@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | // If this file is called directly, abort. |
| 11 | 11 | if (!defined('WPINC')) { |
| 12 | - die; |
|
| 12 | + die; |
|
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | /** |
@@ -22,22 +22,22 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | function gdsc_validate_measurements($value) |
| 24 | 24 | { |
| 25 | - if ((strlen($value) - 1) == strpos(trim($value), '%')) { |
|
| 26 | - // $value is entered as a percent, so it can't be less than 0 or more than 100 |
|
| 27 | - $value = preg_replace('/\D/', '', $value); |
|
| 28 | - if (100 < $value) { |
|
| 29 | - $value = 100; |
|
| 30 | - } |
|
| 31 | - // Re-add the percent symbol |
|
| 32 | - $value = $value . '%'; |
|
| 33 | - } elseif ((strlen($value) - 2) == strpos(trim($value), 'px')) { |
|
| 34 | - // Get the absint & re-add the 'px' |
|
| 35 | - $value = preg_replace('/\D/', '', $value) . 'px'; |
|
| 36 | - } else { |
|
| 37 | - $value = preg_replace('/\D/', '', $value); |
|
| 38 | - } |
|
| 25 | + if ((strlen($value) - 1) == strpos(trim($value), '%')) { |
|
| 26 | + // $value is entered as a percent, so it can't be less than 0 or more than 100 |
|
| 27 | + $value = preg_replace('/\D/', '', $value); |
|
| 28 | + if (100 < $value) { |
|
| 29 | + $value = 100; |
|
| 30 | + } |
|
| 31 | + // Re-add the percent symbol |
|
| 32 | + $value = $value . '%'; |
|
| 33 | + } elseif ((strlen($value) - 2) == strpos(trim($value), 'px')) { |
|
| 34 | + // Get the absint & re-add the 'px' |
|
| 35 | + $value = preg_replace('/\D/', '', $value) . 'px'; |
|
| 36 | + } else { |
|
| 37 | + $value = preg_replace('/\D/', '', $value); |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - return $value; |
|
| 40 | + return $value; |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
@@ -52,35 +52,35 @@ discard block |
||
| 52 | 52 | function gdsc_validate_map_args($params) |
| 53 | 53 | { |
| 54 | 54 | |
| 55 | - $params['width'] = gdsc_validate_measurements($params['width']); |
|
| 56 | - $params['height'] = gdsc_validate_measurements($params['height']); |
|
| 55 | + $params['width'] = gdsc_validate_measurements($params['width']); |
|
| 56 | + $params['height'] = gdsc_validate_measurements($params['height']); |
|
| 57 | 57 | |
| 58 | - // Only accept our 4 maptypes. Otherwise, revert to the default. |
|
| 59 | - if (!(in_array(geodir_strtoupper($params['maptype']), array('HYBRID', 'SATELLITE', 'ROADMAP', 'TERRAIN')))) { |
|
| 60 | - $params['maptype'] = 'ROADMAP'; |
|
| 61 | - } else { |
|
| 62 | - $params['maptype'] = geodir_strtoupper($params['maptype']); |
|
| 63 | - } |
|
| 58 | + // Only accept our 4 maptypes. Otherwise, revert to the default. |
|
| 59 | + if (!(in_array(geodir_strtoupper($params['maptype']), array('HYBRID', 'SATELLITE', 'ROADMAP', 'TERRAIN')))) { |
|
| 60 | + $params['maptype'] = 'ROADMAP'; |
|
| 61 | + } else { |
|
| 62 | + $params['maptype'] = geodir_strtoupper($params['maptype']); |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - // Zoom accepts a value between 1 and 19 |
|
| 66 | - $params['zoom'] = absint($params['zoom']); |
|
| 67 | - if (19 < $params['zoom']) { |
|
| 68 | - $params['zoom'] = '19'; |
|
| 69 | - } |
|
| 70 | - if (0 == $params['zoom']) { |
|
| 71 | - $params['zoom'] = '1'; |
|
| 72 | - } |
|
| 65 | + // Zoom accepts a value between 1 and 19 |
|
| 66 | + $params['zoom'] = absint($params['zoom']); |
|
| 67 | + if (19 < $params['zoom']) { |
|
| 68 | + $params['zoom'] = '19'; |
|
| 69 | + } |
|
| 70 | + if (0 == $params['zoom']) { |
|
| 71 | + $params['zoom'] = '1'; |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | - // Child_collapse must be boolean |
|
| 75 | - $params['child_collapse'] = gdsc_to_bool_val($params['child_collapse']); |
|
| 74 | + // Child_collapse must be boolean |
|
| 75 | + $params['child_collapse'] = gdsc_to_bool_val($params['child_collapse']); |
|
| 76 | 76 | |
| 77 | - // Scrollwheel must be boolean |
|
| 78 | - $params['scrollwheel'] = gdsc_to_bool_val($params['scrollwheel']); |
|
| 77 | + // Scrollwheel must be boolean |
|
| 78 | + $params['scrollwheel'] = gdsc_to_bool_val($params['scrollwheel']); |
|
| 79 | 79 | |
| 80 | - // Scrollwheel must be boolean |
|
| 81 | - $params['autozoom'] = gdsc_to_bool_val($params['autozoom']); |
|
| 80 | + // Scrollwheel must be boolean |
|
| 81 | + $params['autozoom'] = gdsc_to_bool_val($params['autozoom']); |
|
| 82 | 82 | |
| 83 | - return $params; |
|
| 83 | + return $params; |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /** |
@@ -99,52 +99,52 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | function gdsc_to_bool_val($in, $strict = false) |
| 101 | 101 | { |
| 102 | - $out = null; |
|
| 103 | - |
|
| 104 | - // if not strict, we only have to check if something is false |
|
| 105 | - if (in_array($in, array( |
|
| 106 | - 'false', |
|
| 107 | - 'False', |
|
| 108 | - 'FALSE', |
|
| 109 | - 'no', |
|
| 110 | - 'No', |
|
| 111 | - 'n', |
|
| 112 | - 'N', |
|
| 113 | - '0', |
|
| 114 | - 'off', |
|
| 115 | - 'Off', |
|
| 116 | - 'OFF', |
|
| 117 | - false, |
|
| 118 | - 0, |
|
| 119 | - null |
|
| 120 | - ), true)) { |
|
| 121 | - $out = false; |
|
| 122 | - } else if ($strict) { |
|
| 123 | - // if strict, check the equivalent true values |
|
| 124 | - if (in_array($in, array( |
|
| 125 | - 'true', |
|
| 126 | - 'True', |
|
| 127 | - 'TRUE', |
|
| 128 | - 'yes', |
|
| 129 | - 'Yes', |
|
| 130 | - 'y', |
|
| 131 | - 'Y', |
|
| 132 | - '1', |
|
| 133 | - 'on', |
|
| 134 | - 'On', |
|
| 135 | - 'ON', |
|
| 136 | - true, |
|
| 137 | - 1 |
|
| 138 | - ), true)) { |
|
| 139 | - $out = true; |
|
| 140 | - } |
|
| 141 | - } else { |
|
| 142 | - // not strict? let the regular php bool check figure it out (will |
|
| 143 | - // largely default to true) |
|
| 144 | - $out = ($in ? true : false); |
|
| 145 | - } |
|
| 102 | + $out = null; |
|
| 103 | + |
|
| 104 | + // if not strict, we only have to check if something is false |
|
| 105 | + if (in_array($in, array( |
|
| 106 | + 'false', |
|
| 107 | + 'False', |
|
| 108 | + 'FALSE', |
|
| 109 | + 'no', |
|
| 110 | + 'No', |
|
| 111 | + 'n', |
|
| 112 | + 'N', |
|
| 113 | + '0', |
|
| 114 | + 'off', |
|
| 115 | + 'Off', |
|
| 116 | + 'OFF', |
|
| 117 | + false, |
|
| 118 | + 0, |
|
| 119 | + null |
|
| 120 | + ), true)) { |
|
| 121 | + $out = false; |
|
| 122 | + } else if ($strict) { |
|
| 123 | + // if strict, check the equivalent true values |
|
| 124 | + if (in_array($in, array( |
|
| 125 | + 'true', |
|
| 126 | + 'True', |
|
| 127 | + 'TRUE', |
|
| 128 | + 'yes', |
|
| 129 | + 'Yes', |
|
| 130 | + 'y', |
|
| 131 | + 'Y', |
|
| 132 | + '1', |
|
| 133 | + 'on', |
|
| 134 | + 'On', |
|
| 135 | + 'ON', |
|
| 136 | + true, |
|
| 137 | + 1 |
|
| 138 | + ), true)) { |
|
| 139 | + $out = true; |
|
| 140 | + } |
|
| 141 | + } else { |
|
| 142 | + // not strict? let the regular php bool check figure it out (will |
|
| 143 | + // largely default to true) |
|
| 144 | + $out = ($in ? true : false); |
|
| 145 | + } |
|
| 146 | 146 | |
| 147 | - return $out; |
|
| 147 | + return $out; |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | /** |
@@ -157,16 +157,16 @@ discard block |
||
| 157 | 157 | */ |
| 158 | 158 | function gdsc_is_post_type_valid($incoming_post_type) |
| 159 | 159 | { |
| 160 | - $post_types = geodir_get_posttypes(); |
|
| 161 | - $post_types = array_map('geodir_strtolower', $post_types); |
|
| 162 | - $post_type_found = false; |
|
| 163 | - foreach ($post_types as $type) { |
|
| 164 | - if (geodir_strtolower($incoming_post_type) == geodir_strtolower($type)) { |
|
| 165 | - $post_type_found = true; |
|
| 166 | - } |
|
| 167 | - } |
|
| 160 | + $post_types = geodir_get_posttypes(); |
|
| 161 | + $post_types = array_map('geodir_strtolower', $post_types); |
|
| 162 | + $post_type_found = false; |
|
| 163 | + foreach ($post_types as $type) { |
|
| 164 | + if (geodir_strtolower($incoming_post_type) == geodir_strtolower($type)) { |
|
| 165 | + $post_type_found = true; |
|
| 166 | + } |
|
| 167 | + } |
|
| 168 | 168 | |
| 169 | - return $post_type_found; |
|
| 169 | + return $post_type_found; |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | /** |
@@ -186,52 +186,52 @@ discard block |
||
| 186 | 186 | */ |
| 187 | 187 | function gdsc_listing_loop_filter($query) |
| 188 | 188 | { |
| 189 | - global $wp_query, $geodir_post_type, $table, $plugin_prefix, $term; |
|
| 190 | - |
|
| 191 | - $geodir_post_type = geodir_get_current_posttype(); |
|
| 192 | - |
|
| 193 | - if (isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries) { |
|
| 194 | - $taxonomies = wp_list_pluck($wp_query->tax_query->queries, 'taxonomy'); |
|
| 195 | - |
|
| 196 | - if (isset($wp_query->query[$taxonomies[0]])) { |
|
| 197 | - $request_term = explode("/", $wp_query->query[$taxonomies[0]]); |
|
| 198 | - $request_term = end($request_term); |
|
| 199 | - if (!term_exists($request_term)) { |
|
| 200 | - $args = array('number' => '1',); |
|
| 201 | - $terms_arr = get_terms($taxonomies[0], $args); |
|
| 202 | - foreach ($terms_arr as $location_term) { |
|
| 203 | - $term_arr = $location_term; |
|
| 204 | - $term_arr->name = geodir_ucwords(str_replace('-', ' ', $request_term)); |
|
| 205 | - } |
|
| 206 | - $wp_query->queried_object_id = 1; |
|
| 207 | - $wp_query->queried_object = $term_arr; |
|
| 208 | - } |
|
| 209 | - } |
|
| 189 | + global $wp_query, $geodir_post_type, $table, $plugin_prefix, $term; |
|
| 190 | + |
|
| 191 | + $geodir_post_type = geodir_get_current_posttype(); |
|
| 192 | + |
|
| 193 | + if (isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries) { |
|
| 194 | + $taxonomies = wp_list_pluck($wp_query->tax_query->queries, 'taxonomy'); |
|
| 195 | + |
|
| 196 | + if (isset($wp_query->query[$taxonomies[0]])) { |
|
| 197 | + $request_term = explode("/", $wp_query->query[$taxonomies[0]]); |
|
| 198 | + $request_term = end($request_term); |
|
| 199 | + if (!term_exists($request_term)) { |
|
| 200 | + $args = array('number' => '1',); |
|
| 201 | + $terms_arr = get_terms($taxonomies[0], $args); |
|
| 202 | + foreach ($terms_arr as $location_term) { |
|
| 203 | + $term_arr = $location_term; |
|
| 204 | + $term_arr->name = geodir_ucwords(str_replace('-', ' ', $request_term)); |
|
| 205 | + } |
|
| 206 | + $wp_query->queried_object_id = 1; |
|
| 207 | + $wp_query->queried_object = $term_arr; |
|
| 208 | + } |
|
| 209 | + } |
|
| 210 | 210 | |
| 211 | - } |
|
| 212 | - if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) { |
|
| 211 | + } |
|
| 212 | + if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) { |
|
| 213 | 213 | |
| 214 | - $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
| 214 | + $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
| 215 | 215 | |
| 216 | - add_filter('posts_fields', 'geodir_posts_fields', 1); |
|
| 217 | - add_filter('posts_join', 'geodir_posts_join', 1); |
|
| 218 | - geodir_post_where(); |
|
| 219 | - if (!is_admin()) { |
|
| 220 | - add_filter('posts_orderby', 'geodir_posts_orderby', 1); |
|
| 221 | - } |
|
| 216 | + add_filter('posts_fields', 'geodir_posts_fields', 1); |
|
| 217 | + add_filter('posts_join', 'geodir_posts_join', 1); |
|
| 218 | + geodir_post_where(); |
|
| 219 | + if (!is_admin()) { |
|
| 220 | + add_filter('posts_orderby', 'geodir_posts_orderby', 1); |
|
| 221 | + } |
|
| 222 | 222 | |
| 223 | - // advanced filter for popular post view widget |
|
| 224 | - global $wp_query; |
|
| 225 | - if (!is_admin()) { |
|
| 226 | - if (!empty($wp_query->query['with_pics_only'])) { |
|
| 227 | - add_filter('posts_join', 'geodir_filter_widget_join', 1000); |
|
| 228 | - } |
|
| 229 | - add_filter('posts_where', 'geodir_filter_widget_where', 1000); |
|
| 230 | - } |
|
| 223 | + // advanced filter for popular post view widget |
|
| 224 | + global $wp_query; |
|
| 225 | + if (!is_admin()) { |
|
| 226 | + if (!empty($wp_query->query['with_pics_only'])) { |
|
| 227 | + add_filter('posts_join', 'geodir_filter_widget_join', 1000); |
|
| 228 | + } |
|
| 229 | + add_filter('posts_where', 'geodir_filter_widget_where', 1000); |
|
| 230 | + } |
|
| 231 | 231 | |
| 232 | - } |
|
| 232 | + } |
|
| 233 | 233 | |
| 234 | - return $query; |
|
| 234 | + return $query; |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | /** |
@@ -245,40 +245,40 @@ discard block |
||
| 245 | 245 | */ |
| 246 | 246 | function gdsc_manage_category_choice($post_type, $category) |
| 247 | 247 | { |
| 248 | - if (0 == $category || '' == $category) { |
|
| 249 | - return ''; |
|
| 250 | - } |
|
| 248 | + if (0 == $category || '' == $category) { |
|
| 249 | + return ''; |
|
| 250 | + } |
|
| 251 | 251 | |
| 252 | - if (!(gdsc_is_post_type_valid($post_type))) { |
|
| 253 | - return ''; |
|
| 254 | - } |
|
| 252 | + if (!(gdsc_is_post_type_valid($post_type))) { |
|
| 253 | + return ''; |
|
| 254 | + } |
|
| 255 | 255 | |
| 256 | - $taxonomies = geodir_get_taxonomies($post_type); |
|
| 256 | + $taxonomies = geodir_get_taxonomies($post_type); |
|
| 257 | 257 | |
| 258 | - $categories = get_terms(array('taxonomy' => $taxonomies[0])); |
|
| 258 | + $categories = get_terms(array('taxonomy' => $taxonomies[0])); |
|
| 259 | 259 | |
| 260 | - $cat_id = 0; |
|
| 260 | + $cat_id = 0; |
|
| 261 | 261 | |
| 262 | - foreach ($categories as $cat) { |
|
| 263 | - if (is_numeric($category)) { |
|
| 264 | - if (absint($category) == $cat->term_id) { |
|
| 265 | - $cat_id = $cat->term_id; |
|
| 266 | - break; |
|
| 267 | - } |
|
| 268 | - } else { |
|
| 269 | - if ($category == $cat->slug) { |
|
| 270 | - $cat_id = $cat->term_id; |
|
| 271 | - break; |
|
| 272 | - } |
|
| 262 | + foreach ($categories as $cat) { |
|
| 263 | + if (is_numeric($category)) { |
|
| 264 | + if (absint($category) == $cat->term_id) { |
|
| 265 | + $cat_id = $cat->term_id; |
|
| 266 | + break; |
|
| 267 | + } |
|
| 268 | + } else { |
|
| 269 | + if ($category == $cat->slug) { |
|
| 270 | + $cat_id = $cat->term_id; |
|
| 271 | + break; |
|
| 272 | + } |
|
| 273 | 273 | |
| 274 | - if ($category == $cat->name) { |
|
| 275 | - $cat_id = $cat->term_id; |
|
| 276 | - break; |
|
| 277 | - } |
|
| 278 | - } |
|
| 279 | - } |
|
| 274 | + if ($category == $cat->name) { |
|
| 275 | + $cat_id = $cat->term_id; |
|
| 276 | + break; |
|
| 277 | + } |
|
| 278 | + } |
|
| 279 | + } |
|
| 280 | 280 | |
| 281 | - return $cat_id; |
|
| 281 | + return $cat_id; |
|
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | // @todo: Extract this |
@@ -288,11 +288,11 @@ discard block |
||
| 288 | 288 | * Adds the script in the page footer for the home page google map. |
| 289 | 289 | * |
| 290 | 290 | * @since 1.0.0 |
| 291 | - * @return string Print the script in page footer. |
|
| 291 | + * @return string Print the script in page footer. |
|
| 292 | 292 | */ |
| 293 | 293 | function geodir_home_map_add_script() |
| 294 | - { |
|
| 295 | - ?> |
|
| 294 | + { |
|
| 295 | + ?> |
|
| 296 | 296 | <script type="text/javascript"> |
| 297 | 297 | jQuery(document).ready(function () { |
| 298 | 298 | geoDirMapSlide(); |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | } |
| 366 | 366 | </script> |
| 367 | 367 | <?php |
| 368 | - } |
|
| 368 | + } |
|
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | /** |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | */ |
| 377 | 377 | function geodir_popular_category_add_scripts() |
| 378 | 378 | { |
| 379 | - ?> |
|
| 379 | + ?> |
|
| 380 | 380 | <script type="text/javascript"> |
| 381 | 381 | jQuery(function ($) { |
| 382 | 382 | $('.geodir-showcat').click(function () { |
@@ -406,56 +406,56 @@ discard block |
||
| 406 | 406 | */ |
| 407 | 407 | function gdsc_validate_layout_choice($layout_choice) |
| 408 | 408 | { |
| 409 | - switch (geodir_strtolower($layout_choice)) { |
|
| 410 | - case 'list'; |
|
| 411 | - case 'one'; |
|
| 412 | - case 'one_column'; |
|
| 413 | - case 'onecolumn'; |
|
| 414 | - case '1'; |
|
| 415 | - $layout_choice = 'list'; |
|
| 416 | - break; |
|
| 417 | - case 'gridview_onehalf'; |
|
| 418 | - case 'two'; |
|
| 419 | - case 'two_column'; |
|
| 420 | - case 'two_columns'; |
|
| 421 | - case 'twocolumn'; |
|
| 422 | - case 'twocolumns'; |
|
| 423 | - case '2'; |
|
| 424 | - $layout_choice = 'gridview_onehalf'; |
|
| 425 | - break; |
|
| 426 | - case 'gridview_onethird'; |
|
| 427 | - case 'three'; |
|
| 428 | - case 'three_column'; |
|
| 429 | - case 'three_columns'; |
|
| 430 | - case 'threecolumn'; |
|
| 431 | - case 'threecolumns'; |
|
| 432 | - case '3'; |
|
| 433 | - $layout_choice = 'gridview_onethird'; |
|
| 434 | - break; |
|
| 435 | - case 'gridview_onefourth'; |
|
| 436 | - case 'four'; |
|
| 437 | - case 'four_column'; |
|
| 438 | - case 'four_columns'; |
|
| 439 | - case 'fourcolumn'; |
|
| 440 | - case 'fourcolumns'; |
|
| 441 | - case '4'; |
|
| 442 | - $layout_choice = 'gridview_onefourth'; |
|
| 443 | - break; |
|
| 444 | - case 'gridview_onefifth'; |
|
| 445 | - case 'five'; |
|
| 446 | - case 'five_column'; |
|
| 447 | - case 'five_columns'; |
|
| 448 | - case 'fivecolumn'; |
|
| 449 | - case 'fivecolumns'; |
|
| 450 | - case '5'; |
|
| 451 | - $layout_choice = 'gridview_onefifth'; |
|
| 452 | - break; |
|
| 453 | - default: |
|
| 454 | - $layout_choice = 'gridview_onehalf'; |
|
| 455 | - break; |
|
| 456 | - } |
|
| 409 | + switch (geodir_strtolower($layout_choice)) { |
|
| 410 | + case 'list'; |
|
| 411 | + case 'one'; |
|
| 412 | + case 'one_column'; |
|
| 413 | + case 'onecolumn'; |
|
| 414 | + case '1'; |
|
| 415 | + $layout_choice = 'list'; |
|
| 416 | + break; |
|
| 417 | + case 'gridview_onehalf'; |
|
| 418 | + case 'two'; |
|
| 419 | + case 'two_column'; |
|
| 420 | + case 'two_columns'; |
|
| 421 | + case 'twocolumn'; |
|
| 422 | + case 'twocolumns'; |
|
| 423 | + case '2'; |
|
| 424 | + $layout_choice = 'gridview_onehalf'; |
|
| 425 | + break; |
|
| 426 | + case 'gridview_onethird'; |
|
| 427 | + case 'three'; |
|
| 428 | + case 'three_column'; |
|
| 429 | + case 'three_columns'; |
|
| 430 | + case 'threecolumn'; |
|
| 431 | + case 'threecolumns'; |
|
| 432 | + case '3'; |
|
| 433 | + $layout_choice = 'gridview_onethird'; |
|
| 434 | + break; |
|
| 435 | + case 'gridview_onefourth'; |
|
| 436 | + case 'four'; |
|
| 437 | + case 'four_column'; |
|
| 438 | + case 'four_columns'; |
|
| 439 | + case 'fourcolumn'; |
|
| 440 | + case 'fourcolumns'; |
|
| 441 | + case '4'; |
|
| 442 | + $layout_choice = 'gridview_onefourth'; |
|
| 443 | + break; |
|
| 444 | + case 'gridview_onefifth'; |
|
| 445 | + case 'five'; |
|
| 446 | + case 'five_column'; |
|
| 447 | + case 'five_columns'; |
|
| 448 | + case 'fivecolumn'; |
|
| 449 | + case 'fivecolumns'; |
|
| 450 | + case '5'; |
|
| 451 | + $layout_choice = 'gridview_onefifth'; |
|
| 452 | + break; |
|
| 453 | + default: |
|
| 454 | + $layout_choice = 'gridview_onehalf'; |
|
| 455 | + break; |
|
| 456 | + } |
|
| 457 | 457 | |
| 458 | - return $layout_choice; |
|
| 458 | + return $layout_choice; |
|
| 459 | 459 | } |
| 460 | 460 | |
| 461 | 461 | /** |
@@ -472,34 +472,34 @@ discard block |
||
| 472 | 472 | */ |
| 473 | 473 | function gdsc_validate_sort_choice($sort_choice, $post_type = '') |
| 474 | 474 | { |
| 475 | - global $plugin_prefix; |
|
| 476 | - |
|
| 477 | - $sorts = array( |
|
| 478 | - 'az', |
|
| 479 | - 'latest', |
|
| 480 | - 'featured', |
|
| 481 | - 'high_review', |
|
| 482 | - 'high_rating', |
|
| 483 | - 'random', |
|
| 484 | - ); |
|
| 485 | - |
|
| 486 | - if (in_array($sort_choice, $sorts)) { |
|
| 487 | - return $sort_choice; |
|
| 488 | - } |
|
| 475 | + global $plugin_prefix; |
|
| 476 | + |
|
| 477 | + $sorts = array( |
|
| 478 | + 'az', |
|
| 479 | + 'latest', |
|
| 480 | + 'featured', |
|
| 481 | + 'high_review', |
|
| 482 | + 'high_rating', |
|
| 483 | + 'random', |
|
| 484 | + ); |
|
| 485 | + |
|
| 486 | + if (in_array($sort_choice, $sorts)) { |
|
| 487 | + return $sort_choice; |
|
| 488 | + } |
|
| 489 | 489 | |
| 490 | - if (!empty($post_type)) { |
|
| 491 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 490 | + if (!empty($post_type)) { |
|
| 491 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
| 492 | 492 | |
| 493 | - if (!geodir_prepare_custom_sorting($sort_choice, $table)) { |
|
| 494 | - $sort_choice = ''; |
|
| 495 | - } |
|
| 496 | - } |
|
| 493 | + if (!geodir_prepare_custom_sorting($sort_choice, $table)) { |
|
| 494 | + $sort_choice = ''; |
|
| 495 | + } |
|
| 496 | + } |
|
| 497 | 497 | |
| 498 | - if (empty($post_type) || empty($sort_choice)) { |
|
| 499 | - $sort_choice = 'latest'; |
|
| 500 | - } |
|
| 498 | + if (empty($post_type) || empty($sort_choice)) { |
|
| 499 | + $sort_choice = 'latest'; |
|
| 500 | + } |
|
| 501 | 501 | |
| 502 | - return $sort_choice; |
|
| 502 | + return $sort_choice; |
|
| 503 | 503 | } |
| 504 | 504 | |
| 505 | 505 | /** |
@@ -512,22 +512,22 @@ discard block |
||
| 512 | 512 | */ |
| 513 | 513 | function gdsc_validate_listing_width($width_choice) |
| 514 | 514 | { |
| 515 | - if (!(empty($width_choice))) { |
|
| 516 | - $width_choice = absint($width_choice); |
|
| 517 | - } else { |
|
| 518 | - return ''; |
|
| 519 | - } |
|
| 515 | + if (!(empty($width_choice))) { |
|
| 516 | + $width_choice = absint($width_choice); |
|
| 517 | + } else { |
|
| 518 | + return ''; |
|
| 519 | + } |
|
| 520 | 520 | |
| 521 | - if (100 < $width_choice) { |
|
| 522 | - $width_choice = 100; |
|
| 523 | - } |
|
| 521 | + if (100 < $width_choice) { |
|
| 522 | + $width_choice = 100; |
|
| 523 | + } |
|
| 524 | 524 | |
| 525 | - // If listing_width is too narrow, it won't work, arbitrarily set to 10% here |
|
| 526 | - if (10 > $width_choice) { |
|
| 527 | - $width_choice = 10; |
|
| 528 | - } |
|
| 525 | + // If listing_width is too narrow, it won't work, arbitrarily set to 10% here |
|
| 526 | + if (10 > $width_choice) { |
|
| 527 | + $width_choice = 10; |
|
| 528 | + } |
|
| 529 | 529 | |
| 530 | - return $width_choice; |
|
| 530 | + return $width_choice; |
|
| 531 | 531 | } |
| 532 | 532 | |
| 533 | 533 | /** |
@@ -540,18 +540,18 @@ discard block |
||
| 540 | 540 | */ |
| 541 | 541 | function gdsc_validate_list_filter_choice($filter_choice) |
| 542 | 542 | { |
| 543 | - $filters = array( |
|
| 544 | - 'all', |
|
| 545 | - 'today', |
|
| 546 | - 'upcoming', |
|
| 547 | - 'past', |
|
| 548 | - ); |
|
| 549 | - |
|
| 550 | - if (!(in_array($filter_choice, $filters))) { |
|
| 551 | - $filter_choice = 'all'; |
|
| 552 | - } |
|
| 543 | + $filters = array( |
|
| 544 | + 'all', |
|
| 545 | + 'today', |
|
| 546 | + 'upcoming', |
|
| 547 | + 'past', |
|
| 548 | + ); |
|
| 549 | + |
|
| 550 | + if (!(in_array($filter_choice, $filters))) { |
|
| 551 | + $filter_choice = 'all'; |
|
| 552 | + } |
|
| 553 | 553 | |
| 554 | - return $filter_choice; |
|
| 554 | + return $filter_choice; |
|
| 555 | 555 | } |
| 556 | 556 | |
| 557 | 557 | /** |
@@ -574,7 +574,7 @@ discard block |
||
| 574 | 574 | * @return string Listings HTML content. |
| 575 | 575 | */ |
| 576 | 576 | function geodir_sc_gd_listings_output($args = array()) { |
| 577 | - $title = !empty($args['title']) ? __($args['title'], 'geodirectory') : ''; |
|
| 577 | + $title = !empty($args['title']) ? __($args['title'], 'geodirectory') : ''; |
|
| 578 | 578 | $post_type = !empty($args['post_type']) ? $args['post_type'] : 'gd_place'; |
| 579 | 579 | $category = !empty($args['category']) ? $args['category'] : '0'; |
| 580 | 580 | $post_number = !empty($args['post_number']) ? $args['post_number'] : 10; |
@@ -585,17 +585,17 @@ discard block |
||
| 585 | 585 | $listing_width = !empty($args['listing_width']) ? $args['listing_width'] : ''; |
| 586 | 586 | $with_pagination = !empty($args['with_pagination']) ? true : false; |
| 587 | 587 | $event_type = !empty($args['event_type']) ? $args['event_type'] : ''; |
| 588 | - $shortcode_content = !empty($args['shortcode_content']) ? trim($args['shortcode_content']) : ''; |
|
| 589 | - $tags = !empty($args['tags']) ? $args['tags'] : array(); |
|
| 590 | - /** |
|
| 591 | - * Filter the content text displayed when no listings found. |
|
| 592 | - * |
|
| 593 | - * @since 1.6.0 |
|
| 594 | - * |
|
| 595 | - * @param string $shortcode_content The shortcode content text. |
|
| 596 | - * @param array $args Array of arguements to filter listings. |
|
| 597 | - */ |
|
| 598 | - $shortcode_content = apply_filters('geodir_sc_gd_listings_not_found_content', $shortcode_content, $args); |
|
| 588 | + $shortcode_content = !empty($args['shortcode_content']) ? trim($args['shortcode_content']) : ''; |
|
| 589 | + $tags = !empty($args['tags']) ? $args['tags'] : array(); |
|
| 590 | + /** |
|
| 591 | + * Filter the content text displayed when no listings found. |
|
| 592 | + * |
|
| 593 | + * @since 1.6.0 |
|
| 594 | + * |
|
| 595 | + * @param string $shortcode_content The shortcode content text. |
|
| 596 | + * @param array $args Array of arguements to filter listings. |
|
| 597 | + */ |
|
| 598 | + $shortcode_content = apply_filters('geodir_sc_gd_listings_not_found_content', $shortcode_content, $args); |
|
| 599 | 599 | |
| 600 | 600 | $top_pagination = $with_pagination && !empty($args['top_pagination']) ? true : false; |
| 601 | 601 | $bottom_pagination = $with_pagination && !empty($args['bottom_pagination']) ? true : false; |
@@ -607,92 +607,92 @@ discard block |
||
| 607 | 607 | $pageno = $geodir_ajax && !empty($args['pageno']) ? $args['pageno'] : 1; |
| 608 | 608 | |
| 609 | 609 | $query_args = array( |
| 610 | - 'posts_per_page' => $post_number, |
|
| 611 | - 'is_geodir_loop' => true, |
|
| 612 | - 'gd_location' => $add_location_filter, |
|
| 613 | - 'post_type' => $post_type, |
|
| 614 | - 'order_by' => $list_sort, |
|
| 610 | + 'posts_per_page' => $post_number, |
|
| 611 | + 'is_geodir_loop' => true, |
|
| 612 | + 'gd_location' => $add_location_filter, |
|
| 613 | + 'post_type' => $post_type, |
|
| 614 | + 'order_by' => $list_sort, |
|
| 615 | 615 | 'pageno' => $pageno |
| 616 | - ); |
|
| 616 | + ); |
|
| 617 | 617 | |
| 618 | - if ($character_count >= 0) { |
|
| 619 | - $query_args['excerpt_length'] = $character_count; |
|
| 620 | - } |
|
| 618 | + if ($character_count >= 0) { |
|
| 619 | + $query_args['excerpt_length'] = $character_count; |
|
| 620 | + } |
|
| 621 | 621 | |
| 622 | - if (!empty($args['post_author'])) { |
|
| 623 | - $query_args['post_author'] = $args['post_author']; |
|
| 624 | - } |
|
| 622 | + if (!empty($args['post_author'])) { |
|
| 623 | + $query_args['post_author'] = $args['post_author']; |
|
| 624 | + } |
|
| 625 | 625 | |
| 626 | - if (!empty($args['show_featured_only'])) { |
|
| 627 | - $query_args['show_featured_only'] = 1; |
|
| 628 | - } |
|
| 626 | + if (!empty($args['show_featured_only'])) { |
|
| 627 | + $query_args['show_featured_only'] = 1; |
|
| 628 | + } |
|
| 629 | 629 | |
| 630 | - if (!empty($args['show_special_only'])) { |
|
| 631 | - $query_args['show_special_only'] = 1; |
|
| 632 | - } |
|
| 630 | + if (!empty($args['show_special_only'])) { |
|
| 631 | + $query_args['show_special_only'] = 1; |
|
| 632 | + } |
|
| 633 | 633 | |
| 634 | - if (!empty($args['with_pics_only'])) { |
|
| 635 | - $query_args['with_pics_only'] = 0; |
|
| 636 | - $query_args['featured_image_only'] = 1; |
|
| 637 | - } |
|
| 634 | + if (!empty($args['with_pics_only'])) { |
|
| 635 | + $query_args['with_pics_only'] = 0; |
|
| 636 | + $query_args['featured_image_only'] = 1; |
|
| 637 | + } |
|
| 638 | 638 | |
| 639 | - if (!empty($args['with_videos_only'])) { |
|
| 640 | - $query_args['with_videos_only'] = 1; |
|
| 641 | - } |
|
| 639 | + if (!empty($args['with_videos_only'])) { |
|
| 640 | + $query_args['with_videos_only'] = 1; |
|
| 641 | + } |
|
| 642 | 642 | |
| 643 | - if (!empty($args['show_favorites_only'])) { |
|
| 644 | - $query_args['show_favorites_only'] = 1; |
|
| 645 | - $query_args['favorites_by_user'] = !empty($args['favorites_by_user']) ? $args['favorites_by_user'] : 0; |
|
| 646 | - } |
|
| 647 | - $with_no_results = !empty($args['without_no_results']) ? false : true; |
|
| 643 | + if (!empty($args['show_favorites_only'])) { |
|
| 644 | + $query_args['show_favorites_only'] = 1; |
|
| 645 | + $query_args['favorites_by_user'] = !empty($args['favorites_by_user']) ? $args['favorites_by_user'] : 0; |
|
| 646 | + } |
|
| 647 | + $with_no_results = !empty($args['without_no_results']) ? false : true; |
|
| 648 | 648 | |
| 649 | - if (!empty($category) && isset($category[0]) && $category[0] != '0') { |
|
| 650 | - $category_taxonomy = geodir_get_taxonomies($post_type); |
|
| 649 | + if (!empty($category) && isset($category[0]) && $category[0] != '0') { |
|
| 650 | + $category_taxonomy = geodir_get_taxonomies($post_type); |
|
| 651 | 651 | |
| 652 | - ######### WPML ######### |
|
| 653 | - if (geodir_wpml_is_taxonomy_translated($category_taxonomy[0])) { |
|
| 654 | - $category = gd_lang_object_ids($category, $category_taxonomy[0]); |
|
| 655 | - } |
|
| 656 | - ######### WPML ######### |
|
| 652 | + ######### WPML ######### |
|
| 653 | + if (geodir_wpml_is_taxonomy_translated($category_taxonomy[0])) { |
|
| 654 | + $category = gd_lang_object_ids($category, $category_taxonomy[0]); |
|
| 655 | + } |
|
| 656 | + ######### WPML ######### |
|
| 657 | 657 | |
| 658 | - $tax_query = array( |
|
| 659 | - 'taxonomy' => $category_taxonomy[0], |
|
| 660 | - 'field' => 'id', |
|
| 661 | - 'terms' => $category |
|
| 662 | - ); |
|
| 658 | + $tax_query = array( |
|
| 659 | + 'taxonomy' => $category_taxonomy[0], |
|
| 660 | + 'field' => 'id', |
|
| 661 | + 'terms' => $category |
|
| 662 | + ); |
|
| 663 | 663 | |
| 664 | - $query_args['tax_query'] = array($tax_query); |
|
| 665 | - } |
|
| 664 | + $query_args['tax_query'] = array($tax_query); |
|
| 665 | + } |
|
| 666 | 666 | |
| 667 | - if (!empty($tags)) { |
|
| 668 | - // Clean tags |
|
| 669 | - if (!is_array($tags)) { |
|
| 670 | - $comma = _x(',', 'tag delimiter'); |
|
| 671 | - if ( ',' !== $comma ) { |
|
| 672 | - $tags = str_replace($comma, ',', $tags); |
|
| 673 | - } |
|
| 674 | - $tags = explode(',', trim($tags, " \n\t\r\0\x0B,")); |
|
| 675 | - $tags = array_map('trim', $tags); |
|
| 676 | - } |
|
| 667 | + if (!empty($tags)) { |
|
| 668 | + // Clean tags |
|
| 669 | + if (!is_array($tags)) { |
|
| 670 | + $comma = _x(',', 'tag delimiter'); |
|
| 671 | + if ( ',' !== $comma ) { |
|
| 672 | + $tags = str_replace($comma, ',', $tags); |
|
| 673 | + } |
|
| 674 | + $tags = explode(',', trim($tags, " \n\t\r\0\x0B,")); |
|
| 675 | + $tags = array_map('trim', $tags); |
|
| 676 | + } |
|
| 677 | 677 | |
| 678 | - if (!empty($tags)) { |
|
| 679 | - $tag_query = array( |
|
| 680 | - 'taxonomy' => $post_type . '_tags', |
|
| 681 | - 'field' => 'name', |
|
| 682 | - 'terms' => $tags |
|
| 683 | - ); |
|
| 684 | - |
|
| 685 | - if (!empty($query_args['tax_query'])) { |
|
| 686 | - $query_args['tax_query'][] = $tag_query; |
|
| 687 | - } else { |
|
| 688 | - $query_args['tax_query'] = array($tag_query); |
|
| 689 | - } |
|
| 690 | - } |
|
| 691 | - } |
|
| 678 | + if (!empty($tags)) { |
|
| 679 | + $tag_query = array( |
|
| 680 | + 'taxonomy' => $post_type . '_tags', |
|
| 681 | + 'field' => 'name', |
|
| 682 | + 'terms' => $tags |
|
| 683 | + ); |
|
| 684 | + |
|
| 685 | + if (!empty($query_args['tax_query'])) { |
|
| 686 | + $query_args['tax_query'][] = $tag_query; |
|
| 687 | + } else { |
|
| 688 | + $query_args['tax_query'] = array($tag_query); |
|
| 689 | + } |
|
| 690 | + } |
|
| 691 | + } |
|
| 692 | 692 | |
| 693 | - global $gridview_columns_widget, $geodir_is_widget_listing; |
|
| 693 | + global $gridview_columns_widget, $geodir_is_widget_listing; |
|
| 694 | 694 | |
| 695 | - if ($post_type == 'gd_event' && function_exists('geodir_event_get_widget_events')) { |
|
| 695 | + if ($post_type == 'gd_event' && function_exists('geodir_event_get_widget_events')) { |
|
| 696 | 696 | global $geodir_event_widget_listview; |
| 697 | 697 | $geodir_event_widget_listview = true; |
| 698 | 698 | |
@@ -707,16 +707,16 @@ discard block |
||
| 707 | 707 | $widget_listings = $total_posts > 0 ? geodir_get_widget_listings($query_args) : array(); |
| 708 | 708 | } |
| 709 | 709 | $current_gridview_columns_widget = $gridview_columns_widget; |
| 710 | - $identifier = ' gd-wgt-pagi-' . mt_rand(); |
|
| 711 | - ob_start(); |
|
| 710 | + $identifier = ' gd-wgt-pagi-' . mt_rand(); |
|
| 711 | + ob_start(); |
|
| 712 | 712 | if (!empty($widget_listings) || $with_no_results) { |
| 713 | 713 | if (!$geodir_ajax) { |
| 714 | - /** |
|
| 715 | - * Called before the shortcode [gd_listings] content is output. |
|
| 716 | - * |
|
| 717 | - * @since 1.0.0 |
|
| 718 | - */ |
|
| 719 | - do_action('geodir_before_sc_gd_listings'); |
|
| 714 | + /** |
|
| 715 | + * Called before the shortcode [gd_listings] content is output. |
|
| 716 | + * |
|
| 717 | + * @since 1.0.0 |
|
| 718 | + */ |
|
| 719 | + do_action('geodir_before_sc_gd_listings'); |
|
| 720 | 720 | ?> |
| 721 | 721 | <div class="geodir_locations geodir_location_listing geodir-sc-gd-listings <?php echo $identifier;?>"> |
| 722 | 722 | <?php if ($title != '') { ?> |
@@ -727,63 +727,63 @@ discard block |
||
| 727 | 727 | <div class="gd-sc-loader"> |
| 728 | 728 | <div class="gd-sc-content"> |
| 729 | 729 | <?php } |
| 730 | - if (!(empty($widget_listings) && !empty($shortcode_content))) { |
|
| 731 | - if (strstr($layout, 'gridview')) { |
|
| 732 | - $listing_view_exp = explode('_', $layout); |
|
| 733 | - $gridview_columns_widget = $layout; |
|
| 734 | - $layout = $listing_view_exp[0]; |
|
| 735 | - } else { |
|
| 736 | - $gridview_columns_widget = ''; |
|
| 737 | - } |
|
| 738 | - |
|
| 739 | - /** |
|
| 740 | - * Filter the widget listing listview template. |
|
| 741 | - * |
|
| 742 | - * @since 1.0.0 |
|
| 743 | - * |
|
| 744 | - * @param string The template file to display listing. |
|
| 745 | - */ |
|
| 746 | - $template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview')); |
|
| 730 | + if (!(empty($widget_listings) && !empty($shortcode_content))) { |
|
| 731 | + if (strstr($layout, 'gridview')) { |
|
| 732 | + $listing_view_exp = explode('_', $layout); |
|
| 733 | + $gridview_columns_widget = $layout; |
|
| 734 | + $layout = $listing_view_exp[0]; |
|
| 735 | + } else { |
|
| 736 | + $gridview_columns_widget = ''; |
|
| 737 | + } |
|
| 738 | + |
|
| 739 | + /** |
|
| 740 | + * Filter the widget listing listview template. |
|
| 741 | + * |
|
| 742 | + * @since 1.0.0 |
|
| 743 | + * |
|
| 744 | + * @param string The template file to display listing. |
|
| 745 | + */ |
|
| 746 | + $template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview')); |
|
| 747 | 747 | |
| 748 | - global $post, $map_jason, $map_canvas_arr, $gd_session; |
|
| 749 | - |
|
| 750 | - $current_post = $post; |
|
| 751 | - $current_map_jason = $map_jason; |
|
| 752 | - $current_map_canvas_arr = $map_canvas_arr; |
|
| 753 | - $geodir_is_widget_listing = true; |
|
| 754 | - $gd_session->un_set('gd_listing_view'); |
|
| 755 | - |
|
| 756 | - if ($with_pagination && $top_pagination) { |
|
| 757 | - echo geodir_sc_listings_pagination($total_posts, $post_number, $pageno); |
|
| 758 | - } |
|
| 759 | - |
|
| 760 | - /** |
|
| 761 | - * Includes listing listview template. |
|
| 762 | - * |
|
| 763 | - * @since 1.0.0 |
|
| 764 | - */ |
|
| 765 | - include($template); |
|
| 748 | + global $post, $map_jason, $map_canvas_arr, $gd_session; |
|
| 749 | + |
|
| 750 | + $current_post = $post; |
|
| 751 | + $current_map_jason = $map_jason; |
|
| 752 | + $current_map_canvas_arr = $map_canvas_arr; |
|
| 753 | + $geodir_is_widget_listing = true; |
|
| 754 | + $gd_session->un_set('gd_listing_view'); |
|
| 755 | + |
|
| 756 | + if ($with_pagination && $top_pagination) { |
|
| 757 | + echo geodir_sc_listings_pagination($total_posts, $post_number, $pageno); |
|
| 758 | + } |
|
| 759 | + |
|
| 760 | + /** |
|
| 761 | + * Includes listing listview template. |
|
| 762 | + * |
|
| 763 | + * @since 1.0.0 |
|
| 764 | + */ |
|
| 765 | + include($template); |
|
| 766 | 766 | |
| 767 | - if ($with_pagination && $bottom_pagination) { |
|
| 768 | - echo geodir_sc_listings_pagination($total_posts, $post_number, $pageno); |
|
| 769 | - } |
|
| 770 | - |
|
| 771 | - $geodir_is_widget_listing = false; |
|
| 772 | - |
|
| 773 | - $GLOBALS['post'] = $current_post; |
|
| 774 | - if (!empty($current_post)) { |
|
| 775 | - setup_postdata($current_post); |
|
| 776 | - } |
|
| 777 | - $map_jason = $current_map_jason; |
|
| 778 | - $map_canvas_arr = $current_map_canvas_arr; |
|
| 779 | - global $gridview_columns_widget; |
|
| 780 | - $gridview_columns_widget = $current_gridview_columns_widget; |
|
| 781 | - } else { |
|
| 782 | - echo $shortcode_content; |
|
| 783 | - } |
|
| 767 | + if ($with_pagination && $bottom_pagination) { |
|
| 768 | + echo geodir_sc_listings_pagination($total_posts, $post_number, $pageno); |
|
| 769 | + } |
|
| 770 | + |
|
| 771 | + $geodir_is_widget_listing = false; |
|
| 772 | + |
|
| 773 | + $GLOBALS['post'] = $current_post; |
|
| 774 | + if (!empty($current_post)) { |
|
| 775 | + setup_postdata($current_post); |
|
| 776 | + } |
|
| 777 | + $map_jason = $current_map_jason; |
|
| 778 | + $map_canvas_arr = $current_map_canvas_arr; |
|
| 779 | + global $gridview_columns_widget; |
|
| 780 | + $gridview_columns_widget = $current_gridview_columns_widget; |
|
| 781 | + } else { |
|
| 782 | + echo $shortcode_content; |
|
| 783 | + } |
|
| 784 | 784 | ?> |
| 785 | 785 | <?php |
| 786 | - if (!$geodir_ajax) { |
|
| 786 | + if (!$geodir_ajax) { |
|
| 787 | 787 | ?> |
| 788 | 788 | </div><p class="geodir-sclisting-loading" style="display:none;"><i class="fa fa-cog fa-spin"></i></p></div> |
| 789 | 789 | <script type="text/javascript"> |
@@ -821,10 +821,10 @@ discard block |
||
| 821 | 821 | loading.hide(); |
| 822 | 822 | jQuery(items).html(response); |
| 823 | 823 | <?php |
| 824 | - /** |
|
| 825 | - * if lazyload images enabled then refresh them once ajax page changed. |
|
| 826 | - */ |
|
| 827 | - if (get_option('geodir_lazy_load', 1)) { ?> |
|
| 824 | + /** |
|
| 825 | + * if lazyload images enabled then refresh them once ajax page changed. |
|
| 826 | + */ |
|
| 827 | + if (get_option('geodir_lazy_load', 1)) { ?> |
|
| 828 | 828 | geodir_init_lazy_load(); |
| 829 | 829 | <?php } ?> |
| 830 | 830 | } |
@@ -834,11 +834,11 @@ discard block |
||
| 834 | 834 | </div> |
| 835 | 835 | <?php } ?> |
| 836 | 836 | <?php |
| 837 | - } |
|
| 837 | + } |
|
| 838 | 838 | $output = ob_get_contents(); |
| 839 | - ob_end_clean(); |
|
| 839 | + ob_end_clean(); |
|
| 840 | 840 | |
| 841 | - return trim($output); |
|
| 841 | + return trim($output); |
|
| 842 | 842 | } |
| 843 | 843 | |
| 844 | 844 | /** |
@@ -865,15 +865,15 @@ discard block |
||
| 865 | 865 | * @return string Listings pagination HTML content. |
| 866 | 866 | */ |
| 867 | 867 | function geodir_sc_listings_pagination($total_posts, $posts_per_page, $pageno, $before = '', $after = '', $prelabel = '', $nxtlabel = '', $pages_to_show = 5, $always_show = false) { |
| 868 | - if (empty($prelabel)) { |
|
| 869 | - $prelabel = '<strong>«</strong>'; |
|
| 870 | - } |
|
| 868 | + if (empty($prelabel)) { |
|
| 869 | + $prelabel = '<strong>«</strong>'; |
|
| 870 | + } |
|
| 871 | 871 | |
| 872 | - if (empty($nxtlabel)) { |
|
| 873 | - $nxtlabel = '<strong>»</strong>'; |
|
| 874 | - } |
|
| 872 | + if (empty($nxtlabel)) { |
|
| 873 | + $nxtlabel = '<strong>»</strong>'; |
|
| 874 | + } |
|
| 875 | 875 | |
| 876 | - $half_pages_to_show = round($pages_to_show / 2); |
|
| 876 | + $half_pages_to_show = round($pages_to_show / 2); |
|
| 877 | 877 | |
| 878 | 878 | $numposts = $total_posts; |
| 879 | 879 | |
@@ -906,7 +906,7 @@ discard block |
||
| 906 | 906 | } |
| 907 | 907 | |
| 908 | 908 | if (($pageno - 1) > 0) { |
| 909 | - echo '<a class="gd-page-sc-prev gd-wgt-page" data-page="' . (int)($pageno - 1) . '" href="javascript:void(0);">' . $prelabel . '</a> '; |
|
| 909 | + echo '<a class="gd-page-sc-prev gd-wgt-page" data-page="' . (int)($pageno - 1) . '" href="javascript:void(0);">' . $prelabel . '</a> '; |
|
| 910 | 910 | } |
| 911 | 911 | |
| 912 | 912 | for ($i = $pageno - $half_pages_to_show; $i <= $pageno + $half_pages_to_show; $i++) { |
@@ -929,9 +929,9 @@ discard block |
||
| 929 | 929 | echo "</div> $after </div>"; |
| 930 | 930 | } |
| 931 | 931 | $output = ob_get_contents(); |
| 932 | - ob_end_clean(); |
|
| 932 | + ob_end_clean(); |
|
| 933 | 933 | |
| 934 | - return trim($output); |
|
| 934 | + return trim($output); |
|
| 935 | 935 | } |
| 936 | 936 | |
| 937 | 937 | /** |
@@ -942,10 +942,10 @@ discard block |
||
| 942 | 942 | * @return string Listings HTML content. |
| 943 | 943 | */ |
| 944 | 944 | function geodir_sclistings_callback() { |
| 945 | - check_ajax_referer('geodir-sclistings-nonce', 'geodir_sclistings_nonce'); |
|
| 946 | - //set variables |
|
| 947 | - $scatts = isset($_POST['scatts']) ? $_POST['scatts'] : NULL; |
|
| 948 | - $pageno = isset($_POST['pageno']) ? absint($_POST['pageno']) : 1; |
|
| 945 | + check_ajax_referer('geodir-sclistings-nonce', 'geodir_sclistings_nonce'); |
|
| 946 | + //set variables |
|
| 947 | + $scatts = isset($_POST['scatts']) ? $_POST['scatts'] : NULL; |
|
| 948 | + $pageno = isset($_POST['pageno']) ? absint($_POST['pageno']) : 1; |
|
| 949 | 949 | |
| 950 | 950 | $shortcode_atts = !empty($scatts) ? (array)json_decode(stripslashes_deep($scatts)) : NULL; |
| 951 | 951 | |
@@ -957,7 +957,7 @@ discard block |
||
| 957 | 957 | } else { |
| 958 | 958 | echo 0; |
| 959 | 959 | } |
| 960 | - wp_die(); |
|
| 960 | + wp_die(); |
|
| 961 | 961 | } |
| 962 | 962 | add_action('wp_ajax_geodir_sclistings', 'geodir_sclistings_callback'); |
| 963 | 963 | add_action('wp_ajax_nopriv_geodir_sclistings', 'geodir_sclistings_callback'); |
| 964 | 964 | \ No newline at end of file |
@@ -29,10 +29,10 @@ discard block |
||
| 29 | 29 | $value = 100; |
| 30 | 30 | } |
| 31 | 31 | // Re-add the percent symbol |
| 32 | - $value = $value . '%'; |
|
| 32 | + $value = $value.'%'; |
|
| 33 | 33 | } elseif ((strlen($value) - 2) == strpos(trim($value), 'px')) { |
| 34 | 34 | // Get the absint & re-add the 'px' |
| 35 | - $value = preg_replace('/\D/', '', $value) . 'px'; |
|
| 35 | + $value = preg_replace('/\D/', '', $value).'px'; |
|
| 36 | 36 | } else { |
| 37 | 37 | $value = preg_replace('/\D/', '', $value); |
| 38 | 38 | } |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | } |
| 212 | 212 | if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) { |
| 213 | 213 | |
| 214 | - $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
| 214 | + $table = $plugin_prefix.$geodir_post_type.'_detail'; |
|
| 215 | 215 | |
| 216 | 216 | add_filter('posts_fields', 'geodir_posts_fields', 1); |
| 217 | 217 | add_filter('posts_join', 'geodir_posts_join', 1); |
@@ -488,7 +488,7 @@ discard block |
||
| 488 | 488 | } |
| 489 | 489 | |
| 490 | 490 | if (!empty($post_type)) { |
| 491 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 491 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 492 | 492 | |
| 493 | 493 | if (!geodir_prepare_custom_sorting($sort_choice, $table)) { |
| 494 | 494 | $sort_choice = ''; |
@@ -581,10 +581,10 @@ discard block |
||
| 581 | 581 | $add_location_filter = !empty($args['add_location_filter']) ? true : false; |
| 582 | 582 | $list_sort = !empty($args['list_sort']) ? $args['list_sort'] : 'latest'; |
| 583 | 583 | $character_count = isset($args['character_count']) ? $args['character_count'] : ''; |
| 584 | - $layout = !empty($args['layout']) ? $args['layout'] : 'gridview_onehalf'; |
|
| 584 | + $layout = !empty($args['layout']) ? $args['layout'] : 'gridview_onehalf'; |
|
| 585 | 585 | $listing_width = !empty($args['listing_width']) ? $args['listing_width'] : ''; |
| 586 | - $with_pagination = !empty($args['with_pagination']) ? true : false; |
|
| 587 | - $event_type = !empty($args['event_type']) ? $args['event_type'] : ''; |
|
| 586 | + $with_pagination = !empty($args['with_pagination']) ? true : false; |
|
| 587 | + $event_type = !empty($args['event_type']) ? $args['event_type'] : ''; |
|
| 588 | 588 | $shortcode_content = !empty($args['shortcode_content']) ? trim($args['shortcode_content']) : ''; |
| 589 | 589 | $tags = !empty($args['tags']) ? $args['tags'] : array(); |
| 590 | 590 | /** |
@@ -598,13 +598,13 @@ discard block |
||
| 598 | 598 | $shortcode_content = apply_filters('geodir_sc_gd_listings_not_found_content', $shortcode_content, $args); |
| 599 | 599 | |
| 600 | 600 | $top_pagination = $with_pagination && !empty($args['top_pagination']) ? true : false; |
| 601 | - $bottom_pagination = $with_pagination && !empty($args['bottom_pagination']) ? true : false; |
|
| 601 | + $bottom_pagination = $with_pagination && !empty($args['bottom_pagination']) ? true : false; |
|
| 602 | 602 | |
| 603 | 603 | $shortcode_atts = !empty($args['shortcode_atts']) ? $args['shortcode_atts'] : array(); |
| 604 | 604 | |
| 605 | 605 | // ajax mode |
| 606 | - $geodir_ajax = !empty($args['geodir_ajax']) ? true : false; |
|
| 607 | - $pageno = $geodir_ajax && !empty($args['pageno']) ? $args['pageno'] : 1; |
|
| 606 | + $geodir_ajax = !empty($args['geodir_ajax']) ? true : false; |
|
| 607 | + $pageno = $geodir_ajax && !empty($args['pageno']) ? $args['pageno'] : 1; |
|
| 608 | 608 | |
| 609 | 609 | $query_args = array( |
| 610 | 610 | 'posts_per_page' => $post_number, |
@@ -668,7 +668,7 @@ discard block |
||
| 668 | 668 | // Clean tags |
| 669 | 669 | if (!is_array($tags)) { |
| 670 | 670 | $comma = _x(',', 'tag delimiter'); |
| 671 | - if ( ',' !== $comma ) { |
|
| 671 | + if (',' !== $comma) { |
|
| 672 | 672 | $tags = str_replace($comma, ',', $tags); |
| 673 | 673 | } |
| 674 | 674 | $tags = explode(',', trim($tags, " \n\t\r\0\x0B,")); |
@@ -677,7 +677,7 @@ discard block |
||
| 677 | 677 | |
| 678 | 678 | if (!empty($tags)) { |
| 679 | 679 | $tag_query = array( |
| 680 | - 'taxonomy' => $post_type . '_tags', |
|
| 680 | + 'taxonomy' => $post_type.'_tags', |
|
| 681 | 681 | 'field' => 'name', |
| 682 | 682 | 'terms' => $tags |
| 683 | 683 | ); |
@@ -707,7 +707,7 @@ discard block |
||
| 707 | 707 | $widget_listings = $total_posts > 0 ? geodir_get_widget_listings($query_args) : array(); |
| 708 | 708 | } |
| 709 | 709 | $current_gridview_columns_widget = $gridview_columns_widget; |
| 710 | - $identifier = ' gd-wgt-pagi-' . mt_rand(); |
|
| 710 | + $identifier = ' gd-wgt-pagi-'.mt_rand(); |
|
| 711 | 711 | ob_start(); |
| 712 | 712 | if (!empty($widget_listings) || $with_no_results) { |
| 713 | 713 | if (!$geodir_ajax) { |
@@ -718,7 +718,7 @@ discard block |
||
| 718 | 718 | */ |
| 719 | 719 | do_action('geodir_before_sc_gd_listings'); |
| 720 | 720 | ?> |
| 721 | - <div class="geodir_locations geodir_location_listing geodir-sc-gd-listings <?php echo $identifier;?>"> |
|
| 721 | + <div class="geodir_locations geodir_location_listing geodir-sc-gd-listings <?php echo $identifier; ?>"> |
|
| 722 | 722 | <?php if ($title != '') { ?> |
| 723 | 723 | <div class="geodir_list_heading clearfix"> |
| 724 | 724 | <?php echo $title; ?> |
@@ -787,8 +787,8 @@ discard block |
||
| 787 | 787 | ?> |
| 788 | 788 | </div><p class="geodir-sclisting-loading" style="display:none;"><i class="fa fa-cog fa-spin"></i></p></div> |
| 789 | 789 | <script type="text/javascript"> |
| 790 | -jQuery(document).on('click', '.<?php echo trim($identifier);?> .gd-wgt-page', function(e) { |
|
| 791 | - var container = jQuery( '.<?php echo trim($identifier);?>'); |
|
| 790 | +jQuery(document).on('click', '.<?php echo trim($identifier); ?> .gd-wgt-page', function(e) { |
|
| 791 | + var container = jQuery( '.<?php echo trim($identifier); ?>'); |
|
| 792 | 792 | var obj = this; |
| 793 | 793 | var pid = parseInt(jQuery(this).data('page')); |
| 794 | 794 | var items = jQuery(obj).closest('.gd-sc-content'); |
@@ -798,7 +798,7 @@ discard block |
||
| 798 | 798 | return false; |
| 799 | 799 | } |
| 800 | 800 | |
| 801 | - var scatts = "<?php echo addslashes(json_encode($shortcode_atts));?>"; |
|
| 801 | + var scatts = "<?php echo addslashes(json_encode($shortcode_atts)); ?>"; |
|
| 802 | 802 | |
| 803 | 803 | var data = { |
| 804 | 804 | 'action': 'geodir_sclistings', |
@@ -887,16 +887,16 @@ discard block |
||
| 887 | 887 | if ($max_page > 1 || $always_show) { |
| 888 | 888 | // Extra pagination info |
| 889 | 889 | $geodir_pagination_more_info = get_option('geodir_pagination_advance_info'); |
| 890 | - $start_no = ( $pageno - 1 ) * $posts_per_page + 1; |
|
| 890 | + $start_no = ($pageno - 1) * $posts_per_page + 1; |
|
| 891 | 891 | $end_no = min($pageno * $posts_per_page, $numposts); |
| 892 | 892 | |
| 893 | 893 | if ($geodir_pagination_more_info != '') { |
| 894 | - $pagination_info = '<div class="gd-pagination-details gd-pagination-details-' . $geodir_pagination_more_info . '">' . wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts) . '</div>'; |
|
| 894 | + $pagination_info = '<div class="gd-pagination-details gd-pagination-details-'.$geodir_pagination_more_info.'">'.wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts).'</div>'; |
|
| 895 | 895 | |
| 896 | 896 | if ($geodir_pagination_more_info == 'before') { |
| 897 | - $before = $before . $pagination_info; |
|
| 897 | + $before = $before.$pagination_info; |
|
| 898 | 898 | } else if ($geodir_pagination_more_info == 'after') { |
| 899 | - $after = $pagination_info . $after; |
|
| 899 | + $after = $pagination_info.$after; |
|
| 900 | 900 | } |
| 901 | 901 | } |
| 902 | 902 | |
@@ -906,7 +906,7 @@ discard block |
||
| 906 | 906 | } |
| 907 | 907 | |
| 908 | 908 | if (($pageno - 1) > 0) { |
| 909 | - echo '<a class="gd-page-sc-prev gd-wgt-page" data-page="' . (int)($pageno - 1) . '" href="javascript:void(0);">' . $prelabel . '</a> '; |
|
| 909 | + echo '<a class="gd-page-sc-prev gd-wgt-page" data-page="'.(int) ($pageno - 1).'" href="javascript:void(0);">'.$prelabel.'</a> '; |
|
| 910 | 910 | } |
| 911 | 911 | |
| 912 | 912 | for ($i = $pageno - $half_pages_to_show; $i <= $pageno + $half_pages_to_show; $i++) { |
@@ -914,17 +914,17 @@ discard block |
||
| 914 | 914 | if ($i == $pageno) { |
| 915 | 915 | echo "<strong class='on' class='gd-page-sc-act'>$i</strong>"; |
| 916 | 916 | } else { |
| 917 | - echo ' <a class="gd-page-sc-no gd-wgt-page" data-page="' . (int)$i . '" href="javascript:void(0);">' . $i . '</a> '; |
|
| 917 | + echo ' <a class="gd-page-sc-no gd-wgt-page" data-page="'.(int) $i.'" href="javascript:void(0);">'.$i.'</a> '; |
|
| 918 | 918 | } |
| 919 | 919 | } |
| 920 | 920 | } |
| 921 | 921 | |
| 922 | 922 | if (($pageno + 1) <= $max_page) { |
| 923 | - echo ' <a class="gd-page-sc-nxt gd-wgt-page" data-page="' . (int)($pageno + 1) . '" href="javascript:void(0);">' . $nxtlabel . '</a>'; |
|
| 923 | + echo ' <a class="gd-page-sc-nxt gd-wgt-page" data-page="'.(int) ($pageno + 1).'" href="javascript:void(0);">'.$nxtlabel.'</a>'; |
|
| 924 | 924 | } |
| 925 | 925 | |
| 926 | 926 | if ($pageno < $max_page) { |
| 927 | - echo ' <a class="gd-page-sc-lst gd-wgt-page" data-page="' . (int)$max_page . '" href="javascript:void(0);">»</a>'; |
|
| 927 | + echo ' <a class="gd-page-sc-lst gd-wgt-page" data-page="'.(int) $max_page.'" href="javascript:void(0);">»</a>'; |
|
| 928 | 928 | } |
| 929 | 929 | echo "</div> $after </div>"; |
| 930 | 930 | } |
@@ -947,7 +947,7 @@ discard block |
||
| 947 | 947 | $scatts = isset($_POST['scatts']) ? $_POST['scatts'] : NULL; |
| 948 | 948 | $pageno = isset($_POST['pageno']) ? absint($_POST['pageno']) : 1; |
| 949 | 949 | |
| 950 | - $shortcode_atts = !empty($scatts) ? (array)json_decode(stripslashes_deep($scatts)) : NULL; |
|
| 950 | + $shortcode_atts = !empty($scatts) ? (array) json_decode(stripslashes_deep($scatts)) : NULL; |
|
| 951 | 951 | |
| 952 | 952 | if (!empty($shortcode_atts) && is_array($shortcode_atts)) { |
| 953 | 953 | $shortcode_atts['pageno'] = $pageno; |