@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | */ |
| 8 | 8 | // If this file is called directly, abort. |
| 9 | 9 | if (!defined('WPINC')) { |
| 10 | - die; |
|
| 10 | + die; |
|
| 11 | 11 | } |
| 12 | 12 | require_once('geodirectory-functions/shortcode_functions.php'); |
| 13 | 13 | |
@@ -32,43 +32,43 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | function geodir_sc_add_listing($atts) |
| 34 | 34 | { |
| 35 | - ob_start(); |
|
| 36 | - $defaults = array( |
|
| 37 | - 'pid' => '', |
|
| 38 | - 'listing_type' => 'gd_place', |
|
| 39 | - 'login_msg' => __('You must login to post.', 'geodirectory'), |
|
| 40 | - 'show_login' => false, |
|
| 41 | - ); |
|
| 42 | - $params = shortcode_atts($defaults, $atts); |
|
| 43 | - |
|
| 44 | - foreach ($params as $key => $value) { |
|
| 45 | - $_REQUEST[$key] = $value; |
|
| 46 | - } |
|
| 47 | - |
|
| 48 | - $user_id = get_current_user_id(); |
|
| 49 | - if (!$user_id) { |
|
| 50 | - echo $params['login_msg']; |
|
| 51 | - if ($params['show_login']) { |
|
| 52 | - echo "<br />"; |
|
| 53 | - $defaults = array( |
|
| 54 | - 'before_widget' => '', |
|
| 55 | - 'after_widget' => '', |
|
| 56 | - 'before_title' => '', |
|
| 57 | - 'after_title' => '', |
|
| 58 | - ); |
|
| 59 | - |
|
| 60 | - geodir_loginwidget_output($defaults, $defaults); |
|
| 61 | - } |
|
| 62 | - |
|
| 63 | - |
|
| 64 | - } else { |
|
| 65 | - // Add listing page will be used if shortcode is detected in page content, no need to call it here |
|
| 66 | - } |
|
| 67 | - $output = ob_get_contents(); |
|
| 68 | - |
|
| 69 | - ob_end_clean(); |
|
| 70 | - |
|
| 71 | - return $output; |
|
| 35 | + ob_start(); |
|
| 36 | + $defaults = array( |
|
| 37 | + 'pid' => '', |
|
| 38 | + 'listing_type' => 'gd_place', |
|
| 39 | + 'login_msg' => __('You must login to post.', 'geodirectory'), |
|
| 40 | + 'show_login' => false, |
|
| 41 | + ); |
|
| 42 | + $params = shortcode_atts($defaults, $atts); |
|
| 43 | + |
|
| 44 | + foreach ($params as $key => $value) { |
|
| 45 | + $_REQUEST[$key] = $value; |
|
| 46 | + } |
|
| 47 | + |
|
| 48 | + $user_id = get_current_user_id(); |
|
| 49 | + if (!$user_id) { |
|
| 50 | + echo $params['login_msg']; |
|
| 51 | + if ($params['show_login']) { |
|
| 52 | + echo "<br />"; |
|
| 53 | + $defaults = array( |
|
| 54 | + 'before_widget' => '', |
|
| 55 | + 'after_widget' => '', |
|
| 56 | + 'before_title' => '', |
|
| 57 | + 'after_title' => '', |
|
| 58 | + ); |
|
| 59 | + |
|
| 60 | + geodir_loginwidget_output($defaults, $defaults); |
|
| 61 | + } |
|
| 62 | + |
|
| 63 | + |
|
| 64 | + } else { |
|
| 65 | + // Add listing page will be used if shortcode is detected in page content, no need to call it here |
|
| 66 | + } |
|
| 67 | + $output = ob_get_contents(); |
|
| 68 | + |
|
| 69 | + ob_end_clean(); |
|
| 70 | + |
|
| 71 | + return $output; |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | /** |
@@ -96,136 +96,136 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | function geodir_sc_home_map($atts) |
| 98 | 98 | { |
| 99 | - ob_start(); |
|
| 100 | - $defaults = array( |
|
| 101 | - 'width' => '960', |
|
| 102 | - 'height' => '425', |
|
| 103 | - 'maptype' => 'ROADMAP', |
|
| 104 | - 'zoom' => '13', |
|
| 105 | - 'autozoom' => '', |
|
| 106 | - 'child_collapse' => '0', |
|
| 107 | - 'scrollwheel' => '0', |
|
| 99 | + ob_start(); |
|
| 100 | + $defaults = array( |
|
| 101 | + 'width' => '960', |
|
| 102 | + 'height' => '425', |
|
| 103 | + 'maptype' => 'ROADMAP', |
|
| 104 | + 'zoom' => '13', |
|
| 105 | + 'autozoom' => '', |
|
| 106 | + 'child_collapse' => '0', |
|
| 107 | + 'scrollwheel' => '0', |
|
| 108 | 108 | 'marker_cluster' => false, |
| 109 | - 'latitude' => '', |
|
| 110 | - 'longitude' => '' |
|
| 111 | - ); |
|
| 112 | - |
|
| 113 | - $params = shortcode_atts($defaults, $atts); |
|
| 114 | - |
|
| 115 | - $params = gdsc_validate_map_args($params); |
|
| 116 | - |
|
| 117 | - $map_args = array( |
|
| 118 | - 'map_canvas_name' => 'gd_home_map', |
|
| 119 | - 'latitude' => $params['latitude'], |
|
| 120 | - 'longitude' => $params['longitude'], |
|
| 121 | - |
|
| 122 | - /** |
|
| 123 | - * Filter the widget width of the map on home/listings page. |
|
| 124 | - * |
|
| 125 | - * @since 1.0.0 |
|
| 126 | - * @param mixed(string|int|float) $params['width'] The map width. |
|
| 127 | - */ |
|
| 128 | - 'width' => apply_filters('widget_width', $params['width']), |
|
| 129 | - /** |
|
| 130 | - * Filter the widget height of the map on home/listings page. |
|
| 131 | - * |
|
| 132 | - * @since 1.0.0 |
|
| 133 | - * @param mixed(string|int|float) $params['height'] The map height. |
|
| 134 | - */ |
|
| 135 | - 'height' => apply_filters('widget_heigh', $params['height']), |
|
| 136 | - /** |
|
| 137 | - * Filter the widget maptype of the map on home/listings page. |
|
| 138 | - * |
|
| 139 | - * @since 1.0.0 |
|
| 109 | + 'latitude' => '', |
|
| 110 | + 'longitude' => '' |
|
| 111 | + ); |
|
| 112 | + |
|
| 113 | + $params = shortcode_atts($defaults, $atts); |
|
| 114 | + |
|
| 115 | + $params = gdsc_validate_map_args($params); |
|
| 116 | + |
|
| 117 | + $map_args = array( |
|
| 118 | + 'map_canvas_name' => 'gd_home_map', |
|
| 119 | + 'latitude' => $params['latitude'], |
|
| 120 | + 'longitude' => $params['longitude'], |
|
| 121 | + |
|
| 122 | + /** |
|
| 123 | + * Filter the widget width of the map on home/listings page. |
|
| 124 | + * |
|
| 125 | + * @since 1.0.0 |
|
| 126 | + * @param mixed(string|int|float) $params['width'] The map width. |
|
| 127 | + */ |
|
| 128 | + 'width' => apply_filters('widget_width', $params['width']), |
|
| 129 | + /** |
|
| 130 | + * Filter the widget height of the map on home/listings page. |
|
| 131 | + * |
|
| 132 | + * @since 1.0.0 |
|
| 133 | + * @param mixed(string|int|float) $params['height'] The map height. |
|
| 134 | + */ |
|
| 135 | + 'height' => apply_filters('widget_heigh', $params['height']), |
|
| 136 | + /** |
|
| 137 | + * Filter the widget maptype of the map on home/listings page. |
|
| 138 | + * |
|
| 139 | + * @since 1.0.0 |
|
| 140 | 140 | * @since 1.5.2 Added TERRAIN map type. |
| 141 | - * @param string $params['maptype'] The map type. Can be ROADMAP | SATELLITE | HYBRID | TERRAIN. |
|
| 142 | - */ |
|
| 143 | - 'maptype' => apply_filters('widget_maptype', $params['maptype']), |
|
| 144 | - /** |
|
| 145 | - * Filter the widget scrollwheel value of the map on home/listings page. |
|
| 146 | - * |
|
| 147 | - * Should the scrollwheel zoom the map or not. |
|
| 148 | - * |
|
| 149 | - * @since 1.0.0 |
|
| 150 | - * @param bool $params['scrollwheel'] True to allow scroll wheel to scroll map or false if not. |
|
| 151 | - */ |
|
| 152 | - 'scrollwheel' => apply_filters('widget_scrollwheel', $params['scrollwheel']), |
|
| 153 | - /** |
|
| 154 | - * Filter the widget zoom level of the map on home/listings page. |
|
| 155 | - * |
|
| 156 | - * @since 1.0.0 |
|
| 157 | - * @param int $params['zoom'] The zoom level of the map. Between 1-19. |
|
| 158 | - */ |
|
| 159 | - 'zoom' => apply_filters('widget_zoom', $params['zoom']), |
|
| 160 | - /** |
|
| 161 | - * Filter the widget auto zoom value of the map on home/listings page. |
|
| 162 | - * |
|
| 163 | - * If the map should autozoom to fit the markers shown. |
|
| 164 | - * |
|
| 165 | - * @since 1.0.0 |
|
| 166 | - * @param bool $params['autozoom'] True if the map should autozoom, false if not. |
|
| 167 | - */ |
|
| 168 | - 'autozoom' => apply_filters('widget_autozoom', $params['autozoom']), |
|
| 169 | - /** |
|
| 170 | - * Filter the widget child_collapse value of the map on home/listings page. |
|
| 171 | - * |
|
| 172 | - * If the map should auto collapse the child categories if the category bar is present. |
|
| 173 | - * |
|
| 174 | - * @since 1.0.0 |
|
| 175 | - * @param bool $params['child_collapse'] True if the map should collapse the categories, false if not. |
|
| 176 | - */ |
|
| 177 | - 'child_collapse' => apply_filters('widget_child_collapse', $params['child_collapse']), |
|
| 178 | - 'enable_cat_filters' => true, |
|
| 179 | - 'enable_text_search' => true, |
|
| 180 | - 'enable_post_type_filters' => true, |
|
| 181 | - /** |
|
| 182 | - * Filter the widget enable_location_filters value of the map on home/listings page. |
|
| 183 | - * |
|
| 184 | - * This is used when the location addon is used. |
|
| 185 | - * |
|
| 186 | - * @since 1.0.0 |
|
| 187 | - * @param bool $val True if location filters should be used, false if not. |
|
| 188 | - */ |
|
| 189 | - 'enable_location_filters' => apply_filters('geodir_home_map_enable_location_filters', false), |
|
| 190 | - 'enable_jason_on_load' => false, |
|
| 191 | - 'enable_marker_cluster' => false, |
|
| 192 | - 'enable_map_resize_button' => true, |
|
| 193 | - 'map_class_name' => 'geodir-map-home-page', |
|
| 194 | - 'is_geodir_home_map_widget' => true, |
|
| 195 | - ); |
|
| 141 | + * @param string $params['maptype'] The map type. Can be ROADMAP | SATELLITE | HYBRID | TERRAIN. |
|
| 142 | + */ |
|
| 143 | + 'maptype' => apply_filters('widget_maptype', $params['maptype']), |
|
| 144 | + /** |
|
| 145 | + * Filter the widget scrollwheel value of the map on home/listings page. |
|
| 146 | + * |
|
| 147 | + * Should the scrollwheel zoom the map or not. |
|
| 148 | + * |
|
| 149 | + * @since 1.0.0 |
|
| 150 | + * @param bool $params['scrollwheel'] True to allow scroll wheel to scroll map or false if not. |
|
| 151 | + */ |
|
| 152 | + 'scrollwheel' => apply_filters('widget_scrollwheel', $params['scrollwheel']), |
|
| 153 | + /** |
|
| 154 | + * Filter the widget zoom level of the map on home/listings page. |
|
| 155 | + * |
|
| 156 | + * @since 1.0.0 |
|
| 157 | + * @param int $params['zoom'] The zoom level of the map. Between 1-19. |
|
| 158 | + */ |
|
| 159 | + 'zoom' => apply_filters('widget_zoom', $params['zoom']), |
|
| 160 | + /** |
|
| 161 | + * Filter the widget auto zoom value of the map on home/listings page. |
|
| 162 | + * |
|
| 163 | + * If the map should autozoom to fit the markers shown. |
|
| 164 | + * |
|
| 165 | + * @since 1.0.0 |
|
| 166 | + * @param bool $params['autozoom'] True if the map should autozoom, false if not. |
|
| 167 | + */ |
|
| 168 | + 'autozoom' => apply_filters('widget_autozoom', $params['autozoom']), |
|
| 169 | + /** |
|
| 170 | + * Filter the widget child_collapse value of the map on home/listings page. |
|
| 171 | + * |
|
| 172 | + * If the map should auto collapse the child categories if the category bar is present. |
|
| 173 | + * |
|
| 174 | + * @since 1.0.0 |
|
| 175 | + * @param bool $params['child_collapse'] True if the map should collapse the categories, false if not. |
|
| 176 | + */ |
|
| 177 | + 'child_collapse' => apply_filters('widget_child_collapse', $params['child_collapse']), |
|
| 178 | + 'enable_cat_filters' => true, |
|
| 179 | + 'enable_text_search' => true, |
|
| 180 | + 'enable_post_type_filters' => true, |
|
| 181 | + /** |
|
| 182 | + * Filter the widget enable_location_filters value of the map on home/listings page. |
|
| 183 | + * |
|
| 184 | + * This is used when the location addon is used. |
|
| 185 | + * |
|
| 186 | + * @since 1.0.0 |
|
| 187 | + * @param bool $val True if location filters should be used, false if not. |
|
| 188 | + */ |
|
| 189 | + 'enable_location_filters' => apply_filters('geodir_home_map_enable_location_filters', false), |
|
| 190 | + 'enable_jason_on_load' => false, |
|
| 191 | + 'enable_marker_cluster' => false, |
|
| 192 | + 'enable_map_resize_button' => true, |
|
| 193 | + 'map_class_name' => 'geodir-map-home-page', |
|
| 194 | + 'is_geodir_home_map_widget' => true, |
|
| 195 | + ); |
|
| 196 | 196 | |
| 197 | 197 | // Add marker cluster |
| 198 | 198 | if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) { |
| 199 | - $map_args['enable_marker_cluster'] = true; |
|
| 200 | - if(get_option('geodir_marker_cluster_type')) { |
|
| 201 | - if ($map_args['autozoom']) { |
|
| 202 | - $map_args['enable_marker_cluster_no_reposition'] = false; |
|
| 203 | - } else { |
|
| 204 | - $map_args['enable_marker_cluster_no_reposition'] = true; |
|
| 205 | - } |
|
| 199 | + $map_args['enable_marker_cluster'] = true; |
|
| 200 | + if(get_option('geodir_marker_cluster_type')) { |
|
| 201 | + if ($map_args['autozoom']) { |
|
| 202 | + $map_args['enable_marker_cluster_no_reposition'] = false; |
|
| 203 | + } else { |
|
| 204 | + $map_args['enable_marker_cluster_no_reposition'] = true; |
|
| 205 | + } |
|
| 206 | 206 | |
| 207 | - $map_args['enable_marker_cluster_server'] = true ; |
|
| 207 | + $map_args['enable_marker_cluster_server'] = true ; |
|
| 208 | 208 | |
| 209 | - } |
|
| 209 | + } |
|
| 210 | 210 | } else { |
| 211 | 211 | $map_args['enable_marker_cluster'] = false; |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | - // if lat and long set in shortcode, hack it so the map is not repositioned |
|
| 215 | - if(!empty($params['latitude']) && !empty($params['longitude']) ){ |
|
| 216 | - $map_args['enable_marker_cluster_no_reposition'] = true; |
|
| 217 | - } |
|
| 214 | + // if lat and long set in shortcode, hack it so the map is not repositioned |
|
| 215 | + if(!empty($params['latitude']) && !empty($params['longitude']) ){ |
|
| 216 | + $map_args['enable_marker_cluster_no_reposition'] = true; |
|
| 217 | + } |
|
| 218 | 218 | |
| 219 | 219 | |
| 220 | - geodir_draw_map($map_args); |
|
| 220 | + geodir_draw_map($map_args); |
|
| 221 | 221 | |
| 222 | - add_action('wp_footer', 'geodir_home_map_add_script', 100); |
|
| 222 | + add_action('wp_footer', 'geodir_home_map_add_script', 100); |
|
| 223 | 223 | |
| 224 | - $output = ob_get_contents(); |
|
| 224 | + $output = ob_get_contents(); |
|
| 225 | 225 | |
| 226 | - ob_end_clean(); |
|
| 226 | + ob_end_clean(); |
|
| 227 | 227 | |
| 228 | - return $output; |
|
| 228 | + return $output; |
|
| 229 | 229 | } |
| 230 | 230 | add_shortcode('gd_homepage_map', 'geodir_sc_home_map'); |
| 231 | 231 | |
@@ -259,77 +259,77 @@ discard block |
||
| 259 | 259 | */ |
| 260 | 260 | function geodir_sc_listing_map($atts) |
| 261 | 261 | { |
| 262 | - ob_start(); |
|
| 263 | - add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array |
|
| 264 | - |
|
| 265 | - add_action('the_post', 'create_list_jsondata'); // Add marker in json array |
|
| 266 | - |
|
| 267 | - add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers |
|
| 268 | - |
|
| 269 | - $defaults = array( |
|
| 270 | - 'width' => '294', |
|
| 271 | - 'height' => '370', |
|
| 272 | - 'zoom' => '13', |
|
| 273 | - 'autozoom' => '', |
|
| 274 | - 'sticky' => '', |
|
| 275 | - 'showall' => '0', |
|
| 276 | - 'scrollwheel' => '0', |
|
| 277 | - 'maptype' => 'ROADMAP', |
|
| 278 | - 'child_collapse' => 0, |
|
| 262 | + ob_start(); |
|
| 263 | + add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array |
|
| 264 | + |
|
| 265 | + add_action('the_post', 'create_list_jsondata'); // Add marker in json array |
|
| 266 | + |
|
| 267 | + add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers |
|
| 268 | + |
|
| 269 | + $defaults = array( |
|
| 270 | + 'width' => '294', |
|
| 271 | + 'height' => '370', |
|
| 272 | + 'zoom' => '13', |
|
| 273 | + 'autozoom' => '', |
|
| 274 | + 'sticky' => '', |
|
| 275 | + 'showall' => '0', |
|
| 276 | + 'scrollwheel' => '0', |
|
| 277 | + 'maptype' => 'ROADMAP', |
|
| 278 | + 'child_collapse' => 0, |
|
| 279 | 279 | 'marker_cluster' => false |
| 280 | - ); |
|
| 281 | - |
|
| 282 | - $params = shortcode_atts($defaults, $atts); |
|
| 283 | - |
|
| 284 | - $params = gdsc_validate_map_args($params); |
|
| 285 | - |
|
| 286 | - $map_args = array( |
|
| 287 | - 'map_canvas_name' => 'gd_listing_map', |
|
| 288 | - 'width' => $params['width'], |
|
| 289 | - 'height' => $params['height'], |
|
| 290 | - 'zoom' => $params['zoom'], |
|
| 291 | - 'autozoom' => $params['autozoom'], |
|
| 292 | - 'sticky' => $params['sticky'], |
|
| 293 | - 'showall' => $params['showall'], |
|
| 294 | - 'scrollwheel' => $params['scrollwheel'], |
|
| 295 | - 'child_collapse' => 0, |
|
| 296 | - 'enable_cat_filters' => false, |
|
| 297 | - 'enable_text_search' => false, |
|
| 298 | - 'enable_post_type_filters' => false, |
|
| 299 | - 'enable_location_filters' => false, |
|
| 300 | - 'enable_jason_on_load' => true, |
|
| 301 | - ); |
|
| 302 | - |
|
| 303 | - if (is_single()) { |
|
| 304 | - |
|
| 305 | - global $post; |
|
| 306 | - $map_default_lat = $address_latitude = $post->post_latitude; |
|
| 307 | - $map_default_lng = $address_longitude = $post->post_longitude; |
|
| 308 | - $mapview = $post->post_mapview; |
|
| 309 | - $map_args['zoom'] = $post->post_mapzoom; |
|
| 310 | - $map_args['map_class_name'] = 'geodir-map-listing-page-single'; |
|
| 311 | - |
|
| 312 | - } else { |
|
| 313 | - $default_location = geodir_get_default_location(); |
|
| 314 | - |
|
| 315 | - $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
| 316 | - $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
| 317 | - $map_args['map_class_name'] = 'geodir-map-listing-page'; |
|
| 318 | - } |
|
| 319 | - |
|
| 320 | - if (empty($mapview)) { |
|
| 321 | - $mapview = 'ROADMAP'; |
|
| 322 | - } |
|
| 323 | - |
|
| 324 | - // Set default map options |
|
| 325 | - $map_args['ajax_url'] = geodir_get_ajax_url(); |
|
| 326 | - $map_args['latitude'] = $map_default_lat; |
|
| 327 | - $map_args['longitude'] = $map_default_lng; |
|
| 328 | - $map_args['streetViewControl'] = true; |
|
| 329 | - $map_args['maptype'] = $mapview; |
|
| 330 | - $map_args['showPreview'] = '0'; |
|
| 331 | - $map_args['maxZoom'] = 21; |
|
| 332 | - $map_args['bubble_size'] = 'small'; |
|
| 280 | + ); |
|
| 281 | + |
|
| 282 | + $params = shortcode_atts($defaults, $atts); |
|
| 283 | + |
|
| 284 | + $params = gdsc_validate_map_args($params); |
|
| 285 | + |
|
| 286 | + $map_args = array( |
|
| 287 | + 'map_canvas_name' => 'gd_listing_map', |
|
| 288 | + 'width' => $params['width'], |
|
| 289 | + 'height' => $params['height'], |
|
| 290 | + 'zoom' => $params['zoom'], |
|
| 291 | + 'autozoom' => $params['autozoom'], |
|
| 292 | + 'sticky' => $params['sticky'], |
|
| 293 | + 'showall' => $params['showall'], |
|
| 294 | + 'scrollwheel' => $params['scrollwheel'], |
|
| 295 | + 'child_collapse' => 0, |
|
| 296 | + 'enable_cat_filters' => false, |
|
| 297 | + 'enable_text_search' => false, |
|
| 298 | + 'enable_post_type_filters' => false, |
|
| 299 | + 'enable_location_filters' => false, |
|
| 300 | + 'enable_jason_on_load' => true, |
|
| 301 | + ); |
|
| 302 | + |
|
| 303 | + if (is_single()) { |
|
| 304 | + |
|
| 305 | + global $post; |
|
| 306 | + $map_default_lat = $address_latitude = $post->post_latitude; |
|
| 307 | + $map_default_lng = $address_longitude = $post->post_longitude; |
|
| 308 | + $mapview = $post->post_mapview; |
|
| 309 | + $map_args['zoom'] = $post->post_mapzoom; |
|
| 310 | + $map_args['map_class_name'] = 'geodir-map-listing-page-single'; |
|
| 311 | + |
|
| 312 | + } else { |
|
| 313 | + $default_location = geodir_get_default_location(); |
|
| 314 | + |
|
| 315 | + $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
| 316 | + $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
| 317 | + $map_args['map_class_name'] = 'geodir-map-listing-page'; |
|
| 318 | + } |
|
| 319 | + |
|
| 320 | + if (empty($mapview)) { |
|
| 321 | + $mapview = 'ROADMAP'; |
|
| 322 | + } |
|
| 323 | + |
|
| 324 | + // Set default map options |
|
| 325 | + $map_args['ajax_url'] = geodir_get_ajax_url(); |
|
| 326 | + $map_args['latitude'] = $map_default_lat; |
|
| 327 | + $map_args['longitude'] = $map_default_lng; |
|
| 328 | + $map_args['streetViewControl'] = true; |
|
| 329 | + $map_args['maptype'] = $mapview; |
|
| 330 | + $map_args['showPreview'] = '0'; |
|
| 331 | + $map_args['maxZoom'] = 21; |
|
| 332 | + $map_args['bubble_size'] = 'small'; |
|
| 333 | 333 | |
| 334 | 334 | // Add marker cluster |
| 335 | 335 | if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) { |
@@ -338,13 +338,13 @@ discard block |
||
| 338 | 338 | $map_args['enable_marker_cluster'] = false; |
| 339 | 339 | } |
| 340 | 340 | |
| 341 | - geodir_draw_map($map_args); |
|
| 341 | + geodir_draw_map($map_args); |
|
| 342 | 342 | |
| 343 | - $output = ob_get_contents(); |
|
| 343 | + $output = ob_get_contents(); |
|
| 344 | 344 | |
| 345 | - ob_end_clean(); |
|
| 345 | + ob_end_clean(); |
|
| 346 | 346 | |
| 347 | - return $output; |
|
| 347 | + return $output; |
|
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | add_shortcode('gd_listing_slider', 'geodir_sc_listing_slider'); |
@@ -377,120 +377,120 @@ discard block |
||
| 377 | 377 | */ |
| 378 | 378 | function geodir_sc_listing_slider($atts) |
| 379 | 379 | { |
| 380 | - ob_start(); |
|
| 381 | - $defaults = array( |
|
| 382 | - 'post_type' => 'gd_place', |
|
| 383 | - 'category' => '0', |
|
| 384 | - 'post_number' => '5', |
|
| 385 | - 'slideshow' => '0', |
|
| 386 | - 'animation_loop' => 0, |
|
| 387 | - 'direction_nav' => 0, |
|
| 388 | - 'slideshow_speed' => 5000, |
|
| 389 | - 'animation_speed' => 600, |
|
| 390 | - 'animation' => 'slide', |
|
| 391 | - 'order_by' => 'latest', |
|
| 392 | - 'show_title' => '', |
|
| 393 | - 'show_featured_only' => '', |
|
| 394 | - 'title' => '', |
|
| 395 | - ); |
|
| 396 | - |
|
| 397 | - $params = shortcode_atts($defaults, $atts); |
|
| 398 | - |
|
| 399 | - |
|
| 400 | - /* |
|
| 380 | + ob_start(); |
|
| 381 | + $defaults = array( |
|
| 382 | + 'post_type' => 'gd_place', |
|
| 383 | + 'category' => '0', |
|
| 384 | + 'post_number' => '5', |
|
| 385 | + 'slideshow' => '0', |
|
| 386 | + 'animation_loop' => 0, |
|
| 387 | + 'direction_nav' => 0, |
|
| 388 | + 'slideshow_speed' => 5000, |
|
| 389 | + 'animation_speed' => 600, |
|
| 390 | + 'animation' => 'slide', |
|
| 391 | + 'order_by' => 'latest', |
|
| 392 | + 'show_title' => '', |
|
| 393 | + 'show_featured_only' => '', |
|
| 394 | + 'title' => '', |
|
| 395 | + ); |
|
| 396 | + |
|
| 397 | + $params = shortcode_atts($defaults, $atts); |
|
| 398 | + |
|
| 399 | + |
|
| 400 | + /* |
|
| 401 | 401 | * |
| 402 | 402 | * Now we begin the validation of the attributes. |
| 403 | 403 | */ |
| 404 | - // Check we have a valid post_type |
|
| 405 | - if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
| 406 | - $params['post_type'] = 'gd_place'; |
|
| 407 | - } |
|
| 408 | - |
|
| 409 | - // Check we have a valid sort_order |
|
| 410 | - $params['order_by'] = gdsc_validate_sort_choice($params['order_by']); |
|
| 411 | - |
|
| 412 | - // Match the chosen animation to our options |
|
| 413 | - $animation_list = array('slide', 'fade'); |
|
| 414 | - if (!(in_array($params['animation'], $animation_list))) { |
|
| 415 | - $params['animation'] = 'slide'; |
|
| 416 | - } |
|
| 417 | - |
|
| 418 | - // Post_number needs to be a positive integer |
|
| 419 | - $params['post_number'] = absint($params['post_number']); |
|
| 420 | - if (0 == $params['post_number']) { |
|
| 421 | - $params['post_number'] = 1; |
|
| 422 | - } |
|
| 423 | - |
|
| 424 | - // Manage the entered categories |
|
| 425 | - if (0 != $params['category'] || '' != $params['category']) { |
|
| 426 | - $params['category'] = gdsc_manage_category_choice($params['post_type'], $params['category']); |
|
| 427 | - } |
|
| 428 | - // Convert show_title to a bool |
|
| 429 | - $params['show_title'] = intval(gdsc_to_bool_val($params['show_title'])); |
|
| 430 | - |
|
| 431 | - // Convert show_featured_only to a bool |
|
| 432 | - $params['show_featured_only'] = intval(gdsc_to_bool_val($params['show_featured_only'])); |
|
| 433 | - |
|
| 434 | - /* |
|
| 404 | + // Check we have a valid post_type |
|
| 405 | + if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
| 406 | + $params['post_type'] = 'gd_place'; |
|
| 407 | + } |
|
| 408 | + |
|
| 409 | + // Check we have a valid sort_order |
|
| 410 | + $params['order_by'] = gdsc_validate_sort_choice($params['order_by']); |
|
| 411 | + |
|
| 412 | + // Match the chosen animation to our options |
|
| 413 | + $animation_list = array('slide', 'fade'); |
|
| 414 | + if (!(in_array($params['animation'], $animation_list))) { |
|
| 415 | + $params['animation'] = 'slide'; |
|
| 416 | + } |
|
| 417 | + |
|
| 418 | + // Post_number needs to be a positive integer |
|
| 419 | + $params['post_number'] = absint($params['post_number']); |
|
| 420 | + if (0 == $params['post_number']) { |
|
| 421 | + $params['post_number'] = 1; |
|
| 422 | + } |
|
| 423 | + |
|
| 424 | + // Manage the entered categories |
|
| 425 | + if (0 != $params['category'] || '' != $params['category']) { |
|
| 426 | + $params['category'] = gdsc_manage_category_choice($params['post_type'], $params['category']); |
|
| 427 | + } |
|
| 428 | + // Convert show_title to a bool |
|
| 429 | + $params['show_title'] = intval(gdsc_to_bool_val($params['show_title'])); |
|
| 430 | + |
|
| 431 | + // Convert show_featured_only to a bool |
|
| 432 | + $params['show_featured_only'] = intval(gdsc_to_bool_val($params['show_featured_only'])); |
|
| 433 | + |
|
| 434 | + /* |
|
| 435 | 435 | * Hopefully all attributes are now valid, and safe to pass forward |
| 436 | 436 | */ |
| 437 | 437 | |
| 438 | - // redeclare vars after validation |
|
| 439 | - |
|
| 440 | - if (isset($params['direction_nav'])) { |
|
| 441 | - $params['directionNav'] = $params['direction_nav']; |
|
| 442 | - } |
|
| 443 | - if (isset($params['animation_loop'])) { |
|
| 444 | - $params['animationLoop'] = $params['animation_loop']; |
|
| 445 | - } |
|
| 446 | - if (isset($params['slideshow_speed'])) { |
|
| 447 | - $params['slideshowSpeed'] = $params['slideshow_speed']; |
|
| 448 | - } |
|
| 449 | - if (isset($params['animation_speed'])) { |
|
| 450 | - $params['animationSpeed'] = $params['animation_speed']; |
|
| 451 | - } |
|
| 452 | - if (isset($params['order_by'])) { |
|
| 453 | - $params['list_sort'] = $params['order_by']; |
|
| 454 | - } |
|
| 455 | - |
|
| 456 | - $query_args = array( |
|
| 457 | - 'post_number' => $params['post_number'], |
|
| 458 | - 'is_geodir_loop' => true, |
|
| 459 | - 'post_type' => $params['post_type'], |
|
| 460 | - 'order_by' => $params['order_by'] |
|
| 461 | - ); |
|
| 462 | - |
|
| 463 | - if (1 == $params['show_featured_only']) { |
|
| 464 | - $query_args['show_featured_only'] = 1; |
|
| 465 | - } |
|
| 466 | - |
|
| 467 | - if (0 != $params['category'] && '' != $params['category']) { |
|
| 468 | - $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
| 469 | - $tax_query = array( |
|
| 470 | - 'taxonomy' => $category_taxonomy[0], |
|
| 471 | - 'field' => 'id', |
|
| 472 | - 'terms' => $params['category'], |
|
| 473 | - ); |
|
| 474 | - |
|
| 475 | - $query_args['tax_query'] = array($tax_query); |
|
| 476 | - } |
|
| 477 | - |
|
| 478 | - $defaults = array( |
|
| 479 | - 'before_widget' => '', |
|
| 480 | - 'after_widget' => '', |
|
| 481 | - 'before_title' => '', |
|
| 482 | - 'after_title' => '', |
|
| 483 | - ); |
|
| 484 | - |
|
| 485 | - $query_args = array_merge($query_args, $params); |
|
| 486 | - |
|
| 487 | - geodir_listing_slider_widget_output($defaults, $query_args); |
|
| 488 | - |
|
| 489 | - $output = ob_get_contents(); |
|
| 490 | - |
|
| 491 | - ob_end_clean(); |
|
| 492 | - |
|
| 493 | - return $output; |
|
| 438 | + // redeclare vars after validation |
|
| 439 | + |
|
| 440 | + if (isset($params['direction_nav'])) { |
|
| 441 | + $params['directionNav'] = $params['direction_nav']; |
|
| 442 | + } |
|
| 443 | + if (isset($params['animation_loop'])) { |
|
| 444 | + $params['animationLoop'] = $params['animation_loop']; |
|
| 445 | + } |
|
| 446 | + if (isset($params['slideshow_speed'])) { |
|
| 447 | + $params['slideshowSpeed'] = $params['slideshow_speed']; |
|
| 448 | + } |
|
| 449 | + if (isset($params['animation_speed'])) { |
|
| 450 | + $params['animationSpeed'] = $params['animation_speed']; |
|
| 451 | + } |
|
| 452 | + if (isset($params['order_by'])) { |
|
| 453 | + $params['list_sort'] = $params['order_by']; |
|
| 454 | + } |
|
| 455 | + |
|
| 456 | + $query_args = array( |
|
| 457 | + 'post_number' => $params['post_number'], |
|
| 458 | + 'is_geodir_loop' => true, |
|
| 459 | + 'post_type' => $params['post_type'], |
|
| 460 | + 'order_by' => $params['order_by'] |
|
| 461 | + ); |
|
| 462 | + |
|
| 463 | + if (1 == $params['show_featured_only']) { |
|
| 464 | + $query_args['show_featured_only'] = 1; |
|
| 465 | + } |
|
| 466 | + |
|
| 467 | + if (0 != $params['category'] && '' != $params['category']) { |
|
| 468 | + $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
| 469 | + $tax_query = array( |
|
| 470 | + 'taxonomy' => $category_taxonomy[0], |
|
| 471 | + 'field' => 'id', |
|
| 472 | + 'terms' => $params['category'], |
|
| 473 | + ); |
|
| 474 | + |
|
| 475 | + $query_args['tax_query'] = array($tax_query); |
|
| 476 | + } |
|
| 477 | + |
|
| 478 | + $defaults = array( |
|
| 479 | + 'before_widget' => '', |
|
| 480 | + 'after_widget' => '', |
|
| 481 | + 'before_title' => '', |
|
| 482 | + 'after_title' => '', |
|
| 483 | + ); |
|
| 484 | + |
|
| 485 | + $query_args = array_merge($query_args, $params); |
|
| 486 | + |
|
| 487 | + geodir_listing_slider_widget_output($defaults, $query_args); |
|
| 488 | + |
|
| 489 | + $output = ob_get_contents(); |
|
| 490 | + |
|
| 491 | + ob_end_clean(); |
|
| 492 | + |
|
| 493 | + return $output; |
|
| 494 | 494 | } |
| 495 | 495 | |
| 496 | 496 | add_shortcode('gd_login_box', 'geodir_sc_login_box'); |
@@ -514,22 +514,22 @@ discard block |
||
| 514 | 514 | */ |
| 515 | 515 | function geodir_sc_login_box($atts) |
| 516 | 516 | { |
| 517 | - ob_start(); |
|
| 517 | + ob_start(); |
|
| 518 | 518 | |
| 519 | - $defaults = array( |
|
| 520 | - 'before_widget' => '', |
|
| 521 | - 'after_widget' => '', |
|
| 522 | - 'before_title' => '', |
|
| 523 | - 'after_title' => '', |
|
| 524 | - ); |
|
| 519 | + $defaults = array( |
|
| 520 | + 'before_widget' => '', |
|
| 521 | + 'after_widget' => '', |
|
| 522 | + 'before_title' => '', |
|
| 523 | + 'after_title' => '', |
|
| 524 | + ); |
|
| 525 | 525 | |
| 526 | - geodir_loginwidget_output($defaults, $defaults); |
|
| 526 | + geodir_loginwidget_output($defaults, $defaults); |
|
| 527 | 527 | |
| 528 | - $output = ob_get_contents(); |
|
| 528 | + $output = ob_get_contents(); |
|
| 529 | 529 | |
| 530 | - ob_end_clean(); |
|
| 530 | + ob_end_clean(); |
|
| 531 | 531 | |
| 532 | - return $output; |
|
| 532 | + return $output; |
|
| 533 | 533 | } |
| 534 | 534 | |
| 535 | 535 | add_shortcode('gd_popular_post_category', 'geodir_sc_popular_post_category'); |
@@ -560,30 +560,30 @@ discard block |
||
| 560 | 560 | */ |
| 561 | 561 | function geodir_sc_popular_post_category($atts) |
| 562 | 562 | { |
| 563 | - ob_start(); |
|
| 564 | - global $geodir_post_category_str; |
|
| 565 | - $defaults = array( |
|
| 566 | - 'category_limit' => 15, |
|
| 567 | - 'before_widget' => '', |
|
| 568 | - 'after_widget' => '', |
|
| 569 | - 'before_title' => '', |
|
| 570 | - 'after_title' => '', |
|
| 571 | - 'title' => '', |
|
| 572 | - 'default_post_type' => '', |
|
| 573 | - 'parent_only' => false, |
|
| 574 | - ); |
|
| 575 | - |
|
| 576 | - $params = shortcode_atts($defaults, $atts, 'popular_post_category'); |
|
| 577 | - $params['category_limit'] = absint($params['category_limit']); |
|
| 578 | - $params['default_post_type'] = gdsc_is_post_type_valid($params['default_post_type']) ? $params['default_post_type'] : ''; |
|
| 579 | - $params['parent_only'] = gdsc_to_bool_val($params['parent_only']); |
|
| 580 | - geodir_popular_post_category_output($params, $params); |
|
| 581 | - |
|
| 582 | - $output = ob_get_contents(); |
|
| 583 | - |
|
| 584 | - ob_end_clean(); |
|
| 585 | - |
|
| 586 | - return $output; |
|
| 563 | + ob_start(); |
|
| 564 | + global $geodir_post_category_str; |
|
| 565 | + $defaults = array( |
|
| 566 | + 'category_limit' => 15, |
|
| 567 | + 'before_widget' => '', |
|
| 568 | + 'after_widget' => '', |
|
| 569 | + 'before_title' => '', |
|
| 570 | + 'after_title' => '', |
|
| 571 | + 'title' => '', |
|
| 572 | + 'default_post_type' => '', |
|
| 573 | + 'parent_only' => false, |
|
| 574 | + ); |
|
| 575 | + |
|
| 576 | + $params = shortcode_atts($defaults, $atts, 'popular_post_category'); |
|
| 577 | + $params['category_limit'] = absint($params['category_limit']); |
|
| 578 | + $params['default_post_type'] = gdsc_is_post_type_valid($params['default_post_type']) ? $params['default_post_type'] : ''; |
|
| 579 | + $params['parent_only'] = gdsc_to_bool_val($params['parent_only']); |
|
| 580 | + geodir_popular_post_category_output($params, $params); |
|
| 581 | + |
|
| 582 | + $output = ob_get_contents(); |
|
| 583 | + |
|
| 584 | + ob_end_clean(); |
|
| 585 | + |
|
| 586 | + return $output; |
|
| 587 | 587 | } |
| 588 | 588 | |
| 589 | 589 | add_shortcode('gd_popular_post_view', 'geodir_sc_popular_post_view'); |
@@ -623,97 +623,97 @@ discard block |
||
| 623 | 623 | */ |
| 624 | 624 | function geodir_sc_popular_post_view($atts) |
| 625 | 625 | { |
| 626 | - ob_start(); |
|
| 627 | - $defaults = array( |
|
| 628 | - 'post_type' => 'gd_place', |
|
| 629 | - 'category' => '0', |
|
| 630 | - 'post_number' => '5', |
|
| 631 | - 'layout' => 'gridview_onehalf', |
|
| 632 | - 'add_location_filter' => '0', |
|
| 633 | - 'list_sort' => 'latest', |
|
| 634 | - 'use_viewing_post_type' => '1', |
|
| 635 | - 'character_count' => '20', |
|
| 636 | - 'listing_width' => '', |
|
| 637 | - 'show_featured_only' => '0', |
|
| 638 | - 'show_special_only' => '0', |
|
| 639 | - 'with_pics_only' => '0', |
|
| 640 | - 'with_videos_only' => '0', |
|
| 641 | - 'before_widget' => '', |
|
| 642 | - 'after_widget' => '', |
|
| 643 | - 'before_title' => '<h3 class="widget-title">', |
|
| 644 | - 'after_title' => '</h3>', |
|
| 645 | - 'title' => '', |
|
| 646 | - 'category_title' => '', |
|
| 647 | - ); |
|
| 648 | - |
|
| 649 | - $params = shortcode_atts($defaults, $atts); |
|
| 650 | - |
|
| 651 | - /** |
|
| 652 | - * Validate our incoming params |
|
| 653 | - */ |
|
| 626 | + ob_start(); |
|
| 627 | + $defaults = array( |
|
| 628 | + 'post_type' => 'gd_place', |
|
| 629 | + 'category' => '0', |
|
| 630 | + 'post_number' => '5', |
|
| 631 | + 'layout' => 'gridview_onehalf', |
|
| 632 | + 'add_location_filter' => '0', |
|
| 633 | + 'list_sort' => 'latest', |
|
| 634 | + 'use_viewing_post_type' => '1', |
|
| 635 | + 'character_count' => '20', |
|
| 636 | + 'listing_width' => '', |
|
| 637 | + 'show_featured_only' => '0', |
|
| 638 | + 'show_special_only' => '0', |
|
| 639 | + 'with_pics_only' => '0', |
|
| 640 | + 'with_videos_only' => '0', |
|
| 641 | + 'before_widget' => '', |
|
| 642 | + 'after_widget' => '', |
|
| 643 | + 'before_title' => '<h3 class="widget-title">', |
|
| 644 | + 'after_title' => '</h3>', |
|
| 645 | + 'title' => '', |
|
| 646 | + 'category_title' => '', |
|
| 647 | + ); |
|
| 654 | 648 | |
| 655 | - // Validate the selected post type, default to gd_place on fail |
|
| 656 | - if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
| 657 | - $params['post_type'] = 'gd_place'; |
|
| 658 | - } |
|
| 659 | - |
|
| 660 | - // Validate the selected category/ies - Grab the current list based on post_type |
|
| 661 | - $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
| 662 | - $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids')); |
|
| 663 | - |
|
| 664 | - // Make sure we have an array |
|
| 665 | - if (!(is_array($params['category']))) { |
|
| 666 | - $params['category'] = explode(',', $params['category']); |
|
| 667 | - } |
|
| 668 | - |
|
| 669 | - // Array_intersect returns only the items in $params['category'] that are also in our category list |
|
| 670 | - // Otherwise it becomes empty and later on that will mean "All" |
|
| 671 | - $params['category'] = array_intersect($params['category'], $categories); |
|
| 672 | - |
|
| 673 | - // Post_number needs to be a positive integer |
|
| 674 | - $params['post_number'] = absint($params['post_number']); |
|
| 675 | - if (0 == $params['post_number']) { |
|
| 676 | - $params['post_number'] = 1; |
|
| 677 | - } |
|
| 678 | - |
|
| 679 | - // Validate our layout choice |
|
| 680 | - // Outside of the norm, I added some more simple terms to match the existing |
|
| 681 | - // So now I just run the switch to set it properly. |
|
| 682 | - $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
| 683 | - |
|
| 684 | - // Validate our sorting choice |
|
| 685 | - $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
| 686 | - |
|
| 687 | - // Validate character_count |
|
| 688 | - $params['character_count'] = absint($params['character_count']); |
|
| 689 | - if (20 > $params['character_count']) { |
|
| 690 | - $params['character_count'] = 20; |
|
| 691 | - } |
|
| 692 | - |
|
| 693 | - // Validate Listing width, used in the template widget-listing-listview.php |
|
| 694 | - // The context is in width=$listing_width% - So we need a positive number between 0 & 100 |
|
| 695 | - $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
| 696 | - |
|
| 697 | - // Validate the checkboxes used on the widget |
|
| 698 | - $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
| 699 | - $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']); |
|
| 700 | - $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']); |
|
| 701 | - $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']); |
|
| 702 | - $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']); |
|
| 703 | - $params['use_viewing_post_type'] = gdsc_to_bool_val($params['use_viewing_post_type']); |
|
| 704 | - |
|
| 705 | - /** |
|
| 706 | - * End of validation |
|
| 707 | - */ |
|
| 649 | + $params = shortcode_atts($defaults, $atts); |
|
| 650 | + |
|
| 651 | + /** |
|
| 652 | + * Validate our incoming params |
|
| 653 | + */ |
|
| 654 | + |
|
| 655 | + // Validate the selected post type, default to gd_place on fail |
|
| 656 | + if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
| 657 | + $params['post_type'] = 'gd_place'; |
|
| 658 | + } |
|
| 659 | + |
|
| 660 | + // Validate the selected category/ies - Grab the current list based on post_type |
|
| 661 | + $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
| 662 | + $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids')); |
|
| 708 | 663 | |
| 709 | - geodir_popular_postview_output($params, $params); |
|
| 664 | + // Make sure we have an array |
|
| 665 | + if (!(is_array($params['category']))) { |
|
| 666 | + $params['category'] = explode(',', $params['category']); |
|
| 667 | + } |
|
| 668 | + |
|
| 669 | + // Array_intersect returns only the items in $params['category'] that are also in our category list |
|
| 670 | + // Otherwise it becomes empty and later on that will mean "All" |
|
| 671 | + $params['category'] = array_intersect($params['category'], $categories); |
|
| 672 | + |
|
| 673 | + // Post_number needs to be a positive integer |
|
| 674 | + $params['post_number'] = absint($params['post_number']); |
|
| 675 | + if (0 == $params['post_number']) { |
|
| 676 | + $params['post_number'] = 1; |
|
| 677 | + } |
|
| 710 | 678 | |
| 679 | + // Validate our layout choice |
|
| 680 | + // Outside of the norm, I added some more simple terms to match the existing |
|
| 681 | + // So now I just run the switch to set it properly. |
|
| 682 | + $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
| 711 | 683 | |
| 712 | - $output = ob_get_contents(); |
|
| 684 | + // Validate our sorting choice |
|
| 685 | + $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
| 713 | 686 | |
| 714 | - ob_end_clean(); |
|
| 687 | + // Validate character_count |
|
| 688 | + $params['character_count'] = absint($params['character_count']); |
|
| 689 | + if (20 > $params['character_count']) { |
|
| 690 | + $params['character_count'] = 20; |
|
| 691 | + } |
|
| 715 | 692 | |
| 716 | - return $output; |
|
| 693 | + // Validate Listing width, used in the template widget-listing-listview.php |
|
| 694 | + // The context is in width=$listing_width% - So we need a positive number between 0 & 100 |
|
| 695 | + $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
| 696 | + |
|
| 697 | + // Validate the checkboxes used on the widget |
|
| 698 | + $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
| 699 | + $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']); |
|
| 700 | + $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']); |
|
| 701 | + $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']); |
|
| 702 | + $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']); |
|
| 703 | + $params['use_viewing_post_type'] = gdsc_to_bool_val($params['use_viewing_post_type']); |
|
| 704 | + |
|
| 705 | + /** |
|
| 706 | + * End of validation |
|
| 707 | + */ |
|
| 708 | + |
|
| 709 | + geodir_popular_postview_output($params, $params); |
|
| 710 | + |
|
| 711 | + |
|
| 712 | + $output = ob_get_contents(); |
|
| 713 | + |
|
| 714 | + ob_end_clean(); |
|
| 715 | + |
|
| 716 | + return $output; |
|
| 717 | 717 | } |
| 718 | 718 | |
| 719 | 719 | add_shortcode('gd_recent_reviews', 'geodir_sc_recent_reviews'); |
@@ -735,37 +735,37 @@ discard block |
||
| 735 | 735 | * @return string Recent reviews HTML. |
| 736 | 736 | */ |
| 737 | 737 | function geodir_sc_recent_reviews($atts) { |
| 738 | - ob_start(); |
|
| 739 | - $defaults = array( |
|
| 738 | + ob_start(); |
|
| 739 | + $defaults = array( |
|
| 740 | 740 | 'title' => '', |
| 741 | 741 | 'count' => 5, |
| 742 | - ); |
|
| 742 | + ); |
|
| 743 | 743 | |
| 744 | - $params = shortcode_atts($defaults, $atts); |
|
| 744 | + $params = shortcode_atts($defaults, $atts); |
|
| 745 | 745 | |
| 746 | - $count = absint($params['count']); |
|
| 747 | - if (0 == $count) { |
|
| 748 | - $count = 1; |
|
| 749 | - } |
|
| 746 | + $count = absint($params['count']); |
|
| 747 | + if (0 == $count) { |
|
| 748 | + $count = 1; |
|
| 749 | + } |
|
| 750 | 750 | |
| 751 | 751 | $title = !empty($params['title']) ? __($params['title'], 'geodirectory') : ''; |
| 752 | 752 | |
| 753 | - $comments_li = geodir_get_recent_reviews(30, $count, 100, false); |
|
| 753 | + $comments_li = geodir_get_recent_reviews(30, $count, 100, false); |
|
| 754 | 754 | |
| 755 | - if ($comments_li) { |
|
| 756 | - if ($title != '') { ?> |
|
| 755 | + if ($comments_li) { |
|
| 756 | + if ($title != '') { ?> |
|
| 757 | 757 | <h3 class="geodir-sc-recent-reviews-title widget-title"><?php echo $title; ?></h3> |
| 758 | 758 | <?php } ?> |
| 759 | 759 | <div class="geodir_sc_recent_reviews_section"> |
| 760 | 760 | <ul class="geodir_sc_recent_reviews"><?php echo $comments_li; ?></ul> |
| 761 | 761 | </div> |
| 762 | 762 | <?php |
| 763 | - } |
|
| 764 | - $output = ob_get_contents(); |
|
| 763 | + } |
|
| 764 | + $output = ob_get_contents(); |
|
| 765 | 765 | |
| 766 | - ob_end_clean(); |
|
| 766 | + ob_end_clean(); |
|
| 767 | 767 | |
| 768 | - return $output; |
|
| 768 | + return $output; |
|
| 769 | 769 | } |
| 770 | 770 | |
| 771 | 771 | add_shortcode('gd_related_listings', 'geodir_sc_related_listings'); |
@@ -795,64 +795,64 @@ discard block |
||
| 795 | 795 | */ |
| 796 | 796 | function geodir_sc_related_listings($atts) |
| 797 | 797 | { |
| 798 | - ob_start(); |
|
| 799 | - $defaults = array( |
|
| 800 | - 'post_number' => 5, |
|
| 801 | - 'relate_to' => 'category', |
|
| 802 | - 'layout' => 'gridview_onehalf', |
|
| 803 | - 'add_location_filter' => 0, |
|
| 804 | - 'listing_width' => '', |
|
| 805 | - 'list_sort' => 'latest', |
|
| 806 | - 'character_count' => 20, |
|
| 807 | - 'is_widget' => 1, |
|
| 808 | - 'before_title' => '<style type="text/css">.geodir_category_list_view li{margin:0px!important}</style>', |
|
| 809 | - ); |
|
| 810 | - // The "before_title" code is an ugly & terrible hack. But it works for now. I should enqueue a new stylesheet. |
|
| 811 | - |
|
| 812 | - $params = shortcode_atts($defaults, $atts); |
|
| 813 | - |
|
| 814 | - /** |
|
| 815 | - * Begin validating parameters |
|
| 816 | - */ |
|
| 798 | + ob_start(); |
|
| 799 | + $defaults = array( |
|
| 800 | + 'post_number' => 5, |
|
| 801 | + 'relate_to' => 'category', |
|
| 802 | + 'layout' => 'gridview_onehalf', |
|
| 803 | + 'add_location_filter' => 0, |
|
| 804 | + 'listing_width' => '', |
|
| 805 | + 'list_sort' => 'latest', |
|
| 806 | + 'character_count' => 20, |
|
| 807 | + 'is_widget' => 1, |
|
| 808 | + 'before_title' => '<style type="text/css">.geodir_category_list_view li{margin:0px!important}</style>', |
|
| 809 | + ); |
|
| 810 | + // The "before_title" code is an ugly & terrible hack. But it works for now. I should enqueue a new stylesheet. |
|
| 811 | + |
|
| 812 | + $params = shortcode_atts($defaults, $atts); |
|
| 813 | + |
|
| 814 | + /** |
|
| 815 | + * Begin validating parameters |
|
| 816 | + */ |
|
| 817 | 817 | |
| 818 | - // Validate that post_number is a number and is 1 or higher |
|
| 819 | - $params['post_number'] = absint($params['post_number']); |
|
| 820 | - if (0 === $params['post_number']) { |
|
| 821 | - $params['post_number'] = 1; |
|
| 822 | - } |
|
| 818 | + // Validate that post_number is a number and is 1 or higher |
|
| 819 | + $params['post_number'] = absint($params['post_number']); |
|
| 820 | + if (0 === $params['post_number']) { |
|
| 821 | + $params['post_number'] = 1; |
|
| 822 | + } |
|
| 823 | 823 | |
| 824 | - // Validate relate_to - only category or tags |
|
| 825 | - $params['relate_to'] = geodir_strtolower($params['relate_to']); |
|
| 826 | - if ('category' != $params['relate_to'] && 'tags' != $params['relate_to']) { |
|
| 827 | - $params['relate_to'] = 'category'; |
|
| 828 | - } |
|
| 824 | + // Validate relate_to - only category or tags |
|
| 825 | + $params['relate_to'] = geodir_strtolower($params['relate_to']); |
|
| 826 | + if ('category' != $params['relate_to'] && 'tags' != $params['relate_to']) { |
|
| 827 | + $params['relate_to'] = 'category'; |
|
| 828 | + } |
|
| 829 | 829 | |
| 830 | - // Validate layout selection |
|
| 831 | - $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
| 830 | + // Validate layout selection |
|
| 831 | + $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
| 832 | 832 | |
| 833 | - // Validate sorting option |
|
| 834 | - $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
| 833 | + // Validate sorting option |
|
| 834 | + $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
| 835 | 835 | |
| 836 | - // Validate add_location_filter |
|
| 837 | - $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
| 836 | + // Validate add_location_filter |
|
| 837 | + $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
| 838 | 838 | |
| 839 | - // Validate listing_width |
|
| 840 | - $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
| 839 | + // Validate listing_width |
|
| 840 | + $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
| 841 | 841 | |
| 842 | - // Validate character_count |
|
| 843 | - $params['character_count'] = absint($params['character_count']); |
|
| 844 | - if (20 > $params['character_count']) { |
|
| 845 | - $params['character_count'] = 20; |
|
| 846 | - } |
|
| 842 | + // Validate character_count |
|
| 843 | + $params['character_count'] = absint($params['character_count']); |
|
| 844 | + if (20 > $params['character_count']) { |
|
| 845 | + $params['character_count'] = 20; |
|
| 846 | + } |
|
| 847 | 847 | |
| 848 | - if ($related_display = geodir_related_posts_display($params)) { |
|
| 849 | - echo $related_display; |
|
| 850 | - } |
|
| 851 | - $output = ob_get_contents(); |
|
| 848 | + if ($related_display = geodir_related_posts_display($params)) { |
|
| 849 | + echo $related_display; |
|
| 850 | + } |
|
| 851 | + $output = ob_get_contents(); |
|
| 852 | 852 | |
| 853 | - ob_end_clean(); |
|
| 853 | + ob_end_clean(); |
|
| 854 | 854 | |
| 855 | - return $output; |
|
| 855 | + return $output; |
|
| 856 | 856 | } |
| 857 | 857 | |
| 858 | 858 | /** |
@@ -876,13 +876,13 @@ discard block |
||
| 876 | 876 | * @return string Advanced search widget HTML. |
| 877 | 877 | */ |
| 878 | 878 | function geodir_sc_advanced_search($atts) { |
| 879 | - $defaults = array( |
|
| 879 | + $defaults = array( |
|
| 880 | 880 | 'title' => '', |
| 881 | 881 | 'before_widget' => '<section id="geodir_advanced_search-1" class="widget geodir-widget geodir_advance_search_widget">', |
| 882 | - 'after_widget' => '</section>', |
|
| 883 | - 'before_title' => '<h3 class="widget-title">', |
|
| 884 | - 'after_title' => '</h3>', |
|
| 885 | - 'show_adv_search' => 'default', |
|
| 882 | + 'after_widget' => '</section>', |
|
| 883 | + 'before_title' => '<h3 class="widget-title">', |
|
| 884 | + 'after_title' => '</h3>', |
|
| 885 | + 'show_adv_search' => 'default', |
|
| 886 | 886 | 'post_type' => '' |
| 887 | 887 | ); |
| 888 | 888 | |
@@ -906,9 +906,9 @@ discard block |
||
| 906 | 906 | the_widget('geodir_advance_search_widget', $params, $params ); |
| 907 | 907 | |
| 908 | 908 | $output = ob_get_contents(); |
| 909 | - ob_end_clean(); |
|
| 909 | + ob_end_clean(); |
|
| 910 | 910 | |
| 911 | - return $output; |
|
| 911 | + return $output; |
|
| 912 | 912 | } |
| 913 | 913 | add_shortcode('gd_advanced_search', 'geodir_sc_advanced_search'); |
| 914 | 914 | |
@@ -954,48 +954,48 @@ discard block |
||
| 954 | 954 | 'add_location_filter' => '1', |
| 955 | 955 | 'tab_layout' => 'bestof-tabs-on-top', |
| 956 | 956 | 'before_widget' => '<section id="bestof_widget-1" class="widget geodir-widget geodir_bestof_widget geodir_sc_bestof_widget">', |
| 957 | - 'after_widget' => '</section>', |
|
| 958 | - 'before_title' => '<h3 class="widget-title">', |
|
| 959 | - 'after_title' => '</h3>', |
|
| 957 | + 'after_widget' => '</section>', |
|
| 958 | + 'before_title' => '<h3 class="widget-title">', |
|
| 959 | + 'after_title' => '</h3>', |
|
| 960 | 960 | ); |
| 961 | 961 | $params = shortcode_atts($defaults, $atts); |
| 962 | 962 | |
| 963 | - /** |
|
| 964 | - * Validate our incoming params |
|
| 965 | - */ |
|
| 963 | + /** |
|
| 964 | + * Validate our incoming params |
|
| 965 | + */ |
|
| 966 | 966 | |
| 967 | - // Validate the selected post type, default to gd_place on fail |
|
| 968 | - if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
| 969 | - $params['post_type'] = 'gd_place'; |
|
| 970 | - } |
|
| 967 | + // Validate the selected post type, default to gd_place on fail |
|
| 968 | + if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
| 969 | + $params['post_type'] = 'gd_place'; |
|
| 970 | + } |
|
| 971 | 971 | |
| 972 | 972 | // Post limit needs to be a positive integer |
| 973 | - $params['post_limit'] = absint($params['post_limit']); |
|
| 974 | - if (0 == $params['post_limit']) { |
|
| 975 | - $params['post_limit'] = 5; |
|
| 976 | - } |
|
| 973 | + $params['post_limit'] = absint($params['post_limit']); |
|
| 974 | + if (0 == $params['post_limit']) { |
|
| 975 | + $params['post_limit'] = 5; |
|
| 976 | + } |
|
| 977 | 977 | |
| 978 | 978 | // Category limit needs to be a positive integer |
| 979 | - $params['categ_limit'] = absint($params['categ_limit']); |
|
| 980 | - if (0 == $params['categ_limit']) { |
|
| 981 | - $params['categ_limit'] = 3; |
|
| 982 | - } |
|
| 979 | + $params['categ_limit'] = absint($params['categ_limit']); |
|
| 980 | + if (0 == $params['categ_limit']) { |
|
| 981 | + $params['categ_limit'] = 3; |
|
| 982 | + } |
|
| 983 | 983 | |
| 984 | 984 | // Tab layout validation |
| 985 | - $params['tab_layout'] = $params['tab_layout']; |
|
| 986 | - if (!in_array($params['tab_layout'], array('bestof-tabs-on-top', 'bestof-tabs-on-left', 'bestof-tabs-as-dropdown'))) { |
|
| 987 | - $params['tab_layout'] = 'bestof-tabs-on-top'; |
|
| 988 | - } |
|
| 985 | + $params['tab_layout'] = $params['tab_layout']; |
|
| 986 | + if (!in_array($params['tab_layout'], array('bestof-tabs-on-top', 'bestof-tabs-on-left', 'bestof-tabs-as-dropdown'))) { |
|
| 987 | + $params['tab_layout'] = 'bestof-tabs-on-top'; |
|
| 988 | + } |
|
| 989 | 989 | |
| 990 | 990 | // Validate character_count |
| 991 | - $params['character_count'] = $params['character_count']; |
|
| 991 | + $params['character_count'] = $params['character_count']; |
|
| 992 | 992 | |
| 993 | 993 | ob_start(); |
| 994 | 994 | the_widget('geodir_bestof_widget', $params, $params); |
| 995 | - $output = ob_get_contents(); |
|
| 996 | - ob_end_clean(); |
|
| 995 | + $output = ob_get_contents(); |
|
| 996 | + ob_end_clean(); |
|
| 997 | 997 | |
| 998 | - return $output; |
|
| 998 | + return $output; |
|
| 999 | 999 | } |
| 1000 | 1000 | add_shortcode('gd_bestof_widget', 'geodir_sc_bestof_widget'); |
| 1001 | 1001 | |
@@ -1043,127 +1043,127 @@ discard block |
||
| 1043 | 1043 | * @return string HTML content to display geodirectory listings. |
| 1044 | 1044 | */ |
| 1045 | 1045 | function geodir_sc_gd_listings($atts, $content = '') { |
| 1046 | - global $post; |
|
| 1047 | - $defaults = array( |
|
| 1048 | - 'title' => '', |
|
| 1049 | - 'post_type' => 'gd_place', |
|
| 1050 | - 'category' => 0, |
|
| 1051 | - 'list_sort' => 'latest', |
|
| 1052 | - 'event_type' => '', |
|
| 1053 | - 'post_number' => 10, |
|
| 1054 | - 'post_author' => '', |
|
| 1055 | - 'layout' => 'gridview_onehalf', |
|
| 1056 | - 'listing_width' => '', |
|
| 1057 | - 'character_count' => 20, |
|
| 1058 | - 'add_location_filter' => 1, |
|
| 1059 | - 'show_featured_only' => '', |
|
| 1060 | - 'show_special_only' => '', |
|
| 1061 | - 'with_pics_only' => '', |
|
| 1062 | - 'with_videos_only' => '', |
|
| 1063 | - 'with_pagination' => '1', |
|
| 1064 | - 'top_pagination' => '0', |
|
| 1065 | - 'bottom_pagination' => '1', |
|
| 1066 | - 'without_no_results' => 0, |
|
| 1067 | - 'tags' => '' |
|
| 1068 | - ); |
|
| 1069 | - $params = shortcode_atts($defaults, $atts); |
|
| 1070 | - |
|
| 1071 | - $params['title'] = wp_strip_all_tags($params['title']); |
|
| 1072 | - $params['post_type'] = gdsc_is_post_type_valid($params['post_type']) ? $params['post_type'] : 'gd_place'; |
|
| 1073 | - |
|
| 1074 | - // Validate the selected category/ies - Grab the current list based on post_type |
|
| 1075 | - $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
| 1076 | - $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids')); |
|
| 1077 | - |
|
| 1078 | - // Make sure we have an array |
|
| 1079 | - if (!(is_array($params['category']))) { |
|
| 1080 | - $params['category'] = explode(',', $params['category']); |
|
| 1081 | - } |
|
| 1082 | - |
|
| 1083 | - // Array_intersect returns only the items in $params['category'] that are also in our category list |
|
| 1084 | - // Otherwise it becomes empty and later on that will mean "All" |
|
| 1085 | - $params['category'] = array_intersect($params['category'], $categories); |
|
| 1086 | - |
|
| 1087 | - // Post_number needs to be a positive integer |
|
| 1088 | - $params['post_number'] = absint($params['post_number']); |
|
| 1089 | - $params['post_number'] = $params['post_number'] > 0 ? $params['post_number'] : 10; |
|
| 1046 | + global $post; |
|
| 1047 | + $defaults = array( |
|
| 1048 | + 'title' => '', |
|
| 1049 | + 'post_type' => 'gd_place', |
|
| 1050 | + 'category' => 0, |
|
| 1051 | + 'list_sort' => 'latest', |
|
| 1052 | + 'event_type' => '', |
|
| 1053 | + 'post_number' => 10, |
|
| 1054 | + 'post_author' => '', |
|
| 1055 | + 'layout' => 'gridview_onehalf', |
|
| 1056 | + 'listing_width' => '', |
|
| 1057 | + 'character_count' => 20, |
|
| 1058 | + 'add_location_filter' => 1, |
|
| 1059 | + 'show_featured_only' => '', |
|
| 1060 | + 'show_special_only' => '', |
|
| 1061 | + 'with_pics_only' => '', |
|
| 1062 | + 'with_videos_only' => '', |
|
| 1063 | + 'with_pagination' => '1', |
|
| 1064 | + 'top_pagination' => '0', |
|
| 1065 | + 'bottom_pagination' => '1', |
|
| 1066 | + 'without_no_results' => 0, |
|
| 1067 | + 'tags' => '' |
|
| 1068 | + ); |
|
| 1069 | + $params = shortcode_atts($defaults, $atts); |
|
| 1070 | + |
|
| 1071 | + $params['title'] = wp_strip_all_tags($params['title']); |
|
| 1072 | + $params['post_type'] = gdsc_is_post_type_valid($params['post_type']) ? $params['post_type'] : 'gd_place'; |
|
| 1073 | + |
|
| 1074 | + // Validate the selected category/ies - Grab the current list based on post_type |
|
| 1075 | + $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
| 1076 | + $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids')); |
|
| 1077 | + |
|
| 1078 | + // Make sure we have an array |
|
| 1079 | + if (!(is_array($params['category']))) { |
|
| 1080 | + $params['category'] = explode(',', $params['category']); |
|
| 1081 | + } |
|
| 1082 | + |
|
| 1083 | + // Array_intersect returns only the items in $params['category'] that are also in our category list |
|
| 1084 | + // Otherwise it becomes empty and later on that will mean "All" |
|
| 1085 | + $params['category'] = array_intersect($params['category'], $categories); |
|
| 1086 | + |
|
| 1087 | + // Post_number needs to be a positive integer |
|
| 1088 | + $params['post_number'] = absint($params['post_number']); |
|
| 1089 | + $params['post_number'] = $params['post_number'] > 0 ? $params['post_number'] : 10; |
|
| 1090 | 1090 | |
| 1091 | - // Post_number needs to be a positive integer |
|
| 1092 | - if (!empty($atts['post_author'])) { |
|
| 1093 | - if ($atts['post_author'] == 'current' && !empty($post) && isset($post->post_author) && $post->post_type != 'page') { |
|
| 1094 | - $params['post_author'] = $post->post_author; |
|
| 1095 | - } else if ($atts['post_author'] != 'current' && absint($atts['post_author']) > 0) { |
|
| 1096 | - $params['post_author'] = absint($atts['post_author']); |
|
| 1097 | - } else { |
|
| 1098 | - unset($params['post_author']); |
|
| 1099 | - } |
|
| 1100 | - } else { |
|
| 1101 | - unset($params['post_author']); |
|
| 1102 | - } |
|
| 1103 | - |
|
| 1104 | - // Validate character_count |
|
| 1105 | - //todo: is this necessary? |
|
| 1106 | - $params['character_count'] = $params['character_count']; |
|
| 1107 | - |
|
| 1108 | - // Validate our layout choice |
|
| 1109 | - // Outside of the norm, I added some more simple terms to match the existing |
|
| 1110 | - // So now I just run the switch to set it properly. |
|
| 1111 | - $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
| 1112 | - |
|
| 1113 | - // Validate our sorting choice |
|
| 1114 | - $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
| 1115 | - |
|
| 1116 | - // Validate Listing width, used in the template widget-listing-listview.php |
|
| 1117 | - // The context is in width=$listing_width% - So we need a positive number between 0 & 100 |
|
| 1118 | - $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
| 1119 | - |
|
| 1120 | - // Validate the checkboxes used on the widget |
|
| 1121 | - $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
| 1122 | - $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']); |
|
| 1123 | - $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']); |
|
| 1124 | - $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']); |
|
| 1125 | - $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']); |
|
| 1126 | - $params['with_pagination'] = gdsc_to_bool_val($params['with_pagination']); |
|
| 1127 | - $params['top_pagination'] = gdsc_to_bool_val($params['top_pagination']); |
|
| 1128 | - $params['bottom_pagination'] = gdsc_to_bool_val($params['bottom_pagination']); |
|
| 1129 | - |
|
| 1130 | - // Clean tags |
|
| 1131 | - if (!empty($params['tags'])) { |
|
| 1132 | - if (!is_array($params['tags'])) { |
|
| 1133 | - $comma = _x(',', 'tag delimiter'); |
|
| 1134 | - if ( ',' !== $comma ) { |
|
| 1135 | - $params['tags'] = str_replace($comma, ',', $params['tags']); |
|
| 1136 | - } |
|
| 1137 | - $params['tags'] = explode(',', trim($params['tags'], " \n\t\r\0\x0B,")); |
|
| 1138 | - $params['tags'] = array_map('trim', $params['tags']); |
|
| 1139 | - } |
|
| 1140 | - } else { |
|
| 1141 | - $params['tags'] = array(); |
|
| 1142 | - } |
|
| 1143 | - |
|
| 1144 | - /** |
|
| 1145 | - * End of validation |
|
| 1146 | - */ |
|
| 1147 | - if (isset($atts['geodir_ajax'])) { |
|
| 1148 | - $params['geodir_ajax'] = $atts['geodir_ajax']; |
|
| 1149 | - unset($atts['geodir_ajax']); |
|
| 1150 | - } |
|
| 1151 | - if (isset($atts['pageno'])) { |
|
| 1152 | - $params['pageno'] = $atts['pageno']; |
|
| 1153 | - unset($atts['pageno']); |
|
| 1154 | - } |
|
| 1155 | - |
|
| 1156 | - if ( !empty($atts['shortcode_content']) ) { |
|
| 1157 | - $content = $atts['shortcode_content']; |
|
| 1158 | - } |
|
| 1159 | - $params['shortcode_content'] = trim($content); |
|
| 1160 | - $atts['shortcode_content'] = trim($content); |
|
| 1091 | + // Post_number needs to be a positive integer |
|
| 1092 | + if (!empty($atts['post_author'])) { |
|
| 1093 | + if ($atts['post_author'] == 'current' && !empty($post) && isset($post->post_author) && $post->post_type != 'page') { |
|
| 1094 | + $params['post_author'] = $post->post_author; |
|
| 1095 | + } else if ($atts['post_author'] != 'current' && absint($atts['post_author']) > 0) { |
|
| 1096 | + $params['post_author'] = absint($atts['post_author']); |
|
| 1097 | + } else { |
|
| 1098 | + unset($params['post_author']); |
|
| 1099 | + } |
|
| 1100 | + } else { |
|
| 1101 | + unset($params['post_author']); |
|
| 1102 | + } |
|
| 1103 | + |
|
| 1104 | + // Validate character_count |
|
| 1105 | + //todo: is this necessary? |
|
| 1106 | + $params['character_count'] = $params['character_count']; |
|
| 1107 | + |
|
| 1108 | + // Validate our layout choice |
|
| 1109 | + // Outside of the norm, I added some more simple terms to match the existing |
|
| 1110 | + // So now I just run the switch to set it properly. |
|
| 1111 | + $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
| 1112 | + |
|
| 1113 | + // Validate our sorting choice |
|
| 1114 | + $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
| 1115 | + |
|
| 1116 | + // Validate Listing width, used in the template widget-listing-listview.php |
|
| 1117 | + // The context is in width=$listing_width% - So we need a positive number between 0 & 100 |
|
| 1118 | + $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
| 1119 | + |
|
| 1120 | + // Validate the checkboxes used on the widget |
|
| 1121 | + $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
| 1122 | + $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']); |
|
| 1123 | + $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']); |
|
| 1124 | + $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']); |
|
| 1125 | + $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']); |
|
| 1126 | + $params['with_pagination'] = gdsc_to_bool_val($params['with_pagination']); |
|
| 1127 | + $params['top_pagination'] = gdsc_to_bool_val($params['top_pagination']); |
|
| 1128 | + $params['bottom_pagination'] = gdsc_to_bool_val($params['bottom_pagination']); |
|
| 1129 | + |
|
| 1130 | + // Clean tags |
|
| 1131 | + if (!empty($params['tags'])) { |
|
| 1132 | + if (!is_array($params['tags'])) { |
|
| 1133 | + $comma = _x(',', 'tag delimiter'); |
|
| 1134 | + if ( ',' !== $comma ) { |
|
| 1135 | + $params['tags'] = str_replace($comma, ',', $params['tags']); |
|
| 1136 | + } |
|
| 1137 | + $params['tags'] = explode(',', trim($params['tags'], " \n\t\r\0\x0B,")); |
|
| 1138 | + $params['tags'] = array_map('trim', $params['tags']); |
|
| 1139 | + } |
|
| 1140 | + } else { |
|
| 1141 | + $params['tags'] = array(); |
|
| 1142 | + } |
|
| 1143 | + |
|
| 1144 | + /** |
|
| 1145 | + * End of validation |
|
| 1146 | + */ |
|
| 1147 | + if (isset($atts['geodir_ajax'])) { |
|
| 1148 | + $params['geodir_ajax'] = $atts['geodir_ajax']; |
|
| 1149 | + unset($atts['geodir_ajax']); |
|
| 1150 | + } |
|
| 1151 | + if (isset($atts['pageno'])) { |
|
| 1152 | + $params['pageno'] = $atts['pageno']; |
|
| 1153 | + unset($atts['pageno']); |
|
| 1154 | + } |
|
| 1155 | + |
|
| 1156 | + if ( !empty($atts['shortcode_content']) ) { |
|
| 1157 | + $content = $atts['shortcode_content']; |
|
| 1158 | + } |
|
| 1159 | + $params['shortcode_content'] = trim($content); |
|
| 1160 | + $atts['shortcode_content'] = trim($content); |
|
| 1161 | 1161 | |
| 1162 | - $params['shortcode_atts'] = $atts; |
|
| 1162 | + $params['shortcode_atts'] = $atts; |
|
| 1163 | 1163 | |
| 1164 | - $output = geodir_sc_gd_listings_output($params); |
|
| 1164 | + $output = geodir_sc_gd_listings_output($params); |
|
| 1165 | 1165 | |
| 1166 | - return $output; |
|
| 1166 | + return $output; |
|
| 1167 | 1167 | } |
| 1168 | 1168 | add_shortcode('gd_listings', 'geodir_sc_gd_listings'); |
| 1169 | 1169 | |
@@ -1203,56 +1203,56 @@ discard block |
||
| 1203 | 1203 | * @return string HTML content to display CPT categories. |
| 1204 | 1204 | */ |
| 1205 | 1205 | function geodir_sc_cpt_categories_widget($atts, $content = '') { |
| 1206 | - $defaults = array( |
|
| 1207 | - 'title' => '', |
|
| 1208 | - 'post_type' => '', // NULL for all |
|
| 1209 | - 'hide_empty' => '', |
|
| 1210 | - 'show_count' => '', |
|
| 1211 | - 'hide_icon' => '', |
|
| 1212 | - 'cpt_left' => '', |
|
| 1213 | - 'sort_by' => 'count', |
|
| 1214 | - 'max_count' => 'all', |
|
| 1215 | - 'max_level' => '1', |
|
| 1216 | - 'no_cpt_filter' => '', |
|
| 1217 | - 'no_cat_filter' => '', |
|
| 1218 | - 'before_widget' => '<section id="geodir_cpt_categories_widget-1" class="widget geodir-widget geodir_cpt_categories_widget geodir_sc_cpt_categories_widget">', |
|
| 1219 | - 'after_widget' => '</section>', |
|
| 1220 | - 'before_title' => '<h3 class="widget-title">', |
|
| 1221 | - 'after_title' => '</h3>', |
|
| 1222 | - ); |
|
| 1223 | - $params = shortcode_atts($defaults, $atts); |
|
| 1224 | - |
|
| 1225 | - /** |
|
| 1226 | - * Validate our incoming params |
|
| 1227 | - */ |
|
| 1228 | - // Make sure we have an array |
|
| 1229 | - $params['post_type'] = !is_array($params['post_type']) && trim($params['post_type']) != '' ? explode(',', trim($params['post_type'])) : array(); |
|
| 1230 | - |
|
| 1231 | - // Validate the checkboxes used on the widget |
|
| 1232 | - $params['hide_empty'] = gdsc_to_bool_val($params['hide_empty']); |
|
| 1233 | - $params['show_count'] = gdsc_to_bool_val($params['show_count']); |
|
| 1234 | - $params['hide_icon'] = gdsc_to_bool_val($params['hide_icon']); |
|
| 1235 | - $params['cpt_left'] = gdsc_to_bool_val($params['cpt_left']); |
|
| 1206 | + $defaults = array( |
|
| 1207 | + 'title' => '', |
|
| 1208 | + 'post_type' => '', // NULL for all |
|
| 1209 | + 'hide_empty' => '', |
|
| 1210 | + 'show_count' => '', |
|
| 1211 | + 'hide_icon' => '', |
|
| 1212 | + 'cpt_left' => '', |
|
| 1213 | + 'sort_by' => 'count', |
|
| 1214 | + 'max_count' => 'all', |
|
| 1215 | + 'max_level' => '1', |
|
| 1216 | + 'no_cpt_filter' => '', |
|
| 1217 | + 'no_cat_filter' => '', |
|
| 1218 | + 'before_widget' => '<section id="geodir_cpt_categories_widget-1" class="widget geodir-widget geodir_cpt_categories_widget geodir_sc_cpt_categories_widget">', |
|
| 1219 | + 'after_widget' => '</section>', |
|
| 1220 | + 'before_title' => '<h3 class="widget-title">', |
|
| 1221 | + 'after_title' => '</h3>', |
|
| 1222 | + ); |
|
| 1223 | + $params = shortcode_atts($defaults, $atts); |
|
| 1236 | 1224 | |
| 1237 | - if ($params['max_count'] != 'all') { |
|
| 1238 | - $params['max_count'] = absint($params['max_count']); |
|
| 1239 | - } |
|
| 1225 | + /** |
|
| 1226 | + * Validate our incoming params |
|
| 1227 | + */ |
|
| 1228 | + // Make sure we have an array |
|
| 1229 | + $params['post_type'] = !is_array($params['post_type']) && trim($params['post_type']) != '' ? explode(',', trim($params['post_type'])) : array(); |
|
| 1230 | + |
|
| 1231 | + // Validate the checkboxes used on the widget |
|
| 1232 | + $params['hide_empty'] = gdsc_to_bool_val($params['hide_empty']); |
|
| 1233 | + $params['show_count'] = gdsc_to_bool_val($params['show_count']); |
|
| 1234 | + $params['hide_icon'] = gdsc_to_bool_val($params['hide_icon']); |
|
| 1235 | + $params['cpt_left'] = gdsc_to_bool_val($params['cpt_left']); |
|
| 1236 | + |
|
| 1237 | + if ($params['max_count'] != 'all') { |
|
| 1238 | + $params['max_count'] = absint($params['max_count']); |
|
| 1239 | + } |
|
| 1240 | 1240 | |
| 1241 | - if ($params['max_level'] != 'all') { |
|
| 1242 | - $params['max_level'] = absint($params['max_level']); |
|
| 1243 | - } |
|
| 1241 | + if ($params['max_level'] != 'all') { |
|
| 1242 | + $params['max_level'] = absint($params['max_level']); |
|
| 1243 | + } |
|
| 1244 | 1244 | |
| 1245 | - $params['no_cpt_filter'] = gdsc_to_bool_val($params['no_cpt_filter']); |
|
| 1246 | - $params['no_cat_filter'] = gdsc_to_bool_val($params['no_cat_filter']); |
|
| 1245 | + $params['no_cpt_filter'] = gdsc_to_bool_val($params['no_cpt_filter']); |
|
| 1246 | + $params['no_cat_filter'] = gdsc_to_bool_val($params['no_cat_filter']); |
|
| 1247 | 1247 | |
| 1248 | - $params['sort_by'] = $params['sort_by'] == 'az' ? 'az' : 'count'; |
|
| 1248 | + $params['sort_by'] = $params['sort_by'] == 'az' ? 'az' : 'count'; |
|
| 1249 | 1249 | |
| 1250 | - ob_start(); |
|
| 1251 | - the_widget('geodir_cpt_categories_widget', $params, $params); |
|
| 1252 | - $output = ob_get_contents(); |
|
| 1253 | - ob_end_clean(); |
|
| 1250 | + ob_start(); |
|
| 1251 | + the_widget('geodir_cpt_categories_widget', $params, $params); |
|
| 1252 | + $output = ob_get_contents(); |
|
| 1253 | + ob_end_clean(); |
|
| 1254 | 1254 | |
| 1255 | - return $output; |
|
| 1255 | + return $output; |
|
| 1256 | 1256 | } |
| 1257 | 1257 | add_shortcode('gd_cpt_categories', 'geodir_sc_cpt_categories_widget'); |
| 1258 | 1258 | |
@@ -1267,7 +1267,7 @@ discard block |
||
| 1267 | 1267 | * @return string HTML code. |
| 1268 | 1268 | */ |
| 1269 | 1269 | function geodir_sc_responsive_videos($atts, $content) { |
| 1270 | - return '<div class="geodir-video-wrapper">'.$content.'</div>'; |
|
| 1270 | + return '<div class="geodir-video-wrapper">'.$content.'</div>'; |
|
| 1271 | 1271 | } |
| 1272 | 1272 | add_shortcode('gd_video', 'geodir_sc_responsive_videos'); |
| 1273 | 1273 | ?> |
| 1274 | 1274 | \ No newline at end of file |
@@ -13,29 +13,29 @@ discard block |
||
| 13 | 13 | */ |
| 14 | 14 | function geodir_register_taxonomies() |
| 15 | 15 | {
|
| 16 | - $taxonomies = array(); |
|
| 17 | - $taxonomies = get_option('geodir_taxonomies');
|
|
| 18 | - // If custom taxonomies are present, register them |
|
| 19 | - if (is_array($taxonomies)) {
|
|
| 20 | - // Sort taxonomies |
|
| 21 | - ksort($taxonomies); |
|
| 22 | - |
|
| 23 | - // Register taxonomies |
|
| 24 | - foreach ($taxonomies as $taxonomy => $args) {
|
|
| 25 | - // Allow taxonomy names to be translated |
|
| 26 | - if (!empty($args['args']['labels'])) {
|
|
| 27 | - foreach ($args['args']['labels'] as $key => $tax_label) {
|
|
| 28 | - $args['args']['labels'][$key] = __($tax_label, 'geodirectory'); |
|
| 29 | - } |
|
| 30 | - } |
|
| 31 | - |
|
| 32 | - $tax = register_taxonomy($taxonomy, $args['object_type'], $args['args']); |
|
| 33 | - |
|
| 34 | - if (taxonomy_exists($taxonomy)) {
|
|
| 35 | - $tax = register_taxonomy_for_object_type($taxonomy, $args['object_type']); |
|
| 36 | - } |
|
| 37 | - } |
|
| 38 | - } |
|
| 16 | + $taxonomies = array(); |
|
| 17 | + $taxonomies = get_option('geodir_taxonomies');
|
|
| 18 | + // If custom taxonomies are present, register them |
|
| 19 | + if (is_array($taxonomies)) {
|
|
| 20 | + // Sort taxonomies |
|
| 21 | + ksort($taxonomies); |
|
| 22 | + |
|
| 23 | + // Register taxonomies |
|
| 24 | + foreach ($taxonomies as $taxonomy => $args) {
|
|
| 25 | + // Allow taxonomy names to be translated |
|
| 26 | + if (!empty($args['args']['labels'])) {
|
|
| 27 | + foreach ($args['args']['labels'] as $key => $tax_label) {
|
|
| 28 | + $args['args']['labels'][$key] = __($tax_label, 'geodirectory'); |
|
| 29 | + } |
|
| 30 | + } |
|
| 31 | + |
|
| 32 | + $tax = register_taxonomy($taxonomy, $args['object_type'], $args['args']); |
|
| 33 | + |
|
| 34 | + if (taxonomy_exists($taxonomy)) {
|
|
| 35 | + $tax = register_taxonomy_for_object_type($taxonomy, $args['object_type']); |
|
| 36 | + } |
|
| 37 | + } |
|
| 38 | + } |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | |
@@ -53,40 +53,40 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | function geodir_register_post_types() |
| 55 | 55 | {
|
| 56 | - global $wp_post_types; |
|
| 56 | + global $wp_post_types; |
|
| 57 | 57 | |
| 58 | - $post_types = array(); |
|
| 59 | - $post_types = get_option('geodir_post_types');
|
|
| 58 | + $post_types = array(); |
|
| 59 | + $post_types = get_option('geodir_post_types');
|
|
| 60 | 60 | |
| 61 | - // Register each post type if array of data is returned |
|
| 62 | - if (is_array($post_types)): |
|
| 61 | + // Register each post type if array of data is returned |
|
| 62 | + if (is_array($post_types)): |
|
| 63 | 63 | |
| 64 | - foreach ($post_types as $post_type => $args): |
|
| 64 | + foreach ($post_types as $post_type => $args): |
|
| 65 | 65 | |
| 66 | - if (!empty($args['rewrite']['slug'])) {
|
|
| 67 | - $args['rewrite']['slug'] = _x($args['rewrite']['slug'], 'URL slug', 'geodirectory'); |
|
| 68 | - } |
|
| 69 | - $args = stripslashes_deep($args); |
|
| 66 | + if (!empty($args['rewrite']['slug'])) {
|
|
| 67 | + $args['rewrite']['slug'] = _x($args['rewrite']['slug'], 'URL slug', 'geodirectory'); |
|
| 68 | + } |
|
| 69 | + $args = stripslashes_deep($args); |
|
| 70 | 70 | |
| 71 | - if (!empty($args['labels'])) {
|
|
| 72 | - foreach ($args['labels'] as $key => $val) {
|
|
| 73 | - $args['labels'][$key] = __($val, 'geodirectory');// allow translation |
|
| 74 | - } |
|
| 75 | - } |
|
| 71 | + if (!empty($args['labels'])) {
|
|
| 72 | + foreach ($args['labels'] as $key => $val) {
|
|
| 73 | + $args['labels'][$key] = __($val, 'geodirectory');// allow translation |
|
| 74 | + } |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | - /** |
|
| 78 | - * Filter post type args. |
|
| 79 | - * |
|
| 80 | - * @since 1.0.0 |
|
| 81 | - * @param string $args Post type args. |
|
| 82 | - * @param string $post_type The post type. |
|
| 83 | - */ |
|
| 84 | - $args = apply_filters('geodir_post_type_args', $args, $post_type);
|
|
| 77 | + /** |
|
| 78 | + * Filter post type args. |
|
| 79 | + * |
|
| 80 | + * @since 1.0.0 |
|
| 81 | + * @param string $args Post type args. |
|
| 82 | + * @param string $post_type The post type. |
|
| 83 | + */ |
|
| 84 | + $args = apply_filters('geodir_post_type_args', $args, $post_type);
|
|
| 85 | 85 | |
| 86 | - $post_type = register_post_type($post_type, $args); |
|
| 86 | + $post_type = register_post_type($post_type, $args); |
|
| 87 | 87 | |
| 88 | - endforeach; |
|
| 89 | - endif; |
|
| 88 | + endforeach; |
|
| 89 | + endif; |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /** |
@@ -100,72 +100,72 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | function geodir_post_type_args_modify($args, $post_type) |
| 102 | 102 | {
|
| 103 | - $geodir_location_prefix = isset($_REQUEST['geodir_location_prefix']) ? trim($_REQUEST['geodir_location_prefix']) : get_option('geodir_location_prefix');
|
|
| 103 | + $geodir_location_prefix = isset($_REQUEST['geodir_location_prefix']) ? trim($_REQUEST['geodir_location_prefix']) : get_option('geodir_location_prefix');
|
|
| 104 | 104 | if (isset($_REQUEST['geodir_listing_prefix']) && $_REQUEST['geodir_listing_prefix'] != '' && geodir_strtolower($_REQUEST['geodir_listing_prefix']) != geodir_strtolower($geodir_location_prefix)) {
|
| 105 | 105 | |
| 106 | - $listing_slug = htmlentities(trim($_REQUEST['geodir_listing_prefix'])); |
|
| 106 | + $listing_slug = htmlentities(trim($_REQUEST['geodir_listing_prefix'])); |
|
| 107 | 107 | |
| 108 | - if ($post_type == 'gd_place') {
|
|
| 109 | - if (array_key_exists('has_archive', $args))
|
|
| 110 | - $args['has_archive'] = $listing_slug; |
|
| 108 | + if ($post_type == 'gd_place') {
|
|
| 109 | + if (array_key_exists('has_archive', $args))
|
|
| 110 | + $args['has_archive'] = $listing_slug; |
|
| 111 | 111 | |
| 112 | - if (array_key_exists('rewrite', $args)) {
|
|
| 113 | - if (array_key_exists('slug', $args['rewrite']))
|
|
| 114 | - $args['rewrite']['slug'] = $listing_slug;// . '/%gd_taxonomy%'; |
|
| 115 | - } |
|
| 112 | + if (array_key_exists('rewrite', $args)) {
|
|
| 113 | + if (array_key_exists('slug', $args['rewrite']))
|
|
| 114 | + $args['rewrite']['slug'] = $listing_slug;// . '/%gd_taxonomy%'; |
|
| 115 | + } |
|
| 116 | 116 | |
| 117 | - $geodir_post_types = get_option('geodir_post_types');
|
|
| 117 | + $geodir_post_types = get_option('geodir_post_types');
|
|
| 118 | 118 | |
| 119 | - if (array_key_exists($post_type, $geodir_post_types)) {
|
|
| 119 | + if (array_key_exists($post_type, $geodir_post_types)) {
|
|
| 120 | 120 | |
| 121 | - if (array_key_exists('has_archive', $geodir_post_types[$post_type]))
|
|
| 122 | - $geodir_post_types[$post_type]['has_archive'] = $listing_slug; |
|
| 121 | + if (array_key_exists('has_archive', $geodir_post_types[$post_type]))
|
|
| 122 | + $geodir_post_types[$post_type]['has_archive'] = $listing_slug; |
|
| 123 | 123 | |
| 124 | - if (array_key_exists('rewrite', $geodir_post_types[$post_type]))
|
|
| 125 | - if (array_key_exists('slug', $geodir_post_types[$post_type]['rewrite']))
|
|
| 126 | - $geodir_post_types[$post_type]['rewrite']['slug'] = $listing_slug;// . '/%gd_taxonomy%'; |
|
| 124 | + if (array_key_exists('rewrite', $geodir_post_types[$post_type]))
|
|
| 125 | + if (array_key_exists('slug', $geodir_post_types[$post_type]['rewrite']))
|
|
| 126 | + $geodir_post_types[$post_type]['rewrite']['slug'] = $listing_slug;// . '/%gd_taxonomy%'; |
|
| 127 | 127 | |
| 128 | - update_option('geodir_post_types', $geodir_post_types);
|
|
| 128 | + update_option('geodir_post_types', $geodir_post_types);
|
|
| 129 | 129 | |
| 130 | - } |
|
| 130 | + } |
|
| 131 | 131 | |
| 132 | - $geodir_post_types = get_option('geodir_post_types');
|
|
| 132 | + $geodir_post_types = get_option('geodir_post_types');
|
|
| 133 | 133 | |
| 134 | - /* --- update taxonomies (category) --- */ |
|
| 134 | + /* --- update taxonomies (category) --- */ |
|
| 135 | 135 | |
| 136 | - $geodir_taxonomies = get_option('geodir_taxonomies');
|
|
| 136 | + $geodir_taxonomies = get_option('geodir_taxonomies');
|
|
| 137 | 137 | |
| 138 | - if (array_key_exists('listing_slug', $geodir_taxonomies[$post_type . 'category'])) {
|
|
| 139 | - $geodir_taxonomies[$post_type . 'category']['listing_slug'] = $listing_slug; |
|
| 138 | + if (array_key_exists('listing_slug', $geodir_taxonomies[$post_type . 'category'])) {
|
|
| 139 | + $geodir_taxonomies[$post_type . 'category']['listing_slug'] = $listing_slug; |
|
| 140 | 140 | |
| 141 | - if (array_key_exists('args', $geodir_taxonomies[$post_type . 'category']))
|
|
| 142 | - if (array_key_exists('rewrite', $geodir_taxonomies[$post_type . 'category']['args']))
|
|
| 143 | - if (array_key_exists('slug', $geodir_taxonomies[$post_type . 'category']['args']['rewrite']))
|
|
| 144 | - $geodir_taxonomies[$post_type . 'category']['args']['rewrite']['slug'] = $listing_slug; |
|
| 141 | + if (array_key_exists('args', $geodir_taxonomies[$post_type . 'category']))
|
|
| 142 | + if (array_key_exists('rewrite', $geodir_taxonomies[$post_type . 'category']['args']))
|
|
| 143 | + if (array_key_exists('slug', $geodir_taxonomies[$post_type . 'category']['args']['rewrite']))
|
|
| 144 | + $geodir_taxonomies[$post_type . 'category']['args']['rewrite']['slug'] = $listing_slug; |
|
| 145 | 145 | |
| 146 | - update_option('geodir_taxonomies', $geodir_taxonomies);
|
|
| 146 | + update_option('geodir_taxonomies', $geodir_taxonomies);
|
|
| 147 | 147 | |
| 148 | - } |
|
| 148 | + } |
|
| 149 | 149 | |
| 150 | - /* --- update taxonomies (tags) --- */ |
|
| 151 | - $geodir_taxonomies_tag = get_option('geodir_taxonomies');
|
|
| 152 | - if (array_key_exists('listing_slug', $geodir_taxonomies_tag[$post_type . '_tags'])) {
|
|
| 153 | - $geodir_taxonomies_tag[$post_type . '_tags']['listing_slug'] = $listing_slug . '/tags'; |
|
| 150 | + /* --- update taxonomies (tags) --- */ |
|
| 151 | + $geodir_taxonomies_tag = get_option('geodir_taxonomies');
|
|
| 152 | + if (array_key_exists('listing_slug', $geodir_taxonomies_tag[$post_type . '_tags'])) {
|
|
| 153 | + $geodir_taxonomies_tag[$post_type . '_tags']['listing_slug'] = $listing_slug . '/tags'; |
|
| 154 | 154 | |
| 155 | - if (array_key_exists('args', $geodir_taxonomies_tag[$post_type . '_tags']))
|
|
| 156 | - if (array_key_exists('rewrite', $geodir_taxonomies_tag[$post_type . '_tags']['args']))
|
|
| 157 | - if (array_key_exists('slug', $geodir_taxonomies_tag[$post_type . '_tags']['args']['rewrite']))
|
|
| 158 | - $geodir_taxonomies_tag[$post_type . '_tags']['args']['rewrite']['slug'] = $listing_slug . '/tags'; |
|
| 155 | + if (array_key_exists('args', $geodir_taxonomies_tag[$post_type . '_tags']))
|
|
| 156 | + if (array_key_exists('rewrite', $geodir_taxonomies_tag[$post_type . '_tags']['args']))
|
|
| 157 | + if (array_key_exists('slug', $geodir_taxonomies_tag[$post_type . '_tags']['args']['rewrite']))
|
|
| 158 | + $geodir_taxonomies_tag[$post_type . '_tags']['args']['rewrite']['slug'] = $listing_slug . '/tags'; |
|
| 159 | 159 | |
| 160 | - update_option('geodir_taxonomies', $geodir_taxonomies_tag);
|
|
| 160 | + update_option('geodir_taxonomies', $geodir_taxonomies_tag);
|
|
| 161 | 161 | |
| 162 | - } |
|
| 162 | + } |
|
| 163 | 163 | |
| 164 | - } |
|
| 164 | + } |
|
| 165 | 165 | |
| 166 | - } |
|
| 166 | + } |
|
| 167 | 167 | |
| 168 | - return $args; |
|
| 168 | + return $args; |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | /** |
@@ -178,8 +178,8 @@ discard block |
||
| 178 | 178 | */ |
| 179 | 179 | function geodir_flush_rewrite_rules() |
| 180 | 180 | {
|
| 181 | - global $wp_rewrite; |
|
| 182 | - $wp_rewrite->flush_rules(false); |
|
| 181 | + global $wp_rewrite; |
|
| 182 | + $wp_rewrite->flush_rules(false); |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | /** |
@@ -194,35 +194,35 @@ discard block |
||
| 194 | 194 | * @return array Rewrite rules. |
| 195 | 195 | */ |
| 196 | 196 | function geodir_listing_rewrite_rules($rules) {
|
| 197 | - $newrules = array(); |
|
| 198 | - $taxonomies = get_option('geodir_taxonomies');
|
|
| 199 | - $detail_url_seprator = get_option('geodir_detailurl_separator');
|
|
| 197 | + $newrules = array(); |
|
| 198 | + $taxonomies = get_option('geodir_taxonomies');
|
|
| 199 | + $detail_url_seprator = get_option('geodir_detailurl_separator');
|
|
| 200 | 200 | |
| 201 | 201 | // create rules for post listing |
| 202 | - if (is_array($taxonomies)): |
|
| 203 | - foreach ($taxonomies as $taxonomy => $args): |
|
| 204 | - $post_type = $args['object_type']; |
|
| 205 | - $listing_slug = $args['listing_slug']; |
|
| 206 | - |
|
| 207 | - if (strpos($taxonomy, 'tags')) {
|
|
| 208 | - $newrules[$listing_slug . '/(.+?)/page/?([0-9]{1,})/?$'] = 'index.php?' . $taxonomy . '=$matches[1]&paged=$matches[2]';
|
|
| 209 | - $newrules[$listing_slug . '/(.+?)/?$'] = 'index.php?' . $taxonomy . '=$matches[1]'; |
|
| 210 | - } else {
|
|
| 211 | - // use this loop to add paging for details page comments paging |
|
| 212 | - $newrules[str_replace("/tags","",$listing_slug) . '/(.+?)/comment-page-([0-9]{1,})/?$'] = 'index.php?' . $taxonomy . '=$matches[1]&cpage=$matches[2]';
|
|
| 213 | - } |
|
| 214 | - endforeach; |
|
| 215 | - endif; |
|
| 216 | - |
|
| 217 | - // create rules for location listing |
|
| 218 | - $location_page = get_option('geodir_location_page');
|
|
| 202 | + if (is_array($taxonomies)): |
|
| 203 | + foreach ($taxonomies as $taxonomy => $args): |
|
| 204 | + $post_type = $args['object_type']; |
|
| 205 | + $listing_slug = $args['listing_slug']; |
|
| 206 | + |
|
| 207 | + if (strpos($taxonomy, 'tags')) {
|
|
| 208 | + $newrules[$listing_slug . '/(.+?)/page/?([0-9]{1,})/?$'] = 'index.php?' . $taxonomy . '=$matches[1]&paged=$matches[2]';
|
|
| 209 | + $newrules[$listing_slug . '/(.+?)/?$'] = 'index.php?' . $taxonomy . '=$matches[1]'; |
|
| 210 | + } else {
|
|
| 211 | + // use this loop to add paging for details page comments paging |
|
| 212 | + $newrules[str_replace("/tags","",$listing_slug) . '/(.+?)/comment-page-([0-9]{1,})/?$'] = 'index.php?' . $taxonomy . '=$matches[1]&cpage=$matches[2]';
|
|
| 213 | + } |
|
| 214 | + endforeach; |
|
| 215 | + endif; |
|
| 216 | + |
|
| 217 | + // create rules for location listing |
|
| 218 | + $location_page = get_option('geodir_location_page');
|
|
| 219 | 219 | |
| 220 | - if($location_page) {
|
|
| 221 | - global $wpdb; |
|
| 222 | - $location_prefix = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_type='page' AND ID=%d", $location_page));
|
|
| 223 | - } |
|
| 224 | - if (!isset($location_prefix)) |
|
| 225 | - $location_prefix = 'location'; |
|
| 220 | + if($location_page) {
|
|
| 221 | + global $wpdb; |
|
| 222 | + $location_prefix = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_type='page' AND ID=%d", $location_page));
|
|
| 223 | + } |
|
| 224 | + if (!isset($location_prefix)) |
|
| 225 | + $location_prefix = 'location'; |
|
| 226 | 226 | |
| 227 | 227 | $location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
|
| 228 | 228 | if ($location_manager) {
|
@@ -266,12 +266,12 @@ discard block |
||
| 266 | 266 | $newrules[$location_prefix . '/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&gd_country=$matches[1]'; |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | - if ($location_page && function_exists('icl_object_id')) {
|
|
| 270 | - foreach(icl_get_languages('skip_missing=N') as $lang){
|
|
| 271 | - $alt_page_id = ''; |
|
| 272 | - $alt_page_id = icl_object_id($location_page, 'page', false,$lang['language_code']); |
|
| 273 | - if($alt_page_id){
|
|
| 274 | - $location_prefix = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_type='page' AND ID=%d", $alt_page_id));
|
|
| 269 | + if ($location_page && function_exists('icl_object_id')) {
|
|
| 270 | + foreach(icl_get_languages('skip_missing=N') as $lang){
|
|
| 271 | + $alt_page_id = ''; |
|
| 272 | + $alt_page_id = icl_object_id($location_page, 'page', false,$lang['language_code']); |
|
| 273 | + if($alt_page_id){
|
|
| 274 | + $location_prefix = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_type='page' AND ID=%d", $alt_page_id));
|
|
| 275 | 275 | |
| 276 | 276 | if ($location_manager && ($hide_country_part || $hide_region_part)) {
|
| 277 | 277 | $matches2 = ''; |
@@ -307,14 +307,14 @@ discard block |
||
| 307 | 307 | $newrules[$location_prefix . '/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&gd_country=$matches[1]&gd_region=$matches[2]'; |
| 308 | 308 | $newrules[$location_prefix . '/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&gd_country=$matches[1]'; |
| 309 | 309 | } |
| 310 | - } |
|
| 311 | - } |
|
| 312 | - } |
|
| 310 | + } |
|
| 311 | + } |
|
| 312 | + } |
|
| 313 | 313 | |
| 314 | - $newrules[$location_prefix . '/?$'] = 'index.php?page_id=' . $location_page; |
|
| 314 | + $newrules[$location_prefix . '/?$'] = 'index.php?page_id=' . $location_page; |
|
| 315 | 315 | |
| 316 | - $rules = array_merge($newrules, $rules); |
|
| 317 | - return $rules; |
|
| 316 | + $rules = array_merge($newrules, $rules); |
|
| 317 | + return $rules; |
|
| 318 | 318 | } |
| 319 | 319 | |
| 320 | 320 | /** |
@@ -329,18 +329,18 @@ discard block |
||
| 329 | 329 | */ |
| 330 | 330 | function geodir_htaccess_contents($rules) |
| 331 | 331 | {
|
| 332 | - global $wpdb; |
|
| 333 | - $location_prefix = get_option('geodir_location_prefix');
|
|
| 334 | - // if location page slug changed then add redirect |
|
| 335 | - if ($location_prefix == 'location') {
|
|
| 336 | - return $rules; |
|
| 337 | - } |
|
| 338 | - $my_content = <<<EOD |
|
| 332 | + global $wpdb; |
|
| 333 | + $location_prefix = get_option('geodir_location_prefix');
|
|
| 334 | + // if location page slug changed then add redirect |
|
| 335 | + if ($location_prefix == 'location') {
|
|
| 336 | + return $rules; |
|
| 337 | + } |
|
| 338 | + $my_content = <<<EOD |
|
| 339 | 339 | \n# BEGIN GeoDirectory Rules |
| 340 | 340 | #Redirect 301 /location/ /$location_prefix/ |
| 341 | 341 | # END GeoDirectory Rules\n\n |
| 342 | 342 | EOD; |
| 343 | - return $my_content . $rules; |
|
| 343 | + return $my_content . $rules; |
|
| 344 | 344 | } |
| 345 | 345 | //add_filter('mod_rewrite_rules', 'geodir_htaccess_contents');
|
| 346 | 346 | |
@@ -354,10 +354,10 @@ discard block |
||
| 354 | 354 | */ |
| 355 | 355 | function geodir_add_location_var($public_query_vars) |
| 356 | 356 | {
|
| 357 | - $public_query_vars[] = 'gd_country'; |
|
| 358 | - $public_query_vars[] = 'gd_region'; |
|
| 359 | - $public_query_vars[] = 'gd_city'; |
|
| 360 | - return $public_query_vars; |
|
| 357 | + $public_query_vars[] = 'gd_country'; |
|
| 358 | + $public_query_vars[] = 'gd_region'; |
|
| 359 | + $public_query_vars[] = 'gd_city'; |
|
| 360 | + return $public_query_vars; |
|
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | /** |
@@ -370,8 +370,8 @@ discard block |
||
| 370 | 370 | */ |
| 371 | 371 | function geodir_add_geodir_page_var($public_query_vars) |
| 372 | 372 | {
|
| 373 | - $public_query_vars[] = 'gd_is_geodir_page'; |
|
| 374 | - return $public_query_vars; |
|
| 373 | + $public_query_vars[] = 'gd_is_geodir_page'; |
|
| 374 | + return $public_query_vars; |
|
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | /** |
@@ -383,20 +383,20 @@ discard block |
||
| 383 | 383 | */ |
| 384 | 384 | function geodir_add_page_id_in_query_var() |
| 385 | 385 | {
|
| 386 | - global $wp_query; |
|
| 386 | + global $wp_query; |
|
| 387 | 387 | |
| 388 | - $page_id = $wp_query->get_queried_object_id(); |
|
| 388 | + $page_id = $wp_query->get_queried_object_id(); |
|
| 389 | 389 | |
| 390 | - if (!get_query_var('page_id') && !is_archive()) {
|
|
| 391 | - // fix for WP tags conflict with enfold theme |
|
| 392 | - $theme_name = geodir_strtolower(wp_get_theme()); |
|
| 393 | - if (!geodir_is_geodir_page() && strpos($theme_name, 'enfold') !== false) {
|
|
| 394 | - return $wp_query; |
|
| 395 | - } |
|
| 396 | - $wp_query->set('page_id', $page_id);
|
|
| 397 | - } |
|
| 390 | + if (!get_query_var('page_id') && !is_archive()) {
|
|
| 391 | + // fix for WP tags conflict with enfold theme |
|
| 392 | + $theme_name = geodir_strtolower(wp_get_theme()); |
|
| 393 | + if (!geodir_is_geodir_page() && strpos($theme_name, 'enfold') !== false) {
|
|
| 394 | + return $wp_query; |
|
| 395 | + } |
|
| 396 | + $wp_query->set('page_id', $page_id);
|
|
| 397 | + } |
|
| 398 | 398 | |
| 399 | - return $wp_query; |
|
| 399 | + return $wp_query; |
|
| 400 | 400 | } |
| 401 | 401 | |
| 402 | 402 | /** |
@@ -411,24 +411,24 @@ discard block |
||
| 411 | 411 | function geodir_set_location_var_in_session_in_core($wp) {
|
| 412 | 412 | global $gd_session; |
| 413 | 413 | |
| 414 | - // Fix for WPML removing page_id query var: |
|
| 415 | - if (isset($wp->query_vars['page']) && !isset($wp->query_vars['page_id']) && isset($wp->query_vars['pagename']) && !is_home()) {
|
|
| 416 | - global $wpdb; |
|
| 417 | - |
|
| 418 | - $page_for_posts = get_option('page_for_posts');
|
|
| 419 | - $real_page_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_name=%s",$wp->query_vars['pagename']));
|
|
| 420 | - |
|
| 421 | - if (function_exists('icl_object_id')) {
|
|
| 422 | - $real_page_id = icl_object_id($real_page_id, 'page', true, ICL_LANGUAGE_CODE); |
|
| 423 | - } |
|
| 424 | - if ($real_page_id && $real_page_id!=$page_for_posts) {
|
|
| 425 | - $wp->query_vars['page_id'] = $real_page_id; |
|
| 426 | - } |
|
| 427 | - } |
|
| 414 | + // Fix for WPML removing page_id query var: |
|
| 415 | + if (isset($wp->query_vars['page']) && !isset($wp->query_vars['page_id']) && isset($wp->query_vars['pagename']) && !is_home()) {
|
|
| 416 | + global $wpdb; |
|
| 417 | + |
|
| 418 | + $page_for_posts = get_option('page_for_posts');
|
|
| 419 | + $real_page_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_name=%s",$wp->query_vars['pagename']));
|
|
| 420 | + |
|
| 421 | + if (function_exists('icl_object_id')) {
|
|
| 422 | + $real_page_id = icl_object_id($real_page_id, 'page', true, ICL_LANGUAGE_CODE); |
|
| 423 | + } |
|
| 424 | + if ($real_page_id && $real_page_id!=$page_for_posts) {
|
|
| 425 | + $wp->query_vars['page_id'] = $real_page_id; |
|
| 426 | + } |
|
| 427 | + } |
|
| 428 | 428 | |
| 429 | 429 | // Query Vars will have page_id parameter |
| 430 | 430 | // check if query var has page_id and that page id is location page |
| 431 | - geodir_set_is_geodir_page($wp); |
|
| 431 | + geodir_set_is_geodir_page($wp); |
|
| 432 | 432 | // if is GD homepage set the page ID |
| 433 | 433 | if (geodir_is_page('home')) {
|
| 434 | 434 | $wp->query_vars['page_id'] = get_option('page_on_front');
|
@@ -437,118 +437,118 @@ discard block |
||
| 437 | 437 | // The location url format (all or country_city or region_city or city). |
| 438 | 438 | $geodir_show_location_url = get_option('geodir_show_location_url');
|
| 439 | 439 | |
| 440 | - if (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_location_page_id()) {
|
|
| 441 | - $gd_country = ''; |
|
| 442 | - $gd_region = ''; |
|
| 443 | - $gd_city = ''; |
|
| 444 | - if (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') |
|
| 445 | - $gd_country = urldecode($wp->query_vars['gd_country']); |
|
| 446 | - |
|
| 447 | - if (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') |
|
| 448 | - $gd_region = urldecode($wp->query_vars['gd_region']); |
|
| 449 | - |
|
| 450 | - if (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') |
|
| 451 | - $gd_city = urldecode($wp->query_vars['gd_city']); |
|
| 452 | - |
|
| 453 | - if (!($gd_country == '' && $gd_region == '' && $gd_city == '')) {
|
|
| 454 | - $default_location = geodir_get_default_location(); |
|
| 455 | - |
|
| 456 | - if (get_option('geodir_add_location_url')) {
|
|
| 457 | - if ($geodir_show_location_url != 'all') {
|
|
| 458 | - if ($gd_region == '') {
|
|
| 459 | - if ($gd_ses_region = $gd_session->get('gd_region'))
|
|
| 460 | - $gd_region = $gd_ses_region; |
|
| 461 | - else |
|
| 462 | - $gd_region = $default_location->region_slug; |
|
| 463 | - } |
|
| 464 | - |
|
| 465 | - if ($gd_city == '') {
|
|
| 466 | - if ($gd_ses_city = $gd_session->get('gd_city'))
|
|
| 467 | - $gd_city = $gd_ses_city; |
|
| 468 | - else |
|
| 469 | - $gd_city = $default_location->city_slug; |
|
| 470 | - |
|
| 471 | - $base_location_link = geodir_get_location_link('base');
|
|
| 472 | - wp_redirect($base_location_link . '/' . $gd_country . '/' . $gd_region . '/' . $gd_city); |
|
| 473 | - exit(); |
|
| 474 | - } |
|
| 475 | - } |
|
| 476 | - } |
|
| 477 | - |
|
| 478 | - $args = array( |
|
| 479 | - 'what' => 'city', |
|
| 480 | - 'city_val' => $gd_city, |
|
| 481 | - 'region_val' => $gd_region, |
|
| 482 | - 'country_val' => $gd_country, |
|
| 483 | - 'country_column_name' => 'country_slug', |
|
| 484 | - 'region_column_name' => 'region_slug', |
|
| 485 | - 'city_column_name' => 'city_slug', |
|
| 486 | - 'location_link_part' => false, |
|
| 487 | - 'compare_operator' => '' |
|
| 488 | - ); |
|
| 489 | - |
|
| 490 | - $location_array = function_exists('geodir_get_location_array') ? geodir_get_location_array($args) : array();
|
|
| 491 | - if (!empty($location_array)) {
|
|
| 492 | - $gd_session->set('gd_multi_location', 1);
|
|
| 493 | - $gd_session->set('gd_country', $gd_country);
|
|
| 494 | - $gd_session->set('gd_region', $gd_region);
|
|
| 495 | - $gd_session->set('gd_city', $gd_city);
|
|
| 440 | + if (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_location_page_id()) {
|
|
| 441 | + $gd_country = ''; |
|
| 442 | + $gd_region = ''; |
|
| 443 | + $gd_city = ''; |
|
| 444 | + if (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') |
|
| 445 | + $gd_country = urldecode($wp->query_vars['gd_country']); |
|
| 446 | + |
|
| 447 | + if (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') |
|
| 448 | + $gd_region = urldecode($wp->query_vars['gd_region']); |
|
| 449 | + |
|
| 450 | + if (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') |
|
| 451 | + $gd_city = urldecode($wp->query_vars['gd_city']); |
|
| 452 | + |
|
| 453 | + if (!($gd_country == '' && $gd_region == '' && $gd_city == '')) {
|
|
| 454 | + $default_location = geodir_get_default_location(); |
|
| 455 | + |
|
| 456 | + if (get_option('geodir_add_location_url')) {
|
|
| 457 | + if ($geodir_show_location_url != 'all') {
|
|
| 458 | + if ($gd_region == '') {
|
|
| 459 | + if ($gd_ses_region = $gd_session->get('gd_region'))
|
|
| 460 | + $gd_region = $gd_ses_region; |
|
| 461 | + else |
|
| 462 | + $gd_region = $default_location->region_slug; |
|
| 463 | + } |
|
| 464 | + |
|
| 465 | + if ($gd_city == '') {
|
|
| 466 | + if ($gd_ses_city = $gd_session->get('gd_city'))
|
|
| 467 | + $gd_city = $gd_ses_city; |
|
| 468 | + else |
|
| 469 | + $gd_city = $default_location->city_slug; |
|
| 470 | + |
|
| 471 | + $base_location_link = geodir_get_location_link('base');
|
|
| 472 | + wp_redirect($base_location_link . '/' . $gd_country . '/' . $gd_region . '/' . $gd_city); |
|
| 473 | + exit(); |
|
| 474 | + } |
|
| 475 | + } |
|
| 476 | + } |
|
| 477 | + |
|
| 478 | + $args = array( |
|
| 479 | + 'what' => 'city', |
|
| 480 | + 'city_val' => $gd_city, |
|
| 481 | + 'region_val' => $gd_region, |
|
| 482 | + 'country_val' => $gd_country, |
|
| 483 | + 'country_column_name' => 'country_slug', |
|
| 484 | + 'region_column_name' => 'region_slug', |
|
| 485 | + 'city_column_name' => 'city_slug', |
|
| 486 | + 'location_link_part' => false, |
|
| 487 | + 'compare_operator' => '' |
|
| 488 | + ); |
|
| 489 | + |
|
| 490 | + $location_array = function_exists('geodir_get_location_array') ? geodir_get_location_array($args) : array();
|
|
| 491 | + if (!empty($location_array)) {
|
|
| 492 | + $gd_session->set('gd_multi_location', 1);
|
|
| 493 | + $gd_session->set('gd_country', $gd_country);
|
|
| 494 | + $gd_session->set('gd_region', $gd_region);
|
|
| 495 | + $gd_session->set('gd_city', $gd_city);
|
|
| 496 | 496 | |
| 497 | 497 | $wp->query_vars['gd_country'] = $gd_country; |
| 498 | - $wp->query_vars['gd_region'] = $gd_region; |
|
| 499 | - $wp->query_vars['gd_city'] = $gd_city; |
|
| 500 | - } else {
|
|
| 501 | - $gd_session->un_set(array('gd_multi_location', 'gd_city', 'gd_region', 'gd_country'));
|
|
| 502 | - } |
|
| 503 | - } else {
|
|
| 504 | - $gd_session->un_set(array('gd_multi_location', 'gd_city', 'gd_region', 'gd_country'));
|
|
| 505 | - } |
|
| 506 | - |
|
| 507 | - } else if (isset($wp->query_vars['post_type']) && $wp->query_vars['post_type'] != '') {
|
|
| 508 | - if (!is_admin()) {
|
|
| 509 | - $requested_post_type = $wp->query_vars['post_type']; |
|
| 510 | - // check if this post type is geodirectory post types |
|
| 511 | - $post_type_array = geodir_get_posttypes(); |
|
| 498 | + $wp->query_vars['gd_region'] = $gd_region; |
|
| 499 | + $wp->query_vars['gd_city'] = $gd_city; |
|
| 500 | + } else {
|
|
| 501 | + $gd_session->un_set(array('gd_multi_location', 'gd_city', 'gd_region', 'gd_country'));
|
|
| 502 | + } |
|
| 503 | + } else {
|
|
| 504 | + $gd_session->un_set(array('gd_multi_location', 'gd_city', 'gd_region', 'gd_country'));
|
|
| 505 | + } |
|
| 506 | + |
|
| 507 | + } else if (isset($wp->query_vars['post_type']) && $wp->query_vars['post_type'] != '') {
|
|
| 508 | + if (!is_admin()) {
|
|
| 509 | + $requested_post_type = $wp->query_vars['post_type']; |
|
| 510 | + // check if this post type is geodirectory post types |
|
| 511 | + $post_type_array = geodir_get_posttypes(); |
|
| 512 | 512 | |
| 513 | 513 | if (in_array($requested_post_type, $post_type_array)) {
|
| 514 | - // now u can apply geodirectory related manipulation. |
|
| 515 | - } |
|
| 516 | - } |
|
| 517 | - } else {
|
|
| 518 | - // check if a geodirectory taxonomy is set |
|
| 519 | - $gd_country = ''; |
|
| 520 | - $gd_region = ''; |
|
| 521 | - $gd_city = ''; |
|
| 514 | + // now u can apply geodirectory related manipulation. |
|
| 515 | + } |
|
| 516 | + } |
|
| 517 | + } else {
|
|
| 518 | + // check if a geodirectory taxonomy is set |
|
| 519 | + $gd_country = ''; |
|
| 520 | + $gd_region = ''; |
|
| 521 | + $gd_city = ''; |
|
| 522 | 522 | |
| 523 | 523 | $is_geodir_taxonomy = false; |
| 524 | - $is_geodir_taxonomy_term = false; // the last term is real geodirectory taxonomy term or not |
|
| 525 | - $is_geodir_location_found = false; |
|
| 524 | + $is_geodir_taxonomy_term = false; // the last term is real geodirectory taxonomy term or not |
|
| 525 | + $is_geodir_location_found = false; |
|
| 526 | 526 | |
| 527 | 527 | $geodir_taxonomy = ''; |
| 528 | - $geodir_post_type = ''; |
|
| 529 | - $geodir_term = ''; |
|
| 530 | - $geodir_set_location_session = true; |
|
| 531 | - $geodir_taxonomis = geodir_get_taxonomies('', true);
|
|
| 532 | - |
|
| 533 | - if(!empty($geodir_taxonomis)){
|
|
| 534 | - foreach ($geodir_taxonomis as $taxonomy) {
|
|
| 535 | - if (array_key_exists($taxonomy, $wp->query_vars)) {
|
|
| 536 | - $is_geodir_taxonomy = true; |
|
| 537 | - $geodir_taxonomy = $taxonomy; |
|
| 538 | - $geodir_post_type = str_replace('category', '', $taxonomy);
|
|
| 539 | - $geodir_post_type = str_replace('_tags', '', $geodir_post_type);
|
|
| 540 | - $geodir_term = $wp->query_vars[$geodir_taxonomy]; |
|
| 541 | - break; |
|
| 542 | - } |
|
| 543 | - } |
|
| 544 | - } |
|
| 545 | - |
|
| 546 | - // now get an array of all terms seperated by '/' |
|
| 547 | - $geodir_terms = explode('/', $geodir_term);
|
|
| 548 | - $geodir_last_term = end($geodir_terms); |
|
| 549 | - |
|
| 550 | - if ($is_geodir_taxonomy) { // do all these only when it is a geodirectory taxonomy
|
|
| 551 | - $wp->query_vars['post_type'] = $geodir_post_type; |
|
| 528 | + $geodir_post_type = ''; |
|
| 529 | + $geodir_term = ''; |
|
| 530 | + $geodir_set_location_session = true; |
|
| 531 | + $geodir_taxonomis = geodir_get_taxonomies('', true);
|
|
| 532 | + |
|
| 533 | + if(!empty($geodir_taxonomis)){
|
|
| 534 | + foreach ($geodir_taxonomis as $taxonomy) {
|
|
| 535 | + if (array_key_exists($taxonomy, $wp->query_vars)) {
|
|
| 536 | + $is_geodir_taxonomy = true; |
|
| 537 | + $geodir_taxonomy = $taxonomy; |
|
| 538 | + $geodir_post_type = str_replace('category', '', $taxonomy);
|
|
| 539 | + $geodir_post_type = str_replace('_tags', '', $geodir_post_type);
|
|
| 540 | + $geodir_term = $wp->query_vars[$geodir_taxonomy]; |
|
| 541 | + break; |
|
| 542 | + } |
|
| 543 | + } |
|
| 544 | + } |
|
| 545 | + |
|
| 546 | + // now get an array of all terms seperated by '/' |
|
| 547 | + $geodir_terms = explode('/', $geodir_term);
|
|
| 548 | + $geodir_last_term = end($geodir_terms); |
|
| 549 | + |
|
| 550 | + if ($is_geodir_taxonomy) { // do all these only when it is a geodirectory taxonomy
|
|
| 551 | + $wp->query_vars['post_type'] = $geodir_post_type; |
|
| 552 | 552 | |
| 553 | 553 | // now check if last term is a post of geodirectory post types |
| 554 | 554 | $geodir_post = get_posts(array( |
@@ -597,196 +597,196 @@ discard block |
||
| 597 | 597 | //return ; |
| 598 | 598 | } |
| 599 | 599 | |
| 600 | - $geodir_location_terms = ''; |
|
| 601 | - // if last term is not a post then check if last term is a term of the specific texonomy or not |
|
| 602 | - if (geodir_term_exists($geodir_last_term, $geodir_taxonomy)) {
|
|
| 603 | - $is_geodir_taxonomy_term = true; |
|
| 600 | + $geodir_location_terms = ''; |
|
| 601 | + // if last term is not a post then check if last term is a term of the specific texonomy or not |
|
| 602 | + if (geodir_term_exists($geodir_last_term, $geodir_taxonomy)) {
|
|
| 603 | + $is_geodir_taxonomy_term = true; |
|
| 604 | 604 | |
| 605 | - $geodir_set_location_session = false; |
|
| 606 | - } |
|
| 605 | + $geodir_set_location_session = false; |
|
| 606 | + } |
|
| 607 | 607 | |
| 608 | 608 | |
| 609 | - // now check if there is location parts in the url or not |
|
| 610 | - if (get_option('geodir_add_location_url')) {
|
|
| 609 | + // now check if there is location parts in the url or not |
|
| 610 | + if (get_option('geodir_add_location_url')) {
|
|
| 611 | 611 | $default_location = geodir_get_default_location(); |
| 612 | 612 | |
| 613 | 613 | if ($geodir_show_location_url == 'all') {
|
| 614 | - if (count($geodir_terms) >= 3) {
|
|
| 615 | - $gd_country = urldecode($geodir_terms[0]); |
|
| 616 | - $gd_region = urldecode($geodir_terms[1]); |
|
| 617 | - $gd_city = urldecode($geodir_terms[2]); |
|
| 618 | - } else if (count($geodir_terms) >= 2) {
|
|
| 619 | - $gd_country = urldecode($geodir_terms[0]); |
|
| 620 | - $gd_region = urldecode($geodir_terms[1]); |
|
| 621 | - } else if (count($geodir_terms) >= 1) {
|
|
| 622 | - $gd_country = urldecode($geodir_terms[0]); |
|
| 623 | - } |
|
| 624 | - |
|
| 625 | - if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) && |
|
| 626 | - geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region) && |
|
| 627 | - geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city) |
|
| 628 | - ) |
|
| 629 | - $is_geodir_location_found = true; |
|
| 630 | - |
|
| 631 | - // if location has not been found for country , region and city then search for country and region only |
|
| 632 | - |
|
| 633 | - if (!$is_geodir_location_found) {
|
|
| 634 | - $gd_city = ''; |
|
| 635 | - if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) && |
|
| 636 | - geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region) |
|
| 637 | - ) |
|
| 638 | - $is_geodir_location_found = true; |
|
| 639 | - |
|
| 640 | - } |
|
| 641 | - |
|
| 642 | - // if location has not been found for country , region then search for country only |
|
| 643 | - if (!$is_geodir_location_found) {
|
|
| 644 | - $gd_city = ''; |
|
| 645 | - $gd_region = ''; |
|
| 646 | - if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country)) |
|
| 647 | - $is_geodir_location_found = true; |
|
| 648 | - } |
|
| 649 | - } else if ($geodir_show_location_url == 'country_city') {
|
|
| 650 | - if (count($geodir_terms) >= 2) {
|
|
| 651 | - $gd_country = urldecode($geodir_terms[0]); |
|
| 652 | - $gd_city = urldecode($geodir_terms[1]); |
|
| 653 | - } else if (count($geodir_terms) >= 1) {
|
|
| 654 | - $gd_country = urldecode($geodir_terms[0]); |
|
| 655 | - } |
|
| 656 | - |
|
| 657 | - if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) && geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city)) |
|
| 658 | - $is_geodir_location_found = true; |
|
| 659 | - |
|
| 660 | - // if location has not been found for country and city then search for country only |
|
| 661 | - if (!$is_geodir_location_found) {
|
|
| 662 | - $gd_city = ''; |
|
| 614 | + if (count($geodir_terms) >= 3) {
|
|
| 615 | + $gd_country = urldecode($geodir_terms[0]); |
|
| 616 | + $gd_region = urldecode($geodir_terms[1]); |
|
| 617 | + $gd_city = urldecode($geodir_terms[2]); |
|
| 618 | + } else if (count($geodir_terms) >= 2) {
|
|
| 619 | + $gd_country = urldecode($geodir_terms[0]); |
|
| 620 | + $gd_region = urldecode($geodir_terms[1]); |
|
| 621 | + } else if (count($geodir_terms) >= 1) {
|
|
| 622 | + $gd_country = urldecode($geodir_terms[0]); |
|
| 623 | + } |
|
| 624 | + |
|
| 625 | + if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) && |
|
| 626 | + geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region) && |
|
| 627 | + geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city) |
|
| 628 | + ) |
|
| 629 | + $is_geodir_location_found = true; |
|
| 630 | + |
|
| 631 | + // if location has not been found for country , region and city then search for country and region only |
|
| 632 | + |
|
| 633 | + if (!$is_geodir_location_found) {
|
|
| 634 | + $gd_city = ''; |
|
| 635 | + if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) && |
|
| 636 | + geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region) |
|
| 637 | + ) |
|
| 638 | + $is_geodir_location_found = true; |
|
| 639 | + |
|
| 640 | + } |
|
| 641 | + |
|
| 642 | + // if location has not been found for country , region then search for country only |
|
| 643 | + if (!$is_geodir_location_found) {
|
|
| 644 | + $gd_city = ''; |
|
| 645 | + $gd_region = ''; |
|
| 646 | + if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country)) |
|
| 647 | + $is_geodir_location_found = true; |
|
| 648 | + } |
|
| 649 | + } else if ($geodir_show_location_url == 'country_city') {
|
|
| 650 | + if (count($geodir_terms) >= 2) {
|
|
| 651 | + $gd_country = urldecode($geodir_terms[0]); |
|
| 652 | + $gd_city = urldecode($geodir_terms[1]); |
|
| 653 | + } else if (count($geodir_terms) >= 1) {
|
|
| 654 | + $gd_country = urldecode($geodir_terms[0]); |
|
| 655 | + } |
|
| 656 | + |
|
| 657 | + if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) && geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city)) |
|
| 658 | + $is_geodir_location_found = true; |
|
| 659 | + |
|
| 660 | + // if location has not been found for country and city then search for country only |
|
| 661 | + if (!$is_geodir_location_found) {
|
|
| 662 | + $gd_city = ''; |
|
| 663 | 663 | |
| 664 | 664 | if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country)) |
| 665 | - $is_geodir_location_found = true; |
|
| 666 | - } |
|
| 667 | - } else if ($geodir_show_location_url == 'region_city') {
|
|
| 668 | - if (count($geodir_terms) >= 2) {
|
|
| 669 | - $gd_region = urldecode($geodir_terms[0]); |
|
| 670 | - $gd_city = urldecode($geodir_terms[1]); |
|
| 671 | - } else if (count($geodir_terms) >= 1) {
|
|
| 672 | - $gd_region = urldecode($geodir_terms[0]); |
|
| 673 | - } |
|
| 674 | - |
|
| 675 | - if (geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region) && geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city)) |
|
| 676 | - $is_geodir_location_found = true; |
|
| 677 | - |
|
| 678 | - // if location has not been found for region and city then search for region only |
|
| 679 | - if (!$is_geodir_location_found) {
|
|
| 680 | - $gd_city = ''; |
|
| 665 | + $is_geodir_location_found = true; |
|
| 666 | + } |
|
| 667 | + } else if ($geodir_show_location_url == 'region_city') {
|
|
| 668 | + if (count($geodir_terms) >= 2) {
|
|
| 669 | + $gd_region = urldecode($geodir_terms[0]); |
|
| 670 | + $gd_city = urldecode($geodir_terms[1]); |
|
| 671 | + } else if (count($geodir_terms) >= 1) {
|
|
| 672 | + $gd_region = urldecode($geodir_terms[0]); |
|
| 673 | + } |
|
| 674 | + |
|
| 675 | + if (geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region) && geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city)) |
|
| 676 | + $is_geodir_location_found = true; |
|
| 677 | + |
|
| 678 | + // if location has not been found for region and city then search for region only |
|
| 679 | + if (!$is_geodir_location_found) {
|
|
| 680 | + $gd_city = ''; |
|
| 681 | 681 | |
| 682 | 682 | if (geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region)) |
| 683 | - $is_geodir_location_found = true; |
|
| 684 | - } |
|
| 685 | - } else {
|
|
| 686 | - $gd_city = $geodir_terms[0]; |
|
| 687 | - |
|
| 688 | - if (geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city)) {
|
|
| 689 | - $is_geodir_location_found = true; |
|
| 690 | - $gd_region = $default_location->region_slug; |
|
| 691 | - $gd_country = $default_location->country_slug; |
|
| 692 | - } |
|
| 693 | - } |
|
| 694 | - // if location still not found then clear location related session variables |
|
| 695 | - if ($is_geodir_location_found && $geodir_set_location_session) {
|
|
| 696 | - $gd_session->set('gd_multi_location', 1);
|
|
| 697 | - $gd_session->set('gd_country', $gd_country);
|
|
| 698 | - $gd_session->set('gd_region', $gd_region);
|
|
| 699 | - $gd_session->set('gd_city', $gd_city);
|
|
| 700 | - } |
|
| 701 | - |
|
| 702 | - if ($geodir_show_location_url == 'all') {
|
|
| 683 | + $is_geodir_location_found = true; |
|
| 684 | + } |
|
| 685 | + } else {
|
|
| 686 | + $gd_city = $geodir_terms[0]; |
|
| 687 | + |
|
| 688 | + if (geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city)) {
|
|
| 689 | + $is_geodir_location_found = true; |
|
| 690 | + $gd_region = $default_location->region_slug; |
|
| 691 | + $gd_country = $default_location->country_slug; |
|
| 692 | + } |
|
| 693 | + } |
|
| 694 | + // if location still not found then clear location related session variables |
|
| 695 | + if ($is_geodir_location_found && $geodir_set_location_session) {
|
|
| 696 | + $gd_session->set('gd_multi_location', 1);
|
|
| 697 | + $gd_session->set('gd_country', $gd_country);
|
|
| 698 | + $gd_session->set('gd_region', $gd_region);
|
|
| 699 | + $gd_session->set('gd_city', $gd_city);
|
|
| 700 | + } |
|
| 701 | + |
|
| 702 | + if ($geodir_show_location_url == 'all') {
|
|
| 703 | 703 | } else if ($geodir_show_location_url == 'country_city') {
|
| 704 | 704 | $gd_region = ''; |
| 705 | 705 | } else if ($geodir_show_location_url == 'region_city') {
|
| 706 | 706 | $gd_country = ''; |
| 707 | 707 | } else {
|
| 708 | 708 | $gd_country = ''; |
| 709 | - $gd_region = ''; |
|
| 709 | + $gd_region = ''; |
|
| 710 | 710 | } |
| 711 | 711 | |
| 712 | - if ($is_geodir_location_found) {
|
|
| 713 | - $wp->query_vars['gd_country'] = $gd_country; |
|
| 714 | - $wp->query_vars['gd_region'] = $gd_region; |
|
| 715 | - $wp->query_vars['gd_city'] = $gd_city; |
|
| 716 | - } else {
|
|
| 717 | - $gd_country = ''; |
|
| 718 | - $gd_region = ''; |
|
| 719 | - $gd_city = ''; |
|
| 720 | - } |
|
| 721 | - } |
|
| 722 | - |
|
| 723 | - $wp->query_vars[$geodir_taxonomy] = $geodir_term; |
|
| 724 | - // eliminate location related terms from taxonomy term |
|
| 725 | - if ($gd_country != '') |
|
| 726 | - $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_country) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
|
|
| 727 | - |
|
| 728 | - if ($gd_region != '') |
|
| 729 | - $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_region) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
|
|
| 730 | - |
|
| 731 | - if ($gd_city != '') |
|
| 732 | - $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_city) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
|
|
| 733 | - |
|
| 734 | - |
|
| 735 | - $wp->query_vars[$geodir_taxonomy] = str_replace('///', '', $wp->query_vars[$geodir_taxonomy]);
|
|
| 736 | - $wp->query_vars[$geodir_taxonomy] = str_replace('//', '', $wp->query_vars[$geodir_taxonomy]);
|
|
| 737 | - |
|
| 738 | - $wp->query_vars[$geodir_taxonomy] = trim($wp->query_vars[$geodir_taxonomy], '/'); |
|
| 739 | - |
|
| 740 | - if ($wp->query_vars[$geodir_taxonomy] == '') {
|
|
| 741 | - unset($wp->query_vars[$geodir_taxonomy]); |
|
| 742 | - } else {
|
|
| 743 | - if (!$is_geodir_taxonomy_term) {
|
|
| 744 | - foreach ($wp->query_vars as $key => $vars) {
|
|
| 745 | - unset($wp->query_vars[$key]); |
|
| 746 | - } |
|
| 747 | - $wp->query_vars['error'] = '404'; |
|
| 748 | - } |
|
| 749 | - } |
|
| 750 | - } |
|
| 751 | - } |
|
| 712 | + if ($is_geodir_location_found) {
|
|
| 713 | + $wp->query_vars['gd_country'] = $gd_country; |
|
| 714 | + $wp->query_vars['gd_region'] = $gd_region; |
|
| 715 | + $wp->query_vars['gd_city'] = $gd_city; |
|
| 716 | + } else {
|
|
| 717 | + $gd_country = ''; |
|
| 718 | + $gd_region = ''; |
|
| 719 | + $gd_city = ''; |
|
| 720 | + } |
|
| 721 | + } |
|
| 722 | + |
|
| 723 | + $wp->query_vars[$geodir_taxonomy] = $geodir_term; |
|
| 724 | + // eliminate location related terms from taxonomy term |
|
| 725 | + if ($gd_country != '') |
|
| 726 | + $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_country) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
|
|
| 727 | + |
|
| 728 | + if ($gd_region != '') |
|
| 729 | + $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_region) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
|
|
| 730 | + |
|
| 731 | + if ($gd_city != '') |
|
| 732 | + $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_city) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
|
|
| 733 | + |
|
| 734 | + |
|
| 735 | + $wp->query_vars[$geodir_taxonomy] = str_replace('///', '', $wp->query_vars[$geodir_taxonomy]);
|
|
| 736 | + $wp->query_vars[$geodir_taxonomy] = str_replace('//', '', $wp->query_vars[$geodir_taxonomy]);
|
|
| 737 | + |
|
| 738 | + $wp->query_vars[$geodir_taxonomy] = trim($wp->query_vars[$geodir_taxonomy], '/'); |
|
| 739 | + |
|
| 740 | + if ($wp->query_vars[$geodir_taxonomy] == '') {
|
|
| 741 | + unset($wp->query_vars[$geodir_taxonomy]); |
|
| 742 | + } else {
|
|
| 743 | + if (!$is_geodir_taxonomy_term) {
|
|
| 744 | + foreach ($wp->query_vars as $key => $vars) {
|
|
| 745 | + unset($wp->query_vars[$key]); |
|
| 746 | + } |
|
| 747 | + $wp->query_vars['error'] = '404'; |
|
| 748 | + } |
|
| 749 | + } |
|
| 750 | + } |
|
| 751 | + } |
|
| 752 | 752 | |
| 753 | 753 | // Unset location session if gd page and location not set. |
| 754 | 754 | if (isset($wp->query_vars['gd_is_geodir_page']) && !isset($wp->query_vars['gd_country'])) {
|
| 755 | 755 | $gd_session->un_set(array('gd_multi_location', 'gd_city', 'gd_region', 'gd_country'));
|
| 756 | 756 | } |
| 757 | 757 | |
| 758 | - if ($gd_session->get('gd_multi_location') == 1) {
|
|
| 759 | - $wp->query_vars['gd_country'] = $gd_session->get('gd_country');
|
|
| 760 | - $wp->query_vars['gd_region'] = $gd_session->get('gd_region');
|
|
| 761 | - $wp->query_vars['gd_city'] = $gd_session->get('gd_city');
|
|
| 762 | - } |
|
| 758 | + if ($gd_session->get('gd_multi_location') == 1) {
|
|
| 759 | + $wp->query_vars['gd_country'] = $gd_session->get('gd_country');
|
|
| 760 | + $wp->query_vars['gd_region'] = $gd_session->get('gd_region');
|
|
| 761 | + $wp->query_vars['gd_city'] = $gd_session->get('gd_city');
|
|
| 762 | + } |
|
| 763 | 763 | |
| 764 | - // now check if there is location parts in the url or not |
|
| 765 | - if (get_option('geodir_add_location_url')) {
|
|
| 764 | + // now check if there is location parts in the url or not |
|
| 765 | + if (get_option('geodir_add_location_url')) {
|
|
| 766 | 766 | if ($geodir_show_location_url == 'all') {
|
| 767 | 767 | } else if ($geodir_show_location_url == 'country_city') {
|
| 768 | 768 | if (isset($wp->query_vars['gd_region'])) |
| 769 | - $wp->query_vars['gd_region'] = ''; |
|
| 769 | + $wp->query_vars['gd_region'] = ''; |
|
| 770 | 770 | } else if ($geodir_show_location_url == 'region_city') {
|
| 771 | 771 | if (isset($wp->query_vars['gd_country'])) |
| 772 | - $wp->query_vars['gd_country'] = ''; |
|
| 772 | + $wp->query_vars['gd_country'] = ''; |
|
| 773 | 773 | } else {
|
| 774 | 774 | if (isset($wp->query_vars['gd_country'])) |
| 775 | - $wp->query_vars['gd_country'] = ''; |
|
| 775 | + $wp->query_vars['gd_country'] = ''; |
|
| 776 | 776 | |
| 777 | - if (isset($wp->query_vars['gd_region'])) |
|
| 778 | - $wp->query_vars['gd_region'] = ''; |
|
| 777 | + if (isset($wp->query_vars['gd_region'])) |
|
| 778 | + $wp->query_vars['gd_region'] = ''; |
|
| 779 | 779 | } |
| 780 | - } else {
|
|
| 781 | - if (isset($wp->query_vars['gd_country'])) |
|
| 782 | - $wp->query_vars['gd_country'] = ''; |
|
| 780 | + } else {
|
|
| 781 | + if (isset($wp->query_vars['gd_country'])) |
|
| 782 | + $wp->query_vars['gd_country'] = ''; |
|
| 783 | 783 | |
| 784 | - if (isset($wp->query_vars['gd_region'])) |
|
| 785 | - $wp->query_vars['gd_region'] = ''; |
|
| 784 | + if (isset($wp->query_vars['gd_region'])) |
|
| 785 | + $wp->query_vars['gd_region'] = ''; |
|
| 786 | 786 | |
| 787 | - if (isset($wp->query_vars['gd_city'])) |
|
| 788 | - $wp->query_vars['gd_city'] = ''; |
|
| 789 | - } |
|
| 787 | + if (isset($wp->query_vars['gd_city'])) |
|
| 788 | + $wp->query_vars['gd_city'] = ''; |
|
| 789 | + } |
|
| 790 | 790 | } |
| 791 | 791 | |
| 792 | 792 | /** |
@@ -800,24 +800,24 @@ discard block |
||
| 800 | 800 | */ |
| 801 | 801 | function geodir_custom_post_status() |
| 802 | 802 | {
|
| 803 | - // Virtual Page Status |
|
| 804 | - register_post_status('virtual', array(
|
|
| 805 | - 'label' => _x('Virtual', 'page', 'geodirectory'),
|
|
| 806 | - 'public' => true, |
|
| 807 | - 'exclude_from_search' => true, |
|
| 808 | - 'show_in_admin_all_list' => true, |
|
| 809 | - 'show_in_admin_status_list' => true, |
|
| 810 | - 'label_count' => _n_noop('Virtual <span class="count">(%s)</span>', 'Virtual <span class="count">(%s)</span>', 'geodirectory'),
|
|
| 811 | - )); |
|
| 812 | - |
|
| 813 | - /** |
|
| 814 | - * Called after we register the custom post status 'Virtual'. |
|
| 815 | - * |
|
| 816 | - * Can be use to add more post statuses. |
|
| 817 | - * |
|
| 818 | - * @since 1.0.0 |
|
| 819 | - */ |
|
| 820 | - do_action('geodir_custom_post_status');
|
|
| 803 | + // Virtual Page Status |
|
| 804 | + register_post_status('virtual', array(
|
|
| 805 | + 'label' => _x('Virtual', 'page', 'geodirectory'),
|
|
| 806 | + 'public' => true, |
|
| 807 | + 'exclude_from_search' => true, |
|
| 808 | + 'show_in_admin_all_list' => true, |
|
| 809 | + 'show_in_admin_status_list' => true, |
|
| 810 | + 'label_count' => _n_noop('Virtual <span class="count">(%s)</span>', 'Virtual <span class="count">(%s)</span>', 'geodirectory'),
|
|
| 811 | + )); |
|
| 812 | + |
|
| 813 | + /** |
|
| 814 | + * Called after we register the custom post status 'Virtual'. |
|
| 815 | + * |
|
| 816 | + * Can be use to add more post statuses. |
|
| 817 | + * |
|
| 818 | + * @since 1.0.0 |
|
| 819 | + */ |
|
| 820 | + do_action('geodir_custom_post_status');
|
|
| 821 | 821 | } |
| 822 | 822 | |
| 823 | 823 | /** |
@@ -832,7 +832,7 @@ discard block |
||
| 832 | 832 | */ |
| 833 | 833 | function geodir_get_term_link($termlink, $term, $taxonomy) |
| 834 | 834 | {
|
| 835 | - return geodir_term_link($termlink, $term, $taxonomy); // taxonomy_functions.php |
|
| 835 | + return geodir_term_link($termlink, $term, $taxonomy); // taxonomy_functions.php |
|
| 836 | 836 | } |
| 837 | 837 | |
| 838 | 838 | /** |
@@ -846,7 +846,7 @@ discard block |
||
| 846 | 846 | */ |
| 847 | 847 | function geodir_get_posttype_link($link, $post_type) |
| 848 | 848 | {
|
| 849 | - return geodir_posttype_link($link, $post_type); // taxonomy_functions.php |
|
| 849 | + return geodir_posttype_link($link, $post_type); // taxonomy_functions.php |
|
| 850 | 850 | } |
| 851 | 851 | |
| 852 | 852 | /** |
@@ -861,13 +861,13 @@ discard block |
||
| 861 | 861 | */ |
| 862 | 862 | function exclude_from_wp_list_pages($exclude_array) |
| 863 | 863 | {
|
| 864 | - $pages_ids = array(); |
|
| 865 | - $pages_array = get_posts(array('post_type' => 'page', 'post_status' => 'virtual'));
|
|
| 866 | - foreach ($pages_array as $page) {
|
|
| 867 | - $pages_ids[] = $page->ID; |
|
| 868 | - } |
|
| 869 | - $exclude_array = $exclude_array + $pages_ids; |
|
| 870 | - return $exclude_array; |
|
| 864 | + $pages_ids = array(); |
|
| 865 | + $pages_array = get_posts(array('post_type' => 'page', 'post_status' => 'virtual'));
|
|
| 866 | + foreach ($pages_array as $page) {
|
|
| 867 | + $pages_ids[] = $page->ID; |
|
| 868 | + } |
|
| 869 | + $exclude_array = $exclude_array + $pages_ids; |
|
| 870 | + return $exclude_array; |
|
| 871 | 871 | } |
| 872 | 872 | |
| 873 | 873 | /** |
@@ -880,8 +880,8 @@ discard block |
||
| 880 | 880 | */ |
| 881 | 881 | function geodir_exclude_page($query) |
| 882 | 882 | {
|
| 883 | - add_filter('posts_where', 'geodir_exclude_page_where', 100);
|
|
| 884 | - return $query; |
|
| 883 | + add_filter('posts_where', 'geodir_exclude_page_where', 100);
|
|
| 884 | + return $query; |
|
| 885 | 885 | } |
| 886 | 886 | |
| 887 | 887 | /** |
@@ -896,11 +896,11 @@ discard block |
||
| 896 | 896 | */ |
| 897 | 897 | function geodir_exclude_page_where($where) |
| 898 | 898 | {
|
| 899 | - global $wpdb; |
|
| 900 | - if (is_admin()) |
|
| 901 | - $where .= " AND $wpdb->posts.post_status != 'virtual'"; |
|
| 899 | + global $wpdb; |
|
| 900 | + if (is_admin()) |
|
| 901 | + $where .= " AND $wpdb->posts.post_status != 'virtual'"; |
|
| 902 | 902 | |
| 903 | - return $where; |
|
| 903 | + return $where; |
|
| 904 | 904 | } |
| 905 | 905 | |
| 906 | 906 | /** |
@@ -915,20 +915,20 @@ discard block |
||
| 915 | 915 | * @return mixed The taxonomy option value. |
| 916 | 916 | */ |
| 917 | 917 | function geodir_wpseo_taxonomy_meta( $value, $option = '' ) {
|
| 918 | - global $wp_query; |
|
| 918 | + global $wp_query; |
|
| 919 | 919 | |
| 920 | - if ( !empty( $value ) && ( is_category() || is_tax() ) ) {
|
|
| 921 | - $term = $wp_query->get_queried_object(); |
|
| 920 | + if ( !empty( $value ) && ( is_category() || is_tax() ) ) {
|
|
| 921 | + $term = $wp_query->get_queried_object(); |
|
| 922 | 922 | |
| 923 | - if ( !empty( $term->term_id ) && !empty( $term->taxonomy ) && isset( $value[$term->taxonomy][$term->term_id] ) && in_array( str_replace( 'category', '', $term->taxonomy ), geodir_get_posttypes() ) ) {
|
|
| 924 | - $image = geodir_get_default_catimage( $term->term_id, str_replace( 'category', '', $term->taxonomy ) ); |
|
| 923 | + if ( !empty( $term->term_id ) && !empty( $term->taxonomy ) && isset( $value[$term->taxonomy][$term->term_id] ) && in_array( str_replace( 'category', '', $term->taxonomy ), geodir_get_posttypes() ) ) {
|
|
| 924 | + $image = geodir_get_default_catimage( $term->term_id, str_replace( 'category', '', $term->taxonomy ) ); |
|
| 925 | 925 | |
| 926 | - if ( !empty( $image['src'] ) ) {
|
|
| 927 | - $value[$term->taxonomy][$term->term_id]['wpseo_twitter-image'] = $image['src']; |
|
| 928 | - $value[$term->taxonomy][$term->term_id]['wpseo_opengraph-image'] = $image['src']; |
|
| 929 | - } |
|
| 930 | - } |
|
| 931 | - } |
|
| 932 | - return $value; |
|
| 926 | + if ( !empty( $image['src'] ) ) {
|
|
| 927 | + $value[$term->taxonomy][$term->term_id]['wpseo_twitter-image'] = $image['src']; |
|
| 928 | + $value[$term->taxonomy][$term->term_id]['wpseo_opengraph-image'] = $image['src']; |
|
| 929 | + } |
|
| 930 | + } |
|
| 931 | + } |
|
| 932 | + return $value; |
|
| 933 | 933 | } |
| 934 | 934 | add_filter( 'option_wpseo_taxonomy_meta', 'geodir_wpseo_taxonomy_meta', 10, 2 ); |
@@ -15,296 +15,296 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | function geodir_register_sidebar() |
| 17 | 17 | {
|
| 18 | - global $geodir_sidebars; |
|
| 19 | - |
|
| 20 | - if (function_exists('register_sidebar')) {
|
|
| 21 | - /*===========================*/ |
|
| 22 | - /* Home page sidebars start*/ |
|
| 23 | - /*===========================*/ |
|
| 24 | - |
|
| 25 | - /** |
|
| 26 | - * Filter the `$before_widget` widget opening HTML tag. |
|
| 27 | - * |
|
| 28 | - * @since 1.0.0 |
|
| 29 | - * @param string $var The HTML string to filter. Default = '<section id="%1$s" class="widget geodir-widget %2$s">'. |
|
| 30 | - * @see 'geodir_after_widget' |
|
| 31 | - */ |
|
| 32 | - $before_widget = apply_filters('geodir_before_widget', '<section id="%1$s" class="widget geodir-widget %2$s">');
|
|
| 33 | - /** |
|
| 34 | - * Filter the `$after_widget` widget closing HTML tag. |
|
| 35 | - * |
|
| 36 | - * @since 1.0.0 |
|
| 37 | - * @param string $var The HTML string to filter. Default = '</section>'. |
|
| 38 | - * @see 'geodir_before_widget' |
|
| 39 | - */ |
|
| 40 | - $after_widget = apply_filters('geodir_after_widget', '</section>');
|
|
| 41 | - /** |
|
| 42 | - * Filter the `$before_title` widget title opening HTML tag. |
|
| 43 | - * |
|
| 44 | - * @since 1.0.0 |
|
| 45 | - * @param string $var The HTML string to filter. Default = '<h3 class="widget-title">'. |
|
| 46 | - * @see 'geodir_after_title' |
|
| 47 | - */ |
|
| 48 | - $before_title = apply_filters('geodir_before_title', '<h3 class="widget-title">');
|
|
| 49 | - /** |
|
| 50 | - * Filter the `$after_title` widget title closing HTML tag. |
|
| 51 | - * |
|
| 52 | - * @since 1.0.0 |
|
| 53 | - * @param string $var The HTML string to filter. Default = '</h3>'. |
|
| 54 | - * @see 'geodir_before_title' |
|
| 55 | - */ |
|
| 56 | - $after_title = apply_filters('geodir_after_title', '</h3>');
|
|
| 57 | - |
|
| 58 | - if (get_option('geodir_show_home_top_section')) {
|
|
| 59 | - register_sidebars(1, array('id' => 'geodir_home_top', 'name' => __('GD Home Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 60 | - |
|
| 61 | - $geodir_sidebars[] = 'geodir_home_top'; |
|
| 62 | - } |
|
| 63 | - |
|
| 64 | - if (get_option('geodir_show_home_contant_section')) {
|
|
| 65 | - register_sidebars(1, array('id' => 'geodir_home_content', 'name' => __('GD Home Content Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 18 | + global $geodir_sidebars; |
|
| 66 | 19 | |
| 67 | - $geodir_sidebars[] = 'geodir_home_content'; |
|
| 68 | - } |
|
| 20 | + if (function_exists('register_sidebar')) {
|
|
| 21 | + /*===========================*/ |
|
| 22 | + /* Home page sidebars start*/ |
|
| 23 | + /*===========================*/ |
|
| 69 | 24 | |
| 70 | - if (get_option('geodir_show_home_right_section')) {
|
|
| 71 | - register_sidebars(1, array('id' => 'geodir_home_right', 'name' => __('GD Home Right Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 25 | + /** |
|
| 26 | + * Filter the `$before_widget` widget opening HTML tag. |
|
| 27 | + * |
|
| 28 | + * @since 1.0.0 |
|
| 29 | + * @param string $var The HTML string to filter. Default = '<section id="%1$s" class="widget geodir-widget %2$s">'. |
|
| 30 | + * @see 'geodir_after_widget' |
|
| 31 | + */ |
|
| 32 | + $before_widget = apply_filters('geodir_before_widget', '<section id="%1$s" class="widget geodir-widget %2$s">');
|
|
| 33 | + /** |
|
| 34 | + * Filter the `$after_widget` widget closing HTML tag. |
|
| 35 | + * |
|
| 36 | + * @since 1.0.0 |
|
| 37 | + * @param string $var The HTML string to filter. Default = '</section>'. |
|
| 38 | + * @see 'geodir_before_widget' |
|
| 39 | + */ |
|
| 40 | + $after_widget = apply_filters('geodir_after_widget', '</section>');
|
|
| 41 | + /** |
|
| 42 | + * Filter the `$before_title` widget title opening HTML tag. |
|
| 43 | + * |
|
| 44 | + * @since 1.0.0 |
|
| 45 | + * @param string $var The HTML string to filter. Default = '<h3 class="widget-title">'. |
|
| 46 | + * @see 'geodir_after_title' |
|
| 47 | + */ |
|
| 48 | + $before_title = apply_filters('geodir_before_title', '<h3 class="widget-title">');
|
|
| 49 | + /** |
|
| 50 | + * Filter the `$after_title` widget title closing HTML tag. |
|
| 51 | + * |
|
| 52 | + * @since 1.0.0 |
|
| 53 | + * @param string $var The HTML string to filter. Default = '</h3>'. |
|
| 54 | + * @see 'geodir_before_title' |
|
| 55 | + */ |
|
| 56 | + $after_title = apply_filters('geodir_after_title', '</h3>');
|
|
| 57 | + |
|
| 58 | + if (get_option('geodir_show_home_top_section')) {
|
|
| 59 | + register_sidebars(1, array('id' => 'geodir_home_top', 'name' => __('GD Home Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 72 | 60 | |
| 73 | - $geodir_sidebars[] = 'geodir_home_right'; |
|
| 74 | - } |
|
| 61 | + $geodir_sidebars[] = 'geodir_home_top'; |
|
| 62 | + } |
|
| 75 | 63 | |
| 76 | - if (get_option('geodir_show_home_left_section')) {
|
|
| 77 | - register_sidebars(1, array('id' => 'geodir_home_left', 'name' => __('GD Home Left Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 64 | + if (get_option('geodir_show_home_contant_section')) {
|
|
| 65 | + register_sidebars(1, array('id' => 'geodir_home_content', 'name' => __('GD Home Content Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 78 | 66 | |
| 79 | - $geodir_sidebars[] = 'geodir_home_left'; |
|
| 80 | - } |
|
| 67 | + $geodir_sidebars[] = 'geodir_home_content'; |
|
| 68 | + } |
|
| 81 | 69 | |
| 82 | - if (get_option('geodir_show_home_bottom_section')) {
|
|
| 83 | - register_sidebars(1, array('id' => 'geodir_home_bottom', 'name' => __('GD Home Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 70 | + if (get_option('geodir_show_home_right_section')) {
|
|
| 71 | + register_sidebars(1, array('id' => 'geodir_home_right', 'name' => __('GD Home Right Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 84 | 72 | |
| 85 | - $geodir_sidebars[] = 'geodir_home_bottom'; |
|
| 86 | - } |
|
| 73 | + $geodir_sidebars[] = 'geodir_home_right'; |
|
| 74 | + } |
|
| 87 | 75 | |
| 88 | - /*===========================*/ |
|
| 89 | - /* Home page sidebars end*/ |
|
| 90 | - /*===========================*/ |
|
| 76 | + if (get_option('geodir_show_home_left_section')) {
|
|
| 77 | + register_sidebars(1, array('id' => 'geodir_home_left', 'name' => __('GD Home Left Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 91 | 78 | |
| 92 | - /*===========================*/ |
|
| 93 | - /* Listing page sidebars start*/ |
|
| 94 | - /*===========================*/ |
|
| 79 | + $geodir_sidebars[] = 'geodir_home_left'; |
|
| 80 | + } |
|
| 95 | 81 | |
| 96 | - if (get_option('geodir_show_listing_top_section')) {
|
|
| 97 | - register_sidebars(1, array('id' => 'geodir_listing_top', 'name' => __('GD Listing Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 82 | + if (get_option('geodir_show_home_bottom_section')) {
|
|
| 83 | + register_sidebars(1, array('id' => 'geodir_home_bottom', 'name' => __('GD Home Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 98 | 84 | |
| 99 | - $geodir_sidebars[] = 'geodir_listing_top'; |
|
| 100 | - } |
|
| 85 | + $geodir_sidebars[] = 'geodir_home_bottom'; |
|
| 86 | + } |
|
| 101 | 87 | |
| 102 | - if (get_option('geodir_show_listing_left_section')) {
|
|
| 103 | - register_sidebars(1, array('id' => 'geodir_listing_left_sidebar', 'name' => __('GD Listing Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 88 | + /*===========================*/ |
|
| 89 | + /* Home page sidebars end*/ |
|
| 90 | + /*===========================*/ |
|
| 104 | 91 | |
| 105 | - $geodir_sidebars[] = 'geodir_listing_left_sidebar'; |
|
| 106 | - } |
|
| 92 | + /*===========================*/ |
|
| 93 | + /* Listing page sidebars start*/ |
|
| 94 | + /*===========================*/ |
|
| 107 | 95 | |
| 108 | - if (get_option('geodir_show_listing_right_section')) {
|
|
| 109 | - register_sidebars(1, array('id' => 'geodir_listing_right_sidebar', 'name' => __('GD Listing Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 96 | + if (get_option('geodir_show_listing_top_section')) {
|
|
| 97 | + register_sidebars(1, array('id' => 'geodir_listing_top', 'name' => __('GD Listing Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 110 | 98 | |
| 111 | - $geodir_sidebars[] = 'geodir_listing_right_sidebar'; |
|
| 112 | - } |
|
| 99 | + $geodir_sidebars[] = 'geodir_listing_top'; |
|
| 100 | + } |
|
| 113 | 101 | |
| 114 | - if (get_option('geodir_show_listing_bottom_section')) {
|
|
| 115 | - register_sidebars(1, array('id' => 'geodir_listing_bottom', 'name' => __('GD Listing Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 102 | + if (get_option('geodir_show_listing_left_section')) {
|
|
| 103 | + register_sidebars(1, array('id' => 'geodir_listing_left_sidebar', 'name' => __('GD Listing Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 116 | 104 | |
| 117 | - $geodir_sidebars[] = 'geodir_listing_bottom'; |
|
| 118 | - } |
|
| 105 | + $geodir_sidebars[] = 'geodir_listing_left_sidebar'; |
|
| 106 | + } |
|
| 119 | 107 | |
| 120 | - /*===========================*/ |
|
| 121 | - /* Listing page sidebars start*/ |
|
| 122 | - /*===========================*/ |
|
| 108 | + if (get_option('geodir_show_listing_right_section')) {
|
|
| 109 | + register_sidebars(1, array('id' => 'geodir_listing_right_sidebar', 'name' => __('GD Listing Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 123 | 110 | |
| 124 | - /*===========================*/ |
|
| 125 | - /* Search page sidebars start*/ |
|
| 126 | - /*===========================*/ |
|
| 111 | + $geodir_sidebars[] = 'geodir_listing_right_sidebar'; |
|
| 112 | + } |
|
| 127 | 113 | |
| 128 | - if (get_option('geodir_show_search_top_section')) {
|
|
| 129 | - register_sidebars(1, array('id' => 'geodir_search_top', 'name' => __('GD Search Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 114 | + if (get_option('geodir_show_listing_bottom_section')) {
|
|
| 115 | + register_sidebars(1, array('id' => 'geodir_listing_bottom', 'name' => __('GD Listing Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 130 | 116 | |
| 131 | - $geodir_sidebars[] = 'geodir_search_top'; |
|
| 132 | - } |
|
| 117 | + $geodir_sidebars[] = 'geodir_listing_bottom'; |
|
| 118 | + } |
|
| 133 | 119 | |
| 134 | - if (get_option('geodir_show_search_left_section')) {
|
|
| 135 | - register_sidebars(1, array('id' => 'geodir_search_left_sidebar', 'name' => __('GD Search Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 120 | + /*===========================*/ |
|
| 121 | + /* Listing page sidebars start*/ |
|
| 122 | + /*===========================*/ |
|
| 136 | 123 | |
| 137 | - $geodir_sidebars[] = 'geodir_search_left_sidebar'; |
|
| 138 | - } |
|
| 124 | + /*===========================*/ |
|
| 125 | + /* Search page sidebars start*/ |
|
| 126 | + /*===========================*/ |
|
| 139 | 127 | |
| 140 | - if (get_option('geodir_show_search_right_section')) {
|
|
| 141 | - register_sidebars(1, array('id' => 'geodir_search_right_sidebar', 'name' => __('GD Search Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 128 | + if (get_option('geodir_show_search_top_section')) {
|
|
| 129 | + register_sidebars(1, array('id' => 'geodir_search_top', 'name' => __('GD Search Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 142 | 130 | |
| 143 | - $geodir_sidebars[] = 'geodir_search_right_sidebar'; |
|
| 144 | - } |
|
| 131 | + $geodir_sidebars[] = 'geodir_search_top'; |
|
| 132 | + } |
|
| 145 | 133 | |
| 146 | - if (get_option('geodir_show_search_bottom_section')) {
|
|
| 147 | - register_sidebars(1, array('id' => 'geodir_search_bottom', 'name' => __('GD Search Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 134 | + if (get_option('geodir_show_search_left_section')) {
|
|
| 135 | + register_sidebars(1, array('id' => 'geodir_search_left_sidebar', 'name' => __('GD Search Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 148 | 136 | |
| 149 | - $geodir_sidebars[] = 'geodir_search_bottom'; |
|
| 150 | - } |
|
| 137 | + $geodir_sidebars[] = 'geodir_search_left_sidebar'; |
|
| 138 | + } |
|
| 151 | 139 | |
| 152 | - /*===========================*/ |
|
| 153 | - /* Search page sidebars end*/ |
|
| 154 | - /*===========================*/ |
|
| 140 | + if (get_option('geodir_show_search_right_section')) {
|
|
| 141 | + register_sidebars(1, array('id' => 'geodir_search_right_sidebar', 'name' => __('GD Search Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 155 | 142 | |
| 156 | - /*==================================*/ |
|
| 157 | - /* Detail/Single page sidebars start*/ |
|
| 158 | - /*==================================*/ |
|
| 159 | - if (get_option('geodir_show_detail_top_section')) {
|
|
| 160 | - register_sidebars(1, array('id' => 'geodir_detail_top', 'name' => __('GD Detail Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 143 | + $geodir_sidebars[] = 'geodir_search_right_sidebar'; |
|
| 144 | + } |
|
| 161 | 145 | |
| 162 | - $geodir_sidebars[] = 'geodir_detail_top'; |
|
| 163 | - } |
|
| 146 | + if (get_option('geodir_show_search_bottom_section')) {
|
|
| 147 | + register_sidebars(1, array('id' => 'geodir_search_bottom', 'name' => __('GD Search Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 164 | 148 | |
| 165 | - register_sidebars(1, array('id' => 'geodir_detail_sidebar', 'name' => __('GD Detail Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 149 | + $geodir_sidebars[] = 'geodir_search_bottom'; |
|
| 150 | + } |
|
| 166 | 151 | |
| 167 | - $geodir_sidebars[] = 'geodir_detail_sidebar'; |
|
| 152 | + /*===========================*/ |
|
| 153 | + /* Search page sidebars end*/ |
|
| 154 | + /*===========================*/ |
|
| 168 | 155 | |
| 169 | - if (get_option('geodir_show_detail_bottom_section')) {
|
|
| 170 | - register_sidebars(1, array('id' => 'geodir_detail_bottom', 'name' => __('GD Detail Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 156 | + /*==================================*/ |
|
| 157 | + /* Detail/Single page sidebars start*/ |
|
| 158 | + /*==================================*/ |
|
| 159 | + if (get_option('geodir_show_detail_top_section')) {
|
|
| 160 | + register_sidebars(1, array('id' => 'geodir_detail_top', 'name' => __('GD Detail Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 171 | 161 | |
| 172 | - $geodir_sidebars[] = 'geodir_detail_bottom'; |
|
| 173 | - } |
|
| 162 | + $geodir_sidebars[] = 'geodir_detail_top'; |
|
| 163 | + } |
|
| 174 | 164 | |
| 175 | - /*==================================*/ |
|
| 176 | - /* Detail/Single page sidebars end*/ |
|
| 177 | - /*==================================*/ |
|
| 165 | + register_sidebars(1, array('id' => 'geodir_detail_sidebar', 'name' => __('GD Detail Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 178 | 166 | |
| 179 | - /*==================================*/ |
|
| 180 | - /* Author page sidebars start */ |
|
| 181 | - /*==================================*/ |
|
| 167 | + $geodir_sidebars[] = 'geodir_detail_sidebar'; |
|
| 182 | 168 | |
| 183 | - if (get_option('geodir_show_author_top_section')) {
|
|
| 184 | - register_sidebars(1, array('id' => 'geodir_author_top', 'name' => __('GD Author Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 169 | + if (get_option('geodir_show_detail_bottom_section')) {
|
|
| 170 | + register_sidebars(1, array('id' => 'geodir_detail_bottom', 'name' => __('GD Detail Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 185 | 171 | |
| 186 | - $geodir_sidebars[] = 'geodir_author_top'; |
|
| 187 | - } |
|
| 172 | + $geodir_sidebars[] = 'geodir_detail_bottom'; |
|
| 173 | + } |
|
| 188 | 174 | |
| 189 | - if (get_option('geodir_show_author_left_section')) {
|
|
| 190 | - register_sidebars(1, array('id' => 'geodir_author_left_sidebar', 'name' => __('GD Author Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 175 | + /*==================================*/ |
|
| 176 | + /* Detail/Single page sidebars end*/ |
|
| 177 | + /*==================================*/ |
|
| 191 | 178 | |
| 192 | - $geodir_sidebars[] = 'geodir_author_left_sidebar'; |
|
| 193 | - } |
|
| 179 | + /*==================================*/ |
|
| 180 | + /* Author page sidebars start */ |
|
| 181 | + /*==================================*/ |
|
| 194 | 182 | |
| 195 | - if (get_option('geodir_show_author_right_section')) {
|
|
| 196 | - register_sidebars(1, array('id' => 'geodir_author_right_sidebar', 'name' => __('GD Author Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 183 | + if (get_option('geodir_show_author_top_section')) {
|
|
| 184 | + register_sidebars(1, array('id' => 'geodir_author_top', 'name' => __('GD Author Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 197 | 185 | |
| 198 | - $geodir_sidebars[] = 'geodir_author_right_sidebar'; |
|
| 199 | - } |
|
| 186 | + $geodir_sidebars[] = 'geodir_author_top'; |
|
| 187 | + } |
|
| 200 | 188 | |
| 201 | - if (get_option('geodir_show_author_bottom_section')) {
|
|
| 202 | - register_sidebars(1, array('id' => 'geodir_author_bottom', 'name' => __('GD Author Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 189 | + if (get_option('geodir_show_author_left_section')) {
|
|
| 190 | + register_sidebars(1, array('id' => 'geodir_author_left_sidebar', 'name' => __('GD Author Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 203 | 191 | |
| 204 | - $geodir_sidebars[] = 'geodir_author_bottom'; |
|
| 205 | - } |
|
| 192 | + $geodir_sidebars[] = 'geodir_author_left_sidebar'; |
|
| 193 | + } |
|
| 206 | 194 | |
| 207 | - /*==================================*/ |
|
| 208 | - /* Author page sidebars end */ |
|
| 209 | - /*==================================*/ |
|
| 195 | + if (get_option('geodir_show_author_right_section')) {
|
|
| 196 | + register_sidebars(1, array('id' => 'geodir_author_right_sidebar', 'name' => __('GD Author Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 210 | 197 | |
| 211 | - /*==================================*/ |
|
| 212 | - /* Add listing page sidebars start */ |
|
| 213 | - /*==================================*/ |
|
| 198 | + $geodir_sidebars[] = 'geodir_author_right_sidebar'; |
|
| 199 | + } |
|
| 214 | 200 | |
| 215 | - register_sidebars(1, array('id' => 'geodir_add_listing_sidebar', 'name' => __('GD Add Listing Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 201 | + if (get_option('geodir_show_author_bottom_section')) {
|
|
| 202 | + register_sidebars(1, array('id' => 'geodir_author_bottom', 'name' => __('GD Author Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 216 | 203 | |
| 217 | - $geodir_sidebars[] = 'geodir_add_listing_sidebar'; |
|
| 204 | + $geodir_sidebars[] = 'geodir_author_bottom'; |
|
| 205 | + } |
|
| 218 | 206 | |
| 219 | - /*==================================*/ |
|
| 220 | - /* Add listing page sidebars end */ |
|
| 221 | - /*==================================*/ |
|
| 207 | + /*==================================*/ |
|
| 208 | + /* Author page sidebars end */ |
|
| 209 | + /*==================================*/ |
|
| 222 | 210 | |
| 223 | - } |
|
| 211 | + /*==================================*/ |
|
| 212 | + /* Add listing page sidebars start */ |
|
| 213 | + /*==================================*/ |
|
| 214 | + |
|
| 215 | + register_sidebars(1, array('id' => 'geodir_add_listing_sidebar', 'name' => __('GD Add Listing Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 216 | + |
|
| 217 | + $geodir_sidebars[] = 'geodir_add_listing_sidebar'; |
|
| 218 | + |
|
| 219 | + /*==================================*/ |
|
| 220 | + /* Add listing page sidebars end */ |
|
| 221 | + /*==================================*/ |
|
| 222 | + |
|
| 223 | + } |
|
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | |
| 227 | 227 | if (!function_exists('register_geodir_widgets')) {
|
| 228 | - /** |
|
| 229 | - * Registers all Widgets. |
|
| 230 | - * |
|
| 231 | - * @since 1.0.0 |
|
| 232 | - * @package GeoDirectory |
|
| 233 | - */ |
|
| 234 | - function register_geodir_widgets() |
|
| 235 | - {
|
|
| 236 | - /** |
|
| 237 | - * Login Widget. |
|
| 238 | - * |
|
| 239 | - * @since 1.0.0 |
|
| 240 | - */ |
|
| 241 | - class geodir_loginwidget extends WP_Widget |
|
| 242 | - {
|
|
| 243 | - /** |
|
| 244 | - * Register the login widget with WordPress. |
|
| 245 | - * |
|
| 246 | - * @since 1.0.0 |
|
| 247 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 248 | - */ |
|
| 249 | - public function __construct() {
|
|
| 250 | - $widget_ops = array('classname' => 'geodir_loginbox', 'description' => __('Geodirectory Loginbox Widget', 'geodirectory'));
|
|
| 251 | - parent::__construct( |
|
| 252 | - 'geodir_loginbox', // Base ID |
|
| 253 | - __('GD > Loginbox', 'geodirectory'), // Name
|
|
| 254 | - $widget_ops// Args |
|
| 255 | - ); |
|
| 256 | - } |
|
| 257 | - |
|
| 258 | - /** |
|
| 259 | - * Front-end display content for login widget. |
|
| 260 | - * |
|
| 261 | - * @since 1.0.0 |
|
| 262 | - * @since 1.5.1 Declare function public. |
|
| 263 | - * |
|
| 264 | - * @param array $args Widget arguments. |
|
| 265 | - * @param array $instance Saved values from database. |
|
| 266 | - */ |
|
| 267 | - public function widget($args, $instance) |
|
| 268 | - {
|
|
| 269 | - geodir_loginwidget_output($args, $instance); |
|
| 270 | - } |
|
| 271 | - |
|
| 272 | - /** |
|
| 273 | - * Sanitize login widget form values as they are saved. |
|
| 274 | - * |
|
| 275 | - * @since 1.0.0 |
|
| 276 | - * @since 1.5.1 Declare function public. |
|
| 277 | - * |
|
| 278 | - * @param array $new_instance Values just sent to be saved. |
|
| 279 | - * @param array $old_instance Previously saved values from database. |
|
| 280 | - * |
|
| 281 | - * @return array Updated safe values to be saved. |
|
| 282 | - */ |
|
| 283 | - public function update($new_instance, $old_instance) |
|
| 284 | - {
|
|
| 285 | - //save the widget |
|
| 286 | - $instance = $old_instance; |
|
| 287 | - $instance['title'] = strip_tags($new_instance['title']); |
|
| 288 | - |
|
| 289 | - return $instance; |
|
| 290 | - } |
|
| 291 | - |
|
| 292 | - /** |
|
| 293 | - * Back-end login widget settings form. |
|
| 294 | - * |
|
| 295 | - * @since 1.0.0 |
|
| 296 | - * @since 1.5.1 Declare function public. |
|
| 297 | - * |
|
| 298 | - * @param array $instance Previously saved values from database. |
|
| 299 | - * @return string|void |
|
| 300 | - */ |
|
| 301 | - public function form($instance) |
|
| 302 | - {
|
|
| 303 | - //widgetform in backend |
|
| 304 | - $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => ''));
|
|
| 305 | - $title = strip_tags($instance['title']); |
|
| 306 | - |
|
| 307 | - ?> |
|
| 228 | + /** |
|
| 229 | + * Registers all Widgets. |
|
| 230 | + * |
|
| 231 | + * @since 1.0.0 |
|
| 232 | + * @package GeoDirectory |
|
| 233 | + */ |
|
| 234 | + function register_geodir_widgets() |
|
| 235 | + {
|
|
| 236 | + /** |
|
| 237 | + * Login Widget. |
|
| 238 | + * |
|
| 239 | + * @since 1.0.0 |
|
| 240 | + */ |
|
| 241 | + class geodir_loginwidget extends WP_Widget |
|
| 242 | + {
|
|
| 243 | + /** |
|
| 244 | + * Register the login widget with WordPress. |
|
| 245 | + * |
|
| 246 | + * @since 1.0.0 |
|
| 247 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 248 | + */ |
|
| 249 | + public function __construct() {
|
|
| 250 | + $widget_ops = array('classname' => 'geodir_loginbox', 'description' => __('Geodirectory Loginbox Widget', 'geodirectory'));
|
|
| 251 | + parent::__construct( |
|
| 252 | + 'geodir_loginbox', // Base ID |
|
| 253 | + __('GD > Loginbox', 'geodirectory'), // Name
|
|
| 254 | + $widget_ops// Args |
|
| 255 | + ); |
|
| 256 | + } |
|
| 257 | + |
|
| 258 | + /** |
|
| 259 | + * Front-end display content for login widget. |
|
| 260 | + * |
|
| 261 | + * @since 1.0.0 |
|
| 262 | + * @since 1.5.1 Declare function public. |
|
| 263 | + * |
|
| 264 | + * @param array $args Widget arguments. |
|
| 265 | + * @param array $instance Saved values from database. |
|
| 266 | + */ |
|
| 267 | + public function widget($args, $instance) |
|
| 268 | + {
|
|
| 269 | + geodir_loginwidget_output($args, $instance); |
|
| 270 | + } |
|
| 271 | + |
|
| 272 | + /** |
|
| 273 | + * Sanitize login widget form values as they are saved. |
|
| 274 | + * |
|
| 275 | + * @since 1.0.0 |
|
| 276 | + * @since 1.5.1 Declare function public. |
|
| 277 | + * |
|
| 278 | + * @param array $new_instance Values just sent to be saved. |
|
| 279 | + * @param array $old_instance Previously saved values from database. |
|
| 280 | + * |
|
| 281 | + * @return array Updated safe values to be saved. |
|
| 282 | + */ |
|
| 283 | + public function update($new_instance, $old_instance) |
|
| 284 | + {
|
|
| 285 | + //save the widget |
|
| 286 | + $instance = $old_instance; |
|
| 287 | + $instance['title'] = strip_tags($new_instance['title']); |
|
| 288 | + |
|
| 289 | + return $instance; |
|
| 290 | + } |
|
| 291 | + |
|
| 292 | + /** |
|
| 293 | + * Back-end login widget settings form. |
|
| 294 | + * |
|
| 295 | + * @since 1.0.0 |
|
| 296 | + * @since 1.5.1 Declare function public. |
|
| 297 | + * |
|
| 298 | + * @param array $instance Previously saved values from database. |
|
| 299 | + * @return string|void |
|
| 300 | + */ |
|
| 301 | + public function form($instance) |
|
| 302 | + {
|
|
| 303 | + //widgetform in backend |
|
| 304 | + $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => ''));
|
|
| 305 | + $title = strip_tags($instance['title']); |
|
| 306 | + |
|
| 307 | + ?> |
|
| 308 | 308 | <p><label |
| 309 | 309 | for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Widget Title', 'geodirectory'); ?>
|
| 310 | 310 | : <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>"
|
@@ -313,64 +313,64 @@ discard block |
||
| 313 | 313 | |
| 314 | 314 | |
| 315 | 315 | <?php |
| 316 | - } |
|
| 317 | - } |
|
| 318 | - |
|
| 319 | - register_widget('geodir_loginwidget');
|
|
| 320 | - |
|
| 321 | - |
|
| 322 | - /** |
|
| 323 | - * GeoDirectory Social Like Widget. |
|
| 324 | - * |
|
| 325 | - * @since 1.0.0 |
|
| 326 | - */ |
|
| 327 | - class geodir_social_like_widget extends WP_Widget |
|
| 328 | - {
|
|
| 329 | - |
|
| 330 | - /** |
|
| 331 | - * Register the social like widget with WordPress. |
|
| 332 | - * |
|
| 333 | - * @since 1.0.0 |
|
| 334 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 335 | - */ |
|
| 336 | - public function __construct() {
|
|
| 337 | - $widget_ops = array('classname' => 'geodir_social_like_widget', 'description' => __('GD > Twitter,Facebook and Google+ buttons', 'geodirectory'));
|
|
| 338 | - parent::__construct( |
|
| 339 | - 'social_like_widget', // Base ID |
|
| 340 | - __('GD > Social Like', 'geodirectory'), // Name
|
|
| 341 | - $widget_ops// Args |
|
| 342 | - ); |
|
| 343 | - } |
|
| 344 | - |
|
| 345 | - /** |
|
| 346 | - * Front-end display content for social like widget. |
|
| 347 | - * |
|
| 348 | - * @since 1.0.0 |
|
| 349 | - * @since 1.5.1 Declare function public. |
|
| 350 | - * |
|
| 351 | - * @param array $args Widget arguments. |
|
| 352 | - * @param array $instance Saved values from database. |
|
| 353 | - */ |
|
| 354 | - public function widget($args, $instance) |
|
| 355 | - {
|
|
| 356 | - // prints the widget |
|
| 357 | - extract($args, EXTR_SKIP); |
|
| 358 | - |
|
| 359 | - /** |
|
| 360 | - * Filter the widget title text. |
|
| 361 | - * |
|
| 362 | - * @since 1.0.0 |
|
| 363 | - * @global object $current_user Current user object. |
|
| 364 | - * @param string $title The widget title text. |
|
| 365 | - */ |
|
| 366 | - $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
|
|
| 367 | - |
|
| 368 | - global $current_user, $post; |
|
| 369 | - echo $before_widget; |
|
| 370 | - ?> |
|
| 316 | + } |
|
| 317 | + } |
|
| 318 | + |
|
| 319 | + register_widget('geodir_loginwidget');
|
|
| 320 | + |
|
| 321 | + |
|
| 322 | + /** |
|
| 323 | + * GeoDirectory Social Like Widget. |
|
| 324 | + * |
|
| 325 | + * @since 1.0.0 |
|
| 326 | + */ |
|
| 327 | + class geodir_social_like_widget extends WP_Widget |
|
| 328 | + {
|
|
| 329 | + |
|
| 330 | + /** |
|
| 331 | + * Register the social like widget with WordPress. |
|
| 332 | + * |
|
| 333 | + * @since 1.0.0 |
|
| 334 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 335 | + */ |
|
| 336 | + public function __construct() {
|
|
| 337 | + $widget_ops = array('classname' => 'geodir_social_like_widget', 'description' => __('GD > Twitter,Facebook and Google+ buttons', 'geodirectory'));
|
|
| 338 | + parent::__construct( |
|
| 339 | + 'social_like_widget', // Base ID |
|
| 340 | + __('GD > Social Like', 'geodirectory'), // Name
|
|
| 341 | + $widget_ops// Args |
|
| 342 | + ); |
|
| 343 | + } |
|
| 344 | + |
|
| 345 | + /** |
|
| 346 | + * Front-end display content for social like widget. |
|
| 347 | + * |
|
| 348 | + * @since 1.0.0 |
|
| 349 | + * @since 1.5.1 Declare function public. |
|
| 350 | + * |
|
| 351 | + * @param array $args Widget arguments. |
|
| 352 | + * @param array $instance Saved values from database. |
|
| 353 | + */ |
|
| 354 | + public function widget($args, $instance) |
|
| 355 | + {
|
|
| 356 | + // prints the widget |
|
| 357 | + extract($args, EXTR_SKIP); |
|
| 358 | + |
|
| 359 | + /** |
|
| 360 | + * Filter the widget title text. |
|
| 361 | + * |
|
| 362 | + * @since 1.0.0 |
|
| 363 | + * @global object $current_user Current user object. |
|
| 364 | + * @param string $title The widget title text. |
|
| 365 | + */ |
|
| 366 | + $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
|
|
| 367 | + |
|
| 368 | + global $current_user, $post; |
|
| 369 | + echo $before_widget; |
|
| 370 | + ?> |
|
| 371 | 371 | |
| 372 | 372 | <?php //if ( get_option('gd_tweet_button') ) {
|
| 373 | - ?> |
|
| 373 | + ?> |
|
| 374 | 374 | |
| 375 | 375 | <a href="http://twitter.com/share" |
| 376 | 376 | class="twitter-share-button"><?php _e('Tweet', 'geodirectory');?></a>
|
@@ -378,23 +378,23 @@ discard block |
||
| 378 | 378 | <script type="text/javascript" src="//platform.twitter.com/widgets.js"></script> |
| 379 | 379 | |
| 380 | 380 | <?php //} |
| 381 | - ?> |
|
| 381 | + ?> |
|
| 382 | 382 | |
| 383 | 383 | <?php // if ( get_option('gd_facebook_button') ) {
|
| 384 | - ?> |
|
| 384 | + ?> |
|
| 385 | 385 | |
| 386 | 386 | <iframe <?php if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) {
|
| 387 | - echo 'allowtransparency="true"'; |
|
| 388 | - }?> class="facebook" |
|
| 387 | + echo 'allowtransparency="true"'; |
|
| 388 | + }?> class="facebook" |
|
| 389 | 389 | src="//www.facebook.com/plugins/like.php?href=<?php echo urlencode(geodir_curPageURL()); ?>&layout=button_count&show_faces=false&width=100&action=like&colorscheme=light" |
| 390 | 390 | style="border:none; overflow:hidden; width:100px; height:20px"></iframe> |
| 391 | 391 | |
| 392 | 392 | |
| 393 | 393 | <?php //} |
| 394 | - ?> |
|
| 394 | + ?> |
|
| 395 | 395 | |
| 396 | 396 | <?php //if ( get_option('gd_google_button') ) {
|
| 397 | - ?> |
|
| 397 | + ?> |
|
| 398 | 398 | <script> |
| 399 | 399 | window.___gcfg = {
|
| 400 | 400 | parsetags: 'explicit' |
@@ -408,118 +408,118 @@ discard block |
||
| 408 | 408 | "count": "true" |
| 409 | 409 | });</script> |
| 410 | 410 | <?php //} |
| 411 | - echo $after_widget; |
|
| 412 | - |
|
| 413 | - } |
|
| 414 | - |
|
| 415 | - /** |
|
| 416 | - * Sanitize social like widget form values as they are saved. |
|
| 417 | - * |
|
| 418 | - * @since 1.0.0 |
|
| 419 | - * @since 1.5.1 Declare function public. |
|
| 420 | - * |
|
| 421 | - * @param array $new_instance Values just sent to be saved. |
|
| 422 | - * @param array $old_instance Previously saved values from database. |
|
| 423 | - * |
|
| 424 | - * @return array Updated safe values to be saved. |
|
| 425 | - */ |
|
| 426 | - public function update($new_instance, $old_instance) |
|
| 427 | - {
|
|
| 428 | - //save the widget |
|
| 429 | - $instance = $old_instance; |
|
| 430 | - $instance['title'] = strip_tags($new_instance['title']); |
|
| 431 | - return $instance; |
|
| 432 | - } |
|
| 433 | - |
|
| 434 | - /** |
|
| 435 | - * Back-end social like widget settings form. |
|
| 436 | - * |
|
| 437 | - * @since 1.0.0 |
|
| 438 | - * @since 1.5.1 Declare function public. |
|
| 439 | - * |
|
| 440 | - * @param array $instance Previously saved values from database. |
|
| 441 | - * @return string|void |
|
| 442 | - */ |
|
| 443 | - public function form($instance) |
|
| 444 | - {
|
|
| 445 | - //widgetform in backend |
|
| 446 | - $instance = wp_parse_args((array)$instance, array('title' => ''));
|
|
| 447 | - $title = strip_tags($instance['title']); |
|
| 448 | - ?> |
|
| 411 | + echo $after_widget; |
|
| 412 | + |
|
| 413 | + } |
|
| 414 | + |
|
| 415 | + /** |
|
| 416 | + * Sanitize social like widget form values as they are saved. |
|
| 417 | + * |
|
| 418 | + * @since 1.0.0 |
|
| 419 | + * @since 1.5.1 Declare function public. |
|
| 420 | + * |
|
| 421 | + * @param array $new_instance Values just sent to be saved. |
|
| 422 | + * @param array $old_instance Previously saved values from database. |
|
| 423 | + * |
|
| 424 | + * @return array Updated safe values to be saved. |
|
| 425 | + */ |
|
| 426 | + public function update($new_instance, $old_instance) |
|
| 427 | + {
|
|
| 428 | + //save the widget |
|
| 429 | + $instance = $old_instance; |
|
| 430 | + $instance['title'] = strip_tags($new_instance['title']); |
|
| 431 | + return $instance; |
|
| 432 | + } |
|
| 433 | + |
|
| 434 | + /** |
|
| 435 | + * Back-end social like widget settings form. |
|
| 436 | + * |
|
| 437 | + * @since 1.0.0 |
|
| 438 | + * @since 1.5.1 Declare function public. |
|
| 439 | + * |
|
| 440 | + * @param array $instance Previously saved values from database. |
|
| 441 | + * @return string|void |
|
| 442 | + */ |
|
| 443 | + public function form($instance) |
|
| 444 | + {
|
|
| 445 | + //widgetform in backend |
|
| 446 | + $instance = wp_parse_args((array)$instance, array('title' => ''));
|
|
| 447 | + $title = strip_tags($instance['title']); |
|
| 448 | + ?> |
|
| 449 | 449 | <p>No settings for this widget</p> |
| 450 | 450 | |
| 451 | 451 | |
| 452 | 452 | <?php |
| 453 | - } |
|
| 454 | - } |
|
| 455 | - |
|
| 456 | - register_widget('geodir_social_like_widget');
|
|
| 457 | - |
|
| 458 | - |
|
| 459 | - /** |
|
| 460 | - * GeoDirectory Feedburner Subscribe widget. |
|
| 461 | - * |
|
| 462 | - * @since 1.0.0 |
|
| 463 | - */ |
|
| 464 | - class geodirsubscribeWidget extends WP_Widget |
|
| 465 | - {
|
|
| 466 | - |
|
| 467 | - /** |
|
| 468 | - * Register the feedburner subscribe widget with WordPress. |
|
| 469 | - * |
|
| 470 | - * @since 1.0.0 |
|
| 471 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 472 | - */ |
|
| 473 | - public function __construct() {
|
|
| 474 | - $widget_ops = array('classname' => 'geodir-subscribe', 'description' => __('GD > Google Feedburner Subscribe', 'geodirectory'));
|
|
| 475 | - parent::__construct( |
|
| 476 | - 'widget_subscribeWidget', // Base ID |
|
| 477 | - __('GD > Subscribe', 'geodirectory'), // Name
|
|
| 478 | - $widget_ops// Args |
|
| 479 | - ); |
|
| 480 | - } |
|
| 481 | - |
|
| 482 | - /** |
|
| 483 | - * Front-end display content for feedburner subscribe widget. |
|
| 484 | - * |
|
| 485 | - * @since 1.0.0 |
|
| 486 | - * @since 1.5.1 Declare function public. |
|
| 487 | - * |
|
| 488 | - * @param array $args Widget arguments. |
|
| 489 | - * @param array $instance Saved values from database. |
|
| 490 | - */ |
|
| 491 | - public function widget($args, $instance) |
|
| 492 | - {
|
|
| 493 | - // prints the widget |
|
| 494 | - extract($args, EXTR_SKIP); |
|
| 495 | - |
|
| 496 | - /** |
|
| 497 | - * Filter the widget instance id. |
|
| 498 | - * |
|
| 499 | - * @since 1.0.0 |
|
| 500 | - * @param string $id The widget instance id. |
|
| 501 | - */ |
|
| 502 | - $id = empty($instance['id']) ? '' : apply_filters('widget_id', $instance['id']);
|
|
| 503 | - |
|
| 504 | - /** This filter is documented in geodirectory_widgets.php */ |
|
| 505 | - $title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
|
|
| 506 | - |
|
| 507 | - /** |
|
| 508 | - * Filter the widget text. |
|
| 509 | - * |
|
| 510 | - * @since 1.0.0 |
|
| 511 | - * @param string $text The widget text. |
|
| 512 | - */ |
|
| 513 | - $text = empty($instance['text']) ? '' : apply_filters('widget_text', $instance['text']);
|
|
| 514 | - |
|
| 515 | - echo $before_widget; |
|
| 516 | - ?> |
|
| 453 | + } |
|
| 454 | + } |
|
| 455 | + |
|
| 456 | + register_widget('geodir_social_like_widget');
|
|
| 457 | + |
|
| 458 | + |
|
| 459 | + /** |
|
| 460 | + * GeoDirectory Feedburner Subscribe widget. |
|
| 461 | + * |
|
| 462 | + * @since 1.0.0 |
|
| 463 | + */ |
|
| 464 | + class geodirsubscribeWidget extends WP_Widget |
|
| 465 | + {
|
|
| 466 | + |
|
| 467 | + /** |
|
| 468 | + * Register the feedburner subscribe widget with WordPress. |
|
| 469 | + * |
|
| 470 | + * @since 1.0.0 |
|
| 471 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 472 | + */ |
|
| 473 | + public function __construct() {
|
|
| 474 | + $widget_ops = array('classname' => 'geodir-subscribe', 'description' => __('GD > Google Feedburner Subscribe', 'geodirectory'));
|
|
| 475 | + parent::__construct( |
|
| 476 | + 'widget_subscribeWidget', // Base ID |
|
| 477 | + __('GD > Subscribe', 'geodirectory'), // Name
|
|
| 478 | + $widget_ops// Args |
|
| 479 | + ); |
|
| 480 | + } |
|
| 481 | + |
|
| 482 | + /** |
|
| 483 | + * Front-end display content for feedburner subscribe widget. |
|
| 484 | + * |
|
| 485 | + * @since 1.0.0 |
|
| 486 | + * @since 1.5.1 Declare function public. |
|
| 487 | + * |
|
| 488 | + * @param array $args Widget arguments. |
|
| 489 | + * @param array $instance Saved values from database. |
|
| 490 | + */ |
|
| 491 | + public function widget($args, $instance) |
|
| 492 | + {
|
|
| 493 | + // prints the widget |
|
| 494 | + extract($args, EXTR_SKIP); |
|
| 495 | + |
|
| 496 | + /** |
|
| 497 | + * Filter the widget instance id. |
|
| 498 | + * |
|
| 499 | + * @since 1.0.0 |
|
| 500 | + * @param string $id The widget instance id. |
|
| 501 | + */ |
|
| 502 | + $id = empty($instance['id']) ? '' : apply_filters('widget_id', $instance['id']);
|
|
| 503 | + |
|
| 504 | + /** This filter is documented in geodirectory_widgets.php */ |
|
| 505 | + $title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
|
|
| 506 | + |
|
| 507 | + /** |
|
| 508 | + * Filter the widget text. |
|
| 509 | + * |
|
| 510 | + * @since 1.0.0 |
|
| 511 | + * @param string $text The widget text. |
|
| 512 | + */ |
|
| 513 | + $text = empty($instance['text']) ? '' : apply_filters('widget_text', $instance['text']);
|
|
| 514 | + |
|
| 515 | + echo $before_widget; |
|
| 516 | + ?> |
|
| 517 | 517 | |
| 518 | 518 | <?php echo $before_title . $title; ?> <a href="<?php if ($id) {
|
| 519 | - echo 'http://feeds2.feedburner.com/' . $id; |
|
| 520 | - } else {
|
|
| 521 | - bloginfo('rss_url');
|
|
| 522 | - } ?>"><i class="fa fa-rss-square"></i> </a><?php echo $after_title;?> |
|
| 519 | + echo 'http://feeds2.feedburner.com/' . $id; |
|
| 520 | + } else {
|
|
| 521 | + bloginfo('rss_url');
|
|
| 522 | + } ?>"><i class="fa fa-rss-square"></i> </a><?php echo $after_title;?> |
|
| 523 | 523 | |
| 524 | 524 | <?php if ($text <> "") { ?>
|
| 525 | 525 | |
@@ -544,57 +544,57 @@ discard block |
||
| 544 | 544 | </form> |
| 545 | 545 | |
| 546 | 546 | <?php |
| 547 | - echo $after_widget; |
|
| 547 | + echo $after_widget; |
|
| 548 | 548 | |
| 549 | - } |
|
| 549 | + } |
|
| 550 | 550 | |
| 551 | - /** |
|
| 552 | - * Sanitize feedburner subscribe widget form values as they are saved. |
|
| 553 | - * |
|
| 554 | - * @since 1.0.0 |
|
| 555 | - * @since 1.5.1 Declare function public. |
|
| 556 | - * |
|
| 557 | - * @param array $new_instance Values just sent to be saved. |
|
| 558 | - * @param array $old_instance Previously saved values from database. |
|
| 559 | - * |
|
| 560 | - * @return array Updated safe values to be saved. |
|
| 561 | - */ |
|
| 562 | - public function update($new_instance, $old_instance) |
|
| 563 | - {
|
|
| 551 | + /** |
|
| 552 | + * Sanitize feedburner subscribe widget form values as they are saved. |
|
| 553 | + * |
|
| 554 | + * @since 1.0.0 |
|
| 555 | + * @since 1.5.1 Declare function public. |
|
| 556 | + * |
|
| 557 | + * @param array $new_instance Values just sent to be saved. |
|
| 558 | + * @param array $old_instance Previously saved values from database. |
|
| 559 | + * |
|
| 560 | + * @return array Updated safe values to be saved. |
|
| 561 | + */ |
|
| 562 | + public function update($new_instance, $old_instance) |
|
| 563 | + {
|
|
| 564 | 564 | |
| 565 | - //save the widget |
|
| 566 | - $instance = $old_instance; |
|
| 567 | - $instance['id'] = strip_tags($new_instance['id']); |
|
| 568 | - $instance['title'] = ($new_instance['title']); |
|
| 569 | - $instance['text'] = ($new_instance['text']); |
|
| 565 | + //save the widget |
|
| 566 | + $instance = $old_instance; |
|
| 567 | + $instance['id'] = strip_tags($new_instance['id']); |
|
| 568 | + $instance['title'] = ($new_instance['title']); |
|
| 569 | + $instance['text'] = ($new_instance['text']); |
|
| 570 | 570 | |
| 571 | 571 | |
| 572 | - return $instance; |
|
| 573 | - } |
|
| 572 | + return $instance; |
|
| 573 | + } |
|
| 574 | 574 | |
| 575 | - /** |
|
| 576 | - * Back-end feedburner subscribe widget settings form. |
|
| 577 | - * |
|
| 578 | - * @since 1.0.0 |
|
| 579 | - * @since 1.5.1 Declare function public. |
|
| 580 | - * |
|
| 581 | - * @param array $instance Previously saved values from database. |
|
| 582 | - * @return string|void |
|
| 583 | - */ |
|
| 584 | - public function form($instance) |
|
| 585 | - {
|
|
| 586 | - //widgetform in backend |
|
| 587 | - $instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'advt1' => '', 'text' => '', 'twitter' => '', 'facebook' => '', 'digg' => '', 'myspace' => ''));
|
|
| 575 | + /** |
|
| 576 | + * Back-end feedburner subscribe widget settings form. |
|
| 577 | + * |
|
| 578 | + * @since 1.0.0 |
|
| 579 | + * @since 1.5.1 Declare function public. |
|
| 580 | + * |
|
| 581 | + * @param array $instance Previously saved values from database. |
|
| 582 | + * @return string|void |
|
| 583 | + */ |
|
| 584 | + public function form($instance) |
|
| 585 | + {
|
|
| 586 | + //widgetform in backend |
|
| 587 | + $instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'advt1' => '', 'text' => '', 'twitter' => '', 'facebook' => '', 'digg' => '', 'myspace' => ''));
|
|
| 588 | 588 | |
| 589 | - $id = strip_tags($instance['id']); |
|
| 589 | + $id = strip_tags($instance['id']); |
|
| 590 | 590 | |
| 591 | - $title = strip_tags($instance['title']); |
|
| 591 | + $title = strip_tags($instance['title']); |
|
| 592 | 592 | |
| 593 | - $text = strip_tags($instance['text']); |
|
| 593 | + $text = strip_tags($instance['text']); |
|
| 594 | 594 | |
| 595 | 595 | |
| 596 | 596 | |
| 597 | - ?> |
|
| 597 | + ?> |
|
| 598 | 598 | <p><label |
| 599 | 599 | for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title', 'geodirectory');?>:
|
| 600 | 600 | <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>"
|
@@ -613,101 +613,101 @@ discard block |
||
| 613 | 613 | name="<?php echo $this->get_field_name('text'); ?>"><?php echo esc_attr($text); ?></textarea></label>
|
| 614 | 614 | </p> |
| 615 | 615 | <?php |
| 616 | - } |
|
| 617 | - } |
|
| 618 | - |
|
| 619 | - register_widget('geodirsubscribeWidget');
|
|
| 620 | - |
|
| 621 | - /** |
|
| 622 | - * GeoDirectory advertise widget. |
|
| 623 | - * |
|
| 624 | - * @since 1.0.0 |
|
| 625 | - */ |
|
| 626 | - class geodiradvtwidget extends WP_Widget |
|
| 627 | - {
|
|
| 628 | - |
|
| 629 | - /** |
|
| 630 | - * Register the advertise widget with WordPress. |
|
| 631 | - * |
|
| 632 | - * @since 1.0.0 |
|
| 633 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 634 | - */ |
|
| 635 | - public function __construct() {
|
|
| 636 | - $widget_ops = array('classname' => 'GeoDirectory Advertise', 'description' => __('GD > common advertise widget in sidebar, bottom section', 'geodirectory'));
|
|
| 637 | - parent::__construct( |
|
| 638 | - 'advtwidget', // Base ID |
|
| 639 | - __('GD > Advertise', 'geodirectory'), // Name
|
|
| 640 | - $widget_ops// Args |
|
| 641 | - ); |
|
| 642 | - } |
|
| 643 | - |
|
| 644 | - |
|
| 645 | - /** |
|
| 646 | - * Front-end display content for advertise widget. |
|
| 647 | - * |
|
| 648 | - * @since 1.0.0 |
|
| 649 | - * @since 1.5.1 Declare function public. |
|
| 650 | - * |
|
| 651 | - * @param array $args Widget arguments. |
|
| 652 | - * @param array $instance Saved values from database. |
|
| 653 | - */ |
|
| 654 | - public function widget($args, $instance) |
|
| 655 | - {
|
|
| 656 | - |
|
| 657 | - // prints the widget |
|
| 658 | - |
|
| 659 | - extract($args, EXTR_SKIP); |
|
| 660 | - |
|
| 661 | - /** |
|
| 662 | - * Filter the description text. |
|
| 663 | - * |
|
| 664 | - * @since 1.0.0 |
|
| 665 | - * @param string $desc1 The widget description text. |
|
| 666 | - */ |
|
| 667 | - $desc1 = empty($instance['desc1']) ? ' ' : apply_filters('widget_desc1', $instance['desc1']);
|
|
| 668 | - echo $before_widget; |
|
| 669 | - ?> |
|
| 616 | + } |
|
| 617 | + } |
|
| 618 | + |
|
| 619 | + register_widget('geodirsubscribeWidget');
|
|
| 620 | + |
|
| 621 | + /** |
|
| 622 | + * GeoDirectory advertise widget. |
|
| 623 | + * |
|
| 624 | + * @since 1.0.0 |
|
| 625 | + */ |
|
| 626 | + class geodiradvtwidget extends WP_Widget |
|
| 627 | + {
|
|
| 628 | + |
|
| 629 | + /** |
|
| 630 | + * Register the advertise widget with WordPress. |
|
| 631 | + * |
|
| 632 | + * @since 1.0.0 |
|
| 633 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 634 | + */ |
|
| 635 | + public function __construct() {
|
|
| 636 | + $widget_ops = array('classname' => 'GeoDirectory Advertise', 'description' => __('GD > common advertise widget in sidebar, bottom section', 'geodirectory'));
|
|
| 637 | + parent::__construct( |
|
| 638 | + 'advtwidget', // Base ID |
|
| 639 | + __('GD > Advertise', 'geodirectory'), // Name
|
|
| 640 | + $widget_ops// Args |
|
| 641 | + ); |
|
| 642 | + } |
|
| 643 | + |
|
| 644 | + |
|
| 645 | + /** |
|
| 646 | + * Front-end display content for advertise widget. |
|
| 647 | + * |
|
| 648 | + * @since 1.0.0 |
|
| 649 | + * @since 1.5.1 Declare function public. |
|
| 650 | + * |
|
| 651 | + * @param array $args Widget arguments. |
|
| 652 | + * @param array $instance Saved values from database. |
|
| 653 | + */ |
|
| 654 | + public function widget($args, $instance) |
|
| 655 | + {
|
|
| 656 | + |
|
| 657 | + // prints the widget |
|
| 658 | + |
|
| 659 | + extract($args, EXTR_SKIP); |
|
| 660 | + |
|
| 661 | + /** |
|
| 662 | + * Filter the description text. |
|
| 663 | + * |
|
| 664 | + * @since 1.0.0 |
|
| 665 | + * @param string $desc1 The widget description text. |
|
| 666 | + */ |
|
| 667 | + $desc1 = empty($instance['desc1']) ? ' ' : apply_filters('widget_desc1', $instance['desc1']);
|
|
| 668 | + echo $before_widget; |
|
| 669 | + ?> |
|
| 670 | 670 | <?php if ($desc1 <> "") { ?>
|
| 671 | 671 | <?php echo $desc1; ?> |
| 672 | 672 | <?php } |
| 673 | - echo $after_widget; |
|
| 674 | - } |
|
| 675 | - |
|
| 676 | - /** |
|
| 677 | - * Sanitize advertise widget form values as they are saved. |
|
| 678 | - * |
|
| 679 | - * @since 1.0.0 |
|
| 680 | - * @since 1.5.1 Declare function public. |
|
| 681 | - * |
|
| 682 | - * @param array $new_instance Values just sent to be saved. |
|
| 683 | - * @param array $old_instance Previously saved values from database. |
|
| 684 | - * |
|
| 685 | - * @return array Updated safe values to be saved. |
|
| 686 | - */ |
|
| 687 | - public function update($new_instance, $old_instance) |
|
| 688 | - {
|
|
| 689 | - //save the widget |
|
| 690 | - $instance = $old_instance; |
|
| 691 | - $instance['desc1'] = ($new_instance['desc1']); |
|
| 692 | - return $instance; |
|
| 693 | - } |
|
| 694 | - |
|
| 695 | - /** |
|
| 696 | - * Back-end advertise widget settings form. |
|
| 697 | - * |
|
| 698 | - * @since 1.0.0 |
|
| 699 | - * @since 1.5.1 Declare function public. |
|
| 700 | - * |
|
| 701 | - * @param array $instance Previously saved values from database. |
|
| 702 | - * @return string|void |
|
| 703 | - */ |
|
| 704 | - public function form($instance) |
|
| 705 | - {
|
|
| 706 | - //widgetform in backend |
|
| 707 | - $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => ''));
|
|
| 708 | - |
|
| 709 | - $desc1 = ($instance['desc1']); |
|
| 710 | - ?> |
|
| 673 | + echo $after_widget; |
|
| 674 | + } |
|
| 675 | + |
|
| 676 | + /** |
|
| 677 | + * Sanitize advertise widget form values as they are saved. |
|
| 678 | + * |
|
| 679 | + * @since 1.0.0 |
|
| 680 | + * @since 1.5.1 Declare function public. |
|
| 681 | + * |
|
| 682 | + * @param array $new_instance Values just sent to be saved. |
|
| 683 | + * @param array $old_instance Previously saved values from database. |
|
| 684 | + * |
|
| 685 | + * @return array Updated safe values to be saved. |
|
| 686 | + */ |
|
| 687 | + public function update($new_instance, $old_instance) |
|
| 688 | + {
|
|
| 689 | + //save the widget |
|
| 690 | + $instance = $old_instance; |
|
| 691 | + $instance['desc1'] = ($new_instance['desc1']); |
|
| 692 | + return $instance; |
|
| 693 | + } |
|
| 694 | + |
|
| 695 | + /** |
|
| 696 | + * Back-end advertise widget settings form. |
|
| 697 | + * |
|
| 698 | + * @since 1.0.0 |
|
| 699 | + * @since 1.5.1 Declare function public. |
|
| 700 | + * |
|
| 701 | + * @param array $instance Previously saved values from database. |
|
| 702 | + * @return string|void |
|
| 703 | + */ |
|
| 704 | + public function form($instance) |
|
| 705 | + {
|
|
| 706 | + //widgetform in backend |
|
| 707 | + $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => ''));
|
|
| 708 | + |
|
| 709 | + $desc1 = ($instance['desc1']); |
|
| 710 | + ?> |
|
| 711 | 711 | <p><label |
| 712 | 712 | for="<?php echo $this->get_field_id('desc1'); ?>"><?php _e('Your Advt code (ex.google adsense, etc.)', 'geodirectory');?>
|
| 713 | 713 | <textarea class="widefat" rows="6" cols="20" id="<?php echo $this->get_field_id('desc1'); ?>"
|
@@ -715,65 +715,65 @@ discard block |
||
| 715 | 715 | </p> |
| 716 | 716 | |
| 717 | 717 | <?php |
| 718 | - } |
|
| 719 | - } |
|
| 720 | - |
|
| 721 | - register_widget('geodiradvtwidget');
|
|
| 722 | - |
|
| 723 | - /** |
|
| 724 | - * GeoDirectory Flickr widget. |
|
| 725 | - * |
|
| 726 | - * @since 1.0.0 |
|
| 727 | - */ |
|
| 728 | - class GeodirFlickrWidget extends WP_Widget |
|
| 729 | - {
|
|
| 730 | - |
|
| 731 | - /** |
|
| 732 | - * Register the flickr widget with WordPress. |
|
| 733 | - * |
|
| 734 | - * @since 1.0.0 |
|
| 735 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 736 | - */ |
|
| 737 | - public function __construct() {
|
|
| 738 | - $widget_ops = array('classname' => 'Geo Dir Flickr Photos ', 'description' => __('GD > Flickr Photos', 'geodirectory'));
|
|
| 739 | - parent::__construct( |
|
| 740 | - 'widget_flickrwidget', // Base ID |
|
| 741 | - __('GD > Flickr Photos', 'geodirectory'), // Name
|
|
| 742 | - $widget_ops// Args |
|
| 743 | - ); |
|
| 744 | - } |
|
| 745 | - |
|
| 746 | - /** |
|
| 747 | - * Front-end display content for flickr widget. |
|
| 748 | - * |
|
| 749 | - * @since 1.0.0 |
|
| 750 | - * @since 1.5.1 Declare function public. |
|
| 751 | - * |
|
| 752 | - * @param array $args Widget arguments. |
|
| 753 | - * @param array $instance Saved values from database. |
|
| 754 | - */ |
|
| 755 | - public function widget($args, $instance) |
|
| 756 | - {
|
|
| 757 | - |
|
| 758 | - // prints the widget |
|
| 759 | - extract($args, EXTR_SKIP); |
|
| 760 | - |
|
| 761 | - echo $before_widget; |
|
| 762 | - |
|
| 763 | - /** This filter is documented in geodirectory_widgets.php */ |
|
| 764 | - $id = empty($instance['id']) ? ' ' : apply_filters('widget_id', $instance['id']);
|
|
| 765 | - |
|
| 766 | - /** |
|
| 767 | - * Filter the widget number. |
|
| 768 | - * |
|
| 769 | - * This is used in the flicker widget to show how many images to show. |
|
| 770 | - * |
|
| 771 | - * @since 1.0.0 |
|
| 772 | - * @param string $number The image count. |
|
| 773 | - */ |
|
| 774 | - $number = empty($instance['number']) ? ' ' : apply_filters('widget_number', $instance['number']);
|
|
| 775 | - echo $before_title . __('Photo Gallery', 'geodirectory') . $after_title;
|
|
| 776 | - ?> |
|
| 718 | + } |
|
| 719 | + } |
|
| 720 | + |
|
| 721 | + register_widget('geodiradvtwidget');
|
|
| 722 | + |
|
| 723 | + /** |
|
| 724 | + * GeoDirectory Flickr widget. |
|
| 725 | + * |
|
| 726 | + * @since 1.0.0 |
|
| 727 | + */ |
|
| 728 | + class GeodirFlickrWidget extends WP_Widget |
|
| 729 | + {
|
|
| 730 | + |
|
| 731 | + /** |
|
| 732 | + * Register the flickr widget with WordPress. |
|
| 733 | + * |
|
| 734 | + * @since 1.0.0 |
|
| 735 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 736 | + */ |
|
| 737 | + public function __construct() {
|
|
| 738 | + $widget_ops = array('classname' => 'Geo Dir Flickr Photos ', 'description' => __('GD > Flickr Photos', 'geodirectory'));
|
|
| 739 | + parent::__construct( |
|
| 740 | + 'widget_flickrwidget', // Base ID |
|
| 741 | + __('GD > Flickr Photos', 'geodirectory'), // Name
|
|
| 742 | + $widget_ops// Args |
|
| 743 | + ); |
|
| 744 | + } |
|
| 745 | + |
|
| 746 | + /** |
|
| 747 | + * Front-end display content for flickr widget. |
|
| 748 | + * |
|
| 749 | + * @since 1.0.0 |
|
| 750 | + * @since 1.5.1 Declare function public. |
|
| 751 | + * |
|
| 752 | + * @param array $args Widget arguments. |
|
| 753 | + * @param array $instance Saved values from database. |
|
| 754 | + */ |
|
| 755 | + public function widget($args, $instance) |
|
| 756 | + {
|
|
| 757 | + |
|
| 758 | + // prints the widget |
|
| 759 | + extract($args, EXTR_SKIP); |
|
| 760 | + |
|
| 761 | + echo $before_widget; |
|
| 762 | + |
|
| 763 | + /** This filter is documented in geodirectory_widgets.php */ |
|
| 764 | + $id = empty($instance['id']) ? ' ' : apply_filters('widget_id', $instance['id']);
|
|
| 765 | + |
|
| 766 | + /** |
|
| 767 | + * Filter the widget number. |
|
| 768 | + * |
|
| 769 | + * This is used in the flicker widget to show how many images to show. |
|
| 770 | + * |
|
| 771 | + * @since 1.0.0 |
|
| 772 | + * @param string $number The image count. |
|
| 773 | + */ |
|
| 774 | + $number = empty($instance['number']) ? ' ' : apply_filters('widget_number', $instance['number']);
|
|
| 775 | + echo $before_title . __('Photo Gallery', 'geodirectory') . $after_title;
|
|
| 776 | + ?> |
|
| 777 | 777 | |
| 778 | 778 | <div class="geodir-flickr clearfix"> |
| 779 | 779 | |
@@ -784,45 +784,45 @@ discard block |
||
| 784 | 784 | |
| 785 | 785 | |
| 786 | 786 | <?php echo $after_widget; |
| 787 | - } |
|
| 788 | - |
|
| 789 | - /** |
|
| 790 | - * Sanitize flickr widget form values as they are saved. |
|
| 791 | - * |
|
| 792 | - * @since 1.0.0 |
|
| 793 | - * @since 1.5.1 Declare function public. |
|
| 794 | - * |
|
| 795 | - * @param array $new_instance Values just sent to be saved. |
|
| 796 | - * @param array $old_instance Previously saved values from database. |
|
| 797 | - * |
|
| 798 | - * @return array Updated safe values to be saved. |
|
| 799 | - */ |
|
| 800 | - public function update($new_instance, $old_instance) |
|
| 801 | - {
|
|
| 802 | - //save the widget |
|
| 803 | - $instance = $old_instance; |
|
| 804 | - $instance['id'] = strip_tags($new_instance['id']); |
|
| 805 | - $instance['number'] = strip_tags($new_instance['number']); |
|
| 806 | - return $instance; |
|
| 807 | - } |
|
| 808 | - |
|
| 809 | - /** |
|
| 810 | - * Back-end flickr widget settings form. |
|
| 811 | - * |
|
| 812 | - * @since 1.0.0 |
|
| 813 | - * @since 1.5.1 Declare function public. |
|
| 814 | - * |
|
| 815 | - * @param array $instance Previously saved values from database. |
|
| 816 | - * @return string|void |
|
| 817 | - */ |
|
| 818 | - public function form($instance) |
|
| 819 | - {
|
|
| 820 | - |
|
| 821 | - //widgetform in backend |
|
| 822 | - $instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'number' => ''));
|
|
| 823 | - $id = strip_tags($instance['id']); |
|
| 824 | - $number = strip_tags($instance['number']); |
|
| 825 | - ?> |
|
| 787 | + } |
|
| 788 | + |
|
| 789 | + /** |
|
| 790 | + * Sanitize flickr widget form values as they are saved. |
|
| 791 | + * |
|
| 792 | + * @since 1.0.0 |
|
| 793 | + * @since 1.5.1 Declare function public. |
|
| 794 | + * |
|
| 795 | + * @param array $new_instance Values just sent to be saved. |
|
| 796 | + * @param array $old_instance Previously saved values from database. |
|
| 797 | + * |
|
| 798 | + * @return array Updated safe values to be saved. |
|
| 799 | + */ |
|
| 800 | + public function update($new_instance, $old_instance) |
|
| 801 | + {
|
|
| 802 | + //save the widget |
|
| 803 | + $instance = $old_instance; |
|
| 804 | + $instance['id'] = strip_tags($new_instance['id']); |
|
| 805 | + $instance['number'] = strip_tags($new_instance['number']); |
|
| 806 | + return $instance; |
|
| 807 | + } |
|
| 808 | + |
|
| 809 | + /** |
|
| 810 | + * Back-end flickr widget settings form. |
|
| 811 | + * |
|
| 812 | + * @since 1.0.0 |
|
| 813 | + * @since 1.5.1 Declare function public. |
|
| 814 | + * |
|
| 815 | + * @param array $instance Previously saved values from database. |
|
| 816 | + * @return string|void |
|
| 817 | + */ |
|
| 818 | + public function form($instance) |
|
| 819 | + {
|
|
| 820 | + |
|
| 821 | + //widgetform in backend |
|
| 822 | + $instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'number' => ''));
|
|
| 823 | + $id = strip_tags($instance['id']); |
|
| 824 | + $number = strip_tags($instance['number']); |
|
| 825 | + ?> |
|
| 826 | 826 | |
| 827 | 827 | <p> |
| 828 | 828 | <label |
@@ -843,99 +843,99 @@ discard block |
||
| 843 | 843 | </label> |
| 844 | 844 | </p> |
| 845 | 845 | <?php |
| 846 | - } |
|
| 847 | - } |
|
| 848 | - |
|
| 849 | - register_widget('GeodirFlickrWidget');
|
|
| 850 | - |
|
| 851 | - /** |
|
| 852 | - * GeoDirectory Twitter widget. |
|
| 853 | - * |
|
| 854 | - * @since 1.0.0 |
|
| 855 | - */ |
|
| 856 | - class geodir_twitter extends WP_Widget |
|
| 857 | - {
|
|
| 858 | - /** |
|
| 859 | - * Register the Twitter widget with WordPress. |
|
| 860 | - * |
|
| 861 | - * @since 1.0.0 |
|
| 862 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 863 | - */ |
|
| 864 | - public function __construct() {
|
|
| 865 | - $widget_ops = array('classname' => 'Twitter', 'description' => __('GD > Twitter Feed', 'geodirectory'));
|
|
| 866 | - parent::__construct( |
|
| 867 | - 'widget_Twidget', // Base ID |
|
| 868 | - __('GD > Twitter', 'geodirectory'), // Name
|
|
| 869 | - $widget_ops// Args |
|
| 870 | - ); |
|
| 871 | - } |
|
| 872 | - |
|
| 873 | - |
|
| 874 | - /** |
|
| 875 | - * Front-end display content for Twitter widget. |
|
| 876 | - * |
|
| 877 | - * @since 1.0.0 |
|
| 878 | - * @since 1.5.1 Declare function public. |
|
| 879 | - * |
|
| 880 | - * @param array $args Widget arguments. |
|
| 881 | - * @param array $instance Saved values from database. |
|
| 882 | - */ |
|
| 883 | - public function widget($args, $instance) |
|
| 884 | - {
|
|
| 885 | - |
|
| 886 | - // prints the widget |
|
| 887 | - |
|
| 888 | - extract($args, EXTR_SKIP); |
|
| 889 | - |
|
| 890 | - /** |
|
| 891 | - * Filter the twitter widget description text. |
|
| 892 | - * |
|
| 893 | - * @since 1.0.0 |
|
| 894 | - * @param string $desc1 The widget description text. |
|
| 895 | - */ |
|
| 896 | - $desc1 = empty($instance['gd_tw_desc1']) ? ' ' : apply_filters('gd_tw_widget_desc1', $instance['gd_tw_desc1']);
|
|
| 897 | - echo $before_widget; |
|
| 898 | - if ($desc1 <> "") {
|
|
| 899 | - echo $desc1; |
|
| 900 | - } |
|
| 901 | - echo $after_widget; |
|
| 902 | - } |
|
| 903 | - |
|
| 904 | - /** |
|
| 905 | - * Sanitize twitter widget form values as they are saved. |
|
| 906 | - * |
|
| 907 | - * @since 1.0.0 |
|
| 908 | - * @since 1.5.1 Declare function public. |
|
| 909 | - * |
|
| 910 | - * @param array $new_instance Values just sent to be saved. |
|
| 911 | - * @param array $old_instance Previously saved values from database. |
|
| 912 | - * |
|
| 913 | - * @return array Updated safe values to be saved. |
|
| 914 | - */ |
|
| 915 | - public function update($new_instance, $old_instance) |
|
| 916 | - {
|
|
| 917 | - //save the widget |
|
| 918 | - $instance = $old_instance; |
|
| 919 | - $instance['gd_tw_desc1'] = ($new_instance['gd_tw_desc1']); |
|
| 920 | - return $instance; |
|
| 921 | - } |
|
| 922 | - |
|
| 923 | - /** |
|
| 924 | - * Back-end twitter widget settings form. |
|
| 925 | - * |
|
| 926 | - * @since 1.0.0 |
|
| 927 | - * @since 1.5.1 Declare function public. |
|
| 928 | - * |
|
| 929 | - * @param array $instance Previously saved values from database. |
|
| 930 | - * @return string|void |
|
| 931 | - */ |
|
| 932 | - public function form($instance) |
|
| 933 | - {
|
|
| 934 | - //widgetform in backend |
|
| 935 | - $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'gd_tw_desc1' => ''));
|
|
| 936 | - |
|
| 937 | - $desc1 = ($instance['gd_tw_desc1']); |
|
| 938 | - ?> |
|
| 846 | + } |
|
| 847 | + } |
|
| 848 | + |
|
| 849 | + register_widget('GeodirFlickrWidget');
|
|
| 850 | + |
|
| 851 | + /** |
|
| 852 | + * GeoDirectory Twitter widget. |
|
| 853 | + * |
|
| 854 | + * @since 1.0.0 |
|
| 855 | + */ |
|
| 856 | + class geodir_twitter extends WP_Widget |
|
| 857 | + {
|
|
| 858 | + /** |
|
| 859 | + * Register the Twitter widget with WordPress. |
|
| 860 | + * |
|
| 861 | + * @since 1.0.0 |
|
| 862 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 863 | + */ |
|
| 864 | + public function __construct() {
|
|
| 865 | + $widget_ops = array('classname' => 'Twitter', 'description' => __('GD > Twitter Feed', 'geodirectory'));
|
|
| 866 | + parent::__construct( |
|
| 867 | + 'widget_Twidget', // Base ID |
|
| 868 | + __('GD > Twitter', 'geodirectory'), // Name
|
|
| 869 | + $widget_ops// Args |
|
| 870 | + ); |
|
| 871 | + } |
|
| 872 | + |
|
| 873 | + |
|
| 874 | + /** |
|
| 875 | + * Front-end display content for Twitter widget. |
|
| 876 | + * |
|
| 877 | + * @since 1.0.0 |
|
| 878 | + * @since 1.5.1 Declare function public. |
|
| 879 | + * |
|
| 880 | + * @param array $args Widget arguments. |
|
| 881 | + * @param array $instance Saved values from database. |
|
| 882 | + */ |
|
| 883 | + public function widget($args, $instance) |
|
| 884 | + {
|
|
| 885 | + |
|
| 886 | + // prints the widget |
|
| 887 | + |
|
| 888 | + extract($args, EXTR_SKIP); |
|
| 889 | + |
|
| 890 | + /** |
|
| 891 | + * Filter the twitter widget description text. |
|
| 892 | + * |
|
| 893 | + * @since 1.0.0 |
|
| 894 | + * @param string $desc1 The widget description text. |
|
| 895 | + */ |
|
| 896 | + $desc1 = empty($instance['gd_tw_desc1']) ? ' ' : apply_filters('gd_tw_widget_desc1', $instance['gd_tw_desc1']);
|
|
| 897 | + echo $before_widget; |
|
| 898 | + if ($desc1 <> "") {
|
|
| 899 | + echo $desc1; |
|
| 900 | + } |
|
| 901 | + echo $after_widget; |
|
| 902 | + } |
|
| 903 | + |
|
| 904 | + /** |
|
| 905 | + * Sanitize twitter widget form values as they are saved. |
|
| 906 | + * |
|
| 907 | + * @since 1.0.0 |
|
| 908 | + * @since 1.5.1 Declare function public. |
|
| 909 | + * |
|
| 910 | + * @param array $new_instance Values just sent to be saved. |
|
| 911 | + * @param array $old_instance Previously saved values from database. |
|
| 912 | + * |
|
| 913 | + * @return array Updated safe values to be saved. |
|
| 914 | + */ |
|
| 915 | + public function update($new_instance, $old_instance) |
|
| 916 | + {
|
|
| 917 | + //save the widget |
|
| 918 | + $instance = $old_instance; |
|
| 919 | + $instance['gd_tw_desc1'] = ($new_instance['gd_tw_desc1']); |
|
| 920 | + return $instance; |
|
| 921 | + } |
|
| 922 | + |
|
| 923 | + /** |
|
| 924 | + * Back-end twitter widget settings form. |
|
| 925 | + * |
|
| 926 | + * @since 1.0.0 |
|
| 927 | + * @since 1.5.1 Declare function public. |
|
| 928 | + * |
|
| 929 | + * @param array $instance Previously saved values from database. |
|
| 930 | + * @return string|void |
|
| 931 | + */ |
|
| 932 | + public function form($instance) |
|
| 933 | + {
|
|
| 934 | + //widgetform in backend |
|
| 935 | + $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'gd_tw_desc1' => ''));
|
|
| 936 | + |
|
| 937 | + $desc1 = ($instance['gd_tw_desc1']); |
|
| 938 | + ?> |
|
| 939 | 939 | <p><label |
| 940 | 940 | for="<?php echo $this->get_field_id('gd_tw_desc1'); ?>"><?php _e('Your twitter code', 'geodirectory');?>
|
| 941 | 941 | <textarea class="widefat" rows="6" cols="20" |
@@ -944,179 +944,179 @@ discard block |
||
| 944 | 944 | </p> |
| 945 | 945 | |
| 946 | 946 | <?php |
| 947 | - } |
|
| 948 | - } |
|
| 949 | - |
|
| 950 | - register_widget('geodir_twitter');
|
|
| 951 | - |
|
| 952 | - /** |
|
| 953 | - * GeoDirectory Advanced Search widget. |
|
| 954 | - * |
|
| 955 | - * @since 1.0.0 |
|
| 956 | - */ |
|
| 957 | - class geodir_advance_search_widget extends WP_Widget |
|
| 958 | - {
|
|
| 959 | - /** |
|
| 960 | - * Register the advanced search widget with WordPress. |
|
| 961 | - * |
|
| 962 | - * @since 1.0.0 |
|
| 963 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 964 | - */ |
|
| 965 | - public function __construct() {
|
|
| 966 | - $widget_ops = array('classname' => 'geodir_advance_search_widget', 'description' => __('GD > Search', 'geodirectory'),'post_type'=>'');
|
|
| 967 | - parent::__construct( |
|
| 968 | - 'geodir_advance_search', // Base ID |
|
| 969 | - __('GD > Search', 'geodirectory'), // Name
|
|
| 970 | - $widget_ops// Args |
|
| 971 | - ); |
|
| 972 | - } |
|
| 973 | - |
|
| 974 | - |
|
| 975 | - /** |
|
| 976 | - * Front-end display content for advanced search widget. |
|
| 977 | - * |
|
| 978 | - * @since 1.0.0 |
|
| 979 | - * @since 1.5.1 Declare function public. |
|
| 980 | - * |
|
| 981 | - * @param array $args Widget arguments. |
|
| 982 | - * @param array $instance Saved values from database. |
|
| 983 | - */ |
|
| 984 | - public function widget($args, $instance) |
|
| 985 | - {
|
|
| 986 | - /** |
|
| 987 | - * Filter the search widget arguments. |
|
| 988 | - * |
|
| 989 | - * @since 1.5.7 |
|
| 990 | - * @param array $args The widget arguments. |
|
| 991 | - * @param array $instance The widget instance. |
|
| 992 | - */ |
|
| 993 | - $args = apply_filters('widget_geodir_advance_search_args',$args,$instance);
|
|
| 994 | - |
|
| 995 | - // prints the widget |
|
| 996 | - extract($args, EXTR_SKIP); |
|
| 997 | - |
|
| 998 | - if(isset($post_type) && $post_type){
|
|
| 999 | - geodir_get_search_post_type($post_type);// set the post type |
|
| 1000 | - }else{
|
|
| 1001 | - geodir_get_search_post_type();// set the post type |
|
| 1002 | - } |
|
| 1003 | - |
|
| 1004 | - echo $before_widget; |
|
| 1005 | - |
|
| 1006 | - /** This filter is documented in geodirectory_widgets.php */ |
|
| 1007 | - $title = empty($instance['title']) ? __('Search', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
|
|
| 1008 | - |
|
| 1009 | - geodir_get_template_part('listing', 'filter-form');
|
|
| 1010 | - |
|
| 1011 | - echo $after_widget; |
|
| 1012 | - |
|
| 1013 | - // after outputing the search reset the CPT |
|
| 1014 | - global $geodir_search_post_type; |
|
| 1015 | - $geodir_search_post_type = ''; |
|
| 1016 | - } |
|
| 1017 | - |
|
| 1018 | - /** |
|
| 1019 | - * Sanitize advanced search widget form values as they are saved. |
|
| 1020 | - * |
|
| 1021 | - * @since 1.0.0 |
|
| 1022 | - * @since 1.5.1 Declare function public. |
|
| 1023 | - * |
|
| 1024 | - * @param array $new_instance Values just sent to be saved. |
|
| 1025 | - * @param array $old_instance Previously saved values from database. |
|
| 1026 | - * |
|
| 1027 | - * @return array Updated safe values to be saved. |
|
| 1028 | - */ |
|
| 1029 | - public function update($new_instance, $old_instance) |
|
| 1030 | - {
|
|
| 1031 | - //save the widget |
|
| 1032 | - //Nothing to save |
|
| 1033 | - return isset($instance) ? $instance : array(); |
|
| 1034 | - } |
|
| 1035 | - |
|
| 1036 | - /** |
|
| 1037 | - * Back-end advanced search widget settings form. |
|
| 1038 | - * |
|
| 1039 | - * @since 1.0.0 |
|
| 1040 | - * @since 1.5.1 Declare function public. |
|
| 1041 | - * |
|
| 1042 | - * @param array $instance Previously saved values from database. |
|
| 1043 | - * @return string|void |
|
| 1044 | - */ |
|
| 1045 | - public function form($instance) |
|
| 1046 | - {
|
|
| 1047 | - //widgetform in backend |
|
| 1048 | - echo __("This is a search widget to show advance search for gedodirectory listings.", 'geodirectory');
|
|
| 1049 | - } |
|
| 1050 | - } |
|
| 1051 | - |
|
| 1052 | - register_widget('geodir_advance_search_widget');
|
|
| 1053 | - |
|
| 1054 | - |
|
| 1055 | - /** |
|
| 1056 | - * Contains all functions for popular widget. |
|
| 1057 | - * |
|
| 1058 | - * @since 1.0.0 |
|
| 1059 | - * @package GeoDirectory |
|
| 1060 | - */ |
|
| 1061 | - include_once('geodirectory-widgets/geodirectory_popular_widget.php');
|
|
| 1062 | - /** |
|
| 1063 | - * Contains all functions for listing slider widget. |
|
| 1064 | - * |
|
| 1065 | - * @since 1.0.0 |
|
| 1066 | - * @package GeoDirectory |
|
| 1067 | - */ |
|
| 1068 | - include_once('geodirectory-widgets/geodirectory_listing_slider_widget.php');
|
|
| 1069 | - /** |
|
| 1070 | - * Contains all functions for home map widget. |
|
| 1071 | - * |
|
| 1072 | - * @since 1.0.0 |
|
| 1073 | - * @package GeoDirectory |
|
| 1074 | - */ |
|
| 1075 | - include_once('geodirectory-widgets/home_map_widget.php');
|
|
| 1076 | - /** |
|
| 1077 | - * Contains all functions for listing map widget. |
|
| 1078 | - * |
|
| 1079 | - * @since 1.0.0 |
|
| 1080 | - * @package GeoDirectory |
|
| 1081 | - */ |
|
| 1082 | - include_once('geodirectory-widgets/listing_map_widget.php');
|
|
| 1083 | - /** |
|
| 1084 | - * Contains all functions for reviews widget. |
|
| 1085 | - * |
|
| 1086 | - * @since 1.0.0 |
|
| 1087 | - * @package GeoDirectory |
|
| 1088 | - */ |
|
| 1089 | - include_once('geodirectory-widgets/geodirectory_reviews_widget.php');
|
|
| 1090 | - /** |
|
| 1091 | - * Contains all functions for related listing widget. |
|
| 1092 | - * |
|
| 1093 | - * @since 1.0.0 |
|
| 1094 | - * @package GeoDirectory |
|
| 1095 | - */ |
|
| 1096 | - include_once('geodirectory-widgets/geodirectory_related_listing_widget.php');
|
|
| 1097 | - /** |
|
| 1098 | - * Contains all functions for bestof widget. |
|
| 1099 | - * |
|
| 1100 | - * @since 1.0.0 |
|
| 1101 | - * @package GeoDirectory |
|
| 1102 | - */ |
|
| 1103 | - include_once('geodirectory-widgets/geodirectory_bestof_widget.php');
|
|
| 947 | + } |
|
| 948 | + } |
|
| 949 | + |
|
| 950 | + register_widget('geodir_twitter');
|
|
| 951 | + |
|
| 952 | + /** |
|
| 953 | + * GeoDirectory Advanced Search widget. |
|
| 954 | + * |
|
| 955 | + * @since 1.0.0 |
|
| 956 | + */ |
|
| 957 | + class geodir_advance_search_widget extends WP_Widget |
|
| 958 | + {
|
|
| 959 | + /** |
|
| 960 | + * Register the advanced search widget with WordPress. |
|
| 961 | + * |
|
| 962 | + * @since 1.0.0 |
|
| 963 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 964 | + */ |
|
| 965 | + public function __construct() {
|
|
| 966 | + $widget_ops = array('classname' => 'geodir_advance_search_widget', 'description' => __('GD > Search', 'geodirectory'),'post_type'=>'');
|
|
| 967 | + parent::__construct( |
|
| 968 | + 'geodir_advance_search', // Base ID |
|
| 969 | + __('GD > Search', 'geodirectory'), // Name
|
|
| 970 | + $widget_ops// Args |
|
| 971 | + ); |
|
| 972 | + } |
|
| 973 | + |
|
| 974 | + |
|
| 975 | + /** |
|
| 976 | + * Front-end display content for advanced search widget. |
|
| 977 | + * |
|
| 978 | + * @since 1.0.0 |
|
| 979 | + * @since 1.5.1 Declare function public. |
|
| 980 | + * |
|
| 981 | + * @param array $args Widget arguments. |
|
| 982 | + * @param array $instance Saved values from database. |
|
| 983 | + */ |
|
| 984 | + public function widget($args, $instance) |
|
| 985 | + {
|
|
| 986 | + /** |
|
| 987 | + * Filter the search widget arguments. |
|
| 988 | + * |
|
| 989 | + * @since 1.5.7 |
|
| 990 | + * @param array $args The widget arguments. |
|
| 991 | + * @param array $instance The widget instance. |
|
| 992 | + */ |
|
| 993 | + $args = apply_filters('widget_geodir_advance_search_args',$args,$instance);
|
|
| 994 | + |
|
| 995 | + // prints the widget |
|
| 996 | + extract($args, EXTR_SKIP); |
|
| 997 | + |
|
| 998 | + if(isset($post_type) && $post_type){
|
|
| 999 | + geodir_get_search_post_type($post_type);// set the post type |
|
| 1000 | + }else{
|
|
| 1001 | + geodir_get_search_post_type();// set the post type |
|
| 1002 | + } |
|
| 1003 | + |
|
| 1004 | + echo $before_widget; |
|
| 1005 | + |
|
| 1006 | + /** This filter is documented in geodirectory_widgets.php */ |
|
| 1007 | + $title = empty($instance['title']) ? __('Search', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
|
|
| 1008 | + |
|
| 1009 | + geodir_get_template_part('listing', 'filter-form');
|
|
| 1010 | + |
|
| 1011 | + echo $after_widget; |
|
| 1012 | + |
|
| 1013 | + // after outputing the search reset the CPT |
|
| 1014 | + global $geodir_search_post_type; |
|
| 1015 | + $geodir_search_post_type = ''; |
|
| 1016 | + } |
|
| 1017 | + |
|
| 1018 | + /** |
|
| 1019 | + * Sanitize advanced search widget form values as they are saved. |
|
| 1020 | + * |
|
| 1021 | + * @since 1.0.0 |
|
| 1022 | + * @since 1.5.1 Declare function public. |
|
| 1023 | + * |
|
| 1024 | + * @param array $new_instance Values just sent to be saved. |
|
| 1025 | + * @param array $old_instance Previously saved values from database. |
|
| 1026 | + * |
|
| 1027 | + * @return array Updated safe values to be saved. |
|
| 1028 | + */ |
|
| 1029 | + public function update($new_instance, $old_instance) |
|
| 1030 | + {
|
|
| 1031 | + //save the widget |
|
| 1032 | + //Nothing to save |
|
| 1033 | + return isset($instance) ? $instance : array(); |
|
| 1034 | + } |
|
| 1035 | + |
|
| 1036 | + /** |
|
| 1037 | + * Back-end advanced search widget settings form. |
|
| 1038 | + * |
|
| 1039 | + * @since 1.0.0 |
|
| 1040 | + * @since 1.5.1 Declare function public. |
|
| 1041 | + * |
|
| 1042 | + * @param array $instance Previously saved values from database. |
|
| 1043 | + * @return string|void |
|
| 1044 | + */ |
|
| 1045 | + public function form($instance) |
|
| 1046 | + {
|
|
| 1047 | + //widgetform in backend |
|
| 1048 | + echo __("This is a search widget to show advance search for gedodirectory listings.", 'geodirectory');
|
|
| 1049 | + } |
|
| 1050 | + } |
|
| 1051 | + |
|
| 1052 | + register_widget('geodir_advance_search_widget');
|
|
| 1053 | + |
|
| 1054 | + |
|
| 1055 | + /** |
|
| 1056 | + * Contains all functions for popular widget. |
|
| 1057 | + * |
|
| 1058 | + * @since 1.0.0 |
|
| 1059 | + * @package GeoDirectory |
|
| 1060 | + */ |
|
| 1061 | + include_once('geodirectory-widgets/geodirectory_popular_widget.php');
|
|
| 1062 | + /** |
|
| 1063 | + * Contains all functions for listing slider widget. |
|
| 1064 | + * |
|
| 1065 | + * @since 1.0.0 |
|
| 1066 | + * @package GeoDirectory |
|
| 1067 | + */ |
|
| 1068 | + include_once('geodirectory-widgets/geodirectory_listing_slider_widget.php');
|
|
| 1069 | + /** |
|
| 1070 | + * Contains all functions for home map widget. |
|
| 1071 | + * |
|
| 1072 | + * @since 1.0.0 |
|
| 1073 | + * @package GeoDirectory |
|
| 1074 | + */ |
|
| 1075 | + include_once('geodirectory-widgets/home_map_widget.php');
|
|
| 1076 | + /** |
|
| 1077 | + * Contains all functions for listing map widget. |
|
| 1078 | + * |
|
| 1079 | + * @since 1.0.0 |
|
| 1080 | + * @package GeoDirectory |
|
| 1081 | + */ |
|
| 1082 | + include_once('geodirectory-widgets/listing_map_widget.php');
|
|
| 1083 | + /** |
|
| 1084 | + * Contains all functions for reviews widget. |
|
| 1085 | + * |
|
| 1086 | + * @since 1.0.0 |
|
| 1087 | + * @package GeoDirectory |
|
| 1088 | + */ |
|
| 1089 | + include_once('geodirectory-widgets/geodirectory_reviews_widget.php');
|
|
| 1090 | + /** |
|
| 1091 | + * Contains all functions for related listing widget. |
|
| 1092 | + * |
|
| 1093 | + * @since 1.0.0 |
|
| 1094 | + * @package GeoDirectory |
|
| 1095 | + */ |
|
| 1096 | + include_once('geodirectory-widgets/geodirectory_related_listing_widget.php');
|
|
| 1097 | + /** |
|
| 1098 | + * Contains all functions for bestof widget. |
|
| 1099 | + * |
|
| 1100 | + * @since 1.0.0 |
|
| 1101 | + * @package GeoDirectory |
|
| 1102 | + */ |
|
| 1103 | + include_once('geodirectory-widgets/geodirectory_bestof_widget.php');
|
|
| 1104 | + /** |
|
| 1105 | + * Contains all functions for cpt categories widget. |
|
| 1106 | + * |
|
| 1107 | + * @since 1.5.4 |
|
| 1108 | + * @package GeoDirectory |
|
| 1109 | + */ |
|
| 1110 | + include_once('geodirectory-widgets/geodirectory_cpt_categories_widget.php');
|
|
| 1104 | 1111 | /** |
| 1105 | - * Contains all functions for cpt categories widget. |
|
| 1106 | - * |
|
| 1107 | - * @since 1.5.4 |
|
| 1108 | - * @package GeoDirectory |
|
| 1109 | - */ |
|
| 1110 | - include_once('geodirectory-widgets/geodirectory_cpt_categories_widget.php');
|
|
| 1111 | - /** |
|
| 1112 | - * Contains all functions for features widget. |
|
| 1113 | - * |
|
| 1114 | - * @since 1.5.6 |
|
| 1115 | - * @package GeoDirectory |
|
| 1116 | - * @todo make the image field recurring |
|
| 1117 | - */ |
|
| 1118 | - include_once('geodirectory-widgets/geodirectory_features_widget.php');
|
|
| 1119 | - } |
|
| 1112 | + * Contains all functions for features widget. |
|
| 1113 | + * |
|
| 1114 | + * @since 1.5.6 |
|
| 1115 | + * @package GeoDirectory |
|
| 1116 | + * @todo make the image field recurring |
|
| 1117 | + */ |
|
| 1118 | + include_once('geodirectory-widgets/geodirectory_features_widget.php');
|
|
| 1119 | + } |
|
| 1120 | 1120 | |
| 1121 | 1121 | } |
| 1122 | 1122 | |