| @@ -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 | } | 
| @@ -70,7 +70,7 @@ discard block | ||
| 70 | 70 | |
| 71 | 71 |              if (!empty($args['labels'])) {
 | 
| 72 | 72 |                  foreach ($args['labels'] as $key => $val) {
 | 
| 73 | - $args['labels'][$key] = __($val, 'geodirectory');// allow translation | |
| 73 | + $args['labels'][$key] = __($val, 'geodirectory'); // allow translation | |
| 74 | 74 | } | 
| 75 | 75 | } | 
| 76 | 76 | |
| @@ -111,7 +111,7 @@ discard block | ||
| 111 | 111 | |
| 112 | 112 |              if (array_key_exists('rewrite', $args)) {
 | 
| 113 | 113 |                  if (array_key_exists('slug', $args['rewrite']))
 | 
| 114 | - $args['rewrite']['slug'] = $listing_slug;// . '/%gd_taxonomy%'; | |
| 114 | + $args['rewrite']['slug'] = $listing_slug; // . '/%gd_taxonomy%'; | |
| 115 | 115 | } | 
| 116 | 116 | |
| 117 | 117 |              $geodir_post_types = get_option('geodir_post_types');
 | 
| @@ -123,7 +123,7 @@ discard block | ||
| 123 | 123 | |
| 124 | 124 |                  if (array_key_exists('rewrite', $geodir_post_types[$post_type]))
 | 
| 125 | 125 |                      if (array_key_exists('slug', $geodir_post_types[$post_type]['rewrite']))
 | 
| 126 | - $geodir_post_types[$post_type]['rewrite']['slug'] = $listing_slug;// . '/%gd_taxonomy%'; | |
| 126 | + $geodir_post_types[$post_type]['rewrite']['slug'] = $listing_slug; // . '/%gd_taxonomy%'; | |
| 127 | 127 | |
| 128 | 128 |                  update_option('geodir_post_types', $geodir_post_types);
 | 
| 129 | 129 | |
| @@ -135,13 +135,13 @@ discard block | ||
| 135 | 135 | |
| 136 | 136 |              $geodir_taxonomies = get_option('geodir_taxonomies');
 | 
| 137 | 137 | |
| 138 | -            if (array_key_exists('listing_slug', $geodir_taxonomies[$post_type . 'category'])) {
 | |
| 139 | - $geodir_taxonomies[$post_type . 'category']['listing_slug'] = $listing_slug; | |
| 138 | +            if (array_key_exists('listing_slug', $geodir_taxonomies[$post_type.'category'])) {
 | |
| 139 | + $geodir_taxonomies[$post_type.'category']['listing_slug'] = $listing_slug; | |
| 140 | 140 | |
| 141 | -                if (array_key_exists('args', $geodir_taxonomies[$post_type . 'category']))
 | |
| 142 | -                    if (array_key_exists('rewrite', $geodir_taxonomies[$post_type . 'category']['args']))
 | |
| 143 | -                        if (array_key_exists('slug', $geodir_taxonomies[$post_type . 'category']['args']['rewrite']))
 | |
| 144 | - $geodir_taxonomies[$post_type . 'category']['args']['rewrite']['slug'] = $listing_slug; | |
| 141 | +                if (array_key_exists('args', $geodir_taxonomies[$post_type.'category']))
 | |
| 142 | +                    if (array_key_exists('rewrite', $geodir_taxonomies[$post_type.'category']['args']))
 | |
| 143 | +                        if (array_key_exists('slug', $geodir_taxonomies[$post_type.'category']['args']['rewrite']))
 | |
| 144 | + $geodir_taxonomies[$post_type.'category']['args']['rewrite']['slug'] = $listing_slug; | |
| 145 | 145 | |
| 146 | 146 |                  update_option('geodir_taxonomies', $geodir_taxonomies);
 | 
| 147 | 147 | |
| @@ -149,13 +149,13 @@ discard block | ||
| 149 | 149 | |
| 150 | 150 | /* --- update taxonomies (tags) --- */ | 
| 151 | 151 |              $geodir_taxonomies_tag = get_option('geodir_taxonomies');
 | 
| 152 | -            if (array_key_exists('listing_slug', $geodir_taxonomies_tag[$post_type . '_tags'])) {
 | |
| 153 | - $geodir_taxonomies_tag[$post_type . '_tags']['listing_slug'] = $listing_slug . '/tags'; | |
| 152 | +            if (array_key_exists('listing_slug', $geodir_taxonomies_tag[$post_type.'_tags'])) {
 | |
| 153 | + $geodir_taxonomies_tag[$post_type.'_tags']['listing_slug'] = $listing_slug.'/tags'; | |
| 154 | 154 | |
| 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']))
 | |
| 157 | -                        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'; | |
| 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']))
 | |
| 157 | +                        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'; | |
| 159 | 159 | |
| 160 | 160 |                  update_option('geodir_taxonomies', $geodir_taxonomies_tag);
 | 
| 161 | 161 | |
| @@ -205,11 +205,11 @@ discard block | ||
| 205 | 205 | $listing_slug = $args['listing_slug']; | 
| 206 | 206 | |
| 207 | 207 |              if (strpos($taxonomy, 'tags')) {
 | 
| 208 | -                $newrules[$listing_slug . '/(.+?)/page/?([0-9]{1,})/?$'] = 'index.php?' . $taxonomy . '=$matches[1]&paged=$matches[2]';
 | |
| 209 | - $newrules[$listing_slug . '/(.+?)/?$'] = 'index.php?' . $taxonomy . '=$matches[1]'; | |
| 208 | +                $newrules[$listing_slug.'/(.+?)/page/?([0-9]{1,})/?$'] = 'index.php?'.$taxonomy.'=$matches[1]&paged=$matches[2]';
 | |
| 209 | + $newrules[$listing_slug.'/(.+?)/?$'] = 'index.php?'.$taxonomy.'=$matches[1]'; | |
| 210 | 210 |              } else {
 | 
| 211 | 211 | // use this loop to add paging for details page comments paging | 
| 212 | -                $newrules[str_replace("/tags","",$listing_slug) . '/(.+?)/comment-page-([0-9]{1,})/?$'] = 'index.php?' . $taxonomy . '=$matches[1]&cpage=$matches[2]';
 | |
| 212 | +                $newrules[str_replace("/tags", "", $listing_slug).'/(.+?)/comment-page-([0-9]{1,})/?$'] = 'index.php?'.$taxonomy.'=$matches[1]&cpage=$matches[2]';
 | |
| 213 | 213 | } | 
| 214 | 214 | endforeach; | 
| 215 | 215 | endif; | 
| @@ -217,7 +217,7 @@ discard block | ||
| 217 | 217 | // create rules for location listing | 
| 218 | 218 |      $location_page = get_option('geodir_location_page');
 | 
| 219 | 219 | |
| 220 | -    if($location_page) {
 | |
| 220 | +    if ($location_page) {
 | |
| 221 | 221 | global $wpdb; | 
| 222 | 222 |          $location_prefix = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_type='page' AND ID=%d", $location_page));
 | 
| 223 | 223 | } | 
| @@ -247,30 +247,30 @@ discard block | ||
| 247 | 247 | |
| 248 | 248 |  		if ($matches2) {
 | 
| 249 | 249 |  			if ($neighbourhood_active) {
 | 
| 250 | - $newrules[$location_prefix . '/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&' . $matches1 . '=$matches[1]&' . $matches2 . '=$matches[2]&gd_neighbourhood=$matches[3]'; | |
| 250 | + $newrules[$location_prefix.'/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id='.$location_page.'&'.$matches1.'=$matches[1]&'.$matches2.'=$matches[2]&gd_neighbourhood=$matches[3]'; | |
| 251 | 251 | } | 
| 252 | - $newrules[$location_prefix . '/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&' . $matches1 . '=$matches[1]&' . $matches2 . '=$matches[2]'; | |
| 252 | + $newrules[$location_prefix.'/([^/]+)/([^/]+)/?$'] = 'index.php?page_id='.$location_page.'&'.$matches1.'=$matches[1]&'.$matches2.'=$matches[2]'; | |
| 253 | 253 |  		} else {
 | 
| 254 | 254 |  			if ($neighbourhood_active) {
 | 
| 255 | - $newrules[$location_prefix . '/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&' . $matches1 . '=$matches[1]&gd_neighbourhood=$matches[2]'; | |
| 255 | + $newrules[$location_prefix.'/([^/]+)/([^/]+)/?$'] = 'index.php?page_id='.$location_page.'&'.$matches1.'=$matches[1]&gd_neighbourhood=$matches[2]'; | |
| 256 | 256 | } | 
| 257 | 257 | } | 
| 258 | 258 | |
| 259 | - $newrules[$location_prefix . '/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&' . $matches1 . '=$matches[1]'; | |
| 259 | + $newrules[$location_prefix.'/([^/]+)/?$'] = 'index.php?page_id='.$location_page.'&'.$matches1.'=$matches[1]'; | |
| 260 | 260 |  	} else { // country/region/city
 | 
| 261 | 261 |  		if ($neighbourhood_active) {
 | 
| 262 | - $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]'; | |
| 262 | + $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]'; | |
| 263 | 263 | } | 
| 264 | - $newrules[$location_prefix . '/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&gd_country=$matches[1]&gd_region=$matches[2]&gd_city=$matches[3]'; | |
| 265 | - $newrules[$location_prefix . '/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&gd_country=$matches[1]&gd_region=$matches[2]'; | |
| 266 | - $newrules[$location_prefix . '/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&gd_country=$matches[1]'; | |
| 264 | + $newrules[$location_prefix.'/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id='.$location_page.'&gd_country=$matches[1]&gd_region=$matches[2]&gd_city=$matches[3]'; | |
| 265 | + $newrules[$location_prefix.'/([^/]+)/([^/]+)/?$'] = 'index.php?page_id='.$location_page.'&gd_country=$matches[1]&gd_region=$matches[2]'; | |
| 266 | + $newrules[$location_prefix.'/([^/]+)/?$'] = 'index.php?page_id='.$location_page.'&gd_country=$matches[1]'; | |
| 267 | 267 | } | 
| 268 | 268 | |
| 269 | 269 |      if ($location_page && function_exists('icl_object_id')) {
 | 
| 270 | -        foreach(icl_get_languages('skip_missing=N') as $lang){
 | |
| 270 | +        foreach (icl_get_languages('skip_missing=N') as $lang) {
 | |
| 271 | 271 | $alt_page_id = ''; | 
| 272 | - $alt_page_id = icl_object_id($location_page, 'page', false,$lang['language_code']); | |
| 273 | -            if($alt_page_id){
 | |
| 272 | + $alt_page_id = icl_object_id($location_page, 'page', false, $lang['language_code']); | |
| 273 | +            if ($alt_page_id) {
 | |
| 274 | 274 |                  $location_prefix = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_type='page' AND ID=%d", $alt_page_id));
 | 
| 275 | 275 | |
| 276 | 276 |  				if ($location_manager && ($hide_country_part || $hide_region_part)) {
 | 
| @@ -289,29 +289,29 @@ discard block | ||
| 289 | 289 | |
| 290 | 290 |  					if ($matches2) {
 | 
| 291 | 291 |  						if ($neighbourhood_active) {
 | 
| 292 | - $newrules[$location_prefix . '/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&' . $matches1 . '=$matches[1]&' . $matches2 . '=$matches[2]&gd_neighbourhood=$matches[3]'; | |
| 292 | + $newrules[$location_prefix.'/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id='.$alt_page_id.'&'.$matches1.'=$matches[1]&'.$matches2.'=$matches[2]&gd_neighbourhood=$matches[3]'; | |
| 293 | 293 | } | 
| 294 | - $newrules[$location_prefix . '/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&' . $matches1 . '=$matches[1]&' . $matches2 . '=$matches[2]'; | |
| 294 | + $newrules[$location_prefix.'/([^/]+)/([^/]+)/?$'] = 'index.php?page_id='.$alt_page_id.'&'.$matches1.'=$matches[1]&'.$matches2.'=$matches[2]'; | |
| 295 | 295 |  					} else {
 | 
| 296 | 296 |  						if ($neighbourhood_active) {
 | 
| 297 | - $newrules[$location_prefix . '/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&' . $matches1 . '=$matches[1]&gd_neighbourhood=$matches[2]'; | |
| 297 | + $newrules[$location_prefix.'/([^/]+)/([^/]+)/?$'] = 'index.php?page_id='.$alt_page_id.'&'.$matches1.'=$matches[1]&gd_neighbourhood=$matches[2]'; | |
| 298 | 298 | } | 
| 299 | 299 | } | 
| 300 | 300 | |
| 301 | - $newrules[$location_prefix . '/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&' . $matches1 . '=$matches[1]'; | |
| 301 | + $newrules[$location_prefix.'/([^/]+)/?$'] = 'index.php?page_id='.$alt_page_id.'&'.$matches1.'=$matches[1]'; | |
| 302 | 302 |  				} else { // country/region/city
 | 
| 303 | 303 |  					if ($neighbourhood_active) {
 | 
| 304 | - $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]'; | |
| 304 | + $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]'; | |
| 305 | 305 | } | 
| 306 | - $newrules[$location_prefix . '/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&gd_country=$matches[1]&gd_region=$matches[2]&gd_city=$matches[3]'; | |
| 307 | - $newrules[$location_prefix . '/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&gd_country=$matches[1]&gd_region=$matches[2]'; | |
| 308 | - $newrules[$location_prefix . '/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&gd_country=$matches[1]'; | |
| 306 | + $newrules[$location_prefix.'/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id='.$alt_page_id.'&gd_country=$matches[1]&gd_region=$matches[2]&gd_city=$matches[3]'; | |
| 307 | + $newrules[$location_prefix.'/([^/]+)/([^/]+)/?$'] = 'index.php?page_id='.$alt_page_id.'&gd_country=$matches[1]&gd_region=$matches[2]'; | |
| 308 | + $newrules[$location_prefix.'/([^/]+)/?$'] = 'index.php?page_id='.$alt_page_id.'&gd_country=$matches[1]'; | |
| 309 | 309 | } | 
| 310 | 310 | } | 
| 311 | 311 | } | 
| 312 | 312 | } | 
| 313 | 313 | |
| 314 | - $newrules[$location_prefix . '/?$'] = 'index.php?page_id=' . $location_page; | |
| 314 | + $newrules[$location_prefix.'/?$'] = 'index.php?page_id='.$location_page; | |
| 315 | 315 | |
| 316 | 316 | $rules = array_merge($newrules, $rules); | 
| 317 | 317 | return $rules; | 
| @@ -340,7 +340,7 @@ discard block | ||
| 340 | 340 | #Redirect 301 /location/ /$location_prefix/ | 
| 341 | 341 | # END GeoDirectory Rules\n\n | 
| 342 | 342 | EOD; | 
| 343 | - return $my_content . $rules; | |
| 343 | + return $my_content.$rules; | |
| 344 | 344 | } | 
| 345 | 345 |  //add_filter('mod_rewrite_rules', 'geodir_htaccess_contents');
 | 
| 346 | 346 | |
| @@ -416,12 +416,12 @@ discard block | ||
| 416 | 416 | global $wpdb; | 
| 417 | 417 | |
| 418 | 418 |          $page_for_posts = get_option('page_for_posts');
 | 
| 419 | -        $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']));
 | |
| 419 | +        $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']));
 | |
| 420 | 420 | |
| 421 | 421 |          if (function_exists('icl_object_id')) {
 | 
| 422 | 422 | $real_page_id = icl_object_id($real_page_id, 'page', true, ICL_LANGUAGE_CODE); | 
| 423 | 423 | } | 
| 424 | -        if ($real_page_id && $real_page_id!=$page_for_posts) {
 | |
| 424 | +        if ($real_page_id && $real_page_id != $page_for_posts) {
 | |
| 425 | 425 | $wp->query_vars['page_id'] = $real_page_id; | 
| 426 | 426 | } | 
| 427 | 427 | } | 
| @@ -469,7 +469,7 @@ discard block | ||
| 469 | 469 | $gd_city = $default_location->city_slug; | 
| 470 | 470 | |
| 471 | 471 |                          $base_location_link = geodir_get_location_link('base');
 | 
| 472 | - wp_redirect($base_location_link . '/' . $gd_country . '/' . $gd_region . '/' . $gd_city); | |
| 472 | + wp_redirect($base_location_link.'/'.$gd_country.'/'.$gd_region.'/'.$gd_city); | |
| 473 | 473 | exit(); | 
| 474 | 474 | } | 
| 475 | 475 | } | 
| @@ -530,7 +530,7 @@ discard block | ||
| 530 | 530 | $geodir_set_location_session = true; | 
| 531 | 531 |          $geodir_taxonomis = geodir_get_taxonomies('', true);
 | 
| 532 | 532 | |
| 533 | -        if(!empty($geodir_taxonomis)){
 | |
| 533 | +        if (!empty($geodir_taxonomis)) {
 | |
| 534 | 534 |              foreach ($geodir_taxonomis as $taxonomy) {
 | 
| 535 | 535 |                  if (array_key_exists($taxonomy, $wp->query_vars)) {
 | 
| 536 | 536 | $is_geodir_taxonomy = true; | 
| @@ -587,7 +587,7 @@ discard block | ||
| 587 | 587 | } | 
| 588 | 588 | |
| 589 | 589 | |
| 590 | -				$geodir_term = str_replace('/' . $geodir_last_term, '', $geodir_term, $post_title_replace_count);
 | |
| 590 | +				$geodir_term = str_replace('/'.$geodir_last_term, '', $geodir_term, $post_title_replace_count);
 | |
| 591 | 591 | if (!$post_title_replace_count) | 
| 592 | 592 | $geodir_term = str_replace($geodir_last_term, '', $geodir_term, $post_title_replace_count); | 
| 593 | 593 |  				$geodir_terms = explode('/', $geodir_term);
 | 
| @@ -664,7 +664,7 @@ discard block | ||
| 664 | 664 | if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country)) | 
| 665 | 665 | $is_geodir_location_found = true; | 
| 666 | 666 | } | 
| 667 | -                }  else if ($geodir_show_location_url == 'region_city') {
 | |
| 667 | +                } else if ($geodir_show_location_url == 'region_city') {
 | |
| 668 | 668 |                      if (count($geodir_terms) >= 2) {
 | 
| 669 | 669 | $gd_region = urldecode($geodir_terms[0]); | 
| 670 | 670 | $gd_city = urldecode($geodir_terms[1]); | 
| @@ -723,13 +723,13 @@ discard block | ||
| 723 | 723 | $wp->query_vars[$geodir_taxonomy] = $geodir_term; | 
| 724 | 724 | // eliminate location related terms from taxonomy term | 
| 725 | 725 | if ($gd_country != '') | 
| 726 | -                $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_country) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
 | |
| 726 | +                $wp->query_vars[$geodir_taxonomy] = preg_replace('/'.urlencode($gd_country).'/', '', $wp->query_vars[$geodir_taxonomy], 1);
 | |
| 727 | 727 | |
| 728 | 728 | if ($gd_region != '') | 
| 729 | -                $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_region) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
 | |
| 729 | +                $wp->query_vars[$geodir_taxonomy] = preg_replace('/'.urlencode($gd_region).'/', '', $wp->query_vars[$geodir_taxonomy], 1);
 | |
| 730 | 730 | |
| 731 | 731 | if ($gd_city != '') | 
| 732 | -                $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_city) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
 | |
| 732 | +                $wp->query_vars[$geodir_taxonomy] = preg_replace('/'.urlencode($gd_city).'/', '', $wp->query_vars[$geodir_taxonomy], 1);
 | |
| 733 | 733 | |
| 734 | 734 | |
| 735 | 735 |              $wp->query_vars[$geodir_taxonomy] = str_replace('///', '', $wp->query_vars[$geodir_taxonomy]);
 | 
| @@ -914,16 +914,16 @@ discard block | ||
| 914 | 914 | * @param string $option Option name. | 
| 915 | 915 | * @return mixed The taxonomy option value. | 
| 916 | 916 | */ | 
| 917 | -function geodir_wpseo_taxonomy_meta( $value, $option = '' ) {
 | |
| 917 | +function geodir_wpseo_taxonomy_meta($value, $option = '') {
 | |
| 918 | 918 | global $wp_query; | 
| 919 | 919 | |
| 920 | -    if ( !empty( $value ) && ( is_category() || is_tax() ) ) {
 | |
| 920 | +    if (!empty($value) && (is_category() || is_tax())) {
 | |
| 921 | 921 | $term = $wp_query->get_queried_object(); | 
| 922 | 922 | |
| 923 | -        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() ) ) {
 | |
| 924 | - $image = geodir_get_default_catimage( $term->term_id, str_replace( 'category', '', $term->taxonomy ) ); | |
| 923 | +        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())) {
 | |
| 924 | +            $image = geodir_get_default_catimage($term->term_id, str_replace('category', '', $term->taxonomy));
 | |
| 925 | 925 | |
| 926 | -            if ( !empty( $image['src'] ) ) {
 | |
| 926 | +            if (!empty($image['src'])) {
 | |
| 927 | 927 | $value[$term->taxonomy][$term->term_id]['wpseo_twitter-image'] = $image['src']; | 
| 928 | 928 | $value[$term->taxonomy][$term->term_id]['wpseo_opengraph-image'] = $image['src']; | 
| 929 | 929 | } | 
| @@ -931,4 +931,4 @@ discard block | ||
| 931 | 931 | } | 
| 932 | 932 | return $value; | 
| 933 | 933 | } | 
| 934 | -add_filter( 'option_wpseo_taxonomy_meta', 'geodir_wpseo_taxonomy_meta', 10, 2 ); | |
| 934 | +add_filter('option_wpseo_taxonomy_meta', 'geodir_wpseo_taxonomy_meta', 10, 2);
 | |
| @@ -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 | |
| @@ -53,40 +53,40 @@ discard block | ||
| 53 | 53 | */ | 
| 54 | 54 | function geodir_register_post_types() | 
| 55 | 55 |  {
 | 
| 56 | - global $wp_post_types; | |
| 56 | + global $wp_post_types; | |
| 57 | 57 | |
| 58 | - $post_types = array(); | |
| 59 | -    $post_types = get_option('geodir_post_types');
 | |
| 58 | + $post_types = array(); | |
| 59 | +	$post_types = get_option('geodir_post_types');
 | |
| 60 | 60 | |
| 61 | - // Register each post type if array of data is returned | |
| 62 | - if (is_array($post_types)): | |
| 61 | + // Register each post type if array of data is returned | |
| 62 | + if (is_array($post_types)): | |
| 63 | 63 | |
| 64 | - foreach ($post_types as $post_type => $args): | |
| 64 | + foreach ($post_types as $post_type => $args): | |
| 65 | 65 | |
| 66 | -            if (!empty($args['rewrite']['slug'])) {
 | |
| 67 | - $args['rewrite']['slug'] = _x($args['rewrite']['slug'], 'URL slug', 'geodirectory'); | |
| 68 | - } | |
| 69 | - $args = stripslashes_deep($args); | |
| 66 | +			if (!empty($args['rewrite']['slug'])) {
 | |
| 67 | + $args['rewrite']['slug'] = _x($args['rewrite']['slug'], 'URL slug', 'geodirectory'); | |
| 68 | + } | |
| 69 | + $args = stripslashes_deep($args); | |
| 70 | 70 | |
| 71 | -            if (!empty($args['labels'])) {
 | |
| 72 | -                foreach ($args['labels'] as $key => $val) {
 | |
| 73 | - $args['labels'][$key] = __($val, 'geodirectory');// allow translation | |
| 74 | - } | |
| 75 | - } | |
| 71 | +			if (!empty($args['labels'])) {
 | |
| 72 | +				foreach ($args['labels'] as $key => $val) {
 | |
| 73 | + $args['labels'][$key] = __($val, 'geodirectory');// allow translation | |
| 74 | + } | |
| 75 | + } | |
| 76 | 76 | |
| 77 | - /** | |
| 78 | - * Filter post type args. | |
| 79 | - * | |
| 80 | - * @since 1.0.0 | |
| 81 | - * @param string $args Post type args. | |
| 82 | - * @param string $post_type The post type. | |
| 83 | - */ | |
| 84 | -            $args = apply_filters('geodir_post_type_args', $args, $post_type);
 | |
| 77 | + /** | |
| 78 | + * Filter post type args. | |
| 79 | + * | |
| 80 | + * @since 1.0.0 | |
| 81 | + * @param string $args Post type args. | |
| 82 | + * @param string $post_type The post type. | |
| 83 | + */ | |
| 84 | +			$args = apply_filters('geodir_post_type_args', $args, $post_type);
 | |
| 85 | 85 | |
| 86 | - $post_type = register_post_type($post_type, $args); | |
| 86 | + $post_type = register_post_type($post_type, $args); | |
| 87 | 87 | |
| 88 | - endforeach; | |
| 89 | - endif; | |
| 88 | + endforeach; | |
| 89 | + endif; | |
| 90 | 90 | } | 
| 91 | 91 | |
| 92 | 92 | /** | 
| @@ -100,72 +100,72 @@ discard block | ||
| 100 | 100 | */ | 
| 101 | 101 | function geodir_post_type_args_modify($args, $post_type) | 
| 102 | 102 |  {
 | 
| 103 | -    $geodir_location_prefix = isset($_REQUEST['geodir_location_prefix']) ? trim($_REQUEST['geodir_location_prefix']) : get_option('geodir_location_prefix');
 | |
| 103 | +	$geodir_location_prefix = isset($_REQUEST['geodir_location_prefix']) ? trim($_REQUEST['geodir_location_prefix']) : get_option('geodir_location_prefix');
 | |
| 104 | 104 |  	if (isset($_REQUEST['geodir_listing_prefix']) && $_REQUEST['geodir_listing_prefix'] != '' && geodir_strtolower($_REQUEST['geodir_listing_prefix']) != geodir_strtolower($geodir_location_prefix)) {
 | 
| 105 | 105 | |
| 106 | - $listing_slug = htmlentities(trim($_REQUEST['geodir_listing_prefix'])); | |
| 106 | + $listing_slug = htmlentities(trim($_REQUEST['geodir_listing_prefix'])); | |
| 107 | 107 | |
| 108 | -        if ($post_type == 'gd_place') {
 | |
| 109 | -            if (array_key_exists('has_archive', $args))
 | |
| 110 | - $args['has_archive'] = $listing_slug; | |
| 108 | +		if ($post_type == 'gd_place') {
 | |
| 109 | +			if (array_key_exists('has_archive', $args))
 | |
| 110 | + $args['has_archive'] = $listing_slug; | |
| 111 | 111 | |
| 112 | -            if (array_key_exists('rewrite', $args)) {
 | |
| 113 | -                if (array_key_exists('slug', $args['rewrite']))
 | |
| 114 | - $args['rewrite']['slug'] = $listing_slug;// . '/%gd_taxonomy%'; | |
| 115 | - } | |
| 112 | +			if (array_key_exists('rewrite', $args)) {
 | |
| 113 | +				if (array_key_exists('slug', $args['rewrite']))
 | |
| 114 | + $args['rewrite']['slug'] = $listing_slug;// . '/%gd_taxonomy%'; | |
| 115 | + } | |
| 116 | 116 | |
| 117 | -            $geodir_post_types = get_option('geodir_post_types');
 | |
| 117 | +			$geodir_post_types = get_option('geodir_post_types');
 | |
| 118 | 118 | |
| 119 | -            if (array_key_exists($post_type, $geodir_post_types)) {
 | |
| 119 | +			if (array_key_exists($post_type, $geodir_post_types)) {
 | |
| 120 | 120 | |
| 121 | -                if (array_key_exists('has_archive', $geodir_post_types[$post_type]))
 | |
| 122 | - $geodir_post_types[$post_type]['has_archive'] = $listing_slug; | |
| 121 | +				if (array_key_exists('has_archive', $geodir_post_types[$post_type]))
 | |
| 122 | + $geodir_post_types[$post_type]['has_archive'] = $listing_slug; | |
| 123 | 123 | |
| 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%'; | |
| 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%'; | |
| 127 | 127 | |
| 128 | -                update_option('geodir_post_types', $geodir_post_types);
 | |
| 128 | +				update_option('geodir_post_types', $geodir_post_types);
 | |
| 129 | 129 | |
| 130 | - } | |
| 130 | + } | |
| 131 | 131 | |
| 132 | -            $geodir_post_types = get_option('geodir_post_types');
 | |
| 132 | +			$geodir_post_types = get_option('geodir_post_types');
 | |
| 133 | 133 | |
| 134 | - /* --- update taxonomies (category) --- */ | |
| 134 | + /* --- update taxonomies (category) --- */ | |
| 135 | 135 | |
| 136 | -            $geodir_taxonomies = get_option('geodir_taxonomies');
 | |
| 136 | +			$geodir_taxonomies = get_option('geodir_taxonomies');
 | |
| 137 | 137 | |
| 138 | -            if (array_key_exists('listing_slug', $geodir_taxonomies[$post_type . 'category'])) {
 | |
| 139 | - $geodir_taxonomies[$post_type . 'category']['listing_slug'] = $listing_slug; | |
| 138 | +			if (array_key_exists('listing_slug', $geodir_taxonomies[$post_type . 'category'])) {
 | |
| 139 | + $geodir_taxonomies[$post_type . 'category']['listing_slug'] = $listing_slug; | |
| 140 | 140 | |
| 141 | -                if (array_key_exists('args', $geodir_taxonomies[$post_type . 'category']))
 | |
| 142 | -                    if (array_key_exists('rewrite', $geodir_taxonomies[$post_type . 'category']['args']))
 | |
| 143 | -                        if (array_key_exists('slug', $geodir_taxonomies[$post_type . 'category']['args']['rewrite']))
 | |
| 144 | - $geodir_taxonomies[$post_type . 'category']['args']['rewrite']['slug'] = $listing_slug; | |
| 141 | +				if (array_key_exists('args', $geodir_taxonomies[$post_type . 'category']))
 | |
| 142 | +					if (array_key_exists('rewrite', $geodir_taxonomies[$post_type . 'category']['args']))
 | |
| 143 | +						if (array_key_exists('slug', $geodir_taxonomies[$post_type . 'category']['args']['rewrite']))
 | |
| 144 | + $geodir_taxonomies[$post_type . 'category']['args']['rewrite']['slug'] = $listing_slug; | |
| 145 | 145 | |
| 146 | -                update_option('geodir_taxonomies', $geodir_taxonomies);
 | |
| 146 | +				update_option('geodir_taxonomies', $geodir_taxonomies);
 | |
| 147 | 147 | |
| 148 | - } | |
| 148 | + } | |
| 149 | 149 | |
| 150 | - /* --- update taxonomies (tags) --- */ | |
| 151 | -            $geodir_taxonomies_tag = get_option('geodir_taxonomies');
 | |
| 152 | -            if (array_key_exists('listing_slug', $geodir_taxonomies_tag[$post_type . '_tags'])) {
 | |
| 153 | - $geodir_taxonomies_tag[$post_type . '_tags']['listing_slug'] = $listing_slug . '/tags'; | |
| 150 | + /* --- update taxonomies (tags) --- */ | |
| 151 | +			$geodir_taxonomies_tag = get_option('geodir_taxonomies');
 | |
| 152 | +			if (array_key_exists('listing_slug', $geodir_taxonomies_tag[$post_type . '_tags'])) {
 | |
| 153 | + $geodir_taxonomies_tag[$post_type . '_tags']['listing_slug'] = $listing_slug . '/tags'; | |
| 154 | 154 | |
| 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']))
 | |
| 157 | -                        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'; | |
| 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']))
 | |
| 157 | +						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'; | |
| 159 | 159 | |
| 160 | -                update_option('geodir_taxonomies', $geodir_taxonomies_tag);
 | |
| 160 | +				update_option('geodir_taxonomies', $geodir_taxonomies_tag);
 | |
| 161 | 161 | |
| 162 | - } | |
| 162 | + } | |
| 163 | 163 | |
| 164 | - } | |
| 164 | + } | |
| 165 | 165 | |
| 166 | - } | |
| 166 | + } | |
| 167 | 167 | |
| 168 | - return $args; | |
| 168 | + return $args; | |
| 169 | 169 | } | 
| 170 | 170 | |
| 171 | 171 | /** | 
| @@ -178,8 +178,8 @@ discard block | ||
| 178 | 178 | */ | 
| 179 | 179 | function geodir_flush_rewrite_rules() | 
| 180 | 180 |  {
 | 
| 181 | - global $wp_rewrite; | |
| 182 | - $wp_rewrite->flush_rules(false); | |
| 181 | + global $wp_rewrite; | |
| 182 | + $wp_rewrite->flush_rules(false); | |
| 183 | 183 | } | 
| 184 | 184 | |
| 185 | 185 | /** | 
| @@ -194,35 +194,35 @@ discard block | ||
| 194 | 194 | * @return array Rewrite rules. | 
| 195 | 195 | */ | 
| 196 | 196 |  function geodir_listing_rewrite_rules($rules) {
 | 
| 197 | - $newrules = array(); | |
| 198 | -    $taxonomies = get_option('geodir_taxonomies');
 | |
| 199 | -    $detail_url_seprator = get_option('geodir_detailurl_separator');
 | |
| 197 | + $newrules = array(); | |
| 198 | +	$taxonomies = get_option('geodir_taxonomies');
 | |
| 199 | +	$detail_url_seprator = get_option('geodir_detailurl_separator');
 | |
| 200 | 200 | |
| 201 | 201 | // create rules for post listing | 
| 202 | - if (is_array($taxonomies)): | |
| 203 | - foreach ($taxonomies as $taxonomy => $args): | |
| 204 | - $post_type = $args['object_type']; | |
| 205 | - $listing_slug = $args['listing_slug']; | |
| 206 | - | |
| 207 | -            if (strpos($taxonomy, 'tags')) {
 | |
| 208 | -                $newrules[$listing_slug . '/(.+?)/page/?([0-9]{1,})/?$'] = 'index.php?' . $taxonomy . '=$matches[1]&paged=$matches[2]';
 | |
| 209 | - $newrules[$listing_slug . '/(.+?)/?$'] = 'index.php?' . $taxonomy . '=$matches[1]'; | |
| 210 | -            } else {
 | |
| 211 | - // use this loop to add paging for details page comments paging | |
| 212 | -                $newrules[str_replace("/tags","",$listing_slug) . '/(.+?)/comment-page-([0-9]{1,})/?$'] = 'index.php?' . $taxonomy . '=$matches[1]&cpage=$matches[2]';
 | |
| 213 | - } | |
| 214 | - endforeach; | |
| 215 | - endif; | |
| 216 | - | |
| 217 | - // create rules for location listing | |
| 218 | -    $location_page = get_option('geodir_location_page');
 | |
| 202 | + if (is_array($taxonomies)): | |
| 203 | + foreach ($taxonomies as $taxonomy => $args): | |
| 204 | + $post_type = $args['object_type']; | |
| 205 | + $listing_slug = $args['listing_slug']; | |
| 206 | + | |
| 207 | +			if (strpos($taxonomy, 'tags')) {
 | |
| 208 | +				$newrules[$listing_slug . '/(.+?)/page/?([0-9]{1,})/?$'] = 'index.php?' . $taxonomy . '=$matches[1]&paged=$matches[2]';
 | |
| 209 | + $newrules[$listing_slug . '/(.+?)/?$'] = 'index.php?' . $taxonomy . '=$matches[1]'; | |
| 210 | +			} else {
 | |
| 211 | + // use this loop to add paging for details page comments paging | |
| 212 | +				$newrules[str_replace("/tags","",$listing_slug) . '/(.+?)/comment-page-([0-9]{1,})/?$'] = 'index.php?' . $taxonomy . '=$matches[1]&cpage=$matches[2]';
 | |
| 213 | + } | |
| 214 | + endforeach; | |
| 215 | + endif; | |
| 216 | + | |
| 217 | + // create rules for location listing | |
| 218 | +	$location_page = get_option('geodir_location_page');
 | |
| 219 | 219 | |
| 220 | -    if($location_page) {
 | |
| 221 | - global $wpdb; | |
| 222 | -        $location_prefix = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_type='page' AND ID=%d", $location_page));
 | |
| 223 | - } | |
| 224 | - if (!isset($location_prefix)) | |
| 225 | - $location_prefix = 'location'; | |
| 220 | +	if($location_page) {
 | |
| 221 | + global $wpdb; | |
| 222 | +		$location_prefix = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_type='page' AND ID=%d", $location_page));
 | |
| 223 | + } | |
| 224 | + if (!isset($location_prefix)) | |
| 225 | + $location_prefix = 'location'; | |
| 226 | 226 | |
| 227 | 227 |  	$location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
 | 
| 228 | 228 |  	if ($location_manager) {
 | 
| @@ -266,12 +266,12 @@ discard block | ||
| 266 | 266 | $newrules[$location_prefix . '/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&gd_country=$matches[1]'; | 
| 267 | 267 | } | 
| 268 | 268 | |
| 269 | -    if ($location_page && function_exists('icl_object_id')) {
 | |
| 270 | -        foreach(icl_get_languages('skip_missing=N') as $lang){
 | |
| 271 | - $alt_page_id = ''; | |
| 272 | - $alt_page_id = icl_object_id($location_page, 'page', false,$lang['language_code']); | |
| 273 | -            if($alt_page_id){
 | |
| 274 | -                $location_prefix = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_type='page' AND ID=%d", $alt_page_id));
 | |
| 269 | +	if ($location_page && function_exists('icl_object_id')) {
 | |
| 270 | +		foreach(icl_get_languages('skip_missing=N') as $lang){
 | |
| 271 | + $alt_page_id = ''; | |
| 272 | + $alt_page_id = icl_object_id($location_page, 'page', false,$lang['language_code']); | |
| 273 | +			if($alt_page_id){
 | |
| 274 | +				$location_prefix = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_type='page' AND ID=%d", $alt_page_id));
 | |
| 275 | 275 | |
| 276 | 276 |  				if ($location_manager && ($hide_country_part || $hide_region_part)) {
 | 
| 277 | 277 | $matches2 = ''; | 
| @@ -307,14 +307,14 @@ discard block | ||
| 307 | 307 | $newrules[$location_prefix . '/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&gd_country=$matches[1]&gd_region=$matches[2]'; | 
| 308 | 308 | $newrules[$location_prefix . '/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&gd_country=$matches[1]'; | 
| 309 | 309 | } | 
| 310 | - } | |
| 311 | - } | |
| 312 | - } | |
| 310 | + } | |
| 311 | + } | |
| 312 | + } | |
| 313 | 313 | |
| 314 | - $newrules[$location_prefix . '/?$'] = 'index.php?page_id=' . $location_page; | |
| 314 | + $newrules[$location_prefix . '/?$'] = 'index.php?page_id=' . $location_page; | |
| 315 | 315 | |
| 316 | - $rules = array_merge($newrules, $rules); | |
| 317 | - return $rules; | |
| 316 | + $rules = array_merge($newrules, $rules); | |
| 317 | + return $rules; | |
| 318 | 318 | } | 
| 319 | 319 | |
| 320 | 320 | /** | 
| @@ -329,18 +329,18 @@ discard block | ||
| 329 | 329 | */ | 
| 330 | 330 | function geodir_htaccess_contents($rules) | 
| 331 | 331 |  {
 | 
| 332 | - global $wpdb; | |
| 333 | -    $location_prefix = get_option('geodir_location_prefix');
 | |
| 334 | - // if location page slug changed then add redirect | |
| 335 | -    if ($location_prefix == 'location') {
 | |
| 336 | - return $rules; | |
| 337 | - } | |
| 338 | - $my_content = <<<EOD | |
| 332 | + global $wpdb; | |
| 333 | +	$location_prefix = get_option('geodir_location_prefix');
 | |
| 334 | + // if location page slug changed then add redirect | |
| 335 | +	if ($location_prefix == 'location') {
 | |
| 336 | + return $rules; | |
| 337 | + } | |
| 338 | + $my_content = <<<EOD | |
| 339 | 339 | \n# BEGIN GeoDirectory Rules | 
| 340 | 340 | #Redirect 301 /location/ /$location_prefix/ | 
| 341 | 341 | # END GeoDirectory Rules\n\n | 
| 342 | 342 | EOD; | 
| 343 | - return $my_content . $rules; | |
| 343 | + return $my_content . $rules; | |
| 344 | 344 | } | 
| 345 | 345 |  //add_filter('mod_rewrite_rules', 'geodir_htaccess_contents');
 | 
| 346 | 346 | |
| @@ -354,10 +354,10 @@ discard block | ||
| 354 | 354 | */ | 
| 355 | 355 | function geodir_add_location_var($public_query_vars) | 
| 356 | 356 |  {
 | 
| 357 | - $public_query_vars[] = 'gd_country'; | |
| 358 | - $public_query_vars[] = 'gd_region'; | |
| 359 | - $public_query_vars[] = 'gd_city'; | |
| 360 | - return $public_query_vars; | |
| 357 | + $public_query_vars[] = 'gd_country'; | |
| 358 | + $public_query_vars[] = 'gd_region'; | |
| 359 | + $public_query_vars[] = 'gd_city'; | |
| 360 | + return $public_query_vars; | |
| 361 | 361 | } | 
| 362 | 362 | |
| 363 | 363 | /** | 
| @@ -370,8 +370,8 @@ discard block | ||
| 370 | 370 | */ | 
| 371 | 371 | function geodir_add_geodir_page_var($public_query_vars) | 
| 372 | 372 |  {
 | 
| 373 | - $public_query_vars[] = 'gd_is_geodir_page'; | |
| 374 | - return $public_query_vars; | |
| 373 | + $public_query_vars[] = 'gd_is_geodir_page'; | |
| 374 | + return $public_query_vars; | |
| 375 | 375 | } | 
| 376 | 376 | |
| 377 | 377 | /** | 
| @@ -383,20 +383,20 @@ discard block | ||
| 383 | 383 | */ | 
| 384 | 384 | function geodir_add_page_id_in_query_var() | 
| 385 | 385 |  {
 | 
| 386 | - global $wp_query; | |
| 386 | + global $wp_query; | |
| 387 | 387 | |
| 388 | - $page_id = $wp_query->get_queried_object_id(); | |
| 388 | + $page_id = $wp_query->get_queried_object_id(); | |
| 389 | 389 | |
| 390 | -    if (!get_query_var('page_id') && !is_archive()) {
 | |
| 391 | - // fix for WP tags conflict with enfold theme | |
| 392 | - $theme_name = geodir_strtolower(wp_get_theme()); | |
| 393 | -        if (!geodir_is_geodir_page() && strpos($theme_name, 'enfold') !== false) {
 | |
| 394 | - return $wp_query; | |
| 395 | - } | |
| 396 | -        $wp_query->set('page_id', $page_id);
 | |
| 397 | - } | |
| 390 | +	if (!get_query_var('page_id') && !is_archive()) {
 | |
| 391 | + // fix for WP tags conflict with enfold theme | |
| 392 | + $theme_name = geodir_strtolower(wp_get_theme()); | |
| 393 | +		if (!geodir_is_geodir_page() && strpos($theme_name, 'enfold') !== false) {
 | |
| 394 | + return $wp_query; | |
| 395 | + } | |
| 396 | +		$wp_query->set('page_id', $page_id);
 | |
| 397 | + } | |
| 398 | 398 | |
| 399 | - return $wp_query; | |
| 399 | + return $wp_query; | |
| 400 | 400 | } | 
| 401 | 401 | |
| 402 | 402 | /** | 
| @@ -411,23 +411,23 @@ discard block | ||
| 411 | 411 |  function geodir_set_location_var_in_session_in_core($wp) {
 | 
| 412 | 412 | global $gd_session; | 
| 413 | 413 | |
| 414 | - // Fix for WPML removing page_id query var: | |
| 415 | -    if (isset($wp->query_vars['page']) && !isset($wp->query_vars['page_id']) && isset($wp->query_vars['pagename']) && !is_home()) {
 | |
| 416 | - global $wpdb; | |
| 414 | + // Fix for WPML removing page_id query var: | |
| 415 | +	if (isset($wp->query_vars['page']) && !isset($wp->query_vars['page_id']) && isset($wp->query_vars['pagename']) && !is_home()) {
 | |
| 416 | + global $wpdb; | |
| 417 | 417 | |
| 418 | -        $page_for_posts = get_option('page_for_posts');
 | |
| 419 | -        $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 | +		$page_for_posts = get_option('page_for_posts');
 | |
| 419 | +		$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']));
 | |
| 420 | 420 | |
| 421 | -        if (function_exists('icl_object_id')) {
 | |
| 422 | - $real_page_id = icl_object_id($real_page_id, 'page', true, ICL_LANGUAGE_CODE); | |
| 423 | - } | |
| 424 | -        if ($real_page_id && $real_page_id!=$page_for_posts) {
 | |
| 425 | - $wp->query_vars['page_id'] = $real_page_id; | |
| 426 | - } | |
| 427 | - } | |
| 421 | +		if (function_exists('icl_object_id')) {
 | |
| 422 | + $real_page_id = icl_object_id($real_page_id, 'page', true, ICL_LANGUAGE_CODE); | |
| 423 | + } | |
| 424 | +		if ($real_page_id && $real_page_id!=$page_for_posts) {
 | |
| 425 | + $wp->query_vars['page_id'] = $real_page_id; | |
| 426 | + } | |
| 427 | + } | |
| 428 | 428 | // Query Vars will have page_id parameter | 
| 429 | 429 | // check if query var has page_id and that page id is location page | 
| 430 | - geodir_set_is_geodir_page($wp); | |
| 430 | + geodir_set_is_geodir_page($wp); | |
| 431 | 431 | // if is GD homepage set the page ID | 
| 432 | 432 |  	if (geodir_is_page('home')) {
 | 
| 433 | 433 |  		$wp->query_vars['page_id'] = get_option('page_on_front');
 | 
| @@ -436,118 +436,118 @@ discard block | ||
| 436 | 436 | // The location url format (all or country_city or region_city or city). | 
| 437 | 437 |  	$geodir_show_location_url = get_option('geodir_show_location_url');
 | 
| 438 | 438 | |
| 439 | -    if (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_location_page_id()) {
 | |
| 440 | - $gd_country = ''; | |
| 441 | - $gd_region = ''; | |
| 442 | - $gd_city = ''; | |
| 443 | - if (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') | |
| 444 | - $gd_country = urldecode($wp->query_vars['gd_country']); | |
| 445 | - | |
| 446 | - if (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') | |
| 447 | - $gd_region = urldecode($wp->query_vars['gd_region']); | |
| 448 | - | |
| 449 | - if (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') | |
| 450 | - $gd_city = urldecode($wp->query_vars['gd_city']); | |
| 451 | - | |
| 452 | -        if (!($gd_country == '' && $gd_region == '' && $gd_city == '')) {
 | |
| 453 | - $default_location = geodir_get_default_location(); | |
| 454 | - | |
| 455 | -            if (get_option('geodir_add_location_url')) {
 | |
| 456 | -                if ($geodir_show_location_url != 'all') {
 | |
| 457 | -                    if ($gd_region == '') {
 | |
| 458 | -                        if ($gd_ses_region = $gd_session->get('gd_region'))
 | |
| 459 | - $gd_region = $gd_ses_region; | |
| 460 | - else | |
| 461 | - $gd_region = $default_location->region_slug; | |
| 462 | - } | |
| 463 | - | |
| 464 | -                    if ($gd_city == '') {
 | |
| 465 | -                        if ($gd_ses_city = $gd_session->get('gd_city'))
 | |
| 466 | - $gd_city = $gd_ses_city; | |
| 467 | - else | |
| 468 | - $gd_city = $default_location->city_slug; | |
| 469 | - | |
| 470 | -                        $base_location_link = geodir_get_location_link('base');
 | |
| 471 | - wp_redirect($base_location_link . '/' . $gd_country . '/' . $gd_region . '/' . $gd_city); | |
| 472 | - exit(); | |
| 473 | - } | |
| 474 | - } | |
| 475 | - } | |
| 476 | - | |
| 477 | - $args = array( | |
| 478 | - 'what' => 'city', | |
| 479 | - 'city_val' => $gd_city, | |
| 480 | - 'region_val' => $gd_region, | |
| 481 | - 'country_val' => $gd_country, | |
| 482 | - 'country_column_name' => 'country_slug', | |
| 483 | - 'region_column_name' => 'region_slug', | |
| 484 | - 'city_column_name' => 'city_slug', | |
| 485 | - 'location_link_part' => false, | |
| 486 | - 'compare_operator' => '' | |
| 487 | - ); | |
| 488 | - | |
| 489 | -            $location_array = function_exists('geodir_get_location_array') ? geodir_get_location_array($args) : array();
 | |
| 490 | -            if (!empty($location_array)) {
 | |
| 491 | -                $gd_session->set('gd_multi_location', 1);
 | |
| 492 | -                $gd_session->set('gd_country', $gd_country);
 | |
| 493 | -                $gd_session->set('gd_region', $gd_region);
 | |
| 494 | -                $gd_session->set('gd_city', $gd_city);
 | |
| 439 | +	if (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_location_page_id()) {
 | |
| 440 | + $gd_country = ''; | |
| 441 | + $gd_region = ''; | |
| 442 | + $gd_city = ''; | |
| 443 | + if (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') | |
| 444 | + $gd_country = urldecode($wp->query_vars['gd_country']); | |
| 445 | + | |
| 446 | + if (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') | |
| 447 | + $gd_region = urldecode($wp->query_vars['gd_region']); | |
| 448 | + | |
| 449 | + if (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') | |
| 450 | + $gd_city = urldecode($wp->query_vars['gd_city']); | |
| 451 | + | |
| 452 | +		if (!($gd_country == '' && $gd_region == '' && $gd_city == '')) {
 | |
| 453 | + $default_location = geodir_get_default_location(); | |
| 454 | + | |
| 455 | +			if (get_option('geodir_add_location_url')) {
 | |
| 456 | +				if ($geodir_show_location_url != 'all') {
 | |
| 457 | +					if ($gd_region == '') {
 | |
| 458 | +						if ($gd_ses_region = $gd_session->get('gd_region'))
 | |
| 459 | + $gd_region = $gd_ses_region; | |
| 460 | + else | |
| 461 | + $gd_region = $default_location->region_slug; | |
| 462 | + } | |
| 463 | + | |
| 464 | +					if ($gd_city == '') {
 | |
| 465 | +						if ($gd_ses_city = $gd_session->get('gd_city'))
 | |
| 466 | + $gd_city = $gd_ses_city; | |
| 467 | + else | |
| 468 | + $gd_city = $default_location->city_slug; | |
| 469 | + | |
| 470 | +						$base_location_link = geodir_get_location_link('base');
 | |
| 471 | + wp_redirect($base_location_link . '/' . $gd_country . '/' . $gd_region . '/' . $gd_city); | |
| 472 | + exit(); | |
| 473 | + } | |
| 474 | + } | |
| 475 | + } | |
| 476 | + | |
| 477 | + $args = array( | |
| 478 | + 'what' => 'city', | |
| 479 | + 'city_val' => $gd_city, | |
| 480 | + 'region_val' => $gd_region, | |
| 481 | + 'country_val' => $gd_country, | |
| 482 | + 'country_column_name' => 'country_slug', | |
| 483 | + 'region_column_name' => 'region_slug', | |
| 484 | + 'city_column_name' => 'city_slug', | |
| 485 | + 'location_link_part' => false, | |
| 486 | + 'compare_operator' => '' | |
| 487 | + ); | |
| 488 | + | |
| 489 | +			$location_array = function_exists('geodir_get_location_array') ? geodir_get_location_array($args) : array();
 | |
| 490 | +			if (!empty($location_array)) {
 | |
| 491 | +				$gd_session->set('gd_multi_location', 1);
 | |
| 492 | +				$gd_session->set('gd_country', $gd_country);
 | |
| 493 | +				$gd_session->set('gd_region', $gd_region);
 | |
| 494 | +				$gd_session->set('gd_city', $gd_city);
 | |
| 495 | 495 | |
| 496 | 496 | $wp->query_vars['gd_country'] = $gd_country; | 
| 497 | - $wp->query_vars['gd_region'] = $gd_region; | |
| 498 | - $wp->query_vars['gd_city'] = $gd_city; | |
| 499 | -            } else {
 | |
| 500 | -                $gd_session->un_set(array('gd_multi_location', 'gd_city', 'gd_region', 'gd_country'));
 | |
| 501 | - } | |
| 502 | -        } else {
 | |
| 503 | -            $gd_session->un_set(array('gd_multi_location', 'gd_city', 'gd_region', 'gd_country'));
 | |
| 504 | - } | |
| 505 | - | |
| 506 | -    } else if (isset($wp->query_vars['post_type']) && $wp->query_vars['post_type'] != '') {
 | |
| 507 | -        if (!is_admin()) {
 | |
| 508 | - $requested_post_type = $wp->query_vars['post_type']; | |
| 509 | - // check if this post type is geodirectory post types | |
| 510 | - $post_type_array = geodir_get_posttypes(); | |
| 497 | + $wp->query_vars['gd_region'] = $gd_region; | |
| 498 | + $wp->query_vars['gd_city'] = $gd_city; | |
| 499 | +			} else {
 | |
| 500 | +				$gd_session->un_set(array('gd_multi_location', 'gd_city', 'gd_region', 'gd_country'));
 | |
| 501 | + } | |
| 502 | +		} else {
 | |
| 503 | +			$gd_session->un_set(array('gd_multi_location', 'gd_city', 'gd_region', 'gd_country'));
 | |
| 504 | + } | |
| 505 | + | |
| 506 | +	} else if (isset($wp->query_vars['post_type']) && $wp->query_vars['post_type'] != '') {
 | |
| 507 | +		if (!is_admin()) {
 | |
| 508 | + $requested_post_type = $wp->query_vars['post_type']; | |
| 509 | + // check if this post type is geodirectory post types | |
| 510 | + $post_type_array = geodir_get_posttypes(); | |
| 511 | 511 | |
| 512 | 512 |  			if (in_array($requested_post_type, $post_type_array)) {
 | 
| 513 | - // now u can apply geodirectory related manipulation. | |
| 514 | - } | |
| 515 | - } | |
| 516 | -    } else {
 | |
| 517 | - // check if a geodirectory taxonomy is set | |
| 518 | - $gd_country = ''; | |
| 519 | - $gd_region = ''; | |
| 520 | - $gd_city = ''; | |
| 513 | + // now u can apply geodirectory related manipulation. | |
| 514 | + } | |
| 515 | + } | |
| 516 | +	} else {
 | |
| 517 | + // check if a geodirectory taxonomy is set | |
| 518 | + $gd_country = ''; | |
| 519 | + $gd_region = ''; | |
| 520 | + $gd_city = ''; | |
| 521 | 521 | |
| 522 | 522 | $is_geodir_taxonomy = false; | 
| 523 | - $is_geodir_taxonomy_term = false; // the last term is real geodirectory taxonomy term or not | |
| 524 | - $is_geodir_location_found = false; | |
| 523 | + $is_geodir_taxonomy_term = false; // the last term is real geodirectory taxonomy term or not | |
| 524 | + $is_geodir_location_found = false; | |
| 525 | 525 | |
| 526 | 526 | $geodir_taxonomy = ''; | 
| 527 | - $geodir_post_type = ''; | |
| 528 | - $geodir_term = ''; | |
| 529 | - $geodir_set_location_session = true; | |
| 530 | -        $geodir_taxonomis = geodir_get_taxonomies('', true);
 | |
| 531 | - | |
| 532 | -        if(!empty($geodir_taxonomis)){
 | |
| 533 | -            foreach ($geodir_taxonomis as $taxonomy) {
 | |
| 534 | -                if (array_key_exists($taxonomy, $wp->query_vars)) {
 | |
| 535 | - $is_geodir_taxonomy = true; | |
| 536 | - $geodir_taxonomy = $taxonomy; | |
| 537 | -                    $geodir_post_type = str_replace('category', '', $taxonomy);
 | |
| 538 | -                    $geodir_post_type = str_replace('_tags', '', $geodir_post_type);
 | |
| 539 | - $geodir_term = $wp->query_vars[$geodir_taxonomy]; | |
| 540 | - break; | |
| 541 | - } | |
| 542 | - } | |
| 543 | - } | |
| 544 | - | |
| 545 | - // now get an array of all terms seperated by '/' | |
| 546 | -        $geodir_terms = explode('/', $geodir_term);
 | |
| 547 | - $geodir_last_term = end($geodir_terms); | |
| 548 | - | |
| 549 | -        if ($is_geodir_taxonomy) { // do all these only when it is a geodirectory taxonomy
 | |
| 550 | - $wp->query_vars['post_type'] = $geodir_post_type; | |
| 527 | + $geodir_post_type = ''; | |
| 528 | + $geodir_term = ''; | |
| 529 | + $geodir_set_location_session = true; | |
| 530 | +		$geodir_taxonomis = geodir_get_taxonomies('', true);
 | |
| 531 | + | |
| 532 | +		if(!empty($geodir_taxonomis)){
 | |
| 533 | +			foreach ($geodir_taxonomis as $taxonomy) {
 | |
| 534 | +				if (array_key_exists($taxonomy, $wp->query_vars)) {
 | |
| 535 | + $is_geodir_taxonomy = true; | |
| 536 | + $geodir_taxonomy = $taxonomy; | |
| 537 | +					$geodir_post_type = str_replace('category', '', $taxonomy);
 | |
| 538 | +					$geodir_post_type = str_replace('_tags', '', $geodir_post_type);
 | |
| 539 | + $geodir_term = $wp->query_vars[$geodir_taxonomy]; | |
| 540 | + break; | |
| 541 | + } | |
| 542 | + } | |
| 543 | + } | |
| 544 | + | |
| 545 | + // now get an array of all terms seperated by '/' | |
| 546 | +		$geodir_terms = explode('/', $geodir_term);
 | |
| 547 | + $geodir_last_term = end($geodir_terms); | |
| 548 | + | |
| 549 | +		if ($is_geodir_taxonomy) { // do all these only when it is a geodirectory taxonomy
 | |
| 550 | + $wp->query_vars['post_type'] = $geodir_post_type; | |
| 551 | 551 | |
| 552 | 552 | // now check if last term is a post of geodirectory post types | 
| 553 | 553 | $geodir_post = get_posts(array( | 
| @@ -596,196 +596,196 @@ discard block | ||
| 596 | 596 | //return ; | 
| 597 | 597 | } | 
| 598 | 598 | |
| 599 | - $geodir_location_terms = ''; | |
| 600 | - // if last term is not a post then check if last term is a term of the specific texonomy or not | |
| 601 | -            if (geodir_term_exists($geodir_last_term, $geodir_taxonomy)) {
 | |
| 602 | - $is_geodir_taxonomy_term = true; | |
| 599 | + $geodir_location_terms = ''; | |
| 600 | + // if last term is not a post then check if last term is a term of the specific texonomy or not | |
| 601 | +			if (geodir_term_exists($geodir_last_term, $geodir_taxonomy)) {
 | |
| 602 | + $is_geodir_taxonomy_term = true; | |
| 603 | 603 | |
| 604 | - $geodir_set_location_session = false; | |
| 605 | - } | |
| 604 | + $geodir_set_location_session = false; | |
| 605 | + } | |
| 606 | 606 | |
| 607 | 607 | |
| 608 | - // now check if there is location parts in the url or not | |
| 609 | -            if (get_option('geodir_add_location_url')) {				
 | |
| 608 | + // now check if there is location parts in the url or not | |
| 609 | +			if (get_option('geodir_add_location_url')) {				
 | |
| 610 | 610 | $default_location = geodir_get_default_location(); | 
| 611 | 611 | |
| 612 | 612 |  				if ($geodir_show_location_url == 'all') {
 | 
| 613 | -                    if (count($geodir_terms) >= 3) {
 | |
| 614 | - $gd_country = urldecode($geodir_terms[0]); | |
| 615 | - $gd_region = urldecode($geodir_terms[1]); | |
| 616 | - $gd_city = urldecode($geodir_terms[2]); | |
| 617 | -                    } else if (count($geodir_terms) >= 2) {
 | |
| 618 | - $gd_country = urldecode($geodir_terms[0]); | |
| 619 | - $gd_region = urldecode($geodir_terms[1]); | |
| 620 | -                    } else if (count($geodir_terms) >= 1) {
 | |
| 621 | - $gd_country = urldecode($geodir_terms[0]); | |
| 622 | - } | |
| 623 | - | |
| 624 | - if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) && | |
| 625 | - geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region) && | |
| 626 | - geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city) | |
| 627 | - ) | |
| 628 | - $is_geodir_location_found = true; | |
| 629 | - | |
| 630 | - // if location has not been found for country , region and city then search for country and region only | |
| 631 | - | |
| 632 | -                    if (!$is_geodir_location_found) {
 | |
| 633 | - $gd_city = ''; | |
| 634 | - if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) && | |
| 635 | - geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region) | |
| 636 | - ) | |
| 637 | - $is_geodir_location_found = true; | |
| 638 | - | |
| 639 | - } | |
| 640 | - | |
| 641 | - // if location has not been found for country , region then search for country only | |
| 642 | -                    if (!$is_geodir_location_found) {
 | |
| 643 | - $gd_city = ''; | |
| 644 | - $gd_region = ''; | |
| 645 | - if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country)) | |
| 646 | - $is_geodir_location_found = true; | |
| 647 | - } | |
| 648 | -                } else if ($geodir_show_location_url == 'country_city') {
 | |
| 649 | -                    if (count($geodir_terms) >= 2) {
 | |
| 650 | - $gd_country = urldecode($geodir_terms[0]); | |
| 651 | - $gd_city = urldecode($geodir_terms[1]); | |
| 652 | -                    } else if (count($geodir_terms) >= 1) {
 | |
| 653 | - $gd_country = urldecode($geodir_terms[0]); | |
| 654 | - } | |
| 655 | - | |
| 656 | - if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) && geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city)) | |
| 657 | - $is_geodir_location_found = true; | |
| 658 | - | |
| 659 | - // if location has not been found for country and city then search for country only | |
| 660 | -                    if (!$is_geodir_location_found) {
 | |
| 661 | - $gd_city = ''; | |
| 613 | +					if (count($geodir_terms) >= 3) {
 | |
| 614 | + $gd_country = urldecode($geodir_terms[0]); | |
| 615 | + $gd_region = urldecode($geodir_terms[1]); | |
| 616 | + $gd_city = urldecode($geodir_terms[2]); | |
| 617 | +					} else if (count($geodir_terms) >= 2) {
 | |
| 618 | + $gd_country = urldecode($geodir_terms[0]); | |
| 619 | + $gd_region = urldecode($geodir_terms[1]); | |
| 620 | +					} else if (count($geodir_terms) >= 1) {
 | |
| 621 | + $gd_country = urldecode($geodir_terms[0]); | |
| 622 | + } | |
| 623 | + | |
| 624 | + if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) && | |
| 625 | + geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region) && | |
| 626 | + geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city) | |
| 627 | + ) | |
| 628 | + $is_geodir_location_found = true; | |
| 629 | + | |
| 630 | + // if location has not been found for country , region and city then search for country and region only | |
| 631 | + | |
| 632 | +					if (!$is_geodir_location_found) {
 | |
| 633 | + $gd_city = ''; | |
| 634 | + if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) && | |
| 635 | + geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region) | |
| 636 | + ) | |
| 637 | + $is_geodir_location_found = true; | |
| 638 | + | |
| 639 | + } | |
| 640 | + | |
| 641 | + // if location has not been found for country , region then search for country only | |
| 642 | +					if (!$is_geodir_location_found) {
 | |
| 643 | + $gd_city = ''; | |
| 644 | + $gd_region = ''; | |
| 645 | + if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country)) | |
| 646 | + $is_geodir_location_found = true; | |
| 647 | + } | |
| 648 | +				} else if ($geodir_show_location_url == 'country_city') {
 | |
| 649 | +					if (count($geodir_terms) >= 2) {
 | |
| 650 | + $gd_country = urldecode($geodir_terms[0]); | |
| 651 | + $gd_city = urldecode($geodir_terms[1]); | |
| 652 | +					} else if (count($geodir_terms) >= 1) {
 | |
| 653 | + $gd_country = urldecode($geodir_terms[0]); | |
| 654 | + } | |
| 655 | + | |
| 656 | + if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) && geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city)) | |
| 657 | + $is_geodir_location_found = true; | |
| 658 | + | |
| 659 | + // if location has not been found for country and city then search for country only | |
| 660 | +					if (!$is_geodir_location_found) {
 | |
| 661 | + $gd_city = ''; | |
| 662 | 662 | |
| 663 | 663 | if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country)) | 
| 664 | - $is_geodir_location_found = true; | |
| 665 | - } | |
| 666 | -                }  else if ($geodir_show_location_url == 'region_city') {
 | |
| 667 | -                    if (count($geodir_terms) >= 2) {
 | |
| 668 | - $gd_region = urldecode($geodir_terms[0]); | |
| 669 | - $gd_city = urldecode($geodir_terms[1]); | |
| 670 | -                    } else if (count($geodir_terms) >= 1) {
 | |
| 671 | - $gd_region = urldecode($geodir_terms[0]); | |
| 672 | - } | |
| 673 | - | |
| 674 | - if (geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region) && geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city)) | |
| 675 | - $is_geodir_location_found = true; | |
| 676 | - | |
| 677 | - // if location has not been found for region and city then search for region only | |
| 678 | -                    if (!$is_geodir_location_found) {
 | |
| 679 | - $gd_city = ''; | |
| 664 | + $is_geodir_location_found = true; | |
| 665 | + } | |
| 666 | +				}  else if ($geodir_show_location_url == 'region_city') {
 | |
| 667 | +					if (count($geodir_terms) >= 2) {
 | |
| 668 | + $gd_region = urldecode($geodir_terms[0]); | |
| 669 | + $gd_city = urldecode($geodir_terms[1]); | |
| 670 | +					} else if (count($geodir_terms) >= 1) {
 | |
| 671 | + $gd_region = urldecode($geodir_terms[0]); | |
| 672 | + } | |
| 673 | + | |
| 674 | + if (geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region) && geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city)) | |
| 675 | + $is_geodir_location_found = true; | |
| 676 | + | |
| 677 | + // if location has not been found for region and city then search for region only | |
| 678 | +					if (!$is_geodir_location_found) {
 | |
| 679 | + $gd_city = ''; | |
| 680 | 680 | |
| 681 | 681 | if (geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region)) | 
| 682 | - $is_geodir_location_found = true; | |
| 683 | - } | |
| 684 | -                } else {
 | |
| 685 | - $gd_city = $geodir_terms[0]; | |
| 686 | - | |
| 687 | -                    if (geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city)) {
 | |
| 688 | - $is_geodir_location_found = true; | |
| 689 | - $gd_region = $default_location->region_slug; | |
| 690 | - $gd_country = $default_location->country_slug; | |
| 691 | - } | |
| 692 | - } | |
| 693 | - // if location still not found then clear location related session variables | |
| 694 | -                if ($is_geodir_location_found && $geodir_set_location_session) {
 | |
| 695 | -                    $gd_session->set('gd_multi_location', 1);
 | |
| 696 | -                    $gd_session->set('gd_country', $gd_country);
 | |
| 697 | -                    $gd_session->set('gd_region', $gd_region);
 | |
| 698 | -                    $gd_session->set('gd_city', $gd_city);
 | |
| 699 | - } | |
| 700 | - | |
| 701 | -                if ($geodir_show_location_url == 'all') {
 | |
| 682 | + $is_geodir_location_found = true; | |
| 683 | + } | |
| 684 | +				} else {
 | |
| 685 | + $gd_city = $geodir_terms[0]; | |
| 686 | + | |
| 687 | +					if (geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city)) {
 | |
| 688 | + $is_geodir_location_found = true; | |
| 689 | + $gd_region = $default_location->region_slug; | |
| 690 | + $gd_country = $default_location->country_slug; | |
| 691 | + } | |
| 692 | + } | |
| 693 | + // if location still not found then clear location related session variables | |
| 694 | +				if ($is_geodir_location_found && $geodir_set_location_session) {
 | |
| 695 | +					$gd_session->set('gd_multi_location', 1);
 | |
| 696 | +					$gd_session->set('gd_country', $gd_country);
 | |
| 697 | +					$gd_session->set('gd_region', $gd_region);
 | |
| 698 | +					$gd_session->set('gd_city', $gd_city);
 | |
| 699 | + } | |
| 700 | + | |
| 701 | +				if ($geodir_show_location_url == 'all') {
 | |
| 702 | 702 |  				} else if ($geodir_show_location_url == 'country_city') {
 | 
| 703 | 703 | $gd_region = ''; | 
| 704 | 704 |  				} else if ($geodir_show_location_url == 'region_city') {
 | 
| 705 | 705 | $gd_country = ''; | 
| 706 | 706 |  				} else {
 | 
| 707 | 707 | $gd_country = ''; | 
| 708 | - $gd_region = ''; | |
| 708 | + $gd_region = ''; | |
| 709 | + } | |
| 710 | + | |
| 711 | +				if ($is_geodir_location_found) {
 | |
| 712 | + $wp->query_vars['gd_country'] = $gd_country; | |
| 713 | + $wp->query_vars['gd_region'] = $gd_region; | |
| 714 | + $wp->query_vars['gd_city'] = $gd_city; | |
| 715 | +				} else {
 | |
| 716 | + $gd_country = ''; | |
| 717 | + $gd_region = ''; | |
| 718 | + $gd_city = ''; | |
| 709 | 719 | } | 
| 720 | + } | |
| 721 | + | |
| 722 | + $wp->query_vars[$geodir_taxonomy] = $geodir_term; | |
| 723 | + // eliminate location related terms from taxonomy term | |
| 724 | + if ($gd_country != '') | |
| 725 | +				$wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_country) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
 | |
| 726 | + | |
| 727 | + if ($gd_region != '') | |
| 728 | +				$wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_region) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
 | |
| 710 | 729 | |
| 711 | -                if ($is_geodir_location_found) {
 | |
| 712 | - $wp->query_vars['gd_country'] = $gd_country; | |
| 713 | - $wp->query_vars['gd_region'] = $gd_region; | |
| 714 | - $wp->query_vars['gd_city'] = $gd_city; | |
| 715 | -                } else {
 | |
| 716 | - $gd_country = ''; | |
| 717 | - $gd_region = ''; | |
| 718 | - $gd_city = ''; | |
| 719 | - } | |
| 720 | - } | |
| 721 | - | |
| 722 | - $wp->query_vars[$geodir_taxonomy] = $geodir_term; | |
| 723 | - // eliminate location related terms from taxonomy term | |
| 724 | - if ($gd_country != '') | |
| 725 | -                $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_country) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
 | |
| 726 | - | |
| 727 | - if ($gd_region != '') | |
| 728 | -                $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_region) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
 | |
| 729 | - | |
| 730 | - if ($gd_city != '') | |
| 731 | -                $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_city) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
 | |
| 732 | - | |
| 733 | - | |
| 734 | -            $wp->query_vars[$geodir_taxonomy] = str_replace('///', '', $wp->query_vars[$geodir_taxonomy]);
 | |
| 735 | -            $wp->query_vars[$geodir_taxonomy] = str_replace('//', '', $wp->query_vars[$geodir_taxonomy]);
 | |
| 736 | - | |
| 737 | - $wp->query_vars[$geodir_taxonomy] = trim($wp->query_vars[$geodir_taxonomy], '/'); | |
| 738 | - | |
| 739 | -            if ($wp->query_vars[$geodir_taxonomy] == '') {
 | |
| 740 | - unset($wp->query_vars[$geodir_taxonomy]); | |
| 741 | -            } else {
 | |
| 742 | -                if (!$is_geodir_taxonomy_term) {
 | |
| 743 | -                    foreach ($wp->query_vars as $key => $vars) {
 | |
| 744 | - unset($wp->query_vars[$key]); | |
| 745 | - } | |
| 746 | - $wp->query_vars['error'] = '404'; | |
| 747 | - } | |
| 748 | - } | |
| 749 | - } | |
| 750 | - } | |
| 730 | + if ($gd_city != '') | |
| 731 | +				$wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_city) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
 | |
| 732 | + | |
| 733 | + | |
| 734 | +			$wp->query_vars[$geodir_taxonomy] = str_replace('///', '', $wp->query_vars[$geodir_taxonomy]);
 | |
| 735 | +			$wp->query_vars[$geodir_taxonomy] = str_replace('//', '', $wp->query_vars[$geodir_taxonomy]);
 | |
| 736 | + | |
| 737 | + $wp->query_vars[$geodir_taxonomy] = trim($wp->query_vars[$geodir_taxonomy], '/'); | |
| 738 | + | |
| 739 | +			if ($wp->query_vars[$geodir_taxonomy] == '') {
 | |
| 740 | + unset($wp->query_vars[$geodir_taxonomy]); | |
| 741 | +			} else {
 | |
| 742 | +				if (!$is_geodir_taxonomy_term) {
 | |
| 743 | +					foreach ($wp->query_vars as $key => $vars) {
 | |
| 744 | + unset($wp->query_vars[$key]); | |
| 745 | + } | |
| 746 | + $wp->query_vars['error'] = '404'; | |
| 747 | + } | |
| 748 | + } | |
| 749 | + } | |
| 750 | + } | |
| 751 | 751 | |
| 752 | 752 | // Unset location session if gd page and location not set. | 
| 753 | 753 |  	if (isset($wp->query_vars['gd_is_geodir_page']) && !isset($wp->query_vars['gd_country'])) {
 | 
| 754 | 754 |  		$gd_session->un_set(array('gd_multi_location', 'gd_city', 'gd_region', 'gd_country'));
 | 
| 755 | 755 | } | 
| 756 | 756 | |
| 757 | -    if ($gd_session->get('gd_multi_location') == 1) {
 | |
| 758 | -        $wp->query_vars['gd_country'] = $gd_session->get('gd_country');
 | |
| 759 | -        $wp->query_vars['gd_region'] = $gd_session->get('gd_region');
 | |
| 760 | -        $wp->query_vars['gd_city'] = $gd_session->get('gd_city');
 | |
| 761 | - } | |
| 757 | +	if ($gd_session->get('gd_multi_location') == 1) {
 | |
| 758 | +		$wp->query_vars['gd_country'] = $gd_session->get('gd_country');
 | |
| 759 | +		$wp->query_vars['gd_region'] = $gd_session->get('gd_region');
 | |
| 760 | +		$wp->query_vars['gd_city'] = $gd_session->get('gd_city');
 | |
| 761 | + } | |
| 762 | 762 | |
| 763 | - // now check if there is location parts in the url or not | |
| 764 | -    if (get_option('geodir_add_location_url')) {        
 | |
| 763 | + // now check if there is location parts in the url or not | |
| 764 | +	if (get_option('geodir_add_location_url')) {        
 | |
| 765 | 765 |  		if ($geodir_show_location_url == 'all') {
 | 
| 766 | 766 |  		} else if ($geodir_show_location_url == 'country_city') {
 | 
| 767 | 767 | if (isset($wp->query_vars['gd_region'])) | 
| 768 | - $wp->query_vars['gd_region'] = ''; | |
| 768 | + $wp->query_vars['gd_region'] = ''; | |
| 769 | 769 |  		} else if ($geodir_show_location_url == 'region_city') {
 | 
| 770 | 770 | if (isset($wp->query_vars['gd_country'])) | 
| 771 | - $wp->query_vars['gd_country'] = ''; | |
| 771 | + $wp->query_vars['gd_country'] = ''; | |
| 772 | 772 |  		} else {
 | 
| 773 | 773 | if (isset($wp->query_vars['gd_country'])) | 
| 774 | - $wp->query_vars['gd_country'] = ''; | |
| 774 | + $wp->query_vars['gd_country'] = ''; | |
| 775 | 775 | |
| 776 | - if (isset($wp->query_vars['gd_region'])) | |
| 777 | - $wp->query_vars['gd_region'] = ''; | |
| 776 | + if (isset($wp->query_vars['gd_region'])) | |
| 777 | + $wp->query_vars['gd_region'] = ''; | |
| 778 | 778 | } | 
| 779 | -    } else {
 | |
| 780 | - if (isset($wp->query_vars['gd_country'])) | |
| 781 | - $wp->query_vars['gd_country'] = ''; | |
| 779 | +	} else {
 | |
| 780 | + if (isset($wp->query_vars['gd_country'])) | |
| 781 | + $wp->query_vars['gd_country'] = ''; | |
| 782 | 782 | |
| 783 | - if (isset($wp->query_vars['gd_region'])) | |
| 784 | - $wp->query_vars['gd_region'] = ''; | |
| 783 | + if (isset($wp->query_vars['gd_region'])) | |
| 784 | + $wp->query_vars['gd_region'] = ''; | |
| 785 | 785 | |
| 786 | - if (isset($wp->query_vars['gd_city'])) | |
| 787 | - $wp->query_vars['gd_city'] = ''; | |
| 788 | - } | |
| 786 | + if (isset($wp->query_vars['gd_city'])) | |
| 787 | + $wp->query_vars['gd_city'] = ''; | |
| 788 | + } | |
| 789 | 789 | } | 
| 790 | 790 | |
| 791 | 791 | /** | 
| @@ -799,24 +799,24 @@ discard block | ||
| 799 | 799 | */ | 
| 800 | 800 | function geodir_custom_post_status() | 
| 801 | 801 |  {
 | 
| 802 | - // Virtual Page Status | |
| 803 | -    register_post_status('virtual', array(
 | |
| 804 | -        'label' => _x('Virtual', 'page', 'geodirectory'),
 | |
| 805 | - 'public' => true, | |
| 806 | - 'exclude_from_search' => true, | |
| 807 | - 'show_in_admin_all_list' => true, | |
| 808 | - 'show_in_admin_status_list' => true, | |
| 809 | -        'label_count' => _n_noop('Virtual <span class="count">(%s)</span>', 'Virtual <span class="count">(%s)</span>', 'geodirectory'),
 | |
| 810 | - )); | |
| 811 | - | |
| 812 | - /** | |
| 813 | - * Called after we register the custom post status 'Virtual'. | |
| 814 | - * | |
| 815 | - * Can be use to add more post statuses. | |
| 816 | - * | |
| 817 | - * @since 1.0.0 | |
| 818 | - */ | |
| 819 | -    do_action('geodir_custom_post_status');
 | |
| 802 | + // Virtual Page Status | |
| 803 | +	register_post_status('virtual', array(
 | |
| 804 | +		'label' => _x('Virtual', 'page', 'geodirectory'),
 | |
| 805 | + 'public' => true, | |
| 806 | + 'exclude_from_search' => true, | |
| 807 | + 'show_in_admin_all_list' => true, | |
| 808 | + 'show_in_admin_status_list' => true, | |
| 809 | +		'label_count' => _n_noop('Virtual <span class="count">(%s)</span>', 'Virtual <span class="count">(%s)</span>', 'geodirectory'),
 | |
| 810 | + )); | |
| 811 | + | |
| 812 | + /** | |
| 813 | + * Called after we register the custom post status 'Virtual'. | |
| 814 | + * | |
| 815 | + * Can be use to add more post statuses. | |
| 816 | + * | |
| 817 | + * @since 1.0.0 | |
| 818 | + */ | |
| 819 | +	do_action('geodir_custom_post_status');
 | |
| 820 | 820 | } | 
| 821 | 821 | |
| 822 | 822 | /** | 
| @@ -831,7 +831,7 @@ discard block | ||
| 831 | 831 | */ | 
| 832 | 832 | function geodir_get_term_link($termlink, $term, $taxonomy) | 
| 833 | 833 |  {
 | 
| 834 | - return geodir_term_link($termlink, $term, $taxonomy); // taxonomy_functions.php | |
| 834 | + return geodir_term_link($termlink, $term, $taxonomy); // taxonomy_functions.php | |
| 835 | 835 | } | 
| 836 | 836 | |
| 837 | 837 | /** | 
| @@ -845,7 +845,7 @@ discard block | ||
| 845 | 845 | */ | 
| 846 | 846 | function geodir_get_posttype_link($link, $post_type) | 
| 847 | 847 |  {
 | 
| 848 | - return geodir_posttype_link($link, $post_type); // taxonomy_functions.php | |
| 848 | + return geodir_posttype_link($link, $post_type); // taxonomy_functions.php | |
| 849 | 849 | } | 
| 850 | 850 | |
| 851 | 851 | /** | 
| @@ -860,13 +860,13 @@ discard block | ||
| 860 | 860 | */ | 
| 861 | 861 | function exclude_from_wp_list_pages($exclude_array) | 
| 862 | 862 |  {
 | 
| 863 | - $pages_ids = array(); | |
| 864 | -    $pages_array = get_posts(array('post_type' => 'page', 'post_status' => 'virtual'));
 | |
| 865 | -    foreach ($pages_array as $page) {
 | |
| 866 | - $pages_ids[] = $page->ID; | |
| 867 | - } | |
| 868 | - $exclude_array = $exclude_array + $pages_ids; | |
| 869 | - return $exclude_array; | |
| 863 | + $pages_ids = array(); | |
| 864 | +	$pages_array = get_posts(array('post_type' => 'page', 'post_status' => 'virtual'));
 | |
| 865 | +	foreach ($pages_array as $page) {
 | |
| 866 | + $pages_ids[] = $page->ID; | |
| 867 | + } | |
| 868 | + $exclude_array = $exclude_array + $pages_ids; | |
| 869 | + return $exclude_array; | |
| 870 | 870 | } | 
| 871 | 871 | |
| 872 | 872 | /** | 
| @@ -879,8 +879,8 @@ discard block | ||
| 879 | 879 | */ | 
| 880 | 880 | function geodir_exclude_page($query) | 
| 881 | 881 |  {
 | 
| 882 | -    add_filter('posts_where', 'geodir_exclude_page_where', 100);
 | |
| 883 | - return $query; | |
| 882 | +	add_filter('posts_where', 'geodir_exclude_page_where', 100);
 | |
| 883 | + return $query; | |
| 884 | 884 | } | 
| 885 | 885 | |
| 886 | 886 | /** | 
| @@ -895,11 +895,11 @@ discard block | ||
| 895 | 895 | */ | 
| 896 | 896 | function geodir_exclude_page_where($where) | 
| 897 | 897 |  {
 | 
| 898 | - global $wpdb; | |
| 899 | - if (is_admin()) | |
| 900 | - $where .= " AND $wpdb->posts.post_status != 'virtual'"; | |
| 898 | + global $wpdb; | |
| 899 | + if (is_admin()) | |
| 900 | + $where .= " AND $wpdb->posts.post_status != 'virtual'"; | |
| 901 | 901 | |
| 902 | - return $where; | |
| 902 | + return $where; | |
| 903 | 903 | } | 
| 904 | 904 | |
| 905 | 905 | /** | 
| @@ -914,20 +914,20 @@ discard block | ||
| 914 | 914 | * @return mixed The taxonomy option value. | 
| 915 | 915 | */ | 
| 916 | 916 |  function geodir_wpseo_taxonomy_meta( $value, $option = '' ) {
 | 
| 917 | - global $wp_query; | |
| 917 | + global $wp_query; | |
| 918 | 918 | |
| 919 | -    if ( !empty( $value ) && ( is_category() || is_tax() ) ) {
 | |
| 920 | - $term = $wp_query->get_queried_object(); | |
| 919 | +	if ( !empty( $value ) && ( is_category() || is_tax() ) ) {
 | |
| 920 | + $term = $wp_query->get_queried_object(); | |
| 921 | 921 | |
| 922 | -        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() ) ) {
 | |
| 923 | - $image = geodir_get_default_catimage( $term->term_id, str_replace( 'category', '', $term->taxonomy ) ); | |
| 922 | +		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() ) ) {
 | |
| 923 | + $image = geodir_get_default_catimage( $term->term_id, str_replace( 'category', '', $term->taxonomy ) ); | |
| 924 | 924 | |
| 925 | -            if ( !empty( $image['src'] ) ) {
 | |
| 926 | - $value[$term->taxonomy][$term->term_id]['wpseo_twitter-image'] = $image['src']; | |
| 927 | - $value[$term->taxonomy][$term->term_id]['wpseo_opengraph-image'] = $image['src']; | |
| 928 | - } | |
| 929 | - } | |
| 930 | - } | |
| 931 | - return $value; | |
| 925 | +			if ( !empty( $image['src'] ) ) {
 | |
| 926 | + $value[$term->taxonomy][$term->term_id]['wpseo_twitter-image'] = $image['src']; | |
| 927 | + $value[$term->taxonomy][$term->term_id]['wpseo_opengraph-image'] = $image['src']; | |
| 928 | + } | |
| 929 | + } | |
| 930 | + } | |
| 931 | + return $value; | |
| 932 | 932 | } | 
| 933 | 933 | add_filter( 'option_wpseo_taxonomy_meta', 'geodir_wpseo_taxonomy_meta', 10, 2 ); | 
| @@ -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 |  { | 
| @@ -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 = ''; | 
| @@ -579,10 +579,10 @@ discard block | ||
| 579 | 579 | $post_number = !empty($args['post_number']) ? $args['post_number'] : 10; | 
| 580 | 580 | $add_location_filter = !empty($args['add_location_filter']) ? true : false; | 
| 581 | 581 | $list_sort = !empty($args['list_sort']) ? $args['list_sort'] : 'latest'; | 
| 582 | - $character_count = isset($args['character_count']) ? $args['character_count'] : ''; | |
| 583 | - $layout = !empty($args['layout']) ? $args['layout'] : 'gridview_onehalf'; | |
| 584 | - $with_pagination = !empty($args['with_pagination']) ? true : false; | |
| 585 | - $event_type = !empty($args['event_type']) ? $args['event_type'] : ''; | |
| 582 | + $character_count = isset($args['character_count']) ? $args['character_count'] : ''; | |
| 583 | + $layout = !empty($args['layout']) ? $args['layout'] : 'gridview_onehalf'; | |
| 584 | + $with_pagination = !empty($args['with_pagination']) ? true : false; | |
| 585 | + $event_type = !empty($args['event_type']) ? $args['event_type'] : ''; | |
| 586 | 586 | $shortcode_content = !empty($args['shortcode_content']) ? trim($args['shortcode_content']) : ''; | 
| 587 | 587 | $tags = !empty($args['tags']) ? $args['tags'] : array(); | 
| 588 | 588 | /** | 
| @@ -596,13 +596,13 @@ discard block | ||
| 596 | 596 |      $shortcode_content = apply_filters('geodir_sc_gd_listings_not_found_content', $shortcode_content, $args); | 
| 597 | 597 | |
| 598 | 598 | $top_pagination = $with_pagination && !empty($args['top_pagination']) ? true : false; | 
| 599 | - $bottom_pagination = $with_pagination && !empty($args['bottom_pagination']) ? true : false; | |
| 599 | + $bottom_pagination = $with_pagination && !empty($args['bottom_pagination']) ? true : false; | |
| 600 | 600 | |
| 601 | 601 | $shortcode_atts = !empty($args['shortcode_atts']) ? $args['shortcode_atts'] : array(); | 
| 602 | 602 | |
| 603 | 603 | // ajax mode | 
| 604 | - $geodir_ajax = !empty($args['geodir_ajax']) ? true : false; | |
| 605 | - $pageno = $geodir_ajax && !empty($args['pageno']) ? $args['pageno'] : 1; | |
| 604 | + $geodir_ajax = !empty($args['geodir_ajax']) ? true : false; | |
| 605 | + $pageno = $geodir_ajax && !empty($args['pageno']) ? $args['pageno'] : 1; | |
| 606 | 606 | |
| 607 | 607 | $query_args = array( | 
| 608 | 608 | 'posts_per_page' => $post_number, | 
| @@ -666,7 +666,7 @@ discard block | ||
| 666 | 666 | // Clean tags | 
| 667 | 667 |          if (!is_array($tags)) { | 
| 668 | 668 |              $comma = _x(',', 'tag delimiter'); | 
| 669 | -            if ( ',' !== $comma ) { | |
| 669 | +            if (',' !== $comma) { | |
| 670 | 670 | $tags = str_replace($comma, ',', $tags); | 
| 671 | 671 | } | 
| 672 | 672 |              $tags = explode(',', trim($tags, " \n\t\r\0\x0B,")); | 
| @@ -675,7 +675,7 @@ discard block | ||
| 675 | 675 | |
| 676 | 676 |          if (!empty($tags)) { | 
| 677 | 677 | $tag_query = array( | 
| 678 | - 'taxonomy' => $post_type . '_tags', | |
| 678 | + 'taxonomy' => $post_type.'_tags', | |
| 679 | 679 | 'field' => 'name', | 
| 680 | 680 | 'terms' => $tags | 
| 681 | 681 | ); | 
| @@ -705,7 +705,7 @@ discard block | ||
| 705 | 705 | $widget_listings = $total_posts > 0 ? geodir_get_widget_listings($query_args) : array(); | 
| 706 | 706 | } | 
| 707 | 707 | $current_gridview_columns_widget = $gridview_columns_widget; | 
| 708 | - $identifier = ' gd-wgt-pagi-' . mt_rand(); | |
| 708 | + $identifier = ' gd-wgt-pagi-'.mt_rand(); | |
| 709 | 709 | ob_start(); | 
| 710 | 710 |  	if (!empty($widget_listings) || $with_no_results) { | 
| 711 | 711 |  		if (!$geodir_ajax) { | 
| @@ -716,7 +716,7 @@ discard block | ||
| 716 | 716 | */ | 
| 717 | 717 |          do_action('geodir_before_sc_gd_listings'); | 
| 718 | 718 | ?> | 
| 719 | - <div class="geodir_locations geodir_location_listing geodir-sc-gd-listings <?php echo $identifier;?>"> | |
| 719 | + <div class="geodir_locations geodir_location_listing geodir-sc-gd-listings <?php echo $identifier; ?>"> | |
| 720 | 720 |              <?php if ($title != '') { ?> | 
| 721 | 721 | <div class="geodir_list_heading clearfix"> | 
| 722 | 722 | <?php echo $title; ?> | 
| @@ -785,8 +785,8 @@ discard block | ||
| 785 | 785 | ?> | 
| 786 | 786 | </div><p class="geodir-sclisting-loading" style="display:none;"><i class="fa fa-cog fa-spin"></i></p></div> | 
| 787 | 787 | <script type="text/javascript"> | 
| 788 | -jQuery(document).on('click', '.<?php echo trim($identifier);?> .gd-wgt-page', function(e) { | |
| 789 | - var container = jQuery( '.<?php echo trim($identifier);?>'); | |
| 788 | +jQuery(document).on('click', '.<?php echo trim($identifier); ?> .gd-wgt-page', function(e) { | |
| 789 | + var container = jQuery( '.<?php echo trim($identifier); ?>'); | |
| 790 | 790 | var obj = this; | 
| 791 | 791 |      var pid = parseInt(jQuery(this).data('page')); | 
| 792 | 792 |      var items = jQuery(obj).closest('.gd-sc-content'); | 
| @@ -796,7 +796,7 @@ discard block | ||
| 796 | 796 | return false; | 
| 797 | 797 | } | 
| 798 | 798 | |
| 799 | - var scatts = "<?php echo addslashes(json_encode($shortcode_atts));?>"; | |
| 799 | + var scatts = "<?php echo addslashes(json_encode($shortcode_atts)); ?>"; | |
| 800 | 800 | |
| 801 | 801 |      var data = { | 
| 802 | 802 | 'action': 'geodir_sclistings', | 
| @@ -885,16 +885,16 @@ discard block | ||
| 885 | 885 |  	if ($max_page > 1 || $always_show) { | 
| 886 | 886 | // Extra pagination info | 
| 887 | 887 |  		$geodir_pagination_more_info = get_option('geodir_pagination_advance_info'); | 
| 888 | - $start_no = ( $pageno - 1 ) * $posts_per_page + 1; | |
| 888 | + $start_no = ($pageno - 1) * $posts_per_page + 1; | |
| 889 | 889 | $end_no = min($pageno * $posts_per_page, $numposts); | 
| 890 | 890 | |
| 891 | 891 |  		if ($geodir_pagination_more_info != '') { | 
| 892 | -			$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>'; | |
| 892 | +			$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>'; | |
| 893 | 893 | |
| 894 | 894 |  			if ($geodir_pagination_more_info == 'before') { | 
| 895 | - $before = $before . $pagination_info; | |
| 895 | + $before = $before.$pagination_info; | |
| 896 | 896 |  			} else if ($geodir_pagination_more_info == 'after') { | 
| 897 | - $after = $pagination_info . $after; | |
| 897 | + $after = $pagination_info.$after; | |
| 898 | 898 | } | 
| 899 | 899 | } | 
| 900 | 900 | |
| @@ -904,7 +904,7 @@ discard block | ||
| 904 | 904 | } | 
| 905 | 905 | |
| 906 | 906 |  		if (($pageno - 1) > 0) { | 
| 907 | - echo '<a class="gd-page-sc-prev gd-wgt-page" data-page="' . (int)($pageno - 1) . '" href="javascript:void(0);">' . $prelabel . '</a> '; | |
| 907 | + echo '<a class="gd-page-sc-prev gd-wgt-page" data-page="'.(int) ($pageno - 1).'" href="javascript:void(0);">'.$prelabel.'</a> '; | |
| 908 | 908 | } | 
| 909 | 909 | |
| 910 | 910 |  		for ($i = $pageno - $half_pages_to_show; $i <= $pageno + $half_pages_to_show; $i++) { | 
| @@ -912,17 +912,17 @@ discard block | ||
| 912 | 912 |  				if ($i == $pageno) { | 
| 913 | 913 | echo "<strong class='on' class='gd-page-sc-act'>$i</strong>"; | 
| 914 | 914 |  				} else { | 
| 915 | - echo ' <a class="gd-page-sc-no gd-wgt-page" data-page="' . (int)$i . '" href="javascript:void(0);">' . $i . '</a> '; | |
| 915 | + echo ' <a class="gd-page-sc-no gd-wgt-page" data-page="'.(int) $i.'" href="javascript:void(0);">'.$i.'</a> '; | |
| 916 | 916 | } | 
| 917 | 917 | } | 
| 918 | 918 | } | 
| 919 | 919 | |
| 920 | 920 |  		if (($pageno + 1) <= $max_page) { | 
| 921 | - echo ' <a class="gd-page-sc-nxt gd-wgt-page" data-page="' . (int)($pageno + 1) . '" href="javascript:void(0);">' . $nxtlabel . '</a>'; | |
| 921 | + echo ' <a class="gd-page-sc-nxt gd-wgt-page" data-page="'.(int) ($pageno + 1).'" href="javascript:void(0);">'.$nxtlabel.'</a>'; | |
| 922 | 922 | } | 
| 923 | 923 | |
| 924 | 924 |  		if ($pageno < $max_page) { | 
| 925 | - echo ' <a class="gd-page-sc-lst gd-wgt-page" data-page="' . (int)$max_page . '" href="javascript:void(0);">»</a>'; | |
| 925 | + echo ' <a class="gd-page-sc-lst gd-wgt-page" data-page="'.(int) $max_page.'" href="javascript:void(0);">»</a>'; | |
| 926 | 926 | } | 
| 927 | 927 | echo "</div> $after </div>"; | 
| 928 | 928 | } | 
| @@ -945,7 +945,7 @@ discard block | ||
| 945 | 945 | $scatts = isset($_POST['scatts']) ? $_POST['scatts'] : NULL; | 
| 946 | 946 | $pageno = isset($_POST['pageno']) ? absint($_POST['pageno']) : 1; | 
| 947 | 947 | |
| 948 | - $shortcode_atts = !empty($scatts) ? (array)json_decode(stripslashes_deep($scatts)) : NULL; | |
| 948 | + $shortcode_atts = !empty($scatts) ? (array) json_decode(stripslashes_deep($scatts)) : NULL; | |
| 949 | 949 | |
| 950 | 950 |  	if (!empty($shortcode_atts) && is_array($shortcode_atts)) { | 
| 951 | 951 | $shortcode_atts['pageno'] = $pageno; | 
| @@ -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 | /** | 
| @@ -573,7 +573,7 @@ discard block | ||
| 573 | 573 | * @return string Listings HTML content. | 
| 574 | 574 | */ | 
| 575 | 575 |  function geodir_sc_gd_listings_output($args = array()) { | 
| 576 | - $title = !empty($args['title']) ? __($args['title'], 'geodirectory') : ''; | |
| 576 | + $title = !empty($args['title']) ? __($args['title'], 'geodirectory') : ''; | |
| 577 | 577 | $post_type = !empty($args['post_type']) ? $args['post_type'] : 'gd_place'; | 
| 578 | 578 | $category = !empty($args['category']) ? $args['category'] : '0'; | 
| 579 | 579 | $post_number = !empty($args['post_number']) ? $args['post_number'] : 10; | 
| @@ -583,17 +583,17 @@ discard block | ||
| 583 | 583 | $layout = !empty($args['layout']) ? $args['layout'] : 'gridview_onehalf'; | 
| 584 | 584 | $with_pagination = !empty($args['with_pagination']) ? true : false; | 
| 585 | 585 | $event_type = !empty($args['event_type']) ? $args['event_type'] : ''; | 
| 586 | - $shortcode_content = !empty($args['shortcode_content']) ? trim($args['shortcode_content']) : ''; | |
| 587 | - $tags = !empty($args['tags']) ? $args['tags'] : array(); | |
| 588 | - /** | |
| 589 | - * Filter the content text displayed when no listings found. | |
| 590 | - * | |
| 591 | - * @since 1.6.0 | |
| 592 | - * | |
| 593 | - * @param string $shortcode_content The shortcode content text. | |
| 594 | - * @param array $args Array of arguements to filter listings. | |
| 595 | - */ | |
| 596 | -    $shortcode_content = apply_filters('geodir_sc_gd_listings_not_found_content', $shortcode_content, $args); | |
| 586 | + $shortcode_content = !empty($args['shortcode_content']) ? trim($args['shortcode_content']) : ''; | |
| 587 | + $tags = !empty($args['tags']) ? $args['tags'] : array(); | |
| 588 | + /** | |
| 589 | + * Filter the content text displayed when no listings found. | |
| 590 | + * | |
| 591 | + * @since 1.6.0 | |
| 592 | + * | |
| 593 | + * @param string $shortcode_content The shortcode content text. | |
| 594 | + * @param array $args Array of arguements to filter listings. | |
| 595 | + */ | |
| 596 | +	$shortcode_content = apply_filters('geodir_sc_gd_listings_not_found_content', $shortcode_content, $args); | |
| 597 | 597 | |
| 598 | 598 | $top_pagination = $with_pagination && !empty($args['top_pagination']) ? true : false; | 
| 599 | 599 | $bottom_pagination = $with_pagination && !empty($args['bottom_pagination']) ? true : false; | 
| @@ -605,92 +605,92 @@ discard block | ||
| 605 | 605 | $pageno = $geodir_ajax && !empty($args['pageno']) ? $args['pageno'] : 1; | 
| 606 | 606 | |
| 607 | 607 | $query_args = array( | 
| 608 | - 'posts_per_page' => $post_number, | |
| 609 | - 'is_geodir_loop' => true, | |
| 610 | - 'gd_location' => $add_location_filter, | |
| 611 | - 'post_type' => $post_type, | |
| 612 | - 'order_by' => $list_sort, | |
| 608 | + 'posts_per_page' => $post_number, | |
| 609 | + 'is_geodir_loop' => true, | |
| 610 | + 'gd_location' => $add_location_filter, | |
| 611 | + 'post_type' => $post_type, | |
| 612 | + 'order_by' => $list_sort, | |
| 613 | 613 | 'pageno' => $pageno | 
| 614 | - ); | |
| 614 | + ); | |
| 615 | 615 | |
| 616 | -    if ($character_count >= 0) { | |
| 617 | - $query_args['excerpt_length'] = $character_count; | |
| 618 | - } | |
| 616 | +	if ($character_count >= 0) { | |
| 617 | + $query_args['excerpt_length'] = $character_count; | |
| 618 | + } | |
| 619 | 619 | |
| 620 | -    if (!empty($args['post_author'])) { | |
| 621 | - $query_args['post_author'] = $args['post_author']; | |
| 622 | - } | |
| 620 | +	if (!empty($args['post_author'])) { | |
| 621 | + $query_args['post_author'] = $args['post_author']; | |
| 622 | + } | |
| 623 | 623 | |
| 624 | -    if (!empty($args['show_featured_only'])) { | |
| 625 | - $query_args['show_featured_only'] = 1; | |
| 626 | - } | |
| 624 | +	if (!empty($args['show_featured_only'])) { | |
| 625 | + $query_args['show_featured_only'] = 1; | |
| 626 | + } | |
| 627 | 627 | |
| 628 | -    if (!empty($args['show_special_only'])) { | |
| 629 | - $query_args['show_special_only'] = 1; | |
| 630 | - } | |
| 628 | +	if (!empty($args['show_special_only'])) { | |
| 629 | + $query_args['show_special_only'] = 1; | |
| 630 | + } | |
| 631 | 631 | |
| 632 | -    if (!empty($args['with_pics_only'])) { | |
| 633 | - $query_args['with_pics_only'] = 0; | |
| 634 | - $query_args['featured_image_only'] = 1; | |
| 635 | - } | |
| 632 | +	if (!empty($args['with_pics_only'])) { | |
| 633 | + $query_args['with_pics_only'] = 0; | |
| 634 | + $query_args['featured_image_only'] = 1; | |
| 635 | + } | |
| 636 | 636 | |
| 637 | -    if (!empty($args['with_videos_only'])) { | |
| 638 | - $query_args['with_videos_only'] = 1; | |
| 639 | - } | |
| 637 | +	if (!empty($args['with_videos_only'])) { | |
| 638 | + $query_args['with_videos_only'] = 1; | |
| 639 | + } | |
| 640 | 640 | |
| 641 | -    if (!empty($args['show_favorites_only'])) { | |
| 642 | - $query_args['show_favorites_only'] = 1; | |
| 643 | - $query_args['favorites_by_user'] = !empty($args['favorites_by_user']) ? $args['favorites_by_user'] : 0; | |
| 644 | - } | |
| 645 | - $with_no_results = !empty($args['without_no_results']) ? false : true; | |
| 641 | +	if (!empty($args['show_favorites_only'])) { | |
| 642 | + $query_args['show_favorites_only'] = 1; | |
| 643 | + $query_args['favorites_by_user'] = !empty($args['favorites_by_user']) ? $args['favorites_by_user'] : 0; | |
| 644 | + } | |
| 645 | + $with_no_results = !empty($args['without_no_results']) ? false : true; | |
| 646 | 646 | |
| 647 | -    if (!empty($category) && isset($category[0]) && $category[0] != '0') { | |
| 648 | - $category_taxonomy = geodir_get_taxonomies($post_type); | |
| 647 | +	if (!empty($category) && isset($category[0]) && $category[0] != '0') { | |
| 648 | + $category_taxonomy = geodir_get_taxonomies($post_type); | |
| 649 | 649 | |
| 650 | - ######### WPML ######### | |
| 651 | -        if (geodir_wpml_is_taxonomy_translated($category_taxonomy[0])) { | |
| 652 | - $category = gd_lang_object_ids($category, $category_taxonomy[0]); | |
| 653 | - } | |
| 654 | - ######### WPML ######### | |
| 650 | + ######### WPML ######### | |
| 651 | +		if (geodir_wpml_is_taxonomy_translated($category_taxonomy[0])) { | |
| 652 | + $category = gd_lang_object_ids($category, $category_taxonomy[0]); | |
| 653 | + } | |
| 654 | + ######### WPML ######### | |
| 655 | 655 | |
| 656 | - $tax_query = array( | |
| 657 | - 'taxonomy' => $category_taxonomy[0], | |
| 658 | - 'field' => 'id', | |
| 659 | - 'terms' => $category | |
| 660 | - ); | |
| 656 | + $tax_query = array( | |
| 657 | + 'taxonomy' => $category_taxonomy[0], | |
| 658 | + 'field' => 'id', | |
| 659 | + 'terms' => $category | |
| 660 | + ); | |
| 661 | 661 | |
| 662 | - $query_args['tax_query'] = array($tax_query); | |
| 663 | - } | |
| 662 | + $query_args['tax_query'] = array($tax_query); | |
| 663 | + } | |
| 664 | 664 | |
| 665 | -    if (!empty($tags)) { | |
| 666 | - // Clean tags | |
| 667 | -        if (!is_array($tags)) { | |
| 668 | -            $comma = _x(',', 'tag delimiter'); | |
| 669 | -            if ( ',' !== $comma ) { | |
| 670 | - $tags = str_replace($comma, ',', $tags); | |
| 671 | - } | |
| 672 | -            $tags = explode(',', trim($tags, " \n\t\r\0\x0B,")); | |
| 673 | -            $tags = array_map('trim', $tags); | |
| 674 | - } | |
| 665 | +	if (!empty($tags)) { | |
| 666 | + // Clean tags | |
| 667 | +		if (!is_array($tags)) { | |
| 668 | +			$comma = _x(',', 'tag delimiter'); | |
| 669 | +			if ( ',' !== $comma ) { | |
| 670 | + $tags = str_replace($comma, ',', $tags); | |
| 671 | + } | |
| 672 | +			$tags = explode(',', trim($tags, " \n\t\r\0\x0B,")); | |
| 673 | +			$tags = array_map('trim', $tags); | |
| 674 | + } | |
| 675 | 675 | |
| 676 | -        if (!empty($tags)) { | |
| 677 | - $tag_query = array( | |
| 678 | - 'taxonomy' => $post_type . '_tags', | |
| 679 | - 'field' => 'name', | |
| 680 | - 'terms' => $tags | |
| 681 | - ); | |
| 682 | - | |
| 683 | -            if (!empty($query_args['tax_query'])) { | |
| 684 | - $query_args['tax_query'][] = $tag_query; | |
| 685 | -            } else { | |
| 686 | - $query_args['tax_query'] = array($tag_query); | |
| 687 | - } | |
| 688 | - } | |
| 689 | - } | |
| 676 | +		if (!empty($tags)) { | |
| 677 | + $tag_query = array( | |
| 678 | + 'taxonomy' => $post_type . '_tags', | |
| 679 | + 'field' => 'name', | |
| 680 | + 'terms' => $tags | |
| 681 | + ); | |
| 682 | + | |
| 683 | +			if (!empty($query_args['tax_query'])) { | |
| 684 | + $query_args['tax_query'][] = $tag_query; | |
| 685 | +			} else { | |
| 686 | + $query_args['tax_query'] = array($tag_query); | |
| 687 | + } | |
| 688 | + } | |
| 689 | + } | |
| 690 | 690 | |
| 691 | - global $gridview_columns_widget, $geodir_is_widget_listing; | |
| 691 | + global $gridview_columns_widget, $geodir_is_widget_listing; | |
| 692 | 692 | |
| 693 | -    if ($post_type == 'gd_event' && function_exists('geodir_event_get_widget_events')) { | |
| 693 | +	if ($post_type == 'gd_event' && function_exists('geodir_event_get_widget_events')) { | |
| 694 | 694 | global $geodir_event_widget_listview; | 
| 695 | 695 | $geodir_event_widget_listview = true; | 
| 696 | 696 | |
| @@ -705,16 +705,16 @@ discard block | ||
| 705 | 705 | $widget_listings = $total_posts > 0 ? geodir_get_widget_listings($query_args) : array(); | 
| 706 | 706 | } | 
| 707 | 707 | $current_gridview_columns_widget = $gridview_columns_widget; | 
| 708 | - $identifier = ' gd-wgt-pagi-' . mt_rand(); | |
| 709 | - ob_start(); | |
| 708 | + $identifier = ' gd-wgt-pagi-' . mt_rand(); | |
| 709 | + ob_start(); | |
| 710 | 710 |  	if (!empty($widget_listings) || $with_no_results) { | 
| 711 | 711 |  		if (!$geodir_ajax) { | 
| 712 | - /** | |
| 713 | - * Called before the shortcode [gd_listings] content is output. | |
| 714 | - * | |
| 715 | - * @since 1.0.0 | |
| 716 | - */ | |
| 717 | -        do_action('geodir_before_sc_gd_listings'); | |
| 712 | + /** | |
| 713 | + * Called before the shortcode [gd_listings] content is output. | |
| 714 | + * | |
| 715 | + * @since 1.0.0 | |
| 716 | + */ | |
| 717 | +		do_action('geodir_before_sc_gd_listings'); | |
| 718 | 718 | ?> | 
| 719 | 719 | <div class="geodir_locations geodir_location_listing geodir-sc-gd-listings <?php echo $identifier;?>"> | 
| 720 | 720 |              <?php if ($title != '') { ?> | 
| @@ -725,63 +725,63 @@ discard block | ||
| 725 | 725 | <div class="gd-sc-loader"> | 
| 726 | 726 | <div class="gd-sc-content"> | 
| 727 | 727 | <?php } | 
| 728 | -            if (!(empty($widget_listings) && !empty($shortcode_content))) { | |
| 729 | -                if (strstr($layout, 'gridview')) { | |
| 730 | -                    $listing_view_exp = explode('_', $layout); | |
| 731 | - $gridview_columns_widget = $layout; | |
| 732 | - $layout = $listing_view_exp[0]; | |
| 733 | -                } else { | |
| 734 | - $gridview_columns_widget = ''; | |
| 735 | - } | |
| 736 | - | |
| 737 | - /** | |
| 738 | - * Filter the widget listing listview template. | |
| 739 | - * | |
| 740 | - * @since 1.0.0 | |
| 741 | - * | |
| 742 | - * @param string The template file to display listing. | |
| 743 | - */ | |
| 744 | -                $template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview')); | |
| 728 | +			if (!(empty($widget_listings) && !empty($shortcode_content))) { | |
| 729 | +				if (strstr($layout, 'gridview')) { | |
| 730 | +					$listing_view_exp = explode('_', $layout); | |
| 731 | + $gridview_columns_widget = $layout; | |
| 732 | + $layout = $listing_view_exp[0]; | |
| 733 | +				} else { | |
| 734 | + $gridview_columns_widget = ''; | |
| 735 | + } | |
| 736 | + | |
| 737 | + /** | |
| 738 | + * Filter the widget listing listview template. | |
| 739 | + * | |
| 740 | + * @since 1.0.0 | |
| 741 | + * | |
| 742 | + * @param string The template file to display listing. | |
| 743 | + */ | |
| 744 | +				$template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview')); | |
| 745 | 745 | |
| 746 | - global $post, $map_jason, $map_canvas_arr, $gd_session; | |
| 747 | - | |
| 748 | - $current_post = $post; | |
| 749 | - $current_map_jason = $map_jason; | |
| 750 | - $current_map_canvas_arr = $map_canvas_arr; | |
| 751 | - $geodir_is_widget_listing = true; | |
| 752 | -                $gd_session->un_set('gd_listing_view'); | |
| 753 | - | |
| 754 | -                if ($with_pagination && $top_pagination) {				 | |
| 755 | - echo geodir_sc_listings_pagination($total_posts, $post_number, $pageno); | |
| 756 | - } | |
| 757 | - | |
| 758 | - /** | |
| 759 | - * Includes listing listview template. | |
| 760 | - * | |
| 761 | - * @since 1.0.0 | |
| 762 | - */ | |
| 763 | - include($template); | |
| 746 | + global $post, $map_jason, $map_canvas_arr, $gd_session; | |
| 747 | + | |
| 748 | + $current_post = $post; | |
| 749 | + $current_map_jason = $map_jason; | |
| 750 | + $current_map_canvas_arr = $map_canvas_arr; | |
| 751 | + $geodir_is_widget_listing = true; | |
| 752 | +				$gd_session->un_set('gd_listing_view'); | |
| 753 | + | |
| 754 | +				if ($with_pagination && $top_pagination) {				 | |
| 755 | + echo geodir_sc_listings_pagination($total_posts, $post_number, $pageno); | |
| 756 | + } | |
| 757 | + | |
| 758 | + /** | |
| 759 | + * Includes listing listview template. | |
| 760 | + * | |
| 761 | + * @since 1.0.0 | |
| 762 | + */ | |
| 763 | + include($template); | |
| 764 | 764 | |
| 765 | -                if ($with_pagination && $bottom_pagination) {				 | |
| 766 | - echo geodir_sc_listings_pagination($total_posts, $post_number, $pageno); | |
| 767 | - } | |
| 768 | - | |
| 769 | - $geodir_is_widget_listing = false; | |
| 770 | - | |
| 771 | - $GLOBALS['post'] = $current_post; | |
| 772 | -                if (!empty($current_post)) { | |
| 773 | - setup_postdata($current_post); | |
| 774 | - } | |
| 775 | - $map_jason = $current_map_jason; | |
| 776 | - $map_canvas_arr = $current_map_canvas_arr; | |
| 777 | - global $gridview_columns_widget; | |
| 778 | - $gridview_columns_widget = $current_gridview_columns_widget; | |
| 779 | -            } else { | |
| 780 | - echo $shortcode_content; | |
| 781 | - } | |
| 765 | +				if ($with_pagination && $bottom_pagination) {				 | |
| 766 | + echo geodir_sc_listings_pagination($total_posts, $post_number, $pageno); | |
| 767 | + } | |
| 768 | + | |
| 769 | + $geodir_is_widget_listing = false; | |
| 770 | + | |
| 771 | + $GLOBALS['post'] = $current_post; | |
| 772 | +				if (!empty($current_post)) { | |
| 773 | + setup_postdata($current_post); | |
| 774 | + } | |
| 775 | + $map_jason = $current_map_jason; | |
| 776 | + $map_canvas_arr = $current_map_canvas_arr; | |
| 777 | + global $gridview_columns_widget; | |
| 778 | + $gridview_columns_widget = $current_gridview_columns_widget; | |
| 779 | +			} else { | |
| 780 | + echo $shortcode_content; | |
| 781 | + } | |
| 782 | 782 | ?> | 
| 783 | 783 | <?php | 
| 784 | -            if (!$geodir_ajax) {  | |
| 784 | +			if (!$geodir_ajax) {  | |
| 785 | 785 | ?> | 
| 786 | 786 | </div><p class="geodir-sclisting-loading" style="display:none;"><i class="fa fa-cog fa-spin"></i></p></div> | 
| 787 | 787 | <script type="text/javascript"> | 
| @@ -819,10 +819,10 @@ discard block | ||
| 819 | 819 | loading.hide(); | 
| 820 | 820 | jQuery(items).html(response); | 
| 821 | 821 | <?php | 
| 822 | - /** | |
| 823 | - * if lazyload images enabled then refresh them once ajax page changed. | |
| 824 | - */ | |
| 825 | -              if (get_option('geodir_lazy_load', 1)) { ?> | |
| 822 | + /** | |
| 823 | + * if lazyload images enabled then refresh them once ajax page changed. | |
| 824 | + */ | |
| 825 | +			  if (get_option('geodir_lazy_load', 1)) { ?> | |
| 826 | 826 | geodir_init_lazy_load(); | 
| 827 | 827 | <?php } ?> | 
| 828 | 828 | } | 
| @@ -832,11 +832,11 @@ discard block | ||
| 832 | 832 | </div> | 
| 833 | 833 | <?php } ?> | 
| 834 | 834 | <?php | 
| 835 | - } | |
| 835 | + } | |
| 836 | 836 | $output = ob_get_contents(); | 
| 837 | - ob_end_clean(); | |
| 837 | + ob_end_clean(); | |
| 838 | 838 | |
| 839 | - return trim($output); | |
| 839 | + return trim($output); | |
| 840 | 840 | } | 
| 841 | 841 | |
| 842 | 842 | /** | 
| @@ -863,15 +863,15 @@ discard block | ||
| 863 | 863 | * @return string Listings pagination HTML content. | 
| 864 | 864 | */ | 
| 865 | 865 |  function geodir_sc_listings_pagination($total_posts, $posts_per_page, $pageno, $before = '', $after = '', $prelabel = '', $nxtlabel = '', $pages_to_show = 5, $always_show = false) { | 
| 866 | -    if (empty($prelabel)) { | |
| 867 | - $prelabel = '<strong>«</strong>'; | |
| 868 | - } | |
| 866 | +	if (empty($prelabel)) { | |
| 867 | + $prelabel = '<strong>«</strong>'; | |
| 868 | + } | |
| 869 | 869 | |
| 870 | -    if (empty($nxtlabel)) { | |
| 871 | - $nxtlabel = '<strong>»</strong>'; | |
| 872 | - } | |
| 870 | +	if (empty($nxtlabel)) { | |
| 871 | + $nxtlabel = '<strong>»</strong>'; | |
| 872 | + } | |
| 873 | 873 | |
| 874 | - $half_pages_to_show = round($pages_to_show / 2); | |
| 874 | + $half_pages_to_show = round($pages_to_show / 2); | |
| 875 | 875 | |
| 876 | 876 | $numposts = $total_posts; | 
| 877 | 877 | |
| @@ -904,7 +904,7 @@ discard block | ||
| 904 | 904 | } | 
| 905 | 905 | |
| 906 | 906 |  		if (($pageno - 1) > 0) { | 
| 907 | - echo '<a class="gd-page-sc-prev gd-wgt-page" data-page="' . (int)($pageno - 1) . '" href="javascript:void(0);">' . $prelabel . '</a> '; | |
| 907 | + echo '<a class="gd-page-sc-prev gd-wgt-page" data-page="' . (int)($pageno - 1) . '" href="javascript:void(0);">' . $prelabel . '</a> '; | |
| 908 | 908 | } | 
| 909 | 909 | |
| 910 | 910 |  		for ($i = $pageno - $half_pages_to_show; $i <= $pageno + $half_pages_to_show; $i++) { | 
| @@ -927,9 +927,9 @@ discard block | ||
| 927 | 927 | echo "</div> $after </div>"; | 
| 928 | 928 | } | 
| 929 | 929 | $output = ob_get_contents(); | 
| 930 | - ob_end_clean(); | |
| 930 | + ob_end_clean(); | |
| 931 | 931 | |
| 932 | - return trim($output); | |
| 932 | + return trim($output); | |
| 933 | 933 | } | 
| 934 | 934 | |
| 935 | 935 | /** | 
| @@ -940,10 +940,10 @@ discard block | ||
| 940 | 940 | * @return string Listings HTML content. | 
| 941 | 941 | */ | 
| 942 | 942 |  function geodir_sclistings_callback() { | 
| 943 | -    check_ajax_referer('geodir-sclistings-nonce', 'geodir_sclistings_nonce'); | |
| 944 | - //set variables | |
| 945 | - $scatts = isset($_POST['scatts']) ? $_POST['scatts'] : NULL; | |
| 946 | - $pageno = isset($_POST['pageno']) ? absint($_POST['pageno']) : 1; | |
| 943 | +	check_ajax_referer('geodir-sclistings-nonce', 'geodir_sclistings_nonce'); | |
| 944 | + //set variables | |
| 945 | + $scatts = isset($_POST['scatts']) ? $_POST['scatts'] : NULL; | |
| 946 | + $pageno = isset($_POST['pageno']) ? absint($_POST['pageno']) : 1; | |
| 947 | 947 | |
| 948 | 948 | $shortcode_atts = !empty($scatts) ? (array)json_decode(stripslashes_deep($scatts)) : NULL; | 
| 949 | 949 | |
| @@ -955,7 +955,7 @@ discard block | ||
| 955 | 955 |  	} else { | 
| 956 | 956 | echo 0; | 
| 957 | 957 | } | 
| 958 | - wp_die(); | |
| 958 | + wp_die(); | |
| 959 | 959 | } | 
| 960 | 960 |  add_action('wp_ajax_geodir_sclistings', 'geodir_sclistings_callback'); | 
| 961 | 961 |  add_action('wp_ajax_nopriv_geodir_sclistings', 'geodir_sclistings_callback'); | 
| 962 | 962 | \ No newline at end of file | 
| @@ -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 |  {
 | 
| @@ -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,317 +418,317 @@ 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 = isset($user->ID) ? $user->ID : ''; | |
| 641 | - $author_link = get_author_posts_url($user_ID); | |
| 642 | -                    $default_author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true', 'stype' => 'gd_place'), false);
 | |
| 643 | - | |
| 644 | - /** | |
| 645 | - * Filter the author link. | |
| 646 | - * | |
| 647 | - * @since 1.0.0 | |
| 648 | - * | |
| 649 | - * @param string $default_author_link Default author link. | |
| 650 | - * @param int $user_ID The user ID. | |
| 651 | - */ | |
| 652 | -                    $default_author_link = apply_filters('geodir_dashboard_author_link', $default_author_link, $user_ID);
 | |
| 653 | - | |
| 654 | - $_REQUEST['redirect_to'] = $default_author_link; | |
| 655 | - else: | |
| 656 | - $_REQUEST['redirect_to'] = home_url(); | |
| 657 | - endif; | |
| 658 | - | |
| 659 | - } | |
| 660 | -            if (isset($_REQUEST['redirect_to'])) {
 | |
| 661 | - $redirect_to = $_REQUEST['redirect_to']; | |
| 662 | - // 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);
 | |
| 665 | -            } else {
 | |
| 666 | - $redirect_to = admin_url(); | |
| 667 | - } | |
| 668 | - | |
| 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; | |
| 671 | -            $user = wp_signon('', $secure_cookie);
 | |
| 672 | - | |
| 673 | - | |
| 674 | - /** | |
| 675 | - * Filter the login redirect URL. | |
| 676 | - * | |
| 677 | - * @since 1.4.9 | |
| 678 | - * @param string $redirect_to The redirect destination URL. | |
| 679 | - * @param WP_User|WP_Error $user WP_User object if login was successful, WP_Error object otherwise. | |
| 680 | - */ | |
| 681 | -            $redirect_to = apply_filters('login_redirect', $redirect_to, isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '', $user);
 | |
| 682 | - | |
| 683 | -            if (is_wp_error($user)) {
 | |
| 684 | -                if (isset($_SERVER['HTTP_REFERER']) && strstr($_SERVER['HTTP_REFERER'], 'ptype=property_submit') && $_POST['log'] != '' && $_POST['pwd'] != '') {
 | |
| 685 | - wp_redirect($_SERVER['HTTP_REFERER'] . '&emsg=1'); | |
| 686 | - } | |
| 687 | - } | |
| 688 | -            if (!is_wp_error($user)) {
 | |
| 689 | - | |
| 690 | - // Some servers are not logging the user in properly after wp_signon, se we set the user here. | |
| 691 | - //wp_set_current_user($user->ID); | |
| 692 | - //echo '###';exit; | |
| 693 | - | |
| 694 | -                if ($redirect_to) {
 | |
| 695 | - wp_redirect($redirect_to); | |
| 696 | -                } else {
 | |
| 697 | - wp_redirect(home_url()); | |
| 698 | - } | |
| 699 | - gd_die(); | |
| 700 | - } | |
| 701 | - | |
| 702 | - $errors = $user; | |
| 703 | - | |
| 704 | - // Clear errors if loggedout is set. | |
| 705 | - if (!empty($_GET['loggedout'])) | |
| 706 | - $errors = new WP_Error(); | |
| 707 | - // 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'));
 | |
| 710 | - | |
| 711 | - // Some parts of this script use the main login form to display a message | |
| 712 | -            if (isset($_GET['loggedout']) && TRUE == $_GET['loggedout']) {
 | |
| 713 | - $successmsg = '<div class="sucess_msg">' . YOU_ARE_LOGED_OUT_MSG . '</div>'; | |
| 714 | -            } elseif (isset($_GET['registration']) && 'disabled' == $_GET['registration']) {
 | |
| 715 | - $successmsg = USER_REG_NOT_ALLOW_MSG; | |
| 716 | -            } elseif (isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail']) {
 | |
| 717 | - $successmsg = EMAIL_CONFIRM_LINK_MSG; | |
| 718 | -            } elseif (isset($_GET['checkemail']) && 'newpass' == $_GET['checkemail']) {
 | |
| 719 | - $successmsg = NEW_PW_EMAIL_MSG; | |
| 720 | -            } elseif (isset($_GET['checkemail']) && 'registered' == $_GET['checkemail']) {
 | |
| 721 | - $successmsg = REG_COMPLETE_MSG; | |
| 722 | - } | |
| 723 | - | |
| 724 | -            if ((isset($_POST['log']) && $_POST['log'] != '' && $errors) || ((!isset($_POST['log']) || $_POST['log'] == '') && isset($_REQUEST['testcookie']) && $_REQUEST['testcookie'])) {
 | |
| 725 | -                if (isset($_REQUEST['pagetype']) && $_REQUEST['pagetype'] != '') {
 | |
| 726 | - wp_redirect($_REQUEST['pagetype'] . '&emsg=1'); | |
| 727 | -                } else {
 | |
| 728 | -                    wp_redirect(geodir_login_url(array('logemsg'=>'1','redirect_to'=>urlencode($_REQUEST['redirect_to']))));
 | |
| 729 | - } | |
| 730 | - gd_die(); | |
| 731 | - } | |
| 732 | - break; | |
| 733 | - endswitch; // end action switch | |
| 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 = isset($user->ID) ? $user->ID : ''; | |
| 641 | + $author_link = get_author_posts_url($user_ID); | |
| 642 | +					$default_author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true', 'stype' => 'gd_place'), false);
 | |
| 643 | + | |
| 644 | + /** | |
| 645 | + * Filter the author link. | |
| 646 | + * | |
| 647 | + * @since 1.0.0 | |
| 648 | + * | |
| 649 | + * @param string $default_author_link Default author link. | |
| 650 | + * @param int $user_ID The user ID. | |
| 651 | + */ | |
| 652 | +					$default_author_link = apply_filters('geodir_dashboard_author_link', $default_author_link, $user_ID);
 | |
| 653 | + | |
| 654 | + $_REQUEST['redirect_to'] = $default_author_link; | |
| 655 | + else: | |
| 656 | + $_REQUEST['redirect_to'] = home_url(); | |
| 657 | + endif; | |
| 658 | + | |
| 659 | + } | |
| 660 | +			if (isset($_REQUEST['redirect_to'])) {
 | |
| 661 | + $redirect_to = $_REQUEST['redirect_to']; | |
| 662 | + // 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);
 | |
| 665 | +			} else {
 | |
| 666 | + $redirect_to = admin_url(); | |
| 667 | + } | |
| 668 | + | |
| 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; | |
| 671 | +			$user = wp_signon('', $secure_cookie);
 | |
| 672 | + | |
| 673 | + | |
| 674 | + /** | |
| 675 | + * Filter the login redirect URL. | |
| 676 | + * | |
| 677 | + * @since 1.4.9 | |
| 678 | + * @param string $redirect_to The redirect destination URL. | |
| 679 | + * @param WP_User|WP_Error $user WP_User object if login was successful, WP_Error object otherwise. | |
| 680 | + */ | |
| 681 | +			$redirect_to = apply_filters('login_redirect', $redirect_to, isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '', $user);
 | |
| 682 | + | |
| 683 | +			if (is_wp_error($user)) {
 | |
| 684 | +				if (isset($_SERVER['HTTP_REFERER']) && strstr($_SERVER['HTTP_REFERER'], 'ptype=property_submit') && $_POST['log'] != '' && $_POST['pwd'] != '') {
 | |
| 685 | + wp_redirect($_SERVER['HTTP_REFERER'] . '&emsg=1'); | |
| 686 | + } | |
| 687 | + } | |
| 688 | +			if (!is_wp_error($user)) {
 | |
| 689 | + | |
| 690 | + // Some servers are not logging the user in properly after wp_signon, se we set the user here. | |
| 691 | + //wp_set_current_user($user->ID); | |
| 692 | + //echo '###';exit; | |
| 693 | + | |
| 694 | +				if ($redirect_to) {
 | |
| 695 | + wp_redirect($redirect_to); | |
| 696 | +				} else {
 | |
| 697 | + wp_redirect(home_url()); | |
| 698 | + } | |
| 699 | + gd_die(); | |
| 700 | + } | |
| 701 | + | |
| 702 | + $errors = $user; | |
| 703 | + | |
| 704 | + // Clear errors if loggedout is set. | |
| 705 | + if (!empty($_GET['loggedout'])) | |
| 706 | + $errors = new WP_Error(); | |
| 707 | + // 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'));
 | |
| 710 | + | |
| 711 | + // Some parts of this script use the main login form to display a message | |
| 712 | +			if (isset($_GET['loggedout']) && TRUE == $_GET['loggedout']) {
 | |
| 713 | + $successmsg = '<div class="sucess_msg">' . YOU_ARE_LOGED_OUT_MSG . '</div>'; | |
| 714 | +			} elseif (isset($_GET['registration']) && 'disabled' == $_GET['registration']) {
 | |
| 715 | + $successmsg = USER_REG_NOT_ALLOW_MSG; | |
| 716 | +			} elseif (isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail']) {
 | |
| 717 | + $successmsg = EMAIL_CONFIRM_LINK_MSG; | |
| 718 | +			} elseif (isset($_GET['checkemail']) && 'newpass' == $_GET['checkemail']) {
 | |
| 719 | + $successmsg = NEW_PW_EMAIL_MSG; | |
| 720 | +			} elseif (isset($_GET['checkemail']) && 'registered' == $_GET['checkemail']) {
 | |
| 721 | + $successmsg = REG_COMPLETE_MSG; | |
| 722 | + } | |
| 723 | + | |
| 724 | +			if ((isset($_POST['log']) && $_POST['log'] != '' && $errors) || ((!isset($_POST['log']) || $_POST['log'] == '') && isset($_REQUEST['testcookie']) && $_REQUEST['testcookie'])) {
 | |
| 725 | +				if (isset($_REQUEST['pagetype']) && $_REQUEST['pagetype'] != '') {
 | |
| 726 | + wp_redirect($_REQUEST['pagetype'] . '&emsg=1'); | |
| 727 | +				} else {
 | |
| 728 | +					wp_redirect(geodir_login_url(array('logemsg'=>'1','redirect_to'=>urlencode($_REQUEST['redirect_to']))));
 | |
| 729 | + } | |
| 730 | + gd_die(); | |
| 731 | + } | |
| 732 | + break; | |
| 733 | + endswitch; // end action switch | |
| 734 | 734 | } | 
| 735 | 735 | \ 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; | 
| @@ -682,7 +682,7 @@ discard block | ||
| 682 | 682 | |
| 683 | 683 |              if (is_wp_error($user)) {
 | 
| 684 | 684 |                  if (isset($_SERVER['HTTP_REFERER']) && strstr($_SERVER['HTTP_REFERER'], 'ptype=property_submit') && $_POST['log'] != '' && $_POST['pwd'] != '') {
 | 
| 685 | - wp_redirect($_SERVER['HTTP_REFERER'] . '&emsg=1'); | |
| 685 | + wp_redirect($_SERVER['HTTP_REFERER'].'&emsg=1'); | |
| 686 | 686 | } | 
| 687 | 687 | } | 
| 688 | 688 |              if (!is_wp_error($user)) {
 | 
| @@ -710,7 +710,7 @@ discard block | ||
| 710 | 710 | |
| 711 | 711 | // Some parts of this script use the main login form to display a message | 
| 712 | 712 |              if (isset($_GET['loggedout']) && TRUE == $_GET['loggedout']) {
 | 
| 713 | - $successmsg = '<div class="sucess_msg">' . YOU_ARE_LOGED_OUT_MSG . '</div>'; | |
| 713 | + $successmsg = '<div class="sucess_msg">'.YOU_ARE_LOGED_OUT_MSG.'</div>'; | |
| 714 | 714 |              } elseif (isset($_GET['registration']) && 'disabled' == $_GET['registration']) {
 | 
| 715 | 715 | $successmsg = USER_REG_NOT_ALLOW_MSG; | 
| 716 | 716 |              } elseif (isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail']) {
 | 
| @@ -723,9 +723,9 @@ discard block | ||
| 723 | 723 | |
| 724 | 724 |              if ((isset($_POST['log']) && $_POST['log'] != '' && $errors) || ((!isset($_POST['log']) || $_POST['log'] == '') && isset($_REQUEST['testcookie']) && $_REQUEST['testcookie'])) {
 | 
| 725 | 725 |                  if (isset($_REQUEST['pagetype']) && $_REQUEST['pagetype'] != '') {
 | 
| 726 | - wp_redirect($_REQUEST['pagetype'] . '&emsg=1'); | |
| 726 | + wp_redirect($_REQUEST['pagetype'].'&emsg=1'); | |
| 727 | 727 |                  } else {
 | 
| 728 | -                    wp_redirect(geodir_login_url(array('logemsg'=>'1','redirect_to'=>urlencode($_REQUEST['redirect_to']))));
 | |
| 728 | +                    wp_redirect(geodir_login_url(array('logemsg'=>'1', 'redirect_to'=>urlencode($_REQUEST['redirect_to']))));
 | |
| 729 | 729 | } | 
| 730 | 730 | gd_die(); | 
| 731 | 731 | } | 
| @@ -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']) {
 | 
| @@ -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 | } | 
| @@ -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 = function_exists('icl_object_id') ? true : false;
 | |
| 51 | +			$is_wpml = function_exists('icl_object_id') ? 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');
 | 
| @@ -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 | 
| @@ -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 | } |