Test Failed
Pull Request — master (#439)
by Kiran
19:28
created
geodirectory-functions/custom_taxonomy_hooks_actions.php 1 patch
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 
69 69
             if (!empty($args['labels'])) {
70 70
                 foreach ($args['labels'] as $key => $val) {
71
-                    $args['labels'][$key] = __($val, 'geodirectory');// allow translation
71
+                    $args['labels'][$key] = __($val, 'geodirectory'); // allow translation
72 72
                 }
73 73
             }
74 74
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 
110 110
             if (array_key_exists('rewrite', $args)) {
111 111
                 if (array_key_exists('slug', $args['rewrite']))
112
-                    $args['rewrite']['slug'] = $listing_slug;// . '/%gd_taxonomy%';
112
+                    $args['rewrite']['slug'] = $listing_slug; // . '/%gd_taxonomy%';
113 113
             }
114 114
 
115 115
             $geodir_post_types = get_option('geodir_post_types');
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 
122 122
                 if (array_key_exists('rewrite', $geodir_post_types[$post_type]))
123 123
                     if (array_key_exists('slug', $geodir_post_types[$post_type]['rewrite']))
124
-                        $geodir_post_types[$post_type]['rewrite']['slug'] = $listing_slug;// . '/%gd_taxonomy%';
124
+                        $geodir_post_types[$post_type]['rewrite']['slug'] = $listing_slug; // . '/%gd_taxonomy%';
125 125
 
126 126
                 update_option('geodir_post_types', $geodir_post_types);
127 127
 
@@ -133,13 +133,13 @@  discard block
 block discarded – undo
133 133
 
134 134
             $geodir_taxonomies = get_option('geodir_taxonomies');
135 135
 
136
-            if (array_key_exists('listing_slug', $geodir_taxonomies[$post_type . 'category'])) {
137
-                $geodir_taxonomies[$post_type . 'category']['listing_slug'] = $listing_slug;
136
+            if (array_key_exists('listing_slug', $geodir_taxonomies[$post_type.'category'])) {
137
+                $geodir_taxonomies[$post_type.'category']['listing_slug'] = $listing_slug;
138 138
 
139
-                if (array_key_exists('args', $geodir_taxonomies[$post_type . 'category']))
140
-                    if (array_key_exists('rewrite', $geodir_taxonomies[$post_type . 'category']['args']))
141
-                        if (array_key_exists('slug', $geodir_taxonomies[$post_type . 'category']['args']['rewrite']))
142
-                            $geodir_taxonomies[$post_type . 'category']['args']['rewrite']['slug'] = $listing_slug;
139
+                if (array_key_exists('args', $geodir_taxonomies[$post_type.'category']))
140
+                    if (array_key_exists('rewrite', $geodir_taxonomies[$post_type.'category']['args']))
141
+                        if (array_key_exists('slug', $geodir_taxonomies[$post_type.'category']['args']['rewrite']))
142
+                            $geodir_taxonomies[$post_type.'category']['args']['rewrite']['slug'] = $listing_slug;
143 143
 
144 144
                 update_option('geodir_taxonomies', $geodir_taxonomies);
145 145
 
@@ -147,13 +147,13 @@  discard block
 block discarded – undo
147 147
 
148 148
             /* --- update taxonomies (tags) --- */
149 149
             $geodir_taxonomies_tag = get_option('geodir_taxonomies');
150
-            if (array_key_exists('listing_slug', $geodir_taxonomies_tag[$post_type . '_tags'])) {
151
-                $geodir_taxonomies_tag[$post_type . '_tags']['listing_slug'] = $listing_slug . '/tags';
150
+            if (array_key_exists('listing_slug', $geodir_taxonomies_tag[$post_type.'_tags'])) {
151
+                $geodir_taxonomies_tag[$post_type.'_tags']['listing_slug'] = $listing_slug.'/tags';
152 152
 
153
-                if (array_key_exists('args', $geodir_taxonomies_tag[$post_type . '_tags']))
154
-                    if (array_key_exists('rewrite', $geodir_taxonomies_tag[$post_type . '_tags']['args']))
155
-                        if (array_key_exists('slug', $geodir_taxonomies_tag[$post_type . '_tags']['args']['rewrite']))
156
-                            $geodir_taxonomies_tag[$post_type . '_tags']['args']['rewrite']['slug'] = $listing_slug . '/tags';
153
+                if (array_key_exists('args', $geodir_taxonomies_tag[$post_type.'_tags']))
154
+                    if (array_key_exists('rewrite', $geodir_taxonomies_tag[$post_type.'_tags']['args']))
155
+                        if (array_key_exists('slug', $geodir_taxonomies_tag[$post_type.'_tags']['args']['rewrite']))
156
+                            $geodir_taxonomies_tag[$post_type.'_tags']['args']['rewrite']['slug'] = $listing_slug.'/tags';
157 157
 
158 158
                 update_option('geodir_taxonomies', $geodir_taxonomies_tag);
159 159
 
@@ -203,11 +203,11 @@  discard block
 block discarded – undo
203 203
             $listing_slug = $args['listing_slug'];
204 204
 
205 205
             if (strpos($taxonomy, 'tags')) {
206
-                $newrules[$listing_slug . '/(.+?)/page/?([0-9]{1,})/?$'] = 'index.php?' . $taxonomy . '=$matches[1]&paged=$matches[2]';
207
-                $newrules[$listing_slug . '/(.+?)/?$'] = 'index.php?' . $taxonomy . '=$matches[1]';
206
+                $newrules[$listing_slug.'/(.+?)/page/?([0-9]{1,})/?$'] = 'index.php?'.$taxonomy.'=$matches[1]&paged=$matches[2]';
207
+                $newrules[$listing_slug.'/(.+?)/?$'] = 'index.php?'.$taxonomy.'=$matches[1]';
208 208
             } else {
209 209
                 // use this loop to add paging for details page comments paging
210
-                $newrules[str_replace("/tags","",$listing_slug) . '/(.+?)/comment-page-([0-9]{1,})/?$'] = 'index.php?' . $taxonomy . '=$matches[1]&cpage=$matches[2]';
210
+                $newrules[str_replace("/tags", "", $listing_slug).'/(.+?)/comment-page-([0-9]{1,})/?$'] = 'index.php?'.$taxonomy.'=$matches[1]&cpage=$matches[2]';
211 211
             }
212 212
         endforeach;
213 213
     endif;
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
     // create rules for location listing
216 216
     $location_page = get_option('geodir_location_page');
217 217
 	
218
-    if($location_page) {
218
+    if ($location_page) {
219 219
         global $wpdb;
220 220
         $location_prefix = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_type='page' AND ID=%d", $location_page));
221 221
     }
@@ -245,30 +245,30 @@  discard block
 block discarded – undo
245 245
 		
246 246
 		if ($matches2) {
247 247
 			if ($neighbourhood_active) {
248
-				$newrules[$location_prefix . '/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&' . $matches1 . '=$matches[1]&' . $matches2 . '=$matches[2]&gd_neighbourhood=$matches[3]';
248
+				$newrules[$location_prefix.'/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id='.$location_page.'&'.$matches1.'=$matches[1]&'.$matches2.'=$matches[2]&gd_neighbourhood=$matches[3]';
249 249
 			}
250
-			$newrules[$location_prefix . '/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&' . $matches1 . '=$matches[1]&' . $matches2 . '=$matches[2]';
250
+			$newrules[$location_prefix.'/([^/]+)/([^/]+)/?$'] = 'index.php?page_id='.$location_page.'&'.$matches1.'=$matches[1]&'.$matches2.'=$matches[2]';
251 251
 		} else {
252 252
 			if ($neighbourhood_active) {
253
-				$newrules[$location_prefix . '/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&' . $matches1 . '=$matches[1]&gd_neighbourhood=$matches[2]';
253
+				$newrules[$location_prefix.'/([^/]+)/([^/]+)/?$'] = 'index.php?page_id='.$location_page.'&'.$matches1.'=$matches[1]&gd_neighbourhood=$matches[2]';
254 254
 			}
255 255
 		}
256 256
 		
257
-		$newrules[$location_prefix . '/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&' . $matches1 . '=$matches[1]';
257
+		$newrules[$location_prefix.'/([^/]+)/?$'] = 'index.php?page_id='.$location_page.'&'.$matches1.'=$matches[1]';
258 258
 	} else { // country/region/city
259 259
 		if ($neighbourhood_active) {
260
-			$newrules[$location_prefix . '/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&gd_country=$matches[1]&gd_region=$matches[2]&gd_city=$matches[3]&gd_neighbourhood=$matches[4]';
260
+			$newrules[$location_prefix.'/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id='.$location_page.'&gd_country=$matches[1]&gd_region=$matches[2]&gd_city=$matches[3]&gd_neighbourhood=$matches[4]';
261 261
 		}
262
-		$newrules[$location_prefix . '/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&gd_country=$matches[1]&gd_region=$matches[2]&gd_city=$matches[3]';
263
-		$newrules[$location_prefix . '/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&gd_country=$matches[1]&gd_region=$matches[2]';
264
-		$newrules[$location_prefix . '/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&gd_country=$matches[1]';
262
+		$newrules[$location_prefix.'/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id='.$location_page.'&gd_country=$matches[1]&gd_region=$matches[2]&gd_city=$matches[3]';
263
+		$newrules[$location_prefix.'/([^/]+)/([^/]+)/?$'] = 'index.php?page_id='.$location_page.'&gd_country=$matches[1]&gd_region=$matches[2]';
264
+		$newrules[$location_prefix.'/([^/]+)/?$'] = 'index.php?page_id='.$location_page.'&gd_country=$matches[1]';
265 265
 	}
266 266
 
267 267
     if ($location_page && geodir_is_wpml()) {
268
-        foreach(icl_get_languages('skip_missing=N') as $lang){
268
+        foreach (icl_get_languages('skip_missing=N') as $lang) {
269 269
             $alt_page_id = '';
270
-            $alt_page_id = geodir_wpml_object_id($location_page, 'page', false,$lang['language_code']);
271
-            if($alt_page_id){
270
+            $alt_page_id = geodir_wpml_object_id($location_page, 'page', false, $lang['language_code']);
271
+            if ($alt_page_id) {
272 272
                 $location_prefix = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_type='page' AND ID=%d", $alt_page_id));
273 273
 
274 274
 				if ($location_manager && ($hide_country_part || $hide_region_part)) {
@@ -287,29 +287,29 @@  discard block
 block discarded – undo
287 287
 					
288 288
 					if ($matches2) {
289 289
 						if ($neighbourhood_active) {
290
-							$newrules[$location_prefix . '/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&' . $matches1 . '=$matches[1]&' . $matches2 . '=$matches[2]&gd_neighbourhood=$matches[3]';
290
+							$newrules[$location_prefix.'/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id='.$alt_page_id.'&'.$matches1.'=$matches[1]&'.$matches2.'=$matches[2]&gd_neighbourhood=$matches[3]';
291 291
 						}
292
-						$newrules[$location_prefix . '/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&' . $matches1 . '=$matches[1]&' . $matches2 . '=$matches[2]';
292
+						$newrules[$location_prefix.'/([^/]+)/([^/]+)/?$'] = 'index.php?page_id='.$alt_page_id.'&'.$matches1.'=$matches[1]&'.$matches2.'=$matches[2]';
293 293
 					} else {
294 294
 						if ($neighbourhood_active) {
295
-							$newrules[$location_prefix . '/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&' . $matches1 . '=$matches[1]&gd_neighbourhood=$matches[2]';
295
+							$newrules[$location_prefix.'/([^/]+)/([^/]+)/?$'] = 'index.php?page_id='.$alt_page_id.'&'.$matches1.'=$matches[1]&gd_neighbourhood=$matches[2]';
296 296
 						}
297 297
 					}
298 298
 					
299
-					$newrules[$location_prefix . '/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&' . $matches1 . '=$matches[1]';
299
+					$newrules[$location_prefix.'/([^/]+)/?$'] = 'index.php?page_id='.$alt_page_id.'&'.$matches1.'=$matches[1]';
300 300
 				} else { // country/region/city
301 301
 					if ($neighbourhood_active) {
302
-						$newrules[$location_prefix . '/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&gd_country=$matches[1]&gd_region=$matches[2]&gd_city=$matches[3]&gd_neighbourhood=$matches[4]';
302
+						$newrules[$location_prefix.'/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id='.$alt_page_id.'&gd_country=$matches[1]&gd_region=$matches[2]&gd_city=$matches[3]&gd_neighbourhood=$matches[4]';
303 303
 					}
304
-					$newrules[$location_prefix . '/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&gd_country=$matches[1]&gd_region=$matches[2]&gd_city=$matches[3]';
305
-					$newrules[$location_prefix . '/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&gd_country=$matches[1]&gd_region=$matches[2]';
306
-					$newrules[$location_prefix . '/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&gd_country=$matches[1]';
304
+					$newrules[$location_prefix.'/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id='.$alt_page_id.'&gd_country=$matches[1]&gd_region=$matches[2]&gd_city=$matches[3]';
305
+					$newrules[$location_prefix.'/([^/]+)/([^/]+)/?$'] = 'index.php?page_id='.$alt_page_id.'&gd_country=$matches[1]&gd_region=$matches[2]';
306
+					$newrules[$location_prefix.'/([^/]+)/?$'] = 'index.php?page_id='.$alt_page_id.'&gd_country=$matches[1]';
307 307
 				}
308 308
             }
309 309
         }
310 310
     }
311 311
 
312
-    $newrules[$location_prefix . '/?$'] = 'index.php?page_id=' . $location_page;
312
+    $newrules[$location_prefix.'/?$'] = 'index.php?page_id='.$location_page;
313 313
 
314 314
     $rules = array_merge($newrules, $rules);
315 315
     return $rules;
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 #Redirect 301 /location/ /$location_prefix/
339 339
 # END GeoDirectory Rules\n\n
340 340
 EOD;
341
-    return $my_content . $rules;
341
+    return $my_content.$rules;
342 342
 }
343 343
 //add_filter('mod_rewrite_rules', 'geodir_htaccess_contents');
344 344
 
@@ -414,12 +414,12 @@  discard block
 block discarded – undo
414 414
         global $wpdb;
415 415
 
416 416
         $page_for_posts = get_option('page_for_posts');
417
-        $real_page_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_name=%s",$wp->query_vars['pagename']));
417
+        $real_page_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_name=%s", $wp->query_vars['pagename']));
418 418
 
419 419
         if (geodir_is_wpml()) {
420 420
             $real_page_id = geodir_wpml_object_id($real_page_id, 'page', true, ICL_LANGUAGE_CODE);
421 421
         }
422
-        if ($real_page_id && $real_page_id!=$page_for_posts) {
422
+        if ($real_page_id && $real_page_id != $page_for_posts) {
423 423
             $wp->query_vars['page_id'] = $real_page_id;
424 424
         }
425 425
     }
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
                             $gd_city = $default_location->city_slug;
467 467
 
468 468
                         $base_location_link = geodir_get_location_link('base');
469
-                        wp_redirect($base_location_link . '/' . $gd_country . '/' . $gd_region . '/' . $gd_city);
469
+                        wp_redirect($base_location_link.'/'.$gd_country.'/'.$gd_region.'/'.$gd_city);
470 470
                         exit();
471 471
                     }
472 472
                 }
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
         $geodir_set_location_session = true;
528 528
         $geodir_taxonomis = geodir_get_taxonomies('', true);
529 529
 
530
-        if(!empty($geodir_taxonomis)){
530
+        if (!empty($geodir_taxonomis)) {
531 531
             foreach ($geodir_taxonomis as $taxonomy) {
532 532
                 if (array_key_exists($taxonomy, $wp->query_vars)) {
533 533
                     $is_geodir_taxonomy = true;
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
 				}
585 585
 
586 586
 
587
-				$geodir_term = str_replace('/' . $geodir_last_term, '', $geodir_term, $post_title_replace_count);
587
+				$geodir_term = str_replace('/'.$geodir_last_term, '', $geodir_term, $post_title_replace_count);
588 588
 				if (!$post_title_replace_count)
589 589
 					$geodir_term = str_replace($geodir_last_term, '', $geodir_term, $post_title_replace_count);
590 590
 				$geodir_terms = explode('/', $geodir_term);
@@ -661,7 +661,7 @@  discard block
 block discarded – undo
661 661
 						if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country))
662 662
                             $is_geodir_location_found = true;
663 663
                     }
664
-                }  else if ($geodir_show_location_url == 'region_city') {
664
+                } else if ($geodir_show_location_url == 'region_city') {
665 665
                     if (count($geodir_terms) >= 2) {
666 666
                         $gd_region = urldecode($geodir_terms[0]);
667 667
                         $gd_city = urldecode($geodir_terms[1]);
@@ -720,13 +720,13 @@  discard block
 block discarded – undo
720 720
             $wp->query_vars[$geodir_taxonomy] = $geodir_term;
721 721
             // eliminate location related terms from taxonomy term
722 722
             if ($gd_country != '')
723
-                $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_country) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
723
+                $wp->query_vars[$geodir_taxonomy] = preg_replace('/'.urlencode($gd_country).'/', '', $wp->query_vars[$geodir_taxonomy], 1);
724 724
 
725 725
             if ($gd_region != '')
726
-                $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_region) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
726
+                $wp->query_vars[$geodir_taxonomy] = preg_replace('/'.urlencode($gd_region).'/', '', $wp->query_vars[$geodir_taxonomy], 1);
727 727
 
728 728
             if ($gd_city != '')
729
-                $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_city) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
729
+                $wp->query_vars[$geodir_taxonomy] = preg_replace('/'.urlencode($gd_city).'/', '', $wp->query_vars[$geodir_taxonomy], 1);
730 730
 
731 731
 
732 732
             $wp->query_vars[$geodir_taxonomy] = str_replace('///', '', $wp->query_vars[$geodir_taxonomy]);
@@ -911,16 +911,16 @@  discard block
 block discarded – undo
911 911
  * @param string $option Option name.
912 912
  * @return mixed The taxonomy option value.
913 913
  */
914
-function geodir_wpseo_taxonomy_meta( $value, $option = '' ) {
914
+function geodir_wpseo_taxonomy_meta($value, $option = '') {
915 915
     global $wp_query;
916 916
     
917
-    if ( !empty( $value ) && ( is_category() || is_tax() ) ) {
917
+    if (!empty($value) && (is_category() || is_tax())) {
918 918
         $term = $wp_query->get_queried_object();
919 919
         
920
-        if ( !empty( $term->term_id ) && !empty( $term->taxonomy ) && isset( $value[$term->taxonomy][$term->term_id] ) && in_array( str_replace( 'category', '', $term->taxonomy ), geodir_get_posttypes() ) ) {
921
-            $image  = geodir_get_default_catimage( $term->term_id, str_replace( 'category', '', $term->taxonomy ) );
920
+        if (!empty($term->term_id) && !empty($term->taxonomy) && isset($value[$term->taxonomy][$term->term_id]) && in_array(str_replace('category', '', $term->taxonomy), geodir_get_posttypes())) {
921
+            $image = geodir_get_default_catimage($term->term_id, str_replace('category', '', $term->taxonomy));
922 922
             
923
-            if ( !empty( $image['src'] ) ) {
923
+            if (!empty($image['src'])) {
924 924
                 $value[$term->taxonomy][$term->term_id]['wpseo_twitter-image'] = $image['src'];
925 925
                 $value[$term->taxonomy][$term->term_id]['wpseo_opengraph-image'] = $image['src'];
926 926
             }
@@ -928,7 +928,7 @@  discard block
 block discarded – undo
928 928
     }
929 929
     return $value;
930 930
 }
931
-add_filter( 'option_wpseo_taxonomy_meta', 'geodir_wpseo_taxonomy_meta', 10, 2 );
931
+add_filter('option_wpseo_taxonomy_meta', 'geodir_wpseo_taxonomy_meta', 10, 2);
932 932
 
933 933
 /**
934 934
  * Fix affiliate links for GeoDirectory CPTs listing pages.
@@ -937,24 +937,24 @@  discard block
 block discarded – undo
937 937
  *
938 938
  */
939 939
 function geodir_affiliate_wp_rewrite_fix() {
940
-    if ( !class_exists( 'Affiliate_WP' ) ) {
940
+    if (!class_exists('Affiliate_WP')) {
941 941
         return;
942 942
     }
943 943
 
944
-    $gd_post_types = geodir_get_posttypes( 'array' );
944
+    $gd_post_types = geodir_get_posttypes('array');
945 945
 
946
-    if ( !empty( $gd_post_types ) ) {
946
+    if (!empty($gd_post_types)) {
947 947
         $ref = affiliate_wp()->tracking->get_referral_var();
948
-        if ( empty( $ref ) ) {
948
+        if (empty($ref)) {
949 949
             return;
950 950
         }
951 951
 
952
-        foreach ( $gd_post_types as $key => $post_type ) {
953
-            if ( !empty( $key ) && !empty( $post_type['rewrite']['slug'] ) ) {
954
-                add_rewrite_rule( $post_type['rewrite']['slug'] . '/' . $ref . '(/(.*))?/page/([0-9]{1,})/?$', 'index.php?post_type=' . $key . '&' . $ref . '=$matches[1]&paged=$matches[3]', 'top');
955
-                add_rewrite_rule( $post_type['rewrite']['slug'] . '/' . $ref . '(/(.*))?/?$', 'index.php?post_type=' . $key . '&' . $ref . '=$matches[1]', 'top');
952
+        foreach ($gd_post_types as $key => $post_type) {
953
+            if (!empty($key) && !empty($post_type['rewrite']['slug'])) {
954
+                add_rewrite_rule($post_type['rewrite']['slug'].'/'.$ref.'(/(.*))?/page/([0-9]{1,})/?$', 'index.php?post_type='.$key.'&'.$ref.'=$matches[1]&paged=$matches[3]', 'top');
955
+                add_rewrite_rule($post_type['rewrite']['slug'].'/'.$ref.'(/(.*))?/?$', 'index.php?post_type='.$key.'&'.$ref.'=$matches[1]', 'top');
956 956
             }
957 957
         }
958 958
     }
959 959
 }
960
-add_action( 'init', 'geodir_affiliate_wp_rewrite_fix', 99999 );
960
+add_action('init', 'geodir_affiliate_wp_rewrite_fix', 99999);
Please login to merge, or discard this patch.
geodirectory-functions/signup_function.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
         if ($redirect) {
23 23
             ?>
24 24
             <script type="text/javascript">
25
-                window.location.href = '<?php echo geodir_login_url();?>';
25
+                window.location.href = '<?php echo geodir_login_url(); ?>';
26 26
             </script>
27 27
         <?php
28 28
         } else
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
             wp_redirect(preg_replace('|^http://|', 'https://', $_SERVER['REQUEST_URI']));
48 48
             exit();
49 49
         } else {
50
-            wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
50
+            wp_redirect('https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
51 51
             exit();
52 52
         }
53 53
     }
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      * @param string $message Login message.
61 61
      */
62 62
     $message = apply_filters('login_message', $message);
63
-    if (!empty($message)) echo $message . "\n";
63
+    if (!empty($message)) echo $message."\n";
64 64
 
65 65
 }
66 66
 
@@ -208,9 +208,9 @@  discard block
 block discarded – undo
208 208
 
209 209
     wp_set_password($new_pass, $user->ID);
210 210
     update_user_meta($user->ID, 'default_password_nag', true); //Set up the Password change nag.
211
-    $message = '<p><b>' . __('Your login Information :', 'geodirectory') . '</b></p>';
212
-    $message .= '<p>' . sprintf(__('Username: %s', 'geodirectory'), $user->user_login) . "</p>";
213
-    $message .= '<p>' . sprintf(__('Password: %s', 'geodirectory'), $new_pass) . "</p>";
211
+    $message = '<p><b>'.__('Your login Information :', 'geodirectory').'</b></p>';
212
+    $message .= '<p>'.sprintf(__('Username: %s', 'geodirectory'), $user->user_login)."</p>";
213
+    $message .= '<p>'.sprintf(__('Password: %s', 'geodirectory'), $new_pass)."</p>";
214 214
     //$message .= '<p>You can login to : <a href="'.home_url().'/?ptype=login' . "\">Login</a> or the URL is :  ".home_url()."/?ptype=login</p>";
215 215
     //$message .= '<p>Thank You,<br> '.get_option('blogname').'</p>';
216 216
     $user_email = $user_data->user_email;
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
      */
237 237
     $message = apply_filters('password_reset_message', $message, $new_pass);
238 238
     //geodir_sendEmail($fromEmail,$fromEmailName,$user_email,$user_name,$title,$message,$extra='');///forgot password email
239
-    geodir_sendEmail($fromEmail, $fromEmailName, $user_email, $user_name, $title, $message, $extra = '', 'forgot_password', $post_id = '', $user->ID);///forgot password email
239
+    geodir_sendEmail($fromEmail, $fromEmailName, $user_email, $user_name, $title, $message, $extra = '', 'forgot_password', $post_id = '', $user->ID); ///forgot password email
240 240
 
241 241
     return true;
242 242
 }
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
      *
316 316
      * @param object $errors Registration error messages.
317 317
      */
318
-    $errors = apply_filters('registration_errors', $errors,$user_login,$user_email);
318
+    $errors = apply_filters('registration_errors', $errors, $user_login, $user_email);
319 319
 
320 320
     if ($errors->get_error_code())
321 321
         return $errors;
@@ -390,13 +390,13 @@  discard block
 block discarded – undo
390 390
         ///////REGISTRATION EMAIL START//////
391 391
         $fromEmail = geodir_get_site_email_id();
392 392
         $fromEmailName = get_site_emailName();
393
-        $message = __('<p><b>' . __('Your login Information :', 'geodirectory') . '</b></p>
394
-<p>' . __('Username:', 'geodirectory') . ' ' . $user_login . '</p>
395
-<p>' . __('Password:', 'geodirectory') . ' ' . $user_pass . '</p>');
393
+        $message = __('<p><b>'.__('Your login Information :', 'geodirectory').'</b></p>
394
+<p>' . __('Username:', 'geodirectory').' '.$user_login.'</p>
395
+<p>' . __('Password:', 'geodirectory').' '.$user_pass.'</p>');
396 396
 
397 397
         /////////////customer email//////////////
398 398
         //geodir_sendEmail($fromEmail,$fromEmailName,$user_email,$userName,$subject,$client_message,$extra='');///To client email
399
-        geodir_sendEmail($fromEmail, $fromEmailName, $user_email, $userName, '', $message, '', 'registration', '', $user_id);/// registration email
399
+        geodir_sendEmail($fromEmail, $fromEmailName, $user_email, $userName, '', $message, '', 'registration', '', $user_id); /// registration email
400 400
         //////REGISTRATION EMAIL END////////
401 401
     }
402 402
 
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
         $action = 'resetpass';
428 428
 
429 429
     // validate action so as to default to the login screen
430
-    if (!in_array($action, array('logout', 'lostpassword', 'retrievepassword', 'resetpass', 'rp', 'register', 'login')) && false === has_filter('login_form_' . $action))
430
+    if (!in_array($action, array('logout', 'lostpassword', 'retrievepassword', 'resetpass', 'rp', 'register', 'login')) && false === has_filter('login_form_'.$action))
431 431
         $action = 'login';
432 432
 
433 433
     nocache_headers();
@@ -437,8 +437,8 @@  discard block
 block discarded – undo
437 437
             $_SERVER['PHP_SELF'] = str_replace($_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF']);
438 438
 
439 439
         $schema = (isset($_SERVER['HTTPS']) && geodir_strtolower($_SERVER['HTTPS']) == 'on') ? 'https://' : 'http://';
440
-        if (dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) != home_url())
441
-            update_option('siteurl', dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']));
440
+        if (dirname($schema.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']) != home_url())
441
+            update_option('siteurl', dirname($schema.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']));
442 442
     }
443 443
 
444 444
     //Set a cookie now to see if they are supported by the browser.
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
      *
454 454
      * @since 1.0.0
455 455
      */
456
-    do_action('login_form_' . $action);
456
+    do_action('login_form_'.$action);
457 457
 
458 458
     $http_post = ('POST' == $_SERVER['REQUEST_METHOD']);
459 459
 
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
          * @since 1.0.0
494 494
          */
495 495
         do_action('lost_password');
496
-            $message = '<div class="sucess_msg">' . ENTER_USER_EMAIL_NEW_PW_MSG . '</div>';
496
+            $message = '<div class="sucess_msg">'.ENTER_USER_EMAIL_NEW_PW_MSG.'</div>';
497 497
             $user_login = isset($_POST['user_login']) ? stripslashes($_POST['user_login']) : '';
498 498
 
499 499
             break;
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
                 exit();
508 508
             }
509 509
 
510
-            wp_redirect(geodir_login_url(array('error'=>'invalidkey','action'=>'lostpassword')));
510
+            wp_redirect(geodir_login_url(array('error'=>'invalidkey', 'action'=>'lostpassword')));
511 511
             exit();
512 512
 
513 513
             break;
@@ -640,15 +640,15 @@  discard block
 block discarded – undo
640 640
                     $user_ID = !empty($user->ID) ? $user->ID : get_current_user_id();
641 641
                     $post_types = geodir_get_posttypes();
642 642
                     
643
-                    if ( !empty( $_REQUEST['stype'] ) ) {
643
+                    if (!empty($_REQUEST['stype'])) {
644 644
                         $dashboard_post_type = sanitize_text_field($_REQUEST['stype']);
645 645
                     } else {
646
-                        $user_listings = geodir_user_post_listing_count( $user_ID );
647
-                        if ( !empty( $user_listings ) && $dashboard_post_types = array_keys( $user_listings ) ) {
646
+                        $user_listings = geodir_user_post_listing_count($user_ID);
647
+                        if (!empty($user_listings) && $dashboard_post_types = array_keys($user_listings)) {
648 648
                             $dashboard_post_type = $dashboard_post_types[0];
649 649
                         }
650 650
                     }
651
-                    if ( !( !empty( $dashboard_post_type ) && in_array( $dashboard_post_type, $post_types ) ) ) {
651
+                    if (!(!empty($dashboard_post_type) && in_array($dashboard_post_type, $post_types))) {
652 652
                         $dashboard_post_type = $post_types[0];
653 653
                     }
654 654
                     
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
 
697 697
             if (is_wp_error($user)) {
698 698
                 if (isset($_SERVER['HTTP_REFERER']) && strstr($_SERVER['HTTP_REFERER'], 'ptype=property_submit') && $_POST['log'] != '' && $_POST['pwd'] != '') {
699
-                    wp_redirect($_SERVER['HTTP_REFERER'] . '&emsg=1');
699
+                    wp_redirect($_SERVER['HTTP_REFERER'].'&emsg=1');
700 700
                 }
701 701
             }
702 702
             if (!is_wp_error($user)) {
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
 
725 725
             // Some parts of this script use the main login form to display a message
726 726
             if (isset($_GET['loggedout']) && TRUE == $_GET['loggedout']) {
727
-                $successmsg = '<div class="sucess_msg">' . YOU_ARE_LOGED_OUT_MSG . '</div>';
727
+                $successmsg = '<div class="sucess_msg">'.YOU_ARE_LOGED_OUT_MSG.'</div>';
728 728
             } elseif (isset($_GET['registration']) && 'disabled' == $_GET['registration']) {
729 729
                 $successmsg = USER_REG_NOT_ALLOW_MSG;
730 730
             } elseif (isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail']) {
@@ -737,9 +737,9 @@  discard block
 block discarded – undo
737 737
 
738 738
             if ((isset($_POST['log']) && $_POST['log'] != '' && $errors) || ((!isset($_POST['log']) || $_POST['log'] == '') && isset($_REQUEST['testcookie']) && $_REQUEST['testcookie'])) {
739 739
                 if (isset($_REQUEST['pagetype']) && $_REQUEST['pagetype'] != '') {
740
-                    wp_redirect($_REQUEST['pagetype'] . '&emsg=1');
740
+                    wp_redirect($_REQUEST['pagetype'].'&emsg=1');
741 741
                 } else {
742
-                    wp_redirect(geodir_login_url(array('logemsg'=>'1','redirect_to'=>urlencode($_REQUEST['redirect_to']))));
742
+                    wp_redirect(geodir_login_url(array('logemsg'=>'1', 'redirect_to'=>urlencode($_REQUEST['redirect_to']))));
743 743
                 }
744 744
                 gd_die();
745 745
             }
Please login to merge, or discard this patch.