Advertisement
Guest User

Untitled

a guest
Apr 15th, 2016
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 42.86 KB | None | 0 0
  1. <?php
  2. require_once 'libs/css_js_include.php';
  3. require_once 'libs/metaboxes.php';
  4. require_once 'libs/plugins.php';
  5. require_once 'libs/help_functions.php';//
  6. require_once 'libs/pin_management.php';//
  7. require_once 'libs/ajax_functions.php';
  8. require_once 'libs/ajax_upload.php';
  9. require_once 'libs/3rdparty.php';
  10. require_once 'libs/theme-setup.php';//
  11. require_once 'libs/general-settings.php';//
  12. require_once 'libs/listing_functions.php';
  13. require_once 'libs/theme-slider.php';
  14. require_once 'libs/agents.php';
  15. require_once ('libs/invoices.php');
  16. require_once ('libs/searches.php');
  17. require_once ('libs/membership.php');
  18. require_once ('libs/property.php');
  19. require_once ('libs/shortcodes_install.php');
  20. require_once ('libs/shortcodes.php');
  21. require_once ('libs/widgets.php');
  22. require_once ('libs/events.php');
  23. require_once ('libs/WalkScore.php');
  24. require_once ('libs/emailfunctions.php');
  25. require_once ('libs/searchfunctions.php');
  26. require_once ('libs/stats.php');
  27. require_once ('libs/megamenu.php');
  28. //require_once ('profiling.php');
  29.  
  30. define('ULTIMATE_NO_EDIT_PAGE_NOTICE', true);
  31. define('ULTIMATE_NO_PLUGIN_PAGE_NOTICE', true);
  32. # Disable check updates -
  33. define('BSF_6892199_CHECK_UPDATES',false);
  34.  
  35. # Disable license registration nag -
  36. define('BSF_6892199_NAG', false);
  37.  
  38.  
  39. function wpestate_admin_notice() {
  40. global $pagenow;
  41. global $typenow;
  42.  
  43. if($pagenow=='themes.php'){
  44. return;
  45. }
  46.  
  47. if (!empty($_GET['post'])) {
  48. $allowed_html = array();
  49. $post = get_post( esc_html($_GET['post']) );
  50. $typenow = $post->post_type;
  51. }
  52.  
  53.  
  54. if ( WP_MEMORY_LIMIT < 96 ) {
  55. print '<div class="error">
  56. <p>'.esc_html__( 'Wordpress Memory Limit is set to ', 'wpestate' ).' '.WP_MEMORY_LIMIT.' '.esc_html__( 'Recommended memory limit should be at least 96MB. Please refer to : ','wpestate').'<a href="http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP" target="_blank">'.esc_html__('Increasing memory allocated to PHP','wpestate').'</a></p>
  57. </div>';
  58. }
  59.  
  60. if (!defined('PHP_VERSION_ID')) {
  61. $version = explode('.', PHP_VERSION);
  62. define('PHP_VERSION_ID', ($version[0] * 10000 + $version[1] * 100 + $version[2]));
  63. }
  64.  
  65. if(PHP_VERSION_ID<50600){
  66. $version = explode('.', PHP_VERSION);
  67. print '<div class="error">
  68. <p>'.__( 'Your PHP version is ', 'wpestate' ).' '.$version[0].'.'.$version[1].'.'.$version[2].'. For loading speed reasons we recommend upgrading the PHP version to at least 5.6.1. The upgrade should be done on your server by your hosting company. </p>
  69. </div>';
  70. }
  71.  
  72. if( !extension_loaded('gd') && !function_exists('gd_info')){
  73. $version = explode('.', PHP_VERSION);
  74. print '<div class="error">
  75. <p>'.__( 'PHP GD library is NOT installed on your web server and because of that the theme will not be able to work with images. Please contact your hosting company in order to activate this library.','wpestate').' </p>
  76. </div>';
  77. }
  78.  
  79.  
  80.  
  81.  
  82. if ( !extension_loaded('mbstring')) {
  83. print '<div class="error">
  84. <p>'.__( 'MbString extension not detected. Please contact your hosting provider in order to enable it.', 'wpestate' ).'</p>
  85. </div>';
  86. }
  87.  
  88. //print $pagenow.' / '.$typenow .' / '.basename( get_page_template($post) );
  89.  
  90. if (is_admin() && $pagenow=='post.php' && $typenow=='page' && basename( get_page_template($post))=='property_list_half.php' ){
  91. $header_type = get_post_meta ( $post->ID, 'header_type', true);
  92.  
  93. if ( $header_type != 5){
  94. print '<div class="error">
  95. <p>'.esc_html__( 'Half Map Template - make sure your page has the "media header type" set as google map ', 'wpestate' ).'</p>
  96. </div>';
  97. }
  98.  
  99. }
  100.  
  101. if (is_admin() && $pagenow=='edit-tags.php' && $typenow=='estate_property') {
  102.  
  103. print '<div class="error">
  104. <p>'.esc_html__( 'Please do not manually change the slugs when adding new terms. If you need to edit a term name copy the new name in the slug field also.', 'wpestate' ).'</p>
  105. </div>';
  106. }
  107.  
  108.  
  109.  
  110.  
  111.  
  112. }
  113.  
  114.  
  115.  
  116.  
  117. add_action( 'admin_notices', 'wpestate_admin_notice' );
  118.  
  119.  
  120. add_action('after_setup_theme', 'wp_estate_init');
  121. if( !function_exists('wp_estate_init') ):
  122. function wp_estate_init() {
  123.  
  124. global $content_width;
  125. if ( ! isset( $content_width ) ) {
  126. $content_width = 1200;
  127. }
  128.  
  129. load_theme_textdomain('wpestate', get_template_directory() . '/languages');
  130. set_post_thumbnail_size(940, 198, true);
  131. add_editor_style();
  132. add_theme_support('post-thumbnails');
  133. add_theme_support('automatic-feed-links');
  134. add_theme_support('custom-background' );
  135. wp_estate_setup();
  136. add_action('widgets_init', 'register_wpestate_widgets' );
  137. add_action('init', 'wpestate_shortcodes');
  138. wp_oembed_add_provider('#https?://twitter.com/\#!/[a-z0-9_]{1,20}/status/\d+#i', 'https://api.twitter.com/1/statuses/oembed.json', true);
  139. wpestate_image_size();
  140. add_filter('excerpt_length', 'wp_estate_excerpt_length');
  141. add_filter('excerpt_more', 'wpestate_new_excerpt_more');
  142. add_action('tgmpa_register', 'wpestate_required_plugins');
  143. add_action('wp_enqueue_scripts', 'wpestate_scripts'); // function in css_js_include.php
  144. add_action('admin_enqueue_scripts', 'wpestate_admin');// function in css_js_include.php
  145. update_option( 'image_default_link_type', 'file' );
  146. }
  147. endif; // end wp_estate_init
  148.  
  149.  
  150.  
  151.  
  152.  
  153. ///////////////////////////////////////////////////////////////////////////////////////////
  154. /////// If admin create the menu
  155. ///////////////////////////////////////////////////////////////////////////////////////////
  156. if (is_admin()) {
  157. add_action('admin_menu', 'wpestate_manage_admin_menu');
  158. }
  159.  
  160. if( !function_exists('wpestate_manage_admin_menu') ):
  161.  
  162. function wpestate_manage_admin_menu() {
  163. global $theme_name;
  164. add_theme_page('WpResidence Options', 'WpResidence Options', 'administrator', 'libs/theme-admin.php', 'wpestate_new_general_set' );
  165. add_theme_page('Import WpResidence Themes', 'WpResidence Import', 'administrator', 'libs/theme-import.php', 'wpestate_new_import' );
  166.  
  167. require_once 'libs/property-admin.php';
  168. require_once 'libs/pin-admin.php';
  169. require_once 'libs/theme-admin.php';
  170. require_once 'libs/theme-import.php';
  171. }
  172.  
  173. endif; // end wpestate_manage_admin_menu
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184. //////////////////////////////////////////////////////////////////////////////////////////////
  185. // page details : setting sidebar position etc...
  186. //////////////////////////////////////////////////////////////////////////////////////////////
  187.  
  188. if( !function_exists('wpestate_page_details') ):
  189.  
  190.  
  191. function wpestate_page_details($post_id){
  192.  
  193. $return_array=array();
  194.  
  195. if($post_id !='' && !is_home() && !is_tax() ){
  196. $sidebar_name = esc_html( get_post_meta($post_id, 'sidebar_select', true) );
  197. $sidebar_status = esc_html( get_post_meta($post_id, 'sidebar_option', true) );
  198. }else{
  199. $sidebar_name = esc_html( get_option('wp_estate_blog_sidebar_name', '') );
  200. $sidebar_status = esc_html( get_option('wp_estate_blog_sidebar', '') );
  201. }
  202.  
  203. if( 'estate_agent' == get_post_type() && $sidebar_name=='' & $sidebar_status=='' ) {
  204. $sidebar_status = esc_html ( get_option('wp_estate_agent_sidebar','') );
  205. $sidebar_name = esc_html ( get_option('wp_estate_agent_sidebar_name','') );
  206. }
  207.  
  208.  
  209.  
  210. if(''==$sidebar_name){
  211. $sidebar_name='primary-widget-area';
  212. }
  213. if(''==$sidebar_status){
  214. $sidebar_status='right';
  215. }
  216.  
  217.  
  218.  
  219. if( 'left'==$sidebar_status ){
  220. $return_array['content_class'] = 'col-md-9 col-md-push-3 rightmargin';
  221. $return_array['sidebar_class'] = 'col-md-3 col-md-pull-9 ';
  222. }else if( $sidebar_status=='right'){
  223. $return_array['content_class'] = 'col-md-9 rightmargin';
  224. $return_array['sidebar_class'] = 'col-md-3';
  225. }else{
  226. $return_array['content_class'] = 'col-md-12';
  227. $return_array['sidebar_class'] = 'none';
  228. }
  229.  
  230. $return_array['sidebar_name'] = $sidebar_name;
  231.  
  232. return $return_array;
  233.  
  234. }
  235.  
  236. endif; // end wpestate_page_details
  237.  
  238.  
  239.  
  240. ///////////////////////////////////////////////////////////////////////////////////////////
  241. /////// generate custom css
  242. ///////////////////////////////////////////////////////////////////////////////////////////
  243.  
  244. add_action('wp_head', 'wpestate_generate_options_css');
  245.  
  246. if( !function_exists('wpestate_generate_options_css') ):
  247.  
  248. function wpestate_generate_options_css() {
  249.  
  250. $general_font = esc_html( get_option('wp_estate_general_font', '') );
  251. $custom_css = stripslashes ( get_option('wp_estate_custom_css') );
  252. $color_scheme = esc_html( get_option('wp_estate_color_scheme', '') );
  253.  
  254. if ($general_font != '' || $color_scheme == 'yes' || $custom_css != ''){
  255. echo "<style type='text/css'>" ;
  256. if ($general_font != '') {
  257. require_once ('libs/custom_general_font.php');
  258. }
  259.  
  260.  
  261. if ($color_scheme == 'yes') {
  262. require_once ('libs/customcss.php');
  263. }
  264. print ($custom_css);
  265. echo "</style>";
  266. }
  267.  
  268. }
  269.  
  270. endif; // end generate_options_css
  271.  
  272.  
  273. ///////////////////////////////////////////////////////////////////////////////////////////
  274. /////// Display navigation to next/previous pages when applicable
  275. ///////////////////////////////////////////////////////////////////////////////////////////
  276.  
  277. if (!function_exists('wp_estate_content_nav')) :
  278.  
  279. function wp_estate_content_nav($html_id) {
  280. global $wp_query;
  281.  
  282. if ($wp_query->max_num_pages > 1) :
  283. ?>
  284. <nav id="<?php echo esc_attr($html_id); ?>">
  285. <h3 class="assistive-text"><?php _e('Post navigation', 'wpestate'); ?></h3>
  286. <div class="nav-previous"><?php next_posts_link(__('<span class="meta-nav">&larr;</span> Older posts', 'wpestate')); ?></div>
  287. <div class="nav-next"><?php previous_posts_link(__('Newer posts <span class="meta-nav">&rarr;</span>', 'wpestate')); ?></div>
  288. </nav><!-- #nav-above -->
  289. <?php
  290. endif;
  291. }
  292.  
  293. endif; // wpestate_content_nav
  294.  
  295.  
  296.  
  297.  
  298.  
  299. ///////////////////////////////////////////////////////////////////////////////////////////
  300. /////// Comments
  301. ///////////////////////////////////////////////////////////////////////////////////////////
  302.  
  303. if (!function_exists('wpestate_comment')) :
  304. function wpestate_comment($comment, $args, $depth) {
  305. $GLOBALS['comment'] = $comment;
  306. switch ($comment->comment_type) :
  307. case 'pingback' :
  308. case 'trackback' :
  309. ?>
  310. <li class="post pingback">
  311. <p><?php _e('Pingback:', 'wpestate'); ?> <?php comment_author_link(); ?><?php edit_comment_link(__('Edit', 'wpestate'), '<span class="edit-link">', '</span>'); ?></p>
  312. <?php
  313. break;
  314. default :
  315. ?>
  316.  
  317.  
  318.  
  319.  
  320. <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
  321.  
  322. <?php
  323. $avatar = wpestate_get_avatar_url(get_avatar($comment, 55));
  324. print '<div class="blog_author_image singlepage" style="background-image: url(' . $avatar . ');">';
  325. comment_reply_link(array_merge($args, array('reply_text' => __('Reply', 'wpestate'), 'depth' => $depth, 'max_depth' => $args['max_depth'])));
  326. print'</div>';
  327. ?>
  328.  
  329. <div id="comment-<?php comment_ID(); ?>" class="comment">
  330. <?php edit_comment_link(__('Edit', 'wpestate'), '<span class="edit-link">', '</span>'); ?>
  331. <div class="comment-meta">
  332. <div class="comment-author vcard">
  333. <?php
  334. print '<div class="comment_name">' . get_comment_author_link().'</div>';
  335. print '<span class="comment_date">'.__(' on ','wpestate').' '. get_comment_date() . '</span>';
  336. ?>
  337. </div><!-- .comment-author .vcard -->
  338.  
  339. <?php if ($comment->comment_approved == '0') : ?>
  340. <em class="comment-awaiting-moderation"><?php _e('Your comment is awaiting moderation.', 'wpestate'); ?></em>
  341. <br />
  342. <?php endif; ?>
  343.  
  344. </div>
  345.  
  346. <div class="comment-content"><?php comment_text(); ?></div>
  347. </div><!-- #comment-## -->
  348. <?php
  349. break;
  350. endswitch;
  351. }
  352.  
  353.  
  354. endif; // ends check for wpestate_comment
  355.  
  356.  
  357.  
  358. ////////////////////////////////////////////////////////////////////////////////
  359. /// Add new profile fields
  360. ////////////////////////////////////////////////////////////////////////////////
  361.  
  362. add_filter('user_contactmethods', 'wpestate_modify_contact_methods');
  363. if( !function_exists('wpestate_modify_contact_methods') ):
  364.  
  365. function wpestate_modify_contact_methods($profile_fields) {
  366.  
  367. // Add new fields
  368. $profile_fields['facebook'] = 'Facebook';
  369. $profile_fields['twitter'] = 'Twitter';
  370. $profile_fields['linkedin'] = 'Linkedin';
  371. $profile_fields['pinterest'] = 'Pinterest';
  372. $profile_fields['website'] = 'Website';
  373. $profile_fields['phone'] = 'Phone';
  374. $profile_fields['mobile'] = 'Mobile';
  375. $profile_fields['skype'] = 'Skype';
  376. $profile_fields['title'] = 'Title/Position';
  377. $profile_fields['custom_picture'] = 'Picture Url';
  378. $profile_fields['small_custom_picture'] = 'Small Picture Url';
  379. $profile_fields['package_id'] = 'Package Id';
  380. $profile_fields['package_activation'] = 'Package Activation';
  381. $profile_fields['package_listings'] = 'Listings available';
  382. $profile_fields['package_featured_listings'] = 'Featured Listings available';
  383. $profile_fields['profile_id'] = 'Paypal Recuring Profile';
  384. $profile_fields['user_agent_id'] = 'User Agent Id';
  385. $profile_fields['stripe'] = __('Stripe Consumer Profile','wpestate');
  386. return $profile_fields;
  387. }
  388.  
  389. endif; // end wpestate_modify_contact_methods
  390.  
  391.  
  392.  
  393.  
  394. if( !current_user_can('activate_plugins') ) {
  395. function wpestate_admin_bar_render() {
  396. global $wp_admin_bar;
  397. $wp_admin_bar->remove_menu('edit-profile', 'user-actions');
  398. }
  399.  
  400. add_action( 'wp_before_admin_bar_render', 'wpestate_admin_bar_render' );
  401.  
  402. add_action( 'admin_init', 'wpestate_stop_access_profile' );
  403. if( !function_exists('wpestate_stop_access_profile') ):
  404. function wpestate_stop_access_profile() {
  405. global $pagenow;
  406.  
  407. if( defined('IS_PROFILE_PAGE') && IS_PROFILE_PAGE === true ) {
  408. wp_die( __('Please edit your profile page from site interface.','wpestate') );
  409. }
  410.  
  411. if($pagenow=='user-edit.php'){
  412. wp_die( __('Please edit your profile page from site interface.','wpestate') );
  413. }
  414. }
  415. endif; // end wpestate_stop_access_profile
  416.  
  417. }// end user can activate_plugins
  418.  
  419.  
  420.  
  421.  
  422.  
  423.  
  424. ///////////////////////////////////////////////////////////////////////////////////////////
  425. // prevent changing the author id when admin hit publish
  426. ///////////////////////////////////////////////////////////////////////////////////////////
  427.  
  428. add_action( 'transition_post_status', 'wpestate_correct_post_data',10,3 );
  429.  
  430. if( !function_exists('wpestate_correct_post_data') ):
  431.  
  432. function wpestate_correct_post_data( $strNewStatus,$strOldStatus,$post) {
  433. /* Only pay attention to posts (i.e. ignore links, attachments, etc. ) */
  434. if( $post->post_type !== 'estate_property' )
  435. return;
  436.  
  437. if( $strOldStatus === 'new' ) {
  438. update_post_meta( $post->ID, 'original_author', $post->post_author );
  439. }
  440.  
  441.  
  442.  
  443. /* If this post is being published, try to restore the original author */
  444. if( $strNewStatus === 'publish' ) {
  445.  
  446. // print_r($post);
  447. //$originalAuthor = get_post_meta( $post->ID, 'original_author' );
  448.  
  449. $originalAuthor_id =$post->post_author;
  450. $user = get_user_by('id',$originalAuthor_id);
  451. $user_email=$user->user_email;
  452.  
  453. if( $user->roles[0]=='subscriber'){
  454. $arguments=array(
  455. 'post_id' => $post->ID,
  456. 'property_url' => get_permalink($post->ID),
  457. 'property_title' => get_the_title($post->ID)
  458. );
  459.  
  460.  
  461.  
  462. wpestate_select_email_type($user_email,'approved_listing',$arguments);
  463.  
  464. }
  465. }
  466. }
  467. endif; // end wpestate_correct_post_data
  468.  
  469.  
  470.  
  471.  
  472.  
  473.  
  474.  
  475.  
  476.  
  477.  
  478.  
  479. ///////////////////////////////////////////////////////////////////////////////////////////
  480. // get attachment info
  481. ///////////////////////////////////////////////////////////////////////////////////////////
  482.  
  483. if( !function_exists('wp_get_attachment') ):
  484. function wp_get_attachment( $attachment_id ) {
  485.  
  486. $attachment = get_post( $attachment_id );
  487.  
  488. if(is_array($attachment)){
  489. return array(
  490. 'alt' => get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true ),
  491. 'caption' => $attachment->post_excerpt,
  492. 'description' => $attachment->post_content,
  493. 'href' => get_permalink( $attachment->ID ),
  494. 'src' => $attachment->guid,
  495. 'title' => $attachment->post_title
  496. );
  497. }else{
  498. return array(
  499. 'alt' => '',
  500. 'caption' => '',
  501. 'description' => '',
  502. 'href' => '',
  503. 'src' => '',
  504. 'title' => ''
  505. );
  506. }
  507. }
  508. endif;
  509.  
  510.  
  511. add_action('get_header', 'wpestate_my_filter_head');
  512.  
  513. if( !function_exists('wpestate_my_filter_head') ):
  514. function wpestate_my_filter_head() {
  515. remove_action('wp_head', '_admin_bar_bump_cb');
  516. }
  517. endif;
  518.  
  519.  
  520. ///////////////////////////////////////////////////////////////////////////////////////////
  521. // loosing session fix
  522. ///////////////////////////////////////////////////////////////////////////////////////////
  523. remove_action('wp_head', 'adjacent_posts_rel_link_wp_head');
  524.  
  525.  
  526. ///////////////////////////////////////////////////////////////////////////////////////////
  527. // remove vc as theme
  528. ///////////////////////////////////////////////////////////////////////////////////////////
  529.  
  530. /*
  531. if (function_exists('vc_set_as_theme')) {
  532. vc_set_as_theme($disable_updater = false);
  533. }
  534. */
  535.  
  536. ///////////////////////////////////////////////////////////////////////////////////////////
  537. // forgot pass action
  538. ///////////////////////////////////////////////////////////////////////////////////////////
  539.  
  540. add_action('wp_head','hook_javascript');
  541. if( !function_exists('hook_javascript') ):
  542. function hook_javascript(){
  543. global $wpdb;
  544. $allowed_html = array();
  545. if(isset($_GET['key']) && $_GET['action'] == "reset_pwd") {
  546. $reset_key = esc_html( wp_kses($_GET['key'],$allowed_html) );
  547. $user_login = esc_html( wp_kses($_GET['login'],$allowed_html) );
  548. $user_data = $wpdb->get_row($wpdb->prepare("SELECT ID, user_login, user_email FROM $wpdb->users
  549. WHERE user_activation_key = %s AND user_login = %s", $reset_key, $user_login));
  550.  
  551.  
  552. if(!empty($user_data)){
  553. $user_login = $user_data->user_login;
  554. $user_email = $user_data->user_email;
  555.  
  556. if(!empty($reset_key) && !empty($user_data)) {
  557. $new_password = wp_generate_password(7, false);
  558. wp_set_password( $new_password, $user_data->ID );
  559. //mailing the reset details to the user
  560. $message = __('Your new password for the account at:','wpestate') . "\r\n\r\n";
  561. $message .= get_bloginfo('name') . "\r\n\r\n";
  562. $message .= sprintf(__('Username: %s','wpestate'), $user_login) . "\r\n\r\n";
  563. $message .= sprintf(__('Password: %s','wpestate'), $new_password) . "\r\n\r\n";
  564. $message .= __('You can now login with your new password at: ','wpestate') . get_option('siteurl')."/" . "\r\n\r\n";
  565.  
  566. $headers = 'From: noreply <noreply@'.$_SERVER['HTTP_HOST'].'>' . "\r\n".
  567. 'Reply-To: noreply@'.$_SERVER['HTTP_HOST']. "\r\n" .
  568. 'X-Mailer: PHP/' . phpversion();
  569.  
  570. $arguments=array(
  571. 'user_pass' => $new_password,
  572. );
  573. wpestate_select_email_type($user_email,'password_reseted',$arguments);
  574.  
  575. $mess= '<div class="login-alert">'.__('A new password was sent via email!','wpestate').'</div>';
  576.  
  577. }
  578. else {
  579. exit('Not a Valid Key.');
  580. }
  581. }// end if empty
  582. PRINT $mes='<div class="login_alert_full">'.__('We have just sent you a new password. Please check your email!','wpestate').'</div>';
  583.  
  584. }
  585.  
  586. }
  587. endif;
  588.  
  589.  
  590.  
  591. add_action('wpcf7_before_send_mail', 'wpcf7_update_email_body');
  592.  
  593. function wpcf7_update_email_body($contact_form) {
  594.  
  595. // don't copy my code little f.... - use your brain if you have one
  596. $submission = WPCF7_Submission::get_instance();
  597. $url = $submission->get_meta( 'url' );
  598. $postid = url_to_postid( $url );
  599.  
  600. if ( $submission ){
  601. if( isset($postid) && get_post_type($postid) == 'estate_property' ){
  602. $mail = $contact_form->prop('mail');
  603. $mail['recipient'] = wpestate_return_agent_email_listing($postid);
  604. $mail['body'] .= __('Message sent from page: ','wpestate').get_permalink($postid);
  605. $contact_form->set_properties(array('mail' => $mail));
  606. }
  607.  
  608. if(isset($postid) && get_post_type($postid) == 'estate_agent' ){
  609. $mail = $contact_form->prop('mail');
  610. $mail['recipient'] = esc_html( get_post_meta($postid, 'agent_email', true) );
  611. $mail['body'] .= __('Message sent from page: ','wpestate').get_permalink($postid);
  612. $contact_form->set_properties(array('mail' => $mail));
  613. }
  614.  
  615. }
  616.  
  617. }
  618.  
  619.  
  620. function wpestate_return_agent_email_listing($postid){
  621.  
  622. $agent_id = intval( get_post_meta($postid, 'property_agent', true) );
  623.  
  624. if ($agent_id!=0){
  625. $agent_email = esc_html( get_post_meta($agent_id, 'agent_email', true) );
  626. }else{
  627. $author_id = wpsestate_get_author($postid);
  628. $agent_email = get_the_author_meta( 'user_email',$author_id );
  629. }
  630. return $agent_email;
  631. }
  632.  
  633.  
  634. add_filter( 'option_posts_per_page', 'tdd_tax_filter_posts_per_page' );
  635. function tdd_tax_filter_posts_per_page( $value ) {
  636. $prop_no = intval( get_option('wp_estate_prop_no','') );
  637. return (is_tax('estate_property')) ? 1 : $prop_no;
  638. }
  639.  
  640.  
  641.  
  642.  
  643.  
  644. //add_filter( 'posts_results', 'cache_meta_data', 9999, 2 );
  645. function cache_meta_data( $posts, $object ) {
  646. // global $posts;
  647.  
  648. $posts_to_cache = array();
  649. // this usually makes only sense when we have a bunch of posts
  650. if ( empty( $posts ) || is_wp_error( $posts ) || is_single() || is_page() || count( $posts ) < 20 ){
  651.  
  652. return $posts;
  653.  
  654. }
  655.  
  656. foreach( $posts as $post ) {
  657. if ( isset( $post->ID ) && isset( $post->post_type ) ) {
  658. $posts_to_cache[$post->ID] = 1;
  659. }
  660. }
  661.  
  662. if ( empty( $posts_to_cache ) )
  663. return $posts;
  664. //print_r($posts_to_cache);
  665. update_meta_cache( 'post', array_keys( $posts_to_cache ) );
  666. unset( $posts_to_cache );
  667.  
  668. return $posts;
  669. }
  670.  
  671.  
  672. if ( !function_exists('estate_get_pin_file_path')):
  673.  
  674. function estate_get_pin_file_path(){
  675. if (function_exists('icl_translate') ) {
  676. $path=get_template_directory().'/pins-'.apply_filters( 'wpml_current_language', 'en' ).'.txt';
  677. }else{
  678. $path=get_template_directory().'/pins.txt';
  679. }
  680.  
  681. return $path;
  682. }
  683.  
  684. endif;
  685.  
  686.  
  687.  
  688.  
  689. if( !function_exists('wpestate_show_search_field_classic_form') ):
  690. function wpestate_show_search_field_classic_form($postion,$action_select_list,$categ_select_list ,$select_city_list,$select_area_list){
  691.  
  692. $allowed_html=array();
  693. if ($postion=='main'){
  694. $caret_class = ' caret_filter ';
  695. $main_class = ' filter_menu_trigger ';
  696. $appendix = '';
  697. $price_low = 'price_low';
  698. $price_max = 'price_max';
  699. $ammount = 'amount';
  700. $slider = 'slider_price';
  701. $drop_class = '';
  702.  
  703. }else if($postion=='sidebar'){
  704. $caret_class = ' caret_sidebar ';
  705. $main_class = ' sidebar_filter_menu ';
  706. $appendix = 'sidebar-';
  707. $price_low = 'price_low_widget';
  708. $price_max = 'price_max_widget';
  709. $ammount = 'amount_wd';
  710. $slider = 'slider_price_widget';
  711. $drop_class = '';
  712.  
  713. }else if($postion=='shortcode'){
  714. $caret_class = ' caret_filter ';
  715. $main_class = ' filter_menu_trigger ';
  716. $appendix = '';
  717. $price_low = 'price_low_sh';
  718. $price_max = 'price_max_sh';
  719. $ammount = 'amount_sh';
  720. $slider = 'slider_price_sh';
  721. $drop_class = 'listing_filter_select ';
  722.  
  723. } else if($postion=='mobile'){
  724. $caret_class = ' caret_filter ';
  725. $main_class = ' filter_menu_trigger ';
  726. $appendix = '';
  727. $price_low = 'price_low_mobile';
  728. $price_max = 'price_max_mobile';
  729. $ammount = 'amount_mobile';
  730. $slider = 'slider_price_mobile';
  731. $drop_class = '';
  732. }
  733.  
  734. $return_string='';
  735.  
  736. if(isset($_GET['filter_search_action'][0]) && $_GET['filter_search_action'][0]!='' && $_GET['filter_search_action'][0]!='all'){
  737. $full_name = get_term_by('slug', esc_html( wp_kses( $_GET['filter_search_action'][0],$allowed_html) ),'property_action_category');
  738. $adv_actions_value=$adv_actions_value1= $full_name->name;
  739. $adv_actions_value1 = mb_strtolower ( str_replace(' ', '-', $adv_actions_value1) );
  740. }else{
  741. $adv_actions_value=__('All Actions','wpestate');
  742. $adv_actions_value1='all';
  743. }
  744.  
  745. $return_string.='
  746. <div class="dropdown form-control '.$drop_class.' " >
  747. <div data-toggle="dropdown" id="'.$appendix.'adv_actions" class="'.$main_class.'" data-value="'.strtolower ( rawurlencode ( $adv_actions_value1) ).'">
  748. '.$adv_actions_value.'
  749. <span class="caret '.$caret_class.'"></span> </div>
  750. <input type="hidden" name="filter_search_action[]" value="';
  751. if(isset($_GET['filter_search_action'][0])){
  752. $return_string.= strtolower( esc_attr($_GET['filter_search_action'][0]) );
  753.  
  754. }; $return_string.='">
  755. <ul class="dropdown-menu filter_menu" role="menu" aria-labelledby="'.$appendix.'adv_actions">
  756. '.$action_select_list.'
  757. </ul>
  758. </div>';
  759.  
  760.  
  761.  
  762.  
  763.  
  764.  
  765. if( isset($_GET['filter_search_type'][0]) && $_GET['filter_search_type'][0]!=''&& $_GET['filter_search_type'][0]!='all' ){
  766. $full_name = get_term_by('slug', esc_html( wp_kses( $_GET['filter_search_type'][0],$allowed_html) ),'property_category');
  767. $adv_categ_value= $adv_categ_value1=$full_name->name;
  768. $adv_categ_value1 = mb_strtolower ( str_replace(' ', '-', $adv_categ_value1));
  769. }else{
  770. $adv_categ_value = __('All Types','wpestate');
  771. $adv_categ_value1 ='all';
  772. }
  773.  
  774. $return_string.='
  775. <div class="dropdown form-control '.$drop_class.'" >
  776. <div data-toggle="dropdown" id="'.$appendix.'adv_categ" class="'.$main_class.'" data-value="'.strtolower ( rawurlencode( $adv_categ_value1)).'">
  777. '.$adv_categ_value.'
  778. <span class="caret '.$caret_class.'"></span> </div>
  779. <input type="hidden" name="filter_search_type[]" value="';
  780. if(isset($_GET['filter_search_type'][0])){
  781. $return_string.= strtolower ( esc_attr( $_GET['filter_search_type'][0] ) );
  782. }
  783. $return_string.='">
  784. <ul class="dropdown-menu filter_menu" role="menu" aria-labelledby="'.$appendix.'adv_categ">
  785. '.$categ_select_list.'
  786. </ul>
  787. </div>';
  788.  
  789. if(isset($_GET['advanced_city']) && $_GET['advanced_city']!='' && $_GET['advanced_city']!='all'){
  790. $full_name = get_term_by('slug',esc_html( wp_kses($_GET['advanced_city'] ,$allowed_html)), 'property_city');
  791. $advanced_city_value = $advanced_city_value1 = $full_name->name;
  792. $advanced_city_value1 = mb_strtolower(str_replace(' ', '-', $advanced_city_value1));
  793. }else{
  794. $advanced_city_value=__('All Cities','wpestate');
  795. $advanced_city_value1='all';
  796. }
  797.  
  798. $return_string.='
  799. <div class="dropdown form-control '.$drop_class.'" >
  800. <div data-toggle="dropdown" id="'.$appendix.'advanced_city" class="'.$main_class.'" data-value="'. strtolower (rawurlencode ($advanced_city_value1)).'">
  801. '.$advanced_city_value.'
  802. <span class="caret '.$caret_class.'"></span> </div>
  803. <input type="hidden" name="advanced_city" value="';
  804. if(isset($_GET['advanced_city'])){
  805. $return_string.=strtolower ( esc_attr($_GET['advanced_city'] ) );
  806.  
  807. }
  808. $return_string.='">
  809. <ul class="dropdown-menu filter_menu" role="menu" id="adv-search-city" aria-labelledby="'.$appendix.'advanced_city">
  810. '.$select_city_list.'
  811. </ul>
  812. </div>';
  813.  
  814.  
  815. if(isset($_GET['advanced_area']) && $_GET['advanced_area']!=''&& $_GET['advanced_area']!='all'){
  816. $full_name = get_term_by('slug', esc_html(wp_kses($_GET['advanced_area'],$allowed_html)),'property_area');
  817. $advanced_area_value=$advanced_area_value1= $full_name->name;
  818. $advanced_area_value1 = mb_strtolower (str_replace(' ', '-', $advanced_area_value1));
  819. }else{
  820. $advanced_area_value=__('All Areas','wpestate');
  821. $advanced_area_value1='all';
  822. }
  823.  
  824.  
  825. $return_string.='
  826. <div class="dropdown form-control '.$drop_class.'" >
  827. <div data-toggle="dropdown" id="'.$appendix.'advanced_area" class="'.$main_class.'" data-value="'.strtolower( rawurlencode( $advanced_area_value1)).'">
  828. '.$advanced_area_value.'
  829. <span class="caret '.$caret_class.'"></span> </div>
  830. <input type="hidden" name="advanced_area" value="';
  831. if(isset($_GET['advanced_area'])){
  832. $return_string.=strtolower( esc_attr($_GET['advanced_area'] ) );
  833. }
  834. $return_string.='">
  835. <ul class="dropdown-menu filter_menu" role="menu" id="adv-search-area" aria-labelledby="'.$appendix.'advanced_area">
  836. '.$select_area_list.'
  837. </ul>
  838. </div>';
  839.  
  840. $return_string.='
  841. <input type="text" id="'.$appendix.'adv_rooms" class="form-control" name="advanced_rooms" placeholder="'.__('Type Bedrooms No.','wpestate').'"
  842. value="';
  843. if ( isset ( $_GET['advanced_rooms'] ) ) {
  844. $return_string.= esc_attr( $_GET['advanced_rooms'] );
  845.  
  846. }
  847. $return_string.='">
  848. <input type="text" id="'.$appendix.'adv_bath" class="form-control" name="advanced_bath" placeholder="'.__('Type Bathrooms No.','wpestate').'"
  849. value="';
  850. if (isset($_GET['advanced_bath'])) {
  851. $return_string.= esc_attr( $_GET['advanced_bath'] );
  852.  
  853. }
  854. $return_string.='">';
  855.  
  856.  
  857. $show_slider_price = get_option('wp_estate_show_slider_price','');
  858. $where_currency = esc_html( get_option('wp_estate_where_currency_symbol', '') );
  859. $currency = esc_html( get_option('wp_estate_currency_symbol', '') );
  860.  
  861.  
  862. if ($show_slider_price==='yes'){
  863. $min_price_slider= ( floatval(get_option('wp_estate_show_slider_min_price','')) );
  864. $max_price_slider= ( floatval(get_option('wp_estate_show_slider_max_price','')) );
  865.  
  866. if(isset($_GET['price_low'])){
  867. $min_price_slider= floatval($_GET['price_low']) ;
  868. }
  869.  
  870. if(isset($_GET['price_low'])){
  871. $max_price_slider= floatval($_GET['price_max']) ;
  872. }
  873.  
  874. $price_slider_label = wpestate_show_price_label_slider($min_price_slider,$max_price_slider,$currency,$where_currency);
  875.  
  876. $return_string.='
  877. <div class="adv_search_slider">
  878. <p>
  879. <label for="'.$ammount.'">'.__('Price range:','wpestate').'</label>
  880. <span id="'.$ammount.'" style="border:0; color:#f6931f; font-weight:bold;">'.$price_slider_label.'</span>
  881. </p>
  882. <div id="'.$slider.'"></div>';
  883. $custom_fields = get_option( 'wp_estate_multi_curr', true);
  884. if( !empty($custom_fields) && isset($_COOKIE['my_custom_curr']) && isset($_COOKIE['my_custom_curr_pos']) && isset($_COOKIE['my_custom_curr_symbol']) && $_COOKIE['my_custom_curr_pos']!=-1){
  885. $i=intval($_COOKIE['my_custom_curr_pos']);
  886.  
  887. if( !isset($_GET['price_low']) && !isset($_GET['price_max']) ){
  888. $min_price_slider = $min_price_slider * $custom_fields[$i][2];
  889. $max_price_slider = $max_price_slider * $custom_fields[$i][2];
  890. }
  891. }
  892. $return_string.='
  893. <input type="hidden" id="'.$price_low.'" name="price_low" value="'.$min_price_slider.'>" />
  894. <input type="hidden" id="'.$price_max.'" name="price_max" value="'.$max_price_slider.'>" />
  895. </div>';
  896.  
  897. }else{
  898. $return_string.='
  899. <input type="text" id="'.$price_low.'" class="form-control advanced_select" name="price_low" placeholder="'.__('Type Min. Price','wpestate').'" value=""/>
  900. <input type="text" id="'.$price_max.'" class="form-control advanced_select" name="price_max" placeholder="'.__('Type Max. Price','wpestate').'" value=""/>';
  901.  
  902. }
  903.  
  904.  
  905. return $return_string;
  906.  
  907.  
  908. }
  909. endif;
  910.  
  911.  
  912. add_filter( 'redirect_canonical','wpestate_disable_redirect_canonical',10,2 );
  913. function wpestate_disable_redirect_canonical( $redirect_url ,$requested_url){
  914. //print '$redirect_url'.$redirect_url;
  915. //print '$requested_url'.$requested_url;
  916. if ( is_page_template('property_list.php') || is_page_template('property_list_half.php') ){
  917.  
  918. $redirect_url = false;
  919. }
  920.  
  921.  
  922. return $redirect_url;
  923. }
  924.  
  925. if(!function_exists('convertAccentsAndSpecialToNormal')):
  926. function convertAccentsAndSpecialToNormal($string) {
  927. $table = array(
  928. 'À'=>'A', 'Á'=>'A', 'Â'=>'A', 'Ã'=>'A', 'Ä'=>'A', 'Å'=>'A', 'Ă'=>'A', 'Ā'=>'A', 'Ą'=>'A', 'Æ'=>'A', 'Ǽ'=>'A',
  929. 'à'=>'a', 'á'=>'a', 'â'=>'a', 'ã'=>'a', 'ä'=>'a', 'å'=>'a', 'ă'=>'a', 'ā'=>'a', 'ą'=>'a', 'æ'=>'a', 'ǽ'=>'a',
  930.  
  931. 'Þ'=>'B', 'þ'=>'b', 'ß'=>'Ss',
  932.  
  933. 'Ç'=>'C', 'Č'=>'C', 'Ć'=>'C', 'Ĉ'=>'C', 'Ċ'=>'C',
  934. 'ç'=>'c', 'č'=>'c', 'ć'=>'c', 'ĉ'=>'c', 'ċ'=>'c',
  935.  
  936. 'Đ'=>'Dj', 'Ď'=>'D', 'Đ'=>'D',
  937. 'đ'=>'dj', 'ď'=>'d',
  938.  
  939. 'È'=>'E', 'É'=>'E', 'Ê'=>'E', 'Ë'=>'E', 'Ĕ'=>'E', 'Ē'=>'E', 'Ę'=>'E', 'Ė'=>'E',
  940. 'è'=>'e', 'é'=>'e', 'ê'=>'e', 'ë'=>'e', 'ĕ'=>'e', 'ē'=>'e', 'ę'=>'e', 'ė'=>'e',
  941.  
  942. 'Ĝ'=>'G', 'Ğ'=>'G', 'Ġ'=>'G', 'Ģ'=>'G',
  943. 'ĝ'=>'g', 'ğ'=>'g', 'ġ'=>'g', 'ģ'=>'g',
  944.  
  945. 'Ĥ'=>'H', 'Ħ'=>'H',
  946. 'ĥ'=>'h', 'ħ'=>'h',
  947.  
  948. 'Ì'=>'I', 'Í'=>'I', 'Î'=>'I', 'Ï'=>'I', 'İ'=>'I', 'Ĩ'=>'I', 'Ī'=>'I', 'Ĭ'=>'I', 'Į'=>'I',
  949. 'ì'=>'i', 'í'=>'i', 'î'=>'i', 'ï'=>'i', 'į'=>'i', 'ĩ'=>'i', 'ī'=>'i', 'ĭ'=>'i', 'ı'=>'i',
  950.  
  951. 'Ĵ'=>'J',
  952. 'ĵ'=>'j',
  953.  
  954. 'Ķ'=>'K',
  955. 'ķ'=>'k', 'ĸ'=>'k',
  956.  
  957. 'Ĺ'=>'L', 'Ļ'=>'L', 'Ľ'=>'L', 'Ŀ'=>'L', 'Ł'=>'L',
  958. 'ĺ'=>'l', 'ļ'=>'l', 'ľ'=>'l', 'ŀ'=>'l', 'ł'=>'l',
  959.  
  960. 'Ñ'=>'N', 'Ń'=>'N', 'Ň'=>'N', 'Ņ'=>'N', 'Ŋ'=>'N',
  961. 'ñ'=>'n', 'ń'=>'n', 'ň'=>'n', 'ņ'=>'n', 'ŋ'=>'n', 'ʼn'=>'n',
  962.  
  963. 'Ò'=>'O', 'Ó'=>'O', 'Ô'=>'O', 'Õ'=>'O', 'Ö'=>'O', 'Ø'=>'O', 'Ō'=>'O', 'Ŏ'=>'O', 'Ő'=>'O', 'Œ'=>'O',
  964. 'ò'=>'o', 'ó'=>'o', 'ô'=>'o', 'õ'=>'o', 'ö'=>'o', 'ø'=>'o', 'ō'=>'o', 'ŏ'=>'o', 'ő'=>'o', 'œ'=>'o', 'ð'=>'o',
  965.  
  966. 'Ŕ'=>'R', 'Ř'=>'R',
  967. 'ŕ'=>'r', 'ř'=>'r', 'ŗ'=>'r',
  968.  
  969. 'Š'=>'S', 'Ŝ'=>'S', 'Ś'=>'S', 'Ş'=>'S',
  970. 'š'=>'s', 'ŝ'=>'s', 'ś'=>'s', 'ş'=>'s',
  971.  
  972. 'Ŧ'=>'T', 'Ţ'=>'T', 'Ť'=>'T',
  973. 'ŧ'=>'t', 'ţ'=>'t', 'ť'=>'t',
  974.  
  975. 'Ù'=>'U', 'Ú'=>'U', 'Û'=>'U', 'Ü'=>'U', 'Ũ'=>'U', 'Ū'=>'U', 'Ŭ'=>'U', 'Ů'=>'U', 'Ű'=>'U', 'Ų'=>'U',
  976. 'ù'=>'u', 'ú'=>'u', 'û'=>'u', 'ü'=>'u', 'ũ'=>'u', 'ū'=>'u', 'ŭ'=>'u', 'ů'=>'u', 'ű'=>'u', 'ų'=>'u',
  977.  
  978. 'Ŵ'=>'W', 'Ẁ'=>'W', 'Ẃ'=>'W', 'Ẅ'=>'W',
  979. 'ŵ'=>'w', 'ẁ'=>'w', 'ẃ'=>'w', 'ẅ'=>'w',
  980.  
  981. 'Ý'=>'Y', 'Ÿ'=>'Y', 'Ŷ'=>'Y',
  982. 'ý'=>'y', 'ÿ'=>'y', 'ŷ'=>'y',
  983.  
  984. 'Ž'=>'Z', 'Ź'=>'Z', 'Ż'=>'Z', 'Ž'=>'Z',
  985. 'ž'=>'z', 'ź'=>'z', 'ż'=>'z', 'ž'=>'z',
  986.  
  987. '“'=>'"', '”'=>'"', '‘'=>"'", '’'=>"'", '•'=>'-', '…'=>'...', '—'=>'-', '–'=>'-', '¿'=>'?', '¡'=>'!', '°'=>' degrees ',
  988. '¼'=>' 1/4 ', '½'=>' 1/2 ', '¾'=>' 3/4 ', '⅓'=>' 1/3 ', '⅔'=>' 2/3 ', '⅛'=>' 1/8 ', '⅜'=>' 3/8 ', '⅝'=>' 5/8 ', '⅞'=>' 7/8 ',
  989. '÷'=>' divided by ', '×'=>' times ', '±'=>' plus-minus ', '√'=>' square root ', '∞'=>' infinity ',
  990. '≈'=>' almost equal to ', '≠'=>' not equal to ', '≡'=>' identical to ', '≤'=>' less than or equal to ', '≥'=>' greater than or equal to ',
  991. '←'=>' left ', '→'=>' right ', '↑'=>' up ', '↓'=>' down ', '↔'=>' left and right ', '↕'=>' up and down ',
  992. '℅'=>' care of ', '℮' => ' estimated ',
  993. 'Ω'=>' ohm ',
  994. '♀'=>' female ', '♂'=>' male ',
  995. '©'=>' Copyright ', '®'=>' Registered ', '™' =>' Trademark ',
  996. );
  997.  
  998. $string = strtr($string, $table);
  999. // Currency symbols: £¤¥€ - we dont bother with them for now
  1000. $string = preg_replace("/[^\x9\xA\xD\x20-\x7F]/u", "", $string);
  1001.  
  1002. return $string;
  1003. }
  1004. endif;
  1005.  
  1006.  
  1007. function estate_create_onetime_nonce($action = -1) {
  1008. $time = time();
  1009. // print $time.$action;
  1010. $nonce = wp_create_nonce($time.$action);
  1011. return $nonce . '-' . $time;
  1012. }
  1013. //1455041901register_ajax_nonce_topbar
  1014.  
  1015. function estate_verify_onetime_nonce( $_nonce, $action = -1) {
  1016. $parts = explode( '-', $_nonce );
  1017. $nonce = $toadd_nonce = $parts[0];
  1018. $generated = $parts[1];
  1019.  
  1020. $nonce_life = 60*60;
  1021. $expires = (int) $generated + $nonce_life;
  1022. $time = time();
  1023.  
  1024. if( ! wp_verify_nonce( $nonce, $generated.$action ) || $time > $expires ){
  1025. return false;
  1026. }
  1027.  
  1028. $used_nonces = get_option('_sh_used_nonces');
  1029.  
  1030. if( isset( $used_nonces[$nonce] ) ) {
  1031. return false;
  1032. }
  1033.  
  1034. if(is_array($used_nonces)){
  1035. foreach ($used_nonces as $nonce=> $timestamp){
  1036. if( $timestamp > $time ){
  1037. break;
  1038. }
  1039. unset( $used_nonces[$nonce] );
  1040. }
  1041. }
  1042.  
  1043. $used_nonces[$toadd_nonce] = $expires;
  1044. asort( $used_nonces );
  1045. update_option( '_sh_used_nonces',$used_nonces );
  1046. return true;
  1047. }
  1048.  
  1049.  
  1050.  
  1051.  
  1052. function estate_verify_onetime_nonce_login( $_nonce, $action = -1) {
  1053. $parts = explode( '-', $_nonce );
  1054. $nonce =$toadd_nonce= $parts[0];
  1055. $generated = $parts[1];
  1056.  
  1057. $nonce_life = 60*60;
  1058. $expires = (int) $generated + $nonce_life;
  1059. $expires2 = (int) $generated + 120;
  1060. $time = time();
  1061.  
  1062. if( ! wp_verify_nonce( $nonce, $generated.$action ) || $time > $expires ){
  1063. return false;
  1064. }
  1065.  
  1066. //Get used nonces
  1067. $used_nonces = get_option('_sh_used_nonces');
  1068.  
  1069. if( isset( $used_nonces[$nonce] ) ) {
  1070. return false;
  1071. }
  1072.  
  1073. if(is_array($used_nonces)){
  1074. foreach ($used_nonces as $nonce=> $timestamp){
  1075. if( $timestamp > $time ){
  1076. break;
  1077. }
  1078. unset( $used_nonces[$nonce] );
  1079. }
  1080. }
  1081.  
  1082. //Add nonce in the stack after 2min
  1083. if($time > $expires2){
  1084. $used_nonces[$toadd_nonce] = $expires;
  1085. asort( $used_nonces );
  1086. update_option( '_sh_used_nonces',$used_nonces );
  1087. }
  1088. return true;
  1089. }
  1090.  
  1091.  
  1092.  
  1093.  
  1094. /*
  1095.  
  1096. add_filter( 'script_loader_src', '_remove_script_version', 15, 1 );
  1097. add_filter( 'style_loader_src', '_remove_script_version', 15, 1 );
  1098.  
  1099. function _remove_script_version( $src ){
  1100. print $src;
  1101. $parts = explode( '?', $src );
  1102. return $parts[0];
  1103. }
  1104.  
  1105. */
  1106. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement