'); define('PackPATH', get_template_directory() . '/' . (new ThemeStatic)->IntegrationsFolder . '/Layrs/'); define('PackURL', get_template_directory_uri() . '/' . (new ThemeStatic)->IntegrationsFolder . '/Layrs/'); define('WaqfPrices', ['3', '5', '10', '15', '20', '25']); function _obtain_new_token() { $last_token = get_option('recent_salla_token'); if( !isset($last_token['access_token']) ) { return false; }else { $last_token['expires_in'] = (time() + $last_token['expires_in']); update_option('recent_salla_token', $last_token); } $salla_refresh_token = get_option('salla_refresh_token'); if( !empty($salla_refresh_token) ) { $last_token = $salla_refresh_token; } if( time() < $last_token['expires_in'] ) { return $last_token; } $callback_url = home_url('/'); $client_id = get_option('salla_client_id'); $client_secret = get_option('salla_client_secret'); $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://accounts.salla.sa/oauth2/token', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => 'client_id=' . $client_id . '&client_secret=' . $client_secret . '&grant_type=refresh_token&refresh_token=' . $last_token['refresh_token'] . '&redirect_uri=' . urlencode($callback_url), CURLOPT_HTTPHEADER => array( 'Content-Type: application/x-www-form-urlencoded' ), )); $response = curl_exec($curl); $response = json_decode($response, true); if( isset($response['access_token']) ) { update_option('recent_salla_token_expiration', (time() + $response['expires_in'])); update_option('salla_refresh_token', $response); } return $response; } function _salla_token() { if( isset($_REQUEST['code']) and isset($_REQUEST['state']) ) { $callback_url = home_url('/'); $client_id = get_option('salla_client_id'); $client_secret = get_option('salla_client_secret'); $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://accounts.salla.sa/oauth2/token', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => 'client_id=' . $client_id . '&client_secret=' . $client_secret . '&response_type=code&code=' . $_REQUEST['code'] . '&scope=payments.read,offline_access&state=' . $_REQUEST['state'] . '&grant_type=authorization_code&redirect_uri=' . urlencode($callback_url), CURLOPT_HTTPHEADER => array( 'Content-Type: application/x-www-form-urlencoded' ), )); $response = curl_exec($curl); $response = json_decode($response, true); if( isset($response['access_token']) ) { update_option('recent_salla_token', $response); delete_option('salla_refresh_token'); delete_option('waqf_prices_products'); update_option('recent_salla_code', $_REQUEST['code']); update_option('recent_salla_state', $_REQUEST['state']); # Update Banks $banks_list = []; $last_token = _obtain_new_token(); if( isset($last_token['access_token']) ) { $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://api.salla.dev/admin/v2/payment/banks?page&status=active', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', 'Authorization: Bearer ' . $last_token['access_token'] ), )); $response = curl_exec($curl); $response = json_decode($response, true); curl_close($curl); if( isset($response['data']) ) { foreach( $response['data'] as $bank ) { $banks_list[$bank['id']] = $bank['bank_name']; } } } update_option('_salla_banks_list', $banks_list); header( "Location: " . admin_url('?salla_integrated=true') ); die(); } } } add_action("wp_loaded", '_salla_token'); function _create_salla_product($data) { $last_token = _obtain_new_token(); if( !isset($last_token['access_token']) ) return ; $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://api.salla.dev/admin/v2/products', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS =>json_encode([ "name" => $data['name'], "price" => $data['price'], "product_type" => "service", "images" => [ [ "original" => get_option('logo'), ] ], ]), CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', 'Authorization: Bearer ' . $last_token['access_token'] ), )); $response = curl_exec($curl); $response = json_decode($response, true); curl_close($curl); return $response; } function _waqf_prices() { $waqf_prices_products = get_option('waqf_prices_products', []); if( !is_array($waqf_prices_products) ) $waqf_prices_products = []; $added_more = false; foreach( WaqfPrices as $price ) { if( !isset($waqf_prices_products[$price]) ) { $added_more = true; $waqf_prices_products[$price] = _create_salla_product([ "price" => $price, "name" => "Waqf - {$price} USD" ]); } } if( !empty($waqf_prices_products) and $added_more == true ) { update_option('waqf_prices_products', $waqf_prices_products); } return $waqf_prices_products; } add_action("wp_loaded", '_waqf_prices'); function _create_payment_url($price, $clientData) { $last_token = _obtain_new_token(); $_waqf_prices = _waqf_prices(); $selected_product = false; if( isset($_waqf_prices[$price]) ) { $selected_product = $_waqf_prices[$price]['data']['id']; }else { return ; } $salla_bank_id = get_option('salla_bank_id'); $salla_phone = get_option('salla_phone'); $salla_email = get_option('salla_email'); $salla_client_phone = get_option('salla_client_phone'); # Create Order $jsonData = json_encode([ "customer" => [ "name" => $clientData['name'], "email" => $clientData['email'], "mobile" => $salla_client_phone, ], "receiver" => [ "name" => get_option('salla_display_name'), "country_code" => "SA", "phone" => $salla_phone, "email" => $salla_email, "notify" => true ], "payment" => [ "status" => 'pending_payment', "bank_id" => $salla_bank_id, "accepted_methods" => ["bank"] ], "products" => [ [ "identifier_type" => "id", "identifier" => $selected_product, "quantity" => 1 ], ] ]); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://api.salla.dev/admin/v2/orders'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData); $headers = array(); $headers[] = 'Content-Type: application/json'; $headers[] = 'Authorization: Bearer ' . $last_token['access_token']; curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $result = curl_exec($ch); if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); } curl_close($ch); $result = json_decode($result, true); # Return Data return $result; } // # Money Format # // function _money_format($money = false) { if( empty($money) ) $money = '0'; $formatter = new NumberFormatter('en_US', NumberFormatter::CURRENCY); return $formatter->formatCurrency($money, 'USD'); } // # \ Money Format # // function _logo_url($type = '') { $url = function($val) { if( isset($val['url']) ) return $val['url']; return ''; }; if( $type == 'favicon' ) { return $url(get_option('favicon')); } return $url(get_option("logo")); } function _reading_minutes( $content ) { $res = preg_split('/\s+/', strip_tags($content)); $count = count($res); return ceil($count / 120); } function _currentModel() { global $post; if( isset($post->post_type) ) { if( $post->post_type == 'page' ) { return get_post_meta($post->ID, 'template', true); } } return 'default'; } function _modelURL($id) { $query = get_posts( array( "post_type" => 'page', "posts_per_page" => 1, "meta_query" => [ [ "key" => 'template', "compare" => '==', "value" => $id ] ] ) ); foreach( $query as $page ) { return get_the_permalink($page->ID); } return '#'; } function _packURL($name) { if( mb_substr($name, 0, 1) == '#' ) $name = urlencode($name); $url = PackURL . "{$name}/"; return $url; } function _packPATH($name) { if( mb_substr($name, 0, 1) == '#' ) $name = $name; $url = PackPATH . "{$name}/"; return $url; } function __loc($string, $vars=[]) { foreach( $vars as $k => $v ) { $string = str_replace('{' . $k . '}', $v, $string); } return $string; } function _date_by_tz($format, $time=false, $tz=false, $modify=false) { if( $tz == false ) $tz = _system_timezone(); if( is_numeric($time) ) { $date = new DateTime(); $date->setTimestamp($time); if( $tz != false ) $date->setTimezone(new DateTimeZone($tz)); }else { if( $tz != false ) { $date = new DateTime($time, new DateTimeZone($tz)); }else { $date = new DateTime($time); } } if( $modify != false ) { $date->modify($modify); } $time = $date->format($format); return $time; } function getContrastColor($hexColor) { // hexColor RGB $R1 = hexdec(substr($hexColor, 1, 2)); $G1 = hexdec(substr($hexColor, 3, 2)); $B1 = hexdec(substr($hexColor, 5, 2)); // Black RGB $blackColor = "#000000"; $R2BlackColor = hexdec(substr($blackColor, 1, 2)); $G2BlackColor = hexdec(substr($blackColor, 3, 2)); $B2BlackColor = hexdec(substr($blackColor, 5, 2)); // Calc contrast ratio $L1 = 0.2126 * pow($R1 / 255, 2.2) + 0.7152 * pow($G1 / 255, 2.2) + 0.0722 * pow($B1 / 255, 2.2); $L2 = 0.2126 * pow($R2BlackColor / 255, 2.2) + 0.7152 * pow($G2BlackColor / 255, 2.2) + 0.0722 * pow($B2BlackColor / 255, 2.2); $contrastRatio = 0; if ($L1 > $L2) { $contrastRatio = (int)(($L1 + 0.05) / ($L2 + 0.05)); } else { $contrastRatio = (int)(($L2 + 0.05) / ($L1 + 0.05)); } // If contrast is more than 5, return black color if ($contrastRatio > 5) { return '#000000'; } else { // if not, return white color. return '#FFFFFF'; } } function _useravatar($uid=false, $size='avatar-50') { if( $uid == false || !is_numeric($uid) ) { global $current_user; $uid = $current_user->ID; } $user = get_userdata($uid); if( !isset($user->ID) ) return false; $avatar_url = _useravatar_url($uid, $size); if( !$avatar_url ) { ob_start(); echo ''; echo ''; echo ''; return ob_get_clean(); } ob_start(); echo ''; echo ''.$user->display_name.''; echo ''; return ob_get_clean(); } function _useravatar_url($uid=false, $size='avatar-50') { if( $uid == false || !is_numeric($uid) ) { global $current_user; $uid = $current_user->ID; } $user = get_userdata($uid); if( !isset($user->ID) ) return false; $avatar = $user->avatar_url; # if avatar exists $homeURL = str_replace('/' . CurrentLanguage . '/', '/', home_url()); $homePath = (new ThemeStatic)->get_home_path(); $avatarCheckerPATH = str_replace( $homeURL, $homePath, $avatar ); if( !file_exists($avatarCheckerPATH) or filesize($avatarCheckerPATH) < 100 ) { $avatar = ''; } # \ if avatar exists if( !empty($avatar) ) return $avatar; if( isset(get_option('default_avatar')['id']) ) { $default_avatar = wp_get_attachment_image_src( get_option('default_avatar')['id'], $size ); if( isset($default_avatar[0]) ) return $default_avatar[0]; } return false; } function _mkdir($path) { if( !is_dir($path) ) { $tags = explode('/' ,$path); // explode the full path $mkDir = ""; foreach($tags as $folder) { $mkDir = $mkDir . $folder ."/"; // make one directory join one other for the nest directory to make if(!is_dir($mkDir)) { // check if directory exist or not mkdir($mkDir, 0777); // if not exist then make the directory file_put_contents( $mkDir . '/index.php', '' ); } } } if( file_exists($path . '/index.php') ) { file_put_contents( $path . '/index.php', '' ); } return $path; } function calculateFileDuration($file, $justseconds=false){ $ratio = 16000; //bytespersec if (!$file) { return '00:00'; } $file_size = filesize($file); if (!$file_size) return '00:00'; $duration = ($file_size / $ratio); $minutes = floor($duration / 60); $seconds = $duration - ($minutes * 60); $seconds = round($seconds); if( $justseconds == true ) { $seconds = $seconds + ($minutes * 60); return $seconds; } $minutes = str_pad($minutes, 2, STR_PAD_LEFT, '0'); $seconds = str_pad($seconds, 2, STR_PAD_LEFT, '0'); return "$minutes:$seconds"; } function is_valid_domain_name($url){ $parse = parse_url($url); if( isset($parse['host']) ) { if( !empty($parse['host']) ) { $url = $parse['host']; } } return (preg_match("/^([a-z\d](-*[a-z\d])*)(\.([a-z\d](-*[a-z\d])*))*$/i", $url) //valid chars check && preg_match("/^.{1,253}$/", $url) //overall length check && preg_match("/^[^\.]{1,63}(\.[^\.]{1,63})*$/", $url) ); //length of each label } # Dates Display # // if( !function_exists("_system_date") ) { function _system_date($timezone = 'UTC') { date_default_timezone_set("UTC"); return time(); } } if( !function_exists("_bp_display_date") ) { function _bp_display_date($time){ $periods = array("ثانية", "دقيقة", "ساعة", "يوم", "اسبوع", "شهر", "سنة", "عقد"); $lengths = array("60","60","24","7","4.35","12","10"); $now = _system_date(); $difference = $now - $time; for($j = 0; $difference >= $lengths[$j] && $j < count($lengths)-1; $j++) { $difference /= $lengths[$j]; } $difference = round($difference); if($difference != 1) { #$periods[$j].= "s"; } if( $difference == 0 and strpos($periods[$j], 'second') !== false ) { return __loc('منذ ثانية واحدة'); } if( $difference <= 0 ) $difference = 1; return __loc("منذ {diff} {$periods[$j]}", array( "diff" => $difference, )); } } # \ Dates Display # // // # Deep Stripslashes // if( !function_exists('stripslashes_deep') ) { function stripslashes_deep($value){ foreach( $value as $k => $v ) { if( is_array($v) ) { $value[$k] = stripslashes_deep($v); }else { $value[$k] = stripslashes($v); } } return $value; } } // # \ Deep Stripslashes //ThemeStatic = new ThemeStatic; } public function QueryEndpoint() { add_rewrite_endpoint( 'AjaxCenter', EP_ROOT ); } public function AjaxCenterPage() { if($AjaxCenter = get_query_var('AjaxCenter')){ $Action = explode('/', $AjaxCenter)[0]; $Params = ( ( isset( explode($Action.'/', $AjaxCenter)[1] ) ) ) ? explode($Action.'/', $AjaxCenter)[1] : ''; $AjaxCenterPath = get_template_directory().'/Integrations/Layrs/AjaxCenter/'; $AjaxCenterURL = get_template_directory_uri().'/Integrations/Layrs/AjaxCenter/'; require(get_template_directory().'/Integrations/Layrs/AjaxCenter/'.$Action.'.php'); die(); } } public function ExtractAjaxData($url){ $Retruner = array(); $Params = explode('/', $url); $Count = count($Params) / 2; $Filters = array(); $offset = 0; for ($i=0; $i <= $Count; $i++) { $k = 0; foreach (array_slice($Params, $offset, 2) as $v) {$k++; if( $k == 1 ) { $param = urldecode($v); }else if( $k == 2 ) { $val = urldecode($v); $ID = urldecode($v); } } if( isset($Filters[$param]) ) { if( is_array($Filters[$param]['value']) ) { $val = $Filters[$param]['value']; $val[] = urldecode($ID); }else { $val = array(urldecode($ID), $Filters[$param]['value']); } $Filters[$param]['value'] = array_unique($val); }else { $Filters[$param] = array( 'param'=>$param, 'value'=>$val ); } $offset = $offset + 2; } foreach ($Filters as $v) { $_GET[$v['param']] = (is_array($v['value'])) ? $v['value'][0] : $v['value']; } //return $Retruner; } public function Setup() { add_action( 'init', array( $this, 'QueryEndpoint' ) ); add_action( 'BeforeHeader', array( $this, 'AjaxCenterPage' ) ); } } (new AjaxCenter)->Setup(); $locale_language, 'region' => $locale_region ); if (strtolower($language_code) == strtolower($locale_language)){ return $locale_array['region']; }else if (strtolower($language_code_exp) == strtolower($locale_language)){ return $locale_array['region']; } } return null; } function country_code_to_locale($country_code, $language_code = '') { $locales = __locales(); foreach ($locales as $locale) { $locale_region = locale_get_region($locale); $locale_language = locale_get_primary_language($locale); $locale_array = array('language' => $locale_language, 'region' => $locale_region); if (strtoupper($country_code) == $locale_region && $language_code == '') { return $locale_array['language']; } elseif (strtoupper($country_code) == $locale_region && strtolower($language_code) == $locale_language) { return $locale_array['language']; } } return null; } function languages_list() { $languages_names = array( 'ar' => ( CurrentLanguage == 'ar' ) ? 'العربية' : 'Arabic', 'en' => 'English', 'fr' => 'French', 'af' => 'Afrikaans', 'sq' => 'Albanian', 'am' => 'Amharic', 'hy' => 'Armenian', 'as' => 'Assamese', 'ay' => 'Aymara', 'az' => 'Azerbaijani', 'bm' => 'Bambara', 'eu' => 'Basque', 'be' => 'Belarusian', 'bn' => 'Bengali', 'bho' => 'Bhojpuri', 'bs' => 'Bosnian', 'bg' => 'Bulgarian', 'ca' => 'Catalan', 'ceb' => 'Cebuano', 'ny' => 'Chichewa', 'zh-CN' => 'Chinese (Simplified)', 'zh-TW' => 'Chinese (Traditional)', 'co' => 'Corsican', 'hr' => 'Croatian', 'cs' => 'Czech', 'da' => 'Danish', 'dv' => 'Dhivehi', 'doi' => 'Dogri', 'nl' => 'Dutch', 'eo' => 'Esperanto', 'et' => 'Estonian', 'ee' => 'Ewe', 'tl' => 'Filipino', 'fi' => 'Finnish', 'fy' => 'Frisian', 'gl' => 'Galician', 'ka' => 'Georgian', 'de' => 'German', 'el' => 'Greek', 'gn' => 'Guarani', 'gu' => 'Gujarati', 'ht' => 'Haitian Creole', 'ha' => 'Hausa', 'haw' => 'Hawaiian', 'iw' => 'Hebrew', 'hi' => 'Hindi', 'hmn' => 'Hmong', 'hu' => 'Hungarian', 'is' => 'Icelandic', 'ig' => 'Igbo', 'ilo' => 'Ilocano', 'id' => 'Indonesian', 'ga' => 'Irish', 'it' => 'Italian', 'ja' => 'Japanese', 'jw' => 'Javanese', 'kn' => 'Kannada', 'kk' => 'Kazakh', 'km' => 'Khmer', 'rw' => 'Kinyarwanda', 'gom' => 'Konkani', 'ko' => 'Korean', 'kri' => 'Krio', 'ku' => 'Kurdish (Kurmanji)', 'ckb' => 'Kurdish (Sorani)', 'ky' => 'Kyrgyz', 'lo' => 'Lao', 'la' => 'Latin', 'lv' => 'Latvian', 'ln' => 'Lingala', 'lt' => 'Lithuanian', 'lg' => 'Luganda', 'lb' => 'Luxembourgish', 'mk' => 'Macedonian', 'mai' => 'Maithili', 'mg' => 'Malagasy', 'ms' => 'Malay', 'ml' => 'Malayalam', 'mt' => 'Maltese', 'mi' => 'Maori', 'mr' => 'Marathi', 'mni-Mtei' => 'Meiteilon (Manipuri)', 'lus' => 'Mizo', 'mn' => 'Mongolian', 'my' => 'Myanmar (Burmese)', 'ne' => 'Nepali', 'no' => 'Norwegian', 'or' => 'Odia (Oriya)', 'om' => 'Oromo', 'ps' => 'Pashto', 'fa' => 'Persian', 'pl' => 'Polish', 'pt' => 'Portuguese', 'pa' => 'Punjabi', 'qu' => 'Quechua', 'ro' => 'Romanian', 'ru' => 'Russian', 'sm' => 'Samoan', 'sa' => 'Sanskrit', 'gd' => 'Scots Gaelic', 'nso' => 'Sepedi', 'sr' => 'Serbian', 'st' => 'Sesotho', 'sn' => 'Shona', 'sd' => 'Sindhi', 'si' => 'Sinhala', 'sk' => 'Slovak', 'sl' => 'Slovenian', 'so' => 'Somali', 'es' => 'Spanish', 'su' => 'Sundanese', 'sw' => 'Swahili', 'sv' => 'Swedish', 'tg' => 'Tajik', 'ta' => 'Tamil', 'tt' => 'Tatar', 'te' => 'Telugu', 'th' => 'Thai', 'ti' => 'Tigrinya', 'ts' => 'Tsonga', 'tr' => 'Turkish', 'tk' => 'Turkmen', 'ak' => 'Twi', 'uk' => 'Ukrainian', 'ur' => 'Urdu', 'ug' => 'Uyghur', 'uz' => 'Uzbek', 'vi' => 'Vietnamese', 'cy' => 'Welsh', 'xh' => 'Xhosa', 'yi' => 'Yiddish', 'yo' => 'Yoruba', 'zu' => 'Zulu', ); return $languages_names; } function language_code_to_name($lang) { $lang = strtolower($lang); $languages_names = languages_list(); if( isset($languages_names[$lang]) ) { return $languages_names[$lang]; } return ''; }'; echo '
  • '; echo ''; echo ''.((is_single()) ? '' : '').get_option('sitename').''; echo ''; echo '
  • '; if( is_page() ) { global $post; if( $post->post_parent == 0 ) { $position++; echo '
  • '; echo ''; echo ''.$post->post_title.''; echo ''; echo '
  • '; }else { $position++; echo '
  • '; echo ''; echo ''.get_the_title($post->post_parent).''; echo ''; echo '
  • '; $position++; echo '
  • '; echo ''; echo ''.$post->post_title.''; echo ''; echo '
  • '; } }else if( is_single() ) { global $post; $category = (is_array(get_the_terms($post->ID, 'category', ''))) ? get_the_terms($post->ID, 'category', '') : array(); foreach ( array_slice($category,0,2) as $cat) { $position++; echo '
  • '; echo ''; echo ''.$cat->name.''; echo ''; echo '
  • '; } $services = (is_array(get_the_terms($post->ID, 'services', ''))) ? get_the_terms($post->ID, 'services', '') : array(); if( !empty( $services ) ){ foreach ( array_slice($services,0,2) as $serv) { echo '
  • '; echo ''; echo ''.$serv->name.''; echo ''; echo '
  • '; } } $position++; echo '
  • '; echo ''; echo ''.$post->post_title.''; echo ''; echo '
  • '; }else if(null !== get_query_var('search') ) { $SearchQuery = urldecode(get_query_var('search')); $position++; echo '
  • '; echo ''; echo 'نتائج البحث عن : '.$SearchQuery.''; echo ''; echo '
  • '; }else if( is_category() ) { $obj = get_queried_object(); $parentID = 0; if( $obj->parent > 0 ) $parentID = $obj->parent; if( $parentID == 0 ) { $position++; echo '
  • '; echo ''; echo ''.$obj->name.''; echo ''; echo '
  • '; }else { if( $parentID != $obj->term_id ) { $position++; $parent = get_term($parentID, 'category'); echo '
  • '; echo ''; echo ''.$parent->name.''; echo ''; echo '
  • '; } $position++; echo '
  • '; echo ''; echo ''.$obj->name.''; echo ''; echo '
  • '; } }else if( is_tag() or is_tax('services') or is_tax('filters') or is_tax('ratingbars') or is_tax('stores') or is_tax('statistics') or is_tax('customers') ) { $obj = get_queried_object(); $parentID = 0; if( $obj->parent > 0 ) { $parentID = $obj->parent; }else if( get_term_meta($obj->term_id, 'parentc', true) > 0 ) { $parentID = get_term_meta($obj->term_id, 'parentc', true); } if( $parentID == 0 ) { $position++; echo '
  • '; echo ''; echo ''.$obj->name.''; echo ''; echo '
  • '; }else { $position++; $parent = get_term($parentID, $obj->taxonomy); echo '
  • '; echo ''; echo ''.$parent->name.''; echo ''; echo '
  • '; $position++; echo '
  • '; echo ''; echo ''.$obj->name.''; echo ''; echo '
  • '; } }else if( is_author() ) { $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author')); $position++; echo '
  • '; echo ''; echo ''.$curauth->display_name.''; echo ''; echo '
  • '; } if( (new ThemeStatic)->Paged() > 1 ) { $position++; echo '
  • '; echo ''; echo 'صفحة '.(new ThemeStatic)->Paged().''; echo ''; echo '
  • '; } echo ''; }human_time_diff( date('U', $time), current_time('timestamp') ))); }else { $displayed = date_i18n('l, d F', $time); } } return $displayed; } // # Dates Display # // function _display_date($time){ $periods = array("second", "minute", "hour", "day", "week", "month", "year", "decade"); $lengths = array("60","60","24","7","4.35","12","10"); $now = time(); $difference = $now - $time; for($j = 0; $difference >= $lengths[$j] && $j < count($lengths)-1; $j++) { $difference /= $lengths[$j]; } $difference = round($difference); if($difference != 1) { $periods[$j].= "s"; } if( $difference == 0 and strpos($periods[$j], 'second') !== false ) { return __loc('a few moments ago'); } return __loc("{diff} {$periods[$j]} ago", array( "diff" => $difference, )); } // # \ Dates Display # //'; echo ''; echo ''; # Styles echo ''; echo ''; echo ''; echo ''; echo ''; if (is_single()) { echo ''; } if( IsSpeed() == false ) { echo ''; echo ''; echo ''; echo ''; } }); // # Footer add_action("Waqf_front_footer", function(){ $variables = [ "HomeURL" => home_url(), "AjaxCenterURL" => home_url("/AjaxCenter/"), ]; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; });