Passed
Pull Request — master (#221)
by Kiran
10:36
created
geodirectory-functions/general_functions.php 1 patch
Spacing   +233 added lines, -233 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
  */
48 48
 function geodir_plugin_path()
49 49
 {
50
-    if ( defined( 'GD_TESTING_MODE' ) && GD_TESTING_MODE ) {
50
+    if (defined('GD_TESTING_MODE') && GD_TESTING_MODE) {
51 51
         return dirname(dirname(__FILE__));
52 52
     } else {
53 53
         return WP_PLUGIN_DIR . "/" . plugin_basename(dirname(dirname(__FILE__)));
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 
161 161
         $add_listing_link = get_page_link(geodir_add_listing_page_id());
162 162
 
163
-        return esc_url( add_query_arg(array('listing_type' => $post_type), $add_listing_link) );
163
+        return esc_url(add_query_arg(array('listing_type' => $post_type), $add_listing_link));
164 164
     } else
165 165
         return get_bloginfo('url');
166 166
 }
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 function geodir_is_page($gdpage = '')
253 253
 {
254 254
 
255
-    global $wp_query, $post,$wp;
255
+    global $wp_query, $post, $wp;
256 256
     //if(!is_admin()):
257 257
 
258 258
     switch ($gdpage):
@@ -277,14 +277,14 @@  discard block
 block discarded – undo
277 277
             break;
278 278
         case 'detail':
279 279
             $post_type = get_query_var('post_type');
280
-            if(is_array($post_type)){$post_type = reset($post_type);}
280
+            if (is_array($post_type)) {$post_type = reset($post_type); }
281 281
             if (is_single() && in_array($post_type, geodir_get_posttypes()))
282 282
                 return true;
283 283
             break;
284 284
         case 'pt':
285 285
             $post_type = get_query_var('post_type');
286
-            if(is_array($post_type)){$post_type = reset($post_type);}
287
-            if (is_post_type_archive() && in_array($post_type , geodir_get_posttypes()) && !is_tax())
286
+            if (is_array($post_type)) {$post_type = reset($post_type); }
287
+            if (is_post_type_archive() && in_array($post_type, geodir_get_posttypes()) && !is_tax())
288 288
                 return true;
289 289
 
290 290
             break;
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
                 return true;
296 296
             }
297 297
             $post_type = get_query_var('post_type');
298
-            if(is_array($post_type)){$post_type = reset($post_type);}
298
+            if (is_array($post_type)) {$post_type = reset($post_type); }
299 299
             if (is_post_type_archive() && in_array($post_type, geodir_get_posttypes()))
300 300
                 return true;
301 301
 
@@ -314,8 +314,8 @@  discard block
 block discarded – undo
314 314
             if (is_author() && isset($_REQUEST['geodir_dashbord']))
315 315
                 return true;
316 316
 			
317
-			if (function_exists('bp_loggedin_user_id') && function_exists('bp_displayed_user_id') && $my_id = (int)bp_loggedin_user_id()) {
318
-				if (((bool)bp_is_current_component('listings') || (bool)bp_is_current_component('favorites')) && $my_id > 0 && $my_id == (int)bp_displayed_user_id()) {
317
+			if (function_exists('bp_loggedin_user_id') && function_exists('bp_displayed_user_id') && $my_id = (int) bp_loggedin_user_id()) {
318
+				if (((bool) bp_is_current_component('listings') || (bool) bp_is_current_component('favorites')) && $my_id > 0 && $my_id == (int) bp_displayed_user_id()) {
319 319
 					return true;
320 320
 				}
321 321
 			}
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
         if (empty($wp->query_vars) || !array_diff(array_keys($wp->query_vars), array('preview', 'page', 'paged', 'cpage'))) {
369 369
             if (get_option('geodir_set_as_home'))
370 370
                 $wp->query_vars['gd_is_geodir_page'] = true;
371
-            if(geodir_is_page('home')){
371
+            if (geodir_is_page('home')) {
372 372
                 $wp->query_vars['gd_is_geodir_page'] = true;
373 373
             }
374 374
 
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
 
421 421
         if (!isset($wp->query_vars['gd_is_geodir_page'])) {
422 422
             $geodir_taxonomis = geodir_get_taxonomies('', true);
423
-            if(!empty($geodir_taxonomis)){
423
+            if (!empty($geodir_taxonomis)) {
424 424
                 foreach ($geodir_taxonomis as $taxonomy) {
425 425
                     if (array_key_exists($taxonomy, $wp->query_vars)) {
426 426
                         $wp->query_vars['gd_is_geodir_page'] = true;
@@ -440,10 +440,10 @@  discard block
 block discarded – undo
440 440
 
441 441
 
442 442
 //check if homepage
443
-        if(!isset($wp->query_vars['gd_is_geodir_page'])
443
+        if (!isset($wp->query_vars['gd_is_geodir_page'])
444 444
             && !isset($wp->query_vars['page_id'])
445 445
             && !isset($wp->query_vars['pagename'])
446
-            && is_page_geodir_home()){
446
+            && is_page_geodir_home()) {
447 447
             $wp->query_vars['gd_is_geodir_page'] = true;
448 448
         }
449 449
         //echo $wp->query_vars['gd_is_geodir_page'] ;
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
     function createRandomString()
545 545
     {
546 546
         $chars = "abcdefghijkmlnopqrstuvwxyz1023456789";
547
-        srand((double)microtime() * 1000000);
547
+        srand((double) microtime() * 1000000);
548 548
         $i = 0;
549 549
         $rstring = '';
550 550
         while ($i <= 25) {
@@ -681,11 +681,11 @@  discard block
 block discarded – undo
681 681
         }
682 682
 		
683 683
 		if (!empty($subject)) {
684
-			$subject = __(stripslashes_deep($subject),'geodirectory');
684
+			$subject = __(stripslashes_deep($subject), 'geodirectory');
685 685
 		}
686 686
 		
687 687
 		if (!empty($message)) {
688
-			$message = __(stripslashes_deep($message),'geodirectory');
688
+			$message = __(stripslashes_deep($message), 'geodirectory');
689 689
 		}
690 690
 
691 691
         $to_message = nl2br($to_message);
@@ -724,12 +724,12 @@  discard block
 block discarded – undo
724 724
             $fromEmailName = get_option('site_email_name');
725 725
         }
726 726
 
727
-        $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]', '[#posted_date#]','[#from_email#]','[#user_login#]','[#username#]','[#post_author_id#]','[#post_author_name#]','[#current_date#]');
728
-        $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName, $posted_date,$fromEmail, $user_login, $user_login, $post_author_id, $post_author_name, $current_date);
727
+        $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]', '[#posted_date#]', '[#from_email#]', '[#user_login#]', '[#username#]', '[#post_author_id#]', '[#post_author_name#]', '[#current_date#]');
728
+        $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName, $posted_date, $fromEmail, $user_login, $user_login, $post_author_id, $post_author_name, $current_date);
729 729
         $message = str_replace($search_array, $replace_array, $message);
730 730
 
731
-        $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]','[#from_email#]','[#user_login#]','[#username#]','[#post_author_id#]','[#post_author_name#]','[#current_date#]');
732
-        $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName, $posted_date,$fromEmail, $user_login, $user_login, $post_author_id, $post_author_name, $current_date);
731
+        $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]', '[#from_email#]', '[#user_login#]', '[#username#]', '[#post_author_id#]', '[#post_author_name#]', '[#current_date#]');
732
+        $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName, $posted_date, $fromEmail, $user_login, $user_login, $post_author_id, $post_author_name, $current_date);
733 733
         $subject = str_replace($search_array, $replace_array, $subject);
734 734
 
735 735
         $headers = 'MIME-Version: 1.0' . "\r\n";
@@ -740,18 +740,18 @@  discard block
 block discarded – undo
740 740
         $to = $toEmail;
741 741
         $sent = wp_mail($to, $subject, $message, $headers);
742 742
 
743
-        if( ! $sent ) {
744
-            if ( is_array( $to ) ) {
745
-                $to = implode( ',', $to );
743
+        if (!$sent) {
744
+            if (is_array($to)) {
745
+                $to = implode(',', $to);
746 746
             }
747 747
             $log_message = sprintf(
748
-                __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
748
+                __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
749 749
                 $message_type,
750
-                date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
750
+                date_i18n('F j Y H:i:s', current_time('timestamp')),
751 751
                 $to,
752 752
                 $subject
753 753
             );
754
-            geodir_error_log( $log_message );
754
+            geodir_error_log($log_message);
755 755
         }
756 756
 
757 757
         ///////// ADMIN BCC EMIALS
@@ -763,11 +763,11 @@  discard block
 block discarded – undo
763 763
             $subject = __(stripslashes_deep(get_option('geodir_post_submited_success_email_subject_admin')), 'geodirectory');
764 764
             $message = __(stripslashes_deep(get_option('geodir_post_submited_success_email_content_admin')), 'geodirectory');
765 765
 
766
-            $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]', '[#posted_date#]','[#user_login#]','[#username#]');
766
+            $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]', '[#posted_date#]', '[#user_login#]', '[#username#]');
767 767
             $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName, $posted_date, $user_login, $user_login);
768 768
             $message = str_replace($search_array, $replace_array, $message);
769 769
 
770
-            $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]','[#user_login#]','[#username#]');
770
+            $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]', '[#user_login#]', '[#username#]');
771 771
             $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName, $posted_date, $user_login, $user_login);
772 772
             $subject = str_replace($search_array, $replace_array, $subject);
773 773
 
@@ -792,21 +792,21 @@  discard block
 block discarded – undo
792 792
             $admin_bcc = true;
793 793
         }
794 794
 
795
-        if($admin_bcc===true){
795
+        if ($admin_bcc === true) {
796 796
             $sent = wp_mail($to, $subject, $message, $headers);
797 797
 
798
-            if( ! $sent ) {
799
-                if ( is_array( $to ) ) {
800
-                    $to = implode( ',', $to );
798
+            if (!$sent) {
799
+                if (is_array($to)) {
800
+                    $to = implode(',', $to);
801 801
                 }
802 802
                 $log_message = sprintf(
803
-                    __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
803
+                    __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
804 804
                     $message_type,
805
-                    date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
805
+                    date_i18n('F j Y H:i:s', current_time('timestamp')),
806 806
                     $to,
807 807
                     $subject
808 808
                 );
809
-                geodir_error_log( $log_message );
809
+                geodir_error_log($log_message);
810 810
             }
811 811
         }
812 812
 
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
             $location_manager = defined('POST_LOCATION_TABLE') ? true : false;
902 902
 			$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
903 903
 				
904
-			if(geodir_is_page('detail') && isset($post->country_slug)){
904
+			if (geodir_is_page('detail') && isset($post->country_slug)) {
905 905
                 $location_terms = array(
906 906
                     'gd_country' => $post->country_slug,
907 907
                     'gd_region' => $post->region_slug,
@@ -1156,7 +1156,7 @@  discard block
 block discarded – undo
1156 1156
             $breadcrumb .= stripslashes_deep($page_title);
1157 1157
             $breadcrumb .= '</li>';
1158 1158
         } else if (is_tag()) {
1159
-            $breadcrumb .=  "<li> " . $separator . single_tag_title('',false) . '</li>';
1159
+            $breadcrumb .= "<li> " . $separator . single_tag_title('', false) . '</li>';
1160 1160
         } else if (is_day()) {
1161 1161
             $breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1162 1162
             the_time('F jS, Y');
@@ -1248,7 +1248,7 @@  discard block
 block discarded – undo
1248 1248
         return new WP_Error('upload_dir_error', $upload['error']);
1249 1249
 
1250 1250
     // fetch the remote url and write it to the placeholder file
1251
-    $headers = wp_remote_get($url, array('stream' => true,'filename' => $upload['file']));
1251
+    $headers = wp_remote_get($url, array('stream' => true, 'filename' => $upload['file']));
1252 1252
 
1253 1253
     $log_message = '';
1254 1254
     $filesize = filesize($upload['file']);
@@ -1261,16 +1261,16 @@  discard block
 block discarded – undo
1261 1261
         $log_message = sprintf(__('Remote server returned error response %1$d %2$s', 'geodirectory'), esc_html($headers['response']), get_status_header_desc($headers['response']));
1262 1262
     }
1263 1263
     elseif (isset($headers['headers']['content-length']) && $filesize != $headers['headers']['content-length']) {
1264
-        $log_message =  __('Remote file is incorrect size', 'geodirectory');
1264
+        $log_message = __('Remote file is incorrect size', 'geodirectory');
1265 1265
     }
1266 1266
     elseif (0 == $filesize) {
1267 1267
         $log_message = __('Zero size file downloaded', 'geodirectory');
1268 1268
     }
1269 1269
 
1270
-    if($log_message){
1270
+    if ($log_message) {
1271 1271
         $del = unlink($upload['file']);
1272
-        if(!$del){geodir_error_log(__('GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory'));}
1273
-        return new WP_Error('import_file_error',$log_message );
1272
+        if (!$del) {geodir_error_log(__('GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory')); }
1273
+        return new WP_Error('import_file_error', $log_message);
1274 1274
     }
1275 1275
 
1276 1276
 
@@ -1286,10 +1286,10 @@  discard block
 block discarded – undo
1286 1286
  */
1287 1287
 function geodir_max_upload_size()
1288 1288
 {
1289
-    $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
1289
+    $max_filesize = (float) get_option('geodir_upload_max_filesize', 2);
1290 1290
 
1291 1291
     if ($max_filesize > 0 && $max_filesize < 1) {
1292
-        $max_filesize = (int)($max_filesize * 1024) . 'kb';
1292
+        $max_filesize = (int) ($max_filesize * 1024) . 'kb';
1293 1293
     } else {
1294 1294
         $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1295 1295
     }
@@ -1358,35 +1358,35 @@  discard block
 block discarded – undo
1358 1358
     {
1359 1359
         global $wpdb;
1360 1360
         if ($message_type == 'expiration') {
1361
-            $subject = stripslashes(__(get_option('renew_email_subject'),'geodirectory'));
1362
-            $client_message = stripslashes(__(get_option('renew_email_content'),'geodirectory'));
1361
+            $subject = stripslashes(__(get_option('renew_email_subject'), 'geodirectory'));
1362
+            $client_message = stripslashes(__(get_option('renew_email_content'), 'geodirectory'));
1363 1363
         } elseif ($message_type == 'post_submited') {
1364
-            $subject = __(get_option('post_submited_success_email_subject_admin'),'geodirectory');
1365
-            $client_message = __(get_option('post_submited_success_email_content_admin'),'geodirectory');
1364
+            $subject = __(get_option('post_submited_success_email_subject_admin'), 'geodirectory');
1365
+            $client_message = __(get_option('post_submited_success_email_content_admin'), 'geodirectory');
1366 1366
         } elseif ($message_type == 'renew') {
1367
-            $subject = __(get_option('post_renew_success_email_subject_admin'),'geodirectory');
1368
-            $client_message = __(get_option('post_renew_success_email_content_admin'),'geodirectory');
1367
+            $subject = __(get_option('post_renew_success_email_subject_admin'), 'geodirectory');
1368
+            $client_message = __(get_option('post_renew_success_email_content_admin'), 'geodirectory');
1369 1369
         } elseif ($message_type == 'upgrade') {
1370
-            $subject = __(get_option('post_upgrade_success_email_subject_admin'),'geodirectory');
1371
-            $client_message = __(get_option('post_upgrade_success_email_content_admin'),'geodirectory');
1370
+            $subject = __(get_option('post_upgrade_success_email_subject_admin'), 'geodirectory');
1371
+            $client_message = __(get_option('post_upgrade_success_email_content_admin'), 'geodirectory');
1372 1372
         } elseif ($message_type == 'claim_approved') {
1373
-            $subject = __(get_option('claim_approved_email_subject'),'geodirectory');
1374
-            $client_message = __(get_option('claim_approved_email_content'),'geodirectory');
1373
+            $subject = __(get_option('claim_approved_email_subject'), 'geodirectory');
1374
+            $client_message = __(get_option('claim_approved_email_content'), 'geodirectory');
1375 1375
         } elseif ($message_type == 'claim_rejected') {
1376
-            $subject = __(get_option('claim_rejected_email_subject'),'geodirectory');
1377
-            $client_message = __(get_option('claim_rejected_email_content'),'geodirectory');
1376
+            $subject = __(get_option('claim_rejected_email_subject'), 'geodirectory');
1377
+            $client_message = __(get_option('claim_rejected_email_content'), 'geodirectory');
1378 1378
         } elseif ($message_type == 'claim_requested') {
1379
-            $subject = __(get_option('claim_email_subject_admin'),'geodirectory');
1380
-            $client_message = __(get_option('claim_email_content_admin'),'geodirectory');
1379
+            $subject = __(get_option('claim_email_subject_admin'), 'geodirectory');
1380
+            $client_message = __(get_option('claim_email_content_admin'), 'geodirectory');
1381 1381
         } elseif ($message_type == 'auto_claim') {
1382
-            $subject = __(get_option('auto_claim_email_subject'),'geodirectory');
1383
-            $client_message = __(get_option('auto_claim_email_content'),'geodirectory');
1382
+            $subject = __(get_option('auto_claim_email_subject'), 'geodirectory');
1383
+            $client_message = __(get_option('auto_claim_email_content'), 'geodirectory');
1384 1384
         } elseif ($message_type == 'payment_success') {
1385
-            $subject = __(get_option('post_payment_success_admin_email_subject'),'geodirectory');
1386
-            $client_message = __(get_option('post_payment_success_admin_email_content'),'geodirectory');
1385
+            $subject = __(get_option('post_payment_success_admin_email_subject'), 'geodirectory');
1386
+            $client_message = __(get_option('post_payment_success_admin_email_content'), 'geodirectory');
1387 1387
         } elseif ($message_type == 'payment_fail') {
1388
-            $subject = __(get_option('post_payment_fail_admin_email_subject'),'geodirectory');
1389
-            $client_message = __(get_option('post_payment_fail_admin_email_content'),'geodirectory');
1388
+            $subject = __(get_option('post_payment_fail_admin_email_subject'), 'geodirectory');
1389
+            $client_message = __(get_option('post_payment_fail_admin_email_content'), 'geodirectory');
1390 1390
         }
1391 1391
         $transaction_details = $custom_1;
1392 1392
         $fromEmail = get_option('site_email');
@@ -1427,18 +1427,18 @@  discard block
 block discarded – undo
1427 1427
         $to = $fromEmail;
1428 1428
         $message = $client_message;
1429 1429
         $sent = wp_mail($to, $subject, $message, $headers);
1430
-        if( ! $sent ) {
1431
-            if ( is_array( $to ) ) {
1432
-                $to = implode( ',', $to );
1430
+        if (!$sent) {
1431
+            if (is_array($to)) {
1432
+                $to = implode(',', $to);
1433 1433
             }
1434 1434
             $log_message = sprintf(
1435
-                __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1435
+                __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1436 1436
                 $message_type,
1437
-                date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1437
+                date_i18n('F j Y H:i:s', current_time('timestamp')),
1438 1438
                 $to,
1439 1439
                 $subject
1440 1440
             );
1441
-            geodir_error_log( $log_message );
1441
+            geodir_error_log($log_message);
1442 1442
         }
1443 1443
     }
1444 1444
 }
@@ -1464,18 +1464,18 @@  discard block
 block discarded – undo
1464 1464
     {
1465 1465
         $login_details = '';
1466 1466
         if ($message_type == 'send_friend') {
1467
-            $subject = stripslashes(__(get_option('email_friend_subject'),'geodirectory'));
1468
-            $message = stripslashes(__(get_option('email_friend_content'),'geodirectory'));
1467
+            $subject = stripslashes(__(get_option('email_friend_subject'), 'geodirectory'));
1468
+            $message = stripslashes(__(get_option('email_friend_content'), 'geodirectory'));
1469 1469
         } elseif ($message_type == 'send_enquiry') {
1470
-            $subject = __(get_option('email_enquiry_subject'),'geodirectory');
1471
-            $message = __(get_option('email_enquiry_content'),'geodirectory');
1470
+            $subject = __(get_option('email_enquiry_subject'), 'geodirectory');
1471
+            $message = __(get_option('email_enquiry_content'), 'geodirectory');
1472 1472
         } elseif ($message_type == 'forgot_password') {
1473
-            $subject = __(get_option('forgot_password_subject'),'geodirectory');
1474
-            $message = __(get_option('forgot_password_content'),'geodirectory');
1473
+            $subject = __(get_option('forgot_password_subject'), 'geodirectory');
1474
+            $message = __(get_option('forgot_password_content'), 'geodirectory');
1475 1475
             $login_details = $to_message;
1476 1476
         } elseif ($message_type == 'registration') {
1477
-            $subject = __(get_option('registration_success_email_subject'),'geodirectory');
1478
-            $message = __(get_option('registration_success_email_content'),'geodirectory');
1477
+            $subject = __(get_option('registration_success_email_subject'), 'geodirectory');
1478
+            $message = __(get_option('registration_success_email_content'), 'geodirectory');
1479 1479
             $login_details = $to_message;
1480 1480
         }
1481 1481
         $to_message = nl2br($to_message);
@@ -1509,18 +1509,18 @@  discard block
 block discarded – undo
1509 1509
         $to = $toEmail;
1510 1510
 
1511 1511
         $sent = wp_mail($to, $subject, $message, $headers);
1512
-        if( ! $sent ) {
1513
-            if ( is_array( $to ) ) {
1514
-                $to = implode( ',', $to );
1512
+        if (!$sent) {
1513
+            if (is_array($to)) {
1514
+                $to = implode(',', $to);
1515 1515
             }
1516 1516
             $log_message = sprintf(
1517
-                __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1517
+                __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1518 1518
                 $message_type,
1519
-                date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1519
+                date_i18n('F j Y H:i:s', current_time('timestamp')),
1520 1520
                 $to,
1521 1521
                 $subject
1522 1522
             );
1523
-            geodir_error_log( $log_message );
1523
+            geodir_error_log($log_message);
1524 1524
         }
1525 1525
 
1526 1526
         ///////// ADMIN BCC EMIALS
@@ -1546,20 +1546,20 @@  discard block
 block discarded – undo
1546 1546
             $admin_bcc = true;
1547 1547
         }
1548 1548
 
1549
-        if($admin_bcc === true){
1549
+        if ($admin_bcc === true) {
1550 1550
             $sent = wp_mail($to, $subject, $message, $headers);
1551
-            if( ! $sent ) {
1552
-                if ( is_array( $to ) ) {
1553
-                    $to = implode( ',', $to );
1551
+            if (!$sent) {
1552
+                if (is_array($to)) {
1553
+                    $to = implode(',', $to);
1554 1554
                 }
1555 1555
                 $log_message = sprintf(
1556
-                    __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1556
+                    __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1557 1557
                     $message_type,
1558
-                    date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1558
+                    date_i18n('F j Y H:i:s', current_time('timestamp')),
1559 1559
                     $to,
1560 1560
                     $subject
1561 1561
                 );
1562
-                geodir_error_log( $log_message );
1562
+                geodir_error_log($log_message);
1563 1563
             }
1564 1564
         }
1565 1565
 
@@ -1607,7 +1607,7 @@  discard block
 block discarded – undo
1607 1607
 function geodir_custom_posts_body_class($classes) {
1608 1608
     global $wpdb, $wp;
1609 1609
     $post_types = geodir_get_posttypes('object');
1610
-    if (!empty($post_types) && count((array)$post_types) > 1) {
1610
+    if (!empty($post_types) && count((array) $post_types) > 1) {
1611 1611
         $classes[] = 'geodir_custom_posts';
1612 1612
     }
1613 1613
 
@@ -1901,7 +1901,7 @@  discard block
 block discarded – undo
1901 1901
         $sql = "SELECT COUNT(" . $wpdb->posts . ".ID) AS total FROM " . $wpdb->posts . "
1902 1902
 			" . $join . "
1903 1903
 			" . $where;
1904
-        $rows = (int)$wpdb->get_var($sql);
1904
+        $rows = (int) $wpdb->get_var($sql);
1905 1905
     } else {
1906 1906
         $orderby = geodir_widget_listings_get_order($query_args);
1907 1907
         /**
@@ -1927,10 +1927,10 @@  discard block
 block discarded – undo
1927 1927
         $limit = apply_filters('geodir_filter_widget_listings_limit', $limit, $post_type);
1928 1928
 
1929 1929
         $page = !empty($query_args['pageno']) ? absint($query_args['pageno']) : 1;
1930
-        if ( !$page )
1930
+        if (!$page)
1931 1931
             $page = 1;
1932 1932
 
1933
-        $limit = (int)$limit > 0 ? " LIMIT " . absint( ( $page - 1 ) * (int)$limit ) . ", " . (int)$limit : "";
1933
+        $limit = (int) $limit > 0 ? " LIMIT " . absint(($page - 1) * (int) $limit) . ", " . (int) $limit : "";
1934 1934
 
1935 1935
         $sql = "SELECT SQL_CALC_FOUND_ROWS " . $fields . " FROM " . $wpdb->posts . "
1936 1936
 			" . $join . "
@@ -2045,7 +2045,7 @@  discard block
 block discarded – undo
2045 2045
         }
2046 2046
 
2047 2047
         if (!empty($query_args['post_author'])) {
2048
-            $where .= " AND " . $wpdb->posts . ".post_author = " . (int)$query_args['post_author'];
2048
+            $where .= " AND " . $wpdb->posts . ".post_author = " . (int) $query_args['post_author'];
2049 2049
         }
2050 2050
         
2051 2051
         if (!empty($query_args['show_featured_only'])) {
@@ -2131,7 +2131,7 @@  discard block
 block discarded – undo
2131 2131
     }
2132 2132
 
2133 2133
     if (!empty($query_args) && !empty($query_args['posts_per_page'])) {
2134
-        $limit = (int)$query_args['posts_per_page'];
2134
+        $limit = (int) $query_args['posts_per_page'];
2135 2135
     }
2136 2136
 
2137 2137
     return $limit;
@@ -2274,9 +2274,9 @@  discard block
 block discarded – undo
2274 2274
         add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
2275 2275
     }
2276 2276
     $home_url = str_replace("www.", "", $home_url);
2277
-    if ( (strpos($home_url, $cur_url) !== false || strpos($home_url . '/', $cur_url) !== false) && ('page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front')==get_option('geodir_home_page')) ) {
2277
+    if ((strpos($home_url, $cur_url) !== false || strpos($home_url . '/', $cur_url) !== false) && ('page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front') == get_option('geodir_home_page'))) {
2278 2278
         return true;
2279
-    }elseif(get_query_var('page_id') == get_option('page_on_front') && 'page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front')==get_option('geodir_home_page')){
2279
+    }elseif (get_query_var('page_id') == get_option('page_on_front') && 'page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front') == get_option('geodir_home_page')) {
2280 2280
         return true;
2281 2281
     } else {
2282 2282
         return false;
@@ -2359,7 +2359,7 @@  discard block
 block discarded – undo
2359 2359
 
2360 2360
     $gd_post_type = geodir_get_current_posttype();
2361 2361
 
2362
-    $category_limit = isset($instance['category_limit']) && $instance['category_limit'] > 0 ? (int)$instance['category_limit'] : 15;
2362
+    $category_limit = isset($instance['category_limit']) && $instance['category_limit'] > 0 ? (int) $instance['category_limit'] : 15;
2363 2363
     $default_post_type = !empty($gd_post_type) ? $gd_post_type : (isset($instance['default_post_type']) && gdsc_is_post_type_valid($instance['default_post_type']) ? $instance['default_post_type'] : '');
2364 2364
 
2365 2365
     $taxonomy = array();
@@ -2392,14 +2392,14 @@  discard block
 block discarded – undo
2392 2392
             foreach ($b_terms as $key => $val) {
2393 2393
                 $ptype = get_post_type_object(str_replace("category", "", $key));
2394 2394
                 $cpt_name = __($ptype->labels->singular_name, 'geodirectory');
2395
-                $tax_change_output .= "<option value='$key' ". selected($key, $default_taxonomy, false) .">" . sprintf(__('%s Categories', 'geodirectory'),$cpt_name) . "</option>";
2395
+                $tax_change_output .= "<option value='$key' " . selected($key, $default_taxonomy, false) . ">" . sprintf(__('%s Categories', 'geodirectory'), $cpt_name) . "</option>";
2396 2396
             }
2397 2397
             $tax_change_output .= "</select>";
2398 2398
         }
2399 2399
 
2400 2400
         if (!empty($b_terms)) {
2401
-            $terms = $default_taxonomy != '' && isset($b_terms[$default_taxonomy]) ? $b_terms[$default_taxonomy] : reset($b_terms);// get the first array
2402
-            global $cat_count;//make global so we can change via function
2401
+            $terms = $default_taxonomy != '' && isset($b_terms[$default_taxonomy]) ? $b_terms[$default_taxonomy] : reset($b_terms); // get the first array
2402
+            global $cat_count; //make global so we can change via function
2403 2403
             $cat_count = 0;
2404 2404
             ?>
2405 2405
             <div class="geodir-category-list-in clearfix">
@@ -2463,7 +2463,7 @@  discard block
 block discarded – undo
2463 2463
         $class_row = $cat_count > $category_limit ? 'geodir-pcat-hide geodir-hide' : 'geodir-pcat-show';
2464 2464
         $total_post = $cat->count;
2465 2465
 
2466
-        $term_link = get_term_link( $cat, $cat->taxonomy );
2466
+        $term_link = get_term_link($cat, $cat->taxonomy);
2467 2467
         /**
2468 2468
          * Filer the category term link.
2469 2469
          *
@@ -2472,7 +2472,7 @@  discard block
 block discarded – undo
2472 2472
          * @param int    $cat->term_id The term id.
2473 2473
          * @param string $post_type Wordpress post type.
2474 2474
          */
2475
-        $term_link = apply_filters( 'geodir_category_term_link', $term_link, $cat->term_id, $post_type );
2475
+        $term_link = apply_filters('geodir_category_term_link', $term_link, $cat->term_id, $post_type);
2476 2476
 
2477 2477
         echo '<li class="' . $class_row . '"><a href="' . $term_link . '">';
2478 2478
         echo '<img alt="' . esc_attr($cat->name) . ' icon" style="height:20px;vertical-align:middle;" src="' . $term_icon_url . '"/> <span class="cat-link">'; echo $cat->name . '</span> <span class="geodir_term_class geodir_link_span geodir_category_class_' . $post_type . '_' . $cat->term_id . '">(' . $total_post . ')</span> ';
@@ -2606,29 +2606,29 @@  discard block
 block discarded – undo
2606 2606
                 itemWidth: 75,
2607 2607
                 itemMargin: 5,
2608 2608
                 asNavFor: '#geodir_widget_slider',
2609
-                rtl: <?php echo ( is_rtl() ? 'true' : 'false' ); /* fix rtl issue */ ?>
2609
+                rtl: <?php echo (is_rtl() ? 'true' : 'false'); /* fix rtl issue */ ?>
2610 2610
             });
2611 2611
 
2612 2612
             jQuery('#geodir_widget_slider').flexslider({
2613
-                animation: "<?php echo $animation;?>",
2613
+                animation: "<?php echo $animation; ?>",
2614 2614
                 selector: ".geodir-slides > li",
2615 2615
                 namespace: "geodir-",
2616 2616
                 controlNav: true,
2617
-                animationLoop: <?php echo $animationLoop;?>,
2618
-                slideshow: <?php echo $slideshow;?>,
2619
-                slideshowSpeed: <?php echo $slideshowSpeed;?>,
2620
-                animationSpeed: <?php echo $animationSpeed;?>,
2621
-                directionNav: <?php echo $directionNav;?>,
2622
-                maxItems: <?php echo $max_show;?>,
2617
+                animationLoop: <?php echo $animationLoop; ?>,
2618
+                slideshow: <?php echo $slideshow; ?>,
2619
+                slideshowSpeed: <?php echo $slideshowSpeed; ?>,
2620
+                animationSpeed: <?php echo $animationSpeed; ?>,
2621
+                directionNav: <?php echo $directionNav; ?>,
2622
+                maxItems: <?php echo $max_show; ?>,
2623 2623
                 move: 1,
2624
-                <?php if($slide_width){ echo "itemWidth: ".$slide_width.",";}?>
2624
+                <?php if ($slide_width) { echo "itemWidth: " . $slide_width . ","; }?>
2625 2625
                 sync: "#geodir_widget_carousel",
2626 2626
                 start: function (slider) {
2627 2627
                     jQuery('.geodir-listing-flex-loader').hide();
2628 2628
                     jQuery('#geodir_widget_slider').css({'visibility': 'visible'});
2629 2629
                     jQuery('#geodir_widget_carousel').css({'visibility': 'visible'});
2630 2630
                 },
2631
-                rtl: <?php echo ( is_rtl() ? 'true' : 'false' ); /* fix rtl issue */ ?>
2631
+                rtl: <?php echo (is_rtl() ? 'true' : 'false'); /* fix rtl issue */ ?>
2632 2632
             });
2633 2633
         });
2634 2634
     </script>
@@ -2669,7 +2669,7 @@  discard block
 block discarded – undo
2669 2669
 
2670 2670
         global $post;
2671 2671
 
2672
-        $current_post = $post;// keep current post info
2672
+        $current_post = $post; // keep current post info
2673 2673
 
2674 2674
         $widget_main_slides = '';
2675 2675
         $nav_slides = '';
@@ -3112,7 +3112,7 @@  discard block
 block discarded – undo
3112 3112
             $geodir_add_location_url = '1';
3113 3113
         }
3114 3114
 
3115
-        $viewall_url = get_term_link((int)$category[0], $post_type . 'category');
3115
+        $viewall_url = get_term_link((int) $category[0], $post_type . 'category');
3116 3116
 
3117 3117
         $geodir_add_location_url = NULL;
3118 3118
     }
@@ -3120,7 +3120,7 @@  discard block
 block discarded – undo
3120 3120
         $gd_session->set('gd_multi_location', 1);
3121 3121
     }
3122 3122
 
3123
-    if(is_wp_error( $viewall_url  )){$viewall_url = '';}
3123
+    if (is_wp_error($viewall_url)) {$viewall_url = ''; }
3124 3124
 
3125 3125
     $query_args = array(
3126 3126
         'posts_per_page' => $post_number,
@@ -3358,14 +3358,14 @@  discard block
 block discarded – undo
3358 3358
  * @package GeoDirectory
3359 3359
  * @return bool
3360 3360
  */
3361
-function geodir_term_review_count_force_update($new_status, $old_status='', $post='')
3361
+function geodir_term_review_count_force_update($new_status, $old_status = '', $post = '')
3362 3362
 {
3363
-    if(isset($_REQUEST['action']) && $_REQUEST['action']=='geodir_import_export'){return;}//do not run if importing listings
3363
+    if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'geodir_import_export') {return; }//do not run if importing listings
3364 3364
 
3365
-    if(isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')){
3365
+    if (isset($post->post_type) && ($post->post_type == 'nav_menu_item' || $post->post_type == 'page' || $post->post_type == 'post')) {
3366 3366
         return;
3367 3367
     }
3368
-    if($new_status!=$old_status) {
3368
+    if ($new_status != $old_status) {
3369 3369
         geodir_count_reviews_by_terms(true);
3370 3370
     }
3371 3371
     return true;
@@ -3530,7 +3530,7 @@  discard block
 block discarded – undo
3530 3530
          */
3531 3531
         try {
3532 3532
             require_once($language_file);
3533
-        } catch(Exception $e) {
3533
+        } catch (Exception $e) {
3534 3534
             error_log('Language Error: ' . $e->getMessage());
3535 3535
         }
3536 3536
     }
@@ -3548,18 +3548,18 @@  discard block
 block discarded – undo
3548 3548
  */
3549 3549
 function geodirectory_load_db_language() {
3550 3550
     global $wp_filesystem;
3551
-    if( empty( $wp_filesystem ) ) {
3552
-        require_once( ABSPATH .'/wp-admin/includes/file.php' );
3551
+    if (empty($wp_filesystem)) {
3552
+        require_once(ABSPATH . '/wp-admin/includes/file.php');
3553 3553
         WP_Filesystem();
3554 3554
         global $wp_filesystem;
3555 3555
     }
3556 3556
 
3557 3557
     $language_file = geodir_plugin_path() . '/db-language.php';
3558 3558
 
3559
-    if(is_file($language_file) && !is_writable($language_file))
3559
+    if (is_file($language_file) && !is_writable($language_file))
3560 3560
         return false; // Not possible to create.
3561 3561
 
3562
-    if(!is_file($language_file) && !is_writable(dirname($language_file)))
3562
+    if (!is_file($language_file) && !is_writable(dirname($language_file)))
3563 3563
         return false; // Not possible to create.
3564 3564
 
3565 3565
     $contents_strings = array();
@@ -3593,7 +3593,7 @@  discard block
 block discarded – undo
3593 3593
     $contents = implode(PHP_EOL, $contents_head);
3594 3594
 
3595 3595
     if (!empty($contents_strings)) {
3596
-        foreach ( $contents_strings as $string ) {
3596
+        foreach ($contents_strings as $string) {
3597 3597
             if (is_scalar($string) && $string != '') {
3598 3598
                 $string = str_replace("'", "\'", $string);
3599 3599
                 $contents .= PHP_EOL . "__('" . $string . "', 'geodirectory');";
@@ -3603,7 +3603,7 @@  discard block
 block discarded – undo
3603 3603
 
3604 3604
     $contents .= implode(PHP_EOL, $contents_foot);
3605 3605
 
3606
-    if($wp_filesystem->put_contents( $language_file, $contents, FS_CHMOD_FILE))
3606
+    if ($wp_filesystem->put_contents($language_file, $contents, FS_CHMOD_FILE))
3607 3607
         return false; // Failure; could not write file.
3608 3608
 
3609 3609
     return true;
@@ -3629,7 +3629,7 @@  discard block
 block discarded – undo
3629 3629
     $rows = $wpdb->get_results($sql);
3630 3630
 
3631 3631
     if (!empty($rows)) {
3632
-        foreach($rows as $row) {
3632
+        foreach ($rows as $row) {
3633 3633
             if (!empty($row->admin_title))
3634 3634
                 $translation_texts[] = stripslashes_deep($row->admin_title);
3635 3635
 			
@@ -3667,7 +3667,7 @@  discard block
 block discarded – undo
3667 3667
     $rows = $wpdb->get_results($sql);
3668 3668
 
3669 3669
     if (!empty($rows)) {
3670
-        foreach($rows as $row) {
3670
+        foreach ($rows as $row) {
3671 3671
             if (!empty($row->site_title))
3672 3672
                 $translation_texts[] = stripslashes_deep($row->site_title);
3673 3673
 
@@ -3685,7 +3685,7 @@  discard block
 block discarded – undo
3685 3685
 		$rows = $wpdb->get_results($sql);
3686 3686
 
3687 3687
 		if (!empty($rows)) {
3688
-			foreach($rows as $row) {
3688
+			foreach ($rows as $row) {
3689 3689
 				if (!empty($row->field_site_name))
3690 3690
 					$translation_texts[] = stripslashes_deep($row->field_site_name);
3691 3691
 
@@ -3720,7 +3720,7 @@  discard block
 block discarded – undo
3720 3720
      *
3721 3721
      * @param array $geodir_allowed_mime_types and file extensions.
3722 3722
      */
3723
-    return apply_filters( 'geodir_allowed_mime_types', array(
3723
+    return apply_filters('geodir_allowed_mime_types', array(
3724 3724
             'Image' => array( // Image formats.
3725 3725
                 'jpg' => 'image/jpeg',
3726 3726
                 'jpe' => 'image/jpeg',
@@ -3809,13 +3809,13 @@  discard block
 block discarded – undo
3809 3809
 
3810 3810
 
3811 3811
 
3812
-add_filter('wpseo_replacements','geodir_wpseo_replacements',10,1);
3812
+add_filter('wpseo_replacements', 'geodir_wpseo_replacements', 10, 1);
3813 3813
 /*
3814 3814
  * Add location variables to wpseo replacements.
3815 3815
  *
3816 3816
  * @since 1.5.4
3817 3817
  */
3818
-function geodir_wpseo_replacements($vars){
3818
+function geodir_wpseo_replacements($vars) {
3819 3819
 
3820 3820
     global $wp;
3821 3821
     $title = '';
@@ -3830,12 +3830,12 @@  discard block
 block discarded – undo
3830 3830
      * @param array $location_array The array of location variables.
3831 3831
      * @param array $vars The page title variables.
3832 3832
      */
3833
-    $location_array = apply_filters('geodir_filter_title_variables_location_arr_seo',$location_array, $vars);
3833
+    $location_array = apply_filters('geodir_filter_title_variables_location_arr_seo', $location_array, $vars);
3834 3834
     $location_titles = array();
3835
-    if(get_query_var( 'gd_country_full' )){
3836
-        if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );}
3837
-        if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );}
3838
-        if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );}
3835
+    if (get_query_var('gd_country_full')) {
3836
+        if (get_query_var('gd_country_full')) {$location_array['gd_country'] = get_query_var('gd_country_full'); }
3837
+        if (get_query_var('gd_region_full')) {$location_array['gd_region'] = get_query_var('gd_region_full'); }
3838
+        if (get_query_var('gd_city_full')) {$location_array['gd_city'] = get_query_var('gd_city_full'); }
3839 3839
     }
3840 3840
     $location_single = '';
3841 3841
     $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
@@ -3907,23 +3907,23 @@  discard block
 block discarded – undo
3907 3907
     }
3908 3908
 
3909 3909
 
3910
-    if(!empty($location_titles)) {
3910
+    if (!empty($location_titles)) {
3911 3911
         $vars['%%location%%'] = implode(", ", $location_titles);
3912 3912
     }
3913 3913
 
3914 3914
 
3915
-    if(!empty($location_titles)) {
3915
+    if (!empty($location_titles)) {
3916 3916
         $vars['%%in_location%%'] = __('in ', 'geodirectory') . implode(", ", $location_titles);
3917 3917
     }
3918 3918
 
3919 3919
 
3920 3920
 
3921
-    if($location_single) {
3922
-        $vars['%%in_location_single%%'] = __('in', 'geodirectory') . ' ' .$location_single;
3921
+    if ($location_single) {
3922
+        $vars['%%in_location_single%%'] = __('in', 'geodirectory') . ' ' . $location_single;
3923 3923
     }
3924 3924
 
3925 3925
 
3926
-    if($location_single) {
3926
+    if ($location_single) {
3927 3927
         $vars['%%location_single%%'] = $location_single;
3928 3928
     }
3929 3929
 
@@ -3935,17 +3935,17 @@  discard block
 block discarded – undo
3935 3935
      * @param string $vars The title with variables.
3936 3936
      * @param array $location_array The array of location variables.
3937 3937
      */
3938
-    return apply_filters('geodir_wpseo_replacements_vars',$vars,$location_array);
3938
+    return apply_filters('geodir_wpseo_replacements_vars', $vars, $location_array);
3939 3939
 }
3940 3940
 
3941 3941
 
3942
-add_filter('geodir_seo_meta_title','geodir_filter_title_variables',10,3);
3943
-add_filter('geodir_seo_page_title','geodir_filter_title_variables',10,2);
3944
-add_filter('geodir_seo_meta_description_pre','geodir_filter_title_variables',10,3);
3945
-function geodir_filter_title_variables($title, $gd_page, $sep=''){
3942
+add_filter('geodir_seo_meta_title', 'geodir_filter_title_variables', 10, 3);
3943
+add_filter('geodir_seo_page_title', 'geodir_filter_title_variables', 10, 2);
3944
+add_filter('geodir_seo_meta_description_pre', 'geodir_filter_title_variables', 10, 3);
3945
+function geodir_filter_title_variables($title, $gd_page, $sep = '') {
3946 3946
 
3947 3947
 
3948
-    if(!$gd_page || !$title){return $title;}// if no a GD page then bail.
3948
+    if (!$gd_page || !$title) {return $title; }// if no a GD page then bail.
3949 3949
     global $post;
3950 3950
     //print_r($post);
3951 3951
     /*
@@ -3987,119 +3987,119 @@  discard block
 block discarded – undo
3987 3987
     }
3988 3988
 
3989 3989
 
3990
-    if(strpos($title,'%%title%%') !== false){
3991
-        $title = str_replace("%%title%%",$post->post_title,$title);
3990
+    if (strpos($title, '%%title%%') !== false) {
3991
+        $title = str_replace("%%title%%", $post->post_title, $title);
3992 3992
     }
3993 3993
 
3994
-    if(strpos($title,'%%sitename%%') !== false){
3995
-        $title = str_replace("%%sitename%%",get_bloginfo('name'),$title);
3994
+    if (strpos($title, '%%sitename%%') !== false) {
3995
+        $title = str_replace("%%sitename%%", get_bloginfo('name'), $title);
3996 3996
     }
3997 3997
 
3998
-    if(strpos($title,'%%sitedesc%%') !== false){
3999
-        $title = str_replace("%%sitedesc%%",get_bloginfo('description'),$title);
3998
+    if (strpos($title, '%%sitedesc%%') !== false) {
3999
+        $title = str_replace("%%sitedesc%%", get_bloginfo('description'), $title);
4000 4000
     }
4001 4001
 
4002
-    if(strpos($title,'%%excerpt%%') !== false){
4003
-        $title = str_replace("%%excerpt%%",strip_tags(get_the_excerpt()),$title);
4002
+    if (strpos($title, '%%excerpt%%') !== false) {
4003
+        $title = str_replace("%%excerpt%%", strip_tags(get_the_excerpt()), $title);
4004 4004
     }
4005 4005
 
4006
-    if(strpos($title,'%%pt_single%%') !== false){
4006
+    if (strpos($title, '%%pt_single%%') !== false) {
4007 4007
         $single_name = '';
4008
-        if($gd_page=='search' || $gd_page=='author'){
4008
+        if ($gd_page == 'search' || $gd_page == 'author') {
4009 4009
             $geodir_post_types = get_option('geodir_post_types');
4010 4010
             $spt = esc_attr($_REQUEST['stype']);
4011
-            if(isset($geodir_post_types[$spt]['labels']['singular_name'])){
4012
-                $single_name = __($geodir_post_types[$spt]['labels']['singular_name'],'geodirectory');
4011
+            if (isset($geodir_post_types[$spt]['labels']['singular_name'])) {
4012
+                $single_name = __($geodir_post_types[$spt]['labels']['singular_name'], 'geodirectory');
4013 4013
             }
4014
-        }elseif($gd_page=='add-listing'){
4014
+        }elseif ($gd_page == 'add-listing') {
4015 4015
             $geodir_post_types = get_option('geodir_post_types');
4016 4016
             $spt = isset($_REQUEST['listing_type']) ? esc_attr($_REQUEST['listing_type']) : '';
4017
-            if(!$spt && isset($_REQUEST['pid'])){
4018
-                $spt = get_post_type( $_REQUEST['pid'] );
4017
+            if (!$spt && isset($_REQUEST['pid'])) {
4018
+                $spt = get_post_type($_REQUEST['pid']);
4019 4019
             }
4020
-            if(!$spt){$spt='gd_place';}
4021
-            if(isset($geodir_post_types[$spt]['labels']['singular_name'])){
4022
-                $single_name = __($geodir_post_types[$spt]['labels']['singular_name'],'geodirectory');
4020
+            if (!$spt) {$spt = 'gd_place'; }
4021
+            if (isset($geodir_post_types[$spt]['labels']['singular_name'])) {
4022
+                $single_name = __($geodir_post_types[$spt]['labels']['singular_name'], 'geodirectory');
4023 4023
             }
4024 4024
         }
4025
-        elseif($post->post_type){
4025
+        elseif ($post->post_type) {
4026 4026
             $geodir_post_types = get_option('geodir_post_types');
4027
-            if(isset($geodir_post_types[$post->post_type]['labels']['singular_name'])){
4028
-                $single_name = __($geodir_post_types[$post->post_type]['labels']['singular_name'],'geodirectory');
4027
+            if (isset($geodir_post_types[$post->post_type]['labels']['singular_name'])) {
4028
+                $single_name = __($geodir_post_types[$post->post_type]['labels']['singular_name'], 'geodirectory');
4029 4029
             }
4030 4030
 
4031 4031
 
4032 4032
         }
4033
-        $title = str_replace("%%pt_single%%",$single_name,$title);
4033
+        $title = str_replace("%%pt_single%%", $single_name, $title);
4034 4034
     }
4035 4035
 
4036
-    if(strpos($title,'%%pt_plural%%') !== false){
4036
+    if (strpos($title, '%%pt_plural%%') !== false) {
4037 4037
         $plural_name = '';
4038
-        if($gd_page=='search' || $gd_page=='author'){
4038
+        if ($gd_page == 'search' || $gd_page == 'author') {
4039 4039
             $geodir_post_types = get_option('geodir_post_types');
4040 4040
             $spt = esc_attr($_REQUEST['stype']);
4041
-            if(isset($geodir_post_types[$spt]['labels']['name'])){
4042
-                $plural_name = __($geodir_post_types[$spt]['labels']['name'],'geodirectory');
4041
+            if (isset($geodir_post_types[$spt]['labels']['name'])) {
4042
+                $plural_name = __($geodir_post_types[$spt]['labels']['name'], 'geodirectory');
4043 4043
             }
4044
-        }elseif($gd_page=='add-listing'){
4044
+        }elseif ($gd_page == 'add-listing') {
4045 4045
             $geodir_post_types = get_option('geodir_post_types');
4046 4046
             $spt = sanitize_text_field($_REQUEST['listing_type']);
4047
-            if(!$spt){$spt='gd_place';}
4048
-            if(isset($geodir_post_types[$spt]['labels']['name'])){
4049
-                $plural_name = __($geodir_post_types[$spt]['labels']['name'],'geodirectory');
4047
+            if (!$spt) {$spt = 'gd_place'; }
4048
+            if (isset($geodir_post_types[$spt]['labels']['name'])) {
4049
+                $plural_name = __($geodir_post_types[$spt]['labels']['name'], 'geodirectory');
4050 4050
             }
4051 4051
         }
4052
-        elseif(isset($post->post_type) && $post->post_type){
4052
+        elseif (isset($post->post_type) && $post->post_type) {
4053 4053
             $geodir_post_types = get_option('geodir_post_types');
4054
-            if(isset($geodir_post_types[$post->post_type]['labels']['name'])){
4055
-                $plural_name = __($geodir_post_types[$post->post_type]['labels']['name'],'geodirectory');
4054
+            if (isset($geodir_post_types[$post->post_type]['labels']['name'])) {
4055
+                $plural_name = __($geodir_post_types[$post->post_type]['labels']['name'], 'geodirectory');
4056 4056
             }
4057 4057
 
4058 4058
         }
4059
-        $title = str_replace("%%pt_plural%%",$plural_name,$title);
4059
+        $title = str_replace("%%pt_plural%%", $plural_name, $title);
4060 4060
     }
4061 4061
 
4062 4062
 
4063 4063
 
4064
-    if(strpos($title,'%%category%%') !== false){
4064
+    if (strpos($title, '%%category%%') !== false) {
4065 4065
         $cat_name = '';
4066 4066
 
4067
-        if($gd_page=='detail') {
4067
+        if ($gd_page == 'detail') {
4068 4068
             if ($post->default_category) {
4069 4069
                 $cat = get_term($post->default_category, $post->post_type . 'category');
4070 4070
                 $cat_name = (isset($cat->name)) ? $cat->name : '';
4071 4071
             }
4072
-        }elseif($gd_page=='listing'){
4072
+        }elseif ($gd_page == 'listing') {
4073 4073
             $queried_object = get_queried_object();
4074
-            if(isset($queried_object->name)){
4074
+            if (isset($queried_object->name)) {
4075 4075
                 $cat_name = $queried_object->name;
4076 4076
             }
4077 4077
         }
4078
-        $title = str_replace("%%category%%",$cat_name,$title);
4078
+        $title = str_replace("%%category%%", $cat_name, $title);
4079 4079
     }
4080 4080
 
4081
-    if(strpos($title,'%%tag%%') !== false){
4081
+    if (strpos($title, '%%tag%%') !== false) {
4082 4082
         $cat_name = '';
4083 4083
 
4084
-        if($gd_page=='detail') {
4084
+        if ($gd_page == 'detail') {
4085 4085
             if ($post->default_category) {
4086 4086
                 $cat = get_term($post->default_category, $post->post_type . 'category');
4087 4087
                 $cat_name = (isset($cat->name)) ? $cat->name : '';
4088 4088
             }
4089
-        }elseif($gd_page=='listing'){
4089
+        }elseif ($gd_page == 'listing') {
4090 4090
             $queried_object = get_queried_object();
4091
-            if(isset($queried_object->name)){
4091
+            if (isset($queried_object->name)) {
4092 4092
                 $cat_name = $queried_object->name;
4093 4093
             }
4094 4094
         }
4095
-        $title = str_replace("%%tag%%",$cat_name,$title);
4095
+        $title = str_replace("%%tag%%", $cat_name, $title);
4096 4096
     }
4097 4097
 
4098 4098
 
4099 4099
 
4100
-    if(strpos($title,'%%id%%') !== false){
4100
+    if (strpos($title, '%%id%%') !== false) {
4101 4101
         $ID = (isset($post->ID)) ? $post->ID : '';
4102
-        $title = str_replace("%%id%%",$ID,$title);
4102
+        $title = str_replace("%%id%%", $ID, $title);
4103 4103
     }
4104 4104
 
4105 4105
     /*
@@ -4112,8 +4112,8 @@  discard block
 block discarded – undo
4112 4112
         }
4113 4113
     */
4114 4114
 
4115
-    if(strpos($title,'%%sep%%') !== false){
4116
-        $title = str_replace("%%sep%%",$sep,$title);
4115
+    if (strpos($title, '%%sep%%') !== false) {
4116
+        $title = str_replace("%%sep%%", $sep, $title);
4117 4117
     }
4118 4118
 
4119 4119
 
@@ -4131,12 +4131,12 @@  discard block
 block discarded – undo
4131 4131
      * @param string $gd_page The page being filtered.
4132 4132
      * @param string $sep The separator, default: `|`.
4133 4133
      */
4134
-    $location_array = apply_filters('geodir_filter_title_variables_location_arr',$location_array,$title, $gd_page, $sep);
4134
+    $location_array = apply_filters('geodir_filter_title_variables_location_arr', $location_array, $title, $gd_page, $sep);
4135 4135
     $location_titles = array();
4136
-    if($gd_page=='location' && get_query_var( 'gd_country_full' )){
4137
-        if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );}
4138
-        if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );}
4139
-        if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );}
4136
+    if ($gd_page == 'location' && get_query_var('gd_country_full')) {
4137
+        if (get_query_var('gd_country_full')) {$location_array['gd_country'] = get_query_var('gd_country_full'); }
4138
+        if (get_query_var('gd_region_full')) {$location_array['gd_region'] = get_query_var('gd_region_full'); }
4139
+        if (get_query_var('gd_city_full')) {$location_array['gd_city'] = get_query_var('gd_city_full'); }
4140 4140
     }
4141 4141
     $location_single = '';
4142 4142
     $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
@@ -4208,65 +4208,65 @@  discard block
 block discarded – undo
4208 4208
     }
4209 4209
 
4210 4210
 
4211
-    if(strpos($title,'%%location%%') !== false){
4211
+    if (strpos($title, '%%location%%') !== false) {
4212 4212
         $location = '';
4213
-        if($location_titles) {
4213
+        if ($location_titles) {
4214 4214
             $location = implode(", ", $location_titles);
4215 4215
         }
4216
-        $title = str_replace("%%location%%",$location,$title);
4216
+        $title = str_replace("%%location%%", $location, $title);
4217 4217
     }
4218 4218
 
4219
-    if(strpos($title,'%%in_location%%') !== false){
4219
+    if (strpos($title, '%%in_location%%') !== false) {
4220 4220
         $location = '';
4221
-        if($location_titles) {
4221
+        if ($location_titles) {
4222 4222
             $location = __('in ', 'geodirectory') . implode(", ", $location_titles);
4223 4223
         }
4224
-        $title = str_replace("%%in_location%%",$location,$title);
4224
+        $title = str_replace("%%in_location%%", $location, $title);
4225 4225
     }
4226 4226
 
4227
-    if(strpos($title,'%%in_location_single%%') !== false){
4228
-        if($location_single) {
4229
-            $location_single = __('in', 'geodirectory') . ' ' .$location_single;
4227
+    if (strpos($title, '%%in_location_single%%') !== false) {
4228
+        if ($location_single) {
4229
+            $location_single = __('in', 'geodirectory') . ' ' . $location_single;
4230 4230
         }
4231
-        $title = str_replace("%%in_location_single%%",$location_single,$title);
4231
+        $title = str_replace("%%in_location_single%%", $location_single, $title);
4232 4232
     }
4233 4233
 
4234
-    if(strpos($title,'%%location_single%%') !== false){
4235
-        $title = str_replace("%%location_single%%",$location_single,$title);
4234
+    if (strpos($title, '%%location_single%%') !== false) {
4235
+        $title = str_replace("%%location_single%%", $location_single, $title);
4236 4236
     }
4237 4237
 
4238 4238
 
4239
-    if(strpos($title,'%%search_term%%') !== false){
4239
+    if (strpos($title, '%%search_term%%') !== false) {
4240 4240
         $search_term = '';
4241
-        if(isset($_REQUEST['s'])){
4241
+        if (isset($_REQUEST['s'])) {
4242 4242
             $search_term = esc_attr($_REQUEST['s']);
4243 4243
         }
4244
-        $title = str_replace("%%search_term%%",$search_term,$title);
4244
+        $title = str_replace("%%search_term%%", $search_term, $title);
4245 4245
     }
4246 4246
 
4247
-    if(strpos($title,'%%search_near%%') !== false){
4247
+    if (strpos($title, '%%search_near%%') !== false) {
4248 4248
         $search_term = '';
4249
-        if(isset($_REQUEST['snear'])){
4249
+        if (isset($_REQUEST['snear'])) {
4250 4250
             $search_term = esc_attr($_REQUEST['snear']);
4251 4251
         }
4252
-        $title = str_replace("%%search_near%%",$search_term,$title);
4252
+        $title = str_replace("%%search_near%%", $search_term, $title);
4253 4253
     }
4254 4254
 
4255
-    if(strpos($title,'%%name%%') !== false){
4255
+    if (strpos($title, '%%name%%') !== false) {
4256 4256
         $author_name = '';
4257
-        if($author_name = get_the_author()){}
4258
-        else{
4257
+        if ($author_name = get_the_author()) {}
4258
+        else {
4259 4259
             $queried_object = get_queried_object();
4260
-            if(isset($queried_object->data->user_nicename)){
4260
+            if (isset($queried_object->data->user_nicename)) {
4261 4261
                 $author_name = $queried_object->data->user_nicename;
4262 4262
             }
4263 4263
         }
4264
-        $title = str_replace("%%name%%",$author_name,$title);
4264
+        $title = str_replace("%%name%%", $author_name, $title);
4265 4265
     }
4266 4266
 
4267
-    $title = wptexturize( $title );
4268
-    $title = convert_chars( $title );
4269
-    $title = esc_html( $title );
4267
+    $title = wptexturize($title);
4268
+    $title = convert_chars($title);
4269
+    $title = esc_html($title);
4270 4270
 
4271 4271
     /**
4272 4272
      * Filter the title variables after standard ones have been filtered.
@@ -4279,7 +4279,7 @@  discard block
 block discarded – undo
4279 4279
      * @param string $sep The separator, default: `|`.
4280 4280
      */
4281 4281
 
4282
-    return apply_filters('geodir_filter_title_variables_vars',$title,$location_array, $gd_page, $sep);
4282
+    return apply_filters('geodir_filter_title_variables_vars', $title, $location_array, $gd_page, $sep);
4283 4283
 }
4284 4284
 
4285 4285
 /**
@@ -4401,14 +4401,14 @@  discard block
 block discarded – undo
4401 4401
         return;
4402 4402
     }
4403 4403
     
4404
-    $is_admin = is_admin() && ( !defined('DOING_AJAX' ) || ( defined('DOING_AJAX') && !DOING_AJAX ) )  ? true : false;
4404
+    $is_admin = is_admin() && (!defined('DOING_AJAX') || (defined('DOING_AJAX') && !DOING_AJAX)) ? true : false;
4405 4405
     $inline_save = isset($_POST['action']) && $_POST['action'] == 'inline-save' ? true : false;
4406 4406
 
4407 4407
     if (empty($post->post_type) || $is_admin || $inline_save || (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)) {
4408 4408
         return;
4409 4409
     }
4410 4410
 
4411
-    $user_id = (int)get_current_user_id();
4411
+    $user_id = (int) get_current_user_id();
4412 4412
         
4413 4413
     if ($user_id > 0 && get_option('geodir_notify_post_edited') && !wp_is_post_revision($post_ID) && in_array($post->post_type, geodir_get_posttypes())) {
4414 4414
         $author_id = !empty($post->post_author) ? $post->post_author : 0;
Please login to merge, or discard this patch.