@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | |
243 | 243 | $author_id = $p_post->post_author; |
244 | 244 | |
245 | - }else{ |
|
245 | + } else{ |
|
246 | 246 | gd_die(); |
247 | 247 | } |
248 | 248 | |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | |
388 | 388 | check_ajax_referer( 'send_to_frnd_'.$pid ); |
389 | 389 | |
390 | - }else{ |
|
390 | + } else{ |
|
391 | 391 | gd_die(); |
392 | 392 | } |
393 | 393 | |
@@ -2274,7 +2274,7 @@ discard block |
||
2274 | 2274 | |
2275 | 2275 | if ( $new_style ) { |
2276 | 2276 | $default_search_button_label = '<i class="fa fa-search" aria-hidden="true"></i>'; |
2277 | - }else{ |
|
2277 | + } else{ |
|
2278 | 2278 | $default_search_button_label = 'Search'; |
2279 | 2279 | } |
2280 | 2280 | if ( get_option( 'geodir_search_button_label' ) && get_option( 'geodir_search_button_label' ) != 'Search' ) { |
@@ -2301,7 +2301,7 @@ discard block |
||
2301 | 2301 | if ( $new_style ) { |
2302 | 2302 | ?> |
2303 | 2303 | <button class="geodir_submit_search <?php echo $fa_class; ?>"><?php _e( $default_search_button_label ,'geodirectory'); ?></button> |
2304 | - <?php }else{?> |
|
2304 | + <?php } else{?> |
|
2305 | 2305 | <input type="button" value="<?php esc_attr_e( $default_search_button_label ); ?>" |
2306 | 2306 | class="geodir_submit_search <?php echo $fa_class; ?>"/> |
2307 | 2307 | <?php } |
@@ -2351,17 +2351,17 @@ discard block |
||
2351 | 2351 | if ( $new_style ) { |
2352 | 2352 | echo "</div>"; |
2353 | 2353 | } |
2354 | - }else{ |
|
2354 | + } else{ |
|
2355 | 2355 | if(! empty( $post_types )){ |
2356 | 2356 | $pt_arr = (array)$post_types; |
2357 | 2357 | echo '<input type="hidden" name="stype" value="' . key( $pt_arr ) . '" />'; |
2358 | - }else{ |
|
2358 | + } else{ |
|
2359 | 2359 | echo '<input type="hidden" name="stype" value="gd_place" />'; |
2360 | 2360 | } |
2361 | 2361 | |
2362 | 2362 | } |
2363 | 2363 | |
2364 | - }elseif ( ! empty( $post_types ) ) { |
|
2364 | + } elseif ( ! empty( $post_types ) ) { |
|
2365 | 2365 | echo '<input type="hidden" name="stype" value="gd_place" />'; |
2366 | 2366 | } |
2367 | 2367 | } |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | * @param object|string $post The post object. |
162 | 162 | * @param string $post_type The post type. |
163 | 163 | * |
164 | - * @return object Returns filtered package info as an object. |
|
164 | + * @return string Returns filtered package info as an object. |
|
165 | 165 | */ |
166 | 166 | function geodir_post_package_info( $package_info, $post = '', $post_type = '' ) { |
167 | 167 | $package_info['pid'] = 0; |
@@ -2507,7 +2507,7 @@ discard block |
||
2507 | 2507 | * |
2508 | 2508 | * @since 1.5.0 |
2509 | 2509 | * |
2510 | - * @return True if WPML is active else False. |
|
2510 | + * @return boolean if WPML is active else False. |
|
2511 | 2511 | */ |
2512 | 2512 | function geodir_is_wpml() { |
2513 | 2513 | if (class_exists('SitePress') && function_exists('icl_object_id')) { |
@@ -2583,7 +2583,6 @@ discard block |
||
2583 | 2583 | * @since 1.6.25 "geodir_wpml_listing_duplicated" action added. |
2584 | 2584 | * |
2585 | 2585 | * @param int $post_id The Post ID. |
2586 | - * @param string $lang Language code for translating post. |
|
2587 | 2586 | * @param array $request_info The post details in an array. |
2588 | 2587 | */ |
2589 | 2588 | function geodir_wpml_duplicate_listing($post_id, $request_info) { |
@@ -2673,7 +2672,7 @@ discard block |
||
2673 | 2672 | * @param int $master_post_id Original Post ID. |
2674 | 2673 | * @param int $tr_post_id Translation Post ID. |
2675 | 2674 | * @param string $lang Language code for translating post. |
2676 | - * @return bool True for success, False for fail. |
|
2675 | + * @return boolean|null True for success, False for fail. |
|
2677 | 2676 | */ |
2678 | 2677 | function geodir_icl_duplicate_taxonomies($master_post_id, $tr_post_id, $lang) { |
2679 | 2678 | global $sitepress, $wpdb; |
@@ -2916,8 +2915,6 @@ discard block |
||
2916 | 2915 | * |
2917 | 2916 | * @since 1.6.16 |
2918 | 2917 | * |
2919 | - * @param string $post_type WP post type or WP texonomy. Ex: gd_place. |
|
2920 | - * @param bool $taxonomy Whether $post_type is taxonomy or not. |
|
2921 | 2918 | * @return bool True if review star disabled, otherwise false. |
2922 | 2919 | */ |
2923 | 2920 | function geodir_rating_disabled_post_types() { |
@@ -3189,7 +3186,7 @@ discard block |
||
3189 | 3186 | * @param string $element_type Use post, page, {custom post type name}, nav_menu, nav_menu_item, category, tag, etc. |
3190 | 3187 | * You can also pass 'any', to let WPML guess the type, but this will only work for posts. |
3191 | 3188 | * @param bool $return_original_if_missing Optional, default is FALSE. If set to true it will always return a value (the original value, if translation is missing). |
3192 | - * @param string|NULL $language_code Optional, default is NULL. If missing, it will use the current language. |
|
3189 | + * @param string|NULL $ulanguage_code Optional, default is NULL. If missing, it will use the current language. |
|
3193 | 3190 | * If set to a language code, it will return a translation for that language code or |
3194 | 3191 | * the original if the translation is missing and $return_original_if_missing is set to TRUE. |
3195 | 3192 | * |
@@ -2389,12 +2389,12 @@ |
||
2389 | 2389 | ?> |
2390 | 2390 | <input class="search_text" name="s" |
2391 | 2391 | value="<?php if ( isset( $_REQUEST['s'] ) && trim( $_REQUEST['s'] ) != '' ) { |
2392 | - $search_term = esc_attr( stripslashes_deep( $_REQUEST['s'] ) ); |
|
2393 | - $search_term = str_replace(array("%E2%80%99","’"),array("%27","'"),$search_term); |
|
2394 | - echo $search_term; |
|
2395 | - } else { |
|
2396 | - echo $default_search_for_text; |
|
2397 | - } ?>" type="text" |
|
2392 | + $search_term = esc_attr( stripslashes_deep( $_REQUEST['s'] ) ); |
|
2393 | + $search_term = str_replace(array("%E2%80%99","’"),array("%27","'"),$search_term); |
|
2394 | + echo $search_term; |
|
2395 | + } else { |
|
2396 | + echo $default_search_for_text; |
|
2397 | + } ?>" type="text" |
|
2398 | 2398 | onblur="if (this.value.trim() == '') {this.value = '<?php echo esc_sql( $default_search_for_text ); ?>';}" |
2399 | 2399 | onfocus="if (this.value == '<?php echo esc_sql( $default_search_for_text ); ?>') {this.value = '';}" |
2400 | 2400 | onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);"> |
@@ -52,31 +52,31 @@ discard block |
||
52 | 52 | jQuery(listSel).children('li').switchClass('gridview_onehalf gridview_onethird gridview_onefourth', 'gridview_onefifth', 600); |
53 | 53 | } |
54 | 54 | |
55 | - jQuery.post("<?php echo geodir_get_ajax_url();?>&gd_listing_view=" + val, function (data) { |
|
55 | + jQuery.post("<?php echo geodir_get_ajax_url(); ?>&gd_listing_view=" + val, function (data) { |
|
56 | 56 | //alert(data ); |
57 | 57 | }); |
58 | 58 | } |
59 | 59 | </script> |
60 | 60 | <div class="geodir-list-view-select"> |
61 | 61 | <select name="gd_list_view" id="gd_list_view" onchange="geodir_list_view_select(this);"> |
62 | - <?php $listing_view = (int) $gd_session->get( 'gd_listing_view' ); ?> |
|
63 | - <option value=""><?php _e( 'View:', 'geodirectory' ); ?></option> |
|
62 | + <?php $listing_view = (int) $gd_session->get('gd_listing_view'); ?> |
|
63 | + <option value=""><?php _e('View:', 'geodirectory'); ?></option> |
|
64 | 64 | <option |
65 | - value="1" <?php selected( 1, $listing_view ); ?>><?php _e( 'View: List', 'geodirectory' ); ?></option> |
|
65 | + value="1" <?php selected(1, $listing_view); ?>><?php _e('View: List', 'geodirectory'); ?></option> |
|
66 | 66 | <option |
67 | - value="2" <?php selected( 2, $listing_view ); ?>><?php _e( 'View: Grid 2', 'geodirectory' ); ?></option> |
|
67 | + value="2" <?php selected(2, $listing_view); ?>><?php _e('View: Grid 2', 'geodirectory'); ?></option> |
|
68 | 68 | <option |
69 | - value="3" <?php selected( 3, $listing_view ); ?>><?php _e( 'View: Grid 3', 'geodirectory' ); ?></option> |
|
69 | + value="3" <?php selected(3, $listing_view); ?>><?php _e('View: Grid 3', 'geodirectory'); ?></option> |
|
70 | 70 | <option |
71 | - value="4" <?php selected( 4, $listing_view ); ?>><?php _e( 'View: Grid 4', 'geodirectory' ); ?></option> |
|
71 | + value="4" <?php selected(4, $listing_view); ?>><?php _e('View: Grid 4', 'geodirectory'); ?></option> |
|
72 | 72 | <option |
73 | - value="5" <?php selected( 5, $listing_view ); ?>><?php _e( 'View: Grid 5', 'geodirectory' ); ?></option> |
|
73 | + value="5" <?php selected(5, $listing_view); ?>><?php _e('View: Grid 5', 'geodirectory'); ?></option> |
|
74 | 74 | </select> |
75 | 75 | </div> |
76 | 76 | <?php |
77 | 77 | } |
78 | 78 | |
79 | -add_action( 'geodir_before_listing', 'geodir_list_view_select', 100 ); |
|
79 | +add_action('geodir_before_listing', 'geodir_list_view_select', 100); |
|
80 | 80 | |
81 | 81 | /** |
82 | 82 | * Limit the listing excerpt. |
@@ -91,9 +91,9 @@ discard block |
||
91 | 91 | * @global object $post The current post object. |
92 | 92 | * @return string The modified excerpt. |
93 | 93 | */ |
94 | -function geodir_max_excerpt( $charlength ) { |
|
94 | +function geodir_max_excerpt($charlength) { |
|
95 | 95 | global $post; |
96 | - if ( $charlength == '0' ) { |
|
96 | + if ($charlength == '0') { |
|
97 | 97 | return; |
98 | 98 | } |
99 | 99 | $out = ''; |
@@ -101,46 +101,46 @@ discard block |
||
101 | 101 | $temp_post = $post; |
102 | 102 | $excerpt = get_the_excerpt(); |
103 | 103 | |
104 | - $charlength ++; |
|
105 | - $excerpt_more = function_exists( 'geodirf_excerpt_more' ) ? geodirf_excerpt_more( '' ) : geodir_excerpt_more( '' ); |
|
106 | - if ( geodir_utf8_strlen( $excerpt ) > $charlength ) { |
|
107 | - if ( geodir_utf8_strlen( $excerpt_more ) > 0 && geodir_utf8_strpos( $excerpt, $excerpt_more ) !== false ) { |
|
108 | - $excut = - ( geodir_utf8_strlen( $excerpt_more ) ); |
|
109 | - $subex = geodir_utf8_substr( $excerpt, 0, $excut ); |
|
110 | - if ( $charlength > 0 && geodir_utf8_strlen( $subex ) > $charlength ) { |
|
111 | - $subex = geodir_utf8_substr( $subex, 0, $charlength ); |
|
104 | + $charlength++; |
|
105 | + $excerpt_more = function_exists('geodirf_excerpt_more') ? geodirf_excerpt_more('') : geodir_excerpt_more(''); |
|
106 | + if (geodir_utf8_strlen($excerpt) > $charlength) { |
|
107 | + if (geodir_utf8_strlen($excerpt_more) > 0 && geodir_utf8_strpos($excerpt, $excerpt_more) !== false) { |
|
108 | + $excut = - (geodir_utf8_strlen($excerpt_more)); |
|
109 | + $subex = geodir_utf8_substr($excerpt, 0, $excut); |
|
110 | + if ($charlength > 0 && geodir_utf8_strlen($subex) > $charlength) { |
|
111 | + $subex = geodir_utf8_substr($subex, 0, $charlength); |
|
112 | 112 | } |
113 | 113 | $out .= $subex; |
114 | 114 | } else { |
115 | - $subex = geodir_utf8_substr( $excerpt, 0, $charlength - 5 ); |
|
116 | - $exwords = explode( ' ', $subex ); |
|
117 | - $excut = - ( geodir_utf8_strlen( $exwords[ count( $exwords ) - 1 ] ) ); |
|
118 | - if ( $excut < 0 ) { |
|
119 | - $out .= geodir_utf8_substr( $subex, 0, $excut ); |
|
115 | + $subex = geodir_utf8_substr($excerpt, 0, $charlength - 5); |
|
116 | + $exwords = explode(' ', $subex); |
|
117 | + $excut = - (geodir_utf8_strlen($exwords[count($exwords) - 1])); |
|
118 | + if ($excut < 0) { |
|
119 | + $out .= geodir_utf8_substr($subex, 0, $excut); |
|
120 | 120 | } else { |
121 | 121 | $out .= $subex; |
122 | 122 | } |
123 | 123 | } |
124 | - $out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">'; |
|
124 | + $out .= ' <a class="excerpt-read-more" href="'.get_permalink().'" title="'.get_the_title().'">'; |
|
125 | 125 | /** |
126 | 126 | * Filter excerpt read more text. |
127 | 127 | * |
128 | 128 | * @since 1.0.0 |
129 | 129 | */ |
130 | - $out .= apply_filters( 'geodir_max_excerpt_end', __( 'Read more [...]', 'geodirectory' ) ); |
|
130 | + $out .= apply_filters('geodir_max_excerpt_end', __('Read more [...]', 'geodirectory')); |
|
131 | 131 | $out .= '</a>'; |
132 | 132 | |
133 | 133 | } else { |
134 | - if ( geodir_utf8_strlen( $excerpt_more ) > 0 && geodir_utf8_strpos( $excerpt, $excerpt_more ) !== false ) { |
|
135 | - $excut = - ( geodir_utf8_strlen( $excerpt_more ) ); |
|
136 | - $out .= geodir_utf8_substr( $excerpt, 0, $excut ); |
|
137 | - $out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">'; |
|
134 | + if (geodir_utf8_strlen($excerpt_more) > 0 && geodir_utf8_strpos($excerpt, $excerpt_more) !== false) { |
|
135 | + $excut = - (geodir_utf8_strlen($excerpt_more)); |
|
136 | + $out .= geodir_utf8_substr($excerpt, 0, $excut); |
|
137 | + $out .= ' <a class="excerpt-read-more" href="'.get_permalink().'" title="'.get_the_title().'">'; |
|
138 | 138 | /** |
139 | 139 | * Filter excerpt read more text. |
140 | 140 | * |
141 | 141 | * @since 1.0.0 |
142 | 142 | */ |
143 | - $out .= apply_filters( 'geodir_max_excerpt_end', __( 'Read more [...]', 'geodirectory' ) ); |
|
143 | + $out .= apply_filters('geodir_max_excerpt_end', __('Read more [...]', 'geodirectory')); |
|
144 | 144 | $out .= '</a>'; |
145 | 145 | } else { |
146 | 146 | $out .= $excerpt; |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | * |
164 | 164 | * @return object Returns filtered package info as an object. |
165 | 165 | */ |
166 | -function geodir_post_package_info( $package_info, $post = '', $post_type = '' ) { |
|
166 | +function geodir_post_package_info($package_info, $post = '', $post_type = '') { |
|
167 | 167 | $package_info['pid'] = 0; |
168 | 168 | $package_info['days'] = 0; |
169 | 169 | $package_info['amount'] = 0; |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | * @param object|string $post The post object. |
193 | 193 | * @param string $post_type The post type. |
194 | 194 | */ |
195 | - return (object) apply_filters( 'geodir_post_package_info', $package_info, $post, $post_type ); |
|
195 | + return (object) apply_filters('geodir_post_package_info', $package_info, $post, $post_type); |
|
196 | 196 | |
197 | 197 | } |
198 | 198 | |
@@ -220,11 +220,11 @@ discard block |
||
220 | 220 | * |
221 | 221 | * } |
222 | 222 | */ |
223 | -function geodir_send_inquiry( $request ) { |
|
223 | +function geodir_send_inquiry($request) { |
|
224 | 224 | global $wpdb; |
225 | 225 | |
226 | 226 | // strip slashes from text |
227 | - $request = ! empty( $request ) ? stripslashes_deep( $request ) : $request; |
|
227 | + $request = !empty($request) ? stripslashes_deep($request) : $request; |
|
228 | 228 | |
229 | 229 | $yourname = sanitize_text_field($request['inq_name']); |
230 | 230 | $youremail = sanitize_email($request['inq_email']); |
@@ -232,25 +232,25 @@ discard block |
||
232 | 232 | $frnd_comments = sanitize_text_field($request['inq_msg']); |
233 | 233 | $pid = absint($request['pid']); |
234 | 234 | |
235 | - $author_id = ''; |
|
235 | + $author_id = ''; |
|
236 | 236 | |
237 | - if ( $pid && 'publish' == get_post_status ( $pid ) ) { |
|
237 | + if ($pid && 'publish' == get_post_status($pid)) { |
|
238 | 238 | |
239 | - check_ajax_referer( 'send_inquiry_'.$pid ); |
|
239 | + check_ajax_referer('send_inquiry_'.$pid); |
|
240 | 240 | |
241 | 241 | $p_post = get_post($pid); |
242 | 242 | |
243 | - $author_id = $p_post->post_author; |
|
243 | + $author_id = $p_post->post_author; |
|
244 | 244 | |
245 | - }else{ |
|
245 | + } else { |
|
246 | 246 | gd_die(); |
247 | 247 | } |
248 | 248 | |
249 | - $to_email = geodir_get_post_meta( $pid, 'geodir_email', true ); |
|
250 | - $to_name = geodir_get_client_name( $author_id ); |
|
249 | + $to_email = geodir_get_post_meta($pid, 'geodir_email', true); |
|
250 | + $to_name = geodir_get_client_name($author_id); |
|
251 | 251 | |
252 | - if ( $to_email == '' ) { |
|
253 | - $to_email = get_option( 'admin_email' ); |
|
252 | + if ($to_email == '') { |
|
253 | + $to_email = get_option('admin_email'); |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | /** |
@@ -271,10 +271,10 @@ discard block |
||
271 | 271 | * } |
272 | 272 | * @param string $type The form type, default: `Enquiry`. |
273 | 273 | */ |
274 | - do_action( 'geodir_after_send_enquiry', $request, 'Enquiry' ); |
|
274 | + do_action('geodir_after_send_enquiry', $request, 'Enquiry'); |
|
275 | 275 | |
276 | 276 | $client_message = $frnd_comments; |
277 | - $client_message .= '<br>' . __( 'From :', 'geodirectory' ) . ' ' . $yourname . '<br>' . __( 'Phone :', 'geodirectory' ) . ' ' . $inq_phone . '<br>' . __( 'Email :', 'geodirectory' ) . ' ' . $youremail . '<br><br>' . __( 'Sent from', 'geodirectory' ) . ' - <b><a href="' . trailingslashit( home_url() ) . '">' . get_option( 'blogname' ) . '</a></b>.'; |
|
277 | + $client_message .= '<br>'.__('From :', 'geodirectory').' '.$yourname.'<br>'.__('Phone :', 'geodirectory').' '.$inq_phone.'<br>'.__('Email :', 'geodirectory').' '.$youremail.'<br><br>'.__('Sent from', 'geodirectory').' - <b><a href="'.trailingslashit(home_url()).'">'.get_option('blogname').'</a></b>.'; |
|
278 | 278 | /** |
279 | 279 | * Filter client message text. |
280 | 280 | * |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | * |
283 | 283 | * @param string $client_message Client message text. |
284 | 284 | */ |
285 | - $client_message = apply_filters( 'geodir_inquiry_email_msg', $client_message ); |
|
285 | + $client_message = apply_filters('geodir_inquiry_email_msg', $client_message); |
|
286 | 286 | |
287 | 287 | /** |
288 | 288 | * Called before the send enquiry email is sent. |
@@ -301,12 +301,12 @@ discard block |
||
301 | 301 | * |
302 | 302 | * } |
303 | 303 | */ |
304 | - do_action( 'geodir_before_send_enquiry_email', $request ); |
|
305 | - if ( $to_email ) { |
|
304 | + do_action('geodir_before_send_enquiry_email', $request); |
|
305 | + if ($to_email) { |
|
306 | 306 | // strip slashes message |
307 | - $client_message = stripslashes_deep( $client_message ); |
|
307 | + $client_message = stripslashes_deep($client_message); |
|
308 | 308 | |
309 | - geodir_sendEmail( $youremail, $yourname, $to_email, $to_name, '', $client_message, $extra = '', 'send_enquiry', $request['pid'] );//To client email |
|
309 | + geodir_sendEmail($youremail, $yourname, $to_email, $to_name, '', $client_message, $extra = '', 'send_enquiry', $request['pid']); //To client email |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | /** |
@@ -326,12 +326,12 @@ discard block |
||
326 | 326 | * |
327 | 327 | * } |
328 | 328 | */ |
329 | - do_action( 'geodir_after_send_enquiry_email', $request ); |
|
330 | - $url = get_permalink( $pid ); |
|
331 | - if ( strstr( $url, '?' ) ) { |
|
332 | - $url = $url . "&send_inquiry=success"; |
|
329 | + do_action('geodir_after_send_enquiry_email', $request); |
|
330 | + $url = get_permalink($pid); |
|
331 | + if (strstr($url, '?')) { |
|
332 | + $url = $url."&send_inquiry=success"; |
|
333 | 333 | } else { |
334 | - $url = $url . "?send_inquiry=success"; |
|
334 | + $url = $url."?send_inquiry=success"; |
|
335 | 335 | } |
336 | 336 | /** |
337 | 337 | * Filter redirect url after the send enquiry email is sent. |
@@ -340,8 +340,8 @@ discard block |
||
340 | 340 | * |
341 | 341 | * @param string $url Redirect url. |
342 | 342 | */ |
343 | - $url = apply_filters( 'geodir_send_enquiry_after_submit_redirect', $url ); |
|
344 | - wp_redirect( $url ); |
|
343 | + $url = apply_filters('geodir_send_enquiry_after_submit_redirect', $url); |
|
344 | + wp_redirect($url); |
|
345 | 345 | gd_die(); |
346 | 346 | |
347 | 347 | } |
@@ -372,11 +372,11 @@ discard block |
||
372 | 372 | * |
373 | 373 | * @deprecated 1.6.26 |
374 | 374 | */ |
375 | -function geodir_send_friend( $request ) { |
|
375 | +function geodir_send_friend($request) { |
|
376 | 376 | global $wpdb; |
377 | 377 | |
378 | 378 | // strip slashes from text |
379 | - $request = ! empty( $request ) ? stripslashes_deep( $request ) : $request; |
|
379 | + $request = !empty($request) ? stripslashes_deep($request) : $request; |
|
380 | 380 | |
381 | 381 | $yourname = sanitize_text_field($request['yourname']); |
382 | 382 | $youremail = sanitize_email($request['youremail']); |
@@ -385,11 +385,11 @@ discard block |
||
385 | 385 | $pid = absint($request['pid']); |
386 | 386 | $to_email = sanitize_email($request['to_email']); |
387 | 387 | $to_name = sanitize_text_field($request['to_name']); |
388 | - if ( $pid && 'publish' == get_post_status ( $pid ) ) { |
|
388 | + if ($pid && 'publish' == get_post_status($pid)) { |
|
389 | 389 | |
390 | - check_ajax_referer( 'send_to_frnd_'.$pid ); |
|
390 | + check_ajax_referer('send_to_frnd_'.$pid); |
|
391 | 391 | |
392 | - }else{ |
|
392 | + } else { |
|
393 | 393 | gd_die(); |
394 | 394 | } |
395 | 395 | |
@@ -412,8 +412,8 @@ discard block |
||
412 | 412 | * |
413 | 413 | * } |
414 | 414 | */ |
415 | - do_action( 'geodir_before_send_to_friend_email', $request ); |
|
416 | - geodir_sendEmail( $youremail, $yourname, $to_email, $to_name, $frnd_subject, $frnd_comments, $extra = '', 'send_friend', $request['pid'] );//To client email |
|
415 | + do_action('geodir_before_send_to_friend_email', $request); |
|
416 | + geodir_sendEmail($youremail, $yourname, $to_email, $to_name, $frnd_subject, $frnd_comments, $extra = '', 'send_friend', $request['pid']); //To client email |
|
417 | 417 | |
418 | 418 | /** |
419 | 419 | * Called after the send to friend email is sent. |
@@ -434,13 +434,13 @@ discard block |
||
434 | 434 | * |
435 | 435 | * } |
436 | 436 | */ |
437 | - do_action( 'geodir_after_send_to_friend_email', $request ); |
|
437 | + do_action('geodir_after_send_to_friend_email', $request); |
|
438 | 438 | |
439 | - $url = get_permalink( $pid ); |
|
440 | - if ( strstr( $url, '?' ) ) { |
|
441 | - $url = $url . "&sendtofrnd=success"; |
|
439 | + $url = get_permalink($pid); |
|
440 | + if (strstr($url, '?')) { |
|
441 | + $url = $url."&sendtofrnd=success"; |
|
442 | 442 | } else { |
443 | - $url = $url . "?sendtofrnd=success"; |
|
443 | + $url = $url."?sendtofrnd=success"; |
|
444 | 444 | } |
445 | 445 | /** |
446 | 446 | * Filter redirect url after the send to friend email is sent. |
@@ -449,8 +449,8 @@ discard block |
||
449 | 449 | * |
450 | 450 | * @param string $url Redirect url. |
451 | 451 | */ |
452 | - $url = apply_filters( 'geodir_send_to_friend_after_submit_redirect', $url ); |
|
453 | - wp_redirect( $url ); |
|
452 | + $url = apply_filters('geodir_send_to_friend_after_submit_redirect', $url); |
|
453 | + wp_redirect($url); |
|
454 | 454 | gd_die(); |
455 | 455 | } |
456 | 456 | |
@@ -464,8 +464,8 @@ discard block |
||
464 | 464 | * |
465 | 465 | * @param string $hash_key |
466 | 466 | */ |
467 | -function geodir_before_tab_content( $hash_key ) { |
|
468 | - switch ( $hash_key ) { |
|
467 | +function geodir_before_tab_content($hash_key) { |
|
468 | + switch ($hash_key) { |
|
469 | 469 | case 'post_info' : |
470 | 470 | echo '<div class="geodir-company_info field-group">'; |
471 | 471 | break; |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | * |
476 | 476 | * @since 1.0.0 |
477 | 477 | */ |
478 | - echo ' <div id="' . apply_filters( 'geodir_post_gallery_id', 'geodir-post-gallery' ) . '" class="clearfix" >'; |
|
478 | + echo ' <div id="'.apply_filters('geodir_post_gallery_id', 'geodir-post-gallery').'" class="clearfix" >'; |
|
479 | 479 | break; |
480 | 480 | case 'reviews' : |
481 | 481 | echo '<div id="reviews-wrap" class="clearfix"> '; |
@@ -499,8 +499,8 @@ discard block |
||
499 | 499 | * |
500 | 500 | * @param string $hash_key |
501 | 501 | */ |
502 | -function geodir_after_tab_content( $hash_key ) { |
|
503 | - switch ( $hash_key ) { |
|
502 | +function geodir_after_tab_content($hash_key) { |
|
503 | + switch ($hash_key) { |
|
504 | 504 | case 'post_info' : |
505 | 505 | echo '</div>'; |
506 | 506 | break; |
@@ -531,25 +531,25 @@ discard block |
||
531 | 531 | * @global object $wpdb WordPress Database object. |
532 | 532 | * @return bool|null|string Returns default sort results, when the post type is valid. Otherwise returns false. |
533 | 533 | */ |
534 | -function geodir_get_posts_default_sort( $post_type ) { |
|
534 | +function geodir_get_posts_default_sort($post_type) { |
|
535 | 535 | |
536 | 536 | global $wpdb; |
537 | 537 | |
538 | - if ( $post_type != '' ) { |
|
538 | + if ($post_type != '') { |
|
539 | 539 | |
540 | 540 | $all_postypes = geodir_get_posttypes(); |
541 | 541 | |
542 | - if ( ! in_array( $post_type, $all_postypes ) ) { |
|
542 | + if (!in_array($post_type, $all_postypes)) { |
|
543 | 543 | return false; |
544 | 544 | } |
545 | 545 | |
546 | - $sort_field_info = $wpdb->get_var( $wpdb->prepare( "select default_order from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type= %s and is_active=%d and is_default=%d", array( |
|
546 | + $sort_field_info = $wpdb->get_var($wpdb->prepare("select default_order from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where post_type= %s and is_active=%d and is_default=%d", array( |
|
547 | 547 | $post_type, |
548 | 548 | 1, |
549 | 549 | 1 |
550 | - ) ) ); |
|
550 | + ))); |
|
551 | 551 | |
552 | - if ( ! empty( $sort_field_info ) ) { |
|
552 | + if (!empty($sort_field_info)) { |
|
553 | 553 | return $sort_field_info; |
554 | 554 | } |
555 | 555 | |
@@ -569,20 +569,20 @@ discard block |
||
569 | 569 | * @global object $wpdb WordPress Database object. |
570 | 570 | * @return bool|mixed|void Returns sort results, when the post type is valid. Otherwise returns false. |
571 | 571 | */ |
572 | -function geodir_get_sort_options( $post_type ) { |
|
572 | +function geodir_get_sort_options($post_type) { |
|
573 | 573 | global $wpdb; |
574 | 574 | |
575 | - if ( $post_type != '' ) { |
|
575 | + if ($post_type != '') { |
|
576 | 576 | $all_postypes = geodir_get_posttypes(); |
577 | 577 | |
578 | - if ( ! in_array( $post_type, $all_postypes ) ) { |
|
578 | + if (!in_array($post_type, $all_postypes)) { |
|
579 | 579 | return false; |
580 | 580 | } |
581 | 581 | |
582 | - $sort_field_info = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE post_type=%s AND is_active=%d AND (sort_asc=1 || sort_desc=1 || field_type='random') AND field_type != 'address' ORDER BY sort_order ASC", array( |
|
582 | + $sort_field_info = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE post_type=%s AND is_active=%d AND (sort_asc=1 || sort_desc=1 || field_type='random') AND field_type != 'address' ORDER BY sort_order ASC", array( |
|
583 | 583 | $post_type, |
584 | 584 | 1 |
585 | - ) ) ); |
|
585 | + ))); |
|
586 | 586 | |
587 | 587 | /** |
588 | 588 | * Filter post sort options. |
@@ -592,7 +592,7 @@ discard block |
||
592 | 592 | * @param array $sort_field_info Unfiltered sort field array. |
593 | 593 | * @param string $post_type Post type. |
594 | 594 | */ |
595 | - return apply_filters( 'geodir_get_sort_options', $sort_field_info, $post_type ); |
|
595 | + return apply_filters('geodir_get_sort_options', $sort_field_info, $post_type); |
|
596 | 596 | } |
597 | 597 | |
598 | 598 | } |
@@ -613,63 +613,63 @@ discard block |
||
613 | 613 | * |
614 | 614 | * @since 1.4.4 |
615 | 615 | */ |
616 | - if ( is_search() ) { |
|
616 | + if (is_search()) { |
|
617 | 617 | return; |
618 | 618 | } |
619 | 619 | |
620 | 620 | $sort_by = ''; |
621 | 621 | |
622 | - if ( isset( $_REQUEST['sort_by'] ) ) { |
|
622 | + if (isset($_REQUEST['sort_by'])) { |
|
623 | 623 | $sort_by = $_REQUEST['sort_by']; |
624 | 624 | } |
625 | 625 | |
626 | 626 | $gd_post_type = geodir_get_current_posttype(); |
627 | 627 | |
628 | - $sort_options = geodir_get_sort_options( $gd_post_type ); |
|
628 | + $sort_options = geodir_get_sort_options($gd_post_type); |
|
629 | 629 | |
630 | 630 | |
631 | 631 | $sort_field_options = ''; |
632 | 632 | |
633 | - if ( ! empty( $sort_options ) ) { |
|
634 | - foreach ( $sort_options as $sort ) { |
|
635 | - $sort = stripslashes_deep( $sort ); // strip slashes |
|
633 | + if (!empty($sort_options)) { |
|
634 | + foreach ($sort_options as $sort) { |
|
635 | + $sort = stripslashes_deep($sort); // strip slashes |
|
636 | 636 | |
637 | - $label = __( $sort->site_title, 'geodirectory' ); |
|
637 | + $label = __($sort->site_title, 'geodirectory'); |
|
638 | 638 | |
639 | - if ( $sort->field_type == 'random' ) { |
|
639 | + if ($sort->field_type == 'random') { |
|
640 | 640 | $key = $sort->field_type; |
641 | - ( $sort_by == $key || ( $sort->is_default == '1' && ! isset( $_REQUEST['sort_by'] ) ) ) ? $selected = 'selected="selected"' : $selected = ''; |
|
642 | - $sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg( 'sort_by', $key ) ) . '">' . __( $label, 'geodirectory' ) . '</option>'; |
|
641 | + ($sort_by == $key || ($sort->is_default == '1' && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = ''; |
|
642 | + $sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>'; |
|
643 | 643 | } |
644 | 644 | |
645 | - if ( $sort->htmlvar_name == 'comment_count' ) { |
|
645 | + if ($sort->htmlvar_name == 'comment_count') { |
|
646 | 646 | $sort->htmlvar_name = 'rating_count'; |
647 | 647 | } |
648 | 648 | |
649 | - if ( $sort->sort_asc ) { |
|
650 | - $key = $sort->htmlvar_name . '_asc'; |
|
649 | + if ($sort->sort_asc) { |
|
650 | + $key = $sort->htmlvar_name.'_asc'; |
|
651 | 651 | $label = $sort->site_title; |
652 | - if ( $sort->asc_title ) { |
|
652 | + if ($sort->asc_title) { |
|
653 | 653 | $label = $sort->asc_title; |
654 | 654 | } |
655 | - ( $sort_by == $key || ( $sort->is_default == '1' && $sort->default_order == $key && ! isset( $_REQUEST['sort_by'] ) ) ) ? $selected = 'selected="selected"' : $selected = ''; |
|
656 | - $sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg( 'sort_by', $key ) ) . '">' . __( $label, 'geodirectory' ) . '</option>'; |
|
655 | + ($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = ''; |
|
656 | + $sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>'; |
|
657 | 657 | } |
658 | 658 | |
659 | - if ( $sort->sort_desc ) { |
|
660 | - $key = $sort->htmlvar_name . '_desc'; |
|
659 | + if ($sort->sort_desc) { |
|
660 | + $key = $sort->htmlvar_name.'_desc'; |
|
661 | 661 | $label = $sort->site_title; |
662 | - if ( $sort->desc_title ) { |
|
662 | + if ($sort->desc_title) { |
|
663 | 663 | $label = $sort->desc_title; |
664 | 664 | } |
665 | - ( $sort_by == $key || ( $sort->is_default == '1' && $sort->default_order == $key && ! isset( $_REQUEST['sort_by'] ) ) ) ? $selected = 'selected="selected"' : $selected = ''; |
|
666 | - $sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg( 'sort_by', $key ) ) . '">' . __( $label, 'geodirectory' ) . '</option>'; |
|
665 | + ($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = ''; |
|
666 | + $sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>'; |
|
667 | 667 | } |
668 | 668 | |
669 | 669 | } |
670 | 670 | } |
671 | 671 | |
672 | - if ( $sort_field_options != '' ) { |
|
672 | + if ($sort_field_options != '') { |
|
673 | 673 | |
674 | 674 | ?> |
675 | 675 | |
@@ -678,9 +678,9 @@ discard block |
||
678 | 678 | <select name="sort_by" id="sort_by" onchange="javascript:window.location=this.value;"> |
679 | 679 | |
680 | 680 | <option |
681 | - value="<?php echo esc_url( add_query_arg( 'sort_by', '' ) ); ?>" <?php if ( $sort_by == '' ) { |
|
681 | + value="<?php echo esc_url(add_query_arg('sort_by', '')); ?>" <?php if ($sort_by == '') { |
|
682 | 682 | echo 'selected="selected"'; |
683 | - } ?>><?php _e( 'Sort By', 'geodirectory' ); ?></option><?php |
|
683 | + } ?>><?php _e('Sort By', 'geodirectory'); ?></option><?php |
|
684 | 684 | |
685 | 685 | echo $sort_field_options; ?> |
686 | 686 | |
@@ -708,9 +708,9 @@ discard block |
||
708 | 708 | * |
709 | 709 | * @return string Returns the section title. |
710 | 710 | */ |
711 | -function geodir_advance_customfields_heading( $title, $field_type ) { |
|
711 | +function geodir_advance_customfields_heading($title, $field_type) { |
|
712 | 712 | |
713 | - if ( in_array( $field_type, array( 'multiselect', 'textarea', 'taxonomy' ) ) ) { |
|
713 | + if (in_array($field_type, array('multiselect', 'textarea', 'taxonomy'))) { |
|
714 | 714 | $title = ''; |
715 | 715 | } |
716 | 716 | |
@@ -732,30 +732,30 @@ discard block |
||
732 | 732 | * @global object $gd_session GeoDirectory Session object. |
733 | 733 | * @return string Returns related posts html. |
734 | 734 | */ |
735 | -function geodir_related_posts_display( $request ) { |
|
736 | - if ( ! empty( $request ) ) { |
|
737 | - $before_title = ( isset( $request['before_title'] ) && ! empty( $request['before_title'] ) ) ? $request['before_title'] : ''; |
|
738 | - $after_title = ( isset( $request['after_title'] ) && ! empty( $request['after_title'] ) ) ? $request['after_title'] : ''; |
|
739 | - |
|
740 | - $title = ( isset( $request['title'] ) && ! empty( $request['title'] ) ) ? $request['title'] : __( 'Related Listings', 'geodirectory' ); |
|
741 | - $post_number = ( isset( $request['post_number'] ) && ! empty( $request['post_number'] ) ) ? $request['post_number'] : '5'; |
|
742 | - $relate_to = ( isset( $request['relate_to'] ) && ! empty( $request['relate_to'] ) ) ? $request['relate_to'] : 'category'; |
|
743 | - $layout = ( isset( $request['layout'] ) && ! empty( $request['layout'] ) ) ? $request['layout'] : 'gridview_onehalf'; |
|
744 | - $add_location_filter = ( isset( $request['add_location_filter'] ) && ! empty( $request['add_location_filter'] ) ) ? $request['add_location_filter'] : '0'; |
|
745 | - $listing_width = ( isset( $request['listing_width'] ) && ! empty( $request['listing_width'] ) ) ? $request['listing_width'] : ''; |
|
746 | - $list_sort = ( isset( $request['list_sort'] ) && ! empty( $request['list_sort'] ) ) ? $request['list_sort'] : 'latest'; |
|
747 | - $character_count = ( isset( $request['character_count'] ) && ! empty( $request['character_count'] ) ) ? $request['character_count'] : ''; |
|
735 | +function geodir_related_posts_display($request) { |
|
736 | + if (!empty($request)) { |
|
737 | + $before_title = (isset($request['before_title']) && !empty($request['before_title'])) ? $request['before_title'] : ''; |
|
738 | + $after_title = (isset($request['after_title']) && !empty($request['after_title'])) ? $request['after_title'] : ''; |
|
739 | + |
|
740 | + $title = (isset($request['title']) && !empty($request['title'])) ? $request['title'] : __('Related Listings', 'geodirectory'); |
|
741 | + $post_number = (isset($request['post_number']) && !empty($request['post_number'])) ? $request['post_number'] : '5'; |
|
742 | + $relate_to = (isset($request['relate_to']) && !empty($request['relate_to'])) ? $request['relate_to'] : 'category'; |
|
743 | + $layout = (isset($request['layout']) && !empty($request['layout'])) ? $request['layout'] : 'gridview_onehalf'; |
|
744 | + $add_location_filter = (isset($request['add_location_filter']) && !empty($request['add_location_filter'])) ? $request['add_location_filter'] : '0'; |
|
745 | + $listing_width = (isset($request['listing_width']) && !empty($request['listing_width'])) ? $request['listing_width'] : ''; |
|
746 | + $list_sort = (isset($request['list_sort']) && !empty($request['list_sort'])) ? $request['list_sort'] : 'latest'; |
|
747 | + $character_count = (isset($request['character_count']) && !empty($request['character_count'])) ? $request['character_count'] : ''; |
|
748 | 748 | |
749 | 749 | global $wpdb, $post, $gd_session, $related_nearest, $related_parent_lat, $related_parent_lon; |
750 | - $related_parent_lat = !empty($post->post_latitude) && geodir_is_page( 'detail' ) ? $post->post_latitude : ''; |
|
751 | - $related_parent_lon = !empty($post->post_longitude) && geodir_is_page( 'detail' ) ? $post->post_longitude : ''; |
|
750 | + $related_parent_lat = !empty($post->post_latitude) && geodir_is_page('detail') ? $post->post_latitude : ''; |
|
751 | + $related_parent_lon = !empty($post->post_longitude) && geodir_is_page('detail') ? $post->post_longitude : ''; |
|
752 | 752 | $arr_detail_page_tabs = geodir_detail_page_tabs_list(); |
753 | 753 | |
754 | 754 | $related_listing_array = array(); |
755 | - if ( get_option( 'geodir_add_related_listing_posttypes' ) ) { |
|
756 | - $related_listing_array = get_option( 'geodir_add_related_listing_posttypes' ); |
|
755 | + if (get_option('geodir_add_related_listing_posttypes')) { |
|
756 | + $related_listing_array = get_option('geodir_add_related_listing_posttypes'); |
|
757 | 757 | } |
758 | - if ( isset($post->post_type) && in_array( $post->post_type, $related_listing_array ) ) { |
|
758 | + if (isset($post->post_type) && in_array($post->post_type, $related_listing_array)) { |
|
759 | 759 | $arr_detail_page_tabs['related_listing']['is_display'] = true; |
760 | 760 | } |
761 | 761 | |
@@ -767,90 +767,90 @@ discard block |
||
767 | 767 | $tax_field = 'id'; |
768 | 768 | $category = array(); |
769 | 769 | |
770 | - if ( isset( $_REQUEST['backandedit'] ) ) { |
|
771 | - $post = (object) $gd_session->get( 'listing' ); |
|
770 | + if (isset($_REQUEST['backandedit'])) { |
|
771 | + $post = (object) $gd_session->get('listing'); |
|
772 | 772 | $post_type = $post->listing_type; |
773 | - if ( isset( $_REQUEST['pid'] ) && $_REQUEST['pid'] != '' ) { |
|
773 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
|
774 | 774 | $post_id = $_REQUEST['pid']; |
775 | 775 | } |
776 | - } elseif ( isset( $_REQUEST['pid'] ) && $_REQUEST['pid'] != '' ) { |
|
777 | - $post = geodir_get_post_info( $_REQUEST['pid'] ); |
|
776 | + } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
|
777 | + $post = geodir_get_post_info($_REQUEST['pid']); |
|
778 | 778 | $post_type = $post->post_type; |
779 | 779 | $post_id = $_REQUEST['pid']; |
780 | - } elseif ( isset( $post->post_type ) && $post->post_type != '' ) { |
|
780 | + } elseif (isset($post->post_type) && $post->post_type != '') { |
|
781 | 781 | $post_type = $post->post_type; |
782 | 782 | $post_id = $post->ID; |
783 | 783 | } |
784 | 784 | |
785 | - if ( $relate_to == 'category' ) { |
|
785 | + if ($relate_to == 'category') { |
|
786 | 786 | |
787 | - $category_taxonomy = $post_type . $relate_to; |
|
788 | - if ( isset( $post->{$category_taxonomy} ) && $post->{$category_taxonomy} != '' ) { |
|
789 | - $category = explode( ',', trim( $post->{$category_taxonomy}, ',' ) ); |
|
787 | + $category_taxonomy = $post_type.$relate_to; |
|
788 | + if (isset($post->{$category_taxonomy} ) && $post->{$category_taxonomy} != '') { |
|
789 | + $category = explode(',', trim($post->{$category_taxonomy}, ',')); |
|
790 | 790 | } |
791 | 791 | |
792 | - } elseif ( $relate_to == 'tags' ) { |
|
792 | + } elseif ($relate_to == 'tags') { |
|
793 | 793 | |
794 | - $category_taxonomy = $post_type . '_' . $relate_to; |
|
795 | - if ( $post->post_tags != '' ) { |
|
796 | - $category = explode( ',', trim( $post->post_tags, ',' ) ); |
|
794 | + $category_taxonomy = $post_type.'_'.$relate_to; |
|
795 | + if ($post->post_tags != '') { |
|
796 | + $category = explode(',', trim($post->post_tags, ',')); |
|
797 | 797 | } |
798 | 798 | $tax_field = 'name'; |
799 | 799 | } |
800 | 800 | |
801 | 801 | /* --- return false in invalid request --- */ |
802 | - if ( empty( $category ) ) { |
|
802 | + if (empty($category)) { |
|
803 | 803 | return false; |
804 | 804 | } |
805 | 805 | |
806 | 806 | $all_postypes = geodir_get_posttypes(); |
807 | 807 | |
808 | - if ( ! in_array( $post_type, $all_postypes ) ) { |
|
808 | + if (!in_array($post_type, $all_postypes)) { |
|
809 | 809 | return false; |
810 | 810 | } |
811 | 811 | |
812 | 812 | /* --- return false in invalid request --- */ |
813 | 813 | |
814 | 814 | $location_url = ''; |
815 | - if ( $add_location_filter != '0' ) { |
|
815 | + if ($add_location_filter != '0') { |
|
816 | 816 | $location_url = array(); |
817 | - $geodir_show_location_url = get_option( 'geodir_show_location_url' ); |
|
817 | + $geodir_show_location_url = get_option('geodir_show_location_url'); |
|
818 | 818 | |
819 | - $gd_city = get_query_var( 'gd_city' ); |
|
819 | + $gd_city = get_query_var('gd_city'); |
|
820 | 820 | |
821 | - if ( $gd_city ) { |
|
822 | - $gd_country = get_query_var( 'gd_country' ); |
|
823 | - $gd_region = get_query_var( 'gd_region' ); |
|
821 | + if ($gd_city) { |
|
822 | + $gd_country = get_query_var('gd_country'); |
|
823 | + $gd_region = get_query_var('gd_region'); |
|
824 | 824 | } else { |
825 | 825 | $location = geodir_get_default_location(); |
826 | 826 | |
827 | - $gd_country = isset( $location->country_slug ) ? $location->country_slug : ''; |
|
828 | - $gd_region = isset( $location->region_slug ) ? $location->region_slug : ''; |
|
829 | - $gd_city = isset( $location->city_slug ) ? $location->city_slug : ''; |
|
827 | + $gd_country = isset($location->country_slug) ? $location->country_slug : ''; |
|
828 | + $gd_region = isset($location->region_slug) ? $location->region_slug : ''; |
|
829 | + $gd_city = isset($location->city_slug) ? $location->city_slug : ''; |
|
830 | 830 | } |
831 | 831 | |
832 | - if ( $geodir_show_location_url == 'all' ) { |
|
832 | + if ($geodir_show_location_url == 'all') { |
|
833 | 833 | $location_url[] = $gd_country; |
834 | 834 | $location_url[] = $gd_region; |
835 | - } else if ( $geodir_show_location_url == 'country_city' ) { |
|
835 | + } else if ($geodir_show_location_url == 'country_city') { |
|
836 | 836 | $location_url[] = $gd_country; |
837 | - } else if ( $geodir_show_location_url == 'region_city' ) { |
|
837 | + } else if ($geodir_show_location_url == 'region_city') { |
|
838 | 838 | $location_url[] = $gd_region; |
839 | 839 | } |
840 | 840 | |
841 | 841 | $location_url[] = $gd_city; |
842 | 842 | |
843 | - $location_url = implode( '/', $location_url ); |
|
843 | + $location_url = implode('/', $location_url); |
|
844 | 844 | } |
845 | 845 | |
846 | 846 | |
847 | - if ( ! empty( $category ) ) { |
|
847 | + if (!empty($category)) { |
|
848 | 848 | global $geodir_add_location_url; |
849 | 849 | $geodir_add_location_url = '0'; |
850 | - if ( $add_location_filter != '0' ) { |
|
850 | + if ($add_location_filter != '0') { |
|
851 | 851 | $geodir_add_location_url = '1'; |
852 | 852 | } |
853 | - $viewall_url = get_term_link( (int) $category[0], $post_type . $category_taxonomy ); |
|
853 | + $viewall_url = get_term_link((int) $category[0], $post_type.$category_taxonomy); |
|
854 | 854 | $geodir_add_location_url = null; |
855 | 855 | } |
856 | 856 | ob_start(); |
@@ -860,24 +860,24 @@ discard block |
||
860 | 860 | <div class="geodir_locations geodir_location_listing"> |
861 | 861 | |
862 | 862 | <?php |
863 | - if ( isset( $request['is_widget'] ) && $request['is_widget'] == '1' ) { |
|
863 | + if (isset($request['is_widget']) && $request['is_widget'] == '1') { |
|
864 | 864 | /** geodir_before_title filter Documented in geodirectory_widgets.php */ |
865 | - $before_title = isset( $before_title ) ? $before_title : apply_filters( 'geodir_before_title', '<h3 class="widget-title">' ); |
|
865 | + $before_title = isset($before_title) ? $before_title : apply_filters('geodir_before_title', '<h3 class="widget-title">'); |
|
866 | 866 | /** geodir_after_title filter Documented in geodirectory_widgets.php */ |
867 | - $after_title = isset( $after_title ) ? $after_title : apply_filters( 'geodir_after_title', '</h3>' ); |
|
867 | + $after_title = isset($after_title) ? $after_title : apply_filters('geodir_after_title', '</h3>'); |
|
868 | 868 | ?> |
869 | 869 | <div class="location_list_heading clearfix"> |
870 | - <?php echo $before_title . $title . $after_title; ?> |
|
870 | + <?php echo $before_title.$title.$after_title; ?> |
|
871 | 871 | </div> |
872 | 872 | <?php |
873 | 873 | } |
874 | 874 | $query_args = array( |
875 | 875 | 'posts_per_page' => $post_number, |
876 | 876 | 'is_geodir_loop' => true, |
877 | - 'gd_location' => ( $add_location_filter ) ? true : false, |
|
877 | + 'gd_location' => ($add_location_filter) ? true : false, |
|
878 | 878 | 'post_type' => $post_type, |
879 | 879 | 'order_by' => $list_sort, |
880 | - 'post__not_in' => array( $post_id ), |
|
880 | + 'post__not_in' => array($post_id), |
|
881 | 881 | 'excerpt_length' => $character_count, |
882 | 882 | 'related_listings' => $is_display |
883 | 883 | ); |
@@ -888,7 +888,7 @@ discard block |
||
888 | 888 | 'terms' => $category |
889 | 889 | ); |
890 | 890 | |
891 | - $query_args['tax_query'] = array( $tax_query ); |
|
891 | + $query_args['tax_query'] = array($tax_query); |
|
892 | 892 | |
893 | 893 | global $gridview_columns_widget, $post; |
894 | 894 | |
@@ -900,21 +900,21 @@ discard block |
||
900 | 900 | * @param array $query_args The query array. |
901 | 901 | * @param array $request Related posts request array. |
902 | 902 | */ |
903 | - $query_args = apply_filters( 'geodir_related_posts_widget_query_args', $query_args, $request ); |
|
903 | + $query_args = apply_filters('geodir_related_posts_widget_query_args', $query_args, $request); |
|
904 | 904 | |
905 | - query_posts( $query_args ); |
|
905 | + query_posts($query_args); |
|
906 | 906 | |
907 | - if ( strstr( $layout, 'gridview' ) ) { |
|
908 | - $listing_view_exp = explode( '_', $layout ); |
|
907 | + if (strstr($layout, 'gridview')) { |
|
908 | + $listing_view_exp = explode('_', $layout); |
|
909 | 909 | $gridview_columns_widget = $layout; |
910 | 910 | $layout = $listing_view_exp[0]; |
911 | - } else if ( $layout == 'list' ) { |
|
911 | + } else if ($layout == 'list') { |
|
912 | 912 | $gridview_columns_widget = ''; |
913 | 913 | } |
914 | 914 | $related_posts = true; |
915 | 915 | |
916 | 916 | $related_nearest = false; |
917 | - if ( $list_sort == 'nearest' ) { |
|
917 | + if ($list_sort == 'nearest') { |
|
918 | 918 | $related_nearest = true; |
919 | 919 | } |
920 | 920 | |
@@ -931,14 +931,14 @@ discard block |
||
931 | 931 | * |
932 | 932 | * @since 1.0.0 |
933 | 933 | */ |
934 | - $template = apply_filters( "geodir_template_part-related-listing-listview", geodir_locate_template( 'widget-listing-listview' ) ); |
|
934 | + $template = apply_filters("geodir_template_part-related-listing-listview", geodir_locate_template('widget-listing-listview')); |
|
935 | 935 | |
936 | 936 | /** |
937 | 937 | * Includes related listing listview template. |
938 | 938 | * |
939 | 939 | * @since 1.0.0 |
940 | 940 | */ |
941 | - include( $template ); |
|
941 | + include($template); |
|
942 | 942 | |
943 | 943 | wp_reset_query(); |
944 | 944 | $post = $origi_post; |
@@ -966,12 +966,12 @@ discard block |
||
966 | 966 | function geodir_category_count_script() { |
967 | 967 | global $geodir_post_category_str; |
968 | 968 | |
969 | - if ( ! empty( $geodir_post_category_str ) ) { |
|
970 | - $geodir_post_category_str = serialize( $geodir_post_category_str ); |
|
969 | + if (!empty($geodir_post_category_str)) { |
|
970 | + $geodir_post_category_str = serialize($geodir_post_category_str); |
|
971 | 971 | } |
972 | 972 | |
973 | - $all_var['post_category_array'] = html_entity_decode( (string) $geodir_post_category_str, ENT_QUOTES, 'UTF-8' ); |
|
974 | - $script = "var post_category_array = " . json_encode( $all_var ) . ';'; |
|
973 | + $all_var['post_category_array'] = html_entity_decode((string) $geodir_post_category_str, ENT_QUOTES, 'UTF-8'); |
|
974 | + $script = "var post_category_array = ".json_encode($all_var).';'; |
|
975 | 975 | echo '<script>'; |
976 | 976 | echo $script; |
977 | 977 | echo '</script>'; |
@@ -986,8 +986,8 @@ discard block |
||
986 | 986 | * @return string Returns the default language. |
987 | 987 | */ |
988 | 988 | function geodir_get_map_default_language() { |
989 | - $geodir_default_map_language = get_option( 'geodir_default_map_language' ); |
|
990 | - if ( empty( $geodir_default_map_language ) ) { |
|
989 | + $geodir_default_map_language = get_option('geodir_default_map_language'); |
|
990 | + if (empty($geodir_default_map_language)) { |
|
991 | 991 | $geodir_default_map_language = 'en'; |
992 | 992 | } |
993 | 993 | |
@@ -998,7 +998,7 @@ discard block |
||
998 | 998 | * |
999 | 999 | * @param string $geodir_default_map_language Default map language. |
1000 | 1000 | */ |
1001 | - return apply_filters( 'geodir_default_map_language', $geodir_default_map_language ); |
|
1001 | + return apply_filters('geodir_default_map_language', $geodir_default_map_language); |
|
1002 | 1002 | } |
1003 | 1003 | |
1004 | 1004 | /** |
@@ -1009,7 +1009,7 @@ discard block |
||
1009 | 1009 | * @return string Returns the api key. |
1010 | 1010 | */ |
1011 | 1011 | function geodir_get_map_api_key() { |
1012 | - $key = get_option( 'geodir_google_api_key' ); |
|
1012 | + $key = get_option('geodir_google_api_key'); |
|
1013 | 1013 | |
1014 | 1014 | /** |
1015 | 1015 | * Filter Google maps api key. |
@@ -1018,7 +1018,7 @@ discard block |
||
1018 | 1018 | * |
1019 | 1019 | * @param string $key Google maps api key. |
1020 | 1020 | */ |
1021 | - return apply_filters( 'geodir_google_api_key', $key ); |
|
1021 | + return apply_filters('geodir_google_api_key', $key); |
|
1022 | 1022 | } |
1023 | 1023 | |
1024 | 1024 | |
@@ -1038,20 +1038,20 @@ discard block |
||
1038 | 1038 | global $wp, $post, $wp_query, $wpdb, $geodir_addon_list; |
1039 | 1039 | |
1040 | 1040 | $is_geodir_page = geodir_is_geodir_page(); |
1041 | - if ( ! $is_geodir_page ) { |
|
1041 | + if (!$is_geodir_page) { |
|
1042 | 1042 | return; |
1043 | 1043 | }// if non GD page, bail |
1044 | 1044 | |
1045 | 1045 | $use_gd_meta = true; |
1046 | - if ( ( class_exists( 'WPSEO_Frontend' ) || class_exists( 'All_in_One_SEO_Pack' ) ) && !geodir_disable_yoast_seo_metas() ) { |
|
1046 | + if ((class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) && !geodir_disable_yoast_seo_metas()) { |
|
1047 | 1047 | $use_gd_meta = false; |
1048 | 1048 | |
1049 | - if ( geodir_is_page( 'search' ) ) { |
|
1049 | + if (geodir_is_page('search')) { |
|
1050 | 1050 | $use_gd_meta = true; |
1051 | 1051 | } |
1052 | 1052 | } |
1053 | 1053 | |
1054 | - if ( ! $use_gd_meta ) { |
|
1054 | + if (!$use_gd_meta) { |
|
1055 | 1055 | return; |
1056 | 1056 | }// bail if Yoast Wordpress SEO or All_in_One_SEO_Pack active. |
1057 | 1057 | |
@@ -1059,68 +1059,68 @@ discard block |
||
1059 | 1059 | |
1060 | 1060 | $all_postypes = geodir_get_posttypes(); |
1061 | 1061 | |
1062 | - $geodir_taxonomies = geodir_get_taxonomies( '', true ); |
|
1062 | + $geodir_taxonomies = geodir_get_taxonomies('', true); |
|
1063 | 1063 | |
1064 | 1064 | $meta_desc = ''; |
1065 | 1065 | $meta_key = ''; |
1066 | - if ( isset( $current_term->ID ) && $current_term->ID == geodir_location_page_id() ) { |
|
1066 | + if (isset($current_term->ID) && $current_term->ID == geodir_location_page_id()) { |
|
1067 | 1067 | /** |
1068 | 1068 | * Filter SEO meta location description. |
1069 | 1069 | * |
1070 | 1070 | * @since 1.0.0 |
1071 | 1071 | */ |
1072 | - $meta_desc = apply_filters( 'geodir_seo_meta_location_description', '' ); |
|
1072 | + $meta_desc = apply_filters('geodir_seo_meta_location_description', ''); |
|
1073 | 1073 | $meta_desc .= ''; |
1074 | 1074 | } |
1075 | - if ( have_posts() && is_single() OR is_page() ) { |
|
1076 | - while ( have_posts() ) { |
|
1075 | + if (have_posts() && is_single() OR is_page()) { |
|
1076 | + while (have_posts()) { |
|
1077 | 1077 | the_post(); |
1078 | 1078 | |
1079 | - if ( has_excerpt() ) { |
|
1080 | - $out_excerpt = strip_tags( strip_shortcodes( get_the_excerpt() ) ); |
|
1081 | - if ( empty( $out_excerpt ) ) { |
|
1082 | - $out_excerpt = strip_tags( do_shortcode( get_the_excerpt() ) ); |
|
1079 | + if (has_excerpt()) { |
|
1080 | + $out_excerpt = strip_tags(strip_shortcodes(get_the_excerpt())); |
|
1081 | + if (empty($out_excerpt)) { |
|
1082 | + $out_excerpt = strip_tags(do_shortcode(get_the_excerpt())); |
|
1083 | 1083 | } |
1084 | - $out_excerpt = str_replace( array( "\r\n", "\r", "\n" ), "", $out_excerpt ); |
|
1084 | + $out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $out_excerpt); |
|
1085 | 1085 | } else { |
1086 | - $out_excerpt = str_replace( array( "\r\n", "\r", "\n" ), "", $post->post_content ); |
|
1087 | - $out_excerpt = strip_tags( strip_shortcodes( $out_excerpt ) ); |
|
1088 | - if ( empty( $out_excerpt ) ) { |
|
1089 | - $out_excerpt = strip_tags( do_shortcode( $out_excerpt ) ); // parse short code from content |
|
1086 | + $out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $post->post_content); |
|
1087 | + $out_excerpt = strip_tags(strip_shortcodes($out_excerpt)); |
|
1088 | + if (empty($out_excerpt)) { |
|
1089 | + $out_excerpt = strip_tags(do_shortcode($out_excerpt)); // parse short code from content |
|
1090 | 1090 | } |
1091 | - $out_excerpt = trim( wp_trim_words( $out_excerpt, 35, '' ), '.!?,;:-' ); |
|
1091 | + $out_excerpt = trim(wp_trim_words($out_excerpt, 35, ''), '.!?,;:-'); |
|
1092 | 1092 | } |
1093 | 1093 | |
1094 | 1094 | $meta_desc .= $out_excerpt; |
1095 | 1095 | } |
1096 | - } elseif ( ( is_category() || is_tag() ) && isset( $current_term->taxonomy ) && in_array( $current_term->taxonomy, $geodir_taxonomies ) ) { |
|
1097 | - if ( is_category() ) { |
|
1098 | - $meta_desc .= __( "Posts related to Category:", 'geodirectory' ) . " " . geodir_utf8_ucfirst( single_cat_title( "", false ) ); |
|
1099 | - } elseif ( is_tag() ) { |
|
1100 | - $meta_desc .= __( "Posts related to Tag:", 'geodirectory' ) . " " . geodir_utf8_ucfirst( single_tag_title( "", false ) ); |
|
1096 | + } elseif ((is_category() || is_tag()) && isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) { |
|
1097 | + if (is_category()) { |
|
1098 | + $meta_desc .= __("Posts related to Category:", 'geodirectory')." ".geodir_utf8_ucfirst(single_cat_title("", false)); |
|
1099 | + } elseif (is_tag()) { |
|
1100 | + $meta_desc .= __("Posts related to Tag:", 'geodirectory')." ".geodir_utf8_ucfirst(single_tag_title("", false)); |
|
1101 | 1101 | } |
1102 | - } elseif ( isset( $current_term->taxonomy ) && in_array( $current_term->taxonomy, $geodir_taxonomies ) ) { |
|
1103 | - $meta_desc .= isset( $current_term->description ) ? $current_term->description : ''; |
|
1102 | + } elseif (isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) { |
|
1103 | + $meta_desc .= isset($current_term->description) ? $current_term->description : ''; |
|
1104 | 1104 | } |
1105 | 1105 | |
1106 | 1106 | |
1107 | 1107 | $geodir_post_type = geodir_get_current_posttype(); |
1108 | - $geodir_post_type_info = get_post_type_object( $geodir_post_type ); |
|
1109 | - $geodir_is_page_listing = geodir_is_page( 'listing' ) ? true : false; |
|
1110 | - |
|
1111 | - $category_taxonomy = geodir_get_taxonomies( $geodir_post_type ); |
|
1112 | - $tag_taxonomy = geodir_get_taxonomies( $geodir_post_type, true ); |
|
1113 | - |
|
1114 | - $geodir_is_category = isset( $category_taxonomy[0] ) && get_query_var( $category_taxonomy[0] ) ? get_query_var( $category_taxonomy[0] ) : false; |
|
1115 | - $geodir_is_tag = isset( $tag_taxonomy[0] ) && get_query_var( $tag_taxonomy[0] ) ? true : false; |
|
1116 | - |
|
1117 | - $geodir_is_search = geodir_is_page( 'search' ) ? true : false; |
|
1118 | - $geodir_is_location = geodir_is_page( 'location' ) ? true : false; |
|
1119 | - $geodir_location_manager = isset( $geodir_addon_list['geodir_location_manager'] ) && $geodir_addon_list['geodir_location_manager'] = 'yes' ? true : false; |
|
1120 | - $godir_location_terms = geodir_get_current_location_terms( 'query_vars' ); |
|
1121 | - $gd_city = $geodir_location_manager && isset( $godir_location_terms['gd_city'] ) ? $godir_location_terms['gd_city'] : null; |
|
1122 | - $gd_region = $geodir_location_manager && isset( $godir_location_terms['gd_region'] ) ? $godir_location_terms['gd_region'] : null; |
|
1123 | - $gd_country = $geodir_location_manager && isset( $godir_location_terms['gd_country'] ) ? $godir_location_terms['gd_country'] : null; |
|
1108 | + $geodir_post_type_info = get_post_type_object($geodir_post_type); |
|
1109 | + $geodir_is_page_listing = geodir_is_page('listing') ? true : false; |
|
1110 | + |
|
1111 | + $category_taxonomy = geodir_get_taxonomies($geodir_post_type); |
|
1112 | + $tag_taxonomy = geodir_get_taxonomies($geodir_post_type, true); |
|
1113 | + |
|
1114 | + $geodir_is_category = isset($category_taxonomy[0]) && get_query_var($category_taxonomy[0]) ? get_query_var($category_taxonomy[0]) : false; |
|
1115 | + $geodir_is_tag = isset($tag_taxonomy[0]) && get_query_var($tag_taxonomy[0]) ? true : false; |
|
1116 | + |
|
1117 | + $geodir_is_search = geodir_is_page('search') ? true : false; |
|
1118 | + $geodir_is_location = geodir_is_page('location') ? true : false; |
|
1119 | + $geodir_location_manager = isset($geodir_addon_list['geodir_location_manager']) && $geodir_addon_list['geodir_location_manager'] = 'yes' ? true : false; |
|
1120 | + $godir_location_terms = geodir_get_current_location_terms('query_vars'); |
|
1121 | + $gd_city = $geodir_location_manager && isset($godir_location_terms['gd_city']) ? $godir_location_terms['gd_city'] : null; |
|
1122 | + $gd_region = $geodir_location_manager && isset($godir_location_terms['gd_region']) ? $godir_location_terms['gd_region'] : null; |
|
1123 | + $gd_country = $geodir_location_manager && isset($godir_location_terms['gd_country']) ? $godir_location_terms['gd_country'] : null; |
|
1124 | 1124 | /** |
1125 | 1125 | * Filter the Everywhere text in location description. |
1126 | 1126 | * |
@@ -1128,108 +1128,108 @@ discard block |
||
1128 | 1128 | * |
1129 | 1129 | * @param string $replace_location Everywhere text. |
1130 | 1130 | */ |
1131 | - $replace_location = apply_filters( 'geodir_location_description_everywhere_text', __( 'Everywhere', 'geodirectory' ) ); |
|
1131 | + $replace_location = apply_filters('geodir_location_description_everywhere_text', __('Everywhere', 'geodirectory')); |
|
1132 | 1132 | $location_id = null; |
1133 | - if ( $geodir_location_manager ) { |
|
1134 | - $sql = $wpdb->prepare( "SELECT location_id FROM " . POST_LOCATION_TABLE . " WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array( $gd_city ) ); |
|
1135 | - $location_id = (int) $wpdb->get_var( $sql ); |
|
1133 | + if ($geodir_location_manager) { |
|
1134 | + $sql = $wpdb->prepare("SELECT location_id FROM ".POST_LOCATION_TABLE." WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array($gd_city)); |
|
1135 | + $location_id = (int) $wpdb->get_var($sql); |
|
1136 | 1136 | $location_type = geodir_what_is_current_location(); |
1137 | - if ( $location_type == 'city' ) { |
|
1138 | - $replace_location = geodir_get_current_location( array( 'what' => 'city', 'echo' => false ) ); |
|
1139 | - } elseif ( $location_type == 'region' ) { |
|
1140 | - $replace_location = geodir_get_current_location( array( 'what' => 'region', 'echo' => false ) ); |
|
1141 | - } elseif ( $location_type == 'country' ) { |
|
1142 | - $replace_location = geodir_get_current_location( array( 'what' => 'country', 'echo' => false ) ); |
|
1143 | - $replace_location = __( $replace_location, 'geodirectory' ); |
|
1144 | - } |
|
1145 | - $country = get_query_var( 'gd_country' ); |
|
1146 | - $region = get_query_var( 'gd_region' ); |
|
1147 | - $city = get_query_var( 'gd_city' ); |
|
1137 | + if ($location_type == 'city') { |
|
1138 | + $replace_location = geodir_get_current_location(array('what' => 'city', 'echo' => false)); |
|
1139 | + } elseif ($location_type == 'region') { |
|
1140 | + $replace_location = geodir_get_current_location(array('what' => 'region', 'echo' => false)); |
|
1141 | + } elseif ($location_type == 'country') { |
|
1142 | + $replace_location = geodir_get_current_location(array('what' => 'country', 'echo' => false)); |
|
1143 | + $replace_location = __($replace_location, 'geodirectory'); |
|
1144 | + } |
|
1145 | + $country = get_query_var('gd_country'); |
|
1146 | + $region = get_query_var('gd_region'); |
|
1147 | + $city = get_query_var('gd_city'); |
|
1148 | 1148 | $current_location = ''; |
1149 | - if ( $country != '' ) { |
|
1150 | - $current_location = get_actual_location_name( 'country', $country, true ); |
|
1149 | + if ($country != '') { |
|
1150 | + $current_location = get_actual_location_name('country', $country, true); |
|
1151 | 1151 | } |
1152 | - if ( $region != '' ) { |
|
1153 | - $current_location = get_actual_location_name( 'region', $region ); |
|
1152 | + if ($region != '') { |
|
1153 | + $current_location = get_actual_location_name('region', $region); |
|
1154 | 1154 | } |
1155 | - if ( $city != '' ) { |
|
1156 | - $current_location = get_actual_location_name( 'city', $city ); |
|
1155 | + if ($city != '') { |
|
1156 | + $current_location = get_actual_location_name('city', $city); |
|
1157 | 1157 | } |
1158 | 1158 | $replace_location = $current_location != '' ? $current_location : $replace_location; |
1159 | 1159 | } |
1160 | 1160 | |
1161 | 1161 | $geodir_meta_keys = ''; |
1162 | 1162 | $geodir_meta_desc = ''; |
1163 | - if ( $is_geodir_page && ! empty( $geodir_post_type_info ) ) { |
|
1164 | - if ( $geodir_is_page_listing || $geodir_is_search || geodir_is_page( 'add-listing' ) ) { |
|
1165 | - $geodir_meta_keys = isset( $geodir_post_type_info->seo['meta_keyword'] ) && $geodir_post_type_info->seo['meta_keyword'] != '' ? $geodir_post_type_info->seo['meta_keyword'] : $geodir_meta_keys; |
|
1163 | + if ($is_geodir_page && !empty($geodir_post_type_info)) { |
|
1164 | + if ($geodir_is_page_listing || $geodir_is_search || geodir_is_page('add-listing')) { |
|
1165 | + $geodir_meta_keys = isset($geodir_post_type_info->seo['meta_keyword']) && $geodir_post_type_info->seo['meta_keyword'] != '' ? $geodir_post_type_info->seo['meta_keyword'] : $geodir_meta_keys; |
|
1166 | 1166 | |
1167 | - $geodir_meta_desc = isset( $geodir_post_type_info->description ) ? $geodir_post_type_info->description : $geodir_meta_desc; |
|
1168 | - $geodir_meta_desc = isset( $geodir_post_type_info->seo['meta_description'] ) && $geodir_post_type_info->seo['meta_description'] != '' ? $geodir_post_type_info->seo['meta_description'] : $geodir_meta_desc; |
|
1167 | + $geodir_meta_desc = isset($geodir_post_type_info->description) ? $geodir_post_type_info->description : $geodir_meta_desc; |
|
1168 | + $geodir_meta_desc = isset($geodir_post_type_info->seo['meta_description']) && $geodir_post_type_info->seo['meta_description'] != '' ? $geodir_post_type_info->seo['meta_description'] : $geodir_meta_desc; |
|
1169 | 1169 | |
1170 | - if ( $geodir_is_category ) { |
|
1171 | - $category = $geodir_is_category ? get_term_by( 'slug', $geodir_is_category, $category_taxonomy[0] ) : null; |
|
1172 | - if ( isset( $category->term_id ) && ! empty( $category->term_id ) ) { |
|
1170 | + if ($geodir_is_category) { |
|
1171 | + $category = $geodir_is_category ? get_term_by('slug', $geodir_is_category, $category_taxonomy[0]) : null; |
|
1172 | + if (isset($category->term_id) && !empty($category->term_id)) { |
|
1173 | 1173 | $category_id = $category->term_id; |
1174 | - $category_desc = trim( $category->description ) != '' ? trim( $category->description ) : geodir_get_tax_meta( $category_id, 'ct_cat_top_desc', false, $geodir_post_type ); |
|
1175 | - if ( $location_id ) { |
|
1176 | - $option_name = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id; |
|
1177 | - $cat_loc_option = get_option( $option_name ); |
|
1178 | - |
|
1179 | - $gd_cat_loc_default = ! empty( $cat_loc_option ) && isset( $cat_loc_option['gd_cat_loc_default'] ) && $cat_loc_option['gd_cat_loc_default'] > 0 ? true : false; |
|
1180 | - if ( ! $gd_cat_loc_default ) { |
|
1181 | - $option_name = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id . '_' . $location_id; |
|
1182 | - $option = get_option( $option_name ); |
|
1183 | - $category_desc = isset( $option['gd_cat_loc_desc'] ) && trim( $option['gd_cat_loc_desc'] ) != '' ? trim( $option['gd_cat_loc_desc'] ) : $category_desc; |
|
1174 | + $category_desc = trim($category->description) != '' ? trim($category->description) : geodir_get_tax_meta($category_id, 'ct_cat_top_desc', false, $geodir_post_type); |
|
1175 | + if ($location_id) { |
|
1176 | + $option_name = 'geodir_cat_loc_'.$geodir_post_type.'_'.$category_id; |
|
1177 | + $cat_loc_option = get_option($option_name); |
|
1178 | + |
|
1179 | + $gd_cat_loc_default = !empty($cat_loc_option) && isset($cat_loc_option['gd_cat_loc_default']) && $cat_loc_option['gd_cat_loc_default'] > 0 ? true : false; |
|
1180 | + if (!$gd_cat_loc_default) { |
|
1181 | + $option_name = 'geodir_cat_loc_'.$geodir_post_type.'_'.$category_id.'_'.$location_id; |
|
1182 | + $option = get_option($option_name); |
|
1183 | + $category_desc = isset($option['gd_cat_loc_desc']) && trim($option['gd_cat_loc_desc']) != '' ? trim($option['gd_cat_loc_desc']) : $category_desc; |
|
1184 | 1184 | } |
1185 | 1185 | } |
1186 | - $geodir_meta_desc = __( "Posts related to Category:", 'geodirectory' ) . " " . geodir_utf8_ucfirst( single_cat_title( "", false ) ) . '. ' . $category_desc; |
|
1186 | + $geodir_meta_desc = __("Posts related to Category:", 'geodirectory')." ".geodir_utf8_ucfirst(single_cat_title("", false)).'. '.$category_desc; |
|
1187 | 1187 | } |
1188 | - } else if ( $geodir_is_tag ) { |
|
1189 | - $geodir_meta_desc = __( "Posts related to Tag:", 'geodirectory' ) . " " . geodir_utf8_ucfirst( single_tag_title( "", false ) ) . '. ' . $geodir_meta_desc; |
|
1188 | + } else if ($geodir_is_tag) { |
|
1189 | + $geodir_meta_desc = __("Posts related to Tag:", 'geodirectory')." ".geodir_utf8_ucfirst(single_tag_title("", false)).'. '.$geodir_meta_desc; |
|
1190 | 1190 | } |
1191 | 1191 | } |
1192 | 1192 | } |
1193 | 1193 | |
1194 | 1194 | |
1195 | 1195 | $gd_page = ''; |
1196 | - if ( geodir_is_page( 'home' ) ) { |
|
1196 | + if (geodir_is_page('home')) { |
|
1197 | 1197 | $gd_page = 'home'; |
1198 | - $meta_desc = ( get_option( 'geodir_meta_desc_homepage' ) ) ? get_option( 'geodir_meta_desc_homepage' ) : $meta_desc; |
|
1199 | - } elseif ( geodir_is_page( 'detail' ) ) { |
|
1198 | + $meta_desc = (get_option('geodir_meta_desc_homepage')) ? get_option('geodir_meta_desc_homepage') : $meta_desc; |
|
1199 | + } elseif (geodir_is_page('detail')) { |
|
1200 | 1200 | $gd_page = 'detail'; |
1201 | - $meta_desc = ( get_option( 'geodir_meta_desc_detail' ) ) ? get_option( 'geodir_meta_desc_detail' ) : $meta_desc; |
|
1202 | - } elseif ( geodir_is_page( 'pt' ) ) { |
|
1201 | + $meta_desc = (get_option('geodir_meta_desc_detail')) ? get_option('geodir_meta_desc_detail') : $meta_desc; |
|
1202 | + } elseif (geodir_is_page('pt')) { |
|
1203 | 1203 | $gd_page = 'pt'; |
1204 | - $meta_desc = ( get_option( 'geodir_meta_desc_pt' ) ) ? get_option( 'geodir_meta_desc_pt' ) : $meta_desc; |
|
1205 | - } elseif ( geodir_is_page( 'listing' ) ) { |
|
1204 | + $meta_desc = (get_option('geodir_meta_desc_pt')) ? get_option('geodir_meta_desc_pt') : $meta_desc; |
|
1205 | + } elseif (geodir_is_page('listing')) { |
|
1206 | 1206 | $gd_page = 'listing'; |
1207 | - $meta_desc = ( get_option( 'geodir_meta_desc_listing' ) ) ? get_option( 'geodir_meta_desc_listing' ) : $meta_desc; |
|
1208 | - } elseif ( geodir_is_page( 'location' ) ) { |
|
1207 | + $meta_desc = (get_option('geodir_meta_desc_listing')) ? get_option('geodir_meta_desc_listing') : $meta_desc; |
|
1208 | + } elseif (geodir_is_page('location')) { |
|
1209 | 1209 | $gd_page = 'location'; |
1210 | - $meta_desc = ( get_option( 'geodir_meta_desc_location' ) ) ? get_option( 'geodir_meta_desc_location' ) : $meta_desc; |
|
1211 | - $meta_desc = apply_filters( 'geodir_seo_meta_location_description', $meta_desc ); |
|
1210 | + $meta_desc = (get_option('geodir_meta_desc_location')) ? get_option('geodir_meta_desc_location') : $meta_desc; |
|
1211 | + $meta_desc = apply_filters('geodir_seo_meta_location_description', $meta_desc); |
|
1212 | 1212 | |
1213 | - } elseif ( geodir_is_page( 'search' ) ) { |
|
1213 | + } elseif (geodir_is_page('search')) { |
|
1214 | 1214 | $gd_page = 'search'; |
1215 | - $meta_desc = ( get_option( 'geodir_meta_desc_search' ) ) ? get_option( 'geodir_meta_desc_search' ) : $meta_desc; |
|
1216 | - } elseif ( geodir_is_page( 'add-listing' ) ) { |
|
1215 | + $meta_desc = (get_option('geodir_meta_desc_search')) ? get_option('geodir_meta_desc_search') : $meta_desc; |
|
1216 | + } elseif (geodir_is_page('add-listing')) { |
|
1217 | 1217 | $gd_page = 'add-listing'; |
1218 | - $meta_desc = ( get_option( 'geodir_meta_desc_add-listing' ) ) ? get_option( 'geodir_meta_desc_add-listing' ) : $meta_desc; |
|
1219 | - } elseif ( geodir_is_page( 'author' ) ) { |
|
1218 | + $meta_desc = (get_option('geodir_meta_desc_add-listing')) ? get_option('geodir_meta_desc_add-listing') : $meta_desc; |
|
1219 | + } elseif (geodir_is_page('author')) { |
|
1220 | 1220 | $gd_page = 'author'; |
1221 | - $meta_desc = ( get_option( 'geodir_meta_desc_author' ) ) ? get_option( 'geodir_meta_desc_author' ) : $meta_desc; |
|
1222 | - } elseif ( geodir_is_page( 'login' ) ) { |
|
1221 | + $meta_desc = (get_option('geodir_meta_desc_author')) ? get_option('geodir_meta_desc_author') : $meta_desc; |
|
1222 | + } elseif (geodir_is_page('login')) { |
|
1223 | 1223 | $gd_page = 'login'; |
1224 | - $meta_desc = ( get_option( 'geodir_meta_desc_login' ) ) ? get_option( 'geodir_meta_desc_login' ) : $meta_desc; |
|
1225 | - } elseif ( geodir_is_page( 'listing-success' ) ) { |
|
1224 | + $meta_desc = (get_option('geodir_meta_desc_login')) ? get_option('geodir_meta_desc_login') : $meta_desc; |
|
1225 | + } elseif (geodir_is_page('listing-success')) { |
|
1226 | 1226 | $gd_page = 'listing-success'; |
1227 | - $meta_desc = ( get_option( 'geodir_meta_desc_listing-success' ) ) ? get_option( 'geodir_meta_desc_listing-success' ) : $meta_desc; |
|
1227 | + $meta_desc = (get_option('geodir_meta_desc_listing-success')) ? get_option('geodir_meta_desc_listing-success') : $meta_desc; |
|
1228 | 1228 | } |
1229 | 1229 | |
1230 | 1230 | |
1231 | - if ( $meta_desc ) { |
|
1232 | - $meta_desc = stripslashes_deep( $meta_desc ); |
|
1231 | + if ($meta_desc) { |
|
1232 | + $meta_desc = stripslashes_deep($meta_desc); |
|
1233 | 1233 | /** |
1234 | 1234 | * Filter page description to replace variables. |
1235 | 1235 | * |
@@ -1238,7 +1238,7 @@ discard block |
||
1238 | 1238 | * @param string $title The page description including variables. |
1239 | 1239 | * @param string $gd_page The GeoDirectory page type if any. |
1240 | 1240 | */ |
1241 | - $meta_desc = apply_filters( 'geodir_seo_meta_description_pre', __( $meta_desc, 'geodirectory' ), $gd_page, '' ); |
|
1241 | + $meta_desc = apply_filters('geodir_seo_meta_description_pre', __($meta_desc, 'geodirectory'), $gd_page, ''); |
|
1242 | 1242 | |
1243 | 1243 | /** |
1244 | 1244 | * Filter SEO meta description. |
@@ -1247,20 +1247,20 @@ discard block |
||
1247 | 1247 | * |
1248 | 1248 | * @param string $meta_desc Meta description content. |
1249 | 1249 | */ |
1250 | - echo apply_filters( 'geodir_seo_meta_description', '<meta name="description" content="' . $meta_desc . '" />', $meta_desc ); |
|
1250 | + echo apply_filters('geodir_seo_meta_description', '<meta name="description" content="'.$meta_desc.'" />', $meta_desc); |
|
1251 | 1251 | } |
1252 | 1252 | |
1253 | 1253 | // meta keywords |
1254 | - if ( isset( $post->post_type ) && in_array( $post->post_type, $all_postypes ) ) { |
|
1255 | - $place_tags = wp_get_post_terms( $post->ID, $post->post_type . '_tags', array( "fields" => "names" ) ); |
|
1256 | - $place_cats = wp_get_post_terms( $post->ID, $post->post_type . 'category', array( "fields" => "names" ) ); |
|
1254 | + if (isset($post->post_type) && in_array($post->post_type, $all_postypes)) { |
|
1255 | + $place_tags = wp_get_post_terms($post->ID, $post->post_type.'_tags', array("fields" => "names")); |
|
1256 | + $place_cats = wp_get_post_terms($post->ID, $post->post_type.'category', array("fields" => "names")); |
|
1257 | 1257 | |
1258 | - $meta_key .= implode( ", ", array_merge( (array) $place_cats, (array) $place_tags ) ); |
|
1258 | + $meta_key .= implode(", ", array_merge((array) $place_cats, (array) $place_tags)); |
|
1259 | 1259 | } else { |
1260 | 1260 | $posttags = get_the_tags(); |
1261 | - if ( $posttags ) { |
|
1262 | - foreach ( $posttags as $tag ) { |
|
1263 | - $meta_key .= $tag->name . ' '; |
|
1261 | + if ($posttags) { |
|
1262 | + foreach ($posttags as $tag) { |
|
1263 | + $meta_key .= $tag->name.' '; |
|
1264 | 1264 | } |
1265 | 1265 | } else { |
1266 | 1266 | // $tags = get_tags( array( 'orderby' => 'count', 'order' => 'DESC' ) ); |
@@ -1276,20 +1276,20 @@ discard block |
||
1276 | 1276 | } |
1277 | 1277 | } |
1278 | 1278 | |
1279 | - $meta_key = $meta_key != '' ? rtrim( trim( $meta_key ), "," ) : $meta_key; |
|
1280 | - $geodir_meta_keys = $geodir_meta_keys != '' ? ( $meta_key != '' ? $meta_key . ', ' . $geodir_meta_keys : $geodir_meta_keys ) : $meta_key; |
|
1281 | - if ( $geodir_meta_keys != '' ) { |
|
1282 | - $geodir_meta_keys = strip_tags( $geodir_meta_keys ); |
|
1283 | - $geodir_meta_keys = esc_html( $geodir_meta_keys ); |
|
1284 | - $geodir_meta_keys = geodir_strtolower( $geodir_meta_keys ); |
|
1285 | - $geodir_meta_keys = wp_html_excerpt( $geodir_meta_keys, 1000, '' ); |
|
1286 | - $geodir_meta_keys = str_replace( '%location%', $replace_location, $geodir_meta_keys ); |
|
1279 | + $meta_key = $meta_key != '' ? rtrim(trim($meta_key), ",") : $meta_key; |
|
1280 | + $geodir_meta_keys = $geodir_meta_keys != '' ? ($meta_key != '' ? $meta_key.', '.$geodir_meta_keys : $geodir_meta_keys) : $meta_key; |
|
1281 | + if ($geodir_meta_keys != '') { |
|
1282 | + $geodir_meta_keys = strip_tags($geodir_meta_keys); |
|
1283 | + $geodir_meta_keys = esc_html($geodir_meta_keys); |
|
1284 | + $geodir_meta_keys = geodir_strtolower($geodir_meta_keys); |
|
1285 | + $geodir_meta_keys = wp_html_excerpt($geodir_meta_keys, 1000, ''); |
|
1286 | + $geodir_meta_keys = str_replace('%location%', $replace_location, $geodir_meta_keys); |
|
1287 | 1287 | |
1288 | - $meta_key = rtrim( trim( $geodir_meta_keys ), "," ); |
|
1288 | + $meta_key = rtrim(trim($geodir_meta_keys), ","); |
|
1289 | 1289 | } |
1290 | 1290 | |
1291 | - if ( $meta_key ) { |
|
1292 | - $meta_key = stripslashes_deep( $meta_key ); |
|
1291 | + if ($meta_key) { |
|
1292 | + $meta_key = stripslashes_deep($meta_key); |
|
1293 | 1293 | /** |
1294 | 1294 | * Filter SEO meta keywords. |
1295 | 1295 | * |
@@ -1297,7 +1297,7 @@ discard block |
||
1297 | 1297 | * |
1298 | 1298 | * @param string $meta_desc Meta keywords. |
1299 | 1299 | */ |
1300 | - echo apply_filters( 'geodir_seo_meta_keywords', '<meta name="keywords" content="' . $meta_key . '" />', $meta_key ); |
|
1300 | + echo apply_filters('geodir_seo_meta_keywords', '<meta name="keywords" content="'.$meta_key.'" />', $meta_key); |
|
1301 | 1301 | } |
1302 | 1302 | |
1303 | 1303 | } |
@@ -1317,8 +1317,8 @@ discard block |
||
1317 | 1317 | |
1318 | 1318 | $geodir_detail_page_tabs_array = geodir_detail_page_tabs_array(); |
1319 | 1319 | |
1320 | - foreach ( $geodir_detail_page_tabs_array as $key => $tabs_obj ) { |
|
1321 | - $geodir_detail_page_tabs_key_value_array[ $key ] = $tabs_obj['heading_text']; |
|
1320 | + foreach ($geodir_detail_page_tabs_array as $key => $tabs_obj) { |
|
1321 | + $geodir_detail_page_tabs_key_value_array[$key] = $tabs_obj['heading_text']; |
|
1322 | 1322 | } |
1323 | 1323 | |
1324 | 1324 | return $geodir_detail_page_tabs_key_value_array; |
@@ -1340,57 +1340,57 @@ discard block |
||
1340 | 1340 | * @since 1.0.0 |
1341 | 1341 | */ |
1342 | 1342 | $arr_tabs['post_profile'] = array( |
1343 | - 'heading_text' => __( 'Profile', 'geodirectory' ), |
|
1343 | + 'heading_text' => __('Profile', 'geodirectory'), |
|
1344 | 1344 | 'is_active_tab' => true, |
1345 | - 'is_display' => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_profile' ), |
|
1345 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_profile'), |
|
1346 | 1346 | 'tab_content' => '' |
1347 | 1347 | ); |
1348 | - $arr_tabs['post_info'] = array( |
|
1349 | - 'heading_text' => __( 'More Info', 'geodirectory' ), |
|
1348 | + $arr_tabs['post_info'] = array( |
|
1349 | + 'heading_text' => __('More Info', 'geodirectory'), |
|
1350 | 1350 | 'is_active_tab' => false, |
1351 | - 'is_display' => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_info' ), |
|
1351 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_info'), |
|
1352 | 1352 | 'tab_content' => '' |
1353 | 1353 | ); |
1354 | 1354 | |
1355 | 1355 | $arr_tabs['post_images'] = array( |
1356 | - 'heading_text' => __( 'Photos', 'geodirectory' ), |
|
1356 | + 'heading_text' => __('Photos', 'geodirectory'), |
|
1357 | 1357 | 'is_active_tab' => false, |
1358 | - 'is_display' => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_images' ), |
|
1358 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_images'), |
|
1359 | 1359 | 'tab_content' => '' |
1360 | 1360 | ); |
1361 | 1361 | |
1362 | 1362 | $arr_tabs['post_video'] = array( |
1363 | - 'heading_text' => __( 'Video', 'geodirectory' ), |
|
1363 | + 'heading_text' => __('Video', 'geodirectory'), |
|
1364 | 1364 | 'is_active_tab' => false, |
1365 | - 'is_display' => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_video' ), |
|
1365 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_video'), |
|
1366 | 1366 | 'tab_content' => '' |
1367 | 1367 | ); |
1368 | 1368 | |
1369 | 1369 | $arr_tabs['special_offers'] = array( |
1370 | - 'heading_text' => __( 'Special Offers', 'geodirectory' ), |
|
1370 | + 'heading_text' => __('Special Offers', 'geodirectory'), |
|
1371 | 1371 | 'is_active_tab' => false, |
1372 | - 'is_display' => apply_filters( 'geodir_detail_page_tab_is_display', true, 'special_offers' ), |
|
1372 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'special_offers'), |
|
1373 | 1373 | 'tab_content' => '' |
1374 | 1374 | ); |
1375 | 1375 | |
1376 | 1376 | $arr_tabs['post_map'] = array( |
1377 | - 'heading_text' => __( 'Map', 'geodirectory' ), |
|
1377 | + 'heading_text' => __('Map', 'geodirectory'), |
|
1378 | 1378 | 'is_active_tab' => false, |
1379 | - 'is_display' => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_map' ), |
|
1379 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_map'), |
|
1380 | 1380 | 'tab_content' => '' |
1381 | 1381 | ); |
1382 | 1382 | |
1383 | 1383 | $arr_tabs['reviews'] = array( |
1384 | - 'heading_text' => __( 'Reviews', 'geodirectory' ), |
|
1384 | + 'heading_text' => __('Reviews', 'geodirectory'), |
|
1385 | 1385 | 'is_active_tab' => false, |
1386 | - 'is_display' => apply_filters( 'geodir_detail_page_tab_is_display', true, 'reviews' ), |
|
1386 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'reviews'), |
|
1387 | 1387 | 'tab_content' => 'review display' |
1388 | 1388 | ); |
1389 | 1389 | |
1390 | 1390 | $arr_tabs['related_listing'] = array( |
1391 | - 'heading_text' => __( 'Related Listing', 'geodirectory' ), |
|
1391 | + 'heading_text' => __('Related Listing', 'geodirectory'), |
|
1392 | 1392 | 'is_active_tab' => false, |
1393 | - 'is_display' => apply_filters( 'geodir_detail_page_tab_is_display', true, 'related_listing' ), |
|
1393 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'related_listing'), |
|
1394 | 1394 | 'tab_content' => '' |
1395 | 1395 | ); |
1396 | 1396 | |
@@ -1399,7 +1399,7 @@ discard block |
||
1399 | 1399 | * |
1400 | 1400 | * @since 1.0.0 |
1401 | 1401 | */ |
1402 | - return apply_filters( 'geodir_detail_page_tab_list_extend', $arr_tabs ); |
|
1402 | + return apply_filters('geodir_detail_page_tab_list_extend', $arr_tabs); |
|
1403 | 1403 | |
1404 | 1404 | |
1405 | 1405 | } |
@@ -1413,13 +1413,13 @@ discard block |
||
1413 | 1413 | * @return mixed|array Tabs array. |
1414 | 1414 | */ |
1415 | 1415 | function geodir_detail_page_tabs_list() { |
1416 | - $tabs_excluded = get_option( 'geodir_detail_page_tabs_excluded' ); |
|
1416 | + $tabs_excluded = get_option('geodir_detail_page_tabs_excluded'); |
|
1417 | 1417 | $tabs_array = geodir_detail_page_tabs_array(); |
1418 | 1418 | |
1419 | - if ( ! empty( $tabs_excluded ) ) { |
|
1420 | - foreach ( $tabs_excluded as $tab ) { |
|
1421 | - if ( array_key_exists( $tab, $tabs_array ) ) { |
|
1422 | - unset( $tabs_array[ $tab ] ); |
|
1419 | + if (!empty($tabs_excluded)) { |
|
1420 | + foreach ($tabs_excluded as $tab) { |
|
1421 | + if (array_key_exists($tab, $tabs_array)) { |
|
1422 | + unset($tabs_array[$tab]); |
|
1423 | 1423 | } |
1424 | 1424 | } |
1425 | 1425 | } |
@@ -1443,66 +1443,66 @@ discard block |
||
1443 | 1443 | function geodir_show_detail_page_tabs() { |
1444 | 1444 | global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields, $preview; |
1445 | 1445 | |
1446 | - $post_id = ! empty( $post ) && isset( $post->ID ) ? (int) $post->ID : 0; |
|
1447 | - $request_post_id = ! empty( $_REQUEST['p'] ) ? (int) $_REQUEST['p'] : 0; |
|
1448 | - $is_backend_preview = ( is_single() && ! empty( $_REQUEST['post_type'] ) && ! empty( $_REQUEST['preview'] ) && ! empty( $_REQUEST['p'] ) ) && is_super_admin() ? true : false; // skip if preview from backend |
|
1446 | + $post_id = !empty($post) && isset($post->ID) ? (int) $post->ID : 0; |
|
1447 | + $request_post_id = !empty($_REQUEST['p']) ? (int) $_REQUEST['p'] : 0; |
|
1448 | + $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend |
|
1449 | 1449 | |
1450 | - if ( $is_backend_preview && ! $post_id > 0 && $request_post_id > 0 ) { |
|
1451 | - $post = geodir_get_post_info( $request_post_id ); |
|
1452 | - setup_postdata( $post ); |
|
1450 | + if ($is_backend_preview && !$post_id > 0 && $request_post_id > 0) { |
|
1451 | + $post = geodir_get_post_info($request_post_id); |
|
1452 | + setup_postdata($post); |
|
1453 | 1453 | } |
1454 | 1454 | |
1455 | - $geodir_post_detail_fields = geodir_show_listing_info( 'moreinfo' ); |
|
1455 | + $geodir_post_detail_fields = geodir_show_listing_info('moreinfo'); |
|
1456 | 1456 | |
1457 | 1457 | $package_info = geodir_post_package_info(array(), $post, (!empty($post->post_type) ? $post->post_type : '')); |
1458 | 1458 | $image_limit = ''; |
1459 | 1459 | if (defined('GEODIRPAYMENT_VERSION') && !empty($package_info) && isset($package_info->image_limit) && $package_info->image_limit !== '') { |
1460 | - $image_limit = (int)$package_info->image_limit; |
|
1460 | + $image_limit = (int) $package_info->image_limit; |
|
1461 | 1461 | } |
1462 | 1462 | |
1463 | - if ( geodir_is_page( 'detail' ) ) { |
|
1464 | - $video = geodir_get_video( $post->ID ); |
|
1465 | - $special_offers = geodir_get_special_offers( $post->ID ); |
|
1463 | + if (geodir_is_page('detail')) { |
|
1464 | + $video = geodir_get_video($post->ID); |
|
1465 | + $special_offers = geodir_get_special_offers($post->ID); |
|
1466 | 1466 | $related_listing_array = array(); |
1467 | - if ( get_option( 'geodir_add_related_listing_posttypes' ) ) { |
|
1468 | - $related_listing_array = get_option( 'geodir_add_related_listing_posttypes' ); |
|
1467 | + if (get_option('geodir_add_related_listing_posttypes')) { |
|
1468 | + $related_listing_array = get_option('geodir_add_related_listing_posttypes'); |
|
1469 | 1469 | } |
1470 | 1470 | |
1471 | - $excluded_tabs = get_option( 'geodir_detail_page_tabs_excluded' ); |
|
1472 | - if ( ! $excluded_tabs ) { |
|
1471 | + $excluded_tabs = get_option('geodir_detail_page_tabs_excluded'); |
|
1472 | + if (!$excluded_tabs) { |
|
1473 | 1473 | $excluded_tabs = array(); |
1474 | 1474 | } |
1475 | 1475 | |
1476 | 1476 | $related_listing = ''; |
1477 | - if ( in_array( $post->post_type, $related_listing_array ) && ! in_array( 'related_listing', $excluded_tabs ) ) { |
|
1477 | + if (in_array($post->post_type, $related_listing_array) && !in_array('related_listing', $excluded_tabs)) { |
|
1478 | 1478 | $request = array( |
1479 | - 'post_number' => get_option( 'geodir_related_post_count' ), |
|
1480 | - 'relate_to' => get_option( 'geodir_related_post_relate_to' ), |
|
1481 | - 'layout' => get_option( 'geodir_related_post_listing_view' ), |
|
1482 | - 'add_location_filter' => get_option( 'geodir_related_post_location_filter' ), |
|
1483 | - 'list_sort' => get_option( 'geodir_related_post_sortby' ), |
|
1484 | - 'character_count' => get_option( 'geodir_related_post_excerpt' ) |
|
1479 | + 'post_number' => get_option('geodir_related_post_count'), |
|
1480 | + 'relate_to' => get_option('geodir_related_post_relate_to'), |
|
1481 | + 'layout' => get_option('geodir_related_post_listing_view'), |
|
1482 | + 'add_location_filter' => get_option('geodir_related_post_location_filter'), |
|
1483 | + 'list_sort' => get_option('geodir_related_post_sortby'), |
|
1484 | + 'character_count' => get_option('geodir_related_post_excerpt') |
|
1485 | 1485 | ); |
1486 | 1486 | |
1487 | - if ( $post->post_type == 'gd_event' && defined( 'GDEVENTS_VERSION' ) ) { |
|
1488 | - $related_listing = geodir_get_detail_page_related_events( $request ); |
|
1487 | + if ($post->post_type == 'gd_event' && defined('GDEVENTS_VERSION')) { |
|
1488 | + $related_listing = geodir_get_detail_page_related_events($request); |
|
1489 | 1489 | } else { |
1490 | - $related_listing = geodir_related_posts_display( $request ); |
|
1490 | + $related_listing = geodir_related_posts_display($request); |
|
1491 | 1491 | } |
1492 | 1492 | |
1493 | 1493 | } |
1494 | 1494 | |
1495 | - $post_images = geodir_get_images( $post->ID, 'thumbnail' ); |
|
1495 | + $post_images = geodir_get_images($post->ID, 'thumbnail'); |
|
1496 | 1496 | $thumb_image = ''; |
1497 | - if ( ! empty( $post_images ) ) { |
|
1497 | + if (!empty($post_images)) { |
|
1498 | 1498 | $count = 1; |
1499 | - foreach ( $post_images as $image ) { |
|
1499 | + foreach ($post_images as $image) { |
|
1500 | 1500 | if ($image_limit !== '' && $count > $image_limit) { |
1501 | 1501 | break; |
1502 | 1502 | } |
1503 | - $caption = ( ! empty( $image->caption ) ) ? $image->caption : ''; |
|
1504 | - $thumb_image .= '<a href="' . $image->src . '" title="' . $caption . '">'; |
|
1505 | - $thumb_image .= geodir_show_image( $image, 'thumbnail', true, false ); |
|
1503 | + $caption = (!empty($image->caption)) ? $image->caption : ''; |
|
1504 | + $thumb_image .= '<a href="'.$image->src.'" title="'.$caption.'">'; |
|
1505 | + $thumb_image .= geodir_show_image($image, 'thumbnail', true, false); |
|
1506 | 1506 | $thumb_image .= '</a>'; |
1507 | 1507 | $count++; |
1508 | 1508 | } |
@@ -1512,11 +1512,11 @@ discard block |
||
1512 | 1512 | $map_args['map_canvas_name'] = 'detail_page_map_canvas'; |
1513 | 1513 | $map_args['width'] = '600'; |
1514 | 1514 | $map_args['height'] = '300'; |
1515 | - if ( $post->post_mapzoom ) { |
|
1516 | - $map_args['zoom'] = '' . $post->post_mapzoom . ''; |
|
1515 | + if ($post->post_mapzoom) { |
|
1516 | + $map_args['zoom'] = ''.$post->post_mapzoom.''; |
|
1517 | 1517 | } |
1518 | 1518 | $map_args['autozoom'] = false; |
1519 | - $map_args['scrollwheel'] = ( get_option( 'geodir_add_listing_mouse_scroll' ) ) ? 0 : 1; |
|
1519 | + $map_args['scrollwheel'] = (get_option('geodir_add_listing_mouse_scroll')) ? 0 : 1; |
|
1520 | 1520 | $map_args['child_collapse'] = '0'; |
1521 | 1521 | $map_args['enable_cat_filters'] = false; |
1522 | 1522 | $map_args['enable_text_search'] = false; |
@@ -1525,29 +1525,29 @@ discard block |
||
1525 | 1525 | $map_args['enable_jason_on_load'] = true; |
1526 | 1526 | $map_args['enable_map_direction'] = true; |
1527 | 1527 | $map_args['map_class_name'] = 'geodir-map-detail-page'; |
1528 | - $map_args['maptype'] = ( ! empty( $post->post_mapview ) ) ? $post->post_mapview : 'ROADMAP'; |
|
1529 | - } else if ( geodir_is_page( 'preview' ) ) { |
|
1530 | - $video = isset( $post->geodir_video ) ? $post->geodir_video : ''; |
|
1531 | - $special_offers = isset( $post->geodir_special_offers ) ? $post->geodir_special_offers : ''; |
|
1528 | + $map_args['maptype'] = (!empty($post->post_mapview)) ? $post->post_mapview : 'ROADMAP'; |
|
1529 | + } else if (geodir_is_page('preview')) { |
|
1530 | + $video = isset($post->geodir_video) ? $post->geodir_video : ''; |
|
1531 | + $special_offers = isset($post->geodir_special_offers) ? $post->geodir_special_offers : ''; |
|
1532 | 1532 | |
1533 | - if ( isset( $post->post_images ) ) { |
|
1534 | - $post->post_images = trim( $post->post_images, "," ); |
|
1533 | + if (isset($post->post_images)) { |
|
1534 | + $post->post_images = trim($post->post_images, ","); |
|
1535 | 1535 | } |
1536 | 1536 | |
1537 | - if ( isset( $post->post_images ) && ! empty( $post->post_images ) ) { |
|
1538 | - $post_images = explode( ",", $post->post_images ); |
|
1537 | + if (isset($post->post_images) && !empty($post->post_images)) { |
|
1538 | + $post_images = explode(",", $post->post_images); |
|
1539 | 1539 | } |
1540 | 1540 | |
1541 | 1541 | $thumb_image = ''; |
1542 | - if ( ! empty( $post_images ) ) { |
|
1542 | + if (!empty($post_images)) { |
|
1543 | 1543 | $count = 1; |
1544 | - foreach ( $post_images as $image ) { |
|
1545 | - if ( $image != '' ) { |
|
1544 | + foreach ($post_images as $image) { |
|
1545 | + if ($image != '') { |
|
1546 | 1546 | if ($image_limit !== '' && $count > $image_limit) { |
1547 | 1547 | break; |
1548 | 1548 | } |
1549 | - $thumb_image .= '<a href="' . $image . '">'; |
|
1550 | - $thumb_image .= geodir_show_image( array( 'src' => $image ), 'thumbnail', true, false ); |
|
1549 | + $thumb_image .= '<a href="'.$image.'">'; |
|
1550 | + $thumb_image .= geodir_show_image(array('src' => $image), 'thumbnail', true, false); |
|
1551 | 1551 | $thumb_image .= '</a>'; |
1552 | 1552 | $count++; |
1553 | 1553 | } |
@@ -1555,18 +1555,18 @@ discard block |
||
1555 | 1555 | } |
1556 | 1556 | |
1557 | 1557 | global $map_jason; |
1558 | - $marker_json = $post->marker_json != '' ? json_decode( $post->marker_json, true ) : array(); |
|
1559 | - $marker_icon = ( ! empty( $marker_json ) && ! empty( $marker_json['i'] ) ) ? $marker_json['i'] : ''; |
|
1560 | - $icon_size = geodir_get_marker_size( $marker_icon ); |
|
1558 | + $marker_json = $post->marker_json != '' ? json_decode($post->marker_json, true) : array(); |
|
1559 | + $marker_icon = (!empty($marker_json) && !empty($marker_json['i'])) ? $marker_json['i'] : ''; |
|
1560 | + $icon_size = geodir_get_marker_size($marker_icon); |
|
1561 | 1561 | $marker_json['w'] = $icon_size['w']; |
1562 | 1562 | $marker_json['h'] = $icon_size['h']; |
1563 | - $map_jason[] = json_encode( $marker_json ); |
|
1563 | + $map_jason[] = json_encode($marker_json); |
|
1564 | 1564 | |
1565 | - $address_latitude = isset( $post->post_latitude ) ? $post->post_latitude : ''; |
|
1566 | - $address_longitude = isset( $post->post_longitude ) ? $post->post_longitude : ''; |
|
1567 | - $mapview = isset( $post->post_mapview ) ? $post->post_mapview : ''; |
|
1568 | - $mapzoom = isset( $post->post_mapzoom ) ? $post->post_mapzoom : ''; |
|
1569 | - if ( ! $mapzoom ) { |
|
1565 | + $address_latitude = isset($post->post_latitude) ? $post->post_latitude : ''; |
|
1566 | + $address_longitude = isset($post->post_longitude) ? $post->post_longitude : ''; |
|
1567 | + $mapview = isset($post->post_mapview) ? $post->post_mapview : ''; |
|
1568 | + $mapzoom = isset($post->post_mapzoom) ? $post->post_mapzoom : ''; |
|
1569 | + if (!$mapzoom) { |
|
1570 | 1570 | $mapzoom = 12; |
1571 | 1571 | } |
1572 | 1572 | |
@@ -1589,37 +1589,37 @@ discard block |
||
1589 | 1589 | $map_args['map_class_name'] = 'geodir-map-preview-page'; |
1590 | 1590 | } |
1591 | 1591 | |
1592 | - $arr_detail_page_tabs = geodir_detail_page_tabs_list();// get this sooner so we can get the active tab for the user |
|
1592 | + $arr_detail_page_tabs = geodir_detail_page_tabs_list(); // get this sooner so we can get the active tab for the user |
|
1593 | 1593 | |
1594 | 1594 | $active_tab = ''; |
1595 | 1595 | $active_tab_name = ''; |
1596 | 1596 | $default_tab = ''; |
1597 | 1597 | $default_tab_name = ''; |
1598 | - foreach ( $arr_detail_page_tabs as $tab_index => $tabs ) { |
|
1599 | - if ( isset( $tabs['is_active_tab'] ) && $tabs['is_active_tab'] && ! empty( $tabs['is_display'] ) && isset( $tabs['heading_text'] ) && $tabs['heading_text'] ) { |
|
1598 | + foreach ($arr_detail_page_tabs as $tab_index => $tabs) { |
|
1599 | + if (isset($tabs['is_active_tab']) && $tabs['is_active_tab'] && !empty($tabs['is_display']) && isset($tabs['heading_text']) && $tabs['heading_text']) { |
|
1600 | 1600 | $active_tab = $tab_index; |
1601 | - $active_tab_name = __( $tabs['heading_text'], 'geodirectory' ); |
|
1601 | + $active_tab_name = __($tabs['heading_text'], 'geodirectory'); |
|
1602 | 1602 | } |
1603 | 1603 | |
1604 | - if ( $default_tab === '' && ! empty( $tabs['is_display'] ) && ! empty( $tabs['heading_text'] ) ) { |
|
1604 | + if ($default_tab === '' && !empty($tabs['is_display']) && !empty($tabs['heading_text'])) { |
|
1605 | 1605 | $default_tab = $tab_index; |
1606 | - $default_tab_name = __( $tabs['heading_text'], 'geodirectory' ); |
|
1606 | + $default_tab_name = __($tabs['heading_text'], 'geodirectory'); |
|
1607 | 1607 | } |
1608 | 1608 | } |
1609 | 1609 | |
1610 | - if ( $active_tab === '' && $default_tab !== '' ) { // Make first tab as a active tab if not any tab is active. |
|
1611 | - if ( isset( $arr_detail_page_tabs[ $active_tab ] ) && isset( $arr_detail_page_tabs[ $active_tab ]['is_active_tab'] ) ) { |
|
1612 | - $arr_detail_page_tabs[ $active_tab ]['is_active_tab'] = false; |
|
1610 | + if ($active_tab === '' && $default_tab !== '') { // Make first tab as a active tab if not any tab is active. |
|
1611 | + if (isset($arr_detail_page_tabs[$active_tab]) && isset($arr_detail_page_tabs[$active_tab]['is_active_tab'])) { |
|
1612 | + $arr_detail_page_tabs[$active_tab]['is_active_tab'] = false; |
|
1613 | 1613 | } |
1614 | 1614 | |
1615 | - $arr_detail_page_tabs[ $default_tab ]['is_active_tab'] = true; |
|
1615 | + $arr_detail_page_tabs[$default_tab]['is_active_tab'] = true; |
|
1616 | 1616 | $active_tab = $default_tab; |
1617 | 1617 | $active_tab_name = $default_tab_name; |
1618 | 1618 | } |
1619 | - $tab_list = ( get_option( 'geodir_disable_tabs', false ) ) ? true : false; |
|
1619 | + $tab_list = (get_option('geodir_disable_tabs', false)) ? true : false; |
|
1620 | 1620 | ?> |
1621 | 1621 | <div class="geodir-tabs" id="gd-tabs" style="position:relative;"> |
1622 | - <?php if ( ! $tab_list ){ ?> |
|
1622 | + <?php if (!$tab_list) { ?> |
|
1623 | 1623 | <div id="geodir-tab-mobile-menu"> |
1624 | 1624 | <i class="fa fa-bars"></i> |
1625 | 1625 | <span class="geodir-mobile-active-tab"><?php echo $active_tab_name; ?></span> |
@@ -1634,26 +1634,26 @@ discard block |
||
1634 | 1634 | * @since 1.0.0 |
1635 | 1635 | * @see 'geodir_after_tab_list' |
1636 | 1636 | */ |
1637 | - do_action( 'geodir_before_tab_list' ); ?> |
|
1637 | + do_action('geodir_before_tab_list'); ?> |
|
1638 | 1638 | <?php |
1639 | 1639 | |
1640 | - foreach ( $arr_detail_page_tabs as $tab_index => $detail_page_tab ) { |
|
1641 | - if ( $detail_page_tab['is_display'] ) { |
|
1640 | + foreach ($arr_detail_page_tabs as $tab_index => $detail_page_tab) { |
|
1641 | + if ($detail_page_tab['is_display']) { |
|
1642 | 1642 | |
1643 | - if ( ! $tab_list ) { |
|
1643 | + if (!$tab_list) { |
|
1644 | 1644 | ?> |
1645 | 1645 | <dt></dt> <!-- added to comply with validation --> |
1646 | - <dd <?php if ( $detail_page_tab['is_active_tab'] ){ ?>class="geodir-tab-active"<?php } ?> ><a |
|
1646 | + <dd <?php if ($detail_page_tab['is_active_tab']) { ?>class="geodir-tab-active"<?php } ?> ><a |
|
1647 | 1647 | data-tab="#<?php echo $tab_index; ?>" |
1648 | - data-status="enable"><?php _e( $detail_page_tab['heading_text'], 'geodirectory' ); ?></a> |
|
1648 | + data-status="enable"><?php _e($detail_page_tab['heading_text'], 'geodirectory'); ?></a> |
|
1649 | 1649 | </dd> |
1650 | 1650 | <?php |
1651 | 1651 | } |
1652 | 1652 | ob_start() // start tab content buffering |
1653 | 1653 | ?> |
1654 | 1654 | <li id="<?php echo $tab_index; ?>Tab"> |
1655 | - <?php if ( $tab_list ) { |
|
1656 | - $tab_title = '<span class="gd-tab-list-title" ><a href="#' . $tab_index . '">' . __( $detail_page_tab['heading_text'], 'geodirectory' ) . '</a></span><hr />'; |
|
1655 | + <?php if ($tab_list) { |
|
1656 | + $tab_title = '<span class="gd-tab-list-title" ><a href="#'.$tab_index.'">'.__($detail_page_tab['heading_text'], 'geodirectory').'</a></span><hr />'; |
|
1657 | 1657 | /** |
1658 | 1658 | * Filter the tab list title html. |
1659 | 1659 | * |
@@ -1663,7 +1663,7 @@ discard block |
||
1663 | 1663 | * @param string $tab_index The tab index type. |
1664 | 1664 | * @param array $detail_page_tab The array of values including title text. |
1665 | 1665 | */ |
1666 | - echo apply_filters( 'geodir_tab_list_title', $tab_title, $tab_index, $detail_page_tab ); |
|
1666 | + echo apply_filters('geodir_tab_list_title', $tab_title, $tab_index, $detail_page_tab); |
|
1667 | 1667 | } ?> |
1668 | 1668 | <div id="<?php echo $tab_index; ?>" class="hash-offset"></div> |
1669 | 1669 | <?php |
@@ -1674,7 +1674,7 @@ discard block |
||
1674 | 1674 | * |
1675 | 1675 | * @param string $tab_index The tab name ID. |
1676 | 1676 | */ |
1677 | - do_action( 'geodir_before_tab_content', $tab_index ); |
|
1677 | + do_action('geodir_before_tab_content', $tab_index); |
|
1678 | 1678 | |
1679 | 1679 | /** |
1680 | 1680 | * Called before the details tab content is output per tab. |
@@ -1684,21 +1684,21 @@ discard block |
||
1684 | 1684 | * @since 1.0.0 |
1685 | 1685 | * @todo do we need this if we have the hook above? 'geodir_before_tab_content' |
1686 | 1686 | */ |
1687 | - do_action( 'geodir_before_' . $tab_index . '_tab_content' ); |
|
1687 | + do_action('geodir_before_'.$tab_index.'_tab_content'); |
|
1688 | 1688 | /// write a code to generate content of each tab |
1689 | - switch ( $tab_index ) { |
|
1689 | + switch ($tab_index) { |
|
1690 | 1690 | case 'post_profile': |
1691 | 1691 | /** |
1692 | 1692 | * Called before the listing description content on the details page tab. |
1693 | 1693 | * |
1694 | 1694 | * @since 1.0.0 |
1695 | 1695 | */ |
1696 | - do_action( 'geodir_before_description_on_listing_detail' ); |
|
1697 | - if ( geodir_is_page( 'detail' ) ) { |
|
1696 | + do_action('geodir_before_description_on_listing_detail'); |
|
1697 | + if (geodir_is_page('detail')) { |
|
1698 | 1698 | the_content(); |
1699 | 1699 | } else { |
1700 | 1700 | /** This action is documented in geodirectory_template_actions.php */ |
1701 | - echo apply_filters( 'the_content', stripslashes( $post->post_desc ) ); |
|
1701 | + echo apply_filters('the_content', stripslashes($post->post_desc)); |
|
1702 | 1702 | } |
1703 | 1703 | |
1704 | 1704 | /** |
@@ -1706,7 +1706,7 @@ discard block |
||
1706 | 1706 | * |
1707 | 1707 | * @since 1.0.0 |
1708 | 1708 | */ |
1709 | - do_action( 'geodir_after_description_on_listing_detail' ); |
|
1709 | + do_action('geodir_after_description_on_listing_detail'); |
|
1710 | 1710 | break; |
1711 | 1711 | case 'post_info': |
1712 | 1712 | echo $geodir_post_detail_fields; |
@@ -1716,32 +1716,32 @@ discard block |
||
1716 | 1716 | break; |
1717 | 1717 | case 'post_video': |
1718 | 1718 | // some browsers hide $_POST data if used for embeds so we replace with a placeholder |
1719 | - if ( $preview ) { |
|
1720 | - if ( $video ) { |
|
1721 | - echo "<span class='gd-video-embed-preview' ><p class='gd-video-preview-text'><i class=\"fa fa-video-camera\" aria-hidden=\"true\"></i><br />" . __( 'Video Preview Placeholder', 'geodirectory' ) . "</p></span>"; |
|
1719 | + if ($preview) { |
|
1720 | + if ($video) { |
|
1721 | + echo "<span class='gd-video-embed-preview' ><p class='gd-video-preview-text'><i class=\"fa fa-video-camera\" aria-hidden=\"true\"></i><br />".__('Video Preview Placeholder', 'geodirectory')."</p></span>"; |
|
1722 | 1722 | } |
1723 | 1723 | } else { |
1724 | 1724 | |
1725 | 1725 | // stop payment manager filtering content length |
1726 | - $filter_priority = has_filter( 'the_content', 'geodir_payments_the_content' ); |
|
1727 | - if ( false !== $filter_priority ) { |
|
1728 | - remove_filter( 'the_content', 'geodir_payments_the_content', $filter_priority ); |
|
1726 | + $filter_priority = has_filter('the_content', 'geodir_payments_the_content'); |
|
1727 | + if (false !== $filter_priority) { |
|
1728 | + remove_filter('the_content', 'geodir_payments_the_content', $filter_priority); |
|
1729 | 1729 | } |
1730 | 1730 | |
1731 | 1731 | /** This action is documented in geodirectory_template_actions.php */ |
1732 | - echo apply_filters( 'the_content', stripslashes( $video ) );// we apply the_content filter so oembed works also; |
|
1732 | + echo apply_filters('the_content', stripslashes($video)); // we apply the_content filter so oembed works also; |
|
1733 | 1733 | |
1734 | - if ( false !== $filter_priority ) { |
|
1735 | - add_filter( 'the_content', 'geodir_payments_the_content', $filter_priority ); |
|
1734 | + if (false !== $filter_priority) { |
|
1735 | + add_filter('the_content', 'geodir_payments_the_content', $filter_priority); |
|
1736 | 1736 | } |
1737 | 1737 | } |
1738 | 1738 | break; |
1739 | 1739 | case 'special_offers': |
1740 | - echo apply_filters( 'gd_special_offers_content', wpautop( stripslashes( $special_offers ) ) ); |
|
1740 | + echo apply_filters('gd_special_offers_content', wpautop(stripslashes($special_offers))); |
|
1741 | 1741 | |
1742 | 1742 | break; |
1743 | 1743 | case 'post_map': |
1744 | - geodir_draw_map( $map_args ); |
|
1744 | + geodir_draw_map($map_args); |
|
1745 | 1745 | break; |
1746 | 1746 | case 'reviews': |
1747 | 1747 | comments_template(); |
@@ -1750,7 +1750,7 @@ discard block |
||
1750 | 1750 | echo $related_listing; |
1751 | 1751 | break; |
1752 | 1752 | default: { |
1753 | - if ( ( isset( $post->{$tab_index} ) || ( ! isset( $post->{$tab_index} ) && ( strpos( $tab_index, 'gd_tab_' ) !== false || $tab_index == 'link_business' ) ) ) && ! empty( $detail_page_tab['tab_content'] ) ) { |
|
1753 | + if ((isset($post->{$tab_index} ) || (!isset($post->{$tab_index} ) && (strpos($tab_index, 'gd_tab_') !== false || $tab_index == 'link_business'))) && !empty($detail_page_tab['tab_content'])) { |
|
1754 | 1754 | echo $detail_page_tab['tab_content']; |
1755 | 1755 | } |
1756 | 1756 | } |
@@ -1762,7 +1762,7 @@ discard block |
||
1762 | 1762 | * |
1763 | 1763 | * @since 1.0.0 |
1764 | 1764 | */ |
1765 | - do_action( 'geodir_after_tab_content', $tab_index ); |
|
1765 | + do_action('geodir_after_tab_content', $tab_index); |
|
1766 | 1766 | |
1767 | 1767 | /** |
1768 | 1768 | * Called after the details tab content is output per tab. |
@@ -1772,7 +1772,7 @@ discard block |
||
1772 | 1772 | * @since 1.0.0 |
1773 | 1773 | * @todo do we need this if we have the hook above? 'geodir_after_tab_content' |
1774 | 1774 | */ |
1775 | - do_action( 'geodir_after_' . $tab_index . '_tab_content' ); |
|
1775 | + do_action('geodir_after_'.$tab_index.'_tab_content'); |
|
1776 | 1776 | ?> </li> |
1777 | 1777 | <?php |
1778 | 1778 | /** |
@@ -1780,7 +1780,7 @@ discard block |
||
1780 | 1780 | * |
1781 | 1781 | * @since 1.0.0 |
1782 | 1782 | */ |
1783 | - $arr_detail_page_tabs[ $tab_index ]['tab_content'] = apply_filters( "geodir_modify_" . $detail_page_tab['tab_content'] . "_tab_content", ob_get_clean() ); |
|
1783 | + $arr_detail_page_tabs[$tab_index]['tab_content'] = apply_filters("geodir_modify_".$detail_page_tab['tab_content']."_tab_content", ob_get_clean()); |
|
1784 | 1784 | } // end of if for is_display |
1785 | 1785 | }// end of foreach |
1786 | 1786 | |
@@ -1790,14 +1790,14 @@ discard block |
||
1790 | 1790 | * @since 1.0.0 |
1791 | 1791 | * @see 'geodir_before_tab_list' |
1792 | 1792 | */ |
1793 | - do_action( 'geodir_after_tab_list' ); |
|
1793 | + do_action('geodir_after_tab_list'); |
|
1794 | 1794 | ?> |
1795 | - <?php if ( ! $tab_list ){ ?></dl><?php } ?> |
|
1796 | - <ul class="geodir-tabs-content entry-content <?php if ( $tab_list ) { ?>geodir-tabs-list<?php } ?>" |
|
1795 | + <?php if (!$tab_list) { ?></dl><?php } ?> |
|
1796 | + <ul class="geodir-tabs-content entry-content <?php if ($tab_list) { ?>geodir-tabs-list<?php } ?>" |
|
1797 | 1797 | style="position:relative;"> |
1798 | 1798 | <?php |
1799 | - foreach ( $arr_detail_page_tabs as $detail_page_tab ) { |
|
1800 | - if ( $detail_page_tab['is_display'] && ! empty( $detail_page_tab['tab_content'] ) ) { |
|
1799 | + foreach ($arr_detail_page_tabs as $detail_page_tab) { |
|
1800 | + if ($detail_page_tab['is_display'] && !empty($detail_page_tab['tab_content'])) { |
|
1801 | 1801 | echo $detail_page_tab['tab_content']; |
1802 | 1802 | }// end of if |
1803 | 1803 | }// end of foreach |
@@ -1807,11 +1807,11 @@ discard block |
||
1807 | 1807 | * |
1808 | 1808 | * @since 1.0.0 |
1809 | 1809 | */ |
1810 | - do_action( 'geodir_add_tab_content' ); ?> |
|
1810 | + do_action('geodir_add_tab_content'); ?> |
|
1811 | 1811 | </ul> |
1812 | 1812 | <!--gd-tabs-content ul end--> |
1813 | 1813 | </div> |
1814 | - <?php if ( ! $tab_list ) { ?> |
|
1814 | + <?php if (!$tab_list) { ?> |
|
1815 | 1815 | <script> |
1816 | 1816 | if (window.location.hash && window.location.hash.indexOf('&') === -1 && jQuery(window.location.hash + 'Tab').length) { |
1817 | 1817 | hashVal = window.location.hash; |
@@ -1843,31 +1843,31 @@ discard block |
||
1843 | 1843 | * |
1844 | 1844 | * @return mixed Image file. |
1845 | 1845 | */ |
1846 | -function geodir_exif( $file ) { |
|
1847 | - if ( empty( $file ) || ! is_array( $file ) ) { |
|
1846 | +function geodir_exif($file) { |
|
1847 | + if (empty($file) || !is_array($file)) { |
|
1848 | 1848 | return $file; |
1849 | 1849 | } |
1850 | 1850 | |
1851 | - $file_path = ! empty( $file['tmp_name'] ) ? sanitize_text_field( $file['tmp_name'] ) : ''; |
|
1852 | - if ( ! ( $file_path && file_exists( $file_path ) ) ) { |
|
1851 | + $file_path = !empty($file['tmp_name']) ? sanitize_text_field($file['tmp_name']) : ''; |
|
1852 | + if (!($file_path && file_exists($file_path))) { |
|
1853 | 1853 | return $file; |
1854 | 1854 | } |
1855 | 1855 | $file['file'] = $file_path; |
1856 | 1856 | |
1857 | - if ( ! file_is_valid_image( $file_path ) ) { |
|
1857 | + if (!file_is_valid_image($file_path)) { |
|
1858 | 1858 | return $file; // Bail if file is not an image. |
1859 | 1859 | } |
1860 | 1860 | |
1861 | - if ( ! function_exists( 'wp_get_image_editor' ) ) { |
|
1861 | + if (!function_exists('wp_get_image_editor')) { |
|
1862 | 1862 | return $file; |
1863 | 1863 | } |
1864 | 1864 | |
1865 | 1865 | $mime_type = $file['type']; |
1866 | 1866 | $exif = array(); |
1867 | - if ( $mime_type == 'image/jpeg' && function_exists( 'exif_read_data' ) ) { |
|
1867 | + if ($mime_type == 'image/jpeg' && function_exists('exif_read_data')) { |
|
1868 | 1868 | try { |
1869 | - $exif = exif_read_data( $file_path ); |
|
1870 | - } catch ( Exception $e ) { |
|
1869 | + $exif = exif_read_data($file_path); |
|
1870 | + } catch (Exception $e) { |
|
1871 | 1871 | $exif = array(); |
1872 | 1872 | } |
1873 | 1873 | } |
@@ -1876,13 +1876,13 @@ discard block |
||
1876 | 1876 | $flip = false; |
1877 | 1877 | $modify = false; |
1878 | 1878 | $orientation = 0; |
1879 | - if ( ! empty( $exif ) && isset( $exif['Orientation'] ) ) { |
|
1880 | - switch ( (int) $exif['Orientation'] ) { |
|
1879 | + if (!empty($exif) && isset($exif['Orientation'])) { |
|
1880 | + switch ((int) $exif['Orientation']) { |
|
1881 | 1881 | case 1: |
1882 | 1882 | // do nothing |
1883 | 1883 | break; |
1884 | 1884 | case 2: |
1885 | - $flip = array( false, true ); |
|
1885 | + $flip = array(false, true); |
|
1886 | 1886 | $modify = true; |
1887 | 1887 | break; |
1888 | 1888 | case 3: |
@@ -1891,13 +1891,13 @@ discard block |
||
1891 | 1891 | $modify = true; |
1892 | 1892 | break; |
1893 | 1893 | case 4: |
1894 | - $flip = array( true, false ); |
|
1894 | + $flip = array(true, false); |
|
1895 | 1895 | $modify = true; |
1896 | 1896 | break; |
1897 | 1897 | case 5: |
1898 | 1898 | $orientation = - 90; |
1899 | 1899 | $rotate = true; |
1900 | - $flip = array( false, true ); |
|
1900 | + $flip = array(false, true); |
|
1901 | 1901 | $modify = true; |
1902 | 1902 | break; |
1903 | 1903 | case 6: |
@@ -1908,7 +1908,7 @@ discard block |
||
1908 | 1908 | case 7: |
1909 | 1909 | $orientation = - 270; |
1910 | 1910 | $rotate = true; |
1911 | - $flip = array( false, true ); |
|
1911 | + $flip = array(false, true); |
|
1912 | 1912 | $modify = true; |
1913 | 1913 | break; |
1914 | 1914 | case 8: |
@@ -1934,31 +1934,31 @@ discard block |
||
1934 | 1934 | * @param int|null $quality Image Compression quality between 1-100% scale. Default null. |
1935 | 1935 | * @param string $quality Image mime type. |
1936 | 1936 | */ |
1937 | - $quality = apply_filters( 'geodir_image_upload_set_quality', $quality, $mime_type ); |
|
1938 | - if ( $quality !== null ) { |
|
1937 | + $quality = apply_filters('geodir_image_upload_set_quality', $quality, $mime_type); |
|
1938 | + if ($quality !== null) { |
|
1939 | 1939 | $modify = true; |
1940 | 1940 | } |
1941 | 1941 | |
1942 | - if ( ! $modify ) { |
|
1942 | + if (!$modify) { |
|
1943 | 1943 | return $file; // no change |
1944 | 1944 | } |
1945 | 1945 | |
1946 | - $image = wp_get_image_editor( $file_path ); |
|
1947 | - if ( ! is_wp_error( $image ) ) { |
|
1948 | - if ( $rotate ) { |
|
1949 | - $image->rotate( $orientation ); |
|
1946 | + $image = wp_get_image_editor($file_path); |
|
1947 | + if (!is_wp_error($image)) { |
|
1948 | + if ($rotate) { |
|
1949 | + $image->rotate($orientation); |
|
1950 | 1950 | } |
1951 | 1951 | |
1952 | - if ( ! empty( $flip ) ) { |
|
1953 | - $image->flip( $flip[0], $flip[1] ); |
|
1952 | + if (!empty($flip)) { |
|
1953 | + $image->flip($flip[0], $flip[1]); |
|
1954 | 1954 | } |
1955 | 1955 | |
1956 | - if ( $quality !== null ) { |
|
1957 | - $image->set_quality( (int) $quality ); |
|
1956 | + if ($quality !== null) { |
|
1957 | + $image->set_quality((int) $quality); |
|
1958 | 1958 | } |
1959 | 1959 | |
1960 | - $result = $image->save( $file_path ); |
|
1961 | - if ( ! is_wp_error( $result ) ) { |
|
1960 | + $result = $image->save($file_path); |
|
1961 | + if (!is_wp_error($result)) { |
|
1962 | 1962 | $file['file'] = $result['path']; |
1963 | 1963 | $file['tmp_name'] = $result['path']; |
1964 | 1964 | } |
@@ -1986,7 +1986,7 @@ discard block |
||
1986 | 1986 | * |
1987 | 1987 | * @return string Returns the recent reviews html. |
1988 | 1988 | */ |
1989 | -function geodir_get_recent_reviews( $g_size = 60, $no_comments = 5, $comment_lenth = 60, $show_pass_post = false ) { |
|
1989 | +function geodir_get_recent_reviews($g_size = 60, $no_comments = 5, $comment_lenth = 60, $show_pass_post = false) { |
|
1990 | 1990 | global $wpdb, $tablecomments, $tableposts, $rating_table_name, $gd_session, $table_prefix; |
1991 | 1991 | $tablecomments = $wpdb->comments; |
1992 | 1992 | $tableposts = $wpdb->posts; |
@@ -1996,17 +1996,17 @@ discard block |
||
1996 | 1996 | $region_filter = ''; |
1997 | 1997 | $country_filter = ''; |
1998 | 1998 | |
1999 | - if ( $gd_session->get( 'gd_multi_location' ) ) { |
|
2000 | - if ( $gd_ses_country = $gd_session->get( 'gd_country' ) ) { |
|
2001 | - $country_filter = $wpdb->prepare( " AND r.post_country=%s ", str_replace( "-", " ", $gd_ses_country ) ); |
|
1999 | + if ($gd_session->get('gd_multi_location')) { |
|
2000 | + if ($gd_ses_country = $gd_session->get('gd_country')) { |
|
2001 | + $country_filter = $wpdb->prepare(" AND r.post_country=%s ", str_replace("-", " ", $gd_ses_country)); |
|
2002 | 2002 | } |
2003 | 2003 | |
2004 | - if ( $gd_ses_region = $gd_session->get( 'gd_region' ) ) { |
|
2005 | - $region_filter = $wpdb->prepare( " AND r.post_region=%s ", str_replace( "-", " ", $gd_ses_region ) ); |
|
2004 | + if ($gd_ses_region = $gd_session->get('gd_region')) { |
|
2005 | + $region_filter = $wpdb->prepare(" AND r.post_region=%s ", str_replace("-", " ", $gd_ses_region)); |
|
2006 | 2006 | } |
2007 | 2007 | |
2008 | - if ( $gd_ses_city = $gd_session->get( 'gd_city' ) ) { |
|
2009 | - $city_filter = $wpdb->prepare( " AND r.post_city=%s ", str_replace( "-", " ", $gd_ses_city ) ); |
|
2008 | + if ($gd_ses_city = $gd_session->get('gd_city')) { |
|
2009 | + $city_filter = $wpdb->prepare(" AND r.post_city=%s ", str_replace("-", " ", $gd_ses_city)); |
|
2010 | 2010 | } |
2011 | 2011 | } |
2012 | 2012 | |
@@ -2017,84 +2017,84 @@ discard block |
||
2017 | 2017 | $lang_code = ICL_LANGUAGE_CODE; |
2018 | 2018 | |
2019 | 2019 | if ($lang_code) { |
2020 | - $join .= " JOIN " . $table_prefix . "icl_translations AS icltr2 ON icltr2.element_id = c.comment_post_ID AND p.ID = icltr2.element_id AND CONCAT('post_', p.post_type) = icltr2.element_type LEFT JOIN " . $table_prefix . "icl_translations AS icltr_comment ON icltr_comment.element_id = c.comment_ID AND icltr_comment.element_type = 'comment'"; |
|
2021 | - $where .= " AND icltr2.language_code = '" . $lang_code . "' AND (icltr_comment.language_code IS NULL OR icltr_comment.language_code = icltr2.language_code)"; |
|
2020 | + $join .= " JOIN ".$table_prefix."icl_translations AS icltr2 ON icltr2.element_id = c.comment_post_ID AND p.ID = icltr2.element_id AND CONCAT('post_', p.post_type) = icltr2.element_type LEFT JOIN ".$table_prefix."icl_translations AS icltr_comment ON icltr_comment.element_id = c.comment_ID AND icltr_comment.element_type = 'comment'"; |
|
2021 | + $where .= " AND icltr2.language_code = '".$lang_code."' AND (icltr_comment.language_code IS NULL OR icltr_comment.language_code = icltr2.language_code)"; |
|
2022 | 2022 | } |
2023 | 2023 | } |
2024 | 2024 | |
2025 | - $request = "SELECT r.id AS ID, r.post_type, r.comment_id AS comment_ID, r.post_date AS comment_date, r.overall_rating, r.user_id, r.post_id FROM " . GEODIR_REVIEW_TABLE . " AS r JOIN " . $wpdb->comments . " AS c ON c.comment_ID = r.comment_id JOIN " . $wpdb->posts . " AS p ON p.ID = c.comment_post_ID " . $join . " WHERE c.comment_parent = 0 AND c.comment_approved = 1 AND r.status = 1 AND r.overall_rating >= 1 AND p.post_status = 'publish' " . $where . " ORDER BY r.post_date DESC, r.id DESC LIMIT ". $no_comments; |
|
2025 | + $request = "SELECT r.id AS ID, r.post_type, r.comment_id AS comment_ID, r.post_date AS comment_date, r.overall_rating, r.user_id, r.post_id FROM ".GEODIR_REVIEW_TABLE." AS r JOIN ".$wpdb->comments." AS c ON c.comment_ID = r.comment_id JOIN ".$wpdb->posts." AS p ON p.ID = c.comment_post_ID ".$join." WHERE c.comment_parent = 0 AND c.comment_approved = 1 AND r.status = 1 AND r.overall_rating >= 1 AND p.post_status = 'publish' ".$where." ORDER BY r.post_date DESC, r.id DESC LIMIT ".$no_comments; |
|
2026 | 2026 | |
2027 | - $comments = $wpdb->get_results( $request ); |
|
2027 | + $comments = $wpdb->get_results($request); |
|
2028 | 2028 | |
2029 | - foreach ( $comments as $comment ) { |
|
2029 | + foreach ($comments as $comment) { |
|
2030 | 2030 | // Set the extra comment info needed. |
2031 | - $comment_extra = $wpdb->get_row( "SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID" ); |
|
2031 | + $comment_extra = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID"); |
|
2032 | 2032 | $comment->comment_content = $comment_extra->comment_content; |
2033 | 2033 | $comment->comment_author = $comment_extra->comment_author; |
2034 | 2034 | $comment->comment_author_email = $comment_extra->comment_author_email; |
2035 | 2035 | |
2036 | 2036 | $comment_id = ''; |
2037 | 2037 | $comment_id = $comment->comment_ID; |
2038 | - $comment_content = strip_tags( $comment->comment_content ); |
|
2038 | + $comment_content = strip_tags($comment->comment_content); |
|
2039 | 2039 | |
2040 | - $comment_content = preg_replace( '#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content ); |
|
2040 | + $comment_content = preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content); |
|
2041 | 2041 | |
2042 | - $permalink = get_permalink( $comment->ID ) . "#comment-" . $comment->comment_ID; |
|
2042 | + $permalink = get_permalink($comment->ID)."#comment-".$comment->comment_ID; |
|
2043 | 2043 | $comment_author_email = $comment->comment_author_email; |
2044 | 2044 | $comment_post_ID = $comment->post_id; |
2045 | 2045 | |
2046 | - $post_title = get_the_title( $comment_post_ID ); |
|
2047 | - $permalink = get_permalink( $comment_post_ID ); |
|
2048 | - $comment_permalink = $permalink . "#comment-" . $comment->comment_ID; |
|
2049 | - $read_more = '<a class="comment_excerpt" href="' . $comment_permalink . '">' . __( 'Read more', 'geodirectory' ) . '</a>'; |
|
2046 | + $post_title = get_the_title($comment_post_ID); |
|
2047 | + $permalink = get_permalink($comment_post_ID); |
|
2048 | + $comment_permalink = $permalink."#comment-".$comment->comment_ID; |
|
2049 | + $read_more = '<a class="comment_excerpt" href="'.$comment_permalink.'">'.__('Read more', 'geodirectory').'</a>'; |
|
2050 | 2050 | |
2051 | - $comment_content_length = strlen( $comment_content ); |
|
2052 | - if ( $comment_content_length > $comment_lenth ) { |
|
2053 | - $comment_excerpt = geodir_utf8_substr( $comment_content, 0, $comment_lenth ) . '... ' . $read_more; |
|
2051 | + $comment_content_length = strlen($comment_content); |
|
2052 | + if ($comment_content_length > $comment_lenth) { |
|
2053 | + $comment_excerpt = geodir_utf8_substr($comment_content, 0, $comment_lenth).'... '.$read_more; |
|
2054 | 2054 | } else { |
2055 | 2055 | $comment_excerpt = $comment_content; |
2056 | 2056 | } |
2057 | 2057 | |
2058 | - if ( $comment->user_id ) { |
|
2059 | - $user_profile_url = get_author_posts_url( $comment->user_id ); |
|
2058 | + if ($comment->user_id) { |
|
2059 | + $user_profile_url = get_author_posts_url($comment->user_id); |
|
2060 | 2060 | } else { |
2061 | 2061 | $user_profile_url = ''; |
2062 | 2062 | } |
2063 | 2063 | |
2064 | - if ( $comment_id ) { |
|
2064 | + if ($comment_id) { |
|
2065 | 2065 | $comments_echo .= '<li class="clearfix">'; |
2066 | - $comments_echo .= "<span class=\"li" . $comment_id . " geodir_reviewer_image\">"; |
|
2067 | - if ( function_exists( 'get_avatar' ) ) { |
|
2068 | - if ( ! isset( $comment->comment_type ) ) { |
|
2069 | - if ( $user_profile_url ) { |
|
2070 | - $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
2066 | + $comments_echo .= "<span class=\"li".$comment_id." geodir_reviewer_image\">"; |
|
2067 | + if (function_exists('get_avatar')) { |
|
2068 | + if (!isset($comment->comment_type)) { |
|
2069 | + if ($user_profile_url) { |
|
2070 | + $comments_echo .= '<a href="'.$user_profile_url.'">'; |
|
2071 | 2071 | } |
2072 | - $comments_echo .= get_avatar( $comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' ); |
|
2073 | - if ( $user_profile_url ) { |
|
2072 | + $comments_echo .= get_avatar($comment->comment_author_email, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png'); |
|
2073 | + if ($user_profile_url) { |
|
2074 | 2074 | $comments_echo .= '</a>'; |
2075 | 2075 | } |
2076 | - } elseif ( ( isset( $comment->comment_type ) && $comment->comment_type == 'trackback' ) || ( isset( $comment->comment_type ) && $comment->comment_type == 'pingback' ) ) { |
|
2077 | - if ( $user_profile_url ) { |
|
2078 | - $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
2076 | + } elseif ((isset($comment->comment_type) && $comment->comment_type == 'trackback') || (isset($comment->comment_type) && $comment->comment_type == 'pingback')) { |
|
2077 | + if ($user_profile_url) { |
|
2078 | + $comments_echo .= '<a href="'.$user_profile_url.'">'; |
|
2079 | 2079 | } |
2080 | - $comments_echo .= get_avatar( $comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' ); |
|
2080 | + $comments_echo .= get_avatar($comment->comment_author_url, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png'); |
|
2081 | 2081 | } |
2082 | - } elseif ( function_exists( 'gravatar' ) ) { |
|
2083 | - if ( $user_profile_url ) { |
|
2084 | - $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
2082 | + } elseif (function_exists('gravatar')) { |
|
2083 | + if ($user_profile_url) { |
|
2084 | + $comments_echo .= '<a href="'.$user_profile_url.'">'; |
|
2085 | 2085 | } |
2086 | 2086 | $comments_echo .= "<img src=\""; |
2087 | - if ( '' == $comment->comment_type ) { |
|
2088 | - $comments_echo .= gravatar( $comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' ); |
|
2089 | - if ( $user_profile_url ) { |
|
2087 | + if ('' == $comment->comment_type) { |
|
2088 | + $comments_echo .= gravatar($comment->comment_author_email, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png'); |
|
2089 | + if ($user_profile_url) { |
|
2090 | 2090 | $comments_echo .= '</a>'; |
2091 | 2091 | } |
2092 | - } elseif ( ( 'trackback' == $comment->comment_type ) || ( 'pingback' == $comment->comment_type ) ) { |
|
2093 | - if ( $user_profile_url ) { |
|
2094 | - $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
2092 | + } elseif (('trackback' == $comment->comment_type) || ('pingback' == $comment->comment_type)) { |
|
2093 | + if ($user_profile_url) { |
|
2094 | + $comments_echo .= '<a href="'.$user_profile_url.'">'; |
|
2095 | 2095 | } |
2096 | - $comments_echo .= gravatar( $comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' ); |
|
2097 | - if ( $user_profile_url ) { |
|
2096 | + $comments_echo .= gravatar($comment->comment_author_url, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png'); |
|
2097 | + if ($user_profile_url) { |
|
2098 | 2098 | $comments_echo .= '</a>'; |
2099 | 2099 | } |
2100 | 2100 | } |
@@ -2105,17 +2105,17 @@ discard block |
||
2105 | 2105 | |
2106 | 2106 | $comments_echo .= '<span class="geodir_reviewer_content">'; |
2107 | 2107 | $author_link = apply_filters('geodir_reviewer_content_author_link', true); |
2108 | - if ( $comment->user_id && $author_link ) { |
|
2109 | - $comments_echo .= '<a href="' . get_author_posts_url( $comment->user_id ) . '">'; |
|
2108 | + if ($comment->user_id && $author_link) { |
|
2109 | + $comments_echo .= '<a href="'.get_author_posts_url($comment->user_id).'">'; |
|
2110 | 2110 | } |
2111 | - $comments_echo .= '<span class="geodir_reviewer_author">' . $comment->comment_author . '</span> '; |
|
2112 | - if ( $comment->user_id && $author_link ) { |
|
2111 | + $comments_echo .= '<span class="geodir_reviewer_author">'.$comment->comment_author.'</span> '; |
|
2112 | + if ($comment->user_id && $author_link) { |
|
2113 | 2113 | $comments_echo .= '</a>'; |
2114 | 2114 | } |
2115 | - $comments_echo .= '<span class="geodir_reviewer_reviewed">' . __( 'reviewed', 'geodirectory' ) . '</span> '; |
|
2116 | - $comments_echo .= '<a href="' . $permalink . '" class="geodir_reviewer_title">' . $post_title . '</a>'; |
|
2117 | - $comments_echo .= geodir_get_rating_stars( $comment->overall_rating, $comment_post_ID ); |
|
2118 | - $comments_echo .= '<p class="geodir_reviewer_text">' . $comment_excerpt . ''; |
|
2115 | + $comments_echo .= '<span class="geodir_reviewer_reviewed">'.__('reviewed', 'geodirectory').'</span> '; |
|
2116 | + $comments_echo .= '<a href="'.$permalink.'" class="geodir_reviewer_title">'.$post_title.'</a>'; |
|
2117 | + $comments_echo .= geodir_get_rating_stars($comment->overall_rating, $comment_post_ID); |
|
2118 | + $comments_echo .= '<p class="geodir_reviewer_text">'.$comment_excerpt.''; |
|
2119 | 2119 | //echo preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_excerpt); |
2120 | 2120 | $comments_echo .= '</p>'; |
2121 | 2121 | |
@@ -2135,25 +2135,25 @@ discard block |
||
2135 | 2135 | * @return array Returns post categories as an array. |
2136 | 2136 | */ |
2137 | 2137 | function geodir_home_map_cats_key_value_array() { |
2138 | - $post_types = geodir_get_posttypes( 'object' ); |
|
2138 | + $post_types = geodir_get_posttypes('object'); |
|
2139 | 2139 | |
2140 | 2140 | $return = array(); |
2141 | - if ( ! empty( $post_types ) ) { |
|
2142 | - foreach ( $post_types as $key => $post_type ) { |
|
2143 | - $cpt_name = __( $post_type->labels->singular_name, 'geodirectory' ); |
|
2144 | - $post_type_name = sprintf( __( '%s Categories', 'geodirectory' ), $cpt_name ); |
|
2145 | - $taxonomies = geodir_get_taxonomies( $key ); |
|
2146 | - $cat_taxonomy = ! empty( $taxonomies[0] ) ? $taxonomies[0] : null; |
|
2147 | - $cat_terms = $cat_taxonomy ? get_terms( $cat_taxonomy ) : null; |
|
2148 | - |
|
2149 | - if ( ! empty( $cat_terms ) ) { |
|
2150 | - $return[ 'optgroup_start-' . $key ] = $post_type_name; |
|
2151 | - |
|
2152 | - foreach ( $cat_terms as $cat_term ) { |
|
2153 | - $return[ $key . '_' . $cat_term->term_id ] = $cat_term->name; |
|
2141 | + if (!empty($post_types)) { |
|
2142 | + foreach ($post_types as $key => $post_type) { |
|
2143 | + $cpt_name = __($post_type->labels->singular_name, 'geodirectory'); |
|
2144 | + $post_type_name = sprintf(__('%s Categories', 'geodirectory'), $cpt_name); |
|
2145 | + $taxonomies = geodir_get_taxonomies($key); |
|
2146 | + $cat_taxonomy = !empty($taxonomies[0]) ? $taxonomies[0] : null; |
|
2147 | + $cat_terms = $cat_taxonomy ? get_terms($cat_taxonomy) : null; |
|
2148 | + |
|
2149 | + if (!empty($cat_terms)) { |
|
2150 | + $return['optgroup_start-'.$key] = $post_type_name; |
|
2151 | + |
|
2152 | + foreach ($cat_terms as $cat_term) { |
|
2153 | + $return[$key.'_'.$cat_term->term_id] = $cat_term->name; |
|
2154 | 2154 | } |
2155 | 2155 | |
2156 | - $return[ 'optgroup_end-' . $key ] = $post_type_name; |
|
2156 | + $return['optgroup_end-'.$key] = $post_type_name; |
|
2157 | 2157 | } |
2158 | 2158 | } |
2159 | 2159 | } |
@@ -2169,14 +2169,14 @@ discard block |
||
2169 | 2169 | * @package GeoDirectory |
2170 | 2170 | */ |
2171 | 2171 | function geodir_twitter_tweet_button() { |
2172 | - if ( isset( $_GET['gde'] ) ) { |
|
2173 | - $link = '?url=' . urlencode( geodir_curPageURL() ); |
|
2172 | + if (isset($_GET['gde'])) { |
|
2173 | + $link = '?url='.urlencode(geodir_curPageURL()); |
|
2174 | 2174 | } else { |
2175 | 2175 | $link = ''; |
2176 | 2176 | } |
2177 | 2177 | ?> |
2178 | 2178 | <a href="http://twitter.com/share<?php echo $link; ?>" |
2179 | - class="twitter-share-button"><?php _e( 'Tweet', 'geodirectory' ); ?></a> |
|
2179 | + class="twitter-share-button"><?php _e('Tweet', 'geodirectory'); ?></a> |
|
2180 | 2180 | <script type="text/javascript" src="//platform.twitter.com/widgets.js"></script> |
2181 | 2181 | <?php |
2182 | 2182 | } |
@@ -2193,10 +2193,10 @@ discard block |
||
2193 | 2193 | function geodir_fb_like_button() { |
2194 | 2194 | global $post; |
2195 | 2195 | ?> |
2196 | - <iframe <?php if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE' ) !== false ) ) { |
|
2196 | + <iframe <?php if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) { |
|
2197 | 2197 | echo 'allowtransparency="true"'; |
2198 | 2198 | } ?> class="facebook" |
2199 | - src="//www.facebook.com/plugins/like.php?href=<?php echo urlencode( get_permalink( $post->ID ) ); ?>&layout=button_count&show_faces=false&width=100&action=like&colorscheme=light" |
|
2199 | + src="//www.facebook.com/plugins/like.php?href=<?php echo urlencode(get_permalink($post->ID)); ?>&layout=button_count&show_faces=false&width=100&action=like&colorscheme=light" |
|
2200 | 2200 | style="border:none; overflow:hidden; width:100px; height:20px"></iframe> |
2201 | 2201 | <?php |
2202 | 2202 | } |
@@ -2227,7 +2227,7 @@ discard block |
||
2227 | 2227 | |
2228 | 2228 | |
2229 | 2229 | function geodir_listing_bounce_map_pin_on_hover() { |
2230 | - if ( get_option( 'geodir_listing_hover_bounce_map_pin', true ) ) { |
|
2230 | + if (get_option('geodir_listing_hover_bounce_map_pin', true)) { |
|
2231 | 2231 | ?> |
2232 | 2232 | <script> |
2233 | 2233 | jQuery(function ($) { |
@@ -2250,44 +2250,44 @@ discard block |
||
2250 | 2250 | } |
2251 | 2251 | } |
2252 | 2252 | |
2253 | -add_action( 'geodir_after_listing_listview', 'geodir_listing_bounce_map_pin_on_hover', 10 ); |
|
2253 | +add_action('geodir_after_listing_listview', 'geodir_listing_bounce_map_pin_on_hover', 10); |
|
2254 | 2254 | |
2255 | -add_action( 'geodir_after_favorite_html', 'geodir_output_favourite_html_listings', 1, 1 ); |
|
2256 | -function geodir_output_favourite_html_listings( $post_id ) { |
|
2257 | - geodir_favourite_html( '', $post_id ); |
|
2255 | +add_action('geodir_after_favorite_html', 'geodir_output_favourite_html_listings', 1, 1); |
|
2256 | +function geodir_output_favourite_html_listings($post_id) { |
|
2257 | + geodir_favourite_html('', $post_id); |
|
2258 | 2258 | } |
2259 | 2259 | |
2260 | -add_action( 'geodir_listing_after_pinpoint', 'geodir_output_pinpoint_html_listings', 1, 2 ); |
|
2261 | -function geodir_output_pinpoint_html_listings( $post_id, $post = array() ) { |
|
2260 | +add_action('geodir_listing_after_pinpoint', 'geodir_output_pinpoint_html_listings', 1, 2); |
|
2261 | +function geodir_output_pinpoint_html_listings($post_id, $post = array()) { |
|
2262 | 2262 | global $wp_query; |
2263 | 2263 | |
2264 | 2264 | $show_pin_point = $wp_query->is_main_query(); |
2265 | 2265 | |
2266 | - if ( ! empty( $post ) && ! empty( $show_pin_point ) && is_active_widget( false, "", "geodir_map_v3_listing_map" ) ) { |
|
2267 | - $term_icon_url = geodir_get_tax_meta( $post->default_category, 'ct_cat_icon', false, $post->post_type ); |
|
2268 | - $marker_icon = isset( $term_icon_url['src'] ) ? $term_icon_url['src'] : get_option( 'geodir_default_marker_icon' ); |
|
2266 | + if (!empty($post) && !empty($show_pin_point) && is_active_widget(false, "", "geodir_map_v3_listing_map")) { |
|
2267 | + $term_icon_url = geodir_get_tax_meta($post->default_category, 'ct_cat_icon', false, $post->post_type); |
|
2268 | + $marker_icon = isset($term_icon_url['src']) ? $term_icon_url['src'] : get_option('geodir_default_marker_icon'); |
|
2269 | 2269 | ?> |
2270 | 2270 | <span class="geodir-pinpoint" |
2271 | - style="background:url('<?php echo $marker_icon; ?>') no-repeat scroll left top transparent;background-size:auto 100%; -webkit-background-size:auto 100%;-moz-background-size:auto 100%;height:9px;width:14px;"><?php echo apply_filters( 'geodir_listing_listview_pinpoint_inner_content', '', 'listing' ); ?></span> |
|
2271 | + style="background:url('<?php echo $marker_icon; ?>') no-repeat scroll left top transparent;background-size:auto 100%; -webkit-background-size:auto 100%;-moz-background-size:auto 100%;height:9px;width:14px;"><?php echo apply_filters('geodir_listing_listview_pinpoint_inner_content', '', 'listing'); ?></span> |
|
2272 | 2272 | <a class="geodir-pinpoint-link" href="javascript:void(0)" |
2273 | 2273 | onclick="if(typeof openMarker=='function'){openMarker('listing_map_canvas' ,'<?php echo $post->ID; ?>')}" |
2274 | 2274 | onmouseover="if(typeof animate_marker=='function'){animate_marker('listing_map_canvas' ,'<?php echo $post->ID; ?>')}" |
2275 | - onmouseout="if(typeof stop_marker_animation=='function'){stop_marker_animation('listing_map_canvas' ,'<?php echo $post->ID; ?>')}"><?php _e( 'Pinpoint', 'geodirectory' ); ?></a> |
|
2275 | + onmouseout="if(typeof stop_marker_animation=='function'){stop_marker_animation('listing_map_canvas' ,'<?php echo $post->ID; ?>')}"><?php _e('Pinpoint', 'geodirectory'); ?></a> |
|
2276 | 2276 | <?php |
2277 | 2277 | } |
2278 | 2278 | } |
2279 | 2279 | |
2280 | 2280 | function geodir_search_form_submit_button() { |
2281 | 2281 | |
2282 | - $new_style = get_option( 'geodir_show_search_old_search_from' ) ? false : true; |
|
2282 | + $new_style = get_option('geodir_show_search_old_search_from') ? false : true; |
|
2283 | 2283 | |
2284 | - if ( $new_style ) { |
|
2284 | + if ($new_style) { |
|
2285 | 2285 | $default_search_button_label = '<i class="fa fa-search" aria-hidden="true"></i>'; |
2286 | - }else{ |
|
2286 | + } else { |
|
2287 | 2287 | $default_search_button_label = 'Search'; |
2288 | 2288 | } |
2289 | - if ( get_option( 'geodir_search_button_label' ) && get_option( 'geodir_search_button_label' ) != 'Search' ) { |
|
2290 | - $default_search_button_label = __( get_option( 'geodir_search_button_label' ), 'geodirectory' ); |
|
2289 | + if (get_option('geodir_search_button_label') && get_option('geodir_search_button_label') != 'Search') { |
|
2290 | + $default_search_button_label = __(get_option('geodir_search_button_label'), 'geodirectory'); |
|
2291 | 2291 | } |
2292 | 2292 | |
2293 | 2293 | /** |
@@ -2299,78 +2299,78 @@ discard block |
||
2299 | 2299 | * |
2300 | 2300 | * @param string $default_search_button_label The current search button text. |
2301 | 2301 | */ |
2302 | - $default_search_button_label = apply_filters( 'geodir_search_default_search_button_text', $default_search_button_label ); |
|
2302 | + $default_search_button_label = apply_filters('geodir_search_default_search_button_text', $default_search_button_label); |
|
2303 | 2303 | |
2304 | 2304 | $fa_class = ''; |
2305 | - if ( strpos( $default_search_button_label, '&#' ) !== false ) { |
|
2305 | + if (strpos($default_search_button_label, '&#') !== false) { |
|
2306 | 2306 | $fa_class = 'fa'; |
2307 | 2307 | } |
2308 | 2308 | |
2309 | 2309 | |
2310 | - if ( $new_style ) { |
|
2310 | + if ($new_style) { |
|
2311 | 2311 | ?> |
2312 | - <button class="geodir_submit_search <?php echo $fa_class; ?>"><?php _e( $default_search_button_label ,'geodirectory'); ?></button> |
|
2313 | - <?php }else{?> |
|
2314 | - <input type="button" value="<?php esc_attr_e( $default_search_button_label ); ?>" |
|
2312 | + <button class="geodir_submit_search <?php echo $fa_class; ?>"><?php _e($default_search_button_label, 'geodirectory'); ?></button> |
|
2313 | + <?php } else {?> |
|
2314 | + <input type="button" value="<?php esc_attr_e($default_search_button_label); ?>" |
|
2315 | 2315 | class="geodir_submit_search <?php echo $fa_class; ?>"/> |
2316 | 2316 | <?php } |
2317 | 2317 | } |
2318 | 2318 | |
2319 | -add_action( 'geodir_before_search_button', 'geodir_search_form_submit_button', 5000 ); |
|
2319 | +add_action('geodir_before_search_button', 'geodir_search_form_submit_button', 5000); |
|
2320 | 2320 | |
2321 | 2321 | function geodir_search_form_post_type_input() { |
2322 | 2322 | global $geodir_search_post_type; |
2323 | - $post_types = apply_filters( 'geodir_search_form_post_types', geodir_get_posttypes( 'object' ) ); |
|
2323 | + $post_types = apply_filters('geodir_search_form_post_types', geodir_get_posttypes('object')); |
|
2324 | 2324 | $curr_post_type = $geodir_search_post_type; |
2325 | 2325 | |
2326 | - if ( ! empty( $post_types ) && count( (array) $post_types ) > 1 ) { |
|
2326 | + if (!empty($post_types) && count((array) $post_types) > 1) { |
|
2327 | 2327 | |
2328 | - foreach ( $post_types as $post_type => $info ){ |
|
2328 | + foreach ($post_types as $post_type => $info) { |
|
2329 | 2329 | global $wpdb; |
2330 | - $has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) ); |
|
2331 | - if ( ! $has_posts ) { |
|
2330 | + $has_posts = $wpdb->get_row($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type)); |
|
2331 | + if (!$has_posts) { |
|
2332 | 2332 | unset($post_types->{$post_type}); |
2333 | 2333 | } |
2334 | 2334 | } |
2335 | 2335 | |
2336 | - if ( ! empty( $post_types ) && count( (array) $post_types ) > 1 ) { |
|
2336 | + if (!empty($post_types) && count((array) $post_types) > 1) { |
|
2337 | 2337 | |
2338 | - $new_style = get_option( 'geodir_show_search_old_search_from' ) ? false : true; |
|
2339 | - if ( $new_style ) { |
|
2338 | + $new_style = get_option('geodir_show_search_old_search_from') ? false : true; |
|
2339 | + if ($new_style) { |
|
2340 | 2340 | echo "<div class='gd-search-input-wrapper gd-search-field-cpt'>"; |
2341 | 2341 | } |
2342 | 2342 | ?> |
2343 | 2343 | <select name="stype" class="search_by_post"> |
2344 | - <?php foreach ( $post_types as $post_type => $info ): |
|
2344 | + <?php foreach ($post_types as $post_type => $info): |
|
2345 | 2345 | global $wpdb; |
2346 | 2346 | ?> |
2347 | 2347 | |
2348 | - <option data-label="<?php echo get_post_type_archive_link( $post_type ); ?>" |
|
2349 | - value="<?php echo $post_type; ?>" <?php if ( isset( $_REQUEST['stype'] ) ) { |
|
2350 | - if ( $post_type == $_REQUEST['stype'] ) { |
|
2348 | + <option data-label="<?php echo get_post_type_archive_link($post_type); ?>" |
|
2349 | + value="<?php echo $post_type; ?>" <?php if (isset($_REQUEST['stype'])) { |
|
2350 | + if ($post_type == $_REQUEST['stype']) { |
|
2351 | 2351 | echo 'selected="selected"'; |
2352 | 2352 | } |
2353 | - } elseif ( $curr_post_type == $post_type ) { |
|
2353 | + } elseif ($curr_post_type == $post_type) { |
|
2354 | 2354 | echo 'selected="selected"'; |
2355 | - } ?>><?php _e( geodir_utf8_ucfirst( $info->labels->name ), 'geodirectory' ); ?></option> |
|
2355 | + } ?>><?php _e(geodir_utf8_ucfirst($info->labels->name), 'geodirectory'); ?></option> |
|
2356 | 2356 | |
2357 | 2357 | <?php endforeach; ?> |
2358 | 2358 | </select> |
2359 | 2359 | <?php |
2360 | - if ( $new_style ) { |
|
2360 | + if ($new_style) { |
|
2361 | 2361 | echo "</div>"; |
2362 | 2362 | } |
2363 | - }else{ |
|
2364 | - if(! empty( $post_types )){ |
|
2365 | - $pt_arr = (array)$post_types; |
|
2366 | - echo '<input type="hidden" name="stype" value="' . key( $pt_arr ) . '" />'; |
|
2367 | - }else{ |
|
2363 | + } else { |
|
2364 | + if (!empty($post_types)) { |
|
2365 | + $pt_arr = (array) $post_types; |
|
2366 | + echo '<input type="hidden" name="stype" value="'.key($pt_arr).'" />'; |
|
2367 | + } else { |
|
2368 | 2368 | echo '<input type="hidden" name="stype" value="gd_place" />'; |
2369 | 2369 | } |
2370 | 2370 | |
2371 | 2371 | } |
2372 | 2372 | |
2373 | - }elseif ( ! empty( $post_types ) ) { |
|
2373 | + }elseif (!empty($post_types)) { |
|
2374 | 2374 | echo '<input type="hidden" name="stype" value="gd_place" />'; |
2375 | 2375 | } |
2376 | 2376 | } |
@@ -2378,28 +2378,28 @@ discard block |
||
2378 | 2378 | function geodir_search_form_search_input() { |
2379 | 2379 | |
2380 | 2380 | $default_search_for_text = SEARCH_FOR_TEXT; |
2381 | - if ( get_option( 'geodir_search_field_default_text' ) ) { |
|
2382 | - $default_search_for_text = __( get_option( 'geodir_search_field_default_text' ), 'geodirectory' ); |
|
2381 | + if (get_option('geodir_search_field_default_text')) { |
|
2382 | + $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory'); |
|
2383 | 2383 | } |
2384 | 2384 | |
2385 | 2385 | $new_style = get_option('geodir_show_search_old_search_from') ? false : true; |
2386 | - if($new_style){ |
|
2386 | + if ($new_style) { |
|
2387 | 2387 | echo "<div class='gd-search-input-wrapper gd-search-field-search'>"; |
2388 | 2388 | } |
2389 | 2389 | ?> |
2390 | 2390 | <input class="search_text" name="s" |
2391 | - value="<?php if ( isset( $_REQUEST['s'] ) && trim( $_REQUEST['s'] ) != '' ) { |
|
2392 | - $search_term = esc_attr( stripslashes_deep( $_REQUEST['s'] ) ); |
|
2393 | - $search_term = str_replace(array("%E2%80%99","’"),array("%27","'"),$search_term); |
|
2391 | + value="<?php if (isset($_REQUEST['s']) && trim($_REQUEST['s']) != '') { |
|
2392 | + $search_term = esc_attr(stripslashes_deep($_REQUEST['s'])); |
|
2393 | + $search_term = str_replace(array("%E2%80%99", "’"), array("%27", "'"), $search_term); |
|
2394 | 2394 | echo $search_term; |
2395 | 2395 | } else { |
2396 | 2396 | echo $default_search_for_text; |
2397 | 2397 | } ?>" type="text" |
2398 | - onblur="if (this.value.trim() == '') {this.value = '<?php echo esc_sql( $default_search_for_text ); ?>';}" |
|
2399 | - onfocus="if (this.value == '<?php echo esc_sql( $default_search_for_text ); ?>') {this.value = '';}" |
|
2398 | + onblur="if (this.value.trim() == '') {this.value = '<?php echo esc_sql($default_search_for_text); ?>';}" |
|
2399 | + onfocus="if (this.value == '<?php echo esc_sql($default_search_for_text); ?>') {this.value = '';}" |
|
2400 | 2400 | onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);"> |
2401 | 2401 | <?php |
2402 | - if($new_style){ |
|
2402 | + if ($new_style) { |
|
2403 | 2403 | echo "</div>"; |
2404 | 2404 | } |
2405 | 2405 | } |
@@ -2407,12 +2407,12 @@ discard block |
||
2407 | 2407 | function geodir_search_form_near_input() { |
2408 | 2408 | |
2409 | 2409 | $default_near_text = NEAR_TEXT; |
2410 | - if ( get_option( 'geodir_near_field_default_text' ) ) { |
|
2411 | - $default_near_text = __( get_option( 'geodir_near_field_default_text' ), 'geodirectory' ); |
|
2410 | + if (get_option('geodir_near_field_default_text')) { |
|
2411 | + $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory'); |
|
2412 | 2412 | } |
2413 | 2413 | |
2414 | - if ( isset( $_REQUEST['snear'] ) && $_REQUEST['snear'] != '' ) { |
|
2415 | - $near = esc_attr( stripslashes_deep( $_REQUEST['snear'] ) ); |
|
2414 | + if (isset($_REQUEST['snear']) && $_REQUEST['snear'] != '') { |
|
2415 | + $near = esc_attr(stripslashes_deep($_REQUEST['snear'])); |
|
2416 | 2416 | } else { |
2417 | 2417 | $near = $default_near_text; |
2418 | 2418 | } |
@@ -2426,7 +2426,7 @@ discard block |
||
2426 | 2426 | * @since 1.6.9 |
2427 | 2427 | * @param string $curr_post_type The current post type. |
2428 | 2428 | */ |
2429 | - $near_input_extra = apply_filters('geodir_near_input_extra','',$curr_post_type); |
|
2429 | + $near_input_extra = apply_filters('geodir_near_input_extra', '', $curr_post_type); |
|
2430 | 2430 | |
2431 | 2431 | |
2432 | 2432 | /** |
@@ -2439,7 +2439,7 @@ discard block |
||
2439 | 2439 | * @param string $near The current near value. |
2440 | 2440 | * @param string $default_near_text The default near value. |
2441 | 2441 | */ |
2442 | - $near = apply_filters( 'geodir_search_near_text', $near, $default_near_text ); |
|
2442 | + $near = apply_filters('geodir_search_near_text', $near, $default_near_text); |
|
2443 | 2443 | /** |
2444 | 2444 | * Filter the default "Near" text value for the search form. |
2445 | 2445 | * |
@@ -2450,7 +2450,7 @@ discard block |
||
2450 | 2450 | * @param string $near The current near value. |
2451 | 2451 | * @param string $default_near_text The default near value. |
2452 | 2452 | */ |
2453 | - $default_near_text = apply_filters( 'geodir_search_default_near_text', $default_near_text, $near ); |
|
2453 | + $default_near_text = apply_filters('geodir_search_default_near_text', $default_near_text, $near); |
|
2454 | 2454 | /** |
2455 | 2455 | * Filter the class for the near search input. |
2456 | 2456 | * |
@@ -2458,10 +2458,10 @@ discard block |
||
2458 | 2458 | * |
2459 | 2459 | * @param string $class The class for the HTML near input, default is blank. |
2460 | 2460 | */ |
2461 | - $near_class = apply_filters( 'geodir_search_near_class', '' ); |
|
2461 | + $near_class = apply_filters('geodir_search_near_class', ''); |
|
2462 | 2462 | |
2463 | 2463 | $new_style = get_option('geodir_show_search_old_search_from') ? false : true; |
2464 | - if($new_style){ |
|
2464 | + if ($new_style) { |
|
2465 | 2465 | echo "<div class='gd-search-input-wrapper gd-search-field-near' $near_input_extra>"; |
2466 | 2466 | |
2467 | 2467 | do_action('geodir_before_near_input'); |
@@ -2469,30 +2469,30 @@ discard block |
||
2469 | 2469 | |
2470 | 2470 | ?> |
2471 | 2471 | <input name="snear" class="snear <?php echo $near_class; ?>" type="text" value="<?php echo $near; ?>" |
2472 | - onblur="if (this.value.trim() == '') {this.value = ('<?php echo esc_sql( $near ); ?>' != '' ? '<?php echo esc_sql( $near ); ?>' : '<?php echo $default_near_text; ?>');}" |
|
2473 | - onfocus="if (this.value == '<?php echo $default_near_text; ?>' || this.value =='<?php echo esc_sql( $near ); ?>') {this.value = '';}" |
|
2474 | - onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);" <?php echo $near_input_extra;?>/> |
|
2472 | + onblur="if (this.value.trim() == '') {this.value = ('<?php echo esc_sql($near); ?>' != '' ? '<?php echo esc_sql($near); ?>' : '<?php echo $default_near_text; ?>');}" |
|
2473 | + onfocus="if (this.value == '<?php echo $default_near_text; ?>' || this.value =='<?php echo esc_sql($near); ?>') {this.value = '';}" |
|
2474 | + onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);" <?php echo $near_input_extra; ?>/> |
|
2475 | 2475 | <?php |
2476 | - if($new_style){ |
|
2476 | + if ($new_style) { |
|
2477 | 2477 | do_action('geodir_after_near_input'); |
2478 | 2478 | |
2479 | 2479 | echo "</div>"; |
2480 | 2480 | } |
2481 | 2481 | } |
2482 | 2482 | |
2483 | -add_action( 'geodir_search_form_inputs', 'geodir_search_form_post_type_input', 10 ); |
|
2484 | -add_action( 'geodir_search_form_inputs', 'geodir_search_form_search_input', 20 ); |
|
2485 | -add_action( 'geodir_search_form_inputs', 'geodir_search_form_near_input', 30 ); |
|
2483 | +add_action('geodir_search_form_inputs', 'geodir_search_form_post_type_input', 10); |
|
2484 | +add_action('geodir_search_form_inputs', 'geodir_search_form_search_input', 20); |
|
2485 | +add_action('geodir_search_form_inputs', 'geodir_search_form_near_input', 30); |
|
2486 | 2486 | |
2487 | -function geodir_get_search_post_type($pt=''){ |
|
2487 | +function geodir_get_search_post_type($pt = '') { |
|
2488 | 2488 | global $geodir_search_post_type; |
2489 | 2489 | |
2490 | - if($pt!=''){return $geodir_search_post_type = $pt;} |
|
2491 | - if(!empty($geodir_search_post_type)){ return $geodir_search_post_type;} |
|
2490 | + if ($pt != '') {return $geodir_search_post_type = $pt; } |
|
2491 | + if (!empty($geodir_search_post_type)) { return $geodir_search_post_type; } |
|
2492 | 2492 | |
2493 | 2493 | $geodir_search_post_type = geodir_get_current_posttype(); |
2494 | 2494 | |
2495 | - if(!$geodir_search_post_type) { |
|
2495 | + if (!$geodir_search_post_type) { |
|
2496 | 2496 | $geodir_search_post_type = geodir_get_default_posttype(); |
2497 | 2497 | } |
2498 | 2498 | |
@@ -2500,7 +2500,7 @@ discard block |
||
2500 | 2500 | return $geodir_search_post_type; |
2501 | 2501 | } |
2502 | 2502 | |
2503 | -function geodir_search_form(){ |
|
2503 | +function geodir_search_form() { |
|
2504 | 2504 | |
2505 | 2505 | geodir_get_search_post_type(); |
2506 | 2506 | |
@@ -2510,8 +2510,8 @@ discard block |
||
2510 | 2510 | die(); |
2511 | 2511 | } |
2512 | 2512 | |
2513 | -add_action( 'wp_ajax_geodir_search_form', 'geodir_search_form' ); |
|
2514 | -add_action( 'wp_ajax_nopriv_geodir_search_form', 'geodir_search_form' ); |
|
2513 | +add_action('wp_ajax_geodir_search_form', 'geodir_search_form'); |
|
2514 | +add_action('wp_ajax_nopriv_geodir_search_form', 'geodir_search_form'); |
|
2515 | 2515 | |
2516 | 2516 | /** |
2517 | 2517 | * Check wpml active or not. |
@@ -2585,7 +2585,7 @@ discard block |
||
2585 | 2585 | } |
2586 | 2586 | } |
2587 | 2587 | } |
2588 | -add_filter( 'icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4 ); |
|
2588 | +add_filter('icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4); |
|
2589 | 2589 | |
2590 | 2590 | /** |
2591 | 2591 | * Duplicate post listing manually after listing saved. |
@@ -2609,7 +2609,7 @@ discard block |
||
2609 | 2609 | foreach ($post_duplicates as $lang => $dup_post_id) { |
2610 | 2610 | geodir_icl_make_duplicate($post_id, $lang, $request_info, $dup_post_id, true); |
2611 | 2611 | } |
2612 | - do_action( 'geodir_wpml_listing_duplicated', $post_id, $request_info ); |
|
2612 | + do_action('geodir_wpml_listing_duplicated', $post_id, $request_info); |
|
2613 | 2613 | } |
2614 | 2614 | } |
2615 | 2615 | |
@@ -2628,7 +2628,7 @@ discard block |
||
2628 | 2628 | function geodir_wpml_duplicate_post_reviews($master_post_id, $tr_post_id, $lang) { |
2629 | 2629 | global $wpdb; |
2630 | 2630 | |
2631 | - $reviews = $wpdb->get_results($wpdb->prepare("SELECT comment_id FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id=%d ORDER BY id ASC", $master_post_id), ARRAY_A); |
|
2631 | + $reviews = $wpdb->get_results($wpdb->prepare("SELECT comment_id FROM ".GEODIR_REVIEW_TABLE." WHERE post_id=%d ORDER BY id ASC", $master_post_id), ARRAY_A); |
|
2632 | 2632 | |
2633 | 2633 | if (!empty($reviews)) { |
2634 | 2634 | foreach ($reviews as $review) { |
@@ -2657,15 +2657,15 @@ discard block |
||
2657 | 2657 | global $wpdb, $plugin_prefix; |
2658 | 2658 | |
2659 | 2659 | $post_type = get_post_type($master_post_id); |
2660 | - $post_table = $plugin_prefix . $post_type . '_detail'; |
|
2660 | + $post_table = $plugin_prefix.$post_type.'_detail'; |
|
2661 | 2661 | |
2662 | - $query = $wpdb->prepare("SELECT * FROM " . $post_table . " WHERE post_id = %d", array($master_post_id)); |
|
2663 | - $data = (array)$wpdb->get_row($query); |
|
2662 | + $query = $wpdb->prepare("SELECT * FROM ".$post_table." WHERE post_id = %d", array($master_post_id)); |
|
2663 | + $data = (array) $wpdb->get_row($query); |
|
2664 | 2664 | |
2665 | - if ( !empty( $data ) ) { |
|
2666 | - $data = apply_filters( 'geodir_icl_duplicate_post_data', $data, $master_post_id, $tr_post_id, $lang ); |
|
2665 | + if (!empty($data)) { |
|
2666 | + $data = apply_filters('geodir_icl_duplicate_post_data', $data, $master_post_id, $tr_post_id, $lang); |
|
2667 | 2667 | $data['post_id'] = $tr_post_id; |
2668 | - unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type . 'category']); |
|
2668 | + unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type.'category']); |
|
2669 | 2669 | $wpdb->update($post_table, $data, array('post_id' => $tr_post_id)); |
2670 | 2670 | return true; |
2671 | 2671 | } |
@@ -2690,7 +2690,7 @@ discard block |
||
2690 | 2690 | global $sitepress, $wpdb; |
2691 | 2691 | $post_type = get_post_type($master_post_id); |
2692 | 2692 | |
2693 | - remove_filter('get_term', array($sitepress,'get_term_adjust_id')); // AVOID filtering to current language |
|
2693 | + remove_filter('get_term', array($sitepress, 'get_term_adjust_id')); // AVOID filtering to current language |
|
2694 | 2694 | |
2695 | 2695 | $taxonomies = get_object_taxonomies($post_type); |
2696 | 2696 | foreach ($taxonomies as $taxonomy) { |
@@ -2699,9 +2699,9 @@ discard block |
||
2699 | 2699 | |
2700 | 2700 | if ($terms) { |
2701 | 2701 | foreach ($terms as $term) { |
2702 | - $tr_id = apply_filters( 'translate_object_id',$term->term_id, $taxonomy, false, $lang); |
|
2702 | + $tr_id = apply_filters('translate_object_id', $term->term_id, $taxonomy, false, $lang); |
|
2703 | 2703 | |
2704 | - if (!is_null($tr_id)){ |
|
2704 | + if (!is_null($tr_id)) { |
|
2705 | 2705 | // not using get_term - unfiltered get_term |
2706 | 2706 | $translated_term = $wpdb->get_row($wpdb->prepare(" |
2707 | 2707 | SELECT * FROM {$wpdb->terms} t JOIN {$wpdb->term_taxonomy} x ON x.term_id = t.term_id WHERE t.term_id = %d AND x.taxonomy = %s", $tr_id, $taxonomy)); |
@@ -2710,14 +2710,14 @@ discard block |
||
2710 | 2710 | } |
2711 | 2711 | } |
2712 | 2712 | |
2713 | - if (!is_taxonomy_hierarchical($taxonomy)){ |
|
2714 | - $terms_array = array_unique( array_map( 'intval', $terms_array ) ); |
|
2713 | + if (!is_taxonomy_hierarchical($taxonomy)) { |
|
2714 | + $terms_array = array_unique(array_map('intval', $terms_array)); |
|
2715 | 2715 | } |
2716 | 2716 | |
2717 | 2717 | wp_set_post_terms($tr_post_id, $terms_array, $taxonomy); |
2718 | 2718 | |
2719 | - if ($taxonomy == $post_type . 'category') { |
|
2720 | - geodir_set_postcat_structure($tr_post_id, $post_type . 'category'); |
|
2719 | + if ($taxonomy == $post_type.'category') { |
|
2720 | + geodir_set_postcat_structure($tr_post_id, $post_type.'category'); |
|
2721 | 2721 | } |
2722 | 2722 | } |
2723 | 2723 | } |
@@ -2738,15 +2738,15 @@ discard block |
||
2738 | 2738 | function geodir_icl_duplicate_post_images($master_post_id, $tr_post_id, $lang) { |
2739 | 2739 | global $wpdb; |
2740 | 2740 | |
2741 | - $query = $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id)); |
|
2741 | + $query = $wpdb->prepare("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id)); |
|
2742 | 2742 | $wpdb->query($query); |
2743 | 2743 | |
2744 | - $query = $wpdb->prepare("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id)); |
|
2744 | + $query = $wpdb->prepare("SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id)); |
|
2745 | 2745 | $post_images = $wpdb->get_results($query); |
2746 | 2746 | |
2747 | - if ( !empty( $post_images ) ) { |
|
2748 | - foreach ( $post_images as $post_image) { |
|
2749 | - $image_data = (array)$post_image; |
|
2747 | + if (!empty($post_images)) { |
|
2748 | + foreach ($post_images as $post_image) { |
|
2749 | + $image_data = (array) $post_image; |
|
2750 | 2750 | unset($image_data['ID']); |
2751 | 2751 | $image_data['post_id'] = $tr_post_id; |
2752 | 2752 | |
@@ -2779,13 +2779,13 @@ discard block |
||
2779 | 2779 | function geodir_wpml_duplicate_post_review($master_comment_id, $master_post_id, $tr_post_id, $lang) { |
2780 | 2780 | global $wpdb, $plugin_prefix, $sitepress; |
2781 | 2781 | |
2782 | - $review = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d ORDER BY id ASC", $master_comment_id), ARRAY_A); |
|
2782 | + $review = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".GEODIR_REVIEW_TABLE." WHERE comment_id=%d ORDER BY id ASC", $master_comment_id), ARRAY_A); |
|
2783 | 2783 | |
2784 | 2784 | if (empty($review)) { |
2785 | 2785 | return false; |
2786 | 2786 | } |
2787 | 2787 | if ($review['post_id'] != $master_post_id) { |
2788 | - $wpdb->query($wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET post_id=%d WHERE comment_id=%d", $master_post_id, $master_comment_id)); |
|
2788 | + $wpdb->query($wpdb->prepare("UPDATE ".GEODIR_REVIEW_TABLE." SET post_id=%d WHERE comment_id=%d", $master_post_id, $master_comment_id)); |
|
2789 | 2789 | geodir_update_postrating($master_post_id, $post_type); |
2790 | 2790 | } |
2791 | 2791 | |
@@ -2796,9 +2796,9 @@ discard block |
||
2796 | 2796 | } |
2797 | 2797 | |
2798 | 2798 | $post_type = get_post_type($master_post_id); |
2799 | - $post_table = $plugin_prefix . $post_type . '_detail'; |
|
2799 | + $post_table = $plugin_prefix.$post_type.'_detail'; |
|
2800 | 2800 | |
2801 | - $translated_post = $wpdb->get_row($wpdb->prepare("SELECT post_title, post_latitude, post_longitude, post_city, post_region, post_country FROM " . $post_table . " WHERE post_id = %d", $tr_post_id), ARRAY_A); |
|
2801 | + $translated_post = $wpdb->get_row($wpdb->prepare("SELECT post_title, post_latitude, post_longitude, post_city, post_region, post_country FROM ".$post_table." WHERE post_id = %d", $tr_post_id), ARRAY_A); |
|
2802 | 2802 | if (empty($translated_post)) { |
2803 | 2803 | return false; |
2804 | 2804 | } |
@@ -2816,7 +2816,7 @@ discard block |
||
2816 | 2816 | unset($review['id']); |
2817 | 2817 | } |
2818 | 2818 | |
2819 | - $tr_review_id = $wpdb->get_var($wpdb->prepare("SELECT id FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d AND post_id=%d ORDER BY id ASC", $tr_comment_id, $tr_post_id)); |
|
2819 | + $tr_review_id = $wpdb->get_var($wpdb->prepare("SELECT id FROM ".GEODIR_REVIEW_TABLE." WHERE comment_id=%d AND post_id=%d ORDER BY id ASC", $tr_comment_id, $tr_post_id)); |
|
2820 | 2820 | |
2821 | 2821 | if ($tr_review_id) { // update review |
2822 | 2822 | $wpdb->update(GEODIR_REVIEW_TABLE, $review, array('id' => $tr_review_id)); |
@@ -2829,8 +2829,8 @@ discard block |
||
2829 | 2829 | geodir_update_postrating($tr_post_id, $post_type); |
2830 | 2830 | |
2831 | 2831 | if (defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_review') && $sitepress->get_setting('sync_comments_on_duplicates')) { |
2832 | - $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_COMMENTS_REVIEWS_TABLE . " WHERE comment_id = %d", array($tr_comment_id))); |
|
2833 | - $likes = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_COMMENTS_REVIEWS_TABLE . " WHERE comment_id=%d ORDER BY like_date ASC", $master_comment_id, $tr_post_id), ARRAY_A); |
|
2832 | + $wpdb->query($wpdb->prepare("DELETE FROM ".GEODIR_COMMENTS_REVIEWS_TABLE." WHERE comment_id = %d", array($tr_comment_id))); |
|
2833 | + $likes = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".GEODIR_COMMENTS_REVIEWS_TABLE." WHERE comment_id=%d ORDER BY like_date ASC", $master_comment_id, $tr_post_id), ARRAY_A); |
|
2834 | 2834 | |
2835 | 2835 | if (!empty($likes)) { |
2836 | 2836 | foreach ($likes as $like) { |
@@ -2932,7 +2932,7 @@ discard block |
||
2932 | 2932 | * @return bool True if review star disabled, otherwise false. |
2933 | 2933 | */ |
2934 | 2934 | function geodir_rating_disabled_post_types() { |
2935 | - $post_types = get_option( 'geodir_disable_rating_cpt' ); |
|
2935 | + $post_types = get_option('geodir_disable_rating_cpt'); |
|
2936 | 2936 | |
2937 | 2937 | /** |
2938 | 2938 | * Filter the post types array which have rating disabled. |
@@ -2941,7 +2941,7 @@ discard block |
||
2941 | 2941 | * |
2942 | 2942 | * @param array $post_types Array of post types which have rating starts disabled. |
2943 | 2943 | */ |
2944 | - return apply_filters( 'geodir_rating_disabled_post_types', $post_types ); |
|
2944 | + return apply_filters('geodir_rating_disabled_post_types', $post_types); |
|
2945 | 2945 | } |
2946 | 2946 | |
2947 | 2947 | /** |
@@ -2953,30 +2953,30 @@ discard block |
||
2953 | 2953 | * @param bool $taxonomy Whether $post_type is taxonomy or not. |
2954 | 2954 | * @return bool True if review star disabled, otherwise false. |
2955 | 2955 | */ |
2956 | -function geodir_cpt_has_rating_disabled( $post_type = '', $taxonomy = false ) { |
|
2956 | +function geodir_cpt_has_rating_disabled($post_type = '', $taxonomy = false) { |
|
2957 | 2957 | $post_types = geodir_rating_disabled_post_types(); |
2958 | 2958 | |
2959 | - if ( empty( $post_types ) ) { |
|
2959 | + if (empty($post_types)) { |
|
2960 | 2960 | return false; |
2961 | 2961 | } |
2962 | 2962 | |
2963 | - if ( is_int( $post_type ) ) { |
|
2964 | - $post_type = get_post_type( $post_type ); |
|
2963 | + if (is_int($post_type)) { |
|
2964 | + $post_type = get_post_type($post_type); |
|
2965 | 2965 | } |
2966 | 2966 | |
2967 | - if ( $taxonomy && !empty( $post_types ) ) { |
|
2967 | + if ($taxonomy && !empty($post_types)) { |
|
2968 | 2968 | $posttypes = array(); |
2969 | 2969 | |
2970 | - foreach ( $post_types as $posttype ) { |
|
2971 | - $posttypes[] = $posttype . 'category'; |
|
2972 | - $posttypes[] = $posttype . '_tags'; |
|
2970 | + foreach ($post_types as $posttype) { |
|
2971 | + $posttypes[] = $posttype.'category'; |
|
2972 | + $posttypes[] = $posttype.'_tags'; |
|
2973 | 2973 | } |
2974 | 2974 | |
2975 | 2975 | $post_types = $posttypes; |
2976 | 2976 | } |
2977 | 2977 | |
2978 | 2978 | $return = false; |
2979 | - if ( $post_type != '' && !empty( $post_types ) && in_array( $post_type, $post_types ) ) { |
|
2979 | + if ($post_type != '' && !empty($post_types) && in_array($post_type, $post_types)) { |
|
2980 | 2980 | $return = true; |
2981 | 2981 | } |
2982 | 2982 | |
@@ -2991,7 +2991,7 @@ discard block |
||
2991 | 2991 | * @return bool True if Yoast SEO disabled on GD pages. |
2992 | 2992 | */ |
2993 | 2993 | function geodir_disable_yoast_seo_metas() { |
2994 | - return (bool)get_option( 'geodir_disable_yoast_meta' ); |
|
2994 | + return (bool) get_option('geodir_disable_yoast_meta'); |
|
2995 | 2995 | } |
2996 | 2996 | |
2997 | 2997 | /** |
@@ -3002,30 +3002,30 @@ discard block |
||
3002 | 3002 | * @param int $post_id The post ID. |
3003 | 3003 | * @return bool True if allowed. |
3004 | 3004 | */ |
3005 | -function geodir_wpml_allowed_to_duplicate( $post_id ) { |
|
3005 | +function geodir_wpml_allowed_to_duplicate($post_id) { |
|
3006 | 3006 | $allowed = false; |
3007 | 3007 | |
3008 | - if ( !geodir_is_wpml() || empty( $post_id ) ) { |
|
3008 | + if (!geodir_is_wpml() || empty($post_id)) { |
|
3009 | 3009 | return $allowed; |
3010 | 3010 | } |
3011 | 3011 | |
3012 | - $user_id = (int)get_current_user_id(); |
|
3012 | + $user_id = (int) get_current_user_id(); |
|
3013 | 3013 | |
3014 | - if ( empty( $user_id ) ) { |
|
3014 | + if (empty($user_id)) { |
|
3015 | 3015 | return $allowed; |
3016 | 3016 | } |
3017 | 3017 | |
3018 | - $post_type = get_post_type( $post_id ); |
|
3019 | - if ( !geodir_wpml_is_post_type_translated( $post_type ) || get_post_meta( $post_id, '_icl_lang_duplicate_of', true ) ) { |
|
3018 | + $post_type = get_post_type($post_id); |
|
3019 | + if (!geodir_wpml_is_post_type_translated($post_type) || get_post_meta($post_id, '_icl_lang_duplicate_of', true)) { |
|
3020 | 3020 | return $allowed; |
3021 | 3021 | } |
3022 | 3022 | |
3023 | - if ( geodir_listing_belong_to_current_user( $post_id ) ) { |
|
3023 | + if (geodir_listing_belong_to_current_user($post_id)) { |
|
3024 | 3024 | $allowed = true; |
3025 | 3025 | } |
3026 | 3026 | |
3027 | - $disable_cpts = get_option( 'geodir_wpml_disable_duplicate' ); |
|
3028 | - if ( $allowed && !empty( $disable_cpts ) && in_array( $post_type, $disable_cpts ) ) { |
|
3027 | + $disable_cpts = get_option('geodir_wpml_disable_duplicate'); |
|
3028 | + if ($allowed && !empty($disable_cpts) && in_array($post_type, $disable_cpts)) { |
|
3029 | 3029 | $allowed = false; |
3030 | 3030 | } |
3031 | 3031 | |
@@ -3035,7 +3035,7 @@ discard block |
||
3035 | 3035 | * @param bool $allowed True if allowed. |
3036 | 3036 | * @param int $post_id The post ID. |
3037 | 3037 | */ |
3038 | - return apply_filters( 'geodir_wpml_allowed_to_duplicate', $allowed, $post_id ); |
|
3038 | + return apply_filters('geodir_wpml_allowed_to_duplicate', $allowed, $post_id); |
|
3039 | 3039 | } |
3040 | 3040 | |
3041 | 3041 | /** |
@@ -3050,61 +3050,61 @@ discard block |
||
3050 | 3050 | * @param string $content_html The output html of the geodir_edit_post_link() function. |
3051 | 3051 | * @return string Filtered html of the geodir_edit_post_link() function. |
3052 | 3052 | */ |
3053 | -function geodir_wpml_frontend_duplicate_listing( $content_html ) { |
|
3053 | +function geodir_wpml_frontend_duplicate_listing($content_html) { |
|
3054 | 3054 | global $post, $preview, $sitepress; |
3055 | 3055 | |
3056 | - if ( !empty( $post->ID ) && !$preview && geodir_is_page( 'detail' ) && geodir_wpml_allowed_to_duplicate( $post->ID ) ) { |
|
3056 | + if (!empty($post->ID) && !$preview && geodir_is_page('detail') && geodir_wpml_allowed_to_duplicate($post->ID)) { |
|
3057 | 3057 | $post_id = $post->ID; |
3058 | - $element_type = 'post_' . get_post_type( $post_id ); |
|
3059 | - $original_post_id = $sitepress->get_original_element_id( $post_id, $element_type ); |
|
3058 | + $element_type = 'post_'.get_post_type($post_id); |
|
3059 | + $original_post_id = $sitepress->get_original_element_id($post_id, $element_type); |
|
3060 | 3060 | |
3061 | - if ( $original_post_id == $post_id ) { |
|
3061 | + if ($original_post_id == $post_id) { |
|
3062 | 3062 | $wpml_languages = $sitepress->get_active_languages(); |
3063 | - $post_language = $sitepress->get_language_for_element( $post_id, $element_type ); |
|
3063 | + $post_language = $sitepress->get_language_for_element($post_id, $element_type); |
|
3064 | 3064 | |
3065 | - if ( !empty( $wpml_languages ) && isset( $wpml_languages[ $post_language ] ) ) { |
|
3066 | - unset( $wpml_languages[ $post_language ] ); |
|
3065 | + if (!empty($wpml_languages) && isset($wpml_languages[$post_language])) { |
|
3066 | + unset($wpml_languages[$post_language]); |
|
3067 | 3067 | } |
3068 | 3068 | |
3069 | - if ( !empty( $wpml_languages ) ) { |
|
3070 | - $trid = $sitepress->get_element_trid( $post_id, $element_type ); |
|
3071 | - $element_translations = $sitepress->get_element_translations( $trid, $element_type ); |
|
3072 | - $duplicates = $sitepress->get_duplicates( $post_id ); |
|
3069 | + if (!empty($wpml_languages)) { |
|
3070 | + $trid = $sitepress->get_element_trid($post_id, $element_type); |
|
3071 | + $element_translations = $sitepress->get_element_translations($trid, $element_type); |
|
3072 | + $duplicates = $sitepress->get_duplicates($post_id); |
|
3073 | 3073 | |
3074 | - $wpml_content = '<div class="geodir-company_info gd-detail-duplicate"><h3 class="widget-title">' . __( 'Translate Listing', 'geodirectory' ) . '</h3>'; |
|
3074 | + $wpml_content = '<div class="geodir-company_info gd-detail-duplicate"><h3 class="widget-title">'.__('Translate Listing', 'geodirectory').'</h3>'; |
|
3075 | 3075 | $wpml_content .= '<table class="gd-duplicate-table" style="width:100%;margin:0"><tbody>'; |
3076 | - $wpml_content .= '<tr style="border-bottom:solid 1px #efefef"><th style="padding:0 2px 2px 2px">' . __( 'Language', 'geodirectory' ) . '</th><th style="width:25px;"></th><th style="width:5em;text-align:center">' . __( 'Translate', 'geodirectory' ) . '</th></tr>'; |
|
3076 | + $wpml_content .= '<tr style="border-bottom:solid 1px #efefef"><th style="padding:0 2px 2px 2px">'.__('Language', 'geodirectory').'</th><th style="width:25px;"></th><th style="width:5em;text-align:center">'.__('Translate', 'geodirectory').'</th></tr>'; |
|
3077 | 3077 | |
3078 | 3078 | $needs_translation = false; |
3079 | 3079 | |
3080 | - foreach ( $wpml_languages as $lang_code => $lang ) { |
|
3080 | + foreach ($wpml_languages as $lang_code => $lang) { |
|
3081 | 3081 | $duplicates_text = ''; |
3082 | 3082 | $translated = false; |
3083 | 3083 | |
3084 | - if ( !empty( $element_translations ) && isset( $element_translations[$lang_code] ) ) { |
|
3084 | + if (!empty($element_translations) && isset($element_translations[$lang_code])) { |
|
3085 | 3085 | $translated = true; |
3086 | 3086 | |
3087 | - if ( !empty( $duplicates ) && isset( $duplicates[$lang_code] ) ) { |
|
3088 | - $duplicates_text = ' ' . __( '(duplicate)', 'geodirectory' ); |
|
3087 | + if (!empty($duplicates) && isset($duplicates[$lang_code])) { |
|
3088 | + $duplicates_text = ' '.__('(duplicate)', 'geodirectory'); |
|
3089 | 3089 | } |
3090 | 3090 | } else { |
3091 | 3091 | $needs_translation = true; |
3092 | 3092 | } |
3093 | 3093 | |
3094 | - $wpml_content .= '<tr><td style="padding:4px">' . $lang['english_name'] . $duplicates_text . '</td><td> </td><td style="text-align:center;">'; |
|
3094 | + $wpml_content .= '<tr><td style="padding:4px">'.$lang['english_name'].$duplicates_text.'</td><td> </td><td style="text-align:center;">'; |
|
3095 | 3095 | |
3096 | - if ( $translated ) { |
|
3096 | + if ($translated) { |
|
3097 | 3097 | $wpml_content .= '<i class="fa fa-check" style="color:orange"></i>'; |
3098 | 3098 | } else { |
3099 | - $wpml_content .= '<input name="gd_icl_dup[]" value="' . $lang_code . '" title="' . esc_attr__( 'Create duplicate', 'geodirectory' ) . '" type="checkbox">'; |
|
3099 | + $wpml_content .= '<input name="gd_icl_dup[]" value="'.$lang_code.'" title="'.esc_attr__('Create duplicate', 'geodirectory').'" type="checkbox">'; |
|
3100 | 3100 | } |
3101 | 3101 | |
3102 | 3102 | $wpml_content .= '</td></tr>'; |
3103 | 3103 | } |
3104 | 3104 | |
3105 | - if ( $needs_translation ) { |
|
3106 | - $nonce = wp_create_nonce( 'geodir_duplicate_nonce' ); |
|
3107 | - $wpml_content .= '<tr><td> </td><td style="vertical-align:middle;padding-top:13px"><i style="display:none" class="fa fa-spin fa-refresh"></i></td><td style="padding:15px 3px 3px 3px;text-align:right"><button data-nonce="' . esc_attr( $nonce ) . '" data-post-id="' . $post_id . '" id="gd_make_duplicates" class="button-secondary">' . __( 'Duplicate', 'geodirectory' ) . '</button></td></tr>'; |
|
3105 | + if ($needs_translation) { |
|
3106 | + $nonce = wp_create_nonce('geodir_duplicate_nonce'); |
|
3107 | + $wpml_content .= '<tr><td> </td><td style="vertical-align:middle;padding-top:13px"><i style="display:none" class="fa fa-spin fa-refresh"></i></td><td style="padding:15px 3px 3px 3px;text-align:right"><button data-nonce="'.esc_attr($nonce).'" data-post-id="'.$post_id.'" id="gd_make_duplicates" class="button-secondary">'.__('Duplicate', 'geodirectory').'</button></td></tr>'; |
|
3108 | 3108 | } |
3109 | 3109 | |
3110 | 3110 | $wpml_content .= '</tbody></table>'; |
@@ -3126,12 +3126,12 @@ discard block |
||
3126 | 3126 | * @param array $settings GD design settings array. |
3127 | 3127 | * @return array Filtered GD design settings array.. |
3128 | 3128 | */ |
3129 | -function geodir_wpml_duplicate_settings( $settings = array() ) { |
|
3129 | +function geodir_wpml_duplicate_settings($settings = array()) { |
|
3130 | 3130 | $new_settings = array(); |
3131 | 3131 | |
3132 | - foreach ( $settings as $key => $setting ) { |
|
3132 | + foreach ($settings as $key => $setting) { |
|
3133 | 3133 | |
3134 | - if ( isset( $setting['type'] ) && $setting['type'] == 'sectionend' && $setting['id'] == 'detail_page_settings' ) { |
|
3134 | + if (isset($setting['type']) && $setting['type'] == 'sectionend' && $setting['id'] == 'detail_page_settings') { |
|
3135 | 3135 | $new_settings[] = array( |
3136 | 3136 | 'name' => __('Disable WPML duplicate translation', 'geodirectory'), |
3137 | 3137 | 'desc' => __('Select post types to disable front end WPML duplicate translation. For selected post types the WPML duplicate option will be disabled from listing detail page sidebar.', 'geodirectory'), |
@@ -3159,12 +3159,12 @@ discard block |
||
3159 | 3159 | * @param string $taxonomy name/slug of a taxonomy. |
3160 | 3160 | * @return bool true if the taxonomy is currently set to being translatable in WPML. |
3161 | 3161 | */ |
3162 | -function geodir_wpml_is_taxonomy_translated( $taxonomy ) { |
|
3163 | - if ( empty( $taxonomy ) || !geodir_is_wpml() || !function_exists( 'is_taxonomy_translated' ) ) { |
|
3162 | +function geodir_wpml_is_taxonomy_translated($taxonomy) { |
|
3163 | + if (empty($taxonomy) || !geodir_is_wpml() || !function_exists('is_taxonomy_translated')) { |
|
3164 | 3164 | return false; |
3165 | 3165 | } |
3166 | 3166 | |
3167 | - if ( is_taxonomy_translated( $taxonomy ) ) { |
|
3167 | + if (is_taxonomy_translated($taxonomy)) { |
|
3168 | 3168 | return true; |
3169 | 3169 | } |
3170 | 3170 | |
@@ -3179,12 +3179,12 @@ discard block |
||
3179 | 3179 | * @param string $post_type name/slug of a post_type. |
3180 | 3180 | * @return bool true if the post_type is currently set to being translatable in WPML. |
3181 | 3181 | */ |
3182 | -function geodir_wpml_is_post_type_translated( $post_type ) { |
|
3183 | - if ( empty( $post_type ) || !geodir_is_wpml() || !function_exists( 'is_post_type_translated' ) ) { |
|
3182 | +function geodir_wpml_is_post_type_translated($post_type) { |
|
3183 | + if (empty($post_type) || !geodir_is_wpml() || !function_exists('is_post_type_translated')) { |
|
3184 | 3184 | return false; |
3185 | 3185 | } |
3186 | 3186 | |
3187 | - if ( is_post_type_translated( $post_type ) ) { |
|
3187 | + if (is_post_type_translated($post_type)) { |
|
3188 | 3188 | return true; |
3189 | 3189 | } |
3190 | 3190 | |
@@ -3206,12 +3206,12 @@ discard block |
||
3206 | 3206 | * |
3207 | 3207 | * @return int|NULL |
3208 | 3208 | */ |
3209 | -function geodir_wpml_object_id( $element_id, $element_type = 'post', $return_original_if_missing = false, $ulanguage_code = null ) { |
|
3210 | - if ( geodir_is_wpml() ) { |
|
3211 | - if ( function_exists( 'wpml_object_id_filter' ) ) { |
|
3212 | - return apply_filters( 'wpml_object_id', $element_id, $element_type, $return_original_if_missing, $ulanguage_code ); |
|
3209 | +function geodir_wpml_object_id($element_id, $element_type = 'post', $return_original_if_missing = false, $ulanguage_code = null) { |
|
3210 | + if (geodir_is_wpml()) { |
|
3211 | + if (function_exists('wpml_object_id_filter')) { |
|
3212 | + return apply_filters('wpml_object_id', $element_id, $element_type, $return_original_if_missing, $ulanguage_code); |
|
3213 | 3213 | } else { |
3214 | - return icl_object_id( $element_id, $element_type, $return_original_if_missing, $ulanguage_code ); |
|
3214 | + return icl_object_id($element_id, $element_type, $return_original_if_missing, $ulanguage_code); |
|
3215 | 3215 | } |
3216 | 3216 | } |
3217 | 3217 |
@@ -19,13 +19,13 @@ discard block |
||
19 | 19 | */ |
20 | 20 | function geodir_divi_signup_body_class($classes) |
21 | 21 | { |
22 | - if (geodir_is_page('login')) { |
|
23 | - $classes = str_replace('et_right_sidebar', 'et_full_width_page', $classes); |
|
24 | - $classes[] = 'divi-gd-signup'; |
|
25 | - } else if ( geodir_is_page( 'detail' ) || geodir_is_page( 'preview' ) ) { |
|
26 | - $classes[] = is_rtl() ? 'et_left_sidebar' : 'et_right_sidebar'; |
|
27 | - } |
|
28 | - return $classes; |
|
22 | + if (geodir_is_page('login')) { |
|
23 | + $classes = str_replace('et_right_sidebar', 'et_full_width_page', $classes); |
|
24 | + $classes[] = 'divi-gd-signup'; |
|
25 | + } else if ( geodir_is_page( 'detail' ) || geodir_is_page( 'preview' ) ) { |
|
26 | + $classes[] = is_rtl() ? 'et_left_sidebar' : 'et_right_sidebar'; |
|
27 | + } |
|
28 | + return $classes; |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | add_action('geodir_wrapper_close', 'geodir_divi_action_wrapper_close', 11); |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | */ |
38 | 38 | function geodir_divi_action_wrapper_close() |
39 | 39 | { |
40 | - if (geodir_is_page('login')) { |
|
41 | - // We need to close extra divs generated by WRAPPER BEFORE MAIN CONTENT (below) because there is no sidebar on this page |
|
42 | - echo '</div></div>'; |
|
43 | - } |
|
40 | + if (geodir_is_page('login')) { |
|
41 | + // We need to close extra divs generated by WRAPPER BEFORE MAIN CONTENT (below) because there is no sidebar on this page |
|
42 | + echo '</div></div>'; |
|
43 | + } |
|
44 | 44 | } |
45 | 45 | \ No newline at end of file |
@@ -22,7 +22,7 @@ |
||
22 | 22 | if (geodir_is_page('login')) { |
23 | 23 | $classes = str_replace('et_right_sidebar', 'et_full_width_page', $classes); |
24 | 24 | $classes[] = 'divi-gd-signup'; |
25 | - } else if ( geodir_is_page( 'detail' ) || geodir_is_page( 'preview' ) ) { |
|
25 | + } else if (geodir_is_page('detail') || geodir_is_page('preview')) { |
|
26 | 26 | $classes[] = is_rtl() ? 'et_left_sidebar' : 'et_right_sidebar'; |
27 | 27 | } |
28 | 28 | return $classes; |
@@ -17,26 +17,26 @@ discard block |
||
17 | 17 | function gd_compat_php_genesis() |
18 | 18 | { |
19 | 19 | // REPLACE GENESIS BREADCRUMBS WITH GD BREADCRUMBS |
20 | - remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20); |
|
21 | - remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20); |
|
22 | - remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20); |
|
23 | - remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20); |
|
24 | - remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20); |
|
25 | - remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20); |
|
20 | + remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20); |
|
21 | + remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20); |
|
22 | + remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20); |
|
23 | + remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20); |
|
24 | + remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20); |
|
25 | + remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20); |
|
26 | 26 | |
27 | 27 | |
28 | - // make top section wide |
|
29 | - remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
30 | - remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
31 | - remove_action('geodir_author_before_main_content', 'geodir_action_geodir_sidebar_author_top', 10); |
|
32 | - remove_action('geodir_search_before_main_content', 'geodir_action_geodir_sidebar_search_top', 10); |
|
33 | - remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_sidebar_detail_top', 10); |
|
34 | - remove_action('geodir_listings_before_main_content', 'geodir_action_geodir_sidebar_listings_top', 10); |
|
28 | + // make top section wide |
|
29 | + remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
30 | + remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
31 | + remove_action('geodir_author_before_main_content', 'geodir_action_geodir_sidebar_author_top', 10); |
|
32 | + remove_action('geodir_search_before_main_content', 'geodir_action_geodir_sidebar_search_top', 10); |
|
33 | + remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_sidebar_detail_top', 10); |
|
34 | + remove_action('geodir_listings_before_main_content', 'geodir_action_geodir_sidebar_listings_top', 10); |
|
35 | 35 | |
36 | - // REMOVE PAGE TITLES |
|
37 | - remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10); |
|
38 | - remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10); |
|
39 | - remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10); |
|
36 | + // REMOVE PAGE TITLES |
|
37 | + remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10); |
|
38 | + remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10); |
|
39 | + remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10); |
|
40 | 40 | |
41 | 41 | |
42 | 42 | } |
@@ -53,25 +53,25 @@ discard block |
||
53 | 53 | function gd_genesis_compat_left_sidebars() |
54 | 54 | { |
55 | 55 | |
56 | - if (is_page_geodir_home()) { |
|
57 | - remove_action('geodir_home_sidebar_left', 'geodir_action_home_sidebar_left', 10); |
|
58 | - add_action('geodir_wrapper_close', 'geodir_action_home_sidebar_left', 11); |
|
59 | - } elseif (geodir_is_page('location')) { |
|
60 | - remove_action('geodir_location_sidebar_left', 'geodir_action_home_sidebar_left', 10); |
|
61 | - add_action('geodir_wrapper_close', 'geodir_action_home_sidebar_left', 11); |
|
62 | - } elseif (geodir_is_page('listing')) { |
|
63 | - remove_action('geodir_listings_sidebar_left', 'geodir_action_listings_sidebar_left', 10); |
|
64 | - add_action('geodir_wrapper_close', 'geodir_action_listings_sidebar_left', 11); |
|
65 | - } elseif (geodir_is_page('detail') && get_option('geodir_detail_sidebar_left_section')) { |
|
66 | - //remove_action( 'geodir_detail_sidebar', 'geodir_action_details_sidebar', 10 ); |
|
67 | - //add_action( 'geodir_wrapper_close', 'geodir_action_details_sidebar', 11 ); |
|
68 | - } elseif (geodir_is_page('search')) { |
|
69 | - remove_action('geodir_search_sidebar_left', 'geodir_action_search_sidebar_left', 10); |
|
70 | - add_action('geodir_wrapper_close', 'geodir_action_search_sidebar_left', 11); |
|
71 | - } elseif (geodir_is_page('author')) { |
|
72 | - remove_action('geodir_author_sidebar_left', 'geodir_action_author_sidebar_left', 10); |
|
73 | - add_action('geodir_wrapper_close', 'geodir_action_author_sidebar_left', 11); |
|
74 | - } |
|
56 | + if (is_page_geodir_home()) { |
|
57 | + remove_action('geodir_home_sidebar_left', 'geodir_action_home_sidebar_left', 10); |
|
58 | + add_action('geodir_wrapper_close', 'geodir_action_home_sidebar_left', 11); |
|
59 | + } elseif (geodir_is_page('location')) { |
|
60 | + remove_action('geodir_location_sidebar_left', 'geodir_action_home_sidebar_left', 10); |
|
61 | + add_action('geodir_wrapper_close', 'geodir_action_home_sidebar_left', 11); |
|
62 | + } elseif (geodir_is_page('listing')) { |
|
63 | + remove_action('geodir_listings_sidebar_left', 'geodir_action_listings_sidebar_left', 10); |
|
64 | + add_action('geodir_wrapper_close', 'geodir_action_listings_sidebar_left', 11); |
|
65 | + } elseif (geodir_is_page('detail') && get_option('geodir_detail_sidebar_left_section')) { |
|
66 | + //remove_action( 'geodir_detail_sidebar', 'geodir_action_details_sidebar', 10 ); |
|
67 | + //add_action( 'geodir_wrapper_close', 'geodir_action_details_sidebar', 11 ); |
|
68 | + } elseif (geodir_is_page('search')) { |
|
69 | + remove_action('geodir_search_sidebar_left', 'geodir_action_search_sidebar_left', 10); |
|
70 | + add_action('geodir_wrapper_close', 'geodir_action_search_sidebar_left', 11); |
|
71 | + } elseif (geodir_is_page('author')) { |
|
72 | + remove_action('geodir_author_sidebar_left', 'geodir_action_author_sidebar_left', 10); |
|
73 | + add_action('geodir_wrapper_close', 'geodir_action_author_sidebar_left', 11); |
|
74 | + } |
|
75 | 75 | |
76 | 76 | |
77 | 77 | } |
@@ -88,68 +88,68 @@ discard block |
||
88 | 88 | */ |
89 | 89 | function geodir_set_body_scs($classes) |
90 | 90 | { |
91 | - $remove_class = false; |
|
92 | - $new_class = ''; |
|
93 | - if (is_page_geodir_home() || geodir_is_page('location') || geodir_is_page('home')) { |
|
94 | - $remove_class = true; |
|
95 | - if (get_option('geodir_show_home_left_section')) { |
|
96 | - $new_class .= 'sidebar-'; |
|
97 | - } |
|
98 | - if (get_option('geodir_show_home_contant_section')) { |
|
99 | - $new_class .= 'content'; |
|
100 | - } |
|
101 | - if (get_option('geodir_show_home_right_section')) { |
|
102 | - $new_class .= '-sidebar'; |
|
103 | - } |
|
104 | - } elseif (geodir_is_page('listing')) { |
|
105 | - $remove_class = true; |
|
106 | - if (get_option('geodir_show_listing_left_section')) { |
|
107 | - $new_class .= 'sidebar-'; |
|
108 | - } |
|
109 | - $new_class .= 'content'; |
|
110 | - if (get_option('geodir_show_listing_right_section')) { |
|
111 | - $new_class .= '-sidebar'; |
|
112 | - } |
|
113 | - } elseif (geodir_is_page('detail')) { |
|
114 | - $remove_class = true; |
|
115 | - if (get_option('geodir_detail_sidebar_left_section')) { |
|
116 | - $new_class .= 'sidebar-content gd-details-sidebar-left'; |
|
117 | - } else { |
|
118 | - $new_class .= 'content-sidebar'; |
|
119 | - } |
|
120 | - } elseif (geodir_is_page('search')) { |
|
121 | - $remove_class = true; |
|
122 | - if (get_option('geodir_show_search_left_section')) { |
|
123 | - $new_class .= 'sidebar-'; |
|
124 | - } |
|
125 | - $new_class .= 'content'; |
|
126 | - if (get_option('geodir_show_search_right_section')) { |
|
127 | - $new_class .= '-sidebar'; |
|
128 | - } |
|
129 | - } elseif (geodir_is_page('author')) { |
|
130 | - $remove_class = true; |
|
131 | - if (get_option('geodir_show_author_left_section')) { |
|
132 | - $new_class .= 'sidebar-'; |
|
133 | - } |
|
134 | - $new_class .= 'content'; |
|
135 | - if (get_option('geodir_show_author_right_section')) { |
|
136 | - $new_class .= '-sidebar'; |
|
137 | - } |
|
138 | - } elseif (geodir_is_page('add-listing')) { |
|
139 | - $remove_class = true; |
|
140 | - $new_class .= 'content-sidebar'; |
|
141 | - } |
|
142 | - |
|
143 | - if ($remove_class) { |
|
144 | - $classes = array_diff($classes, array('content-sidebar', 'sidebar-content', 'content-sidebar-sidebar', 'sidebar-sidebar-content', 'sidebar-content-sidebar', 'full-width-content')); |
|
145 | - if ( $new_class == 'content' ) { |
|
146 | - $new_class = 'content-no-sidebar'; |
|
147 | - $classes[] = 'full-width-content'; |
|
148 | - } |
|
149 | - $classes[] = $new_class; |
|
150 | - } |
|
151 | - |
|
152 | - return $classes; |
|
91 | + $remove_class = false; |
|
92 | + $new_class = ''; |
|
93 | + if (is_page_geodir_home() || geodir_is_page('location') || geodir_is_page('home')) { |
|
94 | + $remove_class = true; |
|
95 | + if (get_option('geodir_show_home_left_section')) { |
|
96 | + $new_class .= 'sidebar-'; |
|
97 | + } |
|
98 | + if (get_option('geodir_show_home_contant_section')) { |
|
99 | + $new_class .= 'content'; |
|
100 | + } |
|
101 | + if (get_option('geodir_show_home_right_section')) { |
|
102 | + $new_class .= '-sidebar'; |
|
103 | + } |
|
104 | + } elseif (geodir_is_page('listing')) { |
|
105 | + $remove_class = true; |
|
106 | + if (get_option('geodir_show_listing_left_section')) { |
|
107 | + $new_class .= 'sidebar-'; |
|
108 | + } |
|
109 | + $new_class .= 'content'; |
|
110 | + if (get_option('geodir_show_listing_right_section')) { |
|
111 | + $new_class .= '-sidebar'; |
|
112 | + } |
|
113 | + } elseif (geodir_is_page('detail')) { |
|
114 | + $remove_class = true; |
|
115 | + if (get_option('geodir_detail_sidebar_left_section')) { |
|
116 | + $new_class .= 'sidebar-content gd-details-sidebar-left'; |
|
117 | + } else { |
|
118 | + $new_class .= 'content-sidebar'; |
|
119 | + } |
|
120 | + } elseif (geodir_is_page('search')) { |
|
121 | + $remove_class = true; |
|
122 | + if (get_option('geodir_show_search_left_section')) { |
|
123 | + $new_class .= 'sidebar-'; |
|
124 | + } |
|
125 | + $new_class .= 'content'; |
|
126 | + if (get_option('geodir_show_search_right_section')) { |
|
127 | + $new_class .= '-sidebar'; |
|
128 | + } |
|
129 | + } elseif (geodir_is_page('author')) { |
|
130 | + $remove_class = true; |
|
131 | + if (get_option('geodir_show_author_left_section')) { |
|
132 | + $new_class .= 'sidebar-'; |
|
133 | + } |
|
134 | + $new_class .= 'content'; |
|
135 | + if (get_option('geodir_show_author_right_section')) { |
|
136 | + $new_class .= '-sidebar'; |
|
137 | + } |
|
138 | + } elseif (geodir_is_page('add-listing')) { |
|
139 | + $remove_class = true; |
|
140 | + $new_class .= 'content-sidebar'; |
|
141 | + } |
|
142 | + |
|
143 | + if ($remove_class) { |
|
144 | + $classes = array_diff($classes, array('content-sidebar', 'sidebar-content', 'content-sidebar-sidebar', 'sidebar-sidebar-content', 'sidebar-content-sidebar', 'full-width-content')); |
|
145 | + if ( $new_class == 'content' ) { |
|
146 | + $new_class = 'content-no-sidebar'; |
|
147 | + $classes[] = 'full-width-content'; |
|
148 | + } |
|
149 | + $classes[] = $new_class; |
|
150 | + } |
|
151 | + |
|
152 | + return $classes; |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | add_action('genesis_after_header', 'gd_genesis_compat_add_top_section_back', 11); |
@@ -162,17 +162,17 @@ discard block |
||
162 | 162 | function gd_genesis_compat_add_top_section_back() |
163 | 163 | { |
164 | 164 | |
165 | - if (is_page_geodir_home() || geodir_is_page('location')) { |
|
166 | - geodir_action_geodir_sidebar_home_top(); |
|
167 | - } elseif (geodir_is_page('listing')) { |
|
168 | - geodir_action_geodir_sidebar_listings_top(); |
|
169 | - } elseif (geodir_is_page('detail')) { |
|
170 | - geodir_action_geodir_sidebar_detail_top(); |
|
171 | - } elseif (geodir_is_page('search')) { |
|
172 | - geodir_action_geodir_sidebar_search_top(); |
|
173 | - } elseif (geodir_is_page('author')) { |
|
174 | - geodir_action_geodir_sidebar_author_top(); |
|
175 | - } |
|
165 | + if (is_page_geodir_home() || geodir_is_page('location')) { |
|
166 | + geodir_action_geodir_sidebar_home_top(); |
|
167 | + } elseif (geodir_is_page('listing')) { |
|
168 | + geodir_action_geodir_sidebar_listings_top(); |
|
169 | + } elseif (geodir_is_page('detail')) { |
|
170 | + geodir_action_geodir_sidebar_detail_top(); |
|
171 | + } elseif (geodir_is_page('search')) { |
|
172 | + geodir_action_geodir_sidebar_search_top(); |
|
173 | + } elseif (geodir_is_page('author')) { |
|
174 | + geodir_action_geodir_sidebar_author_top(); |
|
175 | + } |
|
176 | 176 | |
177 | 177 | |
178 | 178 | } |
@@ -185,12 +185,12 @@ discard block |
||
185 | 185 | */ |
186 | 186 | function geodir_replace_breadcrumb() |
187 | 187 | { |
188 | - if (is_front_page() && geodir_is_page('home') && !geodir_is_page('login')) { |
|
189 | - } else { |
|
190 | - echo '<div class="geodir-breadcrumb-bar"><div class="wrap">'; |
|
191 | - geodir_breadcrumb(); |
|
192 | - echo '</div></div>'; |
|
193 | - } |
|
188 | + if (is_front_page() && geodir_is_page('home') && !geodir_is_page('login')) { |
|
189 | + } else { |
|
190 | + echo '<div class="geodir-breadcrumb-bar"><div class="wrap">'; |
|
191 | + geodir_breadcrumb(); |
|
192 | + echo '</div></div>'; |
|
193 | + } |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | // Force Full Width on signup page |
@@ -203,9 +203,9 @@ discard block |
||
203 | 203 | */ |
204 | 204 | function geodir_genesis_meta() |
205 | 205 | { |
206 | - if (geodir_is_page('login')) { |
|
207 | - add_filter('genesis_pre_get_option_site_layout', '__genesis_return_full_width_content'); |
|
208 | - } |
|
206 | + if (geodir_is_page('login')) { |
|
207 | + add_filter('genesis_pre_get_option_site_layout', '__genesis_return_full_width_content'); |
|
208 | + } |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | add_action('geodir_add_listing_page_title', 'geodir_add_listing_page_title_genesis_before', 8); |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | function geodir_add_listing_page_title_genesis_before() |
219 | 219 | { |
220 | 220 | |
221 | - echo "<div class='entry' >"; |
|
221 | + echo "<div class='entry' >"; |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | function geodir_add_listing_form_genesis_after() |
233 | 233 | { |
234 | 234 | |
235 | - echo "</div>"; |
|
235 | + echo "</div>"; |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | |
@@ -251,38 +251,38 @@ discard block |
||
251 | 251 | { |
252 | 252 | |
253 | 253 | |
254 | - $title = ''; |
|
255 | - $subtitle = ''; |
|
256 | - |
|
257 | - if (geodir_is_page('listing')) { |
|
258 | - echo '<div class="wrap gd-title-wrap">'; |
|
259 | - geodir_action_listings_title(); |
|
260 | - echo '</div>'; |
|
261 | - } |
|
262 | - |
|
263 | - if (geodir_is_page('add-listing')) { |
|
264 | - echo '<div class="wrap gd-title-wrap">'; |
|
265 | - geodir_action_add_listing_page_title(); |
|
266 | - echo '</div>'; |
|
267 | - } |
|
268 | - |
|
269 | - if (geodir_is_page('author')) { |
|
270 | - echo '<div class="wrap gd-title-wrap">'; |
|
271 | - geodir_action_author_page_title(); |
|
272 | - echo '</div>'; |
|
273 | - } |
|
274 | - |
|
275 | - if (geodir_is_page('detail') || geodir_is_page('preview')) { |
|
276 | - echo '<div class="wrap gd-title-wrap">'; |
|
277 | - echo get_the_title(); |
|
278 | - echo '</div>'; |
|
279 | - } |
|
280 | - |
|
281 | - if (geodir_is_page('search')) { |
|
282 | - echo '<div class="wrap gd-title-wrap">'; |
|
283 | - geodir_action_search_page_title(); |
|
284 | - echo '</div>'; |
|
285 | - } |
|
254 | + $title = ''; |
|
255 | + $subtitle = ''; |
|
256 | + |
|
257 | + if (geodir_is_page('listing')) { |
|
258 | + echo '<div class="wrap gd-title-wrap">'; |
|
259 | + geodir_action_listings_title(); |
|
260 | + echo '</div>'; |
|
261 | + } |
|
262 | + |
|
263 | + if (geodir_is_page('add-listing')) { |
|
264 | + echo '<div class="wrap gd-title-wrap">'; |
|
265 | + geodir_action_add_listing_page_title(); |
|
266 | + echo '</div>'; |
|
267 | + } |
|
268 | + |
|
269 | + if (geodir_is_page('author')) { |
|
270 | + echo '<div class="wrap gd-title-wrap">'; |
|
271 | + geodir_action_author_page_title(); |
|
272 | + echo '</div>'; |
|
273 | + } |
|
274 | + |
|
275 | + if (geodir_is_page('detail') || geodir_is_page('preview')) { |
|
276 | + echo '<div class="wrap gd-title-wrap">'; |
|
277 | + echo get_the_title(); |
|
278 | + echo '</div>'; |
|
279 | + } |
|
280 | + |
|
281 | + if (geodir_is_page('search')) { |
|
282 | + echo '<div class="wrap gd-title-wrap">'; |
|
283 | + geodir_action_search_page_title(); |
|
284 | + echo '</div>'; |
|
285 | + } |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | |
@@ -295,8 +295,8 @@ discard block |
||
295 | 295 | */ |
296 | 296 | function gd_genesis_listing_page_title_bar() |
297 | 297 | { |
298 | - geodir_action_listings_title(); |
|
299 | - //geodir_action_listings_description(); |
|
298 | + geodir_action_listings_title(); |
|
299 | + //geodir_action_listings_description(); |
|
300 | 300 | } |
301 | 301 | |
302 | 302 | |
@@ -309,19 +309,19 @@ discard block |
||
309 | 309 | */ |
310 | 310 | function gd_compat_php_genesis_geo_1280_fix() |
311 | 311 | { |
312 | - if (function_exists('geo1280_search_bar')) { |
|
313 | - remove_action('genesis_after_header', 'geo1280_search_bar', 20); |
|
314 | - add_action('genesis_after_header', 'geo1280_search_bar_fix', 4); |
|
312 | + if (function_exists('geo1280_search_bar')) { |
|
313 | + remove_action('genesis_after_header', 'geo1280_search_bar', 20); |
|
314 | + add_action('genesis_after_header', 'geo1280_search_bar_fix', 4); |
|
315 | 315 | |
316 | - // |
|
316 | + // |
|
317 | 317 | |
318 | - remove_action('genesis_after_header', 'geodir_replace_breadcrumb', 20); |
|
319 | - remove_action('genesis_before_content_sidebar_wrap', 'geodir_replace_breadcrumb', 20); |
|
320 | - add_action('geodir_wrapper_open', 'geodir_replace_breadcrumb', 105); |
|
318 | + remove_action('genesis_after_header', 'geodir_replace_breadcrumb', 20); |
|
319 | + remove_action('genesis_before_content_sidebar_wrap', 'geodir_replace_breadcrumb', 20); |
|
320 | + add_action('geodir_wrapper_open', 'geodir_replace_breadcrumb', 105); |
|
321 | 321 | |
322 | - remove_action('genesis_before_content_sidebar_wrap', 'geo1280_page_title', 10); |
|
323 | - add_action('geodir_wrapper_open', 'geo1280_page_title', 101); |
|
324 | - } |
|
322 | + remove_action('genesis_before_content_sidebar_wrap', 'geo1280_page_title', 10); |
|
323 | + add_action('geodir_wrapper_open', 'geo1280_page_title', 101); |
|
324 | + } |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | /** |
@@ -333,11 +333,11 @@ discard block |
||
333 | 333 | function geo1280_search_bar_fix() |
334 | 334 | { |
335 | 335 | |
336 | - echo '<div class="geo1280-placeholder"></div>'; |
|
337 | - if (is_active_sidebar('search-bar')) { |
|
338 | - genesis_widget_area('search-bar', array( |
|
339 | - 'before' => '<div class="search-bar widget-area"><div class="wrap">', |
|
340 | - 'after' => '</div></div>', |
|
341 | - )); |
|
342 | - } |
|
336 | + echo '<div class="geo1280-placeholder"></div>'; |
|
337 | + if (is_active_sidebar('search-bar')) { |
|
338 | + genesis_widget_area('search-bar', array( |
|
339 | + 'before' => '<div class="search-bar widget-area"><div class="wrap">', |
|
340 | + 'after' => '</div></div>', |
|
341 | + )); |
|
342 | + } |
|
343 | 343 | } |
@@ -142,7 +142,7 @@ |
||
142 | 142 | |
143 | 143 | if ($remove_class) { |
144 | 144 | $classes = array_diff($classes, array('content-sidebar', 'sidebar-content', 'content-sidebar-sidebar', 'sidebar-sidebar-content', 'sidebar-content-sidebar', 'full-width-content')); |
145 | - if ( $new_class == 'content' ) { |
|
145 | + if ($new_class == 'content') { |
|
146 | 146 | $new_class = 'content-no-sidebar'; |
147 | 147 | $classes[] = 'full-width-content'; |
148 | 148 | } |
@@ -13,34 +13,34 @@ discard block |
||
13 | 13 | */ |
14 | 14 | function geodir_user_favourite_listing_count($user_id=false) |
15 | 15 | { |
16 | - global $wpdb, $plugin_prefix, $current_user; |
|
16 | + global $wpdb, $plugin_prefix, $current_user; |
|
17 | 17 | |
18 | - if(!$user_id){$user_id = $current_user->ID;} |
|
19 | - if(!$user_id){return array();} |
|
18 | + if(!$user_id){$user_id = $current_user->ID;} |
|
19 | + if(!$user_id){return array();} |
|
20 | 20 | |
21 | - $site_id = ''; |
|
22 | - if ( is_multisite() ) { |
|
23 | - $blog_id = get_current_blog_id(); |
|
24 | - if($blog_id && $blog_id!='1'){$site_id = '_' . $blog_id ;} |
|
25 | - } |
|
21 | + $site_id = ''; |
|
22 | + if ( is_multisite() ) { |
|
23 | + $blog_id = get_current_blog_id(); |
|
24 | + if($blog_id && $blog_id!='1'){$site_id = '_' . $blog_id ;} |
|
25 | + } |
|
26 | 26 | |
27 | - $user_favorites = geodir_get_user_favourites($user_id); |
|
28 | - $all_posts = get_option('geodir_favorite_link_user_dashboard'); |
|
27 | + $user_favorites = geodir_get_user_favourites($user_id); |
|
28 | + $all_posts = get_option('geodir_favorite_link_user_dashboard'); |
|
29 | 29 | |
30 | - $user_listing = array(); |
|
31 | - if (is_array($all_posts) && !empty($all_posts) && is_array($user_favorites) && !empty($user_favorites)) { |
|
32 | - $user_favorites = "'" . implode("','", $user_favorites) . "'"; |
|
30 | + $user_listing = array(); |
|
31 | + if (is_array($all_posts) && !empty($all_posts) && is_array($user_favorites) && !empty($user_favorites)) { |
|
32 | + $user_favorites = "'" . implode("','", $user_favorites) . "'"; |
|
33 | 33 | |
34 | - foreach ($all_posts as $ptype) { |
|
35 | - $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_type='" . $ptype . "' AND post_status = 'publish' AND ID IN (" . $user_favorites . ")"); |
|
34 | + foreach ($all_posts as $ptype) { |
|
35 | + $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_type='" . $ptype . "' AND post_status = 'publish' AND ID IN (" . $user_favorites . ")"); |
|
36 | 36 | |
37 | - if ($total_posts > 0) { |
|
38 | - $user_listing[$ptype] = $total_posts; |
|
39 | - } |
|
40 | - } |
|
41 | - } |
|
37 | + if ($total_posts > 0) { |
|
38 | + $user_listing[$ptype] = $total_posts; |
|
39 | + } |
|
40 | + } |
|
41 | + } |
|
42 | 42 | |
43 | - return $user_listing; |
|
43 | + return $user_listing; |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -50,48 +50,48 @@ discard block |
||
50 | 50 | * @package GeoDirectory |
51 | 51 | */ |
52 | 52 | function geodir_user_show_favourites( $user_id = '', $output_type = 'select' ) { |
53 | - // My Favourites in Dashboard |
|
54 | - $show_favorite_link_user_dashboard = get_option( 'geodir_favorite_link_user_dashboard' ); |
|
55 | - $user_favourite = geodir_user_favourite_listing_count( $user_id ); |
|
56 | - |
|
57 | - if ( ! empty( $show_favorite_link_user_dashboard ) && ! empty( $user_favourite ) ) { |
|
58 | - $favourite_links = $output_type == 'link' ? array() : ''; |
|
59 | - $post_types = geodir_get_posttypes( 'object' ); |
|
60 | - |
|
61 | - $author_link = get_author_posts_url( $user_id ); |
|
62 | - $author_link = geodir_getlink( $author_link, array( 'geodir_dashbord' => 'true' ), false ); |
|
63 | - |
|
64 | - foreach ( $post_types as $key => $postobj ) { |
|
65 | - if ( in_array( $key, $show_favorite_link_user_dashboard ) && array_key_exists( $key, $user_favourite ) ) { |
|
66 | - $name = __( $postobj->labels->name, 'geodirectory' ); |
|
67 | - $post_type_link = geodir_getlink( $author_link, array( 'stype' => $key, 'list' => 'favourite' ), false ); |
|
68 | - |
|
69 | - /** |
|
70 | - * Filter favorite listing link. |
|
71 | - * |
|
72 | - * @since 1.0.0 |
|
73 | - * @param string $post_type_link Favorite listing link. |
|
74 | - * @param string $key Favorite listing array key. |
|
75 | - * @param int $current_user->ID Current user ID. |
|
76 | - */ |
|
77 | - $post_type_link = apply_filters( 'geodir_dashboard_link_favorite_listing', $post_type_link, $key, $user_id ); |
|
78 | - |
|
79 | - if ( $output_type == 'select' ) { |
|
80 | - $selected = ''; |
|
81 | - if ( isset( $_REQUEST['list'] ) && $_REQUEST['list'] == 'favourite' && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key && isset( $_REQUEST['geodir_dashbord'] ) ) { |
|
82 | - $selected = 'selected="selected"'; |
|
83 | - } |
|
84 | - |
|
85 | - $favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . $name . '</option>'; |
|
86 | - } elseif ( $output_type == 'link' ) { |
|
87 | - $favourite_links[] = '<a href="' . $post_type_link . '">' . $name . '</a>'; |
|
88 | - } |
|
89 | - } |
|
90 | - } |
|
91 | - |
|
92 | - if ( ! empty( $favourite_links ) ) { |
|
93 | - if ( $output_type == 'select' ) { |
|
94 | - ?> |
|
53 | + // My Favourites in Dashboard |
|
54 | + $show_favorite_link_user_dashboard = get_option( 'geodir_favorite_link_user_dashboard' ); |
|
55 | + $user_favourite = geodir_user_favourite_listing_count( $user_id ); |
|
56 | + |
|
57 | + if ( ! empty( $show_favorite_link_user_dashboard ) && ! empty( $user_favourite ) ) { |
|
58 | + $favourite_links = $output_type == 'link' ? array() : ''; |
|
59 | + $post_types = geodir_get_posttypes( 'object' ); |
|
60 | + |
|
61 | + $author_link = get_author_posts_url( $user_id ); |
|
62 | + $author_link = geodir_getlink( $author_link, array( 'geodir_dashbord' => 'true' ), false ); |
|
63 | + |
|
64 | + foreach ( $post_types as $key => $postobj ) { |
|
65 | + if ( in_array( $key, $show_favorite_link_user_dashboard ) && array_key_exists( $key, $user_favourite ) ) { |
|
66 | + $name = __( $postobj->labels->name, 'geodirectory' ); |
|
67 | + $post_type_link = geodir_getlink( $author_link, array( 'stype' => $key, 'list' => 'favourite' ), false ); |
|
68 | + |
|
69 | + /** |
|
70 | + * Filter favorite listing link. |
|
71 | + * |
|
72 | + * @since 1.0.0 |
|
73 | + * @param string $post_type_link Favorite listing link. |
|
74 | + * @param string $key Favorite listing array key. |
|
75 | + * @param int $current_user->ID Current user ID. |
|
76 | + */ |
|
77 | + $post_type_link = apply_filters( 'geodir_dashboard_link_favorite_listing', $post_type_link, $key, $user_id ); |
|
78 | + |
|
79 | + if ( $output_type == 'select' ) { |
|
80 | + $selected = ''; |
|
81 | + if ( isset( $_REQUEST['list'] ) && $_REQUEST['list'] == 'favourite' && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key && isset( $_REQUEST['geodir_dashbord'] ) ) { |
|
82 | + $selected = 'selected="selected"'; |
|
83 | + } |
|
84 | + |
|
85 | + $favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . $name . '</option>'; |
|
86 | + } elseif ( $output_type == 'link' ) { |
|
87 | + $favourite_links[] = '<a href="' . $post_type_link . '">' . $name . '</a>'; |
|
88 | + } |
|
89 | + } |
|
90 | + } |
|
91 | + |
|
92 | + if ( ! empty( $favourite_links ) ) { |
|
93 | + if ( $output_type == 'select' ) { |
|
94 | + ?> |
|
95 | 95 | <li> |
96 | 96 | <select id="geodir_my_favourites" class="chosen_select" onchange="window.location.href=this.value" option-autoredirect="1" name="geodir_my_favourites" option-ajaxchosen="false" data-placeholder="<?php echo esc_attr__( 'My Favorites', 'geodirectory' ); ?>"> |
97 | 97 | <option value="" disabled="disabled" selected="selected" style='display:none;'><?php echo esc_attr( wp_sprintf( __( "%s's Favorites", 'geodirectory' ), geodir_get_client_name( $user_id ) ) ); ?></option> |
@@ -99,55 +99,55 @@ discard block |
||
99 | 99 | </select> |
100 | 100 | </li> |
101 | 101 | <?php |
102 | - } elseif ( $output_type == 'link' ) { |
|
103 | - echo implode( " | ", $favourite_links ); |
|
104 | - } |
|
105 | - } |
|
106 | - } |
|
102 | + } elseif ( $output_type == 'link' ) { |
|
103 | + echo implode( " | ", $favourite_links ); |
|
104 | + } |
|
105 | + } |
|
106 | + } |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | function geodir_user_show_listings( $user_id = '', $output_type = 'select' ) { |
110 | - $show_listing_link_user_dashboard = get_option( 'geodir_listing_link_user_dashboard' ); |
|
111 | - $user_listing = geodir_user_post_listing_count( $user_id ); |
|
112 | - |
|
113 | - if ( ! empty( $show_listing_link_user_dashboard ) && ! empty( $user_listing ) ) { |
|
114 | - $listing_links = $output_type == 'link' ? array() : ''; |
|
115 | - |
|
116 | - $post_types = geodir_get_posttypes( 'object' ); |
|
117 | - |
|
118 | - $author_link = get_author_posts_url( $user_id ); |
|
119 | - $author_link = geodir_getlink( $author_link, array( 'geodir_dashbord' => 'true' ), false ); |
|
120 | - |
|
121 | - foreach ( $post_types as $key => $postobj ) { |
|
122 | - if ( in_array( $key, $show_listing_link_user_dashboard ) && array_key_exists( $key, $user_listing ) ) { |
|
123 | - $name = __( $postobj->labels->name, 'geodirectory' ); |
|
124 | - $listing_link = geodir_getlink( $author_link, array( 'stype' => $key ), false ); |
|
125 | - |
|
126 | - /** |
|
127 | - * Filter my listing link. |
|
128 | - * |
|
129 | - * @since 1.0.0 |
|
130 | - * @param string $listing_link My listing link. |
|
131 | - * @param string $key My listing array key. |
|
132 | - * @param int $current_user->ID Current user ID. |
|
133 | - */ |
|
134 | - $listing_link = apply_filters( 'geodir_dashboard_link_my_listing', $listing_link, $key, $user_id ); |
|
135 | - if ( $output_type == 'select' ) { |
|
136 | - $selected = ''; |
|
137 | - if ( ! isset( $_REQUEST['list'] ) && isset( $_REQUEST['geodir_dashbord'] ) && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key ) { |
|
138 | - $selected = 'selected="selected"'; |
|
139 | - } |
|
140 | - |
|
141 | - $listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . $name . '</option>'; |
|
142 | - } elseif ( $output_type == 'link' ) { |
|
143 | - $listing_links[] = '<a href="' . $listing_link . '">' . $name . '</a>'; |
|
144 | - } |
|
145 | - } |
|
146 | - } |
|
147 | - |
|
148 | - if ( ! empty( $listing_links ) ) { |
|
149 | - if ( $output_type == 'select' ) { |
|
150 | - ?> |
|
110 | + $show_listing_link_user_dashboard = get_option( 'geodir_listing_link_user_dashboard' ); |
|
111 | + $user_listing = geodir_user_post_listing_count( $user_id ); |
|
112 | + |
|
113 | + if ( ! empty( $show_listing_link_user_dashboard ) && ! empty( $user_listing ) ) { |
|
114 | + $listing_links = $output_type == 'link' ? array() : ''; |
|
115 | + |
|
116 | + $post_types = geodir_get_posttypes( 'object' ); |
|
117 | + |
|
118 | + $author_link = get_author_posts_url( $user_id ); |
|
119 | + $author_link = geodir_getlink( $author_link, array( 'geodir_dashbord' => 'true' ), false ); |
|
120 | + |
|
121 | + foreach ( $post_types as $key => $postobj ) { |
|
122 | + if ( in_array( $key, $show_listing_link_user_dashboard ) && array_key_exists( $key, $user_listing ) ) { |
|
123 | + $name = __( $postobj->labels->name, 'geodirectory' ); |
|
124 | + $listing_link = geodir_getlink( $author_link, array( 'stype' => $key ), false ); |
|
125 | + |
|
126 | + /** |
|
127 | + * Filter my listing link. |
|
128 | + * |
|
129 | + * @since 1.0.0 |
|
130 | + * @param string $listing_link My listing link. |
|
131 | + * @param string $key My listing array key. |
|
132 | + * @param int $current_user->ID Current user ID. |
|
133 | + */ |
|
134 | + $listing_link = apply_filters( 'geodir_dashboard_link_my_listing', $listing_link, $key, $user_id ); |
|
135 | + if ( $output_type == 'select' ) { |
|
136 | + $selected = ''; |
|
137 | + if ( ! isset( $_REQUEST['list'] ) && isset( $_REQUEST['geodir_dashbord'] ) && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key ) { |
|
138 | + $selected = 'selected="selected"'; |
|
139 | + } |
|
140 | + |
|
141 | + $listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . $name . '</option>'; |
|
142 | + } elseif ( $output_type == 'link' ) { |
|
143 | + $listing_links[] = '<a href="' . $listing_link . '">' . $name . '</a>'; |
|
144 | + } |
|
145 | + } |
|
146 | + } |
|
147 | + |
|
148 | + if ( ! empty( $listing_links ) ) { |
|
149 | + if ( $output_type == 'select' ) { |
|
150 | + ?> |
|
151 | 151 | <li> |
152 | 152 | <select id="geodir_my_listings" class="chosen_select" onchange="window.location.href=this.value" option-autoredirect="1" name="geodir_my_listings" option-ajaxchosen="false" data-placeholder="<?php echo esc_attr__( 'My Listings', 'geodirectory' ); ?>"> |
153 | 153 | <option value="" disabled="disabled" selected="selected" style='display:none;'><?php echo esc_attr( wp_sprintf( __( "%s's Listings", 'geodirectory' ), geodir_get_client_name( $user_id ) ) ); ?></option> |
@@ -155,11 +155,11 @@ discard block |
||
155 | 155 | </select> |
156 | 156 | </li> |
157 | 157 | <?php |
158 | - } elseif ( $output_type == 'link' ) { |
|
159 | - echo implode( " | ", $listing_links ); |
|
160 | - } |
|
161 | - } |
|
162 | - } |
|
158 | + } elseif ( $output_type == 'link' ) { |
|
159 | + echo implode( " | ", $listing_links ); |
|
160 | + } |
|
161 | + } |
|
162 | + } |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | /** |
@@ -170,12 +170,12 @@ discard block |
||
170 | 170 | * @return mixed |
171 | 171 | */ |
172 | 172 | function geodir_get_user_favourites($user_id=''){ |
173 | - if(!$user_id){$user_id = get_current_user_id();} |
|
174 | - $site_id = ''; |
|
175 | - if ( is_multisite() ) { |
|
176 | - $blog_id = get_current_blog_id(); |
|
177 | - if($blog_id && $blog_id!='1'){$site_id = '_' . $blog_id ;} |
|
178 | - } |
|
179 | - |
|
180 | - return get_user_meta($user_id, 'gd_user_favourite_post'.$site_id, true); |
|
173 | + if(!$user_id){$user_id = get_current_user_id();} |
|
174 | + $site_id = ''; |
|
175 | + if ( is_multisite() ) { |
|
176 | + $blog_id = get_current_blog_id(); |
|
177 | + if($blog_id && $blog_id!='1'){$site_id = '_' . $blog_id ;} |
|
178 | + } |
|
179 | + |
|
180 | + return get_user_meta($user_id, 'gd_user_favourite_post'.$site_id, true); |
|
181 | 181 | } |
182 | 182 | \ No newline at end of file |
@@ -11,17 +11,17 @@ discard block |
||
11 | 11 | * @global string $plugin_prefix Geodirectory plugin table prefix. |
12 | 12 | * @return array User listing count for each post type. |
13 | 13 | */ |
14 | -function geodir_user_favourite_listing_count($user_id=false) |
|
14 | +function geodir_user_favourite_listing_count($user_id = false) |
|
15 | 15 | { |
16 | 16 | global $wpdb, $plugin_prefix, $current_user; |
17 | 17 | |
18 | - if(!$user_id){$user_id = $current_user->ID;} |
|
19 | - if(!$user_id){return array();} |
|
18 | + if (!$user_id) {$user_id = $current_user->ID; } |
|
19 | + if (!$user_id) {return array(); } |
|
20 | 20 | |
21 | 21 | $site_id = ''; |
22 | - if ( is_multisite() ) { |
|
22 | + if (is_multisite()) { |
|
23 | 23 | $blog_id = get_current_blog_id(); |
24 | - if($blog_id && $blog_id!='1'){$site_id = '_' . $blog_id ;} |
|
24 | + if ($blog_id && $blog_id != '1') {$site_id = '_'.$blog_id; } |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | $user_favorites = geodir_get_user_favourites($user_id); |
@@ -29,10 +29,10 @@ discard block |
||
29 | 29 | |
30 | 30 | $user_listing = array(); |
31 | 31 | if (is_array($all_posts) && !empty($all_posts) && is_array($user_favorites) && !empty($user_favorites)) { |
32 | - $user_favorites = "'" . implode("','", $user_favorites) . "'"; |
|
32 | + $user_favorites = "'".implode("','", $user_favorites)."'"; |
|
33 | 33 | |
34 | 34 | foreach ($all_posts as $ptype) { |
35 | - $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_type='" . $ptype . "' AND post_status = 'publish' AND ID IN (" . $user_favorites . ")"); |
|
35 | + $total_posts = $wpdb->get_var("SELECT count( ID ) FROM ".$wpdb->prefix."posts WHERE post_type='".$ptype."' AND post_status = 'publish' AND ID IN (".$user_favorites.")"); |
|
36 | 36 | |
37 | 37 | if ($total_posts > 0) { |
38 | 38 | $user_listing[$ptype] = $total_posts; |
@@ -49,22 +49,22 @@ discard block |
||
49 | 49 | * @since 1.5.9 |
50 | 50 | * @package GeoDirectory |
51 | 51 | */ |
52 | -function geodir_user_show_favourites( $user_id = '', $output_type = 'select' ) { |
|
52 | +function geodir_user_show_favourites($user_id = '', $output_type = 'select') { |
|
53 | 53 | // My Favourites in Dashboard |
54 | - $show_favorite_link_user_dashboard = get_option( 'geodir_favorite_link_user_dashboard' ); |
|
55 | - $user_favourite = geodir_user_favourite_listing_count( $user_id ); |
|
54 | + $show_favorite_link_user_dashboard = get_option('geodir_favorite_link_user_dashboard'); |
|
55 | + $user_favourite = geodir_user_favourite_listing_count($user_id); |
|
56 | 56 | |
57 | - if ( ! empty( $show_favorite_link_user_dashboard ) && ! empty( $user_favourite ) ) { |
|
57 | + if (!empty($show_favorite_link_user_dashboard) && !empty($user_favourite)) { |
|
58 | 58 | $favourite_links = $output_type == 'link' ? array() : ''; |
59 | - $post_types = geodir_get_posttypes( 'object' ); |
|
59 | + $post_types = geodir_get_posttypes('object'); |
|
60 | 60 | |
61 | - $author_link = get_author_posts_url( $user_id ); |
|
62 | - $author_link = geodir_getlink( $author_link, array( 'geodir_dashbord' => 'true' ), false ); |
|
61 | + $author_link = get_author_posts_url($user_id); |
|
62 | + $author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false); |
|
63 | 63 | |
64 | - foreach ( $post_types as $key => $postobj ) { |
|
65 | - if ( in_array( $key, $show_favorite_link_user_dashboard ) && array_key_exists( $key, $user_favourite ) ) { |
|
66 | - $name = __( $postobj->labels->name, 'geodirectory' ); |
|
67 | - $post_type_link = geodir_getlink( $author_link, array( 'stype' => $key, 'list' => 'favourite' ), false ); |
|
64 | + foreach ($post_types as $key => $postobj) { |
|
65 | + if (in_array($key, $show_favorite_link_user_dashboard) && array_key_exists($key, $user_favourite)) { |
|
66 | + $name = __($postobj->labels->name, 'geodirectory'); |
|
67 | + $post_type_link = geodir_getlink($author_link, array('stype' => $key, 'list' => 'favourite'), false); |
|
68 | 68 | |
69 | 69 | /** |
70 | 70 | * Filter favorite listing link. |
@@ -74,54 +74,54 @@ discard block |
||
74 | 74 | * @param string $key Favorite listing array key. |
75 | 75 | * @param int $current_user->ID Current user ID. |
76 | 76 | */ |
77 | - $post_type_link = apply_filters( 'geodir_dashboard_link_favorite_listing', $post_type_link, $key, $user_id ); |
|
77 | + $post_type_link = apply_filters('geodir_dashboard_link_favorite_listing', $post_type_link, $key, $user_id); |
|
78 | 78 | |
79 | - if ( $output_type == 'select' ) { |
|
79 | + if ($output_type == 'select') { |
|
80 | 80 | $selected = ''; |
81 | - if ( isset( $_REQUEST['list'] ) && $_REQUEST['list'] == 'favourite' && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key && isset( $_REQUEST['geodir_dashbord'] ) ) { |
|
81 | + if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key && isset($_REQUEST['geodir_dashbord'])) { |
|
82 | 82 | $selected = 'selected="selected"'; |
83 | 83 | } |
84 | 84 | |
85 | - $favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . $name . '</option>'; |
|
86 | - } elseif ( $output_type == 'link' ) { |
|
87 | - $favourite_links[] = '<a href="' . $post_type_link . '">' . $name . '</a>'; |
|
85 | + $favourite_links .= '<option '.$selected.' value="'.$post_type_link.'">'.$name.'</option>'; |
|
86 | + } elseif ($output_type == 'link') { |
|
87 | + $favourite_links[] = '<a href="'.$post_type_link.'">'.$name.'</a>'; |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | } |
91 | 91 | |
92 | - if ( ! empty( $favourite_links ) ) { |
|
93 | - if ( $output_type == 'select' ) { |
|
92 | + if (!empty($favourite_links)) { |
|
93 | + if ($output_type == 'select') { |
|
94 | 94 | ?> |
95 | 95 | <li> |
96 | - <select id="geodir_my_favourites" class="chosen_select" onchange="window.location.href=this.value" option-autoredirect="1" name="geodir_my_favourites" option-ajaxchosen="false" data-placeholder="<?php echo esc_attr__( 'My Favorites', 'geodirectory' ); ?>"> |
|
97 | - <option value="" disabled="disabled" selected="selected" style='display:none;'><?php echo esc_attr( wp_sprintf( __( "%s's Favorites", 'geodirectory' ), geodir_get_client_name( $user_id ) ) ); ?></option> |
|
96 | + <select id="geodir_my_favourites" class="chosen_select" onchange="window.location.href=this.value" option-autoredirect="1" name="geodir_my_favourites" option-ajaxchosen="false" data-placeholder="<?php echo esc_attr__('My Favorites', 'geodirectory'); ?>"> |
|
97 | + <option value="" disabled="disabled" selected="selected" style='display:none;'><?php echo esc_attr(wp_sprintf(__("%s's Favorites", 'geodirectory'), geodir_get_client_name($user_id))); ?></option> |
|
98 | 98 | <?php echo $favourite_links; ?> |
99 | 99 | </select> |
100 | 100 | </li> |
101 | 101 | <?php |
102 | - } elseif ( $output_type == 'link' ) { |
|
103 | - echo implode( " | ", $favourite_links ); |
|
102 | + } elseif ($output_type == 'link') { |
|
103 | + echo implode(" | ", $favourite_links); |
|
104 | 104 | } |
105 | 105 | } |
106 | 106 | } |
107 | 107 | } |
108 | 108 | |
109 | -function geodir_user_show_listings( $user_id = '', $output_type = 'select' ) { |
|
110 | - $show_listing_link_user_dashboard = get_option( 'geodir_listing_link_user_dashboard' ); |
|
111 | - $user_listing = geodir_user_post_listing_count( $user_id ); |
|
109 | +function geodir_user_show_listings($user_id = '', $output_type = 'select') { |
|
110 | + $show_listing_link_user_dashboard = get_option('geodir_listing_link_user_dashboard'); |
|
111 | + $user_listing = geodir_user_post_listing_count($user_id); |
|
112 | 112 | |
113 | - if ( ! empty( $show_listing_link_user_dashboard ) && ! empty( $user_listing ) ) { |
|
113 | + if (!empty($show_listing_link_user_dashboard) && !empty($user_listing)) { |
|
114 | 114 | $listing_links = $output_type == 'link' ? array() : ''; |
115 | 115 | |
116 | - $post_types = geodir_get_posttypes( 'object' ); |
|
116 | + $post_types = geodir_get_posttypes('object'); |
|
117 | 117 | |
118 | - $author_link = get_author_posts_url( $user_id ); |
|
119 | - $author_link = geodir_getlink( $author_link, array( 'geodir_dashbord' => 'true' ), false ); |
|
118 | + $author_link = get_author_posts_url($user_id); |
|
119 | + $author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false); |
|
120 | 120 | |
121 | - foreach ( $post_types as $key => $postobj ) { |
|
122 | - if ( in_array( $key, $show_listing_link_user_dashboard ) && array_key_exists( $key, $user_listing ) ) { |
|
123 | - $name = __( $postobj->labels->name, 'geodirectory' ); |
|
124 | - $listing_link = geodir_getlink( $author_link, array( 'stype' => $key ), false ); |
|
121 | + foreach ($post_types as $key => $postobj) { |
|
122 | + if (in_array($key, $show_listing_link_user_dashboard) && array_key_exists($key, $user_listing)) { |
|
123 | + $name = __($postobj->labels->name, 'geodirectory'); |
|
124 | + $listing_link = geodir_getlink($author_link, array('stype' => $key), false); |
|
125 | 125 | |
126 | 126 | /** |
127 | 127 | * Filter my listing link. |
@@ -131,32 +131,32 @@ discard block |
||
131 | 131 | * @param string $key My listing array key. |
132 | 132 | * @param int $current_user->ID Current user ID. |
133 | 133 | */ |
134 | - $listing_link = apply_filters( 'geodir_dashboard_link_my_listing', $listing_link, $key, $user_id ); |
|
135 | - if ( $output_type == 'select' ) { |
|
134 | + $listing_link = apply_filters('geodir_dashboard_link_my_listing', $listing_link, $key, $user_id); |
|
135 | + if ($output_type == 'select') { |
|
136 | 136 | $selected = ''; |
137 | - if ( ! isset( $_REQUEST['list'] ) && isset( $_REQUEST['geodir_dashbord'] ) && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key ) { |
|
137 | + if (!isset($_REQUEST['list']) && isset($_REQUEST['geodir_dashbord']) && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key) { |
|
138 | 138 | $selected = 'selected="selected"'; |
139 | 139 | } |
140 | 140 | |
141 | - $listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . $name . '</option>'; |
|
142 | - } elseif ( $output_type == 'link' ) { |
|
143 | - $listing_links[] = '<a href="' . $listing_link . '">' . $name . '</a>'; |
|
141 | + $listing_links .= '<option '.$selected.' value="'.$listing_link.'">'.$name.'</option>'; |
|
142 | + } elseif ($output_type == 'link') { |
|
143 | + $listing_links[] = '<a href="'.$listing_link.'">'.$name.'</a>'; |
|
144 | 144 | } |
145 | 145 | } |
146 | 146 | } |
147 | 147 | |
148 | - if ( ! empty( $listing_links ) ) { |
|
149 | - if ( $output_type == 'select' ) { |
|
148 | + if (!empty($listing_links)) { |
|
149 | + if ($output_type == 'select') { |
|
150 | 150 | ?> |
151 | 151 | <li> |
152 | - <select id="geodir_my_listings" class="chosen_select" onchange="window.location.href=this.value" option-autoredirect="1" name="geodir_my_listings" option-ajaxchosen="false" data-placeholder="<?php echo esc_attr__( 'My Listings', 'geodirectory' ); ?>"> |
|
153 | - <option value="" disabled="disabled" selected="selected" style='display:none;'><?php echo esc_attr( wp_sprintf( __( "%s's Listings", 'geodirectory' ), geodir_get_client_name( $user_id ) ) ); ?></option> |
|
152 | + <select id="geodir_my_listings" class="chosen_select" onchange="window.location.href=this.value" option-autoredirect="1" name="geodir_my_listings" option-ajaxchosen="false" data-placeholder="<?php echo esc_attr__('My Listings', 'geodirectory'); ?>"> |
|
153 | + <option value="" disabled="disabled" selected="selected" style='display:none;'><?php echo esc_attr(wp_sprintf(__("%s's Listings", 'geodirectory'), geodir_get_client_name($user_id))); ?></option> |
|
154 | 154 | <?php echo $listing_links; ?> |
155 | 155 | </select> |
156 | 156 | </li> |
157 | 157 | <?php |
158 | - } elseif ( $output_type == 'link' ) { |
|
159 | - echo implode( " | ", $listing_links ); |
|
158 | + } elseif ($output_type == 'link') { |
|
159 | + echo implode(" | ", $listing_links); |
|
160 | 160 | } |
161 | 161 | } |
162 | 162 | } |
@@ -169,12 +169,12 @@ discard block |
||
169 | 169 | * @since 1.6.24 |
170 | 170 | * @return mixed |
171 | 171 | */ |
172 | -function geodir_get_user_favourites($user_id=''){ |
|
173 | - if(!$user_id){$user_id = get_current_user_id();} |
|
172 | +function geodir_get_user_favourites($user_id = '') { |
|
173 | + if (!$user_id) {$user_id = get_current_user_id(); } |
|
174 | 174 | $site_id = ''; |
175 | - if ( is_multisite() ) { |
|
175 | + if (is_multisite()) { |
|
176 | 176 | $blog_id = get_current_blog_id(); |
177 | - if($blog_id && $blog_id!='1'){$site_id = '_' . $blog_id ;} |
|
177 | + if ($blog_id && $blog_id != '1') {$site_id = '_'.$blog_id; } |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | return get_user_meta($user_id, 'gd_user_favourite_post'.$site_id, true); |
@@ -18,9 +18,9 @@ discard block |
||
18 | 18 | global $post_type; |
19 | 19 | |
20 | 20 | if (!isset($field_info->post_type)) { |
21 | - $post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
21 | + $post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
22 | 22 | } else |
23 | - $post_type = $field_info->post_type; |
|
23 | + $post_type = $field_info->post_type; |
|
24 | 24 | |
25 | 25 | //if(isset($_REQUEST['custom_type']) && $_REQUEST['custom_type']=='predefined'){ |
26 | 26 | // $cf_arr = geodir_custom_fields_predefined($post_type); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | $field_admin_title = ''; |
50 | 50 | if (isset($field_info->admin_title)) |
51 | - $field_admin_title = $field_info->admin_title; |
|
51 | + $field_admin_title = $field_info->admin_title; |
|
52 | 52 | |
53 | 53 | $default = isset($field_info->is_admin) ? $field_info->is_admin : ''; |
54 | 54 | |
@@ -68,21 +68,21 @@ discard block |
||
68 | 68 | //print_r($field_info); |
69 | 69 | |
70 | 70 | if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) { |
71 | - $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>'; |
|
71 | + $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>'; |
|
72 | 72 | }elseif(isset($cf['icon']) && $cf['icon']){ |
73 | - $field_icon = '<b class="gd-cf-icon" style="background-image: url(\''.$cf['icon'].'\')"></b>'; |
|
73 | + $field_icon = '<b class="gd-cf-icon" style="background-image: url(\''.$cf['icon'].'\')"></b>'; |
|
74 | 74 | }else{ |
75 | - $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>'; |
|
75 | + $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>'; |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | if(isset($cf['name']) && $cf['name']){ |
79 | - $field_type_name = $cf['name']; |
|
79 | + $field_type_name = $cf['name']; |
|
80 | 80 | }else{ |
81 | - $field_type_name = $field_type; |
|
81 | + $field_type_name = $field_type; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | if (isset($field_info->data_type) && $field_info->data_type == 'VARCHAR') { |
85 | - $field_info->data_type = 'XVARCHAR'; |
|
85 | + $field_info->data_type = 'XVARCHAR'; |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | ?> |
@@ -92,45 +92,45 @@ discard block |
||
92 | 92 | ondblclick="show_hide('field_frm<?php echo $result_str; ?>')" > |
93 | 93 | <?php |
94 | 94 | |
95 | - $nonce = wp_create_nonce('custom_fields_' . $result_str); |
|
96 | - ?> |
|
95 | + $nonce = wp_create_nonce('custom_fields_' . $result_str); |
|
96 | + ?> |
|
97 | 97 | |
98 | 98 | <?php if (!$default): ?> |
99 | 99 | <div title="<?php _e('Click to remove field', 'geodirectory'); ?>" |
100 | 100 | onclick="delete_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>')" |
101 | 101 | class="handlediv close"><i class="fa fa-times" aria-hidden="true"></i></div> |
102 | 102 | <?php endif; |
103 | - if ($field_type == 'fieldset') { |
|
104 | - ?> |
|
103 | + if ($field_type == 'fieldset') { |
|
104 | + ?> |
|
105 | 105 | <i class="fa fa-long-arrow-left " aria-hidden="true"></i> |
106 | 106 | <i class="fa fa-long-arrow-right " aria-hidden="true"></i> |
107 | 107 | <b style="cursor:pointer;" |
108 | 108 | onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory') . ' ' . $field_admin_title);?></b> |
109 | 109 | <?php |
110 | - } else {echo $field_icon; |
|
111 | - ?> |
|
110 | + } else {echo $field_icon; |
|
111 | + ?> |
|
112 | 112 | <b style="cursor:pointer;" |
113 | 113 | onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(' ' . $field_admin_title . ' (' . $field_type_name . ')');?></b> |
114 | 114 | <?php |
115 | - } |
|
116 | - ?> |
|
115 | + } |
|
116 | + ?> |
|
117 | 117 | </div> |
118 | 118 | |
119 | 119 | <form><!-- we need to wrap in a fom so we can use radio buttons with same name --> |
120 | 120 | <div id="field_frm<?php echo $result_str; ?>" class="field_frm" |
121 | 121 | style="display:<?php if ($field_ins_upd == 'submit') { |
122 | - echo 'block;'; |
|
123 | - } else { |
|
124 | - echo 'none;'; |
|
125 | - } ?>"> |
|
122 | + echo 'block;'; |
|
123 | + } else { |
|
124 | + echo 'none;'; |
|
125 | + } ?>"> |
|
126 | 126 | <input type="hidden" name="_wpnonce" value="<?php echo esc_attr($nonce); ?>"/> |
127 | 127 | <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type; ?>"/> |
128 | 128 | <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type; ?>"/> |
129 | 129 | <input type="hidden" name="field_type_key" id="field_type_key" value="<?php echo $field_type_key; ?>"/> |
130 | 130 | <input type="hidden" name="field_id" id="field_id" value="<?php echo esc_attr($result_str); ?>"/> |
131 | 131 | <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) { |
132 | - echo $field_info->data_type; |
|
133 | - } ?>"/> |
|
132 | + echo $field_info->data_type; |
|
133 | + } ?>"/> |
|
134 | 134 | <input type="hidden" name="is_active" id="is_active" value="1"/> |
135 | 135 | |
136 | 136 | <input type="hidden" name="is_default" value="<?php echo isset($field_info->is_default) ? $field_info->is_default : '';?>" /><?php // show in sidebar value?> |
@@ -142,37 +142,37 @@ discard block |
||
142 | 142 | |
143 | 143 | <?php |
144 | 144 | |
145 | - // data_type |
|
146 | - if(has_filter("geodir_cfa_data_type_{$field_type}")){ |
|
145 | + // data_type |
|
146 | + if(has_filter("geodir_cfa_data_type_{$field_type}")){ |
|
147 | 147 | |
148 | - echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info); |
|
148 | + echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info); |
|
149 | 149 | |
150 | - }else{ |
|
151 | - $value = ''; |
|
152 | - if (isset($field_info->data_type)) { |
|
153 | - $value = esc_attr($field_info->data_type); |
|
154 | - }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){ |
|
155 | - $value = $cf['defaults']['data_type']; |
|
156 | - } |
|
157 | - ?> |
|
150 | + }else{ |
|
151 | + $value = ''; |
|
152 | + if (isset($field_info->data_type)) { |
|
153 | + $value = esc_attr($field_info->data_type); |
|
154 | + }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){ |
|
155 | + $value = $cf['defaults']['data_type']; |
|
156 | + } |
|
157 | + ?> |
|
158 | 158 | <input type="hidden" name="data_type" id="data_type" value="<?php echo $value;?>"/> |
159 | 159 | <?php |
160 | - } |
|
160 | + } |
|
161 | 161 | |
162 | 162 | |
163 | - // admin_title |
|
164 | - if(has_filter("geodir_cfa_admin_title_{$field_type}")){ |
|
163 | + // admin_title |
|
164 | + if(has_filter("geodir_cfa_admin_title_{$field_type}")){ |
|
165 | 165 | |
166 | - echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info); |
|
166 | + echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info); |
|
167 | 167 | |
168 | - }else{ |
|
169 | - $value = ''; |
|
170 | - if (isset($field_info->admin_title)) { |
|
171 | - $value = esc_attr($field_info->admin_title); |
|
172 | - }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){ |
|
173 | - $value = $cf['defaults']['admin_title']; |
|
174 | - } |
|
175 | - ?> |
|
168 | + }else{ |
|
169 | + $value = ''; |
|
170 | + if (isset($field_info->admin_title)) { |
|
171 | + $value = esc_attr($field_info->admin_title); |
|
172 | + }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){ |
|
173 | + $value = $cf['defaults']['admin_title']; |
|
174 | + } |
|
175 | + ?> |
|
176 | 176 | <li> |
177 | 177 | <label for="admin_title" class="gd-cf-tooltip-wrap"> |
178 | 178 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Admin title :', 'geodirectory'); ?> |
@@ -186,22 +186,22 @@ discard block |
||
186 | 186 | </div> |
187 | 187 | </li> |
188 | 188 | <?php |
189 | - } |
|
189 | + } |
|
190 | 190 | |
191 | 191 | |
192 | - // site_title |
|
193 | - if(has_filter("geodir_cfa_site_title_{$field_type}")){ |
|
192 | + // site_title |
|
193 | + if(has_filter("geodir_cfa_site_title_{$field_type}")){ |
|
194 | 194 | |
195 | - echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info); |
|
195 | + echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info); |
|
196 | 196 | |
197 | - }else{ |
|
198 | - $value = ''; |
|
199 | - if (isset($field_info->site_title)) { |
|
200 | - $value = esc_attr($field_info->site_title); |
|
201 | - }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){ |
|
202 | - $value = $cf['defaults']['site_title']; |
|
203 | - } |
|
204 | - ?> |
|
197 | + }else{ |
|
198 | + $value = ''; |
|
199 | + if (isset($field_info->site_title)) { |
|
200 | + $value = esc_attr($field_info->site_title); |
|
201 | + }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){ |
|
202 | + $value = $cf['defaults']['site_title']; |
|
203 | + } |
|
204 | + ?> |
|
205 | 205 | <li> |
206 | 206 | <label for="site_title" class="gd-cf-tooltip-wrap"> <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Frontend title :', 'geodirectory'); ?> |
207 | 207 | <div class="gdcf-tooltip"> |
@@ -214,22 +214,22 @@ discard block |
||
214 | 214 | </div> |
215 | 215 | </li> |
216 | 216 | <?php |
217 | - } |
|
217 | + } |
|
218 | 218 | |
219 | 219 | |
220 | - // admin_desc |
|
221 | - if(has_filter("geodir_cfa_admin_desc_{$field_type}")){ |
|
220 | + // admin_desc |
|
221 | + if(has_filter("geodir_cfa_admin_desc_{$field_type}")){ |
|
222 | 222 | |
223 | - echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info); |
|
223 | + echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info); |
|
224 | 224 | |
225 | - }else{ |
|
226 | - $value = ''; |
|
227 | - if (isset($field_info->admin_desc)) { |
|
228 | - $value = esc_attr($field_info->admin_desc); |
|
229 | - }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){ |
|
230 | - $value = $cf['defaults']['admin_desc']; |
|
231 | - } |
|
232 | - ?> |
|
225 | + }else{ |
|
226 | + $value = ''; |
|
227 | + if (isset($field_info->admin_desc)) { |
|
228 | + $value = esc_attr($field_info->admin_desc); |
|
229 | + }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){ |
|
230 | + $value = $cf['defaults']['admin_desc']; |
|
231 | + } |
|
232 | + ?> |
|
233 | 233 | <li> |
234 | 234 | <label for="admin_desc" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Frontend description :', 'geodirectory'); ?> |
235 | 235 | <div class="gdcf-tooltip"> |
@@ -241,23 +241,23 @@ discard block |
||
241 | 241 | </div> |
242 | 242 | </li> |
243 | 243 | <?php |
244 | - } |
|
244 | + } |
|
245 | 245 | |
246 | 246 | |
247 | 247 | |
248 | - // htmlvar_name |
|
249 | - if(has_filter("geodir_cfa_htmlvar_name_{$field_type}")){ |
|
248 | + // htmlvar_name |
|
249 | + if(has_filter("geodir_cfa_htmlvar_name_{$field_type}")){ |
|
250 | 250 | |
251 | - echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info); |
|
251 | + echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info); |
|
252 | 252 | |
253 | - }else{ |
|
254 | - $value = ''; |
|
255 | - if (isset($field_info->htmlvar_name)) { |
|
256 | - $value = esc_attr($field_info->htmlvar_name); |
|
257 | - }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){ |
|
258 | - $value = $cf['defaults']['htmlvar_name']; |
|
259 | - } |
|
260 | - ?> |
|
253 | + }else{ |
|
254 | + $value = ''; |
|
255 | + if (isset($field_info->htmlvar_name)) { |
|
256 | + $value = esc_attr($field_info->htmlvar_name); |
|
257 | + }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){ |
|
258 | + $value = $cf['defaults']['htmlvar_name']; |
|
259 | + } |
|
260 | + ?> |
|
261 | 261 | <li> |
262 | 262 | <label for="htmlvar_name" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('HTML variable name :', 'geodirectory');?> |
263 | 263 | <div class="gdcf-tooltip"> |
@@ -267,29 +267,29 @@ discard block |
||
267 | 267 | <div class="gd-cf-input-wrap"> |
268 | 268 | <input type="text" name="htmlvar_name" id="htmlvar_name" pattern="[a-zA-Z0-9]+" title="<?php _e('Must not contain spaces or special characters', 'geodirectory');?>" |
269 | 269 | value="<?php if ($value) { |
270 | - echo preg_replace('/geodir_/', '', $value, 1); |
|
271 | - }?>" <?php if ($default) { |
|
272 | - echo 'readonly="readonly"'; |
|
273 | - }?> /> |
|
270 | + echo preg_replace('/geodir_/', '', $value, 1); |
|
271 | + }?>" <?php if ($default) { |
|
272 | + echo 'readonly="readonly"'; |
|
273 | + }?> /> |
|
274 | 274 | </div> |
275 | 275 | </li> |
276 | 276 | <?php |
277 | - } |
|
277 | + } |
|
278 | 278 | |
279 | 279 | |
280 | - // is_active |
|
281 | - if(has_filter("geodir_cfa_is_active_{$field_type}")){ |
|
280 | + // is_active |
|
281 | + if(has_filter("geodir_cfa_is_active_{$field_type}")){ |
|
282 | 282 | |
283 | - echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info); |
|
283 | + echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info); |
|
284 | 284 | |
285 | - }else{ |
|
286 | - $value = ''; |
|
287 | - if (isset($field_info->is_active)) { |
|
288 | - $value = esc_attr($field_info->is_active); |
|
289 | - }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){ |
|
290 | - $value = $cf['defaults']['is_active']; |
|
291 | - } |
|
292 | - ?> |
|
285 | + }else{ |
|
286 | + $value = ''; |
|
287 | + if (isset($field_info->is_active)) { |
|
288 | + $value = esc_attr($field_info->is_active); |
|
289 | + }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){ |
|
290 | + $value = $cf['defaults']['is_active']; |
|
291 | + } |
|
292 | + ?> |
|
293 | 293 | <li <?php echo $field_display; ?>> |
294 | 294 | <label for="is_active" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Is active :', 'geodirectory'); ?> |
295 | 295 | <div class="gdcf-tooltip"> |
@@ -300,35 +300,35 @@ discard block |
||
300 | 300 | |
301 | 301 | <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled" value="1" |
302 | 302 | <?php if ($value == '1') { |
303 | - echo 'checked'; |
|
304 | - } ?>/> |
|
303 | + echo 'checked'; |
|
304 | + } ?>/> |
|
305 | 305 | <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
306 | 306 | |
307 | 307 | <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0" |
308 | 308 | <?php if ($value == '0' || !$value) { |
309 | - echo 'checked'; |
|
310 | - } ?>/> |
|
309 | + echo 'checked'; |
|
310 | + } ?>/> |
|
311 | 311 | <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
312 | 312 | |
313 | 313 | </div> |
314 | 314 | </li> |
315 | 315 | <?php |
316 | - } |
|
316 | + } |
|
317 | 317 | |
318 | 318 | |
319 | - // for_admin_use |
|
320 | - if(has_filter("geodir_cfa_for_admin_use_{$field_type}")){ |
|
319 | + // for_admin_use |
|
320 | + if(has_filter("geodir_cfa_for_admin_use_{$field_type}")){ |
|
321 | 321 | |
322 | - echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info); |
|
322 | + echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info); |
|
323 | 323 | |
324 | - }else{ |
|
325 | - $value = ''; |
|
326 | - if (isset($field_info->for_admin_use)) { |
|
327 | - $value = esc_attr($field_info->for_admin_use); |
|
328 | - }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){ |
|
329 | - $value = $cf['defaults']['for_admin_use']; |
|
330 | - } |
|
331 | - ?> |
|
324 | + }else{ |
|
325 | + $value = ''; |
|
326 | + if (isset($field_info->for_admin_use)) { |
|
327 | + $value = esc_attr($field_info->for_admin_use); |
|
328 | + }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){ |
|
329 | + $value = $cf['defaults']['for_admin_use']; |
|
330 | + } |
|
331 | + ?> |
|
332 | 332 | <li> |
333 | 333 | <label for="for_admin_use" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('For admin use only? :', 'geodirectory'); ?> |
334 | 334 | <div class="gdcf-tooltip"> |
@@ -339,47 +339,47 @@ discard block |
||
339 | 339 | |
340 | 340 | <input type="radio" id="for_admin_use_yes<?php echo $radio_id;?>" name="for_admin_use" class="gdri-enabled" value="1" |
341 | 341 | <?php if ($value == '1') { |
342 | - echo 'checked'; |
|
343 | - } ?>/> |
|
342 | + echo 'checked'; |
|
343 | + } ?>/> |
|
344 | 344 | <label for="for_admin_use_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
345 | 345 | |
346 | 346 | <input type="radio" id="for_admin_use_no<?php echo $radio_id;?>" name="for_admin_use" class="gdri-disabled" value="0" |
347 | 347 | <?php if ($value == '0' || !$value) { |
348 | - echo 'checked'; |
|
349 | - } ?>/> |
|
348 | + echo 'checked'; |
|
349 | + } ?>/> |
|
350 | 350 | <label for="for_admin_use_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
351 | 351 | |
352 | 352 | </div> |
353 | 353 | </li> |
354 | 354 | <?php |
355 | - } |
|
355 | + } |
|
356 | 356 | |
357 | 357 | |
358 | - // default_value |
|
359 | - if(has_filter("geodir_cfa_default_value_{$field_type}")){ |
|
358 | + // default_value |
|
359 | + if(has_filter("geodir_cfa_default_value_{$field_type}")){ |
|
360 | 360 | |
361 | - echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info); |
|
361 | + echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info); |
|
362 | 362 | |
363 | - }else{ |
|
364 | - $value = ''; |
|
365 | - if (isset($field_info->default_value)) { |
|
366 | - $value = esc_attr($field_info->default_value); |
|
367 | - }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){ |
|
368 | - $value = $cf['defaults']['default_value']; |
|
369 | - } |
|
370 | - ?> |
|
363 | + }else{ |
|
364 | + $value = ''; |
|
365 | + if (isset($field_info->default_value)) { |
|
366 | + $value = esc_attr($field_info->default_value); |
|
367 | + }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){ |
|
368 | + $value = $cf['defaults']['default_value']; |
|
369 | + } |
|
370 | + ?> |
|
371 | 371 | <li> |
372 | 372 | <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory');?> |
373 | 373 | <div class="gdcf-tooltip"> |
374 | 374 | <?php |
375 | - if ($field_type == 'checkbox') { |
|
376 | - _e('Should the checkbox be checked by default?', 'geodirectory'); |
|
377 | - } else if ($field_type == 'email') { |
|
378 | - _e('A default value for the field, usually blank. Ex: [email protected]', 'geodirectory'); |
|
379 | - } else { |
|
380 | - _e('A default value for the field, usually blank. (for "link" this will be used as the link text)', 'geodirectory'); |
|
381 | - } |
|
382 | - ?> |
|
375 | + if ($field_type == 'checkbox') { |
|
376 | + _e('Should the checkbox be checked by default?', 'geodirectory'); |
|
377 | + } else if ($field_type == 'email') { |
|
378 | + _e('A default value for the field, usually blank. Ex: [email protected]', 'geodirectory'); |
|
379 | + } else { |
|
380 | + _e('A default value for the field, usually blank. (for "link" this will be used as the link text)', 'geodirectory'); |
|
381 | + } |
|
382 | + ?> |
|
383 | 383 | </div> |
384 | 384 | </label> |
385 | 385 | <div class="gd-cf-input-wrap"> |
@@ -396,22 +396,22 @@ discard block |
||
396 | 396 | </div> |
397 | 397 | </li> |
398 | 398 | <?php |
399 | - } |
|
399 | + } |
|
400 | 400 | |
401 | 401 | |
402 | - // show_in |
|
403 | - if(has_filter("geodir_cfa_show_in_{$field_type}")){ |
|
402 | + // show_in |
|
403 | + if(has_filter("geodir_cfa_show_in_{$field_type}")){ |
|
404 | 404 | |
405 | - echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info); |
|
405 | + echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info); |
|
406 | 406 | |
407 | - }else{ |
|
408 | - $value = ''; |
|
409 | - if (isset($field_info->show_in)) { |
|
410 | - $value = esc_attr($field_info->show_in); |
|
411 | - }elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){ |
|
412 | - $value = esc_attr($cf['defaults']['show_in']); |
|
413 | - } |
|
414 | - ?> |
|
407 | + }else{ |
|
408 | + $value = ''; |
|
409 | + if (isset($field_info->show_in)) { |
|
410 | + $value = esc_attr($field_info->show_in); |
|
411 | + }elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){ |
|
412 | + $value = esc_attr($cf['defaults']['show_in']); |
|
413 | + } |
|
414 | + ?> |
|
415 | 415 | <li> |
416 | 416 | <label for="show_in" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show in what locations?:', 'geodirectory'); ?> |
417 | 417 | <div class="gdcf-tooltip"> |
@@ -422,41 +422,41 @@ discard block |
||
422 | 422 | |
423 | 423 | <?php |
424 | 424 | |
425 | - /* |
|
425 | + /* |
|
426 | 426 | * We wrap the key values in [] so we can search the DB easier with a LIKE query. |
427 | 427 | */ |
428 | - $show_in_locations = array( |
|
429 | - "[detail]" => __("Details page sidebar", 'geodirectory'), |
|
430 | - "[moreinfo]" => __("More info tab", 'geodirectory'), |
|
431 | - "[listing]" => __("Listings page", 'geodirectory'), |
|
432 | - "[owntab]" => __("Details page own tab", 'geodirectory'), |
|
433 | - "[mapbubble]" => __("Map bubble", 'geodirectory'), |
|
434 | - ); |
|
435 | - |
|
436 | - /** |
|
437 | - * Filter the locations array for where to display custom fields. |
|
438 | - * |
|
439 | - * @since 1.6.6 |
|
440 | - * @param array $show_in_locations The array of locations and descriptions. |
|
441 | - * @param object $field_info The field being displayed info. |
|
442 | - * @param string $field_info The type of field. |
|
443 | - */ |
|
444 | - $show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info,$field_type); |
|
445 | - |
|
446 | - |
|
447 | - // remove some locations for some field types |
|
448 | - |
|
449 | - // don't show new tab option for some types |
|
450 | - if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) { |
|
451 | - }else{ |
|
452 | - unset($show_in_locations['[owntab]']); |
|
453 | - } |
|
454 | - |
|
455 | - if(!$display_on_listing){ |
|
456 | - unset($show_in_locations['[listings]']); |
|
457 | - } |
|
458 | - |
|
459 | - ?> |
|
428 | + $show_in_locations = array( |
|
429 | + "[detail]" => __("Details page sidebar", 'geodirectory'), |
|
430 | + "[moreinfo]" => __("More info tab", 'geodirectory'), |
|
431 | + "[listing]" => __("Listings page", 'geodirectory'), |
|
432 | + "[owntab]" => __("Details page own tab", 'geodirectory'), |
|
433 | + "[mapbubble]" => __("Map bubble", 'geodirectory'), |
|
434 | + ); |
|
435 | + |
|
436 | + /** |
|
437 | + * Filter the locations array for where to display custom fields. |
|
438 | + * |
|
439 | + * @since 1.6.6 |
|
440 | + * @param array $show_in_locations The array of locations and descriptions. |
|
441 | + * @param object $field_info The field being displayed info. |
|
442 | + * @param string $field_info The type of field. |
|
443 | + */ |
|
444 | + $show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info,$field_type); |
|
445 | + |
|
446 | + |
|
447 | + // remove some locations for some field types |
|
448 | + |
|
449 | + // don't show new tab option for some types |
|
450 | + if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) { |
|
451 | + }else{ |
|
452 | + unset($show_in_locations['[owntab]']); |
|
453 | + } |
|
454 | + |
|
455 | + if(!$display_on_listing){ |
|
456 | + unset($show_in_locations['[listings]']); |
|
457 | + } |
|
458 | + |
|
459 | + ?> |
|
460 | 460 | |
461 | 461 | <select multiple="multiple" name="show_in[]" |
462 | 462 | id="show_in" |
@@ -466,38 +466,38 @@ discard block |
||
466 | 466 | option-ajaxchosen="false"> |
467 | 467 | <?php |
468 | 468 | |
469 | - $show_in_values = explode(',',$value); |
|
469 | + $show_in_values = explode(',',$value); |
|
470 | 470 | |
471 | - foreach( $show_in_locations as $key => $val){ |
|
472 | - $selected = ''; |
|
471 | + foreach( $show_in_locations as $key => $val){ |
|
472 | + $selected = ''; |
|
473 | 473 | |
474 | - if(is_array($show_in_values) && in_array($key,$show_in_values ) ){ |
|
475 | - $selected = 'selected'; |
|
476 | - } |
|
474 | + if(is_array($show_in_values) && in_array($key,$show_in_values ) ){ |
|
475 | + $selected = 'selected'; |
|
476 | + } |
|
477 | 477 | |
478 | - ?> |
|
478 | + ?> |
|
479 | 479 | <option value="<?php echo $key;?>" <?php echo $selected;?>><?php echo $val;?></option> |
480 | 480 | <?php |
481 | - } |
|
482 | - ?> |
|
481 | + } |
|
482 | + ?> |
|
483 | 483 | </select> |
484 | 484 | </div> |
485 | 485 | </li> |
486 | 486 | <?php |
487 | - } |
|
487 | + } |
|
488 | 488 | |
489 | 489 | |
490 | - // advanced_editor |
|
491 | - if(has_filter("geodir_cfa_advanced_editor_{$field_type}")){ |
|
490 | + // advanced_editor |
|
491 | + if(has_filter("geodir_cfa_advanced_editor_{$field_type}")){ |
|
492 | 492 | |
493 | - echo apply_filters("geodir_cfa_advanced_editor_{$field_type}",'',$result_str,$cf,$field_info); |
|
493 | + echo apply_filters("geodir_cfa_advanced_editor_{$field_type}",'',$result_str,$cf,$field_info); |
|
494 | 494 | |
495 | - } |
|
495 | + } |
|
496 | 496 | |
497 | 497 | |
498 | 498 | |
499 | 499 | |
500 | - ?> |
|
500 | + ?> |
|
501 | 501 | |
502 | 502 | |
503 | 503 | <?php // @todo this does not seem to be used for anything, it can be removed or replaced ?> |
@@ -510,38 +510,38 @@ discard block |
||
510 | 510 | |
511 | 511 | <?php |
512 | 512 | |
513 | - $pricearr = array(); |
|
514 | - if (isset($field_info->packages) && $field_info->packages != '') { |
|
515 | - $pricearr = explode(',', trim($field_info->packages, ',')); |
|
516 | - } else { |
|
517 | - $package_info = array(); |
|
513 | + $pricearr = array(); |
|
514 | + if (isset($field_info->packages) && $field_info->packages != '') { |
|
515 | + $pricearr = explode(',', trim($field_info->packages, ',')); |
|
516 | + } else { |
|
517 | + $package_info = array(); |
|
518 | 518 | |
519 | - $package_info = geodir_post_package_info($package_info, '', $post_type); |
|
520 | - $pricearr[] = $package_info->pid; |
|
521 | - } |
|
519 | + $package_info = geodir_post_package_info($package_info, '', $post_type); |
|
520 | + $pricearr[] = $package_info->pid; |
|
521 | + } |
|
522 | 522 | |
523 | - ob_start() |
|
524 | - ?> |
|
523 | + ob_start() |
|
524 | + ?> |
|
525 | 525 | |
526 | 526 | <select style="display:none" name="show_on_pkg[]" id="show_on_pkg" multiple="multiple"> |
527 | 527 | <?php |
528 | - if (!empty($pricearr)) { |
|
529 | - foreach ($pricearr as $val) { |
|
530 | - ?> |
|
528 | + if (!empty($pricearr)) { |
|
529 | + foreach ($pricearr as $val) { |
|
530 | + ?> |
|
531 | 531 | <option selected="selected" value="<?php echo esc_attr($val); ?>" ><?php echo $val; ?></option><?php |
532 | - } |
|
533 | - } |
|
534 | - ?> |
|
532 | + } |
|
533 | + } |
|
534 | + ?> |
|
535 | 535 | </select> |
536 | 536 | |
537 | 537 | <?php |
538 | - $html = ob_get_clean(); |
|
538 | + $html = ob_get_clean(); |
|
539 | 539 | |
540 | 540 | /** |
541 | 541 | * Filter the price packages list. |
542 | 542 | * |
543 | 543 | * Filter the price packages list in custom field form in admin |
544 | - * custom fields settings. |
|
544 | + * custom fields settings. |
|
545 | 545 | * |
546 | 546 | * @since 1.0.0 |
547 | 547 | * |
@@ -550,25 +550,25 @@ discard block |
||
550 | 550 | */ |
551 | 551 | echo $html = apply_filters('geodir_packages_list_on_custom_fields', $html, $field_info); |
552 | 552 | |
553 | - ?> |
|
553 | + ?> |
|
554 | 554 | |
555 | 555 | |
556 | 556 | |
557 | 557 | <?php |
558 | 558 | |
559 | - // is_required |
|
560 | - if(has_filter("geodir_cfa_is_required_{$field_type}")){ |
|
559 | + // is_required |
|
560 | + if(has_filter("geodir_cfa_is_required_{$field_type}")){ |
|
561 | 561 | |
562 | - echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info); |
|
562 | + echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info); |
|
563 | 563 | |
564 | - }else{ |
|
565 | - $value = ''; |
|
566 | - if (isset($field_info->is_required)) { |
|
567 | - $value = esc_attr($field_info->is_required); |
|
568 | - }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){ |
|
569 | - $value = $cf['defaults']['is_required']; |
|
570 | - } |
|
571 | - ?> |
|
564 | + }else{ |
|
565 | + $value = ''; |
|
566 | + if (isset($field_info->is_required)) { |
|
567 | + $value = esc_attr($field_info->is_required); |
|
568 | + }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){ |
|
569 | + $value = $cf['defaults']['is_required']; |
|
570 | + } |
|
571 | + ?> |
|
572 | 572 | <li> |
573 | 573 | <label for="is_required" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Is required :', 'geodirectory'); ?> |
574 | 574 | <div class="gdcf-tooltip"> |
@@ -580,14 +580,14 @@ discard block |
||
580 | 580 | |
581 | 581 | <input type="radio" id="is_required_yes<?php echo $radio_id;?>" name="is_required" class="gdri-enabled" value="1" |
582 | 582 | <?php if ($value == '1') { |
583 | - echo 'checked'; |
|
584 | - } ?>/> |
|
583 | + echo 'checked'; |
|
584 | + } ?>/> |
|
585 | 585 | <label onclick="show_hide_radio(this,'show','cf-is-required-msg');" for="is_required_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
586 | 586 | |
587 | 587 | <input type="radio" id="is_required_no<?php echo $radio_id;?>" name="is_required" class="gdri-disabled" value="0" |
588 | 588 | <?php if ($value == '0' || !$value) { |
589 | - echo 'checked'; |
|
590 | - } ?>/> |
|
589 | + echo 'checked'; |
|
590 | + } ?>/> |
|
591 | 591 | <label onclick="show_hide_radio(this,'hide','cf-is-required-msg');" for="is_required_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
592 | 592 | |
593 | 593 | </div> |
@@ -595,21 +595,21 @@ discard block |
||
595 | 595 | </li> |
596 | 596 | |
597 | 597 | <?php |
598 | - } |
|
598 | + } |
|
599 | 599 | |
600 | - // required_msg |
|
601 | - if(has_filter("geodir_cfa_required_msg_{$field_type}")){ |
|
600 | + // required_msg |
|
601 | + if(has_filter("geodir_cfa_required_msg_{$field_type}")){ |
|
602 | 602 | |
603 | - echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info); |
|
603 | + echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info); |
|
604 | 604 | |
605 | - }else{ |
|
606 | - $value = ''; |
|
607 | - if (isset($field_info->required_msg)) { |
|
608 | - $value = esc_attr($field_info->required_msg); |
|
609 | - }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){ |
|
610 | - $value = $cf['defaults']['required_msg']; |
|
611 | - } |
|
612 | - ?> |
|
605 | + }else{ |
|
606 | + $value = ''; |
|
607 | + if (isset($field_info->required_msg)) { |
|
608 | + $value = esc_attr($field_info->required_msg); |
|
609 | + }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){ |
|
610 | + $value = $cf['defaults']['required_msg']; |
|
611 | + } |
|
612 | + ?> |
|
613 | 613 | <li class="cf-is-required-msg" <?php if ((isset($field_info->is_required) && $field_info->is_required == '0') || !isset($field_info->is_required)) {echo "style='display:none;'";}?>> |
614 | 614 | <label for="required_msg" class="gd-cf-tooltip-wrap"> |
615 | 615 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Required message:', 'geodirectory'); ?> |
@@ -623,38 +623,38 @@ discard block |
||
623 | 623 | </div> |
624 | 624 | </li> |
625 | 625 | <?php |
626 | - } |
|
626 | + } |
|
627 | 627 | |
628 | 628 | |
629 | - // required_msg |
|
630 | - if(has_filter("geodir_cfa_validation_pattern_{$field_type}")){ |
|
629 | + // required_msg |
|
630 | + if(has_filter("geodir_cfa_validation_pattern_{$field_type}")){ |
|
631 | 631 | |
632 | - echo apply_filters("geodir_cfa_validation_pattern_{$field_type}",'',$result_str,$cf,$field_info); |
|
632 | + echo apply_filters("geodir_cfa_validation_pattern_{$field_type}",'',$result_str,$cf,$field_info); |
|
633 | 633 | |
634 | - } |
|
634 | + } |
|
635 | 635 | |
636 | 636 | |
637 | - // extra_fields |
|
638 | - if(has_filter("geodir_cfa_extra_fields_{$field_type}")){ |
|
637 | + // extra_fields |
|
638 | + if(has_filter("geodir_cfa_extra_fields_{$field_type}")){ |
|
639 | 639 | |
640 | - echo apply_filters("geodir_cfa_extra_fields_{$field_type}",'',$result_str,$cf,$field_info); |
|
640 | + echo apply_filters("geodir_cfa_extra_fields_{$field_type}",'',$result_str,$cf,$field_info); |
|
641 | 641 | |
642 | - } |
|
642 | + } |
|
643 | 643 | |
644 | 644 | |
645 | - // field_icon |
|
646 | - if(has_filter("geodir_cfa_field_icon_{$field_type}")){ |
|
645 | + // field_icon |
|
646 | + if(has_filter("geodir_cfa_field_icon_{$field_type}")){ |
|
647 | 647 | |
648 | - echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info); |
|
648 | + echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info); |
|
649 | 649 | |
650 | - }else{ |
|
651 | - $value = ''; |
|
652 | - if (isset($field_info->field_icon)) { |
|
653 | - $value = esc_attr($field_info->field_icon); |
|
654 | - }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){ |
|
655 | - $value = $cf['defaults']['field_icon']; |
|
656 | - } |
|
657 | - ?> |
|
650 | + }else{ |
|
651 | + $value = ''; |
|
652 | + if (isset($field_info->field_icon)) { |
|
653 | + $value = esc_attr($field_info->field_icon); |
|
654 | + }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){ |
|
655 | + $value = $cf['defaults']['field_icon']; |
|
656 | + } |
|
657 | + ?> |
|
658 | 658 | <li> |
659 | 659 | <h3><?php echo __('Custom css', 'geodirectory'); ?></h3> |
660 | 660 | |
@@ -672,22 +672,22 @@ discard block |
||
672 | 672 | |
673 | 673 | </li> |
674 | 674 | <?php |
675 | - } |
|
675 | + } |
|
676 | 676 | |
677 | 677 | |
678 | - // css_class |
|
679 | - if(has_filter("geodir_cfa_css_class_{$field_type}")){ |
|
678 | + // css_class |
|
679 | + if(has_filter("geodir_cfa_css_class_{$field_type}")){ |
|
680 | 680 | |
681 | - echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info); |
|
681 | + echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info); |
|
682 | 682 | |
683 | - }else{ |
|
684 | - $value = ''; |
|
685 | - if (isset($field_info->css_class)) { |
|
686 | - $value = esc_attr($field_info->css_class); |
|
687 | - }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){ |
|
688 | - $value = $cf['defaults']['css_class']; |
|
689 | - } |
|
690 | - ?> |
|
683 | + }else{ |
|
684 | + $value = ''; |
|
685 | + if (isset($field_info->css_class)) { |
|
686 | + $value = esc_attr($field_info->css_class); |
|
687 | + }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){ |
|
688 | + $value = $cf['defaults']['css_class']; |
|
689 | + } |
|
690 | + ?> |
|
691 | 691 | <li> |
692 | 692 | |
693 | 693 | <label for="css_class" class="gd-cf-tooltip-wrap"> |
@@ -700,47 +700,47 @@ discard block |
||
700 | 700 | <div class="gd-cf-input-wrap"> |
701 | 701 | <input type="text" name="css_class" id="css_class" |
702 | 702 | value="<?php if (isset($field_info->css_class)) { |
703 | - echo esc_attr($field_info->css_class); |
|
704 | - }?>"/> |
|
703 | + echo esc_attr($field_info->css_class); |
|
704 | + }?>"/> |
|
705 | 705 | </div> |
706 | 706 | </li> |
707 | 707 | <?php |
708 | - } |
|
708 | + } |
|
709 | 709 | |
710 | 710 | |
711 | - // cat_sort |
|
712 | - if(has_filter("geodir_cfa_cat_sort_{$field_type}")){ |
|
711 | + // cat_sort |
|
712 | + if(has_filter("geodir_cfa_cat_sort_{$field_type}")){ |
|
713 | 713 | |
714 | - echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info); |
|
714 | + echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info); |
|
715 | 715 | |
716 | - }else{ |
|
717 | - $value = ''; |
|
718 | - $hide_cat_sort =''; |
|
719 | - if (isset($field_info->cat_sort)) { |
|
720 | - $value = esc_attr($field_info->cat_sort); |
|
721 | - }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){ |
|
722 | - $value = $cf['defaults']['cat_sort']; |
|
723 | - $hide_cat_sort = ($value===false) ? "style='display:none;'" : ''; |
|
724 | - } |
|
716 | + }else{ |
|
717 | + $value = ''; |
|
718 | + $hide_cat_sort =''; |
|
719 | + if (isset($field_info->cat_sort)) { |
|
720 | + $value = esc_attr($field_info->cat_sort); |
|
721 | + }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){ |
|
722 | + $value = $cf['defaults']['cat_sort']; |
|
723 | + $hide_cat_sort = ($value===false) ? "style='display:none;'" : ''; |
|
724 | + } |
|
725 | 725 | |
726 | - $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']===false) ? "style='display:none;'" : ''; |
|
727 | - ?> |
|
726 | + $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']===false) ? "style='display:none;'" : ''; |
|
727 | + ?> |
|
728 | 728 | <li <?php echo $hide_cat_sort ;?>> |
729 | 729 | <h3><?php |
730 | - /** |
|
731 | - * Filter the section title. |
|
732 | - * |
|
733 | - * Filter the section title in custom field form in admin |
|
734 | - * custom fields settings. |
|
735 | - * |
|
736 | - * @since 1.0.0 |
|
737 | - * |
|
738 | - * @param string $title Title of the section. |
|
739 | - * @param string $field_type Current field type. |
|
740 | - */ |
|
741 | - echo apply_filters('geodir_advance_custom_fields_heading', __('Posts sort options', 'geodirectory'), $field_type); |
|
742 | - |
|
743 | - ?></h3> |
|
730 | + /** |
|
731 | + * Filter the section title. |
|
732 | + * |
|
733 | + * Filter the section title in custom field form in admin |
|
734 | + * custom fields settings. |
|
735 | + * |
|
736 | + * @since 1.0.0 |
|
737 | + * |
|
738 | + * @param string $title Title of the section. |
|
739 | + * @param string $field_type Current field type. |
|
740 | + */ |
|
741 | + echo apply_filters('geodir_advance_custom_fields_heading', __('Posts sort options', 'geodirectory'), $field_type); |
|
742 | + |
|
743 | + ?></h3> |
|
744 | 744 | <label for="cat_sort" class="gd-cf-tooltip-wrap"> |
745 | 745 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Include this field in sorting options :', 'geodirectory'); ?> |
746 | 746 | <div class="gdcf-tooltip"> |
@@ -752,42 +752,42 @@ discard block |
||
752 | 752 | |
753 | 753 | <input type="radio" id="cat_sort_yes<?php echo $radio_id;?>" name="cat_sort" class="gdri-enabled" value="1" |
754 | 754 | <?php if ($value == '1') { |
755 | - echo 'checked'; |
|
756 | - } ?>/> |
|
755 | + echo 'checked'; |
|
756 | + } ?>/> |
|
757 | 757 | <label for="cat_sort_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
758 | 758 | |
759 | 759 | <input type="radio" id="cat_sort_no<?php echo $radio_id;?>" name="cat_sort" class="gdri-disabled" value="0" |
760 | 760 | <?php if (!$value) { |
761 | - echo 'checked'; |
|
762 | - } ?>/> |
|
761 | + echo 'checked'; |
|
762 | + } ?>/> |
|
763 | 763 | <label for="cat_sort_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
764 | 764 | |
765 | 765 | </div> |
766 | 766 | </li> |
767 | 767 | <?php |
768 | - } |
|
769 | - |
|
770 | - |
|
771 | - |
|
772 | - switch ($field_type): |
|
773 | - case 'html': |
|
774 | - case 'file': |
|
775 | - case 'url': |
|
776 | - case 'fieldset': |
|
777 | - break; |
|
778 | - default: |
|
779 | - |
|
780 | - /** |
|
781 | - * Called at the end of the advanced custom fields settings page loop. |
|
782 | - * |
|
783 | - * Can be used to add or deal with different settings types. |
|
784 | - * |
|
785 | - * @since 1.0.0 |
|
786 | - * @since 1.6.6 $cf param added. |
|
787 | - * @param object $field_info The current fields info. |
|
788 | - * @param array $cf The custom field settings |
|
789 | - */ |
|
790 | - do_action('geodir_advance_custom_fields', $field_info,$cf);?> |
|
768 | + } |
|
769 | + |
|
770 | + |
|
771 | + |
|
772 | + switch ($field_type): |
|
773 | + case 'html': |
|
774 | + case 'file': |
|
775 | + case 'url': |
|
776 | + case 'fieldset': |
|
777 | + break; |
|
778 | + default: |
|
779 | + |
|
780 | + /** |
|
781 | + * Called at the end of the advanced custom fields settings page loop. |
|
782 | + * |
|
783 | + * Can be used to add or deal with different settings types. |
|
784 | + * |
|
785 | + * @since 1.0.0 |
|
786 | + * @since 1.6.6 $cf param added. |
|
787 | + * @param object $field_info The current fields info. |
|
788 | + * @param array $cf The custom field settings |
|
789 | + */ |
|
790 | + do_action('geodir_advance_custom_fields', $field_info,$cf);?> |
|
791 | 791 | |
792 | 792 | |
793 | 793 | <?php endswitch; ?> |
@@ -39,12 +39,12 @@ discard block |
||
39 | 39 | $cf = (isset($cf_arr[$field_type_key])) ? $cf_arr[$field_type_key] : ''; |
40 | 40 | |
41 | 41 | |
42 | -if(isset($field_info->extra_fields)){$extra_fields = $field_info->extra_fields;} |
|
42 | +if (isset($field_info->extra_fields)) {$extra_fields = $field_info->extra_fields; } |
|
43 | 43 | $field_info = stripslashes_deep($field_info); // strip slashes from labels |
44 | -if(isset($field_info->extra_fields)){$field_info->extra_fields = $extra_fields;} |
|
44 | +if (isset($field_info->extra_fields)) {$field_info->extra_fields = $extra_fields; } |
|
45 | 45 | |
46 | 46 | |
47 | -$nonce = wp_create_nonce('custom_fields_' . $result_str); |
|
47 | +$nonce = wp_create_nonce('custom_fields_'.$result_str); |
|
48 | 48 | |
49 | 49 | $field_admin_title = ''; |
50 | 50 | if (isset($field_info->admin_title)) |
@@ -69,15 +69,15 @@ discard block |
||
69 | 69 | |
70 | 70 | if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) { |
71 | 71 | $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>'; |
72 | -}elseif(isset($cf['icon']) && $cf['icon']){ |
|
72 | +}elseif (isset($cf['icon']) && $cf['icon']) { |
|
73 | 73 | $field_icon = '<b class="gd-cf-icon" style="background-image: url(\''.$cf['icon'].'\')"></b>'; |
74 | -}else{ |
|
74 | +} else { |
|
75 | 75 | $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>'; |
76 | 76 | } |
77 | 77 | |
78 | -if(isset($cf['name']) && $cf['name']){ |
|
78 | +if (isset($cf['name']) && $cf['name']) { |
|
79 | 79 | $field_type_name = $cf['name']; |
80 | -}else{ |
|
80 | +} else { |
|
81 | 81 | $field_type_name = $field_type; |
82 | 82 | } |
83 | 83 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | ondblclick="show_hide('field_frm<?php echo $result_str; ?>')" > |
93 | 93 | <?php |
94 | 94 | |
95 | - $nonce = wp_create_nonce('custom_fields_' . $result_str); |
|
95 | + $nonce = wp_create_nonce('custom_fields_'.$result_str); |
|
96 | 96 | ?> |
97 | 97 | |
98 | 98 | <?php if (!$default): ?> |
@@ -105,12 +105,12 @@ discard block |
||
105 | 105 | <i class="fa fa-long-arrow-left " aria-hidden="true"></i> |
106 | 106 | <i class="fa fa-long-arrow-right " aria-hidden="true"></i> |
107 | 107 | <b style="cursor:pointer;" |
108 | - onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory') . ' ' . $field_admin_title);?></b> |
|
108 | + onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory').' '.$field_admin_title); ?></b> |
|
109 | 109 | <?php |
110 | 110 | } else {echo $field_icon; |
111 | 111 | ?> |
112 | 112 | <b style="cursor:pointer;" |
113 | - onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(' ' . $field_admin_title . ' (' . $field_type_name . ')');?></b> |
|
113 | + onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(' '.$field_admin_title.' ('.$field_type_name.')'); ?></b> |
|
114 | 114 | <?php |
115 | 115 | } |
116 | 116 | ?> |
@@ -133,43 +133,43 @@ discard block |
||
133 | 133 | } ?>"/> |
134 | 134 | <input type="hidden" name="is_active" id="is_active" value="1"/> |
135 | 135 | |
136 | - <input type="hidden" name="is_default" value="<?php echo isset($field_info->is_default) ? $field_info->is_default : '';?>" /><?php // show in sidebar value?> |
|
137 | - <input type="hidden" name="show_on_listing" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : '';?>" /> |
|
138 | - <input type="hidden" name="show_on_detail" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : '';?>" /> |
|
139 | - <input type="hidden" name="show_as_tab" value="<?php echo isset($field_info->show_as_tab) ? $field_info->show_as_tab : '';?>" /> |
|
136 | + <input type="hidden" name="is_default" value="<?php echo isset($field_info->is_default) ? $field_info->is_default : ''; ?>" /><?php // show in sidebar value?> |
|
137 | + <input type="hidden" name="show_on_listing" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : ''; ?>" /> |
|
138 | + <input type="hidden" name="show_on_detail" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : ''; ?>" /> |
|
139 | + <input type="hidden" name="show_as_tab" value="<?php echo isset($field_info->show_as_tab) ? $field_info->show_as_tab : ''; ?>" /> |
|
140 | 140 | |
141 | 141 | <ul class="widefat post fixed" border="0" style="width:100%;"> |
142 | 142 | |
143 | 143 | <?php |
144 | 144 | |
145 | 145 | // data_type |
146 | - if(has_filter("geodir_cfa_data_type_{$field_type}")){ |
|
146 | + if (has_filter("geodir_cfa_data_type_{$field_type}")) { |
|
147 | 147 | |
148 | - echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info); |
|
148 | + echo apply_filters("geodir_cfa_data_type_{$field_type}", '', $result_str, $cf, $field_info); |
|
149 | 149 | |
150 | - }else{ |
|
150 | + } else { |
|
151 | 151 | $value = ''; |
152 | 152 | if (isset($field_info->data_type)) { |
153 | 153 | $value = esc_attr($field_info->data_type); |
154 | - }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){ |
|
154 | + }elseif (isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']) { |
|
155 | 155 | $value = $cf['defaults']['data_type']; |
156 | 156 | } |
157 | 157 | ?> |
158 | - <input type="hidden" name="data_type" id="data_type" value="<?php echo $value;?>"/> |
|
158 | + <input type="hidden" name="data_type" id="data_type" value="<?php echo $value; ?>"/> |
|
159 | 159 | <?php |
160 | 160 | } |
161 | 161 | |
162 | 162 | |
163 | 163 | // admin_title |
164 | - if(has_filter("geodir_cfa_admin_title_{$field_type}")){ |
|
164 | + if (has_filter("geodir_cfa_admin_title_{$field_type}")) { |
|
165 | 165 | |
166 | - echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info); |
|
166 | + echo apply_filters("geodir_cfa_admin_title_{$field_type}", '', $result_str, $cf, $field_info); |
|
167 | 167 | |
168 | - }else{ |
|
168 | + } else { |
|
169 | 169 | $value = ''; |
170 | 170 | if (isset($field_info->admin_title)) { |
171 | 171 | $value = esc_attr($field_info->admin_title); |
172 | - }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){ |
|
172 | + }elseif (isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']) { |
|
173 | 173 | $value = $cf['defaults']['admin_title']; |
174 | 174 | } |
175 | 175 | ?> |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | </label> |
183 | 183 | <div class="gd-cf-input-wrap"> |
184 | 184 | <input type="text" name="admin_title" id="admin_title" |
185 | - value="<?php echo $value;?>"/> |
|
185 | + value="<?php echo $value; ?>"/> |
|
186 | 186 | </div> |
187 | 187 | </li> |
188 | 188 | <?php |
@@ -190,15 +190,15 @@ discard block |
||
190 | 190 | |
191 | 191 | |
192 | 192 | // site_title |
193 | - if(has_filter("geodir_cfa_site_title_{$field_type}")){ |
|
193 | + if (has_filter("geodir_cfa_site_title_{$field_type}")) { |
|
194 | 194 | |
195 | - echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info); |
|
195 | + echo apply_filters("geodir_cfa_site_title_{$field_type}", '', $result_str, $cf, $field_info); |
|
196 | 196 | |
197 | - }else{ |
|
197 | + } else { |
|
198 | 198 | $value = ''; |
199 | 199 | if (isset($field_info->site_title)) { |
200 | 200 | $value = esc_attr($field_info->site_title); |
201 | - }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){ |
|
201 | + }elseif (isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']) { |
|
202 | 202 | $value = $cf['defaults']['site_title']; |
203 | 203 | } |
204 | 204 | ?> |
@@ -218,15 +218,15 @@ discard block |
||
218 | 218 | |
219 | 219 | |
220 | 220 | // admin_desc |
221 | - if(has_filter("geodir_cfa_admin_desc_{$field_type}")){ |
|
221 | + if (has_filter("geodir_cfa_admin_desc_{$field_type}")) { |
|
222 | 222 | |
223 | - echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info); |
|
223 | + echo apply_filters("geodir_cfa_admin_desc_{$field_type}", '', $result_str, $cf, $field_info); |
|
224 | 224 | |
225 | - }else{ |
|
225 | + } else { |
|
226 | 226 | $value = ''; |
227 | 227 | if (isset($field_info->admin_desc)) { |
228 | 228 | $value = esc_attr($field_info->admin_desc); |
229 | - }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){ |
|
229 | + }elseif (isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']) { |
|
230 | 230 | $value = $cf['defaults']['admin_desc']; |
231 | 231 | } |
232 | 232 | ?> |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | </div> |
238 | 238 | </label> |
239 | 239 | <div class="gd-cf-input-wrap"> |
240 | - <input type="text" name="admin_desc" id="admin_desc" value="<?php echo $value;?>"/> |
|
240 | + <input type="text" name="admin_desc" id="admin_desc" value="<?php echo $value; ?>"/> |
|
241 | 241 | </div> |
242 | 242 | </li> |
243 | 243 | <?php |
@@ -246,26 +246,26 @@ discard block |
||
246 | 246 | |
247 | 247 | |
248 | 248 | // htmlvar_name |
249 | - if(has_filter("geodir_cfa_htmlvar_name_{$field_type}")){ |
|
249 | + if (has_filter("geodir_cfa_htmlvar_name_{$field_type}")) { |
|
250 | 250 | |
251 | - echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info); |
|
251 | + echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}", '', $result_str, $cf, $field_info); |
|
252 | 252 | |
253 | - }else{ |
|
253 | + } else { |
|
254 | 254 | $value = ''; |
255 | 255 | if (isset($field_info->htmlvar_name)) { |
256 | 256 | $value = esc_attr($field_info->htmlvar_name); |
257 | - }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){ |
|
257 | + }elseif (isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']) { |
|
258 | 258 | $value = $cf['defaults']['htmlvar_name']; |
259 | 259 | } |
260 | 260 | ?> |
261 | 261 | <li> |
262 | - <label for="htmlvar_name" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('HTML variable name :', 'geodirectory');?> |
|
262 | + <label for="htmlvar_name" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('HTML variable name :', 'geodirectory'); ?> |
|
263 | 263 | <div class="gdcf-tooltip"> |
264 | 264 | <?php _e('This is a unique identifier used in the HTML, it MUST NOT contain spaces or special characters.', 'geodirectory'); ?> |
265 | 265 | </div> |
266 | 266 | </label> |
267 | 267 | <div class="gd-cf-input-wrap"> |
268 | - <input type="text" name="htmlvar_name" id="htmlvar_name" pattern="[a-zA-Z0-9]+" title="<?php _e('Must not contain spaces or special characters', 'geodirectory');?>" |
|
268 | + <input type="text" name="htmlvar_name" id="htmlvar_name" pattern="[a-zA-Z0-9]+" title="<?php _e('Must not contain spaces or special characters', 'geodirectory'); ?>" |
|
269 | 269 | value="<?php if ($value) { |
270 | 270 | echo preg_replace('/geodir_/', '', $value, 1); |
271 | 271 | }?>" <?php if ($default) { |
@@ -278,15 +278,15 @@ discard block |
||
278 | 278 | |
279 | 279 | |
280 | 280 | // is_active |
281 | - if(has_filter("geodir_cfa_is_active_{$field_type}")){ |
|
281 | + if (has_filter("geodir_cfa_is_active_{$field_type}")) { |
|
282 | 282 | |
283 | - echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info); |
|
283 | + echo apply_filters("geodir_cfa_is_active_{$field_type}", '', $result_str, $cf, $field_info); |
|
284 | 284 | |
285 | - }else{ |
|
285 | + } else { |
|
286 | 286 | $value = ''; |
287 | 287 | if (isset($field_info->is_active)) { |
288 | 288 | $value = esc_attr($field_info->is_active); |
289 | - }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){ |
|
289 | + }elseif (isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']) { |
|
290 | 290 | $value = $cf['defaults']['is_active']; |
291 | 291 | } |
292 | 292 | ?> |
@@ -298,17 +298,17 @@ discard block |
||
298 | 298 | </label> |
299 | 299 | <div class="gd-cf-input-wrap gd-switch"> |
300 | 300 | |
301 | - <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled" value="1" |
|
301 | + <input type="radio" id="is_active_yes<?php echo $radio_id; ?>" name="is_active" class="gdri-enabled" value="1" |
|
302 | 302 | <?php if ($value == '1') { |
303 | 303 | echo 'checked'; |
304 | 304 | } ?>/> |
305 | - <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
|
305 | + <label for="is_active_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
|
306 | 306 | |
307 | - <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0" |
|
307 | + <input type="radio" id="is_active_no<?php echo $radio_id; ?>" name="is_active" class="gdri-disabled" value="0" |
|
308 | 308 | <?php if ($value == '0' || !$value) { |
309 | 309 | echo 'checked'; |
310 | 310 | } ?>/> |
311 | - <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
|
311 | + <label for="is_active_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
|
312 | 312 | |
313 | 313 | </div> |
314 | 314 | </li> |
@@ -317,15 +317,15 @@ discard block |
||
317 | 317 | |
318 | 318 | |
319 | 319 | // for_admin_use |
320 | - if(has_filter("geodir_cfa_for_admin_use_{$field_type}")){ |
|
320 | + if (has_filter("geodir_cfa_for_admin_use_{$field_type}")) { |
|
321 | 321 | |
322 | - echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info); |
|
322 | + echo apply_filters("geodir_cfa_for_admin_use_{$field_type}", '', $result_str, $cf, $field_info); |
|
323 | 323 | |
324 | - }else{ |
|
324 | + } else { |
|
325 | 325 | $value = ''; |
326 | 326 | if (isset($field_info->for_admin_use)) { |
327 | 327 | $value = esc_attr($field_info->for_admin_use); |
328 | - }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){ |
|
328 | + }elseif (isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']) { |
|
329 | 329 | $value = $cf['defaults']['for_admin_use']; |
330 | 330 | } |
331 | 331 | ?> |
@@ -337,17 +337,17 @@ discard block |
||
337 | 337 | </label> |
338 | 338 | <div class="gd-cf-input-wrap gd-switch"> |
339 | 339 | |
340 | - <input type="radio" id="for_admin_use_yes<?php echo $radio_id;?>" name="for_admin_use" class="gdri-enabled" value="1" |
|
340 | + <input type="radio" id="for_admin_use_yes<?php echo $radio_id; ?>" name="for_admin_use" class="gdri-enabled" value="1" |
|
341 | 341 | <?php if ($value == '1') { |
342 | 342 | echo 'checked'; |
343 | 343 | } ?>/> |
344 | - <label for="for_admin_use_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
|
344 | + <label for="for_admin_use_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
|
345 | 345 | |
346 | - <input type="radio" id="for_admin_use_no<?php echo $radio_id;?>" name="for_admin_use" class="gdri-disabled" value="0" |
|
346 | + <input type="radio" id="for_admin_use_no<?php echo $radio_id; ?>" name="for_admin_use" class="gdri-disabled" value="0" |
|
347 | 347 | <?php if ($value == '0' || !$value) { |
348 | 348 | echo 'checked'; |
349 | 349 | } ?>/> |
350 | - <label for="for_admin_use_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
|
350 | + <label for="for_admin_use_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
|
351 | 351 | |
352 | 352 | </div> |
353 | 353 | </li> |
@@ -356,20 +356,20 @@ discard block |
||
356 | 356 | |
357 | 357 | |
358 | 358 | // default_value |
359 | - if(has_filter("geodir_cfa_default_value_{$field_type}")){ |
|
359 | + if (has_filter("geodir_cfa_default_value_{$field_type}")) { |
|
360 | 360 | |
361 | - echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info); |
|
361 | + echo apply_filters("geodir_cfa_default_value_{$field_type}", '', $result_str, $cf, $field_info); |
|
362 | 362 | |
363 | - }else{ |
|
363 | + } else { |
|
364 | 364 | $value = ''; |
365 | 365 | if (isset($field_info->default_value)) { |
366 | 366 | $value = esc_attr($field_info->default_value); |
367 | - }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){ |
|
367 | + }elseif (isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']) { |
|
368 | 368 | $value = $cf['defaults']['default_value']; |
369 | 369 | } |
370 | 370 | ?> |
371 | 371 | <li> |
372 | - <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory');?> |
|
372 | + <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory'); ?> |
|
373 | 373 | <div class="gdcf-tooltip"> |
374 | 374 | <?php |
375 | 375 | if ($field_type == 'checkbox') { |
@@ -386,12 +386,12 @@ discard block |
||
386 | 386 | <?php if ($field_type == 'checkbox') { ?> |
387 | 387 | <select name="default_value" id="default_value"> |
388 | 388 | <option value=""><?php _e('Unchecked', 'geodirectory'); ?></option> |
389 | - <option value="1" <?php selected(true, (int)$value === 1);?>><?php _e('Checked', 'geodirectory'); ?></option> |
|
389 | + <option value="1" <?php selected(true, (int) $value === 1); ?>><?php _e('Checked', 'geodirectory'); ?></option> |
|
390 | 390 | </select> |
391 | 391 | <?php } else if ($field_type == 'email') { ?> |
392 | - <input type="email" name="default_value" placeholder="<?php _e('[email protected]', 'geodirectory') ;?>" id="default_value" value="<?php echo esc_attr($value);?>" /><br/> |
|
392 | + <input type="email" name="default_value" placeholder="<?php _e('[email protected]', 'geodirectory'); ?>" id="default_value" value="<?php echo esc_attr($value); ?>" /><br/> |
|
393 | 393 | <?php } else { ?> |
394 | - <input type="text" name="default_value" id="default_value" value="<?php echo esc_attr($value);?>" /><br/> |
|
394 | + <input type="text" name="default_value" id="default_value" value="<?php echo esc_attr($value); ?>" /><br/> |
|
395 | 395 | <?php } ?> |
396 | 396 | </div> |
397 | 397 | </li> |
@@ -400,15 +400,15 @@ discard block |
||
400 | 400 | |
401 | 401 | |
402 | 402 | // show_in |
403 | - if(has_filter("geodir_cfa_show_in_{$field_type}")){ |
|
403 | + if (has_filter("geodir_cfa_show_in_{$field_type}")) { |
|
404 | 404 | |
405 | - echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info); |
|
405 | + echo apply_filters("geodir_cfa_show_in_{$field_type}", '', $result_str, $cf, $field_info); |
|
406 | 406 | |
407 | - }else{ |
|
407 | + } else { |
|
408 | 408 | $value = ''; |
409 | 409 | if (isset($field_info->show_in)) { |
410 | 410 | $value = esc_attr($field_info->show_in); |
411 | - }elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){ |
|
411 | + }elseif (isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']) { |
|
412 | 412 | $value = esc_attr($cf['defaults']['show_in']); |
413 | 413 | } |
414 | 414 | ?> |
@@ -441,18 +441,18 @@ discard block |
||
441 | 441 | * @param object $field_info The field being displayed info. |
442 | 442 | * @param string $field_info The type of field. |
443 | 443 | */ |
444 | - $show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info,$field_type); |
|
444 | + $show_in_locations = apply_filters('geodir_show_in_locations', $show_in_locations, $field_info, $field_type); |
|
445 | 445 | |
446 | 446 | |
447 | 447 | // remove some locations for some field types |
448 | 448 | |
449 | 449 | // don't show new tab option for some types |
450 | - if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) { |
|
451 | - }else{ |
|
450 | + if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file', 'address', 'taxonomy'))) { |
|
451 | + } else { |
|
452 | 452 | unset($show_in_locations['[owntab]']); |
453 | 453 | } |
454 | 454 | |
455 | - if(!$display_on_listing){ |
|
455 | + if (!$display_on_listing) { |
|
456 | 456 | unset($show_in_locations['[listings]']); |
457 | 457 | } |
458 | 458 | |
@@ -466,17 +466,17 @@ discard block |
||
466 | 466 | option-ajaxchosen="false"> |
467 | 467 | <?php |
468 | 468 | |
469 | - $show_in_values = explode(',',$value); |
|
469 | + $show_in_values = explode(',', $value); |
|
470 | 470 | |
471 | - foreach( $show_in_locations as $key => $val){ |
|
471 | + foreach ($show_in_locations as $key => $val) { |
|
472 | 472 | $selected = ''; |
473 | 473 | |
474 | - if(is_array($show_in_values) && in_array($key,$show_in_values ) ){ |
|
474 | + if (is_array($show_in_values) && in_array($key, $show_in_values)) { |
|
475 | 475 | $selected = 'selected'; |
476 | 476 | } |
477 | 477 | |
478 | 478 | ?> |
479 | - <option value="<?php echo $key;?>" <?php echo $selected;?>><?php echo $val;?></option> |
|
479 | + <option value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $val; ?></option> |
|
480 | 480 | <?php |
481 | 481 | } |
482 | 482 | ?> |
@@ -488,9 +488,9 @@ discard block |
||
488 | 488 | |
489 | 489 | |
490 | 490 | // advanced_editor |
491 | - if(has_filter("geodir_cfa_advanced_editor_{$field_type}")){ |
|
491 | + if (has_filter("geodir_cfa_advanced_editor_{$field_type}")) { |
|
492 | 492 | |
493 | - echo apply_filters("geodir_cfa_advanced_editor_{$field_type}",'',$result_str,$cf,$field_info); |
|
493 | + echo apply_filters("geodir_cfa_advanced_editor_{$field_type}", '', $result_str, $cf, $field_info); |
|
494 | 494 | |
495 | 495 | } |
496 | 496 | |
@@ -501,10 +501,10 @@ discard block |
||
501 | 501 | |
502 | 502 | |
503 | 503 | <?php // @todo this does not seem to be used for anything, it can be removed or replaced ?> |
504 | - <input type="hidden" name="clabels" id="clabels" value="<?php if (isset($field_info->clabels)) { echo esc_attr($field_info->clabels);} ?>"/> |
|
504 | + <input type="hidden" name="clabels" id="clabels" value="<?php if (isset($field_info->clabels)) { echo esc_attr($field_info->clabels); } ?>"/> |
|
505 | 505 | |
506 | 506 | <?php // we dont need to show the sort order ?> |
507 | - <input type="hidden" readonly="readonly" name="sort_order" id="sort_order" value="<?php if (isset($field_info->sort_order)) { echo esc_attr($field_info->sort_order);} ?>"/> |
|
507 | + <input type="hidden" readonly="readonly" name="sort_order" id="sort_order" value="<?php if (isset($field_info->sort_order)) { echo esc_attr($field_info->sort_order); } ?>"/> |
|
508 | 508 | |
509 | 509 | |
510 | 510 | |
@@ -557,15 +557,15 @@ discard block |
||
557 | 557 | <?php |
558 | 558 | |
559 | 559 | // is_required |
560 | - if(has_filter("geodir_cfa_is_required_{$field_type}")){ |
|
560 | + if (has_filter("geodir_cfa_is_required_{$field_type}")) { |
|
561 | 561 | |
562 | - echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info); |
|
562 | + echo apply_filters("geodir_cfa_is_required_{$field_type}", '', $result_str, $cf, $field_info); |
|
563 | 563 | |
564 | - }else{ |
|
564 | + } else { |
|
565 | 565 | $value = ''; |
566 | 566 | if (isset($field_info->is_required)) { |
567 | 567 | $value = esc_attr($field_info->is_required); |
568 | - }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){ |
|
568 | + }elseif (isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']) { |
|
569 | 569 | $value = $cf['defaults']['is_required']; |
570 | 570 | } |
571 | 571 | ?> |
@@ -578,17 +578,17 @@ discard block |
||
578 | 578 | |
579 | 579 | <div class="gd-cf-input-wrap gd-switch"> |
580 | 580 | |
581 | - <input type="radio" id="is_required_yes<?php echo $radio_id;?>" name="is_required" class="gdri-enabled" value="1" |
|
581 | + <input type="radio" id="is_required_yes<?php echo $radio_id; ?>" name="is_required" class="gdri-enabled" value="1" |
|
582 | 582 | <?php if ($value == '1') { |
583 | 583 | echo 'checked'; |
584 | 584 | } ?>/> |
585 | - <label onclick="show_hide_radio(this,'show','cf-is-required-msg');" for="is_required_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
|
585 | + <label onclick="show_hide_radio(this,'show','cf-is-required-msg');" for="is_required_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
|
586 | 586 | |
587 | - <input type="radio" id="is_required_no<?php echo $radio_id;?>" name="is_required" class="gdri-disabled" value="0" |
|
587 | + <input type="radio" id="is_required_no<?php echo $radio_id; ?>" name="is_required" class="gdri-disabled" value="0" |
|
588 | 588 | <?php if ($value == '0' || !$value) { |
589 | 589 | echo 'checked'; |
590 | 590 | } ?>/> |
591 | - <label onclick="show_hide_radio(this,'hide','cf-is-required-msg');" for="is_required_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
|
591 | + <label onclick="show_hide_radio(this,'hide','cf-is-required-msg');" for="is_required_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
|
592 | 592 | |
593 | 593 | </div> |
594 | 594 | |
@@ -598,19 +598,19 @@ discard block |
||
598 | 598 | } |
599 | 599 | |
600 | 600 | // required_msg |
601 | - if(has_filter("geodir_cfa_required_msg_{$field_type}")){ |
|
601 | + if (has_filter("geodir_cfa_required_msg_{$field_type}")) { |
|
602 | 602 | |
603 | - echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info); |
|
603 | + echo apply_filters("geodir_cfa_required_msg_{$field_type}", '', $result_str, $cf, $field_info); |
|
604 | 604 | |
605 | - }else{ |
|
605 | + } else { |
|
606 | 606 | $value = ''; |
607 | 607 | if (isset($field_info->required_msg)) { |
608 | 608 | $value = esc_attr($field_info->required_msg); |
609 | - }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){ |
|
609 | + }elseif (isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']) { |
|
610 | 610 | $value = $cf['defaults']['required_msg']; |
611 | 611 | } |
612 | 612 | ?> |
613 | - <li class="cf-is-required-msg" <?php if ((isset($field_info->is_required) && $field_info->is_required == '0') || !isset($field_info->is_required)) {echo "style='display:none;'";}?>> |
|
613 | + <li class="cf-is-required-msg" <?php if ((isset($field_info->is_required) && $field_info->is_required == '0') || !isset($field_info->is_required)) {echo "style='display:none;'"; }?>> |
|
614 | 614 | <label for="required_msg" class="gd-cf-tooltip-wrap"> |
615 | 615 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Required message:', 'geodirectory'); ?> |
616 | 616 | <div class="gdcf-tooltip"> |
@@ -627,31 +627,31 @@ discard block |
||
627 | 627 | |
628 | 628 | |
629 | 629 | // required_msg |
630 | - if(has_filter("geodir_cfa_validation_pattern_{$field_type}")){ |
|
630 | + if (has_filter("geodir_cfa_validation_pattern_{$field_type}")) { |
|
631 | 631 | |
632 | - echo apply_filters("geodir_cfa_validation_pattern_{$field_type}",'',$result_str,$cf,$field_info); |
|
632 | + echo apply_filters("geodir_cfa_validation_pattern_{$field_type}", '', $result_str, $cf, $field_info); |
|
633 | 633 | |
634 | 634 | } |
635 | 635 | |
636 | 636 | |
637 | 637 | // extra_fields |
638 | - if(has_filter("geodir_cfa_extra_fields_{$field_type}")){ |
|
638 | + if (has_filter("geodir_cfa_extra_fields_{$field_type}")) { |
|
639 | 639 | |
640 | - echo apply_filters("geodir_cfa_extra_fields_{$field_type}",'',$result_str,$cf,$field_info); |
|
640 | + echo apply_filters("geodir_cfa_extra_fields_{$field_type}", '', $result_str, $cf, $field_info); |
|
641 | 641 | |
642 | 642 | } |
643 | 643 | |
644 | 644 | |
645 | 645 | // field_icon |
646 | - if(has_filter("geodir_cfa_field_icon_{$field_type}")){ |
|
646 | + if (has_filter("geodir_cfa_field_icon_{$field_type}")) { |
|
647 | 647 | |
648 | - echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info); |
|
648 | + echo apply_filters("geodir_cfa_field_icon_{$field_type}", '', $result_str, $cf, $field_info); |
|
649 | 649 | |
650 | - }else{ |
|
650 | + } else { |
|
651 | 651 | $value = ''; |
652 | 652 | if (isset($field_info->field_icon)) { |
653 | 653 | $value = esc_attr($field_info->field_icon); |
654 | - }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){ |
|
654 | + }elseif (isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']) { |
|
655 | 655 | $value = $cf['defaults']['field_icon']; |
656 | 656 | } |
657 | 657 | ?> |
@@ -662,12 +662,12 @@ discard block |
||
662 | 662 | <label for="field_icon" class="gd-cf-tooltip-wrap"> |
663 | 663 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Upload icon :', 'geodirectory'); ?> |
664 | 664 | <div class="gdcf-tooltip"> |
665 | - <?php _e('Upload icon using media and enter its url path, or enter <a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank" >font awesome </a>class eg:"fa fa-home"', 'geodirectory');?> |
|
665 | + <?php _e('Upload icon using media and enter its url path, or enter <a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank" >font awesome </a>class eg:"fa fa-home"', 'geodirectory'); ?> |
|
666 | 666 | </div> |
667 | 667 | </label> |
668 | 668 | <div class="gd-cf-input-wrap"> |
669 | 669 | <input type="text" name="field_icon" id="field_icon" |
670 | - value="<?php echo $value;?>"/> |
|
670 | + value="<?php echo $value; ?>"/> |
|
671 | 671 | </div> |
672 | 672 | |
673 | 673 | </li> |
@@ -676,15 +676,15 @@ discard block |
||
676 | 676 | |
677 | 677 | |
678 | 678 | // css_class |
679 | - if(has_filter("geodir_cfa_css_class_{$field_type}")){ |
|
679 | + if (has_filter("geodir_cfa_css_class_{$field_type}")) { |
|
680 | 680 | |
681 | - echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info); |
|
681 | + echo apply_filters("geodir_cfa_css_class_{$field_type}", '', $result_str, $cf, $field_info); |
|
682 | 682 | |
683 | - }else{ |
|
683 | + } else { |
|
684 | 684 | $value = ''; |
685 | 685 | if (isset($field_info->css_class)) { |
686 | 686 | $value = esc_attr($field_info->css_class); |
687 | - }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){ |
|
687 | + }elseif (isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']) { |
|
688 | 688 | $value = $cf['defaults']['css_class']; |
689 | 689 | } |
690 | 690 | ?> |
@@ -693,8 +693,8 @@ discard block |
||
693 | 693 | <label for="css_class" class="gd-cf-tooltip-wrap"> |
694 | 694 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Css class :', 'geodirectory'); ?> |
695 | 695 | <div class="gdcf-tooltip"> |
696 | - <?php _e('Enter custom css class for field custom style.', 'geodirectory');?> |
|
697 | - <?php if($field_type=='multiselect'){_e('(Enter class `gd-comma-list` to show list as comma separated)', 'geodirectory');}?> |
|
696 | + <?php _e('Enter custom css class for field custom style.', 'geodirectory'); ?> |
|
697 | + <?php if ($field_type == 'multiselect') {_e('(Enter class `gd-comma-list` to show list as comma separated)', 'geodirectory'); }?> |
|
698 | 698 | </div> |
699 | 699 | </label> |
700 | 700 | <div class="gd-cf-input-wrap"> |
@@ -709,23 +709,23 @@ discard block |
||
709 | 709 | |
710 | 710 | |
711 | 711 | // cat_sort |
712 | - if(has_filter("geodir_cfa_cat_sort_{$field_type}")){ |
|
712 | + if (has_filter("geodir_cfa_cat_sort_{$field_type}")) { |
|
713 | 713 | |
714 | - echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info); |
|
714 | + echo apply_filters("geodir_cfa_cat_sort_{$field_type}", '', $result_str, $cf, $field_info); |
|
715 | 715 | |
716 | - }else{ |
|
716 | + } else { |
|
717 | 717 | $value = ''; |
718 | - $hide_cat_sort =''; |
|
718 | + $hide_cat_sort = ''; |
|
719 | 719 | if (isset($field_info->cat_sort)) { |
720 | 720 | $value = esc_attr($field_info->cat_sort); |
721 | - }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){ |
|
721 | + }elseif (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']) { |
|
722 | 722 | $value = $cf['defaults']['cat_sort']; |
723 | - $hide_cat_sort = ($value===false) ? "style='display:none;'" : ''; |
|
723 | + $hide_cat_sort = ($value === false) ? "style='display:none;'" : ''; |
|
724 | 724 | } |
725 | 725 | |
726 | - $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']===false) ? "style='display:none;'" : ''; |
|
726 | + $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort'] === false) ? "style='display:none;'" : ''; |
|
727 | 727 | ?> |
728 | - <li <?php echo $hide_cat_sort ;?>> |
|
728 | + <li <?php echo $hide_cat_sort; ?>> |
|
729 | 729 | <h3><?php |
730 | 730 | /** |
731 | 731 | * Filter the section title. |
@@ -744,23 +744,23 @@ discard block |
||
744 | 744 | <label for="cat_sort" class="gd-cf-tooltip-wrap"> |
745 | 745 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Include this field in sorting options :', 'geodirectory'); ?> |
746 | 746 | <div class="gdcf-tooltip"> |
747 | - <?php _e('Lets you use this filed as a sorting option, set from sorting options above.', 'geodirectory');?> |
|
747 | + <?php _e('Lets you use this filed as a sorting option, set from sorting options above.', 'geodirectory'); ?> |
|
748 | 748 | </div> |
749 | 749 | </label> |
750 | 750 | |
751 | 751 | <div class="gd-cf-input-wrap gd-switch"> |
752 | 752 | |
753 | - <input type="radio" id="cat_sort_yes<?php echo $radio_id;?>" name="cat_sort" class="gdri-enabled" value="1" |
|
753 | + <input type="radio" id="cat_sort_yes<?php echo $radio_id; ?>" name="cat_sort" class="gdri-enabled" value="1" |
|
754 | 754 | <?php if ($value == '1') { |
755 | 755 | echo 'checked'; |
756 | 756 | } ?>/> |
757 | - <label for="cat_sort_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
|
757 | + <label for="cat_sort_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
|
758 | 758 | |
759 | - <input type="radio" id="cat_sort_no<?php echo $radio_id;?>" name="cat_sort" class="gdri-disabled" value="0" |
|
759 | + <input type="radio" id="cat_sort_no<?php echo $radio_id; ?>" name="cat_sort" class="gdri-disabled" value="0" |
|
760 | 760 | <?php if (!$value) { |
761 | 761 | echo 'checked'; |
762 | 762 | } ?>/> |
763 | - <label for="cat_sort_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
|
763 | + <label for="cat_sort_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
|
764 | 764 | |
765 | 765 | </div> |
766 | 766 | </li> |
@@ -787,7 +787,7 @@ discard block |
||
787 | 787 | * @param object $field_info The current fields info. |
788 | 788 | * @param array $cf The custom field settings |
789 | 789 | */ |
790 | - do_action('geodir_advance_custom_fields', $field_info,$cf);?> |
|
790 | + do_action('geodir_advance_custom_fields', $field_info, $cf); ?> |
|
791 | 791 | |
792 | 792 | |
793 | 793 | <?php endswitch; ?> |
@@ -799,10 +799,10 @@ discard block |
||
799 | 799 | <h3></h3> |
800 | 800 | </label> |
801 | 801 | <div class="gd-cf-input-wrap"> |
802 | - <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save','geodirectory'));?>" |
|
802 | + <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save', 'geodirectory')); ?>" |
|
803 | 803 | onclick="save_field('<?php echo esc_attr($result_str); ?>')"/> |
804 | 804 | <?php if (!$default): ?> |
805 | - <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete','geodirectory'));?>" |
|
805 | + <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete', 'geodirectory')); ?>" |
|
806 | 806 | onclick="delete_field('<?php echo esc_attr($result_str); ?>', '<?php echo $nonce; ?>')" |
807 | 807 | class="button"/></a> |
808 | 808 | <?php endif; ?> |
@@ -19,8 +19,9 @@ discard block |
||
19 | 19 | |
20 | 20 | if (!isset($field_info->post_type)) { |
21 | 21 | $post_type = sanitize_text_field($_REQUEST['listing_type']); |
22 | -} else |
|
23 | - $post_type = $field_info->post_type; |
|
22 | +} else { |
|
23 | + $post_type = $field_info->post_type; |
|
24 | +} |
|
24 | 25 | |
25 | 26 | //if(isset($_REQUEST['custom_type']) && $_REQUEST['custom_type']=='predefined'){ |
26 | 27 | // $cf_arr = geodir_custom_fields_predefined($post_type); |
@@ -47,8 +48,9 @@ discard block |
||
47 | 48 | $nonce = wp_create_nonce('custom_fields_' . $result_str); |
48 | 49 | |
49 | 50 | $field_admin_title = ''; |
50 | -if (isset($field_info->admin_title)) |
|
51 | - $field_admin_title = $field_info->admin_title; |
|
51 | +if (isset($field_info->admin_title)) { |
|
52 | + $field_admin_title = $field_info->admin_title; |
|
53 | +} |
|
52 | 54 | |
53 | 55 | $default = isset($field_info->is_admin) ? $field_info->is_admin : ''; |
54 | 56 | |
@@ -69,15 +71,15 @@ discard block |
||
69 | 71 | |
70 | 72 | if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) { |
71 | 73 | $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>'; |
72 | -}elseif(isset($cf['icon']) && $cf['icon']){ |
|
74 | +} elseif(isset($cf['icon']) && $cf['icon']){ |
|
73 | 75 | $field_icon = '<b class="gd-cf-icon" style="background-image: url(\''.$cf['icon'].'\')"></b>'; |
74 | -}else{ |
|
76 | +} else{ |
|
75 | 77 | $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>'; |
76 | 78 | } |
77 | 79 | |
78 | 80 | if(isset($cf['name']) && $cf['name']){ |
79 | 81 | $field_type_name = $cf['name']; |
80 | -}else{ |
|
82 | +} else{ |
|
81 | 83 | $field_type_name = $field_type; |
82 | 84 | } |
83 | 85 | |
@@ -147,11 +149,11 @@ discard block |
||
147 | 149 | |
148 | 150 | echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info); |
149 | 151 | |
150 | - }else{ |
|
152 | + } else{ |
|
151 | 153 | $value = ''; |
152 | 154 | if (isset($field_info->data_type)) { |
153 | 155 | $value = esc_attr($field_info->data_type); |
154 | - }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){ |
|
156 | + } elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){ |
|
155 | 157 | $value = $cf['defaults']['data_type']; |
156 | 158 | } |
157 | 159 | ?> |
@@ -165,11 +167,11 @@ discard block |
||
165 | 167 | |
166 | 168 | echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info); |
167 | 169 | |
168 | - }else{ |
|
170 | + } else{ |
|
169 | 171 | $value = ''; |
170 | 172 | if (isset($field_info->admin_title)) { |
171 | 173 | $value = esc_attr($field_info->admin_title); |
172 | - }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){ |
|
174 | + } elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){ |
|
173 | 175 | $value = $cf['defaults']['admin_title']; |
174 | 176 | } |
175 | 177 | ?> |
@@ -194,11 +196,11 @@ discard block |
||
194 | 196 | |
195 | 197 | echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info); |
196 | 198 | |
197 | - }else{ |
|
199 | + } else{ |
|
198 | 200 | $value = ''; |
199 | 201 | if (isset($field_info->site_title)) { |
200 | 202 | $value = esc_attr($field_info->site_title); |
201 | - }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){ |
|
203 | + } elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){ |
|
202 | 204 | $value = $cf['defaults']['site_title']; |
203 | 205 | } |
204 | 206 | ?> |
@@ -222,11 +224,11 @@ discard block |
||
222 | 224 | |
223 | 225 | echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info); |
224 | 226 | |
225 | - }else{ |
|
227 | + } else{ |
|
226 | 228 | $value = ''; |
227 | 229 | if (isset($field_info->admin_desc)) { |
228 | 230 | $value = esc_attr($field_info->admin_desc); |
229 | - }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){ |
|
231 | + } elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){ |
|
230 | 232 | $value = $cf['defaults']['admin_desc']; |
231 | 233 | } |
232 | 234 | ?> |
@@ -250,11 +252,11 @@ discard block |
||
250 | 252 | |
251 | 253 | echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info); |
252 | 254 | |
253 | - }else{ |
|
255 | + } else{ |
|
254 | 256 | $value = ''; |
255 | 257 | if (isset($field_info->htmlvar_name)) { |
256 | 258 | $value = esc_attr($field_info->htmlvar_name); |
257 | - }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){ |
|
259 | + } elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){ |
|
258 | 260 | $value = $cf['defaults']['htmlvar_name']; |
259 | 261 | } |
260 | 262 | ?> |
@@ -282,11 +284,11 @@ discard block |
||
282 | 284 | |
283 | 285 | echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info); |
284 | 286 | |
285 | - }else{ |
|
287 | + } else{ |
|
286 | 288 | $value = ''; |
287 | 289 | if (isset($field_info->is_active)) { |
288 | 290 | $value = esc_attr($field_info->is_active); |
289 | - }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){ |
|
291 | + } elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){ |
|
290 | 292 | $value = $cf['defaults']['is_active']; |
291 | 293 | } |
292 | 294 | ?> |
@@ -321,11 +323,11 @@ discard block |
||
321 | 323 | |
322 | 324 | echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info); |
323 | 325 | |
324 | - }else{ |
|
326 | + } else{ |
|
325 | 327 | $value = ''; |
326 | 328 | if (isset($field_info->for_admin_use)) { |
327 | 329 | $value = esc_attr($field_info->for_admin_use); |
328 | - }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){ |
|
330 | + } elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){ |
|
329 | 331 | $value = $cf['defaults']['for_admin_use']; |
330 | 332 | } |
331 | 333 | ?> |
@@ -360,11 +362,11 @@ discard block |
||
360 | 362 | |
361 | 363 | echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info); |
362 | 364 | |
363 | - }else{ |
|
365 | + } else{ |
|
364 | 366 | $value = ''; |
365 | 367 | if (isset($field_info->default_value)) { |
366 | 368 | $value = esc_attr($field_info->default_value); |
367 | - }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){ |
|
369 | + } elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){ |
|
368 | 370 | $value = $cf['defaults']['default_value']; |
369 | 371 | } |
370 | 372 | ?> |
@@ -404,11 +406,11 @@ discard block |
||
404 | 406 | |
405 | 407 | echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info); |
406 | 408 | |
407 | - }else{ |
|
409 | + } else{ |
|
408 | 410 | $value = ''; |
409 | 411 | if (isset($field_info->show_in)) { |
410 | 412 | $value = esc_attr($field_info->show_in); |
411 | - }elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){ |
|
413 | + } elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){ |
|
412 | 414 | $value = esc_attr($cf['defaults']['show_in']); |
413 | 415 | } |
414 | 416 | ?> |
@@ -448,7 +450,7 @@ discard block |
||
448 | 450 | |
449 | 451 | // don't show new tab option for some types |
450 | 452 | if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) { |
451 | - }else{ |
|
453 | + } else{ |
|
452 | 454 | unset($show_in_locations['[owntab]']); |
453 | 455 | } |
454 | 456 | |
@@ -561,11 +563,11 @@ discard block |
||
561 | 563 | |
562 | 564 | echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info); |
563 | 565 | |
564 | - }else{ |
|
566 | + } else{ |
|
565 | 567 | $value = ''; |
566 | 568 | if (isset($field_info->is_required)) { |
567 | 569 | $value = esc_attr($field_info->is_required); |
568 | - }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){ |
|
570 | + } elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){ |
|
569 | 571 | $value = $cf['defaults']['is_required']; |
570 | 572 | } |
571 | 573 | ?> |
@@ -602,11 +604,11 @@ discard block |
||
602 | 604 | |
603 | 605 | echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info); |
604 | 606 | |
605 | - }else{ |
|
607 | + } else{ |
|
606 | 608 | $value = ''; |
607 | 609 | if (isset($field_info->required_msg)) { |
608 | 610 | $value = esc_attr($field_info->required_msg); |
609 | - }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){ |
|
611 | + } elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){ |
|
610 | 612 | $value = $cf['defaults']['required_msg']; |
611 | 613 | } |
612 | 614 | ?> |
@@ -647,11 +649,11 @@ discard block |
||
647 | 649 | |
648 | 650 | echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info); |
649 | 651 | |
650 | - }else{ |
|
652 | + } else{ |
|
651 | 653 | $value = ''; |
652 | 654 | if (isset($field_info->field_icon)) { |
653 | 655 | $value = esc_attr($field_info->field_icon); |
654 | - }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){ |
|
656 | + } elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){ |
|
655 | 657 | $value = $cf['defaults']['field_icon']; |
656 | 658 | } |
657 | 659 | ?> |
@@ -680,11 +682,11 @@ discard block |
||
680 | 682 | |
681 | 683 | echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info); |
682 | 684 | |
683 | - }else{ |
|
685 | + } else{ |
|
684 | 686 | $value = ''; |
685 | 687 | if (isset($field_info->css_class)) { |
686 | 688 | $value = esc_attr($field_info->css_class); |
687 | - }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){ |
|
689 | + } elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){ |
|
688 | 690 | $value = $cf['defaults']['css_class']; |
689 | 691 | } |
690 | 692 | ?> |
@@ -713,12 +715,12 @@ discard block |
||
713 | 715 | |
714 | 716 | echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info); |
715 | 717 | |
716 | - }else{ |
|
718 | + } else{ |
|
717 | 719 | $value = ''; |
718 | 720 | $hide_cat_sort =''; |
719 | 721 | if (isset($field_info->cat_sort)) { |
720 | 722 | $value = esc_attr($field_info->cat_sort); |
721 | - }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){ |
|
723 | + } elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){ |
|
722 | 724 | $value = $cf['defaults']['cat_sort']; |
723 | 725 | $hide_cat_sort = ($value===false) ? "style='display:none;'" : ''; |
724 | 726 | } |
@@ -18,9 +18,9 @@ discard block |
||
18 | 18 | */ |
19 | 19 | function init_listing_map_script() |
20 | 20 | { |
21 | - global $list_map_json; |
|
21 | + global $list_map_json; |
|
22 | 22 | |
23 | - $list_map_json = array(); |
|
23 | + $list_map_json = array(); |
|
24 | 24 | |
25 | 25 | } |
26 | 26 | |
@@ -35,18 +35,18 @@ discard block |
||
35 | 35 | */ |
36 | 36 | function create_list_jsondata($post) |
37 | 37 | { |
38 | - global $wpdb, $list_map_json, $add_post_in_marker_array; |
|
39 | - |
|
40 | - if ((is_main_query() || $add_post_in_marker_array) && isset($post->marker_json) && $post->marker_json != '') { |
|
41 | - /** |
|
42 | - * Filter the json data for search listing map. |
|
43 | - * |
|
44 | - * @since 1.5.7 |
|
45 | - * @param string $post->marker_json JSON representation of the post marker info. |
|
46 | - * @param object $post The post object. |
|
47 | - */ |
|
48 | - $list_map_json[] = apply_filters('geodir_create_list_jsondata',$post->marker_json,$post); |
|
49 | - } |
|
38 | + global $wpdb, $list_map_json, $add_post_in_marker_array; |
|
39 | + |
|
40 | + if ((is_main_query() || $add_post_in_marker_array) && isset($post->marker_json) && $post->marker_json != '') { |
|
41 | + /** |
|
42 | + * Filter the json data for search listing map. |
|
43 | + * |
|
44 | + * @since 1.5.7 |
|
45 | + * @param string $post->marker_json JSON representation of the post marker info. |
|
46 | + * @param object $post The post object. |
|
47 | + */ |
|
48 | + $list_map_json[] = apply_filters('geodir_create_list_jsondata',$post->marker_json,$post); |
|
49 | + } |
|
50 | 50 | |
51 | 51 | } |
52 | 52 | |
@@ -59,29 +59,29 @@ discard block |
||
59 | 59 | */ |
60 | 60 | function show_listing_widget_map() |
61 | 61 | { |
62 | - global $list_map_json; |
|
62 | + global $list_map_json; |
|
63 | 63 | |
64 | - if (!empty($list_map_json)) { |
|
65 | - $list_map_json = array_unique($list_map_json); |
|
66 | - $cat_content_info[] = implode(',', $list_map_json); |
|
67 | - } |
|
64 | + if (!empty($list_map_json)) { |
|
65 | + $list_map_json = array_unique($list_map_json); |
|
66 | + $cat_content_info[] = implode(',', $list_map_json); |
|
67 | + } |
|
68 | 68 | |
69 | - $totalcount = count(array_unique($list_map_json)); |
|
69 | + $totalcount = count(array_unique($list_map_json)); |
|
70 | 70 | |
71 | 71 | |
72 | - if (!empty($cat_content_info)) { |
|
73 | - $json_content = substr(implode(',', $cat_content_info), 1); |
|
74 | - $json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016 |
|
75 | - $json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08 |
|
76 | - $list_json = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']'; |
|
77 | - } else { |
|
78 | - $list_json = '[{"totalcount":"0"}]'; |
|
79 | - } |
|
72 | + if (!empty($cat_content_info)) { |
|
73 | + $json_content = substr(implode(',', $cat_content_info), 1); |
|
74 | + $json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016 |
|
75 | + $json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08 |
|
76 | + $list_json = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']'; |
|
77 | + } else { |
|
78 | + $list_json = '[{"totalcount":"0"}]'; |
|
79 | + } |
|
80 | 80 | |
81 | - $listing_map_args = array('list_json' => $list_json); |
|
81 | + $listing_map_args = array('list_json' => $list_json); |
|
82 | 82 | |
83 | - // Pass the json data in listing map script |
|
84 | - wp_localize_script('geodir-listing-map-widget', 'listing_map_args', $listing_map_args); |
|
83 | + // Pass the json data in listing map script |
|
84 | + wp_localize_script('geodir-listing-map-widget', 'listing_map_args', $listing_map_args); |
|
85 | 85 | |
86 | 86 | } |
87 | 87 | |
@@ -93,110 +93,110 @@ discard block |
||
93 | 93 | class geodir_map_listingpage extends WP_Widget |
94 | 94 | { |
95 | 95 | |
96 | - /** |
|
96 | + /** |
|
97 | 97 | * Register the listing page map widget. |
98 | 98 | * |
99 | 99 | * @since 1.0.0 |
100 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
100 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
101 | 101 | */ |
102 | - public function __construct() { |
|
103 | - $widget_ops = array('classname' => 'widget geodir-map-listing-page', 'description' => __('Google Map for Listing page. It will show you google map V3 for Listing page.', 'geodirectory')); |
|
104 | - parent::__construct( |
|
105 | - 'geodir_map_v3_listing_map', // Base ID |
|
106 | - __('GD > GMap - Listing page', 'geodirectory'), // Name |
|
107 | - $widget_ops// Args |
|
108 | - ); |
|
102 | + public function __construct() { |
|
103 | + $widget_ops = array('classname' => 'widget geodir-map-listing-page', 'description' => __('Google Map for Listing page. It will show you google map V3 for Listing page.', 'geodirectory')); |
|
104 | + parent::__construct( |
|
105 | + 'geodir_map_v3_listing_map', // Base ID |
|
106 | + __('GD > GMap - Listing page', 'geodirectory'), // Name |
|
107 | + $widget_ops// Args |
|
108 | + ); |
|
109 | 109 | |
110 | - add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array |
|
110 | + add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array |
|
111 | 111 | |
112 | - add_action('the_post', 'create_list_jsondata'); // Add marker in json array |
|
112 | + add_action('the_post', 'create_list_jsondata'); // Add marker in json array |
|
113 | 113 | |
114 | - add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers |
|
115 | - } |
|
114 | + add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers |
|
115 | + } |
|
116 | 116 | |
117 | 117 | /** |
118 | 118 | * Front-end display content for listing page map widget. |
119 | 119 | * |
120 | 120 | * @since 1.0.0 |
121 | - * @since 1.5.1 Declare function public. |
|
121 | + * @since 1.5.1 Declare function public. |
|
122 | + * |
|
123 | + * @global object $post The current post object. |
|
122 | 124 | * |
123 | - * @global object $post The current post object. |
|
124 | - * |
|
125 | 125 | * @param array $args Widget arguments. |
126 | 126 | * @param array $instance Saved values from database. |
127 | 127 | */ |
128 | - public function widget($args, $instance) |
|
129 | - { |
|
130 | - |
|
131 | - if (geodir_is_page('listing') || geodir_is_page('author') || geodir_is_page('search') |
|
132 | - || geodir_is_page('detail') |
|
133 | - ) : |
|
134 | - |
|
135 | - extract($args, EXTR_SKIP); |
|
136 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
137 | - $width = empty($instance['width']) ? '294' : apply_filters('widget_width', $instance['width']); |
|
138 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
139 | - $height = empty($instance['heigh']) ? '370' : apply_filters('widget_heigh', $instance['heigh']); |
|
140 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
141 | - $maptype = empty($instance['maptype']) ? 'ROADMAP' : apply_filters('widget_maptype', $instance['maptype']); |
|
142 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
143 | - $zoom = empty($instance['zoom']) ? '13' : apply_filters('widget_zoom', $instance['zoom']); |
|
144 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
145 | - $autozoom = empty($instance['autozoom']) ? '' : apply_filters('widget_autozoom', $instance['autozoom']); |
|
146 | - /** |
|
147 | - * Filter the listing map value widget_sticky, to set if the map should be sticky or not (scroll with page). |
|
148 | - * |
|
149 | - * @since 1.0.0 |
|
150 | - * @param bool $sticky True if should be sticky, false if not |
|
151 | - */ |
|
152 | - $sticky = empty($instance['sticky']) ? '' : apply_filters('widget_sticky', $instance['sticky']); |
|
153 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
154 | - $scrollwheel = empty($instance['scrollwheel']) ? '0' : apply_filters('widget_scrollwheel', $instance['scrollwheel']); |
|
155 | - $showall = empty($instance['showall']) ? '0' : apply_filters('widget_showall', $instance['showall']); |
|
128 | + public function widget($args, $instance) |
|
129 | + { |
|
130 | + |
|
131 | + if (geodir_is_page('listing') || geodir_is_page('author') || geodir_is_page('search') |
|
132 | + || geodir_is_page('detail') |
|
133 | + ) : |
|
134 | + |
|
135 | + extract($args, EXTR_SKIP); |
|
136 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
137 | + $width = empty($instance['width']) ? '294' : apply_filters('widget_width', $instance['width']); |
|
138 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
139 | + $height = empty($instance['heigh']) ? '370' : apply_filters('widget_heigh', $instance['heigh']); |
|
140 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
141 | + $maptype = empty($instance['maptype']) ? 'ROADMAP' : apply_filters('widget_maptype', $instance['maptype']); |
|
142 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
143 | + $zoom = empty($instance['zoom']) ? '13' : apply_filters('widget_zoom', $instance['zoom']); |
|
144 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
145 | + $autozoom = empty($instance['autozoom']) ? '' : apply_filters('widget_autozoom', $instance['autozoom']); |
|
146 | + /** |
|
147 | + * Filter the listing map value widget_sticky, to set if the map should be sticky or not (scroll with page). |
|
148 | + * |
|
149 | + * @since 1.0.0 |
|
150 | + * @param bool $sticky True if should be sticky, false if not |
|
151 | + */ |
|
152 | + $sticky = empty($instance['sticky']) ? '' : apply_filters('widget_sticky', $instance['sticky']); |
|
153 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
154 | + $scrollwheel = empty($instance['scrollwheel']) ? '0' : apply_filters('widget_scrollwheel', $instance['scrollwheel']); |
|
155 | + $showall = empty($instance['showall']) ? '0' : apply_filters('widget_showall', $instance['showall']); |
|
156 | 156 | |
157 | 157 | /** |
158 | - * Filter the listing map should to be displayed or not. |
|
159 | - * |
|
160 | - * @since 1.4.6 |
|
158 | + * Filter the listing map should to be displayed or not. |
|
161 | 159 | * |
162 | - * @param bool $display true if map should be displayed, false if not. |
|
163 | - */ |
|
160 | + * @since 1.4.6 |
|
161 | + * |
|
162 | + * @param bool $display true if map should be displayed, false if not. |
|
163 | + */ |
|
164 | 164 | $show_map = apply_filters( 'geodir_show_map_listing', $display = true ); |
165 | 165 | if ( !$show_map ) { |
166 | 166 | return; |
167 | 167 | } |
168 | 168 | |
169 | - $map_args = array(); |
|
170 | - $map_args['map_canvas_name'] = str_replace('-', '_', $args['widget_id']); |
|
171 | - $map_args['width'] = $width; |
|
172 | - $map_args['height'] = $height; |
|
173 | - |
|
174 | - $map_args['scrollwheel'] = $scrollwheel; |
|
175 | - $map_args['showall'] = $showall; |
|
176 | - $map_args['child_collapse'] = '0'; |
|
177 | - $map_args['sticky'] = $sticky; |
|
178 | - $map_args['enable_cat_filters'] = false; |
|
179 | - $map_args['enable_text_search'] = false; |
|
180 | - $map_args['enable_post_type_filters'] = false; |
|
181 | - $map_args['enable_location_filters'] = false; |
|
182 | - $map_args['enable_jason_on_load'] = true; |
|
169 | + $map_args = array(); |
|
170 | + $map_args['map_canvas_name'] = str_replace('-', '_', $args['widget_id']); |
|
171 | + $map_args['width'] = $width; |
|
172 | + $map_args['height'] = $height; |
|
173 | + |
|
174 | + $map_args['scrollwheel'] = $scrollwheel; |
|
175 | + $map_args['showall'] = $showall; |
|
176 | + $map_args['child_collapse'] = '0'; |
|
177 | + $map_args['sticky'] = $sticky; |
|
178 | + $map_args['enable_cat_filters'] = false; |
|
179 | + $map_args['enable_text_search'] = false; |
|
180 | + $map_args['enable_post_type_filters'] = false; |
|
181 | + $map_args['enable_location_filters'] = false; |
|
182 | + $map_args['enable_jason_on_load'] = true; |
|
183 | 183 | |
184 | - if (is_single()) { |
|
184 | + if (is_single()) { |
|
185 | 185 | |
186 | - global $post; |
|
187 | - $map_default_lat = $address_latitude = $post->post_latitude; |
|
188 | - $map_default_lng = $address_longitude = $post->post_longitude; |
|
189 | - $mapview = $post->post_mapview; |
|
190 | - $mapzoom = $post->post_mapzoom; |
|
191 | - $map_args['map_class_name'] = 'geodir-map-listing-page-single'; |
|
186 | + global $post; |
|
187 | + $map_default_lat = $address_latitude = $post->post_latitude; |
|
188 | + $map_default_lng = $address_longitude = $post->post_longitude; |
|
189 | + $mapview = $post->post_mapview; |
|
190 | + $mapzoom = $post->post_mapzoom; |
|
191 | + $map_args['map_class_name'] = 'geodir-map-listing-page-single'; |
|
192 | 192 | |
193 | - } else { |
|
194 | - $default_location = geodir_get_default_location(); |
|
193 | + } else { |
|
194 | + $default_location = geodir_get_default_location(); |
|
195 | 195 | |
196 | - $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
197 | - $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
198 | - $map_args['map_class_name'] = 'geodir-map-listing-page'; |
|
199 | - $mapview = $maptype; |
|
196 | + $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
197 | + $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
198 | + $map_args['map_class_name'] = 'geodir-map-listing-page'; |
|
199 | + $mapview = $maptype; |
|
200 | 200 | |
201 | 201 | if ( geodir_is_page( 'search' ) ) { |
202 | 202 | $map_default_lat = ''; |
@@ -213,83 +213,83 @@ discard block |
||
213 | 213 | } |
214 | 214 | } |
215 | 215 | } |
216 | - } |
|
217 | - |
|
218 | - if (empty($mapzoom)) $mapzoom = $zoom; |
|
219 | - |
|
220 | - // Set default map options |
|
221 | - $map_args['ajax_url'] = geodir_get_ajax_url(); |
|
222 | - $map_args['latitude'] = $map_default_lat; |
|
223 | - $map_args['longitude'] = $map_default_lng; |
|
224 | - $map_args['zoom'] = $zoom; |
|
225 | - //$map_args['scrollwheel'] = true; |
|
226 | - $map_args['scrollwheel'] = $scrollwheel; |
|
227 | - $map_args['showall'] = $showall; |
|
228 | - $map_args['streetViewControl'] = true; |
|
229 | - $map_args['maptype'] = $maptype; |
|
230 | - $map_args['showPreview'] = '0'; |
|
231 | - $map_args['maxZoom'] = 21; |
|
232 | - $map_args['autozoom'] = $autozoom; |
|
233 | - $map_args['bubble_size'] = 'small'; |
|
216 | + } |
|
217 | + |
|
218 | + if (empty($mapzoom)) $mapzoom = $zoom; |
|
219 | + |
|
220 | + // Set default map options |
|
221 | + $map_args['ajax_url'] = geodir_get_ajax_url(); |
|
222 | + $map_args['latitude'] = $map_default_lat; |
|
223 | + $map_args['longitude'] = $map_default_lng; |
|
224 | + $map_args['zoom'] = $zoom; |
|
225 | + //$map_args['scrollwheel'] = true; |
|
226 | + $map_args['scrollwheel'] = $scrollwheel; |
|
227 | + $map_args['showall'] = $showall; |
|
228 | + $map_args['streetViewControl'] = true; |
|
229 | + $map_args['maptype'] = $maptype; |
|
230 | + $map_args['showPreview'] = '0'; |
|
231 | + $map_args['maxZoom'] = 21; |
|
232 | + $map_args['autozoom'] = $autozoom; |
|
233 | + $map_args['bubble_size'] = 'small'; |
|
234 | 234 | |
235 | - $map_args['enable_marker_cluster'] = defined('GDCLUSTER_VERSION') && !empty($instance['marker_cluster']) ? true : false; |
|
235 | + $map_args['enable_marker_cluster'] = defined('GDCLUSTER_VERSION') && !empty($instance['marker_cluster']) ? true : false; |
|
236 | 236 | |
237 | - echo $before_widget; |
|
238 | - geodir_draw_map($map_args); |
|
239 | - echo $after_widget; |
|
237 | + echo $before_widget; |
|
238 | + geodir_draw_map($map_args); |
|
239 | + echo $after_widget; |
|
240 | 240 | |
241 | - endif; |
|
242 | - } |
|
241 | + endif; |
|
242 | + } |
|
243 | 243 | |
244 | 244 | /** |
245 | 245 | * Sanitize listing page map widget form values as they are saved. |
246 | 246 | * |
247 | 247 | * @since 1.0.0 |
248 | - * @since 1.5.1 Declare function public. |
|
248 | + * @since 1.5.1 Declare function public. |
|
249 | 249 | * |
250 | 250 | * @param array $new_instance Values just sent to be saved. |
251 | 251 | * @param array $old_instance Previously saved values from database. |
252 | 252 | * |
253 | 253 | * @return array Updated safe values to be saved. |
254 | 254 | */ |
255 | - public function update($new_instance, $old_instance) { |
|
256 | - //save the widget |
|
257 | - $instance = $old_instance; |
|
258 | - $instance['width'] = strip_tags($new_instance['width']); |
|
259 | - $instance['heigh'] = ($new_instance['heigh']); |
|
260 | - $instance['maptype'] = ($new_instance['maptype']); |
|
261 | - $instance['zoom'] = ($new_instance['zoom']); |
|
262 | - $instance['autozoom'] = isset($new_instance['autozoom']) ? $new_instance['autozoom'] : ''; |
|
263 | - $instance['sticky'] = isset($new_instance['sticky']) ? $new_instance['sticky'] : ''; |
|
264 | - $instance['scrollwheel'] = isset($new_instance['scrollwheel']) ? ($new_instance['scrollwheel']) : ''; |
|
265 | - $instance['showall'] = isset($new_instance['showall']) ? ($new_instance['showall']) : ''; |
|
266 | - $instance['marker_cluster'] = defined('GDCLUSTER_VERSION') && !empty($new_instance['marker_cluster']) ? 1 : ''; |
|
267 | - |
|
268 | - return $instance; |
|
269 | - } |
|
255 | + public function update($new_instance, $old_instance) { |
|
256 | + //save the widget |
|
257 | + $instance = $old_instance; |
|
258 | + $instance['width'] = strip_tags($new_instance['width']); |
|
259 | + $instance['heigh'] = ($new_instance['heigh']); |
|
260 | + $instance['maptype'] = ($new_instance['maptype']); |
|
261 | + $instance['zoom'] = ($new_instance['zoom']); |
|
262 | + $instance['autozoom'] = isset($new_instance['autozoom']) ? $new_instance['autozoom'] : ''; |
|
263 | + $instance['sticky'] = isset($new_instance['sticky']) ? $new_instance['sticky'] : ''; |
|
264 | + $instance['scrollwheel'] = isset($new_instance['scrollwheel']) ? ($new_instance['scrollwheel']) : ''; |
|
265 | + $instance['showall'] = isset($new_instance['showall']) ? ($new_instance['showall']) : ''; |
|
266 | + $instance['marker_cluster'] = defined('GDCLUSTER_VERSION') && !empty($new_instance['marker_cluster']) ? 1 : ''; |
|
267 | + |
|
268 | + return $instance; |
|
269 | + } |
|
270 | 270 | |
271 | 271 | /** |
272 | 272 | * Back-end listing page map widget settings form. |
273 | 273 | * |
274 | 274 | * @since 1.0.0 |
275 | - * @since 1.5.1 Declare function public. |
|
275 | + * @since 1.5.1 Declare function public. |
|
276 | 276 | * |
277 | 277 | * @param array $instance Previously saved values from database. |
278 | 278 | */ |
279 | - public function form($instance) { |
|
280 | - // widget form in backend |
|
281 | - $instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0', 'marker_cluster' => '0')); |
|
279 | + public function form($instance) { |
|
280 | + // widget form in backend |
|
281 | + $instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0', 'marker_cluster' => '0')); |
|
282 | 282 | |
283 | - $width = strip_tags($instance['width']); |
|
284 | - $heigh = strip_tags($instance['heigh']); |
|
285 | - $maptype = strip_tags($instance['maptype']); |
|
286 | - $zoom = strip_tags($instance['zoom']); |
|
287 | - $autozoom = strip_tags($instance['autozoom']); |
|
288 | - $sticky = strip_tags($instance['sticky']); |
|
289 | - $scrollwheel = strip_tags($instance['scrollwheel']); |
|
290 | - $showall = strip_tags($instance['showall']); |
|
291 | - $marker_cluster = (int)$instance['marker_cluster']; |
|
292 | - ?> |
|
283 | + $width = strip_tags($instance['width']); |
|
284 | + $heigh = strip_tags($instance['heigh']); |
|
285 | + $maptype = strip_tags($instance['maptype']); |
|
286 | + $zoom = strip_tags($instance['zoom']); |
|
287 | + $autozoom = strip_tags($instance['autozoom']); |
|
288 | + $sticky = strip_tags($instance['sticky']); |
|
289 | + $scrollwheel = strip_tags($instance['scrollwheel']); |
|
290 | + $showall = strip_tags($instance['showall']); |
|
291 | + $marker_cluster = (int)$instance['marker_cluster']; |
|
292 | + ?> |
|
293 | 293 | <p> |
294 | 294 | <label |
295 | 295 | for="<?php echo $this->get_field_id('width'); ?>"><?php _e('Map Width <small>(Default is : 294) you can use px or % here</small>', 'geodirectory'); ?> |
@@ -318,14 +318,14 @@ discard block |
||
318 | 318 | name="<?php echo $this->get_field_name('maptype'); ?>"> |
319 | 319 | |
320 | 320 | <option <?php if (isset($maptype) && $maptype == 'ROADMAP') { |
321 | - echo 'selected="selected"'; |
|
322 | - } ?> value="ROADMAP"><?php _e('Road Map', 'geodirectory'); ?></option> |
|
321 | + echo 'selected="selected"'; |
|
322 | + } ?> value="ROADMAP"><?php _e('Road Map', 'geodirectory'); ?></option> |
|
323 | 323 | <option <?php if (isset($maptype) && $maptype == 'SATELLITE') { |
324 | - echo 'selected="selected"'; |
|
325 | - } ?> value="SATELLITE"><?php _e('Satellite Map', 'geodirectory'); ?></option> |
|
324 | + echo 'selected="selected"'; |
|
325 | + } ?> value="SATELLITE"><?php _e('Satellite Map', 'geodirectory'); ?></option> |
|
326 | 326 | <option <?php if (isset($maptype) && $maptype == 'HYBRID') { |
327 | - echo 'selected="selected"'; |
|
328 | - } ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option> |
|
327 | + echo 'selected="selected"'; |
|
328 | + } ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option> |
|
329 | 329 | <option <?php selected($maptype, 'TERRAIN');?> |
330 | 330 | value="TERRAIN"><?php _e('Terrain Map', 'geodirectory'); ?></option> |
331 | 331 | </select> |
@@ -333,8 +333,8 @@ discard block |
||
333 | 333 | </p> |
334 | 334 | |
335 | 335 | <?php |
336 | - $map_zoom_level = geodir_map_zoom_level(); |
|
337 | - ?> |
|
336 | + $map_zoom_level = geodir_map_zoom_level(); |
|
337 | + ?> |
|
338 | 338 | |
339 | 339 | <p> |
340 | 340 | <label |
@@ -344,14 +344,14 @@ discard block |
||
344 | 344 | <select class="widefat" id="<?php echo $this->get_field_id('zoom'); ?>" |
345 | 345 | name="<?php echo $this->get_field_name('zoom'); ?>"> <?php |
346 | 346 | |
347 | - foreach ($map_zoom_level as $level) { |
|
348 | - $selected = ''; |
|
349 | - if ($level == $zoom) |
|
350 | - $selected = 'selected="selected"'; |
|
347 | + foreach ($map_zoom_level as $level) { |
|
348 | + $selected = ''; |
|
349 | + if ($level == $zoom) |
|
350 | + $selected = 'selected="selected"'; |
|
351 | 351 | |
352 | - echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>'; |
|
352 | + echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>'; |
|
353 | 353 | |
354 | - } ?> |
|
354 | + } ?> |
|
355 | 355 | |
356 | 356 | </select> |
357 | 357 | |
@@ -363,8 +363,8 @@ discard block |
||
363 | 363 | for="<?php echo $this->get_field_id('autozoom'); ?>"> |
364 | 364 | <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('autozoom'); ?>" |
365 | 365 | name="<?php echo $this->get_field_name('autozoom'); ?>"<?php if ($autozoom) { |
366 | - echo 'checked="checked"'; |
|
367 | - } ?> /> <?php _e('Map Auto Zoom ?', 'geodirectory'); ?></label> |
|
366 | + echo 'checked="checked"'; |
|
367 | + } ?> /> <?php _e('Map Auto Zoom ?', 'geodirectory'); ?></label> |
|
368 | 368 | </p> |
369 | 369 | |
370 | 370 | <p> |
@@ -372,8 +372,8 @@ discard block |
||
372 | 372 | for="<?php echo $this->get_field_id('sticky'); ?>"> |
373 | 373 | <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('sticky'); ?>" |
374 | 374 | name="<?php echo $this->get_field_name('sticky'); ?>"<?php if ($sticky) { |
375 | - echo 'checked="checked"'; |
|
376 | - } ?> /> <?php _e('Map Sticky(should stick to the right of screen) ?', 'geodirectory'); ?> |
|
375 | + echo 'checked="checked"'; |
|
376 | + } ?> /> <?php _e('Map Sticky(should stick to the right of screen) ?', 'geodirectory'); ?> |
|
377 | 377 | </label> |
378 | 378 | </p> |
379 | 379 | |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | </p> --> |
400 | 400 | |
401 | 401 | <?php |
402 | - } |
|
402 | + } |
|
403 | 403 | } // class geodir_map_listingpage |
404 | 404 | |
405 | 405 | register_widget('geodir_map_listingpage'); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @param string $post->marker_json JSON representation of the post marker info. |
46 | 46 | * @param object $post The post object. |
47 | 47 | */ |
48 | - $list_map_json[] = apply_filters('geodir_create_list_jsondata',$post->marker_json,$post); |
|
48 | + $list_map_json[] = apply_filters('geodir_create_list_jsondata', $post->marker_json, $post); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $json_content = substr(implode(',', $cat_content_info), 1); |
74 | 74 | $json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016 |
75 | 75 | $json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08 |
76 | - $list_json = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']'; |
|
76 | + $list_json = '[{"totalcount":"'.$totalcount.'",'.$json_content.']'; |
|
77 | 77 | } else { |
78 | 78 | $list_json = '[{"totalcount":"0"}]'; |
79 | 79 | } |
@@ -161,8 +161,8 @@ discard block |
||
161 | 161 | * |
162 | 162 | * @param bool $display true if map should be displayed, false if not. |
163 | 163 | */ |
164 | - $show_map = apply_filters( 'geodir_show_map_listing', $display = true ); |
|
165 | - if ( !$show_map ) { |
|
164 | + $show_map = apply_filters('geodir_show_map_listing', $display = true); |
|
165 | + if (!$show_map) { |
|
166 | 166 | return; |
167 | 167 | } |
168 | 168 | |
@@ -198,16 +198,16 @@ discard block |
||
198 | 198 | $map_args['map_class_name'] = 'geodir-map-listing-page'; |
199 | 199 | $mapview = $maptype; |
200 | 200 | |
201 | - if ( geodir_is_page( 'search' ) ) { |
|
201 | + if (geodir_is_page('search')) { |
|
202 | 202 | $map_default_lat = ''; |
203 | 203 | $map_default_lng = ''; |
204 | - if ( isset( $_REQUEST['sgeo_lat'] ) && isset( $_REQUEST['sgeo_lon'] ) ) { |
|
205 | - $map_default_lat = (float)sanitize_text_field( $_REQUEST['sgeo_lat'] ); |
|
206 | - $map_default_lng = (float)sanitize_text_field( $_REQUEST['sgeo_lon'] ); |
|
204 | + if (isset($_REQUEST['sgeo_lat']) && isset($_REQUEST['sgeo_lon'])) { |
|
205 | + $map_default_lat = (float) sanitize_text_field($_REQUEST['sgeo_lat']); |
|
206 | + $map_default_lng = (float) sanitize_text_field($_REQUEST['sgeo_lon']); |
|
207 | 207 | } |
208 | - if ( empty( $map_default_lat ) && empty( $map_default_lng ) && ! empty( $_REQUEST['set_location_type'] ) && ! empty( $_REQUEST['set_location_val'] ) && function_exists( 'geodir_get_location_by_id' ) ) { |
|
209 | - $location = geodir_get_location_by_id( '', (int)$_REQUEST['set_location_val'] ); |
|
210 | - if ( ! empty( $location ) ) { |
|
208 | + if (empty($map_default_lat) && empty($map_default_lng) && !empty($_REQUEST['set_location_type']) && !empty($_REQUEST['set_location_val']) && function_exists('geodir_get_location_by_id')) { |
|
209 | + $location = geodir_get_location_by_id('', (int) $_REQUEST['set_location_val']); |
|
210 | + if (!empty($location)) { |
|
211 | 211 | $map_default_lat = $location->city_latitude; |
212 | 212 | $map_default_lng = $location->city_longitude; |
213 | 213 | } |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | */ |
279 | 279 | public function form($instance) { |
280 | 280 | // widget form in backend |
281 | - $instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0', 'marker_cluster' => '0')); |
|
281 | + $instance = wp_parse_args((array) $instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0', 'marker_cluster' => '0')); |
|
282 | 282 | |
283 | 283 | $width = strip_tags($instance['width']); |
284 | 284 | $heigh = strip_tags($instance['heigh']); |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | $sticky = strip_tags($instance['sticky']); |
289 | 289 | $scrollwheel = strip_tags($instance['scrollwheel']); |
290 | 290 | $showall = strip_tags($instance['showall']); |
291 | - $marker_cluster = (int)$instance['marker_cluster']; |
|
291 | + $marker_cluster = (int) $instance['marker_cluster']; |
|
292 | 292 | ?> |
293 | 293 | <p> |
294 | 294 | <label |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | <option <?php if (isset($maptype) && $maptype == 'HYBRID') { |
327 | 327 | echo 'selected="selected"'; |
328 | 328 | } ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option> |
329 | - <option <?php selected($maptype, 'TERRAIN');?> |
|
329 | + <option <?php selected($maptype, 'TERRAIN'); ?> |
|
330 | 330 | value="TERRAIN"><?php _e('Terrain Map', 'geodirectory'); ?></option> |
331 | 331 | </select> |
332 | 332 | </label> |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | if ($level == $zoom) |
350 | 350 | $selected = 'selected="selected"'; |
351 | 351 | |
352 | - echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>'; |
|
352 | + echo '<option '.$selected.' value="'.$level.'">'.$level.'</option>'; |
|
353 | 353 | |
354 | 354 | } ?> |
355 | 355 | |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | for="<?php echo $this->get_field_id('scrollwheel'); ?>"> |
383 | 383 | <input id="<?php echo $this->get_field_id('scrollwheel'); ?>" |
384 | 384 | name="<?php echo $this->get_field_name('scrollwheel'); ?>" type="checkbox" value="1" |
385 | - <?php if ($scrollwheel){ ?>checked="checked" <?php } ?> /> <?php _e('Enable mouse scroll zoom ?', 'geodirectory'); ?> |
|
385 | + <?php if ($scrollwheel) { ?>checked="checked" <?php } ?> /> <?php _e('Enable mouse scroll zoom ?', 'geodirectory'); ?> |
|
386 | 386 | </label> |
387 | 387 | </p> |
388 | 388 | <?php if (defined('GDCLUSTER_VERSION')) { ?> |
@@ -215,7 +215,9 @@ discard block |
||
215 | 215 | } |
216 | 216 | } |
217 | 217 | |
218 | - if (empty($mapzoom)) $mapzoom = $zoom; |
|
218 | + if (empty($mapzoom)) { |
|
219 | + $mapzoom = $zoom; |
|
220 | + } |
|
219 | 221 | |
220 | 222 | // Set default map options |
221 | 223 | $map_args['ajax_url'] = geodir_get_ajax_url(); |
@@ -346,8 +348,9 @@ discard block |
||
346 | 348 | |
347 | 349 | foreach ($map_zoom_level as $level) { |
348 | 350 | $selected = ''; |
349 | - if ($level == $zoom) |
|
350 | - $selected = 'selected="selected"'; |
|
351 | + if ($level == $zoom) { |
|
352 | + $selected = 'selected="selected"'; |
|
353 | + } |
|
351 | 354 | |
352 | 355 | echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>'; |
353 | 356 |
@@ -316,6 +316,10 @@ |
||
316 | 316 | return $personal_data; |
317 | 317 | } |
318 | 318 | |
319 | + /** |
|
320 | + * @param string $email_address |
|
321 | + * @param integer $page |
|
322 | + */ |
|
319 | 323 | public static function posts_by_author( $email_address, $post_type, $page ) { |
320 | 324 | if ( empty( $email_address ) || empty( $post_type ) || empty( $page ) ) { |
321 | 325 | return array(); |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @package GeoDirectory |
7 | 7 | */ |
8 | 8 | |
9 | -defined( 'ABSPATH' ) || exit; |
|
9 | +defined('ABSPATH') || exit; |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * GeoDir_Privacy_Exporters Class. |
@@ -23,32 +23,32 @@ discard block |
||
23 | 23 | * @param int $page Page. |
24 | 24 | * @return array An array of personal data in name value pairs |
25 | 25 | */ |
26 | - public static function post_data_exporter( $email_address, $page ) { |
|
27 | - $post_type = GeoDir_Privacy::exporter_post_type(); |
|
26 | + public static function post_data_exporter($email_address, $page) { |
|
27 | + $post_type = GeoDir_Privacy::exporter_post_type(); |
|
28 | 28 | |
29 | 29 | $done = false; |
30 | 30 | $page = (int) $page; |
31 | 31 | $data_to_export = array(); |
32 | 32 | |
33 | - $posts = self::posts_by_author( $email_address, $post_type, $page ); |
|
33 | + $posts = self::posts_by_author($email_address, $post_type, $page); |
|
34 | 34 | |
35 | - if ( 0 < count( $posts ) ) { |
|
36 | - $obj_post_type = get_post_type_object( $post_type ); |
|
35 | + if (0 < count($posts)) { |
|
36 | + $obj_post_type = get_post_type_object($post_type); |
|
37 | 37 | |
38 | - foreach ( $posts as $post_ID ) { |
|
39 | - $gd_post = geodir_get_post_info( $post_ID ); |
|
40 | - if ( empty( $gd_post ) ) { |
|
38 | + foreach ($posts as $post_ID) { |
|
39 | + $gd_post = geodir_get_post_info($post_ID); |
|
40 | + if (empty($gd_post)) { |
|
41 | 41 | continue; |
42 | 42 | } |
43 | 43 | |
44 | 44 | $data_to_export[] = array( |
45 | - 'group_id' => 'geodirectory-post-' . $post_type, |
|
46 | - 'group_label' => __( $obj_post_type->labels->name, 'geodirectory' ), |
|
47 | - 'item_id' => 'post-' . $post_ID, |
|
48 | - 'data' => self::get_post_personal_data( $gd_post ), |
|
45 | + 'group_id' => 'geodirectory-post-'.$post_type, |
|
46 | + 'group_label' => __($obj_post_type->labels->name, 'geodirectory'), |
|
47 | + 'item_id' => 'post-'.$post_ID, |
|
48 | + 'data' => self::get_post_personal_data($gd_post), |
|
49 | 49 | ); |
50 | 50 | } |
51 | - $done = 10 > count( $posts ); |
|
51 | + $done = 10 > count($posts); |
|
52 | 52 | } else { |
53 | 53 | $done = true; |
54 | 54 | } |
@@ -66,24 +66,24 @@ discard block |
||
66 | 66 | * @param WP_Post $gd_post The post object. |
67 | 67 | * @return array |
68 | 68 | */ |
69 | - protected static function get_post_personal_data( $gd_post ) { |
|
69 | + protected static function get_post_personal_data($gd_post) { |
|
70 | 70 | $post_categories = array(); |
71 | 71 | $post_tags = array(); |
72 | 72 | $default_category = ''; |
73 | 73 | |
74 | - $cat_taxonomy = $gd_post->post_type . 'category'; |
|
75 | - $tag_taxonomy = $gd_post->post_type . '_tags'; |
|
74 | + $cat_taxonomy = $gd_post->post_type.'category'; |
|
75 | + $tag_taxonomy = $gd_post->post_type.'_tags'; |
|
76 | 76 | |
77 | - $post_terms = wp_get_post_terms( $gd_post->ID, array( $cat_taxonomy, $tag_taxonomy ) ); |
|
78 | - if ( ! empty( $post_terms ) && ! is_wp_error( $post_terms ) ) { |
|
79 | - foreach ( $post_terms as $term ) { |
|
80 | - if ( $term->taxonomy == $cat_taxonomy ) { |
|
77 | + $post_terms = wp_get_post_terms($gd_post->ID, array($cat_taxonomy, $tag_taxonomy)); |
|
78 | + if (!empty($post_terms) && !is_wp_error($post_terms)) { |
|
79 | + foreach ($post_terms as $term) { |
|
80 | + if ($term->taxonomy == $cat_taxonomy) { |
|
81 | 81 | $post_categories[] = $term->name; |
82 | 82 | } else { |
83 | 83 | $post_tags[] = $term->name; |
84 | 84 | } |
85 | 85 | |
86 | - if ( $gd_post->default_category == $term->term_id ) { |
|
86 | + if ($gd_post->default_category == $term->term_id) { |
|
87 | 87 | $default_category = $term->name; |
88 | 88 | } |
89 | 89 | } |
@@ -91,189 +91,189 @@ discard block |
||
91 | 91 | |
92 | 92 | $personal_data = array(); |
93 | 93 | $personal_data[] = array( |
94 | - 'name' => __( 'Post ID', 'geodirectory' ), |
|
94 | + 'name' => __('Post ID', 'geodirectory'), |
|
95 | 95 | 'value' => $gd_post->ID, |
96 | 96 | ); |
97 | 97 | $personal_data[] = array( |
98 | - 'name' => __( 'Post Title', 'geodirectory' ), |
|
98 | + 'name' => __('Post Title', 'geodirectory'), |
|
99 | 99 | 'value' => $gd_post->post_title, |
100 | 100 | ); |
101 | 101 | $personal_data[] = array( |
102 | - 'name' => __( 'Post Description', 'geodirectory' ), |
|
102 | + 'name' => __('Post Description', 'geodirectory'), |
|
103 | 103 | 'value' => $gd_post->post_content, |
104 | 104 | ); |
105 | 105 | $personal_data[] = array( |
106 | - 'name' => __( 'Post Date', 'geodirectory' ), |
|
106 | + 'name' => __('Post Date', 'geodirectory'), |
|
107 | 107 | 'value' => $gd_post->post_date, |
108 | 108 | ); |
109 | - if ( ! empty( $gd_post->post_modified ) && $gd_post->post_modified != '0000-00-00 00:00:00' ) { |
|
109 | + if (!empty($gd_post->post_modified) && $gd_post->post_modified != '0000-00-00 00:00:00') { |
|
110 | 110 | $personal_data[] = array( |
111 | - 'name' => __( 'Post Modified Date', 'geodirectory' ), |
|
111 | + 'name' => __('Post Modified Date', 'geodirectory'), |
|
112 | 112 | 'value' => $gd_post->post_modified, |
113 | 113 | ); |
114 | 114 | } |
115 | 115 | $personal_data[] = array( |
116 | - 'name' => __( 'Post Status', 'geodirectory' ), |
|
116 | + 'name' => __('Post Status', 'geodirectory'), |
|
117 | 117 | 'value' => $gd_post->post_status, |
118 | 118 | ); |
119 | - if ( ! empty( $gd_post->submit_ip ) ) { |
|
119 | + if (!empty($gd_post->submit_ip)) { |
|
120 | 120 | $personal_data[] = array( |
121 | - 'name' => __( 'Submit IP', 'geodirectory' ), |
|
121 | + 'name' => __('Submit IP', 'geodirectory'), |
|
122 | 122 | 'value' => $gd_post->submit_ip, |
123 | 123 | ); |
124 | 124 | } |
125 | 125 | $personal_data[] = array( |
126 | - 'name' => __( 'Post Categories', 'geodirectory' ), |
|
127 | - 'value' => ( ! empty( $post_categories ) ? implode( ', ', $post_categories ) : '' ), |
|
126 | + 'name' => __('Post Categories', 'geodirectory'), |
|
127 | + 'value' => (!empty($post_categories) ? implode(', ', $post_categories) : ''), |
|
128 | 128 | ); |
129 | - if ( $default_category ) { |
|
129 | + if ($default_category) { |
|
130 | 130 | $personal_data[] = array( |
131 | - 'name' => __( 'Default Category', 'geodirectory' ), |
|
131 | + 'name' => __('Default Category', 'geodirectory'), |
|
132 | 132 | 'value' => $default_category, |
133 | 133 | ); |
134 | 134 | } |
135 | - if ( ! empty( $post_tags ) ) { |
|
135 | + if (!empty($post_tags)) { |
|
136 | 136 | $personal_data[] = array( |
137 | - 'name' => __( 'Post Tags', 'geodirectory' ), |
|
138 | - 'value' => implode( ', ', $post_tags ), |
|
137 | + 'name' => __('Post Tags', 'geodirectory'), |
|
138 | + 'value' => implode(', ', $post_tags), |
|
139 | 139 | ); |
140 | 140 | } |
141 | 141 | $personal_data[] = array( |
142 | - 'name' => __( 'Post URL', 'geodirectory' ), |
|
143 | - 'value' => get_permalink( $gd_post->ID ), |
|
142 | + 'name' => __('Post URL', 'geodirectory'), |
|
143 | + 'value' => get_permalink($gd_post->ID), |
|
144 | 144 | ); |
145 | 145 | |
146 | 146 | // Post Images |
147 | - $post_images = geodir_get_images( $gd_post->ID ); |
|
148 | - if ( ! empty( $post_images ) ) { |
|
147 | + $post_images = geodir_get_images($gd_post->ID); |
|
148 | + if (!empty($post_images)) { |
|
149 | 149 | $images = array(); |
150 | - foreach ( $post_images as $key => $post_image ) { |
|
151 | - if ( ! empty( $post_image->src ) ) { |
|
150 | + foreach ($post_images as $key => $post_image) { |
|
151 | + if (!empty($post_image->src)) { |
|
152 | 152 | $images[] = $post_image->src; |
153 | 153 | } |
154 | 154 | } |
155 | 155 | |
156 | - if ( ! empty( $images ) ) { |
|
156 | + if (!empty($images)) { |
|
157 | 157 | $personal_data[] = array( |
158 | - 'name' => __( 'Post Images', 'geodirectory' ), |
|
159 | - 'value' => self::parse_files_value( $images ), |
|
158 | + 'name' => __('Post Images', 'geodirectory'), |
|
159 | + 'value' => self::parse_files_value($images), |
|
160 | 160 | ); |
161 | 161 | } |
162 | 162 | } |
163 | 163 | |
164 | 164 | // Post Rating |
165 | - $post_rating = geodir_get_post_rating( $gd_post->ID ); |
|
166 | - if ( $post_rating > 0 ) { |
|
167 | - $post_rating = ( is_float( $post_rating) || ( strpos( $post_rating, ".", 1 ) == 1 && strlen( $post_rating ) > 3 ) ) ? number_format( $post_rating, 1, '.', '' ) : $post_rating; |
|
165 | + $post_rating = geodir_get_post_rating($gd_post->ID); |
|
166 | + if ($post_rating > 0) { |
|
167 | + $post_rating = (is_float($post_rating) || (strpos($post_rating, ".", 1) == 1 && strlen($post_rating) > 3)) ? number_format($post_rating, 1, '.', '') : $post_rating; |
|
168 | 168 | $personal_data[] = array( |
169 | - 'name' => __( 'Post Rating', 'geodirectory' ), |
|
170 | - 'value' => $post_rating . ' / 5', |
|
169 | + 'name' => __('Post Rating', 'geodirectory'), |
|
170 | + 'value' => $post_rating.' / 5', |
|
171 | 171 | ); |
172 | 172 | } |
173 | 173 | |
174 | 174 | // Post Reviews |
175 | - $post_reviews = geodir_get_review_count_total( $gd_post->ID ); |
|
176 | - if ( $post_reviews > 0 ) { |
|
175 | + $post_reviews = geodir_get_review_count_total($gd_post->ID); |
|
176 | + if ($post_reviews > 0) { |
|
177 | 177 | $personal_data[] = array( |
178 | - 'name' => __( 'Post Reviews', 'geodirectory' ), |
|
178 | + 'name' => __('Post Reviews', 'geodirectory'), |
|
179 | 179 | 'value' => $post_reviews, |
180 | 180 | ); |
181 | 181 | } |
182 | 182 | |
183 | - if ( ! empty( $gd_post->is_featured ) ) { |
|
183 | + if (!empty($gd_post->is_featured)) { |
|
184 | 184 | $personal_data[] = array( |
185 | - 'name' => __( 'Post Featured', 'geodirectory' ), |
|
186 | - 'value' => __( 'Yes', 'geodirectory' ), |
|
185 | + 'name' => __('Post Featured', 'geodirectory'), |
|
186 | + 'value' => __('Yes', 'geodirectory'), |
|
187 | 187 | ); |
188 | 188 | } |
189 | 189 | |
190 | - $custom_fields = geodir_post_custom_fields( $gd_post->package_id, 'all', $gd_post->post_type ); |
|
191 | - $post_fields = array_keys( (array) $gd_post ); |
|
190 | + $custom_fields = geodir_post_custom_fields($gd_post->package_id, 'all', $gd_post->post_type); |
|
191 | + $post_fields = array_keys((array) $gd_post); |
|
192 | 192 | |
193 | - foreach ( $custom_fields as $key => $field ) { |
|
194 | - $field_name = ! empty( $field['htmlvar_name'] ) ? $field['htmlvar_name'] : ''; |
|
195 | - if ( empty( $field_name ) ) { |
|
193 | + foreach ($custom_fields as $key => $field) { |
|
194 | + $field_name = !empty($field['htmlvar_name']) ? $field['htmlvar_name'] : ''; |
|
195 | + if (empty($field_name)) { |
|
196 | 196 | continue; |
197 | 197 | } |
198 | 198 | |
199 | - $field = stripslashes_deep( $field ); |
|
199 | + $field = stripslashes_deep($field); |
|
200 | 200 | |
201 | - $extra_fields = ! empty( $field['extra_fields'] ) ? $field['extra_fields'] : array(); |
|
201 | + $extra_fields = !empty($field['extra_fields']) ? $field['extra_fields'] : array(); |
|
202 | 202 | $data_type = $field['data_type']; |
203 | 203 | $field_type = $field['field_type']; |
204 | - $field_title = $field['site_title']; |
|
205 | - if ( $field_name == 'post' ) { |
|
204 | + $field_title = $field['site_title']; |
|
205 | + if ($field_name == 'post') { |
|
206 | 206 | $field_name = 'post_address'; |
207 | 207 | } |
208 | 208 | |
209 | - if ( ! in_array( $field_name, $post_fields ) ) { |
|
209 | + if (!in_array($field_name, $post_fields)) { |
|
210 | 210 | continue; |
211 | 211 | } |
212 | 212 | |
213 | 213 | $name = $field_title; |
214 | 214 | $value = ''; |
215 | - switch ( $field_type ) { |
|
215 | + switch ($field_type) { |
|
216 | 216 | case 'address': |
217 | - $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $gd_post->post_type ) ? false : true; |
|
218 | - if ( $location_allowed && ! empty( $gd_post->post_country ) && ! empty( $gd_post->post_region ) && ! empty( $gd_post->post_city ) ) { |
|
217 | + $location_allowed = function_exists('geodir_cpt_no_location') && geodir_cpt_no_location($gd_post->post_type) ? false : true; |
|
218 | + if ($location_allowed && !empty($gd_post->post_country) && !empty($gd_post->post_region) && !empty($gd_post->post_city)) { |
|
219 | 219 | $personal_data[] = array( |
220 | - 'name' => __( 'Post Address', 'geodirectory' ), |
|
220 | + 'name' => __('Post Address', 'geodirectory'), |
|
221 | 221 | 'value' => $gd_post->post_address, |
222 | 222 | ); |
223 | 223 | $personal_data[] = array( |
224 | - 'name' => __( 'Post City', 'geodirectory' ), |
|
224 | + 'name' => __('Post City', 'geodirectory'), |
|
225 | 225 | 'value' => $gd_post->post_city, |
226 | 226 | ); |
227 | 227 | $personal_data[] = array( |
228 | - 'name' => __( 'Post Region', 'geodirectory' ), |
|
228 | + 'name' => __('Post Region', 'geodirectory'), |
|
229 | 229 | 'value' => $gd_post->post_region, |
230 | 230 | ); |
231 | 231 | $personal_data[] = array( |
232 | - 'name' => __( 'Post Country', 'geodirectory' ), |
|
232 | + 'name' => __('Post Country', 'geodirectory'), |
|
233 | 233 | 'value' => $gd_post->post_country, |
234 | 234 | ); |
235 | 235 | $personal_data[] = array( |
236 | - 'name' => __( 'Post Zip', 'geodirectory' ), |
|
236 | + 'name' => __('Post Zip', 'geodirectory'), |
|
237 | 237 | 'value' => $gd_post->post_zip, |
238 | 238 | ); |
239 | 239 | $personal_data[] = array( |
240 | - 'name' => __( 'Post Latitude', 'geodirectory' ), |
|
240 | + 'name' => __('Post Latitude', 'geodirectory'), |
|
241 | 241 | 'value' => $gd_post->post_latitude, |
242 | 242 | ); |
243 | 243 | $personal_data[] = array( |
244 | - 'name' => __( 'Post Longitude', 'geodirectory' ), |
|
244 | + 'name' => __('Post Longitude', 'geodirectory'), |
|
245 | 245 | 'value' => $gd_post->post_longitude, |
246 | 246 | ); |
247 | - if ( ! empty( $gd_post->post_neighbourhood ) ) { |
|
247 | + if (!empty($gd_post->post_neighbourhood)) { |
|
248 | 248 | $personal_data[] = array( |
249 | - 'name' => __( 'Post Neighbourhood', 'geodirectory' ), |
|
249 | + 'name' => __('Post Neighbourhood', 'geodirectory'), |
|
250 | 250 | 'value' => $gd_post->post_neighbourhood, |
251 | 251 | ); |
252 | 252 | } |
253 | 253 | } |
254 | 254 | break; |
255 | 255 | case 'checkbox': |
256 | - if ( ! empty( $gd_post->{$field_name} ) ) { |
|
257 | - $value = __( 'Yes', 'geodirectory' ); |
|
256 | + if (!empty($gd_post->{$field_name} )) { |
|
257 | + $value = __('Yes', 'geodirectory'); |
|
258 | 258 | } else { |
259 | - $value = __( 'No', 'geodirectory' ); |
|
259 | + $value = __('No', 'geodirectory'); |
|
260 | 260 | } |
261 | 261 | break; |
262 | 262 | case 'datepicker': |
263 | 263 | $value = $gd_post->{$field_name} != '0000-00-00' ? $gd_post->{$field_name} : ''; |
264 | 264 | break; |
265 | 265 | case 'radio': |
266 | - if ( $gd_post->{$field_name} !== '' ) { |
|
267 | - if ( $gd_post->{$field_name} == 'f' || $gd_post->{$field_name} == '0') { |
|
268 | - $value = __( 'No', 'geodirectory' ); |
|
269 | - } else if ( $gd_post->{$field_name} == 't' || $gd_post->{$field_name} == '1') { |
|
270 | - $value = __( 'Yes', 'geodirectory' ); |
|
266 | + if ($gd_post->{$field_name} !== '') { |
|
267 | + if ($gd_post->{$field_name} == 'f' || $gd_post->{$field_name} == '0') { |
|
268 | + $value = __('No', 'geodirectory'); |
|
269 | + } else if ($gd_post->{$field_name} == 't' || $gd_post->{$field_name} == '1') { |
|
270 | + $value = __('Yes', 'geodirectory'); |
|
271 | 271 | } else { |
272 | - if ( !empty( $field['option_values'] ) ) { |
|
273 | - $cf_option_values = geodir_string_values_to_options(stripslashes_deep( $field['option_values'] ), true ); |
|
274 | - if ( ! empty( $cf_option_values ) ) { |
|
275 | - foreach ( $cf_option_values as $cf_option_value ) { |
|
276 | - if ( isset( $cf_option_value['value'] ) && $cf_option_value['value'] == $gd_post->{$field_name} ) { |
|
272 | + if (!empty($field['option_values'])) { |
|
273 | + $cf_option_values = geodir_string_values_to_options(stripslashes_deep($field['option_values']), true); |
|
274 | + if (!empty($cf_option_values)) { |
|
275 | + foreach ($cf_option_values as $cf_option_value) { |
|
276 | + if (isset($cf_option_value['value']) && $cf_option_value['value'] == $gd_post->{$field_name} ) { |
|
277 | 277 | $value = $cf_option_value['label']; |
278 | 278 | } |
279 | 279 | } |
@@ -283,12 +283,12 @@ discard block |
||
283 | 283 | } |
284 | 284 | break; |
285 | 285 | case 'select': |
286 | - $value = __( $gd_post->{$field_name}, 'geodirectory'); |
|
287 | - if ( !empty( $field['option_values'] ) ) { |
|
288 | - $cf_option_values = geodir_string_values_to_options(stripslashes_deep( $field['option_values'] ), true ); |
|
289 | - if ( ! empty( $cf_option_values ) ) { |
|
290 | - foreach ( $cf_option_values as $cf_option_value ) { |
|
291 | - if ( isset( $cf_option_value['value'] ) && $cf_option_value['value'] == $gd_post->{$field_name} ) { |
|
286 | + $value = __($gd_post->{$field_name}, 'geodirectory'); |
|
287 | + if (!empty($field['option_values'])) { |
|
288 | + $cf_option_values = geodir_string_values_to_options(stripslashes_deep($field['option_values']), true); |
|
289 | + if (!empty($cf_option_values)) { |
|
290 | + foreach ($cf_option_values as $cf_option_value) { |
|
291 | + if (isset($cf_option_value['value']) && $cf_option_value['value'] == $gd_post->{$field_name} ) { |
|
292 | 292 | $value = $cf_option_value['label']; |
293 | 293 | } |
294 | 294 | } |
@@ -296,23 +296,23 @@ discard block |
||
296 | 296 | } |
297 | 297 | break; |
298 | 298 | case 'multiselect': |
299 | - $field_values = explode( ',', trim( $gd_post->{$field_name}, "," ) ); |
|
300 | - if ( is_array( $field_values ) ) { |
|
301 | - $field_values = array_map( 'trim', $field_values ); |
|
299 | + $field_values = explode(',', trim($gd_post->{$field_name}, ",")); |
|
300 | + if (is_array($field_values)) { |
|
301 | + $field_values = array_map('trim', $field_values); |
|
302 | 302 | } |
303 | 303 | $values = array(); |
304 | - if ( ! empty( $field['option_values'] ) ) { |
|
305 | - $cf_option_values = geodir_string_values_to_options(stripslashes_deep( $field['option_values'] ), true ); |
|
304 | + if (!empty($field['option_values'])) { |
|
305 | + $cf_option_values = geodir_string_values_to_options(stripslashes_deep($field['option_values']), true); |
|
306 | 306 | |
307 | - if ( ! empty( $cf_option_values ) ) { |
|
308 | - foreach ( $cf_option_values as $cf_option_value ) { |
|
309 | - if ( isset( $cf_option_value['value'] ) && in_array( $cf_option_value['value'], $field_values ) ) { |
|
307 | + if (!empty($cf_option_values)) { |
|
308 | + foreach ($cf_option_values as $cf_option_value) { |
|
309 | + if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) { |
|
310 | 310 | $values[] = $cf_option_value['label']; |
311 | 311 | } |
312 | 312 | } |
313 | 313 | } |
314 | 314 | } |
315 | - $value = ! empty( $values ) ? implode( ', ', $values ) : ''; |
|
315 | + $value = !empty($values) ? implode(', ', $values) : ''; |
|
316 | 316 | break; |
317 | 317 | case 'time': |
318 | 318 | $value = $gd_post->{$field_name} != '00:00:00' ? $gd_post->{$field_name} : ''; |
@@ -326,70 +326,70 @@ discard block |
||
326 | 326 | $value = $gd_post->{$field_name} ? $gd_post->{$field_name} : ''; |
327 | 327 | break; |
328 | 328 | case 'file': |
329 | - $files = explode( ",", $gd_post->{$field_name} ); |
|
330 | - if ( ! empty( $files ) ) { |
|
331 | - $allowed_file_types = !empty( $extra_fields['gd_file_types'] ) && is_array( $extra_fields['gd_file_types'] ) && !in_array( "*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : ''; |
|
329 | + $files = explode(",", $gd_post->{$field_name} ); |
|
330 | + if (!empty($files)) { |
|
331 | + $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : ''; |
|
332 | 332 | |
333 | 333 | $file_urls = array(); |
334 | - foreach ( $files as $file ) { |
|
335 | - if ( ! empty( $file ) ) { |
|
336 | - $image_name_arr = explode( '/', $file ); |
|
337 | - $curr_img_dir = $image_name_arr[ count( $image_name_arr ) - 2]; |
|
334 | + foreach ($files as $file) { |
|
335 | + if (!empty($file)) { |
|
336 | + $image_name_arr = explode('/', $file); |
|
337 | + $curr_img_dir = $image_name_arr[count($image_name_arr) - 2]; |
|
338 | 338 | $filename = end($image_name_arr); |
339 | 339 | $img_name_arr = explode('.', $filename); |
340 | 340 | |
341 | - $arr_file_type = wp_check_filetype( $filename ); |
|
342 | - if ( empty( $arr_file_type['ext'] ) || empty( $arr_file_type['type'] ) ) { |
|
341 | + $arr_file_type = wp_check_filetype($filename); |
|
342 | + if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) { |
|
343 | 343 | continue; |
344 | 344 | } |
345 | 345 | |
346 | 346 | $uploaded_file_type = $arr_file_type['type']; |
347 | 347 | $uploaded_file_ext = $arr_file_type['ext']; |
348 | 348 | |
349 | - if ( ! empty( $allowed_file_types ) && !in_array( $uploaded_file_ext, $allowed_file_types ) ) { |
|
349 | + if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) { |
|
350 | 350 | continue; // Invalid file type. |
351 | 351 | } |
352 | - $image_file_types = array( 'image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon' ); |
|
353 | - $audio_file_types = array( 'audio/mpeg', 'audio/ogg', 'audio/mp4', 'audio/vnd.wav', 'audio/basic', 'audio/mid' ); |
|
352 | + $image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon'); |
|
353 | + $audio_file_types = array('audio/mpeg', 'audio/ogg', 'audio/mp4', 'audio/vnd.wav', 'audio/basic', 'audio/mid'); |
|
354 | 354 | |
355 | 355 | // If the uploaded file is image |
356 | - if ( in_array( $uploaded_file_type, $image_file_types ) ) { |
|
356 | + if (in_array($uploaded_file_type, $image_file_types)) { |
|
357 | 357 | $file_urls[] = $file; |
358 | 358 | } |
359 | 359 | } |
360 | 360 | } |
361 | - $value = ! empty( $file_urls ) ? self::parse_files_value( $file_urls ) : ''; |
|
361 | + $value = !empty($file_urls) ? self::parse_files_value($file_urls) : ''; |
|
362 | 362 | } |
363 | 363 | break; |
364 | 364 | } |
365 | 365 | |
366 | - if ( ! empty( $name ) && $value !== '' ) { |
|
366 | + if (!empty($name) && $value !== '') { |
|
367 | 367 | $personal_data[] = array( |
368 | - 'name' => __( $name, 'geodirectory' ), |
|
368 | + 'name' => __($name, 'geodirectory'), |
|
369 | 369 | 'value' => $value, |
370 | 370 | ); |
371 | 371 | } |
372 | 372 | } |
373 | 373 | |
374 | - if ( ! empty( $gd_post->geodir_link_business ) && ( $post_type = get_post_type( (int)$gd_post->geodir_link_business ) ) ) { |
|
374 | + if (!empty($gd_post->geodir_link_business) && ($post_type = get_post_type((int) $gd_post->geodir_link_business))) { |
|
375 | 375 | $personal_data[] = array( |
376 | - 'name' => __( 'Link Business Title', 'geodirectory' ), |
|
377 | - 'value' => get_the_title( (int)$gd_post->geodir_link_business ), |
|
376 | + 'name' => __('Link Business Title', 'geodirectory'), |
|
377 | + 'value' => get_the_title((int) $gd_post->geodir_link_business), |
|
378 | 378 | ); |
379 | 379 | $personal_data[] = array( |
380 | - 'name' => __( 'Link Business URL', 'geodirectory' ), |
|
381 | - 'value' => get_permalink( (int)$gd_post->geodir_link_business ), |
|
380 | + 'name' => __('Link Business URL', 'geodirectory'), |
|
381 | + 'value' => get_permalink((int) $gd_post->geodir_link_business), |
|
382 | 382 | ); |
383 | 383 | } |
384 | - if ( defined( 'GEODIR_FRANCHISE_VERSION' ) ) { |
|
385 | - if ( ! empty( $gd_post->franchise ) && ( $post_type = get_post_type( (int)$gd_post->franchise ) ) ) { |
|
384 | + if (defined('GEODIR_FRANCHISE_VERSION')) { |
|
385 | + if (!empty($gd_post->franchise) && ($post_type = get_post_type((int) $gd_post->franchise))) { |
|
386 | 386 | $personal_data[] = array( |
387 | - 'name' => __( 'Main Listing Title', 'geodirectory' ), |
|
388 | - 'value' => get_the_title( (int)$gd_post->franchise ), |
|
387 | + 'name' => __('Main Listing Title', 'geodirectory'), |
|
388 | + 'value' => get_the_title((int) $gd_post->franchise), |
|
389 | 389 | ); |
390 | 390 | $personal_data[] = array( |
391 | - 'name' => __( 'Main Listing URL', 'geodirectory' ), |
|
392 | - 'value' => get_permalink( (int)$gd_post->franchise ), |
|
391 | + 'name' => __('Main Listing URL', 'geodirectory'), |
|
392 | + 'value' => get_permalink((int) $gd_post->franchise), |
|
393 | 393 | ); |
394 | 394 | } |
395 | 395 | } |
@@ -401,28 +401,28 @@ discard block |
||
401 | 401 | * @param array $personal_data Array of name value pairs to expose in the export. |
402 | 402 | * @param WP_Post $gd_post The post object. |
403 | 403 | */ |
404 | - $personal_data = apply_filters( 'geodir_privacy_export_post_personal_data', $personal_data, $gd_post ); |
|
404 | + $personal_data = apply_filters('geodir_privacy_export_post_personal_data', $personal_data, $gd_post); |
|
405 | 405 | |
406 | 406 | return $personal_data; |
407 | 407 | } |
408 | 408 | |
409 | - public static function posts_by_author( $email_address, $post_type, $page ) { |
|
410 | - if ( empty( $email_address ) || empty( $post_type ) || empty( $page ) ) { |
|
409 | + public static function posts_by_author($email_address, $post_type, $page) { |
|
410 | + if (empty($email_address) || empty($post_type) || empty($page)) { |
|
411 | 411 | return array(); |
412 | 412 | } |
413 | 413 | |
414 | - $user = get_user_by( 'email', $email_address ); |
|
415 | - if ( empty( $user ) ) { |
|
414 | + $user = get_user_by('email', $email_address); |
|
415 | + if (empty($user)) { |
|
416 | 416 | return array(); |
417 | 417 | } |
418 | 418 | |
419 | - $statuses = array_keys( get_post_statuses() ); |
|
419 | + $statuses = array_keys(get_post_statuses()); |
|
420 | 420 | $skip_statuses = geodir_imex_export_skip_statuses(); |
421 | - if ( ! empty( $skip_statuses ) ) { |
|
422 | - $statuses = array_diff( $statuses, $skip_statuses ); |
|
421 | + if (!empty($skip_statuses)) { |
|
422 | + $statuses = array_diff($statuses, $skip_statuses); |
|
423 | 423 | } |
424 | 424 | |
425 | - $query_args = array( |
|
425 | + $query_args = array( |
|
426 | 426 | 'post_type' => $post_type, |
427 | 427 | 'post_status' => $statuses, |
428 | 428 | 'fields' => 'ids', |
@@ -433,66 +433,66 @@ discard block |
||
433 | 433 | 'order' => 'ASC' |
434 | 434 | ); |
435 | 435 | |
436 | - $query_args = apply_filters( 'geodir_privacy_post_data_exporter_post_query', $query_args, $post_type, $email_address, $page ); |
|
436 | + $query_args = apply_filters('geodir_privacy_post_data_exporter_post_query', $query_args, $post_type, $email_address, $page); |
|
437 | 437 | |
438 | - $posts = get_posts( $query_args ); |
|
438 | + $posts = get_posts($query_args); |
|
439 | 439 | |
440 | - return apply_filters( 'geodir_privacy_post_data_exporter_posts', $posts, $query_args, $post_type, $email_address, $page ); |
|
440 | + return apply_filters('geodir_privacy_post_data_exporter_posts', $posts, $query_args, $post_type, $email_address, $page); |
|
441 | 441 | } |
442 | 442 | |
443 | - public static function review_data_exporter( $response, $exporter_index, $email_address, $page, $request_id, $send_as_email, $exporter_key ) { |
|
443 | + public static function review_data_exporter($response, $exporter_index, $email_address, $page, $request_id, $send_as_email, $exporter_key) { |
|
444 | 444 | global $wpdb; |
445 | 445 | |
446 | 446 | $exporter_key = GeoDir_Privacy::personal_data_exporter_key(); |
447 | 447 | |
448 | - if ( $exporter_key == 'wordpress-comments' && ! empty( $response['data'] ) ) { |
|
449 | - foreach ( $response['data'] as $key => $item ) { |
|
450 | - $comment_id = str_replace( 'comment-', '', $item['item_id'] ); |
|
448 | + if ($exporter_key == 'wordpress-comments' && !empty($response['data'])) { |
|
449 | + foreach ($response['data'] as $key => $item) { |
|
450 | + $comment_id = str_replace('comment-', '', $item['item_id']); |
|
451 | 451 | $data = $item['data']; |
452 | 452 | |
453 | - $review = geodir_get_review( $comment_id ); |
|
454 | - if ( ! empty( $review ) ) { |
|
455 | - if ( ! empty( $review->overall_rating ) ) { |
|
453 | + $review = geodir_get_review($comment_id); |
|
454 | + if (!empty($review)) { |
|
455 | + if (!empty($review->overall_rating)) { |
|
456 | 456 | $data[] = array( |
457 | - 'name' => __( 'Rating (Overall)', 'geodirectory' ), |
|
458 | - 'value' => (float)$review->overall_rating . ' / 5', |
|
457 | + 'name' => __('Rating (Overall)', 'geodirectory'), |
|
458 | + 'value' => (float) $review->overall_rating.' / 5', |
|
459 | 459 | ); |
460 | 460 | } |
461 | - if ( ! empty( $review->post_city ) ) { |
|
461 | + if (!empty($review->post_city)) { |
|
462 | 462 | $data[] = array( |
463 | - 'name' => __( 'Review City', 'geodirectory' ), |
|
463 | + 'name' => __('Review City', 'geodirectory'), |
|
464 | 464 | 'value' => $review->post_city, |
465 | 465 | ); |
466 | 466 | } |
467 | - if ( ! empty( $review->post_region ) ) { |
|
467 | + if (!empty($review->post_region)) { |
|
468 | 468 | $data[] = array( |
469 | - 'name' => __( 'Review Region', 'geodirectory' ), |
|
469 | + 'name' => __('Review Region', 'geodirectory'), |
|
470 | 470 | 'value' => $review->post_region, |
471 | 471 | ); |
472 | 472 | } |
473 | - if ( ! empty( $review->post_country ) ) { |
|
473 | + if (!empty($review->post_country)) { |
|
474 | 474 | $data[] = array( |
475 | - 'name' => __( 'Review Country', 'geodirectory' ), |
|
475 | + 'name' => __('Review Country', 'geodirectory'), |
|
476 | 476 | 'value' => $review->post_country, |
477 | 477 | ); |
478 | 478 | } |
479 | - if ( ! empty( $review->post_latitude ) ) { |
|
479 | + if (!empty($review->post_latitude)) { |
|
480 | 480 | $data[] = array( |
481 | - 'name' => __( 'Review Latitude', 'geodirectory' ), |
|
481 | + 'name' => __('Review Latitude', 'geodirectory'), |
|
482 | 482 | 'value' => $review->post_latitude, |
483 | 483 | ); |
484 | 484 | } |
485 | - if ( ! empty( $review->post_longitude ) ) { |
|
485 | + if (!empty($review->post_longitude)) { |
|
486 | 486 | $data[] = array( |
487 | - 'name' => __( 'Review Longitude', 'geodirectory' ), |
|
487 | + 'name' => __('Review Longitude', 'geodirectory'), |
|
488 | 488 | 'value' => $review->post_longitude, |
489 | 489 | ); |
490 | 490 | } |
491 | 491 | |
492 | - $data = apply_filters( 'geodir_privacy_export_review_data', $data, $review, $email_address ); |
|
492 | + $data = apply_filters('geodir_privacy_export_review_data', $data, $review, $email_address); |
|
493 | 493 | |
494 | - if ( ! empty( $data ) ) { |
|
495 | - $response['data'][ $key ]['data'] = $data; |
|
494 | + if (!empty($data)) { |
|
495 | + $response['data'][$key]['data'] = $data; |
|
496 | 496 | } |
497 | 497 | } |
498 | 498 | } |
@@ -508,36 +508,36 @@ discard block |
||
508 | 508 | * @param int $page Page. |
509 | 509 | * @return array An array of personal data in name value pairs |
510 | 510 | */ |
511 | - public static function favorites_data_exporter( $email_address, $page ) { |
|
511 | + public static function favorites_data_exporter($email_address, $page) { |
|
512 | 512 | $done = true; |
513 | 513 | $page = (int) $page; |
514 | 514 | $data_to_export = array(); |
515 | 515 | |
516 | - $items = GeoDir_Privacy::favorites_by_user( $email_address, $page ); |
|
516 | + $items = GeoDir_Privacy::favorites_by_user($email_address, $page); |
|
517 | 517 | |
518 | - if ( 0 < count( $items ) ) { |
|
519 | - foreach ( $items as $item ) { |
|
520 | - $gd_post = geodir_get_post_info( $item ); |
|
521 | - if ( empty( $gd_post ) ) { |
|
518 | + if (0 < count($items)) { |
|
519 | + foreach ($items as $item) { |
|
520 | + $gd_post = geodir_get_post_info($item); |
|
521 | + if (empty($gd_post)) { |
|
522 | 522 | continue; |
523 | 523 | } |
524 | 524 | |
525 | 525 | $data_to_export[] = array( |
526 | 526 | 'group_id' => 'geodirectory-post-favorites', |
527 | - 'group_label' => __( 'GeoDirectory Favorite Listings', 'geodirectory' ), |
|
528 | - 'item_id' => 'gd-favorite-' . $gd_post->ID, |
|
527 | + 'group_label' => __('GeoDirectory Favorite Listings', 'geodirectory'), |
|
528 | + 'item_id' => 'gd-favorite-'.$gd_post->ID, |
|
529 | 529 | 'data' => array( |
530 | 530 | array( |
531 | - 'name' => __( 'Post ID', 'geodirectory' ), |
|
531 | + 'name' => __('Post ID', 'geodirectory'), |
|
532 | 532 | 'value' => $gd_post->ID, |
533 | 533 | ), |
534 | 534 | array( |
535 | - 'name' => __( 'Post Title', 'geodirectory' ), |
|
535 | + 'name' => __('Post Title', 'geodirectory'), |
|
536 | 536 | 'value' => $gd_post->post_title, |
537 | 537 | ), |
538 | 538 | array( |
539 | - 'name' => __( 'Post URL', 'geodirectory' ), |
|
540 | - 'value' => get_permalink( $gd_post->ID ), |
|
539 | + 'name' => __('Post URL', 'geodirectory'), |
|
540 | + 'value' => get_permalink($gd_post->ID), |
|
541 | 541 | ) |
542 | 542 | ), |
543 | 543 | ); |
@@ -550,27 +550,27 @@ discard block |
||
550 | 550 | ); |
551 | 551 | } |
552 | 552 | |
553 | - public static function parse_files_value( $files ) { |
|
554 | - if ( empty( $files ) ) { |
|
553 | + public static function parse_files_value($files) { |
|
554 | + if (empty($files)) { |
|
555 | 555 | return ''; |
556 | 556 | } |
557 | 557 | |
558 | - if ( ! is_array( $files ) ) { |
|
558 | + if (!is_array($files)) { |
|
559 | 559 | return $files; |
560 | 560 | } |
561 | 561 | |
562 | - if ( count( $files ) == 1 ) { |
|
562 | + if (count($files) == 1) { |
|
563 | 563 | return $files[0]; |
564 | 564 | } |
565 | 565 | |
566 | 566 | $links = array(); |
567 | - foreach ( $files as $file ) { |
|
568 | - if ( false === strpos( $file, ' ' ) && ( 0 === strpos( $file, 'http://' ) || 0 === strpos( $file, 'https://' ) ) ) { |
|
569 | - $file = '<a href="' . esc_url( $file ) . '">' . esc_html( $file ) . '</a>'; |
|
567 | + foreach ($files as $file) { |
|
568 | + if (false === strpos($file, ' ') && (0 === strpos($file, 'http://') || 0 === strpos($file, 'https://'))) { |
|
569 | + $file = '<a href="'.esc_url($file).'">'.esc_html($file).'</a>'; |
|
570 | 570 | } |
571 | 571 | $links[] = $file; |
572 | 572 | } |
573 | - $links = ! empty( $links ) ? implode( ' <br> ', $links ) : ''; |
|
573 | + $links = !empty($links) ? implode(' <br> ', $links) : ''; |
|
574 | 574 | |
575 | 575 | return $links; |
576 | 576 | } |
@@ -103,6 +103,10 @@ |
||
103 | 103 | ); |
104 | 104 | } |
105 | 105 | |
106 | + /** |
|
107 | + * @param string $email_address |
|
108 | + * @param integer $page |
|
109 | + */ |
|
106 | 110 | public static function reviews_by_author( $email_address, $page, $posts_per_page = 10 ) { |
107 | 111 | global $wpdb; |
108 | 112 |
@@ -159,12 +159,12 @@ |
||
159 | 159 | $messages = array(); |
160 | 160 | |
161 | 161 | $site_id = ''; |
162 | - if ( is_multisite() ) { |
|
163 | - $blog_id = get_current_blog_id(); |
|
164 | - if ( $blog_id && $blog_id != '1' ) { |
|
162 | + if ( is_multisite() ) { |
|
163 | + $blog_id = get_current_blog_id(); |
|
164 | + if ( $blog_id && $blog_id != '1' ) { |
|
165 | 165 | $site_id = '_' . $blog_id; |
166 | 166 | } |
167 | - } |
|
167 | + } |
|
168 | 168 | |
169 | 169 | if ( delete_user_meta( $user->ID, 'gd_user_favourite_post' . $site_id ) ) { |
170 | 170 | $messages[] = __( 'Removed "Favorite Listings" data from user.', 'geodirectory' ); |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @package GeoDirectory |
7 | 7 | */ |
8 | 8 | |
9 | -defined( 'ABSPATH' ) || exit; |
|
9 | +defined('ABSPATH') || exit; |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * GeoDir_Privacy_Erasers Class. |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * @param int $page Review page. |
23 | 23 | * @return array |
24 | 24 | */ |
25 | - public static function review_data_eraser( $email_address, $page ) { |
|
25 | + public static function review_data_eraser($email_address, $page) { |
|
26 | 26 | global $wpdb; |
27 | 27 | |
28 | 28 | $response = array( |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | 'done' => true, |
33 | 33 | ); |
34 | 34 | |
35 | - if ( empty( $email_address ) ) { |
|
35 | + if (empty($email_address)) { |
|
36 | 36 | return $response; |
37 | 37 | } |
38 | 38 | |
@@ -40,18 +40,18 @@ discard block |
||
40 | 40 | $items_removed = false; |
41 | 41 | $items_retained = false; |
42 | 42 | |
43 | - $reviews = self::reviews_by_author( $email_address, $page ); |
|
43 | + $reviews = self::reviews_by_author($email_address, $page); |
|
44 | 44 | |
45 | - if ( empty( $reviews ) ) { |
|
45 | + if (empty($reviews)) { |
|
46 | 46 | return $response; |
47 | 47 | } |
48 | 48 | |
49 | - $messages = array(); |
|
49 | + $messages = array(); |
|
50 | 50 | |
51 | - foreach ( $reviews as $review ) { |
|
51 | + foreach ($reviews as $review) { |
|
52 | 52 | $anonymized_review = array(); |
53 | 53 | $anonymized_review['user_id'] = 0; |
54 | - $anonymized_review['rating_ip'] = wp_privacy_anonymize_data( 'ip', $review->rating_ip ); |
|
54 | + $anonymized_review['rating_ip'] = wp_privacy_anonymize_data('ip', $review->rating_ip); |
|
55 | 55 | |
56 | 56 | $review_id = (int) $review->id; |
57 | 57 | |
@@ -65,14 +65,14 @@ discard block |
||
65 | 65 | * @param object $review Review object. |
66 | 66 | * @param array $anonymized_review Anonymized review data. |
67 | 67 | */ |
68 | - $anon_message = apply_filters( 'geodir_anonymize_post_review', true, $review, $anonymized_review ); |
|
68 | + $anon_message = apply_filters('geodir_anonymize_post_review', true, $review, $anonymized_review); |
|
69 | 69 | |
70 | - if ( true !== $anon_message ) { |
|
71 | - if ( $anon_message && is_string( $anon_message ) ) { |
|
72 | - $messages[] = esc_html( $anon_message ); |
|
70 | + if (true !== $anon_message) { |
|
71 | + if ($anon_message && is_string($anon_message)) { |
|
72 | + $messages[] = esc_html($anon_message); |
|
73 | 73 | } else { |
74 | 74 | /* translators: %d: Review ID */ |
75 | - $messages[] = sprintf( __( 'Review %d contains personal data but could not be anonymized.', 'geodirectory' ), $review_id ); |
|
75 | + $messages[] = sprintf(__('Review %d contains personal data but could not be anonymized.', 'geodirectory'), $review_id); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | $items_retained = true; |
@@ -84,16 +84,16 @@ discard block |
||
84 | 84 | 'id' => $review_id, |
85 | 85 | ); |
86 | 86 | |
87 | - $updated = $wpdb->update( GEODIR_REVIEW_TABLE, $anonymized_review, $args ); |
|
87 | + $updated = $wpdb->update(GEODIR_REVIEW_TABLE, $anonymized_review, $args); |
|
88 | 88 | |
89 | - if ( $updated ) { |
|
89 | + if ($updated) { |
|
90 | 90 | $items_removed = true; |
91 | 91 | } else { |
92 | 92 | $items_retained = true; |
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
96 | - $done = count( $reviews ) < $number; |
|
96 | + $done = count($reviews) < $number; |
|
97 | 97 | |
98 | 98 | return array( |
99 | 99 | 'items_removed' => $items_removed, |
@@ -103,29 +103,29 @@ discard block |
||
103 | 103 | ); |
104 | 104 | } |
105 | 105 | |
106 | - public static function reviews_by_author( $email_address, $page, $posts_per_page = 10 ) { |
|
106 | + public static function reviews_by_author($email_address, $page, $posts_per_page = 10) { |
|
107 | 107 | global $wpdb; |
108 | 108 | |
109 | - if ( empty( $email_address ) || empty( $page ) ) { |
|
109 | + if (empty($email_address) || empty($page)) { |
|
110 | 110 | return array(); |
111 | 111 | } |
112 | 112 | |
113 | - $user = get_user_by( 'email', $email_address ); |
|
114 | - if ( empty( $user ) ) { |
|
113 | + $user = get_user_by('email', $email_address); |
|
114 | + if (empty($user)) { |
|
115 | 115 | return array(); |
116 | 116 | } |
117 | 117 | |
118 | - if ( absint( $page ) < 1 ) { |
|
118 | + if (absint($page) < 1) { |
|
119 | 119 | $page = 1; |
120 | 120 | } |
121 | 121 | |
122 | - $limit = absint( ( $page - 1 ) * $posts_per_page ) . ", " . $posts_per_page; |
|
122 | + $limit = absint(($page - 1) * $posts_per_page).", ".$posts_per_page; |
|
123 | 123 | |
124 | - $query = $wpdb->prepare( "SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE user_id = %d ORDER BY comment_id ASC LIMIT " . $limit, array( $user->ID ) ); |
|
124 | + $query = $wpdb->prepare("SELECT * FROM ".GEODIR_REVIEW_TABLE." WHERE user_id = %d ORDER BY comment_id ASC LIMIT ".$limit, array($user->ID)); |
|
125 | 125 | |
126 | - $reviews = $wpdb->get_results( $query ); |
|
126 | + $reviews = $wpdb->get_results($query); |
|
127 | 127 | |
128 | - return apply_filters( 'geodir_privacy_review_data_eraser_reviews', $reviews, $email_address, $user, $page ); |
|
128 | + return apply_filters('geodir_privacy_review_data_eraser_reviews', $reviews, $email_address, $user, $page); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * @param int $page Page number. |
138 | 138 | * @return array |
139 | 139 | */ |
140 | - public static function favorites_data_eraser( $email_address, $page ) { |
|
140 | + public static function favorites_data_eraser($email_address, $page) { |
|
141 | 141 | $response = array( |
142 | 142 | 'items_removed' => false, |
143 | 143 | 'items_retained' => false, |
@@ -145,12 +145,12 @@ discard block |
||
145 | 145 | 'done' => true, |
146 | 146 | ); |
147 | 147 | |
148 | - if ( empty( $email_address ) ) { |
|
148 | + if (empty($email_address)) { |
|
149 | 149 | return $response; |
150 | 150 | } |
151 | 151 | |
152 | - $user = get_user_by( 'email', $email_address ); |
|
153 | - if ( empty( $user ) ) { |
|
152 | + $user = get_user_by('email', $email_address); |
|
153 | + if (empty($user)) { |
|
154 | 154 | return $response; |
155 | 155 | } |
156 | 156 | |
@@ -159,15 +159,15 @@ discard block |
||
159 | 159 | $messages = array(); |
160 | 160 | |
161 | 161 | $site_id = ''; |
162 | - if ( is_multisite() ) { |
|
162 | + if (is_multisite()) { |
|
163 | 163 | $blog_id = get_current_blog_id(); |
164 | - if ( $blog_id && $blog_id != '1' ) { |
|
165 | - $site_id = '_' . $blog_id; |
|
164 | + if ($blog_id && $blog_id != '1') { |
|
165 | + $site_id = '_'.$blog_id; |
|
166 | 166 | } |
167 | 167 | } |
168 | 168 | |
169 | - if ( delete_user_meta( $user->ID, 'gd_user_favourite_post' . $site_id ) ) { |
|
170 | - $messages[] = __( 'Removed "Favorite Listings" data from user.', 'geodirectory' ); |
|
169 | + if (delete_user_meta($user->ID, 'gd_user_favourite_post'.$site_id)) { |
|
170 | + $messages[] = __('Removed "Favorite Listings" data from user.', 'geodirectory'); |
|
171 | 171 | $items_removed = true; |
172 | 172 | } |
173 | 173 |
@@ -14,83 +14,83 @@ discard block |
||
14 | 14 | */ |
15 | 15 | class geodir_popular_post_category extends WP_Widget |
16 | 16 | { |
17 | - /** |
|
18 | - * Register the popular post category widget. |
|
19 | - * |
|
20 | - * @since 1.0.0 |
|
21 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
22 | - */ |
|
23 | - public function __construct() { |
|
24 | - $widget_ops = array('classname' => 'geodir_popular_post_category', 'description' => __('GD > Popular Post Category', 'geodirectory')); |
|
25 | - parent::__construct( |
|
26 | - 'popular_post_category', // Base ID |
|
27 | - __('GD > Popular Post Category', 'geodirectory'), // Name |
|
28 | - $widget_ops// Args |
|
29 | - ); |
|
30 | - } |
|
31 | - |
|
32 | - /** |
|
33 | - * Front-end display content for popular post category widget. |
|
34 | - * |
|
35 | - * @since 1.0.0 |
|
36 | - * @since 1.5.1 Declare function public. |
|
37 | - * |
|
38 | - * @param array $args Widget arguments. |
|
39 | - * @param array $instance Saved values from database. |
|
40 | - */ |
|
41 | - public function widget($args, $instance) |
|
42 | - { |
|
43 | - geodir_popular_post_category_output($args, $instance); |
|
44 | - } |
|
45 | - |
|
46 | - /** |
|
47 | - * Sanitize popular post category widget form values as they are saved. |
|
48 | - * |
|
49 | - * @since 1.0.0 |
|
50 | - * @since 1.5.1 Declare function public. |
|
51 | - * @since 1.5.1 Added default_post_type parameter. |
|
52 | - * @since 1.6.9 Added parent_only parameter. |
|
53 | - * |
|
54 | - * @param array $new_instance Values just sent to be saved. |
|
55 | - * @param array $old_instance Previously saved values from database. |
|
56 | - * |
|
57 | - * @return array Updated safe values to be saved. |
|
58 | - */ |
|
59 | - public function update($new_instance, $old_instance) |
|
60 | - { |
|
61 | - //save the widget |
|
62 | - $instance = $old_instance; |
|
63 | - $instance['title'] = strip_tags($new_instance['title']); |
|
64 | - $category_limit = (int)$new_instance['category_limit']; |
|
65 | - $instance['category_limit'] = $category_limit > 0 ? $category_limit : 15; |
|
66 | - $instance['default_post_type'] = isset($new_instance['default_post_type']) ? $new_instance['default_post_type'] : ''; |
|
67 | - $instance['parent_only'] = !empty($new_instance['parent_only']) ? true : false; |
|
68 | - return $instance; |
|
69 | - } |
|
70 | - |
|
71 | - /** |
|
72 | - * Back-end popular post category widget settings form. |
|
73 | - * |
|
74 | - * @since 1.0.0 |
|
75 | - * @since 1.5.1 Declare function public. |
|
76 | - * @since 1.5.1 Added option to set default post type. |
|
77 | - * @since 1.6.9 Added option to show parent categories only. |
|
78 | - * |
|
79 | - * @param array $instance Previously saved values from database. |
|
80 | - */ |
|
81 | - public function form($instance) |
|
82 | - { |
|
83 | - //widgetform in backend |
|
84 | - $instance = wp_parse_args((array)$instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => '', 'parent_only' => false)); |
|
85 | - |
|
86 | - $title = strip_tags($instance['title']); |
|
87 | - $category_limit = (int)$instance['category_limit']; |
|
88 | - $category_limit = $category_limit > 0 ? $category_limit : 15; |
|
89 | - $default_post_type = isset($instance['default_post_type']) ? $instance['default_post_type'] : ''; |
|
90 | - $parent_only = !empty($instance['parent_only']) ? true: false; |
|
17 | + /** |
|
18 | + * Register the popular post category widget. |
|
19 | + * |
|
20 | + * @since 1.0.0 |
|
21 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
22 | + */ |
|
23 | + public function __construct() { |
|
24 | + $widget_ops = array('classname' => 'geodir_popular_post_category', 'description' => __('GD > Popular Post Category', 'geodirectory')); |
|
25 | + parent::__construct( |
|
26 | + 'popular_post_category', // Base ID |
|
27 | + __('GD > Popular Post Category', 'geodirectory'), // Name |
|
28 | + $widget_ops// Args |
|
29 | + ); |
|
30 | + } |
|
31 | + |
|
32 | + /** |
|
33 | + * Front-end display content for popular post category widget. |
|
34 | + * |
|
35 | + * @since 1.0.0 |
|
36 | + * @since 1.5.1 Declare function public. |
|
37 | + * |
|
38 | + * @param array $args Widget arguments. |
|
39 | + * @param array $instance Saved values from database. |
|
40 | + */ |
|
41 | + public function widget($args, $instance) |
|
42 | + { |
|
43 | + geodir_popular_post_category_output($args, $instance); |
|
44 | + } |
|
45 | + |
|
46 | + /** |
|
47 | + * Sanitize popular post category widget form values as they are saved. |
|
48 | + * |
|
49 | + * @since 1.0.0 |
|
50 | + * @since 1.5.1 Declare function public. |
|
51 | + * @since 1.5.1 Added default_post_type parameter. |
|
52 | + * @since 1.6.9 Added parent_only parameter. |
|
53 | + * |
|
54 | + * @param array $new_instance Values just sent to be saved. |
|
55 | + * @param array $old_instance Previously saved values from database. |
|
56 | + * |
|
57 | + * @return array Updated safe values to be saved. |
|
58 | + */ |
|
59 | + public function update($new_instance, $old_instance) |
|
60 | + { |
|
61 | + //save the widget |
|
62 | + $instance = $old_instance; |
|
63 | + $instance['title'] = strip_tags($new_instance['title']); |
|
64 | + $category_limit = (int)$new_instance['category_limit']; |
|
65 | + $instance['category_limit'] = $category_limit > 0 ? $category_limit : 15; |
|
66 | + $instance['default_post_type'] = isset($new_instance['default_post_type']) ? $new_instance['default_post_type'] : ''; |
|
67 | + $instance['parent_only'] = !empty($new_instance['parent_only']) ? true : false; |
|
68 | + return $instance; |
|
69 | + } |
|
70 | + |
|
71 | + /** |
|
72 | + * Back-end popular post category widget settings form. |
|
73 | + * |
|
74 | + * @since 1.0.0 |
|
75 | + * @since 1.5.1 Declare function public. |
|
76 | + * @since 1.5.1 Added option to set default post type. |
|
77 | + * @since 1.6.9 Added option to show parent categories only. |
|
78 | + * |
|
79 | + * @param array $instance Previously saved values from database. |
|
80 | + */ |
|
81 | + public function form($instance) |
|
82 | + { |
|
83 | + //widgetform in backend |
|
84 | + $instance = wp_parse_args((array)$instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => '', 'parent_only' => false)); |
|
85 | + |
|
86 | + $title = strip_tags($instance['title']); |
|
87 | + $category_limit = (int)$instance['category_limit']; |
|
88 | + $category_limit = $category_limit > 0 ? $category_limit : 15; |
|
89 | + $default_post_type = isset($instance['default_post_type']) ? $instance['default_post_type'] : ''; |
|
90 | + $parent_only = !empty($instance['parent_only']) ? true: false; |
|
91 | 91 | |
92 | - $post_type_options = geodir_get_posttypes('options'); |
|
93 | - ?> |
|
92 | + $post_type_options = geodir_get_posttypes('options'); |
|
93 | + ?> |
|
94 | 94 | <p> |
95 | 95 | <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory'); ?> |
96 | 96 | <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>"/> |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | <label for="<?php echo $this->get_field_id('parent_only'); ?>"><?php _e( 'Show parent categories only', 'geodirectory' ); ?></label> |
117 | 117 | </p> |
118 | 118 | <?php |
119 | - } |
|
119 | + } |
|
120 | 120 | } // class geodir_popular_post_category |
121 | 121 | |
122 | 122 | register_widget('geodir_popular_post_category'); |
@@ -130,40 +130,40 @@ discard block |
||
130 | 130 | class geodir_popular_postview extends WP_Widget |
131 | 131 | { |
132 | 132 | |
133 | - /** |
|
133 | + /** |
|
134 | 134 | * Register the popular posts widget. |
135 | 135 | * |
136 | 136 | * @since 1.0.0 |
137 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
137 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
138 | 138 | */ |
139 | - public function __construct() { |
|
140 | - $widget_ops = array('classname' => 'geodir_popular_post_view', 'description' => __('GD > Popular Post View', 'geodirectory')); |
|
141 | - parent::__construct( |
|
142 | - 'popular_post_view', // Base ID |
|
143 | - __('GD > Popular Post View', 'geodirectory'), // Name |
|
144 | - $widget_ops// Args |
|
145 | - ); |
|
146 | - } |
|
139 | + public function __construct() { |
|
140 | + $widget_ops = array('classname' => 'geodir_popular_post_view', 'description' => __('GD > Popular Post View', 'geodirectory')); |
|
141 | + parent::__construct( |
|
142 | + 'popular_post_view', // Base ID |
|
143 | + __('GD > Popular Post View', 'geodirectory'), // Name |
|
144 | + $widget_ops// Args |
|
145 | + ); |
|
146 | + } |
|
147 | 147 | |
148 | 148 | /** |
149 | 149 | * Front-end display content for popular posts widget. |
150 | 150 | * |
151 | 151 | * @since 1.0.0 |
152 | - * @since 1.5.1 Declare function public. |
|
152 | + * @since 1.5.1 Declare function public. |
|
153 | 153 | * |
154 | 154 | * @param array $args Widget arguments. |
155 | 155 | * @param array $instance Saved values from database. |
156 | 156 | */ |
157 | 157 | public function widget($args, $instance) |
158 | - { |
|
159 | - geodir_popular_postview_output($args, $instance); |
|
160 | - } |
|
158 | + { |
|
159 | + geodir_popular_postview_output($args, $instance); |
|
160 | + } |
|
161 | 161 | |
162 | 162 | /** |
163 | 163 | * Sanitize popular posts widget form values as they are saved. |
164 | 164 | * |
165 | 165 | * @since 1.0.0 |
166 | - * @since 1.5.1 Declare function public. |
|
166 | + * @since 1.5.1 Declare function public. |
|
167 | 167 | * |
168 | 168 | * @param array $new_instance Values just sent to be saved. |
169 | 169 | * @param array $old_instance Previously saved values from database. |
@@ -171,106 +171,106 @@ discard block |
||
171 | 171 | * @return array Updated safe values to be saved. |
172 | 172 | */ |
173 | 173 | public function update($new_instance, $old_instance) |
174 | - { |
|
175 | - //save the widget |
|
176 | - $instance = $old_instance; |
|
177 | - |
|
178 | - if ($new_instance['title'] == '') { |
|
179 | - $title = geodir_ucwords(strip_tags($new_instance['category_title'])); |
|
180 | - //$instance['title'] = $title; |
|
181 | - } |
|
182 | - $instance['title'] = strip_tags($new_instance['title']); |
|
183 | - |
|
184 | - $instance['post_type'] = strip_tags($new_instance['post_type']); |
|
185 | - //$instance['category'] = strip_tags($new_instance['category']); |
|
186 | - $instance['category'] = isset($new_instance['category']) ? $new_instance['category'] : ''; |
|
187 | - $instance['category_title'] = strip_tags($new_instance['category_title']); |
|
188 | - $instance['post_number'] = strip_tags($new_instance['post_number']); |
|
189 | - $instance['layout'] = strip_tags($new_instance['layout']); |
|
190 | - $instance['listing_width'] = strip_tags($new_instance['listing_width']); |
|
191 | - $instance['list_sort'] = strip_tags($new_instance['list_sort']); |
|
192 | - $instance['title_tag'] = strip_tags($new_instance['title_tag']); |
|
193 | - $instance['character_count'] = $new_instance['character_count']; |
|
194 | - if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') |
|
195 | - $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
196 | - else |
|
197 | - $instance['add_location_filter'] = '0'; |
|
198 | - |
|
199 | - $instance['show_featured_only'] = isset($new_instance['show_featured_only']) && $new_instance['show_featured_only'] ? 1 : 0; |
|
200 | - $instance['show_special_only'] = isset($new_instance['show_special_only']) && $new_instance['show_special_only'] ? 1 : 0; |
|
201 | - $instance['with_pics_only'] = isset($new_instance['with_pics_only']) && $new_instance['with_pics_only'] ? 1 : 0; |
|
202 | - $instance['with_videos_only'] = isset($new_instance['with_videos_only']) && $new_instance['with_videos_only'] ? 1 : 0; |
|
203 | - $instance['use_viewing_post_type'] = isset($new_instance['use_viewing_post_type']) && $new_instance['use_viewing_post_type'] ? 1 : 0; |
|
204 | - $instance['hide_if_empty'] = !empty($new_instance['hide_if_empty']) ? 1 : 0; |
|
205 | - |
|
206 | - return $instance; |
|
207 | - } |
|
174 | + { |
|
175 | + //save the widget |
|
176 | + $instance = $old_instance; |
|
177 | + |
|
178 | + if ($new_instance['title'] == '') { |
|
179 | + $title = geodir_ucwords(strip_tags($new_instance['category_title'])); |
|
180 | + //$instance['title'] = $title; |
|
181 | + } |
|
182 | + $instance['title'] = strip_tags($new_instance['title']); |
|
183 | + |
|
184 | + $instance['post_type'] = strip_tags($new_instance['post_type']); |
|
185 | + //$instance['category'] = strip_tags($new_instance['category']); |
|
186 | + $instance['category'] = isset($new_instance['category']) ? $new_instance['category'] : ''; |
|
187 | + $instance['category_title'] = strip_tags($new_instance['category_title']); |
|
188 | + $instance['post_number'] = strip_tags($new_instance['post_number']); |
|
189 | + $instance['layout'] = strip_tags($new_instance['layout']); |
|
190 | + $instance['listing_width'] = strip_tags($new_instance['listing_width']); |
|
191 | + $instance['list_sort'] = strip_tags($new_instance['list_sort']); |
|
192 | + $instance['title_tag'] = strip_tags($new_instance['title_tag']); |
|
193 | + $instance['character_count'] = $new_instance['character_count']; |
|
194 | + if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') |
|
195 | + $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
196 | + else |
|
197 | + $instance['add_location_filter'] = '0'; |
|
198 | + |
|
199 | + $instance['show_featured_only'] = isset($new_instance['show_featured_only']) && $new_instance['show_featured_only'] ? 1 : 0; |
|
200 | + $instance['show_special_only'] = isset($new_instance['show_special_only']) && $new_instance['show_special_only'] ? 1 : 0; |
|
201 | + $instance['with_pics_only'] = isset($new_instance['with_pics_only']) && $new_instance['with_pics_only'] ? 1 : 0; |
|
202 | + $instance['with_videos_only'] = isset($new_instance['with_videos_only']) && $new_instance['with_videos_only'] ? 1 : 0; |
|
203 | + $instance['use_viewing_post_type'] = isset($new_instance['use_viewing_post_type']) && $new_instance['use_viewing_post_type'] ? 1 : 0; |
|
204 | + $instance['hide_if_empty'] = !empty($new_instance['hide_if_empty']) ? 1 : 0; |
|
205 | + |
|
206 | + return $instance; |
|
207 | + } |
|
208 | 208 | |
209 | 209 | /** |
210 | 210 | * Back-end popular posts widget settings form. |
211 | 211 | * |
212 | 212 | * @since 1.0.0 |
213 | - * @since 1.5.1 Declare function public. |
|
213 | + * @since 1.5.1 Declare function public. |
|
214 | 214 | * |
215 | 215 | * @param array $instance Previously saved values from database. |
216 | 216 | */ |
217 | 217 | public function form($instance) |
218 | - { |
|
219 | - //widgetform in backend |
|
220 | - $instance = wp_parse_args((array)$instance, |
|
221 | - array('title' => '', |
|
222 | - 'post_type' => '', |
|
223 | - 'category' => array(), |
|
224 | - 'category_title' => '', |
|
225 | - 'list_sort' => '', |
|
226 | - 'title_tag' => 'h3', |
|
227 | - 'list_order' => '', |
|
228 | - 'post_number' => '5', |
|
229 | - 'layout' => 'gridview_onehalf', |
|
230 | - 'listing_width' => '', |
|
231 | - 'add_location_filter' => '1', |
|
232 | - 'character_count' => '20', |
|
233 | - 'show_featured_only' => '', |
|
234 | - 'show_special_only' => '', |
|
235 | - 'with_pics_only' => '', |
|
236 | - 'with_videos_only' => '', |
|
237 | - 'use_viewing_post_type' => '', |
|
238 | - 'hide_if_empty' => '' |
|
239 | - ) |
|
240 | - ); |
|
218 | + { |
|
219 | + //widgetform in backend |
|
220 | + $instance = wp_parse_args((array)$instance, |
|
221 | + array('title' => '', |
|
222 | + 'post_type' => '', |
|
223 | + 'category' => array(), |
|
224 | + 'category_title' => '', |
|
225 | + 'list_sort' => '', |
|
226 | + 'title_tag' => 'h3', |
|
227 | + 'list_order' => '', |
|
228 | + 'post_number' => '5', |
|
229 | + 'layout' => 'gridview_onehalf', |
|
230 | + 'listing_width' => '', |
|
231 | + 'add_location_filter' => '1', |
|
232 | + 'character_count' => '20', |
|
233 | + 'show_featured_only' => '', |
|
234 | + 'show_special_only' => '', |
|
235 | + 'with_pics_only' => '', |
|
236 | + 'with_videos_only' => '', |
|
237 | + 'use_viewing_post_type' => '', |
|
238 | + 'hide_if_empty' => '' |
|
239 | + ) |
|
240 | + ); |
|
241 | 241 | |
242 | - $title = strip_tags($instance['title']); |
|
242 | + $title = strip_tags($instance['title']); |
|
243 | 243 | |
244 | - $post_type = strip_tags($instance['post_type']); |
|
244 | + $post_type = strip_tags($instance['post_type']); |
|
245 | 245 | |
246 | - $category = $instance['category']; |
|
246 | + $category = $instance['category']; |
|
247 | 247 | |
248 | - $category_title = strip_tags($instance['category_title']); |
|
248 | + $category_title = strip_tags($instance['category_title']); |
|
249 | 249 | |
250 | - $list_sort = strip_tags($instance['list_sort']); |
|
250 | + $list_sort = strip_tags($instance['list_sort']); |
|
251 | 251 | |
252 | - $list_order = strip_tags($instance['list_order']); |
|
252 | + $list_order = strip_tags($instance['list_order']); |
|
253 | 253 | |
254 | - $title_tag = strip_tags($instance['title_tag']); |
|
254 | + $title_tag = strip_tags($instance['title_tag']); |
|
255 | 255 | |
256 | - $post_number = strip_tags($instance['post_number']); |
|
256 | + $post_number = strip_tags($instance['post_number']); |
|
257 | 257 | |
258 | - $layout = strip_tags($instance['layout']); |
|
258 | + $layout = strip_tags($instance['layout']); |
|
259 | 259 | |
260 | - $listing_width = strip_tags($instance['listing_width']); |
|
260 | + $listing_width = strip_tags($instance['listing_width']); |
|
261 | 261 | |
262 | - $add_location_filter = strip_tags($instance['add_location_filter']); |
|
262 | + $add_location_filter = strip_tags($instance['add_location_filter']); |
|
263 | 263 | |
264 | - $character_count = $instance['character_count']; |
|
264 | + $character_count = $instance['character_count']; |
|
265 | 265 | |
266 | - $show_featured_only = isset($instance['show_featured_only']) && $instance['show_featured_only'] ? true : false; |
|
267 | - $show_special_only = isset($instance['show_special_only']) && $instance['show_special_only'] ? true : false; |
|
268 | - $with_pics_only = isset($instance['with_pics_only']) && $instance['with_pics_only'] ? true : false; |
|
269 | - $with_videos_only = isset($instance['with_videos_only']) && $instance['with_videos_only'] ? true : false; |
|
270 | - $use_viewing_post_type = isset($instance['use_viewing_post_type']) && $instance['use_viewing_post_type'] ? true : false; |
|
271 | - $hide_if_empty = !empty($instance['hide_if_empty']) ? true : false; |
|
266 | + $show_featured_only = isset($instance['show_featured_only']) && $instance['show_featured_only'] ? true : false; |
|
267 | + $show_special_only = isset($instance['show_special_only']) && $instance['show_special_only'] ? true : false; |
|
268 | + $with_pics_only = isset($instance['with_pics_only']) && $instance['with_pics_only'] ? true : false; |
|
269 | + $with_videos_only = isset($instance['with_videos_only']) && $instance['with_videos_only'] ? true : false; |
|
270 | + $use_viewing_post_type = isset($instance['use_viewing_post_type']) && $instance['use_viewing_post_type'] ? true : false; |
|
271 | + $hide_if_empty = !empty($instance['hide_if_empty']) ? true : false; |
|
272 | 272 | |
273 | - ?> |
|
273 | + ?> |
|
274 | 274 | <p> |
275 | 275 | <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?> |
276 | 276 | <small>(%posttype_singular_label% , |
@@ -304,9 +304,9 @@ discard block |
||
304 | 304 | <?php foreach ($postypes as $postypes_obj) { ?> |
305 | 305 | |
306 | 306 | <option <?php if ($post_type == $postypes_obj) { |
307 | - echo 'selected="selected"'; |
|
308 | - } ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj); |
|
309 | - echo geodir_utf8_ucfirst($extvalue[1]); ?></option> |
|
307 | + echo 'selected="selected"'; |
|
308 | + } ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj); |
|
309 | + echo geodir_utf8_ucfirst($extvalue[1]); ?></option> |
|
310 | 310 | |
311 | 311 | <?php } ?> |
312 | 312 | |
@@ -321,30 +321,30 @@ discard block |
||
321 | 321 | |
322 | 322 | <?php |
323 | 323 | |
324 | - $post_type = ($post_type != '') ? $post_type : 'gd_place'; |
|
324 | + $post_type = ($post_type != '') ? $post_type : 'gd_place'; |
|
325 | 325 | |
326 | - $all_postypes = geodir_get_posttypes(); |
|
326 | + $all_postypes = geodir_get_posttypes(); |
|
327 | 327 | |
328 | - if (!in_array($post_type, $all_postypes)) |
|
329 | - $post_type = 'gd_place'; |
|
328 | + if (!in_array($post_type, $all_postypes)) |
|
329 | + $post_type = 'gd_place'; |
|
330 | 330 | |
331 | - $category_taxonomy = geodir_get_taxonomies($post_type); |
|
332 | - $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC')); |
|
331 | + $category_taxonomy = geodir_get_taxonomies($post_type); |
|
332 | + $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC')); |
|
333 | 333 | |
334 | - ?> |
|
334 | + ?> |
|
335 | 335 | |
336 | 336 | <select multiple="multiple" class="widefat" name="<?php echo $this->get_field_name('category'); ?>[]" |
337 | 337 | onchange="geodir_popular_widget_cat_title(this)"> |
338 | 338 | |
339 | 339 | <option <?php if (!is_array($category) || (is_array($category) && in_array('0', $category))) { |
340 | - echo 'selected="selected"'; |
|
341 | - } ?> value="0"><?php _e('All', 'geodirectory'); ?></option> |
|
340 | + echo 'selected="selected"'; |
|
341 | + } ?> value="0"><?php _e('All', 'geodirectory'); ?></option> |
|
342 | 342 | <?php foreach ($categories as $category_obj) { |
343 | - $selected = ''; |
|
344 | - if (is_array($category) && in_array($category_obj->term_id, $category)) |
|
345 | - echo $selected = 'selected="selected"'; |
|
343 | + $selected = ''; |
|
344 | + if (is_array($category) && in_array($category_obj->term_id, $category)) |
|
345 | + echo $selected = 'selected="selected"'; |
|
346 | 346 | |
347 | - ?> |
|
347 | + ?> |
|
348 | 348 | |
349 | 349 | <option <?php echo $selected; ?> |
350 | 350 | value="<?php echo $category_obj->term_id; ?>"><?php echo geodir_utf8_ucfirst($category_obj->name); ?></option> |
@@ -365,32 +365,32 @@ discard block |
||
365 | 365 | <label for="<?php echo $this->get_field_id('list_sort'); ?>"><?php _e('Sort by:', 'geodirectory');?> |
366 | 366 | |
367 | 367 | <?php |
368 | - $list_sort_arr = array( |
|
369 | - "az" => __('A-Z', 'geodirectory'), |
|
370 | - "latest" => __('Latest', 'geodirectory'), |
|
371 | - "featured" => __('Featured', 'geodirectory'), |
|
372 | - "high_review" => __('Review', 'geodirectory'), |
|
373 | - "high_rating" => __('Rating', 'geodirectory'), |
|
374 | - "random" => __('Random', 'geodirectory'), |
|
375 | - ); |
|
376 | - |
|
377 | - /** |
|
378 | - * Filter the Popular post view widget sorting options. |
|
379 | - * |
|
380 | - * @since 1.6.22 |
|
381 | - * @param array $list_sort_arr The array of key value pairs of settings. |
|
382 | - * @param array $instance The array of widget settings. |
|
383 | - */ |
|
384 | - $list_sort_arr = apply_filters('geodir_popular_post_view_list_sort',$list_sort_arr,$instance); |
|
385 | - ?> |
|
368 | + $list_sort_arr = array( |
|
369 | + "az" => __('A-Z', 'geodirectory'), |
|
370 | + "latest" => __('Latest', 'geodirectory'), |
|
371 | + "featured" => __('Featured', 'geodirectory'), |
|
372 | + "high_review" => __('Review', 'geodirectory'), |
|
373 | + "high_rating" => __('Rating', 'geodirectory'), |
|
374 | + "random" => __('Random', 'geodirectory'), |
|
375 | + ); |
|
376 | + |
|
377 | + /** |
|
378 | + * Filter the Popular post view widget sorting options. |
|
379 | + * |
|
380 | + * @since 1.6.22 |
|
381 | + * @param array $list_sort_arr The array of key value pairs of settings. |
|
382 | + * @param array $instance The array of widget settings. |
|
383 | + */ |
|
384 | + $list_sort_arr = apply_filters('geodir_popular_post_view_list_sort',$list_sort_arr,$instance); |
|
385 | + ?> |
|
386 | 386 | |
387 | 387 | <select class="widefat" id="<?php echo $this->get_field_id('list_sort'); ?>" |
388 | 388 | name="<?php echo $this->get_field_name('list_sort'); ?>"> |
389 | 389 | <?php |
390 | - foreach($list_sort_arr as $sort_val => $sort_title){ |
|
391 | - echo "<option value='$sort_val' ".selected($list_sort,$sort_val)." >$sort_title</option>"; |
|
392 | - } |
|
393 | - ?> |
|
390 | + foreach($list_sort_arr as $sort_val => $sort_title){ |
|
391 | + echo "<option value='$sort_val' ".selected($list_sort,$sort_val)." >$sort_title</option>"; |
|
392 | + } |
|
393 | + ?> |
|
394 | 394 | </select> |
395 | 395 | </label> |
396 | 396 | </p> |
@@ -399,28 +399,28 @@ discard block |
||
399 | 399 | <label for="<?php echo $this->get_field_id('title_tag'); ?>"><?php _e('Title tag:', 'geodirectory');?> |
400 | 400 | |
401 | 401 | <?php |
402 | - $title_tag_arr = array( |
|
403 | - "h3" => __('h3 (default)', 'geodirectory'), |
|
404 | - "h2" => __('h2 (if main content of page)', 'geodirectory'), |
|
405 | - ); |
|
406 | - |
|
407 | - /** |
|
408 | - * Filter the Popular post view widget title tag. |
|
409 | - * |
|
410 | - * @since 1.6.26 |
|
411 | - * @param array $title_tag_arr The array of key value pairs of settings. |
|
412 | - * @param array $instance The array of widget settings. |
|
413 | - */ |
|
414 | - $title_tag_arr = apply_filters('geodir_popular_post_view_title_tag',$title_tag_arr,$instance); |
|
415 | - ?> |
|
402 | + $title_tag_arr = array( |
|
403 | + "h3" => __('h3 (default)', 'geodirectory'), |
|
404 | + "h2" => __('h2 (if main content of page)', 'geodirectory'), |
|
405 | + ); |
|
406 | + |
|
407 | + /** |
|
408 | + * Filter the Popular post view widget title tag. |
|
409 | + * |
|
410 | + * @since 1.6.26 |
|
411 | + * @param array $title_tag_arr The array of key value pairs of settings. |
|
412 | + * @param array $instance The array of widget settings. |
|
413 | + */ |
|
414 | + $title_tag_arr = apply_filters('geodir_popular_post_view_title_tag',$title_tag_arr,$instance); |
|
415 | + ?> |
|
416 | 416 | |
417 | 417 | <select class="widefat" id="<?php echo $this->get_field_id('title_tag'); ?>" |
418 | 418 | name="<?php echo $this->get_field_name('title_tag'); ?>"> |
419 | 419 | <?php |
420 | - foreach($title_tag_arr as $title_val => $title_title){ |
|
421 | - echo "<option value='$title_val' ".selected($title_tag,$title_val)." >$title_title</option>"; |
|
422 | - } |
|
423 | - ?> |
|
420 | + foreach($title_tag_arr as $title_val => $title_title){ |
|
421 | + echo "<option value='$title_val' ".selected($title_tag,$title_val)." >$title_title</option>"; |
|
422 | + } |
|
423 | + ?> |
|
424 | 424 | </select> |
425 | 425 | </label> |
426 | 426 | </p> |
@@ -442,24 +442,24 @@ discard block |
||
442 | 442 | <select class="widefat" id="<?php echo $this->get_field_id('layout'); ?>" |
443 | 443 | name="<?php echo $this->get_field_name('layout'); ?>"> |
444 | 444 | <option <?php if ($layout == 'gridview_onehalf') { |
445 | - echo 'selected="selected"'; |
|
446 | - } ?> |
|
445 | + echo 'selected="selected"'; |
|
446 | + } ?> |
|
447 | 447 | value="gridview_onehalf"><?php _e('Grid View (Two Columns)', 'geodirectory'); ?></option> |
448 | 448 | <option <?php if ($layout == 'gridview_onethird') { |
449 | - echo 'selected="selected"'; |
|
450 | - } ?> |
|
449 | + echo 'selected="selected"'; |
|
450 | + } ?> |
|
451 | 451 | value="gridview_onethird"><?php _e('Grid View (Three Columns)', 'geodirectory'); ?></option> |
452 | 452 | <option <?php if ($layout == 'gridview_onefourth') { |
453 | - echo 'selected="selected"'; |
|
454 | - } ?> |
|
453 | + echo 'selected="selected"'; |
|
454 | + } ?> |
|
455 | 455 | value="gridview_onefourth"><?php _e('Grid View (Four Columns)', 'geodirectory'); ?></option> |
456 | 456 | <option <?php if ($layout == 'gridview_onefifth') { |
457 | - echo 'selected="selected"'; |
|
458 | - } ?> |
|
457 | + echo 'selected="selected"'; |
|
458 | + } ?> |
|
459 | 459 | value="gridview_onefifth"><?php _e('Grid View (Five Columns)', 'geodirectory'); ?></option> |
460 | 460 | <option <?php if ($layout == 'list') { |
461 | - echo 'selected="selected"'; |
|
462 | - } ?> value="list"><?php _e('List view', 'geodirectory'); ?></option> |
|
461 | + echo 'selected="selected"'; |
|
462 | + } ?> value="list"><?php _e('List view', 'geodirectory'); ?></option> |
|
463 | 463 | |
464 | 464 | </select> |
465 | 465 | </label> |
@@ -529,8 +529,8 @@ discard block |
||
529 | 529 | for="<?php echo $this->get_field_id('use_viewing_post_type'); ?>"><?php _e('Use current viewing post type:', 'geodirectory'); ?> |
530 | 530 | <input type="checkbox" id="<?php echo $this->get_field_id('use_viewing_post_type'); ?>" |
531 | 531 | name="<?php echo $this->get_field_name('use_viewing_post_type'); ?>" <?php if ($use_viewing_post_type) { |
532 | - echo 'checked="checked"'; |
|
533 | - } ?> value="1"/> |
|
532 | + echo 'checked="checked"'; |
|
533 | + } ?> value="1"/> |
|
534 | 534 | </label> |
535 | 535 | </p> |
536 | 536 | <p> |
@@ -578,7 +578,7 @@ discard block |
||
578 | 578 | </script> |
579 | 579 | |
580 | 580 | <?php |
581 | - } |
|
581 | + } |
|
582 | 582 | } // class geodir_popular_postview |
583 | 583 | |
584 | 584 | register_widget('geodir_popular_postview'); |
585 | 585 | \ No newline at end of file |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | //save the widget |
62 | 62 | $instance = $old_instance; |
63 | 63 | $instance['title'] = strip_tags($new_instance['title']); |
64 | - $category_limit = (int)$new_instance['category_limit']; |
|
64 | + $category_limit = (int) $new_instance['category_limit']; |
|
65 | 65 | $instance['category_limit'] = $category_limit > 0 ? $category_limit : 15; |
66 | 66 | $instance['default_post_type'] = isset($new_instance['default_post_type']) ? $new_instance['default_post_type'] : ''; |
67 | 67 | $instance['parent_only'] = !empty($new_instance['parent_only']) ? true : false; |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | public function form($instance) |
82 | 82 | { |
83 | 83 | //widgetform in backend |
84 | - $instance = wp_parse_args((array)$instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => '', 'parent_only' => false)); |
|
84 | + $instance = wp_parse_args((array) $instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => '', 'parent_only' => false)); |
|
85 | 85 | |
86 | 86 | $title = strip_tags($instance['title']); |
87 | - $category_limit = (int)$instance['category_limit']; |
|
87 | + $category_limit = (int) $instance['category_limit']; |
|
88 | 88 | $category_limit = $category_limit > 0 ? $category_limit : 15; |
89 | 89 | $default_post_type = isset($instance['default_post_type']) ? $instance['default_post_type'] : ''; |
90 | 90 | $parent_only = !empty($instance['parent_only']) ? true: false; |
@@ -97,23 +97,23 @@ discard block |
||
97 | 97 | </label> |
98 | 98 | </p> |
99 | 99 | <p> |
100 | - <label for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Default post type to use (if not set by page)', 'geodirectory');?> |
|
100 | + <label for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Default post type to use (if not set by page)', 'geodirectory'); ?> |
|
101 | 101 | <select class="widefat" id="<?php echo $this->get_field_id('default_post_type'); ?>" name="<?php echo $this->get_field_name('default_post_type'); ?>"> |
102 | 102 | <?php foreach ($post_type_options as $name => $title) { ?> |
103 | - <option value="<?php echo $name;?>" <?php selected($name, $default_post_type);?>><?php echo $title; ?></option> |
|
103 | + <option value="<?php echo $name; ?>" <?php selected($name, $default_post_type); ?>><?php echo $title; ?></option> |
|
104 | 104 | <?php } ?> |
105 | 105 | </select> |
106 | 106 | </label> |
107 | 107 | </p> |
108 | 108 | <p> |
109 | 109 | <label for="<?php echo $this->get_field_id('category_limit'); ?>"><?php _e('Customize categories count to appear by default:', 'geodirectory'); ?> |
110 | - <input class="widefat" id="<?php echo $this->get_field_id('category_limit'); ?>" name="<?php echo $this->get_field_name('category_limit'); ?>" type="text" value="<?php echo (int)esc_attr($category_limit); ?>"/> |
|
110 | + <input class="widefat" id="<?php echo $this->get_field_id('category_limit'); ?>" name="<?php echo $this->get_field_name('category_limit'); ?>" type="text" value="<?php echo (int) esc_attr($category_limit); ?>"/> |
|
111 | 111 | <p class="description" style="padding:0"><?php _e('After categories count reaches this limit option More Categories / Less Categoris will be displayed to show/hide categories. Default: 15', 'geodirectory'); ?></p> |
112 | 112 | </label> |
113 | 113 | </p> |
114 | 114 | <p> |
115 | - <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('parent_only'); ?>" name="<?php echo $this->get_field_name('parent_only'); ?>"<?php checked( $parent_only ); ?> value="1" /> |
|
116 | - <label for="<?php echo $this->get_field_id('parent_only'); ?>"><?php _e( 'Show parent categories only', 'geodirectory' ); ?></label> |
|
115 | + <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('parent_only'); ?>" name="<?php echo $this->get_field_name('parent_only'); ?>"<?php checked($parent_only); ?> value="1" /> |
|
116 | + <label for="<?php echo $this->get_field_id('parent_only'); ?>"><?php _e('Show parent categories only', 'geodirectory'); ?></label> |
|
117 | 117 | </p> |
118 | 118 | <?php |
119 | 119 | } |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | public function form($instance) |
218 | 218 | { |
219 | 219 | //widgetform in backend |
220 | - $instance = wp_parse_args((array)$instance, |
|
220 | + $instance = wp_parse_args((array) $instance, |
|
221 | 221 | array('title' => '', |
222 | 222 | 'post_type' => '', |
223 | 223 | 'category' => array(), |
@@ -272,9 +272,9 @@ discard block |
||
272 | 272 | |
273 | 273 | ?> |
274 | 274 | <p> |
275 | - <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?> |
|
275 | + <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory'); ?> |
|
276 | 276 | <small>(%posttype_singular_label% , |
277 | - %posttype_plural_label% <?php _e('can be used', 'geodirectory');?>) |
|
277 | + %posttype_plural_label% <?php _e('can be used', 'geodirectory'); ?>) |
|
278 | 278 | </small> |
279 | 279 | |
280 | 280 | <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | |
286 | 286 | <p> |
287 | 287 | <label |
288 | - for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory');?> |
|
288 | + for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory'); ?> |
|
289 | 289 | |
290 | 290 | <?php $postypes = geodir_get_posttypes(); |
291 | 291 | /** |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | |
318 | 318 | <p id="post_type_cats"> |
319 | 319 | <label |
320 | - for="<?php echo $this->get_field_id('category'); ?>"><?php _e('Post Category:', 'geodirectory');?> |
|
320 | + for="<?php echo $this->get_field_id('category'); ?>"><?php _e('Post Category:', 'geodirectory'); ?> |
|
321 | 321 | |
322 | 322 | <?php |
323 | 323 | |
@@ -356,13 +356,13 @@ discard block |
||
356 | 356 | |
357 | 357 | <input type="hidden" name="<?php echo $this->get_field_name('category_title'); ?>" |
358 | 358 | id="<?php echo $this->get_field_id('category_title'); ?>" |
359 | - value="<?php if ($category_title != '') echo $category_title; else echo __('All', 'geodirectory');?>"/> |
|
359 | + value="<?php if ($category_title != '') echo $category_title; else echo __('All', 'geodirectory'); ?>"/> |
|
360 | 360 | |
361 | 361 | </label> |
362 | 362 | </p> |
363 | 363 | |
364 | 364 | <p> |
365 | - <label for="<?php echo $this->get_field_id('list_sort'); ?>"><?php _e('Sort by:', 'geodirectory');?> |
|
365 | + <label for="<?php echo $this->get_field_id('list_sort'); ?>"><?php _e('Sort by:', 'geodirectory'); ?> |
|
366 | 366 | |
367 | 367 | <?php |
368 | 368 | $list_sort_arr = array( |
@@ -381,14 +381,14 @@ discard block |
||
381 | 381 | * @param array $list_sort_arr The array of key value pairs of settings. |
382 | 382 | * @param array $instance The array of widget settings. |
383 | 383 | */ |
384 | - $list_sort_arr = apply_filters('geodir_popular_post_view_list_sort',$list_sort_arr,$instance); |
|
384 | + $list_sort_arr = apply_filters('geodir_popular_post_view_list_sort', $list_sort_arr, $instance); |
|
385 | 385 | ?> |
386 | 386 | |
387 | 387 | <select class="widefat" id="<?php echo $this->get_field_id('list_sort'); ?>" |
388 | 388 | name="<?php echo $this->get_field_name('list_sort'); ?>"> |
389 | 389 | <?php |
390 | - foreach($list_sort_arr as $sort_val => $sort_title){ |
|
391 | - echo "<option value='$sort_val' ".selected($list_sort,$sort_val)." >$sort_title</option>"; |
|
390 | + foreach ($list_sort_arr as $sort_val => $sort_title) { |
|
391 | + echo "<option value='$sort_val' ".selected($list_sort, $sort_val)." >$sort_title</option>"; |
|
392 | 392 | } |
393 | 393 | ?> |
394 | 394 | </select> |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | </p> |
397 | 397 | |
398 | 398 | <p> |
399 | - <label for="<?php echo $this->get_field_id('title_tag'); ?>"><?php _e('Title tag:', 'geodirectory');?> |
|
399 | + <label for="<?php echo $this->get_field_id('title_tag'); ?>"><?php _e('Title tag:', 'geodirectory'); ?> |
|
400 | 400 | |
401 | 401 | <?php |
402 | 402 | $title_tag_arr = array( |
@@ -411,14 +411,14 @@ discard block |
||
411 | 411 | * @param array $title_tag_arr The array of key value pairs of settings. |
412 | 412 | * @param array $instance The array of widget settings. |
413 | 413 | */ |
414 | - $title_tag_arr = apply_filters('geodir_popular_post_view_title_tag',$title_tag_arr,$instance); |
|
414 | + $title_tag_arr = apply_filters('geodir_popular_post_view_title_tag', $title_tag_arr, $instance); |
|
415 | 415 | ?> |
416 | 416 | |
417 | 417 | <select class="widefat" id="<?php echo $this->get_field_id('title_tag'); ?>" |
418 | 418 | name="<?php echo $this->get_field_name('title_tag'); ?>"> |
419 | 419 | <?php |
420 | - foreach($title_tag_arr as $title_val => $title_title){ |
|
421 | - echo "<option value='$title_val' ".selected($title_tag,$title_val)." >$title_title</option>"; |
|
420 | + foreach ($title_tag_arr as $title_val => $title_title) { |
|
421 | + echo "<option value='$title_val' ".selected($title_tag, $title_val)." >$title_title</option>"; |
|
422 | 422 | } |
423 | 423 | ?> |
424 | 424 | </select> |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | <p> |
429 | 429 | |
430 | 430 | <label |
431 | - for="<?php echo $this->get_field_id('post_number'); ?>"><?php _e('Number of posts:', 'geodirectory');?> |
|
431 | + for="<?php echo $this->get_field_id('post_number'); ?>"><?php _e('Number of posts:', 'geodirectory'); ?> |
|
432 | 432 | |
433 | 433 | <input class="widefat" id="<?php echo $this->get_field_id('post_number'); ?>" |
434 | 434 | name="<?php echo $this->get_field_name('post_number'); ?>" type="text" |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | |
439 | 439 | <p> |
440 | 440 | <label for="<?php echo $this->get_field_id('layout'); ?>"> |
441 | - <?php _e('Layout:', 'geodirectory');?> |
|
441 | + <?php _e('Layout:', 'geodirectory'); ?> |
|
442 | 442 | <select class="widefat" id="<?php echo $this->get_field_id('layout'); ?>" |
443 | 443 | name="<?php echo $this->get_field_name('layout'); ?>"> |
444 | 444 | <option <?php if ($layout == 'gridview_onehalf') { |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | |
468 | 468 | <p> |
469 | 469 | <label |
470 | - for="<?php echo $this->get_field_id('listing_width'); ?>"><?php _e('Listing width:', 'geodirectory');?> |
|
470 | + for="<?php echo $this->get_field_id('listing_width'); ?>"><?php _e('Listing width:', 'geodirectory'); ?> |
|
471 | 471 | |
472 | 472 | <input class="widefat" id="<?php echo $this->get_field_id('listing_width'); ?>" |
473 | 473 | name="<?php echo $this->get_field_name('listing_width'); ?>" type="text" |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | |
478 | 478 | <p> |
479 | 479 | <label |
480 | - for="<?php echo $this->get_field_id('character_count'); ?>"><?php _e('Post Content excerpt character count :', 'geodirectory');?> |
|
480 | + for="<?php echo $this->get_field_id('character_count'); ?>"><?php _e('Post Content excerpt character count :', 'geodirectory'); ?> |
|
481 | 481 | <input class="widefat" id="<?php echo $this->get_field_id('character_count'); ?>" |
482 | 482 | name="<?php echo $this->get_field_name('character_count'); ?>" type="text" |
483 | 483 | value="<?php echo esc_attr($character_count); ?>"/> |
@@ -486,41 +486,41 @@ discard block |
||
486 | 486 | |
487 | 487 | <p> |
488 | 488 | <label for="<?php echo $this->get_field_id('add_location_filter'); ?>"> |
489 | - <?php _e('Enable Location Filter:', 'geodirectory');?> |
|
489 | + <?php _e('Enable Location Filter:', 'geodirectory'); ?> |
|
490 | 490 | <input type="checkbox" id="<?php echo $this->get_field_id('add_location_filter'); ?>" |
491 | - name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"';?> |
|
491 | + name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"'; ?> |
|
492 | 492 | value="1"/> |
493 | 493 | </label> |
494 | 494 | </p> |
495 | 495 | <p> |
496 | 496 | <label for="<?php echo $this->get_field_id('show_featured_only'); ?>"> |
497 | - <?php _e('Show only featured listings:', 'geodirectory');?> <input type="checkbox" |
|
497 | + <?php _e('Show only featured listings:', 'geodirectory'); ?> <input type="checkbox" |
|
498 | 498 | id="<?php echo $this->get_field_id('show_featured_only'); ?>" |
499 | - name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) echo 'checked="checked"';?> |
|
499 | + name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) echo 'checked="checked"'; ?> |
|
500 | 500 | value="1"/> |
501 | 501 | </label> |
502 | 502 | </p> |
503 | 503 | <p> |
504 | 504 | <label for="<?php echo $this->get_field_id('show_special_only'); ?>"> |
505 | - <?php _e('Show only listings with special offers:', 'geodirectory');?> <input type="checkbox" |
|
505 | + <?php _e('Show only listings with special offers:', 'geodirectory'); ?> <input type="checkbox" |
|
506 | 506 | id="<?php echo $this->get_field_id('show_special_only'); ?>" |
507 | - name="<?php echo $this->get_field_name('show_special_only'); ?>" <?php if ($show_special_only) echo 'checked="checked"';?> |
|
507 | + name="<?php echo $this->get_field_name('show_special_only'); ?>" <?php if ($show_special_only) echo 'checked="checked"'; ?> |
|
508 | 508 | value="1"/> |
509 | 509 | </label> |
510 | 510 | </p> |
511 | 511 | <p> |
512 | 512 | <label for="<?php echo $this->get_field_id('with_pics_only'); ?>"> |
513 | - <?php _e('Show only listings with pics:', 'geodirectory');?> <input type="checkbox" |
|
513 | + <?php _e('Show only listings with pics:', 'geodirectory'); ?> <input type="checkbox" |
|
514 | 514 | id="<?php echo $this->get_field_id('with_pics_only'); ?>" |
515 | - name="<?php echo $this->get_field_name('with_pics_only'); ?>" <?php if ($with_pics_only) echo 'checked="checked"';?> |
|
515 | + name="<?php echo $this->get_field_name('with_pics_only'); ?>" <?php if ($with_pics_only) echo 'checked="checked"'; ?> |
|
516 | 516 | value="1"/> |
517 | 517 | </label> |
518 | 518 | </p> |
519 | 519 | <p> |
520 | 520 | <label for="<?php echo $this->get_field_id('with_videos_only'); ?>"> |
521 | - <?php _e('Show only listings with videos:', 'geodirectory');?> <input type="checkbox" |
|
521 | + <?php _e('Show only listings with videos:', 'geodirectory'); ?> <input type="checkbox" |
|
522 | 522 | id="<?php echo $this->get_field_id('with_videos_only'); ?>" |
523 | - name="<?php echo $this->get_field_name('with_videos_only'); ?>" <?php if ($with_videos_only) echo 'checked="checked"';?> |
|
523 | + name="<?php echo $this->get_field_name('with_videos_only'); ?>" <?php if ($with_videos_only) echo 'checked="checked"'; ?> |
|
524 | 524 | value="1"/> |
525 | 525 | </label> |
526 | 526 | </p> |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | |
571 | 571 | } |
572 | 572 | |
573 | - <?php if(is_active_widget( false, false, $this->id_base, true )){ ?> |
|
573 | + <?php if (is_active_widget(false, false, $this->id_base, true)) { ?> |
|
574 | 574 | var post_type = jQuery('#<?php echo $this->get_field_id('post_type'); ?>').val(); |
575 | 575 | |
576 | 576 | <?php } ?> |
@@ -191,10 +191,11 @@ discard block |
||
191 | 191 | $instance['list_sort'] = strip_tags($new_instance['list_sort']); |
192 | 192 | $instance['title_tag'] = strip_tags($new_instance['title_tag']); |
193 | 193 | $instance['character_count'] = $new_instance['character_count']; |
194 | - if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') |
|
195 | - $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
196 | - else |
|
197 | - $instance['add_location_filter'] = '0'; |
|
194 | + if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') { |
|
195 | + $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
196 | + } else { |
|
197 | + $instance['add_location_filter'] = '0'; |
|
198 | + } |
|
198 | 199 | |
199 | 200 | $instance['show_featured_only'] = isset($new_instance['show_featured_only']) && $new_instance['show_featured_only'] ? 1 : 0; |
200 | 201 | $instance['show_special_only'] = isset($new_instance['show_special_only']) && $new_instance['show_special_only'] ? 1 : 0; |
@@ -325,8 +326,9 @@ discard block |
||
325 | 326 | |
326 | 327 | $all_postypes = geodir_get_posttypes(); |
327 | 328 | |
328 | - if (!in_array($post_type, $all_postypes)) |
|
329 | - $post_type = 'gd_place'; |
|
329 | + if (!in_array($post_type, $all_postypes)) { |
|
330 | + $post_type = 'gd_place'; |
|
331 | + } |
|
330 | 332 | |
331 | 333 | $category_taxonomy = geodir_get_taxonomies($post_type); |
332 | 334 | $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC')); |
@@ -341,8 +343,9 @@ discard block |
||
341 | 343 | } ?> value="0"><?php _e('All', 'geodirectory'); ?></option> |
342 | 344 | <?php foreach ($categories as $category_obj) { |
343 | 345 | $selected = ''; |
344 | - if (is_array($category) && in_array($category_obj->term_id, $category)) |
|
345 | - echo $selected = 'selected="selected"'; |
|
346 | + if (is_array($category) && in_array($category_obj->term_id, $category)) { |
|
347 | + echo $selected = 'selected="selected"'; |
|
348 | + } |
|
346 | 349 | |
347 | 350 | ?> |
348 | 351 | |
@@ -356,7 +359,12 @@ discard block |
||
356 | 359 | |
357 | 360 | <input type="hidden" name="<?php echo $this->get_field_name('category_title'); ?>" |
358 | 361 | id="<?php echo $this->get_field_id('category_title'); ?>" |
359 | - value="<?php if ($category_title != '') echo $category_title; else echo __('All', 'geodirectory');?>"/> |
|
362 | + value="<?php if ($category_title != '') { |
|
363 | + echo $category_title; |
|
364 | +} else { |
|
365 | + echo __('All', 'geodirectory'); |
|
366 | +} |
|
367 | +?>"/> |
|
360 | 368 | |
361 | 369 | </label> |
362 | 370 | </p> |
@@ -488,7 +496,10 @@ discard block |
||
488 | 496 | <label for="<?php echo $this->get_field_id('add_location_filter'); ?>"> |
489 | 497 | <?php _e('Enable Location Filter:', 'geodirectory');?> |
490 | 498 | <input type="checkbox" id="<?php echo $this->get_field_id('add_location_filter'); ?>" |
491 | - name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"';?> |
|
499 | + name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) { |
|
500 | + echo 'checked="checked"'; |
|
501 | +} |
|
502 | +?> |
|
492 | 503 | value="1"/> |
493 | 504 | </label> |
494 | 505 | </p> |
@@ -496,7 +507,10 @@ discard block |
||
496 | 507 | <label for="<?php echo $this->get_field_id('show_featured_only'); ?>"> |
497 | 508 | <?php _e('Show only featured listings:', 'geodirectory');?> <input type="checkbox" |
498 | 509 | id="<?php echo $this->get_field_id('show_featured_only'); ?>" |
499 | - name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) echo 'checked="checked"';?> |
|
510 | + name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) { |
|
511 | + echo 'checked="checked"'; |
|
512 | +} |
|
513 | +?> |
|
500 | 514 | value="1"/> |
501 | 515 | </label> |
502 | 516 | </p> |
@@ -504,7 +518,10 @@ discard block |
||
504 | 518 | <label for="<?php echo $this->get_field_id('show_special_only'); ?>"> |
505 | 519 | <?php _e('Show only listings with special offers:', 'geodirectory');?> <input type="checkbox" |
506 | 520 | id="<?php echo $this->get_field_id('show_special_only'); ?>" |
507 | - name="<?php echo $this->get_field_name('show_special_only'); ?>" <?php if ($show_special_only) echo 'checked="checked"';?> |
|
521 | + name="<?php echo $this->get_field_name('show_special_only'); ?>" <?php if ($show_special_only) { |
|
522 | + echo 'checked="checked"'; |
|
523 | +} |
|
524 | +?> |
|
508 | 525 | value="1"/> |
509 | 526 | </label> |
510 | 527 | </p> |
@@ -512,7 +529,10 @@ discard block |
||
512 | 529 | <label for="<?php echo $this->get_field_id('with_pics_only'); ?>"> |
513 | 530 | <?php _e('Show only listings with pics:', 'geodirectory');?> <input type="checkbox" |
514 | 531 | id="<?php echo $this->get_field_id('with_pics_only'); ?>" |
515 | - name="<?php echo $this->get_field_name('with_pics_only'); ?>" <?php if ($with_pics_only) echo 'checked="checked"';?> |
|
532 | + name="<?php echo $this->get_field_name('with_pics_only'); ?>" <?php if ($with_pics_only) { |
|
533 | + echo 'checked="checked"'; |
|
534 | +} |
|
535 | +?> |
|
516 | 536 | value="1"/> |
517 | 537 | </label> |
518 | 538 | </p> |
@@ -520,7 +540,10 @@ discard block |
||
520 | 540 | <label for="<?php echo $this->get_field_id('with_videos_only'); ?>"> |
521 | 541 | <?php _e('Show only listings with videos:', 'geodirectory');?> <input type="checkbox" |
522 | 542 | id="<?php echo $this->get_field_id('with_videos_only'); ?>" |
523 | - name="<?php echo $this->get_field_name('with_videos_only'); ?>" <?php if ($with_videos_only) echo 'checked="checked"';?> |
|
543 | + name="<?php echo $this->get_field_name('with_videos_only'); ?>" <?php if ($with_videos_only) { |
|
544 | + echo 'checked="checked"'; |
|
545 | +} |
|
546 | +?> |
|
524 | 547 | value="1"/> |
525 | 548 | </label> |
526 | 549 | </p> |