Plugin Directory

Changeset 3112236


Ignore:
Timestamp:
07/04/2024 08:11:15 AM (21 months ago)
Author:
myscoot
Message:

timezone code updated

File:
1 edited

Legend:

Unmodified
Added
Removed
  • exly-wp/trunk/public/partials/exly-wp-public-modern.php

    r2872372 r3112236  
    11<?php
    22
     3/*
    34//$timezone = $this->display_time_zone_callback();
    45//print_r($timezone);
     
    1112    $currencyName = 'USD';
    1213}
     14*/
     15
     16function isBrowser() {
     17    return isset($_SERVER['HTTP_USER_AGENT']);
     18}
     19
     20function getLocalStorageItem($key) {
     21    return isset($_COOKIE[$key]) ? $_COOKIE[$key] : null;
     22}
     23
     24function setLocalStorageItem($key, $value) {
     25    setcookie($key, $value, time() + (86400 * 30), "/");
     26}
     27
     28const TIMEZONE_LOCAL_STORAGE_KEYS = [
     29    'SYSTEM_TIMEZONE' => 'system_timezone'
     30];
     31
     32if (!isBrowser()) {
     33    echo 'DEFAULT_TIMEZONE';
     34    return;
     35}
     36
     37$cachedTimezone = getLocalStorageItem(TIMEZONE_LOCAL_STORAGE_KEYS['SYSTEM_TIMEZONE']);
     38if ($cachedTimezone) {
     39    $timezone = $cachedTimezone;
     40} else {
     41    $timezone = 'UTC'; // Default if no cookie is set yet
     42}
     43
     44//echo "Timezone: " . $timezone . "<br>";
     45
     46if ($timezone == 'Asia/Calcutta') {
     47    $currencySymbol = '₹';
     48    $currencyName = 'INR';
     49} else {
     50    $currencySymbol = '$';
     51    $currencyName = 'USD';
     52}
     53
     54//echo "Currency Symbol: " . $currencySymbol . "<br>";
     55//echo "Currency Name: " . $currencyName . "<br>";
     56
    1357
    1458    $isCategorized = $this->get_categorise_type();
Note: See TracChangeset for help on using the changeset viewer.