@@ -559,11 +559,11 @@ discard block |
||
559 | 559 | $post_number = !empty($args['post_number']) ? $args['post_number'] : 10; |
560 | 560 | $add_location_filter = !empty($args['add_location_filter']) ? true : false; |
561 | 561 | $list_sort = !empty($args['list_sort']) ? $args['list_sort'] : 'latest'; |
562 | - $character_count = isset($args['character_count']) ? $args['character_count'] : ''; |
|
563 | - $layout = !empty($args['layout']) ? $args['layout'] : 'gridview_onehalf'; |
|
564 | - $with_pagination = !empty($args['with_pagination']) ? true : false; |
|
565 | - $event_type = !empty($args['event_type']) ? $args['event_type'] : ''; |
|
566 | - $shortcode_content = !empty($args['shortcode_content']) ? trim($args['shortcode_content']) : ''; |
|
562 | + $character_count = isset($args['character_count']) ? $args['character_count'] : ''; |
|
563 | + $layout = !empty($args['layout']) ? $args['layout'] : 'gridview_onehalf'; |
|
564 | + $with_pagination = !empty($args['with_pagination']) ? true : false; |
|
565 | + $event_type = !empty($args['event_type']) ? $args['event_type'] : ''; |
|
566 | + $shortcode_content = !empty($args['shortcode_content']) ? trim($args['shortcode_content']) : ''; |
|
567 | 567 | /** |
568 | 568 | * Filter the content text displayed when no listings found. |
569 | 569 | * |
@@ -575,13 +575,13 @@ discard block |
||
575 | 575 | $shortcode_content = apply_filters('geodir_sc_gd_listings_not_found_content', $shortcode_content, $args); |
576 | 576 | |
577 | 577 | $top_pagination = $with_pagination && !empty($args['top_pagination']) ? true : false; |
578 | - $bottom_pagination = $with_pagination && !empty($args['bottom_pagination']) ? true : false; |
|
578 | + $bottom_pagination = $with_pagination && !empty($args['bottom_pagination']) ? true : false; |
|
579 | 579 | |
580 | 580 | $shortcode_atts = !empty($args['shortcode_atts']) ? $args['shortcode_atts'] : array(); |
581 | 581 | |
582 | 582 | // ajax mode |
583 | - $geodir_ajax = !empty($args['geodir_ajax']) ? true : false; |
|
584 | - $pageno = $geodir_ajax && !empty($args['pageno']) ? $args['pageno'] : 1; |
|
583 | + $geodir_ajax = !empty($args['geodir_ajax']) ? true : false; |
|
584 | + $pageno = $geodir_ajax && !empty($args['pageno']) ? $args['pageno'] : 1; |
|
585 | 585 | |
586 | 586 | $query_args = array( |
587 | 587 | 'posts_per_page' => $post_number, |
@@ -740,7 +740,7 @@ discard block |
||
740 | 740 | if(!pid > 0 || !(container && typeof container != 'undefined')) { |
741 | 741 | return false; |
742 | 742 | } |
743 | - var scatts = "<?php echo addslashes(json_encode($shortcode_atts));?>"; |
|
743 | + var scatts = "<?php echo addslashes(json_encode($shortcode_atts)); ?>"; |
|
744 | 744 | |
745 | 745 | var data = { |
746 | 746 | 'action': 'geodir_sclistings', |
@@ -820,7 +820,7 @@ discard block |
||
820 | 820 | if ($max_page > 1 || $always_show) { |
821 | 821 | // Extra pagination info |
822 | 822 | $geodir_pagination_more_info = get_option('geodir_pagination_advance_info'); |
823 | - $start_no = ( $pageno - 1 ) * $posts_per_page + 1; |
|
823 | + $start_no = ($pageno - 1) * $posts_per_page + 1; |
|
824 | 824 | $end_no = min($pageno * $posts_per_page, $numposts); |
825 | 825 | |
826 | 826 | if ($geodir_pagination_more_info != '') { |
@@ -839,7 +839,7 @@ discard block |
||
839 | 839 | } |
840 | 840 | |
841 | 841 | if (($pageno - 1) > 0) { |
842 | - echo '<a class="gd-page-sc-prev" href="javascript:void(0);" onclick="gd_sc_gopage(this, ' . (int)($pageno - 1) . ');">' . $prelabel . '</a> '; |
|
842 | + echo '<a class="gd-page-sc-prev" href="javascript:void(0);" onclick="gd_sc_gopage(this, ' . (int) ($pageno - 1) . ');">' . $prelabel . '</a> '; |
|
843 | 843 | } |
844 | 844 | |
845 | 845 | for ($i = $pageno - $half_pages_to_show; $i <= $pageno + $half_pages_to_show; $i++) { |
@@ -847,17 +847,17 @@ discard block |
||
847 | 847 | if ($i == $pageno) { |
848 | 848 | echo "<strong class='on' class='gd-page-sc-act'>$i</strong>"; |
849 | 849 | } else { |
850 | - echo ' <a class="gd-page-sc-no" href="javascript:void(0);" onclick="gd_sc_gopage(this, ' . (int)$i . ');">' . $i . '</a> '; |
|
850 | + echo ' <a class="gd-page-sc-no" href="javascript:void(0);" onclick="gd_sc_gopage(this, ' . (int) $i . ');">' . $i . '</a> '; |
|
851 | 851 | } |
852 | 852 | } |
853 | 853 | } |
854 | 854 | |
855 | 855 | if (($pageno + 1) <= $max_page) { |
856 | - echo ' <a class="gd-page-sc-nxt" href="javascript:void(0);" onclick="gd_sc_gopage(this, ' . (int)($pageno + 1) . ');">' . $nxtlabel . '</a>'; |
|
856 | + echo ' <a class="gd-page-sc-nxt" href="javascript:void(0);" onclick="gd_sc_gopage(this, ' . (int) ($pageno + 1) . ');">' . $nxtlabel . '</a>'; |
|
857 | 857 | } |
858 | 858 | |
859 | 859 | if ($pageno < $max_page) { |
860 | - echo ' <a class="gd-page-sc-lst" href="javascript:void(0);" onclick="gd_sc_gopage(this, ' . (int)$max_page . ');">»</a>'; |
|
860 | + echo ' <a class="gd-page-sc-lst" href="javascript:void(0);" onclick="gd_sc_gopage(this, ' . (int) $max_page . ');">»</a>'; |
|
861 | 861 | } |
862 | 862 | echo "</div> $after"; |
863 | 863 | } |
@@ -880,7 +880,7 @@ discard block |
||
880 | 880 | $scatts = isset($_POST['scatts']) ? $_POST['scatts'] : NULL; |
881 | 881 | $pageno = isset($_POST['pageno']) ? absint($_POST['pageno']) : 1; |
882 | 882 | |
883 | - $shortcode_atts = !empty($scatts) ? (array)json_decode(stripslashes_deep($scatts)) : NULL; |
|
883 | + $shortcode_atts = !empty($scatts) ? (array) json_decode(stripslashes_deep($scatts)) : NULL; |
|
884 | 884 | |
885 | 885 | if (!empty($shortcode_atts) && is_array($shortcode_atts)) { |
886 | 886 | $shortcode_atts['pageno'] = $pageno; |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | |
10 | 10 | // If this file is called directly, abort. |
11 | 11 | if (!defined('WPINC')) { |
12 | - die; |
|
12 | + die; |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | /** |
@@ -22,22 +22,22 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function gdsc_validate_measurements($value) |
24 | 24 | { |
25 | - if ((strlen($value) - 1) == strpos(trim($value), '%')) { |
|
26 | - // $value is entered as a percent, so it can't be less than 0 or more than 100 |
|
27 | - $value = preg_replace('/\D/', '', $value); |
|
28 | - if (100 < $value) { |
|
29 | - $value = 100; |
|
30 | - } |
|
31 | - // Re-add the percent symbol |
|
32 | - $value = $value . '%'; |
|
33 | - } elseif ((strlen($value) - 2) == strpos(trim($value), 'px')) { |
|
34 | - // Get the absint & re-add the 'px' |
|
35 | - $value = preg_replace('/\D/', '', $value) . 'px'; |
|
36 | - } else { |
|
37 | - $value = preg_replace('/\D/', '', $value); |
|
38 | - } |
|
39 | - |
|
40 | - return $value; |
|
25 | + if ((strlen($value) - 1) == strpos(trim($value), '%')) { |
|
26 | + // $value is entered as a percent, so it can't be less than 0 or more than 100 |
|
27 | + $value = preg_replace('/\D/', '', $value); |
|
28 | + if (100 < $value) { |
|
29 | + $value = 100; |
|
30 | + } |
|
31 | + // Re-add the percent symbol |
|
32 | + $value = $value . '%'; |
|
33 | + } elseif ((strlen($value) - 2) == strpos(trim($value), 'px')) { |
|
34 | + // Get the absint & re-add the 'px' |
|
35 | + $value = preg_replace('/\D/', '', $value) . 'px'; |
|
36 | + } else { |
|
37 | + $value = preg_replace('/\D/', '', $value); |
|
38 | + } |
|
39 | + |
|
40 | + return $value; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -52,35 +52,35 @@ discard block |
||
52 | 52 | function gdsc_validate_map_args($params) |
53 | 53 | { |
54 | 54 | |
55 | - $params['width'] = gdsc_validate_measurements($params['width']); |
|
56 | - $params['height'] = gdsc_validate_measurements($params['height']); |
|
55 | + $params['width'] = gdsc_validate_measurements($params['width']); |
|
56 | + $params['height'] = gdsc_validate_measurements($params['height']); |
|
57 | 57 | |
58 | - // Only accept our 4 maptypes. Otherwise, revert to the default. |
|
59 | - if (!(in_array(geodir_strtoupper($params['maptype']), array('HYBRID', 'SATELLITE', 'ROADMAP', 'TERRAIN')))) { |
|
60 | - $params['maptype'] = 'ROADMAP'; |
|
61 | - } else { |
|
62 | - $params['maptype'] = geodir_strtoupper($params['maptype']); |
|
63 | - } |
|
58 | + // Only accept our 4 maptypes. Otherwise, revert to the default. |
|
59 | + if (!(in_array(geodir_strtoupper($params['maptype']), array('HYBRID', 'SATELLITE', 'ROADMAP', 'TERRAIN')))) { |
|
60 | + $params['maptype'] = 'ROADMAP'; |
|
61 | + } else { |
|
62 | + $params['maptype'] = geodir_strtoupper($params['maptype']); |
|
63 | + } |
|
64 | 64 | |
65 | - // Zoom accepts a value between 1 and 19 |
|
66 | - $params['zoom'] = absint($params['zoom']); |
|
67 | - if (19 < $params['zoom']) { |
|
68 | - $params['zoom'] = '19'; |
|
69 | - } |
|
70 | - if (0 == $params['zoom']) { |
|
71 | - $params['zoom'] = '1'; |
|
72 | - } |
|
65 | + // Zoom accepts a value between 1 and 19 |
|
66 | + $params['zoom'] = absint($params['zoom']); |
|
67 | + if (19 < $params['zoom']) { |
|
68 | + $params['zoom'] = '19'; |
|
69 | + } |
|
70 | + if (0 == $params['zoom']) { |
|
71 | + $params['zoom'] = '1'; |
|
72 | + } |
|
73 | 73 | |
74 | - // Child_collapse must be boolean |
|
75 | - $params['child_collapse'] = gdsc_to_bool_val($params['child_collapse']); |
|
74 | + // Child_collapse must be boolean |
|
75 | + $params['child_collapse'] = gdsc_to_bool_val($params['child_collapse']); |
|
76 | 76 | |
77 | - // Scrollwheel must be boolean |
|
78 | - $params['scrollwheel'] = gdsc_to_bool_val($params['scrollwheel']); |
|
77 | + // Scrollwheel must be boolean |
|
78 | + $params['scrollwheel'] = gdsc_to_bool_val($params['scrollwheel']); |
|
79 | 79 | |
80 | - // Scrollwheel must be boolean |
|
81 | - $params['autozoom'] = gdsc_to_bool_val($params['autozoom']); |
|
80 | + // Scrollwheel must be boolean |
|
81 | + $params['autozoom'] = gdsc_to_bool_val($params['autozoom']); |
|
82 | 82 | |
83 | - return $params; |
|
83 | + return $params; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -99,52 +99,52 @@ discard block |
||
99 | 99 | */ |
100 | 100 | function gdsc_to_bool_val($in, $strict = false) |
101 | 101 | { |
102 | - $out = null; |
|
103 | - |
|
104 | - // if not strict, we only have to check if something is false |
|
105 | - if (in_array($in, array( |
|
106 | - 'false', |
|
107 | - 'False', |
|
108 | - 'FALSE', |
|
109 | - 'no', |
|
110 | - 'No', |
|
111 | - 'n', |
|
112 | - 'N', |
|
113 | - '0', |
|
114 | - 'off', |
|
115 | - 'Off', |
|
116 | - 'OFF', |
|
117 | - false, |
|
118 | - 0, |
|
119 | - null |
|
120 | - ), true)) { |
|
121 | - $out = false; |
|
122 | - } else if ($strict) { |
|
123 | - // if strict, check the equivalent true values |
|
124 | - if (in_array($in, array( |
|
125 | - 'true', |
|
126 | - 'True', |
|
127 | - 'TRUE', |
|
128 | - 'yes', |
|
129 | - 'Yes', |
|
130 | - 'y', |
|
131 | - 'Y', |
|
132 | - '1', |
|
133 | - 'on', |
|
134 | - 'On', |
|
135 | - 'ON', |
|
136 | - true, |
|
137 | - 1 |
|
138 | - ), true)) { |
|
139 | - $out = true; |
|
140 | - } |
|
141 | - } else { |
|
142 | - // not strict? let the regular php bool check figure it out (will |
|
143 | - // largely default to true) |
|
144 | - $out = ($in ? true : false); |
|
145 | - } |
|
146 | - |
|
147 | - return $out; |
|
102 | + $out = null; |
|
103 | + |
|
104 | + // if not strict, we only have to check if something is false |
|
105 | + if (in_array($in, array( |
|
106 | + 'false', |
|
107 | + 'False', |
|
108 | + 'FALSE', |
|
109 | + 'no', |
|
110 | + 'No', |
|
111 | + 'n', |
|
112 | + 'N', |
|
113 | + '0', |
|
114 | + 'off', |
|
115 | + 'Off', |
|
116 | + 'OFF', |
|
117 | + false, |
|
118 | + 0, |
|
119 | + null |
|
120 | + ), true)) { |
|
121 | + $out = false; |
|
122 | + } else if ($strict) { |
|
123 | + // if strict, check the equivalent true values |
|
124 | + if (in_array($in, array( |
|
125 | + 'true', |
|
126 | + 'True', |
|
127 | + 'TRUE', |
|
128 | + 'yes', |
|
129 | + 'Yes', |
|
130 | + 'y', |
|
131 | + 'Y', |
|
132 | + '1', |
|
133 | + 'on', |
|
134 | + 'On', |
|
135 | + 'ON', |
|
136 | + true, |
|
137 | + 1 |
|
138 | + ), true)) { |
|
139 | + $out = true; |
|
140 | + } |
|
141 | + } else { |
|
142 | + // not strict? let the regular php bool check figure it out (will |
|
143 | + // largely default to true) |
|
144 | + $out = ($in ? true : false); |
|
145 | + } |
|
146 | + |
|
147 | + return $out; |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
@@ -157,16 +157,16 @@ discard block |
||
157 | 157 | */ |
158 | 158 | function gdsc_is_post_type_valid($incoming_post_type) |
159 | 159 | { |
160 | - $post_types = geodir_get_posttypes(); |
|
161 | - $post_types = array_map('geodir_strtolower', $post_types); |
|
162 | - $post_type_found = false; |
|
163 | - foreach ($post_types as $type) { |
|
164 | - if (geodir_strtolower($incoming_post_type) == geodir_strtolower($type)) { |
|
165 | - $post_type_found = true; |
|
166 | - } |
|
167 | - } |
|
168 | - |
|
169 | - return $post_type_found; |
|
160 | + $post_types = geodir_get_posttypes(); |
|
161 | + $post_types = array_map('geodir_strtolower', $post_types); |
|
162 | + $post_type_found = false; |
|
163 | + foreach ($post_types as $type) { |
|
164 | + if (geodir_strtolower($incoming_post_type) == geodir_strtolower($type)) { |
|
165 | + $post_type_found = true; |
|
166 | + } |
|
167 | + } |
|
168 | + |
|
169 | + return $post_type_found; |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | /** |
@@ -186,52 +186,52 @@ discard block |
||
186 | 186 | */ |
187 | 187 | function gdsc_listing_loop_filter($query) |
188 | 188 | { |
189 | - global $wp_query, $geodir_post_type, $table, $plugin_prefix, $term; |
|
190 | - |
|
191 | - $geodir_post_type = geodir_get_current_posttype(); |
|
192 | - |
|
193 | - if (isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries) { |
|
194 | - $taxonomies = wp_list_pluck($wp_query->tax_query->queries, 'taxonomy'); |
|
195 | - |
|
196 | - if (isset($wp_query->query[$taxonomies[0]])) { |
|
197 | - $request_term = explode("/", $wp_query->query[$taxonomies[0]]); |
|
198 | - $request_term = end($request_term); |
|
199 | - if (!term_exists($request_term)) { |
|
200 | - $args = array('number' => '1',); |
|
201 | - $terms_arr = get_terms($taxonomies[0], $args); |
|
202 | - foreach ($terms_arr as $location_term) { |
|
203 | - $term_arr = $location_term; |
|
204 | - $term_arr->name = geodir_ucwords(str_replace('-', ' ', $request_term)); |
|
205 | - } |
|
206 | - $wp_query->queried_object_id = 1; |
|
207 | - $wp_query->queried_object = $term_arr; |
|
208 | - } |
|
209 | - } |
|
189 | + global $wp_query, $geodir_post_type, $table, $plugin_prefix, $term; |
|
190 | + |
|
191 | + $geodir_post_type = geodir_get_current_posttype(); |
|
192 | + |
|
193 | + if (isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries) { |
|
194 | + $taxonomies = wp_list_pluck($wp_query->tax_query->queries, 'taxonomy'); |
|
195 | + |
|
196 | + if (isset($wp_query->query[$taxonomies[0]])) { |
|
197 | + $request_term = explode("/", $wp_query->query[$taxonomies[0]]); |
|
198 | + $request_term = end($request_term); |
|
199 | + if (!term_exists($request_term)) { |
|
200 | + $args = array('number' => '1',); |
|
201 | + $terms_arr = get_terms($taxonomies[0], $args); |
|
202 | + foreach ($terms_arr as $location_term) { |
|
203 | + $term_arr = $location_term; |
|
204 | + $term_arr->name = geodir_ucwords(str_replace('-', ' ', $request_term)); |
|
205 | + } |
|
206 | + $wp_query->queried_object_id = 1; |
|
207 | + $wp_query->queried_object = $term_arr; |
|
208 | + } |
|
209 | + } |
|
210 | 210 | |
211 | - } |
|
212 | - if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) { |
|
211 | + } |
|
212 | + if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) { |
|
213 | 213 | |
214 | - $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
214 | + $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
215 | 215 | |
216 | - add_filter('posts_fields', 'geodir_posts_fields', 1); |
|
217 | - add_filter('posts_join', 'geodir_posts_join', 1); |
|
218 | - geodir_post_where(); |
|
219 | - if (!is_admin()) { |
|
220 | - add_filter('posts_orderby', 'geodir_posts_orderby', 1); |
|
221 | - } |
|
216 | + add_filter('posts_fields', 'geodir_posts_fields', 1); |
|
217 | + add_filter('posts_join', 'geodir_posts_join', 1); |
|
218 | + geodir_post_where(); |
|
219 | + if (!is_admin()) { |
|
220 | + add_filter('posts_orderby', 'geodir_posts_orderby', 1); |
|
221 | + } |
|
222 | 222 | |
223 | - // advanced filter for popular post view widget |
|
224 | - global $wp_query; |
|
225 | - if (!is_admin()) { |
|
226 | - if (!empty($wp_query->query['with_pics_only'])) { |
|
227 | - add_filter('posts_join', 'geodir_filter_widget_join', 1000); |
|
228 | - } |
|
229 | - add_filter('posts_where', 'geodir_filter_widget_where', 1000); |
|
230 | - } |
|
223 | + // advanced filter for popular post view widget |
|
224 | + global $wp_query; |
|
225 | + if (!is_admin()) { |
|
226 | + if (!empty($wp_query->query['with_pics_only'])) { |
|
227 | + add_filter('posts_join', 'geodir_filter_widget_join', 1000); |
|
228 | + } |
|
229 | + add_filter('posts_where', 'geodir_filter_widget_where', 1000); |
|
230 | + } |
|
231 | 231 | |
232 | - } |
|
232 | + } |
|
233 | 233 | |
234 | - return $query; |
|
234 | + return $query; |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | /** |
@@ -245,40 +245,40 @@ discard block |
||
245 | 245 | */ |
246 | 246 | function gdsc_manage_category_choice($post_type, $category) |
247 | 247 | { |
248 | - if (0 == $category || '' == $category) { |
|
249 | - return ''; |
|
250 | - } |
|
248 | + if (0 == $category || '' == $category) { |
|
249 | + return ''; |
|
250 | + } |
|
251 | 251 | |
252 | - if (!(gdsc_is_post_type_valid($post_type))) { |
|
253 | - return ''; |
|
254 | - } |
|
252 | + if (!(gdsc_is_post_type_valid($post_type))) { |
|
253 | + return ''; |
|
254 | + } |
|
255 | 255 | |
256 | - $taxonomies = geodir_get_taxonomies($post_type); |
|
256 | + $taxonomies = geodir_get_taxonomies($post_type); |
|
257 | 257 | |
258 | - $categories = get_terms(array('taxonomy' => $taxonomies[0])); |
|
258 | + $categories = get_terms(array('taxonomy' => $taxonomies[0])); |
|
259 | 259 | |
260 | - $cat_id = 0; |
|
260 | + $cat_id = 0; |
|
261 | 261 | |
262 | - foreach ($categories as $cat) { |
|
263 | - if (is_numeric($category)) { |
|
264 | - if (absint($category) == $cat->term_id) { |
|
265 | - $cat_id = $cat->term_id; |
|
266 | - break; |
|
267 | - } |
|
268 | - } else { |
|
269 | - if ($category == $cat->slug) { |
|
270 | - $cat_id = $cat->term_id; |
|
271 | - break; |
|
272 | - } |
|
262 | + foreach ($categories as $cat) { |
|
263 | + if (is_numeric($category)) { |
|
264 | + if (absint($category) == $cat->term_id) { |
|
265 | + $cat_id = $cat->term_id; |
|
266 | + break; |
|
267 | + } |
|
268 | + } else { |
|
269 | + if ($category == $cat->slug) { |
|
270 | + $cat_id = $cat->term_id; |
|
271 | + break; |
|
272 | + } |
|
273 | 273 | |
274 | - if ($category == $cat->name) { |
|
275 | - $cat_id = $cat->term_id; |
|
276 | - break; |
|
277 | - } |
|
278 | - } |
|
279 | - } |
|
274 | + if ($category == $cat->name) { |
|
275 | + $cat_id = $cat->term_id; |
|
276 | + break; |
|
277 | + } |
|
278 | + } |
|
279 | + } |
|
280 | 280 | |
281 | - return $cat_id; |
|
281 | + return $cat_id; |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | // @todo: Extract this |
@@ -288,11 +288,11 @@ discard block |
||
288 | 288 | * Adds the script in the page footer for the home page google map. |
289 | 289 | * |
290 | 290 | * @since 1.0.0 |
291 | - * @return string Print the script in page footer. |
|
291 | + * @return string Print the script in page footer. |
|
292 | 292 | */ |
293 | 293 | function geodir_home_map_add_script() |
294 | - { |
|
295 | - ?> |
|
294 | + { |
|
295 | + ?> |
|
296 | 296 | <script type="text/javascript"> |
297 | 297 | jQuery(document).ready(function () { |
298 | 298 | geoDirMapSlide(); |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | } |
366 | 366 | </script> |
367 | 367 | <?php |
368 | - } |
|
368 | + } |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | /** |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | */ |
377 | 377 | function geodir_popular_category_add_scripts() |
378 | 378 | { |
379 | - ?> |
|
379 | + ?> |
|
380 | 380 | <script type="text/javascript"> |
381 | 381 | jQuery(function ($) { |
382 | 382 | $('.geodir-showcat').click(function () { |
@@ -406,56 +406,56 @@ discard block |
||
406 | 406 | */ |
407 | 407 | function gdsc_validate_layout_choice($layout_choice) |
408 | 408 | { |
409 | - switch (geodir_strtolower($layout_choice)) { |
|
410 | - case 'list'; |
|
411 | - case 'one'; |
|
412 | - case 'one_column'; |
|
413 | - case 'onecolumn'; |
|
414 | - case '1'; |
|
415 | - $layout_choice = 'list'; |
|
416 | - break; |
|
417 | - case 'gridview_onehalf'; |
|
418 | - case 'two'; |
|
419 | - case 'two_column'; |
|
420 | - case 'two_columns'; |
|
421 | - case 'twocolumn'; |
|
422 | - case 'twocolumns'; |
|
423 | - case '2'; |
|
424 | - $layout_choice = 'gridview_onehalf'; |
|
425 | - break; |
|
426 | - case 'gridview_onethird'; |
|
427 | - case 'three'; |
|
428 | - case 'three_column'; |
|
429 | - case 'three_columns'; |
|
430 | - case 'threecolumn'; |
|
431 | - case 'threecolumns'; |
|
432 | - case '3'; |
|
433 | - $layout_choice = 'gridview_onethird'; |
|
434 | - break; |
|
435 | - case 'gridview_onefourth'; |
|
436 | - case 'four'; |
|
437 | - case 'four_column'; |
|
438 | - case 'four_columns'; |
|
439 | - case 'fourcolumn'; |
|
440 | - case 'fourcolumns'; |
|
441 | - case '4'; |
|
442 | - $layout_choice = 'gridview_onefourth'; |
|
443 | - break; |
|
444 | - case 'gridview_onefifth'; |
|
445 | - case 'five'; |
|
446 | - case 'five_column'; |
|
447 | - case 'five_columns'; |
|
448 | - case 'fivecolumn'; |
|
449 | - case 'fivecolumns'; |
|
450 | - case '5'; |
|
451 | - $layout_choice = 'gridview_onefifth'; |
|
452 | - break; |
|
453 | - default: |
|
454 | - $layout_choice = 'gridview_onehalf'; |
|
455 | - break; |
|
456 | - } |
|
457 | - |
|
458 | - return $layout_choice; |
|
409 | + switch (geodir_strtolower($layout_choice)) { |
|
410 | + case 'list'; |
|
411 | + case 'one'; |
|
412 | + case 'one_column'; |
|
413 | + case 'onecolumn'; |
|
414 | + case '1'; |
|
415 | + $layout_choice = 'list'; |
|
416 | + break; |
|
417 | + case 'gridview_onehalf'; |
|
418 | + case 'two'; |
|
419 | + case 'two_column'; |
|
420 | + case 'two_columns'; |
|
421 | + case 'twocolumn'; |
|
422 | + case 'twocolumns'; |
|
423 | + case '2'; |
|
424 | + $layout_choice = 'gridview_onehalf'; |
|
425 | + break; |
|
426 | + case 'gridview_onethird'; |
|
427 | + case 'three'; |
|
428 | + case 'three_column'; |
|
429 | + case 'three_columns'; |
|
430 | + case 'threecolumn'; |
|
431 | + case 'threecolumns'; |
|
432 | + case '3'; |
|
433 | + $layout_choice = 'gridview_onethird'; |
|
434 | + break; |
|
435 | + case 'gridview_onefourth'; |
|
436 | + case 'four'; |
|
437 | + case 'four_column'; |
|
438 | + case 'four_columns'; |
|
439 | + case 'fourcolumn'; |
|
440 | + case 'fourcolumns'; |
|
441 | + case '4'; |
|
442 | + $layout_choice = 'gridview_onefourth'; |
|
443 | + break; |
|
444 | + case 'gridview_onefifth'; |
|
445 | + case 'five'; |
|
446 | + case 'five_column'; |
|
447 | + case 'five_columns'; |
|
448 | + case 'fivecolumn'; |
|
449 | + case 'fivecolumns'; |
|
450 | + case '5'; |
|
451 | + $layout_choice = 'gridview_onefifth'; |
|
452 | + break; |
|
453 | + default: |
|
454 | + $layout_choice = 'gridview_onehalf'; |
|
455 | + break; |
|
456 | + } |
|
457 | + |
|
458 | + return $layout_choice; |
|
459 | 459 | } |
460 | 460 | |
461 | 461 | /** |
@@ -468,20 +468,20 @@ discard block |
||
468 | 468 | */ |
469 | 469 | function gdsc_validate_sort_choice($sort_choice) |
470 | 470 | { |
471 | - $sorts = array( |
|
472 | - 'az', |
|
473 | - 'latest', |
|
474 | - 'featured', |
|
475 | - 'high_review', |
|
476 | - 'high_rating', |
|
477 | - 'random', |
|
478 | - ); |
|
479 | - |
|
480 | - if (!(in_array($sort_choice, $sorts))) { |
|
481 | - $sort_choice = 'latest'; |
|
482 | - } |
|
483 | - |
|
484 | - return $sort_choice; |
|
471 | + $sorts = array( |
|
472 | + 'az', |
|
473 | + 'latest', |
|
474 | + 'featured', |
|
475 | + 'high_review', |
|
476 | + 'high_rating', |
|
477 | + 'random', |
|
478 | + ); |
|
479 | + |
|
480 | + if (!(in_array($sort_choice, $sorts))) { |
|
481 | + $sort_choice = 'latest'; |
|
482 | + } |
|
483 | + |
|
484 | + return $sort_choice; |
|
485 | 485 | } |
486 | 486 | |
487 | 487 | /** |
@@ -494,22 +494,22 @@ discard block |
||
494 | 494 | */ |
495 | 495 | function gdsc_validate_listing_width($width_choice) |
496 | 496 | { |
497 | - if (!(empty($width_choice))) { |
|
498 | - $width_choice = absint($width_choice); |
|
499 | - } else { |
|
500 | - return ''; |
|
501 | - } |
|
502 | - |
|
503 | - if (100 < $width_choice) { |
|
504 | - $width_choice = 100; |
|
505 | - } |
|
506 | - |
|
507 | - // If listing_width is too narrow, it won't work, arbitrarily set to 10% here |
|
508 | - if (10 > $width_choice) { |
|
509 | - $width_choice = 10; |
|
510 | - } |
|
511 | - |
|
512 | - return $width_choice; |
|
497 | + if (!(empty($width_choice))) { |
|
498 | + $width_choice = absint($width_choice); |
|
499 | + } else { |
|
500 | + return ''; |
|
501 | + } |
|
502 | + |
|
503 | + if (100 < $width_choice) { |
|
504 | + $width_choice = 100; |
|
505 | + } |
|
506 | + |
|
507 | + // If listing_width is too narrow, it won't work, arbitrarily set to 10% here |
|
508 | + if (10 > $width_choice) { |
|
509 | + $width_choice = 10; |
|
510 | + } |
|
511 | + |
|
512 | + return $width_choice; |
|
513 | 513 | } |
514 | 514 | |
515 | 515 | /** |
@@ -522,18 +522,18 @@ discard block |
||
522 | 522 | */ |
523 | 523 | function gdsc_validate_list_filter_choice($filter_choice) |
524 | 524 | { |
525 | - $filters = array( |
|
526 | - 'all', |
|
527 | - 'today', |
|
528 | - 'upcoming', |
|
529 | - 'past', |
|
530 | - ); |
|
531 | - |
|
532 | - if (!(in_array($filter_choice, $filters))) { |
|
533 | - $filter_choice = 'all'; |
|
534 | - } |
|
535 | - |
|
536 | - return $filter_choice; |
|
525 | + $filters = array( |
|
526 | + 'all', |
|
527 | + 'today', |
|
528 | + 'upcoming', |
|
529 | + 'past', |
|
530 | + ); |
|
531 | + |
|
532 | + if (!(in_array($filter_choice, $filters))) { |
|
533 | + $filter_choice = 'all'; |
|
534 | + } |
|
535 | + |
|
536 | + return $filter_choice; |
|
537 | 537 | } |
538 | 538 | |
539 | 539 | /** |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | * @return string Listings HTML content. |
554 | 554 | */ |
555 | 555 | function geodir_sc_gd_listings_output($args = array()) { |
556 | - $title = !empty($args['title']) ? __($args['title'], 'geodirectory') : ''; |
|
556 | + $title = !empty($args['title']) ? __($args['title'], 'geodirectory') : ''; |
|
557 | 557 | $post_type = !empty($args['post_type']) ? $args['post_type'] : 'gd_place'; |
558 | 558 | $category = !empty($args['category']) ? $args['category'] : '0'; |
559 | 559 | $post_number = !empty($args['post_number']) ? $args['post_number'] : 10; |
@@ -563,16 +563,16 @@ discard block |
||
563 | 563 | $layout = !empty($args['layout']) ? $args['layout'] : 'gridview_onehalf'; |
564 | 564 | $with_pagination = !empty($args['with_pagination']) ? true : false; |
565 | 565 | $event_type = !empty($args['event_type']) ? $args['event_type'] : ''; |
566 | - $shortcode_content = !empty($args['shortcode_content']) ? trim($args['shortcode_content']) : ''; |
|
567 | - /** |
|
568 | - * Filter the content text displayed when no listings found. |
|
569 | - * |
|
570 | - * @since 1.6.0 |
|
571 | - * |
|
572 | - * @param string $shortcode_content The shortcode content text. |
|
573 | - * @param array $args Array of arguements to filter listings. |
|
574 | - */ |
|
575 | - $shortcode_content = apply_filters('geodir_sc_gd_listings_not_found_content', $shortcode_content, $args); |
|
566 | + $shortcode_content = !empty($args['shortcode_content']) ? trim($args['shortcode_content']) : ''; |
|
567 | + /** |
|
568 | + * Filter the content text displayed when no listings found. |
|
569 | + * |
|
570 | + * @since 1.6.0 |
|
571 | + * |
|
572 | + * @param string $shortcode_content The shortcode content text. |
|
573 | + * @param array $args Array of arguements to filter listings. |
|
574 | + */ |
|
575 | + $shortcode_content = apply_filters('geodir_sc_gd_listings_not_found_content', $shortcode_content, $args); |
|
576 | 576 | |
577 | 577 | $top_pagination = $with_pagination && !empty($args['top_pagination']) ? true : false; |
578 | 578 | $bottom_pagination = $with_pagination && !empty($args['bottom_pagination']) ? true : false; |
@@ -584,61 +584,61 @@ discard block |
||
584 | 584 | $pageno = $geodir_ajax && !empty($args['pageno']) ? $args['pageno'] : 1; |
585 | 585 | |
586 | 586 | $query_args = array( |
587 | - 'posts_per_page' => $post_number, |
|
588 | - 'is_geodir_loop' => true, |
|
589 | - 'gd_location' => $add_location_filter, |
|
590 | - 'post_type' => $post_type, |
|
591 | - 'order_by' => $list_sort, |
|
587 | + 'posts_per_page' => $post_number, |
|
588 | + 'is_geodir_loop' => true, |
|
589 | + 'gd_location' => $add_location_filter, |
|
590 | + 'post_type' => $post_type, |
|
591 | + 'order_by' => $list_sort, |
|
592 | 592 | 'pageno' => $pageno |
593 | - ); |
|
593 | + ); |
|
594 | 594 | |
595 | - if ($character_count >= 0) { |
|
596 | - $query_args['excerpt_length'] = $character_count; |
|
597 | - } |
|
595 | + if ($character_count >= 0) { |
|
596 | + $query_args['excerpt_length'] = $character_count; |
|
597 | + } |
|
598 | 598 | |
599 | - if (!empty($args['post_author'])) { |
|
600 | - $query_args['post_author'] = $args['post_author']; |
|
601 | - } |
|
599 | + if (!empty($args['post_author'])) { |
|
600 | + $query_args['post_author'] = $args['post_author']; |
|
601 | + } |
|
602 | 602 | |
603 | - if (!empty($args['show_featured_only'])) { |
|
604 | - $query_args['show_featured_only'] = 1; |
|
605 | - } |
|
603 | + if (!empty($args['show_featured_only'])) { |
|
604 | + $query_args['show_featured_only'] = 1; |
|
605 | + } |
|
606 | 606 | |
607 | - if (!empty($args['show_special_only'])) { |
|
608 | - $query_args['show_special_only'] = 1; |
|
609 | - } |
|
607 | + if (!empty($args['show_special_only'])) { |
|
608 | + $query_args['show_special_only'] = 1; |
|
609 | + } |
|
610 | 610 | |
611 | - if (!empty($args['with_pics_only'])) { |
|
612 | - $query_args['with_pics_only'] = 0; |
|
613 | - $query_args['featured_image_only'] = 1; |
|
614 | - } |
|
611 | + if (!empty($args['with_pics_only'])) { |
|
612 | + $query_args['with_pics_only'] = 0; |
|
613 | + $query_args['featured_image_only'] = 1; |
|
614 | + } |
|
615 | 615 | |
616 | - if (!empty($args['with_videos_only'])) { |
|
617 | - $query_args['with_videos_only'] = 1; |
|
618 | - } |
|
619 | - $with_no_results = !empty($args['without_no_results']) ? false : true; |
|
616 | + if (!empty($args['with_videos_only'])) { |
|
617 | + $query_args['with_videos_only'] = 1; |
|
618 | + } |
|
619 | + $with_no_results = !empty($args['without_no_results']) ? false : true; |
|
620 | 620 | |
621 | - if (!empty($category) && isset($category[0]) && $category[0] != '0') { |
|
622 | - $category_taxonomy = geodir_get_taxonomies($post_type); |
|
621 | + if (!empty($category) && isset($category[0]) && $category[0] != '0') { |
|
622 | + $category_taxonomy = geodir_get_taxonomies($post_type); |
|
623 | 623 | |
624 | - ######### WPML ######### |
|
625 | - if (function_exists('icl_object_id')) { |
|
626 | - $category = gd_lang_object_ids($category, $category_taxonomy[0]); |
|
627 | - } |
|
628 | - ######### WPML ######### |
|
624 | + ######### WPML ######### |
|
625 | + if (function_exists('icl_object_id')) { |
|
626 | + $category = gd_lang_object_ids($category, $category_taxonomy[0]); |
|
627 | + } |
|
628 | + ######### WPML ######### |
|
629 | 629 | |
630 | - $tax_query = array( |
|
631 | - 'taxonomy' => $category_taxonomy[0], |
|
632 | - 'field' => 'id', |
|
633 | - 'terms' => $category |
|
634 | - ); |
|
630 | + $tax_query = array( |
|
631 | + 'taxonomy' => $category_taxonomy[0], |
|
632 | + 'field' => 'id', |
|
633 | + 'terms' => $category |
|
634 | + ); |
|
635 | 635 | |
636 | - $query_args['tax_query'] = array($tax_query); |
|
637 | - } |
|
636 | + $query_args['tax_query'] = array($tax_query); |
|
637 | + } |
|
638 | 638 | |
639 | - global $gridview_columns_widget, $geodir_is_widget_listing; |
|
639 | + global $gridview_columns_widget, $geodir_is_widget_listing; |
|
640 | 640 | |
641 | - if ($post_type == 'gd_event' && function_exists('geodir_event_get_widget_events')) { |
|
641 | + if ($post_type == 'gd_event' && function_exists('geodir_event_get_widget_events')) { |
|
642 | 642 | global $geodir_event_widget_listview; |
643 | 643 | $geodir_event_widget_listview = true; |
644 | 644 | |
@@ -655,15 +655,15 @@ discard block |
||
655 | 655 | } |
656 | 656 | $current_gridview_columns_widget = $gridview_columns_widget; |
657 | 657 | |
658 | - ob_start(); |
|
658 | + ob_start(); |
|
659 | 659 | if (!empty($widget_listings) || $with_no_results) { |
660 | 660 | if (!$geodir_ajax) { |
661 | - /** |
|
662 | - * Called before the shortcode [gd_listings] content is output. |
|
663 | - * |
|
664 | - * @since 1.0.0 |
|
665 | - */ |
|
666 | - do_action('geodir_before_sc_gd_listings'); |
|
661 | + /** |
|
662 | + * Called before the shortcode [gd_listings] content is output. |
|
663 | + * |
|
664 | + * @since 1.0.0 |
|
665 | + */ |
|
666 | + do_action('geodir_before_sc_gd_listings'); |
|
667 | 667 | ?> |
668 | 668 | <div class="geodir_locations geodir_location_listing geodir-sc-gd-listings"> |
669 | 669 | <?php } ?> |
@@ -673,64 +673,64 @@ discard block |
||
673 | 673 | </div> |
674 | 674 | <?php } ?> |
675 | 675 | <?php |
676 | - if (!(empty($widget_listings) && !empty($shortcode_content))) { |
|
677 | - if (strstr($layout, 'gridview')) { |
|
678 | - $listing_view_exp = explode('_', $layout); |
|
679 | - $gridview_columns_widget = $layout; |
|
680 | - $layout = $listing_view_exp[0]; |
|
681 | - } else { |
|
682 | - $gridview_columns_widget = ''; |
|
683 | - } |
|
684 | - |
|
685 | - /** |
|
686 | - * Filter the widget listing listview template. |
|
687 | - * |
|
688 | - * @since 1.0.0 |
|
689 | - * |
|
690 | - * @param string The template file to display listing. |
|
691 | - */ |
|
692 | - $template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview')); |
|
676 | + if (!(empty($widget_listings) && !empty($shortcode_content))) { |
|
677 | + if (strstr($layout, 'gridview')) { |
|
678 | + $listing_view_exp = explode('_', $layout); |
|
679 | + $gridview_columns_widget = $layout; |
|
680 | + $layout = $listing_view_exp[0]; |
|
681 | + } else { |
|
682 | + $gridview_columns_widget = ''; |
|
683 | + } |
|
684 | + |
|
685 | + /** |
|
686 | + * Filter the widget listing listview template. |
|
687 | + * |
|
688 | + * @since 1.0.0 |
|
689 | + * |
|
690 | + * @param string The template file to display listing. |
|
691 | + */ |
|
692 | + $template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview')); |
|
693 | 693 | |
694 | - global $post, $map_jason, $map_canvas_arr, $gd_session; |
|
695 | - |
|
696 | - $current_post = $post; |
|
697 | - $current_map_jason = $map_jason; |
|
698 | - $current_map_canvas_arr = $map_canvas_arr; |
|
699 | - $geodir_is_widget_listing = true; |
|
700 | - $gd_session->un_set('gd_listing_view'); |
|
701 | - |
|
702 | - if ($with_pagination && $top_pagination) { |
|
703 | - echo geodir_sc_listings_pagination($total_posts, $post_number, $pageno); |
|
704 | - } |
|
705 | - |
|
706 | - /** |
|
707 | - * Includes listing listview template. |
|
708 | - * |
|
709 | - * @since 1.0.0 |
|
710 | - */ |
|
711 | - include($template); |
|
694 | + global $post, $map_jason, $map_canvas_arr, $gd_session; |
|
695 | + |
|
696 | + $current_post = $post; |
|
697 | + $current_map_jason = $map_jason; |
|
698 | + $current_map_canvas_arr = $map_canvas_arr; |
|
699 | + $geodir_is_widget_listing = true; |
|
700 | + $gd_session->un_set('gd_listing_view'); |
|
701 | + |
|
702 | + if ($with_pagination && $top_pagination) { |
|
703 | + echo geodir_sc_listings_pagination($total_posts, $post_number, $pageno); |
|
704 | + } |
|
705 | + |
|
706 | + /** |
|
707 | + * Includes listing listview template. |
|
708 | + * |
|
709 | + * @since 1.0.0 |
|
710 | + */ |
|
711 | + include($template); |
|
712 | 712 | |
713 | - if ($with_pagination && $bottom_pagination) { |
|
714 | - echo geodir_sc_listings_pagination($total_posts, $post_number, $pageno); |
|
715 | - } |
|
716 | - |
|
717 | - $geodir_is_widget_listing = false; |
|
718 | - |
|
719 | - $GLOBALS['post'] = $current_post; |
|
720 | - if (!empty($current_post)) { |
|
721 | - setup_postdata($current_post); |
|
722 | - } |
|
723 | - $map_jason = $current_map_jason; |
|
724 | - $map_canvas_arr = $current_map_canvas_arr; |
|
725 | - global $gridview_columns_widget; |
|
726 | - $gridview_columns_widget = $current_gridview_columns_widget; |
|
727 | - } else { |
|
728 | - echo $shortcode_content; |
|
729 | - } |
|
713 | + if ($with_pagination && $bottom_pagination) { |
|
714 | + echo geodir_sc_listings_pagination($total_posts, $post_number, $pageno); |
|
715 | + } |
|
716 | + |
|
717 | + $geodir_is_widget_listing = false; |
|
718 | + |
|
719 | + $GLOBALS['post'] = $current_post; |
|
720 | + if (!empty($current_post)) { |
|
721 | + setup_postdata($current_post); |
|
722 | + } |
|
723 | + $map_jason = $current_map_jason; |
|
724 | + $map_canvas_arr = $current_map_canvas_arr; |
|
725 | + global $gridview_columns_widget; |
|
726 | + $gridview_columns_widget = $current_gridview_columns_widget; |
|
727 | + } else { |
|
728 | + echo $shortcode_content; |
|
729 | + } |
|
730 | 730 | ?> |
731 | 731 | <p class="geodir-sclisting-loading" style="display:none;"><i class="fa fa-cog fa-spin"></i></p> |
732 | 732 | <?php |
733 | - if (!$geodir_ajax) { |
|
733 | + if (!$geodir_ajax) { |
|
734 | 734 | ?> |
735 | 735 | </div> |
736 | 736 | <script type="text/javascript"> |
@@ -767,11 +767,11 @@ discard block |
||
767 | 767 | </script> |
768 | 768 | <?php } ?> |
769 | 769 | <?php |
770 | - } |
|
770 | + } |
|
771 | 771 | $output = ob_get_contents(); |
772 | - ob_end_clean(); |
|
772 | + ob_end_clean(); |
|
773 | 773 | |
774 | - return trim($output); |
|
774 | + return trim($output); |
|
775 | 775 | } |
776 | 776 | |
777 | 777 | /** |
@@ -798,15 +798,15 @@ discard block |
||
798 | 798 | * @return string Listings pagination HTML content. |
799 | 799 | */ |
800 | 800 | function geodir_sc_listings_pagination($total_posts, $posts_per_page, $pageno, $before = '', $after = '', $prelabel = '', $nxtlabel = '', $pages_to_show = 5, $always_show = false) { |
801 | - if (empty($prelabel)) { |
|
802 | - $prelabel = '<strong>«</strong>'; |
|
803 | - } |
|
801 | + if (empty($prelabel)) { |
|
802 | + $prelabel = '<strong>«</strong>'; |
|
803 | + } |
|
804 | 804 | |
805 | - if (empty($nxtlabel)) { |
|
806 | - $nxtlabel = '<strong>»</strong>'; |
|
807 | - } |
|
805 | + if (empty($nxtlabel)) { |
|
806 | + $nxtlabel = '<strong>»</strong>'; |
|
807 | + } |
|
808 | 808 | |
809 | - $half_pages_to_show = round($pages_to_show / 2); |
|
809 | + $half_pages_to_show = round($pages_to_show / 2); |
|
810 | 810 | |
811 | 811 | $numposts = $total_posts; |
812 | 812 | |
@@ -862,9 +862,9 @@ discard block |
||
862 | 862 | echo "</div> $after"; |
863 | 863 | } |
864 | 864 | $output = ob_get_contents(); |
865 | - ob_end_clean(); |
|
865 | + ob_end_clean(); |
|
866 | 866 | |
867 | - return trim($output); |
|
867 | + return trim($output); |
|
868 | 868 | } |
869 | 869 | |
870 | 870 | /** |
@@ -875,10 +875,10 @@ discard block |
||
875 | 875 | * @return string Listings HTML content. |
876 | 876 | */ |
877 | 877 | function geodir_sclistings_callback() { |
878 | - check_ajax_referer('geodir-sclistings-nonce', 'geodir_sclistings_nonce'); |
|
879 | - //set variables |
|
880 | - $scatts = isset($_POST['scatts']) ? $_POST['scatts'] : NULL; |
|
881 | - $pageno = isset($_POST['pageno']) ? absint($_POST['pageno']) : 1; |
|
878 | + check_ajax_referer('geodir-sclistings-nonce', 'geodir_sclistings_nonce'); |
|
879 | + //set variables |
|
880 | + $scatts = isset($_POST['scatts']) ? $_POST['scatts'] : NULL; |
|
881 | + $pageno = isset($_POST['pageno']) ? absint($_POST['pageno']) : 1; |
|
882 | 882 | |
883 | 883 | $shortcode_atts = !empty($scatts) ? (array)json_decode(stripslashes_deep($scatts)) : NULL; |
884 | 884 | |
@@ -890,7 +890,7 @@ discard block |
||
890 | 890 | } else { |
891 | 891 | echo 0; |
892 | 892 | } |
893 | - wp_die(); |
|
893 | + wp_die(); |
|
894 | 894 | } |
895 | 895 | add_action('wp_ajax_geodir_sclistings', 'geodir_sclistings_callback'); |
896 | 896 | add_action('wp_ajax_nopriv_geodir_sclistings', 'geodir_sclistings_callback'); |
897 | 897 | \ No newline at end of file |
@@ -202,14 +202,14 @@ discard block |
||
202 | 202 | // Add marker cluster |
203 | 203 | if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) { |
204 | 204 | $map_args['enable_marker_cluster'] = true; |
205 | - if(get_option('geodir_marker_cluster_type')) { |
|
205 | + if (get_option('geodir_marker_cluster_type')) { |
|
206 | 206 | if ($map_args['autozoom']) { |
207 | 207 | $map_args['enable_marker_cluster_no_reposition'] = false; |
208 | 208 | } else { |
209 | 209 | $map_args['enable_marker_cluster_no_reposition'] = true; |
210 | 210 | } |
211 | 211 | |
212 | - $map_args['enable_marker_cluster_server'] = true ; |
|
212 | + $map_args['enable_marker_cluster_server'] = true; |
|
213 | 213 | |
214 | 214 | } |
215 | 215 | } else { |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | } |
218 | 218 | |
219 | 219 | // if lat and long set in shortcode, hack it so the map is not repositioned |
220 | - if(!empty($params['latitude']) && !empty($params['longitude']) ){ |
|
220 | + if (!empty($params['latitude']) && !empty($params['longitude'])) { |
|
221 | 221 | $map_args['enable_marker_cluster_no_reposition'] = true; |
222 | 222 | } |
223 | 223 | |
@@ -890,7 +890,7 @@ discard block |
||
890 | 890 | |
891 | 891 | $show_adv_search = isset($params['show_adv_search']) && in_array($params['show_adv_search'], array('default', 'always', 'searched')) ? $params['show_adv_search'] : ''; |
892 | 892 | |
893 | - if ($show_adv_search != '' ) { |
|
893 | + if ($show_adv_search != '') { |
|
894 | 894 | $show_adv_class = 'geodir-advance-search-' . $show_adv_search . ' '; |
895 | 895 | if ($show_adv_search == 'searched' && geodir_is_page('search')) { |
896 | 896 | $show_adv_search = 'search'; |
@@ -903,7 +903,7 @@ discard block |
||
903 | 903 | ob_start(); |
904 | 904 | |
905 | 905 | //geodir_get_template_part('listing', 'filter-form'); |
906 | - the_widget('geodir_advance_search_widget', $params, $params ); |
|
906 | + the_widget('geodir_advance_search_widget', $params, $params); |
|
907 | 907 | |
908 | 908 | $output = ob_get_contents(); |
909 | 909 | ob_end_clean(); |
@@ -1101,7 +1101,7 @@ discard block |
||
1101 | 1101 | |
1102 | 1102 | // Validate character_count |
1103 | 1103 | //todo: is this necessary? |
1104 | - $params['character_count'] = $params['character_count']; |
|
1104 | + $params['character_count'] = $params['character_count']; |
|
1105 | 1105 | |
1106 | 1106 | // Validate our layout choice |
1107 | 1107 | // Outside of the norm, I added some more simple terms to match the existing |
@@ -1113,7 +1113,7 @@ discard block |
||
1113 | 1113 | |
1114 | 1114 | // Validate Listing width, used in the template widget-listing-listview.php |
1115 | 1115 | // The context is in width=$listing_width% - So we need a positive number between 0 & 100 |
1116 | - $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
1116 | + $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
1117 | 1117 | |
1118 | 1118 | // Validate the checkboxes used on the widget |
1119 | 1119 | $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
@@ -1137,13 +1137,13 @@ discard block |
||
1137 | 1137 | unset($atts['pageno']); |
1138 | 1138 | } |
1139 | 1139 | |
1140 | - if ( !empty($atts['shortcode_content']) ) { |
|
1140 | + if (!empty($atts['shortcode_content'])) { |
|
1141 | 1141 | $content = $atts['shortcode_content']; |
1142 | 1142 | } |
1143 | 1143 | $params['shortcode_content'] = trim($content); |
1144 | 1144 | $atts['shortcode_content'] = trim($content); |
1145 | 1145 | |
1146 | - $params['shortcode_atts'] = $atts; |
|
1146 | + $params['shortcode_atts'] = $atts; |
|
1147 | 1147 | |
1148 | 1148 | $output = geodir_sc_gd_listings_output($params); |
1149 | 1149 | |
@@ -1210,8 +1210,8 @@ discard block |
||
1210 | 1210 | // Validate the checkboxes used on the widget |
1211 | 1211 | $params['hide_empty'] = gdsc_to_bool_val($params['hide_empty']); |
1212 | 1212 | $params['show_count'] = gdsc_to_bool_val($params['show_count']); |
1213 | - $params['hide_icon'] = gdsc_to_bool_val($params['hide_icon']); |
|
1214 | - $params['cpt_left'] = gdsc_to_bool_val($params['cpt_left']); |
|
1213 | + $params['hide_icon'] = gdsc_to_bool_val($params['hide_icon']); |
|
1214 | + $params['cpt_left'] = gdsc_to_bool_val($params['cpt_left']); |
|
1215 | 1215 | |
1216 | 1216 | if ($params['max_count'] != 'all') { |
1217 | 1217 | $params['max_count'] = absint($params['max_count']); |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | */ |
8 | 8 | // If this file is called directly, abort. |
9 | 9 | if (!defined('WPINC')) { |
10 | - die; |
|
10 | + die; |
|
11 | 11 | } |
12 | 12 | require_once('geodirectory-functions/shortcode_functions.php'); |
13 | 13 | |
@@ -32,48 +32,48 @@ discard block |
||
32 | 32 | */ |
33 | 33 | function geodir_sc_add_listing($atts) |
34 | 34 | { |
35 | - ob_start(); |
|
36 | - $defaults = array( |
|
37 | - 'pid' => '', |
|
38 | - 'listing_type' => 'gd_place', |
|
39 | - 'login_msg' => __('You must login to post.', 'geodirectory'), |
|
40 | - 'show_login' => false, |
|
41 | - ); |
|
42 | - $params = shortcode_atts($defaults, $atts); |
|
43 | - |
|
44 | - foreach ($params as $key => $value) { |
|
45 | - $_REQUEST[$key] = $value; |
|
46 | - } |
|
47 | - |
|
48 | - $user_id = get_current_user_id(); |
|
49 | - if (!$user_id) { |
|
50 | - echo $params['login_msg']; |
|
51 | - if ($params['show_login']) { |
|
52 | - echo "<br />"; |
|
53 | - $defaults = array( |
|
54 | - 'before_widget' => '', |
|
55 | - 'after_widget' => '', |
|
56 | - 'before_title' => '', |
|
57 | - 'after_title' => '', |
|
58 | - ); |
|
59 | - |
|
60 | - geodir_loginwidget_output($defaults, $defaults); |
|
61 | - } |
|
62 | - |
|
63 | - |
|
64 | - } else { |
|
65 | - ###### MAIN CONTENT ###### |
|
66 | - |
|
67 | - /** This action is documented in geodirectory-templates/add-listing.php */ |
|
68 | - do_action('geodir_add_listing_page_mandatory'); |
|
69 | - /** This action is documented in geodirectory-templates/add-listing.php */ |
|
70 | - do_action('geodir_add_listing_form'); |
|
71 | - } |
|
72 | - $output = ob_get_contents(); |
|
73 | - |
|
74 | - ob_end_clean(); |
|
75 | - |
|
76 | - return $output; |
|
35 | + ob_start(); |
|
36 | + $defaults = array( |
|
37 | + 'pid' => '', |
|
38 | + 'listing_type' => 'gd_place', |
|
39 | + 'login_msg' => __('You must login to post.', 'geodirectory'), |
|
40 | + 'show_login' => false, |
|
41 | + ); |
|
42 | + $params = shortcode_atts($defaults, $atts); |
|
43 | + |
|
44 | + foreach ($params as $key => $value) { |
|
45 | + $_REQUEST[$key] = $value; |
|
46 | + } |
|
47 | + |
|
48 | + $user_id = get_current_user_id(); |
|
49 | + if (!$user_id) { |
|
50 | + echo $params['login_msg']; |
|
51 | + if ($params['show_login']) { |
|
52 | + echo "<br />"; |
|
53 | + $defaults = array( |
|
54 | + 'before_widget' => '', |
|
55 | + 'after_widget' => '', |
|
56 | + 'before_title' => '', |
|
57 | + 'after_title' => '', |
|
58 | + ); |
|
59 | + |
|
60 | + geodir_loginwidget_output($defaults, $defaults); |
|
61 | + } |
|
62 | + |
|
63 | + |
|
64 | + } else { |
|
65 | + ###### MAIN CONTENT ###### |
|
66 | + |
|
67 | + /** This action is documented in geodirectory-templates/add-listing.php */ |
|
68 | + do_action('geodir_add_listing_page_mandatory'); |
|
69 | + /** This action is documented in geodirectory-templates/add-listing.php */ |
|
70 | + do_action('geodir_add_listing_form'); |
|
71 | + } |
|
72 | + $output = ob_get_contents(); |
|
73 | + |
|
74 | + ob_end_clean(); |
|
75 | + |
|
76 | + return $output; |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | /** |
@@ -101,136 +101,136 @@ discard block |
||
101 | 101 | */ |
102 | 102 | function geodir_sc_home_map($atts) |
103 | 103 | { |
104 | - ob_start(); |
|
105 | - $defaults = array( |
|
106 | - 'width' => '960', |
|
107 | - 'height' => '425', |
|
108 | - 'maptype' => 'ROADMAP', |
|
109 | - 'zoom' => '13', |
|
110 | - 'autozoom' => '', |
|
111 | - 'child_collapse' => '0', |
|
112 | - 'scrollwheel' => '0', |
|
104 | + ob_start(); |
|
105 | + $defaults = array( |
|
106 | + 'width' => '960', |
|
107 | + 'height' => '425', |
|
108 | + 'maptype' => 'ROADMAP', |
|
109 | + 'zoom' => '13', |
|
110 | + 'autozoom' => '', |
|
111 | + 'child_collapse' => '0', |
|
112 | + 'scrollwheel' => '0', |
|
113 | 113 | 'marker_cluster' => false, |
114 | - 'latitude' => '', |
|
115 | - 'longitude' => '' |
|
116 | - ); |
|
117 | - |
|
118 | - $params = shortcode_atts($defaults, $atts); |
|
119 | - |
|
120 | - $params = gdsc_validate_map_args($params); |
|
121 | - |
|
122 | - $map_args = array( |
|
123 | - 'map_canvas_name' => 'gd_home_map', |
|
124 | - 'latitude' => $params['latitude'], |
|
125 | - 'longitude' => $params['longitude'], |
|
126 | - |
|
127 | - /** |
|
128 | - * Filter the widget width of the map on home/listings page. |
|
129 | - * |
|
130 | - * @since 1.0.0 |
|
131 | - * @param mixed(string|int|float) $params['width'] The map width. |
|
132 | - */ |
|
133 | - 'width' => apply_filters('widget_width', $params['width']), |
|
134 | - /** |
|
135 | - * Filter the widget height of the map on home/listings page. |
|
136 | - * |
|
137 | - * @since 1.0.0 |
|
138 | - * @param mixed(string|int|float) $params['height'] The map height. |
|
139 | - */ |
|
140 | - 'height' => apply_filters('widget_heigh', $params['height']), |
|
141 | - /** |
|
142 | - * Filter the widget maptype of the map on home/listings page. |
|
143 | - * |
|
144 | - * @since 1.0.0 |
|
114 | + 'latitude' => '', |
|
115 | + 'longitude' => '' |
|
116 | + ); |
|
117 | + |
|
118 | + $params = shortcode_atts($defaults, $atts); |
|
119 | + |
|
120 | + $params = gdsc_validate_map_args($params); |
|
121 | + |
|
122 | + $map_args = array( |
|
123 | + 'map_canvas_name' => 'gd_home_map', |
|
124 | + 'latitude' => $params['latitude'], |
|
125 | + 'longitude' => $params['longitude'], |
|
126 | + |
|
127 | + /** |
|
128 | + * Filter the widget width of the map on home/listings page. |
|
129 | + * |
|
130 | + * @since 1.0.0 |
|
131 | + * @param mixed(string|int|float) $params['width'] The map width. |
|
132 | + */ |
|
133 | + 'width' => apply_filters('widget_width', $params['width']), |
|
134 | + /** |
|
135 | + * Filter the widget height of the map on home/listings page. |
|
136 | + * |
|
137 | + * @since 1.0.0 |
|
138 | + * @param mixed(string|int|float) $params['height'] The map height. |
|
139 | + */ |
|
140 | + 'height' => apply_filters('widget_heigh', $params['height']), |
|
141 | + /** |
|
142 | + * Filter the widget maptype of the map on home/listings page. |
|
143 | + * |
|
144 | + * @since 1.0.0 |
|
145 | 145 | * @since 1.5.2 Added TERRAIN map type. |
146 | - * @param string $params['maptype'] The map type. Can be ROADMAP | SATELLITE | HYBRID | TERRAIN. |
|
147 | - */ |
|
148 | - 'maptype' => apply_filters('widget_maptype', $params['maptype']), |
|
149 | - /** |
|
150 | - * Filter the widget scrollwheel value of the map on home/listings page. |
|
151 | - * |
|
152 | - * Should the scrollwheel zoom the map or not. |
|
153 | - * |
|
154 | - * @since 1.0.0 |
|
155 | - * @param bool $params['scrollwheel'] True to allow scroll wheel to scroll map or false if not. |
|
156 | - */ |
|
157 | - 'scrollwheel' => apply_filters('widget_scrollwheel', $params['scrollwheel']), |
|
158 | - /** |
|
159 | - * Filter the widget zoom level of the map on home/listings page. |
|
160 | - * |
|
161 | - * @since 1.0.0 |
|
162 | - * @param int $params['zoom'] The zoom level of the map. Between 1-19. |
|
163 | - */ |
|
164 | - 'zoom' => apply_filters('widget_zoom', $params['zoom']), |
|
165 | - /** |
|
166 | - * Filter the widget auto zoom value of the map on home/listings page. |
|
167 | - * |
|
168 | - * If the map should autozoom to fit the markers shown. |
|
169 | - * |
|
170 | - * @since 1.0.0 |
|
171 | - * @param bool $params['autozoom'] True if the map should autozoom, false if not. |
|
172 | - */ |
|
173 | - 'autozoom' => apply_filters('widget_autozoom', $params['autozoom']), |
|
174 | - /** |
|
175 | - * Filter the widget child_collapse value of the map on home/listings page. |
|
176 | - * |
|
177 | - * If the map should auto collapse the child categories if the category bar is present. |
|
178 | - * |
|
179 | - * @since 1.0.0 |
|
180 | - * @param bool $params['child_collapse'] True if the map should collapse the categories, false if not. |
|
181 | - */ |
|
182 | - 'child_collapse' => apply_filters('widget_child_collapse', $params['child_collapse']), |
|
183 | - 'enable_cat_filters' => true, |
|
184 | - 'enable_text_search' => true, |
|
185 | - 'enable_post_type_filters' => true, |
|
186 | - /** |
|
187 | - * Filter the widget enable_location_filters value of the map on home/listings page. |
|
188 | - * |
|
189 | - * This is used when the location addon is used. |
|
190 | - * |
|
191 | - * @since 1.0.0 |
|
192 | - * @param bool $val True if location filters should be used, false if not. |
|
193 | - */ |
|
194 | - 'enable_location_filters' => apply_filters('geodir_home_map_enable_location_filters', false), |
|
195 | - 'enable_jason_on_load' => false, |
|
196 | - 'enable_marker_cluster' => false, |
|
197 | - 'enable_map_resize_button' => true, |
|
198 | - 'map_class_name' => 'geodir-map-home-page', |
|
199 | - 'is_geodir_home_map_widget' => true, |
|
200 | - ); |
|
146 | + * @param string $params['maptype'] The map type. Can be ROADMAP | SATELLITE | HYBRID | TERRAIN. |
|
147 | + */ |
|
148 | + 'maptype' => apply_filters('widget_maptype', $params['maptype']), |
|
149 | + /** |
|
150 | + * Filter the widget scrollwheel value of the map on home/listings page. |
|
151 | + * |
|
152 | + * Should the scrollwheel zoom the map or not. |
|
153 | + * |
|
154 | + * @since 1.0.0 |
|
155 | + * @param bool $params['scrollwheel'] True to allow scroll wheel to scroll map or false if not. |
|
156 | + */ |
|
157 | + 'scrollwheel' => apply_filters('widget_scrollwheel', $params['scrollwheel']), |
|
158 | + /** |
|
159 | + * Filter the widget zoom level of the map on home/listings page. |
|
160 | + * |
|
161 | + * @since 1.0.0 |
|
162 | + * @param int $params['zoom'] The zoom level of the map. Between 1-19. |
|
163 | + */ |
|
164 | + 'zoom' => apply_filters('widget_zoom', $params['zoom']), |
|
165 | + /** |
|
166 | + * Filter the widget auto zoom value of the map on home/listings page. |
|
167 | + * |
|
168 | + * If the map should autozoom to fit the markers shown. |
|
169 | + * |
|
170 | + * @since 1.0.0 |
|
171 | + * @param bool $params['autozoom'] True if the map should autozoom, false if not. |
|
172 | + */ |
|
173 | + 'autozoom' => apply_filters('widget_autozoom', $params['autozoom']), |
|
174 | + /** |
|
175 | + * Filter the widget child_collapse value of the map on home/listings page. |
|
176 | + * |
|
177 | + * If the map should auto collapse the child categories if the category bar is present. |
|
178 | + * |
|
179 | + * @since 1.0.0 |
|
180 | + * @param bool $params['child_collapse'] True if the map should collapse the categories, false if not. |
|
181 | + */ |
|
182 | + 'child_collapse' => apply_filters('widget_child_collapse', $params['child_collapse']), |
|
183 | + 'enable_cat_filters' => true, |
|
184 | + 'enable_text_search' => true, |
|
185 | + 'enable_post_type_filters' => true, |
|
186 | + /** |
|
187 | + * Filter the widget enable_location_filters value of the map on home/listings page. |
|
188 | + * |
|
189 | + * This is used when the location addon is used. |
|
190 | + * |
|
191 | + * @since 1.0.0 |
|
192 | + * @param bool $val True if location filters should be used, false if not. |
|
193 | + */ |
|
194 | + 'enable_location_filters' => apply_filters('geodir_home_map_enable_location_filters', false), |
|
195 | + 'enable_jason_on_load' => false, |
|
196 | + 'enable_marker_cluster' => false, |
|
197 | + 'enable_map_resize_button' => true, |
|
198 | + 'map_class_name' => 'geodir-map-home-page', |
|
199 | + 'is_geodir_home_map_widget' => true, |
|
200 | + ); |
|
201 | 201 | |
202 | 202 | // Add marker cluster |
203 | 203 | if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) { |
204 | - $map_args['enable_marker_cluster'] = true; |
|
205 | - if(get_option('geodir_marker_cluster_type')) { |
|
206 | - if ($map_args['autozoom']) { |
|
207 | - $map_args['enable_marker_cluster_no_reposition'] = false; |
|
208 | - } else { |
|
209 | - $map_args['enable_marker_cluster_no_reposition'] = true; |
|
210 | - } |
|
204 | + $map_args['enable_marker_cluster'] = true; |
|
205 | + if(get_option('geodir_marker_cluster_type')) { |
|
206 | + if ($map_args['autozoom']) { |
|
207 | + $map_args['enable_marker_cluster_no_reposition'] = false; |
|
208 | + } else { |
|
209 | + $map_args['enable_marker_cluster_no_reposition'] = true; |
|
210 | + } |
|
211 | 211 | |
212 | - $map_args['enable_marker_cluster_server'] = true ; |
|
212 | + $map_args['enable_marker_cluster_server'] = true ; |
|
213 | 213 | |
214 | - } |
|
214 | + } |
|
215 | 215 | } else { |
216 | 216 | $map_args['enable_marker_cluster'] = false; |
217 | 217 | } |
218 | 218 | |
219 | - // if lat and long set in shortcode, hack it so the map is not repositioned |
|
220 | - if(!empty($params['latitude']) && !empty($params['longitude']) ){ |
|
221 | - $map_args['enable_marker_cluster_no_reposition'] = true; |
|
222 | - } |
|
219 | + // if lat and long set in shortcode, hack it so the map is not repositioned |
|
220 | + if(!empty($params['latitude']) && !empty($params['longitude']) ){ |
|
221 | + $map_args['enable_marker_cluster_no_reposition'] = true; |
|
222 | + } |
|
223 | 223 | |
224 | 224 | |
225 | - geodir_draw_map($map_args); |
|
225 | + geodir_draw_map($map_args); |
|
226 | 226 | |
227 | - add_action('wp_footer', 'geodir_home_map_add_script', 100); |
|
227 | + add_action('wp_footer', 'geodir_home_map_add_script', 100); |
|
228 | 228 | |
229 | - $output = ob_get_contents(); |
|
229 | + $output = ob_get_contents(); |
|
230 | 230 | |
231 | - ob_end_clean(); |
|
231 | + ob_end_clean(); |
|
232 | 232 | |
233 | - return $output; |
|
233 | + return $output; |
|
234 | 234 | } |
235 | 235 | add_shortcode('gd_homepage_map', 'geodir_sc_home_map'); |
236 | 236 | |
@@ -264,77 +264,77 @@ discard block |
||
264 | 264 | */ |
265 | 265 | function geodir_sc_listing_map($atts) |
266 | 266 | { |
267 | - ob_start(); |
|
268 | - add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array |
|
269 | - |
|
270 | - add_action('the_post', 'create_list_jsondata'); // Add marker in json array |
|
271 | - |
|
272 | - add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers |
|
273 | - |
|
274 | - $defaults = array( |
|
275 | - 'width' => '294', |
|
276 | - 'height' => '370', |
|
277 | - 'zoom' => '13', |
|
278 | - 'autozoom' => '', |
|
279 | - 'sticky' => '', |
|
280 | - 'showall' => '0', |
|
281 | - 'scrollwheel' => '0', |
|
282 | - 'maptype' => 'ROADMAP', |
|
283 | - 'child_collapse' => 0, |
|
267 | + ob_start(); |
|
268 | + add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array |
|
269 | + |
|
270 | + add_action('the_post', 'create_list_jsondata'); // Add marker in json array |
|
271 | + |
|
272 | + add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers |
|
273 | + |
|
274 | + $defaults = array( |
|
275 | + 'width' => '294', |
|
276 | + 'height' => '370', |
|
277 | + 'zoom' => '13', |
|
278 | + 'autozoom' => '', |
|
279 | + 'sticky' => '', |
|
280 | + 'showall' => '0', |
|
281 | + 'scrollwheel' => '0', |
|
282 | + 'maptype' => 'ROADMAP', |
|
283 | + 'child_collapse' => 0, |
|
284 | 284 | 'marker_cluster' => false |
285 | - ); |
|
286 | - |
|
287 | - $params = shortcode_atts($defaults, $atts); |
|
288 | - |
|
289 | - $params = gdsc_validate_map_args($params); |
|
290 | - |
|
291 | - $map_args = array( |
|
292 | - 'map_canvas_name' => 'gd_listing_map', |
|
293 | - 'width' => $params['width'], |
|
294 | - 'height' => $params['height'], |
|
295 | - 'zoom' => $params['zoom'], |
|
296 | - 'autozoom' => $params['autozoom'], |
|
297 | - 'sticky' => $params['sticky'], |
|
298 | - 'showall' => $params['showall'], |
|
299 | - 'scrollwheel' => $params['scrollwheel'], |
|
300 | - 'child_collapse' => 0, |
|
301 | - 'enable_cat_filters' => false, |
|
302 | - 'enable_text_search' => false, |
|
303 | - 'enable_post_type_filters' => false, |
|
304 | - 'enable_location_filters' => false, |
|
305 | - 'enable_jason_on_load' => true, |
|
306 | - ); |
|
307 | - |
|
308 | - if (is_single()) { |
|
309 | - |
|
310 | - global $post; |
|
311 | - $map_default_lat = $address_latitude = $post->post_latitude; |
|
312 | - $map_default_lng = $address_longitude = $post->post_longitude; |
|
313 | - $mapview = $post->post_mapview; |
|
314 | - $map_args['zoom'] = $post->post_mapzoom; |
|
315 | - $map_args['map_class_name'] = 'geodir-map-listing-page-single'; |
|
316 | - |
|
317 | - } else { |
|
318 | - $default_location = geodir_get_default_location(); |
|
319 | - |
|
320 | - $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
321 | - $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
322 | - $map_args['map_class_name'] = 'geodir-map-listing-page'; |
|
323 | - } |
|
324 | - |
|
325 | - if (empty($mapview)) { |
|
326 | - $mapview = 'ROADMAP'; |
|
327 | - } |
|
328 | - |
|
329 | - // Set default map options |
|
330 | - $map_args['ajax_url'] = geodir_get_ajax_url(); |
|
331 | - $map_args['latitude'] = $map_default_lat; |
|
332 | - $map_args['longitude'] = $map_default_lng; |
|
333 | - $map_args['streetViewControl'] = true; |
|
334 | - $map_args['maptype'] = $mapview; |
|
335 | - $map_args['showPreview'] = '0'; |
|
336 | - $map_args['maxZoom'] = 21; |
|
337 | - $map_args['bubble_size'] = 'small'; |
|
285 | + ); |
|
286 | + |
|
287 | + $params = shortcode_atts($defaults, $atts); |
|
288 | + |
|
289 | + $params = gdsc_validate_map_args($params); |
|
290 | + |
|
291 | + $map_args = array( |
|
292 | + 'map_canvas_name' => 'gd_listing_map', |
|
293 | + 'width' => $params['width'], |
|
294 | + 'height' => $params['height'], |
|
295 | + 'zoom' => $params['zoom'], |
|
296 | + 'autozoom' => $params['autozoom'], |
|
297 | + 'sticky' => $params['sticky'], |
|
298 | + 'showall' => $params['showall'], |
|
299 | + 'scrollwheel' => $params['scrollwheel'], |
|
300 | + 'child_collapse' => 0, |
|
301 | + 'enable_cat_filters' => false, |
|
302 | + 'enable_text_search' => false, |
|
303 | + 'enable_post_type_filters' => false, |
|
304 | + 'enable_location_filters' => false, |
|
305 | + 'enable_jason_on_load' => true, |
|
306 | + ); |
|
307 | + |
|
308 | + if (is_single()) { |
|
309 | + |
|
310 | + global $post; |
|
311 | + $map_default_lat = $address_latitude = $post->post_latitude; |
|
312 | + $map_default_lng = $address_longitude = $post->post_longitude; |
|
313 | + $mapview = $post->post_mapview; |
|
314 | + $map_args['zoom'] = $post->post_mapzoom; |
|
315 | + $map_args['map_class_name'] = 'geodir-map-listing-page-single'; |
|
316 | + |
|
317 | + } else { |
|
318 | + $default_location = geodir_get_default_location(); |
|
319 | + |
|
320 | + $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
321 | + $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
322 | + $map_args['map_class_name'] = 'geodir-map-listing-page'; |
|
323 | + } |
|
324 | + |
|
325 | + if (empty($mapview)) { |
|
326 | + $mapview = 'ROADMAP'; |
|
327 | + } |
|
328 | + |
|
329 | + // Set default map options |
|
330 | + $map_args['ajax_url'] = geodir_get_ajax_url(); |
|
331 | + $map_args['latitude'] = $map_default_lat; |
|
332 | + $map_args['longitude'] = $map_default_lng; |
|
333 | + $map_args['streetViewControl'] = true; |
|
334 | + $map_args['maptype'] = $mapview; |
|
335 | + $map_args['showPreview'] = '0'; |
|
336 | + $map_args['maxZoom'] = 21; |
|
337 | + $map_args['bubble_size'] = 'small'; |
|
338 | 338 | |
339 | 339 | // Add marker cluster |
340 | 340 | if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) { |
@@ -343,13 +343,13 @@ discard block |
||
343 | 343 | $map_args['enable_marker_cluster'] = false; |
344 | 344 | } |
345 | 345 | |
346 | - geodir_draw_map($map_args); |
|
346 | + geodir_draw_map($map_args); |
|
347 | 347 | |
348 | - $output = ob_get_contents(); |
|
348 | + $output = ob_get_contents(); |
|
349 | 349 | |
350 | - ob_end_clean(); |
|
350 | + ob_end_clean(); |
|
351 | 351 | |
352 | - return $output; |
|
352 | + return $output; |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | add_shortcode('gd_listing_slider', 'geodir_sc_listing_slider'); |
@@ -382,120 +382,120 @@ discard block |
||
382 | 382 | */ |
383 | 383 | function geodir_sc_listing_slider($atts) |
384 | 384 | { |
385 | - ob_start(); |
|
386 | - $defaults = array( |
|
387 | - 'post_type' => 'gd_place', |
|
388 | - 'category' => '0', |
|
389 | - 'post_number' => '5', |
|
390 | - 'slideshow' => '0', |
|
391 | - 'animation_loop' => 0, |
|
392 | - 'direction_nav' => 0, |
|
393 | - 'slideshow_speed' => 5000, |
|
394 | - 'animation_speed' => 600, |
|
395 | - 'animation' => 'slide', |
|
396 | - 'order_by' => 'latest', |
|
397 | - 'show_title' => '', |
|
398 | - 'show_featured_only' => '', |
|
399 | - 'title' => '', |
|
400 | - ); |
|
401 | - |
|
402 | - $params = shortcode_atts($defaults, $atts); |
|
403 | - |
|
404 | - |
|
405 | - /* |
|
385 | + ob_start(); |
|
386 | + $defaults = array( |
|
387 | + 'post_type' => 'gd_place', |
|
388 | + 'category' => '0', |
|
389 | + 'post_number' => '5', |
|
390 | + 'slideshow' => '0', |
|
391 | + 'animation_loop' => 0, |
|
392 | + 'direction_nav' => 0, |
|
393 | + 'slideshow_speed' => 5000, |
|
394 | + 'animation_speed' => 600, |
|
395 | + 'animation' => 'slide', |
|
396 | + 'order_by' => 'latest', |
|
397 | + 'show_title' => '', |
|
398 | + 'show_featured_only' => '', |
|
399 | + 'title' => '', |
|
400 | + ); |
|
401 | + |
|
402 | + $params = shortcode_atts($defaults, $atts); |
|
403 | + |
|
404 | + |
|
405 | + /* |
|
406 | 406 | * |
407 | 407 | * Now we begin the validation of the attributes. |
408 | 408 | */ |
409 | - // Check we have a valid post_type |
|
410 | - if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
411 | - $params['post_type'] = 'gd_place'; |
|
412 | - } |
|
413 | - |
|
414 | - // Check we have a valid sort_order |
|
415 | - $params['order_by'] = gdsc_validate_sort_choice($params['order_by']); |
|
416 | - |
|
417 | - // Match the chosen animation to our options |
|
418 | - $animation_list = array('slide', 'fade'); |
|
419 | - if (!(in_array($params['animation'], $animation_list))) { |
|
420 | - $params['animation'] = 'slide'; |
|
421 | - } |
|
422 | - |
|
423 | - // Post_number needs to be a positive integer |
|
424 | - $params['post_number'] = absint($params['post_number']); |
|
425 | - if (0 == $params['post_number']) { |
|
426 | - $params['post_number'] = 1; |
|
427 | - } |
|
428 | - |
|
429 | - // Manage the entered categories |
|
430 | - if (0 != $params['category'] || '' != $params['category']) { |
|
431 | - $params['category'] = gdsc_manage_category_choice($params['post_type'], $params['category']); |
|
432 | - } |
|
433 | - // Convert show_title to a bool |
|
434 | - $params['show_title'] = intval(gdsc_to_bool_val($params['show_title'])); |
|
435 | - |
|
436 | - // Convert show_featured_only to a bool |
|
437 | - $params['show_featured_only'] = intval(gdsc_to_bool_val($params['show_featured_only'])); |
|
438 | - |
|
439 | - /* |
|
409 | + // Check we have a valid post_type |
|
410 | + if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
411 | + $params['post_type'] = 'gd_place'; |
|
412 | + } |
|
413 | + |
|
414 | + // Check we have a valid sort_order |
|
415 | + $params['order_by'] = gdsc_validate_sort_choice($params['order_by']); |
|
416 | + |
|
417 | + // Match the chosen animation to our options |
|
418 | + $animation_list = array('slide', 'fade'); |
|
419 | + if (!(in_array($params['animation'], $animation_list))) { |
|
420 | + $params['animation'] = 'slide'; |
|
421 | + } |
|
422 | + |
|
423 | + // Post_number needs to be a positive integer |
|
424 | + $params['post_number'] = absint($params['post_number']); |
|
425 | + if (0 == $params['post_number']) { |
|
426 | + $params['post_number'] = 1; |
|
427 | + } |
|
428 | + |
|
429 | + // Manage the entered categories |
|
430 | + if (0 != $params['category'] || '' != $params['category']) { |
|
431 | + $params['category'] = gdsc_manage_category_choice($params['post_type'], $params['category']); |
|
432 | + } |
|
433 | + // Convert show_title to a bool |
|
434 | + $params['show_title'] = intval(gdsc_to_bool_val($params['show_title'])); |
|
435 | + |
|
436 | + // Convert show_featured_only to a bool |
|
437 | + $params['show_featured_only'] = intval(gdsc_to_bool_val($params['show_featured_only'])); |
|
438 | + |
|
439 | + /* |
|
440 | 440 | * Hopefully all attributes are now valid, and safe to pass forward |
441 | 441 | */ |
442 | 442 | |
443 | - // redeclare vars after validation |
|
444 | - |
|
445 | - if (isset($params['direction_nav'])) { |
|
446 | - $params['directionNav'] = $params['direction_nav']; |
|
447 | - } |
|
448 | - if (isset($params['animation_loop'])) { |
|
449 | - $params['animationLoop'] = $params['animation_loop']; |
|
450 | - } |
|
451 | - if (isset($params['slideshow_speed'])) { |
|
452 | - $params['slideshowSpeed'] = $params['slideshow_speed']; |
|
453 | - } |
|
454 | - if (isset($params['animation_speed'])) { |
|
455 | - $params['animationSpeed'] = $params['animation_speed']; |
|
456 | - } |
|
457 | - if (isset($params['order_by'])) { |
|
458 | - $params['list_sort'] = $params['order_by']; |
|
459 | - } |
|
460 | - |
|
461 | - $query_args = array( |
|
462 | - 'post_number' => $params['post_number'], |
|
463 | - 'is_geodir_loop' => true, |
|
464 | - 'post_type' => $params['post_type'], |
|
465 | - 'order_by' => $params['order_by'] |
|
466 | - ); |
|
467 | - |
|
468 | - if (1 == $params['show_featured_only']) { |
|
469 | - $query_args['show_featured_only'] = 1; |
|
470 | - } |
|
471 | - |
|
472 | - if (0 != $params['category'] && '' != $params['category']) { |
|
473 | - $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
474 | - $tax_query = array( |
|
475 | - 'taxonomy' => $category_taxonomy[0], |
|
476 | - 'field' => 'id', |
|
477 | - 'terms' => $params['category'], |
|
478 | - ); |
|
479 | - |
|
480 | - $query_args['tax_query'] = array($tax_query); |
|
481 | - } |
|
482 | - |
|
483 | - $defaults = array( |
|
484 | - 'before_widget' => '', |
|
485 | - 'after_widget' => '', |
|
486 | - 'before_title' => '', |
|
487 | - 'after_title' => '', |
|
488 | - ); |
|
489 | - |
|
490 | - $query_args = array_merge($query_args, $params); |
|
491 | - |
|
492 | - geodir_listing_slider_widget_output($defaults, $query_args); |
|
493 | - |
|
494 | - $output = ob_get_contents(); |
|
495 | - |
|
496 | - ob_end_clean(); |
|
497 | - |
|
498 | - return $output; |
|
443 | + // redeclare vars after validation |
|
444 | + |
|
445 | + if (isset($params['direction_nav'])) { |
|
446 | + $params['directionNav'] = $params['direction_nav']; |
|
447 | + } |
|
448 | + if (isset($params['animation_loop'])) { |
|
449 | + $params['animationLoop'] = $params['animation_loop']; |
|
450 | + } |
|
451 | + if (isset($params['slideshow_speed'])) { |
|
452 | + $params['slideshowSpeed'] = $params['slideshow_speed']; |
|
453 | + } |
|
454 | + if (isset($params['animation_speed'])) { |
|
455 | + $params['animationSpeed'] = $params['animation_speed']; |
|
456 | + } |
|
457 | + if (isset($params['order_by'])) { |
|
458 | + $params['list_sort'] = $params['order_by']; |
|
459 | + } |
|
460 | + |
|
461 | + $query_args = array( |
|
462 | + 'post_number' => $params['post_number'], |
|
463 | + 'is_geodir_loop' => true, |
|
464 | + 'post_type' => $params['post_type'], |
|
465 | + 'order_by' => $params['order_by'] |
|
466 | + ); |
|
467 | + |
|
468 | + if (1 == $params['show_featured_only']) { |
|
469 | + $query_args['show_featured_only'] = 1; |
|
470 | + } |
|
471 | + |
|
472 | + if (0 != $params['category'] && '' != $params['category']) { |
|
473 | + $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
474 | + $tax_query = array( |
|
475 | + 'taxonomy' => $category_taxonomy[0], |
|
476 | + 'field' => 'id', |
|
477 | + 'terms' => $params['category'], |
|
478 | + ); |
|
479 | + |
|
480 | + $query_args['tax_query'] = array($tax_query); |
|
481 | + } |
|
482 | + |
|
483 | + $defaults = array( |
|
484 | + 'before_widget' => '', |
|
485 | + 'after_widget' => '', |
|
486 | + 'before_title' => '', |
|
487 | + 'after_title' => '', |
|
488 | + ); |
|
489 | + |
|
490 | + $query_args = array_merge($query_args, $params); |
|
491 | + |
|
492 | + geodir_listing_slider_widget_output($defaults, $query_args); |
|
493 | + |
|
494 | + $output = ob_get_contents(); |
|
495 | + |
|
496 | + ob_end_clean(); |
|
497 | + |
|
498 | + return $output; |
|
499 | 499 | } |
500 | 500 | |
501 | 501 | add_shortcode('gd_login_box', 'geodir_sc_login_box'); |
@@ -519,22 +519,22 @@ discard block |
||
519 | 519 | */ |
520 | 520 | function geodir_sc_login_box($atts) |
521 | 521 | { |
522 | - ob_start(); |
|
522 | + ob_start(); |
|
523 | 523 | |
524 | - $defaults = array( |
|
525 | - 'before_widget' => '', |
|
526 | - 'after_widget' => '', |
|
527 | - 'before_title' => '', |
|
528 | - 'after_title' => '', |
|
529 | - ); |
|
524 | + $defaults = array( |
|
525 | + 'before_widget' => '', |
|
526 | + 'after_widget' => '', |
|
527 | + 'before_title' => '', |
|
528 | + 'after_title' => '', |
|
529 | + ); |
|
530 | 530 | |
531 | - geodir_loginwidget_output($defaults, $defaults); |
|
531 | + geodir_loginwidget_output($defaults, $defaults); |
|
532 | 532 | |
533 | - $output = ob_get_contents(); |
|
533 | + $output = ob_get_contents(); |
|
534 | 534 | |
535 | - ob_end_clean(); |
|
535 | + ob_end_clean(); |
|
536 | 536 | |
537 | - return $output; |
|
537 | + return $output; |
|
538 | 538 | } |
539 | 539 | |
540 | 540 | add_shortcode('gd_popular_post_category', 'geodir_sc_popular_post_category'); |
@@ -563,28 +563,28 @@ discard block |
||
563 | 563 | */ |
564 | 564 | function geodir_sc_popular_post_category($atts) |
565 | 565 | { |
566 | - ob_start(); |
|
567 | - global $geodir_post_category_str; |
|
568 | - $defaults = array( |
|
569 | - 'category_limit' => 15, |
|
570 | - 'before_widget' => '', |
|
571 | - 'after_widget' => '', |
|
572 | - 'before_title' => '', |
|
573 | - 'after_title' => '', |
|
574 | - 'title' => '', |
|
566 | + ob_start(); |
|
567 | + global $geodir_post_category_str; |
|
568 | + $defaults = array( |
|
569 | + 'category_limit' => 15, |
|
570 | + 'before_widget' => '', |
|
571 | + 'after_widget' => '', |
|
572 | + 'before_title' => '', |
|
573 | + 'after_title' => '', |
|
574 | + 'title' => '', |
|
575 | 575 | 'default_post_type' => '', |
576 | - ); |
|
576 | + ); |
|
577 | 577 | |
578 | - $params = shortcode_atts($defaults, $atts, 'popular_post_category'); |
|
579 | - $params['category_limit'] = absint($params['category_limit']); |
|
578 | + $params = shortcode_atts($defaults, $atts, 'popular_post_category'); |
|
579 | + $params['category_limit'] = absint($params['category_limit']); |
|
580 | 580 | $params['default_post_type'] = gdsc_is_post_type_valid($params['default_post_type']) ? $params['default_post_type'] : ''; |
581 | - geodir_popular_post_category_output($params, $params); |
|
581 | + geodir_popular_post_category_output($params, $params); |
|
582 | 582 | |
583 | - $output = ob_get_contents(); |
|
583 | + $output = ob_get_contents(); |
|
584 | 584 | |
585 | - ob_end_clean(); |
|
585 | + ob_end_clean(); |
|
586 | 586 | |
587 | - return $output; |
|
587 | + return $output; |
|
588 | 588 | } |
589 | 589 | |
590 | 590 | add_shortcode('gd_popular_post_view', 'geodir_sc_popular_post_view'); |
@@ -624,97 +624,97 @@ discard block |
||
624 | 624 | */ |
625 | 625 | function geodir_sc_popular_post_view($atts) |
626 | 626 | { |
627 | - ob_start(); |
|
628 | - $defaults = array( |
|
629 | - 'post_type' => 'gd_place', |
|
630 | - 'category' => '0', |
|
631 | - 'post_number' => '5', |
|
632 | - 'layout' => 'gridview_onehalf', |
|
633 | - 'add_location_filter' => '0', |
|
634 | - 'list_sort' => 'latest', |
|
635 | - 'use_viewing_post_type' => '1', |
|
636 | - 'character_count' => '20', |
|
637 | - 'listing_width' => '', |
|
638 | - 'show_featured_only' => '0', |
|
639 | - 'show_special_only' => '0', |
|
640 | - 'with_pics_only' => '0', |
|
641 | - 'with_videos_only' => '0', |
|
642 | - 'before_widget' => '', |
|
643 | - 'after_widget' => '', |
|
644 | - 'before_title' => '<h3 class="widget-title">', |
|
645 | - 'after_title' => '</h3>', |
|
646 | - 'title' => '', |
|
647 | - 'category_title' => '', |
|
648 | - ); |
|
649 | - |
|
650 | - $params = shortcode_atts($defaults, $atts); |
|
651 | - |
|
652 | - /** |
|
653 | - * Validate our incoming params |
|
654 | - */ |
|
627 | + ob_start(); |
|
628 | + $defaults = array( |
|
629 | + 'post_type' => 'gd_place', |
|
630 | + 'category' => '0', |
|
631 | + 'post_number' => '5', |
|
632 | + 'layout' => 'gridview_onehalf', |
|
633 | + 'add_location_filter' => '0', |
|
634 | + 'list_sort' => 'latest', |
|
635 | + 'use_viewing_post_type' => '1', |
|
636 | + 'character_count' => '20', |
|
637 | + 'listing_width' => '', |
|
638 | + 'show_featured_only' => '0', |
|
639 | + 'show_special_only' => '0', |
|
640 | + 'with_pics_only' => '0', |
|
641 | + 'with_videos_only' => '0', |
|
642 | + 'before_widget' => '', |
|
643 | + 'after_widget' => '', |
|
644 | + 'before_title' => '<h3 class="widget-title">', |
|
645 | + 'after_title' => '</h3>', |
|
646 | + 'title' => '', |
|
647 | + 'category_title' => '', |
|
648 | + ); |
|
655 | 649 | |
656 | - // Validate the selected post type, default to gd_place on fail |
|
657 | - if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
658 | - $params['post_type'] = 'gd_place'; |
|
659 | - } |
|
660 | - |
|
661 | - // Validate the selected category/ies - Grab the current list based on post_type |
|
662 | - $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
663 | - $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids')); |
|
664 | - |
|
665 | - // Make sure we have an array |
|
666 | - if (!(is_array($params['category']))) { |
|
667 | - $params['category'] = explode(',', $params['category']); |
|
668 | - } |
|
669 | - |
|
670 | - // Array_intersect returns only the items in $params['category'] that are also in our category list |
|
671 | - // Otherwise it becomes empty and later on that will mean "All" |
|
672 | - $params['category'] = array_intersect($params['category'], $categories); |
|
673 | - |
|
674 | - // Post_number needs to be a positive integer |
|
675 | - $params['post_number'] = absint($params['post_number']); |
|
676 | - if (0 == $params['post_number']) { |
|
677 | - $params['post_number'] = 1; |
|
678 | - } |
|
679 | - |
|
680 | - // Validate our layout choice |
|
681 | - // Outside of the norm, I added some more simple terms to match the existing |
|
682 | - // So now I just run the switch to set it properly. |
|
683 | - $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
684 | - |
|
685 | - // Validate our sorting choice |
|
686 | - $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
687 | - |
|
688 | - // Validate character_count |
|
689 | - $params['character_count'] = absint($params['character_count']); |
|
690 | - if (20 > $params['character_count']) { |
|
691 | - $params['character_count'] = 20; |
|
692 | - } |
|
693 | - |
|
694 | - // Validate Listing width, used in the template widget-listing-listview.php |
|
695 | - // The context is in width=$listing_width% - So we need a positive number between 0 & 100 |
|
696 | - $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
697 | - |
|
698 | - // Validate the checkboxes used on the widget |
|
699 | - $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
700 | - $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']); |
|
701 | - $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']); |
|
702 | - $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']); |
|
703 | - $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']); |
|
704 | - $params['use_viewing_post_type'] = gdsc_to_bool_val($params['use_viewing_post_type']); |
|
705 | - |
|
706 | - /** |
|
707 | - * End of validation |
|
708 | - */ |
|
650 | + $params = shortcode_atts($defaults, $atts); |
|
651 | + |
|
652 | + /** |
|
653 | + * Validate our incoming params |
|
654 | + */ |
|
655 | + |
|
656 | + // Validate the selected post type, default to gd_place on fail |
|
657 | + if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
658 | + $params['post_type'] = 'gd_place'; |
|
659 | + } |
|
709 | 660 | |
710 | - geodir_popular_postview_output($params, $params); |
|
661 | + // Validate the selected category/ies - Grab the current list based on post_type |
|
662 | + $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
663 | + $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids')); |
|
711 | 664 | |
665 | + // Make sure we have an array |
|
666 | + if (!(is_array($params['category']))) { |
|
667 | + $params['category'] = explode(',', $params['category']); |
|
668 | + } |
|
669 | + |
|
670 | + // Array_intersect returns only the items in $params['category'] that are also in our category list |
|
671 | + // Otherwise it becomes empty and later on that will mean "All" |
|
672 | + $params['category'] = array_intersect($params['category'], $categories); |
|
673 | + |
|
674 | + // Post_number needs to be a positive integer |
|
675 | + $params['post_number'] = absint($params['post_number']); |
|
676 | + if (0 == $params['post_number']) { |
|
677 | + $params['post_number'] = 1; |
|
678 | + } |
|
712 | 679 | |
713 | - $output = ob_get_contents(); |
|
680 | + // Validate our layout choice |
|
681 | + // Outside of the norm, I added some more simple terms to match the existing |
|
682 | + // So now I just run the switch to set it properly. |
|
683 | + $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
714 | 684 | |
715 | - ob_end_clean(); |
|
685 | + // Validate our sorting choice |
|
686 | + $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
716 | 687 | |
717 | - return $output; |
|
688 | + // Validate character_count |
|
689 | + $params['character_count'] = absint($params['character_count']); |
|
690 | + if (20 > $params['character_count']) { |
|
691 | + $params['character_count'] = 20; |
|
692 | + } |
|
693 | + |
|
694 | + // Validate Listing width, used in the template widget-listing-listview.php |
|
695 | + // The context is in width=$listing_width% - So we need a positive number between 0 & 100 |
|
696 | + $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
697 | + |
|
698 | + // Validate the checkboxes used on the widget |
|
699 | + $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
700 | + $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']); |
|
701 | + $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']); |
|
702 | + $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']); |
|
703 | + $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']); |
|
704 | + $params['use_viewing_post_type'] = gdsc_to_bool_val($params['use_viewing_post_type']); |
|
705 | + |
|
706 | + /** |
|
707 | + * End of validation |
|
708 | + */ |
|
709 | + |
|
710 | + geodir_popular_postview_output($params, $params); |
|
711 | + |
|
712 | + |
|
713 | + $output = ob_get_contents(); |
|
714 | + |
|
715 | + ob_end_clean(); |
|
716 | + |
|
717 | + return $output; |
|
718 | 718 | } |
719 | 719 | |
720 | 720 | add_shortcode('gd_recent_reviews', 'geodir_sc_recent_reviews'); |
@@ -736,37 +736,37 @@ discard block |
||
736 | 736 | * @return string Recent reviews HTML. |
737 | 737 | */ |
738 | 738 | function geodir_sc_recent_reviews($atts) { |
739 | - ob_start(); |
|
740 | - $defaults = array( |
|
739 | + ob_start(); |
|
740 | + $defaults = array( |
|
741 | 741 | 'title' => '', |
742 | 742 | 'count' => 5, |
743 | - ); |
|
743 | + ); |
|
744 | 744 | |
745 | - $params = shortcode_atts($defaults, $atts); |
|
745 | + $params = shortcode_atts($defaults, $atts); |
|
746 | 746 | |
747 | - $count = absint($params['count']); |
|
748 | - if (0 == $count) { |
|
749 | - $count = 1; |
|
750 | - } |
|
747 | + $count = absint($params['count']); |
|
748 | + if (0 == $count) { |
|
749 | + $count = 1; |
|
750 | + } |
|
751 | 751 | |
752 | 752 | $title = !empty($params['title']) ? __($params['title'], 'geodirectory') : ''; |
753 | 753 | |
754 | - $comments_li = geodir_get_recent_reviews(30, $count, 100, false); |
|
754 | + $comments_li = geodir_get_recent_reviews(30, $count, 100, false); |
|
755 | 755 | |
756 | - if ($comments_li) { |
|
757 | - if ($title != '') { ?> |
|
756 | + if ($comments_li) { |
|
757 | + if ($title != '') { ?> |
|
758 | 758 | <h3 class="geodir-sc-recent-reviews-title widget-title"><?php echo $title; ?></h3> |
759 | 759 | <?php } ?> |
760 | 760 | <div class="geodir_sc_recent_reviews_section"> |
761 | 761 | <ul class="geodir_sc_recent_reviews"><?php echo $comments_li; ?></ul> |
762 | 762 | </div> |
763 | 763 | <?php |
764 | - } |
|
765 | - $output = ob_get_contents(); |
|
764 | + } |
|
765 | + $output = ob_get_contents(); |
|
766 | 766 | |
767 | - ob_end_clean(); |
|
767 | + ob_end_clean(); |
|
768 | 768 | |
769 | - return $output; |
|
769 | + return $output; |
|
770 | 770 | } |
771 | 771 | |
772 | 772 | add_shortcode('gd_related_listings', 'geodir_sc_related_listings'); |
@@ -796,64 +796,64 @@ discard block |
||
796 | 796 | */ |
797 | 797 | function geodir_sc_related_listings($atts) |
798 | 798 | { |
799 | - ob_start(); |
|
800 | - $defaults = array( |
|
801 | - 'post_number' => 5, |
|
802 | - 'relate_to' => 'category', |
|
803 | - 'layout' => 'gridview_onehalf', |
|
804 | - 'add_location_filter' => 0, |
|
805 | - 'listing_width' => '', |
|
806 | - 'list_sort' => 'latest', |
|
807 | - 'character_count' => 20, |
|
808 | - 'is_widget' => 1, |
|
809 | - 'before_title' => '<style type="text/css">.geodir_category_list_view li{margin:0px!important}</style>', |
|
810 | - ); |
|
811 | - // The "before_title" code is an ugly & terrible hack. But it works for now. I should enqueue a new stylesheet. |
|
812 | - |
|
813 | - $params = shortcode_atts($defaults, $atts); |
|
814 | - |
|
815 | - /** |
|
816 | - * Begin validating parameters |
|
817 | - */ |
|
799 | + ob_start(); |
|
800 | + $defaults = array( |
|
801 | + 'post_number' => 5, |
|
802 | + 'relate_to' => 'category', |
|
803 | + 'layout' => 'gridview_onehalf', |
|
804 | + 'add_location_filter' => 0, |
|
805 | + 'listing_width' => '', |
|
806 | + 'list_sort' => 'latest', |
|
807 | + 'character_count' => 20, |
|
808 | + 'is_widget' => 1, |
|
809 | + 'before_title' => '<style type="text/css">.geodir_category_list_view li{margin:0px!important}</style>', |
|
810 | + ); |
|
811 | + // The "before_title" code is an ugly & terrible hack. But it works for now. I should enqueue a new stylesheet. |
|
812 | + |
|
813 | + $params = shortcode_atts($defaults, $atts); |
|
814 | + |
|
815 | + /** |
|
816 | + * Begin validating parameters |
|
817 | + */ |
|
818 | 818 | |
819 | - // Validate that post_number is a number and is 1 or higher |
|
820 | - $params['post_number'] = absint($params['post_number']); |
|
821 | - if (0 === $params['post_number']) { |
|
822 | - $params['post_number'] = 1; |
|
823 | - } |
|
819 | + // Validate that post_number is a number and is 1 or higher |
|
820 | + $params['post_number'] = absint($params['post_number']); |
|
821 | + if (0 === $params['post_number']) { |
|
822 | + $params['post_number'] = 1; |
|
823 | + } |
|
824 | 824 | |
825 | - // Validate relate_to - only category or tags |
|
826 | - $params['relate_to'] = geodir_strtolower($params['relate_to']); |
|
827 | - if ('category' != $params['relate_to'] && 'tags' != $params['relate_to']) { |
|
828 | - $params['relate_to'] = 'category'; |
|
829 | - } |
|
825 | + // Validate relate_to - only category or tags |
|
826 | + $params['relate_to'] = geodir_strtolower($params['relate_to']); |
|
827 | + if ('category' != $params['relate_to'] && 'tags' != $params['relate_to']) { |
|
828 | + $params['relate_to'] = 'category'; |
|
829 | + } |
|
830 | 830 | |
831 | - // Validate layout selection |
|
832 | - $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
831 | + // Validate layout selection |
|
832 | + $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
833 | 833 | |
834 | - // Validate sorting option |
|
835 | - $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
834 | + // Validate sorting option |
|
835 | + $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
836 | 836 | |
837 | - // Validate add_location_filter |
|
838 | - $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
837 | + // Validate add_location_filter |
|
838 | + $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
839 | 839 | |
840 | - // Validate listing_width |
|
841 | - $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
840 | + // Validate listing_width |
|
841 | + $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
842 | 842 | |
843 | - // Validate character_count |
|
844 | - $params['character_count'] = absint($params['character_count']); |
|
845 | - if (20 > $params['character_count']) { |
|
846 | - $params['character_count'] = 20; |
|
847 | - } |
|
843 | + // Validate character_count |
|
844 | + $params['character_count'] = absint($params['character_count']); |
|
845 | + if (20 > $params['character_count']) { |
|
846 | + $params['character_count'] = 20; |
|
847 | + } |
|
848 | 848 | |
849 | - if ($related_display = geodir_related_posts_display($params)) { |
|
850 | - echo $related_display; |
|
851 | - } |
|
852 | - $output = ob_get_contents(); |
|
849 | + if ($related_display = geodir_related_posts_display($params)) { |
|
850 | + echo $related_display; |
|
851 | + } |
|
852 | + $output = ob_get_contents(); |
|
853 | 853 | |
854 | - ob_end_clean(); |
|
854 | + ob_end_clean(); |
|
855 | 855 | |
856 | - return $output; |
|
856 | + return $output; |
|
857 | 857 | } |
858 | 858 | |
859 | 859 | /** |
@@ -877,12 +877,12 @@ discard block |
||
877 | 877 | * @return string Advanced search widget HTML. |
878 | 878 | */ |
879 | 879 | function geodir_sc_advanced_search($atts) { |
880 | - $defaults = array( |
|
880 | + $defaults = array( |
|
881 | 881 | 'title' => '', |
882 | 882 | 'before_widget' => '<section id="geodir_advanced_search-1" class="widget geodir-widget geodir_advanced_search_widget">', |
883 | - 'after_widget' => '</section>', |
|
884 | - 'before_title' => '<h3 class="widget-title">', |
|
885 | - 'after_title' => '</h3>', |
|
883 | + 'after_widget' => '</section>', |
|
884 | + 'before_title' => '<h3 class="widget-title">', |
|
885 | + 'after_title' => '</h3>', |
|
886 | 886 | 'show_adv_search' => 'default' |
887 | 887 | ); |
888 | 888 | |
@@ -906,9 +906,9 @@ discard block |
||
906 | 906 | the_widget('geodir_advance_search_widget', $params, $params ); |
907 | 907 | |
908 | 908 | $output = ob_get_contents(); |
909 | - ob_end_clean(); |
|
909 | + ob_end_clean(); |
|
910 | 910 | |
911 | - return $output; |
|
911 | + return $output; |
|
912 | 912 | } |
913 | 913 | add_shortcode('gd_advanced_search', 'geodir_sc_advanced_search'); |
914 | 914 | |
@@ -954,48 +954,48 @@ discard block |
||
954 | 954 | 'add_location_filter' => '1', |
955 | 955 | 'tab_layout' => 'bestof-tabs-on-top', |
956 | 956 | 'before_widget' => '<section id="bestof_widget-1" class="widget geodir-widget geodir_bestof_widget geodir_sc_bestof_widget">', |
957 | - 'after_widget' => '</section>', |
|
958 | - 'before_title' => '<h3 class="widget-title">', |
|
959 | - 'after_title' => '</h3>', |
|
957 | + 'after_widget' => '</section>', |
|
958 | + 'before_title' => '<h3 class="widget-title">', |
|
959 | + 'after_title' => '</h3>', |
|
960 | 960 | ); |
961 | 961 | $params = shortcode_atts($defaults, $atts); |
962 | 962 | |
963 | - /** |
|
964 | - * Validate our incoming params |
|
965 | - */ |
|
963 | + /** |
|
964 | + * Validate our incoming params |
|
965 | + */ |
|
966 | 966 | |
967 | - // Validate the selected post type, default to gd_place on fail |
|
968 | - if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
969 | - $params['post_type'] = 'gd_place'; |
|
970 | - } |
|
967 | + // Validate the selected post type, default to gd_place on fail |
|
968 | + if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
969 | + $params['post_type'] = 'gd_place'; |
|
970 | + } |
|
971 | 971 | |
972 | 972 | // Post limit needs to be a positive integer |
973 | - $params['post_limit'] = absint($params['post_limit']); |
|
974 | - if (0 == $params['post_limit']) { |
|
975 | - $params['post_limit'] = 5; |
|
976 | - } |
|
973 | + $params['post_limit'] = absint($params['post_limit']); |
|
974 | + if (0 == $params['post_limit']) { |
|
975 | + $params['post_limit'] = 5; |
|
976 | + } |
|
977 | 977 | |
978 | 978 | // Category limit needs to be a positive integer |
979 | - $params['categ_limit'] = absint($params['categ_limit']); |
|
980 | - if (0 == $params['categ_limit']) { |
|
981 | - $params['categ_limit'] = 3; |
|
982 | - } |
|
979 | + $params['categ_limit'] = absint($params['categ_limit']); |
|
980 | + if (0 == $params['categ_limit']) { |
|
981 | + $params['categ_limit'] = 3; |
|
982 | + } |
|
983 | 983 | |
984 | 984 | // Tab layout validation |
985 | - $params['tab_layout'] = $params['tab_layout']; |
|
986 | - if (!in_array($params['tab_layout'], array('bestof-tabs-on-top', 'bestof-tabs-on-left', 'bestof-tabs-as-dropdown'))) { |
|
987 | - $params['tab_layout'] = 'bestof-tabs-on-top'; |
|
988 | - } |
|
985 | + $params['tab_layout'] = $params['tab_layout']; |
|
986 | + if (!in_array($params['tab_layout'], array('bestof-tabs-on-top', 'bestof-tabs-on-left', 'bestof-tabs-as-dropdown'))) { |
|
987 | + $params['tab_layout'] = 'bestof-tabs-on-top'; |
|
988 | + } |
|
989 | 989 | |
990 | 990 | // Validate character_count |
991 | - $params['character_count'] = $params['character_count']; |
|
991 | + $params['character_count'] = $params['character_count']; |
|
992 | 992 | |
993 | 993 | ob_start(); |
994 | 994 | the_widget('geodir_bestof_widget', $params, $params); |
995 | - $output = ob_get_contents(); |
|
996 | - ob_end_clean(); |
|
995 | + $output = ob_get_contents(); |
|
996 | + ob_end_clean(); |
|
997 | 997 | |
998 | - return $output; |
|
998 | + return $output; |
|
999 | 999 | } |
1000 | 1000 | add_shortcode('gd_bestof_widget', 'geodir_sc_bestof_widget'); |
1001 | 1001 | |
@@ -1041,113 +1041,113 @@ discard block |
||
1041 | 1041 | * @return string HTML content to display geodirectory listings. |
1042 | 1042 | */ |
1043 | 1043 | function geodir_sc_gd_listings($atts, $content = '') { |
1044 | - global $post; |
|
1044 | + global $post; |
|
1045 | 1045 | |
1046 | - $defaults = array( |
|
1047 | - 'title' => '', |
|
1048 | - 'post_type' => 'gd_place', |
|
1049 | - 'category' => 0, |
|
1050 | - 'list_sort' => 'latest', |
|
1051 | - 'event_type' => '', |
|
1052 | - 'post_number' => 10, |
|
1053 | - 'post_author' => '', |
|
1054 | - 'layout' => 'gridview_onehalf', |
|
1055 | - 'listing_width' => '', |
|
1056 | - 'character_count' => 20, |
|
1057 | - 'add_location_filter' => 1, |
|
1058 | - 'show_featured_only' => '', |
|
1059 | - 'show_special_only' => '', |
|
1060 | - 'with_pics_only' => '', |
|
1061 | - 'with_videos_only' => '', |
|
1062 | - 'with_pagination' => '1', |
|
1063 | - 'top_pagination' => '0', |
|
1064 | - 'bottom_pagination' => '1', |
|
1065 | - 'without_no_results' => 0, |
|
1066 | - ); |
|
1067 | - $params = shortcode_atts($defaults, $atts); |
|
1068 | - |
|
1069 | - $params['title'] = wp_strip_all_tags($params['title']); |
|
1070 | - $params['post_type'] = gdsc_is_post_type_valid($params['post_type']) ? $params['post_type'] : 'gd_place'; |
|
1071 | - |
|
1072 | - // Validate the selected category/ies - Grab the current list based on post_type |
|
1073 | - $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
1074 | - $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids')); |
|
1075 | - |
|
1076 | - // Make sure we have an array |
|
1077 | - if (!(is_array($params['category']))) { |
|
1078 | - $params['category'] = explode(',', $params['category']); |
|
1079 | - } |
|
1080 | - |
|
1081 | - // Array_intersect returns only the items in $params['category'] that are also in our category list |
|
1082 | - // Otherwise it becomes empty and later on that will mean "All" |
|
1083 | - $params['category'] = array_intersect($params['category'], $categories); |
|
1084 | - |
|
1085 | - // Post_number needs to be a positive integer |
|
1086 | - $params['post_number'] = absint($params['post_number']); |
|
1087 | - $params['post_number'] = $params['post_number'] > 0 ? $params['post_number'] : 10; |
|
1046 | + $defaults = array( |
|
1047 | + 'title' => '', |
|
1048 | + 'post_type' => 'gd_place', |
|
1049 | + 'category' => 0, |
|
1050 | + 'list_sort' => 'latest', |
|
1051 | + 'event_type' => '', |
|
1052 | + 'post_number' => 10, |
|
1053 | + 'post_author' => '', |
|
1054 | + 'layout' => 'gridview_onehalf', |
|
1055 | + 'listing_width' => '', |
|
1056 | + 'character_count' => 20, |
|
1057 | + 'add_location_filter' => 1, |
|
1058 | + 'show_featured_only' => '', |
|
1059 | + 'show_special_only' => '', |
|
1060 | + 'with_pics_only' => '', |
|
1061 | + 'with_videos_only' => '', |
|
1062 | + 'with_pagination' => '1', |
|
1063 | + 'top_pagination' => '0', |
|
1064 | + 'bottom_pagination' => '1', |
|
1065 | + 'without_no_results' => 0, |
|
1066 | + ); |
|
1067 | + $params = shortcode_atts($defaults, $atts); |
|
1068 | + |
|
1069 | + $params['title'] = wp_strip_all_tags($params['title']); |
|
1070 | + $params['post_type'] = gdsc_is_post_type_valid($params['post_type']) ? $params['post_type'] : 'gd_place'; |
|
1071 | + |
|
1072 | + // Validate the selected category/ies - Grab the current list based on post_type |
|
1073 | + $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
1074 | + $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids')); |
|
1075 | + |
|
1076 | + // Make sure we have an array |
|
1077 | + if (!(is_array($params['category']))) { |
|
1078 | + $params['category'] = explode(',', $params['category']); |
|
1079 | + } |
|
1080 | + |
|
1081 | + // Array_intersect returns only the items in $params['category'] that are also in our category list |
|
1082 | + // Otherwise it becomes empty and later on that will mean "All" |
|
1083 | + $params['category'] = array_intersect($params['category'], $categories); |
|
1084 | + |
|
1085 | + // Post_number needs to be a positive integer |
|
1086 | + $params['post_number'] = absint($params['post_number']); |
|
1087 | + $params['post_number'] = $params['post_number'] > 0 ? $params['post_number'] : 10; |
|
1088 | 1088 | |
1089 | - // Post_number needs to be a positive integer |
|
1090 | - if (!empty($atts['post_author'])) { |
|
1091 | - if ($atts['post_author'] == 'current' && !empty($post) && isset($post->post_author) && $post->post_type != 'page') { |
|
1092 | - $params['post_author'] = $post->post_author; |
|
1093 | - } else if ($atts['post_author'] != 'current' && absint($atts['post_author']) > 0) { |
|
1094 | - $params['post_author'] = absint($atts['post_author']); |
|
1095 | - } else { |
|
1096 | - unset($params['post_author']); |
|
1097 | - } |
|
1098 | - } else { |
|
1099 | - unset($params['post_author']); |
|
1100 | - } |
|
1101 | - |
|
1102 | - // Validate character_count |
|
1103 | - //todo: is this necessary? |
|
1104 | - $params['character_count'] = $params['character_count']; |
|
1105 | - |
|
1106 | - // Validate our layout choice |
|
1107 | - // Outside of the norm, I added some more simple terms to match the existing |
|
1108 | - // So now I just run the switch to set it properly. |
|
1109 | - $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
1110 | - |
|
1111 | - // Validate our sorting choice |
|
1112 | - $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
1113 | - |
|
1114 | - // Validate Listing width, used in the template widget-listing-listview.php |
|
1115 | - // The context is in width=$listing_width% - So we need a positive number between 0 & 100 |
|
1116 | - $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
1117 | - |
|
1118 | - // Validate the checkboxes used on the widget |
|
1119 | - $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
1120 | - $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']); |
|
1121 | - $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']); |
|
1122 | - $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']); |
|
1123 | - $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']); |
|
1124 | - $params['with_pagination'] = gdsc_to_bool_val($params['with_pagination']); |
|
1125 | - $params['top_pagination'] = gdsc_to_bool_val($params['top_pagination']); |
|
1126 | - $params['bottom_pagination'] = gdsc_to_bool_val($params['bottom_pagination']); |
|
1127 | - |
|
1128 | - /** |
|
1129 | - * End of validation |
|
1130 | - */ |
|
1131 | - if (isset($atts['geodir_ajax'])) { |
|
1132 | - $params['geodir_ajax'] = $atts['geodir_ajax']; |
|
1133 | - unset($atts['geodir_ajax']); |
|
1134 | - } |
|
1135 | - if (isset($atts['pageno'])) { |
|
1136 | - $params['pageno'] = $atts['pageno']; |
|
1137 | - unset($atts['pageno']); |
|
1138 | - } |
|
1139 | - |
|
1140 | - if ( !empty($atts['shortcode_content']) ) { |
|
1141 | - $content = $atts['shortcode_content']; |
|
1142 | - } |
|
1143 | - $params['shortcode_content'] = trim($content); |
|
1144 | - $atts['shortcode_content'] = trim($content); |
|
1089 | + // Post_number needs to be a positive integer |
|
1090 | + if (!empty($atts['post_author'])) { |
|
1091 | + if ($atts['post_author'] == 'current' && !empty($post) && isset($post->post_author) && $post->post_type != 'page') { |
|
1092 | + $params['post_author'] = $post->post_author; |
|
1093 | + } else if ($atts['post_author'] != 'current' && absint($atts['post_author']) > 0) { |
|
1094 | + $params['post_author'] = absint($atts['post_author']); |
|
1095 | + } else { |
|
1096 | + unset($params['post_author']); |
|
1097 | + } |
|
1098 | + } else { |
|
1099 | + unset($params['post_author']); |
|
1100 | + } |
|
1101 | + |
|
1102 | + // Validate character_count |
|
1103 | + //todo: is this necessary? |
|
1104 | + $params['character_count'] = $params['character_count']; |
|
1105 | + |
|
1106 | + // Validate our layout choice |
|
1107 | + // Outside of the norm, I added some more simple terms to match the existing |
|
1108 | + // So now I just run the switch to set it properly. |
|
1109 | + $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
1110 | + |
|
1111 | + // Validate our sorting choice |
|
1112 | + $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
1113 | + |
|
1114 | + // Validate Listing width, used in the template widget-listing-listview.php |
|
1115 | + // The context is in width=$listing_width% - So we need a positive number between 0 & 100 |
|
1116 | + $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
1117 | + |
|
1118 | + // Validate the checkboxes used on the widget |
|
1119 | + $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
1120 | + $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']); |
|
1121 | + $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']); |
|
1122 | + $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']); |
|
1123 | + $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']); |
|
1124 | + $params['with_pagination'] = gdsc_to_bool_val($params['with_pagination']); |
|
1125 | + $params['top_pagination'] = gdsc_to_bool_val($params['top_pagination']); |
|
1126 | + $params['bottom_pagination'] = gdsc_to_bool_val($params['bottom_pagination']); |
|
1127 | + |
|
1128 | + /** |
|
1129 | + * End of validation |
|
1130 | + */ |
|
1131 | + if (isset($atts['geodir_ajax'])) { |
|
1132 | + $params['geodir_ajax'] = $atts['geodir_ajax']; |
|
1133 | + unset($atts['geodir_ajax']); |
|
1134 | + } |
|
1135 | + if (isset($atts['pageno'])) { |
|
1136 | + $params['pageno'] = $atts['pageno']; |
|
1137 | + unset($atts['pageno']); |
|
1138 | + } |
|
1139 | + |
|
1140 | + if ( !empty($atts['shortcode_content']) ) { |
|
1141 | + $content = $atts['shortcode_content']; |
|
1142 | + } |
|
1143 | + $params['shortcode_content'] = trim($content); |
|
1144 | + $atts['shortcode_content'] = trim($content); |
|
1145 | 1145 | |
1146 | - $params['shortcode_atts'] = $atts; |
|
1146 | + $params['shortcode_atts'] = $atts; |
|
1147 | 1147 | |
1148 | - $output = geodir_sc_gd_listings_output($params); |
|
1148 | + $output = geodir_sc_gd_listings_output($params); |
|
1149 | 1149 | |
1150 | - return $output; |
|
1150 | + return $output; |
|
1151 | 1151 | } |
1152 | 1152 | add_shortcode('gd_listings', 'geodir_sc_gd_listings'); |
1153 | 1153 | |
@@ -1195,23 +1195,23 @@ discard block |
||
1195 | 1195 | 'max_count' => 'all', |
1196 | 1196 | 'max_level' => '1', |
1197 | 1197 | 'before_widget' => '<section id="geodir_cpt_categories_widget-1" class="widget geodir-widget geodir_cpt_categories_widget geodir_sc_cpt_categories_widget">', |
1198 | - 'after_widget' => '</section>', |
|
1199 | - 'before_title' => '<h3 class="widget-title">', |
|
1200 | - 'after_title' => '</h3>', |
|
1198 | + 'after_widget' => '</section>', |
|
1199 | + 'before_title' => '<h3 class="widget-title">', |
|
1200 | + 'after_title' => '</h3>', |
|
1201 | 1201 | ); |
1202 | 1202 | $params = shortcode_atts($defaults, $atts); |
1203 | 1203 | |
1204 | - /** |
|
1205 | - * Validate our incoming params |
|
1206 | - */ |
|
1204 | + /** |
|
1205 | + * Validate our incoming params |
|
1206 | + */ |
|
1207 | 1207 | // Make sure we have an array |
1208 | - $params['post_type'] = !is_array($params['post_type']) && trim($params['post_type']) != '' ? explode(',', trim($params['post_type'])) : array(); |
|
1208 | + $params['post_type'] = !is_array($params['post_type']) && trim($params['post_type']) != '' ? explode(',', trim($params['post_type'])) : array(); |
|
1209 | 1209 | |
1210 | 1210 | // Validate the checkboxes used on the widget |
1211 | - $params['hide_empty'] = gdsc_to_bool_val($params['hide_empty']); |
|
1212 | - $params['show_count'] = gdsc_to_bool_val($params['show_count']); |
|
1213 | - $params['hide_icon'] = gdsc_to_bool_val($params['hide_icon']); |
|
1214 | - $params['cpt_left'] = gdsc_to_bool_val($params['cpt_left']); |
|
1211 | + $params['hide_empty'] = gdsc_to_bool_val($params['hide_empty']); |
|
1212 | + $params['show_count'] = gdsc_to_bool_val($params['show_count']); |
|
1213 | + $params['hide_icon'] = gdsc_to_bool_val($params['hide_icon']); |
|
1214 | + $params['cpt_left'] = gdsc_to_bool_val($params['cpt_left']); |
|
1215 | 1215 | |
1216 | 1216 | if ($params['max_count'] != 'all') { |
1217 | 1217 | $params['max_count'] = absint($params['max_count']); |
@@ -1225,10 +1225,10 @@ discard block |
||
1225 | 1225 | |
1226 | 1226 | ob_start(); |
1227 | 1227 | the_widget('geodir_cpt_categories_widget', $params, $params); |
1228 | - $output = ob_get_contents(); |
|
1229 | - ob_end_clean(); |
|
1228 | + $output = ob_get_contents(); |
|
1229 | + ob_end_clean(); |
|
1230 | 1230 | |
1231 | - return $output; |
|
1231 | + return $output; |
|
1232 | 1232 | } |
1233 | 1233 | add_shortcode('gd_cpt_categories', 'geodir_sc_cpt_categories_widget'); |
1234 | 1234 | ?> |
1235 | 1235 | \ No newline at end of file |
@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Plugin general functions |
|
4 | - * |
|
5 | - * @since 1.0.0 |
|
6 | - * @package GeoDirectory |
|
7 | - */ |
|
3 | + * Plugin general functions |
|
4 | + * |
|
5 | + * @since 1.0.0 |
|
6 | + * @package GeoDirectory |
|
7 | + */ |
|
8 | 8 | |
9 | 9 | |
10 | 10 | /** |
@@ -28,11 +28,11 @@ discard block |
||
28 | 28 | function geodir_plugin_url() |
29 | 29 | { |
30 | 30 | |
31 | - if (is_ssl()) : |
|
32 | - return str_replace('http://', 'https://', WP_PLUGIN_URL) . "/" . plugin_basename(dirname(dirname(__FILE__))); |
|
33 | - else : |
|
34 | - return WP_PLUGIN_URL . "/" . plugin_basename(dirname(dirname(__FILE__))); |
|
35 | - endif; |
|
31 | + if (is_ssl()) : |
|
32 | + return str_replace('http://', 'https://', WP_PLUGIN_URL) . "/" . plugin_basename(dirname(dirname(__FILE__))); |
|
33 | + else : |
|
34 | + return WP_PLUGIN_URL . "/" . plugin_basename(dirname(dirname(__FILE__))); |
|
35 | + endif; |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -47,11 +47,11 @@ discard block |
||
47 | 47 | */ |
48 | 48 | function geodir_plugin_path() |
49 | 49 | { |
50 | - if ( defined( 'GD_TESTING_MODE' ) && GD_TESTING_MODE ) { |
|
51 | - return dirname(dirname(__FILE__)); |
|
52 | - } else { |
|
53 | - return WP_PLUGIN_DIR . "/" . plugin_basename(dirname(dirname(__FILE__))); |
|
54 | - } |
|
50 | + if ( defined( 'GD_TESTING_MODE' ) && GD_TESTING_MODE ) { |
|
51 | + return dirname(dirname(__FILE__)); |
|
52 | + } else { |
|
53 | + return WP_PLUGIN_DIR . "/" . plugin_basename(dirname(dirname(__FILE__))); |
|
54 | + } |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -65,11 +65,11 @@ discard block |
||
65 | 65 | */ |
66 | 66 | function geodir_is_plugin_active($plugin) |
67 | 67 | { |
68 | - $active_plugins = get_option('active_plugins'); |
|
69 | - foreach ($active_plugins as $key => $active_plugin) { |
|
70 | - if (strstr($active_plugin, $plugin)) return true; |
|
71 | - } |
|
72 | - return false; |
|
68 | + $active_plugins = get_option('active_plugins'); |
|
69 | + foreach ($active_plugins as $key => $active_plugin) { |
|
70 | + if (strstr($active_plugin, $plugin)) return true; |
|
71 | + } |
|
72 | + return false; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | */ |
86 | 86 | function geodir_get_formated_date($date) |
87 | 87 | { |
88 | - return mysql2date(get_option('date_format'), $date); |
|
88 | + return mysql2date(get_option('date_format'), $date); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | */ |
101 | 101 | function geodir_get_formated_time($time) |
102 | 102 | { |
103 | - return mysql2date(get_option('time_format'), $time, $translate = true); |
|
103 | + return mysql2date(get_option('time_format'), $time, $translate = true); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | |
@@ -118,26 +118,26 @@ discard block |
||
118 | 118 | */ |
119 | 119 | function geodir_getlink($url, $params = array(), $use_existing_arguments = false) |
120 | 120 | { |
121 | - if ($use_existing_arguments) $params = $params + $_GET; |
|
122 | - if (!$params) return $url; |
|
123 | - $link = $url; |
|
124 | - if (strpos($link, '?') === false) $link .= '?'; //If there is no '?' add one at the end |
|
125 | - elseif (strpos($link, '//maps.google.com/maps/api/js?language=')) $link .= '&'; //If there is no '&' at the END, add one. |
|
126 | - elseif (!preg_match('/(\?|\&(amp;)?)$/', $link)) $link .= '&'; //If there is no '&' at the END, add one. |
|
127 | - |
|
128 | - $params_arr = array(); |
|
129 | - foreach ($params as $key => $value) { |
|
130 | - if (gettype($value) == 'array') { //Handle array data properly |
|
131 | - foreach ($value as $val) { |
|
132 | - $params_arr[] = $key . '[]=' . urlencode($val); |
|
133 | - } |
|
134 | - } else { |
|
135 | - $params_arr[] = $key . '=' . urlencode($value); |
|
136 | - } |
|
137 | - } |
|
138 | - $link .= implode('&', $params_arr); |
|
139 | - |
|
140 | - return $link; |
|
121 | + if ($use_existing_arguments) $params = $params + $_GET; |
|
122 | + if (!$params) return $url; |
|
123 | + $link = $url; |
|
124 | + if (strpos($link, '?') === false) $link .= '?'; //If there is no '?' add one at the end |
|
125 | + elseif (strpos($link, '//maps.google.com/maps/api/js?language=')) $link .= '&'; //If there is no '&' at the END, add one. |
|
126 | + elseif (!preg_match('/(\?|\&(amp;)?)$/', $link)) $link .= '&'; //If there is no '&' at the END, add one. |
|
127 | + |
|
128 | + $params_arr = array(); |
|
129 | + foreach ($params as $key => $value) { |
|
130 | + if (gettype($value) == 'array') { //Handle array data properly |
|
131 | + foreach ($value as $val) { |
|
132 | + $params_arr[] = $key . '[]=' . urlencode($val); |
|
133 | + } |
|
134 | + } else { |
|
135 | + $params_arr[] = $key . '=' . urlencode($value); |
|
136 | + } |
|
137 | + } |
|
138 | + $link .= implode('&', $params_arr); |
|
139 | + |
|
140 | + return $link; |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | |
@@ -152,17 +152,17 @@ discard block |
||
152 | 152 | */ |
153 | 153 | function geodir_get_addlisting_link($post_type = '') |
154 | 154 | { |
155 | - global $wpdb; |
|
155 | + global $wpdb; |
|
156 | 156 | |
157 | - //$check_pkg = $wpdb->get_var("SELECT pid FROM ".GEODIR_PRICE_TABLE." WHERE post_type='".$post_type."' and status != '0'"); |
|
158 | - $check_pkg = 1; |
|
159 | - if (post_type_exists($post_type) && $check_pkg) { |
|
157 | + //$check_pkg = $wpdb->get_var("SELECT pid FROM ".GEODIR_PRICE_TABLE." WHERE post_type='".$post_type."' and status != '0'"); |
|
158 | + $check_pkg = 1; |
|
159 | + if (post_type_exists($post_type) && $check_pkg) { |
|
160 | 160 | |
161 | - $add_listing_link = get_page_link(geodir_add_listing_page_id()); |
|
161 | + $add_listing_link = get_page_link(geodir_add_listing_page_id()); |
|
162 | 162 | |
163 | - return esc_url( add_query_arg(array('listing_type' => $post_type), $add_listing_link) ); |
|
164 | - } else |
|
165 | - return get_bloginfo('url'); |
|
163 | + return esc_url( add_query_arg(array('listing_type' => $post_type), $add_listing_link) ); |
|
164 | + } else |
|
165 | + return get_bloginfo('url'); |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | /** |
@@ -175,19 +175,19 @@ discard block |
||
175 | 175 | */ |
176 | 176 | function geodir_curPageURL() |
177 | 177 | { |
178 | - $pageURL = 'http'; |
|
179 | - if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") { |
|
180 | - $pageURL .= "s"; |
|
181 | - } |
|
182 | - $pageURL .= "://"; |
|
183 | - $pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]; |
|
184 | - /** |
|
185 | - * Filter the current page URL returned by function geodir_curPageURL(). |
|
186 | - * |
|
187 | - * @since 1.4.1 |
|
188 | - * @param string $pageURL The URL of the current page. |
|
189 | - */ |
|
190 | - return apply_filters('geodir_curPageURL', $pageURL); |
|
178 | + $pageURL = 'http'; |
|
179 | + if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") { |
|
180 | + $pageURL .= "s"; |
|
181 | + } |
|
182 | + $pageURL .= "://"; |
|
183 | + $pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]; |
|
184 | + /** |
|
185 | + * Filter the current page URL returned by function geodir_curPageURL(). |
|
186 | + * |
|
187 | + * @since 1.4.1 |
|
188 | + * @param string $pageURL The URL of the current page. |
|
189 | + */ |
|
190 | + return apply_filters('geodir_curPageURL', $pageURL); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | |
@@ -204,12 +204,12 @@ discard block |
||
204 | 204 | function geodir_clean($string) |
205 | 205 | { |
206 | 206 | |
207 | - $string = trim(strip_tags(stripslashes($string))); |
|
208 | - $string = str_replace(" ", "-", $string); // Replaces all spaces with hyphens. |
|
209 | - $string = preg_replace('/[^A-Za-z0-9\-\_]/', '', $string); // Removes special chars. |
|
210 | - $string = preg_replace('/-+/', '-', $string); // Replaces multiple hyphens with single one. |
|
207 | + $string = trim(strip_tags(stripslashes($string))); |
|
208 | + $string = str_replace(" ", "-", $string); // Replaces all spaces with hyphens. |
|
209 | + $string = preg_replace('/[^A-Za-z0-9\-\_]/', '', $string); // Removes special chars. |
|
210 | + $string = preg_replace('/-+/', '-', $string); // Replaces multiple hyphens with single one. |
|
211 | 211 | |
212 | - return $string; |
|
212 | + return $string; |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | /** |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | */ |
222 | 222 | function geodir_get_weekday() |
223 | 223 | { |
224 | - return array(__('Sunday', 'geodirectory'), __('Monday', 'geodirectory'), __('Tuesday', 'geodirectory'), __('Wednesday', 'geodirectory'), __('Thursday', 'geodirectory'), __('Friday', 'geodirectory'), __('Saturday', 'geodirectory')); |
|
224 | + return array(__('Sunday', 'geodirectory'), __('Monday', 'geodirectory'), __('Tuesday', 'geodirectory'), __('Wednesday', 'geodirectory'), __('Thursday', 'geodirectory'), __('Friday', 'geodirectory'), __('Saturday', 'geodirectory')); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | /** |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | */ |
234 | 234 | function geodir_get_weeks() |
235 | 235 | { |
236 | - return array(__('First', 'geodirectory'), __('Second', 'geodirectory'), __('Third', 'geodirectory'), __('Fourth', 'geodirectory'), __('Last', 'geodirectory')); |
|
236 | + return array(__('First', 'geodirectory'), __('Second', 'geodirectory'), __('Third', 'geodirectory'), __('Fourth', 'geodirectory'), __('Last', 'geodirectory')); |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | |
@@ -252,103 +252,103 @@ discard block |
||
252 | 252 | function geodir_is_page($gdpage = '') |
253 | 253 | { |
254 | 254 | |
255 | - global $wp_query, $post,$wp; |
|
256 | - //if(!is_admin()): |
|
257 | - |
|
258 | - switch ($gdpage): |
|
259 | - case 'add-listing': |
|
260 | - |
|
261 | - if (is_page() && get_query_var('page_id') == geodir_add_listing_page_id()) { |
|
262 | - return true; |
|
263 | - } elseif (is_page() && isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) { |
|
264 | - return true; |
|
265 | - } |
|
266 | - |
|
267 | - break; |
|
268 | - case 'preview': |
|
269 | - if ((is_page() && get_query_var('page_id') == geodir_preview_page_id()) && isset($_REQUEST['listing_type']) |
|
270 | - && in_array($_REQUEST['listing_type'], geodir_get_posttypes()) |
|
271 | - ) |
|
272 | - return true; |
|
273 | - break; |
|
274 | - case 'listing-success': |
|
275 | - if (is_page() && get_query_var('page_id') == geodir_success_page_id()) |
|
276 | - return true; |
|
277 | - break; |
|
278 | - case 'detail': |
|
279 | - $post_type = get_query_var('post_type'); |
|
280 | - if(is_array($post_type)){$post_type = reset($post_type);} |
|
281 | - if (is_single() && in_array($post_type, geodir_get_posttypes())) |
|
282 | - return true; |
|
283 | - break; |
|
284 | - case 'pt': |
|
285 | - $post_type = get_query_var('post_type'); |
|
286 | - if(is_array($post_type)){$post_type = reset($post_type);} |
|
287 | - if (is_post_type_archive() && in_array($post_type , geodir_get_posttypes()) && !is_tax()) |
|
288 | - return true; |
|
289 | - |
|
290 | - break; |
|
291 | - case 'listing': |
|
292 | - if (is_tax() && geodir_get_taxonomy_posttype()) { |
|
293 | - global $current_term, $taxonomy, $term; |
|
294 | - |
|
295 | - return true; |
|
296 | - } |
|
297 | - $post_type = get_query_var('post_type'); |
|
298 | - if(is_array($post_type)){$post_type = reset($post_type);} |
|
299 | - if (is_post_type_archive() && in_array($post_type, geodir_get_posttypes())) |
|
300 | - return true; |
|
301 | - |
|
302 | - break; |
|
303 | - case 'home': |
|
304 | - |
|
305 | - if ((is_page() && get_query_var('page_id') == geodir_home_page_id()) || is_page_geodir_home()) |
|
306 | - return true; |
|
307 | - |
|
308 | - break; |
|
309 | - case 'location': |
|
310 | - if (is_page() && get_query_var('page_id') == geodir_location_page_id()) |
|
311 | - return true; |
|
312 | - break; |
|
313 | - case 'author': |
|
314 | - if (is_author() && isset($_REQUEST['geodir_dashbord'])) |
|
315 | - return true; |
|
255 | + global $wp_query, $post,$wp; |
|
256 | + //if(!is_admin()): |
|
257 | + |
|
258 | + switch ($gdpage): |
|
259 | + case 'add-listing': |
|
260 | + |
|
261 | + if (is_page() && get_query_var('page_id') == geodir_add_listing_page_id()) { |
|
262 | + return true; |
|
263 | + } elseif (is_page() && isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) { |
|
264 | + return true; |
|
265 | + } |
|
266 | + |
|
267 | + break; |
|
268 | + case 'preview': |
|
269 | + if ((is_page() && get_query_var('page_id') == geodir_preview_page_id()) && isset($_REQUEST['listing_type']) |
|
270 | + && in_array($_REQUEST['listing_type'], geodir_get_posttypes()) |
|
271 | + ) |
|
272 | + return true; |
|
273 | + break; |
|
274 | + case 'listing-success': |
|
275 | + if (is_page() && get_query_var('page_id') == geodir_success_page_id()) |
|
276 | + return true; |
|
277 | + break; |
|
278 | + case 'detail': |
|
279 | + $post_type = get_query_var('post_type'); |
|
280 | + if(is_array($post_type)){$post_type = reset($post_type);} |
|
281 | + if (is_single() && in_array($post_type, geodir_get_posttypes())) |
|
282 | + return true; |
|
283 | + break; |
|
284 | + case 'pt': |
|
285 | + $post_type = get_query_var('post_type'); |
|
286 | + if(is_array($post_type)){$post_type = reset($post_type);} |
|
287 | + if (is_post_type_archive() && in_array($post_type , geodir_get_posttypes()) && !is_tax()) |
|
288 | + return true; |
|
289 | + |
|
290 | + break; |
|
291 | + case 'listing': |
|
292 | + if (is_tax() && geodir_get_taxonomy_posttype()) { |
|
293 | + global $current_term, $taxonomy, $term; |
|
294 | + |
|
295 | + return true; |
|
296 | + } |
|
297 | + $post_type = get_query_var('post_type'); |
|
298 | + if(is_array($post_type)){$post_type = reset($post_type);} |
|
299 | + if (is_post_type_archive() && in_array($post_type, geodir_get_posttypes())) |
|
300 | + return true; |
|
301 | + |
|
302 | + break; |
|
303 | + case 'home': |
|
304 | + |
|
305 | + if ((is_page() && get_query_var('page_id') == geodir_home_page_id()) || is_page_geodir_home()) |
|
306 | + return true; |
|
307 | + |
|
308 | + break; |
|
309 | + case 'location': |
|
310 | + if (is_page() && get_query_var('page_id') == geodir_location_page_id()) |
|
311 | + return true; |
|
312 | + break; |
|
313 | + case 'author': |
|
314 | + if (is_author() && isset($_REQUEST['geodir_dashbord'])) |
|
315 | + return true; |
|
316 | 316 | |
317 | 317 | if (function_exists('bp_loggedin_user_id') && function_exists('bp_displayed_user_id') && $my_id = (int)bp_loggedin_user_id()) { |
318 | 318 | if (((bool)bp_is_current_component('listings') || (bool)bp_is_current_component('favorites')) && $my_id > 0 && $my_id == (int)bp_displayed_user_id()) { |
319 | 319 | return true; |
320 | 320 | } |
321 | 321 | } |
322 | - break; |
|
323 | - case 'search': |
|
324 | - if (is_search() && isset($_REQUEST['geodir_search'])) |
|
325 | - return true; |
|
326 | - break; |
|
327 | - case 'info': |
|
328 | - if (is_page() && get_query_var('page_id') == geodir_info_page_id()) |
|
329 | - return true; |
|
330 | - break; |
|
331 | - case 'login': |
|
332 | - if (is_page() && get_query_var('page_id') == geodir_login_page_id()) |
|
333 | - return true; |
|
334 | - break; |
|
335 | - case 'checkout': |
|
336 | - if (is_page() && function_exists('geodir_payment_checkout_page_id') && get_query_var('page_id') == geodir_payment_checkout_page_id()) |
|
337 | - return true; |
|
338 | - break; |
|
339 | - case 'invoices': |
|
340 | - if (is_page() && function_exists('geodir_payment_invoices_page_id') && get_query_var('page_id') == geodir_payment_invoices_page_id()) |
|
341 | - return true; |
|
342 | - break; |
|
343 | - default: |
|
344 | - return false; |
|
345 | - break; |
|
346 | - |
|
347 | - endswitch; |
|
348 | - |
|
349 | - //endif; |
|
350 | - |
|
351 | - return false; |
|
322 | + break; |
|
323 | + case 'search': |
|
324 | + if (is_search() && isset($_REQUEST['geodir_search'])) |
|
325 | + return true; |
|
326 | + break; |
|
327 | + case 'info': |
|
328 | + if (is_page() && get_query_var('page_id') == geodir_info_page_id()) |
|
329 | + return true; |
|
330 | + break; |
|
331 | + case 'login': |
|
332 | + if (is_page() && get_query_var('page_id') == geodir_login_page_id()) |
|
333 | + return true; |
|
334 | + break; |
|
335 | + case 'checkout': |
|
336 | + if (is_page() && function_exists('geodir_payment_checkout_page_id') && get_query_var('page_id') == geodir_payment_checkout_page_id()) |
|
337 | + return true; |
|
338 | + break; |
|
339 | + case 'invoices': |
|
340 | + if (is_page() && function_exists('geodir_payment_invoices_page_id') && get_query_var('page_id') == geodir_payment_invoices_page_id()) |
|
341 | + return true; |
|
342 | + break; |
|
343 | + default: |
|
344 | + return false; |
|
345 | + break; |
|
346 | + |
|
347 | + endswitch; |
|
348 | + |
|
349 | + //endif; |
|
350 | + |
|
351 | + return false; |
|
352 | 352 | } |
353 | 353 | |
354 | 354 | /** |
@@ -362,97 +362,97 @@ discard block |
||
362 | 362 | */ |
363 | 363 | function geodir_set_is_geodir_page($wp) |
364 | 364 | { |
365 | - if (!is_admin()) { |
|
366 | - //$wp->query_vars['gd_is_geodir_page'] = false; |
|
367 | - //print_r() |
|
368 | - if (empty($wp->query_vars) || !array_diff(array_keys($wp->query_vars), array('preview', 'page', 'paged', 'cpage'))) { |
|
369 | - if (get_option('geodir_set_as_home')) |
|
370 | - $wp->query_vars['gd_is_geodir_page'] = true; |
|
371 | - if(geodir_is_page('home')){ |
|
372 | - $wp->query_vars['gd_is_geodir_page'] = true; |
|
373 | - } |
|
374 | - |
|
375 | - |
|
376 | - } |
|
377 | - |
|
378 | - if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['page_id'])) { |
|
379 | - if ( |
|
380 | - $wp->query_vars['page_id'] == geodir_add_listing_page_id() |
|
381 | - || $wp->query_vars['page_id'] == geodir_preview_page_id() |
|
382 | - || $wp->query_vars['page_id'] == geodir_success_page_id() |
|
383 | - || $wp->query_vars['page_id'] == geodir_location_page_id() |
|
384 | - || $wp->query_vars['page_id'] == geodir_home_page_id() |
|
385 | - || $wp->query_vars['page_id'] == geodir_info_page_id() |
|
386 | - || $wp->query_vars['page_id'] == geodir_login_page_id() |
|
387 | - || (function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id()) |
|
388 | - || (function_exists('geodir_payment_invoices_page_id') && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id()) |
|
389 | - ) |
|
390 | - $wp->query_vars['gd_is_geodir_page'] = true; |
|
391 | - } |
|
392 | - |
|
393 | - if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['pagename'])) { |
|
394 | - $page = get_page_by_path($wp->query_vars['pagename']); |
|
395 | - |
|
396 | - if (!empty($page) && ( |
|
397 | - $page->ID == geodir_add_listing_page_id() |
|
398 | - || $page->ID == geodir_preview_page_id() |
|
399 | - || $page->ID == geodir_success_page_id() |
|
400 | - || $page->ID == geodir_location_page_id() |
|
401 | - || (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_home_page_id()) |
|
402 | - || (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_info_page_id()) |
|
403 | - || (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_login_page_id()) |
|
404 | - || (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id()) |
|
405 | - || (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_invoices_page_id') && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id()) |
|
406 | - ) |
|
407 | - ) |
|
408 | - $wp->query_vars['gd_is_geodir_page'] = true; |
|
409 | - } |
|
410 | - |
|
411 | - |
|
412 | - if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['post_type']) && $wp->query_vars['post_type'] != '') { |
|
413 | - $requested_post_type = $wp->query_vars['post_type']; |
|
414 | - // check if this post type is geodirectory post types |
|
415 | - $post_type_array = geodir_get_posttypes(); |
|
416 | - if (in_array($requested_post_type, $post_type_array)) { |
|
417 | - $wp->query_vars['gd_is_geodir_page'] = true; |
|
418 | - } |
|
419 | - } |
|
420 | - |
|
421 | - if (!isset($wp->query_vars['gd_is_geodir_page'])) { |
|
422 | - $geodir_taxonomis = geodir_get_taxonomies('', true); |
|
423 | - if(!empty($geodir_taxonomis)){ |
|
424 | - foreach ($geodir_taxonomis as $taxonomy) { |
|
425 | - if (array_key_exists($taxonomy, $wp->query_vars)) { |
|
426 | - $wp->query_vars['gd_is_geodir_page'] = true; |
|
427 | - break; |
|
428 | - } |
|
429 | - } |
|
430 | - } |
|
431 | - |
|
432 | - } |
|
433 | - |
|
434 | - if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['author_name']) && isset($_REQUEST['geodir_dashbord'])) |
|
435 | - $wp->query_vars['gd_is_geodir_page'] = true; |
|
436 | - |
|
437 | - |
|
438 | - if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($_REQUEST['geodir_search'])) |
|
439 | - $wp->query_vars['gd_is_geodir_page'] = true; |
|
365 | + if (!is_admin()) { |
|
366 | + //$wp->query_vars['gd_is_geodir_page'] = false; |
|
367 | + //print_r() |
|
368 | + if (empty($wp->query_vars) || !array_diff(array_keys($wp->query_vars), array('preview', 'page', 'paged', 'cpage'))) { |
|
369 | + if (get_option('geodir_set_as_home')) |
|
370 | + $wp->query_vars['gd_is_geodir_page'] = true; |
|
371 | + if(geodir_is_page('home')){ |
|
372 | + $wp->query_vars['gd_is_geodir_page'] = true; |
|
373 | + } |
|
374 | + |
|
375 | + |
|
376 | + } |
|
377 | + |
|
378 | + if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['page_id'])) { |
|
379 | + if ( |
|
380 | + $wp->query_vars['page_id'] == geodir_add_listing_page_id() |
|
381 | + || $wp->query_vars['page_id'] == geodir_preview_page_id() |
|
382 | + || $wp->query_vars['page_id'] == geodir_success_page_id() |
|
383 | + || $wp->query_vars['page_id'] == geodir_location_page_id() |
|
384 | + || $wp->query_vars['page_id'] == geodir_home_page_id() |
|
385 | + || $wp->query_vars['page_id'] == geodir_info_page_id() |
|
386 | + || $wp->query_vars['page_id'] == geodir_login_page_id() |
|
387 | + || (function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id()) |
|
388 | + || (function_exists('geodir_payment_invoices_page_id') && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id()) |
|
389 | + ) |
|
390 | + $wp->query_vars['gd_is_geodir_page'] = true; |
|
391 | + } |
|
392 | + |
|
393 | + if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['pagename'])) { |
|
394 | + $page = get_page_by_path($wp->query_vars['pagename']); |
|
395 | + |
|
396 | + if (!empty($page) && ( |
|
397 | + $page->ID == geodir_add_listing_page_id() |
|
398 | + || $page->ID == geodir_preview_page_id() |
|
399 | + || $page->ID == geodir_success_page_id() |
|
400 | + || $page->ID == geodir_location_page_id() |
|
401 | + || (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_home_page_id()) |
|
402 | + || (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_info_page_id()) |
|
403 | + || (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_login_page_id()) |
|
404 | + || (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id()) |
|
405 | + || (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_invoices_page_id') && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id()) |
|
406 | + ) |
|
407 | + ) |
|
408 | + $wp->query_vars['gd_is_geodir_page'] = true; |
|
409 | + } |
|
410 | + |
|
411 | + |
|
412 | + if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['post_type']) && $wp->query_vars['post_type'] != '') { |
|
413 | + $requested_post_type = $wp->query_vars['post_type']; |
|
414 | + // check if this post type is geodirectory post types |
|
415 | + $post_type_array = geodir_get_posttypes(); |
|
416 | + if (in_array($requested_post_type, $post_type_array)) { |
|
417 | + $wp->query_vars['gd_is_geodir_page'] = true; |
|
418 | + } |
|
419 | + } |
|
420 | + |
|
421 | + if (!isset($wp->query_vars['gd_is_geodir_page'])) { |
|
422 | + $geodir_taxonomis = geodir_get_taxonomies('', true); |
|
423 | + if(!empty($geodir_taxonomis)){ |
|
424 | + foreach ($geodir_taxonomis as $taxonomy) { |
|
425 | + if (array_key_exists($taxonomy, $wp->query_vars)) { |
|
426 | + $wp->query_vars['gd_is_geodir_page'] = true; |
|
427 | + break; |
|
428 | + } |
|
429 | + } |
|
430 | + } |
|
431 | + |
|
432 | + } |
|
433 | + |
|
434 | + if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['author_name']) && isset($_REQUEST['geodir_dashbord'])) |
|
435 | + $wp->query_vars['gd_is_geodir_page'] = true; |
|
436 | + |
|
437 | + |
|
438 | + if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($_REQUEST['geodir_search'])) |
|
439 | + $wp->query_vars['gd_is_geodir_page'] = true; |
|
440 | 440 | |
441 | 441 | |
442 | 442 | //check if homepage |
443 | - if(!isset($wp->query_vars['gd_is_geodir_page']) |
|
444 | - && !isset($wp->query_vars['page_id']) |
|
445 | - && !isset($wp->query_vars['pagename']) |
|
446 | - && is_page_geodir_home()){ |
|
447 | - $wp->query_vars['gd_is_geodir_page'] = true; |
|
448 | - } |
|
449 | - //echo $wp->query_vars['gd_is_geodir_page'] ; |
|
450 | - /*echo "<pre>" ; |
|
443 | + if(!isset($wp->query_vars['gd_is_geodir_page']) |
|
444 | + && !isset($wp->query_vars['page_id']) |
|
445 | + && !isset($wp->query_vars['pagename']) |
|
446 | + && is_page_geodir_home()){ |
|
447 | + $wp->query_vars['gd_is_geodir_page'] = true; |
|
448 | + } |
|
449 | + //echo $wp->query_vars['gd_is_geodir_page'] ; |
|
450 | + /*echo "<pre>" ; |
|
451 | 451 | print_r($wp) ; |
452 | 452 | echo "</pre>" ; |
453 | 453 | // exit(); |
454 | 454 | */ |
455 | - } // end of is admin |
|
455 | + } // end of is admin |
|
456 | 456 | } |
457 | 457 | |
458 | 458 | /** |
@@ -465,56 +465,56 @@ discard block |
||
465 | 465 | */ |
466 | 466 | function geodir_is_geodir_page() |
467 | 467 | { |
468 | - global $wp; |
|
469 | - if (isset($wp->query_vars['gd_is_geodir_page']) && $wp->query_vars['gd_is_geodir_page']) |
|
470 | - return true; |
|
471 | - else |
|
472 | - return false; |
|
468 | + global $wp; |
|
469 | + if (isset($wp->query_vars['gd_is_geodir_page']) && $wp->query_vars['gd_is_geodir_page']) |
|
470 | + return true; |
|
471 | + else |
|
472 | + return false; |
|
473 | 473 | } |
474 | 474 | |
475 | 475 | if (!function_exists('geodir_get_imagesize')) { |
476 | - /** |
|
477 | - * Get image size using the size key . |
|
478 | - * |
|
479 | - * @since 1.0.0 |
|
480 | - * @package GeoDirectory |
|
481 | - * @param string $size The image size key. |
|
482 | - * @return array|mixed|void|WP_Error If valid returns image size. Else returns error. |
|
483 | - */ |
|
484 | - function geodir_get_imagesize($size = '') |
|
485 | - { |
|
486 | - |
|
487 | - $imagesizes = array('list-thumb' => array('w' => 283, 'h' => 188), |
|
488 | - 'thumbnail' => array('w' => 125, 'h' => 125), |
|
489 | - 'widget-thumb' => array('w' => 50, 'h' => 50), |
|
490 | - 'slider-thumb' => array('w' => 100, 'h' => 100) |
|
491 | - ); |
|
492 | - |
|
493 | - /** |
|
494 | - * Filter the image sizes array. |
|
495 | - * |
|
496 | - * @since 1.0.0 |
|
497 | - * @param array $imagesizes Image size array. |
|
498 | - */ |
|
499 | - $imagesizes = apply_filters('geodir_imagesizes', $imagesizes); |
|
500 | - |
|
501 | - if (!empty($size) && array_key_exists($size, $imagesizes)) { |
|
502 | - /** |
|
503 | - * Filters image size of the passed key. |
|
504 | - * |
|
505 | - * @since 1.0.0 |
|
506 | - * @param array $imagesizes[$size] Image size array of the passed key. |
|
507 | - */ |
|
508 | - return apply_filters('geodir_get_imagesize_' . $size, $imagesizes[$size]); |
|
509 | - |
|
510 | - } elseif (!empty($size)) { |
|
511 | - |
|
512 | - return new WP_Error('geodir_no_imagesize', __("Given image size is not valid", 'geodirectory')); |
|
513 | - |
|
514 | - } |
|
515 | - |
|
516 | - return $imagesizes; |
|
517 | - } |
|
476 | + /** |
|
477 | + * Get image size using the size key . |
|
478 | + * |
|
479 | + * @since 1.0.0 |
|
480 | + * @package GeoDirectory |
|
481 | + * @param string $size The image size key. |
|
482 | + * @return array|mixed|void|WP_Error If valid returns image size. Else returns error. |
|
483 | + */ |
|
484 | + function geodir_get_imagesize($size = '') |
|
485 | + { |
|
486 | + |
|
487 | + $imagesizes = array('list-thumb' => array('w' => 283, 'h' => 188), |
|
488 | + 'thumbnail' => array('w' => 125, 'h' => 125), |
|
489 | + 'widget-thumb' => array('w' => 50, 'h' => 50), |
|
490 | + 'slider-thumb' => array('w' => 100, 'h' => 100) |
|
491 | + ); |
|
492 | + |
|
493 | + /** |
|
494 | + * Filter the image sizes array. |
|
495 | + * |
|
496 | + * @since 1.0.0 |
|
497 | + * @param array $imagesizes Image size array. |
|
498 | + */ |
|
499 | + $imagesizes = apply_filters('geodir_imagesizes', $imagesizes); |
|
500 | + |
|
501 | + if (!empty($size) && array_key_exists($size, $imagesizes)) { |
|
502 | + /** |
|
503 | + * Filters image size of the passed key. |
|
504 | + * |
|
505 | + * @since 1.0.0 |
|
506 | + * @param array $imagesizes[$size] Image size array of the passed key. |
|
507 | + */ |
|
508 | + return apply_filters('geodir_get_imagesize_' . $size, $imagesizes[$size]); |
|
509 | + |
|
510 | + } elseif (!empty($size)) { |
|
511 | + |
|
512 | + return new WP_Error('geodir_no_imagesize', __("Given image size is not valid", 'geodirectory')); |
|
513 | + |
|
514 | + } |
|
515 | + |
|
516 | + return $imagesizes; |
|
517 | + } |
|
518 | 518 | } |
519 | 519 | |
520 | 520 | /** |
@@ -534,151 +534,151 @@ discard block |
||
534 | 534 | |
535 | 535 | |
536 | 536 | if (!function_exists('createRandomString')) { |
537 | - /** |
|
538 | - * Creates random string. |
|
539 | - * |
|
540 | - * @since 1.0.0 |
|
541 | - * @package GeoDirectory |
|
542 | - * @return string Random string. |
|
543 | - */ |
|
544 | - function createRandomString() |
|
545 | - { |
|
546 | - $chars = "abcdefghijkmlnopqrstuvwxyz1023456789"; |
|
547 | - srand((double)microtime() * 1000000); |
|
548 | - $i = 0; |
|
549 | - $rstring = ''; |
|
550 | - while ($i <= 25) { |
|
551 | - $num = rand() % 33; |
|
552 | - $tmp = substr($chars, $num, 1); |
|
553 | - $rstring = $rstring . $tmp; |
|
554 | - $i++; |
|
555 | - } |
|
556 | - return $rstring; |
|
557 | - } |
|
537 | + /** |
|
538 | + * Creates random string. |
|
539 | + * |
|
540 | + * @since 1.0.0 |
|
541 | + * @package GeoDirectory |
|
542 | + * @return string Random string. |
|
543 | + */ |
|
544 | + function createRandomString() |
|
545 | + { |
|
546 | + $chars = "abcdefghijkmlnopqrstuvwxyz1023456789"; |
|
547 | + srand((double)microtime() * 1000000); |
|
548 | + $i = 0; |
|
549 | + $rstring = ''; |
|
550 | + while ($i <= 25) { |
|
551 | + $num = rand() % 33; |
|
552 | + $tmp = substr($chars, $num, 1); |
|
553 | + $rstring = $rstring . $tmp; |
|
554 | + $i++; |
|
555 | + } |
|
556 | + return $rstring; |
|
557 | + } |
|
558 | 558 | } |
559 | 559 | |
560 | 560 | if (!function_exists('geodir_getDistanceRadius')) { |
561 | - /** |
|
562 | - * Calculates the distance radius. |
|
563 | - * |
|
564 | - * @since 1.0.0 |
|
565 | - * @package GeoDirectory |
|
566 | - * @param string $uom Measurement unit type. |
|
567 | - * @return float The mean radius. |
|
568 | - */ |
|
569 | - function geodir_getDistanceRadius($uom = 'km') |
|
570 | - { |
|
561 | + /** |
|
562 | + * Calculates the distance radius. |
|
563 | + * |
|
564 | + * @since 1.0.0 |
|
565 | + * @package GeoDirectory |
|
566 | + * @param string $uom Measurement unit type. |
|
567 | + * @return float The mean radius. |
|
568 | + */ |
|
569 | + function geodir_getDistanceRadius($uom = 'km') |
|
570 | + { |
|
571 | 571 | // Use Haversine formula to calculate the great circle distance between two points identified by longitude and latitude |
572 | - switch (geodir_strtolower($uom)): |
|
573 | - case 'km' : |
|
574 | - $earthMeanRadius = 6371.009; // km |
|
575 | - break; |
|
576 | - case 'm' : |
|
577 | - case 'meters' : |
|
578 | - $earthMeanRadius = 6371.009 * 1000; // km |
|
579 | - break; |
|
580 | - case 'miles' : |
|
581 | - $earthMeanRadius = 3958.761; // miles |
|
582 | - break; |
|
583 | - case 'yards' : |
|
584 | - case 'yds' : |
|
585 | - $earthMeanRadius = 3958.761 * 1760; // yards |
|
586 | - break; |
|
587 | - case 'feet' : |
|
588 | - case 'ft' : |
|
589 | - $earthMeanRadius = 3958.761 * 1760 * 3; // feet |
|
590 | - break; |
|
591 | - case 'nm' : |
|
592 | - $earthMeanRadius = 3440.069; // miles |
|
593 | - break; |
|
594 | - default: |
|
595 | - $earthMeanRadius = 3958.761; // miles |
|
596 | - break; |
|
597 | - endswitch; |
|
598 | - return $earthMeanRadius; |
|
599 | - } |
|
572 | + switch (geodir_strtolower($uom)): |
|
573 | + case 'km' : |
|
574 | + $earthMeanRadius = 6371.009; // km |
|
575 | + break; |
|
576 | + case 'm' : |
|
577 | + case 'meters' : |
|
578 | + $earthMeanRadius = 6371.009 * 1000; // km |
|
579 | + break; |
|
580 | + case 'miles' : |
|
581 | + $earthMeanRadius = 3958.761; // miles |
|
582 | + break; |
|
583 | + case 'yards' : |
|
584 | + case 'yds' : |
|
585 | + $earthMeanRadius = 3958.761 * 1760; // yards |
|
586 | + break; |
|
587 | + case 'feet' : |
|
588 | + case 'ft' : |
|
589 | + $earthMeanRadius = 3958.761 * 1760 * 3; // feet |
|
590 | + break; |
|
591 | + case 'nm' : |
|
592 | + $earthMeanRadius = 3440.069; // miles |
|
593 | + break; |
|
594 | + default: |
|
595 | + $earthMeanRadius = 3958.761; // miles |
|
596 | + break; |
|
597 | + endswitch; |
|
598 | + return $earthMeanRadius; |
|
599 | + } |
|
600 | 600 | } |
601 | 601 | |
602 | 602 | |
603 | 603 | if (!function_exists('geodir_calculateDistanceFromLatLong')) { |
604 | - /** |
|
605 | - * Calculate the great circle distance between two points identified by longitude and latitude. |
|
606 | - * |
|
607 | - * @since 1.0.0 |
|
608 | - * @package GeoDirectory |
|
609 | - * @param array $point1 Latitude and Longitude of point 1. |
|
610 | - * @param array $point2 Latitude and Longitude of point 2. |
|
611 | - * @param string $uom Unit of measurement. |
|
612 | - * @return float The distance. |
|
613 | - */ |
|
614 | - function geodir_calculateDistanceFromLatLong($point1, $point2, $uom = 'km') |
|
615 | - { |
|
604 | + /** |
|
605 | + * Calculate the great circle distance between two points identified by longitude and latitude. |
|
606 | + * |
|
607 | + * @since 1.0.0 |
|
608 | + * @package GeoDirectory |
|
609 | + * @param array $point1 Latitude and Longitude of point 1. |
|
610 | + * @param array $point2 Latitude and Longitude of point 2. |
|
611 | + * @param string $uom Unit of measurement. |
|
612 | + * @return float The distance. |
|
613 | + */ |
|
614 | + function geodir_calculateDistanceFromLatLong($point1, $point2, $uom = 'km') |
|
615 | + { |
|
616 | 616 | // Use Haversine formula to calculate the great circle distance between two points identified by longitude and latitude |
617 | 617 | |
618 | - $earthMeanRadius = geodir_getDistanceRadius($uom); |
|
618 | + $earthMeanRadius = geodir_getDistanceRadius($uom); |
|
619 | 619 | |
620 | - $deltaLatitude = deg2rad($point2['latitude'] - $point1['latitude']); |
|
621 | - $deltaLongitude = deg2rad($point2['longitude'] - $point1['longitude']); |
|
622 | - $a = sin($deltaLatitude / 2) * sin($deltaLatitude / 2) + |
|
623 | - cos(deg2rad($point1['latitude'])) * cos(deg2rad($point2['latitude'])) * |
|
624 | - sin($deltaLongitude / 2) * sin($deltaLongitude / 2); |
|
625 | - $c = 2 * atan2(sqrt($a), sqrt(1 - $a)); |
|
626 | - $distance = $earthMeanRadius * $c; |
|
627 | - return $distance; |
|
620 | + $deltaLatitude = deg2rad($point2['latitude'] - $point1['latitude']); |
|
621 | + $deltaLongitude = deg2rad($point2['longitude'] - $point1['longitude']); |
|
622 | + $a = sin($deltaLatitude / 2) * sin($deltaLatitude / 2) + |
|
623 | + cos(deg2rad($point1['latitude'])) * cos(deg2rad($point2['latitude'])) * |
|
624 | + sin($deltaLongitude / 2) * sin($deltaLongitude / 2); |
|
625 | + $c = 2 * atan2(sqrt($a), sqrt(1 - $a)); |
|
626 | + $distance = $earthMeanRadius * $c; |
|
627 | + return $distance; |
|
628 | 628 | |
629 | - } |
|
629 | + } |
|
630 | 630 | } |
631 | 631 | |
632 | 632 | |
633 | 633 | if (!function_exists('geodir_sendEmail')) { |
634 | - /** |
|
635 | - * The main function that send transactional emails using the args provided. |
|
636 | - * |
|
637 | - * @since 1.0.0 |
|
638 | - * @since 1.5.7 Added db translations for notifications subject and content. |
|
639 | - * @package GeoDirectory |
|
640 | - * @param string $fromEmail Sender email address. |
|
641 | - * @param string $fromEmailName Sender name. |
|
642 | - * @param string $toEmail Receiver email address. |
|
643 | - * @param string $toEmailName Receiver name. |
|
644 | - * @param string $to_subject Email subject. |
|
645 | - * @param string $to_message Email content. |
|
646 | - * @param string $extra Not being used. |
|
647 | - * @param string $message_type The message type. Can be send_friend, send_enquiry, forgot_password, registration, post_submit, listing_published. |
|
648 | - * @param string $post_id The post ID. |
|
649 | - * @param string $user_id The user ID. |
|
650 | - */ |
|
651 | - function geodir_sendEmail($fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '') { |
|
652 | - $login_details = ''; |
|
653 | - |
|
654 | - // strip slashes from subject & message text |
|
655 | - $to_subject = stripslashes_deep($to_subject); |
|
656 | - $to_message = stripslashes_deep($to_message); |
|
657 | - |
|
658 | - if ($message_type == 'send_friend') { |
|
659 | - $subject = get_option('geodir_email_friend_subject'); |
|
660 | - $message = get_option('geodir_email_friend_content'); |
|
661 | - } elseif ($message_type == 'send_enquiry') { |
|
662 | - $subject = get_option('geodir_email_enquiry_subject'); |
|
663 | - $message = get_option('geodir_email_enquiry_content'); |
|
664 | - } elseif ($message_type == 'forgot_password') { |
|
665 | - $subject = get_option('geodir_forgot_password_subject'); |
|
666 | - $message = get_option('geodir_forgot_password_content'); |
|
667 | - $login_details = $to_message; |
|
668 | - } elseif ($message_type == 'registration') { |
|
669 | - $subject = get_option('geodir_registration_success_email_subject'); |
|
670 | - $message = get_option('geodir_registration_success_email_content'); |
|
671 | - $login_details = $to_message; |
|
672 | - } elseif ($message_type == 'post_submit') { |
|
673 | - $subject = get_option('geodir_post_submited_success_email_subject'); |
|
674 | - $message = get_option('geodir_post_submited_success_email_content'); |
|
675 | - } elseif ($message_type == 'listing_published') { |
|
676 | - $subject = get_option('geodir_post_published_email_subject'); |
|
677 | - $message = get_option('geodir_post_published_email_content'); |
|
678 | - } elseif ($message_type == 'listing_edited') { |
|
679 | - $subject = get_option('geodir_post_edited_email_subject_admin'); |
|
680 | - $message = get_option('geodir_post_edited_email_content_admin'); |
|
681 | - } |
|
634 | + /** |
|
635 | + * The main function that send transactional emails using the args provided. |
|
636 | + * |
|
637 | + * @since 1.0.0 |
|
638 | + * @since 1.5.7 Added db translations for notifications subject and content. |
|
639 | + * @package GeoDirectory |
|
640 | + * @param string $fromEmail Sender email address. |
|
641 | + * @param string $fromEmailName Sender name. |
|
642 | + * @param string $toEmail Receiver email address. |
|
643 | + * @param string $toEmailName Receiver name. |
|
644 | + * @param string $to_subject Email subject. |
|
645 | + * @param string $to_message Email content. |
|
646 | + * @param string $extra Not being used. |
|
647 | + * @param string $message_type The message type. Can be send_friend, send_enquiry, forgot_password, registration, post_submit, listing_published. |
|
648 | + * @param string $post_id The post ID. |
|
649 | + * @param string $user_id The user ID. |
|
650 | + */ |
|
651 | + function geodir_sendEmail($fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '') { |
|
652 | + $login_details = ''; |
|
653 | + |
|
654 | + // strip slashes from subject & message text |
|
655 | + $to_subject = stripslashes_deep($to_subject); |
|
656 | + $to_message = stripslashes_deep($to_message); |
|
657 | + |
|
658 | + if ($message_type == 'send_friend') { |
|
659 | + $subject = get_option('geodir_email_friend_subject'); |
|
660 | + $message = get_option('geodir_email_friend_content'); |
|
661 | + } elseif ($message_type == 'send_enquiry') { |
|
662 | + $subject = get_option('geodir_email_enquiry_subject'); |
|
663 | + $message = get_option('geodir_email_enquiry_content'); |
|
664 | + } elseif ($message_type == 'forgot_password') { |
|
665 | + $subject = get_option('geodir_forgot_password_subject'); |
|
666 | + $message = get_option('geodir_forgot_password_content'); |
|
667 | + $login_details = $to_message; |
|
668 | + } elseif ($message_type == 'registration') { |
|
669 | + $subject = get_option('geodir_registration_success_email_subject'); |
|
670 | + $message = get_option('geodir_registration_success_email_content'); |
|
671 | + $login_details = $to_message; |
|
672 | + } elseif ($message_type == 'post_submit') { |
|
673 | + $subject = get_option('geodir_post_submited_success_email_subject'); |
|
674 | + $message = get_option('geodir_post_submited_success_email_content'); |
|
675 | + } elseif ($message_type == 'listing_published') { |
|
676 | + $subject = get_option('geodir_post_published_email_subject'); |
|
677 | + $message = get_option('geodir_post_published_email_content'); |
|
678 | + } elseif ($message_type == 'listing_edited') { |
|
679 | + $subject = get_option('geodir_post_edited_email_subject_admin'); |
|
680 | + $message = get_option('geodir_post_edited_email_content_admin'); |
|
681 | + } |
|
682 | 682 | |
683 | 683 | if (!empty($subject)) { |
684 | 684 | $subject = __(stripslashes_deep($subject),'geodirectory'); |
@@ -688,129 +688,129 @@ discard block |
||
688 | 688 | $message = __(stripslashes_deep($message),'geodirectory'); |
689 | 689 | } |
690 | 690 | |
691 | - $to_message = nl2br($to_message); |
|
692 | - $sitefromEmail = get_option('site_email'); |
|
693 | - $sitefromEmailName = get_site_emailName(); |
|
694 | - $productlink = get_permalink($post_id); |
|
695 | - |
|
696 | - $user_login = ''; |
|
697 | - if ($user_id > 0 && $user_info = get_userdata($user_id)) { |
|
698 | - $user_login = $user_info->user_login; |
|
699 | - } |
|
700 | - |
|
701 | - $posted_date = ''; |
|
702 | - $listingLink = ''; |
|
703 | - |
|
704 | - $post_info = get_post($post_id); |
|
705 | - |
|
706 | - if ($post_info) { |
|
707 | - $posted_date = $post_info->post_date; |
|
708 | - $listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>'; |
|
709 | - } |
|
710 | - $siteurl = home_url(); |
|
711 | - $siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>'; |
|
712 | - $loginurl = geodir_login_url(); |
|
713 | - $loginurl_link = '<a href="' . $loginurl . '">login</a>'; |
|
691 | + $to_message = nl2br($to_message); |
|
692 | + $sitefromEmail = get_option('site_email'); |
|
693 | + $sitefromEmailName = get_site_emailName(); |
|
694 | + $productlink = get_permalink($post_id); |
|
695 | + |
|
696 | + $user_login = ''; |
|
697 | + if ($user_id > 0 && $user_info = get_userdata($user_id)) { |
|
698 | + $user_login = $user_info->user_login; |
|
699 | + } |
|
700 | + |
|
701 | + $posted_date = ''; |
|
702 | + $listingLink = ''; |
|
703 | + |
|
704 | + $post_info = get_post($post_id); |
|
705 | + |
|
706 | + if ($post_info) { |
|
707 | + $posted_date = $post_info->post_date; |
|
708 | + $listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>'; |
|
709 | + } |
|
710 | + $siteurl = home_url(); |
|
711 | + $siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>'; |
|
712 | + $loginurl = geodir_login_url(); |
|
713 | + $loginurl_link = '<a href="' . $loginurl . '">login</a>'; |
|
714 | 714 | |
715 | - $post_author_id = !empty($post_info) ? $post_info->post_author : 0; |
|
716 | - $post_author_name = geodir_get_client_name($post_author_id); |
|
717 | - $current_date = date_i18n('Y-m-d H:i:s', current_time('timestamp')); |
|
718 | - |
|
719 | - if ($fromEmail == '') { |
|
720 | - $fromEmail = get_option('site_email'); |
|
721 | - } |
|
722 | - |
|
723 | - if ($fromEmailName == '') { |
|
724 | - $fromEmailName = get_option('site_email_name'); |
|
725 | - } |
|
726 | - |
|
727 | - $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]', '[#posted_date#]','[#from_email#]','[#user_login#]','[#username#]','[#post_author_id#]','[#post_author_name#]','[#current_date#]'); |
|
728 | - $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName, $posted_date,$fromEmail, $user_login, $user_login, $post_author_id, $post_author_name, $current_date); |
|
729 | - $message = str_replace($search_array, $replace_array, $message); |
|
730 | - |
|
731 | - $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]','[#from_email#]','[#user_login#]','[#username#]','[#post_author_id#]','[#post_author_name#]','[#current_date#]'); |
|
732 | - $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName, $posted_date,$fromEmail, $user_login, $user_login, $post_author_id, $post_author_name, $current_date); |
|
733 | - $subject = str_replace($search_array, $replace_array, $subject); |
|
734 | - |
|
735 | - $headers = 'MIME-Version: 1.0' . "\r\n"; |
|
736 | - $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n"; |
|
737 | - $headers .= "Reply-To: " . $fromEmail . "\r\n"; |
|
738 | - $headers .= 'From: ' . $sitefromEmailName . ' <' . $sitefromEmail . '>' . "\r\n"; |
|
739 | - |
|
740 | - $to = $toEmail; |
|
741 | - $sent = wp_mail($to, $subject, $message, $headers); |
|
742 | - |
|
743 | - if( ! $sent ) { |
|
744 | - if ( is_array( $to ) ) { |
|
745 | - $to = implode( ',', $to ); |
|
746 | - } |
|
747 | - $log_message = sprintf( |
|
748 | - __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ), |
|
749 | - $message_type, |
|
750 | - date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ), |
|
751 | - $to, |
|
752 | - $subject |
|
753 | - ); |
|
754 | - geodir_error_log( $log_message ); |
|
755 | - } |
|
756 | - |
|
757 | - ///////// ADMIN BCC EMIALS |
|
758 | - $adminEmail = get_bloginfo('admin_email'); |
|
759 | - $to = $adminEmail; |
|
760 | - |
|
761 | - $admin_bcc = false; |
|
762 | - if ($message_type == 'post_submit') { |
|
763 | - $subject = __(stripslashes_deep(get_option('geodir_post_submited_success_email_subject_admin')), 'geodirectory'); |
|
764 | - $message = __(stripslashes_deep(get_option('geodir_post_submited_success_email_content_admin')), 'geodirectory'); |
|
765 | - |
|
766 | - $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]', '[#posted_date#]','[#user_login#]','[#username#]'); |
|
767 | - $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName, $posted_date, $user_login, $user_login); |
|
768 | - $message = str_replace($search_array, $replace_array, $message); |
|
769 | - |
|
770 | - $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]','[#user_login#]','[#username#]'); |
|
771 | - $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName, $posted_date, $user_login, $user_login); |
|
772 | - $subject = str_replace($search_array, $replace_array, $subject); |
|
773 | - |
|
774 | - $subject .= ' - ADMIN BCC COPY'; |
|
775 | - $admin_bcc = true; |
|
776 | - |
|
777 | - } |
|
778 | - elseif ($message_type == 'registration' && get_option('geodir_bcc_new_user')) { |
|
779 | - $subject .= ' - ADMIN BCC COPY'; |
|
780 | - $admin_bcc = true; |
|
781 | - } |
|
782 | - elseif ($message_type == 'send_friend' && get_option('geodir_bcc_friend')) { |
|
783 | - $subject .= ' - ADMIN BCC COPY'; |
|
784 | - $admin_bcc = true; |
|
785 | - } |
|
786 | - elseif ($message_type == 'send_enquiry' && get_option('geodir_bcc_enquiry')) { |
|
787 | - $subject .= ' - ADMIN BCC COPY'; |
|
788 | - $admin_bcc = true; |
|
789 | - } |
|
790 | - elseif ($message_type == 'listing_published' && get_option('geodir_bcc_listing_published')) { |
|
791 | - $subject .= ' - ADMIN BCC COPY'; |
|
792 | - $admin_bcc = true; |
|
793 | - } |
|
794 | - |
|
795 | - if($admin_bcc===true){ |
|
796 | - $sent = wp_mail($to, $subject, $message, $headers); |
|
797 | - |
|
798 | - if( ! $sent ) { |
|
799 | - if ( is_array( $to ) ) { |
|
800 | - $to = implode( ',', $to ); |
|
801 | - } |
|
802 | - $log_message = sprintf( |
|
803 | - __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ), |
|
804 | - $message_type, |
|
805 | - date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ), |
|
806 | - $to, |
|
807 | - $subject |
|
808 | - ); |
|
809 | - geodir_error_log( $log_message ); |
|
810 | - } |
|
811 | - } |
|
812 | - |
|
813 | - } |
|
715 | + $post_author_id = !empty($post_info) ? $post_info->post_author : 0; |
|
716 | + $post_author_name = geodir_get_client_name($post_author_id); |
|
717 | + $current_date = date_i18n('Y-m-d H:i:s', current_time('timestamp')); |
|
718 | + |
|
719 | + if ($fromEmail == '') { |
|
720 | + $fromEmail = get_option('site_email'); |
|
721 | + } |
|
722 | + |
|
723 | + if ($fromEmailName == '') { |
|
724 | + $fromEmailName = get_option('site_email_name'); |
|
725 | + } |
|
726 | + |
|
727 | + $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]', '[#posted_date#]','[#from_email#]','[#user_login#]','[#username#]','[#post_author_id#]','[#post_author_name#]','[#current_date#]'); |
|
728 | + $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName, $posted_date,$fromEmail, $user_login, $user_login, $post_author_id, $post_author_name, $current_date); |
|
729 | + $message = str_replace($search_array, $replace_array, $message); |
|
730 | + |
|
731 | + $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]','[#from_email#]','[#user_login#]','[#username#]','[#post_author_id#]','[#post_author_name#]','[#current_date#]'); |
|
732 | + $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName, $posted_date,$fromEmail, $user_login, $user_login, $post_author_id, $post_author_name, $current_date); |
|
733 | + $subject = str_replace($search_array, $replace_array, $subject); |
|
734 | + |
|
735 | + $headers = 'MIME-Version: 1.0' . "\r\n"; |
|
736 | + $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n"; |
|
737 | + $headers .= "Reply-To: " . $fromEmail . "\r\n"; |
|
738 | + $headers .= 'From: ' . $sitefromEmailName . ' <' . $sitefromEmail . '>' . "\r\n"; |
|
739 | + |
|
740 | + $to = $toEmail; |
|
741 | + $sent = wp_mail($to, $subject, $message, $headers); |
|
742 | + |
|
743 | + if( ! $sent ) { |
|
744 | + if ( is_array( $to ) ) { |
|
745 | + $to = implode( ',', $to ); |
|
746 | + } |
|
747 | + $log_message = sprintf( |
|
748 | + __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ), |
|
749 | + $message_type, |
|
750 | + date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ), |
|
751 | + $to, |
|
752 | + $subject |
|
753 | + ); |
|
754 | + geodir_error_log( $log_message ); |
|
755 | + } |
|
756 | + |
|
757 | + ///////// ADMIN BCC EMIALS |
|
758 | + $adminEmail = get_bloginfo('admin_email'); |
|
759 | + $to = $adminEmail; |
|
760 | + |
|
761 | + $admin_bcc = false; |
|
762 | + if ($message_type == 'post_submit') { |
|
763 | + $subject = __(stripslashes_deep(get_option('geodir_post_submited_success_email_subject_admin')), 'geodirectory'); |
|
764 | + $message = __(stripslashes_deep(get_option('geodir_post_submited_success_email_content_admin')), 'geodirectory'); |
|
765 | + |
|
766 | + $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]', '[#posted_date#]','[#user_login#]','[#username#]'); |
|
767 | + $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName, $posted_date, $user_login, $user_login); |
|
768 | + $message = str_replace($search_array, $replace_array, $message); |
|
769 | + |
|
770 | + $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]','[#user_login#]','[#username#]'); |
|
771 | + $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName, $posted_date, $user_login, $user_login); |
|
772 | + $subject = str_replace($search_array, $replace_array, $subject); |
|
773 | + |
|
774 | + $subject .= ' - ADMIN BCC COPY'; |
|
775 | + $admin_bcc = true; |
|
776 | + |
|
777 | + } |
|
778 | + elseif ($message_type == 'registration' && get_option('geodir_bcc_new_user')) { |
|
779 | + $subject .= ' - ADMIN BCC COPY'; |
|
780 | + $admin_bcc = true; |
|
781 | + } |
|
782 | + elseif ($message_type == 'send_friend' && get_option('geodir_bcc_friend')) { |
|
783 | + $subject .= ' - ADMIN BCC COPY'; |
|
784 | + $admin_bcc = true; |
|
785 | + } |
|
786 | + elseif ($message_type == 'send_enquiry' && get_option('geodir_bcc_enquiry')) { |
|
787 | + $subject .= ' - ADMIN BCC COPY'; |
|
788 | + $admin_bcc = true; |
|
789 | + } |
|
790 | + elseif ($message_type == 'listing_published' && get_option('geodir_bcc_listing_published')) { |
|
791 | + $subject .= ' - ADMIN BCC COPY'; |
|
792 | + $admin_bcc = true; |
|
793 | + } |
|
794 | + |
|
795 | + if($admin_bcc===true){ |
|
796 | + $sent = wp_mail($to, $subject, $message, $headers); |
|
797 | + |
|
798 | + if( ! $sent ) { |
|
799 | + if ( is_array( $to ) ) { |
|
800 | + $to = implode( ',', $to ); |
|
801 | + } |
|
802 | + $log_message = sprintf( |
|
803 | + __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ), |
|
804 | + $message_type, |
|
805 | + date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ), |
|
806 | + $to, |
|
807 | + $subject |
|
808 | + ); |
|
809 | + geodir_error_log( $log_message ); |
|
810 | + } |
|
811 | + } |
|
812 | + |
|
813 | + } |
|
814 | 814 | } |
815 | 815 | |
816 | 816 | |
@@ -823,27 +823,27 @@ discard block |
||
823 | 823 | function geodir_taxonomy_breadcrumb() |
824 | 824 | { |
825 | 825 | |
826 | - $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); |
|
827 | - $parent = $term->parent; |
|
826 | + $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); |
|
827 | + $parent = $term->parent; |
|
828 | 828 | |
829 | - while ($parent): |
|
830 | - $parents[] = $parent; |
|
831 | - $new_parent = get_term_by('id', $parent, get_query_var('taxonomy')); |
|
832 | - $parent = $new_parent->parent; |
|
833 | - endwhile; |
|
829 | + while ($parent): |
|
830 | + $parents[] = $parent; |
|
831 | + $new_parent = get_term_by('id', $parent, get_query_var('taxonomy')); |
|
832 | + $parent = $new_parent->parent; |
|
833 | + endwhile; |
|
834 | 834 | |
835 | - if (!empty($parents)): |
|
836 | - $parents = array_reverse($parents); |
|
835 | + if (!empty($parents)): |
|
836 | + $parents = array_reverse($parents); |
|
837 | 837 | |
838 | - foreach ($parents as $parent): |
|
839 | - $item = get_term_by('id', $parent, get_query_var('taxonomy')); |
|
840 | - $url = get_term_link($item, get_query_var('taxonomy')); |
|
841 | - echo '<li> > <a href="' . $url . '">' . $item->name . '</a></li>'; |
|
842 | - endforeach; |
|
838 | + foreach ($parents as $parent): |
|
839 | + $item = get_term_by('id', $parent, get_query_var('taxonomy')); |
|
840 | + $url = get_term_link($item, get_query_var('taxonomy')); |
|
841 | + echo '<li> > <a href="' . $url . '">' . $item->name . '</a></li>'; |
|
842 | + endforeach; |
|
843 | 843 | |
844 | - endif; |
|
844 | + endif; |
|
845 | 845 | |
846 | - echo '<li> > ' . $term->name . '</li>'; |
|
846 | + echo '<li> > ' . $term->name . '</li>'; |
|
847 | 847 | } |
848 | 848 | |
849 | 849 | |
@@ -859,365 +859,365 @@ discard block |
||
859 | 859 | */ |
860 | 860 | function geodir_breadcrumb() |
861 | 861 | { |
862 | - global $wp_query, $geodir_add_location_url; |
|
863 | - |
|
864 | - /** |
|
865 | - * Filter breadcrumb separator. |
|
866 | - * |
|
867 | - * @since 1.0.0 |
|
868 | - */ |
|
869 | - $separator = apply_filters('geodir_breadcrumb_separator', ' > '); |
|
870 | - |
|
871 | - if (!geodir_is_page('home')) { |
|
872 | - $breadcrumb = ''; |
|
873 | - $url_categoris = ''; |
|
874 | - $breadcrumb .= '<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs">'; |
|
875 | - /** |
|
876 | - * Filter breadcrumb's first link. |
|
877 | - * |
|
878 | - * @since 1.0.0 |
|
879 | - */ |
|
880 | - $breadcrumb .= '<li>' . apply_filters('geodir_breadcrumb_first_link', '<a href="' . home_url() . '">' . __('Home', 'geodirectory') . '</a>') . '</li>'; |
|
862 | + global $wp_query, $geodir_add_location_url; |
|
863 | + |
|
864 | + /** |
|
865 | + * Filter breadcrumb separator. |
|
866 | + * |
|
867 | + * @since 1.0.0 |
|
868 | + */ |
|
869 | + $separator = apply_filters('geodir_breadcrumb_separator', ' > '); |
|
870 | + |
|
871 | + if (!geodir_is_page('home')) { |
|
872 | + $breadcrumb = ''; |
|
873 | + $url_categoris = ''; |
|
874 | + $breadcrumb .= '<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs">'; |
|
875 | + /** |
|
876 | + * Filter breadcrumb's first link. |
|
877 | + * |
|
878 | + * @since 1.0.0 |
|
879 | + */ |
|
880 | + $breadcrumb .= '<li>' . apply_filters('geodir_breadcrumb_first_link', '<a href="' . home_url() . '">' . __('Home', 'geodirectory') . '</a>') . '</li>'; |
|
881 | + |
|
882 | + $gd_post_type = geodir_get_current_posttype(); |
|
883 | + $post_type_info = get_post_type_object($gd_post_type); |
|
884 | + |
|
885 | + remove_filter('post_type_archive_link', 'geodir_get_posttype_link'); |
|
886 | + |
|
887 | + $listing_link = get_post_type_archive_link($gd_post_type); |
|
888 | + |
|
889 | + add_filter('post_type_archive_link', 'geodir_get_posttype_link', 10, 2); |
|
890 | + $listing_link = rtrim($listing_link, '/'); |
|
891 | + $listing_link .= '/'; |
|
892 | + |
|
893 | + $post_type_for_location_link = $listing_link; |
|
894 | + $location_terms = geodir_get_current_location_terms('query_vars', $gd_post_type); |
|
895 | + |
|
896 | + global $wp, $gd_session; |
|
897 | + $location_link = $post_type_for_location_link; |
|
898 | + |
|
899 | + if (geodir_is_page('detail') || geodir_is_page('listing')) { |
|
900 | + global $post; |
|
901 | + $location_manager = defined('POST_LOCATION_TABLE') ? true : false; |
|
902 | + $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false; |
|
903 | + |
|
904 | + if(geodir_is_page('detail') && isset($post->country_slug)){ |
|
905 | + $location_terms = array( |
|
906 | + 'gd_country' => $post->country_slug, |
|
907 | + 'gd_region' => $post->region_slug, |
|
908 | + 'gd_city' => $post->city_slug |
|
909 | + ); |
|
910 | + |
|
911 | + if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) { |
|
912 | + $location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood; |
|
913 | + } |
|
914 | + } |
|
881 | 915 | |
882 | - $gd_post_type = geodir_get_current_posttype(); |
|
883 | - $post_type_info = get_post_type_object($gd_post_type); |
|
916 | + $geodir_show_location_url = get_option('geodir_show_location_url'); |
|
884 | 917 | |
885 | - remove_filter('post_type_archive_link', 'geodir_get_posttype_link'); |
|
918 | + $hide_url_part = array(); |
|
919 | + if ($location_manager) { |
|
920 | + $hide_country_part = get_option('geodir_location_hide_country_part'); |
|
921 | + $hide_region_part = get_option('geodir_location_hide_region_part'); |
|
886 | 922 | |
887 | - $listing_link = get_post_type_archive_link($gd_post_type); |
|
923 | + if ($hide_region_part && $hide_country_part) { |
|
924 | + $hide_url_part = array('gd_country', 'gd_region'); |
|
925 | + } else if ($hide_region_part && !$hide_country_part) { |
|
926 | + $hide_url_part = array('gd_region'); |
|
927 | + } else if (!$hide_region_part && $hide_country_part) { |
|
928 | + $hide_url_part = array('gd_country'); |
|
929 | + } |
|
930 | + } |
|
888 | 931 | |
889 | - add_filter('post_type_archive_link', 'geodir_get_posttype_link', 10, 2); |
|
890 | - $listing_link = rtrim($listing_link, '/'); |
|
891 | - $listing_link .= '/'; |
|
932 | + $hide_text_part = array(); |
|
933 | + if ($geodir_show_location_url == 'country_city') { |
|
934 | + $hide_text_part = array('gd_region'); |
|
892 | 935 | |
893 | - $post_type_for_location_link = $listing_link; |
|
894 | - $location_terms = geodir_get_current_location_terms('query_vars', $gd_post_type); |
|
936 | + if (isset($location_terms['gd_region']) && !$location_manager) { |
|
937 | + unset($location_terms['gd_region']); |
|
938 | + } |
|
939 | + } else if ($geodir_show_location_url == 'region_city') { |
|
940 | + $hide_text_part = array('gd_country'); |
|
895 | 941 | |
896 | - global $wp, $gd_session; |
|
897 | - $location_link = $post_type_for_location_link; |
|
942 | + if (isset($location_terms['gd_country']) && !$location_manager) { |
|
943 | + unset($location_terms['gd_country']); |
|
944 | + } |
|
945 | + } else if ($geodir_show_location_url == 'city') { |
|
946 | + $hide_text_part = array('gd_country', 'gd_region'); |
|
898 | 947 | |
899 | - if (geodir_is_page('detail') || geodir_is_page('listing')) { |
|
900 | - global $post; |
|
901 | - $location_manager = defined('POST_LOCATION_TABLE') ? true : false; |
|
902 | - $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false; |
|
903 | - |
|
904 | - if(geodir_is_page('detail') && isset($post->country_slug)){ |
|
905 | - $location_terms = array( |
|
906 | - 'gd_country' => $post->country_slug, |
|
907 | - 'gd_region' => $post->region_slug, |
|
908 | - 'gd_city' => $post->city_slug |
|
909 | - ); |
|
910 | - |
|
911 | - if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) { |
|
912 | - $location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood; |
|
948 | + if (isset($location_terms['gd_country']) && !$location_manager) { |
|
949 | + unset($location_terms['gd_country']); |
|
913 | 950 | } |
914 | - } |
|
915 | - |
|
916 | - $geodir_show_location_url = get_option('geodir_show_location_url'); |
|
917 | - |
|
918 | - $hide_url_part = array(); |
|
919 | - if ($location_manager) { |
|
920 | - $hide_country_part = get_option('geodir_location_hide_country_part'); |
|
921 | - $hide_region_part = get_option('geodir_location_hide_region_part'); |
|
922 | - |
|
923 | - if ($hide_region_part && $hide_country_part) { |
|
924 | - $hide_url_part = array('gd_country', 'gd_region'); |
|
925 | - } else if ($hide_region_part && !$hide_country_part) { |
|
926 | - $hide_url_part = array('gd_region'); |
|
927 | - } else if (!$hide_region_part && $hide_country_part) { |
|
928 | - $hide_url_part = array('gd_country'); |
|
929 | - } |
|
930 | - } |
|
931 | - |
|
932 | - $hide_text_part = array(); |
|
933 | - if ($geodir_show_location_url == 'country_city') { |
|
934 | - $hide_text_part = array('gd_region'); |
|
935 | - |
|
936 | - if (isset($location_terms['gd_region']) && !$location_manager) { |
|
937 | - unset($location_terms['gd_region']); |
|
938 | - } |
|
939 | - } else if ($geodir_show_location_url == 'region_city') { |
|
940 | - $hide_text_part = array('gd_country'); |
|
941 | - |
|
942 | - if (isset($location_terms['gd_country']) && !$location_manager) { |
|
943 | - unset($location_terms['gd_country']); |
|
944 | - } |
|
945 | - } else if ($geodir_show_location_url == 'city') { |
|
946 | - $hide_text_part = array('gd_country', 'gd_region'); |
|
947 | - |
|
948 | - if (isset($location_terms['gd_country']) && !$location_manager) { |
|
949 | - unset($location_terms['gd_country']); |
|
950 | - } |
|
951 | - if (isset($location_terms['gd_region']) && !$location_manager) { |
|
952 | - unset($location_terms['gd_region']); |
|
953 | - } |
|
954 | - } |
|
955 | - |
|
956 | - $is_location_last = ''; |
|
957 | - $is_taxonomy_last = ''; |
|
958 | - $breadcrumb .= '<li>'; |
|
959 | - if (get_query_var($gd_post_type . 'category')) |
|
960 | - $gd_taxonomy = $gd_post_type . 'category'; |
|
961 | - elseif (get_query_var($gd_post_type . '_tags')) |
|
962 | - $gd_taxonomy = $gd_post_type . '_tags'; |
|
963 | - |
|
964 | - $breadcrumb .= $separator . '<a href="' . $listing_link . '">' . __(ucfirst($post_type_info->label), 'geodirectory') . '</a>'; |
|
965 | - if (!empty($gd_taxonomy) || geodir_is_page('detail')) |
|
966 | - $is_location_last = false; |
|
967 | - else |
|
968 | - $is_location_last = true; |
|
969 | - |
|
970 | - if (!empty($gd_taxonomy) && geodir_is_page('listing')) |
|
971 | - $is_taxonomy_last = true; |
|
972 | - else |
|
973 | - $is_taxonomy_last = false; |
|
974 | - |
|
975 | - if (!empty($location_terms)) { |
|
976 | - $geodir_get_locations = function_exists('get_actual_location_name') ? true : false; |
|
977 | - |
|
978 | - foreach ($location_terms as $key => $location_term) { |
|
979 | - if ($location_term != '') { |
|
980 | - if (!empty($hide_url_part) && in_array($key, $hide_url_part)) { // Hide location part from url & breadcrumb. |
|
981 | - continue; |
|
982 | - } |
|
983 | - |
|
984 | - $gd_location_link_text = preg_replace('/-(\d+)$/', '', $location_term); |
|
985 | - $gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text); |
|
986 | - $gd_location_link_text = ucfirst($gd_location_link_text); |
|
987 | - |
|
988 | - $location_term_actual_country = ''; |
|
989 | - $location_term_actual_region = ''; |
|
990 | - $location_term_actual_city = ''; |
|
991 | - if ($geodir_get_locations) { |
|
992 | - if ($key == 'gd_country') { |
|
993 | - $location_term_actual_country = get_actual_location_name('country', $location_term, true); |
|
994 | - } else if ($key == 'gd_region') { |
|
995 | - $location_term_actual_region = get_actual_location_name('region', $location_term, true); |
|
996 | - } else if ($key == 'gd_city') { |
|
997 | - $location_term_actual_city = get_actual_location_name('city', $location_term, true); |
|
998 | - } |
|
999 | - } else { |
|
1000 | - $location_info = geodir_get_location(); |
|
1001 | - |
|
1002 | - if (!empty($location_info) && isset($location_info->location_id)) { |
|
1003 | - if ($key == 'gd_country') { |
|
1004 | - $location_term_actual_country = __($location_info->country, 'geodirectory'); |
|
1005 | - } else if ($key == 'gd_region') { |
|
1006 | - $location_term_actual_region = __($location_info->region, 'geodirectory'); |
|
1007 | - } else if ($key == 'gd_city') { |
|
1008 | - $location_term_actual_city = __($location_info->city, 'geodirectory'); |
|
1009 | - } |
|
1010 | - } |
|
1011 | - } |
|
1012 | - |
|
1013 | - if ($is_location_last && $key == 'gd_country' && !(isset($location_terms['gd_region']) && $location_terms['gd_region'] != '') && !(isset($location_terms['gd_city']) && $location_terms['gd_city'] != '')) { |
|
1014 | - $breadcrumb .= $location_term_actual_country != '' ? $separator . $location_term_actual_country : $separator . $gd_location_link_text; |
|
1015 | - } else if ($is_location_last && $key == 'gd_region' && !(isset($location_terms['gd_city']) && $location_terms['gd_city'] != '')) { |
|
1016 | - $breadcrumb .= $location_term_actual_region != '' ? $separator . $location_term_actual_region : $separator . $gd_location_link_text; |
|
1017 | - } else if ($is_location_last && $key == 'gd_city' && empty($location_terms['gd_neighbourhood'])) { |
|
1018 | - $breadcrumb .= $location_term_actual_city != '' ? $separator . $location_term_actual_city : $separator . $gd_location_link_text; |
|
1019 | - } else if ($is_location_last && $key == 'gd_neighbourhood') { |
|
1020 | - $breadcrumb .= $separator . $gd_location_link_text; |
|
1021 | - } else { |
|
1022 | - if (get_option('permalink_structure') != '') { |
|
1023 | - $location_link .= $location_term . '/'; |
|
1024 | - } else { |
|
1025 | - $location_link .= "&$key=" . $location_term; |
|
1026 | - } |
|
951 | + if (isset($location_terms['gd_region']) && !$location_manager) { |
|
952 | + unset($location_terms['gd_region']); |
|
953 | + } |
|
954 | + } |
|
1027 | 955 | |
1028 | - if ($key == 'gd_country' && $location_term_actual_country != '') { |
|
1029 | - $gd_location_link_text = $location_term_actual_country; |
|
1030 | - } else if ($key == 'gd_region' && $location_term_actual_region != '') { |
|
1031 | - $gd_location_link_text = $location_term_actual_region; |
|
1032 | - } else if ($key == 'gd_city' && $location_term_actual_city != '') { |
|
1033 | - $gd_location_link_text = $location_term_actual_city; |
|
1034 | - } |
|
956 | + $is_location_last = ''; |
|
957 | + $is_taxonomy_last = ''; |
|
958 | + $breadcrumb .= '<li>'; |
|
959 | + if (get_query_var($gd_post_type . 'category')) |
|
960 | + $gd_taxonomy = $gd_post_type . 'category'; |
|
961 | + elseif (get_query_var($gd_post_type . '_tags')) |
|
962 | + $gd_taxonomy = $gd_post_type . '_tags'; |
|
963 | + |
|
964 | + $breadcrumb .= $separator . '<a href="' . $listing_link . '">' . __(ucfirst($post_type_info->label), 'geodirectory') . '</a>'; |
|
965 | + if (!empty($gd_taxonomy) || geodir_is_page('detail')) |
|
966 | + $is_location_last = false; |
|
967 | + else |
|
968 | + $is_location_last = true; |
|
969 | + |
|
970 | + if (!empty($gd_taxonomy) && geodir_is_page('listing')) |
|
971 | + $is_taxonomy_last = true; |
|
972 | + else |
|
973 | + $is_taxonomy_last = false; |
|
974 | + |
|
975 | + if (!empty($location_terms)) { |
|
976 | + $geodir_get_locations = function_exists('get_actual_location_name') ? true : false; |
|
977 | + |
|
978 | + foreach ($location_terms as $key => $location_term) { |
|
979 | + if ($location_term != '') { |
|
980 | + if (!empty($hide_url_part) && in_array($key, $hide_url_part)) { // Hide location part from url & breadcrumb. |
|
981 | + continue; |
|
982 | + } |
|
1035 | 983 | |
1036 | - /* |
|
984 | + $gd_location_link_text = preg_replace('/-(\d+)$/', '', $location_term); |
|
985 | + $gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text); |
|
986 | + $gd_location_link_text = ucfirst($gd_location_link_text); |
|
987 | + |
|
988 | + $location_term_actual_country = ''; |
|
989 | + $location_term_actual_region = ''; |
|
990 | + $location_term_actual_city = ''; |
|
991 | + if ($geodir_get_locations) { |
|
992 | + if ($key == 'gd_country') { |
|
993 | + $location_term_actual_country = get_actual_location_name('country', $location_term, true); |
|
994 | + } else if ($key == 'gd_region') { |
|
995 | + $location_term_actual_region = get_actual_location_name('region', $location_term, true); |
|
996 | + } else if ($key == 'gd_city') { |
|
997 | + $location_term_actual_city = get_actual_location_name('city', $location_term, true); |
|
998 | + } |
|
999 | + } else { |
|
1000 | + $location_info = geodir_get_location(); |
|
1001 | + |
|
1002 | + if (!empty($location_info) && isset($location_info->location_id)) { |
|
1003 | + if ($key == 'gd_country') { |
|
1004 | + $location_term_actual_country = __($location_info->country, 'geodirectory'); |
|
1005 | + } else if ($key == 'gd_region') { |
|
1006 | + $location_term_actual_region = __($location_info->region, 'geodirectory'); |
|
1007 | + } else if ($key == 'gd_city') { |
|
1008 | + $location_term_actual_city = __($location_info->city, 'geodirectory'); |
|
1009 | + } |
|
1010 | + } |
|
1011 | + } |
|
1012 | + |
|
1013 | + if ($is_location_last && $key == 'gd_country' && !(isset($location_terms['gd_region']) && $location_terms['gd_region'] != '') && !(isset($location_terms['gd_city']) && $location_terms['gd_city'] != '')) { |
|
1014 | + $breadcrumb .= $location_term_actual_country != '' ? $separator . $location_term_actual_country : $separator . $gd_location_link_text; |
|
1015 | + } else if ($is_location_last && $key == 'gd_region' && !(isset($location_terms['gd_city']) && $location_terms['gd_city'] != '')) { |
|
1016 | + $breadcrumb .= $location_term_actual_region != '' ? $separator . $location_term_actual_region : $separator . $gd_location_link_text; |
|
1017 | + } else if ($is_location_last && $key == 'gd_city' && empty($location_terms['gd_neighbourhood'])) { |
|
1018 | + $breadcrumb .= $location_term_actual_city != '' ? $separator . $location_term_actual_city : $separator . $gd_location_link_text; |
|
1019 | + } else if ($is_location_last && $key == 'gd_neighbourhood') { |
|
1020 | + $breadcrumb .= $separator . $gd_location_link_text; |
|
1021 | + } else { |
|
1022 | + if (get_option('permalink_structure') != '') { |
|
1023 | + $location_link .= $location_term . '/'; |
|
1024 | + } else { |
|
1025 | + $location_link .= "&$key=" . $location_term; |
|
1026 | + } |
|
1027 | + |
|
1028 | + if ($key == 'gd_country' && $location_term_actual_country != '') { |
|
1029 | + $gd_location_link_text = $location_term_actual_country; |
|
1030 | + } else if ($key == 'gd_region' && $location_term_actual_region != '') { |
|
1031 | + $gd_location_link_text = $location_term_actual_region; |
|
1032 | + } else if ($key == 'gd_city' && $location_term_actual_city != '') { |
|
1033 | + $gd_location_link_text = $location_term_actual_city; |
|
1034 | + } |
|
1035 | + |
|
1036 | + /* |
|
1037 | 1037 | if (geodir_is_page('detail') && !empty($hide_text_part) && in_array($key, $hide_text_part)) { |
1038 | 1038 | continue; |
1039 | 1039 | } |
1040 | 1040 | */ |
1041 | 1041 | |
1042 | - $breadcrumb .= $separator . '<a href="' . $location_link . '">' . $gd_location_link_text . '</a>'; |
|
1043 | - } |
|
1044 | - } |
|
1045 | - } |
|
1046 | - } |
|
1047 | - |
|
1048 | - if (!empty($gd_taxonomy)) { |
|
1049 | - $term_index = 1; |
|
1050 | - |
|
1051 | - //if(get_option('geodir_add_categories_url')) |
|
1052 | - { |
|
1053 | - if (get_query_var($gd_post_type . '_tags')) { |
|
1054 | - $cat_link = $listing_link . 'tags/'; |
|
1055 | - } else |
|
1056 | - $cat_link = $listing_link; |
|
1057 | - |
|
1058 | - foreach ($location_terms as $key => $location_term) { |
|
1059 | - if ($location_manager && in_array($key, $hide_url_part)) { |
|
1060 | - continue; |
|
1061 | - } |
|
1062 | - |
|
1063 | - if ($location_term != '') { |
|
1064 | - if (get_option('permalink_structure') != '') { |
|
1065 | - $cat_link .= $location_term . '/'; |
|
1066 | - } |
|
1067 | - } |
|
1068 | - } |
|
1069 | - |
|
1070 | - $term_array = explode("/", trim($wp_query->query[$gd_taxonomy], "/")); |
|
1071 | - foreach ($term_array as $term) { |
|
1072 | - $term_link_text = preg_replace('/-(\d+)$/', '', $term); |
|
1073 | - $term_link_text = preg_replace('/[_-]/', ' ', $term_link_text); |
|
1074 | - |
|
1075 | - // get term actual name |
|
1076 | - $term_info = get_term_by('slug', $term, $gd_taxonomy, 'ARRAY_A'); |
|
1077 | - if (!empty($term_info) && isset($term_info['name']) && $term_info['name'] != '') { |
|
1078 | - $term_link_text = urldecode($term_info['name']); |
|
1079 | - } else { |
|
1080 | - $term_link_text = geodir_ucwords(urldecode($term_link_text)); |
|
1081 | - } |
|
1082 | - |
|
1083 | - if ($term_index == count($term_array) && $is_taxonomy_last) |
|
1084 | - $breadcrumb .= $separator . $term_link_text; |
|
1085 | - else { |
|
1086 | - $cat_link .= $term . '/'; |
|
1087 | - $breadcrumb .= $separator . '<a href="' . $cat_link . '">' . $term_link_text . '</a>'; |
|
1088 | - } |
|
1089 | - $term_index++; |
|
1090 | - } |
|
1091 | - } |
|
1092 | - |
|
1093 | - |
|
1094 | - } |
|
1095 | - |
|
1096 | - if (geodir_is_page('detail')) |
|
1097 | - $breadcrumb .= $separator . get_the_title(); |
|
1098 | - |
|
1099 | - $breadcrumb .= '</li>'; |
|
1100 | - |
|
1101 | - |
|
1102 | - } elseif (geodir_is_page('author')) { |
|
1103 | - $user_id = get_current_user_id(); |
|
1104 | - $author_link = get_author_posts_url($user_id); |
|
1105 | - $default_author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true', 'stype' => 'gd_place'), false); |
|
1106 | - |
|
1107 | - /** |
|
1108 | - * Filter author page link. |
|
1109 | - * |
|
1110 | - * @since 1.0.0 |
|
1111 | - * @param string $default_author_link Default author link. |
|
1112 | - * @param int $user_id Author ID. |
|
1113 | - */ |
|
1114 | - $default_author_link = apply_filters('geodir_dashboard_author_link', $default_author_link, $user_id); |
|
1115 | - |
|
1116 | - $breadcrumb .= '<li>'; |
|
1117 | - $breadcrumb .= $separator . '<a href="' . $default_author_link . '">' . __('My Dashboard', 'geodirectory') . '</a>'; |
|
1118 | - |
|
1119 | - if (isset($_REQUEST['list'])) { |
|
1120 | - $author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true', 'stype' => $_REQUEST['stype']), false); |
|
1121 | - |
|
1122 | - /** |
|
1123 | - * Filter author page link. |
|
1124 | - * |
|
1125 | - * @since 1.0.0 |
|
1126 | - * @param string $author_link Author page link. |
|
1127 | - * @param int $user_id Author ID. |
|
1128 | - * @param string $_REQUEST['stype'] Post type. |
|
1129 | - */ |
|
1130 | - $author_link = apply_filters('geodir_dashboard_author_link', $author_link, $user_id, $_REQUEST['stype']); |
|
1131 | - |
|
1132 | - $breadcrumb .= $separator . '<a href="' . $author_link . '">' . __(ucfirst($post_type_info->label), 'geodirectory') . '</a>'; |
|
1133 | - $breadcrumb .= $separator . ucfirst(__('My', 'geodirectory') . ' ' . $_REQUEST['list']); |
|
1134 | - } else |
|
1135 | - $breadcrumb .= $separator . __(ucfirst($post_type_info->label), 'geodirectory'); |
|
1136 | - |
|
1137 | - $breadcrumb .= '</li>'; |
|
1138 | - } elseif (is_category() || is_single()) { |
|
1139 | - $category = get_the_category(); |
|
1140 | - if (is_category()) { |
|
1141 | - $breadcrumb .= '<li>' . $separator . $category[0]->cat_name . '</li>'; |
|
1142 | - } |
|
1143 | - if (is_single()) { |
|
1144 | - $breadcrumb .= '<li>' . $separator . '<a href="' . get_category_link($category[0]->term_id) . '">' . $category[0]->cat_name . '</a></li>'; |
|
1145 | - $breadcrumb .= '<li>' . $separator . get_the_title() . '</li>'; |
|
1146 | - } |
|
1147 | - /* End of my version ##################################################### */ |
|
1148 | - } else if (is_page()) { |
|
1149 | - $page_title = get_the_title(); |
|
1150 | - |
|
1151 | - if (geodir_is_page('location')) { |
|
1152 | - $page_title = defined('GD_LOCATION') ? GD_LOCATION : __('Location', 'geodirectory'); |
|
1153 | - } |
|
1154 | - |
|
1155 | - $breadcrumb .= '<li>' . $separator; |
|
1156 | - $breadcrumb .= stripslashes_deep($page_title); |
|
1157 | - $breadcrumb .= '</li>'; |
|
1158 | - } else if (is_tag()) { |
|
1159 | - $breadcrumb .= "<li> " . $separator . single_tag_title('',false) . '</li>'; |
|
1160 | - } else if (is_day()) { |
|
1161 | - $breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " "; |
|
1162 | - the_time('F jS, Y'); |
|
1163 | - $breadcrumb .= '</li>'; |
|
1164 | - } else if (is_month()) { |
|
1165 | - $breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " "; |
|
1166 | - the_time('F, Y'); |
|
1167 | - $breadcrumb .= '</li>'; |
|
1168 | - } else if (is_year()) { |
|
1169 | - $breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " "; |
|
1170 | - the_time('Y'); |
|
1171 | - $breadcrumb .= '</li>'; |
|
1172 | - } else if (is_author()) { |
|
1173 | - $breadcrumb .= "<li> " . $separator . __(" Author Archive", 'geodirectory'); |
|
1174 | - $breadcrumb .= '</li>'; |
|
1175 | - } else if (isset($_GET['paged']) && !empty($_GET['paged'])) { |
|
1176 | - $breadcrumb .= "<li>" . $separator . __("Blog Archives", 'geodirectory'); |
|
1177 | - $breadcrumb .= '</li>'; |
|
1178 | - } else if (is_search()) { |
|
1179 | - $breadcrumb .= "<li> " . $separator . __(" Search Results", 'geodirectory'); |
|
1180 | - $breadcrumb .= '</li>'; |
|
1181 | - } |
|
1182 | - $breadcrumb .= '</ul></div>'; |
|
1183 | - |
|
1184 | - /** |
|
1185 | - * Filter breadcrumb html output. |
|
1186 | - * |
|
1187 | - * @since 1.0.0 |
|
1188 | - * @param string $breadcrumb Breadcrumb HTML. |
|
1189 | - * @param string $separator Breadcrumb separator. |
|
1190 | - */ |
|
1191 | - echo $breadcrumb = apply_filters('geodir_breadcrumb', $breadcrumb, $separator); |
|
1192 | - } |
|
1042 | + $breadcrumb .= $separator . '<a href="' . $location_link . '">' . $gd_location_link_text . '</a>'; |
|
1043 | + } |
|
1044 | + } |
|
1045 | + } |
|
1046 | + } |
|
1047 | + |
|
1048 | + if (!empty($gd_taxonomy)) { |
|
1049 | + $term_index = 1; |
|
1050 | + |
|
1051 | + //if(get_option('geodir_add_categories_url')) |
|
1052 | + { |
|
1053 | + if (get_query_var($gd_post_type . '_tags')) { |
|
1054 | + $cat_link = $listing_link . 'tags/'; |
|
1055 | + } else |
|
1056 | + $cat_link = $listing_link; |
|
1057 | + |
|
1058 | + foreach ($location_terms as $key => $location_term) { |
|
1059 | + if ($location_manager && in_array($key, $hide_url_part)) { |
|
1060 | + continue; |
|
1061 | + } |
|
1062 | + |
|
1063 | + if ($location_term != '') { |
|
1064 | + if (get_option('permalink_structure') != '') { |
|
1065 | + $cat_link .= $location_term . '/'; |
|
1066 | + } |
|
1067 | + } |
|
1068 | + } |
|
1069 | + |
|
1070 | + $term_array = explode("/", trim($wp_query->query[$gd_taxonomy], "/")); |
|
1071 | + foreach ($term_array as $term) { |
|
1072 | + $term_link_text = preg_replace('/-(\d+)$/', '', $term); |
|
1073 | + $term_link_text = preg_replace('/[_-]/', ' ', $term_link_text); |
|
1074 | + |
|
1075 | + // get term actual name |
|
1076 | + $term_info = get_term_by('slug', $term, $gd_taxonomy, 'ARRAY_A'); |
|
1077 | + if (!empty($term_info) && isset($term_info['name']) && $term_info['name'] != '') { |
|
1078 | + $term_link_text = urldecode($term_info['name']); |
|
1079 | + } else { |
|
1080 | + $term_link_text = geodir_ucwords(urldecode($term_link_text)); |
|
1081 | + } |
|
1082 | + |
|
1083 | + if ($term_index == count($term_array) && $is_taxonomy_last) |
|
1084 | + $breadcrumb .= $separator . $term_link_text; |
|
1085 | + else { |
|
1086 | + $cat_link .= $term . '/'; |
|
1087 | + $breadcrumb .= $separator . '<a href="' . $cat_link . '">' . $term_link_text . '</a>'; |
|
1088 | + } |
|
1089 | + $term_index++; |
|
1090 | + } |
|
1091 | + } |
|
1092 | + |
|
1093 | + |
|
1094 | + } |
|
1095 | + |
|
1096 | + if (geodir_is_page('detail')) |
|
1097 | + $breadcrumb .= $separator . get_the_title(); |
|
1098 | + |
|
1099 | + $breadcrumb .= '</li>'; |
|
1100 | + |
|
1101 | + |
|
1102 | + } elseif (geodir_is_page('author')) { |
|
1103 | + $user_id = get_current_user_id(); |
|
1104 | + $author_link = get_author_posts_url($user_id); |
|
1105 | + $default_author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true', 'stype' => 'gd_place'), false); |
|
1106 | + |
|
1107 | + /** |
|
1108 | + * Filter author page link. |
|
1109 | + * |
|
1110 | + * @since 1.0.0 |
|
1111 | + * @param string $default_author_link Default author link. |
|
1112 | + * @param int $user_id Author ID. |
|
1113 | + */ |
|
1114 | + $default_author_link = apply_filters('geodir_dashboard_author_link', $default_author_link, $user_id); |
|
1115 | + |
|
1116 | + $breadcrumb .= '<li>'; |
|
1117 | + $breadcrumb .= $separator . '<a href="' . $default_author_link . '">' . __('My Dashboard', 'geodirectory') . '</a>'; |
|
1118 | + |
|
1119 | + if (isset($_REQUEST['list'])) { |
|
1120 | + $author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true', 'stype' => $_REQUEST['stype']), false); |
|
1121 | + |
|
1122 | + /** |
|
1123 | + * Filter author page link. |
|
1124 | + * |
|
1125 | + * @since 1.0.0 |
|
1126 | + * @param string $author_link Author page link. |
|
1127 | + * @param int $user_id Author ID. |
|
1128 | + * @param string $_REQUEST['stype'] Post type. |
|
1129 | + */ |
|
1130 | + $author_link = apply_filters('geodir_dashboard_author_link', $author_link, $user_id, $_REQUEST['stype']); |
|
1131 | + |
|
1132 | + $breadcrumb .= $separator . '<a href="' . $author_link . '">' . __(ucfirst($post_type_info->label), 'geodirectory') . '</a>'; |
|
1133 | + $breadcrumb .= $separator . ucfirst(__('My', 'geodirectory') . ' ' . $_REQUEST['list']); |
|
1134 | + } else |
|
1135 | + $breadcrumb .= $separator . __(ucfirst($post_type_info->label), 'geodirectory'); |
|
1136 | + |
|
1137 | + $breadcrumb .= '</li>'; |
|
1138 | + } elseif (is_category() || is_single()) { |
|
1139 | + $category = get_the_category(); |
|
1140 | + if (is_category()) { |
|
1141 | + $breadcrumb .= '<li>' . $separator . $category[0]->cat_name . '</li>'; |
|
1142 | + } |
|
1143 | + if (is_single()) { |
|
1144 | + $breadcrumb .= '<li>' . $separator . '<a href="' . get_category_link($category[0]->term_id) . '">' . $category[0]->cat_name . '</a></li>'; |
|
1145 | + $breadcrumb .= '<li>' . $separator . get_the_title() . '</li>'; |
|
1146 | + } |
|
1147 | + /* End of my version ##################################################### */ |
|
1148 | + } else if (is_page()) { |
|
1149 | + $page_title = get_the_title(); |
|
1150 | + |
|
1151 | + if (geodir_is_page('location')) { |
|
1152 | + $page_title = defined('GD_LOCATION') ? GD_LOCATION : __('Location', 'geodirectory'); |
|
1153 | + } |
|
1154 | + |
|
1155 | + $breadcrumb .= '<li>' . $separator; |
|
1156 | + $breadcrumb .= stripslashes_deep($page_title); |
|
1157 | + $breadcrumb .= '</li>'; |
|
1158 | + } else if (is_tag()) { |
|
1159 | + $breadcrumb .= "<li> " . $separator . single_tag_title('',false) . '</li>'; |
|
1160 | + } else if (is_day()) { |
|
1161 | + $breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " "; |
|
1162 | + the_time('F jS, Y'); |
|
1163 | + $breadcrumb .= '</li>'; |
|
1164 | + } else if (is_month()) { |
|
1165 | + $breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " "; |
|
1166 | + the_time('F, Y'); |
|
1167 | + $breadcrumb .= '</li>'; |
|
1168 | + } else if (is_year()) { |
|
1169 | + $breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " "; |
|
1170 | + the_time('Y'); |
|
1171 | + $breadcrumb .= '</li>'; |
|
1172 | + } else if (is_author()) { |
|
1173 | + $breadcrumb .= "<li> " . $separator . __(" Author Archive", 'geodirectory'); |
|
1174 | + $breadcrumb .= '</li>'; |
|
1175 | + } else if (isset($_GET['paged']) && !empty($_GET['paged'])) { |
|
1176 | + $breadcrumb .= "<li>" . $separator . __("Blog Archives", 'geodirectory'); |
|
1177 | + $breadcrumb .= '</li>'; |
|
1178 | + } else if (is_search()) { |
|
1179 | + $breadcrumb .= "<li> " . $separator . __(" Search Results", 'geodirectory'); |
|
1180 | + $breadcrumb .= '</li>'; |
|
1181 | + } |
|
1182 | + $breadcrumb .= '</ul></div>'; |
|
1183 | + |
|
1184 | + /** |
|
1185 | + * Filter breadcrumb html output. |
|
1186 | + * |
|
1187 | + * @since 1.0.0 |
|
1188 | + * @param string $breadcrumb Breadcrumb HTML. |
|
1189 | + * @param string $separator Breadcrumb separator. |
|
1190 | + */ |
|
1191 | + echo $breadcrumb = apply_filters('geodir_breadcrumb', $breadcrumb, $separator); |
|
1192 | + } |
|
1193 | 1193 | } |
1194 | 1194 | |
1195 | 1195 | |
1196 | 1196 | add_action("admin_init", "geodir_allow_wpadmin"); // check user is admin |
1197 | 1197 | if (!function_exists('geodir_allow_wpadmin')) { |
1198 | - /** |
|
1199 | - * Allow only admins to access wp-admin. |
|
1200 | - * |
|
1201 | - * Normal users will be redirected to home page. |
|
1202 | - * |
|
1203 | - * @since 1.0.0 |
|
1204 | - * @package GeoDirectory |
|
1205 | - * @global object $wpdb WordPress Database object. |
|
1206 | - */ |
|
1207 | - function geodir_allow_wpadmin() |
|
1208 | - { |
|
1209 | - global $wpdb; |
|
1210 | - if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && (!isset($_REQUEST['action']))) // checking action in request to allow ajax request go through |
|
1211 | - { |
|
1212 | - if (current_user_can('manage_options')) { |
|
1213 | - } else { |
|
1214 | - |
|
1215 | - wp_redirect(home_url()); |
|
1216 | - exit; |
|
1217 | - } |
|
1218 | - |
|
1219 | - } |
|
1220 | - } |
|
1198 | + /** |
|
1199 | + * Allow only admins to access wp-admin. |
|
1200 | + * |
|
1201 | + * Normal users will be redirected to home page. |
|
1202 | + * |
|
1203 | + * @since 1.0.0 |
|
1204 | + * @package GeoDirectory |
|
1205 | + * @global object $wpdb WordPress Database object. |
|
1206 | + */ |
|
1207 | + function geodir_allow_wpadmin() |
|
1208 | + { |
|
1209 | + global $wpdb; |
|
1210 | + if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && (!isset($_REQUEST['action']))) // checking action in request to allow ajax request go through |
|
1211 | + { |
|
1212 | + if (current_user_can('manage_options')) { |
|
1213 | + } else { |
|
1214 | + |
|
1215 | + wp_redirect(home_url()); |
|
1216 | + exit; |
|
1217 | + } |
|
1218 | + |
|
1219 | + } |
|
1220 | + } |
|
1221 | 1221 | } |
1222 | 1222 | |
1223 | 1223 | |
@@ -1231,50 +1231,50 @@ discard block |
||
1231 | 1231 | */ |
1232 | 1232 | function fetch_remote_file($url) |
1233 | 1233 | { |
1234 | - // extract the file name and extension from the url |
|
1235 | - require_once(ABSPATH . 'wp-includes/pluggable.php'); |
|
1236 | - $file_name = basename($url); |
|
1237 | - if (strpos($file_name, '?') !== false) { |
|
1238 | - list($file_name) = explode('?', $file_name); |
|
1239 | - } |
|
1240 | - |
|
1241 | - |
|
1242 | - // get placeholder file in the upload dir with a unique, sanitized filename |
|
1243 | - |
|
1244 | - $post_upload_date = isset($post['upload_date']) ? $post['upload_date'] : ''; |
|
1245 | - |
|
1246 | - $upload = wp_upload_bits($file_name, 0, '', $post_upload_date); |
|
1247 | - if ($upload['error']) |
|
1248 | - return new WP_Error('upload_dir_error', $upload['error']); |
|
1249 | - |
|
1250 | - // fetch the remote url and write it to the placeholder file |
|
1251 | - $headers = wp_remote_get($url, array('stream' => true,'filename' => $upload['file'])); |
|
1252 | - |
|
1253 | - $log_message = ''; |
|
1254 | - $filesize = filesize($upload['file']); |
|
1255 | - // request failed |
|
1256 | - if (!$headers) { |
|
1257 | - $log_message = __('Remote server did not respond', 'geodirectory'); |
|
1258 | - } |
|
1259 | - // make sure the fetch was successful |
|
1260 | - elseif ($headers['response']['code'] != '200') { |
|
1261 | - $log_message = sprintf(__('Remote server returned error response %1$d %2$s', 'geodirectory'), esc_html($headers['response']), get_status_header_desc($headers['response'])); |
|
1262 | - } |
|
1263 | - elseif (isset($headers['headers']['content-length']) && $filesize != $headers['headers']['content-length']) { |
|
1264 | - $log_message = __('Remote file is incorrect size', 'geodirectory'); |
|
1265 | - } |
|
1266 | - elseif (0 == $filesize) { |
|
1267 | - $log_message = __('Zero size file downloaded', 'geodirectory'); |
|
1268 | - } |
|
1269 | - |
|
1270 | - if($log_message){ |
|
1271 | - $del = unlink($upload['file']); |
|
1272 | - if(!$del){geodir_error_log(__('GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory'));} |
|
1273 | - return new WP_Error('import_file_error',$log_message ); |
|
1274 | - } |
|
1275 | - |
|
1276 | - |
|
1277 | - return $upload; |
|
1234 | + // extract the file name and extension from the url |
|
1235 | + require_once(ABSPATH . 'wp-includes/pluggable.php'); |
|
1236 | + $file_name = basename($url); |
|
1237 | + if (strpos($file_name, '?') !== false) { |
|
1238 | + list($file_name) = explode('?', $file_name); |
|
1239 | + } |
|
1240 | + |
|
1241 | + |
|
1242 | + // get placeholder file in the upload dir with a unique, sanitized filename |
|
1243 | + |
|
1244 | + $post_upload_date = isset($post['upload_date']) ? $post['upload_date'] : ''; |
|
1245 | + |
|
1246 | + $upload = wp_upload_bits($file_name, 0, '', $post_upload_date); |
|
1247 | + if ($upload['error']) |
|
1248 | + return new WP_Error('upload_dir_error', $upload['error']); |
|
1249 | + |
|
1250 | + // fetch the remote url and write it to the placeholder file |
|
1251 | + $headers = wp_remote_get($url, array('stream' => true,'filename' => $upload['file'])); |
|
1252 | + |
|
1253 | + $log_message = ''; |
|
1254 | + $filesize = filesize($upload['file']); |
|
1255 | + // request failed |
|
1256 | + if (!$headers) { |
|
1257 | + $log_message = __('Remote server did not respond', 'geodirectory'); |
|
1258 | + } |
|
1259 | + // make sure the fetch was successful |
|
1260 | + elseif ($headers['response']['code'] != '200') { |
|
1261 | + $log_message = sprintf(__('Remote server returned error response %1$d %2$s', 'geodirectory'), esc_html($headers['response']), get_status_header_desc($headers['response'])); |
|
1262 | + } |
|
1263 | + elseif (isset($headers['headers']['content-length']) && $filesize != $headers['headers']['content-length']) { |
|
1264 | + $log_message = __('Remote file is incorrect size', 'geodirectory'); |
|
1265 | + } |
|
1266 | + elseif (0 == $filesize) { |
|
1267 | + $log_message = __('Zero size file downloaded', 'geodirectory'); |
|
1268 | + } |
|
1269 | + |
|
1270 | + if($log_message){ |
|
1271 | + $del = unlink($upload['file']); |
|
1272 | + if(!$del){geodir_error_log(__('GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory'));} |
|
1273 | + return new WP_Error('import_file_error',$log_message ); |
|
1274 | + } |
|
1275 | + |
|
1276 | + |
|
1277 | + return $upload; |
|
1278 | 1278 | } |
1279 | 1279 | |
1280 | 1280 | /** |
@@ -1286,21 +1286,21 @@ discard block |
||
1286 | 1286 | */ |
1287 | 1287 | function geodir_max_upload_size() |
1288 | 1288 | { |
1289 | - $max_filesize = (float)get_option('geodir_upload_max_filesize', 2); |
|
1290 | - |
|
1291 | - if ($max_filesize > 0 && $max_filesize < 1) { |
|
1292 | - $max_filesize = (int)($max_filesize * 1024) . 'kb'; |
|
1293 | - } else { |
|
1294 | - $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb'; |
|
1295 | - } |
|
1296 | - |
|
1297 | - /** |
|
1298 | - * Filter default image upload size limit. |
|
1299 | - * |
|
1300 | - * @since 1.0.0 |
|
1301 | - * @param string $max_filesize Max file upload size. Ex. 10mb, 512kb. |
|
1302 | - */ |
|
1303 | - return apply_filters('geodir_default_image_upload_size_limit', $max_filesize); |
|
1289 | + $max_filesize = (float)get_option('geodir_upload_max_filesize', 2); |
|
1290 | + |
|
1291 | + if ($max_filesize > 0 && $max_filesize < 1) { |
|
1292 | + $max_filesize = (int)($max_filesize * 1024) . 'kb'; |
|
1293 | + } else { |
|
1294 | + $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb'; |
|
1295 | + } |
|
1296 | + |
|
1297 | + /** |
|
1298 | + * Filter default image upload size limit. |
|
1299 | + * |
|
1300 | + * @since 1.0.0 |
|
1301 | + * @param string $max_filesize Max file upload size. Ex. 10mb, 512kb. |
|
1302 | + */ |
|
1303 | + return apply_filters('geodir_default_image_upload_size_limit', $max_filesize); |
|
1304 | 1304 | } |
1305 | 1305 | |
1306 | 1306 | /** |
@@ -1314,11 +1314,11 @@ discard block |
||
1314 | 1314 | */ |
1315 | 1315 | function geodir_dummy_folder_exists() |
1316 | 1316 | { |
1317 | - $path = geodir_plugin_path() . '/geodirectory-admin/dummy/'; |
|
1318 | - if (!is_dir($path)) |
|
1319 | - return false; |
|
1320 | - else |
|
1321 | - return true; |
|
1317 | + $path = geodir_plugin_path() . '/geodirectory-admin/dummy/'; |
|
1318 | + if (!is_dir($path)) |
|
1319 | + return false; |
|
1320 | + else |
|
1321 | + return true; |
|
1322 | 1322 | |
1323 | 1323 | } |
1324 | 1324 | |
@@ -1333,237 +1333,237 @@ discard block |
||
1333 | 1333 | */ |
1334 | 1334 | function geodir_get_author_info($aid) |
1335 | 1335 | { |
1336 | - global $wpdb; |
|
1337 | - /*$infosql = "select * from $wpdb->users where ID=$aid";*/ |
|
1338 | - $infosql = $wpdb->prepare("select * from $wpdb->users where ID=%d", array($aid)); |
|
1339 | - $info = $wpdb->get_results($infosql); |
|
1340 | - if ($info) { |
|
1341 | - return $info[0]; |
|
1342 | - } |
|
1336 | + global $wpdb; |
|
1337 | + /*$infosql = "select * from $wpdb->users where ID=$aid";*/ |
|
1338 | + $infosql = $wpdb->prepare("select * from $wpdb->users where ID=%d", array($aid)); |
|
1339 | + $info = $wpdb->get_results($infosql); |
|
1340 | + if ($info) { |
|
1341 | + return $info[0]; |
|
1342 | + } |
|
1343 | 1343 | } |
1344 | 1344 | |
1345 | 1345 | if (!function_exists('adminEmail')) { |
1346 | - /** |
|
1347 | - * Send emails to client on post submission, renew etc. |
|
1348 | - * |
|
1349 | - * @since 1.0.0 |
|
1350 | - * @package GeoDirectory |
|
1351 | - * @global object $wpdb WordPress Database object. |
|
1352 | - * @param int|string $page_id Page ID. |
|
1353 | - * @param int|string $user_id User ID. |
|
1354 | - * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'. |
|
1355 | - * @param string $custom_1 Custom data to be sent. |
|
1356 | - */ |
|
1357 | - function adminEmail($page_id, $user_id, $message_type, $custom_1 = '') |
|
1358 | - { |
|
1359 | - global $wpdb; |
|
1360 | - if ($message_type == 'expiration') { |
|
1361 | - $subject = stripslashes(__(get_option('renew_email_subject'),'geodirectory')); |
|
1362 | - $client_message = stripslashes(__(get_option('renew_email_content'),'geodirectory')); |
|
1363 | - } elseif ($message_type == 'post_submited') { |
|
1364 | - $subject = __(get_option('post_submited_success_email_subject_admin'),'geodirectory'); |
|
1365 | - $client_message = __(get_option('post_submited_success_email_content_admin'),'geodirectory'); |
|
1366 | - } elseif ($message_type == 'renew') { |
|
1367 | - $subject = __(get_option('post_renew_success_email_subject_admin'),'geodirectory'); |
|
1368 | - $client_message = __(get_option('post_renew_success_email_content_admin'),'geodirectory'); |
|
1369 | - } elseif ($message_type == 'upgrade') { |
|
1370 | - $subject = __(get_option('post_upgrade_success_email_subject_admin'),'geodirectory'); |
|
1371 | - $client_message = __(get_option('post_upgrade_success_email_content_admin'),'geodirectory'); |
|
1372 | - } elseif ($message_type == 'claim_approved') { |
|
1373 | - $subject = __(get_option('claim_approved_email_subject'),'geodirectory'); |
|
1374 | - $client_message = __(get_option('claim_approved_email_content'),'geodirectory'); |
|
1375 | - } elseif ($message_type == 'claim_rejected') { |
|
1376 | - $subject = __(get_option('claim_rejected_email_subject'),'geodirectory'); |
|
1377 | - $client_message = __(get_option('claim_rejected_email_content'),'geodirectory'); |
|
1378 | - } elseif ($message_type == 'claim_requested') { |
|
1379 | - $subject = __(get_option('claim_email_subject_admin'),'geodirectory'); |
|
1380 | - $client_message = __(get_option('claim_email_content_admin'),'geodirectory'); |
|
1381 | - } elseif ($message_type == 'auto_claim') { |
|
1382 | - $subject = __(get_option('auto_claim_email_subject'),'geodirectory'); |
|
1383 | - $client_message = __(get_option('auto_claim_email_content'),'geodirectory'); |
|
1384 | - } elseif ($message_type == 'payment_success') { |
|
1385 | - $subject = __(get_option('post_payment_success_admin_email_subject'),'geodirectory'); |
|
1386 | - $client_message = __(get_option('post_payment_success_admin_email_content'),'geodirectory'); |
|
1387 | - } elseif ($message_type == 'payment_fail') { |
|
1388 | - $subject = __(get_option('post_payment_fail_admin_email_subject'),'geodirectory'); |
|
1389 | - $client_message = __(get_option('post_payment_fail_admin_email_content'),'geodirectory'); |
|
1390 | - } |
|
1391 | - $transaction_details = $custom_1; |
|
1392 | - $fromEmail = get_option('site_email'); |
|
1393 | - $fromEmailName = get_site_emailName(); |
|
1346 | + /** |
|
1347 | + * Send emails to client on post submission, renew etc. |
|
1348 | + * |
|
1349 | + * @since 1.0.0 |
|
1350 | + * @package GeoDirectory |
|
1351 | + * @global object $wpdb WordPress Database object. |
|
1352 | + * @param int|string $page_id Page ID. |
|
1353 | + * @param int|string $user_id User ID. |
|
1354 | + * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'. |
|
1355 | + * @param string $custom_1 Custom data to be sent. |
|
1356 | + */ |
|
1357 | + function adminEmail($page_id, $user_id, $message_type, $custom_1 = '') |
|
1358 | + { |
|
1359 | + global $wpdb; |
|
1360 | + if ($message_type == 'expiration') { |
|
1361 | + $subject = stripslashes(__(get_option('renew_email_subject'),'geodirectory')); |
|
1362 | + $client_message = stripslashes(__(get_option('renew_email_content'),'geodirectory')); |
|
1363 | + } elseif ($message_type == 'post_submited') { |
|
1364 | + $subject = __(get_option('post_submited_success_email_subject_admin'),'geodirectory'); |
|
1365 | + $client_message = __(get_option('post_submited_success_email_content_admin'),'geodirectory'); |
|
1366 | + } elseif ($message_type == 'renew') { |
|
1367 | + $subject = __(get_option('post_renew_success_email_subject_admin'),'geodirectory'); |
|
1368 | + $client_message = __(get_option('post_renew_success_email_content_admin'),'geodirectory'); |
|
1369 | + } elseif ($message_type == 'upgrade') { |
|
1370 | + $subject = __(get_option('post_upgrade_success_email_subject_admin'),'geodirectory'); |
|
1371 | + $client_message = __(get_option('post_upgrade_success_email_content_admin'),'geodirectory'); |
|
1372 | + } elseif ($message_type == 'claim_approved') { |
|
1373 | + $subject = __(get_option('claim_approved_email_subject'),'geodirectory'); |
|
1374 | + $client_message = __(get_option('claim_approved_email_content'),'geodirectory'); |
|
1375 | + } elseif ($message_type == 'claim_rejected') { |
|
1376 | + $subject = __(get_option('claim_rejected_email_subject'),'geodirectory'); |
|
1377 | + $client_message = __(get_option('claim_rejected_email_content'),'geodirectory'); |
|
1378 | + } elseif ($message_type == 'claim_requested') { |
|
1379 | + $subject = __(get_option('claim_email_subject_admin'),'geodirectory'); |
|
1380 | + $client_message = __(get_option('claim_email_content_admin'),'geodirectory'); |
|
1381 | + } elseif ($message_type == 'auto_claim') { |
|
1382 | + $subject = __(get_option('auto_claim_email_subject'),'geodirectory'); |
|
1383 | + $client_message = __(get_option('auto_claim_email_content'),'geodirectory'); |
|
1384 | + } elseif ($message_type == 'payment_success') { |
|
1385 | + $subject = __(get_option('post_payment_success_admin_email_subject'),'geodirectory'); |
|
1386 | + $client_message = __(get_option('post_payment_success_admin_email_content'),'geodirectory'); |
|
1387 | + } elseif ($message_type == 'payment_fail') { |
|
1388 | + $subject = __(get_option('post_payment_fail_admin_email_subject'),'geodirectory'); |
|
1389 | + $client_message = __(get_option('post_payment_fail_admin_email_content'),'geodirectory'); |
|
1390 | + } |
|
1391 | + $transaction_details = $custom_1; |
|
1392 | + $fromEmail = get_option('site_email'); |
|
1393 | + $fromEmailName = get_site_emailName(); |
|
1394 | 1394 | //$alivedays = get_post_meta($page_id,'alive_days',true); |
1395 | - $pkg_limit = get_property_price_info_listing($page_id); |
|
1396 | - $alivedays = $pkg_limit['days']; |
|
1397 | - $productlink = get_permalink($page_id); |
|
1398 | - $post_info = get_post($page_id); |
|
1399 | - $post_date = date('dS F,Y', strtotime($post_info->post_date)); |
|
1400 | - $listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>'; |
|
1401 | - $loginurl = geodir_login_url(); |
|
1402 | - $loginurl_link = '<a href="' . $loginurl . '">login</a>'; |
|
1403 | - $siteurl = home_url(); |
|
1404 | - $siteurl_link = '<a href="' . $siteurl . '">' . $fromEmailName . '</a>'; |
|
1405 | - $user_info = get_userdata($user_id); |
|
1406 | - $user_email = $user_info->user_email; |
|
1407 | - $display_name = geodir_get_client_name($user_id); |
|
1408 | - $user_login = $user_info->user_login; |
|
1409 | - $number_of_grace_days = get_option('ptthemes_listing_preexpiry_notice_days'); |
|
1410 | - if ($number_of_grace_days == '') { |
|
1411 | - $number_of_grace_days = 1; |
|
1412 | - } |
|
1413 | - if ($post_info->post_type == 'event') { |
|
1414 | - $post_type = 'event'; |
|
1415 | - } else { |
|
1416 | - $post_type = 'listing'; |
|
1417 | - } |
|
1418 | - $renew_link = '<a href="' . $siteurl . '?ptype=post_' . $post_type . '&renew=1&pid=' . $page_id . '">' . RENEW_LINK . '</a>'; |
|
1419 | - $search_array = array('[#client_name#]', '[#listing_link#]', '[#posted_date#]', '[#number_of_days#]', '[#number_of_grace_days#]', '[#login_url#]', '[#username#]', '[#user_email#]', '[#site_name_url#]', '[#renew_link#]', '[#post_id#]', '[#site_name#]', '[#transaction_details#]'); |
|
1420 | - $replace_array = array($display_name, $listingLink, $post_date, $alivedays, $number_of_grace_days, $loginurl_link, $user_login, $user_email, $siteurl_link, $renew_link, $page_id, $fromEmailName, $transaction_details); |
|
1421 | - $client_message = str_replace($search_array, $replace_array, $client_message); |
|
1422 | - $subject = str_replace($search_array, $replace_array, $subject); |
|
1423 | - $headers = 'MIME-Version: 1.0' . "\r\n"; |
|
1424 | - $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n"; |
|
1425 | - $headers .= 'From: ' . $fromEmailName . ' <' . $fromEmail . '>' . "\r\n"; |
|
1426 | - |
|
1427 | - $to = $fromEmail; |
|
1428 | - $message = $client_message; |
|
1429 | - $sent = wp_mail($to, $subject, $message, $headers); |
|
1430 | - if( ! $sent ) { |
|
1431 | - if ( is_array( $to ) ) { |
|
1432 | - $to = implode( ',', $to ); |
|
1433 | - } |
|
1434 | - $log_message = sprintf( |
|
1435 | - __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ), |
|
1436 | - $message_type, |
|
1437 | - date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ), |
|
1438 | - $to, |
|
1439 | - $subject |
|
1440 | - ); |
|
1441 | - geodir_error_log( $log_message ); |
|
1442 | - } |
|
1443 | - } |
|
1395 | + $pkg_limit = get_property_price_info_listing($page_id); |
|
1396 | + $alivedays = $pkg_limit['days']; |
|
1397 | + $productlink = get_permalink($page_id); |
|
1398 | + $post_info = get_post($page_id); |
|
1399 | + $post_date = date('dS F,Y', strtotime($post_info->post_date)); |
|
1400 | + $listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>'; |
|
1401 | + $loginurl = geodir_login_url(); |
|
1402 | + $loginurl_link = '<a href="' . $loginurl . '">login</a>'; |
|
1403 | + $siteurl = home_url(); |
|
1404 | + $siteurl_link = '<a href="' . $siteurl . '">' . $fromEmailName . '</a>'; |
|
1405 | + $user_info = get_userdata($user_id); |
|
1406 | + $user_email = $user_info->user_email; |
|
1407 | + $display_name = geodir_get_client_name($user_id); |
|
1408 | + $user_login = $user_info->user_login; |
|
1409 | + $number_of_grace_days = get_option('ptthemes_listing_preexpiry_notice_days'); |
|
1410 | + if ($number_of_grace_days == '') { |
|
1411 | + $number_of_grace_days = 1; |
|
1412 | + } |
|
1413 | + if ($post_info->post_type == 'event') { |
|
1414 | + $post_type = 'event'; |
|
1415 | + } else { |
|
1416 | + $post_type = 'listing'; |
|
1417 | + } |
|
1418 | + $renew_link = '<a href="' . $siteurl . '?ptype=post_' . $post_type . '&renew=1&pid=' . $page_id . '">' . RENEW_LINK . '</a>'; |
|
1419 | + $search_array = array('[#client_name#]', '[#listing_link#]', '[#posted_date#]', '[#number_of_days#]', '[#number_of_grace_days#]', '[#login_url#]', '[#username#]', '[#user_email#]', '[#site_name_url#]', '[#renew_link#]', '[#post_id#]', '[#site_name#]', '[#transaction_details#]'); |
|
1420 | + $replace_array = array($display_name, $listingLink, $post_date, $alivedays, $number_of_grace_days, $loginurl_link, $user_login, $user_email, $siteurl_link, $renew_link, $page_id, $fromEmailName, $transaction_details); |
|
1421 | + $client_message = str_replace($search_array, $replace_array, $client_message); |
|
1422 | + $subject = str_replace($search_array, $replace_array, $subject); |
|
1423 | + $headers = 'MIME-Version: 1.0' . "\r\n"; |
|
1424 | + $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n"; |
|
1425 | + $headers .= 'From: ' . $fromEmailName . ' <' . $fromEmail . '>' . "\r\n"; |
|
1426 | + |
|
1427 | + $to = $fromEmail; |
|
1428 | + $message = $client_message; |
|
1429 | + $sent = wp_mail($to, $subject, $message, $headers); |
|
1430 | + if( ! $sent ) { |
|
1431 | + if ( is_array( $to ) ) { |
|
1432 | + $to = implode( ',', $to ); |
|
1433 | + } |
|
1434 | + $log_message = sprintf( |
|
1435 | + __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ), |
|
1436 | + $message_type, |
|
1437 | + date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ), |
|
1438 | + $to, |
|
1439 | + $subject |
|
1440 | + ); |
|
1441 | + geodir_error_log( $log_message ); |
|
1442 | + } |
|
1443 | + } |
|
1444 | 1444 | } |
1445 | 1445 | |
1446 | 1446 | if (!function_exists('sendEmail')) { |
1447 | - /** |
|
1448 | - * @todo could be a duplicate of geodir_sendEmail. |
|
1449 | - * |
|
1450 | - * @since 1.0.0 |
|
1451 | - * @package GeoDirectory |
|
1452 | - * @param string $fromEmail Sender email address. |
|
1453 | - * @param string $fromEmailName Sender name. |
|
1454 | - * @param string $toEmail Receiver email address. |
|
1455 | - * @param string $toEmailName Receiver name. |
|
1456 | - * @param string $to_subject Email subject. |
|
1457 | - * @param string $to_message Email content. |
|
1458 | - * @param string $extra Not being used. |
|
1459 | - * @param string $message_type The message type. Can be send_friend, send_enquiry, forgot_password, registration. |
|
1460 | - * @param string $post_id The post ID. |
|
1461 | - * @param string $user_id The user ID. |
|
1462 | - */ |
|
1463 | - function sendEmail($fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '') |
|
1464 | - { |
|
1465 | - $login_details = ''; |
|
1466 | - if ($message_type == 'send_friend') { |
|
1467 | - $subject = stripslashes(__(get_option('email_friend_subject'),'geodirectory')); |
|
1468 | - $message = stripslashes(__(get_option('email_friend_content'),'geodirectory')); |
|
1469 | - } elseif ($message_type == 'send_enquiry') { |
|
1470 | - $subject = __(get_option('email_enquiry_subject'),'geodirectory'); |
|
1471 | - $message = __(get_option('email_enquiry_content'),'geodirectory'); |
|
1472 | - } elseif ($message_type == 'forgot_password') { |
|
1473 | - $subject = __(get_option('forgot_password_subject'),'geodirectory'); |
|
1474 | - $message = __(get_option('forgot_password_content'),'geodirectory'); |
|
1475 | - $login_details = $to_message; |
|
1476 | - } elseif ($message_type == 'registration') { |
|
1477 | - $subject = __(get_option('registration_success_email_subject'),'geodirectory'); |
|
1478 | - $message = __(get_option('registration_success_email_content'),'geodirectory'); |
|
1479 | - $login_details = $to_message; |
|
1480 | - } |
|
1481 | - $to_message = nl2br($to_message); |
|
1482 | - $sitefromEmail = get_option('site_email'); |
|
1483 | - $sitefromEmailName = get_site_emailName(); |
|
1484 | - $productlink = get_permalink($post_id); |
|
1485 | - $post_info = get_post($post_id); |
|
1486 | - $listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>'; |
|
1487 | - $siteurl = home_url(); |
|
1488 | - $siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>'; |
|
1489 | - $loginurl = geodir_login_url(); |
|
1490 | - $loginurl_link = '<a href="' . $loginurl . '">login</a>'; |
|
1491 | - if ($fromEmail == '') { |
|
1492 | - $fromEmail = get_option('site_email'); |
|
1493 | - } |
|
1494 | - if ($fromEmailName == '') { |
|
1495 | - $fromEmailName = get_option('site_email_name'); |
|
1496 | - } |
|
1497 | - $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]'); |
|
1498 | - $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName); |
|
1499 | - $message = str_replace($search_array, $replace_array, $message); |
|
1500 | - |
|
1501 | - $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]'); |
|
1502 | - $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName); |
|
1503 | - $subject = str_replace($search_array, $replace_array, $subject); |
|
1504 | - $headers = 'MIME-Version: 1.0' . "\r\n"; |
|
1505 | - $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n"; |
|
1506 | - $headers .= "Reply-To: " . $fromEmail . "\r\n"; |
|
1507 | - $headers .= 'From: ' . $sitefromEmailName . ' <' . $sitefromEmail . '>' . "\r\n"; |
|
1508 | - |
|
1509 | - $to = $toEmail; |
|
1510 | - |
|
1511 | - $sent = wp_mail($to, $subject, $message, $headers); |
|
1512 | - if( ! $sent ) { |
|
1513 | - if ( is_array( $to ) ) { |
|
1514 | - $to = implode( ',', $to ); |
|
1515 | - } |
|
1516 | - $log_message = sprintf( |
|
1517 | - __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ), |
|
1518 | - $message_type, |
|
1519 | - date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ), |
|
1520 | - $to, |
|
1521 | - $subject |
|
1522 | - ); |
|
1523 | - geodir_error_log( $log_message ); |
|
1524 | - } |
|
1525 | - |
|
1526 | - ///////// ADMIN BCC EMIALS |
|
1527 | - $admin_bcc = false; |
|
1528 | - if ($message_type == 'registration') { |
|
1529 | - $message_raw = explode(__("Password:", 'geodirectory'), $message); |
|
1530 | - $message_raw2 = explode("</p>", $message_raw[1], 2); |
|
1531 | - $message = $message_raw[0] . __('Password:', 'geodirectory') . ' **********</p>' . $message_raw2[1]; |
|
1532 | - } |
|
1533 | - $adminEmail = get_bloginfo('admin_email'); |
|
1534 | - $to = $adminEmail; |
|
1535 | - |
|
1536 | - if ($message_type == 'registration' && get_option('bcc_new_user')) { |
|
1537 | - $subject .= ' - ADMIN BCC COPY'; |
|
1538 | - $admin_bcc = true; |
|
1539 | - } |
|
1540 | - elseif ($message_type == 'send_friend' && get_option('bcc_friend')) { |
|
1541 | - $subject .= ' - ADMIN BCC COPY'; |
|
1542 | - $admin_bcc = true; |
|
1543 | - } |
|
1544 | - elseif ($message_type == 'send_enquiry' && get_option('bcc_enquiry')) { |
|
1545 | - $subject .= ' - ADMIN BCC COPY'; |
|
1546 | - $admin_bcc = true; |
|
1547 | - } |
|
1548 | - |
|
1549 | - if($admin_bcc === true){ |
|
1550 | - $sent = wp_mail($to, $subject, $message, $headers); |
|
1551 | - if( ! $sent ) { |
|
1552 | - if ( is_array( $to ) ) { |
|
1553 | - $to = implode( ',', $to ); |
|
1554 | - } |
|
1555 | - $log_message = sprintf( |
|
1556 | - __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ), |
|
1557 | - $message_type, |
|
1558 | - date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ), |
|
1559 | - $to, |
|
1560 | - $subject |
|
1561 | - ); |
|
1562 | - geodir_error_log( $log_message ); |
|
1563 | - } |
|
1564 | - } |
|
1565 | - |
|
1566 | - } |
|
1447 | + /** |
|
1448 | + * @todo could be a duplicate of geodir_sendEmail. |
|
1449 | + * |
|
1450 | + * @since 1.0.0 |
|
1451 | + * @package GeoDirectory |
|
1452 | + * @param string $fromEmail Sender email address. |
|
1453 | + * @param string $fromEmailName Sender name. |
|
1454 | + * @param string $toEmail Receiver email address. |
|
1455 | + * @param string $toEmailName Receiver name. |
|
1456 | + * @param string $to_subject Email subject. |
|
1457 | + * @param string $to_message Email content. |
|
1458 | + * @param string $extra Not being used. |
|
1459 | + * @param string $message_type The message type. Can be send_friend, send_enquiry, forgot_password, registration. |
|
1460 | + * @param string $post_id The post ID. |
|
1461 | + * @param string $user_id The user ID. |
|
1462 | + */ |
|
1463 | + function sendEmail($fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '') |
|
1464 | + { |
|
1465 | + $login_details = ''; |
|
1466 | + if ($message_type == 'send_friend') { |
|
1467 | + $subject = stripslashes(__(get_option('email_friend_subject'),'geodirectory')); |
|
1468 | + $message = stripslashes(__(get_option('email_friend_content'),'geodirectory')); |
|
1469 | + } elseif ($message_type == 'send_enquiry') { |
|
1470 | + $subject = __(get_option('email_enquiry_subject'),'geodirectory'); |
|
1471 | + $message = __(get_option('email_enquiry_content'),'geodirectory'); |
|
1472 | + } elseif ($message_type == 'forgot_password') { |
|
1473 | + $subject = __(get_option('forgot_password_subject'),'geodirectory'); |
|
1474 | + $message = __(get_option('forgot_password_content'),'geodirectory'); |
|
1475 | + $login_details = $to_message; |
|
1476 | + } elseif ($message_type == 'registration') { |
|
1477 | + $subject = __(get_option('registration_success_email_subject'),'geodirectory'); |
|
1478 | + $message = __(get_option('registration_success_email_content'),'geodirectory'); |
|
1479 | + $login_details = $to_message; |
|
1480 | + } |
|
1481 | + $to_message = nl2br($to_message); |
|
1482 | + $sitefromEmail = get_option('site_email'); |
|
1483 | + $sitefromEmailName = get_site_emailName(); |
|
1484 | + $productlink = get_permalink($post_id); |
|
1485 | + $post_info = get_post($post_id); |
|
1486 | + $listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>'; |
|
1487 | + $siteurl = home_url(); |
|
1488 | + $siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>'; |
|
1489 | + $loginurl = geodir_login_url(); |
|
1490 | + $loginurl_link = '<a href="' . $loginurl . '">login</a>'; |
|
1491 | + if ($fromEmail == '') { |
|
1492 | + $fromEmail = get_option('site_email'); |
|
1493 | + } |
|
1494 | + if ($fromEmailName == '') { |
|
1495 | + $fromEmailName = get_option('site_email_name'); |
|
1496 | + } |
|
1497 | + $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]'); |
|
1498 | + $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName); |
|
1499 | + $message = str_replace($search_array, $replace_array, $message); |
|
1500 | + |
|
1501 | + $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]'); |
|
1502 | + $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName); |
|
1503 | + $subject = str_replace($search_array, $replace_array, $subject); |
|
1504 | + $headers = 'MIME-Version: 1.0' . "\r\n"; |
|
1505 | + $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n"; |
|
1506 | + $headers .= "Reply-To: " . $fromEmail . "\r\n"; |
|
1507 | + $headers .= 'From: ' . $sitefromEmailName . ' <' . $sitefromEmail . '>' . "\r\n"; |
|
1508 | + |
|
1509 | + $to = $toEmail; |
|
1510 | + |
|
1511 | + $sent = wp_mail($to, $subject, $message, $headers); |
|
1512 | + if( ! $sent ) { |
|
1513 | + if ( is_array( $to ) ) { |
|
1514 | + $to = implode( ',', $to ); |
|
1515 | + } |
|
1516 | + $log_message = sprintf( |
|
1517 | + __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ), |
|
1518 | + $message_type, |
|
1519 | + date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ), |
|
1520 | + $to, |
|
1521 | + $subject |
|
1522 | + ); |
|
1523 | + geodir_error_log( $log_message ); |
|
1524 | + } |
|
1525 | + |
|
1526 | + ///////// ADMIN BCC EMIALS |
|
1527 | + $admin_bcc = false; |
|
1528 | + if ($message_type == 'registration') { |
|
1529 | + $message_raw = explode(__("Password:", 'geodirectory'), $message); |
|
1530 | + $message_raw2 = explode("</p>", $message_raw[1], 2); |
|
1531 | + $message = $message_raw[0] . __('Password:', 'geodirectory') . ' **********</p>' . $message_raw2[1]; |
|
1532 | + } |
|
1533 | + $adminEmail = get_bloginfo('admin_email'); |
|
1534 | + $to = $adminEmail; |
|
1535 | + |
|
1536 | + if ($message_type == 'registration' && get_option('bcc_new_user')) { |
|
1537 | + $subject .= ' - ADMIN BCC COPY'; |
|
1538 | + $admin_bcc = true; |
|
1539 | + } |
|
1540 | + elseif ($message_type == 'send_friend' && get_option('bcc_friend')) { |
|
1541 | + $subject .= ' - ADMIN BCC COPY'; |
|
1542 | + $admin_bcc = true; |
|
1543 | + } |
|
1544 | + elseif ($message_type == 'send_enquiry' && get_option('bcc_enquiry')) { |
|
1545 | + $subject .= ' - ADMIN BCC COPY'; |
|
1546 | + $admin_bcc = true; |
|
1547 | + } |
|
1548 | + |
|
1549 | + if($admin_bcc === true){ |
|
1550 | + $sent = wp_mail($to, $subject, $message, $headers); |
|
1551 | + if( ! $sent ) { |
|
1552 | + if ( is_array( $to ) ) { |
|
1553 | + $to = implode( ',', $to ); |
|
1554 | + } |
|
1555 | + $log_message = sprintf( |
|
1556 | + __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ), |
|
1557 | + $message_type, |
|
1558 | + date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ), |
|
1559 | + $to, |
|
1560 | + $subject |
|
1561 | + ); |
|
1562 | + geodir_error_log( $log_message ); |
|
1563 | + } |
|
1564 | + } |
|
1565 | + |
|
1566 | + } |
|
1567 | 1567 | } |
1568 | 1568 | |
1569 | 1569 | /* |
@@ -1581,16 +1581,16 @@ discard block |
||
1581 | 1581 | */ |
1582 | 1582 | function gd_lang_object_ids($ids_array, $type) |
1583 | 1583 | { |
1584 | - if (function_exists('icl_object_id')) { |
|
1585 | - $res = array(); |
|
1586 | - foreach ($ids_array as $id) { |
|
1587 | - $xlat = icl_object_id($id, $type, false); |
|
1588 | - if (!is_null($xlat)) $res[] = $xlat; |
|
1589 | - } |
|
1590 | - return $res; |
|
1591 | - } else { |
|
1592 | - return $ids_array; |
|
1593 | - } |
|
1584 | + if (function_exists('icl_object_id')) { |
|
1585 | + $res = array(); |
|
1586 | + foreach ($ids_array as $id) { |
|
1587 | + $xlat = icl_object_id($id, $type, false); |
|
1588 | + if (!is_null($xlat)) $res[] = $xlat; |
|
1589 | + } |
|
1590 | + return $res; |
|
1591 | + } else { |
|
1592 | + return $ids_array; |
|
1593 | + } |
|
1594 | 1594 | } |
1595 | 1595 | |
1596 | 1596 | |
@@ -1605,31 +1605,31 @@ discard block |
||
1605 | 1605 | * @return array Modified Body CSS classes. |
1606 | 1606 | */ |
1607 | 1607 | function geodir_custom_posts_body_class($classes) { |
1608 | - global $wpdb, $wp; |
|
1609 | - $post_types = geodir_get_posttypes('object'); |
|
1610 | - if (!empty($post_types) && count((array)$post_types) > 1) { |
|
1611 | - $classes[] = 'geodir_custom_posts'; |
|
1612 | - } |
|
1613 | - |
|
1614 | - // fix body class for signup page |
|
1615 | - if (geodir_is_page('login')) { |
|
1616 | - $new_classes = array(); |
|
1617 | - $new_classes[] = 'signup page-geodir-signup'; |
|
1618 | - if (!empty($classes)) { |
|
1619 | - foreach ($classes as $class) { |
|
1620 | - if ($class && $class != 'home' && $class != 'blog') { |
|
1621 | - $new_classes[] = $class; |
|
1622 | - } |
|
1623 | - } |
|
1624 | - } |
|
1625 | - $classes = $new_classes; |
|
1626 | - } |
|
1627 | - |
|
1628 | - if (geodir_is_geodir_page()) { |
|
1629 | - $classes[] = 'geodir-page'; |
|
1630 | - } |
|
1631 | - |
|
1632 | - return $classes; |
|
1608 | + global $wpdb, $wp; |
|
1609 | + $post_types = geodir_get_posttypes('object'); |
|
1610 | + if (!empty($post_types) && count((array)$post_types) > 1) { |
|
1611 | + $classes[] = 'geodir_custom_posts'; |
|
1612 | + } |
|
1613 | + |
|
1614 | + // fix body class for signup page |
|
1615 | + if (geodir_is_page('login')) { |
|
1616 | + $new_classes = array(); |
|
1617 | + $new_classes[] = 'signup page-geodir-signup'; |
|
1618 | + if (!empty($classes)) { |
|
1619 | + foreach ($classes as $class) { |
|
1620 | + if ($class && $class != 'home' && $class != 'blog') { |
|
1621 | + $new_classes[] = $class; |
|
1622 | + } |
|
1623 | + } |
|
1624 | + } |
|
1625 | + $classes = $new_classes; |
|
1626 | + } |
|
1627 | + |
|
1628 | + if (geodir_is_geodir_page()) { |
|
1629 | + $classes[] = 'geodir-page'; |
|
1630 | + } |
|
1631 | + |
|
1632 | + return $classes; |
|
1633 | 1633 | } |
1634 | 1634 | |
1635 | 1635 | add_filter('body_class', 'geodir_custom_posts_body_class'); // let's add a class to the body so we can style the new addition to the search |
@@ -1644,12 +1644,12 @@ discard block |
||
1644 | 1644 | */ |
1645 | 1645 | function geodir_map_zoom_level() |
1646 | 1646 | { |
1647 | - /** |
|
1648 | - * Filter GD map zoom level. |
|
1649 | - * |
|
1650 | - * @since 1.0.0 |
|
1651 | - */ |
|
1652 | - return apply_filters('geodir_map_zoom_level', array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19)); |
|
1647 | + /** |
|
1648 | + * Filter GD map zoom level. |
|
1649 | + * |
|
1650 | + * @since 1.0.0 |
|
1651 | + */ |
|
1652 | + return apply_filters('geodir_map_zoom_level', array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19)); |
|
1653 | 1653 | |
1654 | 1654 | } |
1655 | 1655 | |
@@ -1663,12 +1663,12 @@ discard block |
||
1663 | 1663 | */ |
1664 | 1664 | function geodir_option_version_backup($geodir_option_name) |
1665 | 1665 | { |
1666 | - $version_date = time(); |
|
1667 | - $geodir_option = get_option($geodir_option_name); |
|
1666 | + $version_date = time(); |
|
1667 | + $geodir_option = get_option($geodir_option_name); |
|
1668 | 1668 | |
1669 | - if (!empty($geodir_option)) { |
|
1670 | - add_option($geodir_option_name . '_' . $version_date, $geodir_option); |
|
1671 | - } |
|
1669 | + if (!empty($geodir_option)) { |
|
1670 | + add_option($geodir_option_name . '_' . $version_date, $geodir_option); |
|
1671 | + } |
|
1672 | 1672 | } |
1673 | 1673 | |
1674 | 1674 | /** |
@@ -1681,11 +1681,11 @@ discard block |
||
1681 | 1681 | */ |
1682 | 1682 | function get_page_id_geodir_add_listing_page($page_id) |
1683 | 1683 | { |
1684 | - if (geodir_wpml_multilingual_status()) { |
|
1685 | - $post_type = 'post_page'; |
|
1686 | - $page_id = geodir_get_wpml_element_id($page_id, $post_type); |
|
1687 | - } |
|
1688 | - return $page_id; |
|
1684 | + if (geodir_wpml_multilingual_status()) { |
|
1685 | + $post_type = 'post_page'; |
|
1686 | + $page_id = geodir_get_wpml_element_id($page_id, $post_type); |
|
1687 | + } |
|
1688 | + return $page_id; |
|
1689 | 1689 | } |
1690 | 1690 | |
1691 | 1691 | /** |
@@ -1697,10 +1697,10 @@ discard block |
||
1697 | 1697 | */ |
1698 | 1698 | function geodir_wpml_multilingual_status() |
1699 | 1699 | { |
1700 | - if (function_exists('icl_object_id')) { |
|
1701 | - return true; |
|
1702 | - } |
|
1703 | - return false; |
|
1700 | + if (function_exists('icl_object_id')) { |
|
1701 | + return true; |
|
1702 | + } |
|
1703 | + return false; |
|
1704 | 1704 | } |
1705 | 1705 | |
1706 | 1706 | /** |
@@ -1714,22 +1714,22 @@ discard block |
||
1714 | 1714 | */ |
1715 | 1715 | function geodir_get_wpml_element_id($page_id, $post_type) |
1716 | 1716 | { |
1717 | - global $sitepress; |
|
1718 | - if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) { |
|
1719 | - $trid = $sitepress->get_element_trid($page_id, $post_type); |
|
1720 | - |
|
1721 | - if ($trid > 0) { |
|
1722 | - $translations = $sitepress->get_element_translations($trid, $post_type); |
|
1723 | - |
|
1724 | - $lang = $sitepress->get_current_language(); |
|
1725 | - $lang = $lang ? $lang : $sitepress->get_default_language(); |
|
1726 | - |
|
1727 | - if (!empty($translations) && !empty($lang) && isset($translations[$lang]) && isset($translations[$lang]->element_id) && !empty($translations[$lang]->element_id)) { |
|
1728 | - $page_id = $translations[$lang]->element_id; |
|
1729 | - } |
|
1730 | - } |
|
1731 | - } |
|
1732 | - return $page_id; |
|
1717 | + global $sitepress; |
|
1718 | + if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) { |
|
1719 | + $trid = $sitepress->get_element_trid($page_id, $post_type); |
|
1720 | + |
|
1721 | + if ($trid > 0) { |
|
1722 | + $translations = $sitepress->get_element_translations($trid, $post_type); |
|
1723 | + |
|
1724 | + $lang = $sitepress->get_current_language(); |
|
1725 | + $lang = $lang ? $lang : $sitepress->get_default_language(); |
|
1726 | + |
|
1727 | + if (!empty($translations) && !empty($lang) && isset($translations[$lang]) && isset($translations[$lang]->element_id) && !empty($translations[$lang]->element_id)) { |
|
1728 | + $page_id = $translations[$lang]->element_id; |
|
1729 | + } |
|
1730 | + } |
|
1731 | + } |
|
1732 | + return $page_id; |
|
1733 | 1733 | } |
1734 | 1734 | |
1735 | 1735 | /** |
@@ -1741,20 +1741,20 @@ discard block |
||
1741 | 1741 | */ |
1742 | 1742 | function geodir_wpml_check_element_id() |
1743 | 1743 | { |
1744 | - global $sitepress; |
|
1745 | - if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) { |
|
1746 | - $el_type = 'post_page'; |
|
1747 | - $el_id = get_option('geodir_add_listing_page'); |
|
1748 | - $default_lang = $sitepress->get_default_language(); |
|
1749 | - $el_details = $sitepress->get_element_language_details($el_id, $el_type); |
|
1750 | - |
|
1751 | - if (!($el_id > 0 && $default_lang && !empty($el_details) && isset($el_details->language_code) && $el_details->language_code == $default_lang)) { |
|
1752 | - if (!$el_details->source_language_code) { |
|
1753 | - $sitepress->set_element_language_details($el_id, $el_type, '', $default_lang); |
|
1754 | - $sitepress->icl_translations_cache->clear(); |
|
1755 | - } |
|
1756 | - } |
|
1757 | - } |
|
1744 | + global $sitepress; |
|
1745 | + if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) { |
|
1746 | + $el_type = 'post_page'; |
|
1747 | + $el_id = get_option('geodir_add_listing_page'); |
|
1748 | + $default_lang = $sitepress->get_default_language(); |
|
1749 | + $el_details = $sitepress->get_element_language_details($el_id, $el_type); |
|
1750 | + |
|
1751 | + if (!($el_id > 0 && $default_lang && !empty($el_details) && isset($el_details->language_code) && $el_details->language_code == $default_lang)) { |
|
1752 | + if (!$el_details->source_language_code) { |
|
1753 | + $sitepress->set_element_language_details($el_id, $el_type, '', $default_lang); |
|
1754 | + $sitepress->icl_translations_cache->clear(); |
|
1755 | + } |
|
1756 | + } |
|
1757 | + } |
|
1758 | 1758 | } |
1759 | 1759 | |
1760 | 1760 | /** |
@@ -1769,44 +1769,44 @@ discard block |
||
1769 | 1769 | */ |
1770 | 1770 | function geodir_widget_listings_get_order($query_args) |
1771 | 1771 | { |
1772 | - global $wpdb, $plugin_prefix, $gd_query_args_widgets; |
|
1773 | - |
|
1774 | - $query_args = $gd_query_args_widgets; |
|
1775 | - if (empty($query_args) || empty($query_args['is_geodir_loop'])) { |
|
1776 | - return $wpdb->posts . ".post_date DESC, "; |
|
1777 | - } |
|
1778 | - |
|
1779 | - $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type']; |
|
1780 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
1781 | - |
|
1782 | - $sort_by = !empty($query_args['order_by']) ? $query_args['order_by'] : ''; |
|
1783 | - |
|
1784 | - switch ($sort_by) { |
|
1785 | - case 'latest': |
|
1786 | - case 'newest': |
|
1787 | - $orderby = $wpdb->posts . ".post_date DESC, "; |
|
1788 | - break; |
|
1789 | - case 'featured': |
|
1790 | - $orderby = $table . ".is_featured ASC, "; |
|
1791 | - break; |
|
1792 | - case 'az': |
|
1793 | - $orderby = $wpdb->posts . ".post_title ASC, "; |
|
1794 | - break; |
|
1795 | - case 'high_review': |
|
1796 | - $orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, "; |
|
1797 | - break; |
|
1798 | - case 'high_rating': |
|
1799 | - $orderby = "( " . $table . ".overall_rating ) DESC, "; |
|
1800 | - break; |
|
1801 | - case 'random': |
|
1802 | - $orderby = "RAND(), "; |
|
1803 | - break; |
|
1804 | - default: |
|
1805 | - $orderby = $wpdb->posts . ".post_title ASC, "; |
|
1806 | - break; |
|
1807 | - } |
|
1808 | - |
|
1809 | - return $orderby; |
|
1772 | + global $wpdb, $plugin_prefix, $gd_query_args_widgets; |
|
1773 | + |
|
1774 | + $query_args = $gd_query_args_widgets; |
|
1775 | + if (empty($query_args) || empty($query_args['is_geodir_loop'])) { |
|
1776 | + return $wpdb->posts . ".post_date DESC, "; |
|
1777 | + } |
|
1778 | + |
|
1779 | + $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type']; |
|
1780 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
1781 | + |
|
1782 | + $sort_by = !empty($query_args['order_by']) ? $query_args['order_by'] : ''; |
|
1783 | + |
|
1784 | + switch ($sort_by) { |
|
1785 | + case 'latest': |
|
1786 | + case 'newest': |
|
1787 | + $orderby = $wpdb->posts . ".post_date DESC, "; |
|
1788 | + break; |
|
1789 | + case 'featured': |
|
1790 | + $orderby = $table . ".is_featured ASC, "; |
|
1791 | + break; |
|
1792 | + case 'az': |
|
1793 | + $orderby = $wpdb->posts . ".post_title ASC, "; |
|
1794 | + break; |
|
1795 | + case 'high_review': |
|
1796 | + $orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, "; |
|
1797 | + break; |
|
1798 | + case 'high_rating': |
|
1799 | + $orderby = "( " . $table . ".overall_rating ) DESC, "; |
|
1800 | + break; |
|
1801 | + case 'random': |
|
1802 | + $orderby = "RAND(), "; |
|
1803 | + break; |
|
1804 | + default: |
|
1805 | + $orderby = $wpdb->posts . ".post_title ASC, "; |
|
1806 | + break; |
|
1807 | + } |
|
1808 | + |
|
1809 | + return $orderby; |
|
1810 | 1810 | } |
1811 | 1811 | |
1812 | 1812 | /** |
@@ -1824,126 +1824,126 @@ discard block |
||
1824 | 1824 | */ |
1825 | 1825 | function geodir_get_widget_listings($query_args = array(), $count_only = false) |
1826 | 1826 | { |
1827 | - global $wpdb, $plugin_prefix, $table_prefix; |
|
1828 | - $GLOBALS['gd_query_args_widgets'] = $query_args; |
|
1829 | - $gd_query_args_widgets = $query_args; |
|
1830 | - |
|
1831 | - $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type']; |
|
1832 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
1833 | - |
|
1834 | - $fields = $wpdb->posts . ".*, " . $table . ".*"; |
|
1835 | - /** |
|
1836 | - * Filter widget listing fields string part that is being used for query. |
|
1837 | - * |
|
1838 | - * @since 1.0.0 |
|
1839 | - * @param string $fields Fields string. |
|
1840 | - * @param string $table Table name. |
|
1841 | - * @param string $post_type Post type. |
|
1842 | - */ |
|
1843 | - $fields = apply_filters('geodir_filter_widget_listings_fields', $fields, $table, $post_type); |
|
1844 | - |
|
1845 | - $join = "INNER JOIN " . $table . " ON (" . $table . ".post_id = " . $wpdb->posts . ".ID)"; |
|
1827 | + global $wpdb, $plugin_prefix, $table_prefix; |
|
1828 | + $GLOBALS['gd_query_args_widgets'] = $query_args; |
|
1829 | + $gd_query_args_widgets = $query_args; |
|
1830 | + |
|
1831 | + $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type']; |
|
1832 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
1833 | + |
|
1834 | + $fields = $wpdb->posts . ".*, " . $table . ".*"; |
|
1835 | + /** |
|
1836 | + * Filter widget listing fields string part that is being used for query. |
|
1837 | + * |
|
1838 | + * @since 1.0.0 |
|
1839 | + * @param string $fields Fields string. |
|
1840 | + * @param string $table Table name. |
|
1841 | + * @param string $post_type Post type. |
|
1842 | + */ |
|
1843 | + $fields = apply_filters('geodir_filter_widget_listings_fields', $fields, $table, $post_type); |
|
1844 | + |
|
1845 | + $join = "INNER JOIN " . $table . " ON (" . $table . ".post_id = " . $wpdb->posts . ".ID)"; |
|
1846 | + |
|
1847 | + ########### WPML ########### |
|
1848 | + |
|
1849 | + if (function_exists('icl_object_id')) { |
|
1850 | + global $sitepress; |
|
1851 | + $lang_code = ICL_LANGUAGE_CODE; |
|
1852 | + if ($lang_code) { |
|
1853 | + $join .= " JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID"; |
|
1854 | + } |
|
1855 | + } |
|
1846 | 1856 | |
1847 | - ########### WPML ########### |
|
1857 | + ########### WPML ########### |
|
1848 | 1858 | |
1849 | - if (function_exists('icl_object_id')) { |
|
1850 | - global $sitepress; |
|
1851 | - $lang_code = ICL_LANGUAGE_CODE; |
|
1852 | - if ($lang_code) { |
|
1853 | - $join .= " JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID"; |
|
1854 | - } |
|
1855 | - } |
|
1859 | + /** |
|
1860 | + * Filter widget listing join clause string part that is being used for query. |
|
1861 | + * |
|
1862 | + * @since 1.0.0 |
|
1863 | + * @param string $join Join clause string. |
|
1864 | + * @param string $post_type Post type. |
|
1865 | + */ |
|
1866 | + $join = apply_filters('geodir_filter_widget_listings_join', $join, $post_type); |
|
1856 | 1867 | |
1857 | - ########### WPML ########### |
|
1868 | + $post_status = is_super_admin() ? " OR " . $wpdb->posts . ".post_status = 'private'" : ''; |
|
1858 | 1869 | |
1859 | - /** |
|
1860 | - * Filter widget listing join clause string part that is being used for query. |
|
1861 | - * |
|
1862 | - * @since 1.0.0 |
|
1863 | - * @param string $join Join clause string. |
|
1864 | - * @param string $post_type Post type. |
|
1865 | - */ |
|
1866 | - $join = apply_filters('geodir_filter_widget_listings_join', $join, $post_type); |
|
1867 | - |
|
1868 | - $post_status = is_super_admin() ? " OR " . $wpdb->posts . ".post_status = 'private'" : ''; |
|
1869 | - |
|
1870 | - $where = " AND ( " . $wpdb->posts . ".post_status = 'publish' " . $post_status . " ) AND " . $wpdb->posts . ".post_type = '" . $post_type . "'"; |
|
1871 | - |
|
1872 | - ########### WPML ########### |
|
1873 | - if (function_exists('icl_object_id')) { |
|
1874 | - if ($lang_code) { |
|
1875 | - $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type = 'post_$post_type' "; |
|
1876 | - } |
|
1877 | - } |
|
1878 | - ########### WPML ########### |
|
1879 | - /** |
|
1880 | - * Filter widget listing where clause string part that is being used for query. |
|
1881 | - * |
|
1882 | - * @since 1.0.0 |
|
1883 | - * @param string $where Where clause string. |
|
1884 | - * @param string $post_type Post type. |
|
1885 | - */ |
|
1886 | - $where = apply_filters('geodir_filter_widget_listings_where', $where, $post_type); |
|
1887 | - $where = $where != '' ? " WHERE 1=1 " . $where : ''; |
|
1888 | - |
|
1889 | - $groupby = " GROUP BY $wpdb->posts.ID "; |
|
1890 | - /** |
|
1891 | - * Filter widget listing groupby clause string part that is being used for query. |
|
1892 | - * |
|
1893 | - * @since 1.0.0 |
|
1894 | - * @param string $groupby Group by clause string. |
|
1895 | - * @param string $post_type Post type. |
|
1896 | - */ |
|
1897 | - $groupby = apply_filters('geodir_filter_widget_listings_groupby', $groupby, $post_type); |
|
1870 | + $where = " AND ( " . $wpdb->posts . ".post_status = 'publish' " . $post_status . " ) AND " . $wpdb->posts . ".post_type = '" . $post_type . "'"; |
|
1898 | 1871 | |
1899 | - if ($count_only) { |
|
1900 | - $sql = "SELECT COUNT(" . $wpdb->posts . ".ID) AS total FROM " . $wpdb->posts . " |
|
1872 | + ########### WPML ########### |
|
1873 | + if (function_exists('icl_object_id')) { |
|
1874 | + if ($lang_code) { |
|
1875 | + $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type = 'post_$post_type' "; |
|
1876 | + } |
|
1877 | + } |
|
1878 | + ########### WPML ########### |
|
1879 | + /** |
|
1880 | + * Filter widget listing where clause string part that is being used for query. |
|
1881 | + * |
|
1882 | + * @since 1.0.0 |
|
1883 | + * @param string $where Where clause string. |
|
1884 | + * @param string $post_type Post type. |
|
1885 | + */ |
|
1886 | + $where = apply_filters('geodir_filter_widget_listings_where', $where, $post_type); |
|
1887 | + $where = $where != '' ? " WHERE 1=1 " . $where : ''; |
|
1888 | + |
|
1889 | + $groupby = " GROUP BY $wpdb->posts.ID "; |
|
1890 | + /** |
|
1891 | + * Filter widget listing groupby clause string part that is being used for query. |
|
1892 | + * |
|
1893 | + * @since 1.0.0 |
|
1894 | + * @param string $groupby Group by clause string. |
|
1895 | + * @param string $post_type Post type. |
|
1896 | + */ |
|
1897 | + $groupby = apply_filters('geodir_filter_widget_listings_groupby', $groupby, $post_type); |
|
1898 | + |
|
1899 | + if ($count_only) { |
|
1900 | + $sql = "SELECT COUNT(" . $wpdb->posts . ".ID) AS total FROM " . $wpdb->posts . " |
|
1901 | 1901 | " . $join . " |
1902 | 1902 | " . $where; |
1903 | - $rows = (int)$wpdb->get_var($sql); |
|
1904 | - } else { |
|
1905 | - $orderby = geodir_widget_listings_get_order($query_args); |
|
1906 | - /** |
|
1907 | - * Filter widget listing orderby clause string part that is being used for query. |
|
1908 | - * |
|
1909 | - * @since 1.0.0 |
|
1910 | - * @param string $orderby Order by clause string. |
|
1911 | - * @param string $table Table name. |
|
1912 | - * @param string $post_type Post type. |
|
1913 | - */ |
|
1914 | - $orderby = apply_filters('geodir_filter_widget_listings_orderby', $orderby, $table, $post_type); |
|
1915 | - $orderby .= $wpdb->posts . ".post_title ASC"; |
|
1916 | - $orderby = $orderby != '' ? " ORDER BY " . $orderby : ''; |
|
1917 | - |
|
1918 | - $limit = !empty($query_args['posts_per_page']) ? $query_args['posts_per_page'] : 5; |
|
1919 | - /** |
|
1920 | - * Filter widget listing limit that is being used for query. |
|
1921 | - * |
|
1922 | - * @since 1.0.0 |
|
1923 | - * @param int $limit Query results limit. |
|
1924 | - * @param string $post_type Post type. |
|
1925 | - */ |
|
1926 | - $limit = apply_filters('geodir_filter_widget_listings_limit', $limit, $post_type); |
|
1927 | - |
|
1928 | - $page = !empty($query_args['pageno']) ? absint($query_args['pageno']) : 1; |
|
1929 | - if ( !$page ) |
|
1930 | - $page = 1; |
|
1931 | - |
|
1932 | - $limit = (int)$limit > 0 ? " LIMIT " . absint( ( $page - 1 ) * (int)$limit ) . ", " . (int)$limit : ""; |
|
1933 | - |
|
1934 | - $sql = "SELECT SQL_CALC_FOUND_ROWS " . $fields . " FROM " . $wpdb->posts . " |
|
1903 | + $rows = (int)$wpdb->get_var($sql); |
|
1904 | + } else { |
|
1905 | + $orderby = geodir_widget_listings_get_order($query_args); |
|
1906 | + /** |
|
1907 | + * Filter widget listing orderby clause string part that is being used for query. |
|
1908 | + * |
|
1909 | + * @since 1.0.0 |
|
1910 | + * @param string $orderby Order by clause string. |
|
1911 | + * @param string $table Table name. |
|
1912 | + * @param string $post_type Post type. |
|
1913 | + */ |
|
1914 | + $orderby = apply_filters('geodir_filter_widget_listings_orderby', $orderby, $table, $post_type); |
|
1915 | + $orderby .= $wpdb->posts . ".post_title ASC"; |
|
1916 | + $orderby = $orderby != '' ? " ORDER BY " . $orderby : ''; |
|
1917 | + |
|
1918 | + $limit = !empty($query_args['posts_per_page']) ? $query_args['posts_per_page'] : 5; |
|
1919 | + /** |
|
1920 | + * Filter widget listing limit that is being used for query. |
|
1921 | + * |
|
1922 | + * @since 1.0.0 |
|
1923 | + * @param int $limit Query results limit. |
|
1924 | + * @param string $post_type Post type. |
|
1925 | + */ |
|
1926 | + $limit = apply_filters('geodir_filter_widget_listings_limit', $limit, $post_type); |
|
1927 | + |
|
1928 | + $page = !empty($query_args['pageno']) ? absint($query_args['pageno']) : 1; |
|
1929 | + if ( !$page ) |
|
1930 | + $page = 1; |
|
1931 | + |
|
1932 | + $limit = (int)$limit > 0 ? " LIMIT " . absint( ( $page - 1 ) * (int)$limit ) . ", " . (int)$limit : ""; |
|
1933 | + |
|
1934 | + $sql = "SELECT SQL_CALC_FOUND_ROWS " . $fields . " FROM " . $wpdb->posts . " |
|
1935 | 1935 | " . $join . " |
1936 | 1936 | " . $where . " |
1937 | 1937 | " . $groupby . " |
1938 | 1938 | " . $orderby . " |
1939 | 1939 | " . $limit; |
1940 | - $rows = $wpdb->get_results($sql); |
|
1941 | - } |
|
1940 | + $rows = $wpdb->get_results($sql); |
|
1941 | + } |
|
1942 | 1942 | |
1943 | - unset($GLOBALS['gd_query_args_widgets']); |
|
1944 | - unset($gd_query_args_widgets); |
|
1943 | + unset($GLOBALS['gd_query_args_widgets']); |
|
1944 | + unset($gd_query_args_widgets); |
|
1945 | 1945 | |
1946 | - return $rows; |
|
1946 | + return $rows; |
|
1947 | 1947 | } |
1948 | 1948 | |
1949 | 1949 | /** |
@@ -1958,14 +1958,14 @@ discard block |
||
1958 | 1958 | */ |
1959 | 1959 | function geodir_function_widget_listings_fields($fields) |
1960 | 1960 | { |
1961 | - global $wpdb, $plugin_prefix, $gd_query_args_widgets; |
|
1961 | + global $wpdb, $plugin_prefix, $gd_query_args_widgets; |
|
1962 | 1962 | |
1963 | - $query_args = $gd_query_args_widgets; |
|
1964 | - if (empty($query_args) || empty($query_args['is_geodir_loop'])) { |
|
1965 | - return $fields; |
|
1966 | - } |
|
1963 | + $query_args = $gd_query_args_widgets; |
|
1964 | + if (empty($query_args) || empty($query_args['is_geodir_loop'])) { |
|
1965 | + return $fields; |
|
1966 | + } |
|
1967 | 1967 | |
1968 | - return $fields; |
|
1968 | + return $fields; |
|
1969 | 1969 | } |
1970 | 1970 | |
1971 | 1971 | /** |
@@ -1980,28 +1980,28 @@ discard block |
||
1980 | 1980 | */ |
1981 | 1981 | function geodir_function_widget_listings_join($join) |
1982 | 1982 | { |
1983 | - global $wpdb, $plugin_prefix, $gd_query_args_widgets; |
|
1983 | + global $wpdb, $plugin_prefix, $gd_query_args_widgets; |
|
1984 | 1984 | |
1985 | - $query_args = $gd_query_args_widgets; |
|
1986 | - if (empty($query_args) || empty($query_args['is_geodir_loop'])) { |
|
1987 | - return $join; |
|
1988 | - } |
|
1985 | + $query_args = $gd_query_args_widgets; |
|
1986 | + if (empty($query_args) || empty($query_args['is_geodir_loop'])) { |
|
1987 | + return $join; |
|
1988 | + } |
|
1989 | 1989 | |
1990 | - $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type']; |
|
1991 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
1990 | + $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type']; |
|
1991 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
1992 | 1992 | |
1993 | - if (!empty($query_args['with_pics_only'])) { |
|
1994 | - $join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )"; |
|
1995 | - } |
|
1993 | + if (!empty($query_args['with_pics_only'])) { |
|
1994 | + $join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )"; |
|
1995 | + } |
|
1996 | 1996 | |
1997 | - if (!empty($query_args['tax_query'])) { |
|
1998 | - $tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID'); |
|
1999 | - if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) { |
|
2000 | - $join .= $tax_queries['join']; |
|
2001 | - } |
|
2002 | - } |
|
1997 | + if (!empty($query_args['tax_query'])) { |
|
1998 | + $tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID'); |
|
1999 | + if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) { |
|
2000 | + $join .= $tax_queries['join']; |
|
2001 | + } |
|
2002 | + } |
|
2003 | 2003 | |
2004 | - return $join; |
|
2004 | + return $join; |
|
2005 | 2005 | } |
2006 | 2006 | |
2007 | 2007 | /** |
@@ -2016,55 +2016,55 @@ discard block |
||
2016 | 2016 | */ |
2017 | 2017 | function geodir_function_widget_listings_where($where) |
2018 | 2018 | { |
2019 | - global $wpdb, $plugin_prefix, $gd_query_args_widgets; |
|
2020 | - |
|
2021 | - $query_args = $gd_query_args_widgets; |
|
2022 | - if (empty($query_args) || empty($query_args['is_geodir_loop'])) { |
|
2023 | - return $where; |
|
2024 | - } |
|
2025 | - $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type']; |
|
2026 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
2027 | - |
|
2028 | - if (!empty($query_args)) { |
|
2029 | - if (!empty($query_args['gd_location']) && function_exists('geodir_default_location_where')) { |
|
2030 | - $where = geodir_default_location_where($where, $table); |
|
2031 | - } |
|
2032 | - |
|
2033 | - if (!empty($query_args['post_author'])) { |
|
2034 | - $where .= " AND " . $wpdb->posts . ".post_author = " . (int)$query_args['post_author']; |
|
2035 | - } |
|
2036 | - |
|
2037 | - if (!empty($query_args['show_featured_only'])) { |
|
2038 | - $where .= " AND " . $table . ".is_featured = '1'"; |
|
2039 | - } |
|
2019 | + global $wpdb, $plugin_prefix, $gd_query_args_widgets; |
|
2040 | 2020 | |
2041 | - if (!empty($query_args['show_special_only'])) { |
|
2042 | - $where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )"; |
|
2043 | - } |
|
2021 | + $query_args = $gd_query_args_widgets; |
|
2022 | + if (empty($query_args) || empty($query_args['is_geodir_loop'])) { |
|
2023 | + return $where; |
|
2024 | + } |
|
2025 | + $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type']; |
|
2026 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
2044 | 2027 | |
2045 | - if (!empty($query_args['with_pics_only'])) { |
|
2046 | - $where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL "; |
|
2047 | - } |
|
2028 | + if (!empty($query_args)) { |
|
2029 | + if (!empty($query_args['gd_location']) && function_exists('geodir_default_location_where')) { |
|
2030 | + $where = geodir_default_location_where($where, $table); |
|
2031 | + } |
|
2048 | 2032 | |
2049 | - if (!empty($query_args['featured_image_only'])) { |
|
2050 | - $where .= " AND " . $table . ".featured_image IS NOT NULL AND " . $table . ".featured_image!='' "; |
|
2051 | - } |
|
2033 | + if (!empty($query_args['post_author'])) { |
|
2034 | + $where .= " AND " . $wpdb->posts . ".post_author = " . (int)$query_args['post_author']; |
|
2035 | + } |
|
2036 | + |
|
2037 | + if (!empty($query_args['show_featured_only'])) { |
|
2038 | + $where .= " AND " . $table . ".is_featured = '1'"; |
|
2039 | + } |
|
2052 | 2040 | |
2053 | - if (!empty($query_args['with_videos_only'])) { |
|
2054 | - $where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )"; |
|
2055 | - } |
|
2041 | + if (!empty($query_args['show_special_only'])) { |
|
2042 | + $where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )"; |
|
2043 | + } |
|
2056 | 2044 | |
2057 | - if (!empty($query_args['tax_query'])) { |
|
2058 | - $tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID'); |
|
2045 | + if (!empty($query_args['with_pics_only'])) { |
|
2046 | + $where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL "; |
|
2047 | + } |
|
2059 | 2048 | |
2060 | - if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) { |
|
2061 | - $where .= $tax_queries['where']; |
|
2062 | - } |
|
2063 | - } |
|
2064 | - } |
|
2049 | + if (!empty($query_args['featured_image_only'])) { |
|
2050 | + $where .= " AND " . $table . ".featured_image IS NOT NULL AND " . $table . ".featured_image!='' "; |
|
2051 | + } |
|
2065 | 2052 | |
2066 | - return $where; |
|
2067 | -} |
|
2053 | + if (!empty($query_args['with_videos_only'])) { |
|
2054 | + $where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )"; |
|
2055 | + } |
|
2056 | + |
|
2057 | + if (!empty($query_args['tax_query'])) { |
|
2058 | + $tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID'); |
|
2059 | + |
|
2060 | + if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) { |
|
2061 | + $where .= $tax_queries['where']; |
|
2062 | + } |
|
2063 | + } |
|
2064 | + } |
|
2065 | + |
|
2066 | + return $where; |
|
2067 | +} |
|
2068 | 2068 | |
2069 | 2069 | /** |
2070 | 2070 | * Listing query orderby clause SQL part for widgets. |
@@ -2078,14 +2078,14 @@ discard block |
||
2078 | 2078 | */ |
2079 | 2079 | function geodir_function_widget_listings_orderby($orderby) |
2080 | 2080 | { |
2081 | - global $wpdb, $plugin_prefix, $gd_query_args_widgets; |
|
2081 | + global $wpdb, $plugin_prefix, $gd_query_args_widgets; |
|
2082 | 2082 | |
2083 | - $query_args = $gd_query_args_widgets; |
|
2084 | - if (empty($query_args) || empty($query_args['is_geodir_loop'])) { |
|
2085 | - return $orderby; |
|
2086 | - } |
|
2083 | + $query_args = $gd_query_args_widgets; |
|
2084 | + if (empty($query_args) || empty($query_args['is_geodir_loop'])) { |
|
2085 | + return $orderby; |
|
2086 | + } |
|
2087 | 2087 | |
2088 | - return $orderby; |
|
2088 | + return $orderby; |
|
2089 | 2089 | } |
2090 | 2090 | |
2091 | 2091 | /** |
@@ -2100,18 +2100,18 @@ discard block |
||
2100 | 2100 | */ |
2101 | 2101 | function geodir_function_widget_listings_limit($limit) |
2102 | 2102 | { |
2103 | - global $wpdb, $plugin_prefix, $gd_query_args_widgets; |
|
2103 | + global $wpdb, $plugin_prefix, $gd_query_args_widgets; |
|
2104 | 2104 | |
2105 | - $query_args = $gd_query_args_widgets; |
|
2106 | - if (empty($query_args) || empty($query_args['is_geodir_loop'])) { |
|
2107 | - return $limit; |
|
2108 | - } |
|
2105 | + $query_args = $gd_query_args_widgets; |
|
2106 | + if (empty($query_args) || empty($query_args['is_geodir_loop'])) { |
|
2107 | + return $limit; |
|
2108 | + } |
|
2109 | 2109 | |
2110 | - if (!empty($query_args) && !empty($query_args['posts_per_page'])) { |
|
2111 | - $limit = (int)$query_args['posts_per_page']; |
|
2112 | - } |
|
2110 | + if (!empty($query_args) && !empty($query_args['posts_per_page'])) { |
|
2111 | + $limit = (int)$query_args['posts_per_page']; |
|
2112 | + } |
|
2113 | 2113 | |
2114 | - return $limit; |
|
2114 | + return $limit; |
|
2115 | 2115 | } |
2116 | 2116 | |
2117 | 2117 | /** |
@@ -2125,24 +2125,24 @@ discard block |
||
2125 | 2125 | */ |
2126 | 2126 | function geodir_media_image_large_width($default = 800, $params = '') |
2127 | 2127 | { |
2128 | - $large_size_w = get_option('large_size_w'); |
|
2129 | - $large_size_w = $large_size_w > 0 ? $large_size_w : $default; |
|
2130 | - $large_size_w = absint($large_size_w); |
|
2131 | - |
|
2132 | - if (!get_option('geodir_use_wp_media_large_size')) { |
|
2133 | - $large_size_w = 800; |
|
2134 | - } |
|
2135 | - |
|
2136 | - /** |
|
2137 | - * Filter large image width. |
|
2138 | - * |
|
2139 | - * @since 1.0.0 |
|
2140 | - * @param int $large_size_w Large image width. |
|
2141 | - * @param int $default Default width. |
|
2142 | - * @param string|array $params Image parameters. |
|
2143 | - */ |
|
2144 | - $large_size_w = apply_filters('geodir_filter_media_image_large_width', $large_size_w, $default, $params); |
|
2145 | - return $large_size_w; |
|
2128 | + $large_size_w = get_option('large_size_w'); |
|
2129 | + $large_size_w = $large_size_w > 0 ? $large_size_w : $default; |
|
2130 | + $large_size_w = absint($large_size_w); |
|
2131 | + |
|
2132 | + if (!get_option('geodir_use_wp_media_large_size')) { |
|
2133 | + $large_size_w = 800; |
|
2134 | + } |
|
2135 | + |
|
2136 | + /** |
|
2137 | + * Filter large image width. |
|
2138 | + * |
|
2139 | + * @since 1.0.0 |
|
2140 | + * @param int $large_size_w Large image width. |
|
2141 | + * @param int $default Default width. |
|
2142 | + * @param string|array $params Image parameters. |
|
2143 | + */ |
|
2144 | + $large_size_w = apply_filters('geodir_filter_media_image_large_width', $large_size_w, $default, $params); |
|
2145 | + return $large_size_w; |
|
2146 | 2146 | } |
2147 | 2147 | |
2148 | 2148 | /** |
@@ -2156,25 +2156,25 @@ discard block |
||
2156 | 2156 | */ |
2157 | 2157 | function geodir_media_image_large_height($default = 800, $params = '') |
2158 | 2158 | { |
2159 | - $large_size_h = get_option('large_size_h'); |
|
2160 | - $large_size_h = $large_size_h > 0 ? $large_size_h : $default; |
|
2161 | - $large_size_h = absint($large_size_h); |
|
2162 | - |
|
2163 | - if (!get_option('geodir_use_wp_media_large_size')) { |
|
2164 | - $large_size_h = 800; |
|
2165 | - } |
|
2166 | - |
|
2167 | - /** |
|
2168 | - * Filter large image height. |
|
2169 | - * |
|
2170 | - * @since 1.0.0 |
|
2171 | - * @param int $large_size_h Large image height. |
|
2172 | - * @param int $default Default height. |
|
2173 | - * @param string|array $params Image parameters. |
|
2174 | - */ |
|
2175 | - $large_size_h = apply_filters('geodir_filter_media_image_large_height', $large_size_h, $default, $params); |
|
2159 | + $large_size_h = get_option('large_size_h'); |
|
2160 | + $large_size_h = $large_size_h > 0 ? $large_size_h : $default; |
|
2161 | + $large_size_h = absint($large_size_h); |
|
2176 | 2162 | |
2177 | - return $large_size_h; |
|
2163 | + if (!get_option('geodir_use_wp_media_large_size')) { |
|
2164 | + $large_size_h = 800; |
|
2165 | + } |
|
2166 | + |
|
2167 | + /** |
|
2168 | + * Filter large image height. |
|
2169 | + * |
|
2170 | + * @since 1.0.0 |
|
2171 | + * @param int $large_size_h Large image height. |
|
2172 | + * @param int $default Default height. |
|
2173 | + * @param string|array $params Image parameters. |
|
2174 | + */ |
|
2175 | + $large_size_h = apply_filters('geodir_filter_media_image_large_height', $large_size_h, $default, $params); |
|
2176 | + |
|
2177 | + return $large_size_h; |
|
2178 | 2178 | } |
2179 | 2179 | |
2180 | 2180 | /** |
@@ -2189,25 +2189,25 @@ discard block |
||
2189 | 2189 | */ |
2190 | 2190 | function geodir_sanitize_location_name($type, $name, $translate = true) |
2191 | 2191 | { |
2192 | - if ($name == '') { |
|
2193 | - return NULL; |
|
2194 | - } |
|
2195 | - |
|
2196 | - $type = $type == 'gd_country' ? 'country' : $type; |
|
2197 | - $type = $type == 'gd_region' ? 'region' : $type; |
|
2198 | - $type = $type == 'gd_city' ? 'city' : $type; |
|
2199 | - |
|
2200 | - $return = $name; |
|
2201 | - if (function_exists('get_actual_location_name')) { |
|
2202 | - $return = get_actual_location_name($type, $name, $translate); |
|
2203 | - } else { |
|
2204 | - $return = preg_replace('/-(\d+)$/', '', $return); |
|
2205 | - $return = preg_replace('/[_-]/', ' ', $return); |
|
2206 | - $return = geodir_ucwords($return); |
|
2207 | - $return = $translate ? __($return, 'geodirectory') : $return; |
|
2208 | - } |
|
2209 | - |
|
2210 | - return $return; |
|
2192 | + if ($name == '') { |
|
2193 | + return NULL; |
|
2194 | + } |
|
2195 | + |
|
2196 | + $type = $type == 'gd_country' ? 'country' : $type; |
|
2197 | + $type = $type == 'gd_region' ? 'region' : $type; |
|
2198 | + $type = $type == 'gd_city' ? 'city' : $type; |
|
2199 | + |
|
2200 | + $return = $name; |
|
2201 | + if (function_exists('get_actual_location_name')) { |
|
2202 | + $return = get_actual_location_name($type, $name, $translate); |
|
2203 | + } else { |
|
2204 | + $return = preg_replace('/-(\d+)$/', '', $return); |
|
2205 | + $return = preg_replace('/[_-]/', ' ', $return); |
|
2206 | + $return = geodir_ucwords($return); |
|
2207 | + $return = $translate ? __($return, 'geodirectory') : $return; |
|
2208 | + } |
|
2209 | + |
|
2210 | + return $return; |
|
2211 | 2211 | } |
2212 | 2212 | |
2213 | 2213 | |
@@ -2221,14 +2221,14 @@ discard block |
||
2221 | 2221 | function geodir_comments_number($number) |
2222 | 2222 | { |
2223 | 2223 | |
2224 | - if ($number > 1) { |
|
2225 | - $output = str_replace('%', number_format_i18n($number), __('% Reviews', 'geodirectory')); |
|
2226 | - } elseif ($number == 0 || $number == '') { |
|
2227 | - $output = __('No Reviews', 'geodirectory'); |
|
2228 | - } else { // must be one |
|
2229 | - $output = __('1 Review', 'geodirectory'); |
|
2230 | - } |
|
2231 | - echo $output; |
|
2224 | + if ($number > 1) { |
|
2225 | + $output = str_replace('%', number_format_i18n($number), __('% Reviews', 'geodirectory')); |
|
2226 | + } elseif ($number == 0 || $number == '') { |
|
2227 | + $output = __('No Reviews', 'geodirectory'); |
|
2228 | + } else { // must be one |
|
2229 | + $output = __('1 Review', 'geodirectory'); |
|
2230 | + } |
|
2231 | + echo $output; |
|
2232 | 2232 | } |
2233 | 2233 | |
2234 | 2234 | /** |
@@ -2241,23 +2241,23 @@ discard block |
||
2241 | 2241 | */ |
2242 | 2242 | function is_page_geodir_home() |
2243 | 2243 | { |
2244 | - global $wpdb; |
|
2245 | - $cur_url = str_replace(array("https://", "http://", "www."), array('', '', ''), geodir_curPageURL()); |
|
2246 | - if (function_exists('geodir_location_geo_home_link')) { |
|
2247 | - remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
2248 | - } |
|
2249 | - $home_url = home_url('', 'http'); |
|
2250 | - if (function_exists('geodir_location_geo_home_link')) { |
|
2251 | - add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
2252 | - } |
|
2253 | - $home_url = str_replace("www.", "", $home_url); |
|
2254 | - if ( (strpos($home_url, $cur_url) !== false || strpos($home_url . '/', $cur_url) !== false) && ('page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front')==get_option('geodir_home_page')) ) { |
|
2255 | - return true; |
|
2256 | - }elseif(get_query_var('page_id') == get_option('page_on_front') && 'page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front')==get_option('geodir_home_page')){ |
|
2257 | - return true; |
|
2258 | - } else { |
|
2259 | - return false; |
|
2260 | - } |
|
2244 | + global $wpdb; |
|
2245 | + $cur_url = str_replace(array("https://", "http://", "www."), array('', '', ''), geodir_curPageURL()); |
|
2246 | + if (function_exists('geodir_location_geo_home_link')) { |
|
2247 | + remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
2248 | + } |
|
2249 | + $home_url = home_url('', 'http'); |
|
2250 | + if (function_exists('geodir_location_geo_home_link')) { |
|
2251 | + add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
2252 | + } |
|
2253 | + $home_url = str_replace("www.", "", $home_url); |
|
2254 | + if ( (strpos($home_url, $cur_url) !== false || strpos($home_url . '/', $cur_url) !== false) && ('page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front')==get_option('geodir_home_page')) ) { |
|
2255 | + return true; |
|
2256 | + }elseif(get_query_var('page_id') == get_option('page_on_front') && 'page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front')==get_option('geodir_home_page')){ |
|
2257 | + return true; |
|
2258 | + } else { |
|
2259 | + return false; |
|
2260 | + } |
|
2261 | 2261 | |
2262 | 2262 | } |
2263 | 2263 | |
@@ -2273,13 +2273,13 @@ discard block |
||
2273 | 2273 | */ |
2274 | 2274 | function geodir_wpseo_homepage_canonical($url) |
2275 | 2275 | { |
2276 | - global $post; |
|
2276 | + global $post; |
|
2277 | 2277 | |
2278 | - if (is_page_geodir_home()) { |
|
2279 | - return home_url(); |
|
2280 | - } |
|
2278 | + if (is_page_geodir_home()) { |
|
2279 | + return home_url(); |
|
2280 | + } |
|
2281 | 2281 | |
2282 | - return $url; |
|
2282 | + return $url; |
|
2283 | 2283 | } |
2284 | 2284 | |
2285 | 2285 | add_filter('wpseo_canonical', 'geodir_wpseo_homepage_canonical', 10); |
@@ -2296,16 +2296,16 @@ discard block |
||
2296 | 2296 | */ |
2297 | 2297 | function geodir_googlemap_script_extra_details_page($extra) |
2298 | 2298 | { |
2299 | - global $post; |
|
2300 | - $add_google_places_api = false; |
|
2301 | - if (isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) { |
|
2302 | - $add_google_places_api = true; |
|
2303 | - } |
|
2304 | - if (!str_replace('libraries=places', '', $extra) && (geodir_is_page('detail') || $add_google_places_api)) { |
|
2305 | - $extra .= "&libraries=places"; |
|
2306 | - } |
|
2307 | - |
|
2308 | - return $extra; |
|
2299 | + global $post; |
|
2300 | + $add_google_places_api = false; |
|
2301 | + if (isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) { |
|
2302 | + $add_google_places_api = true; |
|
2303 | + } |
|
2304 | + if (!str_replace('libraries=places', '', $extra) && (geodir_is_page('detail') || $add_google_places_api)) { |
|
2305 | + $extra .= "&libraries=places"; |
|
2306 | + } |
|
2307 | + |
|
2308 | + return $extra; |
|
2309 | 2309 | } |
2310 | 2310 | |
2311 | 2311 | add_filter('geodir_googlemap_script_extra', 'geodir_googlemap_script_extra_details_page', 101, 1); |
@@ -2325,91 +2325,91 @@ discard block |
||
2325 | 2325 | */ |
2326 | 2326 | function geodir_popular_post_category_output($args = '', $instance = '') |
2327 | 2327 | { |
2328 | - // prints the widget |
|
2329 | - global $wpdb, $plugin_prefix, $geodir_post_category_str; |
|
2330 | - extract($args, EXTR_SKIP); |
|
2331 | - |
|
2332 | - echo $before_widget; |
|
2333 | - |
|
2334 | - /** This filter is documented in geodirectory_widgets.php */ |
|
2335 | - $title = empty($instance['title']) ? __('Popular Categories', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory')); |
|
2336 | - |
|
2337 | - $gd_post_type = geodir_get_current_posttype(); |
|
2338 | - |
|
2339 | - $category_limit = isset($instance['category_limit']) && $instance['category_limit'] > 0 ? (int)$instance['category_limit'] : 15; |
|
2340 | - $default_post_type = !empty($gd_post_type) ? $gd_post_type : (isset($instance['default_post_type']) && gdsc_is_post_type_valid($instance['default_post_type']) ? $instance['default_post_type'] : ''); |
|
2341 | - |
|
2342 | - $taxonomy = array(); |
|
2343 | - if (!empty($gd_post_type)) { |
|
2344 | - $taxonomy[] = $gd_post_type . "category"; |
|
2345 | - } else { |
|
2346 | - $taxonomy = geodir_get_taxonomies($gd_post_type); |
|
2347 | - } |
|
2348 | - |
|
2349 | - $terms = get_terms($taxonomy); |
|
2350 | - $a_terms = array(); |
|
2351 | - $b_terms = array(); |
|
2352 | - |
|
2353 | - foreach ($terms as $term) { |
|
2354 | - if ($term->count > 0) { |
|
2355 | - $a_terms[$term->taxonomy][] = $term; |
|
2356 | - } |
|
2357 | - } |
|
2358 | - |
|
2359 | - if (!empty($a_terms)) { |
|
2360 | - foreach ($a_terms as $b_key => $b_val) { |
|
2361 | - $b_terms[$b_key] = geodir_sort_terms($b_val, 'count'); |
|
2362 | - } |
|
2363 | - |
|
2364 | - $default_taxonomy = $default_post_type != '' && isset($b_terms[$default_post_type . 'category']) ? $default_post_type . 'category' : ''; |
|
2365 | - |
|
2366 | - $tax_change_output = ''; |
|
2367 | - if (count($b_terms) > 1) { |
|
2368 | - $tax_change_output .= "<select data-limit='$category_limit' class='geodir-cat-list-tax' onchange='geodir_get_post_term(this);'>"; |
|
2369 | - foreach ($b_terms as $key => $val) { |
|
2370 | - $ptype = get_post_type_object(str_replace("category", "", $key)); |
|
2371 | - $cpt_name = __($ptype->labels->singular_name, 'geodirectory'); |
|
2372 | - $tax_change_output .= "<option value='$key' ". selected($key, $default_taxonomy, false) .">" . sprintf(__('%s Categories', 'geodirectory'),$cpt_name) . "</option>"; |
|
2373 | - } |
|
2374 | - $tax_change_output .= "</select>"; |
|
2375 | - } |
|
2376 | - |
|
2377 | - if (!empty($b_terms)) { |
|
2378 | - $terms = $default_taxonomy != '' && isset($b_terms[$default_taxonomy]) ? $b_terms[$default_taxonomy] : reset($b_terms);// get the first array |
|
2379 | - global $cat_count;//make global so we can change via function |
|
2380 | - $cat_count = 0; |
|
2381 | - ?> |
|
2328 | + // prints the widget |
|
2329 | + global $wpdb, $plugin_prefix, $geodir_post_category_str; |
|
2330 | + extract($args, EXTR_SKIP); |
|
2331 | + |
|
2332 | + echo $before_widget; |
|
2333 | + |
|
2334 | + /** This filter is documented in geodirectory_widgets.php */ |
|
2335 | + $title = empty($instance['title']) ? __('Popular Categories', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory')); |
|
2336 | + |
|
2337 | + $gd_post_type = geodir_get_current_posttype(); |
|
2338 | + |
|
2339 | + $category_limit = isset($instance['category_limit']) && $instance['category_limit'] > 0 ? (int)$instance['category_limit'] : 15; |
|
2340 | + $default_post_type = !empty($gd_post_type) ? $gd_post_type : (isset($instance['default_post_type']) && gdsc_is_post_type_valid($instance['default_post_type']) ? $instance['default_post_type'] : ''); |
|
2341 | + |
|
2342 | + $taxonomy = array(); |
|
2343 | + if (!empty($gd_post_type)) { |
|
2344 | + $taxonomy[] = $gd_post_type . "category"; |
|
2345 | + } else { |
|
2346 | + $taxonomy = geodir_get_taxonomies($gd_post_type); |
|
2347 | + } |
|
2348 | + |
|
2349 | + $terms = get_terms($taxonomy); |
|
2350 | + $a_terms = array(); |
|
2351 | + $b_terms = array(); |
|
2352 | + |
|
2353 | + foreach ($terms as $term) { |
|
2354 | + if ($term->count > 0) { |
|
2355 | + $a_terms[$term->taxonomy][] = $term; |
|
2356 | + } |
|
2357 | + } |
|
2358 | + |
|
2359 | + if (!empty($a_terms)) { |
|
2360 | + foreach ($a_terms as $b_key => $b_val) { |
|
2361 | + $b_terms[$b_key] = geodir_sort_terms($b_val, 'count'); |
|
2362 | + } |
|
2363 | + |
|
2364 | + $default_taxonomy = $default_post_type != '' && isset($b_terms[$default_post_type . 'category']) ? $default_post_type . 'category' : ''; |
|
2365 | + |
|
2366 | + $tax_change_output = ''; |
|
2367 | + if (count($b_terms) > 1) { |
|
2368 | + $tax_change_output .= "<select data-limit='$category_limit' class='geodir-cat-list-tax' onchange='geodir_get_post_term(this);'>"; |
|
2369 | + foreach ($b_terms as $key => $val) { |
|
2370 | + $ptype = get_post_type_object(str_replace("category", "", $key)); |
|
2371 | + $cpt_name = __($ptype->labels->singular_name, 'geodirectory'); |
|
2372 | + $tax_change_output .= "<option value='$key' ". selected($key, $default_taxonomy, false) .">" . sprintf(__('%s Categories', 'geodirectory'),$cpt_name) . "</option>"; |
|
2373 | + } |
|
2374 | + $tax_change_output .= "</select>"; |
|
2375 | + } |
|
2376 | + |
|
2377 | + if (!empty($b_terms)) { |
|
2378 | + $terms = $default_taxonomy != '' && isset($b_terms[$default_taxonomy]) ? $b_terms[$default_taxonomy] : reset($b_terms);// get the first array |
|
2379 | + global $cat_count;//make global so we can change via function |
|
2380 | + $cat_count = 0; |
|
2381 | + ?> |
|
2382 | 2382 | <div class="geodir-category-list-in clearfix"> |
2383 | 2383 | <div class="geodir-cat-list clearfix"> |
2384 | 2384 | <?php |
2385 | - echo $before_title . __($title) . $after_title; |
|
2385 | + echo $before_title . __($title) . $after_title; |
|
2386 | 2386 | |
2387 | - echo $tax_change_output; |
|
2387 | + echo $tax_change_output; |
|
2388 | 2388 | |
2389 | - echo '<ul class="geodir-popular-cat-list">'; |
|
2389 | + echo '<ul class="geodir-popular-cat-list">'; |
|
2390 | 2390 | |
2391 | - geodir_helper_cat_list_output($terms, $category_limit); |
|
2391 | + geodir_helper_cat_list_output($terms, $category_limit); |
|
2392 | 2392 | |
2393 | - echo '</ul>'; |
|
2394 | - ?> |
|
2393 | + echo '</ul>'; |
|
2394 | + ?> |
|
2395 | 2395 | </div> |
2396 | 2396 | <?php |
2397 | - $hide = ''; |
|
2398 | - if ($cat_count < $category_limit) { |
|
2399 | - $hide = 'style="display:none;"'; |
|
2400 | - } |
|
2401 | - echo "<div class='geodir-cat-list-more' $hide >"; |
|
2402 | - echo '<a href="javascript:void(0)" class="geodir-morecat geodir-showcat">' . __('More Categories', 'geodirectory') . '</a>'; |
|
2403 | - echo '<a href="javascript:void(0)" class="geodir-morecat geodir-hidecat geodir-hide">' . __('Less Categories', 'geodirectory') . '</a>'; |
|
2404 | - echo "</div>"; |
|
2405 | - /* add scripts */ |
|
2406 | - add_action('wp_footer', 'geodir_popular_category_add_scripts', 100); |
|
2407 | - ?> |
|
2397 | + $hide = ''; |
|
2398 | + if ($cat_count < $category_limit) { |
|
2399 | + $hide = 'style="display:none;"'; |
|
2400 | + } |
|
2401 | + echo "<div class='geodir-cat-list-more' $hide >"; |
|
2402 | + echo '<a href="javascript:void(0)" class="geodir-morecat geodir-showcat">' . __('More Categories', 'geodirectory') . '</a>'; |
|
2403 | + echo '<a href="javascript:void(0)" class="geodir-morecat geodir-hidecat geodir-hide">' . __('Less Categories', 'geodirectory') . '</a>'; |
|
2404 | + echo "</div>"; |
|
2405 | + /* add scripts */ |
|
2406 | + add_action('wp_footer', 'geodir_popular_category_add_scripts', 100); |
|
2407 | + ?> |
|
2408 | 2408 | </div> |
2409 | 2409 | <?php |
2410 | - } |
|
2411 | - } |
|
2412 | - echo $after_widget; |
|
2410 | + } |
|
2411 | + } |
|
2412 | + echo $after_widget; |
|
2413 | 2413 | } |
2414 | 2414 | |
2415 | 2415 | /** |
@@ -2423,38 +2423,38 @@ discard block |
||
2423 | 2423 | */ |
2424 | 2424 | function geodir_helper_cat_list_output($terms, $category_limit) |
2425 | 2425 | { |
2426 | - global $geodir_post_category_str, $cat_count; |
|
2427 | - $term_icons = geodir_get_term_icon(); |
|
2426 | + global $geodir_post_category_str, $cat_count; |
|
2427 | + $term_icons = geodir_get_term_icon(); |
|
2428 | 2428 | |
2429 | - $geodir_post_category_str = array(); |
|
2429 | + $geodir_post_category_str = array(); |
|
2430 | 2430 | |
2431 | 2431 | |
2432 | - foreach ($terms as $cat) { |
|
2433 | - $post_type = str_replace("category", "", $cat->taxonomy); |
|
2434 | - $term_icon_url = !empty($term_icons) && isset($term_icons[$cat->term_id]) ? $term_icons[$cat->term_id] : ''; |
|
2432 | + foreach ($terms as $cat) { |
|
2433 | + $post_type = str_replace("category", "", $cat->taxonomy); |
|
2434 | + $term_icon_url = !empty($term_icons) && isset($term_icons[$cat->term_id]) ? $term_icons[$cat->term_id] : ''; |
|
2435 | 2435 | |
2436 | - $cat_count++; |
|
2436 | + $cat_count++; |
|
2437 | 2437 | |
2438 | - $geodir_post_category_str[] = array('posttype' => $post_type, 'termid' => $cat->term_id); |
|
2438 | + $geodir_post_category_str[] = array('posttype' => $post_type, 'termid' => $cat->term_id); |
|
2439 | 2439 | |
2440 | - $class_row = $cat_count > $category_limit ? 'geodir-pcat-hide geodir-hide' : 'geodir-pcat-show'; |
|
2441 | - $total_post = $cat->count; |
|
2440 | + $class_row = $cat_count > $category_limit ? 'geodir-pcat-hide geodir-hide' : 'geodir-pcat-show'; |
|
2441 | + $total_post = $cat->count; |
|
2442 | 2442 | |
2443 | - $term_link = get_term_link( $cat, $cat->taxonomy ); |
|
2444 | - /** |
|
2445 | - * Filer the category term link. |
|
2446 | - * |
|
2447 | - * @since 1.4.5 |
|
2448 | - * @param string $term_link The term permalink. |
|
2449 | - * @param int $cat->term_id The term id. |
|
2450 | - * @param string $post_type Wordpress post type. |
|
2451 | - */ |
|
2452 | - $term_link = apply_filters( 'geodir_category_term_link', $term_link, $cat->term_id, $post_type ); |
|
2443 | + $term_link = get_term_link( $cat, $cat->taxonomy ); |
|
2444 | + /** |
|
2445 | + * Filer the category term link. |
|
2446 | + * |
|
2447 | + * @since 1.4.5 |
|
2448 | + * @param string $term_link The term permalink. |
|
2449 | + * @param int $cat->term_id The term id. |
|
2450 | + * @param string $post_type Wordpress post type. |
|
2451 | + */ |
|
2452 | + $term_link = apply_filters( 'geodir_category_term_link', $term_link, $cat->term_id, $post_type ); |
|
2453 | 2453 | |
2454 | - echo '<li class="' . $class_row . '"><a href="' . $term_link . '">'; |
|
2455 | - echo '<img alt="' . esc_attr($cat->name) . ' icon" style="height:20px;vertical-align:middle;" src="' . $term_icon_url . '"/> <span class="cat-link">'; echo $cat->name . '</span> <span class="geodir_term_class geodir_link_span geodir_category_class_' . $post_type . '_' . $cat->term_id . '">(' . $total_post . ')</span> '; |
|
2456 | - echo '</a></li>'; |
|
2457 | - } |
|
2454 | + echo '<li class="' . $class_row . '"><a href="' . $term_link . '">'; |
|
2455 | + echo '<img alt="' . esc_attr($cat->name) . ' icon" style="height:20px;vertical-align:middle;" src="' . $term_icon_url . '"/> <span class="cat-link">'; echo $cat->name . '</span> <span class="geodir_term_class geodir_link_span geodir_category_class_' . $post_type . '_' . $cat->term_id . '">(' . $total_post . ')</span> '; |
|
2456 | + echo '</a></li>'; |
|
2457 | + } |
|
2458 | 2458 | } |
2459 | 2459 | |
2460 | 2460 | /** |
@@ -2468,108 +2468,108 @@ discard block |
||
2468 | 2468 | */ |
2469 | 2469 | function geodir_listing_slider_widget_output($args = '', $instance = '') |
2470 | 2470 | { |
2471 | - // prints the widget |
|
2472 | - extract($args, EXTR_SKIP); |
|
2473 | - |
|
2474 | - echo $before_widget; |
|
2475 | - |
|
2476 | - /** This filter is documented in geodirectory_widgets.php */ |
|
2477 | - $title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory')); |
|
2478 | - /** |
|
2479 | - * Filter the widget post type. |
|
2480 | - * |
|
2481 | - * @since 1.0.0 |
|
2482 | - * @param string $instance['post_type'] Post type of listing. |
|
2483 | - */ |
|
2484 | - $post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']); |
|
2485 | - /** |
|
2486 | - * Filter the widget's term. |
|
2487 | - * |
|
2488 | - * @since 1.0.0 |
|
2489 | - * @param string $instance['category'] Filter by term. Can be any valid term. |
|
2490 | - */ |
|
2491 | - $category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']); |
|
2492 | - /** |
|
2493 | - * Filter the widget listings limit. |
|
2494 | - * |
|
2495 | - * @since 1.0.0 |
|
2496 | - * @param string $instance['post_number'] Number of listings to display. |
|
2497 | - */ |
|
2498 | - $post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']); |
|
2499 | - /** |
|
2500 | - * Filter the widget listings limit shown at one time. |
|
2501 | - * |
|
2502 | - * @since 1.5.0 |
|
2503 | - * @param string $instance['max_show'] Number of listings to display on screen. |
|
2504 | - */ |
|
2505 | - $max_show = empty($instance['max_show']) ? '1' : apply_filters('widget_max_show', $instance['max_show']); |
|
2506 | - /** |
|
2507 | - * Filter the widget slide width. |
|
2508 | - * |
|
2509 | - * @since 1.5.0 |
|
2510 | - * @param string $instance['slide_width'] Width of the slides shown. |
|
2511 | - */ |
|
2512 | - $slide_width = empty($instance['slide_width']) ? '' : apply_filters('widget_slide_width', $instance['slide_width']); |
|
2513 | - /** |
|
2514 | - * Filter widget's "show title" value. |
|
2515 | - * |
|
2516 | - * @since 1.0.0 |
|
2517 | - * @param string|bool $instance['show_title'] Do you want to display title? Can be 1 or 0. |
|
2518 | - */ |
|
2519 | - $show_title = empty($instance['show_title']) ? '' : apply_filters('widget_show_title', $instance['show_title']); |
|
2520 | - /** |
|
2521 | - * Filter widget's "slideshow" value. |
|
2522 | - * |
|
2523 | - * @since 1.0.0 |
|
2524 | - * @param int $instance['slideshow'] Setup a slideshow for the slider to animate automatically. |
|
2525 | - */ |
|
2526 | - $slideshow = empty($instance['slideshow']) ? 0 : apply_filters('widget_slideshow', $instance['slideshow']); |
|
2527 | - /** |
|
2528 | - * Filter widget's "animationLoop" value. |
|
2529 | - * |
|
2530 | - * @since 1.0.0 |
|
2531 | - * @param int $instance['animationLoop'] Gives the slider a seamless infinite loop. |
|
2532 | - */ |
|
2533 | - $animationLoop = empty($instance['animationLoop']) ? 0 : apply_filters('widget_animationLoop', $instance['animationLoop']); |
|
2534 | - /** |
|
2535 | - * Filter widget's "directionNav" value. |
|
2536 | - * |
|
2537 | - * @since 1.0.0 |
|
2538 | - * @param int $instance['directionNav'] Enable previous/next arrow navigation?. Can be 1 or 0. |
|
2539 | - */ |
|
2540 | - $directionNav = empty($instance['directionNav']) ? 0 : apply_filters('widget_directionNav', $instance['directionNav']); |
|
2541 | - /** |
|
2542 | - * Filter widget's "slideshowSpeed" value. |
|
2543 | - * |
|
2544 | - * @since 1.0.0 |
|
2545 | - * @param int $instance['slideshowSpeed'] Set the speed of the slideshow cycling, in milliseconds. |
|
2546 | - */ |
|
2547 | - $slideshowSpeed = empty($instance['slideshowSpeed']) ? 5000 : apply_filters('widget_slideshowSpeed', $instance['slideshowSpeed']); |
|
2548 | - /** |
|
2549 | - * Filter widget's "animationSpeed" value. |
|
2550 | - * |
|
2551 | - * @since 1.0.0 |
|
2552 | - * @param int $instance['animationSpeed'] Set the speed of animations, in milliseconds. |
|
2553 | - */ |
|
2554 | - $animationSpeed = empty($instance['animationSpeed']) ? 600 : apply_filters('widget_animationSpeed', $instance['animationSpeed']); |
|
2555 | - /** |
|
2556 | - * Filter widget's "animation" value. |
|
2557 | - * |
|
2558 | - * @since 1.0.0 |
|
2559 | - * @param string $instance['animation'] Controls the animation type, "fade" or "slide". |
|
2560 | - */ |
|
2561 | - $animation = empty($instance['animation']) ? 'slide' : apply_filters('widget_animation', $instance['animation']); |
|
2562 | - /** |
|
2563 | - * Filter widget's "list_sort" type. |
|
2564 | - * |
|
2565 | - * @since 1.0.0 |
|
2566 | - * @param string $instance['list_sort'] Listing sort by type. |
|
2567 | - */ |
|
2568 | - $list_sort = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']); |
|
2569 | - $show_featured_only = !empty($instance['show_featured_only']) ? 1 : NULL; |
|
2570 | - |
|
2571 | - wp_enqueue_script('geodirectory-jquery-flexslider-js'); |
|
2572 | - ?> |
|
2471 | + // prints the widget |
|
2472 | + extract($args, EXTR_SKIP); |
|
2473 | + |
|
2474 | + echo $before_widget; |
|
2475 | + |
|
2476 | + /** This filter is documented in geodirectory_widgets.php */ |
|
2477 | + $title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory')); |
|
2478 | + /** |
|
2479 | + * Filter the widget post type. |
|
2480 | + * |
|
2481 | + * @since 1.0.0 |
|
2482 | + * @param string $instance['post_type'] Post type of listing. |
|
2483 | + */ |
|
2484 | + $post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']); |
|
2485 | + /** |
|
2486 | + * Filter the widget's term. |
|
2487 | + * |
|
2488 | + * @since 1.0.0 |
|
2489 | + * @param string $instance['category'] Filter by term. Can be any valid term. |
|
2490 | + */ |
|
2491 | + $category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']); |
|
2492 | + /** |
|
2493 | + * Filter the widget listings limit. |
|
2494 | + * |
|
2495 | + * @since 1.0.0 |
|
2496 | + * @param string $instance['post_number'] Number of listings to display. |
|
2497 | + */ |
|
2498 | + $post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']); |
|
2499 | + /** |
|
2500 | + * Filter the widget listings limit shown at one time. |
|
2501 | + * |
|
2502 | + * @since 1.5.0 |
|
2503 | + * @param string $instance['max_show'] Number of listings to display on screen. |
|
2504 | + */ |
|
2505 | + $max_show = empty($instance['max_show']) ? '1' : apply_filters('widget_max_show', $instance['max_show']); |
|
2506 | + /** |
|
2507 | + * Filter the widget slide width. |
|
2508 | + * |
|
2509 | + * @since 1.5.0 |
|
2510 | + * @param string $instance['slide_width'] Width of the slides shown. |
|
2511 | + */ |
|
2512 | + $slide_width = empty($instance['slide_width']) ? '' : apply_filters('widget_slide_width', $instance['slide_width']); |
|
2513 | + /** |
|
2514 | + * Filter widget's "show title" value. |
|
2515 | + * |
|
2516 | + * @since 1.0.0 |
|
2517 | + * @param string|bool $instance['show_title'] Do you want to display title? Can be 1 or 0. |
|
2518 | + */ |
|
2519 | + $show_title = empty($instance['show_title']) ? '' : apply_filters('widget_show_title', $instance['show_title']); |
|
2520 | + /** |
|
2521 | + * Filter widget's "slideshow" value. |
|
2522 | + * |
|
2523 | + * @since 1.0.0 |
|
2524 | + * @param int $instance['slideshow'] Setup a slideshow for the slider to animate automatically. |
|
2525 | + */ |
|
2526 | + $slideshow = empty($instance['slideshow']) ? 0 : apply_filters('widget_slideshow', $instance['slideshow']); |
|
2527 | + /** |
|
2528 | + * Filter widget's "animationLoop" value. |
|
2529 | + * |
|
2530 | + * @since 1.0.0 |
|
2531 | + * @param int $instance['animationLoop'] Gives the slider a seamless infinite loop. |
|
2532 | + */ |
|
2533 | + $animationLoop = empty($instance['animationLoop']) ? 0 : apply_filters('widget_animationLoop', $instance['animationLoop']); |
|
2534 | + /** |
|
2535 | + * Filter widget's "directionNav" value. |
|
2536 | + * |
|
2537 | + * @since 1.0.0 |
|
2538 | + * @param int $instance['directionNav'] Enable previous/next arrow navigation?. Can be 1 or 0. |
|
2539 | + */ |
|
2540 | + $directionNav = empty($instance['directionNav']) ? 0 : apply_filters('widget_directionNav', $instance['directionNav']); |
|
2541 | + /** |
|
2542 | + * Filter widget's "slideshowSpeed" value. |
|
2543 | + * |
|
2544 | + * @since 1.0.0 |
|
2545 | + * @param int $instance['slideshowSpeed'] Set the speed of the slideshow cycling, in milliseconds. |
|
2546 | + */ |
|
2547 | + $slideshowSpeed = empty($instance['slideshowSpeed']) ? 5000 : apply_filters('widget_slideshowSpeed', $instance['slideshowSpeed']); |
|
2548 | + /** |
|
2549 | + * Filter widget's "animationSpeed" value. |
|
2550 | + * |
|
2551 | + * @since 1.0.0 |
|
2552 | + * @param int $instance['animationSpeed'] Set the speed of animations, in milliseconds. |
|
2553 | + */ |
|
2554 | + $animationSpeed = empty($instance['animationSpeed']) ? 600 : apply_filters('widget_animationSpeed', $instance['animationSpeed']); |
|
2555 | + /** |
|
2556 | + * Filter widget's "animation" value. |
|
2557 | + * |
|
2558 | + * @since 1.0.0 |
|
2559 | + * @param string $instance['animation'] Controls the animation type, "fade" or "slide". |
|
2560 | + */ |
|
2561 | + $animation = empty($instance['animation']) ? 'slide' : apply_filters('widget_animation', $instance['animation']); |
|
2562 | + /** |
|
2563 | + * Filter widget's "list_sort" type. |
|
2564 | + * |
|
2565 | + * @since 1.0.0 |
|
2566 | + * @param string $instance['list_sort'] Listing sort by type. |
|
2567 | + */ |
|
2568 | + $list_sort = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']); |
|
2569 | + $show_featured_only = !empty($instance['show_featured_only']) ? 1 : NULL; |
|
2570 | + |
|
2571 | + wp_enqueue_script('geodirectory-jquery-flexslider-js'); |
|
2572 | + ?> |
|
2573 | 2573 | <script type="text/javascript"> |
2574 | 2574 | jQuery(window).load(function () { |
2575 | 2575 | jQuery('#geodir_widget_carousel').flexslider({ |
@@ -2610,73 +2610,73 @@ discard block |
||
2610 | 2610 | }); |
2611 | 2611 | </script> |
2612 | 2612 | <?php |
2613 | - $query_args = array( |
|
2614 | - 'posts_per_page' => $post_number, |
|
2615 | - 'is_geodir_loop' => true, |
|
2616 | - 'post_type' => $post_type, |
|
2617 | - 'order_by' => $list_sort |
|
2618 | - ); |
|
2619 | - if ($show_featured_only) { |
|
2620 | - $query_args['show_featured_only'] = 1; |
|
2621 | - } |
|
2622 | - |
|
2623 | - if ($category != 0 || $category != '') { |
|
2624 | - $category_taxonomy = geodir_get_taxonomies($post_type); |
|
2625 | - $tax_query = array( |
|
2626 | - 'taxonomy' => $category_taxonomy[0], |
|
2627 | - 'field' => 'id', |
|
2628 | - 'terms' => $category |
|
2629 | - ); |
|
2630 | - |
|
2631 | - $query_args['tax_query'] = array($tax_query); |
|
2632 | - } |
|
2633 | - |
|
2634 | - // we want listings with featured image only |
|
2635 | - $query_args['featured_image_only'] = 1; |
|
2636 | - |
|
2637 | - if ($post_type == 'gd_event') { |
|
2638 | - $query_args['gedir_event_listing_filter'] = 'upcoming'; |
|
2639 | - }// show only upcomming events |
|
2640 | - |
|
2641 | - $widget_listings = geodir_get_widget_listings($query_args); |
|
2642 | - if (!empty($widget_listings) || (isset($with_no_results) && $with_no_results)) { |
|
2643 | - if ($title) { |
|
2644 | - echo $before_title . $title . $after_title; |
|
2645 | - } |
|
2646 | - |
|
2647 | - global $post; |
|
2648 | - |
|
2649 | - $current_post = $post;// keep current post info |
|
2650 | - |
|
2651 | - $widget_main_slides = ''; |
|
2652 | - $nav_slides = ''; |
|
2653 | - $widget_slides = 0; |
|
2654 | - |
|
2655 | - foreach ($widget_listings as $widget_listing) { |
|
2656 | - global $gd_widget_listing_type; |
|
2657 | - $post = $widget_listing; |
|
2658 | - $widget_image = geodir_get_featured_image($post->ID, 'thumbnail', get_option('geodir_listing_no_img')); |
|
2659 | - |
|
2660 | - if (!empty($widget_image)) { |
|
2661 | - if ($widget_image->height >= 200) { |
|
2662 | - $widget_spacer_height = 0; |
|
2663 | - } else { |
|
2664 | - $widget_spacer_height = ((200 - $widget_image->height) / 2); |
|
2665 | - } |
|
2666 | - |
|
2667 | - $widget_main_slides .= '<li class="geodir-listing-slider-widget"><img class="geodir-listing-slider-spacer" src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:' . $widget_spacer_height . 'px !important;margin:0 auto;" width="100" />'; |
|
2668 | - |
|
2669 | - $title = ''; |
|
2670 | - if ($show_title) { |
|
2671 | - $title = '<div class="geodir-slider-title"><a href="' . get_permalink($post->ID) . '">' . get_the_title($post->ID) . '</a></div>'; |
|
2672 | - } |
|
2673 | - |
|
2674 | - $widget_main_slides .= $title . '<img src="' . $widget_image->src . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:200px;margin:0 auto;" /></li>'; |
|
2675 | - $nav_slides .= '<li><img src="' . $widget_image->src . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:48px;margin:0 auto;" /></li>'; |
|
2676 | - $widget_slides++; |
|
2677 | - } |
|
2678 | - } |
|
2679 | - ?> |
|
2613 | + $query_args = array( |
|
2614 | + 'posts_per_page' => $post_number, |
|
2615 | + 'is_geodir_loop' => true, |
|
2616 | + 'post_type' => $post_type, |
|
2617 | + 'order_by' => $list_sort |
|
2618 | + ); |
|
2619 | + if ($show_featured_only) { |
|
2620 | + $query_args['show_featured_only'] = 1; |
|
2621 | + } |
|
2622 | + |
|
2623 | + if ($category != 0 || $category != '') { |
|
2624 | + $category_taxonomy = geodir_get_taxonomies($post_type); |
|
2625 | + $tax_query = array( |
|
2626 | + 'taxonomy' => $category_taxonomy[0], |
|
2627 | + 'field' => 'id', |
|
2628 | + 'terms' => $category |
|
2629 | + ); |
|
2630 | + |
|
2631 | + $query_args['tax_query'] = array($tax_query); |
|
2632 | + } |
|
2633 | + |
|
2634 | + // we want listings with featured image only |
|
2635 | + $query_args['featured_image_only'] = 1; |
|
2636 | + |
|
2637 | + if ($post_type == 'gd_event') { |
|
2638 | + $query_args['gedir_event_listing_filter'] = 'upcoming'; |
|
2639 | + }// show only upcomming events |
|
2640 | + |
|
2641 | + $widget_listings = geodir_get_widget_listings($query_args); |
|
2642 | + if (!empty($widget_listings) || (isset($with_no_results) && $with_no_results)) { |
|
2643 | + if ($title) { |
|
2644 | + echo $before_title . $title . $after_title; |
|
2645 | + } |
|
2646 | + |
|
2647 | + global $post; |
|
2648 | + |
|
2649 | + $current_post = $post;// keep current post info |
|
2650 | + |
|
2651 | + $widget_main_slides = ''; |
|
2652 | + $nav_slides = ''; |
|
2653 | + $widget_slides = 0; |
|
2654 | + |
|
2655 | + foreach ($widget_listings as $widget_listing) { |
|
2656 | + global $gd_widget_listing_type; |
|
2657 | + $post = $widget_listing; |
|
2658 | + $widget_image = geodir_get_featured_image($post->ID, 'thumbnail', get_option('geodir_listing_no_img')); |
|
2659 | + |
|
2660 | + if (!empty($widget_image)) { |
|
2661 | + if ($widget_image->height >= 200) { |
|
2662 | + $widget_spacer_height = 0; |
|
2663 | + } else { |
|
2664 | + $widget_spacer_height = ((200 - $widget_image->height) / 2); |
|
2665 | + } |
|
2666 | + |
|
2667 | + $widget_main_slides .= '<li class="geodir-listing-slider-widget"><img class="geodir-listing-slider-spacer" src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:' . $widget_spacer_height . 'px !important;margin:0 auto;" width="100" />'; |
|
2668 | + |
|
2669 | + $title = ''; |
|
2670 | + if ($show_title) { |
|
2671 | + $title = '<div class="geodir-slider-title"><a href="' . get_permalink($post->ID) . '">' . get_the_title($post->ID) . '</a></div>'; |
|
2672 | + } |
|
2673 | + |
|
2674 | + $widget_main_slides .= $title . '<img src="' . $widget_image->src . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:200px;margin:0 auto;" /></li>'; |
|
2675 | + $nav_slides .= '<li><img src="' . $widget_image->src . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:48px;margin:0 auto;" /></li>'; |
|
2676 | + $widget_slides++; |
|
2677 | + } |
|
2678 | + } |
|
2679 | + ?> |
|
2680 | 2680 | <div class="flex-container" style="min-height:200px;"> |
2681 | 2681 | <div class="geodir-listing-flex-loader"><i class="fa fa-refresh fa-spin"></i></div> |
2682 | 2682 | <div id="geodir_widget_slider" class="geodir_flexslider"> |
@@ -2689,10 +2689,10 @@ discard block |
||
2689 | 2689 | <?php } ?> |
2690 | 2690 | </div> |
2691 | 2691 | <?php |
2692 | - $GLOBALS['post'] = $current_post; |
|
2693 | - setup_postdata($current_post); |
|
2694 | - } |
|
2695 | - echo $after_widget; |
|
2692 | + $GLOBALS['post'] = $current_post; |
|
2693 | + setup_postdata($current_post); |
|
2694 | + } |
|
2695 | + echo $after_widget; |
|
2696 | 2696 | } |
2697 | 2697 | |
2698 | 2698 | |
@@ -2707,65 +2707,65 @@ discard block |
||
2707 | 2707 | */ |
2708 | 2708 | function geodir_loginwidget_output($args = '', $instance = '') |
2709 | 2709 | { |
2710 | - //print_r($args); |
|
2711 | - //print_r($instance); |
|
2712 | - // prints the widget |
|
2713 | - extract($args, EXTR_SKIP); |
|
2710 | + //print_r($args); |
|
2711 | + //print_r($instance); |
|
2712 | + // prints the widget |
|
2713 | + extract($args, EXTR_SKIP); |
|
2714 | 2714 | |
2715 | - /** This filter is documented in geodirectory_widgets.php */ |
|
2716 | - $title = empty($instance['title']) ? __('My Dashboard', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory')); |
|
2715 | + /** This filter is documented in geodirectory_widgets.php */ |
|
2716 | + $title = empty($instance['title']) ? __('My Dashboard', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory')); |
|
2717 | 2717 | |
2718 | - echo $before_widget; |
|
2719 | - echo $before_title . $title . $after_title; |
|
2718 | + echo $before_widget; |
|
2719 | + echo $before_title . $title . $after_title; |
|
2720 | 2720 | |
2721 | - if (is_user_logged_in()) { |
|
2722 | - global $current_user; |
|
2721 | + if (is_user_logged_in()) { |
|
2722 | + global $current_user; |
|
2723 | 2723 | |
2724 | - $author_link = get_author_posts_url($current_user->data->ID); |
|
2725 | - $author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false); |
|
2724 | + $author_link = get_author_posts_url($current_user->data->ID); |
|
2725 | + $author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false); |
|
2726 | 2726 | |
2727 | - echo '<ul class="geodir-loginbox-list">'; |
|
2728 | - ob_start(); |
|
2729 | - ?> |
|
2727 | + echo '<ul class="geodir-loginbox-list">'; |
|
2728 | + ob_start(); |
|
2729 | + ?> |
|
2730 | 2730 | <li><a class="signin" |
2731 | 2731 | href="<?php echo wp_logout_url(home_url()); ?>"><?php _e('Logout', 'geodirectory'); ?></a></li> |
2732 | 2732 | <?php |
2733 | - $post_types = geodir_get_posttypes('object'); |
|
2734 | - $show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_user_dashboard'); |
|
2735 | - $geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend'); |
|
2733 | + $post_types = geodir_get_posttypes('object'); |
|
2734 | + $show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_user_dashboard'); |
|
2735 | + $geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend'); |
|
2736 | 2736 | |
2737 | - if (!empty($show_add_listing_post_types_main_nav)) { |
|
2738 | - $addlisting_links = ''; |
|
2739 | - foreach ($post_types as $key => $postobj) { |
|
2737 | + if (!empty($show_add_listing_post_types_main_nav)) { |
|
2738 | + $addlisting_links = ''; |
|
2739 | + foreach ($post_types as $key => $postobj) { |
|
2740 | 2740 | |
2741 | - if (in_array($key, $show_add_listing_post_types_main_nav)) { |
|
2741 | + if (in_array($key, $show_add_listing_post_types_main_nav)) { |
|
2742 | 2742 | |
2743 | - if ($add_link = geodir_get_addlisting_link($key)) { |
|
2743 | + if ($add_link = geodir_get_addlisting_link($key)) { |
|
2744 | 2744 | |
2745 | - $name = $postobj->labels->name; |
|
2745 | + $name = $postobj->labels->name; |
|
2746 | 2746 | |
2747 | - $selected = ''; |
|
2748 | - if (geodir_get_current_posttype() == $key && geodir_is_page('add-listing')) |
|
2749 | - $selected = 'selected="selected"'; |
|
2747 | + $selected = ''; |
|
2748 | + if (geodir_get_current_posttype() == $key && geodir_is_page('add-listing')) |
|
2749 | + $selected = 'selected="selected"'; |
|
2750 | 2750 | |
2751 | - /** |
|
2752 | - * Filter add listing link. |
|
2753 | - * |
|
2754 | - * @since 1.0.0 |
|
2755 | - * @param string $add_link Add listing link. |
|
2756 | - * @param string $key Add listing array key. |
|
2757 | - * @param int $current_user->ID Current user ID. |
|
2758 | - */ |
|
2759 | - $add_link = apply_filters('geodir_dashboard_link_add_listing', $add_link, $key, $current_user->ID); |
|
2751 | + /** |
|
2752 | + * Filter add listing link. |
|
2753 | + * |
|
2754 | + * @since 1.0.0 |
|
2755 | + * @param string $add_link Add listing link. |
|
2756 | + * @param string $key Add listing array key. |
|
2757 | + * @param int $current_user->ID Current user ID. |
|
2758 | + */ |
|
2759 | + $add_link = apply_filters('geodir_dashboard_link_add_listing', $add_link, $key, $current_user->ID); |
|
2760 | 2760 | |
2761 | - $addlisting_links .= '<option ' . $selected . ' value="' . $add_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>'; |
|
2761 | + $addlisting_links .= '<option ' . $selected . ' value="' . $add_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>'; |
|
2762 | 2762 | |
2763 | - } |
|
2764 | - } |
|
2763 | + } |
|
2764 | + } |
|
2765 | 2765 | |
2766 | - } |
|
2766 | + } |
|
2767 | 2767 | |
2768 | - if ($addlisting_links != '') { ?> |
|
2768 | + if ($addlisting_links != '') { ?> |
|
2769 | 2769 | |
2770 | 2770 | <li><select id="geodir_add_listing" class="chosen_select" onchange="window.location.href=this.value" |
2771 | 2771 | option-autoredirect="1" name="geodir_add_listing" option-ajaxchosen="false" |
@@ -2774,42 +2774,42 @@ discard block |
||
2774 | 2774 | <?php echo $addlisting_links; ?> |
2775 | 2775 | </select></li> <?php |
2776 | 2776 | |
2777 | - } |
|
2778 | - |
|
2779 | - } |
|
2780 | - // My Favourites in Dashboard |
|
2781 | - $show_favorite_link_user_dashboard = get_option('geodir_favorite_link_user_dashboard'); |
|
2782 | - $user_favourite = geodir_user_favourite_listing_count(); |
|
2783 | - |
|
2784 | - if (!empty($show_favorite_link_user_dashboard) && !empty($user_favourite)) { |
|
2785 | - $favourite_links = ''; |
|
2786 | - |
|
2787 | - foreach ($post_types as $key => $postobj) { |
|
2788 | - if (in_array($key, $show_favorite_link_user_dashboard) && array_key_exists($key, $user_favourite)) { |
|
2789 | - $name = $postobj->labels->name; |
|
2790 | - $post_type_link = geodir_getlink($author_link, array('stype' => $key, 'list' => 'favourite'), false); |
|
2791 | - |
|
2792 | - $selected = ''; |
|
2793 | - |
|
2794 | - if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key && isset($_REQUEST['geodir_dashbord'])) { |
|
2795 | - $selected = 'selected="selected"'; |
|
2796 | - } |
|
2797 | - /** |
|
2798 | - * Filter favorite listing link. |
|
2799 | - * |
|
2800 | - * @since 1.0.0 |
|
2801 | - * @param string $post_type_link Favorite listing link. |
|
2802 | - * @param string $key Favorite listing array key. |
|
2803 | - * @param int $current_user->ID Current user ID. |
|
2804 | - */ |
|
2805 | - $post_type_link = apply_filters('geodir_dashboard_link_favorite_listing', $post_type_link, $key, $current_user->ID); |
|
2806 | - |
|
2807 | - $favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>'; |
|
2808 | - } |
|
2809 | - } |
|
2810 | - |
|
2811 | - if ($favourite_links != '') { |
|
2812 | - ?> |
|
2777 | + } |
|
2778 | + |
|
2779 | + } |
|
2780 | + // My Favourites in Dashboard |
|
2781 | + $show_favorite_link_user_dashboard = get_option('geodir_favorite_link_user_dashboard'); |
|
2782 | + $user_favourite = geodir_user_favourite_listing_count(); |
|
2783 | + |
|
2784 | + if (!empty($show_favorite_link_user_dashboard) && !empty($user_favourite)) { |
|
2785 | + $favourite_links = ''; |
|
2786 | + |
|
2787 | + foreach ($post_types as $key => $postobj) { |
|
2788 | + if (in_array($key, $show_favorite_link_user_dashboard) && array_key_exists($key, $user_favourite)) { |
|
2789 | + $name = $postobj->labels->name; |
|
2790 | + $post_type_link = geodir_getlink($author_link, array('stype' => $key, 'list' => 'favourite'), false); |
|
2791 | + |
|
2792 | + $selected = ''; |
|
2793 | + |
|
2794 | + if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key && isset($_REQUEST['geodir_dashbord'])) { |
|
2795 | + $selected = 'selected="selected"'; |
|
2796 | + } |
|
2797 | + /** |
|
2798 | + * Filter favorite listing link. |
|
2799 | + * |
|
2800 | + * @since 1.0.0 |
|
2801 | + * @param string $post_type_link Favorite listing link. |
|
2802 | + * @param string $key Favorite listing array key. |
|
2803 | + * @param int $current_user->ID Current user ID. |
|
2804 | + */ |
|
2805 | + $post_type_link = apply_filters('geodir_dashboard_link_favorite_listing', $post_type_link, $key, $current_user->ID); |
|
2806 | + |
|
2807 | + $favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>'; |
|
2808 | + } |
|
2809 | + } |
|
2810 | + |
|
2811 | + if ($favourite_links != '') { |
|
2812 | + ?> |
|
2813 | 2813 | <li> |
2814 | 2814 | <select id="geodir_my_favourites" class="chosen_select" onchange="window.location.href=this.value" |
2815 | 2815 | option-autoredirect="1" name="geodir_my_favourites" option-ajaxchosen="false" |
@@ -2819,42 +2819,42 @@ discard block |
||
2819 | 2819 | </select> |
2820 | 2820 | </li> |
2821 | 2821 | <?php |
2822 | - } |
|
2823 | - } |
|
2824 | - |
|
2825 | - |
|
2826 | - $show_listing_link_user_dashboard = get_option('geodir_listing_link_user_dashboard'); |
|
2827 | - $user_listing = geodir_user_post_listing_count(); |
|
2828 | - |
|
2829 | - if (!empty($show_listing_link_user_dashboard) && !empty($user_listing)) { |
|
2830 | - $listing_links = ''; |
|
2831 | - |
|
2832 | - foreach ($post_types as $key => $postobj) { |
|
2833 | - if (in_array($key, $show_listing_link_user_dashboard) && array_key_exists($key, $user_listing)) { |
|
2834 | - $name = $postobj->labels->name; |
|
2835 | - $listing_link = geodir_getlink($author_link, array('stype' => $key), false); |
|
2836 | - |
|
2837 | - $selected = ''; |
|
2838 | - if (!isset($_REQUEST['list']) && isset($_REQUEST['geodir_dashbord']) && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key) { |
|
2839 | - $selected = 'selected="selected"'; |
|
2840 | - } |
|
2841 | - |
|
2842 | - /** |
|
2843 | - * Filter my listing link. |
|
2844 | - * |
|
2845 | - * @since 1.0.0 |
|
2846 | - * @param string $listing_link My listing link. |
|
2847 | - * @param string $key My listing array key. |
|
2848 | - * @param int $current_user->ID Current user ID. |
|
2849 | - */ |
|
2850 | - $listing_link = apply_filters('geodir_dashboard_link_my_listing', $listing_link, $key, $current_user->ID); |
|
2851 | - |
|
2852 | - $listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>'; |
|
2853 | - } |
|
2854 | - } |
|
2855 | - |
|
2856 | - if ($listing_links != '') { |
|
2857 | - ?> |
|
2822 | + } |
|
2823 | + } |
|
2824 | + |
|
2825 | + |
|
2826 | + $show_listing_link_user_dashboard = get_option('geodir_listing_link_user_dashboard'); |
|
2827 | + $user_listing = geodir_user_post_listing_count(); |
|
2828 | + |
|
2829 | + if (!empty($show_listing_link_user_dashboard) && !empty($user_listing)) { |
|
2830 | + $listing_links = ''; |
|
2831 | + |
|
2832 | + foreach ($post_types as $key => $postobj) { |
|
2833 | + if (in_array($key, $show_listing_link_user_dashboard) && array_key_exists($key, $user_listing)) { |
|
2834 | + $name = $postobj->labels->name; |
|
2835 | + $listing_link = geodir_getlink($author_link, array('stype' => $key), false); |
|
2836 | + |
|
2837 | + $selected = ''; |
|
2838 | + if (!isset($_REQUEST['list']) && isset($_REQUEST['geodir_dashbord']) && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key) { |
|
2839 | + $selected = 'selected="selected"'; |
|
2840 | + } |
|
2841 | + |
|
2842 | + /** |
|
2843 | + * Filter my listing link. |
|
2844 | + * |
|
2845 | + * @since 1.0.0 |
|
2846 | + * @param string $listing_link My listing link. |
|
2847 | + * @param string $key My listing array key. |
|
2848 | + * @param int $current_user->ID Current user ID. |
|
2849 | + */ |
|
2850 | + $listing_link = apply_filters('geodir_dashboard_link_my_listing', $listing_link, $key, $current_user->ID); |
|
2851 | + |
|
2852 | + $listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>'; |
|
2853 | + } |
|
2854 | + } |
|
2855 | + |
|
2856 | + if ($listing_links != '') { |
|
2857 | + ?> |
|
2858 | 2858 | <li> |
2859 | 2859 | <select id="geodir_my_listings" class="chosen_select" onchange="window.location.href=this.value" |
2860 | 2860 | option-autoredirect="1" name="geodir_my_listings" option-ajaxchosen="false" |
@@ -2864,27 +2864,27 @@ discard block |
||
2864 | 2864 | </select> |
2865 | 2865 | </li> |
2866 | 2866 | <?php |
2867 | - } |
|
2868 | - } |
|
2869 | - |
|
2870 | - $dashboard_link = ob_get_clean(); |
|
2871 | - /** |
|
2872 | - * Filter dashboard links HTML. |
|
2873 | - * |
|
2874 | - * @since 1.0.0 |
|
2875 | - * @param string $dashboard_link Dashboard links HTML. |
|
2876 | - */ |
|
2877 | - echo apply_filters('geodir_dashboard_links', $dashboard_link); |
|
2878 | - echo '</ul>'; |
|
2879 | - } else { |
|
2880 | - ?> |
|
2867 | + } |
|
2868 | + } |
|
2869 | + |
|
2870 | + $dashboard_link = ob_get_clean(); |
|
2871 | + /** |
|
2872 | + * Filter dashboard links HTML. |
|
2873 | + * |
|
2874 | + * @since 1.0.0 |
|
2875 | + * @param string $dashboard_link Dashboard links HTML. |
|
2876 | + */ |
|
2877 | + echo apply_filters('geodir_dashboard_links', $dashboard_link); |
|
2878 | + echo '</ul>'; |
|
2879 | + } else { |
|
2880 | + ?> |
|
2881 | 2881 | <?php |
2882 | - /** |
|
2883 | - * Filter signup form action link. |
|
2884 | - * |
|
2885 | - * @since 1.0.0 |
|
2886 | - */ |
|
2887 | - ?> |
|
2882 | + /** |
|
2883 | + * Filter signup form action link. |
|
2884 | + * |
|
2885 | + * @since 1.0.0 |
|
2886 | + */ |
|
2887 | + ?> |
|
2888 | 2888 | <form name="loginform" class="loginform1" |
2889 | 2889 | action="<?php echo geodir_login_url(); ?>" |
2890 | 2890 | method="post"> |
@@ -2904,28 +2904,28 @@ discard block |
||
2904 | 2904 | |
2905 | 2905 | <p class="geodir-new-forgot-link"> |
2906 | 2906 | <?php |
2907 | - /** |
|
2908 | - * Filter signup page register form link. |
|
2909 | - * |
|
2910 | - * @since 1.0.0 |
|
2911 | - */ |
|
2912 | - ?> |
|
2907 | + /** |
|
2908 | + * Filter signup page register form link. |
|
2909 | + * |
|
2910 | + * @since 1.0.0 |
|
2911 | + */ |
|
2912 | + ?> |
|
2913 | 2913 | <a href="<?php echo geodir_login_url(array('signup' => true)); ?>" |
2914 | 2914 | class="goedir-newuser-link"><?php echo NEW_USER_TEXT; ?></a> |
2915 | 2915 | |
2916 | 2916 | <?php |
2917 | - /** |
|
2918 | - * Filter signup page forgot password form link. |
|
2919 | - * |
|
2920 | - * @since 1.0.0 |
|
2921 | - */ |
|
2922 | - ?> |
|
2917 | + /** |
|
2918 | + * Filter signup page forgot password form link. |
|
2919 | + * |
|
2920 | + * @since 1.0.0 |
|
2921 | + */ |
|
2922 | + ?> |
|
2923 | 2923 | <a href="<?php echo geodir_login_url(array('forgot' => true)); ?>" |
2924 | 2924 | class="goedir-forgot-link"><?php echo FORGOT_PW_TEXT; ?></a></p></div> |
2925 | 2925 | </form> |
2926 | 2926 | <?php } |
2927 | 2927 | |
2928 | - echo $after_widget; |
|
2928 | + echo $after_widget; |
|
2929 | 2929 | } |
2930 | 2930 | |
2931 | 2931 | |
@@ -2944,284 +2944,284 @@ discard block |
||
2944 | 2944 | * @param array|string $instance The settings for the particular instance of the widget. |
2945 | 2945 | */ |
2946 | 2946 | function geodir_popular_postview_output($args = '', $instance = '') { |
2947 | - global $gd_session; |
|
2947 | + global $gd_session; |
|
2948 | 2948 | |
2949 | - // prints the widget |
|
2950 | - extract($args, EXTR_SKIP); |
|
2951 | - |
|
2952 | - echo $before_widget; |
|
2953 | - |
|
2954 | - /** This filter is documented in geodirectory_widgets.php */ |
|
2955 | - $title = empty($instance['title']) ? geodir_ucwords($instance['category_title']) : apply_filters('widget_title', __($instance['title'], 'geodirectory')); |
|
2956 | - /** |
|
2957 | - * Filter the widget post type. |
|
2958 | - * |
|
2959 | - * @since 1.0.0 |
|
2960 | - * @param string $instance['post_type'] Post type of listing. |
|
2961 | - */ |
|
2962 | - $post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']); |
|
2963 | - /** |
|
2964 | - * Filter the widget's term. |
|
2965 | - * |
|
2966 | - * @since 1.0.0 |
|
2967 | - * @param string $instance['category'] Filter by term. Can be any valid term. |
|
2968 | - */ |
|
2969 | - $category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']); |
|
2970 | - /** |
|
2971 | - * Filter the widget listings limit. |
|
2972 | - * |
|
2973 | - * @since 1.0.0 |
|
2974 | - * @param string $instance['post_number'] Number of listings to display. |
|
2975 | - */ |
|
2976 | - $post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']); |
|
2977 | - /** |
|
2978 | - * Filter widget's "layout" type. |
|
2979 | - * |
|
2980 | - * @since 1.0.0 |
|
2981 | - * @param string $instance['layout'] Widget layout type. |
|
2982 | - */ |
|
2983 | - $layout = empty($instance['layout']) ? 'gridview_onehalf' : apply_filters('widget_layout', $instance['layout']); |
|
2984 | - /** |
|
2985 | - * Filter widget's "add_location_filter" value. |
|
2986 | - * |
|
2987 | - * @since 1.0.0 |
|
2988 | - * @param string|bool $instance['add_location_filter'] Do you want to add location filter? Can be 1 or 0. |
|
2989 | - */ |
|
2990 | - $add_location_filter = empty($instance['add_location_filter']) ? '0' : apply_filters('widget_add_location_filter', $instance['add_location_filter']); |
|
2991 | - /** |
|
2992 | - * Filter widget's listing width. |
|
2993 | - * |
|
2994 | - * @since 1.0.0 |
|
2995 | - * @param string $instance['listing_width'] Listing width. |
|
2996 | - */ |
|
2997 | - $listing_width = empty($instance['listing_width']) ? '' : apply_filters('widget_listing_width', $instance['listing_width']); |
|
2998 | - /** |
|
2999 | - * Filter widget's "list_sort" type. |
|
3000 | - * |
|
3001 | - * @since 1.0.0 |
|
3002 | - * @param string $instance['list_sort'] Listing sort by type. |
|
3003 | - */ |
|
3004 | - $list_sort = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']); |
|
3005 | - $use_viewing_post_type = !empty($instance['use_viewing_post_type']) ? true : false; |
|
3006 | - |
|
3007 | - // set post type to current viewing post type |
|
3008 | - if ($use_viewing_post_type) { |
|
3009 | - $current_post_type = geodir_get_current_posttype(); |
|
3010 | - if ($current_post_type != '' && $current_post_type != $post_type) { |
|
3011 | - $post_type = $current_post_type; |
|
3012 | - $category = array(); // old post type category will not work for current changed post type |
|
3013 | - } |
|
3014 | - } |
|
3015 | - // replace widget title dynamically |
|
3016 | - $posttype_plural_label = __(get_post_type_plural_label($post_type), 'geodirectory'); |
|
3017 | - $posttype_singular_label = __(get_post_type_singular_label($post_type), 'geodirectory'); |
|
3018 | - |
|
3019 | - $title = str_replace("%posttype_plural_label%", $posttype_plural_label, $title); |
|
3020 | - $title = str_replace("%posttype_singular_label%", $posttype_singular_label, $title); |
|
3021 | - |
|
3022 | - if (isset($instance['character_count'])) { |
|
3023 | - /** |
|
3024 | - * Filter the widget's excerpt character count. |
|
3025 | - * |
|
3026 | - * @since 1.0.0 |
|
3027 | - * @param int $instance['character_count'] Excerpt character count. |
|
3028 | - */ |
|
3029 | - $character_count = apply_filters('widget_list_character_count', $instance['character_count']); |
|
3030 | - } else { |
|
3031 | - $character_count = ''; |
|
3032 | - } |
|
3033 | - |
|
3034 | - if (empty($title) || $title == 'All') { |
|
3035 | - $title .= ' ' . __(get_post_type_plural_label($post_type), 'geodirectory'); |
|
3036 | - } |
|
3037 | - |
|
3038 | - $location_url = array(); |
|
3039 | - $city = get_query_var('gd_city'); |
|
3040 | - if (!empty($city)) { |
|
3041 | - $country = get_query_var('gd_country'); |
|
3042 | - $region = get_query_var('gd_region'); |
|
3043 | - |
|
3044 | - $geodir_show_location_url = get_option('geodir_show_location_url'); |
|
3045 | - |
|
3046 | - if ($geodir_show_location_url == 'all') { |
|
3047 | - if ($country != '') { |
|
3048 | - $location_url[] = $country; |
|
3049 | - } |
|
3050 | - |
|
3051 | - if ($region != '') { |
|
3052 | - $location_url[] = $region; |
|
3053 | - } |
|
3054 | - } else if ($geodir_show_location_url == 'country_city') { |
|
3055 | - if ($country != '') { |
|
3056 | - $location_url[] = $country; |
|
3057 | - } |
|
3058 | - } else if ($geodir_show_location_url == 'region_city') { |
|
3059 | - if ($region != '') { |
|
3060 | - $location_url[] = $region; |
|
3061 | - } |
|
3062 | - } |
|
3063 | - |
|
3064 | - $location_url[] = $city; |
|
3065 | - } |
|
3066 | - |
|
3067 | - $location_url = implode('/', $location_url); |
|
3068 | - $skip_location = false; |
|
3069 | - if (!$add_location_filter && $gd_session->get('gd_multi_location')) { |
|
3070 | - $skip_location = true; |
|
3071 | - $gd_session->un_set('gd_multi_location'); |
|
3072 | - } |
|
3073 | - |
|
3074 | - if (get_option('permalink_structure')) { |
|
3075 | - $viewall_url = get_post_type_archive_link($post_type); |
|
3076 | - } else { |
|
3077 | - $viewall_url = get_post_type_archive_link($post_type); |
|
3078 | - } |
|
3079 | - |
|
3080 | - if (!empty($category) && $category[0] != '0') { |
|
3081 | - global $geodir_add_location_url; |
|
3082 | - |
|
3083 | - $geodir_add_location_url = '0'; |
|
3084 | - |
|
3085 | - if ($add_location_filter != '0') { |
|
3086 | - $geodir_add_location_url = '1'; |
|
3087 | - } |
|
3088 | - |
|
3089 | - $viewall_url = get_term_link((int)$category[0], $post_type . 'category'); |
|
3090 | - |
|
3091 | - $geodir_add_location_url = NULL; |
|
3092 | - } |
|
3093 | - if ($skip_location) { |
|
3094 | - $gd_session->set('gd_multi_location', 1); |
|
3095 | - } |
|
3096 | - |
|
3097 | - if(is_wp_error( $viewall_url )){$viewall_url = '';} |
|
3098 | - |
|
3099 | - $query_args = array( |
|
3100 | - 'posts_per_page' => $post_number, |
|
3101 | - 'is_geodir_loop' => true, |
|
3102 | - 'gd_location' => $add_location_filter ? true : false, |
|
3103 | - 'post_type' => $post_type, |
|
3104 | - 'order_by' => $list_sort |
|
3105 | - ); |
|
3106 | - |
|
3107 | - if ($character_count) { |
|
3108 | - $query_args['excerpt_length'] = $character_count; |
|
3109 | - } |
|
3110 | - |
|
3111 | - if (!empty($instance['show_featured_only'])) { |
|
3112 | - $query_args['show_featured_only'] = 1; |
|
3113 | - } |
|
3114 | - |
|
3115 | - if (!empty($instance['show_special_only'])) { |
|
3116 | - $query_args['show_special_only'] = 1; |
|
3117 | - } |
|
3118 | - |
|
3119 | - if (!empty($instance['with_pics_only'])) { |
|
3120 | - $query_args['with_pics_only'] = 0; |
|
3121 | - $query_args['featured_image_only'] = 1; |
|
3122 | - } |
|
3123 | - |
|
3124 | - if (!empty($instance['with_videos_only'])) { |
|
3125 | - $query_args['with_videos_only'] = 1; |
|
3126 | - } |
|
3127 | - $with_no_results = !empty($instance['without_no_results']) ? false : true; |
|
3128 | - |
|
3129 | - if (!empty($category) && $category[0] != '0') { |
|
3130 | - $category_taxonomy = geodir_get_taxonomies($post_type); |
|
3131 | - |
|
3132 | - ######### WPML ######### |
|
3133 | - if (function_exists('icl_object_id')) { |
|
3134 | - $category = gd_lang_object_ids($category, $category_taxonomy[0]); |
|
3135 | - } |
|
3136 | - ######### WPML ######### |
|
3137 | - |
|
3138 | - $tax_query = array( |
|
3139 | - 'taxonomy' => $category_taxonomy[0], |
|
3140 | - 'field' => 'id', |
|
3141 | - 'terms' => $category |
|
3142 | - ); |
|
3143 | - |
|
3144 | - $query_args['tax_query'] = array($tax_query); |
|
3145 | - } |
|
3146 | - |
|
3147 | - global $gridview_columns_widget, $geodir_is_widget_listing; |
|
3148 | - |
|
3149 | - $widget_listings = geodir_get_widget_listings($query_args); |
|
3150 | - |
|
3151 | - if (!empty($widget_listings) || $with_no_results) { |
|
3152 | - ?> |
|
2949 | + // prints the widget |
|
2950 | + extract($args, EXTR_SKIP); |
|
2951 | + |
|
2952 | + echo $before_widget; |
|
2953 | + |
|
2954 | + /** This filter is documented in geodirectory_widgets.php */ |
|
2955 | + $title = empty($instance['title']) ? geodir_ucwords($instance['category_title']) : apply_filters('widget_title', __($instance['title'], 'geodirectory')); |
|
2956 | + /** |
|
2957 | + * Filter the widget post type. |
|
2958 | + * |
|
2959 | + * @since 1.0.0 |
|
2960 | + * @param string $instance['post_type'] Post type of listing. |
|
2961 | + */ |
|
2962 | + $post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']); |
|
2963 | + /** |
|
2964 | + * Filter the widget's term. |
|
2965 | + * |
|
2966 | + * @since 1.0.0 |
|
2967 | + * @param string $instance['category'] Filter by term. Can be any valid term. |
|
2968 | + */ |
|
2969 | + $category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']); |
|
2970 | + /** |
|
2971 | + * Filter the widget listings limit. |
|
2972 | + * |
|
2973 | + * @since 1.0.0 |
|
2974 | + * @param string $instance['post_number'] Number of listings to display. |
|
2975 | + */ |
|
2976 | + $post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']); |
|
2977 | + /** |
|
2978 | + * Filter widget's "layout" type. |
|
2979 | + * |
|
2980 | + * @since 1.0.0 |
|
2981 | + * @param string $instance['layout'] Widget layout type. |
|
2982 | + */ |
|
2983 | + $layout = empty($instance['layout']) ? 'gridview_onehalf' : apply_filters('widget_layout', $instance['layout']); |
|
2984 | + /** |
|
2985 | + * Filter widget's "add_location_filter" value. |
|
2986 | + * |
|
2987 | + * @since 1.0.0 |
|
2988 | + * @param string|bool $instance['add_location_filter'] Do you want to add location filter? Can be 1 or 0. |
|
2989 | + */ |
|
2990 | + $add_location_filter = empty($instance['add_location_filter']) ? '0' : apply_filters('widget_add_location_filter', $instance['add_location_filter']); |
|
2991 | + /** |
|
2992 | + * Filter widget's listing width. |
|
2993 | + * |
|
2994 | + * @since 1.0.0 |
|
2995 | + * @param string $instance['listing_width'] Listing width. |
|
2996 | + */ |
|
2997 | + $listing_width = empty($instance['listing_width']) ? '' : apply_filters('widget_listing_width', $instance['listing_width']); |
|
2998 | + /** |
|
2999 | + * Filter widget's "list_sort" type. |
|
3000 | + * |
|
3001 | + * @since 1.0.0 |
|
3002 | + * @param string $instance['list_sort'] Listing sort by type. |
|
3003 | + */ |
|
3004 | + $list_sort = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']); |
|
3005 | + $use_viewing_post_type = !empty($instance['use_viewing_post_type']) ? true : false; |
|
3006 | + |
|
3007 | + // set post type to current viewing post type |
|
3008 | + if ($use_viewing_post_type) { |
|
3009 | + $current_post_type = geodir_get_current_posttype(); |
|
3010 | + if ($current_post_type != '' && $current_post_type != $post_type) { |
|
3011 | + $post_type = $current_post_type; |
|
3012 | + $category = array(); // old post type category will not work for current changed post type |
|
3013 | + } |
|
3014 | + } |
|
3015 | + // replace widget title dynamically |
|
3016 | + $posttype_plural_label = __(get_post_type_plural_label($post_type), 'geodirectory'); |
|
3017 | + $posttype_singular_label = __(get_post_type_singular_label($post_type), 'geodirectory'); |
|
3018 | + |
|
3019 | + $title = str_replace("%posttype_plural_label%", $posttype_plural_label, $title); |
|
3020 | + $title = str_replace("%posttype_singular_label%", $posttype_singular_label, $title); |
|
3021 | + |
|
3022 | + if (isset($instance['character_count'])) { |
|
3023 | + /** |
|
3024 | + * Filter the widget's excerpt character count. |
|
3025 | + * |
|
3026 | + * @since 1.0.0 |
|
3027 | + * @param int $instance['character_count'] Excerpt character count. |
|
3028 | + */ |
|
3029 | + $character_count = apply_filters('widget_list_character_count', $instance['character_count']); |
|
3030 | + } else { |
|
3031 | + $character_count = ''; |
|
3032 | + } |
|
3033 | + |
|
3034 | + if (empty($title) || $title == 'All') { |
|
3035 | + $title .= ' ' . __(get_post_type_plural_label($post_type), 'geodirectory'); |
|
3036 | + } |
|
3037 | + |
|
3038 | + $location_url = array(); |
|
3039 | + $city = get_query_var('gd_city'); |
|
3040 | + if (!empty($city)) { |
|
3041 | + $country = get_query_var('gd_country'); |
|
3042 | + $region = get_query_var('gd_region'); |
|
3043 | + |
|
3044 | + $geodir_show_location_url = get_option('geodir_show_location_url'); |
|
3045 | + |
|
3046 | + if ($geodir_show_location_url == 'all') { |
|
3047 | + if ($country != '') { |
|
3048 | + $location_url[] = $country; |
|
3049 | + } |
|
3050 | + |
|
3051 | + if ($region != '') { |
|
3052 | + $location_url[] = $region; |
|
3053 | + } |
|
3054 | + } else if ($geodir_show_location_url == 'country_city') { |
|
3055 | + if ($country != '') { |
|
3056 | + $location_url[] = $country; |
|
3057 | + } |
|
3058 | + } else if ($geodir_show_location_url == 'region_city') { |
|
3059 | + if ($region != '') { |
|
3060 | + $location_url[] = $region; |
|
3061 | + } |
|
3062 | + } |
|
3063 | + |
|
3064 | + $location_url[] = $city; |
|
3065 | + } |
|
3066 | + |
|
3067 | + $location_url = implode('/', $location_url); |
|
3068 | + $skip_location = false; |
|
3069 | + if (!$add_location_filter && $gd_session->get('gd_multi_location')) { |
|
3070 | + $skip_location = true; |
|
3071 | + $gd_session->un_set('gd_multi_location'); |
|
3072 | + } |
|
3073 | + |
|
3074 | + if (get_option('permalink_structure')) { |
|
3075 | + $viewall_url = get_post_type_archive_link($post_type); |
|
3076 | + } else { |
|
3077 | + $viewall_url = get_post_type_archive_link($post_type); |
|
3078 | + } |
|
3079 | + |
|
3080 | + if (!empty($category) && $category[0] != '0') { |
|
3081 | + global $geodir_add_location_url; |
|
3082 | + |
|
3083 | + $geodir_add_location_url = '0'; |
|
3084 | + |
|
3085 | + if ($add_location_filter != '0') { |
|
3086 | + $geodir_add_location_url = '1'; |
|
3087 | + } |
|
3088 | + |
|
3089 | + $viewall_url = get_term_link((int)$category[0], $post_type . 'category'); |
|
3090 | + |
|
3091 | + $geodir_add_location_url = NULL; |
|
3092 | + } |
|
3093 | + if ($skip_location) { |
|
3094 | + $gd_session->set('gd_multi_location', 1); |
|
3095 | + } |
|
3096 | + |
|
3097 | + if(is_wp_error( $viewall_url )){$viewall_url = '';} |
|
3098 | + |
|
3099 | + $query_args = array( |
|
3100 | + 'posts_per_page' => $post_number, |
|
3101 | + 'is_geodir_loop' => true, |
|
3102 | + 'gd_location' => $add_location_filter ? true : false, |
|
3103 | + 'post_type' => $post_type, |
|
3104 | + 'order_by' => $list_sort |
|
3105 | + ); |
|
3106 | + |
|
3107 | + if ($character_count) { |
|
3108 | + $query_args['excerpt_length'] = $character_count; |
|
3109 | + } |
|
3110 | + |
|
3111 | + if (!empty($instance['show_featured_only'])) { |
|
3112 | + $query_args['show_featured_only'] = 1; |
|
3113 | + } |
|
3114 | + |
|
3115 | + if (!empty($instance['show_special_only'])) { |
|
3116 | + $query_args['show_special_only'] = 1; |
|
3117 | + } |
|
3118 | + |
|
3119 | + if (!empty($instance['with_pics_only'])) { |
|
3120 | + $query_args['with_pics_only'] = 0; |
|
3121 | + $query_args['featured_image_only'] = 1; |
|
3122 | + } |
|
3123 | + |
|
3124 | + if (!empty($instance['with_videos_only'])) { |
|
3125 | + $query_args['with_videos_only'] = 1; |
|
3126 | + } |
|
3127 | + $with_no_results = !empty($instance['without_no_results']) ? false : true; |
|
3128 | + |
|
3129 | + if (!empty($category) && $category[0] != '0') { |
|
3130 | + $category_taxonomy = geodir_get_taxonomies($post_type); |
|
3131 | + |
|
3132 | + ######### WPML ######### |
|
3133 | + if (function_exists('icl_object_id')) { |
|
3134 | + $category = gd_lang_object_ids($category, $category_taxonomy[0]); |
|
3135 | + } |
|
3136 | + ######### WPML ######### |
|
3137 | + |
|
3138 | + $tax_query = array( |
|
3139 | + 'taxonomy' => $category_taxonomy[0], |
|
3140 | + 'field' => 'id', |
|
3141 | + 'terms' => $category |
|
3142 | + ); |
|
3143 | + |
|
3144 | + $query_args['tax_query'] = array($tax_query); |
|
3145 | + } |
|
3146 | + |
|
3147 | + global $gridview_columns_widget, $geodir_is_widget_listing; |
|
3148 | + |
|
3149 | + $widget_listings = geodir_get_widget_listings($query_args); |
|
3150 | + |
|
3151 | + if (!empty($widget_listings) || $with_no_results) { |
|
3152 | + ?> |
|
3153 | 3153 | <div class="geodir_locations geodir_location_listing"> |
3154 | 3154 | |
3155 | 3155 | <?php |
3156 | - /** |
|
3157 | - * Called before the div containing the title and view all link in popular post view widget. |
|
3158 | - * |
|
3159 | - * @since 1.0.0 |
|
3160 | - */ |
|
3161 | - do_action('geodir_before_view_all_link_in_widget'); ?> |
|
3156 | + /** |
|
3157 | + * Called before the div containing the title and view all link in popular post view widget. |
|
3158 | + * |
|
3159 | + * @since 1.0.0 |
|
3160 | + */ |
|
3161 | + do_action('geodir_before_view_all_link_in_widget'); ?> |
|
3162 | 3162 | <div class="geodir_list_heading clearfix"> |
3163 | 3163 | <?php echo $before_title . $title . $after_title; ?> |
3164 | 3164 | <a href="<?php echo $viewall_url; ?>" |
3165 | 3165 | class="geodir-viewall"><?php _e('View all', 'geodirectory'); ?></a> |
3166 | 3166 | </div> |
3167 | 3167 | <?php |
3168 | - /** |
|
3169 | - * Called after the div containing the title and view all link in popular post view widget. |
|
3170 | - * |
|
3171 | - * @since 1.0.0 |
|
3172 | - */ |
|
3173 | - do_action('geodir_after_view_all_link_in_widget'); ?> |
|
3168 | + /** |
|
3169 | + * Called after the div containing the title and view all link in popular post view widget. |
|
3170 | + * |
|
3171 | + * @since 1.0.0 |
|
3172 | + */ |
|
3173 | + do_action('geodir_after_view_all_link_in_widget'); ?> |
|
3174 | 3174 | <?php |
3175 | - if (strstr($layout, 'gridview')) { |
|
3176 | - $listing_view_exp = explode('_', $layout); |
|
3177 | - $gridview_columns_widget = $layout; |
|
3178 | - $layout = $listing_view_exp[0]; |
|
3179 | - } else { |
|
3180 | - $gridview_columns_widget = ''; |
|
3181 | - } |
|
3182 | - |
|
3183 | - /** |
|
3184 | - * Filter the widget listing listview template path. |
|
3185 | - * |
|
3186 | - * @since 1.0.0 |
|
3187 | - */ |
|
3188 | - $template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview')); |
|
3189 | - if (!isset($character_count)) { |
|
3190 | - /** |
|
3191 | - * Filter the widget's excerpt character count. |
|
3192 | - * |
|
3193 | - * @since 1.0.0 |
|
3194 | - * @param int $instance['character_count'] Excerpt character count. |
|
3195 | - */ |
|
3196 | - $character_count = $character_count == '' ? 50 : apply_filters('widget_character_count', $character_count); |
|
3197 | - } |
|
3198 | - |
|
3199 | - global $post, $map_jason, $map_canvas_arr; |
|
3200 | - |
|
3201 | - $current_post = $post; |
|
3202 | - $current_map_jason = $map_jason; |
|
3203 | - $current_map_canvas_arr = $map_canvas_arr; |
|
3204 | - $geodir_is_widget_listing = true; |
|
3205 | - |
|
3206 | - /** |
|
3207 | - * Includes related listing listview template. |
|
3208 | - * |
|
3209 | - * @since 1.0.0 |
|
3210 | - */ |
|
3211 | - include($template); |
|
3212 | - |
|
3213 | - $geodir_is_widget_listing = false; |
|
3214 | - |
|
3215 | - $GLOBALS['post'] = $current_post; |
|
3216 | - if (!empty($current_post)) |
|
3217 | - setup_postdata($current_post); |
|
3218 | - $map_jason = $current_map_jason; |
|
3219 | - $map_canvas_arr = $current_map_canvas_arr; |
|
3220 | - ?> |
|
3175 | + if (strstr($layout, 'gridview')) { |
|
3176 | + $listing_view_exp = explode('_', $layout); |
|
3177 | + $gridview_columns_widget = $layout; |
|
3178 | + $layout = $listing_view_exp[0]; |
|
3179 | + } else { |
|
3180 | + $gridview_columns_widget = ''; |
|
3181 | + } |
|
3182 | + |
|
3183 | + /** |
|
3184 | + * Filter the widget listing listview template path. |
|
3185 | + * |
|
3186 | + * @since 1.0.0 |
|
3187 | + */ |
|
3188 | + $template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview')); |
|
3189 | + if (!isset($character_count)) { |
|
3190 | + /** |
|
3191 | + * Filter the widget's excerpt character count. |
|
3192 | + * |
|
3193 | + * @since 1.0.0 |
|
3194 | + * @param int $instance['character_count'] Excerpt character count. |
|
3195 | + */ |
|
3196 | + $character_count = $character_count == '' ? 50 : apply_filters('widget_character_count', $character_count); |
|
3197 | + } |
|
3198 | + |
|
3199 | + global $post, $map_jason, $map_canvas_arr; |
|
3200 | + |
|
3201 | + $current_post = $post; |
|
3202 | + $current_map_jason = $map_jason; |
|
3203 | + $current_map_canvas_arr = $map_canvas_arr; |
|
3204 | + $geodir_is_widget_listing = true; |
|
3205 | + |
|
3206 | + /** |
|
3207 | + * Includes related listing listview template. |
|
3208 | + * |
|
3209 | + * @since 1.0.0 |
|
3210 | + */ |
|
3211 | + include($template); |
|
3212 | + |
|
3213 | + $geodir_is_widget_listing = false; |
|
3214 | + |
|
3215 | + $GLOBALS['post'] = $current_post; |
|
3216 | + if (!empty($current_post)) |
|
3217 | + setup_postdata($current_post); |
|
3218 | + $map_jason = $current_map_jason; |
|
3219 | + $map_canvas_arr = $current_map_canvas_arr; |
|
3220 | + ?> |
|
3221 | 3221 | </div> |
3222 | 3222 | <?php |
3223 | - } |
|
3224 | - echo $after_widget; |
|
3223 | + } |
|
3224 | + echo $after_widget; |
|
3225 | 3225 | |
3226 | 3226 | } |
3227 | 3227 | |
@@ -3244,26 +3244,26 @@ discard block |
||
3244 | 3244 | */ |
3245 | 3245 | function geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type) |
3246 | 3246 | { |
3247 | - global $wpdb, $plugin_prefix; |
|
3247 | + global $wpdb, $plugin_prefix; |
|
3248 | 3248 | |
3249 | - $detail_table = $plugin_prefix . $post_type . '_detail'; |
|
3249 | + $detail_table = $plugin_prefix . $post_type . '_detail'; |
|
3250 | 3250 | |
3251 | - $sql = "SELECT COALESCE(SUM(rating_count),0) FROM " . $detail_table . " WHERE post_status = 'publish' AND rating_count > 0 AND FIND_IN_SET(" . $term_id . ", " . $taxonomy . ")"; |
|
3251 | + $sql = "SELECT COALESCE(SUM(rating_count),0) FROM " . $detail_table . " WHERE post_status = 'publish' AND rating_count > 0 AND FIND_IN_SET(" . $term_id . ", " . $taxonomy . ")"; |
|
3252 | 3252 | |
3253 | - /** |
|
3254 | - * Filter count review sql query. |
|
3255 | - * |
|
3256 | - * @since 1.5.1 |
|
3257 | - * @param string $sql Database sql query.. |
|
3258 | - * @param int $term_id The term ID. |
|
3259 | - * @param int $taxonomy The taxonomy Id. |
|
3260 | - * @param string $post_type The post type. |
|
3261 | - */ |
|
3262 | - $sql = apply_filters('geodir_count_reviews_by_term_sql', $sql, $term_id, $taxonomy, $post_type); |
|
3253 | + /** |
|
3254 | + * Filter count review sql query. |
|
3255 | + * |
|
3256 | + * @since 1.5.1 |
|
3257 | + * @param string $sql Database sql query.. |
|
3258 | + * @param int $term_id The term ID. |
|
3259 | + * @param int $taxonomy The taxonomy Id. |
|
3260 | + * @param string $post_type The post type. |
|
3261 | + */ |
|
3262 | + $sql = apply_filters('geodir_count_reviews_by_term_sql', $sql, $term_id, $taxonomy, $post_type); |
|
3263 | 3263 | |
3264 | - $count = $wpdb->get_var($sql); |
|
3264 | + $count = $wpdb->get_var($sql); |
|
3265 | 3265 | |
3266 | - return $count; |
|
3266 | + return $count; |
|
3267 | 3267 | } |
3268 | 3268 | |
3269 | 3269 | /** |
@@ -3276,53 +3276,53 @@ discard block |
||
3276 | 3276 | */ |
3277 | 3277 | function geodir_count_reviews_by_terms($force_update = false) |
3278 | 3278 | { |
3279 | - /** |
|
3280 | - * Filter review count option data. |
|
3281 | - * |
|
3282 | - * @since 1.0.0 |
|
3283 | - * @param bool $force_update Force update option value?. Default.false. |
|
3284 | - */ |
|
3285 | - $option_data = apply_filters('geodir_count_reviews_by_terms_before', '', $force_update); |
|
3286 | - if (!empty($option_data)) { |
|
3287 | - return $option_data; |
|
3288 | - } |
|
3279 | + /** |
|
3280 | + * Filter review count option data. |
|
3281 | + * |
|
3282 | + * @since 1.0.0 |
|
3283 | + * @param bool $force_update Force update option value?. Default.false. |
|
3284 | + */ |
|
3285 | + $option_data = apply_filters('geodir_count_reviews_by_terms_before', '', $force_update); |
|
3286 | + if (!empty($option_data)) { |
|
3287 | + return $option_data; |
|
3288 | + } |
|
3289 | 3289 | |
3290 | - $option_data = get_option('geodir_global_review_count'); |
|
3290 | + $option_data = get_option('geodir_global_review_count'); |
|
3291 | 3291 | |
3292 | - if (!$option_data OR $force_update) { |
|
3293 | - $post_types = geodir_get_posttypes(); |
|
3294 | - $term_array = array(); |
|
3295 | - foreach ($post_types as $post_type) { |
|
3292 | + if (!$option_data OR $force_update) { |
|
3293 | + $post_types = geodir_get_posttypes(); |
|
3294 | + $term_array = array(); |
|
3295 | + foreach ($post_types as $post_type) { |
|
3296 | 3296 | |
3297 | - $taxonomy = geodir_get_taxonomies($post_type); |
|
3298 | - $taxonomy = $taxonomy[0]; |
|
3297 | + $taxonomy = geodir_get_taxonomies($post_type); |
|
3298 | + $taxonomy = $taxonomy[0]; |
|
3299 | 3299 | |
3300 | - $args = array( |
|
3301 | - 'hide_empty' => false |
|
3302 | - ); |
|
3300 | + $args = array( |
|
3301 | + 'hide_empty' => false |
|
3302 | + ); |
|
3303 | 3303 | |
3304 | - $terms = get_terms($taxonomy, $args); |
|
3304 | + $terms = get_terms($taxonomy, $args); |
|
3305 | 3305 | |
3306 | - foreach ($terms as $term) { |
|
3307 | - $count = geodir_count_reviews_by_term_id($term->term_id, $taxonomy, $post_type); |
|
3308 | - $children = get_term_children($term->term_id, $taxonomy); |
|
3309 | - /*if ( is_array( $children ) ) { |
|
3306 | + foreach ($terms as $term) { |
|
3307 | + $count = geodir_count_reviews_by_term_id($term->term_id, $taxonomy, $post_type); |
|
3308 | + $children = get_term_children($term->term_id, $taxonomy); |
|
3309 | + /*if ( is_array( $children ) ) { |
|
3310 | 3310 | foreach ( $children as $child_id ) { |
3311 | 3311 | $child_count = geodir_count_reviews_by_term_id($child_id, $taxonomy, $post_type); |
3312 | 3312 | $count = $count + $child_count; |
3313 | 3313 | } |
3314 | 3314 | }*/ |
3315 | - $term_array[$term->term_id] = $count; |
|
3316 | - } |
|
3317 | - } |
|
3318 | - |
|
3319 | - update_option('geodir_global_review_count', $term_array); |
|
3320 | - //clear cache |
|
3321 | - wp_cache_delete('geodir_global_review_count'); |
|
3322 | - return $term_array; |
|
3323 | - } else { |
|
3324 | - return $option_data; |
|
3325 | - } |
|
3315 | + $term_array[$term->term_id] = $count; |
|
3316 | + } |
|
3317 | + } |
|
3318 | + |
|
3319 | + update_option('geodir_global_review_count', $term_array); |
|
3320 | + //clear cache |
|
3321 | + wp_cache_delete('geodir_global_review_count'); |
|
3322 | + return $term_array; |
|
3323 | + } else { |
|
3324 | + return $option_data; |
|
3325 | + } |
|
3326 | 3326 | } |
3327 | 3327 | |
3328 | 3328 | /** |
@@ -3334,15 +3334,15 @@ discard block |
||
3334 | 3334 | */ |
3335 | 3335 | function geodir_term_review_count_force_update($new_status, $old_status='', $post='') |
3336 | 3336 | { |
3337 | - if(isset($_REQUEST['action']) && $_REQUEST['action']=='geodir_import_export'){return;}//do not run if importing listings |
|
3338 | - |
|
3339 | - if(isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')){ |
|
3340 | - return; |
|
3341 | - } |
|
3342 | - if($new_status!=$old_status) { |
|
3343 | - geodir_count_reviews_by_terms(true); |
|
3344 | - } |
|
3345 | - return true; |
|
3337 | + if(isset($_REQUEST['action']) && $_REQUEST['action']=='geodir_import_export'){return;}//do not run if importing listings |
|
3338 | + |
|
3339 | + if(isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')){ |
|
3340 | + return; |
|
3341 | + } |
|
3342 | + if($new_status!=$old_status) { |
|
3343 | + geodir_count_reviews_by_terms(true); |
|
3344 | + } |
|
3345 | + return true; |
|
3346 | 3346 | } |
3347 | 3347 | |
3348 | 3348 | |
@@ -3361,15 +3361,15 @@ discard block |
||
3361 | 3361 | function geodir_count_posts_by_term($data, $term) |
3362 | 3362 | { |
3363 | 3363 | |
3364 | - if ($data) { |
|
3365 | - if (isset($data[$term->term_id])) { |
|
3366 | - return $data[$term->term_id]; |
|
3367 | - } else { |
|
3368 | - return 0; |
|
3369 | - } |
|
3370 | - } else { |
|
3371 | - return $term->count; |
|
3372 | - } |
|
3364 | + if ($data) { |
|
3365 | + if (isset($data[$term->term_id])) { |
|
3366 | + return $data[$term->term_id]; |
|
3367 | + } else { |
|
3368 | + return 0; |
|
3369 | + } |
|
3370 | + } else { |
|
3371 | + return $term->count; |
|
3372 | + } |
|
3373 | 3373 | } |
3374 | 3374 | |
3375 | 3375 | /** |
@@ -3382,8 +3382,8 @@ discard block |
||
3382 | 3382 | */ |
3383 | 3383 | function geodir_sort_terms_by_count($terms) |
3384 | 3384 | { |
3385 | - usort($terms, "geodir_sort_by_count_obj"); |
|
3386 | - return $terms; |
|
3385 | + usort($terms, "geodir_sort_by_count_obj"); |
|
3386 | + return $terms; |
|
3387 | 3387 | } |
3388 | 3388 | |
3389 | 3389 | /** |
@@ -3396,8 +3396,8 @@ discard block |
||
3396 | 3396 | */ |
3397 | 3397 | function geodir_sort_terms_by_review_count($terms) |
3398 | 3398 | { |
3399 | - usort($terms, "geodir_sort_by_review_count_obj"); |
|
3400 | - return $terms; |
|
3399 | + usort($terms, "geodir_sort_by_review_count_obj"); |
|
3400 | + return $terms; |
|
3401 | 3401 | } |
3402 | 3402 | |
3403 | 3403 | /** |
@@ -3411,12 +3411,12 @@ discard block |
||
3411 | 3411 | */ |
3412 | 3412 | function geodir_sort_terms($terms, $sort = 'count') |
3413 | 3413 | { |
3414 | - if ($sort == 'count') { |
|
3415 | - return geodir_sort_terms_by_count($terms); |
|
3416 | - } |
|
3417 | - if ($sort == 'review_count') { |
|
3418 | - return geodir_sort_terms_by_review_count($terms); |
|
3419 | - } |
|
3414 | + if ($sort == 'count') { |
|
3415 | + return geodir_sort_terms_by_count($terms); |
|
3416 | + } |
|
3417 | + if ($sort == 'review_count') { |
|
3418 | + return geodir_sort_terms_by_review_count($terms); |
|
3419 | + } |
|
3420 | 3420 | } |
3421 | 3421 | |
3422 | 3422 | /*-----------------------------------------------------------------------------------*/ |
@@ -3433,7 +3433,7 @@ discard block |
||
3433 | 3433 | */ |
3434 | 3434 | function geodir_sort_by_count($a, $b) |
3435 | 3435 | { |
3436 | - return $a['count'] < $b['count']; |
|
3436 | + return $a['count'] < $b['count']; |
|
3437 | 3437 | } |
3438 | 3438 | |
3439 | 3439 | /** |
@@ -3447,7 +3447,7 @@ discard block |
||
3447 | 3447 | */ |
3448 | 3448 | function geodir_sort_by_count_obj($a, $b) |
3449 | 3449 | { |
3450 | - return $a->count < $b->count; |
|
3450 | + return $a->count < $b->count; |
|
3451 | 3451 | } |
3452 | 3452 | |
3453 | 3453 | /** |
@@ -3461,7 +3461,7 @@ discard block |
||
3461 | 3461 | */ |
3462 | 3462 | function geodir_sort_by_review_count_obj($a, $b) |
3463 | 3463 | { |
3464 | - return $a->review_count < $b->review_count; |
|
3464 | + return $a->review_count < $b->review_count; |
|
3465 | 3465 | } |
3466 | 3466 | |
3467 | 3467 | /** |
@@ -3471,43 +3471,43 @@ discard block |
||
3471 | 3471 | * @package GeoDirectory |
3472 | 3472 | */ |
3473 | 3473 | function geodir_load_textdomain() { |
3474 | - /** |
|
3475 | - * Filter the plugin locale. |
|
3476 | - * |
|
3477 | - * @since 1.4.2 |
|
3478 | - * @package GeoDirectory |
|
3479 | - */ |
|
3480 | - $locale = apply_filters('plugin_locale', get_locale(), 'geodirectory'); |
|
3481 | - |
|
3482 | - load_textdomain('geodirectory', WP_LANG_DIR . '/' . 'geodirectory' . '/' . 'geodirectory' . '-' . $locale . '.mo'); |
|
3483 | - load_plugin_textdomain('geodirectory', false, plugin_basename(dirname(dirname(__FILE__))) . '/geodirectory-languages'); |
|
3474 | + /** |
|
3475 | + * Filter the plugin locale. |
|
3476 | + * |
|
3477 | + * @since 1.4.2 |
|
3478 | + * @package GeoDirectory |
|
3479 | + */ |
|
3480 | + $locale = apply_filters('plugin_locale', get_locale(), 'geodirectory'); |
|
3481 | + |
|
3482 | + load_textdomain('geodirectory', WP_LANG_DIR . '/' . 'geodirectory' . '/' . 'geodirectory' . '-' . $locale . '.mo'); |
|
3483 | + load_plugin_textdomain('geodirectory', false, plugin_basename(dirname(dirname(__FILE__))) . '/geodirectory-languages'); |
|
3484 | + |
|
3485 | + /** |
|
3486 | + * Define language constants. |
|
3487 | + * |
|
3488 | + * @since 1.0.0 |
|
3489 | + */ |
|
3490 | + require_once(geodir_plugin_path() . '/language.php'); |
|
3491 | + |
|
3492 | + $language_file = geodir_plugin_path() . '/db-language.php'; |
|
3493 | + |
|
3494 | + // Load language string file if not created yet |
|
3495 | + if (!file_exists($language_file)) { |
|
3496 | + geodirectory_load_db_language(); |
|
3497 | + } |
|
3484 | 3498 | |
3485 | - /** |
|
3486 | - * Define language constants. |
|
3487 | - * |
|
3488 | - * @since 1.0.0 |
|
3489 | - */ |
|
3490 | - require_once(geodir_plugin_path() . '/language.php'); |
|
3491 | - |
|
3492 | - $language_file = geodir_plugin_path() . '/db-language.php'; |
|
3493 | - |
|
3494 | - // Load language string file if not created yet |
|
3495 | - if (!file_exists($language_file)) { |
|
3496 | - geodirectory_load_db_language(); |
|
3497 | - } |
|
3498 | - |
|
3499 | - if (file_exists($language_file)) { |
|
3500 | - /** |
|
3501 | - * Language strings from database. |
|
3502 | - * |
|
3503 | - * @since 1.4.2 |
|
3504 | - */ |
|
3505 | - try { |
|
3506 | - require_once($language_file); |
|
3507 | - } catch(Exception $e) { |
|
3508 | - error_log('Language Error: ' . $e->getMessage()); |
|
3509 | - } |
|
3510 | - } |
|
3499 | + if (file_exists($language_file)) { |
|
3500 | + /** |
|
3501 | + * Language strings from database. |
|
3502 | + * |
|
3503 | + * @since 1.4.2 |
|
3504 | + */ |
|
3505 | + try { |
|
3506 | + require_once($language_file); |
|
3507 | + } catch(Exception $e) { |
|
3508 | + error_log('Language Error: ' . $e->getMessage()); |
|
3509 | + } |
|
3510 | + } |
|
3511 | 3511 | } |
3512 | 3512 | |
3513 | 3513 | /** |
@@ -3521,66 +3521,66 @@ discard block |
||
3521 | 3521 | * @return bool True if file created otherwise false |
3522 | 3522 | */ |
3523 | 3523 | function geodirectory_load_db_language() { |
3524 | - global $wp_filesystem; |
|
3525 | - if( empty( $wp_filesystem ) ) { |
|
3526 | - require_once( ABSPATH .'/wp-admin/includes/file.php' ); |
|
3527 | - WP_Filesystem(); |
|
3528 | - global $wp_filesystem; |
|
3529 | - } |
|
3530 | - |
|
3531 | - $language_file = geodir_plugin_path() . '/db-language.php'; |
|
3524 | + global $wp_filesystem; |
|
3525 | + if( empty( $wp_filesystem ) ) { |
|
3526 | + require_once( ABSPATH .'/wp-admin/includes/file.php' ); |
|
3527 | + WP_Filesystem(); |
|
3528 | + global $wp_filesystem; |
|
3529 | + } |
|
3532 | 3530 | |
3533 | - if(is_file($language_file) && !is_writable($language_file)) |
|
3534 | - return false; // Not possible to create. |
|
3531 | + $language_file = geodir_plugin_path() . '/db-language.php'; |
|
3532 | + |
|
3533 | + if(is_file($language_file) && !is_writable($language_file)) |
|
3534 | + return false; // Not possible to create. |
|
3535 | + |
|
3536 | + if(!is_file($language_file) && !is_writable(dirname($language_file))) |
|
3537 | + return false; // Not possible to create. |
|
3538 | + |
|
3539 | + $contents_strings = array(); |
|
3540 | + |
|
3541 | + /** |
|
3542 | + * Filter the language string from database to translate via po editor |
|
3543 | + * |
|
3544 | + * @since 1.4.2 |
|
3545 | + * |
|
3546 | + * @param array $contents_strings Array of strings. |
|
3547 | + */ |
|
3548 | + $contents_strings = apply_filters('geodir_load_db_language', $contents_strings); |
|
3549 | + |
|
3550 | + $contents_strings = array_unique($contents_strings); |
|
3551 | + |
|
3552 | + $contents_head = array(); |
|
3553 | + $contents_head[] = "<?php"; |
|
3554 | + $contents_head[] = "/**"; |
|
3555 | + $contents_head[] = " * Translate language string stored in database. Ex: Custom Fields"; |
|
3556 | + $contents_head[] = " *"; |
|
3557 | + $contents_head[] = " * @package GeoDirectory"; |
|
3558 | + $contents_head[] = " * @since 1.4.2"; |
|
3559 | + $contents_head[] = " */"; |
|
3560 | + $contents_head[] = ""; |
|
3561 | + $contents_head[] = "// Language keys"; |
|
3562 | + |
|
3563 | + $contents_foot = array(); |
|
3564 | + $contents_foot[] = ""; |
|
3565 | + $contents_foot[] = ""; |
|
3566 | + |
|
3567 | + $contents = implode(PHP_EOL, $contents_head); |
|
3568 | + |
|
3569 | + if (!empty($contents_strings)) { |
|
3570 | + foreach ( $contents_strings as $string ) { |
|
3571 | + if (is_scalar($string) && $string != '') { |
|
3572 | + $string = str_replace("'", "\'", $string); |
|
3573 | + $contents .= PHP_EOL . "__('" . $string . "', 'geodirectory');"; |
|
3574 | + } |
|
3575 | + } |
|
3576 | + } |
|
3535 | 3577 | |
3536 | - if(!is_file($language_file) && !is_writable(dirname($language_file))) |
|
3537 | - return false; // Not possible to create. |
|
3578 | + $contents .= implode(PHP_EOL, $contents_foot); |
|
3538 | 3579 | |
3539 | - $contents_strings = array(); |
|
3580 | + if($wp_filesystem->put_contents( $language_file, $contents, FS_CHMOD_FILE)) |
|
3581 | + return false; // Failure; could not write file. |
|
3540 | 3582 | |
3541 | - /** |
|
3542 | - * Filter the language string from database to translate via po editor |
|
3543 | - * |
|
3544 | - * @since 1.4.2 |
|
3545 | - * |
|
3546 | - * @param array $contents_strings Array of strings. |
|
3547 | - */ |
|
3548 | - $contents_strings = apply_filters('geodir_load_db_language', $contents_strings); |
|
3549 | - |
|
3550 | - $contents_strings = array_unique($contents_strings); |
|
3551 | - |
|
3552 | - $contents_head = array(); |
|
3553 | - $contents_head[] = "<?php"; |
|
3554 | - $contents_head[] = "/**"; |
|
3555 | - $contents_head[] = " * Translate language string stored in database. Ex: Custom Fields"; |
|
3556 | - $contents_head[] = " *"; |
|
3557 | - $contents_head[] = " * @package GeoDirectory"; |
|
3558 | - $contents_head[] = " * @since 1.4.2"; |
|
3559 | - $contents_head[] = " */"; |
|
3560 | - $contents_head[] = ""; |
|
3561 | - $contents_head[] = "// Language keys"; |
|
3562 | - |
|
3563 | - $contents_foot = array(); |
|
3564 | - $contents_foot[] = ""; |
|
3565 | - $contents_foot[] = ""; |
|
3566 | - |
|
3567 | - $contents = implode(PHP_EOL, $contents_head); |
|
3568 | - |
|
3569 | - if (!empty($contents_strings)) { |
|
3570 | - foreach ( $contents_strings as $string ) { |
|
3571 | - if (is_scalar($string) && $string != '') { |
|
3572 | - $string = str_replace("'", "\'", $string); |
|
3573 | - $contents .= PHP_EOL . "__('" . $string . "', 'geodirectory');"; |
|
3574 | - } |
|
3575 | - } |
|
3576 | - } |
|
3577 | - |
|
3578 | - $contents .= implode(PHP_EOL, $contents_foot); |
|
3579 | - |
|
3580 | - if($wp_filesystem->put_contents( $language_file, $contents, FS_CHMOD_FILE)) |
|
3581 | - return false; // Failure; could not write file. |
|
3582 | - |
|
3583 | - return true; |
|
3583 | + return true; |
|
3584 | 3584 | } |
3585 | 3585 | |
3586 | 3586 | /** |
@@ -3596,31 +3596,31 @@ discard block |
||
3596 | 3596 | * @return array Translation texts. |
3597 | 3597 | */ |
3598 | 3598 | function geodir_load_custom_field_translation($translation_texts = array()) { |
3599 | - global $wpdb; |
|
3599 | + global $wpdb; |
|
3600 | 3600 | |
3601 | - // Custom fields table |
|
3602 | - $sql = "SELECT admin_title, admin_desc, site_title, clabels, required_msg, default_value, option_values FROM " . GEODIR_CUSTOM_FIELDS_TABLE; |
|
3603 | - $rows = $wpdb->get_results($sql); |
|
3601 | + // Custom fields table |
|
3602 | + $sql = "SELECT admin_title, admin_desc, site_title, clabels, required_msg, default_value, option_values FROM " . GEODIR_CUSTOM_FIELDS_TABLE; |
|
3603 | + $rows = $wpdb->get_results($sql); |
|
3604 | 3604 | |
3605 | - if (!empty($rows)) { |
|
3606 | - foreach($rows as $row) { |
|
3607 | - if (!empty($row->admin_title)) |
|
3608 | - $translation_texts[] = stripslashes_deep($row->admin_title); |
|
3605 | + if (!empty($rows)) { |
|
3606 | + foreach($rows as $row) { |
|
3607 | + if (!empty($row->admin_title)) |
|
3608 | + $translation_texts[] = stripslashes_deep($row->admin_title); |
|
3609 | 3609 | |
3610 | - if (!empty($row->admin_desc)) |
|
3611 | - $translation_texts[] = stripslashes_deep($row->admin_desc); |
|
3610 | + if (!empty($row->admin_desc)) |
|
3611 | + $translation_texts[] = stripslashes_deep($row->admin_desc); |
|
3612 | 3612 | |
3613 | - if (!empty($row->site_title)) |
|
3614 | - $translation_texts[] = stripslashes_deep($row->site_title); |
|
3613 | + if (!empty($row->site_title)) |
|
3614 | + $translation_texts[] = stripslashes_deep($row->site_title); |
|
3615 | 3615 | |
3616 | - if (!empty($row->clabels)) |
|
3617 | - $translation_texts[] = stripslashes_deep($row->clabels); |
|
3616 | + if (!empty($row->clabels)) |
|
3617 | + $translation_texts[] = stripslashes_deep($row->clabels); |
|
3618 | 3618 | |
3619 | - if (!empty($row->required_msg)) |
|
3620 | - $translation_texts[] = stripslashes_deep($row->required_msg); |
|
3619 | + if (!empty($row->required_msg)) |
|
3620 | + $translation_texts[] = stripslashes_deep($row->required_msg); |
|
3621 | 3621 | |
3622 | 3622 | if (!empty($row->default_value)) |
3623 | - $translation_texts[] = stripslashes_deep($row->default_value); |
|
3623 | + $translation_texts[] = stripslashes_deep($row->default_value); |
|
3624 | 3624 | |
3625 | 3625 | if (!empty($row->option_values)) { |
3626 | 3626 | $option_values = geodir_string_values_to_options(stripslashes_deep($row->option_values)); |
@@ -3633,25 +3633,25 @@ discard block |
||
3633 | 3633 | } |
3634 | 3634 | } |
3635 | 3635 | } |
3636 | - } |
|
3637 | - } |
|
3636 | + } |
|
3637 | + } |
|
3638 | 3638 | |
3639 | - // Custom sorting fields table |
|
3640 | - $sql = "SELECT site_title, asc_title, desc_title FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE; |
|
3641 | - $rows = $wpdb->get_results($sql); |
|
3642 | - |
|
3643 | - if (!empty($rows)) { |
|
3644 | - foreach($rows as $row) { |
|
3645 | - if (!empty($row->site_title)) |
|
3646 | - $translation_texts[] = stripslashes_deep($row->site_title); |
|
3647 | - |
|
3648 | - if (!empty($row->asc_title)) |
|
3649 | - $translation_texts[] = stripslashes_deep($row->asc_title); |
|
3650 | - |
|
3651 | - if (!empty($row->desc_title)) |
|
3652 | - $translation_texts[] = stripslashes_deep($row->desc_title); |
|
3653 | - } |
|
3654 | - } |
|
3639 | + // Custom sorting fields table |
|
3640 | + $sql = "SELECT site_title, asc_title, desc_title FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE; |
|
3641 | + $rows = $wpdb->get_results($sql); |
|
3642 | + |
|
3643 | + if (!empty($rows)) { |
|
3644 | + foreach($rows as $row) { |
|
3645 | + if (!empty($row->site_title)) |
|
3646 | + $translation_texts[] = stripslashes_deep($row->site_title); |
|
3647 | + |
|
3648 | + if (!empty($row->asc_title)) |
|
3649 | + $translation_texts[] = stripslashes_deep($row->asc_title); |
|
3650 | + |
|
3651 | + if (!empty($row->desc_title)) |
|
3652 | + $translation_texts[] = stripslashes_deep($row->desc_title); |
|
3653 | + } |
|
3654 | + } |
|
3655 | 3655 | |
3656 | 3656 | // Advance search filter fields table |
3657 | 3657 | if (defined('GEODIR_ADVANCE_SEARCH_TABLE')) { |
@@ -3672,9 +3672,9 @@ discard block |
||
3672 | 3672 | } |
3673 | 3673 | } |
3674 | 3674 | |
3675 | - $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts; |
|
3675 | + $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts; |
|
3676 | 3676 | |
3677 | - return $translation_texts; |
|
3677 | + return $translation_texts; |
|
3678 | 3678 | } |
3679 | 3679 | |
3680 | 3680 | /** |
@@ -3686,71 +3686,71 @@ discard block |
||
3686 | 3686 | * @return array Array of mime types. |
3687 | 3687 | */ |
3688 | 3688 | function geodir_allowed_mime_types() { |
3689 | - /** |
|
3690 | - * Filter the list of mime types and file extensions allowed for file upload. |
|
3691 | - * |
|
3692 | - * @since 1.4.7 |
|
3693 | - * @package GeoDirectory |
|
3694 | - * |
|
3695 | - * @param array $geodir_allowed_mime_types and file extensions. |
|
3696 | - */ |
|
3697 | - return apply_filters( 'geodir_allowed_mime_types', array( |
|
3698 | - 'Image' => array( // Image formats. |
|
3699 | - 'jpg' => 'image/jpeg', |
|
3700 | - 'jpe' => 'image/jpeg', |
|
3701 | - 'jpeg' => 'image/jpeg', |
|
3702 | - 'gif' => 'image/gif', |
|
3703 | - 'png' => 'image/png', |
|
3704 | - 'bmp' => 'image/bmp', |
|
3705 | - 'ico' => 'image/x-icon', |
|
3706 | - ), |
|
3707 | - 'Video' => array( // Video formats. |
|
3708 | - 'asf' => 'video/x-ms-asf', |
|
3709 | - 'avi' => 'video/avi', |
|
3710 | - 'flv' => 'video/x-flv', |
|
3711 | - 'mkv' => 'video/x-matroska', |
|
3712 | - 'mp4' => 'video/mp4', |
|
3713 | - 'mpeg' => 'video/mpeg', |
|
3714 | - 'mpg' => 'video/mpeg', |
|
3715 | - 'wmv' => 'video/x-ms-wmv', |
|
3716 | - '3gp' => 'video/3gpp', |
|
3717 | - ), |
|
3718 | - 'Audio' => array( // Audio formats. |
|
3719 | - 'ogg' => 'audio/ogg', |
|
3720 | - 'mp3' => 'audio/mpeg', |
|
3721 | - 'wav' => 'audio/wav', |
|
3722 | - 'wma' => 'audio/x-ms-wma', |
|
3723 | - ), |
|
3724 | - 'Text' => array( // Text formats. |
|
3725 | - 'css' => 'text/css', |
|
3726 | - 'csv' => 'text/csv', |
|
3727 | - 'htm' => 'text/html', |
|
3728 | - 'html' => 'text/html', |
|
3729 | - 'txt' => 'text/plain', |
|
3730 | - 'rtx' => 'text/richtext', |
|
3731 | - 'vtt' => 'text/vtt', |
|
3732 | - ), |
|
3733 | - 'Application' => array( // Application formats. |
|
3734 | - 'doc' => 'application/msword', |
|
3735 | - 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', |
|
3736 | - 'exe' => 'application/x-msdownload', |
|
3737 | - 'js' => 'application/javascript', |
|
3738 | - 'odt' => 'application/vnd.oasis.opendocument.text', |
|
3739 | - 'pdf' => 'application/pdf', |
|
3740 | - 'pot' => 'application/vnd.ms-powerpoint', |
|
3741 | - 'ppt' => 'application/vnd.ms-powerpoint', |
|
3742 | - 'pptx' => 'application/vnd.ms-powerpoint', |
|
3743 | - 'psd' => 'application/octet-stream', |
|
3744 | - 'rar' => 'application/rar', |
|
3745 | - 'rtf' => 'application/rtf', |
|
3746 | - 'swf' => 'application/x-shockwave-flash', |
|
3747 | - 'tar' => 'application/x-tar', |
|
3748 | - 'xls' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', |
|
3749 | - 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', |
|
3750 | - 'zip' => 'application/zip', |
|
3751 | - ) |
|
3752 | - ) |
|
3753 | - ); |
|
3689 | + /** |
|
3690 | + * Filter the list of mime types and file extensions allowed for file upload. |
|
3691 | + * |
|
3692 | + * @since 1.4.7 |
|
3693 | + * @package GeoDirectory |
|
3694 | + * |
|
3695 | + * @param array $geodir_allowed_mime_types and file extensions. |
|
3696 | + */ |
|
3697 | + return apply_filters( 'geodir_allowed_mime_types', array( |
|
3698 | + 'Image' => array( // Image formats. |
|
3699 | + 'jpg' => 'image/jpeg', |
|
3700 | + 'jpe' => 'image/jpeg', |
|
3701 | + 'jpeg' => 'image/jpeg', |
|
3702 | + 'gif' => 'image/gif', |
|
3703 | + 'png' => 'image/png', |
|
3704 | + 'bmp' => 'image/bmp', |
|
3705 | + 'ico' => 'image/x-icon', |
|
3706 | + ), |
|
3707 | + 'Video' => array( // Video formats. |
|
3708 | + 'asf' => 'video/x-ms-asf', |
|
3709 | + 'avi' => 'video/avi', |
|
3710 | + 'flv' => 'video/x-flv', |
|
3711 | + 'mkv' => 'video/x-matroska', |
|
3712 | + 'mp4' => 'video/mp4', |
|
3713 | + 'mpeg' => 'video/mpeg', |
|
3714 | + 'mpg' => 'video/mpeg', |
|
3715 | + 'wmv' => 'video/x-ms-wmv', |
|
3716 | + '3gp' => 'video/3gpp', |
|
3717 | + ), |
|
3718 | + 'Audio' => array( // Audio formats. |
|
3719 | + 'ogg' => 'audio/ogg', |
|
3720 | + 'mp3' => 'audio/mpeg', |
|
3721 | + 'wav' => 'audio/wav', |
|
3722 | + 'wma' => 'audio/x-ms-wma', |
|
3723 | + ), |
|
3724 | + 'Text' => array( // Text formats. |
|
3725 | + 'css' => 'text/css', |
|
3726 | + 'csv' => 'text/csv', |
|
3727 | + 'htm' => 'text/html', |
|
3728 | + 'html' => 'text/html', |
|
3729 | + 'txt' => 'text/plain', |
|
3730 | + 'rtx' => 'text/richtext', |
|
3731 | + 'vtt' => 'text/vtt', |
|
3732 | + ), |
|
3733 | + 'Application' => array( // Application formats. |
|
3734 | + 'doc' => 'application/msword', |
|
3735 | + 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', |
|
3736 | + 'exe' => 'application/x-msdownload', |
|
3737 | + 'js' => 'application/javascript', |
|
3738 | + 'odt' => 'application/vnd.oasis.opendocument.text', |
|
3739 | + 'pdf' => 'application/pdf', |
|
3740 | + 'pot' => 'application/vnd.ms-powerpoint', |
|
3741 | + 'ppt' => 'application/vnd.ms-powerpoint', |
|
3742 | + 'pptx' => 'application/vnd.ms-powerpoint', |
|
3743 | + 'psd' => 'application/octet-stream', |
|
3744 | + 'rar' => 'application/rar', |
|
3745 | + 'rtf' => 'application/rtf', |
|
3746 | + 'swf' => 'application/x-shockwave-flash', |
|
3747 | + 'tar' => 'application/x-tar', |
|
3748 | + 'xls' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', |
|
3749 | + 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', |
|
3750 | + 'zip' => 'application/zip', |
|
3751 | + ) |
|
3752 | + ) |
|
3753 | + ); |
|
3754 | 3754 | } |
3755 | 3755 | |
3756 | 3756 | /** |
@@ -3762,21 +3762,21 @@ discard block |
||
3762 | 3762 | * @return string User display name. |
3763 | 3763 | */ |
3764 | 3764 | function geodir_get_client_name($user_id) { |
3765 | - $client_name = ''; |
|
3765 | + $client_name = ''; |
|
3766 | 3766 | |
3767 | - $user_data = get_userdata($user_id); |
|
3767 | + $user_data = get_userdata($user_id); |
|
3768 | 3768 | |
3769 | - if (!empty($user_data)) { |
|
3770 | - if (isset($user_data->display_name) && trim($user_data->display_name) != '') { |
|
3771 | - $client_name = trim($user_data->display_name); |
|
3772 | - } else if (isset($user_data->user_nicename) && trim($user_data->user_nicename) != '') { |
|
3773 | - $client_name = trim($user_data->user_nicename); |
|
3774 | - } else { |
|
3775 | - $client_name = trim($user_data->user_login); |
|
3776 | - } |
|
3777 | - } |
|
3769 | + if (!empty($user_data)) { |
|
3770 | + if (isset($user_data->display_name) && trim($user_data->display_name) != '') { |
|
3771 | + $client_name = trim($user_data->display_name); |
|
3772 | + } else if (isset($user_data->user_nicename) && trim($user_data->user_nicename) != '') { |
|
3773 | + $client_name = trim($user_data->user_nicename); |
|
3774 | + } else { |
|
3775 | + $client_name = trim($user_data->user_login); |
|
3776 | + } |
|
3777 | + } |
|
3778 | 3778 | |
3779 | - return $client_name; |
|
3779 | + return $client_name; |
|
3780 | 3780 | } |
3781 | 3781 | |
3782 | 3782 | |
@@ -3791,125 +3791,125 @@ discard block |
||
3791 | 3791 | */ |
3792 | 3792 | function geodir_wpseo_replacements($vars){ |
3793 | 3793 | |
3794 | - global $wp; |
|
3795 | - $title = ''; |
|
3796 | - // location variables |
|
3797 | - $gd_post_type = geodir_get_current_posttype(); |
|
3798 | - $location_array = geodir_get_current_location_terms('query_vars', $gd_post_type); |
|
3799 | - /** |
|
3800 | - * Filter the title variables location variables array |
|
3801 | - * |
|
3802 | - * @since 1.5.5 |
|
3803 | - * @package GeoDirectory |
|
3804 | - * @param array $location_array The array of location variables. |
|
3805 | - * @param array $vars The page title variables. |
|
3806 | - */ |
|
3807 | - $location_array = apply_filters('geodir_filter_title_variables_location_arr_seo',$location_array, $vars); |
|
3808 | - $location_titles = array(); |
|
3809 | - if(get_query_var( 'gd_country_full' )){ |
|
3810 | - if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );} |
|
3811 | - if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );} |
|
3812 | - if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );} |
|
3813 | - } |
|
3814 | - $location_single = ''; |
|
3815 | - $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : ''; |
|
3816 | - $gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : ''; |
|
3817 | - $gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : ''; |
|
3818 | - |
|
3819 | - $gd_country_actual = $gd_region_actual = $gd_city_actual = ''; |
|
3820 | - |
|
3821 | - if (function_exists('get_actual_location_name')) { |
|
3822 | - $gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country; |
|
3823 | - $gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region; |
|
3824 | - $gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city; |
|
3825 | - } |
|
3826 | - |
|
3827 | - if ($gd_city != '') { |
|
3828 | - if ($gd_city_actual != '') { |
|
3829 | - $gd_city = $gd_city_actual; |
|
3830 | - } else { |
|
3831 | - $gd_city = preg_replace('/-(\d+)$/', '', $gd_city); |
|
3832 | - $gd_city = preg_replace('/[_-]/', ' ', $gd_city); |
|
3833 | - $gd_city = __(geodir_ucwords($gd_city), 'geodirectory'); |
|
3834 | - } |
|
3835 | - $location_single = $gd_city; |
|
3836 | - |
|
3837 | - } else if ($gd_region != '') { |
|
3838 | - if ($gd_region_actual != '') { |
|
3839 | - $gd_region = $gd_region_actual; |
|
3840 | - } else { |
|
3841 | - $gd_region = preg_replace('/-(\d+)$/', '', $gd_region); |
|
3842 | - $gd_region = preg_replace('/[_-]/', ' ', $gd_region); |
|
3843 | - $gd_region = __(geodir_ucwords($gd_region), 'geodirectory'); |
|
3844 | - } |
|
3845 | - |
|
3846 | - $location_single = $gd_region; |
|
3847 | - } else if ($gd_country != '') { |
|
3848 | - if ($gd_country_actual != '') { |
|
3849 | - $gd_country = $gd_country_actual; |
|
3850 | - } else { |
|
3851 | - $gd_country = preg_replace('/-(\d+)$/', '', $gd_country); |
|
3852 | - $gd_country = preg_replace('/[_-]/', ' ', $gd_country); |
|
3853 | - $gd_country = __(geodir_ucwords($gd_country), 'geodirectory'); |
|
3854 | - } |
|
3855 | - |
|
3856 | - $location_single = $gd_country; |
|
3857 | - } |
|
3858 | - |
|
3859 | - if (!empty($location_array)) { |
|
3860 | - |
|
3861 | - $actual_location_name = function_exists('get_actual_location_name') ? true : false; |
|
3862 | - $location_array = array_reverse($location_array); |
|
3863 | - |
|
3864 | - foreach ($location_array as $location_type => $location) { |
|
3865 | - $gd_location_link_text = preg_replace('/-(\d+)$/', '', $location); |
|
3866 | - $gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text); |
|
3867 | - |
|
3868 | - $location_name = geodir_ucwords($gd_location_link_text); |
|
3869 | - $location_name = __($location_name, 'geodirectory'); |
|
3870 | - |
|
3871 | - if ($actual_location_name) { |
|
3872 | - $location_type = strpos($location_type, 'gd_') === 0 ? substr($location_type, 3) : $location_type; |
|
3873 | - $location_name = get_actual_location_name($location_type, $location, true); |
|
3874 | - } |
|
3875 | - |
|
3876 | - $location_titles[] = $location_name; |
|
3877 | - } |
|
3878 | - if (!empty($location_titles)) { |
|
3879 | - $location_titles = array_unique($location_titles); |
|
3880 | - } |
|
3881 | - } |
|
3882 | - |
|
3883 | - |
|
3884 | - if(!empty($location_titles)) { |
|
3885 | - $vars['%%location%%'] = implode(", ", $location_titles); |
|
3886 | - } |
|
3887 | - |
|
3888 | - |
|
3889 | - if(!empty($location_titles)) { |
|
3890 | - $vars['%%in_location%%'] = __('in ', 'geodirectory') . implode(", ", $location_titles); |
|
3891 | - } |
|
3892 | - |
|
3893 | - |
|
3894 | - |
|
3895 | - if($location_single) { |
|
3896 | - $vars['%%in_location_single%%'] = __('in', 'geodirectory') . ' ' .$location_single; |
|
3897 | - } |
|
3898 | - |
|
3899 | - |
|
3900 | - if($location_single) { |
|
3901 | - $vars['%%location_single%%'] = $location_single; |
|
3902 | - } |
|
3903 | - |
|
3904 | - /** |
|
3905 | - * Filter the title variables after standard ones have been filtered for wpseo. |
|
3906 | - * |
|
3907 | - * @since 1.5.7 |
|
3908 | - * @package GeoDirectory |
|
3909 | - * @param string $vars The title with variables. |
|
3910 | - * @param array $location_array The array of location variables. |
|
3911 | - */ |
|
3912 | - return apply_filters('geodir_wpseo_replacements_vars',$vars,$location_array); |
|
3794 | + global $wp; |
|
3795 | + $title = ''; |
|
3796 | + // location variables |
|
3797 | + $gd_post_type = geodir_get_current_posttype(); |
|
3798 | + $location_array = geodir_get_current_location_terms('query_vars', $gd_post_type); |
|
3799 | + /** |
|
3800 | + * Filter the title variables location variables array |
|
3801 | + * |
|
3802 | + * @since 1.5.5 |
|
3803 | + * @package GeoDirectory |
|
3804 | + * @param array $location_array The array of location variables. |
|
3805 | + * @param array $vars The page title variables. |
|
3806 | + */ |
|
3807 | + $location_array = apply_filters('geodir_filter_title_variables_location_arr_seo',$location_array, $vars); |
|
3808 | + $location_titles = array(); |
|
3809 | + if(get_query_var( 'gd_country_full' )){ |
|
3810 | + if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );} |
|
3811 | + if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );} |
|
3812 | + if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );} |
|
3813 | + } |
|
3814 | + $location_single = ''; |
|
3815 | + $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : ''; |
|
3816 | + $gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : ''; |
|
3817 | + $gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : ''; |
|
3818 | + |
|
3819 | + $gd_country_actual = $gd_region_actual = $gd_city_actual = ''; |
|
3820 | + |
|
3821 | + if (function_exists('get_actual_location_name')) { |
|
3822 | + $gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country; |
|
3823 | + $gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region; |
|
3824 | + $gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city; |
|
3825 | + } |
|
3826 | + |
|
3827 | + if ($gd_city != '') { |
|
3828 | + if ($gd_city_actual != '') { |
|
3829 | + $gd_city = $gd_city_actual; |
|
3830 | + } else { |
|
3831 | + $gd_city = preg_replace('/-(\d+)$/', '', $gd_city); |
|
3832 | + $gd_city = preg_replace('/[_-]/', ' ', $gd_city); |
|
3833 | + $gd_city = __(geodir_ucwords($gd_city), 'geodirectory'); |
|
3834 | + } |
|
3835 | + $location_single = $gd_city; |
|
3836 | + |
|
3837 | + } else if ($gd_region != '') { |
|
3838 | + if ($gd_region_actual != '') { |
|
3839 | + $gd_region = $gd_region_actual; |
|
3840 | + } else { |
|
3841 | + $gd_region = preg_replace('/-(\d+)$/', '', $gd_region); |
|
3842 | + $gd_region = preg_replace('/[_-]/', ' ', $gd_region); |
|
3843 | + $gd_region = __(geodir_ucwords($gd_region), 'geodirectory'); |
|
3844 | + } |
|
3845 | + |
|
3846 | + $location_single = $gd_region; |
|
3847 | + } else if ($gd_country != '') { |
|
3848 | + if ($gd_country_actual != '') { |
|
3849 | + $gd_country = $gd_country_actual; |
|
3850 | + } else { |
|
3851 | + $gd_country = preg_replace('/-(\d+)$/', '', $gd_country); |
|
3852 | + $gd_country = preg_replace('/[_-]/', ' ', $gd_country); |
|
3853 | + $gd_country = __(geodir_ucwords($gd_country), 'geodirectory'); |
|
3854 | + } |
|
3855 | + |
|
3856 | + $location_single = $gd_country; |
|
3857 | + } |
|
3858 | + |
|
3859 | + if (!empty($location_array)) { |
|
3860 | + |
|
3861 | + $actual_location_name = function_exists('get_actual_location_name') ? true : false; |
|
3862 | + $location_array = array_reverse($location_array); |
|
3863 | + |
|
3864 | + foreach ($location_array as $location_type => $location) { |
|
3865 | + $gd_location_link_text = preg_replace('/-(\d+)$/', '', $location); |
|
3866 | + $gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text); |
|
3867 | + |
|
3868 | + $location_name = geodir_ucwords($gd_location_link_text); |
|
3869 | + $location_name = __($location_name, 'geodirectory'); |
|
3870 | + |
|
3871 | + if ($actual_location_name) { |
|
3872 | + $location_type = strpos($location_type, 'gd_') === 0 ? substr($location_type, 3) : $location_type; |
|
3873 | + $location_name = get_actual_location_name($location_type, $location, true); |
|
3874 | + } |
|
3875 | + |
|
3876 | + $location_titles[] = $location_name; |
|
3877 | + } |
|
3878 | + if (!empty($location_titles)) { |
|
3879 | + $location_titles = array_unique($location_titles); |
|
3880 | + } |
|
3881 | + } |
|
3882 | + |
|
3883 | + |
|
3884 | + if(!empty($location_titles)) { |
|
3885 | + $vars['%%location%%'] = implode(", ", $location_titles); |
|
3886 | + } |
|
3887 | + |
|
3888 | + |
|
3889 | + if(!empty($location_titles)) { |
|
3890 | + $vars['%%in_location%%'] = __('in ', 'geodirectory') . implode(", ", $location_titles); |
|
3891 | + } |
|
3892 | + |
|
3893 | + |
|
3894 | + |
|
3895 | + if($location_single) { |
|
3896 | + $vars['%%in_location_single%%'] = __('in', 'geodirectory') . ' ' .$location_single; |
|
3897 | + } |
|
3898 | + |
|
3899 | + |
|
3900 | + if($location_single) { |
|
3901 | + $vars['%%location_single%%'] = $location_single; |
|
3902 | + } |
|
3903 | + |
|
3904 | + /** |
|
3905 | + * Filter the title variables after standard ones have been filtered for wpseo. |
|
3906 | + * |
|
3907 | + * @since 1.5.7 |
|
3908 | + * @package GeoDirectory |
|
3909 | + * @param string $vars The title with variables. |
|
3910 | + * @param array $location_array The array of location variables. |
|
3911 | + */ |
|
3912 | + return apply_filters('geodir_wpseo_replacements_vars',$vars,$location_array); |
|
3913 | 3913 | } |
3914 | 3914 | |
3915 | 3915 | |
@@ -3919,10 +3919,10 @@ discard block |
||
3919 | 3919 | function geodir_filter_title_variables($title, $gd_page, $sep=''){ |
3920 | 3920 | |
3921 | 3921 | |
3922 | - if(!$gd_page || !$title){return $title;}// if no a GD page then bail. |
|
3923 | - global $post; |
|
3924 | - //print_r($post); |
|
3925 | - /* |
|
3922 | + if(!$gd_page || !$title){return $title;}// if no a GD page then bail. |
|
3923 | + global $post; |
|
3924 | + //print_r($post); |
|
3925 | + /* |
|
3926 | 3926 | %%date%% Replaced with the date of the post/page |
3927 | 3927 | %%title%% Replaced with the title of the post/page |
3928 | 3928 | %%sitename%% The site's name |
@@ -3949,314 +3949,314 @@ discard block |
||
3949 | 3949 | %%pagenumber%% Replaced with the current page number |
3950 | 3950 | */ |
3951 | 3951 | |
3952 | - if ($sep == '') { |
|
3953 | - /** |
|
3954 | - * Filter the page title separator. |
|
3955 | - * |
|
3956 | - * @since 1.0.0 |
|
3957 | - * @package GeoDirectory |
|
3958 | - * @param string $sep The separator, default: `|`. |
|
3959 | - */ |
|
3960 | - $sep = apply_filters('geodir_page_title_separator', '|'); |
|
3961 | - } |
|
3962 | - |
|
3963 | - |
|
3964 | - if(strpos($title,'%%title%%') !== false){ |
|
3965 | - $title = str_replace("%%title%%",$post->post_title,$title); |
|
3966 | - } |
|
3967 | - |
|
3968 | - if(strpos($title,'%%sitename%%') !== false){ |
|
3969 | - $title = str_replace("%%sitename%%",get_bloginfo('name'),$title); |
|
3970 | - } |
|
3971 | - |
|
3972 | - if(strpos($title,'%%sitedesc%%') !== false){ |
|
3973 | - $title = str_replace("%%sitedesc%%",get_bloginfo('description'),$title); |
|
3974 | - } |
|
3975 | - |
|
3976 | - if(strpos($title,'%%excerpt%%') !== false){ |
|
3977 | - $title = str_replace("%%excerpt%%",strip_tags(get_the_excerpt()),$title); |
|
3978 | - } |
|
3979 | - |
|
3980 | - if(strpos($title,'%%pt_single%%') !== false){ |
|
3981 | - $single_name = ''; |
|
3982 | - if($gd_page=='search' || $gd_page=='author'){ |
|
3983 | - $geodir_post_types = get_option('geodir_post_types'); |
|
3984 | - $spt = esc_attr($_REQUEST['stype']); |
|
3985 | - if(isset($geodir_post_types[$spt]['labels']['singular_name'])){ |
|
3986 | - $single_name = __($geodir_post_types[$spt]['labels']['singular_name'],'geodirectory'); |
|
3987 | - } |
|
3988 | - }elseif($gd_page=='add-listing'){ |
|
3989 | - $geodir_post_types = get_option('geodir_post_types'); |
|
3990 | - $spt = isset($_REQUEST['listing_type']) ? esc_attr($_REQUEST['listing_type']) : ''; |
|
3991 | - if(!$spt && isset($_REQUEST['pid'])){ |
|
3992 | - $spt = get_post_type( $_REQUEST['pid'] ); |
|
3993 | - } |
|
3994 | - if(!$spt){$spt='gd_place';} |
|
3995 | - if(isset($geodir_post_types[$spt]['labels']['singular_name'])){ |
|
3996 | - $single_name = __($geodir_post_types[$spt]['labels']['singular_name'],'geodirectory'); |
|
3997 | - } |
|
3998 | - } |
|
3999 | - elseif($post->post_type){ |
|
4000 | - $geodir_post_types = get_option('geodir_post_types'); |
|
4001 | - if(isset($geodir_post_types[$post->post_type]['labels']['singular_name'])){ |
|
4002 | - $single_name = __($geodir_post_types[$post->post_type]['labels']['singular_name'],'geodirectory'); |
|
4003 | - } |
|
4004 | - |
|
4005 | - |
|
4006 | - } |
|
4007 | - $title = str_replace("%%pt_single%%",$single_name,$title); |
|
4008 | - } |
|
4009 | - |
|
4010 | - if(strpos($title,'%%pt_plural%%') !== false){ |
|
4011 | - $plural_name = ''; |
|
4012 | - if($gd_page=='search' || $gd_page=='author'){ |
|
4013 | - $geodir_post_types = get_option('geodir_post_types'); |
|
4014 | - $spt = esc_attr($_REQUEST['stype']); |
|
4015 | - if(isset($geodir_post_types[$spt]['labels']['name'])){ |
|
4016 | - $plural_name = __($geodir_post_types[$spt]['labels']['name'],'geodirectory'); |
|
4017 | - } |
|
4018 | - }elseif($gd_page=='add-listing'){ |
|
4019 | - $geodir_post_types = get_option('geodir_post_types'); |
|
4020 | - $spt = sanitize_text_field($_REQUEST['listing_type']); |
|
4021 | - if(!$spt){$spt='gd_place';} |
|
4022 | - if(isset($geodir_post_types[$spt]['labels']['name'])){ |
|
4023 | - $plural_name = __($geodir_post_types[$spt]['labels']['name'],'geodirectory'); |
|
4024 | - } |
|
4025 | - } |
|
4026 | - elseif(isset($post->post_type) && $post->post_type){ |
|
4027 | - $geodir_post_types = get_option('geodir_post_types'); |
|
4028 | - if(isset($geodir_post_types[$post->post_type]['labels']['name'])){ |
|
4029 | - $plural_name = __($geodir_post_types[$post->post_type]['labels']['name'],'geodirectory'); |
|
4030 | - } |
|
4031 | - |
|
4032 | - } |
|
4033 | - $title = str_replace("%%pt_plural%%",$plural_name,$title); |
|
4034 | - } |
|
4035 | - |
|
4036 | - |
|
4037 | - |
|
4038 | - if(strpos($title,'%%category%%') !== false){ |
|
4039 | - $cat_name = ''; |
|
4040 | - |
|
4041 | - if($gd_page=='detail') { |
|
4042 | - if ($post->default_category) { |
|
4043 | - $cat = get_term($post->default_category, $post->post_type . 'category'); |
|
4044 | - $cat_name = (isset($cat->name)) ? $cat->name : ''; |
|
4045 | - } |
|
4046 | - }elseif($gd_page=='listing'){ |
|
4047 | - $queried_object = get_queried_object(); |
|
4048 | - if(isset($queried_object->name)){ |
|
4049 | - $cat_name = $queried_object->name; |
|
4050 | - } |
|
4051 | - } |
|
4052 | - $title = str_replace("%%category%%",$cat_name,$title); |
|
4053 | - } |
|
4054 | - |
|
4055 | - if(strpos($title,'%%tag%%') !== false){ |
|
4056 | - $cat_name = ''; |
|
4057 | - |
|
4058 | - if($gd_page=='detail') { |
|
4059 | - if ($post->default_category) { |
|
4060 | - $cat = get_term($post->default_category, $post->post_type . 'category'); |
|
4061 | - $cat_name = (isset($cat->name)) ? $cat->name : ''; |
|
4062 | - } |
|
4063 | - }elseif($gd_page=='listing'){ |
|
4064 | - $queried_object = get_queried_object(); |
|
4065 | - if(isset($queried_object->name)){ |
|
4066 | - $cat_name = $queried_object->name; |
|
4067 | - } |
|
4068 | - } |
|
4069 | - $title = str_replace("%%tag%%",$cat_name,$title); |
|
4070 | - } |
|
4071 | - |
|
4072 | - |
|
4073 | - |
|
4074 | - if(strpos($title,'%%id%%') !== false){ |
|
4075 | - $ID = (isset($post->ID)) ? $post->ID : ''; |
|
4076 | - $title = str_replace("%%id%%",$ID,$title); |
|
4077 | - } |
|
4078 | - |
|
4079 | - if(strpos($title,'%%sep%%') !== false){ |
|
4080 | - $title = str_replace("%%sep%%",$sep,$title); |
|
4081 | - } |
|
4082 | - |
|
4083 | - |
|
4084 | - global $wp; |
|
4085 | - // location variables |
|
4086 | - $gd_post_type = geodir_get_current_posttype(); |
|
4087 | - $location_array = geodir_get_current_location_terms('query_vars', $gd_post_type); |
|
4088 | - /** |
|
4089 | - * Filter the title variables location variables array |
|
4090 | - * |
|
4091 | - * @since 1.5.5 |
|
4092 | - * @package GeoDirectory |
|
4093 | - * @param array $location_array The array of location variables. |
|
4094 | - * @param string $title The title with variables.. |
|
4095 | - * @param string $gd_page The page being filtered. |
|
4096 | - * @param string $sep The separator, default: `|`. |
|
4097 | - */ |
|
4098 | - $location_array = apply_filters('geodir_filter_title_variables_location_arr',$location_array,$title, $gd_page, $sep); |
|
4099 | - $location_titles = array(); |
|
4100 | - if($gd_page=='location' && get_query_var( 'gd_country_full' )){ |
|
4101 | - if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );} |
|
4102 | - if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );} |
|
4103 | - if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );} |
|
4104 | - } |
|
4105 | - $location_single = ''; |
|
4106 | - $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : ''; |
|
4107 | - $gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : ''; |
|
4108 | - $gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : ''; |
|
4109 | - |
|
4110 | - $gd_country_actual = $gd_region_actual = $gd_city_actual = ''; |
|
4111 | - |
|
4112 | - if (function_exists('get_actual_location_name')) { |
|
4113 | - $gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country; |
|
4114 | - $gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region; |
|
4115 | - $gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city; |
|
4116 | - } |
|
4117 | - |
|
4118 | - if ($gd_city != '') { |
|
4119 | - if ($gd_city_actual != '') { |
|
4120 | - $gd_city = $gd_city_actual; |
|
4121 | - } else { |
|
4122 | - $gd_city = preg_replace('/-(\d+)$/', '', $gd_city); |
|
4123 | - $gd_city = preg_replace('/[_-]/', ' ', $gd_city); |
|
4124 | - $gd_city = __(geodir_ucwords($gd_city), 'geodirectory'); |
|
4125 | - } |
|
4126 | - $location_single = $gd_city; |
|
4127 | - |
|
4128 | - } else if ($gd_region != '') { |
|
4129 | - if ($gd_region_actual != '') { |
|
4130 | - $gd_region = $gd_region_actual; |
|
4131 | - } else { |
|
4132 | - $gd_region = preg_replace('/-(\d+)$/', '', $gd_region); |
|
4133 | - $gd_region = preg_replace('/[_-]/', ' ', $gd_region); |
|
4134 | - $gd_region = __(geodir_ucwords($gd_region), 'geodirectory'); |
|
4135 | - } |
|
4136 | - |
|
4137 | - $location_single = $gd_region; |
|
4138 | - } else if ($gd_country != '') { |
|
4139 | - if ($gd_country_actual != '') { |
|
4140 | - $gd_country = $gd_country_actual; |
|
4141 | - } else { |
|
4142 | - $gd_country = preg_replace('/-(\d+)$/', '', $gd_country); |
|
4143 | - $gd_country = preg_replace('/[_-]/', ' ', $gd_country); |
|
4144 | - $gd_country = __(geodir_ucwords($gd_country), 'geodirectory'); |
|
4145 | - } |
|
4146 | - |
|
4147 | - $location_single = $gd_country; |
|
4148 | - } |
|
4149 | - |
|
4150 | - if (!empty($location_array)) { |
|
4151 | - |
|
4152 | - $actual_location_name = function_exists('get_actual_location_name') ? true : false; |
|
4153 | - $location_array = array_reverse($location_array); |
|
4154 | - |
|
4155 | - foreach ($location_array as $location_type => $location) { |
|
4156 | - $gd_location_link_text = preg_replace('/-(\d+)$/', '', $location); |
|
4157 | - $gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text); |
|
4158 | - |
|
4159 | - $location_name = geodir_ucwords($gd_location_link_text); |
|
4160 | - $location_name = __($location_name, 'geodirectory'); |
|
4161 | - |
|
4162 | - if ($actual_location_name) { |
|
4163 | - $location_type = strpos($location_type, 'gd_') === 0 ? substr($location_type, 3) : $location_type; |
|
4164 | - $location_name = get_actual_location_name($location_type, $location, true); |
|
4165 | - } |
|
4166 | - |
|
4167 | - $location_titles[] = $location_name; |
|
4168 | - } |
|
4169 | - if (!empty($location_titles)) { |
|
4170 | - $location_titles = array_unique($location_titles); |
|
4171 | - } |
|
4172 | - } |
|
4173 | - |
|
4174 | - |
|
4175 | - if(strpos($title,'%%location%%') !== false){ |
|
4176 | - $location = ''; |
|
4177 | - if($location_titles) { |
|
4178 | - $location = implode(", ", $location_titles); |
|
4179 | - } |
|
4180 | - $title = str_replace("%%location%%",$location,$title); |
|
4181 | - } |
|
4182 | - |
|
4183 | - if(strpos($title,'%%in_location%%') !== false){ |
|
4184 | - $location = ''; |
|
4185 | - if($location_titles) { |
|
4186 | - $location = __('in ', 'geodirectory') . implode(", ", $location_titles); |
|
4187 | - } |
|
4188 | - $title = str_replace("%%in_location%%",$location,$title); |
|
4189 | - } |
|
4190 | - |
|
4191 | - if(strpos($title,'%%in_location_single%%') !== false){ |
|
4192 | - if($location_single) { |
|
4193 | - $location_single = __('in', 'geodirectory') . ' ' .$location_single; |
|
4194 | - } |
|
4195 | - $title = str_replace("%%in_location_single%%",$location_single,$title); |
|
4196 | - } |
|
4197 | - |
|
4198 | - if(strpos($title,'%%location_single%%') !== false){ |
|
4199 | - $title = str_replace("%%location_single%%",$location_single,$title); |
|
4200 | - } |
|
4201 | - |
|
4202 | - |
|
4203 | - if(strpos($title,'%%search_term%%') !== false){ |
|
4204 | - $search_term = ''; |
|
4205 | - if(isset($_REQUEST['s'])){ |
|
4206 | - $search_term = esc_attr($_REQUEST['s']); |
|
4207 | - } |
|
4208 | - $title = str_replace("%%search_term%%",$search_term,$title); |
|
4209 | - } |
|
4210 | - |
|
4211 | - if(strpos($title,'%%search_near%%') !== false){ |
|
4212 | - $search_term = ''; |
|
4213 | - if(isset($_REQUEST['snear'])){ |
|
4214 | - $search_term = esc_attr($_REQUEST['snear']); |
|
4215 | - } |
|
4216 | - $title = str_replace("%%search_near%%",$search_term,$title); |
|
4217 | - } |
|
4218 | - |
|
4219 | - if(strpos($title,'%%name%%') !== false){ |
|
4220 | - $author_name = get_the_author(); |
|
4221 | - if (!$author_name || $author_name === '') { |
|
4222 | - $queried_object = get_queried_object(); |
|
3952 | + if ($sep == '') { |
|
3953 | + /** |
|
3954 | + * Filter the page title separator. |
|
3955 | + * |
|
3956 | + * @since 1.0.0 |
|
3957 | + * @package GeoDirectory |
|
3958 | + * @param string $sep The separator, default: `|`. |
|
3959 | + */ |
|
3960 | + $sep = apply_filters('geodir_page_title_separator', '|'); |
|
3961 | + } |
|
3962 | + |
|
3963 | + |
|
3964 | + if(strpos($title,'%%title%%') !== false){ |
|
3965 | + $title = str_replace("%%title%%",$post->post_title,$title); |
|
3966 | + } |
|
3967 | + |
|
3968 | + if(strpos($title,'%%sitename%%') !== false){ |
|
3969 | + $title = str_replace("%%sitename%%",get_bloginfo('name'),$title); |
|
3970 | + } |
|
3971 | + |
|
3972 | + if(strpos($title,'%%sitedesc%%') !== false){ |
|
3973 | + $title = str_replace("%%sitedesc%%",get_bloginfo('description'),$title); |
|
3974 | + } |
|
3975 | + |
|
3976 | + if(strpos($title,'%%excerpt%%') !== false){ |
|
3977 | + $title = str_replace("%%excerpt%%",strip_tags(get_the_excerpt()),$title); |
|
3978 | + } |
|
3979 | + |
|
3980 | + if(strpos($title,'%%pt_single%%') !== false){ |
|
3981 | + $single_name = ''; |
|
3982 | + if($gd_page=='search' || $gd_page=='author'){ |
|
3983 | + $geodir_post_types = get_option('geodir_post_types'); |
|
3984 | + $spt = esc_attr($_REQUEST['stype']); |
|
3985 | + if(isset($geodir_post_types[$spt]['labels']['singular_name'])){ |
|
3986 | + $single_name = __($geodir_post_types[$spt]['labels']['singular_name'],'geodirectory'); |
|
3987 | + } |
|
3988 | + }elseif($gd_page=='add-listing'){ |
|
3989 | + $geodir_post_types = get_option('geodir_post_types'); |
|
3990 | + $spt = isset($_REQUEST['listing_type']) ? esc_attr($_REQUEST['listing_type']) : ''; |
|
3991 | + if(!$spt && isset($_REQUEST['pid'])){ |
|
3992 | + $spt = get_post_type( $_REQUEST['pid'] ); |
|
3993 | + } |
|
3994 | + if(!$spt){$spt='gd_place';} |
|
3995 | + if(isset($geodir_post_types[$spt]['labels']['singular_name'])){ |
|
3996 | + $single_name = __($geodir_post_types[$spt]['labels']['singular_name'],'geodirectory'); |
|
3997 | + } |
|
3998 | + } |
|
3999 | + elseif($post->post_type){ |
|
4000 | + $geodir_post_types = get_option('geodir_post_types'); |
|
4001 | + if(isset($geodir_post_types[$post->post_type]['labels']['singular_name'])){ |
|
4002 | + $single_name = __($geodir_post_types[$post->post_type]['labels']['singular_name'],'geodirectory'); |
|
4003 | + } |
|
4004 | + |
|
4005 | + |
|
4006 | + } |
|
4007 | + $title = str_replace("%%pt_single%%",$single_name,$title); |
|
4008 | + } |
|
4009 | + |
|
4010 | + if(strpos($title,'%%pt_plural%%') !== false){ |
|
4011 | + $plural_name = ''; |
|
4012 | + if($gd_page=='search' || $gd_page=='author'){ |
|
4013 | + $geodir_post_types = get_option('geodir_post_types'); |
|
4014 | + $spt = esc_attr($_REQUEST['stype']); |
|
4015 | + if(isset($geodir_post_types[$spt]['labels']['name'])){ |
|
4016 | + $plural_name = __($geodir_post_types[$spt]['labels']['name'],'geodirectory'); |
|
4017 | + } |
|
4018 | + }elseif($gd_page=='add-listing'){ |
|
4019 | + $geodir_post_types = get_option('geodir_post_types'); |
|
4020 | + $spt = sanitize_text_field($_REQUEST['listing_type']); |
|
4021 | + if(!$spt){$spt='gd_place';} |
|
4022 | + if(isset($geodir_post_types[$spt]['labels']['name'])){ |
|
4023 | + $plural_name = __($geodir_post_types[$spt]['labels']['name'],'geodirectory'); |
|
4024 | + } |
|
4025 | + } |
|
4026 | + elseif(isset($post->post_type) && $post->post_type){ |
|
4027 | + $geodir_post_types = get_option('geodir_post_types'); |
|
4028 | + if(isset($geodir_post_types[$post->post_type]['labels']['name'])){ |
|
4029 | + $plural_name = __($geodir_post_types[$post->post_type]['labels']['name'],'geodirectory'); |
|
4030 | + } |
|
4031 | + |
|
4032 | + } |
|
4033 | + $title = str_replace("%%pt_plural%%",$plural_name,$title); |
|
4034 | + } |
|
4035 | + |
|
4036 | + |
|
4037 | + |
|
4038 | + if(strpos($title,'%%category%%') !== false){ |
|
4039 | + $cat_name = ''; |
|
4040 | + |
|
4041 | + if($gd_page=='detail') { |
|
4042 | + if ($post->default_category) { |
|
4043 | + $cat = get_term($post->default_category, $post->post_type . 'category'); |
|
4044 | + $cat_name = (isset($cat->name)) ? $cat->name : ''; |
|
4045 | + } |
|
4046 | + }elseif($gd_page=='listing'){ |
|
4047 | + $queried_object = get_queried_object(); |
|
4048 | + if(isset($queried_object->name)){ |
|
4049 | + $cat_name = $queried_object->name; |
|
4050 | + } |
|
4051 | + } |
|
4052 | + $title = str_replace("%%category%%",$cat_name,$title); |
|
4053 | + } |
|
4054 | + |
|
4055 | + if(strpos($title,'%%tag%%') !== false){ |
|
4056 | + $cat_name = ''; |
|
4057 | + |
|
4058 | + if($gd_page=='detail') { |
|
4059 | + if ($post->default_category) { |
|
4060 | + $cat = get_term($post->default_category, $post->post_type . 'category'); |
|
4061 | + $cat_name = (isset($cat->name)) ? $cat->name : ''; |
|
4062 | + } |
|
4063 | + }elseif($gd_page=='listing'){ |
|
4064 | + $queried_object = get_queried_object(); |
|
4065 | + if(isset($queried_object->name)){ |
|
4066 | + $cat_name = $queried_object->name; |
|
4067 | + } |
|
4068 | + } |
|
4069 | + $title = str_replace("%%tag%%",$cat_name,$title); |
|
4070 | + } |
|
4071 | + |
|
4072 | + |
|
4073 | + |
|
4074 | + if(strpos($title,'%%id%%') !== false){ |
|
4075 | + $ID = (isset($post->ID)) ? $post->ID : ''; |
|
4076 | + $title = str_replace("%%id%%",$ID,$title); |
|
4077 | + } |
|
4078 | + |
|
4079 | + if(strpos($title,'%%sep%%') !== false){ |
|
4080 | + $title = str_replace("%%sep%%",$sep,$title); |
|
4081 | + } |
|
4082 | + |
|
4083 | + |
|
4084 | + global $wp; |
|
4085 | + // location variables |
|
4086 | + $gd_post_type = geodir_get_current_posttype(); |
|
4087 | + $location_array = geodir_get_current_location_terms('query_vars', $gd_post_type); |
|
4088 | + /** |
|
4089 | + * Filter the title variables location variables array |
|
4090 | + * |
|
4091 | + * @since 1.5.5 |
|
4092 | + * @package GeoDirectory |
|
4093 | + * @param array $location_array The array of location variables. |
|
4094 | + * @param string $title The title with variables.. |
|
4095 | + * @param string $gd_page The page being filtered. |
|
4096 | + * @param string $sep The separator, default: `|`. |
|
4097 | + */ |
|
4098 | + $location_array = apply_filters('geodir_filter_title_variables_location_arr',$location_array,$title, $gd_page, $sep); |
|
4099 | + $location_titles = array(); |
|
4100 | + if($gd_page=='location' && get_query_var( 'gd_country_full' )){ |
|
4101 | + if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );} |
|
4102 | + if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );} |
|
4103 | + if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );} |
|
4104 | + } |
|
4105 | + $location_single = ''; |
|
4106 | + $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : ''; |
|
4107 | + $gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : ''; |
|
4108 | + $gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : ''; |
|
4109 | + |
|
4110 | + $gd_country_actual = $gd_region_actual = $gd_city_actual = ''; |
|
4111 | + |
|
4112 | + if (function_exists('get_actual_location_name')) { |
|
4113 | + $gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country; |
|
4114 | + $gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region; |
|
4115 | + $gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city; |
|
4116 | + } |
|
4117 | + |
|
4118 | + if ($gd_city != '') { |
|
4119 | + if ($gd_city_actual != '') { |
|
4120 | + $gd_city = $gd_city_actual; |
|
4121 | + } else { |
|
4122 | + $gd_city = preg_replace('/-(\d+)$/', '', $gd_city); |
|
4123 | + $gd_city = preg_replace('/[_-]/', ' ', $gd_city); |
|
4124 | + $gd_city = __(geodir_ucwords($gd_city), 'geodirectory'); |
|
4125 | + } |
|
4126 | + $location_single = $gd_city; |
|
4127 | + |
|
4128 | + } else if ($gd_region != '') { |
|
4129 | + if ($gd_region_actual != '') { |
|
4130 | + $gd_region = $gd_region_actual; |
|
4131 | + } else { |
|
4132 | + $gd_region = preg_replace('/-(\d+)$/', '', $gd_region); |
|
4133 | + $gd_region = preg_replace('/[_-]/', ' ', $gd_region); |
|
4134 | + $gd_region = __(geodir_ucwords($gd_region), 'geodirectory'); |
|
4135 | + } |
|
4136 | + |
|
4137 | + $location_single = $gd_region; |
|
4138 | + } else if ($gd_country != '') { |
|
4139 | + if ($gd_country_actual != '') { |
|
4140 | + $gd_country = $gd_country_actual; |
|
4141 | + } else { |
|
4142 | + $gd_country = preg_replace('/-(\d+)$/', '', $gd_country); |
|
4143 | + $gd_country = preg_replace('/[_-]/', ' ', $gd_country); |
|
4144 | + $gd_country = __(geodir_ucwords($gd_country), 'geodirectory'); |
|
4145 | + } |
|
4146 | + |
|
4147 | + $location_single = $gd_country; |
|
4148 | + } |
|
4149 | + |
|
4150 | + if (!empty($location_array)) { |
|
4151 | + |
|
4152 | + $actual_location_name = function_exists('get_actual_location_name') ? true : false; |
|
4153 | + $location_array = array_reverse($location_array); |
|
4154 | + |
|
4155 | + foreach ($location_array as $location_type => $location) { |
|
4156 | + $gd_location_link_text = preg_replace('/-(\d+)$/', '', $location); |
|
4157 | + $gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text); |
|
4158 | + |
|
4159 | + $location_name = geodir_ucwords($gd_location_link_text); |
|
4160 | + $location_name = __($location_name, 'geodirectory'); |
|
4161 | + |
|
4162 | + if ($actual_location_name) { |
|
4163 | + $location_type = strpos($location_type, 'gd_') === 0 ? substr($location_type, 3) : $location_type; |
|
4164 | + $location_name = get_actual_location_name($location_type, $location, true); |
|
4165 | + } |
|
4166 | + |
|
4167 | + $location_titles[] = $location_name; |
|
4168 | + } |
|
4169 | + if (!empty($location_titles)) { |
|
4170 | + $location_titles = array_unique($location_titles); |
|
4171 | + } |
|
4172 | + } |
|
4173 | + |
|
4174 | + |
|
4175 | + if(strpos($title,'%%location%%') !== false){ |
|
4176 | + $location = ''; |
|
4177 | + if($location_titles) { |
|
4178 | + $location = implode(", ", $location_titles); |
|
4179 | + } |
|
4180 | + $title = str_replace("%%location%%",$location,$title); |
|
4181 | + } |
|
4182 | + |
|
4183 | + if(strpos($title,'%%in_location%%') !== false){ |
|
4184 | + $location = ''; |
|
4185 | + if($location_titles) { |
|
4186 | + $location = __('in ', 'geodirectory') . implode(", ", $location_titles); |
|
4187 | + } |
|
4188 | + $title = str_replace("%%in_location%%",$location,$title); |
|
4189 | + } |
|
4190 | + |
|
4191 | + if(strpos($title,'%%in_location_single%%') !== false){ |
|
4192 | + if($location_single) { |
|
4193 | + $location_single = __('in', 'geodirectory') . ' ' .$location_single; |
|
4194 | + } |
|
4195 | + $title = str_replace("%%in_location_single%%",$location_single,$title); |
|
4196 | + } |
|
4197 | + |
|
4198 | + if(strpos($title,'%%location_single%%') !== false){ |
|
4199 | + $title = str_replace("%%location_single%%",$location_single,$title); |
|
4200 | + } |
|
4201 | + |
|
4202 | + |
|
4203 | + if(strpos($title,'%%search_term%%') !== false){ |
|
4204 | + $search_term = ''; |
|
4205 | + if(isset($_REQUEST['s'])){ |
|
4206 | + $search_term = esc_attr($_REQUEST['s']); |
|
4207 | + } |
|
4208 | + $title = str_replace("%%search_term%%",$search_term,$title); |
|
4209 | + } |
|
4210 | + |
|
4211 | + if(strpos($title,'%%search_near%%') !== false){ |
|
4212 | + $search_term = ''; |
|
4213 | + if(isset($_REQUEST['snear'])){ |
|
4214 | + $search_term = esc_attr($_REQUEST['snear']); |
|
4215 | + } |
|
4216 | + $title = str_replace("%%search_near%%",$search_term,$title); |
|
4217 | + } |
|
4218 | + |
|
4219 | + if(strpos($title,'%%name%%') !== false){ |
|
4220 | + $author_name = get_the_author(); |
|
4221 | + if (!$author_name || $author_name === '') { |
|
4222 | + $queried_object = get_queried_object(); |
|
4223 | 4223 | |
4224 | - if (isset($queried_object->data->user_nicename)) { |
|
4225 | - $author_name = $queried_object->data->user_nicename; |
|
4226 | - } |
|
4227 | - } |
|
4228 | - $title = str_replace("%%name%%", $author_name, $title); |
|
4229 | - } |
|
4224 | + if (isset($queried_object->data->user_nicename)) { |
|
4225 | + $author_name = $queried_object->data->user_nicename; |
|
4226 | + } |
|
4227 | + } |
|
4228 | + $title = str_replace("%%name%%", $author_name, $title); |
|
4229 | + } |
|
4230 | 4230 | |
4231 | - if (strpos($title, '%%page%%') !== false) { |
|
4232 | - $page = geodir_title_meta_page($sep); |
|
4233 | - $title = str_replace("%%page%%", $page, $title); |
|
4234 | - } |
|
4235 | - if (strpos($title, '%%pagenumber%%') !== false) { |
|
4236 | - $pagenumber = geodir_title_meta_pagenumber(); |
|
4237 | - $title = str_replace("%%pagenumber%%", $pagenumber, $title); |
|
4238 | - } |
|
4239 | - if (strpos($title, '%%pagetotal%%') !== false) { |
|
4240 | - $pagetotal = geodir_title_meta_pagetotal(); |
|
4241 | - $title = str_replace("%%pagetotal%%", $pagetotal, $title); |
|
4242 | - } |
|
4243 | - |
|
4244 | - $title = wptexturize( $title ); |
|
4245 | - $title = convert_chars( $title ); |
|
4246 | - $title = esc_html( $title ); |
|
4247 | - |
|
4248 | - /** |
|
4249 | - * Filter the title variables after standard ones have been filtered. |
|
4250 | - * |
|
4251 | - * @since 1.5.7 |
|
4252 | - * @package GeoDirectory |
|
4253 | - * @param string $title The title with variables. |
|
4254 | - * @param array $location_array The array of location variables. |
|
4255 | - * @param string $gd_page The page being filtered. |
|
4256 | - * @param string $sep The separator, default: `|`. |
|
4257 | - */ |
|
4231 | + if (strpos($title, '%%page%%') !== false) { |
|
4232 | + $page = geodir_title_meta_page($sep); |
|
4233 | + $title = str_replace("%%page%%", $page, $title); |
|
4234 | + } |
|
4235 | + if (strpos($title, '%%pagenumber%%') !== false) { |
|
4236 | + $pagenumber = geodir_title_meta_pagenumber(); |
|
4237 | + $title = str_replace("%%pagenumber%%", $pagenumber, $title); |
|
4238 | + } |
|
4239 | + if (strpos($title, '%%pagetotal%%') !== false) { |
|
4240 | + $pagetotal = geodir_title_meta_pagetotal(); |
|
4241 | + $title = str_replace("%%pagetotal%%", $pagetotal, $title); |
|
4242 | + } |
|
4258 | 4243 | |
4259 | - return apply_filters('geodir_filter_title_variables_vars',$title,$location_array, $gd_page, $sep); |
|
4244 | + $title = wptexturize( $title ); |
|
4245 | + $title = convert_chars( $title ); |
|
4246 | + $title = esc_html( $title ); |
|
4247 | + |
|
4248 | + /** |
|
4249 | + * Filter the title variables after standard ones have been filtered. |
|
4250 | + * |
|
4251 | + * @since 1.5.7 |
|
4252 | + * @package GeoDirectory |
|
4253 | + * @param string $title The title with variables. |
|
4254 | + * @param array $location_array The array of location variables. |
|
4255 | + * @param string $gd_page The page being filtered. |
|
4256 | + * @param string $sep The separator, default: `|`. |
|
4257 | + */ |
|
4258 | + |
|
4259 | + return apply_filters('geodir_filter_title_variables_vars',$title,$location_array, $gd_page, $sep); |
|
4260 | 4260 | } |
4261 | 4261 | |
4262 | 4262 | /** |
@@ -4269,65 +4269,65 @@ discard block |
||
4269 | 4269 | * @return array Translation texts. |
4270 | 4270 | */ |
4271 | 4271 | function geodir_load_cpt_text_translation($translation_texts = array()) { |
4272 | - $gd_post_types = geodir_get_posttypes('array'); |
|
4273 | - |
|
4274 | - if (!empty($gd_post_types)) { |
|
4275 | - foreach ($gd_post_types as $post_type => $cpt_info) { |
|
4276 | - $labels = isset($cpt_info['labels']) ? $cpt_info['labels'] : ''; |
|
4277 | - $description = isset($cpt_info['description']) ? $cpt_info['description'] : ''; |
|
4278 | - $seo = isset($cpt_info['seo']) ? $cpt_info['seo'] : ''; |
|
4279 | - |
|
4280 | - if (!empty($labels)) { |
|
4281 | - if ($labels['name'] != '' && !in_array($labels['name'], $translation_texts)) |
|
4282 | - $translation_texts[] = $labels['name']; |
|
4283 | - if ($labels['singular_name'] != '' && !in_array($labels['singular_name'], $translation_texts)) |
|
4284 | - $translation_texts[] = $labels['singular_name']; |
|
4285 | - if ($labels['add_new'] != '' && !in_array($labels['add_new'], $translation_texts)) |
|
4286 | - $translation_texts[] = $labels['add_new']; |
|
4287 | - if ($labels['add_new_item'] != '' && !in_array($labels['add_new_item'], $translation_texts)) |
|
4288 | - $translation_texts[] = $labels['add_new_item']; |
|
4289 | - if ($labels['edit_item'] != '' && !in_array($labels['edit_item'], $translation_texts)) |
|
4290 | - $translation_texts[] = $labels['edit_item']; |
|
4291 | - if ($labels['new_item'] != '' && !in_array($labels['new_item'], $translation_texts)) |
|
4292 | - $translation_texts[] = $labels['new_item']; |
|
4293 | - if ($labels['view_item'] != '' && !in_array($labels['view_item'], $translation_texts)) |
|
4294 | - $translation_texts[] = $labels['view_item']; |
|
4295 | - if ($labels['search_items'] != '' && !in_array($labels['search_items'], $translation_texts)) |
|
4296 | - $translation_texts[] = $labels['search_items']; |
|
4297 | - if ($labels['not_found'] != '' && !in_array($labels['not_found'], $translation_texts)) |
|
4298 | - $translation_texts[] = $labels['not_found']; |
|
4299 | - if ($labels['not_found_in_trash'] != '' && !in_array($labels['not_found_in_trash'], $translation_texts)) |
|
4300 | - $translation_texts[] = $labels['not_found_in_trash']; |
|
4301 | - if (isset($labels['label_post_profile']) && $labels['label_post_profile'] != '' && !in_array($labels['label_post_profile'], $translation_texts)) |
|
4302 | - $translation_texts[] = $labels['label_post_profile']; |
|
4303 | - if (isset($labels['label_post_info']) && $labels['label_post_info'] != '' && !in_array($labels['label_post_info'], $translation_texts)) |
|
4304 | - $translation_texts[] = $labels['label_post_info']; |
|
4305 | - if (isset($labels['label_post_images']) && $labels['label_post_images'] != '' && !in_array($labels['label_post_images'], $translation_texts)) |
|
4306 | - $translation_texts[] = $labels['label_post_images']; |
|
4307 | - if (isset($labels['label_post_map']) && $labels['label_post_map'] != '' && !in_array($labels['label_post_map'], $translation_texts)) |
|
4308 | - $translation_texts[] = $labels['label_post_map']; |
|
4309 | - if (isset($labels['label_reviews']) && $labels['label_reviews'] != '' && !in_array($labels['label_reviews'], $translation_texts)) |
|
4310 | - $translation_texts[] = $labels['label_reviews']; |
|
4311 | - if (isset($labels['label_related_listing']) && $labels['label_related_listing'] != '' && !in_array($labels['label_related_listing'], $translation_texts)) |
|
4312 | - $translation_texts[] = $labels['label_related_listing']; |
|
4313 | - } |
|
4314 | - |
|
4315 | - if ($description != '' && !in_array($description, $translation_texts)) { |
|
4316 | - $translation_texts[] = normalize_whitespace($description); |
|
4317 | - } |
|
4318 | - |
|
4319 | - if (!empty($seo)) { |
|
4320 | - if (isset($seo['meta_keyword']) && $seo['meta_keyword'] != '' && !in_array($seo['meta_keyword'], $translation_texts)) |
|
4321 | - $translation_texts[] = normalize_whitespace($seo['meta_keyword']); |
|
4322 | - |
|
4323 | - if (isset($seo['meta_description']) && $seo['meta_description'] != '' && !in_array($seo['meta_description'], $translation_texts)) |
|
4324 | - $translation_texts[] = normalize_whitespace($seo['meta_description']); |
|
4325 | - } |
|
4326 | - } |
|
4327 | - } |
|
4328 | - $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts; |
|
4329 | - |
|
4330 | - return $translation_texts; |
|
4272 | + $gd_post_types = geodir_get_posttypes('array'); |
|
4273 | + |
|
4274 | + if (!empty($gd_post_types)) { |
|
4275 | + foreach ($gd_post_types as $post_type => $cpt_info) { |
|
4276 | + $labels = isset($cpt_info['labels']) ? $cpt_info['labels'] : ''; |
|
4277 | + $description = isset($cpt_info['description']) ? $cpt_info['description'] : ''; |
|
4278 | + $seo = isset($cpt_info['seo']) ? $cpt_info['seo'] : ''; |
|
4279 | + |
|
4280 | + if (!empty($labels)) { |
|
4281 | + if ($labels['name'] != '' && !in_array($labels['name'], $translation_texts)) |
|
4282 | + $translation_texts[] = $labels['name']; |
|
4283 | + if ($labels['singular_name'] != '' && !in_array($labels['singular_name'], $translation_texts)) |
|
4284 | + $translation_texts[] = $labels['singular_name']; |
|
4285 | + if ($labels['add_new'] != '' && !in_array($labels['add_new'], $translation_texts)) |
|
4286 | + $translation_texts[] = $labels['add_new']; |
|
4287 | + if ($labels['add_new_item'] != '' && !in_array($labels['add_new_item'], $translation_texts)) |
|
4288 | + $translation_texts[] = $labels['add_new_item']; |
|
4289 | + if ($labels['edit_item'] != '' && !in_array($labels['edit_item'], $translation_texts)) |
|
4290 | + $translation_texts[] = $labels['edit_item']; |
|
4291 | + if ($labels['new_item'] != '' && !in_array($labels['new_item'], $translation_texts)) |
|
4292 | + $translation_texts[] = $labels['new_item']; |
|
4293 | + if ($labels['view_item'] != '' && !in_array($labels['view_item'], $translation_texts)) |
|
4294 | + $translation_texts[] = $labels['view_item']; |
|
4295 | + if ($labels['search_items'] != '' && !in_array($labels['search_items'], $translation_texts)) |
|
4296 | + $translation_texts[] = $labels['search_items']; |
|
4297 | + if ($labels['not_found'] != '' && !in_array($labels['not_found'], $translation_texts)) |
|
4298 | + $translation_texts[] = $labels['not_found']; |
|
4299 | + if ($labels['not_found_in_trash'] != '' && !in_array($labels['not_found_in_trash'], $translation_texts)) |
|
4300 | + $translation_texts[] = $labels['not_found_in_trash']; |
|
4301 | + if (isset($labels['label_post_profile']) && $labels['label_post_profile'] != '' && !in_array($labels['label_post_profile'], $translation_texts)) |
|
4302 | + $translation_texts[] = $labels['label_post_profile']; |
|
4303 | + if (isset($labels['label_post_info']) && $labels['label_post_info'] != '' && !in_array($labels['label_post_info'], $translation_texts)) |
|
4304 | + $translation_texts[] = $labels['label_post_info']; |
|
4305 | + if (isset($labels['label_post_images']) && $labels['label_post_images'] != '' && !in_array($labels['label_post_images'], $translation_texts)) |
|
4306 | + $translation_texts[] = $labels['label_post_images']; |
|
4307 | + if (isset($labels['label_post_map']) && $labels['label_post_map'] != '' && !in_array($labels['label_post_map'], $translation_texts)) |
|
4308 | + $translation_texts[] = $labels['label_post_map']; |
|
4309 | + if (isset($labels['label_reviews']) && $labels['label_reviews'] != '' && !in_array($labels['label_reviews'], $translation_texts)) |
|
4310 | + $translation_texts[] = $labels['label_reviews']; |
|
4311 | + if (isset($labels['label_related_listing']) && $labels['label_related_listing'] != '' && !in_array($labels['label_related_listing'], $translation_texts)) |
|
4312 | + $translation_texts[] = $labels['label_related_listing']; |
|
4313 | + } |
|
4314 | + |
|
4315 | + if ($description != '' && !in_array($description, $translation_texts)) { |
|
4316 | + $translation_texts[] = normalize_whitespace($description); |
|
4317 | + } |
|
4318 | + |
|
4319 | + if (!empty($seo)) { |
|
4320 | + if (isset($seo['meta_keyword']) && $seo['meta_keyword'] != '' && !in_array($seo['meta_keyword'], $translation_texts)) |
|
4321 | + $translation_texts[] = normalize_whitespace($seo['meta_keyword']); |
|
4322 | + |
|
4323 | + if (isset($seo['meta_description']) && $seo['meta_description'] != '' && !in_array($seo['meta_description'], $translation_texts)) |
|
4324 | + $translation_texts[] = normalize_whitespace($seo['meta_description']); |
|
4325 | + } |
|
4326 | + } |
|
4327 | + } |
|
4328 | + $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts; |
|
4329 | + |
|
4330 | + return $translation_texts; |
|
4331 | 4331 | } |
4332 | 4332 | |
4333 | 4333 | /** |
@@ -4340,27 +4340,27 @@ discard block |
||
4340 | 4340 | * @return array Location terms. |
4341 | 4341 | */ |
4342 | 4342 | function geodir_remove_location_terms($location_terms = array()) { |
4343 | - $location_manager = defined('POST_LOCATION_TABLE') ? true : false; |
|
4344 | - |
|
4345 | - if (!empty($location_terms) && $location_manager) { |
|
4346 | - $hide_country_part = get_option('geodir_location_hide_country_part'); |
|
4347 | - $hide_region_part = get_option('geodir_location_hide_region_part'); |
|
4348 | - |
|
4349 | - if ($hide_region_part && $hide_country_part) { |
|
4350 | - if (isset($location_terms['gd_country'])) |
|
4351 | - unset($location_terms['gd_country']); |
|
4352 | - if (isset($location_terms['gd_region'])) |
|
4353 | - unset($location_terms['gd_region']); |
|
4354 | - } else if ($hide_region_part && !$hide_country_part) { |
|
4355 | - if (isset($location_terms['gd_region'])) |
|
4356 | - unset($location_terms['gd_region']); |
|
4357 | - } else if (!$hide_region_part && $hide_country_part) { |
|
4358 | - if (isset($location_terms['gd_country'])) |
|
4359 | - unset($location_terms['gd_country']); |
|
4360 | - } |
|
4361 | - } |
|
4362 | - |
|
4363 | - return $location_terms; |
|
4343 | + $location_manager = defined('POST_LOCATION_TABLE') ? true : false; |
|
4344 | + |
|
4345 | + if (!empty($location_terms) && $location_manager) { |
|
4346 | + $hide_country_part = get_option('geodir_location_hide_country_part'); |
|
4347 | + $hide_region_part = get_option('geodir_location_hide_region_part'); |
|
4348 | + |
|
4349 | + if ($hide_region_part && $hide_country_part) { |
|
4350 | + if (isset($location_terms['gd_country'])) |
|
4351 | + unset($location_terms['gd_country']); |
|
4352 | + if (isset($location_terms['gd_region'])) |
|
4353 | + unset($location_terms['gd_region']); |
|
4354 | + } else if ($hide_region_part && !$hide_country_part) { |
|
4355 | + if (isset($location_terms['gd_region'])) |
|
4356 | + unset($location_terms['gd_region']); |
|
4357 | + } else if (!$hide_region_part && $hide_country_part) { |
|
4358 | + if (isset($location_terms['gd_country'])) |
|
4359 | + unset($location_terms['gd_country']); |
|
4360 | + } |
|
4361 | + } |
|
4362 | + |
|
4363 | + return $location_terms; |
|
4364 | 4364 | } |
4365 | 4365 | |
4366 | 4366 | /** |
@@ -4374,47 +4374,47 @@ discard block |
||
4374 | 4374 | * @param bool $update Whether this is an existing listing being updated or not. |
4375 | 4375 | */ |
4376 | 4376 | function geodir_on_wp_insert_post($post_ID, $post, $update) { |
4377 | - if (!$update) { |
|
4378 | - return; |
|
4379 | - } |
|
4377 | + if (!$update) { |
|
4378 | + return; |
|
4379 | + } |
|
4380 | 4380 | |
4381 | - $action = isset($_REQUEST['action']) ? sanitize_text_field($_REQUEST['action']) : ''; |
|
4382 | - $is_admin = is_admin() && ( !defined('DOING_AJAX' ) || ( defined('DOING_AJAX') && !DOING_AJAX ) ) ? true : false; |
|
4383 | - $inline_save = $action == 'inline-save' ? true : false; |
|
4381 | + $action = isset($_REQUEST['action']) ? sanitize_text_field($_REQUEST['action']) : ''; |
|
4382 | + $is_admin = is_admin() && ( !defined('DOING_AJAX' ) || ( defined('DOING_AJAX') && !DOING_AJAX ) ) ? true : false; |
|
4383 | + $inline_save = $action == 'inline-save' ? true : false; |
|
4384 | 4384 | |
4385 | - if (empty($post->post_type) || $is_admin || $inline_save || (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)) { |
|
4386 | - return; |
|
4387 | - } |
|
4385 | + if (empty($post->post_type) || $is_admin || $inline_save || (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)) { |
|
4386 | + return; |
|
4387 | + } |
|
4388 | 4388 | |
4389 | - if ($action != '' && in_array($action, array('geodir_import_export'))) { |
|
4390 | - return; |
|
4391 | - } |
|
4389 | + if ($action != '' && in_array($action, array('geodir_import_export'))) { |
|
4390 | + return; |
|
4391 | + } |
|
4392 | 4392 | |
4393 | - $user_id = (int)get_current_user_id(); |
|
4393 | + $user_id = (int)get_current_user_id(); |
|
4394 | 4394 | |
4395 | - if ($user_id > 0 && get_option('geodir_notify_post_edited') && !wp_is_post_revision($post_ID) && in_array($post->post_type, geodir_get_posttypes())) { |
|
4396 | - $author_id = !empty($post->post_author) ? $post->post_author : 0; |
|
4395 | + if ($user_id > 0 && get_option('geodir_notify_post_edited') && !wp_is_post_revision($post_ID) && in_array($post->post_type, geodir_get_posttypes())) { |
|
4396 | + $author_id = !empty($post->post_author) ? $post->post_author : 0; |
|
4397 | 4397 | |
4398 | - if ($user_id == $author_id && !is_super_admin()) { |
|
4399 | - $from_email = get_option('site_email'); |
|
4400 | - $from_name = get_site_emailName(); |
|
4401 | - $to_email = get_option('admin_email'); |
|
4402 | - $to_name = get_option('name'); |
|
4403 | - $message_type = 'listing_edited'; |
|
4398 | + if ($user_id == $author_id && !is_super_admin()) { |
|
4399 | + $from_email = get_option('site_email'); |
|
4400 | + $from_name = get_site_emailName(); |
|
4401 | + $to_email = get_option('admin_email'); |
|
4402 | + $to_name = get_option('name'); |
|
4403 | + $message_type = 'listing_edited'; |
|
4404 | 4404 | |
4405 | - $notify_edited = true; |
|
4406 | - /** |
|
4407 | - * Send notification when listing edited by author? |
|
4408 | - * |
|
4409 | - * @since 1.6.0 |
|
4410 | - * @param bool $notify_edited Notify on listing edited by author? |
|
4411 | - * @param object $post The current post object. |
|
4412 | - */ |
|
4413 | - $notify_edited = apply_filters('geodir_notify_on_listing_edited', $notify_edited, $post); |
|
4405 | + $notify_edited = true; |
|
4406 | + /** |
|
4407 | + * Send notification when listing edited by author? |
|
4408 | + * |
|
4409 | + * @since 1.6.0 |
|
4410 | + * @param bool $notify_edited Notify on listing edited by author? |
|
4411 | + * @param object $post The current post object. |
|
4412 | + */ |
|
4413 | + $notify_edited = apply_filters('geodir_notify_on_listing_edited', $notify_edited, $post); |
|
4414 | 4414 | |
4415 | - geodir_sendEmail($from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID); |
|
4416 | - } |
|
4417 | - } |
|
4415 | + geodir_sendEmail($from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID); |
|
4416 | + } |
|
4417 | + } |
|
4418 | 4418 | } |
4419 | 4419 | |
4420 | 4420 | /** |
@@ -4428,16 +4428,16 @@ discard block |
||
4428 | 4428 | * @return string|null The current page start & end numbering. |
4429 | 4429 | */ |
4430 | 4430 | function geodir_title_meta_page($sep) { |
4431 | - $replacement = null; |
|
4431 | + $replacement = null; |
|
4432 | 4432 | |
4433 | - $max = geodir_title_meta_pagenumbering('max'); |
|
4434 | - $nr = geodir_title_meta_pagenumbering('nr'); |
|
4433 | + $max = geodir_title_meta_pagenumbering('max'); |
|
4434 | + $nr = geodir_title_meta_pagenumbering('nr'); |
|
4435 | 4435 | |
4436 | - if ($max > 1 && $nr > 1) { |
|
4437 | - $replacement = sprintf($sep . ' ' . __('Page %1$d of %2$d', 'geodirectory'), $nr, $max); |
|
4438 | - } |
|
4436 | + if ($max > 1 && $nr > 1) { |
|
4437 | + $replacement = sprintf($sep . ' ' . __('Page %1$d of %2$d', 'geodirectory'), $nr, $max); |
|
4438 | + } |
|
4439 | 4439 | |
4440 | - return $replacement; |
|
4440 | + return $replacement; |
|
4441 | 4441 | } |
4442 | 4442 | |
4443 | 4443 | /** |
@@ -4449,14 +4449,14 @@ discard block |
||
4449 | 4449 | * @return string|null The current page number. |
4450 | 4450 | */ |
4451 | 4451 | function geodir_title_meta_pagenumber() { |
4452 | - $replacement = null; |
|
4452 | + $replacement = null; |
|
4453 | 4453 | |
4454 | - $nr = geodir_title_meta_pagenumbering('nr'); |
|
4455 | - if (isset($nr) && $nr > 0) { |
|
4456 | - $replacement = (string)$nr; |
|
4457 | - } |
|
4454 | + $nr = geodir_title_meta_pagenumbering('nr'); |
|
4455 | + if (isset($nr) && $nr > 0) { |
|
4456 | + $replacement = (string)$nr; |
|
4457 | + } |
|
4458 | 4458 | |
4459 | - return $replacement; |
|
4459 | + return $replacement; |
|
4460 | 4460 | } |
4461 | 4461 | |
4462 | 4462 | /** |
@@ -4468,14 +4468,14 @@ discard block |
||
4468 | 4468 | * @return string|null The current page total. |
4469 | 4469 | */ |
4470 | 4470 | function geodir_title_meta_pagetotal() { |
4471 | - $replacement = null; |
|
4471 | + $replacement = null; |
|
4472 | 4472 | |
4473 | - $max = geodir_title_meta_pagenumbering('max'); |
|
4474 | - if (isset($max) && $max > 0) { |
|
4475 | - $replacement = (string)$max; |
|
4476 | - } |
|
4473 | + $max = geodir_title_meta_pagenumbering('max'); |
|
4474 | + if (isset($max) && $max > 0) { |
|
4475 | + $replacement = (string)$max; |
|
4476 | + } |
|
4477 | 4477 | |
4478 | - return $replacement; |
|
4478 | + return $replacement; |
|
4479 | 4479 | } |
4480 | 4480 | |
4481 | 4481 | /** |
@@ -4492,42 +4492,42 @@ discard block |
||
4492 | 4492 | * @return int|null The current page numbering. |
4493 | 4493 | */ |
4494 | 4494 | function geodir_title_meta_pagenumbering($request = 'nr') { |
4495 | - global $wp_query, $post; |
|
4496 | - $max_num_pages = null; |
|
4497 | - $page_number = null; |
|
4498 | - |
|
4499 | - $max_num_pages = 1; |
|
4500 | - |
|
4501 | - if (!is_singular()) { |
|
4502 | - $page_number = get_query_var('paged'); |
|
4503 | - if ($page_number === 0 || $page_number === '') { |
|
4504 | - $page_number = 1; |
|
4505 | - } |
|
4506 | - |
|
4507 | - if (isset($wp_query->max_num_pages) && ($wp_query->max_num_pages != '' && $wp_query->max_num_pages != 0)) { |
|
4508 | - $max_num_pages = $wp_query->max_num_pages; |
|
4509 | - } |
|
4510 | - } else { |
|
4511 | - $page_number = get_query_var('page'); |
|
4512 | - if ($page_number === 0 || $page_number === '') { |
|
4513 | - $page_number = 1; |
|
4514 | - } |
|
4515 | - |
|
4516 | - if (isset($post->post_content)) { |
|
4517 | - $max_num_pages = (substr_count($post->post_content, '<!--nextpage-->' ) + 1); |
|
4518 | - } |
|
4519 | - } |
|
4520 | - |
|
4521 | - $return = null; |
|
4522 | - |
|
4523 | - switch ($request) { |
|
4524 | - case 'nr': |
|
4525 | - $return = $page_number; |
|
4526 | - break; |
|
4527 | - case 'max': |
|
4528 | - $return = $max_num_pages; |
|
4529 | - break; |
|
4530 | - } |
|
4531 | - |
|
4532 | - return $return; |
|
4495 | + global $wp_query, $post; |
|
4496 | + $max_num_pages = null; |
|
4497 | + $page_number = null; |
|
4498 | + |
|
4499 | + $max_num_pages = 1; |
|
4500 | + |
|
4501 | + if (!is_singular()) { |
|
4502 | + $page_number = get_query_var('paged'); |
|
4503 | + if ($page_number === 0 || $page_number === '') { |
|
4504 | + $page_number = 1; |
|
4505 | + } |
|
4506 | + |
|
4507 | + if (isset($wp_query->max_num_pages) && ($wp_query->max_num_pages != '' && $wp_query->max_num_pages != 0)) { |
|
4508 | + $max_num_pages = $wp_query->max_num_pages; |
|
4509 | + } |
|
4510 | + } else { |
|
4511 | + $page_number = get_query_var('page'); |
|
4512 | + if ($page_number === 0 || $page_number === '') { |
|
4513 | + $page_number = 1; |
|
4514 | + } |
|
4515 | + |
|
4516 | + if (isset($post->post_content)) { |
|
4517 | + $max_num_pages = (substr_count($post->post_content, '<!--nextpage-->' ) + 1); |
|
4518 | + } |
|
4519 | + } |
|
4520 | + |
|
4521 | + $return = null; |
|
4522 | + |
|
4523 | + switch ($request) { |
|
4524 | + case 'nr': |
|
4525 | + $return = $page_number; |
|
4526 | + break; |
|
4527 | + case 'max': |
|
4528 | + $return = $max_num_pages; |
|
4529 | + break; |
|
4530 | + } |
|
4531 | + |
|
4532 | + return $return; |
|
4533 | 4533 | } |
4534 | 4534 | \ No newline at end of file |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | function geodir_plugin_path() |
49 | 49 | { |
50 | - if ( defined( 'GD_TESTING_MODE' ) && GD_TESTING_MODE ) { |
|
50 | + if (defined('GD_TESTING_MODE') && GD_TESTING_MODE) { |
|
51 | 51 | return dirname(dirname(__FILE__)); |
52 | 52 | } else { |
53 | 53 | return WP_PLUGIN_DIR . "/" . plugin_basename(dirname(dirname(__FILE__))); |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | |
161 | 161 | $add_listing_link = get_page_link(geodir_add_listing_page_id()); |
162 | 162 | |
163 | - return esc_url( add_query_arg(array('listing_type' => $post_type), $add_listing_link) ); |
|
163 | + return esc_url(add_query_arg(array('listing_type' => $post_type), $add_listing_link)); |
|
164 | 164 | } else |
165 | 165 | return get_bloginfo('url'); |
166 | 166 | } |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | function geodir_is_page($gdpage = '') |
253 | 253 | { |
254 | 254 | |
255 | - global $wp_query, $post,$wp; |
|
255 | + global $wp_query, $post, $wp; |
|
256 | 256 | //if(!is_admin()): |
257 | 257 | |
258 | 258 | switch ($gdpage): |
@@ -277,14 +277,14 @@ discard block |
||
277 | 277 | break; |
278 | 278 | case 'detail': |
279 | 279 | $post_type = get_query_var('post_type'); |
280 | - if(is_array($post_type)){$post_type = reset($post_type);} |
|
280 | + if (is_array($post_type)) {$post_type = reset($post_type); } |
|
281 | 281 | if (is_single() && in_array($post_type, geodir_get_posttypes())) |
282 | 282 | return true; |
283 | 283 | break; |
284 | 284 | case 'pt': |
285 | 285 | $post_type = get_query_var('post_type'); |
286 | - if(is_array($post_type)){$post_type = reset($post_type);} |
|
287 | - if (is_post_type_archive() && in_array($post_type , geodir_get_posttypes()) && !is_tax()) |
|
286 | + if (is_array($post_type)) {$post_type = reset($post_type); } |
|
287 | + if (is_post_type_archive() && in_array($post_type, geodir_get_posttypes()) && !is_tax()) |
|
288 | 288 | return true; |
289 | 289 | |
290 | 290 | break; |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | return true; |
296 | 296 | } |
297 | 297 | $post_type = get_query_var('post_type'); |
298 | - if(is_array($post_type)){$post_type = reset($post_type);} |
|
298 | + if (is_array($post_type)) {$post_type = reset($post_type); } |
|
299 | 299 | if (is_post_type_archive() && in_array($post_type, geodir_get_posttypes())) |
300 | 300 | return true; |
301 | 301 | |
@@ -314,8 +314,8 @@ discard block |
||
314 | 314 | if (is_author() && isset($_REQUEST['geodir_dashbord'])) |
315 | 315 | return true; |
316 | 316 | |
317 | - if (function_exists('bp_loggedin_user_id') && function_exists('bp_displayed_user_id') && $my_id = (int)bp_loggedin_user_id()) { |
|
318 | - if (((bool)bp_is_current_component('listings') || (bool)bp_is_current_component('favorites')) && $my_id > 0 && $my_id == (int)bp_displayed_user_id()) { |
|
317 | + if (function_exists('bp_loggedin_user_id') && function_exists('bp_displayed_user_id') && $my_id = (int) bp_loggedin_user_id()) { |
|
318 | + if (((bool) bp_is_current_component('listings') || (bool) bp_is_current_component('favorites')) && $my_id > 0 && $my_id == (int) bp_displayed_user_id()) { |
|
319 | 319 | return true; |
320 | 320 | } |
321 | 321 | } |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | if (empty($wp->query_vars) || !array_diff(array_keys($wp->query_vars), array('preview', 'page', 'paged', 'cpage'))) { |
369 | 369 | if (get_option('geodir_set_as_home')) |
370 | 370 | $wp->query_vars['gd_is_geodir_page'] = true; |
371 | - if(geodir_is_page('home')){ |
|
371 | + if (geodir_is_page('home')) { |
|
372 | 372 | $wp->query_vars['gd_is_geodir_page'] = true; |
373 | 373 | } |
374 | 374 | |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | |
421 | 421 | if (!isset($wp->query_vars['gd_is_geodir_page'])) { |
422 | 422 | $geodir_taxonomis = geodir_get_taxonomies('', true); |
423 | - if(!empty($geodir_taxonomis)){ |
|
423 | + if (!empty($geodir_taxonomis)) { |
|
424 | 424 | foreach ($geodir_taxonomis as $taxonomy) { |
425 | 425 | if (array_key_exists($taxonomy, $wp->query_vars)) { |
426 | 426 | $wp->query_vars['gd_is_geodir_page'] = true; |
@@ -440,10 +440,10 @@ discard block |
||
440 | 440 | |
441 | 441 | |
442 | 442 | //check if homepage |
443 | - if(!isset($wp->query_vars['gd_is_geodir_page']) |
|
443 | + if (!isset($wp->query_vars['gd_is_geodir_page']) |
|
444 | 444 | && !isset($wp->query_vars['page_id']) |
445 | 445 | && !isset($wp->query_vars['pagename']) |
446 | - && is_page_geodir_home()){ |
|
446 | + && is_page_geodir_home()) { |
|
447 | 447 | $wp->query_vars['gd_is_geodir_page'] = true; |
448 | 448 | } |
449 | 449 | //echo $wp->query_vars['gd_is_geodir_page'] ; |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | function createRandomString() |
545 | 545 | { |
546 | 546 | $chars = "abcdefghijkmlnopqrstuvwxyz1023456789"; |
547 | - srand((double)microtime() * 1000000); |
|
547 | + srand((double) microtime() * 1000000); |
|
548 | 548 | $i = 0; |
549 | 549 | $rstring = ''; |
550 | 550 | while ($i <= 25) { |
@@ -681,11 +681,11 @@ discard block |
||
681 | 681 | } |
682 | 682 | |
683 | 683 | if (!empty($subject)) { |
684 | - $subject = __(stripslashes_deep($subject),'geodirectory'); |
|
684 | + $subject = __(stripslashes_deep($subject), 'geodirectory'); |
|
685 | 685 | } |
686 | 686 | |
687 | 687 | if (!empty($message)) { |
688 | - $message = __(stripslashes_deep($message),'geodirectory'); |
|
688 | + $message = __(stripslashes_deep($message), 'geodirectory'); |
|
689 | 689 | } |
690 | 690 | |
691 | 691 | $to_message = nl2br($to_message); |
@@ -724,12 +724,12 @@ discard block |
||
724 | 724 | $fromEmailName = get_option('site_email_name'); |
725 | 725 | } |
726 | 726 | |
727 | - $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]', '[#posted_date#]','[#from_email#]','[#user_login#]','[#username#]','[#post_author_id#]','[#post_author_name#]','[#current_date#]'); |
|
728 | - $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName, $posted_date,$fromEmail, $user_login, $user_login, $post_author_id, $post_author_name, $current_date); |
|
727 | + $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]', '[#posted_date#]', '[#from_email#]', '[#user_login#]', '[#username#]', '[#post_author_id#]', '[#post_author_name#]', '[#current_date#]'); |
|
728 | + $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName, $posted_date, $fromEmail, $user_login, $user_login, $post_author_id, $post_author_name, $current_date); |
|
729 | 729 | $message = str_replace($search_array, $replace_array, $message); |
730 | 730 | |
731 | - $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]','[#from_email#]','[#user_login#]','[#username#]','[#post_author_id#]','[#post_author_name#]','[#current_date#]'); |
|
732 | - $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName, $posted_date,$fromEmail, $user_login, $user_login, $post_author_id, $post_author_name, $current_date); |
|
731 | + $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]', '[#from_email#]', '[#user_login#]', '[#username#]', '[#post_author_id#]', '[#post_author_name#]', '[#current_date#]'); |
|
732 | + $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName, $posted_date, $fromEmail, $user_login, $user_login, $post_author_id, $post_author_name, $current_date); |
|
733 | 733 | $subject = str_replace($search_array, $replace_array, $subject); |
734 | 734 | |
735 | 735 | $headers = 'MIME-Version: 1.0' . "\r\n"; |
@@ -740,18 +740,18 @@ discard block |
||
740 | 740 | $to = $toEmail; |
741 | 741 | $sent = wp_mail($to, $subject, $message, $headers); |
742 | 742 | |
743 | - if( ! $sent ) { |
|
744 | - if ( is_array( $to ) ) { |
|
745 | - $to = implode( ',', $to ); |
|
743 | + if (!$sent) { |
|
744 | + if (is_array($to)) { |
|
745 | + $to = implode(',', $to); |
|
746 | 746 | } |
747 | 747 | $log_message = sprintf( |
748 | - __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ), |
|
748 | + __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'), |
|
749 | 749 | $message_type, |
750 | - date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ), |
|
750 | + date_i18n('F j Y H:i:s', current_time('timestamp')), |
|
751 | 751 | $to, |
752 | 752 | $subject |
753 | 753 | ); |
754 | - geodir_error_log( $log_message ); |
|
754 | + geodir_error_log($log_message); |
|
755 | 755 | } |
756 | 756 | |
757 | 757 | ///////// ADMIN BCC EMIALS |
@@ -763,11 +763,11 @@ discard block |
||
763 | 763 | $subject = __(stripslashes_deep(get_option('geodir_post_submited_success_email_subject_admin')), 'geodirectory'); |
764 | 764 | $message = __(stripslashes_deep(get_option('geodir_post_submited_success_email_content_admin')), 'geodirectory'); |
765 | 765 | |
766 | - $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]', '[#posted_date#]','[#user_login#]','[#username#]'); |
|
766 | + $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]', '[#posted_date#]', '[#user_login#]', '[#username#]'); |
|
767 | 767 | $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName, $posted_date, $user_login, $user_login); |
768 | 768 | $message = str_replace($search_array, $replace_array, $message); |
769 | 769 | |
770 | - $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]','[#user_login#]','[#username#]'); |
|
770 | + $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]', '[#user_login#]', '[#username#]'); |
|
771 | 771 | $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName, $posted_date, $user_login, $user_login); |
772 | 772 | $subject = str_replace($search_array, $replace_array, $subject); |
773 | 773 | |
@@ -792,21 +792,21 @@ discard block |
||
792 | 792 | $admin_bcc = true; |
793 | 793 | } |
794 | 794 | |
795 | - if($admin_bcc===true){ |
|
795 | + if ($admin_bcc === true) { |
|
796 | 796 | $sent = wp_mail($to, $subject, $message, $headers); |
797 | 797 | |
798 | - if( ! $sent ) { |
|
799 | - if ( is_array( $to ) ) { |
|
800 | - $to = implode( ',', $to ); |
|
798 | + if (!$sent) { |
|
799 | + if (is_array($to)) { |
|
800 | + $to = implode(',', $to); |
|
801 | 801 | } |
802 | 802 | $log_message = sprintf( |
803 | - __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ), |
|
803 | + __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'), |
|
804 | 804 | $message_type, |
805 | - date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ), |
|
805 | + date_i18n('F j Y H:i:s', current_time('timestamp')), |
|
806 | 806 | $to, |
807 | 807 | $subject |
808 | 808 | ); |
809 | - geodir_error_log( $log_message ); |
|
809 | + geodir_error_log($log_message); |
|
810 | 810 | } |
811 | 811 | } |
812 | 812 | |
@@ -901,7 +901,7 @@ discard block |
||
901 | 901 | $location_manager = defined('POST_LOCATION_TABLE') ? true : false; |
902 | 902 | $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false; |
903 | 903 | |
904 | - if(geodir_is_page('detail') && isset($post->country_slug)){ |
|
904 | + if (geodir_is_page('detail') && isset($post->country_slug)) { |
|
905 | 905 | $location_terms = array( |
906 | 906 | 'gd_country' => $post->country_slug, |
907 | 907 | 'gd_region' => $post->region_slug, |
@@ -1156,7 +1156,7 @@ discard block |
||
1156 | 1156 | $breadcrumb .= stripslashes_deep($page_title); |
1157 | 1157 | $breadcrumb .= '</li>'; |
1158 | 1158 | } else if (is_tag()) { |
1159 | - $breadcrumb .= "<li> " . $separator . single_tag_title('',false) . '</li>'; |
|
1159 | + $breadcrumb .= "<li> " . $separator . single_tag_title('', false) . '</li>'; |
|
1160 | 1160 | } else if (is_day()) { |
1161 | 1161 | $breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " "; |
1162 | 1162 | the_time('F jS, Y'); |
@@ -1248,7 +1248,7 @@ discard block |
||
1248 | 1248 | return new WP_Error('upload_dir_error', $upload['error']); |
1249 | 1249 | |
1250 | 1250 | // fetch the remote url and write it to the placeholder file |
1251 | - $headers = wp_remote_get($url, array('stream' => true,'filename' => $upload['file'])); |
|
1251 | + $headers = wp_remote_get($url, array('stream' => true, 'filename' => $upload['file'])); |
|
1252 | 1252 | |
1253 | 1253 | $log_message = ''; |
1254 | 1254 | $filesize = filesize($upload['file']); |
@@ -1261,16 +1261,16 @@ discard block |
||
1261 | 1261 | $log_message = sprintf(__('Remote server returned error response %1$d %2$s', 'geodirectory'), esc_html($headers['response']), get_status_header_desc($headers['response'])); |
1262 | 1262 | } |
1263 | 1263 | elseif (isset($headers['headers']['content-length']) && $filesize != $headers['headers']['content-length']) { |
1264 | - $log_message = __('Remote file is incorrect size', 'geodirectory'); |
|
1264 | + $log_message = __('Remote file is incorrect size', 'geodirectory'); |
|
1265 | 1265 | } |
1266 | 1266 | elseif (0 == $filesize) { |
1267 | 1267 | $log_message = __('Zero size file downloaded', 'geodirectory'); |
1268 | 1268 | } |
1269 | 1269 | |
1270 | - if($log_message){ |
|
1270 | + if ($log_message) { |
|
1271 | 1271 | $del = unlink($upload['file']); |
1272 | - if(!$del){geodir_error_log(__('GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory'));} |
|
1273 | - return new WP_Error('import_file_error',$log_message ); |
|
1272 | + if (!$del) {geodir_error_log(__('GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory')); } |
|
1273 | + return new WP_Error('import_file_error', $log_message); |
|
1274 | 1274 | } |
1275 | 1275 | |
1276 | 1276 | |
@@ -1286,10 +1286,10 @@ discard block |
||
1286 | 1286 | */ |
1287 | 1287 | function geodir_max_upload_size() |
1288 | 1288 | { |
1289 | - $max_filesize = (float)get_option('geodir_upload_max_filesize', 2); |
|
1289 | + $max_filesize = (float) get_option('geodir_upload_max_filesize', 2); |
|
1290 | 1290 | |
1291 | 1291 | if ($max_filesize > 0 && $max_filesize < 1) { |
1292 | - $max_filesize = (int)($max_filesize * 1024) . 'kb'; |
|
1292 | + $max_filesize = (int) ($max_filesize * 1024) . 'kb'; |
|
1293 | 1293 | } else { |
1294 | 1294 | $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb'; |
1295 | 1295 | } |
@@ -1358,35 +1358,35 @@ discard block |
||
1358 | 1358 | { |
1359 | 1359 | global $wpdb; |
1360 | 1360 | if ($message_type == 'expiration') { |
1361 | - $subject = stripslashes(__(get_option('renew_email_subject'),'geodirectory')); |
|
1362 | - $client_message = stripslashes(__(get_option('renew_email_content'),'geodirectory')); |
|
1361 | + $subject = stripslashes(__(get_option('renew_email_subject'), 'geodirectory')); |
|
1362 | + $client_message = stripslashes(__(get_option('renew_email_content'), 'geodirectory')); |
|
1363 | 1363 | } elseif ($message_type == 'post_submited') { |
1364 | - $subject = __(get_option('post_submited_success_email_subject_admin'),'geodirectory'); |
|
1365 | - $client_message = __(get_option('post_submited_success_email_content_admin'),'geodirectory'); |
|
1364 | + $subject = __(get_option('post_submited_success_email_subject_admin'), 'geodirectory'); |
|
1365 | + $client_message = __(get_option('post_submited_success_email_content_admin'), 'geodirectory'); |
|
1366 | 1366 | } elseif ($message_type == 'renew') { |
1367 | - $subject = __(get_option('post_renew_success_email_subject_admin'),'geodirectory'); |
|
1368 | - $client_message = __(get_option('post_renew_success_email_content_admin'),'geodirectory'); |
|
1367 | + $subject = __(get_option('post_renew_success_email_subject_admin'), 'geodirectory'); |
|
1368 | + $client_message = __(get_option('post_renew_success_email_content_admin'), 'geodirectory'); |
|
1369 | 1369 | } elseif ($message_type == 'upgrade') { |
1370 | - $subject = __(get_option('post_upgrade_success_email_subject_admin'),'geodirectory'); |
|
1371 | - $client_message = __(get_option('post_upgrade_success_email_content_admin'),'geodirectory'); |
|
1370 | + $subject = __(get_option('post_upgrade_success_email_subject_admin'), 'geodirectory'); |
|
1371 | + $client_message = __(get_option('post_upgrade_success_email_content_admin'), 'geodirectory'); |
|
1372 | 1372 | } elseif ($message_type == 'claim_approved') { |
1373 | - $subject = __(get_option('claim_approved_email_subject'),'geodirectory'); |
|
1374 | - $client_message = __(get_option('claim_approved_email_content'),'geodirectory'); |
|
1373 | + $subject = __(get_option('claim_approved_email_subject'), 'geodirectory'); |
|
1374 | + $client_message = __(get_option('claim_approved_email_content'), 'geodirectory'); |
|
1375 | 1375 | } elseif ($message_type == 'claim_rejected') { |
1376 | - $subject = __(get_option('claim_rejected_email_subject'),'geodirectory'); |
|
1377 | - $client_message = __(get_option('claim_rejected_email_content'),'geodirectory'); |
|
1376 | + $subject = __(get_option('claim_rejected_email_subject'), 'geodirectory'); |
|
1377 | + $client_message = __(get_option('claim_rejected_email_content'), 'geodirectory'); |
|
1378 | 1378 | } elseif ($message_type == 'claim_requested') { |
1379 | - $subject = __(get_option('claim_email_subject_admin'),'geodirectory'); |
|
1380 | - $client_message = __(get_option('claim_email_content_admin'),'geodirectory'); |
|
1379 | + $subject = __(get_option('claim_email_subject_admin'), 'geodirectory'); |
|
1380 | + $client_message = __(get_option('claim_email_content_admin'), 'geodirectory'); |
|
1381 | 1381 | } elseif ($message_type == 'auto_claim') { |
1382 | - $subject = __(get_option('auto_claim_email_subject'),'geodirectory'); |
|
1383 | - $client_message = __(get_option('auto_claim_email_content'),'geodirectory'); |
|
1382 | + $subject = __(get_option('auto_claim_email_subject'), 'geodirectory'); |
|
1383 | + $client_message = __(get_option('auto_claim_email_content'), 'geodirectory'); |
|
1384 | 1384 | } elseif ($message_type == 'payment_success') { |
1385 | - $subject = __(get_option('post_payment_success_admin_email_subject'),'geodirectory'); |
|
1386 | - $client_message = __(get_option('post_payment_success_admin_email_content'),'geodirectory'); |
|
1385 | + $subject = __(get_option('post_payment_success_admin_email_subject'), 'geodirectory'); |
|
1386 | + $client_message = __(get_option('post_payment_success_admin_email_content'), 'geodirectory'); |
|
1387 | 1387 | } elseif ($message_type == 'payment_fail') { |
1388 | - $subject = __(get_option('post_payment_fail_admin_email_subject'),'geodirectory'); |
|
1389 | - $client_message = __(get_option('post_payment_fail_admin_email_content'),'geodirectory'); |
|
1388 | + $subject = __(get_option('post_payment_fail_admin_email_subject'), 'geodirectory'); |
|
1389 | + $client_message = __(get_option('post_payment_fail_admin_email_content'), 'geodirectory'); |
|
1390 | 1390 | } |
1391 | 1391 | $transaction_details = $custom_1; |
1392 | 1392 | $fromEmail = get_option('site_email'); |
@@ -1427,18 +1427,18 @@ discard block |
||
1427 | 1427 | $to = $fromEmail; |
1428 | 1428 | $message = $client_message; |
1429 | 1429 | $sent = wp_mail($to, $subject, $message, $headers); |
1430 | - if( ! $sent ) { |
|
1431 | - if ( is_array( $to ) ) { |
|
1432 | - $to = implode( ',', $to ); |
|
1430 | + if (!$sent) { |
|
1431 | + if (is_array($to)) { |
|
1432 | + $to = implode(',', $to); |
|
1433 | 1433 | } |
1434 | 1434 | $log_message = sprintf( |
1435 | - __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ), |
|
1435 | + __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'), |
|
1436 | 1436 | $message_type, |
1437 | - date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ), |
|
1437 | + date_i18n('F j Y H:i:s', current_time('timestamp')), |
|
1438 | 1438 | $to, |
1439 | 1439 | $subject |
1440 | 1440 | ); |
1441 | - geodir_error_log( $log_message ); |
|
1441 | + geodir_error_log($log_message); |
|
1442 | 1442 | } |
1443 | 1443 | } |
1444 | 1444 | } |
@@ -1464,18 +1464,18 @@ discard block |
||
1464 | 1464 | { |
1465 | 1465 | $login_details = ''; |
1466 | 1466 | if ($message_type == 'send_friend') { |
1467 | - $subject = stripslashes(__(get_option('email_friend_subject'),'geodirectory')); |
|
1468 | - $message = stripslashes(__(get_option('email_friend_content'),'geodirectory')); |
|
1467 | + $subject = stripslashes(__(get_option('email_friend_subject'), 'geodirectory')); |
|
1468 | + $message = stripslashes(__(get_option('email_friend_content'), 'geodirectory')); |
|
1469 | 1469 | } elseif ($message_type == 'send_enquiry') { |
1470 | - $subject = __(get_option('email_enquiry_subject'),'geodirectory'); |
|
1471 | - $message = __(get_option('email_enquiry_content'),'geodirectory'); |
|
1470 | + $subject = __(get_option('email_enquiry_subject'), 'geodirectory'); |
|
1471 | + $message = __(get_option('email_enquiry_content'), 'geodirectory'); |
|
1472 | 1472 | } elseif ($message_type == 'forgot_password') { |
1473 | - $subject = __(get_option('forgot_password_subject'),'geodirectory'); |
|
1474 | - $message = __(get_option('forgot_password_content'),'geodirectory'); |
|
1473 | + $subject = __(get_option('forgot_password_subject'), 'geodirectory'); |
|
1474 | + $message = __(get_option('forgot_password_content'), 'geodirectory'); |
|
1475 | 1475 | $login_details = $to_message; |
1476 | 1476 | } elseif ($message_type == 'registration') { |
1477 | - $subject = __(get_option('registration_success_email_subject'),'geodirectory'); |
|
1478 | - $message = __(get_option('registration_success_email_content'),'geodirectory'); |
|
1477 | + $subject = __(get_option('registration_success_email_subject'), 'geodirectory'); |
|
1478 | + $message = __(get_option('registration_success_email_content'), 'geodirectory'); |
|
1479 | 1479 | $login_details = $to_message; |
1480 | 1480 | } |
1481 | 1481 | $to_message = nl2br($to_message); |
@@ -1509,18 +1509,18 @@ discard block |
||
1509 | 1509 | $to = $toEmail; |
1510 | 1510 | |
1511 | 1511 | $sent = wp_mail($to, $subject, $message, $headers); |
1512 | - if( ! $sent ) { |
|
1513 | - if ( is_array( $to ) ) { |
|
1514 | - $to = implode( ',', $to ); |
|
1512 | + if (!$sent) { |
|
1513 | + if (is_array($to)) { |
|
1514 | + $to = implode(',', $to); |
|
1515 | 1515 | } |
1516 | 1516 | $log_message = sprintf( |
1517 | - __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ), |
|
1517 | + __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'), |
|
1518 | 1518 | $message_type, |
1519 | - date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ), |
|
1519 | + date_i18n('F j Y H:i:s', current_time('timestamp')), |
|
1520 | 1520 | $to, |
1521 | 1521 | $subject |
1522 | 1522 | ); |
1523 | - geodir_error_log( $log_message ); |
|
1523 | + geodir_error_log($log_message); |
|
1524 | 1524 | } |
1525 | 1525 | |
1526 | 1526 | ///////// ADMIN BCC EMIALS |
@@ -1546,20 +1546,20 @@ discard block |
||
1546 | 1546 | $admin_bcc = true; |
1547 | 1547 | } |
1548 | 1548 | |
1549 | - if($admin_bcc === true){ |
|
1549 | + if ($admin_bcc === true) { |
|
1550 | 1550 | $sent = wp_mail($to, $subject, $message, $headers); |
1551 | - if( ! $sent ) { |
|
1552 | - if ( is_array( $to ) ) { |
|
1553 | - $to = implode( ',', $to ); |
|
1551 | + if (!$sent) { |
|
1552 | + if (is_array($to)) { |
|
1553 | + $to = implode(',', $to); |
|
1554 | 1554 | } |
1555 | 1555 | $log_message = sprintf( |
1556 | - __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ), |
|
1556 | + __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'), |
|
1557 | 1557 | $message_type, |
1558 | - date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ), |
|
1558 | + date_i18n('F j Y H:i:s', current_time('timestamp')), |
|
1559 | 1559 | $to, |
1560 | 1560 | $subject |
1561 | 1561 | ); |
1562 | - geodir_error_log( $log_message ); |
|
1562 | + geodir_error_log($log_message); |
|
1563 | 1563 | } |
1564 | 1564 | } |
1565 | 1565 | |
@@ -1607,7 +1607,7 @@ discard block |
||
1607 | 1607 | function geodir_custom_posts_body_class($classes) { |
1608 | 1608 | global $wpdb, $wp; |
1609 | 1609 | $post_types = geodir_get_posttypes('object'); |
1610 | - if (!empty($post_types) && count((array)$post_types) > 1) { |
|
1610 | + if (!empty($post_types) && count((array) $post_types) > 1) { |
|
1611 | 1611 | $classes[] = 'geodir_custom_posts'; |
1612 | 1612 | } |
1613 | 1613 | |
@@ -1900,7 +1900,7 @@ discard block |
||
1900 | 1900 | $sql = "SELECT COUNT(" . $wpdb->posts . ".ID) AS total FROM " . $wpdb->posts . " |
1901 | 1901 | " . $join . " |
1902 | 1902 | " . $where; |
1903 | - $rows = (int)$wpdb->get_var($sql); |
|
1903 | + $rows = (int) $wpdb->get_var($sql); |
|
1904 | 1904 | } else { |
1905 | 1905 | $orderby = geodir_widget_listings_get_order($query_args); |
1906 | 1906 | /** |
@@ -1926,10 +1926,10 @@ discard block |
||
1926 | 1926 | $limit = apply_filters('geodir_filter_widget_listings_limit', $limit, $post_type); |
1927 | 1927 | |
1928 | 1928 | $page = !empty($query_args['pageno']) ? absint($query_args['pageno']) : 1; |
1929 | - if ( !$page ) |
|
1929 | + if (!$page) |
|
1930 | 1930 | $page = 1; |
1931 | 1931 | |
1932 | - $limit = (int)$limit > 0 ? " LIMIT " . absint( ( $page - 1 ) * (int)$limit ) . ", " . (int)$limit : ""; |
|
1932 | + $limit = (int) $limit > 0 ? " LIMIT " . absint(($page - 1) * (int) $limit) . ", " . (int) $limit : ""; |
|
1933 | 1933 | |
1934 | 1934 | $sql = "SELECT SQL_CALC_FOUND_ROWS " . $fields . " FROM " . $wpdb->posts . " |
1935 | 1935 | " . $join . " |
@@ -2031,7 +2031,7 @@ discard block |
||
2031 | 2031 | } |
2032 | 2032 | |
2033 | 2033 | if (!empty($query_args['post_author'])) { |
2034 | - $where .= " AND " . $wpdb->posts . ".post_author = " . (int)$query_args['post_author']; |
|
2034 | + $where .= " AND " . $wpdb->posts . ".post_author = " . (int) $query_args['post_author']; |
|
2035 | 2035 | } |
2036 | 2036 | |
2037 | 2037 | if (!empty($query_args['show_featured_only'])) { |
@@ -2108,7 +2108,7 @@ discard block |
||
2108 | 2108 | } |
2109 | 2109 | |
2110 | 2110 | if (!empty($query_args) && !empty($query_args['posts_per_page'])) { |
2111 | - $limit = (int)$query_args['posts_per_page']; |
|
2111 | + $limit = (int) $query_args['posts_per_page']; |
|
2112 | 2112 | } |
2113 | 2113 | |
2114 | 2114 | return $limit; |
@@ -2251,9 +2251,9 @@ discard block |
||
2251 | 2251 | add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
2252 | 2252 | } |
2253 | 2253 | $home_url = str_replace("www.", "", $home_url); |
2254 | - if ( (strpos($home_url, $cur_url) !== false || strpos($home_url . '/', $cur_url) !== false) && ('page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front')==get_option('geodir_home_page')) ) { |
|
2254 | + if ((strpos($home_url, $cur_url) !== false || strpos($home_url . '/', $cur_url) !== false) && ('page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front') == get_option('geodir_home_page'))) { |
|
2255 | 2255 | return true; |
2256 | - }elseif(get_query_var('page_id') == get_option('page_on_front') && 'page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front')==get_option('geodir_home_page')){ |
|
2256 | + }elseif (get_query_var('page_id') == get_option('page_on_front') && 'page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front') == get_option('geodir_home_page')) { |
|
2257 | 2257 | return true; |
2258 | 2258 | } else { |
2259 | 2259 | return false; |
@@ -2336,7 +2336,7 @@ discard block |
||
2336 | 2336 | |
2337 | 2337 | $gd_post_type = geodir_get_current_posttype(); |
2338 | 2338 | |
2339 | - $category_limit = isset($instance['category_limit']) && $instance['category_limit'] > 0 ? (int)$instance['category_limit'] : 15; |
|
2339 | + $category_limit = isset($instance['category_limit']) && $instance['category_limit'] > 0 ? (int) $instance['category_limit'] : 15; |
|
2340 | 2340 | $default_post_type = !empty($gd_post_type) ? $gd_post_type : (isset($instance['default_post_type']) && gdsc_is_post_type_valid($instance['default_post_type']) ? $instance['default_post_type'] : ''); |
2341 | 2341 | |
2342 | 2342 | $taxonomy = array(); |
@@ -2369,14 +2369,14 @@ discard block |
||
2369 | 2369 | foreach ($b_terms as $key => $val) { |
2370 | 2370 | $ptype = get_post_type_object(str_replace("category", "", $key)); |
2371 | 2371 | $cpt_name = __($ptype->labels->singular_name, 'geodirectory'); |
2372 | - $tax_change_output .= "<option value='$key' ". selected($key, $default_taxonomy, false) .">" . sprintf(__('%s Categories', 'geodirectory'),$cpt_name) . "</option>"; |
|
2372 | + $tax_change_output .= "<option value='$key' " . selected($key, $default_taxonomy, false) . ">" . sprintf(__('%s Categories', 'geodirectory'), $cpt_name) . "</option>"; |
|
2373 | 2373 | } |
2374 | 2374 | $tax_change_output .= "</select>"; |
2375 | 2375 | } |
2376 | 2376 | |
2377 | 2377 | if (!empty($b_terms)) { |
2378 | - $terms = $default_taxonomy != '' && isset($b_terms[$default_taxonomy]) ? $b_terms[$default_taxonomy] : reset($b_terms);// get the first array |
|
2379 | - global $cat_count;//make global so we can change via function |
|
2378 | + $terms = $default_taxonomy != '' && isset($b_terms[$default_taxonomy]) ? $b_terms[$default_taxonomy] : reset($b_terms); // get the first array |
|
2379 | + global $cat_count; //make global so we can change via function |
|
2380 | 2380 | $cat_count = 0; |
2381 | 2381 | ?> |
2382 | 2382 | <div class="geodir-category-list-in clearfix"> |
@@ -2440,7 +2440,7 @@ discard block |
||
2440 | 2440 | $class_row = $cat_count > $category_limit ? 'geodir-pcat-hide geodir-hide' : 'geodir-pcat-show'; |
2441 | 2441 | $total_post = $cat->count; |
2442 | 2442 | |
2443 | - $term_link = get_term_link( $cat, $cat->taxonomy ); |
|
2443 | + $term_link = get_term_link($cat, $cat->taxonomy); |
|
2444 | 2444 | /** |
2445 | 2445 | * Filer the category term link. |
2446 | 2446 | * |
@@ -2449,7 +2449,7 @@ discard block |
||
2449 | 2449 | * @param int $cat->term_id The term id. |
2450 | 2450 | * @param string $post_type Wordpress post type. |
2451 | 2451 | */ |
2452 | - $term_link = apply_filters( 'geodir_category_term_link', $term_link, $cat->term_id, $post_type ); |
|
2452 | + $term_link = apply_filters('geodir_category_term_link', $term_link, $cat->term_id, $post_type); |
|
2453 | 2453 | |
2454 | 2454 | echo '<li class="' . $class_row . '"><a href="' . $term_link . '">'; |
2455 | 2455 | echo '<img alt="' . esc_attr($cat->name) . ' icon" style="height:20px;vertical-align:middle;" src="' . $term_icon_url . '"/> <span class="cat-link">'; echo $cat->name . '</span> <span class="geodir_term_class geodir_link_span geodir_category_class_' . $post_type . '_' . $cat->term_id . '">(' . $total_post . ')</span> '; |
@@ -2583,29 +2583,29 @@ discard block |
||
2583 | 2583 | itemWidth: 75, |
2584 | 2584 | itemMargin: 5, |
2585 | 2585 | asNavFor: '#geodir_widget_slider', |
2586 | - rtl: <?php echo ( is_rtl() ? 'true' : 'false' ); /* fix rtl issue */ ?> |
|
2586 | + rtl: <?php echo (is_rtl() ? 'true' : 'false'); /* fix rtl issue */ ?> |
|
2587 | 2587 | }); |
2588 | 2588 | |
2589 | 2589 | jQuery('#geodir_widget_slider').flexslider({ |
2590 | - animation: "<?php echo $animation;?>", |
|
2590 | + animation: "<?php echo $animation; ?>", |
|
2591 | 2591 | selector: ".geodir-slides > li", |
2592 | 2592 | namespace: "geodir-", |
2593 | 2593 | controlNav: true, |
2594 | - animationLoop: <?php echo $animationLoop;?>, |
|
2595 | - slideshow: <?php echo $slideshow;?>, |
|
2596 | - slideshowSpeed: <?php echo $slideshowSpeed;?>, |
|
2597 | - animationSpeed: <?php echo $animationSpeed;?>, |
|
2598 | - directionNav: <?php echo $directionNav;?>, |
|
2599 | - maxItems: <?php echo $max_show;?>, |
|
2594 | + animationLoop: <?php echo $animationLoop; ?>, |
|
2595 | + slideshow: <?php echo $slideshow; ?>, |
|
2596 | + slideshowSpeed: <?php echo $slideshowSpeed; ?>, |
|
2597 | + animationSpeed: <?php echo $animationSpeed; ?>, |
|
2598 | + directionNav: <?php echo $directionNav; ?>, |
|
2599 | + maxItems: <?php echo $max_show; ?>, |
|
2600 | 2600 | move: 1, |
2601 | - <?php if($slide_width){ echo "itemWidth: ".$slide_width.",";}?> |
|
2601 | + <?php if ($slide_width) { echo "itemWidth: " . $slide_width . ","; }?> |
|
2602 | 2602 | sync: "#geodir_widget_carousel", |
2603 | 2603 | start: function (slider) { |
2604 | 2604 | jQuery('.geodir-listing-flex-loader').hide(); |
2605 | 2605 | jQuery('#geodir_widget_slider').css({'visibility': 'visible'}); |
2606 | 2606 | jQuery('#geodir_widget_carousel').css({'visibility': 'visible'}); |
2607 | 2607 | }, |
2608 | - rtl: <?php echo ( is_rtl() ? 'true' : 'false' ); /* fix rtl issue */ ?> |
|
2608 | + rtl: <?php echo (is_rtl() ? 'true' : 'false'); /* fix rtl issue */ ?> |
|
2609 | 2609 | }); |
2610 | 2610 | }); |
2611 | 2611 | </script> |
@@ -2646,7 +2646,7 @@ discard block |
||
2646 | 2646 | |
2647 | 2647 | global $post; |
2648 | 2648 | |
2649 | - $current_post = $post;// keep current post info |
|
2649 | + $current_post = $post; // keep current post info |
|
2650 | 2650 | |
2651 | 2651 | $widget_main_slides = ''; |
2652 | 2652 | $nav_slides = ''; |
@@ -3086,7 +3086,7 @@ discard block |
||
3086 | 3086 | $geodir_add_location_url = '1'; |
3087 | 3087 | } |
3088 | 3088 | |
3089 | - $viewall_url = get_term_link((int)$category[0], $post_type . 'category'); |
|
3089 | + $viewall_url = get_term_link((int) $category[0], $post_type . 'category'); |
|
3090 | 3090 | |
3091 | 3091 | $geodir_add_location_url = NULL; |
3092 | 3092 | } |
@@ -3094,7 +3094,7 @@ discard block |
||
3094 | 3094 | $gd_session->set('gd_multi_location', 1); |
3095 | 3095 | } |
3096 | 3096 | |
3097 | - if(is_wp_error( $viewall_url )){$viewall_url = '';} |
|
3097 | + if (is_wp_error($viewall_url)) {$viewall_url = ''; } |
|
3098 | 3098 | |
3099 | 3099 | $query_args = array( |
3100 | 3100 | 'posts_per_page' => $post_number, |
@@ -3332,14 +3332,14 @@ discard block |
||
3332 | 3332 | * @package GeoDirectory |
3333 | 3333 | * @return bool |
3334 | 3334 | */ |
3335 | -function geodir_term_review_count_force_update($new_status, $old_status='', $post='') |
|
3335 | +function geodir_term_review_count_force_update($new_status, $old_status = '', $post = '') |
|
3336 | 3336 | { |
3337 | - if(isset($_REQUEST['action']) && $_REQUEST['action']=='geodir_import_export'){return;}//do not run if importing listings |
|
3337 | + if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'geodir_import_export') {return; }//do not run if importing listings |
|
3338 | 3338 | |
3339 | - if(isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')){ |
|
3339 | + if (isset($post->post_type) && ($post->post_type == 'nav_menu_item' || $post->post_type == 'page' || $post->post_type == 'post')) { |
|
3340 | 3340 | return; |
3341 | 3341 | } |
3342 | - if($new_status!=$old_status) { |
|
3342 | + if ($new_status != $old_status) { |
|
3343 | 3343 | geodir_count_reviews_by_terms(true); |
3344 | 3344 | } |
3345 | 3345 | return true; |
@@ -3504,7 +3504,7 @@ discard block |
||
3504 | 3504 | */ |
3505 | 3505 | try { |
3506 | 3506 | require_once($language_file); |
3507 | - } catch(Exception $e) { |
|
3507 | + } catch (Exception $e) { |
|
3508 | 3508 | error_log('Language Error: ' . $e->getMessage()); |
3509 | 3509 | } |
3510 | 3510 | } |
@@ -3522,18 +3522,18 @@ discard block |
||
3522 | 3522 | */ |
3523 | 3523 | function geodirectory_load_db_language() { |
3524 | 3524 | global $wp_filesystem; |
3525 | - if( empty( $wp_filesystem ) ) { |
|
3526 | - require_once( ABSPATH .'/wp-admin/includes/file.php' ); |
|
3525 | + if (empty($wp_filesystem)) { |
|
3526 | + require_once(ABSPATH . '/wp-admin/includes/file.php'); |
|
3527 | 3527 | WP_Filesystem(); |
3528 | 3528 | global $wp_filesystem; |
3529 | 3529 | } |
3530 | 3530 | |
3531 | 3531 | $language_file = geodir_plugin_path() . '/db-language.php'; |
3532 | 3532 | |
3533 | - if(is_file($language_file) && !is_writable($language_file)) |
|
3533 | + if (is_file($language_file) && !is_writable($language_file)) |
|
3534 | 3534 | return false; // Not possible to create. |
3535 | 3535 | |
3536 | - if(!is_file($language_file) && !is_writable(dirname($language_file))) |
|
3536 | + if (!is_file($language_file) && !is_writable(dirname($language_file))) |
|
3537 | 3537 | return false; // Not possible to create. |
3538 | 3538 | |
3539 | 3539 | $contents_strings = array(); |
@@ -3567,7 +3567,7 @@ discard block |
||
3567 | 3567 | $contents = implode(PHP_EOL, $contents_head); |
3568 | 3568 | |
3569 | 3569 | if (!empty($contents_strings)) { |
3570 | - foreach ( $contents_strings as $string ) { |
|
3570 | + foreach ($contents_strings as $string) { |
|
3571 | 3571 | if (is_scalar($string) && $string != '') { |
3572 | 3572 | $string = str_replace("'", "\'", $string); |
3573 | 3573 | $contents .= PHP_EOL . "__('" . $string . "', 'geodirectory');"; |
@@ -3577,7 +3577,7 @@ discard block |
||
3577 | 3577 | |
3578 | 3578 | $contents .= implode(PHP_EOL, $contents_foot); |
3579 | 3579 | |
3580 | - if($wp_filesystem->put_contents( $language_file, $contents, FS_CHMOD_FILE)) |
|
3580 | + if ($wp_filesystem->put_contents($language_file, $contents, FS_CHMOD_FILE)) |
|
3581 | 3581 | return false; // Failure; could not write file. |
3582 | 3582 | |
3583 | 3583 | return true; |
@@ -3603,7 +3603,7 @@ discard block |
||
3603 | 3603 | $rows = $wpdb->get_results($sql); |
3604 | 3604 | |
3605 | 3605 | if (!empty($rows)) { |
3606 | - foreach($rows as $row) { |
|
3606 | + foreach ($rows as $row) { |
|
3607 | 3607 | if (!empty($row->admin_title)) |
3608 | 3608 | $translation_texts[] = stripslashes_deep($row->admin_title); |
3609 | 3609 | |
@@ -3641,7 +3641,7 @@ discard block |
||
3641 | 3641 | $rows = $wpdb->get_results($sql); |
3642 | 3642 | |
3643 | 3643 | if (!empty($rows)) { |
3644 | - foreach($rows as $row) { |
|
3644 | + foreach ($rows as $row) { |
|
3645 | 3645 | if (!empty($row->site_title)) |
3646 | 3646 | $translation_texts[] = stripslashes_deep($row->site_title); |
3647 | 3647 | |
@@ -3659,7 +3659,7 @@ discard block |
||
3659 | 3659 | $rows = $wpdb->get_results($sql); |
3660 | 3660 | |
3661 | 3661 | if (!empty($rows)) { |
3662 | - foreach($rows as $row) { |
|
3662 | + foreach ($rows as $row) { |
|
3663 | 3663 | if (!empty($row->field_site_name)) |
3664 | 3664 | $translation_texts[] = stripslashes_deep($row->field_site_name); |
3665 | 3665 | |
@@ -3694,7 +3694,7 @@ discard block |
||
3694 | 3694 | * |
3695 | 3695 | * @param array $geodir_allowed_mime_types and file extensions. |
3696 | 3696 | */ |
3697 | - return apply_filters( 'geodir_allowed_mime_types', array( |
|
3697 | + return apply_filters('geodir_allowed_mime_types', array( |
|
3698 | 3698 | 'Image' => array( // Image formats. |
3699 | 3699 | 'jpg' => 'image/jpeg', |
3700 | 3700 | 'jpe' => 'image/jpeg', |
@@ -3783,13 +3783,13 @@ discard block |
||
3783 | 3783 | |
3784 | 3784 | |
3785 | 3785 | |
3786 | -add_filter('wpseo_replacements','geodir_wpseo_replacements',10,1); |
|
3786 | +add_filter('wpseo_replacements', 'geodir_wpseo_replacements', 10, 1); |
|
3787 | 3787 | /* |
3788 | 3788 | * Add location variables to wpseo replacements. |
3789 | 3789 | * |
3790 | 3790 | * @since 1.5.4 |
3791 | 3791 | */ |
3792 | -function geodir_wpseo_replacements($vars){ |
|
3792 | +function geodir_wpseo_replacements($vars) { |
|
3793 | 3793 | |
3794 | 3794 | global $wp; |
3795 | 3795 | $title = ''; |
@@ -3804,12 +3804,12 @@ discard block |
||
3804 | 3804 | * @param array $location_array The array of location variables. |
3805 | 3805 | * @param array $vars The page title variables. |
3806 | 3806 | */ |
3807 | - $location_array = apply_filters('geodir_filter_title_variables_location_arr_seo',$location_array, $vars); |
|
3807 | + $location_array = apply_filters('geodir_filter_title_variables_location_arr_seo', $location_array, $vars); |
|
3808 | 3808 | $location_titles = array(); |
3809 | - if(get_query_var( 'gd_country_full' )){ |
|
3810 | - if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );} |
|
3811 | - if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );} |
|
3812 | - if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );} |
|
3809 | + if (get_query_var('gd_country_full')) { |
|
3810 | + if (get_query_var('gd_country_full')) {$location_array['gd_country'] = get_query_var('gd_country_full'); } |
|
3811 | + if (get_query_var('gd_region_full')) {$location_array['gd_region'] = get_query_var('gd_region_full'); } |
|
3812 | + if (get_query_var('gd_city_full')) {$location_array['gd_city'] = get_query_var('gd_city_full'); } |
|
3813 | 3813 | } |
3814 | 3814 | $location_single = ''; |
3815 | 3815 | $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : ''; |
@@ -3881,23 +3881,23 @@ discard block |
||
3881 | 3881 | } |
3882 | 3882 | |
3883 | 3883 | |
3884 | - if(!empty($location_titles)) { |
|
3884 | + if (!empty($location_titles)) { |
|
3885 | 3885 | $vars['%%location%%'] = implode(", ", $location_titles); |
3886 | 3886 | } |
3887 | 3887 | |
3888 | 3888 | |
3889 | - if(!empty($location_titles)) { |
|
3889 | + if (!empty($location_titles)) { |
|
3890 | 3890 | $vars['%%in_location%%'] = __('in ', 'geodirectory') . implode(", ", $location_titles); |
3891 | 3891 | } |
3892 | 3892 | |
3893 | 3893 | |
3894 | 3894 | |
3895 | - if($location_single) { |
|
3896 | - $vars['%%in_location_single%%'] = __('in', 'geodirectory') . ' ' .$location_single; |
|
3895 | + if ($location_single) { |
|
3896 | + $vars['%%in_location_single%%'] = __('in', 'geodirectory') . ' ' . $location_single; |
|
3897 | 3897 | } |
3898 | 3898 | |
3899 | 3899 | |
3900 | - if($location_single) { |
|
3900 | + if ($location_single) { |
|
3901 | 3901 | $vars['%%location_single%%'] = $location_single; |
3902 | 3902 | } |
3903 | 3903 | |
@@ -3909,17 +3909,17 @@ discard block |
||
3909 | 3909 | * @param string $vars The title with variables. |
3910 | 3910 | * @param array $location_array The array of location variables. |
3911 | 3911 | */ |
3912 | - return apply_filters('geodir_wpseo_replacements_vars',$vars,$location_array); |
|
3912 | + return apply_filters('geodir_wpseo_replacements_vars', $vars, $location_array); |
|
3913 | 3913 | } |
3914 | 3914 | |
3915 | 3915 | |
3916 | -add_filter('geodir_seo_meta_title','geodir_filter_title_variables',10,3); |
|
3917 | -add_filter('geodir_seo_page_title','geodir_filter_title_variables',10,2); |
|
3918 | -add_filter('geodir_seo_meta_description_pre','geodir_filter_title_variables',10,3); |
|
3919 | -function geodir_filter_title_variables($title, $gd_page, $sep=''){ |
|
3916 | +add_filter('geodir_seo_meta_title', 'geodir_filter_title_variables', 10, 3); |
|
3917 | +add_filter('geodir_seo_page_title', 'geodir_filter_title_variables', 10, 2); |
|
3918 | +add_filter('geodir_seo_meta_description_pre', 'geodir_filter_title_variables', 10, 3); |
|
3919 | +function geodir_filter_title_variables($title, $gd_page, $sep = '') { |
|
3920 | 3920 | |
3921 | 3921 | |
3922 | - if(!$gd_page || !$title){return $title;}// if no a GD page then bail. |
|
3922 | + if (!$gd_page || !$title) {return $title; }// if no a GD page then bail. |
|
3923 | 3923 | global $post; |
3924 | 3924 | //print_r($post); |
3925 | 3925 | /* |
@@ -3961,123 +3961,123 @@ discard block |
||
3961 | 3961 | } |
3962 | 3962 | |
3963 | 3963 | |
3964 | - if(strpos($title,'%%title%%') !== false){ |
|
3965 | - $title = str_replace("%%title%%",$post->post_title,$title); |
|
3964 | + if (strpos($title, '%%title%%') !== false) { |
|
3965 | + $title = str_replace("%%title%%", $post->post_title, $title); |
|
3966 | 3966 | } |
3967 | 3967 | |
3968 | - if(strpos($title,'%%sitename%%') !== false){ |
|
3969 | - $title = str_replace("%%sitename%%",get_bloginfo('name'),$title); |
|
3968 | + if (strpos($title, '%%sitename%%') !== false) { |
|
3969 | + $title = str_replace("%%sitename%%", get_bloginfo('name'), $title); |
|
3970 | 3970 | } |
3971 | 3971 | |
3972 | - if(strpos($title,'%%sitedesc%%') !== false){ |
|
3973 | - $title = str_replace("%%sitedesc%%",get_bloginfo('description'),$title); |
|
3972 | + if (strpos($title, '%%sitedesc%%') !== false) { |
|
3973 | + $title = str_replace("%%sitedesc%%", get_bloginfo('description'), $title); |
|
3974 | 3974 | } |
3975 | 3975 | |
3976 | - if(strpos($title,'%%excerpt%%') !== false){ |
|
3977 | - $title = str_replace("%%excerpt%%",strip_tags(get_the_excerpt()),$title); |
|
3976 | + if (strpos($title, '%%excerpt%%') !== false) { |
|
3977 | + $title = str_replace("%%excerpt%%", strip_tags(get_the_excerpt()), $title); |
|
3978 | 3978 | } |
3979 | 3979 | |
3980 | - if(strpos($title,'%%pt_single%%') !== false){ |
|
3980 | + if (strpos($title, '%%pt_single%%') !== false) { |
|
3981 | 3981 | $single_name = ''; |
3982 | - if($gd_page=='search' || $gd_page=='author'){ |
|
3982 | + if ($gd_page == 'search' || $gd_page == 'author') { |
|
3983 | 3983 | $geodir_post_types = get_option('geodir_post_types'); |
3984 | 3984 | $spt = esc_attr($_REQUEST['stype']); |
3985 | - if(isset($geodir_post_types[$spt]['labels']['singular_name'])){ |
|
3986 | - $single_name = __($geodir_post_types[$spt]['labels']['singular_name'],'geodirectory'); |
|
3985 | + if (isset($geodir_post_types[$spt]['labels']['singular_name'])) { |
|
3986 | + $single_name = __($geodir_post_types[$spt]['labels']['singular_name'], 'geodirectory'); |
|
3987 | 3987 | } |
3988 | - }elseif($gd_page=='add-listing'){ |
|
3988 | + }elseif ($gd_page == 'add-listing') { |
|
3989 | 3989 | $geodir_post_types = get_option('geodir_post_types'); |
3990 | 3990 | $spt = isset($_REQUEST['listing_type']) ? esc_attr($_REQUEST['listing_type']) : ''; |
3991 | - if(!$spt && isset($_REQUEST['pid'])){ |
|
3992 | - $spt = get_post_type( $_REQUEST['pid'] ); |
|
3991 | + if (!$spt && isset($_REQUEST['pid'])) { |
|
3992 | + $spt = get_post_type($_REQUEST['pid']); |
|
3993 | 3993 | } |
3994 | - if(!$spt){$spt='gd_place';} |
|
3995 | - if(isset($geodir_post_types[$spt]['labels']['singular_name'])){ |
|
3996 | - $single_name = __($geodir_post_types[$spt]['labels']['singular_name'],'geodirectory'); |
|
3994 | + if (!$spt) {$spt = 'gd_place'; } |
|
3995 | + if (isset($geodir_post_types[$spt]['labels']['singular_name'])) { |
|
3996 | + $single_name = __($geodir_post_types[$spt]['labels']['singular_name'], 'geodirectory'); |
|
3997 | 3997 | } |
3998 | 3998 | } |
3999 | - elseif($post->post_type){ |
|
3999 | + elseif ($post->post_type) { |
|
4000 | 4000 | $geodir_post_types = get_option('geodir_post_types'); |
4001 | - if(isset($geodir_post_types[$post->post_type]['labels']['singular_name'])){ |
|
4002 | - $single_name = __($geodir_post_types[$post->post_type]['labels']['singular_name'],'geodirectory'); |
|
4001 | + if (isset($geodir_post_types[$post->post_type]['labels']['singular_name'])) { |
|
4002 | + $single_name = __($geodir_post_types[$post->post_type]['labels']['singular_name'], 'geodirectory'); |
|
4003 | 4003 | } |
4004 | 4004 | |
4005 | 4005 | |
4006 | 4006 | } |
4007 | - $title = str_replace("%%pt_single%%",$single_name,$title); |
|
4007 | + $title = str_replace("%%pt_single%%", $single_name, $title); |
|
4008 | 4008 | } |
4009 | 4009 | |
4010 | - if(strpos($title,'%%pt_plural%%') !== false){ |
|
4010 | + if (strpos($title, '%%pt_plural%%') !== false) { |
|
4011 | 4011 | $plural_name = ''; |
4012 | - if($gd_page=='search' || $gd_page=='author'){ |
|
4012 | + if ($gd_page == 'search' || $gd_page == 'author') { |
|
4013 | 4013 | $geodir_post_types = get_option('geodir_post_types'); |
4014 | 4014 | $spt = esc_attr($_REQUEST['stype']); |
4015 | - if(isset($geodir_post_types[$spt]['labels']['name'])){ |
|
4016 | - $plural_name = __($geodir_post_types[$spt]['labels']['name'],'geodirectory'); |
|
4015 | + if (isset($geodir_post_types[$spt]['labels']['name'])) { |
|
4016 | + $plural_name = __($geodir_post_types[$spt]['labels']['name'], 'geodirectory'); |
|
4017 | 4017 | } |
4018 | - }elseif($gd_page=='add-listing'){ |
|
4018 | + }elseif ($gd_page == 'add-listing') { |
|
4019 | 4019 | $geodir_post_types = get_option('geodir_post_types'); |
4020 | 4020 | $spt = sanitize_text_field($_REQUEST['listing_type']); |
4021 | - if(!$spt){$spt='gd_place';} |
|
4022 | - if(isset($geodir_post_types[$spt]['labels']['name'])){ |
|
4023 | - $plural_name = __($geodir_post_types[$spt]['labels']['name'],'geodirectory'); |
|
4021 | + if (!$spt) {$spt = 'gd_place'; } |
|
4022 | + if (isset($geodir_post_types[$spt]['labels']['name'])) { |
|
4023 | + $plural_name = __($geodir_post_types[$spt]['labels']['name'], 'geodirectory'); |
|
4024 | 4024 | } |
4025 | 4025 | } |
4026 | - elseif(isset($post->post_type) && $post->post_type){ |
|
4026 | + elseif (isset($post->post_type) && $post->post_type) { |
|
4027 | 4027 | $geodir_post_types = get_option('geodir_post_types'); |
4028 | - if(isset($geodir_post_types[$post->post_type]['labels']['name'])){ |
|
4029 | - $plural_name = __($geodir_post_types[$post->post_type]['labels']['name'],'geodirectory'); |
|
4028 | + if (isset($geodir_post_types[$post->post_type]['labels']['name'])) { |
|
4029 | + $plural_name = __($geodir_post_types[$post->post_type]['labels']['name'], 'geodirectory'); |
|
4030 | 4030 | } |
4031 | 4031 | |
4032 | 4032 | } |
4033 | - $title = str_replace("%%pt_plural%%",$plural_name,$title); |
|
4033 | + $title = str_replace("%%pt_plural%%", $plural_name, $title); |
|
4034 | 4034 | } |
4035 | 4035 | |
4036 | 4036 | |
4037 | 4037 | |
4038 | - if(strpos($title,'%%category%%') !== false){ |
|
4038 | + if (strpos($title, '%%category%%') !== false) { |
|
4039 | 4039 | $cat_name = ''; |
4040 | 4040 | |
4041 | - if($gd_page=='detail') { |
|
4041 | + if ($gd_page == 'detail') { |
|
4042 | 4042 | if ($post->default_category) { |
4043 | 4043 | $cat = get_term($post->default_category, $post->post_type . 'category'); |
4044 | 4044 | $cat_name = (isset($cat->name)) ? $cat->name : ''; |
4045 | 4045 | } |
4046 | - }elseif($gd_page=='listing'){ |
|
4046 | + }elseif ($gd_page == 'listing') { |
|
4047 | 4047 | $queried_object = get_queried_object(); |
4048 | - if(isset($queried_object->name)){ |
|
4048 | + if (isset($queried_object->name)) { |
|
4049 | 4049 | $cat_name = $queried_object->name; |
4050 | 4050 | } |
4051 | 4051 | } |
4052 | - $title = str_replace("%%category%%",$cat_name,$title); |
|
4052 | + $title = str_replace("%%category%%", $cat_name, $title); |
|
4053 | 4053 | } |
4054 | 4054 | |
4055 | - if(strpos($title,'%%tag%%') !== false){ |
|
4055 | + if (strpos($title, '%%tag%%') !== false) { |
|
4056 | 4056 | $cat_name = ''; |
4057 | 4057 | |
4058 | - if($gd_page=='detail') { |
|
4058 | + if ($gd_page == 'detail') { |
|
4059 | 4059 | if ($post->default_category) { |
4060 | 4060 | $cat = get_term($post->default_category, $post->post_type . 'category'); |
4061 | 4061 | $cat_name = (isset($cat->name)) ? $cat->name : ''; |
4062 | 4062 | } |
4063 | - }elseif($gd_page=='listing'){ |
|
4063 | + }elseif ($gd_page == 'listing') { |
|
4064 | 4064 | $queried_object = get_queried_object(); |
4065 | - if(isset($queried_object->name)){ |
|
4065 | + if (isset($queried_object->name)) { |
|
4066 | 4066 | $cat_name = $queried_object->name; |
4067 | 4067 | } |
4068 | 4068 | } |
4069 | - $title = str_replace("%%tag%%",$cat_name,$title); |
|
4069 | + $title = str_replace("%%tag%%", $cat_name, $title); |
|
4070 | 4070 | } |
4071 | 4071 | |
4072 | 4072 | |
4073 | 4073 | |
4074 | - if(strpos($title,'%%id%%') !== false){ |
|
4074 | + if (strpos($title, '%%id%%') !== false) { |
|
4075 | 4075 | $ID = (isset($post->ID)) ? $post->ID : ''; |
4076 | - $title = str_replace("%%id%%",$ID,$title); |
|
4076 | + $title = str_replace("%%id%%", $ID, $title); |
|
4077 | 4077 | } |
4078 | 4078 | |
4079 | - if(strpos($title,'%%sep%%') !== false){ |
|
4080 | - $title = str_replace("%%sep%%",$sep,$title); |
|
4079 | + if (strpos($title, '%%sep%%') !== false) { |
|
4080 | + $title = str_replace("%%sep%%", $sep, $title); |
|
4081 | 4081 | } |
4082 | 4082 | |
4083 | 4083 | |
@@ -4095,12 +4095,12 @@ discard block |
||
4095 | 4095 | * @param string $gd_page The page being filtered. |
4096 | 4096 | * @param string $sep The separator, default: `|`. |
4097 | 4097 | */ |
4098 | - $location_array = apply_filters('geodir_filter_title_variables_location_arr',$location_array,$title, $gd_page, $sep); |
|
4098 | + $location_array = apply_filters('geodir_filter_title_variables_location_arr', $location_array, $title, $gd_page, $sep); |
|
4099 | 4099 | $location_titles = array(); |
4100 | - if($gd_page=='location' && get_query_var( 'gd_country_full' )){ |
|
4101 | - if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );} |
|
4102 | - if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );} |
|
4103 | - if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );} |
|
4100 | + if ($gd_page == 'location' && get_query_var('gd_country_full')) { |
|
4101 | + if (get_query_var('gd_country_full')) {$location_array['gd_country'] = get_query_var('gd_country_full'); } |
|
4102 | + if (get_query_var('gd_region_full')) {$location_array['gd_region'] = get_query_var('gd_region_full'); } |
|
4103 | + if (get_query_var('gd_city_full')) {$location_array['gd_city'] = get_query_var('gd_city_full'); } |
|
4104 | 4104 | } |
4105 | 4105 | $location_single = ''; |
4106 | 4106 | $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : ''; |
@@ -4172,51 +4172,51 @@ discard block |
||
4172 | 4172 | } |
4173 | 4173 | |
4174 | 4174 | |
4175 | - if(strpos($title,'%%location%%') !== false){ |
|
4175 | + if (strpos($title, '%%location%%') !== false) { |
|
4176 | 4176 | $location = ''; |
4177 | - if($location_titles) { |
|
4177 | + if ($location_titles) { |
|
4178 | 4178 | $location = implode(", ", $location_titles); |
4179 | 4179 | } |
4180 | - $title = str_replace("%%location%%",$location,$title); |
|
4180 | + $title = str_replace("%%location%%", $location, $title); |
|
4181 | 4181 | } |
4182 | 4182 | |
4183 | - if(strpos($title,'%%in_location%%') !== false){ |
|
4183 | + if (strpos($title, '%%in_location%%') !== false) { |
|
4184 | 4184 | $location = ''; |
4185 | - if($location_titles) { |
|
4185 | + if ($location_titles) { |
|
4186 | 4186 | $location = __('in ', 'geodirectory') . implode(", ", $location_titles); |
4187 | 4187 | } |
4188 | - $title = str_replace("%%in_location%%",$location,$title); |
|
4188 | + $title = str_replace("%%in_location%%", $location, $title); |
|
4189 | 4189 | } |
4190 | 4190 | |
4191 | - if(strpos($title,'%%in_location_single%%') !== false){ |
|
4192 | - if($location_single) { |
|
4193 | - $location_single = __('in', 'geodirectory') . ' ' .$location_single; |
|
4191 | + if (strpos($title, '%%in_location_single%%') !== false) { |
|
4192 | + if ($location_single) { |
|
4193 | + $location_single = __('in', 'geodirectory') . ' ' . $location_single; |
|
4194 | 4194 | } |
4195 | - $title = str_replace("%%in_location_single%%",$location_single,$title); |
|
4195 | + $title = str_replace("%%in_location_single%%", $location_single, $title); |
|
4196 | 4196 | } |
4197 | 4197 | |
4198 | - if(strpos($title,'%%location_single%%') !== false){ |
|
4199 | - $title = str_replace("%%location_single%%",$location_single,$title); |
|
4198 | + if (strpos($title, '%%location_single%%') !== false) { |
|
4199 | + $title = str_replace("%%location_single%%", $location_single, $title); |
|
4200 | 4200 | } |
4201 | 4201 | |
4202 | 4202 | |
4203 | - if(strpos($title,'%%search_term%%') !== false){ |
|
4203 | + if (strpos($title, '%%search_term%%') !== false) { |
|
4204 | 4204 | $search_term = ''; |
4205 | - if(isset($_REQUEST['s'])){ |
|
4205 | + if (isset($_REQUEST['s'])) { |
|
4206 | 4206 | $search_term = esc_attr($_REQUEST['s']); |
4207 | 4207 | } |
4208 | - $title = str_replace("%%search_term%%",$search_term,$title); |
|
4208 | + $title = str_replace("%%search_term%%", $search_term, $title); |
|
4209 | 4209 | } |
4210 | 4210 | |
4211 | - if(strpos($title,'%%search_near%%') !== false){ |
|
4211 | + if (strpos($title, '%%search_near%%') !== false) { |
|
4212 | 4212 | $search_term = ''; |
4213 | - if(isset($_REQUEST['snear'])){ |
|
4213 | + if (isset($_REQUEST['snear'])) { |
|
4214 | 4214 | $search_term = esc_attr($_REQUEST['snear']); |
4215 | 4215 | } |
4216 | - $title = str_replace("%%search_near%%",$search_term,$title); |
|
4216 | + $title = str_replace("%%search_near%%", $search_term, $title); |
|
4217 | 4217 | } |
4218 | 4218 | |
4219 | - if(strpos($title,'%%name%%') !== false){ |
|
4219 | + if (strpos($title, '%%name%%') !== false) { |
|
4220 | 4220 | $author_name = get_the_author(); |
4221 | 4221 | if (!$author_name || $author_name === '') { |
4222 | 4222 | $queried_object = get_queried_object(); |
@@ -4241,9 +4241,9 @@ discard block |
||
4241 | 4241 | $title = str_replace("%%pagetotal%%", $pagetotal, $title); |
4242 | 4242 | } |
4243 | 4243 | |
4244 | - $title = wptexturize( $title ); |
|
4245 | - $title = convert_chars( $title ); |
|
4246 | - $title = esc_html( $title ); |
|
4244 | + $title = wptexturize($title); |
|
4245 | + $title = convert_chars($title); |
|
4246 | + $title = esc_html($title); |
|
4247 | 4247 | |
4248 | 4248 | /** |
4249 | 4249 | * Filter the title variables after standard ones have been filtered. |
@@ -4256,7 +4256,7 @@ discard block |
||
4256 | 4256 | * @param string $sep The separator, default: `|`. |
4257 | 4257 | */ |
4258 | 4258 | |
4259 | - return apply_filters('geodir_filter_title_variables_vars',$title,$location_array, $gd_page, $sep); |
|
4259 | + return apply_filters('geodir_filter_title_variables_vars', $title, $location_array, $gd_page, $sep); |
|
4260 | 4260 | } |
4261 | 4261 | |
4262 | 4262 | /** |
@@ -4379,7 +4379,7 @@ discard block |
||
4379 | 4379 | } |
4380 | 4380 | |
4381 | 4381 | $action = isset($_REQUEST['action']) ? sanitize_text_field($_REQUEST['action']) : ''; |
4382 | - $is_admin = is_admin() && ( !defined('DOING_AJAX' ) || ( defined('DOING_AJAX') && !DOING_AJAX ) ) ? true : false; |
|
4382 | + $is_admin = is_admin() && (!defined('DOING_AJAX') || (defined('DOING_AJAX') && !DOING_AJAX)) ? true : false; |
|
4383 | 4383 | $inline_save = $action == 'inline-save' ? true : false; |
4384 | 4384 | |
4385 | 4385 | if (empty($post->post_type) || $is_admin || $inline_save || (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)) { |
@@ -4390,7 +4390,7 @@ discard block |
||
4390 | 4390 | return; |
4391 | 4391 | } |
4392 | 4392 | |
4393 | - $user_id = (int)get_current_user_id(); |
|
4393 | + $user_id = (int) get_current_user_id(); |
|
4394 | 4394 | |
4395 | 4395 | if ($user_id > 0 && get_option('geodir_notify_post_edited') && !wp_is_post_revision($post_ID) && in_array($post->post_type, geodir_get_posttypes())) { |
4396 | 4396 | $author_id = !empty($post->post_author) ? $post->post_author : 0; |
@@ -4453,7 +4453,7 @@ discard block |
||
4453 | 4453 | |
4454 | 4454 | $nr = geodir_title_meta_pagenumbering('nr'); |
4455 | 4455 | if (isset($nr) && $nr > 0) { |
4456 | - $replacement = (string)$nr; |
|
4456 | + $replacement = (string) $nr; |
|
4457 | 4457 | } |
4458 | 4458 | |
4459 | 4459 | return $replacement; |
@@ -4472,7 +4472,7 @@ discard block |
||
4472 | 4472 | |
4473 | 4473 | $max = geodir_title_meta_pagenumbering('max'); |
4474 | 4474 | if (isset($max) && $max > 0) { |
4475 | - $replacement = (string)$max; |
|
4475 | + $replacement = (string) $max; |
|
4476 | 4476 | } |
4477 | 4477 | |
4478 | 4478 | return $replacement; |
@@ -4514,7 +4514,7 @@ discard block |
||
4514 | 4514 | } |
4515 | 4515 | |
4516 | 4516 | if (isset($post->post_content)) { |
4517 | - $max_num_pages = (substr_count($post->post_content, '<!--nextpage-->' ) + 1); |
|
4517 | + $max_num_pages = (substr_count($post->post_content, '<!--nextpage-->') + 1); |
|
4518 | 4518 | } |
4519 | 4519 | } |
4520 | 4520 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | $gd_wpseo_use = ''; |
12 | 12 | if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) { |
13 | - $gd_wpseo_use = "<b style='color:red;'>".__('Please use the WPSEO settings instead.','geodirectory')."</b><br />"; |
|
13 | + $gd_wpseo_use = "<b style='color:red;'>".__('Please use the WPSEO settings instead.','geodirectory')."</b><br />"; |
|
14 | 14 | } |
15 | 15 | |
16 | 16 | /** |
@@ -21,363 +21,363 @@ discard block |
||
21 | 21 | */ |
22 | 22 | $geodir_settings['title_meta_settings'] = apply_filters('geodir_title_meta_settings', array( |
23 | 23 | |
24 | - /* Listing Permalink Settings start */ |
|
25 | - array('name' => __('Title / Meta', 'geodirectory'), 'type' => 'no_tabs', 'desc' => 'Settings to set page title and meta', 'id' => 'geodir_title_meta_settings '), |
|
26 | - |
|
27 | - |
|
28 | - |
|
29 | - |
|
30 | - array('name' => $gd_wpseo_use.__('Available Variables', 'geodirectory'), |
|
31 | - 'desc' => __('%%title%%, %%sitename%%, %%sitedesc%%, %%excerpt%%, %%pt_single%%, %%pt_plural%%, %%category%%, %%id%%, %%sep%%, %%location%%, %%in_location%%, %%in_location_single%%, %%location_single%%, %%search_term%%, %%search_near%%, %%name%%, %%page%%, %%pagenumber%%, %%pagetotal%%', 'geodirectory'), |
|
32 | - 'type' => 'sectionstart', |
|
33 | - 'id' => 'geodir_meta_vars'), |
|
34 | - |
|
35 | - array('type' => 'sectionend', 'id' => 'geodir_meta_vars'), |
|
36 | - |
|
37 | - array('name' => __('Homepage Meta Settings', 'geodirectory'), |
|
38 | - 'type' => 'sectionstart', |
|
39 | - 'desc' => '', |
|
40 | - 'id' => 'geodir_home_meta'), |
|
41 | - |
|
42 | - array( |
|
43 | - 'name' => __('Homepage meta title', 'geodirectory'), |
|
44 | - 'desc' => __('This will use the title of the page set as frontpage if left blank.', 'geodirectory'), |
|
45 | - 'id' => 'geodir_meta_title_homepage', |
|
46 | - 'type' => 'text', |
|
47 | - 'css' => 'width:100%;', |
|
48 | - 'std' => '', |
|
49 | - 'placeholder' => '' |
|
50 | - ), |
|
51 | - |
|
52 | - array( |
|
53 | - 'name' => __('Homepage meta description', 'geodirectory'), |
|
54 | - 'desc' => __('Enter the meta description for the homepage.', 'geodirectory'), |
|
55 | - 'id' => 'geodir_meta_desc_homepage', |
|
56 | - 'type' => 'textarea', |
|
57 | - 'css' => 'width:100%;', |
|
58 | - 'std' => '' |
|
59 | - ), |
|
60 | - |
|
61 | - array('type' => 'sectionend', 'id' => 'geodir_home_meta'), |
|
62 | - |
|
63 | - // details page meta |
|
64 | - array('name' => __('Details Page Meta Settings', 'geodirectory'), |
|
65 | - 'type' => 'sectionstart', |
|
66 | - 'desc' => '', |
|
67 | - 'id' => 'geodir_details_meta'), |
|
68 | - |
|
69 | - array( |
|
70 | - 'name' => __('Details page meta title', 'geodirectory'), |
|
71 | - 'desc' => __('Enter the meta title for the details page.', 'geodirectory'), |
|
72 | - 'id' => 'geodir_meta_title_detail', |
|
73 | - 'type' => 'text', |
|
74 | - 'css' => 'width:100%;', |
|
75 | - 'std' => __('%%title%% %%sep%% %%sitename%%', 'geodirectory'), |
|
76 | - 'placeholder' => '%%title%% %%sep%% %%sitename%%' |
|
77 | - ), |
|
78 | - |
|
79 | - array( |
|
80 | - 'name' => __('Details page meta description', 'geodirectory'), |
|
81 | - 'desc' => __('Enter the meta description for the details page.', 'geodirectory'), |
|
82 | - 'id' => 'geodir_meta_desc_detail', |
|
83 | - 'type' => 'textarea', |
|
84 | - 'css' => 'width:100%;', |
|
85 | - 'std' => __('%%excerpt%%', 'geodirectory'), |
|
86 | - 'placeholder' => '%%excerpt%%' |
|
87 | - ), |
|
88 | - |
|
89 | - array('type' => 'sectionend', 'id' => 'geodir_details_meta'), |
|
90 | - |
|
91 | - // CPT page meta |
|
92 | - array('name' => __('Post Type Page Meta Settings', 'geodirectory'), |
|
93 | - 'type' => 'sectionstart', |
|
94 | - 'desc' => '', |
|
95 | - 'id' => 'geodir_pt_meta'), |
|
96 | - |
|
97 | - array( |
|
98 | - 'name' => __('Post type page meta title', 'geodirectory'), |
|
99 | - 'desc' => __('Enter the meta title for the post type pages.', 'geodirectory'), |
|
100 | - 'id' => 'geodir_meta_title_pt', |
|
101 | - 'type' => 'text', |
|
102 | - 'css' => 'width:100%;', |
|
103 | - 'std' => __('%%pt_plural%% %%in_location%% %%sep%% %%sitename%%', 'geodirectory'), |
|
104 | - 'placeholder' => '%%pt_plural%% %%in_location%% %%sep%% %%sitename%%' |
|
105 | - ), |
|
106 | - |
|
107 | - array( |
|
108 | - 'name' => __('Post type page meta description', 'geodirectory'), |
|
109 | - 'desc' => __('Enter the meta description for the post type pages.', 'geodirectory'), |
|
110 | - 'id' => 'geodir_meta_desc_pt', |
|
111 | - 'type' => 'textarea', |
|
112 | - 'css' => 'width:100%;', |
|
113 | - 'std' => __('%%pt_plural%% %%in_location%%', 'geodirectory'), |
|
114 | - 'placeholder' => '%%pt_plural%% %%in_location%%' |
|
115 | - ), |
|
116 | - |
|
117 | - array( |
|
118 | - 'name' => __('Post type page title', 'geodirectory'), |
|
119 | - 'desc' => __('Enter the title for the post type pages.', 'geodirectory'), |
|
120 | - 'id' => 'geodir_page_title_pt', |
|
121 | - 'type' => 'text', |
|
122 | - 'css' => 'width:100%;', |
|
123 | - 'std' => __('All %%pt_plural%% %%in_location_single%%', 'geodirectory'), |
|
124 | - 'placeholder' => 'All %%pt_plural%% %%in_location_single%%' |
|
125 | - ), |
|
126 | - |
|
127 | - array('type' => 'sectionend', 'id' => 'geodir_pt_meta'), |
|
128 | - |
|
129 | - // Cat listing page meta |
|
130 | - array('name' => __('Listing Page Meta Settings', 'geodirectory'), |
|
131 | - 'type' => 'sectionstart', |
|
132 | - 'desc' => '', |
|
133 | - 'id' => 'geodir_pt_meta'), |
|
134 | - |
|
135 | - array( |
|
136 | - 'name' => __('Listing page meta title', 'geodirectory'), |
|
137 | - 'desc' => __('Enter the meta title for the category listing pages.', 'geodirectory'), |
|
138 | - 'id' => 'geodir_meta_title_listing', |
|
139 | - 'type' => 'text', |
|
140 | - 'css' => 'width:100%;', |
|
141 | - 'std' => __('%%category%% %%in_location%% %%sep%% %%sitename%%', 'geodirectory'), |
|
142 | - 'placeholder' => '%%category%% %%in_location%% %%sep%% %%sitename%%' |
|
143 | - ), |
|
144 | - |
|
145 | - array( |
|
146 | - 'name' => __('Listing page meta description', 'geodirectory'), |
|
147 | - 'desc' => __('Enter the meta description for the category listing pages.', 'geodirectory'), |
|
148 | - 'id' => 'geodir_meta_desc_listing', |
|
149 | - 'type' => 'textarea', |
|
150 | - 'css' => 'width:100%;', |
|
151 | - 'std' => __('Posts related to Category: %%category%% %%in_location%%', 'geodirectory'), |
|
152 | - 'placeholder' => 'Posts related to Category: %%category%% %%in_location%%' |
|
153 | - ), |
|
154 | - |
|
155 | - array( |
|
156 | - 'name' => __('Category listing page title', 'geodirectory'), |
|
157 | - 'desc' => __('Enter the title for the category listing pages.', 'geodirectory'), |
|
158 | - 'id' => 'geodir_page_title_cat-listing', |
|
159 | - 'type' => 'text', |
|
160 | - 'css' => 'width:100%;', |
|
161 | - 'std' => __('All %%category%% %%in_location_single%%', 'geodirectory'), |
|
162 | - 'placeholder' => 'All %%category%% %%in_location_single%%' |
|
163 | - ), |
|
164 | - |
|
165 | - array( |
|
166 | - 'name' => __('Tag listing page title', 'geodirectory'), |
|
167 | - 'desc' => __('Enter the title for the tag listing pages.', 'geodirectory'), |
|
168 | - 'id' => 'geodir_page_title_tag-listing', |
|
169 | - 'type' => 'text', |
|
170 | - 'css' => 'width:100%;', |
|
171 | - 'std' => __('Tag: %%tag%% %%in_location_single%%', 'geodirectory'), |
|
172 | - 'placeholder' => 'Tag: %%tag%% %%in_location_single%%' |
|
173 | - ), |
|
174 | - |
|
175 | - array('type' => 'sectionend', 'id' => 'geodir_location_meta'), |
|
176 | - |
|
177 | - // location page meta |
|
178 | - array('name' => __('Location Page Meta Settings', 'geodirectory'), |
|
179 | - 'type' => 'sectionstart', |
|
180 | - 'desc' => '', |
|
181 | - 'id' => 'geodir_pt_meta'), |
|
182 | - |
|
183 | - array( |
|
184 | - 'name' => __('Location page meta title', 'geodirectory'), |
|
185 | - 'desc' => __('Enter the meta title for the location pages.', 'geodirectory'), |
|
186 | - 'id' => 'geodir_meta_title_location', |
|
187 | - 'type' => 'text', |
|
188 | - 'css' => 'width:100%;', |
|
189 | - 'std' => __('%%title%% %%location%% %%sep%% %%sitename%%', 'geodirectory'), |
|
190 | - 'placeholder' => '%%title%% %%location%% %%sep%% %%sitename%%' |
|
191 | - ), |
|
192 | - |
|
193 | - array( |
|
194 | - 'name' => __('Location page meta description', 'geodirectory'), |
|
195 | - 'desc' => __('Enter the meta description for the location pages.', 'geodirectory'), |
|
196 | - 'id' => 'geodir_meta_desc_location', |
|
197 | - 'type' => 'textarea', |
|
198 | - 'css' => 'width:100%;', |
|
199 | - 'std' => __('%%location%%', 'geodirectory'), |
|
200 | - 'placeholder' => '%%location%%' |
|
201 | - ), |
|
202 | - |
|
203 | - array('type' => 'sectionend', 'id' => 'geodir_location_meta'), |
|
204 | - |
|
205 | - // Search page meta |
|
206 | - array('name' => __('Search Page Meta Settings', 'geodirectory'), |
|
207 | - 'type' => 'sectionstart', |
|
208 | - 'desc' => '', |
|
209 | - 'id' => 'geodir_pt_meta'), |
|
210 | - |
|
211 | - array( |
|
212 | - 'name' => __('Search page meta title', 'geodirectory'), |
|
213 | - 'desc' => __('Enter the meta title for the search page.', 'geodirectory'), |
|
214 | - 'id' => 'geodir_meta_title_search', |
|
215 | - 'type' => 'text', |
|
216 | - 'css' => 'width:100%;', |
|
217 | - 'std' => __('%%pt_plural%% search results for %%search_term%%, Near %%search_near%% %%sep%% %%sitename%%', 'geodirectory'), |
|
218 | - 'placeholder' => '%%pt_plural%% search results for %%search_term%%, Near %%search_near%% %%sep%% %%sitename%%' |
|
219 | - ), |
|
220 | - |
|
221 | - array( |
|
222 | - 'name' => __('Search page meta description', 'geodirectory'), |
|
223 | - 'desc' => __('Enter the meta description for the search page.', 'geodirectory'), |
|
224 | - 'id' => 'geodir_meta_desc_search', |
|
225 | - 'type' => 'textarea', |
|
226 | - 'css' => 'width:100%;', |
|
227 | - 'std' => __('%%pt_plural%% search results for %%search_term%%, Near %%search_near%%', 'geodirectory'), |
|
228 | - 'placeholder' => '%%pt_plural%% search results for %%search_term%%, Near %%search_near%%' |
|
229 | - ), |
|
230 | - |
|
231 | - array('type' => 'sectionend', 'id' => 'geodir_location_meta'), |
|
232 | - |
|
233 | - //Add listing page meta |
|
234 | - array('name' => __('Add Listing Page Meta Settings', 'geodirectory'), |
|
235 | - 'type' => 'sectionstart', |
|
236 | - 'desc' => '', |
|
237 | - 'id' => 'geodir_pt_meta'), |
|
238 | - |
|
239 | - array( |
|
240 | - 'name' => __('Add listing page meta title', 'geodirectory'), |
|
241 | - 'desc' => __('Enter the meta title for the add listing page.', 'geodirectory'), |
|
242 | - 'id' => 'geodir_meta_title_add-listing', |
|
243 | - 'type' => 'text', |
|
244 | - 'css' => 'width:100%;', |
|
245 | - 'std' => __('Add %%pt_single%% %%sep%% %%sitename%%', 'geodirectory'), |
|
246 | - 'placeholder' => 'Add %%pt_single%% %%sep%% %%sitename%%' |
|
247 | - ), |
|
248 | - |
|
249 | - array( |
|
250 | - 'name' => __('Add listing page meta description', 'geodirectory'), |
|
251 | - 'desc' => __('Enter the meta description for the add listing page.', 'geodirectory'), |
|
252 | - 'id' => 'geodir_meta_desc_add-listing', |
|
253 | - 'type' => 'textarea', |
|
254 | - 'css' => 'width:100%;', |
|
255 | - 'std' => __('Add %%pt_single%%', 'geodirectory'), |
|
256 | - 'placeholder' => 'Add %%pt_single%%' |
|
257 | - ), |
|
258 | - |
|
259 | - array( |
|
260 | - 'name' => __('Add listing page title', 'geodirectory'), |
|
261 | - 'desc' => __('Enter the title for the add listing page.', 'geodirectory'), |
|
262 | - 'id' => 'geodir_page_title_add-listing', |
|
263 | - 'type' => 'text', |
|
264 | - 'css' => 'width:100%;', |
|
265 | - 'std' => __('Add %%pt_single%%', 'geodirectory'), |
|
266 | - 'placeholder' => 'Add %%pt_single%%' |
|
267 | - ), |
|
268 | - |
|
269 | - array( |
|
270 | - 'name' => __('Edit listing page title', 'geodirectory'), |
|
271 | - 'desc' => __('Enter the title for the edit listing page.', 'geodirectory'), |
|
272 | - 'id' => 'geodir_page_title_edit-listing', |
|
273 | - 'type' => 'text', |
|
274 | - 'css' => 'width:100%;', |
|
275 | - 'std' => __('Edit %%pt_single%%', 'geodirectory'), |
|
276 | - 'placeholder' => 'Edit %%pt_single%%' |
|
277 | - ), |
|
278 | - |
|
279 | - array('type' => 'sectionend', 'id' => 'geodir_location_meta'), |
|
280 | - |
|
281 | - //Author page meta |
|
282 | - array('name' => __('Author Page Meta Settings', 'geodirectory'), |
|
283 | - 'type' => 'sectionstart', |
|
284 | - 'desc' => '', |
|
285 | - 'id' => 'geodir_pt_meta'), |
|
286 | - |
|
287 | - array( |
|
288 | - 'name' => __('Author page meta title', 'geodirectory'), |
|
289 | - 'desc' => __('Enter the meta title for the author page.', 'geodirectory'), |
|
290 | - 'id' => 'geodir_meta_title_author', |
|
291 | - 'type' => 'text', |
|
292 | - 'css' => 'width:100%;', |
|
293 | - 'std' => __('Author: %%name%% %%sep%% %%sitename%%', 'geodirectory'), |
|
294 | - 'placeholder' => 'Author: %%name%% %%sep%% %%sitename%%' |
|
295 | - ), |
|
296 | - |
|
297 | - array( |
|
298 | - 'name' => __('Author page meta description', 'geodirectory'), |
|
299 | - 'desc' => __('Enter the meta description for the author page.', 'geodirectory'), |
|
300 | - 'id' => 'geodir_meta_desc_author', |
|
301 | - 'type' => 'textarea', |
|
302 | - 'css' => 'width:100%;', |
|
303 | - 'std' => '' |
|
304 | - ), |
|
305 | - |
|
306 | - array( |
|
307 | - 'name' => __('Author page title', 'geodirectory'), |
|
308 | - 'desc' => __('Enter the title for the author page.', 'geodirectory'), |
|
309 | - 'id' => 'geodir_page_title_author', |
|
310 | - 'type' => 'text', |
|
311 | - 'css' => 'width:100%;', |
|
312 | - 'std' => __('%%pt_plural%% by: %%name%%', 'geodirectory'), |
|
313 | - 'placeholder' => '%%pt_plural%% by: %%name%%' |
|
314 | - ), |
|
315 | - |
|
316 | - array( |
|
317 | - 'name' => __('Author favorite page title', 'geodirectory'), |
|
318 | - 'desc' => __('Enter the title for the author favorite page.', 'geodirectory'), |
|
319 | - 'id' => 'geodir_page_title_favorite', |
|
320 | - 'type' => 'text', |
|
321 | - 'css' => 'width:100%;', |
|
322 | - 'std' => __('%%name%%: Favorite %%pt_plural%%', 'geodirectory'), |
|
323 | - 'placeholder' => '%%name%%: Favorite %%pt_plural%%' |
|
324 | - ), |
|
325 | - |
|
326 | - array('type' => 'sectionend', 'id' => 'geodir_location_meta'), |
|
327 | - |
|
328 | - //Login page meta |
|
329 | - array('name' => __('Login Page Meta Settings', 'geodirectory'), |
|
330 | - 'type' => 'sectionstart', |
|
331 | - 'desc' => '', |
|
332 | - 'id' => 'geodir_login_meta'), |
|
333 | - |
|
334 | - array( |
|
335 | - 'name' => __('Login page meta title', 'geodirectory'), |
|
336 | - 'desc' => __('Enter the meta title for the login page.', 'geodirectory'), |
|
337 | - 'id' => 'geodir_meta_title_login', |
|
338 | - 'type' => 'text', |
|
339 | - 'css' => 'width:100%;', |
|
340 | - 'std' => __('%%title%% %%sep%% %%sitename%%', 'geodirectory'), |
|
341 | - 'placeholder' => '%%title%% %%sep%% %%sitename%%' |
|
342 | - ), |
|
343 | - |
|
344 | - array( |
|
345 | - 'name' => __('Login page meta description', 'geodirectory'), |
|
346 | - 'desc' => __('Enter the meta description for the login page.', 'geodirectory'), |
|
347 | - 'id' => 'geodir_meta_desc_login', |
|
348 | - 'type' => 'textarea', |
|
349 | - 'css' => 'width:100%;', |
|
350 | - 'std' => '' |
|
351 | - ), |
|
352 | - |
|
353 | - array('type' => 'sectionend', 'id' => 'geodir_login_meta'), |
|
354 | - |
|
355 | - //Listing success page meta |
|
356 | - array('name' => __('Listing Success Page Meta Settings', 'geodirectory'), |
|
357 | - 'type' => 'sectionstart', |
|
358 | - 'desc' => '', |
|
359 | - 'id' => 'geodir_login_meta'), |
|
360 | - |
|
361 | - array( |
|
362 | - 'name' => __('Listing success page meta title', 'geodirectory'), |
|
363 | - 'desc' => __('Enter the meta title for the listing success page.', 'geodirectory'), |
|
364 | - 'id' => 'geodir_meta_title_listing-success', |
|
365 | - 'type' => 'text', |
|
366 | - 'css' => 'width:100%;', |
|
367 | - 'std' => __('%%title%% %%sep%% %%sitename%%', 'geodirectory'), |
|
368 | - 'placeholder' => '%%title%% %%sep%% %%sitename%%' |
|
369 | - ), |
|
370 | - |
|
371 | - array( |
|
372 | - 'name' => __('Listing success page meta description', 'geodirectory'), |
|
373 | - 'desc' => __('Enter the meta description for the listing success page.', 'geodirectory'), |
|
374 | - 'id' => 'geodir_meta_desc_listing-success', |
|
375 | - 'type' => 'textarea', |
|
376 | - 'css' => 'width:100%;', |
|
377 | - 'std' => '' |
|
378 | - ), |
|
379 | - |
|
380 | - array('type' => 'sectionend', 'id' => 'geodir_login_meta'), |
|
24 | + /* Listing Permalink Settings start */ |
|
25 | + array('name' => __('Title / Meta', 'geodirectory'), 'type' => 'no_tabs', 'desc' => 'Settings to set page title and meta', 'id' => 'geodir_title_meta_settings '), |
|
26 | + |
|
27 | + |
|
28 | + |
|
29 | + |
|
30 | + array('name' => $gd_wpseo_use.__('Available Variables', 'geodirectory'), |
|
31 | + 'desc' => __('%%title%%, %%sitename%%, %%sitedesc%%, %%excerpt%%, %%pt_single%%, %%pt_plural%%, %%category%%, %%id%%, %%sep%%, %%location%%, %%in_location%%, %%in_location_single%%, %%location_single%%, %%search_term%%, %%search_near%%, %%name%%, %%page%%, %%pagenumber%%, %%pagetotal%%', 'geodirectory'), |
|
32 | + 'type' => 'sectionstart', |
|
33 | + 'id' => 'geodir_meta_vars'), |
|
34 | + |
|
35 | + array('type' => 'sectionend', 'id' => 'geodir_meta_vars'), |
|
36 | + |
|
37 | + array('name' => __('Homepage Meta Settings', 'geodirectory'), |
|
38 | + 'type' => 'sectionstart', |
|
39 | + 'desc' => '', |
|
40 | + 'id' => 'geodir_home_meta'), |
|
41 | + |
|
42 | + array( |
|
43 | + 'name' => __('Homepage meta title', 'geodirectory'), |
|
44 | + 'desc' => __('This will use the title of the page set as frontpage if left blank.', 'geodirectory'), |
|
45 | + 'id' => 'geodir_meta_title_homepage', |
|
46 | + 'type' => 'text', |
|
47 | + 'css' => 'width:100%;', |
|
48 | + 'std' => '', |
|
49 | + 'placeholder' => '' |
|
50 | + ), |
|
51 | + |
|
52 | + array( |
|
53 | + 'name' => __('Homepage meta description', 'geodirectory'), |
|
54 | + 'desc' => __('Enter the meta description for the homepage.', 'geodirectory'), |
|
55 | + 'id' => 'geodir_meta_desc_homepage', |
|
56 | + 'type' => 'textarea', |
|
57 | + 'css' => 'width:100%;', |
|
58 | + 'std' => '' |
|
59 | + ), |
|
60 | + |
|
61 | + array('type' => 'sectionend', 'id' => 'geodir_home_meta'), |
|
62 | + |
|
63 | + // details page meta |
|
64 | + array('name' => __('Details Page Meta Settings', 'geodirectory'), |
|
65 | + 'type' => 'sectionstart', |
|
66 | + 'desc' => '', |
|
67 | + 'id' => 'geodir_details_meta'), |
|
68 | + |
|
69 | + array( |
|
70 | + 'name' => __('Details page meta title', 'geodirectory'), |
|
71 | + 'desc' => __('Enter the meta title for the details page.', 'geodirectory'), |
|
72 | + 'id' => 'geodir_meta_title_detail', |
|
73 | + 'type' => 'text', |
|
74 | + 'css' => 'width:100%;', |
|
75 | + 'std' => __('%%title%% %%sep%% %%sitename%%', 'geodirectory'), |
|
76 | + 'placeholder' => '%%title%% %%sep%% %%sitename%%' |
|
77 | + ), |
|
78 | + |
|
79 | + array( |
|
80 | + 'name' => __('Details page meta description', 'geodirectory'), |
|
81 | + 'desc' => __('Enter the meta description for the details page.', 'geodirectory'), |
|
82 | + 'id' => 'geodir_meta_desc_detail', |
|
83 | + 'type' => 'textarea', |
|
84 | + 'css' => 'width:100%;', |
|
85 | + 'std' => __('%%excerpt%%', 'geodirectory'), |
|
86 | + 'placeholder' => '%%excerpt%%' |
|
87 | + ), |
|
88 | + |
|
89 | + array('type' => 'sectionend', 'id' => 'geodir_details_meta'), |
|
90 | + |
|
91 | + // CPT page meta |
|
92 | + array('name' => __('Post Type Page Meta Settings', 'geodirectory'), |
|
93 | + 'type' => 'sectionstart', |
|
94 | + 'desc' => '', |
|
95 | + 'id' => 'geodir_pt_meta'), |
|
96 | + |
|
97 | + array( |
|
98 | + 'name' => __('Post type page meta title', 'geodirectory'), |
|
99 | + 'desc' => __('Enter the meta title for the post type pages.', 'geodirectory'), |
|
100 | + 'id' => 'geodir_meta_title_pt', |
|
101 | + 'type' => 'text', |
|
102 | + 'css' => 'width:100%;', |
|
103 | + 'std' => __('%%pt_plural%% %%in_location%% %%sep%% %%sitename%%', 'geodirectory'), |
|
104 | + 'placeholder' => '%%pt_plural%% %%in_location%% %%sep%% %%sitename%%' |
|
105 | + ), |
|
106 | + |
|
107 | + array( |
|
108 | + 'name' => __('Post type page meta description', 'geodirectory'), |
|
109 | + 'desc' => __('Enter the meta description for the post type pages.', 'geodirectory'), |
|
110 | + 'id' => 'geodir_meta_desc_pt', |
|
111 | + 'type' => 'textarea', |
|
112 | + 'css' => 'width:100%;', |
|
113 | + 'std' => __('%%pt_plural%% %%in_location%%', 'geodirectory'), |
|
114 | + 'placeholder' => '%%pt_plural%% %%in_location%%' |
|
115 | + ), |
|
116 | + |
|
117 | + array( |
|
118 | + 'name' => __('Post type page title', 'geodirectory'), |
|
119 | + 'desc' => __('Enter the title for the post type pages.', 'geodirectory'), |
|
120 | + 'id' => 'geodir_page_title_pt', |
|
121 | + 'type' => 'text', |
|
122 | + 'css' => 'width:100%;', |
|
123 | + 'std' => __('All %%pt_plural%% %%in_location_single%%', 'geodirectory'), |
|
124 | + 'placeholder' => 'All %%pt_plural%% %%in_location_single%%' |
|
125 | + ), |
|
126 | + |
|
127 | + array('type' => 'sectionend', 'id' => 'geodir_pt_meta'), |
|
128 | + |
|
129 | + // Cat listing page meta |
|
130 | + array('name' => __('Listing Page Meta Settings', 'geodirectory'), |
|
131 | + 'type' => 'sectionstart', |
|
132 | + 'desc' => '', |
|
133 | + 'id' => 'geodir_pt_meta'), |
|
134 | + |
|
135 | + array( |
|
136 | + 'name' => __('Listing page meta title', 'geodirectory'), |
|
137 | + 'desc' => __('Enter the meta title for the category listing pages.', 'geodirectory'), |
|
138 | + 'id' => 'geodir_meta_title_listing', |
|
139 | + 'type' => 'text', |
|
140 | + 'css' => 'width:100%;', |
|
141 | + 'std' => __('%%category%% %%in_location%% %%sep%% %%sitename%%', 'geodirectory'), |
|
142 | + 'placeholder' => '%%category%% %%in_location%% %%sep%% %%sitename%%' |
|
143 | + ), |
|
144 | + |
|
145 | + array( |
|
146 | + 'name' => __('Listing page meta description', 'geodirectory'), |
|
147 | + 'desc' => __('Enter the meta description for the category listing pages.', 'geodirectory'), |
|
148 | + 'id' => 'geodir_meta_desc_listing', |
|
149 | + 'type' => 'textarea', |
|
150 | + 'css' => 'width:100%;', |
|
151 | + 'std' => __('Posts related to Category: %%category%% %%in_location%%', 'geodirectory'), |
|
152 | + 'placeholder' => 'Posts related to Category: %%category%% %%in_location%%' |
|
153 | + ), |
|
154 | + |
|
155 | + array( |
|
156 | + 'name' => __('Category listing page title', 'geodirectory'), |
|
157 | + 'desc' => __('Enter the title for the category listing pages.', 'geodirectory'), |
|
158 | + 'id' => 'geodir_page_title_cat-listing', |
|
159 | + 'type' => 'text', |
|
160 | + 'css' => 'width:100%;', |
|
161 | + 'std' => __('All %%category%% %%in_location_single%%', 'geodirectory'), |
|
162 | + 'placeholder' => 'All %%category%% %%in_location_single%%' |
|
163 | + ), |
|
164 | + |
|
165 | + array( |
|
166 | + 'name' => __('Tag listing page title', 'geodirectory'), |
|
167 | + 'desc' => __('Enter the title for the tag listing pages.', 'geodirectory'), |
|
168 | + 'id' => 'geodir_page_title_tag-listing', |
|
169 | + 'type' => 'text', |
|
170 | + 'css' => 'width:100%;', |
|
171 | + 'std' => __('Tag: %%tag%% %%in_location_single%%', 'geodirectory'), |
|
172 | + 'placeholder' => 'Tag: %%tag%% %%in_location_single%%' |
|
173 | + ), |
|
174 | + |
|
175 | + array('type' => 'sectionend', 'id' => 'geodir_location_meta'), |
|
176 | + |
|
177 | + // location page meta |
|
178 | + array('name' => __('Location Page Meta Settings', 'geodirectory'), |
|
179 | + 'type' => 'sectionstart', |
|
180 | + 'desc' => '', |
|
181 | + 'id' => 'geodir_pt_meta'), |
|
182 | + |
|
183 | + array( |
|
184 | + 'name' => __('Location page meta title', 'geodirectory'), |
|
185 | + 'desc' => __('Enter the meta title for the location pages.', 'geodirectory'), |
|
186 | + 'id' => 'geodir_meta_title_location', |
|
187 | + 'type' => 'text', |
|
188 | + 'css' => 'width:100%;', |
|
189 | + 'std' => __('%%title%% %%location%% %%sep%% %%sitename%%', 'geodirectory'), |
|
190 | + 'placeholder' => '%%title%% %%location%% %%sep%% %%sitename%%' |
|
191 | + ), |
|
192 | + |
|
193 | + array( |
|
194 | + 'name' => __('Location page meta description', 'geodirectory'), |
|
195 | + 'desc' => __('Enter the meta description for the location pages.', 'geodirectory'), |
|
196 | + 'id' => 'geodir_meta_desc_location', |
|
197 | + 'type' => 'textarea', |
|
198 | + 'css' => 'width:100%;', |
|
199 | + 'std' => __('%%location%%', 'geodirectory'), |
|
200 | + 'placeholder' => '%%location%%' |
|
201 | + ), |
|
202 | + |
|
203 | + array('type' => 'sectionend', 'id' => 'geodir_location_meta'), |
|
204 | + |
|
205 | + // Search page meta |
|
206 | + array('name' => __('Search Page Meta Settings', 'geodirectory'), |
|
207 | + 'type' => 'sectionstart', |
|
208 | + 'desc' => '', |
|
209 | + 'id' => 'geodir_pt_meta'), |
|
210 | + |
|
211 | + array( |
|
212 | + 'name' => __('Search page meta title', 'geodirectory'), |
|
213 | + 'desc' => __('Enter the meta title for the search page.', 'geodirectory'), |
|
214 | + 'id' => 'geodir_meta_title_search', |
|
215 | + 'type' => 'text', |
|
216 | + 'css' => 'width:100%;', |
|
217 | + 'std' => __('%%pt_plural%% search results for %%search_term%%, Near %%search_near%% %%sep%% %%sitename%%', 'geodirectory'), |
|
218 | + 'placeholder' => '%%pt_plural%% search results for %%search_term%%, Near %%search_near%% %%sep%% %%sitename%%' |
|
219 | + ), |
|
220 | + |
|
221 | + array( |
|
222 | + 'name' => __('Search page meta description', 'geodirectory'), |
|
223 | + 'desc' => __('Enter the meta description for the search page.', 'geodirectory'), |
|
224 | + 'id' => 'geodir_meta_desc_search', |
|
225 | + 'type' => 'textarea', |
|
226 | + 'css' => 'width:100%;', |
|
227 | + 'std' => __('%%pt_plural%% search results for %%search_term%%, Near %%search_near%%', 'geodirectory'), |
|
228 | + 'placeholder' => '%%pt_plural%% search results for %%search_term%%, Near %%search_near%%' |
|
229 | + ), |
|
230 | + |
|
231 | + array('type' => 'sectionend', 'id' => 'geodir_location_meta'), |
|
232 | + |
|
233 | + //Add listing page meta |
|
234 | + array('name' => __('Add Listing Page Meta Settings', 'geodirectory'), |
|
235 | + 'type' => 'sectionstart', |
|
236 | + 'desc' => '', |
|
237 | + 'id' => 'geodir_pt_meta'), |
|
238 | + |
|
239 | + array( |
|
240 | + 'name' => __('Add listing page meta title', 'geodirectory'), |
|
241 | + 'desc' => __('Enter the meta title for the add listing page.', 'geodirectory'), |
|
242 | + 'id' => 'geodir_meta_title_add-listing', |
|
243 | + 'type' => 'text', |
|
244 | + 'css' => 'width:100%;', |
|
245 | + 'std' => __('Add %%pt_single%% %%sep%% %%sitename%%', 'geodirectory'), |
|
246 | + 'placeholder' => 'Add %%pt_single%% %%sep%% %%sitename%%' |
|
247 | + ), |
|
248 | + |
|
249 | + array( |
|
250 | + 'name' => __('Add listing page meta description', 'geodirectory'), |
|
251 | + 'desc' => __('Enter the meta description for the add listing page.', 'geodirectory'), |
|
252 | + 'id' => 'geodir_meta_desc_add-listing', |
|
253 | + 'type' => 'textarea', |
|
254 | + 'css' => 'width:100%;', |
|
255 | + 'std' => __('Add %%pt_single%%', 'geodirectory'), |
|
256 | + 'placeholder' => 'Add %%pt_single%%' |
|
257 | + ), |
|
258 | + |
|
259 | + array( |
|
260 | + 'name' => __('Add listing page title', 'geodirectory'), |
|
261 | + 'desc' => __('Enter the title for the add listing page.', 'geodirectory'), |
|
262 | + 'id' => 'geodir_page_title_add-listing', |
|
263 | + 'type' => 'text', |
|
264 | + 'css' => 'width:100%;', |
|
265 | + 'std' => __('Add %%pt_single%%', 'geodirectory'), |
|
266 | + 'placeholder' => 'Add %%pt_single%%' |
|
267 | + ), |
|
268 | + |
|
269 | + array( |
|
270 | + 'name' => __('Edit listing page title', 'geodirectory'), |
|
271 | + 'desc' => __('Enter the title for the edit listing page.', 'geodirectory'), |
|
272 | + 'id' => 'geodir_page_title_edit-listing', |
|
273 | + 'type' => 'text', |
|
274 | + 'css' => 'width:100%;', |
|
275 | + 'std' => __('Edit %%pt_single%%', 'geodirectory'), |
|
276 | + 'placeholder' => 'Edit %%pt_single%%' |
|
277 | + ), |
|
278 | + |
|
279 | + array('type' => 'sectionend', 'id' => 'geodir_location_meta'), |
|
280 | + |
|
281 | + //Author page meta |
|
282 | + array('name' => __('Author Page Meta Settings', 'geodirectory'), |
|
283 | + 'type' => 'sectionstart', |
|
284 | + 'desc' => '', |
|
285 | + 'id' => 'geodir_pt_meta'), |
|
286 | + |
|
287 | + array( |
|
288 | + 'name' => __('Author page meta title', 'geodirectory'), |
|
289 | + 'desc' => __('Enter the meta title for the author page.', 'geodirectory'), |
|
290 | + 'id' => 'geodir_meta_title_author', |
|
291 | + 'type' => 'text', |
|
292 | + 'css' => 'width:100%;', |
|
293 | + 'std' => __('Author: %%name%% %%sep%% %%sitename%%', 'geodirectory'), |
|
294 | + 'placeholder' => 'Author: %%name%% %%sep%% %%sitename%%' |
|
295 | + ), |
|
296 | + |
|
297 | + array( |
|
298 | + 'name' => __('Author page meta description', 'geodirectory'), |
|
299 | + 'desc' => __('Enter the meta description for the author page.', 'geodirectory'), |
|
300 | + 'id' => 'geodir_meta_desc_author', |
|
301 | + 'type' => 'textarea', |
|
302 | + 'css' => 'width:100%;', |
|
303 | + 'std' => '' |
|
304 | + ), |
|
305 | + |
|
306 | + array( |
|
307 | + 'name' => __('Author page title', 'geodirectory'), |
|
308 | + 'desc' => __('Enter the title for the author page.', 'geodirectory'), |
|
309 | + 'id' => 'geodir_page_title_author', |
|
310 | + 'type' => 'text', |
|
311 | + 'css' => 'width:100%;', |
|
312 | + 'std' => __('%%pt_plural%% by: %%name%%', 'geodirectory'), |
|
313 | + 'placeholder' => '%%pt_plural%% by: %%name%%' |
|
314 | + ), |
|
315 | + |
|
316 | + array( |
|
317 | + 'name' => __('Author favorite page title', 'geodirectory'), |
|
318 | + 'desc' => __('Enter the title for the author favorite page.', 'geodirectory'), |
|
319 | + 'id' => 'geodir_page_title_favorite', |
|
320 | + 'type' => 'text', |
|
321 | + 'css' => 'width:100%;', |
|
322 | + 'std' => __('%%name%%: Favorite %%pt_plural%%', 'geodirectory'), |
|
323 | + 'placeholder' => '%%name%%: Favorite %%pt_plural%%' |
|
324 | + ), |
|
325 | + |
|
326 | + array('type' => 'sectionend', 'id' => 'geodir_location_meta'), |
|
327 | + |
|
328 | + //Login page meta |
|
329 | + array('name' => __('Login Page Meta Settings', 'geodirectory'), |
|
330 | + 'type' => 'sectionstart', |
|
331 | + 'desc' => '', |
|
332 | + 'id' => 'geodir_login_meta'), |
|
333 | + |
|
334 | + array( |
|
335 | + 'name' => __('Login page meta title', 'geodirectory'), |
|
336 | + 'desc' => __('Enter the meta title for the login page.', 'geodirectory'), |
|
337 | + 'id' => 'geodir_meta_title_login', |
|
338 | + 'type' => 'text', |
|
339 | + 'css' => 'width:100%;', |
|
340 | + 'std' => __('%%title%% %%sep%% %%sitename%%', 'geodirectory'), |
|
341 | + 'placeholder' => '%%title%% %%sep%% %%sitename%%' |
|
342 | + ), |
|
343 | + |
|
344 | + array( |
|
345 | + 'name' => __('Login page meta description', 'geodirectory'), |
|
346 | + 'desc' => __('Enter the meta description for the login page.', 'geodirectory'), |
|
347 | + 'id' => 'geodir_meta_desc_login', |
|
348 | + 'type' => 'textarea', |
|
349 | + 'css' => 'width:100%;', |
|
350 | + 'std' => '' |
|
351 | + ), |
|
352 | + |
|
353 | + array('type' => 'sectionend', 'id' => 'geodir_login_meta'), |
|
354 | + |
|
355 | + //Listing success page meta |
|
356 | + array('name' => __('Listing Success Page Meta Settings', 'geodirectory'), |
|
357 | + 'type' => 'sectionstart', |
|
358 | + 'desc' => '', |
|
359 | + 'id' => 'geodir_login_meta'), |
|
360 | + |
|
361 | + array( |
|
362 | + 'name' => __('Listing success page meta title', 'geodirectory'), |
|
363 | + 'desc' => __('Enter the meta title for the listing success page.', 'geodirectory'), |
|
364 | + 'id' => 'geodir_meta_title_listing-success', |
|
365 | + 'type' => 'text', |
|
366 | + 'css' => 'width:100%;', |
|
367 | + 'std' => __('%%title%% %%sep%% %%sitename%%', 'geodirectory'), |
|
368 | + 'placeholder' => '%%title%% %%sep%% %%sitename%%' |
|
369 | + ), |
|
370 | + |
|
371 | + array( |
|
372 | + 'name' => __('Listing success page meta description', 'geodirectory'), |
|
373 | + 'desc' => __('Enter the meta description for the listing success page.', 'geodirectory'), |
|
374 | + 'id' => 'geodir_meta_desc_listing-success', |
|
375 | + 'type' => 'textarea', |
|
376 | + 'css' => 'width:100%;', |
|
377 | + 'std' => '' |
|
378 | + ), |
|
379 | + |
|
380 | + array('type' => 'sectionend', 'id' => 'geodir_login_meta'), |
|
381 | 381 | |
382 | 382 | |
383 | 383 |