@@ -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 | } |
@@ -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 | { |
@@ -353,7 +353,7 @@ |
||
| 353 | 353 | |
| 354 | 354 | if(!$cpt_left){ |
| 355 | 355 | $cpt_left = "gd-cpt-flat"; |
| 356 | - }else{ |
|
| 356 | + } else{ |
|
| 357 | 357 | $cpt_left = ''; |
| 358 | 358 | } |
| 359 | 359 | |
@@ -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,46 +65,46 @@ 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 | - } |
|
| 82 | - |
|
| 83 | - if (geodir_is_page('add-listing')) { |
|
| 84 | - ob_start(); // Start buffering; |
|
| 85 | - geodir_action_add_listing_page_title(); |
|
| 86 | - $title = ob_get_clean(); |
|
| 87 | - avada_page_title_bar($title, $subtitle, $secondary_content); |
|
| 88 | - } |
|
| 89 | - |
|
| 90 | - if (geodir_is_page('author')) { |
|
| 91 | - ob_start(); // Start buffering; |
|
| 92 | - geodir_action_author_page_title(); |
|
| 93 | - $title = ob_get_clean(); |
|
| 94 | - avada_page_title_bar($title, $subtitle, $secondary_content); |
|
| 95 | - } |
|
| 96 | - |
|
| 97 | - if (geodir_is_page('detail') || geodir_is_page('preview')) { |
|
| 98 | - $title = get_the_title(); |
|
| 99 | - avada_page_title_bar($title, $subtitle, $secondary_content); |
|
| 100 | - } |
|
| 101 | - |
|
| 102 | - if (geodir_is_page('search')) { |
|
| 103 | - ob_start(); // Start buffering; |
|
| 104 | - geodir_action_search_page_title(); |
|
| 105 | - $title = ob_get_clean(); |
|
| 106 | - avada_page_title_bar($title, $subtitle, $secondary_content); |
|
| 107 | - } |
|
| 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 | + } |
|
| 82 | + |
|
| 83 | + if (geodir_is_page('add-listing')) { |
|
| 84 | + ob_start(); // Start buffering; |
|
| 85 | + geodir_action_add_listing_page_title(); |
|
| 86 | + $title = ob_get_clean(); |
|
| 87 | + avada_page_title_bar($title, $subtitle, $secondary_content); |
|
| 88 | + } |
|
| 89 | + |
|
| 90 | + if (geodir_is_page('author')) { |
|
| 91 | + ob_start(); // Start buffering; |
|
| 92 | + geodir_action_author_page_title(); |
|
| 93 | + $title = ob_get_clean(); |
|
| 94 | + avada_page_title_bar($title, $subtitle, $secondary_content); |
|
| 95 | + } |
|
| 96 | + |
|
| 97 | + if (geodir_is_page('detail') || geodir_is_page('preview')) { |
|
| 98 | + $title = get_the_title(); |
|
| 99 | + avada_page_title_bar($title, $subtitle, $secondary_content); |
|
| 100 | + } |
|
| 101 | + |
|
| 102 | + if (geodir_is_page('search')) { |
|
| 103 | + ob_start(); // Start buffering; |
|
| 104 | + geodir_action_search_page_title(); |
|
| 105 | + $title = ob_get_clean(); |
|
| 106 | + avada_page_title_bar($title, $subtitle, $secondary_content); |
|
| 107 | + } |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /** |
@@ -115,34 +115,34 @@ discard block |
||
| 115 | 115 | */ |
| 116 | 116 | function gd_compat_php_avada() |
| 117 | 117 | { |
| 118 | - // change widget wrappers |
|
| 119 | - //add_filter( 'geodir_before_widget', 'geodir_before_widget_compat',10,1 ); |
|
| 120 | - //add_filter( 'geodir_after_widget', 'geodir_after_widget_compat',10,1 ); |
|
| 121 | - |
|
| 122 | - // REMOVE BREADCRUMB |
|
| 123 | - remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20); |
|
| 124 | - remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20); |
|
| 125 | - remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20); |
|
| 126 | - remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20); |
|
| 127 | - remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20); |
|
| 128 | - remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20); |
|
| 129 | - |
|
| 130 | - // REMOVE PAGE TITLES |
|
| 131 | - remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10); |
|
| 132 | - remove_action('geodir_add_listing_page_title', 'geodir_action_add_listing_page_title', 10); |
|
| 133 | - remove_action('geodir_details_main_content', 'geodir_action_page_title', 20); |
|
| 134 | - remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10); |
|
| 135 | - remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10); |
|
| 136 | - |
|
| 137 | - // make top section wide |
|
| 138 | - remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
| 139 | - remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
| 140 | - remove_action('geodir_author_before_main_content', 'geodir_action_geodir_sidebar_author_top', 10); |
|
| 141 | - remove_action('geodir_search_before_main_content', 'geodir_action_geodir_sidebar_search_top', 10); |
|
| 142 | - remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_sidebar_detail_top', 10); |
|
| 143 | - remove_action('geodir_listings_before_main_content', 'geodir_action_geodir_sidebar_listings_top', 10); |
|
| 144 | - |
|
| 145 | - //gd_compat_add_top_section_back(); |
|
| 118 | + // change widget wrappers |
|
| 119 | + //add_filter( 'geodir_before_widget', 'geodir_before_widget_compat',10,1 ); |
|
| 120 | + //add_filter( 'geodir_after_widget', 'geodir_after_widget_compat',10,1 ); |
|
| 121 | + |
|
| 122 | + // REMOVE BREADCRUMB |
|
| 123 | + remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20); |
|
| 124 | + remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20); |
|
| 125 | + remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20); |
|
| 126 | + remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20); |
|
| 127 | + remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20); |
|
| 128 | + remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20); |
|
| 129 | + |
|
| 130 | + // REMOVE PAGE TITLES |
|
| 131 | + remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10); |
|
| 132 | + remove_action('geodir_add_listing_page_title', 'geodir_action_add_listing_page_title', 10); |
|
| 133 | + remove_action('geodir_details_main_content', 'geodir_action_page_title', 20); |
|
| 134 | + remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10); |
|
| 135 | + remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10); |
|
| 136 | + |
|
| 137 | + // make top section wide |
|
| 138 | + remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
| 139 | + remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
| 140 | + remove_action('geodir_author_before_main_content', 'geodir_action_geodir_sidebar_author_top', 10); |
|
| 141 | + remove_action('geodir_search_before_main_content', 'geodir_action_geodir_sidebar_search_top', 10); |
|
| 142 | + remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_sidebar_detail_top', 10); |
|
| 143 | + remove_action('geodir_listings_before_main_content', 'geodir_action_geodir_sidebar_listings_top', 10); |
|
| 144 | + |
|
| 145 | + //gd_compat_add_top_section_back(); |
|
| 146 | 146 | |
| 147 | 147 | } |
| 148 | 148 | |
@@ -156,17 +156,17 @@ discard block |
||
| 156 | 156 | function gd_compat_add_top_section_back() |
| 157 | 157 | { |
| 158 | 158 | |
| 159 | - if (is_page_geodir_home() || geodir_is_page('location')) { |
|
| 160 | - geodir_action_geodir_sidebar_home_top(); |
|
| 161 | - } elseif (geodir_is_page('listing')) { |
|
| 162 | - geodir_action_geodir_sidebar_listings_top(); |
|
| 163 | - } elseif (geodir_is_page('detail')) { |
|
| 164 | - geodir_action_geodir_sidebar_detail_top(); |
|
| 165 | - } elseif (geodir_is_page('search')) { |
|
| 166 | - geodir_action_geodir_sidebar_search_top(); |
|
| 167 | - } elseif (geodir_is_page('author')) { |
|
| 168 | - geodir_action_geodir_sidebar_author_top(); |
|
| 169 | - } |
|
| 159 | + if (is_page_geodir_home() || geodir_is_page('location')) { |
|
| 160 | + geodir_action_geodir_sidebar_home_top(); |
|
| 161 | + } elseif (geodir_is_page('listing')) { |
|
| 162 | + geodir_action_geodir_sidebar_listings_top(); |
|
| 163 | + } elseif (geodir_is_page('detail')) { |
|
| 164 | + geodir_action_geodir_sidebar_detail_top(); |
|
| 165 | + } elseif (geodir_is_page('search')) { |
|
| 166 | + geodir_action_geodir_sidebar_search_top(); |
|
| 167 | + } elseif (geodir_is_page('author')) { |
|
| 168 | + geodir_action_geodir_sidebar_author_top(); |
|
| 169 | + } |
|
| 170 | 170 | |
| 171 | 171 | |
| 172 | 172 | } |
@@ -183,12 +183,12 @@ discard block |
||
| 183 | 183 | */ |
| 184 | 184 | function gd_compat_body_class($classes) |
| 185 | 185 | { |
| 186 | - if (geodir_is_geodir_page()) { |
|
| 187 | - $classes[] = 'wpgeo-avada'; |
|
| 188 | - } else { |
|
| 189 | - $classes[] = ''; |
|
| 190 | - } |
|
| 191 | - return $classes; |
|
| 186 | + if (geodir_is_geodir_page()) { |
|
| 187 | + $classes[] = 'wpgeo-avada'; |
|
| 188 | + } else { |
|
| 189 | + $classes[] = ''; |
|
| 190 | + } |
|
| 191 | + return $classes; |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | */ |
| 203 | 203 | function geodir_before_widget_compat($var) |
| 204 | 204 | { |
| 205 | - return '<div id="%1$s" class="geodir-widget %2$s">'; |
|
| 205 | + return '<div id="%1$s" class="geodir-widget %2$s">'; |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | /** |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | */ |
| 216 | 216 | function geodir_after_widget_compat($var) |
| 217 | 217 | { |
| 218 | - return '</div>'; |
|
| 218 | + return '</div>'; |
|
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | add_filter('geodir_search_form_class', 'geodir_search_form_class_avada'); |
@@ -229,8 +229,8 @@ discard block |
||
| 229 | 229 | */ |
| 230 | 230 | function geodir_search_form_class_avada($class) |
| 231 | 231 | { |
| 232 | - $class .= ' search'; |
|
| 233 | - return $class; |
|
| 232 | + $class .= ' search'; |
|
| 233 | + return $class; |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | |
@@ -76,22 +76,19 @@ discard block |
||
| 76 | 76 | if(!$ga_start){$ga_start = date('Y-m-d', strtotime("-6 day"));}
|
| 77 | 77 | if(!$ga_end){$ga_end = date('Y-m-d');}
|
| 78 | 78 | $dimensions = "&dimensions=ga:date,ga:nthDay"; |
| 79 | - }elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastweek'){
|
|
| 79 | + } elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastweek'){
|
|
| 80 | 80 | if(!$ga_start){$ga_start = date('Y-m-d', strtotime("-13 day"));}
|
| 81 | 81 | if(!$ga_end){$ga_end = date('Y-m-d', strtotime("-7 day"));}
|
| 82 | 82 | $dimensions = "&dimensions=ga:date,ga:nthDay"; |
| 83 | - } |
|
| 84 | - elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='thisyear'){
|
|
| 83 | + } elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='thisyear'){
|
|
| 85 | 84 | if(!$ga_start){$ga_start = date('Y')."-01-01";}
|
| 86 | 85 | if(!$ga_end){$ga_end = date('Y-m-d');}
|
| 87 | 86 | $dimensions = "&dimensions=ga:month,ga:nthMonth"; |
| 88 | - } |
|
| 89 | - elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastyear'){
|
|
| 87 | + } elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastyear'){
|
|
| 90 | 88 | if(!$ga_start){$ga_start = date('Y', strtotime("-1 year"))."-01-01";}
|
| 91 | 89 | if(!$ga_end){$ga_end = date('Y', strtotime("-1 year"))."-12-31";}
|
| 92 | 90 | $dimensions = "&dimensions=ga:month,ga:nthMonth"; |
| 93 | - } |
|
| 94 | - elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='country'){
|
|
| 91 | + } elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='country'){
|
|
| 95 | 92 | if(!$ga_start){$ga_start = "14daysAgo";}
|
| 96 | 93 | if(!$ga_end){$ga_end = "yesterday";}
|
| 97 | 94 | $dimensions = "&dimensions=ga:country&sort=-ga:pageviews&max-results=5"; |
@@ -144,7 +141,7 @@ discard block |
||
| 144 | 141 | if(!empty($response['response']['code']) && $response['response']['code']==200) {//access token is valid
|
| 145 | 142 | |
| 146 | 143 | return $at; |
| 147 | - }else{//else get new access token
|
|
| 144 | + } else{//else get new access token
|
|
| 148 | 145 | |
| 149 | 146 | $refresh_at = get_option('gd_ga_refresh_token');
|
| 150 | 147 | if(!$refresh_at){
|
@@ -167,7 +164,7 @@ discard block |
||
| 167 | 164 | update_option('gd_ga_access_token', $parts->access_token);
|
| 168 | 165 | return $parts->access_token; |
| 169 | 166 | |
| 170 | - }else{
|
|
| 167 | + } else{
|
|
| 171 | 168 | echo json_encode(array('error'=>__('Login failed', 'geodirectory')));exit;
|
| 172 | 169 | } |
| 173 | 170 | |
@@ -17,34 +17,34 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | function geodir_sec2hms($sec, $padHours = false) |
| 19 | 19 | {
|
| 20 | - // holds formatted string |
|
| 21 | - $hms = ""; |
|
| 22 | - // there are 3600 seconds in an hour, so if we |
|
| 23 | - // divide total seconds by 3600 and throw away |
|
| 24 | - // the remainder, we've got the number of hours |
|
| 25 | - $hours = intval(intval($sec) / 3600); |
|
| 26 | - |
|
| 27 | - // add to $hms, with a leading 0 if asked for |
|
| 28 | - $hms .= ($padHours) ? str_pad($hours, 2, "0", STR_PAD_LEFT) . ':' : $hours . ':'; |
|
| 29 | - |
|
| 30 | - // dividing the total seconds by 60 will give us |
|
| 31 | - // the number of minutes, but we're interested in |
|
| 32 | - // minutes past the hour: to get that, we need to |
|
| 33 | - // divide by 60 again and keep the remainder |
|
| 34 | - $minutes = intval(($sec / 60) % 60); |
|
| 35 | - |
|
| 36 | - // then add to $hms (with a leading 0 if needed) |
|
| 37 | - $hms .= str_pad($minutes, 2, "0", STR_PAD_LEFT) . ':'; |
|
| 38 | - |
|
| 39 | - // seconds are simple - just divide the total |
|
| 40 | - // seconds by 60 and keep the remainder |
|
| 41 | - $seconds = intval($sec % 60); |
|
| 42 | - |
|
| 43 | - // add to $hms, again with a leading 0 if needed |
|
| 44 | - $hms .= str_pad($seconds, 2, "0", STR_PAD_LEFT); |
|
| 45 | - |
|
| 46 | - // done! |
|
| 47 | - return $hms; |
|
| 20 | + // holds formatted string |
|
| 21 | + $hms = ""; |
|
| 22 | + // there are 3600 seconds in an hour, so if we |
|
| 23 | + // divide total seconds by 3600 and throw away |
|
| 24 | + // the remainder, we've got the number of hours |
|
| 25 | + $hours = intval(intval($sec) / 3600); |
|
| 26 | + |
|
| 27 | + // add to $hms, with a leading 0 if asked for |
|
| 28 | + $hms .= ($padHours) ? str_pad($hours, 2, "0", STR_PAD_LEFT) . ':' : $hours . ':'; |
|
| 29 | + |
|
| 30 | + // dividing the total seconds by 60 will give us |
|
| 31 | + // the number of minutes, but we're interested in |
|
| 32 | + // minutes past the hour: to get that, we need to |
|
| 33 | + // divide by 60 again and keep the remainder |
|
| 34 | + $minutes = intval(($sec / 60) % 60); |
|
| 35 | + |
|
| 36 | + // then add to $hms (with a leading 0 if needed) |
|
| 37 | + $hms .= str_pad($minutes, 2, "0", STR_PAD_LEFT) . ':'; |
|
| 38 | + |
|
| 39 | + // seconds are simple - just divide the total |
|
| 40 | + // seconds by 60 and keep the remainder |
|
| 41 | + $seconds = intval($sec % 60); |
|
| 42 | + |
|
| 43 | + // add to $hms, again with a leading 0 if needed |
|
| 44 | + $hms .= str_pad($seconds, 2, "0", STR_PAD_LEFT); |
|
| 45 | + |
|
| 46 | + // done! |
|
| 47 | + return $hms; |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
@@ -61,117 +61,117 @@ discard block |
||
| 61 | 61 | {
|
| 62 | 62 | |
| 63 | 63 | |
| 64 | - // NOTE: the id is in the form ga:12345 and not just 12345 |
|
| 65 | - // if you do e.g. 12345 then no data will be returned |
|
| 66 | - // read http://www.electrictoolbox.com/get-id-for-google-analytics-api/ for info about how to get this id from the GA web interface |
|
| 67 | - // or load the accounts (see below) and get it from there |
|
| 68 | - // if you don't specify an id here, then you'll get the "Badly formatted request to the Google Analytics API..." error message |
|
| 69 | - $id = trim(get_option('geodir_ga_id'));
|
|
| 70 | - |
|
| 71 | - $at = geodir_ga_get_token(); |
|
| 72 | - |
|
| 73 | - $start_date = ''; |
|
| 74 | - $end_date = ''; |
|
| 75 | - $dimensions = "&filters=ga:pagePath==" . $page; |
|
| 76 | - if(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='thisweek'){
|
|
| 77 | - if(!$ga_start){$ga_start = date('Y-m-d', strtotime("-6 day"));}
|
|
| 78 | - if(!$ga_end){$ga_end = date('Y-m-d');}
|
|
| 79 | - $dimensions = "&dimensions=ga:date,ga:nthDay"; |
|
| 80 | - }elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastweek'){
|
|
| 81 | - if(!$ga_start){$ga_start = date('Y-m-d', strtotime("-13 day"));}
|
|
| 82 | - if(!$ga_end){$ga_end = date('Y-m-d', strtotime("-7 day"));}
|
|
| 83 | - $dimensions = "&dimensions=ga:date,ga:nthDay"; |
|
| 84 | - } |
|
| 85 | - elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='thisyear'){
|
|
| 86 | - if(!$ga_start){$ga_start = date('Y')."-01-01";}
|
|
| 87 | - if(!$ga_end){$ga_end = date('Y-m-d');}
|
|
| 88 | - $dimensions = "&dimensions=ga:month,ga:nthMonth"; |
|
| 89 | - } |
|
| 90 | - elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastyear'){
|
|
| 91 | - if(!$ga_start){$ga_start = date('Y', strtotime("-1 year"))."-01-01";}
|
|
| 92 | - if(!$ga_end){$ga_end = date('Y', strtotime("-1 year"))."-12-31";}
|
|
| 93 | - $dimensions = "&dimensions=ga:month,ga:nthMonth"; |
|
| 94 | - } |
|
| 95 | - elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='country'){
|
|
| 96 | - if(!$ga_start){$ga_start = "14daysAgo";}
|
|
| 97 | - if(!$ga_end){$ga_end = "yesterday";}
|
|
| 98 | - $dimensions = "&dimensions=ga:country&sort=-ga:pageviews&max-results=5"; |
|
| 99 | - } |
|
| 100 | - |
|
| 101 | - $APIURL = "https://www.googleapis.com/analytics/v3/data/ga?"; |
|
| 102 | - $ids = "ids=".$id; |
|
| 103 | - if(!$start_date){$start_date = "&start-date=".$ga_start;}
|
|
| 104 | - if(!$end_date){$end_date = "&end-date=".$ga_end;}
|
|
| 105 | - $metrics = "&metrics=ga:pageviews"; |
|
| 106 | - $filters = "&filters=ga:pagePath==".$page; |
|
| 107 | - $access_token = "&access_token=".$at; |
|
| 108 | - |
|
| 109 | - $use_url = $APIURL.$ids.$start_date.$end_date.$dimensions.$metrics.$filters.$access_token; |
|
| 110 | - |
|
| 111 | - if(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='realtime'){
|
|
| 112 | - $metrics = "&metrics=rt:activeUsers"; |
|
| 113 | - $dimensions = "&filters=ga:pagePath==".$page; |
|
| 114 | - |
|
| 115 | - $use_url = "https://www.googleapis.com/analytics/v3/data/realtime?".$ids.$access_token.$metrics.$dimensions; |
|
| 116 | - } |
|
| 117 | - |
|
| 118 | - $response = wp_remote_get($use_url,array('timeout' => 15));
|
|
| 119 | - |
|
| 120 | - // Make countries translatable |
|
| 121 | - if(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='country'){
|
|
| 122 | - $c_arr = json_decode($response['body']); |
|
| 123 | - if(is_array($c_arr->rows)){
|
|
| 124 | - $new_rows = array(); |
|
| 125 | - foreach($c_arr->rows as $wow){
|
|
| 126 | - $new_rows[] = array(__($wow[0],'geodirectory'),$wow[1]); |
|
| 127 | - } |
|
| 128 | - $c_arr->rows = $new_rows; |
|
| 129 | - } |
|
| 130 | - $response['body'] = json_encode($c_arr); |
|
| 131 | - } |
|
| 132 | - |
|
| 133 | - echo $response['body']; |
|
| 134 | - exit; |
|
| 64 | + // NOTE: the id is in the form ga:12345 and not just 12345 |
|
| 65 | + // if you do e.g. 12345 then no data will be returned |
|
| 66 | + // read http://www.electrictoolbox.com/get-id-for-google-analytics-api/ for info about how to get this id from the GA web interface |
|
| 67 | + // or load the accounts (see below) and get it from there |
|
| 68 | + // if you don't specify an id here, then you'll get the "Badly formatted request to the Google Analytics API..." error message |
|
| 69 | + $id = trim(get_option('geodir_ga_id'));
|
|
| 70 | + |
|
| 71 | + $at = geodir_ga_get_token(); |
|
| 72 | + |
|
| 73 | + $start_date = ''; |
|
| 74 | + $end_date = ''; |
|
| 75 | + $dimensions = "&filters=ga:pagePath==" . $page; |
|
| 76 | + if(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='thisweek'){
|
|
| 77 | + if(!$ga_start){$ga_start = date('Y-m-d', strtotime("-6 day"));}
|
|
| 78 | + if(!$ga_end){$ga_end = date('Y-m-d');}
|
|
| 79 | + $dimensions = "&dimensions=ga:date,ga:nthDay"; |
|
| 80 | + }elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastweek'){
|
|
| 81 | + if(!$ga_start){$ga_start = date('Y-m-d', strtotime("-13 day"));}
|
|
| 82 | + if(!$ga_end){$ga_end = date('Y-m-d', strtotime("-7 day"));}
|
|
| 83 | + $dimensions = "&dimensions=ga:date,ga:nthDay"; |
|
| 84 | + } |
|
| 85 | + elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='thisyear'){
|
|
| 86 | + if(!$ga_start){$ga_start = date('Y')."-01-01";}
|
|
| 87 | + if(!$ga_end){$ga_end = date('Y-m-d');}
|
|
| 88 | + $dimensions = "&dimensions=ga:month,ga:nthMonth"; |
|
| 89 | + } |
|
| 90 | + elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastyear'){
|
|
| 91 | + if(!$ga_start){$ga_start = date('Y', strtotime("-1 year"))."-01-01";}
|
|
| 92 | + if(!$ga_end){$ga_end = date('Y', strtotime("-1 year"))."-12-31";}
|
|
| 93 | + $dimensions = "&dimensions=ga:month,ga:nthMonth"; |
|
| 94 | + } |
|
| 95 | + elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='country'){
|
|
| 96 | + if(!$ga_start){$ga_start = "14daysAgo";}
|
|
| 97 | + if(!$ga_end){$ga_end = "yesterday";}
|
|
| 98 | + $dimensions = "&dimensions=ga:country&sort=-ga:pageviews&max-results=5"; |
|
| 99 | + } |
|
| 100 | + |
|
| 101 | + $APIURL = "https://www.googleapis.com/analytics/v3/data/ga?"; |
|
| 102 | + $ids = "ids=".$id; |
|
| 103 | + if(!$start_date){$start_date = "&start-date=".$ga_start;}
|
|
| 104 | + if(!$end_date){$end_date = "&end-date=".$ga_end;}
|
|
| 105 | + $metrics = "&metrics=ga:pageviews"; |
|
| 106 | + $filters = "&filters=ga:pagePath==".$page; |
|
| 107 | + $access_token = "&access_token=".$at; |
|
| 108 | + |
|
| 109 | + $use_url = $APIURL.$ids.$start_date.$end_date.$dimensions.$metrics.$filters.$access_token; |
|
| 110 | + |
|
| 111 | + if(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='realtime'){
|
|
| 112 | + $metrics = "&metrics=rt:activeUsers"; |
|
| 113 | + $dimensions = "&filters=ga:pagePath==".$page; |
|
| 114 | + |
|
| 115 | + $use_url = "https://www.googleapis.com/analytics/v3/data/realtime?".$ids.$access_token.$metrics.$dimensions; |
|
| 116 | + } |
|
| 117 | + |
|
| 118 | + $response = wp_remote_get($use_url,array('timeout' => 15));
|
|
| 119 | + |
|
| 120 | + // Make countries translatable |
|
| 121 | + if(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='country'){
|
|
| 122 | + $c_arr = json_decode($response['body']); |
|
| 123 | + if(is_array($c_arr->rows)){
|
|
| 124 | + $new_rows = array(); |
|
| 125 | + foreach($c_arr->rows as $wow){
|
|
| 126 | + $new_rows[] = array(__($wow[0],'geodirectory'),$wow[1]); |
|
| 127 | + } |
|
| 128 | + $c_arr->rows = $new_rows; |
|
| 129 | + } |
|
| 130 | + $response['body'] = json_encode($c_arr); |
|
| 131 | + } |
|
| 132 | + |
|
| 133 | + echo $response['body']; |
|
| 134 | + exit; |
|
| 135 | 135 | |
| 136 | 136 | }// end GA function |
| 137 | 137 | |
| 138 | 138 | |
| 139 | 139 | function geodir_ga_get_token(){
|
| 140 | - $at = get_option('gd_ga_access_token');
|
|
| 141 | - $use_url = "https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=".$at; |
|
| 142 | - $response = wp_remote_get($use_url,array('timeout' => 15));
|
|
| 140 | + $at = get_option('gd_ga_access_token');
|
|
| 141 | + $use_url = "https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=".$at; |
|
| 142 | + $response = wp_remote_get($use_url,array('timeout' => 15));
|
|
| 143 | 143 | |
| 144 | - if(!empty($response['response']['code']) && $response['response']['code']==200) {//access token is valid
|
|
| 144 | + if(!empty($response['response']['code']) && $response['response']['code']==200) {//access token is valid
|
|
| 145 | 145 | |
| 146 | - return $at; |
|
| 147 | - }else{//else get new access token
|
|
| 146 | + return $at; |
|
| 147 | + }else{//else get new access token
|
|
| 148 | 148 | |
| 149 | - $refresh_at = get_option('gd_ga_refresh_token');
|
|
| 150 | - if(!$refresh_at){
|
|
| 151 | - echo json_encode(array('error'=>__('Not authorized, please click authorized in GD > Google analytic settings.', 'geodirectory')));exit;
|
|
| 152 | - } |
|
| 149 | + $refresh_at = get_option('gd_ga_refresh_token');
|
|
| 150 | + if(!$refresh_at){
|
|
| 151 | + echo json_encode(array('error'=>__('Not authorized, please click authorized in GD > Google analytic settings.', 'geodirectory')));exit;
|
|
| 152 | + } |
|
| 153 | 153 | |
| 154 | - $rat_url = "https://www.googleapis.com/oauth2/v3/token?"; |
|
| 155 | - $client_id = "client_id=".get_option('geodir_ga_client_id');
|
|
| 156 | - $client_secret = "&client_secret=".get_option('geodir_ga_client_secret');
|
|
| 157 | - $refresh_token = "&refresh_token=".$refresh_at; |
|
| 158 | - $grant_type = "&grant_type=refresh_token"; |
|
| 154 | + $rat_url = "https://www.googleapis.com/oauth2/v3/token?"; |
|
| 155 | + $client_id = "client_id=".get_option('geodir_ga_client_id');
|
|
| 156 | + $client_secret = "&client_secret=".get_option('geodir_ga_client_secret');
|
|
| 157 | + $refresh_token = "&refresh_token=".$refresh_at; |
|
| 158 | + $grant_type = "&grant_type=refresh_token"; |
|
| 159 | 159 | |
| 160 | - $rat_url_use = $rat_url.$client_id.$client_secret.$refresh_token.$grant_type; |
|
| 160 | + $rat_url_use = $rat_url.$client_id.$client_secret.$refresh_token.$grant_type; |
|
| 161 | 161 | |
| 162 | - $rat_response = wp_remote_post($rat_url_use,array('timeout' => 15));
|
|
| 163 | - if(!empty($rat_response['response']['code']) && $rat_response['response']['code']==200) {
|
|
| 164 | - $parts = json_decode($rat_response['body']); |
|
| 162 | + $rat_response = wp_remote_post($rat_url_use,array('timeout' => 15));
|
|
| 163 | + if(!empty($rat_response['response']['code']) && $rat_response['response']['code']==200) {
|
|
| 164 | + $parts = json_decode($rat_response['body']); |
|
| 165 | 165 | |
| 166 | 166 | |
| 167 | - update_option('gd_ga_access_token', $parts->access_token);
|
|
| 168 | - return $parts->access_token; |
|
| 167 | + update_option('gd_ga_access_token', $parts->access_token);
|
|
| 168 | + return $parts->access_token; |
|
| 169 | 169 | |
| 170 | - }else{
|
|
| 171 | - echo json_encode(array('error'=>__('Login failed', 'geodirectory')));exit;
|
|
| 172 | - } |
|
| 170 | + }else{
|
|
| 171 | + echo json_encode(array('error'=>__('Login failed', 'geodirectory')));exit;
|
|
| 172 | + } |
|
| 173 | 173 | |
| 174 | 174 | |
| 175 | - } |
|
| 175 | + } |
|
| 176 | 176 | |
| 177 | 177 | } |
| 178 | 178 | \ No newline at end of file |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | $hours = intval(intval($sec) / 3600); |
| 26 | 26 | |
| 27 | 27 | // add to $hms, with a leading 0 if asked for |
| 28 | - $hms .= ($padHours) ? str_pad($hours, 2, "0", STR_PAD_LEFT) . ':' : $hours . ':'; |
|
| 28 | + $hms .= ($padHours) ? str_pad($hours, 2, "0", STR_PAD_LEFT).':' : $hours.':'; |
|
| 29 | 29 | |
| 30 | 30 | // dividing the total seconds by 60 will give us |
| 31 | 31 | // the number of minutes, but we're interested in |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | $minutes = intval(($sec / 60) % 60); |
| 35 | 35 | |
| 36 | 36 | // then add to $hms (with a leading 0 if needed) |
| 37 | - $hms .= str_pad($minutes, 2, "0", STR_PAD_LEFT) . ':'; |
|
| 37 | + $hms .= str_pad($minutes, 2, "0", STR_PAD_LEFT).':'; |
|
| 38 | 38 | |
| 39 | 39 | // seconds are simple - just divide the total |
| 40 | 40 | // seconds by 60 and keep the remainder |
@@ -72,58 +72,58 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | $start_date = ''; |
| 74 | 74 | $end_date = ''; |
| 75 | - $dimensions = "&filters=ga:pagePath==" . $page; |
|
| 76 | - if(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='thisweek'){
|
|
| 77 | - if(!$ga_start){$ga_start = date('Y-m-d', strtotime("-6 day"));}
|
|
| 78 | - if(!$ga_end){$ga_end = date('Y-m-d');}
|
|
| 75 | + $dimensions = "&filters=ga:pagePath==".$page; |
|
| 76 | + if (isset($_REQUEST['ga_type']) && $_REQUEST['ga_type'] == 'thisweek') {
|
|
| 77 | + if (!$ga_start) {$ga_start = date('Y-m-d', strtotime("-6 day")); }
|
|
| 78 | + if (!$ga_end) {$ga_end = date('Y-m-d'); }
|
|
| 79 | 79 | $dimensions = "&dimensions=ga:date,ga:nthDay"; |
| 80 | - }elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastweek'){
|
|
| 81 | - if(!$ga_start){$ga_start = date('Y-m-d', strtotime("-13 day"));}
|
|
| 82 | - if(!$ga_end){$ga_end = date('Y-m-d', strtotime("-7 day"));}
|
|
| 80 | + }elseif (isset($_REQUEST['ga_type']) && $_REQUEST['ga_type'] == 'lastweek') {
|
|
| 81 | + if (!$ga_start) {$ga_start = date('Y-m-d', strtotime("-13 day")); }
|
|
| 82 | + if (!$ga_end) {$ga_end = date('Y-m-d', strtotime("-7 day")); }
|
|
| 83 | 83 | $dimensions = "&dimensions=ga:date,ga:nthDay"; |
| 84 | 84 | } |
| 85 | - elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='thisyear'){
|
|
| 86 | - if(!$ga_start){$ga_start = date('Y')."-01-01";}
|
|
| 87 | - if(!$ga_end){$ga_end = date('Y-m-d');}
|
|
| 85 | + elseif (isset($_REQUEST['ga_type']) && $_REQUEST['ga_type'] == 'thisyear') {
|
|
| 86 | + if (!$ga_start) {$ga_start = date('Y')."-01-01"; }
|
|
| 87 | + if (!$ga_end) {$ga_end = date('Y-m-d'); }
|
|
| 88 | 88 | $dimensions = "&dimensions=ga:month,ga:nthMonth"; |
| 89 | 89 | } |
| 90 | - elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastyear'){
|
|
| 91 | - if(!$ga_start){$ga_start = date('Y', strtotime("-1 year"))."-01-01";}
|
|
| 92 | - if(!$ga_end){$ga_end = date('Y', strtotime("-1 year"))."-12-31";}
|
|
| 90 | + elseif (isset($_REQUEST['ga_type']) && $_REQUEST['ga_type'] == 'lastyear') {
|
|
| 91 | + if (!$ga_start) {$ga_start = date('Y', strtotime("-1 year"))."-01-01"; }
|
|
| 92 | + if (!$ga_end) {$ga_end = date('Y', strtotime("-1 year"))."-12-31"; }
|
|
| 93 | 93 | $dimensions = "&dimensions=ga:month,ga:nthMonth"; |
| 94 | 94 | } |
| 95 | - elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='country'){
|
|
| 96 | - if(!$ga_start){$ga_start = "14daysAgo";}
|
|
| 97 | - if(!$ga_end){$ga_end = "yesterday";}
|
|
| 95 | + elseif (isset($_REQUEST['ga_type']) && $_REQUEST['ga_type'] == 'country') {
|
|
| 96 | + if (!$ga_start) {$ga_start = "14daysAgo"; }
|
|
| 97 | + if (!$ga_end) {$ga_end = "yesterday"; }
|
|
| 98 | 98 | $dimensions = "&dimensions=ga:country&sort=-ga:pageviews&max-results=5"; |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | $APIURL = "https://www.googleapis.com/analytics/v3/data/ga?"; |
| 102 | 102 | $ids = "ids=".$id; |
| 103 | - if(!$start_date){$start_date = "&start-date=".$ga_start;}
|
|
| 104 | - if(!$end_date){$end_date = "&end-date=".$ga_end;}
|
|
| 103 | + if (!$start_date) {$start_date = "&start-date=".$ga_start; }
|
|
| 104 | + if (!$end_date) {$end_date = "&end-date=".$ga_end; }
|
|
| 105 | 105 | $metrics = "&metrics=ga:pageviews"; |
| 106 | 106 | $filters = "&filters=ga:pagePath==".$page; |
| 107 | 107 | $access_token = "&access_token=".$at; |
| 108 | 108 | |
| 109 | 109 | $use_url = $APIURL.$ids.$start_date.$end_date.$dimensions.$metrics.$filters.$access_token; |
| 110 | 110 | |
| 111 | - if(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='realtime'){
|
|
| 111 | + if (isset($_REQUEST['ga_type']) && $_REQUEST['ga_type'] == 'realtime') {
|
|
| 112 | 112 | $metrics = "&metrics=rt:activeUsers"; |
| 113 | 113 | $dimensions = "&filters=ga:pagePath==".$page; |
| 114 | 114 | |
| 115 | 115 | $use_url = "https://www.googleapis.com/analytics/v3/data/realtime?".$ids.$access_token.$metrics.$dimensions; |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - $response = wp_remote_get($use_url,array('timeout' => 15));
|
|
| 118 | + $response = wp_remote_get($use_url, array('timeout' => 15));
|
|
| 119 | 119 | |
| 120 | 120 | // Make countries translatable |
| 121 | - if(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='country'){
|
|
| 121 | + if (isset($_REQUEST['ga_type']) && $_REQUEST['ga_type'] == 'country') {
|
|
| 122 | 122 | $c_arr = json_decode($response['body']); |
| 123 | - if(is_array($c_arr->rows)){
|
|
| 123 | + if (is_array($c_arr->rows)) {
|
|
| 124 | 124 | $new_rows = array(); |
| 125 | - foreach($c_arr->rows as $wow){
|
|
| 126 | - $new_rows[] = array(__($wow[0],'geodirectory'),$wow[1]); |
|
| 125 | + foreach ($c_arr->rows as $wow) {
|
|
| 126 | + $new_rows[] = array(__($wow[0], 'geodirectory'), $wow[1]); |
|
| 127 | 127 | } |
| 128 | 128 | $c_arr->rows = $new_rows; |
| 129 | 129 | } |
@@ -136,19 +136,19 @@ discard block |
||
| 136 | 136 | }// end GA function |
| 137 | 137 | |
| 138 | 138 | |
| 139 | -function geodir_ga_get_token(){
|
|
| 139 | +function geodir_ga_get_token() {
|
|
| 140 | 140 | $at = get_option('gd_ga_access_token');
|
| 141 | 141 | $use_url = "https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=".$at; |
| 142 | - $response = wp_remote_get($use_url,array('timeout' => 15));
|
|
| 142 | + $response = wp_remote_get($use_url, array('timeout' => 15));
|
|
| 143 | 143 | |
| 144 | - if(!empty($response['response']['code']) && $response['response']['code']==200) {//access token is valid
|
|
| 144 | + if (!empty($response['response']['code']) && $response['response']['code'] == 200) {//access token is valid
|
|
| 145 | 145 | |
| 146 | 146 | return $at; |
| 147 | - }else{//else get new access token
|
|
| 147 | + } else {//else get new access token
|
|
| 148 | 148 | |
| 149 | 149 | $refresh_at = get_option('gd_ga_refresh_token');
|
| 150 | - if(!$refresh_at){
|
|
| 151 | - echo json_encode(array('error'=>__('Not authorized, please click authorized in GD > Google analytic settings.', 'geodirectory')));exit;
|
|
| 150 | + if (!$refresh_at) {
|
|
| 151 | + echo json_encode(array('error'=>__('Not authorized, please click authorized in GD > Google analytic settings.', 'geodirectory'))); exit;
|
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | $rat_url = "https://www.googleapis.com/oauth2/v3/token?"; |
@@ -159,16 +159,16 @@ discard block |
||
| 159 | 159 | |
| 160 | 160 | $rat_url_use = $rat_url.$client_id.$client_secret.$refresh_token.$grant_type; |
| 161 | 161 | |
| 162 | - $rat_response = wp_remote_post($rat_url_use,array('timeout' => 15));
|
|
| 163 | - if(!empty($rat_response['response']['code']) && $rat_response['response']['code']==200) {
|
|
| 162 | + $rat_response = wp_remote_post($rat_url_use, array('timeout' => 15));
|
|
| 163 | + if (!empty($rat_response['response']['code']) && $rat_response['response']['code'] == 200) {
|
|
| 164 | 164 | $parts = json_decode($rat_response['body']); |
| 165 | 165 | |
| 166 | 166 | |
| 167 | 167 | update_option('gd_ga_access_token', $parts->access_token);
|
| 168 | 168 | return $parts->access_token; |
| 169 | 169 | |
| 170 | - }else{
|
|
| 171 | - echo json_encode(array('error'=>__('Login failed', 'geodirectory')));exit;
|
|
| 170 | + } else {
|
|
| 171 | + echo json_encode(array('error'=>__('Login failed', 'geodirectory'))); exit;
|
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | $slug = $post->post_name; |
| 154 | 154 | //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
| 155 | 155 | $login_url = trailingslashit($home_url)."$slug/"; |
| 156 | - }else{ |
|
| 156 | + } else{ |
|
| 157 | 157 | $login_url = trailingslashit($home_url)."?geodir_signup=true"; |
| 158 | 158 | } |
| 159 | 159 | |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | $slug = $post->post_name; |
| 203 | 203 | //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
| 204 | 204 | $info_url = trailingslashit($home_url)."$slug/"; |
| 205 | - }else{ |
|
| 205 | + } else{ |
|
| 206 | 206 | $info_url = trailingslashit($home_url); |
| 207 | 207 | } |
| 208 | 208 | |
@@ -14,13 +14,13 @@ discard block |
||
| 14 | 14 | * @return int|null Return the page ID if present or null if not. |
| 15 | 15 | */ |
| 16 | 16 | function geodir_add_listing_page_id(){ |
| 17 | - $gd_page_id = get_option('geodir_add_listing_page'); |
|
| 17 | + $gd_page_id = get_option('geodir_add_listing_page'); |
|
| 18 | 18 | |
| 19 | - if (function_exists('icl_object_id')) { |
|
| 20 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 21 | - } |
|
| 19 | + if (function_exists('icl_object_id')) { |
|
| 20 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 21 | + } |
|
| 22 | 22 | |
| 23 | - return $gd_page_id; |
|
| 23 | + return $gd_page_id; |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | /** |
@@ -31,13 +31,13 @@ discard block |
||
| 31 | 31 | * @return int|null Return the page ID if present or null if not. |
| 32 | 32 | */ |
| 33 | 33 | function geodir_preview_page_id(){ |
| 34 | - $gd_page_id = get_option('geodir_preview_page'); |
|
| 34 | + $gd_page_id = get_option('geodir_preview_page'); |
|
| 35 | 35 | |
| 36 | - if (function_exists('icl_object_id')) { |
|
| 37 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 38 | - } |
|
| 36 | + if (function_exists('icl_object_id')) { |
|
| 37 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - return $gd_page_id; |
|
| 40 | + return $gd_page_id; |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
@@ -48,13 +48,13 @@ discard block |
||
| 48 | 48 | * @return int|null Return the page ID if present or null if not. |
| 49 | 49 | */ |
| 50 | 50 | function geodir_success_page_id(){ |
| 51 | - $gd_page_id = get_option('geodir_success_page'); |
|
| 51 | + $gd_page_id = get_option('geodir_success_page'); |
|
| 52 | 52 | |
| 53 | - if (function_exists('icl_object_id')) { |
|
| 54 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 55 | - } |
|
| 53 | + if (function_exists('icl_object_id')) { |
|
| 54 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - return $gd_page_id; |
|
| 57 | + return $gd_page_id; |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
@@ -65,13 +65,13 @@ discard block |
||
| 65 | 65 | * @return int|null Return the page ID if present or null if not. |
| 66 | 66 | */ |
| 67 | 67 | function geodir_location_page_id(){ |
| 68 | - $gd_page_id = get_option('geodir_location_page'); |
|
| 68 | + $gd_page_id = get_option('geodir_location_page'); |
|
| 69 | 69 | |
| 70 | - if (function_exists('icl_object_id')) { |
|
| 71 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 72 | - } |
|
| 70 | + if (function_exists('icl_object_id')) { |
|
| 71 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | - return $gd_page_id; |
|
| 74 | + return $gd_page_id; |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /** |
@@ -82,13 +82,13 @@ discard block |
||
| 82 | 82 | * @return int|null Return the page ID if present or null if not. |
| 83 | 83 | */ |
| 84 | 84 | function geodir_home_page_id(){ |
| 85 | - $gd_page_id = get_option('geodir_home_page'); |
|
| 85 | + $gd_page_id = get_option('geodir_home_page'); |
|
| 86 | 86 | |
| 87 | - if (function_exists('icl_object_id')) { |
|
| 88 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 89 | - } |
|
| 87 | + if (function_exists('icl_object_id')) { |
|
| 88 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 89 | + } |
|
| 90 | 90 | |
| 91 | - return $gd_page_id; |
|
| 91 | + return $gd_page_id; |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | /** |
@@ -99,13 +99,13 @@ discard block |
||
| 99 | 99 | * @return int|null Return the page ID if present or null if not. |
| 100 | 100 | */ |
| 101 | 101 | function geodir_info_page_id(){ |
| 102 | - $gd_page_id = get_option('geodir_info_page'); |
|
| 102 | + $gd_page_id = get_option('geodir_info_page'); |
|
| 103 | 103 | |
| 104 | - if (function_exists('icl_object_id')) { |
|
| 105 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 106 | - } |
|
| 104 | + if (function_exists('icl_object_id')) { |
|
| 105 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 106 | + } |
|
| 107 | 107 | |
| 108 | - return $gd_page_id; |
|
| 108 | + return $gd_page_id; |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | /** |
@@ -116,13 +116,13 @@ discard block |
||
| 116 | 116 | * @return int|null Return the page ID if present or null if not. |
| 117 | 117 | */ |
| 118 | 118 | function geodir_login_page_id(){ |
| 119 | - $gd_page_id = get_option('geodir_login_page'); |
|
| 119 | + $gd_page_id = get_option('geodir_login_page'); |
|
| 120 | 120 | |
| 121 | - if (function_exists('icl_object_id')) { |
|
| 122 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 123 | - } |
|
| 121 | + if (function_exists('icl_object_id')) { |
|
| 122 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 123 | + } |
|
| 124 | 124 | |
| 125 | - return $gd_page_id; |
|
| 125 | + return $gd_page_id; |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | |
@@ -134,45 +134,45 @@ discard block |
||
| 134 | 134 | * @return int|null Return the page ID if present or null if not. |
| 135 | 135 | */ |
| 136 | 136 | function geodir_login_url($args=array()){ |
| 137 | - $gd_page_id = get_option('geodir_login_page'); |
|
| 138 | - |
|
| 139 | - if (function_exists('icl_object_id')) { |
|
| 140 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 141 | - } |
|
| 142 | - |
|
| 143 | - if (function_exists('geodir_location_geo_home_link')) { |
|
| 144 | - remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
| 145 | - } |
|
| 146 | - $home_url = get_home_url(); |
|
| 147 | - if (function_exists('geodir_location_geo_home_link')) { |
|
| 148 | - add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
| 149 | - } |
|
| 150 | - |
|
| 151 | - if($gd_page_id){ |
|
| 152 | - $post = get_post($gd_page_id); |
|
| 153 | - $slug = $post->post_name; |
|
| 154 | - //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
|
| 155 | - $login_url = trailingslashit($home_url)."$slug/"; |
|
| 156 | - }else{ |
|
| 157 | - $login_url = trailingslashit($home_url)."?geodir_signup=true"; |
|
| 158 | - } |
|
| 159 | - |
|
| 160 | - if($args){ |
|
| 161 | - $login_url = add_query_arg($args,$login_url ); |
|
| 162 | - } |
|
| 163 | - |
|
| 164 | - /** |
|
| 165 | - * Filter the GeoDirectory login page url. |
|
| 166 | - * |
|
| 167 | - * This filter can be used to change the GeoDirectory page url. |
|
| 168 | - * |
|
| 169 | - * @since 1.5.3 |
|
| 170 | - * @package GeoDirectory |
|
| 171 | - * @param string $login_url The url of the login page. |
|
| 172 | - * @param array $args The array of query args used. |
|
| 173 | - * @param int $gd_page_id The page id of the GD login page. |
|
| 174 | - */ |
|
| 175 | - return apply_filters('geodir_login_url',$login_url,$args,$gd_page_id); |
|
| 137 | + $gd_page_id = get_option('geodir_login_page'); |
|
| 138 | + |
|
| 139 | + if (function_exists('icl_object_id')) { |
|
| 140 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 141 | + } |
|
| 142 | + |
|
| 143 | + if (function_exists('geodir_location_geo_home_link')) { |
|
| 144 | + remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
| 145 | + } |
|
| 146 | + $home_url = get_home_url(); |
|
| 147 | + if (function_exists('geodir_location_geo_home_link')) { |
|
| 148 | + add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
| 149 | + } |
|
| 150 | + |
|
| 151 | + if($gd_page_id){ |
|
| 152 | + $post = get_post($gd_page_id); |
|
| 153 | + $slug = $post->post_name; |
|
| 154 | + //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
|
| 155 | + $login_url = trailingslashit($home_url)."$slug/"; |
|
| 156 | + }else{ |
|
| 157 | + $login_url = trailingslashit($home_url)."?geodir_signup=true"; |
|
| 158 | + } |
|
| 159 | + |
|
| 160 | + if($args){ |
|
| 161 | + $login_url = add_query_arg($args,$login_url ); |
|
| 162 | + } |
|
| 163 | + |
|
| 164 | + /** |
|
| 165 | + * Filter the GeoDirectory login page url. |
|
| 166 | + * |
|
| 167 | + * This filter can be used to change the GeoDirectory page url. |
|
| 168 | + * |
|
| 169 | + * @since 1.5.3 |
|
| 170 | + * @package GeoDirectory |
|
| 171 | + * @param string $login_url The url of the login page. |
|
| 172 | + * @param array $args The array of query args used. |
|
| 173 | + * @param int $gd_page_id The page id of the GD login page. |
|
| 174 | + */ |
|
| 175 | + return apply_filters('geodir_login_url',$login_url,$args,$gd_page_id); |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | /** |
@@ -183,34 +183,34 @@ discard block |
||
| 183 | 183 | * @return string Info page url. |
| 184 | 184 | */ |
| 185 | 185 | function geodir_info_url($args=array()){ |
| 186 | - $gd_page_id = get_option('geodir_info_page'); |
|
| 187 | - |
|
| 188 | - if (function_exists('icl_object_id')) { |
|
| 189 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 190 | - } |
|
| 191 | - |
|
| 192 | - if (function_exists('geodir_location_geo_home_link')) { |
|
| 193 | - remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
| 194 | - } |
|
| 195 | - $home_url = get_home_url(); |
|
| 196 | - if (function_exists('geodir_location_geo_home_link')) { |
|
| 197 | - add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
| 198 | - } |
|
| 199 | - |
|
| 200 | - if($gd_page_id){ |
|
| 201 | - $post = get_post($gd_page_id); |
|
| 202 | - $slug = $post->post_name; |
|
| 203 | - //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
|
| 204 | - $info_url = trailingslashit($home_url)."$slug/"; |
|
| 205 | - }else{ |
|
| 206 | - $info_url = trailingslashit($home_url); |
|
| 207 | - } |
|
| 208 | - |
|
| 209 | - if($args){ |
|
| 210 | - $info_url = add_query_arg($args,$info_url ); |
|
| 211 | - } |
|
| 212 | - |
|
| 213 | - return $info_url; |
|
| 186 | + $gd_page_id = get_option('geodir_info_page'); |
|
| 187 | + |
|
| 188 | + if (function_exists('icl_object_id')) { |
|
| 189 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 190 | + } |
|
| 191 | + |
|
| 192 | + if (function_exists('geodir_location_geo_home_link')) { |
|
| 193 | + remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
| 194 | + } |
|
| 195 | + $home_url = get_home_url(); |
|
| 196 | + if (function_exists('geodir_location_geo_home_link')) { |
|
| 197 | + add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
| 198 | + } |
|
| 199 | + |
|
| 200 | + if($gd_page_id){ |
|
| 201 | + $post = get_post($gd_page_id); |
|
| 202 | + $slug = $post->post_name; |
|
| 203 | + //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
|
| 204 | + $info_url = trailingslashit($home_url)."$slug/"; |
|
| 205 | + }else{ |
|
| 206 | + $info_url = trailingslashit($home_url); |
|
| 207 | + } |
|
| 208 | + |
|
| 209 | + if($args){ |
|
| 210 | + $info_url = add_query_arg($args,$info_url ); |
|
| 211 | + } |
|
| 212 | + |
|
| 213 | + return $info_url; |
|
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | /** |
@@ -226,11 +226,11 @@ discard block |
||
| 226 | 226 | * @return string Returns converted string. |
| 227 | 227 | */ |
| 228 | 228 | function geodir_ucwords($string, $charset='UTF-8') { |
| 229 | - if (function_exists('mb_convert_case')) { |
|
| 230 | - return mb_convert_case($string, MB_CASE_TITLE, $charset); |
|
| 231 | - } else { |
|
| 232 | - return ucwords($string); |
|
| 233 | - } |
|
| 229 | + if (function_exists('mb_convert_case')) { |
|
| 230 | + return mb_convert_case($string, MB_CASE_TITLE, $charset); |
|
| 231 | + } else { |
|
| 232 | + return ucwords($string); |
|
| 233 | + } |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | /** |
@@ -246,11 +246,11 @@ discard block |
||
| 246 | 246 | * @return string Returns converted string. |
| 247 | 247 | */ |
| 248 | 248 | function geodir_strtolower($string, $charset='UTF-8') { |
| 249 | - if (function_exists('mb_convert_case')) { |
|
| 250 | - return mb_convert_case($string, MB_CASE_LOWER, $charset); |
|
| 251 | - } else { |
|
| 252 | - return strtolower($string); |
|
| 253 | - } |
|
| 249 | + if (function_exists('mb_convert_case')) { |
|
| 250 | + return mb_convert_case($string, MB_CASE_LOWER, $charset); |
|
| 251 | + } else { |
|
| 252 | + return strtolower($string); |
|
| 253 | + } |
|
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | /** |
@@ -266,11 +266,11 @@ discard block |
||
| 266 | 266 | * @return string Returns converted string. |
| 267 | 267 | */ |
| 268 | 268 | function geodir_strtoupper($string, $charset='UTF-8') { |
| 269 | - if (function_exists('mb_convert_case')) { |
|
| 270 | - return mb_convert_case($string, MB_CASE_UPPER, $charset); |
|
| 271 | - } else { |
|
| 272 | - return strtoupper($string); |
|
| 273 | - } |
|
| 269 | + if (function_exists('mb_convert_case')) { |
|
| 270 | + return mb_convert_case($string, MB_CASE_UPPER, $charset); |
|
| 271 | + } else { |
|
| 272 | + return strtoupper($string); |
|
| 273 | + } |
|
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | /** |
@@ -449,11 +449,11 @@ discard block |
||
| 449 | 449 | * @package GeoDirectory |
| 450 | 450 | */ |
| 451 | 451 | function _gd_die_handler() { |
| 452 | - if ( defined( 'GD_TESTING_MODE' ) ) { |
|
| 453 | - return '_gd_die_handler'; |
|
| 454 | - } else { |
|
| 455 | - die(); |
|
| 456 | - } |
|
| 452 | + if ( defined( 'GD_TESTING_MODE' ) ) { |
|
| 453 | + return '_gd_die_handler'; |
|
| 454 | + } else { |
|
| 455 | + die(); |
|
| 456 | + } |
|
| 457 | 457 | } |
| 458 | 458 | |
| 459 | 459 | /** |
@@ -468,7 +468,7 @@ discard block |
||
| 468 | 468 | * @param int $status Optional. Status code. |
| 469 | 469 | */ |
| 470 | 470 | function gd_die( $message = '', $title = '', $status = 400 ) { |
| 471 | - add_filter( 'wp_die_ajax_handler', '_gd_die_handler', 10, 3 ); |
|
| 472 | - add_filter( 'wp_die_handler', '_gd_die_handler', 10, 3 ); |
|
| 473 | - wp_die( $message, $title, array( 'response' => $status )); |
|
| 471 | + add_filter( 'wp_die_ajax_handler', '_gd_die_handler', 10, 3 ); |
|
| 472 | + add_filter( 'wp_die_handler', '_gd_die_handler', 10, 3 ); |
|
| 473 | + wp_die( $message, $title, array( 'response' => $status )); |
|
| 474 | 474 | } |
| 475 | 475 | \ No newline at end of file |
@@ -13,11 +13,11 @@ discard block |
||
| 13 | 13 | * @since 1.4.6 |
| 14 | 14 | * @return int|null Return the page ID if present or null if not. |
| 15 | 15 | */ |
| 16 | -function geodir_add_listing_page_id(){ |
|
| 16 | +function geodir_add_listing_page_id() { |
|
| 17 | 17 | $gd_page_id = get_option('geodir_add_listing_page'); |
| 18 | 18 | |
| 19 | 19 | if (function_exists('icl_object_id')) { |
| 20 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 20 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | return $gd_page_id; |
@@ -30,11 +30,11 @@ discard block |
||
| 30 | 30 | * @since 1.4.6 |
| 31 | 31 | * @return int|null Return the page ID if present or null if not. |
| 32 | 32 | */ |
| 33 | -function geodir_preview_page_id(){ |
|
| 33 | +function geodir_preview_page_id() { |
|
| 34 | 34 | $gd_page_id = get_option('geodir_preview_page'); |
| 35 | 35 | |
| 36 | 36 | if (function_exists('icl_object_id')) { |
| 37 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 37 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | return $gd_page_id; |
@@ -47,11 +47,11 @@ discard block |
||
| 47 | 47 | * @since 1.4.6 |
| 48 | 48 | * @return int|null Return the page ID if present or null if not. |
| 49 | 49 | */ |
| 50 | -function geodir_success_page_id(){ |
|
| 50 | +function geodir_success_page_id() { |
|
| 51 | 51 | $gd_page_id = get_option('geodir_success_page'); |
| 52 | 52 | |
| 53 | 53 | if (function_exists('icl_object_id')) { |
| 54 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 54 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | return $gd_page_id; |
@@ -64,11 +64,11 @@ discard block |
||
| 64 | 64 | * @since 1.4.6 |
| 65 | 65 | * @return int|null Return the page ID if present or null if not. |
| 66 | 66 | */ |
| 67 | -function geodir_location_page_id(){ |
|
| 67 | +function geodir_location_page_id() { |
|
| 68 | 68 | $gd_page_id = get_option('geodir_location_page'); |
| 69 | 69 | |
| 70 | 70 | if (function_exists('icl_object_id')) { |
| 71 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 71 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | return $gd_page_id; |
@@ -81,11 +81,11 @@ discard block |
||
| 81 | 81 | * @since 1.5.4 |
| 82 | 82 | * @return int|null Return the page ID if present or null if not. |
| 83 | 83 | */ |
| 84 | -function geodir_home_page_id(){ |
|
| 84 | +function geodir_home_page_id() { |
|
| 85 | 85 | $gd_page_id = get_option('geodir_home_page'); |
| 86 | 86 | |
| 87 | 87 | if (function_exists('icl_object_id')) { |
| 88 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 88 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | return $gd_page_id; |
@@ -98,11 +98,11 @@ discard block |
||
| 98 | 98 | * @since 1.5.3 |
| 99 | 99 | * @return int|null Return the page ID if present or null if not. |
| 100 | 100 | */ |
| 101 | -function geodir_info_page_id(){ |
|
| 101 | +function geodir_info_page_id() { |
|
| 102 | 102 | $gd_page_id = get_option('geodir_info_page'); |
| 103 | 103 | |
| 104 | 104 | if (function_exists('icl_object_id')) { |
| 105 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 105 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | return $gd_page_id; |
@@ -115,11 +115,11 @@ discard block |
||
| 115 | 115 | * @since 1.5.3 |
| 116 | 116 | * @return int|null Return the page ID if present or null if not. |
| 117 | 117 | */ |
| 118 | -function geodir_login_page_id(){ |
|
| 118 | +function geodir_login_page_id() { |
|
| 119 | 119 | $gd_page_id = get_option('geodir_login_page'); |
| 120 | 120 | |
| 121 | 121 | if (function_exists('icl_object_id')) { |
| 122 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 122 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | return $gd_page_id; |
@@ -133,11 +133,11 @@ discard block |
||
| 133 | 133 | * @since 1.5.3 |
| 134 | 134 | * @return int|null Return the page ID if present or null if not. |
| 135 | 135 | */ |
| 136 | -function geodir_login_url($args=array()){ |
|
| 136 | +function geodir_login_url($args = array()) { |
|
| 137 | 137 | $gd_page_id = get_option('geodir_login_page'); |
| 138 | 138 | |
| 139 | 139 | if (function_exists('icl_object_id')) { |
| 140 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 140 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | if (function_exists('geodir_location_geo_home_link')) { |
@@ -148,17 +148,17 @@ discard block |
||
| 148 | 148 | add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | - if($gd_page_id){ |
|
| 151 | + if ($gd_page_id) { |
|
| 152 | 152 | $post = get_post($gd_page_id); |
| 153 | 153 | $slug = $post->post_name; |
| 154 | 154 | //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
| 155 | 155 | $login_url = trailingslashit($home_url)."$slug/"; |
| 156 | - }else{ |
|
| 156 | + } else { |
|
| 157 | 157 | $login_url = trailingslashit($home_url)."?geodir_signup=true"; |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | - if($args){ |
|
| 161 | - $login_url = add_query_arg($args,$login_url ); |
|
| 160 | + if ($args) { |
|
| 161 | + $login_url = add_query_arg($args, $login_url); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | /** |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | * @param array $args The array of query args used. |
| 173 | 173 | * @param int $gd_page_id The page id of the GD login page. |
| 174 | 174 | */ |
| 175 | - return apply_filters('geodir_login_url',$login_url,$args,$gd_page_id); |
|
| 175 | + return apply_filters('geodir_login_url', $login_url, $args, $gd_page_id); |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | /** |
@@ -182,11 +182,11 @@ discard block |
||
| 182 | 182 | * @since 1.5.4 |
| 183 | 183 | * @return string Info page url. |
| 184 | 184 | */ |
| 185 | -function geodir_info_url($args=array()){ |
|
| 185 | +function geodir_info_url($args = array()) { |
|
| 186 | 186 | $gd_page_id = get_option('geodir_info_page'); |
| 187 | 187 | |
| 188 | 188 | if (function_exists('icl_object_id')) { |
| 189 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 189 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | if (function_exists('geodir_location_geo_home_link')) { |
@@ -197,17 +197,17 @@ discard block |
||
| 197 | 197 | add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | - if($gd_page_id){ |
|
| 200 | + if ($gd_page_id) { |
|
| 201 | 201 | $post = get_post($gd_page_id); |
| 202 | 202 | $slug = $post->post_name; |
| 203 | 203 | //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
| 204 | 204 | $info_url = trailingslashit($home_url)."$slug/"; |
| 205 | - }else{ |
|
| 205 | + } else { |
|
| 206 | 206 | $info_url = trailingslashit($home_url); |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | - if($args){ |
|
| 210 | - $info_url = add_query_arg($args,$info_url ); |
|
| 209 | + if ($args) { |
|
| 210 | + $info_url = add_query_arg($args, $info_url); |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | return $info_url; |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | * @param string $charset Character set to use for conversion. |
| 226 | 226 | * @return string Returns converted string. |
| 227 | 227 | */ |
| 228 | -function geodir_ucwords($string, $charset='UTF-8') { |
|
| 228 | +function geodir_ucwords($string, $charset = 'UTF-8') { |
|
| 229 | 229 | if (function_exists('mb_convert_case')) { |
| 230 | 230 | return mb_convert_case($string, MB_CASE_TITLE, $charset); |
| 231 | 231 | } else { |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | * @param string $charset Character set to use for conversion. |
| 246 | 246 | * @return string Returns converted string. |
| 247 | 247 | */ |
| 248 | -function geodir_strtolower($string, $charset='UTF-8') { |
|
| 248 | +function geodir_strtolower($string, $charset = 'UTF-8') { |
|
| 249 | 249 | if (function_exists('mb_convert_case')) { |
| 250 | 250 | return mb_convert_case($string, MB_CASE_LOWER, $charset); |
| 251 | 251 | } else { |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | * @param string $charset Character set to use for conversion. |
| 266 | 266 | * @return string Returns converted string. |
| 267 | 267 | */ |
| 268 | -function geodir_strtoupper($string, $charset='UTF-8') { |
|
| 268 | +function geodir_strtoupper($string, $charset = 'UTF-8') { |
|
| 269 | 269 | if (function_exists('mb_convert_case')) { |
| 270 | 270 | return mb_convert_case($string, MB_CASE_UPPER, $charset); |
| 271 | 271 | } else { |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | |
| 297 | 297 | $url = trim($parts[0]); |
| 298 | 298 | if ($formatted && $url != '') { |
| 299 | - $url = str_replace( ' ', '%20', $url ); |
|
| 299 | + $url = str_replace(' ', '%20', $url); |
|
| 300 | 300 | $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\[\]\\x80-\\xff]|i', '', $url); |
| 301 | 301 | |
| 302 | 302 | if (0 !== stripos($url, 'mailto:')) { |
@@ -306,8 +306,8 @@ discard block |
||
| 306 | 306 | |
| 307 | 307 | $url = str_replace(';//', '://', $url); |
| 308 | 308 | |
| 309 | - if (strpos($url, ':') === false && ! in_array($url[0], array('/', '#', '?')) && !preg_match('/^[a-z0-9-]+?\.php/i', $url)) { |
|
| 310 | - $url = 'http://' . $url; |
|
| 309 | + if (strpos($url, ':') === false && !in_array($url[0], array('/', '#', '?')) && !preg_match('/^[a-z0-9-]+?\.php/i', $url)) { |
|
| 310 | + $url = 'http://'.$url; |
|
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | $url = wp_kses_normalize_entities($url); |
@@ -449,7 +449,7 @@ discard block |
||
| 449 | 449 | * @package GeoDirectory |
| 450 | 450 | */ |
| 451 | 451 | function _gd_die_handler() { |
| 452 | - if ( defined( 'GD_TESTING_MODE' ) ) { |
|
| 452 | + if (defined('GD_TESTING_MODE')) { |
|
| 453 | 453 | return '_gd_die_handler'; |
| 454 | 454 | } else { |
| 455 | 455 | die(); |
@@ -467,8 +467,8 @@ discard block |
||
| 467 | 467 | * @param string $title Optional. Error title. |
| 468 | 468 | * @param int $status Optional. Status code. |
| 469 | 469 | */ |
| 470 | -function gd_die( $message = '', $title = '', $status = 400 ) { |
|
| 471 | - add_filter( 'wp_die_ajax_handler', '_gd_die_handler', 10, 3 ); |
|
| 472 | - add_filter( 'wp_die_handler', '_gd_die_handler', 10, 3 ); |
|
| 473 | - wp_die( $message, $title, array( 'response' => $status )); |
|
| 470 | +function gd_die($message = '', $title = '', $status = 400) { |
|
| 471 | + add_filter('wp_die_ajax_handler', '_gd_die_handler', 10, 3); |
|
| 472 | + add_filter('wp_die_handler', '_gd_die_handler', 10, 3); |
|
| 473 | + wp_die($message, $title, array('response' => $status)); |
|
| 474 | 474 | } |
| 475 | 475 | \ No newline at end of file |
@@ -107,11 +107,13 @@ discard block |
||
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - if (!empty($field_default_cat)) |
|
| 111 | - $field_default_cat = ''; |
|
| 110 | + if (!empty($field_default_cat)) { |
|
| 111 | + $field_default_cat = ''; |
|
| 112 | + } |
|
| 112 | 113 | |
| 113 | - if (!empty($cat_find_array)) |
|
| 114 | - $search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
|
|
| 114 | + if (!empty($cat_find_array)) { |
|
| 115 | + $search .= "AND (" . implode(' OR ', $cat_find_array) . ")"; |
|
| 116 | + } |
|
| 115 | 117 | |
| 116 | 118 | $main_query_array = $map_cat_ids_array; |
| 117 | 119 | |
@@ -143,8 +145,9 @@ discard block |
||
| 143 | 145 | $gd_posttype = " AND p.post_type = %s"; |
| 144 | 146 | $main_query_array[] = $_REQUEST['gd_posttype']; |
| 145 | 147 | |
| 146 | - } else |
|
| 147 | - $table = $plugin_prefix . 'gd_place_detail'; |
|
| 148 | + } else { |
|
| 149 | + $table = $plugin_prefix . 'gd_place_detail'; |
|
| 150 | + } |
|
| 148 | 151 | |
| 149 | 152 | $join = ", " . $table . " AS pd "; |
| 150 | 153 | |
@@ -309,8 +312,7 @@ discard block |
||
| 309 | 312 | |
| 310 | 313 | if (!empty($cat_content_info)) {
|
| 311 | 314 | return '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
|
| 312 | - } |
|
| 313 | - else {
|
|
| 315 | + } else {
|
|
| 314 | 316 | return '[{"totalcount":"0"}]';
|
| 315 | 317 | } |
| 316 | 318 | } |
| 317 | 319 | \ No newline at end of file |
@@ -7,59 +7,59 @@ discard block |
||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'homemap_catlist') {
|
| 10 | - $gd_post_type = sanitize_text_field($_REQUEST['post_type']); |
|
| 11 | - $post_taxonomy = geodir_get_taxonomies($gd_post_type); |
|
| 12 | - $map_canvas_name = sanitize_text_field($_REQUEST['map_canvas']); |
|
| 13 | - $child_collapse = (bool)$_REQUEST['child_collapse']; |
|
| 14 | - echo home_map_taxonomy_walker($post_taxonomy, 0, true, 0, $map_canvas_name, $child_collapse, true); |
|
| 15 | - die; |
|
| 10 | + $gd_post_type = sanitize_text_field($_REQUEST['post_type']); |
|
| 11 | + $post_taxonomy = geodir_get_taxonomies($gd_post_type); |
|
| 12 | + $map_canvas_name = sanitize_text_field($_REQUEST['map_canvas']); |
|
| 13 | + $child_collapse = (bool)$_REQUEST['child_collapse']; |
|
| 14 | + echo home_map_taxonomy_walker($post_taxonomy, 0, true, 0, $map_canvas_name, $child_collapse, true); |
|
| 15 | + die; |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | // Send the content-type header with correct encoding |
| 19 | 19 | header("Content-type: text/javascript; charset=utf-8");
|
| 20 | 20 | |
| 21 | 21 | if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'cat') { // Retrives markers data for categories
|
| 22 | - echo get_markers(); |
|
| 23 | - exit; |
|
| 22 | + echo get_markers(); |
|
| 23 | + exit; |
|
| 24 | 24 | } else if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'info') { // Retrives marker info window html
|
| 25 | - /** |
|
| 26 | - * @global object $wpdb WordPress Database object. |
|
| 27 | - * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 28 | - * @global object $gd_session GeoDirectory Session object. |
|
| 29 | - */ |
|
| 30 | - global $wpdb, $plugin_prefix, $gd_session; |
|
| 31 | - |
|
| 32 | - if ($_REQUEST['m_id'] != '') {
|
|
| 33 | - $pid = (int)$_REQUEST['m_id']; |
|
| 34 | - } else {
|
|
| 35 | - echo __('No marker data found', 'geodirectory');
|
|
| 36 | - exit; |
|
| 37 | - } |
|
| 38 | - |
|
| 39 | - if (isset($_REQUEST['post_preview']) && $_REQUEST['post_preview'] != '' && $gd_ses_listing = $gd_session->get('listing')) {
|
|
| 40 | - $post = (object)$gd_ses_listing; |
|
| 41 | - echo geodir_get_infowindow_html($post, $_REQUEST['post_preview']); |
|
| 42 | - } else {
|
|
| 43 | - $geodir_post_type = get_post_type($pid); |
|
| 44 | - |
|
| 45 | - $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
| 46 | - |
|
| 47 | - $sql = $wpdb->prepare("SELECT * FROM " . $table . " WHERE post_id = %d", array($pid));
|
|
| 48 | - |
|
| 49 | - $postinfo = $wpdb->get_results($sql); |
|
| 50 | - |
|
| 51 | - $data_arr = array(); |
|
| 52 | - |
|
| 53 | - if ($postinfo) {
|
|
| 54 | - $srcharr = array("'", "/", "-", '"', '\\');
|
|
| 55 | - $replarr = array("′", "⁄", "–", "“", '');
|
|
| 56 | - |
|
| 57 | - foreach ($postinfo as $postinfo_obj) {
|
|
| 58 | - echo geodir_get_infowindow_html($postinfo_obj); |
|
| 59 | - } |
|
| 60 | - } |
|
| 61 | - } |
|
| 62 | - exit; |
|
| 25 | + /** |
|
| 26 | + * @global object $wpdb WordPress Database object. |
|
| 27 | + * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 28 | + * @global object $gd_session GeoDirectory Session object. |
|
| 29 | + */ |
|
| 30 | + global $wpdb, $plugin_prefix, $gd_session; |
|
| 31 | + |
|
| 32 | + if ($_REQUEST['m_id'] != '') {
|
|
| 33 | + $pid = (int)$_REQUEST['m_id']; |
|
| 34 | + } else {
|
|
| 35 | + echo __('No marker data found', 'geodirectory');
|
|
| 36 | + exit; |
|
| 37 | + } |
|
| 38 | + |
|
| 39 | + if (isset($_REQUEST['post_preview']) && $_REQUEST['post_preview'] != '' && $gd_ses_listing = $gd_session->get('listing')) {
|
|
| 40 | + $post = (object)$gd_ses_listing; |
|
| 41 | + echo geodir_get_infowindow_html($post, $_REQUEST['post_preview']); |
|
| 42 | + } else {
|
|
| 43 | + $geodir_post_type = get_post_type($pid); |
|
| 44 | + |
|
| 45 | + $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
| 46 | + |
|
| 47 | + $sql = $wpdb->prepare("SELECT * FROM " . $table . " WHERE post_id = %d", array($pid));
|
|
| 48 | + |
|
| 49 | + $postinfo = $wpdb->get_results($sql); |
|
| 50 | + |
|
| 51 | + $data_arr = array(); |
|
| 52 | + |
|
| 53 | + if ($postinfo) {
|
|
| 54 | + $srcharr = array("'", "/", "-", '"', '\\');
|
|
| 55 | + $replarr = array("′", "⁄", "–", "“", '');
|
|
| 56 | + |
|
| 57 | + foreach ($postinfo as $postinfo_obj) {
|
|
| 58 | + echo geodir_get_infowindow_html($postinfo_obj); |
|
| 59 | + } |
|
| 60 | + } |
|
| 61 | + } |
|
| 62 | + exit; |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | /** |
@@ -77,80 +77,80 @@ discard block |
||
| 77 | 77 | * @return string |
| 78 | 78 | */ |
| 79 | 79 | function get_markers() {
|
| 80 | - global $wpdb, $plugin_prefix, $geodir_cat_icons, $gd_marker_sizes; |
|
| 80 | + global $wpdb, $plugin_prefix, $geodir_cat_icons, $gd_marker_sizes; |
|
| 81 | 81 | |
| 82 | - $search = ''; |
|
| 83 | - $main_query_array; |
|
| 82 | + $search = ''; |
|
| 83 | + $main_query_array; |
|
| 84 | 84 | |
| 85 | - $srcharr = array("'", "/", "-", '"', '\\');
|
|
| 86 | - $replarr = array("′", "⁄", "–", "“", '');
|
|
| 85 | + $srcharr = array("'", "/", "-", '"', '\\');
|
|
| 86 | + $replarr = array("′", "⁄", "–", "“", '');
|
|
| 87 | 87 | |
| 88 | - $post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place'; |
|
| 88 | + $post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place'; |
|
| 89 | 89 | |
| 90 | - $map_cat_ids_array = array('0');
|
|
| 91 | - $cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)");
|
|
| 90 | + $map_cat_ids_array = array('0');
|
|
| 91 | + $cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)");
|
|
| 92 | 92 | |
| 93 | 93 | |
| 94 | - $field_default_cat = ''; |
|
| 95 | - if (isset($_REQUEST['cat_id']) && $_REQUEST['cat_id'] != '') {
|
|
| 96 | - $map_cat_arr = trim($_REQUEST['cat_id'], ','); |
|
| 94 | + $field_default_cat = ''; |
|
| 95 | + if (isset($_REQUEST['cat_id']) && $_REQUEST['cat_id'] != '') {
|
|
| 96 | + $map_cat_arr = trim($_REQUEST['cat_id'], ','); |
|
| 97 | 97 | |
| 98 | - if (!empty($map_cat_arr)) {
|
|
| 99 | - $field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category ";
|
|
| 98 | + if (!empty($map_cat_arr)) {
|
|
| 99 | + $field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category ";
|
|
| 100 | 100 | |
| 101 | - $map_cat_ids_array = explode(',', $map_cat_arr);
|
|
| 102 | - $cat_find_array = array(); |
|
| 103 | - foreach ($map_cat_ids_array as $cat_id) {
|
|
| 104 | - $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id "; |
|
| 105 | - $cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)"; |
|
| 106 | - $main_query_array[] = $cat_id; |
|
| 107 | - } |
|
| 101 | + $map_cat_ids_array = explode(',', $map_cat_arr);
|
|
| 102 | + $cat_find_array = array(); |
|
| 103 | + foreach ($map_cat_ids_array as $cat_id) {
|
|
| 104 | + $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id "; |
|
| 105 | + $cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)"; |
|
| 106 | + $main_query_array[] = $cat_id; |
|
| 107 | + } |
|
| 108 | 108 | |
| 109 | - } |
|
| 110 | - } |
|
| 109 | + } |
|
| 110 | + } |
|
| 111 | 111 | |
| 112 | - if (!empty($field_default_cat)) |
|
| 113 | - $field_default_cat = ''; |
|
| 112 | + if (!empty($field_default_cat)) |
|
| 113 | + $field_default_cat = ''; |
|
| 114 | 114 | |
| 115 | - if (!empty($cat_find_array)) |
|
| 116 | - $search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
|
|
| 115 | + if (!empty($cat_find_array)) |
|
| 116 | + $search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
|
|
| 117 | 117 | |
| 118 | - $main_query_array = $map_cat_ids_array; |
|
| 118 | + $main_query_array = $map_cat_ids_array; |
|
| 119 | 119 | |
| 120 | - if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) {
|
|
| 121 | - $search .= " AND p.post_title LIKE %s"; |
|
| 122 | - $main_query_array[] = "%" . $_REQUEST['search'] . "%"; |
|
| 123 | - } |
|
| 124 | - |
|
| 125 | - /** |
|
| 126 | - * Filter the marker query search SQL, values are replaces with %s or %d. |
|
| 127 | - * |
|
| 128 | - * @since 1.5.3 |
|
| 129 | - * |
|
| 130 | - * @param string $search The SQL query for search/where. |
|
| 131 | - */ |
|
| 132 | - $search = apply_filters('geodir_marker_search', $search);
|
|
| 133 | - /** |
|
| 134 | - * Filter the marker query search SQL values %s and %d, this is an array of values. |
|
| 135 | - * |
|
| 136 | - * @since 1.5.3 |
|
| 137 | - * |
|
| 138 | - * @param array $main_query_array The SQL query values for search/where. |
|
| 139 | - */ |
|
| 140 | - $main_query_array = apply_filters('geodir_marker_main_query_array', $main_query_array);
|
|
| 141 | - |
|
| 142 | - $gd_posttype = ''; |
|
| 143 | - if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') {
|
|
| 144 | - $table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail'; |
|
| 145 | - $gd_posttype = " AND p.post_type = %s"; |
|
| 146 | - $main_query_array[] = $_REQUEST['gd_posttype']; |
|
| 147 | - |
|
| 148 | - } else |
|
| 149 | - $table = $plugin_prefix . 'gd_place_detail'; |
|
| 150 | - |
|
| 151 | - $join = ", " . $table . " AS pd "; |
|
| 152 | - |
|
| 153 | - /** |
|
| 120 | + if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) {
|
|
| 121 | + $search .= " AND p.post_title LIKE %s"; |
|
| 122 | + $main_query_array[] = "%" . $_REQUEST['search'] . "%"; |
|
| 123 | + } |
|
| 124 | + |
|
| 125 | + /** |
|
| 126 | + * Filter the marker query search SQL, values are replaces with %s or %d. |
|
| 127 | + * |
|
| 128 | + * @since 1.5.3 |
|
| 129 | + * |
|
| 130 | + * @param string $search The SQL query for search/where. |
|
| 131 | + */ |
|
| 132 | + $search = apply_filters('geodir_marker_search', $search);
|
|
| 133 | + /** |
|
| 134 | + * Filter the marker query search SQL values %s and %d, this is an array of values. |
|
| 135 | + * |
|
| 136 | + * @since 1.5.3 |
|
| 137 | + * |
|
| 138 | + * @param array $main_query_array The SQL query values for search/where. |
|
| 139 | + */ |
|
| 140 | + $main_query_array = apply_filters('geodir_marker_main_query_array', $main_query_array);
|
|
| 141 | + |
|
| 142 | + $gd_posttype = ''; |
|
| 143 | + if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') {
|
|
| 144 | + $table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail'; |
|
| 145 | + $gd_posttype = " AND p.post_type = %s"; |
|
| 146 | + $main_query_array[] = $_REQUEST['gd_posttype']; |
|
| 147 | + |
|
| 148 | + } else |
|
| 149 | + $table = $plugin_prefix . 'gd_place_detail'; |
|
| 150 | + |
|
| 151 | + $join = ", " . $table . " AS pd "; |
|
| 152 | + |
|
| 153 | + /** |
|
| 154 | 154 | * Filter the SQL JOIN clause for the markers data |
| 155 | 155 | * |
| 156 | 156 | * @since 1.0.0 |
@@ -167,16 +167,16 @@ discard block |
||
| 167 | 167 | * @param string $search Row of searched fields to use in WHERE clause. |
| 168 | 168 | */ |
| 169 | 169 | $search = apply_filters('geodir_home_map_listing_where', $search);
|
| 170 | - $search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search);
|
|
| 171 | - $cat_type = $post_type . 'category'; |
|
| 172 | - if ($post_type == 'gd_event') {
|
|
| 173 | - $event_select = ", pd.recurring_dates, pd.is_recurring"; |
|
| 174 | - } else {
|
|
| 175 | - $event_select = ""; |
|
| 176 | - } |
|
| 177 | - |
|
| 178 | - $sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select; |
|
| 179 | - /** |
|
| 170 | + $search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search);
|
|
| 171 | + $cat_type = $post_type . 'category'; |
|
| 172 | + if ($post_type == 'gd_event') {
|
|
| 173 | + $event_select = ", pd.recurring_dates, pd.is_recurring"; |
|
| 174 | + } else {
|
|
| 175 | + $event_select = ""; |
|
| 176 | + } |
|
| 177 | + |
|
| 178 | + $sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select; |
|
| 179 | + /** |
|
| 180 | 180 | * Filter the SQL SELECT clause to retrive fields data |
| 181 | 181 | * |
| 182 | 182 | * @since 1.0.0 |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | */ |
| 196 | 196 | $groupby = apply_filters('geodir_home_map_listing_groupby', $groupby);
|
| 197 | 197 | |
| 198 | - $catsql = $wpdb->prepare("$select $field_default_cat FROM " . $wpdb->posts . " as p" . $join . " WHERE p.ID = pd.post_id AND p.post_status = 'publish' " . $search . $gd_posttype . $groupby , $main_query_array);
|
|
| 198 | + $catsql = $wpdb->prepare("$select $field_default_cat FROM " . $wpdb->posts . " as p" . $join . " WHERE p.ID = pd.post_id AND p.post_status = 'publish' " . $search . $gd_posttype . $groupby , $main_query_array);
|
|
| 199 | 199 | |
| 200 | 200 | /** |
| 201 | 201 | * Filter the SQL query to retrive markers data |
@@ -207,125 +207,125 @@ discard block |
||
| 207 | 207 | */ |
| 208 | 208 | $catsql = apply_filters('geodir_home_map_listing_query', $catsql, $search);
|
| 209 | 209 | |
| 210 | - $catinfo = $wpdb->get_results($catsql); |
|
| 210 | + $catinfo = $wpdb->get_results($catsql); |
|
| 211 | 211 | |
| 212 | - $cat_content_info = array(); |
|
| 213 | - $content_data = array(); |
|
| 214 | - $post_ids = array(); |
|
| 215 | - |
|
| 216 | - /** |
|
| 217 | - * Called before marker data is processed into JSON. |
|
| 218 | - * |
|
| 219 | - * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
| 220 | - * |
|
| 221 | - * @since 1.5.3 |
|
| 222 | - * @param object $catinfo The posts object containing all marker data. |
|
| 223 | - * @see 'geodir_after_marker_post_process' |
|
| 224 | - */ |
|
| 225 | - $catinfo = apply_filters('geodir_before_marker_post_process', $catinfo);
|
|
| 226 | - |
|
| 227 | - /** |
|
| 228 | - * Called before marker data is processed into JSON. |
|
| 229 | - * |
|
| 230 | - * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
| 231 | - * |
|
| 232 | - * @since 1.4.9 |
|
| 233 | - * @param object $catinfo The posts object containing all marker data. |
|
| 234 | - * @see 'geodir_after_marker_post_process' |
|
| 235 | - */ |
|
| 236 | - do_action('geodir_before_marker_post_process_action', $catinfo);
|
|
| 237 | - |
|
| 238 | - // Sort any posts into a ajax array |
|
| 239 | - if (!empty($catinfo)) {
|
|
| 240 | - $geodir_cat_icons = geodir_get_term_icon(); |
|
| 241 | - global $geodir_date_format; |
|
| 242 | - |
|
| 243 | - $today = strtotime(date_i18n('Y-m-d'));
|
|
| 212 | + $cat_content_info = array(); |
|
| 213 | + $content_data = array(); |
|
| 214 | + $post_ids = array(); |
|
| 215 | + |
|
| 216 | + /** |
|
| 217 | + * Called before marker data is processed into JSON. |
|
| 218 | + * |
|
| 219 | + * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
| 220 | + * |
|
| 221 | + * @since 1.5.3 |
|
| 222 | + * @param object $catinfo The posts object containing all marker data. |
|
| 223 | + * @see 'geodir_after_marker_post_process' |
|
| 224 | + */ |
|
| 225 | + $catinfo = apply_filters('geodir_before_marker_post_process', $catinfo);
|
|
| 226 | + |
|
| 227 | + /** |
|
| 228 | + * Called before marker data is processed into JSON. |
|
| 229 | + * |
|
| 230 | + * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
| 231 | + * |
|
| 232 | + * @since 1.4.9 |
|
| 233 | + * @param object $catinfo The posts object containing all marker data. |
|
| 234 | + * @see 'geodir_after_marker_post_process' |
|
| 235 | + */ |
|
| 236 | + do_action('geodir_before_marker_post_process_action', $catinfo);
|
|
| 237 | + |
|
| 238 | + // Sort any posts into a ajax array |
|
| 239 | + if (!empty($catinfo)) {
|
|
| 240 | + $geodir_cat_icons = geodir_get_term_icon(); |
|
| 241 | + global $geodir_date_format; |
|
| 242 | + |
|
| 243 | + $today = strtotime(date_i18n('Y-m-d'));
|
|
| 244 | 244 | |
| 245 | - foreach ($catinfo as $catinfo_obj) {
|
|
| 246 | - $post_title = $catinfo_obj->post_title; |
|
| 245 | + foreach ($catinfo as $catinfo_obj) {
|
|
| 246 | + $post_title = $catinfo_obj->post_title; |
|
| 247 | 247 | |
| 248 | - if ($post_type == 'gd_event' && !empty($catinfo_obj->recurring_dates)) {
|
|
| 249 | - $event_dates = ''; |
|
| 250 | - $recurring_data = isset($catinfo_obj->recurring_dates) ? maybe_unserialize($catinfo_obj->recurring_dates) : array(); |
|
| 248 | + if ($post_type == 'gd_event' && !empty($catinfo_obj->recurring_dates)) {
|
|
| 249 | + $event_dates = ''; |
|
| 250 | + $recurring_data = isset($catinfo_obj->recurring_dates) ? maybe_unserialize($catinfo_obj->recurring_dates) : array(); |
|
| 251 | 251 | |
| 252 | - $post_info = geodir_get_post_info($catinfo_obj->post_id); |
|
| 253 | - if (!empty($catinfo_obj->is_recurring) && !empty($recurring_data) && !empty($recurring_data['is_recurring']) && geodir_event_recurring_pkg($post_info)) {
|
|
| 254 | - $recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
|
|
| 252 | + $post_info = geodir_get_post_info($catinfo_obj->post_id); |
|
| 253 | + if (!empty($catinfo_obj->is_recurring) && !empty($recurring_data) && !empty($recurring_data['is_recurring']) && geodir_event_recurring_pkg($post_info)) {
|
|
| 254 | + $recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
|
|
| 255 | 255 | |
| 256 | - if (!empty($recurring_dates)) {
|
|
| 257 | - $e = 0; |
|
| 258 | - foreach ($recurring_dates as $date) {
|
|
| 259 | - if (strtotime($date) >= $today) {
|
|
| 260 | - $event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($date)); |
|
| 256 | + if (!empty($recurring_dates)) {
|
|
| 257 | + $e = 0; |
|
| 258 | + foreach ($recurring_dates as $date) {
|
|
| 259 | + if (strtotime($date) >= $today) {
|
|
| 260 | + $event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($date)); |
|
| 261 | 261 | |
| 262 | - $e++; |
|
| 263 | - if ($e == 3) { // only show 3 event dates
|
|
| 264 | - break; |
|
| 265 | - } |
|
| 266 | - } |
|
| 267 | - } |
|
| 268 | - } |
|
| 269 | - } else {
|
|
| 270 | - $start_date = !empty($recurring_data['event_start']) && $recurring_data['event_start'] != '0000-00-00 00:00:00' ? $recurring_data['event_start'] : ''; |
|
| 271 | - $end_date = !empty($recurring_data['event_end']) && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? $recurring_data['event_end'] : $start_date; |
|
| 262 | + $e++; |
|
| 263 | + if ($e == 3) { // only show 3 event dates
|
|
| 264 | + break; |
|
| 265 | + } |
|
| 266 | + } |
|
| 267 | + } |
|
| 268 | + } |
|
| 269 | + } else {
|
|
| 270 | + $start_date = !empty($recurring_data['event_start']) && $recurring_data['event_start'] != '0000-00-00 00:00:00' ? $recurring_data['event_start'] : ''; |
|
| 271 | + $end_date = !empty($recurring_data['event_end']) && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? $recurring_data['event_end'] : $start_date; |
|
| 272 | 272 | |
| 273 | - if ($end_date != '' && strtotime($end_date) >= $today) {
|
|
| 274 | - $event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($start_date)) .' -> ' . date_i18n($geodir_date_format, strtotime($end_date)); |
|
| 275 | - } |
|
| 276 | - } |
|
| 277 | - |
|
| 278 | - if (empty($event_dates)) {
|
|
| 279 | - continue; |
|
| 280 | - } |
|
| 273 | + if ($end_date != '' && strtotime($end_date) >= $today) {
|
|
| 274 | + $event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($start_date)) .' -> ' . date_i18n($geodir_date_format, strtotime($end_date)); |
|
| 275 | + } |
|
| 276 | + } |
|
| 277 | + |
|
| 278 | + if (empty($event_dates)) {
|
|
| 279 | + continue; |
|
| 280 | + } |
|
| 281 | 281 | |
| 282 | - $post_title .= $event_dates; |
|
| 283 | - } |
|
| 282 | + $post_title .= $event_dates; |
|
| 283 | + } |
|
| 284 | 284 | |
| 285 | - $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$catinfo_obj->default_category]) ? $geodir_cat_icons[$catinfo_obj->default_category] : ''; |
|
| 286 | - $mark_extra = (isset($catinfo_obj->marker_extra)) ? $catinfo_obj->marker_extra : ''; |
|
| 287 | - $title = str_replace($srcharr, $replarr, $post_title); |
|
| 285 | + $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$catinfo_obj->default_category]) ? $geodir_cat_icons[$catinfo_obj->default_category] : ''; |
|
| 286 | + $mark_extra = (isset($catinfo_obj->marker_extra)) ? $catinfo_obj->marker_extra : ''; |
|
| 287 | + $title = str_replace($srcharr, $replarr, $post_title); |
|
| 288 | 288 | |
| 289 | - if ($icon != '') {
|
|
| 290 | - $gd_marker_sizes = empty($gd_marker_sizes) ? array() : $gd_marker_sizes; |
|
| 289 | + if ($icon != '') {
|
|
| 290 | + $gd_marker_sizes = empty($gd_marker_sizes) ? array() : $gd_marker_sizes; |
|
| 291 | 291 | |
| 292 | - if (isset($gd_marker_sizes[$icon])) {
|
|
| 293 | - $icon_size = $gd_marker_sizes[$icon]; |
|
| 294 | - } else {
|
|
| 295 | - $icon_size = geodir_get_marker_size($icon); |
|
| 296 | - $gd_marker_sizes[$icon] = $icon_size; |
|
| 297 | - } |
|
| 298 | - } else {
|
|
| 299 | - $icon_size = array('w' => 36, 'h' => 45);
|
|
| 300 | - } |
|
| 301 | - |
|
| 302 | - $content_data[] = '{"id":"' . $catinfo_obj->post_id . '","t": "' . $title . '","lt": "' . $catinfo_obj->post_latitude . '","ln": "' . $catinfo_obj->post_longitude . '","mk_id":"' . $catinfo_obj->post_id . '_' . $catinfo_obj->default_category . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"'.$mark_extra.'}';
|
|
| 303 | - $post_ids[] = $catinfo_obj->post_id; |
|
| 304 | - } |
|
| 305 | - } |
|
| 306 | - |
|
| 307 | - /** |
|
| 308 | - * Called after marker data is processed into JSON. |
|
| 309 | - * |
|
| 310 | - * Called after marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
| 311 | - * |
|
| 312 | - * @since 1.4.9 |
|
| 313 | - * @param array $content_data The array containing all markers in JSON format. |
|
| 314 | - * @param object $catinfo The posts object containing all marker data. |
|
| 315 | - * @see 'geodir_before_marker_post_process' |
|
| 316 | - */ |
|
| 317 | - do_action('geodir_after_marker_post_process', $content_data, $catinfo);
|
|
| 318 | - |
|
| 319 | - if (!empty($content_data)) {
|
|
| 320 | - $cat_content_info[] = implode(',', $content_data);
|
|
| 321 | - } |
|
| 322 | - |
|
| 323 | - $totalcount = count(array_unique($post_ids)); |
|
| 324 | - |
|
| 325 | - if (!empty($cat_content_info)) {
|
|
| 326 | - return '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
|
|
| 327 | - } |
|
| 328 | - else {
|
|
| 329 | - return '[{"totalcount":"0"}]';
|
|
| 330 | - } |
|
| 292 | + if (isset($gd_marker_sizes[$icon])) {
|
|
| 293 | + $icon_size = $gd_marker_sizes[$icon]; |
|
| 294 | + } else {
|
|
| 295 | + $icon_size = geodir_get_marker_size($icon); |
|
| 296 | + $gd_marker_sizes[$icon] = $icon_size; |
|
| 297 | + } |
|
| 298 | + } else {
|
|
| 299 | + $icon_size = array('w' => 36, 'h' => 45);
|
|
| 300 | + } |
|
| 301 | + |
|
| 302 | + $content_data[] = '{"id":"' . $catinfo_obj->post_id . '","t": "' . $title . '","lt": "' . $catinfo_obj->post_latitude . '","ln": "' . $catinfo_obj->post_longitude . '","mk_id":"' . $catinfo_obj->post_id . '_' . $catinfo_obj->default_category . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"'.$mark_extra.'}';
|
|
| 303 | + $post_ids[] = $catinfo_obj->post_id; |
|
| 304 | + } |
|
| 305 | + } |
|
| 306 | + |
|
| 307 | + /** |
|
| 308 | + * Called after marker data is processed into JSON. |
|
| 309 | + * |
|
| 310 | + * Called after marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
| 311 | + * |
|
| 312 | + * @since 1.4.9 |
|
| 313 | + * @param array $content_data The array containing all markers in JSON format. |
|
| 314 | + * @param object $catinfo The posts object containing all marker data. |
|
| 315 | + * @see 'geodir_before_marker_post_process' |
|
| 316 | + */ |
|
| 317 | + do_action('geodir_after_marker_post_process', $content_data, $catinfo);
|
|
| 318 | + |
|
| 319 | + if (!empty($content_data)) {
|
|
| 320 | + $cat_content_info[] = implode(',', $content_data);
|
|
| 321 | + } |
|
| 322 | + |
|
| 323 | + $totalcount = count(array_unique($post_ids)); |
|
| 324 | + |
|
| 325 | + if (!empty($cat_content_info)) {
|
|
| 326 | + return '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
|
|
| 327 | + } |
|
| 328 | + else {
|
|
| 329 | + return '[{"totalcount":"0"}]';
|
|
| 330 | + } |
|
| 331 | 331 | } |
| 332 | 332 | \ No newline at end of file |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | $gd_post_type = sanitize_text_field($_REQUEST['post_type']); |
| 11 | 11 | $post_taxonomy = geodir_get_taxonomies($gd_post_type); |
| 12 | 12 | $map_canvas_name = sanitize_text_field($_REQUEST['map_canvas']); |
| 13 | - $child_collapse = (bool)$_REQUEST['child_collapse']; |
|
| 13 | + $child_collapse = (bool) $_REQUEST['child_collapse']; |
|
| 14 | 14 | echo home_map_taxonomy_walker($post_taxonomy, 0, true, 0, $map_canvas_name, $child_collapse, true); |
| 15 | 15 | die; |
| 16 | 16 | } |
@@ -30,21 +30,21 @@ discard block |
||
| 30 | 30 | global $wpdb, $plugin_prefix, $gd_session; |
| 31 | 31 | |
| 32 | 32 | if ($_REQUEST['m_id'] != '') {
|
| 33 | - $pid = (int)$_REQUEST['m_id']; |
|
| 33 | + $pid = (int) $_REQUEST['m_id']; |
|
| 34 | 34 | } else {
|
| 35 | 35 | echo __('No marker data found', 'geodirectory');
|
| 36 | 36 | exit; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | if (isset($_REQUEST['post_preview']) && $_REQUEST['post_preview'] != '' && $gd_ses_listing = $gd_session->get('listing')) {
|
| 40 | - $post = (object)$gd_ses_listing; |
|
| 40 | + $post = (object) $gd_ses_listing; |
|
| 41 | 41 | echo geodir_get_infowindow_html($post, $_REQUEST['post_preview']); |
| 42 | 42 | } else {
|
| 43 | 43 | $geodir_post_type = get_post_type($pid); |
| 44 | 44 | |
| 45 | - $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
| 45 | + $table = $plugin_prefix.$geodir_post_type.'_detail'; |
|
| 46 | 46 | |
| 47 | - $sql = $wpdb->prepare("SELECT * FROM " . $table . " WHERE post_id = %d", array($pid));
|
|
| 47 | + $sql = $wpdb->prepare("SELECT * FROM ".$table." WHERE post_id = %d", array($pid));
|
|
| 48 | 48 | |
| 49 | 49 | $postinfo = $wpdb->get_results($sql); |
| 50 | 50 | |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | $post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place'; |
| 89 | 89 | |
| 90 | 90 | $map_cat_ids_array = array('0');
|
| 91 | - $cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)");
|
|
| 91 | + $cat_find_array = array(" FIND_IN_SET(%d, pd.".$post_type."category)");
|
|
| 92 | 92 | |
| 93 | 93 | |
| 94 | 94 | $field_default_cat = ''; |
@@ -96,13 +96,13 @@ discard block |
||
| 96 | 96 | $map_cat_arr = trim($_REQUEST['cat_id'], ','); |
| 97 | 97 | |
| 98 | 98 | if (!empty($map_cat_arr)) {
|
| 99 | - $field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category ";
|
|
| 99 | + $field_default_cat .= "WHEN (default_category IN (".$map_cat_arr.")) THEN default_category ";
|
|
| 100 | 100 | |
| 101 | 101 | $map_cat_ids_array = explode(',', $map_cat_arr);
|
| 102 | 102 | $cat_find_array = array(); |
| 103 | 103 | foreach ($map_cat_ids_array as $cat_id) {
|
| 104 | - $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id "; |
|
| 105 | - $cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)"; |
|
| 104 | + $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `".$post_type."category`) > 0) THEN $cat_id "; |
|
| 105 | + $cat_find_array[] = " FIND_IN_SET(%d, pd.".$post_type."category)"; |
|
| 106 | 106 | $main_query_array[] = $cat_id; |
| 107 | 107 | } |
| 108 | 108 | |
@@ -113,13 +113,13 @@ discard block |
||
| 113 | 113 | $field_default_cat = ''; |
| 114 | 114 | |
| 115 | 115 | if (!empty($cat_find_array)) |
| 116 | - $search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
|
|
| 116 | + $search .= "AND (".implode(' OR ', $cat_find_array).")";
|
|
| 117 | 117 | |
| 118 | 118 | $main_query_array = $map_cat_ids_array; |
| 119 | 119 | |
| 120 | 120 | if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) {
|
| 121 | 121 | $search .= " AND p.post_title LIKE %s"; |
| 122 | - $main_query_array[] = "%" . $_REQUEST['search'] . "%"; |
|
| 122 | + $main_query_array[] = "%".$_REQUEST['search']."%"; |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | /** |
@@ -141,14 +141,14 @@ discard block |
||
| 141 | 141 | |
| 142 | 142 | $gd_posttype = ''; |
| 143 | 143 | if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') {
|
| 144 | - $table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail'; |
|
| 144 | + $table = $plugin_prefix.$_REQUEST['gd_posttype'].'_detail'; |
|
| 145 | 145 | $gd_posttype = " AND p.post_type = %s"; |
| 146 | 146 | $main_query_array[] = $_REQUEST['gd_posttype']; |
| 147 | 147 | |
| 148 | 148 | } else |
| 149 | - $table = $plugin_prefix . 'gd_place_detail'; |
|
| 149 | + $table = $plugin_prefix.'gd_place_detail'; |
|
| 150 | 150 | |
| 151 | - $join = ", " . $table . " AS pd "; |
|
| 151 | + $join = ", ".$table." AS pd "; |
|
| 152 | 152 | |
| 153 | 153 | /** |
| 154 | 154 | * Filter the SQL JOIN clause for the markers data |
@@ -168,14 +168,14 @@ discard block |
||
| 168 | 168 | */ |
| 169 | 169 | $search = apply_filters('geodir_home_map_listing_where', $search);
|
| 170 | 170 | $search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search);
|
| 171 | - $cat_type = $post_type . 'category'; |
|
| 171 | + $cat_type = $post_type.'category'; |
|
| 172 | 172 | if ($post_type == 'gd_event') {
|
| 173 | 173 | $event_select = ", pd.recurring_dates, pd.is_recurring"; |
| 174 | 174 | } else {
|
| 175 | 175 | $event_select = ""; |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | - $sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select; |
|
| 178 | + $sql_select = 'SELECT pd.default_category, pd.'.$cat_type.', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude'.$event_select; |
|
| 179 | 179 | /** |
| 180 | 180 | * Filter the SQL SELECT clause to retrive fields data |
| 181 | 181 | * |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | */ |
| 196 | 196 | $groupby = apply_filters('geodir_home_map_listing_groupby', $groupby);
|
| 197 | 197 | |
| 198 | - $catsql = $wpdb->prepare("$select $field_default_cat FROM " . $wpdb->posts . " as p" . $join . " WHERE p.ID = pd.post_id AND p.post_status = 'publish' " . $search . $gd_posttype . $groupby , $main_query_array);
|
|
| 198 | + $catsql = $wpdb->prepare("$select $field_default_cat FROM ".$wpdb->posts." as p".$join." WHERE p.ID = pd.post_id AND p.post_status = 'publish' ".$search.$gd_posttype.$groupby, $main_query_array);
|
|
| 199 | 199 | |
| 200 | 200 | /** |
| 201 | 201 | * Filter the SQL query to retrive markers data |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | $e = 0; |
| 258 | 258 | foreach ($recurring_dates as $date) {
|
| 259 | 259 | if (strtotime($date) >= $today) {
|
| 260 | - $event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($date)); |
|
| 260 | + $event_dates .= ' :: '.date_i18n($geodir_date_format, strtotime($date)); |
|
| 261 | 261 | |
| 262 | 262 | $e++; |
| 263 | 263 | if ($e == 3) { // only show 3 event dates
|
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | $end_date = !empty($recurring_data['event_end']) && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? $recurring_data['event_end'] : $start_date; |
| 272 | 272 | |
| 273 | 273 | if ($end_date != '' && strtotime($end_date) >= $today) {
|
| 274 | - $event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($start_date)) .' -> ' . date_i18n($geodir_date_format, strtotime($end_date)); |
|
| 274 | + $event_dates .= ' :: '.date_i18n($geodir_date_format, strtotime($start_date)).' -> '.date_i18n($geodir_date_format, strtotime($end_date)); |
|
| 275 | 275 | } |
| 276 | 276 | } |
| 277 | 277 | |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | $icon_size = array('w' => 36, 'h' => 45);
|
| 300 | 300 | } |
| 301 | 301 | |
| 302 | - $content_data[] = '{"id":"' . $catinfo_obj->post_id . '","t": "' . $title . '","lt": "' . $catinfo_obj->post_latitude . '","ln": "' . $catinfo_obj->post_longitude . '","mk_id":"' . $catinfo_obj->post_id . '_' . $catinfo_obj->default_category . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"'.$mark_extra.'}';
|
|
| 302 | + $content_data[] = '{"id":"'.$catinfo_obj->post_id.'","t": "'.$title.'","lt": "'.$catinfo_obj->post_latitude.'","ln": "'.$catinfo_obj->post_longitude.'","mk_id":"'.$catinfo_obj->post_id.'_'.$catinfo_obj->default_category.'","i":"'.$icon.'","w":"'.$icon_size['w'].'","h":"'.$icon_size['h'].'"'.$mark_extra.'}';
|
|
| 303 | 303 | $post_ids[] = $catinfo_obj->post_id; |
| 304 | 304 | } |
| 305 | 305 | } |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | $totalcount = count(array_unique($post_ids)); |
| 324 | 324 | |
| 325 | 325 | if (!empty($cat_content_info)) {
|
| 326 | - return '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
|
|
| 326 | + return '[{"totalcount":"'.$totalcount.'",'.substr(implode(',', $cat_content_info), 1).']';
|
|
| 327 | 327 | } |
| 328 | 328 | else {
|
| 329 | 329 | return '[{"totalcount":"0"}]';
|
@@ -45,9 +45,10 @@ discard block |
||
| 45 | 45 | $default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
| 46 | 46 | if (is_admin() && isset($_REQUEST['tab']) && $mapzoom == '') {
|
| 47 | 47 | $mapzoom = 4; |
| 48 | - if (isset($_REQUEST['add_hood'])) |
|
| 49 | - $mapzoom = 10; |
|
| 50 | -} |
|
| 48 | + if (isset($_REQUEST['add_hood'])) { |
|
| 49 | + $mapzoom = 10; |
|
| 50 | + } |
|
| 51 | + } |
|
| 51 | 52 | |
| 52 | 53 | /** |
| 53 | 54 | * Filter the auto change address fields values |
@@ -641,8 +642,9 @@ discard block |
||
| 641 | 642 | </script> |
| 642 | 643 | <?php |
| 643 | 644 | $set_button_class = 'geodir_button'; |
| 644 | -if (is_admin()) |
|
| 645 | - $set_button_class = 'button-primary'; |
|
| 645 | +if (is_admin()) { |
|
| 646 | + $set_button_class = 'button-primary'; |
|
| 647 | +} |
|
| 646 | 648 | ?> |
| 647 | 649 | <input type="button" id="<?php echo $prefix; ?>set_address_button" class="<?php echo $set_button_class; ?>" |
| 648 | 650 | value="<?php _e($map_title, 'geodirectory'); ?>" style="float:none;"/> |
@@ -34,19 +34,19 @@ discard block |
||
| 34 | 34 | $defaultcity = isset($default_location->city) ? $default_location->city : ''; |
| 35 | 35 | $lat_lng_blank = false; |
| 36 | 36 | if ($lat == '' && $lng == '') {
|
| 37 | - $lat_lng_blank = true; |
|
| 38 | - $city = $defaultcity; |
|
| 39 | - $region = isset($default_location->region) ? $default_location->region : ''; |
|
| 40 | - $country = isset($default_location->country) ? $default_location->country : ''; |
|
| 41 | - $lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
| 42 | - $lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
| 37 | + $lat_lng_blank = true; |
|
| 38 | + $city = $defaultcity; |
|
| 39 | + $region = isset($default_location->region) ? $default_location->region : ''; |
|
| 40 | + $country = isset($default_location->country) ? $default_location->country : ''; |
|
| 41 | + $lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
| 42 | + $lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
| 43 | 43 | } |
| 44 | 44 | $default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
| 45 | 45 | $default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
| 46 | 46 | if (is_admin() && isset($_REQUEST['tab']) && $mapzoom == '') {
|
| 47 | - $mapzoom = 4; |
|
| 48 | - if (isset($_REQUEST['add_hood'])) |
|
| 49 | - $mapzoom = 10; |
|
| 47 | + $mapzoom = 4; |
|
| 48 | + if (isset($_REQUEST['add_hood'])) |
|
| 49 | + $mapzoom = 10; |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | /** |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | * Fires at the start of the add javascript on the add lsitings map. |
| 68 | 68 | * |
| 69 | 69 | * @since 1.0.0 |
| 70 | - * @param string $prefix The prefix for all elements. |
|
| 70 | + * @param string $prefix The prefix for all elements. |
|
| 71 | 71 | */ |
| 72 | 72 | do_action('geodir_add_listing_js_start', $prefix);
|
| 73 | 73 | ?> |
@@ -314,13 +314,13 @@ discard block |
||
| 314 | 314 | getZip = postal_code.long_name; |
| 315 | 315 | } |
| 316 | 316 | <?php |
| 317 | - /** |
|
| 318 | - * Fires to add javascript variable to use in google map. |
|
| 319 | - * |
|
| 320 | - * @since 1.0.0 |
|
| 321 | - */ |
|
| 322 | - do_action('geodir_add_listing_geocode_js_vars');
|
|
| 323 | - ?> |
|
| 317 | + /** |
|
| 318 | + * Fires to add javascript variable to use in google map. |
|
| 319 | + * |
|
| 320 | + * @since 1.0.0 |
|
| 321 | + */ |
|
| 322 | + do_action('geodir_add_listing_geocode_js_vars');
|
|
| 323 | + ?> |
|
| 324 | 324 | <?php if ($is_map_restrict) { ?>
|
| 325 | 325 | if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
|
| 326 | 326 | alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
|
@@ -400,15 +400,15 @@ discard block |
||
| 400 | 400 | } |
| 401 | 401 | } |
| 402 | 402 | <?php |
| 403 | - /** |
|
| 404 | - * Fires when marker address updated on map. |
|
| 405 | - * |
|
| 406 | - * @since 1.0.0 |
|
| 407 | - * @param string $prefix Identifier used as a prefix for field name |
|
| 408 | - */ |
|
| 409 | - do_action('geodir_update_marker_address', $prefix);
|
|
| 410 | - echo $updateMarkerAddress = ob_get_clean(); |
|
| 411 | - ?> |
|
| 403 | + /** |
|
| 404 | + * Fires when marker address updated on map. |
|
| 405 | + * |
|
| 406 | + * @since 1.0.0 |
|
| 407 | + * @param string $prefix Identifier used as a prefix for field name |
|
| 408 | + */ |
|
| 409 | + do_action('geodir_update_marker_address', $prefix);
|
|
| 410 | + echo $updateMarkerAddress = ob_get_clean(); |
|
| 411 | + ?> |
|
| 412 | 412 | } |
| 413 | 413 | function geodir_codeAddress(set_on_map) {
|
| 414 | 414 | var address = jQuery('#<?php echo $prefix.'address';?>').val();
|
@@ -435,9 +435,9 @@ discard block |
||
| 435 | 435 | } |
| 436 | 436 | var is_restrict = '<?php echo $is_map_restrict; ?>'; |
| 437 | 437 | <?php ob_start(); |
| 438 | - $defaultregion = isset($default_location->region) ? $default_location->region : ''; |
|
| 439 | - $defaultcountry = isset($default_location->country) ? $default_location->country : ''; |
|
| 440 | - ?> |
|
| 438 | + $defaultregion = isset($default_location->region) ? $default_location->region : ''; |
|
| 439 | + $defaultcountry = isset($default_location->country) ? $default_location->country : ''; |
|
| 440 | + ?> |
|
| 441 | 441 | if (set_on_map && is_restrict) {
|
| 442 | 442 | if (zip != '' && address != '') {
|
| 443 | 443 | address = address + ',' + zip; |
@@ -446,12 +446,12 @@ discard block |
||
| 446 | 446 | if (typeof address === 'undefined') |
| 447 | 447 | address = ''; |
| 448 | 448 | <?php |
| 449 | - if(is_admin() && isset($_REQUEST['tab'])){?>
|
|
| 449 | + if(is_admin() && isset($_REQUEST['tab'])){?>
|
|
| 450 | 450 | if (jQuery.trim(city) == '' || jQuery.trim(region) == '') {
|
| 451 | 451 | address = ''; |
| 452 | 452 | } |
| 453 | 453 | <?php |
| 454 | - }?> |
|
| 454 | + }?> |
|
| 455 | 455 | |
| 456 | 456 | if (ISO2 == 'GB') {
|
| 457 | 457 | address = address + ',' + city + ',' + country + ',' + zip; // UK is funny with regions |
@@ -460,15 +460,15 @@ discard block |
||
| 460 | 460 | } |
| 461 | 461 | } |
| 462 | 462 | <?php $codeAddress = ob_get_clean(); |
| 463 | - /** |
|
| 464 | - * Filter the address variable |
|
| 465 | - * |
|
| 466 | - * @since 1.0.0 |
|
| 467 | - * |
|
| 468 | - * @param string $codeAddress Row of address to use in google map. |
|
| 469 | - */ |
|
| 470 | - echo apply_filters('geodir_codeaddress', $codeAddress);
|
|
| 471 | - ?> |
|
| 463 | + /** |
|
| 464 | + * Filter the address variable |
|
| 465 | + * |
|
| 466 | + * @since 1.0.0 |
|
| 467 | + * |
|
| 468 | + * @param string $codeAddress Row of address to use in google map. |
|
| 469 | + */ |
|
| 470 | + echo apply_filters('geodir_codeaddress', $codeAddress);
|
|
| 471 | + ?> |
|
| 472 | 472 | if (!window.gdMaps) { // No Google Map Loaded
|
| 473 | 473 | return; |
| 474 | 474 | } |
@@ -493,13 +493,13 @@ discard block |
||
| 493 | 493 | updateMarkerPosition(baseMarker.getPosition()); |
| 494 | 494 | //if(set_on_map && is_restrict) {
|
| 495 | 495 | <?php |
| 496 | - /** |
|
| 497 | - * Fires before set geocode position. |
|
| 498 | - * |
|
| 499 | - * @since 1.0.0 |
|
| 500 | - */ |
|
| 501 | - do_action('geodir_add_listing_codeaddress_before_geocode');
|
|
| 502 | - ?> |
|
| 496 | + /** |
|
| 497 | + * Fires before set geocode position. |
|
| 498 | + * |
|
| 499 | + * @since 1.0.0 |
|
| 500 | + */ |
|
| 501 | + do_action('geodir_add_listing_codeaddress_before_geocode');
|
|
| 502 | + ?> |
|
| 503 | 503 | geocodePosition(baseMarker.getPosition(), {'address': address, 'country': ISO2});
|
| 504 | 504 | //} |
| 505 | 505 | } else {
|
@@ -545,13 +545,13 @@ discard block |
||
| 545 | 545 | updateMarkerPositionOSM(baseMarker.getLatLng()); |
| 546 | 546 | } |
| 547 | 547 | <?php |
| 548 | - /** |
|
| 549 | - * Fires to add javascript variable to use in google map. |
|
| 550 | - * |
|
| 551 | - * @since 1.0.0 |
|
| 552 | - */ |
|
| 553 | - do_action('geodir_add_listing_geocode_js_vars');
|
|
| 554 | - ?> |
|
| 548 | + /** |
|
| 549 | + * Fires to add javascript variable to use in google map. |
|
| 550 | + * |
|
| 551 | + * @since 1.0.0 |
|
| 552 | + */ |
|
| 553 | + do_action('geodir_add_listing_geocode_js_vars');
|
|
| 554 | + ?> |
|
| 555 | 555 | <?php if ($is_map_restrict) { ?>
|
| 556 | 556 | if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
|
| 557 | 557 | alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
|
@@ -699,7 +699,7 @@ discard block |
||
| 699 | 699 | <?php |
| 700 | 700 | $set_button_class = 'geodir_button'; |
| 701 | 701 | if (is_admin()) |
| 702 | - $set_button_class = 'button-primary'; |
|
| 702 | + $set_button_class = 'button-primary'; |
|
| 703 | 703 | ?> |
| 704 | 704 | <input type="button" id="<?php echo $prefix; ?>set_address_button" class="<?php echo $set_button_class; ?>" value="<?php esc_attr_e($map_title, 'geodirectory'); ?>" style="float:none;"/> |
| 705 | 705 | <div id="<?php echo $prefix; ?>d_mouseClick"></div> |
@@ -81,16 +81,16 @@ discard block |
||
| 81 | 81 | window.gdMaps = window.gdMaps || gdMaps; |
| 82 | 82 | |
| 83 | 83 | user_address = false; |
| 84 | - jQuery('#<?php echo $prefix.'address';?>').keypress(function () {
|
|
| 84 | + jQuery('#<?php echo $prefix.'address'; ?>').keypress(function () {
|
|
| 85 | 85 | user_address = true; |
| 86 | 86 | }); |
| 87 | 87 | |
| 88 | 88 | baseMarker = ''; |
| 89 | 89 | geocoder = ''; |
| 90 | - var <?php echo $prefix;?>CITY_MAP_CENTER_LAT = <?php echo ($lat) ? $lat : '39.952484'; ?>; |
|
| 91 | - var <?php echo $prefix;?>CITY_MAP_CENTER_LNG = <?php echo ($lng) ? $lng : '-75.163786'; ?>; |
|
| 92 | - <?php if($lat_lng_blank){$lat='';$lng='';}?>
|
|
| 93 | - var <?php echo $prefix;?>CITY_MAP_ZOOMING_FACT = <?php echo ($mapzoom) ? $mapzoom : 12;?>; |
|
| 90 | + var <?php echo $prefix; ?>CITY_MAP_CENTER_LAT = <?php echo ($lat) ? $lat : '39.952484'; ?>; |
|
| 91 | + var <?php echo $prefix; ?>CITY_MAP_CENTER_LNG = <?php echo ($lng) ? $lng : '-75.163786'; ?>; |
|
| 92 | + <?php if ($lat_lng_blank) {$lat = ''; $lng = ''; }?>
|
|
| 93 | + var <?php echo $prefix; ?>CITY_MAP_ZOOMING_FACT = <?php echo ($mapzoom) ? $mapzoom : 12; ?>; |
|
| 94 | 94 | var minZoomLevel = <?php echo ($is_map_restrict) ? 5 : 0; ?>; |
| 95 | 95 | var oldstr_address; |
| 96 | 96 | var oldstr_zip; |
@@ -322,9 +322,9 @@ discard block |
||
| 322 | 322 | do_action('geodir_add_listing_geocode_js_vars');
|
| 323 | 323 | ?> |
| 324 | 324 | <?php if ($is_map_restrict) { ?>
|
| 325 | - if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
|
|
| 326 | - alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
|
|
| 327 | - jQuery("#<?php echo $prefix.'map';?>").goMap();
|
|
| 325 | + if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city)); ?>') {
|
|
| 326 | + alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.', 'geodirectory'), $city)); ?>');
|
|
| 327 | + jQuery("#<?php echo $prefix.'map'; ?>").goMap();
|
|
| 328 | 328 | jQuery.goMap.map.setCenter(new google.maps.LatLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
|
| 329 | 329 | baseMarker.setPosition(new google.maps.LatLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
|
| 330 | 330 | updateMarkerPosition(baseMarker.getPosition()); |
@@ -333,11 +333,11 @@ discard block |
||
| 333 | 333 | <?php } ?> |
| 334 | 334 | updateMarkerAddress(getAddress, getZip, getCity, getState, getCountry); |
| 335 | 335 | } else {
|
| 336 | - updateMarkerAddress('<?php echo addslashes_gpc(__('Cannot determine address at this location.','geodirectory'));?>');
|
|
| 336 | + updateMarkerAddress('<?php echo addslashes_gpc(__('Cannot determine address at this location.', 'geodirectory')); ?>');
|
|
| 337 | 337 | } |
| 338 | 338 | } |
| 339 | 339 | function centerMap(latlng) {
|
| 340 | - jQuery("#<?php echo $prefix.'map';?>").goMap();
|
|
| 340 | + jQuery("#<?php echo $prefix.'map'; ?>").goMap();
|
|
| 341 | 341 | if (window.gdMaps == 'google') {
|
| 342 | 342 | jQuery.goMap.map.panTo(baseMarker.getPosition()); |
| 343 | 343 | } else if (window.gdMaps == 'osm') {
|
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | } |
| 347 | 347 | } |
| 348 | 348 | function centerMarker() {
|
| 349 | - jQuery("#<?php echo $prefix.'map';?>").goMap();
|
|
| 349 | + jQuery("#<?php echo $prefix.'map'; ?>").goMap();
|
|
| 350 | 350 | var center = jQuery.goMap.map.getCenter(); |
| 351 | 351 | if (window.gdMaps == 'google') {
|
| 352 | 352 | baseMarker.setPosition(center); |
@@ -355,47 +355,47 @@ discard block |
||
| 355 | 355 | } |
| 356 | 356 | } |
| 357 | 357 | function updateMapZoom(zoom) {
|
| 358 | - jQuery('#<?php echo $prefix.'mapzoom';?>').val(zoom);
|
|
| 358 | + jQuery('#<?php echo $prefix.'mapzoom'; ?>').val(zoom);
|
|
| 359 | 359 | } |
| 360 | 360 | function updateMarkerPosition(markerlatLng) {
|
| 361 | - jQuery("#<?php echo $prefix.'map';?>").goMap();
|
|
| 362 | - jQuery('#<?php echo $prefix.'latitude';?>').val(markerlatLng.lat());
|
|
| 363 | - jQuery('#<?php echo $prefix.'longitude';?>').val(markerlatLng.lng());
|
|
| 361 | + jQuery("#<?php echo $prefix.'map'; ?>").goMap();
|
|
| 362 | + jQuery('#<?php echo $prefix.'latitude'; ?>').val(markerlatLng.lat());
|
|
| 363 | + jQuery('#<?php echo $prefix.'longitude'; ?>').val(markerlatLng.lng());
|
|
| 364 | 364 | } |
| 365 | 365 | function updateMarkerPositionOSM(markerlatLng) {
|
| 366 | - jQuery('#<?php echo $prefix.'latitude';?>').val(markerlatLng.lat);
|
|
| 367 | - jQuery('#<?php echo $prefix.'longitude';?>').val(markerlatLng.lng);
|
|
| 366 | + jQuery('#<?php echo $prefix.'latitude'; ?>').val(markerlatLng.lat);
|
|
| 367 | + jQuery('#<?php echo $prefix.'longitude'; ?>').val(markerlatLng.lng);
|
|
| 368 | 368 | } |
| 369 | 369 | function updateMarkerAddress(getAddress, getZip, getCity, getState, getCountry) {
|
| 370 | - var set_map_val_in_fields = '<?php echo addslashes_gpc($auto_change_map_fields);?>'; |
|
| 371 | - <?php ob_start();?> |
|
| 372 | - var old_country = jQuery("#<?php echo $prefix.'country';?>").val();
|
|
| 373 | - var old_region = jQuery("#<?php echo $prefix.'region';?>").val();
|
|
| 370 | + var set_map_val_in_fields = '<?php echo addslashes_gpc($auto_change_map_fields); ?>'; |
|
| 371 | + <?php ob_start(); ?> |
|
| 372 | + var old_country = jQuery("#<?php echo $prefix.'country'; ?>").val();
|
|
| 373 | + var old_region = jQuery("#<?php echo $prefix.'region'; ?>").val();
|
|
| 374 | 374 | |
| 375 | - if (user_address == false || jQuery('#<?php echo $prefix.'address';?>').val() == '') {
|
|
| 376 | - jQuery("#<?php echo $prefix.'address';?>").val(getAddress);
|
|
| 375 | + if (user_address == false || jQuery('#<?php echo $prefix.'address'; ?>').val() == '') {
|
|
| 376 | + jQuery("#<?php echo $prefix.'address'; ?>").val(getAddress);
|
|
| 377 | 377 | } |
| 378 | 378 | if (getAddress) {
|
| 379 | 379 | oldstr_address = getAddress; |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | - jQuery("#<?php echo $prefix.'zip';?>").val(getZip);
|
|
| 382 | + jQuery("#<?php echo $prefix.'zip'; ?>").val(getZip);
|
|
| 383 | 383 | if (getZip) {
|
| 384 | 384 | oldstr_zip = getZip; |
| 385 | 385 | } |
| 386 | 386 | if (set_map_val_in_fields) {
|
| 387 | 387 | if (getCountry) {
|
| 388 | - jQuery('#<?php echo $prefix.'country';?> option[data-country_code="' + getCountryISO + '"]').attr("selected", true);
|
|
| 389 | - jQuery("#<?php echo $prefix.'country';?>").trigger("chosen:updated");
|
|
| 388 | + jQuery('#<?php echo $prefix.'country'; ?> option[data-country_code="' + getCountryISO + '"]').attr("selected", true);
|
|
| 389 | + jQuery("#<?php echo $prefix.'country'; ?>").trigger("chosen:updated");
|
|
| 390 | 390 | } |
| 391 | 391 | if (getState) {
|
| 392 | - if (jQuery('input[id="<?php echo $prefix.'region';?>"]').attr('id')) {
|
|
| 393 | - jQuery("#<?php echo $prefix.'region';?>").val(getState);
|
|
| 392 | + if (jQuery('input[id="<?php echo $prefix.'region'; ?>"]').attr('id')) {
|
|
| 393 | + jQuery("#<?php echo $prefix.'region'; ?>").val(getState);
|
|
| 394 | 394 | } |
| 395 | 395 | } |
| 396 | 396 | if (getCity) {
|
| 397 | - if (jQuery('input[id="<?php echo $prefix.'city';?>"]').attr('id')) {
|
|
| 398 | - jQuery("#<?php echo $prefix.'city';?>").val(getCity);
|
|
| 397 | + if (jQuery('input[id="<?php echo $prefix.'city'; ?>"]').attr('id')) {
|
|
| 398 | + jQuery("#<?php echo $prefix.'city'; ?>").val(getCity);
|
|
| 399 | 399 | } |
| 400 | 400 | } |
| 401 | 401 | } |
@@ -411,12 +411,12 @@ discard block |
||
| 411 | 411 | ?> |
| 412 | 412 | } |
| 413 | 413 | function geodir_codeAddress(set_on_map) {
|
| 414 | - var address = jQuery('#<?php echo $prefix.'address';?>').val();
|
|
| 415 | - var zip = jQuery('#<?php echo $prefix.'zip';?>').val();
|
|
| 416 | - var city = jQuery('#<?php echo $prefix.'city';?>').val();
|
|
| 417 | - var region = jQuery('#<?php echo $prefix.'region';?>').val();
|
|
| 418 | - var country = jQuery('#<?php echo $prefix.'country';?>').val();
|
|
| 419 | - var country_selected = jQuery('#<?php echo $prefix.'country';?>').find('option:selected');
|
|
| 414 | + var address = jQuery('#<?php echo $prefix.'address'; ?>').val();
|
|
| 415 | + var zip = jQuery('#<?php echo $prefix.'zip'; ?>').val();
|
|
| 416 | + var city = jQuery('#<?php echo $prefix.'city'; ?>').val();
|
|
| 417 | + var region = jQuery('#<?php echo $prefix.'region'; ?>').val();
|
|
| 418 | + var country = jQuery('#<?php echo $prefix.'country'; ?>').val();
|
|
| 419 | + var country_selected = jQuery('#<?php echo $prefix.'country'; ?>').find('option:selected');
|
|
| 420 | 420 | var ISO2 = country_selected.data('country_code');
|
| 421 | 421 | if (ISO2 == '--') {
|
| 422 | 422 | ISO2 = ''; |
@@ -425,13 +425,13 @@ discard block |
||
| 425 | 425 | zip = ''; |
| 426 | 426 | } |
| 427 | 427 | if (typeof city == "undefined") {
|
| 428 | - city = '<?php echo addslashes_gpc($city);?>'; |
|
| 428 | + city = '<?php echo addslashes_gpc($city); ?>'; |
|
| 429 | 429 | } |
| 430 | 430 | if (typeof region == "undefined") {
|
| 431 | - region = '<?php echo addslashes_gpc($region);?>'; |
|
| 431 | + region = '<?php echo addslashes_gpc($region); ?>'; |
|
| 432 | 432 | } |
| 433 | 433 | if (typeof country == "undefined") {
|
| 434 | - country = '<?php echo addslashes_gpc($country);?>'; |
|
| 434 | + country = '<?php echo addslashes_gpc($country); ?>'; |
|
| 435 | 435 | } |
| 436 | 436 | var is_restrict = '<?php echo $is_map_restrict; ?>'; |
| 437 | 437 | <?php ob_start(); |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | if (typeof address === 'undefined') |
| 447 | 447 | address = ''; |
| 448 | 448 | <?php |
| 449 | - if(is_admin() && isset($_REQUEST['tab'])){?>
|
|
| 449 | + if (is_admin() && isset($_REQUEST['tab'])) {?>
|
|
| 450 | 450 | if (jQuery.trim(city) == '' || jQuery.trim(region) == '') {
|
| 451 | 451 | address = ''; |
| 452 | 452 | } |
@@ -486,7 +486,7 @@ discard block |
||
| 486 | 486 | geocoder.geocode({'address': address, 'country': ISO2},
|
| 487 | 487 | function (results, status) {
|
| 488 | 488 | console.log(status); |
| 489 | - jQuery("#<?php echo $prefix.'map';?>").goMap();
|
|
| 489 | + jQuery("#<?php echo $prefix.'map'; ?>").goMap();
|
|
| 490 | 490 | if (status == google.maps.GeocoderStatus.OK) {
|
| 491 | 491 | baseMarker.setPosition(results[0].geometry.location); |
| 492 | 492 | jQuery.goMap.map.setCenter(results[0].geometry.location); |
@@ -503,21 +503,21 @@ discard block |
||
| 503 | 503 | geocodePosition(baseMarker.getPosition(), {'address': address, 'country': ISO2});
|
| 504 | 504 | //} |
| 505 | 505 | } else {
|
| 506 | - alert('<?php echo addslashes_gpc(__('Geocode was not successful for the following reason:','geodirectory'));?> ' + status);
|
|
| 506 | + alert('<?php echo addslashes_gpc(__('Geocode was not successful for the following reason:', 'geodirectory')); ?> ' + status);
|
|
| 507 | 507 | } |
| 508 | 508 | }); |
| 509 | 509 | } |
| 510 | 510 | } |
| 511 | 511 | function gdMaxMap() {
|
| 512 | - jQuery("#<?php echo $prefix.'map';?>").goMap();
|
|
| 512 | + jQuery("#<?php echo $prefix.'map'; ?>").goMap();
|
|
| 513 | 513 | |
| 514 | - jQuery('#<?php echo $prefix.'map';?>').toggleClass('map-fullscreen');
|
|
| 514 | + jQuery('#<?php echo $prefix.'map'; ?>').toggleClass('map-fullscreen');
|
|
| 515 | 515 | jQuery('.map_category').toggleClass('map_category_fullscreen');
|
| 516 | - jQuery('#<?php echo $prefix;?>trigger').toggleClass('map_category_fullscreen');
|
|
| 516 | + jQuery('#<?php echo $prefix; ?>trigger').toggleClass('map_category_fullscreen');
|
|
| 517 | 517 | jQuery('body').toggleClass('body_fullscreen');
|
| 518 | - jQuery('#<?php echo $prefix;?>loading_div').toggleClass('loading_div_fullscreen');
|
|
| 519 | - jQuery('#<?php echo $prefix;?>advmap_nofound').toggleClass('nofound_fullscreen');
|
|
| 520 | - jQuery('#<?php echo $prefix;?>triggermap').toggleClass('triggermap_fullscreen');
|
|
| 518 | + jQuery('#<?php echo $prefix; ?>loading_div').toggleClass('loading_div_fullscreen');
|
|
| 519 | + jQuery('#<?php echo $prefix; ?>advmap_nofound').toggleClass('nofound_fullscreen');
|
|
| 520 | + jQuery('#<?php echo $prefix; ?>triggermap').toggleClass('triggermap_fullscreen');
|
|
| 521 | 521 | jQuery('.TopLeft').toggleClass('TopLeft_fullscreen');
|
| 522 | 522 | window.setTimeout(function () {
|
| 523 | 523 | if (window.gdMaps == 'google') {
|
@@ -553,9 +553,9 @@ discard block |
||
| 553 | 553 | do_action('geodir_add_listing_geocode_js_vars');
|
| 554 | 554 | ?> |
| 555 | 555 | <?php if ($is_map_restrict) { ?>
|
| 556 | - if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
|
|
| 557 | - alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
|
|
| 558 | - jQuery("#<?php echo $prefix.'map';?>").goMap();
|
|
| 556 | + if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city)); ?>') {
|
|
| 557 | + alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.', 'geodirectory'), $city)); ?>');
|
|
| 558 | + jQuery("#<?php echo $prefix.'map'; ?>").goMap();
|
|
| 559 | 559 | centerMap(new L.latLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
|
| 560 | 560 | baseMarker.setLatLng(new L.latLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
|
| 561 | 561 | updateMarkerPositionOSM(baseMarker.getLatLng()); |
@@ -564,39 +564,39 @@ discard block |
||
| 564 | 564 | <?php } ?> |
| 565 | 565 | updateMarkerAddress(getAddress, getZip, getCity, getState, getCountry); |
| 566 | 566 | } else {
|
| 567 | - alert('<?php echo addslashes_gpc(__('Cannot determine address at this location.','geodirectory'));?>');
|
|
| 567 | + alert('<?php echo addslashes_gpc(__('Cannot determine address at this location.', 'geodirectory')); ?>');
|
|
| 568 | 568 | } |
| 569 | 569 | } |
| 570 | 570 | |
| 571 | 571 | jQuery(function ($) {
|
| 572 | - $("#<?php echo $prefix.'map';?>").goMap({
|
|
| 573 | - latitude: <?php echo $prefix;?>CITY_MAP_CENTER_LAT, |
|
| 574 | - longitude: <?php echo $prefix;?>CITY_MAP_CENTER_LNG, |
|
| 575 | - zoom: <?php echo $prefix;?>CITY_MAP_ZOOMING_FACT, |
|
| 572 | + $("#<?php echo $prefix.'map'; ?>").goMap({
|
|
| 573 | + latitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LAT, |
|
| 574 | + longitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LNG, |
|
| 575 | + zoom: <?php echo $prefix; ?>CITY_MAP_ZOOMING_FACT, |
|
| 576 | 576 | maptype: 'ROADMAP', // Map type - HYBRID, ROADMAP, SATELLITE, TERRAIN |
| 577 | 577 | streetViewControl: true, |
| 578 | - <?php if(get_option('geodir_add_listing_mouse_scroll')) { echo 'scrollwheel: false,';}?>
|
|
| 578 | + <?php if (get_option('geodir_add_listing_mouse_scroll')) { echo 'scrollwheel: false,'; }?>
|
|
| 579 | 579 | }); |
| 580 | 580 | |
| 581 | 581 | if (window.gdMaps) {
|
| 582 | 582 | geocoder = window.gdMaps == 'google' ? new google.maps.Geocoder() : []; |
| 583 | 583 | |
| 584 | 584 | baseMarker = $.goMap.createMarker({
|
| 585 | - latitude: <?php echo $prefix;?>CITY_MAP_CENTER_LAT, |
|
| 586 | - longitude: <?php echo $prefix;?>CITY_MAP_CENTER_LNG, |
|
| 585 | + latitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LAT, |
|
| 586 | + longitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LNG, |
|
| 587 | 587 | id: 'baseMarker', |
| 588 | - icon: '<?php echo $marker_icon;?>', |
|
| 588 | + icon: '<?php echo $marker_icon; ?>', |
|
| 589 | 589 | draggable: true, |
| 590 | 590 | addToMap: true, // For OSM |
| 591 | - w: parseFloat('<?php echo $icon_size['w'];?>'),
|
|
| 592 | - h: parseFloat('<?php echo $icon_size['h'];?>'),
|
|
| 591 | + w: parseFloat('<?php echo $icon_size['w']; ?>'),
|
|
| 592 | + h: parseFloat('<?php echo $icon_size['h']; ?>'),
|
|
| 593 | 593 | }); |
| 594 | 594 | } else {
|
| 595 | - jQuery('#<?php echo $prefix.'advmap_nofound';?>').hide();
|
|
| 596 | - jQuery('#<?php echo $prefix.'advmap_notloaded';?>').show();
|
|
| 595 | + jQuery('#<?php echo $prefix.'advmap_nofound'; ?>').hide();
|
|
| 596 | + jQuery('#<?php echo $prefix.'advmap_notloaded'; ?>').show();
|
|
| 597 | 597 | } |
| 598 | 598 | |
| 599 | - $("#<?php echo $prefix;?>set_address_button").click(function () {
|
|
| 599 | + $("#<?php echo $prefix; ?>set_address_button").click(function () {
|
|
| 600 | 600 | var set_on_map = true; |
| 601 | 601 | geodir_codeAddress(set_on_map); |
| 602 | 602 | }); |
@@ -630,14 +630,14 @@ discard block |
||
| 630 | 630 | updateMapZoom($.goMap.map.zoom); |
| 631 | 631 | }); |
| 632 | 632 | |
| 633 | - var maxMap = document.getElementById('<?php echo $prefix;?>triggermap');
|
|
| 633 | + var maxMap = document.getElementById('<?php echo $prefix; ?>triggermap');
|
|
| 634 | 634 | google.maps.event.addDomListener(maxMap, 'click', gdMaxMap); |
| 635 | 635 | |
| 636 | 636 | <?php if ($is_map_restrict) { ?>
|
| 637 | - var CITY_ADDRESS = '<?php echo addslashes_gpc($city).','.addslashes_gpc($region).','.addslashes_gpc($country);?>'; |
|
| 637 | + var CITY_ADDRESS = '<?php echo addslashes_gpc($city).','.addslashes_gpc($region).','.addslashes_gpc($country); ?>'; |
|
| 638 | 638 | geocoder.geocode({'address': CITY_ADDRESS},
|
| 639 | 639 | function (results, status) {
|
| 640 | - $("#<?php echo $prefix.'map';?>").goMap();
|
|
| 640 | + $("#<?php echo $prefix.'map'; ?>").goMap();
|
|
| 641 | 641 | if (status == google.maps.GeocoderStatus.OK) {
|
| 642 | 642 | // Bounds for North America |
| 643 | 643 | var bound_lat_lng = String(results[0].geometry.bounds); |
@@ -648,13 +648,13 @@ discard block |
||
| 648 | 648 | new google.maps.LatLng(bound_lat_lng[2], bound_lat_lng[3]) |
| 649 | 649 | ); |
| 650 | 650 | } else {
|
| 651 | - alert("<?php _e('Geocode was not successful for the following reason:','geodirectory');?> " + status);
|
|
| 651 | + alert("<?php _e('Geocode was not successful for the following reason:', 'geodirectory'); ?> " + status);
|
|
| 652 | 652 | } |
| 653 | 653 | }); |
| 654 | 654 | <?php } ?> |
| 655 | 655 | // Limit the zoom level |
| 656 | 656 | google.maps.event.addListener($.goMap.map, 'zoom_changed', function () {
|
| 657 | - $("#<?php echo $prefix.'map';?>").goMap();
|
|
| 657 | + $("#<?php echo $prefix.'map'; ?>").goMap();
|
|
| 658 | 658 | if ($.goMap.map.getZoom() < minZoomLevel) $.goMap.map.setZoom(minZoomLevel); |
| 659 | 659 | }); |
| 660 | 660 | } else if (window.gdMaps == 'osm') {
|
@@ -680,10 +680,10 @@ discard block |
||
| 680 | 680 | updateMapZoom($.goMap.map.getZoom()); |
| 681 | 681 | }); |
| 682 | 682 | |
| 683 | - L.DomEvent.addListener($('<?php echo $prefix;?>triggermap'), 'click', gdMaxMap);
|
|
| 683 | + L.DomEvent.addListener($('<?php echo $prefix; ?>triggermap'), 'click', gdMaxMap);
|
|
| 684 | 684 | |
| 685 | 685 | <?php if ($is_map_restrict) { ?>
|
| 686 | - var CITY_ADDRESS = '<?php echo addslashes_gpc($city).', '.addslashes_gpc($region).', '.addslashes_gpc($country);?>'; |
|
| 686 | + var CITY_ADDRESS = '<?php echo addslashes_gpc($city).', '.addslashes_gpc($region).', '.addslashes_gpc($country); ?>'; |
|
| 687 | 687 | geocodePositionOSM('', CITY_ADDRESS);
|
| 688 | 688 | <?php } ?> |
| 689 | 689 | // Limit the zoom level |
@@ -706,14 +706,14 @@ discard block |
||
| 706 | 706 | <div class="top_banner_section_inn geodir_map_container clearfix" style="margin-top:10px;"> |
| 707 | 707 | <div class="TopLeft"><span id="<?php echo $prefix; ?>triggermap" style="margin-top:-11px;margin-left:-12px;"></span></div> |
| 708 | 708 | <div class="TopRight"></div> |
| 709 | - <div id="<?php echo $prefix . 'map'; ?>" class="geodir_map" style="height:300px"> |
|
| 709 | + <div id="<?php echo $prefix.'map'; ?>" class="geodir_map" style="height:300px"> |
|
| 710 | 710 | <!-- new map start --> |
| 711 | 711 | <div class="iprelative"> |
| 712 | - <div id="<?php echo $prefix . 'map'; ?>" style="float:right;height:300px;position:relative;" class="form_row clearfix"></div> |
|
| 712 | + <div id="<?php echo $prefix.'map'; ?>" style="float:right;height:300px;position:relative;" class="form_row clearfix"></div> |
|
| 713 | 713 | <div id="<?php echo $prefix; ?>loading_div" style="height:300px"></div> |
| 714 | 714 | <div id="<?php echo $prefix; ?>advmap_counter"></div> |
| 715 | 715 | <div id="<?php echo $prefix; ?>advmap_nofound"><?php echo MAP_NO_RESULTS; ?></div> |
| 716 | - <div id="<?php echo $prefix;?>advmap_notloaded" class="advmap_notloaded"><?php _e('<h3>Map Not Loaded</h3><p>Sorry, unable to load Maps API.', 'geodirectory'); ?></div>
|
|
| 716 | + <div id="<?php echo $prefix; ?>advmap_notloaded" class="advmap_notloaded"><?php _e('<h3>Map Not Loaded</h3><p>Sorry, unable to load Maps API.', 'geodirectory'); ?></div>
|
|
| 717 | 717 | </div> |
| 718 | 718 | <!-- new map end --> |
| 719 | 719 | </div> |
@@ -223,10 +223,11 @@ discard block |
||
| 223 | 223 | <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="0"/> |
| 224 | 224 | <?php } |
| 225 | 225 | |
| 226 | - if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters']) |
|
| 227 | - $show_entire_cat_panel = "none"; |
|
| 228 | - else |
|
| 229 | - $show_entire_cat_panel = "''"; |
|
| 226 | + if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters']) { |
|
| 227 | + $show_entire_cat_panel = "none"; |
|
| 228 | + } else { |
|
| 229 | + $show_entire_cat_panel = "''"; |
|
| 230 | + } |
|
| 230 | 231 | ?> |
| 231 | 232 | |
| 232 | 233 | <?php if ($geodir_map_options['enable_map_direction']) { ?>
|
@@ -288,8 +289,9 @@ discard block |
||
| 288 | 289 | } |
| 289 | 290 | |
| 290 | 291 | $geodir_default_map_search_pt = get_option('geodir_default_map_search_pt');
|
| 291 | - if (empty($geodir_default_map_search_pt)) |
|
| 292 | - $geodir_default_map_search_pt = 'gd_place'; |
|
| 292 | + if (empty($geodir_default_map_search_pt)) { |
|
| 293 | + $geodir_default_map_search_pt = 'gd_place'; |
|
| 294 | + } |
|
| 293 | 295 | |
| 294 | 296 | /** |
| 295 | 297 | * Filter the post type to retrive data for map |
@@ -67,77 +67,77 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | function geodir_draw_map($map_args = array()) |
| 69 | 69 | {
|
| 70 | - global $map_canvas_arr; |
|
| 71 | - $map_canvas_name = (!empty($map_args) && $map_args['map_canvas_name'] != '') ? $map_args['map_canvas_name'] : 'home_map_canvas'; |
|
| 72 | - $map_class_name = (!empty($map_args) && isset($map_args['map_class_name'])) ? $map_args['map_class_name'] : ''; |
|
| 73 | - |
|
| 74 | - $default_location = geodir_get_default_location(); |
|
| 75 | - |
|
| 76 | - $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
| 77 | - $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
| 78 | - $map_default_zoom = 12; |
|
| 79 | - // map options default values |
|
| 80 | - $width = 950; |
|
| 81 | - $height = 450; |
|
| 82 | - $child_collapse = '0'; |
|
| 83 | - $sticky = ''; |
|
| 84 | - $enable_cat_filters = false; |
|
| 85 | - $enable_text_search = false; |
|
| 86 | - $enable_post_type_filters = false; |
|
| 87 | - $enable_location_filters = false; |
|
| 88 | - $enable_jason_on_load = false; |
|
| 89 | - $enable_map_direction = false; |
|
| 90 | - $enable_marker_cluster = false; |
|
| 91 | - $enable_map_resize_button = false; |
|
| 92 | - $maptype = 'ROADMAP'; |
|
| 93 | - |
|
| 94 | - $geodir_map_options = array( |
|
| 95 | - 'width' => $width, |
|
| 96 | - 'height' => $height, |
|
| 97 | - 'child_collapse' => $child_collapse, |
|
| 98 | - 'sticky' => $sticky, |
|
| 99 | - 'enable_map_resize_button' => $enable_map_resize_button, |
|
| 100 | - 'enable_cat_filters' => $enable_cat_filters, |
|
| 101 | - 'enable_text_search' => $enable_text_search, |
|
| 102 | - 'enable_post_type_filters' => $enable_post_type_filters, |
|
| 103 | - 'enable_location_filters' => $enable_location_filters, |
|
| 104 | - 'enable_jason_on_load' => $enable_jason_on_load, |
|
| 105 | - 'enable_map_direction' => $enable_map_direction, |
|
| 106 | - 'enable_marker_cluster' => $enable_marker_cluster, |
|
| 107 | - 'ajax_url' => geodir_get_ajax_url(), |
|
| 108 | - 'map_canvas_name' => $map_canvas_name, |
|
| 109 | - 'inputText' => __('Title or Keyword', 'geodirectory'),
|
|
| 110 | - 'latitude' => $map_default_lat, |
|
| 111 | - 'longitude' => $map_default_lng, |
|
| 112 | - 'zoom' => $map_default_zoom, |
|
| 113 | - 'scrollwheel' => true, |
|
| 114 | - 'streetViewControl' => true, |
|
| 115 | - 'maptype' => $maptype, |
|
| 116 | - 'showPreview' => '0', |
|
| 117 | - 'maxZoom' => 21, |
|
| 118 | - 'autozoom' => true, |
|
| 119 | - 'bubble_size' => 'small', |
|
| 120 | - 'token' => '68f48005e256696074e1da9bf9f67f06', |
|
| 121 | - 'navigationControlOptions' => array('position' => 'TOP_LEFT', 'style' => 'ZOOM_PAN')
|
|
| 122 | - ); |
|
| 123 | - |
|
| 124 | - if (!empty($map_args)) {
|
|
| 125 | - foreach ($map_args as $map_option_key => $map_option_value) {
|
|
| 126 | - $geodir_map_options[$map_option_key] = $map_option_value; |
|
| 127 | - } |
|
| 128 | - } |
|
| 129 | - |
|
| 130 | - if (strpos($geodir_map_options['height'], '%') !== false || strpos($geodir_map_options['height'], 'px') !== false || strpos($geodir_map_options['height'], 'vh') !== false) {
|
|
| 131 | - } else {
|
|
| 132 | - $geodir_map_options['height'] = $geodir_map_options['height'] . 'px'; |
|
| 133 | - } |
|
| 134 | - |
|
| 135 | - if (strpos($geodir_map_options['width'], '%') !== false || strpos($geodir_map_options['width'], 'px') !== false) {
|
|
| 136 | - } else {
|
|
| 137 | - $geodir_map_options['width'] = $geodir_map_options['width'] . 'px'; |
|
| 138 | - } |
|
| 139 | - |
|
| 140 | - /** |
|
| 70 | + global $map_canvas_arr; |
|
| 71 | + $map_canvas_name = (!empty($map_args) && $map_args['map_canvas_name'] != '') ? $map_args['map_canvas_name'] : 'home_map_canvas'; |
|
| 72 | + $map_class_name = (!empty($map_args) && isset($map_args['map_class_name'])) ? $map_args['map_class_name'] : ''; |
|
| 73 | + |
|
| 74 | + $default_location = geodir_get_default_location(); |
|
| 75 | + |
|
| 76 | + $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
| 77 | + $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
| 78 | + $map_default_zoom = 12; |
|
| 79 | + // map options default values |
|
| 80 | + $width = 950; |
|
| 81 | + $height = 450; |
|
| 82 | + $child_collapse = '0'; |
|
| 83 | + $sticky = ''; |
|
| 84 | + $enable_cat_filters = false; |
|
| 85 | + $enable_text_search = false; |
|
| 86 | + $enable_post_type_filters = false; |
|
| 87 | + $enable_location_filters = false; |
|
| 88 | + $enable_jason_on_load = false; |
|
| 89 | + $enable_map_direction = false; |
|
| 90 | + $enable_marker_cluster = false; |
|
| 91 | + $enable_map_resize_button = false; |
|
| 92 | + $maptype = 'ROADMAP'; |
|
| 93 | + |
|
| 94 | + $geodir_map_options = array( |
|
| 95 | + 'width' => $width, |
|
| 96 | + 'height' => $height, |
|
| 97 | + 'child_collapse' => $child_collapse, |
|
| 98 | + 'sticky' => $sticky, |
|
| 99 | + 'enable_map_resize_button' => $enable_map_resize_button, |
|
| 100 | + 'enable_cat_filters' => $enable_cat_filters, |
|
| 101 | + 'enable_text_search' => $enable_text_search, |
|
| 102 | + 'enable_post_type_filters' => $enable_post_type_filters, |
|
| 103 | + 'enable_location_filters' => $enable_location_filters, |
|
| 104 | + 'enable_jason_on_load' => $enable_jason_on_load, |
|
| 105 | + 'enable_map_direction' => $enable_map_direction, |
|
| 106 | + 'enable_marker_cluster' => $enable_marker_cluster, |
|
| 107 | + 'ajax_url' => geodir_get_ajax_url(), |
|
| 108 | + 'map_canvas_name' => $map_canvas_name, |
|
| 109 | + 'inputText' => __('Title or Keyword', 'geodirectory'),
|
|
| 110 | + 'latitude' => $map_default_lat, |
|
| 111 | + 'longitude' => $map_default_lng, |
|
| 112 | + 'zoom' => $map_default_zoom, |
|
| 113 | + 'scrollwheel' => true, |
|
| 114 | + 'streetViewControl' => true, |
|
| 115 | + 'maptype' => $maptype, |
|
| 116 | + 'showPreview' => '0', |
|
| 117 | + 'maxZoom' => 21, |
|
| 118 | + 'autozoom' => true, |
|
| 119 | + 'bubble_size' => 'small', |
|
| 120 | + 'token' => '68f48005e256696074e1da9bf9f67f06', |
|
| 121 | + 'navigationControlOptions' => array('position' => 'TOP_LEFT', 'style' => 'ZOOM_PAN')
|
|
| 122 | + ); |
|
| 123 | + |
|
| 124 | + if (!empty($map_args)) {
|
|
| 125 | + foreach ($map_args as $map_option_key => $map_option_value) {
|
|
| 126 | + $geodir_map_options[$map_option_key] = $map_option_value; |
|
| 127 | + } |
|
| 128 | + } |
|
| 129 | + |
|
| 130 | + if (strpos($geodir_map_options['height'], '%') !== false || strpos($geodir_map_options['height'], 'px') !== false || strpos($geodir_map_options['height'], 'vh') !== false) {
|
|
| 131 | + } else {
|
|
| 132 | + $geodir_map_options['height'] = $geodir_map_options['height'] . 'px'; |
|
| 133 | + } |
|
| 134 | + |
|
| 135 | + if (strpos($geodir_map_options['width'], '%') !== false || strpos($geodir_map_options['width'], 'px') !== false) {
|
|
| 136 | + } else {
|
|
| 137 | + $geodir_map_options['width'] = $geodir_map_options['width'] . 'px'; |
|
| 138 | + } |
|
| 139 | + |
|
| 140 | + /** |
|
| 141 | 141 | * Filter the options to use in google map. |
| 142 | 142 | * |
| 143 | 143 | * @since 1.0.0 |
@@ -146,9 +146,9 @@ discard block |
||
| 146 | 146 | */ |
| 147 | 147 | $geodir_map_options = apply_filters("geodir_map_options_{$map_canvas_name}", $geodir_map_options);
|
| 148 | 148 | |
| 149 | - $map_canvas_arr[$map_canvas_name] = array(); |
|
| 149 | + $map_canvas_arr[$map_canvas_name] = array(); |
|
| 150 | 150 | |
| 151 | - /** |
|
| 151 | + /** |
|
| 152 | 152 | * Filter the post types to display data on map. |
| 153 | 153 | * |
| 154 | 154 | * @since 1.0.0 |
@@ -166,20 +166,20 @@ discard block |
||
| 166 | 166 | */ |
| 167 | 167 | $exclude_post_types = apply_filters("geodir_exclude_post_type_on_map_{$map_canvas_name}", get_option('geodir_exclude_post_type_on_map'));
|
| 168 | 168 | |
| 169 | - if (count((array)$post_types) != count($exclude_post_types) || ($enable_jason_on_load)): |
|
| 170 | - // Set default map options |
|
| 169 | + if (count((array)$post_types) != count($exclude_post_types) || ($enable_jason_on_load)): |
|
| 170 | + // Set default map options |
|
| 171 | 171 | |
| 172 | - wp_enqueue_script('geodir-map-widget', geodir_plugin_url() . '/geodirectory-functions/map-functions/js/map.min.js',array(),false,true);
|
|
| 172 | + wp_enqueue_script('geodir-map-widget', geodir_plugin_url() . '/geodirectory-functions/map-functions/js/map.min.js',array(),false,true);
|
|
| 173 | 173 | |
| 174 | - wp_localize_script('geodir-map-widget', $map_canvas_name, $geodir_map_options);
|
|
| 174 | + wp_localize_script('geodir-map-widget', $map_canvas_name, $geodir_map_options);
|
|
| 175 | 175 | |
| 176 | - if ($map_canvas_name == 'detail_page_map_canvas' || $map_canvas_name == 'preview_map_canvas') {
|
|
| 177 | - $map_width = '100%'; |
|
| 178 | - } else {
|
|
| 179 | - $map_width = $geodir_map_options['width']; |
|
| 180 | - } |
|
| 176 | + if ($map_canvas_name == 'detail_page_map_canvas' || $map_canvas_name == 'preview_map_canvas') {
|
|
| 177 | + $map_width = '100%'; |
|
| 178 | + } else {
|
|
| 179 | + $map_width = $geodir_map_options['width']; |
|
| 180 | + } |
|
| 181 | 181 | |
| 182 | - /** |
|
| 182 | + /** |
|
| 183 | 183 | * Filter the width of map. |
| 184 | 184 | * |
| 185 | 185 | * @since 1.0.0 |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | * @param int $map_width Width of map box, eg: gd_place. |
| 188 | 188 | */ |
| 189 | 189 | $map_width = apply_filters('geodir_change_map_width', $map_width);
|
| 190 | - ?> |
|
| 190 | + ?> |
|
| 191 | 191 | <div id="catcher_<?php echo $map_canvas_name;?>"></div> |
| 192 | 192 | <div class="stick_trigger_container"> |
| 193 | 193 | <div class="trigger_sticky triggeroff_sticky"></div> |
@@ -219,15 +219,15 @@ discard block |
||
| 219 | 219 | <?php if ($geodir_map_options['enable_jason_on_load']) { ?>
|
| 220 | 220 | <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="1"/> |
| 221 | 221 | <?php } else {
|
| 222 | - ?> |
|
| 222 | + ?> |
|
| 223 | 223 | <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="0"/> |
| 224 | 224 | <?php } |
| 225 | 225 | |
| 226 | - if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters']) |
|
| 227 | - $show_entire_cat_panel = "none"; |
|
| 228 | - else |
|
| 229 | - $show_entire_cat_panel = "''"; |
|
| 230 | - ?> |
|
| 226 | + if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters']) |
|
| 227 | + $show_entire_cat_panel = "none"; |
|
| 228 | + else |
|
| 229 | + $show_entire_cat_panel = "''"; |
|
| 230 | + ?> |
|
| 231 | 231 | |
| 232 | 232 | <?php if ($geodir_map_options['enable_map_direction']) { ?>
|
| 233 | 233 | |
@@ -278,8 +278,8 @@ discard block |
||
| 278 | 278 | <select id="travel-units" onchange="calcRoute('<?php echo $map_canvas_name; ?>')">
|
| 279 | 279 | <option value="miles"><?php _e('Miles', 'geodirectory'); ?></option>
|
| 280 | 280 | <option <?php if (get_option('geodir_search_dist_1') == 'km') {
|
| 281 | - echo 'selected="selected"'; |
|
| 282 | - } ?> value="kilometers"><?php _e('Kilometers', 'geodirectory'); ?></option>
|
|
| 281 | + echo 'selected="selected"'; |
|
| 282 | + } ?> value="kilometers"><?php _e('Kilometers', 'geodirectory'); ?></option>
|
|
| 283 | 283 | </select> |
| 284 | 284 | </div> |
| 285 | 285 | |
@@ -302,13 +302,13 @@ discard block |
||
| 302 | 302 | ?> |
| 303 | 303 | <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel;?>"> |
| 304 | 304 | <?php |
| 305 | - $exclude_post_types = get_option('geodir_exclude_post_type_on_map');
|
|
| 306 | - $geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types);
|
|
| 305 | + $exclude_post_types = get_option('geodir_exclude_post_type_on_map');
|
|
| 306 | + $geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types);
|
|
| 307 | 307 | $map_cat_class = ''; |
| 308 | 308 | if ($geodir_map_options['enable_post_type_filters']) {
|
| 309 | 309 | $map_cat_class = $geodir_available_pt_on_map > 1 ? ' map-cat-ptypes' : ' map-cat-floor'; |
| 310 | 310 | } |
| 311 | - ?> |
|
| 311 | + ?> |
|
| 312 | 312 | <div |
| 313 | 313 | class="map-category-listing<?php echo $map_cat_class;?>"> |
| 314 | 314 | <div class="trigger triggeroff"><i class="fa fa-compress"></i><i class="fa fa-expand"></i></div> |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | <?php if ($geodir_map_options['child_collapse']) { $child_collapse = "1"; ?>
|
| 327 | 327 | <input type="hidden" id="<?php echo $map_canvas_name; ?>_child_collapse" value="1"/> |
| 328 | 328 | <?php } else {$child_collapse = "0";
|
| 329 | - ?> |
|
| 329 | + ?> |
|
| 330 | 330 | <input type="hidden" id="<?php echo $map_canvas_name;?>_child_collapse" value="0"/> |
| 331 | 331 | <?php } ?> |
| 332 | 332 | <input type="hidden" id="<?php echo $map_canvas_name; ?>_cat_enabled" value="1"/> |
@@ -349,17 +349,17 @@ discard block |
||
| 349 | 349 | <!-- map-category-listings--> |
| 350 | 350 | |
| 351 | 351 | <?php |
| 352 | - if ($geodir_map_options['enable_location_filters']) {
|
|
| 352 | + if ($geodir_map_options['enable_location_filters']) {
|
|
| 353 | 353 | $country = get_query_var('gd_country');
|
| 354 | 354 | $region = get_query_var('gd_region');
|
| 355 | 355 | $city = get_query_var('gd_city');
|
| 356 | 356 | |
| 357 | - //fix for location/me page |
|
| 358 | - $country = $country != 'me' ? $country : ''; |
|
| 357 | + //fix for location/me page |
|
| 358 | + $country = $country != 'me' ? $country : ''; |
|
| 359 | 359 | $region = $region != 'me' ? $region : ''; |
| 360 | 360 | $city = $country != 'me' ? $city : ''; |
| 361 | - $gd_neighbourhood = isset($_REQUEST['gd_neighbourhood']) ? sanitize_text_field($_REQUEST['gd_neighbourhood']) : ''; |
|
| 362 | - ?> |
|
| 361 | + $gd_neighbourhood = isset($_REQUEST['gd_neighbourhood']) ? sanitize_text_field($_REQUEST['gd_neighbourhood']) : ''; |
|
| 362 | + ?> |
|
| 363 | 363 | <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="1"/> |
| 364 | 364 | <input type="hidden" id="<?php echo $map_canvas_name;?>_country" name="gd_country" |
| 365 | 365 | value="<?php echo $country;?>"/> |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | <input type="hidden" id="<?php echo $map_canvas_name;?>_neighbourhood" name="gd_neighbourhood" |
| 371 | 371 | value="<?php echo $gd_neighbourhood;?>"/> |
| 372 | 372 | <?php } else { //end of location filter
|
| 373 | - ?> |
|
| 373 | + ?> |
|
| 374 | 374 | <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="0"/> |
| 375 | 375 | <?php }?> |
| 376 | 376 | |
@@ -381,9 +381,9 @@ discard block |
||
| 381 | 381 | |
| 382 | 382 | |
| 383 | 383 | <?php if ($geodir_map_options['enable_post_type_filters']) {
|
| 384 | - $post_types = geodir_get_posttypes('object');
|
|
| 385 | - if (count((array)($post_types)) > 1) {
|
|
| 386 | - ?> |
|
| 384 | + $post_types = geodir_get_posttypes('object');
|
|
| 385 | + if (count((array)($post_types)) > 1) {
|
|
| 386 | + ?> |
|
| 387 | 387 | <div class="map-places-listing" id="<?php echo $map_canvas_name;?>_posttype_menu" |
| 388 | 388 | style="max-width:<?php echo $map_width;?>!important;"> |
| 389 | 389 | |
@@ -391,15 +391,15 @@ discard block |
||
| 391 | 391 | <div class="geodir-map-posttype-list"><?php } ?> |
| 392 | 392 | <ul class="clearfix place-list"> |
| 393 | 393 | <?php |
| 394 | - $exclude_post_types = get_option('geodir_exclude_post_type_on_map');
|
|
| 394 | + $exclude_post_types = get_option('geodir_exclude_post_type_on_map');
|
|
| 395 | 395 | |
| 396 | - foreach ($post_types as $post_type => $args) {
|
|
| 397 | - if (!in_array($post_type, $exclude_post_types)) {
|
|
| 398 | - $class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : ''; |
|
| 396 | + foreach ($post_types as $post_type => $args) {
|
|
| 397 | + if (!in_array($post_type, $exclude_post_types)) {
|
|
| 398 | + $class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : ''; |
|
| 399 | 399 | echo '<li id="' . $post_type . '" ' . $class . '><a href="javascript:void(0);" onclick="jQuery(\'#' . $map_canvas_name . '_posttype\').val(\'' . $post_type . '\');build_map_ajax_search_param(\'' . $map_canvas_name . '\', true)">' . __(ucfirst($args->labels->name), 'geodirectory') . '</a></li>'; |
| 400 | - } |
|
| 401 | - } |
|
| 402 | - ?> |
|
| 400 | + } |
|
| 401 | + } |
|
| 402 | + ?> |
|
| 403 | 403 | </ul> |
| 404 | 404 | <?php if (isset($geodir_map_options['is_geodir_home_map_widget']) && $map_args['is_geodir_home_map_widget']) { ?>
|
| 405 | 405 | </div><?php } ?> |
@@ -413,8 +413,8 @@ discard block |
||
| 413 | 413 | |
| 414 | 414 | </div> <!-- map-places-listings--> |
| 415 | 415 | <?php } |
| 416 | - } // end of post type filter if |
|
| 417 | - ?> |
|
| 416 | + } // end of post type filter if |
|
| 417 | + ?> |
|
| 418 | 418 | |
| 419 | 419 | </div> |
| 420 | 420 | </div> <!--end of stick trigger container--> |
@@ -429,8 +429,8 @@ discard block |
||
| 429 | 429 | </script> |
| 430 | 430 | <?php |
| 431 | 431 | |
| 432 | - if (strpos($geodir_map_options['height'], 'vh')) {
|
|
| 433 | - ?> |
|
| 432 | + if (strpos($geodir_map_options['height'], 'vh')) {
|
|
| 433 | + ?> |
|
| 434 | 434 | <script> |
| 435 | 435 | (function () {
|
| 436 | 436 | var screenH = jQuery(window).height(); |
@@ -452,8 +452,8 @@ discard block |
||
| 452 | 452 | |
| 453 | 453 | <?php |
| 454 | 454 | |
| 455 | - } elseif (strpos($geodir_map_options['height'], 'px')) {
|
|
| 456 | - ?> |
|
| 455 | + } elseif (strpos($geodir_map_options['height'], 'px')) {
|
|
| 456 | + ?> |
|
| 457 | 457 | <script> |
| 458 | 458 | (function () {
|
| 459 | 459 | var screenH = jQuery(window).height(); |
@@ -468,20 +468,20 @@ discard block |
||
| 468 | 468 | }()); |
| 469 | 469 | </script> |
| 470 | 470 | <?php |
| 471 | - } |
|
| 471 | + } |
|
| 472 | 472 | |
| 473 | - /** |
|
| 474 | - * Action that runs after all the map code has been output; |
|
| 475 | - * |
|
| 476 | - * @since 1.5.3 |
|
| 477 | - * |
|
| 478 | - * @param array $geodir_map_options Array of map settings. |
|
| 479 | - * @param string $map_canvas_name The canvas name and ID for the map. |
|
| 480 | - */ |
|
| 481 | - do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name);
|
|
| 473 | + /** |
|
| 474 | + * Action that runs after all the map code has been output; |
|
| 475 | + * |
|
| 476 | + * @since 1.5.3 |
|
| 477 | + * |
|
| 478 | + * @param array $geodir_map_options Array of map settings. |
|
| 479 | + * @param string $map_canvas_name The canvas name and ID for the map. |
|
| 480 | + */ |
|
| 481 | + do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name);
|
|
| 482 | 482 | |
| 483 | 483 | |
| 484 | - endif; // Exclude posttypes if end |
|
| 484 | + endif; // Exclude posttypes if end |
|
| 485 | 485 | } |
| 486 | 486 | |
| 487 | 487 | ?> |
| 488 | 488 | \ No newline at end of file |
@@ -129,12 +129,12 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | if (strpos($geodir_map_options['height'], '%') !== false || strpos($geodir_map_options['height'], 'px') !== false || strpos($geodir_map_options['height'], 'vh') !== false) {
|
| 131 | 131 | } else {
|
| 132 | - $geodir_map_options['height'] = $geodir_map_options['height'] . 'px'; |
|
| 132 | + $geodir_map_options['height'] = $geodir_map_options['height'].'px'; |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | if (strpos($geodir_map_options['width'], '%') !== false || strpos($geodir_map_options['width'], 'px') !== false) {
|
| 136 | 136 | } else {
|
| 137 | - $geodir_map_options['width'] = $geodir_map_options['width'] . 'px'; |
|
| 137 | + $geodir_map_options['width'] = $geodir_map_options['width'].'px'; |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | /** |
@@ -166,10 +166,10 @@ discard block |
||
| 166 | 166 | */ |
| 167 | 167 | $exclude_post_types = apply_filters("geodir_exclude_post_type_on_map_{$map_canvas_name}", get_option('geodir_exclude_post_type_on_map'));
|
| 168 | 168 | |
| 169 | - if (count((array)$post_types) != count($exclude_post_types) || ($enable_jason_on_load)): |
|
| 169 | + if (count((array) $post_types) != count($exclude_post_types) || ($enable_jason_on_load)): |
|
| 170 | 170 | // Set default map options |
| 171 | 171 | |
| 172 | - wp_enqueue_script('geodir-map-widget', geodir_plugin_url() . '/geodirectory-functions/map-functions/js/map.min.js',array(),false,true);
|
|
| 172 | + wp_enqueue_script('geodir-map-widget', geodir_plugin_url().'/geodirectory-functions/map-functions/js/map.min.js', array(), false, true);
|
|
| 173 | 173 | |
| 174 | 174 | wp_localize_script('geodir-map-widget', $map_canvas_name, $geodir_map_options);
|
| 175 | 175 | |
@@ -188,41 +188,41 @@ discard block |
||
| 188 | 188 | */ |
| 189 | 189 | $map_width = apply_filters('geodir_change_map_width', $map_width);
|
| 190 | 190 | ?> |
| 191 | - <div id="catcher_<?php echo $map_canvas_name;?>"></div> |
|
| 191 | + <div id="catcher_<?php echo $map_canvas_name; ?>"></div> |
|
| 192 | 192 | <div class="stick_trigger_container"> |
| 193 | 193 | <div class="trigger_sticky triggeroff_sticky"></div> |
| 194 | - <div class="top_banner_section geodir_map_container <?php echo $map_class_name;?>" |
|
| 195 | - id="sticky_map_<?php echo $map_canvas_name;?>" |
|
| 196 | - style="min-height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;"> |
|
| 194 | + <div class="top_banner_section geodir_map_container <?php echo $map_class_name; ?>" |
|
| 195 | + id="sticky_map_<?php echo $map_canvas_name; ?>" |
|
| 196 | + style="min-height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;"> |
|
| 197 | 197 | |
| 198 | 198 | <div class="map_background"> |
| 199 | 199 | <div class="top_banner_section_in clearfix"> |
| 200 | - <div class="<?php echo $map_canvas_name;?>_TopLeft TopLeft"><span class="triggermap" id="<?php echo $map_canvas_name;?>_triggermap" <?php if (!$geodir_map_options['enable_map_resize_button']) { ?> <?php }?>><i class="fa fa-arrows-alt"></i></span></div>
|
|
| 201 | - <div class="<?php echo $map_canvas_name;?>_TopRight TopRight"></div> |
|
| 202 | - <div id="<?php echo $map_canvas_name;?>_wrapper" class="main_map_wrapper" |
|
| 203 | - style="height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;"> |
|
| 200 | + <div class="<?php echo $map_canvas_name; ?>_TopLeft TopLeft"><span class="triggermap" id="<?php echo $map_canvas_name; ?>_triggermap" <?php if (!$geodir_map_options['enable_map_resize_button']) { ?> <?php }?>><i class="fa fa-arrows-alt"></i></span></div>
|
|
| 201 | + <div class="<?php echo $map_canvas_name; ?>_TopRight TopRight"></div> |
|
| 202 | + <div id="<?php echo $map_canvas_name; ?>_wrapper" class="main_map_wrapper" |
|
| 203 | + style="height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;"> |
|
| 204 | 204 | <!-- new map start --> |
| 205 | 205 | <div class="iprelative"> |
| 206 | - <div class="geodir_marker_cluster" id="<?php echo $map_canvas_name;?>" |
|
| 207 | - style="height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;"></div> |
|
| 208 | - <div id="<?php echo $map_canvas_name;?>_loading_div" class="loading_div" |
|
| 209 | - style=" height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;"></div> |
|
| 206 | + <div class="geodir_marker_cluster" id="<?php echo $map_canvas_name; ?>" |
|
| 207 | + style="height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;"></div> |
|
| 208 | + <div id="<?php echo $map_canvas_name; ?>_loading_div" class="loading_div" |
|
| 209 | + style=" height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;"></div> |
|
| 210 | 210 | <!--<div id="home_map_counter"></div> --> |
| 211 | - <div id="<?php echo $map_canvas_name;?>_map_nofound" |
|
| 211 | + <div id="<?php echo $map_canvas_name; ?>_map_nofound" |
|
| 212 | 212 | class="advmap_nofound"><?php echo MAP_NO_RESULTS; ?></div> |
| 213 | - <div id="<?php echo $map_canvas_name;?>_map_notloaded" |
|
| 213 | + <div id="<?php echo $map_canvas_name; ?>_map_notloaded" |
|
| 214 | 214 | class="advmap_notloaded"><?php _e('<h3>Google Map Not Loaded</h3><p>Sorry, unable to load Google Maps API.', 'geodirectory'); ?></div>
|
| 215 | 215 | </div> |
| 216 | 216 | <!-- new map end --> |
| 217 | 217 | </div> |
| 218 | - <div class="<?php echo $map_canvas_name;?>_BottomLeft BottomLeft"></div> |
|
| 218 | + <div class="<?php echo $map_canvas_name; ?>_BottomLeft BottomLeft"></div> |
|
| 219 | 219 | </div> |
| 220 | 220 | </div> |
| 221 | 221 | <?php if ($geodir_map_options['enable_jason_on_load']) { ?>
|
| 222 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="1"/> |
|
| 222 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_jason_enabled" value="1"/> |
|
| 223 | 223 | <?php } else {
|
| 224 | 224 | ?> |
| 225 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="0"/> |
|
| 225 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_jason_enabled" value="0"/> |
|
| 226 | 226 | <?php } |
| 227 | 227 | |
| 228 | 228 | if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters']) |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | onclick="calcRoute('<?php echo $map_canvas_name; ?>')"/>
|
| 243 | 243 | |
| 244 | 244 | <script> |
| 245 | - <?php if(geodir_is_page('detail')){?>
|
|
| 245 | + <?php if (geodir_is_page('detail')) {?>
|
|
| 246 | 246 | jQuery(function () {
|
| 247 | 247 | gd_initialize_ac(); |
| 248 | 248 | }); |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | // Create the autocomplete object, restricting the search |
| 254 | 254 | // to geographical location types. |
| 255 | 255 | autocomplete = new google.maps.places.Autocomplete( |
| 256 | - /** @type {HTMLInputElement} */(document.getElementById('<?php echo $map_canvas_name;?>_fromAddress')),
|
|
| 256 | + /** @type {HTMLInputElement} */(document.getElementById('<?php echo $map_canvas_name; ?>_fromAddress')),
|
|
| 257 | 257 | {types: ['geocode']});
|
| 258 | 258 | // When the user selects an address from the dropdown, |
| 259 | 259 | // populate the address fields in the form. |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | */ |
| 308 | 308 | $map_search_pt = apply_filters('geodir_default_map_search_pt', $geodir_default_map_search_pt);
|
| 309 | 309 | ?> |
| 310 | - <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel;?>"> |
|
| 310 | + <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel; ?>"> |
|
| 311 | 311 | <?php |
| 312 | 312 | $exclude_post_types = get_option('geodir_exclude_post_type_on_map');
|
| 313 | 313 | $geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types);
|
@@ -317,12 +317,12 @@ discard block |
||
| 317 | 317 | } |
| 318 | 318 | ?> |
| 319 | 319 | <div |
| 320 | - class="map-category-listing<?php echo $map_cat_class;?>"> |
|
| 320 | + class="map-category-listing<?php echo $map_cat_class; ?>"> |
|
| 321 | 321 | <div class="trigger triggeroff"><i class="fa fa-compress"></i><i class="fa fa-expand"></i></div> |
| 322 | - <div id="<?php echo $map_canvas_name;?>_cat" |
|
| 323 | - class="<?php echo $map_canvas_name;?>_map_category map_category" |
|
| 324 | - <?php if ($child_collapse){ ?>checked="checked" <?php }?>
|
|
| 325 | - style="max-height:<?php echo $geodir_map_options['height'];?>;"> |
|
| 322 | + <div id="<?php echo $map_canvas_name; ?>_cat" |
|
| 323 | + class="<?php echo $map_canvas_name; ?>_map_category map_category" |
|
| 324 | + <?php if ($child_collapse) { ?>checked="checked" <?php }?>
|
|
| 325 | + style="max-height:<?php echo $geodir_map_options['height']; ?>;"> |
|
| 326 | 326 | <input |
| 327 | 327 | onkeydown="if(event.keyCode == 13){build_map_ajax_search_param('<?php echo $map_canvas_name; ?>', false)}"
|
| 328 | 328 | type="text" |
@@ -334,11 +334,11 @@ discard block |
||
| 334 | 334 | <input type="hidden" id="<?php echo $map_canvas_name; ?>_child_collapse" value="1"/> |
| 335 | 335 | <?php } else {$child_collapse = "0";
|
| 336 | 336 | ?> |
| 337 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_child_collapse" value="0"/> |
|
| 337 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_child_collapse" value="0"/> |
|
| 338 | 338 | <?php } ?> |
| 339 | 339 | <input type="hidden" id="<?php echo $map_canvas_name; ?>_cat_enabled" value="1"/> |
| 340 | 340 | <div class="toggle"> |
| 341 | - <?php echo home_map_taxonomy_walker(array($map_search_pt.'category'),0,true,0,$map_canvas_name,$child_collapse,true); ?> |
|
| 341 | + <?php echo home_map_taxonomy_walker(array($map_search_pt.'category'), 0, true, 0, $map_canvas_name, $child_collapse, true); ?> |
|
| 342 | 342 | <script>jQuery( document ).ready(function() {
|
| 343 | 343 | geodir_show_sub_cat_collapse_button(); |
| 344 | 344 | });</script> |
@@ -367,21 +367,21 @@ discard block |
||
| 367 | 367 | $city = $country != 'me' ? $city : ''; |
| 368 | 368 | $gd_neighbourhood = isset($_REQUEST['gd_neighbourhood']) ? sanitize_text_field($_REQUEST['gd_neighbourhood']) : ''; |
| 369 | 369 | ?> |
| 370 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="1"/> |
|
| 371 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_country" name="gd_country" |
|
| 372 | - value="<?php echo $country;?>"/> |
|
| 373 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_region" name="gd_region" |
|
| 374 | - value="<?php echo $region;?>"/> |
|
| 375 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_city" name="gd_city" |
|
| 376 | - value="<?php echo $city;?>"/> |
|
| 377 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_neighbourhood" name="gd_neighbourhood" |
|
| 378 | - value="<?php echo $gd_neighbourhood;?>"/> |
|
| 370 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_location_enabled" value="1"/> |
|
| 371 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_country" name="gd_country" |
|
| 372 | + value="<?php echo $country; ?>"/> |
|
| 373 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_region" name="gd_region" |
|
| 374 | + value="<?php echo $region; ?>"/> |
|
| 375 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_city" name="gd_city" |
|
| 376 | + value="<?php echo $city; ?>"/> |
|
| 377 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_neighbourhood" name="gd_neighbourhood" |
|
| 378 | + value="<?php echo $gd_neighbourhood; ?>"/> |
|
| 379 | 379 | <?php } else { //end of location filter
|
| 380 | 380 | ?> |
| 381 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="0"/> |
|
| 381 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_location_enabled" value="0"/> |
|
| 382 | 382 | <?php }?> |
| 383 | 383 | |
| 384 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_posttype" name="gd_posttype" value="<?php echo $map_search_pt;?>"/> |
|
| 384 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_posttype" name="gd_posttype" value="<?php echo $map_search_pt; ?>"/> |
|
| 385 | 385 | |
| 386 | 386 | <input type="hidden" name="limitstart" value=""/> |
| 387 | 387 | |
@@ -389,10 +389,10 @@ discard block |
||
| 389 | 389 | |
| 390 | 390 | <?php if ($geodir_map_options['enable_post_type_filters']) {
|
| 391 | 391 | $post_types = geodir_get_posttypes('object');
|
| 392 | - if (count((array)($post_types)) > 1) {
|
|
| 392 | + if (count((array) ($post_types)) > 1) {
|
|
| 393 | 393 | ?> |
| 394 | - <div class="map-places-listing" id="<?php echo $map_canvas_name;?>_posttype_menu" |
|
| 395 | - style="max-width:<?php echo $map_width;?>!important;"> |
|
| 394 | + <div class="map-places-listing" id="<?php echo $map_canvas_name; ?>_posttype_menu" |
|
| 395 | + style="max-width:<?php echo $map_width; ?>!important;"> |
|
| 396 | 396 | |
| 397 | 397 | <?php if (isset($geodir_map_options['is_geodir_home_map_widget']) && $map_args['is_geodir_home_map_widget']) { ?>
|
| 398 | 398 | <div class="geodir-map-posttype-list"><?php } ?> |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | foreach ($post_types as $post_type => $args) {
|
| 404 | 404 | if (!in_array($post_type, $exclude_post_types)) {
|
| 405 | 405 | $class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : ''; |
| 406 | - echo '<li id="' . $post_type . '" ' . $class . '><a href="javascript:void(0);" onclick="jQuery(\'#' . $map_canvas_name . '_posttype\').val(\'' . $post_type . '\');build_map_ajax_search_param(\'' . $map_canvas_name . '\', true)">' . __(ucfirst($args->labels->name), 'geodirectory') . '</a></li>'; |
|
| 406 | + echo '<li id="'.$post_type.'" '.$class.'><a href="javascript:void(0);" onclick="jQuery(\'#'.$map_canvas_name.'_posttype\').val(\''.$post_type.'\');build_map_ajax_search_param(\''.$map_canvas_name.'\', true)">'.__(ucfirst($args->labels->name), 'geodirectory').'</a></li>'; |
|
| 407 | 407 | } |
| 408 | 408 | } |
| 409 | 409 | ?> |
@@ -428,9 +428,9 @@ discard block |
||
| 428 | 428 | <script type="text/javascript"> |
| 429 | 429 | |
| 430 | 430 | jQuery(document).ready(function () {
|
| 431 | - //initMap('<?php echo $map_canvas_name;?>'); // depreciated, no need to load this twice
|
|
| 432 | - build_map_ajax_search_param('<?php echo $map_canvas_name;?>', false);
|
|
| 433 | - map_sticky('<?php echo $map_canvas_name;?>');
|
|
| 431 | + //initMap('<?php echo $map_canvas_name; ?>'); // depreciated, no need to load this twice
|
|
| 432 | + build_map_ajax_search_param('<?php echo $map_canvas_name; ?>', false);
|
|
| 433 | + map_sticky('<?php echo $map_canvas_name; ?>');
|
|
| 434 | 434 | }); |
| 435 | 435 | |
| 436 | 436 | </script> |
@@ -441,18 +441,18 @@ discard block |
||
| 441 | 441 | <script> |
| 442 | 442 | (function () {
|
| 443 | 443 | var screenH = jQuery(window).height(); |
| 444 | - var heightVH = "<?php echo str_replace("vh", "", $geodir_map_options['height']);?>";
|
|
| 444 | + var heightVH = "<?php echo str_replace("vh", "", $geodir_map_options['height']); ?>";
|
|
| 445 | 445 | |
| 446 | 446 | var ptypeH = ''; |
| 447 | - if (jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").length) {
|
|
| 448 | - ptypeH = jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").outerHeight();
|
|
| 447 | + if (jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").length) {
|
|
| 448 | + ptypeH = jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").outerHeight();
|
|
| 449 | 449 | } |
| 450 | 450 | |
| 451 | - jQuery("#sticky_map_<?php echo $map_canvas_name;?>").css("min-height", screenH * (heightVH / 100) + 'px');
|
|
| 452 | - jQuery("#<?php echo $map_canvas_name;?>_wrapper").height(screenH * (heightVH / 100) + 'px');
|
|
| 453 | - jQuery("#<?php echo $map_canvas_name;?>").height(screenH * (heightVH / 100) + 'px');
|
|
| 454 | - jQuery("#<?php echo $map_canvas_name;?>_loading_div").height(screenH * (heightVH / 100) + 'px');
|
|
| 455 | - jQuery("#<?php echo $map_canvas_name;?>_cat").css("max-height", (screenH * (heightVH / 100)) - ptypeH + 'px');
|
|
| 451 | + jQuery("#sticky_map_<?php echo $map_canvas_name; ?>").css("min-height", screenH * (heightVH / 100) + 'px');
|
|
| 452 | + jQuery("#<?php echo $map_canvas_name; ?>_wrapper").height(screenH * (heightVH / 100) + 'px');
|
|
| 453 | + jQuery("#<?php echo $map_canvas_name; ?>").height(screenH * (heightVH / 100) + 'px');
|
|
| 454 | + jQuery("#<?php echo $map_canvas_name; ?>_loading_div").height(screenH * (heightVH / 100) + 'px');
|
|
| 455 | + jQuery("#<?php echo $map_canvas_name; ?>_cat").css("max-height", (screenH * (heightVH / 100)) - ptypeH + 'px');
|
|
| 456 | 456 | |
| 457 | 457 | }()); |
| 458 | 458 | </script> |
@@ -464,13 +464,13 @@ discard block |
||
| 464 | 464 | <script> |
| 465 | 465 | (function () {
|
| 466 | 466 | var screenH = jQuery(window).height(); |
| 467 | - var heightVH = "<?php echo str_replace("px", "", $geodir_map_options['height']);?>";
|
|
| 467 | + var heightVH = "<?php echo str_replace("px", "", $geodir_map_options['height']); ?>";
|
|
| 468 | 468 | var ptypeH = ''; |
| 469 | - if (jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").length) {
|
|
| 470 | - ptypeH = jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").outerHeight();
|
|
| 469 | + if (jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").length) {
|
|
| 470 | + ptypeH = jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").outerHeight();
|
|
| 471 | 471 | } |
| 472 | 472 | |
| 473 | - jQuery("#<?php echo $map_canvas_name;?>_cat").css("max-height", heightVH - ptypeH + 'px');
|
|
| 473 | + jQuery("#<?php echo $map_canvas_name; ?>_cat").css("max-height", heightVH - ptypeH + 'px');
|
|
| 474 | 474 | |
| 475 | 475 | }()); |
| 476 | 476 | </script> |
@@ -485,7 +485,7 @@ discard block |
||
| 485 | 485 | * @param array $geodir_map_options Array of map settings. |
| 486 | 486 | * @param string $map_canvas_name The canvas name and ID for the map. |
| 487 | 487 | */ |
| 488 | - do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name);
|
|
| 488 | + do_action('geodir_map_after_render', $geodir_map_options, $map_canvas_name);
|
|
| 489 | 489 | |
| 490 | 490 | |
| 491 | 491 | endif; // Exclude posttypes if end |
@@ -16,8 +16,9 @@ |
||
| 16 | 16 | * the visitor has not yet entered the password we will |
| 17 | 17 | * return early without loading the comments. |
| 18 | 18 | */ |
| 19 | -if (post_password_required()) |
|
| 20 | - return; |
|
| 19 | +if (post_password_required()) { |
|
| 20 | + return; |
|
| 21 | +} |
|
| 21 | 22 | ?> |
| 22 | 23 | |
| 23 | 24 | <div id="comments" class="comments-area"> |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | * return early without loading the comments. |
| 18 | 18 | */ |
| 19 | 19 | if (post_password_required()) |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | ?> |
| 22 | 22 | |
| 23 | 23 | <div id="comments" class="comments-area"> |
@@ -25,35 +25,35 @@ discard block |
||
| 25 | 25 | <?php // You can start editing here -- including this comment! ?> |
| 26 | 26 | |
| 27 | 27 | <?php |
| 28 | - /** |
|
| 29 | - * Called before displaying reviews. |
|
| 30 | - * |
|
| 31 | - * If you would like to wrap reviews inside a div this is the place to print your open div. @see geodir_before_review_form to print your closing div. |
|
| 32 | - * |
|
| 33 | - * @since 1.5.7 |
|
| 34 | - */ |
|
| 35 | - do_action('geodir_before_review_list'); ?>
|
|
| 28 | + /** |
|
| 29 | + * Called before displaying reviews. |
|
| 30 | + * |
|
| 31 | + * If you would like to wrap reviews inside a div this is the place to print your open div. @see geodir_before_review_form to print your closing div. |
|
| 32 | + * |
|
| 33 | + * @since 1.5.7 |
|
| 34 | + */ |
|
| 35 | + do_action('geodir_before_review_list'); ?>
|
|
| 36 | 36 | |
| 37 | 37 | <?php if (have_comments()) : ?> |
| 38 | 38 | <h2 class="comments-title"> |
| 39 | 39 | <?php |
| 40 | - printf(_n('1 Review <span class="r-title-on">on</span> <span class="r-title">“%2$s”</span>', '%1$s Reviews <span>on</span> <span class="r-title"> “%2$s”</span>', get_comments_number(), 'geodirectory'),
|
|
| 41 | - number_format_i18n(get_comments_number()), get_the_title()); |
|
| 42 | - ?> |
|
| 40 | + printf(_n('1 Review <span class="r-title-on">on</span> <span class="r-title">“%2$s”</span>', '%1$s Reviews <span>on</span> <span class="r-title"> “%2$s”</span>', get_comments_number(), 'geodirectory'),
|
|
| 41 | + number_format_i18n(get_comments_number()), get_the_title()); |
|
| 42 | + ?> |
|
| 43 | 43 | </h2> |
| 44 | 44 | |
| 45 | 45 | <?php |
| 46 | - /** |
|
| 47 | - * Called after displaying review listing title. |
|
| 48 | - * |
|
| 49 | - * @since 1.5.7 |
|
| 50 | - */ |
|
| 51 | - do_action('geodir_after_review_list_title'); ?>
|
|
| 46 | + /** |
|
| 47 | + * Called after displaying review listing title. |
|
| 48 | + * |
|
| 49 | + * @since 1.5.7 |
|
| 50 | + */ |
|
| 51 | + do_action('geodir_after_review_list_title'); ?>
|
|
| 52 | 52 | |
| 53 | 53 | <ol class="commentlist"> |
| 54 | 54 | <?php $reverse_top_level = is_plugin_active('geodir_review_rating_manager/geodir_review_rating_manager.php') ? false : null; ?>
|
| 55 | 55 | <?php wp_list_comments(array('callback' => 'geodir_comment', 'reverse_top_level' => $reverse_top_level, 'style' => 'ol'));
|
| 56 | - ?> |
|
| 56 | + ?> |
|
| 57 | 57 | </ol><!-- .commentlist --> |
| 58 | 58 | |
| 59 | 59 | <?php if (get_comment_pages_count() > 1 && get_option('page_comments')) : // are there comments to navigate through ?>
|
@@ -68,51 +68,51 @@ discard block |
||
| 68 | 68 | <?php endif; // check for comment navigation ?> |
| 69 | 69 | |
| 70 | 70 | <?php |
| 71 | - /* If there are no comments and comments are closed, let's leave a note. |
|
| 71 | + /* If there are no comments and comments are closed, let's leave a note. |
|
| 72 | 72 | * But we only want the note on posts and pages that had comments in the first place. |
| 73 | 73 | */ |
| 74 | - if (!comments_open() && get_comments_number()) : ?> |
|
| 74 | + if (!comments_open() && get_comments_number()) : ?> |
|
| 75 | 75 | <p class="nocomments"><?php _e('Reviews are closed.', 'geodirectory'); ?></p>
|
| 76 | 76 | <?php endif; ?> |
| 77 | 77 | |
| 78 | 78 | <?php endif; // have_comments() ?> |
| 79 | 79 | |
| 80 | 80 | <?php |
| 81 | - /** |
|
| 82 | - * Called before displaying "Leave a review form". |
|
| 83 | - * |
|
| 84 | - * If you would like to wrap "review form" inside a div this is the best place to hook your open div. @see geodir_after_review_form to print your closing div. |
|
| 85 | - * Also If you would like to wrap "reviews" inside a div this is the best place to print your closing div. @see geodir_before_review_list to print your open div. |
|
| 86 | - * |
|
| 87 | - * @since 1.5.7 |
|
| 88 | - */ |
|
| 89 | - do_action('geodir_before_review_form'); ?>
|
|
| 81 | + /** |
|
| 82 | + * Called before displaying "Leave a review form". |
|
| 83 | + * |
|
| 84 | + * If you would like to wrap "review form" inside a div this is the best place to hook your open div. @see geodir_after_review_form to print your closing div. |
|
| 85 | + * Also If you would like to wrap "reviews" inside a div this is the best place to print your closing div. @see geodir_before_review_list to print your open div. |
|
| 86 | + * |
|
| 87 | + * @since 1.5.7 |
|
| 88 | + */ |
|
| 89 | + do_action('geodir_before_review_form'); ?>
|
|
| 90 | 90 | |
| 91 | 91 | <?php |
| 92 | - /** |
|
| 93 | - * Filters comment form args |
|
| 94 | - * |
|
| 95 | - * If you would like to modify your comment form args, use this filter. @see https://codex.wordpress.org/Function_Reference/comment_form for accepted args. |
|
| 96 | - * |
|
| 97 | - * @since 1.0.0 |
|
| 98 | - */ |
|
| 99 | - $args = apply_filters('geodir_review_form_args', array(
|
|
| 100 | - 'title_reply' => __('Leave a Review', 'geodirectory'),
|
|
| 101 | - 'label_submit' => __('Post Review', 'geodirectory'),
|
|
| 102 | - 'comment_field' => '<p class="comment-form-comment"><label for="comment">' . __('Review text', 'geodirectory') . '</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>',
|
|
| 103 | - 'must_log_in' => '<p class="must-log-in">' . sprintf(__('You must be <a href="%s">logged in</a> to post a comment.', 'geodirectory'), geodir_login_url()) . '</p>'
|
|
| 104 | - )); |
|
| 105 | - comment_form($args); |
|
| 106 | - ?> |
|
| 92 | + /** |
|
| 93 | + * Filters comment form args |
|
| 94 | + * |
|
| 95 | + * If you would like to modify your comment form args, use this filter. @see https://codex.wordpress.org/Function_Reference/comment_form for accepted args. |
|
| 96 | + * |
|
| 97 | + * @since 1.0.0 |
|
| 98 | + */ |
|
| 99 | + $args = apply_filters('geodir_review_form_args', array(
|
|
| 100 | + 'title_reply' => __('Leave a Review', 'geodirectory'),
|
|
| 101 | + 'label_submit' => __('Post Review', 'geodirectory'),
|
|
| 102 | + 'comment_field' => '<p class="comment-form-comment"><label for="comment">' . __('Review text', 'geodirectory') . '</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>',
|
|
| 103 | + 'must_log_in' => '<p class="must-log-in">' . sprintf(__('You must be <a href="%s">logged in</a> to post a comment.', 'geodirectory'), geodir_login_url()) . '</p>'
|
|
| 104 | + )); |
|
| 105 | + comment_form($args); |
|
| 106 | + ?> |
|
| 107 | 107 | |
| 108 | 108 | <?php |
| 109 | - /** |
|
| 110 | - * Called after displaying "Leave a review form". |
|
| 111 | - * |
|
| 112 | - * If you would like to wrap "review form" inside a div this is the best place to print your closing div. @see geodir_before_review_form to print your open div. |
|
| 113 | - * |
|
| 114 | - * @since 1.5.7 |
|
| 115 | - */ |
|
| 116 | - do_action('geodir_after_review_form'); ?>
|
|
| 109 | + /** |
|
| 110 | + * Called after displaying "Leave a review form". |
|
| 111 | + * |
|
| 112 | + * If you would like to wrap "review form" inside a div this is the best place to print your closing div. @see geodir_before_review_form to print your open div. |
|
| 113 | + * |
|
| 114 | + * @since 1.5.7 |
|
| 115 | + */ |
|
| 116 | + do_action('geodir_after_review_form'); ?>
|
|
| 117 | 117 | |
| 118 | 118 | </div><!-- #comments .comments-area --> |
| 119 | 119 | \ No newline at end of file |
@@ -99,8 +99,8 @@ |
||
| 99 | 99 | $args = apply_filters('geodir_review_form_args', array(
|
| 100 | 100 | 'title_reply' => __('Leave a Review', 'geodirectory'),
|
| 101 | 101 | 'label_submit' => __('Post Review', 'geodirectory'),
|
| 102 | - 'comment_field' => '<p class="comment-form-comment"><label for="comment">' . __('Review text', 'geodirectory') . '</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>',
|
|
| 103 | - 'must_log_in' => '<p class="must-log-in">' . sprintf(__('You must be <a href="%s">logged in</a> to post a comment.', 'geodirectory'), geodir_login_url()) . '</p>'
|
|
| 102 | + 'comment_field' => '<p class="comment-form-comment"><label for="comment">'.__('Review text', 'geodirectory').'</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>',
|
|
| 103 | + 'must_log_in' => '<p class="must-log-in">'.sprintf(__('You must be <a href="%s">logged in</a> to post a comment.', 'geodirectory'), geodir_login_url()).'</p>'
|
|
| 104 | 104 | )); |
| 105 | 105 | comment_form($args); |
| 106 | 106 | ?> |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | // Exit if accessed directly |
| 14 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
| 14 | +if (!defined('ABSPATH')) exit; |
|
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * Return the current cache expire setting. |
@@ -36,10 +36,10 @@ discard block |
||
| 36 | 36 | * |
| 37 | 37 | * @param string $data |
| 38 | 38 | */ |
| 39 | -function wp_session_decode( $data ) { |
|
| 39 | +function wp_session_decode($data) { |
|
| 40 | 40 | $wp_session = WP_Session::get_instance(); |
| 41 | 41 | |
| 42 | - return $wp_session->json_in( $data ); |
|
| 42 | + return $wp_session->json_in($data); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
@@ -60,10 +60,10 @@ discard block |
||
| 60 | 60 | * |
| 61 | 61 | * @return bool |
| 62 | 62 | */ |
| 63 | -function wp_session_regenerate_id( $delete_old_session = false ) { |
|
| 63 | +function wp_session_regenerate_id($delete_old_session = false) { |
|
| 64 | 64 | $wp_session = WP_Session::get_instance(); |
| 65 | 65 | |
| 66 | - $wp_session->regenerate_id( $delete_old_session ); |
|
| 66 | + $wp_session->regenerate_id($delete_old_session); |
|
| 67 | 67 | |
| 68 | 68 | return true; |
| 69 | 69 | } |
@@ -77,11 +77,11 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | function wp_session_start() { |
| 79 | 79 | $wp_session = WP_Session::get_instance(); |
| 80 | - do_action( 'wp_session_start' ); |
|
| 80 | + do_action('wp_session_start'); |
|
| 81 | 81 | |
| 82 | 82 | return $wp_session->session_started(); |
| 83 | 83 | } |
| 84 | -add_action( 'plugins_loaded', 'wp_session_start' ); |
|
| 84 | +add_action('plugins_loaded', 'wp_session_start'); |
|
| 85 | 85 | |
| 86 | 86 | /** |
| 87 | 87 | * Return the current session status. |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | function wp_session_status() { |
| 92 | 92 | $wp_session = WP_Session::get_instance(); |
| 93 | 93 | |
| 94 | - if ( $wp_session->session_started() ) { |
|
| 94 | + if ($wp_session->session_started()) { |
|
| 95 | 95 | return PHP_SESSION_ACTIVE; |
| 96 | 96 | } |
| 97 | 97 | |
@@ -114,9 +114,9 @@ discard block |
||
| 114 | 114 | $wp_session = WP_Session::get_instance(); |
| 115 | 115 | |
| 116 | 116 | $wp_session->write_data(); |
| 117 | - do_action( 'wp_session_commit' ); |
|
| 117 | + do_action('wp_session_commit'); |
|
| 118 | 118 | } |
| 119 | -add_action( 'shutdown', 'wp_session_write_close' ); |
|
| 119 | +add_action('shutdown', 'wp_session_write_close'); |
|
| 120 | 120 | |
| 121 | 121 | /** |
| 122 | 122 | * Clean up expired sessions by removing data and their expiration entries from |
@@ -128,51 +128,51 @@ discard block |
||
| 128 | 128 | function wp_session_cleanup() { |
| 129 | 129 | global $wpdb; |
| 130 | 130 | |
| 131 | - if ( defined( 'WP_SETUP_CONFIG' ) ) { |
|
| 131 | + if (defined('WP_SETUP_CONFIG')) { |
|
| 132 | 132 | return; |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - if ( ! defined( 'WP_INSTALLING' ) ) { |
|
| 136 | - $expiration_keys = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options WHERE option_name LIKE '_wp_session_expires_%'" ); |
|
| 135 | + if (!defined('WP_INSTALLING')) { |
|
| 136 | + $expiration_keys = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options WHERE option_name LIKE '_wp_session_expires_%'"); |
|
| 137 | 137 | |
| 138 | - $now = current_time( 'timestamp' ); |
|
| 138 | + $now = current_time('timestamp'); |
|
| 139 | 139 | $expired_sessions = array(); |
| 140 | 140 | |
| 141 | - foreach( $expiration_keys as $expiration ) { |
|
| 141 | + foreach ($expiration_keys as $expiration) { |
|
| 142 | 142 | |
| 143 | 143 | // If the session has expired |
| 144 | - if ( $now > intval( $expiration->option_value ) ) { |
|
| 144 | + if ($now > intval($expiration->option_value)) { |
|
| 145 | 145 | |
| 146 | 146 | // Get the session ID by parsing the option_name |
| 147 | - $session_id = substr( $expiration->option_name, 20 ); |
|
| 147 | + $session_id = substr($expiration->option_name, 20); |
|
| 148 | 148 | |
| 149 | - if( (int) -1 === (int) $session_id || ! preg_match( '/^[a-f0-9]{32}$/', $session_id ) ) { |
|
| 149 | + if ((int) -1 === (int) $session_id || !preg_match('/^[a-f0-9]{32}$/', $session_id)) { |
|
| 150 | 150 | continue; |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | $expired_sessions[] = $expiration->option_name; |
| 154 | - $expired_sessions[] = esc_sql( "_wp_session_$session_id" ); |
|
| 154 | + $expired_sessions[] = esc_sql("_wp_session_$session_id"); |
|
| 155 | 155 | } |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | // Delete all expired sessions in a single query |
| 159 | - if ( ! empty( $expired_sessions ) ) { |
|
| 160 | - $option_names = implode( "','", $expired_sessions ); |
|
| 161 | - $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name IN ('$option_names')" ); |
|
| 159 | + if (!empty($expired_sessions)) { |
|
| 160 | + $option_names = implode("','", $expired_sessions); |
|
| 161 | + $wpdb->query("DELETE FROM $wpdb->options WHERE option_name IN ('$option_names')"); |
|
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | // Allow other plugins to hook in to the garbage collection process. |
| 166 | - do_action( 'wp_session_cleanup' ); |
|
| 166 | + do_action('wp_session_cleanup'); |
|
| 167 | 167 | } |
| 168 | -add_action( 'wp_session_garbage_collection', 'wp_session_cleanup' ); |
|
| 168 | +add_action('wp_session_garbage_collection', 'wp_session_cleanup'); |
|
| 169 | 169 | |
| 170 | 170 | /** |
| 171 | 171 | * Register the garbage collector as a twice daily event. |
| 172 | 172 | */ |
| 173 | 173 | function wp_session_register_garbage_collection() { |
| 174 | - if ( ! wp_next_scheduled( 'wp_session_garbage_collection' ) ) { |
|
| 175 | - wp_schedule_event( current_time( 'timestamp' ), 'twicedaily', 'wp_session_garbage_collection' ); |
|
| 174 | + if (!wp_next_scheduled('wp_session_garbage_collection')) { |
|
| 175 | + wp_schedule_event(current_time('timestamp'), 'twicedaily', 'wp_session_garbage_collection'); |
|
| 176 | 176 | } |
| 177 | 177 | } |
| 178 | -add_action( 'wp', 'wp_session_register_garbage_collection' ); |
|
| 178 | +add_action('wp', 'wp_session_register_garbage_collection'); |
|
@@ -11,7 +11,9 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | // Exit if accessed directly |
| 14 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
| 14 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 15 | + exit; |
|
| 16 | +} |
|
| 15 | 17 | |
| 16 | 18 | /** |
| 17 | 19 | * Return the current cache expire setting. |
@@ -50,16 +50,19 @@ |
||
| 50 | 50 | <?php |
| 51 | 51 | |
| 52 | 52 | $default_search_for_text = SEARCH_FOR_TEXT; |
| 53 | - if (get_option('geodir_search_field_default_text'))
|
|
| 54 | - $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
|
|
| 53 | + if (get_option('geodir_search_field_default_text')) { |
|
| 54 | + $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory'); |
|
| 55 | + } |
|
| 55 | 56 | |
| 56 | 57 | $default_near_text = NEAR_TEXT; |
| 57 | - if (get_option('geodir_near_field_default_text'))
|
|
| 58 | - $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
|
|
| 58 | + if (get_option('geodir_near_field_default_text')) { |
|
| 59 | + $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory'); |
|
| 60 | + } |
|
| 59 | 61 | |
| 60 | 62 | $default_search_button_label = __('Search', 'geodirectory');
|
| 61 | - if (get_option('geodir_search_button_label'))
|
|
| 62 | - $default_search_button_label = __(get_option('geodir_search_button_label'), 'geodirectory');
|
|
| 63 | + if (get_option('geodir_search_button_label')) { |
|
| 64 | + $default_search_button_label = __(get_option('geodir_search_button_label'), 'geodirectory'); |
|
| 65 | + } |
|
| 63 | 66 | |
| 64 | 67 | $post_types = geodir_get_posttypes('object');
|
| 65 | 68 | |
@@ -14,11 +14,11 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | $curr_post_type = geodir_get_current_posttype(); |
| 16 | 16 | if (function_exists('geodir_location_geo_home_link')) {
|
| 17 | - remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
|
|
| 17 | + remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
|
|
| 18 | 18 | } |
| 19 | 19 | $search_url = trailingslashit(get_home_url()); |
| 20 | 20 | if (function_exists('geodir_location_geo_home_link')) {
|
| 21 | - add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
|
|
| 21 | + add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
|
|
| 22 | 22 | } |
| 23 | 23 | ?> |
| 24 | 24 | |
@@ -37,104 +37,104 @@ discard block |
||
| 37 | 37 | <div class="geodir-loc-bar"> |
| 38 | 38 | |
| 39 | 39 | <?php |
| 40 | - /** |
|
| 41 | - * Called inside the search form but before any of the fields. |
|
| 42 | - * |
|
| 43 | - * @since 1.0.0 |
|
| 44 | - */ |
|
| 45 | - do_action('geodir_before_search_form') ?>
|
|
| 40 | + /** |
|
| 41 | + * Called inside the search form but before any of the fields. |
|
| 42 | + * |
|
| 43 | + * @since 1.0.0 |
|
| 44 | + */ |
|
| 45 | + do_action('geodir_before_search_form') ?>
|
|
| 46 | 46 | |
| 47 | 47 | <div class="clearfix geodir-loc-bar-in"> |
| 48 | 48 | <div class="geodir-search"> |
| 49 | 49 | |
| 50 | 50 | <?php |
| 51 | 51 | |
| 52 | - $default_search_for_text = SEARCH_FOR_TEXT; |
|
| 53 | - if (get_option('geodir_search_field_default_text'))
|
|
| 54 | - $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
|
|
| 52 | + $default_search_for_text = SEARCH_FOR_TEXT; |
|
| 53 | + if (get_option('geodir_search_field_default_text'))
|
|
| 54 | + $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
|
|
| 55 | 55 | |
| 56 | - $default_near_text = NEAR_TEXT; |
|
| 57 | - if (get_option('geodir_near_field_default_text'))
|
|
| 58 | - $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
|
|
| 56 | + $default_near_text = NEAR_TEXT; |
|
| 57 | + if (get_option('geodir_near_field_default_text'))
|
|
| 58 | + $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
|
|
| 59 | 59 | |
| 60 | - $default_search_button_label = __('Search', 'geodirectory');
|
|
| 61 | - if (get_option('geodir_search_button_label'))
|
|
| 62 | - $default_search_button_label = __(get_option('geodir_search_button_label'), 'geodirectory');
|
|
| 60 | + $default_search_button_label = __('Search', 'geodirectory');
|
|
| 61 | + if (get_option('geodir_search_button_label'))
|
|
| 62 | + $default_search_button_label = __(get_option('geodir_search_button_label'), 'geodirectory');
|
|
| 63 | 63 | |
| 64 | - $post_types = geodir_get_posttypes('object');
|
|
| 64 | + $post_types = geodir_get_posttypes('object');
|
|
| 65 | 65 | |
| 66 | - if (!empty($post_types) && count((array)$post_types) > 1): |
|
| 67 | - ?> |
|
| 66 | + if (!empty($post_types) && count((array)$post_types) > 1): |
|
| 67 | + ?> |
|
| 68 | 68 | <select name="stype" class="search_by_post"> |
| 69 | 69 | <?php foreach ($post_types as $post_type => $info): |
| 70 | - global $wpdb; |
|
| 71 | - $has_posts = ''; |
|
| 72 | - $has_posts = $wpdb->get_row($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type));
|
|
| 73 | - if (!$has_posts) {
|
|
| 74 | - continue; |
|
| 75 | - } |
|
| 76 | - ?> |
|
| 70 | + global $wpdb; |
|
| 71 | + $has_posts = ''; |
|
| 72 | + $has_posts = $wpdb->get_row($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type));
|
|
| 73 | + if (!$has_posts) {
|
|
| 74 | + continue; |
|
| 75 | + } |
|
| 76 | + ?> |
|
| 77 | 77 | |
| 78 | 78 | <option data-label="<?php echo get_post_type_archive_link($post_type);?>" |
| 79 | 79 | value="<?php echo $post_type;?>" <?php if (isset($_REQUEST['stype'])) {
|
| 80 | - if ($post_type == $_REQUEST['stype']) {
|
|
| 81 | - echo 'selected="selected"'; |
|
| 82 | - } |
|
| 83 | - } elseif ($curr_post_type == $post_type) {
|
|
| 84 | - echo 'selected="selected"'; |
|
| 85 | - }?>><?php _e(ucfirst($info->labels->name), 'geodirectory');?></option> |
|
| 80 | + if ($post_type == $_REQUEST['stype']) {
|
|
| 81 | + echo 'selected="selected"'; |
|
| 82 | + } |
|
| 83 | + } elseif ($curr_post_type == $post_type) {
|
|
| 84 | + echo 'selected="selected"'; |
|
| 85 | + }?>><?php _e(ucfirst($info->labels->name), 'geodirectory');?></option> |
|
| 86 | 86 | |
| 87 | 87 | <?php endforeach; ?> |
| 88 | 88 | </select> |
| 89 | 89 | <?php elseif (!empty($post_types)): |
| 90 | - echo '<input type="hidden" name="stype" value="' . key($post_types) . '" />'; |
|
| 91 | - endif; ?> |
|
| 90 | + echo '<input type="hidden" name="stype" value="' . key($post_types) . '" />'; |
|
| 91 | + endif; ?> |
|
| 92 | 92 | |
| 93 | 93 | <input class="search_text" name="s" |
| 94 | 94 | value="<?php if (isset($_REQUEST['s']) && trim($_REQUEST['s']) != '') {
|
| 95 | - echo esc_attr(stripslashes_deep($_REQUEST['s'])); |
|
| 96 | - } else {
|
|
| 97 | - echo $default_search_for_text; |
|
| 98 | - } ?>" type="text" |
|
| 95 | + echo esc_attr(stripslashes_deep($_REQUEST['s'])); |
|
| 96 | + } else {
|
|
| 97 | + echo $default_search_for_text; |
|
| 98 | + } ?>" type="text" |
|
| 99 | 99 | onblur="if (this.value.trim() == '') {this.value = '<?php echo $default_search_for_text; ?>';}"
|
| 100 | 100 | onfocus="if (this.value == '<?php echo $default_search_for_text; ?>') {this.value = '';}"
|
| 101 | 101 | onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);"> |
| 102 | 102 | |
| 103 | 103 | |
| 104 | 104 | <?php |
| 105 | - if (isset($_REQUEST['snear']) && $_REQUEST['snear'] != '') {
|
|
| 106 | - $near = esc_attr(stripslashes_deep($_REQUEST['snear'])); |
|
| 107 | - } else {
|
|
| 108 | - $near = $default_near_text; |
|
| 109 | - } |
|
| 110 | - /** |
|
| 111 | - * Filter the "Near" text value for the search form. |
|
| 112 | - * |
|
| 113 | - * This is the input "value" attribute and can change depending on what the user searches and is not always the default value. |
|
| 114 | - * |
|
| 115 | - * @since 1.0.0 |
|
| 116 | - * @param string $near The current near value. |
|
| 117 | - * @param string $default_near_text The default near value. |
|
| 118 | - */ |
|
| 119 | - $near = apply_filters('geodir_search_near_text', $near, $default_near_text);
|
|
| 120 | - /** |
|
| 121 | - * Filter the default "Near" text value for the search form. |
|
| 122 | - * |
|
| 123 | - * This is the default value if nothing has been searched. |
|
| 124 | - * |
|
| 125 | - * @since 1.0.0 |
|
| 126 | - * @param string $near The current near value. |
|
| 127 | - * @param string $default_near_text The default near value. |
|
| 128 | - */ |
|
| 129 | - $default_near_text = apply_filters('geodir_search_default_near_text', $default_near_text, $near);
|
|
| 130 | - /** |
|
| 131 | - * Filter the class for the near search input. |
|
| 132 | - * |
|
| 133 | - * @since 1.0.0 |
|
| 134 | - * @param string $class The class for the HTML near input, default is blank. |
|
| 135 | - */ |
|
| 136 | - $near_class = apply_filters('geodir_search_near_class', '');
|
|
| 137 | - ?> |
|
| 105 | + if (isset($_REQUEST['snear']) && $_REQUEST['snear'] != '') {
|
|
| 106 | + $near = esc_attr(stripslashes_deep($_REQUEST['snear'])); |
|
| 107 | + } else {
|
|
| 108 | + $near = $default_near_text; |
|
| 109 | + } |
|
| 110 | + /** |
|
| 111 | + * Filter the "Near" text value for the search form. |
|
| 112 | + * |
|
| 113 | + * This is the input "value" attribute and can change depending on what the user searches and is not always the default value. |
|
| 114 | + * |
|
| 115 | + * @since 1.0.0 |
|
| 116 | + * @param string $near The current near value. |
|
| 117 | + * @param string $default_near_text The default near value. |
|
| 118 | + */ |
|
| 119 | + $near = apply_filters('geodir_search_near_text', $near, $default_near_text);
|
|
| 120 | + /** |
|
| 121 | + * Filter the default "Near" text value for the search form. |
|
| 122 | + * |
|
| 123 | + * This is the default value if nothing has been searched. |
|
| 124 | + * |
|
| 125 | + * @since 1.0.0 |
|
| 126 | + * @param string $near The current near value. |
|
| 127 | + * @param string $default_near_text The default near value. |
|
| 128 | + */ |
|
| 129 | + $default_near_text = apply_filters('geodir_search_default_near_text', $default_near_text, $near);
|
|
| 130 | + /** |
|
| 131 | + * Filter the class for the near search input. |
|
| 132 | + * |
|
| 133 | + * @since 1.0.0 |
|
| 134 | + * @param string $class The class for the HTML near input, default is blank. |
|
| 135 | + */ |
|
| 136 | + $near_class = apply_filters('geodir_search_near_class', '');
|
|
| 137 | + ?> |
|
| 138 | 138 | |
| 139 | 139 | <input name="snear" class="snear <?php echo $near_class; ?>" type="text" value="<?php echo $near; ?>" |
| 140 | 140 | onblur="if (this.value.trim() == '') {this.value = ('<?php echo $near; ?>' != '' ? '<?php echo $near; ?>' : '<?php echo $default_near_text; ?>');}"
|
@@ -142,42 +142,42 @@ discard block |
||
| 142 | 142 | onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);"/> |
| 143 | 143 | |
| 144 | 144 | <?php |
| 145 | - /** |
|
| 146 | - * Called on the GD search form just before the search button. |
|
| 147 | - * |
|
| 148 | - * @since 1.0.0 |
|
| 149 | - */ |
|
| 150 | - do_action('geodir_before_search_button');
|
|
| 151 | - |
|
| 152 | - /** |
|
| 153 | - * Filter the default search button text value for the search form. |
|
| 154 | - * |
|
| 155 | - * This text can be changed via an option in settings, this is a last resort. |
|
| 156 | - * |
|
| 157 | - * @since 1.5.5 |
|
| 158 | - * @param string $default_search_button_label The current search button text. |
|
| 159 | - */ |
|
| 160 | - $default_search_button_label = apply_filters('geodir_search_default_search_button_text', $default_search_button_label);?>
|
|
| 145 | + /** |
|
| 146 | + * Called on the GD search form just before the search button. |
|
| 147 | + * |
|
| 148 | + * @since 1.0.0 |
|
| 149 | + */ |
|
| 150 | + do_action('geodir_before_search_button');
|
|
| 151 | + |
|
| 152 | + /** |
|
| 153 | + * Filter the default search button text value for the search form. |
|
| 154 | + * |
|
| 155 | + * This text can be changed via an option in settings, this is a last resort. |
|
| 156 | + * |
|
| 157 | + * @since 1.5.5 |
|
| 158 | + * @param string $default_search_button_label The current search button text. |
|
| 159 | + */ |
|
| 160 | + $default_search_button_label = apply_filters('geodir_search_default_search_button_text', $default_search_button_label);?>
|
|
| 161 | 161 | <input type="button" value="<?php esc_attr_e($default_search_button_label); ?>" class="geodir_submit_search" /> |
| 162 | 162 | <?php |
| 163 | - /** |
|
| 164 | - * Called on the GD search form just after the search button. |
|
| 165 | - * |
|
| 166 | - * @since 1.0.0 |
|
| 167 | - */ |
|
| 168 | - do_action('geodir_after_search_button'); ?>
|
|
| 163 | + /** |
|
| 164 | + * Called on the GD search form just after the search button. |
|
| 165 | + * |
|
| 166 | + * @since 1.0.0 |
|
| 167 | + */ |
|
| 168 | + do_action('geodir_after_search_button'); ?>
|
|
| 169 | 169 | </div> |
| 170 | 170 | |
| 171 | 171 | |
| 172 | 172 | </div> |
| 173 | 173 | |
| 174 | 174 | <?php |
| 175 | - /** |
|
| 176 | - * Called inside the search form but after all the input fields. |
|
| 177 | - * |
|
| 178 | - * @since 1.0.0 |
|
| 179 | - */ |
|
| 180 | - do_action('geodir_after_search_form') ?>
|
|
| 175 | + /** |
|
| 176 | + * Called inside the search form but after all the input fields. |
|
| 177 | + * |
|
| 178 | + * @since 1.0.0 |
|
| 179 | + */ |
|
| 180 | + do_action('geodir_after_search_form') ?>
|
|
| 181 | 181 | |
| 182 | 182 | |
| 183 | 183 | </div> |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | $post_types = geodir_get_posttypes('object');
|
| 65 | 65 | |
| 66 | - if (!empty($post_types) && count((array)$post_types) > 1): |
|
| 66 | + if (!empty($post_types) && count((array) $post_types) > 1): |
|
| 67 | 67 | ?> |
| 68 | 68 | <select name="stype" class="search_by_post"> |
| 69 | 69 | <?php foreach ($post_types as $post_type => $info): |
@@ -75,19 +75,19 @@ discard block |
||
| 75 | 75 | } |
| 76 | 76 | ?> |
| 77 | 77 | |
| 78 | - <option data-label="<?php echo get_post_type_archive_link($post_type);?>" |
|
| 79 | - value="<?php echo $post_type;?>" <?php if (isset($_REQUEST['stype'])) {
|
|
| 78 | + <option data-label="<?php echo get_post_type_archive_link($post_type); ?>" |
|
| 79 | + value="<?php echo $post_type; ?>" <?php if (isset($_REQUEST['stype'])) {
|
|
| 80 | 80 | if ($post_type == $_REQUEST['stype']) {
|
| 81 | 81 | echo 'selected="selected"'; |
| 82 | 82 | } |
| 83 | 83 | } elseif ($curr_post_type == $post_type) {
|
| 84 | 84 | echo 'selected="selected"'; |
| 85 | - }?>><?php _e(ucfirst($info->labels->name), 'geodirectory');?></option> |
|
| 85 | + }?>><?php _e(ucfirst($info->labels->name), 'geodirectory'); ?></option> |
|
| 86 | 86 | |
| 87 | 87 | <?php endforeach; ?> |
| 88 | 88 | </select> |
| 89 | 89 | <?php elseif (!empty($post_types)): |
| 90 | - echo '<input type="hidden" name="stype" value="' . key($post_types) . '" />'; |
|
| 90 | + echo '<input type="hidden" name="stype" value="'.key($post_types).'" />'; |
|
| 91 | 91 | endif; ?> |
| 92 | 92 | |
| 93 | 93 | <input class="search_text" name="s" |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | * @since 1.5.5 |
| 158 | 158 | * @param string $default_search_button_label The current search button text. |
| 159 | 159 | */ |
| 160 | - $default_search_button_label = apply_filters('geodir_search_default_search_button_text', $default_search_button_label);?>
|
|
| 160 | + $default_search_button_label = apply_filters('geodir_search_default_search_button_text', $default_search_button_label); ?>
|
|
| 161 | 161 | <input type="button" value="<?php esc_attr_e($default_search_button_label); ?>" class="geodir_submit_search" /> |
| 162 | 162 | <?php |
| 163 | 163 | /** |