Website : phonehp.ir
backdoor
Warning
: Undefined variable $backdoor in
/home/nehpir/public_html/goods.php
on line
326
Home
Console
Warning
: Undefined variable $backdoor in
/home/nehpir/public_html/goods.php
on line
326
Warning
: Undefined variable $backdoor in
/home/nehpir/public_html/goods.php
on line
326
Warning
: Undefined variable $backdoor in
/home/nehpir/public_html/goods.php
on line
326
Warning
: Undefined variable $backdoor in
/home/nehpir/public_html/goods.php
on line
326
Warning
: Undefined variable $backdoor in
/home/nehpir/public_html/goods.php
on line
326
Warning
: Undefined variable $backdoor in
/home/nehpir/public_html/goods.php
on line
326
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
nehpir
/
www
/
wp-content
/
plugins
/
woocommersa
/
includes
/
Core
/
Filename :
Utils.php
back
Warning
: Undefined variable $file in
/home/nehpir/public_html/goods.php
on line
545
Copy
<?php namespace WooCommersa\Core; if (!defined('ABSPATH')) exit; class Utils { /** * Normalize numeric strings (Persian/Arabic digits to Western) */ public static function normalize_number($value) { if (!is_string($value) && !is_numeric($value)) return $value; $persian = ['۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹']; $arabic = ['٠', '١', '٢', '٣', '٤', '٥', '٦', '٧', '٨', '٩']; $num = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']; $value = str_replace($persian, $num, $value); $value = str_replace($arabic, $num, $value); // Remove currency symbols and separators, keep decimal point $value = preg_replace('/[^\d.]/', '', $value); return floatval($value); } /** * Detect the brand taxonomy used in the site */ public static function get_brand_taxonomy() { $settings = get_option('woocommersa_settings', []); $custom_slug = !empty($settings['brand_taxonomy_slug']) ? $settings['brand_taxonomy_slug'] : ''; if (!empty($custom_slug) && taxonomy_exists($custom_slug)) { return $custom_slug; } // Priority 0: Hard-force for user site if (taxonomy_exists('product_brand')) return 'product_brand'; $taxonomies = get_object_taxonomies('product'); $common_slugs = [ 'pwb-brand', 'brand', 'brands', 'yith_product_brand', 'pa_brand', 'pa_brands', 'product_brands', 'wcb_category' ]; foreach ($common_slugs as $slug) { if (in_array($slug, $taxonomies)) return $slug; } // Search fallback for any taxonomy containing "brand" foreach ($taxonomies as $tax) { if (strpos($tax, 'brand') !== false) return $tax; } // Final fallback: Look for anything that might be brands (like 'manufacturer' or 'make') foreach (['manufacturer', 'make', 'label'] as $fallback) { if (in_array($fallback, $taxonomies)) return $fallback; } return ''; } /** * Convert Gregorian date to Jalali */ public static function jalali_date($format, $timestamp = null) { if ($timestamp === null) $timestamp = time(); // If wp-jalali or similar plugin is active, use its jdate function if (function_exists('jdate')) { return jdate($format, $timestamp); } $g_y = date('Y', $timestamp); $g_m = date('m', $timestamp); $g_d = date('d', $timestamp); $j_date = self::gregorian_to_jalali($g_y, $g_m, $g_d); $jy = $j_date[0]; $jm = $j_date[1]; $jd = $j_date[2]; // Simple format support (Y/m/d) $res = $format; $res = str_replace('Y', $jy, $res); $res = str_replace('m', str_pad($jm, 2, '0', STR_PAD_LEFT), $res); $res = str_replace('d', str_pad($jd, 2, '0', STR_PAD_LEFT), $res); $res = str_replace('H', date('H', $timestamp), $res); $res = str_replace('i', date('i', $timestamp), $res); return $res; } public static function gregorian_to_jalali($gy, $gm, $gd) { $g_d_m = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334]; $gy2 = ($gm > 2) ? ($gy + 1) : $gy; $days = 355666 + (365 * $gy) + (int)(($gy2 + 3) / 4) - (int)(($gy2 + 99) / 100) + (int)(($gy2 + 399) / 400) + $gd + $g_d_m[$gm - 1]; $jy = -1595 + (33 * (int)($days / 12053)); $days %= 12053; $jy += 4 * (int)($days / 1461); $days %= 1461; if ($days > 365) { $jy += (int)(($days - 1) / 365); $days = ($days - 1) % 365; } if ($days < 186) { $jm = 1 + (int)($days / 31); $jd = 1 + ($days % 31); } else { $jm = 7 + (int)(($days - 186) / 30); $jd = 1 + (($days - 186) % 30); } return [$jy, $jm, $jd]; } }