Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 212
0.00% covered (danger)
0.00%
0 / 20
CRAP
n/a
0 / 0
zeroBSCRM_locale_wpConversionWorkarounds
0.00% covered (danger)
0.00%
0 / 15
0.00% covered (danger)
0.00%
0 / 1
72
zeroBSCRM_locale_utsToDate
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
6
zeroBSCRM_locale_utsToDatetime
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
6
zeroBSCRM_locale_utsToDatetimeWP
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
6
zeroBSCRM_locale_dateToUTS
0.00% covered (danger)
0.00%
0 / 20
0.00% covered (danger)
0.00%
0 / 1
156
zeroBSCRM_date_i18n_plusTime
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
6
zeroBSCRM_date_i18n
0.00% covered (danger)
0.00%
0 / 22
0.00% covered (danger)
0.00%
0 / 1
56
zeroBSCRM_date_defaultFormat
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
zeroBSCRM_date_PHPtoDatePicker
0.00% covered (danger)
0.00%
0 / 39
0.00% covered (danger)
0.00%
0 / 1
2
zeroBSCRM_date_localeForDaterangePicker
0.00% covered (danger)
0.00%
0 / 38
0.00% covered (danger)
0.00%
0 / 1
6
zeroBSCRM_formatCurrency
0.00% covered (danger)
0.00%
0 / 31
0.00% covered (danger)
0.00%
0 / 1
42
zeroBSCRM_format_quantity
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
zeroBSCRM_getLocale
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 1
12
zeroBSCRM_locale_getServerLocale
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
zeroBSCRM_getCurrencyChr
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 1
12
zeroBSCRM_getCurrencyStr
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 1
12
zeroBSCRM_getTimezoneOffset
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
zeroBSCRM_getCurrentTime
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
zeroBSCRM_getDateFormat
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
6
zeroBSCRM_getTimeFormat
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
6
1<?php
2/*
3 * Jetpack CRM
4 * https://jetpackcrm.com
5 * V2.0.6
6 *
7 * Copyright 2020 Automattic
8 *
9 * Date: 24/05/2017
10 */
11
12/*
13======================================================
14    Breaking Checks ( stops direct access )
15    ====================================================== */
16if ( ! defined( 'ZEROBSCRM_PATH' ) ) {
17    exit( 0 );
18}
19/*
20======================================================
21    / Breaking Checks
22    ====================================================== */
23
24// Globals...
25
26    // } Cache of locale... if set (avoids multiple getting for each label)
27    global $zeroBSCRM_locale;
28
29/*
30this isn't used!
31// } Temp mapping for 2.0.6:
32global $zeroBSCRM_localisationTextOverrides; $zeroBSCRM_localisationTextOverrides = array(
33
34    'en-US' => array(
35                    array('County','State'),
36                    array('Postcode','Zip Code'),
37                    array('Mobile Telephone','Cell')
38                )
39
40); */
41
42/*
43    This func was built to centralise "workarounds" where the default
44    WP date config conflicted with that of the jquery datepicker used.
45    ... WH did so 27/2/19
46    ... ultimately this method is clearly flawed somewhere in the linkage though,
47    ... as these keep cropping up.
48
49*/
50function zeroBSCRM_locale_wpConversionWorkarounds( $format = 'd/m/Y' ) {
51
52    // allow for this funky thing here. (only if getting default format)
53    if ( $format == 'F j, Y' ) {
54        $format = 'm/d/Y';
55    }
56    if ( $format == 'jS F Y' ) {
57        $format = 'd/m/Y';
58    }
59    if ( $format == 'j F, Y' ) {
60        $format = 'd/m/Y';
61    }
62
63        // added 27/2/19 JIRA-BS-792
64    if ( $format == 'j. F Y' ) {
65        $format = 'd/m/Y';
66    }
67    if ( $format == 'j F Y' ) {
68        $format = 'd/m/Y';
69    }
70
71        // added 11/03/19 JIRA-ZBS-817
72    if ( $format == 'F j, Y' ) {
73        $format = 'm/d/Y';
74    }
75
76        // Temporary workaround for gh-273, to be addressed in full under gh-313
77    if ( $format === 'Y. F j.' ) {
78        $format = 'Y/d/m';
79    }
80
81        return $format;
82}
83
84// https://codex.wordpress.org/Function_Reference/date_i18n
85function zeroBSCRM_locale_utsToDate( $unixTimestamp = -1 ) {
86    if ( $unixTimestamp === -1 ) {
87        $unixTimestamp = time();
88    }
89    // return date_i18n( get_option( 'date_format' ), $unixTimestamp );
90    return zeroBSCRM_date_i18n( get_option( 'date_format' ), $unixTimestamp );
91}
92// https://codex.wordpress.org/Function_Reference/date_i18n + 'Y-m-d H:i:s'
93function zeroBSCRM_locale_utsToDatetime( $unixTimestamp = -1 ) {
94    if ( $unixTimestamp === -1 ) {
95        $unixTimestamp = time();
96    }
97    // return date_i18n( 'Y-m-d H:i:s', $unixTimestamp );
98    return zeroBSCRM_date_i18n( 'Y-m-d H:i:s', $unixTimestamp );
99}
100
101// same as above but in WP chosen formats
102function zeroBSCRM_locale_utsToDatetimeWP( $unixTimestamp = -1 ) {
103    if ( $unixTimestamp === -1 ) {
104        $unixTimestamp = time();
105    }
106    // return date_i18n( 'Y-m-d H:i:s', $unixTimestamp );
107    return zeroBSCRM_date_i18n( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), $unixTimestamp );
108}
109
110// adapted from https://stackoverflow.com/questions/2891937/strtotime-doesnt-work-with-dd-mm-yyyy-format
111function zeroBSCRM_locale_dateToUTS( $dateInFormat = '', $withTime = false, $specificFormat = false ) {
112
113    try {
114
115        $format = zeroBSCRM_date_defaultFormat();
116        if ( $withTime ) {
117            $format .= ' H:i';
118            // hacky catch of AM/PM + add to format end...?
119            if ( str_contains( $dateInFormat, 'AM' ) || str_contains( $dateInFormat, 'PM' ) ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase
120                $format .= ' A';
121            }
122        }
123
124        // if specificFormat, use that
125        if ( $specificFormat !== false ) {
126            $format = $specificFormat;
127        }
128
129        // debug echo 'from: '.$dateInFormat.' in format '.$format.':';
130
131        // requires php 5.3+
132        $dt = DateTime::createFromFormat( '!' . $format, $dateInFormat );
133
134        // debug  echo 'DT Errors:<pre>'.print_r(DateTime::getLastErrors(),1).'</pre>';
135
136        /*
137        can use this to check for errors:
138            print_r(DateTime::getLastErrors());
139        e.g.
140
141            Array
142            (
143                [warning_count] => 0
144                [warnings] => Array
145                    (
146                    )
147
148                [error_count] => 4
149                [errors] => Array
150                    (
151                        [2] => Unexpected data found.
152                        [5] => Unexpected data found.
153                    )
154
155            ) */
156
157        // if was failed conversion, is set to false
158        // if ($dt !== false)
159        if ( $dt instanceof DateTime ) {
160
161            return $dt->getTimestamp();
162
163        } else {
164            // this only happens when people have $date in one format, but their settings match a diff setting
165
166                // try this
167                $dt = strtotime( $dateInFormat );
168
169                // debug
170                // echo 'from: '.$dateInFormat.' in format '.$format.'... = '.$dt;
171
172            if ( $dt !== false && $dt > 0 ) {
173                return $dt;
174            }
175
176            return false;
177
178        }
179    } catch ( Exception $e ) {
180
181        // debug echo 'error:'.$e->getMessage();
182        try {
183
184                // try this
185                $dt = strtotime( $dateInFormat );
186                // echo 'dt:'.$dateInFormat.'=>'; print_r($dt); echo '!';
187            if ( $dt !== false && $dt > 0 ) {
188                return $dt;
189            }
190        } catch ( Exception $e ) {
191
192            // really not a great date...
193            // echo 'error2:'.$e->getMessage();
194
195        }
196    }
197
198    return false;
199}
200/*
201WH switched this for the above zeroBSCRM_locale_dateToUTS, which is just the next answer down on your original stack overflow link
202... this was good, but that was a little more cleaner/all-encompassing.
203
204// function to convert date to time for ZBS use (since multile dates used) this was a bit of a pig
205// since when updating DB it needs Y-m-d H:i:s format. and strtotime does not work with UK date formats
206// hence the 1 Jan 1970 bug reported in the date picker from Paul (groove-85858971)
207
208function zeroBSCRM_strtotime($date = ''){
209
210
211        $the_format = get_option( 'date_format' );
212        if($the_format == 'd/m/Y' || $the_format = 'jS F Y' || $the_format = 'F j, Y'){
213            $date = str_replace('/', '-', $date);
214        }
215        $unixtime = strtotime($date);
216        return $unixtime;
217} */
218
219// wh added 9/8/18 - adds time to zeroBSCRM_date_i18n, basically
220// ... just appends H:i to format
221// ... had to use for .zbs-date-time datepicker
222function zeroBSCRM_date_i18n_plusTime( $format, $timestamp, $isUTC = false ) {
223
224    // pass -1 to default to WP date
225    if ( $format == -1 ) {
226        $format = zeroBSCRM_date_defaultFormat();
227    }
228
229    // add time
230    $format .= ' H:i';
231
232    return zeroBSCRM_date_i18n( $format, $timestamp, false, $isUTC );
233}
234
235// this is a modified version of 2x answer here, takinginto account +- gmt_offset
236// https://wordpress.stackexchange.com/questions/94755/converting-timestamps-to-local-time-with-date-l18n
237// fully testing + works as at 11/05/18
238// WH: As of 16/8/18 - has extra var $isUTC -
239// this is a workaround for those peeps in non UTC
240// who, when converting dates, were getting back 'offset' dates (this is because we're using timestamps of midnight here)
241function zeroBSCRM_date_i18n( $format, $timestamp, $notused = true, $isUTC = false ) {
242
243    // catch empty timestamps
244    if ( ! is_numeric( $timestamp ) ) {
245        $timestamp = time();
246    }
247
248    // pass -1 to default to WP date
249    if ( $format == -1 ) {
250        $format = zeroBSCRM_date_defaultFormat();
251    }
252
253    // Timezone Support
254
255        // Default:
256        $timezone_str = 'UTC';
257
258        // got a non-utc timestamp str?
259    if ( ! $isUTC ) {
260        $timezone_str = get_option( 'timezone_string' );
261        if ( empty( $timezone_str ) ) {
262
263            // if offset, use that
264            $offsetStr = get_option( 'gmt_offset' );
265            if ( ! empty( $offsetStr ) ) {
266                $offset = $offsetStr * HOUR_IN_SECONDS;
267                return date_i18n( $format, $timestamp + $offset, true );
268            }
269        }
270    }
271        // if still no return, default:
272    if ( empty( $timezone_str ) ) {
273        $timezone_str = 'UTC';
274    }
275
276    // proceed with timezone str:
277    $timezone = new \DateTimeZone( $timezone_str );
278
279    // The date in the local timezone.
280    $date = new \DateTime( 'now', $timezone );
281    $date->setTimestamp( $timestamp );
282    $date_str = $date->format( 'Y-m-d H:i:s' );
283
284    // Pretend the local date is UTC to get the timestamp
285    // to pass to date_i18n().
286    $utc_timezone = new \DateTimeZone( 'UTC' );
287    $utc_date     = new \DateTime( $date_str, $utc_timezone );
288    $timestamp    = $utc_date->getTimestamp();
289
290    return date_i18n( $format, $timestamp, true );
291}
292
293// gets format + returns format (with some mods)
294function zeroBSCRM_date_defaultFormat() {
295
296    $format = get_option( 'date_format' );
297
298    // catch specific issues
299    $format = zeroBSCRM_locale_wpConversionWorkarounds( $format );
300
301    return $format;
302}
303
304// https://stackoverflow.com/questions/16702398/convert-a-php-date-format-to-a-jqueryui-datepicker-date-format
305// further down
306// We need this to take WP locale -> datetimepicker
307// Note: WH added strtoupper, seems to be req. for datetimerangepicker
308/*
309 * Matches each symbol of PHP date format standard
310 * with jQuery equivalent codeword
311 * @author Tristan Jahier
312 */
313function zeroBSCRM_date_PHPtoDatePicker( $format ) {
314
315    // dd M yy
316
317        static $assoc = array(
318            'Y' => 'yyyy',
319            'y' => 'yy',
320            'F' => 'MM',
321            'm' => 'mm',
322            'l' => 'DD',
323            'd' => 'dd',
324            'D' => 'D',
325            'j' => 'd',
326            'M' => 'M',
327            'n' => 'm',
328            'z' => 'o',
329            'N' => '',
330            'S' => 'd',
331            'w' => '',
332            'W' => '',
333            't' => '',
334            'L' => '',
335            'o' => '',
336            'a' => '',
337            'A' => '',
338            'B' => '',
339            'g' => '',
340            'G' => '',
341            'h' => '',
342            'H' => '',
343            'i' => '',
344            's' => '',
345            'u' => '',
346        );
347
348        $keys = array_keys( $assoc );
349
350        $indeces = array_map(
351            function ( $index ) {
352                return '{{' . $index . '}}';
353            },
354            array_keys( $keys )
355        );
356
357        $format = str_replace( $keys, $indeces, $format );
358
359        // Note: WH added strtoupper, seems to be req. for datetimerangepicker
360        return strtoupper( str_replace( $indeces, $assoc, $format ) );
361}
362
363function zeroBSCRM_date_localeForDaterangePicker() {
364
365    $dateTimePickerFormat = 'DD.MM.YYYY';
366    $wpDateFormat         = get_option( 'date_format' );
367
368    if ( ! empty( $wpDateFormat ) ) {
369
370        // catch specific issues
371        $wpDateFormat = zeroBSCRM_locale_wpConversionWorkarounds( $wpDateFormat );
372
373        $dateTimePickerFormat = zeroBSCRM_date_PHPtoDatePicker( $wpDateFormat );
374
375    }
376
377    return array(
378        'format'           => $dateTimePickerFormat,
379
380        'applyLabel'       => __( 'Apply', 'zero-bs-crm' ),
381        'cancelLabel'      => __( 'Clear', 'zero-bs-crm' ),
382        'fromLabel'        => __( 'From', 'zero-bs-crm' ),
383        'toLabel'          => __( 'To', 'zero-bs-crm' ),
384        'customRangeLabel' => __( 'Custom', 'zero-bs-crm' ),
385
386        'separator'        => ' - ',
387
388        'daysOfWeek'       => array(
389            __( 'Su', 'zero-bs-crm' ),
390            __( 'Mo', 'zero-bs-crm' ),
391            __( 'Tu', 'zero-bs-crm' ),
392            __( 'We', 'zero-bs-crm' ),
393            __( 'Th', 'zero-bs-crm' ),
394            __( 'Fr', 'zero-bs-crm' ),
395            __( 'Sa', 'zero-bs-crm' ),
396        ),
397        'monthNames'       => array(
398            __( 'January', 'zero-bs-crm' ),
399            __( 'February', 'zero-bs-crm' ),
400            __( 'March', 'zero-bs-crm' ),
401            __( 'April', 'zero-bs-crm' ),
402            __( 'May', 'zero-bs-crm' ),
403            __( 'June', 'zero-bs-crm' ),
404            __( 'July', 'zero-bs-crm' ),
405            __( 'August', 'zero-bs-crm' ),
406            __( 'September', 'zero-bs-crm' ),
407            __( 'October', 'zero-bs-crm' ),
408            __( 'November', 'zero-bs-crm' ),
409            __( 'December', 'zero-bs-crm' ),
410        ),
411        'firstDay'         => (int) get_option( 'start_of_week', 0 ),
412    );
413
414    /*
415    full possible settings
416    "format": "MM/DD/YYYY",
417        "separator": " - ",
418        "applyLabel": "Apply",
419        "cancelLabel": "Cancel",
420        "fromLabel": "From",
421        "toLabel": "To",
422        "customRangeLabel": "Custom",
423        "daysOfWeek": [
424            "Su",
425            "Mo",
426            "Tu",
427            "We",
428            "Th",
429            "Fr",
430            "Sa"
431        ],
432        "monthNames": [
433            "January",
434            "February",
435            "March",
436            "April",
437            "May",
438            "June",
439            "July",
440            "August",
441            "September",
442            "October",
443            "November",
444            "December"
445        ],
446        "firstDay": 1
447     */
448}
449/*
450Removed 2.14 - opting for _e :)
451
452// } This simply dumps any 'overrides' into the __w function before returning (E.g. County -> State)
453function zeroBSCRM_localiseFieldLabel($labelStr=''){
454
455    global $zeroBSCRM_localisationTextOverrides;
456
457    $locale = zeroBSCRM_getLocale();
458
459    #} Init just checks if set to en_US
460    if (isset($locale) && !empty($locale) && isset($zeroBSCRM_localisationTextOverrides[$locale])){
461
462        #} locale present - replace any?
463        $replacement = $labelStr;
464        foreach ($zeroBSCRM_localisationTextOverrides[$locale] as $repArr){
465
466            if (isset($repArr[0]) && $repArr[0] == $labelStr) $replacement = $repArr[1];
467
468        }
469
470        #} Return replacement or orig..
471        return $replacement;
472
473    }
474
475
476    return $labelStr;
477
478} */
479
480// for JS there's a ver of this in admin.global called zeroBSCRMJS_formatCurrency
481function zeroBSCRM_formatCurrency( $amount ) {
482
483    // see here: https://akrabat.com/using-phps-numberformatter-to-format-currencies/
484    // needs the international PHP extension (hence wrapped in if exists)
485
486    /*
487        You can check if you have the intl extension installed using php -m | grep intl and if you don't then you can install it with apt-get install php5-intl or yum install php-intl assuming you use your distro's stock PHP. (If you compile your own, then --enable-intl is the switch you need.)
488
489    */
490
491    global $zbs;
492
493    /*
494        'currency' => symbol
495        'currency_position' => 0,
496        'currency_format_thousand_separator' => ',',
497        'currency_format_decimal_separator' => '.',
498        'currency_format_number_of_decimals' => 2,
499    */
500
501    // WH would be nice if we could get a GROUP of settings (i.e. just the ones above.. )
502    $settings = $zbs->settings->getAll();
503
504    // defaults declared elsewhere so do I need the below :declare: :bear:
505    $zbscrm_currency_symbol                    = '$';
506    $zbscrm_currency_format_thousand_separator = ',';
507    $zbscrm_currency_format_decimal_separator  = '.';
508    $zbscrm_currency_format_number_of_decimals = 2;
509
510    $zbscrm_currency_symbol   = zeroBSCRM_getCurrencyChr();
511    $zbscrm_currency_position = $settings['currency_position'];
512
513    $zbscrm_currency_format_thousand_separator = $settings['currency_format_thousand_separator'];
514    $zbscrm_currency_format_decimal_separator  = $settings['currency_format_decimal_separator'];
515    $zbscrm_currency_format_number_of_decimals = $settings['currency_format_number_of_decimals'];
516
517    // process the number
518    $formatted_number = number_format(
519        (float) $amount,
520        $zbscrm_currency_format_number_of_decimals,
521        $zbscrm_currency_format_decimal_separator,
522        $zbscrm_currency_format_thousand_separator
523    );
524
525    // add the currecy symbol
526
527    switch ( $zbscrm_currency_position ) {
528        case 0: // left
529            $formatted_amount = $zbscrm_currency_symbol . $formatted_number;
530            break;
531        case 1: // right
532            $formatted_amount = $formatted_number . $zbscrm_currency_symbol;
533            break;
534        case 2: // left with space
535            $formatted_amount = $zbscrm_currency_symbol . ' ' . $formatted_number;
536            break;
537        case 3: // right with space
538            $formatted_amount = $formatted_number . ' ' . $zbscrm_currency_symbol;
539            break;
540        default:   // default to the left
541            $formatted_amount = $zbscrm_currency_symbol . $formatted_number;
542            break;
543
544    }
545
546    return $formatted_amount;
547
548    /*
549    AS OF v2.84+ we shunt everything through the settings rather than the below which seems unreliable
550
551
552
553    $locale = zeroBSCRM_getLocale(true);
554    if(class_exists('NumberFormatter')){
555        $formatter = new NumberFormatter($locale,  NumberFormatter::CURRENCY);
556        return $formatter->formatCurrency($amount, zeroBSCRM_getCurrencyStr());
557    }
558    else{
559
560        // use wp default /// which needs this currency :)
561        return zeroBSCRM_getCurrencyChr().number_format_i18n($amount);
562    }
563
564    */
565}
566
567function zeroBSCRM_format_quantity( $quantity ) {
568    return sprintf( '%g', $quantity );
569}
570
571function zeroBSCRM_getLocale( $full = true ) {
572
573    // phpcs:disable WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase
574    global $zeroBSCRM_locale;
575
576    if ( ! isset( $zeroBSCRM_locale ) ) {
577        $zeroBSCRM_locale = get_bloginfo( 'language' );
578    }
579
580    if ( ! $full ) {
581        $zeroBSCRM_locale_short = str_replace( '_', '-', $zeroBSCRM_locale ); // just in case en_GB?
582        $zeroBSCRM_locale_short = explode( '-', $zeroBSCRM_locale_short )[0];
583        return $zeroBSCRM_locale_short;
584    }
585
586    return $zeroBSCRM_locale;
587    // phpcs:enable WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase
588}
589
590// getLocale wrapper
591function zeroBSCRM_locale_getServerLocale() {
592
593    // https://stackoverflow.com/questions/29932843/php-get-current-locale
594    // limited use, e.g. flywheel returns 'C'
595    return setlocale( LC_ALL, 0 );
596}
597
598/*
599===========================================
600    Helper functions (moved from dal 2.2)
601===========================================
602*/
603    // } Minified get currency func
604function zeroBSCRM_getCurrencyChr() {
605
606    // } Curr
607    $theCurrency     = zeroBSCRM_getSetting( 'currency' );
608    $theCurrencyChar = '&pound;';
609    if ( isset( $theCurrency ) && isset( $theCurrency['chr'] ) ) {
610
611        $theCurrencyChar = $theCurrency['chr'];
612
613    }
614
615    return $theCurrencyChar;
616}
617function zeroBSCRM_getCurrencyStr() {
618
619    // } Curr
620    $theCurrency    = zeroBSCRM_getSetting( 'currency' );
621    $theCurrencyStr = 'GBP';
622    if ( isset( $theCurrency ) && isset( $theCurrency['chr'] ) ) {
623
624        $theCurrencyStr = $theCurrency['strval'];
625
626    }
627
628    return $theCurrencyStr;
629}
630function zeroBSCRM_getTimezoneOffset() {
631
632    return get_option( 'gmt_offset' );
633}
634function zeroBSCRM_getCurrentTime() {
635    return current_time();
636}
637
638    // } Date time formats
639    // http://wordpress.stackexchange.com/questions/591/how-to-get-the-date-format-and-time-format-settings-for-use-in-my-template
640function zeroBSCRM_getDateFormat() {
641
642    // } cache
643    global $zeroBSCRM_dateFormat;
644    if ( isset( $zeroBSCRM_dateFormat ) ) {
645        return $zeroBSCRM_dateFormat;
646    }
647    $zeroBSCRM_dateFormat = get_option( 'date_format' );
648
649    return $zeroBSCRM_dateFormat;
650}
651function zeroBSCRM_getTimeFormat() {
652
653    // } cache
654    global $zeroBSCRM_timeFormat;
655    if ( isset( $zeroBSCRM_timeFormat ) ) {
656        return $zeroBSCRM_timeFormat;
657    }
658    $zeroBSCRM_timeFormat = get_option( 'time_format' );
659
660    return $zeroBSCRM_timeFormat;
661}
662
663    // output locale stuff into header :)
664    // actually left in main .php for now