@@ -60,16 +60,16 @@ discard block |
||
60 | 60 | * @since 1.0.0 |
61 | 61 | * @param string $menu_class The menu HTML class. |
62 | 62 | */ |
63 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class); |
|
63 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item '.$menu_class); |
|
64 | 64 | /** |
65 | 65 | * Filter the menu a class. |
66 | 66 | * |
67 | 67 | * @since 1.0.0 |
68 | 68 | */ |
69 | 69 | $a_class = apply_filters('geodir_menu_a_class', ''); |
70 | - $items .= '<li class="' . $li_class . '"> |
|
71 | - <a href="' . get_post_type_archive_link($post_type) . '" class="' . $a_class . '"> |
|
72 | - ' . __(ucfirst($args->labels->name),'geodirectory') . ' |
|
70 | + $items .= '<li class="'.$li_class.'"> |
|
71 | + <a href="' . get_post_type_archive_link($post_type).'" class="'.$a_class.'"> |
|
72 | + ' . __(ucfirst($args->labels->name), 'geodirectory').' |
|
73 | 73 | </a> |
74 | 74 | </li>'; |
75 | 75 | } |
@@ -88,14 +88,14 @@ discard block |
||
88 | 88 | * @since 1.0.0 |
89 | 89 | * @param string $menu_class The menu HTML class. |
90 | 90 | */ |
91 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings ' . $menu_class); |
|
91 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings '.$menu_class); |
|
92 | 92 | /** |
93 | 93 | * Filter the sub menu li class. |
94 | 94 | * |
95 | 95 | * @since 1.0.0 |
96 | 96 | * @param string $menu_class The menu HTML class. |
97 | 97 | */ |
98 | - $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class); |
|
98 | + $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item '.$menu_class); |
|
99 | 99 | /** |
100 | 100 | * Filter the sub menu ul class. |
101 | 101 | * |
@@ -114,9 +114,9 @@ discard block |
||
114 | 114 | * @since 1.0.0 |
115 | 115 | */ |
116 | 116 | $sub_a_class = apply_filters('geodir_sub_menu_a_class', ''); |
117 | - $items .= '<li class="' . $li_class . '"> |
|
118 | - <a href="#" class="' . $a_class . '">' . __('Listing', 'geodirectory') . '</a> |
|
119 | - <ul class="' . $sub_ul_class . '">'; |
|
117 | + $items .= '<li class="'.$li_class.'"> |
|
118 | + <a href="#" class="' . $a_class.'">'.__('Listing', 'geodirectory').'</a> |
|
119 | + <ul class="' . $sub_ul_class.'">'; |
|
120 | 120 | $post_types = geodir_get_posttypes('object'); |
121 | 121 | |
122 | 122 | $show_listing_post_types = get_option('geodir_add_posttype_in_listing_nav'); |
@@ -133,9 +133,9 @@ discard block |
||
133 | 133 | if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) |
134 | 134 | $menu_class = 'current-menu-item'; |
135 | 135 | |
136 | - $items .= '<li class="' . $sub_li_class . '"> |
|
137 | - <a href="' . get_post_type_archive_link($post_type) . '" class="' . $sub_a_class . '"> |
|
138 | - ' . __(ucfirst($args->labels->name),'geodirectory') . ' |
|
136 | + $items .= '<li class="'.$sub_li_class.'"> |
|
137 | + <a href="' . get_post_type_archive_link($post_type).'" class="'.$sub_a_class.'"> |
|
138 | + ' . __(ucfirst($args->labels->name), 'geodirectory').' |
|
139 | 139 | </a> |
140 | 140 | </li>'; |
141 | 141 | } |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * |
152 | 152 | * @since 1.5.9 |
153 | 153 | */ |
154 | - $items .= apply_filters('geodir_menu_after_sub_ul',''); |
|
154 | + $items .= apply_filters('geodir_menu_after_sub_ul', ''); |
|
155 | 155 | $items .= '</li>'; |
156 | 156 | } |
157 | 157 | } |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | * @since 1.0.0 |
185 | 185 | * @param string $menu_class The menu HTML class. |
186 | 186 | */ |
187 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class); |
|
187 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item '.$menu_class); |
|
188 | 188 | /** |
189 | 189 | * Filter the menu a class. |
190 | 190 | * |
@@ -192,9 +192,9 @@ discard block |
||
192 | 192 | */ |
193 | 193 | $a_class = apply_filters('geodir_menu_a_class', ''); |
194 | 194 | $cpt_name = __($args->labels->singular_name, 'geodirectory'); |
195 | - $items .= '<li class="' . $li_class . '"> |
|
196 | - <a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $a_class . '"> |
|
197 | - ' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . ' |
|
195 | + $items .= '<li class="'.$li_class.'"> |
|
196 | + <a href="' . geodir_get_addlisting_link($post_type).'" class="'.$a_class.'"> |
|
197 | + ' . sprintf(__('Add %s', 'geodirectory'), $cpt_name).' |
|
198 | 198 | </a> |
199 | 199 | </li>'; |
200 | 200 | } |
@@ -218,14 +218,14 @@ discard block |
||
218 | 218 | * @since 1.0.0 |
219 | 219 | * @param string $menu_class The menu HTML class. |
220 | 220 | */ |
221 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing ' . $menu_class); |
|
221 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing '.$menu_class); |
|
222 | 222 | /** |
223 | 223 | * Filter the sub menu li class. |
224 | 224 | * |
225 | 225 | * @since 1.0.0 |
226 | 226 | * @param string $menu_class The menu HTML class. |
227 | 227 | */ |
228 | - $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class); |
|
228 | + $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item '.$menu_class); |
|
229 | 229 | /** |
230 | 230 | * Filter the sub menu ul class. |
231 | 231 | * |
@@ -244,9 +244,9 @@ discard block |
||
244 | 244 | * @since 1.0.0 |
245 | 245 | */ |
246 | 246 | $sub_a_class = apply_filters('geodir_sub_menu_a_class', ''); |
247 | - $items .= '<li class="' . $li_class . '"> |
|
248 | - <a href="#" class="' . $a_class . '">' . __('Add Listing', 'geodirectory') . '</a> |
|
249 | - <ul class="' . $sub_ul_class . '">'; |
|
247 | + $items .= '<li class="'.$li_class.'"> |
|
248 | + <a href="#" class="' . $a_class.'">'.__('Add Listing', 'geodirectory').'</a> |
|
249 | + <ul class="' . $sub_ul_class.'">'; |
|
250 | 250 | |
251 | 251 | $post_types = geodir_get_posttypes('object'); |
252 | 252 | |
@@ -269,11 +269,11 @@ discard block |
||
269 | 269 | * @since 1.0.0 |
270 | 270 | * @param string $menu_class The menu HTML class. |
271 | 271 | */ |
272 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class); |
|
272 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item '.$menu_class); |
|
273 | 273 | $cpt_name = __($args->labels->singular_name, 'geodirectory'); |
274 | - $items .= '<li class="' . $li_class . '"> |
|
275 | - <a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $sub_a_class . '"> |
|
276 | - ' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . ' |
|
274 | + $items .= '<li class="'.$li_class.'"> |
|
275 | + <a href="' . geodir_get_addlisting_link($post_type).'" class="'.$sub_a_class.'"> |
|
276 | + ' . sprintf(__('Add %s', 'geodirectory'), $cpt_name).' |
|
277 | 277 | </a> |
278 | 278 | </li>'; |
279 | 279 | } |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | } |
286 | 286 | |
287 | 287 | $items .= ' </ul> '; |
288 | - $items .= apply_filters('geodir_menu_after_sub_ul',''); |
|
288 | + $items .= apply_filters('geodir_menu_after_sub_ul', ''); |
|
289 | 289 | $items .= '</li>'; |
290 | 290 | |
291 | 291 | } |
@@ -313,14 +313,14 @@ discard block |
||
313 | 313 | $geodir_theme_location = get_option('geodir_theme_location_nav'); |
314 | 314 | $geodir_theme_location_nav = array(); |
315 | 315 | if (empty($locations) && empty($geodir_theme_location)) { |
316 | - $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu); |
|
316 | + $menu = str_replace("</ul></div>", geodir_add_nav_menu_items()."</ul></div>", $menu); |
|
317 | 317 | $geodir_theme_location_nav[] = $args['theme_location']; |
318 | 318 | update_option('geodir_theme_location_nav', $geodir_theme_location_nav); |
319 | 319 | } |
320 | 320 | //else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet. |
321 | 321 | // $menu = str_replace("</ul></div>",geodir_add_nav_menu_items()."</ul></div>",$menu); |
322 | 322 | else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location)) |
323 | - $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu); |
|
323 | + $menu = str_replace("</ul></div>", geodir_add_nav_menu_items()."</ul></div>", $menu); |
|
324 | 324 | |
325 | 325 | return $menu; |
326 | 326 | |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | |
349 | 349 | if (has_nav_menu($location) == '1' && is_array($geodir_theme_location) && in_array($location, $geodir_theme_location)) { |
350 | 350 | |
351 | - $items = $items . geodir_add_nav_menu_items(); |
|
351 | + $items = $items.geodir_add_nav_menu_items(); |
|
352 | 352 | return $items; |
353 | 353 | |
354 | 354 | } else { |
@@ -373,12 +373,12 @@ discard block |
||
373 | 373 | |
374 | 374 | $taxonomies = geodir_get_taxonomies(); |
375 | 375 | $taxonomies = implode("','", $taxonomies); |
376 | - $taxonomies = "'" . $taxonomies . "'"; |
|
376 | + $taxonomies = "'".$taxonomies."'"; |
|
377 | 377 | |
378 | 378 | $pn_categories = $wpdb->get_results( |
379 | 379 | $wpdb->prepare( |
380 | 380 | "SELECT $wpdb->terms.name as name, $wpdb->term_taxonomy.count as count, $wpdb->terms.term_id as cat_ID FROM $wpdb->term_taxonomy, $wpdb->terms WHERE $wpdb->term_taxonomy.term_id = %d AND $wpdb->term_taxonomy.taxonomy in ( $taxonomies ) ORDER BY name", |
381 | - array($wpdb->terms . term_id) |
|
381 | + array($wpdb->terms.term_id) |
|
382 | 382 | ) |
383 | 383 | ); |
384 | 384 | |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | |
408 | 408 | if (geodir_is_page('add-listing') || geodir_is_page('preview')) { |
409 | 409 | if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
410 | - $geodir_post_type = get_post_type((int)$_REQUEST['pid']); |
|
410 | + $geodir_post_type = get_post_type((int) $_REQUEST['pid']); |
|
411 | 411 | elseif (isset($_REQUEST['listing_type'])) |
412 | 412 | $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']); |
413 | 413 | } |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes)) |
426 | 426 | $geodir_post_type = ''; |
427 | 427 | |
428 | - if( defined( 'DOING_AJAX' ) && isset($_REQUEST['stype'])){ |
|
428 | + if (defined('DOING_AJAX') && isset($_REQUEST['stype'])) { |
|
429 | 429 | $geodir_post_type = sanitize_text_field($_REQUEST['stype']); |
430 | 430 | } |
431 | 431 | |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | * |
436 | 436 | * @since 1.6.9 |
437 | 437 | */ |
438 | - return apply_filters('geodir_get_current_posttype',$geodir_post_type); |
|
438 | + return apply_filters('geodir_get_current_posttype', $geodir_post_type); |
|
439 | 439 | } |
440 | 440 | |
441 | 441 | /** |
@@ -449,18 +449,18 @@ discard block |
||
449 | 449 | */ |
450 | 450 | function geodir_get_default_posttype() |
451 | 451 | { |
452 | - $post_types = apply_filters( 'geodir_get_default_posttype', geodir_get_posttypes( 'object' ) ); |
|
452 | + $post_types = apply_filters('geodir_get_default_posttype', geodir_get_posttypes('object')); |
|
453 | 453 | |
454 | 454 | $stype = false; |
455 | - foreach ( $post_types as $post_type => $info ) { |
|
455 | + foreach ($post_types as $post_type => $info) { |
|
456 | 456 | global $wpdb; |
457 | - $has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) ); |
|
458 | - if ( $has_posts ) { |
|
457 | + $has_posts = $wpdb->get_row($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type)); |
|
458 | + if ($has_posts) { |
|
459 | 459 | $stype = $post_type; break; |
460 | 460 | } |
461 | 461 | } |
462 | 462 | |
463 | - if(!$stype){ |
|
463 | + if (!$stype) { |
|
464 | 464 | $stype = 'gd_place'; |
465 | 465 | } |
466 | 466 | |
@@ -485,14 +485,14 @@ discard block |
||
485 | 485 | switch ($output): |
486 | 486 | case 'object': |
487 | 487 | case 'Object': |
488 | - $post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types; |
|
488 | + $post_types = json_decode(json_encode($post_types), FALSE); //(object)$post_types; |
|
489 | 489 | break; |
490 | 490 | case 'array': |
491 | 491 | case 'Array': |
492 | - $post_types = (array)$post_types; |
|
492 | + $post_types = (array) $post_types; |
|
493 | 493 | break; |
494 | 494 | case 'options': |
495 | - $post_types = (array)$post_types; |
|
495 | + $post_types = (array) $post_types; |
|
496 | 496 | |
497 | 497 | $options = array(); |
498 | 498 | if (!empty($post_types)) { |
@@ -610,15 +610,15 @@ discard block |
||
610 | 610 | |
611 | 611 | $categories = get_terms($taxonomies); |
612 | 612 | |
613 | - $html .= '<option value="0">' . __('All', 'geodirectory') . '</option>'; |
|
613 | + $html .= '<option value="0">'.__('All', 'geodirectory').'</option>'; |
|
614 | 614 | |
615 | 615 | foreach ($categories as $category_obj) { |
616 | 616 | $select_opt = ''; |
617 | 617 | if ($selected == $category_obj->term_id) { |
618 | 618 | $select_opt = 'selected="selected"'; |
619 | 619 | } |
620 | - $html .= '<option ' . $select_opt . ' value="' . $category_obj->term_id . '">' |
|
621 | - . ucfirst($category_obj->name) . '</option>'; |
|
620 | + $html .= '<option '.$select_opt.' value="'.$category_obj->term_id.'">' |
|
621 | + . ucfirst($category_obj->name).'</option>'; |
|
622 | 622 | } |
623 | 623 | |
624 | 624 | if ($echo) |
@@ -686,7 +686,7 @@ discard block |
||
686 | 686 | } elseif (isset($wp_query->tax_query->queries)) { |
687 | 687 | $tax_arr = $wp_query->tax_query->queries; |
688 | 688 | //if tax query has 'relation' set then it will break wp_list_pluck so we remove it |
689 | - if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);} |
|
689 | + if (isset($tax_arr['relation'])) {unset($tax_arr['relation']); } |
|
690 | 690 | $taxonomies = wp_list_pluck($tax_arr, 'taxonomy'); |
691 | 691 | } |
692 | 692 | |
@@ -740,7 +740,7 @@ discard block |
||
740 | 740 | |
741 | 741 | if ((!geodir_is_page('listing')) || (is_search() && $_REQUEST['search_taxonomy'] == '')) { |
742 | 742 | if ($cat_parent == 0) { |
743 | - $list_class = 'main_list gd-parent-cats-list gd-cats-display-' . $cat_display; |
|
743 | + $list_class = 'main_list gd-parent-cats-list gd-cats-display-'.$cat_display; |
|
744 | 744 | $main_list_class = 'class="main_list_selecter"'; |
745 | 745 | } else { |
746 | 746 | //$display = 'display:none'; |
@@ -750,7 +750,7 @@ discard block |
||
750 | 750 | |
751 | 751 | if ($cat_display == 'checkbox' || $cat_display == 'radio') { |
752 | 752 | $p = 0; |
753 | - $out = '<div class="' . $list_class . ' gd-cat-row-' . $cat_parent . '" style="margin-left:' . $p . 'px;' . $display . ';">'; |
|
753 | + $out = '<div class="'.$list_class.' gd-cat-row-'.$cat_parent.'" style="margin-left:'.$p.'px;'.$display.';">'; |
|
754 | 754 | } |
755 | 755 | |
756 | 756 | foreach ($cat_terms as $cat_term) { |
@@ -765,12 +765,12 @@ discard block |
||
765 | 765 | } |
766 | 766 | |
767 | 767 | if ($cat_display == 'radio') |
768 | - $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>'; |
|
768 | + $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category['.$cat_term->taxonomy.'][]" '.$main_list_class.' alt="'.$cat_term->taxonomy.'" title="'.ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" '.$checked.$onchange.' id="gd-cat-'.$cat_term->term_id.'" >'.$term_check.ucfirst($cat_term->name).'</span>'; |
|
769 | 769 | elseif ($cat_display == 'select' || $cat_display == 'multiselect') |
770 | - $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . ucfirst($cat_term->name) . '</option>'; |
|
770 | + $out .= '<option '.$main_list_class.' style="margin-left:'.$p.'px;" alt="'.$cat_term->taxonomy.'" title="'.ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" '.$checked.$onchange.' >'.$term_check.ucfirst($cat_term->name).'</option>'; |
|
771 | 771 | |
772 | 772 | else { |
773 | - $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>'; |
|
773 | + $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category['.$cat_term->taxonomy.'][]" '.$main_list_class.' alt="'.$cat_term->taxonomy.'" title="'.ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" '.$checked.$onchange.' id="gd-cat-'.$cat_term->term_id.'" >'.$term_check.ucfirst($cat_term->name).'</span>'; |
|
774 | 774 | } |
775 | 775 | |
776 | 776 | // Call recurson to print sub cats |
@@ -809,7 +809,7 @@ discard block |
||
809 | 809 | $cat_exclude = serialize($exclude_cats); |
810 | 810 | |
811 | 811 | if (isset($_REQUEST['backandedit'])) { |
812 | - $post = (object)$gd_session->get('listing'); |
|
812 | + $post = (object) $gd_session->get('listing'); |
|
813 | 813 | |
814 | 814 | if (!is_array($post->post_category[$cat_taxonomy])) |
815 | 815 | $post_category = $post->post_category[$cat_taxonomy]; |
@@ -841,7 +841,7 @@ discard block |
||
841 | 841 | |
842 | 842 | if (!empty($post_category)) { |
843 | 843 | $cat1 = array_filter(explode(',', $post_category)); |
844 | - $post_category = ',' . implode(',', $cat1) . ','; |
|
844 | + $post_category = ','.implode(',', $cat1).','; |
|
845 | 845 | |
846 | 846 | } |
847 | 847 | |
@@ -852,7 +852,7 @@ discard block |
||
852 | 852 | foreach ($post_category_upd as $cat) { |
853 | 853 | |
854 | 854 | if (!in_array($cat, $exclude_cats) && $cat != '') { |
855 | - $post_category_change .= ',' . $cat; |
|
855 | + $post_category_change .= ','.$cat; |
|
856 | 856 | } |
857 | 857 | } |
858 | 858 | $post_category = $post_category_change; |
@@ -864,11 +864,11 @@ discard block |
||
864 | 864 | } |
865 | 865 | } |
866 | 866 | |
867 | - echo '<input type="hidden" id="cat_limit" value="' . $cat_limit . '" name="cat_limit[' . $cat_taxonomy . ']" />'; |
|
867 | + echo '<input type="hidden" id="cat_limit" value="'.$cat_limit.'" name="cat_limit['.$cat_taxonomy.']" />'; |
|
868 | 868 | |
869 | - echo '<input type="hidden" id="post_category" value="' . $post_category . '" name="post_category[' . $cat_taxonomy . ']" />'; |
|
869 | + echo '<input type="hidden" id="post_category" value="'.$post_category.'" name="post_category['.$cat_taxonomy.']" />'; |
|
870 | 870 | |
871 | - echo '<input type="hidden" id="post_category_str" value="' . $post_category_str . '" name="post_category_str[' . $cat_taxonomy . ']" />'; |
|
871 | + echo '<input type="hidden" id="post_category_str" value="'.$post_category_str.'" name="post_category_str['.$cat_taxonomy.']" />'; |
|
872 | 872 | |
873 | 873 | |
874 | 874 | ?> |
@@ -887,14 +887,14 @@ discard block |
||
887 | 887 | |
888 | 888 | function show_subcatlist(main_cat, catObj) { |
889 | 889 | if (main_cat != '') { |
890 | - var url = '<?php echo geodir_get_ajax_url();?>'; |
|
891 | - var cat_taxonomy = '<?php echo $cat_taxonomy;?>'; |
|
892 | - var cat_exclude = '<?php echo base64_encode($cat_exclude);?>'; |
|
890 | + var url = '<?php echo geodir_get_ajax_url(); ?>'; |
|
891 | + var cat_taxonomy = '<?php echo $cat_taxonomy; ?>'; |
|
892 | + var cat_exclude = '<?php echo base64_encode($cat_exclude); ?>'; |
|
893 | 893 | var cat_limit = jQuery('#' + cat_taxonomy).find('#cat_limit').val(); |
894 | - <?php if ((int)$cat_limit > 0) { ?> |
|
894 | + <?php if ((int) $cat_limit > 0) { ?> |
|
895 | 895 | var selected = parseInt(jQuery('#' + cat_taxonomy).find('.cat_sublist > div.post_catlist_item').length); |
896 | 896 | if (cat_limit != '' && selected > 0 && selected >= cat_limit && cat_limit != 0) { |
897 | - alert("<?php echo esc_attr(wp_sprintf(__('You have reached category limit of %d categories.', 'geodirectory'), (int)$cat_limit));?>"); |
|
897 | + alert("<?php echo esc_attr(wp_sprintf(__('You have reached category limit of %d categories.', 'geodirectory'), (int) $cat_limit)); ?>"); |
|
898 | 898 | return false; |
899 | 899 | } |
900 | 900 | <?php } ?> |
@@ -933,7 +933,7 @@ discard block |
||
933 | 933 | } |
934 | 934 | |
935 | 935 | function update_listing_cat(el) { |
936 | - var cat_taxonomy = '<?php echo $cat_taxonomy;?>'; |
|
936 | + var cat_taxonomy = '<?php echo $cat_taxonomy; ?>'; |
|
937 | 937 | var cat_ids = ''; |
938 | 938 | var main_cat = ''; |
939 | 939 | var sub_cat = ''; |
@@ -1014,7 +1014,7 @@ discard block |
||
1014 | 1014 | <div class="main_cat_list" style=" <?php if (isset($style)) { |
1015 | 1015 | echo $style; |
1016 | 1016 | }?> "> |
1017 | - <?php geodir_get_catlist($cat_taxonomy, 0); // print main categories list |
|
1017 | + <?php geodir_get_catlist($cat_taxonomy, 0); // print main categories list |
|
1018 | 1018 | ?> |
1019 | 1019 | </div> |
1020 | 1020 | <?php |
@@ -1041,9 +1041,9 @@ discard block |
||
1041 | 1041 | if ($exclude != '') { |
1042 | 1042 | $exclude_cats = maybe_unserialize(base64_decode($exclude)); |
1043 | 1043 | |
1044 | - if(is_array( $exclude_cats)){ |
|
1045 | - $exclude_cats = array_map( 'intval', $exclude_cats ); |
|
1046 | - }else{ |
|
1044 | + if (is_array($exclude_cats)) { |
|
1045 | + $exclude_cats = array_map('intval', $exclude_cats); |
|
1046 | + } else { |
|
1047 | 1047 | $exclude_cats = intval($exclude_cats); |
1048 | 1048 | } |
1049 | 1049 | |
@@ -1057,25 +1057,25 @@ discard block |
||
1057 | 1057 | <?php $main_cat = get_term($parrent, $request_taxonomy); ?> |
1058 | 1058 | |
1059 | 1059 | <div class="post_catlist_item" style="border:1px solid #CCCCCC; margin:5px auto; padding:5px;"> |
1060 | - <img alt="move icon" src="<?php echo geodir_plugin_url() . '/geodirectory-assets/images/move.png';?>" |
|
1060 | + <img alt="move icon" src="<?php echo geodir_plugin_url().'/geodirectory-assets/images/move.png'; ?>" |
|
1061 | 1061 | onclick="jQuery(this).closest('div').remove();update_listing_cat(this);" align="right"/> |
1062 | 1062 | <?php /* ?> |
1063 | 1063 | <img src="<?php echo geodir_plugin_url().'/geodirectory-assets/images/move.png';?>" onclick="jQuery(this).closest('div').remove();show_subcatlist();" align="right" /> |
1064 | 1064 | <?php */ ?> |
1065 | 1065 | |
1066 | - <input type="checkbox" value="<?php echo $main_cat->term_id;?>" class="listing_main_cat" |
|
1066 | + <input type="checkbox" value="<?php echo $main_cat->term_id; ?>" class="listing_main_cat" |
|
1067 | 1067 | onchange="if(jQuery(this).is(':checked')){jQuery(this).closest('div').find('.post_default_category').prop('checked',false).show();}else{jQuery(this).closest('div').find('.post_default_category').prop('checked',false).hide();};update_listing_cat()" |
1068 | 1068 | checked="checked" disabled="disabled"/> |
1069 | 1069 | <span> |
1070 | - <?php printf(__('Add listing in %s category', 'geodirectory'), geodir_ucwords($main_cat->name));?> |
|
1070 | + <?php printf(__('Add listing in %s category', 'geodirectory'), geodir_ucwords($main_cat->name)); ?> |
|
1071 | 1071 | </span> |
1072 | 1072 | <br/> |
1073 | 1073 | |
1074 | 1074 | <div class="post_default_category"> |
1075 | - <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id;?>" |
|
1076 | - onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" ';?> /> |
|
1075 | + <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id; ?>" |
|
1076 | + onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" '; ?> /> |
|
1077 | 1077 | <span> |
1078 | - <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name));?> |
|
1078 | + <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name)); ?> |
|
1079 | 1079 | </span> |
1080 | 1080 | </div> |
1081 | 1081 | |
@@ -1108,7 +1108,7 @@ discard block |
||
1108 | 1108 | $post_cat_str = $post_categories[$request_taxonomy]; |
1109 | 1109 | $post_cat_array = explode("#", $post_cat_str); |
1110 | 1110 | if (is_array($post_cat_array)) { |
1111 | - $post_cat_array = array_unique( $post_cat_array ); |
|
1111 | + $post_cat_array = array_unique($post_cat_array); |
|
1112 | 1112 | |
1113 | 1113 | foreach ($post_cat_array as $post_cat_html) { |
1114 | 1114 | |
@@ -1123,7 +1123,7 @@ discard block |
||
1123 | 1123 | } |
1124 | 1124 | $post_sub_catid = ''; |
1125 | 1125 | if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) { |
1126 | - $post_sub_catid = (int)$post_cat_info[1]; |
|
1126 | + $post_sub_catid = (int) $post_cat_info[1]; |
|
1127 | 1127 | } |
1128 | 1128 | |
1129 | 1129 | geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default); |
@@ -1144,7 +1144,7 @@ discard block |
||
1144 | 1144 | } |
1145 | 1145 | |
1146 | 1146 | if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) { |
1147 | - $post_sub_catid = (int)$post_cat_info[1]; |
|
1147 | + $post_sub_catid = (int) $post_cat_info[1]; |
|
1148 | 1148 | } |
1149 | 1149 | |
1150 | 1150 | geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default); |
@@ -1176,9 +1176,9 @@ discard block |
||
1176 | 1176 | if (!$selected) |
1177 | 1177 | $option_slected = ' selected="selected" '; |
1178 | 1178 | |
1179 | - echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >'; |
|
1179 | + echo '<select field_type="select" id="'.sanitize_text_field($cat_taxonomy).'" class="chosen_select" '.$onchange.' option-ajaxChosen="false" >'; |
|
1180 | 1180 | |
1181 | - echo '<option value="" ' . $option_selected . ' >' . __('Select Category', 'geodirectory') . '</option>'; |
|
1181 | + echo '<option value="" '.$option_selected.' >'.__('Select Category', 'geodirectory').'</option>'; |
|
1182 | 1182 | |
1183 | 1183 | foreach ($cat_terms as $cat_term) { |
1184 | 1184 | $option_selected = ''; |
@@ -1186,10 +1186,10 @@ discard block |
||
1186 | 1186 | $option_selected = ' selected="selected" '; |
1187 | 1187 | |
1188 | 1188 | // Count child terms |
1189 | - $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) ); |
|
1190 | - $has_child = !empty( $child_terms ) ? 't' : 'f'; |
|
1189 | + $child_terms = get_terms($cat_taxonomy, array('parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1)); |
|
1190 | + $has_child = !empty($child_terms) ? 't' : 'f'; |
|
1191 | 1191 | |
1192 | - echo '<option ' . $option_selected . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" _hc="' . $has_child . '" >' . ucfirst($cat_term->name) . '</option>'; |
|
1192 | + echo '<option '.$option_selected.' alt="'.$cat_term->taxonomy.'" title="'.ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" _hc="'.$has_child.'" >'.ucfirst($cat_term->name).'</option>'; |
|
1193 | 1193 | } |
1194 | 1194 | echo '</select>'; |
1195 | 1195 | } |
@@ -1220,7 +1220,7 @@ discard block |
||
1220 | 1220 | 2 => __('Custom field updated.', 'geodirectory'), |
1221 | 1221 | 3 => __('Custom field deleted.', 'geodirectory'), |
1222 | 1222 | 4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name), |
1223 | - 5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int)$_GET['revision'], false)) : false, |
|
1223 | + 5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int) $_GET['revision'], false)) : false, |
|
1224 | 1224 | 6 => sprintf(__('%s published. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name), |
1225 | 1225 | 7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name), |
1226 | 1226 | 8 => sprintf(__('%s submitted. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name), |
@@ -1246,7 +1246,7 @@ discard block |
||
1246 | 1246 | |
1247 | 1247 | global $wpdb; |
1248 | 1248 | |
1249 | - $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico'; |
|
1249 | + $menu_icon = geodir_plugin_url().'/geodirectory-assets/images/favicon.ico'; |
|
1250 | 1250 | |
1251 | 1251 | if (!$listing_slug = get_option('geodir_listing_prefix')) |
1252 | 1252 | $listing_slug = 'places'; |
@@ -1259,11 +1259,11 @@ discard block |
||
1259 | 1259 | |
1260 | 1260 | $gd_placetags = array(); |
1261 | 1261 | $gd_placetags['object_type'] = 'gd_place'; |
1262 | - $gd_placetags['listing_slug'] = $listing_slug . '/tags'; |
|
1262 | + $gd_placetags['listing_slug'] = $listing_slug.'/tags'; |
|
1263 | 1263 | $gd_placetags['args'] = array( |
1264 | 1264 | 'public' => true, |
1265 | 1265 | 'hierarchical' => false, |
1266 | - 'rewrite' => array('slug' => $listing_slug . '/tags', 'with_front' => false, 'hierarchical' => true), |
|
1266 | + 'rewrite' => array('slug' => $listing_slug.'/tags', 'with_front' => false, 'hierarchical' => true), |
|
1267 | 1267 | 'query_var' => true, |
1268 | 1268 | |
1269 | 1269 | 'labels' => array( |
@@ -1357,7 +1357,7 @@ discard block |
||
1357 | 1357 | 'menu_icon' => $menu_icon, |
1358 | 1358 | 'public' => true, |
1359 | 1359 | 'query_var' => true, |
1360 | - 'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true, 'feeds' => true), |
|
1360 | + 'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true, 'feeds' => true), |
|
1361 | 1361 | 'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/), |
1362 | 1362 | 'taxonomies' => array('gd_placecategory', 'gd_place_tags')); |
1363 | 1363 | |
@@ -1390,12 +1390,12 @@ discard block |
||
1390 | 1390 | return $_REQUEST['lang']; |
1391 | 1391 | } |
1392 | 1392 | |
1393 | - $url = str_replace(array("http://","https://"),"",$url); |
|
1393 | + $url = str_replace(array("http://", "https://"), "", $url); |
|
1394 | 1394 | |
1395 | 1395 | // site_url() seems to work better than get_bloginfo('url') here, WPML can change get_bloginfo('url') to add the lang. |
1396 | - $site_url = str_replace(array("http://","https://"),"",site_url()); |
|
1396 | + $site_url = str_replace(array("http://", "https://"), "", site_url()); |
|
1397 | 1397 | |
1398 | - $url = str_replace($site_url,"",$url); |
|
1398 | + $url = str_replace($site_url, "", $url); |
|
1399 | 1399 | |
1400 | 1400 | $segments = explode('/', trim($url, '/')); |
1401 | 1401 | |
@@ -1465,17 +1465,17 @@ discard block |
||
1465 | 1465 | $slug = $post_types[$post->post_type]['rewrite']['slug']; |
1466 | 1466 | |
1467 | 1467 | // Alter the CPT slug if WPML is set to do so |
1468 | - if(function_exists('icl_object_id')){ |
|
1469 | - if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) { |
|
1468 | + if (function_exists('icl_object_id')) { |
|
1469 | + if (gd_wpml_slug_translation_turned_on($post->post_type) && $language_code = gd_wpml_get_lang_from_url($post_link)) { |
|
1470 | 1470 | |
1471 | 1471 | $org_slug = $slug; |
1472 | - $slug = apply_filters( 'wpml_translate_single_string', |
|
1472 | + $slug = apply_filters('wpml_translate_single_string', |
|
1473 | 1473 | $slug, |
1474 | 1474 | 'WordPress', |
1475 | - 'URL slug: ' . $slug, |
|
1475 | + 'URL slug: '.$slug, |
|
1476 | 1476 | $language_code); |
1477 | 1477 | |
1478 | - if(!$slug){$slug = $org_slug;} |
|
1478 | + if (!$slug) {$slug = $org_slug; } |
|
1479 | 1479 | |
1480 | 1480 | } |
1481 | 1481 | } |
@@ -1497,11 +1497,11 @@ discard block |
||
1497 | 1497 | } |
1498 | 1498 | |
1499 | 1499 | $post_link = trailingslashit( |
1500 | - preg_replace( "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 ) |
|
1500 | + preg_replace("/".preg_quote($slug, "/")."/", $slug."/%gd_taxonomy%", $post_link, 1) |
|
1501 | 1501 | ); |
1502 | 1502 | |
1503 | 1503 | if ($fix_url) { |
1504 | - $post_link = $site_url . $post_link; |
|
1504 | + $post_link = $site_url.$post_link; |
|
1505 | 1505 | } |
1506 | 1506 | |
1507 | 1507 | if (isset($comment_post_cache[$post->ID])) { |
@@ -1520,12 +1520,12 @@ discard block |
||
1520 | 1520 | $ID = $post->ID; |
1521 | 1521 | $post2 = $wpdb->get_row( |
1522 | 1522 | $wpdb->prepare( |
1523 | - "SELECT * from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ", |
|
1523 | + "SELECT * from ".$plugin_prefix.$post->post_type."_detail WHERE post_id = %d ", |
|
1524 | 1524 | array($post->ID) |
1525 | 1525 | ) |
1526 | 1526 | ); |
1527 | 1527 | |
1528 | - $post = (object)array_merge((array)$post, (array)$post2); |
|
1528 | + $post = (object) array_merge((array) $post, (array) $post2); |
|
1529 | 1529 | |
1530 | 1530 | $comment_post_cache[$post->ID] = $post; |
1531 | 1531 | } |
@@ -1534,7 +1534,7 @@ discard block |
||
1534 | 1534 | |
1535 | 1535 | if (false !== strpos($post_link, '%gd_taxonomy%')) { |
1536 | 1536 | |
1537 | - if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) { |
|
1537 | + if (apply_filters("geodir_add_location_url_to_url", get_option('geodir_add_location_url'), $post->post_type, $post)) { |
|
1538 | 1538 | $location_request = ''; |
1539 | 1539 | |
1540 | 1540 | |
@@ -1548,7 +1548,7 @@ discard block |
||
1548 | 1548 | $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]); |
1549 | 1549 | $post->country_slug = str_replace(']', '', $post->country_slug); |
1550 | 1550 | |
1551 | - $post_location = (object)array('country_slug' => $post->country_slug, |
|
1551 | + $post_location = (object) array('country_slug' => $post->country_slug, |
|
1552 | 1552 | 'region_slug' => $post->region_slug, |
1553 | 1553 | 'city_slug' => $post->city_slug |
1554 | 1554 | ); |
@@ -1561,7 +1561,7 @@ discard block |
||
1561 | 1561 | |
1562 | 1562 | $post_location_sql = $wpdb->get_results( |
1563 | 1563 | $wpdb->prepare( |
1564 | - "SELECT post_locations from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ", |
|
1564 | + "SELECT post_locations from ".$plugin_prefix.$post->post_type."_detail WHERE post_id = %d ", |
|
1565 | 1565 | array($post->ID) |
1566 | 1566 | ) |
1567 | 1567 | ); |
@@ -1577,7 +1577,7 @@ discard block |
||
1577 | 1577 | $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]); |
1578 | 1578 | $post->country_slug = str_replace(']', '', $post->country_slug); |
1579 | 1579 | |
1580 | - $post_location = (object)array('country_slug' => $post->country_slug, |
|
1580 | + $post_location = (object) array('country_slug' => $post->country_slug, |
|
1581 | 1581 | 'region_slug' => $post->region_slug, |
1582 | 1582 | 'city_slug' => $post->city_slug |
1583 | 1583 | ); |
@@ -1606,7 +1606,7 @@ discard block |
||
1606 | 1606 | } |
1607 | 1607 | $location_slug[] = $city_slug; |
1608 | 1608 | |
1609 | - $location_request .= implode('/', $location_slug) . '/'; |
|
1609 | + $location_request .= implode('/', $location_slug).'/'; |
|
1610 | 1610 | } |
1611 | 1611 | } |
1612 | 1612 | |
@@ -1622,9 +1622,9 @@ discard block |
||
1622 | 1622 | } else { |
1623 | 1623 | $post_terms = ''; |
1624 | 1624 | |
1625 | - if(isset($_POST['post_default_category']) && $_POST['post_default_category']){ |
|
1625 | + if (isset($_POST['post_default_category']) && $_POST['post_default_category']) { |
|
1626 | 1626 | $post_terms = absint($_POST['post_default_category']); |
1627 | - }elseif(isset($_POST['post_category'][$taxonomies]) && $_POST['post_category'][$taxonomies]){ |
|
1627 | + }elseif (isset($_POST['post_category'][$taxonomies]) && $_POST['post_category'][$taxonomies]) { |
|
1628 | 1628 | $post_terms = explode(",", trim($_POST['post_category'][$taxonomies], ",")); |
1629 | 1629 | $post_terms = absint($post_terms[0]); |
1630 | 1630 | }elseif (isset($post->{$taxonomies})) { |
@@ -1670,14 +1670,14 @@ discard block |
||
1670 | 1670 | $request_term = trim($request_term, '/'); |
1671 | 1671 | |
1672 | 1672 | // Fix with WPML the location terms added twice when CPT slug is translated. |
1673 | - if ($sample && !empty($location_request) && geodir_is_wpml() && strpos($post_link, '%gd_taxonomy%/' . $request_term . $detailurl_separator) !== false) { |
|
1673 | + if ($sample && !empty($location_request) && geodir_is_wpml() && strpos($post_link, '%gd_taxonomy%/'.$request_term.$detailurl_separator) !== false) { |
|
1674 | 1674 | $post_link = str_replace('%gd_taxonomy%/', '', $post_link); |
1675 | 1675 | } |
1676 | 1676 | |
1677 | 1677 | if (!empty($request_term)) |
1678 | - $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link); |
|
1678 | + $post_link = str_replace('%gd_taxonomy%', $request_term.$detailurl_separator, $post_link); |
|
1679 | 1679 | else |
1680 | - $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link); |
|
1680 | + $post_link = str_replace('/%gd_taxonomy%', $request_term.$detailurl_separator, $post_link); |
|
1681 | 1681 | //echo $post_link ; |
1682 | 1682 | } |
1683 | 1683 | // temp cache the permalink |
@@ -1752,9 +1752,9 @@ discard block |
||
1752 | 1752 | $url_separator = ''; |
1753 | 1753 | |
1754 | 1754 | if (get_option('permalink_structure') != '') { |
1755 | - $old_listing_slug = '/' . $listing_slug . '/'; |
|
1755 | + $old_listing_slug = '/'.$listing_slug.'/'; |
|
1756 | 1756 | $request_term = implode("/", $location_terms); |
1757 | - $new_listing_slug = '/' . $listing_slug . '/' . $request_term . '/'; |
|
1757 | + $new_listing_slug = '/'.$listing_slug.'/'.$request_term.'/'; |
|
1758 | 1758 | |
1759 | 1759 | $termlink = substr_replace($termlink, $new_listing_slug, strpos($termlink, $old_listing_slug), strlen($old_listing_slug)); |
1760 | 1760 | } else { |
@@ -1774,25 +1774,25 @@ discard block |
||
1774 | 1774 | // Alter the CPT slug if WPML is set to do so |
1775 | 1775 | if (function_exists('icl_object_id')) { |
1776 | 1776 | $post_types = get_option('geodir_post_types'); |
1777 | - $post_type = str_replace("category","",$taxonomy); |
|
1778 | - $post_type = str_replace("_tags","",$post_type); |
|
1777 | + $post_type = str_replace("category", "", $taxonomy); |
|
1778 | + $post_type = str_replace("_tags", "", $post_type); |
|
1779 | 1779 | $slug = $post_types[$post_type]['rewrite']['slug']; |
1780 | 1780 | if (gd_wpml_slug_translation_turned_on($post_type)) { |
1781 | 1781 | global $sitepress; |
1782 | 1782 | $default_lang = $sitepress->get_default_language(); |
1783 | 1783 | $language_code = gd_wpml_get_lang_from_url($termlink); |
1784 | - if (!$language_code ) { |
|
1785 | - $language_code = $default_lang; |
|
1784 | + if (!$language_code) { |
|
1785 | + $language_code = $default_lang; |
|
1786 | 1786 | } |
1787 | 1787 | |
1788 | 1788 | $org_slug = $slug; |
1789 | - $slug = apply_filters('wpml_translate_single_string', $slug, 'WordPress', 'URL slug: ' . $slug, $language_code); |
|
1789 | + $slug = apply_filters('wpml_translate_single_string', $slug, 'WordPress', 'URL slug: '.$slug, $language_code); |
|
1790 | 1790 | |
1791 | 1791 | if (!$slug) { |
1792 | 1792 | $slug = $org_slug; |
1793 | 1793 | } |
1794 | 1794 | |
1795 | - $termlink = trailingslashit(preg_replace("/" . preg_quote($org_slug, "/") . "/", $slug ,$termlink, 1)); |
|
1795 | + $termlink = trailingslashit(preg_replace("/".preg_quote($org_slug, "/")."/", $slug, $termlink, 1)); |
|
1796 | 1796 | } |
1797 | 1797 | } |
1798 | 1798 | } |
@@ -1822,7 +1822,7 @@ discard block |
||
1822 | 1822 | |
1823 | 1823 | if (in_array($post_type, geodir_get_posttypes())) { |
1824 | 1824 | if (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) { |
1825 | - if(geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) { |
|
1825 | + if (geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) { |
|
1826 | 1826 | $location_terms = array( |
1827 | 1827 | 'gd_country' => $post->country_slug, |
1828 | 1828 | 'gd_region' => $post->region_slug, |
@@ -1839,7 +1839,7 @@ discard block |
||
1839 | 1839 | $location_terms = implode("/", $location_terms); |
1840 | 1840 | $location_terms = rtrim($location_terms, '/'); |
1841 | 1841 | |
1842 | - $link .= urldecode($location_terms) . '/'; |
|
1842 | + $link .= urldecode($location_terms).'/'; |
|
1843 | 1843 | } else { |
1844 | 1844 | $link = geodir_getlink($link, $location_terms); |
1845 | 1845 | } |
@@ -1927,9 +1927,9 @@ discard block |
||
1927 | 1927 | return 0; |
1928 | 1928 | $where = 't.term_id = %d'; |
1929 | 1929 | if (!empty($taxonomy)) |
1930 | - return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A); |
|
1930 | + return $wpdb->get_row($wpdb->prepare($tax_select.$where." AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A); |
|
1931 | 1931 | else |
1932 | - return $wpdb->get_var($wpdb->prepare($select . $where, $term)); |
|
1932 | + return $wpdb->get_var($wpdb->prepare($select.$where, $term)); |
|
1933 | 1933 | } |
1934 | 1934 | |
1935 | 1935 | $term = trim(wp_unslash($term)); |
@@ -1941,7 +1941,7 @@ discard block |
||
1941 | 1941 | |
1942 | 1942 | $where_fields = array($slug); |
1943 | 1943 | if (!empty($taxonomy)) { |
1944 | - $parent = (int)$parent; |
|
1944 | + $parent = (int) $parent; |
|
1945 | 1945 | if ($parent > 0) { |
1946 | 1946 | $where_fields[] = $parent; |
1947 | 1947 | $else_where_fields[] = $parent; |
@@ -2005,13 +2005,13 @@ discard block |
||
2005 | 2005 | $post_types = geodir_get_posttypes(); |
2006 | 2006 | $tax_arr = array(); |
2007 | 2007 | foreach ($post_types as $post_type) { |
2008 | - $tax_arr[] = "'" . $post_type . "category'"; |
|
2008 | + $tax_arr[] = "'".$post_type."category'"; |
|
2009 | 2009 | } |
2010 | 2010 | $tax_c = implode(',', $tax_arr); |
2011 | 2011 | $terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)"); |
2012 | 2012 | //$terms = get_terms( $taxonomy ); |
2013 | 2013 | |
2014 | - if($terms) { |
|
2014 | + if ($terms) { |
|
2015 | 2015 | foreach ($terms as $term) { |
2016 | 2016 | $post_type = str_replace("category", "", $term->taxonomy); |
2017 | 2017 | $a_terms[$post_type][] = $term; |
@@ -2019,7 +2019,7 @@ discard block |
||
2019 | 2019 | } |
2020 | 2020 | } |
2021 | 2021 | |
2022 | - if($a_terms) { |
|
2022 | + if ($a_terms) { |
|
2023 | 2023 | foreach ($a_terms as $pt => $t2) { |
2024 | 2024 | |
2025 | 2025 | foreach ($t2 as $term) { |
@@ -2044,7 +2044,7 @@ discard block |
||
2044 | 2044 | } |
2045 | 2045 | |
2046 | 2046 | if (is_ssl()) { |
2047 | - $terms_icons = str_replace("http:","https:",$terms_icons ); |
|
2047 | + $terms_icons = str_replace("http:", "https:", $terms_icons); |
|
2048 | 2048 | } |
2049 | 2049 | |
2050 | 2050 | return apply_filters('geodir_get_term_icons', $terms_icons, $term_id); |
@@ -26,11 +26,11 @@ discard block |
||
26 | 26 | |
27 | 27 | if (!isset($default_cat) || empty($default_cat)) { |
28 | 28 | $default_cat = isset($post_cat_array[0]) ? $post_cat_array[0] : ''; |
29 | - }else{ |
|
30 | - if(!is_int($default_cat)){ |
|
29 | + } else { |
|
30 | + if (!is_int($default_cat)) { |
|
31 | 31 | $category = get_term_by('name', $default_cat, $taxonomy); |
32 | - if(isset($category->term_id)){ |
|
33 | - $default_cat = $category->term_id; |
|
32 | + if (isset($category->term_id)) { |
|
33 | + $default_cat = $category->term_id; |
|
34 | 34 | } |
35 | 35 | } |
36 | 36 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | if ($default_pos === false) { |
60 | 60 | |
61 | - $change_cat_str = str_replace($default_cat . ',y:', $default_cat . ',y,d:', $change_cat_str); |
|
61 | + $change_cat_str = str_replace($default_cat.',y:', $default_cat.',y,d:', $change_cat_str); |
|
62 | 62 | |
63 | 63 | } |
64 | 64 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | |
145 | 145 | $gd_post = $post; |
146 | 146 | if (!empty($gd_post) && is_array($gd_post)) { |
147 | - $gd_post = (object)$post; |
|
147 | + $gd_post = (object) $post; |
|
148 | 148 | |
149 | 149 | // Fix WPML duplicate. |
150 | 150 | if (geodir_is_wpml() && !empty($request_info['action']) && $request_info['action'] == 'editpost' && !empty($request_info['icl_trid']) && !isset($post['post_date'])) { |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | $send_post_submit_mail = false; |
239 | 239 | |
240 | 240 | // unhook this function so it doesn't loop infinitely |
241 | - remove_action('save_post', 'geodir_post_information_save',10,2); |
|
241 | + remove_action('save_post', 'geodir_post_information_save', 10, 2); |
|
242 | 242 | |
243 | 243 | if (isset($request_info['pid']) && $request_info['pid'] != '') { |
244 | 244 | $post['ID'] = $request_info['pid']; |
@@ -262,13 +262,13 @@ discard block |
||
262 | 262 | } |
263 | 263 | |
264 | 264 | // re-hook this function |
265 | - add_action('save_post', 'geodir_post_information_save',10,2); |
|
265 | + add_action('save_post', 'geodir_post_information_save', 10, 2); |
|
266 | 266 | |
267 | 267 | $post_tags = ''; |
268 | 268 | if (!isset($request_info['post_tags'])) { |
269 | 269 | |
270 | 270 | $post_type = $request_info['listing_type']; |
271 | - $post_tags = implode(",", wp_get_object_terms($last_post_id, $post_type . '_tags', array('fields' => 'names'))); |
|
271 | + $post_tags = implode(",", wp_get_object_terms($last_post_id, $post_type.'_tags', array('fields' => 'names'))); |
|
272 | 272 | |
273 | 273 | } |
274 | 274 | |
@@ -286,13 +286,13 @@ discard block |
||
286 | 286 | $payment_info = array(); |
287 | 287 | $package_info = array(); |
288 | 288 | |
289 | - $package_info = (array)geodir_post_package_info($package_info, $post); |
|
289 | + $package_info = (array) geodir_post_package_info($package_info, $post); |
|
290 | 290 | |
291 | 291 | $post_package_id = geodir_get_post_meta($last_post_id, 'package_id'); |
292 | 292 | |
293 | 293 | if (!empty($package_info) && !$post_package_id) { |
294 | 294 | if (isset($package_info['days']) && $package_info['days'] != 0) { |
295 | - $payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['days'] . " days")); |
|
295 | + $payment_info['expire_date'] = date('Y-m-d', strtotime("+".$package_info['days']." days")); |
|
296 | 296 | } else { |
297 | 297 | $payment_info['expire_date'] = 'Never'; |
298 | 298 | } |
@@ -313,8 +313,8 @@ discard block |
||
313 | 313 | $extrafields = $val['extra_fields']; |
314 | 314 | |
315 | 315 | if (trim($type) == 'address') { |
316 | - $prefix = $name . '_'; |
|
317 | - $address = $prefix . 'address'; |
|
316 | + $prefix = $name.'_'; |
|
317 | + $address = $prefix.'address'; |
|
318 | 318 | |
319 | 319 | if (isset($request_info[$address]) && $request_info[$address] != '') { |
320 | 320 | $gd_post_info[$address] = wp_slash($request_info[$address]); |
@@ -324,59 +324,59 @@ discard block |
||
324 | 324 | $extrafields = unserialize($extrafields); |
325 | 325 | |
326 | 326 | |
327 | - if (!isset($request_info[$prefix . 'city']) || $request_info[$prefix . 'city'] == '') { |
|
327 | + if (!isset($request_info[$prefix.'city']) || $request_info[$prefix.'city'] == '') { |
|
328 | 328 | |
329 | 329 | $location_result = geodir_get_default_location(); |
330 | 330 | |
331 | - $gd_post_info[$prefix . 'city'] = $location_result->city; |
|
332 | - $gd_post_info[$prefix . 'region'] = $location_result->region; |
|
333 | - $gd_post_info[$prefix . 'country'] = $location_result->country; |
|
331 | + $gd_post_info[$prefix.'city'] = $location_result->city; |
|
332 | + $gd_post_info[$prefix.'region'] = $location_result->region; |
|
333 | + $gd_post_info[$prefix.'country'] = $location_result->country; |
|
334 | 334 | |
335 | - $gd_post_info['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // set all overall post location |
|
335 | + $gd_post_info['post_locations'] = '['.$location_result->city_slug.'],['.$location_result->region_slug.'],['.$location_result->country_slug.']'; // set all overall post location |
|
336 | 336 | |
337 | 337 | } else { |
338 | 338 | |
339 | - $gd_post_info[$prefix . 'city'] = $request_info[$prefix . 'city']; |
|
340 | - $gd_post_info[$prefix . 'region'] = $request_info[$prefix . 'region']; |
|
341 | - $gd_post_info[$prefix . 'country'] = $request_info[$prefix . 'country']; |
|
339 | + $gd_post_info[$prefix.'city'] = $request_info[$prefix.'city']; |
|
340 | + $gd_post_info[$prefix.'region'] = $request_info[$prefix.'region']; |
|
341 | + $gd_post_info[$prefix.'country'] = $request_info[$prefix.'country']; |
|
342 | 342 | |
343 | 343 | //----------set post locations when import dummy data------- |
344 | 344 | $location_result = geodir_get_default_location(); |
345 | 345 | |
346 | - $gd_post_info['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // set all overall post location |
|
346 | + $gd_post_info['post_locations'] = '['.$location_result->city_slug.'],['.$location_result->region_slug.'],['.$location_result->country_slug.']'; // set all overall post location |
|
347 | 347 | //----------------------------------------------------------------- |
348 | 348 | |
349 | 349 | } |
350 | 350 | |
351 | 351 | |
352 | - if (isset($extrafields['show_zip']) && $extrafields['show_zip'] && isset($request_info[$prefix . 'zip'])) { |
|
353 | - $gd_post_info[$prefix . 'zip'] = $request_info[$prefix . 'zip']; |
|
352 | + if (isset($extrafields['show_zip']) && $extrafields['show_zip'] && isset($request_info[$prefix.'zip'])) { |
|
353 | + $gd_post_info[$prefix.'zip'] = $request_info[$prefix.'zip']; |
|
354 | 354 | } |
355 | 355 | |
356 | 356 | |
357 | 357 | if (isset($extrafields['show_map']) && $extrafields['show_map']) { |
358 | 358 | |
359 | - if (isset($request_info[$prefix . 'latitude']) && $request_info[$prefix . 'latitude'] != '') { |
|
360 | - $gd_post_info[$prefix . 'latitude'] = $request_info[$prefix . 'latitude']; |
|
359 | + if (isset($request_info[$prefix.'latitude']) && $request_info[$prefix.'latitude'] != '') { |
|
360 | + $gd_post_info[$prefix.'latitude'] = $request_info[$prefix.'latitude']; |
|
361 | 361 | } |
362 | 362 | |
363 | - if (isset($request_info[$prefix . 'longitude']) && $request_info[$prefix . 'longitude'] != '') { |
|
364 | - $gd_post_info[$prefix . 'longitude'] = $request_info[$prefix . 'longitude']; |
|
363 | + if (isset($request_info[$prefix.'longitude']) && $request_info[$prefix.'longitude'] != '') { |
|
364 | + $gd_post_info[$prefix.'longitude'] = $request_info[$prefix.'longitude']; |
|
365 | 365 | } |
366 | 366 | |
367 | - if (isset($request_info[$prefix . 'mapview']) && $request_info[$prefix . 'mapview'] != '') { |
|
368 | - $gd_post_info[$prefix . 'mapview'] = $request_info[$prefix . 'mapview']; |
|
367 | + if (isset($request_info[$prefix.'mapview']) && $request_info[$prefix.'mapview'] != '') { |
|
368 | + $gd_post_info[$prefix.'mapview'] = $request_info[$prefix.'mapview']; |
|
369 | 369 | } |
370 | 370 | |
371 | - if (isset($request_info[$prefix . 'mapzoom']) && $request_info[$prefix . 'mapzoom'] != '') { |
|
372 | - $gd_post_info[$prefix . 'mapzoom'] = $request_info[$prefix . 'mapzoom']; |
|
371 | + if (isset($request_info[$prefix.'mapzoom']) && $request_info[$prefix.'mapzoom'] != '') { |
|
372 | + $gd_post_info[$prefix.'mapzoom'] = $request_info[$prefix.'mapzoom']; |
|
373 | 373 | } |
374 | 374 | |
375 | 375 | } |
376 | 376 | |
377 | 377 | // show lat lng |
378 | - if (isset($extrafields['show_latlng']) && $extrafields['show_latlng'] && isset($request_info[$prefix . 'latlng'])) { |
|
379 | - $gd_post_info[$prefix . 'latlng'] = $request_info[$prefix . 'latlng']; |
|
378 | + if (isset($extrafields['show_latlng']) && $extrafields['show_latlng'] && isset($request_info[$prefix.'latlng'])) { |
|
379 | + $gd_post_info[$prefix.'latlng'] = $request_info[$prefix.'latlng']; |
|
380 | 380 | } |
381 | 381 | } |
382 | 382 | |
@@ -401,16 +401,16 @@ discard block |
||
401 | 401 | |
402 | 402 | // check if we need to change the format or not |
403 | 403 | $date_format_len = strlen(str_replace(' ', '', $date_format)); |
404 | - if($date_format_len>5){// if greater then 5 then it's the old style format. |
|
404 | + if ($date_format_len > 5) {// if greater then 5 then it's the old style format. |
|
405 | 405 | |
406 | - $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format |
|
407 | - $replace = array('d','j','l','m','n','F','Y');//PHP date format |
|
406 | + $search = array('dd', 'd', 'DD', 'mm', 'm', 'MM', 'yy'); //jQuery UI datepicker format |
|
407 | + $replace = array('d', 'j', 'l', 'm', 'n', 'F', 'Y'); //PHP date format |
|
408 | 408 | |
409 | 409 | $date_format = str_replace($search, $replace, $date_format); |
410 | 410 | |
411 | 411 | $post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $request_info[$name]) : $request_info[$name]; |
412 | 412 | |
413 | - }else{ |
|
413 | + } else { |
|
414 | 414 | $post_htmlvar_value = $request_info[$name]; |
415 | 415 | } |
416 | 416 | |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | if (isset($request_info[$name])) { |
426 | 426 | $gd_post_info[$name] = $request_info[$name]; |
427 | 427 | } else { |
428 | - if (isset($request_info['gd_field_' . $name])) { |
|
428 | + if (isset($request_info['gd_field_'.$name])) { |
|
429 | 429 | $gd_post_info[$name] = ''; /* fix de-select for multiselect */ |
430 | 430 | } |
431 | 431 | } |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | } |
486 | 486 | |
487 | 487 | if (is_array($post_tags)) { |
488 | - $taxonomy = $request_info['listing_type'] . '_tags'; |
|
488 | + $taxonomy = $request_info['listing_type'].'_tags'; |
|
489 | 489 | wp_set_object_terms($last_post_id, $post_tags, $taxonomy); |
490 | 490 | } |
491 | 491 | |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | $tmpimgArr = trim($request_info['post_images'], ","); |
498 | 498 | $tmpimgArr = explode(",", $tmpimgArr); |
499 | 499 | geodir_save_post_images($last_post_id, $tmpimgArr, $dummy); |
500 | - } else{ |
|
500 | + } else { |
|
501 | 501 | geodir_save_post_images($last_post_id, $request_info['post_images'], $dummy); |
502 | 502 | } |
503 | 503 | |
@@ -578,7 +578,7 @@ discard block |
||
578 | 578 | if (!in_array($post_type, $all_postypes)) |
579 | 579 | return false; |
580 | 580 | |
581 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
581 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
582 | 582 | |
583 | 583 | /** |
584 | 584 | * Apply Filter to change Post info |
@@ -588,7 +588,7 @@ discard block |
||
588 | 588 | * @since 1.0.0 |
589 | 589 | * @package GeoDirectory |
590 | 590 | */ |
591 | - $query = apply_filters('geodir_post_info_query', $wpdb->prepare("SELECT p.*,pd.* FROM " . $wpdb->posts . " p," . $table . " pd |
|
591 | + $query = apply_filters('geodir_post_info_query', $wpdb->prepare("SELECT p.*,pd.* FROM ".$wpdb->posts." p,".$table." pd |
|
592 | 592 | WHERE p.ID = pd.post_id |
593 | 593 | AND pd.post_id = %d", $post_id)); |
594 | 594 | |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | |
652 | 652 | $post_type = get_post_type($post_id); |
653 | 653 | |
654 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
654 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
655 | 655 | |
656 | 656 | /** |
657 | 657 | * Filter to change Post info |
@@ -672,7 +672,7 @@ discard block |
||
672 | 672 | |
673 | 673 | $columns = $wpdb->get_col("show columns from $table"); |
674 | 674 | foreach ($postmeta as $mkey => $mval) { |
675 | - if(in_array($mkey,$columns)) { |
|
675 | + if (in_array($mkey, $columns)) { |
|
676 | 676 | if (is_array($mval)) { |
677 | 677 | $mval = implode(",", $mval); |
678 | 678 | } |
@@ -701,12 +701,12 @@ discard block |
||
701 | 701 | */ |
702 | 702 | do_action('geodir_before_save_listinginfo', $postinfo_array, $post_id); |
703 | 703 | |
704 | - if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) { |
|
704 | + if ($wpdb->get_var($wpdb->prepare("SELECT post_id from ".$table." where post_id = %d", array($post_id)))) { |
|
705 | 705 | |
706 | 706 | $query_string_array[] = $post_id; |
707 | 707 | $wpdb->query( |
708 | 708 | $wpdb->prepare( |
709 | - "UPDATE " . $table . " SET " . $query_string_escaped . " where post_id =%d", |
|
709 | + "UPDATE ".$table." SET ".$query_string_escaped." where post_id =%d", |
|
710 | 710 | $query_string_array |
711 | 711 | ) |
712 | 712 | ); |
@@ -717,7 +717,7 @@ discard block |
||
717 | 717 | array_unshift($query_string_array, $post_id); |
718 | 718 | $wpdb->query( |
719 | 719 | $wpdb->prepare( |
720 | - "INSERT INTO " . $table . " SET post_id = %d," . $query_string_escaped, |
|
720 | + "INSERT INTO ".$table." SET post_id = %d,".$query_string_escaped, |
|
721 | 721 | $query_string_array |
722 | 722 | ) |
723 | 723 | ); |
@@ -763,7 +763,7 @@ discard block |
||
763 | 763 | |
764 | 764 | $post_type = get_post_type($post_id); |
765 | 765 | |
766 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
766 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
767 | 767 | |
768 | 768 | if ($postmeta != '' && geodir_column_exist($table, $postmeta) && $post_id) { |
769 | 769 | |
@@ -771,11 +771,11 @@ discard block |
||
771 | 771 | $meta_value = implode(",", $meta_value); |
772 | 772 | } |
773 | 773 | |
774 | - if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) { |
|
774 | + if ($wpdb->get_var($wpdb->prepare("SELECT post_id from ".$table." where post_id = %d", array($post_id)))) { |
|
775 | 775 | |
776 | 776 | $wpdb->query( |
777 | 777 | $wpdb->prepare( |
778 | - "UPDATE " . $table . " SET " . $postmeta . " = '" . $meta_value . "' where post_id =%d", |
|
778 | + "UPDATE ".$table." SET ".$postmeta." = '".$meta_value."' where post_id =%d", |
|
779 | 779 | array($post_id) |
780 | 780 | ) |
781 | 781 | ); |
@@ -784,7 +784,7 @@ discard block |
||
784 | 784 | |
785 | 785 | $wpdb->query( |
786 | 786 | $wpdb->prepare( |
787 | - "INSERT INTO " . $table . " SET post_id = %d, " . $postmeta . " = '" . $meta_value . "'", |
|
787 | + "INSERT INTO ".$table." SET post_id = %d, ".$postmeta." = '".$meta_value."'", |
|
788 | 788 | array($post_id) |
789 | 789 | ) |
790 | 790 | ); |
@@ -817,14 +817,14 @@ discard block |
||
817 | 817 | |
818 | 818 | $post_type = get_post_type($post_id); |
819 | 819 | |
820 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
820 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
821 | 821 | |
822 | 822 | if (is_array($postmeta) && !empty($postmeta) && $post_id) { |
823 | 823 | $post_meta_set_query = ''; |
824 | 824 | |
825 | 825 | foreach ($postmeta as $mkey) { |
826 | 826 | if ($mval != '') |
827 | - $post_meta_set_query .= $mkey . " = '', "; |
|
827 | + $post_meta_set_query .= $mkey." = '', "; |
|
828 | 828 | } |
829 | 829 | |
830 | 830 | $post_meta_set_query = trim($post_meta_set_query, ", "); |
@@ -833,11 +833,11 @@ discard block |
||
833 | 833 | return false; |
834 | 834 | } |
835 | 835 | |
836 | - if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $postmeta . "'") != '') { |
|
836 | + if ($wpdb->get_var("SHOW COLUMNS FROM ".$table." WHERE field = '".$postmeta."'") != '') { |
|
837 | 837 | |
838 | 838 | $wpdb->query( |
839 | 839 | $wpdb->prepare( |
840 | - "UPDATE " . $table . " SET " . $post_meta_set_query . " where post_id = %d", |
|
840 | + "UPDATE ".$table." SET ".$post_meta_set_query." where post_id = %d", |
|
841 | 841 | array($post_id) |
842 | 842 | ) |
843 | 843 | ); |
@@ -846,11 +846,11 @@ discard block |
||
846 | 846 | } |
847 | 847 | |
848 | 848 | } elseif ($postmeta != '' && $post_id) { |
849 | - if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $postmeta . "'") != '') { |
|
849 | + if ($wpdb->get_var("SHOW COLUMNS FROM ".$table." WHERE field = '".$postmeta."'") != '') { |
|
850 | 850 | |
851 | 851 | $wpdb->query( |
852 | 852 | $wpdb->prepare( |
853 | - "UPDATE " . $table . " SET " . $postmeta . "= '' where post_id = %d", |
|
853 | + "UPDATE ".$table." SET ".$postmeta."= '' where post_id = %d", |
|
854 | 854 | array($post_id) |
855 | 855 | ) |
856 | 856 | ); |
@@ -892,10 +892,10 @@ discard block |
||
892 | 892 | if (!in_array($post_type, $all_postypes)) |
893 | 893 | return false; |
894 | 894 | |
895 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
895 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
896 | 896 | |
897 | - if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $meta_key . "'") != '') { |
|
898 | - $meta_value = $wpdb->get_var($wpdb->prepare("SELECT " . $meta_key . " from " . $table . " where post_id = %d", array($post_id))); |
|
897 | + if ($wpdb->get_var("SHOW COLUMNS FROM ".$table." WHERE field = '".$meta_key."'") != '') { |
|
898 | + $meta_value = $wpdb->get_var($wpdb->prepare("SELECT ".$meta_key." from ".$table." where post_id = %d", array($post_id))); |
|
899 | 899 | if ($meta_value && $meta_value !== '') { |
900 | 900 | return maybe_serialize($meta_value); |
901 | 901 | } else |
@@ -928,13 +928,13 @@ discard block |
||
928 | 928 | |
929 | 929 | $post_type = get_post_type($post_id); |
930 | 930 | |
931 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
931 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
932 | 932 | |
933 | 933 | $post_images = geodir_get_images($post_id); |
934 | 934 | |
935 | 935 | $wpdb->query( |
936 | 936 | $wpdb->prepare( |
937 | - "UPDATE " . $table . " SET featured_image = '' where post_id =%d", |
|
937 | + "UPDATE ".$table." SET featured_image = '' where post_id =%d", |
|
938 | 938 | array($post_id) |
939 | 939 | ) |
940 | 940 | ); |
@@ -964,12 +964,12 @@ discard block |
||
964 | 964 | $file_path = ''; |
965 | 965 | /* --------- start ------- */ |
966 | 966 | |
967 | - $split_img_path = explode(str_replace(array('http://','https://'),'',$uploads['baseurl']), str_replace(array('http://','https://'),'',$post_image[$m])); |
|
967 | + $split_img_path = explode(str_replace(array('http://', 'https://'), '', $uploads['baseurl']), str_replace(array('http://', 'https://'), '', $post_image[$m])); |
|
968 | 968 | |
969 | 969 | $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : ''; |
970 | 970 | |
971 | 971 | |
972 | - if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT ID FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE file=%s AND post_id = %d", array($split_img_file_path, $post_id)))) { |
|
972 | + if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT ID FROM ".GEODIR_ATTACHMENT_TABLE." WHERE file=%s AND post_id = %d", array($split_img_file_path, $post_id)))) { |
|
973 | 973 | |
974 | 974 | /* --------- end ------- */ |
975 | 975 | $curr_img_url = $post_image[$m]; |
@@ -1013,7 +1013,7 @@ discard block |
||
1013 | 1013 | // If the uploaded file is the right format |
1014 | 1014 | if (in_array($uploaded_file_type, $allowed_file_types)) { |
1015 | 1015 | if (!function_exists('wp_handle_upload')) { |
1016 | - require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
1016 | + require_once(ABSPATH.'wp-admin/includes/file.php'); |
|
1017 | 1017 | } |
1018 | 1018 | |
1019 | 1019 | if (!is_dir($geodir_uploadpath)) { |
@@ -1021,41 +1021,41 @@ discard block |
||
1021 | 1021 | } |
1022 | 1022 | |
1023 | 1023 | $external_img = false; |
1024 | - if (strpos( str_replace( array('http://','https://'),'',$curr_img_url ), str_replace(array('http://','https://'),'',$uploads['baseurl'] ) ) !== false) { |
|
1024 | + if (strpos(str_replace(array('http://', 'https://'), '', $curr_img_url), str_replace(array('http://', 'https://'), '', $uploads['baseurl'])) !== false) { |
|
1025 | 1025 | } else { |
1026 | 1026 | $external_img = true; |
1027 | 1027 | } |
1028 | 1028 | |
1029 | 1029 | if ($dummy || $external_img) { |
1030 | 1030 | $uploaded_file = array(); |
1031 | - $uploaded = (array)fetch_remote_file($curr_img_url); |
|
1031 | + $uploaded = (array) fetch_remote_file($curr_img_url); |
|
1032 | 1032 | |
1033 | 1033 | if (isset($uploaded['error']) && empty($uploaded['error'])) { |
1034 | 1034 | $new_name = basename($uploaded['file']); |
1035 | 1035 | $uploaded_file = $uploaded; |
1036 | - }else{ |
|
1037 | - print_r($uploaded);exit; |
|
1036 | + } else { |
|
1037 | + print_r($uploaded); exit; |
|
1038 | 1038 | } |
1039 | 1039 | $external_img = false; |
1040 | 1040 | } else { |
1041 | - $new_name = $post_id . '_' . $file_name; |
|
1041 | + $new_name = $post_id.'_'.$file_name; |
|
1042 | 1042 | |
1043 | 1043 | if ($curr_img_dir == $sub_dir) { |
1044 | - $img_path = $geodir_uploadpath . '/' . $filename; |
|
1045 | - $img_url = $geodir_uploadurl . '/' . $filename; |
|
1044 | + $img_path = $geodir_uploadpath.'/'.$filename; |
|
1045 | + $img_url = $geodir_uploadurl.'/'.$filename; |
|
1046 | 1046 | } else { |
1047 | - $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
1048 | - $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
1047 | + $img_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$filename; |
|
1048 | + $img_url = $uploads['url'].'/temp_'.$current_user->data->ID.'/'.$filename; |
|
1049 | 1049 | } |
1050 | 1050 | |
1051 | 1051 | $uploaded_file = ''; |
1052 | 1052 | |
1053 | 1053 | if (file_exists($img_path)) { |
1054 | - $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name); |
|
1054 | + $uploaded_file = copy($img_path, $geodir_uploadpath.'/'.$new_name); |
|
1055 | 1055 | $file_path = ''; |
1056 | - } else if (file_exists($uploads['basedir'] . $curr_img_dir . $filename)) { |
|
1056 | + } else if (file_exists($uploads['basedir'].$curr_img_dir.$filename)) { |
|
1057 | 1057 | $uploaded_file = true; |
1058 | - $file_path = $curr_img_dir . '/' . $filename; |
|
1058 | + $file_path = $curr_img_dir.'/'.$filename; |
|
1059 | 1059 | } |
1060 | 1060 | |
1061 | 1061 | if ($curr_img_dir != $geodir_uploaddir && file_exists($img_path)) |
@@ -1064,14 +1064,14 @@ discard block |
||
1064 | 1064 | |
1065 | 1065 | if (!empty($uploaded_file)) { |
1066 | 1066 | if (!isset($file_path) || !$file_path) { |
1067 | - $file_path = $sub_dir . '/' . $new_name; |
|
1067 | + $file_path = $sub_dir.'/'.$new_name; |
|
1068 | 1068 | } |
1069 | 1069 | |
1070 | - $postcurr_images[] = str_replace(array('http://','https://'),'',$uploads['baseurl'] . $file_path); |
|
1070 | + $postcurr_images[] = str_replace(array('http://', 'https://'), '', $uploads['baseurl'].$file_path); |
|
1071 | 1071 | |
1072 | 1072 | if ($menu_order == 1) { |
1073 | 1073 | |
1074 | - $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($file_path, $post_id))); |
|
1074 | + $wpdb->query($wpdb->prepare("UPDATE ".$table." SET featured_image = %s where post_id =%d", array($file_path, $post_id))); |
|
1075 | 1075 | |
1076 | 1076 | } |
1077 | 1077 | |
@@ -1089,12 +1089,12 @@ discard block |
||
1089 | 1089 | |
1090 | 1090 | foreach ($attachment as $key => $val) { |
1091 | 1091 | if ($val != '') |
1092 | - $attachment_set .= $key . " = '" . $val . "', "; |
|
1092 | + $attachment_set .= $key." = '".$val."', "; |
|
1093 | 1093 | } |
1094 | 1094 | |
1095 | 1095 | $attachment_set = trim($attachment_set, ", "); |
1096 | 1096 | |
1097 | - $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set); |
|
1097 | + $wpdb->query("INSERT INTO ".GEODIR_ATTACHMENT_TABLE." SET ".$attachment_set); |
|
1098 | 1098 | |
1099 | 1099 | $valid_file_ids[] = $wpdb->insert_id; |
1100 | 1100 | } |
@@ -1105,17 +1105,17 @@ discard block |
||
1105 | 1105 | } else { |
1106 | 1106 | $valid_file_ids[] = $find_image; |
1107 | 1107 | |
1108 | - $postcurr_images[] = str_replace(array('http://','https://'),'',$post_image[$m]); |
|
1108 | + $postcurr_images[] = str_replace(array('http://', 'https://'), '', $post_image[$m]); |
|
1109 | 1109 | |
1110 | 1110 | $wpdb->query( |
1111 | 1111 | $wpdb->prepare( |
1112 | - "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order = %d where file =%s AND post_id =%d", |
|
1112 | + "UPDATE ".GEODIR_ATTACHMENT_TABLE." SET menu_order = %d where file =%s AND post_id =%d", |
|
1113 | 1113 | array($menu_order, $split_img_path[1], $post_id) |
1114 | 1114 | ) |
1115 | 1115 | ); |
1116 | 1116 | |
1117 | 1117 | if ($menu_order == 1) |
1118 | - $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id))); |
|
1118 | + $wpdb->query($wpdb->prepare("UPDATE ".$table." SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id))); |
|
1119 | 1119 | |
1120 | 1120 | } |
1121 | 1121 | |
@@ -1139,9 +1139,9 @@ discard block |
||
1139 | 1139 | |
1140 | 1140 | foreach ($post_images as $img) { |
1141 | 1141 | |
1142 | - if (!in_array(str_replace(array('http://','https://'),'',$img->src), $postcurr_images)) { |
|
1142 | + if (!in_array(str_replace(array('http://', 'https://'), '', $img->src), $postcurr_images)) { |
|
1143 | 1143 | |
1144 | - $invalid_files[] = (object)array('src' => $img->src); |
|
1144 | + $invalid_files[] = (object) array('src' => $img->src); |
|
1145 | 1145 | |
1146 | 1146 | } |
1147 | 1147 | |
@@ -1149,12 +1149,12 @@ discard block |
||
1149 | 1149 | |
1150 | 1150 | } |
1151 | 1151 | |
1152 | - $invalid_files = (object)$invalid_files; |
|
1152 | + $invalid_files = (object) $invalid_files; |
|
1153 | 1153 | } |
1154 | 1154 | |
1155 | 1155 | $remove_files[] = $post_id; |
1156 | 1156 | |
1157 | - $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE " . $valid_files_condition . " post_id = %d", $remove_files)); |
|
1157 | + $wpdb->query($wpdb->prepare("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE ".$valid_files_condition." post_id = %d", $remove_files)); |
|
1158 | 1158 | |
1159 | 1159 | if (!empty($invalid_files)) |
1160 | 1160 | geodir_remove_attachments($invalid_files); |
@@ -1194,7 +1194,7 @@ discard block |
||
1194 | 1194 | rmdir($dirPath); |
1195 | 1195 | } */ |
1196 | 1196 | |
1197 | - $dirname = $uploads_dir . '/temp_' . $current_user->ID; |
|
1197 | + $dirname = $uploads_dir.'/temp_'.$current_user->ID; |
|
1198 | 1198 | geodir_delete_directory($dirname); |
1199 | 1199 | } |
1200 | 1200 | |
@@ -1216,10 +1216,10 @@ discard block |
||
1216 | 1216 | return false; |
1217 | 1217 | while ($file = readdir($dir_handle)) { |
1218 | 1218 | if ($file != "." && $file != "..") { |
1219 | - if (!is_dir($dirname . "/" . $file)) |
|
1220 | - unlink($dirname . "/" . $file); |
|
1219 | + if (!is_dir($dirname."/".$file)) |
|
1220 | + unlink($dirname."/".$file); |
|
1221 | 1221 | else |
1222 | - geodir_delete_directory($dirname . '/' . $file); |
|
1222 | + geodir_delete_directory($dirname.'/'.$file); |
|
1223 | 1223 | } |
1224 | 1224 | } |
1225 | 1225 | closedir($dir_handle); |
@@ -1248,8 +1248,8 @@ discard block |
||
1248 | 1248 | foreach ($postcurr_images as $postimg) { |
1249 | 1249 | $image_name_arr = explode('/', $postimg->src); |
1250 | 1250 | $filename = end($image_name_arr); |
1251 | - if (file_exists($uploads_dir . '/' . $filename)) |
|
1252 | - unlink($uploads_dir . '/' . $filename); |
|
1251 | + if (file_exists($uploads_dir.'/'.$filename)) |
|
1252 | + unlink($uploads_dir.'/'.$filename); |
|
1253 | 1253 | } |
1254 | 1254 | |
1255 | 1255 | } // endif |
@@ -1290,16 +1290,16 @@ discard block |
||
1290 | 1290 | } |
1291 | 1291 | |
1292 | 1292 | if (!in_array($post_type, geodir_get_posttypes())) { |
1293 | - return false;// if not a GD CPT return; |
|
1293 | + return false; // if not a GD CPT return; |
|
1294 | 1294 | } |
1295 | 1295 | |
1296 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
1296 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
1297 | 1297 | |
1298 | 1298 | if (!$file) { |
1299 | 1299 | if (isset($post->featured_image)) { |
1300 | 1300 | $file = $post->featured_image; |
1301 | 1301 | } else { |
1302 | - $file = $wpdb->get_var($wpdb->prepare("SELECT featured_image FROM " . $table . " WHERE post_id = %d", array($post_id))); |
|
1302 | + $file = $wpdb->get_var($wpdb->prepare("SELECT featured_image FROM ".$table." WHERE post_id = %d", array($post_id))); |
|
1303 | 1303 | } |
1304 | 1304 | } |
1305 | 1305 | |
@@ -1317,7 +1317,7 @@ discard block |
||
1317 | 1317 | |
1318 | 1318 | $file_name = $file_info['basename']; |
1319 | 1319 | |
1320 | - $uploads_url = $uploads_baseurl . $sub_dir; |
|
1320 | + $uploads_url = $uploads_baseurl.$sub_dir; |
|
1321 | 1321 | /* |
1322 | 1322 | * Allows the filter of image src for such things as CDN change. |
1323 | 1323 | * |
@@ -1327,8 +1327,8 @@ discard block |
||
1327 | 1327 | * @param string $uploads_url The server upload directory url. |
1328 | 1328 | * @param string $uploads_baseurl The uploads dir base url. |
1329 | 1329 | */ |
1330 | - $img_arr['src'] = apply_filters('geodir_get_featured_image_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl); |
|
1331 | - $img_arr['path'] = $uploads_path . '/' . $file_name; |
|
1330 | + $img_arr['src'] = apply_filters('geodir_get_featured_image_src', $uploads_url.'/'.$file_name, $file_name, $uploads_url, $uploads_baseurl); |
|
1331 | + $img_arr['path'] = $uploads_path.'/'.$file_name; |
|
1332 | 1332 | $width = 0; |
1333 | 1333 | $height = 0; |
1334 | 1334 | if (is_file($img_arr['path']) && file_exists($img_arr['path'])) { |
@@ -1371,7 +1371,7 @@ discard block |
||
1371 | 1371 | $file_name = $file_info['basename']; |
1372 | 1372 | |
1373 | 1373 | $img_arr['src'] = $default_img; |
1374 | - $img_arr['path'] = $uploads_path . '/' . $file_name; |
|
1374 | + $img_arr['path'] = $uploads_path.'/'.$file_name; |
|
1375 | 1375 | |
1376 | 1376 | $width = 0; |
1377 | 1377 | $height = 0; |
@@ -1388,7 +1388,7 @@ discard block |
||
1388 | 1388 | } |
1389 | 1389 | |
1390 | 1390 | if (!empty($img_arr)) |
1391 | - return (object)$img_arr;//return (object)array( 'src' => $file_url, 'path' => $file_path ); |
|
1391 | + return (object) $img_arr; //return (object)array( 'src' => $file_url, 'path' => $file_path ); |
|
1392 | 1392 | else |
1393 | 1393 | return false; |
1394 | 1394 | } |
@@ -1451,7 +1451,7 @@ discard block |
||
1451 | 1451 | |
1452 | 1452 | $arrImages = $wpdb->get_results( |
1453 | 1453 | $wpdb->prepare( |
1454 | - "SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d" . $not_featured . " ORDER BY menu_order ASC, ID DESC $limit_q ", |
|
1454 | + "SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE mime_type like %s AND post_id = %d".$not_featured." ORDER BY menu_order ASC, ID DESC $limit_q ", |
|
1455 | 1455 | array('%image%', $post_id) |
1456 | 1456 | ) |
1457 | 1457 | ); |
@@ -1477,7 +1477,7 @@ discard block |
||
1477 | 1477 | |
1478 | 1478 | $file_name = $file_info['basename']; |
1479 | 1479 | |
1480 | - $uploads_url = $uploads_baseurl . $sub_dir; |
|
1480 | + $uploads_url = $uploads_baseurl.$sub_dir; |
|
1481 | 1481 | /* |
1482 | 1482 | * Allows the filter of image src for such things as CDN change. |
1483 | 1483 | * |
@@ -1487,8 +1487,8 @@ discard block |
||
1487 | 1487 | * @param string $uploads_url The server upload directory url. |
1488 | 1488 | * @param string $uploads_baseurl The uploads dir base url. |
1489 | 1489 | */ |
1490 | - $img_arr['src'] = apply_filters('geodir_get_images_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl); |
|
1491 | - $img_arr['path'] = $uploads_path . '/' . $file_name; |
|
1490 | + $img_arr['src'] = apply_filters('geodir_get_images_src', $uploads_url.'/'.$file_name, $file_name, $uploads_url, $uploads_baseurl); |
|
1491 | + $img_arr['path'] = $uploads_path.'/'.$file_name; |
|
1492 | 1492 | $width = 0; |
1493 | 1493 | $height = 0; |
1494 | 1494 | if (is_file($img_arr['path']) && file_exists($img_arr['path'])) { |
@@ -1505,11 +1505,11 @@ discard block |
||
1505 | 1505 | $img_arr['content'] = $attechment->content; // add the description to the array |
1506 | 1506 | $img_arr['is_approved'] = isset($attechment->is_approved) ? $attechment->is_approved : ''; // used for user image moderation. For backward compatibility Default value is 1. |
1507 | 1507 | |
1508 | - $return_arr[] = (object)$img_arr; |
|
1508 | + $return_arr[] = (object) $img_arr; |
|
1509 | 1509 | |
1510 | 1510 | $counter++; |
1511 | 1511 | } |
1512 | - return (object)$return_arr; |
|
1512 | + return (object) $return_arr; |
|
1513 | 1513 | } else if ($no_images) { |
1514 | 1514 | $default_img = ''; |
1515 | 1515 | $default_cat = geodir_get_post_meta($post_id, 'default_category', true); |
@@ -1548,7 +1548,7 @@ discard block |
||
1548 | 1548 | $img_arr['title'] = $file_info['filename']; // add the title to the array |
1549 | 1549 | $img_arr['content'] = $file_info['filename']; // add the description to the array |
1550 | 1550 | |
1551 | - $return_arr[] = (object)$img_arr; |
|
1551 | + $return_arr[] = (object) $img_arr; |
|
1552 | 1552 | |
1553 | 1553 | return $return_arr; |
1554 | 1554 | } else |
@@ -1575,8 +1575,8 @@ discard block |
||
1575 | 1575 | |
1576 | 1576 | $html = ''; |
1577 | 1577 | if (!empty($request)) { |
1578 | - if (!is_object($request)){ |
|
1579 | - $request = (object)$request; |
|
1578 | + if (!is_object($request)) { |
|
1579 | + $request = (object) $request; |
|
1580 | 1580 | } |
1581 | 1581 | |
1582 | 1582 | if (isset($request->src) && !isset($request->path)) { |
@@ -1590,7 +1590,7 @@ discard block |
||
1590 | 1590 | $img_no_http = str_replace(array("http://", "https://"), "", $request->path); |
1591 | 1591 | $upload_no_http = str_replace(array("http://", "https://"), "", $upload_dir['baseurl']); |
1592 | 1592 | if (strpos($img_no_http, $upload_no_http) !== false) { |
1593 | - $request->path = str_replace( $img_no_http,$upload_dir['basedir'], $request->path); |
|
1593 | + $request->path = str_replace($img_no_http, $upload_dir['basedir'], $request->path); |
|
1594 | 1594 | } |
1595 | 1595 | |
1596 | 1596 | $width = 0; |
@@ -1605,7 +1605,7 @@ discard block |
||
1605 | 1605 | $image->width = $width; |
1606 | 1606 | $image->height = $height; |
1607 | 1607 | |
1608 | - $max_size = (object)geodir_get_imagesize($size); |
|
1608 | + $max_size = (object) geodir_get_imagesize($size); |
|
1609 | 1609 | |
1610 | 1610 | if (!is_wp_error($max_size)) { |
1611 | 1611 | if ($image->width) { |
@@ -1617,15 +1617,15 @@ discard block |
||
1617 | 1617 | $width_per = 100; |
1618 | 1618 | } |
1619 | 1619 | |
1620 | - if (is_admin() && !isset($_REQUEST['geodir_ajax'])){ |
|
1621 | - $html = '<div class="geodir_thumbnail"><img style="max-height:' . $max_size->h . 'px;" alt="place image" src="' . $image->src . '" /></div>'; |
|
1620 | + if (is_admin() && !isset($_REQUEST['geodir_ajax'])) { |
|
1621 | + $html = '<div class="geodir_thumbnail"><img style="max-height:'.$max_size->h.'px;" alt="place image" src="'.$image->src.'" /></div>'; |
|
1622 | 1622 | } else { |
1623 | - if($size=='widget-thumb' || !get_option('geodir_lazy_load',1)){ |
|
1624 | - $html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>'; |
|
1625 | - }else{ |
|
1623 | + if ($size == 'widget-thumb' || !get_option('geodir_lazy_load', 1)) { |
|
1624 | + $html = '<div class="geodir_thumbnail" style="background-image:url(\''.$image->src.'\');"></div>'; |
|
1625 | + } else { |
|
1626 | 1626 | //$html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>'; |
1627 | 1627 | //$html = '<div data-src="'.$image->src.'" class="geodir_thumbnail" ></div>'; |
1628 | - $html = '<div data-src="'.str_replace(' ','%20',$image->src).'" class="geodir_thumbnail geodir_lazy_load_thumbnail" ></div>'; |
|
1628 | + $html = '<div data-src="'.str_replace(' ', '%20', $image->src).'" class="geodir_thumbnail geodir_lazy_load_thumbnail" ></div>'; |
|
1629 | 1629 | |
1630 | 1630 | } |
1631 | 1631 | |
@@ -1661,15 +1661,15 @@ discard block |
||
1661 | 1661 | |
1662 | 1662 | $post_type = get_post_type($post_id); |
1663 | 1663 | |
1664 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
1664 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
1665 | 1665 | |
1666 | 1666 | if (in_array($post_type, geodir_get_posttypes()) && !wp_is_post_revision($post_id)) { |
1667 | 1667 | |
1668 | - if ($taxonomy == $post_type . '_tags') { |
|
1668 | + if ($taxonomy == $post_type.'_tags') { |
|
1669 | 1669 | if (isset($_POST['action']) && $_POST['action'] == 'inline-save') { |
1670 | 1670 | geodir_save_post_meta($post_id, 'post_tags', $terms); |
1671 | 1671 | } |
1672 | - } elseif ($taxonomy == $post_type . 'category') { |
|
1672 | + } elseif ($taxonomy == $post_type.'category') { |
|
1673 | 1673 | $srcharr = array('"', '\\'); |
1674 | 1674 | $replarr = array(""", ''); |
1675 | 1675 | |
@@ -1691,7 +1691,7 @@ discard block |
||
1691 | 1691 | |
1692 | 1692 | $wpdb->get_var( |
1693 | 1693 | $wpdb->prepare( |
1694 | - "DELETE from " . GEODIR_ICON_TABLE . " WHERE cat_id NOT IN ($format) AND post_id = %d ", |
|
1694 | + "DELETE from ".GEODIR_ICON_TABLE." WHERE cat_id NOT IN ($format) AND post_id = %d ", |
|
1695 | 1695 | $cat_ids_array_del |
1696 | 1696 | ) |
1697 | 1697 | ); |
@@ -1699,7 +1699,7 @@ discard block |
||
1699 | 1699 | |
1700 | 1700 | $post_term = $wpdb->get_col( |
1701 | 1701 | $wpdb->prepare( |
1702 | - "SELECT term_id FROM " . $wpdb->term_taxonomy . " WHERE term_taxonomy_id IN($format) GROUP BY term_id", |
|
1702 | + "SELECT term_id FROM ".$wpdb->term_taxonomy." WHERE term_taxonomy_id IN($format) GROUP BY term_id", |
|
1703 | 1703 | $cat_ids_array |
1704 | 1704 | ) |
1705 | 1705 | ); |
@@ -1721,16 +1721,16 @@ discard block |
||
1721 | 1721 | $lat = geodir_get_post_meta($post_id, 'post_latitude', true); |
1722 | 1722 | $lng = geodir_get_post_meta($post_id, 'post_longitude', true); |
1723 | 1723 | |
1724 | - $timing = ' - ' . date('D M j, Y', strtotime(geodir_get_post_meta($post_id, 'st_date', true))); |
|
1725 | - $timing .= ' - ' . geodir_get_post_meta($post_id, 'st_time', true); |
|
1724 | + $timing = ' - '.date('D M j, Y', strtotime(geodir_get_post_meta($post_id, 'st_date', true))); |
|
1725 | + $timing .= ' - '.geodir_get_post_meta($post_id, 'st_time', true); |
|
1726 | 1726 | |
1727 | 1727 | $json = '{'; |
1728 | - $json .= '"id":"' . $post_id . '",'; |
|
1729 | - $json .= '"lat_pos": "' . $lat . '",'; |
|
1730 | - $json .= '"long_pos": "' . $lng . '",'; |
|
1731 | - $json .= '"marker_id":"' . $post_id . '_' . $cat_id . '",'; |
|
1732 | - $json .= '"icon":"' . $term_icon . '",'; |
|
1733 | - $json .= '"group":"catgroup' . $cat_id . '"'; |
|
1728 | + $json .= '"id":"'.$post_id.'",'; |
|
1729 | + $json .= '"lat_pos": "'.$lat.'",'; |
|
1730 | + $json .= '"long_pos": "'.$lng.'",'; |
|
1731 | + $json .= '"marker_id":"'.$post_id.'_'.$cat_id.'",'; |
|
1732 | + $json .= '"icon":"'.$term_icon.'",'; |
|
1733 | + $json .= '"group":"catgroup'.$cat_id.'"'; |
|
1734 | 1734 | $json .= '}'; |
1735 | 1735 | |
1736 | 1736 | |
@@ -1738,9 +1738,9 @@ discard block |
||
1738 | 1738 | $post_marker_json = $json; |
1739 | 1739 | |
1740 | 1740 | |
1741 | - if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . GEODIR_ICON_TABLE . " WHERE post_id = %d AND cat_id = %d", array($post_id, $cat_id)))) { |
|
1741 | + if ($wpdb->get_var($wpdb->prepare("SELECT post_id from ".GEODIR_ICON_TABLE." WHERE post_id = %d AND cat_id = %d", array($post_id, $cat_id)))) { |
|
1742 | 1742 | |
1743 | - $json_query = $wpdb->prepare("UPDATE " . GEODIR_ICON_TABLE . " SET |
|
1743 | + $json_query = $wpdb->prepare("UPDATE ".GEODIR_ICON_TABLE." SET |
|
1744 | 1744 | post_title = %s, |
1745 | 1745 | json = %s |
1746 | 1746 | WHERE post_id = %d AND cat_id = %d ", |
@@ -1748,7 +1748,7 @@ discard block |
||
1748 | 1748 | |
1749 | 1749 | } else { |
1750 | 1750 | |
1751 | - $json_query = $wpdb->prepare("INSERT INTO " . GEODIR_ICON_TABLE . " SET |
|
1751 | + $json_query = $wpdb->prepare("INSERT INTO ".GEODIR_ICON_TABLE." SET |
|
1752 | 1752 | post_id = %d, |
1753 | 1753 | post_title = %s, |
1754 | 1754 | cat_id = %d, |
@@ -1766,17 +1766,17 @@ discard block |
||
1766 | 1766 | if (!empty($post_term) && is_array($post_term)) { |
1767 | 1767 | $categories = implode(',', $post_term); |
1768 | 1768 | |
1769 | - if ($categories != '' && $categories != 0) $categories = ',' . $categories . ','; |
|
1769 | + if ($categories != '' && $categories != 0) $categories = ','.$categories.','; |
|
1770 | 1770 | |
1771 | 1771 | if (empty($post_marker_json)) |
1772 | 1772 | $post_marker_json = isset($json) ? $json : ''; |
1773 | 1773 | |
1774 | - if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) { |
|
1774 | + if ($wpdb->get_var($wpdb->prepare("SELECT post_id from ".$table." where post_id = %d", array($post_id)))) { |
|
1775 | 1775 | |
1776 | 1776 | $wpdb->query( |
1777 | 1777 | $wpdb->prepare( |
1778 | - "UPDATE " . $table . " SET |
|
1779 | - " . $taxonomy . " = %s, |
|
1778 | + "UPDATE ".$table." SET |
|
1779 | + " . $taxonomy." = %s, |
|
1780 | 1780 | marker_json = %s |
1781 | 1781 | where post_id = %d", |
1782 | 1782 | array($categories, $post_marker_json, $post_id) |
@@ -1797,7 +1797,7 @@ discard block |
||
1797 | 1797 | |
1798 | 1798 | $wpdb->query( |
1799 | 1799 | $wpdb->prepare( |
1800 | - "UPDATE " . $table . " SET |
|
1800 | + "UPDATE ".$table." SET |
|
1801 | 1801 | default_category = %s |
1802 | 1802 | where post_id = %d", |
1803 | 1803 | array($categories[0], $post_id) |
@@ -1822,9 +1822,9 @@ discard block |
||
1822 | 1822 | |
1823 | 1823 | $wpdb->query( |
1824 | 1824 | $wpdb->prepare( |
1825 | - "INSERT INTO " . $table . " SET |
|
1825 | + "INSERT INTO ".$table." SET |
|
1826 | 1826 | post_id = %d, |
1827 | - " . $taxonomy . " = %s, |
|
1827 | + " . $taxonomy." = %s, |
|
1828 | 1828 | marker_json = %s ", |
1829 | 1829 | |
1830 | 1830 | array($post_id, $categories, $post_marker_json) |
@@ -1950,7 +1950,7 @@ discard block |
||
1950 | 1950 | } ?>"><img alt="bubble image" style="max-height:50px;" |
1951 | 1951 | src="<?php echo $post_images[0]; ?>"/></a></div> |
1952 | 1952 | <?php |
1953 | - }else{ |
|
1953 | + } else { |
|
1954 | 1954 | echo '<div class="geodir-bubble_image"></div>'; |
1955 | 1955 | } |
1956 | 1956 | } else { |
@@ -1958,7 +1958,7 @@ discard block |
||
1958 | 1958 | ?> |
1959 | 1959 | <div class="geodir-bubble_image"><a href="<?php echo $plink; ?>"><?php echo $image; ?></a></div> |
1960 | 1960 | <?php |
1961 | - }else{ |
|
1961 | + } else { |
|
1962 | 1962 | echo '<div class="geodir-bubble_image"></div>'; |
1963 | 1963 | } |
1964 | 1964 | } |
@@ -1988,7 +1988,7 @@ discard block |
||
1988 | 1988 | * @param object $postinfo_obj The posts info as an object. |
1989 | 1989 | * @param bool|string $post_preview True if currently in post preview page. Empty string if not. * |
1990 | 1990 | */ |
1991 | - do_action('geodir_infowindow_meta_after',$postinfo_obj,$post_preview ); |
|
1991 | + do_action('geodir_infowindow_meta_after', $postinfo_obj, $post_preview); |
|
1992 | 1992 | ?> |
1993 | 1993 | </div> |
1994 | 1994 | <?php |
@@ -1998,9 +1998,9 @@ discard block |
||
1998 | 1998 | <div class="geodir-bubble-meta-fade"></div> |
1999 | 1999 | <div class="geodir-bubble-meta-bottom"> |
2000 | 2000 | <?php if ($rating_star != '') { ?> |
2001 | - <span class="geodir-bubble-rating"><?php echo $rating_star;?></span> |
|
2001 | + <span class="geodir-bubble-rating"><?php echo $rating_star; ?></span> |
|
2002 | 2002 | <?php } ?> |
2003 | - <span class="geodir-bubble-fav"><?php echo geodir_favourite_html($post_author, $ID);?></span> |
|
2003 | + <span class="geodir-bubble-fav"><?php echo geodir_favourite_html($post_author, $ID); ?></span> |
|
2004 | 2004 | <span class="geodir-bubble-reviews"> |
2005 | 2005 | <a href="<?php echo get_comments_link($ID); ?>" class="geodir-pcomments"><i class="fa fa-comments"></i> <?php echo get_comments_number($ID); ?></a> |
2006 | 2006 | </span> |
@@ -2062,11 +2062,11 @@ discard block |
||
2062 | 2062 | |
2063 | 2063 | $post_type = get_post_type($post_id); |
2064 | 2064 | |
2065 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
2065 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
2066 | 2066 | |
2067 | 2067 | $wpdb->query( |
2068 | 2068 | $wpdb->prepare( |
2069 | - "UPDATE " . $table . " SET post_status=%s WHERE post_id=%d", |
|
2069 | + "UPDATE ".$table." SET post_status=%s WHERE post_id=%d", |
|
2070 | 2070 | array($status, $post_id) |
2071 | 2071 | ) |
2072 | 2072 | ); |
@@ -2138,18 +2138,18 @@ discard block |
||
2138 | 2138 | |
2139 | 2139 | $post_type = get_post_type($post_id); |
2140 | 2140 | |
2141 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
2141 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
2142 | 2142 | |
2143 | 2143 | $wpdb->query( |
2144 | 2144 | $wpdb->prepare( |
2145 | - "UPDATE " . $table . " SET `post_id` = %d WHERE `post_id` = %d", |
|
2145 | + "UPDATE ".$table." SET `post_id` = %d WHERE `post_id` = %d", |
|
2146 | 2146 | array($updatingpost, $temppost) |
2147 | 2147 | ) |
2148 | 2148 | ); |
2149 | 2149 | |
2150 | 2150 | $wpdb->query( |
2151 | 2151 | $wpdb->prepare( |
2152 | - "UPDATE " . GEODIR_ICON_TABLE . " SET `post_id` = %d WHERE `post_id` = %d", |
|
2152 | + "UPDATE ".GEODIR_ICON_TABLE." SET `post_id` = %d WHERE `post_id` = %d", |
|
2153 | 2153 | array($updatingpost, $temppost) |
2154 | 2154 | ) |
2155 | 2155 | ); |
@@ -2158,7 +2158,7 @@ discard block |
||
2158 | 2158 | |
2159 | 2159 | $wpdb->query( |
2160 | 2160 | $wpdb->prepare( |
2161 | - "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET `post_id` = %d WHERE `post_id` = %d", |
|
2161 | + "UPDATE ".GEODIR_ATTACHMENT_TABLE." SET `post_id` = %d WHERE `post_id` = %d", |
|
2162 | 2162 | array($updatingpost, $temppost) |
2163 | 2163 | ) |
2164 | 2164 | ); |
@@ -2196,12 +2196,12 @@ discard block |
||
2196 | 2196 | if (!in_array($post_type, $all_postypes)) |
2197 | 2197 | return false; |
2198 | 2198 | |
2199 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
2199 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
2200 | 2200 | |
2201 | 2201 | /* Delete custom post meta*/ |
2202 | 2202 | $wpdb->query( |
2203 | 2203 | $wpdb->prepare( |
2204 | - "DELETE FROM " . $table . " WHERE `post_id` = %d", |
|
2204 | + "DELETE FROM ".$table." WHERE `post_id` = %d", |
|
2205 | 2205 | array($deleted_postid) |
2206 | 2206 | ) |
2207 | 2207 | ); |
@@ -2210,7 +2210,7 @@ discard block |
||
2210 | 2210 | |
2211 | 2211 | $wpdb->query( |
2212 | 2212 | $wpdb->prepare( |
2213 | - "DELETE FROM " . GEODIR_ICON_TABLE . " WHERE `post_id` = %d", |
|
2213 | + "DELETE FROM ".GEODIR_ICON_TABLE." WHERE `post_id` = %d", |
|
2214 | 2214 | array($deleted_postid) |
2215 | 2215 | ) |
2216 | 2216 | ); |
@@ -2220,7 +2220,7 @@ discard block |
||
2220 | 2220 | |
2221 | 2221 | $wpdb->query( |
2222 | 2222 | $wpdb->prepare( |
2223 | - "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE `post_id` = %d", |
|
2223 | + "DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE `post_id` = %d", |
|
2224 | 2224 | array($deleted_postid) |
2225 | 2225 | ) |
2226 | 2226 | ); |
@@ -2292,7 +2292,7 @@ discard block |
||
2292 | 2292 | */ |
2293 | 2293 | do_action('geodir_before_add_from_favorite', $post_id); |
2294 | 2294 | |
2295 | - echo '<a href="javascript:void(0);" title="' . $remove_favourite_text . '" class="geodir-removetofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'remove\');"><i class="'. $favourite_icon .'"></i> ' . $unfavourite_text . '</a>'; |
|
2295 | + echo '<a href="javascript:void(0);" title="'.$remove_favourite_text.'" class="geodir-removetofav-icon" onclick="javascript:addToFavourite(\''.$post_id.'\',\'remove\');"><i class="'.$favourite_icon.'"></i> '.$unfavourite_text.'</a>'; |
|
2296 | 2296 | |
2297 | 2297 | /** |
2298 | 2298 | * Called after adding the post from favourites. |
@@ -2371,7 +2371,7 @@ discard block |
||
2371 | 2371 | */ |
2372 | 2372 | do_action('geodir_before_remove_from_favorite', $post_id); |
2373 | 2373 | |
2374 | - echo '<a href="javascript:void(0);" title="' . $add_favourite_text . '" class="geodir-addtofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'add\');"><i class="'. $favourite_icon .'"></i> ' . $favourite_text . '</a>'; |
|
2374 | + echo '<a href="javascript:void(0);" title="'.$add_favourite_text.'" class="geodir-addtofav-icon" onclick="javascript:addToFavourite(\''.$post_id.'\',\'add\');"><i class="'.$favourite_icon.'"></i> '.$favourite_text.'</a>'; |
|
2375 | 2375 | |
2376 | 2376 | /** |
2377 | 2377 | * Called after removing the post from favourites. |
@@ -2466,24 +2466,24 @@ discard block |
||
2466 | 2466 | $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true); |
2467 | 2467 | |
2468 | 2468 | if (!empty($user_meta_data) && in_array($post_id, $user_meta_data)) { |
2469 | - ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>" ><a |
|
2469 | + ?><span class="geodir-addtofav favorite_property_<?php echo $post_id; ?>" ><a |
|
2470 | 2470 | class="geodir-removetofav-icon" href="javascript:void(0);" |
2471 | - onclick="javascript:addToFavourite(<?php echo $post_id;?>,'remove');" |
|
2472 | - title="<?php echo $remove_favourite_text;?>"><i class="<?php echo $unfavourite_icon; ?>"></i> <?php echo $unfavourite_text;?> |
|
2471 | + onclick="javascript:addToFavourite(<?php echo $post_id; ?>,'remove');" |
|
2472 | + title="<?php echo $remove_favourite_text; ?>"><i class="<?php echo $unfavourite_icon; ?>"></i> <?php echo $unfavourite_text; ?> |
|
2473 | 2473 | </a> </span><?php |
2474 | 2474 | |
2475 | 2475 | } else { |
2476 | 2476 | |
2477 | 2477 | if (!isset($current_user->data->ID) || $current_user->data->ID == '') { |
2478 | - $script_text = 'javascript:window.location.href=\'' . geodir_login_url() . '\''; |
|
2478 | + $script_text = 'javascript:window.location.href=\''.geodir_login_url().'\''; |
|
2479 | 2479 | } else |
2480 | - $script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')'; |
|
2480 | + $script_text = 'javascript:addToFavourite('.$post_id.',\'add\')'; |
|
2481 | 2481 | |
2482 | - ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"><a class="geodir-addtofav-icon" |
|
2482 | + ?><span class="geodir-addtofav favorite_property_<?php echo $post_id; ?>"><a class="geodir-addtofav-icon" |
|
2483 | 2483 | href="javascript:void(0);" |
2484 | - onclick="<?php echo $script_text;?>" |
|
2485 | - title="<?php echo $add_favourite_text;?>"><i |
|
2486 | - class="<?php echo $favourite_icon; ?>"></i> <?php echo $favourite_text;?></a></span> |
|
2484 | + onclick="<?php echo $script_text; ?>" |
|
2485 | + title="<?php echo $add_favourite_text; ?>"><i |
|
2486 | + class="<?php echo $favourite_icon; ?>"></i> <?php echo $favourite_text; ?></a></span> |
|
2487 | 2487 | <?php } |
2488 | 2488 | } |
2489 | 2489 | } |
@@ -2513,7 +2513,7 @@ discard block |
||
2513 | 2513 | |
2514 | 2514 | $post_type = $taxonomy_obj->object_type[0]; |
2515 | 2515 | |
2516 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
2516 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
2517 | 2517 | |
2518 | 2518 | /** |
2519 | 2519 | * Filter to modify the 'join' query |
@@ -2536,8 +2536,8 @@ discard block |
||
2536 | 2536 | $where = apply_filters('geodir_cat_post_count_where', $where, $term); |
2537 | 2537 | |
2538 | 2538 | $count_query = "SELECT count(post_id) FROM |
2539 | - " . $table . " as pd " . $join . " |
|
2540 | - WHERE pd.post_status='publish' AND FIND_IN_SET('" . $term->term_id . "'," . $term->taxonomy . ") " . $where; |
|
2539 | + " . $table." as pd ".$join." |
|
2540 | + WHERE pd.post_status='publish' AND FIND_IN_SET('" . $term->term_id."',".$term->taxonomy.") ".$where; |
|
2541 | 2541 | |
2542 | 2542 | $cat_post_count = $wpdb->get_var($count_query); |
2543 | 2543 | if (empty($cat_post_count) || is_wp_error($cat_post_count)) |
@@ -2620,7 +2620,7 @@ discard block |
||
2620 | 2620 | global $post; |
2621 | 2621 | $all_postypes = geodir_get_posttypes(); |
2622 | 2622 | if (is_array($all_postypes) && in_array($post->post_type, $all_postypes)) { |
2623 | - return ' <a href="' . get_permalink($post->ID) . '">' . READ_MORE_TXT . '</a>'; |
|
2623 | + return ' <a href="'.get_permalink($post->ID).'">'.READ_MORE_TXT.'</a>'; |
|
2624 | 2624 | } |
2625 | 2625 | |
2626 | 2626 | return $more; |
@@ -2647,14 +2647,14 @@ discard block |
||
2647 | 2647 | if (is_array($gd_taxonomies) && in_array($taxonomy, $gd_taxonomies)) { |
2648 | 2648 | |
2649 | 2649 | $geodir_post_type = geodir_get_taxonomy_posttype($taxonomy); |
2650 | - $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
2650 | + $table = $plugin_prefix.$geodir_post_type.'_detail'; |
|
2651 | 2651 | |
2652 | 2652 | $path_parts = pathinfo($_REQUEST['ct_cat_icon']['src']); |
2653 | - $term_icon = $path_parts['dirname'] . '/cat_icon_' . $term_id . '.png'; |
|
2653 | + $term_icon = $path_parts['dirname'].'/cat_icon_'.$term_id.'.png'; |
|
2654 | 2654 | |
2655 | 2655 | $posts = $wpdb->get_results( |
2656 | 2656 | $wpdb->prepare( |
2657 | - "SELECT post_id,post_title,post_latitude,post_longitude,default_category FROM " . $table . " WHERE FIND_IN_SET(%s,%1\$s ) ", |
|
2657 | + "SELECT post_id,post_title,post_latitude,post_longitude,default_category FROM ".$table." WHERE FIND_IN_SET(%s,%1\$s ) ", |
|
2658 | 2658 | array($term_id, $taxonomy) |
2659 | 2659 | ) |
2660 | 2660 | ); |
@@ -2666,19 +2666,19 @@ discard block |
||
2666 | 2666 | $lng = $post_obj->post_longitude; |
2667 | 2667 | |
2668 | 2668 | $json = '{'; |
2669 | - $json .= '"id":"' . $post_obj->post_id . '",'; |
|
2670 | - $json .= '"lat_pos": "' . $lat . '",'; |
|
2671 | - $json .= '"long_pos": "' . $lng . '",'; |
|
2672 | - $json .= '"marker_id":"' . $post_obj->post_id . '_' . $term_id . '",'; |
|
2673 | - $json .= '"icon":"' . $term_icon . '",'; |
|
2674 | - $json .= '"group":"catgroup' . $term_id . '"'; |
|
2669 | + $json .= '"id":"'.$post_obj->post_id.'",'; |
|
2670 | + $json .= '"lat_pos": "'.$lat.'",'; |
|
2671 | + $json .= '"long_pos": "'.$lng.'",'; |
|
2672 | + $json .= '"marker_id":"'.$post_obj->post_id.'_'.$term_id.'",'; |
|
2673 | + $json .= '"icon":"'.$term_icon.'",'; |
|
2674 | + $json .= '"group":"catgroup'.$term_id.'"'; |
|
2675 | 2675 | $json .= '}'; |
2676 | 2676 | |
2677 | 2677 | if ($post_obj->default_category == $term_id) { |
2678 | 2678 | |
2679 | 2679 | $wpdb->query( |
2680 | 2680 | $wpdb->prepare( |
2681 | - "UPDATE " . $table . " SET marker_json = %s where post_id = %d", |
|
2681 | + "UPDATE ".$table." SET marker_json = %s where post_id = %d", |
|
2682 | 2682 | array($json, $post_obj->post_id) |
2683 | 2683 | ) |
2684 | 2684 | ); |
@@ -2686,7 +2686,7 @@ discard block |
||
2686 | 2686 | |
2687 | 2687 | $wpdb->query( |
2688 | 2688 | $wpdb->prepare( |
2689 | - "UPDATE " . GEODIR_ICON_TABLE . " SET json = %s WHERE post_id = %d AND cat_id = %d", |
|
2689 | + "UPDATE ".GEODIR_ICON_TABLE." SET json = %s WHERE post_id = %d AND cat_id = %d", |
|
2690 | 2690 | array($json, $post_obj->post_id, $term_id) |
2691 | 2691 | ) |
2692 | 2692 | ); |
@@ -2810,7 +2810,7 @@ discard block |
||
2810 | 2810 | // print_r($uploads ) ; |
2811 | 2811 | $post_first_image = $wpdb->get_results( |
2812 | 2812 | $wpdb->prepare( |
2813 | - "SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d and menu_order = 1 ", array($post_id) |
|
2813 | + "SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id = %d and menu_order = 1 ", array($post_id) |
|
2814 | 2814 | ) |
2815 | 2815 | ); |
2816 | 2816 | |
@@ -2831,9 +2831,9 @@ discard block |
||
2831 | 2831 | |
2832 | 2832 | $post_type = get_post_type($post_id); |
2833 | 2833 | |
2834 | - $table_name = $plugin_prefix . $post_type . '_detail'; |
|
2834 | + $table_name = $plugin_prefix.$post_type.'_detail'; |
|
2835 | 2835 | |
2836 | - $wpdb->query("UPDATE " . $table_name . " SET featured_image='" . $post_first_image[0]->file . "' WHERE post_id =" . $post_id); |
|
2836 | + $wpdb->query("UPDATE ".$table_name." SET featured_image='".$post_first_image[0]->file."' WHERE post_id =".$post_id); |
|
2837 | 2837 | |
2838 | 2838 | $new_attachment_name = basename($post_first_image[0]->file); |
2839 | 2839 | |
@@ -2846,11 +2846,11 @@ discard block |
||
2846 | 2846 | wp_delete_attachment($post_thumbnail_id); |
2847 | 2847 | |
2848 | 2848 | } |
2849 | - $filename = $uploads['basedir'] . $post_first_image[0]->file; |
|
2849 | + $filename = $uploads['basedir'].$post_first_image[0]->file; |
|
2850 | 2850 | |
2851 | 2851 | $attachment = array( |
2852 | 2852 | 'post_mime_type' => $post_first_image[0]->mime_type, |
2853 | - 'guid' => $uploads['baseurl'] . $post_first_image[0]->file, |
|
2853 | + 'guid' => $uploads['baseurl'].$post_first_image[0]->file, |
|
2854 | 2854 | 'post_parent' => $post_id, |
2855 | 2855 | 'post_title' => preg_replace('/\.[^.]+$/', '', $post_first_image[0]->title), |
2856 | 2856 | 'post_content' => '' |
@@ -2863,7 +2863,7 @@ discard block |
||
2863 | 2863 | |
2864 | 2864 | set_post_thumbnail($post_id, $id); |
2865 | 2865 | |
2866 | - require_once(ABSPATH . 'wp-admin/includes/image.php'); |
|
2866 | + require_once(ABSPATH.'wp-admin/includes/image.php'); |
|
2867 | 2867 | wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename)); |
2868 | 2868 | |
2869 | 2869 | } |
@@ -2896,35 +2896,35 @@ discard block |
||
2896 | 2896 | $post_id = absint($_POST['post_id']); |
2897 | 2897 | $upload_dir = wp_upload_dir(); |
2898 | 2898 | $post_type = get_post_type($_POST['post_id']); |
2899 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
2899 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
2900 | 2900 | |
2901 | 2901 | $post_arr = $wpdb->get_results($wpdb->prepare( |
2902 | - "SELECT * FROM $wpdb->posts p JOIN " . $table . " gd ON gd.post_id=p.ID WHERE p.ID=%d LIMIT 1", |
|
2902 | + "SELECT * FROM $wpdb->posts p JOIN ".$table." gd ON gd.post_id=p.ID WHERE p.ID=%d LIMIT 1", |
|
2903 | 2903 | array($post_id) |
2904 | 2904 | ) |
2905 | 2905 | , ARRAY_A); |
2906 | 2906 | |
2907 | 2907 | $arrImages = $wpdb->get_results( |
2908 | 2908 | $wpdb->prepare( |
2909 | - "SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC, ID DESC ", |
|
2909 | + "SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC, ID DESC ", |
|
2910 | 2910 | array('%image%', $post_id) |
2911 | 2911 | ) |
2912 | 2912 | ); |
2913 | 2913 | if ($arrImages) { |
2914 | 2914 | $image_arr = array(); |
2915 | 2915 | foreach ($arrImages as $img) { |
2916 | - $image_arr[] = $upload_dir['baseurl'] . $img->file; |
|
2916 | + $image_arr[] = $upload_dir['baseurl'].$img->file; |
|
2917 | 2917 | } |
2918 | 2918 | $comma_separated = implode(",", $image_arr); |
2919 | 2919 | $post_arr[0]['post_images'] = $comma_separated; |
2920 | 2920 | } |
2921 | 2921 | |
2922 | 2922 | |
2923 | - $cats = $post_arr[0][$post_arr[0]['post_type'] . 'category']; |
|
2923 | + $cats = $post_arr[0][$post_arr[0]['post_type'].'category']; |
|
2924 | 2924 | $cat_arr = array_filter(explode(",", $cats)); |
2925 | 2925 | $trans_cat = array(); |
2926 | 2926 | foreach ($cat_arr as $cat) { |
2927 | - $trans_cat[] = icl_object_id($cat, $post_arr[0]['post_type'] . 'category', false); |
|
2927 | + $trans_cat[] = icl_object_id($cat, $post_arr[0]['post_type'].'category', false); |
|
2928 | 2928 | } |
2929 | 2929 | |
2930 | 2930 | |
@@ -2966,7 +2966,7 @@ discard block |
||
2966 | 2966 | |
2967 | 2967 | $get_data = $wpdb->get_results( |
2968 | 2968 | $wpdb->prepare( |
2969 | - "SELECT htmlvar_name, field_type, extra_fields FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND is_active='1'", |
|
2969 | + "SELECT htmlvar_name, field_type, extra_fields FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE post_type=%s AND is_active='1'", |
|
2970 | 2970 | array($listing_type) |
2971 | 2971 | ) |
2972 | 2972 | ); |
@@ -2979,12 +2979,12 @@ discard block |
||
2979 | 2979 | |
2980 | 2980 | $extra_fields = unserialize($data->extra_fields); |
2981 | 2981 | |
2982 | - $prefix = $data->htmlvar_name . '_'; |
|
2982 | + $prefix = $data->htmlvar_name.'_'; |
|
2983 | 2983 | |
2984 | - $fields_info[$prefix . 'address'] = $data->field_type; |
|
2984 | + $fields_info[$prefix.'address'] = $data->field_type; |
|
2985 | 2985 | |
2986 | 2986 | if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) |
2987 | - $fields_info[$prefix . 'zip'] = $data->field_type; |
|
2987 | + $fields_info[$prefix.'zip'] = $data->field_type; |
|
2988 | 2988 | |
2989 | 2989 | } else { |
2990 | 2990 | |
@@ -3082,13 +3082,13 @@ discard block |
||
3082 | 3082 | * @since 1.4.9 |
3083 | 3083 | * @package GeoDirectory |
3084 | 3084 | */ |
3085 | -function geodir_fb_like_thumbnail(){ |
|
3085 | +function geodir_fb_like_thumbnail() { |
|
3086 | 3086 | |
3087 | 3087 | // return if not a single post |
3088 | - if(!is_single()){return;} |
|
3088 | + if (!is_single()) {return; } |
|
3089 | 3089 | |
3090 | 3090 | global $post; |
3091 | - if(isset($post->featured_image) && $post->featured_image){ |
|
3091 | + if (isset($post->featured_image) && $post->featured_image) { |
|
3092 | 3092 | $upload_dir = wp_upload_dir(); |
3093 | 3093 | $thumb = $upload_dir['baseurl'].$post->featured_image; |
3094 | 3094 | echo "\n\n<!-- GD Facebook Like Thumbnail -->\n<link rel=\"image_src\" href=\"$thumb\" />\n<!-- End GD Facebook Like Thumbnail -->\n\n"; |