Test Failed
Push — master ( e72891...440de9 )
by Stiofan
25:52
created
geodirectory-functions/general_functions.php 1 patch
Spacing   +359 added lines, -359 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 /**
11 11
  * Get All Plugin functions from WordPress
12 12
  */
13
-include_once(ABSPATH . 'wp-admin/includes/plugin.php');
13
+include_once(ABSPATH.'wp-admin/includes/plugin.php');
14 14
 
15 15
 /*-----------------------------------------------------------------------------------*/
16 16
 /* Helper functions */
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
 {
30 30
 
31 31
     if (is_ssl()) :
32
-        return str_replace('http://', 'https://', WP_PLUGIN_URL) . "/" . plugin_basename(dirname(dirname(__FILE__)));
32
+        return str_replace('http://', 'https://', WP_PLUGIN_URL)."/".plugin_basename(dirname(dirname(__FILE__)));
33 33
     else :
34
-        return WP_PLUGIN_URL . "/" . plugin_basename(dirname(dirname(__FILE__)));
34
+        return WP_PLUGIN_URL."/".plugin_basename(dirname(dirname(__FILE__)));
35 35
     endif;
36 36
 }
37 37
 
@@ -47,10 +47,10 @@  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
-        return WP_PLUGIN_DIR . "/" . plugin_basename(dirname(dirname(__FILE__)));
53
+        return WP_PLUGIN_DIR."/".plugin_basename(dirname(dirname(__FILE__)));
54 54
     }
55 55
 }
56 56
 
@@ -129,10 +129,10 @@  discard block
 block discarded – undo
129 129
     foreach ($params as $key => $value) {
130 130
         if (gettype($value) == 'array') { //Handle array data properly
131 131
             foreach ($value as $val) {
132
-                $params_arr[] = $key . '[]=' . urlencode($val);
132
+                $params_arr[] = $key.'[]='.urlencode($val);
133 133
             }
134 134
         } else {
135
-            $params_arr[] = $key . '=' . urlencode($value);
135
+            $params_arr[] = $key.'='.urlencode($value);
136 136
         }
137 137
     }
138 138
     $link .= implode('&', $params_arr);
@@ -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
 }
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
         $pageURL .= "s";
181 181
     }
182 182
     $pageURL .= "://";
183
-    $pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
183
+    $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
184 184
     /**
185 185
      * Filter the current page URL returned by function geodir_curPageURL().
186 186
      *
@@ -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'] ;
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
              * @since 1.0.0
506 506
              * @param array $imagesizes[$size] Image size array of the passed key.
507 507
              */
508
-            return apply_filters('geodir_get_imagesize_' . $size, $imagesizes[$size]);
508
+            return apply_filters('geodir_get_imagesize_'.$size, $imagesizes[$size]);
509 509
 
510 510
         } elseif (!empty($size)) {
511 511
 
@@ -544,13 +544,13 @@  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) {
551 551
             $num = rand() % 33;
552 552
             $tmp = substr($chars, $num, 1);
553
-            $rstring = $rstring . $tmp;
553
+            $rstring = $rstring.$tmp;
554 554
             $i++;
555 555
         }
556 556
         return $rstring;
@@ -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);
@@ -705,12 +705,12 @@  discard block
 block discarded – undo
705 705
 
706 706
         if ($post_info) {
707 707
             $posted_date = $post_info->post_date;
708
-            $listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
708
+            $listingLink = '<a href="'.$productlink.'"><b>'.$post_info->post_title.'</b></a>';
709 709
         }
710 710
         $siteurl = home_url();
711
-        $siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>';
711
+        $siteurl_link = '<a href="'.$siteurl.'">'.$siteurl.'</a>';
712 712
         $loginurl = geodir_login_url();
713
-        $loginurl_link = '<a href="' . $loginurl . '">login</a>';
713
+        $loginurl_link = '<a href="'.$loginurl.'">login</a>';
714 714
         
715 715
         $post_author_id = !empty($post_info) ? $post_info->post_author : 0;
716 716
         $post_author_name = geodir_get_client_name($post_author_id);
@@ -724,18 +724,18 @@  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
-        $headers = 'MIME-Version: 1.0' . "\r\n";
736
-        $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
737
-        $headers .= "Reply-To: " . $fromEmail . "\r\n";
738
-        $headers .= 'From: ' . $sitefromEmailName . ' <' . $sitefromEmail . '>' . "\r\n";
735
+        $headers = 'MIME-Version: 1.0'."\r\n";
736
+        $headers .= 'Content-type: text/html; charset=UTF-8'."\r\n";
737
+        $headers .= "Reply-To: ".$fromEmail."\r\n";
738
+        $headers .= 'From: '.$sitefromEmailName.' <'.$sitefromEmail.'>'."\r\n";
739 739
 
740 740
         $to = $toEmail;
741 741
 
@@ -756,7 +756,7 @@  discard block
 block discarded – undo
756 756
          * @param string $post_id The post ID.
757 757
          * @param string $user_id The user ID.
758 758
          */
759
-        $to = apply_filters('geodir_sendEmail_to',$to,$fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
759
+        $to = apply_filters('geodir_sendEmail_to', $to, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
760 760
         /**
761 761
          * Filter the client email subject.
762 762
          *
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
          * @param string $post_id The post ID.
775 775
          * @param string $user_id The user ID.
776 776
          */
777
-        $subject = apply_filters('geodir_sendEmail_subject',$subject,$fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
777
+        $subject = apply_filters('geodir_sendEmail_subject', $subject, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
778 778
         /**
779 779
          * Filter the client email message.
780 780
          *
@@ -792,7 +792,7 @@  discard block
 block discarded – undo
792 792
          * @param string $post_id The post ID.
793 793
          * @param string $user_id The user ID.
794 794
          */
795
-        $message = apply_filters('geodir_sendEmail_message',$message,$fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
795
+        $message = apply_filters('geodir_sendEmail_message', $message, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
796 796
         /**
797 797
          * Filter the client email headers.
798 798
          *
@@ -810,22 +810,22 @@  discard block
 block discarded – undo
810 810
          * @param string $post_id The post ID.
811 811
          * @param string $user_id The user ID.
812 812
          */
813
-        $headers = apply_filters('geodir_sendEmail_headers',$headers,$fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
813
+        $headers = apply_filters('geodir_sendEmail_headers', $headers, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
814 814
 
815 815
         $sent = wp_mail($to, $subject, $message, $headers);
816 816
 
817
-        if( ! $sent ) {
818
-            if ( is_array( $to ) ) {
819
-                $to = implode( ',', $to );
817
+        if (!$sent) {
818
+            if (is_array($to)) {
819
+                $to = implode(',', $to);
820 820
             }
821 821
             $log_message = sprintf(
822
-                __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
822
+                __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
823 823
                 $message_type,
824
-                date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
824
+                date_i18n('F j Y H:i:s', current_time('timestamp')),
825 825
                 $to,
826 826
                 $subject
827 827
             );
828
-            geodir_error_log( $log_message );
828
+            geodir_error_log($log_message);
829 829
         }
830 830
 
831 831
         ///////// ADMIN BCC EMIALS
@@ -837,11 +837,11 @@  discard block
 block discarded – undo
837 837
             $subject = __(stripslashes_deep(get_option('geodir_post_submited_success_email_subject_admin')), 'geodirectory');
838 838
             $message = __(stripslashes_deep(get_option('geodir_post_submited_success_email_content_admin')), 'geodirectory');
839 839
 
840
-            $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#]');
840
+            $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#]');
841 841
             $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);
842 842
             $message = str_replace($search_array, $replace_array, $message);
843 843
 
844
-            $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]','[#user_login#]','[#username#]');
844
+            $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]', '[#user_login#]', '[#username#]');
845 845
             $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName, $posted_date, $user_login, $user_login);
846 846
             $subject = str_replace($search_array, $replace_array, $subject);
847 847
 
@@ -866,21 +866,21 @@  discard block
 block discarded – undo
866 866
             $admin_bcc = true;
867 867
         }
868 868
 
869
-        if($admin_bcc===true){
869
+        if ($admin_bcc === true) {
870 870
             $sent = wp_mail($to, $subject, $message, $headers);
871 871
 
872
-            if( ! $sent ) {
873
-                if ( is_array( $to ) ) {
874
-                    $to = implode( ',', $to );
872
+            if (!$sent) {
873
+                if (is_array($to)) {
874
+                    $to = implode(',', $to);
875 875
                 }
876 876
                 $log_message = sprintf(
877
-                    __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
877
+                    __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
878 878
                     $message_type,
879
-                    date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
879
+                    date_i18n('F j Y H:i:s', current_time('timestamp')),
880 880
                     $to,
881 881
                     $subject
882 882
                 );
883
-                geodir_error_log( $log_message );
883
+                geodir_error_log($log_message);
884 884
             }
885 885
         }
886 886
 
@@ -912,12 +912,12 @@  discard block
 block discarded – undo
912 912
         foreach ($parents as $parent):
913 913
             $item = get_term_by('id', $parent, get_query_var('taxonomy'));
914 914
             $url = get_term_link($item, get_query_var('taxonomy'));
915
-            echo '<li> > <a href="' . $url . '">' . $item->name . '</a></li>';
915
+            echo '<li> > <a href="'.$url.'">'.$item->name.'</a></li>';
916 916
         endforeach;
917 917
 
918 918
     endif;
919 919
 
920
-    echo '<li> > ' . $term->name . '</li>';
920
+    echo '<li> > '.$term->name.'</li>';
921 921
 }
922 922
 
923 923
 
@@ -951,7 +951,7 @@  discard block
 block discarded – undo
951 951
          *
952 952
          * @since 1.0.0
953 953
          */
954
-        $breadcrumb .= '<li>' . apply_filters('geodir_breadcrumb_first_link', '<a href="' . home_url() . '">' . __('Home', 'geodirectory') . '</a>') . '</li>';
954
+        $breadcrumb .= '<li>'.apply_filters('geodir_breadcrumb_first_link', '<a href="'.home_url().'">'.__('Home', 'geodirectory').'</a>').'</li>';
955 955
 
956 956
         $gd_post_type = geodir_get_current_posttype();
957 957
         $post_type_info = get_post_type_object($gd_post_type);
@@ -975,7 +975,7 @@  discard block
 block discarded – undo
975 975
             $location_manager = defined('POST_LOCATION_TABLE') ? true : false;
976 976
 			$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
977 977
 				
978
-			if(geodir_is_page('detail') && isset($post->country_slug)){
978
+			if (geodir_is_page('detail') && isset($post->country_slug)) {
979 979
                 $location_terms = array(
980 980
                     'gd_country' => $post->country_slug,
981 981
                     'gd_region' => $post->region_slug,
@@ -1030,12 +1030,12 @@  discard block
 block discarded – undo
1030 1030
             $is_location_last = '';
1031 1031
             $is_taxonomy_last = '';
1032 1032
             $breadcrumb .= '<li>';
1033
-            if (get_query_var($gd_post_type . 'category'))
1034
-                $gd_taxonomy = $gd_post_type . 'category';
1035
-            elseif (get_query_var($gd_post_type . '_tags'))
1036
-                $gd_taxonomy = $gd_post_type . '_tags';
1033
+            if (get_query_var($gd_post_type.'category'))
1034
+                $gd_taxonomy = $gd_post_type.'category';
1035
+            elseif (get_query_var($gd_post_type.'_tags'))
1036
+                $gd_taxonomy = $gd_post_type.'_tags';
1037 1037
 
1038
-            $breadcrumb .= $separator . '<a href="' . $listing_link . '">' . __(ucfirst($post_type_info->label), 'geodirectory') . '</a>';
1038
+            $breadcrumb .= $separator.'<a href="'.$listing_link.'">'.__(ucfirst($post_type_info->label), 'geodirectory').'</a>';
1039 1039
             if (!empty($gd_taxonomy) || geodir_is_page('detail'))
1040 1040
                 $is_location_last = false;
1041 1041
             else
@@ -1085,18 +1085,18 @@  discard block
 block discarded – undo
1085 1085
                         }
1086 1086
 
1087 1087
                         if ($is_location_last && $key == 'gd_country' && !(isset($location_terms['gd_region']) && $location_terms['gd_region'] != '') && !(isset($location_terms['gd_city']) && $location_terms['gd_city'] != '')) {
1088
-                            $breadcrumb .= $location_term_actual_country != '' ? $separator . $location_term_actual_country : $separator . $gd_location_link_text;
1088
+                            $breadcrumb .= $location_term_actual_country != '' ? $separator.$location_term_actual_country : $separator.$gd_location_link_text;
1089 1089
                         } else if ($is_location_last && $key == 'gd_region' && !(isset($location_terms['gd_city']) && $location_terms['gd_city'] != '')) {
1090
-                            $breadcrumb .= $location_term_actual_region != '' ? $separator . $location_term_actual_region : $separator . $gd_location_link_text;
1090
+                            $breadcrumb .= $location_term_actual_region != '' ? $separator.$location_term_actual_region : $separator.$gd_location_link_text;
1091 1091
                         } else if ($is_location_last && $key == 'gd_city' && empty($location_terms['gd_neighbourhood'])) {
1092
-                            $breadcrumb .= $location_term_actual_city != '' ? $separator . $location_term_actual_city : $separator . $gd_location_link_text;
1092
+                            $breadcrumb .= $location_term_actual_city != '' ? $separator.$location_term_actual_city : $separator.$gd_location_link_text;
1093 1093
                         } else if ($is_location_last && $key == 'gd_neighbourhood') {
1094
-                            $breadcrumb .= $separator . $gd_location_link_text;
1094
+                            $breadcrumb .= $separator.$gd_location_link_text;
1095 1095
                         } else {
1096 1096
                             if (get_option('permalink_structure') != '') {
1097
-                                $location_link .= $location_term . '/';
1097
+                                $location_link .= $location_term.'/';
1098 1098
                             } else {
1099
-                                $location_link .= "&$key=" . $location_term;
1099
+                                $location_link .= "&$key=".$location_term;
1100 1100
                             }
1101 1101
 
1102 1102
                             if ($key == 'gd_country' && $location_term_actual_country != '') {
@@ -1113,7 +1113,7 @@  discard block
 block discarded – undo
1113 1113
                             }
1114 1114
                             */
1115 1115
 
1116
-                            $breadcrumb .= $separator . '<a href="' . $location_link . '">' . $gd_location_link_text . '</a>';
1116
+                            $breadcrumb .= $separator.'<a href="'.$location_link.'">'.$gd_location_link_text.'</a>';
1117 1117
                         }
1118 1118
                     }
1119 1119
                 }
@@ -1124,8 +1124,8 @@  discard block
 block discarded – undo
1124 1124
 
1125 1125
                 //if(get_option('geodir_add_categories_url'))
1126 1126
                 {
1127
-                    if (get_query_var($gd_post_type . '_tags')) {
1128
-                        $cat_link = $listing_link . 'tags/';
1127
+                    if (get_query_var($gd_post_type.'_tags')) {
1128
+                        $cat_link = $listing_link.'tags/';
1129 1129
                     } else
1130 1130
                         $cat_link = $listing_link;
1131 1131
 
@@ -1136,7 +1136,7 @@  discard block
 block discarded – undo
1136 1136
 
1137 1137
                         if ($location_term != '') {
1138 1138
                             if (get_option('permalink_structure') != '') {
1139
-                                $cat_link .= $location_term . '/';
1139
+                                $cat_link .= $location_term.'/';
1140 1140
                             }
1141 1141
                         }
1142 1142
                     }
@@ -1156,10 +1156,10 @@  discard block
 block discarded – undo
1156 1156
                         }
1157 1157
 
1158 1158
                         if ($term_index == count($term_array) && $is_taxonomy_last)
1159
-                            $breadcrumb .= $separator . $term_link_text;
1159
+                            $breadcrumb .= $separator.$term_link_text;
1160 1160
                         else {
1161
-                            $cat_link .= $term . '/';
1162
-                            $breadcrumb .= $separator . '<a href="' . $cat_link . '">' . $term_link_text . '</a>';
1161
+                            $cat_link .= $term.'/';
1162
+                            $breadcrumb .= $separator.'<a href="'.$cat_link.'">'.$term_link_text.'</a>';
1163 1163
                         }
1164 1164
                         $term_index++;
1165 1165
                     }
@@ -1169,7 +1169,7 @@  discard block
 block discarded – undo
1169 1169
             }
1170 1170
 
1171 1171
             if (geodir_is_page('detail'))
1172
-                $breadcrumb .= $separator . get_the_title();
1172
+                $breadcrumb .= $separator.get_the_title();
1173 1173
 
1174 1174
             $breadcrumb .= '</li>';
1175 1175
 
@@ -1189,7 +1189,7 @@  discard block
 block discarded – undo
1189 1189
             $default_author_link = apply_filters('geodir_dashboard_author_link', $default_author_link, $user_id);
1190 1190
 
1191 1191
             $breadcrumb .= '<li>';
1192
-            $breadcrumb .= $separator . '<a href="' . $default_author_link . '">' . __('My Dashboard', 'geodirectory') . '</a>';
1192
+            $breadcrumb .= $separator.'<a href="'.$default_author_link.'">'.__('My Dashboard', 'geodirectory').'</a>';
1193 1193
 
1194 1194
             if (isset($_REQUEST['list'])) {
1195 1195
                 $author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true', 'stype' => $_REQUEST['stype']), false);
@@ -1204,20 +1204,20 @@  discard block
 block discarded – undo
1204 1204
                  */
1205 1205
                 $author_link = apply_filters('geodir_dashboard_author_link', $author_link, $user_id, $_REQUEST['stype']);
1206 1206
 
1207
-                $breadcrumb .= $separator . '<a href="' . $author_link . '">' . __(ucfirst($post_type_info->label), 'geodirectory') . '</a>';
1208
-                $breadcrumb .= $separator . ucfirst(__('My', 'geodirectory') . ' ' . $_REQUEST['list']);
1207
+                $breadcrumb .= $separator.'<a href="'.$author_link.'">'.__(ucfirst($post_type_info->label), 'geodirectory').'</a>';
1208
+                $breadcrumb .= $separator.ucfirst(__('My', 'geodirectory').' '.$_REQUEST['list']);
1209 1209
             } else
1210
-                $breadcrumb .= $separator . __(ucfirst($post_type_info->label), 'geodirectory');
1210
+                $breadcrumb .= $separator.__(ucfirst($post_type_info->label), 'geodirectory');
1211 1211
 
1212 1212
             $breadcrumb .= '</li>';
1213 1213
         } elseif (is_category() || is_single()) {
1214 1214
             $category = get_the_category();
1215 1215
             if (is_category()) {
1216
-                $breadcrumb .= '<li>' . $separator . $category[0]->cat_name . '</li>';
1216
+                $breadcrumb .= '<li>'.$separator.$category[0]->cat_name.'</li>';
1217 1217
             }
1218 1218
             if (is_single()) {
1219
-                $breadcrumb .= '<li>' . $separator . '<a href="' . get_category_link($category[0]->term_id) . '">' . $category[0]->cat_name . '</a></li>';
1220
-                $breadcrumb .= '<li>' . $separator . get_the_title() . '</li>';
1219
+                $breadcrumb .= '<li>'.$separator.'<a href="'.get_category_link($category[0]->term_id).'">'.$category[0]->cat_name.'</a></li>';
1220
+                $breadcrumb .= '<li>'.$separator.get_the_title().'</li>';
1221 1221
             }
1222 1222
             /* End of my version ##################################################### */
1223 1223
         } else if (is_page()) {
@@ -1225,37 +1225,37 @@  discard block
 block discarded – undo
1225 1225
 
1226 1226
             if (geodir_is_page('location')) {
1227 1227
                 $location_page_id = geodir_location_page_id();
1228
-                $loc_post = get_post( $location_page_id );
1228
+                $loc_post = get_post($location_page_id);
1229 1229
                 $post_name = $loc_post->post_name;
1230
-                $slug= ucwords(str_replace('-',' ',$post_name));
1231
-                $page_title = !empty($slug )? $slug : __('Location', 'geodirectory');
1230
+                $slug = ucwords(str_replace('-', ' ', $post_name));
1231
+                $page_title = !empty($slug) ? $slug : __('Location', 'geodirectory');
1232 1232
             }
1233 1233
 
1234
-            $breadcrumb .= '<li>' . $separator;
1234
+            $breadcrumb .= '<li>'.$separator;
1235 1235
             $breadcrumb .= stripslashes_deep($page_title);
1236 1236
             $breadcrumb .= '</li>';
1237 1237
         } else if (is_tag()) {
1238
-            $breadcrumb .=  "<li> " . $separator . single_tag_title('',false) . '</li>';
1238
+            $breadcrumb .= "<li> ".$separator.single_tag_title('', false).'</li>';
1239 1239
         } else if (is_day()) {
1240
-            $breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1240
+            $breadcrumb .= "<li> ".$separator.__(" Archive for", 'geodirectory')." ";
1241 1241
             the_time('F jS, Y');
1242 1242
             $breadcrumb .= '</li>';
1243 1243
         } else if (is_month()) {
1244
-            $breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1244
+            $breadcrumb .= "<li> ".$separator.__(" Archive for", 'geodirectory')." ";
1245 1245
             the_time('F, Y');
1246 1246
             $breadcrumb .= '</li>';
1247 1247
         } else if (is_year()) {
1248
-            $breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1248
+            $breadcrumb .= "<li> ".$separator.__(" Archive for", 'geodirectory')." ";
1249 1249
             the_time('Y');
1250 1250
             $breadcrumb .= '</li>';
1251 1251
         } else if (is_author()) {
1252
-            $breadcrumb .= "<li> " . $separator . __(" Author Archive", 'geodirectory');
1252
+            $breadcrumb .= "<li> ".$separator.__(" Author Archive", 'geodirectory');
1253 1253
             $breadcrumb .= '</li>';
1254 1254
         } else if (isset($_GET['paged']) && !empty($_GET['paged'])) {
1255
-            $breadcrumb .= "<li>" . $separator . __("Blog Archives", 'geodirectory');
1255
+            $breadcrumb .= "<li>".$separator.__("Blog Archives", 'geodirectory');
1256 1256
             $breadcrumb .= '</li>';
1257 1257
         } else if (is_search()) {
1258
-            $breadcrumb .= "<li> " . $separator . __(" Search Results", 'geodirectory');
1258
+            $breadcrumb .= "<li> ".$separator.__(" Search Results", 'geodirectory');
1259 1259
             $breadcrumb .= '</li>';
1260 1260
         }
1261 1261
         $breadcrumb .= '</ul></div>';
@@ -1286,7 +1286,7 @@  discard block
 block discarded – undo
1286 1286
     function geodir_allow_wpadmin()
1287 1287
     {
1288 1288
         global $wpdb;
1289
-        if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && (!defined( 'DOING_AJAX' )) ) // checking action in request to allow ajax request go through
1289
+        if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && (!defined('DOING_AJAX'))) // checking action in request to allow ajax request go through
1290 1290
         {
1291 1291
             if (current_user_can('administrator')) {
1292 1292
             } else {
@@ -1311,7 +1311,7 @@  discard block
 block discarded – undo
1311 1311
 function fetch_remote_file($url)
1312 1312
 {
1313 1313
     // extract the file name and extension from the url
1314
-    require_once(ABSPATH . 'wp-includes/pluggable.php');
1314
+    require_once(ABSPATH.'wp-includes/pluggable.php');
1315 1315
     $file_name = basename($url);
1316 1316
     if (strpos($file_name, '?') !== false) {
1317 1317
         list($file_name) = explode('?', $file_name);
@@ -1343,15 +1343,15 @@  discard block
 block discarded – undo
1343 1343
         return new WP_Error('upload_dir_error', $upload['error']);
1344 1344
 
1345 1345
 
1346
-    sleep(0.3);// if multiple remote file this can cause the remote server to timeout so we add a slight delay
1346
+    sleep(0.3); // if multiple remote file this can cause the remote server to timeout so we add a slight delay
1347 1347
 
1348 1348
     // fetch the remote url and write it to the placeholder file
1349
-    $headers = wp_remote_get($url, array('stream' => true,'filename' => $upload['file']));
1349
+    $headers = wp_remote_get($url, array('stream' => true, 'filename' => $upload['file']));
1350 1350
 
1351 1351
     $log_message = '';
1352
-    if( is_wp_error( $headers  ) ) {
1352
+    if (is_wp_error($headers)) {
1353 1353
         echo 'file: '.$url;
1354
-        return new WP_Error('import_file_error',$headers->get_error_message());
1354
+        return new WP_Error('import_file_error', $headers->get_error_message());
1355 1355
     }
1356 1356
 
1357 1357
     $filesize = filesize($upload['file']);
@@ -1364,21 +1364,21 @@  discard block
 block discarded – undo
1364 1364
         $log_message = sprintf(__('Remote server returned error response %1$d %2$s', 'geodirectory'), esc_html($headers['response']), get_status_header_desc($headers['response']));
1365 1365
     }
1366 1366
     elseif (isset($headers['headers']['content-length']) && $filesize != $headers['headers']['content-length']) {
1367
-        $log_message =  __('Remote file is incorrect size', 'geodirectory');
1367
+        $log_message = __('Remote file is incorrect size', 'geodirectory');
1368 1368
     }
1369 1369
     elseif (0 == $filesize) {
1370 1370
         $log_message = __('Zero size file downloaded', 'geodirectory');
1371 1371
     }
1372 1372
 
1373
-    if($log_message){
1373
+    if ($log_message) {
1374 1374
         $del = unlink($upload['file']);
1375
-        if(!$del){geodir_error_log(__('GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory'));}
1376
-        return new WP_Error('import_file_error',$log_message );
1375
+        if (!$del) {geodir_error_log(__('GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory')); }
1376
+        return new WP_Error('import_file_error', $log_message);
1377 1377
     }
1378 1378
 
1379 1379
     if ($dummy && $add_to_cache && is_array($upload)) {
1380 1380
         $images = get_transient('cached_dummy_images');
1381
-        if(is_array($images))
1381
+        if (is_array($images))
1382 1382
             $images[$key] = $upload;
1383 1383
         else
1384 1384
             $images = array($key => $upload);
@@ -1399,12 +1399,12 @@  discard block
 block discarded – undo
1399 1399
  */
1400 1400
 function geodir_max_upload_size()
1401 1401
 {
1402
-    $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
1402
+    $max_filesize = (float) get_option('geodir_upload_max_filesize', 2);
1403 1403
 
1404 1404
     if ($max_filesize > 0 && $max_filesize < 1) {
1405
-        $max_filesize = (int)($max_filesize * 1024) . 'kb';
1405
+        $max_filesize = (int) ($max_filesize * 1024).'kb';
1406 1406
     } else {
1407
-        $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1407
+        $max_filesize = $max_filesize > 0 ? $max_filesize.'mb' : '2mb';
1408 1408
     }
1409 1409
 
1410 1410
     /**
@@ -1427,7 +1427,7 @@  discard block
 block discarded – undo
1427 1427
  */
1428 1428
 function geodir_dummy_folder_exists()
1429 1429
 {
1430
-    $path = geodir_plugin_path() . '/geodirectory-admin/dummy/';
1430
+    $path = geodir_plugin_path().'/geodirectory-admin/dummy/';
1431 1431
     if (!is_dir($path))
1432 1432
         return false;
1433 1433
     else
@@ -1471,35 +1471,35 @@  discard block
 block discarded – undo
1471 1471
     {
1472 1472
         global $wpdb;
1473 1473
         if ($message_type == 'expiration') {
1474
-            $subject = stripslashes(__(get_option('renew_email_subject'),'geodirectory'));
1475
-            $client_message = stripslashes(__(get_option('renew_email_content'),'geodirectory'));
1474
+            $subject = stripslashes(__(get_option('renew_email_subject'), 'geodirectory'));
1475
+            $client_message = stripslashes(__(get_option('renew_email_content'), 'geodirectory'));
1476 1476
         } elseif ($message_type == 'post_submited') {
1477
-            $subject = __(get_option('post_submited_success_email_subject_admin'),'geodirectory');
1478
-            $client_message = __(get_option('post_submited_success_email_content_admin'),'geodirectory');
1477
+            $subject = __(get_option('post_submited_success_email_subject_admin'), 'geodirectory');
1478
+            $client_message = __(get_option('post_submited_success_email_content_admin'), 'geodirectory');
1479 1479
         } elseif ($message_type == 'renew') {
1480
-            $subject = __(get_option('post_renew_success_email_subject_admin'),'geodirectory');
1481
-            $client_message = __(get_option('post_renew_success_email_content_admin'),'geodirectory');
1480
+            $subject = __(get_option('post_renew_success_email_subject_admin'), 'geodirectory');
1481
+            $client_message = __(get_option('post_renew_success_email_content_admin'), 'geodirectory');
1482 1482
         } elseif ($message_type == 'upgrade') {
1483
-            $subject = __(get_option('post_upgrade_success_email_subject_admin'),'geodirectory');
1484
-            $client_message = __(get_option('post_upgrade_success_email_content_admin'),'geodirectory');
1483
+            $subject = __(get_option('post_upgrade_success_email_subject_admin'), 'geodirectory');
1484
+            $client_message = __(get_option('post_upgrade_success_email_content_admin'), 'geodirectory');
1485 1485
         } elseif ($message_type == 'claim_approved') {
1486
-            $subject = __(get_option('claim_approved_email_subject'),'geodirectory');
1487
-            $client_message = __(get_option('claim_approved_email_content'),'geodirectory');
1486
+            $subject = __(get_option('claim_approved_email_subject'), 'geodirectory');
1487
+            $client_message = __(get_option('claim_approved_email_content'), 'geodirectory');
1488 1488
         } elseif ($message_type == 'claim_rejected') {
1489
-            $subject = __(get_option('claim_rejected_email_subject'),'geodirectory');
1490
-            $client_message = __(get_option('claim_rejected_email_content'),'geodirectory');
1489
+            $subject = __(get_option('claim_rejected_email_subject'), 'geodirectory');
1490
+            $client_message = __(get_option('claim_rejected_email_content'), 'geodirectory');
1491 1491
         } elseif ($message_type == 'claim_requested') {
1492
-            $subject = __(get_option('claim_email_subject_admin'),'geodirectory');
1493
-            $client_message = __(get_option('claim_email_content_admin'),'geodirectory');
1492
+            $subject = __(get_option('claim_email_subject_admin'), 'geodirectory');
1493
+            $client_message = __(get_option('claim_email_content_admin'), 'geodirectory');
1494 1494
         } elseif ($message_type == 'auto_claim') {
1495
-            $subject = __(get_option('auto_claim_email_subject'),'geodirectory');
1496
-            $client_message = __(get_option('auto_claim_email_content'),'geodirectory');
1495
+            $subject = __(get_option('auto_claim_email_subject'), 'geodirectory');
1496
+            $client_message = __(get_option('auto_claim_email_content'), 'geodirectory');
1497 1497
         } elseif ($message_type == 'payment_success') {
1498
-            $subject = __(get_option('post_payment_success_admin_email_subject'),'geodirectory');
1499
-            $client_message = __(get_option('post_payment_success_admin_email_content'),'geodirectory');
1498
+            $subject = __(get_option('post_payment_success_admin_email_subject'), 'geodirectory');
1499
+            $client_message = __(get_option('post_payment_success_admin_email_content'), 'geodirectory');
1500 1500
         } elseif ($message_type == 'payment_fail') {
1501
-            $subject = __(get_option('post_payment_fail_admin_email_subject'),'geodirectory');
1502
-            $client_message = __(get_option('post_payment_fail_admin_email_content'),'geodirectory');
1501
+            $subject = __(get_option('post_payment_fail_admin_email_subject'), 'geodirectory');
1502
+            $client_message = __(get_option('post_payment_fail_admin_email_content'), 'geodirectory');
1503 1503
         }
1504 1504
         $transaction_details = $custom_1;
1505 1505
         $fromEmail = get_option('site_email');
@@ -1510,11 +1510,11 @@  discard block
 block discarded – undo
1510 1510
         $productlink = get_permalink($page_id);
1511 1511
         $post_info = get_post($page_id);
1512 1512
         $post_date = date('dS F,Y', strtotime($post_info->post_date));
1513
-        $listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
1513
+        $listingLink = '<a href="'.$productlink.'"><b>'.$post_info->post_title.'</b></a>';
1514 1514
         $loginurl = geodir_login_url();
1515
-        $loginurl_link = '<a href="' . $loginurl . '">login</a>';
1515
+        $loginurl_link = '<a href="'.$loginurl.'">login</a>';
1516 1516
         $siteurl = home_url();
1517
-        $siteurl_link = '<a href="' . $siteurl . '">' . $fromEmailName . '</a>';
1517
+        $siteurl_link = '<a href="'.$siteurl.'">'.$fromEmailName.'</a>';
1518 1518
         $user_info = get_userdata($user_id);
1519 1519
         $user_email = $user_info->user_email;
1520 1520
         $display_name = geodir_get_client_name($user_id);
@@ -1528,14 +1528,14 @@  discard block
 block discarded – undo
1528 1528
         } else {
1529 1529
             $post_type = 'listing';
1530 1530
         }
1531
-        $renew_link = '<a href="' . $siteurl . '?ptype=post_' . $post_type . '&renew=1&pid=' . $page_id . '">' . RENEW_LINK . '</a>';
1531
+        $renew_link = '<a href="'.$siteurl.'?ptype=post_'.$post_type.'&renew=1&pid='.$page_id.'">'.RENEW_LINK.'</a>';
1532 1532
         $search_array = array('[#client_name#]', '[#listing_link#]', '[#posted_date#]', '[#number_of_days#]', '[#number_of_grace_days#]', '[#login_url#]', '[#username#]', '[#user_email#]', '[#site_name_url#]', '[#renew_link#]', '[#post_id#]', '[#site_name#]', '[#transaction_details#]');
1533 1533
         $replace_array = array($display_name, $listingLink, $post_date, $alivedays, $number_of_grace_days, $loginurl_link, $user_login, $user_email, $siteurl_link, $renew_link, $page_id, $fromEmailName, $transaction_details);
1534 1534
         $client_message = str_replace($search_array, $replace_array, $client_message);
1535 1535
         $subject = str_replace($search_array, $replace_array, $subject);
1536
-        $headers = 'MIME-Version: 1.0' . "\r\n";
1537
-        $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
1538
-        $headers .= 'From: ' . $fromEmailName . ' <' . $fromEmail . '>' . "\r\n";
1536
+        $headers = 'MIME-Version: 1.0'."\r\n";
1537
+        $headers .= 'Content-type: text/html; charset=UTF-8'."\r\n";
1538
+        $headers .= 'From: '.$fromEmailName.' <'.$fromEmail.'>'."\r\n";
1539 1539
 
1540 1540
         $to = $fromEmail;
1541 1541
         $message = $client_message;
@@ -1552,7 +1552,7 @@  discard block
 block discarded – undo
1552 1552
          * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1553 1553
          * @param string $custom_1 Custom data to be sent.
1554 1554
          */
1555
-        $to = apply_filters('geodir_adminEmail_to',$to,$page_id, $user_id, $message_type, $custom_1 );
1555
+        $to = apply_filters('geodir_adminEmail_to', $to, $page_id, $user_id, $message_type, $custom_1);
1556 1556
         /**
1557 1557
          * Filter the admin email subject.
1558 1558
          *
@@ -1564,7 +1564,7 @@  discard block
 block discarded – undo
1564 1564
          * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1565 1565
          * @param string $custom_1 Custom data to be sent.
1566 1566
          */
1567
-        $subject = apply_filters('geodir_adminEmail_subject',$subject,$page_id, $user_id, $message_type, $custom_1);
1567
+        $subject = apply_filters('geodir_adminEmail_subject', $subject, $page_id, $user_id, $message_type, $custom_1);
1568 1568
         /**
1569 1569
          * Filter the admin email message.
1570 1570
          *
@@ -1576,7 +1576,7 @@  discard block
 block discarded – undo
1576 1576
          * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1577 1577
          * @param string $custom_1 Custom data to be sent.
1578 1578
          */
1579
-        $message = apply_filters('geodir_adminEmail_message',$message,$page_id, $user_id, $message_type, $custom_1);
1579
+        $message = apply_filters('geodir_adminEmail_message', $message, $page_id, $user_id, $message_type, $custom_1);
1580 1580
         /**
1581 1581
          * Filter the admin email headers.
1582 1582
          *
@@ -1588,23 +1588,23 @@  discard block
 block discarded – undo
1588 1588
          * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1589 1589
          * @param string $custom_1 Custom data to be sent.
1590 1590
          */
1591
-        $headers = apply_filters('geodir_adminEmail_headers',$headers,$page_id, $user_id, $message_type, $custom_1);
1591
+        $headers = apply_filters('geodir_adminEmail_headers', $headers, $page_id, $user_id, $message_type, $custom_1);
1592 1592
 
1593 1593
 
1594 1594
 
1595 1595
         $sent = wp_mail($to, $subject, $message, $headers);
1596
-        if( ! $sent ) {
1597
-            if ( is_array( $to ) ) {
1598
-                $to = implode( ',', $to );
1596
+        if (!$sent) {
1597
+            if (is_array($to)) {
1598
+                $to = implode(',', $to);
1599 1599
             }
1600 1600
             $log_message = sprintf(
1601
-                __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1601
+                __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1602 1602
                 $message_type,
1603
-                date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1603
+                date_i18n('F j Y H:i:s', current_time('timestamp')),
1604 1604
                 $to,
1605 1605
                 $subject
1606 1606
             );
1607
-            geodir_error_log( $log_message );
1607
+            geodir_error_log($log_message);
1608 1608
         }
1609 1609
     }
1610 1610
 }
@@ -1630,18 +1630,18 @@  discard block
 block discarded – undo
1630 1630
     {
1631 1631
         $login_details = '';
1632 1632
         if ($message_type == 'send_friend') {
1633
-            $subject = stripslashes(__(get_option('email_friend_subject'),'geodirectory'));
1634
-            $message = stripslashes(__(get_option('email_friend_content'),'geodirectory'));
1633
+            $subject = stripslashes(__(get_option('email_friend_subject'), 'geodirectory'));
1634
+            $message = stripslashes(__(get_option('email_friend_content'), 'geodirectory'));
1635 1635
         } elseif ($message_type == 'send_enquiry') {
1636
-            $subject = __(get_option('email_enquiry_subject'),'geodirectory');
1637
-            $message = __(get_option('email_enquiry_content'),'geodirectory');
1636
+            $subject = __(get_option('email_enquiry_subject'), 'geodirectory');
1637
+            $message = __(get_option('email_enquiry_content'), 'geodirectory');
1638 1638
         } elseif ($message_type == 'forgot_password') {
1639
-            $subject = __(get_option('forgot_password_subject'),'geodirectory');
1640
-            $message = __(get_option('forgot_password_content'),'geodirectory');
1639
+            $subject = __(get_option('forgot_password_subject'), 'geodirectory');
1640
+            $message = __(get_option('forgot_password_content'), 'geodirectory');
1641 1641
             $login_details = $to_message;
1642 1642
         } elseif ($message_type == 'registration') {
1643
-            $subject = __(get_option('registration_success_email_subject'),'geodirectory');
1644
-            $message = __(get_option('registration_success_email_content'),'geodirectory');
1643
+            $subject = __(get_option('registration_success_email_subject'), 'geodirectory');
1644
+            $message = __(get_option('registration_success_email_content'), 'geodirectory');
1645 1645
             $login_details = $to_message;
1646 1646
         }
1647 1647
         $to_message = nl2br($to_message);
@@ -1649,11 +1649,11 @@  discard block
 block discarded – undo
1649 1649
         $sitefromEmailName = get_site_emailName();
1650 1650
         $productlink = get_permalink($post_id);
1651 1651
         $post_info = get_post($post_id);
1652
-        $listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
1652
+        $listingLink = '<a href="'.$productlink.'"><b>'.$post_info->post_title.'</b></a>';
1653 1653
         $siteurl = home_url();
1654
-        $siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>';
1654
+        $siteurl_link = '<a href="'.$siteurl.'">'.$siteurl.'</a>';
1655 1655
         $loginurl = geodir_login_url();
1656
-        $loginurl_link = '<a href="' . $loginurl . '">login</a>';
1656
+        $loginurl_link = '<a href="'.$loginurl.'">login</a>';
1657 1657
         if ($fromEmail == '') {
1658 1658
             $fromEmail = get_option('site_email');
1659 1659
         }
@@ -1667,26 +1667,26 @@  discard block
 block discarded – undo
1667 1667
         $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]');
1668 1668
         $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName);
1669 1669
         $subject = str_replace($search_array, $replace_array, $subject);
1670
-        $headers = 'MIME-Version: 1.0' . "\r\n";
1671
-        $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
1672
-        $headers .= "Reply-To: " . $fromEmail . "\r\n";
1673
-        $headers .= 'From: ' . $sitefromEmailName . ' <' . $sitefromEmail . '>' . "\r\n";
1670
+        $headers = 'MIME-Version: 1.0'."\r\n";
1671
+        $headers .= 'Content-type: text/html; charset=UTF-8'."\r\n";
1672
+        $headers .= "Reply-To: ".$fromEmail."\r\n";
1673
+        $headers .= 'From: '.$sitefromEmailName.' <'.$sitefromEmail.'>'."\r\n";
1674 1674
 
1675 1675
         $to = $toEmail;
1676 1676
 
1677 1677
         $sent = wp_mail($to, $subject, $message, $headers);
1678
-        if( ! $sent ) {
1679
-            if ( is_array( $to ) ) {
1680
-                $to = implode( ',', $to );
1678
+        if (!$sent) {
1679
+            if (is_array($to)) {
1680
+                $to = implode(',', $to);
1681 1681
             }
1682 1682
             $log_message = sprintf(
1683
-                __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1683
+                __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1684 1684
                 $message_type,
1685
-                date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1685
+                date_i18n('F j Y H:i:s', current_time('timestamp')),
1686 1686
                 $to,
1687 1687
                 $subject
1688 1688
             );
1689
-            geodir_error_log( $log_message );
1689
+            geodir_error_log($log_message);
1690 1690
         }
1691 1691
 
1692 1692
         ///////// ADMIN BCC EMIALS
@@ -1694,7 +1694,7 @@  discard block
 block discarded – undo
1694 1694
         if ($message_type == 'registration') {
1695 1695
             $message_raw = explode(__("Password:", 'geodirectory'), $message);
1696 1696
             $message_raw2 = explode("</p>", $message_raw[1], 2);
1697
-            $message = $message_raw[0] . __('Password:', 'geodirectory') . ' **********</p>' . $message_raw2[1];
1697
+            $message = $message_raw[0].__('Password:', 'geodirectory').' **********</p>'.$message_raw2[1];
1698 1698
         }
1699 1699
         $adminEmail = get_bloginfo('admin_email');
1700 1700
         $to = $adminEmail;
@@ -1712,20 +1712,20 @@  discard block
 block discarded – undo
1712 1712
             $admin_bcc = true;
1713 1713
         }
1714 1714
 
1715
-        if($admin_bcc === true){
1715
+        if ($admin_bcc === true) {
1716 1716
             $sent = wp_mail($to, $subject, $message, $headers);
1717
-            if( ! $sent ) {
1718
-                if ( is_array( $to ) ) {
1719
-                    $to = implode( ',', $to );
1717
+            if (!$sent) {
1718
+                if (is_array($to)) {
1719
+                    $to = implode(',', $to);
1720 1720
                 }
1721 1721
                 $log_message = sprintf(
1722
-                    __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1722
+                    __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1723 1723
                     $message_type,
1724
-                    date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1724
+                    date_i18n('F j Y H:i:s', current_time('timestamp')),
1725 1725
                     $to,
1726 1726
                     $subject
1727 1727
                 );
1728
-                geodir_error_log( $log_message );
1728
+                geodir_error_log($log_message);
1729 1729
             }
1730 1730
         }
1731 1731
 
@@ -1773,7 +1773,7 @@  discard block
 block discarded – undo
1773 1773
 function geodir_custom_posts_body_class($classes) {
1774 1774
     global $wpdb, $wp;
1775 1775
     $post_types = geodir_get_posttypes('object');
1776
-    if (!empty($post_types) && count((array)$post_types) > 1) {
1776
+    if (!empty($post_types) && count((array) $post_types) > 1) {
1777 1777
         $classes[] = 'geodir_custom_posts';
1778 1778
     }
1779 1779
 
@@ -1833,7 +1833,7 @@  discard block
 block discarded – undo
1833 1833
     $geodir_option = get_option($geodir_option_name);
1834 1834
 
1835 1835
     if (!empty($geodir_option)) {
1836
-        add_option($geodir_option_name . '_' . $version_date, $geodir_option);
1836
+        add_option($geodir_option_name.'_'.$version_date, $geodir_option);
1837 1837
     }
1838 1838
 }
1839 1839
 
@@ -1939,36 +1939,36 @@  discard block
 block discarded – undo
1939 1939
 
1940 1940
     $query_args = $gd_query_args_widgets;
1941 1941
     if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
1942
-        return $wpdb->posts . ".post_date DESC, ";
1942
+        return $wpdb->posts.".post_date DESC, ";
1943 1943
     }
1944 1944
 
1945 1945
     $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
1946
-    $table = $plugin_prefix . $post_type . '_detail';
1946
+    $table = $plugin_prefix.$post_type.'_detail';
1947 1947
 
1948 1948
     $sort_by = !empty($query_args['order_by']) ? $query_args['order_by'] : '';
1949 1949
 
1950 1950
     switch ($sort_by) {
1951 1951
         case 'latest':
1952 1952
         case 'newest':
1953
-            $orderby = $wpdb->posts . ".post_date DESC, ";
1953
+            $orderby = $wpdb->posts.".post_date DESC, ";
1954 1954
             break;
1955 1955
         case 'featured':
1956
-            $orderby = $table . ".is_featured ASC, ";
1956
+            $orderby = $table.".is_featured ASC, ";
1957 1957
             break;
1958 1958
         case 'az':
1959
-            $orderby = $wpdb->posts . ".post_title ASC, ";
1959
+            $orderby = $wpdb->posts.".post_title ASC, ";
1960 1960
             break;
1961 1961
         case 'high_review':
1962
-            $orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, ";
1962
+            $orderby = $table.".rating_count DESC, ".$table.".overall_rating DESC, ";
1963 1963
             break;
1964 1964
         case 'high_rating':
1965
-            $orderby = "( " . $table . ".overall_rating  ) DESC, ";
1965
+            $orderby = "( ".$table.".overall_rating  ) DESC, ";
1966 1966
             break;
1967 1967
         case 'random':
1968 1968
             $orderby = "RAND(), ";
1969 1969
             break;
1970 1970
         default:
1971
-            $orderby = $wpdb->posts . ".post_title ASC, ";
1971
+            $orderby = $wpdb->posts.".post_title ASC, ";
1972 1972
             break;
1973 1973
     }
1974 1974
 
@@ -1995,9 +1995,9 @@  discard block
 block discarded – undo
1995 1995
     $gd_query_args_widgets = $query_args;
1996 1996
 
1997 1997
     $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
1998
-    $table = $plugin_prefix . $post_type . '_detail';
1998
+    $table = $plugin_prefix.$post_type.'_detail';
1999 1999
 
2000
-    $fields = $wpdb->posts . ".*, " . $table . ".*";
2000
+    $fields = $wpdb->posts.".*, ".$table.".*";
2001 2001
     /**
2002 2002
      * Filter widget listing fields string part that is being used for query.
2003 2003
      *
@@ -2008,7 +2008,7 @@  discard block
 block discarded – undo
2008 2008
      */
2009 2009
     $fields = apply_filters('geodir_filter_widget_listings_fields', $fields, $table, $post_type);
2010 2010
 
2011
-    $join = "INNER JOIN " . $table . " ON (" . $table . ".post_id = " . $wpdb->posts . ".ID)";
2011
+    $join = "INNER JOIN ".$table." ON (".$table.".post_id = ".$wpdb->posts.".ID)";
2012 2012
 
2013 2013
     ########### WPML ###########
2014 2014
 
@@ -2016,7 +2016,7 @@  discard block
 block discarded – undo
2016 2016
         global $sitepress;
2017 2017
         $lang_code = ICL_LANGUAGE_CODE;
2018 2018
         if ($lang_code) {
2019
-            $join .= " JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID";
2019
+            $join .= " JOIN ".$table_prefix."icl_translations icl_t ON icl_t.element_id = ".$table_prefix."posts.ID";
2020 2020
         }
2021 2021
     }
2022 2022
 
@@ -2031,9 +2031,9 @@  discard block
 block discarded – undo
2031 2031
      */
2032 2032
     $join = apply_filters('geodir_filter_widget_listings_join', $join, $post_type);
2033 2033
 
2034
-    $post_status = is_super_admin() ? " OR " . $wpdb->posts . ".post_status = 'private'" : '';
2034
+    $post_status = is_super_admin() ? " OR ".$wpdb->posts.".post_status = 'private'" : '';
2035 2035
 
2036
-    $where = " AND ( " . $wpdb->posts . ".post_status = 'publish' " . $post_status . " ) AND " . $wpdb->posts . ".post_type = '" . $post_type . "'";
2036
+    $where = " AND ( ".$wpdb->posts.".post_status = 'publish' ".$post_status." ) AND ".$wpdb->posts.".post_type = '".$post_type."'";
2037 2037
 
2038 2038
     ########### WPML ###########
2039 2039
     if (function_exists('icl_object_id')) {
@@ -2050,7 +2050,7 @@  discard block
 block discarded – undo
2050 2050
      * @param string $post_type Post type.
2051 2051
      */
2052 2052
     $where = apply_filters('geodir_filter_widget_listings_where', $where, $post_type);
2053
-    $where = $where != '' ? " WHERE 1=1 " . $where : '';
2053
+    $where = $where != '' ? " WHERE 1=1 ".$where : '';
2054 2054
 
2055 2055
     $groupby = " GROUP BY $wpdb->posts.ID ";
2056 2056
     /**
@@ -2063,10 +2063,10 @@  discard block
 block discarded – undo
2063 2063
     $groupby = apply_filters('geodir_filter_widget_listings_groupby', $groupby, $post_type);
2064 2064
 
2065 2065
     if ($count_only) {
2066
-        $sql = "SELECT COUNT(" . $wpdb->posts . ".ID) AS total FROM " . $wpdb->posts . "
2067
-			" . $join . "
2066
+        $sql = "SELECT COUNT(".$wpdb->posts.".ID) AS total FROM ".$wpdb->posts."
2067
+			" . $join."
2068 2068
 			" . $where;
2069
-        $rows = (int)$wpdb->get_var($sql);
2069
+        $rows = (int) $wpdb->get_var($sql);
2070 2070
     } else {
2071 2071
         $orderby = geodir_widget_listings_get_order($query_args);
2072 2072
         /**
@@ -2078,8 +2078,8 @@  discard block
 block discarded – undo
2078 2078
          * @param string $post_type Post type.
2079 2079
          */
2080 2080
         $orderby = apply_filters('geodir_filter_widget_listings_orderby', $orderby, $table, $post_type);
2081
-        $orderby .= $wpdb->posts . ".post_title ASC";
2082
-        $orderby = $orderby != '' ? " ORDER BY " . $orderby : '';
2081
+        $orderby .= $wpdb->posts.".post_title ASC";
2082
+        $orderby = $orderby != '' ? " ORDER BY ".$orderby : '';
2083 2083
 
2084 2084
         $limit = !empty($query_args['posts_per_page']) ? $query_args['posts_per_page'] : 5;
2085 2085
         /**
@@ -2092,16 +2092,16 @@  discard block
 block discarded – undo
2092 2092
         $limit = apply_filters('geodir_filter_widget_listings_limit', $limit, $post_type);
2093 2093
 
2094 2094
         $page = !empty($query_args['pageno']) ? absint($query_args['pageno']) : 1;
2095
-        if ( !$page )
2095
+        if (!$page)
2096 2096
             $page = 1;
2097 2097
 
2098
-        $limit = (int)$limit > 0 ? " LIMIT " . absint( ( $page - 1 ) * (int)$limit ) . ", " . (int)$limit : "";
2098
+        $limit = (int) $limit > 0 ? " LIMIT ".absint(($page - 1) * (int) $limit).", ".(int) $limit : "";
2099 2099
 
2100
-        $sql = "SELECT SQL_CALC_FOUND_ROWS " . $fields . " FROM " . $wpdb->posts . "
2101
-			" . $join . "
2102
-			" . $where . "
2103
-			" . $groupby . "
2104
-			" . $orderby . "
2100
+        $sql = "SELECT SQL_CALC_FOUND_ROWS ".$fields." FROM ".$wpdb->posts."
2101
+			" . $join."
2102
+			" . $where."
2103
+			" . $groupby."
2104
+			" . $orderby."
2105 2105
 			" . $limit;
2106 2106
         $rows = $wpdb->get_results($sql);
2107 2107
     }
@@ -2154,10 +2154,10 @@  discard block
 block discarded – undo
2154 2154
     }
2155 2155
 
2156 2156
     $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2157
-    $table = $plugin_prefix . $post_type . '_detail';
2157
+    $table = $plugin_prefix.$post_type.'_detail';
2158 2158
 
2159 2159
     if (!empty($query_args['with_pics_only'])) {
2160
-        $join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )";
2160
+        $join .= " LEFT JOIN ".GEODIR_ATTACHMENT_TABLE." ON ( ".GEODIR_ATTACHMENT_TABLE.".post_id=".$table.".post_id AND ".GEODIR_ATTACHMENT_TABLE.".mime_type LIKE '%image%' )";
2161 2161
     }
2162 2162
 
2163 2163
     if (!empty($query_args['tax_query'])) {
@@ -2189,7 +2189,7 @@  discard block
 block discarded – undo
2189 2189
         return $where;
2190 2190
     }
2191 2191
     $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2192
-    $table = $plugin_prefix . $post_type . '_detail';
2192
+    $table = $plugin_prefix.$post_type.'_detail';
2193 2193
 
2194 2194
     if (!empty($query_args)) {
2195 2195
         if (!empty($query_args['gd_location']) && function_exists('geodir_default_location_where')) {
@@ -2197,27 +2197,27 @@  discard block
 block discarded – undo
2197 2197
         }
2198 2198
 
2199 2199
         if (!empty($query_args['post_author'])) {
2200
-            $where .= " AND " . $wpdb->posts . ".post_author = " . (int)$query_args['post_author'];
2200
+            $where .= " AND ".$wpdb->posts.".post_author = ".(int) $query_args['post_author'];
2201 2201
         }
2202 2202
         
2203 2203
         if (!empty($query_args['show_featured_only'])) {
2204
-            $where .= " AND " . $table . ".is_featured = '1'";
2204
+            $where .= " AND ".$table.".is_featured = '1'";
2205 2205
         }
2206 2206
 
2207 2207
         if (!empty($query_args['show_special_only'])) {
2208
-            $where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )";
2208
+            $where .= " AND ( ".$table.".geodir_special_offers != '' AND ".$table.".geodir_special_offers IS NOT NULL )";
2209 2209
         }
2210 2210
 
2211 2211
         if (!empty($query_args['with_pics_only'])) {
2212
-            $where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL ";
2212
+            $where .= " AND ".GEODIR_ATTACHMENT_TABLE.".ID IS NOT NULL ";
2213 2213
         }
2214 2214
 
2215 2215
         if (!empty($query_args['featured_image_only'])) {
2216
-            $where .= " AND " . $table . ".featured_image IS NOT NULL AND " . $table . ".featured_image!='' ";
2216
+            $where .= " AND ".$table.".featured_image IS NOT NULL AND ".$table.".featured_image!='' ";
2217 2217
         }
2218 2218
 
2219 2219
         if (!empty($query_args['with_videos_only'])) {
2220
-            $where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )";
2220
+            $where .= " AND ( ".$table.".geodir_video != '' AND ".$table.".geodir_video IS NOT NULL )";
2221 2221
         }
2222 2222
 
2223 2223
         if (!empty($query_args['tax_query'])) {
@@ -2274,7 +2274,7 @@  discard block
 block discarded – undo
2274 2274
     }
2275 2275
 
2276 2276
     if (!empty($query_args) && !empty($query_args['posts_per_page'])) {
2277
-        $limit = (int)$query_args['posts_per_page'];
2277
+        $limit = (int) $query_args['posts_per_page'];
2278 2278
     }
2279 2279
 
2280 2280
     return $limit;
@@ -2417,9 +2417,9 @@  discard block
 block discarded – undo
2417 2417
         add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
2418 2418
     }
2419 2419
     $home_url = str_replace("www.", "", $home_url);
2420
-    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')) ) {
2420
+    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'))) {
2421 2421
         return true;
2422
-    }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')){
2422
+    }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')) {
2423 2423
         return true;
2424 2424
     } else {
2425 2425
         return false;
@@ -2502,19 +2502,19 @@  discard block
 block discarded – undo
2502 2502
 
2503 2503
     $gd_post_type = geodir_get_current_posttype();
2504 2504
 
2505
-    $category_limit = isset($instance['category_limit']) && $instance['category_limit'] > 0 ? (int)$instance['category_limit'] : 15;
2506
-    if(!empty($gd_post_type)){
2505
+    $category_limit = isset($instance['category_limit']) && $instance['category_limit'] > 0 ? (int) $instance['category_limit'] : 15;
2506
+    if (!empty($gd_post_type)) {
2507 2507
         $default_post_type = $gd_post_type;
2508
-    }elseif(isset($instance['default_post_type']) && gdsc_is_post_type_valid($instance['default_post_type']) ){
2508
+    }elseif (isset($instance['default_post_type']) && gdsc_is_post_type_valid($instance['default_post_type'])) {
2509 2509
         $default_post_type = $instance['default_post_type'];
2510
-    }else{
2510
+    } else {
2511 2511
         $all_gd_post_type = geodir_get_posttypes();
2512 2512
         $default_post_type = (isset($all_gd_post_type[0])) ? $all_gd_post_type[0] : '';
2513 2513
     }
2514 2514
 
2515 2515
     $taxonomy = array();
2516 2516
     if (!empty($gd_post_type)) {
2517
-        $taxonomy[] = $gd_post_type . "category";
2517
+        $taxonomy[] = $gd_post_type."category";
2518 2518
     } else {
2519 2519
         $taxonomy = geodir_get_taxonomies($gd_post_type);
2520 2520
     }
@@ -2534,7 +2534,7 @@  discard block
 block discarded – undo
2534 2534
             $b_terms[$b_key] = geodir_sort_terms($b_val, 'count');
2535 2535
         }
2536 2536
 
2537
-        $default_taxonomy = $default_post_type != '' && isset($b_terms[$default_post_type . 'category']) ? $default_post_type . 'category' : '';
2537
+        $default_taxonomy = $default_post_type != '' && isset($b_terms[$default_post_type.'category']) ? $default_post_type.'category' : '';
2538 2538
 
2539 2539
         $tax_change_output = '';
2540 2540
         if (count($b_terms) > 1) {
@@ -2542,20 +2542,20 @@  discard block
 block discarded – undo
2542 2542
             foreach ($b_terms as $key => $val) {
2543 2543
                 $ptype = get_post_type_object(str_replace("category", "", $key));
2544 2544
                 $cpt_name = __($ptype->labels->singular_name, 'geodirectory');
2545
-                $tax_change_output .= "<option value='$key' ". selected($key, $default_taxonomy, false) .">" . sprintf(__('%s Categories', 'geodirectory'),$cpt_name) . "</option>";
2545
+                $tax_change_output .= "<option value='$key' ".selected($key, $default_taxonomy, false).">".sprintf(__('%s Categories', 'geodirectory'), $cpt_name)."</option>";
2546 2546
             }
2547 2547
             $tax_change_output .= "</select>";
2548 2548
         }
2549 2549
 
2550 2550
         if (!empty($b_terms)) {
2551
-            $terms = $default_taxonomy != '' && isset($b_terms[$default_taxonomy]) ? $b_terms[$default_taxonomy] : reset($b_terms);// get the first array
2552
-            global $cat_count;//make global so we can change via function
2551
+            $terms = $default_taxonomy != '' && isset($b_terms[$default_taxonomy]) ? $b_terms[$default_taxonomy] : reset($b_terms); // get the first array
2552
+            global $cat_count; //make global so we can change via function
2553 2553
             $cat_count = 0;
2554 2554
             ?>
2555 2555
             <div class="geodir-category-list-in clearfix">
2556 2556
                 <div class="geodir-cat-list clearfix">
2557 2557
                     <?php
2558
-                    echo $before_title . __($title) . $after_title;
2558
+                    echo $before_title.__($title).$after_title;
2559 2559
 
2560 2560
                     echo $tax_change_output;
2561 2561
 
@@ -2572,8 +2572,8 @@  discard block
 block discarded – undo
2572 2572
                     $hide = 'style="display:none;"';
2573 2573
                 }
2574 2574
                 echo "<div class='geodir-cat-list-more' $hide >";
2575
-                echo '<a href="javascript:void(0)" class="geodir-morecat geodir-showcat">' . __('More Categories', 'geodirectory') . '</a>';
2576
-                echo '<a href="javascript:void(0)" class="geodir-morecat geodir-hidecat geodir-hide">' . __('Less Categories', 'geodirectory') . '</a>';
2575
+                echo '<a href="javascript:void(0)" class="geodir-morecat geodir-showcat">'.__('More Categories', 'geodirectory').'</a>';
2576
+                echo '<a href="javascript:void(0)" class="geodir-morecat geodir-hidecat geodir-hide">'.__('Less Categories', 'geodirectory').'</a>';
2577 2577
                 echo "</div>";
2578 2578
                 /* add scripts */
2579 2579
                 add_action('wp_footer', 'geodir_popular_category_add_scripts', 100);
@@ -2613,7 +2613,7 @@  discard block
 block discarded – undo
2613 2613
         $class_row = $cat_count > $category_limit ? 'geodir-pcat-hide geodir-hide' : 'geodir-pcat-show';
2614 2614
         $total_post = $cat->count;
2615 2615
 
2616
-        $term_link = get_term_link( $cat, $cat->taxonomy );
2616
+        $term_link = get_term_link($cat, $cat->taxonomy);
2617 2617
         /**
2618 2618
          * Filer the category term link.
2619 2619
          *
@@ -2622,10 +2622,10 @@  discard block
 block discarded – undo
2622 2622
          * @param int    $cat->term_id The term id.
2623 2623
          * @param string $post_type Wordpress post type.
2624 2624
          */
2625
-        $term_link = apply_filters( 'geodir_category_term_link', $term_link, $cat->term_id, $post_type );
2625
+        $term_link = apply_filters('geodir_category_term_link', $term_link, $cat->term_id, $post_type);
2626 2626
 
2627
-        echo '<li class="' . $class_row . '"><a href="' . $term_link . '">';
2628
-        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> ';
2627
+        echo '<li class="'.$class_row.'"><a href="'.$term_link.'">';
2628
+        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> ';
2629 2629
         echo '</a></li>';
2630 2630
     }
2631 2631
 }
@@ -2756,29 +2756,29 @@  discard block
 block discarded – undo
2756 2756
                 itemWidth: 75,
2757 2757
                 itemMargin: 5,
2758 2758
                 asNavFor: '#geodir_widget_slider',
2759
-                rtl: <?php echo ( is_rtl() ? 'true' : 'false' ); /* fix rtl issue */ ?>
2759
+                rtl: <?php echo (is_rtl() ? 'true' : 'false'); /* fix rtl issue */ ?>
2760 2760
             });
2761 2761
 
2762 2762
             jQuery('#geodir_widget_slider').flexslider({
2763
-                animation: "<?php echo $animation;?>",
2763
+                animation: "<?php echo $animation; ?>",
2764 2764
                 selector: ".geodir-slides > li",
2765 2765
                 namespace: "geodir-",
2766 2766
                 controlNav: true,
2767
-                animationLoop: <?php echo $animationLoop;?>,
2768
-                slideshow: <?php echo $slideshow;?>,
2769
-                slideshowSpeed: <?php echo $slideshowSpeed;?>,
2770
-                animationSpeed: <?php echo $animationSpeed;?>,
2771
-                directionNav: <?php echo $directionNav;?>,
2772
-                maxItems: <?php echo $max_show;?>,
2767
+                animationLoop: <?php echo $animationLoop; ?>,
2768
+                slideshow: <?php echo $slideshow; ?>,
2769
+                slideshowSpeed: <?php echo $slideshowSpeed; ?>,
2770
+                animationSpeed: <?php echo $animationSpeed; ?>,
2771
+                directionNav: <?php echo $directionNav; ?>,
2772
+                maxItems: <?php echo $max_show; ?>,
2773 2773
                 move: 1,
2774
-                <?php if($slide_width){ echo "itemWidth: ".$slide_width.",";}?>
2774
+                <?php if ($slide_width) { echo "itemWidth: ".$slide_width.","; }?>
2775 2775
                 sync: "#geodir_widget_carousel",
2776 2776
                 start: function (slider) {
2777 2777
                     jQuery('.geodir-listing-flex-loader').hide();
2778 2778
                     jQuery('#geodir_widget_slider').css({'visibility': 'visible'});
2779 2779
                     jQuery('#geodir_widget_carousel').css({'visibility': 'visible'});
2780 2780
                 },
2781
-                rtl: <?php echo ( is_rtl() ? 'true' : 'false' ); /* fix rtl issue */ ?>
2781
+                rtl: <?php echo (is_rtl() ? 'true' : 'false'); /* fix rtl issue */ ?>
2782 2782
             });
2783 2783
         });
2784 2784
     </script>
@@ -2814,12 +2814,12 @@  discard block
 block discarded – undo
2814 2814
     $widget_listings = geodir_get_widget_listings($query_args);
2815 2815
     if (!empty($widget_listings) || (isset($with_no_results) && $with_no_results)) {
2816 2816
         if ($title) {
2817
-            echo $before_title . $title . $after_title;
2817
+            echo $before_title.$title.$after_title;
2818 2818
         }
2819 2819
 
2820 2820
         global $post;
2821 2821
 
2822
-        $current_post = $post;// keep current post info
2822
+        $current_post = $post; // keep current post info
2823 2823
 
2824 2824
         $widget_main_slides = '';
2825 2825
         $nav_slides = '';
@@ -2837,11 +2837,11 @@  discard block
 block discarded – undo
2837 2837
                     $widget_spacer_height = ((200 - $widget_image->height) / 2);
2838 2838
                 }
2839 2839
 
2840
-                $widget_main_slides .= '<li class="geodir-listing-slider-widget"><img class="geodir-listing-slider-spacer" src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:' . $widget_spacer_height . 'px !important;margin:0 auto;" width="100" />';
2840
+                $widget_main_slides .= '<li class="geodir-listing-slider-widget"><img class="geodir-listing-slider-spacer" src="'.geodir_plugin_url()."/geodirectory-assets/images/spacer.gif".'" alt="'.$widget_image->title.'" title="'.$widget_image->title.'" style="max-height:'.$widget_spacer_height.'px !important;margin:0 auto;" width="100" />';
2841 2841
 
2842 2842
                 $title = '';
2843 2843
                 if ($show_title) {
2844
-                    $title_html = '<div class="geodir-slider-title"><a href="' . get_permalink($post->ID) . '">' . get_the_title($post->ID) . '</a></div>';
2844
+                    $title_html = '<div class="geodir-slider-title"><a href="'.get_permalink($post->ID).'">'.get_the_title($post->ID).'</a></div>';
2845 2845
                     $post_id = $post->ID;
2846 2846
                     $post_permalink = get_permalink($post->ID);
2847 2847
                     $post_title = get_the_title($post->ID);
@@ -2854,11 +2854,11 @@  discard block
 block discarded – undo
2854 2854
                      * @param string $post_permalink The post permalink url.
2855 2855
                      * @param string $post_title The post title text.
2856 2856
                      */
2857
-                    $title = apply_filters('geodir_listing_slider_title',$title_html,$post_id,$post_permalink,$post_title);
2857
+                    $title = apply_filters('geodir_listing_slider_title', $title_html, $post_id, $post_permalink, $post_title);
2858 2858
                 }
2859 2859
 
2860
-                $widget_main_slides .= $title . '<img src="' . $widget_image->src . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:200px;margin:0 auto;" /></li>';
2861
-                $nav_slides .= '<li><img src="' . $widget_image->src . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
2860
+                $widget_main_slides .= $title.'<img src="'.$widget_image->src.'" alt="'.$widget_image->title.'" title="'.$widget_image->title.'" style="max-height:200px;margin:0 auto;" /></li>';
2861
+                $nav_slides .= '<li><img src="'.$widget_image->src.'" alt="'.$widget_image->title.'" title="'.$widget_image->title.'" style="max-height:48px;margin:0 auto;" /></li>';
2862 2862
                 $widget_slides++;
2863 2863
             }
2864 2864
         }
@@ -2902,7 +2902,7 @@  discard block
 block discarded – undo
2902 2902
     $title = empty($instance['title']) ? __('My Dashboard', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2903 2903
 
2904 2904
     echo $before_widget;
2905
-    echo $before_title . $title . $after_title;
2905
+    echo $before_title.$title.$after_title;
2906 2906
 
2907 2907
     if (is_user_logged_in()) {
2908 2908
         global $current_user;
@@ -2944,7 +2944,7 @@  discard block
 block discarded – undo
2944 2944
                          */
2945 2945
                         $add_link = apply_filters('geodir_dashboard_link_add_listing', $add_link, $key, $current_user->ID);
2946 2946
 
2947
-                        $addlisting_links .= '<option ' . $selected . ' value="' . $add_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>';
2947
+                        $addlisting_links .= '<option '.$selected.' value="'.$add_link.'">'.__(ucfirst($name), 'geodirectory').'</option>';
2948 2948
 
2949 2949
                     }
2950 2950
                 }
@@ -2990,7 +2990,7 @@  discard block
 block discarded – undo
2990 2990
                      */
2991 2991
                     $post_type_link = apply_filters('geodir_dashboard_link_favorite_listing', $post_type_link, $key, $current_user->ID);
2992 2992
 
2993
-                    $favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>';
2993
+                    $favourite_links .= '<option '.$selected.' value="'.$post_type_link.'">'.__(ucfirst($name), 'geodirectory').'</option>';
2994 2994
                 }
2995 2995
             }
2996 2996
 
@@ -3035,7 +3035,7 @@  discard block
 block discarded – undo
3035 3035
                      */
3036 3036
                     $listing_link = apply_filters('geodir_dashboard_link_my_listing', $listing_link, $key, $current_user->ID);
3037 3037
 
3038
-                    $listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>';
3038
+                    $listing_links .= '<option '.$selected.' value="'.$listing_link.'">'.__(ucfirst($name), 'geodirectory').'</option>';
3039 3039
                 }
3040 3040
             }
3041 3041
 
@@ -3218,7 +3218,7 @@  discard block
 block discarded – undo
3218 3218
     }
3219 3219
 
3220 3220
     if (empty($title) || $title == 'All') {
3221
-        $title .= ' ' . __(get_post_type_plural_label($post_type), 'geodirectory');
3221
+        $title .= ' '.__(get_post_type_plural_label($post_type), 'geodirectory');
3222 3222
     }
3223 3223
 
3224 3224
     $location_url = array();
@@ -3272,7 +3272,7 @@  discard block
 block discarded – undo
3272 3272
             $geodir_add_location_url = '1';
3273 3273
         }
3274 3274
 
3275
-        $viewall_url = get_term_link((int)$category[0], $post_type . 'category');
3275
+        $viewall_url = get_term_link((int) $category[0], $post_type.'category');
3276 3276
 
3277 3277
         $geodir_add_location_url = NULL;
3278 3278
     }
@@ -3280,7 +3280,7 @@  discard block
 block discarded – undo
3280 3280
         $gd_session->set('gd_multi_location', 1);
3281 3281
     }
3282 3282
 
3283
-    if(is_wp_error( $viewall_url  )){$viewall_url = '';}
3283
+    if (is_wp_error($viewall_url)) {$viewall_url = ''; }
3284 3284
 
3285 3285
     $query_args = array(
3286 3286
         'posts_per_page' => $post_number,
@@ -3346,7 +3346,7 @@  discard block
 block discarded – undo
3346 3346
              */
3347 3347
             do_action('geodir_before_view_all_link_in_widget'); ?>
3348 3348
             <div class="geodir_list_heading clearfix">
3349
-                <?php echo $before_title . $title . $after_title; ?>
3349
+                <?php echo $before_title.$title.$after_title; ?>
3350 3350
                 <a href="<?php echo $viewall_url; ?>"
3351 3351
                    class="geodir-viewall"><?php _e('View all', 'geodirectory'); ?></a>
3352 3352
             </div>
@@ -3432,9 +3432,9 @@  discard block
 block discarded – undo
3432 3432
 {
3433 3433
     global $wpdb, $plugin_prefix;
3434 3434
 
3435
-    $detail_table = $plugin_prefix . $post_type . '_detail';
3435
+    $detail_table = $plugin_prefix.$post_type.'_detail';
3436 3436
 
3437
-    $sql = "SELECT COALESCE(SUM(rating_count),0) FROM " . $detail_table . " WHERE post_status = 'publish' AND rating_count > 0 AND FIND_IN_SET(" . $term_id . ", " . $taxonomy . ")";
3437
+    $sql = "SELECT COALESCE(SUM(rating_count),0) FROM ".$detail_table." WHERE post_status = 'publish' AND rating_count > 0 AND FIND_IN_SET(".$term_id.", ".$taxonomy.")";
3438 3438
 
3439 3439
     /**
3440 3440
      * Filter count review sql query.
@@ -3473,7 +3473,7 @@  discard block
 block discarded – undo
3473 3473
      * @param bool $force_update Force update option value?. Default.false.
3474 3474
      * @param int $post_ID The post id to update if any.
3475 3475
      */
3476
-    $option_data = apply_filters('geodir_count_reviews_by_terms_before', '', $force_update,$post_ID);
3476
+    $option_data = apply_filters('geodir_count_reviews_by_terms_before', '', $force_update, $post_ID);
3477 3477
     if (!empty($option_data)) {
3478 3478
         return $option_data;
3479 3479
     }
@@ -3481,11 +3481,11 @@  discard block
 block discarded – undo
3481 3481
     $option_data = get_option('geodir_global_review_count');
3482 3482
 
3483 3483
     if (!$option_data || $force_update) {
3484
-        if ((int)$post_ID > 0) { // Update reviews count for specific post categories only.
3484
+        if ((int) $post_ID > 0) { // Update reviews count for specific post categories only.
3485 3485
             global $gd_session;
3486
-            $term_array = (array)$option_data;
3486
+            $term_array = (array) $option_data;
3487 3487
             $post_type = get_post_type($post_ID);
3488
-            $taxonomy = $post_type . 'category';
3488
+            $taxonomy = $post_type.'category';
3489 3489
             $terms = wp_get_object_terms($post_ID, $taxonomy, array('fields' => 'ids'));
3490 3490
 
3491 3491
             if (!empty($terms) && !is_wp_error($terms)) {
@@ -3500,9 +3500,9 @@  discard block
 block discarded – undo
3500 3500
             
3501 3501
             $terms = array();
3502 3502
             if (isset($_POST['post_category'][$taxonomy])) {
3503
-                $terms = (array)$_POST['post_category'][$taxonomy];
3503
+                $terms = (array) $_POST['post_category'][$taxonomy];
3504 3504
             } else if (!empty($session_listing) && isset($session_listing['post_category'][$taxonomy])) {
3505
-                $terms = (array)$session_listing['post_category'][$taxonomy];
3505
+                $terms = (array) $session_listing['post_category'][$taxonomy];
3506 3506
             }
3507 3507
             
3508 3508
             if (!empty($terms)) {
@@ -3590,7 +3590,7 @@  discard block
 block discarded – undo
3590 3590
     return true;
3591 3591
 }
3592 3592
 
3593
-function geodir_term_review_count_force_update_single_post($post_id){
3593
+function geodir_term_review_count_force_update_single_post($post_id) {
3594 3594
     geodir_count_reviews_by_terms(true, $post_id); 
3595 3595
 }
3596 3596
 
@@ -3727,17 +3727,17 @@  discard block
 block discarded – undo
3727 3727
      */
3728 3728
     $locale = apply_filters('plugin_locale', get_locale(), 'geodirectory');
3729 3729
 
3730
-    load_textdomain('geodirectory', WP_LANG_DIR . '/' . 'geodirectory' . '/' . 'geodirectory' . '-' . $locale . '.mo');
3731
-    load_plugin_textdomain('geodirectory', false, plugin_basename(dirname(dirname(__FILE__))) . '/geodirectory-languages');
3730
+    load_textdomain('geodirectory', WP_LANG_DIR.'/'.'geodirectory'.'/'.'geodirectory'.'-'.$locale.'.mo');
3731
+    load_plugin_textdomain('geodirectory', false, plugin_basename(dirname(dirname(__FILE__))).'/geodirectory-languages');
3732 3732
 
3733 3733
     /**
3734 3734
      * Define language constants.
3735 3735
      *
3736 3736
      * @since 1.0.0
3737 3737
      */
3738
-    require_once(geodir_plugin_path() . '/language.php');
3738
+    require_once(geodir_plugin_path().'/language.php');
3739 3739
 
3740
-    $language_file = geodir_plugin_path() . '/db-language.php';
3740
+    $language_file = geodir_plugin_path().'/db-language.php';
3741 3741
 
3742 3742
     // Load language string file if not created yet
3743 3743
     if (!file_exists($language_file)) {
@@ -3752,8 +3752,8 @@  discard block
 block discarded – undo
3752 3752
          */
3753 3753
         try {
3754 3754
             require_once($language_file);
3755
-        } catch(Exception $e) {
3756
-            error_log('Language Error: ' . $e->getMessage());
3755
+        } catch (Exception $e) {
3756
+            error_log('Language Error: '.$e->getMessage());
3757 3757
         }
3758 3758
     }
3759 3759
 }
@@ -3770,18 +3770,18 @@  discard block
 block discarded – undo
3770 3770
  */
3771 3771
 function geodirectory_load_db_language() {
3772 3772
     global $wp_filesystem;
3773
-    if( empty( $wp_filesystem ) ) {
3774
-        require_once( ABSPATH .'/wp-admin/includes/file.php' );
3773
+    if (empty($wp_filesystem)) {
3774
+        require_once(ABSPATH.'/wp-admin/includes/file.php');
3775 3775
         WP_Filesystem();
3776 3776
         global $wp_filesystem;
3777 3777
     }
3778 3778
 
3779
-    $language_file = geodir_plugin_path() . '/db-language.php';
3779
+    $language_file = geodir_plugin_path().'/db-language.php';
3780 3780
 
3781
-    if(is_file($language_file) && !is_writable($language_file))
3781
+    if (is_file($language_file) && !is_writable($language_file))
3782 3782
         return false; // Not possible to create.
3783 3783
 
3784
-    if(!is_file($language_file) && !is_writable(dirname($language_file)))
3784
+    if (!is_file($language_file) && !is_writable(dirname($language_file)))
3785 3785
         return false; // Not possible to create.
3786 3786
 
3787 3787
     $contents_strings = array();
@@ -3815,17 +3815,17 @@  discard block
 block discarded – undo
3815 3815
     $contents = implode(PHP_EOL, $contents_head);
3816 3816
 
3817 3817
     if (!empty($contents_strings)) {
3818
-        foreach ( $contents_strings as $string ) {
3818
+        foreach ($contents_strings as $string) {
3819 3819
             if (is_scalar($string) && $string != '') {
3820 3820
                 $string = str_replace("'", "\'", $string);
3821
-                $contents .= PHP_EOL . "__('" . $string . "', 'geodirectory');";
3821
+                $contents .= PHP_EOL."__('".$string."', 'geodirectory');";
3822 3822
             }
3823 3823
         }
3824 3824
     }
3825 3825
 
3826 3826
     $contents .= implode(PHP_EOL, $contents_foot);
3827 3827
 
3828
-    if($wp_filesystem->put_contents( $language_file, $contents, FS_CHMOD_FILE))
3828
+    if ($wp_filesystem->put_contents($language_file, $contents, FS_CHMOD_FILE))
3829 3829
         return false; // Failure; could not write file.
3830 3830
 
3831 3831
     return true;
@@ -3847,11 +3847,11 @@  discard block
 block discarded – undo
3847 3847
     global $wpdb;
3848 3848
 
3849 3849
     // Custom fields table
3850
-    $sql = "SELECT admin_title, admin_desc, site_title, clabels, required_msg, default_value, option_values FROM " . GEODIR_CUSTOM_FIELDS_TABLE;
3850
+    $sql = "SELECT admin_title, admin_desc, site_title, clabels, required_msg, default_value, option_values FROM ".GEODIR_CUSTOM_FIELDS_TABLE;
3851 3851
     $rows = $wpdb->get_results($sql);
3852 3852
 
3853 3853
     if (!empty($rows)) {
3854
-        foreach($rows as $row) {
3854
+        foreach ($rows as $row) {
3855 3855
             if (!empty($row->admin_title))
3856 3856
                 $translation_texts[] = stripslashes_deep($row->admin_title);
3857 3857
 			
@@ -3885,11 +3885,11 @@  discard block
 block discarded – undo
3885 3885
     }
3886 3886
 	
3887 3887
     // Custom sorting fields table
3888
-    $sql = "SELECT site_title, asc_title, desc_title FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE;
3888
+    $sql = "SELECT site_title, asc_title, desc_title FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE;
3889 3889
     $rows = $wpdb->get_results($sql);
3890 3890
 
3891 3891
     if (!empty($rows)) {
3892
-        foreach($rows as $row) {
3892
+        foreach ($rows as $row) {
3893 3893
             if (!empty($row->site_title))
3894 3894
                 $translation_texts[] = stripslashes_deep($row->site_title);
3895 3895
 
@@ -3903,11 +3903,11 @@  discard block
 block discarded – undo
3903 3903
 	
3904 3904
 	// Advance search filter fields table
3905 3905
 	if (defined('GEODIR_ADVANCE_SEARCH_TABLE')) {
3906
-		$sql = "SELECT field_site_name, front_search_title, field_desc FROM " . GEODIR_ADVANCE_SEARCH_TABLE;
3906
+		$sql = "SELECT field_site_name, front_search_title, field_desc FROM ".GEODIR_ADVANCE_SEARCH_TABLE;
3907 3907
 		$rows = $wpdb->get_results($sql);
3908 3908
 
3909 3909
 		if (!empty($rows)) {
3910
-			foreach($rows as $row) {
3910
+			foreach ($rows as $row) {
3911 3911
 				if (!empty($row->field_site_name))
3912 3912
 					$translation_texts[] = stripslashes_deep($row->field_site_name);
3913 3913
 
@@ -3942,7 +3942,7 @@  discard block
 block discarded – undo
3942 3942
      *
3943 3943
      * @param array $geodir_allowed_mime_types and file extensions.
3944 3944
      */
3945
-    return apply_filters( 'geodir_allowed_mime_types', array(
3945
+    return apply_filters('geodir_allowed_mime_types', array(
3946 3946
             'Image' => array( // Image formats.
3947 3947
                 'jpg' => 'image/jpeg',
3948 3948
                 'jpe' => 'image/jpeg',
@@ -4031,13 +4031,13 @@  discard block
 block discarded – undo
4031 4031
 
4032 4032
 
4033 4033
 
4034
-add_filter('wpseo_replacements','geodir_wpseo_replacements',10,1);
4034
+add_filter('wpseo_replacements', 'geodir_wpseo_replacements', 10, 1);
4035 4035
 /*
4036 4036
  * Add location variables to wpseo replacements.
4037 4037
  *
4038 4038
  * @since 1.5.4
4039 4039
  */
4040
-function geodir_wpseo_replacements($vars){
4040
+function geodir_wpseo_replacements($vars) {
4041 4041
 
4042 4042
     global $wp;
4043 4043
     $title = '';
@@ -4052,12 +4052,12 @@  discard block
 block discarded – undo
4052 4052
      * @param array $location_array The array of location variables.
4053 4053
      * @param array $vars The page title variables.
4054 4054
      */
4055
-    $location_array = apply_filters('geodir_filter_title_variables_location_arr_seo',$location_array, $vars);
4055
+    $location_array = apply_filters('geodir_filter_title_variables_location_arr_seo', $location_array, $vars);
4056 4056
     $location_titles = array();
4057
-    if(get_query_var( 'gd_country_full' )){
4058
-        if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );}
4059
-        if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );}
4060
-        if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );}
4057
+    if (get_query_var('gd_country_full')) {
4058
+        if (get_query_var('gd_country_full')) {$location_array['gd_country'] = get_query_var('gd_country_full'); }
4059
+        if (get_query_var('gd_region_full')) {$location_array['gd_region'] = get_query_var('gd_region_full'); }
4060
+        if (get_query_var('gd_city_full')) {$location_array['gd_city'] = get_query_var('gd_city_full'); }
4061 4061
     }
4062 4062
     $location_single = '';
4063 4063
     $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
@@ -4129,23 +4129,23 @@  discard block
 block discarded – undo
4129 4129
     }
4130 4130
 
4131 4131
 
4132
-    if(!empty($location_titles)) {
4132
+    if (!empty($location_titles)) {
4133 4133
         $vars['%%location%%'] = implode(", ", $location_titles);
4134 4134
     }
4135 4135
 
4136 4136
 
4137
-    if(!empty($location_titles)) {
4138
-        $vars['%%in_location%%'] = __('in ', 'geodirectory') . implode(", ", $location_titles);
4137
+    if (!empty($location_titles)) {
4138
+        $vars['%%in_location%%'] = __('in ', 'geodirectory').implode(", ", $location_titles);
4139 4139
     }
4140 4140
 
4141 4141
 
4142 4142
 
4143
-    if($location_single) {
4144
-        $vars['%%in_location_single%%'] = __('in', 'geodirectory') . ' ' .$location_single;
4143
+    if ($location_single) {
4144
+        $vars['%%in_location_single%%'] = __('in', 'geodirectory').' '.$location_single;
4145 4145
     }
4146 4146
 
4147 4147
 
4148
-    if($location_single) {
4148
+    if ($location_single) {
4149 4149
         $vars['%%location_single%%'] = $location_single;
4150 4150
     }
4151 4151
 
@@ -4157,13 +4157,13 @@  discard block
 block discarded – undo
4157 4157
      * @param string $vars The title with variables.
4158 4158
      * @param array $location_array The array of location variables.
4159 4159
      */
4160
-    return apply_filters('geodir_wpseo_replacements_vars',$vars,$location_array);
4160
+    return apply_filters('geodir_wpseo_replacements_vars', $vars, $location_array);
4161 4161
 }
4162 4162
 
4163 4163
 
4164
-add_filter('geodir_seo_meta_title','geodir_filter_title_variables',10,3);
4165
-add_filter('geodir_seo_page_title','geodir_filter_title_variables',10,2);
4166
-add_filter('geodir_seo_meta_description_pre','geodir_filter_title_variables',10,3);
4164
+add_filter('geodir_seo_meta_title', 'geodir_filter_title_variables', 10, 3);
4165
+add_filter('geodir_seo_page_title', 'geodir_filter_title_variables', 10, 2);
4166
+add_filter('geodir_seo_meta_description_pre', 'geodir_filter_title_variables', 10, 3);
4167 4167
 
4168 4168
 /**
4169 4169
  * Filter the title variables.
@@ -4222,19 +4222,19 @@  discard block
 block discarded – undo
4222 4222
         $sep = apply_filters('geodir_page_title_separator', '|');
4223 4223
     }
4224 4224
 
4225
-    if (strpos($title,'%%title%%') !== false) {
4225
+    if (strpos($title, '%%title%%') !== false) {
4226 4226
         $title = str_replace("%%title%%", $post->post_title, $title);
4227 4227
     }
4228 4228
 
4229
-    if (strpos($title,'%%sitename%%') !== false) {
4229
+    if (strpos($title, '%%sitename%%') !== false) {
4230 4230
         $title = str_replace("%%sitename%%", get_bloginfo('name'), $title);
4231 4231
     }
4232 4232
 
4233
-    if (strpos($title,'%%sitedesc%%') !== false) {
4233
+    if (strpos($title, '%%sitedesc%%') !== false) {
4234 4234
         $title = str_replace("%%sitedesc%%", get_bloginfo('description'), $title);
4235 4235
     }
4236 4236
 
4237
-    if (strpos($title,'%%excerpt%%') !== false) {
4237
+    if (strpos($title, '%%excerpt%%') !== false) {
4238 4238
         $title = str_replace("%%excerpt%%", strip_tags(get_the_excerpt()), $title);
4239 4239
     }
4240 4240
     
@@ -4242,8 +4242,8 @@  discard block
 block discarded – undo
4242 4242
         $post_type = isset($_REQUEST['stype']) ? sanitize_text_field($_REQUEST['stype']) : '';
4243 4243
     } else if ($gd_page == 'add-listing') {
4244 4244
         $post_type = (isset($_REQUEST['listing_type'])) ? sanitize_text_field($_REQUEST['listing_type']) : '';
4245
-        $post_type = !$post_type && !empty($_REQUEST['pid']) ? get_post_type((int)$_REQUEST['pid']) : $post_type;
4246
-    } else if (isset($post->post_type) && $post->post_type && in_array($post->post_type , geodir_get_posttypes())) {
4245
+        $post_type = !$post_type && !empty($_REQUEST['pid']) ? get_post_type((int) $_REQUEST['pid']) : $post_type;
4246
+    } else if (isset($post->post_type) && $post->post_type && in_array($post->post_type, geodir_get_posttypes())) {
4247 4247
         $post_type = $post->post_type;
4248 4248
     } else {
4249 4249
         $post_type = get_query_var('post_type');
@@ -4270,9 +4270,9 @@  discard block
 block discarded – undo
4270 4270
     if (strpos($title, '%%category%%') !== false) {
4271 4271
         $cat_name = '';
4272 4272
 
4273
-        if ($gd_page=='detail') {
4273
+        if ($gd_page == 'detail') {
4274 4274
             if ($post->default_category) {
4275
-                $cat = get_term($post->default_category, $post->post_type . 'category');
4275
+                $cat = get_term($post->default_category, $post->post_type.'category');
4276 4276
                 $cat_name = (isset($cat->name)) ? $cat->name : '';
4277 4277
             }
4278 4278
         } else if ($gd_page == 'listing') {
@@ -4287,12 +4287,12 @@  discard block
 block discarded – undo
4287 4287
     if (strpos($title, '%%tag%%') !== false) {
4288 4288
         $cat_name = '';
4289 4289
 
4290
-        if ($gd_page=='detail') {
4290
+        if ($gd_page == 'detail') {
4291 4291
             if ($post->default_category) {
4292
-                $cat = get_term($post->default_category, $post->post_type . 'category');
4292
+                $cat = get_term($post->default_category, $post->post_type.'category');
4293 4293
                 $cat_name = (isset($cat->name)) ? $cat->name : '';
4294 4294
             }
4295
-        } else if($gd_page == 'listing') {
4295
+        } else if ($gd_page == 'listing') {
4296 4296
             $queried_object = get_queried_object();
4297 4297
             if (isset($queried_object->name)) {
4298 4298
                 $cat_name = $queried_object->name;
@@ -4306,7 +4306,7 @@  discard block
 block discarded – undo
4306 4306
         $title = str_replace("%%id%%", $ID, $title);
4307 4307
     }
4308 4308
 
4309
-    if (strpos($title,'%%sep%%') !== false) {
4309
+    if (strpos($title, '%%sep%%') !== false) {
4310 4310
         $title = str_replace("%%sep%%", $sep, $title);
4311 4311
     }
4312 4312
 
@@ -4323,12 +4323,12 @@  discard block
 block discarded – undo
4323 4323
      * @param string $gd_page The page being filtered.
4324 4324
      * @param string $sep The separator, default: `|`.
4325 4325
      */
4326
-    $location_array = apply_filters('geodir_filter_title_variables_location_arr',$location_array,$title, $gd_page, $sep);
4326
+    $location_array = apply_filters('geodir_filter_title_variables_location_arr', $location_array, $title, $gd_page, $sep);
4327 4327
     $location_titles = array();
4328
-    if($gd_page=='location' && get_query_var( 'gd_country_full' )){
4329
-        if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );}
4330
-        if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );}
4331
-        if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );}
4328
+    if ($gd_page == 'location' && get_query_var('gd_country_full')) {
4329
+        if (get_query_var('gd_country_full')) {$location_array['gd_country'] = get_query_var('gd_country_full'); }
4330
+        if (get_query_var('gd_region_full')) {$location_array['gd_region'] = get_query_var('gd_region_full'); }
4331
+        if (get_query_var('gd_city_full')) {$location_array['gd_city'] = get_query_var('gd_city_full'); }
4332 4332
     }
4333 4333
     $location_single = '';
4334 4334
     $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
@@ -4400,51 +4400,51 @@  discard block
 block discarded – undo
4400 4400
     }
4401 4401
 
4402 4402
 
4403
-    if(strpos($title,'%%location%%') !== false){
4403
+    if (strpos($title, '%%location%%') !== false) {
4404 4404
         $location = '';
4405
-        if($location_titles) {
4405
+        if ($location_titles) {
4406 4406
             $location = implode(", ", $location_titles);
4407 4407
         }
4408
-        $title = str_replace("%%location%%",$location,$title);
4408
+        $title = str_replace("%%location%%", $location, $title);
4409 4409
     }
4410 4410
 
4411
-    if(strpos($title,'%%in_location%%') !== false){
4411
+    if (strpos($title, '%%in_location%%') !== false) {
4412 4412
         $location = '';
4413
-        if($location_titles) {
4414
-            $location = __('in ', 'geodirectory') . implode(", ", $location_titles);
4413
+        if ($location_titles) {
4414
+            $location = __('in ', 'geodirectory').implode(", ", $location_titles);
4415 4415
         }
4416
-        $title = str_replace("%%in_location%%",$location,$title);
4416
+        $title = str_replace("%%in_location%%", $location, $title);
4417 4417
     }
4418 4418
 
4419
-    if(strpos($title,'%%in_location_single%%') !== false){
4420
-        if($location_single) {
4421
-            $location_single = __('in', 'geodirectory') . ' ' .$location_single;
4419
+    if (strpos($title, '%%in_location_single%%') !== false) {
4420
+        if ($location_single) {
4421
+            $location_single = __('in', 'geodirectory').' '.$location_single;
4422 4422
         }
4423
-        $title = str_replace("%%in_location_single%%",$location_single,$title);
4423
+        $title = str_replace("%%in_location_single%%", $location_single, $title);
4424 4424
     }
4425 4425
 
4426
-    if(strpos($title,'%%location_single%%') !== false){
4427
-        $title = str_replace("%%location_single%%",$location_single,$title);
4426
+    if (strpos($title, '%%location_single%%') !== false) {
4427
+        $title = str_replace("%%location_single%%", $location_single, $title);
4428 4428
     }
4429 4429
 
4430 4430
 
4431
-    if(strpos($title,'%%search_term%%') !== false){
4431
+    if (strpos($title, '%%search_term%%') !== false) {
4432 4432
         $search_term = '';
4433
-        if(isset($_REQUEST['s'])){
4433
+        if (isset($_REQUEST['s'])) {
4434 4434
             $search_term = esc_attr($_REQUEST['s']);
4435 4435
         }
4436
-        $title = str_replace("%%search_term%%",$search_term,$title);
4436
+        $title = str_replace("%%search_term%%", $search_term, $title);
4437 4437
     }
4438 4438
 
4439
-    if(strpos($title,'%%search_near%%') !== false){
4439
+    if (strpos($title, '%%search_near%%') !== false) {
4440 4440
         $search_term = '';
4441
-        if(isset($_REQUEST['snear'])){
4441
+        if (isset($_REQUEST['snear'])) {
4442 4442
             $search_term = esc_attr($_REQUEST['snear']);
4443 4443
         }
4444
-        $title = str_replace("%%search_near%%",$search_term,$title);
4444
+        $title = str_replace("%%search_near%%", $search_term, $title);
4445 4445
     }
4446 4446
 
4447
-    if(strpos($title,'%%name%%') !== false){
4447
+    if (strpos($title, '%%name%%') !== false) {
4448 4448
         if (is_author()) {
4449 4449
             $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
4450 4450
             $author_name = $curauth->display_name;
@@ -4474,9 +4474,9 @@  discard block
 block discarded – undo
4474 4474
         $title = str_replace("%%pagetotal%%", $pagetotal, $title);
4475 4475
     }
4476 4476
 
4477
-    $title = wptexturize( $title );
4478
-    $title = convert_chars( $title );
4479
-    $title = esc_html( $title );
4477
+    $title = wptexturize($title);
4478
+    $title = convert_chars($title);
4479
+    $title = esc_html($title);
4480 4480
 
4481 4481
     /**
4482 4482
      * Filter the title variables after standard ones have been filtered.
@@ -4489,7 +4489,7 @@  discard block
 block discarded – undo
4489 4489
      * @param string $sep The separator, default: `|`.
4490 4490
      */
4491 4491
 
4492
-    return apply_filters('geodir_filter_title_variables_vars',$title,$location_array, $gd_page, $sep);
4492
+    return apply_filters('geodir_filter_title_variables_vars', $title, $location_array, $gd_page, $sep);
4493 4493
 }
4494 4494
 
4495 4495
 /**
@@ -4612,7 +4612,7 @@  discard block
 block discarded – undo
4612 4612
     }
4613 4613
     
4614 4614
     $action = isset($_REQUEST['action']) ? sanitize_text_field($_REQUEST['action']) : '';
4615
-    $is_admin = is_admin() && ( !defined('DOING_AJAX' ) || ( defined('DOING_AJAX') && !DOING_AJAX ) )  ? true : false;
4615
+    $is_admin = is_admin() && (!defined('DOING_AJAX') || (defined('DOING_AJAX') && !DOING_AJAX)) ? true : false;
4616 4616
     $inline_save = $action == 'inline-save' ? true : false;
4617 4617
 
4618 4618
     if (empty($post->post_type) || $is_admin || $inline_save || (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)) {
@@ -4623,7 +4623,7 @@  discard block
 block discarded – undo
4623 4623
         return;
4624 4624
     }
4625 4625
 
4626
-    $user_id = (int)get_current_user_id();
4626
+    $user_id = (int) get_current_user_id();
4627 4627
         
4628 4628
     if ($user_id > 0 && get_option('geodir_notify_post_edited') && !wp_is_post_revision($post_ID) && in_array($post->post_type, geodir_get_posttypes())) {
4629 4629
         $author_id = !empty($post->post_author) ? $post->post_author : 0;
@@ -4667,7 +4667,7 @@  discard block
 block discarded – undo
4667 4667
     $nr  = geodir_title_meta_pagenumbering('nr');
4668 4668
 
4669 4669
     if ($max > 1 && $nr > 1) {
4670
-        $replacement = sprintf($sep . ' ' . __('Page %1$d of %2$d', 'geodirectory'), $nr, $max);
4670
+        $replacement = sprintf($sep.' '.__('Page %1$d of %2$d', 'geodirectory'), $nr, $max);
4671 4671
     }
4672 4672
 
4673 4673
     return $replacement;
@@ -4686,7 +4686,7 @@  discard block
 block discarded – undo
4686 4686
 
4687 4687
     $nr = geodir_title_meta_pagenumbering('nr');
4688 4688
     if (isset($nr) && $nr > 0) {
4689
-        $replacement = (string)$nr;
4689
+        $replacement = (string) $nr;
4690 4690
     }
4691 4691
 
4692 4692
     return $replacement;
@@ -4705,7 +4705,7 @@  discard block
 block discarded – undo
4705 4705
 
4706 4706
     $max = geodir_title_meta_pagenumbering('max');
4707 4707
     if (isset($max) && $max > 0) {
4708
-        $replacement = (string)$max;
4708
+        $replacement = (string) $max;
4709 4709
     }
4710 4710
 
4711 4711
     return $replacement;
@@ -4747,7 +4747,7 @@  discard block
 block discarded – undo
4747 4747
         }
4748 4748
 
4749 4749
         if (isset($post->post_content)) {
4750
-            $max_num_pages = (substr_count($post->post_content, '<!--nextpage-->' ) + 1);
4750
+            $max_num_pages = (substr_count($post->post_content, '<!--nextpage-->') + 1);
4751 4751
         }
4752 4752
     }
4753 4753
 
@@ -4782,7 +4782,7 @@  discard block
 block discarded – undo
4782 4782
     foreach ($terms as $term) {
4783 4783
         if (isset($term->count) && $term->count > 0) {
4784 4784
             $return[] = $term;
4785
-        }else{
4785
+        } else {
4786 4786
             /**
4787 4787
              * Allow to filter terms with no count.
4788 4788
              *
@@ -4790,7 +4790,7 @@  discard block
 block discarded – undo
4790 4790
              * @param array $return The array or terms to return.
4791 4791
              * @param object $term The term object.
4792 4792
              */
4793
-            $return =  apply_filters( 'geodir_filter_empty_terms_filter',$return, $term);
4793
+            $return = apply_filters('geodir_filter_empty_terms_filter', $return, $term);
4794 4794
         }
4795 4795
     }
4796 4796
     return $return;
@@ -4805,10 +4805,10 @@  discard block
 block discarded – undo
4805 4805
  *
4806 4806
  * @return array
4807 4807
  */
4808
-function geodir_remove_hentry( $class ) {
4809
-    if(geodir_is_page('detail')){
4810
-        $class = array_diff( $class, array( 'hentry' ) );
4808
+function geodir_remove_hentry($class) {
4809
+    if (geodir_is_page('detail')) {
4810
+        $class = array_diff($class, array('hentry'));
4811 4811
     }
4812 4812
     return $class;
4813 4813
 }
4814
-add_filter( 'post_class', 'geodir_remove_hentry' );
4815 4814
\ No newline at end of file
4815
+add_filter('post_class', 'geodir_remove_hentry');
4816 4816
\ No newline at end of file
Please login to merge, or discard this patch.