PATH:
home
/
lab2454c
/
sothebankuab.com
/
wp-content
/
themes
/
tryo
/
inc
<?php /** * Functions which enhance the theme by hooking into WordPress * @package Tryo */ /** * Tryo Preloader */ if ( ! function_exists( 'tryo_preloader' ) ) { function tryo_preloader() { global $tryo_opt; if( isset( $tryo_opt['enable_preloader'] ) ): $is_preloader = $tryo_opt['enable_preloader']; else: $is_preloader = true; endif; $preloader_style = !empty($tryo_opt['preloader_style']) ? $tryo_opt['preloader_style'] : 'circle-spin'; if( $is_preloader == true ): if ( defined( 'ELEMENTOR_VERSION' ) ) : if (\Elementor\Plugin::$instance->preview->is_preview_mode()) : echo ''; else: if ( $preloader_style == 'text' ) : if (!empty( $tryo_opt['loading_text'] ) ) : ?> <div class="preloader"> <div class="loader"> <p class="text-center"> <?php echo esc_html( $tryo_opt['loading_text'] ) ?> </p> </div> </div> <?php endif; elseif( $preloader_style == 'circle-spin' ) : ?> <div class="preloader"> <div class="loader"> <div class="shadow"></div> <div class="box"></div> </div> </div> <?php else: ?> <div class="preloader preloader-area preloader-img"> <div class="loader"> </div> </div> <?php endif; endif; else: if ( $preloader_style == 'text' ) : if (!empty( $tryo_opt['loading_text'] ) ) : ?> <div class="preloader"> <div class="loader"> <p class="text-center"> <?php echo esc_html( $tryo_opt['loading_text'] ) ?> </p> </div> </div> <?php endif; elseif( $preloader_style == 'circle-spin' ) : ?> <div class="preloader"> <div class="loader"> <div class="shadow"></div> <div class="box"></div> </div> </div> <?php else : ?> <div class="preloader preloader-area preloader-img"> <div class="loader"> </div> </div> <?php endif; endif; endif; } } /** * tryo RTL */ if( ! function_exists( 'tryo_rtl' ) ): function tryo_rtl() { global $tryo_opt; if( isset( $tryo_opt['tryo_enable_rtl']) ): $tryo_rtl_opt = $tryo_opt['tryo_enable_rtl']; else: $tryo_rtl_opt = 'disable'; endif; if ( isset( $_GET['rtl'] ) ) { $tryo_rtl_opt = $_GET['rtl']; } if( $tryo_rtl_opt == 'enable' ): $tryo_rtl = true; else: $tryo_rtl = false; endif; return $tryo_rtl; } endif; /** * Tryo Main Logo */ if ( ! function_exists( 'tryo_main_logo' ) ) : function tryo_main_logo() { global $tryo_opt; if(isset($tryo_opt['main_logo']['url'])): $logo = $tryo_opt['main_logo']['url']; else: $logo = ''; endif; if ( $logo != '' ) : ?> <img class="main-logo" src="<?php echo esc_url( $logo ); ?>" alt='<?php echo esc_attr( bloginfo( 'name' ) ); ?>'> <?php else: ?> <h2><?php bloginfo( 'name' ); ?></h2> <?php endif; } endif; /** * Tryo Sticky Logo */ if ( ! function_exists( 'tryo_sticky_logo' ) ) : function tryo_sticky_logo() { global $tryo_opt; if(isset($tryo_opt['sticky_logo']['url'])): $logo = $tryo_opt['sticky_logo']['url']; else: $logo = ''; endif; if ( $logo != '' ) : ?> <img src="<?php echo esc_url( $logo ); ?>" alt='<?php echo esc_attr( bloginfo( 'name' ) ); ?>'> <?php else: ?> <h2><?php bloginfo( 'name' ); ?></h2> <?php endif; } endif; /** * Footer Logo */ if ( ! function_exists( 'tryo_footer_logo' ) ) : function tryo_footer_logo() { global $tryo_opt; if(isset($tryo_opt['footer_logo']['url'])): $logo = $tryo_opt['footer_logo']['url']; else: $logo = ''; endif; if ( $logo != '' ) : ?> <img src="<?php echo esc_url( $logo ); ?>" alt='<?php echo esc_attr( bloginfo( 'name' ) ); ?>'> <?php else: ?> <h2><?php bloginfo( 'name' ); ?></h2> <?php endif; } endif; /** * Primary Nav */ if ( ! function_exists( 'tryo_main_nav' ) ) : function tryo_main_nav() { $primary_nav_arg = [ 'menu' => 'primary', 'theme_location' => 'primary', 'container' => null, 'menu_class' => 'navbar-nav main-menu ml-auto', 'depth' => 3, 'walker' => new Tryo_Bootstrap_Navwalker(), 'fallback_cb' => 'Tryo_Bootstrap_Navwalker::fallback', ]; if(has_nav_menu('primary')){ wp_nav_menu($primary_nav_arg); } } endif; if ( ! function_exists( 'tryo_main_nav_login' ) ) : function tryo_main_nav_login() { $primary_nav_arg = [ 'menu' => 'primarylogin', 'theme_location' => 'primarylogin', 'container' => null, 'menu_class' => 'navbar-nav main-menu ml-auto', 'depth' => 3, 'walker' => new Tryo_Bootstrap_Navwalker(), 'fallback_cb' => 'Tryo_Bootstrap_Navwalker::fallback', ]; if(has_nav_menu('primarylogin')){ wp_nav_menu($primary_nav_arg); } } endif; function tryo_function_pcs() { $purchase_code = htmlspecialchars(get_option( 'tryo_purchase_code' )); $purchase_code = str_replace(' ', '', $purchase_code); if( $purchase_code != '' ){ require get_template_directory().'/inc/verify/class.verify-purchase.php'; $o = EnvatoApi2::verifyPurchase( $purchase_code ); if ( is_object($o) && strpos($o->item_name, 'Tryo') !== false ) { // Check in localhost $whitelist = array( '127.0.0.1', '::1' ); if(!in_array($_SERVER['REMOTE_ADDR'], $whitelist)){ // In server $url = 'https://api.envytheme.com/api/v1/license'; $purchaseKey = $purchase_code; $itemName = $o->item_name; $buyer = $o->buyer; $purchasedAt = $o->created_at; $supportUntil = $o->supported_until; $licenseType = $o->licence; $domain = get_site_url(); $post_url = ''; $post_url .= $url.'?purchaseKey='.$purchaseKey.'&itemName='.$itemName.'&buyer='.$buyer.'&purchasedAt='.$purchasedAt.'&supportUntil='.$supportUntil.'&licenseType='.$licenseType.'&domain='.$domain.''; $post_url = str_replace(' ', '%', $post_url); $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => $post_url, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_HTTPHEADER => array( "cache-control: no-cache", "content-type: application/x-www-form-urlencoded" ), CURLOPT_SSL_VERIFYPEER => false, )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { $json = json_decode($response); $already_registered = $json->message[0]; // Already registered $new_response = ''; $new_response .= 'Congratulations! Updated for this domain '.$domain.''; preg_match_all('#https?://[^,\s()<>]+(?:\([\w\d]+\)|([^,[:punct:]\s]|/))#', $already_registered, $match); $url = $match[0]; $protocols = array('http://', 'http://www.', 'www.', 'https://', 'https://www.'); $domain_name = str_replace( $protocols, '', $url[0] ); $site_url = str_replace( $protocols, '', get_site_url() ); if( $already_registered != '' ){ if( $already_registered == $new_response ): update_option('tryo_purchase_code_status', 'valid', 'yes'); update_option('tryo_purchase_valid_code', $purchase_code, 'yes'); update_option('tryo_valid_url', $domain, 'yes'); update_option('valid_url', get_site_url(), 'yes'); ?><script>let date = new Date(Date.now() + 604800); date = date.toUTCString(); document.cookie = "ET_L_Status=<?php echo $purchase_code; ?>; expires=" + date; </script><?php elseif( $domain_name == $site_url ): /* Deregister */ $url = 'https://api.envytheme.com/api/v1/license'; $purchaseKey = $purchase_code; $status = 'disabled'; $post_url = ''; $post_url .= $url.'?purchaseKey='.$purchaseKey.'&status='.$status.''; $post_url = str_replace(' ', '%', $post_url); $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => $post_url, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "PUT", CURLOPT_HTTPHEADER => array( "cache-control: no-cache", "content-type: application/x-www-form-urlencoded" ), CURLOPT_SSL_VERIFYPEER => false, )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); /* Deregister */ /* Register */ $url = 'https://api.envytheme.com/api/v1/license'; $purchaseKey = $purchase_code; $itemName = $o->item_name; $buyer = $o->buyer; $purchasedAt = $o->created_at; $supportUntil = $o->supported_until; $licenseType = $o->licence; $domain = get_site_url(); $post_url = ''; $post_url .= $url.'?purchaseKey='.$purchaseKey.'&itemName='.$itemName.'&buyer='.$buyer.'&purchasedAt='.$purchasedAt.'&supportUntil='.$supportUntil.'&licenseType='.$licenseType.'&domain='.$domain.''; $post_url = str_replace(' ', '%', $post_url); $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => $post_url, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_HTTPHEADER => array( "cache-control: no-cache", "content-type: application/x-www-form-urlencoded" ), CURLOPT_SSL_VERIFYPEER => false, )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); /* Register */ update_option('tryo_purchase_code_status', 'valid', 'yes'); update_option('tryo_purchase_valid_code', $purchase_code, 'yes'); update_option('tryo_valid_url', $domain, 'yes'); update_option('valid_url', get_site_url(), 'yes'); ?><script>let date = new Date(Date.now() + 604800); date = date.toUTCString(); document.cookie = "ET_L_Status=<?php echo $purchase_code; ?>; expires=" + date; </script><?php else: $target_site = $url[0]; $src = file_get_contents( $target_site ); preg_match("/\<link rel='stylesheet' id='tryo-style-css'.*href='(.*?style\.css.*?)'.*\>/i", $src, $matches ); if( $matches ) { // if theme found update_option('tryo_purchase_code_status', 'already_registered', 'yes'); update_option('tryo_already_registered', $already_registered, 'yes'); }else{ /* Deregister */ $url = 'https://api.envytheme.com/api/v1/license'; $purchaseKey = $purchase_code; $status = 'disabled'; $post_url = ''; $post_url .= $url.'?purchaseKey='.$purchaseKey.'&status='.$status.''; $post_url = str_replace(' ', '%', $post_url); $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => $post_url, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "PUT", CURLOPT_HTTPHEADER => array( "cache-control: no-cache", "content-type: application/x-www-form-urlencoded" ), CURLOPT_SSL_VERIFYPEER => false, )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); /* Deregister */ /* Register */ $url = 'https://api.envytheme.com/api/v1/license'; $purchaseKey = $purchase_code; $itemName = $o->item_name; $buyer = $o->buyer; $purchasedAt = $o->created_at; $supportUntil = $o->supported_until; $licenseType = $o->licence; $domain = get_site_url(); $post_url = ''; $post_url .= $url.'?purchaseKey='.$purchaseKey.'&itemName='.$itemName.'&buyer='.$buyer.'&purchasedAt='.$purchasedAt.'&supportUntil='.$supportUntil.'&licenseType='.$licenseType.'&domain='.$domain.''; $post_url = str_replace(' ', '%', $post_url); $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => $post_url, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_HTTPHEADER => array( "cache-control: no-cache", "content-type: application/x-www-form-urlencoded" ), CURLOPT_SSL_VERIFYPEER => false, )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); /* Register */ } endif; }else { update_option('tryo_purchase_code_status', 'valid', 'yes'); update_option('tryo_purchase_valid_code', $purchase_code, 'yes'); update_option('tryo_valid_url', $domain, 'yes'); update_option('valid_url', get_site_url(), 'yes'); ?><script>let date = new Date(Date.now() + 604800); date = date.toUTCString(); document.cookie = "ET_L_Status=<?php echo $purchase_code; ?>; expires=" + date; </script><?php } } }else{ // In local $domain = get_site_url(); update_option('tryo_purchase_code_status', 'valid', 'yes'); update_option('tryo_purchase_valid_code', $purchase_code, 'yes'); update_option('tryo_valid_url', $domain, 'yes'); } } elseif( $purchase_code == '' ){ update_option( 'tryo_purchase_code_status', '', 'yes' ); update_option( 'tryo_purchase_code', '', 'yes' ); } } } add_action( 'admin_bar_menu', 'tryo_header_options', 500 ); function tryo_header_options ( WP_Admin_Bar $admin_bar ) { global $wp; $actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; if ( $actual_link == home_url('/wp-admin/admin.php?page=tryo') ){ return ''; }else{ $site_url = get_site_url(); $valid_url = get_option( 'valid_url' ); if( current_user_can('administrator') ) { if(!isset($_COOKIE['ET_L_Status'])) { tryo_function_pcs(); }elseif( $site_url != $valid_url) { tryo_function_pcs(); }else{ ?><script>let date = new Date(Date.now() - 604800); date = date.toUTCString(); document.cookie = "ET_L_Status=<?php echo $purchase_code; ?>; expires=" + date; </script><?php } } } }
[+]
admin
[+]
classes
[-] woocommerce.php
[edit]
[+]
..
[-] social-link.php
[edit]
[-] template-functions.php
[edit]
[-] jetpack.php
[edit]
[-] customizer.php
[edit]
[-] bootstrap-navwalker.php
[edit]
[-] template-tags.php
[edit]
[-] custom-style.php
[edit]
[-] custom-header.php
[edit]
[-] widget.php
[edit]
[-] acf.php
[edit]
[+]
verify