@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | if ($redirect) {
|
| 23 | 23 | ?> |
| 24 | 24 | <script type="text/javascript"> |
| 25 | - window.location.href = '<?php echo geodir_login_url();?>'; |
|
| 25 | + window.location.href = '<?php echo geodir_login_url(); ?>'; |
|
| 26 | 26 | </script> |
| 27 | 27 | <?php |
| 28 | 28 | } else |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | wp_redirect(preg_replace('|^http://|', 'https://', $_SERVER['REQUEST_URI']));
|
| 48 | 48 | exit(); |
| 49 | 49 | } else {
|
| 50 | - wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
|
|
| 50 | + wp_redirect('https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
|
|
| 51 | 51 | exit(); |
| 52 | 52 | } |
| 53 | 53 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | * @param string $message Login message. |
| 61 | 61 | */ |
| 62 | 62 | $message = apply_filters('login_message', $message);
|
| 63 | - if (!empty($message)) echo $message . "\n"; |
|
| 63 | + if (!empty($message)) echo $message."\n"; |
|
| 64 | 64 | |
| 65 | 65 | } |
| 66 | 66 | |
@@ -208,9 +208,9 @@ discard block |
||
| 208 | 208 | |
| 209 | 209 | wp_set_password($new_pass, $user->ID); |
| 210 | 210 | update_user_meta($user->ID, 'default_password_nag', true); //Set up the Password change nag. |
| 211 | - $message = '<p><b>' . __('Your login Information :', 'geodirectory') . '</b></p>';
|
|
| 212 | - $message .= '<p>' . sprintf(__('Username: %s', 'geodirectory'), $user->user_login) . "</p>";
|
|
| 213 | - $message .= '<p>' . sprintf(__('Password: %s', 'geodirectory'), $new_pass) . "</p>";
|
|
| 211 | + $message = '<p><b>'.__('Your login Information :', 'geodirectory').'</b></p>';
|
|
| 212 | + $message .= '<p>'.sprintf(__('Username: %s', 'geodirectory'), $user->user_login)."</p>";
|
|
| 213 | + $message .= '<p>'.sprintf(__('Password: %s', 'geodirectory'), $new_pass)."</p>";
|
|
| 214 | 214 | //$message .= '<p>You can login to : <a href="'.home_url().'/?ptype=login' . "\">Login</a> or the URL is : ".home_url()."/?ptype=login</p>"; |
| 215 | 215 | //$message .= '<p>Thank You,<br> '.get_option('blogname').'</p>';
|
| 216 | 216 | $user_email = $user_data->user_email; |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | */ |
| 237 | 237 | $message = apply_filters('password_reset_message', $message, $new_pass);
|
| 238 | 238 | //geodir_sendEmail($fromEmail,$fromEmailName,$user_email,$user_name,$title,$message,$extra='');///forgot password email |
| 239 | - geodir_sendEmail($fromEmail, $fromEmailName, $user_email, $user_name, $title, $message, $extra = '', 'forgot_password', $post_id = '', $user->ID);///forgot password email |
|
| 239 | + geodir_sendEmail($fromEmail, $fromEmailName, $user_email, $user_name, $title, $message, $extra = '', 'forgot_password', $post_id = '', $user->ID); ///forgot password email |
|
| 240 | 240 | |
| 241 | 241 | return true; |
| 242 | 242 | } |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | * |
| 316 | 316 | * @param object $errors Registration error messages. |
| 317 | 317 | */ |
| 318 | - $errors = apply_filters('registration_errors', $errors,$user_login,$user_email);
|
|
| 318 | + $errors = apply_filters('registration_errors', $errors, $user_login, $user_email);
|
|
| 319 | 319 | |
| 320 | 320 | if ($errors->get_error_code()) |
| 321 | 321 | return $errors; |
@@ -337,8 +337,8 @@ discard block |
||
| 337 | 337 | $user_twitter = $_POST['user_twitter']; */ |
| 338 | 338 | $user_fname = sanitize_user($_POST['user_fname']); |
| 339 | 339 | $user_fname = str_replace(",", "", $user_fname);
|
| 340 | - if ( empty( $user_fname ) ) {
|
|
| 341 | - $user_fname = strstr( $user_login, '@', true ); |
|
| 340 | + if (empty($user_fname)) {
|
|
| 341 | + $user_fname = strstr($user_login, '@', true); |
|
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | /** |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | update_user_meta($user_id, 'first_name', $userName); // User Address Information Here |
| 369 | 369 | //update_user_meta($user_id, 'last_name', $_POST['user_lname']); // User Address Information Here |
| 370 | 370 | |
| 371 | - $user_nicename = geodir_generate_user_nicename( $userName, $user_login ); |
|
| 371 | + $user_nicename = geodir_generate_user_nicename($userName, $user_login); |
|
| 372 | 372 | |
| 373 | 373 | $updateUsersql = $wpdb->prepare("update $wpdb->users set user_url=%s, user_nicename=%s, display_name=%s where ID=%d", array($user_web, $user_nicename, $userName, $user_id));
|
| 374 | 374 | |
@@ -392,13 +392,13 @@ discard block |
||
| 392 | 392 | ///////REGISTRATION EMAIL START////// |
| 393 | 393 | $fromEmail = geodir_get_site_email_id(); |
| 394 | 394 | $fromEmailName = get_site_emailName(); |
| 395 | - $message = __('<p><b>' . __('Your login Information :', 'geodirectory') . '</b></p>
|
|
| 396 | -<p>' . __('Username:', 'geodirectory') . ' ' . $user_login . '</p>
|
|
| 397 | -<p>' . __('Password:', 'geodirectory') . ' ' . $user_pass . '</p>');
|
|
| 395 | + $message = __('<p><b>'.__('Your login Information :', 'geodirectory').'</b></p>
|
|
| 396 | +<p>' . __('Username:', 'geodirectory').' '.$user_login.'</p>
|
|
| 397 | +<p>' . __('Password:', 'geodirectory').' '.$user_pass.'</p>');
|
|
| 398 | 398 | |
| 399 | 399 | /////////////customer email////////////// |
| 400 | 400 | //geodir_sendEmail($fromEmail,$fromEmailName,$user_email,$userName,$subject,$client_message,$extra='');///To client email |
| 401 | - geodir_sendEmail($fromEmail, $fromEmailName, $user_email, $userName, '', $message, '', 'registration', '', $user_id);/// registration email |
|
| 401 | + geodir_sendEmail($fromEmail, $fromEmailName, $user_email, $userName, '', $message, '', 'registration', '', $user_id); /// registration email |
|
| 402 | 402 | //////REGISTRATION EMAIL END//////// |
| 403 | 403 | } |
| 404 | 404 | |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | $action = 'resetpass'; |
| 430 | 430 | |
| 431 | 431 | // validate action so as to default to the login screen |
| 432 | - if (!in_array($action, array('logout', 'lostpassword', 'retrievepassword', 'resetpass', 'rp', 'register', 'login')) && false === has_filter('login_form_' . $action))
|
|
| 432 | + if (!in_array($action, array('logout', 'lostpassword', 'retrievepassword', 'resetpass', 'rp', 'register', 'login')) && false === has_filter('login_form_'.$action))
|
|
| 433 | 433 | $action = 'login'; |
| 434 | 434 | |
| 435 | 435 | nocache_headers(); |
@@ -439,8 +439,8 @@ discard block |
||
| 439 | 439 | $_SERVER['PHP_SELF'] = str_replace($_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF']); |
| 440 | 440 | |
| 441 | 441 | $schema = (isset($_SERVER['HTTPS']) && geodir_strtolower($_SERVER['HTTPS']) == 'on') ? 'https://' : 'http://'; |
| 442 | - if (dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) != home_url()) |
|
| 443 | - update_option('siteurl', dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']));
|
|
| 442 | + if (dirname($schema.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']) != home_url()) |
|
| 443 | + update_option('siteurl', dirname($schema.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']));
|
|
| 444 | 444 | } |
| 445 | 445 | |
| 446 | 446 | //Set a cookie now to see if they are supported by the browser. |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | * |
| 456 | 456 | * @since 1.0.0 |
| 457 | 457 | */ |
| 458 | - do_action('login_form_' . $action);
|
|
| 458 | + do_action('login_form_'.$action);
|
|
| 459 | 459 | |
| 460 | 460 | $http_post = ('POST' == $_SERVER['REQUEST_METHOD']);
|
| 461 | 461 | |
@@ -495,7 +495,7 @@ discard block |
||
| 495 | 495 | * @since 1.0.0 |
| 496 | 496 | */ |
| 497 | 497 | do_action('lost_password');
|
| 498 | - $message = '<div class="sucess_msg">' . ENTER_USER_EMAIL_NEW_PW_MSG . '</div>'; |
|
| 498 | + $message = '<div class="sucess_msg">'.ENTER_USER_EMAIL_NEW_PW_MSG.'</div>'; |
|
| 499 | 499 | $user_login = isset($_POST['user_login']) ? stripslashes($_POST['user_login']) : ''; |
| 500 | 500 | |
| 501 | 501 | break; |
@@ -509,7 +509,7 @@ discard block |
||
| 509 | 509 | exit(); |
| 510 | 510 | } |
| 511 | 511 | |
| 512 | - wp_redirect(geodir_login_url(array('error'=>'invalidkey','action'=>'lostpassword')));
|
|
| 512 | + wp_redirect(geodir_login_url(array('error'=>'invalidkey', 'action'=>'lostpassword')));
|
|
| 513 | 513 | exit(); |
| 514 | 514 | |
| 515 | 515 | break; |
@@ -642,15 +642,15 @@ discard block |
||
| 642 | 642 | $user_ID = !empty($user->ID) ? $user->ID : get_current_user_id(); |
| 643 | 643 | $post_types = geodir_get_posttypes(); |
| 644 | 644 | |
| 645 | - if ( !empty( $_REQUEST['stype'] ) ) {
|
|
| 645 | + if (!empty($_REQUEST['stype'])) {
|
|
| 646 | 646 | $dashboard_post_type = sanitize_text_field($_REQUEST['stype']); |
| 647 | 647 | } else {
|
| 648 | - $user_listings = geodir_user_post_listing_count( $user_ID ); |
|
| 649 | - if ( !empty( $user_listings ) && $dashboard_post_types = array_keys( $user_listings ) ) {
|
|
| 648 | + $user_listings = geodir_user_post_listing_count($user_ID); |
|
| 649 | + if (!empty($user_listings) && $dashboard_post_types = array_keys($user_listings)) {
|
|
| 650 | 650 | $dashboard_post_type = $dashboard_post_types[0]; |
| 651 | 651 | } |
| 652 | 652 | } |
| 653 | - if ( !( !empty( $dashboard_post_type ) && in_array( $dashboard_post_type, $post_types ) ) ) {
|
|
| 653 | + if (!(!empty($dashboard_post_type) && in_array($dashboard_post_type, $post_types))) {
|
|
| 654 | 654 | $dashboard_post_type = $post_types[0]; |
| 655 | 655 | } |
| 656 | 656 | |
@@ -698,7 +698,7 @@ discard block |
||
| 698 | 698 | |
| 699 | 699 | if (is_wp_error($user)) {
|
| 700 | 700 | if (isset($_SERVER['HTTP_REFERER']) && strstr($_SERVER['HTTP_REFERER'], 'ptype=property_submit') && $_POST['log'] != '' && $_POST['pwd'] != '') {
|
| 701 | - wp_redirect($_SERVER['HTTP_REFERER'] . '&emsg=1'); |
|
| 701 | + wp_redirect($_SERVER['HTTP_REFERER'].'&emsg=1'); |
|
| 702 | 702 | } |
| 703 | 703 | } |
| 704 | 704 | if (!is_wp_error($user)) {
|
@@ -726,7 +726,7 @@ discard block |
||
| 726 | 726 | |
| 727 | 727 | // Some parts of this script use the main login form to display a message |
| 728 | 728 | if (isset($_GET['loggedout']) && TRUE == $_GET['loggedout']) {
|
| 729 | - $successmsg = '<div class="sucess_msg">' . YOU_ARE_LOGED_OUT_MSG . '</div>'; |
|
| 729 | + $successmsg = '<div class="sucess_msg">'.YOU_ARE_LOGED_OUT_MSG.'</div>'; |
|
| 730 | 730 | } elseif (isset($_GET['registration']) && 'disabled' == $_GET['registration']) {
|
| 731 | 731 | $successmsg = USER_REG_NOT_ALLOW_MSG; |
| 732 | 732 | } elseif (isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail']) {
|
@@ -739,9 +739,9 @@ discard block |
||
| 739 | 739 | |
| 740 | 740 | if ((isset($_POST['log']) && $_POST['log'] != '' && $errors) || ((!isset($_POST['log']) || $_POST['log'] == '') && isset($_REQUEST['testcookie']) && $_REQUEST['testcookie'])) {
|
| 741 | 741 | if (isset($_REQUEST['pagetype']) && $_REQUEST['pagetype'] != '') {
|
| 742 | - wp_redirect($_REQUEST['pagetype'] . '&emsg=1'); |
|
| 742 | + wp_redirect($_REQUEST['pagetype'].'&emsg=1'); |
|
| 743 | 743 | } else {
|
| 744 | - wp_redirect(geodir_login_url(array('logemsg'=>'1','redirect_to'=>urlencode($_REQUEST['redirect_to']))));
|
|
| 744 | + wp_redirect(geodir_login_url(array('logemsg'=>'1', 'redirect_to'=>urlencode($_REQUEST['redirect_to']))));
|
|
| 745 | 745 | } |
| 746 | 746 | gd_die(); |
| 747 | 747 | } |
@@ -749,28 +749,28 @@ discard block |
||
| 749 | 749 | endswitch; // end action switch |
| 750 | 750 | } |
| 751 | 751 | |
| 752 | -function geodir_generate_user_nicename( $display_name, $user_login ) {
|
|
| 752 | +function geodir_generate_user_nicename($display_name, $user_login) {
|
|
| 753 | 753 | global $wpdb; |
| 754 | 754 | $user_nicename = ''; |
| 755 | - if ( ! empty( $display_name ) ) {
|
|
| 756 | - $user_nicename = sanitize_user( $display_name, true ); |
|
| 755 | + if (!empty($display_name)) {
|
|
| 756 | + $user_nicename = sanitize_user($display_name, true); |
|
| 757 | 757 | } |
| 758 | - if ( empty( $user_nicename ) ) {
|
|
| 758 | + if (empty($user_nicename)) {
|
|
| 759 | 759 | $user_nicename = $user_login; |
| 760 | 760 | } |
| 761 | - $user_nicename = mb_substr( $user_nicename, 0, 50 ); |
|
| 762 | - $user_nicename = sanitize_title( $user_nicename ); |
|
| 763 | - $user_nicename = apply_filters( 'pre_user_nicename', $user_nicename ); |
|
| 761 | + $user_nicename = mb_substr($user_nicename, 0, 50); |
|
| 762 | + $user_nicename = sanitize_title($user_nicename); |
|
| 763 | + $user_nicename = apply_filters('pre_user_nicename', $user_nicename);
|
|
| 764 | 764 | |
| 765 | - $user_nicename_check = $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->users WHERE user_nicename = %s AND user_login != %s LIMIT 1" , $user_nicename, $user_login));
|
|
| 765 | + $user_nicename_check = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users WHERE user_nicename = %s AND user_login != %s LIMIT 1", $user_nicename, $user_login));
|
|
| 766 | 766 | |
| 767 | - if ( $user_nicename_check ) {
|
|
| 767 | + if ($user_nicename_check) {
|
|
| 768 | 768 | $suffix = 2; |
| 769 | 769 | while ($user_nicename_check) {
|
| 770 | 770 | // user_nicename allows 50 chars. Subtract one for a hyphen, plus the length of the suffix. |
| 771 | - $base_length = 49 - mb_strlen( $suffix ); |
|
| 772 | - $alt_user_nicename = mb_substr( $user_nicename, 0, $base_length ) . "-$suffix"; |
|
| 773 | - $user_nicename_check = $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->users WHERE user_nicename = %s AND user_login != %s LIMIT 1" , $alt_user_nicename, $user_login));
|
|
| 771 | + $base_length = 49 - mb_strlen($suffix); |
|
| 772 | + $alt_user_nicename = mb_substr($user_nicename, 0, $base_length)."-$suffix"; |
|
| 773 | + $user_nicename_check = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users WHERE user_nicename = %s AND user_login != %s LIMIT 1", $alt_user_nicename, $user_login));
|
|
| 774 | 774 | $suffix++; |
| 775 | 775 | } |
| 776 | 776 | $user_nicename = $alt_user_nicename; |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | /* ON TEMPLATE INCLUDE */ |
| 137 | 137 | ///////////////////////// |
| 138 | 138 | |
| 139 | -add_filter('template_include', 'geodir_template_loader',9);
|
|
| 139 | +add_filter('template_include', 'geodir_template_loader', 9);
|
|
| 140 | 140 | |
| 141 | 141 | ///////////////////////// |
| 142 | 142 | /* CATEGORY / TAXONOMY / CUSTOM POST ACTIONS */ |
@@ -176,9 +176,9 @@ discard block |
||
| 176 | 176 | /* WP REVIEW COUNT ACTIONS */ |
| 177 | 177 | //////////////////////// |
| 178 | 178 | |
| 179 | -add_action('geodir_update_postrating', 'geodir_term_review_count_force_update_single_post', 100,1);
|
|
| 179 | +add_action('geodir_update_postrating', 'geodir_term_review_count_force_update_single_post', 100, 1);
|
|
| 180 | 180 | //add_action('geodir_update_postrating', 'geodir_term_review_count_force_update', 100);
|
| 181 | -add_action('transition_post_status', 'geodir_term_review_count_force_update', 100,3);
|
|
| 181 | +add_action('transition_post_status', 'geodir_term_review_count_force_update', 100, 3);
|
|
| 182 | 182 | //add_action('created_term', 'geodir_term_review_count_force_update', 100);
|
| 183 | 183 | add_action('edited_term', 'geodir_term_review_count_force_update', 100);
|
| 184 | 184 | add_action('delete_term', 'geodir_term_review_count_force_update', 100);
|
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | */ |
| 224 | 224 | function geodir_unset_prev_theme_nav_location($newname) |
| 225 | 225 | {
|
| 226 | - $geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
|
|
| 226 | + $geodir_theme_location = get_option('geodir_theme_location_nav_'.$newname);
|
|
| 227 | 227 | if ($geodir_theme_location) {
|
| 228 | 228 | update_option('geodir_theme_location_nav', $geodir_theme_location);
|
| 229 | 229 | } else {
|
@@ -258,13 +258,13 @@ discard block |
||
| 258 | 258 | include_once('geodirectory-functions/listing_filters.php');
|
| 259 | 259 | |
| 260 | 260 | // Theme My Login compatibility fix |
| 261 | - if ( isset( $_REQUEST['geodir_search'] ) && class_exists( 'Theme_My_Login' ) ) {
|
|
| 262 | - remove_action( 'pre_get_posts', array( Theme_My_Login::get_object(), 'pre_get_posts' ) ); |
|
| 261 | + if (isset($_REQUEST['geodir_search']) && class_exists('Theme_My_Login')) {
|
|
| 262 | + remove_action('pre_get_posts', array(Theme_My_Login::get_object(), 'pre_get_posts'));
|
|
| 263 | 263 | } |
| 264 | 264 | |
| 265 | - if ( isset( $_REQUEST['geodir_search'] ) ) {
|
|
| 266 | - add_filter( 'geodir_filter_widget_listings_fields', 'geodir_search_widget_location_filter_fields', 100, 3 ); |
|
| 267 | - add_filter( 'geodir_filter_widget_listings_orderby', 'geodir_search_widget_location_filter_orderby', 100, 3 ); |
|
| 265 | + if (isset($_REQUEST['geodir_search'])) {
|
|
| 266 | + add_filter('geodir_filter_widget_listings_fields', 'geodir_search_widget_location_filter_fields', 100, 3);
|
|
| 267 | + add_filter('geodir_filter_widget_listings_orderby', 'geodir_search_widget_location_filter_orderby', 100, 3);
|
|
| 268 | 268 | } |
| 269 | 269 | } |
| 270 | 270 | |
@@ -331,8 +331,8 @@ discard block |
||
| 331 | 331 | |
| 332 | 332 | /////// GEO DIRECOTORY CUSTOM HOOKS /// |
| 333 | 333 | |
| 334 | -add_action('geodir_before_tab_content', 'geodir_before_tab_content');// this function is in custom_functions.php and it is used to wrap detail page tab content
|
|
| 335 | -add_action('geodir_after_tab_content', 'geodir_after_tab_content');// this function is in custom_functions.php and it is used to wrap detail page tab content
|
|
| 334 | +add_action('geodir_before_tab_content', 'geodir_before_tab_content'); // this function is in custom_functions.php and it is used to wrap detail page tab content
|
|
| 335 | +add_action('geodir_after_tab_content', 'geodir_after_tab_content'); // this function is in custom_functions.php and it is used to wrap detail page tab content
|
|
| 336 | 336 | |
| 337 | 337 | // Detail page sidebar content |
| 338 | 338 | add_action('geodir_detail_page_sidebar', 'geodir_detail_page_sidebar_content_sorting', 1);
|
@@ -432,8 +432,8 @@ discard block |
||
| 432 | 432 | do_action('geodir_after_social_sharing_buttons');
|
| 433 | 433 | $content_html = ob_get_clean(); |
| 434 | 434 | if (trim($content_html) != '') |
| 435 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>'; |
|
| 436 | - if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
|
|
| 435 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">'.$content_html.'</div>'; |
|
| 436 | + if ((int) get_option('geodir_disable_tfg_buttons_section') != 1) {
|
|
| 437 | 437 | /** |
| 438 | 438 | * Filter the geodir_social_sharing_buttons() function content. |
| 439 | 439 | * |
@@ -473,12 +473,12 @@ discard block |
||
| 473 | 473 | $post_id = $post->ID; |
| 474 | 474 | |
| 475 | 475 | if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
|
| 476 | - $post_id = (int)$_REQUEST['pid']; |
|
| 476 | + $post_id = (int) $_REQUEST['pid']; |
|
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | $postlink = get_permalink(geodir_add_listing_page_id()); |
| 480 | 480 | $editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
|
| 481 | - echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
|
|
| 481 | + echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="'.esc_url($editlink).'">'.__('Edit this Post', 'geodirectory').'</a></p>';
|
|
| 482 | 482 | } |
| 483 | 483 | }// end of if, if its a preview or not |
| 484 | 484 | /** |
@@ -489,8 +489,8 @@ discard block |
||
| 489 | 489 | do_action('geodir_after_edit_post_link');
|
| 490 | 490 | $content_html = ob_get_clean(); |
| 491 | 491 | if (trim($content_html) != '') |
| 492 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>'; |
|
| 493 | - if ((int)get_option('geodir_disable_user_links_section') != 1) {
|
|
| 492 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">'.$content_html.'</div>'; |
|
| 493 | + if ((int) get_option('geodir_disable_user_links_section') != 1) {
|
|
| 494 | 494 | /** |
| 495 | 495 | * Filter the geodir_edit_post_link() function content. |
| 496 | 496 | * |
@@ -511,8 +511,8 @@ discard block |
||
| 511 | 511 | */ |
| 512 | 512 | function geodir_detail_page_google_analytics() |
| 513 | 513 | {
|
| 514 | - global $post,$preview; |
|
| 515 | - if($preview){return '';}
|
|
| 514 | + global $post, $preview; |
|
| 515 | + if ($preview) {return ''; }
|
|
| 516 | 516 | $package_info = array(); |
| 517 | 517 | $package_info = geodir_post_package_info($package_info, $post); |
| 518 | 518 | |
@@ -544,14 +544,14 @@ discard block |
||
| 544 | 544 | $hide_refresh = get_option('geodir_ga_auto_refresh');
|
| 545 | 545 | |
| 546 | 546 | $auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0; |
| 547 | - if (get_option('geodir_ga_stats') && is_user_logged_in() && (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) {
|
|
| 547 | + if (get_option('geodir_ga_stats') && is_user_logged_in() && (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id() == $post->post_author || current_user_can('manage_options'))) {
|
|
| 548 | 548 | $page_url = urlencode($_SERVER['REQUEST_URI']); |
| 549 | 549 | ?> |
| 550 | 550 | <script type="text/javascript"> |
| 551 | 551 | var gd_gaTimeOut; |
| 552 | - var gd_gaTime = parseInt('<?php echo $refresh_time;?>');
|
|
| 553 | - var gd_gaHideRefresh = <?php echo (int)$hide_refresh;?>; |
|
| 554 | - var gd_gaAutoRefresh = <?php echo $auto_refresh;?>; |
|
| 552 | + var gd_gaTime = parseInt('<?php echo $refresh_time; ?>');
|
|
| 553 | + var gd_gaHideRefresh = <?php echo (int) $hide_refresh; ?>; |
|
| 554 | + var gd_gaAutoRefresh = <?php echo $auto_refresh; ?>; |
|
| 555 | 555 | ga_data1 = false; |
| 556 | 556 | ga_data2 = false; |
| 557 | 557 | ga_data3 = false; |
@@ -692,7 +692,7 @@ discard block |
||
| 692 | 692 | } |
| 693 | 693 | |
| 694 | 694 | function gdga_noResults() {
|
| 695 | - jQuery('#gdga-chart-container').html('<?php _e('No results available','geodirectory');?>');
|
|
| 695 | + jQuery('#gdga-chart-container').html('<?php _e('No results available', 'geodirectory'); ?>');
|
|
| 696 | 696 | jQuery('#gdga-legend-container').html('');
|
| 697 | 697 | } |
| 698 | 698 | |
@@ -724,18 +724,18 @@ discard block |
||
| 724 | 724 | var data2 = results[1].rows.map(function(row) { return +row[2]; });
|
| 725 | 725 | //var labelsN = results[0].rows.map(function(row) { return +row[1]; });
|
| 726 | 726 | |
| 727 | - var labels = ['<?php _e('Jan', 'geodirectory');?>',
|
|
| 728 | - '<?php _e('Feb', 'geodirectory');?>',
|
|
| 729 | - '<?php _e('Mar', 'geodirectory');?>',
|
|
| 730 | - '<?php _e('Apr', 'geodirectory');?>',
|
|
| 731 | - '<?php _e('May', 'geodirectory');?>',
|
|
| 732 | - '<?php _e('Jun', 'geodirectory');?>',
|
|
| 733 | - '<?php _e('Jul', 'geodirectory');?>',
|
|
| 734 | - '<?php _e('Aug', 'geodirectory');?>',
|
|
| 735 | - '<?php _e('Sep', 'geodirectory');?>',
|
|
| 736 | - '<?php _e('Oct', 'geodirectory');?>',
|
|
| 737 | - '<?php _e('Nov', 'geodirectory');?>',
|
|
| 738 | - '<?php _e('Dec', 'geodirectory');?>'];
|
|
| 727 | + var labels = ['<?php _e('Jan', 'geodirectory'); ?>',
|
|
| 728 | + '<?php _e('Feb', 'geodirectory'); ?>',
|
|
| 729 | + '<?php _e('Mar', 'geodirectory'); ?>',
|
|
| 730 | + '<?php _e('Apr', 'geodirectory'); ?>',
|
|
| 731 | + '<?php _e('May', 'geodirectory'); ?>',
|
|
| 732 | + '<?php _e('Jun', 'geodirectory'); ?>',
|
|
| 733 | + '<?php _e('Jul', 'geodirectory'); ?>',
|
|
| 734 | + '<?php _e('Aug', 'geodirectory'); ?>',
|
|
| 735 | + '<?php _e('Sep', 'geodirectory'); ?>',
|
|
| 736 | + '<?php _e('Oct', 'geodirectory'); ?>',
|
|
| 737 | + '<?php _e('Nov', 'geodirectory'); ?>',
|
|
| 738 | + '<?php _e('Dec', 'geodirectory'); ?>'];
|
|
| 739 | 739 | |
| 740 | 740 | // Ensure the data arrays are at least as long as the labels array. |
| 741 | 741 | // Chart.js bar charts don't (yet) accept sparse datasets. |
@@ -748,13 +748,13 @@ discard block |
||
| 748 | 748 | labels : labels, |
| 749 | 749 | datasets : [ |
| 750 | 750 | {
|
| 751 | - label: '<?php _e('Last Year', 'geodirectory');?>',
|
|
| 751 | + label: '<?php _e('Last Year', 'geodirectory'); ?>',
|
|
| 752 | 752 | fillColor : "rgba(220,220,220,0.5)", |
| 753 | 753 | strokeColor : "rgba(220,220,220,1)", |
| 754 | 754 | data : data2 |
| 755 | 755 | }, |
| 756 | 756 | {
|
| 757 | - label: '<?php _e('This Year', 'geodirectory');?>',
|
|
| 757 | + label: '<?php _e('This Year', 'geodirectory'); ?>',
|
|
| 758 | 758 | fillColor : "rgba(151,187,205,0.5)", |
| 759 | 759 | strokeColor : "rgba(151,187,205,1)", |
| 760 | 760 | data : data1 |
@@ -799,30 +799,30 @@ discard block |
||
| 799 | 799 | |
| 800 | 800 | <?php |
| 801 | 801 | // Here we list the shorthand days of the week so it can be used in translation. |
| 802 | - __("Mon",'geodirectory');
|
|
| 803 | - __("Tue",'geodirectory');
|
|
| 804 | - __("Wed",'geodirectory');
|
|
| 805 | - __("Thu",'geodirectory');
|
|
| 806 | - __("Fri",'geodirectory');
|
|
| 807 | - __("Sat",'geodirectory');
|
|
| 808 | - __("Sun",'geodirectory');
|
|
| 802 | + __("Mon", 'geodirectory');
|
|
| 803 | + __("Tue", 'geodirectory');
|
|
| 804 | + __("Wed", 'geodirectory');
|
|
| 805 | + __("Thu", 'geodirectory');
|
|
| 806 | + __("Fri", 'geodirectory');
|
|
| 807 | + __("Sat", 'geodirectory');
|
|
| 808 | + __("Sun", 'geodirectory');
|
|
| 809 | 809 | ?> |
| 810 | 810 | |
| 811 | 811 | labels = [ |
| 812 | - "<?php _e(date('D', strtotime("+1 day")),'geodirectory'); ?>",
|
|
| 813 | - "<?php _e(date('D', strtotime("+2 day")),'geodirectory'); ?>",
|
|
| 814 | - "<?php _e(date('D', strtotime("+3 day")),'geodirectory'); ?>",
|
|
| 815 | - "<?php _e(date('D', strtotime("+4 day")),'geodirectory'); ?>",
|
|
| 816 | - "<?php _e(date('D', strtotime("+5 day")),'geodirectory'); ?>",
|
|
| 817 | - "<?php _e(date('D', strtotime("+6 day")),'geodirectory'); ?>",
|
|
| 818 | - "<?php _e(date('D', strtotime("+7 day")),'geodirectory'); ?>"
|
|
| 812 | + "<?php _e(date('D', strtotime("+1 day")), 'geodirectory'); ?>",
|
|
| 813 | + "<?php _e(date('D', strtotime("+2 day")), 'geodirectory'); ?>",
|
|
| 814 | + "<?php _e(date('D', strtotime("+3 day")), 'geodirectory'); ?>",
|
|
| 815 | + "<?php _e(date('D', strtotime("+4 day")), 'geodirectory'); ?>",
|
|
| 816 | + "<?php _e(date('D', strtotime("+5 day")), 'geodirectory'); ?>",
|
|
| 817 | + "<?php _e(date('D', strtotime("+6 day")), 'geodirectory'); ?>",
|
|
| 818 | + "<?php _e(date('D', strtotime("+7 day")), 'geodirectory'); ?>"
|
|
| 819 | 819 | ]; |
| 820 | 820 | |
| 821 | 821 | var data = {
|
| 822 | 822 | labels : labels, |
| 823 | 823 | datasets : [ |
| 824 | 824 | {
|
| 825 | - label: '<?php _e('Last Week', 'geodirectory');?>',
|
|
| 825 | + label: '<?php _e('Last Week', 'geodirectory'); ?>',
|
|
| 826 | 826 | fillColor : "rgba(220,220,220,0.5)", |
| 827 | 827 | strokeColor : "rgba(220,220,220,1)", |
| 828 | 828 | pointColor : "rgba(220,220,220,1)", |
@@ -830,7 +830,7 @@ discard block |
||
| 830 | 830 | data : data2 |
| 831 | 831 | }, |
| 832 | 832 | {
|
| 833 | - label: '<?php _e('This Week', 'geodirectory');?>',
|
|
| 833 | + label: '<?php _e('This Week', 'geodirectory'); ?>',
|
|
| 834 | 834 | fillColor : "rgba(151,187,205,0.5)", |
| 835 | 835 | strokeColor : "rgba(151,187,205,1)", |
| 836 | 836 | pointColor : "rgba(151,187,205,1)", |
@@ -1037,18 +1037,18 @@ discard block |
||
| 1037 | 1037 | </style> |
| 1038 | 1038 | <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.min.js"></script> |
| 1039 | 1039 | <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.2/moment.min.js"></script> |
| 1040 | - <button type="button" class="gdga-show-analytics"><?php _e('Show Google Analytics', 'geodirectory');?></button>
|
|
| 1040 | + <button type="button" class="gdga-show-analytics"><?php _e('Show Google Analytics', 'geodirectory'); ?></button>
|
|
| 1041 | 1041 | <span id="ga_stats" class="gdga-analytics-box" style="display:none"> |
| 1042 | - <div id="ga-analytics-title"><?php _e("Analytics", 'geodirectory');?></div>
|
|
| 1042 | + <div id="ga-analytics-title"><?php _e("Analytics", 'geodirectory'); ?></div>
|
|
| 1043 | 1043 | <div id="gd-active-users-container"> |
| 1044 | - <div class="gd-ActiveUsers"><i id="gdga-loader-icon" class="fa fa-refresh fa-spin" title="<?php esc_attr_e("Refresh", 'geodirectory');?>"></i><?php _e("Active Users:", 'geodirectory');?>
|
|
| 1044 | + <div class="gd-ActiveUsers"><i id="gdga-loader-icon" class="fa fa-refresh fa-spin" title="<?php esc_attr_e("Refresh", 'geodirectory'); ?>"></i><?php _e("Active Users:", 'geodirectory'); ?>
|
|
| 1045 | 1045 | <b class="gd-ActiveUsers-value">0</b> |
| 1046 | 1046 | </div> |
| 1047 | 1047 | </div> |
| 1048 | 1048 | <select id="gdga-select-analytic" onchange="gdga_select_option();" style="display: none;"> |
| 1049 | - <option value="weeks"><?php _e("Last Week vs This Week", 'geodirectory');?></option>
|
|
| 1050 | - <option value="years"><?php _e("This Year vs Last Year", 'geodirectory');?></option>
|
|
| 1051 | - <option value="country"><?php _e("Top Countries", 'geodirectory');?></option>
|
|
| 1049 | + <option value="weeks"><?php _e("Last Week vs This Week", 'geodirectory'); ?></option>
|
|
| 1050 | + <option value="years"><?php _e("This Year vs Last Year", 'geodirectory'); ?></option>
|
|
| 1051 | + <option value="country"><?php _e("Top Countries", 'geodirectory'); ?></option>
|
|
| 1052 | 1052 | </select> |
| 1053 | 1053 | <div class="Chartjs-figure" id="gdga-chart-container"></div> |
| 1054 | 1054 | <ol class="Chartjs-legend" id="gdga-legend-container"></ol> |
@@ -1064,8 +1064,8 @@ discard block |
||
| 1064 | 1064 | do_action('geodir_after_google_analytics');
|
| 1065 | 1065 | $content_html = ob_get_clean(); |
| 1066 | 1066 | if (trim($content_html) != '') |
| 1067 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>'; |
|
| 1068 | - if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
|
|
| 1067 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">'.$content_html.'</div>'; |
|
| 1068 | + if ((int) get_option('geodir_disable_google_analytics_section') != 1) {
|
|
| 1069 | 1069 | /** |
| 1070 | 1070 | * Filter the geodir_edit_post_link() function content. |
| 1071 | 1071 | * |
@@ -1091,7 +1091,7 @@ discard block |
||
| 1091 | 1091 | {
|
| 1092 | 1092 | global $post, $preview, $post_images; |
| 1093 | 1093 | |
| 1094 | - if (!empty($post->ID) && geodir_cpt_has_rating_disabled((int)$post->ID)) {
|
|
| 1094 | + if (!empty($post->ID) && geodir_cpt_has_rating_disabled((int) $post->ID)) {
|
|
| 1095 | 1095 | return; |
| 1096 | 1096 | } |
| 1097 | 1097 | ob_start(); // Start buffering; |
@@ -1126,10 +1126,10 @@ discard block |
||
| 1126 | 1126 | |
| 1127 | 1127 | $reviews_text = $comment_count > 1 ? __("reviews", 'geodirectory') : __("review", 'geodirectory');
|
| 1128 | 1128 | |
| 1129 | - $html .= '<span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating"><span class="rating" itemprop="average" content="' . $post_avgratings . '">' . $post_avgratings . '</span> / <span itemprop="best" content="5">5</span> ' . __("based on", 'geodirectory') . ' </span><span class="count" itemprop="count" content="' . $comment_count . '">' . $comment_count . ' ' . $reviews_text . '</span><br />';
|
|
| 1129 | + $html .= '<span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating"><span class="rating" itemprop="average" content="'.$post_avgratings.'">'.$post_avgratings.'</span> / <span itemprop="best" content="5">5</span> '.__("based on", 'geodirectory').' </span><span class="count" itemprop="count" content="'.$comment_count.'">'.$comment_count.' '.$reviews_text.'</span><br />';
|
|
| 1130 | 1130 | |
| 1131 | 1131 | $html .= '<span class="item">'; |
| 1132 | - $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>'; |
|
| 1132 | + $html .= '<span class="fn" itemprop="itemreviewed">'.$post->post_title.'</span>'; |
|
| 1133 | 1133 | |
| 1134 | 1134 | if ($post_images) {
|
| 1135 | 1135 | foreach ($post_images as $img) {
|
@@ -1139,7 +1139,7 @@ discard block |
||
| 1139 | 1139 | } |
| 1140 | 1140 | |
| 1141 | 1141 | if (isset($post_img) && $post_img) {
|
| 1142 | - $html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />'; |
|
| 1142 | + $html .= '<br /><img src="'.$post_img.'" class="photo" alt="'.esc_attr($post->post_title).'" itemprop="photo" content="'.$post_img.'" class="photo" />'; |
|
| 1143 | 1143 | } |
| 1144 | 1144 | |
| 1145 | 1145 | $html .= '</span>'; |
@@ -1166,9 +1166,9 @@ discard block |
||
| 1166 | 1166 | do_action('geodir_after_detail_page_review_rating');
|
| 1167 | 1167 | $content_html = ob_get_clean(); |
| 1168 | 1168 | if (trim($content_html) != '') {
|
| 1169 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>'; |
|
| 1169 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">'.$content_html.'</div>'; |
|
| 1170 | 1170 | } |
| 1171 | - if ((int)get_option('geodir_disable_rating_info_section') != 1) {
|
|
| 1171 | + if ((int) get_option('geodir_disable_rating_info_section') != 1) {
|
|
| 1172 | 1172 | /** |
| 1173 | 1173 | * Filter the geodir_detail_page_review_rating() function content. |
| 1174 | 1174 | * |
@@ -1207,8 +1207,8 @@ discard block |
||
| 1207 | 1207 | |
| 1208 | 1208 | $content_html = ob_get_clean(); |
| 1209 | 1209 | if (trim($content_html) != '') |
| 1210 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>'; |
|
| 1211 | - if ((int)get_option('geodir_disable_listing_info_section') != 1) {
|
|
| 1210 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">'.$content_html.'</div>'; |
|
| 1211 | + if ((int) get_option('geodir_disable_listing_info_section') != 1) {
|
|
| 1212 | 1212 | /** |
| 1213 | 1213 | * Filter the output html for function geodir_detail_page_more_info(). |
| 1214 | 1214 | * |
@@ -1309,7 +1309,7 @@ discard block |
||
| 1309 | 1309 | 'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '',
|
| 1310 | 1310 | 'geodir_txt_form_wait' => __('Wait...', 'geodirectory'),
|
| 1311 | 1311 | 'geodir_txt_form_searching' => __('Searching...', 'geodirectory'),
|
| 1312 | - 'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
|
|
| 1312 | + 'fa_rating' => (int) get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
|
|
| 1313 | 1313 | 'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '',
|
| 1314 | 1314 | 'multirating' => defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_rating') ? true : false,
|
| 1315 | 1315 | 'geodir_map_name' => geodir_map_name(), |
@@ -1338,10 +1338,10 @@ discard block |
||
| 1338 | 1338 | foreach ($arr_alert_msg as $key => $value) {
|
| 1339 | 1339 | if (!is_scalar($value)) |
| 1340 | 1340 | continue; |
| 1341 | - $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8'); |
|
| 1341 | + $arr_alert_msg[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8'); |
|
| 1342 | 1342 | } |
| 1343 | 1343 | |
| 1344 | - $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';'; |
|
| 1344 | + $script = "var geodir_all_js_msg = ".json_encode($arr_alert_msg).';'; |
|
| 1345 | 1345 | echo '<script>'; |
| 1346 | 1346 | echo $script; |
| 1347 | 1347 | echo '</script>'; |
@@ -1431,7 +1431,7 @@ discard block |
||
| 1431 | 1431 | $geodir_old_sidebars = get_option('geodir_sidebars');
|
| 1432 | 1432 | if (is_array($geodir_old_sidebars)) {
|
| 1433 | 1433 | foreach ($geodir_old_sidebars as $key => $val) {
|
| 1434 | - if(0 === strpos($key, 'geodir_'))// if gd widget |
|
| 1434 | + if (0 === strpos($key, 'geodir_'))// if gd widget |
|
| 1435 | 1435 | {
|
| 1436 | 1436 | $sidebars_widgets[$key] = $geodir_old_sidebars[$key]; |
| 1437 | 1437 | } |
@@ -1510,7 +1510,7 @@ discard block |
||
| 1510 | 1510 | global $post; |
| 1511 | 1511 | $term_condition = ''; |
| 1512 | 1512 | if (isset($_REQUEST['backandedit'])) {
|
| 1513 | - $post = (object)$gd_session->get('listing');
|
|
| 1513 | + $post = (object) $gd_session->get('listing');
|
|
| 1514 | 1514 | $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : ''; |
| 1515 | 1515 | } |
| 1516 | 1516 | |
@@ -1524,7 +1524,7 @@ discard block |
||
| 1524 | 1524 | echo 'checked="checked"'; |
| 1525 | 1525 | } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition" |
| 1526 | 1526 | class="geodir_textfield" value="1" |
| 1527 | - style="display:inline-block"/><a href="<?php $terms_page = get_option('geodir_term_condition_page'); if($terms_page){ echo get_permalink($terms_page);}?>" target="_blank"><?php _e('Please accept our terms and conditions', 'geodirectory'); ?></a>
|
|
| 1527 | + style="display:inline-block"/><a href="<?php $terms_page = get_option('geodir_term_condition_page'); if ($terms_page) { echo get_permalink($terms_page); }?>" target="_blank"><?php _e('Please accept our terms and conditions', 'geodirectory'); ?></a>
|
|
| 1528 | 1528 | </span> |
| 1529 | 1529 | </div> |
| 1530 | 1530 | <span class="geodir_message_error"><?php if (isset($required_msg)) {
|
@@ -1564,7 +1564,7 @@ discard block |
||
| 1564 | 1564 | /** This action is documented in geodirectory_template_actions.php */ |
| 1565 | 1565 | $desc_limit = apply_filters('geodir_description_field_desc_limit', '');
|
| 1566 | 1566 | |
| 1567 | - if (!($desc_limit === '' || (int)$desc_limit > 0)) {
|
|
| 1567 | + if (!($desc_limit === '' || (int) $desc_limit > 0)) {
|
|
| 1568 | 1568 | $is_display = false; |
| 1569 | 1569 | } |
| 1570 | 1570 | } |
@@ -1612,16 +1612,16 @@ discard block |
||
| 1612 | 1612 | global $wpdb, $plugin_prefix; |
| 1613 | 1613 | |
| 1614 | 1614 | // Remove unused virtual page |
| 1615 | - $listings_page_id = (int)get_option('geodir_listing_page');
|
|
| 1615 | + $listings_page_id = (int) get_option('geodir_listing_page');
|
|
| 1616 | 1616 | if ($listings_page_id) {
|
| 1617 | - $wpdb->query($wpdb->prepare("DELETE FROM " . $wpdb->posts . " WHERE ID=%d AND post_name = %s AND post_type=%s", array($listings_page_id, 'listings', 'page')));
|
|
| 1617 | + $wpdb->query($wpdb->prepare("DELETE FROM ".$wpdb->posts." WHERE ID=%d AND post_name = %s AND post_type=%s", array($listings_page_id, 'listings', 'page')));
|
|
| 1618 | 1618 | delete_option('geodir_listing_page');
|
| 1619 | 1619 | } |
| 1620 | 1620 | |
| 1621 | 1621 | if (!get_option('geodir_changes_in_custom_fields_table')) {
|
| 1622 | 1622 | $wpdb->query( |
| 1623 | 1623 | $wpdb->prepare( |
| 1624 | - "UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s", |
|
| 1624 | + "UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET is_default=%s, is_admin=%s WHERE is_default=%s", |
|
| 1625 | 1625 | array('1', '1', 'admin')
|
| 1626 | 1626 | ) |
| 1627 | 1627 | ); |
@@ -1629,9 +1629,9 @@ discard block |
||
| 1629 | 1629 | |
| 1630 | 1630 | /* --- terms meta value set --- */ |
| 1631 | 1631 | |
| 1632 | - update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
|
|
| 1632 | + update_option('geodir_default_marker_icon', geodir_plugin_url().'/geodirectory-functions/map-functions/icons/pin.png');
|
|
| 1633 | 1633 | |
| 1634 | - $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
|
|
| 1634 | + $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".$wpdb->prefix."options WHERE option_name LIKE %s", array('%tax_meta_%')));
|
|
| 1635 | 1635 | |
| 1636 | 1636 | if (!empty($options_data)) {
|
| 1637 | 1637 | |
@@ -1639,7 +1639,7 @@ discard block |
||
| 1639 | 1639 | |
| 1640 | 1640 | $option_val = str_replace('tax_meta_', '', $optobj->option_name);
|
| 1641 | 1641 | |
| 1642 | - $taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM " . $wpdb->prefix . "term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val)));
|
|
| 1642 | + $taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM ".$wpdb->prefix."term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val)));
|
|
| 1643 | 1643 | |
| 1644 | 1644 | if (!empty($taxonomies_data)) {
|
| 1645 | 1645 | |
@@ -1648,17 +1648,17 @@ discard block |
||
| 1648 | 1648 | $taxObject = get_taxonomy($taxobj->taxonomy); |
| 1649 | 1649 | $post_type = $taxObject->object_type[0]; |
| 1650 | 1650 | |
| 1651 | - $opt_value = 'tax_meta_' . $post_type . '_' . $option_val; |
|
| 1651 | + $opt_value = 'tax_meta_'.$post_type.'_'.$option_val; |
|
| 1652 | 1652 | |
| 1653 | - $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
|
|
| 1653 | + $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM ".$wpdb->prefix."options WHERE option_name=%s", array('tax_meta_'.$option_val)));
|
|
| 1654 | 1654 | |
| 1655 | 1655 | if ($duplicate_data) {
|
| 1656 | 1656 | |
| 1657 | - $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
|
|
| 1657 | + $wpdb->query($wpdb->prepare("UPDATE ".$wpdb->prefix."options SET option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
|
|
| 1658 | 1658 | |
| 1659 | 1659 | } else {
|
| 1660 | 1660 | |
| 1661 | - $wpdb->query($wpdb->prepare("INSERT INTO " . $wpdb->prefix . "options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload)));
|
|
| 1661 | + $wpdb->query($wpdb->prepare("INSERT INTO ".$wpdb->prefix."options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload)));
|
|
| 1662 | 1662 | |
| 1663 | 1663 | } |
| 1664 | 1664 | |
@@ -1692,14 +1692,14 @@ discard block |
||
| 1692 | 1692 | |
| 1693 | 1693 | global $wpdb, $table_prefix; |
| 1694 | 1694 | |
| 1695 | - $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
|
|
| 1695 | + $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s", array($slug)));
|
|
| 1696 | 1696 | |
| 1697 | 1697 | if ($slug_exists) {
|
| 1698 | 1698 | |
| 1699 | 1699 | $suffix = 1; |
| 1700 | 1700 | do {
|
| 1701 | - $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix"; |
|
| 1702 | - $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
|
|
| 1701 | + $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1))."-$suffix"; |
|
| 1702 | + $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s", array($alt_location_name)));
|
|
| 1703 | 1703 | $suffix++; |
| 1704 | 1704 | } while ($location_slug_check && $suffix < 100); |
| 1705 | 1705 | |
@@ -1753,7 +1753,7 @@ discard block |
||
| 1753 | 1753 | |
| 1754 | 1754 | $suffix = 1; |
| 1755 | 1755 | do {
|
| 1756 | - $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix"; |
|
| 1756 | + $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1))."-$suffix"; |
|
| 1757 | 1757 | |
| 1758 | 1758 | /** This action is documented in geodirectory_hooks_actions.php */ |
| 1759 | 1759 | $term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
|
@@ -1765,7 +1765,7 @@ discard block |
||
| 1765 | 1765 | |
| 1766 | 1766 | //wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
|
| 1767 | 1767 | |
| 1768 | - $wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
|
|
| 1768 | + $wpdb->query($wpdb->prepare("UPDATE ".$table_prefix."terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
|
|
| 1769 | 1769 | |
| 1770 | 1770 | } |
| 1771 | 1771 | |
@@ -1774,18 +1774,18 @@ discard block |
||
| 1774 | 1774 | $post_type = !empty($taxonomy_obj) ? $taxonomy_obj->object_type[0] : NULL; |
| 1775 | 1775 | |
| 1776 | 1776 | $post_types = geodir_get_posttypes(); |
| 1777 | - if ($post_type && in_array($post_type, $post_types) && $post_type . '_tags' == $taxonomy) {
|
|
| 1778 | - $posts_obj = $wpdb->get_results($wpdb->prepare("SELECT object_id FROM " . $wpdb->term_relationships . " WHERE term_taxonomy_id = %d", array($tt_id)));
|
|
| 1777 | + if ($post_type && in_array($post_type, $post_types) && $post_type.'_tags' == $taxonomy) {
|
|
| 1778 | + $posts_obj = $wpdb->get_results($wpdb->prepare("SELECT object_id FROM ".$wpdb->term_relationships." WHERE term_taxonomy_id = %d", array($tt_id)));
|
|
| 1779 | 1779 | |
| 1780 | 1780 | if (!empty($posts_obj)) {
|
| 1781 | 1781 | foreach ($posts_obj as $post_obj) {
|
| 1782 | 1782 | $post_id = $post_obj->object_id; |
| 1783 | 1783 | |
| 1784 | - $raw_tags = wp_get_object_terms($post_id, $post_type . '_tags', array('fields' => 'names'));
|
|
| 1784 | + $raw_tags = wp_get_object_terms($post_id, $post_type.'_tags', array('fields' => 'names'));
|
|
| 1785 | 1785 | $post_tags = !empty($raw_tags) ? implode(',', $raw_tags) : '';
|
| 1786 | 1786 | |
| 1787 | - $listing_table = $plugin_prefix . $post_type . '_detail'; |
|
| 1788 | - $wpdb->query($wpdb->prepare("UPDATE " . $listing_table . " SET post_tags=%s WHERE post_id =%d", array($post_tags, $post_id)));
|
|
| 1787 | + $listing_table = $plugin_prefix.$post_type.'_detail'; |
|
| 1788 | + $wpdb->query($wpdb->prepare("UPDATE ".$listing_table." SET post_tags=%s WHERE post_id =%d", array($post_tags, $post_id)));
|
|
| 1789 | 1789 | } |
| 1790 | 1790 | } |
| 1791 | 1791 | } |
@@ -1819,7 +1819,7 @@ discard block |
||
| 1819 | 1819 | if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug) |
| 1820 | 1820 | return $slug_exists = true; |
| 1821 | 1821 | |
| 1822 | - if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
|
|
| 1822 | + if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
|
|
| 1823 | 1823 | return $slug_exists = true; |
| 1824 | 1824 | |
| 1825 | 1825 | return $slug_exists; |
@@ -1860,43 +1860,43 @@ discard block |
||
| 1860 | 1860 | |
| 1861 | 1861 | |
| 1862 | 1862 | $gd_page = ''; |
| 1863 | - if(geodir_is_page('home')){
|
|
| 1863 | + if (geodir_is_page('home')) {
|
|
| 1864 | 1864 | $gd_page = 'home'; |
| 1865 | 1865 | $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
|
| 1866 | 1866 | } |
| 1867 | - elseif(geodir_is_page('detail')){
|
|
| 1867 | + elseif (geodir_is_page('detail')) {
|
|
| 1868 | 1868 | $gd_page = 'detail'; |
| 1869 | 1869 | $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
|
| 1870 | 1870 | } |
| 1871 | - elseif(geodir_is_page('pt')){
|
|
| 1871 | + elseif (geodir_is_page('pt')) {
|
|
| 1872 | 1872 | $gd_page = 'pt'; |
| 1873 | 1873 | $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
|
| 1874 | 1874 | } |
| 1875 | - elseif(geodir_is_page('listing')){
|
|
| 1875 | + elseif (geodir_is_page('listing')) {
|
|
| 1876 | 1876 | $gd_page = 'listing'; |
| 1877 | 1877 | $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
|
| 1878 | 1878 | } |
| 1879 | - elseif(geodir_is_page('location')){
|
|
| 1879 | + elseif (geodir_is_page('location')) {
|
|
| 1880 | 1880 | $gd_page = 'location'; |
| 1881 | 1881 | $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
|
| 1882 | 1882 | } |
| 1883 | - elseif(geodir_is_page('search')){
|
|
| 1883 | + elseif (geodir_is_page('search')) {
|
|
| 1884 | 1884 | $gd_page = 'search'; |
| 1885 | 1885 | $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
|
| 1886 | 1886 | } |
| 1887 | - elseif(geodir_is_page('add-listing')){
|
|
| 1887 | + elseif (geodir_is_page('add-listing')) {
|
|
| 1888 | 1888 | $gd_page = 'add-listing'; |
| 1889 | 1889 | $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
|
| 1890 | 1890 | } |
| 1891 | - elseif(geodir_is_page('author')){
|
|
| 1891 | + elseif (geodir_is_page('author')) {
|
|
| 1892 | 1892 | $gd_page = 'author'; |
| 1893 | 1893 | $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
|
| 1894 | 1894 | } |
| 1895 | - elseif(geodir_is_page('login')){
|
|
| 1895 | + elseif (geodir_is_page('login')) {
|
|
| 1896 | 1896 | $gd_page = 'login'; |
| 1897 | 1897 | $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
|
| 1898 | 1898 | } |
| 1899 | - elseif(geodir_is_page('listing-success')){
|
|
| 1899 | + elseif (geodir_is_page('listing-success')) {
|
|
| 1900 | 1900 | $gd_page = 'listing-success'; |
| 1901 | 1901 | $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
|
| 1902 | 1902 | } |
@@ -1928,12 +1928,12 @@ discard block |
||
| 1928 | 1928 | |
| 1929 | 1929 | if (!get_option('geodir_set_post_attachments')) {
|
| 1930 | 1930 | |
| 1931 | - require_once(ABSPATH . 'wp-admin/includes/image.php'); |
|
| 1932 | - require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
| 1931 | + require_once(ABSPATH.'wp-admin/includes/image.php'); |
|
| 1932 | + require_once(ABSPATH.'wp-admin/includes/file.php'); |
|
| 1933 | 1933 | |
| 1934 | 1934 | $all_postypes = geodir_get_posttypes(); |
| 1935 | 1935 | |
| 1936 | - foreach($all_postypes as $post_type){
|
|
| 1936 | + foreach ($all_postypes as $post_type) {
|
|
| 1937 | 1937 | $args = array( |
| 1938 | 1938 | 'posts_per_page' => -1, |
| 1939 | 1939 | 'post_type' => $post_type, |
@@ -2027,7 +2027,7 @@ discard block |
||
| 2027 | 2027 | {
|
| 2028 | 2028 | $user_id = get_current_user_id(); |
| 2029 | 2029 | |
| 2030 | - if(!$user_id){return $post;}
|
|
| 2030 | + if (!$user_id) {return $post; }
|
|
| 2031 | 2031 | |
| 2032 | 2032 | $gd_post_types = geodir_get_posttypes(); |
| 2033 | 2033 | |
@@ -2136,7 +2136,7 @@ discard block |
||
| 2136 | 2136 | |
| 2137 | 2137 | if (array_key_exists('post_video', $tabs_arr)) {
|
| 2138 | 2138 | |
| 2139 | - $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type)));
|
|
| 2139 | + $field_title = $wpdb->get_var($wpdb->prepare("select site_title from ".GEODIR_CUSTOM_FIELDS_TABLE." where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type)));
|
|
| 2140 | 2140 | |
| 2141 | 2141 | if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '') |
| 2142 | 2142 | $tabs_arr['post_video']['heading_text'] = $field_title; |
@@ -2144,7 +2144,7 @@ discard block |
||
| 2144 | 2144 | |
| 2145 | 2145 | if (array_key_exists('special_offers', $tabs_arr)) {
|
| 2146 | 2146 | |
| 2147 | - $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type)));
|
|
| 2147 | + $field_title = $wpdb->get_var($wpdb->prepare("select site_title from ".GEODIR_CUSTOM_FIELDS_TABLE." where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type)));
|
|
| 2148 | 2148 | |
| 2149 | 2149 | if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '') |
| 2150 | 2150 | $tabs_arr['special_offers']['heading_text'] = $field_title; |
@@ -2165,7 +2165,7 @@ discard block |
||
| 2165 | 2165 | */ |
| 2166 | 2166 | function geodir_remove_template_redirect_actions() |
| 2167 | 2167 | {
|
| 2168 | - if (geodir_is_page('login')){
|
|
| 2168 | + if (geodir_is_page('login')) {
|
|
| 2169 | 2169 | remove_all_actions('template_redirect');
|
| 2170 | 2170 | remove_action('init', 'avia_modify_front', 10);
|
| 2171 | 2171 | } |
@@ -2212,25 +2212,25 @@ discard block |
||
| 2212 | 2212 | $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : ''; |
| 2213 | 2213 | |
| 2214 | 2214 | $wpdb->query( |
| 2215 | - $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
|
|
| 2215 | + $wpdb->prepare("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id = %d AND file=%s ",
|
|
| 2216 | 2216 | array($post_id, $split_img_file_path) |
| 2217 | 2217 | ) |
| 2218 | 2218 | ); |
| 2219 | 2219 | |
| 2220 | 2220 | $attachment_data = $wpdb->get_row( |
| 2221 | - $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
|
|
| 2221 | + $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id=%d",
|
|
| 2222 | 2222 | array($post_id) |
| 2223 | 2223 | ) |
| 2224 | 2224 | ); |
| 2225 | 2225 | |
| 2226 | 2226 | if (!empty($attachment_data)) {
|
| 2227 | - $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
|
|
| 2227 | + $wpdb->query("UPDATE ".GEODIR_ATTACHMENT_TABLE." SET menu_order=1 WHERE ID=".$attachment_data->ID);
|
|
| 2228 | 2228 | } |
| 2229 | 2229 | |
| 2230 | 2230 | |
| 2231 | - $table_name = $plugin_prefix . $post_type . '_detail'; |
|
| 2231 | + $table_name = $plugin_prefix.$post_type.'_detail'; |
|
| 2232 | 2232 | |
| 2233 | - $wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
|
|
| 2233 | + $wpdb->query("UPDATE ".$table_name." SET featured_image='' WHERE post_id =".$post_id);
|
|
| 2234 | 2234 | |
| 2235 | 2235 | geodir_set_wp_featured_image($post_id); |
| 2236 | 2236 | |
@@ -2258,9 +2258,9 @@ discard block |
||
| 2258 | 2258 | |
| 2259 | 2259 | foreach ($all_postypes as $posttype) {
|
| 2260 | 2260 | |
| 2261 | - $tablename = $plugin_prefix . $posttype . '_detail'; |
|
| 2261 | + $tablename = $plugin_prefix.$posttype.'_detail'; |
|
| 2262 | 2262 | |
| 2263 | - $get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
|
|
| 2263 | + $get_post_data = $wpdb->get_results("SELECT post_id FROM ".$tablename);
|
|
| 2264 | 2264 | |
| 2265 | 2265 | if (!empty($get_post_data)) {
|
| 2266 | 2266 | |
@@ -2268,7 +2268,7 @@ discard block |
||
| 2268 | 2268 | |
| 2269 | 2269 | $post_id = $data->post_id; |
| 2270 | 2270 | |
| 2271 | - $attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
|
|
| 2271 | + $attachment_data = $wpdb->get_results("SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id =".$post_id." AND file!=''");
|
|
| 2272 | 2272 | |
| 2273 | 2273 | if (!empty($attachment_data)) {
|
| 2274 | 2274 | |
@@ -2285,22 +2285,22 @@ discard block |
||
| 2285 | 2285 | |
| 2286 | 2286 | $file_name = $file_info['basename']; |
| 2287 | 2287 | |
| 2288 | - $img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name; |
|
| 2288 | + $img_arr['path'] = $uploads_path.$sub_dir.'/'.$file_name; |
|
| 2289 | 2289 | |
| 2290 | 2290 | if (!file_exists($img_arr['path'])) {
|
| 2291 | 2291 | |
| 2292 | - $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
|
|
| 2292 | + $wpdb->query("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE ID=".$attach->ID);
|
|
| 2293 | 2293 | |
| 2294 | 2294 | } |
| 2295 | 2295 | |
| 2296 | 2296 | } |
| 2297 | 2297 | |
| 2298 | - $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
|
|
| 2298 | + $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id=".$post_id." GROUP BY post_id");
|
|
| 2299 | 2299 | |
| 2300 | 2300 | if (!empty($attachment_data)) {
|
| 2301 | 2301 | |
| 2302 | 2302 | if ($attachment_data->ID) |
| 2303 | - $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
|
|
| 2303 | + $wpdb->query("UPDATE ".GEODIR_ATTACHMENT_TABLE." SET menu_order=1 WHERE ID=".$attachment_data->ID);
|
|
| 2304 | 2304 | |
| 2305 | 2305 | } else {
|
| 2306 | 2306 | |
@@ -2314,7 +2314,7 @@ discard block |
||
| 2314 | 2314 | |
| 2315 | 2315 | } |
| 2316 | 2316 | |
| 2317 | - $wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
|
|
| 2317 | + $wpdb->query("UPDATE ".$tablename." SET featured_image='' WHERE post_id =".$post_id);
|
|
| 2318 | 2318 | |
| 2319 | 2319 | geodir_set_wp_featured_image($post_id); |
| 2320 | 2320 | |
@@ -2343,7 +2343,7 @@ discard block |
||
| 2343 | 2343 | {
|
| 2344 | 2344 | |
| 2345 | 2345 | if (!get_option('geodir_default_rating_star_icon')) {
|
| 2346 | - update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
|
|
| 2346 | + update_option('geodir_default_rating_star_icon', geodir_plugin_url().'/geodirectory-assets/images/stars.png');
|
|
| 2347 | 2347 | } |
| 2348 | 2348 | |
| 2349 | 2349 | } |
@@ -2363,7 +2363,7 @@ discard block |
||
| 2363 | 2363 | function geodir_user_post_listing_count($user_id = 0) |
| 2364 | 2364 | {
|
| 2365 | 2365 | global $wpdb, $plugin_prefix, $current_user; |
| 2366 | - if(!$user_id){
|
|
| 2366 | + if (!$user_id) {
|
|
| 2367 | 2367 | $user_id = $current_user->ID; |
| 2368 | 2368 | } |
| 2369 | 2369 | |
@@ -2372,7 +2372,7 @@ discard block |
||
| 2372 | 2372 | $user_listing = array(); |
| 2373 | 2373 | if ($user_id && is_array($all_posts) && !empty($all_posts)) {
|
| 2374 | 2374 | foreach ($all_posts as $ptype) {
|
| 2375 | - $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_author=" . $user_id . " AND post_type='" . $ptype . "' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' OR post_status = 'pending' )");
|
|
| 2375 | + $total_posts = $wpdb->get_var("SELECT count( ID ) FROM ".$wpdb->prefix."posts WHERE post_author=".$user_id." AND post_type='".$ptype."' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' OR post_status = 'pending' )");
|
|
| 2376 | 2376 | |
| 2377 | 2377 | if ($total_posts > 0) {
|
| 2378 | 2378 | $user_listing[$ptype] = $total_posts; |
@@ -2413,19 +2413,19 @@ discard block |
||
| 2413 | 2413 | |
| 2414 | 2414 | $custom_fields = geodir_post_custom_fields($post_package_id, 'all', $post_type, $fields_location); |
| 2415 | 2415 | //remove video and special offers if it is already set to show |
| 2416 | - if(isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']){
|
|
| 2416 | + if (isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']) {
|
|
| 2417 | 2417 | $unset_video = true; |
| 2418 | 2418 | } |
| 2419 | 2419 | |
| 2420 | - if(isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']){
|
|
| 2420 | + if (isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']) {
|
|
| 2421 | 2421 | $unset_special_offers = true; |
| 2422 | 2422 | } |
| 2423 | - if(isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)){
|
|
| 2424 | - foreach($custom_fields as $key => $custom_field){
|
|
| 2425 | - if($custom_field['name']=='geodir_video' && isset($unset_video)){
|
|
| 2423 | + if (isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)) {
|
|
| 2424 | + foreach ($custom_fields as $key => $custom_field) {
|
|
| 2425 | + if ($custom_field['name'] == 'geodir_video' && isset($unset_video)) {
|
|
| 2426 | 2426 | unset($custom_fields[$key]); |
| 2427 | 2427 | } |
| 2428 | - if($custom_field['name']=='geodir_special_offers' && isset($unset_special_offers)){
|
|
| 2428 | + if ($custom_field['name'] == 'geodir_special_offers' && isset($unset_special_offers)) {
|
|
| 2429 | 2429 | unset($custom_fields[$key]); |
| 2430 | 2430 | } |
| 2431 | 2431 | } |
@@ -2442,7 +2442,7 @@ discard block |
||
| 2442 | 2442 | $post->{$field_name} = $_REQUEST[$field_name];
|
| 2443 | 2443 | } |
| 2444 | 2444 | |
| 2445 | - if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
|
|
| 2445 | + if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file', 'address', 'taxonomy'))) {
|
|
| 2446 | 2446 | if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
|
| 2447 | 2447 | continue; |
| 2448 | 2448 | } |
@@ -2475,7 +2475,7 @@ discard block |
||
| 2475 | 2475 | $post->{$field_name} = $_REQUEST[$field_name];
|
| 2476 | 2476 | } |
| 2477 | 2477 | |
| 2478 | - if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
|
|
| 2478 | + if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file', 'address', 'taxonomy'))) {
|
|
| 2479 | 2479 | $label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title']; |
| 2480 | 2480 | $site_title = trim($field['site_title']); |
| 2481 | 2481 | $type = $field; |
@@ -2491,21 +2491,21 @@ discard block |
||
| 2491 | 2491 | $variables_array['label'] = __($type['site_title'], 'geodirectory'); |
| 2492 | 2492 | $variables_array['value'] = isset($post->{$type['htmlvar_name']}) ? $post->{$type['htmlvar_name']} : '';
|
| 2493 | 2493 | |
| 2494 | - }else{
|
|
| 2494 | + } else {
|
|
| 2495 | 2495 | $i = 0; |
| 2496 | 2496 | $fieldset_count++; |
| 2497 | 2497 | $field_set_start = 1; |
| 2498 | - $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count; |
|
| 2498 | + $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_'.$fieldset_count; |
|
| 2499 | 2499 | $fieldset_arr[$fieldset_count]['label'] = $label; |
| 2500 | 2500 | } |
| 2501 | 2501 | |
| 2502 | 2502 | |
| 2503 | - if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
|
|
| 2503 | + if (isset($type['extra_fields'])) {$extra_fields = $type['extra_fields']; }
|
|
| 2504 | 2504 | $type = stripslashes_deep($type); // strip slashes |
| 2505 | - if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
|
|
| 2505 | + if (isset($type['extra_fields'])) {$type['extra_fields'] = $extra_fields; }
|
|
| 2506 | 2506 | $html = ''; |
| 2507 | 2507 | $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : ''; |
| 2508 | - if($html_var=='post'){$html_var='post_address';}
|
|
| 2508 | + if ($html_var == 'post') {$html_var = 'post_address'; }
|
|
| 2509 | 2509 | $field_icon = geodir_field_icon_proccess($type); |
| 2510 | 2510 | $filed_type = $type['type']; |
| 2511 | 2511 | |
@@ -2518,7 +2518,7 @@ discard block |
||
| 2518 | 2518 | * @param string $fields_location The location the field is to be show. |
| 2519 | 2519 | * @param array $type The array of field values. |
| 2520 | 2520 | */ |
| 2521 | - $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
|
|
| 2521 | + $html = apply_filters("geodir_custom_field_output_{$filed_type}", $html, $fields_location, $type);
|
|
| 2522 | 2522 | |
| 2523 | 2523 | |
| 2524 | 2524 | /** |
@@ -2564,7 +2564,7 @@ discard block |
||
| 2564 | 2564 | * @param string $htmlvar_name The field HTML var name. |
| 2565 | 2565 | */ |
| 2566 | 2566 | 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
|
| 2567 | - 'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>' |
|
| 2567 | + 'tab_content' => '<div class="geodir-company_info field-group xxx">'.$fieldset_html.'</div>' |
|
| 2568 | 2568 | ); |
| 2569 | 2569 | } |
| 2570 | 2570 | } else {
|
@@ -2628,7 +2628,7 @@ discard block |
||
| 2628 | 2628 | } |
| 2629 | 2629 | $status .= ")</strong>"; |
| 2630 | 2630 | |
| 2631 | - $html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
|
|
| 2631 | + $html = '<span class="geodir-post-status">'.$status_icon.' <font class="geodir-status-label">'.__('Status: ', 'geodirectory').'</font>'.$status.'</span>';
|
|
| 2632 | 2632 | } |
| 2633 | 2633 | } |
| 2634 | 2634 | |
@@ -2697,7 +2697,7 @@ discard block |
||
| 2697 | 2697 | * @return array Modified class array. |
| 2698 | 2698 | */ |
| 2699 | 2699 | function geodir_body_class_active_map($classes = array()) {
|
| 2700 | - $classes[] = 'gd-map-' . geodir_map_name(); |
|
| 2700 | + $classes[] = 'gd-map-'.geodir_map_name(); |
|
| 2701 | 2701 | |
| 2702 | 2702 | return $classes; |
| 2703 | 2703 | } |
@@ -2712,7 +2712,7 @@ discard block |
||
| 2712 | 2712 | * @return string Modified class string. |
| 2713 | 2713 | */ |
| 2714 | 2714 | function geodir_admin_body_class_active_map($class = '') {
|
| 2715 | - $class .= ' gd-map-' . geodir_map_name(); |
|
| 2715 | + $class .= ' gd-map-'.geodir_map_name(); |
|
| 2716 | 2716 | |
| 2717 | 2717 | return $class; |
| 2718 | 2718 | } |
@@ -2732,7 +2732,7 @@ discard block |
||
| 2732 | 2732 | * @return array Translation texts. |
| 2733 | 2733 | */ |
| 2734 | 2734 | function geodir_load_gd_options_text_translation($translation_texts = array()) {
|
| 2735 | - $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array(); |
|
| 2735 | + $translation_texts = !empty($translation_texts) && is_array($translation_texts) ? $translation_texts : array(); |
|
| 2736 | 2736 | |
| 2737 | 2737 | $gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_friend_subject', 'geodir_email_friend_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin');
|
| 2738 | 2738 | |
@@ -2798,17 +2798,17 @@ discard block |
||
| 2798 | 2798 | * @param array $args The array of menu arguments. |
| 2799 | 2799 | * @return array The modified arguments. |
| 2800 | 2800 | */ |
| 2801 | -function geodir_add_nav_menu_class( $args ) |
|
| 2801 | +function geodir_add_nav_menu_class($args) |
|
| 2802 | 2802 | {
|
| 2803 | 2803 | |
| 2804 | - if(isset($args['menu_class'])){
|
|
| 2804 | + if (isset($args['menu_class'])) {
|
|
| 2805 | 2805 | $args['menu_class'] = $args['menu_class']." gd-menu-z"; |
| 2806 | 2806 | } |
| 2807 | 2807 | |
| 2808 | 2808 | return $args; |
| 2809 | 2809 | } |
| 2810 | 2810 | |
| 2811 | -add_filter( 'wp_nav_menu_args', 'geodir_add_nav_menu_class' ); |
|
| 2811 | +add_filter('wp_nav_menu_args', 'geodir_add_nav_menu_class');
|
|
| 2812 | 2812 | |
| 2813 | 2813 | /** |
| 2814 | 2814 | * Filters WordPress locale ID. |
@@ -2848,10 +2848,10 @@ discard block |
||
| 2848 | 2848 | } |
| 2849 | 2849 | |
| 2850 | 2850 | add_action('geodir_after_save_listing', 'geodir_wpml_duplicate_listing', 100, 2);
|
| 2851 | - add_action( 'geodir_edit_post_link_html', 'geodir_wpml_frontend_duplicate_listing', 0, 1 ); |
|
| 2852 | - add_action( 'geodir_after_search_form', 'geodir_wpml_add_language_input_field' ); |
|
| 2851 | + add_action('geodir_edit_post_link_html', 'geodir_wpml_frontend_duplicate_listing', 0, 1);
|
|
| 2852 | + add_action('geodir_after_search_form', 'geodir_wpml_add_language_input_field');
|
|
| 2853 | 2853 | if (is_admin()) {
|
| 2854 | - add_filter( 'geodir_design_settings', 'geodir_wpml_duplicate_settings', 10, 1 ); |
|
| 2854 | + add_filter('geodir_design_settings', 'geodir_wpml_duplicate_settings', 10, 1);
|
|
| 2855 | 2855 | } |
| 2856 | 2856 | } |
| 2857 | 2857 | } |
@@ -2880,7 +2880,7 @@ discard block |
||
| 2880 | 2880 | } |
| 2881 | 2881 | |
| 2882 | 2882 | if (!empty($keep_vars)) {
|
| 2883 | - foreach ( $languages as $code => $url) {
|
|
| 2883 | + foreach ($languages as $code => $url) {
|
|
| 2884 | 2884 | $filter_url = $url['url']; |
| 2885 | 2885 | |
| 2886 | 2886 | foreach ($keep_vars as $var) {
|
@@ -2899,7 +2899,7 @@ discard block |
||
| 2899 | 2899 | |
| 2900 | 2900 | return $languages; |
| 2901 | 2901 | } |
| 2902 | -add_filter( 'icl_ls_languages', 'geodir_wpml_filter_ls_languages', 11, 1 ); |
|
| 2902 | +add_filter('icl_ls_languages', 'geodir_wpml_filter_ls_languages', 11, 1);
|
|
| 2903 | 2903 | |
| 2904 | 2904 | /** |
| 2905 | 2905 | * Remove Yoast SEO hook if disabled on GD pages. |
@@ -2907,18 +2907,18 @@ discard block |
||
| 2907 | 2907 | * @since 1.6.18 |
| 2908 | 2908 | * |
| 2909 | 2909 | */ |
| 2910 | -function geodir_remove_yoast_seo_metas(){
|
|
| 2911 | - if ( class_exists( 'WPSEO_Frontend' ) && geodir_is_geodir_page() && geodir_disable_yoast_seo_metas() ) {
|
|
| 2910 | +function geodir_remove_yoast_seo_metas() {
|
|
| 2911 | + if (class_exists('WPSEO_Frontend') && geodir_is_geodir_page() && geodir_disable_yoast_seo_metas()) {
|
|
| 2912 | 2912 | $wpseo = WPSEO_Frontend::get_instance(); |
| 2913 | 2913 | |
| 2914 | - remove_action( 'wp_head', array( $wpseo, 'metadesc' ), 6 ); |
|
| 2915 | - remove_action( 'wp_head', array( $wpseo, 'metakeywords' ), 11 ); |
|
| 2916 | - remove_filter( 'pre_get_document_title', array( $wpseo, 'title' ), 15 ); |
|
| 2917 | - remove_filter( 'wp_title', array( $wpseo, 'title' ), 15, 3 ); |
|
| 2918 | - remove_filter( 'thematic_doctitle', array( $wpseo, 'title' ), 15 ); |
|
| 2919 | - remove_filter( 'woo_title', array( $wpseo, 'fix_woo_title' ), 99 ); |
|
| 2914 | + remove_action('wp_head', array($wpseo, 'metadesc'), 6);
|
|
| 2915 | + remove_action('wp_head', array($wpseo, 'metakeywords'), 11);
|
|
| 2916 | + remove_filter('pre_get_document_title', array($wpseo, 'title'), 15);
|
|
| 2917 | + remove_filter('wp_title', array($wpseo, 'title'), 15, 3);
|
|
| 2918 | + remove_filter('thematic_doctitle', array($wpseo, 'title'), 15);
|
|
| 2919 | + remove_filter('woo_title', array($wpseo, 'fix_woo_title'), 99);
|
|
| 2920 | 2920 | |
| 2921 | - remove_action( 'template_redirect', 'wpseo_frontend_head_init', 999 ); |
|
| 2921 | + remove_action('template_redirect', 'wpseo_frontend_head_init', 999);
|
|
| 2922 | 2922 | } |
| 2923 | 2923 | } |
| 2924 | 2924 | |
@@ -2933,22 +2933,22 @@ discard block |
||
| 2933 | 2933 | * |
| 2934 | 2934 | */ |
| 2935 | 2935 | function geodir_wpml_ajax_set_guest_lang() {
|
| 2936 | - if ( geodir_is_wpml() && wpml_is_ajax() && !is_user_logged_in() ) {
|
|
| 2937 | - if ( empty( $_GET['lang'] ) && !( !empty( $_SERVER['REQUEST_URI'] ) && preg_match( '@\.(css|js|png|jpg|gif|jpeg|bmp)@i', basename( preg_replace( '@\?.*$@', '', $_SERVER['REQUEST_URI'] ) ) ) ) ) {
|
|
| 2936 | + if (geodir_is_wpml() && wpml_is_ajax() && !is_user_logged_in()) {
|
|
| 2937 | + if (empty($_GET['lang']) && !(!empty($_SERVER['REQUEST_URI']) && preg_match('@\.(css|js|png|jpg|gif|jpeg|bmp)@i', basename(preg_replace('@\?.*$@', '', $_SERVER['REQUEST_URI']))))) {
|
|
| 2938 | 2938 | global $sitepress; |
| 2939 | 2939 | |
| 2940 | 2940 | $referer = wp_get_referer(); |
| 2941 | 2941 | |
| 2942 | 2942 | $current_lang = $sitepress->get_current_language(); |
| 2943 | - $referrer_lang = $sitepress->get_language_from_url( $referer ); |
|
| 2943 | + $referrer_lang = $sitepress->get_language_from_url($referer); |
|
| 2944 | 2944 | |
| 2945 | - if ( $referrer_lang && $current_lang != $referrer_lang ) {
|
|
| 2945 | + if ($referrer_lang && $current_lang != $referrer_lang) {
|
|
| 2946 | 2946 | $_GET['lang'] = $referrer_lang; |
| 2947 | 2947 | } |
| 2948 | 2948 | } |
| 2949 | 2949 | } |
| 2950 | 2950 | } |
| 2951 | -add_action( 'plugins_loaded', 'geodir_wpml_ajax_set_guest_lang', -1 ); |
|
| 2951 | +add_action('plugins_loaded', 'geodir_wpml_ajax_set_guest_lang', -1);
|
|
| 2952 | 2952 | |
| 2953 | 2953 | /** |
| 2954 | 2954 | * Change country slug czech-republic to czechia and redirect. |
@@ -2969,18 +2969,18 @@ discard block |
||
| 2969 | 2969 | } |
| 2970 | 2970 | |
| 2971 | 2971 | $redirect = false; |
| 2972 | - if (strpos($current_url, '/' . $search . '/') !== false) {
|
|
| 2972 | + if (strpos($current_url, '/'.$search.'/') !== false) {
|
|
| 2973 | 2973 | $redirect = true; |
| 2974 | - $current_url = preg_replace('/\/' . $search . '\//', '/' . $replace . '/', $current_url, 1);
|
|
| 2974 | + $current_url = preg_replace('/\/'.$search.'\//', '/'.$replace.'/', $current_url, 1);
|
|
| 2975 | 2975 | } |
| 2976 | 2976 | |
| 2977 | 2977 | if ($has_slash != "/") {
|
| 2978 | 2978 | $current_url = trim($current_url, '/'); |
| 2979 | 2979 | } |
| 2980 | 2980 | |
| 2981 | - if (strpos($current_url, 'gd_country=' . $search) !== false) {
|
|
| 2981 | + if (strpos($current_url, 'gd_country='.$search) !== false) {
|
|
| 2982 | 2982 | $redirect = true; |
| 2983 | - $current_url = str_replace('gd_country=' . $search, 'gd_country=' . $replace, $current_url);
|
|
| 2983 | + $current_url = str_replace('gd_country='.$search, 'gd_country='.$replace, $current_url);
|
|
| 2984 | 2984 | } |
| 2985 | 2985 | |
| 2986 | 2986 | if ($redirect) {
|
@@ -3006,10 +3006,10 @@ discard block |
||
| 3006 | 3006 | * @param int $post_parent Post parent ID |
| 3007 | 3007 | * @param string $original_slug The original post slug. |
| 3008 | 3008 | */ |
| 3009 | -function geodir_check_post_to_term_slug( $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ) {
|
|
| 3009 | +function geodir_check_post_to_term_slug($slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug) {
|
|
| 3010 | 3010 | global $wpdb, $sitepress; |
| 3011 | 3011 | |
| 3012 | - if ( $post_type && strpos( $post_type, 'gd_' ) === 0 ) {
|
|
| 3012 | + if ($post_type && strpos($post_type, 'gd_') === 0) {
|
|
| 3013 | 3013 | $wpml_post_join = ""; |
| 3014 | 3014 | $wpml_post_where = ""; |
| 3015 | 3015 | $wpml_term_join = ""; |
@@ -3023,28 +3023,28 @@ discard block |
||
| 3023 | 3023 | } |
| 3024 | 3024 | |
| 3025 | 3025 | $wpml_post_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON p.ID = icl_t.element_id AND icl_t.element_type = CONCAT('post_', p.post_type)";
|
| 3026 | - $wpml_post_where = " AND icl_t.language_code = '" . $post_language ."'"; |
|
| 3026 | + $wpml_post_where = " AND icl_t.language_code = '".$post_language."'"; |
|
| 3027 | 3027 | |
| 3028 | 3028 | $wpml_term_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON icl_t.element_id = tt.term_taxonomy_id AND icl_t.element_type = CONCAT('tax_', tt.taxonomy)";
|
| 3029 | - $wpml_term_where = " AND icl_t.language_code = '" . $post_language ."'"; |
|
| 3029 | + $wpml_term_where = " AND icl_t.language_code = '".$post_language."'"; |
|
| 3030 | 3030 | } |
| 3031 | 3031 | |
| 3032 | - $term_slug_check = $wpdb->get_var( $wpdb->prepare( "SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '" . $post_type . "category' OR tt.taxonomy = '" . $post_type . "_tags' ) {$wpml_term_where} LIMIT 1", $slug ) );
|
|
| 3032 | + $term_slug_check = $wpdb->get_var($wpdb->prepare("SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '".$post_type."category' OR tt.taxonomy = '".$post_type."_tags' ) {$wpml_term_where} LIMIT 1", $slug));
|
|
| 3033 | 3033 | |
| 3034 | - if ( $term_slug_check ) {
|
|
| 3034 | + if ($term_slug_check) {
|
|
| 3035 | 3035 | $suffix = 1; |
| 3036 | 3036 | |
| 3037 | 3037 | do {
|
| 3038 | - $alt_slug = _truncate_post_slug( $original_slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix"; |
|
| 3038 | + $alt_slug = _truncate_post_slug($original_slug, 200 - (strlen($suffix) + 1))."-$suffix"; |
|
| 3039 | 3039 | |
| 3040 | - $term_check = $wpdb->get_var( $wpdb->prepare( "SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '" . $post_type . "category' OR tt.taxonomy = '" . $post_type . "_tags' ) {$wpml_term_where} LIMIT 1", $alt_slug ) );
|
|
| 3040 | + $term_check = $wpdb->get_var($wpdb->prepare("SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '".$post_type."category' OR tt.taxonomy = '".$post_type."_tags' ) {$wpml_term_where} LIMIT 1", $alt_slug));
|
|
| 3041 | 3041 | |
| 3042 | - $post_check = !$term_check && $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s AND p.ID != %d {$wpml_term_where} LIMIT 1", $alt_slug, $post_type, $post_ID ) );
|
|
| 3042 | + $post_check = !$term_check && $wpdb->get_var($wpdb->prepare("SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s AND p.ID != %d {$wpml_term_where} LIMIT 1", $alt_slug, $post_type, $post_ID));
|
|
| 3043 | 3043 | |
| 3044 | 3044 | $term_slug_check = $term_check || $post_check; |
| 3045 | 3045 | |
| 3046 | 3046 | $suffix++; |
| 3047 | - } while ( $term_slug_check ); |
|
| 3047 | + } while ($term_slug_check); |
|
| 3048 | 3048 | |
| 3049 | 3049 | $slug = $alt_slug; |
| 3050 | 3050 | } |
@@ -3052,7 +3052,7 @@ discard block |
||
| 3052 | 3052 | |
| 3053 | 3053 | return $slug; |
| 3054 | 3054 | } |
| 3055 | -add_filter( 'wp_unique_post_slug', 'geodir_check_post_to_term_slug', 101, 6 ); |
|
| 3055 | +add_filter('wp_unique_post_slug', 'geodir_check_post_to_term_slug', 101, 6);
|
|
| 3056 | 3056 | |
| 3057 | 3057 | /** |
| 3058 | 3058 | * Check whether a post name with slug exists or not. |
@@ -3069,51 +3069,51 @@ discard block |
||
| 3069 | 3069 | * @param int $term_id The term ID. |
| 3070 | 3070 | * @return bool true when exists. false when not exists. |
| 3071 | 3071 | */ |
| 3072 | -function geodir_check_term_to_post_slug( $slug_exists, $slug, $term_id ) {
|
|
| 3072 | +function geodir_check_term_to_post_slug($slug_exists, $slug, $term_id) {
|
|
| 3073 | 3073 | global $wpdb, $gd_term_post_type, $gd_term_taxonomy, $sitepress; |
| 3074 | 3074 | |
| 3075 | - if ( $slug_exists ) {
|
|
| 3075 | + if ($slug_exists) {
|
|
| 3076 | 3076 | return $slug_exists; |
| 3077 | 3077 | } |
| 3078 | 3078 | |
| 3079 | - if ( !empty( $gd_term_taxonomy ) && isset($gd_term_taxonomy[$term_id]) ) {
|
|
| 3079 | + if (!empty($gd_term_taxonomy) && isset($gd_term_taxonomy[$term_id])) {
|
|
| 3080 | 3080 | $taxonomy = $gd_term_taxonomy[$term_id]; |
| 3081 | 3081 | } else {
|
| 3082 | - $taxonomy = $wpdb->get_var( $wpdb->prepare( "SELECT taxonomy FROM $wpdb->term_taxonomy WHERE term_id = %d LIMIT 1", $term_id ) ); |
|
| 3082 | + $taxonomy = $wpdb->get_var($wpdb->prepare("SELECT taxonomy FROM $wpdb->term_taxonomy WHERE term_id = %d LIMIT 1", $term_id));
|
|
| 3083 | 3083 | $gd_term_taxonomy[$term_id] = $taxonomy; |
| 3084 | 3084 | } |
| 3085 | 3085 | |
| 3086 | - if ( empty($taxonomy) ) {
|
|
| 3086 | + if (empty($taxonomy)) {
|
|
| 3087 | 3087 | return $slug_exists; |
| 3088 | 3088 | } |
| 3089 | 3089 | |
| 3090 | - if ( !empty( $gd_term_post_type ) && $gd_term_post_type[$term_id] ) {
|
|
| 3090 | + if (!empty($gd_term_post_type) && $gd_term_post_type[$term_id]) {
|
|
| 3091 | 3091 | $post_type = $gd_term_post_type[$term_id]; |
| 3092 | 3092 | } else {
|
| 3093 | - $taxonomy_obj = get_taxonomy( $taxonomy ); |
|
| 3094 | - $post_type = !empty( $taxonomy_obj->object_type ) ? $taxonomy_obj->object_type[0] : NULL; |
|
| 3093 | + $taxonomy_obj = get_taxonomy($taxonomy); |
|
| 3094 | + $post_type = !empty($taxonomy_obj->object_type) ? $taxonomy_obj->object_type[0] : NULL; |
|
| 3095 | 3095 | } |
| 3096 | 3096 | |
| 3097 | 3097 | $wpml_post_join = ""; |
| 3098 | 3098 | $wpml_post_where = ""; |
| 3099 | 3099 | |
| 3100 | 3100 | if (geodir_wpml_is_taxonomy_translated($taxonomy) || geodir_wpml_is_post_type_translated($post_type)) {
|
| 3101 | - $term_language = $term_id ? geodir_get_language_for_element($term_id, 'tax_' . $taxonomy) : $sitepress->get_current_language(); |
|
| 3101 | + $term_language = $term_id ? geodir_get_language_for_element($term_id, 'tax_'.$taxonomy) : $sitepress->get_current_language(); |
|
| 3102 | 3102 | if (!$term_language) {
|
| 3103 | 3103 | $term_language = $sitepress->get_current_language(); |
| 3104 | 3104 | } |
| 3105 | 3105 | |
| 3106 | 3106 | $wpml_post_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON p.ID = icl_t.element_id AND icl_t.element_type = CONCAT('post_', p.post_type)";
|
| 3107 | - $wpml_post_where = " AND icl_t.language_code = '" . $term_language ."'"; |
|
| 3107 | + $wpml_post_where = " AND icl_t.language_code = '".$term_language."'"; |
|
| 3108 | 3108 | } |
| 3109 | 3109 | |
| 3110 | - if ( $post_type && $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s {$wpml_post_where} LIMIT 1", $slug, $post_type ) ) ) {
|
|
| 3110 | + if ($post_type && $wpdb->get_var($wpdb->prepare("SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s {$wpml_post_where} LIMIT 1", $slug, $post_type))) {
|
|
| 3111 | 3111 | $slug_exists = true; |
| 3112 | 3112 | } |
| 3113 | 3113 | |
| 3114 | 3114 | return $slug_exists; |
| 3115 | 3115 | } |
| 3116 | -add_filter( 'geodir_term_slug_is_exists', 'geodir_check_term_to_post_slug', 10, 3 ); |
|
| 3116 | +add_filter('geodir_term_slug_is_exists', 'geodir_check_term_to_post_slug', 10, 3);
|
|
| 3117 | 3117 | |
| 3118 | 3118 | /** |
| 3119 | 3119 | * Add hidden WPML language input field. |
@@ -3127,7 +3127,7 @@ discard block |
||
| 3127 | 3127 | function geodir_wpml_add_language_input_field() {
|
| 3128 | 3128 | global $sitepress; |
| 3129 | 3129 | |
| 3130 | - if ( function_exists( 'wpml_add_language_form_field_action' ) && WPML_LANGUAGE_NEGOTIATION_TYPE_PARAMETER === (int) $sitepress->get_setting( 'language_negotiation_type' ) ) {
|
|
| 3130 | + if (function_exists('wpml_add_language_form_field_action') && WPML_LANGUAGE_NEGOTIATION_TYPE_PARAMETER === (int) $sitepress->get_setting('language_negotiation_type')) {
|
|
| 3131 | 3131 | wpml_add_language_form_field_action(); |
| 3132 | 3132 | } |
| 3133 | 3133 | } |
| 3134 | 3134 | \ No newline at end of file |