@@ -14,18 +14,18 @@ discard block |
||
14 | 14 | |
15 | 15 | |
16 | 16 | if (function_exists('geodir_location_geo_home_link')) { |
17 | - remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
17 | + remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
18 | 18 | } |
19 | 19 | $search_url = trailingslashit(get_home_url()); |
20 | 20 | if (function_exists('geodir_location_geo_home_link')) { |
21 | - add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
21 | + add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | |
25 | 25 | $new_style = get_option('geodir_show_search_old_search_from') ? false : true; |
26 | 26 | $form_class = 'geodir-listing-search'; |
27 | 27 | if($new_style){ |
28 | - $form_class .= ' gd-search-bar-style'; |
|
28 | + $form_class .= ' gd-search-bar-style'; |
|
29 | 29 | } |
30 | 30 | ?> |
31 | 31 | |
@@ -44,56 +44,56 @@ discard block |
||
44 | 44 | <div class="geodir-loc-bar"> |
45 | 45 | |
46 | 46 | <?php |
47 | - /** |
|
48 | - * Called inside the search form but before any of the fields. |
|
49 | - * |
|
50 | - * @since 1.0.0 |
|
51 | - */ |
|
52 | - do_action('geodir_before_search_form') ?> |
|
47 | + /** |
|
48 | + * Called inside the search form but before any of the fields. |
|
49 | + * |
|
50 | + * @since 1.0.0 |
|
51 | + */ |
|
52 | + do_action('geodir_before_search_form') ?> |
|
53 | 53 | |
54 | 54 | <div class="clearfix geodir-loc-bar-in"> |
55 | 55 | <div class="geodir-search"> |
56 | 56 | |
57 | 57 | <?php |
58 | 58 | |
59 | - /** |
|
60 | - * Adds the input fields to the search form. |
|
61 | - * |
|
62 | - * @since 1.6.9 |
|
63 | - */ |
|
64 | - do_action('geodir_search_form_inputs'); |
|
59 | + /** |
|
60 | + * Adds the input fields to the search form. |
|
61 | + * |
|
62 | + * @since 1.6.9 |
|
63 | + */ |
|
64 | + do_action('geodir_search_form_inputs'); |
|
65 | 65 | |
66 | 66 | |
67 | 67 | |
68 | - /** |
|
69 | - * Called on the GD search form just before the search button. |
|
70 | - * |
|
71 | - * @since 1.0.0 |
|
72 | - */ |
|
73 | - do_action('geodir_before_search_button'); |
|
68 | + /** |
|
69 | + * Called on the GD search form just before the search button. |
|
70 | + * |
|
71 | + * @since 1.0.0 |
|
72 | + */ |
|
73 | + do_action('geodir_before_search_button'); |
|
74 | 74 | |
75 | 75 | |
76 | - /** |
|
77 | - * Called on the GD search form just after the search button. |
|
78 | - * |
|
79 | - * @since 1.0.0 |
|
80 | - */ |
|
81 | - do_action('geodir_after_search_button'); |
|
76 | + /** |
|
77 | + * Called on the GD search form just after the search button. |
|
78 | + * |
|
79 | + * @since 1.0.0 |
|
80 | + */ |
|
81 | + do_action('geodir_after_search_button'); |
|
82 | 82 | |
83 | 83 | |
84 | - ?> |
|
84 | + ?> |
|
85 | 85 | </div> |
86 | 86 | |
87 | 87 | |
88 | 88 | </div> |
89 | 89 | |
90 | 90 | <?php |
91 | - /** |
|
92 | - * Called inside the search form but after all the input fields. |
|
93 | - * |
|
94 | - * @since 1.0.0 |
|
95 | - */ |
|
96 | - do_action('geodir_after_search_form') ?> |
|
91 | + /** |
|
92 | + * Called inside the search form but after all the input fields. |
|
93 | + * |
|
94 | + * @since 1.0.0 |
|
95 | + */ |
|
96 | + do_action('geodir_after_search_form') ?> |
|
97 | 97 | |
98 | 98 | |
99 | 99 | </div> |
@@ -24,7 +24,7 @@ |
||
24 | 24 | |
25 | 25 | $new_style = get_option('geodir_show_search_old_search_from') ? false : true; |
26 | 26 | $form_class = 'geodir-listing-search'; |
27 | -if($new_style){ |
|
27 | +if ($new_style) { |
|
28 | 28 | $form_class .= ' gd-search-bar-style'; |
29 | 29 | } |
30 | 30 | ?> |
@@ -10,21 +10,21 @@ |
||
10 | 10 | |
11 | 11 | // Exit if accessed directly. |
12 | 12 | if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
13 | - exit; |
|
13 | + exit; |
|
14 | 14 | } |
15 | 15 | |
16 | 16 | global $wpdb; |
17 | 17 | |
18 | 18 | if (get_option('geodir_un_geodirectory')) { |
19 | - $wpdb->hide_errors(); |
|
19 | + $wpdb->hide_errors(); |
|
20 | 20 | |
21 | - /* |
|
21 | + /* |
|
22 | 22 | if (!defined('GEODIRECTORY_VERSION')) { |
23 | 23 | // Load plugin file. |
24 | 24 | include_once('geodirectory.php'); |
25 | 25 | } |
26 | 26 | */ |
27 | 27 | |
28 | - // Delete default data. |
|
29 | - delete_option('geodir_default_data_installed'); |
|
28 | + // Delete default data. |
|
29 | + delete_option('geodir_default_data_installed'); |
|
30 | 30 | } |
31 | 31 | \ No newline at end of file |
@@ -9,7 +9,7 @@ |
||
9 | 9 | */ |
10 | 10 | |
11 | 11 | // Exit if accessed directly. |
12 | -if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
|
12 | +if (!defined('WP_UNINSTALL_PLUGIN')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 |
@@ -15,296 +15,296 @@ discard block |
||
15 | 15 | */ |
16 | 16 | function geodir_register_sidebar() |
17 | 17 | { |
18 | - global $geodir_sidebars; |
|
19 | - |
|
20 | - if (function_exists('register_sidebar')) { |
|
21 | - /*===========================*/ |
|
22 | - /* Home page sidebars start*/ |
|
23 | - /*===========================*/ |
|
24 | - |
|
25 | - /** |
|
26 | - * Filter the `$before_widget` widget opening HTML tag. |
|
27 | - * |
|
28 | - * @since 1.0.0 |
|
29 | - * @param string $var The HTML string to filter. Default = '<section id="%1$s" class="widget geodir-widget %2$s">'. |
|
30 | - * @see 'geodir_after_widget' |
|
31 | - */ |
|
32 | - $before_widget = apply_filters('geodir_before_widget', '<section id="%1$s" class="widget geodir-widget %2$s">'); |
|
33 | - /** |
|
34 | - * Filter the `$after_widget` widget closing HTML tag. |
|
35 | - * |
|
36 | - * @since 1.0.0 |
|
37 | - * @param string $var The HTML string to filter. Default = '</section>'. |
|
38 | - * @see 'geodir_before_widget' |
|
39 | - */ |
|
40 | - $after_widget = apply_filters('geodir_after_widget', '</section>'); |
|
41 | - /** |
|
42 | - * Filter the `$before_title` widget title opening HTML tag. |
|
43 | - * |
|
44 | - * @since 1.0.0 |
|
45 | - * @param string $var The HTML string to filter. Default = '<h3 class="widget-title">'. |
|
46 | - * @see 'geodir_after_title' |
|
47 | - */ |
|
48 | - $before_title = apply_filters('geodir_before_title', '<h3 class="widget-title">'); |
|
49 | - /** |
|
50 | - * Filter the `$after_title` widget title closing HTML tag. |
|
51 | - * |
|
52 | - * @since 1.0.0 |
|
53 | - * @param string $var The HTML string to filter. Default = '</h3>'. |
|
54 | - * @see 'geodir_before_title' |
|
55 | - */ |
|
56 | - $after_title = apply_filters('geodir_after_title', '</h3>'); |
|
57 | - |
|
58 | - if (get_option('geodir_show_home_top_section')) { |
|
59 | - register_sidebars(1, array('id' => 'geodir_home_top', 'name' => __('GD Home Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
60 | - |
|
61 | - $geodir_sidebars[] = 'geodir_home_top'; |
|
62 | - } |
|
63 | - |
|
64 | - if (get_option('geodir_show_home_contant_section')) { |
|
65 | - register_sidebars(1, array('id' => 'geodir_home_content', 'name' => __('GD Home Content Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
18 | + global $geodir_sidebars; |
|
66 | 19 | |
67 | - $geodir_sidebars[] = 'geodir_home_content'; |
|
68 | - } |
|
20 | + if (function_exists('register_sidebar')) { |
|
21 | + /*===========================*/ |
|
22 | + /* Home page sidebars start*/ |
|
23 | + /*===========================*/ |
|
69 | 24 | |
70 | - if (get_option('geodir_show_home_right_section')) { |
|
71 | - register_sidebars(1, array('id' => 'geodir_home_right', 'name' => __('GD Home Right Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
25 | + /** |
|
26 | + * Filter the `$before_widget` widget opening HTML tag. |
|
27 | + * |
|
28 | + * @since 1.0.0 |
|
29 | + * @param string $var The HTML string to filter. Default = '<section id="%1$s" class="widget geodir-widget %2$s">'. |
|
30 | + * @see 'geodir_after_widget' |
|
31 | + */ |
|
32 | + $before_widget = apply_filters('geodir_before_widget', '<section id="%1$s" class="widget geodir-widget %2$s">'); |
|
33 | + /** |
|
34 | + * Filter the `$after_widget` widget closing HTML tag. |
|
35 | + * |
|
36 | + * @since 1.0.0 |
|
37 | + * @param string $var The HTML string to filter. Default = '</section>'. |
|
38 | + * @see 'geodir_before_widget' |
|
39 | + */ |
|
40 | + $after_widget = apply_filters('geodir_after_widget', '</section>'); |
|
41 | + /** |
|
42 | + * Filter the `$before_title` widget title opening HTML tag. |
|
43 | + * |
|
44 | + * @since 1.0.0 |
|
45 | + * @param string $var The HTML string to filter. Default = '<h3 class="widget-title">'. |
|
46 | + * @see 'geodir_after_title' |
|
47 | + */ |
|
48 | + $before_title = apply_filters('geodir_before_title', '<h3 class="widget-title">'); |
|
49 | + /** |
|
50 | + * Filter the `$after_title` widget title closing HTML tag. |
|
51 | + * |
|
52 | + * @since 1.0.0 |
|
53 | + * @param string $var The HTML string to filter. Default = '</h3>'. |
|
54 | + * @see 'geodir_before_title' |
|
55 | + */ |
|
56 | + $after_title = apply_filters('geodir_after_title', '</h3>'); |
|
57 | + |
|
58 | + if (get_option('geodir_show_home_top_section')) { |
|
59 | + register_sidebars(1, array('id' => 'geodir_home_top', 'name' => __('GD Home Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
72 | 60 | |
73 | - $geodir_sidebars[] = 'geodir_home_right'; |
|
74 | - } |
|
61 | + $geodir_sidebars[] = 'geodir_home_top'; |
|
62 | + } |
|
75 | 63 | |
76 | - if (get_option('geodir_show_home_left_section')) { |
|
77 | - register_sidebars(1, array('id' => 'geodir_home_left', 'name' => __('GD Home Left Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
64 | + if (get_option('geodir_show_home_contant_section')) { |
|
65 | + register_sidebars(1, array('id' => 'geodir_home_content', 'name' => __('GD Home Content Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
78 | 66 | |
79 | - $geodir_sidebars[] = 'geodir_home_left'; |
|
80 | - } |
|
67 | + $geodir_sidebars[] = 'geodir_home_content'; |
|
68 | + } |
|
81 | 69 | |
82 | - if (get_option('geodir_show_home_bottom_section')) { |
|
83 | - register_sidebars(1, array('id' => 'geodir_home_bottom', 'name' => __('GD Home Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
70 | + if (get_option('geodir_show_home_right_section')) { |
|
71 | + register_sidebars(1, array('id' => 'geodir_home_right', 'name' => __('GD Home Right Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
84 | 72 | |
85 | - $geodir_sidebars[] = 'geodir_home_bottom'; |
|
86 | - } |
|
73 | + $geodir_sidebars[] = 'geodir_home_right'; |
|
74 | + } |
|
87 | 75 | |
88 | - /*===========================*/ |
|
89 | - /* Home page sidebars end*/ |
|
90 | - /*===========================*/ |
|
76 | + if (get_option('geodir_show_home_left_section')) { |
|
77 | + register_sidebars(1, array('id' => 'geodir_home_left', 'name' => __('GD Home Left Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
91 | 78 | |
92 | - /*===========================*/ |
|
93 | - /* Listing page sidebars start*/ |
|
94 | - /*===========================*/ |
|
79 | + $geodir_sidebars[] = 'geodir_home_left'; |
|
80 | + } |
|
95 | 81 | |
96 | - if (get_option('geodir_show_listing_top_section')) { |
|
97 | - register_sidebars(1, array('id' => 'geodir_listing_top', 'name' => __('GD Listing Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
82 | + if (get_option('geodir_show_home_bottom_section')) { |
|
83 | + register_sidebars(1, array('id' => 'geodir_home_bottom', 'name' => __('GD Home Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
98 | 84 | |
99 | - $geodir_sidebars[] = 'geodir_listing_top'; |
|
100 | - } |
|
85 | + $geodir_sidebars[] = 'geodir_home_bottom'; |
|
86 | + } |
|
101 | 87 | |
102 | - if (get_option('geodir_show_listing_left_section')) { |
|
103 | - register_sidebars(1, array('id' => 'geodir_listing_left_sidebar', 'name' => __('GD Listing Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
88 | + /*===========================*/ |
|
89 | + /* Home page sidebars end*/ |
|
90 | + /*===========================*/ |
|
104 | 91 | |
105 | - $geodir_sidebars[] = 'geodir_listing_left_sidebar'; |
|
106 | - } |
|
92 | + /*===========================*/ |
|
93 | + /* Listing page sidebars start*/ |
|
94 | + /*===========================*/ |
|
107 | 95 | |
108 | - if (get_option('geodir_show_listing_right_section')) { |
|
109 | - register_sidebars(1, array('id' => 'geodir_listing_right_sidebar', 'name' => __('GD Listing Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
96 | + if (get_option('geodir_show_listing_top_section')) { |
|
97 | + register_sidebars(1, array('id' => 'geodir_listing_top', 'name' => __('GD Listing Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
110 | 98 | |
111 | - $geodir_sidebars[] = 'geodir_listing_right_sidebar'; |
|
112 | - } |
|
99 | + $geodir_sidebars[] = 'geodir_listing_top'; |
|
100 | + } |
|
113 | 101 | |
114 | - if (get_option('geodir_show_listing_bottom_section')) { |
|
115 | - register_sidebars(1, array('id' => 'geodir_listing_bottom', 'name' => __('GD Listing Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
102 | + if (get_option('geodir_show_listing_left_section')) { |
|
103 | + register_sidebars(1, array('id' => 'geodir_listing_left_sidebar', 'name' => __('GD Listing Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
116 | 104 | |
117 | - $geodir_sidebars[] = 'geodir_listing_bottom'; |
|
118 | - } |
|
105 | + $geodir_sidebars[] = 'geodir_listing_left_sidebar'; |
|
106 | + } |
|
119 | 107 | |
120 | - /*===========================*/ |
|
121 | - /* Listing page sidebars start*/ |
|
122 | - /*===========================*/ |
|
108 | + if (get_option('geodir_show_listing_right_section')) { |
|
109 | + register_sidebars(1, array('id' => 'geodir_listing_right_sidebar', 'name' => __('GD Listing Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
123 | 110 | |
124 | - /*===========================*/ |
|
125 | - /* Search page sidebars start*/ |
|
126 | - /*===========================*/ |
|
111 | + $geodir_sidebars[] = 'geodir_listing_right_sidebar'; |
|
112 | + } |
|
127 | 113 | |
128 | - if (get_option('geodir_show_search_top_section')) { |
|
129 | - register_sidebars(1, array('id' => 'geodir_search_top', 'name' => __('GD Search Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
114 | + if (get_option('geodir_show_listing_bottom_section')) { |
|
115 | + register_sidebars(1, array('id' => 'geodir_listing_bottom', 'name' => __('GD Listing Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
130 | 116 | |
131 | - $geodir_sidebars[] = 'geodir_search_top'; |
|
132 | - } |
|
117 | + $geodir_sidebars[] = 'geodir_listing_bottom'; |
|
118 | + } |
|
133 | 119 | |
134 | - if (get_option('geodir_show_search_left_section')) { |
|
135 | - register_sidebars(1, array('id' => 'geodir_search_left_sidebar', 'name' => __('GD Search Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
120 | + /*===========================*/ |
|
121 | + /* Listing page sidebars start*/ |
|
122 | + /*===========================*/ |
|
136 | 123 | |
137 | - $geodir_sidebars[] = 'geodir_search_left_sidebar'; |
|
138 | - } |
|
124 | + /*===========================*/ |
|
125 | + /* Search page sidebars start*/ |
|
126 | + /*===========================*/ |
|
139 | 127 | |
140 | - if (get_option('geodir_show_search_right_section')) { |
|
141 | - register_sidebars(1, array('id' => 'geodir_search_right_sidebar', 'name' => __('GD Search Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
128 | + if (get_option('geodir_show_search_top_section')) { |
|
129 | + register_sidebars(1, array('id' => 'geodir_search_top', 'name' => __('GD Search Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
142 | 130 | |
143 | - $geodir_sidebars[] = 'geodir_search_right_sidebar'; |
|
144 | - } |
|
131 | + $geodir_sidebars[] = 'geodir_search_top'; |
|
132 | + } |
|
145 | 133 | |
146 | - if (get_option('geodir_show_search_bottom_section')) { |
|
147 | - register_sidebars(1, array('id' => 'geodir_search_bottom', 'name' => __('GD Search Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
134 | + if (get_option('geodir_show_search_left_section')) { |
|
135 | + register_sidebars(1, array('id' => 'geodir_search_left_sidebar', 'name' => __('GD Search Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
148 | 136 | |
149 | - $geodir_sidebars[] = 'geodir_search_bottom'; |
|
150 | - } |
|
137 | + $geodir_sidebars[] = 'geodir_search_left_sidebar'; |
|
138 | + } |
|
151 | 139 | |
152 | - /*===========================*/ |
|
153 | - /* Search page sidebars end*/ |
|
154 | - /*===========================*/ |
|
140 | + if (get_option('geodir_show_search_right_section')) { |
|
141 | + register_sidebars(1, array('id' => 'geodir_search_right_sidebar', 'name' => __('GD Search Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
155 | 142 | |
156 | - /*==================================*/ |
|
157 | - /* Detail/Single page sidebars start*/ |
|
158 | - /*==================================*/ |
|
159 | - if (get_option('geodir_show_detail_top_section')) { |
|
160 | - register_sidebars(1, array('id' => 'geodir_detail_top', 'name' => __('GD Detail Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
143 | + $geodir_sidebars[] = 'geodir_search_right_sidebar'; |
|
144 | + } |
|
161 | 145 | |
162 | - $geodir_sidebars[] = 'geodir_detail_top'; |
|
163 | - } |
|
146 | + if (get_option('geodir_show_search_bottom_section')) { |
|
147 | + register_sidebars(1, array('id' => 'geodir_search_bottom', 'name' => __('GD Search Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
164 | 148 | |
165 | - register_sidebars(1, array('id' => 'geodir_detail_sidebar', 'name' => __('GD Detail Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
149 | + $geodir_sidebars[] = 'geodir_search_bottom'; |
|
150 | + } |
|
166 | 151 | |
167 | - $geodir_sidebars[] = 'geodir_detail_sidebar'; |
|
152 | + /*===========================*/ |
|
153 | + /* Search page sidebars end*/ |
|
154 | + /*===========================*/ |
|
168 | 155 | |
169 | - if (get_option('geodir_show_detail_bottom_section')) { |
|
170 | - register_sidebars(1, array('id' => 'geodir_detail_bottom', 'name' => __('GD Detail Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
156 | + /*==================================*/ |
|
157 | + /* Detail/Single page sidebars start*/ |
|
158 | + /*==================================*/ |
|
159 | + if (get_option('geodir_show_detail_top_section')) { |
|
160 | + register_sidebars(1, array('id' => 'geodir_detail_top', 'name' => __('GD Detail Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
171 | 161 | |
172 | - $geodir_sidebars[] = 'geodir_detail_bottom'; |
|
173 | - } |
|
162 | + $geodir_sidebars[] = 'geodir_detail_top'; |
|
163 | + } |
|
174 | 164 | |
175 | - /*==================================*/ |
|
176 | - /* Detail/Single page sidebars end*/ |
|
177 | - /*==================================*/ |
|
165 | + register_sidebars(1, array('id' => 'geodir_detail_sidebar', 'name' => __('GD Detail Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
178 | 166 | |
179 | - /*==================================*/ |
|
180 | - /* Author page sidebars start */ |
|
181 | - /*==================================*/ |
|
167 | + $geodir_sidebars[] = 'geodir_detail_sidebar'; |
|
182 | 168 | |
183 | - if (get_option('geodir_show_author_top_section')) { |
|
184 | - register_sidebars(1, array('id' => 'geodir_author_top', 'name' => __('GD Author Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
169 | + if (get_option('geodir_show_detail_bottom_section')) { |
|
170 | + register_sidebars(1, array('id' => 'geodir_detail_bottom', 'name' => __('GD Detail Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
185 | 171 | |
186 | - $geodir_sidebars[] = 'geodir_author_top'; |
|
187 | - } |
|
172 | + $geodir_sidebars[] = 'geodir_detail_bottom'; |
|
173 | + } |
|
188 | 174 | |
189 | - if (get_option('geodir_show_author_left_section')) { |
|
190 | - register_sidebars(1, array('id' => 'geodir_author_left_sidebar', 'name' => __('GD Author Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
175 | + /*==================================*/ |
|
176 | + /* Detail/Single page sidebars end*/ |
|
177 | + /*==================================*/ |
|
191 | 178 | |
192 | - $geodir_sidebars[] = 'geodir_author_left_sidebar'; |
|
193 | - } |
|
179 | + /*==================================*/ |
|
180 | + /* Author page sidebars start */ |
|
181 | + /*==================================*/ |
|
194 | 182 | |
195 | - if (get_option('geodir_show_author_right_section')) { |
|
196 | - register_sidebars(1, array('id' => 'geodir_author_right_sidebar', 'name' => __('GD Author Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
183 | + if (get_option('geodir_show_author_top_section')) { |
|
184 | + register_sidebars(1, array('id' => 'geodir_author_top', 'name' => __('GD Author Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
197 | 185 | |
198 | - $geodir_sidebars[] = 'geodir_author_right_sidebar'; |
|
199 | - } |
|
186 | + $geodir_sidebars[] = 'geodir_author_top'; |
|
187 | + } |
|
200 | 188 | |
201 | - if (get_option('geodir_show_author_bottom_section')) { |
|
202 | - register_sidebars(1, array('id' => 'geodir_author_bottom', 'name' => __('GD Author Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
189 | + if (get_option('geodir_show_author_left_section')) { |
|
190 | + register_sidebars(1, array('id' => 'geodir_author_left_sidebar', 'name' => __('GD Author Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
203 | 191 | |
204 | - $geodir_sidebars[] = 'geodir_author_bottom'; |
|
205 | - } |
|
192 | + $geodir_sidebars[] = 'geodir_author_left_sidebar'; |
|
193 | + } |
|
206 | 194 | |
207 | - /*==================================*/ |
|
208 | - /* Author page sidebars end */ |
|
209 | - /*==================================*/ |
|
195 | + if (get_option('geodir_show_author_right_section')) { |
|
196 | + register_sidebars(1, array('id' => 'geodir_author_right_sidebar', 'name' => __('GD Author Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
210 | 197 | |
211 | - /*==================================*/ |
|
212 | - /* Add listing page sidebars start */ |
|
213 | - /*==================================*/ |
|
198 | + $geodir_sidebars[] = 'geodir_author_right_sidebar'; |
|
199 | + } |
|
214 | 200 | |
215 | - register_sidebars(1, array('id' => 'geodir_add_listing_sidebar', 'name' => __('GD Add Listing Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
201 | + if (get_option('geodir_show_author_bottom_section')) { |
|
202 | + register_sidebars(1, array('id' => 'geodir_author_bottom', 'name' => __('GD Author Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
216 | 203 | |
217 | - $geodir_sidebars[] = 'geodir_add_listing_sidebar'; |
|
204 | + $geodir_sidebars[] = 'geodir_author_bottom'; |
|
205 | + } |
|
218 | 206 | |
219 | - /*==================================*/ |
|
220 | - /* Add listing page sidebars end */ |
|
221 | - /*==================================*/ |
|
207 | + /*==================================*/ |
|
208 | + /* Author page sidebars end */ |
|
209 | + /*==================================*/ |
|
222 | 210 | |
223 | - } |
|
211 | + /*==================================*/ |
|
212 | + /* Add listing page sidebars start */ |
|
213 | + /*==================================*/ |
|
214 | + |
|
215 | + register_sidebars(1, array('id' => 'geodir_add_listing_sidebar', 'name' => __('GD Add Listing Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
216 | + |
|
217 | + $geodir_sidebars[] = 'geodir_add_listing_sidebar'; |
|
218 | + |
|
219 | + /*==================================*/ |
|
220 | + /* Add listing page sidebars end */ |
|
221 | + /*==================================*/ |
|
222 | + |
|
223 | + } |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | |
227 | 227 | if (!function_exists('register_geodir_widgets')) { |
228 | - /** |
|
229 | - * Registers all Widgets. |
|
230 | - * |
|
231 | - * @since 1.0.0 |
|
232 | - * @package GeoDirectory |
|
233 | - */ |
|
234 | - function register_geodir_widgets() |
|
235 | - { |
|
236 | - /** |
|
237 | - * Login Widget. |
|
238 | - * |
|
239 | - * @since 1.0.0 |
|
240 | - */ |
|
241 | - class geodir_loginwidget extends WP_Widget |
|
242 | - { |
|
243 | - /** |
|
244 | - * Register the login widget with WordPress. |
|
245 | - * |
|
246 | - * @since 1.0.0 |
|
247 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
248 | - */ |
|
249 | - public function __construct() { |
|
250 | - $widget_ops = array('classname' => 'geodir_loginbox', 'description' => __('Geodirectory Loginbox Widget', 'geodirectory')); |
|
251 | - parent::__construct( |
|
252 | - 'geodir_loginbox', // Base ID |
|
253 | - __('GD > Loginbox', 'geodirectory'), // Name |
|
254 | - $widget_ops// Args |
|
255 | - ); |
|
256 | - } |
|
257 | - |
|
258 | - /** |
|
259 | - * Front-end display content for login widget. |
|
260 | - * |
|
261 | - * @since 1.0.0 |
|
262 | - * @since 1.5.1 Declare function public. |
|
263 | - * |
|
264 | - * @param array $args Widget arguments. |
|
265 | - * @param array $instance Saved values from database. |
|
266 | - */ |
|
267 | - public function widget($args, $instance) |
|
268 | - { |
|
269 | - geodir_loginwidget_output($args, $instance); |
|
270 | - } |
|
271 | - |
|
272 | - /** |
|
273 | - * Sanitize login widget form values as they are saved. |
|
274 | - * |
|
275 | - * @since 1.0.0 |
|
276 | - * @since 1.5.1 Declare function public. |
|
277 | - * |
|
278 | - * @param array $new_instance Values just sent to be saved. |
|
279 | - * @param array $old_instance Previously saved values from database. |
|
280 | - * |
|
281 | - * @return array Updated safe values to be saved. |
|
282 | - */ |
|
283 | - public function update($new_instance, $old_instance) |
|
284 | - { |
|
285 | - //save the widget |
|
286 | - $instance = $old_instance; |
|
287 | - $instance['title'] = strip_tags($new_instance['title']); |
|
288 | - |
|
289 | - return $instance; |
|
290 | - } |
|
291 | - |
|
292 | - /** |
|
293 | - * Back-end login widget settings form. |
|
294 | - * |
|
295 | - * @since 1.0.0 |
|
296 | - * @since 1.5.1 Declare function public. |
|
297 | - * |
|
298 | - * @param array $instance Previously saved values from database. |
|
299 | - * @return string|void |
|
300 | - */ |
|
301 | - public function form($instance) |
|
302 | - { |
|
303 | - //widgetform in backend |
|
304 | - $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => '')); |
|
305 | - $title = strip_tags($instance['title']); |
|
306 | - |
|
307 | - ?> |
|
228 | + /** |
|
229 | + * Registers all Widgets. |
|
230 | + * |
|
231 | + * @since 1.0.0 |
|
232 | + * @package GeoDirectory |
|
233 | + */ |
|
234 | + function register_geodir_widgets() |
|
235 | + { |
|
236 | + /** |
|
237 | + * Login Widget. |
|
238 | + * |
|
239 | + * @since 1.0.0 |
|
240 | + */ |
|
241 | + class geodir_loginwidget extends WP_Widget |
|
242 | + { |
|
243 | + /** |
|
244 | + * Register the login widget with WordPress. |
|
245 | + * |
|
246 | + * @since 1.0.0 |
|
247 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
248 | + */ |
|
249 | + public function __construct() { |
|
250 | + $widget_ops = array('classname' => 'geodir_loginbox', 'description' => __('Geodirectory Loginbox Widget', 'geodirectory')); |
|
251 | + parent::__construct( |
|
252 | + 'geodir_loginbox', // Base ID |
|
253 | + __('GD > Loginbox', 'geodirectory'), // Name |
|
254 | + $widget_ops// Args |
|
255 | + ); |
|
256 | + } |
|
257 | + |
|
258 | + /** |
|
259 | + * Front-end display content for login widget. |
|
260 | + * |
|
261 | + * @since 1.0.0 |
|
262 | + * @since 1.5.1 Declare function public. |
|
263 | + * |
|
264 | + * @param array $args Widget arguments. |
|
265 | + * @param array $instance Saved values from database. |
|
266 | + */ |
|
267 | + public function widget($args, $instance) |
|
268 | + { |
|
269 | + geodir_loginwidget_output($args, $instance); |
|
270 | + } |
|
271 | + |
|
272 | + /** |
|
273 | + * Sanitize login widget form values as they are saved. |
|
274 | + * |
|
275 | + * @since 1.0.0 |
|
276 | + * @since 1.5.1 Declare function public. |
|
277 | + * |
|
278 | + * @param array $new_instance Values just sent to be saved. |
|
279 | + * @param array $old_instance Previously saved values from database. |
|
280 | + * |
|
281 | + * @return array Updated safe values to be saved. |
|
282 | + */ |
|
283 | + public function update($new_instance, $old_instance) |
|
284 | + { |
|
285 | + //save the widget |
|
286 | + $instance = $old_instance; |
|
287 | + $instance['title'] = strip_tags($new_instance['title']); |
|
288 | + |
|
289 | + return $instance; |
|
290 | + } |
|
291 | + |
|
292 | + /** |
|
293 | + * Back-end login widget settings form. |
|
294 | + * |
|
295 | + * @since 1.0.0 |
|
296 | + * @since 1.5.1 Declare function public. |
|
297 | + * |
|
298 | + * @param array $instance Previously saved values from database. |
|
299 | + * @return string|void |
|
300 | + */ |
|
301 | + public function form($instance) |
|
302 | + { |
|
303 | + //widgetform in backend |
|
304 | + $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => '')); |
|
305 | + $title = strip_tags($instance['title']); |
|
306 | + |
|
307 | + ?> |
|
308 | 308 | <p><label |
309 | 309 | for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Widget Title', 'geodirectory'); ?> |
310 | 310 | : <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" |
@@ -313,64 +313,64 @@ discard block |
||
313 | 313 | |
314 | 314 | |
315 | 315 | <?php |
316 | - } |
|
317 | - } |
|
318 | - |
|
319 | - register_widget('geodir_loginwidget'); |
|
320 | - |
|
321 | - |
|
322 | - /** |
|
323 | - * GeoDirectory Social Like Widget. |
|
324 | - * |
|
325 | - * @since 1.0.0 |
|
326 | - */ |
|
327 | - class geodir_social_like_widget extends WP_Widget |
|
328 | - { |
|
329 | - |
|
330 | - /** |
|
331 | - * Register the social like widget with WordPress. |
|
332 | - * |
|
333 | - * @since 1.0.0 |
|
334 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
335 | - */ |
|
336 | - public function __construct() { |
|
337 | - $widget_ops = array('classname' => 'geodir_social_like_widget', 'description' => __('GD > Twitter,Facebook and Google+ buttons', 'geodirectory')); |
|
338 | - parent::__construct( |
|
339 | - 'social_like_widget', // Base ID |
|
340 | - __('GD > Social Like', 'geodirectory'), // Name |
|
341 | - $widget_ops// Args |
|
342 | - ); |
|
343 | - } |
|
344 | - |
|
345 | - /** |
|
346 | - * Front-end display content for social like widget. |
|
347 | - * |
|
348 | - * @since 1.0.0 |
|
349 | - * @since 1.5.1 Declare function public. |
|
350 | - * |
|
351 | - * @param array $args Widget arguments. |
|
352 | - * @param array $instance Saved values from database. |
|
353 | - */ |
|
354 | - public function widget($args, $instance) |
|
355 | - { |
|
356 | - // prints the widget |
|
357 | - extract($args, EXTR_SKIP); |
|
358 | - |
|
359 | - /** |
|
360 | - * Filter the widget title text. |
|
361 | - * |
|
362 | - * @since 1.0.0 |
|
363 | - * @global object $current_user Current user object. |
|
364 | - * @param string $title The widget title text. |
|
365 | - */ |
|
366 | - $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']); |
|
367 | - |
|
368 | - global $current_user, $post; |
|
369 | - echo $before_widget; |
|
370 | - ?> |
|
316 | + } |
|
317 | + } |
|
318 | + |
|
319 | + register_widget('geodir_loginwidget'); |
|
320 | + |
|
321 | + |
|
322 | + /** |
|
323 | + * GeoDirectory Social Like Widget. |
|
324 | + * |
|
325 | + * @since 1.0.0 |
|
326 | + */ |
|
327 | + class geodir_social_like_widget extends WP_Widget |
|
328 | + { |
|
329 | + |
|
330 | + /** |
|
331 | + * Register the social like widget with WordPress. |
|
332 | + * |
|
333 | + * @since 1.0.0 |
|
334 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
335 | + */ |
|
336 | + public function __construct() { |
|
337 | + $widget_ops = array('classname' => 'geodir_social_like_widget', 'description' => __('GD > Twitter,Facebook and Google+ buttons', 'geodirectory')); |
|
338 | + parent::__construct( |
|
339 | + 'social_like_widget', // Base ID |
|
340 | + __('GD > Social Like', 'geodirectory'), // Name |
|
341 | + $widget_ops// Args |
|
342 | + ); |
|
343 | + } |
|
344 | + |
|
345 | + /** |
|
346 | + * Front-end display content for social like widget. |
|
347 | + * |
|
348 | + * @since 1.0.0 |
|
349 | + * @since 1.5.1 Declare function public. |
|
350 | + * |
|
351 | + * @param array $args Widget arguments. |
|
352 | + * @param array $instance Saved values from database. |
|
353 | + */ |
|
354 | + public function widget($args, $instance) |
|
355 | + { |
|
356 | + // prints the widget |
|
357 | + extract($args, EXTR_SKIP); |
|
358 | + |
|
359 | + /** |
|
360 | + * Filter the widget title text. |
|
361 | + * |
|
362 | + * @since 1.0.0 |
|
363 | + * @global object $current_user Current user object. |
|
364 | + * @param string $title The widget title text. |
|
365 | + */ |
|
366 | + $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']); |
|
367 | + |
|
368 | + global $current_user, $post; |
|
369 | + echo $before_widget; |
|
370 | + ?> |
|
371 | 371 | |
372 | 372 | <?php //if ( get_option('gd_tweet_button') ) { |
373 | - ?> |
|
373 | + ?> |
|
374 | 374 | |
375 | 375 | <a href="http://twitter.com/share" |
376 | 376 | class="twitter-share-button"><?php _e('Tweet', 'geodirectory');?></a> |
@@ -378,23 +378,23 @@ discard block |
||
378 | 378 | <script type="text/javascript" src="//platform.twitter.com/widgets.js"></script> |
379 | 379 | |
380 | 380 | <?php //} |
381 | - ?> |
|
381 | + ?> |
|
382 | 382 | |
383 | 383 | <?php // if ( get_option('gd_facebook_button') ) { |
384 | - ?> |
|
384 | + ?> |
|
385 | 385 | |
386 | 386 | <iframe <?php if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) { |
387 | - echo 'allowtransparency="true"'; |
|
388 | - }?> class="facebook" |
|
387 | + echo 'allowtransparency="true"'; |
|
388 | + }?> class="facebook" |
|
389 | 389 | src="//www.facebook.com/plugins/like.php?href=<?php echo urlencode(geodir_curPageURL()); ?>&layout=button_count&show_faces=false&width=100&action=like&colorscheme=light" |
390 | 390 | style="border:none; overflow:hidden; width:100px; height:20px"></iframe> |
391 | 391 | |
392 | 392 | |
393 | 393 | <?php //} |
394 | - ?> |
|
394 | + ?> |
|
395 | 395 | |
396 | 396 | <?php //if ( get_option('gd_google_button') ) { |
397 | - ?> |
|
397 | + ?> |
|
398 | 398 | <script> |
399 | 399 | window.___gcfg = { |
400 | 400 | parsetags: 'explicit' |
@@ -408,118 +408,118 @@ discard block |
||
408 | 408 | "count": "true" |
409 | 409 | });</script> |
410 | 410 | <?php //} |
411 | - echo $after_widget; |
|
412 | - |
|
413 | - } |
|
414 | - |
|
415 | - /** |
|
416 | - * Sanitize social like widget form values as they are saved. |
|
417 | - * |
|
418 | - * @since 1.0.0 |
|
419 | - * @since 1.5.1 Declare function public. |
|
420 | - * |
|
421 | - * @param array $new_instance Values just sent to be saved. |
|
422 | - * @param array $old_instance Previously saved values from database. |
|
423 | - * |
|
424 | - * @return array Updated safe values to be saved. |
|
425 | - */ |
|
426 | - public function update($new_instance, $old_instance) |
|
427 | - { |
|
428 | - //save the widget |
|
429 | - $instance = $old_instance; |
|
430 | - $instance['title'] = strip_tags($new_instance['title']); |
|
431 | - return $instance; |
|
432 | - } |
|
433 | - |
|
434 | - /** |
|
435 | - * Back-end social like widget settings form. |
|
436 | - * |
|
437 | - * @since 1.0.0 |
|
438 | - * @since 1.5.1 Declare function public. |
|
439 | - * |
|
440 | - * @param array $instance Previously saved values from database. |
|
441 | - * @return string|void |
|
442 | - */ |
|
443 | - public function form($instance) |
|
444 | - { |
|
445 | - //widgetform in backend |
|
446 | - $instance = wp_parse_args((array)$instance, array('title' => '')); |
|
447 | - $title = strip_tags($instance['title']); |
|
448 | - ?> |
|
411 | + echo $after_widget; |
|
412 | + |
|
413 | + } |
|
414 | + |
|
415 | + /** |
|
416 | + * Sanitize social like widget form values as they are saved. |
|
417 | + * |
|
418 | + * @since 1.0.0 |
|
419 | + * @since 1.5.1 Declare function public. |
|
420 | + * |
|
421 | + * @param array $new_instance Values just sent to be saved. |
|
422 | + * @param array $old_instance Previously saved values from database. |
|
423 | + * |
|
424 | + * @return array Updated safe values to be saved. |
|
425 | + */ |
|
426 | + public function update($new_instance, $old_instance) |
|
427 | + { |
|
428 | + //save the widget |
|
429 | + $instance = $old_instance; |
|
430 | + $instance['title'] = strip_tags($new_instance['title']); |
|
431 | + return $instance; |
|
432 | + } |
|
433 | + |
|
434 | + /** |
|
435 | + * Back-end social like widget settings form. |
|
436 | + * |
|
437 | + * @since 1.0.0 |
|
438 | + * @since 1.5.1 Declare function public. |
|
439 | + * |
|
440 | + * @param array $instance Previously saved values from database. |
|
441 | + * @return string|void |
|
442 | + */ |
|
443 | + public function form($instance) |
|
444 | + { |
|
445 | + //widgetform in backend |
|
446 | + $instance = wp_parse_args((array)$instance, array('title' => '')); |
|
447 | + $title = strip_tags($instance['title']); |
|
448 | + ?> |
|
449 | 449 | <p>No settings for this widget</p> |
450 | 450 | |
451 | 451 | |
452 | 452 | <?php |
453 | - } |
|
454 | - } |
|
455 | - |
|
456 | - register_widget('geodir_social_like_widget'); |
|
457 | - |
|
458 | - |
|
459 | - /** |
|
460 | - * GeoDirectory Feedburner Subscribe widget. |
|
461 | - * |
|
462 | - * @since 1.0.0 |
|
463 | - */ |
|
464 | - class geodirsubscribeWidget extends WP_Widget |
|
465 | - { |
|
466 | - |
|
467 | - /** |
|
468 | - * Register the feedburner subscribe widget with WordPress. |
|
469 | - * |
|
470 | - * @since 1.0.0 |
|
471 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
472 | - */ |
|
473 | - public function __construct() { |
|
474 | - $widget_ops = array('classname' => 'geodir-subscribe', 'description' => __('GD > Google Feedburner Subscribe', 'geodirectory')); |
|
475 | - parent::__construct( |
|
476 | - 'widget_subscribeWidget', // Base ID |
|
477 | - __('GD > Subscribe', 'geodirectory'), // Name |
|
478 | - $widget_ops// Args |
|
479 | - ); |
|
480 | - } |
|
481 | - |
|
482 | - /** |
|
483 | - * Front-end display content for feedburner subscribe widget. |
|
484 | - * |
|
485 | - * @since 1.0.0 |
|
486 | - * @since 1.5.1 Declare function public. |
|
487 | - * |
|
488 | - * @param array $args Widget arguments. |
|
489 | - * @param array $instance Saved values from database. |
|
490 | - */ |
|
491 | - public function widget($args, $instance) |
|
492 | - { |
|
493 | - // prints the widget |
|
494 | - extract($args, EXTR_SKIP); |
|
495 | - |
|
496 | - /** |
|
497 | - * Filter the widget instance id. |
|
498 | - * |
|
499 | - * @since 1.0.0 |
|
500 | - * @param string $id The widget instance id. |
|
501 | - */ |
|
502 | - $id = empty($instance['id']) ? '' : apply_filters('widget_id', $instance['id']); |
|
503 | - |
|
504 | - /** This filter is documented in geodirectory_widgets.php */ |
|
505 | - $title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory')); |
|
506 | - |
|
507 | - /** |
|
508 | - * Filter the widget text. |
|
509 | - * |
|
510 | - * @since 1.0.0 |
|
511 | - * @param string $text The widget text. |
|
512 | - */ |
|
513 | - $text = empty($instance['text']) ? '' : apply_filters('widget_text', $instance['text']); |
|
514 | - |
|
515 | - echo $before_widget; |
|
516 | - ?> |
|
453 | + } |
|
454 | + } |
|
455 | + |
|
456 | + register_widget('geodir_social_like_widget'); |
|
457 | + |
|
458 | + |
|
459 | + /** |
|
460 | + * GeoDirectory Feedburner Subscribe widget. |
|
461 | + * |
|
462 | + * @since 1.0.0 |
|
463 | + */ |
|
464 | + class geodirsubscribeWidget extends WP_Widget |
|
465 | + { |
|
466 | + |
|
467 | + /** |
|
468 | + * Register the feedburner subscribe widget with WordPress. |
|
469 | + * |
|
470 | + * @since 1.0.0 |
|
471 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
472 | + */ |
|
473 | + public function __construct() { |
|
474 | + $widget_ops = array('classname' => 'geodir-subscribe', 'description' => __('GD > Google Feedburner Subscribe', 'geodirectory')); |
|
475 | + parent::__construct( |
|
476 | + 'widget_subscribeWidget', // Base ID |
|
477 | + __('GD > Subscribe', 'geodirectory'), // Name |
|
478 | + $widget_ops// Args |
|
479 | + ); |
|
480 | + } |
|
481 | + |
|
482 | + /** |
|
483 | + * Front-end display content for feedburner subscribe widget. |
|
484 | + * |
|
485 | + * @since 1.0.0 |
|
486 | + * @since 1.5.1 Declare function public. |
|
487 | + * |
|
488 | + * @param array $args Widget arguments. |
|
489 | + * @param array $instance Saved values from database. |
|
490 | + */ |
|
491 | + public function widget($args, $instance) |
|
492 | + { |
|
493 | + // prints the widget |
|
494 | + extract($args, EXTR_SKIP); |
|
495 | + |
|
496 | + /** |
|
497 | + * Filter the widget instance id. |
|
498 | + * |
|
499 | + * @since 1.0.0 |
|
500 | + * @param string $id The widget instance id. |
|
501 | + */ |
|
502 | + $id = empty($instance['id']) ? '' : apply_filters('widget_id', $instance['id']); |
|
503 | + |
|
504 | + /** This filter is documented in geodirectory_widgets.php */ |
|
505 | + $title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory')); |
|
506 | + |
|
507 | + /** |
|
508 | + * Filter the widget text. |
|
509 | + * |
|
510 | + * @since 1.0.0 |
|
511 | + * @param string $text The widget text. |
|
512 | + */ |
|
513 | + $text = empty($instance['text']) ? '' : apply_filters('widget_text', $instance['text']); |
|
514 | + |
|
515 | + echo $before_widget; |
|
516 | + ?> |
|
517 | 517 | |
518 | 518 | <?php echo $before_title . $title; ?> <a href="<?php if ($id) { |
519 | - echo 'http://feeds2.feedburner.com/' . $id; |
|
520 | - } else { |
|
521 | - bloginfo('rss_url'); |
|
522 | - } ?>"><i class="fa fa-rss-square"></i> </a><?php echo $after_title;?> |
|
519 | + echo 'http://feeds2.feedburner.com/' . $id; |
|
520 | + } else { |
|
521 | + bloginfo('rss_url'); |
|
522 | + } ?>"><i class="fa fa-rss-square"></i> </a><?php echo $after_title;?> |
|
523 | 523 | |
524 | 524 | <?php if ($text <> "") { ?> |
525 | 525 | |
@@ -544,57 +544,57 @@ discard block |
||
544 | 544 | </form> |
545 | 545 | |
546 | 546 | <?php |
547 | - echo $after_widget; |
|
547 | + echo $after_widget; |
|
548 | 548 | |
549 | - } |
|
549 | + } |
|
550 | 550 | |
551 | - /** |
|
552 | - * Sanitize feedburner subscribe widget form values as they are saved. |
|
553 | - * |
|
554 | - * @since 1.0.0 |
|
555 | - * @since 1.5.1 Declare function public. |
|
556 | - * |
|
557 | - * @param array $new_instance Values just sent to be saved. |
|
558 | - * @param array $old_instance Previously saved values from database. |
|
559 | - * |
|
560 | - * @return array Updated safe values to be saved. |
|
561 | - */ |
|
562 | - public function update($new_instance, $old_instance) |
|
563 | - { |
|
551 | + /** |
|
552 | + * Sanitize feedburner subscribe widget form values as they are saved. |
|
553 | + * |
|
554 | + * @since 1.0.0 |
|
555 | + * @since 1.5.1 Declare function public. |
|
556 | + * |
|
557 | + * @param array $new_instance Values just sent to be saved. |
|
558 | + * @param array $old_instance Previously saved values from database. |
|
559 | + * |
|
560 | + * @return array Updated safe values to be saved. |
|
561 | + */ |
|
562 | + public function update($new_instance, $old_instance) |
|
563 | + { |
|
564 | 564 | |
565 | - //save the widget |
|
566 | - $instance = $old_instance; |
|
567 | - $instance['id'] = strip_tags($new_instance['id']); |
|
568 | - $instance['title'] = ($new_instance['title']); |
|
569 | - $instance['text'] = ($new_instance['text']); |
|
565 | + //save the widget |
|
566 | + $instance = $old_instance; |
|
567 | + $instance['id'] = strip_tags($new_instance['id']); |
|
568 | + $instance['title'] = ($new_instance['title']); |
|
569 | + $instance['text'] = ($new_instance['text']); |
|
570 | 570 | |
571 | 571 | |
572 | - return $instance; |
|
573 | - } |
|
572 | + return $instance; |
|
573 | + } |
|
574 | 574 | |
575 | - /** |
|
576 | - * Back-end feedburner subscribe widget settings form. |
|
577 | - * |
|
578 | - * @since 1.0.0 |
|
579 | - * @since 1.5.1 Declare function public. |
|
580 | - * |
|
581 | - * @param array $instance Previously saved values from database. |
|
582 | - * @return string|void |
|
583 | - */ |
|
584 | - public function form($instance) |
|
585 | - { |
|
586 | - //widgetform in backend |
|
587 | - $instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'advt1' => '', 'text' => '', 'twitter' => '', 'facebook' => '', 'digg' => '', 'myspace' => '')); |
|
575 | + /** |
|
576 | + * Back-end feedburner subscribe widget settings form. |
|
577 | + * |
|
578 | + * @since 1.0.0 |
|
579 | + * @since 1.5.1 Declare function public. |
|
580 | + * |
|
581 | + * @param array $instance Previously saved values from database. |
|
582 | + * @return string|void |
|
583 | + */ |
|
584 | + public function form($instance) |
|
585 | + { |
|
586 | + //widgetform in backend |
|
587 | + $instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'advt1' => '', 'text' => '', 'twitter' => '', 'facebook' => '', 'digg' => '', 'myspace' => '')); |
|
588 | 588 | |
589 | - $id = strip_tags($instance['id']); |
|
589 | + $id = strip_tags($instance['id']); |
|
590 | 590 | |
591 | - $title = strip_tags($instance['title']); |
|
591 | + $title = strip_tags($instance['title']); |
|
592 | 592 | |
593 | - $text = strip_tags($instance['text']); |
|
593 | + $text = strip_tags($instance['text']); |
|
594 | 594 | |
595 | 595 | |
596 | 596 | |
597 | - ?> |
|
597 | + ?> |
|
598 | 598 | <p><label |
599 | 599 | for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title', 'geodirectory');?>: |
600 | 600 | <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" |
@@ -613,101 +613,101 @@ discard block |
||
613 | 613 | name="<?php echo $this->get_field_name('text'); ?>"><?php echo esc_attr($text); ?></textarea></label> |
614 | 614 | </p> |
615 | 615 | <?php |
616 | - } |
|
617 | - } |
|
618 | - |
|
619 | - register_widget('geodirsubscribeWidget'); |
|
620 | - |
|
621 | - /** |
|
622 | - * GeoDirectory advertise widget. |
|
623 | - * |
|
624 | - * @since 1.0.0 |
|
625 | - */ |
|
626 | - class geodiradvtwidget extends WP_Widget |
|
627 | - { |
|
628 | - |
|
629 | - /** |
|
630 | - * Register the advertise widget with WordPress. |
|
631 | - * |
|
632 | - * @since 1.0.0 |
|
633 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
634 | - */ |
|
635 | - public function __construct() { |
|
636 | - $widget_ops = array('classname' => 'GeoDirectory Advertise', 'description' => __('GD > common advertise widget in sidebar, bottom section', 'geodirectory')); |
|
637 | - parent::__construct( |
|
638 | - 'advtwidget', // Base ID |
|
639 | - __('GD > Advertise', 'geodirectory'), // Name |
|
640 | - $widget_ops// Args |
|
641 | - ); |
|
642 | - } |
|
643 | - |
|
644 | - |
|
645 | - /** |
|
646 | - * Front-end display content for advertise widget. |
|
647 | - * |
|
648 | - * @since 1.0.0 |
|
649 | - * @since 1.5.1 Declare function public. |
|
650 | - * |
|
651 | - * @param array $args Widget arguments. |
|
652 | - * @param array $instance Saved values from database. |
|
653 | - */ |
|
654 | - public function widget($args, $instance) |
|
655 | - { |
|
656 | - |
|
657 | - // prints the widget |
|
658 | - |
|
659 | - extract($args, EXTR_SKIP); |
|
660 | - |
|
661 | - /** |
|
662 | - * Filter the description text. |
|
663 | - * |
|
664 | - * @since 1.0.0 |
|
665 | - * @param string $desc1 The widget description text. |
|
666 | - */ |
|
667 | - $desc1 = empty($instance['desc1']) ? ' ' : apply_filters('widget_desc1', $instance['desc1']); |
|
668 | - echo $before_widget; |
|
669 | - ?> |
|
616 | + } |
|
617 | + } |
|
618 | + |
|
619 | + register_widget('geodirsubscribeWidget'); |
|
620 | + |
|
621 | + /** |
|
622 | + * GeoDirectory advertise widget. |
|
623 | + * |
|
624 | + * @since 1.0.0 |
|
625 | + */ |
|
626 | + class geodiradvtwidget extends WP_Widget |
|
627 | + { |
|
628 | + |
|
629 | + /** |
|
630 | + * Register the advertise widget with WordPress. |
|
631 | + * |
|
632 | + * @since 1.0.0 |
|
633 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
634 | + */ |
|
635 | + public function __construct() { |
|
636 | + $widget_ops = array('classname' => 'GeoDirectory Advertise', 'description' => __('GD > common advertise widget in sidebar, bottom section', 'geodirectory')); |
|
637 | + parent::__construct( |
|
638 | + 'advtwidget', // Base ID |
|
639 | + __('GD > Advertise', 'geodirectory'), // Name |
|
640 | + $widget_ops// Args |
|
641 | + ); |
|
642 | + } |
|
643 | + |
|
644 | + |
|
645 | + /** |
|
646 | + * Front-end display content for advertise widget. |
|
647 | + * |
|
648 | + * @since 1.0.0 |
|
649 | + * @since 1.5.1 Declare function public. |
|
650 | + * |
|
651 | + * @param array $args Widget arguments. |
|
652 | + * @param array $instance Saved values from database. |
|
653 | + */ |
|
654 | + public function widget($args, $instance) |
|
655 | + { |
|
656 | + |
|
657 | + // prints the widget |
|
658 | + |
|
659 | + extract($args, EXTR_SKIP); |
|
660 | + |
|
661 | + /** |
|
662 | + * Filter the description text. |
|
663 | + * |
|
664 | + * @since 1.0.0 |
|
665 | + * @param string $desc1 The widget description text. |
|
666 | + */ |
|
667 | + $desc1 = empty($instance['desc1']) ? ' ' : apply_filters('widget_desc1', $instance['desc1']); |
|
668 | + echo $before_widget; |
|
669 | + ?> |
|
670 | 670 | <?php if ($desc1 <> "") { ?> |
671 | 671 | <?php echo $desc1; ?> |
672 | 672 | <?php } |
673 | - echo $after_widget; |
|
674 | - } |
|
675 | - |
|
676 | - /** |
|
677 | - * Sanitize advertise widget form values as they are saved. |
|
678 | - * |
|
679 | - * @since 1.0.0 |
|
680 | - * @since 1.5.1 Declare function public. |
|
681 | - * |
|
682 | - * @param array $new_instance Values just sent to be saved. |
|
683 | - * @param array $old_instance Previously saved values from database. |
|
684 | - * |
|
685 | - * @return array Updated safe values to be saved. |
|
686 | - */ |
|
687 | - public function update($new_instance, $old_instance) |
|
688 | - { |
|
689 | - //save the widget |
|
690 | - $instance = $old_instance; |
|
691 | - $instance['desc1'] = ($new_instance['desc1']); |
|
692 | - return $instance; |
|
693 | - } |
|
694 | - |
|
695 | - /** |
|
696 | - * Back-end advertise widget settings form. |
|
697 | - * |
|
698 | - * @since 1.0.0 |
|
699 | - * @since 1.5.1 Declare function public. |
|
700 | - * |
|
701 | - * @param array $instance Previously saved values from database. |
|
702 | - * @return string|void |
|
703 | - */ |
|
704 | - public function form($instance) |
|
705 | - { |
|
706 | - //widgetform in backend |
|
707 | - $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => '')); |
|
708 | - |
|
709 | - $desc1 = ($instance['desc1']); |
|
710 | - ?> |
|
673 | + echo $after_widget; |
|
674 | + } |
|
675 | + |
|
676 | + /** |
|
677 | + * Sanitize advertise widget form values as they are saved. |
|
678 | + * |
|
679 | + * @since 1.0.0 |
|
680 | + * @since 1.5.1 Declare function public. |
|
681 | + * |
|
682 | + * @param array $new_instance Values just sent to be saved. |
|
683 | + * @param array $old_instance Previously saved values from database. |
|
684 | + * |
|
685 | + * @return array Updated safe values to be saved. |
|
686 | + */ |
|
687 | + public function update($new_instance, $old_instance) |
|
688 | + { |
|
689 | + //save the widget |
|
690 | + $instance = $old_instance; |
|
691 | + $instance['desc1'] = ($new_instance['desc1']); |
|
692 | + return $instance; |
|
693 | + } |
|
694 | + |
|
695 | + /** |
|
696 | + * Back-end advertise widget settings form. |
|
697 | + * |
|
698 | + * @since 1.0.0 |
|
699 | + * @since 1.5.1 Declare function public. |
|
700 | + * |
|
701 | + * @param array $instance Previously saved values from database. |
|
702 | + * @return string|void |
|
703 | + */ |
|
704 | + public function form($instance) |
|
705 | + { |
|
706 | + //widgetform in backend |
|
707 | + $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => '')); |
|
708 | + |
|
709 | + $desc1 = ($instance['desc1']); |
|
710 | + ?> |
|
711 | 711 | <p><label |
712 | 712 | for="<?php echo $this->get_field_id('desc1'); ?>"><?php _e('Your Advt code (ex.google adsense, etc.)', 'geodirectory');?> |
713 | 713 | <textarea class="widefat" rows="6" cols="20" id="<?php echo $this->get_field_id('desc1'); ?>" |
@@ -715,65 +715,65 @@ discard block |
||
715 | 715 | </p> |
716 | 716 | |
717 | 717 | <?php |
718 | - } |
|
719 | - } |
|
720 | - |
|
721 | - register_widget('geodiradvtwidget'); |
|
722 | - |
|
723 | - /** |
|
724 | - * GeoDirectory Flickr widget. |
|
725 | - * |
|
726 | - * @since 1.0.0 |
|
727 | - */ |
|
728 | - class GeodirFlickrWidget extends WP_Widget |
|
729 | - { |
|
730 | - |
|
731 | - /** |
|
732 | - * Register the flickr widget with WordPress. |
|
733 | - * |
|
734 | - * @since 1.0.0 |
|
735 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
736 | - */ |
|
737 | - public function __construct() { |
|
738 | - $widget_ops = array('classname' => 'Geo Dir Flickr Photos ', 'description' => __('GD > Flickr Photos', 'geodirectory')); |
|
739 | - parent::__construct( |
|
740 | - 'widget_flickrwidget', // Base ID |
|
741 | - __('GD > Flickr Photos', 'geodirectory'), // Name |
|
742 | - $widget_ops// Args |
|
743 | - ); |
|
744 | - } |
|
745 | - |
|
746 | - /** |
|
747 | - * Front-end display content for flickr widget. |
|
748 | - * |
|
749 | - * @since 1.0.0 |
|
750 | - * @since 1.5.1 Declare function public. |
|
751 | - * |
|
752 | - * @param array $args Widget arguments. |
|
753 | - * @param array $instance Saved values from database. |
|
754 | - */ |
|
755 | - public function widget($args, $instance) |
|
756 | - { |
|
757 | - |
|
758 | - // prints the widget |
|
759 | - extract($args, EXTR_SKIP); |
|
760 | - |
|
761 | - echo $before_widget; |
|
762 | - |
|
763 | - /** This filter is documented in geodirectory_widgets.php */ |
|
764 | - $id = empty($instance['id']) ? ' ' : apply_filters('widget_id', $instance['id']); |
|
765 | - |
|
766 | - /** |
|
767 | - * Filter the widget number. |
|
768 | - * |
|
769 | - * This is used in the flicker widget to show how many images to show. |
|
770 | - * |
|
771 | - * @since 1.0.0 |
|
772 | - * @param string $number The image count. |
|
773 | - */ |
|
774 | - $number = empty($instance['number']) ? ' ' : apply_filters('widget_number', $instance['number']); |
|
775 | - echo $before_title . __('Photo Gallery', 'geodirectory') . $after_title; |
|
776 | - ?> |
|
718 | + } |
|
719 | + } |
|
720 | + |
|
721 | + register_widget('geodiradvtwidget'); |
|
722 | + |
|
723 | + /** |
|
724 | + * GeoDirectory Flickr widget. |
|
725 | + * |
|
726 | + * @since 1.0.0 |
|
727 | + */ |
|
728 | + class GeodirFlickrWidget extends WP_Widget |
|
729 | + { |
|
730 | + |
|
731 | + /** |
|
732 | + * Register the flickr widget with WordPress. |
|
733 | + * |
|
734 | + * @since 1.0.0 |
|
735 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
736 | + */ |
|
737 | + public function __construct() { |
|
738 | + $widget_ops = array('classname' => 'Geo Dir Flickr Photos ', 'description' => __('GD > Flickr Photos', 'geodirectory')); |
|
739 | + parent::__construct( |
|
740 | + 'widget_flickrwidget', // Base ID |
|
741 | + __('GD > Flickr Photos', 'geodirectory'), // Name |
|
742 | + $widget_ops// Args |
|
743 | + ); |
|
744 | + } |
|
745 | + |
|
746 | + /** |
|
747 | + * Front-end display content for flickr widget. |
|
748 | + * |
|
749 | + * @since 1.0.0 |
|
750 | + * @since 1.5.1 Declare function public. |
|
751 | + * |
|
752 | + * @param array $args Widget arguments. |
|
753 | + * @param array $instance Saved values from database. |
|
754 | + */ |
|
755 | + public function widget($args, $instance) |
|
756 | + { |
|
757 | + |
|
758 | + // prints the widget |
|
759 | + extract($args, EXTR_SKIP); |
|
760 | + |
|
761 | + echo $before_widget; |
|
762 | + |
|
763 | + /** This filter is documented in geodirectory_widgets.php */ |
|
764 | + $id = empty($instance['id']) ? ' ' : apply_filters('widget_id', $instance['id']); |
|
765 | + |
|
766 | + /** |
|
767 | + * Filter the widget number. |
|
768 | + * |
|
769 | + * This is used in the flicker widget to show how many images to show. |
|
770 | + * |
|
771 | + * @since 1.0.0 |
|
772 | + * @param string $number The image count. |
|
773 | + */ |
|
774 | + $number = empty($instance['number']) ? ' ' : apply_filters('widget_number', $instance['number']); |
|
775 | + echo $before_title . __('Photo Gallery', 'geodirectory') . $after_title; |
|
776 | + ?> |
|
777 | 777 | |
778 | 778 | <div class="geodir-flickr clearfix"> |
779 | 779 | |
@@ -784,45 +784,45 @@ discard block |
||
784 | 784 | |
785 | 785 | |
786 | 786 | <?php echo $after_widget; |
787 | - } |
|
788 | - |
|
789 | - /** |
|
790 | - * Sanitize flickr widget form values as they are saved. |
|
791 | - * |
|
792 | - * @since 1.0.0 |
|
793 | - * @since 1.5.1 Declare function public. |
|
794 | - * |
|
795 | - * @param array $new_instance Values just sent to be saved. |
|
796 | - * @param array $old_instance Previously saved values from database. |
|
797 | - * |
|
798 | - * @return array Updated safe values to be saved. |
|
799 | - */ |
|
800 | - public function update($new_instance, $old_instance) |
|
801 | - { |
|
802 | - //save the widget |
|
803 | - $instance = $old_instance; |
|
804 | - $instance['id'] = strip_tags($new_instance['id']); |
|
805 | - $instance['number'] = strip_tags($new_instance['number']); |
|
806 | - return $instance; |
|
807 | - } |
|
808 | - |
|
809 | - /** |
|
810 | - * Back-end flickr widget settings form. |
|
811 | - * |
|
812 | - * @since 1.0.0 |
|
813 | - * @since 1.5.1 Declare function public. |
|
814 | - * |
|
815 | - * @param array $instance Previously saved values from database. |
|
816 | - * @return string|void |
|
817 | - */ |
|
818 | - public function form($instance) |
|
819 | - { |
|
820 | - |
|
821 | - //widgetform in backend |
|
822 | - $instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'number' => '')); |
|
823 | - $id = strip_tags($instance['id']); |
|
824 | - $number = strip_tags($instance['number']); |
|
825 | - ?> |
|
787 | + } |
|
788 | + |
|
789 | + /** |
|
790 | + * Sanitize flickr widget form values as they are saved. |
|
791 | + * |
|
792 | + * @since 1.0.0 |
|
793 | + * @since 1.5.1 Declare function public. |
|
794 | + * |
|
795 | + * @param array $new_instance Values just sent to be saved. |
|
796 | + * @param array $old_instance Previously saved values from database. |
|
797 | + * |
|
798 | + * @return array Updated safe values to be saved. |
|
799 | + */ |
|
800 | + public function update($new_instance, $old_instance) |
|
801 | + { |
|
802 | + //save the widget |
|
803 | + $instance = $old_instance; |
|
804 | + $instance['id'] = strip_tags($new_instance['id']); |
|
805 | + $instance['number'] = strip_tags($new_instance['number']); |
|
806 | + return $instance; |
|
807 | + } |
|
808 | + |
|
809 | + /** |
|
810 | + * Back-end flickr widget settings form. |
|
811 | + * |
|
812 | + * @since 1.0.0 |
|
813 | + * @since 1.5.1 Declare function public. |
|
814 | + * |
|
815 | + * @param array $instance Previously saved values from database. |
|
816 | + * @return string|void |
|
817 | + */ |
|
818 | + public function form($instance) |
|
819 | + { |
|
820 | + |
|
821 | + //widgetform in backend |
|
822 | + $instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'number' => '')); |
|
823 | + $id = strip_tags($instance['id']); |
|
824 | + $number = strip_tags($instance['number']); |
|
825 | + ?> |
|
826 | 826 | |
827 | 827 | <p> |
828 | 828 | <label |
@@ -843,99 +843,99 @@ discard block |
||
843 | 843 | </label> |
844 | 844 | </p> |
845 | 845 | <?php |
846 | - } |
|
847 | - } |
|
848 | - |
|
849 | - register_widget('GeodirFlickrWidget'); |
|
850 | - |
|
851 | - /** |
|
852 | - * GeoDirectory Twitter widget. |
|
853 | - * |
|
854 | - * @since 1.0.0 |
|
855 | - */ |
|
856 | - class geodir_twitter extends WP_Widget |
|
857 | - { |
|
858 | - /** |
|
859 | - * Register the Twitter widget with WordPress. |
|
860 | - * |
|
861 | - * @since 1.0.0 |
|
862 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
863 | - */ |
|
864 | - public function __construct() { |
|
865 | - $widget_ops = array('classname' => 'Twitter', 'description' => __('GD > Twitter Feed', 'geodirectory')); |
|
866 | - parent::__construct( |
|
867 | - 'widget_Twidget', // Base ID |
|
868 | - __('GD > Twitter', 'geodirectory'), // Name |
|
869 | - $widget_ops// Args |
|
870 | - ); |
|
871 | - } |
|
872 | - |
|
873 | - |
|
874 | - /** |
|
875 | - * Front-end display content for Twitter widget. |
|
876 | - * |
|
877 | - * @since 1.0.0 |
|
878 | - * @since 1.5.1 Declare function public. |
|
879 | - * |
|
880 | - * @param array $args Widget arguments. |
|
881 | - * @param array $instance Saved values from database. |
|
882 | - */ |
|
883 | - public function widget($args, $instance) |
|
884 | - { |
|
885 | - |
|
886 | - // prints the widget |
|
887 | - |
|
888 | - extract($args, EXTR_SKIP); |
|
889 | - |
|
890 | - /** |
|
891 | - * Filter the twitter widget description text. |
|
892 | - * |
|
893 | - * @since 1.0.0 |
|
894 | - * @param string $desc1 The widget description text. |
|
895 | - */ |
|
896 | - $desc1 = empty($instance['gd_tw_desc1']) ? ' ' : apply_filters('gd_tw_widget_desc1', $instance['gd_tw_desc1']); |
|
897 | - echo $before_widget; |
|
898 | - if ($desc1 <> "") { |
|
899 | - echo $desc1; |
|
900 | - } |
|
901 | - echo $after_widget; |
|
902 | - } |
|
903 | - |
|
904 | - /** |
|
905 | - * Sanitize twitter widget form values as they are saved. |
|
906 | - * |
|
907 | - * @since 1.0.0 |
|
908 | - * @since 1.5.1 Declare function public. |
|
909 | - * |
|
910 | - * @param array $new_instance Values just sent to be saved. |
|
911 | - * @param array $old_instance Previously saved values from database. |
|
912 | - * |
|
913 | - * @return array Updated safe values to be saved. |
|
914 | - */ |
|
915 | - public function update($new_instance, $old_instance) |
|
916 | - { |
|
917 | - //save the widget |
|
918 | - $instance = $old_instance; |
|
919 | - $instance['gd_tw_desc1'] = ($new_instance['gd_tw_desc1']); |
|
920 | - return $instance; |
|
921 | - } |
|
922 | - |
|
923 | - /** |
|
924 | - * Back-end twitter widget settings form. |
|
925 | - * |
|
926 | - * @since 1.0.0 |
|
927 | - * @since 1.5.1 Declare function public. |
|
928 | - * |
|
929 | - * @param array $instance Previously saved values from database. |
|
930 | - * @return string|void |
|
931 | - */ |
|
932 | - public function form($instance) |
|
933 | - { |
|
934 | - //widgetform in backend |
|
935 | - $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'gd_tw_desc1' => '')); |
|
936 | - |
|
937 | - $desc1 = ($instance['gd_tw_desc1']); |
|
938 | - ?> |
|
846 | + } |
|
847 | + } |
|
848 | + |
|
849 | + register_widget('GeodirFlickrWidget'); |
|
850 | + |
|
851 | + /** |
|
852 | + * GeoDirectory Twitter widget. |
|
853 | + * |
|
854 | + * @since 1.0.0 |
|
855 | + */ |
|
856 | + class geodir_twitter extends WP_Widget |
|
857 | + { |
|
858 | + /** |
|
859 | + * Register the Twitter widget with WordPress. |
|
860 | + * |
|
861 | + * @since 1.0.0 |
|
862 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
863 | + */ |
|
864 | + public function __construct() { |
|
865 | + $widget_ops = array('classname' => 'Twitter', 'description' => __('GD > Twitter Feed', 'geodirectory')); |
|
866 | + parent::__construct( |
|
867 | + 'widget_Twidget', // Base ID |
|
868 | + __('GD > Twitter', 'geodirectory'), // Name |
|
869 | + $widget_ops// Args |
|
870 | + ); |
|
871 | + } |
|
872 | + |
|
873 | + |
|
874 | + /** |
|
875 | + * Front-end display content for Twitter widget. |
|
876 | + * |
|
877 | + * @since 1.0.0 |
|
878 | + * @since 1.5.1 Declare function public. |
|
879 | + * |
|
880 | + * @param array $args Widget arguments. |
|
881 | + * @param array $instance Saved values from database. |
|
882 | + */ |
|
883 | + public function widget($args, $instance) |
|
884 | + { |
|
885 | + |
|
886 | + // prints the widget |
|
887 | + |
|
888 | + extract($args, EXTR_SKIP); |
|
889 | + |
|
890 | + /** |
|
891 | + * Filter the twitter widget description text. |
|
892 | + * |
|
893 | + * @since 1.0.0 |
|
894 | + * @param string $desc1 The widget description text. |
|
895 | + */ |
|
896 | + $desc1 = empty($instance['gd_tw_desc1']) ? ' ' : apply_filters('gd_tw_widget_desc1', $instance['gd_tw_desc1']); |
|
897 | + echo $before_widget; |
|
898 | + if ($desc1 <> "") { |
|
899 | + echo $desc1; |
|
900 | + } |
|
901 | + echo $after_widget; |
|
902 | + } |
|
903 | + |
|
904 | + /** |
|
905 | + * Sanitize twitter widget form values as they are saved. |
|
906 | + * |
|
907 | + * @since 1.0.0 |
|
908 | + * @since 1.5.1 Declare function public. |
|
909 | + * |
|
910 | + * @param array $new_instance Values just sent to be saved. |
|
911 | + * @param array $old_instance Previously saved values from database. |
|
912 | + * |
|
913 | + * @return array Updated safe values to be saved. |
|
914 | + */ |
|
915 | + public function update($new_instance, $old_instance) |
|
916 | + { |
|
917 | + //save the widget |
|
918 | + $instance = $old_instance; |
|
919 | + $instance['gd_tw_desc1'] = ($new_instance['gd_tw_desc1']); |
|
920 | + return $instance; |
|
921 | + } |
|
922 | + |
|
923 | + /** |
|
924 | + * Back-end twitter widget settings form. |
|
925 | + * |
|
926 | + * @since 1.0.0 |
|
927 | + * @since 1.5.1 Declare function public. |
|
928 | + * |
|
929 | + * @param array $instance Previously saved values from database. |
|
930 | + * @return string|void |
|
931 | + */ |
|
932 | + public function form($instance) |
|
933 | + { |
|
934 | + //widgetform in backend |
|
935 | + $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'gd_tw_desc1' => '')); |
|
936 | + |
|
937 | + $desc1 = ($instance['gd_tw_desc1']); |
|
938 | + ?> |
|
939 | 939 | <p><label |
940 | 940 | for="<?php echo $this->get_field_id('gd_tw_desc1'); ?>"><?php _e('Your twitter code', 'geodirectory');?> |
941 | 941 | <textarea class="widefat" rows="6" cols="20" |
@@ -944,179 +944,179 @@ discard block |
||
944 | 944 | </p> |
945 | 945 | |
946 | 946 | <?php |
947 | - } |
|
948 | - } |
|
949 | - |
|
950 | - register_widget('geodir_twitter'); |
|
951 | - |
|
952 | - /** |
|
953 | - * GeoDirectory Advanced Search widget. |
|
954 | - * |
|
955 | - * @since 1.0.0 |
|
956 | - */ |
|
957 | - class geodir_advance_search_widget extends WP_Widget |
|
958 | - { |
|
959 | - /** |
|
960 | - * Register the advanced search widget with WordPress. |
|
961 | - * |
|
962 | - * @since 1.0.0 |
|
963 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
964 | - */ |
|
965 | - public function __construct() { |
|
966 | - $widget_ops = array('classname' => 'geodir_advance_search_widget', 'description' => __('GD > Search', 'geodirectory'),'post_type'=>''); |
|
967 | - parent::__construct( |
|
968 | - 'geodir_advance_search', // Base ID |
|
969 | - __('GD > Search', 'geodirectory'), // Name |
|
970 | - $widget_ops// Args |
|
971 | - ); |
|
972 | - } |
|
973 | - |
|
974 | - |
|
975 | - /** |
|
976 | - * Front-end display content for advanced search widget. |
|
977 | - * |
|
978 | - * @since 1.0.0 |
|
979 | - * @since 1.5.1 Declare function public. |
|
980 | - * |
|
981 | - * @param array $args Widget arguments. |
|
982 | - * @param array $instance Saved values from database. |
|
983 | - */ |
|
984 | - public function widget($args, $instance) |
|
985 | - { |
|
986 | - /** |
|
987 | - * Filter the search widget arguments. |
|
988 | - * |
|
989 | - * @since 1.5.7 |
|
990 | - * @param array $args The widget arguments. |
|
991 | - * @param array $instance The widget instance. |
|
992 | - */ |
|
993 | - $args = apply_filters('widget_geodir_advance_search_args',$args,$instance); |
|
994 | - |
|
995 | - // prints the widget |
|
996 | - extract($args, EXTR_SKIP); |
|
997 | - |
|
998 | - if(isset($post_type) && $post_type){ |
|
999 | - geodir_get_search_post_type($post_type);// set the post type |
|
1000 | - }else{ |
|
1001 | - geodir_get_search_post_type();// set the post type |
|
1002 | - } |
|
1003 | - |
|
1004 | - echo $before_widget; |
|
1005 | - |
|
1006 | - /** This filter is documented in geodirectory_widgets.php */ |
|
1007 | - $title = empty($instance['title']) ? __('Search', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory')); |
|
1008 | - |
|
1009 | - geodir_get_template_part('listing', 'filter-form'); |
|
1010 | - |
|
1011 | - echo $after_widget; |
|
1012 | - |
|
1013 | - // after outputing the search reset the CPT |
|
1014 | - global $geodir_search_post_type; |
|
1015 | - $geodir_search_post_type = ''; |
|
1016 | - } |
|
1017 | - |
|
1018 | - /** |
|
1019 | - * Sanitize advanced search widget form values as they are saved. |
|
1020 | - * |
|
1021 | - * @since 1.0.0 |
|
1022 | - * @since 1.5.1 Declare function public. |
|
1023 | - * |
|
1024 | - * @param array $new_instance Values just sent to be saved. |
|
1025 | - * @param array $old_instance Previously saved values from database. |
|
1026 | - * |
|
1027 | - * @return array Updated safe values to be saved. |
|
1028 | - */ |
|
1029 | - public function update($new_instance, $old_instance) |
|
1030 | - { |
|
1031 | - //save the widget |
|
1032 | - //Nothing to save |
|
1033 | - return isset($instance) ? $instance : array(); |
|
1034 | - } |
|
1035 | - |
|
1036 | - /** |
|
1037 | - * Back-end advanced search widget settings form. |
|
1038 | - * |
|
1039 | - * @since 1.0.0 |
|
1040 | - * @since 1.5.1 Declare function public. |
|
1041 | - * |
|
1042 | - * @param array $instance Previously saved values from database. |
|
1043 | - * @return string|void |
|
1044 | - */ |
|
1045 | - public function form($instance) |
|
1046 | - { |
|
1047 | - //widgetform in backend |
|
1048 | - echo __("This is a search widget to show advance search for gedodirectory listings.", 'geodirectory'); |
|
1049 | - } |
|
1050 | - } |
|
1051 | - |
|
1052 | - register_widget('geodir_advance_search_widget'); |
|
1053 | - |
|
1054 | - |
|
1055 | - /** |
|
1056 | - * Contains all functions for popular widget. |
|
1057 | - * |
|
1058 | - * @since 1.0.0 |
|
1059 | - * @package GeoDirectory |
|
1060 | - */ |
|
1061 | - include_once('geodirectory-widgets/geodirectory_popular_widget.php'); |
|
1062 | - /** |
|
1063 | - * Contains all functions for listing slider widget. |
|
1064 | - * |
|
1065 | - * @since 1.0.0 |
|
1066 | - * @package GeoDirectory |
|
1067 | - */ |
|
1068 | - include_once('geodirectory-widgets/geodirectory_listing_slider_widget.php'); |
|
1069 | - /** |
|
1070 | - * Contains all functions for home map widget. |
|
1071 | - * |
|
1072 | - * @since 1.0.0 |
|
1073 | - * @package GeoDirectory |
|
1074 | - */ |
|
1075 | - include_once('geodirectory-widgets/home_map_widget.php'); |
|
1076 | - /** |
|
1077 | - * Contains all functions for listing map widget. |
|
1078 | - * |
|
1079 | - * @since 1.0.0 |
|
1080 | - * @package GeoDirectory |
|
1081 | - */ |
|
1082 | - include_once('geodirectory-widgets/listing_map_widget.php'); |
|
1083 | - /** |
|
1084 | - * Contains all functions for reviews widget. |
|
1085 | - * |
|
1086 | - * @since 1.0.0 |
|
1087 | - * @package GeoDirectory |
|
1088 | - */ |
|
1089 | - include_once('geodirectory-widgets/geodirectory_reviews_widget.php'); |
|
1090 | - /** |
|
1091 | - * Contains all functions for related listing widget. |
|
1092 | - * |
|
1093 | - * @since 1.0.0 |
|
1094 | - * @package GeoDirectory |
|
1095 | - */ |
|
1096 | - include_once('geodirectory-widgets/geodirectory_related_listing_widget.php'); |
|
1097 | - /** |
|
1098 | - * Contains all functions for bestof widget. |
|
1099 | - * |
|
1100 | - * @since 1.0.0 |
|
1101 | - * @package GeoDirectory |
|
1102 | - */ |
|
1103 | - include_once('geodirectory-widgets/geodirectory_bestof_widget.php'); |
|
947 | + } |
|
948 | + } |
|
949 | + |
|
950 | + register_widget('geodir_twitter'); |
|
951 | + |
|
952 | + /** |
|
953 | + * GeoDirectory Advanced Search widget. |
|
954 | + * |
|
955 | + * @since 1.0.0 |
|
956 | + */ |
|
957 | + class geodir_advance_search_widget extends WP_Widget |
|
958 | + { |
|
959 | + /** |
|
960 | + * Register the advanced search widget with WordPress. |
|
961 | + * |
|
962 | + * @since 1.0.0 |
|
963 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
964 | + */ |
|
965 | + public function __construct() { |
|
966 | + $widget_ops = array('classname' => 'geodir_advance_search_widget', 'description' => __('GD > Search', 'geodirectory'),'post_type'=>''); |
|
967 | + parent::__construct( |
|
968 | + 'geodir_advance_search', // Base ID |
|
969 | + __('GD > Search', 'geodirectory'), // Name |
|
970 | + $widget_ops// Args |
|
971 | + ); |
|
972 | + } |
|
973 | + |
|
974 | + |
|
975 | + /** |
|
976 | + * Front-end display content for advanced search widget. |
|
977 | + * |
|
978 | + * @since 1.0.0 |
|
979 | + * @since 1.5.1 Declare function public. |
|
980 | + * |
|
981 | + * @param array $args Widget arguments. |
|
982 | + * @param array $instance Saved values from database. |
|
983 | + */ |
|
984 | + public function widget($args, $instance) |
|
985 | + { |
|
986 | + /** |
|
987 | + * Filter the search widget arguments. |
|
988 | + * |
|
989 | + * @since 1.5.7 |
|
990 | + * @param array $args The widget arguments. |
|
991 | + * @param array $instance The widget instance. |
|
992 | + */ |
|
993 | + $args = apply_filters('widget_geodir_advance_search_args',$args,$instance); |
|
994 | + |
|
995 | + // prints the widget |
|
996 | + extract($args, EXTR_SKIP); |
|
997 | + |
|
998 | + if(isset($post_type) && $post_type){ |
|
999 | + geodir_get_search_post_type($post_type);// set the post type |
|
1000 | + }else{ |
|
1001 | + geodir_get_search_post_type();// set the post type |
|
1002 | + } |
|
1003 | + |
|
1004 | + echo $before_widget; |
|
1005 | + |
|
1006 | + /** This filter is documented in geodirectory_widgets.php */ |
|
1007 | + $title = empty($instance['title']) ? __('Search', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory')); |
|
1008 | + |
|
1009 | + geodir_get_template_part('listing', 'filter-form'); |
|
1010 | + |
|
1011 | + echo $after_widget; |
|
1012 | + |
|
1013 | + // after outputing the search reset the CPT |
|
1014 | + global $geodir_search_post_type; |
|
1015 | + $geodir_search_post_type = ''; |
|
1016 | + } |
|
1017 | + |
|
1018 | + /** |
|
1019 | + * Sanitize advanced search widget form values as they are saved. |
|
1020 | + * |
|
1021 | + * @since 1.0.0 |
|
1022 | + * @since 1.5.1 Declare function public. |
|
1023 | + * |
|
1024 | + * @param array $new_instance Values just sent to be saved. |
|
1025 | + * @param array $old_instance Previously saved values from database. |
|
1026 | + * |
|
1027 | + * @return array Updated safe values to be saved. |
|
1028 | + */ |
|
1029 | + public function update($new_instance, $old_instance) |
|
1030 | + { |
|
1031 | + //save the widget |
|
1032 | + //Nothing to save |
|
1033 | + return isset($instance) ? $instance : array(); |
|
1034 | + } |
|
1035 | + |
|
1036 | + /** |
|
1037 | + * Back-end advanced search widget settings form. |
|
1038 | + * |
|
1039 | + * @since 1.0.0 |
|
1040 | + * @since 1.5.1 Declare function public. |
|
1041 | + * |
|
1042 | + * @param array $instance Previously saved values from database. |
|
1043 | + * @return string|void |
|
1044 | + */ |
|
1045 | + public function form($instance) |
|
1046 | + { |
|
1047 | + //widgetform in backend |
|
1048 | + echo __("This is a search widget to show advance search for gedodirectory listings.", 'geodirectory'); |
|
1049 | + } |
|
1050 | + } |
|
1051 | + |
|
1052 | + register_widget('geodir_advance_search_widget'); |
|
1053 | + |
|
1054 | + |
|
1055 | + /** |
|
1056 | + * Contains all functions for popular widget. |
|
1057 | + * |
|
1058 | + * @since 1.0.0 |
|
1059 | + * @package GeoDirectory |
|
1060 | + */ |
|
1061 | + include_once('geodirectory-widgets/geodirectory_popular_widget.php'); |
|
1062 | + /** |
|
1063 | + * Contains all functions for listing slider widget. |
|
1064 | + * |
|
1065 | + * @since 1.0.0 |
|
1066 | + * @package GeoDirectory |
|
1067 | + */ |
|
1068 | + include_once('geodirectory-widgets/geodirectory_listing_slider_widget.php'); |
|
1069 | + /** |
|
1070 | + * Contains all functions for home map widget. |
|
1071 | + * |
|
1072 | + * @since 1.0.0 |
|
1073 | + * @package GeoDirectory |
|
1074 | + */ |
|
1075 | + include_once('geodirectory-widgets/home_map_widget.php'); |
|
1076 | + /** |
|
1077 | + * Contains all functions for listing map widget. |
|
1078 | + * |
|
1079 | + * @since 1.0.0 |
|
1080 | + * @package GeoDirectory |
|
1081 | + */ |
|
1082 | + include_once('geodirectory-widgets/listing_map_widget.php'); |
|
1083 | + /** |
|
1084 | + * Contains all functions for reviews widget. |
|
1085 | + * |
|
1086 | + * @since 1.0.0 |
|
1087 | + * @package GeoDirectory |
|
1088 | + */ |
|
1089 | + include_once('geodirectory-widgets/geodirectory_reviews_widget.php'); |
|
1090 | + /** |
|
1091 | + * Contains all functions for related listing widget. |
|
1092 | + * |
|
1093 | + * @since 1.0.0 |
|
1094 | + * @package GeoDirectory |
|
1095 | + */ |
|
1096 | + include_once('geodirectory-widgets/geodirectory_related_listing_widget.php'); |
|
1097 | + /** |
|
1098 | + * Contains all functions for bestof widget. |
|
1099 | + * |
|
1100 | + * @since 1.0.0 |
|
1101 | + * @package GeoDirectory |
|
1102 | + */ |
|
1103 | + include_once('geodirectory-widgets/geodirectory_bestof_widget.php'); |
|
1104 | + /** |
|
1105 | + * Contains all functions for cpt categories widget. |
|
1106 | + * |
|
1107 | + * @since 1.5.4 |
|
1108 | + * @package GeoDirectory |
|
1109 | + */ |
|
1110 | + include_once('geodirectory-widgets/geodirectory_cpt_categories_widget.php'); |
|
1104 | 1111 | /** |
1105 | - * Contains all functions for cpt categories widget. |
|
1106 | - * |
|
1107 | - * @since 1.5.4 |
|
1108 | - * @package GeoDirectory |
|
1109 | - */ |
|
1110 | - include_once('geodirectory-widgets/geodirectory_cpt_categories_widget.php'); |
|
1111 | - /** |
|
1112 | - * Contains all functions for features widget. |
|
1113 | - * |
|
1114 | - * @since 1.5.6 |
|
1115 | - * @package GeoDirectory |
|
1116 | - * @todo make the image field recurring |
|
1117 | - */ |
|
1118 | - include_once('geodirectory-widgets/geodirectory_features_widget.php'); |
|
1119 | - } |
|
1112 | + * Contains all functions for features widget. |
|
1113 | + * |
|
1114 | + * @since 1.5.6 |
|
1115 | + * @package GeoDirectory |
|
1116 | + * @todo make the image field recurring |
|
1117 | + */ |
|
1118 | + include_once('geodirectory-widgets/geodirectory_features_widget.php'); |
|
1119 | + } |
|
1120 | 1120 | |
1121 | 1121 | } |
1122 | 1122 |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | public function form($instance) |
302 | 302 | { |
303 | 303 | //widgetform in backend |
304 | - $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => '')); |
|
304 | + $instance = wp_parse_args((array) $instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => '')); |
|
305 | 305 | $title = strip_tags($instance['title']); |
306 | 306 | |
307 | 307 | ?> |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | ?> |
374 | 374 | |
375 | 375 | <a href="http://twitter.com/share" |
376 | - class="twitter-share-button"><?php _e('Tweet', 'geodirectory');?></a> |
|
376 | + class="twitter-share-button"><?php _e('Tweet', 'geodirectory'); ?></a> |
|
377 | 377 | |
378 | 378 | <script type="text/javascript" src="//platform.twitter.com/widgets.js"></script> |
379 | 379 | |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | public function form($instance) |
444 | 444 | { |
445 | 445 | //widgetform in backend |
446 | - $instance = wp_parse_args((array)$instance, array('title' => '')); |
|
446 | + $instance = wp_parse_args((array) $instance, array('title' => '')); |
|
447 | 447 | $title = strip_tags($instance['title']); |
448 | 448 | ?> |
449 | 449 | <p>No settings for this widget</p> |
@@ -515,11 +515,11 @@ discard block |
||
515 | 515 | echo $before_widget; |
516 | 516 | ?> |
517 | 517 | |
518 | - <?php echo $before_title . $title; ?> <a href="<?php if ($id) { |
|
519 | - echo 'http://feeds2.feedburner.com/' . $id; |
|
518 | + <?php echo $before_title.$title; ?> <a href="<?php if ($id) { |
|
519 | + echo 'http://feeds2.feedburner.com/'.$id; |
|
520 | 520 | } else { |
521 | 521 | bloginfo('rss_url'); |
522 | - } ?>"><i class="fa fa-rss-square"></i> </a><?php echo $after_title;?> |
|
522 | + } ?>"><i class="fa fa-rss-square"></i> </a><?php echo $after_title; ?> |
|
523 | 523 | |
524 | 524 | <?php if ($text <> "") { ?> |
525 | 525 | |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | public function form($instance) |
585 | 585 | { |
586 | 586 | //widgetform in backend |
587 | - $instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'advt1' => '', 'text' => '', 'twitter' => '', 'facebook' => '', 'digg' => '', 'myspace' => '')); |
|
587 | + $instance = wp_parse_args((array) $instance, array('title' => '', 'id' => '', 'advt1' => '', 'text' => '', 'twitter' => '', 'facebook' => '', 'digg' => '', 'myspace' => '')); |
|
588 | 588 | |
589 | 589 | $id = strip_tags($instance['id']); |
590 | 590 | |
@@ -596,19 +596,19 @@ discard block |
||
596 | 596 | |
597 | 597 | ?> |
598 | 598 | <p><label |
599 | - for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title', 'geodirectory');?>: |
|
599 | + for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title', 'geodirectory'); ?>: |
|
600 | 600 | <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" |
601 | 601 | name="<?php echo $this->get_field_name('title'); ?>" type="text" |
602 | 602 | value="<?php echo esc_attr($title); ?>"/></label></p> |
603 | 603 | |
604 | 604 | <p><label |
605 | - for="<?php echo $this->get_field_id('id'); ?>"><?php _e('Feedburner ID (ex :- geotheme)', 'geodirectory');?> |
|
605 | + for="<?php echo $this->get_field_id('id'); ?>"><?php _e('Feedburner ID (ex :- geotheme)', 'geodirectory'); ?> |
|
606 | 606 | : <input class="widefat" id="<?php echo $this->get_field_id('id'); ?>" |
607 | 607 | name="<?php echo $this->get_field_name('id'); ?>" type="text" |
608 | 608 | value="<?php echo esc_attr($id); ?>"/></label></p> |
609 | 609 | |
610 | 610 | <p><label |
611 | - for="<?php echo $this->get_field_id('text'); ?>"><?php _e('Short Description', 'geodirectory');?> |
|
611 | + for="<?php echo $this->get_field_id('text'); ?>"><?php _e('Short Description', 'geodirectory'); ?> |
|
612 | 612 | <textarea class="widefat" rows="6" cols="20" id="<?php echo $this->get_field_id('text'); ?>" |
613 | 613 | name="<?php echo $this->get_field_name('text'); ?>"><?php echo esc_attr($text); ?></textarea></label> |
614 | 614 | </p> |
@@ -704,12 +704,12 @@ discard block |
||
704 | 704 | public function form($instance) |
705 | 705 | { |
706 | 706 | //widgetform in backend |
707 | - $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => '')); |
|
707 | + $instance = wp_parse_args((array) $instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => '')); |
|
708 | 708 | |
709 | 709 | $desc1 = ($instance['desc1']); |
710 | 710 | ?> |
711 | 711 | <p><label |
712 | - for="<?php echo $this->get_field_id('desc1'); ?>"><?php _e('Your Advt code (ex.google adsense, etc.)', 'geodirectory');?> |
|
712 | + for="<?php echo $this->get_field_id('desc1'); ?>"><?php _e('Your Advt code (ex.google adsense, etc.)', 'geodirectory'); ?> |
|
713 | 713 | <textarea class="widefat" rows="6" cols="20" id="<?php echo $this->get_field_id('desc1'); ?>" |
714 | 714 | name="<?php echo $this->get_field_name('desc1'); ?>"><?php echo esc_attr($desc1); ?></textarea></label> |
715 | 715 | </p> |
@@ -772,7 +772,7 @@ discard block |
||
772 | 772 | * @param string $number The image count. |
773 | 773 | */ |
774 | 774 | $number = empty($instance['number']) ? ' ' : apply_filters('widget_number', $instance['number']); |
775 | - echo $before_title . __('Photo Gallery', 'geodirectory') . $after_title; |
|
775 | + echo $before_title.__('Photo Gallery', 'geodirectory').$after_title; |
|
776 | 776 | ?> |
777 | 777 | |
778 | 778 | <div class="geodir-flickr clearfix"> |
@@ -819,14 +819,14 @@ discard block |
||
819 | 819 | { |
820 | 820 | |
821 | 821 | //widgetform in backend |
822 | - $instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'number' => '')); |
|
822 | + $instance = wp_parse_args((array) $instance, array('title' => '', 'id' => '', 'number' => '')); |
|
823 | 823 | $id = strip_tags($instance['id']); |
824 | 824 | $number = strip_tags($instance['number']); |
825 | 825 | ?> |
826 | 826 | |
827 | 827 | <p> |
828 | 828 | <label |
829 | - for="<?php echo $this->get_field_id('id'); ?>"><?php _e('Flickr ID', 'geodirectory');?> |
|
829 | + for="<?php echo $this->get_field_id('id'); ?>"><?php _e('Flickr ID', 'geodirectory'); ?> |
|
830 | 830 | (<a href="http://www.idgettr.com">idGettr</a>): |
831 | 831 | <input class="widefat" id="<?php echo $this->get_field_id('id'); ?>" |
832 | 832 | name="<?php echo $this->get_field_name('id'); ?>" type="text" |
@@ -836,7 +836,7 @@ discard block |
||
836 | 836 | |
837 | 837 | <p> |
838 | 838 | <label |
839 | - for="<?php echo $this->get_field_id('number'); ?>"><?php _e('Number of photos:', 'geodirectory');?> |
|
839 | + for="<?php echo $this->get_field_id('number'); ?>"><?php _e('Number of photos:', 'geodirectory'); ?> |
|
840 | 840 | <input class="widefat" id="<?php echo $this->get_field_id('number'); ?>" |
841 | 841 | name="<?php echo $this->get_field_name('number'); ?>" type="text" |
842 | 842 | value="<?php echo esc_attr($number); ?>"/> |
@@ -932,12 +932,12 @@ discard block |
||
932 | 932 | public function form($instance) |
933 | 933 | { |
934 | 934 | //widgetform in backend |
935 | - $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'gd_tw_desc1' => '')); |
|
935 | + $instance = wp_parse_args((array) $instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'gd_tw_desc1' => '')); |
|
936 | 936 | |
937 | 937 | $desc1 = ($instance['gd_tw_desc1']); |
938 | 938 | ?> |
939 | 939 | <p><label |
940 | - for="<?php echo $this->get_field_id('gd_tw_desc1'); ?>"><?php _e('Your twitter code', 'geodirectory');?> |
|
940 | + for="<?php echo $this->get_field_id('gd_tw_desc1'); ?>"><?php _e('Your twitter code', 'geodirectory'); ?> |
|
941 | 941 | <textarea class="widefat" rows="6" cols="20" |
942 | 942 | id="<?php echo $this->get_field_id('gd_tw_desc1'); ?>" |
943 | 943 | name="<?php echo $this->get_field_name('gd_tw_desc1'); ?>"><?php echo esc_attr($desc1); ?></textarea></label> |
@@ -963,7 +963,7 @@ discard block |
||
963 | 963 | * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
964 | 964 | */ |
965 | 965 | public function __construct() { |
966 | - $widget_ops = array('classname' => 'geodir_advance_search_widget', 'description' => __('GD > Search', 'geodirectory'),'post_type'=>''); |
|
966 | + $widget_ops = array('classname' => 'geodir_advance_search_widget', 'description' => __('GD > Search', 'geodirectory'), 'post_type'=>''); |
|
967 | 967 | parent::__construct( |
968 | 968 | 'geodir_advance_search', // Base ID |
969 | 969 | __('GD > Search', 'geodirectory'), // Name |
@@ -990,15 +990,15 @@ discard block |
||
990 | 990 | * @param array $args The widget arguments. |
991 | 991 | * @param array $instance The widget instance. |
992 | 992 | */ |
993 | - $args = apply_filters('widget_geodir_advance_search_args',$args,$instance); |
|
993 | + $args = apply_filters('widget_geodir_advance_search_args', $args, $instance); |
|
994 | 994 | |
995 | 995 | // prints the widget |
996 | 996 | extract($args, EXTR_SKIP); |
997 | 997 | |
998 | - if(isset($post_type) && $post_type){ |
|
999 | - geodir_get_search_post_type($post_type);// set the post type |
|
1000 | - }else{ |
|
1001 | - geodir_get_search_post_type();// set the post type |
|
998 | + if (isset($post_type) && $post_type) { |
|
999 | + geodir_get_search_post_type($post_type); // set the post type |
|
1000 | + } else { |
|
1001 | + geodir_get_search_post_type(); // set the post type |
|
1002 | 1002 | } |
1003 | 1003 | |
1004 | 1004 | echo $before_widget; |
@@ -997,7 +997,7 @@ |
||
997 | 997 | |
998 | 998 | if(isset($post_type) && $post_type){ |
999 | 999 | geodir_get_search_post_type($post_type);// set the post type |
1000 | - }else{ |
|
1000 | + } else{ |
|
1001 | 1001 | geodir_get_search_post_type();// set the post type |
1002 | 1002 | } |
1003 | 1003 |
@@ -17,26 +17,26 @@ discard block |
||
17 | 17 | function gd_compat_php_genesis() |
18 | 18 | { |
19 | 19 | // REPLACE GENESIS BREADCRUMBS WITH GD BREADCRUMBS |
20 | - remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20); |
|
21 | - remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20); |
|
22 | - remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20); |
|
23 | - remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20); |
|
24 | - remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20); |
|
25 | - remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20); |
|
20 | + remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20); |
|
21 | + remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20); |
|
22 | + remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20); |
|
23 | + remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20); |
|
24 | + remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20); |
|
25 | + remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20); |
|
26 | 26 | |
27 | 27 | |
28 | - // make top section wide |
|
29 | - remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
30 | - remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
31 | - remove_action('geodir_author_before_main_content', 'geodir_action_geodir_sidebar_author_top', 10); |
|
32 | - remove_action('geodir_search_before_main_content', 'geodir_action_geodir_sidebar_search_top', 10); |
|
33 | - remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_sidebar_detail_top', 10); |
|
34 | - remove_action('geodir_listings_before_main_content', 'geodir_action_geodir_sidebar_listings_top', 10); |
|
28 | + // make top section wide |
|
29 | + remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
30 | + remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
31 | + remove_action('geodir_author_before_main_content', 'geodir_action_geodir_sidebar_author_top', 10); |
|
32 | + remove_action('geodir_search_before_main_content', 'geodir_action_geodir_sidebar_search_top', 10); |
|
33 | + remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_sidebar_detail_top', 10); |
|
34 | + remove_action('geodir_listings_before_main_content', 'geodir_action_geodir_sidebar_listings_top', 10); |
|
35 | 35 | |
36 | - // REMOVE PAGE TITLES |
|
37 | - remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10); |
|
38 | - remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10); |
|
39 | - remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10); |
|
36 | + // REMOVE PAGE TITLES |
|
37 | + remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10); |
|
38 | + remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10); |
|
39 | + remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10); |
|
40 | 40 | |
41 | 41 | |
42 | 42 | } |
@@ -53,25 +53,25 @@ discard block |
||
53 | 53 | function gd_genesis_compat_left_sidebars() |
54 | 54 | { |
55 | 55 | |
56 | - if (is_page_geodir_home()) { |
|
57 | - remove_action('geodir_home_sidebar_left', 'geodir_action_home_sidebar_left', 10); |
|
58 | - add_action('geodir_wrapper_close', 'geodir_action_home_sidebar_left', 11); |
|
59 | - } elseif (geodir_is_page('location')) { |
|
60 | - remove_action('geodir_location_sidebar_left', 'geodir_action_home_sidebar_left', 10); |
|
61 | - add_action('geodir_wrapper_close', 'geodir_action_home_sidebar_left', 11); |
|
62 | - } elseif (geodir_is_page('listing')) { |
|
63 | - remove_action('geodir_listings_sidebar_left', 'geodir_action_listings_sidebar_left', 10); |
|
64 | - add_action('geodir_wrapper_close', 'geodir_action_listings_sidebar_left', 11); |
|
65 | - } elseif (geodir_is_page('detail') && get_option('geodir_detail_sidebar_left_section')) { |
|
66 | - //remove_action( 'geodir_detail_sidebar', 'geodir_action_details_sidebar', 10 ); |
|
67 | - //add_action( 'geodir_wrapper_close', 'geodir_action_details_sidebar', 11 ); |
|
68 | - } elseif (geodir_is_page('search')) { |
|
69 | - remove_action('geodir_search_sidebar_left', 'geodir_action_search_sidebar_left', 10); |
|
70 | - add_action('geodir_wrapper_close', 'geodir_action_search_sidebar_left', 11); |
|
71 | - } elseif (geodir_is_page('author')) { |
|
72 | - remove_action('geodir_author_sidebar_left', 'geodir_action_author_sidebar_left', 10); |
|
73 | - add_action('geodir_wrapper_close', 'geodir_action_author_sidebar_left', 11); |
|
74 | - } |
|
56 | + if (is_page_geodir_home()) { |
|
57 | + remove_action('geodir_home_sidebar_left', 'geodir_action_home_sidebar_left', 10); |
|
58 | + add_action('geodir_wrapper_close', 'geodir_action_home_sidebar_left', 11); |
|
59 | + } elseif (geodir_is_page('location')) { |
|
60 | + remove_action('geodir_location_sidebar_left', 'geodir_action_home_sidebar_left', 10); |
|
61 | + add_action('geodir_wrapper_close', 'geodir_action_home_sidebar_left', 11); |
|
62 | + } elseif (geodir_is_page('listing')) { |
|
63 | + remove_action('geodir_listings_sidebar_left', 'geodir_action_listings_sidebar_left', 10); |
|
64 | + add_action('geodir_wrapper_close', 'geodir_action_listings_sidebar_left', 11); |
|
65 | + } elseif (geodir_is_page('detail') && get_option('geodir_detail_sidebar_left_section')) { |
|
66 | + //remove_action( 'geodir_detail_sidebar', 'geodir_action_details_sidebar', 10 ); |
|
67 | + //add_action( 'geodir_wrapper_close', 'geodir_action_details_sidebar', 11 ); |
|
68 | + } elseif (geodir_is_page('search')) { |
|
69 | + remove_action('geodir_search_sidebar_left', 'geodir_action_search_sidebar_left', 10); |
|
70 | + add_action('geodir_wrapper_close', 'geodir_action_search_sidebar_left', 11); |
|
71 | + } elseif (geodir_is_page('author')) { |
|
72 | + remove_action('geodir_author_sidebar_left', 'geodir_action_author_sidebar_left', 10); |
|
73 | + add_action('geodir_wrapper_close', 'geodir_action_author_sidebar_left', 11); |
|
74 | + } |
|
75 | 75 | |
76 | 76 | |
77 | 77 | } |
@@ -88,65 +88,65 @@ discard block |
||
88 | 88 | */ |
89 | 89 | function geodir_set_body_scs($classes) |
90 | 90 | { |
91 | - $remove_class = false; |
|
92 | - $new_class = ''; |
|
93 | - if (is_page_geodir_home() || geodir_is_page('location')) { |
|
94 | - $remove_class = true; |
|
95 | - if (get_option('geodir_show_home_left_section')) { |
|
96 | - $new_class .= 'sidebar-'; |
|
97 | - } |
|
98 | - if (get_option('geodir_show_home_contant_section')) { |
|
99 | - $new_class .= 'content'; |
|
100 | - } |
|
101 | - if (get_option('geodir_show_home_right_section')) { |
|
102 | - $new_class .= '-sidebar'; |
|
103 | - } |
|
104 | - } elseif (geodir_is_page('listing')) { |
|
105 | - $remove_class = true; |
|
106 | - if (get_option('geodir_show_listing_left_section')) { |
|
107 | - $new_class .= 'sidebar-'; |
|
108 | - } |
|
109 | - $new_class .= 'content'; |
|
110 | - if (get_option('geodir_show_listing_right_section')) { |
|
111 | - $new_class .= '-sidebar'; |
|
112 | - } |
|
113 | - } elseif (geodir_is_page('detail')) { |
|
114 | - $remove_class = true; |
|
115 | - if (get_option('geodir_detail_sidebar_left_section')) { |
|
116 | - $new_class .= 'sidebar-content gd-details-sidebar-left'; |
|
117 | - } else { |
|
118 | - $new_class .= 'content-sidebar'; |
|
119 | - } |
|
120 | - } elseif (geodir_is_page('search')) { |
|
121 | - $remove_class = true; |
|
122 | - if (get_option('geodir_show_search_left_section')) { |
|
123 | - $new_class .= 'sidebar-'; |
|
124 | - } |
|
125 | - $new_class .= 'content'; |
|
126 | - if (get_option('geodir_show_search_right_section')) { |
|
127 | - $new_class .= '-sidebar'; |
|
128 | - } |
|
129 | - } elseif (geodir_is_page('author')) { |
|
130 | - $remove_class = true; |
|
131 | - if (get_option('geodir_show_author_left_section')) { |
|
132 | - $new_class .= 'sidebar-'; |
|
133 | - } |
|
134 | - $new_class .= 'content'; |
|
135 | - if (get_option('geodir_show_author_right_section')) { |
|
136 | - $new_class .= '-sidebar'; |
|
137 | - } |
|
138 | - } elseif (geodir_is_page('add-listing')) { |
|
139 | - $remove_class = true; |
|
140 | - $new_class .= 'content-sidebar'; |
|
141 | - } |
|
142 | - |
|
143 | - if ($remove_class) { |
|
144 | - $classes = array_diff($classes, array('content-sidebar', 'sidebar-content', 'content-sidebar-sidebar', 'sidebar-sidebar-content', 'sidebar-content-sidebar', 'full-width-content')); |
|
145 | - //str_replace(array('content-sidebar','sidebar-content','content-sidebar-sidebar','sidebar-sidebar-content','sidebar-content-sidebar','full-width-content'),array('','','','','',''),$classes); |
|
146 | - $classes[] = $new_class; |
|
147 | - } |
|
148 | - |
|
149 | - return $classes; |
|
91 | + $remove_class = false; |
|
92 | + $new_class = ''; |
|
93 | + if (is_page_geodir_home() || geodir_is_page('location')) { |
|
94 | + $remove_class = true; |
|
95 | + if (get_option('geodir_show_home_left_section')) { |
|
96 | + $new_class .= 'sidebar-'; |
|
97 | + } |
|
98 | + if (get_option('geodir_show_home_contant_section')) { |
|
99 | + $new_class .= 'content'; |
|
100 | + } |
|
101 | + if (get_option('geodir_show_home_right_section')) { |
|
102 | + $new_class .= '-sidebar'; |
|
103 | + } |
|
104 | + } elseif (geodir_is_page('listing')) { |
|
105 | + $remove_class = true; |
|
106 | + if (get_option('geodir_show_listing_left_section')) { |
|
107 | + $new_class .= 'sidebar-'; |
|
108 | + } |
|
109 | + $new_class .= 'content'; |
|
110 | + if (get_option('geodir_show_listing_right_section')) { |
|
111 | + $new_class .= '-sidebar'; |
|
112 | + } |
|
113 | + } elseif (geodir_is_page('detail')) { |
|
114 | + $remove_class = true; |
|
115 | + if (get_option('geodir_detail_sidebar_left_section')) { |
|
116 | + $new_class .= 'sidebar-content gd-details-sidebar-left'; |
|
117 | + } else { |
|
118 | + $new_class .= 'content-sidebar'; |
|
119 | + } |
|
120 | + } elseif (geodir_is_page('search')) { |
|
121 | + $remove_class = true; |
|
122 | + if (get_option('geodir_show_search_left_section')) { |
|
123 | + $new_class .= 'sidebar-'; |
|
124 | + } |
|
125 | + $new_class .= 'content'; |
|
126 | + if (get_option('geodir_show_search_right_section')) { |
|
127 | + $new_class .= '-sidebar'; |
|
128 | + } |
|
129 | + } elseif (geodir_is_page('author')) { |
|
130 | + $remove_class = true; |
|
131 | + if (get_option('geodir_show_author_left_section')) { |
|
132 | + $new_class .= 'sidebar-'; |
|
133 | + } |
|
134 | + $new_class .= 'content'; |
|
135 | + if (get_option('geodir_show_author_right_section')) { |
|
136 | + $new_class .= '-sidebar'; |
|
137 | + } |
|
138 | + } elseif (geodir_is_page('add-listing')) { |
|
139 | + $remove_class = true; |
|
140 | + $new_class .= 'content-sidebar'; |
|
141 | + } |
|
142 | + |
|
143 | + if ($remove_class) { |
|
144 | + $classes = array_diff($classes, array('content-sidebar', 'sidebar-content', 'content-sidebar-sidebar', 'sidebar-sidebar-content', 'sidebar-content-sidebar', 'full-width-content')); |
|
145 | + //str_replace(array('content-sidebar','sidebar-content','content-sidebar-sidebar','sidebar-sidebar-content','sidebar-content-sidebar','full-width-content'),array('','','','','',''),$classes); |
|
146 | + $classes[] = $new_class; |
|
147 | + } |
|
148 | + |
|
149 | + return $classes; |
|
150 | 150 | |
151 | 151 | } |
152 | 152 | |
@@ -160,17 +160,17 @@ discard block |
||
160 | 160 | function gd_genesis_compat_add_top_section_back() |
161 | 161 | { |
162 | 162 | |
163 | - if (is_page_geodir_home() || geodir_is_page('location')) { |
|
164 | - geodir_action_geodir_sidebar_home_top(); |
|
165 | - } elseif (geodir_is_page('listing')) { |
|
166 | - geodir_action_geodir_sidebar_listings_top(); |
|
167 | - } elseif (geodir_is_page('detail')) { |
|
168 | - geodir_action_geodir_sidebar_detail_top(); |
|
169 | - } elseif (geodir_is_page('search')) { |
|
170 | - geodir_action_geodir_sidebar_search_top(); |
|
171 | - } elseif (geodir_is_page('author')) { |
|
172 | - geodir_action_geodir_sidebar_author_top(); |
|
173 | - } |
|
163 | + if (is_page_geodir_home() || geodir_is_page('location')) { |
|
164 | + geodir_action_geodir_sidebar_home_top(); |
|
165 | + } elseif (geodir_is_page('listing')) { |
|
166 | + geodir_action_geodir_sidebar_listings_top(); |
|
167 | + } elseif (geodir_is_page('detail')) { |
|
168 | + geodir_action_geodir_sidebar_detail_top(); |
|
169 | + } elseif (geodir_is_page('search')) { |
|
170 | + geodir_action_geodir_sidebar_search_top(); |
|
171 | + } elseif (geodir_is_page('author')) { |
|
172 | + geodir_action_geodir_sidebar_author_top(); |
|
173 | + } |
|
174 | 174 | |
175 | 175 | |
176 | 176 | } |
@@ -183,12 +183,12 @@ discard block |
||
183 | 183 | */ |
184 | 184 | function geodir_replace_breadcrumb() |
185 | 185 | { |
186 | - if (is_front_page() && geodir_is_page('home') && !geodir_is_page('login')) { |
|
187 | - } else { |
|
188 | - echo '<div class="geodir-breadcrumb-bar"><div class="wrap">'; |
|
189 | - geodir_breadcrumb(); |
|
190 | - echo '</div></div>'; |
|
191 | - } |
|
186 | + if (is_front_page() && geodir_is_page('home') && !geodir_is_page('login')) { |
|
187 | + } else { |
|
188 | + echo '<div class="geodir-breadcrumb-bar"><div class="wrap">'; |
|
189 | + geodir_breadcrumb(); |
|
190 | + echo '</div></div>'; |
|
191 | + } |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | // Force Full Width on signup page |
@@ -201,9 +201,9 @@ discard block |
||
201 | 201 | */ |
202 | 202 | function geodir_genesis_meta() |
203 | 203 | { |
204 | - if (geodir_is_page('login')) { |
|
205 | - add_filter('genesis_pre_get_option_site_layout', '__genesis_return_full_width_content'); |
|
206 | - } |
|
204 | + if (geodir_is_page('login')) { |
|
205 | + add_filter('genesis_pre_get_option_site_layout', '__genesis_return_full_width_content'); |
|
206 | + } |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | add_action('geodir_add_listing_page_title', 'geodir_add_listing_page_title_genesis_before', 8); |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | function geodir_add_listing_page_title_genesis_before() |
217 | 217 | { |
218 | 218 | |
219 | - echo "<div class='entry' >"; |
|
219 | + echo "<div class='entry' >"; |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | function geodir_add_listing_form_genesis_after() |
231 | 231 | { |
232 | 232 | |
233 | - echo "</div>"; |
|
233 | + echo "</div>"; |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | |
@@ -249,38 +249,38 @@ discard block |
||
249 | 249 | { |
250 | 250 | |
251 | 251 | |
252 | - $title = ''; |
|
253 | - $subtitle = ''; |
|
254 | - |
|
255 | - if (geodir_is_page('listing')) { |
|
256 | - echo '<div class="wrap gd-title-wrap">'; |
|
257 | - geodir_action_listings_title(); |
|
258 | - echo '</div>'; |
|
259 | - } |
|
260 | - |
|
261 | - if (geodir_is_page('add-listing')) { |
|
262 | - echo '<div class="wrap gd-title-wrap">'; |
|
263 | - geodir_action_add_listing_page_title(); |
|
264 | - echo '</div>'; |
|
265 | - } |
|
266 | - |
|
267 | - if (geodir_is_page('author')) { |
|
268 | - echo '<div class="wrap gd-title-wrap">'; |
|
269 | - geodir_action_author_page_title(); |
|
270 | - echo '</div>'; |
|
271 | - } |
|
272 | - |
|
273 | - if (geodir_is_page('detail') || geodir_is_page('preview')) { |
|
274 | - echo '<div class="wrap gd-title-wrap">'; |
|
275 | - echo get_the_title(); |
|
276 | - echo '</div>'; |
|
277 | - } |
|
278 | - |
|
279 | - if (geodir_is_page('search')) { |
|
280 | - echo '<div class="wrap gd-title-wrap">'; |
|
281 | - geodir_action_search_page_title(); |
|
282 | - echo '</div>'; |
|
283 | - } |
|
252 | + $title = ''; |
|
253 | + $subtitle = ''; |
|
254 | + |
|
255 | + if (geodir_is_page('listing')) { |
|
256 | + echo '<div class="wrap gd-title-wrap">'; |
|
257 | + geodir_action_listings_title(); |
|
258 | + echo '</div>'; |
|
259 | + } |
|
260 | + |
|
261 | + if (geodir_is_page('add-listing')) { |
|
262 | + echo '<div class="wrap gd-title-wrap">'; |
|
263 | + geodir_action_add_listing_page_title(); |
|
264 | + echo '</div>'; |
|
265 | + } |
|
266 | + |
|
267 | + if (geodir_is_page('author')) { |
|
268 | + echo '<div class="wrap gd-title-wrap">'; |
|
269 | + geodir_action_author_page_title(); |
|
270 | + echo '</div>'; |
|
271 | + } |
|
272 | + |
|
273 | + if (geodir_is_page('detail') || geodir_is_page('preview')) { |
|
274 | + echo '<div class="wrap gd-title-wrap">'; |
|
275 | + echo get_the_title(); |
|
276 | + echo '</div>'; |
|
277 | + } |
|
278 | + |
|
279 | + if (geodir_is_page('search')) { |
|
280 | + echo '<div class="wrap gd-title-wrap">'; |
|
281 | + geodir_action_search_page_title(); |
|
282 | + echo '</div>'; |
|
283 | + } |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | |
@@ -293,8 +293,8 @@ discard block |
||
293 | 293 | */ |
294 | 294 | function gd_genesis_listing_page_title_bar() |
295 | 295 | { |
296 | - geodir_action_listings_title(); |
|
297 | - //geodir_action_listings_description(); |
|
296 | + geodir_action_listings_title(); |
|
297 | + //geodir_action_listings_description(); |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | |
@@ -307,19 +307,19 @@ discard block |
||
307 | 307 | */ |
308 | 308 | function gd_compat_php_genesis_geo_1280_fix() |
309 | 309 | { |
310 | - if (function_exists('geo1280_search_bar')) { |
|
311 | - remove_action('genesis_after_header', 'geo1280_search_bar', 20); |
|
312 | - add_action('genesis_after_header', 'geo1280_search_bar_fix', 4); |
|
310 | + if (function_exists('geo1280_search_bar')) { |
|
311 | + remove_action('genesis_after_header', 'geo1280_search_bar', 20); |
|
312 | + add_action('genesis_after_header', 'geo1280_search_bar_fix', 4); |
|
313 | 313 | |
314 | - // |
|
314 | + // |
|
315 | 315 | |
316 | - remove_action('genesis_after_header', 'geodir_replace_breadcrumb', 20); |
|
317 | - remove_action('genesis_before_content_sidebar_wrap', 'geodir_replace_breadcrumb', 20); |
|
318 | - add_action('geodir_wrapper_open', 'geodir_replace_breadcrumb', 105); |
|
316 | + remove_action('genesis_after_header', 'geodir_replace_breadcrumb', 20); |
|
317 | + remove_action('genesis_before_content_sidebar_wrap', 'geodir_replace_breadcrumb', 20); |
|
318 | + add_action('geodir_wrapper_open', 'geodir_replace_breadcrumb', 105); |
|
319 | 319 | |
320 | - remove_action('genesis_before_content_sidebar_wrap', 'geo1280_page_title', 10); |
|
321 | - add_action('geodir_wrapper_open', 'geo1280_page_title', 101); |
|
322 | - } |
|
320 | + remove_action('genesis_before_content_sidebar_wrap', 'geo1280_page_title', 10); |
|
321 | + add_action('geodir_wrapper_open', 'geo1280_page_title', 101); |
|
322 | + } |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | /** |
@@ -331,11 +331,11 @@ discard block |
||
331 | 331 | function geo1280_search_bar_fix() |
332 | 332 | { |
333 | 333 | |
334 | - echo '<div class="geo1280-placeholder"></div>'; |
|
335 | - if (is_active_sidebar('search-bar')) { |
|
336 | - genesis_widget_area('search-bar', array( |
|
337 | - 'before' => '<div class="search-bar widget-area"><div class="wrap">', |
|
338 | - 'after' => '</div></div>', |
|
339 | - )); |
|
340 | - } |
|
334 | + echo '<div class="geo1280-placeholder"></div>'; |
|
335 | + if (is_active_sidebar('search-bar')) { |
|
336 | + genesis_widget_area('search-bar', array( |
|
337 | + 'before' => '<div class="search-bar widget-area"><div class="wrap">', |
|
338 | + 'after' => '</div></div>', |
|
339 | + )); |
|
340 | + } |
|
341 | 341 | } |
@@ -12,27 +12,27 @@ |
||
12 | 12 | <div class="clearfix"> |
13 | 13 | <div id="geodir_content"> |
14 | 14 | <?php |
15 | - /** This action is documented in geodirectory-templates/geodir-home.php */ |
|
16 | - do_action('geodir_add_page_content', 'before', 'info-page'); |
|
17 | - global $information; |
|
18 | - echo '<h5 class="geodir_information">'; |
|
19 | - echo $information; |
|
20 | - echo '</h5>'; |
|
21 | - /** This action is documented in geodirectory-templates/geodir-home.php */ |
|
22 | - do_action('geodir_add_page_content', 'after', 'info-page'); |
|
23 | - ?> |
|
15 | + /** This action is documented in geodirectory-templates/geodir-home.php */ |
|
16 | + do_action('geodir_add_page_content', 'before', 'info-page'); |
|
17 | + global $information; |
|
18 | + echo '<h5 class="geodir_information">'; |
|
19 | + echo $information; |
|
20 | + echo '</h5>'; |
|
21 | + /** This action is documented in geodirectory-templates/geodir-home.php */ |
|
22 | + do_action('geodir_add_page_content', 'after', 'info-page'); |
|
23 | + ?> |
|
24 | 24 | </div> |
25 | 25 | <!-- geodir_content ends here--> |
26 | 26 | <div id="gd-sidebar-wrapper"> |
27 | 27 | <div class="geodir-sidebar-main"> |
28 | 28 | <div class="geodir-gd-sidebar"> |
29 | 29 | <?php |
30 | - /** |
|
31 | - * Calls the author sidebar. |
|
32 | - * |
|
33 | - * @since 1.6.11 |
|
34 | - */ |
|
35 | - dynamic_sidebar('geodir_author_right_sidebar'); ?> |
|
30 | + /** |
|
31 | + * Calls the author sidebar. |
|
32 | + * |
|
33 | + * @since 1.6.11 |
|
34 | + */ |
|
35 | + dynamic_sidebar('geodir_author_right_sidebar'); ?> |
|
36 | 36 | </div> |
37 | 37 | </div> |
38 | 38 | </div> |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | global $sitepress; |
246 | 246 | $default_lang = $sitepress->get_default_language(); |
247 | 247 | $term_id = icl_object_id($cat_term->term_id, $post_type.'category', true, $default_lang); |
248 | - }else{ |
|
248 | + } else{ |
|
249 | 249 | $term_id = $cat_term->term_id; |
250 | 250 | } |
251 | 251 | if (!empty($geodir_home_map_untick) && in_array($post_type . '_' . $term_id, $geodir_home_map_untick)) { |
@@ -273,8 +273,9 @@ discard block |
||
273 | 273 | |
274 | 274 | return $out; |
275 | 275 | } else { |
276 | - if ($cat_parent == 0) |
|
277 | - return _e('No category', 'geodirectory'); |
|
276 | + if ($cat_parent == 0) { |
|
277 | + return _e('No category', 'geodirectory'); |
|
278 | + } |
|
278 | 279 | } |
279 | 280 | return; |
280 | 281 | } |
@@ -15,8 +15,8 @@ discard block |
||
15 | 15 | */ |
16 | 16 | function geodir_init_map_jason() |
17 | 17 | { |
18 | - global $map_jason; |
|
19 | - $map_jason = array(); |
|
18 | + global $map_jason; |
|
19 | + $map_jason = array(); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | */ |
29 | 29 | function geodir_init_map_canvas_array() |
30 | 30 | { |
31 | - global $map_canvas_arr; |
|
32 | - $map_canvas_arr = array(); |
|
31 | + global $map_canvas_arr; |
|
32 | + $map_canvas_arr = array(); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -50,56 +50,56 @@ discard block |
||
50 | 50 | */ |
51 | 51 | function create_marker_jason_of_posts($post) |
52 | 52 | { |
53 | - global $wpdb, $map_jason, $add_post_in_marker_array, $geodir_cat_icons, $gd_marker_sizes; |
|
53 | + global $wpdb, $map_jason, $add_post_in_marker_array, $geodir_cat_icons, $gd_marker_sizes; |
|
54 | 54 | |
55 | - if (!empty($post) && isset($post->ID) && $post->ID > 0 && (is_main_query() || $add_post_in_marker_array) && $post->marker_json != '') { |
|
55 | + if (!empty($post) && isset($post->ID) && $post->ID > 0 && (is_main_query() || $add_post_in_marker_array) && $post->marker_json != '') { |
|
56 | 56 | |
57 | - if(isset($map_jason[$post->ID])){return null;} |
|
57 | + if(isset($map_jason[$post->ID])){return null;} |
|
58 | 58 | |
59 | - $srcharr = array("'", "/", "-", '"', '\\'); |
|
60 | - $replarr = array("′", "⁄", "–", "“", ''); |
|
59 | + $srcharr = array("'", "/", "-", '"', '\\'); |
|
60 | + $replarr = array("′", "⁄", "–", "“", ''); |
|
61 | 61 | |
62 | 62 | |
63 | - $geodir_cat_icons = geodir_get_term_icon(); |
|
64 | - $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$post->default_category]) ? $geodir_cat_icons[$post->default_category] : ''; |
|
63 | + $geodir_cat_icons = geodir_get_term_icon(); |
|
64 | + $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$post->default_category]) ? $geodir_cat_icons[$post->default_category] : ''; |
|
65 | 65 | |
66 | - $post_title = $post->post_title; |
|
67 | - $title = str_replace($srcharr, $replarr, $post_title); |
|
66 | + $post_title = $post->post_title; |
|
67 | + $title = str_replace($srcharr, $replarr, $post_title); |
|
68 | 68 | |
69 | - if (is_ssl()) { |
|
70 | - $icon = str_replace("http:","https:",$icon ); |
|
71 | - } |
|
69 | + if (is_ssl()) { |
|
70 | + $icon = str_replace("http:","https:",$icon ); |
|
71 | + } |
|
72 | 72 | |
73 | - if ($icon != '') { |
|
74 | - $gd_marker_sizes = empty($gd_marker_sizes) ? array() : $gd_marker_sizes; |
|
73 | + if ($icon != '') { |
|
74 | + $gd_marker_sizes = empty($gd_marker_sizes) ? array() : $gd_marker_sizes; |
|
75 | 75 | |
76 | - if (isset($gd_marker_sizes[$icon])) { |
|
77 | - $icon_size = $gd_marker_sizes[$icon]; |
|
78 | - } else { |
|
79 | - $icon_size = geodir_get_marker_size($icon); |
|
80 | - $gd_marker_sizes[$icon] = $icon_size; |
|
81 | - } |
|
82 | - } else { |
|
83 | - $icon_size = array('w' => 36, 'h' => 45); |
|
84 | - } |
|
85 | - |
|
86 | - $post_json = '{"id":"' . $post->ID . '","t": "' . $title . '","lt": "' . $post->post_latitude . '","ln": "' . $post->post_longitude . '","mk_id":"' . $post->ID . '_' . $post->default_category . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"}'; |
|
87 | - |
|
88 | - /** |
|
89 | - * Filter the json data when creating output for post json marker.. |
|
90 | - * |
|
91 | - * @since 1.5.7 |
|
92 | - * @param string $post_json JSON representation of the post marker info. |
|
93 | - * @param object $post The post object. |
|
94 | - */ |
|
95 | - $post_map_json = apply_filters('geodir_create_marker_jason_of_posts',$post_json, $post); |
|
96 | - |
|
97 | - // only assign it if it has a value |
|
98 | - if($post_map_json){ |
|
99 | - $map_jason[$post->ID] = $post_map_json; |
|
100 | - } |
|
101 | - |
|
102 | - } |
|
76 | + if (isset($gd_marker_sizes[$icon])) { |
|
77 | + $icon_size = $gd_marker_sizes[$icon]; |
|
78 | + } else { |
|
79 | + $icon_size = geodir_get_marker_size($icon); |
|
80 | + $gd_marker_sizes[$icon] = $icon_size; |
|
81 | + } |
|
82 | + } else { |
|
83 | + $icon_size = array('w' => 36, 'h' => 45); |
|
84 | + } |
|
85 | + |
|
86 | + $post_json = '{"id":"' . $post->ID . '","t": "' . $title . '","lt": "' . $post->post_latitude . '","ln": "' . $post->post_longitude . '","mk_id":"' . $post->ID . '_' . $post->default_category . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"}'; |
|
87 | + |
|
88 | + /** |
|
89 | + * Filter the json data when creating output for post json marker.. |
|
90 | + * |
|
91 | + * @since 1.5.7 |
|
92 | + * @param string $post_json JSON representation of the post marker info. |
|
93 | + * @param object $post The post object. |
|
94 | + */ |
|
95 | + $post_map_json = apply_filters('geodir_create_marker_jason_of_posts',$post_json, $post); |
|
96 | + |
|
97 | + // only assign it if it has a value |
|
98 | + if($post_map_json){ |
|
99 | + $map_jason[$post->ID] = $post_map_json; |
|
100 | + } |
|
101 | + |
|
102 | + } |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
@@ -112,67 +112,67 @@ discard block |
||
112 | 112 | */ |
113 | 113 | function send_marker_jason_to_js() |
114 | 114 | { |
115 | - global $map_jason, $map_canvas_arr; |
|
116 | - |
|
117 | - if (is_array($map_canvas_arr) && !empty($map_canvas_arr)) { |
|
118 | - foreach ($map_canvas_arr as $canvas => $jason) { |
|
119 | - if (is_array($map_jason) && !empty($map_jason)) { |
|
120 | - |
|
121 | - // on details page only show the main marker on the map |
|
122 | - if(geodir_is_page('detail')){ |
|
123 | - global $post; |
|
124 | - if(isset($map_jason[$post->ID])){ |
|
125 | - $map_jason = array($map_jason[$post->ID]); |
|
126 | - } |
|
127 | - } |
|
128 | - $canvas_jason = $canvas . "_jason"; |
|
129 | - $map_canvas_arr[$canvas] = array_unique($map_jason); |
|
130 | - unset($cat_content_info); |
|
131 | - $cat_content_info[] = implode(',', $map_canvas_arr[$canvas]); |
|
132 | - $totalcount = count(array_unique($map_jason)); |
|
133 | - if (!empty($cat_content_info)) { |
|
134 | - $json_content = substr(implode(',', $cat_content_info), 1); |
|
135 | - $json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016 |
|
136 | - $json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08 |
|
137 | - $canvas_jason = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']'; |
|
138 | - } else { |
|
139 | - $canvas_jason = '[{"totalcount":"0"}]'; |
|
140 | - } |
|
141 | - $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason); |
|
142 | - |
|
143 | - /** |
|
144 | - * Filter the send_marker_jason_to_js() function map canvas json args. |
|
145 | - * |
|
146 | - * You can use this filter to modify map canvas json args. |
|
147 | - * |
|
148 | - * @since 1.0.0 |
|
149 | - * @package GeoDirectory |
|
150 | - * @param string $canvas Map canvas array key. |
|
151 | - * @param array $map_canvas_jason_args Map canvas args. |
|
152 | - */ |
|
153 | - $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args); |
|
154 | - |
|
155 | - wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args); |
|
156 | - } else { |
|
157 | - $canvas_jason = '[{"totalcount":"0"}]'; |
|
158 | - $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason); |
|
159 | - |
|
160 | - /** |
|
161 | - * Filter the send_marker_jason_to_js() function map canvas json args. |
|
162 | - * |
|
163 | - * You can use this filter to modify map canvas json args. |
|
164 | - * |
|
165 | - * @since 1.0.0 |
|
166 | - * @package GeoDirectory |
|
167 | - * @param string $canvas Map canvas array key. |
|
168 | - * @param array $map_canvas_jason_args Map canvas args. |
|
169 | - */ |
|
170 | - $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args); |
|
171 | - wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args); |
|
172 | - } |
|
173 | - } |
|
174 | - |
|
175 | - } |
|
115 | + global $map_jason, $map_canvas_arr; |
|
116 | + |
|
117 | + if (is_array($map_canvas_arr) && !empty($map_canvas_arr)) { |
|
118 | + foreach ($map_canvas_arr as $canvas => $jason) { |
|
119 | + if (is_array($map_jason) && !empty($map_jason)) { |
|
120 | + |
|
121 | + // on details page only show the main marker on the map |
|
122 | + if(geodir_is_page('detail')){ |
|
123 | + global $post; |
|
124 | + if(isset($map_jason[$post->ID])){ |
|
125 | + $map_jason = array($map_jason[$post->ID]); |
|
126 | + } |
|
127 | + } |
|
128 | + $canvas_jason = $canvas . "_jason"; |
|
129 | + $map_canvas_arr[$canvas] = array_unique($map_jason); |
|
130 | + unset($cat_content_info); |
|
131 | + $cat_content_info[] = implode(',', $map_canvas_arr[$canvas]); |
|
132 | + $totalcount = count(array_unique($map_jason)); |
|
133 | + if (!empty($cat_content_info)) { |
|
134 | + $json_content = substr(implode(',', $cat_content_info), 1); |
|
135 | + $json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016 |
|
136 | + $json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08 |
|
137 | + $canvas_jason = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']'; |
|
138 | + } else { |
|
139 | + $canvas_jason = '[{"totalcount":"0"}]'; |
|
140 | + } |
|
141 | + $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason); |
|
142 | + |
|
143 | + /** |
|
144 | + * Filter the send_marker_jason_to_js() function map canvas json args. |
|
145 | + * |
|
146 | + * You can use this filter to modify map canvas json args. |
|
147 | + * |
|
148 | + * @since 1.0.0 |
|
149 | + * @package GeoDirectory |
|
150 | + * @param string $canvas Map canvas array key. |
|
151 | + * @param array $map_canvas_jason_args Map canvas args. |
|
152 | + */ |
|
153 | + $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args); |
|
154 | + |
|
155 | + wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args); |
|
156 | + } else { |
|
157 | + $canvas_jason = '[{"totalcount":"0"}]'; |
|
158 | + $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason); |
|
159 | + |
|
160 | + /** |
|
161 | + * Filter the send_marker_jason_to_js() function map canvas json args. |
|
162 | + * |
|
163 | + * You can use this filter to modify map canvas json args. |
|
164 | + * |
|
165 | + * @since 1.0.0 |
|
166 | + * @package GeoDirectory |
|
167 | + * @param string $canvas Map canvas array key. |
|
168 | + * @param array $map_canvas_jason_args Map canvas args. |
|
169 | + */ |
|
170 | + $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args); |
|
171 | + wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args); |
|
172 | + } |
|
173 | + } |
|
174 | + |
|
175 | + } |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | /** |
@@ -195,99 +195,99 @@ discard block |
||
195 | 195 | */ |
196 | 196 | function home_map_taxonomy_walker($cat_taxonomy, $cat_parent = 0, $hide_empty = true, $pading = 0, $map_canvas_name = '', $child_collapse, $is_home_map = false) |
197 | 197 | { |
198 | - global $cat_count, $geodir_cat_icons, $gd_session; |
|
198 | + global $cat_count, $geodir_cat_icons, $gd_session; |
|
199 | 199 | |
200 | - $exclude_categories = get_option('geodir_exclude_cat_on_map'); |
|
201 | - $exclude_categories_new = get_option('geodir_exclude_cat_on_map_upgrade'); |
|
200 | + $exclude_categories = get_option('geodir_exclude_cat_on_map'); |
|
201 | + $exclude_categories_new = get_option('geodir_exclude_cat_on_map_upgrade'); |
|
202 | 202 | |
203 | - // check if exclude categories saved before fix of categories identical names |
|
204 | - if ($exclude_categories_new) { |
|
205 | - $gd_cat_taxonomy = isset($cat_taxonomy[0]) ? $cat_taxonomy[0] : ''; |
|
206 | - $exclude_categories = !empty($exclude_categories[$gd_cat_taxonomy]) && is_array($exclude_categories[$gd_cat_taxonomy]) ? array_unique($exclude_categories[$gd_cat_taxonomy]) : array(); |
|
207 | - } |
|
203 | + // check if exclude categories saved before fix of categories identical names |
|
204 | + if ($exclude_categories_new) { |
|
205 | + $gd_cat_taxonomy = isset($cat_taxonomy[0]) ? $cat_taxonomy[0] : ''; |
|
206 | + $exclude_categories = !empty($exclude_categories[$gd_cat_taxonomy]) && is_array($exclude_categories[$gd_cat_taxonomy]) ? array_unique($exclude_categories[$gd_cat_taxonomy]) : array(); |
|
207 | + } |
|
208 | 208 | |
209 | - $exclude_cat_str = implode(',', $exclude_categories); |
|
209 | + $exclude_cat_str = implode(',', $exclude_categories); |
|
210 | 210 | |
211 | - if ($exclude_cat_str == '') { |
|
212 | - $exclude_cat_str = '0'; |
|
213 | - } |
|
211 | + if ($exclude_cat_str == '') { |
|
212 | + $exclude_cat_str = '0'; |
|
213 | + } |
|
214 | 214 | |
215 | - $cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'exclude' => $exclude_cat_str, 'hide_empty ' => $hide_empty)); |
|
215 | + $cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'exclude' => $exclude_cat_str, 'hide_empty ' => $hide_empty)); |
|
216 | 216 | |
217 | - if ($hide_empty) { |
|
218 | - $cat_terms = geodir_filter_empty_terms($cat_terms); |
|
219 | - } |
|
217 | + if ($hide_empty) { |
|
218 | + $cat_terms = geodir_filter_empty_terms($cat_terms); |
|
219 | + } |
|
220 | 220 | |
221 | - $main_list_class = ''; |
|
222 | - //If there are terms, start displaying |
|
223 | - if (count($cat_terms) > 0) { |
|
224 | - //Displaying as a list |
|
225 | - $p = $pading * 15; |
|
226 | - $pading++; |
|
221 | + $main_list_class = ''; |
|
222 | + //If there are terms, start displaying |
|
223 | + if (count($cat_terms) > 0) { |
|
224 | + //Displaying as a list |
|
225 | + $p = $pading * 15; |
|
226 | + $pading++; |
|
227 | 227 | |
228 | - if ($cat_parent == 0) { |
|
229 | - $list_class = 'main_list'; |
|
230 | - $display = ''; |
|
231 | - } else { |
|
232 | - $list_class = 'sub_list'; |
|
233 | - $display = !$child_collapse ? '' : 'display:none'; |
|
234 | - } |
|
228 | + if ($cat_parent == 0) { |
|
229 | + $list_class = 'main_list'; |
|
230 | + $display = ''; |
|
231 | + } else { |
|
232 | + $list_class = 'sub_list'; |
|
233 | + $display = !$child_collapse ? '' : 'display:none'; |
|
234 | + } |
|
235 | 235 | |
236 | - $out = '<ul class="treeview ' . $list_class . '" style="margin-left:' . $p . 'px;' . $display . ';">'; |
|
236 | + $out = '<ul class="treeview ' . $list_class . '" style="margin-left:' . $p . 'px;' . $display . ';">'; |
|
237 | 237 | |
238 | - $geodir_cat_icons = geodir_get_term_icon(); |
|
238 | + $geodir_cat_icons = geodir_get_term_icon(); |
|
239 | 239 | |
240 | - $geodir_default_map_search_pt = (get_option('geodir_default_map_search_pt')) ? get_option('geodir_default_map_search_pt') : 'gd_place'; |
|
241 | - if ($is_home_map && $homemap_catlist_ptype = $gd_session->get('homemap_catlist_ptype')) { |
|
242 | - $geodir_default_map_search_pt = $homemap_catlist_ptype; |
|
243 | - } |
|
244 | - $post_type = isset($_REQUEST['post_type']) ? $_REQUEST['post_type'] : (isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : $geodir_default_map_search_pt); |
|
240 | + $geodir_default_map_search_pt = (get_option('geodir_default_map_search_pt')) ? get_option('geodir_default_map_search_pt') : 'gd_place'; |
|
241 | + if ($is_home_map && $homemap_catlist_ptype = $gd_session->get('homemap_catlist_ptype')) { |
|
242 | + $geodir_default_map_search_pt = $homemap_catlist_ptype; |
|
243 | + } |
|
244 | + $post_type = isset($_REQUEST['post_type']) ? $_REQUEST['post_type'] : (isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : $geodir_default_map_search_pt); |
|
245 | 245 | |
246 | - foreach ($cat_terms as $cat_term): |
|
247 | - $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$cat_term->term_id]) ? $geodir_cat_icons[$cat_term->term_id] : ''; |
|
248 | - |
|
249 | - if (!in_array($cat_term->term_id, $exclude_categories)): |
|
250 | - //Secret sauce. Function calls itself to display child elements, if any |
|
251 | - $checked = 'checked="checked"'; |
|
252 | - |
|
253 | - // Untick the category by default on home map |
|
254 | - if ($is_home_map && $geodir_home_map_untick = get_option('geodir_home_map_untick')) { |
|
255 | - if (function_exists('icl_object_id')) { // if WPML |
|
256 | - global $sitepress; |
|
257 | - $default_lang = $sitepress->get_default_language(); |
|
258 | - $term_id = icl_object_id($cat_term->term_id, $post_type.'category', true, $default_lang); |
|
259 | - }else{ |
|
260 | - $term_id = $cat_term->term_id; |
|
261 | - } |
|
262 | - if (!empty($geodir_home_map_untick) && in_array($post_type . '_' . $term_id, $geodir_home_map_untick)) { |
|
263 | - $checked = ''; |
|
264 | - } |
|
265 | - } |
|
266 | - |
|
267 | - $term_check = '<input type="checkbox" ' . $checked . ' id="' .$map_canvas_name.'_tick_cat_'. $cat_term->term_id . '" class="group_selector ' . $main_list_class . '"'; |
|
268 | - $term_check .= ' name="' . $map_canvas_name . '_cat[]" '; |
|
269 | - $term_check .= ' title="' . esc_attr(ucfirst($cat_term->name)) . '" value="' . $cat_term->term_id . '" onclick="javascript:build_map_ajax_search_param(\'' . $map_canvas_name . '\',false, this)">'; |
|
270 | - $term_img = '<img height="15" width="15" alt="' . $cat_term->taxonomy . '" src="' . $icon . '" title="' . ucfirst($cat_term->name) . '"/>'; |
|
271 | - $out .= '<li>' . $term_check . '<label for="' . $map_canvas_name.'_tick_cat_'. $cat_term->term_id . '">' . $term_img . ucfirst($cat_term->name) . '</label><i class="fa fa-long-arrow-down"></i>'; |
|
272 | - |
|
273 | - endif; |
|
274 | - |
|
275 | - |
|
276 | - // get sub category by recursion |
|
277 | - $out .= home_map_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading, $map_canvas_name, $child_collapse, $is_home_map); |
|
278 | - |
|
279 | - $out .= '</li>'; |
|
280 | - |
|
281 | - endforeach; |
|
282 | - |
|
283 | - $out .= '</ul>'; |
|
284 | - |
|
285 | - return $out; |
|
286 | - } else { |
|
287 | - if ($cat_parent == 0) |
|
288 | - return _e('No category', 'geodirectory'); |
|
289 | - } |
|
290 | - return; |
|
246 | + foreach ($cat_terms as $cat_term): |
|
247 | + $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$cat_term->term_id]) ? $geodir_cat_icons[$cat_term->term_id] : ''; |
|
248 | + |
|
249 | + if (!in_array($cat_term->term_id, $exclude_categories)): |
|
250 | + //Secret sauce. Function calls itself to display child elements, if any |
|
251 | + $checked = 'checked="checked"'; |
|
252 | + |
|
253 | + // Untick the category by default on home map |
|
254 | + if ($is_home_map && $geodir_home_map_untick = get_option('geodir_home_map_untick')) { |
|
255 | + if (function_exists('icl_object_id')) { // if WPML |
|
256 | + global $sitepress; |
|
257 | + $default_lang = $sitepress->get_default_language(); |
|
258 | + $term_id = icl_object_id($cat_term->term_id, $post_type.'category', true, $default_lang); |
|
259 | + }else{ |
|
260 | + $term_id = $cat_term->term_id; |
|
261 | + } |
|
262 | + if (!empty($geodir_home_map_untick) && in_array($post_type . '_' . $term_id, $geodir_home_map_untick)) { |
|
263 | + $checked = ''; |
|
264 | + } |
|
265 | + } |
|
266 | + |
|
267 | + $term_check = '<input type="checkbox" ' . $checked . ' id="' .$map_canvas_name.'_tick_cat_'. $cat_term->term_id . '" class="group_selector ' . $main_list_class . '"'; |
|
268 | + $term_check .= ' name="' . $map_canvas_name . '_cat[]" '; |
|
269 | + $term_check .= ' title="' . esc_attr(ucfirst($cat_term->name)) . '" value="' . $cat_term->term_id . '" onclick="javascript:build_map_ajax_search_param(\'' . $map_canvas_name . '\',false, this)">'; |
|
270 | + $term_img = '<img height="15" width="15" alt="' . $cat_term->taxonomy . '" src="' . $icon . '" title="' . ucfirst($cat_term->name) . '"/>'; |
|
271 | + $out .= '<li>' . $term_check . '<label for="' . $map_canvas_name.'_tick_cat_'. $cat_term->term_id . '">' . $term_img . ucfirst($cat_term->name) . '</label><i class="fa fa-long-arrow-down"></i>'; |
|
272 | + |
|
273 | + endif; |
|
274 | + |
|
275 | + |
|
276 | + // get sub category by recursion |
|
277 | + $out .= home_map_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading, $map_canvas_name, $child_collapse, $is_home_map); |
|
278 | + |
|
279 | + $out .= '</li>'; |
|
280 | + |
|
281 | + endforeach; |
|
282 | + |
|
283 | + $out .= '</ul>'; |
|
284 | + |
|
285 | + return $out; |
|
286 | + } else { |
|
287 | + if ($cat_parent == 0) |
|
288 | + return _e('No category', 'geodirectory'); |
|
289 | + } |
|
290 | + return; |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | /** |
@@ -299,19 +299,19 @@ discard block |
||
299 | 299 | * @return string The map API provider name. |
300 | 300 | */ |
301 | 301 | function geodir_map_name() { |
302 | - $geodir_map_name = get_option('geodir_load_map', 'google'); |
|
302 | + $geodir_map_name = get_option('geodir_load_map', 'google'); |
|
303 | 303 | |
304 | - if (!in_array($geodir_map_name, array('none', 'auto', 'google', 'osm'))) { |
|
305 | - $geodir_map_name = 'auto'; |
|
306 | - } |
|
307 | - |
|
308 | - /** |
|
309 | - * Filter the map JS API provider name. |
|
310 | - * |
|
311 | - * @since 1.6.1 |
|
312 | - * @param string $geodir_map_name The map API provider name. |
|
313 | - */ |
|
314 | - return apply_filters('geodir_map_name', $geodir_map_name); |
|
304 | + if (!in_array($geodir_map_name, array('none', 'auto', 'google', 'osm'))) { |
|
305 | + $geodir_map_name = 'auto'; |
|
306 | + } |
|
307 | + |
|
308 | + /** |
|
309 | + * Filter the map JS API provider name. |
|
310 | + * |
|
311 | + * @since 1.6.1 |
|
312 | + * @param string $geodir_map_name The map API provider name. |
|
313 | + */ |
|
314 | + return apply_filters('geodir_map_name', $geodir_map_name); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | /** |
@@ -327,48 +327,48 @@ discard block |
||
327 | 327 | * @return array The icon size. |
328 | 328 | */ |
329 | 329 | function geodir_get_marker_size($icon, $default_size = array('w' => 36, 'h' => 45)) { |
330 | - global $gd_marker_sizes; |
|
330 | + global $gd_marker_sizes; |
|
331 | 331 | |
332 | - if (empty($gd_marker_sizes)) { |
|
333 | - $gd_marker_sizes = array(); |
|
334 | - } |
|
332 | + if (empty($gd_marker_sizes)) { |
|
333 | + $gd_marker_sizes = array(); |
|
334 | + } |
|
335 | 335 | |
336 | - if (!empty($gd_marker_sizes[$icon])) { |
|
337 | - return $gd_marker_sizes[$icon]; |
|
338 | - } |
|
336 | + if (!empty($gd_marker_sizes[$icon])) { |
|
337 | + return $gd_marker_sizes[$icon]; |
|
338 | + } |
|
339 | 339 | |
340 | - if (empty($icon)) { |
|
341 | - $gd_marker_sizes[$icon] = $default_size; |
|
340 | + if (empty($icon)) { |
|
341 | + $gd_marker_sizes[$icon] = $default_size; |
|
342 | 342 | |
343 | - return $default_size; |
|
344 | - } |
|
343 | + return $default_size; |
|
344 | + } |
|
345 | 345 | |
346 | - $icon_url = $icon; |
|
346 | + $icon_url = $icon; |
|
347 | 347 | |
348 | - $uploads = wp_upload_dir(); // Array of key => value pairs |
|
348 | + $uploads = wp_upload_dir(); // Array of key => value pairs |
|
349 | 349 | |
350 | - if (!path_is_absolute($icon)) { |
|
351 | - $icon = str_replace($uploads['baseurl'], $uploads['basedir'], $icon); |
|
352 | - } |
|
350 | + if (!path_is_absolute($icon)) { |
|
351 | + $icon = str_replace($uploads['baseurl'], $uploads['basedir'], $icon); |
|
352 | + } |
|
353 | 353 | |
354 | - if (!path_is_absolute($icon) && strpos($icon, WP_CONTENT_URL) !== false) { |
|
355 | - $icon = str_replace(WP_CONTENT_URL, WP_CONTENT_DIR, $icon); |
|
356 | - } |
|
354 | + if (!path_is_absolute($icon) && strpos($icon, WP_CONTENT_URL) !== false) { |
|
355 | + $icon = str_replace(WP_CONTENT_URL, WP_CONTENT_DIR, $icon); |
|
356 | + } |
|
357 | 357 | |
358 | - $sizes = array(); |
|
359 | - if (is_file($icon) && file_exists($icon)) { |
|
360 | - $size = getimagesize(trim($icon)); |
|
358 | + $sizes = array(); |
|
359 | + if (is_file($icon) && file_exists($icon)) { |
|
360 | + $size = getimagesize(trim($icon)); |
|
361 | 361 | |
362 | - if (!empty($size[0]) && !empty($size[1])) { |
|
363 | - $sizes = array('w' => $size[0], 'h' => $size[1]); |
|
364 | - } |
|
365 | - } |
|
362 | + if (!empty($size[0]) && !empty($size[1])) { |
|
363 | + $sizes = array('w' => $size[0], 'h' => $size[1]); |
|
364 | + } |
|
365 | + } |
|
366 | 366 | |
367 | - $sizes = !empty($sizes) ? $sizes : $default_size; |
|
367 | + $sizes = !empty($sizes) ? $sizes : $default_size; |
|
368 | 368 | |
369 | - $gd_marker_sizes[$icon_url] = $sizes; |
|
369 | + $gd_marker_sizes[$icon_url] = $sizes; |
|
370 | 370 | |
371 | - return $sizes; |
|
371 | + return $sizes; |
|
372 | 372 | } |
373 | 373 | |
374 | 374 | add_action('wp_footer', 'geodir_map_load_script', 10); |
@@ -380,8 +380,8 @@ discard block |
||
380 | 380 | * @package GeoDirectory |
381 | 381 | */ |
382 | 382 | function geodir_map_load_script() { |
383 | - if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is( 'geodirectory-googlemap-script', 'done')) { |
|
384 | - $plugin_url = geodir_plugin_url(); |
|
383 | + if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is( 'geodirectory-googlemap-script', 'done')) { |
|
384 | + $plugin_url = geodir_plugin_url(); |
|
385 | 385 | ?> |
386 | 386 | <script type="text/javascript"> |
387 | 387 | if (!(window.google && typeof google.maps !== 'undefined')) { |
@@ -395,5 +395,5 @@ discard block |
||
395 | 395 | } |
396 | 396 | </script> |
397 | 397 | <?php |
398 | - } |
|
398 | + } |
|
399 | 399 | } |
400 | 400 | \ No newline at end of file |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | if (!empty($post) && isset($post->ID) && $post->ID > 0 && (is_main_query() || $add_post_in_marker_array) && $post->marker_json != '') { |
56 | 56 | |
57 | - if(isset($map_jason[$post->ID])){return null;} |
|
57 | + if (isset($map_jason[$post->ID])) {return null; } |
|
58 | 58 | |
59 | 59 | $srcharr = array("'", "/", "-", '"', '\\'); |
60 | 60 | $replarr = array("′", "⁄", "–", "“", ''); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $title = str_replace($srcharr, $replarr, $post_title); |
68 | 68 | |
69 | 69 | if (is_ssl()) { |
70 | - $icon = str_replace("http:","https:",$icon ); |
|
70 | + $icon = str_replace("http:", "https:", $icon); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | if ($icon != '') { |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | $icon_size = array('w' => 36, 'h' => 45); |
84 | 84 | } |
85 | 85 | |
86 | - $post_json = '{"id":"' . $post->ID . '","t": "' . $title . '","lt": "' . $post->post_latitude . '","ln": "' . $post->post_longitude . '","mk_id":"' . $post->ID . '_' . $post->default_category . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"}'; |
|
86 | + $post_json = '{"id":"'.$post->ID.'","t": "'.$title.'","lt": "'.$post->post_latitude.'","ln": "'.$post->post_longitude.'","mk_id":"'.$post->ID.'_'.$post->default_category.'","i":"'.$icon.'","w":"'.$icon_size['w'].'","h":"'.$icon_size['h'].'"}'; |
|
87 | 87 | |
88 | 88 | /** |
89 | 89 | * Filter the json data when creating output for post json marker.. |
@@ -92,10 +92,10 @@ discard block |
||
92 | 92 | * @param string $post_json JSON representation of the post marker info. |
93 | 93 | * @param object $post The post object. |
94 | 94 | */ |
95 | - $post_map_json = apply_filters('geodir_create_marker_jason_of_posts',$post_json, $post); |
|
95 | + $post_map_json = apply_filters('geodir_create_marker_jason_of_posts', $post_json, $post); |
|
96 | 96 | |
97 | 97 | // only assign it if it has a value |
98 | - if($post_map_json){ |
|
98 | + if ($post_map_json) { |
|
99 | 99 | $map_jason[$post->ID] = $post_map_json; |
100 | 100 | } |
101 | 101 | |
@@ -119,13 +119,13 @@ discard block |
||
119 | 119 | if (is_array($map_jason) && !empty($map_jason)) { |
120 | 120 | |
121 | 121 | // on details page only show the main marker on the map |
122 | - if(geodir_is_page('detail')){ |
|
122 | + if (geodir_is_page('detail')) { |
|
123 | 123 | global $post; |
124 | - if(isset($map_jason[$post->ID])){ |
|
124 | + if (isset($map_jason[$post->ID])) { |
|
125 | 125 | $map_jason = array($map_jason[$post->ID]); |
126 | 126 | } |
127 | 127 | } |
128 | - $canvas_jason = $canvas . "_jason"; |
|
128 | + $canvas_jason = $canvas."_jason"; |
|
129 | 129 | $map_canvas_arr[$canvas] = array_unique($map_jason); |
130 | 130 | unset($cat_content_info); |
131 | 131 | $cat_content_info[] = implode(',', $map_canvas_arr[$canvas]); |
@@ -134,11 +134,11 @@ discard block |
||
134 | 134 | $json_content = substr(implode(',', $cat_content_info), 1); |
135 | 135 | $json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016 |
136 | 136 | $json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08 |
137 | - $canvas_jason = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']'; |
|
137 | + $canvas_jason = '[{"totalcount":"'.$totalcount.'",'.$json_content.']'; |
|
138 | 138 | } else { |
139 | 139 | $canvas_jason = '[{"totalcount":"0"}]'; |
140 | 140 | } |
141 | - $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason); |
|
141 | + $map_canvas_jason_args = array($canvas.'_jason' => $canvas_jason); |
|
142 | 142 | |
143 | 143 | /** |
144 | 144 | * Filter the send_marker_jason_to_js() function map canvas json args. |
@@ -150,12 +150,12 @@ discard block |
||
150 | 150 | * @param string $canvas Map canvas array key. |
151 | 151 | * @param array $map_canvas_jason_args Map canvas args. |
152 | 152 | */ |
153 | - $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args); |
|
153 | + $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_'.$canvas, $map_canvas_jason_args); |
|
154 | 154 | |
155 | - wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args); |
|
155 | + wp_localize_script('geodir-map-widget', $canvas.'_jason_args', $map_canvas_jason_args); |
|
156 | 156 | } else { |
157 | 157 | $canvas_jason = '[{"totalcount":"0"}]'; |
158 | - $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason); |
|
158 | + $map_canvas_jason_args = array($canvas.'_jason' => $canvas_jason); |
|
159 | 159 | |
160 | 160 | /** |
161 | 161 | * Filter the send_marker_jason_to_js() function map canvas json args. |
@@ -167,8 +167,8 @@ discard block |
||
167 | 167 | * @param string $canvas Map canvas array key. |
168 | 168 | * @param array $map_canvas_jason_args Map canvas args. |
169 | 169 | */ |
170 | - $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args); |
|
171 | - wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args); |
|
170 | + $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_'.$canvas, $map_canvas_jason_args); |
|
171 | + wp_localize_script('geodir-map-widget', $canvas.'_jason_args', $map_canvas_jason_args); |
|
172 | 172 | } |
173 | 173 | } |
174 | 174 | |
@@ -233,11 +233,11 @@ discard block |
||
233 | 233 | $display = !$child_collapse ? '' : 'display:none'; |
234 | 234 | } |
235 | 235 | |
236 | - $out = '<ul class="treeview ' . $list_class . '" style="margin-left:' . $p . 'px;' . $display . ';">'; |
|
236 | + $out = '<ul class="treeview '.$list_class.'" style="margin-left:'.$p.'px;'.$display.';">'; |
|
237 | 237 | |
238 | 238 | $geodir_cat_icons = geodir_get_term_icon(); |
239 | 239 | |
240 | - $geodir_default_map_search_pt = (get_option('geodir_default_map_search_pt')) ? get_option('geodir_default_map_search_pt') : 'gd_place'; |
|
240 | + $geodir_default_map_search_pt = (get_option('geodir_default_map_search_pt')) ? get_option('geodir_default_map_search_pt') : 'gd_place'; |
|
241 | 241 | if ($is_home_map && $homemap_catlist_ptype = $gd_session->get('homemap_catlist_ptype')) { |
242 | 242 | $geodir_default_map_search_pt = $homemap_catlist_ptype; |
243 | 243 | } |
@@ -256,19 +256,19 @@ discard block |
||
256 | 256 | global $sitepress; |
257 | 257 | $default_lang = $sitepress->get_default_language(); |
258 | 258 | $term_id = icl_object_id($cat_term->term_id, $post_type.'category', true, $default_lang); |
259 | - }else{ |
|
259 | + } else { |
|
260 | 260 | $term_id = $cat_term->term_id; |
261 | 261 | } |
262 | - if (!empty($geodir_home_map_untick) && in_array($post_type . '_' . $term_id, $geodir_home_map_untick)) { |
|
262 | + if (!empty($geodir_home_map_untick) && in_array($post_type.'_'.$term_id, $geodir_home_map_untick)) { |
|
263 | 263 | $checked = ''; |
264 | 264 | } |
265 | 265 | } |
266 | 266 | |
267 | - $term_check = '<input type="checkbox" ' . $checked . ' id="' .$map_canvas_name.'_tick_cat_'. $cat_term->term_id . '" class="group_selector ' . $main_list_class . '"'; |
|
268 | - $term_check .= ' name="' . $map_canvas_name . '_cat[]" '; |
|
269 | - $term_check .= ' title="' . esc_attr(ucfirst($cat_term->name)) . '" value="' . $cat_term->term_id . '" onclick="javascript:build_map_ajax_search_param(\'' . $map_canvas_name . '\',false, this)">'; |
|
270 | - $term_img = '<img height="15" width="15" alt="' . $cat_term->taxonomy . '" src="' . $icon . '" title="' . ucfirst($cat_term->name) . '"/>'; |
|
271 | - $out .= '<li>' . $term_check . '<label for="' . $map_canvas_name.'_tick_cat_'. $cat_term->term_id . '">' . $term_img . ucfirst($cat_term->name) . '</label><i class="fa fa-long-arrow-down"></i>'; |
|
267 | + $term_check = '<input type="checkbox" '.$checked.' id="'.$map_canvas_name.'_tick_cat_'.$cat_term->term_id.'" class="group_selector '.$main_list_class.'"'; |
|
268 | + $term_check .= ' name="'.$map_canvas_name.'_cat[]" '; |
|
269 | + $term_check .= ' title="'.esc_attr(ucfirst($cat_term->name)).'" value="'.$cat_term->term_id.'" onclick="javascript:build_map_ajax_search_param(\''.$map_canvas_name.'\',false, this)">'; |
|
270 | + $term_img = '<img height="15" width="15" alt="'.$cat_term->taxonomy.'" src="'.$icon.'" title="'.ucfirst($cat_term->name).'"/>'; |
|
271 | + $out .= '<li>'.$term_check.'<label for="'.$map_canvas_name.'_tick_cat_'.$cat_term->term_id.'">'.$term_img.ucfirst($cat_term->name).'</label><i class="fa fa-long-arrow-down"></i>'; |
|
272 | 272 | |
273 | 273 | endif; |
274 | 274 | |
@@ -380,18 +380,18 @@ discard block |
||
380 | 380 | * @package GeoDirectory |
381 | 381 | */ |
382 | 382 | function geodir_map_load_script() { |
383 | - if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is( 'geodirectory-googlemap-script', 'done')) { |
|
383 | + if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is('geodirectory-googlemap-script', 'done')) { |
|
384 | 384 | $plugin_url = geodir_plugin_url(); |
385 | 385 | ?> |
386 | 386 | <script type="text/javascript"> |
387 | 387 | if (!(window.google && typeof google.maps !== 'undefined')) { |
388 | - var css = document.createElement("link");css.setAttribute("rel","stylesheet");css.setAttribute("type","text/css");css.setAttribute("media","all");css.setAttribute("id","geodirectory-leaflet-style-css");css.setAttribute("href","<?php echo $plugin_url;?>/geodirectory-assets/leaflet/leaflet.css?ver=<?php echo GEODIRECTORY_VERSION;?>"); |
|
388 | + var css = document.createElement("link");css.setAttribute("rel","stylesheet");css.setAttribute("type","text/css");css.setAttribute("media","all");css.setAttribute("id","geodirectory-leaflet-style-css");css.setAttribute("href","<?php echo $plugin_url; ?>/geodirectory-assets/leaflet/leaflet.css?ver=<?php echo GEODIRECTORY_VERSION; ?>"); |
|
389 | 389 | document.getElementsByTagName("head")[0].appendChild(css); |
390 | - var css = document.createElement("link");css.setAttribute("rel","stylesheet");css.setAttribute("type","text/css");css.setAttribute("media","all");css.setAttribute("id","geodirectory-leaflet-routing-style");css.setAttribute("href","<?php echo $plugin_url;?>/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css?ver=<?php echo GEODIRECTORY_VERSION;?>"); |
|
390 | + var css = document.createElement("link");css.setAttribute("rel","stylesheet");css.setAttribute("type","text/css");css.setAttribute("media","all");css.setAttribute("id","geodirectory-leaflet-routing-style");css.setAttribute("href","<?php echo $plugin_url; ?>/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css?ver=<?php echo GEODIRECTORY_VERSION; ?>"); |
|
391 | 391 | document.getElementsByTagName("head")[0].appendChild(css); |
392 | - document.write('<' + 'script id="geodirectory-leaflet-script" src="<?php echo $plugin_url;?>/geodirectory-assets/leaflet/leaflet.min.js?ver=<?php echo GEODIRECTORY_VERSION;?>" type="text/javascript"><' + '/script>'); |
|
393 | - document.write('<' + 'script id="geodirectory-leaflet-geo-script" src="<?php echo $plugin_url;?>/geodirectory-assets/leaflet/osm.geocode.js?ver=<?php echo GEODIRECTORY_VERSION;?>" type="text/javascript"><' + '/script>'); |
|
394 | - document.write('<' + 'script id="geodirectory-leaflet-routing-script" src="<?php echo $plugin_url;?>/geodirectory-assets/leaflet/routing/leaflet-routing-machine.js?ver=<?php echo GEODIRECTORY_VERSION;?>" type="text/javascript"><' + '/script>'); |
|
392 | + document.write('<' + 'script id="geodirectory-leaflet-script" src="<?php echo $plugin_url; ?>/geodirectory-assets/leaflet/leaflet.min.js?ver=<?php echo GEODIRECTORY_VERSION; ?>" type="text/javascript"><' + '/script>'); |
|
393 | + document.write('<' + 'script id="geodirectory-leaflet-geo-script" src="<?php echo $plugin_url; ?>/geodirectory-assets/leaflet/osm.geocode.js?ver=<?php echo GEODIRECTORY_VERSION; ?>" type="text/javascript"><' + '/script>'); |
|
394 | + document.write('<' + 'script id="geodirectory-leaflet-routing-script" src="<?php echo $plugin_url; ?>/geodirectory-assets/leaflet/routing/leaflet-routing-machine.js?ver=<?php echo GEODIRECTORY_VERSION; ?>" type="text/javascript"><' + '/script>'); |
|
395 | 395 | } |
396 | 396 | </script> |
397 | 397 | <?php |
@@ -16,10 +16,10 @@ discard block |
||
16 | 16 | */ |
17 | 17 | function geodir_session_start() |
18 | 18 | { |
19 | - if (!session_id()) session_start(); |
|
20 | - global $geodir_add_location_url; |
|
19 | + if (!session_id()) session_start(); |
|
20 | + global $geodir_add_location_url; |
|
21 | 21 | |
22 | - $geodir_add_location_url = NULL; |
|
22 | + $geodir_add_location_url = NULL; |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
@@ -33,18 +33,18 @@ discard block |
||
33 | 33 | */ |
34 | 34 | function geodir_modified_query($query) |
35 | 35 | { |
36 | - if ($query->is_main_query() && ( |
|
37 | - (geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
|
38 | - || geodir_is_page('listing') |
|
39 | - || geodir_is_page('author') |
|
40 | - || geodir_is_page('search') |
|
41 | - || geodir_is_page('detail')) |
|
42 | - ) { |
|
43 | - |
|
44 | - $query->set('is_geodir_loop', true); |
|
45 | - } |
|
36 | + if ($query->is_main_query() && ( |
|
37 | + (geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
|
38 | + || geodir_is_page('listing') |
|
39 | + || geodir_is_page('author') |
|
40 | + || geodir_is_page('search') |
|
41 | + || geodir_is_page('detail')) |
|
42 | + ) { |
|
43 | + |
|
44 | + $query->set('is_geodir_loop', true); |
|
45 | + } |
|
46 | 46 | |
47 | - return $query; |
|
47 | + return $query; |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
@@ -67,81 +67,81 @@ discard block |
||
67 | 67 | */ |
68 | 68 | function set_listing_request($query ) |
69 | 69 | { |
70 | - global $wp_query, $wpdb, $geodir_post_type, $table, $dist, $mylat, $mylon, $s, $snear, $s, $s_A, $s_SA; |
|
70 | + global $wp_query, $wpdb, $geodir_post_type, $table, $dist, $mylat, $mylon, $s, $snear, $s, $s_A, $s_SA; |
|
71 | 71 | |
72 | 72 | |
73 | - // fix woocommerce shop products filtered by language for GD + WPML + Woocommerce |
|
74 | - if (!geodir_is_geodir_page()) { |
|
75 | - return; |
|
76 | - } |
|
73 | + // fix woocommerce shop products filtered by language for GD + WPML + Woocommerce |
|
74 | + if (!geodir_is_geodir_page()) { |
|
75 | + return; |
|
76 | + } |
|
77 | 77 | |
78 | - /* remove all pre filters */ |
|
79 | - remove_all_filters('query'); |
|
80 | - remove_all_filters('posts_search'); |
|
81 | - remove_all_filters('posts_fields'); |
|
82 | - remove_all_filters('posts_join'); |
|
83 | - remove_all_filters('posts_orderby'); |
|
84 | - remove_all_filters('posts_where'); |
|
78 | + /* remove all pre filters */ |
|
79 | + remove_all_filters('query'); |
|
80 | + remove_all_filters('posts_search'); |
|
81 | + remove_all_filters('posts_fields'); |
|
82 | + remove_all_filters('posts_join'); |
|
83 | + remove_all_filters('posts_orderby'); |
|
84 | + remove_all_filters('posts_where'); |
|
85 | 85 | |
86 | 86 | |
87 | - if ((is_search() && isset($_REQUEST['geodir_search']) && $_REQUEST['geodir_search'] != '')): |
|
87 | + if ((is_search() && isset($_REQUEST['geodir_search']) && $_REQUEST['geodir_search'] != '')): |
|
88 | 88 | |
89 | - if (isset($_REQUEST['scat']) && $_REQUEST['scat'] == 'all') $_REQUEST['scat'] = ''; |
|
90 | - //if(isset($_REQUEST['s']) && $_REQUEST['s'] == '+') $_REQUEST['s'] = ''; |
|
89 | + if (isset($_REQUEST['scat']) && $_REQUEST['scat'] == 'all') $_REQUEST['scat'] = ''; |
|
90 | + //if(isset($_REQUEST['s']) && $_REQUEST['s'] == '+') $_REQUEST['s'] = ''; |
|
91 | 91 | |
92 | - if (isset($_REQUEST['sdist'])) { |
|
93 | - ($_REQUEST['sdist'] != '0' && $_REQUEST['sdist'] != '') ? $dist = esc_attr($_REQUEST['sdist']) : $dist = 25000; |
|
94 | - } elseif (get_option('geodir_search_dist') != '') { |
|
95 | - $dist = get_option('geodir_search_dist'); |
|
92 | + if (isset($_REQUEST['sdist'])) { |
|
93 | + ($_REQUEST['sdist'] != '0' && $_REQUEST['sdist'] != '') ? $dist = esc_attr($_REQUEST['sdist']) : $dist = 25000; |
|
94 | + } elseif (get_option('geodir_search_dist') != '') { |
|
95 | + $dist = get_option('geodir_search_dist'); |
|
96 | 96 | |
97 | - } else { |
|
98 | - $dist = 25000; |
|
99 | - } // Distance |
|
97 | + } else { |
|
98 | + $dist = 25000; |
|
99 | + } // Distance |
|
100 | 100 | |
101 | - if (isset($_REQUEST['sgeo_lat'])) { |
|
102 | - $mylat = (float)esc_attr($_REQUEST['sgeo_lat']); |
|
103 | - } else { |
|
104 | - $mylat = (float)geodir_get_current_city_lat(); |
|
105 | - } // Latatude |
|
101 | + if (isset($_REQUEST['sgeo_lat'])) { |
|
102 | + $mylat = (float)esc_attr($_REQUEST['sgeo_lat']); |
|
103 | + } else { |
|
104 | + $mylat = (float)geodir_get_current_city_lat(); |
|
105 | + } // Latatude |
|
106 | 106 | |
107 | - if (isset($_REQUEST['sgeo_lon'])) { |
|
108 | - $mylon = (float)esc_attr($_REQUEST['sgeo_lon']); |
|
109 | - } else { |
|
110 | - $mylon = (float)geodir_get_current_city_lng(); |
|
111 | - } // Distance |
|
107 | + if (isset($_REQUEST['sgeo_lon'])) { |
|
108 | + $mylon = (float)esc_attr($_REQUEST['sgeo_lon']); |
|
109 | + } else { |
|
110 | + $mylon = (float)geodir_get_current_city_lng(); |
|
111 | + } // Distance |
|
112 | 112 | |
113 | - if (isset($_REQUEST['snear'])) { |
|
114 | - $snear = trim(esc_attr($_REQUEST['snear'])); |
|
115 | - } |
|
113 | + if (isset($_REQUEST['snear'])) { |
|
114 | + $snear = trim(esc_attr($_REQUEST['snear'])); |
|
115 | + } |
|
116 | 116 | |
117 | - if (isset($_REQUEST['s'])) { |
|
118 | - $s = trim(esc_attr(wp_strip_all_tags($_REQUEST['s']))); |
|
119 | - } |
|
117 | + if (isset($_REQUEST['s'])) { |
|
118 | + $s = trim(esc_attr(wp_strip_all_tags($_REQUEST['s']))); |
|
119 | + } |
|
120 | 120 | |
121 | - if ($snear == 'NEAR ME') { |
|
122 | - $ip = $_SERVER['REMOTE_ADDR']; |
|
123 | - $addr_details = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=' . $ip)); |
|
124 | - $mylat = stripslashes(ucfirst($addr_details[geoplugin_latitude])); |
|
125 | - $mylon = stripslashes(ucfirst($addr_details[geoplugin_longitude])); |
|
126 | - } |
|
121 | + if ($snear == 'NEAR ME') { |
|
122 | + $ip = $_SERVER['REMOTE_ADDR']; |
|
123 | + $addr_details = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=' . $ip)); |
|
124 | + $mylat = stripslashes(ucfirst($addr_details[geoplugin_latitude])); |
|
125 | + $mylon = stripslashes(ucfirst($addr_details[geoplugin_longitude])); |
|
126 | + } |
|
127 | 127 | |
128 | 128 | |
129 | - if (strstr($s, ',')) { |
|
130 | - $s_AA = str_replace(" ", "", $s); |
|
131 | - $s_A = explode(",", $s_AA); |
|
132 | - $s_A = implode('","', $s_A); |
|
133 | - $s_A = '"' . $s_A . '"'; |
|
134 | - } else { |
|
135 | - $s_A = '"' . $s . '"'; |
|
136 | - } |
|
129 | + if (strstr($s, ',')) { |
|
130 | + $s_AA = str_replace(" ", "", $s); |
|
131 | + $s_A = explode(",", $s_AA); |
|
132 | + $s_A = implode('","', $s_A); |
|
133 | + $s_A = '"' . $s_A . '"'; |
|
134 | + } else { |
|
135 | + $s_A = '"' . $s . '"'; |
|
136 | + } |
|
137 | 137 | |
138 | - if (strstr($s, ' ')) { |
|
139 | - $s_SA = explode(" ", $s); |
|
140 | - } else { |
|
141 | - $s_SA = ''; |
|
142 | - } |
|
138 | + if (strstr($s, ' ')) { |
|
139 | + $s_SA = explode(" ", $s); |
|
140 | + } else { |
|
141 | + $s_SA = ''; |
|
142 | + } |
|
143 | 143 | |
144 | - endif; |
|
144 | + endif; |
|
145 | 145 | |
146 | 146 | |
147 | 147 | |
@@ -162,56 +162,56 @@ discard block |
||
162 | 162 | */ |
163 | 163 | function geodir_listing_loop_filter($query) |
164 | 164 | { |
165 | - global $wp_query, $geodir_post_type, $table, $plugin_prefix, $table, $term; |
|
165 | + global $wp_query, $geodir_post_type, $table, $plugin_prefix, $table, $term; |
|
166 | 166 | |
167 | - // fix wp_reset_query for popular post view widget |
|
168 | - if (!geodir_is_geodir_page()) { |
|
169 | - return; |
|
170 | - } |
|
167 | + // fix wp_reset_query for popular post view widget |
|
168 | + if (!geodir_is_geodir_page()) { |
|
169 | + return; |
|
170 | + } |
|
171 | 171 | |
172 | - $geodir_post_type = geodir_get_current_posttype(); |
|
173 | - |
|
174 | - if (isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries) { |
|
175 | - $taxonomies = wp_list_pluck($wp_query->tax_query->queries, 'taxonomy'); |
|
176 | - |
|
177 | - if (isset($wp_query->query[$taxonomies[0]])) { |
|
178 | - $request_term = explode("/", $wp_query->query[$taxonomies[0]]); |
|
179 | - $request_term = end($request_term); |
|
180 | - if (!term_exists($request_term)) { |
|
181 | - $args = array('number' => '1',); |
|
182 | - $terms_arr = get_terms($taxonomies[0], $args); |
|
183 | - foreach ($terms_arr as $location_term) { |
|
184 | - $term_arr = $location_term; |
|
185 | - $term_arr->name = geodir_ucwords(str_replace('-', ' ', $request_term)); |
|
186 | - } |
|
187 | - $wp_query->queried_object_id = 1; |
|
188 | - $wp_query->queried_object = $term_arr; |
|
189 | - //print_r($wp_query) ; |
|
190 | - } |
|
191 | - } |
|
172 | + $geodir_post_type = geodir_get_current_posttype(); |
|
173 | + |
|
174 | + if (isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries) { |
|
175 | + $taxonomies = wp_list_pluck($wp_query->tax_query->queries, 'taxonomy'); |
|
176 | + |
|
177 | + if (isset($wp_query->query[$taxonomies[0]])) { |
|
178 | + $request_term = explode("/", $wp_query->query[$taxonomies[0]]); |
|
179 | + $request_term = end($request_term); |
|
180 | + if (!term_exists($request_term)) { |
|
181 | + $args = array('number' => '1',); |
|
182 | + $terms_arr = get_terms($taxonomies[0], $args); |
|
183 | + foreach ($terms_arr as $location_term) { |
|
184 | + $term_arr = $location_term; |
|
185 | + $term_arr->name = geodir_ucwords(str_replace('-', ' ', $request_term)); |
|
186 | + } |
|
187 | + $wp_query->queried_object_id = 1; |
|
188 | + $wp_query->queried_object = $term_arr; |
|
189 | + //print_r($wp_query) ; |
|
190 | + } |
|
191 | + } |
|
192 | 192 | |
193 | - } |
|
194 | - if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) { |
|
195 | - |
|
196 | - $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
197 | - |
|
198 | - add_filter('posts_fields', 'geodir_posts_fields', 1); |
|
199 | - add_filter('posts_join', 'geodir_posts_join', 1); |
|
200 | - geodir_post_where(); |
|
201 | - if (!is_admin()) |
|
202 | - add_filter('posts_orderby', 'geodir_posts_orderby', 1); |
|
203 | - |
|
204 | - // advanced filter for popular post view widget |
|
205 | - global $wp_query; |
|
206 | - if (!is_admin()) { |
|
207 | - if (!empty($wp_query->query['with_pics_only'])) { |
|
208 | - add_filter('posts_join', 'geodir_filter_widget_join', 1000); |
|
209 | - } |
|
210 | - add_filter('posts_where', 'geodir_filter_widget_where', 1000); |
|
211 | - } |
|
193 | + } |
|
194 | + if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) { |
|
212 | 195 | |
213 | - } |
|
214 | - return $query; |
|
196 | + $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
197 | + |
|
198 | + add_filter('posts_fields', 'geodir_posts_fields', 1); |
|
199 | + add_filter('posts_join', 'geodir_posts_join', 1); |
|
200 | + geodir_post_where(); |
|
201 | + if (!is_admin()) |
|
202 | + add_filter('posts_orderby', 'geodir_posts_orderby', 1); |
|
203 | + |
|
204 | + // advanced filter for popular post view widget |
|
205 | + global $wp_query; |
|
206 | + if (!is_admin()) { |
|
207 | + if (!empty($wp_query->query['with_pics_only'])) { |
|
208 | + add_filter('posts_join', 'geodir_filter_widget_join', 1000); |
|
209 | + } |
|
210 | + add_filter('posts_where', 'geodir_filter_widget_where', 1000); |
|
211 | + } |
|
212 | + |
|
213 | + } |
|
214 | + return $query; |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | |
@@ -230,67 +230,67 @@ discard block |
||
230 | 230 | * @return string Modified fields query string. |
231 | 231 | */ |
232 | 232 | function geodir_posts_fields($fields) { |
233 | - global $wp_query, $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $snear, $gd_session; |
|
233 | + global $wp_query, $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $snear, $gd_session; |
|
234 | 234 | |
235 | - // Filter-Location-Manager to add location table. |
|
236 | - $fields .= ", " . $table . ".* "; |
|
235 | + // Filter-Location-Manager to add location table. |
|
236 | + $fields .= ", " . $table . ".* "; |
|
237 | 237 | |
238 | 238 | if ($snear != '' || $gd_session->get('all_near_me')) { |
239 | - $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1')); |
|
239 | + $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1')); |
|
240 | 240 | |
241 | 241 | if ($gd_session->get('all_near_me')) { |
242 | - $mylat = $gd_session->get('user_lat'); |
|
243 | - $mylon = $gd_session->get('user_lon'); |
|
244 | - } |
|
245 | - |
|
246 | - $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance "; |
|
247 | - } |
|
248 | - |
|
249 | - global $s; |
|
250 | - if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') { |
|
251 | - $keywords = explode(" ", $s); |
|
252 | - |
|
253 | - if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){ |
|
254 | - foreach($keywords as $kkey=>$kword){ |
|
255 | - if(mb_strlen($kword, 'UTF-8')<=$klimit){ |
|
256 | - unset($keywords[$kkey]); |
|
257 | - } |
|
258 | - } |
|
259 | - } |
|
242 | + $mylat = $gd_session->get('user_lat'); |
|
243 | + $mylon = $gd_session->get('user_lon'); |
|
244 | + } |
|
260 | 245 | |
246 | + $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance "; |
|
247 | + } |
|
261 | 248 | |
262 | - if (count($keywords) > 1) { |
|
263 | - $parts = array( |
|
264 | - 'AND' => 'gd_alltitlematch_part', |
|
265 | - 'OR' => 'gd_titlematch_part' |
|
266 | - ); |
|
267 | - $gd_titlematch_part = ""; |
|
268 | - foreach ($parts as $key => $part) { |
|
269 | - $gd_titlematch_part .= " CASE WHEN "; |
|
270 | - $count = 0; |
|
271 | - foreach ($keywords as $keyword) { |
|
272 | - $keyword = trim($keyword); |
|
273 | - $keyword = wp_specialchars_decode($keyword ,ENT_QUOTES); |
|
249 | + global $s; |
|
250 | + if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') { |
|
251 | + $keywords = explode(" ", $s); |
|
252 | + |
|
253 | + if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){ |
|
254 | + foreach($keywords as $kkey=>$kword){ |
|
255 | + if(mb_strlen($kword, 'UTF-8')<=$klimit){ |
|
256 | + unset($keywords[$kkey]); |
|
257 | + } |
|
258 | + } |
|
259 | + } |
|
260 | + |
|
261 | + |
|
262 | + if (count($keywords) > 1) { |
|
263 | + $parts = array( |
|
264 | + 'AND' => 'gd_alltitlematch_part', |
|
265 | + 'OR' => 'gd_titlematch_part' |
|
266 | + ); |
|
267 | + $gd_titlematch_part = ""; |
|
268 | + foreach ($parts as $key => $part) { |
|
269 | + $gd_titlematch_part .= " CASE WHEN "; |
|
270 | + $count = 0; |
|
271 | + foreach ($keywords as $keyword) { |
|
272 | + $keyword = trim($keyword); |
|
273 | + $keyword = wp_specialchars_decode($keyword ,ENT_QUOTES); |
|
274 | 274 | $count++; |
275 | - if ($count < count($keywords)) { |
|
276 | - // $gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' " . $key . " "; |
|
275 | + if ($count < count($keywords)) { |
|
276 | + // $gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' " . $key . " "; |
|
277 | 277 | $gd_titlematch_part .= "( " . $wpdb->posts . ".post_title LIKE '" . $keyword . "' OR " . $wpdb->posts . ".post_title LIKE '" . $keyword . "%%' OR " . $wpdb->posts . ".post_title LIKE '%% " . $keyword . "%%' ) " . $key . " "; |
278 | - } else { |
|
279 | - //$gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' "; |
|
278 | + } else { |
|
279 | + //$gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' "; |
|
280 | 280 | $gd_titlematch_part .= "( " . $wpdb->posts . ".post_title LIKE '" . $keyword . "' OR " . $wpdb->posts . ".post_title LIKE '" . $keyword . "%%' OR " . $wpdb->posts . ".post_title LIKE '%% " . $keyword . "%%' ) "; |
281 | - } |
|
282 | - } |
|
283 | - $gd_titlematch_part .= "THEN 1 ELSE 0 END AS " . $part . ","; |
|
284 | - } |
|
285 | - } else { |
|
286 | - $gd_titlematch_part = ""; |
|
287 | - } |
|
288 | - $s = stripslashes_deep( $s ); |
|
289 | - $s = wp_specialchars_decode($s,ENT_QUOTES); |
|
281 | + } |
|
282 | + } |
|
283 | + $gd_titlematch_part .= "THEN 1 ELSE 0 END AS " . $part . ","; |
|
284 | + } |
|
285 | + } else { |
|
286 | + $gd_titlematch_part = ""; |
|
287 | + } |
|
288 | + $s = stripslashes_deep( $s ); |
|
289 | + $s = wp_specialchars_decode($s,ENT_QUOTES); |
|
290 | 290 | $fields .= $wpdb->prepare(", CASE WHEN " . $table . ".is_featured='1' THEN 1 ELSE 0 END AS gd_featured, CASE WHEN " . $wpdb->posts . ".post_title LIKE %s THEN 1 ELSE 0 END AS gd_exacttitle," . $gd_titlematch_part . " CASE WHEN ( " . $wpdb->posts . ".post_title LIKE %s OR " . $wpdb->posts . ".post_title LIKE %s OR " . $wpdb->posts . ".post_title LIKE %s ) THEN 1 ELSE 0 END AS gd_titlematch, CASE WHEN ( " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s ) THEN 1 ELSE 0 END AS gd_content", array($s, $s, $s . '%', '% ' . $s . '%', $s, $s . ' %', '% ' . $s . ' %', '% ' . $s)); |
291 | - } |
|
291 | + } |
|
292 | 292 | |
293 | - return $fields; |
|
293 | + return $fields; |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | |
@@ -307,26 +307,26 @@ discard block |
||
307 | 307 | */ |
308 | 308 | function geodir_posts_join($join) |
309 | 309 | { |
310 | - global $wpdb, $geodir_post_type, $table, $table_prefix, $plugin_prefix; |
|
310 | + global $wpdb, $geodir_post_type, $table, $table_prefix, $plugin_prefix; |
|
311 | 311 | |
312 | - ########### WPML ########### |
|
312 | + ########### WPML ########### |
|
313 | 313 | |
314 | - if (function_exists('icl_object_id')) { |
|
315 | - global $sitepress; |
|
316 | - $lang_code = ICL_LANGUAGE_CODE; |
|
317 | - $default_lang_code = $sitepress->get_default_language(); |
|
318 | - if ($lang_code) { |
|
319 | - $join .= "JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID"; |
|
320 | - } |
|
314 | + if (function_exists('icl_object_id')) { |
|
315 | + global $sitepress; |
|
316 | + $lang_code = ICL_LANGUAGE_CODE; |
|
317 | + $default_lang_code = $sitepress->get_default_language(); |
|
318 | + if ($lang_code) { |
|
319 | + $join .= "JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID"; |
|
320 | + } |
|
321 | 321 | |
322 | - } |
|
323 | - ########### WPML ########### |
|
322 | + } |
|
323 | + ########### WPML ########### |
|
324 | 324 | |
325 | - $join .= " INNER JOIN " . $table . " ON (" . $table . ".post_id = $wpdb->posts.ID) "; |
|
326 | - //===old code start |
|
327 | - //$join .= " INNER JOIN ".POST_LOCATION_TABLE." ON (".$table.".post_location_id = ".POST_LOCATION_TABLE.".location_id) " ;//===old code end |
|
325 | + $join .= " INNER JOIN " . $table . " ON (" . $table . ".post_id = $wpdb->posts.ID) "; |
|
326 | + //===old code start |
|
327 | + //$join .= " INNER JOIN ".POST_LOCATION_TABLE." ON (".$table.".post_location_id = ".POST_LOCATION_TABLE.".location_id) " ;//===old code end |
|
328 | 328 | |
329 | - return $join; |
|
329 | + return $join; |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | |
@@ -344,15 +344,15 @@ discard block |
||
344 | 344 | */ |
345 | 345 | function geodir_posts_orderby($orderby) |
346 | 346 | { |
347 | - global $wpdb, $wp_query, $geodir_post_type, $table, $plugin_prefix, $snear, $default_sort; |
|
347 | + global $wpdb, $wp_query, $geodir_post_type, $table, $plugin_prefix, $snear, $default_sort; |
|
348 | 348 | |
349 | - $sort_by = ''; |
|
350 | - $orderby = ' '; |
|
349 | + $sort_by = ''; |
|
350 | + $orderby = ' '; |
|
351 | 351 | |
352 | - if (get_query_var('order_by')) |
|
353 | - $sort_by = get_query_var('order_by'); |
|
352 | + if (get_query_var('order_by')) |
|
353 | + $sort_by = get_query_var('order_by'); |
|
354 | 354 | |
355 | - /*if(isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries){ |
|
355 | + /*if(isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries){ |
|
356 | 356 | $current_term = $wp_query->get_queried_object(); |
357 | 357 | } |
358 | 358 | |
@@ -366,123 +366,123 @@ discard block |
||
366 | 366 | }*/ |
367 | 367 | |
368 | 368 | |
369 | - if ($snear != '') { |
|
370 | - $orderby .= " distance,"; |
|
371 | - } |
|
369 | + if ($snear != '') { |
|
370 | + $orderby .= " distance,"; |
|
371 | + } |
|
372 | 372 | |
373 | - if (isset($_REQUEST['sort_by']) && $_REQUEST['sort_by'] != '' && is_main_query()) |
|
374 | - $sort_by = esc_attr($_REQUEST['sort_by']); |
|
373 | + if (isset($_REQUEST['sort_by']) && $_REQUEST['sort_by'] != '' && is_main_query()) |
|
374 | + $sort_by = esc_attr($_REQUEST['sort_by']); |
|
375 | 375 | |
376 | 376 | |
377 | - if ($sort_by == '') { |
|
378 | - $default_sort = geodir_get_posts_default_sort($geodir_post_type); |
|
379 | - if (!empty($default_sort)) |
|
380 | - $sort_by = $default_sort; |
|
381 | - } |
|
377 | + if ($sort_by == '') { |
|
378 | + $default_sort = geodir_get_posts_default_sort($geodir_post_type); |
|
379 | + if (!empty($default_sort)) |
|
380 | + $sort_by = $default_sort; |
|
381 | + } |
|
382 | 382 | |
383 | - /* |
|
383 | + /* |
|
384 | 384 | if search by term & no location then order always "relevance" |
385 | 385 | if search by location then order always "nearest" |
386 | 386 | */ |
387 | - if (is_main_query() && geodir_is_page('search')) { |
|
388 | - $search_term = get_query_var('s'); |
|
387 | + if (is_main_query() && geodir_is_page('search')) { |
|
388 | + $search_term = get_query_var('s'); |
|
389 | 389 | |
390 | - if (trim($search_term) != '' && !isset($_REQUEST['sort_by'])) { |
|
391 | - $sort_by = 'az'; |
|
392 | - } |
|
390 | + if (trim($search_term) != '' && !isset($_REQUEST['sort_by'])) { |
|
391 | + $sort_by = 'az'; |
|
392 | + } |
|
393 | 393 | |
394 | - if ($snear != '' && $sort_by!='farthest') { |
|
395 | - $sort_by = 'nearest'; |
|
396 | - } |
|
397 | - } |
|
394 | + if ($snear != '' && $sort_by!='farthest') { |
|
395 | + $sort_by = 'nearest'; |
|
396 | + } |
|
397 | + } |
|
398 | 398 | |
399 | - switch ($sort_by): |
|
400 | - case 'newest': |
|
401 | - $orderby = "$wpdb->posts.post_date desc, "; |
|
402 | - break; |
|
403 | - case 'oldest': |
|
404 | - $orderby = "$wpdb->posts.post_date asc, "; |
|
405 | - break; |
|
406 | - case 'low_review': |
|
407 | - case 'rating_count_asc': |
|
408 | - $orderby = $table . ".rating_count ASC, " . $table . ".overall_rating ASC, "; |
|
409 | - break; |
|
410 | - case 'high_review': |
|
411 | - case 'rating_count_desc': |
|
399 | + switch ($sort_by): |
|
400 | + case 'newest': |
|
401 | + $orderby = "$wpdb->posts.post_date desc, "; |
|
402 | + break; |
|
403 | + case 'oldest': |
|
404 | + $orderby = "$wpdb->posts.post_date asc, "; |
|
405 | + break; |
|
406 | + case 'low_review': |
|
407 | + case 'rating_count_asc': |
|
408 | + $orderby = $table . ".rating_count ASC, " . $table . ".overall_rating ASC, "; |
|
409 | + break; |
|
410 | + case 'high_review': |
|
411 | + case 'rating_count_desc': |
|
412 | 412 | $orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, "; |
413 | - break; |
|
414 | - case 'low_rating': |
|
415 | - $orderby = "( " . $table . ".overall_rating ) ASC, " . $table . ".rating_count ASC, "; |
|
416 | - break; |
|
417 | - case 'high_rating': |
|
418 | - $orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, "; |
|
419 | - break; |
|
420 | - case 'featured': |
|
421 | - $orderby = $table . ".is_featured asc, "; |
|
422 | - break; |
|
423 | - case 'nearest': |
|
424 | - $orderby = " distance asc, "; |
|
425 | - break; |
|
426 | - case 'farthest': |
|
427 | - $orderby = " distance desc, "; |
|
428 | - break; |
|
429 | - case 'random': |
|
430 | - $orderby = " rand(), "; |
|
431 | - break; |
|
432 | - case 'az': |
|
433 | - $orderby = "$wpdb->posts.post_title asc, "; |
|
434 | - break; |
|
435 | - // sort by rating |
|
436 | - case 'overall_rating_desc': |
|
437 | - $orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, "; |
|
438 | - break; |
|
439 | - case 'overall_rating_asc': |
|
440 | - $orderby = " " . $table . ".overall_rating ASC, " . $table . ".rating_count ASC, "; |
|
441 | - break; |
|
442 | - default: |
|
443 | - |
|
444 | - break; |
|
445 | - endswitch; |
|
446 | - |
|
447 | - global $s; |
|
448 | - |
|
449 | - if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') { |
|
450 | - $keywords = explode(" ", $s); |
|
451 | - if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){ |
|
452 | - foreach($keywords as $kkey=>$kword){ |
|
453 | - if(mb_strlen($kword, 'UTF-8')<=$klimit){ |
|
454 | - unset($keywords[$kkey]); |
|
455 | - } |
|
456 | - } |
|
457 | - } |
|
458 | - if ($sort_by == 'nearest' || $sort_by == 'farthest') { |
|
459 | - if (count($keywords) > 1) { |
|
460 | - $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, "; |
|
461 | - } else { |
|
462 | - $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, "; |
|
463 | - } |
|
464 | - } else { |
|
465 | - if (count($keywords) > 1) { |
|
466 | - $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, " . $orderby; |
|
467 | - } else { |
|
468 | - $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, " . $orderby; |
|
469 | - } |
|
470 | - } |
|
471 | - } |
|
413 | + break; |
|
414 | + case 'low_rating': |
|
415 | + $orderby = "( " . $table . ".overall_rating ) ASC, " . $table . ".rating_count ASC, "; |
|
416 | + break; |
|
417 | + case 'high_rating': |
|
418 | + $orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, "; |
|
419 | + break; |
|
420 | + case 'featured': |
|
421 | + $orderby = $table . ".is_featured asc, "; |
|
422 | + break; |
|
423 | + case 'nearest': |
|
424 | + $orderby = " distance asc, "; |
|
425 | + break; |
|
426 | + case 'farthest': |
|
427 | + $orderby = " distance desc, "; |
|
428 | + break; |
|
429 | + case 'random': |
|
430 | + $orderby = " rand(), "; |
|
431 | + break; |
|
432 | + case 'az': |
|
433 | + $orderby = "$wpdb->posts.post_title asc, "; |
|
434 | + break; |
|
435 | + // sort by rating |
|
436 | + case 'overall_rating_desc': |
|
437 | + $orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, "; |
|
438 | + break; |
|
439 | + case 'overall_rating_asc': |
|
440 | + $orderby = " " . $table . ".overall_rating ASC, " . $table . ".rating_count ASC, "; |
|
441 | + break; |
|
442 | + default: |
|
443 | + |
|
444 | + break; |
|
445 | + endswitch; |
|
446 | + |
|
447 | + global $s; |
|
448 | + |
|
449 | + if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') { |
|
450 | + $keywords = explode(" ", $s); |
|
451 | + if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){ |
|
452 | + foreach($keywords as $kkey=>$kword){ |
|
453 | + if(mb_strlen($kword, 'UTF-8')<=$klimit){ |
|
454 | + unset($keywords[$kkey]); |
|
455 | + } |
|
456 | + } |
|
457 | + } |
|
458 | + if ($sort_by == 'nearest' || $sort_by == 'farthest') { |
|
459 | + if (count($keywords) > 1) { |
|
460 | + $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, "; |
|
461 | + } else { |
|
462 | + $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, "; |
|
463 | + } |
|
464 | + } else { |
|
465 | + if (count($keywords) > 1) { |
|
466 | + $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, " . $orderby; |
|
467 | + } else { |
|
468 | + $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, " . $orderby; |
|
469 | + } |
|
470 | + } |
|
471 | + } |
|
472 | 472 | |
473 | - /** |
|
474 | - * Filter order by SQL. |
|
475 | - * |
|
476 | - * @since 1.0.0 |
|
477 | - * @param string $orderby The orderby query string. |
|
478 | - * @param string $sort_by Sortby query string. |
|
479 | - * @param string $table Listing table name. |
|
480 | - */ |
|
481 | - $orderby = apply_filters('geodir_posts_order_by_sort', $orderby, $sort_by, $table); |
|
473 | + /** |
|
474 | + * Filter order by SQL. |
|
475 | + * |
|
476 | + * @since 1.0.0 |
|
477 | + * @param string $orderby The orderby query string. |
|
478 | + * @param string $sort_by Sortby query string. |
|
479 | + * @param string $table Listing table name. |
|
480 | + */ |
|
481 | + $orderby = apply_filters('geodir_posts_order_by_sort', $orderby, $sort_by, $table); |
|
482 | 482 | |
483 | - $orderby .= $table . ".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title "; |
|
483 | + $orderby .= $table . ".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title "; |
|
484 | 484 | |
485 | - return $orderby; |
|
485 | + return $orderby; |
|
486 | 486 | } |
487 | 487 | |
488 | 488 | |
@@ -500,53 +500,53 @@ discard block |
||
500 | 500 | function geodir_posts_order_by_custom_sort($orderby, $sort_by, $table) |
501 | 501 | { |
502 | 502 | |
503 | - global $wpdb; |
|
503 | + global $wpdb; |
|
504 | 504 | |
505 | - if ($sort_by != '' && (!is_search() || ( isset($_REQUEST['s']) && isset($_REQUEST['snear']) && $_REQUEST['snear']=='' && ( $_REQUEST['s']=='' || $_REQUEST['s']==' ') ) )) { |
|
505 | + if ($sort_by != '' && (!is_search() || ( isset($_REQUEST['s']) && isset($_REQUEST['snear']) && $_REQUEST['snear']=='' && ( $_REQUEST['s']=='' || $_REQUEST['s']==' ') ) )) { |
|
506 | 506 | |
507 | - $sort_array = explode('_', $sort_by); |
|
507 | + $sort_array = explode('_', $sort_by); |
|
508 | 508 | |
509 | - $sort_by_count = count($sort_array); |
|
509 | + $sort_by_count = count($sort_array); |
|
510 | 510 | |
511 | - $order = $sort_array[$sort_by_count - 1]; |
|
511 | + $order = $sort_array[$sort_by_count - 1]; |
|
512 | 512 | |
513 | - if ($sort_by_count > 1 && ($order == 'asc' || $order == 'desc')) { |
|
513 | + if ($sort_by_count > 1 && ($order == 'asc' || $order == 'desc')) { |
|
514 | 514 | |
515 | - $sort_by = str_replace('_' . $order, '', $sort_by); |
|
515 | + $sort_by = str_replace('_' . $order, '', $sort_by); |
|
516 | 516 | |
517 | - switch ($sort_by): |
|
517 | + switch ($sort_by): |
|
518 | 518 | |
519 | - case 'post_date': |
|
520 | - case 'comment_count': |
|
519 | + case 'post_date': |
|
520 | + case 'comment_count': |
|
521 | 521 | |
522 | - $orderby = "$wpdb->posts." . $sort_by . " " . $order . ", ".$table . ".overall_rating " . $order . ", "; |
|
523 | - break; |
|
522 | + $orderby = "$wpdb->posts." . $sort_by . " " . $order . ", ".$table . ".overall_rating " . $order . ", "; |
|
523 | + break; |
|
524 | 524 | |
525 | - case 'distance': |
|
526 | - $orderby = $sort_by . " " . $order . ", "; |
|
527 | - break; |
|
525 | + case 'distance': |
|
526 | + $orderby = $sort_by . " " . $order . ", "; |
|
527 | + break; |
|
528 | 528 | |
529 | 529 | |
530 | - // sort by rating |
|
531 | - case 'overall_rating': |
|
532 | - $orderby = " " . $table . "." . $sort_by . " " . $order . ", " . $table . ".rating_count " . $order . ", "; |
|
530 | + // sort by rating |
|
531 | + case 'overall_rating': |
|
532 | + $orderby = " " . $table . "." . $sort_by . " " . $order . ", " . $table . ".rating_count " . $order . ", "; |
|
533 | 533 | |
534 | - break; |
|
534 | + break; |
|
535 | 535 | |
536 | 536 | |
537 | - default: |
|
538 | - if (geodir_column_exist($table, $sort_by)) { |
|
537 | + default: |
|
538 | + if (geodir_column_exist($table, $sort_by)) { |
|
539 | 539 | $orderby = $table . "." . $sort_by . " " . $order . ", "; |
540 | 540 | } |
541 | - break; |
|
541 | + break; |
|
542 | 542 | |
543 | - endswitch; |
|
543 | + endswitch; |
|
544 | 544 | |
545 | - } |
|
545 | + } |
|
546 | 546 | |
547 | - } |
|
547 | + } |
|
548 | 548 | |
549 | - return $orderby; |
|
549 | + return $orderby; |
|
550 | 550 | } |
551 | 551 | |
552 | 552 | /** |
@@ -561,34 +561,34 @@ discard block |
||
561 | 561 | { |
562 | 562 | |
563 | 563 | |
564 | - global $wpdb, $geodir_post_type, $table, $s, $snear; |
|
564 | + global $wpdb, $geodir_post_type, $table, $s, $snear; |
|
565 | 565 | |
566 | - if (!is_admin()) { |
|
566 | + if (!is_admin()) { |
|
567 | 567 | |
568 | - if (geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
|
569 | - add_filter('posts_where', 'geodir_edit_listing_where', 1); |
|
568 | + if (geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
|
569 | + add_filter('posts_where', 'geodir_edit_listing_where', 1); |
|
570 | 570 | |
571 | - } elseif ((is_search() && $_REQUEST['geodir_search'])) { |
|
571 | + } elseif ((is_search() && $_REQUEST['geodir_search'])) { |
|
572 | 572 | |
573 | - add_filter('posts_where', 'searching_filter_where', 1); |
|
573 | + add_filter('posts_where', 'searching_filter_where', 1); |
|
574 | 574 | |
575 | - if ($snear != '') |
|
576 | - add_filter('posts_where', 'searching_filter_where', 1); |
|
575 | + if ($snear != '') |
|
576 | + add_filter('posts_where', 'searching_filter_where', 1); |
|
577 | 577 | |
578 | - add_filter('posts_orderby', 'geodir_posts_orderby', 1); |
|
578 | + add_filter('posts_orderby', 'geodir_posts_orderby', 1); |
|
579 | 579 | |
580 | - } elseif (geodir_is_page('author')) { |
|
580 | + } elseif (geodir_is_page('author')) { |
|
581 | 581 | |
582 | - add_filter('posts_where', 'author_filter_where', 1); |
|
582 | + add_filter('posts_where', 'author_filter_where', 1); |
|
583 | 583 | |
584 | - } |
|
584 | + } |
|
585 | 585 | |
586 | - //if (!geodir_is_page('detail')) |
|
587 | - add_filter('posts_where', 'geodir_default_where', 1);/**/ |
|
586 | + //if (!geodir_is_page('detail')) |
|
587 | + add_filter('posts_where', 'geodir_default_where', 1);/**/ |
|
588 | 588 | |
589 | - //add_filter( 'user_has_cap', 'geodir_preview_post_cap', 10, 3 );// let subscribers edit their own posts |
|
589 | + //add_filter( 'user_has_cap', 'geodir_preview_post_cap', 10, 3 );// let subscribers edit their own posts |
|
590 | 590 | |
591 | - } |
|
591 | + } |
|
592 | 592 | } |
593 | 593 | |
594 | 594 | /** |
@@ -603,13 +603,13 @@ discard block |
||
603 | 603 | */ |
604 | 604 | function geodir_preview_post_cap($allcaps, $caps, $args) |
605 | 605 | { |
606 | - $user_id = get_current_user_id(); |
|
607 | - if ($user_id && isset($_REQUEST['post_type']) && $_REQUEST['post_type'] != '' && isset($_REQUEST['p']) && $_REQUEST['p'] != '' && $args[0] == 'edit_post' && $_REQUEST['p'] == $args[2]) { |
|
606 | + $user_id = get_current_user_id(); |
|
607 | + if ($user_id && isset($_REQUEST['post_type']) && $_REQUEST['post_type'] != '' && isset($_REQUEST['p']) && $_REQUEST['p'] != '' && $args[0] == 'edit_post' && $_REQUEST['p'] == $args[2]) { |
|
608 | 608 | |
609 | - $allcaps['edit_posts'] = true; |
|
610 | - } |
|
611 | - //print_r($allcaps); |
|
612 | - return $allcaps; |
|
609 | + $allcaps['edit_posts'] = true; |
|
610 | + } |
|
611 | + //print_r($allcaps); |
|
612 | + return $allcaps; |
|
613 | 613 | } |
614 | 614 | |
615 | 615 | |
@@ -624,9 +624,9 @@ discard block |
||
624 | 624 | */ |
625 | 625 | function geodir_edit_listing_where($where) |
626 | 626 | { |
627 | - global $wpdb; |
|
628 | - $where = $wpdb->prepare(" AND $wpdb->posts.ID = %d ", $_REQUEST['pid']); |
|
629 | - return $where; |
|
627 | + global $wpdb; |
|
628 | + $where = $wpdb->prepare(" AND $wpdb->posts.ID = %d ", $_REQUEST['pid']); |
|
629 | + return $where; |
|
630 | 630 | } |
631 | 631 | |
632 | 632 | |
@@ -643,29 +643,29 @@ discard block |
||
643 | 643 | */ |
644 | 644 | function geodir_default_where($where) |
645 | 645 | { |
646 | - global $wp_query, $wpdb; |
|
647 | - |
|
648 | - //print_r($wp_query); |
|
649 | - ########### WPML ########### |
|
650 | - |
|
651 | - if (function_exists('icl_object_id')) { |
|
652 | - global $sitepress, $table_prefix; |
|
653 | - $lang_code = ICL_LANGUAGE_CODE; |
|
654 | - $default_lang_code = $sitepress->get_default_language(); |
|
655 | - $q_post_type = isset($wp_query->query['post_type']) ? $wp_query->query['post_type'] : ''; |
|
656 | - //echo '##########'.$q_post_type; |
|
657 | - if ($lang_code && $q_post_type) { |
|
658 | - $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_" . $q_post_type . "') "; |
|
659 | - //$where .= " AND icl_t.language_code = '$lang_code' "; |
|
660 | - } |
|
646 | + global $wp_query, $wpdb; |
|
661 | 647 | |
662 | - } |
|
663 | - ########### WPML ########### |
|
648 | + //print_r($wp_query); |
|
649 | + ########### WPML ########### |
|
664 | 650 | |
651 | + if (function_exists('icl_object_id')) { |
|
652 | + global $sitepress, $table_prefix; |
|
653 | + $lang_code = ICL_LANGUAGE_CODE; |
|
654 | + $default_lang_code = $sitepress->get_default_language(); |
|
655 | + $q_post_type = isset($wp_query->query['post_type']) ? $wp_query->query['post_type'] : ''; |
|
656 | + //echo '##########'.$q_post_type; |
|
657 | + if ($lang_code && $q_post_type) { |
|
658 | + $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_" . $q_post_type . "') "; |
|
659 | + //$where .= " AND icl_t.language_code = '$lang_code' "; |
|
660 | + } |
|
665 | 661 | |
666 | - return $where = str_replace("0 = 1", "1=1", $where); |
|
662 | + } |
|
663 | + ########### WPML ########### |
|
667 | 664 | |
668 | - /* ====== old code start === |
|
665 | + |
|
666 | + return $where = str_replace("0 = 1", "1=1", $where); |
|
667 | + |
|
668 | + /* ====== old code start === |
|
669 | 669 | $where = str_replace("0 = 1", "1=1", $where); |
670 | 670 | $country = get_query_var('gd_country'); |
671 | 671 | $region = get_query_var('gd_region'); |
@@ -706,108 +706,108 @@ discard block |
||
706 | 706 | * @return string Modified where query string. |
707 | 707 | */ |
708 | 708 | function searching_filter_where($where) { |
709 | - global $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $s, $snear, $s_A, $s_SA, $search_term, $gd_session; |
|
709 | + global $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $s, $snear, $s_A, $s_SA, $search_term, $gd_session; |
|
710 | 710 | |
711 | - $search_term = 'OR'; |
|
712 | - $search_term = 'AND'; |
|
713 | - $geodir_custom_search = ''; |
|
714 | - $category_search_range = ''; |
|
711 | + $search_term = 'OR'; |
|
712 | + $search_term = 'AND'; |
|
713 | + $geodir_custom_search = ''; |
|
714 | + $category_search_range = ''; |
|
715 | 715 | |
716 | - if (is_single() && get_query_var('post_type')) { |
|
716 | + if (is_single() && get_query_var('post_type')) { |
|
717 | 717 | return $where; |
718 | 718 | } |
719 | 719 | |
720 | - if (is_tax()) { |
|
720 | + if (is_tax()) { |
|
721 | 721 | return $where; |
722 | 722 | } |
723 | 723 | |
724 | 724 | $s = trim($s); |
725 | - $s = wp_specialchars_decode($s ,ENT_QUOTES); |
|
726 | - $s_A = wp_specialchars_decode($s_A ,ENT_QUOTES); |
|
727 | - |
|
728 | - $where = ''; |
|
729 | - $better_search_terms = ''; |
|
730 | - if (isset($_REQUEST['stype'])) |
|
731 | - $post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype'])); |
|
732 | - else |
|
733 | - $post_types = 'gd_place'; |
|
734 | - |
|
735 | - if ($s != '') { |
|
736 | - $keywords = explode(" ", $s); |
|
737 | - if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){ |
|
738 | - foreach($keywords as $kkey=>$kword){ |
|
739 | - if(mb_strlen($kword, 'UTF-8')<=$klimit){ |
|
740 | - unset($keywords[$kkey]); |
|
741 | - } |
|
742 | - } |
|
743 | - } |
|
725 | + $s = wp_specialchars_decode($s ,ENT_QUOTES); |
|
726 | + $s_A = wp_specialchars_decode($s_A ,ENT_QUOTES); |
|
744 | 727 | |
745 | - if (!empty($keywords)) { |
|
746 | - foreach ($keywords as $keyword) { |
|
747 | - $keyword = trim($keyword); |
|
748 | - $keyword = wp_specialchars_decode($keyword ,ENT_QUOTES); |
|
749 | - if ($keyword != '') { |
|
750 | - /** |
|
751 | - * Filter the search query keywords SQL. |
|
752 | - * |
|
753 | - * @since 1.5.9 |
|
754 | - * @package GeoDirectory |
|
755 | - * @param string $better_search_terms The query values, default: `' OR ( ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '" OR ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '%" OR ' . $wpdb->posts . '.post_title LIKE "% ' . $keyword . '%" )'`. |
|
756 | - * @param array $keywords The array of keywords for the query. |
|
757 | - * @param string $keyword The single keyword being searched. |
|
758 | - */ |
|
728 | + $where = ''; |
|
729 | + $better_search_terms = ''; |
|
730 | + if (isset($_REQUEST['stype'])) |
|
731 | + $post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype'])); |
|
732 | + else |
|
733 | + $post_types = 'gd_place'; |
|
734 | + |
|
735 | + if ($s != '') { |
|
736 | + $keywords = explode(" ", $s); |
|
737 | + if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){ |
|
738 | + foreach($keywords as $kkey=>$kword){ |
|
739 | + if(mb_strlen($kword, 'UTF-8')<=$klimit){ |
|
740 | + unset($keywords[$kkey]); |
|
741 | + } |
|
742 | + } |
|
743 | + } |
|
744 | + |
|
745 | + if (!empty($keywords)) { |
|
746 | + foreach ($keywords as $keyword) { |
|
747 | + $keyword = trim($keyword); |
|
748 | + $keyword = wp_specialchars_decode($keyword ,ENT_QUOTES); |
|
749 | + if ($keyword != '') { |
|
750 | + /** |
|
751 | + * Filter the search query keywords SQL. |
|
752 | + * |
|
753 | + * @since 1.5.9 |
|
754 | + * @package GeoDirectory |
|
755 | + * @param string $better_search_terms The query values, default: `' OR ( ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '" OR ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '%" OR ' . $wpdb->posts . '.post_title LIKE "% ' . $keyword . '%" )'`. |
|
756 | + * @param array $keywords The array of keywords for the query. |
|
757 | + * @param string $keyword The single keyword being searched. |
|
758 | + */ |
|
759 | 759 | $better_search_terms .= apply_filters("geodir_search_better_search_terms",' OR ( ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '" OR ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '%" OR ' . $wpdb->posts . '.post_title LIKE "% ' . $keyword . '%" )',$keywords,$keyword); |
760 | - } |
|
761 | - } |
|
762 | - } |
|
763 | - } |
|
760 | + } |
|
761 | + } |
|
762 | + } |
|
763 | + } |
|
764 | 764 | |
765 | - /* get taxonomy */ |
|
766 | - $taxonomies = geodir_get_taxonomies($post_types, true); |
|
767 | - if($taxonomies) { |
|
768 | - $taxonomies = implode("','", $taxonomies); |
|
769 | - $taxonomies = "'" . $taxonomies . "'"; |
|
770 | - }else{$taxonomies='';} |
|
765 | + /* get taxonomy */ |
|
766 | + $taxonomies = geodir_get_taxonomies($post_types, true); |
|
767 | + if($taxonomies) { |
|
768 | + $taxonomies = implode("','", $taxonomies); |
|
769 | + $taxonomies = "'" . $taxonomies . "'"; |
|
770 | + }else{$taxonomies='';} |
|
771 | 771 | |
772 | - $content_where = $terms_where = ''; |
|
772 | + $content_where = $terms_where = ''; |
|
773 | 773 | if ($s != '') { |
774 | - /** |
|
775 | - * Filter the search query content where values. |
|
776 | - * |
|
777 | - * @since 1.5.0 |
|
778 | - * @package GeoDirectory |
|
779 | - * @param string $content_where The query values, default: `" OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ") "`. |
|
780 | - */ |
|
774 | + /** |
|
775 | + * Filter the search query content where values. |
|
776 | + * |
|
777 | + * @since 1.5.0 |
|
778 | + * @package GeoDirectory |
|
779 | + * @param string $content_where The query values, default: `" OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ") "`. |
|
780 | + */ |
|
781 | 781 | $content_where = apply_filters("geodir_search_content_where"," OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") "); |
782 | - /** |
|
783 | - * Filter the search query term values. |
|
784 | - * |
|
785 | - * @since 1.5.0 |
|
786 | - * @package GeoDirectory |
|
787 | - * @param string $terms_where The separator, default: `" AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) "`. |
|
788 | - */ |
|
789 | - $terms_where = apply_filters("geodir_search_terms_where"," AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) "); |
|
782 | + /** |
|
783 | + * Filter the search query term values. |
|
784 | + * |
|
785 | + * @since 1.5.0 |
|
786 | + * @package GeoDirectory |
|
787 | + * @param string $terms_where The separator, default: `" AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) "`. |
|
788 | + */ |
|
789 | + $terms_where = apply_filters("geodir_search_terms_where"," AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) "); |
|
790 | 790 | } |
791 | 791 | |
792 | - if ($snear != '') { |
|
792 | + if ($snear != '') { |
|
793 | 793 | |
794 | 794 | |
795 | - if (is_numeric($gd_session->get('near_me_range')) && !isset($_REQUEST['sdist'])) { |
|
796 | - $dist = $gd_session->get('near_me_range'); |
|
797 | - } |
|
798 | - $lon1 = $mylon - $dist / abs(cos(deg2rad($mylat)) * 69); |
|
799 | - $lon2 = $mylon + $dist / abs(cos(deg2rad($mylat)) * 69); |
|
800 | - $lat1 = $mylat - ($dist / 69); |
|
801 | - $lat2 = $mylat + ($dist / 69); |
|
795 | + if (is_numeric($gd_session->get('near_me_range')) && !isset($_REQUEST['sdist'])) { |
|
796 | + $dist = $gd_session->get('near_me_range'); |
|
797 | + } |
|
798 | + $lon1 = $mylon - $dist / abs(cos(deg2rad($mylat)) * 69); |
|
799 | + $lon2 = $mylon + $dist / abs(cos(deg2rad($mylat)) * 69); |
|
800 | + $lat1 = $mylat - ($dist / 69); |
|
801 | + $lat2 = $mylat + ($dist / 69); |
|
802 | 802 | |
803 | - $rlon1 = is_numeric(min($lon1, $lon2)) ? min($lon1, $lon2) : ''; |
|
804 | - $rlon2 = is_numeric(max($lon1, $lon2)) ? max($lon1, $lon2) : ''; |
|
805 | - $rlat1 = is_numeric(min($lat1, $lat2)) ? min($lat1, $lat2) : ''; |
|
806 | - $rlat2 = is_numeric(max($lat1, $lat2)) ? max($lat1, $lat2) : ''; |
|
803 | + $rlon1 = is_numeric(min($lon1, $lon2)) ? min($lon1, $lon2) : ''; |
|
804 | + $rlon2 = is_numeric(max($lon1, $lon2)) ? max($lon1, $lon2) : ''; |
|
805 | + $rlat1 = is_numeric(min($lat1, $lat2)) ? min($lat1, $lat2) : ''; |
|
806 | + $rlat2 = is_numeric(max($lat1, $lat2)) ? max($lat1, $lat2) : ''; |
|
807 | 807 | |
808 | 808 | |
809 | 809 | |
810 | - $where .= " AND ( ( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms) |
|
810 | + $where .= " AND ( ( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms) |
|
811 | 811 | $content_where |
812 | 812 | OR ($wpdb->posts.ID IN( |
813 | 813 | SELECT $wpdb->term_relationships.object_id as post_id |
@@ -824,13 +824,13 @@ discard block |
||
824 | 824 | AND ( " . $table . ".post_latitude between $rlat1 and $rlat2 ) |
825 | 825 | AND ( " . $table . ".post_longitude between $rlon1 and $rlon2 ) "; |
826 | 826 | |
827 | - if (isset($_REQUEST['sdist']) && $_REQUEST['sdist'] != 'all') { |
|
828 | - $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1')); |
|
829 | - $where .= " AND CONVERT((" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) ))),DECIMAL(64,4)) <= " . $dist; |
|
830 | - } |
|
827 | + if (isset($_REQUEST['sdist']) && $_REQUEST['sdist'] != 'all') { |
|
828 | + $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1')); |
|
829 | + $where .= " AND CONVERT((" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) ))),DECIMAL(64,4)) <= " . $dist; |
|
830 | + } |
|
831 | 831 | |
832 | - } else { |
|
833 | - $where .= " AND ( ( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms) |
|
832 | + } else { |
|
833 | + $where .= " AND ( ( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms) |
|
834 | 834 | $content_where |
835 | 835 | OR ( $wpdb->posts.ID IN( |
836 | 836 | SELECT $wpdb->term_relationships.object_id as post_id |
@@ -844,19 +844,19 @@ discard block |
||
844 | 844 | ) |
845 | 845 | AND $wpdb->posts.post_type in ('$post_types') |
846 | 846 | AND ($wpdb->posts.post_status = 'publish') "; |
847 | - } |
|
847 | + } |
|
848 | 848 | |
849 | 849 | ########### WPML ########### |
850 | - if ( function_exists( 'icl_object_id' ) ) { |
|
850 | + if ( function_exists( 'icl_object_id' ) ) { |
|
851 | 851 | $lang_code = ICL_LANGUAGE_CODE; |
852 | 852 | |
853 | 853 | if ($lang_code && $post_types) { |
854 | - $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_" . $post_types . "') "; |
|
855 | - } |
|
856 | - } |
|
857 | - ########### WPML ########### |
|
854 | + $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_" . $post_types . "') "; |
|
855 | + } |
|
856 | + } |
|
857 | + ########### WPML ########### |
|
858 | 858 | |
859 | - return $where; |
|
859 | + return $where; |
|
860 | 860 | } |
861 | 861 | |
862 | 862 | |
@@ -871,45 +871,45 @@ discard block |
||
871 | 871 | * @return string Modified where query string. |
872 | 872 | */ |
873 | 873 | function author_filter_where($where) { |
874 | - global $wpdb, $geodir_post_type, $table, $curr; |
|
874 | + global $wpdb, $geodir_post_type, $table, $curr; |
|
875 | 875 | |
876 | - $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author')); |
|
877 | - $user_id = !empty($curauth->ID) ? (int)$curauth->ID : 0; |
|
876 | + $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author')); |
|
877 | + $user_id = !empty($curauth->ID) ? (int)$curauth->ID : 0; |
|
878 | 878 | |
879 | - if (isset($_REQUEST['stype'])) { |
|
880 | - $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ",$_REQUEST['stype']); |
|
881 | - } else { |
|
882 | - $where = " AND $wpdb->posts.post_type IN ('gd_place') "; |
|
883 | - } |
|
879 | + if (isset($_REQUEST['stype'])) { |
|
880 | + $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ",$_REQUEST['stype']); |
|
881 | + } else { |
|
882 | + $where = " AND $wpdb->posts.post_type IN ('gd_place') "; |
|
883 | + } |
|
884 | 884 | |
885 | - if ($user_id > 0) { |
|
886 | - if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') { |
|
887 | - $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true); |
|
888 | - $user_fav_posts = !empty($user_fav_posts) && is_array($user_fav_posts) ? implode("','", $user_fav_posts) : '-1'; |
|
889 | - $where .= " AND $wpdb->posts.ID IN ('$user_fav_posts')"; |
|
890 | - } else |
|
891 | - $where .= " AND $wpdb->posts.post_author = $user_id"; |
|
892 | - |
|
893 | - if ($user_id == (int)get_current_user_id()) { |
|
894 | - $where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') "; |
|
895 | - } else { |
|
896 | - $where .= " AND $wpdb->posts.post_status = 'publish' "; |
|
897 | - } |
|
898 | - } else { |
|
899 | - $where .= " AND $wpdb->posts.post_author = '-1' AND $wpdb->posts.post_status = 'publish' "; |
|
900 | - } |
|
885 | + if ($user_id > 0) { |
|
886 | + if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') { |
|
887 | + $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true); |
|
888 | + $user_fav_posts = !empty($user_fav_posts) && is_array($user_fav_posts) ? implode("','", $user_fav_posts) : '-1'; |
|
889 | + $where .= " AND $wpdb->posts.ID IN ('$user_fav_posts')"; |
|
890 | + } else |
|
891 | + $where .= " AND $wpdb->posts.post_author = $user_id"; |
|
892 | + |
|
893 | + if ($user_id == (int)get_current_user_id()) { |
|
894 | + $where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') "; |
|
895 | + } else { |
|
896 | + $where .= " AND $wpdb->posts.post_status = 'publish' "; |
|
897 | + } |
|
898 | + } else { |
|
899 | + $where .= " AND $wpdb->posts.post_author = '-1' AND $wpdb->posts.post_status = 'publish' "; |
|
900 | + } |
|
901 | 901 | |
902 | - ########### WPML ########### |
|
903 | - if (function_exists('icl_object_id')) { |
|
904 | - $lang_code = ICL_LANGUAGE_CODE; |
|
905 | - if ($lang_code) { |
|
906 | - $where .= " AND icl_t.language_code='" . $lang_code . "' "; |
|
907 | - } |
|
902 | + ########### WPML ########### |
|
903 | + if (function_exists('icl_object_id')) { |
|
904 | + $lang_code = ICL_LANGUAGE_CODE; |
|
905 | + if ($lang_code) { |
|
906 | + $where .= " AND icl_t.language_code='" . $lang_code . "' "; |
|
907 | + } |
|
908 | 908 | |
909 | - } |
|
910 | - ########### WPML ########### |
|
909 | + } |
|
910 | + ########### WPML ########### |
|
911 | 911 | |
912 | - return $where; |
|
912 | + return $where; |
|
913 | 913 | } |
914 | 914 | |
915 | 915 | /** |
@@ -924,11 +924,11 @@ discard block |
||
924 | 924 | */ |
925 | 925 | function geodir_filter_widget_join($join) |
926 | 926 | { |
927 | - global $wp_query, $table; |
|
928 | - if (!empty($wp_query->query['with_pics_only'])) { |
|
929 | - $join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )"; |
|
930 | - } |
|
931 | - return $join; |
|
927 | + global $wp_query, $table; |
|
928 | + if (!empty($wp_query->query['with_pics_only'])) { |
|
929 | + $join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )"; |
|
930 | + } |
|
931 | + return $join; |
|
932 | 932 | } |
933 | 933 | |
934 | 934 | /** |
@@ -943,42 +943,42 @@ discard block |
||
943 | 943 | */ |
944 | 944 | function geodir_filter_widget_where($where) |
945 | 945 | { |
946 | - global $wp_query, $table; |
|
947 | - if (!empty($wp_query->query['show_featured_only'])) { |
|
948 | - $where .= " AND " . $table . ".is_featured = '1'"; |
|
949 | - } |
|
950 | - if (!empty($wp_query->query['show_special_only'])) { |
|
951 | - $where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )"; |
|
952 | - } |
|
953 | - if (!empty($wp_query->query['with_pics_only'])) { |
|
954 | - $where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL GROUP BY " . $table . ".post_id"; |
|
955 | - } |
|
956 | - if (!empty($wp_query->query['with_videos_only'])) { |
|
957 | - $where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )"; |
|
958 | - } |
|
959 | - return $where; |
|
946 | + global $wp_query, $table; |
|
947 | + if (!empty($wp_query->query['show_featured_only'])) { |
|
948 | + $where .= " AND " . $table . ".is_featured = '1'"; |
|
949 | + } |
|
950 | + if (!empty($wp_query->query['show_special_only'])) { |
|
951 | + $where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )"; |
|
952 | + } |
|
953 | + if (!empty($wp_query->query['with_pics_only'])) { |
|
954 | + $where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL GROUP BY " . $table . ".post_id"; |
|
955 | + } |
|
956 | + if (!empty($wp_query->query['with_videos_only'])) { |
|
957 | + $where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )"; |
|
958 | + } |
|
959 | + return $where; |
|
960 | 960 | } |
961 | 961 | |
962 | 962 | |
963 | 963 | function geodir_related_posts_fields($fields) { |
964 | - global $wp_query, $wpdb, $table, $post; |
|
964 | + global $wp_query, $wpdb, $table, $post; |
|
965 | 965 | |
966 | - $fields .= ", " . $table . ".* "; |
|
966 | + $fields .= ", " . $table . ".* "; |
|
967 | 967 | |
968 | - $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1')); |
|
968 | + $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1')); |
|
969 | 969 | |
970 | - $mylat = $post->post_latitude; |
|
971 | - $mylon = $post->post_longitude; |
|
970 | + $mylat = $post->post_latitude; |
|
971 | + $mylon = $post->post_longitude; |
|
972 | 972 | |
973 | - $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance "; |
|
974 | - return $fields; |
|
973 | + $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance "; |
|
974 | + return $fields; |
|
975 | 975 | } |
976 | 976 | function geodir_related_posts_fields_filter($query) { |
977 | - if ( isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop'] |
|
978 | - && isset($query->query_vars['order_by']) && $query->query_vars['order_by'] == 'nearest' |
|
979 | - && isset($query->query_vars['related_listings']) && $query->query_vars['related_listings'] |
|
980 | - ) { |
|
981 | - add_filter('posts_fields', 'geodir_related_posts_fields', 1); |
|
982 | - } |
|
977 | + if ( isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop'] |
|
978 | + && isset($query->query_vars['order_by']) && $query->query_vars['order_by'] == 'nearest' |
|
979 | + && isset($query->query_vars['related_listings']) && $query->query_vars['related_listings'] |
|
980 | + ) { |
|
981 | + add_filter('posts_fields', 'geodir_related_posts_fields', 1); |
|
982 | + } |
|
983 | 983 | } |
984 | 984 | add_action('pre_get_posts', 'geodir_related_posts_fields_filter', 1); |
985 | 985 | \ No newline at end of file |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * @global string $s_A Extra parameters. |
66 | 66 | * @global string $s_SA Extra parameters. |
67 | 67 | */ |
68 | -function set_listing_request($query ) |
|
68 | +function set_listing_request($query) |
|
69 | 69 | { |
70 | 70 | global $wp_query, $wpdb, $geodir_post_type, $table, $dist, $mylat, $mylon, $s, $snear, $s, $s_A, $s_SA; |
71 | 71 | |
@@ -99,15 +99,15 @@ discard block |
||
99 | 99 | } // Distance |
100 | 100 | |
101 | 101 | if (isset($_REQUEST['sgeo_lat'])) { |
102 | - $mylat = (float)esc_attr($_REQUEST['sgeo_lat']); |
|
102 | + $mylat = (float) esc_attr($_REQUEST['sgeo_lat']); |
|
103 | 103 | } else { |
104 | - $mylat = (float)geodir_get_current_city_lat(); |
|
104 | + $mylat = (float) geodir_get_current_city_lat(); |
|
105 | 105 | } // Latatude |
106 | 106 | |
107 | 107 | if (isset($_REQUEST['sgeo_lon'])) { |
108 | - $mylon = (float)esc_attr($_REQUEST['sgeo_lon']); |
|
108 | + $mylon = (float) esc_attr($_REQUEST['sgeo_lon']); |
|
109 | 109 | } else { |
110 | - $mylon = (float)geodir_get_current_city_lng(); |
|
110 | + $mylon = (float) geodir_get_current_city_lng(); |
|
111 | 111 | } // Distance |
112 | 112 | |
113 | 113 | if (isset($_REQUEST['snear'])) { |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | |
121 | 121 | if ($snear == 'NEAR ME') { |
122 | 122 | $ip = $_SERVER['REMOTE_ADDR']; |
123 | - $addr_details = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=' . $ip)); |
|
123 | + $addr_details = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip='.$ip)); |
|
124 | 124 | $mylat = stripslashes(ucfirst($addr_details[geoplugin_latitude])); |
125 | 125 | $mylon = stripslashes(ucfirst($addr_details[geoplugin_longitude])); |
126 | 126 | } |
@@ -130,9 +130,9 @@ discard block |
||
130 | 130 | $s_AA = str_replace(" ", "", $s); |
131 | 131 | $s_A = explode(",", $s_AA); |
132 | 132 | $s_A = implode('","', $s_A); |
133 | - $s_A = '"' . $s_A . '"'; |
|
133 | + $s_A = '"'.$s_A.'"'; |
|
134 | 134 | } else { |
135 | - $s_A = '"' . $s . '"'; |
|
135 | + $s_A = '"'.$s.'"'; |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | if (strstr($s, ' ')) { |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | } |
194 | 194 | if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) { |
195 | 195 | |
196 | - $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
196 | + $table = $plugin_prefix.$geodir_post_type.'_detail'; |
|
197 | 197 | |
198 | 198 | add_filter('posts_fields', 'geodir_posts_fields', 1); |
199 | 199 | add_filter('posts_join', 'geodir_posts_join', 1); |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | global $wp_query, $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $snear, $gd_session; |
234 | 234 | |
235 | 235 | // Filter-Location-Manager to add location table. |
236 | - $fields .= ", " . $table . ".* "; |
|
236 | + $fields .= ", ".$table.".* "; |
|
237 | 237 | |
238 | 238 | if ($snear != '' || $gd_session->get('all_near_me')) { |
239 | 239 | $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1')); |
@@ -243,16 +243,16 @@ discard block |
||
243 | 243 | $mylon = $gd_session->get('user_lon'); |
244 | 244 | } |
245 | 245 | |
246 | - $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance "; |
|
246 | + $fields .= " , (".$DistanceRadius." * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(".$table.".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(".$table.".post_latitude) * pi()/180) *POWER(SIN(($mylon - ".$table.".post_longitude) * pi()/180 / 2), 2) )))as distance "; |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | global $s; |
250 | 250 | if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') { |
251 | 251 | $keywords = explode(" ", $s); |
252 | 252 | |
253 | - if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){ |
|
254 | - foreach($keywords as $kkey=>$kword){ |
|
255 | - if(mb_strlen($kword, 'UTF-8')<=$klimit){ |
|
253 | + if (is_array($keywords) && $klimit = get_option('geodir_search_word_limit')) { |
|
254 | + foreach ($keywords as $kkey=>$kword) { |
|
255 | + if (mb_strlen($kword, 'UTF-8') <= $klimit) { |
|
256 | 256 | unset($keywords[$kkey]); |
257 | 257 | } |
258 | 258 | } |
@@ -270,24 +270,24 @@ discard block |
||
270 | 270 | $count = 0; |
271 | 271 | foreach ($keywords as $keyword) { |
272 | 272 | $keyword = trim($keyword); |
273 | - $keyword = wp_specialchars_decode($keyword ,ENT_QUOTES); |
|
273 | + $keyword = wp_specialchars_decode($keyword, ENT_QUOTES); |
|
274 | 274 | $count++; |
275 | 275 | if ($count < count($keywords)) { |
276 | 276 | // $gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' " . $key . " "; |
277 | - $gd_titlematch_part .= "( " . $wpdb->posts . ".post_title LIKE '" . $keyword . "' OR " . $wpdb->posts . ".post_title LIKE '" . $keyword . "%%' OR " . $wpdb->posts . ".post_title LIKE '%% " . $keyword . "%%' ) " . $key . " "; |
|
277 | + $gd_titlematch_part .= "( ".$wpdb->posts.".post_title LIKE '".$keyword."' OR ".$wpdb->posts.".post_title LIKE '".$keyword."%%' OR ".$wpdb->posts.".post_title LIKE '%% ".$keyword."%%' ) ".$key." "; |
|
278 | 278 | } else { |
279 | 279 | //$gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' "; |
280 | - $gd_titlematch_part .= "( " . $wpdb->posts . ".post_title LIKE '" . $keyword . "' OR " . $wpdb->posts . ".post_title LIKE '" . $keyword . "%%' OR " . $wpdb->posts . ".post_title LIKE '%% " . $keyword . "%%' ) "; |
|
280 | + $gd_titlematch_part .= "( ".$wpdb->posts.".post_title LIKE '".$keyword."' OR ".$wpdb->posts.".post_title LIKE '".$keyword."%%' OR ".$wpdb->posts.".post_title LIKE '%% ".$keyword."%%' ) "; |
|
281 | 281 | } |
282 | 282 | } |
283 | - $gd_titlematch_part .= "THEN 1 ELSE 0 END AS " . $part . ","; |
|
283 | + $gd_titlematch_part .= "THEN 1 ELSE 0 END AS ".$part.","; |
|
284 | 284 | } |
285 | 285 | } else { |
286 | 286 | $gd_titlematch_part = ""; |
287 | 287 | } |
288 | - $s = stripslashes_deep( $s ); |
|
289 | - $s = wp_specialchars_decode($s,ENT_QUOTES); |
|
290 | - $fields .= $wpdb->prepare(", CASE WHEN " . $table . ".is_featured='1' THEN 1 ELSE 0 END AS gd_featured, CASE WHEN " . $wpdb->posts . ".post_title LIKE %s THEN 1 ELSE 0 END AS gd_exacttitle," . $gd_titlematch_part . " CASE WHEN ( " . $wpdb->posts . ".post_title LIKE %s OR " . $wpdb->posts . ".post_title LIKE %s OR " . $wpdb->posts . ".post_title LIKE %s ) THEN 1 ELSE 0 END AS gd_titlematch, CASE WHEN ( " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s ) THEN 1 ELSE 0 END AS gd_content", array($s, $s, $s . '%', '% ' . $s . '%', $s, $s . ' %', '% ' . $s . ' %', '% ' . $s)); |
|
288 | + $s = stripslashes_deep($s); |
|
289 | + $s = wp_specialchars_decode($s, ENT_QUOTES); |
|
290 | + $fields .= $wpdb->prepare(", CASE WHEN ".$table.".is_featured='1' THEN 1 ELSE 0 END AS gd_featured, CASE WHEN ".$wpdb->posts.".post_title LIKE %s THEN 1 ELSE 0 END AS gd_exacttitle,".$gd_titlematch_part." CASE WHEN ( ".$wpdb->posts.".post_title LIKE %s OR ".$wpdb->posts.".post_title LIKE %s OR ".$wpdb->posts.".post_title LIKE %s ) THEN 1 ELSE 0 END AS gd_titlematch, CASE WHEN ( ".$wpdb->posts.".post_content LIKE %s OR ".$wpdb->posts.".post_content LIKE %s OR ".$wpdb->posts.".post_content LIKE %s OR ".$wpdb->posts.".post_content LIKE %s ) THEN 1 ELSE 0 END AS gd_content", array($s, $s, $s.'%', '% '.$s.'%', $s, $s.' %', '% '.$s.' %', '% '.$s)); |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | return $fields; |
@@ -316,13 +316,13 @@ discard block |
||
316 | 316 | $lang_code = ICL_LANGUAGE_CODE; |
317 | 317 | $default_lang_code = $sitepress->get_default_language(); |
318 | 318 | if ($lang_code) { |
319 | - $join .= "JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID"; |
|
319 | + $join .= "JOIN ".$table_prefix."icl_translations icl_t ON icl_t.element_id = ".$table_prefix."posts.ID"; |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | } |
323 | 323 | ########### WPML ########### |
324 | 324 | |
325 | - $join .= " INNER JOIN " . $table . " ON (" . $table . ".post_id = $wpdb->posts.ID) "; |
|
325 | + $join .= " INNER JOIN ".$table." ON (".$table.".post_id = $wpdb->posts.ID) "; |
|
326 | 326 | //===old code start |
327 | 327 | //$join .= " INNER JOIN ".POST_LOCATION_TABLE." ON (".$table.".post_location_id = ".POST_LOCATION_TABLE.".location_id) " ;//===old code end |
328 | 328 | |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | $sort_by = 'az'; |
392 | 392 | } |
393 | 393 | |
394 | - if ($snear != '' && $sort_by!='farthest') { |
|
394 | + if ($snear != '' && $sort_by != 'farthest') { |
|
395 | 395 | $sort_by = 'nearest'; |
396 | 396 | } |
397 | 397 | } |
@@ -405,20 +405,20 @@ discard block |
||
405 | 405 | break; |
406 | 406 | case 'low_review': |
407 | 407 | case 'rating_count_asc': |
408 | - $orderby = $table . ".rating_count ASC, " . $table . ".overall_rating ASC, "; |
|
408 | + $orderby = $table.".rating_count ASC, ".$table.".overall_rating ASC, "; |
|
409 | 409 | break; |
410 | 410 | case 'high_review': |
411 | 411 | case 'rating_count_desc': |
412 | - $orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, "; |
|
412 | + $orderby = $table.".rating_count DESC, ".$table.".overall_rating DESC, "; |
|
413 | 413 | break; |
414 | 414 | case 'low_rating': |
415 | - $orderby = "( " . $table . ".overall_rating ) ASC, " . $table . ".rating_count ASC, "; |
|
415 | + $orderby = "( ".$table.".overall_rating ) ASC, ".$table.".rating_count ASC, "; |
|
416 | 416 | break; |
417 | 417 | case 'high_rating': |
418 | - $orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, "; |
|
418 | + $orderby = " ".$table.".overall_rating DESC, ".$table.".rating_count DESC, "; |
|
419 | 419 | break; |
420 | 420 | case 'featured': |
421 | - $orderby = $table . ".is_featured asc, "; |
|
421 | + $orderby = $table.".is_featured asc, "; |
|
422 | 422 | break; |
423 | 423 | case 'nearest': |
424 | 424 | $orderby = " distance asc, "; |
@@ -434,10 +434,10 @@ discard block |
||
434 | 434 | break; |
435 | 435 | // sort by rating |
436 | 436 | case 'overall_rating_desc': |
437 | - $orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, "; |
|
437 | + $orderby = " ".$table.".overall_rating DESC, ".$table.".rating_count DESC, "; |
|
438 | 438 | break; |
439 | 439 | case 'overall_rating_asc': |
440 | - $orderby = " " . $table . ".overall_rating ASC, " . $table . ".rating_count ASC, "; |
|
440 | + $orderby = " ".$table.".overall_rating ASC, ".$table.".rating_count ASC, "; |
|
441 | 441 | break; |
442 | 442 | default: |
443 | 443 | |
@@ -448,24 +448,24 @@ discard block |
||
448 | 448 | |
449 | 449 | if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') { |
450 | 450 | $keywords = explode(" ", $s); |
451 | - if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){ |
|
452 | - foreach($keywords as $kkey=>$kword){ |
|
453 | - if(mb_strlen($kword, 'UTF-8')<=$klimit){ |
|
451 | + if (is_array($keywords) && $klimit = get_option('geodir_search_word_limit')) { |
|
452 | + foreach ($keywords as $kkey=>$kword) { |
|
453 | + if (mb_strlen($kword, 'UTF-8') <= $klimit) { |
|
454 | 454 | unset($keywords[$kkey]); |
455 | 455 | } |
456 | 456 | } |
457 | 457 | } |
458 | 458 | if ($sort_by == 'nearest' || $sort_by == 'farthest') { |
459 | 459 | if (count($keywords) > 1) { |
460 | - $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, "; |
|
460 | + $orderby = $orderby." ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, "; |
|
461 | 461 | } else { |
462 | - $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, "; |
|
462 | + $orderby = $orderby." ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, "; |
|
463 | 463 | } |
464 | 464 | } else { |
465 | 465 | if (count($keywords) > 1) { |
466 | - $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, " . $orderby; |
|
466 | + $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, ".$orderby; |
|
467 | 467 | } else { |
468 | - $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, " . $orderby; |
|
468 | + $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, ".$orderby; |
|
469 | 469 | } |
470 | 470 | } |
471 | 471 | } |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | */ |
481 | 481 | $orderby = apply_filters('geodir_posts_order_by_sort', $orderby, $sort_by, $table); |
482 | 482 | |
483 | - $orderby .= $table . ".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title "; |
|
483 | + $orderby .= $table.".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title "; |
|
484 | 484 | |
485 | 485 | return $orderby; |
486 | 486 | } |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | |
503 | 503 | global $wpdb; |
504 | 504 | |
505 | - if ($sort_by != '' && (!is_search() || ( isset($_REQUEST['s']) && isset($_REQUEST['snear']) && $_REQUEST['snear']=='' && ( $_REQUEST['s']=='' || $_REQUEST['s']==' ') ) )) { |
|
505 | + if ($sort_by != '' && (!is_search() || (isset($_REQUEST['s']) && isset($_REQUEST['snear']) && $_REQUEST['snear'] == '' && ($_REQUEST['s'] == '' || $_REQUEST['s'] == ' ')))) { |
|
506 | 506 | |
507 | 507 | $sort_array = explode('_', $sort_by); |
508 | 508 | |
@@ -512,31 +512,31 @@ discard block |
||
512 | 512 | |
513 | 513 | if ($sort_by_count > 1 && ($order == 'asc' || $order == 'desc')) { |
514 | 514 | |
515 | - $sort_by = str_replace('_' . $order, '', $sort_by); |
|
515 | + $sort_by = str_replace('_'.$order, '', $sort_by); |
|
516 | 516 | |
517 | 517 | switch ($sort_by): |
518 | 518 | |
519 | 519 | case 'post_date': |
520 | 520 | case 'comment_count': |
521 | 521 | |
522 | - $orderby = "$wpdb->posts." . $sort_by . " " . $order . ", ".$table . ".overall_rating " . $order . ", "; |
|
522 | + $orderby = "$wpdb->posts.".$sort_by." ".$order.", ".$table.".overall_rating ".$order.", "; |
|
523 | 523 | break; |
524 | 524 | |
525 | 525 | case 'distance': |
526 | - $orderby = $sort_by . " " . $order . ", "; |
|
526 | + $orderby = $sort_by." ".$order.", "; |
|
527 | 527 | break; |
528 | 528 | |
529 | 529 | |
530 | 530 | // sort by rating |
531 | 531 | case 'overall_rating': |
532 | - $orderby = " " . $table . "." . $sort_by . " " . $order . ", " . $table . ".rating_count " . $order . ", "; |
|
532 | + $orderby = " ".$table.".".$sort_by." ".$order.", ".$table.".rating_count ".$order.", "; |
|
533 | 533 | |
534 | 534 | break; |
535 | 535 | |
536 | 536 | |
537 | 537 | default: |
538 | 538 | if (geodir_column_exist($table, $sort_by)) { |
539 | - $orderby = $table . "." . $sort_by . " " . $order . ", "; |
|
539 | + $orderby = $table.".".$sort_by." ".$order.", "; |
|
540 | 540 | } |
541 | 541 | break; |
542 | 542 | |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | } |
585 | 585 | |
586 | 586 | //if (!geodir_is_page('detail')) |
587 | - add_filter('posts_where', 'geodir_default_where', 1);/**/ |
|
587 | + add_filter('posts_where', 'geodir_default_where', 1); /**/ |
|
588 | 588 | |
589 | 589 | //add_filter( 'user_has_cap', 'geodir_preview_post_cap', 10, 3 );// let subscribers edit their own posts |
590 | 590 | |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | $q_post_type = isset($wp_query->query['post_type']) ? $wp_query->query['post_type'] : ''; |
656 | 656 | //echo '##########'.$q_post_type; |
657 | 657 | if ($lang_code && $q_post_type) { |
658 | - $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_" . $q_post_type . "') "; |
|
658 | + $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_".$q_post_type."') "; |
|
659 | 659 | //$where .= " AND icl_t.language_code = '$lang_code' "; |
660 | 660 | } |
661 | 661 | |
@@ -722,8 +722,8 @@ discard block |
||
722 | 722 | } |
723 | 723 | |
724 | 724 | $s = trim($s); |
725 | - $s = wp_specialchars_decode($s ,ENT_QUOTES); |
|
726 | - $s_A = wp_specialchars_decode($s_A ,ENT_QUOTES); |
|
725 | + $s = wp_specialchars_decode($s, ENT_QUOTES); |
|
726 | + $s_A = wp_specialchars_decode($s_A, ENT_QUOTES); |
|
727 | 727 | |
728 | 728 | $where = ''; |
729 | 729 | $better_search_terms = ''; |
@@ -734,9 +734,9 @@ discard block |
||
734 | 734 | |
735 | 735 | if ($s != '') { |
736 | 736 | $keywords = explode(" ", $s); |
737 | - if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){ |
|
738 | - foreach($keywords as $kkey=>$kword){ |
|
739 | - if(mb_strlen($kword, 'UTF-8')<=$klimit){ |
|
737 | + if (is_array($keywords) && $klimit = get_option('geodir_search_word_limit')) { |
|
738 | + foreach ($keywords as $kkey=>$kword) { |
|
739 | + if (mb_strlen($kword, 'UTF-8') <= $klimit) { |
|
740 | 740 | unset($keywords[$kkey]); |
741 | 741 | } |
742 | 742 | } |
@@ -745,7 +745,7 @@ discard block |
||
745 | 745 | if (!empty($keywords)) { |
746 | 746 | foreach ($keywords as $keyword) { |
747 | 747 | $keyword = trim($keyword); |
748 | - $keyword = wp_specialchars_decode($keyword ,ENT_QUOTES); |
|
748 | + $keyword = wp_specialchars_decode($keyword, ENT_QUOTES); |
|
749 | 749 | if ($keyword != '') { |
750 | 750 | /** |
751 | 751 | * Filter the search query keywords SQL. |
@@ -756,7 +756,7 @@ discard block |
||
756 | 756 | * @param array $keywords The array of keywords for the query. |
757 | 757 | * @param string $keyword The single keyword being searched. |
758 | 758 | */ |
759 | - $better_search_terms .= apply_filters("geodir_search_better_search_terms",' OR ( ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '" OR ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '%" OR ' . $wpdb->posts . '.post_title LIKE "% ' . $keyword . '%" )',$keywords,$keyword); |
|
759 | + $better_search_terms .= apply_filters("geodir_search_better_search_terms", ' OR ( '.$wpdb->posts.'.post_title LIKE "'.$keyword.'" OR '.$wpdb->posts.'.post_title LIKE "'.$keyword.'%" OR '.$wpdb->posts.'.post_title LIKE "% '.$keyword.'%" )', $keywords, $keyword); |
|
760 | 760 | } |
761 | 761 | } |
762 | 762 | } |
@@ -764,10 +764,10 @@ discard block |
||
764 | 764 | |
765 | 765 | /* get taxonomy */ |
766 | 766 | $taxonomies = geodir_get_taxonomies($post_types, true); |
767 | - if($taxonomies) { |
|
767 | + if ($taxonomies) { |
|
768 | 768 | $taxonomies = implode("','", $taxonomies); |
769 | - $taxonomies = "'" . $taxonomies . "'"; |
|
770 | - }else{$taxonomies='';} |
|
769 | + $taxonomies = "'".$taxonomies."'"; |
|
770 | + } else {$taxonomies = ''; } |
|
771 | 771 | |
772 | 772 | $content_where = $terms_where = ''; |
773 | 773 | if ($s != '') { |
@@ -778,7 +778,7 @@ discard block |
||
778 | 778 | * @package GeoDirectory |
779 | 779 | * @param string $content_where The query values, default: `" OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ") "`. |
780 | 780 | */ |
781 | - $content_where = apply_filters("geodir_search_content_where"," OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") "); |
|
781 | + $content_where = apply_filters("geodir_search_content_where", " OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") "); |
|
782 | 782 | /** |
783 | 783 | * Filter the search query term values. |
784 | 784 | * |
@@ -786,7 +786,7 @@ discard block |
||
786 | 786 | * @package GeoDirectory |
787 | 787 | * @param string $terms_where The separator, default: `" AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) "`. |
788 | 788 | */ |
789 | - $terms_where = apply_filters("geodir_search_terms_where"," AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) "); |
|
789 | + $terms_where = apply_filters("geodir_search_terms_where", " AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) "); |
|
790 | 790 | } |
791 | 791 | |
792 | 792 | if ($snear != '') { |
@@ -821,12 +821,12 @@ discard block |
||
821 | 821 | ) |
822 | 822 | AND $wpdb->posts.post_type in ('{$post_types}') |
823 | 823 | AND ($wpdb->posts.post_status = 'publish') |
824 | - AND ( " . $table . ".post_latitude between $rlat1 and $rlat2 ) |
|
825 | - AND ( " . $table . ".post_longitude between $rlon1 and $rlon2 ) "; |
|
824 | + AND ( ".$table.".post_latitude between $rlat1 and $rlat2 ) |
|
825 | + AND ( ".$table.".post_longitude between $rlon1 and $rlon2 ) "; |
|
826 | 826 | |
827 | 827 | if (isset($_REQUEST['sdist']) && $_REQUEST['sdist'] != 'all') { |
828 | 828 | $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1')); |
829 | - $where .= " AND CONVERT((" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) ))),DECIMAL(64,4)) <= " . $dist; |
|
829 | + $where .= " AND CONVERT((".$DistanceRadius." * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(".$table.".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(".$table.".post_latitude) * pi()/180) *POWER(SIN(($mylon - ".$table.".post_longitude) * pi()/180 / 2), 2) ))),DECIMAL(64,4)) <= ".$dist; |
|
830 | 830 | } |
831 | 831 | |
832 | 832 | } else { |
@@ -847,11 +847,11 @@ discard block |
||
847 | 847 | } |
848 | 848 | |
849 | 849 | ########### WPML ########### |
850 | - if ( function_exists( 'icl_object_id' ) ) { |
|
850 | + if (function_exists('icl_object_id')) { |
|
851 | 851 | $lang_code = ICL_LANGUAGE_CODE; |
852 | 852 | |
853 | 853 | if ($lang_code && $post_types) { |
854 | - $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_" . $post_types . "') "; |
|
854 | + $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_".$post_types."') "; |
|
855 | 855 | } |
856 | 856 | } |
857 | 857 | ########### WPML ########### |
@@ -874,10 +874,10 @@ discard block |
||
874 | 874 | global $wpdb, $geodir_post_type, $table, $curr; |
875 | 875 | |
876 | 876 | $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author')); |
877 | - $user_id = !empty($curauth->ID) ? (int)$curauth->ID : 0; |
|
877 | + $user_id = !empty($curauth->ID) ? (int) $curauth->ID : 0; |
|
878 | 878 | |
879 | 879 | if (isset($_REQUEST['stype'])) { |
880 | - $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ",$_REQUEST['stype']); |
|
880 | + $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ", $_REQUEST['stype']); |
|
881 | 881 | } else { |
882 | 882 | $where = " AND $wpdb->posts.post_type IN ('gd_place') "; |
883 | 883 | } |
@@ -890,7 +890,7 @@ discard block |
||
890 | 890 | } else |
891 | 891 | $where .= " AND $wpdb->posts.post_author = $user_id"; |
892 | 892 | |
893 | - if ($user_id == (int)get_current_user_id()) { |
|
893 | + if ($user_id == (int) get_current_user_id()) { |
|
894 | 894 | $where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') "; |
895 | 895 | } else { |
896 | 896 | $where .= " AND $wpdb->posts.post_status = 'publish' "; |
@@ -903,7 +903,7 @@ discard block |
||
903 | 903 | if (function_exists('icl_object_id')) { |
904 | 904 | $lang_code = ICL_LANGUAGE_CODE; |
905 | 905 | if ($lang_code) { |
906 | - $where .= " AND icl_t.language_code='" . $lang_code . "' "; |
|
906 | + $where .= " AND icl_t.language_code='".$lang_code."' "; |
|
907 | 907 | } |
908 | 908 | |
909 | 909 | } |
@@ -926,7 +926,7 @@ discard block |
||
926 | 926 | { |
927 | 927 | global $wp_query, $table; |
928 | 928 | if (!empty($wp_query->query['with_pics_only'])) { |
929 | - $join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )"; |
|
929 | + $join .= " LEFT JOIN ".GEODIR_ATTACHMENT_TABLE." ON ( ".GEODIR_ATTACHMENT_TABLE.".post_id=".$table.".post_id AND ".GEODIR_ATTACHMENT_TABLE.".mime_type LIKE '%image%' )"; |
|
930 | 930 | } |
931 | 931 | return $join; |
932 | 932 | } |
@@ -945,16 +945,16 @@ discard block |
||
945 | 945 | { |
946 | 946 | global $wp_query, $table; |
947 | 947 | if (!empty($wp_query->query['show_featured_only'])) { |
948 | - $where .= " AND " . $table . ".is_featured = '1'"; |
|
948 | + $where .= " AND ".$table.".is_featured = '1'"; |
|
949 | 949 | } |
950 | 950 | if (!empty($wp_query->query['show_special_only'])) { |
951 | - $where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )"; |
|
951 | + $where .= " AND ( ".$table.".geodir_special_offers != '' AND ".$table.".geodir_special_offers IS NOT NULL )"; |
|
952 | 952 | } |
953 | 953 | if (!empty($wp_query->query['with_pics_only'])) { |
954 | - $where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL GROUP BY " . $table . ".post_id"; |
|
954 | + $where .= " AND ".GEODIR_ATTACHMENT_TABLE.".ID IS NOT NULL GROUP BY ".$table.".post_id"; |
|
955 | 955 | } |
956 | 956 | if (!empty($wp_query->query['with_videos_only'])) { |
957 | - $where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )"; |
|
957 | + $where .= " AND ( ".$table.".geodir_video != '' AND ".$table.".geodir_video IS NOT NULL )"; |
|
958 | 958 | } |
959 | 959 | return $where; |
960 | 960 | } |
@@ -963,18 +963,18 @@ discard block |
||
963 | 963 | function geodir_related_posts_fields($fields) { |
964 | 964 | global $wp_query, $wpdb, $table, $post; |
965 | 965 | |
966 | - $fields .= ", " . $table . ".* "; |
|
966 | + $fields .= ", ".$table.".* "; |
|
967 | 967 | |
968 | 968 | $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1')); |
969 | 969 | |
970 | 970 | $mylat = $post->post_latitude; |
971 | 971 | $mylon = $post->post_longitude; |
972 | 972 | |
973 | - $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance "; |
|
973 | + $fields .= " , (".$DistanceRadius." * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(".$table.".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(".$table.".post_latitude) * pi()/180) *POWER(SIN(($mylon - ".$table.".post_longitude) * pi()/180 / 2), 2) )))as distance "; |
|
974 | 974 | return $fields; |
975 | 975 | } |
976 | 976 | function geodir_related_posts_fields_filter($query) { |
977 | - if ( isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop'] |
|
977 | + if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop'] |
|
978 | 978 | && isset($query->query_vars['order_by']) && $query->query_vars['order_by'] == 'nearest' |
979 | 979 | && isset($query->query_vars['related_listings']) && $query->query_vars['related_listings'] |
980 | 980 | ) { |
@@ -16,7 +16,9 @@ discard block |
||
16 | 16 | */ |
17 | 17 | function geodir_session_start() |
18 | 18 | { |
19 | - if (!session_id()) session_start(); |
|
19 | + if (!session_id()) { |
|
20 | + session_start(); |
|
21 | + } |
|
20 | 22 | global $geodir_add_location_url; |
21 | 23 | |
22 | 24 | $geodir_add_location_url = NULL; |
@@ -86,7 +88,9 @@ discard block |
||
86 | 88 | |
87 | 89 | if ((is_search() && isset($_REQUEST['geodir_search']) && $_REQUEST['geodir_search'] != '')): |
88 | 90 | |
89 | - if (isset($_REQUEST['scat']) && $_REQUEST['scat'] == 'all') $_REQUEST['scat'] = ''; |
|
91 | + if (isset($_REQUEST['scat']) && $_REQUEST['scat'] == 'all') { |
|
92 | + $_REQUEST['scat'] = ''; |
|
93 | + } |
|
90 | 94 | //if(isset($_REQUEST['s']) && $_REQUEST['s'] == '+') $_REQUEST['s'] = ''; |
91 | 95 | |
92 | 96 | if (isset($_REQUEST['sdist'])) { |
@@ -198,8 +202,9 @@ discard block |
||
198 | 202 | add_filter('posts_fields', 'geodir_posts_fields', 1); |
199 | 203 | add_filter('posts_join', 'geodir_posts_join', 1); |
200 | 204 | geodir_post_where(); |
201 | - if (!is_admin()) |
|
202 | - add_filter('posts_orderby', 'geodir_posts_orderby', 1); |
|
205 | + if (!is_admin()) { |
|
206 | + add_filter('posts_orderby', 'geodir_posts_orderby', 1); |
|
207 | + } |
|
203 | 208 | |
204 | 209 | // advanced filter for popular post view widget |
205 | 210 | global $wp_query; |
@@ -349,8 +354,9 @@ discard block |
||
349 | 354 | $sort_by = ''; |
350 | 355 | $orderby = ' '; |
351 | 356 | |
352 | - if (get_query_var('order_by')) |
|
353 | - $sort_by = get_query_var('order_by'); |
|
357 | + if (get_query_var('order_by')) { |
|
358 | + $sort_by = get_query_var('order_by'); |
|
359 | + } |
|
354 | 360 | |
355 | 361 | /*if(isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries){ |
356 | 362 | $current_term = $wp_query->get_queried_object(); |
@@ -370,14 +376,16 @@ discard block |
||
370 | 376 | $orderby .= " distance,"; |
371 | 377 | } |
372 | 378 | |
373 | - if (isset($_REQUEST['sort_by']) && $_REQUEST['sort_by'] != '' && is_main_query()) |
|
374 | - $sort_by = esc_attr($_REQUEST['sort_by']); |
|
379 | + if (isset($_REQUEST['sort_by']) && $_REQUEST['sort_by'] != '' && is_main_query()) { |
|
380 | + $sort_by = esc_attr($_REQUEST['sort_by']); |
|
381 | + } |
|
375 | 382 | |
376 | 383 | |
377 | 384 | if ($sort_by == '') { |
378 | 385 | $default_sort = geodir_get_posts_default_sort($geodir_post_type); |
379 | - if (!empty($default_sort)) |
|
380 | - $sort_by = $default_sort; |
|
386 | + if (!empty($default_sort)) { |
|
387 | + $sort_by = $default_sort; |
|
388 | + } |
|
381 | 389 | } |
382 | 390 | |
383 | 391 | /* |
@@ -572,8 +580,9 @@ discard block |
||
572 | 580 | |
573 | 581 | add_filter('posts_where', 'searching_filter_where', 1); |
574 | 582 | |
575 | - if ($snear != '') |
|
576 | - add_filter('posts_where', 'searching_filter_where', 1); |
|
583 | + if ($snear != '') { |
|
584 | + add_filter('posts_where', 'searching_filter_where', 1); |
|
585 | + } |
|
577 | 586 | |
578 | 587 | add_filter('posts_orderby', 'geodir_posts_orderby', 1); |
579 | 588 | |
@@ -727,10 +736,11 @@ discard block |
||
727 | 736 | |
728 | 737 | $where = ''; |
729 | 738 | $better_search_terms = ''; |
730 | - if (isset($_REQUEST['stype'])) |
|
731 | - $post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype'])); |
|
732 | - else |
|
733 | - $post_types = 'gd_place'; |
|
739 | + if (isset($_REQUEST['stype'])) { |
|
740 | + $post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype'])); |
|
741 | + } else { |
|
742 | + $post_types = 'gd_place'; |
|
743 | + } |
|
734 | 744 | |
735 | 745 | if ($s != '') { |
736 | 746 | $keywords = explode(" ", $s); |
@@ -767,7 +777,7 @@ discard block |
||
767 | 777 | if($taxonomies) { |
768 | 778 | $taxonomies = implode("','", $taxonomies); |
769 | 779 | $taxonomies = "'" . $taxonomies . "'"; |
770 | - }else{$taxonomies='';} |
|
780 | + } else{$taxonomies='';} |
|
771 | 781 | |
772 | 782 | $content_where = $terms_where = ''; |
773 | 783 | if ($s != '') { |
@@ -887,8 +897,9 @@ discard block |
||
887 | 897 | $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true); |
888 | 898 | $user_fav_posts = !empty($user_fav_posts) && is_array($user_fav_posts) ? implode("','", $user_fav_posts) : '-1'; |
889 | 899 | $where .= " AND $wpdb->posts.ID IN ('$user_fav_posts')"; |
890 | - } else |
|
891 | - $where .= " AND $wpdb->posts.post_author = $user_id"; |
|
900 | + } else { |
|
901 | + $where .= " AND $wpdb->posts.post_author = $user_id"; |
|
902 | + } |
|
892 | 903 | |
893 | 904 | if ($user_id == (int)get_current_user_id()) { |
894 | 905 | $where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') "; |
@@ -42,10 +42,11 @@ discard block |
||
42 | 42 | } |
43 | 43 | |
44 | 44 | |
45 | - if (geodir_dummy_folder_exists()) |
|
46 | - $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon"; |
|
47 | - else |
|
48 | - $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon'; |
|
45 | + if (geodir_dummy_folder_exists()) { |
|
46 | + $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon"; |
|
47 | + } else { |
|
48 | + $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon'; |
|
49 | + } |
|
49 | 50 | |
50 | 51 | $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url); |
51 | 52 | |
@@ -86,10 +87,11 @@ discard block |
||
86 | 87 | if (!term_exists($catname, $post_type.'category')) { |
87 | 88 | $last_catid = wp_insert_term($catname, $post_type.'category'); |
88 | 89 | |
89 | - if (geodir_dummy_folder_exists()) |
|
90 | - $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon"; |
|
91 | - else |
|
92 | - $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon'; |
|
90 | + if (geodir_dummy_folder_exists()) { |
|
91 | + $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon"; |
|
92 | + } else { |
|
93 | + $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon'; |
|
94 | + } |
|
93 | 95 | |
94 | 96 | $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url); |
95 | 97 | |
@@ -218,7 +220,7 @@ discard block |
||
218 | 220 | * @package GeoDirectory |
219 | 221 | */ |
220 | 222 | include_once( 'dummy-data/standard_places.php' ); |
221 | - }elseif($key=='property_sale'){ |
|
223 | + } elseif($key=='property_sale'){ |
|
222 | 224 | /** |
223 | 225 | * Contains dummy property for sale post content. |
224 | 226 | * |
@@ -226,7 +228,7 @@ discard block |
||
226 | 228 | * @package GeoDirectory |
227 | 229 | */ |
228 | 230 | include_once( 'dummy-data/property_sale.php' ); |
229 | - }elseif($key=='property_rent'){ |
|
231 | + } elseif($key=='property_rent'){ |
|
230 | 232 | /** |
231 | 233 | * Contains dummy property for sale post content. |
232 | 234 | * |
@@ -330,7 +332,7 @@ discard block |
||
330 | 332 | |
331 | 333 | if($post_counts > 0){ |
332 | 334 | echo '<td><input type="button" value="'.__('Remove data','geodirectory').'" class="button-primary geodir_dummy_button gd-remove-data" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>'; |
333 | - }else{ |
|
335 | + } else{ |
|
334 | 336 | echo '<td><input type="button" value="'.__('Insert data','geodirectory').'" class="button-primary geodir_dummy_button" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>'; |
335 | 337 | } |
336 | 338 |
@@ -19,151 +19,151 @@ discard block |
||
19 | 19 | * @global string $dummy_image_path The dummy image path. |
20 | 20 | */ |
21 | 21 | function geodir_dummy_data_taxonomies($post_type,$category_array) { |
22 | - global $wpdb, $dummy_image_path; |
|
22 | + global $wpdb, $dummy_image_path; |
|
23 | 23 | |
24 | 24 | |
25 | 25 | |
26 | - $last_catid = ''; |
|
26 | + $last_catid = ''; |
|
27 | 27 | |
28 | - $uploads = wp_upload_dir(); // Array of key => value pairs |
|
28 | + $uploads = wp_upload_dir(); // Array of key => value pairs |
|
29 | 29 | |
30 | - for ($i = 0; $i < count($category_array); $i++) { |
|
31 | - $parent_catid = 0; |
|
32 | - if (is_array($category_array[$i])) { |
|
33 | - $cat_name_arr = $category_array[$i]; |
|
34 | - for ($j = 0; $j < count($cat_name_arr); $j++) { |
|
35 | - $catname = $cat_name_arr[$j]; |
|
30 | + for ($i = 0; $i < count($category_array); $i++) { |
|
31 | + $parent_catid = 0; |
|
32 | + if (is_array($category_array[$i])) { |
|
33 | + $cat_name_arr = $category_array[$i]; |
|
34 | + for ($j = 0; $j < count($cat_name_arr); $j++) { |
|
35 | + $catname = $cat_name_arr[$j]; |
|
36 | 36 | |
37 | - if (!term_exists($catname, $post_type.'category')) { |
|
38 | - $last_catid = wp_insert_term($catname, $post_type.'category', $args = array('parent' => $parent_catid)); |
|
37 | + if (!term_exists($catname, $post_type.'category')) { |
|
38 | + $last_catid = wp_insert_term($catname, $post_type.'category', $args = array('parent' => $parent_catid)); |
|
39 | 39 | |
40 | - if ($j == 0) { |
|
41 | - $parent_catid = $last_catid; |
|
42 | - } |
|
40 | + if ($j == 0) { |
|
41 | + $parent_catid = $last_catid; |
|
42 | + } |
|
43 | 43 | |
44 | 44 | |
45 | - if (geodir_dummy_folder_exists()) |
|
46 | - $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon"; |
|
47 | - else |
|
48 | - $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon'; |
|
45 | + if (geodir_dummy_folder_exists()) |
|
46 | + $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon"; |
|
47 | + else |
|
48 | + $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon'; |
|
49 | 49 | |
50 | - $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url); |
|
50 | + $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url); |
|
51 | 51 | |
52 | - $catname = str_replace(' ', '_', $catname); |
|
53 | - $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png"); |
|
52 | + $catname = str_replace(' ', '_', $catname); |
|
53 | + $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png"); |
|
54 | 54 | |
55 | - if (empty($uploaded['error'])) { |
|
56 | - $new_path = $uploaded['file']; |
|
57 | - $new_url = $uploaded['url']; |
|
58 | - } |
|
55 | + if (empty($uploaded['error'])) { |
|
56 | + $new_path = $uploaded['file']; |
|
57 | + $new_url = $uploaded['url']; |
|
58 | + } |
|
59 | 59 | |
60 | - $wp_filetype = wp_check_filetype(basename($new_path), null); |
|
61 | - |
|
62 | - $attachment = array( |
|
63 | - 'guid' => $uploads['baseurl'] . '/' . basename($new_path), |
|
64 | - 'post_mime_type' => $wp_filetype['type'], |
|
65 | - 'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)), |
|
66 | - 'post_content' => '', |
|
67 | - 'post_status' => 'inherit' |
|
68 | - ); |
|
69 | - $attach_id = wp_insert_attachment($attachment, $new_path); |
|
70 | - |
|
71 | - // you must first include the image.php file |
|
72 | - // for the function wp_generate_attachment_metadata() to work |
|
73 | - require_once(ABSPATH . 'wp-admin/includes/image.php'); |
|
74 | - $attach_data = wp_generate_attachment_metadata($attach_id, $new_path); |
|
75 | - wp_update_attachment_metadata($attach_id, $attach_data); |
|
76 | - |
|
77 | - if (!get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, $post_type)) { |
|
78 | - update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => 'icon', 'src' => $new_url), $post_type); |
|
79 | - } |
|
80 | - } |
|
81 | - } |
|
60 | + $wp_filetype = wp_check_filetype(basename($new_path), null); |
|
82 | 61 | |
83 | - } else { |
|
84 | - $catname = $category_array[$i]; |
|
62 | + $attachment = array( |
|
63 | + 'guid' => $uploads['baseurl'] . '/' . basename($new_path), |
|
64 | + 'post_mime_type' => $wp_filetype['type'], |
|
65 | + 'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)), |
|
66 | + 'post_content' => '', |
|
67 | + 'post_status' => 'inherit' |
|
68 | + ); |
|
69 | + $attach_id = wp_insert_attachment($attachment, $new_path); |
|
85 | 70 | |
86 | - if (!term_exists($catname, $post_type.'category')) { |
|
87 | - $last_catid = wp_insert_term($catname, $post_type.'category'); |
|
71 | + // you must first include the image.php file |
|
72 | + // for the function wp_generate_attachment_metadata() to work |
|
73 | + require_once(ABSPATH . 'wp-admin/includes/image.php'); |
|
74 | + $attach_data = wp_generate_attachment_metadata($attach_id, $new_path); |
|
75 | + wp_update_attachment_metadata($attach_id, $attach_data); |
|
88 | 76 | |
89 | - if (geodir_dummy_folder_exists()) |
|
90 | - $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon"; |
|
91 | - else |
|
92 | - $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon'; |
|
77 | + if (!get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, $post_type)) { |
|
78 | + update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => 'icon', 'src' => $new_url), $post_type); |
|
79 | + } |
|
80 | + } |
|
81 | + } |
|
93 | 82 | |
94 | - $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url); |
|
83 | + } else { |
|
84 | + $catname = $category_array[$i]; |
|
95 | 85 | |
96 | - $catname = str_replace(' ', '_', $catname); |
|
97 | - $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png"); |
|
86 | + if (!term_exists($catname, $post_type.'category')) { |
|
87 | + $last_catid = wp_insert_term($catname, $post_type.'category'); |
|
98 | 88 | |
99 | - if (empty($uploaded['error'])) { |
|
100 | - $new_path = $uploaded['file']; |
|
101 | - $new_url = $uploaded['url']; |
|
102 | - } |
|
89 | + if (geodir_dummy_folder_exists()) |
|
90 | + $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon"; |
|
91 | + else |
|
92 | + $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon'; |
|
103 | 93 | |
104 | - $wp_filetype = wp_check_filetype(basename($new_path), null); |
|
94 | + $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url); |
|
105 | 95 | |
106 | - $attachment = array( |
|
107 | - 'guid' => $uploads['baseurl'] . '/' . basename($new_path), |
|
108 | - 'post_mime_type' => $wp_filetype['type'], |
|
109 | - 'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)), |
|
110 | - 'post_content' => '', |
|
111 | - 'post_status' => 'inherit' |
|
112 | - ); |
|
96 | + $catname = str_replace(' ', '_', $catname); |
|
97 | + $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png"); |
|
113 | 98 | |
114 | - $attach_id = wp_insert_attachment($attachment, $new_path); |
|
99 | + if (empty($uploaded['error'])) { |
|
100 | + $new_path = $uploaded['file']; |
|
101 | + $new_url = $uploaded['url']; |
|
102 | + } |
|
115 | 103 | |
104 | + $wp_filetype = wp_check_filetype(basename($new_path), null); |
|
116 | 105 | |
117 | - // you must first include the image.php file |
|
118 | - // for the function wp_generate_attachment_metadata() to work |
|
119 | - require_once(ABSPATH . 'wp-admin/includes/image.php'); |
|
120 | - $attach_data = wp_generate_attachment_metadata($attach_id, $new_path); |
|
121 | - wp_update_attachment_metadata($attach_id, $attach_data); |
|
106 | + $attachment = array( |
|
107 | + 'guid' => $uploads['baseurl'] . '/' . basename($new_path), |
|
108 | + 'post_mime_type' => $wp_filetype['type'], |
|
109 | + 'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)), |
|
110 | + 'post_content' => '', |
|
111 | + 'post_status' => 'inherit' |
|
112 | + ); |
|
113 | + |
|
114 | + $attach_id = wp_insert_attachment($attachment, $new_path); |
|
122 | 115 | |
123 | - if (!get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, $post_type)) { |
|
124 | - update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => $attach_id, 'src' => $new_url), $post_type); |
|
125 | - } |
|
126 | - } |
|
127 | - } |
|
128 | 116 | |
129 | - } |
|
117 | + // you must first include the image.php file |
|
118 | + // for the function wp_generate_attachment_metadata() to work |
|
119 | + require_once(ABSPATH . 'wp-admin/includes/image.php'); |
|
120 | + $attach_data = wp_generate_attachment_metadata($attach_id, $new_path); |
|
121 | + wp_update_attachment_metadata($attach_id, $attach_data); |
|
122 | + |
|
123 | + if (!get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, $post_type)) { |
|
124 | + update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => $attach_id, 'src' => $new_url), $post_type); |
|
125 | + } |
|
126 | + } |
|
127 | + } |
|
128 | + |
|
129 | + } |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | |
133 | 133 | function geodir_dummy_data_types(){ |
134 | - $data = array( |
|
135 | - 'standard_places' => array( |
|
136 | - 'name'=>__('Default','geodirectory'), |
|
137 | - 'count'=> 30 |
|
138 | - ), |
|
139 | - 'property_sale' => array( |
|
140 | - 'name'=>__('Property for sale','geodirectory'), |
|
141 | - 'count'=> 10 |
|
142 | - ), |
|
143 | - 'property_rent' => array( |
|
144 | - 'name'=>__('Property for rent','geodirectory'), |
|
145 | - 'count'=> 10 |
|
146 | - ) |
|
147 | - ); |
|
148 | - |
|
149 | - return apply_filters('geodir_dummy_data_types',$data ); |
|
134 | + $data = array( |
|
135 | + 'standard_places' => array( |
|
136 | + 'name'=>__('Default','geodirectory'), |
|
137 | + 'count'=> 30 |
|
138 | + ), |
|
139 | + 'property_sale' => array( |
|
140 | + 'name'=>__('Property for sale','geodirectory'), |
|
141 | + 'count'=> 10 |
|
142 | + ), |
|
143 | + 'property_rent' => array( |
|
144 | + 'name'=>__('Property for rent','geodirectory'), |
|
145 | + 'count'=> 10 |
|
146 | + ) |
|
147 | + ); |
|
148 | + |
|
149 | + return apply_filters('geodir_dummy_data_types',$data ); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | |
153 | 153 | function geodir_create_dummy_fields($fields) |
154 | 154 | { |
155 | 155 | |
156 | - /** |
|
157 | - * Filter the array of default custom fields DB table data. |
|
158 | - * |
|
159 | - * @since 1.0.0 |
|
160 | - * @param string $fields The default custom fields as an array. |
|
161 | - */ |
|
162 | - $fields = apply_filters('geodir_before_dummy_custom_fields_saved', $fields); |
|
163 | - foreach ($fields as $field_index => $field) { |
|
164 | - geodir_custom_field_save($field); |
|
165 | - |
|
166 | - } |
|
156 | + /** |
|
157 | + * Filter the array of default custom fields DB table data. |
|
158 | + * |
|
159 | + * @since 1.0.0 |
|
160 | + * @param string $fields The default custom fields as an array. |
|
161 | + */ |
|
162 | + $fields = apply_filters('geodir_before_dummy_custom_fields_saved', $fields); |
|
163 | + foreach ($fields as $field_index => $field) { |
|
164 | + geodir_custom_field_save($field); |
|
165 | + |
|
166 | + } |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | /** |
@@ -176,20 +176,20 @@ discard block |
||
176 | 176 | */ |
177 | 177 | function geodir_delete_dummy_posts($post_type,$data_type) |
178 | 178 | { |
179 | - global $wpdb, $plugin_prefix; |
|
179 | + global $wpdb, $plugin_prefix; |
|
180 | 180 | |
181 | 181 | |
182 | - $post_ids = $wpdb->get_results("SELECT post_id FROM " . $plugin_prefix . $post_type."_detail WHERE post_dummy='1'"); |
|
182 | + $post_ids = $wpdb->get_results("SELECT post_id FROM " . $plugin_prefix . $post_type."_detail WHERE post_dummy='1'"); |
|
183 | 183 | |
184 | 184 | |
185 | - foreach ($post_ids as $post_ids_obj) { |
|
186 | - wp_delete_post($post_ids_obj->post_id); |
|
187 | - } |
|
185 | + foreach ($post_ids as $post_ids_obj) { |
|
186 | + wp_delete_post($post_ids_obj->post_id); |
|
187 | + } |
|
188 | 188 | |
189 | - //double check posts are deleted |
|
190 | - $wpdb->get_results("DELETE FROM " . $plugin_prefix . $post_type. "_detail WHERE post_dummy='1'"); |
|
189 | + //double check posts are deleted |
|
190 | + $wpdb->get_results("DELETE FROM " . $plugin_prefix . $post_type. "_detail WHERE post_dummy='1'"); |
|
191 | 191 | |
192 | - update_option($post_type.'_dummy_data_type',''); |
|
192 | + update_option($post_type.'_dummy_data_type',''); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | /** |
@@ -203,78 +203,78 @@ discard block |
||
203 | 203 | function geodir_insert_dummy_posts($post_type,$data_type,$item_index) |
204 | 204 | { |
205 | 205 | |
206 | - ini_set('max_execution_time', 999999); //300 seconds = 5 minutes |
|
207 | - $data_types = geodir_dummy_data_types(); |
|
208 | - |
|
209 | - $total_count = 0; |
|
210 | - global $dummy_post_index; |
|
211 | - $dummy_post_index = $item_index; |
|
212 | - foreach( $data_types as $key=>$val){ |
|
213 | - if($key==$data_type){ |
|
214 | - $total_count = $val['count']; |
|
215 | - if($key=='standard_places'){ |
|
216 | - /** |
|
217 | - * Contains dummy post content. |
|
218 | - * |
|
219 | - * @since 1.0.0 |
|
220 | - * @package GeoDirectory |
|
221 | - */ |
|
222 | - include_once( 'dummy-data/standard_places.php' ); |
|
223 | - }elseif($key=='property_sale'){ |
|
224 | - /** |
|
225 | - * Contains dummy property for sale post content. |
|
226 | - * |
|
227 | - * @since 1.6.11 |
|
228 | - * @package GeoDirectory |
|
229 | - */ |
|
230 | - include_once( 'dummy-data/property_sale.php' ); |
|
231 | - }elseif($key=='property_rent'){ |
|
232 | - /** |
|
233 | - * Contains dummy property for sale post content. |
|
234 | - * |
|
235 | - * @since 1.6.11 |
|
236 | - * @package GeoDirectory |
|
237 | - */ |
|
238 | - include_once( 'dummy-data/property_rent.php' ); |
|
239 | - } |
|
240 | - |
|
241 | - } |
|
242 | - |
|
243 | - do_action('geodir_insert_dummy_data_loop',$post_type,$data_type,$item_index); |
|
244 | - } |
|
245 | - |
|
246 | - |
|
247 | - |
|
248 | - // delete image cache on last entry |
|
249 | - if($total_count == $item_index){ |
|
250 | - delete_transient( 'cached_dummy_images' ); |
|
251 | - flush_rewrite_rules(); |
|
252 | - } |
|
206 | + ini_set('max_execution_time', 999999); //300 seconds = 5 minutes |
|
207 | + $data_types = geodir_dummy_data_types(); |
|
208 | + |
|
209 | + $total_count = 0; |
|
210 | + global $dummy_post_index; |
|
211 | + $dummy_post_index = $item_index; |
|
212 | + foreach( $data_types as $key=>$val){ |
|
213 | + if($key==$data_type){ |
|
214 | + $total_count = $val['count']; |
|
215 | + if($key=='standard_places'){ |
|
216 | + /** |
|
217 | + * Contains dummy post content. |
|
218 | + * |
|
219 | + * @since 1.0.0 |
|
220 | + * @package GeoDirectory |
|
221 | + */ |
|
222 | + include_once( 'dummy-data/standard_places.php' ); |
|
223 | + }elseif($key=='property_sale'){ |
|
224 | + /** |
|
225 | + * Contains dummy property for sale post content. |
|
226 | + * |
|
227 | + * @since 1.6.11 |
|
228 | + * @package GeoDirectory |
|
229 | + */ |
|
230 | + include_once( 'dummy-data/property_sale.php' ); |
|
231 | + }elseif($key=='property_rent'){ |
|
232 | + /** |
|
233 | + * Contains dummy property for sale post content. |
|
234 | + * |
|
235 | + * @since 1.6.11 |
|
236 | + * @package GeoDirectory |
|
237 | + */ |
|
238 | + include_once( 'dummy-data/property_rent.php' ); |
|
239 | + } |
|
240 | + |
|
241 | + } |
|
242 | + |
|
243 | + do_action('geodir_insert_dummy_data_loop',$post_type,$data_type,$item_index); |
|
244 | + } |
|
245 | + |
|
246 | + |
|
247 | + |
|
248 | + // delete image cache on last entry |
|
249 | + if($total_count == $item_index){ |
|
250 | + delete_transient( 'cached_dummy_images' ); |
|
251 | + flush_rewrite_rules(); |
|
252 | + } |
|
253 | 253 | |
254 | 254 | |
255 | 255 | } |
256 | 256 | |
257 | 257 | |
258 | 258 | if (!function_exists('geodir_autoinstall_admin_header') && (get_option('geodir_installed') || defined( 'GD_TESTING_MODE' ))) { |
259 | - /** |
|
260 | - * GeoDirectory dummy data installation. |
|
261 | - * |
|
262 | - * @since 1.0.0 |
|
263 | - * @package GeoDirectory |
|
264 | - * @global object $wpdb WordPress Database object. |
|
265 | - * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
266 | - * @param string $post_type The post type. |
|
267 | - */ |
|
268 | - function geodir_autoinstall_admin_header($post_type = 'gd_place') |
|
269 | - { |
|
270 | - |
|
271 | - global $wpdb, $plugin_prefix; |
|
272 | - |
|
273 | - if (!geodir_is_default_location_set()) { |
|
274 | - echo '<div class="updated fade"><p><strong>' . sprintf(__('Please %sclick here%s to set a default location, this will help to set location of all dummy data.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>') . '</strong></p></div>'; |
|
275 | - } else { |
|
276 | - |
|
277 | - ?> |
|
259 | + /** |
|
260 | + * GeoDirectory dummy data installation. |
|
261 | + * |
|
262 | + * @since 1.0.0 |
|
263 | + * @package GeoDirectory |
|
264 | + * @global object $wpdb WordPress Database object. |
|
265 | + * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
266 | + * @param string $post_type The post type. |
|
267 | + */ |
|
268 | + function geodir_autoinstall_admin_header($post_type = 'gd_place') |
|
269 | + { |
|
270 | + |
|
271 | + global $wpdb, $plugin_prefix; |
|
272 | + |
|
273 | + if (!geodir_is_default_location_set()) { |
|
274 | + echo '<div class="updated fade"><p><strong>' . sprintf(__('Please %sclick here%s to set a default location, this will help to set location of all dummy data.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>') . '</strong></p></div>'; |
|
275 | + } else { |
|
276 | + |
|
277 | + ?> |
|
278 | 278 | <span class="gd-dummy-hint"><small><?php _e('*Hint*: Installing our Advanced Search addon FIRST will add extra search fields to non-default data types.','geodirectory');?></small></span> |
279 | 279 | <table class="form-table gd-dummy-table"> |
280 | 280 | <tbody> |
@@ -286,78 +286,78 @@ discard block |
||
286 | 286 | |
287 | 287 | <?php |
288 | 288 | |
289 | - $cpts = geodir_get_posttypes('array'); |
|
289 | + $cpts = geodir_get_posttypes('array'); |
|
290 | 290 | |
291 | - $data_types = geodir_dummy_data_types(); |
|
291 | + $data_types = geodir_dummy_data_types(); |
|
292 | 292 | |
293 | - $nonce = wp_create_nonce('geodir_dummy_posts_insert_noncename'); |
|
293 | + $nonce = wp_create_nonce('geodir_dummy_posts_insert_noncename'); |
|
294 | 294 | |
295 | - foreach($cpts as $post_type=>$cpt){ |
|
295 | + foreach($cpts as $post_type=>$cpt){ |
|
296 | 296 | |
297 | - $data_types_for = apply_filters('geodir_dummy_date_types_for',$data_types,$post_type); |
|
297 | + $data_types_for = apply_filters('geodir_dummy_date_types_for',$data_types,$post_type); |
|
298 | 298 | |
299 | 299 | |
300 | - $set_dt = get_option($post_type.'_dummy_data_type'); |
|
300 | + $set_dt = get_option($post_type.'_dummy_data_type'); |
|
301 | 301 | |
302 | - $count = 30; |
|
302 | + $count = 30; |
|
303 | 303 | |
304 | - geodir_add_column_if_not_exist($plugin_prefix . $post_type. "_detail", 'post_dummy', "enum( '1', '0' ) NULL DEFAULT '0'"); |
|
304 | + geodir_add_column_if_not_exist($plugin_prefix . $post_type. "_detail", 'post_dummy', "enum( '1', '0' ) NULL DEFAULT '0'"); |
|
305 | 305 | |
306 | - $post_counts = $wpdb->get_var("SELECT count(post_id) FROM " . $plugin_prefix . $post_type . "_detail WHERE post_dummy='1'"); |
|
306 | + $post_counts = $wpdb->get_var("SELECT count(post_id) FROM " . $plugin_prefix . $post_type . "_detail WHERE post_dummy='1'"); |
|
307 | 307 | |
308 | - echo "<tr>"; |
|
309 | - echo "<td><strong>".$cpt['labels']['name']."</strong></td>"; |
|
308 | + echo "<tr>"; |
|
309 | + echo "<td><strong>".$cpt['labels']['name']."</strong></td>"; |
|
310 | 310 | |
311 | 311 | |
312 | - $select_disabled = $post_counts > 0 ? 'disabled' : ''; |
|
313 | - echo "<td>"; |
|
314 | - echo "<select id='".$post_type."_data_type' onchange='geodir_dummy_set_count(this,\"$post_type\");' $select_disabled>"; |
|
312 | + $select_disabled = $post_counts > 0 ? 'disabled' : ''; |
|
313 | + echo "<td>"; |
|
314 | + echo "<select id='".$post_type."_data_type' onchange='geodir_dummy_set_count(this,\"$post_type\");' $select_disabled>"; |
|
315 | 315 | |
316 | - foreach($data_types_for as $key=>$val){ |
|
317 | - $selected = ($key==$set_dt) ? "selected='selected'" : ''; |
|
318 | - if($selected || count($data_types_for)==1){$count = $val['count'];} |
|
319 | - echo "<option $selected value='$key' data-count='".$val['count']."'>".$val['name']."</option>"; |
|
320 | - } |
|
321 | - echo "</select>"; |
|
322 | - |
|
323 | - $select_display = $post_counts > 0 ? 'display:none;' : ''; |
|
324 | - echo "<select id='".$post_type."_data_type_count' style='$select_display' >"; |
|
325 | - $x = 1; |
|
326 | - while($x <= $count){ |
|
327 | - $selected = ($x==$count) ? "selected='selected'" : ''; |
|
328 | - echo "<option $selected value='$x'>".$x."</option>"; |
|
329 | - $x++; |
|
330 | - } |
|
331 | - echo "</select>"; |
|
332 | - echo "</td>"; |
|
316 | + foreach($data_types_for as $key=>$val){ |
|
317 | + $selected = ($key==$set_dt) ? "selected='selected'" : ''; |
|
318 | + if($selected || count($data_types_for)==1){$count = $val['count'];} |
|
319 | + echo "<option $selected value='$key' data-count='".$val['count']."'>".$val['name']."</option>"; |
|
320 | + } |
|
321 | + echo "</select>"; |
|
333 | 322 | |
323 | + $select_display = $post_counts > 0 ? 'display:none;' : ''; |
|
324 | + echo "<select id='".$post_type."_data_type_count' style='$select_display' >"; |
|
325 | + $x = 1; |
|
326 | + while($x <= $count){ |
|
327 | + $selected = ($x==$count) ? "selected='selected'" : ''; |
|
328 | + echo "<option $selected value='$x'>".$x."</option>"; |
|
329 | + $x++; |
|
330 | + } |
|
331 | + echo "</select>"; |
|
332 | + echo "</td>"; |
|
334 | 333 | |
335 | 334 | |
336 | 335 | |
337 | 336 | |
338 | - if($post_counts > 0){ |
|
339 | - echo '<td><input type="button" value="'.__('Remove data','geodirectory').'" class="button-primary geodir_dummy_button gd-remove-data" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>'; |
|
340 | - }else{ |
|
341 | - echo '<td><input type="button" value="'.__('Insert data','geodirectory').'" class="button-primary geodir_dummy_button" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>'; |
|
342 | - } |
|
343 | 337 | |
344 | - echo "</tr>"; |
|
345 | - //print_r($cpt); |
|
346 | - } |
|
338 | + if($post_counts > 0){ |
|
339 | + echo '<td><input type="button" value="'.__('Remove data','geodirectory').'" class="button-primary geodir_dummy_button gd-remove-data" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>'; |
|
340 | + }else{ |
|
341 | + echo '<td><input type="button" value="'.__('Insert data','geodirectory').'" class="button-primary geodir_dummy_button" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>'; |
|
342 | + } |
|
343 | + |
|
344 | + echo "</tr>"; |
|
345 | + //print_r($cpt); |
|
346 | + } |
|
347 | 347 | |
348 | - ?> |
|
348 | + ?> |
|
349 | 349 | </tbody> |
350 | 350 | </table> |
351 | 351 | <?php |
352 | 352 | |
353 | 353 | |
354 | - $default_location = geodir_get_default_location(); |
|
355 | - $city = isset($default_location->city) ? $default_location->city : ''; |
|
356 | - $region = isset($default_location->region) ? $default_location->region : ''; |
|
357 | - $country = isset($default_location->country) ? $default_location->country : ''; |
|
358 | - $city_latitude = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
359 | - $city_longitude = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
360 | - ?> |
|
354 | + $default_location = geodir_get_default_location(); |
|
355 | + $city = isset($default_location->city) ? $default_location->city : ''; |
|
356 | + $region = isset($default_location->region) ? $default_location->region : ''; |
|
357 | + $country = isset($default_location->country) ? $default_location->country : ''; |
|
358 | + $city_latitude = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
359 | + $city_longitude = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
360 | + ?> |
|
361 | 361 | <script type="text/javascript"> |
362 | 362 | |
363 | 363 | function geodir_dummy_set_count(data,cpt){ |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | } |
534 | 534 | </script> |
535 | 535 | <?php |
536 | - } |
|
537 | - } |
|
536 | + } |
|
537 | + } |
|
538 | 538 | } |
539 | 539 |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * @global object $wpdb WordPress Database object. |
19 | 19 | * @global string $dummy_image_path The dummy image path. |
20 | 20 | */ |
21 | -function geodir_dummy_data_taxonomies($post_type,$category_array) { |
|
21 | +function geodir_dummy_data_taxonomies($post_type, $category_array) { |
|
22 | 22 | global $wpdb, $dummy_image_path; |
23 | 23 | |
24 | 24 | |
@@ -43,14 +43,14 @@ discard block |
||
43 | 43 | |
44 | 44 | |
45 | 45 | if (geodir_dummy_folder_exists()) |
46 | - $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon"; |
|
46 | + $dummy_image_url = geodir_plugin_url()."/geodirectory-admin/dummy/cat_icon"; |
|
47 | 47 | else |
48 | 48 | $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon'; |
49 | 49 | |
50 | 50 | $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url); |
51 | 51 | |
52 | 52 | $catname = str_replace(' ', '_', $catname); |
53 | - $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png"); |
|
53 | + $uploaded = (array) fetch_remote_file("$dummy_image_url/".$catname.".png"); |
|
54 | 54 | |
55 | 55 | if (empty($uploaded['error'])) { |
56 | 56 | $new_path = $uploaded['file']; |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $wp_filetype = wp_check_filetype(basename($new_path), null); |
61 | 61 | |
62 | 62 | $attachment = array( |
63 | - 'guid' => $uploads['baseurl'] . '/' . basename($new_path), |
|
63 | + 'guid' => $uploads['baseurl'].'/'.basename($new_path), |
|
64 | 64 | 'post_mime_type' => $wp_filetype['type'], |
65 | 65 | 'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)), |
66 | 66 | 'post_content' => '', |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | // you must first include the image.php file |
72 | 72 | // for the function wp_generate_attachment_metadata() to work |
73 | - require_once(ABSPATH . 'wp-admin/includes/image.php'); |
|
73 | + require_once(ABSPATH.'wp-admin/includes/image.php'); |
|
74 | 74 | $attach_data = wp_generate_attachment_metadata($attach_id, $new_path); |
75 | 75 | wp_update_attachment_metadata($attach_id, $attach_data); |
76 | 76 | |
@@ -87,14 +87,14 @@ discard block |
||
87 | 87 | $last_catid = wp_insert_term($catname, $post_type.'category'); |
88 | 88 | |
89 | 89 | if (geodir_dummy_folder_exists()) |
90 | - $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon"; |
|
90 | + $dummy_image_url = geodir_plugin_url()."/geodirectory-admin/dummy/cat_icon"; |
|
91 | 91 | else |
92 | 92 | $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon'; |
93 | 93 | |
94 | 94 | $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url); |
95 | 95 | |
96 | 96 | $catname = str_replace(' ', '_', $catname); |
97 | - $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png"); |
|
97 | + $uploaded = (array) fetch_remote_file("$dummy_image_url/".$catname.".png"); |
|
98 | 98 | |
99 | 99 | if (empty($uploaded['error'])) { |
100 | 100 | $new_path = $uploaded['file']; |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | $wp_filetype = wp_check_filetype(basename($new_path), null); |
105 | 105 | |
106 | 106 | $attachment = array( |
107 | - 'guid' => $uploads['baseurl'] . '/' . basename($new_path), |
|
107 | + 'guid' => $uploads['baseurl'].'/'.basename($new_path), |
|
108 | 108 | 'post_mime_type' => $wp_filetype['type'], |
109 | 109 | 'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)), |
110 | 110 | 'post_content' => '', |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | |
117 | 117 | // you must first include the image.php file |
118 | 118 | // for the function wp_generate_attachment_metadata() to work |
119 | - require_once(ABSPATH . 'wp-admin/includes/image.php'); |
|
119 | + require_once(ABSPATH.'wp-admin/includes/image.php'); |
|
120 | 120 | $attach_data = wp_generate_attachment_metadata($attach_id, $new_path); |
121 | 121 | wp_update_attachment_metadata($attach_id, $attach_data); |
122 | 122 | |
@@ -130,23 +130,23 @@ discard block |
||
130 | 130 | } |
131 | 131 | |
132 | 132 | |
133 | -function geodir_dummy_data_types(){ |
|
134 | - $data = array( |
|
133 | +function geodir_dummy_data_types() { |
|
134 | + $data = array( |
|
135 | 135 | 'standard_places' => array( |
136 | - 'name'=>__('Default','geodirectory'), |
|
136 | + 'name'=>__('Default', 'geodirectory'), |
|
137 | 137 | 'count'=> 30 |
138 | 138 | ), |
139 | 139 | 'property_sale' => array( |
140 | - 'name'=>__('Property for sale','geodirectory'), |
|
140 | + 'name'=>__('Property for sale', 'geodirectory'), |
|
141 | 141 | 'count'=> 10 |
142 | 142 | ), |
143 | 143 | 'property_rent' => array( |
144 | - 'name'=>__('Property for rent','geodirectory'), |
|
144 | + 'name'=>__('Property for rent', 'geodirectory'), |
|
145 | 145 | 'count'=> 10 |
146 | 146 | ) |
147 | 147 | ); |
148 | 148 | |
149 | - return apply_filters('geodir_dummy_data_types',$data ); |
|
149 | + return apply_filters('geodir_dummy_data_types', $data); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | |
@@ -174,12 +174,12 @@ discard block |
||
174 | 174 | * @global object $wpdb WordPress Database object. |
175 | 175 | * @global string $plugin_prefix Geodirectory plugin table prefix. |
176 | 176 | */ |
177 | -function geodir_delete_dummy_posts($post_type,$data_type) |
|
177 | +function geodir_delete_dummy_posts($post_type, $data_type) |
|
178 | 178 | { |
179 | 179 | global $wpdb, $plugin_prefix; |
180 | 180 | |
181 | 181 | |
182 | - $post_ids = $wpdb->get_results("SELECT post_id FROM " . $plugin_prefix . $post_type."_detail WHERE post_dummy='1'"); |
|
182 | + $post_ids = $wpdb->get_results("SELECT post_id FROM ".$plugin_prefix.$post_type."_detail WHERE post_dummy='1'"); |
|
183 | 183 | |
184 | 184 | |
185 | 185 | foreach ($post_ids as $post_ids_obj) { |
@@ -187,9 +187,9 @@ discard block |
||
187 | 187 | } |
188 | 188 | |
189 | 189 | //double check posts are deleted |
190 | - $wpdb->get_results("DELETE FROM " . $plugin_prefix . $post_type. "_detail WHERE post_dummy='1'"); |
|
190 | + $wpdb->get_results("DELETE FROM ".$plugin_prefix.$post_type."_detail WHERE post_dummy='1'"); |
|
191 | 191 | |
192 | - update_option($post_type.'_dummy_data_type',''); |
|
192 | + update_option($post_type.'_dummy_data_type', ''); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | /** |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | * @global object $wpdb WordPress Database object. |
201 | 201 | * @global object $current_user Current user object. |
202 | 202 | */ |
203 | -function geodir_insert_dummy_posts($post_type,$data_type,$item_index) |
|
203 | +function geodir_insert_dummy_posts($post_type, $data_type, $item_index) |
|
204 | 204 | { |
205 | 205 | |
206 | 206 | ini_set('max_execution_time', 999999); //300 seconds = 5 minutes |
@@ -209,45 +209,45 @@ discard block |
||
209 | 209 | $total_count = 0; |
210 | 210 | global $dummy_post_index; |
211 | 211 | $dummy_post_index = $item_index; |
212 | - foreach( $data_types as $key=>$val){ |
|
213 | - if($key==$data_type){ |
|
212 | + foreach ($data_types as $key=>$val) { |
|
213 | + if ($key == $data_type) { |
|
214 | 214 | $total_count = $val['count']; |
215 | - if($key=='standard_places'){ |
|
215 | + if ($key == 'standard_places') { |
|
216 | 216 | /** |
217 | 217 | * Contains dummy post content. |
218 | 218 | * |
219 | 219 | * @since 1.0.0 |
220 | 220 | * @package GeoDirectory |
221 | 221 | */ |
222 | - include_once( 'dummy-data/standard_places.php' ); |
|
223 | - }elseif($key=='property_sale'){ |
|
222 | + include_once('dummy-data/standard_places.php'); |
|
223 | + }elseif ($key == 'property_sale') { |
|
224 | 224 | /** |
225 | 225 | * Contains dummy property for sale post content. |
226 | 226 | * |
227 | 227 | * @since 1.6.11 |
228 | 228 | * @package GeoDirectory |
229 | 229 | */ |
230 | - include_once( 'dummy-data/property_sale.php' ); |
|
231 | - }elseif($key=='property_rent'){ |
|
230 | + include_once('dummy-data/property_sale.php'); |
|
231 | + }elseif ($key == 'property_rent') { |
|
232 | 232 | /** |
233 | 233 | * Contains dummy property for sale post content. |
234 | 234 | * |
235 | 235 | * @since 1.6.11 |
236 | 236 | * @package GeoDirectory |
237 | 237 | */ |
238 | - include_once( 'dummy-data/property_rent.php' ); |
|
238 | + include_once('dummy-data/property_rent.php'); |
|
239 | 239 | } |
240 | 240 | |
241 | 241 | } |
242 | 242 | |
243 | - do_action('geodir_insert_dummy_data_loop',$post_type,$data_type,$item_index); |
|
243 | + do_action('geodir_insert_dummy_data_loop', $post_type, $data_type, $item_index); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | |
247 | 247 | |
248 | 248 | // delete image cache on last entry |
249 | - if($total_count == $item_index){ |
|
250 | - delete_transient( 'cached_dummy_images' ); |
|
249 | + if ($total_count == $item_index) { |
|
250 | + delete_transient('cached_dummy_images'); |
|
251 | 251 | flush_rewrite_rules(); |
252 | 252 | } |
253 | 253 | |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | } |
256 | 256 | |
257 | 257 | |
258 | -if (!function_exists('geodir_autoinstall_admin_header') && (get_option('geodir_installed') || defined( 'GD_TESTING_MODE' ))) { |
|
258 | +if (!function_exists('geodir_autoinstall_admin_header') && (get_option('geodir_installed') || defined('GD_TESTING_MODE'))) { |
|
259 | 259 | /** |
260 | 260 | * GeoDirectory dummy data installation. |
261 | 261 | * |
@@ -271,17 +271,17 @@ discard block |
||
271 | 271 | global $wpdb, $plugin_prefix; |
272 | 272 | |
273 | 273 | if (!geodir_is_default_location_set()) { |
274 | - echo '<div class="updated fade"><p><strong>' . sprintf(__('Please %sclick here%s to set a default location, this will help to set location of all dummy data.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>') . '</strong></p></div>'; |
|
274 | + echo '<div class="updated fade"><p><strong>'.sprintf(__('Please %sclick here%s to set a default location, this will help to set location of all dummy data.', 'geodirectory'), '<a href=\''.admin_url('admin.php?page=geodirectory&tab=default_location_settings').'\'>', '</a>').'</strong></p></div>'; |
|
275 | 275 | } else { |
276 | 276 | |
277 | 277 | ?> |
278 | - <span class="gd-dummy-hint"><small><?php _e('*Hint*: Installing our Advanced Search addon FIRST will add extra search fields to non-default data types.','geodirectory');?></small></span> |
|
278 | + <span class="gd-dummy-hint"><small><?php _e('*Hint*: Installing our Advanced Search addon FIRST will add extra search fields to non-default data types.', 'geodirectory'); ?></small></span> |
|
279 | 279 | <table class="form-table gd-dummy-table"> |
280 | 280 | <tbody> |
281 | 281 | <tr> |
282 | - <td><strong><?php _e('CPT','geodirectory');?></strong></td> |
|
283 | - <td><strong><?php _e('Data Type','geodirectory');?></strong></td> |
|
284 | - <td><strong><?php _e('Action','geodirectory');?></strong></td> |
|
282 | + <td><strong><?php _e('CPT', 'geodirectory'); ?></strong></td> |
|
283 | + <td><strong><?php _e('Data Type', 'geodirectory'); ?></strong></td> |
|
284 | + <td><strong><?php _e('Action', 'geodirectory'); ?></strong></td> |
|
285 | 285 | </tr> |
286 | 286 | |
287 | 287 | <?php |
@@ -292,18 +292,18 @@ discard block |
||
292 | 292 | |
293 | 293 | $nonce = wp_create_nonce('geodir_dummy_posts_insert_noncename'); |
294 | 294 | |
295 | - foreach($cpts as $post_type=>$cpt){ |
|
295 | + foreach ($cpts as $post_type=>$cpt) { |
|
296 | 296 | |
297 | - $data_types_for = apply_filters('geodir_dummy_date_types_for',$data_types,$post_type); |
|
297 | + $data_types_for = apply_filters('geodir_dummy_date_types_for', $data_types, $post_type); |
|
298 | 298 | |
299 | 299 | |
300 | 300 | $set_dt = get_option($post_type.'_dummy_data_type'); |
301 | 301 | |
302 | 302 | $count = 30; |
303 | 303 | |
304 | - geodir_add_column_if_not_exist($plugin_prefix . $post_type. "_detail", 'post_dummy', "enum( '1', '0' ) NULL DEFAULT '0'"); |
|
304 | + geodir_add_column_if_not_exist($plugin_prefix.$post_type."_detail", 'post_dummy', "enum( '1', '0' ) NULL DEFAULT '0'"); |
|
305 | 305 | |
306 | - $post_counts = $wpdb->get_var("SELECT count(post_id) FROM " . $plugin_prefix . $post_type . "_detail WHERE post_dummy='1'"); |
|
306 | + $post_counts = $wpdb->get_var("SELECT count(post_id) FROM ".$plugin_prefix.$post_type."_detail WHERE post_dummy='1'"); |
|
307 | 307 | |
308 | 308 | echo "<tr>"; |
309 | 309 | echo "<td><strong>".$cpt['labels']['name']."</strong></td>"; |
@@ -313,9 +313,9 @@ discard block |
||
313 | 313 | echo "<td>"; |
314 | 314 | echo "<select id='".$post_type."_data_type' onchange='geodir_dummy_set_count(this,\"$post_type\");' $select_disabled>"; |
315 | 315 | |
316 | - foreach($data_types_for as $key=>$val){ |
|
317 | - $selected = ($key==$set_dt) ? "selected='selected'" : ''; |
|
318 | - if($selected || count($data_types_for)==1){$count = $val['count'];} |
|
316 | + foreach ($data_types_for as $key=>$val) { |
|
317 | + $selected = ($key == $set_dt) ? "selected='selected'" : ''; |
|
318 | + if ($selected || count($data_types_for) == 1) {$count = $val['count']; } |
|
319 | 319 | echo "<option $selected value='$key' data-count='".$val['count']."'>".$val['name']."</option>"; |
320 | 320 | } |
321 | 321 | echo "</select>"; |
@@ -323,8 +323,8 @@ discard block |
||
323 | 323 | $select_display = $post_counts > 0 ? 'display:none;' : ''; |
324 | 324 | echo "<select id='".$post_type."_data_type_count' style='$select_display' >"; |
325 | 325 | $x = 1; |
326 | - while($x <= $count){ |
|
327 | - $selected = ($x==$count) ? "selected='selected'" : ''; |
|
326 | + while ($x <= $count) { |
|
327 | + $selected = ($x == $count) ? "selected='selected'" : ''; |
|
328 | 328 | echo "<option $selected value='$x'>".$x."</option>"; |
329 | 329 | $x++; |
330 | 330 | } |
@@ -335,10 +335,10 @@ discard block |
||
335 | 335 | |
336 | 336 | |
337 | 337 | |
338 | - if($post_counts > 0){ |
|
339 | - echo '<td><input type="button" value="'.__('Remove data','geodirectory').'" class="button-primary geodir_dummy_button gd-remove-data" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>'; |
|
340 | - }else{ |
|
341 | - echo '<td><input type="button" value="'.__('Insert data','geodirectory').'" class="button-primary geodir_dummy_button" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>'; |
|
338 | + if ($post_counts > 0) { |
|
339 | + echo '<td><input type="button" value="'.__('Remove data', 'geodirectory').'" class="button-primary geodir_dummy_button gd-remove-data" onclick="gdInstallDummyData(this,\''.$nonce.'\',\''.$post_type.'\'); return false;" ></td>'; |
|
340 | + } else { |
|
341 | + echo '<td><input type="button" value="'.__('Insert data', 'geodirectory').'" class="button-primary geodir_dummy_button" onclick="gdInstallDummyData(this,\''.$nonce.'\',\''.$post_type.'\'); return false;" ></td>'; |
|
342 | 342 | } |
343 | 343 | |
344 | 344 | echo "</tr>"; |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | |
375 | 375 | } |
376 | 376 | |
377 | - var CITY_ADDRESS = '<?php echo addslashes( $city . ',' . $region . ',' . $country );?>'; |
|
377 | + var CITY_ADDRESS = '<?php echo addslashes($city.','.$region.','.$country); ?>'; |
|
378 | 378 | var bound_lat_lng; |
379 | 379 | var latlng = ['<?php echo $city_latitude; ?>', <?php echo $city_longitude; ?>]; |
380 | 380 | var lat = <?php echo $city_latitude; ?>; |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | return x.replace(" ", ''); |
408 | 408 | }); // remove spaces from lat/lon |
409 | 409 | } else { |
410 | - alert("<?php _e( 'Geocode was not successful for the following reason:', 'geodirectory' );?> " + status); |
|
410 | + alert("<?php _e('Geocode was not successful for the following reason:', 'geodirectory'); ?> " + status); |
|
411 | 411 | } |
412 | 412 | }); |
413 | 413 | } else if (window.gdMaps == 'osm') { |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | var dummy_post_index = 1; |
432 | 432 | |
433 | 433 | function gdRemoveDummyData(obj, nonce, posttype){ |
434 | - if (confirm('<?php _e('Are you sure you want to delete dummy data?' , 'geodirectory'); ?>')) { |
|
434 | + if (confirm('<?php _e('Are you sure you want to delete dummy data?', 'geodirectory'); ?>')) { |
|
435 | 435 | jQuery(obj).prop('disabled', true); |
436 | 436 | jQuery('.gd-dummy-data-results-' + posttype).remove(); |
437 | 437 | jQuery('<tr class="gd-dummy-data-results gd-dummy-data-results-' + posttype + '" >'+ |
@@ -446,14 +446,14 @@ discard block |
||
446 | 446 | |
447 | 447 | jQuery('.gd_progressbar_'+posttype).progressbar({value: 0}); |
448 | 448 | |
449 | - gd_progressbar('.gd_progressbar_container_'+posttype, 0, '<i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Removing data...', 'geodirlocation'));?>'); |
|
449 | + gd_progressbar('.gd_progressbar_container_'+posttype, 0, '<i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Removing data...', 'geodirlocation')); ?>'); |
|
450 | 450 | |
451 | 451 | |
452 | 452 | jQuery.post('<?php echo geodir_get_ajax_url(); ?>&geodir_autofill=geodir_dummy_delete&posttype=' + posttype + '&_wpnonce=' + nonce, |
453 | 453 | function (data) { |
454 | - gd_progressbar('.gd_progressbar_container_'+posttype, 100, '<i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirlocation'));?>'); |
|
454 | + gd_progressbar('.gd_progressbar_container_'+posttype, 100, '<i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirlocation')); ?>'); |
|
455 | 455 | jQuery(obj).removeClass('gd-remove-data'); |
456 | - jQuery(obj).val('<?php _e('Insert data','geodirectory');?>'); |
|
456 | + jQuery(obj).val('<?php _e('Insert data', 'geodirectory'); ?>'); |
|
457 | 457 | jQuery(obj).prop('disabled', false); |
458 | 458 | jQuery('#'+posttype+'_data_type_count').show(); |
459 | 459 | jQuery('#'+posttype+'_data_type').prop('disabled', false); |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | |
497 | 497 | jQuery('.gd_progressbar_'+posttype).progressbar({value: 0}); |
498 | 498 | |
499 | - gd_progressbar('.gd_progressbar_container_'+posttype, 0, '0% (0 / ' + dateTypeCount + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Creating categories and custom fields...', 'geodirlocation'));?>'); |
|
499 | + gd_progressbar('.gd_progressbar_container_'+posttype, 0, '0% (0 / ' + dateTypeCount + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Creating categories and custom fields...', 'geodirlocation')); ?>'); |
|
500 | 500 | } |
501 | 501 | |
502 | 502 | if (!(typeof bound_lat_lng == 'object' && bound_lat_lng.length == 4)) { |
@@ -516,15 +516,15 @@ discard block |
||
516 | 516 | percentage = percentage > 100 ? 100 : percentage; |
517 | 517 | |
518 | 518 | |
519 | - gd_progressbar('.gd_progressbar_container_'+posttype, percentage, percentage + '% ('+insertedCount+' / ' + dateTypeCount + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Inserting data...', 'geodirlocation'));?>'); |
|
519 | + gd_progressbar('.gd_progressbar_container_'+posttype, percentage, percentage + '% ('+insertedCount+' / ' + dateTypeCount + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Inserting data...', 'geodirlocation')); ?>'); |
|
520 | 520 | |
521 | 521 | gdInstallDummyData(obj, nonce, posttype,insertedCount); |
522 | 522 | } |
523 | 523 | else { |
524 | 524 | percentage = 100; |
525 | - gd_progressbar('.gd_progressbar_container_'+posttype, percentage, percentage + '% ('+insertedCount+' / ' + dateTypeCount + ') <i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirlocation'));?>'); |
|
525 | + gd_progressbar('.gd_progressbar_container_'+posttype, percentage, percentage + '% ('+insertedCount+' / ' + dateTypeCount + ') <i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirlocation')); ?>'); |
|
526 | 526 | jQuery(obj).addClass('gd-remove-data'); |
527 | - jQuery(obj).val('<?php _e('Remove data','geodirectory');?>'); |
|
527 | + jQuery(obj).val('<?php _e('Remove data', 'geodirectory'); ?>'); |
|
528 | 528 | jQuery(obj).prop('disabled', false); |
529 | 529 | |
530 | 530 | } |
@@ -223,6 +223,9 @@ |
||
223 | 223 | * @param filter - the property to filter on |
224 | 224 | * @param limit - the number of items to get |
225 | 225 | * @param realtime - if the realtime api should be used |
226 | + * @param string $metric |
|
227 | + * @param string $startDate |
|
228 | + * @param string $endDate |
|
226 | 229 | * @return the specific metrics in array form |
227 | 230 | **/ |
228 | 231 | function getMetrics($metric, $startDate, $endDate, $dimensions = false, $sort = false, $filter = false, $limit = false, $realtime = false) |
@@ -30,135 +30,135 @@ discard block |
||
30 | 30 | // Include the Google Service API |
31 | 31 | include_once('google-api-php-client/src/Google/autoload.php'); |
32 | 32 | |
33 | - $this->client = new Google_Client(); |
|
34 | - $this->client->setApprovalPrompt("force"); |
|
35 | - $this->client->setAccessType('offline'); |
|
36 | - $this->client->setClientId(GEODIR_GA_CLIENTID); |
|
37 | - $this->client->setClientSecret(GEODIR_GA_CLIENTSECRET); |
|
38 | - $this->client->setRedirectUri(GEODIR_GA_REDIRECT); |
|
33 | + $this->client = new Google_Client(); |
|
34 | + $this->client->setApprovalPrompt("force"); |
|
35 | + $this->client->setAccessType('offline'); |
|
36 | + $this->client->setClientId(GEODIR_GA_CLIENTID); |
|
37 | + $this->client->setClientSecret(GEODIR_GA_CLIENTSECRET); |
|
38 | + $this->client->setRedirectUri(GEODIR_GA_REDIRECT); |
|
39 | 39 | |
40 | - $this->client->setScopes(array("https://www.googleapis.com/auth/analytics")); |
|
41 | - |
|
42 | - try { |
|
43 | - $this->analytics = new Google_Service_Analytics($this->client); |
|
44 | - } |
|
45 | - catch (Google_ServiceException $e) |
|
46 | - { |
|
47 | - print '(cas:48) There was an Analytics API service error ' . $e->getCode() . ':' . $e->getMessage(); |
|
40 | + $this->client->setScopes(array("https://www.googleapis.com/auth/analytics")); |
|
41 | + |
|
42 | + try { |
|
43 | + $this->analytics = new Google_Service_Analytics($this->client); |
|
44 | + } |
|
45 | + catch (Google_ServiceException $e) |
|
46 | + { |
|
47 | + print '(cas:48) There was an Analytics API service error ' . $e->getCode() . ':' . $e->getMessage(); |
|
48 | 48 | return false; |
49 | - } |
|
49 | + } |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | function checkLogin() |
53 | 53 | { |
54 | - $ga_google_authtoken = get_option('geodir_ga_auth_token'); |
|
54 | + $ga_google_authtoken = get_option('geodir_ga_auth_token'); |
|
55 | 55 | |
56 | - if (!empty($ga_google_authtoken)) |
|
57 | - { |
|
56 | + if (!empty($ga_google_authtoken)) |
|
57 | + { |
|
58 | 58 | try |
59 | - { |
|
60 | - $this->client->setAccessToken($ga_google_authtoken); |
|
59 | + { |
|
60 | + $this->client->setAccessToken($ga_google_authtoken); |
|
61 | 61 | } |
62 | 62 | catch( Google_AuthException $e ) |
63 | - { |
|
64 | - print '(cas:72) GeoDirectory was unable to authenticate you with |
|
63 | + { |
|
64 | + print '(cas:72) GeoDirectory was unable to authenticate you with |
|
65 | 65 | Google using the Auth Token you pasted into the input box on the previous step. <br><br> |
66 | 66 | This could mean either you pasted the token wrong, or the time/date on your server is wrong, |
67 | 67 | or an SSL issue preventing Google from Authenticating. <br><br> |
68 | 68 | <br><br><strong>Tech Info </strong> ' . $e->getCode() . ':' . $e->getMessage(); |
69 | 69 | |
70 | - return false; |
|
71 | - } |
|
72 | - } |
|
73 | - else |
|
74 | - { |
|
75 | - $authCode = get_option('geodir_ga_auth_code'); |
|
76 | - |
|
77 | - if (empty($authCode)) return false; |
|
78 | - |
|
79 | - try |
|
80 | - { |
|
81 | - $accessToken = $this->client->authenticate($authCode); |
|
82 | - } |
|
83 | - catch( Exception $e ) |
|
84 | - { |
|
85 | - print '(cas:72) GeoDirectory was unable to authenticate you with |
|
70 | + return false; |
|
71 | + } |
|
72 | + } |
|
73 | + else |
|
74 | + { |
|
75 | + $authCode = get_option('geodir_ga_auth_code'); |
|
76 | + |
|
77 | + if (empty($authCode)) return false; |
|
78 | + |
|
79 | + try |
|
80 | + { |
|
81 | + $accessToken = $this->client->authenticate($authCode); |
|
82 | + } |
|
83 | + catch( Exception $e ) |
|
84 | + { |
|
85 | + print '(cas:72) GeoDirectory was unable to authenticate you with |
|
86 | 86 | Google using the Auth Token you pasted into the input box on the previous step. <br><br> |
87 | 87 | This could mean either you pasted the token wrong, or the time/date on your server is wrong, |
88 | 88 | or an SSL issue preventing Google from Authenticating. <br><br> |
89 | 89 | <br><br><strong>Tech Info </strong> ' . $e->getCode() . ':' . $e->getMessage(); |
90 | 90 | |
91 | - return false; |
|
92 | - } |
|
93 | - |
|
94 | - if($accessToken) |
|
95 | - { |
|
96 | - $this->client->setAccessToken($accessToken); |
|
97 | - update_option('geodir_ga_auth_token', $accessToken); |
|
98 | - } |
|
99 | - else |
|
100 | - { |
|
101 | - return false; |
|
102 | - } |
|
103 | - } |
|
104 | - |
|
105 | - $this->token = $this->client->getAccessToken(); |
|
106 | - return true; |
|
91 | + return false; |
|
92 | + } |
|
93 | + |
|
94 | + if($accessToken) |
|
95 | + { |
|
96 | + $this->client->setAccessToken($accessToken); |
|
97 | + update_option('geodir_ga_auth_token', $accessToken); |
|
98 | + } |
|
99 | + else |
|
100 | + { |
|
101 | + return false; |
|
102 | + } |
|
103 | + } |
|
104 | + |
|
105 | + $this->token = $this->client->getAccessToken(); |
|
106 | + return true; |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | function deauthorize() |
110 | 110 | { |
111 | - update_option('geodir_ga_auth_code', ''); |
|
112 | - update_option('geodir_ga_auth_token', ''); |
|
111 | + update_option('geodir_ga_auth_code', ''); |
|
112 | + update_option('geodir_ga_auth_token', ''); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | function getSingleProfile() |
116 | 116 | { |
117 | - $webproperty_id = get_option('geodir_ga_account_id'); |
|
118 | - list($pre, $account_id, $post) = explode('-',$webproperty_id); |
|
119 | - |
|
120 | - if (empty($webproperty_id)) return false; |
|
121 | - |
|
122 | - try { |
|
123 | - $profiles = $this->analytics->management_profiles->listManagementProfiles($account_id, $webproperty_id); |
|
124 | - } |
|
125 | - catch (Google_ServiceException $e) |
|
126 | - { |
|
127 | - print 'There was an Analytics API service error ' . $e->getCode() . ': ' . $e->getMessage(); |
|
128 | - return false; |
|
129 | - } |
|
130 | - |
|
131 | - $profile_id = $profiles->items[0]->id; |
|
132 | - if (empty($profile_id)) return false; |
|
133 | - |
|
134 | - $account_array = array(); |
|
135 | - array_push($account_array, array('id'=>$profile_id, 'ga:webPropertyId'=>$webproperty_id)); |
|
136 | - return $account_array; |
|
117 | + $webproperty_id = get_option('geodir_ga_account_id'); |
|
118 | + list($pre, $account_id, $post) = explode('-',$webproperty_id); |
|
119 | + |
|
120 | + if (empty($webproperty_id)) return false; |
|
121 | + |
|
122 | + try { |
|
123 | + $profiles = $this->analytics->management_profiles->listManagementProfiles($account_id, $webproperty_id); |
|
124 | + } |
|
125 | + catch (Google_ServiceException $e) |
|
126 | + { |
|
127 | + print 'There was an Analytics API service error ' . $e->getCode() . ': ' . $e->getMessage(); |
|
128 | + return false; |
|
129 | + } |
|
130 | + |
|
131 | + $profile_id = $profiles->items[0]->id; |
|
132 | + if (empty($profile_id)) return false; |
|
133 | + |
|
134 | + $account_array = array(); |
|
135 | + array_push($account_array, array('id'=>$profile_id, 'ga:webPropertyId'=>$webproperty_id)); |
|
136 | + return $account_array; |
|
137 | 137 | } |
138 | 138 | |
139 | - function getAllProfiles() |
|
140 | - { |
|
141 | - $profile_array = array(); |
|
139 | + function getAllProfiles() |
|
140 | + { |
|
141 | + $profile_array = array(); |
|
142 | 142 | |
143 | - try { |
|
144 | - $profiles = $this->analytics->management_webproperties->listManagementWebproperties('~all'); |
|
145 | - } |
|
146 | - catch (Google_ServiceException $e) |
|
147 | - { |
|
148 | - print 'There was an Analytics API service error ' . $e->getCode() . ': ' . $e->getMessage(); |
|
149 | - } |
|
150 | - |
|
151 | - |
|
152 | - if( !empty( $profiles->items ) ) |
|
153 | - { |
|
154 | - foreach( $profiles->items as $profile ) |
|
155 | - { |
|
156 | - $profile_array[ $profile->id ] = str_replace('http://','',$profile->name ); |
|
157 | - } |
|
158 | - } |
|
159 | - |
|
160 | - return $profile_array; |
|
161 | - } |
|
143 | + try { |
|
144 | + $profiles = $this->analytics->management_webproperties->listManagementWebproperties('~all'); |
|
145 | + } |
|
146 | + catch (Google_ServiceException $e) |
|
147 | + { |
|
148 | + print 'There was an Analytics API service error ' . $e->getCode() . ': ' . $e->getMessage(); |
|
149 | + } |
|
150 | + |
|
151 | + |
|
152 | + if( !empty( $profiles->items ) ) |
|
153 | + { |
|
154 | + foreach( $profiles->items as $profile ) |
|
155 | + { |
|
156 | + $profile_array[ $profile->id ] = str_replace('http://','',$profile->name ); |
|
157 | + } |
|
158 | + } |
|
159 | + |
|
160 | + return $profile_array; |
|
161 | + } |
|
162 | 162 | |
163 | 163 | function getAnalyticsAccounts() |
164 | 164 | { |
@@ -241,13 +241,13 @@ discard block |
||
241 | 241 | $params['max-results'] = $limit; |
242 | 242 | } |
243 | 243 | |
244 | - // Just incase, the ga: is still used in the account id, strip it out to prevent it breaking |
|
245 | - $filtered_id = str_replace( 'ga:', '', $this->accountId ); |
|
244 | + // Just incase, the ga: is still used in the account id, strip it out to prevent it breaking |
|
245 | + $filtered_id = str_replace( 'ga:', '', $this->accountId ); |
|
246 | 246 | |
247 | - if(!$filtered_id){ |
|
248 | - echo 'Error - Account ID is blank'; |
|
249 | - return false; |
|
250 | - } |
|
247 | + if(!$filtered_id){ |
|
248 | + echo 'Error - Account ID is blank'; |
|
249 | + return false; |
|
250 | + } |
|
251 | 251 | |
252 | 252 | if($realtime){ |
253 | 253 | return $analytics->data_realtime->get( |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | } |
45 | 45 | catch (Google_ServiceException $e) |
46 | 46 | { |
47 | - print '(cas:48) There was an Analytics API service error ' . $e->getCode() . ':' . $e->getMessage(); |
|
47 | + print '(cas:48) There was an Analytics API service error '.$e->getCode().':'.$e->getMessage(); |
|
48 | 48 | return false; |
49 | 49 | } |
50 | 50 | } |
@@ -59,13 +59,13 @@ discard block |
||
59 | 59 | { |
60 | 60 | $this->client->setAccessToken($ga_google_authtoken); |
61 | 61 | } |
62 | - catch( Google_AuthException $e ) |
|
62 | + catch (Google_AuthException $e) |
|
63 | 63 | { |
64 | 64 | print '(cas:72) GeoDirectory was unable to authenticate you with |
65 | 65 | Google using the Auth Token you pasted into the input box on the previous step. <br><br> |
66 | 66 | This could mean either you pasted the token wrong, or the time/date on your server is wrong, |
67 | 67 | or an SSL issue preventing Google from Authenticating. <br><br> |
68 | - <br><br><strong>Tech Info </strong> ' . $e->getCode() . ':' . $e->getMessage(); |
|
68 | + <br><br><strong>Tech Info </strong> ' . $e->getCode().':'.$e->getMessage(); |
|
69 | 69 | |
70 | 70 | return false; |
71 | 71 | } |
@@ -80,18 +80,18 @@ discard block |
||
80 | 80 | { |
81 | 81 | $accessToken = $this->client->authenticate($authCode); |
82 | 82 | } |
83 | - catch( Exception $e ) |
|
83 | + catch (Exception $e) |
|
84 | 84 | { |
85 | 85 | print '(cas:72) GeoDirectory was unable to authenticate you with |
86 | 86 | Google using the Auth Token you pasted into the input box on the previous step. <br><br> |
87 | 87 | This could mean either you pasted the token wrong, or the time/date on your server is wrong, |
88 | 88 | or an SSL issue preventing Google from Authenticating. <br><br> |
89 | - <br><br><strong>Tech Info </strong> ' . $e->getCode() . ':' . $e->getMessage(); |
|
89 | + <br><br><strong>Tech Info </strong> ' . $e->getCode().':'.$e->getMessage(); |
|
90 | 90 | |
91 | 91 | return false; |
92 | 92 | } |
93 | 93 | |
94 | - if($accessToken) |
|
94 | + if ($accessToken) |
|
95 | 95 | { |
96 | 96 | $this->client->setAccessToken($accessToken); |
97 | 97 | update_option('geodir_ga_auth_token', $accessToken); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | } |
103 | 103 | } |
104 | 104 | |
105 | - $this->token = $this->client->getAccessToken(); |
|
105 | + $this->token = $this->client->getAccessToken(); |
|
106 | 106 | return true; |
107 | 107 | } |
108 | 108 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | function getSingleProfile() |
116 | 116 | { |
117 | 117 | $webproperty_id = get_option('geodir_ga_account_id'); |
118 | - list($pre, $account_id, $post) = explode('-',$webproperty_id); |
|
118 | + list($pre, $account_id, $post) = explode('-', $webproperty_id); |
|
119 | 119 | |
120 | 120 | if (empty($webproperty_id)) return false; |
121 | 121 | |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | } |
125 | 125 | catch (Google_ServiceException $e) |
126 | 126 | { |
127 | - print 'There was an Analytics API service error ' . $e->getCode() . ': ' . $e->getMessage(); |
|
127 | + print 'There was an Analytics API service error '.$e->getCode().': '.$e->getMessage(); |
|
128 | 128 | return false; |
129 | 129 | } |
130 | 130 | |
@@ -145,15 +145,15 @@ discard block |
||
145 | 145 | } |
146 | 146 | catch (Google_ServiceException $e) |
147 | 147 | { |
148 | - print 'There was an Analytics API service error ' . $e->getCode() . ': ' . $e->getMessage(); |
|
148 | + print 'There was an Analytics API service error '.$e->getCode().': '.$e->getMessage(); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | |
152 | - if( !empty( $profiles->items ) ) |
|
152 | + if (!empty($profiles->items)) |
|
153 | 153 | { |
154 | - foreach( $profiles->items as $profile ) |
|
154 | + foreach ($profiles->items as $profile) |
|
155 | 155 | { |
156 | - $profile_array[ $profile->id ] = str_replace('http://','',$profile->name ); |
|
156 | + $profile_array[$profile->id] = str_replace('http://', '', $profile->name); |
|
157 | 157 | } |
158 | 158 | } |
159 | 159 | |
@@ -242,20 +242,20 @@ discard block |
||
242 | 242 | } |
243 | 243 | |
244 | 244 | // Just incase, the ga: is still used in the account id, strip it out to prevent it breaking |
245 | - $filtered_id = str_replace( 'ga:', '', $this->accountId ); |
|
245 | + $filtered_id = str_replace('ga:', '', $this->accountId); |
|
246 | 246 | |
247 | - if(!$filtered_id){ |
|
247 | + if (!$filtered_id) { |
|
248 | 248 | echo 'Error - Account ID is blank'; |
249 | 249 | return false; |
250 | 250 | } |
251 | 251 | |
252 | - if($realtime){ |
|
252 | + if ($realtime) { |
|
253 | 253 | return $analytics->data_realtime->get( |
254 | 254 | 'ga:'.$filtered_id, |
255 | 255 | $metric, |
256 | 256 | $params |
257 | 257 | ); |
258 | - }else{ |
|
258 | + } else { |
|
259 | 259 | return $analytics->data_ga->get( |
260 | 260 | 'ga:'.$filtered_id, |
261 | 261 | $startDate, |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | **/ |
280 | 280 | function verifyStartDate($date) |
281 | 281 | { |
282 | - if ( strtotime($date) > strtotime('2005-01-01') ) |
|
282 | + if (strtotime($date) > strtotime('2005-01-01')) |
|
283 | 283 | return $date; |
284 | 284 | else |
285 | 285 | return '2005-01-01'; |
@@ -41,8 +41,7 @@ discard block |
||
41 | 41 | |
42 | 42 | try { |
43 | 43 | $this->analytics = new Google_Service_Analytics($this->client); |
44 | - } |
|
45 | - catch (Google_ServiceException $e) |
|
44 | + } catch (Google_ServiceException $e) |
|
46 | 45 | { |
47 | 46 | print '(cas:48) There was an Analytics API service error ' . $e->getCode() . ':' . $e->getMessage(); |
48 | 47 | return false; |
@@ -58,8 +57,7 @@ discard block |
||
58 | 57 | try |
59 | 58 | { |
60 | 59 | $this->client->setAccessToken($ga_google_authtoken); |
61 | - } |
|
62 | - catch( Google_AuthException $e ) |
|
60 | + } catch( Google_AuthException $e ) |
|
63 | 61 | { |
64 | 62 | print '(cas:72) GeoDirectory was unable to authenticate you with |
65 | 63 | Google using the Auth Token you pasted into the input box on the previous step. <br><br> |
@@ -69,18 +67,18 @@ discard block |
||
69 | 67 | |
70 | 68 | return false; |
71 | 69 | } |
72 | - } |
|
73 | - else |
|
70 | + } else |
|
74 | 71 | { |
75 | 72 | $authCode = get_option('geodir_ga_auth_code'); |
76 | 73 | |
77 | - if (empty($authCode)) return false; |
|
74 | + if (empty($authCode)) { |
|
75 | + return false; |
|
76 | + } |
|
78 | 77 | |
79 | 78 | try |
80 | 79 | { |
81 | 80 | $accessToken = $this->client->authenticate($authCode); |
82 | - } |
|
83 | - catch( Exception $e ) |
|
81 | + } catch( Exception $e ) |
|
84 | 82 | { |
85 | 83 | print '(cas:72) GeoDirectory was unable to authenticate you with |
86 | 84 | Google using the Auth Token you pasted into the input box on the previous step. <br><br> |
@@ -95,8 +93,7 @@ discard block |
||
95 | 93 | { |
96 | 94 | $this->client->setAccessToken($accessToken); |
97 | 95 | update_option('geodir_ga_auth_token', $accessToken); |
98 | - } |
|
99 | - else |
|
96 | + } else |
|
100 | 97 | { |
101 | 98 | return false; |
102 | 99 | } |
@@ -117,19 +114,22 @@ discard block |
||
117 | 114 | $webproperty_id = get_option('geodir_ga_account_id'); |
118 | 115 | list($pre, $account_id, $post) = explode('-',$webproperty_id); |
119 | 116 | |
120 | - if (empty($webproperty_id)) return false; |
|
117 | + if (empty($webproperty_id)) { |
|
118 | + return false; |
|
119 | + } |
|
121 | 120 | |
122 | 121 | try { |
123 | 122 | $profiles = $this->analytics->management_profiles->listManagementProfiles($account_id, $webproperty_id); |
124 | - } |
|
125 | - catch (Google_ServiceException $e) |
|
123 | + } catch (Google_ServiceException $e) |
|
126 | 124 | { |
127 | 125 | print 'There was an Analytics API service error ' . $e->getCode() . ': ' . $e->getMessage(); |
128 | 126 | return false; |
129 | 127 | } |
130 | 128 | |
131 | 129 | $profile_id = $profiles->items[0]->id; |
132 | - if (empty($profile_id)) return false; |
|
130 | + if (empty($profile_id)) { |
|
131 | + return false; |
|
132 | + } |
|
133 | 133 | |
134 | 134 | $account_array = array(); |
135 | 135 | array_push($account_array, array('id'=>$profile_id, 'ga:webPropertyId'=>$webproperty_id)); |
@@ -142,8 +142,7 @@ discard block |
||
142 | 142 | |
143 | 143 | try { |
144 | 144 | $profiles = $this->analytics->management_webproperties->listManagementWebproperties('~all'); |
145 | - } |
|
146 | - catch (Google_ServiceException $e) |
|
145 | + } catch (Google_ServiceException $e) |
|
147 | 146 | { |
148 | 147 | print 'There was an Analytics API service error ' . $e->getCode() . ': ' . $e->getMessage(); |
149 | 148 | } |
@@ -255,7 +254,7 @@ discard block |
||
255 | 254 | $metric, |
256 | 255 | $params |
257 | 256 | ); |
258 | - }else{ |
|
257 | + } else{ |
|
259 | 258 | return $analytics->data_ga->get( |
260 | 259 | 'ga:'.$filtered_id, |
261 | 260 | $startDate, |
@@ -279,10 +278,11 @@ discard block |
||
279 | 278 | **/ |
280 | 279 | function verifyStartDate($date) |
281 | 280 | { |
282 | - if ( strtotime($date) > strtotime('2005-01-01') ) |
|
283 | - return $date; |
|
284 | - else |
|
285 | - return '2005-01-01'; |
|
281 | + if ( strtotime($date) > strtotime('2005-01-01') ) { |
|
282 | + return $date; |
|
283 | + } else { |
|
284 | + return '2005-01-01'; |
|
285 | + } |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | } // END class |
289 | 289 | \ No newline at end of file |