@@ -179,7 +179,7 @@  | 
                                                    ||
| 179 | 179 | * @since 1.0.0  | 
                                                        
| 180 | 180 | * @package GeoDirectory  | 
                                                        
| 181 | 181 | * @param array $classes Class array.  | 
                                                        
| 182 | - * @return array Modified class array.  | 
                                                        |
| 182 | + * @return string[] Modified class array.  | 
                                                        |
| 183 | 183 | */  | 
                                                        
| 184 | 184 | function gd_compat_body_class($classes)  | 
                                                        
| 185 | 185 |  { | 
                                                        
@@ -18,10 +18,10 @@ discard block  | 
                                                    ||
| 18 | 18 | */  | 
                                                        
| 19 | 19 | function gd_strip_breadcrumb_wrappers($breadcrumb)  | 
                                                        
| 20 | 20 |  { | 
                                                        
| 21 | -    $breadcrumb = str_replace(array("<li>","</li>"), "", $breadcrumb); | 
                                                        |
| 22 | -    $breadcrumb = str_replace('<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs">', '<ul class="fusion-breadcrumbs"><li>', $breadcrumb); | 
                                                        |
| 23 | -    $breadcrumb = str_replace('</ul></div>', '</li></ul>', $breadcrumb); | 
                                                        |
| 24 | - return $breadcrumb;  | 
                                                        |
| 21 | +	$breadcrumb = str_replace(array("<li>","</li>"), "", $breadcrumb); | 
                                                        |
| 22 | +	$breadcrumb = str_replace('<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs">', '<ul class="fusion-breadcrumbs"><li>', $breadcrumb); | 
                                                        |
| 23 | +	$breadcrumb = str_replace('</ul></div>', '</li></ul>', $breadcrumb); | 
                                                        |
| 24 | + return $breadcrumb;  | 
                                                        |
| 25 | 25 | }  | 
                                                        
| 26 | 26 | |
| 27 | 27 |  add_filter('geodir_breadcrumb_separator', 'gd_change_breadcrumb_separator'); | 
                                                        
@@ -35,8 +35,8 @@ discard block  | 
                                                    ||
| 35 | 35 | */  | 
                                                        
| 36 | 36 | function gd_change_breadcrumb_separator($separator)  | 
                                                        
| 37 | 37 |  { | 
                                                        
| 38 | - $separator = ' / ';  | 
                                                        |
| 39 | - return $separator;  | 
                                                        |
| 38 | + $separator = ' / ';  | 
                                                        |
| 39 | + return $separator;  | 
                                                        |
| 40 | 40 | }  | 
                                                        
| 41 | 41 | |
| 42 | 42 |  add_action('avada_override_current_page_title_bar','gd_avada_current_page_title_bar_change'); | 
                                                        
@@ -49,11 +49,11 @@ discard block  | 
                                                    ||
| 49 | 49 | */  | 
                                                        
| 50 | 50 | function gd_avada_current_page_title_bar_change($c_pageID)  | 
                                                        
| 51 | 51 |  { | 
                                                        
| 52 | -    if (geodir_is_geodir_page()) { | 
                                                        |
| 53 | - gd_avada_current_page_title_bar();  | 
                                                        |
| 54 | -    }else{ | 
                                                        |
| 55 | - avada_current_page_title_bar( $c_pageID );  | 
                                                        |
| 56 | - }  | 
                                                        |
| 52 | +	if (geodir_is_geodir_page()) { | 
                                                        |
| 53 | + gd_avada_current_page_title_bar();  | 
                                                        |
| 54 | +	}else{ | 
                                                        |
| 55 | + avada_current_page_title_bar( $c_pageID );  | 
                                                        |
| 56 | + }  | 
                                                        |
| 57 | 57 | |
| 58 | 58 | }  | 
                                                        
| 59 | 59 | |
@@ -65,44 +65,44 @@ discard block  | 
                                                    ||
| 65 | 65 | */  | 
                                                        
| 66 | 66 | function gd_avada_current_page_title_bar()  | 
                                                        
| 67 | 67 |  { | 
                                                        
| 68 | - ob_start();  | 
                                                        |
| 69 | - geodir_breadcrumb();  | 
                                                        |
| 70 | - $secondary_content = ob_get_contents();  | 
                                                        |
| 71 | - ob_get_clean();  | 
                                                        |
| 72 | -  | 
                                                        |
| 73 | - $title = '';  | 
                                                        |
| 74 | - $subtitle = '';  | 
                                                        |
| 75 | -  | 
                                                        |
| 76 | -    if (geodir_is_page('listing')) { | 
                                                        |
| 77 | - ob_start(); // Start buffering;  | 
                                                        |
| 78 | - geodir_action_listings_title();  | 
                                                        |
| 79 | - $title = ob_get_clean();  | 
                                                        |
| 80 | - avada_page_title_bar($title, $subtitle, $secondary_content);  | 
                                                        |
| 81 | -    }elseif (geodir_is_page('add-listing')) { | 
                                                        |
| 82 | - ob_start(); // Start buffering;  | 
                                                        |
| 83 | - geodir_action_add_listing_page_title();  | 
                                                        |
| 84 | - $title = ob_get_clean();  | 
                                                        |
| 85 | - avada_page_title_bar($title, $subtitle, $secondary_content);  | 
                                                        |
| 86 | -    }elseif (geodir_is_page('author')) { | 
                                                        |
| 87 | - ob_start(); // Start buffering;  | 
                                                        |
| 88 | - geodir_action_author_page_title();  | 
                                                        |
| 89 | - $title = ob_get_clean();  | 
                                                        |
| 90 | - avada_page_title_bar($title, $subtitle, $secondary_content);  | 
                                                        |
| 91 | -    }elseif (geodir_is_page('detail') || geodir_is_page('preview')) { | 
                                                        |
| 92 | -        if ( $title = get_post_meta( get_the_ID(), 'pyre_page_title_custom_text', true ) ) {} | 
                                                        |
| 93 | -        else { | 
                                                        |
| 94 | - $title = get_the_title();  | 
                                                        |
| 95 | - }  | 
                                                        |
| 96 | - avada_page_title_bar($title, $subtitle, $secondary_content);  | 
                                                        |
| 97 | -    }elseif (geodir_is_page('search')) { | 
                                                        |
| 98 | - ob_start(); // Start buffering;  | 
                                                        |
| 99 | - geodir_action_search_page_title();  | 
                                                        |
| 100 | - $title = ob_get_clean();  | 
                                                        |
| 101 | - avada_page_title_bar($title, $subtitle, $secondary_content);  | 
                                                        |
| 102 | -    }else{ | 
                                                        |
| 103 | - $title = get_the_title();  | 
                                                        |
| 104 | - avada_page_title_bar($title, $subtitle, $secondary_content);  | 
                                                        |
| 105 | - }  | 
                                                        |
| 68 | + ob_start();  | 
                                                        |
| 69 | + geodir_breadcrumb();  | 
                                                        |
| 70 | + $secondary_content = ob_get_contents();  | 
                                                        |
| 71 | + ob_get_clean();  | 
                                                        |
| 72 | +  | 
                                                        |
| 73 | + $title = '';  | 
                                                        |
| 74 | + $subtitle = '';  | 
                                                        |
| 75 | +  | 
                                                        |
| 76 | +	if (geodir_is_page('listing')) { | 
                                                        |
| 77 | + ob_start(); // Start buffering;  | 
                                                        |
| 78 | + geodir_action_listings_title();  | 
                                                        |
| 79 | + $title = ob_get_clean();  | 
                                                        |
| 80 | + avada_page_title_bar($title, $subtitle, $secondary_content);  | 
                                                        |
| 81 | +	}elseif (geodir_is_page('add-listing')) { | 
                                                        |
| 82 | + ob_start(); // Start buffering;  | 
                                                        |
| 83 | + geodir_action_add_listing_page_title();  | 
                                                        |
| 84 | + $title = ob_get_clean();  | 
                                                        |
| 85 | + avada_page_title_bar($title, $subtitle, $secondary_content);  | 
                                                        |
| 86 | +	}elseif (geodir_is_page('author')) { | 
                                                        |
| 87 | + ob_start(); // Start buffering;  | 
                                                        |
| 88 | + geodir_action_author_page_title();  | 
                                                        |
| 89 | + $title = ob_get_clean();  | 
                                                        |
| 90 | + avada_page_title_bar($title, $subtitle, $secondary_content);  | 
                                                        |
| 91 | +	}elseif (geodir_is_page('detail') || geodir_is_page('preview')) { | 
                                                        |
| 92 | +		if ( $title = get_post_meta( get_the_ID(), 'pyre_page_title_custom_text', true ) ) {} | 
                                                        |
| 93 | +		else { | 
                                                        |
| 94 | + $title = get_the_title();  | 
                                                        |
| 95 | + }  | 
                                                        |
| 96 | + avada_page_title_bar($title, $subtitle, $secondary_content);  | 
                                                        |
| 97 | +	}elseif (geodir_is_page('search')) { | 
                                                        |
| 98 | + ob_start(); // Start buffering;  | 
                                                        |
| 99 | + geodir_action_search_page_title();  | 
                                                        |
| 100 | + $title = ob_get_clean();  | 
                                                        |
| 101 | + avada_page_title_bar($title, $subtitle, $secondary_content);  | 
                                                        |
| 102 | +	}else{ | 
                                                        |
| 103 | + $title = get_the_title();  | 
                                                        |
| 104 | + avada_page_title_bar($title, $subtitle, $secondary_content);  | 
                                                        |
| 105 | + }  | 
                                                        |
| 106 | 106 | }  | 
                                                        
| 107 | 107 | |
| 108 | 108 | /**  | 
                                                        
@@ -113,34 +113,34 @@ discard block  | 
                                                    ||
| 113 | 113 | */  | 
                                                        
| 114 | 114 | function gd_compat_php_avada()  | 
                                                        
| 115 | 115 |  { | 
                                                        
| 116 | - // change widget wrappers  | 
                                                        |
| 117 | - //add_filter( 'geodir_before_widget', 'geodir_before_widget_compat',10,1 );  | 
                                                        |
| 118 | - //add_filter( 'geodir_after_widget', 'geodir_after_widget_compat',10,1 );  | 
                                                        |
| 119 | -  | 
                                                        |
| 120 | - // REMOVE BREADCRUMB  | 
                                                        |
| 121 | -    remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20); | 
                                                        |
| 122 | -    remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20); | 
                                                        |
| 123 | -    remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20); | 
                                                        |
| 124 | -    remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20); | 
                                                        |
| 125 | -    remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20); | 
                                                        |
| 126 | -    remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20); | 
                                                        |
| 127 | -  | 
                                                        |
| 128 | - // REMOVE PAGE TITLES  | 
                                                        |
| 129 | -    remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10); | 
                                                        |
| 130 | -    remove_action('geodir_add_listing_page_title', 'geodir_action_add_listing_page_title', 10); | 
                                                        |
| 131 | -    remove_action('geodir_details_main_content', 'geodir_action_page_title', 20); | 
                                                        |
| 132 | -    remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10); | 
                                                        |
| 133 | -    remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10); | 
                                                        |
| 134 | -  | 
                                                        |
| 135 | - // make top section wide  | 
                                                        |
| 136 | -    remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); | 
                                                        |
| 137 | -    remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); | 
                                                        |
| 138 | -    remove_action('geodir_author_before_main_content', 'geodir_action_geodir_sidebar_author_top', 10); | 
                                                        |
| 139 | -    remove_action('geodir_search_before_main_content', 'geodir_action_geodir_sidebar_search_top', 10); | 
                                                        |
| 140 | -    remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_sidebar_detail_top', 10); | 
                                                        |
| 141 | -    remove_action('geodir_listings_before_main_content', 'geodir_action_geodir_sidebar_listings_top', 10); | 
                                                        |
| 142 | -  | 
                                                        |
| 143 | - //gd_compat_add_top_section_back();  | 
                                                        |
| 116 | + // change widget wrappers  | 
                                                        |
| 117 | + //add_filter( 'geodir_before_widget', 'geodir_before_widget_compat',10,1 );  | 
                                                        |
| 118 | + //add_filter( 'geodir_after_widget', 'geodir_after_widget_compat',10,1 );  | 
                                                        |
| 119 | +  | 
                                                        |
| 120 | + // REMOVE BREADCRUMB  | 
                                                        |
| 121 | +	remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20); | 
                                                        |
| 122 | +	remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20); | 
                                                        |
| 123 | +	remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20); | 
                                                        |
| 124 | +	remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20); | 
                                                        |
| 125 | +	remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20); | 
                                                        |
| 126 | +	remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20); | 
                                                        |
| 127 | +  | 
                                                        |
| 128 | + // REMOVE PAGE TITLES  | 
                                                        |
| 129 | +	remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10); | 
                                                        |
| 130 | +	remove_action('geodir_add_listing_page_title', 'geodir_action_add_listing_page_title', 10); | 
                                                        |
| 131 | +	remove_action('geodir_details_main_content', 'geodir_action_page_title', 20); | 
                                                        |
| 132 | +	remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10); | 
                                                        |
| 133 | +	remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10); | 
                                                        |
| 134 | +  | 
                                                        |
| 135 | + // make top section wide  | 
                                                        |
| 136 | +	remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); | 
                                                        |
| 137 | +	remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); | 
                                                        |
| 138 | +	remove_action('geodir_author_before_main_content', 'geodir_action_geodir_sidebar_author_top', 10); | 
                                                        |
| 139 | +	remove_action('geodir_search_before_main_content', 'geodir_action_geodir_sidebar_search_top', 10); | 
                                                        |
| 140 | +	remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_sidebar_detail_top', 10); | 
                                                        |
| 141 | +	remove_action('geodir_listings_before_main_content', 'geodir_action_geodir_sidebar_listings_top', 10); | 
                                                        |
| 142 | +  | 
                                                        |
| 143 | + //gd_compat_add_top_section_back();  | 
                                                        |
| 144 | 144 | |
| 145 | 145 | }  | 
                                                        
| 146 | 146 | |
@@ -152,17 +152,17 @@ discard block  | 
                                                    ||
| 152 | 152 | * @package GeoDirectory  | 
                                                        
| 153 | 153 | */  | 
                                                        
| 154 | 154 |  function gd_compat_add_top_section_back() { | 
                                                        
| 155 | -    if (geodir_is_page('home') || geodir_is_page('location')) { | 
                                                        |
| 156 | - geodir_action_geodir_sidebar_home_top();  | 
                                                        |
| 157 | -    } elseif (geodir_is_page('listing')) { | 
                                                        |
| 158 | - geodir_action_geodir_sidebar_listings_top();  | 
                                                        |
| 159 | -    } elseif (geodir_is_page('detail')) { | 
                                                        |
| 160 | - geodir_action_geodir_sidebar_detail_top();  | 
                                                        |
| 161 | -    } elseif (geodir_is_page('search')) { | 
                                                        |
| 162 | - geodir_action_geodir_sidebar_search_top();  | 
                                                        |
| 163 | -    } elseif (geodir_is_page('author')) { | 
                                                        |
| 164 | - geodir_action_geodir_sidebar_author_top();  | 
                                                        |
| 165 | - }  | 
                                                        |
| 155 | +	if (geodir_is_page('home') || geodir_is_page('location')) { | 
                                                        |
| 156 | + geodir_action_geodir_sidebar_home_top();  | 
                                                        |
| 157 | +	} elseif (geodir_is_page('listing')) { | 
                                                        |
| 158 | + geodir_action_geodir_sidebar_listings_top();  | 
                                                        |
| 159 | +	} elseif (geodir_is_page('detail')) { | 
                                                        |
| 160 | + geodir_action_geodir_sidebar_detail_top();  | 
                                                        |
| 161 | +	} elseif (geodir_is_page('search')) { | 
                                                        |
| 162 | + geodir_action_geodir_sidebar_search_top();  | 
                                                        |
| 163 | +	} elseif (geodir_is_page('author')) { | 
                                                        |
| 164 | + geodir_action_geodir_sidebar_author_top();  | 
                                                        |
| 165 | + }  | 
                                                        |
| 166 | 166 | }  | 
                                                        
| 167 | 167 | |
| 168 | 168 |  add_filter('body_class', 'gd_compat_body_class'); | 
                                                        
@@ -176,12 +176,12 @@ discard block  | 
                                                    ||
| 176 | 176 | */  | 
                                                        
| 177 | 177 | function gd_compat_body_class($classes)  | 
                                                        
| 178 | 178 |  { | 
                                                        
| 179 | -    if (geodir_is_geodir_page()) { | 
                                                        |
| 180 | - $classes[] = 'wpgeo-avada';  | 
                                                        |
| 181 | -    } else { | 
                                                        |
| 182 | - $classes[] = '';  | 
                                                        |
| 183 | - }  | 
                                                        |
| 184 | - return $classes;  | 
                                                        |
| 179 | +	if (geodir_is_geodir_page()) { | 
                                                        |
| 180 | + $classes[] = 'wpgeo-avada';  | 
                                                        |
| 181 | +	} else { | 
                                                        |
| 182 | + $classes[] = '';  | 
                                                        |
| 183 | + }  | 
                                                        |
| 184 | + return $classes;  | 
                                                        |
| 185 | 185 | }  | 
                                                        
| 186 | 186 | |
| 187 | 187 | |
@@ -195,7 +195,7 @@ discard block  | 
                                                    ||
| 195 | 195 | */  | 
                                                        
| 196 | 196 | function geodir_before_widget_compat($var)  | 
                                                        
| 197 | 197 |  { | 
                                                        
| 198 | - return '<div id="%1$s" class="geodir-widget %2$s">';  | 
                                                        |
| 198 | + return '<div id="%1$s" class="geodir-widget %2$s">';  | 
                                                        |
| 199 | 199 | }  | 
                                                        
| 200 | 200 | |
| 201 | 201 | /**  | 
                                                        
@@ -208,7 +208,7 @@ discard block  | 
                                                    ||
| 208 | 208 | */  | 
                                                        
| 209 | 209 | function geodir_after_widget_compat($var)  | 
                                                        
| 210 | 210 |  { | 
                                                        
| 211 | - return '</div>';  | 
                                                        |
| 211 | + return '</div>';  | 
                                                        |
| 212 | 212 | }  | 
                                                        
| 213 | 213 | |
| 214 | 214 |  add_filter('geodir_search_form_class', 'geodir_search_form_class_avada'); | 
                                                        
@@ -222,8 +222,8 @@ discard block  | 
                                                    ||
| 222 | 222 | */  | 
                                                        
| 223 | 223 | function geodir_search_form_class_avada($class)  | 
                                                        
| 224 | 224 |  { | 
                                                        
| 225 | - $class .= ' search';  | 
                                                        |
| 226 | - return $class;  | 
                                                        |
| 225 | + $class .= ' search';  | 
                                                        |
| 226 | + return $class;  | 
                                                        |
| 227 | 227 | }  | 
                                                        
| 228 | 228 | |
| 229 | 229 | |
@@ -232,11 +232,11 @@ discard block  | 
                                                    ||
| 232 | 232 | |
| 233 | 233 | // Avada sets the search page to use wither post or page, we need it to be 'any'  | 
                                                        
| 234 | 234 |  function gd_avada_search_filter( $query ) { | 
                                                        
| 235 | -    if ( geodir_is_page('search') && is_search() && $query->is_search) { | 
                                                        |
| 236 | -        $query->set('post_type', 'any'); | 
                                                        |
| 237 | - }  | 
                                                        |
| 238 | - return $query;  | 
                                                        |
| 235 | +	if ( geodir_is_page('search') && is_search() && $query->is_search) { | 
                                                        |
| 236 | +		$query->set('post_type', 'any'); | 
                                                        |
| 237 | + }  | 
                                                        |
| 238 | + return $query;  | 
                                                        |
| 239 | 239 | }  | 
                                                        
| 240 | 240 |  if ( ! is_admin() ) { | 
                                                        
| 241 | - add_filter( 'pre_get_posts', 'gd_avada_search_filter',11 );  | 
                                                        |
| 241 | + add_filter( 'pre_get_posts', 'gd_avada_search_filter',11 );  | 
                                                        |
| 242 | 242 | }  | 
                                                        
| 243 | 243 | \ No newline at end of file  | 
                                                        
@@ -18,7 +18,7 @@ discard block  | 
                                                    ||
| 18 | 18 | */  | 
                                                        
| 19 | 19 | function gd_strip_breadcrumb_wrappers($breadcrumb)  | 
                                                        
| 20 | 20 |  { | 
                                                        
| 21 | -    $breadcrumb = str_replace(array("<li>","</li>"), "", $breadcrumb); | 
                                                        |
| 21 | +    $breadcrumb = str_replace(array("<li>", "</li>"), "", $breadcrumb); | 
                                                        |
| 22 | 22 |      $breadcrumb = str_replace('<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs">', '<ul class="fusion-breadcrumbs"><li>', $breadcrumb); | 
                                                        
| 23 | 23 |      $breadcrumb = str_replace('</ul></div>', '</li></ul>', $breadcrumb); | 
                                                        
| 24 | 24 | return $breadcrumb;  | 
                                                        
@@ -39,7 +39,7 @@ discard block  | 
                                                    ||
| 39 | 39 | return $separator;  | 
                                                        
| 40 | 40 | }  | 
                                                        
| 41 | 41 | |
| 42 | -add_action('avada_override_current_page_title_bar','gd_avada_current_page_title_bar_change'); | 
                                                        |
| 42 | +add_action('avada_override_current_page_title_bar', 'gd_avada_current_page_title_bar_change'); | 
                                                        |
| 43 | 43 | /**  | 
                                                        
| 44 | 44 | * new title bar functions for gd pages.  | 
                                                        
| 45 | 45 | *  | 
                                                        
@@ -51,8 +51,8 @@ discard block  | 
                                                    ||
| 51 | 51 |  { | 
                                                        
| 52 | 52 |      if (geodir_is_geodir_page()) { | 
                                                        
| 53 | 53 | gd_avada_current_page_title_bar();  | 
                                                        
| 54 | -    }else{ | 
                                                        |
| 55 | - avada_current_page_title_bar( $c_pageID );  | 
                                                        |
| 54 | +    } else { | 
                                                        |
| 55 | + avada_current_page_title_bar($c_pageID);  | 
                                                        |
| 56 | 56 | }  | 
                                                        
| 57 | 57 | |
| 58 | 58 | }  | 
                                                        
@@ -89,7 +89,7 @@ discard block  | 
                                                    ||
| 89 | 89 | $title = ob_get_clean();  | 
                                                        
| 90 | 90 | avada_page_title_bar($title, $subtitle, $secondary_content);  | 
                                                        
| 91 | 91 |      }elseif (geodir_is_page('detail') || geodir_is_page('preview')) { | 
                                                        
| 92 | -        if ( $title = get_post_meta( get_the_ID(), 'pyre_page_title_custom_text', true ) ) {} | 
                                                        |
| 92 | +        if ($title = get_post_meta(get_the_ID(), 'pyre_page_title_custom_text', true)) {} | 
                                                        |
| 93 | 93 |          else { | 
                                                        
| 94 | 94 | $title = get_the_title();  | 
                                                        
| 95 | 95 | }  | 
                                                        
@@ -99,7 +99,7 @@ discard block  | 
                                                    ||
| 99 | 99 | geodir_action_search_page_title();  | 
                                                        
| 100 | 100 | $title = ob_get_clean();  | 
                                                        
| 101 | 101 | avada_page_title_bar($title, $subtitle, $secondary_content);  | 
                                                        
| 102 | -    }else{ | 
                                                        |
| 102 | +    } else { | 
                                                        |
| 103 | 103 | $title = get_the_title();  | 
                                                        
| 104 | 104 | avada_page_title_bar($title, $subtitle, $secondary_content);  | 
                                                        
| 105 | 105 | }  | 
                                                        
@@ -231,12 +231,12 @@ discard block  | 
                                                    ||
| 231 | 231 | gd_compat_php_avada();  | 
                                                        
| 232 | 232 | |
| 233 | 233 | // Avada sets the search page to use wither post or page, we need it to be 'any'  | 
                                                        
| 234 | -function gd_avada_search_filter( $query ) { | 
                                                        |
| 235 | -    if ( geodir_is_page('search') && is_search() && $query->is_search) { | 
                                                        |
| 234 | +function gd_avada_search_filter($query) { | 
                                                        |
| 235 | +    if (geodir_is_page('search') && is_search() && $query->is_search) { | 
                                                        |
| 236 | 236 |          $query->set('post_type', 'any'); | 
                                                        
| 237 | 237 | }  | 
                                                        
| 238 | 238 | return $query;  | 
                                                        
| 239 | 239 | }  | 
                                                        
| 240 | -if ( ! is_admin() ) { | 
                                                        |
| 241 | - add_filter( 'pre_get_posts', 'gd_avada_search_filter',11 );  | 
                                                        |
| 240 | +if (!is_admin()) { | 
                                                        |
| 241 | +    add_filter('pre_get_posts', 'gd_avada_search_filter', 11); | 
                                                        |
| 242 | 242 | }  | 
                                                        
| 243 | 243 | \ No newline at end of file  | 
                                                        
@@ -51,7 +51,7 @@ discard block  | 
                                                    ||
| 51 | 51 |  { | 
                                                        
| 52 | 52 |      if (geodir_is_geodir_page()) { | 
                                                        
| 53 | 53 | gd_avada_current_page_title_bar();  | 
                                                        
| 54 | -    }else{ | 
                                                        |
| 54 | +    } else{ | 
                                                        |
| 55 | 55 | avada_current_page_title_bar( $c_pageID );  | 
                                                        
| 56 | 56 | }  | 
                                                        
| 57 | 57 | |
@@ -78,28 +78,27 @@ discard block  | 
                                                    ||
| 78 | 78 | geodir_action_listings_title();  | 
                                                        
| 79 | 79 | $title = ob_get_clean();  | 
                                                        
| 80 | 80 | avada_page_title_bar($title, $subtitle, $secondary_content);  | 
                                                        
| 81 | -    }elseif (geodir_is_page('add-listing')) { | 
                                                        |
| 81 | +    } elseif (geodir_is_page('add-listing')) { | 
                                                        |
| 82 | 82 | ob_start(); // Start buffering;  | 
                                                        
| 83 | 83 | geodir_action_add_listing_page_title();  | 
                                                        
| 84 | 84 | $title = ob_get_clean();  | 
                                                        
| 85 | 85 | avada_page_title_bar($title, $subtitle, $secondary_content);  | 
                                                        
| 86 | -    }elseif (geodir_is_page('author')) { | 
                                                        |
| 86 | +    } elseif (geodir_is_page('author')) { | 
                                                        |
| 87 | 87 | ob_start(); // Start buffering;  | 
                                                        
| 88 | 88 | geodir_action_author_page_title();  | 
                                                        
| 89 | 89 | $title = ob_get_clean();  | 
                                                        
| 90 | 90 | avada_page_title_bar($title, $subtitle, $secondary_content);  | 
                                                        
| 91 | -    }elseif (geodir_is_page('detail') || geodir_is_page('preview')) { | 
                                                        |
| 92 | -        if ( $title = get_post_meta( get_the_ID(), 'pyre_page_title_custom_text', true ) ) {} | 
                                                        |
| 93 | -        else { | 
                                                        |
| 91 | +    } elseif (geodir_is_page('detail') || geodir_is_page('preview')) { | 
                                                        |
| 92 | +        if ( $title = get_post_meta( get_the_ID(), 'pyre_page_title_custom_text', true ) ) {} else { | 
                                                        |
| 94 | 93 | $title = get_the_title();  | 
                                                        
| 95 | 94 | }  | 
                                                        
| 96 | 95 | avada_page_title_bar($title, $subtitle, $secondary_content);  | 
                                                        
| 97 | -    }elseif (geodir_is_page('search')) { | 
                                                        |
| 96 | +    } elseif (geodir_is_page('search')) { | 
                                                        |
| 98 | 97 | ob_start(); // Start buffering;  | 
                                                        
| 99 | 98 | geodir_action_search_page_title();  | 
                                                        
| 100 | 99 | $title = ob_get_clean();  | 
                                                        
| 101 | 100 | avada_page_title_bar($title, $subtitle, $secondary_content);  | 
                                                        
| 102 | -    }else{ | 
                                                        |
| 101 | +    } else{ | 
                                                        |
| 103 | 102 | $title = get_the_title();  | 
                                                        
| 104 | 103 | avada_page_title_bar($title, $subtitle, $secondary_content);  | 
                                                        
| 105 | 104 | }  | 
                                                        
@@ -133,7 +133,7 @@  | 
                                                    ||
| 133 | 133 | * @since 1.0.0  | 
                                                        
| 134 | 134 | * @package GeoDirectory  | 
                                                        
| 135 | 135 | * @param array $classes Class array.  | 
                                                        
| 136 | - * @return array Modified class array.  | 
                                                        |
| 136 | + * @return string[] Modified class array.  | 
                                                        |
| 137 | 137 | */  | 
                                                        
| 138 | 138 | function wpgeo_enfold_body_class($classes)  | 
                                                        
| 139 | 139 |  { | 
                                                        
@@ -17,84 +17,84 @@ discard block  | 
                                                    ||
| 17 | 17 | function enfold_action_calls()  | 
                                                        
| 18 | 18 |  { | 
                                                        
| 19 | 19 | |
| 20 | - /* ACTIONS  | 
                                                        |
| 20 | + /* ACTIONS  | 
                                                        |
| 21 | 21 | ****************************************************************************************/  | 
                                                        
| 22 | 22 | |
| 23 | - // Add body class for styling purposes  | 
                                                        |
| 24 | -    add_filter('body_class', 'wpgeo_enfold_body_class'); | 
                                                        |
| 23 | + // Add body class for styling purposes  | 
                                                        |
| 24 | +	add_filter('body_class', 'wpgeo_enfold_body_class'); | 
                                                        |
| 25 | 25 | |
| 26 | - // Pages using the page-builder shouldn't redirect on successful payment  | 
                                                        |
| 27 | -    if (isset($_REQUEST['pay_action'])) { | 
                                                        |
| 28 | -        add_action('init', 'geodir_allow_payment_urls_enfold', 15); | 
                                                        |
| 29 | - }  | 
                                                        |
| 26 | + // Pages using the page-builder shouldn't redirect on successful payment  | 
                                                        |
| 27 | +	if (isset($_REQUEST['pay_action'])) { | 
                                                        |
| 28 | +		add_action('init', 'geodir_allow_payment_urls_enfold', 15); | 
                                                        |
| 29 | + }  | 
                                                        |
| 30 | 30 | |
| 31 | - // LOCATION MANAGER MENU ACTIONS - set the location menu item before the Enfold search  | 
                                                        |
| 32 | -    if (function_exists('geodir_location_menu_items')) { | 
                                                        |
| 33 | -        remove_filter('wp_nav_menu_items', 'geodir_location_menu_items', 110); | 
                                                        |
| 34 | -        add_filter('wp_nav_menu_items', 'geodir_location_menu_items', 8, 2); | 
                                                        |
| 35 | - }  | 
                                                        |
| 36 | - // GEODIR MENU ACTIONS - set the GeoDir menu items before the Enfold search  | 
                                                        |
| 37 | -    remove_filter('wp_nav_menu_items', 'geodir_menu_items', 100); | 
                                                        |
| 38 | -    add_filter('wp_nav_menu_items', 'geodir_menu_items', 7, 2); | 
                                                        |
| 31 | + // LOCATION MANAGER MENU ACTIONS - set the location menu item before the Enfold search  | 
                                                        |
| 32 | +	if (function_exists('geodir_location_menu_items')) { | 
                                                        |
| 33 | +		remove_filter('wp_nav_menu_items', 'geodir_location_menu_items', 110); | 
                                                        |
| 34 | +		add_filter('wp_nav_menu_items', 'geodir_location_menu_items', 8, 2); | 
                                                        |
| 35 | + }  | 
                                                        |
| 36 | + // GEODIR MENU ACTIONS - set the GeoDir menu items before the Enfold search  | 
                                                        |
| 37 | +	remove_filter('wp_nav_menu_items', 'geodir_menu_items', 100); | 
                                                        |
| 38 | +	add_filter('wp_nav_menu_items', 'geodir_menu_items', 7, 2); | 
                                                        |
| 39 | 39 | |
| 40 | - // HOME TOP SIDEBAR  | 
                                                        |
| 41 | -    remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); | 
                                                        |
| 42 | -    remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); | 
                                                        |
| 43 | - //add_action( 'ava_after_main_container', 'enfold_home_sidebar' );  | 
                                                        |
| 40 | + // HOME TOP SIDEBAR  | 
                                                        |
| 41 | +	remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); | 
                                                        |
| 42 | +	remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); | 
                                                        |
| 43 | + //add_action( 'ava_after_main_container', 'enfold_home_sidebar' );  | 
                                                        |
| 44 | 44 | |
| 45 | 45 | |
| 46 | - // WRAPPER OPEN ACTIONS  | 
                                                        |
| 47 | -    remove_action('geodir_wrapper_open', 'geodir_action_wrapper_open', 10); | 
                                                        |
| 48 | -    add_action('geodir_wrapper_open', 'enfold_action_wrapper_open', 9); | 
                                                        |
| 49 | -    add_action('geodir_wrapper_open', 'enfold_detail_title', 8, 2); // ADD GEODIR TITLE | 
                                                        |
| 46 | + // WRAPPER OPEN ACTIONS  | 
                                                        |
| 47 | +	remove_action('geodir_wrapper_open', 'geodir_action_wrapper_open', 10); | 
                                                        |
| 48 | +	add_action('geodir_wrapper_open', 'enfold_action_wrapper_open', 9); | 
                                                        |
| 49 | +	add_action('geodir_wrapper_open', 'enfold_detail_title', 8, 2); // ADD GEODIR TITLE | 
                                                        |
| 50 | 50 | |
| 51 | 51 | |
| 52 | - // WRAPPER CONTENT OPEN ACTIONS  | 
                                                        |
| 53 | -    remove_action('geodir_wrapper_content_open', 'geodir_action_wrapper_content_open', 10); | 
                                                        |
| 54 | -    add_action('geodir_wrapper_content_open', 'enfold_action_wrapper_content_open', 9, 3); | 
                                                        |
| 52 | + // WRAPPER CONTENT OPEN ACTIONS  | 
                                                        |
| 53 | +	remove_action('geodir_wrapper_content_open', 'geodir_action_wrapper_content_open', 10); | 
                                                        |
| 54 | +	add_action('geodir_wrapper_content_open', 'enfold_action_wrapper_content_open', 9, 3); | 
                                                        |
| 55 | 55 | |
| 56 | 56 | |
| 57 | - // SIDEBAR RIGHT OPEN ACTIONS  | 
                                                        |
| 58 | -    remove_action('geodir_sidebar_right_open', 'geodir_action_sidebar_right_open', 10); | 
                                                        |
| 59 | -    add_action('geodir_sidebar_right_open', 'enfold_action_sidebar_right_open', 10, 4); | 
                                                        |
| 57 | + // SIDEBAR RIGHT OPEN ACTIONS  | 
                                                        |
| 58 | +	remove_action('geodir_sidebar_right_open', 'geodir_action_sidebar_right_open', 10); | 
                                                        |
| 59 | +	add_action('geodir_sidebar_right_open', 'enfold_action_sidebar_right_open', 10, 4); | 
                                                        |
| 60 | 60 | |
| 61 | - // SIDEBAR LEFT OPEN ACTIONS  | 
                                                        |
| 62 | -    remove_action('geodir_sidebar_left_open', 'geodir_action_sidebar_left_open', 10); | 
                                                        |
| 63 | -    add_action('geodir_sidebar_left_open', 'enfold_action_sidebar_left_open', 10, 4); | 
                                                        |
| 61 | + // SIDEBAR LEFT OPEN ACTIONS  | 
                                                        |
| 62 | +	remove_action('geodir_sidebar_left_open', 'geodir_action_sidebar_left_open', 10); | 
                                                        |
| 63 | +	add_action('geodir_sidebar_left_open', 'enfold_action_sidebar_left_open', 10, 4); | 
                                                        |
| 64 | 64 | |
| 65 | 65 | |
| 66 | - // HOME PAGE BREADCRUMBS  | 
                                                        |
| 67 | -    remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20); | 
                                                        |
| 68 | -    remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20); | 
                                                        |
| 66 | + // HOME PAGE BREADCRUMBS  | 
                                                        |
| 67 | +	remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20); | 
                                                        |
| 68 | +	remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20); | 
                                                        |
| 69 | 69 | |
| 70 | - // LISTINGS PAGE BREADCRUMBS & TITLES  | 
                                                        |
| 71 | -    remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20); | 
                                                        |
| 72 | -    remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10); | 
                                                        |
| 70 | + // LISTINGS PAGE BREADCRUMBS & TITLES  | 
                                                        |
| 71 | +	remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20); | 
                                                        |
| 72 | +	remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10); | 
                                                        |
| 73 | 73 | |
| 74 | - // DETAILS PAGE BREADCRUMBS & TITLES  | 
                                                        |
| 75 | -    remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20); | 
                                                        |
| 76 | -    remove_action('geodir_details_main_content', 'geodir_action_page_title', 20); | 
                                                        |
| 74 | + // DETAILS PAGE BREADCRUMBS & TITLES  | 
                                                        |
| 75 | +	remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20); | 
                                                        |
| 76 | +	remove_action('geodir_details_main_content', 'geodir_action_page_title', 20); | 
                                                        |
| 77 | 77 | |
| 78 | - // SEARCH PAGE BREADCRUMBS & TITLES  | 
                                                        |
| 79 | -    remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20); | 
                                                        |
| 80 | -    remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10); | 
                                                        |
| 78 | + // SEARCH PAGE BREADCRUMBS & TITLES  | 
                                                        |
| 79 | +	remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20); | 
                                                        |
| 80 | +	remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10); | 
                                                        |
| 81 | 81 | |
| 82 | - // AUTHOR PAGE BREADCRUMBS & TITLES  | 
                                                        |
| 83 | -    remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20); | 
                                                        |
| 84 | -    remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10); | 
                                                        |
| 82 | + // AUTHOR PAGE BREADCRUMBS & TITLES  | 
                                                        |
| 83 | +	remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20); | 
                                                        |
| 84 | +	remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10); | 
                                                        |
| 85 | 85 | |
| 86 | - // DISABLE ENFOLD MAPS CALL  | 
                                                        |
| 87 | -    add_filter('avf_load_google_map_api', 'gd_enfold_remove_maps_api', 10, 1); | 
                                                        |
| 86 | + // DISABLE ENFOLD MAPS CALL  | 
                                                        |
| 87 | +	add_filter('avf_load_google_map_api', 'gd_enfold_remove_maps_api', 10, 1); | 
                                                        |
| 88 | 88 | |
| 89 | - // make top section wide  | 
                                                        |
| 90 | -    remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); | 
                                                        |
| 91 | -    remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); | 
                                                        |
| 92 | -    remove_action('geodir_author_before_main_content', 'geodir_action_geodir_sidebar_author_top', 10); | 
                                                        |
| 93 | -    remove_action('geodir_search_before_main_content', 'geodir_action_geodir_sidebar_search_top', 10); | 
                                                        |
| 94 | -    remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_sidebar_detail_top', 10); | 
                                                        |
| 95 | -    remove_action('geodir_listings_before_main_content', 'geodir_action_geodir_sidebar_listings_top', 10); | 
                                                        |
| 89 | + // make top section wide  | 
                                                        |
| 90 | +	remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); | 
                                                        |
| 91 | +	remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); | 
                                                        |
| 92 | +	remove_action('geodir_author_before_main_content', 'geodir_action_geodir_sidebar_author_top', 10); | 
                                                        |
| 93 | +	remove_action('geodir_search_before_main_content', 'geodir_action_geodir_sidebar_search_top', 10); | 
                                                        |
| 94 | +	remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_sidebar_detail_top', 10); | 
                                                        |
| 95 | +	remove_action('geodir_listings_before_main_content', 'geodir_action_geodir_sidebar_listings_top', 10); | 
                                                        |
| 96 | 96 | |
| 97 | -    add_action('geodir_wrapper_open', 'gd_enfold_compat_add_top_section_back', 5); | 
                                                        |
| 97 | +	add_action('geodir_wrapper_open', 'gd_enfold_compat_add_top_section_back', 5); | 
                                                        |
| 98 | 98 | |
| 99 | 99 | } // Close enfold_action_calls  | 
                                                        
| 100 | 100 | |
@@ -108,17 +108,17 @@ discard block  | 
                                                    ||
| 108 | 108 | function gd_enfold_compat_add_top_section_back()  | 
                                                        
| 109 | 109 |  { | 
                                                        
| 110 | 110 | |
| 111 | -    if (is_page_geodir_home() || geodir_is_page('location')) { | 
                                                        |
| 112 | -        add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_home_top', 8); | 
                                                        |
| 113 | -    } elseif (geodir_is_page('listing')) { | 
                                                        |
| 114 | -        add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_listings_top', 8); | 
                                                        |
| 115 | -    } elseif (geodir_is_page('detail')) { | 
                                                        |
| 116 | -        add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_detail_top', 8); | 
                                                        |
| 117 | -    } elseif (geodir_is_page('search')) { | 
                                                        |
| 118 | -        add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_search_top', 8); | 
                                                        |
| 119 | -    } elseif (geodir_is_page('author')) { | 
                                                        |
| 120 | -        add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_author_top', 8); | 
                                                        |
| 121 | - }  | 
                                                        |
| 111 | +	if (is_page_geodir_home() || geodir_is_page('location')) { | 
                                                        |
| 112 | +		add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_home_top', 8); | 
                                                        |
| 113 | +	} elseif (geodir_is_page('listing')) { | 
                                                        |
| 114 | +		add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_listings_top', 8); | 
                                                        |
| 115 | +	} elseif (geodir_is_page('detail')) { | 
                                                        |
| 116 | +		add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_detail_top', 8); | 
                                                        |
| 117 | +	} elseif (geodir_is_page('search')) { | 
                                                        |
| 118 | +		add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_search_top', 8); | 
                                                        |
| 119 | +	} elseif (geodir_is_page('author')) { | 
                                                        |
| 120 | +		add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_author_top', 8); | 
                                                        |
| 121 | + }  | 
                                                        |
| 122 | 122 | |
| 123 | 123 | |
| 124 | 124 | }  | 
                                                        
@@ -137,8 +137,8 @@ discard block  | 
                                                    ||
| 137 | 137 | */  | 
                                                        
| 138 | 138 | function wpgeo_enfold_body_class($classes)  | 
                                                        
| 139 | 139 |  { | 
                                                        
| 140 | - $classes[] = 'wpgeo-enfold';  | 
                                                        |
| 141 | - return $classes;  | 
                                                        |
| 140 | + $classes[] = 'wpgeo-enfold';  | 
                                                        |
| 141 | + return $classes;  | 
                                                        |
| 142 | 142 | }  | 
                                                        
| 143 | 143 | |
| 144 | 144 | /**  | 
                                                        
@@ -149,8 +149,8 @@ discard block  | 
                                                    ||
| 149 | 149 | */  | 
                                                        
| 150 | 150 | function geodir_allow_payment_urls_enfold()  | 
                                                        
| 151 | 151 |  { | 
                                                        
| 152 | - global $builder;  | 
                                                        |
| 153 | -    remove_action('template_redirect', array($builder, 'template_redirect'), 1000); | 
                                                        |
| 152 | + global $builder;  | 
                                                        |
| 153 | +	remove_action('template_redirect', array($builder, 'template_redirect'), 1000); | 
                                                        |
| 154 | 154 | }  | 
                                                        
| 155 | 155 | |
| 156 | 156 | |
@@ -162,8 +162,8 @@ discard block  | 
                                                    ||
| 162 | 162 | */  | 
                                                        
| 163 | 163 | function enfold_action_wrapper_open()  | 
                                                        
| 164 | 164 |  { | 
                                                        
| 165 | -    echo "<div class='container_wrap container_wrap_first main_color " . avia_layout_class('main', false) . "'>"; | 
                                                        |
| 166 | - echo "<div class='container template-blog '>";  | 
                                                        |
| 165 | +	echo "<div class='container_wrap container_wrap_first main_color " . avia_layout_class('main', false) . "'>"; | 
                                                        |
| 166 | + echo "<div class='container template-blog '>";  | 
                                                        |
| 167 | 167 | }  | 
                                                        
| 168 | 168 | |
| 169 | 169 | /**  | 
                                                        
@@ -177,38 +177,38 @@ discard block  | 
                                                    ||
| 177 | 177 | */  | 
                                                        
| 178 | 178 | function enfold_detail_title($page, $class)  | 
                                                        
| 179 | 179 |  { | 
                                                        
| 180 | - //echo '###'.$page;  | 
                                                        |
| 181 | - global $wp;  | 
                                                        |
| 182 | -    if (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_location_page_id() && !geodir_is_page('login')) { | 
                                                        |
| 183 | -        add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2); | 
                                                        |
| 184 | - echo avia_title();  | 
                                                        |
| 185 | -    } elseif ($page == 'details-page') { | 
                                                        |
| 186 | -        add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2); | 
                                                        |
| 187 | - echo avia_title();  | 
                                                        |
| 188 | -    } elseif ($page == 'listings-page' || $page == 'search-page') { | 
                                                        |
| 189 | -        add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2); | 
                                                        |
| 190 | - ob_start(); // Start buffering;  | 
                                                        |
| 191 | - geodir_action_listings_title();  | 
                                                        |
| 192 | - $gd_title = ob_get_clean();  | 
                                                        |
| 193 | -        $title_p = explode('">', $gd_title); | 
                                                        |
| 194 | -        $title = str_replace('</h1></header>', "", $title_p[2]); | 
                                                        |
| 195 | - //print_r($title_p);  | 
                                                        |
| 196 | -        echo avia_title(array('title' => $title)); | 
                                                        |
| 197 | -    } elseif ($page == 'author-page') { | 
                                                        |
| 198 | -        add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2); | 
                                                        |
| 199 | - ob_start(); // Start buffering;  | 
                                                        |
| 200 | - geodir_action_author_page_title();  | 
                                                        |
| 201 | - $gd_title = ob_get_clean();  | 
                                                        |
| 202 | -        $gd_title = str_replace('<h1>', "", $gd_title); | 
                                                        |
| 203 | -        $gd_title = str_replace('</h1>', "", $gd_title); | 
                                                        |
| 204 | -        echo avia_title(array('title' => $gd_title)); | 
                                                        |
| 205 | -    } elseif ($page == 'add-listing-page') { | 
                                                        |
| 206 | -        add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2); | 
                                                        |
| 207 | - echo avia_title();  | 
                                                        |
| 208 | -    } elseif ($page == 'add-listing-page') { | 
                                                        |
| 209 | -        add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2); | 
                                                        |
| 210 | - echo avia_title();  | 
                                                        |
| 211 | - }  | 
                                                        |
| 180 | + //echo '###'.$page;  | 
                                                        |
| 181 | + global $wp;  | 
                                                        |
| 182 | +	if (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_location_page_id() && !geodir_is_page('login')) { | 
                                                        |
| 183 | +		add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2); | 
                                                        |
| 184 | + echo avia_title();  | 
                                                        |
| 185 | +	} elseif ($page == 'details-page') { | 
                                                        |
| 186 | +		add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2); | 
                                                        |
| 187 | + echo avia_title();  | 
                                                        |
| 188 | +	} elseif ($page == 'listings-page' || $page == 'search-page') { | 
                                                        |
| 189 | +		add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2); | 
                                                        |
| 190 | + ob_start(); // Start buffering;  | 
                                                        |
| 191 | + geodir_action_listings_title();  | 
                                                        |
| 192 | + $gd_title = ob_get_clean();  | 
                                                        |
| 193 | +		$title_p = explode('">', $gd_title); | 
                                                        |
| 194 | +		$title = str_replace('</h1></header>', "", $title_p[2]); | 
                                                        |
| 195 | + //print_r($title_p);  | 
                                                        |
| 196 | +		echo avia_title(array('title' => $title)); | 
                                                        |
| 197 | +	} elseif ($page == 'author-page') { | 
                                                        |
| 198 | +		add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2); | 
                                                        |
| 199 | + ob_start(); // Start buffering;  | 
                                                        |
| 200 | + geodir_action_author_page_title();  | 
                                                        |
| 201 | + $gd_title = ob_get_clean();  | 
                                                        |
| 202 | +		$gd_title = str_replace('<h1>', "", $gd_title); | 
                                                        |
| 203 | +		$gd_title = str_replace('</h1>', "", $gd_title); | 
                                                        |
| 204 | +		echo avia_title(array('title' => $gd_title)); | 
                                                        |
| 205 | +	} elseif ($page == 'add-listing-page') { | 
                                                        |
| 206 | +		add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2); | 
                                                        |
| 207 | + echo avia_title();  | 
                                                        |
| 208 | +	} elseif ($page == 'add-listing-page') { | 
                                                        |
| 209 | +		add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2); | 
                                                        |
| 210 | + echo avia_title();  | 
                                                        |
| 211 | + }  | 
                                                        |
| 212 | 212 | |
| 213 | 213 | }  | 
                                                        
| 214 | 214 | |
@@ -223,22 +223,22 @@ discard block  | 
                                                    ||
| 223 | 223 | */  | 
                                                        
| 224 | 224 | function enfold_detail_breadcrum($trail, $args)  | 
                                                        
| 225 | 225 |  { | 
                                                        
| 226 | - ob_start(); // Start buffering;  | 
                                                        |
| 227 | - geodir_breadcrumb();  | 
                                                        |
| 228 | - $gd_crums = ob_get_clean();  | 
                                                        |
| 229 | -    if ($gd_crums) { | 
                                                        |
| 230 | -        $gd_crums = str_replace('<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs"><li>', "", $gd_crums); | 
                                                        |
| 231 | -        $gd_crums = str_replace('</li></ul></div>', "", $gd_crums); | 
                                                        |
| 232 | -        $gd_crums = str_replace(' > ', " > ", $gd_crums); | 
                                                        |
| 233 | -        $gd_crums = str_replace('</li><li>', "", $gd_crums); | 
                                                        |
| 234 | -        $gd_crums = explode(" > ", $gd_crums); | 
                                                        |
| 235 | - $trail_end = array_pop($gd_crums);  | 
                                                        |
| 236 | - $gd_crums['trail_end'] = $trail_end;  | 
                                                        |
| 237 | - //print_r($gd_crums);  | 
                                                        |
| 238 | - //print_r($trail);  | 
                                                        |
| 239 | - $trail = $gd_crums;  | 
                                                        |
| 240 | - }  | 
                                                        |
| 241 | - return $trail;  | 
                                                        |
| 226 | + ob_start(); // Start buffering;  | 
                                                        |
| 227 | + geodir_breadcrumb();  | 
                                                        |
| 228 | + $gd_crums = ob_get_clean();  | 
                                                        |
| 229 | +	if ($gd_crums) { | 
                                                        |
| 230 | +		$gd_crums = str_replace('<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs"><li>', "", $gd_crums); | 
                                                        |
| 231 | +		$gd_crums = str_replace('</li></ul></div>', "", $gd_crums); | 
                                                        |
| 232 | +		$gd_crums = str_replace(' > ', " > ", $gd_crums); | 
                                                        |
| 233 | +		$gd_crums = str_replace('</li><li>', "", $gd_crums); | 
                                                        |
| 234 | +		$gd_crums = explode(" > ", $gd_crums); | 
                                                        |
| 235 | + $trail_end = array_pop($gd_crums);  | 
                                                        |
| 236 | + $gd_crums['trail_end'] = $trail_end;  | 
                                                        |
| 237 | + //print_r($gd_crums);  | 
                                                        |
| 238 | + //print_r($trail);  | 
                                                        |
| 239 | + $trail = $gd_crums;  | 
                                                        |
| 240 | + }  | 
                                                        |
| 241 | + return $trail;  | 
                                                        |
| 242 | 242 | }  | 
                                                        
| 243 | 243 | |
| 244 | 244 | |
@@ -253,12 +253,12 @@ discard block  | 
                                                    ||
| 253 | 253 | */  | 
                                                        
| 254 | 254 | function enfold_action_wrapper_content_open($type = '', $id = '', $class = '')  | 
                                                        
| 255 | 255 |  { | 
                                                        
| 256 | -    if (geodir_is_page('login')) { | 
                                                        |
| 257 | -        echo "<main class='template-page content twelve alpha units " . $class . "' " . avia_markup_helper(array('context' => 'content', 'post_type' => 'page', 'echo' => false)) . ">"; | 
                                                        |
| 258 | -    } else { | 
                                                        |
| 259 | -        echo "<main class='template-page content " . avia_layout_class('content', false) . " units " . $class . "' " . avia_markup_helper(array('context' => 'content', 'post_type' => 'page', 'echo' => false)) . ">"; | 
                                                        |
| 260 | - }  | 
                                                        |
| 261 | - echo '<div class="entry-content-wrapper">';  | 
                                                        |
| 256 | +	if (geodir_is_page('login')) { | 
                                                        |
| 257 | +		echo "<main class='template-page content twelve alpha units " . $class . "' " . avia_markup_helper(array('context' => 'content', 'post_type' => 'page', 'echo' => false)) . ">"; | 
                                                        |
| 258 | +	} else { | 
                                                        |
| 259 | +		echo "<main class='template-page content " . avia_layout_class('content', false) . " units " . $class . "' " . avia_markup_helper(array('context' => 'content', 'post_type' => 'page', 'echo' => false)) . ">"; | 
                                                        |
| 260 | + }  | 
                                                        |
| 261 | + echo '<div class="entry-content-wrapper">';  | 
                                                        |
| 262 | 262 | }  | 
                                                        
| 263 | 263 | |
| 264 | 264 | |
@@ -274,9 +274,9 @@ discard block  | 
                                                    ||
| 274 | 274 | */  | 
                                                        
| 275 | 275 | function enfold_action_sidebar_right_open($type = '', $id = '', $class = '', $itemtype = '')  | 
                                                        
| 276 | 276 |  { | 
                                                        
| 277 | -    $sidebar_smartphone = avia_get_option('smartphones_sidebar') == 'smartphones_sidebar' ? 'smartphones_sidebar_active' : ""; | 
                                                        |
| 278 | -    echo "<aside class='sidebar sidebar_right " . $sidebar_smartphone . " " . avia_layout_class('sidebar', false) . " units' " . avia_markup_helper(array('context' => 'sidebar', 'echo' => false)) . ">"; | 
                                                        |
| 279 | - echo "<div class='inner_sidebar extralight-border'>";  | 
                                                        |
| 277 | +	$sidebar_smartphone = avia_get_option('smartphones_sidebar') == 'smartphones_sidebar' ? 'smartphones_sidebar_active' : ""; | 
                                                        |
| 278 | +	echo "<aside class='sidebar sidebar_right " . $sidebar_smartphone . " " . avia_layout_class('sidebar', false) . " units' " . avia_markup_helper(array('context' => 'sidebar', 'echo' => false)) . ">"; | 
                                                        |
| 279 | + echo "<div class='inner_sidebar extralight-border'>";  | 
                                                        |
| 280 | 280 | }  | 
                                                        
| 281 | 281 | |
| 282 | 282 | /**  | 
                                                        
@@ -291,9 +291,9 @@ discard block  | 
                                                    ||
| 291 | 291 | */  | 
                                                        
| 292 | 292 | function enfold_action_sidebar_left_open($type = '', $id = '', $class = '', $itemtype = '')  | 
                                                        
| 293 | 293 |  { | 
                                                        
| 294 | -    $sidebar_smartphone = avia_get_option('smartphones_sidebar') == 'smartphones_sidebar' ? 'smartphones_sidebar_active' : ""; | 
                                                        |
| 295 | -    echo "<aside class='sidebar sidebar_left " . $sidebar_smartphone . " " . avia_layout_class('sidebar', false) . " units' " . avia_markup_helper(array('context' => 'sidebar', 'echo' => false)) . ">"; | 
                                                        |
| 296 | - echo "<div class='inner_sidebar extralight-border'>";  | 
                                                        |
| 294 | +	$sidebar_smartphone = avia_get_option('smartphones_sidebar') == 'smartphones_sidebar' ? 'smartphones_sidebar_active' : ""; | 
                                                        |
| 295 | +	echo "<aside class='sidebar sidebar_left " . $sidebar_smartphone . " " . avia_layout_class('sidebar', false) . " units' " . avia_markup_helper(array('context' => 'sidebar', 'echo' => false)) . ">"; | 
                                                        |
| 296 | + echo "<div class='inner_sidebar extralight-border'>";  | 
                                                        |
| 297 | 297 | }  | 
                                                        
| 298 | 298 | |
| 299 | 299 | |
@@ -307,7 +307,7 @@ discard block  | 
                                                    ||
| 307 | 307 | */  | 
                                                        
| 308 | 308 | function gd_enfold_remove_maps_api($call)  | 
                                                        
| 309 | 309 |  { | 
                                                        
| 310 | - return false;  | 
                                                        |
| 310 | + return false;  | 
                                                        |
| 311 | 311 | }  | 
                                                        
| 312 | 312 | |
| 313 | 313 | |
@@ -162,7 +162,7 @@ discard block  | 
                                                    ||
| 162 | 162 | */  | 
                                                        
| 163 | 163 | function enfold_action_wrapper_open()  | 
                                                        
| 164 | 164 |  { | 
                                                        
| 165 | -    echo "<div class='container_wrap container_wrap_first main_color " . avia_layout_class('main', false) . "'>"; | 
                                                        |
| 165 | +    echo "<div class='container_wrap container_wrap_first main_color ".avia_layout_class('main', false)."'>"; | 
                                                        |
| 166 | 166 | echo "<div class='container template-blog '>";  | 
                                                        
| 167 | 167 | }  | 
                                                        
| 168 | 168 | |
@@ -254,9 +254,9 @@ discard block  | 
                                                    ||
| 254 | 254 | function enfold_action_wrapper_content_open($type = '', $id = '', $class = '')  | 
                                                        
| 255 | 255 |  { | 
                                                        
| 256 | 256 |      if (geodir_is_page('login')) { | 
                                                        
| 257 | -        echo "<main class='template-page content twelve alpha units " . $class . "' " . avia_markup_helper(array('context' => 'content', 'post_type' => 'page', 'echo' => false)) . ">"; | 
                                                        |
| 257 | +        echo "<main class='template-page content twelve alpha units ".$class."' ".avia_markup_helper(array('context' => 'content', 'post_type' => 'page', 'echo' => false)).">"; | 
                                                        |
| 258 | 258 |      } else { | 
                                                        
| 259 | -        echo "<main class='template-page content " . avia_layout_class('content', false) . " units " . $class . "' " . avia_markup_helper(array('context' => 'content', 'post_type' => 'page', 'echo' => false)) . ">"; | 
                                                        |
| 259 | +        echo "<main class='template-page content ".avia_layout_class('content', false)." units ".$class."' ".avia_markup_helper(array('context' => 'content', 'post_type' => 'page', 'echo' => false)).">"; | 
                                                        |
| 260 | 260 | }  | 
                                                        
| 261 | 261 | echo '<div class="entry-content-wrapper">';  | 
                                                        
| 262 | 262 | }  | 
                                                        
@@ -275,7 +275,7 @@ discard block  | 
                                                    ||
| 275 | 275 | function enfold_action_sidebar_right_open($type = '', $id = '', $class = '', $itemtype = '')  | 
                                                        
| 276 | 276 |  { | 
                                                        
| 277 | 277 |      $sidebar_smartphone = avia_get_option('smartphones_sidebar') == 'smartphones_sidebar' ? 'smartphones_sidebar_active' : ""; | 
                                                        
| 278 | -    echo "<aside class='sidebar sidebar_right " . $sidebar_smartphone . " " . avia_layout_class('sidebar', false) . " units' " . avia_markup_helper(array('context' => 'sidebar', 'echo' => false)) . ">"; | 
                                                        |
| 278 | +    echo "<aside class='sidebar sidebar_right ".$sidebar_smartphone." ".avia_layout_class('sidebar', false)." units' ".avia_markup_helper(array('context' => 'sidebar', 'echo' => false)).">"; | 
                                                        |
| 279 | 279 | echo "<div class='inner_sidebar extralight-border'>";  | 
                                                        
| 280 | 280 | }  | 
                                                        
| 281 | 281 | |
@@ -292,7 +292,7 @@ discard block  | 
                                                    ||
| 292 | 292 | function enfold_action_sidebar_left_open($type = '', $id = '', $class = '', $itemtype = '')  | 
                                                        
| 293 | 293 |  { | 
                                                        
| 294 | 294 |      $sidebar_smartphone = avia_get_option('smartphones_sidebar') == 'smartphones_sidebar' ? 'smartphones_sidebar_active' : ""; | 
                                                        
| 295 | -    echo "<aside class='sidebar sidebar_left " . $sidebar_smartphone . " " . avia_layout_class('sidebar', false) . " units' " . avia_markup_helper(array('context' => 'sidebar', 'echo' => false)) . ">"; | 
                                                        |
| 295 | +    echo "<aside class='sidebar sidebar_left ".$sidebar_smartphone." ".avia_layout_class('sidebar', false)." units' ".avia_markup_helper(array('context' => 'sidebar', 'echo' => false)).">"; | 
                                                        |
| 296 | 296 | echo "<div class='inner_sidebar extralight-border'>";  | 
                                                        
| 297 | 297 | }  | 
                                                        
| 298 | 298 | |
@@ -113,7 +113,7 @@  | 
                                                    ||
| 113 | 113 | * @since 1.0.0  | 
                                                        
| 114 | 114 | * @package GeoDirectory  | 
                                                        
| 115 | 115 | * @param array $classes Class array.  | 
                                                        
| 116 | - * @return array Modified class array.  | 
                                                        |
| 116 | + * @return string[] Modified class array.  | 
                                                        |
| 117 | 117 | */  | 
                                                        
| 118 | 118 | function geodir_x_body_class($classes)  | 
                                                        
| 119 | 119 |  { | 
                                                        
@@ -183,7 +183,7 @@ discard block  | 
                                                    ||
| 183 | 183 | echo '<div class="x-main full" role="main">';  | 
                                                        
| 184 | 184 |      } elseif ($stack == 'ethos') { | 
                                                        
| 185 | 185 | echo '<div class="x-container-fluid x-container max width main"><div class="offset cf">';  | 
                                                        
| 186 | -    }else{ | 
                                                        |
| 186 | +    } else{ | 
                                                        |
| 187 | 187 | echo '<div class="x-container max width offset">';  | 
                                                        
| 188 | 188 | }  | 
                                                        
| 189 | 189 | }  | 
                                                        
@@ -344,7 +344,9 @@ discard block  | 
                                                    ||
| 344 | 344 | echo '<div class="x-breadcrumbs"><a href="' . $home_link . '">' . $home_text . '</a>' . $delimiter;  | 
                                                        
| 345 | 345 |                      if (is_category()) { | 
                                                        
| 346 | 346 |                          $the_cat = get_category(get_query_var('cat'), false); | 
                                                        
| 347 | - if ($the_cat->parent != 0) echo get_category_parents($the_cat->parent, TRUE, $delimiter);  | 
                                                        |
| 347 | +                        if ($the_cat->parent != 0) { | 
                                                        |
| 348 | + echo get_category_parents($the_cat->parent, TRUE, $delimiter);  | 
                                                        |
| 349 | + }  | 
                                                        |
| 348 | 350 |                          echo $current_before . single_cat_title('', false) . $current_after; | 
                                                        
| 349 | 351 |                      } elseif (x_is_product_category()) { | 
                                                        
| 350 | 352 |                          echo $shop_link . $delimiter . $current_before . single_cat_title('', false) . $current_after; | 
                                                        
@@ -379,7 +381,9 @@ discard block  | 
                                                    ||
| 379 | 381 | $breadcrumbs = array_reverse($breadcrumbs);  | 
                                                        
| 380 | 382 |                          for ($i = 0; $i < count($breadcrumbs); $i++) { | 
                                                        
| 381 | 383 | echo $breadcrumbs[$i];  | 
                                                        
| 382 | - if ($i != count($breadcrumbs) - 1) echo $delimiter;  | 
                                                        |
| 384 | +                            if ($i != count($breadcrumbs) - 1) { | 
                                                        |
| 385 | + echo $delimiter;  | 
                                                        |
| 386 | + }  | 
                                                        |
| 383 | 387 | }  | 
                                                        
| 384 | 388 | echo $delimiter . $current_before . $page_title . $current_after;  | 
                                                        
| 385 | 389 |                      } elseif (is_tag()) { | 
                                                        
@@ -22,60 +22,60 @@ discard block  | 
                                                    ||
| 22 | 22 | function geodir_x_action_calls()  | 
                                                        
| 23 | 23 |  { | 
                                                        
| 24 | 24 | |
| 25 | - /* ACTIONS  | 
                                                        |
| 25 | + /* ACTIONS  | 
                                                        |
| 26 | 26 | ****************************************************************************************/  | 
                                                        
| 27 | 27 | |
| 28 | - // Add body class for styling purposes  | 
                                                        |
| 29 | -    add_filter('body_class', 'geodir_x_body_class'); | 
                                                        |
| 28 | + // Add body class for styling purposes  | 
                                                        |
| 29 | +	add_filter('body_class', 'geodir_x_body_class'); | 
                                                        |
| 30 | 30 | |
| 31 | - // HOME TOP SIDEBAR  | 
                                                        |
| 32 | - //remove_action( 'geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10 );  | 
                                                        |
| 33 | - //remove_action( 'geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10 );  | 
                                                        |
| 34 | - //add_action( 'geodir_wrapper_open', 'geodir_x_home_sidebar', 5 );  | 
                                                        |
| 35 | -    add_action('geodir_before_search_form', 'geodir_x_search_container_open'); | 
                                                        |
| 36 | -    add_action('geodir_after_search_form', 'geodir_x_search_container_close'); | 
                                                        |
| 31 | + // HOME TOP SIDEBAR  | 
                                                        |
| 32 | + //remove_action( 'geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10 );  | 
                                                        |
| 33 | + //remove_action( 'geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10 );  | 
                                                        |
| 34 | + //add_action( 'geodir_wrapper_open', 'geodir_x_home_sidebar', 5 );  | 
                                                        |
| 35 | +	add_action('geodir_before_search_form', 'geodir_x_search_container_open'); | 
                                                        |
| 36 | +	add_action('geodir_after_search_form', 'geodir_x_search_container_close'); | 
                                                        |
| 37 | 37 | |
| 38 | - // WRAPPER OPEN ACTIONS  | 
                                                        |
| 39 | -    remove_action('geodir_wrapper_open', 'geodir_action_wrapper_open', 10); | 
                                                        |
| 40 | -    add_action('geodir_wrapper_open', 'geodir_x_action_wrapper_open', 9); | 
                                                        |
| 38 | + // WRAPPER OPEN ACTIONS  | 
                                                        |
| 39 | +	remove_action('geodir_wrapper_open', 'geodir_action_wrapper_open', 10); | 
                                                        |
| 40 | +	add_action('geodir_wrapper_open', 'geodir_x_action_wrapper_open', 9); | 
                                                        |
| 41 | 41 | |
| 42 | - // WRAPPER CLOSE ACTIONS  | 
                                                        |
| 43 | -    remove_action('geodir_wrapper_close', 'geodir_action_wrapper_close', 10); | 
                                                        |
| 44 | -    add_action('geodir_wrapper_close', 'geodir_x_action_wrapper_close', 11); | 
                                                        |
| 42 | + // WRAPPER CLOSE ACTIONS  | 
                                                        |
| 43 | +	remove_action('geodir_wrapper_close', 'geodir_action_wrapper_close', 10); | 
                                                        |
| 44 | +	add_action('geodir_wrapper_close', 'geodir_x_action_wrapper_close', 11); | 
                                                        |
| 45 | 45 | |
| 46 | - // WRAPPER CONTENT OPEN ACTIONS  | 
                                                        |
| 47 | -    remove_action('geodir_wrapper_content_open', 'geodir_action_wrapper_content_open', 10); | 
                                                        |
| 48 | -    add_action('geodir_wrapper_content_open', 'geodir_x_action_wrapper_content_open', 9, 3); | 
                                                        |
| 46 | + // WRAPPER CONTENT OPEN ACTIONS  | 
                                                        |
| 47 | +	remove_action('geodir_wrapper_content_open', 'geodir_action_wrapper_content_open', 10); | 
                                                        |
| 48 | +	add_action('geodir_wrapper_content_open', 'geodir_x_action_wrapper_content_open', 9, 3); | 
                                                        |
| 49 | 49 | |
| 50 | - // WRAPPER CONTENT CLOSE ACTIONS  | 
                                                        |
| 51 | -    remove_action('geodir_wrapper_content_close', 'geodir_action_wrapper_content_close', 10); | 
                                                        |
| 52 | -    add_action('geodir_wrapper_content_close', 'geodir_x_action_wrapper_content_close', 11); | 
                                                        |
| 50 | + // WRAPPER CONTENT CLOSE ACTIONS  | 
                                                        |
| 51 | +	remove_action('geodir_wrapper_content_close', 'geodir_action_wrapper_content_close', 10); | 
                                                        |
| 52 | +	add_action('geodir_wrapper_content_close', 'geodir_x_action_wrapper_content_close', 11); | 
                                                        |
| 53 | 53 | |
| 54 | - // SIDEBAR RIGHT OPEN ACTIONS  | 
                                                        |
| 55 | -    remove_action('geodir_sidebar_right_open', 'geodir_action_sidebar_right_open', 10); | 
                                                        |
| 56 | -    add_action('geodir_sidebar_right_open', 'geodir_x_action_sidebar_right_open', 10, 4); | 
                                                        |
| 54 | + // SIDEBAR RIGHT OPEN ACTIONS  | 
                                                        |
| 55 | +	remove_action('geodir_sidebar_right_open', 'geodir_action_sidebar_right_open', 10); | 
                                                        |
| 56 | +	add_action('geodir_sidebar_right_open', 'geodir_x_action_sidebar_right_open', 10, 4); | 
                                                        |
| 57 | 57 | |
| 58 | - // SIDEBAR RIGHT CLOSE ACTIONS  | 
                                                        |
| 59 | -    remove_action('geodir_sidebar_right_close', 'geodir_action_sidebar_right_close', 10); | 
                                                        |
| 60 | -    add_action('geodir_sidebar_right_close', 'geodir_x_action_sidebar_right_close', 10, 1); | 
                                                        |
| 58 | + // SIDEBAR RIGHT CLOSE ACTIONS  | 
                                                        |
| 59 | +	remove_action('geodir_sidebar_right_close', 'geodir_action_sidebar_right_close', 10); | 
                                                        |
| 60 | +	add_action('geodir_sidebar_right_close', 'geodir_x_action_sidebar_right_close', 10, 1); | 
                                                        |
| 61 | 61 | |
| 62 | - // REMOVE BREADCRUMBS  | 
                                                        |
| 63 | -    remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20); | 
                                                        |
| 64 | -    remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20); | 
                                                        |
| 65 | -    remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20); | 
                                                        |
| 66 | -    remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20); | 
                                                        |
| 67 | -    remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20); | 
                                                        |
| 68 | -    remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20); | 
                                                        |
| 62 | + // REMOVE BREADCRUMBS  | 
                                                        |
| 63 | +	remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20); | 
                                                        |
| 64 | +	remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20); | 
                                                        |
| 65 | +	remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20); | 
                                                        |
| 66 | +	remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20); | 
                                                        |
| 67 | +	remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20); | 
                                                        |
| 68 | +	remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20); | 
                                                        |
| 69 | 69 | |
| 70 | - // make top section wide  | 
                                                        |
| 71 | -    remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); | 
                                                        |
| 72 | -    remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); | 
                                                        |
| 73 | -    remove_action('geodir_author_before_main_content', 'geodir_action_geodir_sidebar_author_top', 10); | 
                                                        |
| 74 | -    remove_action('geodir_search_before_main_content', 'geodir_action_geodir_sidebar_search_top', 10); | 
                                                        |
| 75 | -    remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_sidebar_detail_top', 10); | 
                                                        |
| 76 | -    remove_action('geodir_listings_before_main_content', 'geodir_action_geodir_sidebar_listings_top', 10); | 
                                                        |
| 70 | + // make top section wide  | 
                                                        |
| 71 | +	remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); | 
                                                        |
| 72 | +	remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); | 
                                                        |
| 73 | +	remove_action('geodir_author_before_main_content', 'geodir_action_geodir_sidebar_author_top', 10); | 
                                                        |
| 74 | +	remove_action('geodir_search_before_main_content', 'geodir_action_geodir_sidebar_search_top', 10); | 
                                                        |
| 75 | +	remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_sidebar_detail_top', 10); | 
                                                        |
| 76 | +	remove_action('geodir_listings_before_main_content', 'geodir_action_geodir_sidebar_listings_top', 10); | 
                                                        |
| 77 | 77 | |
| 78 | -    add_action('geodir_wrapper_open', 'gd_X_compat_add_top_section_back', 5); | 
                                                        |
| 78 | +	add_action('geodir_wrapper_open', 'gd_X_compat_add_top_section_back', 5); | 
                                                        |
| 79 | 79 | |
| 80 | 80 | |
| 81 | 81 | } // Close geodir_x_action_calls  | 
                                                        
@@ -92,17 +92,17 @@ discard block  | 
                                                    ||
| 92 | 92 | function gd_X_compat_add_top_section_back()  | 
                                                        
| 93 | 93 |  { | 
                                                        
| 94 | 94 | |
| 95 | -    if (is_page_geodir_home() || geodir_is_page('location')) { | 
                                                        |
| 96 | - geodir_action_geodir_sidebar_home_top();  | 
                                                        |
| 97 | -    } elseif (geodir_is_page('listing')) { | 
                                                        |
| 98 | - geodir_action_geodir_sidebar_listings_top();  | 
                                                        |
| 99 | -    } elseif (geodir_is_page('detail')) { | 
                                                        |
| 100 | - geodir_action_geodir_sidebar_detail_top();  | 
                                                        |
| 101 | -    } elseif (geodir_is_page('search')) { | 
                                                        |
| 102 | - geodir_action_geodir_sidebar_search_top();  | 
                                                        |
| 103 | -    } elseif (geodir_is_page('author')) { | 
                                                        |
| 104 | - geodir_action_geodir_sidebar_author_top();  | 
                                                        |
| 105 | - }  | 
                                                        |
| 95 | +	if (is_page_geodir_home() || geodir_is_page('location')) { | 
                                                        |
| 96 | + geodir_action_geodir_sidebar_home_top();  | 
                                                        |
| 97 | +	} elseif (geodir_is_page('listing')) { | 
                                                        |
| 98 | + geodir_action_geodir_sidebar_listings_top();  | 
                                                        |
| 99 | +	} elseif (geodir_is_page('detail')) { | 
                                                        |
| 100 | + geodir_action_geodir_sidebar_detail_top();  | 
                                                        |
| 101 | +	} elseif (geodir_is_page('search')) { | 
                                                        |
| 102 | + geodir_action_geodir_sidebar_search_top();  | 
                                                        |
| 103 | +	} elseif (geodir_is_page('author')) { | 
                                                        |
| 104 | + geodir_action_geodir_sidebar_author_top();  | 
                                                        |
| 105 | + }  | 
                                                        |
| 106 | 106 | |
| 107 | 107 | |
| 108 | 108 | }  | 
                                                        
@@ -120,12 +120,12 @@ discard block  | 
                                                    ||
| 120 | 120 | */  | 
                                                        
| 121 | 121 | function geodir_x_body_class($classes)  | 
                                                        
| 122 | 122 |  { | 
                                                        
| 123 | - $classes[] = 'geodir-x';  | 
                                                        |
| 123 | + $classes[] = 'geodir-x';  | 
                                                        |
| 124 | 124 | |
| 125 | -    if(isset($_REQUEST['geodir_search'])){ | 
                                                        |
| 126 | - $classes[] = 'geodir-x-search';  | 
                                                        |
| 127 | - }  | 
                                                        |
| 128 | - return $classes;  | 
                                                        |
| 125 | +	if(isset($_REQUEST['geodir_search'])){ | 
                                                        |
| 126 | + $classes[] = 'geodir-x-search';  | 
                                                        |
| 127 | + }  | 
                                                        |
| 128 | + return $classes;  | 
                                                        |
| 129 | 129 | }  | 
                                                        
| 130 | 130 | |
| 131 | 131 | /**  | 
                                                        
@@ -137,14 +137,14 @@ discard block  | 
                                                    ||
| 137 | 137 | */  | 
                                                        
| 138 | 138 | function geodir_x_home_sidebar()  | 
                                                        
| 139 | 139 |  { | 
                                                        
| 140 | -    //if ( geodir_is_geodir_page() ) { | 
                                                        |
| 141 | - global $wp;  | 
                                                        |
| 142 | -    if ($wp->query_vars['page_id'] == geodir_location_page_id() || is_home() && !geodir_is_page('login')) { | 
                                                        |
| 143 | - echo '<div class="x-main full">';  | 
                                                        |
| 144 | -        dynamic_sidebar('geodir_home_top'); | 
                                                        |
| 145 | - echo '</div>';  | 
                                                        |
| 146 | - }  | 
                                                        |
| 147 | - //}  | 
                                                        |
| 140 | +	//if ( geodir_is_geodir_page() ) { | 
                                                        |
| 141 | + global $wp;  | 
                                                        |
| 142 | +	if ($wp->query_vars['page_id'] == geodir_location_page_id() || is_home() && !geodir_is_page('login')) { | 
                                                        |
| 143 | + echo '<div class="x-main full">';  | 
                                                        |
| 144 | +		dynamic_sidebar('geodir_home_top'); | 
                                                        |
| 145 | + echo '</div>';  | 
                                                        |
| 146 | + }  | 
                                                        |
| 147 | + //}  | 
                                                        |
| 148 | 148 | }  | 
                                                        
| 149 | 149 | |
| 150 | 150 | /**  | 
                                                        
@@ -155,7 +155,7 @@ discard block  | 
                                                    ||
| 155 | 155 | */  | 
                                                        
| 156 | 156 | function geodir_x_search_container_open()  | 
                                                        
| 157 | 157 |  { | 
                                                        
| 158 | - echo '<div class="x-container-fluid x-container max">';  | 
                                                        |
| 158 | + echo '<div class="x-container-fluid x-container max">';  | 
                                                        |
| 159 | 159 | }  | 
                                                        
| 160 | 160 | |
| 161 | 161 | /**  | 
                                                        
@@ -166,7 +166,7 @@ discard block  | 
                                                    ||
| 166 | 166 | */  | 
                                                        
| 167 | 167 | function geodir_x_search_container_close()  | 
                                                        
| 168 | 168 |  { | 
                                                        
| 169 | - echo '</div>';  | 
                                                        |
| 169 | + echo '</div>';  | 
                                                        |
| 170 | 170 | }  | 
                                                        
| 171 | 171 | |
| 172 | 172 | /**  | 
                                                        
@@ -177,19 +177,19 @@ discard block  | 
                                                    ||
| 177 | 177 | */  | 
                                                        
| 178 | 178 | function geodir_x_action_wrapper_open()  | 
                                                        
| 179 | 179 |  { | 
                                                        
| 180 | - $stack = x_get_stack();  | 
                                                        |
| 181 | -  | 
                                                        |
| 182 | -    if ($stack == 'integrity') { | 
                                                        |
| 183 | - echo '<div class="x-container-fluid x-container max width offset">';  | 
                                                        |
| 184 | -    } elseif ($stack == 'renew') { | 
                                                        |
| 185 | - echo '<div class="x-container-fluid x-container max width offset cf">';  | 
                                                        |
| 186 | -    } elseif ($stack == 'icon') { | 
                                                        |
| 187 | - echo '<div class="x-main full" role="main">';  | 
                                                        |
| 188 | -    } elseif ($stack == 'ethos') { | 
                                                        |
| 189 | - echo '<div class="x-container-fluid x-container max width main"><div class="offset cf">';  | 
                                                        |
| 190 | -    }else{ | 
                                                        |
| 191 | - echo '<div class="x-container max width offset">';  | 
                                                        |
| 192 | - }  | 
                                                        |
| 180 | + $stack = x_get_stack();  | 
                                                        |
| 181 | +  | 
                                                        |
| 182 | +	if ($stack == 'integrity') { | 
                                                        |
| 183 | + echo '<div class="x-container-fluid x-container max width offset">';  | 
                                                        |
| 184 | +	} elseif ($stack == 'renew') { | 
                                                        |
| 185 | + echo '<div class="x-container-fluid x-container max width offset cf">';  | 
                                                        |
| 186 | +	} elseif ($stack == 'icon') { | 
                                                        |
| 187 | + echo '<div class="x-main full" role="main">';  | 
                                                        |
| 188 | +	} elseif ($stack == 'ethos') { | 
                                                        |
| 189 | + echo '<div class="x-container-fluid x-container max width main"><div class="offset cf">';  | 
                                                        |
| 190 | +	}else{ | 
                                                        |
| 191 | + echo '<div class="x-container max width offset">';  | 
                                                        |
| 192 | + }  | 
                                                        |
| 193 | 193 | }  | 
                                                        
| 194 | 194 | |
| 195 | 195 | /**  | 
                                                        
@@ -200,12 +200,12 @@ discard block  | 
                                                    ||
| 200 | 200 | */  | 
                                                        
| 201 | 201 | function geodir_x_action_wrapper_close()  | 
                                                        
| 202 | 202 |  { | 
                                                        
| 203 | - $stack = x_get_stack();  | 
                                                        |
| 204 | -    if ($stack == 'ethos') { | 
                                                        |
| 205 | - echo '</div></div>';  | 
                                                        |
| 206 | -    } else { | 
                                                        |
| 207 | - echo '</div>';  | 
                                                        |
| 208 | - }  | 
                                                        |
| 203 | + $stack = x_get_stack();  | 
                                                        |
| 204 | +	if ($stack == 'ethos') { | 
                                                        |
| 205 | + echo '</div></div>';  | 
                                                        |
| 206 | +	} else { | 
                                                        |
| 207 | + echo '</div>';  | 
                                                        |
| 208 | + }  | 
                                                        |
| 209 | 209 | }  | 
                                                        
| 210 | 210 | |
| 211 | 211 | /**  | 
                                                        
@@ -219,9 +219,9 @@ discard block  | 
                                                    ||
| 219 | 219 | */  | 
                                                        
| 220 | 220 | function geodir_x_action_wrapper_content_open($type = '', $id = '', $class = '')  | 
                                                        
| 221 | 221 |  { | 
                                                        
| 222 | - $content_class = ' entry-wrap ';  | 
                                                        |
| 222 | + $content_class = ' entry-wrap ';  | 
                                                        |
| 223 | 223 | |
| 224 | - echo '<div class="x-main left ' . $class . $content_class . ' " role="main">';  | 
                                                        |
| 224 | + echo '<div class="x-main left ' . $class . $content_class . ' " role="main">';  | 
                                                        |
| 225 | 225 | }  | 
                                                        
| 226 | 226 | |
| 227 | 227 | /**  | 
                                                        
@@ -232,7 +232,7 @@ discard block  | 
                                                    ||
| 232 | 232 | */  | 
                                                        
| 233 | 233 | function geodir_x_action_wrapper_content_close()  | 
                                                        
| 234 | 234 |  { | 
                                                        
| 235 | - echo '</div>';  | 
                                                        |
| 235 | + echo '</div>';  | 
                                                        |
| 236 | 236 | }  | 
                                                        
| 237 | 237 | |
| 238 | 238 | /**  | 
                                                        
@@ -247,7 +247,7 @@ discard block  | 
                                                    ||
| 247 | 247 | */  | 
                                                        
| 248 | 248 | function geodir_x_action_sidebar_right_open($type = '', $id = '', $class = '', $itemtype = '')  | 
                                                        
| 249 | 249 |  { | 
                                                        
| 250 | - echo '<aside class="x-sidebar right" role="complementary" itemscope itemtype="' . $itemtype . '">';  | 
                                                        |
| 250 | + echo '<aside class="x-sidebar right" role="complementary" itemscope itemtype="' . $itemtype . '">';  | 
                                                        |
| 251 | 251 | }  | 
                                                        
| 252 | 252 | |
| 253 | 253 | /**  | 
                                                        
@@ -259,7 +259,7 @@ discard block  | 
                                                    ||
| 259 | 259 | */  | 
                                                        
| 260 | 260 | function geodir_x_action_sidebar_right_close($type = '')  | 
                                                        
| 261 | 261 |  { | 
                                                        
| 262 | - echo '</aside>';  | 
                                                        |
| 262 | + echo '</aside>';  | 
                                                        |
| 263 | 263 | }  | 
                                                        
| 264 | 264 | |
| 265 | 265 |  add_filter('geodir_breadcrumb', 'geodir_x_breadcrumb'); | 
                                                        
@@ -273,12 +273,12 @@ discard block  | 
                                                    ||
| 273 | 273 | */  | 
                                                        
| 274 | 274 | function geodir_x_breadcrumb($breadcrumb)  | 
                                                        
| 275 | 275 |  { | 
                                                        
| 276 | -    $breadcrumb = str_replace('<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs">', '', $breadcrumb); | 
                                                        |
| 277 | -    $breadcrumb = str_replace('<li>', '', $breadcrumb); | 
                                                        |
| 278 | -    $breadcrumb = str_replace('</li>', '', $breadcrumb); | 
                                                        |
| 279 | -    $breadcrumb = str_replace('Home', '<span class="home"><i class="x-icon-home"></i></span>', $breadcrumb); | 
                                                        |
| 280 | -    $breadcrumb = str_replace('</ul></div>', '', $breadcrumb); | 
                                                        |
| 281 | - return $breadcrumb;  | 
                                                        |
| 276 | +	$breadcrumb = str_replace('<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs">', '', $breadcrumb); | 
                                                        |
| 277 | +	$breadcrumb = str_replace('<li>', '', $breadcrumb); | 
                                                        |
| 278 | +	$breadcrumb = str_replace('</li>', '', $breadcrumb); | 
                                                        |
| 279 | +	$breadcrumb = str_replace('Home', '<span class="home"><i class="x-icon-home"></i></span>', $breadcrumb); | 
                                                        |
| 280 | +	$breadcrumb = str_replace('</ul></div>', '', $breadcrumb); | 
                                                        |
| 281 | + return $breadcrumb;  | 
                                                        |
| 282 | 282 | }  | 
                                                        
| 283 | 283 | |
| 284 | 284 |  add_filter('geodir_breadcrumb_separator', 'geodir_x_breadcrumb_separator'); | 
                                                        
@@ -292,125 +292,125 @@ discard block  | 
                                                    ||
| 292 | 292 | */  | 
                                                        
| 293 | 293 | function geodir_x_breadcrumb_separator($separator)  | 
                                                        
| 294 | 294 |  { | 
                                                        
| 295 | -    $separator = str_replace(' > ', ' <span class="delimiter"><i class="x-icon-angle-right"></i></span> ', $separator); | 
                                                        |
| 296 | - return $separator;  | 
                                                        |
| 295 | +	$separator = str_replace(' > ', ' <span class="delimiter"><i class="x-icon-angle-right"></i></span> ', $separator); | 
                                                        |
| 296 | + return $separator;  | 
                                                        |
| 297 | 297 | }  | 
                                                        
| 298 | 298 | |
| 299 | 299 |  if (!function_exists('x_breadcrumbs')) : | 
                                                        
| 300 | - /**  | 
                                                        |
| 301 | - * breadcrumbs.  | 
                                                        |
| 302 | - *  | 
                                                        |
| 303 | - * @since 1.0.0  | 
                                                        |
| 304 | - * @package GeoDirectory  | 
                                                        |
| 305 | - */  | 
                                                        |
| 306 | - function x_breadcrumbs()  | 
                                                        |
| 307 | -    { | 
                                                        |
| 308 | -  | 
                                                        |
| 309 | -        if (x_get_option('x_breadcrumb_display', '1')) { | 
                                                        |
| 310 | -  | 
                                                        |
| 311 | - //  | 
                                                        |
| 312 | - // 1. Delimiter between crumbs.  | 
                                                        |
| 313 | - // 2. Output text for the "Home" link.  | 
                                                        |
| 314 | - // 3. Link to the home page.  | 
                                                        |
| 315 | - // 4. Tag before the current crumb.  | 
                                                        |
| 316 | - // 5. Tag after the current crumb.  | 
                                                        |
| 317 | - // 6. Get page title.  | 
                                                        |
| 318 | - // 7. Get blog title.  | 
                                                        |
| 319 | - // 8. Get shop title.  | 
                                                        |
| 320 | - //  | 
                                                        |
| 321 | -  | 
                                                        |
| 322 | - GLOBAL $post,$wp;  | 
                                                        |
| 323 | -  | 
                                                        |
| 324 | -            if (geodir_is_page('detail') || geodir_is_page('listing') || (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_location_page_id())) { | 
                                                        |
| 325 | - geodir_breadcrumb();  | 
                                                        |
| 326 | -            } else { | 
                                                        |
| 327 | -  | 
                                                        |
| 328 | - $stack = x_get_stack();  | 
                                                        |
| 329 | - $delimiter = ' <span class="delimiter"><i class="x-icon-angle-right"></i></span> '; // 1  | 
                                                        |
| 330 | - $home_text = '<span class="home"><i class="x-icon-home"></i></span>'; // 2  | 
                                                        |
| 331 | - $home_link = home_url(); // 3  | 
                                                        |
| 332 | - $current_before = '<span class="current">'; // 4  | 
                                                        |
| 333 | - $current_after = '</span>'; // 5  | 
                                                        |
| 334 | - $page_title = get_the_title(); // 6  | 
                                                        |
| 335 | -                $blog_title = get_the_title(get_option('page_for_posts', true));                 // 7 | 
                                                        |
| 336 | -                $shop_title = get_theme_mod('x_' . $stack . '_shop_title');                        // 8 | 
                                                        |
| 337 | -  | 
                                                        |
| 338 | -                if (function_exists('woocommerce_get_page_id')) { | 
                                                        |
| 339 | - $shop_url = x_get_shop_link();  | 
                                                        |
| 340 | - $shop_link = '<a href="' . $shop_url . '">' . $shop_title . '</a>';  | 
                                                        |
| 341 | - }  | 
                                                        |
| 342 | -  | 
                                                        |
| 343 | -                if (is_front_page()) { | 
                                                        |
| 344 | - echo '<div class="x-breadcrumbs">' . $current_before . $home_text . $current_after . '</div>';  | 
                                                        |
| 345 | -                } elseif (is_home()) { | 
                                                        |
| 346 | - echo '<div class="x-breadcrumbs"><a href="' . $home_link . '">' . $home_text . '</a>' . $delimiter . $current_before . $blog_title . $current_after . '</div>';  | 
                                                        |
| 347 | -                } else { | 
                                                        |
| 348 | - echo '<div class="x-breadcrumbs"><a href="' . $home_link . '">' . $home_text . '</a>' . $delimiter;  | 
                                                        |
| 349 | -                    if (is_category()) { | 
                                                        |
| 350 | -                        $the_cat = get_category(get_query_var('cat'), false); | 
                                                        |
| 351 | - if ($the_cat->parent != 0) echo get_category_parents($the_cat->parent, TRUE, $delimiter);  | 
                                                        |
| 352 | -                        echo $current_before . single_cat_title('', false) . $current_after; | 
                                                        |
| 353 | -                    } elseif (x_is_product_category()) { | 
                                                        |
| 354 | -                        echo $shop_link . $delimiter . $current_before . single_cat_title('', false) . $current_after; | 
                                                        |
| 355 | -                    } elseif (x_is_product_tag()) { | 
                                                        |
| 356 | -                        echo $shop_link . $delimiter . $current_before . single_tag_title('', false) . $current_after; | 
                                                        |
| 357 | -                    } elseif (is_search()) { | 
                                                        |
| 358 | -                        echo $current_before . __('Search Results for ', '__x__') . '“' . get_search_query() . '”' . $current_after; | 
                                                        |
| 359 | -                    } elseif (is_singular('post')) { | 
                                                        |
| 360 | -                        if (get_option('page_for_posts') == is_front_page()) { | 
                                                        |
| 361 | - echo $current_before . $page_title . $current_after;  | 
                                                        |
| 362 | -                        } else { | 
                                                        |
| 363 | -                            echo '<a href="' . get_permalink(get_option('page_for_posts')) . '" title="' . esc_attr(__('See All Posts', '__x__')) . '">' . $blog_title . '</a>' . $delimiter . $current_before . $page_title . $current_after; | 
                                                        |
| 364 | - }  | 
                                                        |
| 365 | -                    } elseif (x_is_portfolio()) { | 
                                                        |
| 366 | - echo $current_before . get_the_title() . $current_after;  | 
                                                        |
| 367 | -                    } elseif (x_is_portfolio_item()) { | 
                                                        |
| 368 | - $link = x_get_parent_portfolio_link();  | 
                                                        |
| 369 | - $title = x_get_parent_portfolio_title();  | 
                                                        |
| 370 | -                        echo '<a href="' . $link . '" title="' . esc_attr(__('See All Posts', '__x__')) . '">' . $title . '</a>' . $delimiter . $current_before . $page_title . $current_after; | 
                                                        |
| 371 | -                    } elseif (x_is_product()) { | 
                                                        |
| 372 | - echo $shop_link . $delimiter . $current_before . $page_title . $current_after;  | 
                                                        |
| 373 | -                    } elseif (is_page() && !$post->post_parent) { | 
                                                        |
| 374 | - echo $current_before . $page_title . $current_after;  | 
                                                        |
| 375 | -                    } elseif (is_page() && $post->post_parent) { | 
                                                        |
| 376 | - $parent_id = $post->post_parent;  | 
                                                        |
| 377 | - $breadcrumbs = array();  | 
                                                        |
| 378 | -                        while ($parent_id) { | 
                                                        |
| 379 | - $page = get_page($parent_id);  | 
                                                        |
| 380 | - $breadcrumbs[] = '<a href="' . get_permalink($page->ID) . '">' . get_the_title($page->ID) . '</a>';  | 
                                                        |
| 381 | - $parent_id = $page->post_parent;  | 
                                                        |
| 382 | - }  | 
                                                        |
| 383 | - $breadcrumbs = array_reverse($breadcrumbs);  | 
                                                        |
| 384 | -                        for ($i = 0; $i < count($breadcrumbs); $i++) { | 
                                                        |
| 385 | - echo $breadcrumbs[$i];  | 
                                                        |
| 386 | - if ($i != count($breadcrumbs) - 1) echo $delimiter;  | 
                                                        |
| 387 | - }  | 
                                                        |
| 388 | - echo $delimiter . $current_before . $page_title . $current_after;  | 
                                                        |
| 389 | -                    } elseif (is_tag()) { | 
                                                        |
| 390 | -                        echo $current_before . single_tag_title('', false) . $current_after; | 
                                                        |
| 391 | -                    } elseif (is_author()) { | 
                                                        |
| 392 | - GLOBAL $author;  | 
                                                        |
| 393 | - $userdata = get_userdata($author);  | 
                                                        |
| 394 | -                        echo $current_before . __('Posts by ', '__x__') . '“' . $userdata->display_name . $current_after . '”'; | 
                                                        |
| 395 | -                    } elseif (is_404()) { | 
                                                        |
| 396 | -                        echo $current_before . __('404 (Page Not Found)', '__x__') . $current_after; | 
                                                        |
| 397 | -                    } elseif (is_archive()) { | 
                                                        |
| 398 | -                        if (x_is_shop()) { | 
                                                        |
| 399 | - echo $current_before . $shop_title . $current_after;  | 
                                                        |
| 400 | -                        } else { | 
                                                        |
| 401 | -                            echo $current_before . __('Archives ', '__x__') . $current_after; | 
                                                        |
| 402 | - }  | 
                                                        |
| 403 | - }  | 
                                                        |
| 404 | -                    if (get_query_var('paged')) { | 
                                                        |
| 405 | -                        echo ' <span class="current" style="white-space: nowrap;">(' . __('Page', '__x__') . ' ' . get_query_var('paged') . ')</span>'; | 
                                                        |
| 406 | - }  | 
                                                        |
| 407 | - echo '</div>';  | 
                                                        |
| 408 | - }  | 
                                                        |
| 409 | -  | 
                                                        |
| 410 | - }  | 
                                                        |
| 411 | -  | 
                                                        |
| 412 | - }  | 
                                                        |
| 413 | - } // ends my geodir check  | 
                                                        |
| 300 | + /**  | 
                                                        |
| 301 | + * breadcrumbs.  | 
                                                        |
| 302 | + *  | 
                                                        |
| 303 | + * @since 1.0.0  | 
                                                        |
| 304 | + * @package GeoDirectory  | 
                                                        |
| 305 | + */  | 
                                                        |
| 306 | + function x_breadcrumbs()  | 
                                                        |
| 307 | +	{ | 
                                                        |
| 308 | +  | 
                                                        |
| 309 | +		if (x_get_option('x_breadcrumb_display', '1')) { | 
                                                        |
| 310 | +  | 
                                                        |
| 311 | + //  | 
                                                        |
| 312 | + // 1. Delimiter between crumbs.  | 
                                                        |
| 313 | + // 2. Output text for the "Home" link.  | 
                                                        |
| 314 | + // 3. Link to the home page.  | 
                                                        |
| 315 | + // 4. Tag before the current crumb.  | 
                                                        |
| 316 | + // 5. Tag after the current crumb.  | 
                                                        |
| 317 | + // 6. Get page title.  | 
                                                        |
| 318 | + // 7. Get blog title.  | 
                                                        |
| 319 | + // 8. Get shop title.  | 
                                                        |
| 320 | + //  | 
                                                        |
| 321 | +  | 
                                                        |
| 322 | + GLOBAL $post,$wp;  | 
                                                        |
| 323 | +  | 
                                                        |
| 324 | +			if (geodir_is_page('detail') || geodir_is_page('listing') || (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_location_page_id())) { | 
                                                        |
| 325 | + geodir_breadcrumb();  | 
                                                        |
| 326 | +			} else { | 
                                                        |
| 327 | +  | 
                                                        |
| 328 | + $stack = x_get_stack();  | 
                                                        |
| 329 | + $delimiter = ' <span class="delimiter"><i class="x-icon-angle-right"></i></span> '; // 1  | 
                                                        |
| 330 | + $home_text = '<span class="home"><i class="x-icon-home"></i></span>'; // 2  | 
                                                        |
| 331 | + $home_link = home_url(); // 3  | 
                                                        |
| 332 | + $current_before = '<span class="current">'; // 4  | 
                                                        |
| 333 | + $current_after = '</span>'; // 5  | 
                                                        |
| 334 | + $page_title = get_the_title(); // 6  | 
                                                        |
| 335 | +				$blog_title = get_the_title(get_option('page_for_posts', true));                 // 7 | 
                                                        |
| 336 | +				$shop_title = get_theme_mod('x_' . $stack . '_shop_title');                        // 8 | 
                                                        |
| 337 | +  | 
                                                        |
| 338 | +				if (function_exists('woocommerce_get_page_id')) { | 
                                                        |
| 339 | + $shop_url = x_get_shop_link();  | 
                                                        |
| 340 | + $shop_link = '<a href="' . $shop_url . '">' . $shop_title . '</a>';  | 
                                                        |
| 341 | + }  | 
                                                        |
| 342 | +  | 
                                                        |
| 343 | +				if (is_front_page()) { | 
                                                        |
| 344 | + echo '<div class="x-breadcrumbs">' . $current_before . $home_text . $current_after . '</div>';  | 
                                                        |
| 345 | +				} elseif (is_home()) { | 
                                                        |
| 346 | + echo '<div class="x-breadcrumbs"><a href="' . $home_link . '">' . $home_text . '</a>' . $delimiter . $current_before . $blog_title . $current_after . '</div>';  | 
                                                        |
| 347 | +				} else { | 
                                                        |
| 348 | + echo '<div class="x-breadcrumbs"><a href="' . $home_link . '">' . $home_text . '</a>' . $delimiter;  | 
                                                        |
| 349 | +					if (is_category()) { | 
                                                        |
| 350 | +						$the_cat = get_category(get_query_var('cat'), false); | 
                                                        |
| 351 | + if ($the_cat->parent != 0) echo get_category_parents($the_cat->parent, TRUE, $delimiter);  | 
                                                        |
| 352 | +						echo $current_before . single_cat_title('', false) . $current_after; | 
                                                        |
| 353 | +					} elseif (x_is_product_category()) { | 
                                                        |
| 354 | +						echo $shop_link . $delimiter . $current_before . single_cat_title('', false) . $current_after; | 
                                                        |
| 355 | +					} elseif (x_is_product_tag()) { | 
                                                        |
| 356 | +						echo $shop_link . $delimiter . $current_before . single_tag_title('', false) . $current_after; | 
                                                        |
| 357 | +					} elseif (is_search()) { | 
                                                        |
| 358 | +						echo $current_before . __('Search Results for ', '__x__') . '“' . get_search_query() . '”' . $current_after; | 
                                                        |
| 359 | +					} elseif (is_singular('post')) { | 
                                                        |
| 360 | +						if (get_option('page_for_posts') == is_front_page()) { | 
                                                        |
| 361 | + echo $current_before . $page_title . $current_after;  | 
                                                        |
| 362 | +						} else { | 
                                                        |
| 363 | +							echo '<a href="' . get_permalink(get_option('page_for_posts')) . '" title="' . esc_attr(__('See All Posts', '__x__')) . '">' . $blog_title . '</a>' . $delimiter . $current_before . $page_title . $current_after; | 
                                                        |
| 364 | + }  | 
                                                        |
| 365 | +					} elseif (x_is_portfolio()) { | 
                                                        |
| 366 | + echo $current_before . get_the_title() . $current_after;  | 
                                                        |
| 367 | +					} elseif (x_is_portfolio_item()) { | 
                                                        |
| 368 | + $link = x_get_parent_portfolio_link();  | 
                                                        |
| 369 | + $title = x_get_parent_portfolio_title();  | 
                                                        |
| 370 | +						echo '<a href="' . $link . '" title="' . esc_attr(__('See All Posts', '__x__')) . '">' . $title . '</a>' . $delimiter . $current_before . $page_title . $current_after; | 
                                                        |
| 371 | +					} elseif (x_is_product()) { | 
                                                        |
| 372 | + echo $shop_link . $delimiter . $current_before . $page_title . $current_after;  | 
                                                        |
| 373 | +					} elseif (is_page() && !$post->post_parent) { | 
                                                        |
| 374 | + echo $current_before . $page_title . $current_after;  | 
                                                        |
| 375 | +					} elseif (is_page() && $post->post_parent) { | 
                                                        |
| 376 | + $parent_id = $post->post_parent;  | 
                                                        |
| 377 | + $breadcrumbs = array();  | 
                                                        |
| 378 | +						while ($parent_id) { | 
                                                        |
| 379 | + $page = get_page($parent_id);  | 
                                                        |
| 380 | + $breadcrumbs[] = '<a href="' . get_permalink($page->ID) . '">' . get_the_title($page->ID) . '</a>';  | 
                                                        |
| 381 | + $parent_id = $page->post_parent;  | 
                                                        |
| 382 | + }  | 
                                                        |
| 383 | + $breadcrumbs = array_reverse($breadcrumbs);  | 
                                                        |
| 384 | +						for ($i = 0; $i < count($breadcrumbs); $i++) { | 
                                                        |
| 385 | + echo $breadcrumbs[$i];  | 
                                                        |
| 386 | + if ($i != count($breadcrumbs) - 1) echo $delimiter;  | 
                                                        |
| 387 | + }  | 
                                                        |
| 388 | + echo $delimiter . $current_before . $page_title . $current_after;  | 
                                                        |
| 389 | +					} elseif (is_tag()) { | 
                                                        |
| 390 | +						echo $current_before . single_tag_title('', false) . $current_after; | 
                                                        |
| 391 | +					} elseif (is_author()) { | 
                                                        |
| 392 | + GLOBAL $author;  | 
                                                        |
| 393 | + $userdata = get_userdata($author);  | 
                                                        |
| 394 | +						echo $current_before . __('Posts by ', '__x__') . '“' . $userdata->display_name . $current_after . '”'; | 
                                                        |
| 395 | +					} elseif (is_404()) { | 
                                                        |
| 396 | +						echo $current_before . __('404 (Page Not Found)', '__x__') . $current_after; | 
                                                        |
| 397 | +					} elseif (is_archive()) { | 
                                                        |
| 398 | +						if (x_is_shop()) { | 
                                                        |
| 399 | + echo $current_before . $shop_title . $current_after;  | 
                                                        |
| 400 | +						} else { | 
                                                        |
| 401 | +							echo $current_before . __('Archives ', '__x__') . $current_after; | 
                                                        |
| 402 | + }  | 
                                                        |
| 403 | + }  | 
                                                        |
| 404 | +					if (get_query_var('paged')) { | 
                                                        |
| 405 | +						echo ' <span class="current" style="white-space: nowrap;">(' . __('Page', '__x__') . ' ' . get_query_var('paged') . ')</span>'; | 
                                                        |
| 406 | + }  | 
                                                        |
| 407 | + echo '</div>';  | 
                                                        |
| 408 | + }  | 
                                                        |
| 409 | +  | 
                                                        |
| 410 | + }  | 
                                                        |
| 411 | +  | 
                                                        |
| 412 | + }  | 
                                                        |
| 413 | + } // ends my geodir check  | 
                                                        |
| 414 | 414 | endif;  | 
                                                        
| 415 | 415 | |
| 416 | 416 | |
@@ -425,8 +425,8 @@ discard block  | 
                                                    ||
| 425 | 425 | */  | 
                                                        
| 426 | 426 | function geodir_x_location_switcher_menu_li_class($class)  | 
                                                        
| 427 | 427 |  { | 
                                                        
| 428 | - $class .= " menu-item-has-children ";  | 
                                                        |
| 429 | - return $class;  | 
                                                        |
| 428 | + $class .= " menu-item-has-children ";  | 
                                                        |
| 429 | + return $class;  | 
                                                        |
| 430 | 430 | }  | 
                                                        
| 431 | 431 | |
| 432 | 432 |  add_filter('geodir_sub_menu_li_class', 'geodir_x_sub_menu_li_class', 10, 1); | 
                                                        
@@ -440,6 +440,6 @@ discard block  | 
                                                    ||
| 440 | 440 | */  | 
                                                        
| 441 | 441 | function geodir_x_sub_menu_li_class($class)  | 
                                                        
| 442 | 442 |  { | 
                                                        
| 443 | - $class .= " menu-item-has-children ";  | 
                                                        |
| 444 | - return $class;  | 
                                                        |
| 443 | + $class .= " menu-item-has-children ";  | 
                                                        |
| 444 | + return $class;  | 
                                                        |
| 445 | 445 | }  | 
                                                        
@@ -122,7 +122,7 @@ discard block  | 
                                                    ||
| 122 | 122 |  { | 
                                                        
| 123 | 123 | $classes[] = 'geodir-x';  | 
                                                        
| 124 | 124 | |
| 125 | -    if(isset($_REQUEST['geodir_search'])){ | 
                                                        |
| 125 | +    if (isset($_REQUEST['geodir_search'])) { | 
                                                        |
| 126 | 126 | $classes[] = 'geodir-x-search';  | 
                                                        
| 127 | 127 | }  | 
                                                        
| 128 | 128 | return $classes;  | 
                                                        
@@ -187,7 +187,7 @@ discard block  | 
                                                    ||
| 187 | 187 | echo '<div class="x-main full" role="main">';  | 
                                                        
| 188 | 188 |      } elseif ($stack == 'ethos') { | 
                                                        
| 189 | 189 | echo '<div class="x-container-fluid x-container max width main"><div class="offset cf">';  | 
                                                        
| 190 | -    }else{ | 
                                                        |
| 190 | +    } else { | 
                                                        |
| 191 | 191 | echo '<div class="x-container max width offset">';  | 
                                                        
| 192 | 192 | }  | 
                                                        
| 193 | 193 | }  | 
                                                        
@@ -221,7 +221,7 @@ discard block  | 
                                                    ||
| 221 | 221 |  { | 
                                                        
| 222 | 222 | $content_class = ' entry-wrap ';  | 
                                                        
| 223 | 223 | |
| 224 | - echo '<div class="x-main left ' . $class . $content_class . ' " role="main">';  | 
                                                        |
| 224 | + echo '<div class="x-main left '.$class.$content_class.' " role="main">';  | 
                                                        |
| 225 | 225 | }  | 
                                                        
| 226 | 226 | |
| 227 | 227 | /**  | 
                                                        
@@ -247,7 +247,7 @@ discard block  | 
                                                    ||
| 247 | 247 | */  | 
                                                        
| 248 | 248 | function geodir_x_action_sidebar_right_open($type = '', $id = '', $class = '', $itemtype = '')  | 
                                                        
| 249 | 249 |  { | 
                                                        
| 250 | - echo '<aside class="x-sidebar right" role="complementary" itemscope itemtype="' . $itemtype . '">';  | 
                                                        |
| 250 | + echo '<aside class="x-sidebar right" role="complementary" itemscope itemtype="'.$itemtype.'">';  | 
                                                        |
| 251 | 251 | }  | 
                                                        
| 252 | 252 | |
| 253 | 253 | /**  | 
                                                        
@@ -319,7 +319,7 @@ discard block  | 
                                                    ||
| 319 | 319 | // 8. Get shop title.  | 
                                                        
| 320 | 320 | //  | 
                                                        
| 321 | 321 | |
| 322 | - GLOBAL $post,$wp;  | 
                                                        |
| 322 | + GLOBAL $post, $wp;  | 
                                                        |
| 323 | 323 | |
| 324 | 324 |              if (geodir_is_page('detail') || geodir_is_page('listing') || (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_location_page_id())) { | 
                                                        
| 325 | 325 | geodir_breadcrumb();  | 
                                                        
@@ -327,57 +327,57 @@ discard block  | 
                                                    ||
| 327 | 327 | |
| 328 | 328 | $stack = x_get_stack();  | 
                                                        
| 329 | 329 | $delimiter = ' <span class="delimiter"><i class="x-icon-angle-right"></i></span> '; // 1  | 
                                                        
| 330 | - $home_text = '<span class="home"><i class="x-icon-home"></i></span>'; // 2  | 
                                                        |
| 331 | - $home_link = home_url(); // 3  | 
                                                        |
| 332 | - $current_before = '<span class="current">'; // 4  | 
                                                        |
| 333 | - $current_after = '</span>'; // 5  | 
                                                        |
| 334 | - $page_title = get_the_title(); // 6  | 
                                                        |
| 335 | -                $blog_title = get_the_title(get_option('page_for_posts', true));                 // 7 | 
                                                        |
| 336 | -                $shop_title = get_theme_mod('x_' . $stack . '_shop_title');                        // 8 | 
                                                        |
| 330 | + $home_text = '<span class="home"><i class="x-icon-home"></i></span>'; // 2  | 
                                                        |
| 331 | + $home_link = home_url(); // 3  | 
                                                        |
| 332 | + $current_before = '<span class="current">'; // 4  | 
                                                        |
| 333 | + $current_after = '</span>'; // 5  | 
                                                        |
| 334 | + $page_title = get_the_title(); // 6  | 
                                                        |
| 335 | +                $blog_title = get_the_title(get_option('page_for_posts', true)); // 7 | 
                                                        |
| 336 | +                $shop_title = get_theme_mod('x_'.$stack.'_shop_title'); // 8 | 
                                                        |
| 337 | 337 | |
| 338 | 338 |                  if (function_exists('woocommerce_get_page_id')) { | 
                                                        
| 339 | 339 | $shop_url = x_get_shop_link();  | 
                                                        
| 340 | - $shop_link = '<a href="' . $shop_url . '">' . $shop_title . '</a>';  | 
                                                        |
| 340 | + $shop_link = '<a href="'.$shop_url.'">'.$shop_title.'</a>';  | 
                                                        |
| 341 | 341 | }  | 
                                                        
| 342 | 342 | |
| 343 | 343 |                  if (is_front_page()) { | 
                                                        
| 344 | - echo '<div class="x-breadcrumbs">' . $current_before . $home_text . $current_after . '</div>';  | 
                                                        |
| 344 | + echo '<div class="x-breadcrumbs">'.$current_before.$home_text.$current_after.'</div>';  | 
                                                        |
| 345 | 345 |                  } elseif (is_home()) { | 
                                                        
| 346 | - echo '<div class="x-breadcrumbs"><a href="' . $home_link . '">' . $home_text . '</a>' . $delimiter . $current_before . $blog_title . $current_after . '</div>';  | 
                                                        |
| 346 | + echo '<div class="x-breadcrumbs"><a href="'.$home_link.'">'.$home_text.'</a>'.$delimiter.$current_before.$blog_title.$current_after.'</div>';  | 
                                                        |
| 347 | 347 |                  } else { | 
                                                        
| 348 | - echo '<div class="x-breadcrumbs"><a href="' . $home_link . '">' . $home_text . '</a>' . $delimiter;  | 
                                                        |
| 348 | + echo '<div class="x-breadcrumbs"><a href="'.$home_link.'">'.$home_text.'</a>'.$delimiter;  | 
                                                        |
| 349 | 349 |                      if (is_category()) { | 
                                                        
| 350 | 350 |                          $the_cat = get_category(get_query_var('cat'), false); | 
                                                        
| 351 | 351 | if ($the_cat->parent != 0) echo get_category_parents($the_cat->parent, TRUE, $delimiter);  | 
                                                        
| 352 | -                        echo $current_before . single_cat_title('', false) . $current_after; | 
                                                        |
| 352 | +                        echo $current_before.single_cat_title('', false).$current_after; | 
                                                        |
| 353 | 353 |                      } elseif (x_is_product_category()) { | 
                                                        
| 354 | -                        echo $shop_link . $delimiter . $current_before . single_cat_title('', false) . $current_after; | 
                                                        |
| 354 | +                        echo $shop_link.$delimiter.$current_before.single_cat_title('', false).$current_after; | 
                                                        |
| 355 | 355 |                      } elseif (x_is_product_tag()) { | 
                                                        
| 356 | -                        echo $shop_link . $delimiter . $current_before . single_tag_title('', false) . $current_after; | 
                                                        |
| 356 | +                        echo $shop_link.$delimiter.$current_before.single_tag_title('', false).$current_after; | 
                                                        |
| 357 | 357 |                      } elseif (is_search()) { | 
                                                        
| 358 | -                        echo $current_before . __('Search Results for ', '__x__') . '“' . get_search_query() . '”' . $current_after; | 
                                                        |
| 358 | +                        echo $current_before.__('Search Results for ', '__x__').'“'.get_search_query().'”'.$current_after; | 
                                                        |
| 359 | 359 |                      } elseif (is_singular('post')) { | 
                                                        
| 360 | 360 |                          if (get_option('page_for_posts') == is_front_page()) { | 
                                                        
| 361 | - echo $current_before . $page_title . $current_after;  | 
                                                        |
| 361 | + echo $current_before.$page_title.$current_after;  | 
                                                        |
| 362 | 362 |                          } else { | 
                                                        
| 363 | -                            echo '<a href="' . get_permalink(get_option('page_for_posts')) . '" title="' . esc_attr(__('See All Posts', '__x__')) . '">' . $blog_title . '</a>' . $delimiter . $current_before . $page_title . $current_after; | 
                                                        |
| 363 | +                            echo '<a href="'.get_permalink(get_option('page_for_posts')).'" title="'.esc_attr(__('See All Posts', '__x__')).'">'.$blog_title.'</a>'.$delimiter.$current_before.$page_title.$current_after; | 
                                                        |
| 364 | 364 | }  | 
                                                        
| 365 | 365 |                      } elseif (x_is_portfolio()) { | 
                                                        
| 366 | - echo $current_before . get_the_title() . $current_after;  | 
                                                        |
| 366 | + echo $current_before.get_the_title().$current_after;  | 
                                                        |
| 367 | 367 |                      } elseif (x_is_portfolio_item()) { | 
                                                        
| 368 | 368 | $link = x_get_parent_portfolio_link();  | 
                                                        
| 369 | 369 | $title = x_get_parent_portfolio_title();  | 
                                                        
| 370 | -                        echo '<a href="' . $link . '" title="' . esc_attr(__('See All Posts', '__x__')) . '">' . $title . '</a>' . $delimiter . $current_before . $page_title . $current_after; | 
                                                        |
| 370 | +                        echo '<a href="'.$link.'" title="'.esc_attr(__('See All Posts', '__x__')).'">'.$title.'</a>'.$delimiter.$current_before.$page_title.$current_after; | 
                                                        |
| 371 | 371 |                      } elseif (x_is_product()) { | 
                                                        
| 372 | - echo $shop_link . $delimiter . $current_before . $page_title . $current_after;  | 
                                                        |
| 372 | + echo $shop_link.$delimiter.$current_before.$page_title.$current_after;  | 
                                                        |
| 373 | 373 |                      } elseif (is_page() && !$post->post_parent) { | 
                                                        
| 374 | - echo $current_before . $page_title . $current_after;  | 
                                                        |
| 374 | + echo $current_before.$page_title.$current_after;  | 
                                                        |
| 375 | 375 |                      } elseif (is_page() && $post->post_parent) { | 
                                                        
| 376 | 376 | $parent_id = $post->post_parent;  | 
                                                        
| 377 | 377 | $breadcrumbs = array();  | 
                                                        
| 378 | 378 |                          while ($parent_id) { | 
                                                        
| 379 | 379 | $page = get_page($parent_id);  | 
                                                        
| 380 | - $breadcrumbs[] = '<a href="' . get_permalink($page->ID) . '">' . get_the_title($page->ID) . '</a>';  | 
                                                        |
| 380 | + $breadcrumbs[] = '<a href="'.get_permalink($page->ID).'">'.get_the_title($page->ID).'</a>';  | 
                                                        |
| 381 | 381 | $parent_id = $page->post_parent;  | 
                                                        
| 382 | 382 | }  | 
                                                        
| 383 | 383 | $breadcrumbs = array_reverse($breadcrumbs);  | 
                                                        
@@ -385,24 +385,24 @@ discard block  | 
                                                    ||
| 385 | 385 | echo $breadcrumbs[$i];  | 
                                                        
| 386 | 386 | if ($i != count($breadcrumbs) - 1) echo $delimiter;  | 
                                                        
| 387 | 387 | }  | 
                                                        
| 388 | - echo $delimiter . $current_before . $page_title . $current_after;  | 
                                                        |
| 388 | + echo $delimiter.$current_before.$page_title.$current_after;  | 
                                                        |
| 389 | 389 |                      } elseif (is_tag()) { | 
                                                        
| 390 | -                        echo $current_before . single_tag_title('', false) . $current_after; | 
                                                        |
| 390 | +                        echo $current_before.single_tag_title('', false).$current_after; | 
                                                        |
| 391 | 391 |                      } elseif (is_author()) { | 
                                                        
| 392 | 392 | GLOBAL $author;  | 
                                                        
| 393 | 393 | $userdata = get_userdata($author);  | 
                                                        
| 394 | -                        echo $current_before . __('Posts by ', '__x__') . '“' . $userdata->display_name . $current_after . '”'; | 
                                                        |
| 394 | +                        echo $current_before.__('Posts by ', '__x__').'“'.$userdata->display_name.$current_after.'”'; | 
                                                        |
| 395 | 395 |                      } elseif (is_404()) { | 
                                                        
| 396 | -                        echo $current_before . __('404 (Page Not Found)', '__x__') . $current_after; | 
                                                        |
| 396 | +                        echo $current_before.__('404 (Page Not Found)', '__x__').$current_after; | 
                                                        |
| 397 | 397 |                      } elseif (is_archive()) { | 
                                                        
| 398 | 398 |                          if (x_is_shop()) { | 
                                                        
| 399 | - echo $current_before . $shop_title . $current_after;  | 
                                                        |
| 399 | + echo $current_before.$shop_title.$current_after;  | 
                                                        |
| 400 | 400 |                          } else { | 
                                                        
| 401 | -                            echo $current_before . __('Archives ', '__x__') . $current_after; | 
                                                        |
| 401 | +                            echo $current_before.__('Archives ', '__x__').$current_after; | 
                                                        |
| 402 | 402 | }  | 
                                                        
| 403 | 403 | }  | 
                                                        
| 404 | 404 |                      if (get_query_var('paged')) { | 
                                                        
| 405 | -                        echo ' <span class="current" style="white-space: nowrap;">(' . __('Page', '__x__') . ' ' . get_query_var('paged') . ')</span>'; | 
                                                        |
| 405 | +                        echo ' <span class="current" style="white-space: nowrap;">('.__('Page', '__x__').' '.get_query_var('paged').')</span>'; | 
                                                        |
| 406 | 406 | }  | 
                                                        
| 407 | 407 | echo '</div>';  | 
                                                        
| 408 | 408 | }  | 
                                                        
@@ -325,7 +325,7 @@ discard block  | 
                                                    ||
| 325 | 325 | * @global wpdb $wpdb WordPress database abstraction object.  | 
                                                        
| 326 | 326 | * @deprecated 1.5.0 No longer required.  | 
                                                        
| 327 | 327 | * @param string $rules mod_rewrite Rewrite rules formatted for .htaccess.  | 
                                                        
| 328 | - * @return array Rewrite rules.  | 
                                                        |
| 328 | + * @return string Rewrite rules.  | 
                                                        |
| 329 | 329 | */  | 
                                                        
| 330 | 330 | function geodir_htaccess_contents($rules)  | 
                                                        
| 331 | 331 |  {
 | 
                                                        
@@ -350,7 +350,7 @@ discard block  | 
                                                    ||
| 350 | 350 | * @since 1.0.0  | 
                                                        
| 351 | 351 | *  | 
                                                        
| 352 | 352 | * @param array $public_query_vars The array of query variables.  | 
                                                        
| 353 | - * @return array Query variables.  | 
                                                        |
| 353 | + * @return string[] Query variables.  | 
                                                        |
| 354 | 354 | */  | 
                                                        
| 355 | 355 | function geodir_add_location_var($public_query_vars)  | 
                                                        
| 356 | 356 |  {
 | 
                                                        
@@ -366,7 +366,7 @@ discard block  | 
                                                    ||
| 366 | 366 | * @since 1.0.0  | 
                                                        
| 367 | 367 | *  | 
                                                        
| 368 | 368 | * @param array $public_query_vars The array of query variables.  | 
                                                        
| 369 | - * @return array Query variables.  | 
                                                        |
| 369 | + * @return string[] Query variables.  | 
                                                        |
| 370 | 370 | */  | 
                                                        
| 371 | 371 | function geodir_add_geodir_page_var($public_query_vars)  | 
                                                        
| 372 | 372 |  {
 | 
                                                        
@@ -793,7 +793,6 @@ discard block  | 
                                                    ||
| 793 | 793 | *  | 
                                                        
| 794 | 794 | * @since 1.0.0  | 
                                                        
| 795 | 795 | *  | 
                                                        
| 796 | - * @param object $wp The WordPress object.  | 
                                                        |
| 797 | 796 | */  | 
                                                        
| 798 | 797 | function geodir_custom_post_status()  | 
                                                        
| 799 | 798 |  {
 | 
                                                        
@@ -106,24 +106,30 @@ discard block  | 
                                                    ||
| 106 | 106 | $listing_slug = htmlentities(trim($_REQUEST['geodir_listing_prefix']));  | 
                                                        
| 107 | 107 | |
| 108 | 108 |          if ($post_type == 'gd_place') {
 | 
                                                        
| 109 | -            if (array_key_exists('has_archive', $args))
 | 
                                                        |
| 110 | - $args['has_archive'] = $listing_slug;  | 
                                                        |
| 109 | +            if (array_key_exists('has_archive', $args)) { | 
                                                        |
| 110 | + $args['has_archive'] = $listing_slug;  | 
                                                        |
| 111 | + }  | 
                                                        |
| 111 | 112 | |
| 112 | 113 |              if (array_key_exists('rewrite', $args)) {
 | 
                                                        
| 113 | -                if (array_key_exists('slug', $args['rewrite']))
 | 
                                                        |
| 114 | - $args['rewrite']['slug'] = $listing_slug;// . '/%gd_taxonomy%';  | 
                                                        |
| 114 | +                if (array_key_exists('slug', $args['rewrite'])) { | 
                                                        |
| 115 | + $args['rewrite']['slug'] = $listing_slug;  | 
                                                        |
| 116 | + }  | 
                                                        |
| 117 | + // . '/%gd_taxonomy%';  | 
                                                        |
| 115 | 118 | }  | 
                                                        
| 116 | 119 | |
| 117 | 120 |              $geodir_post_types = get_option('geodir_post_types');
 | 
                                                        
| 118 | 121 | |
| 119 | 122 |              if (array_key_exists($post_type, $geodir_post_types)) {
 | 
                                                        
| 120 | 123 | |
| 121 | -                if (array_key_exists('has_archive', $geodir_post_types[$post_type]))
 | 
                                                        |
| 122 | - $geodir_post_types[$post_type]['has_archive'] = $listing_slug;  | 
                                                        |
| 124 | +                if (array_key_exists('has_archive', $geodir_post_types[$post_type])) { | 
                                                        |
| 125 | + $geodir_post_types[$post_type]['has_archive'] = $listing_slug;  | 
                                                        |
| 126 | + }  | 
                                                        |
| 123 | 127 | |
| 124 | -                if (array_key_exists('rewrite', $geodir_post_types[$post_type]))
 | 
                                                        |
| 125 | -                    if (array_key_exists('slug', $geodir_post_types[$post_type]['rewrite']))
 | 
                                                        |
| 126 | - $geodir_post_types[$post_type]['rewrite']['slug'] = $listing_slug;// . '/%gd_taxonomy%';  | 
                                                        |
| 128 | +                if (array_key_exists('rewrite', $geodir_post_types[$post_type])) { | 
                                                        |
| 129 | +                                    if (array_key_exists('slug', $geodir_post_types[$post_type]['rewrite']))
 | 
                                                        |
| 130 | + $geodir_post_types[$post_type]['rewrite']['slug'] = $listing_slug;  | 
                                                        |
| 131 | + }  | 
                                                        |
| 132 | + // . '/%gd_taxonomy%';  | 
                                                        |
| 127 | 133 | |
| 128 | 134 |                  update_option('geodir_post_types', $geodir_post_types);
 | 
                                                        
| 129 | 135 | |
@@ -138,10 +144,11 @@ discard block  | 
                                                    ||
| 138 | 144 |              if (array_key_exists('listing_slug', $geodir_taxonomies[$post_type . 'category'])) {
 | 
                                                        
| 139 | 145 | $geodir_taxonomies[$post_type . 'category']['listing_slug'] = $listing_slug;  | 
                                                        
| 140 | 146 | |
| 141 | -                if (array_key_exists('args', $geodir_taxonomies[$post_type . 'category']))
 | 
                                                        |
| 142 | -                    if (array_key_exists('rewrite', $geodir_taxonomies[$post_type . 'category']['args']))
 | 
                                                        |
| 147 | +                if (array_key_exists('args', $geodir_taxonomies[$post_type . 'category'])) { | 
                                                        |
| 148 | +                                    if (array_key_exists('rewrite', $geodir_taxonomies[$post_type . 'category']['args']))
 | 
                                                        |
| 143 | 149 |                          if (array_key_exists('slug', $geodir_taxonomies[$post_type . 'category']['args']['rewrite']))
 | 
                                                        
| 144 | - $geodir_taxonomies[$post_type . 'category']['args']['rewrite']['slug'] = $listing_slug;  | 
                                                        |
| 150 | + $geodir_taxonomies[$post_type . 'category']['args']['rewrite']['slug'] = $listing_slug;  | 
                                                        |
| 151 | + }  | 
                                                        |
| 145 | 152 | |
| 146 | 153 |                  update_option('geodir_taxonomies', $geodir_taxonomies);
 | 
                                                        
| 147 | 154 | |
@@ -152,10 +159,11 @@ discard block  | 
                                                    ||
| 152 | 159 |              if (array_key_exists('listing_slug', $geodir_taxonomies_tag[$post_type . '_tags'])) {
 | 
                                                        
| 153 | 160 | $geodir_taxonomies_tag[$post_type . '_tags']['listing_slug'] = $listing_slug . '/tags';  | 
                                                        
| 154 | 161 | |
| 155 | -                if (array_key_exists('args', $geodir_taxonomies_tag[$post_type . '_tags']))
 | 
                                                        |
| 156 | -                    if (array_key_exists('rewrite', $geodir_taxonomies_tag[$post_type . '_tags']['args']))
 | 
                                                        |
| 162 | +                if (array_key_exists('args', $geodir_taxonomies_tag[$post_type . '_tags'])) { | 
                                                        |
| 163 | +                                    if (array_key_exists('rewrite', $geodir_taxonomies_tag[$post_type . '_tags']['args']))
 | 
                                                        |
| 157 | 164 |                          if (array_key_exists('slug', $geodir_taxonomies_tag[$post_type . '_tags']['args']['rewrite']))
 | 
                                                        
| 158 | - $geodir_taxonomies_tag[$post_type . '_tags']['args']['rewrite']['slug'] = $listing_slug . '/tags';  | 
                                                        |
| 165 | + $geodir_taxonomies_tag[$post_type . '_tags']['args']['rewrite']['slug'] = $listing_slug . '/tags';  | 
                                                        |
| 166 | + }  | 
                                                        |
| 159 | 167 | |
| 160 | 168 |                  update_option('geodir_taxonomies', $geodir_taxonomies_tag);
 | 
                                                        
| 161 | 169 | |
@@ -221,8 +229,9 @@ discard block  | 
                                                    ||
| 221 | 229 | global $wpdb;  | 
                                                        
| 222 | 230 |          $location_prefix = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_type='page' AND ID=%d", $location_page));
 | 
                                                        
| 223 | 231 | }  | 
                                                        
| 224 | - if (!isset($location_prefix))  | 
                                                        |
| 225 | - $location_prefix = 'location';  | 
                                                        |
| 232 | +    if (!isset($location_prefix)) { | 
                                                        |
| 233 | + $location_prefix = 'location';  | 
                                                        |
| 234 | + }  | 
                                                        |
| 226 | 235 | |
| 227 | 236 |  	$location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
 | 
                                                        
| 228 | 237 |  	if ($location_manager) {
 | 
                                                        
@@ -441,14 +450,17 @@ discard block  | 
                                                    ||
| 441 | 450 | $gd_country = '';  | 
                                                        
| 442 | 451 | $gd_region = '';  | 
                                                        
| 443 | 452 | $gd_city = '';  | 
                                                        
| 444 | - if (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '')  | 
                                                        |
| 445 | - $gd_country = urldecode($wp->query_vars['gd_country']);  | 
                                                        |
| 453 | +        if (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') { | 
                                                        |
| 454 | + $gd_country = urldecode($wp->query_vars['gd_country']);  | 
                                                        |
| 455 | + }  | 
                                                        |
| 446 | 456 | |
| 447 | - if (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '')  | 
                                                        |
| 448 | - $gd_region = urldecode($wp->query_vars['gd_region']);  | 
                                                        |
| 457 | +        if (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') { | 
                                                        |
| 458 | + $gd_region = urldecode($wp->query_vars['gd_region']);  | 
                                                        |
| 459 | + }  | 
                                                        |
| 449 | 460 | |
| 450 | - if (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '')  | 
                                                        |
| 451 | - $gd_city = urldecode($wp->query_vars['gd_city']);  | 
                                                        |
| 461 | +        if (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') { | 
                                                        |
| 462 | + $gd_city = urldecode($wp->query_vars['gd_city']);  | 
                                                        |
| 463 | + }  | 
                                                        |
| 452 | 464 | |
| 453 | 465 |          if (!($gd_country == '' && $gd_region == '' && $gd_city == '')) {
 | 
                                                        
| 454 | 466 | $default_location = geodir_get_default_location();  | 
                                                        
@@ -456,17 +468,19 @@ discard block  | 
                                                    ||
| 456 | 468 |              if (get_option('geodir_add_location_url')) {
 | 
                                                        
| 457 | 469 |                  if ($geodir_show_location_url != 'all') {
 | 
                                                        
| 458 | 470 |                      if ($gd_region == '') {
 | 
                                                        
| 459 | -                        if ($gd_ses_region = $gd_session->get('gd_region'))
 | 
                                                        |
| 460 | - $gd_region = $gd_ses_region;  | 
                                                        |
| 461 | - else  | 
                                                        |
| 462 | - $gd_region = $default_location->region_slug;  | 
                                                        |
| 471 | +                        if ($gd_ses_region = $gd_session->get('gd_region')) { | 
                                                        |
| 472 | + $gd_region = $gd_ses_region;  | 
                                                        |
| 473 | +                        } else { | 
                                                        |
| 474 | + $gd_region = $default_location->region_slug;  | 
                                                        |
| 475 | + }  | 
                                                        |
| 463 | 476 | }  | 
                                                        
| 464 | 477 | |
| 465 | 478 |                      if ($gd_city == '') {
 | 
                                                        
| 466 | -                        if ($gd_ses_city = $gd_session->get('gd_city'))
 | 
                                                        |
| 467 | - $gd_city = $gd_ses_city;  | 
                                                        |
| 468 | - else  | 
                                                        |
| 469 | - $gd_city = $default_location->city_slug;  | 
                                                        |
| 479 | +                        if ($gd_ses_city = $gd_session->get('gd_city')) { | 
                                                        |
| 480 | + $gd_city = $gd_ses_city;  | 
                                                        |
| 481 | +                        } else { | 
                                                        |
| 482 | + $gd_city = $default_location->city_slug;  | 
                                                        |
| 483 | + }  | 
                                                        |
| 470 | 484 | |
| 471 | 485 |                          $base_location_link = geodir_get_location_link('base');
 | 
                                                        
| 472 | 486 | wp_redirect($base_location_link . '/' . $gd_country . '/' . $gd_region . '/' . $gd_city);  | 
                                                        
@@ -585,8 +599,9 @@ discard block  | 
                                                    ||
| 585 | 599 | |
| 586 | 600 | |
| 587 | 601 |  				$geodir_term = str_replace('/' . $geodir_last_term, '', $geodir_term, $post_title_replace_count);
 | 
                                                        
| 588 | - if (!$post_title_replace_count)  | 
                                                        |
| 589 | - $geodir_term = str_replace($geodir_last_term, '', $geodir_term, $post_title_replace_count);  | 
                                                        |
| 602 | +				if (!$post_title_replace_count) { | 
                                                        |
| 603 | + $geodir_term = str_replace($geodir_last_term, '', $geodir_term, $post_title_replace_count);  | 
                                                        |
| 604 | + }  | 
                                                        |
| 590 | 605 |  				$geodir_terms = explode('/', $geodir_term);
 | 
                                                        
| 591 | 606 | $geodir_last_term = end($geodir_terms);  | 
                                                        
| 592 | 607 | |
@@ -622,8 +637,9 @@ discard block  | 
                                                    ||
| 622 | 637 | if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) &&  | 
                                                        
| 623 | 638 | geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region) &&  | 
                                                        
| 624 | 639 | geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city)  | 
                                                        
| 625 | - )  | 
                                                        |
| 626 | - $is_geodir_location_found = true;  | 
                                                        |
| 640 | +                    ) { | 
                                                        |
| 641 | + $is_geodir_location_found = true;  | 
                                                        |
| 642 | + }  | 
                                                        |
| 627 | 643 | |
| 628 | 644 | // if location has not been found for country , region and city then search for country and region only  | 
                                                        
| 629 | 645 | |
@@ -631,8 +647,9 @@ discard block  | 
                                                    ||
| 631 | 647 | $gd_city = '';  | 
                                                        
| 632 | 648 | if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) &&  | 
                                                        
| 633 | 649 | geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region)  | 
                                                        
| 634 | - )  | 
                                                        |
| 635 | - $is_geodir_location_found = true;  | 
                                                        |
| 650 | +                        ) { | 
                                                        |
| 651 | + $is_geodir_location_found = true;  | 
                                                        |
| 652 | + }  | 
                                                        |
| 636 | 653 | |
| 637 | 654 | }  | 
                                                        
| 638 | 655 | |
@@ -640,8 +657,9 @@ discard block  | 
                                                    ||
| 640 | 657 |                      if (!$is_geodir_location_found) {
 | 
                                                        
| 641 | 658 | $gd_city = '';  | 
                                                        
| 642 | 659 | $gd_region = '';  | 
                                                        
| 643 | - if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country))  | 
                                                        |
| 644 | - $is_geodir_location_found = true;  | 
                                                        |
| 660 | +                        if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country)) { | 
                                                        |
| 661 | + $is_geodir_location_found = true;  | 
                                                        |
| 662 | + }  | 
                                                        |
| 645 | 663 | }  | 
                                                        
| 646 | 664 |                  } else if ($geodir_show_location_url == 'country_city') {
 | 
                                                        
| 647 | 665 |                      if (count($geodir_terms) >= 2) {
 | 
                                                        
@@ -651,17 +669,19 @@ discard block  | 
                                                    ||
| 651 | 669 | $gd_country = urldecode($geodir_terms[0]);  | 
                                                        
| 652 | 670 | }  | 
                                                        
| 653 | 671 | |
| 654 | - if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) && geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city))  | 
                                                        |
| 655 | - $is_geodir_location_found = true;  | 
                                                        |
| 672 | +                    if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) && geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city)) { | 
                                                        |
| 673 | + $is_geodir_location_found = true;  | 
                                                        |
| 674 | + }  | 
                                                        |
| 656 | 675 | |
| 657 | 676 | // if location has not been found for country and city then search for country only  | 
                                                        
| 658 | 677 |                      if (!$is_geodir_location_found) {
 | 
                                                        
| 659 | 678 | $gd_city = '';  | 
                                                        
| 660 | 679 | |
| 661 | - if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country))  | 
                                                        |
| 662 | - $is_geodir_location_found = true;  | 
                                                        |
| 680 | +						if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country)) { | 
                                                        |
| 681 | + $is_geodir_location_found = true;  | 
                                                        |
| 682 | + }  | 
                                                        |
| 663 | 683 | }  | 
                                                        
| 664 | -                }  else if ($geodir_show_location_url == 'region_city') {
 | 
                                                        |
| 684 | +                } else if ($geodir_show_location_url == 'region_city') {
 | 
                                                        |
| 665 | 685 |                      if (count($geodir_terms) >= 2) {
 | 
                                                        
| 666 | 686 | $gd_region = urldecode($geodir_terms[0]);  | 
                                                        
| 667 | 687 | $gd_city = urldecode($geodir_terms[1]);  | 
                                                        
@@ -669,15 +689,17 @@ discard block  | 
                                                    ||
| 669 | 689 | $gd_region = urldecode($geodir_terms[0]);  | 
                                                        
| 670 | 690 | }  | 
                                                        
| 671 | 691 | |
| 672 | - if (geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region) && geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city))  | 
                                                        |
| 673 | - $is_geodir_location_found = true;  | 
                                                        |
| 692 | +                    if (geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region) && geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city)) { | 
                                                        |
| 693 | + $is_geodir_location_found = true;  | 
                                                        |
| 694 | + }  | 
                                                        |
| 674 | 695 | |
| 675 | 696 | // if location has not been found for region and city then search for region only  | 
                                                        
| 676 | 697 |                      if (!$is_geodir_location_found) {
 | 
                                                        
| 677 | 698 | $gd_city = '';  | 
                                                        
| 678 | 699 | |
| 679 | - if (geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region))  | 
                                                        |
| 680 | - $is_geodir_location_found = true;  | 
                                                        |
| 700 | +						if (geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region)) { | 
                                                        |
| 701 | + $is_geodir_location_found = true;  | 
                                                        |
| 702 | + }  | 
                                                        |
| 681 | 703 | }  | 
                                                        
| 682 | 704 |                  } else {
 | 
                                                        
| 683 | 705 | $gd_city = $geodir_terms[0];  | 
                                                        
@@ -719,14 +741,17 @@ discard block  | 
                                                    ||
| 719 | 741 | |
| 720 | 742 | $wp->query_vars[$geodir_taxonomy] = $geodir_term;  | 
                                                        
| 721 | 743 | // eliminate location related terms from taxonomy term  | 
                                                        
| 722 | - if ($gd_country != '')  | 
                                                        |
| 723 | -                $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_country) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
 | 
                                                        |
| 744 | +            if ($gd_country != '') { | 
                                                        |
| 745 | +                            $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_country) . '/', '', $wp->query_vars[$geodir_taxonomy], 1); | 
                                                        |
| 746 | + }  | 
                                                        |
| 724 | 747 | |
| 725 | - if ($gd_region != '')  | 
                                                        |
| 726 | -                $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_region) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
 | 
                                                        |
| 748 | +            if ($gd_region != '') { | 
                                                        |
| 749 | +                            $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_region) . '/', '', $wp->query_vars[$geodir_taxonomy], 1); | 
                                                        |
| 750 | + }  | 
                                                        |
| 727 | 751 | |
| 728 | - if ($gd_city != '')  | 
                                                        |
| 729 | -                $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_city) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
 | 
                                                        |
| 752 | +            if ($gd_city != '') { | 
                                                        |
| 753 | +                            $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_city) . '/', '', $wp->query_vars[$geodir_taxonomy], 1); | 
                                                        |
| 754 | + }  | 
                                                        |
| 730 | 755 | |
| 731 | 756 | |
| 732 | 757 |              $wp->query_vars[$geodir_taxonomy] = str_replace('///', '', $wp->query_vars[$geodir_taxonomy]);
 | 
                                                        
@@ -762,27 +787,34 @@ discard block  | 
                                                    ||
| 762 | 787 |      if (get_option('geodir_add_location_url')) {        
 | 
                                                        
| 763 | 788 |  		if ($geodir_show_location_url == 'all') {
 | 
                                                        
| 764 | 789 |  		} else if ($geodir_show_location_url == 'country_city') {
 | 
                                                        
| 765 | - if (isset($wp->query_vars['gd_region']))  | 
                                                        |
| 766 | - $wp->query_vars['gd_region'] = '';  | 
                                                        |
| 790 | +			 if (isset($wp->query_vars['gd_region'])) { | 
                                                        |
| 791 | + $wp->query_vars['gd_region'] = '';  | 
                                                        |
| 792 | + }  | 
                                                        |
| 767 | 793 |  		} else if ($geodir_show_location_url == 'region_city') {
 | 
                                                        
| 768 | - if (isset($wp->query_vars['gd_country']))  | 
                                                        |
| 769 | - $wp->query_vars['gd_country'] = '';  | 
                                                        |
| 794 | +			if (isset($wp->query_vars['gd_country'])) { | 
                                                        |
| 795 | + $wp->query_vars['gd_country'] = '';  | 
                                                        |
| 796 | + }  | 
                                                        |
| 770 | 797 |  		} else {
 | 
                                                        
| 771 | - if (isset($wp->query_vars['gd_country']))  | 
                                                        |
| 772 | - $wp->query_vars['gd_country'] = '';  | 
                                                        |
| 798 | +			if (isset($wp->query_vars['gd_country'])) { | 
                                                        |
| 799 | + $wp->query_vars['gd_country'] = '';  | 
                                                        |
| 800 | + }  | 
                                                        |
| 773 | 801 | |
| 774 | - if (isset($wp->query_vars['gd_region']))  | 
                                                        |
| 775 | - $wp->query_vars['gd_region'] = '';  | 
                                                        |
| 802 | +            if (isset($wp->query_vars['gd_region'])) { | 
                                                        |
| 803 | + $wp->query_vars['gd_region'] = '';  | 
                                                        |
| 804 | + }  | 
                                                        |
| 776 | 805 | }  | 
                                                        
| 777 | 806 |      } else {
 | 
                                                        
| 778 | - if (isset($wp->query_vars['gd_country']))  | 
                                                        |
| 779 | - $wp->query_vars['gd_country'] = '';  | 
                                                        |
| 807 | +        if (isset($wp->query_vars['gd_country'])) { | 
                                                        |
| 808 | + $wp->query_vars['gd_country'] = '';  | 
                                                        |
| 809 | + }  | 
                                                        |
| 780 | 810 | |
| 781 | - if (isset($wp->query_vars['gd_region']))  | 
                                                        |
| 782 | - $wp->query_vars['gd_region'] = '';  | 
                                                        |
| 811 | +        if (isset($wp->query_vars['gd_region'])) { | 
                                                        |
| 812 | + $wp->query_vars['gd_region'] = '';  | 
                                                        |
| 813 | + }  | 
                                                        |
| 783 | 814 | |
| 784 | - if (isset($wp->query_vars['gd_city']))  | 
                                                        |
| 785 | - $wp->query_vars['gd_city'] = '';  | 
                                                        |
| 815 | +        if (isset($wp->query_vars['gd_city'])) { | 
                                                        |
| 816 | + $wp->query_vars['gd_city'] = '';  | 
                                                        |
| 817 | + }  | 
                                                        |
| 786 | 818 | }  | 
                                                        
| 787 | 819 | }  | 
                                                        
| 788 | 820 | |
@@ -894,8 +926,9 @@ discard block  | 
                                                    ||
| 894 | 926 | function geodir_exclude_page_where($where)  | 
                                                        
| 895 | 927 |  {
 | 
                                                        
| 896 | 928 | global $wpdb;  | 
                                                        
| 897 | - if (is_admin())  | 
                                                        |
| 898 | - $where .= " AND $wpdb->posts.post_status != 'virtual'";  | 
                                                        |
| 929 | +    if (is_admin()) { | 
                                                        |
| 930 | + $where .= " AND $wpdb->posts.post_status != 'virtual'";  | 
                                                        |
| 931 | + }  | 
                                                        |
| 899 | 932 | |
| 900 | 933 | return $where;  | 
                                                        
| 901 | 934 | }  | 
                                                        
@@ -13,29 +13,29 @@ discard block  | 
                                                    ||
| 13 | 13 | */  | 
                                                        
| 14 | 14 | function geodir_register_taxonomies()  | 
                                                        
| 15 | 15 |  {
 | 
                                                        
| 16 | - $taxonomies = array();  | 
                                                        |
| 17 | -    $taxonomies = get_option('geodir_taxonomies');
 | 
                                                        |
| 18 | - // If custom taxonomies are present, register them  | 
                                                        |
| 19 | -    if (is_array($taxonomies)) {
 | 
                                                        |
| 20 | - // Sort taxonomies  | 
                                                        |
| 21 | - ksort($taxonomies);  | 
                                                        |
| 22 | -  | 
                                                        |
| 23 | - // Register taxonomies  | 
                                                        |
| 24 | -        foreach ($taxonomies as $taxonomy => $args) {
 | 
                                                        |
| 25 | - // Allow taxonomy names to be translated  | 
                                                        |
| 26 | -            if (!empty($args['args']['labels'])) {
 | 
                                                        |
| 27 | -                foreach ($args['args']['labels'] as $key => $tax_label) {
 | 
                                                        |
| 28 | - $args['args']['labels'][$key] = __($tax_label, 'geodirectory');  | 
                                                        |
| 29 | - }  | 
                                                        |
| 30 | - }  | 
                                                        |
| 31 | -  | 
                                                        |
| 32 | - $tax = register_taxonomy($taxonomy, $args['object_type'], $args['args']);  | 
                                                        |
| 33 | -  | 
                                                        |
| 34 | -            if (taxonomy_exists($taxonomy)) {
 | 
                                                        |
| 35 | - $tax = register_taxonomy_for_object_type($taxonomy, $args['object_type']);  | 
                                                        |
| 36 | - }  | 
                                                        |
| 37 | - }  | 
                                                        |
| 38 | - }  | 
                                                        |
| 16 | + $taxonomies = array();  | 
                                                        |
| 17 | +	$taxonomies = get_option('geodir_taxonomies');
 | 
                                                        |
| 18 | + // If custom taxonomies are present, register them  | 
                                                        |
| 19 | +	if (is_array($taxonomies)) {
 | 
                                                        |
| 20 | + // Sort taxonomies  | 
                                                        |
| 21 | + ksort($taxonomies);  | 
                                                        |
| 22 | +  | 
                                                        |
| 23 | + // Register taxonomies  | 
                                                        |
| 24 | +		foreach ($taxonomies as $taxonomy => $args) {
 | 
                                                        |
| 25 | + // Allow taxonomy names to be translated  | 
                                                        |
| 26 | +			if (!empty($args['args']['labels'])) {
 | 
                                                        |
| 27 | +				foreach ($args['args']['labels'] as $key => $tax_label) {
 | 
                                                        |
| 28 | + $args['args']['labels'][$key] = __($tax_label, 'geodirectory');  | 
                                                        |
| 29 | + }  | 
                                                        |
| 30 | + }  | 
                                                        |
| 31 | +  | 
                                                        |
| 32 | + $tax = register_taxonomy($taxonomy, $args['object_type'], $args['args']);  | 
                                                        |
| 33 | +  | 
                                                        |
| 34 | +			if (taxonomy_exists($taxonomy)) {
 | 
                                                        |
| 35 | + $tax = register_taxonomy_for_object_type($taxonomy, $args['object_type']);  | 
                                                        |
| 36 | + }  | 
                                                        |
| 37 | + }  | 
                                                        |
| 38 | + }  | 
                                                        |
| 39 | 39 | }  | 
                                                        
| 40 | 40 | |
| 41 | 41 | /**  | 
                                                        
@@ -46,45 +46,45 @@ discard block  | 
                                                    ||
| 46 | 46 | * @global array $wp_post_types List of post types.  | 
                                                        
| 47 | 47 | */  | 
                                                        
| 48 | 48 |  function geodir_register_post_types() {
 | 
                                                        
| 49 | - global $wp_post_types;  | 
                                                        |
| 49 | + global $wp_post_types;  | 
                                                        |
| 50 | 50 | |
| 51 | - /**  | 
                                                        |
| 52 | - * Get available custom posttypes and taxonomies and register them.  | 
                                                        |
| 53 | - */  | 
                                                        |
| 54 | -    _x('places', 'URL slug', 'geodirectory');
 | 
                                                        |
| 55 | -  | 
                                                        |
| 56 | - $post_types = array();  | 
                                                        |
| 57 | -    $post_types = get_option('geodir_post_types');
 | 
                                                        |
| 58 | -  | 
                                                        |
| 59 | - // Register each post type if array of data is returned  | 
                                                        |
| 60 | - if (is_array($post_types)):  | 
                                                        |
| 61 | -  | 
                                                        |
| 62 | - foreach ($post_types as $post_type => $args):  | 
                                                        |
| 63 | -  | 
                                                        |
| 64 | -            if (!empty($args['rewrite']['slug'])) {
 | 
                                                        |
| 65 | - $args['rewrite']['slug'] = _x($args['rewrite']['slug'], 'URL slug', 'geodirectory');  | 
                                                        |
| 66 | - }  | 
                                                        |
| 67 | - $args = stripslashes_deep($args);  | 
                                                        |
| 68 | -  | 
                                                        |
| 69 | -            if (!empty($args['labels'])) {
 | 
                                                        |
| 70 | -                foreach ($args['labels'] as $key => $val) {
 | 
                                                        |
| 71 | - $args['labels'][$key] = __($val, 'geodirectory');// allow translation  | 
                                                        |
| 72 | - }  | 
                                                        |
| 73 | - }  | 
                                                        |
| 74 | -  | 
                                                        |
| 75 | - /**  | 
                                                        |
| 76 | - * Filter post type args.  | 
                                                        |
| 77 | - *  | 
                                                        |
| 78 | - * @since 1.0.0  | 
                                                        |
| 79 | - * @param string $args Post type args.  | 
                                                        |
| 80 | - * @param string $post_type The post type.  | 
                                                        |
| 81 | - */  | 
                                                        |
| 82 | -            $args = apply_filters('geodir_post_type_args', $args, $post_type);
 | 
                                                        |
| 83 | -  | 
                                                        |
| 84 | - $post_type = register_post_type($post_type, $args);  | 
                                                        |
| 85 | -  | 
                                                        |
| 86 | - endforeach;  | 
                                                        |
| 87 | - endif;  | 
                                                        |
| 51 | + /**  | 
                                                        |
| 52 | + * Get available custom posttypes and taxonomies and register them.  | 
                                                        |
| 53 | + */  | 
                                                        |
| 54 | +	_x('places', 'URL slug', 'geodirectory');
 | 
                                                        |
| 55 | +  | 
                                                        |
| 56 | + $post_types = array();  | 
                                                        |
| 57 | +	$post_types = get_option('geodir_post_types');
 | 
                                                        |
| 58 | +  | 
                                                        |
| 59 | + // Register each post type if array of data is returned  | 
                                                        |
| 60 | + if (is_array($post_types)):  | 
                                                        |
| 61 | +  | 
                                                        |
| 62 | + foreach ($post_types as $post_type => $args):  | 
                                                        |
| 63 | +  | 
                                                        |
| 64 | +			if (!empty($args['rewrite']['slug'])) {
 | 
                                                        |
| 65 | + $args['rewrite']['slug'] = _x($args['rewrite']['slug'], 'URL slug', 'geodirectory');  | 
                                                        |
| 66 | + }  | 
                                                        |
| 67 | + $args = stripslashes_deep($args);  | 
                                                        |
| 68 | +  | 
                                                        |
| 69 | +			if (!empty($args['labels'])) {
 | 
                                                        |
| 70 | +				foreach ($args['labels'] as $key => $val) {
 | 
                                                        |
| 71 | + $args['labels'][$key] = __($val, 'geodirectory');// allow translation  | 
                                                        |
| 72 | + }  | 
                                                        |
| 73 | + }  | 
                                                        |
| 74 | +  | 
                                                        |
| 75 | + /**  | 
                                                        |
| 76 | + * Filter post type args.  | 
                                                        |
| 77 | + *  | 
                                                        |
| 78 | + * @since 1.0.0  | 
                                                        |
| 79 | + * @param string $args Post type args.  | 
                                                        |
| 80 | + * @param string $post_type The post type.  | 
                                                        |
| 81 | + */  | 
                                                        |
| 82 | +			$args = apply_filters('geodir_post_type_args', $args, $post_type);
 | 
                                                        |
| 83 | +  | 
                                                        |
| 84 | + $post_type = register_post_type($post_type, $args);  | 
                                                        |
| 85 | +  | 
                                                        |
| 86 | + endforeach;  | 
                                                        |
| 87 | + endif;  | 
                                                        |
| 88 | 88 | }  | 
                                                        
| 89 | 89 | |
| 90 | 90 | /**  | 
                                                        
@@ -98,72 +98,72 @@ discard block  | 
                                                    ||
| 98 | 98 | */  | 
                                                        
| 99 | 99 | function geodir_post_type_args_modify($args, $post_type)  | 
                                                        
| 100 | 100 |  {
 | 
                                                        
| 101 | -    $geodir_location_prefix = isset($_REQUEST['geodir_location_prefix']) ? trim($_REQUEST['geodir_location_prefix']) : get_option('geodir_location_prefix');
 | 
                                                        |
| 101 | +	$geodir_location_prefix = isset($_REQUEST['geodir_location_prefix']) ? trim($_REQUEST['geodir_location_prefix']) : get_option('geodir_location_prefix');
 | 
                                                        |
| 102 | 102 |  	if (isset($_REQUEST['geodir_listing_prefix']) && $_REQUEST['geodir_listing_prefix'] != '' && geodir_strtolower($_REQUEST['geodir_listing_prefix']) != geodir_strtolower($geodir_location_prefix)) {
 | 
                                                        
| 103 | 103 | |
| 104 | - $listing_slug = htmlentities(trim($_REQUEST['geodir_listing_prefix']));  | 
                                                        |
| 104 | + $listing_slug = htmlentities(trim($_REQUEST['geodir_listing_prefix']));  | 
                                                        |
| 105 | 105 | |
| 106 | -        if ($post_type == 'gd_place') {
 | 
                                                        |
| 107 | -            if (array_key_exists('has_archive', $args))
 | 
                                                        |
| 108 | - $args['has_archive'] = $listing_slug;  | 
                                                        |
| 106 | +		if ($post_type == 'gd_place') {
 | 
                                                        |
| 107 | +			if (array_key_exists('has_archive', $args))
 | 
                                                        |
| 108 | + $args['has_archive'] = $listing_slug;  | 
                                                        |
| 109 | 109 | |
| 110 | -            if (array_key_exists('rewrite', $args)) {
 | 
                                                        |
| 111 | -                if (array_key_exists('slug', $args['rewrite']))
 | 
                                                        |
| 112 | - $args['rewrite']['slug'] = $listing_slug;// . '/%gd_taxonomy%';  | 
                                                        |
| 113 | - }  | 
                                                        |
| 110 | +			if (array_key_exists('rewrite', $args)) {
 | 
                                                        |
| 111 | +				if (array_key_exists('slug', $args['rewrite']))
 | 
                                                        |
| 112 | + $args['rewrite']['slug'] = $listing_slug;// . '/%gd_taxonomy%';  | 
                                                        |
| 113 | + }  | 
                                                        |
| 114 | 114 | |
| 115 | -            $geodir_post_types = get_option('geodir_post_types');
 | 
                                                        |
| 115 | +			$geodir_post_types = get_option('geodir_post_types');
 | 
                                                        |
| 116 | 116 | |
| 117 | -            if (array_key_exists($post_type, $geodir_post_types)) {
 | 
                                                        |
| 117 | +			if (array_key_exists($post_type, $geodir_post_types)) {
 | 
                                                        |
| 118 | 118 | |
| 119 | -                if (array_key_exists('has_archive', $geodir_post_types[$post_type]))
 | 
                                                        |
| 120 | - $geodir_post_types[$post_type]['has_archive'] = $listing_slug;  | 
                                                        |
| 119 | +				if (array_key_exists('has_archive', $geodir_post_types[$post_type]))
 | 
                                                        |
| 120 | + $geodir_post_types[$post_type]['has_archive'] = $listing_slug;  | 
                                                        |
| 121 | 121 | |
| 122 | -                if (array_key_exists('rewrite', $geodir_post_types[$post_type]))
 | 
                                                        |
| 123 | -                    if (array_key_exists('slug', $geodir_post_types[$post_type]['rewrite']))
 | 
                                                        |
| 124 | - $geodir_post_types[$post_type]['rewrite']['slug'] = $listing_slug;// . '/%gd_taxonomy%';  | 
                                                        |
| 122 | +				if (array_key_exists('rewrite', $geodir_post_types[$post_type]))
 | 
                                                        |
| 123 | +					if (array_key_exists('slug', $geodir_post_types[$post_type]['rewrite']))
 | 
                                                        |
| 124 | + $geodir_post_types[$post_type]['rewrite']['slug'] = $listing_slug;// . '/%gd_taxonomy%';  | 
                                                        |
| 125 | 125 | |
| 126 | -                update_option('geodir_post_types', $geodir_post_types);
 | 
                                                        |
| 126 | +				update_option('geodir_post_types', $geodir_post_types);
 | 
                                                        |
| 127 | 127 | |
| 128 | - }  | 
                                                        |
| 128 | + }  | 
                                                        |
| 129 | 129 | |
| 130 | -            $geodir_post_types = get_option('geodir_post_types');
 | 
                                                        |
| 130 | +			$geodir_post_types = get_option('geodir_post_types');
 | 
                                                        |
| 131 | 131 | |
| 132 | - /* --- update taxonomies (category) --- */  | 
                                                        |
| 132 | + /* --- update taxonomies (category) --- */  | 
                                                        |
| 133 | 133 | |
| 134 | -            $geodir_taxonomies = get_option('geodir_taxonomies');
 | 
                                                        |
| 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 | -                update_option('geodir_taxonomies', $geodir_taxonomies);
 | 
                                                        |
| 144 | +				update_option('geodir_taxonomies', $geodir_taxonomies);
 | 
                                                        |
| 145 | 145 | |
| 146 | - }  | 
                                                        |
| 146 | + }  | 
                                                        |
| 147 | 147 | |
| 148 | - /* --- update taxonomies (tags) --- */  | 
                                                        |
| 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';  | 
                                                        |
| 148 | + /* --- update taxonomies (tags) --- */  | 
                                                        |
| 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';  | 
                                                        |
| 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 | -                update_option('geodir_taxonomies', $geodir_taxonomies_tag);
 | 
                                                        |
| 158 | +				update_option('geodir_taxonomies', $geodir_taxonomies_tag);
 | 
                                                        |
| 159 | 159 | |
| 160 | - }  | 
                                                        |
| 160 | + }  | 
                                                        |
| 161 | 161 | |
| 162 | - }  | 
                                                        |
| 162 | + }  | 
                                                        |
| 163 | 163 | |
| 164 | - }  | 
                                                        |
| 164 | + }  | 
                                                        |
| 165 | 165 | |
| 166 | - return $args;  | 
                                                        |
| 166 | + return $args;  | 
                                                        |
| 167 | 167 | }  | 
                                                        
| 168 | 168 | |
| 169 | 169 | /**  | 
                                                        
@@ -176,8 +176,8 @@ discard block  | 
                                                    ||
| 176 | 176 | */  | 
                                                        
| 177 | 177 | function geodir_flush_rewrite_rules()  | 
                                                        
| 178 | 178 |  {
 | 
                                                        
| 179 | - global $wp_rewrite;  | 
                                                        |
| 180 | - $wp_rewrite->flush_rules(false);  | 
                                                        |
| 179 | + global $wp_rewrite;  | 
                                                        |
| 180 | + $wp_rewrite->flush_rules(false);  | 
                                                        |
| 181 | 181 | }  | 
                                                        
| 182 | 182 | |
| 183 | 183 | /**  | 
                                                        
@@ -192,35 +192,35 @@ discard block  | 
                                                    ||
| 192 | 192 | * @return array Rewrite rules.  | 
                                                        
| 193 | 193 | */  | 
                                                        
| 194 | 194 |  function geodir_listing_rewrite_rules($rules) {
 | 
                                                        
| 195 | - $newrules = array();  | 
                                                        |
| 196 | -    $taxonomies = get_option('geodir_taxonomies');
 | 
                                                        |
| 197 | -    $detail_url_seprator = get_option('geodir_detailurl_separator');
 | 
                                                        |
| 195 | + $newrules = array();  | 
                                                        |
| 196 | +	$taxonomies = get_option('geodir_taxonomies');
 | 
                                                        |
| 197 | +	$detail_url_seprator = get_option('geodir_detailurl_separator');
 | 
                                                        |
| 198 | 198 | |
| 199 | 199 | // create rules for post listing  | 
                                                        
| 200 | - if (is_array($taxonomies)):  | 
                                                        |
| 201 | - foreach ($taxonomies as $taxonomy => $args):  | 
                                                        |
| 202 | - $post_type = $args['object_type'];  | 
                                                        |
| 203 | - $listing_slug = $args['listing_slug'];  | 
                                                        |
| 204 | -  | 
                                                        |
| 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]';  | 
                                                        |
| 208 | -            } else {
 | 
                                                        |
| 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]';
 | 
                                                        |
| 211 | - }  | 
                                                        |
| 212 | - endforeach;  | 
                                                        |
| 213 | - endif;  | 
                                                        |
| 214 | -  | 
                                                        |
| 215 | - // create rules for location listing  | 
                                                        |
| 216 | -    $location_page = get_option('geodir_location_page');
 | 
                                                        |
| 200 | + if (is_array($taxonomies)):  | 
                                                        |
| 201 | + foreach ($taxonomies as $taxonomy => $args):  | 
                                                        |
| 202 | + $post_type = $args['object_type'];  | 
                                                        |
| 203 | + $listing_slug = $args['listing_slug'];  | 
                                                        |
| 204 | +  | 
                                                        |
| 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]';  | 
                                                        |
| 208 | +			} else {
 | 
                                                        |
| 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]';
 | 
                                                        |
| 211 | + }  | 
                                                        |
| 212 | + endforeach;  | 
                                                        |
| 213 | + endif;  | 
                                                        |
| 214 | +  | 
                                                        |
| 215 | + // create rules for location listing  | 
                                                        |
| 216 | +	$location_page = get_option('geodir_location_page');
 | 
                                                        |
| 217 | 217 | |
| 218 | -    if($location_page) {
 | 
                                                        |
| 219 | - global $wpdb;  | 
                                                        |
| 220 | -        $location_prefix = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_type='page' AND ID=%d", $location_page));
 | 
                                                        |
| 221 | - }  | 
                                                        |
| 222 | - if (!isset($location_prefix))  | 
                                                        |
| 223 | - $location_prefix = 'location';  | 
                                                        |
| 218 | +	if($location_page) {
 | 
                                                        |
| 219 | + global $wpdb;  | 
                                                        |
| 220 | +		$location_prefix = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_type='page' AND ID=%d", $location_page));
 | 
                                                        |
| 221 | + }  | 
                                                        |
| 222 | + if (!isset($location_prefix))  | 
                                                        |
| 223 | + $location_prefix = 'location';  | 
                                                        |
| 224 | 224 | |
| 225 | 225 |  	$location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
 | 
                                                        
| 226 | 226 |  	if ($location_manager) {
 | 
                                                        
@@ -264,12 +264,12 @@ discard block  | 
                                                    ||
| 264 | 264 | $newrules[$location_prefix . '/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&gd_country=$matches[1]';  | 
                                                        
| 265 | 265 | }  | 
                                                        
| 266 | 266 | |
| 267 | -    if ($location_page && geodir_is_wpml()) {
 | 
                                                        |
| 268 | -        foreach(icl_get_languages('skip_missing=N') as $lang){
 | 
                                                        |
| 269 | - $alt_page_id = '';  | 
                                                        |
| 270 | - $alt_page_id = geodir_wpml_object_id($location_page, 'page', false,$lang['language_code']);  | 
                                                        |
| 271 | -            if($alt_page_id){
 | 
                                                        |
| 272 | -                $location_prefix = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_type='page' AND ID=%d", $alt_page_id));
 | 
                                                        |
| 267 | +	if ($location_page && geodir_is_wpml()) {
 | 
                                                        |
| 268 | +		foreach(icl_get_languages('skip_missing=N') as $lang){
 | 
                                                        |
| 269 | + $alt_page_id = '';  | 
                                                        |
| 270 | + $alt_page_id = geodir_wpml_object_id($location_page, 'page', false,$lang['language_code']);  | 
                                                        |
| 271 | +			if($alt_page_id){
 | 
                                                        |
| 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)) {
 | 
                                                        
| 275 | 275 | $matches2 = '';  | 
                                                        
@@ -305,14 +305,14 @@ discard block  | 
                                                    ||
| 305 | 305 | $newrules[$location_prefix . '/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&gd_country=$matches[1]&gd_region=$matches[2]';  | 
                                                        
| 306 | 306 | $newrules[$location_prefix . '/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&gd_country=$matches[1]';  | 
                                                        
| 307 | 307 | }  | 
                                                        
| 308 | - }  | 
                                                        |
| 309 | - }  | 
                                                        |
| 310 | - }  | 
                                                        |
| 308 | + }  | 
                                                        |
| 309 | + }  | 
                                                        |
| 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 | - $rules = array_merge($newrules, $rules);  | 
                                                        |
| 315 | - return $rules;  | 
                                                        |
| 314 | + $rules = array_merge($newrules, $rules);  | 
                                                        |
| 315 | + return $rules;  | 
                                                        |
| 316 | 316 | }  | 
                                                        
| 317 | 317 | |
| 318 | 318 | /**  | 
                                                        
@@ -327,18 +327,18 @@ discard block  | 
                                                    ||
| 327 | 327 | */  | 
                                                        
| 328 | 328 | function geodir_htaccess_contents($rules)  | 
                                                        
| 329 | 329 |  {
 | 
                                                        
| 330 | - global $wpdb;  | 
                                                        |
| 331 | -    $location_prefix = get_option('geodir_location_prefix');
 | 
                                                        |
| 332 | - // if location page slug changed then add redirect  | 
                                                        |
| 333 | -    if ($location_prefix == 'location') {
 | 
                                                        |
| 334 | - return $rules;  | 
                                                        |
| 335 | - }  | 
                                                        |
| 336 | - $my_content = <<<EOD  | 
                                                        |
| 330 | + global $wpdb;  | 
                                                        |
| 331 | +	$location_prefix = get_option('geodir_location_prefix');
 | 
                                                        |
| 332 | + // if location page slug changed then add redirect  | 
                                                        |
| 333 | +	if ($location_prefix == 'location') {
 | 
                                                        |
| 334 | + return $rules;  | 
                                                        |
| 335 | + }  | 
                                                        |
| 336 | + $my_content = <<<EOD  | 
                                                        |
| 337 | 337 | \n# BEGIN GeoDirectory Rules  | 
                                                        
| 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 | |
@@ -352,10 +352,10 @@ discard block  | 
                                                    ||
| 352 | 352 | */  | 
                                                        
| 353 | 353 | function geodir_add_location_var($public_query_vars)  | 
                                                        
| 354 | 354 |  {
 | 
                                                        
| 355 | - $public_query_vars[] = 'gd_country';  | 
                                                        |
| 356 | - $public_query_vars[] = 'gd_region';  | 
                                                        |
| 357 | - $public_query_vars[] = 'gd_city';  | 
                                                        |
| 358 | - return $public_query_vars;  | 
                                                        |
| 355 | + $public_query_vars[] = 'gd_country';  | 
                                                        |
| 356 | + $public_query_vars[] = 'gd_region';  | 
                                                        |
| 357 | + $public_query_vars[] = 'gd_city';  | 
                                                        |
| 358 | + return $public_query_vars;  | 
                                                        |
| 359 | 359 | }  | 
                                                        
| 360 | 360 | |
| 361 | 361 | /**  | 
                                                        
@@ -368,8 +368,8 @@ discard block  | 
                                                    ||
| 368 | 368 | */  | 
                                                        
| 369 | 369 | function geodir_add_geodir_page_var($public_query_vars)  | 
                                                        
| 370 | 370 |  {
 | 
                                                        
| 371 | - $public_query_vars[] = 'gd_is_geodir_page';  | 
                                                        |
| 372 | - return $public_query_vars;  | 
                                                        |
| 371 | + $public_query_vars[] = 'gd_is_geodir_page';  | 
                                                        |
| 372 | + return $public_query_vars;  | 
                                                        |
| 373 | 373 | }  | 
                                                        
| 374 | 374 | |
| 375 | 375 | /**  | 
                                                        
@@ -381,20 +381,20 @@ discard block  | 
                                                    ||
| 381 | 381 | */  | 
                                                        
| 382 | 382 | function geodir_add_page_id_in_query_var()  | 
                                                        
| 383 | 383 |  {
 | 
                                                        
| 384 | - global $wp_query;  | 
                                                        |
| 384 | + global $wp_query;  | 
                                                        |
| 385 | 385 | |
| 386 | - $page_id = $wp_query->get_queried_object_id();  | 
                                                        |
| 386 | + $page_id = $wp_query->get_queried_object_id();  | 
                                                        |
| 387 | 387 | |
| 388 | -    if (!get_query_var('page_id') && !is_archive()) {
 | 
                                                        |
| 389 | - // fix for WP tags conflict with enfold theme  | 
                                                        |
| 390 | - $theme_name = geodir_strtolower(wp_get_theme());  | 
                                                        |
| 391 | -        if (!geodir_is_geodir_page() && strpos($theme_name, 'enfold') !== false) {
 | 
                                                        |
| 392 | - return $wp_query;  | 
                                                        |
| 393 | - }  | 
                                                        |
| 394 | -        $wp_query->set('page_id', $page_id);
 | 
                                                        |
| 395 | - }  | 
                                                        |
| 388 | +	if (!get_query_var('page_id') && !is_archive()) {
 | 
                                                        |
| 389 | + // fix for WP tags conflict with enfold theme  | 
                                                        |
| 390 | + $theme_name = geodir_strtolower(wp_get_theme());  | 
                                                        |
| 391 | +		if (!geodir_is_geodir_page() && strpos($theme_name, 'enfold') !== false) {
 | 
                                                        |
| 392 | + return $wp_query;  | 
                                                        |
| 393 | + }  | 
                                                        |
| 394 | +		$wp_query->set('page_id', $page_id);
 | 
                                                        |
| 395 | + }  | 
                                                        |
| 396 | 396 | |
| 397 | - return $wp_query;  | 
                                                        |
| 397 | + return $wp_query;  | 
                                                        |
| 398 | 398 | }  | 
                                                        
| 399 | 399 | |
| 400 | 400 | /**  | 
                                                        
@@ -409,23 +409,23 @@ discard block  | 
                                                    ||
| 409 | 409 |  function geodir_set_location_var_in_session_in_core($wp) {
 | 
                                                        
| 410 | 410 | global $gd_session;  | 
                                                        
| 411 | 411 | |
| 412 | - // Fix for WPML removing page_id query var:  | 
                                                        |
| 413 | -    if (isset($wp->query_vars['page']) && !isset($wp->query_vars['page_id']) && isset($wp->query_vars['pagename']) && !is_home()) {
 | 
                                                        |
| 414 | - global $wpdb;  | 
                                                        |
| 412 | + // Fix for WPML removing page_id query var:  | 
                                                        |
| 413 | +	if (isset($wp->query_vars['page']) && !isset($wp->query_vars['page_id']) && isset($wp->query_vars['pagename']) && !is_home()) {
 | 
                                                        |
| 414 | + global $wpdb;  | 
                                                        |
| 415 | 415 | |
| 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']));
 | 
                                                        |
| 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']));
 | 
                                                        |
| 418 | 418 | |
| 419 | -        if (geodir_is_wpml()) {
 | 
                                                        |
| 420 | - $real_page_id = geodir_wpml_object_id($real_page_id, 'page', true, ICL_LANGUAGE_CODE);  | 
                                                        |
| 421 | - }  | 
                                                        |
| 422 | -        if ($real_page_id && $real_page_id!=$page_for_posts) {
 | 
                                                        |
| 423 | - $wp->query_vars['page_id'] = $real_page_id;  | 
                                                        |
| 424 | - }  | 
                                                        |
| 425 | - }  | 
                                                        |
| 419 | +		if (geodir_is_wpml()) {
 | 
                                                        |
| 420 | + $real_page_id = geodir_wpml_object_id($real_page_id, 'page', true, ICL_LANGUAGE_CODE);  | 
                                                        |
| 421 | + }  | 
                                                        |
| 422 | +		if ($real_page_id && $real_page_id!=$page_for_posts) {
 | 
                                                        |
| 423 | + $wp->query_vars['page_id'] = $real_page_id;  | 
                                                        |
| 424 | + }  | 
                                                        |
| 425 | + }  | 
                                                        |
| 426 | 426 | // Query Vars will have page_id parameter  | 
                                                        
| 427 | 427 | // check if query var has page_id and that page id is location page  | 
                                                        
| 428 | - geodir_set_is_geodir_page($wp);  | 
                                                        |
| 428 | + geodir_set_is_geodir_page($wp);  | 
                                                        |
| 429 | 429 | // if is GD homepage set the page ID  | 
                                                        
| 430 | 430 |  	if (geodir_is_page('home')) {
 | 
                                                        
| 431 | 431 |  		$wp->query_vars['page_id'] = get_option('page_on_front');
 | 
                                                        
@@ -434,118 +434,118 @@ discard block  | 
                                                    ||
| 434 | 434 | // The location url format (all or country_city or region_city or city).  | 
                                                        
| 435 | 435 |  	$geodir_show_location_url = get_option('geodir_show_location_url');
 | 
                                                        
| 436 | 436 | |
| 437 | -    if (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_location_page_id()) {
 | 
                                                        |
| 438 | - $gd_country = '';  | 
                                                        |
| 439 | - $gd_region = '';  | 
                                                        |
| 440 | - $gd_city = '';  | 
                                                        |
| 441 | - if (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '')  | 
                                                        |
| 442 | - $gd_country = urldecode($wp->query_vars['gd_country']);  | 
                                                        |
| 443 | -  | 
                                                        |
| 444 | - if (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '')  | 
                                                        |
| 445 | - $gd_region = urldecode($wp->query_vars['gd_region']);  | 
                                                        |
| 446 | -  | 
                                                        |
| 447 | - if (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '')  | 
                                                        |
| 448 | - $gd_city = urldecode($wp->query_vars['gd_city']);  | 
                                                        |
| 449 | -  | 
                                                        |
| 450 | -        if (!($gd_country == '' && $gd_region == '' && $gd_city == '')) {
 | 
                                                        |
| 451 | - $default_location = geodir_get_default_location();  | 
                                                        |
| 452 | -  | 
                                                        |
| 453 | -            if (get_option('geodir_add_location_url')) {
 | 
                                                        |
| 454 | -                if ($geodir_show_location_url != 'all') {
 | 
                                                        |
| 455 | -                    if ($gd_region == '') {
 | 
                                                        |
| 456 | -                        if ($gd_ses_region = $gd_session->get('gd_region'))
 | 
                                                        |
| 457 | - $gd_region = $gd_ses_region;  | 
                                                        |
| 458 | - else  | 
                                                        |
| 459 | - $gd_region = $default_location->region_slug;  | 
                                                        |
| 460 | - }  | 
                                                        |
| 461 | -  | 
                                                        |
| 462 | -                    if ($gd_city == '') {
 | 
                                                        |
| 463 | -                        if ($gd_ses_city = $gd_session->get('gd_city'))
 | 
                                                        |
| 464 | - $gd_city = $gd_ses_city;  | 
                                                        |
| 465 | - else  | 
                                                        |
| 466 | - $gd_city = $default_location->city_slug;  | 
                                                        |
| 467 | -  | 
                                                        |
| 468 | -                        $base_location_link = geodir_get_location_link('base');
 | 
                                                        |
| 469 | - wp_redirect($base_location_link . '/' . $gd_country . '/' . $gd_region . '/' . $gd_city);  | 
                                                        |
| 470 | - exit();  | 
                                                        |
| 471 | - }  | 
                                                        |
| 472 | - }  | 
                                                        |
| 473 | - }  | 
                                                        |
| 474 | -  | 
                                                        |
| 475 | - $args = array(  | 
                                                        |
| 476 | - 'what' => 'city',  | 
                                                        |
| 477 | - 'city_val' => $gd_city,  | 
                                                        |
| 478 | - 'region_val' => $gd_region,  | 
                                                        |
| 479 | - 'country_val' => $gd_country,  | 
                                                        |
| 480 | - 'country_column_name' => 'country_slug',  | 
                                                        |
| 481 | - 'region_column_name' => 'region_slug',  | 
                                                        |
| 482 | - 'city_column_name' => 'city_slug',  | 
                                                        |
| 483 | - 'location_link_part' => false,  | 
                                                        |
| 484 | - 'compare_operator' => ''  | 
                                                        |
| 485 | - );  | 
                                                        |
| 486 | -  | 
                                                        |
| 487 | -            $location_array = function_exists('geodir_get_location_array') ? geodir_get_location_array($args) : array();
 | 
                                                        |
| 488 | -            if (!empty($location_array)) {
 | 
                                                        |
| 489 | -                $gd_session->set('gd_multi_location', 1);
 | 
                                                        |
| 490 | -                $gd_session->set('gd_country', $gd_country);
 | 
                                                        |
| 491 | -                $gd_session->set('gd_region', $gd_region);
 | 
                                                        |
| 492 | -                $gd_session->set('gd_city', $gd_city);
 | 
                                                        |
| 437 | +	if (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_location_page_id()) {
 | 
                                                        |
| 438 | + $gd_country = '';  | 
                                                        |
| 439 | + $gd_region = '';  | 
                                                        |
| 440 | + $gd_city = '';  | 
                                                        |
| 441 | + if (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '')  | 
                                                        |
| 442 | + $gd_country = urldecode($wp->query_vars['gd_country']);  | 
                                                        |
| 443 | +  | 
                                                        |
| 444 | + if (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '')  | 
                                                        |
| 445 | + $gd_region = urldecode($wp->query_vars['gd_region']);  | 
                                                        |
| 446 | +  | 
                                                        |
| 447 | + if (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '')  | 
                                                        |
| 448 | + $gd_city = urldecode($wp->query_vars['gd_city']);  | 
                                                        |
| 449 | +  | 
                                                        |
| 450 | +		if (!($gd_country == '' && $gd_region == '' && $gd_city == '')) {
 | 
                                                        |
| 451 | + $default_location = geodir_get_default_location();  | 
                                                        |
| 452 | +  | 
                                                        |
| 453 | +			if (get_option('geodir_add_location_url')) {
 | 
                                                        |
| 454 | +				if ($geodir_show_location_url != 'all') {
 | 
                                                        |
| 455 | +					if ($gd_region == '') {
 | 
                                                        |
| 456 | +						if ($gd_ses_region = $gd_session->get('gd_region'))
 | 
                                                        |
| 457 | + $gd_region = $gd_ses_region;  | 
                                                        |
| 458 | + else  | 
                                                        |
| 459 | + $gd_region = $default_location->region_slug;  | 
                                                        |
| 460 | + }  | 
                                                        |
| 461 | +  | 
                                                        |
| 462 | +					if ($gd_city == '') {
 | 
                                                        |
| 463 | +						if ($gd_ses_city = $gd_session->get('gd_city'))
 | 
                                                        |
| 464 | + $gd_city = $gd_ses_city;  | 
                                                        |
| 465 | + else  | 
                                                        |
| 466 | + $gd_city = $default_location->city_slug;  | 
                                                        |
| 467 | +  | 
                                                        |
| 468 | +						$base_location_link = geodir_get_location_link('base');
 | 
                                                        |
| 469 | + wp_redirect($base_location_link . '/' . $gd_country . '/' . $gd_region . '/' . $gd_city);  | 
                                                        |
| 470 | + exit();  | 
                                                        |
| 471 | + }  | 
                                                        |
| 472 | + }  | 
                                                        |
| 473 | + }  | 
                                                        |
| 474 | +  | 
                                                        |
| 475 | + $args = array(  | 
                                                        |
| 476 | + 'what' => 'city',  | 
                                                        |
| 477 | + 'city_val' => $gd_city,  | 
                                                        |
| 478 | + 'region_val' => $gd_region,  | 
                                                        |
| 479 | + 'country_val' => $gd_country,  | 
                                                        |
| 480 | + 'country_column_name' => 'country_slug',  | 
                                                        |
| 481 | + 'region_column_name' => 'region_slug',  | 
                                                        |
| 482 | + 'city_column_name' => 'city_slug',  | 
                                                        |
| 483 | + 'location_link_part' => false,  | 
                                                        |
| 484 | + 'compare_operator' => ''  | 
                                                        |
| 485 | + );  | 
                                                        |
| 486 | +  | 
                                                        |
| 487 | +			$location_array = function_exists('geodir_get_location_array') ? geodir_get_location_array($args) : array();
 | 
                                                        |
| 488 | +			if (!empty($location_array)) {
 | 
                                                        |
| 489 | +				$gd_session->set('gd_multi_location', 1);
 | 
                                                        |
| 490 | +				$gd_session->set('gd_country', $gd_country);
 | 
                                                        |
| 491 | +				$gd_session->set('gd_region', $gd_region);
 | 
                                                        |
| 492 | +				$gd_session->set('gd_city', $gd_city);
 | 
                                                        |
| 493 | 493 | |
| 494 | 494 | $wp->query_vars['gd_country'] = $gd_country;  | 
                                                        
| 495 | - $wp->query_vars['gd_region'] = $gd_region;  | 
                                                        |
| 496 | - $wp->query_vars['gd_city'] = $gd_city;  | 
                                                        |
| 497 | -            } else {
 | 
                                                        |
| 498 | -                $gd_session->un_set(array('gd_multi_location', 'gd_city', 'gd_region', 'gd_country'));
 | 
                                                        |
| 499 | - }  | 
                                                        |
| 500 | -        } else {
 | 
                                                        |
| 501 | -            $gd_session->un_set(array('gd_multi_location', 'gd_city', 'gd_region', 'gd_country'));
 | 
                                                        |
| 502 | - }  | 
                                                        |
| 503 | -  | 
                                                        |
| 504 | -    } else if (isset($wp->query_vars['post_type']) && $wp->query_vars['post_type'] != '') {
 | 
                                                        |
| 505 | -        if (!is_admin()) {
 | 
                                                        |
| 506 | - $requested_post_type = $wp->query_vars['post_type'];  | 
                                                        |
| 507 | - // check if this post type is geodirectory post types  | 
                                                        |
| 508 | - $post_type_array = geodir_get_posttypes();  | 
                                                        |
| 495 | + $wp->query_vars['gd_region'] = $gd_region;  | 
                                                        |
| 496 | + $wp->query_vars['gd_city'] = $gd_city;  | 
                                                        |
| 497 | +			} else {
 | 
                                                        |
| 498 | +				$gd_session->un_set(array('gd_multi_location', 'gd_city', 'gd_region', 'gd_country'));
 | 
                                                        |
| 499 | + }  | 
                                                        |
| 500 | +		} else {
 | 
                                                        |
| 501 | +			$gd_session->un_set(array('gd_multi_location', 'gd_city', 'gd_region', 'gd_country'));
 | 
                                                        |
| 502 | + }  | 
                                                        |
| 503 | +  | 
                                                        |
| 504 | +	} else if (isset($wp->query_vars['post_type']) && $wp->query_vars['post_type'] != '') {
 | 
                                                        |
| 505 | +		if (!is_admin()) {
 | 
                                                        |
| 506 | + $requested_post_type = $wp->query_vars['post_type'];  | 
                                                        |
| 507 | + // check if this post type is geodirectory post types  | 
                                                        |
| 508 | + $post_type_array = geodir_get_posttypes();  | 
                                                        |
| 509 | 509 | |
| 510 | 510 |  			if (in_array($requested_post_type, $post_type_array)) {
 | 
                                                        
| 511 | - // now u can apply geodirectory related manipulation.  | 
                                                        |
| 512 | - }  | 
                                                        |
| 513 | - }  | 
                                                        |
| 514 | -    } else {
 | 
                                                        |
| 515 | - // check if a geodirectory taxonomy is set  | 
                                                        |
| 516 | - $gd_country = '';  | 
                                                        |
| 517 | - $gd_region = '';  | 
                                                        |
| 518 | - $gd_city = '';  | 
                                                        |
| 511 | + // now u can apply geodirectory related manipulation.  | 
                                                        |
| 512 | + }  | 
                                                        |
| 513 | + }  | 
                                                        |
| 514 | +	} else {
 | 
                                                        |
| 515 | + // check if a geodirectory taxonomy is set  | 
                                                        |
| 516 | + $gd_country = '';  | 
                                                        |
| 517 | + $gd_region = '';  | 
                                                        |
| 518 | + $gd_city = '';  | 
                                                        |
| 519 | 519 | |
| 520 | 520 | $is_geodir_taxonomy = false;  | 
                                                        
| 521 | - $is_geodir_taxonomy_term = false; // the last term is real geodirectory taxonomy term or not  | 
                                                        |
| 522 | - $is_geodir_location_found = false;  | 
                                                        |
| 521 | + $is_geodir_taxonomy_term = false; // the last term is real geodirectory taxonomy term or not  | 
                                                        |
| 522 | + $is_geodir_location_found = false;  | 
                                                        |
| 523 | 523 | |
| 524 | 524 | $geodir_taxonomy = '';  | 
                                                        
| 525 | - $geodir_post_type = '';  | 
                                                        |
| 526 | - $geodir_term = '';  | 
                                                        |
| 527 | - $geodir_set_location_session = true;  | 
                                                        |
| 528 | -        $geodir_taxonomis = geodir_get_taxonomies('', true);
 | 
                                                        |
| 529 | -  | 
                                                        |
| 530 | -        if(!empty($geodir_taxonomis)){
 | 
                                                        |
| 531 | -            foreach ($geodir_taxonomis as $taxonomy) {
 | 
                                                        |
| 532 | -                if (array_key_exists($taxonomy, $wp->query_vars)) {
 | 
                                                        |
| 533 | - $is_geodir_taxonomy = true;  | 
                                                        |
| 534 | - $geodir_taxonomy = $taxonomy;  | 
                                                        |
| 535 | -                    $geodir_post_type = str_replace('category', '', $taxonomy);
 | 
                                                        |
| 536 | -                    $geodir_post_type = str_replace('_tags', '', $geodir_post_type);
 | 
                                                        |
| 537 | - $geodir_term = $wp->query_vars[$geodir_taxonomy];  | 
                                                        |
| 538 | - break;  | 
                                                        |
| 539 | - }  | 
                                                        |
| 540 | - }  | 
                                                        |
| 541 | - }  | 
                                                        |
| 542 | -  | 
                                                        |
| 543 | - // now get an array of all terms seperated by '/'  | 
                                                        |
| 544 | -        $geodir_terms = explode('/', $geodir_term);
 | 
                                                        |
| 545 | - $geodir_last_term = end($geodir_terms);  | 
                                                        |
| 546 | -  | 
                                                        |
| 547 | -        if ($is_geodir_taxonomy) { // do all these only when it is a geodirectory taxonomy
 | 
                                                        |
| 548 | - $wp->query_vars['post_type'] = $geodir_post_type;  | 
                                                        |
| 525 | + $geodir_post_type = '';  | 
                                                        |
| 526 | + $geodir_term = '';  | 
                                                        |
| 527 | + $geodir_set_location_session = true;  | 
                                                        |
| 528 | +		$geodir_taxonomis = geodir_get_taxonomies('', true);
 | 
                                                        |
| 529 | +  | 
                                                        |
| 530 | +		if(!empty($geodir_taxonomis)){
 | 
                                                        |
| 531 | +			foreach ($geodir_taxonomis as $taxonomy) {
 | 
                                                        |
| 532 | +				if (array_key_exists($taxonomy, $wp->query_vars)) {
 | 
                                                        |
| 533 | + $is_geodir_taxonomy = true;  | 
                                                        |
| 534 | + $geodir_taxonomy = $taxonomy;  | 
                                                        |
| 535 | +					$geodir_post_type = str_replace('category', '', $taxonomy);
 | 
                                                        |
| 536 | +					$geodir_post_type = str_replace('_tags', '', $geodir_post_type);
 | 
                                                        |
| 537 | + $geodir_term = $wp->query_vars[$geodir_taxonomy];  | 
                                                        |
| 538 | + break;  | 
                                                        |
| 539 | + }  | 
                                                        |
| 540 | + }  | 
                                                        |
| 541 | + }  | 
                                                        |
| 542 | +  | 
                                                        |
| 543 | + // now get an array of all terms seperated by '/'  | 
                                                        |
| 544 | +		$geodir_terms = explode('/', $geodir_term);
 | 
                                                        |
| 545 | + $geodir_last_term = end($geodir_terms);  | 
                                                        |
| 546 | +  | 
                                                        |
| 547 | +		if ($is_geodir_taxonomy) { // do all these only when it is a geodirectory taxonomy
 | 
                                                        |
| 548 | + $wp->query_vars['post_type'] = $geodir_post_type;  | 
                                                        |
| 549 | 549 | |
| 550 | 550 | // now check if last term is a post of geodirectory post types  | 
                                                        
| 551 | 551 | $geodir_post = get_posts(array(  | 
                                                        
@@ -594,196 +594,196 @@ discard block  | 
                                                    ||
| 594 | 594 | //return ;  | 
                                                        
| 595 | 595 | }  | 
                                                        
| 596 | 596 | |
| 597 | - $geodir_location_terms = '';  | 
                                                        |
| 598 | - // if last term is not a post then check if last term is a term of the specific texonomy or not  | 
                                                        |
| 599 | -            if (geodir_term_exists($geodir_last_term, $geodir_taxonomy)) {
 | 
                                                        |
| 600 | - $is_geodir_taxonomy_term = true;  | 
                                                        |
| 597 | + $geodir_location_terms = '';  | 
                                                        |
| 598 | + // if last term is not a post then check if last term is a term of the specific texonomy or not  | 
                                                        |
| 599 | +			if (geodir_term_exists($geodir_last_term, $geodir_taxonomy)) {
 | 
                                                        |
| 600 | + $is_geodir_taxonomy_term = true;  | 
                                                        |
| 601 | 601 | |
| 602 | - $geodir_set_location_session = false;  | 
                                                        |
| 603 | - }  | 
                                                        |
| 602 | + $geodir_set_location_session = false;  | 
                                                        |
| 603 | + }  | 
                                                        |
| 604 | 604 | |
| 605 | 605 | |
| 606 | - // now check if there is location parts in the url or not  | 
                                                        |
| 607 | -            if (get_option('geodir_add_location_url')) {				
 | 
                                                        |
| 606 | + // now check if there is location parts in the url or not  | 
                                                        |
| 607 | +			if (get_option('geodir_add_location_url')) {				
 | 
                                                        |
| 608 | 608 | $default_location = geodir_get_default_location();  | 
                                                        
| 609 | 609 | |
| 610 | 610 |  				if ($geodir_show_location_url == 'all') {
 | 
                                                        
| 611 | -                    if (count($geodir_terms) >= 3) {
 | 
                                                        |
| 612 | - $gd_country = urldecode($geodir_terms[0]);  | 
                                                        |
| 613 | - $gd_region = urldecode($geodir_terms[1]);  | 
                                                        |
| 614 | - $gd_city = urldecode($geodir_terms[2]);  | 
                                                        |
| 615 | -                    } else if (count($geodir_terms) >= 2) {
 | 
                                                        |
| 616 | - $gd_country = urldecode($geodir_terms[0]);  | 
                                                        |
| 617 | - $gd_region = urldecode($geodir_terms[1]);  | 
                                                        |
| 618 | -                    } else if (count($geodir_terms) >= 1) {
 | 
                                                        |
| 619 | - $gd_country = urldecode($geodir_terms[0]);  | 
                                                        |
| 620 | - }  | 
                                                        |
| 621 | -  | 
                                                        |
| 622 | - if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) &&  | 
                                                        |
| 623 | - geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region) &&  | 
                                                        |
| 624 | - geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city)  | 
                                                        |
| 625 | - )  | 
                                                        |
| 626 | - $is_geodir_location_found = true;  | 
                                                        |
| 627 | -  | 
                                                        |
| 628 | - // if location has not been found for country , region and city then search for country and region only  | 
                                                        |
| 629 | -  | 
                                                        |
| 630 | -                    if (!$is_geodir_location_found) {
 | 
                                                        |
| 631 | - $gd_city = '';  | 
                                                        |
| 632 | - if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) &&  | 
                                                        |
| 633 | - geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region)  | 
                                                        |
| 634 | - )  | 
                                                        |
| 635 | - $is_geodir_location_found = true;  | 
                                                        |
| 636 | -  | 
                                                        |
| 637 | - }  | 
                                                        |
| 638 | -  | 
                                                        |
| 639 | - // if location has not been found for country , region then search for country only  | 
                                                        |
| 640 | -                    if (!$is_geodir_location_found) {
 | 
                                                        |
| 641 | - $gd_city = '';  | 
                                                        |
| 642 | - $gd_region = '';  | 
                                                        |
| 643 | - if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country))  | 
                                                        |
| 644 | - $is_geodir_location_found = true;  | 
                                                        |
| 645 | - }  | 
                                                        |
| 646 | -                } else if ($geodir_show_location_url == 'country_city') {
 | 
                                                        |
| 647 | -                    if (count($geodir_terms) >= 2) {
 | 
                                                        |
| 648 | - $gd_country = urldecode($geodir_terms[0]);  | 
                                                        |
| 649 | - $gd_city = urldecode($geodir_terms[1]);  | 
                                                        |
| 650 | -                    } else if (count($geodir_terms) >= 1) {
 | 
                                                        |
| 651 | - $gd_country = urldecode($geodir_terms[0]);  | 
                                                        |
| 652 | - }  | 
                                                        |
| 653 | -  | 
                                                        |
| 654 | - if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) && geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city))  | 
                                                        |
| 655 | - $is_geodir_location_found = true;  | 
                                                        |
| 656 | -  | 
                                                        |
| 657 | - // if location has not been found for country and city then search for country only  | 
                                                        |
| 658 | -                    if (!$is_geodir_location_found) {
 | 
                                                        |
| 659 | - $gd_city = '';  | 
                                                        |
| 611 | +					if (count($geodir_terms) >= 3) {
 | 
                                                        |
| 612 | + $gd_country = urldecode($geodir_terms[0]);  | 
                                                        |
| 613 | + $gd_region = urldecode($geodir_terms[1]);  | 
                                                        |
| 614 | + $gd_city = urldecode($geodir_terms[2]);  | 
                                                        |
| 615 | +					} else if (count($geodir_terms) >= 2) {
 | 
                                                        |
| 616 | + $gd_country = urldecode($geodir_terms[0]);  | 
                                                        |
| 617 | + $gd_region = urldecode($geodir_terms[1]);  | 
                                                        |
| 618 | +					} else if (count($geodir_terms) >= 1) {
 | 
                                                        |
| 619 | + $gd_country = urldecode($geodir_terms[0]);  | 
                                                        |
| 620 | + }  | 
                                                        |
| 621 | +  | 
                                                        |
| 622 | + if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) &&  | 
                                                        |
| 623 | + geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region) &&  | 
                                                        |
| 624 | + geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city)  | 
                                                        |
| 625 | + )  | 
                                                        |
| 626 | + $is_geodir_location_found = true;  | 
                                                        |
| 627 | +  | 
                                                        |
| 628 | + // if location has not been found for country , region and city then search for country and region only  | 
                                                        |
| 629 | +  | 
                                                        |
| 630 | +					if (!$is_geodir_location_found) {
 | 
                                                        |
| 631 | + $gd_city = '';  | 
                                                        |
| 632 | + if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) &&  | 
                                                        |
| 633 | + geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region)  | 
                                                        |
| 634 | + )  | 
                                                        |
| 635 | + $is_geodir_location_found = true;  | 
                                                        |
| 636 | +  | 
                                                        |
| 637 | + }  | 
                                                        |
| 638 | +  | 
                                                        |
| 639 | + // if location has not been found for country , region then search for country only  | 
                                                        |
| 640 | +					if (!$is_geodir_location_found) {
 | 
                                                        |
| 641 | + $gd_city = '';  | 
                                                        |
| 642 | + $gd_region = '';  | 
                                                        |
| 643 | + if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country))  | 
                                                        |
| 644 | + $is_geodir_location_found = true;  | 
                                                        |
| 645 | + }  | 
                                                        |
| 646 | +				} else if ($geodir_show_location_url == 'country_city') {
 | 
                                                        |
| 647 | +					if (count($geodir_terms) >= 2) {
 | 
                                                        |
| 648 | + $gd_country = urldecode($geodir_terms[0]);  | 
                                                        |
| 649 | + $gd_city = urldecode($geodir_terms[1]);  | 
                                                        |
| 650 | +					} else if (count($geodir_terms) >= 1) {
 | 
                                                        |
| 651 | + $gd_country = urldecode($geodir_terms[0]);  | 
                                                        |
| 652 | + }  | 
                                                        |
| 653 | +  | 
                                                        |
| 654 | + if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) && geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city))  | 
                                                        |
| 655 | + $is_geodir_location_found = true;  | 
                                                        |
| 656 | +  | 
                                                        |
| 657 | + // if location has not been found for country and city then search for country only  | 
                                                        |
| 658 | +					if (!$is_geodir_location_found) {
 | 
                                                        |
| 659 | + $gd_city = '';  | 
                                                        |
| 660 | 660 | |
| 661 | 661 | if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country))  | 
                                                        
| 662 | - $is_geodir_location_found = true;  | 
                                                        |
| 663 | - }  | 
                                                        |
| 664 | -                }  else if ($geodir_show_location_url == 'region_city') {
 | 
                                                        |
| 665 | -                    if (count($geodir_terms) >= 2) {
 | 
                                                        |
| 666 | - $gd_region = urldecode($geodir_terms[0]);  | 
                                                        |
| 667 | - $gd_city = urldecode($geodir_terms[1]);  | 
                                                        |
| 668 | -                    } else if (count($geodir_terms) >= 1) {
 | 
                                                        |
| 669 | - $gd_region = urldecode($geodir_terms[0]);  | 
                                                        |
| 670 | - }  | 
                                                        |
| 671 | -  | 
                                                        |
| 672 | - if (geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region) && geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city))  | 
                                                        |
| 673 | - $is_geodir_location_found = true;  | 
                                                        |
| 674 | -  | 
                                                        |
| 675 | - // if location has not been found for region and city then search for region only  | 
                                                        |
| 676 | -                    if (!$is_geodir_location_found) {
 | 
                                                        |
| 677 | - $gd_city = '';  | 
                                                        |
| 662 | + $is_geodir_location_found = true;  | 
                                                        |
| 663 | + }  | 
                                                        |
| 664 | +				}  else if ($geodir_show_location_url == 'region_city') {
 | 
                                                        |
| 665 | +					if (count($geodir_terms) >= 2) {
 | 
                                                        |
| 666 | + $gd_region = urldecode($geodir_terms[0]);  | 
                                                        |
| 667 | + $gd_city = urldecode($geodir_terms[1]);  | 
                                                        |
| 668 | +					} else if (count($geodir_terms) >= 1) {
 | 
                                                        |
| 669 | + $gd_region = urldecode($geodir_terms[0]);  | 
                                                        |
| 670 | + }  | 
                                                        |
| 671 | +  | 
                                                        |
| 672 | + if (geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region) && geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city))  | 
                                                        |
| 673 | + $is_geodir_location_found = true;  | 
                                                        |
| 674 | +  | 
                                                        |
| 675 | + // if location has not been found for region and city then search for region only  | 
                                                        |
| 676 | +					if (!$is_geodir_location_found) {
 | 
                                                        |
| 677 | + $gd_city = '';  | 
                                                        |
| 678 | 678 | |
| 679 | 679 | if (geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region))  | 
                                                        
| 680 | - $is_geodir_location_found = true;  | 
                                                        |
| 681 | - }  | 
                                                        |
| 682 | -                } else {
 | 
                                                        |
| 683 | - $gd_city = $geodir_terms[0];  | 
                                                        |
| 684 | -  | 
                                                        |
| 685 | -                    if (geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city)) {
 | 
                                                        |
| 686 | - $is_geodir_location_found = true;  | 
                                                        |
| 687 | - $gd_region = $default_location->region_slug;  | 
                                                        |
| 688 | - $gd_country = $default_location->country_slug;  | 
                                                        |
| 689 | - }  | 
                                                        |
| 690 | - }  | 
                                                        |
| 691 | - // if location still not found then clear location related session variables  | 
                                                        |
| 692 | -                if ($is_geodir_location_found && $geodir_set_location_session) {
 | 
                                                        |
| 693 | -                    $gd_session->set('gd_multi_location', 1);
 | 
                                                        |
| 694 | -                    $gd_session->set('gd_country', $gd_country);
 | 
                                                        |
| 695 | -                    $gd_session->set('gd_region', $gd_region);
 | 
                                                        |
| 696 | -                    $gd_session->set('gd_city', $gd_city);
 | 
                                                        |
| 697 | - }  | 
                                                        |
| 698 | -  | 
                                                        |
| 699 | -                if ($geodir_show_location_url == 'all') {
 | 
                                                        |
| 680 | + $is_geodir_location_found = true;  | 
                                                        |
| 681 | + }  | 
                                                        |
| 682 | +				} else {
 | 
                                                        |
| 683 | + $gd_city = $geodir_terms[0];  | 
                                                        |
| 684 | +  | 
                                                        |
| 685 | +					if (geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city)) {
 | 
                                                        |
| 686 | + $is_geodir_location_found = true;  | 
                                                        |
| 687 | + $gd_region = $default_location->region_slug;  | 
                                                        |
| 688 | + $gd_country = $default_location->country_slug;  | 
                                                        |
| 689 | + }  | 
                                                        |
| 690 | + }  | 
                                                        |
| 691 | + // if location still not found then clear location related session variables  | 
                                                        |
| 692 | +				if ($is_geodir_location_found && $geodir_set_location_session) {
 | 
                                                        |
| 693 | +					$gd_session->set('gd_multi_location', 1);
 | 
                                                        |
| 694 | +					$gd_session->set('gd_country', $gd_country);
 | 
                                                        |
| 695 | +					$gd_session->set('gd_region', $gd_region);
 | 
                                                        |
| 696 | +					$gd_session->set('gd_city', $gd_city);
 | 
                                                        |
| 697 | + }  | 
                                                        |
| 698 | +  | 
                                                        |
| 699 | +				if ($geodir_show_location_url == 'all') {
 | 
                                                        |
| 700 | 700 |  				} else if ($geodir_show_location_url == 'country_city') {
 | 
                                                        
| 701 | 701 | $gd_region = '';  | 
                                                        
| 702 | 702 |  				} else if ($geodir_show_location_url == 'region_city') {
 | 
                                                        
| 703 | 703 | $gd_country = '';  | 
                                                        
| 704 | 704 |  				} else {
 | 
                                                        
| 705 | 705 | $gd_country = '';  | 
                                                        
| 706 | - $gd_region = '';  | 
                                                        |
| 706 | + $gd_region = '';  | 
                                                        |
| 707 | + }  | 
                                                        |
| 708 | +  | 
                                                        |
| 709 | +				if ($is_geodir_location_found) {
 | 
                                                        |
| 710 | + $wp->query_vars['gd_country'] = $gd_country;  | 
                                                        |
| 711 | + $wp->query_vars['gd_region'] = $gd_region;  | 
                                                        |
| 712 | + $wp->query_vars['gd_city'] = $gd_city;  | 
                                                        |
| 713 | +				} else {
 | 
                                                        |
| 714 | + $gd_country = '';  | 
                                                        |
| 715 | + $gd_region = '';  | 
                                                        |
| 716 | + $gd_city = '';  | 
                                                        |
| 707 | 717 | }  | 
                                                        
| 718 | + }  | 
                                                        |
| 719 | +  | 
                                                        |
| 720 | + $wp->query_vars[$geodir_taxonomy] = $geodir_term;  | 
                                                        |
| 721 | + // eliminate location related terms from taxonomy term  | 
                                                        |
| 722 | + if ($gd_country != '')  | 
                                                        |
| 723 | +				$wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_country) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
 | 
                                                        |
| 724 | +  | 
                                                        |
| 725 | + if ($gd_region != '')  | 
                                                        |
| 726 | +				$wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_region) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
 | 
                                                        |
| 727 | +  | 
                                                        |
| 728 | + if ($gd_city != '')  | 
                                                        |
| 729 | +				$wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_city) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
 | 
                                                        |
| 708 | 730 | |
| 709 | -                if ($is_geodir_location_found) {
 | 
                                                        |
| 710 | - $wp->query_vars['gd_country'] = $gd_country;  | 
                                                        |
| 711 | - $wp->query_vars['gd_region'] = $gd_region;  | 
                                                        |
| 712 | - $wp->query_vars['gd_city'] = $gd_city;  | 
                                                        |
| 713 | -                } else {
 | 
                                                        |
| 714 | - $gd_country = '';  | 
                                                        |
| 715 | - $gd_region = '';  | 
                                                        |
| 716 | - $gd_city = '';  | 
                                                        |
| 717 | - }  | 
                                                        |
| 718 | - }  | 
                                                        |
| 719 | -  | 
                                                        |
| 720 | - $wp->query_vars[$geodir_taxonomy] = $geodir_term;  | 
                                                        |
| 721 | - // eliminate location related terms from taxonomy term  | 
                                                        |
| 722 | - if ($gd_country != '')  | 
                                                        |
| 723 | -                $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_country) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
 | 
                                                        |
| 724 | -  | 
                                                        |
| 725 | - if ($gd_region != '')  | 
                                                        |
| 726 | -                $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_region) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
 | 
                                                        |
| 727 | -  | 
                                                        |
| 728 | - if ($gd_city != '')  | 
                                                        |
| 729 | -                $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_city) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
 | 
                                                        |
| 730 | -  | 
                                                        |
| 731 | -  | 
                                                        |
| 732 | -            $wp->query_vars[$geodir_taxonomy] = str_replace('///', '', $wp->query_vars[$geodir_taxonomy]);
 | 
                                                        |
| 733 | -            $wp->query_vars[$geodir_taxonomy] = str_replace('//', '', $wp->query_vars[$geodir_taxonomy]);
 | 
                                                        |
| 734 | -  | 
                                                        |
| 735 | - $wp->query_vars[$geodir_taxonomy] = trim($wp->query_vars[$geodir_taxonomy], '/');  | 
                                                        |
| 736 | -  | 
                                                        |
| 737 | -            if ($wp->query_vars[$geodir_taxonomy] == '') {
 | 
                                                        |
| 738 | - unset($wp->query_vars[$geodir_taxonomy]);  | 
                                                        |
| 739 | -            } else {
 | 
                                                        |
| 740 | -                if (!$is_geodir_taxonomy_term) {
 | 
                                                        |
| 741 | -                    foreach ($wp->query_vars as $key => $vars) {
 | 
                                                        |
| 742 | - unset($wp->query_vars[$key]);  | 
                                                        |
| 743 | - }  | 
                                                        |
| 744 | - $wp->query_vars['error'] = '404';  | 
                                                        |
| 745 | - }  | 
                                                        |
| 746 | - }  | 
                                                        |
| 747 | - }  | 
                                                        |
| 748 | - }  | 
                                                        |
| 731 | +  | 
                                                        |
| 732 | +			$wp->query_vars[$geodir_taxonomy] = str_replace('///', '', $wp->query_vars[$geodir_taxonomy]);
 | 
                                                        |
| 733 | +			$wp->query_vars[$geodir_taxonomy] = str_replace('//', '', $wp->query_vars[$geodir_taxonomy]);
 | 
                                                        |
| 734 | +  | 
                                                        |
| 735 | + $wp->query_vars[$geodir_taxonomy] = trim($wp->query_vars[$geodir_taxonomy], '/');  | 
                                                        |
| 736 | +  | 
                                                        |
| 737 | +			if ($wp->query_vars[$geodir_taxonomy] == '') {
 | 
                                                        |
| 738 | + unset($wp->query_vars[$geodir_taxonomy]);  | 
                                                        |
| 739 | +			} else {
 | 
                                                        |
| 740 | +				if (!$is_geodir_taxonomy_term) {
 | 
                                                        |
| 741 | +					foreach ($wp->query_vars as $key => $vars) {
 | 
                                                        |
| 742 | + unset($wp->query_vars[$key]);  | 
                                                        |
| 743 | + }  | 
                                                        |
| 744 | + $wp->query_vars['error'] = '404';  | 
                                                        |
| 745 | + }  | 
                                                        |
| 746 | + }  | 
                                                        |
| 747 | + }  | 
                                                        |
| 748 | + }  | 
                                                        |
| 749 | 749 | |
| 750 | 750 | // Unset location session if gd page and location not set.  | 
                                                        
| 751 | 751 |  	if (isset($wp->query_vars['gd_is_geodir_page']) && !isset($wp->query_vars['gd_country'])) {
 | 
                                                        
| 752 | 752 |  		$gd_session->un_set(array('gd_multi_location', 'gd_city', 'gd_region', 'gd_country'));
 | 
                                                        
| 753 | 753 | }  | 
                                                        
| 754 | 754 | |
| 755 | -    if ($gd_session->get('gd_multi_location') == 1) {
 | 
                                                        |
| 756 | -        $wp->query_vars['gd_country'] = $gd_session->get('gd_country');
 | 
                                                        |
| 757 | -        $wp->query_vars['gd_region'] = $gd_session->get('gd_region');
 | 
                                                        |
| 758 | -        $wp->query_vars['gd_city'] = $gd_session->get('gd_city');
 | 
                                                        |
| 759 | - }  | 
                                                        |
| 755 | +	if ($gd_session->get('gd_multi_location') == 1) {
 | 
                                                        |
| 756 | +		$wp->query_vars['gd_country'] = $gd_session->get('gd_country');
 | 
                                                        |
| 757 | +		$wp->query_vars['gd_region'] = $gd_session->get('gd_region');
 | 
                                                        |
| 758 | +		$wp->query_vars['gd_city'] = $gd_session->get('gd_city');
 | 
                                                        |
| 759 | + }  | 
                                                        |
| 760 | 760 | |
| 761 | - // now check if there is location parts in the url or not  | 
                                                        |
| 762 | -    if (get_option('geodir_add_location_url')) {        
 | 
                                                        |
| 761 | + // now check if there is location parts in the url or not  | 
                                                        |
| 762 | +	if (get_option('geodir_add_location_url')) {        
 | 
                                                        |
| 763 | 763 |  		if ($geodir_show_location_url == 'all') {
 | 
                                                        
| 764 | 764 |  		} else if ($geodir_show_location_url == 'country_city') {
 | 
                                                        
| 765 | 765 | if (isset($wp->query_vars['gd_region']))  | 
                                                        
| 766 | - $wp->query_vars['gd_region'] = '';  | 
                                                        |
| 766 | + $wp->query_vars['gd_region'] = '';  | 
                                                        |
| 767 | 767 |  		} else if ($geodir_show_location_url == 'region_city') {
 | 
                                                        
| 768 | 768 | if (isset($wp->query_vars['gd_country']))  | 
                                                        
| 769 | - $wp->query_vars['gd_country'] = '';  | 
                                                        |
| 769 | + $wp->query_vars['gd_country'] = '';  | 
                                                        |
| 770 | 770 |  		} else {
 | 
                                                        
| 771 | 771 | if (isset($wp->query_vars['gd_country']))  | 
                                                        
| 772 | - $wp->query_vars['gd_country'] = '';  | 
                                                        |
| 772 | + $wp->query_vars['gd_country'] = '';  | 
                                                        |
| 773 | 773 | |
| 774 | - if (isset($wp->query_vars['gd_region']))  | 
                                                        |
| 775 | - $wp->query_vars['gd_region'] = '';  | 
                                                        |
| 774 | + if (isset($wp->query_vars['gd_region']))  | 
                                                        |
| 775 | + $wp->query_vars['gd_region'] = '';  | 
                                                        |
| 776 | 776 | }  | 
                                                        
| 777 | -    } else {
 | 
                                                        |
| 778 | - if (isset($wp->query_vars['gd_country']))  | 
                                                        |
| 779 | - $wp->query_vars['gd_country'] = '';  | 
                                                        |
| 777 | +	} else {
 | 
                                                        |
| 778 | + if (isset($wp->query_vars['gd_country']))  | 
                                                        |
| 779 | + $wp->query_vars['gd_country'] = '';  | 
                                                        |
| 780 | 780 | |
| 781 | - if (isset($wp->query_vars['gd_region']))  | 
                                                        |
| 782 | - $wp->query_vars['gd_region'] = '';  | 
                                                        |
| 781 | + if (isset($wp->query_vars['gd_region']))  | 
                                                        |
| 782 | + $wp->query_vars['gd_region'] = '';  | 
                                                        |
| 783 | 783 | |
| 784 | - if (isset($wp->query_vars['gd_city']))  | 
                                                        |
| 785 | - $wp->query_vars['gd_city'] = '';  | 
                                                        |
| 786 | - }  | 
                                                        |
| 784 | + if (isset($wp->query_vars['gd_city']))  | 
                                                        |
| 785 | + $wp->query_vars['gd_city'] = '';  | 
                                                        |
| 786 | + }  | 
                                                        |
| 787 | 787 | }  | 
                                                        
| 788 | 788 | |
| 789 | 789 | /**  | 
                                                        
@@ -797,24 +797,24 @@ discard block  | 
                                                    ||
| 797 | 797 | */  | 
                                                        
| 798 | 798 | function geodir_custom_post_status()  | 
                                                        
| 799 | 799 |  {
 | 
                                                        
| 800 | - // Virtual Page Status  | 
                                                        |
| 801 | -    register_post_status('virtual', array(
 | 
                                                        |
| 802 | -        'label' => _x('Virtual', 'page', 'geodirectory'),
 | 
                                                        |
| 803 | - 'public' => true,  | 
                                                        |
| 804 | - 'exclude_from_search' => true,  | 
                                                        |
| 805 | - 'show_in_admin_all_list' => true,  | 
                                                        |
| 806 | - 'show_in_admin_status_list' => true,  | 
                                                        |
| 807 | -        'label_count' => _n_noop('Virtual <span class="count">(%s)</span>', 'Virtual <span class="count">(%s)</span>', 'geodirectory'),
 | 
                                                        |
| 808 | - ));  | 
                                                        |
| 809 | -  | 
                                                        |
| 810 | - /**  | 
                                                        |
| 811 | - * Called after we register the custom post status 'Virtual'.  | 
                                                        |
| 812 | - *  | 
                                                        |
| 813 | - * Can be use to add more post statuses.  | 
                                                        |
| 814 | - *  | 
                                                        |
| 815 | - * @since 1.0.0  | 
                                                        |
| 816 | - */  | 
                                                        |
| 817 | -    do_action('geodir_custom_post_status');
 | 
                                                        |
| 800 | + // Virtual Page Status  | 
                                                        |
| 801 | +	register_post_status('virtual', array(
 | 
                                                        |
| 802 | +		'label' => _x('Virtual', 'page', 'geodirectory'),
 | 
                                                        |
| 803 | + 'public' => true,  | 
                                                        |
| 804 | + 'exclude_from_search' => true,  | 
                                                        |
| 805 | + 'show_in_admin_all_list' => true,  | 
                                                        |
| 806 | + 'show_in_admin_status_list' => true,  | 
                                                        |
| 807 | +		'label_count' => _n_noop('Virtual <span class="count">(%s)</span>', 'Virtual <span class="count">(%s)</span>', 'geodirectory'),
 | 
                                                        |
| 808 | + ));  | 
                                                        |
| 809 | +  | 
                                                        |
| 810 | + /**  | 
                                                        |
| 811 | + * Called after we register the custom post status 'Virtual'.  | 
                                                        |
| 812 | + *  | 
                                                        |
| 813 | + * Can be use to add more post statuses.  | 
                                                        |
| 814 | + *  | 
                                                        |
| 815 | + * @since 1.0.0  | 
                                                        |
| 816 | + */  | 
                                                        |
| 817 | +	do_action('geodir_custom_post_status');
 | 
                                                        |
| 818 | 818 | }  | 
                                                        
| 819 | 819 | |
| 820 | 820 | /**  | 
                                                        
@@ -829,7 +829,7 @@ discard block  | 
                                                    ||
| 829 | 829 | */  | 
                                                        
| 830 | 830 | function geodir_get_term_link($termlink, $term, $taxonomy)  | 
                                                        
| 831 | 831 |  {
 | 
                                                        
| 832 | - return geodir_term_link($termlink, $term, $taxonomy); // taxonomy_functions.php  | 
                                                        |
| 832 | + return geodir_term_link($termlink, $term, $taxonomy); // taxonomy_functions.php  | 
                                                        |
| 833 | 833 | }  | 
                                                        
| 834 | 834 | |
| 835 | 835 | /**  | 
                                                        
@@ -843,7 +843,7 @@ discard block  | 
                                                    ||
| 843 | 843 | */  | 
                                                        
| 844 | 844 | function geodir_get_posttype_link($link, $post_type)  | 
                                                        
| 845 | 845 |  {
 | 
                                                        
| 846 | - return geodir_posttype_link($link, $post_type); // taxonomy_functions.php  | 
                                                        |
| 846 | + return geodir_posttype_link($link, $post_type); // taxonomy_functions.php  | 
                                                        |
| 847 | 847 | }  | 
                                                        
| 848 | 848 | |
| 849 | 849 | /**  | 
                                                        
@@ -858,13 +858,13 @@ discard block  | 
                                                    ||
| 858 | 858 | */  | 
                                                        
| 859 | 859 | function exclude_from_wp_list_pages($exclude_array)  | 
                                                        
| 860 | 860 |  {
 | 
                                                        
| 861 | - $pages_ids = array();  | 
                                                        |
| 862 | -    $pages_array = get_posts(array('post_type' => 'page', 'post_status' => 'virtual'));
 | 
                                                        |
| 863 | -    foreach ($pages_array as $page) {
 | 
                                                        |
| 864 | - $pages_ids[] = $page->ID;  | 
                                                        |
| 865 | - }  | 
                                                        |
| 866 | - $exclude_array = $exclude_array + $pages_ids;  | 
                                                        |
| 867 | - return $exclude_array;  | 
                                                        |
| 861 | + $pages_ids = array();  | 
                                                        |
| 862 | +	$pages_array = get_posts(array('post_type' => 'page', 'post_status' => 'virtual'));
 | 
                                                        |
| 863 | +	foreach ($pages_array as $page) {
 | 
                                                        |
| 864 | + $pages_ids[] = $page->ID;  | 
                                                        |
| 865 | + }  | 
                                                        |
| 866 | + $exclude_array = $exclude_array + $pages_ids;  | 
                                                        |
| 867 | + return $exclude_array;  | 
                                                        |
| 868 | 868 | }  | 
                                                        
| 869 | 869 | |
| 870 | 870 | /**  | 
                                                        
@@ -877,8 +877,8 @@ discard block  | 
                                                    ||
| 877 | 877 | */  | 
                                                        
| 878 | 878 | function geodir_exclude_page($query)  | 
                                                        
| 879 | 879 |  {
 | 
                                                        
| 880 | -    add_filter('posts_where', 'geodir_exclude_page_where', 100);
 | 
                                                        |
| 881 | - return $query;  | 
                                                        |
| 880 | +	add_filter('posts_where', 'geodir_exclude_page_where', 100);
 | 
                                                        |
| 881 | + return $query;  | 
                                                        |
| 882 | 882 | }  | 
                                                        
| 883 | 883 | |
| 884 | 884 | /**  | 
                                                        
@@ -893,11 +893,11 @@ discard block  | 
                                                    ||
| 893 | 893 | */  | 
                                                        
| 894 | 894 | function geodir_exclude_page_where($where)  | 
                                                        
| 895 | 895 |  {
 | 
                                                        
| 896 | - global $wpdb;  | 
                                                        |
| 897 | - if (is_admin())  | 
                                                        |
| 898 | - $where .= " AND $wpdb->posts.post_status != 'virtual'";  | 
                                                        |
| 896 | + global $wpdb;  | 
                                                        |
| 897 | + if (is_admin())  | 
                                                        |
| 898 | + $where .= " AND $wpdb->posts.post_status != 'virtual'";  | 
                                                        |
| 899 | 899 | |
| 900 | - return $where;  | 
                                                        |
| 900 | + return $where;  | 
                                                        |
| 901 | 901 | }  | 
                                                        
| 902 | 902 | |
| 903 | 903 | /**  | 
                                                        
@@ -912,21 +912,21 @@ discard block  | 
                                                    ||
| 912 | 912 | * @return mixed The taxonomy option value.  | 
                                                        
| 913 | 913 | */  | 
                                                        
| 914 | 914 |  function geodir_wpseo_taxonomy_meta( $value, $option = '' ) {
 | 
                                                        
| 915 | - global $wp_query;  | 
                                                        |
| 915 | + global $wp_query;  | 
                                                        |
| 916 | 916 | |
| 917 | -    if ( !empty( $value ) && ( is_category() || is_tax() ) ) {
 | 
                                                        |
| 918 | - $term = $wp_query->get_queried_object();  | 
                                                        |
| 917 | +	if ( !empty( $value ) && ( is_category() || is_tax() ) ) {
 | 
                                                        |
| 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'] ) ) {
 | 
                                                        |
| 924 | - $value[$term->taxonomy][$term->term_id]['wpseo_twitter-image'] = $image['src'];  | 
                                                        |
| 925 | - $value[$term->taxonomy][$term->term_id]['wpseo_opengraph-image'] = $image['src'];  | 
                                                        |
| 926 | - }  | 
                                                        |
| 927 | - }  | 
                                                        |
| 928 | - }  | 
                                                        |
| 929 | - return $value;  | 
                                                        |
| 923 | +			if ( !empty( $image['src'] ) ) {
 | 
                                                        |
| 924 | + $value[$term->taxonomy][$term->term_id]['wpseo_twitter-image'] = $image['src'];  | 
                                                        |
| 925 | + $value[$term->taxonomy][$term->term_id]['wpseo_opengraph-image'] = $image['src'];  | 
                                                        |
| 926 | + }  | 
                                                        |
| 927 | + }  | 
                                                        |
| 928 | + }  | 
                                                        |
| 929 | + return $value;  | 
                                                        |
| 930 | 930 | }  | 
                                                        
| 931 | 931 | add_filter( 'option_wpseo_taxonomy_meta', 'geodir_wpseo_taxonomy_meta', 10, 2 );  | 
                                                        
| 932 | 932 | |
@@ -937,24 +937,24 @@ discard block  | 
                                                    ||
| 937 | 937 | *  | 
                                                        
| 938 | 938 | */  | 
                                                        
| 939 | 939 |  function geodir_affiliate_wp_rewrite_fix() {
 | 
                                                        
| 940 | -    if ( !class_exists( 'Affiliate_WP' ) ) {
 | 
                                                        |
| 941 | - return;  | 
                                                        |
| 942 | - }  | 
                                                        |
| 943 | -  | 
                                                        |
| 944 | - $gd_post_types = geodir_get_posttypes( 'array' );  | 
                                                        |
| 945 | -  | 
                                                        |
| 946 | -    if ( !empty( $gd_post_types ) ) {
 | 
                                                        |
| 947 | - $ref = affiliate_wp()->tracking->get_referral_var();  | 
                                                        |
| 948 | -        if ( empty( $ref ) ) {
 | 
                                                        |
| 949 | - return;  | 
                                                        |
| 950 | - }  | 
                                                        |
| 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');  | 
                                                        |
| 956 | - }  | 
                                                        |
| 957 | - }  | 
                                                        |
| 958 | - }  | 
                                                        |
| 940 | +	if ( !class_exists( 'Affiliate_WP' ) ) {
 | 
                                                        |
| 941 | + return;  | 
                                                        |
| 942 | + }  | 
                                                        |
| 943 | +  | 
                                                        |
| 944 | + $gd_post_types = geodir_get_posttypes( 'array' );  | 
                                                        |
| 945 | +  | 
                                                        |
| 946 | +	if ( !empty( $gd_post_types ) ) {
 | 
                                                        |
| 947 | + $ref = affiliate_wp()->tracking->get_referral_var();  | 
                                                        |
| 948 | +		if ( empty( $ref ) ) {
 | 
                                                        |
| 949 | + return;  | 
                                                        |
| 950 | + }  | 
                                                        |
| 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');  | 
                                                        |
| 956 | + }  | 
                                                        |
| 957 | + }  | 
                                                        |
| 958 | + }  | 
                                                        |
| 959 | 959 | }  | 
                                                        
| 960 | 960 | add_action( 'init', 'geodir_affiliate_wp_rewrite_fix', 99999 );  | 
                                                        
@@ -68,7 +68,7 @@ discard block  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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);
 | 
                                                        |
@@ -151,8 +151,7 @@ discard block  | 
                                                    ||
| 151 | 151 | * @since 1.5.7  | 
                                                        
| 152 | 152 | *  | 
                                                        
| 153 | 153 | * @param string|array $key Session key.  | 
                                                        
| 154 | - * @param integer $value Session variable.  | 
                                                        |
| 155 | - * @return string Session variable.  | 
                                                        |
| 154 | + * @return boolean Session variable.  | 
                                                        |
| 156 | 155 | */  | 
                                                        
| 157 | 156 |  	public function un_set( $key ) { | 
                                                        
| 158 | 157 |  		if ( empty( $key ) ) { | 
                                                        
@@ -188,8 +187,7 @@ discard block  | 
                                                    ||
| 188 | 187 | * @since 1.5.7  | 
                                                        
| 189 | 188 | *  | 
                                                        
| 190 | 189 | * @param string $key Session key.  | 
                                                        
| 191 | - * @param integer $value Session variable.  | 
                                                        |
| 192 | - * @return string Session variable.  | 
                                                        |
| 190 | + * @return boolean Session variable.  | 
                                                        |
| 193 | 191 | */  | 
                                                        
| 194 | 192 |  	public function is_set( $key ) { | 
                                                        
| 195 | 193 | $key = sanitize_key( $key );  | 
                                                        
@@ -1,6 +1,8 @@  | 
                                                    ||
| 1 | 1 | <?php  | 
                                                        
| 2 | 2 | // Exit if accessed directly.  | 
                                                        
| 3 | -if (!defined( 'ABSPATH' ) ) exit;  | 
                                                        |
| 3 | +if (!defined( 'ABSPATH' ) ) { | 
                                                        |
| 4 | + exit;  | 
                                                        |
| 5 | +}  | 
                                                        |
| 4 | 6 | |
| 5 | 7 | /**  | 
                                                        
| 6 | 8 | * Geodir_Session Class.  | 
                                                        
@@ -1,6 +1,6 @@ discard block  | 
                                                    ||
| 1 | 1 | <?php  | 
                                                        
| 2 | 2 | // Exit if accessed directly.  | 
                                                        
| 3 | -if (!defined( 'ABSPATH' ) ) exit;  | 
                                                        |
| 3 | +if (!defined('ABSPATH')) exit; | 
                                                        |
| 4 | 4 | |
| 5 | 5 | /**  | 
                                                        
| 6 | 6 | * Geodir_Session Class.  | 
                                                        
@@ -46,44 +46,44 @@ discard block  | 
                                                    ||
| 46 | 46 |  	public function __construct() { | 
                                                        
| 47 | 47 | $this->use_php_sessions = $this->use_php_sessions();  | 
                                                        
| 48 | 48 | |
| 49 | -		if ( $this->use_php_sessions ) { | 
                                                        |
| 50 | -			if ( is_multisite() ) { | 
                                                        |
| 51 | - $this->prefix = '_' . get_current_blog_id();  | 
                                                        |
| 49 | +		if ($this->use_php_sessions) { | 
                                                        |
| 50 | +			if (is_multisite()) { | 
                                                        |
| 51 | + $this->prefix = '_'.get_current_blog_id();  | 
                                                        |
| 52 | 52 | }  | 
                                                        
| 53 | 53 | |
| 54 | 54 | // Use PHP SESSION (must be enabled via the GEODIR_USE_PHP_SESSIONS constant)  | 
                                                        
| 55 | - add_action( 'init', array( $this, 'maybe_start_session' ), -2 );  | 
                                                        |
| 55 | +			add_action('init', array($this, 'maybe_start_session'), -2); | 
                                                        |
| 56 | 56 |  		} else { | 
                                                        
| 57 | 57 | // Use WP_Session (default)  | 
                                                        
| 58 | -			if ( !defined( 'WP_SESSION_COOKIE' ) ) { | 
                                                        |
| 59 | - define( 'WP_SESSION_COOKIE', 'geodir_wp_session' );  | 
                                                        |
| 58 | +			if (!defined('WP_SESSION_COOKIE')) { | 
                                                        |
| 59 | +				define('WP_SESSION_COOKIE', 'geodir_wp_session'); | 
                                                        |
| 60 | 60 | }  | 
                                                        
| 61 | 61 | |
| 62 | -			if ( !class_exists( 'Recursive_ArrayAccess' ) ) { | 
                                                        |
| 63 | - require_once GEODIRECTORY_PLUGIN_DIR . 'geodirectory-functions/wp-session/class-recursive-arrayaccess.php';  | 
                                                        |
| 62 | +			if (!class_exists('Recursive_ArrayAccess')) { | 
                                                        |
| 63 | + require_once GEODIRECTORY_PLUGIN_DIR.'geodirectory-functions/wp-session/class-recursive-arrayaccess.php';  | 
                                                        |
| 64 | 64 | }  | 
                                                        
| 65 | 65 | |
| 66 | -			if ( !class_exists( 'WP_Session_Utils' ) ) { | 
                                                        |
| 67 | - require_once GEODIRECTORY_PLUGIN_DIR . 'geodirectory-functions/wp-session/class-wp-session-utils.php';  | 
                                                        |
| 66 | +			if (!class_exists('WP_Session_Utils')) { | 
                                                        |
| 67 | + require_once GEODIRECTORY_PLUGIN_DIR.'geodirectory-functions/wp-session/class-wp-session-utils.php';  | 
                                                        |
| 68 | 68 | }  | 
                                                        
| 69 | 69 | |
| 70 | -			if ( defined( 'WP_CLI' ) && WP_CLI && !class_exists( 'WP_Session_Command' ) ) { | 
                                                        |
| 71 | - require_once GEODIRECTORY_PLUGIN_DIR . 'geodirectory-functions/wp-session/wp-cli.php';  | 
                                                        |
| 70 | +			if (defined('WP_CLI') && WP_CLI && !class_exists('WP_Session_Command')) { | 
                                                        |
| 71 | + require_once GEODIRECTORY_PLUGIN_DIR.'geodirectory-functions/wp-session/wp-cli.php';  | 
                                                        |
| 72 | 72 | }  | 
                                                        
| 73 | 73 | |
| 74 | -			if ( !class_exists( 'WP_Session' ) ) { | 
                                                        |
| 75 | - require_once GEODIRECTORY_PLUGIN_DIR . 'geodirectory-functions/wp-session/class-wp-session.php';  | 
                                                        |
| 76 | - require_once GEODIRECTORY_PLUGIN_DIR . 'geodirectory-functions/wp-session/wp-session.php';  | 
                                                        |
| 74 | +			if (!class_exists('WP_Session')) { | 
                                                        |
| 75 | + require_once GEODIRECTORY_PLUGIN_DIR.'geodirectory-functions/wp-session/class-wp-session.php';  | 
                                                        |
| 76 | + require_once GEODIRECTORY_PLUGIN_DIR.'geodirectory-functions/wp-session/wp-session.php';  | 
                                                        |
| 77 | 77 | }  | 
                                                        
| 78 | 78 | |
| 79 | - add_filter( 'wp_session_expiration_variant', array( $this, 'set_expiration_variant_time' ), 99999 );  | 
                                                        |
| 80 | - add_filter( 'wp_session_expiration', array( $this, 'set_expiration_time' ), 99999 );  | 
                                                        |
| 79 | +			add_filter('wp_session_expiration_variant', array($this, 'set_expiration_variant_time'), 99999); | 
                                                        |
| 80 | +			add_filter('wp_session_expiration', array($this, 'set_expiration_time'), 99999); | 
                                                        |
| 81 | 81 | }  | 
                                                        
| 82 | 82 | |
| 83 | -		if ( empty( $this->session ) && ! $this->use_php_sessions ) { | 
                                                        |
| 84 | - add_action( 'plugins_loaded', array( $this, 'init' ), -1 );  | 
                                                        |
| 83 | +		if (empty($this->session) && !$this->use_php_sessions) { | 
                                                        |
| 84 | +			add_action('plugins_loaded', array($this, 'init'), -1); | 
                                                        |
| 85 | 85 |  		} else { | 
                                                        
| 86 | - add_action( 'init', array( $this, 'init' ), -1 );  | 
                                                        |
| 86 | +			add_action('init', array($this, 'init'), -1); | 
                                                        |
| 87 | 87 | }  | 
                                                        
| 88 | 88 | }  | 
                                                        
| 89 | 89 | |
@@ -95,8 +95,8 @@ discard block  | 
                                                    ||
| 95 | 95 | * @return void  | 
                                                        
| 96 | 96 | */  | 
                                                        
| 97 | 97 |  	public function init() { | 
                                                        
| 98 | -		if ( $this->use_php_sessions ) { | 
                                                        |
| 99 | - $this->session = isset( $_SESSION['gd' . $this->prefix ] ) && is_array( $_SESSION['gd' . $this->prefix ] ) ? $_SESSION['gd' . $this->prefix ] : array();  | 
                                                        |
| 98 | +		if ($this->use_php_sessions) { | 
                                                        |
| 99 | + $this->session = isset($_SESSION['gd'.$this->prefix]) && is_array($_SESSION['gd'.$this->prefix]) ? $_SESSION['gd'.$this->prefix] : array();  | 
                                                        |
| 100 | 100 |  		} else { | 
                                                        
| 101 | 101 | $this->session = WP_Session::get_instance();  | 
                                                        
| 102 | 102 | }  | 
                                                        
@@ -112,10 +112,10 @@ discard block  | 
                                                    ||
| 112 | 112 | * @return string Session ID  | 
                                                        
| 113 | 113 | */  | 
                                                        
| 114 | 114 |  	public function get_id() { | 
                                                        
| 115 | -		if ( $this->use_php_sessions ) { | 
                                                        |
| 116 | - $session_id = !empty( $_SESSION ) && function_exists( 'session_id' ) ? session_id() : NULL;  | 
                                                        |
| 115 | +		if ($this->use_php_sessions) { | 
                                                        |
| 116 | +			$session_id = !empty($_SESSION) && function_exists('session_id') ? session_id() : NULL; | 
                                                        |
| 117 | 117 |  		} else { | 
                                                        
| 118 | - $session_id = !empty( $this->session ) && isset( $this->session->session_id ) ? $this->session->session_id : NULL;  | 
                                                        |
| 118 | + $session_id = !empty($this->session) && isset($this->session->session_id) ? $this->session->session_id : NULL;  | 
                                                        |
| 119 | 119 | }  | 
                                                        
| 120 | 120 | return $session_id;  | 
                                                        
| 121 | 121 | }  | 
                                                        
@@ -128,9 +128,9 @@ discard block  | 
                                                    ||
| 128 | 128 | * @param string $key Session key  | 
                                                        
| 129 | 129 | * @return string Session variable  | 
                                                        
| 130 | 130 | */  | 
                                                        
| 131 | -	public function get( $key ) { | 
                                                        |
| 132 | - $key = sanitize_key( $key );  | 
                                                        |
| 133 | - return isset( $this->session[ $key ] ) ? maybe_unserialize( $this->session[ $key ] ) : false;  | 
                                                        |
| 131 | +	public function get($key) { | 
                                                        |
| 132 | + $key = sanitize_key($key);  | 
                                                        |
| 133 | + return isset($this->session[$key]) ? maybe_unserialize($this->session[$key]) : false;  | 
                                                        |
| 134 | 134 | }  | 
                                                        
| 135 | 135 | |
| 136 | 136 | /**  | 
                                                        
@@ -142,20 +142,20 @@ discard block  | 
                                                    ||
| 142 | 142 | * @param integer $value Session variable  | 
                                                        
| 143 | 143 | * @return string Session variable  | 
                                                        
| 144 | 144 | */  | 
                                                        
| 145 | -	public function set( $key, $value ) { | 
                                                        |
| 146 | - $key = sanitize_key( $key );  | 
                                                        |
| 145 | +	public function set($key, $value) { | 
                                                        |
| 146 | + $key = sanitize_key($key);  | 
                                                        |
| 147 | 147 | |
| 148 | -		if ( is_array( $value ) ) { | 
                                                        |
| 149 | - $this->session[ $key ] = maybe_serialize( $value );  | 
                                                        |
| 148 | +		if (is_array($value)) { | 
                                                        |
| 149 | + $this->session[$key] = maybe_serialize($value);  | 
                                                        |
| 150 | 150 |  		} else { | 
                                                        
| 151 | - $this->session[ $key ] = $value;  | 
                                                        |
| 151 | + $this->session[$key] = $value;  | 
                                                        |
| 152 | 152 | }  | 
                                                        
| 153 | 153 | |
| 154 | -		if ( $this->use_php_sessions ) { | 
                                                        |
| 155 | - $_SESSION['gd' . $this->prefix ] = $this->session;  | 
                                                        |
| 154 | +		if ($this->use_php_sessions) { | 
                                                        |
| 155 | + $_SESSION['gd'.$this->prefix] = $this->session;  | 
                                                        |
| 156 | 156 | }  | 
                                                        
| 157 | 157 | |
| 158 | - return $this->session[ $key ];  | 
                                                        |
| 158 | + return $this->session[$key];  | 
                                                        |
| 159 | 159 | }  | 
                                                        
| 160 | 160 | |
| 161 | 161 | /**  | 
                                                        
@@ -167,29 +167,29 @@ discard block  | 
                                                    ||
| 167 | 167 | * @param integer $value Session variable.  | 
                                                        
| 168 | 168 | * @return string Session variable.  | 
                                                        
| 169 | 169 | */  | 
                                                        
| 170 | -	public function un_set( $key ) { | 
                                                        |
| 171 | -		if ( empty( $key ) ) { | 
                                                        |
| 170 | +	public function un_set($key) { | 
                                                        |
| 171 | +		if (empty($key)) { | 
                                                        |
| 172 | 172 | return false;  | 
                                                        
| 173 | 173 | }  | 
                                                        
| 174 | 174 | |
| 175 | -		if ( is_array( $key ) ) { | 
                                                        |
| 175 | +		if (is_array($key)) { | 
                                                        |
| 176 | 176 |  			foreach ($key as $index) { | 
                                                        
| 177 | - $index = sanitize_key( $index );  | 
                                                        |
| 177 | + $index = sanitize_key($index);  | 
                                                        |
| 178 | 178 | |
| 179 | -				if ( $index && isset( $this->session[ $index ] ) ) { | 
                                                        |
| 180 | - unset( $this->session[ $index ] );  | 
                                                        |
| 179 | +				if ($index && isset($this->session[$index])) { | 
                                                        |
| 180 | + unset($this->session[$index]);  | 
                                                        |
| 181 | 181 | }  | 
                                                        
| 182 | 182 | }  | 
                                                        
| 183 | 183 |  		} else { | 
                                                        
| 184 | - $key = sanitize_key( $key );  | 
                                                        |
| 184 | + $key = sanitize_key($key);  | 
                                                        |
| 185 | 185 | |
| 186 | -			if ( isset( $this->session[ $key ] ) ) { | 
                                                        |
| 187 | - unset( $this->session[ $key ] );  | 
                                                        |
| 186 | +			if (isset($this->session[$key])) { | 
                                                        |
| 187 | + unset($this->session[$key]);  | 
                                                        |
| 188 | 188 | }  | 
                                                        
| 189 | 189 | }  | 
                                                        
| 190 | 190 | |
| 191 | -		if ( $this->use_php_sessions ) { | 
                                                        |
| 192 | - $_SESSION['gd' . $this->prefix ] = $this->session;  | 
                                                        |
| 191 | +		if ($this->use_php_sessions) { | 
                                                        |
| 192 | + $_SESSION['gd'.$this->prefix] = $this->session;  | 
                                                        |
| 193 | 193 | }  | 
                                                        
| 194 | 194 | |
| 195 | 195 | return true;  | 
                                                        
@@ -204,14 +204,14 @@ discard block  | 
                                                    ||
| 204 | 204 | * @param integer $value Session variable.  | 
                                                        
| 205 | 205 | * @return string Session variable.  | 
                                                        
| 206 | 206 | */  | 
                                                        
| 207 | -	public function is_set( $key ) { | 
                                                        |
| 208 | - $key = sanitize_key( $key );  | 
                                                        |
| 207 | +	public function is_set($key) { | 
                                                        |
| 208 | + $key = sanitize_key($key);  | 
                                                        |
| 209 | 209 | |
| 210 | -		if ( empty( $key ) ) { | 
                                                        |
| 210 | +		if (empty($key)) { | 
                                                        |
| 211 | 211 | return false;  | 
                                                        
| 212 | 212 | }  | 
                                                        
| 213 | 213 | |
| 214 | -		if ( isset( $this->session[ $key ] ) ) { | 
                                                        |
| 214 | +		if (isset($this->session[$key])) { | 
                                                        |
| 215 | 215 | return true;  | 
                                                        
| 216 | 216 | }  | 
                                                        
| 217 | 217 | |
@@ -226,8 +226,8 @@ discard block  | 
                                                    ||
| 226 | 226 | * @param int $exp Default expiration (1 hour)  | 
                                                        
| 227 | 227 | * @return int  | 
                                                        
| 228 | 228 | */  | 
                                                        
| 229 | -	public function set_expiration_variant_time( $exp ) { | 
                                                        |
| 230 | - return ( 30 * 60 * 23 );  | 
                                                        |
| 229 | +	public function set_expiration_variant_time($exp) { | 
                                                        |
| 230 | + return (30 * 60 * 23);  | 
                                                        |
| 231 | 231 | }  | 
                                                        
| 232 | 232 | |
| 233 | 233 | /**  | 
                                                        
@@ -238,8 +238,8 @@ discard block  | 
                                                    ||
| 238 | 238 | * @param int $exp Default expiration (1 hour)  | 
                                                        
| 239 | 239 | * @return int  | 
                                                        
| 240 | 240 | */  | 
                                                        
| 241 | -	public function set_expiration_time( $exp ) { | 
                                                        |
| 242 | - return ( 30 * 60 * 24 );  | 
                                                        |
| 241 | +	public function set_expiration_time($exp) { | 
                                                        |
| 242 | + return (30 * 60 * 24);  | 
                                                        |
| 243 | 243 | }  | 
                                                        
| 244 | 244 | |
| 245 | 245 | /**  | 
                                                        
@@ -257,18 +257,18 @@ discard block  | 
                                                    ||
| 257 | 257 | $ret = false;  | 
                                                        
| 258 | 258 | |
| 259 | 259 | // If the database variable is already set, no need to run autodetection  | 
                                                        
| 260 | - $geodir_use_php_sessions = (bool)get_option( 'geodir_use_php_sessions' );  | 
                                                        |
| 260 | +		$geodir_use_php_sessions = (bool) get_option('geodir_use_php_sessions'); | 
                                                        |
| 261 | 261 | |
| 262 | -		if (!$geodir_use_php_sessions ) { | 
                                                        |
| 262 | +		if (!$geodir_use_php_sessions) { | 
                                                        |
| 263 | 263 | // Attempt to detect if the server supports PHP sessions  | 
                                                        
| 264 | -			if ( function_exists( 'session_start' ) && ! ini_get( 'safe_mode' ) ) { | 
                                                        |
| 265 | - $this->set( 'geodir_use_php_sessions', 1 );  | 
                                                        |
| 264 | +			if (function_exists('session_start') && !ini_get('safe_mode')) { | 
                                                        |
| 265 | +				$this->set('geodir_use_php_sessions', 1); | 
                                                        |
| 266 | 266 | |
| 267 | -				if ( $this->get( 'geodir_use_php_sessions' ) ) { | 
                                                        |
| 267 | +				if ($this->get('geodir_use_php_sessions')) { | 
                                                        |
| 268 | 268 | $ret = true;  | 
                                                        
| 269 | 269 | |
| 270 | 270 | // Set the database option  | 
                                                        
| 271 | - update_option( 'geodir_use_php_sessions', true );  | 
                                                        |
| 271 | +					update_option('geodir_use_php_sessions', true); | 
                                                        |
| 272 | 272 | }  | 
                                                        
| 273 | 273 | }  | 
                                                        
| 274 | 274 |  		} else { | 
                                                        
@@ -276,20 +276,20 @@ discard block  | 
                                                    ||
| 276 | 276 | }  | 
                                                        
| 277 | 277 | |
| 278 | 278 | // Enable or disable PHP Sessions based on the GEODIR_USE_PHP_SESSIONS constant  | 
                                                        
| 279 | -		if ( defined( 'GEODIR_USE_PHP_SESSIONS' ) && GEODIR_USE_PHP_SESSIONS ) { | 
                                                        |
| 279 | +		if (defined('GEODIR_USE_PHP_SESSIONS') && GEODIR_USE_PHP_SESSIONS) { | 
                                                        |
| 280 | 280 | $ret = true;  | 
                                                        
| 281 | -		} else if ( defined( 'GEODIR_USE_PHP_SESSIONS' ) && ! GEODIR_USE_PHP_SESSIONS ) { | 
                                                        |
| 281 | +		} else if (defined('GEODIR_USE_PHP_SESSIONS') && !GEODIR_USE_PHP_SESSIONS) { | 
                                                        |
| 282 | 282 | $ret = false;  | 
                                                        
| 283 | 283 | }  | 
                                                        
| 284 | 284 | |
| 285 | - return (bool) apply_filters( 'geodir_use_php_sessions', $ret );  | 
                                                        |
| 285 | +		return (bool) apply_filters('geodir_use_php_sessions', $ret); | 
                                                        |
| 286 | 286 | }  | 
                                                        
| 287 | 287 | |
| 288 | 288 | /**  | 
                                                        
| 289 | 289 | * Starts a new session if one hasn't started yet.  | 
                                                        
| 290 | 290 | */  | 
                                                        
| 291 | 291 |  	public function maybe_start_session() { | 
                                                        
| 292 | -		if ( !session_id() && !headers_sent() ) { | 
                                                        |
| 292 | +		if (!session_id() && !headers_sent()) { | 
                                                        |
| 293 | 293 | session_start();  | 
                                                        
| 294 | 294 | }  | 
                                                        
| 295 | 295 | }  | 
                                                        
@@ -46,7 +46,6 @@ discard block  | 
                                                    ||
| 46 | 46 | * @since 1.0.0  | 
                                                        
| 47 | 47 | * @since 1.5.2 Added TERRAIN map type.  | 
                                                        
| 48 | 48 | *  | 
                                                        
| 49 | - * @param string $value Input value to validate measurement.  | 
                                                        |
| 50 | 49 | * @return string The measurement valud in valid format.  | 
                                                        
| 51 | 50 | */  | 
                                                        
| 52 | 51 | function gdsc_validate_map_args($params)  | 
                                                        
@@ -95,7 +94,7 @@ discard block  | 
                                                    ||
| 95 | 94 | * @param mixed $in The variable to check  | 
                                                        
| 96 | 95 | * @param bool $strict If set to false, consider everything that is not false to be true.  | 
                                                        
| 97 | 96 | *  | 
                                                        
| 98 | - * @return bool The boolean equivalent or null  | 
                                                        |
| 97 | + * @return null|boolean The boolean equivalent or null  | 
                                                        |
| 99 | 98 | */  | 
                                                        
| 100 | 99 | function gdsc_to_bool_val($in, $strict = false)  | 
                                                        
| 101 | 100 |  { | 
                                                        
@@ -9,7 +9,7 @@ discard block  | 
                                                    ||
| 9 | 9 | |
| 10 | 10 | // If this file is called directly, abort.  | 
                                                        
| 11 | 11 |  if (!defined('WPINC')) { | 
                                                        
| 12 | - die;  | 
                                                        |
| 12 | + die;  | 
                                                        |
| 13 | 13 | }  | 
                                                        
| 14 | 14 | |
| 15 | 15 | /**  | 
                                                        
@@ -22,22 +22,22 @@ discard block  | 
                                                    ||
| 22 | 22 | */  | 
                                                        
| 23 | 23 | function gdsc_validate_measurements($value)  | 
                                                        
| 24 | 24 |  { | 
                                                        
| 25 | -    if ((strlen($value) - 1) == strpos(trim($value), '%')) { | 
                                                        |
| 26 | - // $value is entered as a percent, so it can't be less than 0 or more than 100  | 
                                                        |
| 27 | -        $value = preg_replace('/\D/', '', $value); | 
                                                        |
| 28 | -        if (100 < $value) { | 
                                                        |
| 29 | - $value = 100;  | 
                                                        |
| 30 | - }  | 
                                                        |
| 31 | - // Re-add the percent symbol  | 
                                                        |
| 32 | - $value = $value . '%';  | 
                                                        |
| 33 | -    } elseif ((strlen($value) - 2) == strpos(trim($value), 'px')) { | 
                                                        |
| 34 | - // Get the absint & re-add the 'px'  | 
                                                        |
| 35 | -        $value = preg_replace('/\D/', '', $value) . 'px'; | 
                                                        |
| 36 | -    } else { | 
                                                        |
| 37 | -        $value = preg_replace('/\D/', '', $value); | 
                                                        |
| 38 | - }  | 
                                                        |
| 25 | +	if ((strlen($value) - 1) == strpos(trim($value), '%')) { | 
                                                        |
| 26 | + // $value is entered as a percent, so it can't be less than 0 or more than 100  | 
                                                        |
| 27 | +		$value = preg_replace('/\D/', '', $value); | 
                                                        |
| 28 | +		if (100 < $value) { | 
                                                        |
| 29 | + $value = 100;  | 
                                                        |
| 30 | + }  | 
                                                        |
| 31 | + // Re-add the percent symbol  | 
                                                        |
| 32 | + $value = $value . '%';  | 
                                                        |
| 33 | +	} elseif ((strlen($value) - 2) == strpos(trim($value), 'px')) { | 
                                                        |
| 34 | + // Get the absint & re-add the 'px'  | 
                                                        |
| 35 | +		$value = preg_replace('/\D/', '', $value) . 'px'; | 
                                                        |
| 36 | +	} else { | 
                                                        |
| 37 | +		$value = preg_replace('/\D/', '', $value); | 
                                                        |
| 38 | + }  | 
                                                        |
| 39 | 39 | |
| 40 | - return $value;  | 
                                                        |
| 40 | + return $value;  | 
                                                        |
| 41 | 41 | }  | 
                                                        
| 42 | 42 | |
| 43 | 43 | /**  | 
                                                        
@@ -52,35 +52,35 @@ discard block  | 
                                                    ||
| 52 | 52 | function gdsc_validate_map_args($params)  | 
                                                        
| 53 | 53 |  { | 
                                                        
| 54 | 54 | |
| 55 | - $params['width'] = gdsc_validate_measurements($params['width']);  | 
                                                        |
| 56 | - $params['height'] = gdsc_validate_measurements($params['height']);  | 
                                                        |
| 55 | + $params['width'] = gdsc_validate_measurements($params['width']);  | 
                                                        |
| 56 | + $params['height'] = gdsc_validate_measurements($params['height']);  | 
                                                        |
| 57 | 57 | |
| 58 | - // Only accept our 4 maptypes. Otherwise, revert to the default.  | 
                                                        |
| 59 | -    if (!(in_array(geodir_strtoupper($params['maptype']), array('HYBRID', 'SATELLITE', 'ROADMAP', 'TERRAIN')))) { | 
                                                        |
| 60 | - $params['maptype'] = 'ROADMAP';  | 
                                                        |
| 61 | -    } else { | 
                                                        |
| 62 | - $params['maptype'] = geodir_strtoupper($params['maptype']);  | 
                                                        |
| 63 | - }  | 
                                                        |
| 58 | + // Only accept our 4 maptypes. Otherwise, revert to the default.  | 
                                                        |
| 59 | +	if (!(in_array(geodir_strtoupper($params['maptype']), array('HYBRID', 'SATELLITE', 'ROADMAP', 'TERRAIN')))) { | 
                                                        |
| 60 | + $params['maptype'] = 'ROADMAP';  | 
                                                        |
| 61 | +	} else { | 
                                                        |
| 62 | + $params['maptype'] = geodir_strtoupper($params['maptype']);  | 
                                                        |
| 63 | + }  | 
                                                        |
| 64 | 64 | |
| 65 | - // Zoom accepts a value between 1 and 19  | 
                                                        |
| 66 | - $params['zoom'] = absint($params['zoom']);  | 
                                                        |
| 67 | -    if (19 < $params['zoom']) { | 
                                                        |
| 68 | - $params['zoom'] = '19';  | 
                                                        |
| 69 | - }  | 
                                                        |
| 70 | -    if (0 == $params['zoom']) { | 
                                                        |
| 71 | - $params['zoom'] = '1';  | 
                                                        |
| 72 | - }  | 
                                                        |
| 65 | + // Zoom accepts a value between 1 and 19  | 
                                                        |
| 66 | + $params['zoom'] = absint($params['zoom']);  | 
                                                        |
| 67 | +	if (19 < $params['zoom']) { | 
                                                        |
| 68 | + $params['zoom'] = '19';  | 
                                                        |
| 69 | + }  | 
                                                        |
| 70 | +	if (0 == $params['zoom']) { | 
                                                        |
| 71 | + $params['zoom'] = '1';  | 
                                                        |
| 72 | + }  | 
                                                        |
| 73 | 73 | |
| 74 | - // Child_collapse must be boolean  | 
                                                        |
| 75 | - $params['child_collapse'] = gdsc_to_bool_val($params['child_collapse']);  | 
                                                        |
| 74 | + // Child_collapse must be boolean  | 
                                                        |
| 75 | + $params['child_collapse'] = gdsc_to_bool_val($params['child_collapse']);  | 
                                                        |
| 76 | 76 | |
| 77 | - // Scrollwheel must be boolean  | 
                                                        |
| 78 | - $params['scrollwheel'] = gdsc_to_bool_val($params['scrollwheel']);  | 
                                                        |
| 77 | + // Scrollwheel must be boolean  | 
                                                        |
| 78 | + $params['scrollwheel'] = gdsc_to_bool_val($params['scrollwheel']);  | 
                                                        |
| 79 | 79 | |
| 80 | - // Scrollwheel must be boolean  | 
                                                        |
| 81 | - $params['autozoom'] = gdsc_to_bool_val($params['autozoom']);  | 
                                                        |
| 80 | + // Scrollwheel must be boolean  | 
                                                        |
| 81 | + $params['autozoom'] = gdsc_to_bool_val($params['autozoom']);  | 
                                                        |
| 82 | 82 | |
| 83 | - return $params;  | 
                                                        |
| 83 | + return $params;  | 
                                                        |
| 84 | 84 | }  | 
                                                        
| 85 | 85 | |
| 86 | 86 | /**  | 
                                                        
@@ -99,52 +99,52 @@ discard block  | 
                                                    ||
| 99 | 99 | */  | 
                                                        
| 100 | 100 | function gdsc_to_bool_val($in, $strict = false)  | 
                                                        
| 101 | 101 |  { | 
                                                        
| 102 | - $out = null;  | 
                                                        |
| 103 | -  | 
                                                        |
| 104 | - // if not strict, we only have to check if something is false  | 
                                                        |
| 105 | - if (in_array($in, array(  | 
                                                        |
| 106 | - 'false',  | 
                                                        |
| 107 | - 'False',  | 
                                                        |
| 108 | - 'FALSE',  | 
                                                        |
| 109 | - 'no',  | 
                                                        |
| 110 | - 'No',  | 
                                                        |
| 111 | - 'n',  | 
                                                        |
| 112 | - 'N',  | 
                                                        |
| 113 | - '0',  | 
                                                        |
| 114 | - 'off',  | 
                                                        |
| 115 | - 'Off',  | 
                                                        |
| 116 | - 'OFF',  | 
                                                        |
| 117 | - false,  | 
                                                        |
| 118 | - 0,  | 
                                                        |
| 119 | - null  | 
                                                        |
| 120 | -    ), true)) { | 
                                                        |
| 121 | - $out = false;  | 
                                                        |
| 122 | -    } else if ($strict) { | 
                                                        |
| 123 | - // if strict, check the equivalent true values  | 
                                                        |
| 124 | - if (in_array($in, array(  | 
                                                        |
| 125 | - 'true',  | 
                                                        |
| 126 | - 'True',  | 
                                                        |
| 127 | - 'TRUE',  | 
                                                        |
| 128 | - 'yes',  | 
                                                        |
| 129 | - 'Yes',  | 
                                                        |
| 130 | - 'y',  | 
                                                        |
| 131 | - 'Y',  | 
                                                        |
| 132 | - '1',  | 
                                                        |
| 133 | - 'on',  | 
                                                        |
| 134 | - 'On',  | 
                                                        |
| 135 | - 'ON',  | 
                                                        |
| 136 | - true,  | 
                                                        |
| 137 | - 1  | 
                                                        |
| 138 | -        ), true)) { | 
                                                        |
| 139 | - $out = true;  | 
                                                        |
| 140 | - }  | 
                                                        |
| 141 | -    } else { | 
                                                        |
| 142 | - // not strict? let the regular php bool check figure it out (will  | 
                                                        |
| 143 | - // largely default to true)  | 
                                                        |
| 144 | - $out = ($in ? true : false);  | 
                                                        |
| 145 | - }  | 
                                                        |
| 102 | + $out = null;  | 
                                                        |
| 103 | +  | 
                                                        |
| 104 | + // if not strict, we only have to check if something is false  | 
                                                        |
| 105 | + if (in_array($in, array(  | 
                                                        |
| 106 | + 'false',  | 
                                                        |
| 107 | + 'False',  | 
                                                        |
| 108 | + 'FALSE',  | 
                                                        |
| 109 | + 'no',  | 
                                                        |
| 110 | + 'No',  | 
                                                        |
| 111 | + 'n',  | 
                                                        |
| 112 | + 'N',  | 
                                                        |
| 113 | + '0',  | 
                                                        |
| 114 | + 'off',  | 
                                                        |
| 115 | + 'Off',  | 
                                                        |
| 116 | + 'OFF',  | 
                                                        |
| 117 | + false,  | 
                                                        |
| 118 | + 0,  | 
                                                        |
| 119 | + null  | 
                                                        |
| 120 | +	), true)) { | 
                                                        |
| 121 | + $out = false;  | 
                                                        |
| 122 | +	} else if ($strict) { | 
                                                        |
| 123 | + // if strict, check the equivalent true values  | 
                                                        |
| 124 | + if (in_array($in, array(  | 
                                                        |
| 125 | + 'true',  | 
                                                        |
| 126 | + 'True',  | 
                                                        |
| 127 | + 'TRUE',  | 
                                                        |
| 128 | + 'yes',  | 
                                                        |
| 129 | + 'Yes',  | 
                                                        |
| 130 | + 'y',  | 
                                                        |
| 131 | + 'Y',  | 
                                                        |
| 132 | + '1',  | 
                                                        |
| 133 | + 'on',  | 
                                                        |
| 134 | + 'On',  | 
                                                        |
| 135 | + 'ON',  | 
                                                        |
| 136 | + true,  | 
                                                        |
| 137 | + 1  | 
                                                        |
| 138 | +		), true)) { | 
                                                        |
| 139 | + $out = true;  | 
                                                        |
| 140 | + }  | 
                                                        |
| 141 | +	} else { | 
                                                        |
| 142 | + // not strict? let the regular php bool check figure it out (will  | 
                                                        |
| 143 | + // largely default to true)  | 
                                                        |
| 144 | + $out = ($in ? true : false);  | 
                                                        |
| 145 | + }  | 
                                                        |
| 146 | 146 | |
| 147 | - return $out;  | 
                                                        |
| 147 | + return $out;  | 
                                                        |
| 148 | 148 | }  | 
                                                        
| 149 | 149 | |
| 150 | 150 | /**  | 
                                                        
@@ -157,16 +157,16 @@ discard block  | 
                                                    ||
| 157 | 157 | */  | 
                                                        
| 158 | 158 | function gdsc_is_post_type_valid($incoming_post_type)  | 
                                                        
| 159 | 159 |  { | 
                                                        
| 160 | - $post_types = geodir_get_posttypes();  | 
                                                        |
| 161 | -    $post_types = array_map('geodir_strtolower', $post_types); | 
                                                        |
| 162 | - $post_type_found = false;  | 
                                                        |
| 163 | -    foreach ($post_types as $type) { | 
                                                        |
| 164 | -        if (geodir_strtolower($incoming_post_type) == geodir_strtolower($type)) { | 
                                                        |
| 165 | - $post_type_found = true;  | 
                                                        |
| 166 | - }  | 
                                                        |
| 167 | - }  | 
                                                        |
| 160 | + $post_types = geodir_get_posttypes();  | 
                                                        |
| 161 | +	$post_types = array_map('geodir_strtolower', $post_types); | 
                                                        |
| 162 | + $post_type_found = false;  | 
                                                        |
| 163 | +	foreach ($post_types as $type) { | 
                                                        |
| 164 | +		if (geodir_strtolower($incoming_post_type) == geodir_strtolower($type)) { | 
                                                        |
| 165 | + $post_type_found = true;  | 
                                                        |
| 166 | + }  | 
                                                        |
| 167 | + }  | 
                                                        |
| 168 | 168 | |
| 169 | - return $post_type_found;  | 
                                                        |
| 169 | + return $post_type_found;  | 
                                                        |
| 170 | 170 | }  | 
                                                        
| 171 | 171 | |
| 172 | 172 | /**  | 
                                                        
@@ -186,52 +186,52 @@ discard block  | 
                                                    ||
| 186 | 186 | */  | 
                                                        
| 187 | 187 | function gdsc_listing_loop_filter($query)  | 
                                                        
| 188 | 188 |  { | 
                                                        
| 189 | - global $wp_query, $geodir_post_type, $table, $plugin_prefix, $term;  | 
                                                        |
| 190 | -  | 
                                                        |
| 191 | - $geodir_post_type = geodir_get_current_posttype();  | 
                                                        |
| 192 | -  | 
                                                        |
| 193 | -    if (isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries) { | 
                                                        |
| 194 | - $taxonomies = wp_list_pluck($wp_query->tax_query->queries, 'taxonomy');  | 
                                                        |
| 195 | -  | 
                                                        |
| 196 | -        if (isset($wp_query->query[$taxonomies[0]])) { | 
                                                        |
| 197 | -            $request_term = explode("/", $wp_query->query[$taxonomies[0]]); | 
                                                        |
| 198 | - $request_term = end($request_term);  | 
                                                        |
| 199 | -            if (!term_exists($request_term)) { | 
                                                        |
| 200 | -                $args = array('number' => '1',); | 
                                                        |
| 201 | - $terms_arr = get_terms($taxonomies[0], $args);  | 
                                                        |
| 202 | -                foreach ($terms_arr as $location_term) { | 
                                                        |
| 203 | - $term_arr = $location_term;  | 
                                                        |
| 204 | -                    $term_arr->name = geodir_ucwords(str_replace('-', ' ', $request_term)); | 
                                                        |
| 205 | - }  | 
                                                        |
| 206 | - $wp_query->queried_object_id = 1;  | 
                                                        |
| 207 | - $wp_query->queried_object = $term_arr;  | 
                                                        |
| 208 | - }  | 
                                                        |
| 209 | - }  | 
                                                        |
| 189 | + global $wp_query, $geodir_post_type, $table, $plugin_prefix, $term;  | 
                                                        |
| 190 | +  | 
                                                        |
| 191 | + $geodir_post_type = geodir_get_current_posttype();  | 
                                                        |
| 192 | +  | 
                                                        |
| 193 | +	if (isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries) { | 
                                                        |
| 194 | + $taxonomies = wp_list_pluck($wp_query->tax_query->queries, 'taxonomy');  | 
                                                        |
| 195 | +  | 
                                                        |
| 196 | +		if (isset($wp_query->query[$taxonomies[0]])) { | 
                                                        |
| 197 | +			$request_term = explode("/", $wp_query->query[$taxonomies[0]]); | 
                                                        |
| 198 | + $request_term = end($request_term);  | 
                                                        |
| 199 | +			if (!term_exists($request_term)) { | 
                                                        |
| 200 | +				$args = array('number' => '1',); | 
                                                        |
| 201 | + $terms_arr = get_terms($taxonomies[0], $args);  | 
                                                        |
| 202 | +				foreach ($terms_arr as $location_term) { | 
                                                        |
| 203 | + $term_arr = $location_term;  | 
                                                        |
| 204 | +					$term_arr->name = geodir_ucwords(str_replace('-', ' ', $request_term)); | 
                                                        |
| 205 | + }  | 
                                                        |
| 206 | + $wp_query->queried_object_id = 1;  | 
                                                        |
| 207 | + $wp_query->queried_object = $term_arr;  | 
                                                        |
| 208 | + }  | 
                                                        |
| 209 | + }  | 
                                                        |
| 210 | 210 | |
| 211 | - }  | 
                                                        |
| 212 | -    if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) { | 
                                                        |
| 211 | + }  | 
                                                        |
| 212 | +	if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) { | 
                                                        |
| 213 | 213 | |
| 214 | - $table = $plugin_prefix . $geodir_post_type . '_detail';  | 
                                                        |
| 214 | + $table = $plugin_prefix . $geodir_post_type . '_detail';  | 
                                                        |
| 215 | 215 | |
| 216 | -        add_filter('posts_fields', 'geodir_posts_fields', 1); | 
                                                        |
| 217 | -        add_filter('posts_join', 'geodir_posts_join', 1); | 
                                                        |
| 218 | - geodir_post_where();  | 
                                                        |
| 219 | -        if (!is_admin()) { | 
                                                        |
| 220 | -            add_filter('posts_orderby', 'geodir_posts_orderby', 1); | 
                                                        |
| 221 | - }  | 
                                                        |
| 216 | +		add_filter('posts_fields', 'geodir_posts_fields', 1); | 
                                                        |
| 217 | +		add_filter('posts_join', 'geodir_posts_join', 1); | 
                                                        |
| 218 | + geodir_post_where();  | 
                                                        |
| 219 | +		if (!is_admin()) { | 
                                                        |
| 220 | +			add_filter('posts_orderby', 'geodir_posts_orderby', 1); | 
                                                        |
| 221 | + }  | 
                                                        |
| 222 | 222 | |
| 223 | - // advanced filter for popular post view widget  | 
                                                        |
| 224 | - global $wp_query;  | 
                                                        |
| 225 | -        if (!is_admin()) { | 
                                                        |
| 226 | -            if (!empty($wp_query->query['with_pics_only'])) { | 
                                                        |
| 227 | -                add_filter('posts_join', 'geodir_filter_widget_join', 1000); | 
                                                        |
| 228 | - }  | 
                                                        |
| 229 | -            add_filter('posts_where', 'geodir_filter_widget_where', 1000); | 
                                                        |
| 230 | - }  | 
                                                        |
| 223 | + // advanced filter for popular post view widget  | 
                                                        |
| 224 | + global $wp_query;  | 
                                                        |
| 225 | +		if (!is_admin()) { | 
                                                        |
| 226 | +			if (!empty($wp_query->query['with_pics_only'])) { | 
                                                        |
| 227 | +				add_filter('posts_join', 'geodir_filter_widget_join', 1000); | 
                                                        |
| 228 | + }  | 
                                                        |
| 229 | +			add_filter('posts_where', 'geodir_filter_widget_where', 1000); | 
                                                        |
| 230 | + }  | 
                                                        |
| 231 | 231 | |
| 232 | - }  | 
                                                        |
| 232 | + }  | 
                                                        |
| 233 | 233 | |
| 234 | - return $query;  | 
                                                        |
| 234 | + return $query;  | 
                                                        |
| 235 | 235 | }  | 
                                                        
| 236 | 236 | |
| 237 | 237 | /**  | 
                                                        
@@ -245,40 +245,40 @@ discard block  | 
                                                    ||
| 245 | 245 | */  | 
                                                        
| 246 | 246 | function gdsc_manage_category_choice($post_type, $category)  | 
                                                        
| 247 | 247 |  { | 
                                                        
| 248 | -    if (0 == $category || '' == $category) { | 
                                                        |
| 249 | - return '';  | 
                                                        |
| 250 | - }  | 
                                                        |
| 248 | +	if (0 == $category || '' == $category) { | 
                                                        |
| 249 | + return '';  | 
                                                        |
| 250 | + }  | 
                                                        |
| 251 | 251 | |
| 252 | -    if (!(gdsc_is_post_type_valid($post_type))) { | 
                                                        |
| 253 | - return '';  | 
                                                        |
| 254 | - }  | 
                                                        |
| 252 | +	if (!(gdsc_is_post_type_valid($post_type))) { | 
                                                        |
| 253 | + return '';  | 
                                                        |
| 254 | + }  | 
                                                        |
| 255 | 255 | |
| 256 | - $taxonomies = geodir_get_taxonomies($post_type);  | 
                                                        |
| 256 | + $taxonomies = geodir_get_taxonomies($post_type);  | 
                                                        |
| 257 | 257 | |
| 258 | -    $categories = get_terms(array('taxonomy' => $taxonomies[0])); | 
                                                        |
| 258 | +	$categories = get_terms(array('taxonomy' => $taxonomies[0])); | 
                                                        |
| 259 | 259 | |
| 260 | - $cat_id = 0;  | 
                                                        |
| 260 | + $cat_id = 0;  | 
                                                        |
| 261 | 261 | |
| 262 | -    foreach ($categories as $cat) { | 
                                                        |
| 263 | -        if (is_numeric($category)) { | 
                                                        |
| 264 | -            if (absint($category) == $cat->term_id) { | 
                                                        |
| 265 | - $cat_id = $cat->term_id;  | 
                                                        |
| 266 | - break;  | 
                                                        |
| 267 | - }  | 
                                                        |
| 268 | -        } else { | 
                                                        |
| 269 | -            if ($category == $cat->slug) { | 
                                                        |
| 270 | - $cat_id = $cat->term_id;  | 
                                                        |
| 271 | - break;  | 
                                                        |
| 272 | - }  | 
                                                        |
| 262 | +	foreach ($categories as $cat) { | 
                                                        |
| 263 | +		if (is_numeric($category)) { | 
                                                        |
| 264 | +			if (absint($category) == $cat->term_id) { | 
                                                        |
| 265 | + $cat_id = $cat->term_id;  | 
                                                        |
| 266 | + break;  | 
                                                        |
| 267 | + }  | 
                                                        |
| 268 | +		} else { | 
                                                        |
| 269 | +			if ($category == $cat->slug) { | 
                                                        |
| 270 | + $cat_id = $cat->term_id;  | 
                                                        |
| 271 | + break;  | 
                                                        |
| 272 | + }  | 
                                                        |
| 273 | 273 | |
| 274 | -            if ($category == $cat->name) { | 
                                                        |
| 275 | - $cat_id = $cat->term_id;  | 
                                                        |
| 276 | - break;  | 
                                                        |
| 277 | - }  | 
                                                        |
| 278 | - }  | 
                                                        |
| 279 | - }  | 
                                                        |
| 274 | +			if ($category == $cat->name) { | 
                                                        |
| 275 | + $cat_id = $cat->term_id;  | 
                                                        |
| 276 | + break;  | 
                                                        |
| 277 | + }  | 
                                                        |
| 278 | + }  | 
                                                        |
| 279 | + }  | 
                                                        |
| 280 | 280 | |
| 281 | - return $cat_id;  | 
                                                        |
| 281 | + return $cat_id;  | 
                                                        |
| 282 | 282 | }  | 
                                                        
| 283 | 283 | |
| 284 | 284 | // @todo: Extract this  | 
                                                        
@@ -288,11 +288,11 @@ discard block  | 
                                                    ||
| 288 | 288 | * Adds the script in the page footer for the home page google map.  | 
                                                        
| 289 | 289 | *  | 
                                                        
| 290 | 290 | * @since 1.0.0  | 
                                                        
| 291 | - * @return string Print the script in page footer.  | 
                                                        |
| 291 | + * @return string Print the script in page footer.  | 
                                                        |
| 292 | 292 | */  | 
                                                        
| 293 | 293 | function geodir_home_map_add_script()  | 
                                                        
| 294 | -    { | 
                                                        |
| 295 | - ?>  | 
                                                        |
| 294 | +	{ | 
                                                        |
| 295 | + ?>  | 
                                                        |
| 296 | 296 | <script type="text/javascript">  | 
                                                        
| 297 | 297 |              jQuery(document).ready(function () { | 
                                                        
| 298 | 298 | geoDirMapSlide();  | 
                                                        
@@ -365,7 +365,7 @@ discard block  | 
                                                    ||
| 365 | 365 | }  | 
                                                        
| 366 | 366 | </script>  | 
                                                        
| 367 | 367 | <?php  | 
                                                        
| 368 | - }  | 
                                                        |
| 368 | + }  | 
                                                        |
| 369 | 369 | }  | 
                                                        
| 370 | 370 | |
| 371 | 371 | /**  | 
                                                        
@@ -376,7 +376,7 @@ discard block  | 
                                                    ||
| 376 | 376 | */  | 
                                                        
| 377 | 377 | function geodir_popular_category_add_scripts()  | 
                                                        
| 378 | 378 |  { | 
                                                        
| 379 | - ?>  | 
                                                        |
| 379 | + ?>  | 
                                                        |
| 380 | 380 | <script type="text/javascript">  | 
                                                        
| 381 | 381 |          jQuery(function ($) { | 
                                                        
| 382 | 382 |              $('.geodir-showcat').click(function () { | 
                                                        
@@ -406,56 +406,56 @@ discard block  | 
                                                    ||
| 406 | 406 | */  | 
                                                        
| 407 | 407 | function gdsc_validate_layout_choice($layout_choice)  | 
                                                        
| 408 | 408 |  { | 
                                                        
| 409 | -    switch (geodir_strtolower($layout_choice)) { | 
                                                        |
| 410 | - case 'list';  | 
                                                        |
| 411 | - case 'one';  | 
                                                        |
| 412 | - case 'one_column';  | 
                                                        |
| 413 | - case 'onecolumn';  | 
                                                        |
| 414 | - case '1';  | 
                                                        |
| 415 | - $layout_choice = 'list';  | 
                                                        |
| 416 | - break;  | 
                                                        |
| 417 | - case 'gridview_onehalf';  | 
                                                        |
| 418 | - case 'two';  | 
                                                        |
| 419 | - case 'two_column';  | 
                                                        |
| 420 | - case 'two_columns';  | 
                                                        |
| 421 | - case 'twocolumn';  | 
                                                        |
| 422 | - case 'twocolumns';  | 
                                                        |
| 423 | - case '2';  | 
                                                        |
| 424 | - $layout_choice = 'gridview_onehalf';  | 
                                                        |
| 425 | - break;  | 
                                                        |
| 426 | - case 'gridview_onethird';  | 
                                                        |
| 427 | - case 'three';  | 
                                                        |
| 428 | - case 'three_column';  | 
                                                        |
| 429 | - case 'three_columns';  | 
                                                        |
| 430 | - case 'threecolumn';  | 
                                                        |
| 431 | - case 'threecolumns';  | 
                                                        |
| 432 | - case '3';  | 
                                                        |
| 433 | - $layout_choice = 'gridview_onethird';  | 
                                                        |
| 434 | - break;  | 
                                                        |
| 435 | - case 'gridview_onefourth';  | 
                                                        |
| 436 | - case 'four';  | 
                                                        |
| 437 | - case 'four_column';  | 
                                                        |
| 438 | - case 'four_columns';  | 
                                                        |
| 439 | - case 'fourcolumn';  | 
                                                        |
| 440 | - case 'fourcolumns';  | 
                                                        |
| 441 | - case '4';  | 
                                                        |
| 442 | - $layout_choice = 'gridview_onefourth';  | 
                                                        |
| 443 | - break;  | 
                                                        |
| 444 | - case 'gridview_onefifth';  | 
                                                        |
| 445 | - case 'five';  | 
                                                        |
| 446 | - case 'five_column';  | 
                                                        |
| 447 | - case 'five_columns';  | 
                                                        |
| 448 | - case 'fivecolumn';  | 
                                                        |
| 449 | - case 'fivecolumns';  | 
                                                        |
| 450 | - case '5';  | 
                                                        |
| 451 | - $layout_choice = 'gridview_onefifth';  | 
                                                        |
| 452 | - break;  | 
                                                        |
| 453 | - default:  | 
                                                        |
| 454 | - $layout_choice = 'gridview_onehalf';  | 
                                                        |
| 455 | - break;  | 
                                                        |
| 456 | - }  | 
                                                        |
| 409 | +	switch (geodir_strtolower($layout_choice)) { | 
                                                        |
| 410 | + case 'list';  | 
                                                        |
| 411 | + case 'one';  | 
                                                        |
| 412 | + case 'one_column';  | 
                                                        |
| 413 | + case 'onecolumn';  | 
                                                        |
| 414 | + case '1';  | 
                                                        |
| 415 | + $layout_choice = 'list';  | 
                                                        |
| 416 | + break;  | 
                                                        |
| 417 | + case 'gridview_onehalf';  | 
                                                        |
| 418 | + case 'two';  | 
                                                        |
| 419 | + case 'two_column';  | 
                                                        |
| 420 | + case 'two_columns';  | 
                                                        |
| 421 | + case 'twocolumn';  | 
                                                        |
| 422 | + case 'twocolumns';  | 
                                                        |
| 423 | + case '2';  | 
                                                        |
| 424 | + $layout_choice = 'gridview_onehalf';  | 
                                                        |
| 425 | + break;  | 
                                                        |
| 426 | + case 'gridview_onethird';  | 
                                                        |
| 427 | + case 'three';  | 
                                                        |
| 428 | + case 'three_column';  | 
                                                        |
| 429 | + case 'three_columns';  | 
                                                        |
| 430 | + case 'threecolumn';  | 
                                                        |
| 431 | + case 'threecolumns';  | 
                                                        |
| 432 | + case '3';  | 
                                                        |
| 433 | + $layout_choice = 'gridview_onethird';  | 
                                                        |
| 434 | + break;  | 
                                                        |
| 435 | + case 'gridview_onefourth';  | 
                                                        |
| 436 | + case 'four';  | 
                                                        |
| 437 | + case 'four_column';  | 
                                                        |
| 438 | + case 'four_columns';  | 
                                                        |
| 439 | + case 'fourcolumn';  | 
                                                        |
| 440 | + case 'fourcolumns';  | 
                                                        |
| 441 | + case '4';  | 
                                                        |
| 442 | + $layout_choice = 'gridview_onefourth';  | 
                                                        |
| 443 | + break;  | 
                                                        |
| 444 | + case 'gridview_onefifth';  | 
                                                        |
| 445 | + case 'five';  | 
                                                        |
| 446 | + case 'five_column';  | 
                                                        |
| 447 | + case 'five_columns';  | 
                                                        |
| 448 | + case 'fivecolumn';  | 
                                                        |
| 449 | + case 'fivecolumns';  | 
                                                        |
| 450 | + case '5';  | 
                                                        |
| 451 | + $layout_choice = 'gridview_onefifth';  | 
                                                        |
| 452 | + break;  | 
                                                        |
| 453 | + default:  | 
                                                        |
| 454 | + $layout_choice = 'gridview_onehalf';  | 
                                                        |
| 455 | + break;  | 
                                                        |
| 456 | + }  | 
                                                        |
| 457 | 457 | |
| 458 | - return $layout_choice;  | 
                                                        |
| 458 | + return $layout_choice;  | 
                                                        |
| 459 | 459 | }  | 
                                                        
| 460 | 460 | |
| 461 | 461 | /**  | 
                                                        
@@ -472,34 +472,34 @@ discard block  | 
                                                    ||
| 472 | 472 | */  | 
                                                        
| 473 | 473 | function gdsc_validate_sort_choice($sort_choice, $post_type = '')  | 
                                                        
| 474 | 474 |  { | 
                                                        
| 475 | - global $plugin_prefix;  | 
                                                        |
| 476 | -  | 
                                                        |
| 477 | - $sorts = array(  | 
                                                        |
| 478 | - 'az',  | 
                                                        |
| 479 | - 'latest',  | 
                                                        |
| 480 | - 'featured',  | 
                                                        |
| 481 | - 'high_review',  | 
                                                        |
| 482 | - 'high_rating',  | 
                                                        |
| 483 | - 'random',  | 
                                                        |
| 484 | - );  | 
                                                        |
| 485 | -  | 
                                                        |
| 486 | -    if (in_array($sort_choice, $sorts)) { | 
                                                        |
| 487 | - return $sort_choice;  | 
                                                        |
| 488 | - }  | 
                                                        |
| 475 | + global $plugin_prefix;  | 
                                                        |
| 476 | +  | 
                                                        |
| 477 | + $sorts = array(  | 
                                                        |
| 478 | + 'az',  | 
                                                        |
| 479 | + 'latest',  | 
                                                        |
| 480 | + 'featured',  | 
                                                        |
| 481 | + 'high_review',  | 
                                                        |
| 482 | + 'high_rating',  | 
                                                        |
| 483 | + 'random',  | 
                                                        |
| 484 | + );  | 
                                                        |
| 485 | +  | 
                                                        |
| 486 | +	if (in_array($sort_choice, $sorts)) { | 
                                                        |
| 487 | + return $sort_choice;  | 
                                                        |
| 488 | + }  | 
                                                        |
| 489 | 489 | |
| 490 | -    if (!empty($post_type)) { | 
                                                        |
| 491 | - $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 490 | +	if (!empty($post_type)) { | 
                                                        |
| 491 | + $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 492 | 492 | |
| 493 | -        if (!geodir_prepare_custom_sorting($sort_choice, $table)) { | 
                                                        |
| 494 | - $sort_choice = '';  | 
                                                        |
| 495 | - }  | 
                                                        |
| 496 | - }  | 
                                                        |
| 493 | +		if (!geodir_prepare_custom_sorting($sort_choice, $table)) { | 
                                                        |
| 494 | + $sort_choice = '';  | 
                                                        |
| 495 | + }  | 
                                                        |
| 496 | + }  | 
                                                        |
| 497 | 497 | |
| 498 | -    if (empty($post_type) || empty($sort_choice)) { | 
                                                        |
| 499 | - $sort_choice = 'latest';  | 
                                                        |
| 500 | - }  | 
                                                        |
| 498 | +	if (empty($post_type) || empty($sort_choice)) { | 
                                                        |
| 499 | + $sort_choice = 'latest';  | 
                                                        |
| 500 | + }  | 
                                                        |
| 501 | 501 | |
| 502 | - return $sort_choice;  | 
                                                        |
| 502 | + return $sort_choice;  | 
                                                        |
| 503 | 503 | }  | 
                                                        
| 504 | 504 | |
| 505 | 505 | /**  | 
                                                        
@@ -512,22 +512,22 @@ discard block  | 
                                                    ||
| 512 | 512 | */  | 
                                                        
| 513 | 513 | function gdsc_validate_listing_width($width_choice)  | 
                                                        
| 514 | 514 |  { | 
                                                        
| 515 | -    if (!(empty($width_choice))) { | 
                                                        |
| 516 | - $width_choice = absint($width_choice);  | 
                                                        |
| 517 | -    } else { | 
                                                        |
| 518 | - return '';  | 
                                                        |
| 519 | - }  | 
                                                        |
| 515 | +	if (!(empty($width_choice))) { | 
                                                        |
| 516 | + $width_choice = absint($width_choice);  | 
                                                        |
| 517 | +	} else { | 
                                                        |
| 518 | + return '';  | 
                                                        |
| 519 | + }  | 
                                                        |
| 520 | 520 | |
| 521 | -    if (100 < $width_choice) { | 
                                                        |
| 522 | - $width_choice = 100;  | 
                                                        |
| 523 | - }  | 
                                                        |
| 521 | +	if (100 < $width_choice) { | 
                                                        |
| 522 | + $width_choice = 100;  | 
                                                        |
| 523 | + }  | 
                                                        |
| 524 | 524 | |
| 525 | - // If listing_width is too narrow, it won't work, arbitrarily set to 10% here  | 
                                                        |
| 526 | -    if (10 > $width_choice) { | 
                                                        |
| 527 | - $width_choice = 10;  | 
                                                        |
| 528 | - }  | 
                                                        |
| 525 | + // If listing_width is too narrow, it won't work, arbitrarily set to 10% here  | 
                                                        |
| 526 | +	if (10 > $width_choice) { | 
                                                        |
| 527 | + $width_choice = 10;  | 
                                                        |
| 528 | + }  | 
                                                        |
| 529 | 529 | |
| 530 | - return $width_choice;  | 
                                                        |
| 530 | + return $width_choice;  | 
                                                        |
| 531 | 531 | }  | 
                                                        
| 532 | 532 | |
| 533 | 533 | /**  | 
                                                        
@@ -540,18 +540,18 @@ discard block  | 
                                                    ||
| 540 | 540 | */  | 
                                                        
| 541 | 541 | function gdsc_validate_list_filter_choice($filter_choice)  | 
                                                        
| 542 | 542 |  { | 
                                                        
| 543 | - $filters = array(  | 
                                                        |
| 544 | - 'all',  | 
                                                        |
| 545 | - 'today',  | 
                                                        |
| 546 | - 'upcoming',  | 
                                                        |
| 547 | - 'past',  | 
                                                        |
| 548 | - );  | 
                                                        |
| 549 | -  | 
                                                        |
| 550 | -    if (!(in_array($filter_choice, $filters))) { | 
                                                        |
| 551 | - $filter_choice = 'all';  | 
                                                        |
| 552 | - }  | 
                                                        |
| 543 | + $filters = array(  | 
                                                        |
| 544 | + 'all',  | 
                                                        |
| 545 | + 'today',  | 
                                                        |
| 546 | + 'upcoming',  | 
                                                        |
| 547 | + 'past',  | 
                                                        |
| 548 | + );  | 
                                                        |
| 549 | +  | 
                                                        |
| 550 | +	if (!(in_array($filter_choice, $filters))) { | 
                                                        |
| 551 | + $filter_choice = 'all';  | 
                                                        |
| 552 | + }  | 
                                                        |
| 553 | 553 | |
| 554 | - return $filter_choice;  | 
                                                        |
| 554 | + return $filter_choice;  | 
                                                        |
| 555 | 555 | }  | 
                                                        
| 556 | 556 | |
| 557 | 557 | /**  | 
                                                        
@@ -574,7 +574,7 @@ discard block  | 
                                                    ||
| 574 | 574 | * @return string Listings HTML content.  | 
                                                        
| 575 | 575 | */  | 
                                                        
| 576 | 576 |  function geodir_sc_gd_listings_output($args = array()) { | 
                                                        
| 577 | - $title = !empty($args['title']) ? __($args['title'], 'geodirectory') : '';  | 
                                                        |
| 577 | + $title = !empty($args['title']) ? __($args['title'], 'geodirectory') : '';  | 
                                                        |
| 578 | 578 | $post_type = !empty($args['post_type']) ? $args['post_type'] : 'gd_place';  | 
                                                        
| 579 | 579 | $category = !empty($args['category']) ? $args['category'] : '0';  | 
                                                        
| 580 | 580 | $post_number = !empty($args['post_number']) ? $args['post_number'] : 10;  | 
                                                        
@@ -585,17 +585,17 @@ discard block  | 
                                                    ||
| 585 | 585 | $listing_width = !empty($args['listing_width']) ? $args['listing_width'] : '';  | 
                                                        
| 586 | 586 | $with_pagination = !empty($args['with_pagination']) ? true : false;  | 
                                                        
| 587 | 587 | $event_type = !empty($args['event_type']) ? $args['event_type'] : '';  | 
                                                        
| 588 | - $shortcode_content = !empty($args['shortcode_content']) ? trim($args['shortcode_content']) : '';  | 
                                                        |
| 589 | - $tags = !empty($args['tags']) ? $args['tags'] : array();  | 
                                                        |
| 590 | - /**  | 
                                                        |
| 591 | - * Filter the content text displayed when no listings found.  | 
                                                        |
| 592 | - *  | 
                                                        |
| 593 | - * @since 1.6.0  | 
                                                        |
| 594 | - *  | 
                                                        |
| 595 | - * @param string $shortcode_content The shortcode content text.  | 
                                                        |
| 596 | - * @param array $args Array of arguements to filter listings.  | 
                                                        |
| 597 | - */  | 
                                                        |
| 598 | -    $shortcode_content = apply_filters('geodir_sc_gd_listings_not_found_content', $shortcode_content, $args); | 
                                                        |
| 588 | + $shortcode_content = !empty($args['shortcode_content']) ? trim($args['shortcode_content']) : '';  | 
                                                        |
| 589 | + $tags = !empty($args['tags']) ? $args['tags'] : array();  | 
                                                        |
| 590 | + /**  | 
                                                        |
| 591 | + * Filter the content text displayed when no listings found.  | 
                                                        |
| 592 | + *  | 
                                                        |
| 593 | + * @since 1.6.0  | 
                                                        |
| 594 | + *  | 
                                                        |
| 595 | + * @param string $shortcode_content The shortcode content text.  | 
                                                        |
| 596 | + * @param array $args Array of arguements to filter listings.  | 
                                                        |
| 597 | + */  | 
                                                        |
| 598 | +	$shortcode_content = apply_filters('geodir_sc_gd_listings_not_found_content', $shortcode_content, $args); | 
                                                        |
| 599 | 599 | |
| 600 | 600 | $top_pagination = $with_pagination && !empty($args['top_pagination']) ? true : false;  | 
                                                        
| 601 | 601 | $bottom_pagination = $with_pagination && !empty($args['bottom_pagination']) ? true : false;  | 
                                                        
@@ -607,92 +607,92 @@ discard block  | 
                                                    ||
| 607 | 607 | $pageno = $geodir_ajax && !empty($args['pageno']) ? $args['pageno'] : 1;  | 
                                                        
| 608 | 608 | |
| 609 | 609 | $query_args = array(  | 
                                                        
| 610 | - 'posts_per_page' => $post_number,  | 
                                                        |
| 611 | - 'is_geodir_loop' => true,  | 
                                                        |
| 612 | - 'gd_location' => $add_location_filter,  | 
                                                        |
| 613 | - 'post_type' => $post_type,  | 
                                                        |
| 614 | - 'order_by' => $list_sort,  | 
                                                        |
| 610 | + 'posts_per_page' => $post_number,  | 
                                                        |
| 611 | + 'is_geodir_loop' => true,  | 
                                                        |
| 612 | + 'gd_location' => $add_location_filter,  | 
                                                        |
| 613 | + 'post_type' => $post_type,  | 
                                                        |
| 614 | + 'order_by' => $list_sort,  | 
                                                        |
| 615 | 615 | 'pageno' => $pageno  | 
                                                        
| 616 | - );  | 
                                                        |
| 616 | + );  | 
                                                        |
| 617 | 617 | |
| 618 | -    if ($character_count >= 0) { | 
                                                        |
| 619 | - $query_args['excerpt_length'] = $character_count;  | 
                                                        |
| 620 | - }  | 
                                                        |
| 618 | +	if ($character_count >= 0) { | 
                                                        |
| 619 | + $query_args['excerpt_length'] = $character_count;  | 
                                                        |
| 620 | + }  | 
                                                        |
| 621 | 621 | |
| 622 | -    if (!empty($args['post_author'])) { | 
                                                        |
| 623 | - $query_args['post_author'] = $args['post_author'];  | 
                                                        |
| 624 | - }  | 
                                                        |
| 622 | +	if (!empty($args['post_author'])) { | 
                                                        |
| 623 | + $query_args['post_author'] = $args['post_author'];  | 
                                                        |
| 624 | + }  | 
                                                        |
| 625 | 625 | |
| 626 | -    if (!empty($args['show_featured_only'])) { | 
                                                        |
| 627 | - $query_args['show_featured_only'] = 1;  | 
                                                        |
| 628 | - }  | 
                                                        |
| 626 | +	if (!empty($args['show_featured_only'])) { | 
                                                        |
| 627 | + $query_args['show_featured_only'] = 1;  | 
                                                        |
| 628 | + }  | 
                                                        |
| 629 | 629 | |
| 630 | -    if (!empty($args['show_special_only'])) { | 
                                                        |
| 631 | - $query_args['show_special_only'] = 1;  | 
                                                        |
| 632 | - }  | 
                                                        |
| 630 | +	if (!empty($args['show_special_only'])) { | 
                                                        |
| 631 | + $query_args['show_special_only'] = 1;  | 
                                                        |
| 632 | + }  | 
                                                        |
| 633 | 633 | |
| 634 | -    if (!empty($args['with_pics_only'])) { | 
                                                        |
| 635 | - $query_args['with_pics_only'] = 0;  | 
                                                        |
| 636 | - $query_args['featured_image_only'] = 1;  | 
                                                        |
| 637 | - }  | 
                                                        |
| 634 | +	if (!empty($args['with_pics_only'])) { | 
                                                        |
| 635 | + $query_args['with_pics_only'] = 0;  | 
                                                        |
| 636 | + $query_args['featured_image_only'] = 1;  | 
                                                        |
| 637 | + }  | 
                                                        |
| 638 | 638 | |
| 639 | -    if (!empty($args['with_videos_only'])) { | 
                                                        |
| 640 | - $query_args['with_videos_only'] = 1;  | 
                                                        |
| 641 | - }  | 
                                                        |
| 639 | +	if (!empty($args['with_videos_only'])) { | 
                                                        |
| 640 | + $query_args['with_videos_only'] = 1;  | 
                                                        |
| 641 | + }  | 
                                                        |
| 642 | 642 | |
| 643 | -    if (!empty($args['show_favorites_only'])) { | 
                                                        |
| 644 | - $query_args['show_favorites_only'] = 1;  | 
                                                        |
| 645 | - $query_args['favorites_by_user'] = !empty($args['favorites_by_user']) ? $args['favorites_by_user'] : 0;  | 
                                                        |
| 646 | - }  | 
                                                        |
| 647 | - $with_no_results = !empty($args['without_no_results']) ? false : true;  | 
                                                        |
| 643 | +	if (!empty($args['show_favorites_only'])) { | 
                                                        |
| 644 | + $query_args['show_favorites_only'] = 1;  | 
                                                        |
| 645 | + $query_args['favorites_by_user'] = !empty($args['favorites_by_user']) ? $args['favorites_by_user'] : 0;  | 
                                                        |
| 646 | + }  | 
                                                        |
| 647 | + $with_no_results = !empty($args['without_no_results']) ? false : true;  | 
                                                        |
| 648 | 648 | |
| 649 | -    if (!empty($category) && isset($category[0]) && $category[0] != '0') { | 
                                                        |
| 650 | - $category_taxonomy = geodir_get_taxonomies($post_type);  | 
                                                        |
| 649 | +	if (!empty($category) && isset($category[0]) && $category[0] != '0') { | 
                                                        |
| 650 | + $category_taxonomy = geodir_get_taxonomies($post_type);  | 
                                                        |
| 651 | 651 | |
| 652 | - ######### WPML #########  | 
                                                        |
| 653 | -        if (geodir_wpml_is_taxonomy_translated($category_taxonomy[0])) { | 
                                                        |
| 654 | - $category = gd_lang_object_ids($category, $category_taxonomy[0]);  | 
                                                        |
| 655 | - }  | 
                                                        |
| 656 | - ######### WPML #########  | 
                                                        |
| 652 | + ######### WPML #########  | 
                                                        |
| 653 | +		if (geodir_wpml_is_taxonomy_translated($category_taxonomy[0])) { | 
                                                        |
| 654 | + $category = gd_lang_object_ids($category, $category_taxonomy[0]);  | 
                                                        |
| 655 | + }  | 
                                                        |
| 656 | + ######### WPML #########  | 
                                                        |
| 657 | 657 | |
| 658 | - $tax_query = array(  | 
                                                        |
| 659 | - 'taxonomy' => $category_taxonomy[0],  | 
                                                        |
| 660 | - 'field' => 'id',  | 
                                                        |
| 661 | - 'terms' => $category  | 
                                                        |
| 662 | - );  | 
                                                        |
| 658 | + $tax_query = array(  | 
                                                        |
| 659 | + 'taxonomy' => $category_taxonomy[0],  | 
                                                        |
| 660 | + 'field' => 'id',  | 
                                                        |
| 661 | + 'terms' => $category  | 
                                                        |
| 662 | + );  | 
                                                        |
| 663 | 663 | |
| 664 | - $query_args['tax_query'] = array($tax_query);  | 
                                                        |
| 665 | - }  | 
                                                        |
| 664 | + $query_args['tax_query'] = array($tax_query);  | 
                                                        |
| 665 | + }  | 
                                                        |
| 666 | 666 | |
| 667 | -    if (!empty($tags)) { | 
                                                        |
| 668 | - // Clean tags  | 
                                                        |
| 669 | -        if (!is_array($tags)) { | 
                                                        |
| 670 | -            $comma = _x(',', 'tag delimiter'); | 
                                                        |
| 671 | -            if ( ',' !== $comma ) { | 
                                                        |
| 672 | - $tags = str_replace($comma, ',', $tags);  | 
                                                        |
| 673 | - }  | 
                                                        |
| 674 | -            $tags = explode(',', trim($tags, " \n\t\r\0\x0B,")); | 
                                                        |
| 675 | -            $tags = array_map('trim', $tags); | 
                                                        |
| 676 | - }  | 
                                                        |
| 667 | +	if (!empty($tags)) { | 
                                                        |
| 668 | + // Clean tags  | 
                                                        |
| 669 | +		if (!is_array($tags)) { | 
                                                        |
| 670 | +			$comma = _x(',', 'tag delimiter'); | 
                                                        |
| 671 | +			if ( ',' !== $comma ) { | 
                                                        |
| 672 | + $tags = str_replace($comma, ',', $tags);  | 
                                                        |
| 673 | + }  | 
                                                        |
| 674 | +			$tags = explode(',', trim($tags, " \n\t\r\0\x0B,")); | 
                                                        |
| 675 | +			$tags = array_map('trim', $tags); | 
                                                        |
| 676 | + }  | 
                                                        |
| 677 | 677 | |
| 678 | -        if (!empty($tags)) { | 
                                                        |
| 679 | - $tag_query = array(  | 
                                                        |
| 680 | - 'taxonomy' => $post_type . '_tags',  | 
                                                        |
| 681 | - 'field' => 'name',  | 
                                                        |
| 682 | - 'terms' => $tags  | 
                                                        |
| 683 | - );  | 
                                                        |
| 684 | -  | 
                                                        |
| 685 | -            if (!empty($query_args['tax_query'])) { | 
                                                        |
| 686 | - $query_args['tax_query'][] = $tag_query;  | 
                                                        |
| 687 | -            } else { | 
                                                        |
| 688 | - $query_args['tax_query'] = array($tag_query);  | 
                                                        |
| 689 | - }  | 
                                                        |
| 690 | - }  | 
                                                        |
| 691 | - }  | 
                                                        |
| 678 | +		if (!empty($tags)) { | 
                                                        |
| 679 | + $tag_query = array(  | 
                                                        |
| 680 | + 'taxonomy' => $post_type . '_tags',  | 
                                                        |
| 681 | + 'field' => 'name',  | 
                                                        |
| 682 | + 'terms' => $tags  | 
                                                        |
| 683 | + );  | 
                                                        |
| 684 | +  | 
                                                        |
| 685 | +			if (!empty($query_args['tax_query'])) { | 
                                                        |
| 686 | + $query_args['tax_query'][] = $tag_query;  | 
                                                        |
| 687 | +			} else { | 
                                                        |
| 688 | + $query_args['tax_query'] = array($tag_query);  | 
                                                        |
| 689 | + }  | 
                                                        |
| 690 | + }  | 
                                                        |
| 691 | + }  | 
                                                        |
| 692 | 692 | |
| 693 | - global $gridview_columns_widget, $geodir_is_widget_listing;  | 
                                                        |
| 693 | + global $gridview_columns_widget, $geodir_is_widget_listing;  | 
                                                        |
| 694 | 694 | |
| 695 | -    if ($post_type == 'gd_event' && function_exists('geodir_event_get_widget_events')) { | 
                                                        |
| 695 | +	if ($post_type == 'gd_event' && function_exists('geodir_event_get_widget_events')) { | 
                                                        |
| 696 | 696 | global $geodir_event_widget_listview;  | 
                                                        
| 697 | 697 | $geodir_event_widget_listview = true;  | 
                                                        
| 698 | 698 | |
@@ -707,16 +707,16 @@ discard block  | 
                                                    ||
| 707 | 707 | $widget_listings = $total_posts > 0 ? geodir_get_widget_listings($query_args) : array();  | 
                                                        
| 708 | 708 | }  | 
                                                        
| 709 | 709 | $current_gridview_columns_widget = $gridview_columns_widget;  | 
                                                        
| 710 | - $identifier = ' gd-wgt-pagi-' . mt_rand();  | 
                                                        |
| 711 | - ob_start();  | 
                                                        |
| 710 | + $identifier = ' gd-wgt-pagi-' . mt_rand();  | 
                                                        |
| 711 | + ob_start();  | 
                                                        |
| 712 | 712 |  	if (!empty($widget_listings) || $with_no_results) { | 
                                                        
| 713 | 713 |  		if (!$geodir_ajax) { | 
                                                        
| 714 | - /**  | 
                                                        |
| 715 | - * Called before the shortcode [gd_listings] content is output.  | 
                                                        |
| 716 | - *  | 
                                                        |
| 717 | - * @since 1.0.0  | 
                                                        |
| 718 | - */  | 
                                                        |
| 719 | -        do_action('geodir_before_sc_gd_listings'); | 
                                                        |
| 714 | + /**  | 
                                                        |
| 715 | + * Called before the shortcode [gd_listings] content is output.  | 
                                                        |
| 716 | + *  | 
                                                        |
| 717 | + * @since 1.0.0  | 
                                                        |
| 718 | + */  | 
                                                        |
| 719 | +		do_action('geodir_before_sc_gd_listings'); | 
                                                        |
| 720 | 720 | ?>  | 
                                                        
| 721 | 721 | <div class="geodir_locations geodir_location_listing geodir-sc-gd-listings <?php echo $identifier;?>">  | 
                                                        
| 722 | 722 |              <?php if ($title != '') { ?> | 
                                                        
@@ -727,63 +727,63 @@ discard block  | 
                                                    ||
| 727 | 727 | <div class="gd-sc-loader">  | 
                                                        
| 728 | 728 | <div class="gd-sc-content">  | 
                                                        
| 729 | 729 | <?php }  | 
                                                        
| 730 | -            if (!(empty($widget_listings) && !empty($shortcode_content))) { | 
                                                        |
| 731 | -                if (strstr($layout, 'gridview')) { | 
                                                        |
| 732 | -                    $listing_view_exp = explode('_', $layout); | 
                                                        |
| 733 | - $gridview_columns_widget = $layout;  | 
                                                        |
| 734 | - $layout = $listing_view_exp[0];  | 
                                                        |
| 735 | -                } else { | 
                                                        |
| 736 | - $gridview_columns_widget = '';  | 
                                                        |
| 737 | - }  | 
                                                        |
| 738 | -  | 
                                                        |
| 739 | - /**  | 
                                                        |
| 740 | - * Filter the widget listing listview template.  | 
                                                        |
| 741 | - *  | 
                                                        |
| 742 | - * @since 1.0.0  | 
                                                        |
| 743 | - *  | 
                                                        |
| 744 | - * @param string The template file to display listing.  | 
                                                        |
| 745 | - */  | 
                                                        |
| 746 | -                $template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview')); | 
                                                        |
| 730 | +			if (!(empty($widget_listings) && !empty($shortcode_content))) { | 
                                                        |
| 731 | +				if (strstr($layout, 'gridview')) { | 
                                                        |
| 732 | +					$listing_view_exp = explode('_', $layout); | 
                                                        |
| 733 | + $gridview_columns_widget = $layout;  | 
                                                        |
| 734 | + $layout = $listing_view_exp[0];  | 
                                                        |
| 735 | +				} else { | 
                                                        |
| 736 | + $gridview_columns_widget = '';  | 
                                                        |
| 737 | + }  | 
                                                        |
| 738 | +  | 
                                                        |
| 739 | + /**  | 
                                                        |
| 740 | + * Filter the widget listing listview template.  | 
                                                        |
| 741 | + *  | 
                                                        |
| 742 | + * @since 1.0.0  | 
                                                        |
| 743 | + *  | 
                                                        |
| 744 | + * @param string The template file to display listing.  | 
                                                        |
| 745 | + */  | 
                                                        |
| 746 | +				$template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview')); | 
                                                        |
| 747 | 747 | |
| 748 | - global $post, $map_jason, $map_canvas_arr, $gd_session;  | 
                                                        |
| 749 | -  | 
                                                        |
| 750 | - $current_post = $post;  | 
                                                        |
| 751 | - $current_map_jason = $map_jason;  | 
                                                        |
| 752 | - $current_map_canvas_arr = $map_canvas_arr;  | 
                                                        |
| 753 | - $geodir_is_widget_listing = true;  | 
                                                        |
| 754 | -                $gd_session->un_set('gd_listing_view'); | 
                                                        |
| 755 | -  | 
                                                        |
| 756 | -                if ($with_pagination && $top_pagination) {				 | 
                                                        |
| 757 | - echo geodir_sc_listings_pagination($total_posts, $post_number, $pageno);  | 
                                                        |
| 758 | - }  | 
                                                        |
| 759 | -  | 
                                                        |
| 760 | - /**  | 
                                                        |
| 761 | - * Includes listing listview template.  | 
                                                        |
| 762 | - *  | 
                                                        |
| 763 | - * @since 1.0.0  | 
                                                        |
| 764 | - */  | 
                                                        |
| 765 | - include($template);  | 
                                                        |
| 748 | + global $post, $map_jason, $map_canvas_arr, $gd_session;  | 
                                                        |
| 749 | +  | 
                                                        |
| 750 | + $current_post = $post;  | 
                                                        |
| 751 | + $current_map_jason = $map_jason;  | 
                                                        |
| 752 | + $current_map_canvas_arr = $map_canvas_arr;  | 
                                                        |
| 753 | + $geodir_is_widget_listing = true;  | 
                                                        |
| 754 | +				$gd_session->un_set('gd_listing_view'); | 
                                                        |
| 755 | +  | 
                                                        |
| 756 | +				if ($with_pagination && $top_pagination) {				 | 
                                                        |
| 757 | + echo geodir_sc_listings_pagination($total_posts, $post_number, $pageno);  | 
                                                        |
| 758 | + }  | 
                                                        |
| 759 | +  | 
                                                        |
| 760 | + /**  | 
                                                        |
| 761 | + * Includes listing listview template.  | 
                                                        |
| 762 | + *  | 
                                                        |
| 763 | + * @since 1.0.0  | 
                                                        |
| 764 | + */  | 
                                                        |
| 765 | + include($template);  | 
                                                        |
| 766 | 766 | |
| 767 | -                if ($with_pagination && $bottom_pagination) {				 | 
                                                        |
| 768 | - echo geodir_sc_listings_pagination($total_posts, $post_number, $pageno);  | 
                                                        |
| 769 | - }  | 
                                                        |
| 770 | -  | 
                                                        |
| 771 | - $geodir_is_widget_listing = false;  | 
                                                        |
| 772 | -  | 
                                                        |
| 773 | - $GLOBALS['post'] = $current_post;  | 
                                                        |
| 774 | -                if (!empty($current_post)) { | 
                                                        |
| 775 | - setup_postdata($current_post);  | 
                                                        |
| 776 | - }  | 
                                                        |
| 777 | - $map_jason = $current_map_jason;  | 
                                                        |
| 778 | - $map_canvas_arr = $current_map_canvas_arr;  | 
                                                        |
| 779 | - global $gridview_columns_widget;  | 
                                                        |
| 780 | - $gridview_columns_widget = $current_gridview_columns_widget;  | 
                                                        |
| 781 | -            } else { | 
                                                        |
| 782 | - echo $shortcode_content;  | 
                                                        |
| 783 | - }  | 
                                                        |
| 767 | +				if ($with_pagination && $bottom_pagination) {				 | 
                                                        |
| 768 | + echo geodir_sc_listings_pagination($total_posts, $post_number, $pageno);  | 
                                                        |
| 769 | + }  | 
                                                        |
| 770 | +  | 
                                                        |
| 771 | + $geodir_is_widget_listing = false;  | 
                                                        |
| 772 | +  | 
                                                        |
| 773 | + $GLOBALS['post'] = $current_post;  | 
                                                        |
| 774 | +				if (!empty($current_post)) { | 
                                                        |
| 775 | + setup_postdata($current_post);  | 
                                                        |
| 776 | + }  | 
                                                        |
| 777 | + $map_jason = $current_map_jason;  | 
                                                        |
| 778 | + $map_canvas_arr = $current_map_canvas_arr;  | 
                                                        |
| 779 | + global $gridview_columns_widget;  | 
                                                        |
| 780 | + $gridview_columns_widget = $current_gridview_columns_widget;  | 
                                                        |
| 781 | +			} else { | 
                                                        |
| 782 | + echo $shortcode_content;  | 
                                                        |
| 783 | + }  | 
                                                        |
| 784 | 784 | ?>  | 
                                                        
| 785 | 785 | <?php  | 
                                                        
| 786 | -            if (!$geodir_ajax) {  | 
                                                        |
| 786 | +			if (!$geodir_ajax) {  | 
                                                        |
| 787 | 787 | ?>  | 
                                                        
| 788 | 788 | </div><p class="geodir-sclisting-loading" style="display:none;"><i class="fa fa-cog fa-spin"></i></p></div>  | 
                                                        
| 789 | 789 | <script type="text/javascript">  | 
                                                        
@@ -821,10 +821,10 @@ discard block  | 
                                                    ||
| 821 | 821 | loading.hide();  | 
                                                        
| 822 | 822 | jQuery(items).html(response);  | 
                                                        
| 823 | 823 | <?php  | 
                                                        
| 824 | - /**  | 
                                                        |
| 825 | - * if lazyload images enabled then refresh them once ajax page changed.  | 
                                                        |
| 826 | - */  | 
                                                        |
| 827 | -              if (get_option('geodir_lazy_load', 1)) { ?> | 
                                                        |
| 824 | + /**  | 
                                                        |
| 825 | + * if lazyload images enabled then refresh them once ajax page changed.  | 
                                                        |
| 826 | + */  | 
                                                        |
| 827 | +			  if (get_option('geodir_lazy_load', 1)) { ?> | 
                                                        |
| 828 | 828 | geodir_init_lazy_load();  | 
                                                        
| 829 | 829 | <?php } ?>  | 
                                                        
| 830 | 830 | }  | 
                                                        
@@ -834,11 +834,11 @@ discard block  | 
                                                    ||
| 834 | 834 | </div>  | 
                                                        
| 835 | 835 | <?php } ?>  | 
                                                        
| 836 | 836 | <?php  | 
                                                        
| 837 | - }  | 
                                                        |
| 837 | + }  | 
                                                        |
| 838 | 838 | $output = ob_get_contents();  | 
                                                        
| 839 | - ob_end_clean();  | 
                                                        |
| 839 | + ob_end_clean();  | 
                                                        |
| 840 | 840 | |
| 841 | - return trim($output);  | 
                                                        |
| 841 | + return trim($output);  | 
                                                        |
| 842 | 842 | }  | 
                                                        
| 843 | 843 | |
| 844 | 844 | /**  | 
                                                        
@@ -865,15 +865,15 @@ discard block  | 
                                                    ||
| 865 | 865 | * @return string Listings pagination HTML content.  | 
                                                        
| 866 | 866 | */  | 
                                                        
| 867 | 867 |  function geodir_sc_listings_pagination($total_posts, $posts_per_page, $pageno, $before = '', $after = '', $prelabel = '', $nxtlabel = '', $pages_to_show = 5, $always_show = false) { | 
                                                        
| 868 | -    if (empty($prelabel)) { | 
                                                        |
| 869 | - $prelabel = '<strong>«</strong>';  | 
                                                        |
| 870 | - }  | 
                                                        |
| 868 | +	if (empty($prelabel)) { | 
                                                        |
| 869 | + $prelabel = '<strong>«</strong>';  | 
                                                        |
| 870 | + }  | 
                                                        |
| 871 | 871 | |
| 872 | -    if (empty($nxtlabel)) { | 
                                                        |
| 873 | - $nxtlabel = '<strong>»</strong>';  | 
                                                        |
| 874 | - }  | 
                                                        |
| 872 | +	if (empty($nxtlabel)) { | 
                                                        |
| 873 | + $nxtlabel = '<strong>»</strong>';  | 
                                                        |
| 874 | + }  | 
                                                        |
| 875 | 875 | |
| 876 | - $half_pages_to_show = round($pages_to_show / 2);  | 
                                                        |
| 876 | + $half_pages_to_show = round($pages_to_show / 2);  | 
                                                        |
| 877 | 877 | |
| 878 | 878 | $numposts = $total_posts;  | 
                                                        
| 879 | 879 | |
@@ -906,7 +906,7 @@ discard block  | 
                                                    ||
| 906 | 906 | }  | 
                                                        
| 907 | 907 | |
| 908 | 908 |  		if (($pageno - 1) > 0) { | 
                                                        
| 909 | - echo '<a class="gd-page-sc-prev gd-wgt-page" data-page="' . (int)($pageno - 1) . '" href="javascript:void(0);">' . $prelabel . '</a> ';  | 
                                                        |
| 909 | + echo '<a class="gd-page-sc-prev gd-wgt-page" data-page="' . (int)($pageno - 1) . '" href="javascript:void(0);">' . $prelabel . '</a> ';  | 
                                                        |
| 910 | 910 | }  | 
                                                        
| 911 | 911 | |
| 912 | 912 |  		for ($i = $pageno - $half_pages_to_show; $i <= $pageno + $half_pages_to_show; $i++) { | 
                                                        
@@ -929,9 +929,9 @@ discard block  | 
                                                    ||
| 929 | 929 | echo "</div> $after </div>";  | 
                                                        
| 930 | 930 | }  | 
                                                        
| 931 | 931 | $output = ob_get_contents();  | 
                                                        
| 932 | - ob_end_clean();  | 
                                                        |
| 932 | + ob_end_clean();  | 
                                                        |
| 933 | 933 | |
| 934 | - return trim($output);  | 
                                                        |
| 934 | + return trim($output);  | 
                                                        |
| 935 | 935 | }  | 
                                                        
| 936 | 936 | |
| 937 | 937 | /**  | 
                                                        
@@ -942,10 +942,10 @@ discard block  | 
                                                    ||
| 942 | 942 | * @return string Listings HTML content.  | 
                                                        
| 943 | 943 | */  | 
                                                        
| 944 | 944 |  function geodir_sclistings_callback() { | 
                                                        
| 945 | -    check_ajax_referer('geodir-sclistings-nonce', 'geodir_sclistings_nonce'); | 
                                                        |
| 946 | - //set variables  | 
                                                        |
| 947 | - $scatts = isset($_POST['scatts']) ? $_POST['scatts'] : NULL;  | 
                                                        |
| 948 | - $pageno = isset($_POST['pageno']) ? absint($_POST['pageno']) : 1;  | 
                                                        |
| 945 | +	check_ajax_referer('geodir-sclistings-nonce', 'geodir_sclistings_nonce'); | 
                                                        |
| 946 | + //set variables  | 
                                                        |
| 947 | + $scatts = isset($_POST['scatts']) ? $_POST['scatts'] : NULL;  | 
                                                        |
| 948 | + $pageno = isset($_POST['pageno']) ? absint($_POST['pageno']) : 1;  | 
                                                        |
| 949 | 949 | |
| 950 | 950 | $shortcode_atts = !empty($scatts) ? (array)json_decode(stripslashes_deep($scatts)) : NULL;  | 
                                                        
| 951 | 951 | |
@@ -957,7 +957,7 @@ discard block  | 
                                                    ||
| 957 | 957 |  	} else { | 
                                                        
| 958 | 958 | echo 0;  | 
                                                        
| 959 | 959 | }  | 
                                                        
| 960 | - wp_die();  | 
                                                        |
| 960 | + wp_die();  | 
                                                        |
| 961 | 961 | }  | 
                                                        
| 962 | 962 |  add_action('wp_ajax_geodir_sclistings', 'geodir_sclistings_callback'); | 
                                                        
| 963 | 963 |  add_action('wp_ajax_nopriv_geodir_sclistings', 'geodir_sclistings_callback'); | 
                                                        
| 964 | 964 | \ No newline at end of file  | 
                                                        
@@ -29,10 +29,10 @@ discard block  | 
                                                    ||
| 29 | 29 | $value = 100;  | 
                                                        
| 30 | 30 | }  | 
                                                        
| 31 | 31 | // Re-add the percent symbol  | 
                                                        
| 32 | - $value = $value . '%';  | 
                                                        |
| 32 | + $value = $value.'%';  | 
                                                        |
| 33 | 33 |      } elseif ((strlen($value) - 2) == strpos(trim($value), 'px')) { | 
                                                        
| 34 | 34 | // Get the absint & re-add the 'px'  | 
                                                        
| 35 | -        $value = preg_replace('/\D/', '', $value) . 'px'; | 
                                                        |
| 35 | +        $value = preg_replace('/\D/', '', $value).'px'; | 
                                                        |
| 36 | 36 |      } else { | 
                                                        
| 37 | 37 |          $value = preg_replace('/\D/', '', $value); | 
                                                        
| 38 | 38 | }  | 
                                                        
@@ -211,7 +211,7 @@ discard block  | 
                                                    ||
| 211 | 211 | }  | 
                                                        
| 212 | 212 |      if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) { | 
                                                        
| 213 | 213 | |
| 214 | - $table = $plugin_prefix . $geodir_post_type . '_detail';  | 
                                                        |
| 214 | + $table = $plugin_prefix.$geodir_post_type.'_detail';  | 
                                                        |
| 215 | 215 | |
| 216 | 216 |          add_filter('posts_fields', 'geodir_posts_fields', 1); | 
                                                        
| 217 | 217 |          add_filter('posts_join', 'geodir_posts_join', 1); | 
                                                        
@@ -488,7 +488,7 @@ discard block  | 
                                                    ||
| 488 | 488 | }  | 
                                                        
| 489 | 489 | |
| 490 | 490 |      if (!empty($post_type)) { | 
                                                        
| 491 | - $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 491 | + $table = $plugin_prefix.$post_type.'_detail';  | 
                                                        |
| 492 | 492 | |
| 493 | 493 |          if (!geodir_prepare_custom_sorting($sort_choice, $table)) { | 
                                                        
| 494 | 494 | $sort_choice = '';  | 
                                                        
@@ -581,10 +581,10 @@ discard block  | 
                                                    ||
| 581 | 581 | $add_location_filter = !empty($args['add_location_filter']) ? true : false;  | 
                                                        
| 582 | 582 | $list_sort = !empty($args['list_sort']) ? $args['list_sort'] : 'latest';  | 
                                                        
| 583 | 583 | $character_count = isset($args['character_count']) ? $args['character_count'] : '';  | 
                                                        
| 584 | - $layout = !empty($args['layout']) ? $args['layout'] : 'gridview_onehalf';  | 
                                                        |
| 584 | + $layout = !empty($args['layout']) ? $args['layout'] : 'gridview_onehalf';  | 
                                                        |
| 585 | 585 | $listing_width = !empty($args['listing_width']) ? $args['listing_width'] : '';  | 
                                                        
| 586 | - $with_pagination = !empty($args['with_pagination']) ? true : false;  | 
                                                        |
| 587 | - $event_type = !empty($args['event_type']) ? $args['event_type'] : '';  | 
                                                        |
| 586 | + $with_pagination = !empty($args['with_pagination']) ? true : false;  | 
                                                        |
| 587 | + $event_type = !empty($args['event_type']) ? $args['event_type'] : '';  | 
                                                        |
| 588 | 588 | $shortcode_content = !empty($args['shortcode_content']) ? trim($args['shortcode_content']) : '';  | 
                                                        
| 589 | 589 | $tags = !empty($args['tags']) ? $args['tags'] : array();  | 
                                                        
| 590 | 590 | /**  | 
                                                        
@@ -598,13 +598,13 @@ discard block  | 
                                                    ||
| 598 | 598 |      $shortcode_content = apply_filters('geodir_sc_gd_listings_not_found_content', $shortcode_content, $args); | 
                                                        
| 599 | 599 | |
| 600 | 600 | $top_pagination = $with_pagination && !empty($args['top_pagination']) ? true : false;  | 
                                                        
| 601 | - $bottom_pagination = $with_pagination && !empty($args['bottom_pagination']) ? true : false;  | 
                                                        |
| 601 | + $bottom_pagination = $with_pagination && !empty($args['bottom_pagination']) ? true : false;  | 
                                                        |
| 602 | 602 | |
| 603 | 603 | $shortcode_atts = !empty($args['shortcode_atts']) ? $args['shortcode_atts'] : array();  | 
                                                        
| 604 | 604 | |
| 605 | 605 | // ajax mode  | 
                                                        
| 606 | - $geodir_ajax = !empty($args['geodir_ajax']) ? true : false;  | 
                                                        |
| 607 | - $pageno = $geodir_ajax && !empty($args['pageno']) ? $args['pageno'] : 1;  | 
                                                        |
| 606 | + $geodir_ajax = !empty($args['geodir_ajax']) ? true : false;  | 
                                                        |
| 607 | + $pageno = $geodir_ajax && !empty($args['pageno']) ? $args['pageno'] : 1;  | 
                                                        |
| 608 | 608 | |
| 609 | 609 | $query_args = array(  | 
                                                        
| 610 | 610 | 'posts_per_page' => $post_number,  | 
                                                        
@@ -668,7 +668,7 @@ discard block  | 
                                                    ||
| 668 | 668 | // Clean tags  | 
                                                        
| 669 | 669 |          if (!is_array($tags)) { | 
                                                        
| 670 | 670 |              $comma = _x(',', 'tag delimiter'); | 
                                                        
| 671 | -            if ( ',' !== $comma ) { | 
                                                        |
| 671 | +            if (',' !== $comma) { | 
                                                        |
| 672 | 672 | $tags = str_replace($comma, ',', $tags);  | 
                                                        
| 673 | 673 | }  | 
                                                        
| 674 | 674 |              $tags = explode(',', trim($tags, " \n\t\r\0\x0B,")); | 
                                                        
@@ -677,7 +677,7 @@ discard block  | 
                                                    ||
| 677 | 677 | |
| 678 | 678 |          if (!empty($tags)) { | 
                                                        
| 679 | 679 | $tag_query = array(  | 
                                                        
| 680 | - 'taxonomy' => $post_type . '_tags',  | 
                                                        |
| 680 | + 'taxonomy' => $post_type.'_tags',  | 
                                                        |
| 681 | 681 | 'field' => 'name',  | 
                                                        
| 682 | 682 | 'terms' => $tags  | 
                                                        
| 683 | 683 | );  | 
                                                        
@@ -707,7 +707,7 @@ discard block  | 
                                                    ||
| 707 | 707 | $widget_listings = $total_posts > 0 ? geodir_get_widget_listings($query_args) : array();  | 
                                                        
| 708 | 708 | }  | 
                                                        
| 709 | 709 | $current_gridview_columns_widget = $gridview_columns_widget;  | 
                                                        
| 710 | - $identifier = ' gd-wgt-pagi-' . mt_rand();  | 
                                                        |
| 710 | + $identifier = ' gd-wgt-pagi-'.mt_rand();  | 
                                                        |
| 711 | 711 | ob_start();  | 
                                                        
| 712 | 712 |  	if (!empty($widget_listings) || $with_no_results) { | 
                                                        
| 713 | 713 |  		if (!$geodir_ajax) { | 
                                                        
@@ -718,7 +718,7 @@ discard block  | 
                                                    ||
| 718 | 718 | */  | 
                                                        
| 719 | 719 |          do_action('geodir_before_sc_gd_listings'); | 
                                                        
| 720 | 720 | ?>  | 
                                                        
| 721 | - <div class="geodir_locations geodir_location_listing geodir-sc-gd-listings <?php echo $identifier;?>">  | 
                                                        |
| 721 | + <div class="geodir_locations geodir_location_listing geodir-sc-gd-listings <?php echo $identifier; ?>">  | 
                                                        |
| 722 | 722 |              <?php if ($title != '') { ?> | 
                                                        
| 723 | 723 | <div class="geodir_list_heading clearfix">  | 
                                                        
| 724 | 724 | <?php echo $title; ?>  | 
                                                        
@@ -787,8 +787,8 @@ discard block  | 
                                                    ||
| 787 | 787 | ?>  | 
                                                        
| 788 | 788 | </div><p class="geodir-sclisting-loading" style="display:none;"><i class="fa fa-cog fa-spin"></i></p></div>  | 
                                                        
| 789 | 789 | <script type="text/javascript">  | 
                                                        
| 790 | -jQuery(document).on('click', '.<?php echo trim($identifier);?> .gd-wgt-page', function(e) { | 
                                                        |
| 791 | - var container = jQuery( '.<?php echo trim($identifier);?>');  | 
                                                        |
| 790 | +jQuery(document).on('click', '.<?php echo trim($identifier); ?> .gd-wgt-page', function(e) { | 
                                                        |
| 791 | + var container = jQuery( '.<?php echo trim($identifier); ?>');  | 
                                                        |
| 792 | 792 | var obj = this;  | 
                                                        
| 793 | 793 |      var pid = parseInt(jQuery(this).data('page')); | 
                                                        
| 794 | 794 |      var items = jQuery(obj).closest('.gd-sc-content'); | 
                                                        
@@ -798,7 +798,7 @@ discard block  | 
                                                    ||
| 798 | 798 | return false;  | 
                                                        
| 799 | 799 | }  | 
                                                        
| 800 | 800 | |
| 801 | - var scatts = "<?php echo addslashes(json_encode($shortcode_atts));?>";  | 
                                                        |
| 801 | + var scatts = "<?php echo addslashes(json_encode($shortcode_atts)); ?>";  | 
                                                        |
| 802 | 802 | |
| 803 | 803 |      var data = { | 
                                                        
| 804 | 804 | 'action': 'geodir_sclistings',  | 
                                                        
@@ -887,16 +887,16 @@ discard block  | 
                                                    ||
| 887 | 887 |  	if ($max_page > 1 || $always_show) { | 
                                                        
| 888 | 888 | // Extra pagination info  | 
                                                        
| 889 | 889 |  		$geodir_pagination_more_info = get_option('geodir_pagination_advance_info'); | 
                                                        
| 890 | - $start_no = ( $pageno - 1 ) * $posts_per_page + 1;  | 
                                                        |
| 890 | + $start_no = ($pageno - 1) * $posts_per_page + 1;  | 
                                                        |
| 891 | 891 | $end_no = min($pageno * $posts_per_page, $numposts);  | 
                                                        
| 892 | 892 | |
| 893 | 893 |  		if ($geodir_pagination_more_info != '') { | 
                                                        
| 894 | -			$pagination_info = '<div class="gd-pagination-details gd-pagination-details-' . $geodir_pagination_more_info . '">' . wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts) . '</div>'; | 
                                                        |
| 894 | +			$pagination_info = '<div class="gd-pagination-details gd-pagination-details-'.$geodir_pagination_more_info.'">'.wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts).'</div>'; | 
                                                        |
| 895 | 895 | |
| 896 | 896 |  			if ($geodir_pagination_more_info == 'before') { | 
                                                        
| 897 | - $before = $before . $pagination_info;  | 
                                                        |
| 897 | + $before = $before.$pagination_info;  | 
                                                        |
| 898 | 898 |  			} else if ($geodir_pagination_more_info == 'after') { | 
                                                        
| 899 | - $after = $pagination_info . $after;  | 
                                                        |
| 899 | + $after = $pagination_info.$after;  | 
                                                        |
| 900 | 900 | }  | 
                                                        
| 901 | 901 | }  | 
                                                        
| 902 | 902 | |
@@ -906,7 +906,7 @@ discard block  | 
                                                    ||
| 906 | 906 | }  | 
                                                        
| 907 | 907 | |
| 908 | 908 |  		if (($pageno - 1) > 0) { | 
                                                        
| 909 | - echo '<a class="gd-page-sc-prev gd-wgt-page" data-page="' . (int)($pageno - 1) . '" href="javascript:void(0);">' . $prelabel . '</a> ';  | 
                                                        |
| 909 | + echo '<a class="gd-page-sc-prev gd-wgt-page" data-page="'.(int) ($pageno - 1).'" href="javascript:void(0);">'.$prelabel.'</a> ';  | 
                                                        |
| 910 | 910 | }  | 
                                                        
| 911 | 911 | |
| 912 | 912 |  		for ($i = $pageno - $half_pages_to_show; $i <= $pageno + $half_pages_to_show; $i++) { | 
                                                        
@@ -914,17 +914,17 @@ discard block  | 
                                                    ||
| 914 | 914 |  				if ($i == $pageno) { | 
                                                        
| 915 | 915 | echo "<strong class='on' class='gd-page-sc-act'>$i</strong>";  | 
                                                        
| 916 | 916 |  				} else { | 
                                                        
| 917 | - echo ' <a class="gd-page-sc-no gd-wgt-page" data-page="' . (int)$i . '" href="javascript:void(0);">' . $i . '</a> ';  | 
                                                        |
| 917 | + echo ' <a class="gd-page-sc-no gd-wgt-page" data-page="'.(int) $i.'" href="javascript:void(0);">'.$i.'</a> ';  | 
                                                        |
| 918 | 918 | }  | 
                                                        
| 919 | 919 | }  | 
                                                        
| 920 | 920 | }  | 
                                                        
| 921 | 921 | |
| 922 | 922 |  		if (($pageno + 1) <= $max_page) { | 
                                                        
| 923 | - echo ' <a class="gd-page-sc-nxt gd-wgt-page" data-page="' . (int)($pageno + 1) . '" href="javascript:void(0);">' . $nxtlabel . '</a>';  | 
                                                        |
| 923 | + echo ' <a class="gd-page-sc-nxt gd-wgt-page" data-page="'.(int) ($pageno + 1).'" href="javascript:void(0);">'.$nxtlabel.'</a>';  | 
                                                        |
| 924 | 924 | }  | 
                                                        
| 925 | 925 | |
| 926 | 926 |  		if ($pageno < $max_page) { | 
                                                        
| 927 | - echo ' <a class="gd-page-sc-lst gd-wgt-page" data-page="' . (int)$max_page . '" href="javascript:void(0);">»</a>';  | 
                                                        |
| 927 | + echo ' <a class="gd-page-sc-lst gd-wgt-page" data-page="'.(int) $max_page.'" href="javascript:void(0);">»</a>';  | 
                                                        |
| 928 | 928 | }  | 
                                                        
| 929 | 929 | echo "</div> $after </div>";  | 
                                                        
| 930 | 930 | }  | 
                                                        
@@ -947,7 +947,7 @@ discard block  | 
                                                    ||
| 947 | 947 | $scatts = isset($_POST['scatts']) ? $_POST['scatts'] : NULL;  | 
                                                        
| 948 | 948 | $pageno = isset($_POST['pageno']) ? absint($_POST['pageno']) : 1;  | 
                                                        
| 949 | 949 | |
| 950 | - $shortcode_atts = !empty($scatts) ? (array)json_decode(stripslashes_deep($scatts)) : NULL;  | 
                                                        |
| 950 | + $shortcode_atts = !empty($scatts) ? (array) json_decode(stripslashes_deep($scatts)) : NULL;  | 
                                                        |
| 951 | 951 | |
| 952 | 952 |  	if (!empty($shortcode_atts) && is_array($shortcode_atts)) { | 
                                                        
| 953 | 953 | $shortcode_atts['pageno'] = $pageno;  | 
                                                        
@@ -13,7 +13,7 @@ discard block  | 
                                                    ||
| 13 | 13 | * @package GeoDirectory  | 
                                                        
| 14 | 14 | * @global object $current_user Current user object.  | 
                                                        
| 15 | 15 | * @param bool $redirect Optional. Do you want to redirect to signup page, if user not logged in? Default: false.  | 
                                                        
| 16 | - * @return bool  | 
                                                        |
| 16 | + * @return null|boolean  | 
                                                        |
| 17 | 17 | */  | 
                                                        
| 18 | 18 | function geodir_is_login($redirect = false)  | 
                                                        
| 19 | 19 |  {
 | 
                                                        
@@ -69,7 +69,7 @@ discard block  | 
                                                    ||
| 69 | 69 | *  | 
                                                        
| 70 | 70 | * @since 1.0.0  | 
                                                        
| 71 | 71 | * @package GeoDirectory  | 
                                                        
| 72 | - * @return string|mixed|void The email ID.  | 
                                                        |
| 72 | + * @return string The email ID.  | 
                                                        |
| 73 | 73 | */  | 
                                                        
| 74 | 74 | function geodir_get_site_email_id()  | 
                                                        
| 75 | 75 |  {
 | 
                                                        
@@ -25,11 +25,13 @@ discard block  | 
                                                    ||
| 25 | 25 | window.location.href = '<?php echo geodir_login_url();?>';  | 
                                                        
| 26 | 26 | </script>  | 
                                                        
| 27 | 27 | <?php  | 
                                                        
| 28 | - } else  | 
                                                        |
| 29 | - return false;  | 
                                                        |
| 30 | - } else  | 
                                                        |
| 31 | - return true;  | 
                                                        |
| 32 | -}  | 
                                                        |
| 28 | +        } else { | 
                                                        |
| 29 | + return false;  | 
                                                        |
| 30 | + }  | 
                                                        |
| 31 | +    } else { | 
                                                        |
| 32 | + return true;  | 
                                                        |
| 33 | + }  | 
                                                        |
| 34 | + }  | 
                                                        |
| 33 | 35 | |
| 34 | 36 | /**  | 
                                                        
| 35 | 37 | * Redirect to SSL url, if SSL is being used.  | 
                                                        
@@ -60,7 +62,9 @@ discard block  | 
                                                    ||
| 60 | 62 | * @param string $message Login message.  | 
                                                        
| 61 | 63 | */  | 
                                                        
| 62 | 64 |      $message = apply_filters('login_message', $message);
 | 
                                                        
| 63 | - if (!empty($message)) echo $message . "\n";  | 
                                                        |
| 65 | +    if (!empty($message)) { | 
                                                        |
| 66 | + echo $message . "\n";  | 
                                                        |
| 67 | + }  | 
                                                        |
| 64 | 68 | |
| 65 | 69 | }  | 
                                                        
| 66 | 70 | |
@@ -141,14 +145,16 @@ discard block  | 
                                                    ||
| 141 | 145 | global $wpdb;  | 
                                                        
| 142 | 146 | |
| 143 | 147 | $errors = new WP_Error();  | 
                                                        
| 144 | - if (empty($_POST['user_login']) && empty($_POST['user_email']))  | 
                                                        |
| 145 | -        $errors->add('empty_username', __('<strong>ERROR</strong>: Enter a username or e-mail address.', 'geodirectory'));
 | 
                                                        |
| 148 | +    if (empty($_POST['user_login']) && empty($_POST['user_email'])) { | 
                                                        |
| 149 | +            $errors->add('empty_username', __('<strong>ERROR</strong>: Enter a username or e-mail address.', 'geodirectory')); | 
                                                        |
| 150 | + }  | 
                                                        |
| 146 | 151 | |
| 147 | 152 |      if (strpos($_POST['user_login'], '@')) {
 | 
                                                        
| 148 | 153 | //$user_data = get_user_by_email(trim($_POST['user_login']));  | 
                                                        
| 149 | 154 |          $user_data = get_user_by('email', trim($_POST['user_login']));
 | 
                                                        
| 150 | - if (empty($user_data))  | 
                                                        |
| 151 | -            $errors->add('invalid_email', __('<strong>ERROR</strong>: There is no user registered with that email address.', 'geodirectory'));
 | 
                                                        |
| 155 | +        if (empty($user_data)) { | 
                                                        |
| 156 | +                    $errors->add('invalid_email', __('<strong>ERROR</strong>: There is no user registered with that email address.', 'geodirectory')); | 
                                                        |
| 157 | + }  | 
                                                        |
| 152 | 158 |      } else {
 | 
                                                        
| 153 | 159 | $login = trim($_POST['user_login']);  | 
                                                        
| 154 | 160 |          $user_data = get_user_by('email', $login);
 | 
                                                        
@@ -161,8 +167,9 @@ discard block  | 
                                                    ||
| 161 | 167 | */  | 
                                                        
| 162 | 168 |      do_action('lostpassword_post');
 | 
                                                        
| 163 | 169 | |
| 164 | - if ($errors->get_error_code())  | 
                                                        |
| 165 | - return $errors;  | 
                                                        |
| 170 | +    if ($errors->get_error_code()) { | 
                                                        |
| 171 | + return $errors;  | 
                                                        |
| 172 | + }  | 
                                                        |
| 166 | 173 | |
| 167 | 174 |      if (!$user_data) {
 | 
                                                        
| 168 | 175 |          $errors->add('invalidcombo', __('<strong>ERROR</strong>: Invalid username or e-mail.', 'geodirectory'));
 | 
                                                        
@@ -192,8 +199,9 @@ discard block  | 
                                                    ||
| 192 | 199 | )  | 
                                                        
| 193 | 200 | );  | 
                                                        
| 194 | 201 | |
| 195 | - if (empty($user))  | 
                                                        |
| 196 | -        return new WP_Error('invalid_key', __('Invalid key', 'geodirectory'));
 | 
                                                        |
| 202 | +    if (empty($user)) { | 
                                                        |
| 203 | +            return new WP_Error('invalid_key', __('Invalid key', 'geodirectory')); | 
                                                        |
| 204 | + }  | 
                                                        |
| 197 | 205 | |
| 198 | 206 | $new_pass = wp_generate_password(12, false);  | 
                                                        
| 199 | 207 | |
@@ -282,13 +290,14 @@ discard block  | 
                                                    ||
| 282 | 290 | }  | 
                                                        
| 283 | 291 | |
| 284 | 292 | // Check the username  | 
                                                        
| 285 | - if ($user_login == '')  | 
                                                        |
| 286 | -        $errors->add('empty_username', __('ERROR: Please enter a username.', 'geodirectory'));
 | 
                                                        |
| 287 | -    elseif (!validate_username($user_login)) {
 | 
                                                        |
| 293 | +    if ($user_login == '') { | 
                                                        |
| 294 | +            $errors->add('empty_username', __('ERROR: Please enter a username.', 'geodirectory')); | 
                                                        |
| 295 | +    } elseif (!validate_username($user_login)) {
 | 
                                                        |
| 288 | 296 |          $errors->add('invalid_username', __('<strong>ERROR</strong>: This username is invalid.  Please enter a valid username.', 'geodirectory'));
 | 
                                                        
| 289 | 297 | $user_login = '';  | 
                                                        
| 290 | - } elseif (username_exists($user_login))  | 
                                                        |
| 291 | -        $errors->add('username_exists', __('<strong>ERROR</strong>: This username is already registered, please choose another one.', 'geodirectory'));
 | 
                                                        |
| 298 | +    } elseif (username_exists($user_login)) { | 
                                                        |
| 299 | +            $errors->add('username_exists', __('<strong>ERROR</strong>: This username is already registered, please choose another one.', 'geodirectory')); | 
                                                        |
| 300 | + }  | 
                                                        |
| 292 | 301 | |
| 293 | 302 | // Check the e-mail address  | 
                                                        
| 294 | 303 |      if ($user_email == '') {
 | 
                                                        
@@ -296,8 +305,9 @@ discard block  | 
                                                    ||
| 296 | 305 |      } elseif (!is_email($user_email)) {
 | 
                                                        
| 297 | 306 |          $errors->add('invalid_email', __('<strong>ERROR</strong>: The email address isn’t correct.', 'geodirectory'));
 | 
                                                        
| 298 | 307 | $user_email = '';  | 
                                                        
| 299 | - } elseif (email_exists($user_email))  | 
                                                        |
| 300 | -        $errors->add('email_exists', __('<strong>ERROR</strong>: This email is already registered, please choose another one.', 'geodirectory'));
 | 
                                                        |
| 308 | +    } elseif (email_exists($user_email)) { | 
                                                        |
| 309 | +            $errors->add('email_exists', __('<strong>ERROR</strong>: This email is already registered, please choose another one.', 'geodirectory')); | 
                                                        |
| 310 | + }  | 
                                                        |
| 301 | 311 | |
| 302 | 312 | /**  | 
                                                        
| 303 | 313 | * Called when registering a new user.  | 
                                                        
@@ -317,8 +327,9 @@ discard block  | 
                                                    ||
| 317 | 327 | */  | 
                                                        
| 318 | 328 |      $errors = apply_filters('registration_errors', $errors,$user_login,$user_email);
 | 
                                                        
| 319 | 329 | |
| 320 | - if ($errors->get_error_code())  | 
                                                        |
| 321 | - return $errors;  | 
                                                        |
| 330 | +    if ($errors->get_error_code()) { | 
                                                        |
| 331 | + return $errors;  | 
                                                        |
| 332 | + }  | 
                                                        |
| 322 | 333 | |
| 323 | 334 | |
| 324 | 335 |      if (!isset($user_pass) || $user_pass == '') {
 | 
                                                        
@@ -423,28 +434,33 @@ discard block  | 
                                                    ||
| 423 | 434 | |
| 424 | 435 | $errors = new WP_Error();  | 
                                                        
| 425 | 436 | |
| 426 | - if (isset($_GET['key']))  | 
                                                        |
| 427 | - $action = 'resetpass';  | 
                                                        |
| 437 | +    if (isset($_GET['key'])) { | 
                                                        |
| 438 | + $action = 'resetpass';  | 
                                                        |
| 439 | + }  | 
                                                        |
| 428 | 440 | |
| 429 | 441 | // 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))
 | 
                                                        |
| 431 | - $action = 'login';  | 
                                                        |
| 442 | +    if (!in_array($action, array('logout', 'lostpassword', 'retrievepassword', 'resetpass', 'rp', 'register', 'login')) && false === has_filter('login_form_' . $action)) { | 
                                                        |
| 443 | + $action = 'login';  | 
                                                        |
| 444 | + }  | 
                                                        |
| 432 | 445 | |
| 433 | 446 | nocache_headers();  | 
                                                        
| 434 | 447 | |
| 435 | 448 |      if (defined('RELOCATE')) { // Move flag is set
 | 
                                                        
| 436 | - if (isset($_SERVER['PATH_INFO']) && ($_SERVER['PATH_INFO'] != $_SERVER['PHP_SELF']))  | 
                                                        |
| 437 | - $_SERVER['PHP_SELF'] = str_replace($_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF']);  | 
                                                        |
| 449 | +        if (isset($_SERVER['PATH_INFO']) && ($_SERVER['PATH_INFO'] != $_SERVER['PHP_SELF'])) { | 
                                                        |
| 450 | + $_SERVER['PHP_SELF'] = str_replace($_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF']);  | 
                                                        |
| 451 | + }  | 
                                                        |
| 438 | 452 | |
| 439 | 453 | $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']));
 | 
                                                        |
| 454 | +        if (dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) != home_url()) { | 
                                                        |
| 455 | +                    update_option('siteurl', dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'])); | 
                                                        |
| 456 | + }  | 
                                                        |
| 442 | 457 | }  | 
                                                        
| 443 | 458 | |
| 444 | 459 | //Set a cookie now to see if they are supported by the browser.  | 
                                                        
| 445 | 460 | //setcookie(TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN);  | 
                                                        
| 446 | - if (SITECOOKIEPATH != COOKIEPATH)  | 
                                                        |
| 447 | - setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN);  | 
                                                        |
| 461 | +    if (SITECOOKIEPATH != COOKIEPATH) { | 
                                                        |
| 462 | + setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN);  | 
                                                        |
| 463 | + }  | 
                                                        |
| 448 | 464 | |
| 449 | 465 | /**  | 
                                                        
| 450 | 466 | * Allow plugins to override the default actions, and to add extra actions if they want on the register/signin page.  | 
                                                        
@@ -465,8 +481,9 @@ discard block  | 
                                                    ||
| 465 | 481 | |
| 466 | 482 | $redirect_to = $_SERVER['HTTP_REFERER'];  | 
                                                        
| 467 | 483 | //$redirect_to = home_url().'/?ptype=login&loggedout=true';  | 
                                                        
| 468 | - if (isset($_REQUEST['redirect_to']))  | 
                                                        |
| 469 | - $redirect_to = $_REQUEST['redirect_to'];  | 
                                                        |
| 484 | +            if (isset($_REQUEST['redirect_to'])) { | 
                                                        |
| 485 | + $redirect_to = $_REQUEST['redirect_to'];  | 
                                                        |
| 486 | + }  | 
                                                        |
| 470 | 487 | $redirect_to = home_url();  | 
                                                        
| 471 | 488 | wp_safe_redirect($redirect_to);  | 
                                                        
| 472 | 489 | exit();  | 
                                                        
@@ -486,7 +503,9 @@ discard block  | 
                                                    ||
| 486 | 503 | gd_die();  | 
                                                        
| 487 | 504 | }  | 
                                                        
| 488 | 505 | }  | 
                                                        
| 489 | -            if (isset($_GET['error']) && 'invalidkey' == $_GET['error']) $errors->add('invalidkey', __('Sorry, that key does not appear to be valid.', 'geodirectory'));
 | 
                                                        |
| 506 | +            if (isset($_GET['error']) && 'invalidkey' == $_GET['error']) { | 
                                                        |
| 507 | +            	$errors->add('invalidkey', __('Sorry, that key does not appear to be valid.', 'geodirectory')); | 
                                                        |
| 508 | + }  | 
                                                        |
| 490 | 509 | /**  | 
                                                        
| 491 | 510 | * Called in the geodir_user_signup() function during the lostpassword case.  | 
                                                        
| 492 | 511 | *  | 
                                                        
@@ -582,8 +601,9 @@ discard block  | 
                                                    ||
| 582 | 601 | }  | 
                                                        
| 583 | 602 | |
| 584 | 603 | |
| 585 | - if (!$secure_cookie && is_ssl() && force_ssl_admin() && !force_ssl_admin() && (0 !== strpos($redirect_to, 'https')) && (0 === strpos($redirect_to, 'http')))  | 
                                                        |
| 586 | - $secure_cookie = false;  | 
                                                        |
| 604 | +                    if (!$secure_cookie && is_ssl() && force_ssl_admin() && !force_ssl_admin() && (0 !== strpos($redirect_to, 'https')) && (0 === strpos($redirect_to, 'http'))) { | 
                                                        |
| 605 | + $secure_cookie = false;  | 
                                                        |
| 606 | + }  | 
                                                        |
| 587 | 607 | |
| 588 | 608 |                      $user = wp_signon('', $secure_cookie);
 | 
                                                        
| 589 | 609 | |
@@ -652,22 +672,26 @@ discard block  | 
                                                    ||
| 652 | 672 |                      $default_author_link = apply_filters('geodir_dashboard_author_link', $default_author_link, $user_ID);
 | 
                                                        
| 653 | 673 | |
| 654 | 674 | $_REQUEST['redirect_to'] = $default_author_link;  | 
                                                        
| 655 | - else:  | 
                                                        |
| 656 | - $_REQUEST['redirect_to'] = home_url();  | 
                                                        |
| 675 | +                else { | 
                                                        |
| 676 | + :  | 
                                                        |
| 677 | + $_REQUEST['redirect_to'] = home_url();  | 
                                                        |
| 678 | + }  | 
                                                        |
| 657 | 679 | endif;  | 
                                                        
| 658 | 680 | |
| 659 | 681 | }  | 
                                                        
| 660 | 682 |              if (isset($_REQUEST['redirect_to'])) {
 | 
                                                        
| 661 | 683 | $redirect_to = $_REQUEST['redirect_to'];  | 
                                                        
| 662 | 684 | // Redirect to https if user wants ssl  | 
                                                        
| 663 | - if ($secure_cookie && false !== strpos($redirect_to, 'wp-admin'))  | 
                                                        |
| 664 | -                    $redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
 | 
                                                        |
| 685 | +                if ($secure_cookie && false !== strpos($redirect_to, 'wp-admin')) { | 
                                                        |
| 686 | +                                    $redirect_to = preg_replace('|^http://|', 'https://', $redirect_to); | 
                                                        |
| 687 | + }  | 
                                                        |
| 665 | 688 |              } else {
 | 
                                                        
| 666 | 689 | $redirect_to = admin_url();  | 
                                                        
| 667 | 690 | }  | 
                                                        
| 668 | 691 | |
| 669 | - if (!$secure_cookie && is_ssl() && force_ssl_admin() && !force_ssl_admin() && (0 !== strpos($redirect_to, 'https')) && (0 === strpos($redirect_to, 'http')))  | 
                                                        |
| 670 | - $secure_cookie = false;  | 
                                                        |
| 692 | +            if (!$secure_cookie && is_ssl() && force_ssl_admin() && !force_ssl_admin() && (0 !== strpos($redirect_to, 'https')) && (0 === strpos($redirect_to, 'http'))) { | 
                                                        |
| 693 | + $secure_cookie = false;  | 
                                                        |
| 694 | + }  | 
                                                        |
| 671 | 695 |              $user = wp_signon('', $secure_cookie);
 | 
                                                        
| 672 | 696 | |
| 673 | 697 | |
@@ -702,11 +726,13 @@ discard block  | 
                                                    ||
| 702 | 726 | $errors = $user;  | 
                                                        
| 703 | 727 | |
| 704 | 728 | // Clear errors if loggedout is set.  | 
                                                        
| 705 | - if (!empty($_GET['loggedout']))  | 
                                                        |
| 706 | - $errors = new WP_Error();  | 
                                                        |
| 729 | +            if (!empty($_GET['loggedout'])) { | 
                                                        |
| 730 | + $errors = new WP_Error();  | 
                                                        |
| 731 | + }  | 
                                                        |
| 707 | 732 | // If cookies are disabled we can't log in even with a valid user+pass  | 
                                                        
| 708 | - if (isset($_POST['testcookie']) && empty($_COOKIE[TEST_COOKIE]))  | 
                                                        |
| 709 | -                $errors->add('test_cookie', __("<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to use WordPress.", 'geodirectory'));
 | 
                                                        |
| 733 | +            if (isset($_POST['testcookie']) && empty($_COOKIE[TEST_COOKIE])) { | 
                                                        |
| 734 | +                            $errors->add('test_cookie', __("<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to use WordPress.", 'geodirectory')); | 
                                                        |
| 735 | + }  | 
                                                        |
| 710 | 736 | |
| 711 | 737 | // Some parts of this script use the main login form to display a message  | 
                                                        
| 712 | 738 |              if (isset($_GET['loggedout']) && TRUE == $_GET['loggedout']) {
 | 
                                                        
@@ -17,18 +17,18 @@ discard block  | 
                                                    ||
| 17 | 17 | */  | 
                                                        
| 18 | 18 | function geodir_is_login($redirect = false)  | 
                                                        
| 19 | 19 |  {
 | 
                                                        
| 20 | - global $current_user;  | 
                                                        |
| 21 | -    if (!$current_user->ID) {
 | 
                                                        |
| 22 | -        if ($redirect) {
 | 
                                                        |
| 23 | - ?>  | 
                                                        |
| 20 | + global $current_user;  | 
                                                        |
| 21 | +	if (!$current_user->ID) {
 | 
                                                        |
| 22 | +		if ($redirect) {
 | 
                                                        |
| 23 | + ?>  | 
                                                        |
| 24 | 24 | <script type="text/javascript">  | 
                                                        
| 25 | 25 | window.location.href = '<?php echo geodir_login_url();?>';  | 
                                                        
| 26 | 26 | </script>  | 
                                                        
| 27 | 27 | <?php  | 
                                                        
| 28 | - } else  | 
                                                        |
| 29 | - return false;  | 
                                                        |
| 30 | - } else  | 
                                                        |
| 31 | - return true;  | 
                                                        |
| 28 | + } else  | 
                                                        |
| 29 | + return false;  | 
                                                        |
| 30 | + } else  | 
                                                        |
| 31 | + return true;  | 
                                                        |
| 32 | 32 | }  | 
                                                        
| 33 | 33 | |
| 34 | 34 | /**  | 
                                                        
@@ -42,25 +42,25 @@ discard block  | 
                                                    ||
| 42 | 42 |  {
 | 
                                                        
| 43 | 43 | |
| 44 | 44 | // Redirect to https login if forced to use SSL  | 
                                                        
| 45 | -    if (force_ssl_admin() && !is_ssl()) {
 | 
                                                        |
| 46 | -        if (0 === strpos($_SERVER['REQUEST_URI'], 'http')) {
 | 
                                                        |
| 47 | -            wp_redirect(preg_replace('|^http://|', 'https://', $_SERVER['REQUEST_URI']));
 | 
                                                        |
| 48 | - exit();  | 
                                                        |
| 49 | -        } else {
 | 
                                                        |
| 50 | -            wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
 | 
                                                        |
| 51 | - exit();  | 
                                                        |
| 52 | - }  | 
                                                        |
| 53 | - }  | 
                                                        |
| 54 | -  | 
                                                        |
| 55 | - /**  | 
                                                        |
| 56 | - * Filter the login message.  | 
                                                        |
| 57 | - *  | 
                                                        |
| 58 | - * @since 1.0.0  | 
                                                        |
| 59 | - *  | 
                                                        |
| 60 | - * @param string $message Login message.  | 
                                                        |
| 61 | - */  | 
                                                        |
| 62 | -    $message = apply_filters('login_message', $message);
 | 
                                                        |
| 63 | - if (!empty($message)) echo $message . "\n";  | 
                                                        |
| 45 | +	if (force_ssl_admin() && !is_ssl()) {
 | 
                                                        |
| 46 | +		if (0 === strpos($_SERVER['REQUEST_URI'], 'http')) {
 | 
                                                        |
| 47 | +			wp_redirect(preg_replace('|^http://|', 'https://', $_SERVER['REQUEST_URI']));
 | 
                                                        |
| 48 | + exit();  | 
                                                        |
| 49 | +		} else {
 | 
                                                        |
| 50 | +			wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
 | 
                                                        |
| 51 | + exit();  | 
                                                        |
| 52 | + }  | 
                                                        |
| 53 | + }  | 
                                                        |
| 54 | +  | 
                                                        |
| 55 | + /**  | 
                                                        |
| 56 | + * Filter the login message.  | 
                                                        |
| 57 | + *  | 
                                                        |
| 58 | + * @since 1.0.0  | 
                                                        |
| 59 | + *  | 
                                                        |
| 60 | + * @param string $message Login message.  | 
                                                        |
| 61 | + */  | 
                                                        |
| 62 | +	$message = apply_filters('login_message', $message);
 | 
                                                        |
| 63 | + if (!empty($message)) echo $message . "\n";  | 
                                                        |
| 64 | 64 | |
| 65 | 65 | }  | 
                                                        
| 66 | 66 | |
@@ -73,59 +73,59 @@ discard block  | 
                                                    ||
| 73 | 73 | */  | 
                                                        
| 74 | 74 | function geodir_get_site_email_id()  | 
                                                        
| 75 | 75 |  {
 | 
                                                        
| 76 | -    if (get_option('site_email')) {
 | 
                                                        |
| 76 | +	if (get_option('site_email')) {
 | 
                                                        |
| 77 | 77 | |
| 78 | -        return get_option('site_email');
 | 
                                                        |
| 78 | +		return get_option('site_email');
 | 
                                                        |
| 79 | 79 | |
| 80 | -    } else {
 | 
                                                        |
| 80 | +	} else {
 | 
                                                        |
| 81 | 81 | |
| 82 | -        return get_option('admin_email');
 | 
                                                        |
| 82 | +		return get_option('admin_email');
 | 
                                                        |
| 83 | 83 | |
| 84 | - }  | 
                                                        |
| 84 | + }  | 
                                                        |
| 85 | 85 | |
| 86 | 86 | }  | 
                                                        
| 87 | 87 | |
| 88 | 88 | |
| 89 | 89 |  if (!function_exists('get_site_emailName')) {
 | 
                                                        
| 90 | - /**  | 
                                                        |
| 91 | - * Get site name for sending emails.  | 
                                                        |
| 92 | - *  | 
                                                        |
| 93 | - * @since 1.0.0  | 
                                                        |
| 94 | - * @package GeoDirectory  | 
                                                        |
| 95 | - * @return string Site name.  | 
                                                        |
| 96 | - */  | 
                                                        |
| 97 | - function get_site_emailName()  | 
                                                        |
| 90 | + /**  | 
                                                        |
| 91 | + * Get site name for sending emails.  | 
                                                        |
| 92 | + *  | 
                                                        |
| 93 | + * @since 1.0.0  | 
                                                        |
| 94 | + * @package GeoDirectory  | 
                                                        |
| 95 | + * @return string Site name.  | 
                                                        |
| 96 | + */  | 
                                                        |
| 97 | + function get_site_emailName()  | 
                                                        |
| 98 | 98 | |
| 99 | -    {
 | 
                                                        |
| 99 | +	{
 | 
                                                        |
| 100 | 100 | |
| 101 | -        if (get_option('site_email_name')) {
 | 
                                                        |
| 101 | +		if (get_option('site_email_name')) {
 | 
                                                        |
| 102 | 102 | |
| 103 | -            return stripslashes(get_option('site_email_name'));
 | 
                                                        |
| 103 | +			return stripslashes(get_option('site_email_name'));
 | 
                                                        |
| 104 | 104 | |
| 105 | -        } else {
 | 
                                                        |
| 105 | +		} else {
 | 
                                                        |
| 106 | 106 | |
| 107 | -            return stripslashes(get_option('blogname'));
 | 
                                                        |
| 107 | +			return stripslashes(get_option('blogname'));
 | 
                                                        |
| 108 | 108 | |
| 109 | - }  | 
                                                        |
| 109 | + }  | 
                                                        |
| 110 | 110 | |
| 111 | - }  | 
                                                        |
| 111 | + }  | 
                                                        |
| 112 | 112 | }  | 
                                                        
| 113 | 113 | |
| 114 | 114 |  if (!function_exists('is_allow_user_register')) {
 | 
                                                        
| 115 | - /**  | 
                                                        |
| 116 | - * Checks whether the site allowing user registration or not.  | 
                                                        |
| 117 | - *  | 
                                                        |
| 118 | - * @since 1.0.0  | 
                                                        |
| 119 | - * @package GeoDirectory  | 
                                                        |
| 120 | - * @return bool|string  | 
                                                        |
| 121 | - */  | 
                                                        |
| 122 | - function is_allow_user_register()  | 
                                                        |
| 115 | + /**  | 
                                                        |
| 116 | + * Checks whether the site allowing user registration or not.  | 
                                                        |
| 117 | + *  | 
                                                        |
| 118 | + * @since 1.0.0  | 
                                                        |
| 119 | + * @package GeoDirectory  | 
                                                        |
| 120 | + * @return bool|string  | 
                                                        |
| 121 | + */  | 
                                                        |
| 122 | + function is_allow_user_register()  | 
                                                        |
| 123 | 123 | |
| 124 | -    {
 | 
                                                        |
| 124 | +	{
 | 
                                                        |
| 125 | 125 | |
| 126 | -        return get_option('users_can_register');
 | 
                                                        |
| 126 | +		return get_option('users_can_register');
 | 
                                                        |
| 127 | 127 | |
| 128 | - }  | 
                                                        |
| 128 | + }  | 
                                                        |
| 129 | 129 | }  | 
                                                        
| 130 | 130 | |
| 131 | 131 | /**  | 
                                                        
@@ -138,107 +138,107 @@ discard block  | 
                                                    ||
| 138 | 138 | */  | 
                                                        
| 139 | 139 | function geodir_retrieve_password()  | 
                                                        
| 140 | 140 |  {
 | 
                                                        
| 141 | - global $wpdb;  | 
                                                        |
| 142 | -  | 
                                                        |
| 143 | - $errors = new WP_Error();  | 
                                                        |
| 144 | - if (empty($_POST['user_login']) && empty($_POST['user_email']))  | 
                                                        |
| 145 | -        $errors->add('empty_username', __('<strong>ERROR</strong>: Enter a username or e-mail address.', 'geodirectory'));
 | 
                                                        |
| 146 | -  | 
                                                        |
| 147 | -    if (strpos($_POST['user_login'], '@')) {
 | 
                                                        |
| 148 | - //$user_data = get_user_by_email(trim($_POST['user_login']));  | 
                                                        |
| 149 | -        $user_data = get_user_by('email', trim($_POST['user_login']));
 | 
                                                        |
| 150 | - if (empty($user_data))  | 
                                                        |
| 151 | -            $errors->add('invalid_email', __('<strong>ERROR</strong>: There is no user registered with that email address.', 'geodirectory'));
 | 
                                                        |
| 152 | -    } else {
 | 
                                                        |
| 153 | - $login = trim($_POST['user_login']);  | 
                                                        |
| 154 | -        $user_data = get_user_by('email', $login);
 | 
                                                        |
| 155 | - }  | 
                                                        |
| 156 | -  | 
                                                        |
| 157 | - /**  | 
                                                        |
| 158 | - * Called in the geodir_retrieve_password() function before any errors are set or any emails are sent.  | 
                                                        |
| 159 | - *  | 
                                                        |
| 160 | - * @since 1.0.0  | 
                                                        |
| 161 | - */  | 
                                                        |
| 162 | -    do_action('lostpassword_post');
 | 
                                                        |
| 163 | -  | 
                                                        |
| 164 | - if ($errors->get_error_code())  | 
                                                        |
| 165 | - return $errors;  | 
                                                        |
| 166 | -  | 
                                                        |
| 167 | -    if (!$user_data) {
 | 
                                                        |
| 168 | -        $errors->add('invalidcombo', __('<strong>ERROR</strong>: Invalid username or e-mail.', 'geodirectory'));
 | 
                                                        |
| 169 | - return $errors;  | 
                                                        |
| 170 | - }  | 
                                                        |
| 171 | -  | 
                                                        |
| 172 | - // redefining user_login ensures we return the right case in the email  | 
                                                        |
| 173 | - $user_login = $user_data->user_login;  | 
                                                        |
| 174 | - $user_email = $user_data->user_email;  | 
                                                        |
| 175 | -  | 
                                                        |
| 176 | - /**  | 
                                                        |
| 177 | - * Called in the geodir_retrieve_password() function before any emails are sent.  | 
                                                        |
| 178 | - *  | 
                                                        |
| 179 | - * @since 1.0.0  | 
                                                        |
| 180 | - * @param string $user_login The users username.  | 
                                                        |
| 181 | - */  | 
                                                        |
| 182 | -    do_action('retrieve_password', $user_login);
 | 
                                                        |
| 183 | -  | 
                                                        |
| 184 | - ////////////////////////////////////  | 
                                                        |
| 185 | - $user_email = isset($_POST['user_email']) ? $_POST['user_email'] : '';  | 
                                                        |
| 186 | - $user_login = $_POST['user_login'];  | 
                                                        |
| 187 | -  | 
                                                        |
| 188 | - $user = $wpdb->get_row(  | 
                                                        |
| 189 | - $wpdb->prepare(  | 
                                                        |
| 190 | - "SELECT * FROM $wpdb->users WHERE user_login like %s or user_email like %s",  | 
                                                        |
| 191 | - array($user_login, $user_login)  | 
                                                        |
| 192 | - )  | 
                                                        |
| 193 | - );  | 
                                                        |
| 194 | -  | 
                                                        |
| 195 | - if (empty($user))  | 
                                                        |
| 196 | -        return new WP_Error('invalid_key', __('Invalid key', 'geodirectory'));
 | 
                                                        |
| 197 | -  | 
                                                        |
| 198 | - $new_pass = wp_generate_password(12, false);  | 
                                                        |
| 199 | -  | 
                                                        |
| 200 | - /**  | 
                                                        |
| 201 | - * Called in the geodir_retrieve_password() function before any emails are sent.  | 
                                                        |
| 202 | - *  | 
                                                        |
| 203 | - * @since 1.0.0  | 
                                                        |
| 204 | - * @param object $user The user object.  | 
                                                        |
| 205 | - * @param string $new_pass The new pass being sent to the user.  | 
                                                        |
| 206 | - */  | 
                                                        |
| 207 | -    do_action('password_reset', $user, $new_pass);
 | 
                                                        |
| 208 | -  | 
                                                        |
| 209 | - wp_set_password($new_pass, $user->ID);  | 
                                                        |
| 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>";
 | 
                                                        |
| 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 | -    //$message .= '<p>Thank You,<br> '.get_option('blogname').'</p>';
 | 
                                                        |
| 216 | - $user_email = $user_data->user_email;  | 
                                                        |
| 217 | - $user_name = geodir_get_client_name($user->ID);  | 
                                                        |
| 218 | - $fromEmail = geodir_get_site_email_id();  | 
                                                        |
| 219 | - $fromEmailName = get_site_emailName();  | 
                                                        |
| 220 | -    $title = sprintf(__('[%s] Your new password', 'geodirectory'), get_option('blogname'));
 | 
                                                        |
| 221 | - /**  | 
                                                        |
| 222 | - * Filter the password reset email subject part.  | 
                                                        |
| 223 | - *  | 
                                                        |
| 224 | - * @since 1.0.0  | 
                                                        |
| 225 | - *  | 
                                                        |
| 226 | - * @param string $title Password reset email subject.  | 
                                                        |
| 227 | - */  | 
                                                        |
| 228 | -    $title = apply_filters('password_reset_title', $title);
 | 
                                                        |
| 229 | - /**  | 
                                                        |
| 230 | - * Filter the password reset email message part.  | 
                                                        |
| 231 | - *  | 
                                                        |
| 232 | - * @since 1.0.0  | 
                                                        |
| 233 | - *  | 
                                                        |
| 234 | - * @param string $message Password reset email message.  | 
                                                        |
| 235 | - * @param string $new_pass The new password string.  | 
                                                        |
| 236 | - */  | 
                                                        |
| 237 | -    $message = apply_filters('password_reset_message', $message, $new_pass);
 | 
                                                        |
| 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  | 
                                                        |
| 240 | -  | 
                                                        |
| 241 | - return true;  | 
                                                        |
| 141 | + global $wpdb;  | 
                                                        |
| 142 | +  | 
                                                        |
| 143 | + $errors = new WP_Error();  | 
                                                        |
| 144 | + if (empty($_POST['user_login']) && empty($_POST['user_email']))  | 
                                                        |
| 145 | +		$errors->add('empty_username', __('<strong>ERROR</strong>: Enter a username or e-mail address.', 'geodirectory'));
 | 
                                                        |
| 146 | +  | 
                                                        |
| 147 | +	if (strpos($_POST['user_login'], '@')) {
 | 
                                                        |
| 148 | + //$user_data = get_user_by_email(trim($_POST['user_login']));  | 
                                                        |
| 149 | +		$user_data = get_user_by('email', trim($_POST['user_login']));
 | 
                                                        |
| 150 | + if (empty($user_data))  | 
                                                        |
| 151 | +			$errors->add('invalid_email', __('<strong>ERROR</strong>: There is no user registered with that email address.', 'geodirectory'));
 | 
                                                        |
| 152 | +	} else {
 | 
                                                        |
| 153 | + $login = trim($_POST['user_login']);  | 
                                                        |
| 154 | +		$user_data = get_user_by('email', $login);
 | 
                                                        |
| 155 | + }  | 
                                                        |
| 156 | +  | 
                                                        |
| 157 | + /**  | 
                                                        |
| 158 | + * Called in the geodir_retrieve_password() function before any errors are set or any emails are sent.  | 
                                                        |
| 159 | + *  | 
                                                        |
| 160 | + * @since 1.0.0  | 
                                                        |
| 161 | + */  | 
                                                        |
| 162 | +	do_action('lostpassword_post');
 | 
                                                        |
| 163 | +  | 
                                                        |
| 164 | + if ($errors->get_error_code())  | 
                                                        |
| 165 | + return $errors;  | 
                                                        |
| 166 | +  | 
                                                        |
| 167 | +	if (!$user_data) {
 | 
                                                        |
| 168 | +		$errors->add('invalidcombo', __('<strong>ERROR</strong>: Invalid username or e-mail.', 'geodirectory'));
 | 
                                                        |
| 169 | + return $errors;  | 
                                                        |
| 170 | + }  | 
                                                        |
| 171 | +  | 
                                                        |
| 172 | + // redefining user_login ensures we return the right case in the email  | 
                                                        |
| 173 | + $user_login = $user_data->user_login;  | 
                                                        |
| 174 | + $user_email = $user_data->user_email;  | 
                                                        |
| 175 | +  | 
                                                        |
| 176 | + /**  | 
                                                        |
| 177 | + * Called in the geodir_retrieve_password() function before any emails are sent.  | 
                                                        |
| 178 | + *  | 
                                                        |
| 179 | + * @since 1.0.0  | 
                                                        |
| 180 | + * @param string $user_login The users username.  | 
                                                        |
| 181 | + */  | 
                                                        |
| 182 | +	do_action('retrieve_password', $user_login);
 | 
                                                        |
| 183 | +  | 
                                                        |
| 184 | + ////////////////////////////////////  | 
                                                        |
| 185 | + $user_email = isset($_POST['user_email']) ? $_POST['user_email'] : '';  | 
                                                        |
| 186 | + $user_login = $_POST['user_login'];  | 
                                                        |
| 187 | +  | 
                                                        |
| 188 | + $user = $wpdb->get_row(  | 
                                                        |
| 189 | + $wpdb->prepare(  | 
                                                        |
| 190 | + "SELECT * FROM $wpdb->users WHERE user_login like %s or user_email like %s",  | 
                                                        |
| 191 | + array($user_login, $user_login)  | 
                                                        |
| 192 | + )  | 
                                                        |
| 193 | + );  | 
                                                        |
| 194 | +  | 
                                                        |
| 195 | + if (empty($user))  | 
                                                        |
| 196 | +		return new WP_Error('invalid_key', __('Invalid key', 'geodirectory'));
 | 
                                                        |
| 197 | +  | 
                                                        |
| 198 | + $new_pass = wp_generate_password(12, false);  | 
                                                        |
| 199 | +  | 
                                                        |
| 200 | + /**  | 
                                                        |
| 201 | + * Called in the geodir_retrieve_password() function before any emails are sent.  | 
                                                        |
| 202 | + *  | 
                                                        |
| 203 | + * @since 1.0.0  | 
                                                        |
| 204 | + * @param object $user The user object.  | 
                                                        |
| 205 | + * @param string $new_pass The new pass being sent to the user.  | 
                                                        |
| 206 | + */  | 
                                                        |
| 207 | +	do_action('password_reset', $user, $new_pass);
 | 
                                                        |
| 208 | +  | 
                                                        |
| 209 | + wp_set_password($new_pass, $user->ID);  | 
                                                        |
| 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>";
 | 
                                                        |
| 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 | +	//$message .= '<p>Thank You,<br> '.get_option('blogname').'</p>';
 | 
                                                        |
| 216 | + $user_email = $user_data->user_email;  | 
                                                        |
| 217 | + $user_name = geodir_get_client_name($user->ID);  | 
                                                        |
| 218 | + $fromEmail = geodir_get_site_email_id();  | 
                                                        |
| 219 | + $fromEmailName = get_site_emailName();  | 
                                                        |
| 220 | +	$title = sprintf(__('[%s] Your new password', 'geodirectory'), get_option('blogname'));
 | 
                                                        |
| 221 | + /**  | 
                                                        |
| 222 | + * Filter the password reset email subject part.  | 
                                                        |
| 223 | + *  | 
                                                        |
| 224 | + * @since 1.0.0  | 
                                                        |
| 225 | + *  | 
                                                        |
| 226 | + * @param string $title Password reset email subject.  | 
                                                        |
| 227 | + */  | 
                                                        |
| 228 | +	$title = apply_filters('password_reset_title', $title);
 | 
                                                        |
| 229 | + /**  | 
                                                        |
| 230 | + * Filter the password reset email message part.  | 
                                                        |
| 231 | + *  | 
                                                        |
| 232 | + * @since 1.0.0  | 
                                                        |
| 233 | + *  | 
                                                        |
| 234 | + * @param string $message Password reset email message.  | 
                                                        |
| 235 | + * @param string $new_pass The new password string.  | 
                                                        |
| 236 | + */  | 
                                                        |
| 237 | +	$message = apply_filters('password_reset_message', $message, $new_pass);
 | 
                                                        |
| 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  | 
                                                        |
| 240 | +  | 
                                                        |
| 241 | + return true;  | 
                                                        |
| 242 | 242 | }  | 
                                                        
| 243 | 243 | |
| 244 | 244 | /**  | 
                                                        
@@ -253,80 +253,80 @@ discard block  | 
                                                    ||
| 253 | 253 | */  | 
                                                        
| 254 | 254 | function geodir_register_new_user($user_login, $user_email)  | 
                                                        
| 255 | 255 |  {
 | 
                                                        
| 256 | - global $wpdb;  | 
                                                        |
| 257 | - $errors = new WP_Error();  | 
                                                        |
| 258 | -  | 
                                                        |
| 259 | -  | 
                                                        |
| 260 | - $user_login = sanitize_user($user_login);  | 
                                                        |
| 261 | -    $user_login = str_replace(",", "", $user_login);
 | 
                                                        |
| 262 | -    $user_email = str_replace(",", "", $user_email);
 | 
                                                        |
| 263 | - /**  | 
                                                        |
| 264 | - * Filter the user registration email.  | 
                                                        |
| 265 | - *  | 
                                                        |
| 266 | - * @since 1.0.0  | 
                                                        |
| 267 | - *  | 
                                                        |
| 268 | - * @param string $user_email User registration email.  | 
                                                        |
| 269 | - */  | 
                                                        |
| 270 | -    $user_email = apply_filters('user_registration_email', $user_email);
 | 
                                                        |
| 271 | -  | 
                                                        |
| 272 | -  | 
                                                        |
| 273 | -    if (get_option('geodir_allow_cpass')) {
 | 
                                                        |
| 274 | - $user_pass = $_REQUEST['user_pass'];  | 
                                                        |
| 275 | - $user_pass2 = $_REQUEST['user_pass2'];  | 
                                                        |
| 276 | - // Check the password  | 
                                                        |
| 277 | -        if ($user_pass != $user_pass2) {
 | 
                                                        |
| 278 | -            $errors->add('pass_match', __('ERROR: Passwords do not match.', 'geodirectory'));
 | 
                                                        |
| 279 | -        } elseif (strlen($user_pass) < 7) {
 | 
                                                        |
| 280 | -            $errors->add('pass_match', __('ERROR: Password must be 7 characters or more.', 'geodirectory'));
 | 
                                                        |
| 281 | - }  | 
                                                        |
| 282 | - }  | 
                                                        |
| 283 | -  | 
                                                        |
| 284 | - // Check the username  | 
                                                        |
| 285 | - if ($user_login == '')  | 
                                                        |
| 286 | -        $errors->add('empty_username', __('ERROR: Please enter a username.', 'geodirectory'));
 | 
                                                        |
| 287 | -    elseif (!validate_username($user_login)) {
 | 
                                                        |
| 288 | -        $errors->add('invalid_username', __('<strong>ERROR</strong>: This username is invalid.  Please enter a valid username.', 'geodirectory'));
 | 
                                                        |
| 289 | - $user_login = '';  | 
                                                        |
| 290 | - } elseif (username_exists($user_login))  | 
                                                        |
| 291 | -        $errors->add('username_exists', __('<strong>ERROR</strong>: This username is already registered, please choose another one.', 'geodirectory'));
 | 
                                                        |
| 292 | -  | 
                                                        |
| 293 | - // Check the e-mail address  | 
                                                        |
| 294 | -    if ($user_email == '') {
 | 
                                                        |
| 295 | -        $errors->add('empty_email', __('<strong>ERROR</strong>: Please type your e-mail address.', 'geodirectory'));
 | 
                                                        |
| 296 | -    } elseif (!is_email($user_email)) {
 | 
                                                        |
| 297 | -        $errors->add('invalid_email', __('<strong>ERROR</strong>: The email address isn’t correct.', 'geodirectory'));
 | 
                                                        |
| 298 | - $user_email = '';  | 
                                                        |
| 299 | - } elseif (email_exists($user_email))  | 
                                                        |
| 300 | -        $errors->add('email_exists', __('<strong>ERROR</strong>: This email is already registered, please choose another one.', 'geodirectory'));
 | 
                                                        |
| 301 | -  | 
                                                        |
| 302 | - /**  | 
                                                        |
| 303 | - * Called when registering a new user.  | 
                                                        |
| 304 | - *  | 
                                                        |
| 305 | - * This is a WordPress core hook.  | 
                                                        |
| 306 | - *  | 
                                                        |
| 307 | - * @link https://codex.wordpress.org/Plugin_API/Action_Reference/register_post  | 
                                                        |
| 308 | - * @since 1.0.0  | 
                                                        |
| 309 | - */  | 
                                                        |
| 310 | -    do_action('register_post', $user_login, $user_email, $errors);
 | 
                                                        |
| 311 | - /**  | 
                                                        |
| 312 | - * Filter the registration error messages.  | 
                                                        |
| 313 | - *  | 
                                                        |
| 314 | - * @since 1.0.0  | 
                                                        |
| 315 | - *  | 
                                                        |
| 316 | - * @param object $errors Registration error messages.  | 
                                                        |
| 317 | - */  | 
                                                        |
| 318 | -    $errors = apply_filters('registration_errors', $errors,$user_login,$user_email);
 | 
                                                        |
| 319 | -  | 
                                                        |
| 320 | - if ($errors->get_error_code())  | 
                                                        |
| 321 | - return $errors;  | 
                                                        |
| 322 | -  | 
                                                        |
| 323 | -  | 
                                                        |
| 324 | -    if (!isset($user_pass) || $user_pass == '') {
 | 
                                                        |
| 325 | - $user_pass = wp_generate_password(12, false);  | 
                                                        |
| 326 | - }  | 
                                                        |
| 327 | - $user_id = wp_create_user($user_login, $user_pass, $user_email);  | 
                                                        |
| 328 | - $user_web = '';  | 
                                                        |
| 329 | - /*$user_add1 = $_POST['user_add1'];  | 
                                                        |
| 256 | + global $wpdb;  | 
                                                        |
| 257 | + $errors = new WP_Error();  | 
                                                        |
| 258 | +  | 
                                                        |
| 259 | +  | 
                                                        |
| 260 | + $user_login = sanitize_user($user_login);  | 
                                                        |
| 261 | +	$user_login = str_replace(",", "", $user_login);
 | 
                                                        |
| 262 | +	$user_email = str_replace(",", "", $user_email);
 | 
                                                        |
| 263 | + /**  | 
                                                        |
| 264 | + * Filter the user registration email.  | 
                                                        |
| 265 | + *  | 
                                                        |
| 266 | + * @since 1.0.0  | 
                                                        |
| 267 | + *  | 
                                                        |
| 268 | + * @param string $user_email User registration email.  | 
                                                        |
| 269 | + */  | 
                                                        |
| 270 | +	$user_email = apply_filters('user_registration_email', $user_email);
 | 
                                                        |
| 271 | +  | 
                                                        |
| 272 | +  | 
                                                        |
| 273 | +	if (get_option('geodir_allow_cpass')) {
 | 
                                                        |
| 274 | + $user_pass = $_REQUEST['user_pass'];  | 
                                                        |
| 275 | + $user_pass2 = $_REQUEST['user_pass2'];  | 
                                                        |
| 276 | + // Check the password  | 
                                                        |
| 277 | +		if ($user_pass != $user_pass2) {
 | 
                                                        |
| 278 | +			$errors->add('pass_match', __('ERROR: Passwords do not match.', 'geodirectory'));
 | 
                                                        |
| 279 | +		} elseif (strlen($user_pass) < 7) {
 | 
                                                        |
| 280 | +			$errors->add('pass_match', __('ERROR: Password must be 7 characters or more.', 'geodirectory'));
 | 
                                                        |
| 281 | + }  | 
                                                        |
| 282 | + }  | 
                                                        |
| 283 | +  | 
                                                        |
| 284 | + // Check the username  | 
                                                        |
| 285 | + if ($user_login == '')  | 
                                                        |
| 286 | +		$errors->add('empty_username', __('ERROR: Please enter a username.', 'geodirectory'));
 | 
                                                        |
| 287 | +	elseif (!validate_username($user_login)) {
 | 
                                                        |
| 288 | +		$errors->add('invalid_username', __('<strong>ERROR</strong>: This username is invalid.  Please enter a valid username.', 'geodirectory'));
 | 
                                                        |
| 289 | + $user_login = '';  | 
                                                        |
| 290 | + } elseif (username_exists($user_login))  | 
                                                        |
| 291 | +		$errors->add('username_exists', __('<strong>ERROR</strong>: This username is already registered, please choose another one.', 'geodirectory'));
 | 
                                                        |
| 292 | +  | 
                                                        |
| 293 | + // Check the e-mail address  | 
                                                        |
| 294 | +	if ($user_email == '') {
 | 
                                                        |
| 295 | +		$errors->add('empty_email', __('<strong>ERROR</strong>: Please type your e-mail address.', 'geodirectory'));
 | 
                                                        |
| 296 | +	} elseif (!is_email($user_email)) {
 | 
                                                        |
| 297 | +		$errors->add('invalid_email', __('<strong>ERROR</strong>: The email address isn’t correct.', 'geodirectory'));
 | 
                                                        |
| 298 | + $user_email = '';  | 
                                                        |
| 299 | + } elseif (email_exists($user_email))  | 
                                                        |
| 300 | +		$errors->add('email_exists', __('<strong>ERROR</strong>: This email is already registered, please choose another one.', 'geodirectory'));
 | 
                                                        |
| 301 | +  | 
                                                        |
| 302 | + /**  | 
                                                        |
| 303 | + * Called when registering a new user.  | 
                                                        |
| 304 | + *  | 
                                                        |
| 305 | + * This is a WordPress core hook.  | 
                                                        |
| 306 | + *  | 
                                                        |
| 307 | + * @link https://codex.wordpress.org/Plugin_API/Action_Reference/register_post  | 
                                                        |
| 308 | + * @since 1.0.0  | 
                                                        |
| 309 | + */  | 
                                                        |
| 310 | +	do_action('register_post', $user_login, $user_email, $errors);
 | 
                                                        |
| 311 | + /**  | 
                                                        |
| 312 | + * Filter the registration error messages.  | 
                                                        |
| 313 | + *  | 
                                                        |
| 314 | + * @since 1.0.0  | 
                                                        |
| 315 | + *  | 
                                                        |
| 316 | + * @param object $errors Registration error messages.  | 
                                                        |
| 317 | + */  | 
                                                        |
| 318 | +	$errors = apply_filters('registration_errors', $errors,$user_login,$user_email);
 | 
                                                        |
| 319 | +  | 
                                                        |
| 320 | + if ($errors->get_error_code())  | 
                                                        |
| 321 | + return $errors;  | 
                                                        |
| 322 | +  | 
                                                        |
| 323 | +  | 
                                                        |
| 324 | +	if (!isset($user_pass) || $user_pass == '') {
 | 
                                                        |
| 325 | + $user_pass = wp_generate_password(12, false);  | 
                                                        |
| 326 | + }  | 
                                                        |
| 327 | + $user_id = wp_create_user($user_login, $user_pass, $user_email);  | 
                                                        |
| 328 | + $user_web = '';  | 
                                                        |
| 329 | + /*$user_add1 = $_POST['user_add1'];  | 
                                                        |
| 330 | 330 | $user_add2 = $_POST['user_add2'];  | 
                                                        
| 331 | 331 | $user_city = $_POST['user_city'];  | 
                                                        
| 332 | 332 | $user_state = $_POST['user_state'];  | 
                                                        
@@ -335,77 +335,77 @@ discard block  | 
                                                    ||
| 335 | 335 | $user_web = $_POST['user_web'];  | 
                                                        
| 336 | 336 | $user_phone = $_POST['user_phone'];  | 
                                                        
| 337 | 337 | $user_twitter = $_POST['user_twitter']; */  | 
                                                        
| 338 | - $user_fname = sanitize_user($_POST['user_fname']);  | 
                                                        |
| 339 | -    $user_fname = str_replace(",", "", $user_fname);
 | 
                                                        |
| 340 | -  | 
                                                        |
| 341 | - /**  | 
                                                        |
| 342 | - * Filter the submitted user meta.  | 
                                                        |
| 343 | - *  | 
                                                        |
| 344 | - * @since 1.0.0  | 
                                                        |
| 345 | - *  | 
                                                        |
| 346 | - * @param int $user_id User ID.  | 
                                                        |
| 347 | - */  | 
                                                        |
| 348 | -    $user_address_info = apply_filters('geodir_manage_user_meta', array(
 | 
                                                        |
| 349 | - "user_add1" => '',  | 
                                                        |
| 350 | - "user_add2" => '',  | 
                                                        |
| 351 | - "user_city" => '',  | 
                                                        |
| 352 | - "user_state" => '',  | 
                                                        |
| 353 | - "user_country" => '',  | 
                                                        |
| 354 | - "user_postalcode" => '',  | 
                                                        |
| 355 | - "user_phone" => '',  | 
                                                        |
| 356 | - "user_twitter" => '',  | 
                                                        |
| 357 | - "first_name" => $user_fname,  | 
                                                        |
| 358 | - "last_name" => '',  | 
                                                        |
| 359 | - ), $user_id);  | 
                                                        |
| 360 | -    foreach ($user_address_info as $key => $val) {
 | 
                                                        |
| 361 | - update_user_meta($user_id, $key, $val); // User Address Information Here  | 
                                                        |
| 362 | - }  | 
                                                        |
| 363 | - //update_user_meta($user_id, 'user_address_info', ($user_address_info)); // User Address Information Here  | 
                                                        |
| 364 | - $userName = $user_fname;  | 
                                                        |
| 365 | - update_user_meta($user_id, 'first_name', $userName); // User Address Information Here  | 
                                                        |
| 366 | - //update_user_meta($user_id, 'last_name', $_POST['user_lname']); // User Address Information Here  | 
                                                        |
| 367 | -  | 
                                                        |
| 368 | - // Changed by vikas sharma to enable all type of characters in author permalink...  | 
                                                        |
| 369 | - $user_nicename = sanitize_title($userName);  | 
                                                        |
| 370 | -  | 
                                                        |
| 371 | -    $updateUsersql = $wpdb->prepare("update $wpdb->users set user_url=%s, user_nicename=%s, display_name=%s  where ID=%d", array($user_web, $user_nicename, $userName, $user_id));
 | 
                                                        |
| 372 | -  | 
                                                        |
| 373 | - $wpdb->query($updateUsersql);  | 
                                                        |
| 374 | -  | 
                                                        |
| 375 | -    if (!$user_id) {
 | 
                                                        |
| 376 | -        $errors->add('registerfail', sprintf(__('<strong>ERROR</strong>: Couldn’t register you... please contact the <a href="mailto:%s">webmaster</a> !', 'geodirectory'), get_option('admin_email')));
 | 
                                                        |
| 377 | - return $errors;  | 
                                                        |
| 378 | - }  | 
                                                        |
| 379 | - global $upload_folder_path;  | 
                                                        |
| 380 | -  | 
                                                        |
| 381 | -    if ($user_id) {
 | 
                                                        |
| 382 | -  | 
                                                        |
| 383 | - /**  | 
                                                        |
| 384 | - * Called after registering a user and before the registration email is sent.  | 
                                                        |
| 385 | - *  | 
                                                        |
| 386 | - * @since 1.0.0  | 
                                                        |
| 387 | - * @param int $user_id The user ID of the registered user.  | 
                                                        |
| 388 | - */  | 
                                                        |
| 389 | -        do_action('geodir_user_register', $user_id);
 | 
                                                        |
| 390 | - ///////REGISTRATION EMAIL START//////  | 
                                                        |
| 391 | - $fromEmail = geodir_get_site_email_id();  | 
                                                        |
| 392 | - $fromEmailName = get_site_emailName();  | 
                                                        |
| 393 | -        $message = __('<p><b>' . __('Your login Information :', 'geodirectory') . '</b></p>
 | 
                                                        |
| 338 | + $user_fname = sanitize_user($_POST['user_fname']);  | 
                                                        |
| 339 | +	$user_fname = str_replace(",", "", $user_fname);
 | 
                                                        |
| 340 | +  | 
                                                        |
| 341 | + /**  | 
                                                        |
| 342 | + * Filter the submitted user meta.  | 
                                                        |
| 343 | + *  | 
                                                        |
| 344 | + * @since 1.0.0  | 
                                                        |
| 345 | + *  | 
                                                        |
| 346 | + * @param int $user_id User ID.  | 
                                                        |
| 347 | + */  | 
                                                        |
| 348 | +	$user_address_info = apply_filters('geodir_manage_user_meta', array(
 | 
                                                        |
| 349 | + "user_add1" => '',  | 
                                                        |
| 350 | + "user_add2" => '',  | 
                                                        |
| 351 | + "user_city" => '',  | 
                                                        |
| 352 | + "user_state" => '',  | 
                                                        |
| 353 | + "user_country" => '',  | 
                                                        |
| 354 | + "user_postalcode" => '',  | 
                                                        |
| 355 | + "user_phone" => '',  | 
                                                        |
| 356 | + "user_twitter" => '',  | 
                                                        |
| 357 | + "first_name" => $user_fname,  | 
                                                        |
| 358 | + "last_name" => '',  | 
                                                        |
| 359 | + ), $user_id);  | 
                                                        |
| 360 | +	foreach ($user_address_info as $key => $val) {
 | 
                                                        |
| 361 | + update_user_meta($user_id, $key, $val); // User Address Information Here  | 
                                                        |
| 362 | + }  | 
                                                        |
| 363 | + //update_user_meta($user_id, 'user_address_info', ($user_address_info)); // User Address Information Here  | 
                                                        |
| 364 | + $userName = $user_fname;  | 
                                                        |
| 365 | + update_user_meta($user_id, 'first_name', $userName); // User Address Information Here  | 
                                                        |
| 366 | + //update_user_meta($user_id, 'last_name', $_POST['user_lname']); // User Address Information Here  | 
                                                        |
| 367 | +  | 
                                                        |
| 368 | + // Changed by vikas sharma to enable all type of characters in author permalink...  | 
                                                        |
| 369 | + $user_nicename = sanitize_title($userName);  | 
                                                        |
| 370 | +  | 
                                                        |
| 371 | +	$updateUsersql = $wpdb->prepare("update $wpdb->users set user_url=%s, user_nicename=%s, display_name=%s  where ID=%d", array($user_web, $user_nicename, $userName, $user_id));
 | 
                                                        |
| 372 | +  | 
                                                        |
| 373 | + $wpdb->query($updateUsersql);  | 
                                                        |
| 374 | +  | 
                                                        |
| 375 | +	if (!$user_id) {
 | 
                                                        |
| 376 | +		$errors->add('registerfail', sprintf(__('<strong>ERROR</strong>: Couldn’t register you... please contact the <a href="mailto:%s">webmaster</a> !', 'geodirectory'), get_option('admin_email')));
 | 
                                                        |
| 377 | + return $errors;  | 
                                                        |
| 378 | + }  | 
                                                        |
| 379 | + global $upload_folder_path;  | 
                                                        |
| 380 | +  | 
                                                        |
| 381 | +	if ($user_id) {
 | 
                                                        |
| 382 | +  | 
                                                        |
| 383 | + /**  | 
                                                        |
| 384 | + * Called after registering a user and before the registration email is sent.  | 
                                                        |
| 385 | + *  | 
                                                        |
| 386 | + * @since 1.0.0  | 
                                                        |
| 387 | + * @param int $user_id The user ID of the registered user.  | 
                                                        |
| 388 | + */  | 
                                                        |
| 389 | +		do_action('geodir_user_register', $user_id);
 | 
                                                        |
| 390 | + ///////REGISTRATION EMAIL START//////  | 
                                                        |
| 391 | + $fromEmail = geodir_get_site_email_id();  | 
                                                        |
| 392 | + $fromEmailName = get_site_emailName();  | 
                                                        |
| 393 | +		$message = __('<p><b>' . __('Your login Information :', 'geodirectory') . '</b></p>
 | 
                                                        |
| 394 | 394 |  <p>' . __('Username:', 'geodirectory') . ' ' . $user_login . '</p>
 | 
                                                        
| 395 | 395 |  <p>' . __('Password:', 'geodirectory') . ' ' . $user_pass . '</p>');
 | 
                                                        
| 396 | 396 | |
| 397 | - /////////////customer email//////////////  | 
                                                        |
| 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  | 
                                                        |
| 400 | - //////REGISTRATION EMAIL END////////  | 
                                                        |
| 401 | - }  | 
                                                        |
| 397 | + /////////////customer email//////////////  | 
                                                        |
| 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  | 
                                                        |
| 400 | + //////REGISTRATION EMAIL END////////  | 
                                                        |
| 401 | + }  | 
                                                        |
| 402 | 402 | |
| 403 | -    if (get_option('ptthemes_auto_login')) {
 | 
                                                        |
| 404 | -        $errors->add('auto_login', __('<strong>SUCCESS</strong>: Thank you for registering, please check your email for your login details.', 'geodirectory'));
 | 
                                                        |
| 405 | - return $errors;  | 
                                                        |
| 406 | - }  | 
                                                        |
| 403 | +	if (get_option('ptthemes_auto_login')) {
 | 
                                                        |
| 404 | +		$errors->add('auto_login', __('<strong>SUCCESS</strong>: Thank you for registering, please check your email for your login details.', 'geodirectory'));
 | 
                                                        |
| 405 | + return $errors;  | 
                                                        |
| 406 | + }  | 
                                                        |
| 407 | 407 | |
| 408 | - return array($user_id, $user_pass);  | 
                                                        |
| 408 | + return array($user_id, $user_pass);  | 
                                                        |
| 409 | 409 | }  | 
                                                        
| 410 | 410 | |
| 411 | 411 | /**  | 
                                                        
@@ -418,331 +418,331 @@ discard block  | 
                                                    ||
| 418 | 418 | */  | 
                                                        
| 419 | 419 | function geodir_user_signup()  | 
                                                        
| 420 | 420 |  {
 | 
                                                        
| 421 | - global $errors;  | 
                                                        |
| 422 | - $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'login';  | 
                                                        |
| 423 | -  | 
                                                        |
| 424 | - $errors = new WP_Error();  | 
                                                        |
| 425 | -  | 
                                                        |
| 426 | - if (isset($_GET['key']))  | 
                                                        |
| 427 | - $action = 'resetpass';  | 
                                                        |
| 428 | -  | 
                                                        |
| 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))
 | 
                                                        |
| 431 | - $action = 'login';  | 
                                                        |
| 432 | -  | 
                                                        |
| 433 | - nocache_headers();  | 
                                                        |
| 434 | -  | 
                                                        |
| 435 | -    if (defined('RELOCATE')) { // Move flag is set
 | 
                                                        |
| 436 | - if (isset($_SERVER['PATH_INFO']) && ($_SERVER['PATH_INFO'] != $_SERVER['PHP_SELF']))  | 
                                                        |
| 437 | - $_SERVER['PHP_SELF'] = str_replace($_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF']);  | 
                                                        |
| 438 | -  | 
                                                        |
| 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']));
 | 
                                                        |
| 442 | - }  | 
                                                        |
| 443 | -  | 
                                                        |
| 444 | - //Set a cookie now to see if they are supported by the browser.  | 
                                                        |
| 445 | - //setcookie(TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN);  | 
                                                        |
| 446 | - if (SITECOOKIEPATH != COOKIEPATH)  | 
                                                        |
| 447 | - setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN);  | 
                                                        |
| 448 | -  | 
                                                        |
| 449 | - /**  | 
                                                        |
| 450 | - * Allow plugins to override the default actions, and to add extra actions if they want on the register/signin page.  | 
                                                        |
| 451 | - *  | 
                                                        |
| 452 | - * Used dynamic hook login_form_$action  | 
                                                        |
| 453 | - *  | 
                                                        |
| 454 | - * @since 1.0.0  | 
                                                        |
| 455 | - */  | 
                                                        |
| 456 | -    do_action('login_form_' . $action);
 | 
                                                        |
| 457 | -  | 
                                                        |
| 458 | -    $http_post = ('POST' == $_SERVER['REQUEST_METHOD']);
 | 
                                                        |
| 459 | -  | 
                                                        |
| 460 | - switch ($action):  | 
                                                        |
| 461 | -  | 
                                                        |
| 462 | - case 'logout' :  | 
                                                        |
| 463 | -            //check_admin_referer('log-out');
 | 
                                                        |
| 464 | - wp_logout();  | 
                                                        |
| 465 | -  | 
                                                        |
| 466 | - $redirect_to = $_SERVER['HTTP_REFERER'];  | 
                                                        |
| 467 | - //$redirect_to = home_url().'/?ptype=login&loggedout=true';  | 
                                                        |
| 468 | - if (isset($_REQUEST['redirect_to']))  | 
                                                        |
| 469 | - $redirect_to = $_REQUEST['redirect_to'];  | 
                                                        |
| 470 | - $redirect_to = home_url();  | 
                                                        |
| 471 | - wp_safe_redirect($redirect_to);  | 
                                                        |
| 472 | - exit();  | 
                                                        |
| 473 | -  | 
                                                        |
| 474 | - break;  | 
                                                        |
| 475 | -  | 
                                                        |
| 476 | - case 'lostpassword' :  | 
                                                        |
| 477 | - case 'retrievepassword' :  | 
                                                        |
| 478 | -            if ($http_post) {
 | 
                                                        |
| 479 | - $errors = geodir_retrieve_password();  | 
                                                        |
| 480 | - $error_message = isset($errors->errors['invalid_email'][0]) ? $errors->errors['invalid_email'][0] : '';  | 
                                                        |
| 481 | -                if (!is_wp_error($errors)) {
 | 
                                                        |
| 482 | -                    wp_redirect(geodir_login_url(array('checkemail'=>'confirm')));
 | 
                                                        |
| 483 | - gd_die();  | 
                                                        |
| 484 | -                } else {
 | 
                                                        |
| 485 | -                    wp_redirect(geodir_login_url(array('forgot' => 1, 'emsg'=>'fw')));
 | 
                                                        |
| 486 | - gd_die();  | 
                                                        |
| 487 | - }  | 
                                                        |
| 488 | - }  | 
                                                        |
| 489 | -            if (isset($_GET['error']) && 'invalidkey' == $_GET['error']) $errors->add('invalidkey', __('Sorry, that key does not appear to be valid.', 'geodirectory'));
 | 
                                                        |
| 490 | - /**  | 
                                                        |
| 491 | - * Called in the geodir_user_signup() function during the lostpassword case.  | 
                                                        |
| 492 | - *  | 
                                                        |
| 493 | - * @since 1.0.0  | 
                                                        |
| 494 | - */  | 
                                                        |
| 495 | -        do_action('lost_password');
 | 
                                                        |
| 496 | - $message = '<div class="sucess_msg">' . ENTER_USER_EMAIL_NEW_PW_MSG . '</div>';  | 
                                                        |
| 497 | - $user_login = isset($_POST['user_login']) ? stripslashes($_POST['user_login']) : '';  | 
                                                        |
| 498 | -  | 
                                                        |
| 499 | - break;  | 
                                                        |
| 500 | -  | 
                                                        |
| 501 | - case 'resetpass' :  | 
                                                        |
| 502 | - case 'rp' :  | 
                                                        |
| 503 | - $errors = reset_password($_GET['key'], $_GET['login']);  | 
                                                        |
| 504 | -  | 
                                                        |
| 505 | -            if (!is_wp_error($errors)) {
 | 
                                                        |
| 506 | -                wp_redirect(geodir_login_url(array('checkemail'=>'newpass')));
 | 
                                                        |
| 507 | - exit();  | 
                                                        |
| 508 | - }  | 
                                                        |
| 509 | -  | 
                                                        |
| 510 | -            wp_redirect(geodir_login_url(array('error'=>'invalidkey','action'=>'lostpassword')));
 | 
                                                        |
| 511 | - exit();  | 
                                                        |
| 512 | -  | 
                                                        |
| 513 | - break;  | 
                                                        |
| 514 | -  | 
                                                        |
| 515 | - case 'register' :  | 
                                                        |
| 516 | - ############################### fix by Stiofan - HebTech.co.uk ### SECURITY FIX ##############################  | 
                                                        |
| 517 | -            if (!get_option('users_can_register')) {
 | 
                                                        |
| 518 | -                wp_redirect(geodir_login_url(array('emsg'=>'regnewusr')));
 | 
                                                        |
| 519 | - exit();  | 
                                                        |
| 520 | - }  | 
                                                        |
| 521 | - ############################### fix by Stiofan - HebTech.co.uk ### SECURITY FIX ##############################  | 
                                                        |
| 522 | - global $user_email, $user_fname;  | 
                                                        |
| 523 | - $user_login = '';  | 
                                                        |
| 524 | - $user_email = '';  | 
                                                        |
| 525 | -            if ($http_post) {
 | 
                                                        |
| 526 | - $user_login = $_POST['user_email'];  | 
                                                        |
| 527 | - $user_email = $_POST['user_email'];  | 
                                                        |
| 528 | - $user_fname = $_POST['user_fname'];  | 
                                                        |
| 529 | -  | 
                                                        |
| 530 | - $errors = geodir_register_new_user($user_login, $user_email);  | 
                                                        |
| 531 | -  | 
                                                        |
| 532 | - /* display error in registration form */  | 
                                                        |
| 533 | -                if (is_wp_error($errors)) {
 | 
                                                        |
| 534 | - $error_code = $errors->get_error_code();  | 
                                                        |
| 535 | - $error_message = $errors->get_error_message($error_code);  | 
                                                        |
| 536 | -                    if (!isset($_POST['user_login']) && ($error_code == 'empty_username' || $error_code == 'invalid_username' || $error_code == 'username_exists')) {
 | 
                                                        |
| 537 | -                        if ($error_code == 'empty_username') {
 | 
                                                        |
| 538 | - $error_code = 'empty_email';  | 
                                                        |
| 539 | -                        } else if ($error_code == 'invalid_username') {
 | 
                                                        |
| 540 | - $error_code = 'invalid_email';  | 
                                                        |
| 541 | -                        } else if ($error_code == 'username_exists') {
 | 
                                                        |
| 542 | - $error_code = 'email_exists';  | 
                                                        |
| 543 | - }  | 
                                                        |
| 544 | -  | 
                                                        |
| 545 | - $error_message = $errors->get_error_message($error_code);  | 
                                                        |
| 546 | - }  | 
                                                        |
| 547 | - global $geodir_signup_error;  | 
                                                        |
| 548 | - $geodir_signup_error = $error_message;  | 
                                                        |
| 549 | - }  | 
                                                        |
| 550 | -  | 
                                                        |
| 551 | -                if (!is_wp_error($errors)) {
 | 
                                                        |
| 552 | - $_POST['log'] = $user_login;  | 
                                                        |
| 553 | - $_POST['pwd'] = $errors[1];  | 
                                                        |
| 554 | - $_POST['testcookie'] = 1;  | 
                                                        |
| 555 | -  | 
                                                        |
| 556 | - $secure_cookie = '';  | 
                                                        |
| 557 | - // If the user wants ssl but the session is not ssl, force a secure cookie.  | 
                                                        |
| 558 | -                    if (!empty($_POST['log'])) {
 | 
                                                        |
| 559 | - $user_name = sanitize_user($_POST['log']);  | 
                                                        |
| 560 | -                        if ($user = get_user_by('email', $user_name)) {
 | 
                                                        |
| 561 | -                            if (get_user_option('use_ssl', $user->ID)) {
 | 
                                                        |
| 562 | - $secure_cookie = true;  | 
                                                        |
| 563 | - force_ssl_admin(true);  | 
                                                        |
| 564 | - }  | 
                                                        |
| 565 | - }  | 
                                                        |
| 566 | - }  | 
                                                        |
| 567 | -  | 
                                                        |
| 568 | - $redirect_to = $_REQUEST['redirect_to'];  | 
                                                        |
| 569 | -  | 
                                                        |
| 570 | -                    if (!isset($_REQUEST['redirect_to']) || $_REQUEST['redirect_to'] == '') {
 | 
                                                        |
| 571 | -                        if (isset($_SERVER['HTTP_REFERER']) && strstr($_SERVER['HTTP_REFERER'], home_url())) {
 | 
                                                        |
| 572 | - $redirect_to = $_SERVER['HTTP_REFERER'];  | 
                                                        |
| 573 | -                        } else {
 | 
                                                        |
| 574 | - $redirect_to = home_url();  | 
                                                        |
| 575 | - }  | 
                                                        |
| 576 | -  | 
                                                        |
| 577 | - }  | 
                                                        |
| 578 | -  | 
                                                        |
| 579 | -                    if (isset($_REQUEST['redirect_add_listing']) && $_REQUEST['redirect_add_listing'] != '') {
 | 
                                                        |
| 580 | -  | 
                                                        |
| 581 | - $redirect_to = $_REQUEST['redirect_add_listing'];  | 
                                                        |
| 582 | - }  | 
                                                        |
| 583 | -  | 
                                                        |
| 584 | -  | 
                                                        |
| 585 | - if (!$secure_cookie && is_ssl() && force_ssl_admin() && !force_ssl_admin() && (0 !== strpos($redirect_to, 'https')) && (0 === strpos($redirect_to, 'http')))  | 
                                                        |
| 586 | - $secure_cookie = false;  | 
                                                        |
| 587 | -  | 
                                                        |
| 588 | -                    $user = wp_signon('', $secure_cookie);
 | 
                                                        |
| 589 | -  | 
                                                        |
| 590 | - $requested_redirect_to = isset($_REQUEST['redirect_add_listing']) && $_REQUEST['redirect_add_listing'] != '' ? $_REQUEST['redirect_add_listing'] : (isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '');  | 
                                                        |
| 591 | - /**  | 
                                                        |
| 592 | - * Filter the login redirect URL.  | 
                                                        |
| 593 | - *  | 
                                                        |
| 594 | - * @since 1.4.9  | 
                                                        |
| 595 | - * @param string $redirect_to The redirect destination URL.  | 
                                                        |
| 596 | - * @param string $requested_redirect_to The requested redirect destination URL passed as a parameter.  | 
                                                        |
| 597 | - * @param WP_User|WP_Error $user WP_User object if login was successful, WP_Error object otherwise.  | 
                                                        |
| 598 | - */  | 
                                                        |
| 599 | -                    $redirect_to = apply_filters('login_redirect', $redirect_to, $requested_redirect_to, $user);
 | 
                                                        |
| 600 | -  | 
                                                        |
| 601 | -  | 
                                                        |
| 602 | -                    if (!is_wp_error($user)) {
 | 
                                                        |
| 603 | - wp_safe_redirect($redirect_to);  | 
                                                        |
| 604 | - exit();  | 
                                                        |
| 605 | - }  | 
                                                        |
| 606 | - exit();  | 
                                                        |
| 607 | - }  | 
                                                        |
| 608 | - }  | 
                                                        |
| 609 | -  | 
                                                        |
| 610 | - break;  | 
                                                        |
| 611 | -  | 
                                                        |
| 612 | - case 'login' :  | 
                                                        |
| 613 | - default:  | 
                                                        |
| 614 | - $secure_cookie = '';  | 
                                                        |
| 615 | -  | 
                                                        |
| 616 | -            if (!empty($_POST['log'])) {
 | 
                                                        |
| 617 | - $user_name = sanitize_user($_POST['log']);  | 
                                                        |
| 618 | -                if ($user = get_user_by('login', $user_name)) {
 | 
                                                        |
| 619 | -  | 
                                                        |
| 620 | -                    if (get_user_option('use_ssl', $user->ID)) {
 | 
                                                        |
| 621 | - $secure_cookie = true;  | 
                                                        |
| 622 | - force_ssl_admin(true);  | 
                                                        |
| 623 | - }  | 
                                                        |
| 624 | -                } elseif ($user = get_user_by('email', $user_name)) {
 | 
                                                        |
| 625 | - $_POST['log'] = $user->user_login; // If signing in by email, set the username for normal WP login  | 
                                                        |
| 626 | -                    if (get_user_option('use_ssl', $user->ID)) {
 | 
                                                        |
| 627 | - $secure_cookie = true;  | 
                                                        |
| 628 | - force_ssl_admin(true);  | 
                                                        |
| 629 | - }  | 
                                                        |
| 630 | - }  | 
                                                        |
| 631 | - }  | 
                                                        |
| 632 | - ///////////////////////////  | 
                                                        |
| 633 | -            if (isset($_REQUEST['redirect_add_listing'])) {
 | 
                                                        |
| 634 | - $_REQUEST['redirect_to'] = $_REQUEST['redirect_add_listing'];  | 
                                                        |
| 635 | - }  | 
                                                        |
| 636 | -  | 
                                                        |
| 637 | -  | 
                                                        |
| 638 | -            if (!isset($_REQUEST['redirect_to']) || $_REQUEST['redirect_to'] == '') {
 | 
                                                        |
| 639 | - if (is_user_logged_in()) :  | 
                                                        |
| 640 | - $user_ID = !empty($user->ID) ? $user->ID : get_current_user_id();  | 
                                                        |
| 641 | - $post_types = geodir_get_posttypes();  | 
                                                        |
| 421 | + global $errors;  | 
                                                        |
| 422 | + $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'login';  | 
                                                        |
| 423 | +  | 
                                                        |
| 424 | + $errors = new WP_Error();  | 
                                                        |
| 425 | +  | 
                                                        |
| 426 | + if (isset($_GET['key']))  | 
                                                        |
| 427 | + $action = 'resetpass';  | 
                                                        |
| 428 | +  | 
                                                        |
| 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))
 | 
                                                        |
| 431 | + $action = 'login';  | 
                                                        |
| 432 | +  | 
                                                        |
| 433 | + nocache_headers();  | 
                                                        |
| 434 | +  | 
                                                        |
| 435 | +	if (defined('RELOCATE')) { // Move flag is set
 | 
                                                        |
| 436 | + if (isset($_SERVER['PATH_INFO']) && ($_SERVER['PATH_INFO'] != $_SERVER['PHP_SELF']))  | 
                                                        |
| 437 | + $_SERVER['PHP_SELF'] = str_replace($_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF']);  | 
                                                        |
| 438 | +  | 
                                                        |
| 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']));
 | 
                                                        |
| 442 | + }  | 
                                                        |
| 443 | +  | 
                                                        |
| 444 | + //Set a cookie now to see if they are supported by the browser.  | 
                                                        |
| 445 | + //setcookie(TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN);  | 
                                                        |
| 446 | + if (SITECOOKIEPATH != COOKIEPATH)  | 
                                                        |
| 447 | + setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN);  | 
                                                        |
| 448 | +  | 
                                                        |
| 449 | + /**  | 
                                                        |
| 450 | + * Allow plugins to override the default actions, and to add extra actions if they want on the register/signin page.  | 
                                                        |
| 451 | + *  | 
                                                        |
| 452 | + * Used dynamic hook login_form_$action  | 
                                                        |
| 453 | + *  | 
                                                        |
| 454 | + * @since 1.0.0  | 
                                                        |
| 455 | + */  | 
                                                        |
| 456 | +	do_action('login_form_' . $action);
 | 
                                                        |
| 457 | +  | 
                                                        |
| 458 | +	$http_post = ('POST' == $_SERVER['REQUEST_METHOD']);
 | 
                                                        |
| 459 | +  | 
                                                        |
| 460 | + switch ($action):  | 
                                                        |
| 461 | +  | 
                                                        |
| 462 | + case 'logout' :  | 
                                                        |
| 463 | +			//check_admin_referer('log-out');
 | 
                                                        |
| 464 | + wp_logout();  | 
                                                        |
| 465 | +  | 
                                                        |
| 466 | + $redirect_to = $_SERVER['HTTP_REFERER'];  | 
                                                        |
| 467 | + //$redirect_to = home_url().'/?ptype=login&loggedout=true';  | 
                                                        |
| 468 | + if (isset($_REQUEST['redirect_to']))  | 
                                                        |
| 469 | + $redirect_to = $_REQUEST['redirect_to'];  | 
                                                        |
| 470 | + $redirect_to = home_url();  | 
                                                        |
| 471 | + wp_safe_redirect($redirect_to);  | 
                                                        |
| 472 | + exit();  | 
                                                        |
| 473 | +  | 
                                                        |
| 474 | + break;  | 
                                                        |
| 475 | +  | 
                                                        |
| 476 | + case 'lostpassword' :  | 
                                                        |
| 477 | + case 'retrievepassword' :  | 
                                                        |
| 478 | +			if ($http_post) {
 | 
                                                        |
| 479 | + $errors = geodir_retrieve_password();  | 
                                                        |
| 480 | + $error_message = isset($errors->errors['invalid_email'][0]) ? $errors->errors['invalid_email'][0] : '';  | 
                                                        |
| 481 | +				if (!is_wp_error($errors)) {
 | 
                                                        |
| 482 | +					wp_redirect(geodir_login_url(array('checkemail'=>'confirm')));
 | 
                                                        |
| 483 | + gd_die();  | 
                                                        |
| 484 | +				} else {
 | 
                                                        |
| 485 | +					wp_redirect(geodir_login_url(array('forgot' => 1, 'emsg'=>'fw')));
 | 
                                                        |
| 486 | + gd_die();  | 
                                                        |
| 487 | + }  | 
                                                        |
| 488 | + }  | 
                                                        |
| 489 | +			if (isset($_GET['error']) && 'invalidkey' == $_GET['error']) $errors->add('invalidkey', __('Sorry, that key does not appear to be valid.', 'geodirectory'));
 | 
                                                        |
| 490 | + /**  | 
                                                        |
| 491 | + * Called in the geodir_user_signup() function during the lostpassword case.  | 
                                                        |
| 492 | + *  | 
                                                        |
| 493 | + * @since 1.0.0  | 
                                                        |
| 494 | + */  | 
                                                        |
| 495 | +		do_action('lost_password');
 | 
                                                        |
| 496 | + $message = '<div class="sucess_msg">' . ENTER_USER_EMAIL_NEW_PW_MSG . '</div>';  | 
                                                        |
| 497 | + $user_login = isset($_POST['user_login']) ? stripslashes($_POST['user_login']) : '';  | 
                                                        |
| 498 | +  | 
                                                        |
| 499 | + break;  | 
                                                        |
| 500 | +  | 
                                                        |
| 501 | + case 'resetpass' :  | 
                                                        |
| 502 | + case 'rp' :  | 
                                                        |
| 503 | + $errors = reset_password($_GET['key'], $_GET['login']);  | 
                                                        |
| 504 | +  | 
                                                        |
| 505 | +			if (!is_wp_error($errors)) {
 | 
                                                        |
| 506 | +				wp_redirect(geodir_login_url(array('checkemail'=>'newpass')));
 | 
                                                        |
| 507 | + exit();  | 
                                                        |
| 508 | + }  | 
                                                        |
| 509 | +  | 
                                                        |
| 510 | +			wp_redirect(geodir_login_url(array('error'=>'invalidkey','action'=>'lostpassword')));
 | 
                                                        |
| 511 | + exit();  | 
                                                        |
| 512 | +  | 
                                                        |
| 513 | + break;  | 
                                                        |
| 514 | +  | 
                                                        |
| 515 | + case 'register' :  | 
                                                        |
| 516 | + ############################### fix by Stiofan - HebTech.co.uk ### SECURITY FIX ##############################  | 
                                                        |
| 517 | +			if (!get_option('users_can_register')) {
 | 
                                                        |
| 518 | +				wp_redirect(geodir_login_url(array('emsg'=>'regnewusr')));
 | 
                                                        |
| 519 | + exit();  | 
                                                        |
| 520 | + }  | 
                                                        |
| 521 | + ############################### fix by Stiofan - HebTech.co.uk ### SECURITY FIX ##############################  | 
                                                        |
| 522 | + global $user_email, $user_fname;  | 
                                                        |
| 523 | + $user_login = '';  | 
                                                        |
| 524 | + $user_email = '';  | 
                                                        |
| 525 | +			if ($http_post) {
 | 
                                                        |
| 526 | + $user_login = $_POST['user_email'];  | 
                                                        |
| 527 | + $user_email = $_POST['user_email'];  | 
                                                        |
| 528 | + $user_fname = $_POST['user_fname'];  | 
                                                        |
| 529 | +  | 
                                                        |
| 530 | + $errors = geodir_register_new_user($user_login, $user_email);  | 
                                                        |
| 531 | +  | 
                                                        |
| 532 | + /* display error in registration form */  | 
                                                        |
| 533 | +				if (is_wp_error($errors)) {
 | 
                                                        |
| 534 | + $error_code = $errors->get_error_code();  | 
                                                        |
| 535 | + $error_message = $errors->get_error_message($error_code);  | 
                                                        |
| 536 | +					if (!isset($_POST['user_login']) && ($error_code == 'empty_username' || $error_code == 'invalid_username' || $error_code == 'username_exists')) {
 | 
                                                        |
| 537 | +						if ($error_code == 'empty_username') {
 | 
                                                        |
| 538 | + $error_code = 'empty_email';  | 
                                                        |
| 539 | +						} else if ($error_code == 'invalid_username') {
 | 
                                                        |
| 540 | + $error_code = 'invalid_email';  | 
                                                        |
| 541 | +						} else if ($error_code == 'username_exists') {
 | 
                                                        |
| 542 | + $error_code = 'email_exists';  | 
                                                        |
| 543 | + }  | 
                                                        |
| 544 | +  | 
                                                        |
| 545 | + $error_message = $errors->get_error_message($error_code);  | 
                                                        |
| 546 | + }  | 
                                                        |
| 547 | + global $geodir_signup_error;  | 
                                                        |
| 548 | + $geodir_signup_error = $error_message;  | 
                                                        |
| 549 | + }  | 
                                                        |
| 550 | +  | 
                                                        |
| 551 | +				if (!is_wp_error($errors)) {
 | 
                                                        |
| 552 | + $_POST['log'] = $user_login;  | 
                                                        |
| 553 | + $_POST['pwd'] = $errors[1];  | 
                                                        |
| 554 | + $_POST['testcookie'] = 1;  | 
                                                        |
| 555 | +  | 
                                                        |
| 556 | + $secure_cookie = '';  | 
                                                        |
| 557 | + // If the user wants ssl but the session is not ssl, force a secure cookie.  | 
                                                        |
| 558 | +					if (!empty($_POST['log'])) {
 | 
                                                        |
| 559 | + $user_name = sanitize_user($_POST['log']);  | 
                                                        |
| 560 | +						if ($user = get_user_by('email', $user_name)) {
 | 
                                                        |
| 561 | +							if (get_user_option('use_ssl', $user->ID)) {
 | 
                                                        |
| 562 | + $secure_cookie = true;  | 
                                                        |
| 563 | + force_ssl_admin(true);  | 
                                                        |
| 564 | + }  | 
                                                        |
| 565 | + }  | 
                                                        |
| 566 | + }  | 
                                                        |
| 567 | +  | 
                                                        |
| 568 | + $redirect_to = $_REQUEST['redirect_to'];  | 
                                                        |
| 569 | +  | 
                                                        |
| 570 | +					if (!isset($_REQUEST['redirect_to']) || $_REQUEST['redirect_to'] == '') {
 | 
                                                        |
| 571 | +						if (isset($_SERVER['HTTP_REFERER']) && strstr($_SERVER['HTTP_REFERER'], home_url())) {
 | 
                                                        |
| 572 | + $redirect_to = $_SERVER['HTTP_REFERER'];  | 
                                                        |
| 573 | +						} else {
 | 
                                                        |
| 574 | + $redirect_to = home_url();  | 
                                                        |
| 575 | + }  | 
                                                        |
| 576 | +  | 
                                                        |
| 577 | + }  | 
                                                        |
| 578 | +  | 
                                                        |
| 579 | +					if (isset($_REQUEST['redirect_add_listing']) && $_REQUEST['redirect_add_listing'] != '') {
 | 
                                                        |
| 580 | +  | 
                                                        |
| 581 | + $redirect_to = $_REQUEST['redirect_add_listing'];  | 
                                                        |
| 582 | + }  | 
                                                        |
| 583 | +  | 
                                                        |
| 584 | +  | 
                                                        |
| 585 | + if (!$secure_cookie && is_ssl() && force_ssl_admin() && !force_ssl_admin() && (0 !== strpos($redirect_to, 'https')) && (0 === strpos($redirect_to, 'http')))  | 
                                                        |
| 586 | + $secure_cookie = false;  | 
                                                        |
| 587 | +  | 
                                                        |
| 588 | +					$user = wp_signon('', $secure_cookie);
 | 
                                                        |
| 589 | +  | 
                                                        |
| 590 | + $requested_redirect_to = isset($_REQUEST['redirect_add_listing']) && $_REQUEST['redirect_add_listing'] != '' ? $_REQUEST['redirect_add_listing'] : (isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '');  | 
                                                        |
| 591 | + /**  | 
                                                        |
| 592 | + * Filter the login redirect URL.  | 
                                                        |
| 593 | + *  | 
                                                        |
| 594 | + * @since 1.4.9  | 
                                                        |
| 595 | + * @param string $redirect_to The redirect destination URL.  | 
                                                        |
| 596 | + * @param string $requested_redirect_to The requested redirect destination URL passed as a parameter.  | 
                                                        |
| 597 | + * @param WP_User|WP_Error $user WP_User object if login was successful, WP_Error object otherwise.  | 
                                                        |
| 598 | + */  | 
                                                        |
| 599 | +					$redirect_to = apply_filters('login_redirect', $redirect_to, $requested_redirect_to, $user);
 | 
                                                        |
| 600 | +  | 
                                                        |
| 601 | +  | 
                                                        |
| 602 | +					if (!is_wp_error($user)) {
 | 
                                                        |
| 603 | + wp_safe_redirect($redirect_to);  | 
                                                        |
| 604 | + exit();  | 
                                                        |
| 605 | + }  | 
                                                        |
| 606 | + exit();  | 
                                                        |
| 607 | + }  | 
                                                        |
| 608 | + }  | 
                                                        |
| 609 | +  | 
                                                        |
| 610 | + break;  | 
                                                        |
| 611 | +  | 
                                                        |
| 612 | + case 'login' :  | 
                                                        |
| 613 | + default:  | 
                                                        |
| 614 | + $secure_cookie = '';  | 
                                                        |
| 615 | +  | 
                                                        |
| 616 | +			if (!empty($_POST['log'])) {
 | 
                                                        |
| 617 | + $user_name = sanitize_user($_POST['log']);  | 
                                                        |
| 618 | +				if ($user = get_user_by('login', $user_name)) {
 | 
                                                        |
| 619 | +  | 
                                                        |
| 620 | +					if (get_user_option('use_ssl', $user->ID)) {
 | 
                                                        |
| 621 | + $secure_cookie = true;  | 
                                                        |
| 622 | + force_ssl_admin(true);  | 
                                                        |
| 623 | + }  | 
                                                        |
| 624 | +				} elseif ($user = get_user_by('email', $user_name)) {
 | 
                                                        |
| 625 | + $_POST['log'] = $user->user_login; // If signing in by email, set the username for normal WP login  | 
                                                        |
| 626 | +					if (get_user_option('use_ssl', $user->ID)) {
 | 
                                                        |
| 627 | + $secure_cookie = true;  | 
                                                        |
| 628 | + force_ssl_admin(true);  | 
                                                        |
| 629 | + }  | 
                                                        |
| 630 | + }  | 
                                                        |
| 631 | + }  | 
                                                        |
| 632 | + ///////////////////////////  | 
                                                        |
| 633 | +			if (isset($_REQUEST['redirect_add_listing'])) {
 | 
                                                        |
| 634 | + $_REQUEST['redirect_to'] = $_REQUEST['redirect_add_listing'];  | 
                                                        |
| 635 | + }  | 
                                                        |
| 636 | +  | 
                                                        |
| 637 | +  | 
                                                        |
| 638 | +			if (!isset($_REQUEST['redirect_to']) || $_REQUEST['redirect_to'] == '') {
 | 
                                                        |
| 639 | + if (is_user_logged_in()) :  | 
                                                        |
| 640 | + $user_ID = !empty($user->ID) ? $user->ID : get_current_user_id();  | 
                                                        |
| 641 | + $post_types = geodir_get_posttypes();  | 
                                                        |
| 642 | 642 | |
| 643 | -                    if ( !empty( $_REQUEST['stype'] ) ) {
 | 
                                                        |
| 644 | - $dashboard_post_type = sanitize_text_field($_REQUEST['stype']);  | 
                                                        |
| 645 | -                    } else {
 | 
                                                        |
| 646 | - $user_listings = geodir_user_post_listing_count( $user_ID );  | 
                                                        |
| 647 | -                        if ( !empty( $user_listings ) && $dashboard_post_types = array_keys( $user_listings ) ) {
 | 
                                                        |
| 648 | - $dashboard_post_type = $dashboard_post_types[0];  | 
                                                        |
| 649 | - }  | 
                                                        |
| 650 | - }  | 
                                                        |
| 651 | -                    if ( !( !empty( $dashboard_post_type ) && in_array( $dashboard_post_type, $post_types ) ) ) {
 | 
                                                        |
| 652 | - $dashboard_post_type = $post_types[0];  | 
                                                        |
| 653 | - }  | 
                                                        |
| 643 | +					if ( !empty( $_REQUEST['stype'] ) ) {
 | 
                                                        |
| 644 | + $dashboard_post_type = sanitize_text_field($_REQUEST['stype']);  | 
                                                        |
| 645 | +					} else {
 | 
                                                        |
| 646 | + $user_listings = geodir_user_post_listing_count( $user_ID );  | 
                                                        |
| 647 | +						if ( !empty( $user_listings ) && $dashboard_post_types = array_keys( $user_listings ) ) {
 | 
                                                        |
| 648 | + $dashboard_post_type = $dashboard_post_types[0];  | 
                                                        |
| 649 | + }  | 
                                                        |
| 650 | + }  | 
                                                        |
| 651 | +					if ( !( !empty( $dashboard_post_type ) && in_array( $dashboard_post_type, $post_types ) ) ) {
 | 
                                                        |
| 652 | + $dashboard_post_type = $post_types[0];  | 
                                                        |
| 653 | + }  | 
                                                        |
| 654 | 654 | |
| 655 | - $author_link = get_author_posts_url($user_ID);  | 
                                                        |
| 656 | -                    $default_author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true', 'stype' => $dashboard_post_type), false);
 | 
                                                        |
| 657 | -  | 
                                                        |
| 658 | - /**  | 
                                                        |
| 659 | - * Filter the author link.  | 
                                                        |
| 660 | - *  | 
                                                        |
| 661 | - * @since 1.0.0  | 
                                                        |
| 662 | - *  | 
                                                        |
| 663 | - * @param string $default_author_link Default author link.  | 
                                                        |
| 664 | - * @param int $user_ID The user ID.  | 
                                                        |
| 665 | - */  | 
                                                        |
| 666 | -                    $default_author_link = apply_filters('geodir_dashboard_author_link', $default_author_link, $user_ID);
 | 
                                                        |
| 667 | -  | 
                                                        |
| 668 | - $_REQUEST['redirect_to'] = $default_author_link;  | 
                                                        |
| 669 | - else:  | 
                                                        |
| 670 | - $_REQUEST['redirect_to'] = home_url();  | 
                                                        |
| 671 | - endif;  | 
                                                        |
| 672 | -  | 
                                                        |
| 673 | - }  | 
                                                        |
| 674 | -            if (isset($_REQUEST['redirect_to'])) {
 | 
                                                        |
| 675 | - $redirect_to = $_REQUEST['redirect_to'];  | 
                                                        |
| 676 | - // Redirect to https if user wants ssl  | 
                                                        |
| 677 | - if ($secure_cookie && false !== strpos($redirect_to, 'wp-admin'))  | 
                                                        |
| 678 | -                    $redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
 | 
                                                        |
| 679 | -            } else {
 | 
                                                        |
| 680 | - $redirect_to = admin_url();  | 
                                                        |
| 681 | - }  | 
                                                        |
| 682 | -  | 
                                                        |
| 683 | - if (!$secure_cookie && is_ssl() && force_ssl_admin() && !force_ssl_admin() && (0 !== strpos($redirect_to, 'https')) && (0 === strpos($redirect_to, 'http')))  | 
                                                        |
| 684 | - $secure_cookie = false;  | 
                                                        |
| 685 | -            $user = wp_signon('', $secure_cookie);
 | 
                                                        |
| 686 | -  | 
                                                        |
| 687 | -  | 
                                                        |
| 688 | - /**  | 
                                                        |
| 689 | - * Filter the login redirect URL.  | 
                                                        |
| 690 | - *  | 
                                                        |
| 691 | - * @since 1.4.9  | 
                                                        |
| 692 | - * @param string $redirect_to The redirect destination URL.  | 
                                                        |
| 693 | - * @param WP_User|WP_Error $user WP_User object if login was successful, WP_Error object otherwise.  | 
                                                        |
| 694 | - */  | 
                                                        |
| 695 | -            $redirect_to = apply_filters('login_redirect', $redirect_to, isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '', $user);
 | 
                                                        |
| 696 | -  | 
                                                        |
| 697 | -            if (is_wp_error($user)) {
 | 
                                                        |
| 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');  | 
                                                        |
| 700 | - }  | 
                                                        |
| 701 | - }  | 
                                                        |
| 702 | -            if (!is_wp_error($user)) {
 | 
                                                        |
| 703 | -  | 
                                                        |
| 704 | - // Some servers are not logging the user in properly after wp_signon, se we set the user here.  | 
                                                        |
| 705 | - //wp_set_current_user($user->ID);  | 
                                                        |
| 706 | - //echo '###';exit;  | 
                                                        |
| 707 | -  | 
                                                        |
| 708 | -                if ($redirect_to) {
 | 
                                                        |
| 709 | - wp_redirect($redirect_to);  | 
                                                        |
| 710 | -                } else {
 | 
                                                        |
| 711 | - wp_redirect(home_url());  | 
                                                        |
| 712 | - }  | 
                                                        |
| 713 | - gd_die();  | 
                                                        |
| 714 | - }  | 
                                                        |
| 715 | -  | 
                                                        |
| 716 | - $errors = $user;  | 
                                                        |
| 717 | -  | 
                                                        |
| 718 | - // Clear errors if loggedout is set.  | 
                                                        |
| 719 | - if (!empty($_GET['loggedout']))  | 
                                                        |
| 720 | - $errors = new WP_Error();  | 
                                                        |
| 721 | - // If cookies are disabled we can't log in even with a valid user+pass  | 
                                                        |
| 722 | - if (isset($_POST['testcookie']) && empty($_COOKIE[TEST_COOKIE]))  | 
                                                        |
| 723 | -                $errors->add('test_cookie', __("<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to use WordPress.", 'geodirectory'));
 | 
                                                        |
| 724 | -  | 
                                                        |
| 725 | - // Some parts of this script use the main login form to display a message  | 
                                                        |
| 726 | -            if (isset($_GET['loggedout']) && TRUE == $_GET['loggedout']) {
 | 
                                                        |
| 727 | - $successmsg = '<div class="sucess_msg">' . YOU_ARE_LOGED_OUT_MSG . '</div>';  | 
                                                        |
| 728 | -            } elseif (isset($_GET['registration']) && 'disabled' == $_GET['registration']) {
 | 
                                                        |
| 729 | - $successmsg = USER_REG_NOT_ALLOW_MSG;  | 
                                                        |
| 730 | -            } elseif (isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail']) {
 | 
                                                        |
| 731 | - $successmsg = EMAIL_CONFIRM_LINK_MSG;  | 
                                                        |
| 732 | -            } elseif (isset($_GET['checkemail']) && 'newpass' == $_GET['checkemail']) {
 | 
                                                        |
| 733 | - $successmsg = NEW_PW_EMAIL_MSG;  | 
                                                        |
| 734 | -            } elseif (isset($_GET['checkemail']) && 'registered' == $_GET['checkemail']) {
 | 
                                                        |
| 735 | - $successmsg = REG_COMPLETE_MSG;  | 
                                                        |
| 736 | - }  | 
                                                        |
| 737 | -  | 
                                                        |
| 738 | -            if ((isset($_POST['log']) && $_POST['log'] != '' && $errors) || ((!isset($_POST['log']) || $_POST['log'] == '') && isset($_REQUEST['testcookie']) && $_REQUEST['testcookie'])) {
 | 
                                                        |
| 739 | -                if (isset($_REQUEST['pagetype']) && $_REQUEST['pagetype'] != '') {
 | 
                                                        |
| 740 | - wp_redirect($_REQUEST['pagetype'] . '&emsg=1');  | 
                                                        |
| 741 | -                } else {
 | 
                                                        |
| 742 | -                    wp_redirect(geodir_login_url(array('logemsg'=>'1','redirect_to'=>urlencode($_REQUEST['redirect_to']))));
 | 
                                                        |
| 743 | - }  | 
                                                        |
| 744 | - gd_die();  | 
                                                        |
| 745 | - }  | 
                                                        |
| 746 | - break;  | 
                                                        |
| 747 | - endswitch; // end action switch  | 
                                                        |
| 655 | + $author_link = get_author_posts_url($user_ID);  | 
                                                        |
| 656 | +					$default_author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true', 'stype' => $dashboard_post_type), false);
 | 
                                                        |
| 657 | +  | 
                                                        |
| 658 | + /**  | 
                                                        |
| 659 | + * Filter the author link.  | 
                                                        |
| 660 | + *  | 
                                                        |
| 661 | + * @since 1.0.0  | 
                                                        |
| 662 | + *  | 
                                                        |
| 663 | + * @param string $default_author_link Default author link.  | 
                                                        |
| 664 | + * @param int $user_ID The user ID.  | 
                                                        |
| 665 | + */  | 
                                                        |
| 666 | +					$default_author_link = apply_filters('geodir_dashboard_author_link', $default_author_link, $user_ID);
 | 
                                                        |
| 667 | +  | 
                                                        |
| 668 | + $_REQUEST['redirect_to'] = $default_author_link;  | 
                                                        |
| 669 | + else:  | 
                                                        |
| 670 | + $_REQUEST['redirect_to'] = home_url();  | 
                                                        |
| 671 | + endif;  | 
                                                        |
| 672 | +  | 
                                                        |
| 673 | + }  | 
                                                        |
| 674 | +			if (isset($_REQUEST['redirect_to'])) {
 | 
                                                        |
| 675 | + $redirect_to = $_REQUEST['redirect_to'];  | 
                                                        |
| 676 | + // Redirect to https if user wants ssl  | 
                                                        |
| 677 | + if ($secure_cookie && false !== strpos($redirect_to, 'wp-admin'))  | 
                                                        |
| 678 | +					$redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
 | 
                                                        |
| 679 | +			} else {
 | 
                                                        |
| 680 | + $redirect_to = admin_url();  | 
                                                        |
| 681 | + }  | 
                                                        |
| 682 | +  | 
                                                        |
| 683 | + if (!$secure_cookie && is_ssl() && force_ssl_admin() && !force_ssl_admin() && (0 !== strpos($redirect_to, 'https')) && (0 === strpos($redirect_to, 'http')))  | 
                                                        |
| 684 | + $secure_cookie = false;  | 
                                                        |
| 685 | +			$user = wp_signon('', $secure_cookie);
 | 
                                                        |
| 686 | +  | 
                                                        |
| 687 | +  | 
                                                        |
| 688 | + /**  | 
                                                        |
| 689 | + * Filter the login redirect URL.  | 
                                                        |
| 690 | + *  | 
                                                        |
| 691 | + * @since 1.4.9  | 
                                                        |
| 692 | + * @param string $redirect_to The redirect destination URL.  | 
                                                        |
| 693 | + * @param WP_User|WP_Error $user WP_User object if login was successful, WP_Error object otherwise.  | 
                                                        |
| 694 | + */  | 
                                                        |
| 695 | +			$redirect_to = apply_filters('login_redirect', $redirect_to, isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '', $user);
 | 
                                                        |
| 696 | +  | 
                                                        |
| 697 | +			if (is_wp_error($user)) {
 | 
                                                        |
| 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');  | 
                                                        |
| 700 | + }  | 
                                                        |
| 701 | + }  | 
                                                        |
| 702 | +			if (!is_wp_error($user)) {
 | 
                                                        |
| 703 | +  | 
                                                        |
| 704 | + // Some servers are not logging the user in properly after wp_signon, se we set the user here.  | 
                                                        |
| 705 | + //wp_set_current_user($user->ID);  | 
                                                        |
| 706 | + //echo '###';exit;  | 
                                                        |
| 707 | +  | 
                                                        |
| 708 | +				if ($redirect_to) {
 | 
                                                        |
| 709 | + wp_redirect($redirect_to);  | 
                                                        |
| 710 | +				} else {
 | 
                                                        |
| 711 | + wp_redirect(home_url());  | 
                                                        |
| 712 | + }  | 
                                                        |
| 713 | + gd_die();  | 
                                                        |
| 714 | + }  | 
                                                        |
| 715 | +  | 
                                                        |
| 716 | + $errors = $user;  | 
                                                        |
| 717 | +  | 
                                                        |
| 718 | + // Clear errors if loggedout is set.  | 
                                                        |
| 719 | + if (!empty($_GET['loggedout']))  | 
                                                        |
| 720 | + $errors = new WP_Error();  | 
                                                        |
| 721 | + // If cookies are disabled we can't log in even with a valid user+pass  | 
                                                        |
| 722 | + if (isset($_POST['testcookie']) && empty($_COOKIE[TEST_COOKIE]))  | 
                                                        |
| 723 | +				$errors->add('test_cookie', __("<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to use WordPress.", 'geodirectory'));
 | 
                                                        |
| 724 | +  | 
                                                        |
| 725 | + // Some parts of this script use the main login form to display a message  | 
                                                        |
| 726 | +			if (isset($_GET['loggedout']) && TRUE == $_GET['loggedout']) {
 | 
                                                        |
| 727 | + $successmsg = '<div class="sucess_msg">' . YOU_ARE_LOGED_OUT_MSG . '</div>';  | 
                                                        |
| 728 | +			} elseif (isset($_GET['registration']) && 'disabled' == $_GET['registration']) {
 | 
                                                        |
| 729 | + $successmsg = USER_REG_NOT_ALLOW_MSG;  | 
                                                        |
| 730 | +			} elseif (isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail']) {
 | 
                                                        |
| 731 | + $successmsg = EMAIL_CONFIRM_LINK_MSG;  | 
                                                        |
| 732 | +			} elseif (isset($_GET['checkemail']) && 'newpass' == $_GET['checkemail']) {
 | 
                                                        |
| 733 | + $successmsg = NEW_PW_EMAIL_MSG;  | 
                                                        |
| 734 | +			} elseif (isset($_GET['checkemail']) && 'registered' == $_GET['checkemail']) {
 | 
                                                        |
| 735 | + $successmsg = REG_COMPLETE_MSG;  | 
                                                        |
| 736 | + }  | 
                                                        |
| 737 | +  | 
                                                        |
| 738 | +			if ((isset($_POST['log']) && $_POST['log'] != '' && $errors) || ((!isset($_POST['log']) || $_POST['log'] == '') && isset($_REQUEST['testcookie']) && $_REQUEST['testcookie'])) {
 | 
                                                        |
| 739 | +				if (isset($_REQUEST['pagetype']) && $_REQUEST['pagetype'] != '') {
 | 
                                                        |
| 740 | + wp_redirect($_REQUEST['pagetype'] . '&emsg=1');  | 
                                                        |
| 741 | +				} else {
 | 
                                                        |
| 742 | +					wp_redirect(geodir_login_url(array('logemsg'=>'1','redirect_to'=>urlencode($_REQUEST['redirect_to']))));
 | 
                                                        |
| 743 | + }  | 
                                                        |
| 744 | + gd_die();  | 
                                                        |
| 745 | + }  | 
                                                        |
| 746 | + break;  | 
                                                        |
| 747 | + endswitch; // end action switch  | 
                                                        |
| 748 | 748 | }  | 
                                                        
| 749 | 749 | \ No newline at end of file  | 
                                                        
@@ -22,7 +22,7 @@ discard block  | 
                                                    ||
| 22 | 22 |          if ($redirect) {
 | 
                                                        
| 23 | 23 | ?>  | 
                                                        
| 24 | 24 | <script type="text/javascript">  | 
                                                        
| 25 | - window.location.href = '<?php echo geodir_login_url();?>';  | 
                                                        |
| 25 | + window.location.href = '<?php echo geodir_login_url(); ?>';  | 
                                                        |
| 26 | 26 | </script>  | 
                                                        
| 27 | 27 | <?php  | 
                                                        
| 28 | 28 | } else  | 
                                                        
@@ -47,7 +47,7 @@ discard block  | 
                                                    ||
| 47 | 47 |              wp_redirect(preg_replace('|^http://|', 'https://', $_SERVER['REQUEST_URI']));
 | 
                                                        
| 48 | 48 | exit();  | 
                                                        
| 49 | 49 |          } else {
 | 
                                                        
| 50 | -            wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
 | 
                                                        |
| 50 | +            wp_redirect('https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
 | 
                                                        |
| 51 | 51 | exit();  | 
                                                        
| 52 | 52 | }  | 
                                                        
| 53 | 53 | }  | 
                                                        
@@ -60,7 +60,7 @@ discard block  | 
                                                    ||
| 60 | 60 | * @param string $message Login message.  | 
                                                        
| 61 | 61 | */  | 
                                                        
| 62 | 62 |      $message = apply_filters('login_message', $message);
 | 
                                                        
| 63 | - if (!empty($message)) echo $message . "\n";  | 
                                                        |
| 63 | + if (!empty($message)) echo $message."\n";  | 
                                                        |
| 64 | 64 | |
| 65 | 65 | }  | 
                                                        
| 66 | 66 | |
@@ -208,9 +208,9 @@ discard block  | 
                                                    ||
| 208 | 208 | |
| 209 | 209 | wp_set_password($new_pass, $user->ID);  | 
                                                        
| 210 | 210 | update_user_meta($user->ID, 'default_password_nag', true); //Set up the Password change nag.  | 
                                                        
| 211 | -    $message = '<p><b>' . __('Your login Information :', 'geodirectory') . '</b></p>';
 | 
                                                        |
| 212 | -    $message .= '<p>' . sprintf(__('Username: %s', 'geodirectory'), $user->user_login) . "</p>";
 | 
                                                        |
| 213 | -    $message .= '<p>' . sprintf(__('Password: %s', 'geodirectory'), $new_pass) . "</p>";
 | 
                                                        |
| 211 | +    $message = '<p><b>'.__('Your login Information :', 'geodirectory').'</b></p>';
 | 
                                                        |
| 212 | +    $message .= '<p>'.sprintf(__('Username: %s', 'geodirectory'), $user->user_login)."</p>";
 | 
                                                        |
| 213 | +    $message .= '<p>'.sprintf(__('Password: %s', 'geodirectory'), $new_pass)."</p>";
 | 
                                                        |
| 214 | 214 | //$message .= '<p>You can login to : <a href="'.home_url().'/?ptype=login' . "\">Login</a> or the URL is : ".home_url()."/?ptype=login</p>";  | 
                                                        
| 215 | 215 |      //$message .= '<p>Thank You,<br> '.get_option('blogname').'</p>';
 | 
                                                        
| 216 | 216 | $user_email = $user_data->user_email;  | 
                                                        
@@ -236,7 +236,7 @@ discard block  | 
                                                    ||
| 236 | 236 | */  | 
                                                        
| 237 | 237 |      $message = apply_filters('password_reset_message', $message, $new_pass);
 | 
                                                        
| 238 | 238 | //geodir_sendEmail($fromEmail,$fromEmailName,$user_email,$user_name,$title,$message,$extra='');///forgot password email  | 
                                                        
| 239 | - geodir_sendEmail($fromEmail, $fromEmailName, $user_email, $user_name, $title, $message, $extra = '', 'forgot_password', $post_id = '', $user->ID);///forgot password email  | 
                                                        |
| 239 | + geodir_sendEmail($fromEmail, $fromEmailName, $user_email, $user_name, $title, $message, $extra = '', 'forgot_password', $post_id = '', $user->ID); ///forgot password email  | 
                                                        |
| 240 | 240 | |
| 241 | 241 | return true;  | 
                                                        
| 242 | 242 | }  | 
                                                        
@@ -315,7 +315,7 @@ discard block  | 
                                                    ||
| 315 | 315 | *  | 
                                                        
| 316 | 316 | * @param object $errors Registration error messages.  | 
                                                        
| 317 | 317 | */  | 
                                                        
| 318 | -    $errors = apply_filters('registration_errors', $errors,$user_login,$user_email);
 | 
                                                        |
| 318 | +    $errors = apply_filters('registration_errors', $errors, $user_login, $user_email);
 | 
                                                        |
| 319 | 319 | |
| 320 | 320 | if ($errors->get_error_code())  | 
                                                        
| 321 | 321 | return $errors;  | 
                                                        
@@ -390,13 +390,13 @@ discard block  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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 | }  | 
                                                        
@@ -393,7 +393,7 @@  | 
                                                    ||
| 393 | 393 | * @global object $post The current post object.  | 
                                                        
| 394 | 394 | * @global object $geodirectory Not yet implemented.  | 
                                                        
| 395 | 395 | * @param string $slug The template slug.  | 
                                                        
| 396 | - * @param null $name The template name.  | 
                                                        |
| 396 | + * @param string $name The template name.  | 
                                                        |
| 397 | 397 | */  | 
                                                        
| 398 | 398 | function geodir_get_template_part($slug = '', $name = NULL)  | 
                                                        
| 399 | 399 |  {
 | 
                                                        
@@ -83,14 +83,16 @@ discard block  | 
                                                    ||
| 83 | 83 | $success_page_id = geodir_success_page_id();  | 
                                                        
| 84 | 84 | if ($success_page_id != '' && is_page($success_page_id) && isset($_REQUEST['listing_type'])  | 
                                                        
| 85 | 85 | && in_array($_REQUEST['listing_type'], geodir_get_posttypes())  | 
                                                        
| 86 | - )  | 
                                                        |
| 87 | - $post_type = sanitize_text_field($_REQUEST['listing_type']);  | 
                                                        |
| 86 | +            ) { | 
                                                        |
| 87 | + $post_type = sanitize_text_field($_REQUEST['listing_type']);  | 
                                                        |
| 88 | + }  | 
                                                        |
| 88 | 89 |              return $template = locate_template(array("geodirectory/{$post_type}-success.php", "geodirectory/listing-success.php"));
 | 
                                                        
| 89 | 90 | break;  | 
                                                        
| 90 | 91 | case 'detail':  | 
                                                        
| 91 | 92 | case 'preview':  | 
                                                        
| 92 | - if (in_array(get_post_type(), geodir_get_posttypes()))  | 
                                                        |
| 93 | - $post_type = get_post_type();  | 
                                                        |
| 93 | +            if (in_array(get_post_type(), geodir_get_posttypes())) { | 
                                                        |
| 94 | + $post_type = get_post_type();  | 
                                                        |
| 95 | + }  | 
                                                        |
| 94 | 96 |              return $template = locate_template(array("geodirectory/single-{$post_type}.php", "geodirectory/listing-detail.php"));
 | 
                                                        
| 95 | 97 | break;  | 
                                                        
| 96 | 98 | case 'listing':  | 
                                                        
@@ -196,7 +198,9 @@ discard block  | 
                                                    ||
| 196 | 198 | |
| 197 | 199 |          $template = geodir_locate_template('signup');
 | 
                                                        
| 198 | 200 | |
| 199 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-signup.php';  | 
                                                        |
| 201 | +        if (!$template) { | 
                                                        |
| 202 | + $template = geodir_plugin_path() . '/geodirectory-templates/geodir-signup.php';  | 
                                                        |
| 203 | + }  | 
                                                        |
| 200 | 204 | |
| 201 | 205 | /**  | 
                                                        
| 202 | 206 | * Filter the signup template path.  | 
                                                        
@@ -214,7 +218,9 @@ discard block  | 
                                                    ||
| 214 | 218 | |
| 215 | 219 |              $template = geodir_locate_template('information');
 | 
                                                        
| 216 | 220 | |
| 217 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';  | 
                                                        |
| 221 | +            if (!$template) { | 
                                                        |
| 222 | + $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';  | 
                                                        |
| 223 | + }  | 
                                                        |
| 218 | 224 | /**  | 
                                                        
| 219 | 225 | * Filter the information template path.  | 
                                                        
| 220 | 226 | *  | 
                                                        
@@ -248,7 +254,9 @@ discard block  | 
                                                    ||
| 248 | 254 |              if (!$is_current_user_owner) {
 | 
                                                        
| 249 | 255 |                  $template = geodir_locate_template('information');
 | 
                                                        
| 250 | 256 | |
| 251 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';  | 
                                                        |
| 257 | +                if (!$template) { | 
                                                        |
| 258 | + $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';  | 
                                                        |
| 259 | + }  | 
                                                        |
| 252 | 260 | /**  | 
                                                        
| 253 | 261 | * Filter the information template path.  | 
                                                        
| 254 | 262 | *  | 
                                                        
@@ -270,7 +278,9 @@ discard block  | 
                                                    ||
| 270 | 278 | |
| 271 | 279 |          $template = geodir_locate_template('add-listing');
 | 
                                                        
| 272 | 280 | |
| 273 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/add-listing.php';  | 
                                                        |
| 281 | +        if (!$template) { | 
                                                        |
| 282 | + $template = geodir_plugin_path() . '/geodirectory-templates/add-listing.php';  | 
                                                        |
| 283 | + }  | 
                                                        |
| 274 | 284 | /**  | 
                                                        
| 275 | 285 | * Filter the add listing template path.  | 
                                                        
| 276 | 286 | *  | 
                                                        
@@ -287,7 +297,9 @@ discard block  | 
                                                    ||
| 287 | 297 | |
| 288 | 298 |          $template = geodir_locate_template('preview');
 | 
                                                        
| 289 | 299 | |
| 290 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';  | 
                                                        |
| 300 | +        if (!$template) { | 
                                                        |
| 301 | + $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';  | 
                                                        |
| 302 | + }  | 
                                                        |
| 291 | 303 | /**  | 
                                                        
| 292 | 304 | * Filter the preview template path.  | 
                                                        
| 293 | 305 | *  | 
                                                        
@@ -303,7 +315,9 @@ discard block  | 
                                                    ||
| 303 | 315 | |
| 304 | 316 |          $template = geodir_locate_template('success');
 | 
                                                        
| 305 | 317 | |
| 306 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-success.php';  | 
                                                        |
| 318 | +        if (!$template) { | 
                                                        |
| 319 | + $template = geodir_plugin_path() . '/geodirectory-templates/listing-success.php';  | 
                                                        |
| 320 | + }  | 
                                                        |
| 307 | 321 | /**  | 
                                                        
| 308 | 322 | * Filter the success template path.  | 
                                                        
| 309 | 323 | *  | 
                                                        
@@ -318,7 +332,9 @@ discard block  | 
                                                    ||
| 318 | 332 | |
| 319 | 333 |          $template = geodir_locate_template('detail');
 | 
                                                        
| 320 | 334 | |
| 321 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';  | 
                                                        |
| 335 | +        if (!$template) { | 
                                                        |
| 336 | + $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';  | 
                                                        |
| 337 | + }  | 
                                                        |
| 322 | 338 | /**  | 
                                                        
| 323 | 339 | * Filter the detail template path.  | 
                                                        
| 324 | 340 | *  | 
                                                        
@@ -333,7 +349,9 @@ discard block  | 
                                                    ||
| 333 | 349 | |
| 334 | 350 |          $template = geodir_locate_template('listing');
 | 
                                                        
| 335 | 351 | |
| 336 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-listing.php';  | 
                                                        |
| 352 | +        if (!$template) { | 
                                                        |
| 353 | + $template = geodir_plugin_path() . '/geodirectory-templates/geodir-listing.php';  | 
                                                        |
| 354 | + }  | 
                                                        |
| 337 | 355 | /**  | 
                                                        
| 338 | 356 | * Filter the listing template path.  | 
                                                        
| 339 | 357 | *  | 
                                                        
@@ -348,7 +366,9 @@ discard block  | 
                                                    ||
| 348 | 366 | |
| 349 | 367 |          $template = geodir_locate_template('search');
 | 
                                                        
| 350 | 368 | |
| 351 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-search.php';  | 
                                                        |
| 369 | +        if (!$template) { | 
                                                        |
| 370 | + $template = geodir_plugin_path() . '/geodirectory-templates/geodir-search.php';  | 
                                                        |
| 371 | + }  | 
                                                        |
| 352 | 372 | /**  | 
                                                        
| 353 | 373 | * Filter the search template path.  | 
                                                        
| 354 | 374 | *  | 
                                                        
@@ -363,7 +383,9 @@ discard block  | 
                                                    ||
| 363 | 383 | |
| 364 | 384 |          $template = geodir_locate_template('author');
 | 
                                                        
| 365 | 385 | |
| 366 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-author.php';  | 
                                                        |
| 386 | +        if (!$template) { | 
                                                        |
| 387 | + $template = geodir_plugin_path() . '/geodirectory-templates/geodir-author.php';  | 
                                                        |
| 388 | + }  | 
                                                        |
| 367 | 389 | /**  | 
                                                        
| 368 | 390 | * Filter the author template path.  | 
                                                        
| 369 | 391 | *  | 
                                                        
@@ -384,7 +406,9 @@ discard block  | 
                                                    ||
| 384 | 406 | |
| 385 | 407 |              $template = geodir_locate_template('geodir-home');
 | 
                                                        
| 386 | 408 | |
| 387 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-home.php';  | 
                                                        |
| 409 | +            if (!$template) { | 
                                                        |
| 410 | + $template = geodir_plugin_path() . '/geodirectory-templates/geodir-home.php';  | 
                                                        |
| 411 | + }  | 
                                                        |
| 388 | 412 | /**  | 
                                                        
| 389 | 413 | * Filter the home page template path.  | 
                                                        
| 390 | 414 | *  | 
                                                        
@@ -397,7 +421,9 @@ discard block  | 
                                                    ||
| 397 | 421 | |
| 398 | 422 |              $template = geodir_locate_template('location');
 | 
                                                        
| 399 | 423 | |
| 400 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-location.php';  | 
                                                        |
| 424 | +            if (!$template) { | 
                                                        |
| 425 | + $template = geodir_plugin_path() . '/geodirectory-templates/geodir-location.php';  | 
                                                        |
| 426 | + }  | 
                                                        |
| 401 | 427 | /**  | 
                                                        
| 402 | 428 | * Filter the location template path.  | 
                                                        
| 403 | 429 | *  | 
                                                        
@@ -406,8 +432,9 @@ discard block  | 
                                                    ||
| 406 | 432 | */  | 
                                                        
| 407 | 433 |              return $template = apply_filters('geodir_template_location', $template);
 | 
                                                        
| 408 | 434 | |
| 409 | - } else  | 
                                                        |
| 410 | - return $template;  | 
                                                        |
| 435 | +        } else { | 
                                                        |
| 436 | + return $template;  | 
                                                        |
| 437 | + }  | 
                                                        |
| 411 | 438 | |
| 412 | 439 | }  | 
                                                        
| 413 | 440 | |
@@ -461,8 +488,10 @@ discard block  | 
                                                    ||
| 461 | 488 | * @since 1.0.0  | 
                                                        
| 462 | 489 | */  | 
                                                        
| 463 | 490 | include($template);  | 
                                                        
| 464 | - else:  | 
                                                        |
| 465 | -        locate_template(array("geodirectory/" . $template_name), true, false);
 | 
                                                        |
| 491 | +    else { | 
                                                        |
| 492 | + :  | 
                                                        |
| 493 | +        locate_template(array("geodirectory/" . $template_name), true, false); | 
                                                        |
| 494 | + }  | 
                                                        |
| 466 | 495 | endif;  | 
                                                        
| 467 | 496 | |
| 468 | 497 | }  | 
                                                        
@@ -73,7 +73,7 @@ discard block  | 
                                                    ||
| 73 | 73 |                  if ($is_wpml && !empty($wp->query_vars['page_id'])) {
 | 
                                                        
| 74 | 74 |                      wp_redirect(geodir_getlink(get_permalink($wp->query_vars['page_id']), array('listing_type' => $post_type)));
 | 
                                                        
| 75 | 75 |                  } else {
 | 
                                                        
| 76 | - wp_redirect(trailingslashit(get_site_url()) . $pagename . '/?listing_type=' . $post_type);  | 
                                                        |
| 76 | + wp_redirect(trailingslashit(get_site_url()).$pagename.'/?listing_type='.$post_type);  | 
                                                        |
| 77 | 77 | }  | 
                                                        
| 78 | 78 | gd_die();  | 
                                                        
| 79 | 79 | }  | 
                                                        
@@ -131,14 +131,14 @@ discard block  | 
                                                    ||
| 131 | 131 | case 'listing-listview':  | 
                                                        
| 132 | 132 |              $template = locate_template(array("geodirectory/listing-listview.php"));
 | 
                                                        
| 133 | 133 |              if (!$template) {
 | 
                                                        
| 134 | - $template = geodir_plugin_path() . '/geodirectory-templates/listing-listview.php';  | 
                                                        |
| 134 | + $template = geodir_plugin_path().'/geodirectory-templates/listing-listview.php';  | 
                                                        |
| 135 | 135 | }  | 
                                                        
| 136 | 136 | return $template;  | 
                                                        
| 137 | 137 | break;  | 
                                                        
| 138 | 138 | case 'widget-listing-listview':  | 
                                                        
| 139 | 139 |              $template = locate_template(array("geodirectory/widget-listing-listview.php"));
 | 
                                                        
| 140 | 140 |              if (!$template) {
 | 
                                                        
| 141 | - $template = geodir_plugin_path() . '/geodirectory-templates/widget-listing-listview.php';  | 
                                                        |
| 141 | + $template = geodir_plugin_path().'/geodirectory-templates/widget-listing-listview.php';  | 
                                                        |
| 142 | 142 | }  | 
                                                        
| 143 | 143 | return $template;  | 
                                                        
| 144 | 144 | break;  | 
                                                        
@@ -196,7 +196,7 @@ discard block  | 
                                                    ||
| 196 | 196 | |
| 197 | 197 |          $template = geodir_locate_template('signup');
 | 
                                                        
| 198 | 198 | |
| 199 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-signup.php';  | 
                                                        |
| 199 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-signup.php';  | 
                                                        |
| 200 | 200 | |
| 201 | 201 | /**  | 
                                                        
| 202 | 202 | * Filter the signup template path.  | 
                                                        
@@ -210,11 +210,11 @@ discard block  | 
                                                    ||
| 210 | 210 |      if (geodir_is_page('add-listing') || $geodir_custom_page_list['geodir_add_listing_page']) {
 | 
                                                        
| 211 | 211 |          if (!geodir_is_default_location_set()) {
 | 
                                                        
| 212 | 212 | global $information;  | 
                                                        
| 213 | -            $information = sprintf(__('Please %sclick here%s to set a default location, this will make the plugin work properly.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>');
 | 
                                                        |
| 213 | +            $information = sprintf(__('Please %sclick here%s to set a default location, this will make the plugin work properly.', 'geodirectory'), '<a href=\''.admin_url('admin.php?page=geodirectory&tab=default_location_settings').'\'>', '</a>');
 | 
                                                        |
| 214 | 214 | |
| 215 | 215 |              $template = geodir_locate_template('information');
 | 
                                                        
| 216 | 216 | |
| 217 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';  | 
                                                        |
| 217 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-information.php';  | 
                                                        |
| 218 | 218 | /**  | 
                                                        
| 219 | 219 | * Filter the information template path.  | 
                                                        
| 220 | 220 | *  | 
                                                        
@@ -226,10 +226,10 @@ discard block  | 
                                                    ||
| 226 | 226 | // check if pid exists in the record if yes then check if this post belongs to the user who is logged in.  | 
                                                        
| 227 | 227 |          if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
 | 
                                                        
| 228 | 228 | /// WPML  | 
                                                        
| 229 | -            if (geodir_wpml_is_post_type_translated(get_post_type((int)$_GET['pid'])) && $duplicate_of = wpml_get_master_post_from_duplicate((int)$_GET['pid'])) {
 | 
                                                        |
| 229 | +            if (geodir_wpml_is_post_type_translated(get_post_type((int) $_GET['pid'])) && $duplicate_of = wpml_get_master_post_from_duplicate((int) $_GET['pid'])) {
 | 
                                                        |
| 230 | 230 | global $sitepress;  | 
                                                        
| 231 | 231 | |
| 232 | - $lang_of_duplicate = geodir_get_language_for_element($duplicate_of, 'post_' . get_post_type($duplicate_of));  | 
                                                        |
| 232 | + $lang_of_duplicate = geodir_get_language_for_element($duplicate_of, 'post_'.get_post_type($duplicate_of));  | 
                                                        |
| 233 | 233 | $sitepress->switch_lang($lang_of_duplicate, true);  | 
                                                        
| 234 | 234 | |
| 235 | 235 | $redirect_to = get_permalink(geodir_add_listing_page_id());  | 
                                                        
@@ -248,7 +248,7 @@ discard block  | 
                                                    ||
| 248 | 248 |              if (!$is_current_user_owner) {
 | 
                                                        
| 249 | 249 |                  $template = geodir_locate_template('information');
 | 
                                                        
| 250 | 250 | |
| 251 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';  | 
                                                        |
| 251 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-information.php';  | 
                                                        |
| 252 | 252 | /**  | 
                                                        
| 253 | 253 | * Filter the information template path.  | 
                                                        
| 254 | 254 | *  | 
                                                        
@@ -270,7 +270,7 @@ discard block  | 
                                                    ||
| 270 | 270 | |
| 271 | 271 |          $template = geodir_locate_template('add-listing');
 | 
                                                        
| 272 | 272 | |
| 273 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/add-listing.php';  | 
                                                        |
| 273 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/add-listing.php';  | 
                                                        |
| 274 | 274 | /**  | 
                                                        
| 275 | 275 | * Filter the add listing template path.  | 
                                                        
| 276 | 276 | *  | 
                                                        
@@ -287,7 +287,7 @@ discard block  | 
                                                    ||
| 287 | 287 | |
| 288 | 288 |          $template = geodir_locate_template('preview');
 | 
                                                        
| 289 | 289 | |
| 290 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';  | 
                                                        |
| 290 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/listing-detail.php';  | 
                                                        |
| 291 | 291 | /**  | 
                                                        
| 292 | 292 | * Filter the preview template path.  | 
                                                        
| 293 | 293 | *  | 
                                                        
@@ -303,7 +303,7 @@ discard block  | 
                                                    ||
| 303 | 303 | |
| 304 | 304 |          $template = geodir_locate_template('success');
 | 
                                                        
| 305 | 305 | |
| 306 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-success.php';  | 
                                                        |
| 306 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/listing-success.php';  | 
                                                        |
| 307 | 307 | /**  | 
                                                        
| 308 | 308 | * Filter the success template path.  | 
                                                        
| 309 | 309 | *  | 
                                                        
@@ -318,7 +318,7 @@ discard block  | 
                                                    ||
| 318 | 318 | |
| 319 | 319 |          $template = geodir_locate_template('detail');
 | 
                                                        
| 320 | 320 | |
| 321 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';  | 
                                                        |
| 321 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/listing-detail.php';  | 
                                                        |
| 322 | 322 | /**  | 
                                                        
| 323 | 323 | * Filter the detail template path.  | 
                                                        
| 324 | 324 | *  | 
                                                        
@@ -333,7 +333,7 @@ discard block  | 
                                                    ||
| 333 | 333 | |
| 334 | 334 |          $template = geodir_locate_template('listing');
 | 
                                                        
| 335 | 335 | |
| 336 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-listing.php';  | 
                                                        |
| 336 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-listing.php';  | 
                                                        |
| 337 | 337 | /**  | 
                                                        
| 338 | 338 | * Filter the listing template path.  | 
                                                        
| 339 | 339 | *  | 
                                                        
@@ -348,7 +348,7 @@ discard block  | 
                                                    ||
| 348 | 348 | |
| 349 | 349 |          $template = geodir_locate_template('search');
 | 
                                                        
| 350 | 350 | |
| 351 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-search.php';  | 
                                                        |
| 351 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-search.php';  | 
                                                        |
| 352 | 352 | /**  | 
                                                        
| 353 | 353 | * Filter the search template path.  | 
                                                        
| 354 | 354 | *  | 
                                                        
@@ -363,7 +363,7 @@ discard block  | 
                                                    ||
| 363 | 363 | |
| 364 | 364 |          $template = geodir_locate_template('author');
 | 
                                                        
| 365 | 365 | |
| 366 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-author.php';  | 
                                                        |
| 366 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-author.php';  | 
                                                        |
| 367 | 367 | /**  | 
                                                        
| 368 | 368 | * Filter the author template path.  | 
                                                        
| 369 | 369 | *  | 
                                                        
@@ -374,7 +374,7 @@ discard block  | 
                                                    ||
| 374 | 374 | |
| 375 | 375 | }  | 
                                                        
| 376 | 376 | |
| 377 | -    if ( geodir_is_page('home') || geodir_is_page('location')) {
 | 
                                                        |
| 377 | +    if (geodir_is_page('home') || geodir_is_page('location')) {
 | 
                                                        |
| 378 | 378 | |
| 379 | 379 | global $post, $wp_query;  | 
                                                        
| 380 | 380 | |
@@ -384,7 +384,7 @@ discard block  | 
                                                    ||
| 384 | 384 | |
| 385 | 385 |              $template = geodir_locate_template('geodir-home');
 | 
                                                        
| 386 | 386 | |
| 387 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-home.php';  | 
                                                        |
| 387 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-home.php';  | 
                                                        |
| 388 | 388 | /**  | 
                                                        
| 389 | 389 | * Filter the home page template path.  | 
                                                        
| 390 | 390 | *  | 
                                                        
@@ -397,7 +397,7 @@ discard block  | 
                                                    ||
| 397 | 397 | |
| 398 | 398 |              $template = geodir_locate_template('location');
 | 
                                                        
| 399 | 399 | |
| 400 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-location.php';  | 
                                                        |
| 400 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-location.php';  | 
                                                        |
| 401 | 401 | /**  | 
                                                        
| 402 | 402 | * Filter the location template path.  | 
                                                        
| 403 | 403 | *  | 
                                                        
@@ -439,7 +439,7 @@ discard block  | 
                                                    ||
| 439 | 439 | */  | 
                                                        
| 440 | 440 |      do_action("geodir_get_template_part_{$slug}", $slug, $name);
 | 
                                                        
| 441 | 441 | $templates = array();  | 
                                                        
| 442 | - $name = (string)$name;  | 
                                                        |
| 442 | + $name = (string) $name;  | 
                                                        |
| 443 | 443 |      if ('' !== $name) {
 | 
                                                        
| 444 | 444 |          $template_name = "{$slug}-{$name}.php";
 | 
                                                        
| 445 | 445 | |
@@ -447,14 +447,14 @@ discard block  | 
                                                    ||
| 447 | 447 |          $template_name = "{$slug}.php";
 | 
                                                        
| 448 | 448 | }  | 
                                                        
| 449 | 449 | |
| 450 | -    if (!locate_template(array("geodirectory/" . $template_name))) :
 | 
                                                        |
| 450 | +    if (!locate_template(array("geodirectory/".$template_name))) :
 | 
                                                        |
| 451 | 451 | /**  | 
                                                        
| 452 | 452 | * Filter the template part with slug and name.  | 
                                                        
| 453 | 453 | *  | 
                                                        
| 454 | 454 | * @since 1.0.0  | 
                                                        
| 455 | 455 | * @param string $template_name The template name.  | 
                                                        
| 456 | 456 | */  | 
                                                        
| 457 | -        $template = apply_filters("geodir_template_part-{$slug}-{$name}", geodir_plugin_path() . '/geodirectory-templates/' . $template_name);
 | 
                                                        |
| 457 | +        $template = apply_filters("geodir_template_part-{$slug}-{$name}", geodir_plugin_path().'/geodirectory-templates/'.$template_name);
 | 
                                                        |
| 458 | 458 | /**  | 
                                                        
| 459 | 459 | * Includes the template part with slug and name.  | 
                                                        
| 460 | 460 | *  | 
                                                        
@@ -462,7 +462,7 @@ discard block  | 
                                                    ||
| 462 | 462 | */  | 
                                                        
| 463 | 463 | include($template);  | 
                                                        
| 464 | 464 | else:  | 
                                                        
| 465 | -        locate_template(array("geodirectory/" . $template_name), true, false);
 | 
                                                        |
| 465 | +        locate_template(array("geodirectory/".$template_name), true, false);
 | 
                                                        |
| 466 | 466 | endif;  | 
                                                        
| 467 | 467 | |
| 468 | 468 | }  | 
                                                        
@@ -490,9 +490,9 @@ discard block  | 
                                                    ||
| 490 | 490 | $gdp_post_type = $gdp_post_type != '' && !empty($all_postypes) && in_array($gdp_post_type, $all_postypes) ? $gdp_post_type : NULL;  | 
                                                        
| 491 | 491 | |
| 492 | 492 |      if ($gdp_post_id && $gdp_post_type) {
 | 
                                                        
| 493 | - $append_class = 'gd-post-' . $gdp_post_type;  | 
                                                        |
| 493 | + $append_class = 'gd-post-'.$gdp_post_type;  | 
                                                        |
| 494 | 494 | $append_class .= isset($post->is_featured) && $post->is_featured > 0 ? ' gd-post-featured' : '';  | 
                                                        
| 495 | - $class = $class != '' ? $class . ' ' . $append_class : $append_class;  | 
                                                        |
| 495 | + $class = $class != '' ? $class.' '.$append_class : $append_class;  | 
                                                        |
| 496 | 496 | }  | 
                                                        
| 497 | 497 | |
| 498 | 498 | return $class;  | 
                                                        
@@ -524,7 +524,7 @@ discard block  | 
                                                    ||
| 524 | 524 | */  | 
                                                        
| 525 | 525 |  	$message = apply_filters('geodir_message_listing_not_found', $message, $template_listview, $favorite);
 | 
                                                        
| 526 | 526 | |
| 527 | - echo '<li class="no-listing">' . $message . '</li>';  | 
                                                        |
| 527 | + echo '<li class="no-listing">'.$message.'</li>';  | 
                                                        |
| 528 | 528 | }  | 
                                                        
| 529 | 529 | |
| 530 | 530 | /**  | 
                                                        
@@ -553,7 +553,7 @@ discard block  | 
                                                    ||
| 553 | 553 |  function geodir_convert_listing_view_class($columns = '') {
 | 
                                                        
| 554 | 554 | $class = '';  | 
                                                        
| 555 | 555 | |
| 556 | -	switch ((int)$columns) {
 | 
                                                        |
| 556 | +	switch ((int) $columns) {
 | 
                                                        |
| 557 | 557 | case 1:  | 
                                                        
| 558 | 558 | $class = '';  | 
                                                        
| 559 | 559 | break;  | 
                                                        
@@ -618,7 +618,7 @@ discard block  | 
                                                    ||
| 618 | 618 | $html .= '<option value=""></option>';  | 
                                                        
| 619 | 619 |  		if (!empty($star_texts) && is_array($star_texts)) {
 | 
                                                        
| 620 | 620 |  			foreach ($star_texts as $i => $text) {
 | 
                                                        
| 621 | - $html .= '<option ' . selected((int)($i + 1), (int)$default, false) . ' value="' . (int)($i + 1) . '">' . $text . '</option>';  | 
                                                        |
| 621 | + $html .= '<option '.selected((int) ($i + 1), (int) $default, false).' value="'.(int) ($i + 1).'">'.$text.'</option>';  | 
                                                        |
| 622 | 622 | }  | 
                                                        
| 623 | 623 |  		} else {
 | 
                                                        
| 624 | 624 | $html .= '<option value="1">1</option>';  | 
                                                        
@@ -647,14 +647,14 @@ discard block  | 
                                                    ||
| 647 | 647 |  function geodir_font_awesome_rating_stars_html($html, $rating, $star_count = 5) {
 | 
                                                        
| 648 | 648 |  	if (get_option('geodir_reviewrating_enable_font_awesome') == '1') {
 | 
                                                        
| 649 | 649 | $rating = min($rating, $star_count);  | 
                                                        
| 650 | - $full_stars = floor( $rating );  | 
                                                        |
| 651 | - $half_stars = ceil( $rating - $full_stars );  | 
                                                        |
| 650 | + $full_stars = floor($rating);  | 
                                                        |
| 651 | + $half_stars = ceil($rating - $full_stars);  | 
                                                        |
| 652 | 652 | $empty_stars = $star_count - $full_stars - $half_stars;  | 
                                                        
| 653 | 653 | |
| 654 | 654 | $html = '<div class="gd-star-rating gd-fa-star-rating">';  | 
                                                        
| 655 | - $html .= str_repeat( '<i class="fa fa-star gd-full-star"></i>', $full_stars );  | 
                                                        |
| 656 | - $html .= str_repeat( '<i class="fa fa-star-o fa-star-half-full gd-half-star"></i>', $half_stars );  | 
                                                        |
| 657 | - $html .= str_repeat( '<i class="fa fa-star-o gd-empty-star"></i>', $empty_stars);  | 
                                                        |
| 655 | +		$html .= str_repeat('<i class="fa fa-star gd-full-star"></i>', $full_stars);
 | 
                                                        |
| 656 | +		$html .= str_repeat('<i class="fa fa-star-o fa-star-half-full gd-half-star"></i>', $half_stars);
 | 
                                                        |
| 657 | +		$html .= str_repeat('<i class="fa fa-star-o gd-empty-star"></i>', $empty_stars);
 | 
                                                        |
| 658 | 658 | $html .= '</div>';  | 
                                                        
| 659 | 659 | }  | 
                                                        
| 660 | 660 | |
@@ -673,7 +673,7 @@ discard block  | 
                                                    ||
| 673 | 673 |  		$full_color = get_option('geodir_reviewrating_fa_full_rating_color', '#757575');
 | 
                                                        
| 674 | 674 |  		if ($full_color != '#757575') {
 | 
                                                        
| 675 | 675 | echo '<style type="text/css">.br-theme-fontawesome-stars .br-widget a.br-active:after,.br-theme-fontawesome-stars .br-widget a.br-selected:after,  | 
                                                        
| 676 | -			.gd-star-rating i.fa {color:' . stripslashes($full_color) . '!important;}</style>';
 | 
                                                        |
| 676 | +			.gd-star-rating i.fa {color:' . stripslashes($full_color).'!important;}</style>';
 | 
                                                        |
| 677 | 677 | }  | 
                                                        
| 678 | 678 | }  | 
                                                        
| 679 | 679 | }  | 
                                                        
| 680 | 680 | \ No newline at end of file  | 
                                                        
@@ -19,132 +19,132 @@ discard block  | 
                                                    ||
| 19 | 19 | */  | 
                                                        
| 20 | 20 | function geodir_locate_template($template = '')  | 
                                                        
| 21 | 21 |  {
 | 
                                                        
| 22 | - global $post_type, $wp, $post;  | 
                                                        |
| 23 | - $fields = array();  | 
                                                        |
| 24 | -  | 
                                                        |
| 25 | - switch ($template):  | 
                                                        |
| 26 | - case 'signup':  | 
                                                        |
| 27 | -            return $template = locate_template(array("geodirectory/geodir-signup.php"));
 | 
                                                        |
| 28 | - break;  | 
                                                        |
| 29 | - case 'add-listing':  | 
                                                        |
| 30 | - $gd_post_types = geodir_get_posttypes();  | 
                                                        |
| 22 | + global $post_type, $wp, $post;  | 
                                                        |
| 23 | + $fields = array();  | 
                                                        |
| 24 | +  | 
                                                        |
| 25 | + switch ($template):  | 
                                                        |
| 26 | + case 'signup':  | 
                                                        |
| 27 | +			return $template = locate_template(array("geodirectory/geodir-signup.php"));
 | 
                                                        |
| 28 | + break;  | 
                                                        |
| 29 | + case 'add-listing':  | 
                                                        |
| 30 | + $gd_post_types = geodir_get_posttypes();  | 
                                                        |
| 31 | 31 | |
| 32 | -            if (!(!empty($post_type) && in_array($post_type, $gd_post_types))) {
 | 
                                                        |
| 33 | - $post_type = '';  | 
                                                        |
| 34 | - }  | 
                                                        |
| 32 | +			if (!(!empty($post_type) && in_array($post_type, $gd_post_types))) {
 | 
                                                        |
| 33 | + $post_type = '';  | 
                                                        |
| 34 | + }  | 
                                                        |
| 35 | 35 | |
| 36 | - $sc_post_type = '';  | 
                                                        |
| 37 | -            if (is_page() && isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) {
 | 
                                                        |
| 38 | - $listing_page_id = $post->ID;  | 
                                                        |
| 36 | + $sc_post_type = '';  | 
                                                        |
| 37 | +			if (is_page() && isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) {
 | 
                                                        |
| 38 | + $listing_page_id = $post->ID;  | 
                                                        |
| 39 | 39 | |
| 40 | - $regex_pattern = get_shortcode_regex();  | 
                                                        |
| 41 | -                preg_match('/'.$regex_pattern.'/s', $post->post_content, $regex_matches);
 | 
                                                        |
| 40 | + $regex_pattern = get_shortcode_regex();  | 
                                                        |
| 41 | +				preg_match('/'.$regex_pattern.'/s', $post->post_content, $regex_matches);
 | 
                                                        |
| 42 | 42 | |
| 43 | -                if (!empty($regex_matches) && isset($regex_matches[2]) == 'gd_add_listing' && isset($regex_matches[3])) {
 | 
                                                        |
| 44 | - $shortcode_atts = shortcode_parse_atts($regex_matches[3]);  | 
                                                        |
| 45 | - $sc_post_type = !empty($shortcode_atts) && isset($shortcode_atts['listing_type']) && !empty($shortcode_atts['listing_type']) ? $shortcode_atts['listing_type'] : '';  | 
                                                        |
| 46 | - }  | 
                                                        |
| 47 | -            } else {
 | 
                                                        |
| 48 | - $listing_page_id = geodir_add_listing_page_id();  | 
                                                        |
| 49 | - }  | 
                                                        |
| 43 | +				if (!empty($regex_matches) && isset($regex_matches[2]) == 'gd_add_listing' && isset($regex_matches[3])) {
 | 
                                                        |
| 44 | + $shortcode_atts = shortcode_parse_atts($regex_matches[3]);  | 
                                                        |
| 45 | + $sc_post_type = !empty($shortcode_atts) && isset($shortcode_atts['listing_type']) && !empty($shortcode_atts['listing_type']) ? $shortcode_atts['listing_type'] : '';  | 
                                                        |
| 46 | + }  | 
                                                        |
| 47 | +			} else {
 | 
                                                        |
| 48 | + $listing_page_id = geodir_add_listing_page_id();  | 
                                                        |
| 49 | + }  | 
                                                        |
| 50 | 50 | |
| 51 | - $is_wpml = geodir_is_wpml() ? true : false;  | 
                                                        |
| 51 | + $is_wpml = geodir_is_wpml() ? true : false;  | 
                                                        |
| 52 | 52 | |
| 53 | - if ($listing_page_id != '' && (is_page($listing_page_id) || ($is_wpml && !empty($wp->query_vars['page_id']))) && isset($_REQUEST['listing_type'])  | 
                                                        |
| 54 | -                && in_array($_REQUEST['listing_type'], $gd_post_types)) {
 | 
                                                        |
| 55 | - $post_type = sanitize_text_field($_REQUEST['listing_type']);  | 
                                                        |
| 56 | - }  | 
                                                        |
| 53 | + if ($listing_page_id != '' && (is_page($listing_page_id) || ($is_wpml && !empty($wp->query_vars['page_id']))) && isset($_REQUEST['listing_type'])  | 
                                                        |
| 54 | +				&& in_array($_REQUEST['listing_type'], $gd_post_types)) {
 | 
                                                        |
| 55 | + $post_type = sanitize_text_field($_REQUEST['listing_type']);  | 
                                                        |
| 56 | + }  | 
                                                        |
| 57 | 57 | |
| 58 | -            if (empty($post_type) && !isset($_REQUEST['pid'])) {
 | 
                                                        |
| 59 | - $pagename = $wp->query_vars['pagename'];  | 
                                                        |
| 58 | +			if (empty($post_type) && !isset($_REQUEST['pid'])) {
 | 
                                                        |
| 59 | + $pagename = $wp->query_vars['pagename'];  | 
                                                        |
| 60 | 60 | |
| 61 | -                if (!empty($gd_post_types)) {
 | 
                                                        |
| 62 | - $post_type = $gd_post_types[0];  | 
                                                        |
| 63 | - }  | 
                                                        |
| 61 | +				if (!empty($gd_post_types)) {
 | 
                                                        |
| 62 | + $post_type = $gd_post_types[0];  | 
                                                        |
| 63 | + }  | 
                                                        |
| 64 | 64 | |
| 65 | -                if ($sc_post_type != '') {
 | 
                                                        |
| 66 | - $post_type = $sc_post_type;  | 
                                                        |
| 67 | - }  | 
                                                        |
| 65 | +				if ($sc_post_type != '') {
 | 
                                                        |
| 66 | + $post_type = $sc_post_type;  | 
                                                        |
| 67 | + }  | 
                                                        |
| 68 | 68 | |
| 69 | -                if (empty($post_type) && !empty($gd_post_types)) {
 | 
                                                        |
| 70 | - $post_type = $gd_post_types[0];  | 
                                                        |
| 71 | - }  | 
                                                        |
| 69 | +				if (empty($post_type) && !empty($gd_post_types)) {
 | 
                                                        |
| 70 | + $post_type = $gd_post_types[0];  | 
                                                        |
| 71 | + }  | 
                                                        |
| 72 | 72 | |
| 73 | -                if ($is_wpml && !empty($wp->query_vars['page_id'])) {
 | 
                                                        |
| 74 | -                    wp_redirect(geodir_getlink(get_permalink($wp->query_vars['page_id']), array('listing_type' => $post_type)));
 | 
                                                        |
| 75 | -                } else {
 | 
                                                        |
| 76 | - wp_redirect(trailingslashit(get_site_url()) . $pagename . '/?listing_type=' . $post_type);  | 
                                                        |
| 77 | - }  | 
                                                        |
| 78 | - gd_die();  | 
                                                        |
| 79 | - }  | 
                                                        |
| 80 | -            return $template = locate_template(array("geodirectory/add-{$post_type}.php", "geodirectory/add-listing.php"));
 | 
                                                        |
| 81 | - break;  | 
                                                        |
| 82 | - case 'success':  | 
                                                        |
| 83 | - $success_page_id = geodir_success_page_id();  | 
                                                        |
| 84 | - if ($success_page_id != '' && is_page($success_page_id) && isset($_REQUEST['listing_type'])  | 
                                                        |
| 85 | - && in_array($_REQUEST['listing_type'], geodir_get_posttypes())  | 
                                                        |
| 86 | - )  | 
                                                        |
| 87 | - $post_type = sanitize_text_field($_REQUEST['listing_type']);  | 
                                                        |
| 88 | -            return $template = locate_template(array("geodirectory/{$post_type}-success.php", "geodirectory/listing-success.php"));
 | 
                                                        |
| 89 | - break;  | 
                                                        |
| 90 | - case 'detail':  | 
                                                        |
| 91 | - case 'preview':  | 
                                                        |
| 92 | - if (in_array(get_post_type(), geodir_get_posttypes()))  | 
                                                        |
| 93 | - $post_type = get_post_type();  | 
                                                        |
| 94 | -            return $template = locate_template(array("geodirectory/single-{$post_type}.php", "geodirectory/listing-detail.php"));
 | 
                                                        |
| 95 | - break;  | 
                                                        |
| 96 | - case 'listing':  | 
                                                        |
| 97 | - $templates = array();  | 
                                                        |
| 98 | -            if (is_post_type_archive() && in_array(get_post_type(), geodir_get_posttypes())) {
 | 
                                                        |
| 99 | - $post_type = get_post_type();  | 
                                                        |
| 100 | - $templates[] = "geodirectory/archive-$post_type.php";  | 
                                                        |
| 101 | - }  | 
                                                        |
| 102 | -  | 
                                                        |
| 103 | -  | 
                                                        |
| 104 | -            if (is_tax() && geodir_get_taxonomy_posttype()) {
 | 
                                                        |
| 105 | - $query_obj = get_queried_object();  | 
                                                        |
| 106 | - $curr_taxonomy = isset($query_obj->taxonomy) ? $query_obj->taxonomy : '';  | 
                                                        |
| 107 | - $curr_term = isset($query_obj->slug) ? $query_obj->slug : '';  | 
                                                        |
| 108 | - $templates[] = "geodirectory/taxonomy-$curr_taxonomy-$curr_term.php";  | 
                                                        |
| 109 | - $templates[] = "geodirectory/taxonomy-$curr_taxonomy.php";  | 
                                                        |
| 110 | - }  | 
                                                        |
| 111 | -  | 
                                                        |
| 112 | - $templates[] = "geodirectory/geodir-listing.php";  | 
                                                        |
| 113 | -  | 
                                                        |
| 114 | - return $template = locate_template($templates);  | 
                                                        |
| 115 | - break;  | 
                                                        |
| 116 | - case 'information':  | 
                                                        |
| 117 | -            return $template = locate_template(array("geodirectory/geodir-information.php"));
 | 
                                                        |
| 118 | - break;  | 
                                                        |
| 119 | - case 'author':  | 
                                                        |
| 120 | -            return $template = locate_template(array("geodirectory/geodir-author.php"));
 | 
                                                        |
| 121 | - break;  | 
                                                        |
| 122 | - case 'search':  | 
                                                        |
| 123 | -            return $template = locate_template(array("geodirectory/geodir-search.php"));
 | 
                                                        |
| 124 | - break;  | 
                                                        |
| 125 | - case 'location':  | 
                                                        |
| 126 | -            return $template = locate_template(array("geodirectory/geodir-location.php"));
 | 
                                                        |
| 127 | - break;  | 
                                                        |
| 128 | - case 'geodir-home':  | 
                                                        |
| 129 | -            return $template = locate_template(array("geodirectory/geodir-home.php"));
 | 
                                                        |
| 130 | - break;  | 
                                                        |
| 131 | - case 'listing-listview':  | 
                                                        |
| 132 | -            $template = locate_template(array("geodirectory/listing-listview.php"));
 | 
                                                        |
| 133 | -            if (!$template) {
 | 
                                                        |
| 134 | - $template = geodir_plugin_path() . '/geodirectory-templates/listing-listview.php';  | 
                                                        |
| 135 | - }  | 
                                                        |
| 136 | - return $template;  | 
                                                        |
| 137 | - break;  | 
                                                        |
| 138 | - case 'widget-listing-listview':  | 
                                                        |
| 139 | -            $template = locate_template(array("geodirectory/widget-listing-listview.php"));
 | 
                                                        |
| 140 | -            if (!$template) {
 | 
                                                        |
| 141 | - $template = geodir_plugin_path() . '/geodirectory-templates/widget-listing-listview.php';  | 
                                                        |
| 142 | - }  | 
                                                        |
| 143 | - return $template;  | 
                                                        |
| 144 | - break;  | 
                                                        |
| 145 | - endswitch;  | 
                                                        |
| 146 | -  | 
                                                        |
| 147 | - return false;  | 
                                                        |
| 73 | +				if ($is_wpml && !empty($wp->query_vars['page_id'])) {
 | 
                                                        |
| 74 | +					wp_redirect(geodir_getlink(get_permalink($wp->query_vars['page_id']), array('listing_type' => $post_type)));
 | 
                                                        |
| 75 | +				} else {
 | 
                                                        |
| 76 | + wp_redirect(trailingslashit(get_site_url()) . $pagename . '/?listing_type=' . $post_type);  | 
                                                        |
| 77 | + }  | 
                                                        |
| 78 | + gd_die();  | 
                                                        |
| 79 | + }  | 
                                                        |
| 80 | +			return $template = locate_template(array("geodirectory/add-{$post_type}.php", "geodirectory/add-listing.php"));
 | 
                                                        |
| 81 | + break;  | 
                                                        |
| 82 | + case 'success':  | 
                                                        |
| 83 | + $success_page_id = geodir_success_page_id();  | 
                                                        |
| 84 | + if ($success_page_id != '' && is_page($success_page_id) && isset($_REQUEST['listing_type'])  | 
                                                        |
| 85 | + && in_array($_REQUEST['listing_type'], geodir_get_posttypes())  | 
                                                        |
| 86 | + )  | 
                                                        |
| 87 | + $post_type = sanitize_text_field($_REQUEST['listing_type']);  | 
                                                        |
| 88 | +			return $template = locate_template(array("geodirectory/{$post_type}-success.php", "geodirectory/listing-success.php"));
 | 
                                                        |
| 89 | + break;  | 
                                                        |
| 90 | + case 'detail':  | 
                                                        |
| 91 | + case 'preview':  | 
                                                        |
| 92 | + if (in_array(get_post_type(), geodir_get_posttypes()))  | 
                                                        |
| 93 | + $post_type = get_post_type();  | 
                                                        |
| 94 | +			return $template = locate_template(array("geodirectory/single-{$post_type}.php", "geodirectory/listing-detail.php"));
 | 
                                                        |
| 95 | + break;  | 
                                                        |
| 96 | + case 'listing':  | 
                                                        |
| 97 | + $templates = array();  | 
                                                        |
| 98 | +			if (is_post_type_archive() && in_array(get_post_type(), geodir_get_posttypes())) {
 | 
                                                        |
| 99 | + $post_type = get_post_type();  | 
                                                        |
| 100 | + $templates[] = "geodirectory/archive-$post_type.php";  | 
                                                        |
| 101 | + }  | 
                                                        |
| 102 | +  | 
                                                        |
| 103 | +  | 
                                                        |
| 104 | +			if (is_tax() && geodir_get_taxonomy_posttype()) {
 | 
                                                        |
| 105 | + $query_obj = get_queried_object();  | 
                                                        |
| 106 | + $curr_taxonomy = isset($query_obj->taxonomy) ? $query_obj->taxonomy : '';  | 
                                                        |
| 107 | + $curr_term = isset($query_obj->slug) ? $query_obj->slug : '';  | 
                                                        |
| 108 | + $templates[] = "geodirectory/taxonomy-$curr_taxonomy-$curr_term.php";  | 
                                                        |
| 109 | + $templates[] = "geodirectory/taxonomy-$curr_taxonomy.php";  | 
                                                        |
| 110 | + }  | 
                                                        |
| 111 | +  | 
                                                        |
| 112 | + $templates[] = "geodirectory/geodir-listing.php";  | 
                                                        |
| 113 | +  | 
                                                        |
| 114 | + return $template = locate_template($templates);  | 
                                                        |
| 115 | + break;  | 
                                                        |
| 116 | + case 'information':  | 
                                                        |
| 117 | +			return $template = locate_template(array("geodirectory/geodir-information.php"));
 | 
                                                        |
| 118 | + break;  | 
                                                        |
| 119 | + case 'author':  | 
                                                        |
| 120 | +			return $template = locate_template(array("geodirectory/geodir-author.php"));
 | 
                                                        |
| 121 | + break;  | 
                                                        |
| 122 | + case 'search':  | 
                                                        |
| 123 | +			return $template = locate_template(array("geodirectory/geodir-search.php"));
 | 
                                                        |
| 124 | + break;  | 
                                                        |
| 125 | + case 'location':  | 
                                                        |
| 126 | +			return $template = locate_template(array("geodirectory/geodir-location.php"));
 | 
                                                        |
| 127 | + break;  | 
                                                        |
| 128 | + case 'geodir-home':  | 
                                                        |
| 129 | +			return $template = locate_template(array("geodirectory/geodir-home.php"));
 | 
                                                        |
| 130 | + break;  | 
                                                        |
| 131 | + case 'listing-listview':  | 
                                                        |
| 132 | +			$template = locate_template(array("geodirectory/listing-listview.php"));
 | 
                                                        |
| 133 | +			if (!$template) {
 | 
                                                        |
| 134 | + $template = geodir_plugin_path() . '/geodirectory-templates/listing-listview.php';  | 
                                                        |
| 135 | + }  | 
                                                        |
| 136 | + return $template;  | 
                                                        |
| 137 | + break;  | 
                                                        |
| 138 | + case 'widget-listing-listview':  | 
                                                        |
| 139 | +			$template = locate_template(array("geodirectory/widget-listing-listview.php"));
 | 
                                                        |
| 140 | +			if (!$template) {
 | 
                                                        |
| 141 | + $template = geodir_plugin_path() . '/geodirectory-templates/widget-listing-listview.php';  | 
                                                        |
| 142 | + }  | 
                                                        |
| 143 | + return $template;  | 
                                                        |
| 144 | + break;  | 
                                                        |
| 145 | + endswitch;  | 
                                                        |
| 146 | +  | 
                                                        |
| 147 | + return false;  | 
                                                        |
| 148 | 148 | |
| 149 | 149 | }  | 
                                                        
| 150 | 150 | |
@@ -163,255 +163,255 @@ discard block  | 
                                                    ||
| 163 | 163 | function geodir_template_loader($template)  | 
                                                        
| 164 | 164 |  {
 | 
                                                        
| 165 | 165 | |
| 166 | - global $wp_query;  | 
                                                        |
| 167 | -  | 
                                                        |
| 168 | - /**  | 
                                                        |
| 169 | - * Filter the custom page list.  | 
                                                        |
| 170 | - *  | 
                                                        |
| 171 | - * @since 1.0.0  | 
                                                        |
| 172 | - */  | 
                                                        |
| 173 | -    $geodir_custom_page_list = apply_filters('geodir_set_custom_pages', array(
 | 
                                                        |
| 174 | - 'geodir_signup_page' =>  | 
                                                        |
| 175 | -            apply_filters('geodir_set_custom_signup_page', false),
 | 
                                                        |
| 176 | - 'geodir_add_listing_page' =>  | 
                                                        |
| 177 | -            apply_filters('geodir_set_custom_add_listing_page', false),
 | 
                                                        |
| 178 | - 'geodir_preview_page' =>  | 
                                                        |
| 179 | -            apply_filters('geodir_set_custom_preview_page', false),
 | 
                                                        |
| 180 | - 'geodir_listing_success_page' =>  | 
                                                        |
| 181 | -            apply_filters('geodir_set_custom_listing_success_page', false),
 | 
                                                        |
| 182 | - 'geodir_listing_detail_page' =>  | 
                                                        |
| 183 | -            apply_filters('geodir_set_custom_listing_detail_page', false),
 | 
                                                        |
| 184 | - 'geodir_listing_page' =>  | 
                                                        |
| 185 | -            apply_filters('geodir_set_custom_listing_page', false),
 | 
                                                        |
| 186 | - 'geodir_search_page' =>  | 
                                                        |
| 187 | -            apply_filters('geodir_set_custom_search_page', false),
 | 
                                                        |
| 188 | - 'geodir_author_page' =>  | 
                                                        |
| 189 | -            apply_filters('geodir_set_custom_author_page', false),
 | 
                                                        |
| 190 | - 'geodir_home_map_page' =>  | 
                                                        |
| 191 | -            apply_filters('geodir_set_custom_home_map_page', false)
 | 
                                                        |
| 192 | - ));  | 
                                                        |
| 193 | -  | 
                                                        |
| 194 | -  | 
                                                        |
| 195 | -    if (geodir_is_page('login') || $geodir_custom_page_list['geodir_signup_page']) {
 | 
                                                        |
| 196 | -  | 
                                                        |
| 197 | -        $template = geodir_locate_template('signup');
 | 
                                                        |
| 198 | -  | 
                                                        |
| 199 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-signup.php';  | 
                                                        |
| 200 | -  | 
                                                        |
| 201 | - /**  | 
                                                        |
| 202 | - * Filter the signup template path.  | 
                                                        |
| 203 | - *  | 
                                                        |
| 204 | - * @since 1.0.0  | 
                                                        |
| 205 | - * @param string $template The template path.  | 
                                                        |
| 206 | - */  | 
                                                        |
| 207 | -        return $template = apply_filters('geodir_template_signup', $template);
 | 
                                                        |
| 208 | - }  | 
                                                        |
| 209 | -  | 
                                                        |
| 210 | -    if (geodir_is_page('add-listing') || $geodir_custom_page_list['geodir_add_listing_page']) {
 | 
                                                        |
| 211 | -        if (!geodir_is_default_location_set()) {
 | 
                                                        |
| 212 | - global $information;  | 
                                                        |
| 213 | -            $information = sprintf(__('Please %sclick here%s to set a default location, this will make the plugin work properly.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>');
 | 
                                                        |
| 214 | -  | 
                                                        |
| 215 | -            $template = geodir_locate_template('information');
 | 
                                                        |
| 216 | -  | 
                                                        |
| 217 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';  | 
                                                        |
| 218 | - /**  | 
                                                        |
| 219 | - * Filter the information template path.  | 
                                                        |
| 220 | - *  | 
                                                        |
| 221 | - * @since 1.0.0  | 
                                                        |
| 222 | - * @param string $template The template path.  | 
                                                        |
| 223 | - */  | 
                                                        |
| 224 | -            return $template = apply_filters('geodir_template_information', $template);
 | 
                                                        |
| 225 | - }  | 
                                                        |
| 226 | - // check if pid exists in the record if yes then check if this post belongs to the user who is logged in.  | 
                                                        |
| 227 | -        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
 | 
                                                        |
| 228 | - /// WPML  | 
                                                        |
| 229 | -            if (geodir_wpml_is_post_type_translated(get_post_type((int)$_GET['pid'])) && $duplicate_of = wpml_get_master_post_from_duplicate((int)$_GET['pid'])) {
 | 
                                                        |
| 230 | - global $sitepress;  | 
                                                        |
| 166 | + global $wp_query;  | 
                                                        |
| 167 | +  | 
                                                        |
| 168 | + /**  | 
                                                        |
| 169 | + * Filter the custom page list.  | 
                                                        |
| 170 | + *  | 
                                                        |
| 171 | + * @since 1.0.0  | 
                                                        |
| 172 | + */  | 
                                                        |
| 173 | +	$geodir_custom_page_list = apply_filters('geodir_set_custom_pages', array(
 | 
                                                        |
| 174 | + 'geodir_signup_page' =>  | 
                                                        |
| 175 | +			apply_filters('geodir_set_custom_signup_page', false),
 | 
                                                        |
| 176 | + 'geodir_add_listing_page' =>  | 
                                                        |
| 177 | +			apply_filters('geodir_set_custom_add_listing_page', false),
 | 
                                                        |
| 178 | + 'geodir_preview_page' =>  | 
                                                        |
| 179 | +			apply_filters('geodir_set_custom_preview_page', false),
 | 
                                                        |
| 180 | + 'geodir_listing_success_page' =>  | 
                                                        |
| 181 | +			apply_filters('geodir_set_custom_listing_success_page', false),
 | 
                                                        |
| 182 | + 'geodir_listing_detail_page' =>  | 
                                                        |
| 183 | +			apply_filters('geodir_set_custom_listing_detail_page', false),
 | 
                                                        |
| 184 | + 'geodir_listing_page' =>  | 
                                                        |
| 185 | +			apply_filters('geodir_set_custom_listing_page', false),
 | 
                                                        |
| 186 | + 'geodir_search_page' =>  | 
                                                        |
| 187 | +			apply_filters('geodir_set_custom_search_page', false),
 | 
                                                        |
| 188 | + 'geodir_author_page' =>  | 
                                                        |
| 189 | +			apply_filters('geodir_set_custom_author_page', false),
 | 
                                                        |
| 190 | + 'geodir_home_map_page' =>  | 
                                                        |
| 191 | +			apply_filters('geodir_set_custom_home_map_page', false)
 | 
                                                        |
| 192 | + ));  | 
                                                        |
| 193 | +  | 
                                                        |
| 194 | +  | 
                                                        |
| 195 | +	if (geodir_is_page('login') || $geodir_custom_page_list['geodir_signup_page']) {
 | 
                                                        |
| 196 | +  | 
                                                        |
| 197 | +		$template = geodir_locate_template('signup');
 | 
                                                        |
| 198 | +  | 
                                                        |
| 199 | + if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-signup.php';  | 
                                                        |
| 200 | +  | 
                                                        |
| 201 | + /**  | 
                                                        |
| 202 | + * Filter the signup template path.  | 
                                                        |
| 203 | + *  | 
                                                        |
| 204 | + * @since 1.0.0  | 
                                                        |
| 205 | + * @param string $template The template path.  | 
                                                        |
| 206 | + */  | 
                                                        |
| 207 | +		return $template = apply_filters('geodir_template_signup', $template);
 | 
                                                        |
| 208 | + }  | 
                                                        |
| 209 | +  | 
                                                        |
| 210 | +	if (geodir_is_page('add-listing') || $geodir_custom_page_list['geodir_add_listing_page']) {
 | 
                                                        |
| 211 | +		if (!geodir_is_default_location_set()) {
 | 
                                                        |
| 212 | + global $information;  | 
                                                        |
| 213 | +			$information = sprintf(__('Please %sclick here%s to set a default location, this will make the plugin work properly.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>');
 | 
                                                        |
| 214 | +  | 
                                                        |
| 215 | +			$template = geodir_locate_template('information');
 | 
                                                        |
| 216 | +  | 
                                                        |
| 217 | + if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';  | 
                                                        |
| 218 | + /**  | 
                                                        |
| 219 | + * Filter the information template path.  | 
                                                        |
| 220 | + *  | 
                                                        |
| 221 | + * @since 1.0.0  | 
                                                        |
| 222 | + * @param string $template The template path.  | 
                                                        |
| 223 | + */  | 
                                                        |
| 224 | +			return $template = apply_filters('geodir_template_information', $template);
 | 
                                                        |
| 225 | + }  | 
                                                        |
| 226 | + // check if pid exists in the record if yes then check if this post belongs to the user who is logged in.  | 
                                                        |
| 227 | +		if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
 | 
                                                        |
| 228 | + /// WPML  | 
                                                        |
| 229 | +			if (geodir_wpml_is_post_type_translated(get_post_type((int)$_GET['pid'])) && $duplicate_of = wpml_get_master_post_from_duplicate((int)$_GET['pid'])) {
 | 
                                                        |
| 230 | + global $sitepress;  | 
                                                        |
| 231 | 231 | |
| 232 | - $lang_of_duplicate = geodir_get_language_for_element($duplicate_of, 'post_' . get_post_type($duplicate_of));  | 
                                                        |
| 233 | - $sitepress->switch_lang($lang_of_duplicate, true);  | 
                                                        |
| 232 | + $lang_of_duplicate = geodir_get_language_for_element($duplicate_of, 'post_' . get_post_type($duplicate_of));  | 
                                                        |
| 233 | + $sitepress->switch_lang($lang_of_duplicate, true);  | 
                                                        |
| 234 | 234 | |
| 235 | - $redirect_to = get_permalink(geodir_add_listing_page_id());  | 
                                                        |
| 236 | - $_GET['pid'] = $duplicate_of;  | 
                                                        |
| 237 | -                if (!empty($_GET)) {
 | 
                                                        |
| 238 | - $redirect_to = add_query_arg($_GET, $redirect_to);  | 
                                                        |
| 239 | - }  | 
                                                        |
| 240 | - wp_redirect($redirect_to);  | 
                                                        |
| 241 | - exit;  | 
                                                        |
| 242 | - }  | 
                                                        |
| 243 | - /// WPML  | 
                                                        |
| 235 | + $redirect_to = get_permalink(geodir_add_listing_page_id());  | 
                                                        |
| 236 | + $_GET['pid'] = $duplicate_of;  | 
                                                        |
| 237 | +				if (!empty($_GET)) {
 | 
                                                        |
| 238 | + $redirect_to = add_query_arg($_GET, $redirect_to);  | 
                                                        |
| 239 | + }  | 
                                                        |
| 240 | + wp_redirect($redirect_to);  | 
                                                        |
| 241 | + exit;  | 
                                                        |
| 242 | + }  | 
                                                        |
| 243 | + /// WPML  | 
                                                        |
| 244 | 244 | |
| 245 | - global $information;  | 
                                                        |
| 246 | -            $information = __('This listing does not belong to your account, please check the listing id carefully.', 'geodirectory');
 | 
                                                        |
| 247 | - $is_current_user_owner = geodir_listing_belong_to_current_user();  | 
                                                        |
| 248 | -            if (!$is_current_user_owner) {
 | 
                                                        |
| 249 | -                $template = geodir_locate_template('information');
 | 
                                                        |
| 250 | -  | 
                                                        |
| 251 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';  | 
                                                        |
| 252 | - /**  | 
                                                        |
| 253 | - * Filter the information template path.  | 
                                                        |
| 254 | - *  | 
                                                        |
| 255 | - * @since 1.0.0  | 
                                                        |
| 256 | - * @param string $template The template path.  | 
                                                        |
| 257 | - */  | 
                                                        |
| 258 | -                return $template = apply_filters('geodir_template_information', $template);
 | 
                                                        |
| 259 | - }  | 
                                                        |
| 245 | + global $information;  | 
                                                        |
| 246 | +			$information = __('This listing does not belong to your account, please check the listing id carefully.', 'geodirectory');
 | 
                                                        |
| 247 | + $is_current_user_owner = geodir_listing_belong_to_current_user();  | 
                                                        |
| 248 | +			if (!$is_current_user_owner) {
 | 
                                                        |
| 249 | +				$template = geodir_locate_template('information');
 | 
                                                        |
| 250 | +  | 
                                                        |
| 251 | + if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';  | 
                                                        |
| 252 | + /**  | 
                                                        |
| 253 | + * Filter the information template path.  | 
                                                        |
| 254 | + *  | 
                                                        |
| 255 | + * @since 1.0.0  | 
                                                        |
| 256 | + * @param string $template The template path.  | 
                                                        |
| 257 | + */  | 
                                                        |
| 258 | +				return $template = apply_filters('geodir_template_information', $template);
 | 
                                                        |
| 259 | + }  | 
                                                        |
| 260 | 260 | |
| 261 | 261 | |
| 262 | - }  | 
                                                        |
| 262 | + }  | 
                                                        |
| 263 | 263 | |
| 264 | - //geodir_is_login(true);  | 
                                                        |
| 265 | - global $current_user;  | 
                                                        |
| 266 | -        if (!$current_user->ID) {
 | 
                                                        |
| 267 | -            wp_redirect(geodir_login_url(array('redirect_add_listing'=>urlencode(geodir_curPageURL()))), 302);
 | 
                                                        |
| 268 | - exit;  | 
                                                        |
| 269 | - }  | 
                                                        |
| 264 | + //geodir_is_login(true);  | 
                                                        |
| 265 | + global $current_user;  | 
                                                        |
| 266 | +		if (!$current_user->ID) {
 | 
                                                        |
| 267 | +			wp_redirect(geodir_login_url(array('redirect_add_listing'=>urlencode(geodir_curPageURL()))), 302);
 | 
                                                        |
| 268 | + exit;  | 
                                                        |
| 269 | + }  | 
                                                        |
| 270 | 270 | |
| 271 | -        $template = geodir_locate_template('add-listing');
 | 
                                                        |
| 272 | -  | 
                                                        |
| 273 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/add-listing.php';  | 
                                                        |
| 274 | - /**  | 
                                                        |
| 275 | - * Filter the add listing template path.  | 
                                                        |
| 276 | - *  | 
                                                        |
| 277 | - * @since 1.0.0  | 
                                                        |
| 278 | - * @param string $template The template path.  | 
                                                        |
| 279 | - */  | 
                                                        |
| 280 | -        return $template = apply_filters('geodir_template_add_listing', $template);
 | 
                                                        |
| 281 | - }  | 
                                                        |
| 271 | +		$template = geodir_locate_template('add-listing');
 | 
                                                        |
| 282 | 272 | |
| 273 | + if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/add-listing.php';  | 
                                                        |
| 274 | + /**  | 
                                                        |
| 275 | + * Filter the add listing template path.  | 
                                                        |
| 276 | + *  | 
                                                        |
| 277 | + * @since 1.0.0  | 
                                                        |
| 278 | + * @param string $template The template path.  | 
                                                        |
| 279 | + */  | 
                                                        |
| 280 | +		return $template = apply_filters('geodir_template_add_listing', $template);
 | 
                                                        |
| 281 | + }  | 
                                                        |
| 283 | 282 | |
| 284 | -    if (geodir_is_page('preview') || $geodir_custom_page_list['geodir_preview_page']) {
 | 
                                                        |
| 285 | - global $preview;  | 
                                                        |
| 286 | - $preview = true;  | 
                                                        |
| 287 | 283 | |
| 288 | -        $template = geodir_locate_template('preview');
 | 
                                                        |
| 284 | +	if (geodir_is_page('preview') || $geodir_custom_page_list['geodir_preview_page']) {
 | 
                                                        |
| 285 | + global $preview;  | 
                                                        |
| 286 | + $preview = true;  | 
                                                        |
| 289 | 287 | |
| 290 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';  | 
                                                        |
| 291 | - /**  | 
                                                        |
| 292 | - * Filter the preview template path.  | 
                                                        |
| 293 | - *  | 
                                                        |
| 294 | - * @since 1.0.0  | 
                                                        |
| 295 | - * @param string $template The template path.  | 
                                                        |
| 296 | - */  | 
                                                        |
| 297 | -        return $template = apply_filters('geodir_template_preview', $template);
 | 
                                                        |
| 288 | +		$template = geodir_locate_template('preview');
 | 
                                                        |
| 298 | 289 | |
| 299 | - }  | 
                                                        |
| 290 | + if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';  | 
                                                        |
| 291 | + /**  | 
                                                        |
| 292 | + * Filter the preview template path.  | 
                                                        |
| 293 | + *  | 
                                                        |
| 294 | + * @since 1.0.0  | 
                                                        |
| 295 | + * @param string $template The template path.  | 
                                                        |
| 296 | + */  | 
                                                        |
| 297 | +		return $template = apply_filters('geodir_template_preview', $template);
 | 
                                                        |
| 300 | 298 | |
| 299 | + }  | 
                                                        |
| 301 | 300 | |
| 302 | -    if (geodir_is_page('listing-success') || $geodir_custom_page_list['geodir_listing_success_page']) {
 | 
                                                        |
| 303 | 301 | |
| 304 | -        $template = geodir_locate_template('success');
 | 
                                                        |
| 302 | +	if (geodir_is_page('listing-success') || $geodir_custom_page_list['geodir_listing_success_page']) {
 | 
                                                        |
| 305 | 303 | |
| 306 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-success.php';  | 
                                                        |
| 307 | - /**  | 
                                                        |
| 308 | - * Filter the success template path.  | 
                                                        |
| 309 | - *  | 
                                                        |
| 310 | - * @since 1.0.0  | 
                                                        |
| 311 | - * @param string $template The template path.  | 
                                                        |
| 312 | - */  | 
                                                        |
| 313 | -        return $template = apply_filters('geodir_template_success', $template);
 | 
                                                        |
| 304 | +		$template = geodir_locate_template('success');
 | 
                                                        |
| 314 | 305 | |
| 315 | - }  | 
                                                        |
| 306 | + if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-success.php';  | 
                                                        |
| 307 | + /**  | 
                                                        |
| 308 | + * Filter the success template path.  | 
                                                        |
| 309 | + *  | 
                                                        |
| 310 | + * @since 1.0.0  | 
                                                        |
| 311 | + * @param string $template The template path.  | 
                                                        |
| 312 | + */  | 
                                                        |
| 313 | +		return $template = apply_filters('geodir_template_success', $template);
 | 
                                                        |
| 316 | 314 | |
| 317 | -    if (geodir_is_page('detail') || $geodir_custom_page_list['geodir_listing_detail_page']) {
 | 
                                                        |
| 315 | + }  | 
                                                        |
| 318 | 316 | |
| 319 | -        $template = geodir_locate_template('detail');
 | 
                                                        |
| 317 | +	if (geodir_is_page('detail') || $geodir_custom_page_list['geodir_listing_detail_page']) {
 | 
                                                        |
| 320 | 318 | |
| 321 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';  | 
                                                        |
| 322 | - /**  | 
                                                        |
| 323 | - * Filter the detail template path.  | 
                                                        |
| 324 | - *  | 
                                                        |
| 325 | - * @since 1.0.0  | 
                                                        |
| 326 | - * @param string $template The template path.  | 
                                                        |
| 327 | - */  | 
                                                        |
| 328 | -        return $template = apply_filters('geodir_template_detail', $template);
 | 
                                                        |
| 319 | +		$template = geodir_locate_template('detail');
 | 
                                                        |
| 329 | 320 | |
| 330 | - }  | 
                                                        |
| 321 | + if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';  | 
                                                        |
| 322 | + /**  | 
                                                        |
| 323 | + * Filter the detail template path.  | 
                                                        |
| 324 | + *  | 
                                                        |
| 325 | + * @since 1.0.0  | 
                                                        |
| 326 | + * @param string $template The template path.  | 
                                                        |
| 327 | + */  | 
                                                        |
| 328 | +		return $template = apply_filters('geodir_template_detail', $template);
 | 
                                                        |
| 331 | 329 | |
| 332 | -    if (geodir_is_page('listing') || $geodir_custom_page_list['geodir_listing_page']) {
 | 
                                                        |
| 330 | + }  | 
                                                        |
| 333 | 331 | |
| 334 | -        $template = geodir_locate_template('listing');
 | 
                                                        |
| 332 | +	if (geodir_is_page('listing') || $geodir_custom_page_list['geodir_listing_page']) {
 | 
                                                        |
| 335 | 333 | |
| 336 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-listing.php';  | 
                                                        |
| 337 | - /**  | 
                                                        |
| 338 | - * Filter the listing template path.  | 
                                                        |
| 339 | - *  | 
                                                        |
| 340 | - * @since 1.0.0  | 
                                                        |
| 341 | - * @param string $template The template path.  | 
                                                        |
| 342 | - */  | 
                                                        |
| 343 | -        return $template = apply_filters('geodir_template_listing', $template);
 | 
                                                        |
| 334 | +		$template = geodir_locate_template('listing');
 | 
                                                        |
| 344 | 335 | |
| 345 | - }  | 
                                                        |
| 336 | + if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-listing.php';  | 
                                                        |
| 337 | + /**  | 
                                                        |
| 338 | + * Filter the listing template path.  | 
                                                        |
| 339 | + *  | 
                                                        |
| 340 | + * @since 1.0.0  | 
                                                        |
| 341 | + * @param string $template The template path.  | 
                                                        |
| 342 | + */  | 
                                                        |
| 343 | +		return $template = apply_filters('geodir_template_listing', $template);
 | 
                                                        |
| 346 | 344 | |
| 347 | -    if (geodir_is_page('search') || $geodir_custom_page_list['geodir_search_page']) {
 | 
                                                        |
| 345 | + }  | 
                                                        |
| 348 | 346 | |
| 349 | -        $template = geodir_locate_template('search');
 | 
                                                        |
| 347 | +	if (geodir_is_page('search') || $geodir_custom_page_list['geodir_search_page']) {
 | 
                                                        |
| 350 | 348 | |
| 351 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-search.php';  | 
                                                        |
| 352 | - /**  | 
                                                        |
| 353 | - * Filter the search template path.  | 
                                                        |
| 354 | - *  | 
                                                        |
| 355 | - * @since 1.0.0  | 
                                                        |
| 356 | - * @param string $template The template path.  | 
                                                        |
| 357 | - */  | 
                                                        |
| 358 | -        return $template = apply_filters('geodir_template_search', $template);
 | 
                                                        |
| 349 | +		$template = geodir_locate_template('search');
 | 
                                                        |
| 359 | 350 | |
| 360 | - }  | 
                                                        |
| 351 | + if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-search.php';  | 
                                                        |
| 352 | + /**  | 
                                                        |
| 353 | + * Filter the search template path.  | 
                                                        |
| 354 | + *  | 
                                                        |
| 355 | + * @since 1.0.0  | 
                                                        |
| 356 | + * @param string $template The template path.  | 
                                                        |
| 357 | + */  | 
                                                        |
| 358 | +		return $template = apply_filters('geodir_template_search', $template);
 | 
                                                        |
| 361 | 359 | |
| 362 | -    if (geodir_is_page('author') || $geodir_custom_page_list['geodir_author_page']) {
 | 
                                                        |
| 360 | + }  | 
                                                        |
| 363 | 361 | |
| 364 | -        $template = geodir_locate_template('author');
 | 
                                                        |
| 362 | +	if (geodir_is_page('author') || $geodir_custom_page_list['geodir_author_page']) {
 | 
                                                        |
| 365 | 363 | |
| 366 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-author.php';  | 
                                                        |
| 367 | - /**  | 
                                                        |
| 368 | - * Filter the author template path.  | 
                                                        |
| 369 | - *  | 
                                                        |
| 370 | - * @since 1.0.0  | 
                                                        |
| 371 | - * @param string $template The template path.  | 
                                                        |
| 372 | - */  | 
                                                        |
| 373 | -        return $template = apply_filters('geodir_template_author', $template);
 | 
                                                        |
| 364 | +		$template = geodir_locate_template('author');
 | 
                                                        |
| 374 | 365 | |
| 375 | - }  | 
                                                        |
| 366 | + if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-author.php';  | 
                                                        |
| 367 | + /**  | 
                                                        |
| 368 | + * Filter the author template path.  | 
                                                        |
| 369 | + *  | 
                                                        |
| 370 | + * @since 1.0.0  | 
                                                        |
| 371 | + * @param string $template The template path.  | 
                                                        |
| 372 | + */  | 
                                                        |
| 373 | +		return $template = apply_filters('geodir_template_author', $template);
 | 
                                                        |
| 376 | 374 | |
| 377 | -    if ( geodir_is_page('home') || geodir_is_page('location')) {
 | 
                                                        |
| 375 | + }  | 
                                                        |
| 378 | 376 | |
| 379 | - global $post, $wp_query;  | 
                                                        |
| 377 | +	if ( geodir_is_page('home') || geodir_is_page('location')) {
 | 
                                                        |
| 380 | 378 | |
| 381 | -        if (geodir_is_page('home') || ('page' == get_option('show_on_front') && isset($post->ID) && $post->ID == get_option('page_on_front'))
 | 
                                                        |
| 382 | - || (is_home() && !$wp_query->is_posts_page)  | 
                                                        |
| 383 | -        ) {
 | 
                                                        |
| 379 | + global $post, $wp_query;  | 
                                                        |
| 384 | 380 | |
| 385 | -            $template = geodir_locate_template('geodir-home');
 | 
                                                        |
| 381 | +		if (geodir_is_page('home') || ('page' == get_option('show_on_front') && isset($post->ID) && $post->ID == get_option('page_on_front'))
 | 
                                                        |
| 382 | + || (is_home() && !$wp_query->is_posts_page)  | 
                                                        |
| 383 | +		) {
 | 
                                                        |
| 386 | 384 | |
| 387 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-home.php';  | 
                                                        |
| 388 | - /**  | 
                                                        |
| 389 | - * Filter the home page template path.  | 
                                                        |
| 390 | - *  | 
                                                        |
| 391 | - * @since 1.0.0  | 
                                                        |
| 392 | - * @param string $template The template path.  | 
                                                        |
| 393 | - */  | 
                                                        |
| 394 | -            return $template = apply_filters('geodir_template_homepage', $template);
 | 
                                                        |
| 385 | +			$template = geodir_locate_template('geodir-home');
 | 
                                                        |
| 395 | 386 | |
| 396 | -        } elseif (geodir_is_page('location')) {
 | 
                                                        |
| 387 | + if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-home.php';  | 
                                                        |
| 388 | + /**  | 
                                                        |
| 389 | + * Filter the home page template path.  | 
                                                        |
| 390 | + *  | 
                                                        |
| 391 | + * @since 1.0.0  | 
                                                        |
| 392 | + * @param string $template The template path.  | 
                                                        |
| 393 | + */  | 
                                                        |
| 394 | +			return $template = apply_filters('geodir_template_homepage', $template);
 | 
                                                        |
| 397 | 395 | |
| 398 | -            $template = geodir_locate_template('location');
 | 
                                                        |
| 396 | +		} elseif (geodir_is_page('location')) {
 | 
                                                        |
| 399 | 397 | |
| 400 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-location.php';  | 
                                                        |
| 401 | - /**  | 
                                                        |
| 402 | - * Filter the location template path.  | 
                                                        |
| 403 | - *  | 
                                                        |
| 404 | - * @since 1.0.0  | 
                                                        |
| 405 | - * @param string $template The template path.  | 
                                                        |
| 406 | - */  | 
                                                        |
| 407 | -            return $template = apply_filters('geodir_template_location', $template);
 | 
                                                        |
| 398 | +			$template = geodir_locate_template('location');
 | 
                                                        |
| 408 | 399 | |
| 409 | - } else  | 
                                                        |
| 410 | - return $template;  | 
                                                        |
| 400 | + if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-location.php';  | 
                                                        |
| 401 | + /**  | 
                                                        |
| 402 | + * Filter the location template path.  | 
                                                        |
| 403 | + *  | 
                                                        |
| 404 | + * @since 1.0.0  | 
                                                        |
| 405 | + * @param string $template The template path.  | 
                                                        |
| 406 | + */  | 
                                                        |
| 407 | +			return $template = apply_filters('geodir_template_location', $template);
 | 
                                                        |
| 411 | 408 | |
| 412 | - }  | 
                                                        |
| 409 | + } else  | 
                                                        |
| 410 | + return $template;  | 
                                                        |
| 413 | 411 | |
| 414 | - return $template;  | 
                                                        |
| 412 | + }  | 
                                                        |
| 413 | +  | 
                                                        |
| 414 | + return $template;  | 
                                                        |
| 415 | 415 | }  | 
                                                        
| 416 | 416 | |
| 417 | 417 | /**  | 
                                                        
@@ -426,44 +426,44 @@ discard block  | 
                                                    ||
| 426 | 426 | */  | 
                                                        
| 427 | 427 | function geodir_get_template_part($slug = '', $name = NULL)  | 
                                                        
| 428 | 428 |  {
 | 
                                                        
| 429 | - global $geodirectory, $post;  | 
                                                        |
| 430 | - /**  | 
                                                        |
| 431 | - * Called at the start for the geodir_get_template_part() function.  | 
                                                        |
| 432 | - *  | 
                                                        |
| 433 | -     * Used dynamic hook name: geodir_get_template_part_{$slug}
 | 
                                                        |
| 434 | - *  | 
                                                        |
| 435 | - * @since 1.0.0  | 
                                                        |
| 436 | - * @package GeoDirectory  | 
                                                        |
| 437 | - * @param string $slug The template slug.  | 
                                                        |
| 438 | - * @param string $name The template name.  | 
                                                        |
| 439 | - */  | 
                                                        |
| 440 | -    do_action("geodir_get_template_part_{$slug}", $slug, $name);
 | 
                                                        |
| 441 | - $templates = array();  | 
                                                        |
| 442 | - $name = (string)$name;  | 
                                                        |
| 443 | -    if ('' !== $name) {
 | 
                                                        |
| 444 | -        $template_name = "{$slug}-{$name}.php";
 | 
                                                        |
| 445 | -  | 
                                                        |
| 446 | -    } else {
 | 
                                                        |
| 447 | -        $template_name = "{$slug}.php";
 | 
                                                        |
| 448 | - }  | 
                                                        |
| 449 | -  | 
                                                        |
| 450 | -    if (!locate_template(array("geodirectory/" . $template_name))) :
 | 
                                                        |
| 451 | - /**  | 
                                                        |
| 452 | - * Filter the template part with slug and name.  | 
                                                        |
| 453 | - *  | 
                                                        |
| 454 | - * @since 1.0.0  | 
                                                        |
| 455 | - * @param string $template_name The template name.  | 
                                                        |
| 456 | - */  | 
                                                        |
| 457 | -        $template = apply_filters("geodir_template_part-{$slug}-{$name}", geodir_plugin_path() . '/geodirectory-templates/' . $template_name);
 | 
                                                        |
| 458 | - /**  | 
                                                        |
| 459 | - * Includes the template part with slug and name.  | 
                                                        |
| 460 | - *  | 
                                                        |
| 461 | - * @since 1.0.0  | 
                                                        |
| 462 | - */  | 
                                                        |
| 463 | - include($template);  | 
                                                        |
| 464 | - else:  | 
                                                        |
| 465 | -        locate_template(array("geodirectory/" . $template_name), true, false);
 | 
                                                        |
| 466 | - endif;  | 
                                                        |
| 429 | + global $geodirectory, $post;  | 
                                                        |
| 430 | + /**  | 
                                                        |
| 431 | + * Called at the start for the geodir_get_template_part() function.  | 
                                                        |
| 432 | + *  | 
                                                        |
| 433 | +	 * Used dynamic hook name: geodir_get_template_part_{$slug}
 | 
                                                        |
| 434 | + *  | 
                                                        |
| 435 | + * @since 1.0.0  | 
                                                        |
| 436 | + * @package GeoDirectory  | 
                                                        |
| 437 | + * @param string $slug The template slug.  | 
                                                        |
| 438 | + * @param string $name The template name.  | 
                                                        |
| 439 | + */  | 
                                                        |
| 440 | +	do_action("geodir_get_template_part_{$slug}", $slug, $name);
 | 
                                                        |
| 441 | + $templates = array();  | 
                                                        |
| 442 | + $name = (string)$name;  | 
                                                        |
| 443 | +	if ('' !== $name) {
 | 
                                                        |
| 444 | +		$template_name = "{$slug}-{$name}.php";
 | 
                                                        |
| 445 | +  | 
                                                        |
| 446 | +	} else {
 | 
                                                        |
| 447 | +		$template_name = "{$slug}.php";
 | 
                                                        |
| 448 | + }  | 
                                                        |
| 449 | +  | 
                                                        |
| 450 | +	if (!locate_template(array("geodirectory/" . $template_name))) :
 | 
                                                        |
| 451 | + /**  | 
                                                        |
| 452 | + * Filter the template part with slug and name.  | 
                                                        |
| 453 | + *  | 
                                                        |
| 454 | + * @since 1.0.0  | 
                                                        |
| 455 | + * @param string $template_name The template name.  | 
                                                        |
| 456 | + */  | 
                                                        |
| 457 | +		$template = apply_filters("geodir_template_part-{$slug}-{$name}", geodir_plugin_path() . '/geodirectory-templates/' . $template_name);
 | 
                                                        |
| 458 | + /**  | 
                                                        |
| 459 | + * Includes the template part with slug and name.  | 
                                                        |
| 460 | + *  | 
                                                        |
| 461 | + * @since 1.0.0  | 
                                                        |
| 462 | + */  | 
                                                        |
| 463 | + include($template);  | 
                                                        |
| 464 | + else:  | 
                                                        |
| 465 | +		locate_template(array("geodirectory/" . $template_name), true, false);
 | 
                                                        |
| 466 | + endif;  | 
                                                        |
| 467 | 467 | |
| 468 | 468 | }  | 
                                                        
| 469 | 469 | |
@@ -479,23 +479,23 @@ discard block  | 
                                                    ||
| 479 | 479 | */  | 
                                                        
| 480 | 480 | function geodir_core_post_view_extra_class($class, $all_postypes = '')  | 
                                                        
| 481 | 481 |  {
 | 
                                                        
| 482 | - global $post;  | 
                                                        |
| 482 | + global $post;  | 
                                                        |
| 483 | 483 | |
| 484 | -    if (!$all_postypes) {
 | 
                                                        |
| 485 | - $all_postypes = geodir_get_posttypes();  | 
                                                        |
| 486 | - }  | 
                                                        |
| 484 | +	if (!$all_postypes) {
 | 
                                                        |
| 485 | + $all_postypes = geodir_get_posttypes();  | 
                                                        |
| 486 | + }  | 
                                                        |
| 487 | 487 | |
| 488 | - $gdp_post_id = !empty($post) && isset($post->ID) ? $post->ID : NULL;  | 
                                                        |
| 489 | - $gdp_post_type = $gdp_post_id > 0 && isset($post->post_type) ? $post->post_type : NULL;  | 
                                                        |
| 490 | - $gdp_post_type = $gdp_post_type != '' && !empty($all_postypes) && in_array($gdp_post_type, $all_postypes) ? $gdp_post_type : NULL;  | 
                                                        |
| 488 | + $gdp_post_id = !empty($post) && isset($post->ID) ? $post->ID : NULL;  | 
                                                        |
| 489 | + $gdp_post_type = $gdp_post_id > 0 && isset($post->post_type) ? $post->post_type : NULL;  | 
                                                        |
| 490 | + $gdp_post_type = $gdp_post_type != '' && !empty($all_postypes) && in_array($gdp_post_type, $all_postypes) ? $gdp_post_type : NULL;  | 
                                                        |
| 491 | 491 | |
| 492 | -    if ($gdp_post_id && $gdp_post_type) {
 | 
                                                        |
| 493 | - $append_class = 'gd-post-' . $gdp_post_type;  | 
                                                        |
| 494 | - $append_class .= isset($post->is_featured) && $post->is_featured > 0 ? ' gd-post-featured' : '';  | 
                                                        |
| 495 | - $class = $class != '' ? $class . ' ' . $append_class : $append_class;  | 
                                                        |
| 496 | - }  | 
                                                        |
| 492 | +	if ($gdp_post_id && $gdp_post_type) {
 | 
                                                        |
| 493 | + $append_class = 'gd-post-' . $gdp_post_type;  | 
                                                        |
| 494 | + $append_class .= isset($post->is_featured) && $post->is_featured > 0 ? ' gd-post-featured' : '';  | 
                                                        |
| 495 | + $class = $class != '' ? $class . ' ' . $append_class : $append_class;  | 
                                                        |
| 496 | + }  | 
                                                        |
| 497 | 497 | |
| 498 | - return $class;  | 
                                                        |
| 498 | + return $class;  | 
                                                        |
| 499 | 499 | }  | 
                                                        
| 500 | 500 | |
| 501 | 501 | /**  | 
                                                        
@@ -509,7 +509,7 @@ discard block  | 
                                                    ||
| 509 | 509 | * @param bool $favorite Listing Optional. Are favorite listings results? Default: false.  | 
                                                        
| 510 | 510 | */  | 
                                                        
| 511 | 511 |  function geodir_display_message_not_found_on_listing($template_listview = 'listing-listview', $favorite = false) {
 | 
                                                        
| 512 | -    if ($favorite) {
 | 
                                                        |
| 512 | +	if ($favorite) {
 | 
                                                        |
| 513 | 513 |  		$message = __('No favorite listings found which match your selection.', 'geodirectory');
 | 
                                                        
| 514 | 514 |  	} else {
 | 
                                                        
| 515 | 515 |  		$message = __('No listings found which match your selection.', 'geodirectory');
 | 
                                                        
@@ -107,7 +107,6 @@  | 
                                                    ||
| 107 | 107 | * @link http://php.net/manual/en/arrayaccess.offsetset.php  | 
                                                        
| 108 | 108 | *  | 
                                                        
| 109 | 109 | * @param mixed $offset The offset to assign the value to.  | 
                                                        
| 110 | - * @param mixed $value The value to set.  | 
                                                        |
| 111 | 110 | *  | 
                                                        
| 112 | 111 | * @return void  | 
                                                        
| 113 | 112 | */  | 
                                                        
@@ -36,9 +36,9 @@ discard block  | 
                                                    ||
| 36 | 36 | *  | 
                                                        
| 37 | 37 | * @param array $data  | 
                                                        
| 38 | 38 | */  | 
                                                        
| 39 | -	protected function __construct( $data = array() ) { | 
                                                        |
| 40 | -		foreach ( $data as $key => $value ) { | 
                                                        |
| 41 | - $this[ $key ] = $value;  | 
                                                        |
| 39 | +	protected function __construct($data = array()) { | 
                                                        |
| 40 | +		foreach ($data as $key => $value) { | 
                                                        |
| 41 | + $this[$key] = $value;  | 
                                                        |
| 42 | 42 | }  | 
                                                        
| 43 | 43 | }  | 
                                                        
| 44 | 44 | |
@@ -46,9 +46,9 @@ discard block  | 
                                                    ||
| 46 | 46 | * Allow deep copies of objects  | 
                                                        
| 47 | 47 | */  | 
                                                        
| 48 | 48 |  	public function __clone() { | 
                                                        
| 49 | -		foreach ( $this->container as $key => $value ) { | 
                                                        |
| 50 | -			if ( $value instanceof self ) { | 
                                                        |
| 51 | - $this[ $key ] = clone $value;  | 
                                                        |
| 49 | +		foreach ($this->container as $key => $value) { | 
                                                        |
| 50 | +			if ($value instanceof self) { | 
                                                        |
| 51 | + $this[$key] = clone $value;  | 
                                                        |
| 52 | 52 | }  | 
                                                        
| 53 | 53 | }  | 
                                                        
| 54 | 54 | }  | 
                                                        
@@ -60,9 +60,9 @@ discard block  | 
                                                    ||
| 60 | 60 | */  | 
                                                        
| 61 | 61 |  	public function toArray() { | 
                                                        
| 62 | 62 | $data = $this->container;  | 
                                                        
| 63 | -		foreach ( $data as $key => $value ) { | 
                                                        |
| 64 | -			if ( $value instanceof self ) { | 
                                                        |
| 65 | - $data[ $key ] = $value->toArray();  | 
                                                        |
| 63 | +		foreach ($data as $key => $value) { | 
                                                        |
| 64 | +			if ($value instanceof self) { | 
                                                        |
| 65 | + $data[$key] = $value->toArray();  | 
                                                        |
| 66 | 66 | }  | 
                                                        
| 67 | 67 | }  | 
                                                        
| 68 | 68 | return $data;  | 
                                                        
@@ -81,8 +81,8 @@ discard block  | 
                                                    ||
| 81 | 81 | *  | 
                                                        
| 82 | 82 | * @return boolean true on success or false on failure.  | 
                                                        
| 83 | 83 | */  | 
                                                        
| 84 | -	public function offsetExists( $offset ) { | 
                                                        |
| 85 | - return isset( $this->container[ $offset ]) ;  | 
                                                        |
| 84 | +	public function offsetExists($offset) { | 
                                                        |
| 85 | + return isset($this->container[$offset]);  | 
                                                        |
| 86 | 86 | }  | 
                                                        
| 87 | 87 | |
| 88 | 88 | /**  | 
                                                        
@@ -94,8 +94,8 @@ discard block  | 
                                                    ||
| 94 | 94 | *  | 
                                                        
| 95 | 95 | * @return mixed Can return all value types.  | 
                                                        
| 96 | 96 | */  | 
                                                        
| 97 | -	public function offsetGet( $offset ) { | 
                                                        |
| 98 | - return isset( $this->container[ $offset ] ) ? $this->container[ $offset ] : null;  | 
                                                        |
| 97 | +	public function offsetGet($offset) { | 
                                                        |
| 98 | + return isset($this->container[$offset]) ? $this->container[$offset] : null;  | 
                                                        |
| 99 | 99 | }  | 
                                                        
| 100 | 100 | |
| 101 | 101 | /**  | 
                                                        
@@ -108,14 +108,14 @@ discard block  | 
                                                    ||
| 108 | 108 | *  | 
                                                        
| 109 | 109 | * @return void  | 
                                                        
| 110 | 110 | */  | 
                                                        
| 111 | -	public function offsetSet( $offset, $data ) { | 
                                                        |
| 112 | -		if ( is_array( $data ) ) { | 
                                                        |
| 113 | - $data = new self( $data );  | 
                                                        |
| 111 | +	public function offsetSet($offset, $data) { | 
                                                        |
| 112 | +		if (is_array($data)) { | 
                                                        |
| 113 | + $data = new self($data);  | 
                                                        |
| 114 | 114 | }  | 
                                                        
| 115 | -		if ( $offset === null ) { // don't forget this! | 
                                                        |
| 115 | +		if ($offset === null) { // don't forget this! | 
                                                        |
| 116 | 116 | $this->container[] = $data;  | 
                                                        
| 117 | 117 |  		} else { | 
                                                        
| 118 | - $this->container[ $offset ] = $data;  | 
                                                        |
| 118 | + $this->container[$offset] = $data;  | 
                                                        |
| 119 | 119 | }  | 
                                                        
| 120 | 120 | |
| 121 | 121 | $this->dirty = true;  | 
                                                        
@@ -130,8 +130,8 @@ discard block  | 
                                                    ||
| 130 | 130 | *  | 
                                                        
| 131 | 131 | * @return void  | 
                                                        
| 132 | 132 | */  | 
                                                        
| 133 | -	public function offsetUnset( $offset ) { | 
                                                        |
| 134 | - unset( $this->container[ $offset ] );  | 
                                                        |
| 133 | +	public function offsetUnset($offset) { | 
                                                        |
| 134 | + unset($this->container[$offset]);  | 
                                                        |
| 135 | 135 | |
| 136 | 136 | $this->dirty = true;  | 
                                                        
| 137 | 137 | }  | 
                                                        
@@ -149,7 +149,7 @@ discard block  | 
                                                    ||
| 149 | 149 | * @return mixed  | 
                                                        
| 150 | 150 | */  | 
                                                        
| 151 | 151 |  	public function current() { | 
                                                        
| 152 | - return current( $this->container );  | 
                                                        |
| 152 | + return current($this->container);  | 
                                                        |
| 153 | 153 | }  | 
                                                        
| 154 | 154 | |
| 155 | 155 | /**  | 
                                                        
@@ -160,7 +160,7 @@ discard block  | 
                                                    ||
| 160 | 160 | * @return mixed  | 
                                                        
| 161 | 161 | */  | 
                                                        
| 162 | 162 |  	public function key() { | 
                                                        
| 163 | - return key( $this->container );  | 
                                                        |
| 163 | + return key($this->container);  | 
                                                        |
| 164 | 164 | }  | 
                                                        
| 165 | 165 | |
| 166 | 166 | /**  | 
                                                        
@@ -171,7 +171,7 @@ discard block  | 
                                                    ||
| 171 | 171 | * @return void  | 
                                                        
| 172 | 172 | */  | 
                                                        
| 173 | 173 |  	public function next() { | 
                                                        
| 174 | - next( $this->container );  | 
                                                        |
| 174 | + next($this->container);  | 
                                                        |
| 175 | 175 | }  | 
                                                        
| 176 | 176 | |
| 177 | 177 | /**  | 
                                                        
@@ -182,7 +182,7 @@ discard block  | 
                                                    ||
| 182 | 182 | * @return void  | 
                                                        
| 183 | 183 | */  | 
                                                        
| 184 | 184 |  	public function rewind() { | 
                                                        
| 185 | - reset( $this->container );  | 
                                                        |
| 185 | + reset($this->container);  | 
                                                        |
| 186 | 186 | }  | 
                                                        
| 187 | 187 | |
| 188 | 188 | /**  | 
                                                        
@@ -193,7 +193,7 @@ discard block  | 
                                                    ||
| 193 | 193 | * @return bool  | 
                                                        
| 194 | 194 | */  | 
                                                        
| 195 | 195 |  	public function valid() { | 
                                                        
| 196 | - return $this->offsetExists( $this->key() );  | 
                                                        |
| 196 | + return $this->offsetExists($this->key());  | 
                                                        |
| 197 | 197 | }  | 
                                                        
| 198 | 198 | |
| 199 | 199 | /*****************************************************************/  | 
                                                        
@@ -208,6 +208,6 @@ discard block  | 
                                                    ||
| 208 | 208 | * @return int  | 
                                                        
| 209 | 209 | */  | 
                                                        
| 210 | 210 |  	public function count() { | 
                                                        
| 211 | - return count( $this->container );  | 
                                                        |
| 211 | + return count($this->container);  | 
                                                        |
| 212 | 212 | }  | 
                                                        
| 213 | 213 | }  |