@@ -15,40 +15,40 @@ discard block |
||
15 | 15 | class geodir_listing_slider_widget extends WP_Widget |
16 | 16 | { |
17 | 17 | |
18 | - /** |
|
18 | + /** |
|
19 | 19 | * Register the listing slider widget. |
20 | 20 | * |
21 | 21 | * @since 1.0.0 |
22 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
22 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
23 | 23 | */ |
24 | - public function __construct() { |
|
25 | - $widget_ops = array('classname' => 'geodir_listing_slider_view', 'description' => __('GD > Listing Slider', 'geodirectory')); |
|
26 | - parent::__construct( |
|
27 | - 'listing_slider_view', // Base ID |
|
28 | - __('GD > Listing Slider', 'geodirectory'), // Name |
|
29 | - $widget_ops// Args |
|
30 | - ); |
|
31 | - } |
|
24 | + public function __construct() { |
|
25 | + $widget_ops = array('classname' => 'geodir_listing_slider_view', 'description' => __('GD > Listing Slider', 'geodirectory')); |
|
26 | + parent::__construct( |
|
27 | + 'listing_slider_view', // Base ID |
|
28 | + __('GD > Listing Slider', 'geodirectory'), // Name |
|
29 | + $widget_ops// Args |
|
30 | + ); |
|
31 | + } |
|
32 | 32 | |
33 | 33 | /** |
34 | 34 | * Front-end display content for listing slider widget. |
35 | 35 | * |
36 | 36 | * @since 1.0.0 |
37 | - * @since 1.5.1 Declare function public. |
|
37 | + * @since 1.5.1 Declare function public. |
|
38 | 38 | * |
39 | 39 | * @param array $args Widget arguments. |
40 | 40 | * @param array $instance Saved values from database. |
41 | 41 | */ |
42 | - public function widget($args, $instance) |
|
43 | - { |
|
44 | - geodir_listing_slider_widget_output($args, $instance); |
|
45 | - } |
|
42 | + public function widget($args, $instance) |
|
43 | + { |
|
44 | + geodir_listing_slider_widget_output($args, $instance); |
|
45 | + } |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * Sanitize listing slider widget form values as they are saved. |
49 | 49 | * |
50 | 50 | * @since 1.0.0 |
51 | - * @since 1.5.1 Declare function public. |
|
51 | + * @since 1.5.1 Declare function public. |
|
52 | 52 | * |
53 | 53 | * @param array $new_instance Values just sent to be saved. |
54 | 54 | * @param array $old_instance Previously saved values from database. |
@@ -56,101 +56,101 @@ discard block |
||
56 | 56 | * @return array Updated safe values to be saved. |
57 | 57 | */ |
58 | 58 | public function update($new_instance, $old_instance) |
59 | - { |
|
60 | - //save the widget |
|
61 | - $instance = $old_instance; |
|
62 | - $instance['title'] = strip_tags($new_instance['title']); |
|
63 | - $instance['post_type'] = strip_tags($new_instance['post_type']); |
|
64 | - $instance['category'] = strip_tags($new_instance['category']); |
|
65 | - $instance['post_number'] = strip_tags($new_instance['post_number']); |
|
66 | - $instance['max_show'] = strip_tags($new_instance['max_show']); |
|
67 | - $instance['slide_width'] = strip_tags($new_instance['slide_width']); |
|
68 | - $instance['show_title'] = isset($new_instance['show_title']) ? $new_instance['show_title'] : ''; |
|
69 | - $instance['slideshow'] = isset($new_instance['slideshow']) ? $new_instance['slideshow'] : ''; |
|
70 | - $instance['animationLoop'] = isset($new_instance['animationLoop']) ? $new_instance['animationLoop'] : ''; |
|
71 | - $instance['directionNav'] = isset($new_instance['directionNav']) ? $new_instance['directionNav'] : ''; |
|
72 | - $instance['slideshowSpeed'] = $new_instance['slideshowSpeed']; |
|
73 | - $instance['animationSpeed'] = $new_instance['animationSpeed']; |
|
74 | - $instance['animation'] = $new_instance['animation']; |
|
75 | - $instance['list_sort'] = isset($new_instance['list_sort']) ? $new_instance['list_sort'] : ''; |
|
76 | - $instance['show_featured_only'] = isset($new_instance['show_featured_only']) && $new_instance['show_featured_only'] ? 1 : 0; |
|
77 | - if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') |
|
78 | - $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
79 | - else |
|
80 | - $instance['add_location_filter'] = '0'; |
|
81 | - |
|
82 | - return $instance; |
|
83 | - } |
|
59 | + { |
|
60 | + //save the widget |
|
61 | + $instance = $old_instance; |
|
62 | + $instance['title'] = strip_tags($new_instance['title']); |
|
63 | + $instance['post_type'] = strip_tags($new_instance['post_type']); |
|
64 | + $instance['category'] = strip_tags($new_instance['category']); |
|
65 | + $instance['post_number'] = strip_tags($new_instance['post_number']); |
|
66 | + $instance['max_show'] = strip_tags($new_instance['max_show']); |
|
67 | + $instance['slide_width'] = strip_tags($new_instance['slide_width']); |
|
68 | + $instance['show_title'] = isset($new_instance['show_title']) ? $new_instance['show_title'] : ''; |
|
69 | + $instance['slideshow'] = isset($new_instance['slideshow']) ? $new_instance['slideshow'] : ''; |
|
70 | + $instance['animationLoop'] = isset($new_instance['animationLoop']) ? $new_instance['animationLoop'] : ''; |
|
71 | + $instance['directionNav'] = isset($new_instance['directionNav']) ? $new_instance['directionNav'] : ''; |
|
72 | + $instance['slideshowSpeed'] = $new_instance['slideshowSpeed']; |
|
73 | + $instance['animationSpeed'] = $new_instance['animationSpeed']; |
|
74 | + $instance['animation'] = $new_instance['animation']; |
|
75 | + $instance['list_sort'] = isset($new_instance['list_sort']) ? $new_instance['list_sort'] : ''; |
|
76 | + $instance['show_featured_only'] = isset($new_instance['show_featured_only']) && $new_instance['show_featured_only'] ? 1 : 0; |
|
77 | + if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') |
|
78 | + $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
79 | + else |
|
80 | + $instance['add_location_filter'] = '0'; |
|
81 | + |
|
82 | + return $instance; |
|
83 | + } |
|
84 | 84 | |
85 | 85 | /** |
86 | 86 | * Back-end listing slider widget settings form. |
87 | 87 | * |
88 | 88 | * @since 1.0.0 |
89 | - * @since 1.5.1 Declare function public. |
|
89 | + * @since 1.5.1 Declare function public. |
|
90 | 90 | * |
91 | 91 | * @param array $instance Previously saved values from database. |
92 | 92 | */ |
93 | 93 | public function form($instance) |
94 | - { |
|
94 | + { |
|
95 | 95 | |
96 | - //widgetform in backend |
|
97 | - $instance = wp_parse_args((array)$instance, |
|
98 | - array('title' => '', |
|
99 | - 'post_type' => '', |
|
100 | - 'category' => '', |
|
101 | - 'post_number' => '5', |
|
102 | - 'max_show' => '1', |
|
103 | - 'slide_width' => '', |
|
104 | - 'show_title' => '', |
|
105 | - 'slideshow' => '', |
|
106 | - 'animationLoop' => '', |
|
107 | - 'directionNav' => '', |
|
108 | - 'slideshowSpeed' => 5000, |
|
109 | - 'animationSpeed' => 600, |
|
110 | - 'animation' => '', |
|
111 | - 'list_sort' => 'latest', |
|
112 | - 'show_featured_only' => '', |
|
113 | - 'add_location_filter' => '0', |
|
114 | - ) |
|
115 | - ); |
|
96 | + //widgetform in backend |
|
97 | + $instance = wp_parse_args((array)$instance, |
|
98 | + array('title' => '', |
|
99 | + 'post_type' => '', |
|
100 | + 'category' => '', |
|
101 | + 'post_number' => '5', |
|
102 | + 'max_show' => '1', |
|
103 | + 'slide_width' => '', |
|
104 | + 'show_title' => '', |
|
105 | + 'slideshow' => '', |
|
106 | + 'animationLoop' => '', |
|
107 | + 'directionNav' => '', |
|
108 | + 'slideshowSpeed' => 5000, |
|
109 | + 'animationSpeed' => 600, |
|
110 | + 'animation' => '', |
|
111 | + 'list_sort' => 'latest', |
|
112 | + 'show_featured_only' => '', |
|
113 | + 'add_location_filter' => '0', |
|
114 | + ) |
|
115 | + ); |
|
116 | 116 | |
117 | - $title = strip_tags($instance['title']); |
|
117 | + $title = strip_tags($instance['title']); |
|
118 | 118 | |
119 | - $post_type = strip_tags($instance['post_type']); |
|
119 | + $post_type = strip_tags($instance['post_type']); |
|
120 | 120 | |
121 | - $category = strip_tags($instance['category']); |
|
121 | + $category = strip_tags($instance['category']); |
|
122 | 122 | |
123 | - $post_number = strip_tags($instance['post_number']); |
|
123 | + $post_number = strip_tags($instance['post_number']); |
|
124 | 124 | |
125 | - $max_show = strip_tags($instance['max_show']); |
|
125 | + $max_show = strip_tags($instance['max_show']); |
|
126 | 126 | |
127 | - $slide_width = strip_tags($instance['slide_width']); |
|
127 | + $slide_width = strip_tags($instance['slide_width']); |
|
128 | 128 | |
129 | - $show_title = $instance['show_title']; |
|
129 | + $show_title = $instance['show_title']; |
|
130 | 130 | |
131 | - $slideshow = $instance['slideshow']; |
|
131 | + $slideshow = $instance['slideshow']; |
|
132 | 132 | |
133 | - $animationLoop = $instance['animationLoop']; |
|
133 | + $animationLoop = $instance['animationLoop']; |
|
134 | 134 | |
135 | - $directionNav = $instance['directionNav']; |
|
135 | + $directionNav = $instance['directionNav']; |
|
136 | 136 | |
137 | - $slideshowSpeed = $instance['slideshowSpeed']; |
|
137 | + $slideshowSpeed = $instance['slideshowSpeed']; |
|
138 | 138 | |
139 | - $animationSpeed = $instance['animationSpeed']; |
|
139 | + $animationSpeed = $instance['animationSpeed']; |
|
140 | 140 | |
141 | - $add_location_filter = strip_tags($instance['add_location_filter']); |
|
141 | + $add_location_filter = strip_tags($instance['add_location_filter']); |
|
142 | 142 | |
143 | - $animation = $instance['animation']; |
|
144 | - $list_sort = $instance['list_sort']; |
|
145 | - $show_featured_only = isset($instance['show_featured_only']) && $instance['show_featured_only'] ? true : false; |
|
143 | + $animation = $instance['animation']; |
|
144 | + $list_sort = $instance['list_sort']; |
|
145 | + $show_featured_only = isset($instance['show_featured_only']) && $instance['show_featured_only'] ? true : false; |
|
146 | 146 | |
147 | - $sort_fields = array(); |
|
148 | - $sort_fields[] = array('field' => 'latest', 'label' => __('Latest', 'geodirectory')); |
|
149 | - $sort_fields[] = array('field' => 'featured', 'label' => __('Featured', 'geodirectory')); |
|
150 | - $sort_fields[] = array('field' => 'high_review', 'label' => __('Review', 'geodirectory')); |
|
151 | - $sort_fields[] = array('field' => 'high_rating', 'label' => __('Rating', 'geodirectory')); |
|
152 | - $sort_fields[] = array('field' => 'random', 'label' => __('Random', 'geodirectory')); |
|
153 | - ?> |
|
147 | + $sort_fields = array(); |
|
148 | + $sort_fields[] = array('field' => 'latest', 'label' => __('Latest', 'geodirectory')); |
|
149 | + $sort_fields[] = array('field' => 'featured', 'label' => __('Featured', 'geodirectory')); |
|
150 | + $sort_fields[] = array('field' => 'high_review', 'label' => __('Review', 'geodirectory')); |
|
151 | + $sort_fields[] = array('field' => 'high_rating', 'label' => __('Rating', 'geodirectory')); |
|
152 | + $sort_fields[] = array('field' => 'random', 'label' => __('Random', 'geodirectory')); |
|
153 | + ?> |
|
154 | 154 | |
155 | 155 | <p> |
156 | 156 | <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?> |
@@ -174,9 +174,9 @@ discard block |
||
174 | 174 | <?php foreach ($postypes as $postypes_obj) { ?> |
175 | 175 | |
176 | 176 | <option <?php if ($post_type == $postypes_obj) { |
177 | - echo 'selected="selected"'; |
|
178 | - } ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj); |
|
179 | - echo ucfirst($extvalue[1]); ?></option> |
|
177 | + echo 'selected="selected"'; |
|
178 | + } ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj); |
|
179 | + echo ucfirst($extvalue[1]); ?></option> |
|
180 | 180 | |
181 | 181 | <?php } ?> |
182 | 182 | |
@@ -190,20 +190,20 @@ discard block |
||
190 | 190 | for="<?php echo $this->get_field_id('category'); ?>"><?php _e('Post Category:', 'geodirectory');?> |
191 | 191 | |
192 | 192 | <?php |
193 | - $category_taxonomy = geodir_get_taxonomies('gd_place'); |
|
194 | - $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC')); |
|
195 | - ?> |
|
193 | + $category_taxonomy = geodir_get_taxonomies('gd_place'); |
|
194 | + $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC')); |
|
195 | + ?> |
|
196 | 196 | |
197 | 197 | <select class="widefat" id="<?php echo $this->get_field_id('category'); ?>" |
198 | 198 | name="<?php echo $this->get_field_name('category'); ?>"> |
199 | 199 | <option <?php if ($category == '0') { |
200 | - echo 'selected="selected"'; |
|
201 | - } ?> value="0"><?php _e('All', 'geodirectory'); ?></option> |
|
200 | + echo 'selected="selected"'; |
|
201 | + } ?> value="0"><?php _e('All', 'geodirectory'); ?></option> |
|
202 | 202 | <?php foreach ($categories as $category_obj) { ?> |
203 | 203 | |
204 | 204 | <option <?php if ($category == $category_obj->term_id) { |
205 | - echo 'selected="selected"'; |
|
206 | - } ?> |
|
205 | + echo 'selected="selected"'; |
|
206 | + } ?> |
|
207 | 207 | value="<?php echo $category_obj->term_id; ?>"><?php echo ucfirst($category_obj->name); ?></option> |
208 | 208 | |
209 | 209 | <?php } ?> |
@@ -256,12 +256,12 @@ discard block |
||
256 | 256 | <select class="widefat" id="<?php echo $this->get_field_id('animation'); ?>" |
257 | 257 | name="<?php echo $this->get_field_name('animation'); ?>"> |
258 | 258 | <option <?php if ($animation == 'slide') { |
259 | - echo 'selected="selected"'; |
|
260 | - } ?> value="slide">Slide |
|
259 | + echo 'selected="selected"'; |
|
260 | + } ?> value="slide">Slide |
|
261 | 261 | </option> |
262 | 262 | <option <?php if ($animation == 'fade') { |
263 | - echo 'selected="selected"'; |
|
264 | - } ?> value="fade">Fade |
|
263 | + echo 'selected="selected"'; |
|
264 | + } ?> value="fade">Fade |
|
265 | 265 | </option> |
266 | 266 | </select> |
267 | 267 | </label> |
@@ -292,8 +292,8 @@ discard block |
||
292 | 292 | for="<?php echo $this->get_field_id('slideshow'); ?>"><?php _e('SlideShow:', 'geodirectory');?> |
293 | 293 | |
294 | 294 | <input type="checkbox" <?php if ($slideshow) { |
295 | - echo 'checked="checked"'; |
|
296 | - } ?> id="<?php echo $this->get_field_id('slideshow'); ?>" value="1" |
|
295 | + echo 'checked="checked"'; |
|
296 | + } ?> id="<?php echo $this->get_field_id('slideshow'); ?>" value="1" |
|
297 | 297 | name="<?php echo $this->get_field_name('slideshow'); ?>"/> |
298 | 298 | |
299 | 299 | </label> |
@@ -304,8 +304,8 @@ discard block |
||
304 | 304 | for="<?php echo $this->get_field_id('animationLoop'); ?>"><?php _e('AnimationLoop:', 'geodirectory');?> |
305 | 305 | |
306 | 306 | <input type="checkbox" <?php if ($animationLoop) { |
307 | - echo 'checked="checked"'; |
|
308 | - } ?> id="<?php echo $this->get_field_id('animationLoop'); ?>" value="1" |
|
307 | + echo 'checked="checked"'; |
|
308 | + } ?> id="<?php echo $this->get_field_id('animationLoop'); ?>" value="1" |
|
309 | 309 | name="<?php echo $this->get_field_name('animationLoop'); ?>"/> |
310 | 310 | |
311 | 311 | </label> |
@@ -316,8 +316,8 @@ discard block |
||
316 | 316 | for="<?php echo $this->get_field_id('directionNav'); ?>"><?php _e('DirectionNav:', 'geodirectory');?> |
317 | 317 | |
318 | 318 | <input type="checkbox" <?php if ($directionNav) { |
319 | - echo 'checked="checked"'; |
|
320 | - } ?> id="<?php echo $this->get_field_id('directionNav'); ?>" value="1" |
|
319 | + echo 'checked="checked"'; |
|
320 | + } ?> id="<?php echo $this->get_field_id('directionNav'); ?>" value="1" |
|
321 | 321 | name="<?php echo $this->get_field_name('directionNav'); ?>"/> |
322 | 322 | |
323 | 323 | </label> |
@@ -329,8 +329,8 @@ discard block |
||
329 | 329 | for="<?php echo $this->get_field_id('show_title'); ?>"><?php _e('Show Title:', 'geodirectory');?> |
330 | 330 | |
331 | 331 | <input type="checkbox" <?php if ($show_title) { |
332 | - echo 'checked="checked"'; |
|
333 | - } ?> id="<?php echo $this->get_field_id('show_title'); ?>" value="1" |
|
332 | + echo 'checked="checked"'; |
|
333 | + } ?> id="<?php echo $this->get_field_id('show_title'); ?>" value="1" |
|
334 | 334 | name="<?php echo $this->get_field_name('show_title'); ?>"/> |
335 | 335 | |
336 | 336 | </label> |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | |
379 | 379 | |
380 | 380 | <?php |
381 | - } |
|
381 | + } |
|
382 | 382 | } // class geodir_listing_slider_widget |
383 | 383 | |
384 | 384 | register_widget('geodir_listing_slider_widget'); |
385 | 385 | \ No newline at end of file |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | { |
95 | 95 | |
96 | 96 | //widgetform in backend |
97 | - $instance = wp_parse_args((array)$instance, |
|
97 | + $instance = wp_parse_args((array) $instance, |
|
98 | 98 | array('title' => '', |
99 | 99 | 'post_type' => '', |
100 | 100 | 'category' => '', |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | ?> |
154 | 154 | |
155 | 155 | <p> |
156 | - <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?> |
|
156 | + <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory'); ?> |
|
157 | 157 | |
158 | 158 | <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" |
159 | 159 | name="<?php echo $this->get_field_name('title'); ?>" type="text" |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | |
164 | 164 | <p> |
165 | 165 | <label |
166 | - for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory');?> |
|
166 | + for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory'); ?> |
|
167 | 167 | |
168 | 168 | <?php $postypes = geodir_get_posttypes(); ?> |
169 | 169 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | |
188 | 188 | <p> |
189 | 189 | <label |
190 | - for="<?php echo $this->get_field_id('category'); ?>"><?php _e('Post Category:', 'geodirectory');?> |
|
190 | + for="<?php echo $this->get_field_id('category'); ?>"><?php _e('Post Category:', 'geodirectory'); ?> |
|
191 | 191 | |
192 | 192 | <?php |
193 | 193 | $category_taxonomy = geodir_get_taxonomies('gd_place'); |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | </p> |
225 | 225 | <p> |
226 | 226 | <label |
227 | - for="<?php echo $this->get_field_id('post_number'); ?>"><?php _e('Number of posts(total):', 'geodirectory');?> |
|
227 | + for="<?php echo $this->get_field_id('post_number'); ?>"><?php _e('Number of posts(total):', 'geodirectory'); ?> |
|
228 | 228 | <input class="widefat" id="<?php echo $this->get_field_id('post_number'); ?>" |
229 | 229 | name="<?php echo $this->get_field_name('post_number'); ?>" type="text" |
230 | 230 | value="<?php echo esc_attr($post_number); ?>"/> |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | |
234 | 234 | <p> |
235 | 235 | <label |
236 | - for="<?php echo $this->get_field_id('max_show'); ?>"><?php _e('Number of posts(shown at one time, requires a slide width to be set):', 'geodirectory');?> |
|
236 | + for="<?php echo $this->get_field_id('max_show'); ?>"><?php _e('Number of posts(shown at one time, requires a slide width to be set):', 'geodirectory'); ?> |
|
237 | 237 | <input class="widefat" id="<?php echo $this->get_field_id('max_show'); ?>" |
238 | 238 | name="<?php echo $this->get_field_name('max_show'); ?>" type="text" |
239 | 239 | value="<?php echo esc_attr($max_show); ?>"/> |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | |
243 | 243 | <p> |
244 | 244 | <label |
245 | - for="<?php echo $this->get_field_id('slide_width'); ?>"><?php _e('Slide width(leave blank unless showing more than one slide at a time, ex: 210):', 'geodirectory');?> |
|
245 | + for="<?php echo $this->get_field_id('slide_width'); ?>"><?php _e('Slide width(leave blank unless showing more than one slide at a time, ex: 210):', 'geodirectory'); ?> |
|
246 | 246 | <input class="widefat" id="<?php echo $this->get_field_id('slide_width'); ?>" |
247 | 247 | name="<?php echo $this->get_field_name('slide_width'); ?>" type="text" |
248 | 248 | value="<?php echo esc_attr($slide_width); ?>"/> |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | |
252 | 252 | <p> |
253 | 253 | <label |
254 | - for="<?php echo $this->get_field_id('animation'); ?>"><?php _e('Animation:', 'geodirectory');?> |
|
254 | + for="<?php echo $this->get_field_id('animation'); ?>"><?php _e('Animation:', 'geodirectory'); ?> |
|
255 | 255 | |
256 | 256 | <select class="widefat" id="<?php echo $this->get_field_id('animation'); ?>" |
257 | 257 | name="<?php echo $this->get_field_name('animation'); ?>"> |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | |
270 | 270 | <p> |
271 | 271 | <label |
272 | - for="<?php echo $this->get_field_id('slideshowSpeed'); ?>"><?php _e('Slide Show Speed: (milliseconds)', 'geodirectory');?> |
|
272 | + for="<?php echo $this->get_field_id('slideshowSpeed'); ?>"><?php _e('Slide Show Speed: (milliseconds)', 'geodirectory'); ?> |
|
273 | 273 | |
274 | 274 | <input class="widefat" id="<?php echo $this->get_field_id('slideshowSpeed'); ?>" |
275 | 275 | name="<?php echo $this->get_field_name('slideshowSpeed'); ?>" type="text" |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | |
280 | 280 | <p> |
281 | 281 | <label |
282 | - for="<?php echo $this->get_field_id('animationSpeed'); ?>"><?php _e('Animation Speed: (milliseconds)', 'geodirectory');?> |
|
282 | + for="<?php echo $this->get_field_id('animationSpeed'); ?>"><?php _e('Animation Speed: (milliseconds)', 'geodirectory'); ?> |
|
283 | 283 | |
284 | 284 | <input class="widefat" id="<?php echo $this->get_field_id('animationSpeed'); ?>" |
285 | 285 | name="<?php echo $this->get_field_name('animationSpeed'); ?>" type="text" |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | |
290 | 290 | <p> |
291 | 291 | <label |
292 | - for="<?php echo $this->get_field_id('slideshow'); ?>"><?php _e('SlideShow:', 'geodirectory');?> |
|
292 | + for="<?php echo $this->get_field_id('slideshow'); ?>"><?php _e('SlideShow:', 'geodirectory'); ?> |
|
293 | 293 | |
294 | 294 | <input type="checkbox" <?php if ($slideshow) { |
295 | 295 | echo 'checked="checked"'; |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | |
302 | 302 | <p> |
303 | 303 | <label |
304 | - for="<?php echo $this->get_field_id('animationLoop'); ?>"><?php _e('AnimationLoop:', 'geodirectory');?> |
|
304 | + for="<?php echo $this->get_field_id('animationLoop'); ?>"><?php _e('AnimationLoop:', 'geodirectory'); ?> |
|
305 | 305 | |
306 | 306 | <input type="checkbox" <?php if ($animationLoop) { |
307 | 307 | echo 'checked="checked"'; |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | |
314 | 314 | <p> |
315 | 315 | <label |
316 | - for="<?php echo $this->get_field_id('directionNav'); ?>"><?php _e('DirectionNav:', 'geodirectory');?> |
|
316 | + for="<?php echo $this->get_field_id('directionNav'); ?>"><?php _e('DirectionNav:', 'geodirectory'); ?> |
|
317 | 317 | |
318 | 318 | <input type="checkbox" <?php if ($directionNav) { |
319 | 319 | echo 'checked="checked"'; |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | |
327 | 327 | <p> |
328 | 328 | <label |
329 | - for="<?php echo $this->get_field_id('show_title'); ?>"><?php _e('Show Title:', 'geodirectory');?> |
|
329 | + for="<?php echo $this->get_field_id('show_title'); ?>"><?php _e('Show Title:', 'geodirectory'); ?> |
|
330 | 330 | |
331 | 331 | <input type="checkbox" <?php if ($show_title) { |
332 | 332 | echo 'checked="checked"'; |
@@ -345,9 +345,9 @@ discard block |
||
345 | 345 | </p> |
346 | 346 | <p> |
347 | 347 | <label for="<?php echo $this->get_field_id('add_location_filter'); ?>"> |
348 | - <?php _e('Enable Location Filter:', 'geodirectory');?> |
|
348 | + <?php _e('Enable Location Filter:', 'geodirectory'); ?> |
|
349 | 349 | <input type="checkbox" id="<?php echo $this->get_field_id('add_location_filter'); ?>" |
350 | - name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"';?> |
|
350 | + name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"'; ?> |
|
351 | 351 | value="1"/> |
352 | 352 | </label> |
353 | 353 | </p> |
@@ -368,10 +368,10 @@ discard block |
||
368 | 368 | |
369 | 369 | } |
370 | 370 | |
371 | - <?php if(is_active_widget( false, false, $this->id_base, true )){ ?> |
|
371 | + <?php if (is_active_widget(false, false, $this->id_base, true)) { ?> |
|
372 | 372 | var post_type = jQuery('#<?php echo $this->get_field_id('post_type'); ?>').val(); |
373 | 373 | |
374 | - geodir_change_category_list(post_type, '<?php echo $category;?>'); |
|
374 | + geodir_change_category_list(post_type, '<?php echo $category; ?>'); |
|
375 | 375 | <?php } ?> |
376 | 376 | |
377 | 377 | </script> |
@@ -74,10 +74,11 @@ discard block |
||
74 | 74 | $instance['animation'] = $new_instance['animation']; |
75 | 75 | $instance['list_sort'] = isset($new_instance['list_sort']) ? $new_instance['list_sort'] : ''; |
76 | 76 | $instance['show_featured_only'] = isset($new_instance['show_featured_only']) && $new_instance['show_featured_only'] ? 1 : 0; |
77 | - if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') |
|
78 | - $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
79 | - else |
|
80 | - $instance['add_location_filter'] = '0'; |
|
77 | + if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') { |
|
78 | + $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
79 | + } else { |
|
80 | + $instance['add_location_filter'] = '0'; |
|
81 | + } |
|
81 | 82 | |
82 | 83 | return $instance; |
83 | 84 | } |
@@ -339,7 +340,10 @@ discard block |
||
339 | 340 | <label |
340 | 341 | for="<?php echo $this->get_field_id('show_featured_only'); ?>"><?php _e('Show only featured listings:', 'geodirectory'); ?> |
341 | 342 | <input type="checkbox" id="<?php echo $this->get_field_id('show_featured_only'); ?>" |
342 | - name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) echo 'checked="checked"'; ?> |
|
343 | + name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) { |
|
344 | + echo 'checked="checked"'; |
|
345 | +} |
|
346 | +?> |
|
343 | 347 | value="1"/> |
344 | 348 | </label> |
345 | 349 | </p> |
@@ -347,7 +351,10 @@ discard block |
||
347 | 351 | <label for="<?php echo $this->get_field_id('add_location_filter'); ?>"> |
348 | 352 | <?php _e('Enable Location Filter:', 'geodirectory');?> |
349 | 353 | <input type="checkbox" id="<?php echo $this->get_field_id('add_location_filter'); ?>" |
350 | - name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"';?> |
|
354 | + name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) { |
|
355 | + echo 'checked="checked"'; |
|
356 | +} |
|
357 | +?> |
|
351 | 358 | value="1"/> |
352 | 359 | </label> |
353 | 360 | </p> |
@@ -24,8 +24,11 @@ discard block |
||
24 | 24 | global $current_tab; |
25 | 25 | geodir_redirect_to_admin_panel_on_installed(); |
26 | 26 | $current_tab = (isset($_GET['tab']) && $_GET['tab'] != '') ? $_GET['tab'] : 'general_settings'; |
27 | - if (!(isset($_REQUEST['action']))) // this will avoid Ajax requests |
|
28 | - geodir_handle_option_form_submit($current_tab); // located in admin function.php |
|
27 | + if (!(isset($_REQUEST['action']))) { |
|
28 | + // this will avoid Ajax requests |
|
29 | + geodir_handle_option_form_submit($current_tab); |
|
30 | + } |
|
31 | + // located in admin function.php |
|
29 | 32 | /** |
30 | 33 | * Called on the WordPress 'admin_init' hook this hookis used to call everything for the GD settings pages in the admin area. |
31 | 34 | * |
@@ -316,8 +319,9 @@ discard block |
||
316 | 319 | if (!empty($notification) && get_option('geodir_tiny_editor') == '1') { |
317 | 320 | |
318 | 321 | foreach ($notification as $key => $value) { |
319 | - if ($value['type'] == 'textarea') |
|
320 | - $notification[$key]['type'] = 'editor'; |
|
322 | + if ($value['type'] == 'textarea') { |
|
323 | + $notification[$key]['type'] = 'editor'; |
|
324 | + } |
|
321 | 325 | } |
322 | 326 | |
323 | 327 | } |
@@ -342,8 +346,9 @@ discard block |
||
342 | 346 | if (!empty($design_setting) && get_option('geodir_tiny_editor') == '1') { |
343 | 347 | |
344 | 348 | foreach ($design_setting as $key => $value) { |
345 | - if ($value['type'] == 'textarea' && $value['id'] == 'geodir_term_condition_content') |
|
346 | - $design_setting[$key]['type'] = 'editor'; |
|
349 | + if ($value['type'] == 'textarea' && $value['id'] == 'geodir_term_condition_content') { |
|
350 | + $design_setting[$key]['type'] = 'editor'; |
|
351 | + } |
|
347 | 352 | } |
348 | 353 | |
349 | 354 | } |
@@ -462,9 +467,9 @@ discard block |
||
462 | 467 | class="gd-draggable-form-items gd-<?php echo $val['field_type'];?> geodir-sort-<?php echo $val['htmlvar_name'];?>" href="javascript:void(0);"> |
463 | 468 | <?php if (isset($val['field_icon']) && strpos($val['field_icon'], 'fa fa-') !== false) { |
464 | 469 | echo '<i class="'.$val['field_icon'].'" aria-hidden="true"></i>'; |
465 | - }elseif(isset($val['field_icon']) && $val['field_icon'] ){ |
|
470 | + } elseif(isset($val['field_icon']) && $val['field_icon'] ){ |
|
466 | 471 | echo '<b style="background-image: url("'.$val['field_icon'].'")"></b>'; |
467 | - }else{ |
|
472 | + } else{ |
|
468 | 473 | echo '<i class="fa fa-cog" aria-hidden="true"></i>'; |
469 | 474 | }?> |
470 | 475 | <?php echo $val['site_title'];?> |
@@ -693,9 +698,9 @@ discard block |
||
693 | 698 | <?php |
694 | 699 | if($type=='predefined'){ |
695 | 700 | $cfs = geodir_custom_fields_predefined($listing_type); |
696 | - }elseif($type=='custom'){ |
|
701 | + } elseif($type=='custom'){ |
|
697 | 702 | $cfs = geodir_custom_fields_custom($listing_type); |
698 | - }else{ |
|
703 | + } else{ |
|
699 | 704 | $cfs = geodir_custom_fields($listing_type); |
700 | 705 | ?> |
701 | 706 | <ul class="full gd-cf-tooltip-wrap"> |
@@ -750,7 +755,7 @@ discard block |
||
750 | 755 | </li> |
751 | 756 | <?php |
752 | 757 | } |
753 | - }else{ |
|
758 | + } else{ |
|
754 | 759 | _e('There are no custom fields here yet.', 'geodirectory'); |
755 | 760 | } |
756 | 761 | ?> |
@@ -947,8 +952,9 @@ discard block |
||
947 | 952 | |
948 | 953 | if (!get_option('geodir_remove_unnecessary_fields')) { |
949 | 954 | |
950 | - if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'")) |
|
951 | - $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`"); |
|
955 | + if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'")) { |
|
956 | + $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`"); |
|
957 | + } |
|
952 | 958 | |
953 | 959 | update_option('geodir_remove_unnecessary_fields', '1'); |
954 | 960 | |
@@ -974,15 +980,17 @@ discard block |
||
974 | 980 | $geodir_admin_ajax_action = $_REQUEST['geodir_admin_ajax_action']; |
975 | 981 | switch ($geodir_admin_ajax_action) { |
976 | 982 | case 'diagnosis' : |
977 | - if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') |
|
978 | - $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
|
983 | + if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') { |
|
984 | + $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
|
985 | + } |
|
979 | 986 | call_user_func('geodir_diagnose_' . $diagnose_this); |
980 | 987 | exit(); |
981 | 988 | break; |
982 | 989 | |
983 | 990 | case 'diagnosis-fix' : |
984 | - if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') |
|
985 | - $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
|
991 | + if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') { |
|
992 | + $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
|
993 | + } |
|
986 | 994 | call_user_func('geodir_diagnose_' . $diagnose_this); |
987 | 995 | exit(); |
988 | 996 | break; |
@@ -1540,11 +1548,11 @@ discard block |
||
1540 | 1548 | ////////////////////////////////// |
1541 | 1549 | $option_value = get_option('geodir_home_page'); |
1542 | 1550 | $page = get_post($option_value); |
1543 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1551 | + if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';} |
|
1544 | 1552 | |
1545 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1546 | - $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1547 | - else { |
|
1553 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') { |
|
1554 | + $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1555 | + } else { |
|
1548 | 1556 | $is_error_during_diagnose = true; |
1549 | 1557 | $output_str .= "<li><strong>" . __('GD Home page is missing.', 'geodirectory') . "</strong></li>"; |
1550 | 1558 | if ($fix) { |
@@ -1565,11 +1573,11 @@ discard block |
||
1565 | 1573 | ////////////////////////////////// |
1566 | 1574 | $option_value = get_option('geodir_add_listing_page'); |
1567 | 1575 | $page = get_post($option_value); |
1568 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1576 | + if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';} |
|
1569 | 1577 | |
1570 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1571 | - $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1572 | - else { |
|
1578 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') { |
|
1579 | + $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1580 | + } else { |
|
1573 | 1581 | $is_error_during_diagnose = true; |
1574 | 1582 | $output_str .= "<li><strong>" . __('Add Listing page is missing.', 'geodirectory') . "</strong></li>"; |
1575 | 1583 | if ($fix) { |
@@ -1591,11 +1599,11 @@ discard block |
||
1591 | 1599 | ////////////////////////////////// |
1592 | 1600 | $option_value = get_option('geodir_preview_page'); |
1593 | 1601 | $page = get_post($option_value); |
1594 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1602 | + if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';} |
|
1595 | 1603 | |
1596 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1597 | - $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1598 | - else { |
|
1604 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') { |
|
1605 | + $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1606 | + } else { |
|
1599 | 1607 | $is_error_during_diagnose = true; |
1600 | 1608 | $output_str .= "<li><strong>" . __('Listing Preview page is missing.', 'geodirectory') . "</strong></li>"; |
1601 | 1609 | if ($fix) { |
@@ -1616,11 +1624,11 @@ discard block |
||
1616 | 1624 | ////////////////////////////////// |
1617 | 1625 | $option_value = get_option('geodir_success_page'); |
1618 | 1626 | $page = get_post($option_value); |
1619 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1627 | + if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';} |
|
1620 | 1628 | |
1621 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1622 | - $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1623 | - else { |
|
1629 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') { |
|
1630 | + $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1631 | + } else { |
|
1624 | 1632 | $is_error_during_diagnose = true; |
1625 | 1633 | $output_str .= "<li><strong>" . __('Listing Success page is missing.', 'geodirectory') . "</strong></li>"; |
1626 | 1634 | if ($fix) { |
@@ -1641,11 +1649,11 @@ discard block |
||
1641 | 1649 | ////////////////////////////////// |
1642 | 1650 | $option_value = get_option('geodir_info_page'); |
1643 | 1651 | $page = get_post($option_value); |
1644 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1652 | + if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';} |
|
1645 | 1653 | |
1646 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1647 | - $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1648 | - else { |
|
1654 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') { |
|
1655 | + $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1656 | + } else { |
|
1649 | 1657 | $is_error_during_diagnose = true; |
1650 | 1658 | $output_str .= "<li><strong>" . __('Info page is missing.', 'geodirectory') . "</strong></li>"; |
1651 | 1659 | if ($fix) { |
@@ -1666,11 +1674,11 @@ discard block |
||
1666 | 1674 | ////////////////////////////////// |
1667 | 1675 | $option_value = get_option('geodir_login_page'); |
1668 | 1676 | $page = get_post($option_value); |
1669 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1677 | + if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';} |
|
1670 | 1678 | |
1671 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1672 | - $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1673 | - else { |
|
1679 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') { |
|
1680 | + $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1681 | + } else { |
|
1674 | 1682 | $is_error_during_diagnose = true; |
1675 | 1683 | $output_str .= "<li><strong>" . __('Login page is missing.', 'geodirectory') . "</strong></li>"; |
1676 | 1684 | if ($fix) { |
@@ -1691,11 +1699,11 @@ discard block |
||
1691 | 1699 | ////////////////////////////////// |
1692 | 1700 | $option_value = get_option('geodir_location_page'); |
1693 | 1701 | $page = get_post($option_value); |
1694 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1702 | + if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';} |
|
1695 | 1703 | |
1696 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1697 | - $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1698 | - else { |
|
1704 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') { |
|
1705 | + $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1706 | + } else { |
|
1699 | 1707 | $is_error_during_diagnose = true; |
1700 | 1708 | $output_str .= "<li><strong>" . __('Location page is missing.', 'geodirectory') . "</strong></li>"; |
1701 | 1709 | if ($fix) { |
@@ -2140,8 +2148,9 @@ discard block |
||
2140 | 2148 | ); |
2141 | 2149 | |
2142 | 2150 | $post_location_info = $request_info['post_location']; |
2143 | - if ($location_id = geodir_add_new_location($post_location_info)) |
|
2144 | - $post_location_id = $location_id; |
|
2151 | + if ($location_id = geodir_add_new_location($post_location_info)) { |
|
2152 | + $post_location_id = $location_id; |
|
2153 | + } |
|
2145 | 2154 | } else { |
2146 | 2155 | $post_location_id = 0; |
2147 | 2156 | } |
@@ -2204,8 +2213,9 @@ discard block |
||
2204 | 2213 | $attachment_set = ''; |
2205 | 2214 | |
2206 | 2215 | foreach ($attachment as $key => $val) { |
2207 | - if ($val != '') |
|
2208 | - $attachment_set .= $key . " = '" . $val . "', "; |
|
2216 | + if ($val != '') { |
|
2217 | + $attachment_set .= $key . " = '" . $val . "', "; |
|
2218 | + } |
|
2209 | 2219 | } |
2210 | 2220 | $attachment_set = trim($attachment_set, ", "); |
2211 | 2221 | |
@@ -2301,8 +2311,7 @@ discard block |
||
2301 | 2311 | |
2302 | 2312 | $parts = json_decode($response['body']); |
2303 | 2313 | //print_r($parts); |
2304 | - if(!isset($parts->access_token)){echo $error_msg." - #1";exit;} |
|
2305 | - else{ |
|
2314 | + if(!isset($parts->access_token)){echo $error_msg." - #1";exit;} else{ |
|
2306 | 2315 | |
2307 | 2316 | update_option('gd_ga_access_token', $parts->access_token); |
2308 | 2317 | update_option('gd_ga_refresh_token', $parts->refresh_token); |
@@ -2310,17 +2319,16 @@ discard block |
||
2310 | 2319 | } |
2311 | 2320 | |
2312 | 2321 | |
2313 | - } |
|
2314 | - elseif(!empty($response['response']['code'])) { |
|
2322 | + } elseif(!empty($response['response']['code'])) { |
|
2315 | 2323 | $parts = json_decode($response['body']); |
2316 | 2324 | |
2317 | 2325 | if(isset($parts->error)){ |
2318 | 2326 | echo $parts->error.": ".$parts->error_description;exit; |
2319 | - }else{ |
|
2327 | + } else{ |
|
2320 | 2328 | echo $error_msg." - #2";exit; |
2321 | 2329 | } |
2322 | 2330 | |
2323 | - }else{ |
|
2331 | + } else{ |
|
2324 | 2332 | |
2325 | 2333 | echo $error_msg." - #3";exit; |
2326 | 2334 |
@@ -1844,6 +1844,7 @@ discard block |
||
1844 | 1844 | * @since 1.0.0 |
1845 | 1845 | * @package GeoDirectory |
1846 | 1846 | * @global object $current_user Current user object. |
1847 | + * @param string|null $input |
|
1847 | 1848 | * @return array Returns parsed data as array. |
1848 | 1849 | */ |
1849 | 1850 | function geodir_str_getcsv($input, $delimiter = ",", $enclosure = '"', $escape = "\\") |
@@ -2373,7 +2374,6 @@ discard block |
||
2373 | 2374 | * |
2374 | 2375 | * @since 1.6.9 |
2375 | 2376 | * |
2376 | - * @param array $settings Array of GeoDirectory general settings. |
|
2377 | 2377 | * @return array Array of settings. |
2378 | 2378 | */ |
2379 | 2379 | function geodir_uninstall_settings($general_settings) { |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
63 | 63 | function geodir_get_admin_option_form($current_tab) |
64 | 64 | { |
65 | - geodir_admin_option_form($current_tab);// defined in admin template tags.php |
|
65 | + geodir_admin_option_form($current_tab); // defined in admin template tags.php |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | add_action('geodir_update_options_compatibility_settings', 'geodir_update_options_compatibility_settings'); |
71 | 71 | add_action('geodir_update_options_default_location_settings', 'geodir_location_form_submit'); |
72 | 72 | add_action('geodir_before_admin_panel', 'geodir_before_admin_panel'); // this function is in admin_functions.php |
73 | -add_action('geodir_before_update_options', 'geodir_before_update_options',10,2); |
|
73 | +add_action('geodir_before_update_options', 'geodir_before_update_options', 10, 2); |
|
74 | 74 | |
75 | 75 | //add_action('geodir_before_admin_panel', 'geodir_autoinstall_admin_header'); |
76 | 76 | |
@@ -120,8 +120,8 @@ discard block |
||
120 | 120 | add_action('admin_panel_init', 'geodir_admin_list_columns', 2); |
121 | 121 | |
122 | 122 | /* --- insert dummy post action ---*/ |
123 | -add_action('geodir_insert_dummy_posts', 'geodir_insert_dummy_posts', 1,3); |
|
124 | -add_action('geodir_delete_dummy_posts', 'geodir_delete_dummy_posts', 1,3); |
|
123 | +add_action('geodir_insert_dummy_posts', 'geodir_insert_dummy_posts', 1, 3); |
|
124 | +add_action('geodir_delete_dummy_posts', 'geodir_delete_dummy_posts', 1, 3); |
|
125 | 125 | |
126 | 126 | |
127 | 127 | /** |
@@ -229,9 +229,9 @@ discard block |
||
229 | 229 | |
230 | 230 | // Filter-Payment-Manager |
231 | 231 | |
232 | - add_meta_box('geodir_post_images', $post_typename . ' ' . __('Attachments', 'geodirectory'), 'geodir_post_attachments', $geodir_posttype, 'side'); |
|
232 | + add_meta_box('geodir_post_images', $post_typename.' '.__('Attachments', 'geodirectory'), 'geodir_post_attachments', $geodir_posttype, 'side'); |
|
233 | 233 | |
234 | - add_meta_box('geodir_post_info', $post_typename . ' ' . __('Information', 'geodirectory'), 'geodir_post_info_setting', $geodir_posttype, 'normal', 'high'); |
|
234 | + add_meta_box('geodir_post_info', $post_typename.' '.__('Information', 'geodirectory'), 'geodir_post_info_setting', $geodir_posttype, 'normal', 'high'); |
|
235 | 235 | |
236 | 236 | // no need of this box as all fields moved to main information box |
237 | 237 | //add_meta_box( 'geodir_post_addinfo', $post_typename. ' ' .__('Additional Information' , 'geodirectory'), 'geodir_post_addinfo_setting', $geodir_posttype,'normal', 'high' ); |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | |
241 | 241 | } |
242 | 242 | |
243 | -add_action('save_post', 'geodir_post_information_save',10,2); |
|
243 | +add_action('save_post', 'geodir_post_information_save', 10, 2); |
|
244 | 244 | |
245 | 245 | |
246 | 246 | |
@@ -267,10 +267,10 @@ discard block |
||
267 | 267 | |
268 | 268 | $gd_taxonomy = geodir_get_taxonomies($geodir_post_type); |
269 | 269 | |
270 | - if(!empty($gd_taxonomy)) { |
|
270 | + if (!empty($gd_taxonomy)) { |
|
271 | 271 | foreach ($gd_taxonomy as $tax) { |
272 | 272 | |
273 | - remove_meta_box($tax . 'div', $geodir_post_type, 'normal'); |
|
273 | + remove_meta_box($tax.'div', $geodir_post_type, 'normal'); |
|
274 | 274 | |
275 | 275 | } |
276 | 276 | } |
@@ -356,14 +356,14 @@ discard block |
||
356 | 356 | add_action('geodir_manage_available_fields_predefined', 'geodir_manage_available_fields_predefined'); |
357 | 357 | add_action('geodir_manage_available_fields_custom', 'geodir_manage_available_fields_custom'); |
358 | 358 | |
359 | -function geodir_manage_available_fields_predefined($sub_tab){ |
|
360 | - if($sub_tab=='custom_fields'){ |
|
359 | +function geodir_manage_available_fields_predefined($sub_tab) { |
|
360 | + if ($sub_tab == 'custom_fields') { |
|
361 | 361 | geodir_custom_available_fields('predefined'); |
362 | 362 | } |
363 | 363 | } |
364 | 364 | |
365 | -function geodir_manage_available_fields_custom($sub_tab){ |
|
366 | - if($sub_tab=='custom_fields'){ |
|
365 | +function geodir_manage_available_fields_custom($sub_tab) { |
|
366 | + if ($sub_tab == 'custom_fields') { |
|
367 | 367 | geodir_custom_available_fields('custom'); |
368 | 368 | } |
369 | 369 | } |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | global $wpdb; |
434 | 434 | $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
435 | 435 | ?> |
436 | - <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type;?>"/> |
|
436 | + <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type; ?>"/> |
|
437 | 437 | <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>"/> |
438 | 438 | <ul> |
439 | 439 | <?php |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | |
445 | 445 | $check_html_variable = $wpdb->get_var( |
446 | 446 | $wpdb->prepare( |
447 | - "SELECT htmlvar_name FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name = %s AND post_type = %s AND field_type=%s", |
|
447 | + "SELECT htmlvar_name FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE htmlvar_name = %s AND post_type = %s AND field_type=%s", |
|
448 | 448 | array($val['htmlvar_name'], $listing_type, $val['field_type']) |
449 | 449 | ) |
450 | 450 | ); |
@@ -452,23 +452,23 @@ discard block |
||
452 | 452 | $display = $check_html_variable ? ' style="display:none;"' : ''; |
453 | 453 | ?> |
454 | 454 | |
455 | - <li class="gd-cf-tooltip-wrap" <?php echo $display;?>> |
|
455 | + <li class="gd-cf-tooltip-wrap" <?php echo $display; ?>> |
|
456 | 456 | <?php |
457 | - if(isset($val['description']) && $val['description']){ |
|
457 | + if (isset($val['description']) && $val['description']) { |
|
458 | 458 | echo '<div class="gdcf-tooltip">'.$val['description'].'</div>'; |
459 | 459 | }?> |
460 | 460 | |
461 | - <a id="gd-<?php echo $val['field_type'];?>-_-<?php echo $val['htmlvar_name'];?>" data-field-type-key="<?php echo $val['htmlvar_name'];?>" data-field-type="<?php echo $val['field_type'];?>" |
|
462 | - title="<?php echo $val['site_title'];?>" |
|
463 | - class="gd-draggable-form-items gd-<?php echo $val['field_type'];?> geodir-sort-<?php echo $val['htmlvar_name'];?>" href="javascript:void(0);"> |
|
461 | + <a id="gd-<?php echo $val['field_type']; ?>-_-<?php echo $val['htmlvar_name']; ?>" data-field-type-key="<?php echo $val['htmlvar_name']; ?>" data-field-type="<?php echo $val['field_type']; ?>" |
|
462 | + title="<?php echo $val['site_title']; ?>" |
|
463 | + class="gd-draggable-form-items gd-<?php echo $val['field_type']; ?> geodir-sort-<?php echo $val['htmlvar_name']; ?>" href="javascript:void(0);"> |
|
464 | 464 | <?php if (isset($val['field_icon']) && strpos($val['field_icon'], 'fa fa-') !== false) { |
465 | 465 | echo '<i class="'.$val['field_icon'].'" aria-hidden="true"></i>'; |
466 | - }elseif(isset($val['field_icon']) && $val['field_icon'] ){ |
|
466 | + }elseif (isset($val['field_icon']) && $val['field_icon']) { |
|
467 | 467 | echo '<b style="background-image: url("'.$val['field_icon'].'")"></b>'; |
468 | - }else{ |
|
468 | + } else { |
|
469 | 469 | echo '<i class="fa fa-cog" aria-hidden="true"></i>'; |
470 | 470 | }?> |
471 | - <?php echo $val['site_title'];?> |
|
471 | + <?php echo $val['site_title']; ?> |
|
472 | 472 | </a> |
473 | 473 | </li> |
474 | 474 | |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | <?php |
497 | 497 | global $wpdb; |
498 | 498 | |
499 | - $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE post_type = %s AND field_type != 'address' ORDER BY sort_order ASC", array($listing_type))); |
|
499 | + $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE post_type = %s AND field_type != 'address' ORDER BY sort_order ASC", array($listing_type))); |
|
500 | 500 | |
501 | 501 | if (!empty($fields)) { |
502 | 502 | foreach ($fields as $field) { |
@@ -521,14 +521,14 @@ discard block |
||
521 | 521 | * @since 1.6.9 |
522 | 522 | * @package GeoDirectory |
523 | 523 | */ |
524 | -function geodir_custom_fields_custom($post_type=''){ |
|
524 | +function geodir_custom_fields_custom($post_type = '') { |
|
525 | 525 | |
526 | 526 | $custom_fields = array(); |
527 | 527 | |
528 | 528 | /** |
529 | 529 | * @see `geodir_custom_fields` |
530 | 530 | */ |
531 | - return apply_filters('geodir_custom_fields_custom',$custom_fields,$post_type); |
|
531 | + return apply_filters('geodir_custom_fields_custom', $custom_fields, $post_type); |
|
532 | 532 | } |
533 | 533 | |
534 | 534 | |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | * @since 1.6.6 |
540 | 540 | * @package GeoDirectory |
541 | 541 | */ |
542 | -function geodir_custom_fields($post_type=''){ |
|
542 | +function geodir_custom_fields($post_type = '') { |
|
543 | 543 | |
544 | 544 | $custom_fields = array( |
545 | 545 | 'text' => array( |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | * } |
675 | 675 | * @param string $post_type The post type requested. |
676 | 676 | */ |
677 | - return apply_filters('geodir_custom_fields',$custom_fields,$post_type); |
|
677 | + return apply_filters('geodir_custom_fields', $custom_fields, $post_type); |
|
678 | 678 | } |
679 | 679 | |
680 | 680 | /** |
@@ -685,25 +685,25 @@ discard block |
||
685 | 685 | * @param string $type The custom field type, predefined, custom or blank for default |
686 | 686 | * @package GeoDirectory |
687 | 687 | */ |
688 | -function geodir_custom_available_fields($type='') |
|
688 | +function geodir_custom_available_fields($type = '') |
|
689 | 689 | { |
690 | 690 | $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
691 | 691 | ?> |
692 | - <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type;?>"/> |
|
692 | + <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type; ?>"/> |
|
693 | 693 | <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>" /> |
694 | 694 | |
695 | 695 | <?php |
696 | - if($type=='predefined'){ |
|
696 | + if ($type == 'predefined') { |
|
697 | 697 | $cfs = geodir_custom_fields_predefined($listing_type); |
698 | - }elseif($type=='custom'){ |
|
698 | + }elseif ($type == 'custom') { |
|
699 | 699 | $cfs = geodir_custom_fields_custom($listing_type); |
700 | - }else{ |
|
700 | + } else { |
|
701 | 701 | $cfs = geodir_custom_fields($listing_type); |
702 | 702 | ?> |
703 | 703 | <ul class="full gd-cf-tooltip-wrap"> |
704 | 704 | <li> |
705 | 705 | <div class="gdcf-tooltip"> |
706 | - <?php _e('This adds a section separator with a title.', 'geodirectory');?> |
|
706 | + <?php _e('This adds a section separator with a title.', 'geodirectory'); ?> |
|
707 | 707 | </div> |
708 | 708 | <a id="gt-fieldset" |
709 | 709 | class="gd-draggable-form-items gt-fieldset" |
@@ -714,7 +714,7 @@ discard block |
||
714 | 714 | |
715 | 715 | <i class="fa fa-long-arrow-left " aria-hidden="true"></i> |
716 | 716 | <i class="fa fa-long-arrow-right " aria-hidden="true"></i> |
717 | - <?php _e('Fieldset (section separator)', 'geodirectory');?> |
|
717 | + <?php _e('Fieldset (section separator)', 'geodirectory'); ?> |
|
718 | 718 | </a> |
719 | 719 | </li> |
720 | 720 | </ul> |
@@ -722,15 +722,15 @@ discard block |
||
722 | 722 | <?php |
723 | 723 | } |
724 | 724 | |
725 | - if(!empty($cfs)) { |
|
725 | + if (!empty($cfs)) { |
|
726 | 726 | |
727 | - foreach ( $cfs as $id => $cf ) { |
|
727 | + foreach ($cfs as $id => $cf) { |
|
728 | 728 | ?> |
729 | 729 | <ul> |
730 | 730 | <li class="gd-cf-tooltip-wrap"> |
731 | 731 | <?php |
732 | - if ( isset( $cf['description'] ) && $cf['description'] ) { |
|
733 | - echo '<div class="gdcf-tooltip">' . $cf['description'] . '</div>'; |
|
732 | + if (isset($cf['description']) && $cf['description']) { |
|
733 | + echo '<div class="gdcf-tooltip">'.$cf['description'].'</div>'; |
|
734 | 734 | } ?> |
735 | 735 | |
736 | 736 | <a id="gd-<?php echo $id; ?>" |
@@ -740,10 +740,10 @@ discard block |
||
740 | 740 | class="gd-draggable-form-items <?php echo $cf['class']; ?>" |
741 | 741 | href="javascript:void(0);"> |
742 | 742 | |
743 | - <?php if ( isset( $cf['icon'] ) && strpos( $cf['icon'], 'fa fa-' ) !== false ) { |
|
744 | - echo '<i class="' . $cf['icon'] . '" aria-hidden="true"></i>'; |
|
745 | - } elseif ( isset( $cf['icon'] ) && $cf['icon'] ) { |
|
746 | - echo '<b style="background-image: url("' . $cf['icon'] . '")"></b>'; |
|
743 | + <?php if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) { |
|
744 | + echo '<i class="'.$cf['icon'].'" aria-hidden="true"></i>'; |
|
745 | + } elseif (isset($cf['icon']) && $cf['icon']) { |
|
746 | + echo '<b style="background-image: url("'.$cf['icon'].'")"></b>'; |
|
747 | 747 | } else { |
748 | 748 | echo '<i class="fa fa-cog" aria-hidden="true"></i>'; |
749 | 749 | } ?> |
@@ -752,7 +752,7 @@ discard block |
||
752 | 752 | </li> |
753 | 753 | <?php |
754 | 754 | } |
755 | - }else{ |
|
755 | + } else { |
|
756 | 756 | _e('There are no custom fields here yet.', 'geodirectory'); |
757 | 757 | } |
758 | 758 | ?> |
@@ -780,7 +780,7 @@ discard block |
||
780 | 780 | <ul class="core"> |
781 | 781 | <?php |
782 | 782 | global $wpdb; |
783 | - $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type = %s ORDER BY sort_order ASC", array($listing_type))); |
|
783 | + $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE post_type = %s ORDER BY sort_order ASC", array($listing_type))); |
|
784 | 784 | |
785 | 785 | if (!empty($fields)) { |
786 | 786 | foreach ($fields as $field) { |
@@ -790,7 +790,7 @@ discard block |
||
790 | 790 | $field_type_key = $field->field_type_key; |
791 | 791 | $field_ins_upd = 'display'; |
792 | 792 | |
793 | - geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd,$field_type_key); |
|
793 | + geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd, $field_type_key); |
|
794 | 794 | } |
795 | 795 | } |
796 | 796 | ?></ul> |
@@ -868,7 +868,7 @@ discard block |
||
868 | 868 | |
869 | 869 | switch ($sub_tab) { |
870 | 870 | case 'custom_fields': |
871 | - $note = sprintf(__('Click on any box below to add a field of that type to the add %s listing form. You can use a fieldset to group your fields.', 'geodirectory'), get_post_type_singular_label($listing_type));; |
|
871 | + $note = sprintf(__('Click on any box below to add a field of that type to the add %s listing form. You can use a fieldset to group your fields.', 'geodirectory'), get_post_type_singular_label($listing_type)); ; |
|
872 | 872 | break; |
873 | 873 | |
874 | 874 | case 'sorting_options': |
@@ -922,7 +922,7 @@ discard block |
||
922 | 922 | |
923 | 923 | switch ($sub_tab) { |
924 | 924 | case 'custom_fields': |
925 | - $note = sprintf(__('Click to expand and view field related settings. You may drag and drop to arrange fields order on add %s listing form too.', 'geodirectory'), get_post_type_singular_label($listing_type));; |
|
925 | + $note = sprintf(__('Click to expand and view field related settings. You may drag and drop to arrange fields order on add %s listing form too.', 'geodirectory'), get_post_type_singular_label($listing_type)); ; |
|
926 | 926 | break; |
927 | 927 | |
928 | 928 | case 'sorting_options': |
@@ -949,8 +949,8 @@ discard block |
||
949 | 949 | |
950 | 950 | if (!get_option('geodir_remove_unnecessary_fields')) { |
951 | 951 | |
952 | - if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'")) |
|
953 | - $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`"); |
|
952 | + if ($wpdb->get_var("SHOW COLUMNS FROM ".$plugin_prefix."gd_place_detail WHERE field = 'categories'")) |
|
953 | + $wpdb->query("ALTER TABLE `".$plugin_prefix."gd_place_detail` DROP `categories`"); |
|
954 | 954 | |
955 | 955 | update_option('geodir_remove_unnecessary_fields', '1'); |
956 | 956 | |
@@ -978,14 +978,14 @@ discard block |
||
978 | 978 | case 'diagnosis' : |
979 | 979 | if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') |
980 | 980 | $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
981 | - call_user_func('geodir_diagnose_' . $diagnose_this); |
|
981 | + call_user_func('geodir_diagnose_'.$diagnose_this); |
|
982 | 982 | exit(); |
983 | 983 | break; |
984 | 984 | |
985 | 985 | case 'diagnosis-fix' : |
986 | 986 | if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') |
987 | 987 | $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
988 | - call_user_func('geodir_diagnose_' . $diagnose_this); |
|
988 | + call_user_func('geodir_diagnose_'.$diagnose_this); |
|
989 | 989 | exit(); |
990 | 990 | break; |
991 | 991 | } |
@@ -1010,50 +1010,50 @@ discard block |
||
1010 | 1010 | { |
1011 | 1011 | global $wpdb; |
1012 | 1012 | //$filter_arr['output_str'] .='###'.$table.'###'; |
1013 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0) { |
|
1014 | - $filter_arr['output_str'] .= "<li>" . __('ERROR: You did not follow instructions! Now you will need to contact support to manually fix things.', 'geodirectory') . "</li>"; |
|
1013 | + if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak2'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") > 0) { |
|
1014 | + $filter_arr['output_str'] .= "<li>".__('ERROR: You did not follow instructions! Now you will need to contact support to manually fix things.', 'geodirectory')."</li>"; |
|
1015 | 1015 | $filter_arr['is_error_during_diagnose'] = true; |
1016 | 1016 | |
1017 | - } elseif ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) { |
|
1018 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s_ms_bak table found', 'geodirectory'), $tabel_name) . "</li>"; |
|
1017 | + } elseif ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") > 0) { |
|
1018 | + $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: %s_ms_bak table found', 'geodirectory'), $tabel_name)."</li>"; |
|
1019 | 1019 | $filter_arr['is_error_during_diagnose'] = true; |
1020 | - $filter_arr['output_str'] .= "<li>" . __('IMPORTANT: This can be caused by out of date core or addons, please update core + addons before trying the fix OR YOU WILL HAVE A BAD TIME!', 'geodirectory') . "</li>"; |
|
1020 | + $filter_arr['output_str'] .= "<li>".__('IMPORTANT: This can be caused by out of date core or addons, please update core + addons before trying the fix OR YOU WILL HAVE A BAD TIME!', 'geodirectory')."</li>"; |
|
1021 | 1021 | $filter_arr['is_error_during_diagnose'] = true; |
1022 | 1022 | |
1023 | 1023 | if ($fix) { |
1024 | - $ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $table . "_ms_bak");// get backup table count |
|
1025 | - $new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table");// get new table count |
|
1024 | + $ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM ".$table."_ms_bak"); // get backup table count |
|
1025 | + $new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."$table"); // get new table count |
|
1026 | 1026 | |
1027 | 1027 | if ($ms_bak_count == $new_table_count) {// if they are the same count rename to bak2 |
1028 | 1028 | //$filter_arr['output_str'] .= "<li>".sprintf( __('-->PROBLEM: %s table count is the same as new table, contact support' , 'geodirectory'), $table )."</li>" ; |
1029 | 1029 | |
1030 | - $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename bak table to new table |
|
1030 | + $wpdb->query("RENAME TABLE ".$table."_ms_bak TO ".$table."_ms_bak2"); // rename bak table to new table |
|
1031 | 1031 | |
1032 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) { |
|
1033 | - $filter_arr['output_str'] .= "<li>" . __('-->FIXED: Renamed and backed up the tables', 'geodirectory') . "</li>"; |
|
1032 | + if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") == 0) { |
|
1033 | + $filter_arr['output_str'] .= "<li>".__('-->FIXED: Renamed and backed up the tables', 'geodirectory')."</li>"; |
|
1034 | 1034 | } else { |
1035 | - $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>"; |
|
1035 | + $filter_arr['output_str'] .= "<li>".__('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory')."</li>"; |
|
1036 | 1036 | } |
1037 | 1037 | |
1038 | 1038 | } elseif ($ms_bak_count > $new_table_count) {//if backup is greater then restore it |
1039 | 1039 | |
1040 | - $wpdb->query("RENAME TABLE " . $wpdb->prefix . "$table TO " . $table . "_ms_bak2");// rename new table to bak2 |
|
1041 | - $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $wpdb->prefix . "$table");// rename bak table to new table |
|
1040 | + $wpdb->query("RENAME TABLE ".$wpdb->prefix."$table TO ".$table."_ms_bak2"); // rename new table to bak2 |
|
1041 | + $wpdb->query("RENAME TABLE ".$table."_ms_bak TO ".$wpdb->prefix."$table"); // rename bak table to new table |
|
1042 | 1042 | |
1043 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") && $wpdb->query("SHOW TABLES LIKE '$table'") == 0) { |
|
1044 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: restored largest table %s', 'geodirectory'), $table) . "</li>"; |
|
1043 | + if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") && $wpdb->query("SHOW TABLES LIKE '$table'") == 0) { |
|
1044 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: restored largest table %s', 'geodirectory'), $table)."</li>"; |
|
1045 | 1045 | } else { |
1046 | - $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>"; |
|
1046 | + $filter_arr['output_str'] .= "<li>".__('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory')."</li>"; |
|
1047 | 1047 | } |
1048 | 1048 | |
1049 | 1049 | } elseif ($new_table_count > $ms_bak_count) {// we cant do much so rename the table to stop errors |
1050 | 1050 | |
1051 | - $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename ms_bak table to ms_bak2 |
|
1051 | + $wpdb->query("RENAME TABLE ".$table."_ms_bak TO ".$table."_ms_bak2"); // rename ms_bak table to ms_bak2 |
|
1052 | 1052 | |
1053 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) { |
|
1054 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: table %s_ms_bak renamed and backed up', 'geodirectory'), $table) . "</li>"; |
|
1053 | + if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") == 0) { |
|
1054 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: table %s_ms_bak renamed and backed up', 'geodirectory'), $table)."</li>"; |
|
1055 | 1055 | } else { |
1056 | - $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>"; |
|
1056 | + $filter_arr['output_str'] .= "<li>".__('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory')."</li>"; |
|
1057 | 1057 | } |
1058 | 1058 | |
1059 | 1059 | } |
@@ -1061,54 +1061,54 @@ discard block |
||
1061 | 1061 | } |
1062 | 1062 | |
1063 | 1063 | |
1064 | - } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) { |
|
1065 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: Two %s tables found', 'geodirectory'), $tabel_name) . "</li>"; |
|
1064 | + } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") > 0) { |
|
1065 | + $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: Two %s tables found', 'geodirectory'), $tabel_name)."</li>"; |
|
1066 | 1066 | $filter_arr['is_error_during_diagnose'] = true; |
1067 | 1067 | |
1068 | 1068 | if ($fix) { |
1069 | 1069 | if ($wpdb->get_var("SELECT COUNT(*) FROM $table") == 0) {// if first table is empty just delete it |
1070 | 1070 | if ($wpdb->query("DROP TABLE IF EXISTS $table")) { |
1071 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $table) . "</li>"; |
|
1071 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $table)."</li>"; |
|
1072 | 1072 | } else { |
1073 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $table) . "</li>"; |
|
1073 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $table)."</li>"; |
|
1074 | 1074 | } |
1075 | 1075 | |
1076 | - } elseif ($wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table") == 0) {// if main table is empty but original is not, delete main and rename original |
|
1077 | - if ($wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "$table")) { |
|
1078 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $wpdb->prefix . $table) . "</li>"; |
|
1076 | + } elseif ($wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."$table") == 0) {// if main table is empty but original is not, delete main and rename original |
|
1077 | + if ($wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."$table")) { |
|
1078 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $wpdb->prefix.$table)."</li>"; |
|
1079 | 1079 | } else { |
1080 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $wpdb->prefix . $table) . "</li>"; |
|
1080 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $wpdb->prefix.$table)."</li>"; |
|
1081 | 1081 | } |
1082 | - if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) { |
|
1083 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>"; |
|
1082 | + if ($wpdb->query("RENAME TABLE $table TO ".$wpdb->prefix."$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) { |
|
1083 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix.$table)."</li>"; |
|
1084 | 1084 | } else { |
1085 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>"; |
|
1085 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix.$table)."</li>"; |
|
1086 | 1086 | } |
1087 | 1087 | } else {// else rename the original table to _ms_bak |
1088 | - if ($wpdb->query("RENAME TABLE $table TO " . $table . "_ms_bak") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) { |
|
1089 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table contained info so we renamed %s to %s incase it is needed in future', 'geodirectory'), $table, $table . "_ms_bak") . "</li>"; |
|
1088 | + if ($wpdb->query("RENAME TABLE $table TO ".$table."_ms_bak") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) { |
|
1089 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Table contained info so we renamed %s to %s incase it is needed in future', 'geodirectory'), $table, $table."_ms_bak")."</li>"; |
|
1090 | 1090 | } else { |
1091 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Table %s could not be renamed to %s, this table has info so may need to be reviewed manually in the DB', 'geodirectory'), $table, $table . "_ms_bak") . "</li>"; |
|
1091 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Table %s could not be renamed to %s, this table has info so may need to be reviewed manually in the DB', 'geodirectory'), $table, $table."_ms_bak")."</li>"; |
|
1092 | 1092 | } |
1093 | 1093 | } |
1094 | 1094 | } |
1095 | 1095 | |
1096 | - } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) { |
|
1097 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table not converted', 'geodirectory'), $tabel_name) . "</li>"; |
|
1096 | + } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") == 0) { |
|
1097 | + $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: %s table not converted', 'geodirectory'), $tabel_name)."</li>"; |
|
1098 | 1098 | $filter_arr['is_error_during_diagnose'] = true; |
1099 | 1099 | |
1100 | 1100 | if ($fix) { |
1101 | 1101 | // if original table exists but new does not, rename |
1102 | - if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) { |
|
1103 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>"; |
|
1102 | + if ($wpdb->query("RENAME TABLE $table TO ".$wpdb->prefix."$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) { |
|
1103 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix.$table)."</li>"; |
|
1104 | 1104 | } else { |
1105 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>"; |
|
1105 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix.$table)."</li>"; |
|
1106 | 1106 | } |
1107 | 1107 | |
1108 | 1108 | } |
1109 | 1109 | |
1110 | - } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") == 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) { |
|
1111 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table does not exist', 'geodirectory'), $tabel_name) . "</li>"; |
|
1110 | + } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") == 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") == 0) { |
|
1111 | + $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: %s table does not exist', 'geodirectory'), $tabel_name)."</li>"; |
|
1112 | 1112 | $filter_arr['is_error_during_diagnose'] = true; |
1113 | 1113 | |
1114 | 1114 | if ($fix) { |
@@ -1122,11 +1122,11 @@ discard block |
||
1122 | 1122 | delete_option('geodir_custom_posts_db_version'); |
1123 | 1123 | delete_option('geodir_reviewratings_db_version'); |
1124 | 1124 | delete_option('geodiradvancesearch_db_version'); |
1125 | - $filter_arr['output_str'] .= "<li>" . __('-->TRY: Please refresh page to run table install functions', 'geodirectory') . "</li>"; |
|
1125 | + $filter_arr['output_str'] .= "<li>".__('-->TRY: Please refresh page to run table install functions', 'geodirectory')."</li>"; |
|
1126 | 1126 | } |
1127 | 1127 | |
1128 | 1128 | } else { |
1129 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('%s table converted correctly', 'geodirectory'), $tabel_name) . "</li>"; |
|
1129 | + $filter_arr['output_str'] .= "<li>".sprintf(__('%s table converted correctly', 'geodirectory'), $tabel_name)."</li>"; |
|
1130 | 1130 | } |
1131 | 1131 | return $filter_arr; |
1132 | 1132 | } |
@@ -1155,23 +1155,23 @@ discard block |
||
1155 | 1155 | if (!empty($all_postypes)) { |
1156 | 1156 | foreach ($all_postypes as $key) { |
1157 | 1157 | // update each GD CPT |
1158 | - $posts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d"); |
|
1158 | + $posts = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."geodir_".$key."_detail d"); |
|
1159 | 1159 | |
1160 | 1160 | if (!empty($posts)) { |
1161 | 1161 | |
1162 | 1162 | foreach ($posts as $p) { |
1163 | 1163 | $p->post_type = $key; |
1164 | - $raw_tags = wp_get_object_terms($p->post_id, $p->post_type . '_tags', array('fields' => 'names')); |
|
1164 | + $raw_tags = wp_get_object_terms($p->post_id, $p->post_type.'_tags', array('fields' => 'names')); |
|
1165 | 1165 | if (empty($raw_tags)) { |
1166 | 1166 | $post_tags = ''; |
1167 | 1167 | } else { |
1168 | 1168 | $post_tags = implode(",", $raw_tags); |
1169 | 1169 | } |
1170 | - $tablename = $plugin_prefix . $p->post_type . '_detail'; |
|
1171 | - $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id)); |
|
1170 | + $tablename = $plugin_prefix.$p->post_type.'_detail'; |
|
1171 | + $wpdb->query($wpdb->prepare("UPDATE ".$tablename." SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id)); |
|
1172 | 1172 | |
1173 | 1173 | } |
1174 | - $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>"; |
|
1174 | + $output_str .= "<li>".$key.__(': Done', 'geodirectory')."</li>"; |
|
1175 | 1175 | } |
1176 | 1176 | |
1177 | 1177 | } |
@@ -1180,7 +1180,7 @@ discard block |
||
1180 | 1180 | |
1181 | 1181 | if ($is_error_during_diagnose) { |
1182 | 1182 | $info_div_class = "geodir_problem_info"; |
1183 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />"; |
|
1183 | + $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />"; |
|
1184 | 1184 | } else { |
1185 | 1185 | $info_div_class = "geodir_noproblem_info"; |
1186 | 1186 | $fix_button_txt = ''; |
@@ -1217,29 +1217,29 @@ discard block |
||
1217 | 1217 | if (!empty($all_postypes)) { |
1218 | 1218 | foreach ($all_postypes as $key) { |
1219 | 1219 | // update each GD CTP |
1220 | - $posts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d WHERE d." . $key . "category='' "); |
|
1220 | + $posts = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."geodir_".$key."_detail d WHERE d.".$key."category='' "); |
|
1221 | 1221 | |
1222 | 1222 | if (!empty($posts)) { |
1223 | 1223 | |
1224 | 1224 | foreach ($posts as $p) { |
1225 | 1225 | $p->post_type = $key; |
1226 | - $raw_cats = wp_get_object_terms($p->post_id, $p->post_type . 'category', array('fields' => 'ids')); |
|
1226 | + $raw_cats = wp_get_object_terms($p->post_id, $p->post_type.'category', array('fields' => 'ids')); |
|
1227 | 1227 | |
1228 | 1228 | if (empty($raw_cats)) { |
1229 | 1229 | $post_categories = get_post_meta($p->post_id, 'post_categories', true); |
1230 | 1230 | |
1231 | - if (!empty($post_categories) && !empty($post_categories[$p->post_type . 'category'])) { |
|
1232 | - $post_categories[$p->post_type . 'category'] = str_replace("d:", "", $post_categories[$p->post_type . 'category']); |
|
1233 | - foreach (explode(",", $post_categories[$p->post_type . 'category']) as $cat_part) { |
|
1231 | + if (!empty($post_categories) && !empty($post_categories[$p->post_type.'category'])) { |
|
1232 | + $post_categories[$p->post_type.'category'] = str_replace("d:", "", $post_categories[$p->post_type.'category']); |
|
1233 | + foreach (explode(",", $post_categories[$p->post_type.'category']) as $cat_part) { |
|
1234 | 1234 | if (is_numeric($cat_part)) { |
1235 | - $raw_cats[] = (int)$cat_part; |
|
1235 | + $raw_cats[] = (int) $cat_part; |
|
1236 | 1236 | } |
1237 | 1237 | } |
1238 | 1238 | |
1239 | 1239 | } |
1240 | 1240 | |
1241 | 1241 | if (!empty($raw_cats)) { |
1242 | - $term_taxonomy_ids = wp_set_object_terms($p->post_id, $raw_cats, $p->post_type . 'category'); |
|
1242 | + $term_taxonomy_ids = wp_set_object_terms($p->post_id, $raw_cats, $p->post_type.'category'); |
|
1243 | 1243 | |
1244 | 1244 | } |
1245 | 1245 | |
@@ -1249,14 +1249,14 @@ discard block |
||
1249 | 1249 | if (empty($raw_cats)) { |
1250 | 1250 | $post_cats = ''; |
1251 | 1251 | } else { |
1252 | - $post_cats = ',' . implode(",", $raw_cats) . ','; |
|
1252 | + $post_cats = ','.implode(",", $raw_cats).','; |
|
1253 | 1253 | } |
1254 | - $tablename = $plugin_prefix . $p->post_type . '_detail'; |
|
1255 | - $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET " . $p->post_type . "category=%s WHERE post_id =%d", $post_cats, $p->post_id)); |
|
1254 | + $tablename = $plugin_prefix.$p->post_type.'_detail'; |
|
1255 | + $wpdb->query($wpdb->prepare("UPDATE ".$tablename." SET ".$p->post_type."category=%s WHERE post_id =%d", $post_cats, $p->post_id)); |
|
1256 | 1256 | } |
1257 | 1257 | |
1258 | 1258 | } |
1259 | - $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>"; |
|
1259 | + $output_str .= "<li>".$key.__(': Done', 'geodirectory')."</li>"; |
|
1260 | 1260 | |
1261 | 1261 | } |
1262 | 1262 | |
@@ -1264,7 +1264,7 @@ discard block |
||
1264 | 1264 | |
1265 | 1265 | if ($is_error_during_diagnose) { |
1266 | 1266 | $info_div_class = "geodir_problem_info"; |
1267 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />"; |
|
1267 | + $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />"; |
|
1268 | 1268 | } else { |
1269 | 1269 | $info_div_class = "geodir_noproblem_info"; |
1270 | 1270 | $fix_button_txt = ''; |
@@ -1317,15 +1317,15 @@ discard block |
||
1317 | 1317 | if (!empty($ver_arr)) { |
1318 | 1318 | foreach ($ver_arr as $key => $val) { |
1319 | 1319 | if (delete_option($val)) { |
1320 | - $output_str .= "<li>" . $key . __(' Version: Deleted', 'geodirectory') . "</li>"; |
|
1320 | + $output_str .= "<li>".$key.__(' Version: Deleted', 'geodirectory')."</li>"; |
|
1321 | 1321 | } else { |
1322 | - $output_str .= "<li>" . $key . __(' Version: Not Found', 'geodirectory') . "</li>"; |
|
1322 | + $output_str .= "<li>".$key.__(' Version: Not Found', 'geodirectory')."</li>"; |
|
1323 | 1323 | } |
1324 | 1324 | |
1325 | 1325 | } |
1326 | 1326 | |
1327 | 1327 | if ($output_str) { |
1328 | - $output_str .= "<li><strong>" . __(' Upgrade/install scripts will run on next page reload.', 'geodirectory') . "</strong></li>"; |
|
1328 | + $output_str .= "<li><strong>".__(' Upgrade/install scripts will run on next page reload.', 'geodirectory')."</strong></li>"; |
|
1329 | 1329 | } |
1330 | 1330 | |
1331 | 1331 | } |
@@ -1362,43 +1362,43 @@ discard block |
||
1362 | 1362 | $output_str = ''; |
1363 | 1363 | |
1364 | 1364 | // check review locations |
1365 | - if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE post_city='' OR post_city IS NULL OR post_latitude='' OR post_latitude IS NULL")) { |
|
1366 | - $output_str .= "<li>" . __('Review locations missing or broken', 'geodirectory') . "</li>"; |
|
1365 | + if ($wpdb->get_results("SELECT * FROM ".GEODIR_REVIEW_TABLE." WHERE post_city='' OR post_city IS NULL OR post_latitude='' OR post_latitude IS NULL")) { |
|
1366 | + $output_str .= "<li>".__('Review locations missing or broken', 'geodirectory')."</li>"; |
|
1367 | 1367 | $is_error_during_diagnose = true; |
1368 | 1368 | |
1369 | 1369 | if ($fix) { |
1370 | 1370 | if (geodir_fix_review_location()) { |
1371 | - $output_str .= "<li><strong>" . __('-->FIXED: Review locations fixed', 'geodirectory') . "</strong></li>"; |
|
1371 | + $output_str .= "<li><strong>".__('-->FIXED: Review locations fixed', 'geodirectory')."</strong></li>"; |
|
1372 | 1372 | } else { |
1373 | - $output_str .= "<li><strong>" . __('-->FAILED: Review locations fix failed', 'geodirectory') . "</strong></li>"; |
|
1373 | + $output_str .= "<li><strong>".__('-->FAILED: Review locations fix failed', 'geodirectory')."</strong></li>"; |
|
1374 | 1374 | } |
1375 | 1375 | } |
1376 | 1376 | |
1377 | 1377 | } else { |
1378 | - $output_str .= "<li>" . __('Review locations ok', 'geodirectory') . "</li>"; |
|
1378 | + $output_str .= "<li>".__('Review locations ok', 'geodirectory')."</li>"; |
|
1379 | 1379 | } |
1380 | 1380 | |
1381 | 1381 | // check review content |
1382 | - if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_content IS NULL")) { |
|
1383 | - $output_str .= "<li>" . __('Review content missing or broken', 'geodirectory') . "</li>"; |
|
1382 | + if ($wpdb->get_results("SELECT * FROM ".GEODIR_REVIEW_TABLE." WHERE comment_content IS NULL")) { |
|
1383 | + $output_str .= "<li>".__('Review content missing or broken', 'geodirectory')."</li>"; |
|
1384 | 1384 | $is_error_during_diagnose = true; |
1385 | 1385 | |
1386 | 1386 | if ($fix) { |
1387 | 1387 | if (geodir_fix_review_content()) { |
1388 | - $output_str .= "<li><strong>" . __('-->FIXED: Review content fixed', 'geodirectory') . "</strong></li>"; |
|
1388 | + $output_str .= "<li><strong>".__('-->FIXED: Review content fixed', 'geodirectory')."</strong></li>"; |
|
1389 | 1389 | } else { |
1390 | - $output_str .= "<li><strong>" . __('-->FAILED: Review content fix failed', 'geodirectory') . "</strong></li>"; |
|
1390 | + $output_str .= "<li><strong>".__('-->FAILED: Review content fix failed', 'geodirectory')."</strong></li>"; |
|
1391 | 1391 | } |
1392 | 1392 | } |
1393 | 1393 | |
1394 | 1394 | } else { |
1395 | - $output_str .= "<li>" . __('Review content ok', 'geodirectory') . "</li>"; |
|
1395 | + $output_str .= "<li>".__('Review content ok', 'geodirectory')."</li>"; |
|
1396 | 1396 | } |
1397 | 1397 | |
1398 | 1398 | |
1399 | 1399 | if ($is_error_during_diagnose) { |
1400 | 1400 | $info_div_class = "geodir_problem_info"; |
1401 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />"; |
|
1401 | + $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />"; |
|
1402 | 1402 | } else { |
1403 | 1403 | $info_div_class = "geodir_noproblem_info"; |
1404 | 1404 | $fix_button_txt = ''; |
@@ -1462,7 +1462,7 @@ discard block |
||
1462 | 1462 | |
1463 | 1463 | if ($is_error_during_diagnose) { |
1464 | 1464 | $info_div_class = "geodir_problem_info"; |
1465 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='multisite_conversion' />"; |
|
1465 | + $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='multisite_conversion' />"; |
|
1466 | 1466 | } else { |
1467 | 1467 | $info_div_class = "geodir_noproblem_info"; |
1468 | 1468 | $fix_button_txt = ''; |
@@ -1496,7 +1496,7 @@ discard block |
||
1496 | 1496 | else { |
1497 | 1497 | $page_found = $wpdb->get_var( |
1498 | 1498 | $wpdb->prepare( |
1499 | - "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;", |
|
1499 | + "SELECT ID FROM ".$wpdb->posts." WHERE post_name = %s LIMIT 1;", |
|
1500 | 1500 | array($slug) |
1501 | 1501 | ) |
1502 | 1502 | ); |
@@ -1542,18 +1542,18 @@ discard block |
||
1542 | 1542 | ////////////////////////////////// |
1543 | 1543 | $option_value = get_option('geodir_home_page'); |
1544 | 1544 | $page = get_post($option_value); |
1545 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1545 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; } |
|
1546 | 1546 | |
1547 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1548 | - $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1547 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
1548 | + $output_str .= "<li>".__('GD Home page exists with proper setting.', 'geodirectory')."</li>"; |
|
1549 | 1549 | else { |
1550 | 1550 | $is_error_during_diagnose = true; |
1551 | - $output_str .= "<li><strong>" . __('GD Home page is missing.', 'geodirectory') . "</strong></li>"; |
|
1551 | + $output_str .= "<li><strong>".__('GD Home page is missing.', 'geodirectory')."</strong></li>"; |
|
1552 | 1552 | if ($fix) { |
1553 | 1553 | if (geodir_fix_virtual_page('gd-home', __('GD Home page', 'geodirectory'), $page_found, 'geodir_home_page')) { |
1554 | - $output_str .= "<li><strong>" . __('-->FIXED: GD Home page fixed', 'geodirectory') . "</strong></li>"; |
|
1554 | + $output_str .= "<li><strong>".__('-->FIXED: GD Home page fixed', 'geodirectory')."</strong></li>"; |
|
1555 | 1555 | } else { |
1556 | - $output_str .= "<li><strong>" . __('-->FAILED: GD Home page fix failed', 'geodirectory') . "</strong></li>"; |
|
1556 | + $output_str .= "<li><strong>".__('-->FAILED: GD Home page fix failed', 'geodirectory')."</strong></li>"; |
|
1557 | 1557 | } |
1558 | 1558 | } |
1559 | 1559 | } |
@@ -1567,18 +1567,18 @@ discard block |
||
1567 | 1567 | ////////////////////////////////// |
1568 | 1568 | $option_value = get_option('geodir_add_listing_page'); |
1569 | 1569 | $page = get_post($option_value); |
1570 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1570 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; } |
|
1571 | 1571 | |
1572 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1573 | - $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1572 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
1573 | + $output_str .= "<li>".__('Add Listing page exists with proper setting.', 'geodirectory')."</li>"; |
|
1574 | 1574 | else { |
1575 | 1575 | $is_error_during_diagnose = true; |
1576 | - $output_str .= "<li><strong>" . __('Add Listing page is missing.', 'geodirectory') . "</strong></li>"; |
|
1576 | + $output_str .= "<li><strong>".__('Add Listing page is missing.', 'geodirectory')."</strong></li>"; |
|
1577 | 1577 | if ($fix) { |
1578 | 1578 | if (geodir_fix_virtual_page('add-listing', __('Add Listing', 'geodirectory'), $page_found, 'geodir_add_listing_page')) { |
1579 | - $output_str .= "<li><strong>" . __('-->FIXED: Add Listing page fixed', 'geodirectory') . "</strong></li>"; |
|
1579 | + $output_str .= "<li><strong>".__('-->FIXED: Add Listing page fixed', 'geodirectory')."</strong></li>"; |
|
1580 | 1580 | } else { |
1581 | - $output_str .= "<li><strong>" . __('-->FAILED: Add Listing page fix failed', 'geodirectory') . "</strong></li>"; |
|
1581 | + $output_str .= "<li><strong>".__('-->FAILED: Add Listing page fix failed', 'geodirectory')."</strong></li>"; |
|
1582 | 1582 | } |
1583 | 1583 | } |
1584 | 1584 | } |
@@ -1593,18 +1593,18 @@ discard block |
||
1593 | 1593 | ////////////////////////////////// |
1594 | 1594 | $option_value = get_option('geodir_preview_page'); |
1595 | 1595 | $page = get_post($option_value); |
1596 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1596 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; } |
|
1597 | 1597 | |
1598 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1599 | - $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1598 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
1599 | + $output_str .= "<li>".__('Listing Preview page exists with proper setting.', 'geodirectory')."</li>"; |
|
1600 | 1600 | else { |
1601 | 1601 | $is_error_during_diagnose = true; |
1602 | - $output_str .= "<li><strong>" . __('Listing Preview page is missing.', 'geodirectory') . "</strong></li>"; |
|
1602 | + $output_str .= "<li><strong>".__('Listing Preview page is missing.', 'geodirectory')."</strong></li>"; |
|
1603 | 1603 | if ($fix) { |
1604 | 1604 | if (geodir_fix_virtual_page('listing-preview', __('Listing Preview', 'geodirectory'), $page_found, 'geodir_preview_page')) { |
1605 | - $output_str .= "<li><strong>" . __('-->FIXED: Listing Preview page fixed', 'geodirectory') . "</strong></li>"; |
|
1605 | + $output_str .= "<li><strong>".__('-->FIXED: Listing Preview page fixed', 'geodirectory')."</strong></li>"; |
|
1606 | 1606 | } else { |
1607 | - $output_str .= "<li><strong>" . __('-->FAILED: Listing Preview page fix failed', 'geodirectory') . "</strong></li>"; |
|
1607 | + $output_str .= "<li><strong>".__('-->FAILED: Listing Preview page fix failed', 'geodirectory')."</strong></li>"; |
|
1608 | 1608 | } |
1609 | 1609 | } |
1610 | 1610 | } |
@@ -1618,18 +1618,18 @@ discard block |
||
1618 | 1618 | ////////////////////////////////// |
1619 | 1619 | $option_value = get_option('geodir_success_page'); |
1620 | 1620 | $page = get_post($option_value); |
1621 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1621 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; } |
|
1622 | 1622 | |
1623 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1624 | - $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1623 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
1624 | + $output_str .= "<li>".__('Listing Success page exists with proper setting.', 'geodirectory')."</li>"; |
|
1625 | 1625 | else { |
1626 | 1626 | $is_error_during_diagnose = true; |
1627 | - $output_str .= "<li><strong>" . __('Listing Success page is missing.', 'geodirectory') . "</strong></li>"; |
|
1627 | + $output_str .= "<li><strong>".__('Listing Success page is missing.', 'geodirectory')."</strong></li>"; |
|
1628 | 1628 | if ($fix) { |
1629 | 1629 | if (geodir_fix_virtual_page('listing-success', __('Listing Success', 'geodirectory'), $page_found, 'geodir_success_page')) { |
1630 | - $output_str .= "<li><strong>" . __('-->FIXED: Listing Success page fixed', 'geodirectory') . "</strong></li>"; |
|
1630 | + $output_str .= "<li><strong>".__('-->FIXED: Listing Success page fixed', 'geodirectory')."</strong></li>"; |
|
1631 | 1631 | } else { |
1632 | - $output_str .= "<li><strong>" . __('-->FAILED: Listing Success page fix failed', 'geodirectory') . "</strong></li>"; |
|
1632 | + $output_str .= "<li><strong>".__('-->FAILED: Listing Success page fix failed', 'geodirectory')."</strong></li>"; |
|
1633 | 1633 | } |
1634 | 1634 | } |
1635 | 1635 | } |
@@ -1643,18 +1643,18 @@ discard block |
||
1643 | 1643 | ////////////////////////////////// |
1644 | 1644 | $option_value = get_option('geodir_info_page'); |
1645 | 1645 | $page = get_post($option_value); |
1646 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1646 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; } |
|
1647 | 1647 | |
1648 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1649 | - $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1648 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
1649 | + $output_str .= "<li>".__('Info page exists with proper setting.', 'geodirectory')."</li>"; |
|
1650 | 1650 | else { |
1651 | 1651 | $is_error_during_diagnose = true; |
1652 | - $output_str .= "<li><strong>" . __('Info page is missing.', 'geodirectory') . "</strong></li>"; |
|
1652 | + $output_str .= "<li><strong>".__('Info page is missing.', 'geodirectory')."</strong></li>"; |
|
1653 | 1653 | if ($fix) { |
1654 | 1654 | if (geodir_fix_virtual_page('gd-info', __('Info', 'geodirectory'), $page_found, 'geodir_info_page')) { |
1655 | - $output_str .= "<li><strong>" . __('-->FIXED: Info page fixed', 'geodirectory') . "</strong></li>"; |
|
1655 | + $output_str .= "<li><strong>".__('-->FIXED: Info page fixed', 'geodirectory')."</strong></li>"; |
|
1656 | 1656 | } else { |
1657 | - $output_str .= "<li><strong>" . __('-->FAILED: Info page fix failed', 'geodirectory') . "</strong></li>"; |
|
1657 | + $output_str .= "<li><strong>".__('-->FAILED: Info page fix failed', 'geodirectory')."</strong></li>"; |
|
1658 | 1658 | } |
1659 | 1659 | } |
1660 | 1660 | } |
@@ -1668,18 +1668,18 @@ discard block |
||
1668 | 1668 | ////////////////////////////////// |
1669 | 1669 | $option_value = get_option('geodir_login_page'); |
1670 | 1670 | $page = get_post($option_value); |
1671 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1671 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; } |
|
1672 | 1672 | |
1673 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1674 | - $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1673 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
1674 | + $output_str .= "<li>".__('Login page exists with proper setting.', 'geodirectory')."</li>"; |
|
1675 | 1675 | else { |
1676 | 1676 | $is_error_during_diagnose = true; |
1677 | - $output_str .= "<li><strong>" . __('Login page is missing.', 'geodirectory') . "</strong></li>"; |
|
1677 | + $output_str .= "<li><strong>".__('Login page is missing.', 'geodirectory')."</strong></li>"; |
|
1678 | 1678 | if ($fix) { |
1679 | 1679 | if (geodir_fix_virtual_page('gd-login', __('Login', 'geodirectory'), $page_found, 'geodir_login_page')) { |
1680 | - $output_str .= "<li><strong>" . __('-->FIXED: Login page fixed', 'geodirectory') . "</strong></li>"; |
|
1680 | + $output_str .= "<li><strong>".__('-->FIXED: Login page fixed', 'geodirectory')."</strong></li>"; |
|
1681 | 1681 | } else { |
1682 | - $output_str .= "<li><strong>" . __('-->FAILED: Login page fix failed', 'geodirectory') . "</strong></li>"; |
|
1682 | + $output_str .= "<li><strong>".__('-->FAILED: Login page fix failed', 'geodirectory')."</strong></li>"; |
|
1683 | 1683 | } |
1684 | 1684 | } |
1685 | 1685 | } |
@@ -1693,18 +1693,18 @@ discard block |
||
1693 | 1693 | ////////////////////////////////// |
1694 | 1694 | $option_value = get_option('geodir_location_page'); |
1695 | 1695 | $page = get_post($option_value); |
1696 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1696 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; } |
|
1697 | 1697 | |
1698 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1699 | - $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1698 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
1699 | + $output_str .= "<li>".__('Location page exists with proper setting.', 'geodirectory')."</li>"; |
|
1700 | 1700 | else { |
1701 | 1701 | $is_error_during_diagnose = true; |
1702 | - $output_str .= "<li><strong>" . __('Location page is missing.', 'geodirectory') . "</strong></li>"; |
|
1702 | + $output_str .= "<li><strong>".__('Location page is missing.', 'geodirectory')."</strong></li>"; |
|
1703 | 1703 | if ($fix) { |
1704 | 1704 | if (geodir_fix_virtual_page('location', __('Location', 'geodirectory'), $page_found, 'geodir_location_page')) { |
1705 | - $output_str .= "<li><strong>" . __('-->FIXED: Location page fixed', 'geodirectory') . "</strong></li>"; |
|
1705 | + $output_str .= "<li><strong>".__('-->FIXED: Location page fixed', 'geodirectory')."</strong></li>"; |
|
1706 | 1706 | } else { |
1707 | - $output_str .= "<li><strong>" . __('-->FAILED: Location page fix failed', 'geodirectory') . "</strong></li>"; |
|
1707 | + $output_str .= "<li><strong>".__('-->FAILED: Location page fix failed', 'geodirectory')."</strong></li>"; |
|
1708 | 1708 | } |
1709 | 1709 | } |
1710 | 1710 | } |
@@ -1713,13 +1713,13 @@ discard block |
||
1713 | 1713 | /* Diagnose Location Page Ends */ |
1714 | 1714 | //////////////////////////////// |
1715 | 1715 | |
1716 | - $page_chk_arr = array('output_str'=>$output_str,'is_error_during_diagnose'=>$is_error_during_diagnose ); |
|
1716 | + $page_chk_arr = array('output_str'=>$output_str, 'is_error_during_diagnose'=>$is_error_during_diagnose); |
|
1717 | 1717 | /** |
1718 | 1718 | * This action is called at the end of the GD Tools page check function. |
1719 | 1719 | * |
1720 | 1720 | * @since 1.5.2 |
1721 | 1721 | */ |
1722 | - $page_chk_arr = apply_filters('geodir_diagnose_default_pages',$page_chk_arr); |
|
1722 | + $page_chk_arr = apply_filters('geodir_diagnose_default_pages', $page_chk_arr); |
|
1723 | 1723 | |
1724 | 1724 | $output_str = $page_chk_arr['output_str']; |
1725 | 1725 | $is_error_during_diagnose = $page_chk_arr['is_error_during_diagnose']; |
@@ -1729,7 +1729,7 @@ discard block |
||
1729 | 1729 | flush_rewrite_rules(); |
1730 | 1730 | } |
1731 | 1731 | $info_div_class = "geodir_problem_info"; |
1732 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='default_pages' />"; |
|
1732 | + $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='default_pages' />"; |
|
1733 | 1733 | } else { |
1734 | 1734 | $info_div_class = "geodir_noproblem_info"; |
1735 | 1735 | $fix_button_txt = ''; |
@@ -1757,10 +1757,10 @@ discard block |
||
1757 | 1757 | $fix_button_txt = ''; |
1758 | 1758 | |
1759 | 1759 | if ($is_error_during_diagnose) { |
1760 | - $output_str .= "<li>" . __('Fail to load custom fields in to file for translation, please check file permission:', 'geodirectory') . ' ' . geodir_plugin_path() . '/db-language.php' . "</li>"; |
|
1760 | + $output_str .= "<li>".__('Fail to load custom fields in to file for translation, please check file permission:', 'geodirectory').' '.geodir_plugin_path().'/db-language.php'."</li>"; |
|
1761 | 1761 | $info_div_class = "geodir_problem_info"; |
1762 | 1762 | } else { |
1763 | - $output_str .= "<li>" . __('Load custom fields in to file for translation: ok', 'geodirectory') . "</li>"; |
|
1763 | + $output_str .= "<li>".__('Load custom fields in to file for translation: ok', 'geodirectory')."</li>"; |
|
1764 | 1764 | $info_div_class = "geodir_noproblem_info"; |
1765 | 1765 | $fix_button_txt = ''; |
1766 | 1766 | } |
@@ -1802,17 +1802,17 @@ discard block |
||
1802 | 1802 | global $wpdb, $wp_query, $plugin_prefix; |
1803 | 1803 | |
1804 | 1804 | if (is_admin() && !empty($wp_query->query_vars) && !empty($wp_query->query_vars['is_geodir_loop']) && !empty($wp_query->query_vars['orderby']) && $wp_query->query_vars['orderby'] == 'expire' && !empty($wp_query->query_vars['post_type']) && in_array($wp_query->query_vars['post_type'], geodir_get_posttypes()) && !empty($wp_query->query_vars['orderby']) && isset($clauses['join']) && isset($clauses['orderby']) && isset($clauses['fields'])) { |
1805 | - $table = $plugin_prefix . $wp_query->query_vars['post_type'] . '_detail'; |
|
1805 | + $table = $plugin_prefix.$wp_query->query_vars['post_type'].'_detail'; |
|
1806 | 1806 | |
1807 | - $join = $clauses['join'] . ' INNER JOIN ' . $table . ' AS gd_posts ON (gd_posts.post_id = ' . $wpdb->posts . '.ID)'; |
|
1807 | + $join = $clauses['join'].' INNER JOIN '.$table.' AS gd_posts ON (gd_posts.post_id = '.$wpdb->posts.'.ID)'; |
|
1808 | 1808 | $clauses['join'] = $join; |
1809 | 1809 | |
1810 | - $fields = $clauses['fields'] != '' ? $clauses['fields'] . ', ' : ''; |
|
1810 | + $fields = $clauses['fields'] != '' ? $clauses['fields'].', ' : ''; |
|
1811 | 1811 | $fields .= 'IF(UNIX_TIMESTAMP(DATE_FORMAT(gd_posts.expire_date, "%Y-%m-%d")), UNIX_TIMESTAMP(DATE_FORMAT(gd_posts.expire_date, "%Y-%m-%d")), 253402300799) AS gd_expire'; |
1812 | 1812 | $clauses['fields'] = $fields; |
1813 | 1813 | |
1814 | 1814 | $order = !empty($wp_query->query_vars['order']) ? $wp_query->query_vars['order'] : 'ASC'; |
1815 | - $orderby = 'gd_expire ' . $order; |
|
1815 | + $orderby = 'gd_expire '.$order; |
|
1816 | 1816 | $clauses['orderby'] = $orderby; |
1817 | 1817 | } |
1818 | 1818 | return $clauses; |
@@ -1855,7 +1855,7 @@ discard block |
||
1855 | 1855 | global $current_user; |
1856 | 1856 | $upload_dir = wp_upload_dir(); |
1857 | 1857 | |
1858 | - $file = $upload_dir['path'] . '/temp_' . $current_user->data->ID . '/geodir_tmp.csv'; |
|
1858 | + $file = $upload_dir['path'].'/temp_'.$current_user->data->ID.'/geodir_tmp.csv'; |
|
1859 | 1859 | $handle = fopen($file, 'w'); |
1860 | 1860 | |
1861 | 1861 | fwrite($handle, $input); |
@@ -1900,7 +1900,7 @@ discard block |
||
1900 | 1900 | $uploads_dir = $uploads['path']; |
1901 | 1901 | $image_name_arr = explode('/', $filename); |
1902 | 1902 | $filename = end($image_name_arr); |
1903 | - $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
1903 | + $target_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$filename; |
|
1904 | 1904 | $return = array(); |
1905 | 1905 | $return['file'] = $uploadedFile; |
1906 | 1906 | $return['error'] = __('The uploaded file is not a valid csv file. Please try again.', 'geodirectory'); |
@@ -1917,8 +1917,8 @@ discard block |
||
1917 | 1917 | |
1918 | 1918 | if (($handle = fopen($target_path, "r")) !== FALSE) { |
1919 | 1919 | while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { |
1920 | - if(is_array($data) && !empty($data)) { |
|
1921 | - $file[] = '"' . implode('","', $data) . '"'; |
|
1920 | + if (is_array($data) && !empty($data)) { |
|
1921 | + $file[] = '"'.implode('","', $data).'"'; |
|
1922 | 1922 | } |
1923 | 1923 | } |
1924 | 1924 | fclose($handle); |
@@ -2035,10 +2035,10 @@ discard block |
||
2035 | 2035 | $tag_arr = explode(',', $post_tags); |
2036 | 2036 | } |
2037 | 2037 | |
2038 | - $table = $plugin_prefix . $buffer[5] . '_detail'; // check table in database |
|
2038 | + $table = $plugin_prefix.$buffer[5].'_detail'; // check table in database |
|
2039 | 2039 | |
2040 | 2040 | $error = ''; |
2041 | - if ($wpdb->get_var("SHOW TABLES LIKE '" . $table . "'") != $table) { |
|
2041 | + if ($wpdb->get_var("SHOW TABLES LIKE '".$table."'") != $table) { |
|
2042 | 2042 | $invalid_post_type++; |
2043 | 2043 | continue; |
2044 | 2044 | } |
@@ -2064,7 +2064,7 @@ discard block |
||
2064 | 2064 | if ($buffer[$c] != '0' && $buffer[$c] != '') { |
2065 | 2065 | $submitdata = date('Y-m-d'); |
2066 | 2066 | |
2067 | - $gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata . "+" . addslashes($buffer[$c]) . " days")); |
|
2067 | + $gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata."+".addslashes($buffer[$c])." days")); |
|
2068 | 2068 | } else { |
2069 | 2069 | $gd_post_info['expire_date'] = 'Never'; |
2070 | 2070 | } |
@@ -2092,7 +2092,7 @@ discard block |
||
2092 | 2092 | |
2093 | 2093 | // Post status |
2094 | 2094 | if ($customKeyarray[$c] == 'post_status') { |
2095 | - $post_status = sanitize_key( $buffer[$c] ); |
|
2095 | + $post_status = sanitize_key($buffer[$c]); |
|
2096 | 2096 | } |
2097 | 2097 | } |
2098 | 2098 | |
@@ -2110,8 +2110,8 @@ discard block |
||
2110 | 2110 | |
2111 | 2111 | // Default post status |
2112 | 2112 | $default_status = 'publish'; |
2113 | - $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status; |
|
2114 | - $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status; |
|
2113 | + $post_status = !empty($post_status) ? sanitize_key($post_status) : $default_status; |
|
2114 | + $post_status = !empty($wp_post_statuses) && !isset($wp_post_statuses[$post_status]) ? $default_status : $post_status; |
|
2115 | 2115 | |
2116 | 2116 | $my_post['post_title'] = $post_title; |
2117 | 2117 | $my_post['post_content'] = $post_desc; |
@@ -2155,7 +2155,7 @@ discard block |
||
2155 | 2155 | $payment_info = array(); |
2156 | 2156 | $package_info = array(); |
2157 | 2157 | |
2158 | - $package_info = (array)geodir_post_package_info($package_info, '', $buffer[5]); |
|
2158 | + $package_info = (array) geodir_post_package_info($package_info, '', $buffer[5]); |
|
2159 | 2159 | $package_id = ''; |
2160 | 2160 | if (isset($gd_post_info['package_id']) && $gd_post_info['package_id'] != '') { |
2161 | 2161 | $package_id = $gd_post_info['package_id']; |
@@ -2165,7 +2165,7 @@ discard block |
||
2165 | 2165 | $payment_info['package_id'] = $package_info['pid']; |
2166 | 2166 | |
2167 | 2167 | if (isset($package_info['alive_days']) && $package_info['alive_days'] != 0) { |
2168 | - $payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['alive_days'] . " days")); |
|
2168 | + $payment_info['expire_date'] = date('Y-m-d', strtotime("+".$package_info['alive_days']." days")); |
|
2169 | 2169 | } else { |
2170 | 2170 | $payment_info['expire_date'] = 'Never'; |
2171 | 2171 | } |
@@ -2177,7 +2177,7 @@ discard block |
||
2177 | 2177 | |
2178 | 2178 | $post_type = get_post_type($last_postid); |
2179 | 2179 | |
2180 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
2180 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
2181 | 2181 | |
2182 | 2182 | geodir_save_post_info($last_postid, $gd_post_info); |
2183 | 2183 | |
@@ -2198,7 +2198,7 @@ discard block |
||
2198 | 2198 | $attachment['post_id'] = $last_postid; |
2199 | 2199 | $attachment['title'] = $img_name_arr[0]; |
2200 | 2200 | $attachment['content'] = ''; |
2201 | - $attachment['file'] = $sub_dir . '/' . $image_name; |
|
2201 | + $attachment['file'] = $sub_dir.'/'.$image_name; |
|
2202 | 2202 | $attachment['mime_type'] = $uploaded_file_type; |
2203 | 2203 | $attachment['menu_order'] = $menu_order; |
2204 | 2204 | $attachment['is_featured'] = 0; |
@@ -2207,15 +2207,15 @@ discard block |
||
2207 | 2207 | |
2208 | 2208 | foreach ($attachment as $key => $val) { |
2209 | 2209 | if ($val != '') |
2210 | - $attachment_set .= $key . " = '" . $val . "', "; |
|
2210 | + $attachment_set .= $key." = '".$val."', "; |
|
2211 | 2211 | } |
2212 | 2212 | $attachment_set = trim($attachment_set, ", "); |
2213 | 2213 | |
2214 | - $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set); |
|
2214 | + $wpdb->query("INSERT INTO ".GEODIR_ATTACHMENT_TABLE." SET ".$attachment_set); |
|
2215 | 2215 | |
2216 | 2216 | if ($menu_order == 1) { |
2217 | 2217 | $post_type = get_post_type($last_postid); |
2218 | - $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($sub_dir . '/' . $image_name, $last_postid))); |
|
2218 | + $wpdb->query($wpdb->prepare("UPDATE ".$table." SET featured_image = %s where post_id =%d", array($sub_dir.'/'.$image_name, $last_postid))); |
|
2219 | 2219 | } |
2220 | 2220 | $menu_order++; |
2221 | 2221 | } |
@@ -2256,11 +2256,11 @@ discard block |
||
2256 | 2256 | } |
2257 | 2257 | |
2258 | 2258 | // Add the tab in left sidebar menu fro import & export page. |
2259 | -add_filter( 'geodir_settings_tabs_array', 'geodir_import_export_tab', 94 ); |
|
2259 | +add_filter('geodir_settings_tabs_array', 'geodir_import_export_tab', 94); |
|
2260 | 2260 | |
2261 | 2261 | // Handle ajax request for import/export. |
2262 | -add_action( 'wp_ajax_geodir_import_export', 'geodir_ajax_import_export' ); |
|
2263 | -add_action( 'wp_ajax_nopriv_geodir_import_exportn', 'geodir_ajax_import_export' ); |
|
2262 | +add_action('wp_ajax_geodir_import_export', 'geodir_ajax_import_export'); |
|
2263 | +add_action('wp_ajax_nopriv_geodir_import_exportn', 'geodir_ajax_import_export'); |
|
2264 | 2264 | |
2265 | 2265 | |
2266 | 2266 | /** |
@@ -2271,40 +2271,40 @@ discard block |
||
2271 | 2271 | * @param $post_id int $post_id The post ID of the post being saved. |
2272 | 2272 | * @param $post object $post The post object of the post being saved. |
2273 | 2273 | */ |
2274 | -function geodir_update_location_prefix($post_id,$post){ |
|
2275 | - if($post->post_type=='page' && $post->post_name && $post_id==get_option('geodir_location_page')){ |
|
2276 | - update_option('geodir_location_prefix',$post->post_name); |
|
2274 | +function geodir_update_location_prefix($post_id, $post) { |
|
2275 | + if ($post->post_type == 'page' && $post->post_name && $post_id == get_option('geodir_location_page')) { |
|
2276 | + update_option('geodir_location_prefix', $post->post_name); |
|
2277 | 2277 | } |
2278 | 2278 | |
2279 | 2279 | } |
2280 | 2280 | |
2281 | -add_action('save_post', 'geodir_update_location_prefix',10,2); |
|
2281 | +add_action('save_post', 'geodir_update_location_prefix', 10, 2); |
|
2282 | 2282 | |
2283 | -add_action( 'wp_ajax_geodir_ga_callback', 'geodir_ga_callback' ); |
|
2283 | +add_action('wp_ajax_geodir_ga_callback', 'geodir_ga_callback'); |
|
2284 | 2284 | |
2285 | -function geodir_ga_callback(){ |
|
2285 | +function geodir_ga_callback() { |
|
2286 | 2286 | |
2287 | -if(isset($_REQUEST['code']) && $_REQUEST['code']) { |
|
2287 | +if (isset($_REQUEST['code']) && $_REQUEST['code']) { |
|
2288 | 2288 | $oAuthURL = "https://www.googleapis.com/oauth2/v3/token?"; |
2289 | 2289 | $code = "code=".$_REQUEST['code']; |
2290 | 2290 | $grant_type = "&grant_type=authorization_code"; |
2291 | - $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback"; |
|
2291 | + $redirect_uri = "&redirect_uri=".admin_url('admin-ajax.php')."?action=geodir_ga_callback"; |
|
2292 | 2292 | $client_id = "&client_id=".get_option('geodir_ga_client_id'); |
2293 | 2293 | $client_secret = "&client_secret=".get_option('geodir_ga_client_secret'); |
2294 | 2294 | |
2295 | - $auth_url = $oAuthURL . $code . $redirect_uri . $grant_type . $client_id .$client_secret; |
|
2295 | + $auth_url = $oAuthURL.$code.$redirect_uri.$grant_type.$client_id.$client_secret; |
|
2296 | 2296 | |
2297 | 2297 | $response = wp_remote_post($auth_url, array('timeout' => 15)); |
2298 | 2298 | |
2299 | 2299 | //print_r($response); |
2300 | 2300 | |
2301 | - $error_msg = __('Something went wrong','geodirectory'); |
|
2302 | - if(!empty($response['response']['code']) && $response['response']['code']==200){ |
|
2301 | + $error_msg = __('Something went wrong', 'geodirectory'); |
|
2302 | + if (!empty($response['response']['code']) && $response['response']['code'] == 200) { |
|
2303 | 2303 | |
2304 | 2304 | $parts = json_decode($response['body']); |
2305 | 2305 | //print_r($parts); |
2306 | - if(!isset($parts->access_token)){echo $error_msg." - #1";exit;} |
|
2307 | - else{ |
|
2306 | + if (!isset($parts->access_token)) {echo $error_msg." - #1"; exit; } |
|
2307 | + else { |
|
2308 | 2308 | |
2309 | 2309 | update_option('gd_ga_access_token', $parts->access_token); |
2310 | 2310 | update_option('gd_ga_refresh_token', $parts->refresh_token); |
@@ -2313,25 +2313,25 @@ discard block |
||
2313 | 2313 | |
2314 | 2314 | |
2315 | 2315 | } |
2316 | - elseif(!empty($response['response']['code'])) { |
|
2316 | + elseif (!empty($response['response']['code'])) { |
|
2317 | 2317 | $parts = json_decode($response['body']); |
2318 | 2318 | |
2319 | - if(isset($parts->error)){ |
|
2320 | - echo $parts->error.": ".$parts->error_description;exit; |
|
2321 | - }else{ |
|
2322 | - echo $error_msg." - #2";exit; |
|
2319 | + if (isset($parts->error)) { |
|
2320 | + echo $parts->error.": ".$parts->error_description; exit; |
|
2321 | + } else { |
|
2322 | + echo $error_msg." - #2"; exit; |
|
2323 | 2323 | } |
2324 | 2324 | |
2325 | - }else{ |
|
2325 | + } else { |
|
2326 | 2326 | |
2327 | - echo $error_msg." - #3";exit; |
|
2327 | + echo $error_msg." - #3"; exit; |
|
2328 | 2328 | |
2329 | 2329 | } |
2330 | 2330 | } |
2331 | 2331 | exit; |
2332 | 2332 | } |
2333 | 2333 | |
2334 | -add_filter( 'icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4 ); |
|
2334 | +add_filter('icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4); |
|
2335 | 2335 | |
2336 | 2336 | if (isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'permalink_settings') { |
2337 | 2337 | add_action('geodir_before_admin_panel', 'geodir_wpml_permalink_setting_notice'); |
@@ -2348,7 +2348,7 @@ discard block |
||
2348 | 2348 | function geodir_uninstall_settings($general_settings) { |
2349 | 2349 | $settings = array(); |
2350 | 2350 | $settings[] = array('type' => 'title', 'id' => 'uninstall_settings', 'name' => __('Uninstall Settings', 'geodirectory')); |
2351 | - $settings[] = array('type' => 'sectionstart', 'id' => 'uninstall_settings_main', 'name' => __('Remove Data on Uninstall?', 'geodirectory' )); |
|
2351 | + $settings[] = array('type' => 'sectionstart', 'id' => 'uninstall_settings_main', 'name' => __('Remove Data on Uninstall?', 'geodirectory')); |
|
2352 | 2352 | |
2353 | 2353 | $plugins = get_plugins(); |
2354 | 2354 | $un_plugins = apply_filters('geodir_plugins_uninstall_settings', array()); |
@@ -2360,7 +2360,7 @@ discard block |
||
2360 | 2360 | if (in_array($plugin_name, $un_plugins)) { |
2361 | 2361 | $settings[] = array( |
2362 | 2362 | 'type' => 'checkbox', |
2363 | - 'id' => 'geodir_un_' . $plugin_name, |
|
2363 | + 'id' => 'geodir_un_'.$plugin_name, |
|
2364 | 2364 | 'name' => $data['Name'], |
2365 | 2365 | 'desc' => __('Remove all data when deleted?', 'geodirectory'), |
2366 | 2366 | 'std' => '0' |
@@ -2394,7 +2394,7 @@ discard block |
||
2394 | 2394 | * @since 1.6.9 |
2395 | 2395 | */ |
2396 | 2396 | function geodir_uninstall_settings_desc() { |
2397 | - echo '<p class="gd-un-settings-desc">' . __('Select the plugins that you would like to completely remove all of its data when the plugin is deleted.', 'geodirectory') . '</p>'; |
|
2397 | + echo '<p class="gd-un-settings-desc">'.__('Select the plugins that you would like to completely remove all of its data when the plugin is deleted.', 'geodirectory').'</p>'; |
|
2398 | 2398 | } |
2399 | 2399 | add_action('geodir_settings_uninstall_settings_main_start', 'geodir_uninstall_settings_desc'); |
2400 | 2400 |
@@ -10,33 +10,33 @@ discard block |
||
10 | 10 | |
11 | 11 | add_action('admin_init', 'geodir_admin_init'); |
12 | 12 | if (!function_exists('geodir_admin_init')) { |
13 | - /** |
|
14 | - * Adds GD setting pages in admin. |
|
15 | - * |
|
16 | - * @since 1.0.0 |
|
17 | - * @package GeoDirectory |
|
18 | - * @global string $current_tab The current settings tab name. |
|
19 | - */ |
|
20 | - function geodir_admin_init() |
|
21 | - { |
|
22 | - |
|
23 | - if (is_admin()): |
|
24 | - global $current_tab; |
|
25 | - geodir_redirect_to_admin_panel_on_installed(); |
|
26 | - $current_tab = (isset($_GET['tab']) && $_GET['tab'] != '') ? $_GET['tab'] : 'general_settings'; |
|
27 | - if (!(isset($_REQUEST['action']))) // this will avoid Ajax requests |
|
28 | - geodir_handle_option_form_submit($current_tab); // located in admin function.php |
|
29 | - /** |
|
30 | - * Called on the WordPress 'admin_init' hook this hookis used to call everything for the GD settings pages in the admin area. |
|
31 | - * |
|
32 | - * @since 1.0.0 |
|
33 | - */ |
|
34 | - do_action('admin_panel_init'); |
|
35 | - add_action('geodir_admin_option_form', 'geodir_get_admin_option_form', 1); |
|
36 | - |
|
37 | - |
|
38 | - endif; |
|
39 | - } |
|
13 | + /** |
|
14 | + * Adds GD setting pages in admin. |
|
15 | + * |
|
16 | + * @since 1.0.0 |
|
17 | + * @package GeoDirectory |
|
18 | + * @global string $current_tab The current settings tab name. |
|
19 | + */ |
|
20 | + function geodir_admin_init() |
|
21 | + { |
|
22 | + |
|
23 | + if (is_admin()): |
|
24 | + global $current_tab; |
|
25 | + geodir_redirect_to_admin_panel_on_installed(); |
|
26 | + $current_tab = (isset($_GET['tab']) && $_GET['tab'] != '') ? $_GET['tab'] : 'general_settings'; |
|
27 | + if (!(isset($_REQUEST['action']))) // this will avoid Ajax requests |
|
28 | + geodir_handle_option_form_submit($current_tab); // located in admin function.php |
|
29 | + /** |
|
30 | + * Called on the WordPress 'admin_init' hook this hookis used to call everything for the GD settings pages in the admin area. |
|
31 | + * |
|
32 | + * @since 1.0.0 |
|
33 | + */ |
|
34 | + do_action('admin_panel_init'); |
|
35 | + add_action('geodir_admin_option_form', 'geodir_get_admin_option_form', 1); |
|
36 | + |
|
37 | + |
|
38 | + endif; |
|
39 | + } |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -47,10 +47,10 @@ discard block |
||
47 | 47 | */ |
48 | 48 | function geodir_redirect_to_admin_panel_on_installed() |
49 | 49 | { |
50 | - if (get_option('geodir_installation_redirect', false)) { |
|
51 | - delete_option('geodir_installation_redirect'); |
|
52 | - wp_redirect(admin_url('admin.php?page=geodirectory&installed=yes')); |
|
53 | - } |
|
50 | + if (get_option('geodir_installation_redirect', false)) { |
|
51 | + delete_option('geodir_installation_redirect'); |
|
52 | + wp_redirect(admin_url('admin.php?page=geodirectory&installed=yes')); |
|
53 | + } |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
63 | 63 | function geodir_get_admin_option_form($current_tab) |
64 | 64 | { |
65 | - geodir_admin_option_form($current_tab);// defined in admin template tags.php |
|
65 | + geodir_admin_option_form($current_tab);// defined in admin template tags.php |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
@@ -85,19 +85,19 @@ discard block |
||
85 | 85 | */ |
86 | 86 | function geodir_conditional_admin_script_load() |
87 | 87 | { |
88 | - global $pagenow; |
|
88 | + global $pagenow; |
|
89 | 89 | |
90 | 90 | // Get the current post type |
91 | 91 | $post_type = geodir_admin_current_post_type(); |
92 | 92 | $geodir_post_types = geodir_get_posttypes(); |
93 | 93 | |
94 | 94 | if ((isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') || (($pagenow == 'post.php' || $pagenow == 'post-new.php' || $pagenow == 'edit.php') && $post_type && in_array($post_type, $geodir_post_types)) || ($pagenow == 'edit-tags.php' || $pagenow == 'term.php' || $pagenow == 'edit-comments.php' || $pagenow == 'comment.php')) { |
95 | - add_action('admin_enqueue_scripts', 'geodir_admin_scripts'); |
|
96 | - add_action('admin_enqueue_scripts', 'geodir_admin_styles'); |
|
97 | - add_action('admin_enqueue_scripts', 'geodir_admin_dequeue_scripts', 100); |
|
98 | - } |
|
95 | + add_action('admin_enqueue_scripts', 'geodir_admin_scripts'); |
|
96 | + add_action('admin_enqueue_scripts', 'geodir_admin_styles'); |
|
97 | + add_action('admin_enqueue_scripts', 'geodir_admin_dequeue_scripts', 100); |
|
98 | + } |
|
99 | 99 | |
100 | - add_action('admin_enqueue_scripts', 'geodir_admin_styles_req'); |
|
100 | + add_action('admin_enqueue_scripts', 'geodir_admin_styles_req'); |
|
101 | 101 | |
102 | 102 | } |
103 | 103 | |
@@ -132,12 +132,12 @@ discard block |
||
132 | 132 | */ |
133 | 133 | function create_default_admin_main_nav() |
134 | 134 | { |
135 | - add_filter('geodir_settings_tabs_array', 'geodir_default_admin_main_tabs', 1); |
|
136 | - add_filter('geodir_settings_tabs_array', 'places_custom_fields_tab', 2); |
|
137 | - add_filter('geodir_settings_tabs_array', 'geodir_compatibility_setting_tab', 90); |
|
138 | - add_filter('geodir_settings_tabs_array', 'geodir_tools_setting_tab', 95); |
|
139 | - add_filter('geodir_settings_tabs_array', 'geodir_extend_geodirectory_setting_tab', 100); |
|
140 | - //add_filter('geodir_settings_tabs_array', 'geodir_hide_set_location_default',3); |
|
135 | + add_filter('geodir_settings_tabs_array', 'geodir_default_admin_main_tabs', 1); |
|
136 | + add_filter('geodir_settings_tabs_array', 'places_custom_fields_tab', 2); |
|
137 | + add_filter('geodir_settings_tabs_array', 'geodir_compatibility_setting_tab', 90); |
|
138 | + add_filter('geodir_settings_tabs_array', 'geodir_tools_setting_tab', 95); |
|
139 | + add_filter('geodir_settings_tabs_array', 'geodir_extend_geodirectory_setting_tab', 100); |
|
140 | + //add_filter('geodir_settings_tabs_array', 'geodir_hide_set_location_default',3); |
|
141 | 141 | |
142 | 142 | } |
143 | 143 | |
@@ -150,16 +150,16 @@ discard block |
||
150 | 150 | */ |
151 | 151 | function geodir_admin_list_columns() |
152 | 152 | { |
153 | - if ($post_types = geodir_get_posttypes()) { |
|
153 | + if ($post_types = geodir_get_posttypes()) { |
|
154 | 154 | |
155 | - foreach ($post_types as $post_type): |
|
156 | - add_filter("manage_edit-{$post_type}_columns", 'geodir_edit_post_columns', 100); |
|
157 | - //Filter-Payment-Manager to show Package |
|
158 | - add_action("manage_{$post_type}_posts_custom_column", 'geodir_manage_post_columns', 10, 2); |
|
155 | + foreach ($post_types as $post_type): |
|
156 | + add_filter("manage_edit-{$post_type}_columns", 'geodir_edit_post_columns', 100); |
|
157 | + //Filter-Payment-Manager to show Package |
|
158 | + add_action("manage_{$post_type}_posts_custom_column", 'geodir_manage_post_columns', 10, 2); |
|
159 | 159 | |
160 | - add_filter("manage_edit-{$post_type}_sortable_columns", 'geodir_post_sortable_columns'); |
|
161 | - endforeach; |
|
162 | - } |
|
160 | + add_filter("manage_edit-{$post_type}_sortable_columns", 'geodir_post_sortable_columns'); |
|
161 | + endforeach; |
|
162 | + } |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | /** |
@@ -172,15 +172,15 @@ discard block |
||
172 | 172 | */ |
173 | 173 | function geodir_default_admin_main_tabs($tabs) |
174 | 174 | { |
175 | - return $tabs = array( |
|
176 | - 'general_settings' => array('label' => __('General', 'geodirectory')), |
|
177 | - 'design_settings' => array('label' => __('Design', 'geodirectory')), |
|
178 | - 'permalink_settings' => array('label' => __('Permalinks', 'geodirectory')), |
|
179 | - 'title_meta_settings' => array('label' => __('Titles & Metas', 'geodirectory')), |
|
180 | - 'notifications_settings' => array('label' => __('Notifications', 'geodirectory')), |
|
181 | - 'default_location_settings' => array('label' => __('Set Default Location', 'geodirectory')), |
|
182 | - |
|
183 | - ); |
|
175 | + return $tabs = array( |
|
176 | + 'general_settings' => array('label' => __('General', 'geodirectory')), |
|
177 | + 'design_settings' => array('label' => __('Design', 'geodirectory')), |
|
178 | + 'permalink_settings' => array('label' => __('Permalinks', 'geodirectory')), |
|
179 | + 'title_meta_settings' => array('label' => __('Titles & Metas', 'geodirectory')), |
|
180 | + 'notifications_settings' => array('label' => __('Notifications', 'geodirectory')), |
|
181 | + 'default_location_settings' => array('label' => __('Set Default Location', 'geodirectory')), |
|
182 | + |
|
183 | + ); |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | add_action('do_meta_boxes', 'geodir_remove_image_box'); |
@@ -193,16 +193,16 @@ discard block |
||
193 | 193 | */ |
194 | 194 | function geodir_remove_image_box() |
195 | 195 | { |
196 | - global $post; |
|
196 | + global $post; |
|
197 | 197 | |
198 | - $geodir_posttypes = geodir_get_posttypes(); |
|
198 | + $geodir_posttypes = geodir_get_posttypes(); |
|
199 | 199 | |
200 | - if (isset($post) && in_array($post->post_type, $geodir_posttypes)): |
|
200 | + if (isset($post) && in_array($post->post_type, $geodir_posttypes)): |
|
201 | 201 | |
202 | - remove_meta_box('postimagediv', $post->post_type, 'side'); |
|
203 | - remove_meta_box('revisionsdiv', $post->post_type, 'normal'); |
|
202 | + remove_meta_box('postimagediv', $post->post_type, 'side'); |
|
203 | + remove_meta_box('revisionsdiv', $post->post_type, 'normal'); |
|
204 | 204 | |
205 | - endif; |
|
205 | + endif; |
|
206 | 206 | |
207 | 207 | } |
208 | 208 | |
@@ -217,26 +217,26 @@ discard block |
||
217 | 217 | */ |
218 | 218 | function geodir_meta_box_add() |
219 | 219 | { |
220 | - global $post; |
|
220 | + global $post; |
|
221 | 221 | |
222 | - $geodir_post_types = geodir_get_posttypes('array'); |
|
223 | - $geodir_posttypes = array_keys($geodir_post_types); |
|
222 | + $geodir_post_types = geodir_get_posttypes('array'); |
|
223 | + $geodir_posttypes = array_keys($geodir_post_types); |
|
224 | 224 | |
225 | - if (isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)): |
|
225 | + if (isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)): |
|
226 | 226 | |
227 | - $geodir_posttype = $post->post_type; |
|
228 | - $post_typename = geodir_ucwords($geodir_post_types[$geodir_posttype]['labels']['singular_name']); |
|
227 | + $geodir_posttype = $post->post_type; |
|
228 | + $post_typename = geodir_ucwords($geodir_post_types[$geodir_posttype]['labels']['singular_name']); |
|
229 | 229 | |
230 | - // Filter-Payment-Manager |
|
230 | + // Filter-Payment-Manager |
|
231 | 231 | |
232 | - add_meta_box('geodir_post_images', $post_typename . ' ' . __('Attachments', 'geodirectory'), 'geodir_post_attachments', $geodir_posttype, 'side'); |
|
232 | + add_meta_box('geodir_post_images', $post_typename . ' ' . __('Attachments', 'geodirectory'), 'geodir_post_attachments', $geodir_posttype, 'side'); |
|
233 | 233 | |
234 | - add_meta_box('geodir_post_info', $post_typename . ' ' . __('Information', 'geodirectory'), 'geodir_post_info_setting', $geodir_posttype, 'normal', 'high'); |
|
234 | + add_meta_box('geodir_post_info', $post_typename . ' ' . __('Information', 'geodirectory'), 'geodir_post_info_setting', $geodir_posttype, 'normal', 'high'); |
|
235 | 235 | |
236 | - // no need of this box as all fields moved to main information box |
|
237 | - //add_meta_box( 'geodir_post_addinfo', $post_typename. ' ' .__('Additional Information' , 'geodirectory'), 'geodir_post_addinfo_setting', $geodir_posttype,'normal', 'high' ); |
|
236 | + // no need of this box as all fields moved to main information box |
|
237 | + //add_meta_box( 'geodir_post_addinfo', $post_typename. ' ' .__('Additional Information' , 'geodirectory'), 'geodir_post_addinfo_setting', $geodir_posttype,'normal', 'high' ); |
|
238 | 238 | |
239 | - endif; |
|
239 | + endif; |
|
240 | 240 | |
241 | 241 | } |
242 | 242 | |
@@ -260,23 +260,23 @@ discard block |
||
260 | 260 | function geodir_hide_post_taxonomy_meta_boxes() |
261 | 261 | { |
262 | 262 | |
263 | - $geodir_post_types = get_option('geodir_post_types'); |
|
263 | + $geodir_post_types = get_option('geodir_post_types'); |
|
264 | 264 | |
265 | - if (!empty($geodir_post_types)) { |
|
266 | - foreach ($geodir_post_types as $geodir_post_type => $geodir_posttype_info) { |
|
265 | + if (!empty($geodir_post_types)) { |
|
266 | + foreach ($geodir_post_types as $geodir_post_type => $geodir_posttype_info) { |
|
267 | 267 | |
268 | - $gd_taxonomy = geodir_get_taxonomies($geodir_post_type); |
|
268 | + $gd_taxonomy = geodir_get_taxonomies($geodir_post_type); |
|
269 | 269 | |
270 | - if(!empty($gd_taxonomy)) { |
|
271 | - foreach ($gd_taxonomy as $tax) { |
|
270 | + if(!empty($gd_taxonomy)) { |
|
271 | + foreach ($gd_taxonomy as $tax) { |
|
272 | 272 | |
273 | - remove_meta_box($tax . 'div', $geodir_post_type, 'normal'); |
|
273 | + remove_meta_box($tax . 'div', $geodir_post_type, 'normal'); |
|
274 | 274 | |
275 | - } |
|
276 | - } |
|
275 | + } |
|
276 | + } |
|
277 | 277 | |
278 | - } |
|
279 | - } |
|
278 | + } |
|
279 | + } |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | add_filter('geodir_add_listing_map_restrict', 'geodir_add_listing_map_restrict'); |
@@ -290,12 +290,12 @@ discard block |
||
290 | 290 | */ |
291 | 291 | function geodir_add_listing_map_restrict($map_restirct) |
292 | 292 | { |
293 | - if (is_admin()) { |
|
294 | - if (isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'default_location_settings') { |
|
295 | - $map_restirct = false; |
|
296 | - } |
|
297 | - } |
|
298 | - return $map_restirct; |
|
293 | + if (is_admin()) { |
|
294 | + if (isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'default_location_settings') { |
|
295 | + $map_restirct = false; |
|
296 | + } |
|
297 | + } |
|
298 | + return $map_restirct; |
|
299 | 299 | } |
300 | 300 | |
301 | 301 | |
@@ -314,16 +314,16 @@ discard block |
||
314 | 314 | function geodir_enable_editor_on_notifications($notification) |
315 | 315 | { |
316 | 316 | |
317 | - if (!empty($notification) && get_option('geodir_tiny_editor') == '1') { |
|
317 | + if (!empty($notification) && get_option('geodir_tiny_editor') == '1') { |
|
318 | 318 | |
319 | - foreach ($notification as $key => $value) { |
|
320 | - if ($value['type'] == 'textarea') |
|
321 | - $notification[$key]['type'] = 'editor'; |
|
322 | - } |
|
319 | + foreach ($notification as $key => $value) { |
|
320 | + if ($value['type'] == 'textarea') |
|
321 | + $notification[$key]['type'] = 'editor'; |
|
322 | + } |
|
323 | 323 | |
324 | - } |
|
324 | + } |
|
325 | 325 | |
326 | - return $notification; |
|
326 | + return $notification; |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | |
@@ -340,16 +340,16 @@ discard block |
||
340 | 340 | function geodir_enable_editor_on_design_settings($design_setting) |
341 | 341 | { |
342 | 342 | |
343 | - if (!empty($design_setting) && get_option('geodir_tiny_editor') == '1') { |
|
343 | + if (!empty($design_setting) && get_option('geodir_tiny_editor') == '1') { |
|
344 | 344 | |
345 | - foreach ($design_setting as $key => $value) { |
|
346 | - if ($value['type'] == 'textarea' && $value['id'] == 'geodir_term_condition_content') |
|
347 | - $design_setting[$key]['type'] = 'editor'; |
|
348 | - } |
|
345 | + foreach ($design_setting as $key => $value) { |
|
346 | + if ($value['type'] == 'textarea' && $value['id'] == 'geodir_term_condition_content') |
|
347 | + $design_setting[$key]['type'] = 'editor'; |
|
348 | + } |
|
349 | 349 | |
350 | - } |
|
350 | + } |
|
351 | 351 | |
352 | - return $design_setting; |
|
352 | + return $design_setting; |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | /* ----------- START MANAGE CUSTOM FIELDS ---------------- */ |
@@ -357,15 +357,15 @@ discard block |
||
357 | 357 | add_action('geodir_manage_available_fields_custom', 'geodir_manage_available_fields_custom'); |
358 | 358 | |
359 | 359 | function geodir_manage_available_fields_predefined($sub_tab){ |
360 | - if($sub_tab=='custom_fields'){ |
|
361 | - geodir_custom_available_fields('predefined'); |
|
362 | - } |
|
360 | + if($sub_tab=='custom_fields'){ |
|
361 | + geodir_custom_available_fields('predefined'); |
|
362 | + } |
|
363 | 363 | } |
364 | 364 | |
365 | 365 | function geodir_manage_available_fields_custom($sub_tab){ |
366 | - if($sub_tab=='custom_fields'){ |
|
367 | - geodir_custom_available_fields('custom'); |
|
368 | - } |
|
366 | + if($sub_tab=='custom_fields'){ |
|
367 | + geodir_custom_available_fields('custom'); |
|
368 | + } |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | |
@@ -384,16 +384,16 @@ discard block |
||
384 | 384 | function geodir_manage_available_fields($sub_tab) |
385 | 385 | { |
386 | 386 | |
387 | - switch ($sub_tab) { |
|
388 | - case 'custom_fields': |
|
389 | - geodir_custom_available_fields(); |
|
390 | - break; |
|
387 | + switch ($sub_tab) { |
|
388 | + case 'custom_fields': |
|
389 | + geodir_custom_available_fields(); |
|
390 | + break; |
|
391 | 391 | |
392 | - case 'sorting_options': |
|
393 | - geodir_sorting_options_available_fields(); |
|
394 | - break; |
|
392 | + case 'sorting_options': |
|
393 | + geodir_sorting_options_available_fields(); |
|
394 | + break; |
|
395 | 395 | |
396 | - } |
|
396 | + } |
|
397 | 397 | } |
398 | 398 | |
399 | 399 | |
@@ -409,16 +409,16 @@ discard block |
||
409 | 409 | function geodir_manage_selected_fields($sub_tab) |
410 | 410 | { |
411 | 411 | |
412 | - switch ($sub_tab) { |
|
413 | - case 'custom_fields': |
|
414 | - geodir_custom_selected_fields(); |
|
415 | - break; |
|
412 | + switch ($sub_tab) { |
|
413 | + case 'custom_fields': |
|
414 | + geodir_custom_selected_fields(); |
|
415 | + break; |
|
416 | 416 | |
417 | - case 'sorting_options': |
|
418 | - geodir_sorting_options_selected_fields(); |
|
419 | - break; |
|
417 | + case 'sorting_options': |
|
418 | + geodir_sorting_options_selected_fields(); |
|
419 | + break; |
|
420 | 420 | |
421 | - } |
|
421 | + } |
|
422 | 422 | } |
423 | 423 | |
424 | 424 | /** |
@@ -430,52 +430,52 @@ discard block |
||
430 | 430 | */ |
431 | 431 | function geodir_sorting_options_available_fields() |
432 | 432 | { |
433 | - global $wpdb; |
|
434 | - $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
|
435 | - ?> |
|
433 | + global $wpdb; |
|
434 | + $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
|
435 | + ?> |
|
436 | 436 | <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type;?>"/> |
437 | 437 | <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>"/> |
438 | 438 | <ul> |
439 | 439 | <?php |
440 | - $sort_options = geodir_get_custom_sort_options($listing_type); |
|
440 | + $sort_options = geodir_get_custom_sort_options($listing_type); |
|
441 | 441 | |
442 | - foreach ($sort_options as $key => $val) { |
|
443 | - $val = stripslashes_deep($val); // strip slashes |
|
444 | - |
|
445 | - $check_html_variable = $wpdb->get_var( |
|
446 | - $wpdb->prepare( |
|
447 | - "SELECT htmlvar_name FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name = %s AND post_type = %s AND field_type=%s", |
|
448 | - array($val['htmlvar_name'], $listing_type, $val['field_type']) |
|
449 | - ) |
|
450 | - ); |
|
442 | + foreach ($sort_options as $key => $val) { |
|
443 | + $val = stripslashes_deep($val); // strip slashes |
|
444 | + |
|
445 | + $check_html_variable = $wpdb->get_var( |
|
446 | + $wpdb->prepare( |
|
447 | + "SELECT htmlvar_name FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name = %s AND post_type = %s AND field_type=%s", |
|
448 | + array($val['htmlvar_name'], $listing_type, $val['field_type']) |
|
449 | + ) |
|
450 | + ); |
|
451 | 451 | |
452 | - $display = $check_html_variable ? ' style="display:none;"' : ''; |
|
453 | - ?> |
|
452 | + $display = $check_html_variable ? ' style="display:none;"' : ''; |
|
453 | + ?> |
|
454 | 454 | |
455 | 455 | <li class="gd-cf-tooltip-wrap" <?php echo $display;?>> |
456 | 456 | <?php |
457 | - if(isset($val['description']) && $val['description']){ |
|
458 | - echo '<div class="gdcf-tooltip">'.$val['description'].'</div>'; |
|
459 | - }?> |
|
457 | + if(isset($val['description']) && $val['description']){ |
|
458 | + echo '<div class="gdcf-tooltip">'.$val['description'].'</div>'; |
|
459 | + }?> |
|
460 | 460 | |
461 | 461 | <a id="gd-<?php echo $val['field_type'];?>-_-<?php echo $val['htmlvar_name'];?>" data-field-type-key="<?php echo $val['htmlvar_name'];?>" data-field-type="<?php echo $val['field_type'];?>" |
462 | 462 | title="<?php echo $val['site_title'];?>" |
463 | 463 | class="gd-draggable-form-items gd-<?php echo $val['field_type'];?> geodir-sort-<?php echo $val['htmlvar_name'];?>" href="javascript:void(0);"> |
464 | 464 | <?php if (isset($val['field_icon']) && strpos($val['field_icon'], 'fa fa-') !== false) { |
465 | - echo '<i class="'.$val['field_icon'].'" aria-hidden="true"></i>'; |
|
466 | - }elseif(isset($val['field_icon']) && $val['field_icon'] ){ |
|
467 | - echo '<b style="background-image: url("'.$val['field_icon'].'")"></b>'; |
|
468 | - }else{ |
|
469 | - echo '<i class="fa fa-cog" aria-hidden="true"></i>'; |
|
470 | - }?> |
|
465 | + echo '<i class="'.$val['field_icon'].'" aria-hidden="true"></i>'; |
|
466 | + }elseif(isset($val['field_icon']) && $val['field_icon'] ){ |
|
467 | + echo '<b style="background-image: url("'.$val['field_icon'].'")"></b>'; |
|
468 | + }else{ |
|
469 | + echo '<i class="fa fa-cog" aria-hidden="true"></i>'; |
|
470 | + }?> |
|
471 | 471 | <?php echo $val['site_title'];?> |
472 | 472 | </a> |
473 | 473 | </li> |
474 | 474 | |
475 | 475 | |
476 | 476 | <?php |
477 | - } |
|
478 | - ?> |
|
477 | + } |
|
478 | + ?> |
|
479 | 479 | </ul> |
480 | 480 | <?php |
481 | 481 | } |
@@ -489,28 +489,28 @@ discard block |
||
489 | 489 | */ |
490 | 490 | function geodir_sorting_options_selected_fields() |
491 | 491 | { |
492 | - $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
|
493 | - ?> |
|
492 | + $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
|
493 | + ?> |
|
494 | 494 | <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>"/> |
495 | 495 | <ul class="core"> |
496 | 496 | <?php |
497 | - global $wpdb; |
|
497 | + global $wpdb; |
|
498 | 498 | |
499 | - $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE post_type = %s AND field_type != 'address' ORDER BY sort_order ASC", array($listing_type))); |
|
499 | + $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE post_type = %s AND field_type != 'address' ORDER BY sort_order ASC", array($listing_type))); |
|
500 | 500 | |
501 | - if (!empty($fields)) { |
|
502 | - foreach ($fields as $field) { |
|
503 | - //$result_str = $field->id; |
|
504 | - $result_str = $field; |
|
505 | - $field_type = $field->field_type; |
|
506 | - $field_ins_upd = 'display'; |
|
501 | + if (!empty($fields)) { |
|
502 | + foreach ($fields as $field) { |
|
503 | + //$result_str = $field->id; |
|
504 | + $result_str = $field; |
|
505 | + $field_type = $field->field_type; |
|
506 | + $field_ins_upd = 'display'; |
|
507 | 507 | |
508 | - $default = false; |
|
508 | + $default = false; |
|
509 | 509 | |
510 | - geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd, $default); |
|
511 | - } |
|
512 | - } |
|
513 | - ?> |
|
510 | + geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd, $default); |
|
511 | + } |
|
512 | + } |
|
513 | + ?> |
|
514 | 514 | </ul> |
515 | 515 | <?php |
516 | 516 | } |
@@ -523,12 +523,12 @@ discard block |
||
523 | 523 | */ |
524 | 524 | function geodir_custom_fields_custom($post_type=''){ |
525 | 525 | |
526 | - $custom_fields = array(); |
|
526 | + $custom_fields = array(); |
|
527 | 527 | |
528 | - /** |
|
529 | - * @see `geodir_custom_fields` |
|
530 | - */ |
|
531 | - return apply_filters('geodir_custom_fields_custom',$custom_fields,$post_type); |
|
528 | + /** |
|
529 | + * @see `geodir_custom_fields` |
|
530 | + */ |
|
531 | + return apply_filters('geodir_custom_fields_custom',$custom_fields,$post_type); |
|
532 | 532 | } |
533 | 533 | |
534 | 534 | |
@@ -541,140 +541,140 @@ discard block |
||
541 | 541 | */ |
542 | 542 | function geodir_custom_fields($post_type=''){ |
543 | 543 | |
544 | - $custom_fields = array( |
|
545 | - 'text' => array( |
|
546 | - 'field_type' => 'text', |
|
547 | - 'class' => 'gd-text', |
|
548 | - 'icon' => 'fa fa-minus', |
|
549 | - 'name' => __('Text', 'geodirectory'), |
|
550 | - 'description' => __('Add any sort of text field, text or numbers', 'geodirectory') |
|
551 | - ), |
|
552 | - 'datepicker' => array( |
|
553 | - 'field_type' => 'datepicker', |
|
554 | - 'class' => 'gd-datepicker', |
|
555 | - 'icon' => 'fa fa-calendar', |
|
556 | - 'name' => __('Date', 'geodirectory'), |
|
557 | - 'description' => __('Adds a date picker.', 'geodirectory') |
|
558 | - ), |
|
559 | - 'textarea' => array( |
|
560 | - 'field_type' => 'textarea', |
|
561 | - 'class' => 'gd-textarea', |
|
562 | - 'icon' => 'fa fa-bars', |
|
563 | - 'name' => __('Textarea', 'geodirectory'), |
|
564 | - 'description' => __('Adds a textarea', 'geodirectory') |
|
565 | - ), |
|
566 | - 'time' => array( |
|
567 | - 'field_type' => 'time', |
|
568 | - 'class' => 'gd-time', |
|
569 | - 'icon' => 'fa fa-clock-o', |
|
570 | - 'name' => __('Time', 'geodirectory'), |
|
571 | - 'description' => __('Adds a time picker', 'geodirectory') |
|
572 | - ), |
|
573 | - 'checkbox' => array( |
|
574 | - 'field_type' => 'checkbox', |
|
575 | - 'class' => 'gd-checkbox', |
|
576 | - 'icon' => 'fa fa-check-square-o', |
|
577 | - 'name' => __('Checkbox', 'geodirectory'), |
|
578 | - 'description' => __('Adds a checkbox', 'geodirectory') |
|
579 | - ), |
|
580 | - 'phone' => array( |
|
581 | - 'field_type' => 'phone', |
|
582 | - 'class' => 'gd-phone', |
|
583 | - 'icon' => 'fa fa-phone', |
|
584 | - 'name' => __('Phone', 'geodirectory'), |
|
585 | - 'description' => __('Adds a phone input', 'geodirectory') |
|
586 | - ), |
|
587 | - 'radio' => array( |
|
588 | - 'field_type' => 'radio', |
|
589 | - 'class' => 'gd-radio', |
|
590 | - 'icon' => 'fa fa-dot-circle-o', |
|
591 | - 'name' => __('Radio', 'geodirectory'), |
|
592 | - 'description' => __('Adds a radio input', 'geodirectory') |
|
593 | - ), |
|
594 | - 'email' => array( |
|
595 | - 'field_type' => 'email', |
|
596 | - 'class' => 'gd-email', |
|
597 | - 'icon' => 'fa fa-envelope-o', |
|
598 | - 'name' => __('Email', 'geodirectory'), |
|
599 | - 'description' => __('Adds a email input', 'geodirectory') |
|
600 | - ), |
|
601 | - 'select' => array( |
|
602 | - 'field_type' => 'select', |
|
603 | - 'class' => 'gd-select', |
|
604 | - 'icon' => 'fa fa-caret-square-o-down', |
|
605 | - 'name' => __('Select', 'geodirectory'), |
|
606 | - 'description' => __('Adds a select input', 'geodirectory') |
|
607 | - ), |
|
608 | - 'multiselect' => array( |
|
609 | - 'field_type' => 'multiselect', |
|
610 | - 'class' => 'gd-multiselect', |
|
611 | - 'icon' => 'fa fa-caret-square-o-down', |
|
612 | - 'name' => __('Multi Select', 'geodirectory'), |
|
613 | - 'description' => __('Adds a multiselect input', 'geodirectory') |
|
614 | - ), |
|
615 | - 'url' => array( |
|
616 | - 'field_type' => 'url', |
|
617 | - 'class' => 'gd-url', |
|
618 | - 'icon' => 'fa fa-link', |
|
619 | - 'name' => __('URL', 'geodirectory'), |
|
620 | - 'description' => __('Adds a url input', 'geodirectory') |
|
621 | - ), |
|
622 | - 'html' => array( |
|
623 | - 'field_type' => 'html', |
|
624 | - 'class' => 'gd-html', |
|
625 | - 'icon' => 'fa fa-code', |
|
626 | - 'name' => __('HTML', 'geodirectory'), |
|
627 | - 'description' => __('Adds a html input textarea', 'geodirectory') |
|
628 | - ), |
|
629 | - 'file' => array( |
|
630 | - 'field_type' => 'file', |
|
631 | - 'class' => 'gd-file', |
|
632 | - 'icon' => 'fa fa-file', |
|
633 | - 'name' => __('File Upload', 'geodirectory'), |
|
634 | - 'description' => __('Adds a file input', 'geodirectory') |
|
635 | - ) |
|
636 | - ); |
|
637 | - |
|
638 | - /** |
|
639 | - * Filter the custom fields array to be able to add or remove items. |
|
640 | - * |
|
641 | - * @since 1.6.6 |
|
642 | - * |
|
643 | - * @param array $custom_fields { |
|
644 | - * The custom fields array to be filtered. |
|
645 | - * |
|
646 | - * @type string $field_type The type of field, eg: text, datepicker, textarea, time, checkbox, phone, radio, email, select, multiselect, url, html, file. |
|
647 | - * @type string $class The class for the field in backend. |
|
648 | - * @type string $icon Can be font-awesome class name or icon image url. |
|
649 | - * @type string $name The name of the field. |
|
650 | - * @type string $description A short description about the field. |
|
651 | - * @type array $defaults { |
|
652 | - * Optional. Used to set the default value of the field. |
|
653 | - * |
|
654 | - * @type string data_type The SQL data type for the field. VARCHAR, TEXT, TIME, TINYINT, INT, FLOAT, DATE |
|
655 | - * @type int decimal_point limit if using FLOAT data_type |
|
656 | - * @type string admin_title The admin title for the field. |
|
657 | - * @type string site_title This will be the title for the field on the frontend. |
|
658 | - * @type string admin_desc This will be shown below the field on the add listing form. |
|
659 | - * @type string htmlvar_name This is a unique identifier used in the HTML, it MUST NOT contain spaces or special characters. |
|
660 | - * @type bool is_active If false the field will not be displayed anywhere. |
|
661 | - * @type bool for_admin_use If true then only site admin can see and edit this field. |
|
662 | - * @type string default_value The default value for the input on the add listing page. |
|
663 | - * @type string show_in The locations to show in. [detail],[moreinfo],[listing],[owntab],[mapbubble] |
|
664 | - * @type bool is_required If true the field will be required on the add listing page. |
|
665 | - * @type string option_values The option values for select and multiselect only |
|
666 | - * @type string validation_pattern HTML5 validation pattern (text input only by default). |
|
667 | - * @type string validation_msg HTML5 validation message (text input only by default). |
|
668 | - * @type string required_msg Required warning message. |
|
669 | - * @type string field_icon Icon url or font awesome class. |
|
670 | - * @type string css_class Field custom css class for field custom style. |
|
671 | - * @type bool cat_sort If true the field will appear in the category sort options, if false the field will be hidden, leave blank to show option. |
|
672 | - * @type bool cat_sort If true the field will appear in the advanced search sort options, if false the field will be hidden, leave blank to show option. (advanced search addon required) |
|
673 | - * } |
|
674 | - * } |
|
675 | - * @param string $post_type The post type requested. |
|
676 | - */ |
|
677 | - return apply_filters('geodir_custom_fields',$custom_fields,$post_type); |
|
544 | + $custom_fields = array( |
|
545 | + 'text' => array( |
|
546 | + 'field_type' => 'text', |
|
547 | + 'class' => 'gd-text', |
|
548 | + 'icon' => 'fa fa-minus', |
|
549 | + 'name' => __('Text', 'geodirectory'), |
|
550 | + 'description' => __('Add any sort of text field, text or numbers', 'geodirectory') |
|
551 | + ), |
|
552 | + 'datepicker' => array( |
|
553 | + 'field_type' => 'datepicker', |
|
554 | + 'class' => 'gd-datepicker', |
|
555 | + 'icon' => 'fa fa-calendar', |
|
556 | + 'name' => __('Date', 'geodirectory'), |
|
557 | + 'description' => __('Adds a date picker.', 'geodirectory') |
|
558 | + ), |
|
559 | + 'textarea' => array( |
|
560 | + 'field_type' => 'textarea', |
|
561 | + 'class' => 'gd-textarea', |
|
562 | + 'icon' => 'fa fa-bars', |
|
563 | + 'name' => __('Textarea', 'geodirectory'), |
|
564 | + 'description' => __('Adds a textarea', 'geodirectory') |
|
565 | + ), |
|
566 | + 'time' => array( |
|
567 | + 'field_type' => 'time', |
|
568 | + 'class' => 'gd-time', |
|
569 | + 'icon' => 'fa fa-clock-o', |
|
570 | + 'name' => __('Time', 'geodirectory'), |
|
571 | + 'description' => __('Adds a time picker', 'geodirectory') |
|
572 | + ), |
|
573 | + 'checkbox' => array( |
|
574 | + 'field_type' => 'checkbox', |
|
575 | + 'class' => 'gd-checkbox', |
|
576 | + 'icon' => 'fa fa-check-square-o', |
|
577 | + 'name' => __('Checkbox', 'geodirectory'), |
|
578 | + 'description' => __('Adds a checkbox', 'geodirectory') |
|
579 | + ), |
|
580 | + 'phone' => array( |
|
581 | + 'field_type' => 'phone', |
|
582 | + 'class' => 'gd-phone', |
|
583 | + 'icon' => 'fa fa-phone', |
|
584 | + 'name' => __('Phone', 'geodirectory'), |
|
585 | + 'description' => __('Adds a phone input', 'geodirectory') |
|
586 | + ), |
|
587 | + 'radio' => array( |
|
588 | + 'field_type' => 'radio', |
|
589 | + 'class' => 'gd-radio', |
|
590 | + 'icon' => 'fa fa-dot-circle-o', |
|
591 | + 'name' => __('Radio', 'geodirectory'), |
|
592 | + 'description' => __('Adds a radio input', 'geodirectory') |
|
593 | + ), |
|
594 | + 'email' => array( |
|
595 | + 'field_type' => 'email', |
|
596 | + 'class' => 'gd-email', |
|
597 | + 'icon' => 'fa fa-envelope-o', |
|
598 | + 'name' => __('Email', 'geodirectory'), |
|
599 | + 'description' => __('Adds a email input', 'geodirectory') |
|
600 | + ), |
|
601 | + 'select' => array( |
|
602 | + 'field_type' => 'select', |
|
603 | + 'class' => 'gd-select', |
|
604 | + 'icon' => 'fa fa-caret-square-o-down', |
|
605 | + 'name' => __('Select', 'geodirectory'), |
|
606 | + 'description' => __('Adds a select input', 'geodirectory') |
|
607 | + ), |
|
608 | + 'multiselect' => array( |
|
609 | + 'field_type' => 'multiselect', |
|
610 | + 'class' => 'gd-multiselect', |
|
611 | + 'icon' => 'fa fa-caret-square-o-down', |
|
612 | + 'name' => __('Multi Select', 'geodirectory'), |
|
613 | + 'description' => __('Adds a multiselect input', 'geodirectory') |
|
614 | + ), |
|
615 | + 'url' => array( |
|
616 | + 'field_type' => 'url', |
|
617 | + 'class' => 'gd-url', |
|
618 | + 'icon' => 'fa fa-link', |
|
619 | + 'name' => __('URL', 'geodirectory'), |
|
620 | + 'description' => __('Adds a url input', 'geodirectory') |
|
621 | + ), |
|
622 | + 'html' => array( |
|
623 | + 'field_type' => 'html', |
|
624 | + 'class' => 'gd-html', |
|
625 | + 'icon' => 'fa fa-code', |
|
626 | + 'name' => __('HTML', 'geodirectory'), |
|
627 | + 'description' => __('Adds a html input textarea', 'geodirectory') |
|
628 | + ), |
|
629 | + 'file' => array( |
|
630 | + 'field_type' => 'file', |
|
631 | + 'class' => 'gd-file', |
|
632 | + 'icon' => 'fa fa-file', |
|
633 | + 'name' => __('File Upload', 'geodirectory'), |
|
634 | + 'description' => __('Adds a file input', 'geodirectory') |
|
635 | + ) |
|
636 | + ); |
|
637 | + |
|
638 | + /** |
|
639 | + * Filter the custom fields array to be able to add or remove items. |
|
640 | + * |
|
641 | + * @since 1.6.6 |
|
642 | + * |
|
643 | + * @param array $custom_fields { |
|
644 | + * The custom fields array to be filtered. |
|
645 | + * |
|
646 | + * @type string $field_type The type of field, eg: text, datepicker, textarea, time, checkbox, phone, radio, email, select, multiselect, url, html, file. |
|
647 | + * @type string $class The class for the field in backend. |
|
648 | + * @type string $icon Can be font-awesome class name or icon image url. |
|
649 | + * @type string $name The name of the field. |
|
650 | + * @type string $description A short description about the field. |
|
651 | + * @type array $defaults { |
|
652 | + * Optional. Used to set the default value of the field. |
|
653 | + * |
|
654 | + * @type string data_type The SQL data type for the field. VARCHAR, TEXT, TIME, TINYINT, INT, FLOAT, DATE |
|
655 | + * @type int decimal_point limit if using FLOAT data_type |
|
656 | + * @type string admin_title The admin title for the field. |
|
657 | + * @type string site_title This will be the title for the field on the frontend. |
|
658 | + * @type string admin_desc This will be shown below the field on the add listing form. |
|
659 | + * @type string htmlvar_name This is a unique identifier used in the HTML, it MUST NOT contain spaces or special characters. |
|
660 | + * @type bool is_active If false the field will not be displayed anywhere. |
|
661 | + * @type bool for_admin_use If true then only site admin can see and edit this field. |
|
662 | + * @type string default_value The default value for the input on the add listing page. |
|
663 | + * @type string show_in The locations to show in. [detail],[moreinfo],[listing],[owntab],[mapbubble] |
|
664 | + * @type bool is_required If true the field will be required on the add listing page. |
|
665 | + * @type string option_values The option values for select and multiselect only |
|
666 | + * @type string validation_pattern HTML5 validation pattern (text input only by default). |
|
667 | + * @type string validation_msg HTML5 validation message (text input only by default). |
|
668 | + * @type string required_msg Required warning message. |
|
669 | + * @type string field_icon Icon url or font awesome class. |
|
670 | + * @type string css_class Field custom css class for field custom style. |
|
671 | + * @type bool cat_sort If true the field will appear in the category sort options, if false the field will be hidden, leave blank to show option. |
|
672 | + * @type bool cat_sort If true the field will appear in the advanced search sort options, if false the field will be hidden, leave blank to show option. (advanced search addon required) |
|
673 | + * } |
|
674 | + * } |
|
675 | + * @param string $post_type The post type requested. |
|
676 | + */ |
|
677 | + return apply_filters('geodir_custom_fields',$custom_fields,$post_type); |
|
678 | 678 | } |
679 | 679 | |
680 | 680 | /** |
@@ -687,19 +687,19 @@ discard block |
||
687 | 687 | */ |
688 | 688 | function geodir_custom_available_fields($type='') |
689 | 689 | { |
690 | - $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
|
691 | - ?> |
|
690 | + $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
|
691 | + ?> |
|
692 | 692 | <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type;?>"/> |
693 | 693 | <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>" /> |
694 | 694 | |
695 | 695 | <?php |
696 | - if($type=='predefined'){ |
|
697 | - $cfs = geodir_custom_fields_predefined($listing_type); |
|
698 | - }elseif($type=='custom'){ |
|
699 | - $cfs = geodir_custom_fields_custom($listing_type); |
|
700 | - }else{ |
|
701 | - $cfs = geodir_custom_fields($listing_type); |
|
702 | - ?> |
|
696 | + if($type=='predefined'){ |
|
697 | + $cfs = geodir_custom_fields_predefined($listing_type); |
|
698 | + }elseif($type=='custom'){ |
|
699 | + $cfs = geodir_custom_fields_custom($listing_type); |
|
700 | + }else{ |
|
701 | + $cfs = geodir_custom_fields($listing_type); |
|
702 | + ?> |
|
703 | 703 | <ul class="full gd-cf-tooltip-wrap"> |
704 | 704 | <li> |
705 | 705 | <div class="gdcf-tooltip"> |
@@ -720,18 +720,18 @@ discard block |
||
720 | 720 | </ul> |
721 | 721 | |
722 | 722 | <?php |
723 | - } |
|
723 | + } |
|
724 | 724 | |
725 | - if(!empty($cfs)) { |
|
726 | - echo '<ul>'; |
|
727 | - foreach ( $cfs as $id => $cf ) { |
|
728 | - ?> |
|
725 | + if(!empty($cfs)) { |
|
726 | + echo '<ul>'; |
|
727 | + foreach ( $cfs as $id => $cf ) { |
|
728 | + ?> |
|
729 | 729 | |
730 | 730 | <li class="gd-cf-tooltip-wrap"> |
731 | 731 | <?php |
732 | - if ( isset( $cf['description'] ) && $cf['description'] ) { |
|
733 | - echo '<div class="gdcf-tooltip">' . $cf['description'] . '</div>'; |
|
734 | - } ?> |
|
732 | + if ( isset( $cf['description'] ) && $cf['description'] ) { |
|
733 | + echo '<div class="gdcf-tooltip">' . $cf['description'] . '</div>'; |
|
734 | + } ?> |
|
735 | 735 | |
736 | 736 | <a id="gd-<?php echo $id; ?>" |
737 | 737 | data-field-custom-type="<?php echo $type; ?>" |
@@ -741,21 +741,21 @@ discard block |
||
741 | 741 | href="javascript:void(0);"> |
742 | 742 | |
743 | 743 | <?php if ( isset( $cf['icon'] ) && strpos( $cf['icon'], 'fa fa-' ) !== false ) { |
744 | - echo '<i class="' . $cf['icon'] . '" aria-hidden="true"></i>'; |
|
745 | - } elseif ( isset( $cf['icon'] ) && $cf['icon'] ) { |
|
746 | - echo '<b style="background-image: url("' . $cf['icon'] . '")"></b>'; |
|
747 | - } else { |
|
748 | - echo '<i class="fa fa-cog" aria-hidden="true"></i>'; |
|
749 | - } ?> |
|
744 | + echo '<i class="' . $cf['icon'] . '" aria-hidden="true"></i>'; |
|
745 | + } elseif ( isset( $cf['icon'] ) && $cf['icon'] ) { |
|
746 | + echo '<b style="background-image: url("' . $cf['icon'] . '")"></b>'; |
|
747 | + } else { |
|
748 | + echo '<i class="fa fa-cog" aria-hidden="true"></i>'; |
|
749 | + } ?> |
|
750 | 750 | <?php echo $cf['name']; ?> |
751 | 751 | </a> |
752 | 752 | </li> |
753 | 753 | <?php |
754 | - } |
|
755 | - }else{ |
|
756 | - _e('There are no custom fields here yet.', 'geodirectory'); |
|
757 | - } |
|
758 | - ?> |
|
754 | + } |
|
755 | + }else{ |
|
756 | + _e('There are no custom fields here yet.', 'geodirectory'); |
|
757 | + } |
|
758 | + ?> |
|
759 | 759 | |
760 | 760 | |
761 | 761 | </ul> |
@@ -774,26 +774,26 @@ discard block |
||
774 | 774 | */ |
775 | 775 | function geodir_custom_selected_fields() |
776 | 776 | { |
777 | - $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
|
778 | - ?> |
|
777 | + $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
|
778 | + ?> |
|
779 | 779 | <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>"/> |
780 | 780 | <ul class="core"> |
781 | 781 | <?php |
782 | - global $wpdb; |
|
783 | - $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type = %s ORDER BY sort_order ASC", array($listing_type))); |
|
784 | - |
|
785 | - if (!empty($fields)) { |
|
786 | - foreach ($fields as $field) { |
|
787 | - //$result_str = $field->id; |
|
788 | - $result_str = $field; |
|
789 | - $field_type = $field->field_type; |
|
790 | - $field_type_key = $field->field_type_key; |
|
791 | - $field_ins_upd = 'display'; |
|
792 | - |
|
793 | - geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd,$field_type_key); |
|
794 | - } |
|
795 | - } |
|
796 | - ?></ul> |
|
782 | + global $wpdb; |
|
783 | + $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type = %s ORDER BY sort_order ASC", array($listing_type))); |
|
784 | + |
|
785 | + if (!empty($fields)) { |
|
786 | + foreach ($fields as $field) { |
|
787 | + //$result_str = $field->id; |
|
788 | + $result_str = $field; |
|
789 | + $field_type = $field->field_type; |
|
790 | + $field_type_key = $field->field_type_key; |
|
791 | + $field_ins_upd = 'display'; |
|
792 | + |
|
793 | + geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd,$field_type_key); |
|
794 | + } |
|
795 | + } |
|
796 | + ?></ul> |
|
797 | 797 | <?php |
798 | 798 | |
799 | 799 | } |
@@ -812,16 +812,16 @@ discard block |
||
812 | 812 | function geodir_custom_fields_panel_head($heading, $sub_tab, $listing_type) |
813 | 813 | { |
814 | 814 | |
815 | - switch ($sub_tab) { |
|
816 | - case 'custom_fields': |
|
817 | - $heading = sprintf(__('Manage %s Custom Fields', 'geodirectory'), get_post_type_singular_label($listing_type)); |
|
818 | - break; |
|
815 | + switch ($sub_tab) { |
|
816 | + case 'custom_fields': |
|
817 | + $heading = sprintf(__('Manage %s Custom Fields', 'geodirectory'), get_post_type_singular_label($listing_type)); |
|
818 | + break; |
|
819 | 819 | |
820 | - case 'sorting_options': |
|
821 | - $heading = sprintf(__('Manage %s Listing Sorting Options Fields', 'geodirectory'), get_post_type_singular_label($listing_type)); |
|
822 | - break; |
|
823 | - } |
|
824 | - return $heading; |
|
820 | + case 'sorting_options': |
|
821 | + $heading = sprintf(__('Manage %s Listing Sorting Options Fields', 'geodirectory'), get_post_type_singular_label($listing_type)); |
|
822 | + break; |
|
823 | + } |
|
824 | + return $heading; |
|
825 | 825 | } |
826 | 826 | |
827 | 827 | |
@@ -839,16 +839,16 @@ discard block |
||
839 | 839 | function geodir_cf_panel_available_fields_head($heading, $sub_tab, $listing_type) |
840 | 840 | { |
841 | 841 | |
842 | - switch ($sub_tab) { |
|
843 | - case 'custom_fields': |
|
844 | - $heading = sprintf(__('Add new %s form field', 'geodirectory'), get_post_type_singular_label($listing_type)); |
|
845 | - break; |
|
842 | + switch ($sub_tab) { |
|
843 | + case 'custom_fields': |
|
844 | + $heading = sprintf(__('Add new %s form field', 'geodirectory'), get_post_type_singular_label($listing_type)); |
|
845 | + break; |
|
846 | 846 | |
847 | - case 'sorting_options': |
|
848 | - $heading = sprintf(__('Available sorting options for %s listing and search results', 'geodirectory'), get_post_type_singular_label($listing_type)); |
|
849 | - break; |
|
850 | - } |
|
851 | - return $heading; |
|
847 | + case 'sorting_options': |
|
848 | + $heading = sprintf(__('Available sorting options for %s listing and search results', 'geodirectory'), get_post_type_singular_label($listing_type)); |
|
849 | + break; |
|
850 | + } |
|
851 | + return $heading; |
|
852 | 852 | } |
853 | 853 | |
854 | 854 | |
@@ -866,16 +866,16 @@ discard block |
||
866 | 866 | function geodir_cf_panel_available_fields_note($note, $sub_tab, $listing_type) |
867 | 867 | { |
868 | 868 | |
869 | - switch ($sub_tab) { |
|
870 | - case 'custom_fields': |
|
871 | - $note = sprintf(__('Click on any box below to add a field of that type to the add %s listing form. You can use a fieldset to group your fields.', 'geodirectory'), get_post_type_singular_label($listing_type));; |
|
872 | - break; |
|
869 | + switch ($sub_tab) { |
|
870 | + case 'custom_fields': |
|
871 | + $note = sprintf(__('Click on any box below to add a field of that type to the add %s listing form. You can use a fieldset to group your fields.', 'geodirectory'), get_post_type_singular_label($listing_type));; |
|
872 | + break; |
|
873 | 873 | |
874 | - case 'sorting_options': |
|
875 | - $note = sprintf(__('Click on any box below to make it appear in the sorting option dropdown on %s listing and search results.<br />To make a field available here, go to custom fields tab and expand any field from selected fields panel and tick the checkbox saying \'Include this field in sort option\'.', 'geodirectory'), get_post_type_singular_label($listing_type)); |
|
876 | - break; |
|
877 | - } |
|
878 | - return $note; |
|
874 | + case 'sorting_options': |
|
875 | + $note = sprintf(__('Click on any box below to make it appear in the sorting option dropdown on %s listing and search results.<br />To make a field available here, go to custom fields tab and expand any field from selected fields panel and tick the checkbox saying \'Include this field in sort option\'.', 'geodirectory'), get_post_type_singular_label($listing_type)); |
|
876 | + break; |
|
877 | + } |
|
878 | + return $note; |
|
879 | 879 | } |
880 | 880 | |
881 | 881 | |
@@ -893,16 +893,16 @@ discard block |
||
893 | 893 | function geodir_cf_panel_selected_fields_head($heading, $sub_tab, $listing_type) |
894 | 894 | { |
895 | 895 | |
896 | - switch ($sub_tab) { |
|
897 | - case 'custom_fields': |
|
898 | - $heading = sprintf(__('List of fields that will appear on add new %s listing form', 'geodirectory'), get_post_type_singular_label($listing_type)); |
|
899 | - break; |
|
896 | + switch ($sub_tab) { |
|
897 | + case 'custom_fields': |
|
898 | + $heading = sprintf(__('List of fields that will appear on add new %s listing form', 'geodirectory'), get_post_type_singular_label($listing_type)); |
|
899 | + break; |
|
900 | 900 | |
901 | - case 'sorting_options': |
|
902 | - $heading = sprintf(__('List of fields that will appear in %s listing and search results sorting option dropdown box.', 'geodirectory'), get_post_type_singular_label($listing_type)); |
|
903 | - break; |
|
904 | - } |
|
905 | - return $heading; |
|
901 | + case 'sorting_options': |
|
902 | + $heading = sprintf(__('List of fields that will appear in %s listing and search results sorting option dropdown box.', 'geodirectory'), get_post_type_singular_label($listing_type)); |
|
903 | + break; |
|
904 | + } |
|
905 | + return $heading; |
|
906 | 906 | } |
907 | 907 | |
908 | 908 | |
@@ -920,16 +920,16 @@ discard block |
||
920 | 920 | function geodir_cf_panel_selected_fields_note($note, $sub_tab, $listing_type) |
921 | 921 | { |
922 | 922 | |
923 | - switch ($sub_tab) { |
|
924 | - case 'custom_fields': |
|
925 | - $note = sprintf(__('Click to expand and view field related settings. You may drag and drop to arrange fields order on add %s listing form too.', 'geodirectory'), get_post_type_singular_label($listing_type));; |
|
926 | - break; |
|
923 | + switch ($sub_tab) { |
|
924 | + case 'custom_fields': |
|
925 | + $note = sprintf(__('Click to expand and view field related settings. You may drag and drop to arrange fields order on add %s listing form too.', 'geodirectory'), get_post_type_singular_label($listing_type));; |
|
926 | + break; |
|
927 | 927 | |
928 | - case 'sorting_options': |
|
929 | - $note = sprintf(__('Click to expand and view field related settings. You may drag and drop to arrange fields order in sorting option dropdown box on %s listing and search results page.', 'geodirectory'), get_post_type_singular_label($listing_type)); |
|
930 | - break; |
|
931 | - } |
|
932 | - return $note; |
|
928 | + case 'sorting_options': |
|
929 | + $note = sprintf(__('Click to expand and view field related settings. You may drag and drop to arrange fields order in sorting option dropdown box on %s listing and search results page.', 'geodirectory'), get_post_type_singular_label($listing_type)); |
|
930 | + break; |
|
931 | + } |
|
932 | + return $note; |
|
933 | 933 | } |
934 | 934 | |
935 | 935 | |
@@ -945,16 +945,16 @@ discard block |
||
945 | 945 | */ |
946 | 946 | function geodir_remove_unnecessary_fields() |
947 | 947 | { |
948 | - global $wpdb, $plugin_prefix; |
|
948 | + global $wpdb, $plugin_prefix; |
|
949 | 949 | |
950 | - if (!get_option('geodir_remove_unnecessary_fields')) { |
|
950 | + if (!get_option('geodir_remove_unnecessary_fields')) { |
|
951 | 951 | |
952 | - if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'")) |
|
953 | - $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`"); |
|
952 | + if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'")) |
|
953 | + $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`"); |
|
954 | 954 | |
955 | - update_option('geodir_remove_unnecessary_fields', '1'); |
|
955 | + update_option('geodir_remove_unnecessary_fields', '1'); |
|
956 | 956 | |
957 | - } |
|
957 | + } |
|
958 | 958 | |
959 | 959 | } |
960 | 960 | |
@@ -972,25 +972,25 @@ discard block |
||
972 | 972 | */ |
973 | 973 | function geodir_admin_ajax_handler() |
974 | 974 | { |
975 | - if (isset($_REQUEST['geodir_admin_ajax_action']) && $_REQUEST['geodir_admin_ajax_action'] != '') { |
|
976 | - $geodir_admin_ajax_action = $_REQUEST['geodir_admin_ajax_action']; |
|
977 | - switch ($geodir_admin_ajax_action) { |
|
978 | - case 'diagnosis' : |
|
979 | - if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') |
|
980 | - $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
|
981 | - call_user_func('geodir_diagnose_' . $diagnose_this); |
|
982 | - exit(); |
|
983 | - break; |
|
984 | - |
|
985 | - case 'diagnosis-fix' : |
|
986 | - if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') |
|
987 | - $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
|
988 | - call_user_func('geodir_diagnose_' . $diagnose_this); |
|
989 | - exit(); |
|
990 | - break; |
|
991 | - } |
|
992 | - } |
|
993 | - exit(); |
|
975 | + if (isset($_REQUEST['geodir_admin_ajax_action']) && $_REQUEST['geodir_admin_ajax_action'] != '') { |
|
976 | + $geodir_admin_ajax_action = $_REQUEST['geodir_admin_ajax_action']; |
|
977 | + switch ($geodir_admin_ajax_action) { |
|
978 | + case 'diagnosis' : |
|
979 | + if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') |
|
980 | + $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
|
981 | + call_user_func('geodir_diagnose_' . $diagnose_this); |
|
982 | + exit(); |
|
983 | + break; |
|
984 | + |
|
985 | + case 'diagnosis-fix' : |
|
986 | + if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') |
|
987 | + $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
|
988 | + call_user_func('geodir_diagnose_' . $diagnose_this); |
|
989 | + exit(); |
|
990 | + break; |
|
991 | + } |
|
992 | + } |
|
993 | + exit(); |
|
994 | 994 | } |
995 | 995 | |
996 | 996 | |
@@ -1008,127 +1008,127 @@ discard block |
||
1008 | 1008 | */ |
1009 | 1009 | function geodir_diagnose_multisite_table($filter_arr, $table, $tabel_name, $fix) |
1010 | 1010 | { |
1011 | - global $wpdb; |
|
1012 | - //$filter_arr['output_str'] .='###'.$table.'###'; |
|
1013 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0) { |
|
1014 | - $filter_arr['output_str'] .= "<li>" . __('ERROR: You did not follow instructions! Now you will need to contact support to manually fix things.', 'geodirectory') . "</li>"; |
|
1015 | - $filter_arr['is_error_during_diagnose'] = true; |
|
1016 | - |
|
1017 | - } elseif ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) { |
|
1018 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s_ms_bak table found', 'geodirectory'), $tabel_name) . "</li>"; |
|
1019 | - $filter_arr['is_error_during_diagnose'] = true; |
|
1020 | - $filter_arr['output_str'] .= "<li>" . __('IMPORTANT: This can be caused by out of date core or addons, please update core + addons before trying the fix OR YOU WILL HAVE A BAD TIME!', 'geodirectory') . "</li>"; |
|
1021 | - $filter_arr['is_error_during_diagnose'] = true; |
|
1022 | - |
|
1023 | - if ($fix) { |
|
1024 | - $ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $table . "_ms_bak");// get backup table count |
|
1025 | - $new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table");// get new table count |
|
1026 | - |
|
1027 | - if ($ms_bak_count == $new_table_count) {// if they are the same count rename to bak2 |
|
1028 | - //$filter_arr['output_str'] .= "<li>".sprintf( __('-->PROBLEM: %s table count is the same as new table, contact support' , 'geodirectory'), $table )."</li>" ; |
|
1029 | - |
|
1030 | - $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename bak table to new table |
|
1031 | - |
|
1032 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) { |
|
1033 | - $filter_arr['output_str'] .= "<li>" . __('-->FIXED: Renamed and backed up the tables', 'geodirectory') . "</li>"; |
|
1034 | - } else { |
|
1035 | - $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>"; |
|
1036 | - } |
|
1037 | - |
|
1038 | - } elseif ($ms_bak_count > $new_table_count) {//if backup is greater then restore it |
|
1039 | - |
|
1040 | - $wpdb->query("RENAME TABLE " . $wpdb->prefix . "$table TO " . $table . "_ms_bak2");// rename new table to bak2 |
|
1041 | - $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $wpdb->prefix . "$table");// rename bak table to new table |
|
1042 | - |
|
1043 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") && $wpdb->query("SHOW TABLES LIKE '$table'") == 0) { |
|
1044 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: restored largest table %s', 'geodirectory'), $table) . "</li>"; |
|
1045 | - } else { |
|
1046 | - $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>"; |
|
1047 | - } |
|
1048 | - |
|
1049 | - } elseif ($new_table_count > $ms_bak_count) {// we cant do much so rename the table to stop errors |
|
1050 | - |
|
1051 | - $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename ms_bak table to ms_bak2 |
|
1052 | - |
|
1053 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) { |
|
1054 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: table %s_ms_bak renamed and backed up', 'geodirectory'), $table) . "</li>"; |
|
1055 | - } else { |
|
1056 | - $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>"; |
|
1057 | - } |
|
1058 | - |
|
1059 | - } |
|
1060 | - |
|
1061 | - } |
|
1062 | - |
|
1063 | - |
|
1064 | - } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) { |
|
1065 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: Two %s tables found', 'geodirectory'), $tabel_name) . "</li>"; |
|
1066 | - $filter_arr['is_error_during_diagnose'] = true; |
|
1067 | - |
|
1068 | - if ($fix) { |
|
1069 | - if ($wpdb->get_var("SELECT COUNT(*) FROM $table") == 0) {// if first table is empty just delete it |
|
1070 | - if ($wpdb->query("DROP TABLE IF EXISTS $table")) { |
|
1071 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $table) . "</li>"; |
|
1072 | - } else { |
|
1073 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $table) . "</li>"; |
|
1074 | - } |
|
1075 | - |
|
1076 | - } elseif ($wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table") == 0) {// if main table is empty but original is not, delete main and rename original |
|
1077 | - if ($wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "$table")) { |
|
1078 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $wpdb->prefix . $table) . "</li>"; |
|
1079 | - } else { |
|
1080 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $wpdb->prefix . $table) . "</li>"; |
|
1081 | - } |
|
1082 | - if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) { |
|
1083 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>"; |
|
1084 | - } else { |
|
1085 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>"; |
|
1086 | - } |
|
1087 | - } else {// else rename the original table to _ms_bak |
|
1088 | - if ($wpdb->query("RENAME TABLE $table TO " . $table . "_ms_bak") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) { |
|
1089 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table contained info so we renamed %s to %s incase it is needed in future', 'geodirectory'), $table, $table . "_ms_bak") . "</li>"; |
|
1090 | - } else { |
|
1091 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Table %s could not be renamed to %s, this table has info so may need to be reviewed manually in the DB', 'geodirectory'), $table, $table . "_ms_bak") . "</li>"; |
|
1092 | - } |
|
1093 | - } |
|
1094 | - } |
|
1095 | - |
|
1096 | - } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) { |
|
1097 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table not converted', 'geodirectory'), $tabel_name) . "</li>"; |
|
1098 | - $filter_arr['is_error_during_diagnose'] = true; |
|
1099 | - |
|
1100 | - if ($fix) { |
|
1101 | - // if original table exists but new does not, rename |
|
1102 | - if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) { |
|
1103 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>"; |
|
1104 | - } else { |
|
1105 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>"; |
|
1106 | - } |
|
1107 | - |
|
1108 | - } |
|
1109 | - |
|
1110 | - } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") == 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) { |
|
1111 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table does not exist', 'geodirectory'), $tabel_name) . "</li>"; |
|
1112 | - $filter_arr['is_error_during_diagnose'] = true; |
|
1113 | - |
|
1114 | - if ($fix) { |
|
1115 | - // if original table does not exist try deleting db_vers of all addons so the initial db_install scripts run; |
|
1116 | - delete_option('geodirlocation_db_version'); |
|
1117 | - delete_option('geodirevents_db_version'); |
|
1118 | - delete_option('geodir_reviewrating_db_version'); |
|
1119 | - delete_option('gdevents_db_version'); |
|
1120 | - delete_option('geodirectory_db_version'); |
|
1121 | - delete_option('geodirclaim_db_version'); |
|
1122 | - delete_option('geodir_custom_posts_db_version'); |
|
1123 | - delete_option('geodir_reviewratings_db_version'); |
|
1124 | - delete_option('geodiradvancesearch_db_version'); |
|
1125 | - $filter_arr['output_str'] .= "<li>" . __('-->TRY: Please refresh page to run table install functions', 'geodirectory') . "</li>"; |
|
1126 | - } |
|
1127 | - |
|
1128 | - } else { |
|
1129 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('%s table converted correctly', 'geodirectory'), $tabel_name) . "</li>"; |
|
1130 | - } |
|
1131 | - return $filter_arr; |
|
1011 | + global $wpdb; |
|
1012 | + //$filter_arr['output_str'] .='###'.$table.'###'; |
|
1013 | + if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0) { |
|
1014 | + $filter_arr['output_str'] .= "<li>" . __('ERROR: You did not follow instructions! Now you will need to contact support to manually fix things.', 'geodirectory') . "</li>"; |
|
1015 | + $filter_arr['is_error_during_diagnose'] = true; |
|
1016 | + |
|
1017 | + } elseif ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) { |
|
1018 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s_ms_bak table found', 'geodirectory'), $tabel_name) . "</li>"; |
|
1019 | + $filter_arr['is_error_during_diagnose'] = true; |
|
1020 | + $filter_arr['output_str'] .= "<li>" . __('IMPORTANT: This can be caused by out of date core or addons, please update core + addons before trying the fix OR YOU WILL HAVE A BAD TIME!', 'geodirectory') . "</li>"; |
|
1021 | + $filter_arr['is_error_during_diagnose'] = true; |
|
1022 | + |
|
1023 | + if ($fix) { |
|
1024 | + $ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $table . "_ms_bak");// get backup table count |
|
1025 | + $new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table");// get new table count |
|
1026 | + |
|
1027 | + if ($ms_bak_count == $new_table_count) {// if they are the same count rename to bak2 |
|
1028 | + //$filter_arr['output_str'] .= "<li>".sprintf( __('-->PROBLEM: %s table count is the same as new table, contact support' , 'geodirectory'), $table )."</li>" ; |
|
1029 | + |
|
1030 | + $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename bak table to new table |
|
1031 | + |
|
1032 | + if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) { |
|
1033 | + $filter_arr['output_str'] .= "<li>" . __('-->FIXED: Renamed and backed up the tables', 'geodirectory') . "</li>"; |
|
1034 | + } else { |
|
1035 | + $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>"; |
|
1036 | + } |
|
1037 | + |
|
1038 | + } elseif ($ms_bak_count > $new_table_count) {//if backup is greater then restore it |
|
1039 | + |
|
1040 | + $wpdb->query("RENAME TABLE " . $wpdb->prefix . "$table TO " . $table . "_ms_bak2");// rename new table to bak2 |
|
1041 | + $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $wpdb->prefix . "$table");// rename bak table to new table |
|
1042 | + |
|
1043 | + if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") && $wpdb->query("SHOW TABLES LIKE '$table'") == 0) { |
|
1044 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: restored largest table %s', 'geodirectory'), $table) . "</li>"; |
|
1045 | + } else { |
|
1046 | + $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>"; |
|
1047 | + } |
|
1048 | + |
|
1049 | + } elseif ($new_table_count > $ms_bak_count) {// we cant do much so rename the table to stop errors |
|
1050 | + |
|
1051 | + $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename ms_bak table to ms_bak2 |
|
1052 | + |
|
1053 | + if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) { |
|
1054 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: table %s_ms_bak renamed and backed up', 'geodirectory'), $table) . "</li>"; |
|
1055 | + } else { |
|
1056 | + $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>"; |
|
1057 | + } |
|
1058 | + |
|
1059 | + } |
|
1060 | + |
|
1061 | + } |
|
1062 | + |
|
1063 | + |
|
1064 | + } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) { |
|
1065 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: Two %s tables found', 'geodirectory'), $tabel_name) . "</li>"; |
|
1066 | + $filter_arr['is_error_during_diagnose'] = true; |
|
1067 | + |
|
1068 | + if ($fix) { |
|
1069 | + if ($wpdb->get_var("SELECT COUNT(*) FROM $table") == 0) {// if first table is empty just delete it |
|
1070 | + if ($wpdb->query("DROP TABLE IF EXISTS $table")) { |
|
1071 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $table) . "</li>"; |
|
1072 | + } else { |
|
1073 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $table) . "</li>"; |
|
1074 | + } |
|
1075 | + |
|
1076 | + } elseif ($wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table") == 0) {// if main table is empty but original is not, delete main and rename original |
|
1077 | + if ($wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "$table")) { |
|
1078 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $wpdb->prefix . $table) . "</li>"; |
|
1079 | + } else { |
|
1080 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $wpdb->prefix . $table) . "</li>"; |
|
1081 | + } |
|
1082 | + if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) { |
|
1083 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>"; |
|
1084 | + } else { |
|
1085 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>"; |
|
1086 | + } |
|
1087 | + } else {// else rename the original table to _ms_bak |
|
1088 | + if ($wpdb->query("RENAME TABLE $table TO " . $table . "_ms_bak") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) { |
|
1089 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table contained info so we renamed %s to %s incase it is needed in future', 'geodirectory'), $table, $table . "_ms_bak") . "</li>"; |
|
1090 | + } else { |
|
1091 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Table %s could not be renamed to %s, this table has info so may need to be reviewed manually in the DB', 'geodirectory'), $table, $table . "_ms_bak") . "</li>"; |
|
1092 | + } |
|
1093 | + } |
|
1094 | + } |
|
1095 | + |
|
1096 | + } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) { |
|
1097 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table not converted', 'geodirectory'), $tabel_name) . "</li>"; |
|
1098 | + $filter_arr['is_error_during_diagnose'] = true; |
|
1099 | + |
|
1100 | + if ($fix) { |
|
1101 | + // if original table exists but new does not, rename |
|
1102 | + if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) { |
|
1103 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>"; |
|
1104 | + } else { |
|
1105 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>"; |
|
1106 | + } |
|
1107 | + |
|
1108 | + } |
|
1109 | + |
|
1110 | + } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") == 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) { |
|
1111 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table does not exist', 'geodirectory'), $tabel_name) . "</li>"; |
|
1112 | + $filter_arr['is_error_during_diagnose'] = true; |
|
1113 | + |
|
1114 | + if ($fix) { |
|
1115 | + // if original table does not exist try deleting db_vers of all addons so the initial db_install scripts run; |
|
1116 | + delete_option('geodirlocation_db_version'); |
|
1117 | + delete_option('geodirevents_db_version'); |
|
1118 | + delete_option('geodir_reviewrating_db_version'); |
|
1119 | + delete_option('gdevents_db_version'); |
|
1120 | + delete_option('geodirectory_db_version'); |
|
1121 | + delete_option('geodirclaim_db_version'); |
|
1122 | + delete_option('geodir_custom_posts_db_version'); |
|
1123 | + delete_option('geodir_reviewratings_db_version'); |
|
1124 | + delete_option('geodiradvancesearch_db_version'); |
|
1125 | + $filter_arr['output_str'] .= "<li>" . __('-->TRY: Please refresh page to run table install functions', 'geodirectory') . "</li>"; |
|
1126 | + } |
|
1127 | + |
|
1128 | + } else { |
|
1129 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('%s table converted correctly', 'geodirectory'), $tabel_name) . "</li>"; |
|
1130 | + } |
|
1131 | + return $filter_arr; |
|
1132 | 1132 | } |
1133 | 1133 | |
1134 | 1134 | |
@@ -1142,53 +1142,53 @@ discard block |
||
1142 | 1142 | */ |
1143 | 1143 | function geodir_diagnose_tags_sync() |
1144 | 1144 | { |
1145 | - global $wpdb, $plugin_prefix; |
|
1146 | - $fix = isset($_POST['fix']) ? true : false; |
|
1147 | - |
|
1148 | - //if($fix){echo 'true';}else{echo 'false';} |
|
1149 | - $is_error_during_diagnose = false; |
|
1150 | - $output_str = ''; |
|
1151 | - |
|
1152 | - |
|
1153 | - $all_postypes = geodir_get_posttypes(); |
|
1154 | - |
|
1155 | - if (!empty($all_postypes)) { |
|
1156 | - foreach ($all_postypes as $key) { |
|
1157 | - // update each GD CPT |
|
1158 | - $posts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d"); |
|
1159 | - |
|
1160 | - if (!empty($posts)) { |
|
1161 | - |
|
1162 | - foreach ($posts as $p) { |
|
1163 | - $p->post_type = $key; |
|
1164 | - $raw_tags = wp_get_object_terms($p->post_id, $p->post_type . '_tags', array('fields' => 'names')); |
|
1165 | - if (empty($raw_tags)) { |
|
1166 | - $post_tags = ''; |
|
1167 | - } else { |
|
1168 | - $post_tags = implode(",", $raw_tags); |
|
1169 | - } |
|
1170 | - $tablename = $plugin_prefix . $p->post_type . '_detail'; |
|
1171 | - $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id)); |
|
1172 | - |
|
1173 | - } |
|
1174 | - $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>"; |
|
1175 | - } |
|
1176 | - |
|
1177 | - } |
|
1178 | - |
|
1179 | - } |
|
1180 | - |
|
1181 | - if ($is_error_during_diagnose) { |
|
1182 | - $info_div_class = "geodir_problem_info"; |
|
1183 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />"; |
|
1184 | - } else { |
|
1185 | - $info_div_class = "geodir_noproblem_info"; |
|
1186 | - $fix_button_txt = ''; |
|
1187 | - } |
|
1188 | - echo "<ul class='$info_div_class'>"; |
|
1189 | - echo $output_str; |
|
1190 | - echo $fix_button_txt; |
|
1191 | - echo "</ul>"; |
|
1145 | + global $wpdb, $plugin_prefix; |
|
1146 | + $fix = isset($_POST['fix']) ? true : false; |
|
1147 | + |
|
1148 | + //if($fix){echo 'true';}else{echo 'false';} |
|
1149 | + $is_error_during_diagnose = false; |
|
1150 | + $output_str = ''; |
|
1151 | + |
|
1152 | + |
|
1153 | + $all_postypes = geodir_get_posttypes(); |
|
1154 | + |
|
1155 | + if (!empty($all_postypes)) { |
|
1156 | + foreach ($all_postypes as $key) { |
|
1157 | + // update each GD CPT |
|
1158 | + $posts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d"); |
|
1159 | + |
|
1160 | + if (!empty($posts)) { |
|
1161 | + |
|
1162 | + foreach ($posts as $p) { |
|
1163 | + $p->post_type = $key; |
|
1164 | + $raw_tags = wp_get_object_terms($p->post_id, $p->post_type . '_tags', array('fields' => 'names')); |
|
1165 | + if (empty($raw_tags)) { |
|
1166 | + $post_tags = ''; |
|
1167 | + } else { |
|
1168 | + $post_tags = implode(",", $raw_tags); |
|
1169 | + } |
|
1170 | + $tablename = $plugin_prefix . $p->post_type . '_detail'; |
|
1171 | + $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id)); |
|
1172 | + |
|
1173 | + } |
|
1174 | + $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>"; |
|
1175 | + } |
|
1176 | + |
|
1177 | + } |
|
1178 | + |
|
1179 | + } |
|
1180 | + |
|
1181 | + if ($is_error_during_diagnose) { |
|
1182 | + $info_div_class = "geodir_problem_info"; |
|
1183 | + $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />"; |
|
1184 | + } else { |
|
1185 | + $info_div_class = "geodir_noproblem_info"; |
|
1186 | + $fix_button_txt = ''; |
|
1187 | + } |
|
1188 | + echo "<ul class='$info_div_class'>"; |
|
1189 | + echo $output_str; |
|
1190 | + echo $fix_button_txt; |
|
1191 | + echo "</ul>"; |
|
1192 | 1192 | |
1193 | 1193 | } |
1194 | 1194 | |
@@ -1204,75 +1204,75 @@ discard block |
||
1204 | 1204 | */ |
1205 | 1205 | function geodir_diagnose_cats_sync() |
1206 | 1206 | { |
1207 | - global $wpdb, $plugin_prefix; |
|
1208 | - $fix = isset($_POST['fix']) ? true : false; |
|
1207 | + global $wpdb, $plugin_prefix; |
|
1208 | + $fix = isset($_POST['fix']) ? true : false; |
|
1209 | 1209 | |
1210 | - //if($fix){echo 'true';}else{echo 'false';} |
|
1211 | - $is_error_during_diagnose = false; |
|
1212 | - $output_str = ''; |
|
1210 | + //if($fix){echo 'true';}else{echo 'false';} |
|
1211 | + $is_error_during_diagnose = false; |
|
1212 | + $output_str = ''; |
|
1213 | 1213 | |
1214 | 1214 | |
1215 | - $all_postypes = geodir_get_posttypes(); |
|
1215 | + $all_postypes = geodir_get_posttypes(); |
|
1216 | 1216 | |
1217 | - if (!empty($all_postypes)) { |
|
1218 | - foreach ($all_postypes as $key) { |
|
1219 | - // update each GD CTP |
|
1220 | - $posts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d WHERE d." . $key . "category='' "); |
|
1217 | + if (!empty($all_postypes)) { |
|
1218 | + foreach ($all_postypes as $key) { |
|
1219 | + // update each GD CTP |
|
1220 | + $posts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d WHERE d." . $key . "category='' "); |
|
1221 | 1221 | |
1222 | - if (!empty($posts)) { |
|
1222 | + if (!empty($posts)) { |
|
1223 | 1223 | |
1224 | - foreach ($posts as $p) { |
|
1225 | - $p->post_type = $key; |
|
1226 | - $raw_cats = wp_get_object_terms($p->post_id, $p->post_type . 'category', array('fields' => 'ids')); |
|
1224 | + foreach ($posts as $p) { |
|
1225 | + $p->post_type = $key; |
|
1226 | + $raw_cats = wp_get_object_terms($p->post_id, $p->post_type . 'category', array('fields' => 'ids')); |
|
1227 | 1227 | |
1228 | - if (empty($raw_cats)) { |
|
1229 | - $post_categories = get_post_meta($p->post_id, 'post_categories', true); |
|
1228 | + if (empty($raw_cats)) { |
|
1229 | + $post_categories = get_post_meta($p->post_id, 'post_categories', true); |
|
1230 | 1230 | |
1231 | - if (!empty($post_categories) && !empty($post_categories[$p->post_type . 'category'])) { |
|
1232 | - $post_categories[$p->post_type . 'category'] = str_replace("d:", "", $post_categories[$p->post_type . 'category']); |
|
1233 | - foreach (explode(",", $post_categories[$p->post_type . 'category']) as $cat_part) { |
|
1234 | - if (is_numeric($cat_part)) { |
|
1235 | - $raw_cats[] = (int)$cat_part; |
|
1236 | - } |
|
1237 | - } |
|
1231 | + if (!empty($post_categories) && !empty($post_categories[$p->post_type . 'category'])) { |
|
1232 | + $post_categories[$p->post_type . 'category'] = str_replace("d:", "", $post_categories[$p->post_type . 'category']); |
|
1233 | + foreach (explode(",", $post_categories[$p->post_type . 'category']) as $cat_part) { |
|
1234 | + if (is_numeric($cat_part)) { |
|
1235 | + $raw_cats[] = (int)$cat_part; |
|
1236 | + } |
|
1237 | + } |
|
1238 | 1238 | |
1239 | - } |
|
1239 | + } |
|
1240 | 1240 | |
1241 | - if (!empty($raw_cats)) { |
|
1242 | - $term_taxonomy_ids = wp_set_object_terms($p->post_id, $raw_cats, $p->post_type . 'category'); |
|
1241 | + if (!empty($raw_cats)) { |
|
1242 | + $term_taxonomy_ids = wp_set_object_terms($p->post_id, $raw_cats, $p->post_type . 'category'); |
|
1243 | 1243 | |
1244 | - } |
|
1244 | + } |
|
1245 | 1245 | |
1246 | - } |
|
1246 | + } |
|
1247 | 1247 | |
1248 | 1248 | |
1249 | - if (empty($raw_cats)) { |
|
1250 | - $post_cats = ''; |
|
1251 | - } else { |
|
1252 | - $post_cats = ',' . implode(",", $raw_cats) . ','; |
|
1253 | - } |
|
1254 | - $tablename = $plugin_prefix . $p->post_type . '_detail'; |
|
1255 | - $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET " . $p->post_type . "category=%s WHERE post_id =%d", $post_cats, $p->post_id)); |
|
1256 | - } |
|
1249 | + if (empty($raw_cats)) { |
|
1250 | + $post_cats = ''; |
|
1251 | + } else { |
|
1252 | + $post_cats = ',' . implode(",", $raw_cats) . ','; |
|
1253 | + } |
|
1254 | + $tablename = $plugin_prefix . $p->post_type . '_detail'; |
|
1255 | + $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET " . $p->post_type . "category=%s WHERE post_id =%d", $post_cats, $p->post_id)); |
|
1256 | + } |
|
1257 | 1257 | |
1258 | - } |
|
1259 | - $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>"; |
|
1258 | + } |
|
1259 | + $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>"; |
|
1260 | 1260 | |
1261 | - } |
|
1261 | + } |
|
1262 | 1262 | |
1263 | - } |
|
1263 | + } |
|
1264 | 1264 | |
1265 | - if ($is_error_during_diagnose) { |
|
1266 | - $info_div_class = "geodir_problem_info"; |
|
1267 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />"; |
|
1268 | - } else { |
|
1269 | - $info_div_class = "geodir_noproblem_info"; |
|
1270 | - $fix_button_txt = ''; |
|
1271 | - } |
|
1272 | - echo "<ul class='$info_div_class'>"; |
|
1273 | - echo $output_str; |
|
1274 | - echo $fix_button_txt; |
|
1275 | - echo "</ul>"; |
|
1265 | + if ($is_error_during_diagnose) { |
|
1266 | + $info_div_class = "geodir_problem_info"; |
|
1267 | + $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />"; |
|
1268 | + } else { |
|
1269 | + $info_div_class = "geodir_noproblem_info"; |
|
1270 | + $fix_button_txt = ''; |
|
1271 | + } |
|
1272 | + echo "<ul class='$info_div_class'>"; |
|
1273 | + echo $output_str; |
|
1274 | + echo $fix_button_txt; |
|
1275 | + echo "</ul>"; |
|
1276 | 1276 | |
1277 | 1277 | } |
1278 | 1278 | |
@@ -1286,61 +1286,61 @@ discard block |
||
1286 | 1286 | */ |
1287 | 1287 | function geodir_diagnose_version_clear() |
1288 | 1288 | { |
1289 | - global $wpdb, $plugin_prefix; |
|
1290 | - $fix = isset($_POST['fix']) ? true : false; |
|
1291 | - |
|
1292 | - //if($fix){echo 'true';}else{echo 'false';} |
|
1293 | - $is_error_during_diagnose = false; |
|
1294 | - $output_str = ''; |
|
1295 | - |
|
1296 | - |
|
1297 | - $gd_arr = array('GeoDirectory' => 'geodirectory_db_version', |
|
1298 | - 'Payment Manager' => 'geodir_payments_db_version', |
|
1299 | - 'GeoDirectory Framework' => 'gdf_db_version', |
|
1300 | - 'Advanced Search' => 'geodiradvancesearch_db_version', |
|
1301 | - 'Review Rating Manager' => 'geodir_reviewratings_db_version', |
|
1302 | - 'Claim Manager' => 'geodirclaim_db_version', |
|
1303 | - 'CPT Manager' => 'geodir_custom_posts_db_version', |
|
1304 | - 'Location Manager' => 'geodirlocation_db_version', |
|
1305 | - 'Payment Manager' => 'geodir_payments_db_version', |
|
1306 | - 'Events Manager' => 'geodirevents_db_version', |
|
1307 | - ); |
|
1308 | - |
|
1309 | - /** |
|
1310 | - * Filter the array of plugins to clear the version numbers for in the GD >Tools : clear all version numbers. |
|
1311 | - * |
|
1312 | - * @since 1.0.0 |
|
1313 | - * @param array $gd_arr The array or addons to clear, array('GeoDirectory' => 'geodirectory_db_version',... |
|
1314 | - */ |
|
1315 | - $ver_arr = apply_filters('geodir_db_version_name', $gd_arr); |
|
1316 | - |
|
1317 | - if (!empty($ver_arr)) { |
|
1318 | - foreach ($ver_arr as $key => $val) { |
|
1319 | - if (delete_option($val)) { |
|
1320 | - $output_str .= "<li>" . $key . __(' Version: Deleted', 'geodirectory') . "</li>"; |
|
1321 | - } else { |
|
1322 | - $output_str .= "<li>" . $key . __(' Version: Not Found', 'geodirectory') . "</li>"; |
|
1323 | - } |
|
1324 | - |
|
1325 | - } |
|
1326 | - |
|
1327 | - if ($output_str) { |
|
1328 | - $output_str .= "<li><strong>" . __(' Upgrade/install scripts will run on next page reload.', 'geodirectory') . "</strong></li>"; |
|
1329 | - } |
|
1330 | - |
|
1331 | - } |
|
1332 | - |
|
1333 | - if ($is_error_during_diagnose) { |
|
1334 | - $info_div_class = "geodir_problem_info"; |
|
1335 | - $fix_button_txt = ""; |
|
1336 | - } else { |
|
1337 | - $info_div_class = "geodir_noproblem_info"; |
|
1338 | - $fix_button_txt = ''; |
|
1339 | - } |
|
1340 | - echo "<ul class='$info_div_class'>"; |
|
1341 | - echo $output_str; |
|
1342 | - echo $fix_button_txt; |
|
1343 | - echo "</ul>"; |
|
1289 | + global $wpdb, $plugin_prefix; |
|
1290 | + $fix = isset($_POST['fix']) ? true : false; |
|
1291 | + |
|
1292 | + //if($fix){echo 'true';}else{echo 'false';} |
|
1293 | + $is_error_during_diagnose = false; |
|
1294 | + $output_str = ''; |
|
1295 | + |
|
1296 | + |
|
1297 | + $gd_arr = array('GeoDirectory' => 'geodirectory_db_version', |
|
1298 | + 'Payment Manager' => 'geodir_payments_db_version', |
|
1299 | + 'GeoDirectory Framework' => 'gdf_db_version', |
|
1300 | + 'Advanced Search' => 'geodiradvancesearch_db_version', |
|
1301 | + 'Review Rating Manager' => 'geodir_reviewratings_db_version', |
|
1302 | + 'Claim Manager' => 'geodirclaim_db_version', |
|
1303 | + 'CPT Manager' => 'geodir_custom_posts_db_version', |
|
1304 | + 'Location Manager' => 'geodirlocation_db_version', |
|
1305 | + 'Payment Manager' => 'geodir_payments_db_version', |
|
1306 | + 'Events Manager' => 'geodirevents_db_version', |
|
1307 | + ); |
|
1308 | + |
|
1309 | + /** |
|
1310 | + * Filter the array of plugins to clear the version numbers for in the GD >Tools : clear all version numbers. |
|
1311 | + * |
|
1312 | + * @since 1.0.0 |
|
1313 | + * @param array $gd_arr The array or addons to clear, array('GeoDirectory' => 'geodirectory_db_version',... |
|
1314 | + */ |
|
1315 | + $ver_arr = apply_filters('geodir_db_version_name', $gd_arr); |
|
1316 | + |
|
1317 | + if (!empty($ver_arr)) { |
|
1318 | + foreach ($ver_arr as $key => $val) { |
|
1319 | + if (delete_option($val)) { |
|
1320 | + $output_str .= "<li>" . $key . __(' Version: Deleted', 'geodirectory') . "</li>"; |
|
1321 | + } else { |
|
1322 | + $output_str .= "<li>" . $key . __(' Version: Not Found', 'geodirectory') . "</li>"; |
|
1323 | + } |
|
1324 | + |
|
1325 | + } |
|
1326 | + |
|
1327 | + if ($output_str) { |
|
1328 | + $output_str .= "<li><strong>" . __(' Upgrade/install scripts will run on next page reload.', 'geodirectory') . "</strong></li>"; |
|
1329 | + } |
|
1330 | + |
|
1331 | + } |
|
1332 | + |
|
1333 | + if ($is_error_during_diagnose) { |
|
1334 | + $info_div_class = "geodir_problem_info"; |
|
1335 | + $fix_button_txt = ""; |
|
1336 | + } else { |
|
1337 | + $info_div_class = "geodir_noproblem_info"; |
|
1338 | + $fix_button_txt = ''; |
|
1339 | + } |
|
1340 | + echo "<ul class='$info_div_class'>"; |
|
1341 | + echo $output_str; |
|
1342 | + echo $fix_button_txt; |
|
1343 | + echo "</ul>"; |
|
1344 | 1344 | |
1345 | 1345 | } |
1346 | 1346 | |
@@ -1354,59 +1354,59 @@ discard block |
||
1354 | 1354 | */ |
1355 | 1355 | function geodir_diagnose_ratings() |
1356 | 1356 | { |
1357 | - global $wpdb; |
|
1358 | - $fix = isset($_POST['fix']) ? true : false; |
|
1359 | - |
|
1360 | - //if($fix){echo 'true';}else{echo 'false';} |
|
1361 | - $is_error_during_diagnose = false; |
|
1362 | - $output_str = ''; |
|
1363 | - |
|
1364 | - // check review locations |
|
1365 | - if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE post_city='' OR post_city IS NULL OR post_latitude='' OR post_latitude IS NULL")) { |
|
1366 | - $output_str .= "<li>" . __('Review locations missing or broken', 'geodirectory') . "</li>"; |
|
1367 | - $is_error_during_diagnose = true; |
|
1368 | - |
|
1369 | - if ($fix) { |
|
1370 | - if (geodir_fix_review_location()) { |
|
1371 | - $output_str .= "<li><strong>" . __('-->FIXED: Review locations fixed', 'geodirectory') . "</strong></li>"; |
|
1372 | - } else { |
|
1373 | - $output_str .= "<li><strong>" . __('-->FAILED: Review locations fix failed', 'geodirectory') . "</strong></li>"; |
|
1374 | - } |
|
1375 | - } |
|
1376 | - |
|
1377 | - } else { |
|
1378 | - $output_str .= "<li>" . __('Review locations ok', 'geodirectory') . "</li>"; |
|
1379 | - } |
|
1380 | - |
|
1381 | - // check review content |
|
1382 | - if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_content IS NULL")) { |
|
1383 | - $output_str .= "<li>" . __('Review content missing or broken', 'geodirectory') . "</li>"; |
|
1384 | - $is_error_during_diagnose = true; |
|
1385 | - |
|
1386 | - if ($fix) { |
|
1387 | - if (geodir_fix_review_content()) { |
|
1388 | - $output_str .= "<li><strong>" . __('-->FIXED: Review content fixed', 'geodirectory') . "</strong></li>"; |
|
1389 | - } else { |
|
1390 | - $output_str .= "<li><strong>" . __('-->FAILED: Review content fix failed', 'geodirectory') . "</strong></li>"; |
|
1391 | - } |
|
1392 | - } |
|
1393 | - |
|
1394 | - } else { |
|
1395 | - $output_str .= "<li>" . __('Review content ok', 'geodirectory') . "</li>"; |
|
1396 | - } |
|
1397 | - |
|
1398 | - |
|
1399 | - if ($is_error_during_diagnose) { |
|
1400 | - $info_div_class = "geodir_problem_info"; |
|
1401 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />"; |
|
1402 | - } else { |
|
1403 | - $info_div_class = "geodir_noproblem_info"; |
|
1404 | - $fix_button_txt = ''; |
|
1405 | - } |
|
1406 | - echo "<ul class='$info_div_class'>"; |
|
1407 | - echo $output_str; |
|
1408 | - echo $fix_button_txt; |
|
1409 | - echo "</ul>"; |
|
1357 | + global $wpdb; |
|
1358 | + $fix = isset($_POST['fix']) ? true : false; |
|
1359 | + |
|
1360 | + //if($fix){echo 'true';}else{echo 'false';} |
|
1361 | + $is_error_during_diagnose = false; |
|
1362 | + $output_str = ''; |
|
1363 | + |
|
1364 | + // check review locations |
|
1365 | + if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE post_city='' OR post_city IS NULL OR post_latitude='' OR post_latitude IS NULL")) { |
|
1366 | + $output_str .= "<li>" . __('Review locations missing or broken', 'geodirectory') . "</li>"; |
|
1367 | + $is_error_during_diagnose = true; |
|
1368 | + |
|
1369 | + if ($fix) { |
|
1370 | + if (geodir_fix_review_location()) { |
|
1371 | + $output_str .= "<li><strong>" . __('-->FIXED: Review locations fixed', 'geodirectory') . "</strong></li>"; |
|
1372 | + } else { |
|
1373 | + $output_str .= "<li><strong>" . __('-->FAILED: Review locations fix failed', 'geodirectory') . "</strong></li>"; |
|
1374 | + } |
|
1375 | + } |
|
1376 | + |
|
1377 | + } else { |
|
1378 | + $output_str .= "<li>" . __('Review locations ok', 'geodirectory') . "</li>"; |
|
1379 | + } |
|
1380 | + |
|
1381 | + // check review content |
|
1382 | + if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_content IS NULL")) { |
|
1383 | + $output_str .= "<li>" . __('Review content missing or broken', 'geodirectory') . "</li>"; |
|
1384 | + $is_error_during_diagnose = true; |
|
1385 | + |
|
1386 | + if ($fix) { |
|
1387 | + if (geodir_fix_review_content()) { |
|
1388 | + $output_str .= "<li><strong>" . __('-->FIXED: Review content fixed', 'geodirectory') . "</strong></li>"; |
|
1389 | + } else { |
|
1390 | + $output_str .= "<li><strong>" . __('-->FAILED: Review content fix failed', 'geodirectory') . "</strong></li>"; |
|
1391 | + } |
|
1392 | + } |
|
1393 | + |
|
1394 | + } else { |
|
1395 | + $output_str .= "<li>" . __('Review content ok', 'geodirectory') . "</li>"; |
|
1396 | + } |
|
1397 | + |
|
1398 | + |
|
1399 | + if ($is_error_during_diagnose) { |
|
1400 | + $info_div_class = "geodir_problem_info"; |
|
1401 | + $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />"; |
|
1402 | + } else { |
|
1403 | + $info_div_class = "geodir_noproblem_info"; |
|
1404 | + $fix_button_txt = ''; |
|
1405 | + } |
|
1406 | + echo "<ul class='$info_div_class'>"; |
|
1407 | + echo $output_str; |
|
1408 | + echo $fix_button_txt; |
|
1409 | + echo "</ul>"; |
|
1410 | 1410 | |
1411 | 1411 | } |
1412 | 1412 | |
@@ -1420,57 +1420,57 @@ discard block |
||
1420 | 1420 | */ |
1421 | 1421 | function geodir_diagnose_multisite_conversion() |
1422 | 1422 | { |
1423 | - global $wpdb; |
|
1424 | - $fix = isset($_POST['fix']) ? true : false; |
|
1425 | - //if($fix){echo 'true';}else{echo 'false';} |
|
1426 | - $is_error_during_diagnose = false; |
|
1427 | - $output_str = ''; |
|
1428 | - |
|
1429 | - $filter_arr = array(); |
|
1430 | - $filter_arr['output_str'] = $output_str; |
|
1431 | - $filter_arr['is_error_during_diagnose'] = $is_error_during_diagnose; |
|
1432 | - $table_arr = array('geodir_countries' => __('Countries', 'geodirectory'), |
|
1433 | - 'geodir_custom_fields' => __('Custom fields', 'geodirectory'), |
|
1434 | - 'geodir_post_icon' => __('Post icon', 'geodirectory'), |
|
1435 | - 'geodir_attachments' => __('Attachments', 'geodirectory'), |
|
1436 | - 'geodir_post_review' => __('Reviews', 'geodirectory'), |
|
1437 | - 'geodir_custom_sort_fields' => __('Custom sort fields', 'geodirectory'), |
|
1438 | - 'geodir_gd_place_detail' => __('Place detail', 'geodirectory') |
|
1439 | - ); |
|
1440 | - |
|
1441 | - // allow other addons to hook in and add their checks |
|
1442 | - |
|
1443 | - /** |
|
1444 | - * Filter the array of tables. |
|
1445 | - * |
|
1446 | - * Filter the array of tables to check during the GD>Tools multisite DB conversion tool check, this allows addons to add their DB tables to the checks. |
|
1447 | - * |
|
1448 | - * @since 1.0.0 |
|
1449 | - * @param array $table_arr The array of tables to check, array('geodir_countries' => __('Countries', 'geodirectory'),... |
|
1450 | - */ |
|
1451 | - $table_arr = apply_filters('geodir_diagnose_multisite_conversion', $table_arr); |
|
1452 | - |
|
1453 | - foreach ($table_arr as $table => $table_name) { |
|
1454 | - // Diagnose table |
|
1455 | - $filter_arr = geodir_diagnose_multisite_table($filter_arr, $table, $table_name, $fix); |
|
1456 | - } |
|
1457 | - |
|
1458 | - |
|
1459 | - $output_str = $filter_arr['output_str']; |
|
1460 | - $is_error_during_diagnose = $filter_arr['is_error_during_diagnose']; |
|
1461 | - |
|
1462 | - |
|
1463 | - if ($is_error_during_diagnose) { |
|
1464 | - $info_div_class = "geodir_problem_info"; |
|
1465 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='multisite_conversion' />"; |
|
1466 | - } else { |
|
1467 | - $info_div_class = "geodir_noproblem_info"; |
|
1468 | - $fix_button_txt = ''; |
|
1469 | - } |
|
1470 | - echo "<ul class='$info_div_class'>"; |
|
1471 | - echo $output_str; |
|
1472 | - echo $fix_button_txt; |
|
1473 | - echo "</ul>"; |
|
1423 | + global $wpdb; |
|
1424 | + $fix = isset($_POST['fix']) ? true : false; |
|
1425 | + //if($fix){echo 'true';}else{echo 'false';} |
|
1426 | + $is_error_during_diagnose = false; |
|
1427 | + $output_str = ''; |
|
1428 | + |
|
1429 | + $filter_arr = array(); |
|
1430 | + $filter_arr['output_str'] = $output_str; |
|
1431 | + $filter_arr['is_error_during_diagnose'] = $is_error_during_diagnose; |
|
1432 | + $table_arr = array('geodir_countries' => __('Countries', 'geodirectory'), |
|
1433 | + 'geodir_custom_fields' => __('Custom fields', 'geodirectory'), |
|
1434 | + 'geodir_post_icon' => __('Post icon', 'geodirectory'), |
|
1435 | + 'geodir_attachments' => __('Attachments', 'geodirectory'), |
|
1436 | + 'geodir_post_review' => __('Reviews', 'geodirectory'), |
|
1437 | + 'geodir_custom_sort_fields' => __('Custom sort fields', 'geodirectory'), |
|
1438 | + 'geodir_gd_place_detail' => __('Place detail', 'geodirectory') |
|
1439 | + ); |
|
1440 | + |
|
1441 | + // allow other addons to hook in and add their checks |
|
1442 | + |
|
1443 | + /** |
|
1444 | + * Filter the array of tables. |
|
1445 | + * |
|
1446 | + * Filter the array of tables to check during the GD>Tools multisite DB conversion tool check, this allows addons to add their DB tables to the checks. |
|
1447 | + * |
|
1448 | + * @since 1.0.0 |
|
1449 | + * @param array $table_arr The array of tables to check, array('geodir_countries' => __('Countries', 'geodirectory'),... |
|
1450 | + */ |
|
1451 | + $table_arr = apply_filters('geodir_diagnose_multisite_conversion', $table_arr); |
|
1452 | + |
|
1453 | + foreach ($table_arr as $table => $table_name) { |
|
1454 | + // Diagnose table |
|
1455 | + $filter_arr = geodir_diagnose_multisite_table($filter_arr, $table, $table_name, $fix); |
|
1456 | + } |
|
1457 | + |
|
1458 | + |
|
1459 | + $output_str = $filter_arr['output_str']; |
|
1460 | + $is_error_during_diagnose = $filter_arr['is_error_during_diagnose']; |
|
1461 | + |
|
1462 | + |
|
1463 | + if ($is_error_during_diagnose) { |
|
1464 | + $info_div_class = "geodir_problem_info"; |
|
1465 | + $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='multisite_conversion' />"; |
|
1466 | + } else { |
|
1467 | + $info_div_class = "geodir_noproblem_info"; |
|
1468 | + $fix_button_txt = ''; |
|
1469 | + } |
|
1470 | + echo "<ul class='$info_div_class'>"; |
|
1471 | + echo $output_str; |
|
1472 | + echo $fix_button_txt; |
|
1473 | + echo "</ul>"; |
|
1474 | 1474 | } |
1475 | 1475 | |
1476 | 1476 | /** |
@@ -1488,39 +1488,39 @@ discard block |
||
1488 | 1488 | */ |
1489 | 1489 | function geodir_fix_virtual_page($slug, $page_title, $old_id, $option) |
1490 | 1490 | { |
1491 | - global $wpdb, $current_user; |
|
1492 | - |
|
1493 | - if (!empty($old_id)) { |
|
1494 | - wp_delete_post($old_id, true); |
|
1495 | - }//delete post if already there |
|
1496 | - else { |
|
1497 | - $page_found = $wpdb->get_var( |
|
1498 | - $wpdb->prepare( |
|
1499 | - "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;", |
|
1500 | - array($slug) |
|
1501 | - ) |
|
1502 | - ); |
|
1503 | - wp_delete_post($page_found, true); |
|
1504 | - |
|
1505 | - } |
|
1506 | - |
|
1507 | - $page_data = array( |
|
1508 | - 'post_status' => 'publish', |
|
1509 | - 'post_type' => 'page', |
|
1510 | - 'post_author' => $current_user->ID, |
|
1511 | - 'post_name' => $slug, |
|
1512 | - 'post_title' => $page_title, |
|
1513 | - 'post_content' => '', |
|
1514 | - 'post_parent' => 0, |
|
1515 | - 'comment_status' => 'closed' |
|
1516 | - ); |
|
1517 | - $page_id = wp_insert_post($page_data); |
|
1518 | - update_option($option, $page_id); |
|
1519 | - if ($page_id) { |
|
1520 | - return true; |
|
1521 | - } else { |
|
1522 | - return false; |
|
1523 | - } |
|
1491 | + global $wpdb, $current_user; |
|
1492 | + |
|
1493 | + if (!empty($old_id)) { |
|
1494 | + wp_delete_post($old_id, true); |
|
1495 | + }//delete post if already there |
|
1496 | + else { |
|
1497 | + $page_found = $wpdb->get_var( |
|
1498 | + $wpdb->prepare( |
|
1499 | + "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;", |
|
1500 | + array($slug) |
|
1501 | + ) |
|
1502 | + ); |
|
1503 | + wp_delete_post($page_found, true); |
|
1504 | + |
|
1505 | + } |
|
1506 | + |
|
1507 | + $page_data = array( |
|
1508 | + 'post_status' => 'publish', |
|
1509 | + 'post_type' => 'page', |
|
1510 | + 'post_author' => $current_user->ID, |
|
1511 | + 'post_name' => $slug, |
|
1512 | + 'post_title' => $page_title, |
|
1513 | + 'post_content' => '', |
|
1514 | + 'post_parent' => 0, |
|
1515 | + 'comment_status' => 'closed' |
|
1516 | + ); |
|
1517 | + $page_id = wp_insert_post($page_data); |
|
1518 | + update_option($option, $page_id); |
|
1519 | + if ($page_id) { |
|
1520 | + return true; |
|
1521 | + } else { |
|
1522 | + return false; |
|
1523 | + } |
|
1524 | 1524 | } |
1525 | 1525 | |
1526 | 1526 | /** |
@@ -1532,212 +1532,212 @@ discard block |
||
1532 | 1532 | */ |
1533 | 1533 | function geodir_diagnose_default_pages() |
1534 | 1534 | { |
1535 | - global $wpdb; |
|
1536 | - $is_error_during_diagnose = false; |
|
1537 | - $output_str = ''; |
|
1538 | - $fix = isset($_POST['fix']) ? true : false; |
|
1539 | - |
|
1540 | - ////////////////////////////////// |
|
1541 | - /* Diagnose GD Home Page Starts */ |
|
1542 | - ////////////////////////////////// |
|
1543 | - $option_value = get_option('geodir_home_page'); |
|
1544 | - $page = get_post($option_value); |
|
1545 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1546 | - |
|
1547 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1548 | - $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1549 | - else { |
|
1550 | - $is_error_during_diagnose = true; |
|
1551 | - $output_str .= "<li><strong>" . __('GD Home page is missing.', 'geodirectory') . "</strong></li>"; |
|
1552 | - if ($fix) { |
|
1553 | - if (geodir_fix_virtual_page('gd-home', __('GD Home page', 'geodirectory'), $page_found, 'geodir_home_page')) { |
|
1554 | - $output_str .= "<li><strong>" . __('-->FIXED: GD Home page fixed', 'geodirectory') . "</strong></li>"; |
|
1555 | - } else { |
|
1556 | - $output_str .= "<li><strong>" . __('-->FAILED: GD Home page fix failed', 'geodirectory') . "</strong></li>"; |
|
1557 | - } |
|
1558 | - } |
|
1559 | - } |
|
1560 | - |
|
1561 | - //////////////////////////////// |
|
1562 | - /* Diagnose GD Home Page Ends */ |
|
1563 | - //////////////////////////////// |
|
1564 | - |
|
1565 | - ////////////////////////////////// |
|
1566 | - /* Diagnose Add Listing Page Starts */ |
|
1567 | - ////////////////////////////////// |
|
1568 | - $option_value = get_option('geodir_add_listing_page'); |
|
1569 | - $page = get_post($option_value); |
|
1570 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1571 | - |
|
1572 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1573 | - $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1574 | - else { |
|
1575 | - $is_error_during_diagnose = true; |
|
1576 | - $output_str .= "<li><strong>" . __('Add Listing page is missing.', 'geodirectory') . "</strong></li>"; |
|
1577 | - if ($fix) { |
|
1578 | - if (geodir_fix_virtual_page('add-listing', __('Add Listing', 'geodirectory'), $page_found, 'geodir_add_listing_page')) { |
|
1579 | - $output_str .= "<li><strong>" . __('-->FIXED: Add Listing page fixed', 'geodirectory') . "</strong></li>"; |
|
1580 | - } else { |
|
1581 | - $output_str .= "<li><strong>" . __('-->FAILED: Add Listing page fix failed', 'geodirectory') . "</strong></li>"; |
|
1582 | - } |
|
1583 | - } |
|
1584 | - } |
|
1585 | - |
|
1586 | - //////////////////////////////// |
|
1587 | - /* Diagnose Add Listing Page Ends */ |
|
1588 | - //////////////////////////////// |
|
1589 | - |
|
1590 | - |
|
1591 | - ////////////////////////////////// |
|
1592 | - /* Diagnose Listing Preview Page Starts */ |
|
1593 | - ////////////////////////////////// |
|
1594 | - $option_value = get_option('geodir_preview_page'); |
|
1595 | - $page = get_post($option_value); |
|
1596 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1597 | - |
|
1598 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1599 | - $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1600 | - else { |
|
1601 | - $is_error_during_diagnose = true; |
|
1602 | - $output_str .= "<li><strong>" . __('Listing Preview page is missing.', 'geodirectory') . "</strong></li>"; |
|
1603 | - if ($fix) { |
|
1604 | - if (geodir_fix_virtual_page('listing-preview', __('Listing Preview', 'geodirectory'), $page_found, 'geodir_preview_page')) { |
|
1605 | - $output_str .= "<li><strong>" . __('-->FIXED: Listing Preview page fixed', 'geodirectory') . "</strong></li>"; |
|
1606 | - } else { |
|
1607 | - $output_str .= "<li><strong>" . __('-->FAILED: Listing Preview page fix failed', 'geodirectory') . "</strong></li>"; |
|
1608 | - } |
|
1609 | - } |
|
1610 | - } |
|
1611 | - |
|
1612 | - //////////////////////////////// |
|
1613 | - /* Diagnose Listing Preview Page Ends */ |
|
1614 | - //////////////////////////////// |
|
1615 | - |
|
1616 | - ////////////////////////////////// |
|
1617 | - /* Diagnose Listing Success Page Starts */ |
|
1618 | - ////////////////////////////////// |
|
1619 | - $option_value = get_option('geodir_success_page'); |
|
1620 | - $page = get_post($option_value); |
|
1621 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1622 | - |
|
1623 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1624 | - $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1625 | - else { |
|
1626 | - $is_error_during_diagnose = true; |
|
1627 | - $output_str .= "<li><strong>" . __('Listing Success page is missing.', 'geodirectory') . "</strong></li>"; |
|
1628 | - if ($fix) { |
|
1629 | - if (geodir_fix_virtual_page('listing-success', __('Listing Success', 'geodirectory'), $page_found, 'geodir_success_page')) { |
|
1630 | - $output_str .= "<li><strong>" . __('-->FIXED: Listing Success page fixed', 'geodirectory') . "</strong></li>"; |
|
1631 | - } else { |
|
1632 | - $output_str .= "<li><strong>" . __('-->FAILED: Listing Success page fix failed', 'geodirectory') . "</strong></li>"; |
|
1633 | - } |
|
1634 | - } |
|
1635 | - } |
|
1636 | - |
|
1637 | - //////////////////////////////// |
|
1638 | - /* Diagnose Listing Sucess Page Ends */ |
|
1639 | - //////////////////////////////// |
|
1640 | - |
|
1641 | - ////////////////////////////////// |
|
1642 | - /* Diagnose Info Page Starts */ |
|
1643 | - ////////////////////////////////// |
|
1644 | - $option_value = get_option('geodir_info_page'); |
|
1645 | - $page = get_post($option_value); |
|
1646 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1647 | - |
|
1648 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1649 | - $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1650 | - else { |
|
1651 | - $is_error_during_diagnose = true; |
|
1652 | - $output_str .= "<li><strong>" . __('Info page is missing.', 'geodirectory') . "</strong></li>"; |
|
1653 | - if ($fix) { |
|
1654 | - if (geodir_fix_virtual_page('gd-info', __('Info', 'geodirectory'), $page_found, 'geodir_info_page')) { |
|
1655 | - $output_str .= "<li><strong>" . __('-->FIXED: Info page fixed', 'geodirectory') . "</strong></li>"; |
|
1656 | - } else { |
|
1657 | - $output_str .= "<li><strong>" . __('-->FAILED: Info page fix failed', 'geodirectory') . "</strong></li>"; |
|
1658 | - } |
|
1659 | - } |
|
1660 | - } |
|
1661 | - |
|
1662 | - //////////////////////////////// |
|
1663 | - /* Diagnose Info Page Ends */ |
|
1664 | - //////////////////////////////// |
|
1665 | - |
|
1666 | - ////////////////////////////////// |
|
1667 | - /* Diagnose Login Page Starts */ |
|
1668 | - ////////////////////////////////// |
|
1669 | - $option_value = get_option('geodir_login_page'); |
|
1670 | - $page = get_post($option_value); |
|
1671 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1672 | - |
|
1673 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1674 | - $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1675 | - else { |
|
1676 | - $is_error_during_diagnose = true; |
|
1677 | - $output_str .= "<li><strong>" . __('Login page is missing.', 'geodirectory') . "</strong></li>"; |
|
1678 | - if ($fix) { |
|
1679 | - if (geodir_fix_virtual_page('gd-login', __('Login', 'geodirectory'), $page_found, 'geodir_login_page')) { |
|
1680 | - $output_str .= "<li><strong>" . __('-->FIXED: Login page fixed', 'geodirectory') . "</strong></li>"; |
|
1681 | - } else { |
|
1682 | - $output_str .= "<li><strong>" . __('-->FAILED: Login page fix failed', 'geodirectory') . "</strong></li>"; |
|
1683 | - } |
|
1684 | - } |
|
1685 | - } |
|
1686 | - |
|
1687 | - //////////////////////////////// |
|
1688 | - /* Diagnose Info Page Ends */ |
|
1689 | - //////////////////////////////// |
|
1690 | - |
|
1691 | - ////////////////////////////////// |
|
1692 | - /* Diagnose Location Page Starts */ |
|
1693 | - ////////////////////////////////// |
|
1694 | - $option_value = get_option('geodir_location_page'); |
|
1695 | - $page = get_post($option_value); |
|
1696 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1697 | - |
|
1698 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1699 | - $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1700 | - else { |
|
1701 | - $is_error_during_diagnose = true; |
|
1702 | - $output_str .= "<li><strong>" . __('Location page is missing.', 'geodirectory') . "</strong></li>"; |
|
1703 | - if ($fix) { |
|
1704 | - if (geodir_fix_virtual_page('location', __('Location', 'geodirectory'), $page_found, 'geodir_location_page')) { |
|
1705 | - $output_str .= "<li><strong>" . __('-->FIXED: Location page fixed', 'geodirectory') . "</strong></li>"; |
|
1706 | - } else { |
|
1707 | - $output_str .= "<li><strong>" . __('-->FAILED: Location page fix failed', 'geodirectory') . "</strong></li>"; |
|
1708 | - } |
|
1709 | - } |
|
1710 | - } |
|
1711 | - |
|
1712 | - //////////////////////////////// |
|
1713 | - /* Diagnose Location Page Ends */ |
|
1714 | - //////////////////////////////// |
|
1715 | - |
|
1716 | - $page_chk_arr = array('output_str'=>$output_str,'is_error_during_diagnose'=>$is_error_during_diagnose ); |
|
1717 | - /** |
|
1718 | - * This action is called at the end of the GD Tools page check function. |
|
1719 | - * |
|
1720 | - * @since 1.5.2 |
|
1721 | - */ |
|
1722 | - $page_chk_arr = apply_filters('geodir_diagnose_default_pages',$page_chk_arr); |
|
1723 | - |
|
1724 | - $output_str = $page_chk_arr['output_str']; |
|
1725 | - $is_error_during_diagnose = $page_chk_arr['is_error_during_diagnose']; |
|
1726 | - |
|
1727 | - if ($is_error_during_diagnose) { |
|
1728 | - if ($fix) { |
|
1729 | - flush_rewrite_rules(); |
|
1730 | - } |
|
1731 | - $info_div_class = "geodir_problem_info"; |
|
1732 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='default_pages' />"; |
|
1733 | - } else { |
|
1734 | - $info_div_class = "geodir_noproblem_info"; |
|
1735 | - $fix_button_txt = ''; |
|
1736 | - } |
|
1737 | - echo "<ul class='$info_div_class'>"; |
|
1738 | - echo $output_str; |
|
1739 | - echo $fix_button_txt; |
|
1740 | - echo "</ul>"; |
|
1535 | + global $wpdb; |
|
1536 | + $is_error_during_diagnose = false; |
|
1537 | + $output_str = ''; |
|
1538 | + $fix = isset($_POST['fix']) ? true : false; |
|
1539 | + |
|
1540 | + ////////////////////////////////// |
|
1541 | + /* Diagnose GD Home Page Starts */ |
|
1542 | + ////////////////////////////////// |
|
1543 | + $option_value = get_option('geodir_home_page'); |
|
1544 | + $page = get_post($option_value); |
|
1545 | + if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1546 | + |
|
1547 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1548 | + $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1549 | + else { |
|
1550 | + $is_error_during_diagnose = true; |
|
1551 | + $output_str .= "<li><strong>" . __('GD Home page is missing.', 'geodirectory') . "</strong></li>"; |
|
1552 | + if ($fix) { |
|
1553 | + if (geodir_fix_virtual_page('gd-home', __('GD Home page', 'geodirectory'), $page_found, 'geodir_home_page')) { |
|
1554 | + $output_str .= "<li><strong>" . __('-->FIXED: GD Home page fixed', 'geodirectory') . "</strong></li>"; |
|
1555 | + } else { |
|
1556 | + $output_str .= "<li><strong>" . __('-->FAILED: GD Home page fix failed', 'geodirectory') . "</strong></li>"; |
|
1557 | + } |
|
1558 | + } |
|
1559 | + } |
|
1560 | + |
|
1561 | + //////////////////////////////// |
|
1562 | + /* Diagnose GD Home Page Ends */ |
|
1563 | + //////////////////////////////// |
|
1564 | + |
|
1565 | + ////////////////////////////////// |
|
1566 | + /* Diagnose Add Listing Page Starts */ |
|
1567 | + ////////////////////////////////// |
|
1568 | + $option_value = get_option('geodir_add_listing_page'); |
|
1569 | + $page = get_post($option_value); |
|
1570 | + if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1571 | + |
|
1572 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1573 | + $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1574 | + else { |
|
1575 | + $is_error_during_diagnose = true; |
|
1576 | + $output_str .= "<li><strong>" . __('Add Listing page is missing.', 'geodirectory') . "</strong></li>"; |
|
1577 | + if ($fix) { |
|
1578 | + if (geodir_fix_virtual_page('add-listing', __('Add Listing', 'geodirectory'), $page_found, 'geodir_add_listing_page')) { |
|
1579 | + $output_str .= "<li><strong>" . __('-->FIXED: Add Listing page fixed', 'geodirectory') . "</strong></li>"; |
|
1580 | + } else { |
|
1581 | + $output_str .= "<li><strong>" . __('-->FAILED: Add Listing page fix failed', 'geodirectory') . "</strong></li>"; |
|
1582 | + } |
|
1583 | + } |
|
1584 | + } |
|
1585 | + |
|
1586 | + //////////////////////////////// |
|
1587 | + /* Diagnose Add Listing Page Ends */ |
|
1588 | + //////////////////////////////// |
|
1589 | + |
|
1590 | + |
|
1591 | + ////////////////////////////////// |
|
1592 | + /* Diagnose Listing Preview Page Starts */ |
|
1593 | + ////////////////////////////////// |
|
1594 | + $option_value = get_option('geodir_preview_page'); |
|
1595 | + $page = get_post($option_value); |
|
1596 | + if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1597 | + |
|
1598 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1599 | + $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1600 | + else { |
|
1601 | + $is_error_during_diagnose = true; |
|
1602 | + $output_str .= "<li><strong>" . __('Listing Preview page is missing.', 'geodirectory') . "</strong></li>"; |
|
1603 | + if ($fix) { |
|
1604 | + if (geodir_fix_virtual_page('listing-preview', __('Listing Preview', 'geodirectory'), $page_found, 'geodir_preview_page')) { |
|
1605 | + $output_str .= "<li><strong>" . __('-->FIXED: Listing Preview page fixed', 'geodirectory') . "</strong></li>"; |
|
1606 | + } else { |
|
1607 | + $output_str .= "<li><strong>" . __('-->FAILED: Listing Preview page fix failed', 'geodirectory') . "</strong></li>"; |
|
1608 | + } |
|
1609 | + } |
|
1610 | + } |
|
1611 | + |
|
1612 | + //////////////////////////////// |
|
1613 | + /* Diagnose Listing Preview Page Ends */ |
|
1614 | + //////////////////////////////// |
|
1615 | + |
|
1616 | + ////////////////////////////////// |
|
1617 | + /* Diagnose Listing Success Page Starts */ |
|
1618 | + ////////////////////////////////// |
|
1619 | + $option_value = get_option('geodir_success_page'); |
|
1620 | + $page = get_post($option_value); |
|
1621 | + if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1622 | + |
|
1623 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1624 | + $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1625 | + else { |
|
1626 | + $is_error_during_diagnose = true; |
|
1627 | + $output_str .= "<li><strong>" . __('Listing Success page is missing.', 'geodirectory') . "</strong></li>"; |
|
1628 | + if ($fix) { |
|
1629 | + if (geodir_fix_virtual_page('listing-success', __('Listing Success', 'geodirectory'), $page_found, 'geodir_success_page')) { |
|
1630 | + $output_str .= "<li><strong>" . __('-->FIXED: Listing Success page fixed', 'geodirectory') . "</strong></li>"; |
|
1631 | + } else { |
|
1632 | + $output_str .= "<li><strong>" . __('-->FAILED: Listing Success page fix failed', 'geodirectory') . "</strong></li>"; |
|
1633 | + } |
|
1634 | + } |
|
1635 | + } |
|
1636 | + |
|
1637 | + //////////////////////////////// |
|
1638 | + /* Diagnose Listing Sucess Page Ends */ |
|
1639 | + //////////////////////////////// |
|
1640 | + |
|
1641 | + ////////////////////////////////// |
|
1642 | + /* Diagnose Info Page Starts */ |
|
1643 | + ////////////////////////////////// |
|
1644 | + $option_value = get_option('geodir_info_page'); |
|
1645 | + $page = get_post($option_value); |
|
1646 | + if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1647 | + |
|
1648 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1649 | + $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1650 | + else { |
|
1651 | + $is_error_during_diagnose = true; |
|
1652 | + $output_str .= "<li><strong>" . __('Info page is missing.', 'geodirectory') . "</strong></li>"; |
|
1653 | + if ($fix) { |
|
1654 | + if (geodir_fix_virtual_page('gd-info', __('Info', 'geodirectory'), $page_found, 'geodir_info_page')) { |
|
1655 | + $output_str .= "<li><strong>" . __('-->FIXED: Info page fixed', 'geodirectory') . "</strong></li>"; |
|
1656 | + } else { |
|
1657 | + $output_str .= "<li><strong>" . __('-->FAILED: Info page fix failed', 'geodirectory') . "</strong></li>"; |
|
1658 | + } |
|
1659 | + } |
|
1660 | + } |
|
1661 | + |
|
1662 | + //////////////////////////////// |
|
1663 | + /* Diagnose Info Page Ends */ |
|
1664 | + //////////////////////////////// |
|
1665 | + |
|
1666 | + ////////////////////////////////// |
|
1667 | + /* Diagnose Login Page Starts */ |
|
1668 | + ////////////////////////////////// |
|
1669 | + $option_value = get_option('geodir_login_page'); |
|
1670 | + $page = get_post($option_value); |
|
1671 | + if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1672 | + |
|
1673 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1674 | + $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1675 | + else { |
|
1676 | + $is_error_during_diagnose = true; |
|
1677 | + $output_str .= "<li><strong>" . __('Login page is missing.', 'geodirectory') . "</strong></li>"; |
|
1678 | + if ($fix) { |
|
1679 | + if (geodir_fix_virtual_page('gd-login', __('Login', 'geodirectory'), $page_found, 'geodir_login_page')) { |
|
1680 | + $output_str .= "<li><strong>" . __('-->FIXED: Login page fixed', 'geodirectory') . "</strong></li>"; |
|
1681 | + } else { |
|
1682 | + $output_str .= "<li><strong>" . __('-->FAILED: Login page fix failed', 'geodirectory') . "</strong></li>"; |
|
1683 | + } |
|
1684 | + } |
|
1685 | + } |
|
1686 | + |
|
1687 | + //////////////////////////////// |
|
1688 | + /* Diagnose Info Page Ends */ |
|
1689 | + //////////////////////////////// |
|
1690 | + |
|
1691 | + ////////////////////////////////// |
|
1692 | + /* Diagnose Location Page Starts */ |
|
1693 | + ////////////////////////////////// |
|
1694 | + $option_value = get_option('geodir_location_page'); |
|
1695 | + $page = get_post($option_value); |
|
1696 | + if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1697 | + |
|
1698 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1699 | + $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1700 | + else { |
|
1701 | + $is_error_during_diagnose = true; |
|
1702 | + $output_str .= "<li><strong>" . __('Location page is missing.', 'geodirectory') . "</strong></li>"; |
|
1703 | + if ($fix) { |
|
1704 | + if (geodir_fix_virtual_page('location', __('Location', 'geodirectory'), $page_found, 'geodir_location_page')) { |
|
1705 | + $output_str .= "<li><strong>" . __('-->FIXED: Location page fixed', 'geodirectory') . "</strong></li>"; |
|
1706 | + } else { |
|
1707 | + $output_str .= "<li><strong>" . __('-->FAILED: Location page fix failed', 'geodirectory') . "</strong></li>"; |
|
1708 | + } |
|
1709 | + } |
|
1710 | + } |
|
1711 | + |
|
1712 | + //////////////////////////////// |
|
1713 | + /* Diagnose Location Page Ends */ |
|
1714 | + //////////////////////////////// |
|
1715 | + |
|
1716 | + $page_chk_arr = array('output_str'=>$output_str,'is_error_during_diagnose'=>$is_error_during_diagnose ); |
|
1717 | + /** |
|
1718 | + * This action is called at the end of the GD Tools page check function. |
|
1719 | + * |
|
1720 | + * @since 1.5.2 |
|
1721 | + */ |
|
1722 | + $page_chk_arr = apply_filters('geodir_diagnose_default_pages',$page_chk_arr); |
|
1723 | + |
|
1724 | + $output_str = $page_chk_arr['output_str']; |
|
1725 | + $is_error_during_diagnose = $page_chk_arr['is_error_during_diagnose']; |
|
1726 | + |
|
1727 | + if ($is_error_during_diagnose) { |
|
1728 | + if ($fix) { |
|
1729 | + flush_rewrite_rules(); |
|
1730 | + } |
|
1731 | + $info_div_class = "geodir_problem_info"; |
|
1732 | + $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='default_pages' />"; |
|
1733 | + } else { |
|
1734 | + $info_div_class = "geodir_noproblem_info"; |
|
1735 | + $fix_button_txt = ''; |
|
1736 | + } |
|
1737 | + echo "<ul class='$info_div_class'>"; |
|
1738 | + echo $output_str; |
|
1739 | + echo $fix_button_txt; |
|
1740 | + echo "</ul>"; |
|
1741 | 1741 | |
1742 | 1742 | } |
1743 | 1743 | |
@@ -1749,26 +1749,26 @@ discard block |
||
1749 | 1749 | * @global object $wpdb WordPress Database object. |
1750 | 1750 | */ |
1751 | 1751 | function geodir_diagnose_load_db_language() { |
1752 | - global $wpdb; |
|
1752 | + global $wpdb; |
|
1753 | 1753 | |
1754 | 1754 | $is_error_during_diagnose = geodirectory_load_db_language(); |
1755 | 1755 | |
1756 | - $output_str = ''; |
|
1757 | - $fix_button_txt = ''; |
|
1756 | + $output_str = ''; |
|
1757 | + $fix_button_txt = ''; |
|
1758 | 1758 | |
1759 | - if ($is_error_during_diagnose) { |
|
1760 | - $output_str .= "<li>" . __('Fail to load custom fields in to file for translation, please check file permission:', 'geodirectory') . ' ' . geodir_plugin_path() . '/db-language.php' . "</li>"; |
|
1759 | + if ($is_error_during_diagnose) { |
|
1760 | + $output_str .= "<li>" . __('Fail to load custom fields in to file for translation, please check file permission:', 'geodirectory') . ' ' . geodir_plugin_path() . '/db-language.php' . "</li>"; |
|
1761 | 1761 | $info_div_class = "geodir_problem_info"; |
1762 | - } else { |
|
1763 | - $output_str .= "<li>" . __('Load custom fields in to file for translation: ok', 'geodirectory') . "</li>"; |
|
1762 | + } else { |
|
1763 | + $output_str .= "<li>" . __('Load custom fields in to file for translation: ok', 'geodirectory') . "</li>"; |
|
1764 | 1764 | $info_div_class = "geodir_noproblem_info"; |
1765 | - $fix_button_txt = ''; |
|
1766 | - } |
|
1765 | + $fix_button_txt = ''; |
|
1766 | + } |
|
1767 | 1767 | |
1768 | 1768 | echo "<ul class='$info_div_class'>"; |
1769 | - echo $output_str; |
|
1770 | - echo $fix_button_txt; |
|
1771 | - echo "</ul>"; |
|
1769 | + echo $output_str; |
|
1770 | + echo $fix_button_txt; |
|
1771 | + echo "</ul>"; |
|
1772 | 1772 | |
1773 | 1773 | } |
1774 | 1774 | |
@@ -1799,23 +1799,23 @@ discard block |
||
1799 | 1799 | */ |
1800 | 1800 | function geodir_posts_clauses_request($clauses) |
1801 | 1801 | { |
1802 | - global $wpdb, $wp_query, $plugin_prefix; |
|
1802 | + global $wpdb, $wp_query, $plugin_prefix; |
|
1803 | 1803 | |
1804 | - if (is_admin() && !empty($wp_query->query_vars) && !empty($wp_query->query_vars['is_geodir_loop']) && !empty($wp_query->query_vars['orderby']) && $wp_query->query_vars['orderby'] == 'expire' && !empty($wp_query->query_vars['post_type']) && in_array($wp_query->query_vars['post_type'], geodir_get_posttypes()) && !empty($wp_query->query_vars['orderby']) && isset($clauses['join']) && isset($clauses['orderby']) && isset($clauses['fields'])) { |
|
1805 | - $table = $plugin_prefix . $wp_query->query_vars['post_type'] . '_detail'; |
|
1804 | + if (is_admin() && !empty($wp_query->query_vars) && !empty($wp_query->query_vars['is_geodir_loop']) && !empty($wp_query->query_vars['orderby']) && $wp_query->query_vars['orderby'] == 'expire' && !empty($wp_query->query_vars['post_type']) && in_array($wp_query->query_vars['post_type'], geodir_get_posttypes()) && !empty($wp_query->query_vars['orderby']) && isset($clauses['join']) && isset($clauses['orderby']) && isset($clauses['fields'])) { |
|
1805 | + $table = $plugin_prefix . $wp_query->query_vars['post_type'] . '_detail'; |
|
1806 | 1806 | |
1807 | - $join = $clauses['join'] . ' INNER JOIN ' . $table . ' AS gd_posts ON (gd_posts.post_id = ' . $wpdb->posts . '.ID)'; |
|
1808 | - $clauses['join'] = $join; |
|
1807 | + $join = $clauses['join'] . ' INNER JOIN ' . $table . ' AS gd_posts ON (gd_posts.post_id = ' . $wpdb->posts . '.ID)'; |
|
1808 | + $clauses['join'] = $join; |
|
1809 | 1809 | |
1810 | - $fields = $clauses['fields'] != '' ? $clauses['fields'] . ', ' : ''; |
|
1811 | - $fields .= 'IF(UNIX_TIMESTAMP(DATE_FORMAT(gd_posts.expire_date, "%Y-%m-%d")), UNIX_TIMESTAMP(DATE_FORMAT(gd_posts.expire_date, "%Y-%m-%d")), 253402300799) AS gd_expire'; |
|
1812 | - $clauses['fields'] = $fields; |
|
1810 | + $fields = $clauses['fields'] != '' ? $clauses['fields'] . ', ' : ''; |
|
1811 | + $fields .= 'IF(UNIX_TIMESTAMP(DATE_FORMAT(gd_posts.expire_date, "%Y-%m-%d")), UNIX_TIMESTAMP(DATE_FORMAT(gd_posts.expire_date, "%Y-%m-%d")), 253402300799) AS gd_expire'; |
|
1812 | + $clauses['fields'] = $fields; |
|
1813 | 1813 | |
1814 | - $order = !empty($wp_query->query_vars['order']) ? $wp_query->query_vars['order'] : 'ASC'; |
|
1815 | - $orderby = 'gd_expire ' . $order; |
|
1816 | - $clauses['orderby'] = $orderby; |
|
1817 | - } |
|
1818 | - return $clauses; |
|
1814 | + $order = !empty($wp_query->query_vars['order']) ? $wp_query->query_vars['order'] : 'ASC'; |
|
1815 | + $orderby = 'gd_expire ' . $order; |
|
1816 | + $clauses['orderby'] = $orderby; |
|
1817 | + } |
|
1818 | + return $clauses; |
|
1819 | 1819 | } |
1820 | 1820 | |
1821 | 1821 | |
@@ -1836,7 +1836,7 @@ discard block |
||
1836 | 1836 | */ |
1837 | 1837 | function gd_theme_switch_compat_check() |
1838 | 1838 | { |
1839 | - gd_set_theme_compat(); |
|
1839 | + gd_set_theme_compat(); |
|
1840 | 1840 | } |
1841 | 1841 | |
1842 | 1842 | /** |
@@ -1849,27 +1849,27 @@ discard block |
||
1849 | 1849 | */ |
1850 | 1850 | function geodir_str_getcsv($input, $delimiter = ",", $enclosure = '"', $escape = "\\") |
1851 | 1851 | { |
1852 | - if (function_exists('str_getcsv')) { |
|
1853 | - $fgetcsv = str_getcsv($input, $delimiter, $enclosure, $escape); |
|
1854 | - } else { |
|
1855 | - global $current_user; |
|
1856 | - $upload_dir = wp_upload_dir(); |
|
1857 | - |
|
1858 | - $file = $upload_dir['path'] . '/temp_' . $current_user->data->ID . '/geodir_tmp.csv'; |
|
1859 | - $handle = fopen($file, 'w'); |
|
1860 | - |
|
1861 | - fwrite($handle, $input); |
|
1862 | - fclose($handle); |
|
1863 | - |
|
1864 | - $handle = fopen($file, 'rt'); |
|
1865 | - if (PHP_VERSION >= '5.3.0') { |
|
1866 | - $fgetcsv = fgetcsv($handle, 0, $delimiter, $enclosure, $escape); |
|
1867 | - } else { |
|
1868 | - $fgetcsv = fgetcsv($handle, 0, $delimiter, $enclosure); |
|
1869 | - } |
|
1870 | - fclose($handle); |
|
1871 | - } |
|
1872 | - return $fgetcsv; |
|
1852 | + if (function_exists('str_getcsv')) { |
|
1853 | + $fgetcsv = str_getcsv($input, $delimiter, $enclosure, $escape); |
|
1854 | + } else { |
|
1855 | + global $current_user; |
|
1856 | + $upload_dir = wp_upload_dir(); |
|
1857 | + |
|
1858 | + $file = $upload_dir['path'] . '/temp_' . $current_user->data->ID . '/geodir_tmp.csv'; |
|
1859 | + $handle = fopen($file, 'w'); |
|
1860 | + |
|
1861 | + fwrite($handle, $input); |
|
1862 | + fclose($handle); |
|
1863 | + |
|
1864 | + $handle = fopen($file, 'rt'); |
|
1865 | + if (PHP_VERSION >= '5.3.0') { |
|
1866 | + $fgetcsv = fgetcsv($handle, 0, $delimiter, $enclosure, $escape); |
|
1867 | + } else { |
|
1868 | + $fgetcsv = fgetcsv($handle, 0, $delimiter, $enclosure); |
|
1869 | + } |
|
1870 | + fclose($handle); |
|
1871 | + } |
|
1872 | + return $fgetcsv; |
|
1873 | 1873 | } |
1874 | 1874 | |
1875 | 1875 | add_action('wp_ajax_gdImportCsv', 'geodir_ajax_import_csv'); |
@@ -1884,375 +1884,375 @@ discard block |
||
1884 | 1884 | */ |
1885 | 1885 | function geodir_ajax_import_csv() |
1886 | 1886 | { |
1887 | - error_reporting(0); // hide error to get clean json response |
|
1887 | + error_reporting(0); // hide error to get clean json response |
|
1888 | 1888 | |
1889 | - global $wpdb, $plugin_prefix, $current_user; |
|
1890 | - $uploads = wp_upload_dir(); |
|
1891 | - ini_set('auto_detect_line_endings', true); |
|
1889 | + global $wpdb, $plugin_prefix, $current_user; |
|
1890 | + $uploads = wp_upload_dir(); |
|
1891 | + ini_set('auto_detect_line_endings', true); |
|
1892 | 1892 | |
1893 | 1893 | $wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses. |
1894 | 1894 | |
1895 | - $task = isset($_POST['task']) ? $_POST['task'] : ''; |
|
1896 | - $uploadedFile = isset($_POST['gddata']['uploadedFile']) ? $_POST['gddata']['uploadedFile'] : NULL; |
|
1897 | - $filename = $uploadedFile; |
|
1898 | - |
|
1899 | - $uploads = wp_upload_dir(); |
|
1900 | - $uploads_dir = $uploads['path']; |
|
1901 | - $image_name_arr = explode('/', $filename); |
|
1902 | - $filename = end($image_name_arr); |
|
1903 | - $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
1904 | - $return = array(); |
|
1905 | - $return['file'] = $uploadedFile; |
|
1906 | - $return['error'] = __('The uploaded file is not a valid csv file. Please try again.', 'geodirectory'); |
|
1907 | - |
|
1908 | - if (is_file($target_path) && file_exists($target_path) && $uploadedFile) { |
|
1909 | - $wp_filetype = wp_check_filetype_and_ext($target_path, $filename); |
|
1910 | - |
|
1911 | - if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') { |
|
1912 | - $return['error'] = NULL; |
|
1913 | - |
|
1914 | - $return['rows'] = 0; |
|
1915 | - |
|
1916 | - |
|
1917 | - |
|
1918 | - if (($handle = fopen($target_path, "r")) !== FALSE) { |
|
1919 | - while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { |
|
1920 | - if(is_array($data) && !empty($data)) { |
|
1921 | - $file[] = '"' . implode('","', $data) . '"'; |
|
1922 | - } |
|
1923 | - } |
|
1924 | - fclose($handle); |
|
1925 | - $file = $file; |
|
1926 | - } |
|
1927 | - |
|
1928 | - |
|
1929 | - |
|
1930 | - $return['rows'] = (!empty($file) && count($file) > 1) ? count($file) - 1 : 0; |
|
1931 | - |
|
1932 | - |
|
1933 | - if (!$return['rows'] > 0) { |
|
1934 | - $return['error'] = __('No data found in csv file.', 'geodirectory'); |
|
1935 | - } |
|
1936 | - } |
|
1937 | - } |
|
1938 | - if ($task == 'prepare' || !empty($return['error'])) { |
|
1939 | - echo json_encode($return); |
|
1940 | - exit; |
|
1941 | - } |
|
1942 | - |
|
1943 | - $totRecords = isset($_POST['gddata']['totRecords']) ? $_POST['gddata']['totRecords'] : NULL; |
|
1944 | - $importlimit = isset($_POST['gddata']['importlimit']) ? $_POST['gddata']['importlimit'] : 1; |
|
1945 | - $count = $importlimit; |
|
1946 | - $requested_limit = $importlimit; |
|
1947 | - $tmpCnt = isset($_POST['gddata']['tmpcount']) ? $_POST['gddata']['tmpcount'] : 0; |
|
1948 | - |
|
1949 | - if ($count < $totRecords) { |
|
1950 | - $count = $tmpCnt + $count; |
|
1951 | - if ($count > $totRecords) { |
|
1952 | - $count = $totRecords; |
|
1953 | - } |
|
1954 | - } else { |
|
1955 | - $count = $totRecords; |
|
1956 | - } |
|
1957 | - |
|
1958 | - $total_records = 0; |
|
1959 | - $rowcount = 0; |
|
1960 | - $address_invalid = 0; |
|
1961 | - $blank_address = 0; |
|
1962 | - $upload_files = 0; |
|
1963 | - $invalid_post_type = 0; |
|
1964 | - $invalid_title = 0; |
|
1965 | - $customKeyarray = array(); |
|
1966 | - $gd_post_info = array(); |
|
1967 | - $post_location = array(); |
|
1968 | - $countpost = 0; |
|
1969 | - |
|
1970 | - if (!empty($file)) { |
|
1971 | - $columns = isset($file[0]) ? geodir_str_getcsv($file[0]) : NULL; |
|
1972 | - $customKeyarray = $columns; |
|
1973 | - |
|
1974 | - if (empty($columns) || (!empty($columns) && $columns[0] == '')) { |
|
1975 | - $return['error'] = CSV_INVAILD_FILE; |
|
1976 | - echo json_encode($return); |
|
1977 | - exit; |
|
1978 | - } |
|
1979 | - |
|
1980 | - for ($i = 1; $i <= $importlimit; $i++) { |
|
1981 | - $current_index = $tmpCnt + $i; |
|
1982 | - if (isset($file[$current_index])) { |
|
1983 | - $total_records++; |
|
1984 | - |
|
1985 | - $buffer = geodir_str_getcsv($file[$current_index]); |
|
1986 | - $post_title = addslashes($buffer[0]); |
|
1987 | - $current_post_author = $buffer[1]; |
|
1988 | - $post_desc = addslashes($buffer[2]); |
|
1989 | - $post_cat = array(); |
|
1990 | - $catids_arr = array(); |
|
1991 | - $post_cat = trim($buffer[3]); // comma seperated category name |
|
1992 | - |
|
1993 | - if ($post_cat) { |
|
1994 | - $post_cat_arr = explode(',', $post_cat); |
|
1995 | - |
|
1996 | - for ($c = 0; $c < count($post_cat_arr); $c++) { |
|
1997 | - $catid = wp_kses_normalize_entities(trim($post_cat_arr[$c])); |
|
1998 | - |
|
1999 | - if (!empty($buffer[5])) { |
|
2000 | - if (in_array($buffer[5], geodir_get_posttypes())) { |
|
2001 | - |
|
2002 | - $p_taxonomy = geodir_get_taxonomies(addslashes($buffer[5])); |
|
2003 | - |
|
2004 | - if (get_term_by('name', $catid, $p_taxonomy[0])) { |
|
2005 | - $cat = get_term_by('name', $catid, $p_taxonomy[0]); |
|
2006 | - $catids_arr[] = $cat->slug; |
|
2007 | - } else if (get_term_by('slug', $catid, $p_taxonomy[0])) { |
|
2008 | - $cat = get_term_by('slug', $catid, $p_taxonomy[0]); |
|
2009 | - $catids_arr[] = $cat->slug; |
|
2010 | - } else { |
|
2011 | - $ret = wp_insert_term($catid, $p_taxonomy[0]); |
|
2012 | - if ($ret && !is_wp_error($ret)) { |
|
2013 | - if (get_term_by('name', $catid, $p_taxonomy[0])) { |
|
2014 | - $cat = get_term_by('name', $catid, $p_taxonomy[0]); |
|
2015 | - $catids_arr[] = $cat->slug; |
|
2016 | - } elseif (get_term_by('slug', $catid, $p_taxonomy[0])) { |
|
2017 | - $cat = get_term_by('slug', $catid, $p_taxonomy[0]); |
|
2018 | - $catids_arr[] = $cat->slug; |
|
2019 | - } |
|
2020 | - } |
|
2021 | - } |
|
2022 | - } |
|
2023 | - } |
|
2024 | - } |
|
2025 | - } |
|
2026 | - |
|
2027 | - if (!$catids_arr) { |
|
2028 | - $catids_arr[] = 1; |
|
2029 | - } |
|
2030 | - |
|
2031 | - $post_tags = trim($buffer[4]); // comma seperated tags |
|
2032 | - |
|
2033 | - $tag_arr = ''; |
|
2034 | - if ($post_tags) { |
|
2035 | - $tag_arr = explode(',', $post_tags); |
|
2036 | - } |
|
2037 | - |
|
2038 | - $table = $plugin_prefix . $buffer[5] . '_detail'; // check table in database |
|
2039 | - |
|
2040 | - $error = ''; |
|
2041 | - if ($wpdb->get_var("SHOW TABLES LIKE '" . $table . "'") != $table) { |
|
2042 | - $invalid_post_type++; |
|
2043 | - continue; |
|
2044 | - } |
|
2045 | - |
|
2046 | - if ($post_title != '') { |
|
2047 | - $menu_order = 0; |
|
2048 | - $image_folder_name = 'uplaod/'; |
|
2049 | - |
|
2050 | - $image_names = array(); |
|
2051 | - |
|
2052 | - for ($c = 5; $c < count($customKeyarray); $c++) { |
|
2053 | - $gd_post_info[$customKeyarray[$c]] = addslashes($buffer[$c]); |
|
2054 | - |
|
2055 | - if ($customKeyarray[$c] == 'IMAGE') { |
|
2056 | - $buffer[$c] = trim($buffer[$c]); |
|
2057 | - |
|
2058 | - if (!empty($buffer[$c])) { |
|
2059 | - $image_names[] = $buffer[$c]; |
|
2060 | - } |
|
2061 | - } |
|
2062 | - |
|
2063 | - if ($customKeyarray[$c] == 'alive_days') { |
|
2064 | - if ($buffer[$c] != '0' && $buffer[$c] != '') { |
|
2065 | - $submitdata = date('Y-m-d'); |
|
2066 | - |
|
2067 | - $gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata . "+" . addslashes($buffer[$c]) . " days")); |
|
2068 | - } else { |
|
2069 | - $gd_post_info['expire_date'] = 'Never'; |
|
2070 | - } |
|
2071 | - } |
|
2072 | - |
|
2073 | - if ($customKeyarray[$c] == 'post_city') { |
|
2074 | - $post_city = addslashes($buffer[$c]); |
|
2075 | - } |
|
2076 | - |
|
2077 | - if ($customKeyarray[$c] == 'post_region') { |
|
2078 | - $post_region = addslashes($buffer[$c]); |
|
2079 | - } |
|
2080 | - |
|
2081 | - if ($customKeyarray[$c] == 'post_country') { |
|
2082 | - $post_country = addslashes($buffer[$c]); |
|
2083 | - } |
|
2084 | - |
|
2085 | - if ($customKeyarray[$c] == 'post_latitude') { |
|
2086 | - $post_latitude = addslashes($buffer[$c]); |
|
2087 | - } |
|
2088 | - |
|
2089 | - if ($customKeyarray[$c] == 'post_longitude') { |
|
2090 | - $post_longitude = addslashes($buffer[$c]); |
|
2091 | - } |
|
1895 | + $task = isset($_POST['task']) ? $_POST['task'] : ''; |
|
1896 | + $uploadedFile = isset($_POST['gddata']['uploadedFile']) ? $_POST['gddata']['uploadedFile'] : NULL; |
|
1897 | + $filename = $uploadedFile; |
|
1898 | + |
|
1899 | + $uploads = wp_upload_dir(); |
|
1900 | + $uploads_dir = $uploads['path']; |
|
1901 | + $image_name_arr = explode('/', $filename); |
|
1902 | + $filename = end($image_name_arr); |
|
1903 | + $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
1904 | + $return = array(); |
|
1905 | + $return['file'] = $uploadedFile; |
|
1906 | + $return['error'] = __('The uploaded file is not a valid csv file. Please try again.', 'geodirectory'); |
|
1907 | + |
|
1908 | + if (is_file($target_path) && file_exists($target_path) && $uploadedFile) { |
|
1909 | + $wp_filetype = wp_check_filetype_and_ext($target_path, $filename); |
|
1910 | + |
|
1911 | + if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') { |
|
1912 | + $return['error'] = NULL; |
|
1913 | + |
|
1914 | + $return['rows'] = 0; |
|
1915 | + |
|
1916 | + |
|
1917 | + |
|
1918 | + if (($handle = fopen($target_path, "r")) !== FALSE) { |
|
1919 | + while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { |
|
1920 | + if(is_array($data) && !empty($data)) { |
|
1921 | + $file[] = '"' . implode('","', $data) . '"'; |
|
1922 | + } |
|
1923 | + } |
|
1924 | + fclose($handle); |
|
1925 | + $file = $file; |
|
1926 | + } |
|
1927 | + |
|
1928 | + |
|
1929 | + |
|
1930 | + $return['rows'] = (!empty($file) && count($file) > 1) ? count($file) - 1 : 0; |
|
1931 | + |
|
1932 | + |
|
1933 | + if (!$return['rows'] > 0) { |
|
1934 | + $return['error'] = __('No data found in csv file.', 'geodirectory'); |
|
1935 | + } |
|
1936 | + } |
|
1937 | + } |
|
1938 | + if ($task == 'prepare' || !empty($return['error'])) { |
|
1939 | + echo json_encode($return); |
|
1940 | + exit; |
|
1941 | + } |
|
1942 | + |
|
1943 | + $totRecords = isset($_POST['gddata']['totRecords']) ? $_POST['gddata']['totRecords'] : NULL; |
|
1944 | + $importlimit = isset($_POST['gddata']['importlimit']) ? $_POST['gddata']['importlimit'] : 1; |
|
1945 | + $count = $importlimit; |
|
1946 | + $requested_limit = $importlimit; |
|
1947 | + $tmpCnt = isset($_POST['gddata']['tmpcount']) ? $_POST['gddata']['tmpcount'] : 0; |
|
1948 | + |
|
1949 | + if ($count < $totRecords) { |
|
1950 | + $count = $tmpCnt + $count; |
|
1951 | + if ($count > $totRecords) { |
|
1952 | + $count = $totRecords; |
|
1953 | + } |
|
1954 | + } else { |
|
1955 | + $count = $totRecords; |
|
1956 | + } |
|
1957 | + |
|
1958 | + $total_records = 0; |
|
1959 | + $rowcount = 0; |
|
1960 | + $address_invalid = 0; |
|
1961 | + $blank_address = 0; |
|
1962 | + $upload_files = 0; |
|
1963 | + $invalid_post_type = 0; |
|
1964 | + $invalid_title = 0; |
|
1965 | + $customKeyarray = array(); |
|
1966 | + $gd_post_info = array(); |
|
1967 | + $post_location = array(); |
|
1968 | + $countpost = 0; |
|
1969 | + |
|
1970 | + if (!empty($file)) { |
|
1971 | + $columns = isset($file[0]) ? geodir_str_getcsv($file[0]) : NULL; |
|
1972 | + $customKeyarray = $columns; |
|
1973 | + |
|
1974 | + if (empty($columns) || (!empty($columns) && $columns[0] == '')) { |
|
1975 | + $return['error'] = CSV_INVAILD_FILE; |
|
1976 | + echo json_encode($return); |
|
1977 | + exit; |
|
1978 | + } |
|
1979 | + |
|
1980 | + for ($i = 1; $i <= $importlimit; $i++) { |
|
1981 | + $current_index = $tmpCnt + $i; |
|
1982 | + if (isset($file[$current_index])) { |
|
1983 | + $total_records++; |
|
1984 | + |
|
1985 | + $buffer = geodir_str_getcsv($file[$current_index]); |
|
1986 | + $post_title = addslashes($buffer[0]); |
|
1987 | + $current_post_author = $buffer[1]; |
|
1988 | + $post_desc = addslashes($buffer[2]); |
|
1989 | + $post_cat = array(); |
|
1990 | + $catids_arr = array(); |
|
1991 | + $post_cat = trim($buffer[3]); // comma seperated category name |
|
1992 | + |
|
1993 | + if ($post_cat) { |
|
1994 | + $post_cat_arr = explode(',', $post_cat); |
|
1995 | + |
|
1996 | + for ($c = 0; $c < count($post_cat_arr); $c++) { |
|
1997 | + $catid = wp_kses_normalize_entities(trim($post_cat_arr[$c])); |
|
1998 | + |
|
1999 | + if (!empty($buffer[5])) { |
|
2000 | + if (in_array($buffer[5], geodir_get_posttypes())) { |
|
2001 | + |
|
2002 | + $p_taxonomy = geodir_get_taxonomies(addslashes($buffer[5])); |
|
2003 | + |
|
2004 | + if (get_term_by('name', $catid, $p_taxonomy[0])) { |
|
2005 | + $cat = get_term_by('name', $catid, $p_taxonomy[0]); |
|
2006 | + $catids_arr[] = $cat->slug; |
|
2007 | + } else if (get_term_by('slug', $catid, $p_taxonomy[0])) { |
|
2008 | + $cat = get_term_by('slug', $catid, $p_taxonomy[0]); |
|
2009 | + $catids_arr[] = $cat->slug; |
|
2010 | + } else { |
|
2011 | + $ret = wp_insert_term($catid, $p_taxonomy[0]); |
|
2012 | + if ($ret && !is_wp_error($ret)) { |
|
2013 | + if (get_term_by('name', $catid, $p_taxonomy[0])) { |
|
2014 | + $cat = get_term_by('name', $catid, $p_taxonomy[0]); |
|
2015 | + $catids_arr[] = $cat->slug; |
|
2016 | + } elseif (get_term_by('slug', $catid, $p_taxonomy[0])) { |
|
2017 | + $cat = get_term_by('slug', $catid, $p_taxonomy[0]); |
|
2018 | + $catids_arr[] = $cat->slug; |
|
2019 | + } |
|
2020 | + } |
|
2021 | + } |
|
2022 | + } |
|
2023 | + } |
|
2024 | + } |
|
2025 | + } |
|
2026 | + |
|
2027 | + if (!$catids_arr) { |
|
2028 | + $catids_arr[] = 1; |
|
2029 | + } |
|
2030 | + |
|
2031 | + $post_tags = trim($buffer[4]); // comma seperated tags |
|
2032 | + |
|
2033 | + $tag_arr = ''; |
|
2034 | + if ($post_tags) { |
|
2035 | + $tag_arr = explode(',', $post_tags); |
|
2036 | + } |
|
2037 | + |
|
2038 | + $table = $plugin_prefix . $buffer[5] . '_detail'; // check table in database |
|
2039 | + |
|
2040 | + $error = ''; |
|
2041 | + if ($wpdb->get_var("SHOW TABLES LIKE '" . $table . "'") != $table) { |
|
2042 | + $invalid_post_type++; |
|
2043 | + continue; |
|
2044 | + } |
|
2045 | + |
|
2046 | + if ($post_title != '') { |
|
2047 | + $menu_order = 0; |
|
2048 | + $image_folder_name = 'uplaod/'; |
|
2049 | + |
|
2050 | + $image_names = array(); |
|
2051 | + |
|
2052 | + for ($c = 5; $c < count($customKeyarray); $c++) { |
|
2053 | + $gd_post_info[$customKeyarray[$c]] = addslashes($buffer[$c]); |
|
2054 | + |
|
2055 | + if ($customKeyarray[$c] == 'IMAGE') { |
|
2056 | + $buffer[$c] = trim($buffer[$c]); |
|
2057 | + |
|
2058 | + if (!empty($buffer[$c])) { |
|
2059 | + $image_names[] = $buffer[$c]; |
|
2060 | + } |
|
2061 | + } |
|
2062 | + |
|
2063 | + if ($customKeyarray[$c] == 'alive_days') { |
|
2064 | + if ($buffer[$c] != '0' && $buffer[$c] != '') { |
|
2065 | + $submitdata = date('Y-m-d'); |
|
2066 | + |
|
2067 | + $gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata . "+" . addslashes($buffer[$c]) . " days")); |
|
2068 | + } else { |
|
2069 | + $gd_post_info['expire_date'] = 'Never'; |
|
2070 | + } |
|
2071 | + } |
|
2072 | + |
|
2073 | + if ($customKeyarray[$c] == 'post_city') { |
|
2074 | + $post_city = addslashes($buffer[$c]); |
|
2075 | + } |
|
2076 | + |
|
2077 | + if ($customKeyarray[$c] == 'post_region') { |
|
2078 | + $post_region = addslashes($buffer[$c]); |
|
2079 | + } |
|
2080 | + |
|
2081 | + if ($customKeyarray[$c] == 'post_country') { |
|
2082 | + $post_country = addslashes($buffer[$c]); |
|
2083 | + } |
|
2084 | + |
|
2085 | + if ($customKeyarray[$c] == 'post_latitude') { |
|
2086 | + $post_latitude = addslashes($buffer[$c]); |
|
2087 | + } |
|
2088 | + |
|
2089 | + if ($customKeyarray[$c] == 'post_longitude') { |
|
2090 | + $post_longitude = addslashes($buffer[$c]); |
|
2091 | + } |
|
2092 | 2092 | |
2093 | 2093 | // Post status |
2094 | 2094 | if ($customKeyarray[$c] == 'post_status') { |
2095 | - $post_status = sanitize_key( $buffer[$c] ); |
|
2096 | - } |
|
2097 | - } |
|
2098 | - |
|
2099 | - /* ================ before array create ============== */ |
|
2100 | - $location_result = geodir_get_default_location(); |
|
2101 | - if ((!isset($gd_post_info['post_city']) || $gd_post_info['post_city'] == '') || (!isset($gd_post_info['post_region']) || $gd_post_info['post_region'] == '') || (!isset($gd_post_info['post_country']) || $gd_post_info['post_country'] == '') || (!isset($gd_post_info['post_address']) || $gd_post_info['post_address'] == '') || (!isset($gd_post_info['post_latitude']) || $gd_post_info['post_latitude'] == '') || (!isset($gd_post_info['post_longitude']) || $gd_post_info['post_longitude'] == '')) { |
|
2102 | - $blank_address++; |
|
2103 | - continue; |
|
2104 | - } else if ($location_result->location_id == 0) { |
|
2105 | - if ((geodir_strtolower($gd_post_info['post_city']) != geodir_strtolower($location_result->city)) || (geodir_strtolower($gd_post_info['post_region']) != geodir_strtolower($location_result->region)) || (geodir_strtolower($gd_post_info['post_country']) != geodir_strtolower($location_result->country))) { |
|
2106 | - $address_invalid++; |
|
2107 | - continue; |
|
2108 | - } |
|
2109 | - } |
|
2095 | + $post_status = sanitize_key( $buffer[$c] ); |
|
2096 | + } |
|
2097 | + } |
|
2098 | + |
|
2099 | + /* ================ before array create ============== */ |
|
2100 | + $location_result = geodir_get_default_location(); |
|
2101 | + if ((!isset($gd_post_info['post_city']) || $gd_post_info['post_city'] == '') || (!isset($gd_post_info['post_region']) || $gd_post_info['post_region'] == '') || (!isset($gd_post_info['post_country']) || $gd_post_info['post_country'] == '') || (!isset($gd_post_info['post_address']) || $gd_post_info['post_address'] == '') || (!isset($gd_post_info['post_latitude']) || $gd_post_info['post_latitude'] == '') || (!isset($gd_post_info['post_longitude']) || $gd_post_info['post_longitude'] == '')) { |
|
2102 | + $blank_address++; |
|
2103 | + continue; |
|
2104 | + } else if ($location_result->location_id == 0) { |
|
2105 | + if ((geodir_strtolower($gd_post_info['post_city']) != geodir_strtolower($location_result->city)) || (geodir_strtolower($gd_post_info['post_region']) != geodir_strtolower($location_result->region)) || (geodir_strtolower($gd_post_info['post_country']) != geodir_strtolower($location_result->country))) { |
|
2106 | + $address_invalid++; |
|
2107 | + continue; |
|
2108 | + } |
|
2109 | + } |
|
2110 | 2110 | |
2111 | 2111 | // Default post status |
2112 | 2112 | $default_status = 'publish'; |
2113 | 2113 | $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status; |
2114 | 2114 | $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status; |
2115 | 2115 | |
2116 | - $my_post['post_title'] = $post_title; |
|
2117 | - $my_post['post_content'] = $post_desc; |
|
2118 | - $my_post['post_type'] = addslashes($buffer[5]); |
|
2119 | - $my_post['post_author'] = $current_post_author; |
|
2120 | - $my_post['post_status'] = $post_status; |
|
2121 | - $my_post['post_category'] = $catids_arr; |
|
2122 | - $my_post['post_tags'] = $tag_arr; |
|
2123 | - |
|
2124 | - $gd_post_info['post_tags'] = $tag_arr; |
|
2125 | - $gd_post_info['post_title'] = $post_title; |
|
2126 | - $gd_post_info['post_status'] = $post_status; |
|
2127 | - $gd_post_info['submit_time'] = time(); |
|
2128 | - $gd_post_info['submit_ip'] = $_SERVER['REMOTE_ADDR']; |
|
2129 | - |
|
2130 | - $last_postid = wp_insert_post($my_post); |
|
2131 | - $countpost++; |
|
2132 | - |
|
2133 | - // Check if we need to save post location as new location |
|
2134 | - if ($location_result->location_id > 0) { |
|
2135 | - if (isset($post_city) && isset($post_region)) { |
|
2136 | - $request_info['post_location'] = array( |
|
2137 | - 'city' => $post_city, |
|
2138 | - 'region' => $post_region, |
|
2139 | - 'country' => $post_country, |
|
2140 | - 'geo_lat' => $post_latitude, |
|
2141 | - 'geo_lng' => $post_longitude |
|
2142 | - ); |
|
2143 | - |
|
2144 | - $post_location_info = $request_info['post_location']; |
|
2145 | - if ($location_id = geodir_add_new_location($post_location_info)) |
|
2146 | - $post_location_id = $location_id; |
|
2147 | - } else { |
|
2148 | - $post_location_id = 0; |
|
2149 | - } |
|
2150 | - } else { |
|
2151 | - $post_location_id = 0; |
|
2152 | - } |
|
2153 | - |
|
2154 | - /* ------- get default package info ----- */ |
|
2155 | - $payment_info = array(); |
|
2156 | - $package_info = array(); |
|
2157 | - |
|
2158 | - $package_info = (array)geodir_post_package_info($package_info, '', $buffer[5]); |
|
2159 | - $package_id = ''; |
|
2160 | - if (isset($gd_post_info['package_id']) && $gd_post_info['package_id'] != '') { |
|
2161 | - $package_id = $gd_post_info['package_id']; |
|
2162 | - } |
|
2163 | - |
|
2164 | - if (!empty($package_info)) { |
|
2165 | - $payment_info['package_id'] = $package_info['pid']; |
|
2166 | - |
|
2167 | - if (isset($package_info['alive_days']) && $package_info['alive_days'] != 0) { |
|
2168 | - $payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['alive_days'] . " days")); |
|
2169 | - } else { |
|
2170 | - $payment_info['expire_date'] = 'Never'; |
|
2171 | - } |
|
2172 | - |
|
2173 | - $gd_post_info = array_merge($gd_post_info, $payment_info); |
|
2174 | - } |
|
2175 | - |
|
2176 | - $gd_post_info['post_location_id'] = $post_location_id; |
|
2177 | - |
|
2178 | - $post_type = get_post_type($last_postid); |
|
2179 | - |
|
2180 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
2181 | - |
|
2182 | - geodir_save_post_info($last_postid, $gd_post_info); |
|
2183 | - |
|
2184 | - if (!empty($image_names)) { |
|
2185 | - $upload_files++; |
|
2186 | - $menu_order = 1; |
|
2187 | - |
|
2188 | - foreach ($image_names as $image_name) { |
|
2189 | - $img_name_arr = explode('.', $image_name); |
|
2190 | - |
|
2191 | - $uploads = wp_upload_dir(); |
|
2192 | - $sub_dir = $uploads['subdir']; |
|
2193 | - |
|
2194 | - $arr_file_type = wp_check_filetype($image_name); |
|
2195 | - $uploaded_file_type = $arr_file_type['type']; |
|
2196 | - |
|
2197 | - $attachment = array(); |
|
2198 | - $attachment['post_id'] = $last_postid; |
|
2199 | - $attachment['title'] = $img_name_arr[0]; |
|
2200 | - $attachment['content'] = ''; |
|
2201 | - $attachment['file'] = $sub_dir . '/' . $image_name; |
|
2202 | - $attachment['mime_type'] = $uploaded_file_type; |
|
2203 | - $attachment['menu_order'] = $menu_order; |
|
2204 | - $attachment['is_featured'] = 0; |
|
2205 | - |
|
2206 | - $attachment_set = ''; |
|
2207 | - |
|
2208 | - foreach ($attachment as $key => $val) { |
|
2209 | - if ($val != '') |
|
2210 | - $attachment_set .= $key . " = '" . $val . "', "; |
|
2211 | - } |
|
2212 | - $attachment_set = trim($attachment_set, ", "); |
|
2213 | - |
|
2214 | - $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set); |
|
2215 | - |
|
2216 | - if ($menu_order == 1) { |
|
2217 | - $post_type = get_post_type($last_postid); |
|
2218 | - $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($sub_dir . '/' . $image_name, $last_postid))); |
|
2219 | - } |
|
2220 | - $menu_order++; |
|
2221 | - } |
|
2222 | - } |
|
2223 | - |
|
2224 | - $gd_post_info['package_id'] = $package_id; |
|
2225 | - |
|
2226 | - /** This action is documented in geodirectory-functions/post-functions.php */ |
|
2227 | - do_action('geodir_after_save_listing', $last_postid, $gd_post_info); |
|
2228 | - |
|
2229 | - if (!empty($buffer[5])) { |
|
2230 | - if (in_array($buffer[5], geodir_get_posttypes())) { |
|
2231 | - $taxonomies = geodir_get_posttype_info(addslashes($buffer[5])); |
|
2232 | - wp_set_object_terms($last_postid, $my_post['post_tags'], $taxonomy = $taxonomies['taxonomies'][1]); |
|
2233 | - wp_set_object_terms($last_postid, $my_post['post_category'], $taxonomy = $taxonomies['taxonomies'][0]); |
|
2234 | - |
|
2235 | - $post_default_category = isset($my_post['post_default_category']) ? $my_post['post_default_category'] : ''; |
|
2236 | - $post_category_str = isset($my_post['post_category_str']) ? $my_post['post_category_str'] : ''; |
|
2237 | - geodir_set_postcat_structure($last_postid, $taxonomy, $post_default_category, $post_category_str); |
|
2238 | - } |
|
2239 | - } |
|
2240 | - } else { |
|
2241 | - $invalid_title++; |
|
2242 | - } |
|
2243 | - } |
|
2244 | - } |
|
2245 | - } |
|
2246 | - $return['rowcount'] = $countpost; |
|
2247 | - $return['invalidcount'] = $address_invalid; |
|
2248 | - $return['blank_address'] = $blank_address; |
|
2249 | - $return['upload_files'] = $upload_files; |
|
2250 | - $return['invalid_post_type'] = $invalid_post_type; |
|
2251 | - $return['invalid_title'] = $invalid_title; |
|
2252 | - $return['total_records'] = $total_records; |
|
2253 | - |
|
2254 | - echo json_encode($return); |
|
2255 | - exit; |
|
2116 | + $my_post['post_title'] = $post_title; |
|
2117 | + $my_post['post_content'] = $post_desc; |
|
2118 | + $my_post['post_type'] = addslashes($buffer[5]); |
|
2119 | + $my_post['post_author'] = $current_post_author; |
|
2120 | + $my_post['post_status'] = $post_status; |
|
2121 | + $my_post['post_category'] = $catids_arr; |
|
2122 | + $my_post['post_tags'] = $tag_arr; |
|
2123 | + |
|
2124 | + $gd_post_info['post_tags'] = $tag_arr; |
|
2125 | + $gd_post_info['post_title'] = $post_title; |
|
2126 | + $gd_post_info['post_status'] = $post_status; |
|
2127 | + $gd_post_info['submit_time'] = time(); |
|
2128 | + $gd_post_info['submit_ip'] = $_SERVER['REMOTE_ADDR']; |
|
2129 | + |
|
2130 | + $last_postid = wp_insert_post($my_post); |
|
2131 | + $countpost++; |
|
2132 | + |
|
2133 | + // Check if we need to save post location as new location |
|
2134 | + if ($location_result->location_id > 0) { |
|
2135 | + if (isset($post_city) && isset($post_region)) { |
|
2136 | + $request_info['post_location'] = array( |
|
2137 | + 'city' => $post_city, |
|
2138 | + 'region' => $post_region, |
|
2139 | + 'country' => $post_country, |
|
2140 | + 'geo_lat' => $post_latitude, |
|
2141 | + 'geo_lng' => $post_longitude |
|
2142 | + ); |
|
2143 | + |
|
2144 | + $post_location_info = $request_info['post_location']; |
|
2145 | + if ($location_id = geodir_add_new_location($post_location_info)) |
|
2146 | + $post_location_id = $location_id; |
|
2147 | + } else { |
|
2148 | + $post_location_id = 0; |
|
2149 | + } |
|
2150 | + } else { |
|
2151 | + $post_location_id = 0; |
|
2152 | + } |
|
2153 | + |
|
2154 | + /* ------- get default package info ----- */ |
|
2155 | + $payment_info = array(); |
|
2156 | + $package_info = array(); |
|
2157 | + |
|
2158 | + $package_info = (array)geodir_post_package_info($package_info, '', $buffer[5]); |
|
2159 | + $package_id = ''; |
|
2160 | + if (isset($gd_post_info['package_id']) && $gd_post_info['package_id'] != '') { |
|
2161 | + $package_id = $gd_post_info['package_id']; |
|
2162 | + } |
|
2163 | + |
|
2164 | + if (!empty($package_info)) { |
|
2165 | + $payment_info['package_id'] = $package_info['pid']; |
|
2166 | + |
|
2167 | + if (isset($package_info['alive_days']) && $package_info['alive_days'] != 0) { |
|
2168 | + $payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['alive_days'] . " days")); |
|
2169 | + } else { |
|
2170 | + $payment_info['expire_date'] = 'Never'; |
|
2171 | + } |
|
2172 | + |
|
2173 | + $gd_post_info = array_merge($gd_post_info, $payment_info); |
|
2174 | + } |
|
2175 | + |
|
2176 | + $gd_post_info['post_location_id'] = $post_location_id; |
|
2177 | + |
|
2178 | + $post_type = get_post_type($last_postid); |
|
2179 | + |
|
2180 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
2181 | + |
|
2182 | + geodir_save_post_info($last_postid, $gd_post_info); |
|
2183 | + |
|
2184 | + if (!empty($image_names)) { |
|
2185 | + $upload_files++; |
|
2186 | + $menu_order = 1; |
|
2187 | + |
|
2188 | + foreach ($image_names as $image_name) { |
|
2189 | + $img_name_arr = explode('.', $image_name); |
|
2190 | + |
|
2191 | + $uploads = wp_upload_dir(); |
|
2192 | + $sub_dir = $uploads['subdir']; |
|
2193 | + |
|
2194 | + $arr_file_type = wp_check_filetype($image_name); |
|
2195 | + $uploaded_file_type = $arr_file_type['type']; |
|
2196 | + |
|
2197 | + $attachment = array(); |
|
2198 | + $attachment['post_id'] = $last_postid; |
|
2199 | + $attachment['title'] = $img_name_arr[0]; |
|
2200 | + $attachment['content'] = ''; |
|
2201 | + $attachment['file'] = $sub_dir . '/' . $image_name; |
|
2202 | + $attachment['mime_type'] = $uploaded_file_type; |
|
2203 | + $attachment['menu_order'] = $menu_order; |
|
2204 | + $attachment['is_featured'] = 0; |
|
2205 | + |
|
2206 | + $attachment_set = ''; |
|
2207 | + |
|
2208 | + foreach ($attachment as $key => $val) { |
|
2209 | + if ($val != '') |
|
2210 | + $attachment_set .= $key . " = '" . $val . "', "; |
|
2211 | + } |
|
2212 | + $attachment_set = trim($attachment_set, ", "); |
|
2213 | + |
|
2214 | + $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set); |
|
2215 | + |
|
2216 | + if ($menu_order == 1) { |
|
2217 | + $post_type = get_post_type($last_postid); |
|
2218 | + $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($sub_dir . '/' . $image_name, $last_postid))); |
|
2219 | + } |
|
2220 | + $menu_order++; |
|
2221 | + } |
|
2222 | + } |
|
2223 | + |
|
2224 | + $gd_post_info['package_id'] = $package_id; |
|
2225 | + |
|
2226 | + /** This action is documented in geodirectory-functions/post-functions.php */ |
|
2227 | + do_action('geodir_after_save_listing', $last_postid, $gd_post_info); |
|
2228 | + |
|
2229 | + if (!empty($buffer[5])) { |
|
2230 | + if (in_array($buffer[5], geodir_get_posttypes())) { |
|
2231 | + $taxonomies = geodir_get_posttype_info(addslashes($buffer[5])); |
|
2232 | + wp_set_object_terms($last_postid, $my_post['post_tags'], $taxonomy = $taxonomies['taxonomies'][1]); |
|
2233 | + wp_set_object_terms($last_postid, $my_post['post_category'], $taxonomy = $taxonomies['taxonomies'][0]); |
|
2234 | + |
|
2235 | + $post_default_category = isset($my_post['post_default_category']) ? $my_post['post_default_category'] : ''; |
|
2236 | + $post_category_str = isset($my_post['post_category_str']) ? $my_post['post_category_str'] : ''; |
|
2237 | + geodir_set_postcat_structure($last_postid, $taxonomy, $post_default_category, $post_category_str); |
|
2238 | + } |
|
2239 | + } |
|
2240 | + } else { |
|
2241 | + $invalid_title++; |
|
2242 | + } |
|
2243 | + } |
|
2244 | + } |
|
2245 | + } |
|
2246 | + $return['rowcount'] = $countpost; |
|
2247 | + $return['invalidcount'] = $address_invalid; |
|
2248 | + $return['blank_address'] = $blank_address; |
|
2249 | + $return['upload_files'] = $upload_files; |
|
2250 | + $return['invalid_post_type'] = $invalid_post_type; |
|
2251 | + $return['invalid_title'] = $invalid_title; |
|
2252 | + $return['total_records'] = $total_records; |
|
2253 | + |
|
2254 | + echo json_encode($return); |
|
2255 | + exit; |
|
2256 | 2256 | } |
2257 | 2257 | |
2258 | 2258 | // Add the tab in left sidebar menu fro import & export page. |
@@ -2272,9 +2272,9 @@ discard block |
||
2272 | 2272 | * @param $post object $post The post object of the post being saved. |
2273 | 2273 | */ |
2274 | 2274 | function geodir_update_location_prefix($post_id,$post){ |
2275 | - if($post->post_type=='page' && $post->post_name && $post_id==get_option('geodir_location_page')){ |
|
2276 | - update_option('geodir_location_prefix',$post->post_name); |
|
2277 | - } |
|
2275 | + if($post->post_type=='page' && $post->post_name && $post_id==get_option('geodir_location_page')){ |
|
2276 | + update_option('geodir_location_prefix',$post->post_name); |
|
2277 | + } |
|
2278 | 2278 | |
2279 | 2279 | } |
2280 | 2280 | |
@@ -2285,50 +2285,50 @@ discard block |
||
2285 | 2285 | function geodir_ga_callback(){ |
2286 | 2286 | |
2287 | 2287 | if(isset($_REQUEST['code']) && $_REQUEST['code']) { |
2288 | - $oAuthURL = "https://www.googleapis.com/oauth2/v3/token?"; |
|
2289 | - $code = "code=".$_REQUEST['code']; |
|
2290 | - $grant_type = "&grant_type=authorization_code"; |
|
2291 | - $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback"; |
|
2292 | - $client_id = "&client_id=".get_option('geodir_ga_client_id'); |
|
2293 | - $client_secret = "&client_secret=".get_option('geodir_ga_client_secret'); |
|
2288 | + $oAuthURL = "https://www.googleapis.com/oauth2/v3/token?"; |
|
2289 | + $code = "code=".$_REQUEST['code']; |
|
2290 | + $grant_type = "&grant_type=authorization_code"; |
|
2291 | + $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback"; |
|
2292 | + $client_id = "&client_id=".get_option('geodir_ga_client_id'); |
|
2293 | + $client_secret = "&client_secret=".get_option('geodir_ga_client_secret'); |
|
2294 | 2294 | |
2295 | - $auth_url = $oAuthURL . $code . $redirect_uri . $grant_type . $client_id .$client_secret; |
|
2295 | + $auth_url = $oAuthURL . $code . $redirect_uri . $grant_type . $client_id .$client_secret; |
|
2296 | 2296 | |
2297 | - $response = wp_remote_post($auth_url, array('timeout' => 15)); |
|
2297 | + $response = wp_remote_post($auth_url, array('timeout' => 15)); |
|
2298 | 2298 | |
2299 | - //print_r($response); |
|
2299 | + //print_r($response); |
|
2300 | 2300 | |
2301 | - $error_msg = __('Something went wrong','geodirectory'); |
|
2302 | - if(!empty($response['response']['code']) && $response['response']['code']==200){ |
|
2301 | + $error_msg = __('Something went wrong','geodirectory'); |
|
2302 | + if(!empty($response['response']['code']) && $response['response']['code']==200){ |
|
2303 | 2303 | |
2304 | - $parts = json_decode($response['body']); |
|
2305 | - //print_r($parts); |
|
2306 | - if(!isset($parts->access_token)){echo $error_msg." - #1";exit;} |
|
2307 | - else{ |
|
2304 | + $parts = json_decode($response['body']); |
|
2305 | + //print_r($parts); |
|
2306 | + if(!isset($parts->access_token)){echo $error_msg." - #1";exit;} |
|
2307 | + else{ |
|
2308 | 2308 | |
2309 | - update_option('gd_ga_access_token', $parts->access_token); |
|
2310 | - update_option('gd_ga_refresh_token', $parts->refresh_token); |
|
2311 | - ?><script>window.close();</script><?php |
|
2312 | - } |
|
2309 | + update_option('gd_ga_access_token', $parts->access_token); |
|
2310 | + update_option('gd_ga_refresh_token', $parts->refresh_token); |
|
2311 | + ?><script>window.close();</script><?php |
|
2312 | + } |
|
2313 | 2313 | |
2314 | 2314 | |
2315 | - } |
|
2316 | - elseif(!empty($response['response']['code'])) { |
|
2317 | - $parts = json_decode($response['body']); |
|
2315 | + } |
|
2316 | + elseif(!empty($response['response']['code'])) { |
|
2317 | + $parts = json_decode($response['body']); |
|
2318 | 2318 | |
2319 | - if(isset($parts->error)){ |
|
2320 | - echo $parts->error.": ".$parts->error_description;exit; |
|
2321 | - }else{ |
|
2322 | - echo $error_msg." - #2";exit; |
|
2323 | - } |
|
2319 | + if(isset($parts->error)){ |
|
2320 | + echo $parts->error.": ".$parts->error_description;exit; |
|
2321 | + }else{ |
|
2322 | + echo $error_msg." - #2";exit; |
|
2323 | + } |
|
2324 | 2324 | |
2325 | - }else{ |
|
2325 | + }else{ |
|
2326 | 2326 | |
2327 | - echo $error_msg." - #3";exit; |
|
2327 | + echo $error_msg." - #3";exit; |
|
2328 | 2328 | |
2329 | - } |
|
2329 | + } |
|
2330 | 2330 | } |
2331 | - exit; |
|
2331 | + exit; |
|
2332 | 2332 | } |
2333 | 2333 | |
2334 | 2334 | add_filter( 'icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4 ); |
@@ -2346,45 +2346,45 @@ discard block |
||
2346 | 2346 | * @return array Array of settings. |
2347 | 2347 | */ |
2348 | 2348 | function geodir_uninstall_settings($general_settings) { |
2349 | - $settings = array(); |
|
2350 | - $settings[] = array('type' => 'title', 'id' => 'uninstall_settings', 'name' => __('Uninstall Settings', 'geodirectory')); |
|
2351 | - $settings[] = array('type' => 'sectionstart', 'id' => 'uninstall_settings_main', 'name' => __('Remove Data on Uninstall?', 'geodirectory' )); |
|
2349 | + $settings = array(); |
|
2350 | + $settings[] = array('type' => 'title', 'id' => 'uninstall_settings', 'name' => __('Uninstall Settings', 'geodirectory')); |
|
2351 | + $settings[] = array('type' => 'sectionstart', 'id' => 'uninstall_settings_main', 'name' => __('Remove Data on Uninstall?', 'geodirectory' )); |
|
2352 | 2352 | |
2353 | - $plugins = get_plugins(); |
|
2354 | - $un_plugins = apply_filters('geodir_plugins_uninstall_settings', array()); |
|
2353 | + $plugins = get_plugins(); |
|
2354 | + $un_plugins = apply_filters('geodir_plugins_uninstall_settings', array()); |
|
2355 | 2355 | |
2356 | - if (!empty($plugins) && !empty($un_plugins)) { |
|
2357 | - foreach ($plugins as $plugin => $data) { |
|
2358 | - $plugin_name = plugin_basename(dirname($plugin)); |
|
2356 | + if (!empty($plugins) && !empty($un_plugins)) { |
|
2357 | + foreach ($plugins as $plugin => $data) { |
|
2358 | + $plugin_name = plugin_basename(dirname($plugin)); |
|
2359 | 2359 | |
2360 | - if (in_array($plugin_name, $un_plugins)) { |
|
2361 | - $settings[] = array( |
|
2362 | - 'type' => 'checkbox', |
|
2363 | - 'id' => 'geodir_un_' . $plugin_name, |
|
2364 | - 'name' => $data['Name'], |
|
2365 | - 'desc' => __('Remove all data when deleted?', 'geodirectory'), |
|
2366 | - 'std' => '0' |
|
2367 | - ); |
|
2368 | - } |
|
2369 | - } |
|
2370 | - } |
|
2360 | + if (in_array($plugin_name, $un_plugins)) { |
|
2361 | + $settings[] = array( |
|
2362 | + 'type' => 'checkbox', |
|
2363 | + 'id' => 'geodir_un_' . $plugin_name, |
|
2364 | + 'name' => $data['Name'], |
|
2365 | + 'desc' => __('Remove all data when deleted?', 'geodirectory'), |
|
2366 | + 'std' => '0' |
|
2367 | + ); |
|
2368 | + } |
|
2369 | + } |
|
2370 | + } |
|
2371 | 2371 | |
2372 | - $settings[] = array('type' => 'sectionend', 'id' => 'uninstall_settings_main'); |
|
2372 | + $settings[] = array('type' => 'sectionend', 'id' => 'uninstall_settings_main'); |
|
2373 | 2373 | |
2374 | - /** |
|
2375 | - * Filter the uninstall settings array. |
|
2376 | - * |
|
2377 | - * @since 1.6.9 |
|
2378 | - * |
|
2379 | - * @param array $settings The settings array. |
|
2380 | - */ |
|
2381 | - $settings = apply_filters('geodir_uninstall_settings', $settings); |
|
2374 | + /** |
|
2375 | + * Filter the uninstall settings array. |
|
2376 | + * |
|
2377 | + * @since 1.6.9 |
|
2378 | + * |
|
2379 | + * @param array $settings The settings array. |
|
2380 | + */ |
|
2381 | + $settings = apply_filters('geodir_uninstall_settings', $settings); |
|
2382 | 2382 | |
2383 | - if (!empty($settings) && count($settings) > 3) { |
|
2384 | - return array_merge($general_settings, $settings); |
|
2385 | - } |
|
2383 | + if (!empty($settings) && count($settings) > 3) { |
|
2384 | + return array_merge($general_settings, $settings); |
|
2385 | + } |
|
2386 | 2386 | |
2387 | - return $general_settings; |
|
2387 | + return $general_settings; |
|
2388 | 2388 | } |
2389 | 2389 | add_filter('geodir_general_settings', 'geodir_uninstall_settings', 100, 1); |
2390 | 2390 | |
@@ -2394,7 +2394,7 @@ discard block |
||
2394 | 2394 | * @since 1.6.9 |
2395 | 2395 | */ |
2396 | 2396 | function geodir_uninstall_settings_desc() { |
2397 | - echo '<p class="gd-un-settings-desc">' . __('Select the plugins that you would like to completely remove all of its data when the plugin is deleted.', 'geodirectory') . '</p>'; |
|
2397 | + echo '<p class="gd-un-settings-desc">' . __('Select the plugins that you would like to completely remove all of its data when the plugin is deleted.', 'geodirectory') . '</p>'; |
|
2398 | 2398 | } |
2399 | 2399 | add_action('geodir_settings_uninstall_settings_main_start', 'geodir_uninstall_settings_desc'); |
2400 | 2400 | |
@@ -2410,18 +2410,18 @@ discard block |
||
2410 | 2410 | * @return array The settings array. |
2411 | 2411 | */ |
2412 | 2412 | function geodir_resave_settings($settings = array()) { |
2413 | - if (!empty($settings) && is_array($settings)) { |
|
2414 | - $c = 0; |
|
2413 | + if (!empty($settings) && is_array($settings)) { |
|
2414 | + $c = 0; |
|
2415 | 2415 | |
2416 | - foreach ($settings as $setting) { |
|
2417 | - if (!empty($setting['id']) && false !== ($value = get_option($setting['id']))) { |
|
2418 | - $settings[$c]['std'] = $value; |
|
2419 | - } |
|
2420 | - $c++; |
|
2421 | - } |
|
2422 | - } |
|
2423 | - |
|
2424 | - return $settings; |
|
2416 | + foreach ($settings as $setting) { |
|
2417 | + if (!empty($setting['id']) && false !== ($value = get_option($setting['id']))) { |
|
2418 | + $settings[$c]['std'] = $value; |
|
2419 | + } |
|
2420 | + $c++; |
|
2421 | + } |
|
2422 | + } |
|
2423 | + |
|
2424 | + return $settings; |
|
2425 | 2425 | } |
2426 | 2426 | |
2427 | 2427 | /** |
@@ -2433,8 +2433,8 @@ discard block |
||
2433 | 2433 | * @return array The modified settings. |
2434 | 2434 | */ |
2435 | 2435 | function geodir_core_uninstall_settings($settings) { |
2436 | - $settings[] = plugin_basename(dirname(dirname(__FILE__))); |
|
2436 | + $settings[] = plugin_basename(dirname(dirname(__FILE__))); |
|
2437 | 2437 | |
2438 | - return $settings; |
|
2438 | + return $settings; |
|
2439 | 2439 | } |
2440 | 2440 | add_filter('geodir_plugins_uninstall_settings', 'geodir_core_uninstall_settings', 10, 1); |
2441 | 2441 | \ No newline at end of file |
@@ -14,18 +14,18 @@ discard block |
||
14 | 14 | |
15 | 15 | |
16 | 16 | if (function_exists('geodir_location_geo_home_link')) { |
17 | - remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
17 | + remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
18 | 18 | } |
19 | 19 | $search_url = trailingslashit(get_home_url()); |
20 | 20 | if (function_exists('geodir_location_geo_home_link')) { |
21 | - add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
21 | + add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | |
25 | 25 | $new_style = get_option('geodir_show_search_old_search_from') ? false : true; |
26 | 26 | $form_class = 'geodir-listing-search'; |
27 | 27 | if($new_style){ |
28 | - $form_class .= ' gd-search-bar-style'; |
|
28 | + $form_class .= ' gd-search-bar-style'; |
|
29 | 29 | } |
30 | 30 | ?> |
31 | 31 | |
@@ -44,56 +44,56 @@ discard block |
||
44 | 44 | <div class="geodir-loc-bar"> |
45 | 45 | |
46 | 46 | <?php |
47 | - /** |
|
48 | - * Called inside the search form but before any of the fields. |
|
49 | - * |
|
50 | - * @since 1.0.0 |
|
51 | - */ |
|
52 | - do_action('geodir_before_search_form') ?> |
|
47 | + /** |
|
48 | + * Called inside the search form but before any of the fields. |
|
49 | + * |
|
50 | + * @since 1.0.0 |
|
51 | + */ |
|
52 | + do_action('geodir_before_search_form') ?> |
|
53 | 53 | |
54 | 54 | <div class="clearfix geodir-loc-bar-in"> |
55 | 55 | <div class="geodir-search"> |
56 | 56 | |
57 | 57 | <?php |
58 | 58 | |
59 | - /** |
|
60 | - * Adds the input fields to the search form. |
|
61 | - * |
|
62 | - * @since 1.6.9 |
|
63 | - */ |
|
64 | - do_action('geodir_search_form_inputs'); |
|
59 | + /** |
|
60 | + * Adds the input fields to the search form. |
|
61 | + * |
|
62 | + * @since 1.6.9 |
|
63 | + */ |
|
64 | + do_action('geodir_search_form_inputs'); |
|
65 | 65 | |
66 | 66 | |
67 | 67 | |
68 | - /** |
|
69 | - * Called on the GD search form just before the search button. |
|
70 | - * |
|
71 | - * @since 1.0.0 |
|
72 | - */ |
|
73 | - do_action('geodir_before_search_button'); |
|
68 | + /** |
|
69 | + * Called on the GD search form just before the search button. |
|
70 | + * |
|
71 | + * @since 1.0.0 |
|
72 | + */ |
|
73 | + do_action('geodir_before_search_button'); |
|
74 | 74 | |
75 | 75 | |
76 | - /** |
|
77 | - * Called on the GD search form just after the search button. |
|
78 | - * |
|
79 | - * @since 1.0.0 |
|
80 | - */ |
|
81 | - do_action('geodir_after_search_button'); |
|
76 | + /** |
|
77 | + * Called on the GD search form just after the search button. |
|
78 | + * |
|
79 | + * @since 1.0.0 |
|
80 | + */ |
|
81 | + do_action('geodir_after_search_button'); |
|
82 | 82 | |
83 | 83 | |
84 | - ?> |
|
84 | + ?> |
|
85 | 85 | </div> |
86 | 86 | |
87 | 87 | |
88 | 88 | </div> |
89 | 89 | |
90 | 90 | <?php |
91 | - /** |
|
92 | - * Called inside the search form but after all the input fields. |
|
93 | - * |
|
94 | - * @since 1.0.0 |
|
95 | - */ |
|
96 | - do_action('geodir_after_search_form') ?> |
|
91 | + /** |
|
92 | + * Called inside the search form but after all the input fields. |
|
93 | + * |
|
94 | + * @since 1.0.0 |
|
95 | + */ |
|
96 | + do_action('geodir_after_search_form') ?> |
|
97 | 97 | |
98 | 98 | |
99 | 99 | </div> |
@@ -24,7 +24,7 @@ |
||
24 | 24 | |
25 | 25 | $new_style = get_option('geodir_show_search_old_search_from') ? false : true; |
26 | 26 | $form_class = 'geodir-listing-search'; |
27 | -if($new_style){ |
|
27 | +if ($new_style) { |
|
28 | 28 | $form_class .= ' gd-search-bar-style'; |
29 | 29 | } |
30 | 30 | ?> |
@@ -19,8 +19,9 @@ discard block |
||
19 | 19 | |
20 | 20 | if (!isset($field_info->post_type)) { |
21 | 21 | $post_type = sanitize_text_field($_REQUEST['listing_type']); |
22 | -} else |
|
23 | - $post_type = $field_info->post_type; |
|
22 | +} else { |
|
23 | + $post_type = $field_info->post_type; |
|
24 | +} |
|
24 | 25 | |
25 | 26 | //if(isset($_REQUEST['custom_type']) && $_REQUEST['custom_type']=='predefined'){ |
26 | 27 | // $cf_arr = geodir_custom_fields_predefined($post_type); |
@@ -43,8 +44,9 @@ discard block |
||
43 | 44 | $nonce = wp_create_nonce('custom_fields_' . $result_str); |
44 | 45 | |
45 | 46 | $field_admin_title = ''; |
46 | -if (isset($field_info->admin_title)) |
|
47 | - $field_admin_title = $field_info->admin_title; |
|
47 | +if (isset($field_info->admin_title)) { |
|
48 | + $field_admin_title = $field_info->admin_title; |
|
49 | +} |
|
48 | 50 | |
49 | 51 | $default = isset($field_info->is_admin) ? $field_info->is_admin : ''; |
50 | 52 | |
@@ -65,15 +67,15 @@ discard block |
||
65 | 67 | |
66 | 68 | if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) { |
67 | 69 | $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>'; |
68 | -}elseif(isset($cf['icon']) && $cf['icon']){ |
|
70 | +} elseif(isset($cf['icon']) && $cf['icon']){ |
|
69 | 71 | $field_icon = '<b style="background-image: url("'.$cf['icon'].'")"></b>'; |
70 | -}else{ |
|
72 | +} else{ |
|
71 | 73 | $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>'; |
72 | 74 | } |
73 | 75 | |
74 | 76 | if(isset($cf['name']) && $cf['name']){ |
75 | 77 | $field_type_name = $cf['name']; |
76 | -}else{ |
|
78 | +} else{ |
|
77 | 79 | $field_type_name = $field_type; |
78 | 80 | } |
79 | 81 | |
@@ -89,8 +91,11 @@ discard block |
||
89 | 91 | |
90 | 92 | <?php if ($default): ?> |
91 | 93 | <div title="<?php _e('Default field, should not be removed.', 'geodirectory'); ?>" class="handlediv move gd-default-remove"><i class="fa fa-times" aria-hidden="true"></i></div> |
92 | - <?php else: ?> |
|
93 | - <div title="<?php _e('Click to remove field', 'geodirectory'); ?>" |
|
94 | + <?php else { |
|
95 | + : ?> |
|
96 | + <div title="<?php _e('Click to remove field', 'geodirectory'); |
|
97 | +} |
|
98 | +?>" |
|
94 | 99 | onclick="delete_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>')" |
95 | 100 | class="handlediv close"><i class="fa fa-times" aria-hidden="true"></i></div> |
96 | 101 | <?php endif; |
@@ -141,11 +146,11 @@ discard block |
||
141 | 146 | |
142 | 147 | echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info); |
143 | 148 | |
144 | - }else{ |
|
149 | + } else{ |
|
145 | 150 | $value = ''; |
146 | 151 | if (isset($field_info->data_type)) { |
147 | 152 | $value = esc_attr($field_info->data_type); |
148 | - }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){ |
|
153 | + } elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){ |
|
149 | 154 | $value = $cf['defaults']['data_type']; |
150 | 155 | } |
151 | 156 | ?> |
@@ -159,11 +164,11 @@ discard block |
||
159 | 164 | |
160 | 165 | echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info); |
161 | 166 | |
162 | - }else{ |
|
167 | + } else{ |
|
163 | 168 | $value = ''; |
164 | 169 | if (isset($field_info->admin_title)) { |
165 | 170 | $value = esc_attr($field_info->admin_title); |
166 | - }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){ |
|
171 | + } elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){ |
|
167 | 172 | $value = $cf['defaults']['admin_title']; |
168 | 173 | } |
169 | 174 | ?> |
@@ -188,11 +193,11 @@ discard block |
||
188 | 193 | |
189 | 194 | echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info); |
190 | 195 | |
191 | - }else{ |
|
196 | + } else{ |
|
192 | 197 | $value = ''; |
193 | 198 | if (isset($field_info->site_title)) { |
194 | 199 | $value = esc_attr($field_info->site_title); |
195 | - }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){ |
|
200 | + } elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){ |
|
196 | 201 | $value = $cf['defaults']['site_title']; |
197 | 202 | } |
198 | 203 | ?> |
@@ -216,11 +221,11 @@ discard block |
||
216 | 221 | |
217 | 222 | echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info); |
218 | 223 | |
219 | - }else{ |
|
224 | + } else{ |
|
220 | 225 | $value = ''; |
221 | 226 | if (isset($field_info->admin_desc)) { |
222 | 227 | $value = esc_attr($field_info->admin_desc); |
223 | - }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){ |
|
228 | + } elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){ |
|
224 | 229 | $value = $cf['defaults']['admin_desc']; |
225 | 230 | } |
226 | 231 | ?> |
@@ -244,11 +249,11 @@ discard block |
||
244 | 249 | |
245 | 250 | echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info); |
246 | 251 | |
247 | - }else{ |
|
252 | + } else{ |
|
248 | 253 | $value = ''; |
249 | 254 | if (isset($field_info->htmlvar_name)) { |
250 | 255 | $value = esc_attr($field_info->htmlvar_name); |
251 | - }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){ |
|
256 | + } elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){ |
|
252 | 257 | $value = $cf['defaults']['htmlvar_name']; |
253 | 258 | } |
254 | 259 | ?> |
@@ -276,11 +281,11 @@ discard block |
||
276 | 281 | |
277 | 282 | echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info); |
278 | 283 | |
279 | - }else{ |
|
284 | + } else{ |
|
280 | 285 | $value = ''; |
281 | 286 | if (isset($field_info->is_active)) { |
282 | 287 | $value = esc_attr($field_info->is_active); |
283 | - }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){ |
|
288 | + } elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){ |
|
284 | 289 | $value = $cf['defaults']['is_active']; |
285 | 290 | } |
286 | 291 | ?> |
@@ -315,11 +320,11 @@ discard block |
||
315 | 320 | |
316 | 321 | echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info); |
317 | 322 | |
318 | - }else{ |
|
323 | + } else{ |
|
319 | 324 | $value = ''; |
320 | 325 | if (isset($field_info->for_admin_use)) { |
321 | 326 | $value = esc_attr($field_info->for_admin_use); |
322 | - }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){ |
|
327 | + } elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){ |
|
323 | 328 | $value = $cf['defaults']['for_admin_use']; |
324 | 329 | } |
325 | 330 | ?> |
@@ -354,11 +359,11 @@ discard block |
||
354 | 359 | |
355 | 360 | echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info); |
356 | 361 | |
357 | - }else{ |
|
362 | + } else{ |
|
358 | 363 | $value = ''; |
359 | 364 | if (isset($field_info->default_value)) { |
360 | 365 | $value = esc_attr($field_info->default_value); |
361 | - }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){ |
|
366 | + } elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){ |
|
362 | 367 | $value = $cf['defaults']['default_value']; |
363 | 368 | } |
364 | 369 | ?> |
@@ -398,11 +403,11 @@ discard block |
||
398 | 403 | |
399 | 404 | echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info); |
400 | 405 | |
401 | - }else{ |
|
406 | + } else{ |
|
402 | 407 | $value = ''; |
403 | 408 | if (isset($field_info->show_in)) { |
404 | 409 | $value = esc_attr($field_info->show_in); |
405 | - }elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){ |
|
410 | + } elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){ |
|
406 | 411 | $value = esc_attr($cf['defaults']['show_in']); |
407 | 412 | } |
408 | 413 | ?> |
@@ -443,7 +448,7 @@ discard block |
||
443 | 448 | // don't show new tab option for some types |
444 | 449 | |
445 | 450 | if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) { |
446 | - }else{ |
|
451 | + } else{ |
|
447 | 452 | unset($show_in_locations['[owntab]']); |
448 | 453 | } |
449 | 454 | |
@@ -556,11 +561,11 @@ discard block |
||
556 | 561 | |
557 | 562 | echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info); |
558 | 563 | |
559 | - }else{ |
|
564 | + } else{ |
|
560 | 565 | $value = ''; |
561 | 566 | if (isset($field_info->is_required)) { |
562 | 567 | $value = esc_attr($field_info->is_required); |
563 | - }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){ |
|
568 | + } elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){ |
|
564 | 569 | $value = $cf['defaults']['is_required']; |
565 | 570 | } |
566 | 571 | ?> |
@@ -597,11 +602,11 @@ discard block |
||
597 | 602 | |
598 | 603 | echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info); |
599 | 604 | |
600 | - }else{ |
|
605 | + } else{ |
|
601 | 606 | $value = ''; |
602 | 607 | if (isset($field_info->required_msg)) { |
603 | 608 | $value = esc_attr($field_info->required_msg); |
604 | - }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){ |
|
609 | + } elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){ |
|
605 | 610 | $value = $cf['defaults']['required_msg']; |
606 | 611 | } |
607 | 612 | ?> |
@@ -642,11 +647,11 @@ discard block |
||
642 | 647 | |
643 | 648 | echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info); |
644 | 649 | |
645 | - }else{ |
|
650 | + } else{ |
|
646 | 651 | $value = ''; |
647 | 652 | if (isset($field_info->field_icon)) { |
648 | 653 | $value = esc_attr($field_info->field_icon); |
649 | - }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){ |
|
654 | + } elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){ |
|
650 | 655 | $value = $cf['defaults']['field_icon']; |
651 | 656 | } |
652 | 657 | ?> |
@@ -675,11 +680,11 @@ discard block |
||
675 | 680 | |
676 | 681 | echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info); |
677 | 682 | |
678 | - }else{ |
|
683 | + } else{ |
|
679 | 684 | $value = ''; |
680 | 685 | if (isset($field_info->css_class)) { |
681 | 686 | $value = esc_attr($field_info->css_class); |
682 | - }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){ |
|
687 | + } elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){ |
|
683 | 688 | $value = $cf['defaults']['css_class']; |
684 | 689 | } |
685 | 690 | ?> |
@@ -708,12 +713,12 @@ discard block |
||
708 | 713 | |
709 | 714 | echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info); |
710 | 715 | |
711 | - }else{ |
|
716 | + } else{ |
|
712 | 717 | $value = ''; |
713 | 718 | $hide_cat_sort =''; |
714 | 719 | if (isset($field_info->cat_sort)) { |
715 | 720 | $value = esc_attr($field_info->cat_sort); |
716 | - }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){ |
|
721 | + } elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){ |
|
717 | 722 | $value = $cf['defaults']['cat_sort']; |
718 | 723 | $hide_cat_sort = ($value===false) ? "style='display:none;'" : ''; |
719 | 724 | } |
@@ -18,9 +18,9 @@ discard block |
||
18 | 18 | global $post_type; |
19 | 19 | |
20 | 20 | if (!isset($field_info->post_type)) { |
21 | - $post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
21 | + $post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
22 | 22 | } else |
23 | - $post_type = $field_info->post_type; |
|
23 | + $post_type = $field_info->post_type; |
|
24 | 24 | |
25 | 25 | //if(isset($_REQUEST['custom_type']) && $_REQUEST['custom_type']=='predefined'){ |
26 | 26 | // $cf_arr = geodir_custom_fields_predefined($post_type); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | $field_admin_title = ''; |
50 | 50 | if (isset($field_info->admin_title)) |
51 | - $field_admin_title = $field_info->admin_title; |
|
51 | + $field_admin_title = $field_info->admin_title; |
|
52 | 52 | |
53 | 53 | $default = isset($field_info->is_admin) ? $field_info->is_admin : ''; |
54 | 54 | |
@@ -68,17 +68,17 @@ discard block |
||
68 | 68 | //print_r($field_info); |
69 | 69 | |
70 | 70 | if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) { |
71 | - $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>'; |
|
71 | + $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>'; |
|
72 | 72 | }elseif(isset($cf['icon']) && $cf['icon']){ |
73 | - $field_icon = '<b style="background-image: url("'.$cf['icon'].'")"></b>'; |
|
73 | + $field_icon = '<b style="background-image: url("'.$cf['icon'].'")"></b>'; |
|
74 | 74 | }else{ |
75 | - $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>'; |
|
75 | + $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>'; |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | if(isset($cf['name']) && $cf['name']){ |
79 | - $field_type_name = $cf['name']; |
|
79 | + $field_type_name = $cf['name']; |
|
80 | 80 | }else{ |
81 | - $field_type_name = $field_type; |
|
81 | + $field_type_name = $field_type; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | ?> |
@@ -88,8 +88,8 @@ discard block |
||
88 | 88 | ondblclick="show_hide('field_frm<?php echo $result_str; ?>')"> |
89 | 89 | <?php |
90 | 90 | |
91 | - $nonce = wp_create_nonce('custom_fields_' . $result_str); |
|
92 | - ?> |
|
91 | + $nonce = wp_create_nonce('custom_fields_' . $result_str); |
|
92 | + ?> |
|
93 | 93 | |
94 | 94 | <?php if ($default): ?> |
95 | 95 | <div title="<?php _e('Default field, should not be removed.', 'geodirectory'); ?>" class="handlediv move gd-default-remove"><i class="fa fa-times" aria-hidden="true"></i></div> |
@@ -98,37 +98,37 @@ discard block |
||
98 | 98 | onclick="delete_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>')" |
99 | 99 | class="handlediv close"><i class="fa fa-times" aria-hidden="true"></i></div> |
100 | 100 | <?php endif; |
101 | - if ($field_type == 'fieldset') { |
|
102 | - ?> |
|
101 | + if ($field_type == 'fieldset') { |
|
102 | + ?> |
|
103 | 103 | <i class="fa fa-long-arrow-left " aria-hidden="true"></i> |
104 | 104 | <i class="fa fa-long-arrow-right " aria-hidden="true"></i> |
105 | 105 | <b style="cursor:pointer;" |
106 | 106 | onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory') . ' ' . $field_admin_title);?></b> |
107 | 107 | <?php |
108 | - } else {echo $field_icon; |
|
109 | - ?> |
|
108 | + } else {echo $field_icon; |
|
109 | + ?> |
|
110 | 110 | <b style="cursor:pointer;" |
111 | 111 | onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(' ' . $field_admin_title . ' (' . $field_type_name . ')');?></b> |
112 | 112 | <?php |
113 | - } |
|
114 | - ?> |
|
113 | + } |
|
114 | + ?> |
|
115 | 115 | </div> |
116 | 116 | |
117 | 117 | <form><!-- we need to wrap in a fom so we can use radio buttons with same name --> |
118 | 118 | <div id="field_frm<?php echo $result_str; ?>" class="field_frm" |
119 | 119 | style="display:<?php if ($field_ins_upd == 'submit') { |
120 | - echo 'block;'; |
|
121 | - } else { |
|
122 | - echo 'none;'; |
|
123 | - } ?>"> |
|
120 | + echo 'block;'; |
|
121 | + } else { |
|
122 | + echo 'none;'; |
|
123 | + } ?>"> |
|
124 | 124 | <input type="hidden" name="_wpnonce" value="<?php echo esc_attr($nonce); ?>"/> |
125 | 125 | <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type; ?>"/> |
126 | 126 | <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type; ?>"/> |
127 | 127 | <input type="hidden" name="field_type_key" id="field_type_key" value="<?php echo $field_type_key; ?>"/> |
128 | 128 | <input type="hidden" name="field_id" id="field_id" value="<?php echo esc_attr($result_str); ?>"/> |
129 | 129 | <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) { |
130 | - echo $field_info->data_type; |
|
131 | - } ?>"/> |
|
130 | + echo $field_info->data_type; |
|
131 | + } ?>"/> |
|
132 | 132 | <input type="hidden" name="is_active" id="is_active" value="1"/> |
133 | 133 | |
134 | 134 | <input type="hidden" name="is_default" value="<?php echo isset($field_info->is_default) ? $field_info->is_default : '';?>" /><?php // show in sidebar value?> |
@@ -140,37 +140,37 @@ discard block |
||
140 | 140 | |
141 | 141 | <?php |
142 | 142 | |
143 | - // data_type |
|
144 | - if(has_filter("geodir_cfa_data_type_{$field_type}")){ |
|
143 | + // data_type |
|
144 | + if(has_filter("geodir_cfa_data_type_{$field_type}")){ |
|
145 | 145 | |
146 | - echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info); |
|
146 | + echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info); |
|
147 | 147 | |
148 | - }else{ |
|
149 | - $value = ''; |
|
150 | - if (isset($field_info->data_type)) { |
|
151 | - $value = esc_attr($field_info->data_type); |
|
152 | - }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){ |
|
153 | - $value = $cf['defaults']['data_type']; |
|
154 | - } |
|
155 | - ?> |
|
148 | + }else{ |
|
149 | + $value = ''; |
|
150 | + if (isset($field_info->data_type)) { |
|
151 | + $value = esc_attr($field_info->data_type); |
|
152 | + }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){ |
|
153 | + $value = $cf['defaults']['data_type']; |
|
154 | + } |
|
155 | + ?> |
|
156 | 156 | <input type="hidden" name="data_type" id="data_type" value="<?php echo $value;?>"/> |
157 | 157 | <?php |
158 | - } |
|
158 | + } |
|
159 | 159 | |
160 | 160 | |
161 | - // admin_title |
|
162 | - if(has_filter("geodir_cfa_admin_title_{$field_type}")){ |
|
161 | + // admin_title |
|
162 | + if(has_filter("geodir_cfa_admin_title_{$field_type}")){ |
|
163 | 163 | |
164 | - echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info); |
|
164 | + echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info); |
|
165 | 165 | |
166 | - }else{ |
|
167 | - $value = ''; |
|
168 | - if (isset($field_info->admin_title)) { |
|
169 | - $value = esc_attr($field_info->admin_title); |
|
170 | - }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){ |
|
171 | - $value = $cf['defaults']['admin_title']; |
|
172 | - } |
|
173 | - ?> |
|
166 | + }else{ |
|
167 | + $value = ''; |
|
168 | + if (isset($field_info->admin_title)) { |
|
169 | + $value = esc_attr($field_info->admin_title); |
|
170 | + }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){ |
|
171 | + $value = $cf['defaults']['admin_title']; |
|
172 | + } |
|
173 | + ?> |
|
174 | 174 | <li> |
175 | 175 | <label for="admin_title" class="gd-cf-tooltip-wrap"> |
176 | 176 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Admin title :', 'geodirectory'); ?> |
@@ -184,22 +184,22 @@ discard block |
||
184 | 184 | </div> |
185 | 185 | </li> |
186 | 186 | <?php |
187 | - } |
|
187 | + } |
|
188 | 188 | |
189 | 189 | |
190 | - // site_title |
|
191 | - if(has_filter("geodir_cfa_site_title_{$field_type}")){ |
|
190 | + // site_title |
|
191 | + if(has_filter("geodir_cfa_site_title_{$field_type}")){ |
|
192 | 192 | |
193 | - echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info); |
|
193 | + echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info); |
|
194 | 194 | |
195 | - }else{ |
|
196 | - $value = ''; |
|
197 | - if (isset($field_info->site_title)) { |
|
198 | - $value = esc_attr($field_info->site_title); |
|
199 | - }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){ |
|
200 | - $value = $cf['defaults']['site_title']; |
|
201 | - } |
|
202 | - ?> |
|
195 | + }else{ |
|
196 | + $value = ''; |
|
197 | + if (isset($field_info->site_title)) { |
|
198 | + $value = esc_attr($field_info->site_title); |
|
199 | + }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){ |
|
200 | + $value = $cf['defaults']['site_title']; |
|
201 | + } |
|
202 | + ?> |
|
203 | 203 | <li> |
204 | 204 | <label for="site_title" class="gd-cf-tooltip-wrap"> <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Frontend title :', 'geodirectory'); ?> |
205 | 205 | <div class="gdcf-tooltip"> |
@@ -212,22 +212,22 @@ discard block |
||
212 | 212 | </div> |
213 | 213 | </li> |
214 | 214 | <?php |
215 | - } |
|
215 | + } |
|
216 | 216 | |
217 | 217 | |
218 | - // admin_desc |
|
219 | - if(has_filter("geodir_cfa_admin_desc_{$field_type}")){ |
|
218 | + // admin_desc |
|
219 | + if(has_filter("geodir_cfa_admin_desc_{$field_type}")){ |
|
220 | 220 | |
221 | - echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info); |
|
221 | + echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info); |
|
222 | 222 | |
223 | - }else{ |
|
224 | - $value = ''; |
|
225 | - if (isset($field_info->admin_desc)) { |
|
226 | - $value = esc_attr($field_info->admin_desc); |
|
227 | - }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){ |
|
228 | - $value = $cf['defaults']['admin_desc']; |
|
229 | - } |
|
230 | - ?> |
|
223 | + }else{ |
|
224 | + $value = ''; |
|
225 | + if (isset($field_info->admin_desc)) { |
|
226 | + $value = esc_attr($field_info->admin_desc); |
|
227 | + }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){ |
|
228 | + $value = $cf['defaults']['admin_desc']; |
|
229 | + } |
|
230 | + ?> |
|
231 | 231 | <li> |
232 | 232 | <label for="admin_desc" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Frontend description :', 'geodirectory'); ?> |
233 | 233 | <div class="gdcf-tooltip"> |
@@ -239,23 +239,23 @@ discard block |
||
239 | 239 | </div> |
240 | 240 | </li> |
241 | 241 | <?php |
242 | - } |
|
242 | + } |
|
243 | 243 | |
244 | 244 | |
245 | 245 | |
246 | - // htmlvar_name |
|
247 | - if(has_filter("geodir_cfa_htmlvar_name_{$field_type}")){ |
|
246 | + // htmlvar_name |
|
247 | + if(has_filter("geodir_cfa_htmlvar_name_{$field_type}")){ |
|
248 | 248 | |
249 | - echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info); |
|
249 | + echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info); |
|
250 | 250 | |
251 | - }else{ |
|
252 | - $value = ''; |
|
253 | - if (isset($field_info->htmlvar_name)) { |
|
254 | - $value = esc_attr($field_info->htmlvar_name); |
|
255 | - }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){ |
|
256 | - $value = $cf['defaults']['htmlvar_name']; |
|
257 | - } |
|
258 | - ?> |
|
251 | + }else{ |
|
252 | + $value = ''; |
|
253 | + if (isset($field_info->htmlvar_name)) { |
|
254 | + $value = esc_attr($field_info->htmlvar_name); |
|
255 | + }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){ |
|
256 | + $value = $cf['defaults']['htmlvar_name']; |
|
257 | + } |
|
258 | + ?> |
|
259 | 259 | <li> |
260 | 260 | <label for="htmlvar_name" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('HTML variable name :', 'geodirectory');?> |
261 | 261 | <div class="gdcf-tooltip"> |
@@ -265,29 +265,29 @@ discard block |
||
265 | 265 | <div class="gd-cf-input-wrap"> |
266 | 266 | <input type="text" name="htmlvar_name" id="htmlvar_name" pattern="[a-zA-Z0-9]+" title="<?php _e('Must not contain spaces or special characters', 'geodirectory');?>" |
267 | 267 | value="<?php if ($value) { |
268 | - echo preg_replace('/geodir_/', '', $value, 1); |
|
269 | - }?>" <?php if ($default) { |
|
270 | - echo 'readonly="readonly"'; |
|
271 | - }?> /> |
|
268 | + echo preg_replace('/geodir_/', '', $value, 1); |
|
269 | + }?>" <?php if ($default) { |
|
270 | + echo 'readonly="readonly"'; |
|
271 | + }?> /> |
|
272 | 272 | </div> |
273 | 273 | </li> |
274 | 274 | <?php |
275 | - } |
|
275 | + } |
|
276 | 276 | |
277 | 277 | |
278 | - // is_active |
|
279 | - if(has_filter("geodir_cfa_is_active_{$field_type}")){ |
|
278 | + // is_active |
|
279 | + if(has_filter("geodir_cfa_is_active_{$field_type}")){ |
|
280 | 280 | |
281 | - echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info); |
|
281 | + echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info); |
|
282 | 282 | |
283 | - }else{ |
|
284 | - $value = ''; |
|
285 | - if (isset($field_info->is_active)) { |
|
286 | - $value = esc_attr($field_info->is_active); |
|
287 | - }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){ |
|
288 | - $value = $cf['defaults']['is_active']; |
|
289 | - } |
|
290 | - ?> |
|
283 | + }else{ |
|
284 | + $value = ''; |
|
285 | + if (isset($field_info->is_active)) { |
|
286 | + $value = esc_attr($field_info->is_active); |
|
287 | + }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){ |
|
288 | + $value = $cf['defaults']['is_active']; |
|
289 | + } |
|
290 | + ?> |
|
291 | 291 | <li <?php echo $field_display; ?>> |
292 | 292 | <label for="is_active" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Is active :', 'geodirectory'); ?> |
293 | 293 | <div class="gdcf-tooltip"> |
@@ -298,35 +298,35 @@ discard block |
||
298 | 298 | |
299 | 299 | <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled" value="1" |
300 | 300 | <?php if ($value == '1') { |
301 | - echo 'checked'; |
|
302 | - } ?>/> |
|
301 | + echo 'checked'; |
|
302 | + } ?>/> |
|
303 | 303 | <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
304 | 304 | |
305 | 305 | <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0" |
306 | 306 | <?php if ($value == '0' || !$value) { |
307 | - echo 'checked'; |
|
308 | - } ?>/> |
|
307 | + echo 'checked'; |
|
308 | + } ?>/> |
|
309 | 309 | <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
310 | 310 | |
311 | 311 | </div> |
312 | 312 | </li> |
313 | 313 | <?php |
314 | - } |
|
314 | + } |
|
315 | 315 | |
316 | 316 | |
317 | - // for_admin_use |
|
318 | - if(has_filter("geodir_cfa_for_admin_use_{$field_type}")){ |
|
317 | + // for_admin_use |
|
318 | + if(has_filter("geodir_cfa_for_admin_use_{$field_type}")){ |
|
319 | 319 | |
320 | - echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info); |
|
320 | + echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info); |
|
321 | 321 | |
322 | - }else{ |
|
323 | - $value = ''; |
|
324 | - if (isset($field_info->for_admin_use)) { |
|
325 | - $value = esc_attr($field_info->for_admin_use); |
|
326 | - }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){ |
|
327 | - $value = $cf['defaults']['for_admin_use']; |
|
328 | - } |
|
329 | - ?> |
|
322 | + }else{ |
|
323 | + $value = ''; |
|
324 | + if (isset($field_info->for_admin_use)) { |
|
325 | + $value = esc_attr($field_info->for_admin_use); |
|
326 | + }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){ |
|
327 | + $value = $cf['defaults']['for_admin_use']; |
|
328 | + } |
|
329 | + ?> |
|
330 | 330 | <li> |
331 | 331 | <label for="for_admin_use" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('For admin use only? :', 'geodirectory'); ?> |
332 | 332 | <div class="gdcf-tooltip"> |
@@ -337,47 +337,47 @@ discard block |
||
337 | 337 | |
338 | 338 | <input type="radio" id="for_admin_use_yes<?php echo $radio_id;?>" name="for_admin_use" class="gdri-enabled" value="1" |
339 | 339 | <?php if ($value == '1') { |
340 | - echo 'checked'; |
|
341 | - } ?>/> |
|
340 | + echo 'checked'; |
|
341 | + } ?>/> |
|
342 | 342 | <label for="for_admin_use_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
343 | 343 | |
344 | 344 | <input type="radio" id="for_admin_use_no<?php echo $radio_id;?>" name="for_admin_use" class="gdri-disabled" value="0" |
345 | 345 | <?php if ($value == '0' || !$value) { |
346 | - echo 'checked'; |
|
347 | - } ?>/> |
|
346 | + echo 'checked'; |
|
347 | + } ?>/> |
|
348 | 348 | <label for="for_admin_use_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
349 | 349 | |
350 | 350 | </div> |
351 | 351 | </li> |
352 | 352 | <?php |
353 | - } |
|
353 | + } |
|
354 | 354 | |
355 | 355 | |
356 | - // default_value |
|
357 | - if(has_filter("geodir_cfa_default_value_{$field_type}")){ |
|
356 | + // default_value |
|
357 | + if(has_filter("geodir_cfa_default_value_{$field_type}")){ |
|
358 | 358 | |
359 | - echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info); |
|
359 | + echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info); |
|
360 | 360 | |
361 | - }else{ |
|
362 | - $value = ''; |
|
363 | - if (isset($field_info->default_value)) { |
|
364 | - $value = esc_attr($field_info->default_value); |
|
365 | - }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){ |
|
366 | - $value = $cf['defaults']['default_value']; |
|
367 | - } |
|
368 | - ?> |
|
361 | + }else{ |
|
362 | + $value = ''; |
|
363 | + if (isset($field_info->default_value)) { |
|
364 | + $value = esc_attr($field_info->default_value); |
|
365 | + }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){ |
|
366 | + $value = $cf['defaults']['default_value']; |
|
367 | + } |
|
368 | + ?> |
|
369 | 369 | <li> |
370 | 370 | <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory');?> |
371 | 371 | <div class="gdcf-tooltip"> |
372 | 372 | <?php |
373 | - if ($field_type == 'checkbox') { |
|
374 | - _e('Should the checkbox be checked by default?', 'geodirectory'); |
|
375 | - } else if ($field_type == 'email') { |
|
376 | - _e('A default value for the field, usually blank. Ex: [email protected]', 'geodirectory'); |
|
377 | - } else { |
|
378 | - _e('A default value for the field, usually blank. (for "link" this will be used as the link text)', 'geodirectory'); |
|
379 | - } |
|
380 | - ?> |
|
373 | + if ($field_type == 'checkbox') { |
|
374 | + _e('Should the checkbox be checked by default?', 'geodirectory'); |
|
375 | + } else if ($field_type == 'email') { |
|
376 | + _e('A default value for the field, usually blank. Ex: [email protected]', 'geodirectory'); |
|
377 | + } else { |
|
378 | + _e('A default value for the field, usually blank. (for "link" this will be used as the link text)', 'geodirectory'); |
|
379 | + } |
|
380 | + ?> |
|
381 | 381 | </div> |
382 | 382 | </label> |
383 | 383 | <div class="gd-cf-input-wrap"> |
@@ -394,22 +394,22 @@ discard block |
||
394 | 394 | </div> |
395 | 395 | </li> |
396 | 396 | <?php |
397 | - } |
|
397 | + } |
|
398 | 398 | |
399 | 399 | |
400 | - // show_in |
|
401 | - if(has_filter("geodir_cfa_show_in_{$field_type}")){ |
|
400 | + // show_in |
|
401 | + if(has_filter("geodir_cfa_show_in_{$field_type}")){ |
|
402 | 402 | |
403 | - echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info); |
|
403 | + echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info); |
|
404 | 404 | |
405 | - }else{ |
|
406 | - $value = ''; |
|
407 | - if (isset($field_info->show_in)) { |
|
408 | - $value = esc_attr($field_info->show_in); |
|
409 | - }elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){ |
|
410 | - $value = esc_attr($cf['defaults']['show_in']); |
|
411 | - } |
|
412 | - ?> |
|
405 | + }else{ |
|
406 | + $value = ''; |
|
407 | + if (isset($field_info->show_in)) { |
|
408 | + $value = esc_attr($field_info->show_in); |
|
409 | + }elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){ |
|
410 | + $value = esc_attr($cf['defaults']['show_in']); |
|
411 | + } |
|
412 | + ?> |
|
413 | 413 | <li> |
414 | 414 | <label for="show_in" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show in what locations?:', 'geodirectory'); ?> |
415 | 415 | <div class="gdcf-tooltip"> |
@@ -420,41 +420,41 @@ discard block |
||
420 | 420 | |
421 | 421 | <?php |
422 | 422 | |
423 | - /* |
|
423 | + /* |
|
424 | 424 | * We wrap the key values in [] so we can search the DB easier with a LIKE query. |
425 | 425 | */ |
426 | - $show_in_locations = array( |
|
427 | - "[detail]" => __("Details page sidebar", 'geodirectory'), |
|
428 | - "[moreinfo]" => __("More info tab", 'geodirectory'), |
|
429 | - "[listing]" => __("Listings page", 'geodirectory'), |
|
430 | - "[owntab]" => __("Details page own tab", 'geodirectory'), |
|
431 | - "[mapbubble]" => __("Map bubble", 'geodirectory'), |
|
432 | - ); |
|
433 | - |
|
434 | - /** |
|
435 | - * Filter the locations array for where to display custom fields. |
|
436 | - * |
|
437 | - * @since 1.6.6 |
|
438 | - * @param array $show_in_locations The array of locations and descriptions. |
|
439 | - * @param object $field_info The field being displayed info. |
|
440 | - * @param string $field_info The type of field. |
|
441 | - */ |
|
442 | - $show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info,$field_type); |
|
443 | - |
|
444 | - |
|
445 | - // remove some locations for some field types |
|
446 | - |
|
447 | - // don't show new tab option for some types |
|
448 | - if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) { |
|
449 | - }else{ |
|
450 | - unset($show_in_locations['[owntab]']); |
|
451 | - } |
|
452 | - |
|
453 | - if(!$display_on_listing){ |
|
454 | - unset($show_in_locations['[listings]']); |
|
455 | - } |
|
456 | - |
|
457 | - ?> |
|
426 | + $show_in_locations = array( |
|
427 | + "[detail]" => __("Details page sidebar", 'geodirectory'), |
|
428 | + "[moreinfo]" => __("More info tab", 'geodirectory'), |
|
429 | + "[listing]" => __("Listings page", 'geodirectory'), |
|
430 | + "[owntab]" => __("Details page own tab", 'geodirectory'), |
|
431 | + "[mapbubble]" => __("Map bubble", 'geodirectory'), |
|
432 | + ); |
|
433 | + |
|
434 | + /** |
|
435 | + * Filter the locations array for where to display custom fields. |
|
436 | + * |
|
437 | + * @since 1.6.6 |
|
438 | + * @param array $show_in_locations The array of locations and descriptions. |
|
439 | + * @param object $field_info The field being displayed info. |
|
440 | + * @param string $field_info The type of field. |
|
441 | + */ |
|
442 | + $show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info,$field_type); |
|
443 | + |
|
444 | + |
|
445 | + // remove some locations for some field types |
|
446 | + |
|
447 | + // don't show new tab option for some types |
|
448 | + if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) { |
|
449 | + }else{ |
|
450 | + unset($show_in_locations['[owntab]']); |
|
451 | + } |
|
452 | + |
|
453 | + if(!$display_on_listing){ |
|
454 | + unset($show_in_locations['[listings]']); |
|
455 | + } |
|
456 | + |
|
457 | + ?> |
|
458 | 458 | |
459 | 459 | <select multiple="multiple" name="show_in[]" |
460 | 460 | id="show_in" |
@@ -464,38 +464,38 @@ discard block |
||
464 | 464 | option-ajaxchosen="false"> |
465 | 465 | <?php |
466 | 466 | |
467 | - $show_in_values = explode(',',$value); |
|
467 | + $show_in_values = explode(',',$value); |
|
468 | 468 | |
469 | - foreach( $show_in_locations as $key => $val){ |
|
470 | - $selected = ''; |
|
469 | + foreach( $show_in_locations as $key => $val){ |
|
470 | + $selected = ''; |
|
471 | 471 | |
472 | - if(is_array($show_in_values) && in_array($key,$show_in_values ) ){ |
|
473 | - $selected = 'selected'; |
|
474 | - } |
|
472 | + if(is_array($show_in_values) && in_array($key,$show_in_values ) ){ |
|
473 | + $selected = 'selected'; |
|
474 | + } |
|
475 | 475 | |
476 | - ?> |
|
476 | + ?> |
|
477 | 477 | <option value="<?php echo $key;?>" <?php echo $selected;?>><?php echo $val;?></option> |
478 | 478 | <?php |
479 | - } |
|
480 | - ?> |
|
479 | + } |
|
480 | + ?> |
|
481 | 481 | </select> |
482 | 482 | </div> |
483 | 483 | </li> |
484 | 484 | <?php |
485 | - } |
|
485 | + } |
|
486 | 486 | |
487 | 487 | |
488 | - // advanced_editor |
|
489 | - if(has_filter("geodir_cfa_advanced_editor_{$field_type}")){ |
|
488 | + // advanced_editor |
|
489 | + if(has_filter("geodir_cfa_advanced_editor_{$field_type}")){ |
|
490 | 490 | |
491 | - echo apply_filters("geodir_cfa_advanced_editor_{$field_type}",'',$result_str,$cf,$field_info); |
|
491 | + echo apply_filters("geodir_cfa_advanced_editor_{$field_type}",'',$result_str,$cf,$field_info); |
|
492 | 492 | |
493 | - } |
|
493 | + } |
|
494 | 494 | |
495 | 495 | |
496 | 496 | |
497 | 497 | |
498 | - ?> |
|
498 | + ?> |
|
499 | 499 | |
500 | 500 | |
501 | 501 | <?php // @todo this does not seem to be used for anything, it can be removed or replaced ?> |
@@ -508,38 +508,38 @@ discard block |
||
508 | 508 | |
509 | 509 | <?php |
510 | 510 | |
511 | - $pricearr = array(); |
|
512 | - if (isset($field_info->packages) && $field_info->packages != '') { |
|
513 | - $pricearr = explode(',', trim($field_info->packages, ',')); |
|
514 | - } else { |
|
515 | - $package_info = array(); |
|
511 | + $pricearr = array(); |
|
512 | + if (isset($field_info->packages) && $field_info->packages != '') { |
|
513 | + $pricearr = explode(',', trim($field_info->packages, ',')); |
|
514 | + } else { |
|
515 | + $package_info = array(); |
|
516 | 516 | |
517 | - $package_info = geodir_post_package_info($package_info, '', $post_type); |
|
518 | - $pricearr[] = $package_info->pid; |
|
519 | - } |
|
517 | + $package_info = geodir_post_package_info($package_info, '', $post_type); |
|
518 | + $pricearr[] = $package_info->pid; |
|
519 | + } |
|
520 | 520 | |
521 | - ob_start() |
|
522 | - ?> |
|
521 | + ob_start() |
|
522 | + ?> |
|
523 | 523 | |
524 | 524 | <select style="display:none" name="show_on_pkg[]" id="show_on_pkg" multiple="multiple"> |
525 | 525 | <?php |
526 | - if (!empty($pricearr)) { |
|
527 | - foreach ($pricearr as $val) { |
|
528 | - ?> |
|
526 | + if (!empty($pricearr)) { |
|
527 | + foreach ($pricearr as $val) { |
|
528 | + ?> |
|
529 | 529 | <option selected="selected" value="<?php echo esc_attr($val); ?>" ><?php echo $val; ?></option><?php |
530 | - } |
|
531 | - } |
|
532 | - ?> |
|
530 | + } |
|
531 | + } |
|
532 | + ?> |
|
533 | 533 | </select> |
534 | 534 | |
535 | 535 | <?php |
536 | - $html = ob_get_clean(); |
|
536 | + $html = ob_get_clean(); |
|
537 | 537 | |
538 | 538 | /** |
539 | 539 | * Filter the price packages list. |
540 | 540 | * |
541 | 541 | * Filter the price packages list in custom field form in admin |
542 | - * custom fields settings. |
|
542 | + * custom fields settings. |
|
543 | 543 | * |
544 | 544 | * @since 1.0.0 |
545 | 545 | * |
@@ -548,25 +548,25 @@ discard block |
||
548 | 548 | */ |
549 | 549 | echo $html = apply_filters('geodir_packages_list_on_custom_fields', $html, $field_info); |
550 | 550 | |
551 | - ?> |
|
551 | + ?> |
|
552 | 552 | |
553 | 553 | |
554 | 554 | |
555 | 555 | <?php |
556 | 556 | |
557 | - // is_required |
|
558 | - if(has_filter("geodir_cfa_is_required_{$field_type}")){ |
|
557 | + // is_required |
|
558 | + if(has_filter("geodir_cfa_is_required_{$field_type}")){ |
|
559 | 559 | |
560 | - echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info); |
|
560 | + echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info); |
|
561 | 561 | |
562 | - }else{ |
|
563 | - $value = ''; |
|
564 | - if (isset($field_info->is_required)) { |
|
565 | - $value = esc_attr($field_info->is_required); |
|
566 | - }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){ |
|
567 | - $value = $cf['defaults']['is_required']; |
|
568 | - } |
|
569 | - ?> |
|
562 | + }else{ |
|
563 | + $value = ''; |
|
564 | + if (isset($field_info->is_required)) { |
|
565 | + $value = esc_attr($field_info->is_required); |
|
566 | + }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){ |
|
567 | + $value = $cf['defaults']['is_required']; |
|
568 | + } |
|
569 | + ?> |
|
570 | 570 | <li> |
571 | 571 | <label for="is_required" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Is required :', 'geodirectory'); ?> |
572 | 572 | <div class="gdcf-tooltip"> |
@@ -578,14 +578,14 @@ discard block |
||
578 | 578 | |
579 | 579 | <input type="radio" id="is_required_yes<?php echo $radio_id;?>" name="is_required" class="gdri-enabled" value="1" |
580 | 580 | <?php if ($value == '1') { |
581 | - echo 'checked'; |
|
582 | - } ?>/> |
|
581 | + echo 'checked'; |
|
582 | + } ?>/> |
|
583 | 583 | <label onclick="show_hide_radio(this,'show','cf-is-required-msg');" for="is_required_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
584 | 584 | |
585 | 585 | <input type="radio" id="is_required_no<?php echo $radio_id;?>" name="is_required" class="gdri-disabled" value="0" |
586 | 586 | <?php if ($value == '0' || !$value) { |
587 | - echo 'checked'; |
|
588 | - } ?>/> |
|
587 | + echo 'checked'; |
|
588 | + } ?>/> |
|
589 | 589 | <label onclick="show_hide_radio(this,'hide','cf-is-required-msg');" for="is_required_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
590 | 590 | |
591 | 591 | </div> |
@@ -593,21 +593,21 @@ discard block |
||
593 | 593 | </li> |
594 | 594 | |
595 | 595 | <?php |
596 | - } |
|
596 | + } |
|
597 | 597 | |
598 | - // required_msg |
|
599 | - if(has_filter("geodir_cfa_required_msg_{$field_type}")){ |
|
598 | + // required_msg |
|
599 | + if(has_filter("geodir_cfa_required_msg_{$field_type}")){ |
|
600 | 600 | |
601 | - echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info); |
|
601 | + echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info); |
|
602 | 602 | |
603 | - }else{ |
|
604 | - $value = ''; |
|
605 | - if (isset($field_info->required_msg)) { |
|
606 | - $value = esc_attr($field_info->required_msg); |
|
607 | - }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){ |
|
608 | - $value = $cf['defaults']['required_msg']; |
|
609 | - } |
|
610 | - ?> |
|
603 | + }else{ |
|
604 | + $value = ''; |
|
605 | + if (isset($field_info->required_msg)) { |
|
606 | + $value = esc_attr($field_info->required_msg); |
|
607 | + }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){ |
|
608 | + $value = $cf['defaults']['required_msg']; |
|
609 | + } |
|
610 | + ?> |
|
611 | 611 | <li class="cf-is-required-msg" <?php if ((isset($field_info->is_required) && $field_info->is_required == '0') || !isset($field_info->is_required)) {echo "style='display:none;'";}?>> |
612 | 612 | <label for="required_msg" class="gd-cf-tooltip-wrap"> |
613 | 613 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Required message:', 'geodirectory'); ?> |
@@ -621,38 +621,38 @@ discard block |
||
621 | 621 | </div> |
622 | 622 | </li> |
623 | 623 | <?php |
624 | - } |
|
624 | + } |
|
625 | 625 | |
626 | 626 | |
627 | - // required_msg |
|
628 | - if(has_filter("geodir_cfa_validation_pattern_{$field_type}")){ |
|
627 | + // required_msg |
|
628 | + if(has_filter("geodir_cfa_validation_pattern_{$field_type}")){ |
|
629 | 629 | |
630 | - echo apply_filters("geodir_cfa_validation_pattern_{$field_type}",'',$result_str,$cf,$field_info); |
|
630 | + echo apply_filters("geodir_cfa_validation_pattern_{$field_type}",'',$result_str,$cf,$field_info); |
|
631 | 631 | |
632 | - } |
|
632 | + } |
|
633 | 633 | |
634 | 634 | |
635 | - // extra_fields |
|
636 | - if(has_filter("geodir_cfa_extra_fields_{$field_type}")){ |
|
635 | + // extra_fields |
|
636 | + if(has_filter("geodir_cfa_extra_fields_{$field_type}")){ |
|
637 | 637 | |
638 | - echo apply_filters("geodir_cfa_extra_fields_{$field_type}",'',$result_str,$cf,$field_info); |
|
638 | + echo apply_filters("geodir_cfa_extra_fields_{$field_type}",'',$result_str,$cf,$field_info); |
|
639 | 639 | |
640 | - } |
|
640 | + } |
|
641 | 641 | |
642 | 642 | |
643 | - // field_icon |
|
644 | - if(has_filter("geodir_cfa_field_icon_{$field_type}")){ |
|
643 | + // field_icon |
|
644 | + if(has_filter("geodir_cfa_field_icon_{$field_type}")){ |
|
645 | 645 | |
646 | - echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info); |
|
646 | + echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info); |
|
647 | 647 | |
648 | - }else{ |
|
649 | - $value = ''; |
|
650 | - if (isset($field_info->field_icon)) { |
|
651 | - $value = esc_attr($field_info->field_icon); |
|
652 | - }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){ |
|
653 | - $value = $cf['defaults']['field_icon']; |
|
654 | - } |
|
655 | - ?> |
|
648 | + }else{ |
|
649 | + $value = ''; |
|
650 | + if (isset($field_info->field_icon)) { |
|
651 | + $value = esc_attr($field_info->field_icon); |
|
652 | + }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){ |
|
653 | + $value = $cf['defaults']['field_icon']; |
|
654 | + } |
|
655 | + ?> |
|
656 | 656 | <li> |
657 | 657 | <h3><?php echo __('Custom css', 'geodirectory'); ?></h3> |
658 | 658 | |
@@ -670,22 +670,22 @@ discard block |
||
670 | 670 | |
671 | 671 | </li> |
672 | 672 | <?php |
673 | - } |
|
673 | + } |
|
674 | 674 | |
675 | 675 | |
676 | - // css_class |
|
677 | - if(has_filter("geodir_cfa_css_class_{$field_type}")){ |
|
676 | + // css_class |
|
677 | + if(has_filter("geodir_cfa_css_class_{$field_type}")){ |
|
678 | 678 | |
679 | - echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info); |
|
679 | + echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info); |
|
680 | 680 | |
681 | - }else{ |
|
682 | - $value = ''; |
|
683 | - if (isset($field_info->css_class)) { |
|
684 | - $value = esc_attr($field_info->css_class); |
|
685 | - }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){ |
|
686 | - $value = $cf['defaults']['css_class']; |
|
687 | - } |
|
688 | - ?> |
|
681 | + }else{ |
|
682 | + $value = ''; |
|
683 | + if (isset($field_info->css_class)) { |
|
684 | + $value = esc_attr($field_info->css_class); |
|
685 | + }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){ |
|
686 | + $value = $cf['defaults']['css_class']; |
|
687 | + } |
|
688 | + ?> |
|
689 | 689 | <li> |
690 | 690 | |
691 | 691 | <label for="css_class" class="gd-cf-tooltip-wrap"> |
@@ -698,47 +698,47 @@ discard block |
||
698 | 698 | <div class="gd-cf-input-wrap"> |
699 | 699 | <input type="text" name="css_class" id="css_class" |
700 | 700 | value="<?php if (isset($field_info->css_class)) { |
701 | - echo esc_attr($field_info->css_class); |
|
702 | - }?>"/> |
|
701 | + echo esc_attr($field_info->css_class); |
|
702 | + }?>"/> |
|
703 | 703 | </div> |
704 | 704 | </li> |
705 | 705 | <?php |
706 | - } |
|
706 | + } |
|
707 | 707 | |
708 | 708 | |
709 | - // cat_sort |
|
710 | - if(has_filter("geodir_cfa_cat_sort_{$field_type}")){ |
|
709 | + // cat_sort |
|
710 | + if(has_filter("geodir_cfa_cat_sort_{$field_type}")){ |
|
711 | 711 | |
712 | - echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info); |
|
712 | + echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info); |
|
713 | 713 | |
714 | - }else{ |
|
715 | - $value = ''; |
|
716 | - $hide_cat_sort =''; |
|
717 | - if (isset($field_info->cat_sort)) { |
|
718 | - $value = esc_attr($field_info->cat_sort); |
|
719 | - }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){ |
|
720 | - $value = $cf['defaults']['cat_sort']; |
|
721 | - $hide_cat_sort = ($value===false) ? "style='display:none;'" : ''; |
|
722 | - } |
|
714 | + }else{ |
|
715 | + $value = ''; |
|
716 | + $hide_cat_sort =''; |
|
717 | + if (isset($field_info->cat_sort)) { |
|
718 | + $value = esc_attr($field_info->cat_sort); |
|
719 | + }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){ |
|
720 | + $value = $cf['defaults']['cat_sort']; |
|
721 | + $hide_cat_sort = ($value===false) ? "style='display:none;'" : ''; |
|
722 | + } |
|
723 | 723 | |
724 | - $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']===false) ? "style='display:none;'" : ''; |
|
725 | - ?> |
|
724 | + $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']===false) ? "style='display:none;'" : ''; |
|
725 | + ?> |
|
726 | 726 | <li <?php echo $hide_cat_sort ;?>> |
727 | 727 | <h3><?php |
728 | - /** |
|
729 | - * Filter the section title. |
|
730 | - * |
|
731 | - * Filter the section title in custom field form in admin |
|
732 | - * custom fields settings. |
|
733 | - * |
|
734 | - * @since 1.0.0 |
|
735 | - * |
|
736 | - * @param string $title Title of the section. |
|
737 | - * @param string $field_type Current field type. |
|
738 | - */ |
|
739 | - echo apply_filters('geodir_advance_custom_fields_heading', __('Posts sort options', 'geodirectory'), $field_type); |
|
740 | - |
|
741 | - ?></h3> |
|
728 | + /** |
|
729 | + * Filter the section title. |
|
730 | + * |
|
731 | + * Filter the section title in custom field form in admin |
|
732 | + * custom fields settings. |
|
733 | + * |
|
734 | + * @since 1.0.0 |
|
735 | + * |
|
736 | + * @param string $title Title of the section. |
|
737 | + * @param string $field_type Current field type. |
|
738 | + */ |
|
739 | + echo apply_filters('geodir_advance_custom_fields_heading', __('Posts sort options', 'geodirectory'), $field_type); |
|
740 | + |
|
741 | + ?></h3> |
|
742 | 742 | <label for="cat_sort" class="gd-cf-tooltip-wrap"> |
743 | 743 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Include this field in sorting options :', 'geodirectory'); ?> |
744 | 744 | <div class="gdcf-tooltip"> |
@@ -750,42 +750,42 @@ discard block |
||
750 | 750 | |
751 | 751 | <input type="radio" id="cat_sort_yes<?php echo $radio_id;?>" name="cat_sort" class="gdri-enabled" value="1" |
752 | 752 | <?php if ($value == '1') { |
753 | - echo 'checked'; |
|
754 | - } ?>/> |
|
753 | + echo 'checked'; |
|
754 | + } ?>/> |
|
755 | 755 | <label for="cat_sort_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
756 | 756 | |
757 | 757 | <input type="radio" id="cat_sort_no<?php echo $radio_id;?>" name="cat_sort" class="gdri-disabled" value="0" |
758 | 758 | <?php if (!$value) { |
759 | - echo 'checked'; |
|
760 | - } ?>/> |
|
759 | + echo 'checked'; |
|
760 | + } ?>/> |
|
761 | 761 | <label for="cat_sort_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
762 | 762 | |
763 | 763 | </div> |
764 | 764 | </li> |
765 | 765 | <?php |
766 | - } |
|
767 | - |
|
768 | - |
|
769 | - |
|
770 | - switch ($field_type): |
|
771 | - case 'html': |
|
772 | - case 'file': |
|
773 | - case 'url': |
|
774 | - case 'fieldset': |
|
775 | - break; |
|
776 | - default: |
|
777 | - |
|
778 | - /** |
|
779 | - * Called at the end of the advanced custom fields settings page loop. |
|
780 | - * |
|
781 | - * Can be used to add or deal with different settings types. |
|
782 | - * |
|
783 | - * @since 1.0.0 |
|
784 | - * @since 1.6.6 $cf param added. |
|
785 | - * @param object $field_info The current fields info. |
|
786 | - * @param array $cf The custom field settings |
|
787 | - */ |
|
788 | - do_action('geodir_advance_custom_fields', $field_info,$cf);?> |
|
766 | + } |
|
767 | + |
|
768 | + |
|
769 | + |
|
770 | + switch ($field_type): |
|
771 | + case 'html': |
|
772 | + case 'file': |
|
773 | + case 'url': |
|
774 | + case 'fieldset': |
|
775 | + break; |
|
776 | + default: |
|
777 | + |
|
778 | + /** |
|
779 | + * Called at the end of the advanced custom fields settings page loop. |
|
780 | + * |
|
781 | + * Can be used to add or deal with different settings types. |
|
782 | + * |
|
783 | + * @since 1.0.0 |
|
784 | + * @since 1.6.6 $cf param added. |
|
785 | + * @param object $field_info The current fields info. |
|
786 | + * @param array $cf The custom field settings |
|
787 | + */ |
|
788 | + do_action('geodir_advance_custom_fields', $field_info,$cf);?> |
|
789 | 789 | |
790 | 790 | |
791 | 791 | <?php endswitch; ?> |
@@ -39,12 +39,12 @@ discard block |
||
39 | 39 | $cf = (isset($cf_arr[$field_type_key])) ? $cf_arr[$field_type_key] : ''; |
40 | 40 | |
41 | 41 | |
42 | -if(isset($field_info->extra_fields)){$extra_fields = $field_info->extra_fields;} |
|
42 | +if (isset($field_info->extra_fields)) {$extra_fields = $field_info->extra_fields; } |
|
43 | 43 | $field_info = stripslashes_deep($field_info); // strip slashes from labels |
44 | -if(isset($field_info->extra_fields)){$field_info->extra_fields = $extra_fields;} |
|
44 | +if (isset($field_info->extra_fields)) {$field_info->extra_fields = $extra_fields; } |
|
45 | 45 | |
46 | 46 | |
47 | -$nonce = wp_create_nonce('custom_fields_' . $result_str); |
|
47 | +$nonce = wp_create_nonce('custom_fields_'.$result_str); |
|
48 | 48 | |
49 | 49 | $field_admin_title = ''; |
50 | 50 | if (isset($field_info->admin_title)) |
@@ -69,15 +69,15 @@ discard block |
||
69 | 69 | |
70 | 70 | if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) { |
71 | 71 | $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>'; |
72 | -}elseif(isset($cf['icon']) && $cf['icon']){ |
|
72 | +}elseif (isset($cf['icon']) && $cf['icon']) { |
|
73 | 73 | $field_icon = '<b style="background-image: url("'.$cf['icon'].'")"></b>'; |
74 | -}else{ |
|
74 | +} else { |
|
75 | 75 | $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>'; |
76 | 76 | } |
77 | 77 | |
78 | -if(isset($cf['name']) && $cf['name']){ |
|
78 | +if (isset($cf['name']) && $cf['name']) { |
|
79 | 79 | $field_type_name = $cf['name']; |
80 | -}else{ |
|
80 | +} else { |
|
81 | 81 | $field_type_name = $field_type; |
82 | 82 | } |
83 | 83 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | ondblclick="show_hide('field_frm<?php echo $result_str; ?>')"> |
89 | 89 | <?php |
90 | 90 | |
91 | - $nonce = wp_create_nonce('custom_fields_' . $result_str); |
|
91 | + $nonce = wp_create_nonce('custom_fields_'.$result_str); |
|
92 | 92 | ?> |
93 | 93 | |
94 | 94 | <?php if ($default): ?> |
@@ -103,12 +103,12 @@ discard block |
||
103 | 103 | <i class="fa fa-long-arrow-left " aria-hidden="true"></i> |
104 | 104 | <i class="fa fa-long-arrow-right " aria-hidden="true"></i> |
105 | 105 | <b style="cursor:pointer;" |
106 | - onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory') . ' ' . $field_admin_title);?></b> |
|
106 | + onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory').' '.$field_admin_title); ?></b> |
|
107 | 107 | <?php |
108 | 108 | } else {echo $field_icon; |
109 | 109 | ?> |
110 | 110 | <b style="cursor:pointer;" |
111 | - onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(' ' . $field_admin_title . ' (' . $field_type_name . ')');?></b> |
|
111 | + onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(' '.$field_admin_title.' ('.$field_type_name.')'); ?></b> |
|
112 | 112 | <?php |
113 | 113 | } |
114 | 114 | ?> |
@@ -131,43 +131,43 @@ discard block |
||
131 | 131 | } ?>"/> |
132 | 132 | <input type="hidden" name="is_active" id="is_active" value="1"/> |
133 | 133 | |
134 | - <input type="hidden" name="is_default" value="<?php echo isset($field_info->is_default) ? $field_info->is_default : '';?>" /><?php // show in sidebar value?> |
|
135 | - <input type="hidden" name="show_on_listing" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : '';?>" /> |
|
136 | - <input type="hidden" name="show_on_detail" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : '';?>" /> |
|
137 | - <input type="hidden" name="show_as_tab" value="<?php echo isset($field_info->show_as_tab) ? $field_info->show_as_tab : '';?>" /> |
|
134 | + <input type="hidden" name="is_default" value="<?php echo isset($field_info->is_default) ? $field_info->is_default : ''; ?>" /><?php // show in sidebar value?> |
|
135 | + <input type="hidden" name="show_on_listing" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : ''; ?>" /> |
|
136 | + <input type="hidden" name="show_on_detail" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : ''; ?>" /> |
|
137 | + <input type="hidden" name="show_as_tab" value="<?php echo isset($field_info->show_as_tab) ? $field_info->show_as_tab : ''; ?>" /> |
|
138 | 138 | |
139 | 139 | <ul class="widefat post fixed" border="0" style="width:100%;"> |
140 | 140 | |
141 | 141 | <?php |
142 | 142 | |
143 | 143 | // data_type |
144 | - if(has_filter("geodir_cfa_data_type_{$field_type}")){ |
|
144 | + if (has_filter("geodir_cfa_data_type_{$field_type}")) { |
|
145 | 145 | |
146 | - echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info); |
|
146 | + echo apply_filters("geodir_cfa_data_type_{$field_type}", '', $result_str, $cf, $field_info); |
|
147 | 147 | |
148 | - }else{ |
|
148 | + } else { |
|
149 | 149 | $value = ''; |
150 | 150 | if (isset($field_info->data_type)) { |
151 | 151 | $value = esc_attr($field_info->data_type); |
152 | - }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){ |
|
152 | + }elseif (isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']) { |
|
153 | 153 | $value = $cf['defaults']['data_type']; |
154 | 154 | } |
155 | 155 | ?> |
156 | - <input type="hidden" name="data_type" id="data_type" value="<?php echo $value;?>"/> |
|
156 | + <input type="hidden" name="data_type" id="data_type" value="<?php echo $value; ?>"/> |
|
157 | 157 | <?php |
158 | 158 | } |
159 | 159 | |
160 | 160 | |
161 | 161 | // admin_title |
162 | - if(has_filter("geodir_cfa_admin_title_{$field_type}")){ |
|
162 | + if (has_filter("geodir_cfa_admin_title_{$field_type}")) { |
|
163 | 163 | |
164 | - echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info); |
|
164 | + echo apply_filters("geodir_cfa_admin_title_{$field_type}", '', $result_str, $cf, $field_info); |
|
165 | 165 | |
166 | - }else{ |
|
166 | + } else { |
|
167 | 167 | $value = ''; |
168 | 168 | if (isset($field_info->admin_title)) { |
169 | 169 | $value = esc_attr($field_info->admin_title); |
170 | - }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){ |
|
170 | + }elseif (isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']) { |
|
171 | 171 | $value = $cf['defaults']['admin_title']; |
172 | 172 | } |
173 | 173 | ?> |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | </label> |
181 | 181 | <div class="gd-cf-input-wrap"> |
182 | 182 | <input type="text" name="admin_title" id="admin_title" |
183 | - value="<?php echo $value;?>"/> |
|
183 | + value="<?php echo $value; ?>"/> |
|
184 | 184 | </div> |
185 | 185 | </li> |
186 | 186 | <?php |
@@ -188,15 +188,15 @@ discard block |
||
188 | 188 | |
189 | 189 | |
190 | 190 | // site_title |
191 | - if(has_filter("geodir_cfa_site_title_{$field_type}")){ |
|
191 | + if (has_filter("geodir_cfa_site_title_{$field_type}")) { |
|
192 | 192 | |
193 | - echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info); |
|
193 | + echo apply_filters("geodir_cfa_site_title_{$field_type}", '', $result_str, $cf, $field_info); |
|
194 | 194 | |
195 | - }else{ |
|
195 | + } else { |
|
196 | 196 | $value = ''; |
197 | 197 | if (isset($field_info->site_title)) { |
198 | 198 | $value = esc_attr($field_info->site_title); |
199 | - }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){ |
|
199 | + }elseif (isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']) { |
|
200 | 200 | $value = $cf['defaults']['site_title']; |
201 | 201 | } |
202 | 202 | ?> |
@@ -216,15 +216,15 @@ discard block |
||
216 | 216 | |
217 | 217 | |
218 | 218 | // admin_desc |
219 | - if(has_filter("geodir_cfa_admin_desc_{$field_type}")){ |
|
219 | + if (has_filter("geodir_cfa_admin_desc_{$field_type}")) { |
|
220 | 220 | |
221 | - echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info); |
|
221 | + echo apply_filters("geodir_cfa_admin_desc_{$field_type}", '', $result_str, $cf, $field_info); |
|
222 | 222 | |
223 | - }else{ |
|
223 | + } else { |
|
224 | 224 | $value = ''; |
225 | 225 | if (isset($field_info->admin_desc)) { |
226 | 226 | $value = esc_attr($field_info->admin_desc); |
227 | - }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){ |
|
227 | + }elseif (isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']) { |
|
228 | 228 | $value = $cf['defaults']['admin_desc']; |
229 | 229 | } |
230 | 230 | ?> |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | </div> |
236 | 236 | </label> |
237 | 237 | <div class="gd-cf-input-wrap"> |
238 | - <input type="text" name="admin_desc" id="admin_desc" value="<?php echo $value;?>"/> |
|
238 | + <input type="text" name="admin_desc" id="admin_desc" value="<?php echo $value; ?>"/> |
|
239 | 239 | </div> |
240 | 240 | </li> |
241 | 241 | <?php |
@@ -244,26 +244,26 @@ discard block |
||
244 | 244 | |
245 | 245 | |
246 | 246 | // htmlvar_name |
247 | - if(has_filter("geodir_cfa_htmlvar_name_{$field_type}")){ |
|
247 | + if (has_filter("geodir_cfa_htmlvar_name_{$field_type}")) { |
|
248 | 248 | |
249 | - echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info); |
|
249 | + echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}", '', $result_str, $cf, $field_info); |
|
250 | 250 | |
251 | - }else{ |
|
251 | + } else { |
|
252 | 252 | $value = ''; |
253 | 253 | if (isset($field_info->htmlvar_name)) { |
254 | 254 | $value = esc_attr($field_info->htmlvar_name); |
255 | - }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){ |
|
255 | + }elseif (isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']) { |
|
256 | 256 | $value = $cf['defaults']['htmlvar_name']; |
257 | 257 | } |
258 | 258 | ?> |
259 | 259 | <li> |
260 | - <label for="htmlvar_name" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('HTML variable name :', 'geodirectory');?> |
|
260 | + <label for="htmlvar_name" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('HTML variable name :', 'geodirectory'); ?> |
|
261 | 261 | <div class="gdcf-tooltip"> |
262 | 262 | <?php _e('This is a unique identifier used in the HTML, it MUST NOT contain spaces or special characters.', 'geodirectory'); ?> |
263 | 263 | </div> |
264 | 264 | </label> |
265 | 265 | <div class="gd-cf-input-wrap"> |
266 | - <input type="text" name="htmlvar_name" id="htmlvar_name" pattern="[a-zA-Z0-9]+" title="<?php _e('Must not contain spaces or special characters', 'geodirectory');?>" |
|
266 | + <input type="text" name="htmlvar_name" id="htmlvar_name" pattern="[a-zA-Z0-9]+" title="<?php _e('Must not contain spaces or special characters', 'geodirectory'); ?>" |
|
267 | 267 | value="<?php if ($value) { |
268 | 268 | echo preg_replace('/geodir_/', '', $value, 1); |
269 | 269 | }?>" <?php if ($default) { |
@@ -276,15 +276,15 @@ discard block |
||
276 | 276 | |
277 | 277 | |
278 | 278 | // is_active |
279 | - if(has_filter("geodir_cfa_is_active_{$field_type}")){ |
|
279 | + if (has_filter("geodir_cfa_is_active_{$field_type}")) { |
|
280 | 280 | |
281 | - echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info); |
|
281 | + echo apply_filters("geodir_cfa_is_active_{$field_type}", '', $result_str, $cf, $field_info); |
|
282 | 282 | |
283 | - }else{ |
|
283 | + } else { |
|
284 | 284 | $value = ''; |
285 | 285 | if (isset($field_info->is_active)) { |
286 | 286 | $value = esc_attr($field_info->is_active); |
287 | - }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){ |
|
287 | + }elseif (isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']) { |
|
288 | 288 | $value = $cf['defaults']['is_active']; |
289 | 289 | } |
290 | 290 | ?> |
@@ -296,17 +296,17 @@ discard block |
||
296 | 296 | </label> |
297 | 297 | <div class="gd-cf-input-wrap gd-switch"> |
298 | 298 | |
299 | - <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled" value="1" |
|
299 | + <input type="radio" id="is_active_yes<?php echo $radio_id; ?>" name="is_active" class="gdri-enabled" value="1" |
|
300 | 300 | <?php if ($value == '1') { |
301 | 301 | echo 'checked'; |
302 | 302 | } ?>/> |
303 | - <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
|
303 | + <label for="is_active_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
|
304 | 304 | |
305 | - <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0" |
|
305 | + <input type="radio" id="is_active_no<?php echo $radio_id; ?>" name="is_active" class="gdri-disabled" value="0" |
|
306 | 306 | <?php if ($value == '0' || !$value) { |
307 | 307 | echo 'checked'; |
308 | 308 | } ?>/> |
309 | - <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
|
309 | + <label for="is_active_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
|
310 | 310 | |
311 | 311 | </div> |
312 | 312 | </li> |
@@ -315,15 +315,15 @@ discard block |
||
315 | 315 | |
316 | 316 | |
317 | 317 | // for_admin_use |
318 | - if(has_filter("geodir_cfa_for_admin_use_{$field_type}")){ |
|
318 | + if (has_filter("geodir_cfa_for_admin_use_{$field_type}")) { |
|
319 | 319 | |
320 | - echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info); |
|
320 | + echo apply_filters("geodir_cfa_for_admin_use_{$field_type}", '', $result_str, $cf, $field_info); |
|
321 | 321 | |
322 | - }else{ |
|
322 | + } else { |
|
323 | 323 | $value = ''; |
324 | 324 | if (isset($field_info->for_admin_use)) { |
325 | 325 | $value = esc_attr($field_info->for_admin_use); |
326 | - }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){ |
|
326 | + }elseif (isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']) { |
|
327 | 327 | $value = $cf['defaults']['for_admin_use']; |
328 | 328 | } |
329 | 329 | ?> |
@@ -335,17 +335,17 @@ discard block |
||
335 | 335 | </label> |
336 | 336 | <div class="gd-cf-input-wrap gd-switch"> |
337 | 337 | |
338 | - <input type="radio" id="for_admin_use_yes<?php echo $radio_id;?>" name="for_admin_use" class="gdri-enabled" value="1" |
|
338 | + <input type="radio" id="for_admin_use_yes<?php echo $radio_id; ?>" name="for_admin_use" class="gdri-enabled" value="1" |
|
339 | 339 | <?php if ($value == '1') { |
340 | 340 | echo 'checked'; |
341 | 341 | } ?>/> |
342 | - <label for="for_admin_use_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
|
342 | + <label for="for_admin_use_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
|
343 | 343 | |
344 | - <input type="radio" id="for_admin_use_no<?php echo $radio_id;?>" name="for_admin_use" class="gdri-disabled" value="0" |
|
344 | + <input type="radio" id="for_admin_use_no<?php echo $radio_id; ?>" name="for_admin_use" class="gdri-disabled" value="0" |
|
345 | 345 | <?php if ($value == '0' || !$value) { |
346 | 346 | echo 'checked'; |
347 | 347 | } ?>/> |
348 | - <label for="for_admin_use_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
|
348 | + <label for="for_admin_use_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
|
349 | 349 | |
350 | 350 | </div> |
351 | 351 | </li> |
@@ -354,20 +354,20 @@ discard block |
||
354 | 354 | |
355 | 355 | |
356 | 356 | // default_value |
357 | - if(has_filter("geodir_cfa_default_value_{$field_type}")){ |
|
357 | + if (has_filter("geodir_cfa_default_value_{$field_type}")) { |
|
358 | 358 | |
359 | - echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info); |
|
359 | + echo apply_filters("geodir_cfa_default_value_{$field_type}", '', $result_str, $cf, $field_info); |
|
360 | 360 | |
361 | - }else{ |
|
361 | + } else { |
|
362 | 362 | $value = ''; |
363 | 363 | if (isset($field_info->default_value)) { |
364 | 364 | $value = esc_attr($field_info->default_value); |
365 | - }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){ |
|
365 | + }elseif (isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']) { |
|
366 | 366 | $value = $cf['defaults']['default_value']; |
367 | 367 | } |
368 | 368 | ?> |
369 | 369 | <li> |
370 | - <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory');?> |
|
370 | + <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory'); ?> |
|
371 | 371 | <div class="gdcf-tooltip"> |
372 | 372 | <?php |
373 | 373 | if ($field_type == 'checkbox') { |
@@ -384,12 +384,12 @@ discard block |
||
384 | 384 | <?php if ($field_type == 'checkbox') { ?> |
385 | 385 | <select name="default_value" id="default_value"> |
386 | 386 | <option value=""><?php _e('Unchecked', 'geodirectory'); ?></option> |
387 | - <option value="1" <?php selected(true, (int)$value === 1);?>><?php _e('Checked', 'geodirectory'); ?></option> |
|
387 | + <option value="1" <?php selected(true, (int) $value === 1); ?>><?php _e('Checked', 'geodirectory'); ?></option> |
|
388 | 388 | </select> |
389 | 389 | <?php } else if ($field_type == 'email') { ?> |
390 | - <input type="email" name="default_value" placeholder="<?php _e('[email protected]', 'geodirectory') ;?>" id="default_value" value="<?php echo esc_attr($value);?>" /><br/> |
|
390 | + <input type="email" name="default_value" placeholder="<?php _e('[email protected]', 'geodirectory'); ?>" id="default_value" value="<?php echo esc_attr($value); ?>" /><br/> |
|
391 | 391 | <?php } else { ?> |
392 | - <input type="text" name="default_value" id="default_value" value="<?php echo esc_attr($value);?>" /><br/> |
|
392 | + <input type="text" name="default_value" id="default_value" value="<?php echo esc_attr($value); ?>" /><br/> |
|
393 | 393 | <?php } ?> |
394 | 394 | </div> |
395 | 395 | </li> |
@@ -398,15 +398,15 @@ discard block |
||
398 | 398 | |
399 | 399 | |
400 | 400 | // show_in |
401 | - if(has_filter("geodir_cfa_show_in_{$field_type}")){ |
|
401 | + if (has_filter("geodir_cfa_show_in_{$field_type}")) { |
|
402 | 402 | |
403 | - echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info); |
|
403 | + echo apply_filters("geodir_cfa_show_in_{$field_type}", '', $result_str, $cf, $field_info); |
|
404 | 404 | |
405 | - }else{ |
|
405 | + } else { |
|
406 | 406 | $value = ''; |
407 | 407 | if (isset($field_info->show_in)) { |
408 | 408 | $value = esc_attr($field_info->show_in); |
409 | - }elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){ |
|
409 | + }elseif (isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']) { |
|
410 | 410 | $value = esc_attr($cf['defaults']['show_in']); |
411 | 411 | } |
412 | 412 | ?> |
@@ -439,18 +439,18 @@ discard block |
||
439 | 439 | * @param object $field_info The field being displayed info. |
440 | 440 | * @param string $field_info The type of field. |
441 | 441 | */ |
442 | - $show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info,$field_type); |
|
442 | + $show_in_locations = apply_filters('geodir_show_in_locations', $show_in_locations, $field_info, $field_type); |
|
443 | 443 | |
444 | 444 | |
445 | 445 | // remove some locations for some field types |
446 | 446 | |
447 | 447 | // don't show new tab option for some types |
448 | - if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) { |
|
449 | - }else{ |
|
448 | + if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file', 'address', 'taxonomy'))) { |
|
449 | + } else { |
|
450 | 450 | unset($show_in_locations['[owntab]']); |
451 | 451 | } |
452 | 452 | |
453 | - if(!$display_on_listing){ |
|
453 | + if (!$display_on_listing) { |
|
454 | 454 | unset($show_in_locations['[listings]']); |
455 | 455 | } |
456 | 456 | |
@@ -464,17 +464,17 @@ discard block |
||
464 | 464 | option-ajaxchosen="false"> |
465 | 465 | <?php |
466 | 466 | |
467 | - $show_in_values = explode(',',$value); |
|
467 | + $show_in_values = explode(',', $value); |
|
468 | 468 | |
469 | - foreach( $show_in_locations as $key => $val){ |
|
469 | + foreach ($show_in_locations as $key => $val) { |
|
470 | 470 | $selected = ''; |
471 | 471 | |
472 | - if(is_array($show_in_values) && in_array($key,$show_in_values ) ){ |
|
472 | + if (is_array($show_in_values) && in_array($key, $show_in_values)) { |
|
473 | 473 | $selected = 'selected'; |
474 | 474 | } |
475 | 475 | |
476 | 476 | ?> |
477 | - <option value="<?php echo $key;?>" <?php echo $selected;?>><?php echo $val;?></option> |
|
477 | + <option value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $val; ?></option> |
|
478 | 478 | <?php |
479 | 479 | } |
480 | 480 | ?> |
@@ -486,9 +486,9 @@ discard block |
||
486 | 486 | |
487 | 487 | |
488 | 488 | // advanced_editor |
489 | - if(has_filter("geodir_cfa_advanced_editor_{$field_type}")){ |
|
489 | + if (has_filter("geodir_cfa_advanced_editor_{$field_type}")) { |
|
490 | 490 | |
491 | - echo apply_filters("geodir_cfa_advanced_editor_{$field_type}",'',$result_str,$cf,$field_info); |
|
491 | + echo apply_filters("geodir_cfa_advanced_editor_{$field_type}", '', $result_str, $cf, $field_info); |
|
492 | 492 | |
493 | 493 | } |
494 | 494 | |
@@ -499,10 +499,10 @@ discard block |
||
499 | 499 | |
500 | 500 | |
501 | 501 | <?php // @todo this does not seem to be used for anything, it can be removed or replaced ?> |
502 | - <input type="hidden" name="clabels" id="clabels" value="<?php if (isset($field_info->clabels)) { echo esc_attr($field_info->clabels);} ?>"/> |
|
502 | + <input type="hidden" name="clabels" id="clabels" value="<?php if (isset($field_info->clabels)) { echo esc_attr($field_info->clabels); } ?>"/> |
|
503 | 503 | |
504 | 504 | <?php // we dont need to show the sort order ?> |
505 | - <input type="hidden" readonly="readonly" name="sort_order" id="sort_order" value="<?php if (isset($field_info->sort_order)) { echo esc_attr($field_info->sort_order);} ?>"/> |
|
505 | + <input type="hidden" readonly="readonly" name="sort_order" id="sort_order" value="<?php if (isset($field_info->sort_order)) { echo esc_attr($field_info->sort_order); } ?>"/> |
|
506 | 506 | |
507 | 507 | |
508 | 508 | |
@@ -555,15 +555,15 @@ discard block |
||
555 | 555 | <?php |
556 | 556 | |
557 | 557 | // is_required |
558 | - if(has_filter("geodir_cfa_is_required_{$field_type}")){ |
|
558 | + if (has_filter("geodir_cfa_is_required_{$field_type}")) { |
|
559 | 559 | |
560 | - echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info); |
|
560 | + echo apply_filters("geodir_cfa_is_required_{$field_type}", '', $result_str, $cf, $field_info); |
|
561 | 561 | |
562 | - }else{ |
|
562 | + } else { |
|
563 | 563 | $value = ''; |
564 | 564 | if (isset($field_info->is_required)) { |
565 | 565 | $value = esc_attr($field_info->is_required); |
566 | - }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){ |
|
566 | + }elseif (isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']) { |
|
567 | 567 | $value = $cf['defaults']['is_required']; |
568 | 568 | } |
569 | 569 | ?> |
@@ -576,17 +576,17 @@ discard block |
||
576 | 576 | |
577 | 577 | <div class="gd-cf-input-wrap gd-switch"> |
578 | 578 | |
579 | - <input type="radio" id="is_required_yes<?php echo $radio_id;?>" name="is_required" class="gdri-enabled" value="1" |
|
579 | + <input type="radio" id="is_required_yes<?php echo $radio_id; ?>" name="is_required" class="gdri-enabled" value="1" |
|
580 | 580 | <?php if ($value == '1') { |
581 | 581 | echo 'checked'; |
582 | 582 | } ?>/> |
583 | - <label onclick="show_hide_radio(this,'show','cf-is-required-msg');" for="is_required_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
|
583 | + <label onclick="show_hide_radio(this,'show','cf-is-required-msg');" for="is_required_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
|
584 | 584 | |
585 | - <input type="radio" id="is_required_no<?php echo $radio_id;?>" name="is_required" class="gdri-disabled" value="0" |
|
585 | + <input type="radio" id="is_required_no<?php echo $radio_id; ?>" name="is_required" class="gdri-disabled" value="0" |
|
586 | 586 | <?php if ($value == '0' || !$value) { |
587 | 587 | echo 'checked'; |
588 | 588 | } ?>/> |
589 | - <label onclick="show_hide_radio(this,'hide','cf-is-required-msg');" for="is_required_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
|
589 | + <label onclick="show_hide_radio(this,'hide','cf-is-required-msg');" for="is_required_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
|
590 | 590 | |
591 | 591 | </div> |
592 | 592 | |
@@ -596,19 +596,19 @@ discard block |
||
596 | 596 | } |
597 | 597 | |
598 | 598 | // required_msg |
599 | - if(has_filter("geodir_cfa_required_msg_{$field_type}")){ |
|
599 | + if (has_filter("geodir_cfa_required_msg_{$field_type}")) { |
|
600 | 600 | |
601 | - echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info); |
|
601 | + echo apply_filters("geodir_cfa_required_msg_{$field_type}", '', $result_str, $cf, $field_info); |
|
602 | 602 | |
603 | - }else{ |
|
603 | + } else { |
|
604 | 604 | $value = ''; |
605 | 605 | if (isset($field_info->required_msg)) { |
606 | 606 | $value = esc_attr($field_info->required_msg); |
607 | - }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){ |
|
607 | + }elseif (isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']) { |
|
608 | 608 | $value = $cf['defaults']['required_msg']; |
609 | 609 | } |
610 | 610 | ?> |
611 | - <li class="cf-is-required-msg" <?php if ((isset($field_info->is_required) && $field_info->is_required == '0') || !isset($field_info->is_required)) {echo "style='display:none;'";}?>> |
|
611 | + <li class="cf-is-required-msg" <?php if ((isset($field_info->is_required) && $field_info->is_required == '0') || !isset($field_info->is_required)) {echo "style='display:none;'"; }?>> |
|
612 | 612 | <label for="required_msg" class="gd-cf-tooltip-wrap"> |
613 | 613 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Required message:', 'geodirectory'); ?> |
614 | 614 | <div class="gdcf-tooltip"> |
@@ -625,31 +625,31 @@ discard block |
||
625 | 625 | |
626 | 626 | |
627 | 627 | // required_msg |
628 | - if(has_filter("geodir_cfa_validation_pattern_{$field_type}")){ |
|
628 | + if (has_filter("geodir_cfa_validation_pattern_{$field_type}")) { |
|
629 | 629 | |
630 | - echo apply_filters("geodir_cfa_validation_pattern_{$field_type}",'',$result_str,$cf,$field_info); |
|
630 | + echo apply_filters("geodir_cfa_validation_pattern_{$field_type}", '', $result_str, $cf, $field_info); |
|
631 | 631 | |
632 | 632 | } |
633 | 633 | |
634 | 634 | |
635 | 635 | // extra_fields |
636 | - if(has_filter("geodir_cfa_extra_fields_{$field_type}")){ |
|
636 | + if (has_filter("geodir_cfa_extra_fields_{$field_type}")) { |
|
637 | 637 | |
638 | - echo apply_filters("geodir_cfa_extra_fields_{$field_type}",'',$result_str,$cf,$field_info); |
|
638 | + echo apply_filters("geodir_cfa_extra_fields_{$field_type}", '', $result_str, $cf, $field_info); |
|
639 | 639 | |
640 | 640 | } |
641 | 641 | |
642 | 642 | |
643 | 643 | // field_icon |
644 | - if(has_filter("geodir_cfa_field_icon_{$field_type}")){ |
|
644 | + if (has_filter("geodir_cfa_field_icon_{$field_type}")) { |
|
645 | 645 | |
646 | - echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info); |
|
646 | + echo apply_filters("geodir_cfa_field_icon_{$field_type}", '', $result_str, $cf, $field_info); |
|
647 | 647 | |
648 | - }else{ |
|
648 | + } else { |
|
649 | 649 | $value = ''; |
650 | 650 | if (isset($field_info->field_icon)) { |
651 | 651 | $value = esc_attr($field_info->field_icon); |
652 | - }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){ |
|
652 | + }elseif (isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']) { |
|
653 | 653 | $value = $cf['defaults']['field_icon']; |
654 | 654 | } |
655 | 655 | ?> |
@@ -660,12 +660,12 @@ discard block |
||
660 | 660 | <label for="field_icon" class="gd-cf-tooltip-wrap"> |
661 | 661 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Upload icon :', 'geodirectory'); ?> |
662 | 662 | <div class="gdcf-tooltip"> |
663 | - <?php _e('Upload icon using media and enter its url path, or enter <a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank" >font awesome </a>class eg:"fa fa-home"', 'geodirectory');?> |
|
663 | + <?php _e('Upload icon using media and enter its url path, or enter <a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank" >font awesome </a>class eg:"fa fa-home"', 'geodirectory'); ?> |
|
664 | 664 | </div> |
665 | 665 | </label> |
666 | 666 | <div class="gd-cf-input-wrap"> |
667 | 667 | <input type="text" name="field_icon" id="field_icon" |
668 | - value="<?php echo $value;?>"/> |
|
668 | + value="<?php echo $value; ?>"/> |
|
669 | 669 | </div> |
670 | 670 | |
671 | 671 | </li> |
@@ -674,15 +674,15 @@ discard block |
||
674 | 674 | |
675 | 675 | |
676 | 676 | // css_class |
677 | - if(has_filter("geodir_cfa_css_class_{$field_type}")){ |
|
677 | + if (has_filter("geodir_cfa_css_class_{$field_type}")) { |
|
678 | 678 | |
679 | - echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info); |
|
679 | + echo apply_filters("geodir_cfa_css_class_{$field_type}", '', $result_str, $cf, $field_info); |
|
680 | 680 | |
681 | - }else{ |
|
681 | + } else { |
|
682 | 682 | $value = ''; |
683 | 683 | if (isset($field_info->css_class)) { |
684 | 684 | $value = esc_attr($field_info->css_class); |
685 | - }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){ |
|
685 | + }elseif (isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']) { |
|
686 | 686 | $value = $cf['defaults']['css_class']; |
687 | 687 | } |
688 | 688 | ?> |
@@ -691,8 +691,8 @@ discard block |
||
691 | 691 | <label for="css_class" class="gd-cf-tooltip-wrap"> |
692 | 692 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Css class :', 'geodirectory'); ?> |
693 | 693 | <div class="gdcf-tooltip"> |
694 | - <?php _e('Enter custom css class for field custom style.', 'geodirectory');?> |
|
695 | - <?php if($field_type=='multiselect'){_e('(Enter class `gd-comma-list` to show list as comma separated)', 'geodirectory');}?> |
|
694 | + <?php _e('Enter custom css class for field custom style.', 'geodirectory'); ?> |
|
695 | + <?php if ($field_type == 'multiselect') {_e('(Enter class `gd-comma-list` to show list as comma separated)', 'geodirectory'); }?> |
|
696 | 696 | </div> |
697 | 697 | </label> |
698 | 698 | <div class="gd-cf-input-wrap"> |
@@ -707,23 +707,23 @@ discard block |
||
707 | 707 | |
708 | 708 | |
709 | 709 | // cat_sort |
710 | - if(has_filter("geodir_cfa_cat_sort_{$field_type}")){ |
|
710 | + if (has_filter("geodir_cfa_cat_sort_{$field_type}")) { |
|
711 | 711 | |
712 | - echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info); |
|
712 | + echo apply_filters("geodir_cfa_cat_sort_{$field_type}", '', $result_str, $cf, $field_info); |
|
713 | 713 | |
714 | - }else{ |
|
714 | + } else { |
|
715 | 715 | $value = ''; |
716 | - $hide_cat_sort =''; |
|
716 | + $hide_cat_sort = ''; |
|
717 | 717 | if (isset($field_info->cat_sort)) { |
718 | 718 | $value = esc_attr($field_info->cat_sort); |
719 | - }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){ |
|
719 | + }elseif (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']) { |
|
720 | 720 | $value = $cf['defaults']['cat_sort']; |
721 | - $hide_cat_sort = ($value===false) ? "style='display:none;'" : ''; |
|
721 | + $hide_cat_sort = ($value === false) ? "style='display:none;'" : ''; |
|
722 | 722 | } |
723 | 723 | |
724 | - $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']===false) ? "style='display:none;'" : ''; |
|
724 | + $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort'] === false) ? "style='display:none;'" : ''; |
|
725 | 725 | ?> |
726 | - <li <?php echo $hide_cat_sort ;?>> |
|
726 | + <li <?php echo $hide_cat_sort; ?>> |
|
727 | 727 | <h3><?php |
728 | 728 | /** |
729 | 729 | * Filter the section title. |
@@ -742,23 +742,23 @@ discard block |
||
742 | 742 | <label for="cat_sort" class="gd-cf-tooltip-wrap"> |
743 | 743 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Include this field in sorting options :', 'geodirectory'); ?> |
744 | 744 | <div class="gdcf-tooltip"> |
745 | - <?php _e('Lets you use this filed as a sorting option, set from sorting options above.', 'geodirectory');?> |
|
745 | + <?php _e('Lets you use this filed as a sorting option, set from sorting options above.', 'geodirectory'); ?> |
|
746 | 746 | </div> |
747 | 747 | </label> |
748 | 748 | |
749 | 749 | <div class="gd-cf-input-wrap gd-switch"> |
750 | 750 | |
751 | - <input type="radio" id="cat_sort_yes<?php echo $radio_id;?>" name="cat_sort" class="gdri-enabled" value="1" |
|
751 | + <input type="radio" id="cat_sort_yes<?php echo $radio_id; ?>" name="cat_sort" class="gdri-enabled" value="1" |
|
752 | 752 | <?php if ($value == '1') { |
753 | 753 | echo 'checked'; |
754 | 754 | } ?>/> |
755 | - <label for="cat_sort_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
|
755 | + <label for="cat_sort_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
|
756 | 756 | |
757 | - <input type="radio" id="cat_sort_no<?php echo $radio_id;?>" name="cat_sort" class="gdri-disabled" value="0" |
|
757 | + <input type="radio" id="cat_sort_no<?php echo $radio_id; ?>" name="cat_sort" class="gdri-disabled" value="0" |
|
758 | 758 | <?php if (!$value) { |
759 | 759 | echo 'checked'; |
760 | 760 | } ?>/> |
761 | - <label for="cat_sort_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
|
761 | + <label for="cat_sort_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
|
762 | 762 | |
763 | 763 | </div> |
764 | 764 | </li> |
@@ -785,7 +785,7 @@ discard block |
||
785 | 785 | * @param object $field_info The current fields info. |
786 | 786 | * @param array $cf The custom field settings |
787 | 787 | */ |
788 | - do_action('geodir_advance_custom_fields', $field_info,$cf);?> |
|
788 | + do_action('geodir_advance_custom_fields', $field_info, $cf); ?> |
|
789 | 789 | |
790 | 790 | |
791 | 791 | <?php endswitch; ?> |
@@ -797,10 +797,10 @@ discard block |
||
797 | 797 | <h3></h3> |
798 | 798 | </label> |
799 | 799 | <div class="gd-cf-input-wrap"> |
800 | - <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save','geodirectory'));?>" |
|
800 | + <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save', 'geodirectory')); ?>" |
|
801 | 801 | onclick="save_field('<?php echo esc_attr($result_str); ?>')"/> |
802 | 802 | <?php if (!$default): ?> |
803 | - <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete','geodirectory'));?>" |
|
803 | + <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete', 'geodirectory')); ?>" |
|
804 | 804 | onclick="delete_field('<?php echo esc_attr($result_str); ?>', '<?php echo $nonce; ?>')" |
805 | 805 | class="button"/></a> |
806 | 806 | <?php endif; ?> |
@@ -353,7 +353,7 @@ |
||
353 | 353 | |
354 | 354 | if(!$cpt_left){ |
355 | 355 | $cpt_left = "gd-cpt-flat"; |
356 | - }else{ |
|
356 | + } else{ |
|
357 | 357 | $cpt_left = ''; |
358 | 358 | } |
359 | 359 |
@@ -17,370 +17,370 @@ discard block |
||
17 | 17 | */ |
18 | 18 | function geodir_custom_fields_predefined($post_type=''){ |
19 | 19 | |
20 | - $custom_fields = array(); |
|
21 | - |
|
22 | - |
|
23 | - // price |
|
24 | - $custom_fields['price'] = array( // The key value should be unique and not contain any spaces. |
|
25 | - 'field_type' => 'text', |
|
26 | - 'class' => 'gd-price', |
|
27 | - 'icon' => 'fa fa-usd', |
|
28 | - 'name' => __('Price', 'geodirectory'), |
|
29 | - 'description' => __('Adds a input for a price field. This will let you filter and sort by price.', 'geodirectory'), |
|
30 | - 'defaults' => array( |
|
31 | - 'data_type' => 'FLOAT', |
|
32 | - 'decimal_point' => '2', |
|
33 | - 'admin_title' => 'Price', |
|
34 | - 'site_title' => 'Price', |
|
35 | - 'admin_desc' => 'Enter the price in $ (no currency symbol)', |
|
36 | - 'htmlvar_name' => 'price', |
|
37 | - 'is_active' => true, |
|
38 | - 'for_admin_use' => false, |
|
39 | - 'default_value' => '', |
|
40 | - 'show_in' => '[detail],[listing]', |
|
41 | - 'is_required' => false, |
|
42 | - 'validation_pattern' => '\d+(\.\d{2})?', |
|
43 | - 'validation_msg' => 'Please enter number and decimal only ie: 100.50', |
|
44 | - 'required_msg' => '', |
|
45 | - 'field_icon' => 'fa fa-usd', |
|
46 | - 'css_class' => '', |
|
47 | - 'cat_sort' => true, |
|
48 | - 'cat_filter' => true, |
|
49 | - 'extra_fields' => array( |
|
50 | - 'is_price' => 1, |
|
51 | - 'thousand_separator' => 'comma', |
|
52 | - 'decimal_separator' => 'period', |
|
53 | - 'decimal_display' => 'if', |
|
54 | - 'currency_symbol' => '$', |
|
55 | - 'currency_symbol_placement' => 'left' |
|
56 | - ) |
|
57 | - ) |
|
58 | - ); |
|
59 | - |
|
60 | - // property status |
|
61 | - $custom_fields['property_status'] = array( // The key value should be unique and not contain any spaces. |
|
62 | - 'field_type' => 'select', |
|
63 | - 'class' => 'gd-property-status', |
|
64 | - 'icon' => 'fa fa-home', |
|
65 | - 'name' => __('Property Status', 'geodirectory'), |
|
66 | - 'description' => __('Adds a select input to be able to set the status of a property ie: For Sale, For Rent', 'geodirectory'), |
|
67 | - 'defaults' => array( |
|
68 | - 'data_type' => 'VARCHAR', |
|
69 | - 'admin_title' => 'Property Status', |
|
70 | - 'site_title' => 'Property Status', |
|
71 | - 'admin_desc' => 'Enter the status of the property.', |
|
72 | - 'htmlvar_name' => 'property_status', |
|
73 | - 'is_active' => true, |
|
74 | - 'for_admin_use' => false, |
|
75 | - 'default_value' => '', |
|
76 | - 'show_in' => '[detail],[listing]', |
|
77 | - 'is_required' => true, |
|
78 | - 'option_values' => __('Select Status/,For Sale,For Rent,Sold,Let','geodirectory'), |
|
79 | - 'validation_pattern' => '', |
|
80 | - 'validation_msg' => '', |
|
81 | - 'required_msg' => '', |
|
82 | - 'field_icon' => 'fa fa-home', |
|
83 | - 'css_class' => '', |
|
84 | - 'cat_sort' => true, |
|
85 | - 'cat_filter' => true |
|
86 | - ) |
|
87 | - ); |
|
88 | - |
|
89 | - // property furnishing |
|
90 | - $custom_fields['property_furnishing'] = array( // The key value should be unique and not contain any spaces. |
|
91 | - 'field_type' => 'select', |
|
92 | - 'class' => 'gd-property-furnishing', |
|
93 | - 'icon' => 'fa fa-home', |
|
94 | - 'name' => __('Property Furnishing', 'geodirectory'), |
|
95 | - 'description' => __('Adds a select input to be able to set the furnishing status of a property ie: Unfurnished, Furnished', 'geodirectory'), |
|
96 | - 'defaults' => array( |
|
97 | - 'data_type' => 'VARCHAR', |
|
98 | - 'admin_title' => 'Furnishing', |
|
99 | - 'site_title' => 'Furnishing', |
|
100 | - 'admin_desc' => 'Enter the furnishing status of the property.', |
|
101 | - 'htmlvar_name' => 'property_furnishing', |
|
102 | - 'is_active' => true, |
|
103 | - 'for_admin_use' => false, |
|
104 | - 'default_value' => '', |
|
105 | - 'show_in' => '[detail],[listing]', |
|
106 | - 'is_required' => true, |
|
107 | - 'option_values' => __('Select Status/,Unfurnished,Furnished,Partially furnished,Optional','geodirectory'), |
|
108 | - 'validation_pattern' => '', |
|
109 | - 'validation_msg' => '', |
|
110 | - 'required_msg' => '', |
|
111 | - 'field_icon' => 'fa fa-th-large', |
|
112 | - 'css_class' => '', |
|
113 | - 'cat_sort' => true, |
|
114 | - 'cat_filter' => true |
|
115 | - ) |
|
116 | - ); |
|
117 | - |
|
118 | - // property type |
|
119 | - $custom_fields['property_type'] = array( // The key value should be unique and not contain any spaces. |
|
120 | - 'field_type' => 'select', |
|
121 | - 'class' => 'gd-property-type', |
|
122 | - 'icon' => 'fa fa-home', |
|
123 | - 'name' => __('Property Type', 'geodirectory'), |
|
124 | - 'description' => __('Adds a select input for the property type ie: Detached house, Apartment', 'geodirectory'), |
|
125 | - 'defaults' => array( |
|
126 | - 'data_type' => 'VARCHAR', |
|
127 | - 'admin_title' => 'Property Type', |
|
128 | - 'site_title' => 'Property Type', |
|
129 | - 'admin_desc' => 'Select the property type.', |
|
130 | - 'htmlvar_name' => 'property_type', |
|
131 | - 'is_active' => true, |
|
132 | - 'for_admin_use' => false, |
|
133 | - 'default_value' => '', |
|
134 | - 'show_in' => '[detail],[listing]', |
|
135 | - 'is_required' => true, |
|
136 | - 'option_values' => __('Select Type/,Detached house,Semi-detached house,Apartment,Bungalow,Semi-detached bungalow,Chalet,Town House,End-terrace house,Terrace house,Cottage','geodirectory'), |
|
137 | - 'validation_pattern' => '', |
|
138 | - 'validation_msg' => '', |
|
139 | - 'required_msg' => '', |
|
140 | - 'field_icon' => 'fa fa-home', |
|
141 | - 'css_class' => '', |
|
142 | - 'cat_sort' => true, |
|
143 | - 'cat_filter' => true |
|
144 | - ) |
|
145 | - ); |
|
146 | - |
|
147 | - // property bedrooms |
|
148 | - $custom_fields['property_bedrooms'] = array( // The key value should be unique and not contain any spaces. |
|
149 | - 'field_type' => 'select', |
|
150 | - 'class' => 'gd-property-bedrooms', |
|
151 | - 'icon' => 'fa fa-home', |
|
152 | - 'name' => __('Property Bedrooms', 'geodirectory'), |
|
153 | - 'description' => __('Adds a select input for the number of bedrooms.', 'geodirectory'), |
|
154 | - 'defaults' => array( |
|
155 | - 'data_type' => 'VARCHAR', |
|
156 | - 'admin_title' => 'Property Bedrooms', |
|
157 | - 'site_title' => 'Bedrooms', |
|
158 | - 'admin_desc' => 'Select the number of bedrooms', |
|
159 | - 'htmlvar_name' => 'property_bedrooms', |
|
160 | - 'is_active' => true, |
|
161 | - 'for_admin_use' => false, |
|
162 | - 'default_value' => '', |
|
163 | - 'show_in' => '[detail],[listing]', |
|
164 | - 'is_required' => true, |
|
165 | - 'option_values' => __('Select Bedrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'), |
|
166 | - 'validation_pattern' => '', |
|
167 | - 'validation_msg' => '', |
|
168 | - 'required_msg' => '', |
|
169 | - 'field_icon' => 'fa fa-bed', |
|
170 | - 'css_class' => '', |
|
171 | - 'cat_sort' => true, |
|
172 | - 'cat_filter' => true |
|
173 | - ) |
|
174 | - ); |
|
175 | - |
|
176 | - // property bathrooms |
|
177 | - $custom_fields['property_bathrooms'] = array( // The key value should be unique and not contain any spaces. |
|
178 | - 'field_type' => 'select', |
|
179 | - 'class' => 'gd-property-bathrooms', |
|
180 | - 'icon' => 'fa fa-home', |
|
181 | - 'name' => __('Property Bathrooms', 'geodirectory'), |
|
182 | - 'description' => __('Adds a select input for the number of bathrooms.', 'geodirectory'), |
|
183 | - 'defaults' => array( |
|
184 | - 'data_type' => 'VARCHAR', |
|
185 | - 'admin_title' => 'Property Bathrooms', |
|
186 | - 'site_title' => 'Bathrooms', |
|
187 | - 'admin_desc' => 'Select the number of bathrooms', |
|
188 | - 'htmlvar_name' => 'property_bathrooms', |
|
189 | - 'is_active' => true, |
|
190 | - 'for_admin_use' => false, |
|
191 | - 'default_value' => '', |
|
192 | - 'show_in' => '[detail],[listing]', |
|
193 | - 'is_required' => true, |
|
194 | - 'option_values' => __('Select Bathrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'), |
|
195 | - 'validation_pattern' => '', |
|
196 | - 'validation_msg' => '', |
|
197 | - 'required_msg' => '', |
|
198 | - 'field_icon' => 'fa fa-bold', |
|
199 | - 'css_class' => '', |
|
200 | - 'cat_sort' => true, |
|
201 | - 'cat_filter' => true |
|
202 | - ) |
|
203 | - ); |
|
204 | - |
|
205 | - // property area |
|
206 | - $custom_fields['property_area'] = array( // The key value should be unique and not contain any spaces. |
|
207 | - 'field_type' => 'text', |
|
208 | - 'class' => 'gd-area', |
|
209 | - 'icon' => 'fa fa-home', |
|
210 | - 'name' => __('Property Area', 'geodirectory'), |
|
211 | - 'description' => __('Adds a input for the property area.', 'geodirectory'), |
|
212 | - 'defaults' => array( |
|
213 | - 'data_type' => 'FLOAT', |
|
214 | - 'admin_title' => 'Property Area', |
|
215 | - 'site_title' => 'Area (Sq Ft)', |
|
216 | - 'admin_desc' => 'Enter the Sq Ft value for the property', |
|
217 | - 'htmlvar_name' => 'property_area', |
|
218 | - 'is_active' => true, |
|
219 | - 'for_admin_use' => false, |
|
220 | - 'default_value' => '', |
|
221 | - 'show_in' => '[detail],[listing]', |
|
222 | - 'is_required' => false, |
|
223 | - 'validation_pattern' => '\d+(\.\d{2})?', |
|
224 | - 'validation_msg' => 'Please enter the property area in numbers only: 1500', |
|
225 | - 'required_msg' => '', |
|
226 | - 'field_icon' => 'fa fa-area-chart', |
|
227 | - 'css_class' => '', |
|
228 | - 'cat_sort' => true, |
|
229 | - 'cat_filter' => true |
|
230 | - ) |
|
231 | - ); |
|
232 | - |
|
233 | - // property features |
|
234 | - $custom_fields['property_features'] = array( // The key value should be unique and not contain any spaces. |
|
235 | - 'field_type' => 'multiselect', |
|
236 | - 'class' => 'gd-property-features', |
|
237 | - 'icon' => 'fa fa-home', |
|
238 | - 'name' => __('Property Features', 'geodirectory'), |
|
239 | - 'description' => __('Adds a select input for the property features.', 'geodirectory'), |
|
240 | - 'defaults' => array( |
|
241 | - 'data_type' => 'VARCHAR', |
|
242 | - 'admin_title' => 'Property Features', |
|
243 | - 'site_title' => 'Features', |
|
244 | - 'admin_desc' => 'Select the property features.', |
|
245 | - 'htmlvar_name' => 'property_features', |
|
246 | - 'is_active' => true, |
|
247 | - 'for_admin_use' => false, |
|
248 | - 'default_value' => '', |
|
249 | - 'show_in' => '[detail],[listing]', |
|
250 | - 'is_required' => true, |
|
251 | - 'option_values' => __('Select Features/,Gas Central Heating,Oil Central Heating,Double Glazing,Triple Glazing,Front Garden,Garage,Private driveway,Off Road Parking,Fireplace','geodirectory'), |
|
252 | - 'validation_pattern' => '', |
|
253 | - 'validation_msg' => '', |
|
254 | - 'required_msg' => '', |
|
255 | - 'field_icon' => 'fa fa-plus-square', |
|
256 | - 'css_class' => '', |
|
257 | - 'cat_sort' => true, |
|
258 | - 'cat_filter' => true |
|
259 | - ) |
|
260 | - ); |
|
261 | - |
|
262 | - // Twitter feed |
|
263 | - $custom_fields['twitter_feed'] = array( // The key value should be unique and not contain any spaces. |
|
264 | - 'field_type' => 'text', |
|
265 | - 'class' => 'gd-twitter', |
|
266 | - 'icon' => 'fa fa-twitter', |
|
267 | - 'name' => __('Twitter feed', 'geodirectory'), |
|
268 | - 'description' => __('Adds a input for twitter username and outputs feed.', 'geodirectory'), |
|
269 | - 'defaults' => array( |
|
270 | - 'data_type' => 'VARCHAR', |
|
271 | - 'admin_title' => 'Twitter', |
|
272 | - 'site_title' => 'Twitter', |
|
273 | - 'admin_desc' => 'Enter your Twitter username', |
|
274 | - 'htmlvar_name' => 'twitterusername', |
|
275 | - 'is_active' => true, |
|
276 | - 'for_admin_use' => false, |
|
277 | - 'default_value' => '', |
|
278 | - 'show_in' => '[detail],[owntab]', |
|
279 | - 'is_required' => false, |
|
280 | - 'validation_pattern' => '^[A-Za-z0-9_]{1,32}$', |
|
281 | - 'validation_msg' => 'Please enter a valid twitter username.', |
|
282 | - 'required_msg' => '', |
|
283 | - 'field_icon' => 'fa fa-twitter', |
|
284 | - 'css_class' => '', |
|
285 | - 'cat_sort' => false, |
|
286 | - 'cat_filter' => false |
|
287 | - ) |
|
288 | - ); |
|
289 | - |
|
290 | - // Get directions link |
|
291 | - $custom_fields['get_directions'] = array( // The key value should be unique and not contain any spaces. |
|
292 | - 'field_type' => 'text', |
|
293 | - 'class' => 'gd-get-directions', |
|
294 | - 'icon' => 'fa fa-location-arrow', |
|
295 | - 'name' => __('Get Directions Link', 'geodirectory'), |
|
296 | - 'description' => __('Adds a input for twitter username and outputs feed.', 'geodirectory'), |
|
297 | - 'defaults' => array( |
|
298 | - 'data_type' => 'VARCHAR', |
|
299 | - 'admin_title' => 'Get Directions', |
|
300 | - 'site_title' => 'Get Directions', |
|
301 | - 'admin_desc' => '', |
|
302 | - 'htmlvar_name' => 'get_directions', |
|
303 | - 'is_active' => true, |
|
304 | - 'for_admin_use' => true, |
|
305 | - 'default_value' => 'Get Directions', |
|
306 | - 'show_in' => '[detail],[listing]', |
|
307 | - 'is_required' => false, |
|
308 | - 'validation_pattern' => '', |
|
309 | - 'validation_msg' => '', |
|
310 | - 'required_msg' => '', |
|
311 | - 'field_icon' => 'fa fa-location-arrow', |
|
312 | - 'css_class' => '', |
|
313 | - 'cat_sort' => false, |
|
314 | - 'cat_filter' => false |
|
315 | - ) |
|
316 | - ); |
|
317 | - |
|
318 | - |
|
319 | - // JOB TYPE CF |
|
320 | - |
|
321 | - // job type |
|
322 | - $custom_fields['job_type'] = array( // The key value should be unique and not contain any spaces. |
|
323 | - 'field_type' => 'select', |
|
324 | - 'class' => 'gd-job-type', |
|
325 | - 'icon' => 'fa fa-briefcase', |
|
326 | - 'name' => __('Job Type', 'geodirectory'), |
|
327 | - 'description' => __('Adds a select input to be able to set the type of a job ie: Full Time, Part Time', 'geodirectory'), |
|
328 | - 'defaults' => array( |
|
329 | - 'data_type' => 'VARCHAR', |
|
330 | - 'admin_title' => __('Job Type', 'geodirectory'), |
|
331 | - 'site_title' => __('Job Type','geodirectory'), |
|
332 | - 'admin_desc' => __('Select the type of job.','geodirectory'), |
|
333 | - 'htmlvar_name' => 'job_type', |
|
334 | - 'is_active' => true, |
|
335 | - 'for_admin_use' => false, |
|
336 | - 'default_value' => '', |
|
337 | - 'show_in' => '[detail],[listing]', |
|
338 | - 'is_required' => true, |
|
339 | - 'option_values' => __('Select Type/,Freelance,Full Time,Internship,Part Time,Temporary,Other','geodirectory'), |
|
340 | - 'validation_pattern' => '', |
|
341 | - 'validation_msg' => '', |
|
342 | - 'required_msg' => '', |
|
343 | - 'field_icon' => 'fa fa-briefcase', |
|
344 | - 'css_class' => '', |
|
345 | - 'cat_sort' => true, |
|
346 | - 'cat_filter' => true |
|
347 | - ) |
|
348 | - ); |
|
349 | - |
|
350 | - // job sector |
|
351 | - $custom_fields['job_sector'] = array( // The key value should be unique and not contain any spaces. |
|
352 | - 'field_type' => 'select', |
|
353 | - 'class' => 'gd-job-type', |
|
354 | - 'icon' => 'fa fa-briefcase', |
|
355 | - 'name' => __('Job Sector', 'geodirectory'), |
|
356 | - 'description' => __('Adds a select input to be able to set the type of a job Sector ie: Private Sector,Public Sector', 'geodirectory'), |
|
357 | - 'defaults' => array( |
|
358 | - 'data_type' => 'VARCHAR', |
|
359 | - 'admin_title' => __('Job Sector','geodirectory'), |
|
360 | - 'site_title' => __('Job Sector','geodirectory'), |
|
361 | - 'admin_desc' => __('Select the job sector.','geodirectory'), |
|
362 | - 'htmlvar_name' => 'job_sector', |
|
363 | - 'is_active' => true, |
|
364 | - 'for_admin_use' => false, |
|
365 | - 'default_value' => '', |
|
366 | - 'show_in' => '[detail]', |
|
367 | - 'is_required' => true, |
|
368 | - 'option_values' => __('Select Sector/,Private Sector,Public Sector,Agencies','geodirectory'), |
|
369 | - 'validation_pattern' => '', |
|
370 | - 'validation_msg' => '', |
|
371 | - 'required_msg' => '', |
|
372 | - 'field_icon' => 'fa fa-briefcase', |
|
373 | - 'css_class' => '', |
|
374 | - 'cat_sort' => true, |
|
375 | - 'cat_filter' => true |
|
376 | - ) |
|
377 | - ); |
|
378 | - |
|
379 | - |
|
380 | - /** |
|
381 | - * @see `geodir_custom_fields` |
|
382 | - */ |
|
383 | - return apply_filters('geodir_custom_fields_predefined',$custom_fields,$post_type); |
|
20 | + $custom_fields = array(); |
|
21 | + |
|
22 | + |
|
23 | + // price |
|
24 | + $custom_fields['price'] = array( // The key value should be unique and not contain any spaces. |
|
25 | + 'field_type' => 'text', |
|
26 | + 'class' => 'gd-price', |
|
27 | + 'icon' => 'fa fa-usd', |
|
28 | + 'name' => __('Price', 'geodirectory'), |
|
29 | + 'description' => __('Adds a input for a price field. This will let you filter and sort by price.', 'geodirectory'), |
|
30 | + 'defaults' => array( |
|
31 | + 'data_type' => 'FLOAT', |
|
32 | + 'decimal_point' => '2', |
|
33 | + 'admin_title' => 'Price', |
|
34 | + 'site_title' => 'Price', |
|
35 | + 'admin_desc' => 'Enter the price in $ (no currency symbol)', |
|
36 | + 'htmlvar_name' => 'price', |
|
37 | + 'is_active' => true, |
|
38 | + 'for_admin_use' => false, |
|
39 | + 'default_value' => '', |
|
40 | + 'show_in' => '[detail],[listing]', |
|
41 | + 'is_required' => false, |
|
42 | + 'validation_pattern' => '\d+(\.\d{2})?', |
|
43 | + 'validation_msg' => 'Please enter number and decimal only ie: 100.50', |
|
44 | + 'required_msg' => '', |
|
45 | + 'field_icon' => 'fa fa-usd', |
|
46 | + 'css_class' => '', |
|
47 | + 'cat_sort' => true, |
|
48 | + 'cat_filter' => true, |
|
49 | + 'extra_fields' => array( |
|
50 | + 'is_price' => 1, |
|
51 | + 'thousand_separator' => 'comma', |
|
52 | + 'decimal_separator' => 'period', |
|
53 | + 'decimal_display' => 'if', |
|
54 | + 'currency_symbol' => '$', |
|
55 | + 'currency_symbol_placement' => 'left' |
|
56 | + ) |
|
57 | + ) |
|
58 | + ); |
|
59 | + |
|
60 | + // property status |
|
61 | + $custom_fields['property_status'] = array( // The key value should be unique and not contain any spaces. |
|
62 | + 'field_type' => 'select', |
|
63 | + 'class' => 'gd-property-status', |
|
64 | + 'icon' => 'fa fa-home', |
|
65 | + 'name' => __('Property Status', 'geodirectory'), |
|
66 | + 'description' => __('Adds a select input to be able to set the status of a property ie: For Sale, For Rent', 'geodirectory'), |
|
67 | + 'defaults' => array( |
|
68 | + 'data_type' => 'VARCHAR', |
|
69 | + 'admin_title' => 'Property Status', |
|
70 | + 'site_title' => 'Property Status', |
|
71 | + 'admin_desc' => 'Enter the status of the property.', |
|
72 | + 'htmlvar_name' => 'property_status', |
|
73 | + 'is_active' => true, |
|
74 | + 'for_admin_use' => false, |
|
75 | + 'default_value' => '', |
|
76 | + 'show_in' => '[detail],[listing]', |
|
77 | + 'is_required' => true, |
|
78 | + 'option_values' => __('Select Status/,For Sale,For Rent,Sold,Let','geodirectory'), |
|
79 | + 'validation_pattern' => '', |
|
80 | + 'validation_msg' => '', |
|
81 | + 'required_msg' => '', |
|
82 | + 'field_icon' => 'fa fa-home', |
|
83 | + 'css_class' => '', |
|
84 | + 'cat_sort' => true, |
|
85 | + 'cat_filter' => true |
|
86 | + ) |
|
87 | + ); |
|
88 | + |
|
89 | + // property furnishing |
|
90 | + $custom_fields['property_furnishing'] = array( // The key value should be unique and not contain any spaces. |
|
91 | + 'field_type' => 'select', |
|
92 | + 'class' => 'gd-property-furnishing', |
|
93 | + 'icon' => 'fa fa-home', |
|
94 | + 'name' => __('Property Furnishing', 'geodirectory'), |
|
95 | + 'description' => __('Adds a select input to be able to set the furnishing status of a property ie: Unfurnished, Furnished', 'geodirectory'), |
|
96 | + 'defaults' => array( |
|
97 | + 'data_type' => 'VARCHAR', |
|
98 | + 'admin_title' => 'Furnishing', |
|
99 | + 'site_title' => 'Furnishing', |
|
100 | + 'admin_desc' => 'Enter the furnishing status of the property.', |
|
101 | + 'htmlvar_name' => 'property_furnishing', |
|
102 | + 'is_active' => true, |
|
103 | + 'for_admin_use' => false, |
|
104 | + 'default_value' => '', |
|
105 | + 'show_in' => '[detail],[listing]', |
|
106 | + 'is_required' => true, |
|
107 | + 'option_values' => __('Select Status/,Unfurnished,Furnished,Partially furnished,Optional','geodirectory'), |
|
108 | + 'validation_pattern' => '', |
|
109 | + 'validation_msg' => '', |
|
110 | + 'required_msg' => '', |
|
111 | + 'field_icon' => 'fa fa-th-large', |
|
112 | + 'css_class' => '', |
|
113 | + 'cat_sort' => true, |
|
114 | + 'cat_filter' => true |
|
115 | + ) |
|
116 | + ); |
|
117 | + |
|
118 | + // property type |
|
119 | + $custom_fields['property_type'] = array( // The key value should be unique and not contain any spaces. |
|
120 | + 'field_type' => 'select', |
|
121 | + 'class' => 'gd-property-type', |
|
122 | + 'icon' => 'fa fa-home', |
|
123 | + 'name' => __('Property Type', 'geodirectory'), |
|
124 | + 'description' => __('Adds a select input for the property type ie: Detached house, Apartment', 'geodirectory'), |
|
125 | + 'defaults' => array( |
|
126 | + 'data_type' => 'VARCHAR', |
|
127 | + 'admin_title' => 'Property Type', |
|
128 | + 'site_title' => 'Property Type', |
|
129 | + 'admin_desc' => 'Select the property type.', |
|
130 | + 'htmlvar_name' => 'property_type', |
|
131 | + 'is_active' => true, |
|
132 | + 'for_admin_use' => false, |
|
133 | + 'default_value' => '', |
|
134 | + 'show_in' => '[detail],[listing]', |
|
135 | + 'is_required' => true, |
|
136 | + 'option_values' => __('Select Type/,Detached house,Semi-detached house,Apartment,Bungalow,Semi-detached bungalow,Chalet,Town House,End-terrace house,Terrace house,Cottage','geodirectory'), |
|
137 | + 'validation_pattern' => '', |
|
138 | + 'validation_msg' => '', |
|
139 | + 'required_msg' => '', |
|
140 | + 'field_icon' => 'fa fa-home', |
|
141 | + 'css_class' => '', |
|
142 | + 'cat_sort' => true, |
|
143 | + 'cat_filter' => true |
|
144 | + ) |
|
145 | + ); |
|
146 | + |
|
147 | + // property bedrooms |
|
148 | + $custom_fields['property_bedrooms'] = array( // The key value should be unique and not contain any spaces. |
|
149 | + 'field_type' => 'select', |
|
150 | + 'class' => 'gd-property-bedrooms', |
|
151 | + 'icon' => 'fa fa-home', |
|
152 | + 'name' => __('Property Bedrooms', 'geodirectory'), |
|
153 | + 'description' => __('Adds a select input for the number of bedrooms.', 'geodirectory'), |
|
154 | + 'defaults' => array( |
|
155 | + 'data_type' => 'VARCHAR', |
|
156 | + 'admin_title' => 'Property Bedrooms', |
|
157 | + 'site_title' => 'Bedrooms', |
|
158 | + 'admin_desc' => 'Select the number of bedrooms', |
|
159 | + 'htmlvar_name' => 'property_bedrooms', |
|
160 | + 'is_active' => true, |
|
161 | + 'for_admin_use' => false, |
|
162 | + 'default_value' => '', |
|
163 | + 'show_in' => '[detail],[listing]', |
|
164 | + 'is_required' => true, |
|
165 | + 'option_values' => __('Select Bedrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'), |
|
166 | + 'validation_pattern' => '', |
|
167 | + 'validation_msg' => '', |
|
168 | + 'required_msg' => '', |
|
169 | + 'field_icon' => 'fa fa-bed', |
|
170 | + 'css_class' => '', |
|
171 | + 'cat_sort' => true, |
|
172 | + 'cat_filter' => true |
|
173 | + ) |
|
174 | + ); |
|
175 | + |
|
176 | + // property bathrooms |
|
177 | + $custom_fields['property_bathrooms'] = array( // The key value should be unique and not contain any spaces. |
|
178 | + 'field_type' => 'select', |
|
179 | + 'class' => 'gd-property-bathrooms', |
|
180 | + 'icon' => 'fa fa-home', |
|
181 | + 'name' => __('Property Bathrooms', 'geodirectory'), |
|
182 | + 'description' => __('Adds a select input for the number of bathrooms.', 'geodirectory'), |
|
183 | + 'defaults' => array( |
|
184 | + 'data_type' => 'VARCHAR', |
|
185 | + 'admin_title' => 'Property Bathrooms', |
|
186 | + 'site_title' => 'Bathrooms', |
|
187 | + 'admin_desc' => 'Select the number of bathrooms', |
|
188 | + 'htmlvar_name' => 'property_bathrooms', |
|
189 | + 'is_active' => true, |
|
190 | + 'for_admin_use' => false, |
|
191 | + 'default_value' => '', |
|
192 | + 'show_in' => '[detail],[listing]', |
|
193 | + 'is_required' => true, |
|
194 | + 'option_values' => __('Select Bathrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'), |
|
195 | + 'validation_pattern' => '', |
|
196 | + 'validation_msg' => '', |
|
197 | + 'required_msg' => '', |
|
198 | + 'field_icon' => 'fa fa-bold', |
|
199 | + 'css_class' => '', |
|
200 | + 'cat_sort' => true, |
|
201 | + 'cat_filter' => true |
|
202 | + ) |
|
203 | + ); |
|
204 | + |
|
205 | + // property area |
|
206 | + $custom_fields['property_area'] = array( // The key value should be unique and not contain any spaces. |
|
207 | + 'field_type' => 'text', |
|
208 | + 'class' => 'gd-area', |
|
209 | + 'icon' => 'fa fa-home', |
|
210 | + 'name' => __('Property Area', 'geodirectory'), |
|
211 | + 'description' => __('Adds a input for the property area.', 'geodirectory'), |
|
212 | + 'defaults' => array( |
|
213 | + 'data_type' => 'FLOAT', |
|
214 | + 'admin_title' => 'Property Area', |
|
215 | + 'site_title' => 'Area (Sq Ft)', |
|
216 | + 'admin_desc' => 'Enter the Sq Ft value for the property', |
|
217 | + 'htmlvar_name' => 'property_area', |
|
218 | + 'is_active' => true, |
|
219 | + 'for_admin_use' => false, |
|
220 | + 'default_value' => '', |
|
221 | + 'show_in' => '[detail],[listing]', |
|
222 | + 'is_required' => false, |
|
223 | + 'validation_pattern' => '\d+(\.\d{2})?', |
|
224 | + 'validation_msg' => 'Please enter the property area in numbers only: 1500', |
|
225 | + 'required_msg' => '', |
|
226 | + 'field_icon' => 'fa fa-area-chart', |
|
227 | + 'css_class' => '', |
|
228 | + 'cat_sort' => true, |
|
229 | + 'cat_filter' => true |
|
230 | + ) |
|
231 | + ); |
|
232 | + |
|
233 | + // property features |
|
234 | + $custom_fields['property_features'] = array( // The key value should be unique and not contain any spaces. |
|
235 | + 'field_type' => 'multiselect', |
|
236 | + 'class' => 'gd-property-features', |
|
237 | + 'icon' => 'fa fa-home', |
|
238 | + 'name' => __('Property Features', 'geodirectory'), |
|
239 | + 'description' => __('Adds a select input for the property features.', 'geodirectory'), |
|
240 | + 'defaults' => array( |
|
241 | + 'data_type' => 'VARCHAR', |
|
242 | + 'admin_title' => 'Property Features', |
|
243 | + 'site_title' => 'Features', |
|
244 | + 'admin_desc' => 'Select the property features.', |
|
245 | + 'htmlvar_name' => 'property_features', |
|
246 | + 'is_active' => true, |
|
247 | + 'for_admin_use' => false, |
|
248 | + 'default_value' => '', |
|
249 | + 'show_in' => '[detail],[listing]', |
|
250 | + 'is_required' => true, |
|
251 | + 'option_values' => __('Select Features/,Gas Central Heating,Oil Central Heating,Double Glazing,Triple Glazing,Front Garden,Garage,Private driveway,Off Road Parking,Fireplace','geodirectory'), |
|
252 | + 'validation_pattern' => '', |
|
253 | + 'validation_msg' => '', |
|
254 | + 'required_msg' => '', |
|
255 | + 'field_icon' => 'fa fa-plus-square', |
|
256 | + 'css_class' => '', |
|
257 | + 'cat_sort' => true, |
|
258 | + 'cat_filter' => true |
|
259 | + ) |
|
260 | + ); |
|
261 | + |
|
262 | + // Twitter feed |
|
263 | + $custom_fields['twitter_feed'] = array( // The key value should be unique and not contain any spaces. |
|
264 | + 'field_type' => 'text', |
|
265 | + 'class' => 'gd-twitter', |
|
266 | + 'icon' => 'fa fa-twitter', |
|
267 | + 'name' => __('Twitter feed', 'geodirectory'), |
|
268 | + 'description' => __('Adds a input for twitter username and outputs feed.', 'geodirectory'), |
|
269 | + 'defaults' => array( |
|
270 | + 'data_type' => 'VARCHAR', |
|
271 | + 'admin_title' => 'Twitter', |
|
272 | + 'site_title' => 'Twitter', |
|
273 | + 'admin_desc' => 'Enter your Twitter username', |
|
274 | + 'htmlvar_name' => 'twitterusername', |
|
275 | + 'is_active' => true, |
|
276 | + 'for_admin_use' => false, |
|
277 | + 'default_value' => '', |
|
278 | + 'show_in' => '[detail],[owntab]', |
|
279 | + 'is_required' => false, |
|
280 | + 'validation_pattern' => '^[A-Za-z0-9_]{1,32}$', |
|
281 | + 'validation_msg' => 'Please enter a valid twitter username.', |
|
282 | + 'required_msg' => '', |
|
283 | + 'field_icon' => 'fa fa-twitter', |
|
284 | + 'css_class' => '', |
|
285 | + 'cat_sort' => false, |
|
286 | + 'cat_filter' => false |
|
287 | + ) |
|
288 | + ); |
|
289 | + |
|
290 | + // Get directions link |
|
291 | + $custom_fields['get_directions'] = array( // The key value should be unique and not contain any spaces. |
|
292 | + 'field_type' => 'text', |
|
293 | + 'class' => 'gd-get-directions', |
|
294 | + 'icon' => 'fa fa-location-arrow', |
|
295 | + 'name' => __('Get Directions Link', 'geodirectory'), |
|
296 | + 'description' => __('Adds a input for twitter username and outputs feed.', 'geodirectory'), |
|
297 | + 'defaults' => array( |
|
298 | + 'data_type' => 'VARCHAR', |
|
299 | + 'admin_title' => 'Get Directions', |
|
300 | + 'site_title' => 'Get Directions', |
|
301 | + 'admin_desc' => '', |
|
302 | + 'htmlvar_name' => 'get_directions', |
|
303 | + 'is_active' => true, |
|
304 | + 'for_admin_use' => true, |
|
305 | + 'default_value' => 'Get Directions', |
|
306 | + 'show_in' => '[detail],[listing]', |
|
307 | + 'is_required' => false, |
|
308 | + 'validation_pattern' => '', |
|
309 | + 'validation_msg' => '', |
|
310 | + 'required_msg' => '', |
|
311 | + 'field_icon' => 'fa fa-location-arrow', |
|
312 | + 'css_class' => '', |
|
313 | + 'cat_sort' => false, |
|
314 | + 'cat_filter' => false |
|
315 | + ) |
|
316 | + ); |
|
317 | + |
|
318 | + |
|
319 | + // JOB TYPE CF |
|
320 | + |
|
321 | + // job type |
|
322 | + $custom_fields['job_type'] = array( // The key value should be unique and not contain any spaces. |
|
323 | + 'field_type' => 'select', |
|
324 | + 'class' => 'gd-job-type', |
|
325 | + 'icon' => 'fa fa-briefcase', |
|
326 | + 'name' => __('Job Type', 'geodirectory'), |
|
327 | + 'description' => __('Adds a select input to be able to set the type of a job ie: Full Time, Part Time', 'geodirectory'), |
|
328 | + 'defaults' => array( |
|
329 | + 'data_type' => 'VARCHAR', |
|
330 | + 'admin_title' => __('Job Type', 'geodirectory'), |
|
331 | + 'site_title' => __('Job Type','geodirectory'), |
|
332 | + 'admin_desc' => __('Select the type of job.','geodirectory'), |
|
333 | + 'htmlvar_name' => 'job_type', |
|
334 | + 'is_active' => true, |
|
335 | + 'for_admin_use' => false, |
|
336 | + 'default_value' => '', |
|
337 | + 'show_in' => '[detail],[listing]', |
|
338 | + 'is_required' => true, |
|
339 | + 'option_values' => __('Select Type/,Freelance,Full Time,Internship,Part Time,Temporary,Other','geodirectory'), |
|
340 | + 'validation_pattern' => '', |
|
341 | + 'validation_msg' => '', |
|
342 | + 'required_msg' => '', |
|
343 | + 'field_icon' => 'fa fa-briefcase', |
|
344 | + 'css_class' => '', |
|
345 | + 'cat_sort' => true, |
|
346 | + 'cat_filter' => true |
|
347 | + ) |
|
348 | + ); |
|
349 | + |
|
350 | + // job sector |
|
351 | + $custom_fields['job_sector'] = array( // The key value should be unique and not contain any spaces. |
|
352 | + 'field_type' => 'select', |
|
353 | + 'class' => 'gd-job-type', |
|
354 | + 'icon' => 'fa fa-briefcase', |
|
355 | + 'name' => __('Job Sector', 'geodirectory'), |
|
356 | + 'description' => __('Adds a select input to be able to set the type of a job Sector ie: Private Sector,Public Sector', 'geodirectory'), |
|
357 | + 'defaults' => array( |
|
358 | + 'data_type' => 'VARCHAR', |
|
359 | + 'admin_title' => __('Job Sector','geodirectory'), |
|
360 | + 'site_title' => __('Job Sector','geodirectory'), |
|
361 | + 'admin_desc' => __('Select the job sector.','geodirectory'), |
|
362 | + 'htmlvar_name' => 'job_sector', |
|
363 | + 'is_active' => true, |
|
364 | + 'for_admin_use' => false, |
|
365 | + 'default_value' => '', |
|
366 | + 'show_in' => '[detail]', |
|
367 | + 'is_required' => true, |
|
368 | + 'option_values' => __('Select Sector/,Private Sector,Public Sector,Agencies','geodirectory'), |
|
369 | + 'validation_pattern' => '', |
|
370 | + 'validation_msg' => '', |
|
371 | + 'required_msg' => '', |
|
372 | + 'field_icon' => 'fa fa-briefcase', |
|
373 | + 'css_class' => '', |
|
374 | + 'cat_sort' => true, |
|
375 | + 'cat_filter' => true |
|
376 | + ) |
|
377 | + ); |
|
378 | + |
|
379 | + |
|
380 | + /** |
|
381 | + * @see `geodir_custom_fields` |
|
382 | + */ |
|
383 | + return apply_filters('geodir_custom_fields_predefined',$custom_fields,$post_type); |
|
384 | 384 | } |
385 | 385 | |
386 | 386 | |
@@ -395,32 +395,32 @@ discard block |
||
395 | 395 | * @return string The html to output. |
396 | 396 | */ |
397 | 397 | function geodir_predefined_custom_field_output_twitter_feed($html,$location,$cf){ |
398 | - global $post; |
|
398 | + global $post; |
|
399 | 399 | |
400 | 400 | |
401 | - if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ): |
|
401 | + if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ): |
|
402 | 402 | |
403 | - $class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text"; |
|
403 | + $class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text"; |
|
404 | 404 | |
405 | - $field_icon = geodir_field_icon_proccess($cf); |
|
406 | - if (strpos($field_icon, 'http') !== false) { |
|
407 | - $field_icon_af = ''; |
|
408 | - } elseif ($field_icon == '') { |
|
409 | - $field_icon_af = ($cf['htmlvar_name'] == 'geodir_timing') ? '<i class="fa fa-clock-o"></i>' : ""; |
|
410 | - } else { |
|
411 | - $field_icon_af = $field_icon; |
|
412 | - $field_icon = ''; |
|
413 | - } |
|
405 | + $field_icon = geodir_field_icon_proccess($cf); |
|
406 | + if (strpos($field_icon, 'http') !== false) { |
|
407 | + $field_icon_af = ''; |
|
408 | + } elseif ($field_icon == '') { |
|
409 | + $field_icon_af = ($cf['htmlvar_name'] == 'geodir_timing') ? '<i class="fa fa-clock-o"></i>' : ""; |
|
410 | + } else { |
|
411 | + $field_icon_af = $field_icon; |
|
412 | + $field_icon = ''; |
|
413 | + } |
|
414 | 414 | |
415 | 415 | |
416 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;">'; |
|
416 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;">'; |
|
417 | 417 | |
418 | - $html .= '<a class="twitter-timeline" data-height="600" data-dnt="true" href="https://twitter.com/'.$post->{$cf['htmlvar_name']}.'">Tweets by '.$post->{$cf['htmlvar_name']}.'</a> <script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>'; |
|
419 | - $html .= '</div>'; |
|
418 | + $html .= '<a class="twitter-timeline" data-height="600" data-dnt="true" href="https://twitter.com/'.$post->{$cf['htmlvar_name']}.'">Tweets by '.$post->{$cf['htmlvar_name']}.'</a> <script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>'; |
|
419 | + $html .= '</div>'; |
|
420 | 420 | |
421 | - endif; |
|
421 | + endif; |
|
422 | 422 | |
423 | - return $html; |
|
423 | + return $html; |
|
424 | 424 | } |
425 | 425 | add_filter('geodir_custom_field_output_text_key_twitter_feed','geodir_predefined_custom_field_output_twitter_feed',10,3); |
426 | 426 | |
@@ -435,36 +435,36 @@ discard block |
||
435 | 435 | * @return string The html to output. |
436 | 436 | */ |
437 | 437 | function geodir_predefined_custom_field_output_get_directions($html,$location,$cf) { |
438 | - global $post; |
|
438 | + global $post; |
|
439 | 439 | |
440 | 440 | |
441 | - if ( isset( $post->{$cf['htmlvar_name']} ) && $post->{$cf['htmlvar_name']} != '' && isset( $post->post_latitude ) && $post->post_latitude ){ |
|
441 | + if ( isset( $post->{$cf['htmlvar_name']} ) && $post->{$cf['htmlvar_name']} != '' && isset( $post->post_latitude ) && $post->post_latitude ){ |
|
442 | 442 | |
443 | - $field_icon = geodir_field_icon_proccess( $cf ); |
|
444 | - if ( strpos( $field_icon, 'http' ) !== false ) { |
|
445 | - $field_icon_af = ''; |
|
446 | - } elseif ( $field_icon == '' ) { |
|
447 | - $field_icon_af = '<i class="fa fa-location-arrow"></i>'; |
|
448 | - } else { |
|
449 | - $field_icon_af = $field_icon; |
|
450 | - $field_icon = ''; |
|
451 | - } |
|
443 | + $field_icon = geodir_field_icon_proccess( $cf ); |
|
444 | + if ( strpos( $field_icon, 'http' ) !== false ) { |
|
445 | + $field_icon_af = ''; |
|
446 | + } elseif ( $field_icon == '' ) { |
|
447 | + $field_icon_af = '<i class="fa fa-location-arrow"></i>'; |
|
448 | + } else { |
|
449 | + $field_icon_af = $field_icon; |
|
450 | + $field_icon = ''; |
|
451 | + } |
|
452 | 452 | |
453 | - $link_text = isset( $post->{$cf['default_value']} ) ? $post->{$cf['default_value']} : __( 'Get Directions', 'geodirectory' ); |
|
453 | + $link_text = isset( $post->{$cf['default_value']} ) ? $post->{$cf['default_value']} : __( 'Get Directions', 'geodirectory' ); |
|
454 | 454 | |
455 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;">'; |
|
455 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;">'; |
|
456 | 456 | |
457 | - if(isset( $cf['field_icon'] ) && $cf['field_icon']){ |
|
458 | - $html .= $field_icon_af; |
|
459 | - } |
|
457 | + if(isset( $cf['field_icon'] ) && $cf['field_icon']){ |
|
458 | + $html .= $field_icon_af; |
|
459 | + } |
|
460 | 460 | |
461 | - $html .= '<a href="https://www.google.com/maps/dir//\'' . $post->post_latitude . ',' . $post->post_longitude . '\'/" target="_blank" >' . $link_text . '</a>'; |
|
462 | - $html .= '</div>'; |
|
461 | + $html .= '<a href="https://www.google.com/maps/dir//\'' . $post->post_latitude . ',' . $post->post_longitude . '\'/" target="_blank" >' . $link_text . '</a>'; |
|
462 | + $html .= '</div>'; |
|
463 | 463 | |
464 | - }else{ |
|
465 | - $html =''; |
|
466 | - } |
|
464 | + }else{ |
|
465 | + $html =''; |
|
466 | + } |
|
467 | 467 | |
468 | - return $html; |
|
468 | + return $html; |
|
469 | 469 | } |
470 | 470 | add_filter('geodir_custom_field_output_text_key_get_directions','geodir_predefined_custom_field_output_get_directions',10,3); |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | * @package GeoDirectory |
16 | 16 | * @see `geodir_custom_field_save` for array details. |
17 | 17 | */ |
18 | -function geodir_custom_fields_predefined($post_type=''){ |
|
18 | +function geodir_custom_fields_predefined($post_type = '') { |
|
19 | 19 | |
20 | 20 | $custom_fields = array(); |
21 | 21 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | 'default_value' => '', |
76 | 76 | 'show_in' => '[detail],[listing]', |
77 | 77 | 'is_required' => true, |
78 | - 'option_values' => __('Select Status/,For Sale,For Rent,Sold,Let','geodirectory'), |
|
78 | + 'option_values' => __('Select Status/,For Sale,For Rent,Sold,Let', 'geodirectory'), |
|
79 | 79 | 'validation_pattern' => '', |
80 | 80 | 'validation_msg' => '', |
81 | 81 | 'required_msg' => '', |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | 'default_value' => '', |
105 | 105 | 'show_in' => '[detail],[listing]', |
106 | 106 | 'is_required' => true, |
107 | - 'option_values' => __('Select Status/,Unfurnished,Furnished,Partially furnished,Optional','geodirectory'), |
|
107 | + 'option_values' => __('Select Status/,Unfurnished,Furnished,Partially furnished,Optional', 'geodirectory'), |
|
108 | 108 | 'validation_pattern' => '', |
109 | 109 | 'validation_msg' => '', |
110 | 110 | 'required_msg' => '', |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | 'default_value' => '', |
134 | 134 | 'show_in' => '[detail],[listing]', |
135 | 135 | 'is_required' => true, |
136 | - 'option_values' => __('Select Type/,Detached house,Semi-detached house,Apartment,Bungalow,Semi-detached bungalow,Chalet,Town House,End-terrace house,Terrace house,Cottage','geodirectory'), |
|
136 | + 'option_values' => __('Select Type/,Detached house,Semi-detached house,Apartment,Bungalow,Semi-detached bungalow,Chalet,Town House,End-terrace house,Terrace house,Cottage', 'geodirectory'), |
|
137 | 137 | 'validation_pattern' => '', |
138 | 138 | 'validation_msg' => '', |
139 | 139 | 'required_msg' => '', |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | 'default_value' => '', |
163 | 163 | 'show_in' => '[detail],[listing]', |
164 | 164 | 'is_required' => true, |
165 | - 'option_values' => __('Select Bedrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'), |
|
165 | + 'option_values' => __('Select Bedrooms/,1,2,3,4,5,6,7,8,9,10', 'geodirectory'), |
|
166 | 166 | 'validation_pattern' => '', |
167 | 167 | 'validation_msg' => '', |
168 | 168 | 'required_msg' => '', |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | 'default_value' => '', |
192 | 192 | 'show_in' => '[detail],[listing]', |
193 | 193 | 'is_required' => true, |
194 | - 'option_values' => __('Select Bathrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'), |
|
194 | + 'option_values' => __('Select Bathrooms/,1,2,3,4,5,6,7,8,9,10', 'geodirectory'), |
|
195 | 195 | 'validation_pattern' => '', |
196 | 196 | 'validation_msg' => '', |
197 | 197 | 'required_msg' => '', |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | 'default_value' => '', |
249 | 249 | 'show_in' => '[detail],[listing]', |
250 | 250 | 'is_required' => true, |
251 | - 'option_values' => __('Select Features/,Gas Central Heating,Oil Central Heating,Double Glazing,Triple Glazing,Front Garden,Garage,Private driveway,Off Road Parking,Fireplace','geodirectory'), |
|
251 | + 'option_values' => __('Select Features/,Gas Central Heating,Oil Central Heating,Double Glazing,Triple Glazing,Front Garden,Garage,Private driveway,Off Road Parking,Fireplace', 'geodirectory'), |
|
252 | 252 | 'validation_pattern' => '', |
253 | 253 | 'validation_msg' => '', |
254 | 254 | 'required_msg' => '', |
@@ -328,15 +328,15 @@ discard block |
||
328 | 328 | 'defaults' => array( |
329 | 329 | 'data_type' => 'VARCHAR', |
330 | 330 | 'admin_title' => __('Job Type', 'geodirectory'), |
331 | - 'site_title' => __('Job Type','geodirectory'), |
|
332 | - 'admin_desc' => __('Select the type of job.','geodirectory'), |
|
331 | + 'site_title' => __('Job Type', 'geodirectory'), |
|
332 | + 'admin_desc' => __('Select the type of job.', 'geodirectory'), |
|
333 | 333 | 'htmlvar_name' => 'job_type', |
334 | 334 | 'is_active' => true, |
335 | 335 | 'for_admin_use' => false, |
336 | 336 | 'default_value' => '', |
337 | 337 | 'show_in' => '[detail],[listing]', |
338 | 338 | 'is_required' => true, |
339 | - 'option_values' => __('Select Type/,Freelance,Full Time,Internship,Part Time,Temporary,Other','geodirectory'), |
|
339 | + 'option_values' => __('Select Type/,Freelance,Full Time,Internship,Part Time,Temporary,Other', 'geodirectory'), |
|
340 | 340 | 'validation_pattern' => '', |
341 | 341 | 'validation_msg' => '', |
342 | 342 | 'required_msg' => '', |
@@ -356,16 +356,16 @@ discard block |
||
356 | 356 | 'description' => __('Adds a select input to be able to set the type of a job Sector ie: Private Sector,Public Sector', 'geodirectory'), |
357 | 357 | 'defaults' => array( |
358 | 358 | 'data_type' => 'VARCHAR', |
359 | - 'admin_title' => __('Job Sector','geodirectory'), |
|
360 | - 'site_title' => __('Job Sector','geodirectory'), |
|
361 | - 'admin_desc' => __('Select the job sector.','geodirectory'), |
|
359 | + 'admin_title' => __('Job Sector', 'geodirectory'), |
|
360 | + 'site_title' => __('Job Sector', 'geodirectory'), |
|
361 | + 'admin_desc' => __('Select the job sector.', 'geodirectory'), |
|
362 | 362 | 'htmlvar_name' => 'job_sector', |
363 | 363 | 'is_active' => true, |
364 | 364 | 'for_admin_use' => false, |
365 | 365 | 'default_value' => '', |
366 | 366 | 'show_in' => '[detail]', |
367 | 367 | 'is_required' => true, |
368 | - 'option_values' => __('Select Sector/,Private Sector,Public Sector,Agencies','geodirectory'), |
|
368 | + 'option_values' => __('Select Sector/,Private Sector,Public Sector,Agencies', 'geodirectory'), |
|
369 | 369 | 'validation_pattern' => '', |
370 | 370 | 'validation_msg' => '', |
371 | 371 | 'required_msg' => '', |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | /** |
381 | 381 | * @see `geodir_custom_fields` |
382 | 382 | */ |
383 | - return apply_filters('geodir_custom_fields_predefined',$custom_fields,$post_type); |
|
383 | + return apply_filters('geodir_custom_fields_predefined', $custom_fields, $post_type); |
|
384 | 384 | } |
385 | 385 | |
386 | 386 | |
@@ -394,11 +394,11 @@ discard block |
||
394 | 394 | * @since 1.6.9 |
395 | 395 | * @return string The html to output. |
396 | 396 | */ |
397 | -function geodir_predefined_custom_field_output_twitter_feed($html,$location,$cf){ |
|
397 | +function geodir_predefined_custom_field_output_twitter_feed($html, $location, $cf) { |
|
398 | 398 | global $post; |
399 | 399 | |
400 | 400 | |
401 | - if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ): |
|
401 | + if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''): |
|
402 | 402 | |
403 | 403 | $class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text"; |
404 | 404 | |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | } |
414 | 414 | |
415 | 415 | |
416 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;">'; |
|
416 | + $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;">'; |
|
417 | 417 | |
418 | 418 | $html .= '<a class="twitter-timeline" data-height="600" data-dnt="true" href="https://twitter.com/'.$post->{$cf['htmlvar_name']}.'">Tweets by '.$post->{$cf['htmlvar_name']}.'</a> <script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>'; |
419 | 419 | $html .= '</div>'; |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | |
423 | 423 | return $html; |
424 | 424 | } |
425 | -add_filter('geodir_custom_field_output_text_key_twitter_feed','geodir_predefined_custom_field_output_twitter_feed',10,3); |
|
425 | +add_filter('geodir_custom_field_output_text_key_twitter_feed', 'geodir_predefined_custom_field_output_twitter_feed', 10, 3); |
|
426 | 426 | |
427 | 427 | /** |
428 | 428 | * Filter the get_directions custom field output to show a link. |
@@ -434,37 +434,37 @@ discard block |
||
434 | 434 | * @since 1.6.9 |
435 | 435 | * @return string The html to output. |
436 | 436 | */ |
437 | -function geodir_predefined_custom_field_output_get_directions($html,$location,$cf) { |
|
437 | +function geodir_predefined_custom_field_output_get_directions($html, $location, $cf) { |
|
438 | 438 | global $post; |
439 | 439 | |
440 | 440 | |
441 | - if ( isset( $post->{$cf['htmlvar_name']} ) && $post->{$cf['htmlvar_name']} != '' && isset( $post->post_latitude ) && $post->post_latitude ){ |
|
441 | + if (isset($post->{$cf['htmlvar_name']} ) && $post->{$cf['htmlvar_name']} != '' && isset($post->post_latitude) && $post->post_latitude) { |
|
442 | 442 | |
443 | - $field_icon = geodir_field_icon_proccess( $cf ); |
|
444 | - if ( strpos( $field_icon, 'http' ) !== false ) { |
|
443 | + $field_icon = geodir_field_icon_proccess($cf); |
|
444 | + if (strpos($field_icon, 'http') !== false) { |
|
445 | 445 | $field_icon_af = ''; |
446 | - } elseif ( $field_icon == '' ) { |
|
446 | + } elseif ($field_icon == '') { |
|
447 | 447 | $field_icon_af = '<i class="fa fa-location-arrow"></i>'; |
448 | 448 | } else { |
449 | 449 | $field_icon_af = $field_icon; |
450 | 450 | $field_icon = ''; |
451 | 451 | } |
452 | 452 | |
453 | - $link_text = isset( $post->{$cf['default_value']} ) ? $post->{$cf['default_value']} : __( 'Get Directions', 'geodirectory' ); |
|
453 | + $link_text = isset($post->{$cf['default_value']} ) ? $post->{$cf['default_value']} : __('Get Directions', 'geodirectory'); |
|
454 | 454 | |
455 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;">'; |
|
455 | + $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;">'; |
|
456 | 456 | |
457 | - if(isset( $cf['field_icon'] ) && $cf['field_icon']){ |
|
457 | + if (isset($cf['field_icon']) && $cf['field_icon']) { |
|
458 | 458 | $html .= $field_icon_af; |
459 | 459 | } |
460 | 460 | |
461 | - $html .= '<a href="https://www.google.com/maps/dir//\'' . $post->post_latitude . ',' . $post->post_longitude . '\'/" target="_blank" >' . $link_text . '</a>'; |
|
461 | + $html .= '<a href="https://www.google.com/maps/dir//\''.$post->post_latitude.','.$post->post_longitude.'\'/" target="_blank" >'.$link_text.'</a>'; |
|
462 | 462 | $html .= '</div>'; |
463 | 463 | |
464 | - }else{ |
|
465 | - $html =''; |
|
464 | + } else { |
|
465 | + $html = ''; |
|
466 | 466 | } |
467 | 467 | |
468 | 468 | return $html; |
469 | 469 | } |
470 | -add_filter('geodir_custom_field_output_text_key_get_directions','geodir_predefined_custom_field_output_get_directions',10,3); |
|
470 | +add_filter('geodir_custom_field_output_text_key_get_directions', 'geodir_predefined_custom_field_output_get_directions', 10, 3); |
@@ -10,21 +10,21 @@ |
||
10 | 10 | |
11 | 11 | // Exit if accessed directly. |
12 | 12 | if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
13 | - exit; |
|
13 | + exit; |
|
14 | 14 | } |
15 | 15 | |
16 | 16 | global $wpdb; |
17 | 17 | |
18 | 18 | if (get_option('geodir_un_geodirectory')) { |
19 | - $wpdb->hide_errors(); |
|
19 | + $wpdb->hide_errors(); |
|
20 | 20 | |
21 | - /* |
|
21 | + /* |
|
22 | 22 | if (!defined('GEODIRECTORY_VERSION')) { |
23 | 23 | // Load plugin file. |
24 | 24 | include_once('geodirectory.php'); |
25 | 25 | } |
26 | 26 | */ |
27 | 27 | |
28 | - // Delete default data. |
|
29 | - delete_option('geodir_default_data_installed'); |
|
28 | + // Delete default data. |
|
29 | + delete_option('geodir_default_data_installed'); |
|
30 | 30 | } |
31 | 31 | \ No newline at end of file |
@@ -9,7 +9,7 @@ |
||
9 | 9 | */ |
10 | 10 | |
11 | 11 | // Exit if accessed directly. |
12 | -if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
|
12 | +if (!defined('WP_UNINSTALL_PLUGIN')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 |
@@ -15,296 +15,296 @@ discard block |
||
15 | 15 | */ |
16 | 16 | function geodir_register_sidebar() |
17 | 17 | { |
18 | - global $geodir_sidebars; |
|
19 | - |
|
20 | - if (function_exists('register_sidebar')) { |
|
21 | - /*===========================*/ |
|
22 | - /* Home page sidebars start*/ |
|
23 | - /*===========================*/ |
|
24 | - |
|
25 | - /** |
|
26 | - * Filter the `$before_widget` widget opening HTML tag. |
|
27 | - * |
|
28 | - * @since 1.0.0 |
|
29 | - * @param string $var The HTML string to filter. Default = '<section id="%1$s" class="widget geodir-widget %2$s">'. |
|
30 | - * @see 'geodir_after_widget' |
|
31 | - */ |
|
32 | - $before_widget = apply_filters('geodir_before_widget', '<section id="%1$s" class="widget geodir-widget %2$s">'); |
|
33 | - /** |
|
34 | - * Filter the `$after_widget` widget closing HTML tag. |
|
35 | - * |
|
36 | - * @since 1.0.0 |
|
37 | - * @param string $var The HTML string to filter. Default = '</section>'. |
|
38 | - * @see 'geodir_before_widget' |
|
39 | - */ |
|
40 | - $after_widget = apply_filters('geodir_after_widget', '</section>'); |
|
41 | - /** |
|
42 | - * Filter the `$before_title` widget title opening HTML tag. |
|
43 | - * |
|
44 | - * @since 1.0.0 |
|
45 | - * @param string $var The HTML string to filter. Default = '<h3 class="widget-title">'. |
|
46 | - * @see 'geodir_after_title' |
|
47 | - */ |
|
48 | - $before_title = apply_filters('geodir_before_title', '<h3 class="widget-title">'); |
|
49 | - /** |
|
50 | - * Filter the `$after_title` widget title closing HTML tag. |
|
51 | - * |
|
52 | - * @since 1.0.0 |
|
53 | - * @param string $var The HTML string to filter. Default = '</h3>'. |
|
54 | - * @see 'geodir_before_title' |
|
55 | - */ |
|
56 | - $after_title = apply_filters('geodir_after_title', '</h3>'); |
|
57 | - |
|
58 | - if (get_option('geodir_show_home_top_section')) { |
|
59 | - register_sidebars(1, array('id' => 'geodir_home_top', 'name' => __('GD Home Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
60 | - |
|
61 | - $geodir_sidebars[] = 'geodir_home_top'; |
|
62 | - } |
|
63 | - |
|
64 | - if (get_option('geodir_show_home_contant_section')) { |
|
65 | - register_sidebars(1, array('id' => 'geodir_home_content', 'name' => __('GD Home Content Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
18 | + global $geodir_sidebars; |
|
66 | 19 | |
67 | - $geodir_sidebars[] = 'geodir_home_content'; |
|
68 | - } |
|
20 | + if (function_exists('register_sidebar')) { |
|
21 | + /*===========================*/ |
|
22 | + /* Home page sidebars start*/ |
|
23 | + /*===========================*/ |
|
69 | 24 | |
70 | - if (get_option('geodir_show_home_right_section')) { |
|
71 | - register_sidebars(1, array('id' => 'geodir_home_right', 'name' => __('GD Home Right Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
25 | + /** |
|
26 | + * Filter the `$before_widget` widget opening HTML tag. |
|
27 | + * |
|
28 | + * @since 1.0.0 |
|
29 | + * @param string $var The HTML string to filter. Default = '<section id="%1$s" class="widget geodir-widget %2$s">'. |
|
30 | + * @see 'geodir_after_widget' |
|
31 | + */ |
|
32 | + $before_widget = apply_filters('geodir_before_widget', '<section id="%1$s" class="widget geodir-widget %2$s">'); |
|
33 | + /** |
|
34 | + * Filter the `$after_widget` widget closing HTML tag. |
|
35 | + * |
|
36 | + * @since 1.0.0 |
|
37 | + * @param string $var The HTML string to filter. Default = '</section>'. |
|
38 | + * @see 'geodir_before_widget' |
|
39 | + */ |
|
40 | + $after_widget = apply_filters('geodir_after_widget', '</section>'); |
|
41 | + /** |
|
42 | + * Filter the `$before_title` widget title opening HTML tag. |
|
43 | + * |
|
44 | + * @since 1.0.0 |
|
45 | + * @param string $var The HTML string to filter. Default = '<h3 class="widget-title">'. |
|
46 | + * @see 'geodir_after_title' |
|
47 | + */ |
|
48 | + $before_title = apply_filters('geodir_before_title', '<h3 class="widget-title">'); |
|
49 | + /** |
|
50 | + * Filter the `$after_title` widget title closing HTML tag. |
|
51 | + * |
|
52 | + * @since 1.0.0 |
|
53 | + * @param string $var The HTML string to filter. Default = '</h3>'. |
|
54 | + * @see 'geodir_before_title' |
|
55 | + */ |
|
56 | + $after_title = apply_filters('geodir_after_title', '</h3>'); |
|
57 | + |
|
58 | + if (get_option('geodir_show_home_top_section')) { |
|
59 | + register_sidebars(1, array('id' => 'geodir_home_top', 'name' => __('GD Home Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
72 | 60 | |
73 | - $geodir_sidebars[] = 'geodir_home_right'; |
|
74 | - } |
|
61 | + $geodir_sidebars[] = 'geodir_home_top'; |
|
62 | + } |
|
75 | 63 | |
76 | - if (get_option('geodir_show_home_left_section')) { |
|
77 | - register_sidebars(1, array('id' => 'geodir_home_left', 'name' => __('GD Home Left Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
64 | + if (get_option('geodir_show_home_contant_section')) { |
|
65 | + register_sidebars(1, array('id' => 'geodir_home_content', 'name' => __('GD Home Content Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
78 | 66 | |
79 | - $geodir_sidebars[] = 'geodir_home_left'; |
|
80 | - } |
|
67 | + $geodir_sidebars[] = 'geodir_home_content'; |
|
68 | + } |
|
81 | 69 | |
82 | - if (get_option('geodir_show_home_bottom_section')) { |
|
83 | - register_sidebars(1, array('id' => 'geodir_home_bottom', 'name' => __('GD Home Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
70 | + if (get_option('geodir_show_home_right_section')) { |
|
71 | + register_sidebars(1, array('id' => 'geodir_home_right', 'name' => __('GD Home Right Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
84 | 72 | |
85 | - $geodir_sidebars[] = 'geodir_home_bottom'; |
|
86 | - } |
|
73 | + $geodir_sidebars[] = 'geodir_home_right'; |
|
74 | + } |
|
87 | 75 | |
88 | - /*===========================*/ |
|
89 | - /* Home page sidebars end*/ |
|
90 | - /*===========================*/ |
|
76 | + if (get_option('geodir_show_home_left_section')) { |
|
77 | + register_sidebars(1, array('id' => 'geodir_home_left', 'name' => __('GD Home Left Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
91 | 78 | |
92 | - /*===========================*/ |
|
93 | - /* Listing page sidebars start*/ |
|
94 | - /*===========================*/ |
|
79 | + $geodir_sidebars[] = 'geodir_home_left'; |
|
80 | + } |
|
95 | 81 | |
96 | - if (get_option('geodir_show_listing_top_section')) { |
|
97 | - register_sidebars(1, array('id' => 'geodir_listing_top', 'name' => __('GD Listing Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
82 | + if (get_option('geodir_show_home_bottom_section')) { |
|
83 | + register_sidebars(1, array('id' => 'geodir_home_bottom', 'name' => __('GD Home Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
98 | 84 | |
99 | - $geodir_sidebars[] = 'geodir_listing_top'; |
|
100 | - } |
|
85 | + $geodir_sidebars[] = 'geodir_home_bottom'; |
|
86 | + } |
|
101 | 87 | |
102 | - if (get_option('geodir_show_listing_left_section')) { |
|
103 | - register_sidebars(1, array('id' => 'geodir_listing_left_sidebar', 'name' => __('GD Listing Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
88 | + /*===========================*/ |
|
89 | + /* Home page sidebars end*/ |
|
90 | + /*===========================*/ |
|
104 | 91 | |
105 | - $geodir_sidebars[] = 'geodir_listing_left_sidebar'; |
|
106 | - } |
|
92 | + /*===========================*/ |
|
93 | + /* Listing page sidebars start*/ |
|
94 | + /*===========================*/ |
|
107 | 95 | |
108 | - if (get_option('geodir_show_listing_right_section')) { |
|
109 | - register_sidebars(1, array('id' => 'geodir_listing_right_sidebar', 'name' => __('GD Listing Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
96 | + if (get_option('geodir_show_listing_top_section')) { |
|
97 | + register_sidebars(1, array('id' => 'geodir_listing_top', 'name' => __('GD Listing Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
110 | 98 | |
111 | - $geodir_sidebars[] = 'geodir_listing_right_sidebar'; |
|
112 | - } |
|
99 | + $geodir_sidebars[] = 'geodir_listing_top'; |
|
100 | + } |
|
113 | 101 | |
114 | - if (get_option('geodir_show_listing_bottom_section')) { |
|
115 | - register_sidebars(1, array('id' => 'geodir_listing_bottom', 'name' => __('GD Listing Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
102 | + if (get_option('geodir_show_listing_left_section')) { |
|
103 | + register_sidebars(1, array('id' => 'geodir_listing_left_sidebar', 'name' => __('GD Listing Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
116 | 104 | |
117 | - $geodir_sidebars[] = 'geodir_listing_bottom'; |
|
118 | - } |
|
105 | + $geodir_sidebars[] = 'geodir_listing_left_sidebar'; |
|
106 | + } |
|
119 | 107 | |
120 | - /*===========================*/ |
|
121 | - /* Listing page sidebars start*/ |
|
122 | - /*===========================*/ |
|
108 | + if (get_option('geodir_show_listing_right_section')) { |
|
109 | + register_sidebars(1, array('id' => 'geodir_listing_right_sidebar', 'name' => __('GD Listing Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
123 | 110 | |
124 | - /*===========================*/ |
|
125 | - /* Search page sidebars start*/ |
|
126 | - /*===========================*/ |
|
111 | + $geodir_sidebars[] = 'geodir_listing_right_sidebar'; |
|
112 | + } |
|
127 | 113 | |
128 | - if (get_option('geodir_show_search_top_section')) { |
|
129 | - register_sidebars(1, array('id' => 'geodir_search_top', 'name' => __('GD Search Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
114 | + if (get_option('geodir_show_listing_bottom_section')) { |
|
115 | + register_sidebars(1, array('id' => 'geodir_listing_bottom', 'name' => __('GD Listing Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
130 | 116 | |
131 | - $geodir_sidebars[] = 'geodir_search_top'; |
|
132 | - } |
|
117 | + $geodir_sidebars[] = 'geodir_listing_bottom'; |
|
118 | + } |
|
133 | 119 | |
134 | - if (get_option('geodir_show_search_left_section')) { |
|
135 | - register_sidebars(1, array('id' => 'geodir_search_left_sidebar', 'name' => __('GD Search Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
120 | + /*===========================*/ |
|
121 | + /* Listing page sidebars start*/ |
|
122 | + /*===========================*/ |
|
136 | 123 | |
137 | - $geodir_sidebars[] = 'geodir_search_left_sidebar'; |
|
138 | - } |
|
124 | + /*===========================*/ |
|
125 | + /* Search page sidebars start*/ |
|
126 | + /*===========================*/ |
|
139 | 127 | |
140 | - if (get_option('geodir_show_search_right_section')) { |
|
141 | - register_sidebars(1, array('id' => 'geodir_search_right_sidebar', 'name' => __('GD Search Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
128 | + if (get_option('geodir_show_search_top_section')) { |
|
129 | + register_sidebars(1, array('id' => 'geodir_search_top', 'name' => __('GD Search Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
142 | 130 | |
143 | - $geodir_sidebars[] = 'geodir_search_right_sidebar'; |
|
144 | - } |
|
131 | + $geodir_sidebars[] = 'geodir_search_top'; |
|
132 | + } |
|
145 | 133 | |
146 | - if (get_option('geodir_show_search_bottom_section')) { |
|
147 | - register_sidebars(1, array('id' => 'geodir_search_bottom', 'name' => __('GD Search Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
134 | + if (get_option('geodir_show_search_left_section')) { |
|
135 | + register_sidebars(1, array('id' => 'geodir_search_left_sidebar', 'name' => __('GD Search Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
148 | 136 | |
149 | - $geodir_sidebars[] = 'geodir_search_bottom'; |
|
150 | - } |
|
137 | + $geodir_sidebars[] = 'geodir_search_left_sidebar'; |
|
138 | + } |
|
151 | 139 | |
152 | - /*===========================*/ |
|
153 | - /* Search page sidebars end*/ |
|
154 | - /*===========================*/ |
|
140 | + if (get_option('geodir_show_search_right_section')) { |
|
141 | + register_sidebars(1, array('id' => 'geodir_search_right_sidebar', 'name' => __('GD Search Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
155 | 142 | |
156 | - /*==================================*/ |
|
157 | - /* Detail/Single page sidebars start*/ |
|
158 | - /*==================================*/ |
|
159 | - if (get_option('geodir_show_detail_top_section')) { |
|
160 | - register_sidebars(1, array('id' => 'geodir_detail_top', 'name' => __('GD Detail Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
143 | + $geodir_sidebars[] = 'geodir_search_right_sidebar'; |
|
144 | + } |
|
161 | 145 | |
162 | - $geodir_sidebars[] = 'geodir_detail_top'; |
|
163 | - } |
|
146 | + if (get_option('geodir_show_search_bottom_section')) { |
|
147 | + register_sidebars(1, array('id' => 'geodir_search_bottom', 'name' => __('GD Search Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
164 | 148 | |
165 | - register_sidebars(1, array('id' => 'geodir_detail_sidebar', 'name' => __('GD Detail Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
149 | + $geodir_sidebars[] = 'geodir_search_bottom'; |
|
150 | + } |
|
166 | 151 | |
167 | - $geodir_sidebars[] = 'geodir_detail_sidebar'; |
|
152 | + /*===========================*/ |
|
153 | + /* Search page sidebars end*/ |
|
154 | + /*===========================*/ |
|
168 | 155 | |
169 | - if (get_option('geodir_show_detail_bottom_section')) { |
|
170 | - register_sidebars(1, array('id' => 'geodir_detail_bottom', 'name' => __('GD Detail Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
156 | + /*==================================*/ |
|
157 | + /* Detail/Single page sidebars start*/ |
|
158 | + /*==================================*/ |
|
159 | + if (get_option('geodir_show_detail_top_section')) { |
|
160 | + register_sidebars(1, array('id' => 'geodir_detail_top', 'name' => __('GD Detail Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
171 | 161 | |
172 | - $geodir_sidebars[] = 'geodir_detail_bottom'; |
|
173 | - } |
|
162 | + $geodir_sidebars[] = 'geodir_detail_top'; |
|
163 | + } |
|
174 | 164 | |
175 | - /*==================================*/ |
|
176 | - /* Detail/Single page sidebars end*/ |
|
177 | - /*==================================*/ |
|
165 | + register_sidebars(1, array('id' => 'geodir_detail_sidebar', 'name' => __('GD Detail Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
178 | 166 | |
179 | - /*==================================*/ |
|
180 | - /* Author page sidebars start */ |
|
181 | - /*==================================*/ |
|
167 | + $geodir_sidebars[] = 'geodir_detail_sidebar'; |
|
182 | 168 | |
183 | - if (get_option('geodir_show_author_top_section')) { |
|
184 | - register_sidebars(1, array('id' => 'geodir_author_top', 'name' => __('GD Author Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
169 | + if (get_option('geodir_show_detail_bottom_section')) { |
|
170 | + register_sidebars(1, array('id' => 'geodir_detail_bottom', 'name' => __('GD Detail Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
185 | 171 | |
186 | - $geodir_sidebars[] = 'geodir_author_top'; |
|
187 | - } |
|
172 | + $geodir_sidebars[] = 'geodir_detail_bottom'; |
|
173 | + } |
|
188 | 174 | |
189 | - if (get_option('geodir_show_author_left_section')) { |
|
190 | - register_sidebars(1, array('id' => 'geodir_author_left_sidebar', 'name' => __('GD Author Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
175 | + /*==================================*/ |
|
176 | + /* Detail/Single page sidebars end*/ |
|
177 | + /*==================================*/ |
|
191 | 178 | |
192 | - $geodir_sidebars[] = 'geodir_author_left_sidebar'; |
|
193 | - } |
|
179 | + /*==================================*/ |
|
180 | + /* Author page sidebars start */ |
|
181 | + /*==================================*/ |
|
194 | 182 | |
195 | - if (get_option('geodir_show_author_right_section')) { |
|
196 | - register_sidebars(1, array('id' => 'geodir_author_right_sidebar', 'name' => __('GD Author Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
183 | + if (get_option('geodir_show_author_top_section')) { |
|
184 | + register_sidebars(1, array('id' => 'geodir_author_top', 'name' => __('GD Author Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
197 | 185 | |
198 | - $geodir_sidebars[] = 'geodir_author_right_sidebar'; |
|
199 | - } |
|
186 | + $geodir_sidebars[] = 'geodir_author_top'; |
|
187 | + } |
|
200 | 188 | |
201 | - if (get_option('geodir_show_author_bottom_section')) { |
|
202 | - register_sidebars(1, array('id' => 'geodir_author_bottom', 'name' => __('GD Author Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
189 | + if (get_option('geodir_show_author_left_section')) { |
|
190 | + register_sidebars(1, array('id' => 'geodir_author_left_sidebar', 'name' => __('GD Author Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
203 | 191 | |
204 | - $geodir_sidebars[] = 'geodir_author_bottom'; |
|
205 | - } |
|
192 | + $geodir_sidebars[] = 'geodir_author_left_sidebar'; |
|
193 | + } |
|
206 | 194 | |
207 | - /*==================================*/ |
|
208 | - /* Author page sidebars end */ |
|
209 | - /*==================================*/ |
|
195 | + if (get_option('geodir_show_author_right_section')) { |
|
196 | + register_sidebars(1, array('id' => 'geodir_author_right_sidebar', 'name' => __('GD Author Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
210 | 197 | |
211 | - /*==================================*/ |
|
212 | - /* Add listing page sidebars start */ |
|
213 | - /*==================================*/ |
|
198 | + $geodir_sidebars[] = 'geodir_author_right_sidebar'; |
|
199 | + } |
|
214 | 200 | |
215 | - register_sidebars(1, array('id' => 'geodir_add_listing_sidebar', 'name' => __('GD Add Listing Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
201 | + if (get_option('geodir_show_author_bottom_section')) { |
|
202 | + register_sidebars(1, array('id' => 'geodir_author_bottom', 'name' => __('GD Author Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
216 | 203 | |
217 | - $geodir_sidebars[] = 'geodir_add_listing_sidebar'; |
|
204 | + $geodir_sidebars[] = 'geodir_author_bottom'; |
|
205 | + } |
|
218 | 206 | |
219 | - /*==================================*/ |
|
220 | - /* Add listing page sidebars end */ |
|
221 | - /*==================================*/ |
|
207 | + /*==================================*/ |
|
208 | + /* Author page sidebars end */ |
|
209 | + /*==================================*/ |
|
222 | 210 | |
223 | - } |
|
211 | + /*==================================*/ |
|
212 | + /* Add listing page sidebars start */ |
|
213 | + /*==================================*/ |
|
214 | + |
|
215 | + register_sidebars(1, array('id' => 'geodir_add_listing_sidebar', 'name' => __('GD Add Listing Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
216 | + |
|
217 | + $geodir_sidebars[] = 'geodir_add_listing_sidebar'; |
|
218 | + |
|
219 | + /*==================================*/ |
|
220 | + /* Add listing page sidebars end */ |
|
221 | + /*==================================*/ |
|
222 | + |
|
223 | + } |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | |
227 | 227 | if (!function_exists('register_geodir_widgets')) { |
228 | - /** |
|
229 | - * Registers all Widgets. |
|
230 | - * |
|
231 | - * @since 1.0.0 |
|
232 | - * @package GeoDirectory |
|
233 | - */ |
|
234 | - function register_geodir_widgets() |
|
235 | - { |
|
236 | - /** |
|
237 | - * Login Widget. |
|
238 | - * |
|
239 | - * @since 1.0.0 |
|
240 | - */ |
|
241 | - class geodir_loginwidget extends WP_Widget |
|
242 | - { |
|
243 | - /** |
|
244 | - * Register the login widget with WordPress. |
|
245 | - * |
|
246 | - * @since 1.0.0 |
|
247 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
248 | - */ |
|
249 | - public function __construct() { |
|
250 | - $widget_ops = array('classname' => 'geodir_loginbox', 'description' => __('Geodirectory Loginbox Widget', 'geodirectory')); |
|
251 | - parent::__construct( |
|
252 | - 'geodir_loginbox', // Base ID |
|
253 | - __('GD > Loginbox', 'geodirectory'), // Name |
|
254 | - $widget_ops// Args |
|
255 | - ); |
|
256 | - } |
|
257 | - |
|
258 | - /** |
|
259 | - * Front-end display content for login widget. |
|
260 | - * |
|
261 | - * @since 1.0.0 |
|
262 | - * @since 1.5.1 Declare function public. |
|
263 | - * |
|
264 | - * @param array $args Widget arguments. |
|
265 | - * @param array $instance Saved values from database. |
|
266 | - */ |
|
267 | - public function widget($args, $instance) |
|
268 | - { |
|
269 | - geodir_loginwidget_output($args, $instance); |
|
270 | - } |
|
271 | - |
|
272 | - /** |
|
273 | - * Sanitize login widget form values as they are saved. |
|
274 | - * |
|
275 | - * @since 1.0.0 |
|
276 | - * @since 1.5.1 Declare function public. |
|
277 | - * |
|
278 | - * @param array $new_instance Values just sent to be saved. |
|
279 | - * @param array $old_instance Previously saved values from database. |
|
280 | - * |
|
281 | - * @return array Updated safe values to be saved. |
|
282 | - */ |
|
283 | - public function update($new_instance, $old_instance) |
|
284 | - { |
|
285 | - //save the widget |
|
286 | - $instance = $old_instance; |
|
287 | - $instance['title'] = strip_tags($new_instance['title']); |
|
288 | - |
|
289 | - return $instance; |
|
290 | - } |
|
291 | - |
|
292 | - /** |
|
293 | - * Back-end login widget settings form. |
|
294 | - * |
|
295 | - * @since 1.0.0 |
|
296 | - * @since 1.5.1 Declare function public. |
|
297 | - * |
|
298 | - * @param array $instance Previously saved values from database. |
|
299 | - * @return string|void |
|
300 | - */ |
|
301 | - public function form($instance) |
|
302 | - { |
|
303 | - //widgetform in backend |
|
304 | - $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => '')); |
|
305 | - $title = strip_tags($instance['title']); |
|
306 | - |
|
307 | - ?> |
|
228 | + /** |
|
229 | + * Registers all Widgets. |
|
230 | + * |
|
231 | + * @since 1.0.0 |
|
232 | + * @package GeoDirectory |
|
233 | + */ |
|
234 | + function register_geodir_widgets() |
|
235 | + { |
|
236 | + /** |
|
237 | + * Login Widget. |
|
238 | + * |
|
239 | + * @since 1.0.0 |
|
240 | + */ |
|
241 | + class geodir_loginwidget extends WP_Widget |
|
242 | + { |
|
243 | + /** |
|
244 | + * Register the login widget with WordPress. |
|
245 | + * |
|
246 | + * @since 1.0.0 |
|
247 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
248 | + */ |
|
249 | + public function __construct() { |
|
250 | + $widget_ops = array('classname' => 'geodir_loginbox', 'description' => __('Geodirectory Loginbox Widget', 'geodirectory')); |
|
251 | + parent::__construct( |
|
252 | + 'geodir_loginbox', // Base ID |
|
253 | + __('GD > Loginbox', 'geodirectory'), // Name |
|
254 | + $widget_ops// Args |
|
255 | + ); |
|
256 | + } |
|
257 | + |
|
258 | + /** |
|
259 | + * Front-end display content for login widget. |
|
260 | + * |
|
261 | + * @since 1.0.0 |
|
262 | + * @since 1.5.1 Declare function public. |
|
263 | + * |
|
264 | + * @param array $args Widget arguments. |
|
265 | + * @param array $instance Saved values from database. |
|
266 | + */ |
|
267 | + public function widget($args, $instance) |
|
268 | + { |
|
269 | + geodir_loginwidget_output($args, $instance); |
|
270 | + } |
|
271 | + |
|
272 | + /** |
|
273 | + * Sanitize login widget form values as they are saved. |
|
274 | + * |
|
275 | + * @since 1.0.0 |
|
276 | + * @since 1.5.1 Declare function public. |
|
277 | + * |
|
278 | + * @param array $new_instance Values just sent to be saved. |
|
279 | + * @param array $old_instance Previously saved values from database. |
|
280 | + * |
|
281 | + * @return array Updated safe values to be saved. |
|
282 | + */ |
|
283 | + public function update($new_instance, $old_instance) |
|
284 | + { |
|
285 | + //save the widget |
|
286 | + $instance = $old_instance; |
|
287 | + $instance['title'] = strip_tags($new_instance['title']); |
|
288 | + |
|
289 | + return $instance; |
|
290 | + } |
|
291 | + |
|
292 | + /** |
|
293 | + * Back-end login widget settings form. |
|
294 | + * |
|
295 | + * @since 1.0.0 |
|
296 | + * @since 1.5.1 Declare function public. |
|
297 | + * |
|
298 | + * @param array $instance Previously saved values from database. |
|
299 | + * @return string|void |
|
300 | + */ |
|
301 | + public function form($instance) |
|
302 | + { |
|
303 | + //widgetform in backend |
|
304 | + $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => '')); |
|
305 | + $title = strip_tags($instance['title']); |
|
306 | + |
|
307 | + ?> |
|
308 | 308 | <p><label |
309 | 309 | for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Widget Title', 'geodirectory'); ?> |
310 | 310 | : <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" |
@@ -313,64 +313,64 @@ discard block |
||
313 | 313 | |
314 | 314 | |
315 | 315 | <?php |
316 | - } |
|
317 | - } |
|
318 | - |
|
319 | - register_widget('geodir_loginwidget'); |
|
320 | - |
|
321 | - |
|
322 | - /** |
|
323 | - * GeoDirectory Social Like Widget. |
|
324 | - * |
|
325 | - * @since 1.0.0 |
|
326 | - */ |
|
327 | - class geodir_social_like_widget extends WP_Widget |
|
328 | - { |
|
329 | - |
|
330 | - /** |
|
331 | - * Register the social like widget with WordPress. |
|
332 | - * |
|
333 | - * @since 1.0.0 |
|
334 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
335 | - */ |
|
336 | - public function __construct() { |
|
337 | - $widget_ops = array('classname' => 'geodir_social_like_widget', 'description' => __('GD > Twitter,Facebook and Google+ buttons', 'geodirectory')); |
|
338 | - parent::__construct( |
|
339 | - 'social_like_widget', // Base ID |
|
340 | - __('GD > Social Like', 'geodirectory'), // Name |
|
341 | - $widget_ops// Args |
|
342 | - ); |
|
343 | - } |
|
344 | - |
|
345 | - /** |
|
346 | - * Front-end display content for social like widget. |
|
347 | - * |
|
348 | - * @since 1.0.0 |
|
349 | - * @since 1.5.1 Declare function public. |
|
350 | - * |
|
351 | - * @param array $args Widget arguments. |
|
352 | - * @param array $instance Saved values from database. |
|
353 | - */ |
|
354 | - public function widget($args, $instance) |
|
355 | - { |
|
356 | - // prints the widget |
|
357 | - extract($args, EXTR_SKIP); |
|
358 | - |
|
359 | - /** |
|
360 | - * Filter the widget title text. |
|
361 | - * |
|
362 | - * @since 1.0.0 |
|
363 | - * @global object $current_user Current user object. |
|
364 | - * @param string $title The widget title text. |
|
365 | - */ |
|
366 | - $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']); |
|
367 | - |
|
368 | - global $current_user, $post; |
|
369 | - echo $before_widget; |
|
370 | - ?> |
|
316 | + } |
|
317 | + } |
|
318 | + |
|
319 | + register_widget('geodir_loginwidget'); |
|
320 | + |
|
321 | + |
|
322 | + /** |
|
323 | + * GeoDirectory Social Like Widget. |
|
324 | + * |
|
325 | + * @since 1.0.0 |
|
326 | + */ |
|
327 | + class geodir_social_like_widget extends WP_Widget |
|
328 | + { |
|
329 | + |
|
330 | + /** |
|
331 | + * Register the social like widget with WordPress. |
|
332 | + * |
|
333 | + * @since 1.0.0 |
|
334 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
335 | + */ |
|
336 | + public function __construct() { |
|
337 | + $widget_ops = array('classname' => 'geodir_social_like_widget', 'description' => __('GD > Twitter,Facebook and Google+ buttons', 'geodirectory')); |
|
338 | + parent::__construct( |
|
339 | + 'social_like_widget', // Base ID |
|
340 | + __('GD > Social Like', 'geodirectory'), // Name |
|
341 | + $widget_ops// Args |
|
342 | + ); |
|
343 | + } |
|
344 | + |
|
345 | + /** |
|
346 | + * Front-end display content for social like widget. |
|
347 | + * |
|
348 | + * @since 1.0.0 |
|
349 | + * @since 1.5.1 Declare function public. |
|
350 | + * |
|
351 | + * @param array $args Widget arguments. |
|
352 | + * @param array $instance Saved values from database. |
|
353 | + */ |
|
354 | + public function widget($args, $instance) |
|
355 | + { |
|
356 | + // prints the widget |
|
357 | + extract($args, EXTR_SKIP); |
|
358 | + |
|
359 | + /** |
|
360 | + * Filter the widget title text. |
|
361 | + * |
|
362 | + * @since 1.0.0 |
|
363 | + * @global object $current_user Current user object. |
|
364 | + * @param string $title The widget title text. |
|
365 | + */ |
|
366 | + $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']); |
|
367 | + |
|
368 | + global $current_user, $post; |
|
369 | + echo $before_widget; |
|
370 | + ?> |
|
371 | 371 | |
372 | 372 | <?php //if ( get_option('gd_tweet_button') ) { |
373 | - ?> |
|
373 | + ?> |
|
374 | 374 | |
375 | 375 | <a href="http://twitter.com/share" |
376 | 376 | class="twitter-share-button"><?php _e('Tweet', 'geodirectory');?></a> |
@@ -378,23 +378,23 @@ discard block |
||
378 | 378 | <script type="text/javascript" src="//platform.twitter.com/widgets.js"></script> |
379 | 379 | |
380 | 380 | <?php //} |
381 | - ?> |
|
381 | + ?> |
|
382 | 382 | |
383 | 383 | <?php // if ( get_option('gd_facebook_button') ) { |
384 | - ?> |
|
384 | + ?> |
|
385 | 385 | |
386 | 386 | <iframe <?php if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) { |
387 | - echo 'allowtransparency="true"'; |
|
388 | - }?> class="facebook" |
|
387 | + echo 'allowtransparency="true"'; |
|
388 | + }?> class="facebook" |
|
389 | 389 | src="//www.facebook.com/plugins/like.php?href=<?php echo urlencode(geodir_curPageURL()); ?>&layout=button_count&show_faces=false&width=100&action=like&colorscheme=light" |
390 | 390 | style="border:none; overflow:hidden; width:100px; height:20px"></iframe> |
391 | 391 | |
392 | 392 | |
393 | 393 | <?php //} |
394 | - ?> |
|
394 | + ?> |
|
395 | 395 | |
396 | 396 | <?php //if ( get_option('gd_google_button') ) { |
397 | - ?> |
|
397 | + ?> |
|
398 | 398 | <script> |
399 | 399 | window.___gcfg = { |
400 | 400 | parsetags: 'explicit' |
@@ -408,118 +408,118 @@ discard block |
||
408 | 408 | "count": "true" |
409 | 409 | });</script> |
410 | 410 | <?php //} |
411 | - echo $after_widget; |
|
412 | - |
|
413 | - } |
|
414 | - |
|
415 | - /** |
|
416 | - * Sanitize social like widget form values as they are saved. |
|
417 | - * |
|
418 | - * @since 1.0.0 |
|
419 | - * @since 1.5.1 Declare function public. |
|
420 | - * |
|
421 | - * @param array $new_instance Values just sent to be saved. |
|
422 | - * @param array $old_instance Previously saved values from database. |
|
423 | - * |
|
424 | - * @return array Updated safe values to be saved. |
|
425 | - */ |
|
426 | - public function update($new_instance, $old_instance) |
|
427 | - { |
|
428 | - //save the widget |
|
429 | - $instance = $old_instance; |
|
430 | - $instance['title'] = strip_tags($new_instance['title']); |
|
431 | - return $instance; |
|
432 | - } |
|
433 | - |
|
434 | - /** |
|
435 | - * Back-end social like widget settings form. |
|
436 | - * |
|
437 | - * @since 1.0.0 |
|
438 | - * @since 1.5.1 Declare function public. |
|
439 | - * |
|
440 | - * @param array $instance Previously saved values from database. |
|
441 | - * @return string|void |
|
442 | - */ |
|
443 | - public function form($instance) |
|
444 | - { |
|
445 | - //widgetform in backend |
|
446 | - $instance = wp_parse_args((array)$instance, array('title' => '')); |
|
447 | - $title = strip_tags($instance['title']); |
|
448 | - ?> |
|
411 | + echo $after_widget; |
|
412 | + |
|
413 | + } |
|
414 | + |
|
415 | + /** |
|
416 | + * Sanitize social like widget form values as they are saved. |
|
417 | + * |
|
418 | + * @since 1.0.0 |
|
419 | + * @since 1.5.1 Declare function public. |
|
420 | + * |
|
421 | + * @param array $new_instance Values just sent to be saved. |
|
422 | + * @param array $old_instance Previously saved values from database. |
|
423 | + * |
|
424 | + * @return array Updated safe values to be saved. |
|
425 | + */ |
|
426 | + public function update($new_instance, $old_instance) |
|
427 | + { |
|
428 | + //save the widget |
|
429 | + $instance = $old_instance; |
|
430 | + $instance['title'] = strip_tags($new_instance['title']); |
|
431 | + return $instance; |
|
432 | + } |
|
433 | + |
|
434 | + /** |
|
435 | + * Back-end social like widget settings form. |
|
436 | + * |
|
437 | + * @since 1.0.0 |
|
438 | + * @since 1.5.1 Declare function public. |
|
439 | + * |
|
440 | + * @param array $instance Previously saved values from database. |
|
441 | + * @return string|void |
|
442 | + */ |
|
443 | + public function form($instance) |
|
444 | + { |
|
445 | + //widgetform in backend |
|
446 | + $instance = wp_parse_args((array)$instance, array('title' => '')); |
|
447 | + $title = strip_tags($instance['title']); |
|
448 | + ?> |
|
449 | 449 | <p>No settings for this widget</p> |
450 | 450 | |
451 | 451 | |
452 | 452 | <?php |
453 | - } |
|
454 | - } |
|
455 | - |
|
456 | - register_widget('geodir_social_like_widget'); |
|
457 | - |
|
458 | - |
|
459 | - /** |
|
460 | - * GeoDirectory Feedburner Subscribe widget. |
|
461 | - * |
|
462 | - * @since 1.0.0 |
|
463 | - */ |
|
464 | - class geodirsubscribeWidget extends WP_Widget |
|
465 | - { |
|
466 | - |
|
467 | - /** |
|
468 | - * Register the feedburner subscribe widget with WordPress. |
|
469 | - * |
|
470 | - * @since 1.0.0 |
|
471 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
472 | - */ |
|
473 | - public function __construct() { |
|
474 | - $widget_ops = array('classname' => 'geodir-subscribe', 'description' => __('GD > Google Feedburner Subscribe', 'geodirectory')); |
|
475 | - parent::__construct( |
|
476 | - 'widget_subscribeWidget', // Base ID |
|
477 | - __('GD > Subscribe', 'geodirectory'), // Name |
|
478 | - $widget_ops// Args |
|
479 | - ); |
|
480 | - } |
|
481 | - |
|
482 | - /** |
|
483 | - * Front-end display content for feedburner subscribe widget. |
|
484 | - * |
|
485 | - * @since 1.0.0 |
|
486 | - * @since 1.5.1 Declare function public. |
|
487 | - * |
|
488 | - * @param array $args Widget arguments. |
|
489 | - * @param array $instance Saved values from database. |
|
490 | - */ |
|
491 | - public function widget($args, $instance) |
|
492 | - { |
|
493 | - // prints the widget |
|
494 | - extract($args, EXTR_SKIP); |
|
495 | - |
|
496 | - /** |
|
497 | - * Filter the widget instance id. |
|
498 | - * |
|
499 | - * @since 1.0.0 |
|
500 | - * @param string $id The widget instance id. |
|
501 | - */ |
|
502 | - $id = empty($instance['id']) ? '' : apply_filters('widget_id', $instance['id']); |
|
503 | - |
|
504 | - /** This filter is documented in geodirectory_widgets.php */ |
|
505 | - $title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory')); |
|
506 | - |
|
507 | - /** |
|
508 | - * Filter the widget text. |
|
509 | - * |
|
510 | - * @since 1.0.0 |
|
511 | - * @param string $text The widget text. |
|
512 | - */ |
|
513 | - $text = empty($instance['text']) ? '' : apply_filters('widget_text', $instance['text']); |
|
514 | - |
|
515 | - echo $before_widget; |
|
516 | - ?> |
|
453 | + } |
|
454 | + } |
|
455 | + |
|
456 | + register_widget('geodir_social_like_widget'); |
|
457 | + |
|
458 | + |
|
459 | + /** |
|
460 | + * GeoDirectory Feedburner Subscribe widget. |
|
461 | + * |
|
462 | + * @since 1.0.0 |
|
463 | + */ |
|
464 | + class geodirsubscribeWidget extends WP_Widget |
|
465 | + { |
|
466 | + |
|
467 | + /** |
|
468 | + * Register the feedburner subscribe widget with WordPress. |
|
469 | + * |
|
470 | + * @since 1.0.0 |
|
471 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
472 | + */ |
|
473 | + public function __construct() { |
|
474 | + $widget_ops = array('classname' => 'geodir-subscribe', 'description' => __('GD > Google Feedburner Subscribe', 'geodirectory')); |
|
475 | + parent::__construct( |
|
476 | + 'widget_subscribeWidget', // Base ID |
|
477 | + __('GD > Subscribe', 'geodirectory'), // Name |
|
478 | + $widget_ops// Args |
|
479 | + ); |
|
480 | + } |
|
481 | + |
|
482 | + /** |
|
483 | + * Front-end display content for feedburner subscribe widget. |
|
484 | + * |
|
485 | + * @since 1.0.0 |
|
486 | + * @since 1.5.1 Declare function public. |
|
487 | + * |
|
488 | + * @param array $args Widget arguments. |
|
489 | + * @param array $instance Saved values from database. |
|
490 | + */ |
|
491 | + public function widget($args, $instance) |
|
492 | + { |
|
493 | + // prints the widget |
|
494 | + extract($args, EXTR_SKIP); |
|
495 | + |
|
496 | + /** |
|
497 | + * Filter the widget instance id. |
|
498 | + * |
|
499 | + * @since 1.0.0 |
|
500 | + * @param string $id The widget instance id. |
|
501 | + */ |
|
502 | + $id = empty($instance['id']) ? '' : apply_filters('widget_id', $instance['id']); |
|
503 | + |
|
504 | + /** This filter is documented in geodirectory_widgets.php */ |
|
505 | + $title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory')); |
|
506 | + |
|
507 | + /** |
|
508 | + * Filter the widget text. |
|
509 | + * |
|
510 | + * @since 1.0.0 |
|
511 | + * @param string $text The widget text. |
|
512 | + */ |
|
513 | + $text = empty($instance['text']) ? '' : apply_filters('widget_text', $instance['text']); |
|
514 | + |
|
515 | + echo $before_widget; |
|
516 | + ?> |
|
517 | 517 | |
518 | 518 | <?php echo $before_title . $title; ?> <a href="<?php if ($id) { |
519 | - echo 'http://feeds2.feedburner.com/' . $id; |
|
520 | - } else { |
|
521 | - bloginfo('rss_url'); |
|
522 | - } ?>"><i class="fa fa-rss-square"></i> </a><?php echo $after_title;?> |
|
519 | + echo 'http://feeds2.feedburner.com/' . $id; |
|
520 | + } else { |
|
521 | + bloginfo('rss_url'); |
|
522 | + } ?>"><i class="fa fa-rss-square"></i> </a><?php echo $after_title;?> |
|
523 | 523 | |
524 | 524 | <?php if ($text <> "") { ?> |
525 | 525 | |
@@ -544,57 +544,57 @@ discard block |
||
544 | 544 | </form> |
545 | 545 | |
546 | 546 | <?php |
547 | - echo $after_widget; |
|
547 | + echo $after_widget; |
|
548 | 548 | |
549 | - } |
|
549 | + } |
|
550 | 550 | |
551 | - /** |
|
552 | - * Sanitize feedburner subscribe widget form values as they are saved. |
|
553 | - * |
|
554 | - * @since 1.0.0 |
|
555 | - * @since 1.5.1 Declare function public. |
|
556 | - * |
|
557 | - * @param array $new_instance Values just sent to be saved. |
|
558 | - * @param array $old_instance Previously saved values from database. |
|
559 | - * |
|
560 | - * @return array Updated safe values to be saved. |
|
561 | - */ |
|
562 | - public function update($new_instance, $old_instance) |
|
563 | - { |
|
551 | + /** |
|
552 | + * Sanitize feedburner subscribe widget form values as they are saved. |
|
553 | + * |
|
554 | + * @since 1.0.0 |
|
555 | + * @since 1.5.1 Declare function public. |
|
556 | + * |
|
557 | + * @param array $new_instance Values just sent to be saved. |
|
558 | + * @param array $old_instance Previously saved values from database. |
|
559 | + * |
|
560 | + * @return array Updated safe values to be saved. |
|
561 | + */ |
|
562 | + public function update($new_instance, $old_instance) |
|
563 | + { |
|
564 | 564 | |
565 | - //save the widget |
|
566 | - $instance = $old_instance; |
|
567 | - $instance['id'] = strip_tags($new_instance['id']); |
|
568 | - $instance['title'] = ($new_instance['title']); |
|
569 | - $instance['text'] = ($new_instance['text']); |
|
565 | + //save the widget |
|
566 | + $instance = $old_instance; |
|
567 | + $instance['id'] = strip_tags($new_instance['id']); |
|
568 | + $instance['title'] = ($new_instance['title']); |
|
569 | + $instance['text'] = ($new_instance['text']); |
|
570 | 570 | |
571 | 571 | |
572 | - return $instance; |
|
573 | - } |
|
572 | + return $instance; |
|
573 | + } |
|
574 | 574 | |
575 | - /** |
|
576 | - * Back-end feedburner subscribe widget settings form. |
|
577 | - * |
|
578 | - * @since 1.0.0 |
|
579 | - * @since 1.5.1 Declare function public. |
|
580 | - * |
|
581 | - * @param array $instance Previously saved values from database. |
|
582 | - * @return string|void |
|
583 | - */ |
|
584 | - public function form($instance) |
|
585 | - { |
|
586 | - //widgetform in backend |
|
587 | - $instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'advt1' => '', 'text' => '', 'twitter' => '', 'facebook' => '', 'digg' => '', 'myspace' => '')); |
|
575 | + /** |
|
576 | + * Back-end feedburner subscribe widget settings form. |
|
577 | + * |
|
578 | + * @since 1.0.0 |
|
579 | + * @since 1.5.1 Declare function public. |
|
580 | + * |
|
581 | + * @param array $instance Previously saved values from database. |
|
582 | + * @return string|void |
|
583 | + */ |
|
584 | + public function form($instance) |
|
585 | + { |
|
586 | + //widgetform in backend |
|
587 | + $instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'advt1' => '', 'text' => '', 'twitter' => '', 'facebook' => '', 'digg' => '', 'myspace' => '')); |
|
588 | 588 | |
589 | - $id = strip_tags($instance['id']); |
|
589 | + $id = strip_tags($instance['id']); |
|
590 | 590 | |
591 | - $title = strip_tags($instance['title']); |
|
591 | + $title = strip_tags($instance['title']); |
|
592 | 592 | |
593 | - $text = strip_tags($instance['text']); |
|
593 | + $text = strip_tags($instance['text']); |
|
594 | 594 | |
595 | 595 | |
596 | 596 | |
597 | - ?> |
|
597 | + ?> |
|
598 | 598 | <p><label |
599 | 599 | for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title', 'geodirectory');?>: |
600 | 600 | <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" |
@@ -613,101 +613,101 @@ discard block |
||
613 | 613 | name="<?php echo $this->get_field_name('text'); ?>"><?php echo esc_attr($text); ?></textarea></label> |
614 | 614 | </p> |
615 | 615 | <?php |
616 | - } |
|
617 | - } |
|
618 | - |
|
619 | - register_widget('geodirsubscribeWidget'); |
|
620 | - |
|
621 | - /** |
|
622 | - * GeoDirectory advertise widget. |
|
623 | - * |
|
624 | - * @since 1.0.0 |
|
625 | - */ |
|
626 | - class geodiradvtwidget extends WP_Widget |
|
627 | - { |
|
628 | - |
|
629 | - /** |
|
630 | - * Register the advertise widget with WordPress. |
|
631 | - * |
|
632 | - * @since 1.0.0 |
|
633 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
634 | - */ |
|
635 | - public function __construct() { |
|
636 | - $widget_ops = array('classname' => 'GeoDirectory Advertise', 'description' => __('GD > common advertise widget in sidebar, bottom section', 'geodirectory')); |
|
637 | - parent::__construct( |
|
638 | - 'advtwidget', // Base ID |
|
639 | - __('GD > Advertise', 'geodirectory'), // Name |
|
640 | - $widget_ops// Args |
|
641 | - ); |
|
642 | - } |
|
643 | - |
|
644 | - |
|
645 | - /** |
|
646 | - * Front-end display content for advertise widget. |
|
647 | - * |
|
648 | - * @since 1.0.0 |
|
649 | - * @since 1.5.1 Declare function public. |
|
650 | - * |
|
651 | - * @param array $args Widget arguments. |
|
652 | - * @param array $instance Saved values from database. |
|
653 | - */ |
|
654 | - public function widget($args, $instance) |
|
655 | - { |
|
656 | - |
|
657 | - // prints the widget |
|
658 | - |
|
659 | - extract($args, EXTR_SKIP); |
|
660 | - |
|
661 | - /** |
|
662 | - * Filter the description text. |
|
663 | - * |
|
664 | - * @since 1.0.0 |
|
665 | - * @param string $desc1 The widget description text. |
|
666 | - */ |
|
667 | - $desc1 = empty($instance['desc1']) ? ' ' : apply_filters('widget_desc1', $instance['desc1']); |
|
668 | - echo $before_widget; |
|
669 | - ?> |
|
616 | + } |
|
617 | + } |
|
618 | + |
|
619 | + register_widget('geodirsubscribeWidget'); |
|
620 | + |
|
621 | + /** |
|
622 | + * GeoDirectory advertise widget. |
|
623 | + * |
|
624 | + * @since 1.0.0 |
|
625 | + */ |
|
626 | + class geodiradvtwidget extends WP_Widget |
|
627 | + { |
|
628 | + |
|
629 | + /** |
|
630 | + * Register the advertise widget with WordPress. |
|
631 | + * |
|
632 | + * @since 1.0.0 |
|
633 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
634 | + */ |
|
635 | + public function __construct() { |
|
636 | + $widget_ops = array('classname' => 'GeoDirectory Advertise', 'description' => __('GD > common advertise widget in sidebar, bottom section', 'geodirectory')); |
|
637 | + parent::__construct( |
|
638 | + 'advtwidget', // Base ID |
|
639 | + __('GD > Advertise', 'geodirectory'), // Name |
|
640 | + $widget_ops// Args |
|
641 | + ); |
|
642 | + } |
|
643 | + |
|
644 | + |
|
645 | + /** |
|
646 | + * Front-end display content for advertise widget. |
|
647 | + * |
|
648 | + * @since 1.0.0 |
|
649 | + * @since 1.5.1 Declare function public. |
|
650 | + * |
|
651 | + * @param array $args Widget arguments. |
|
652 | + * @param array $instance Saved values from database. |
|
653 | + */ |
|
654 | + public function widget($args, $instance) |
|
655 | + { |
|
656 | + |
|
657 | + // prints the widget |
|
658 | + |
|
659 | + extract($args, EXTR_SKIP); |
|
660 | + |
|
661 | + /** |
|
662 | + * Filter the description text. |
|
663 | + * |
|
664 | + * @since 1.0.0 |
|
665 | + * @param string $desc1 The widget description text. |
|
666 | + */ |
|
667 | + $desc1 = empty($instance['desc1']) ? ' ' : apply_filters('widget_desc1', $instance['desc1']); |
|
668 | + echo $before_widget; |
|
669 | + ?> |
|
670 | 670 | <?php if ($desc1 <> "") { ?> |
671 | 671 | <?php echo $desc1; ?> |
672 | 672 | <?php } |
673 | - echo $after_widget; |
|
674 | - } |
|
675 | - |
|
676 | - /** |
|
677 | - * Sanitize advertise widget form values as they are saved. |
|
678 | - * |
|
679 | - * @since 1.0.0 |
|
680 | - * @since 1.5.1 Declare function public. |
|
681 | - * |
|
682 | - * @param array $new_instance Values just sent to be saved. |
|
683 | - * @param array $old_instance Previously saved values from database. |
|
684 | - * |
|
685 | - * @return array Updated safe values to be saved. |
|
686 | - */ |
|
687 | - public function update($new_instance, $old_instance) |
|
688 | - { |
|
689 | - //save the widget |
|
690 | - $instance = $old_instance; |
|
691 | - $instance['desc1'] = ($new_instance['desc1']); |
|
692 | - return $instance; |
|
693 | - } |
|
694 | - |
|
695 | - /** |
|
696 | - * Back-end advertise widget settings form. |
|
697 | - * |
|
698 | - * @since 1.0.0 |
|
699 | - * @since 1.5.1 Declare function public. |
|
700 | - * |
|
701 | - * @param array $instance Previously saved values from database. |
|
702 | - * @return string|void |
|
703 | - */ |
|
704 | - public function form($instance) |
|
705 | - { |
|
706 | - //widgetform in backend |
|
707 | - $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => '')); |
|
708 | - |
|
709 | - $desc1 = ($instance['desc1']); |
|
710 | - ?> |
|
673 | + echo $after_widget; |
|
674 | + } |
|
675 | + |
|
676 | + /** |
|
677 | + * Sanitize advertise widget form values as they are saved. |
|
678 | + * |
|
679 | + * @since 1.0.0 |
|
680 | + * @since 1.5.1 Declare function public. |
|
681 | + * |
|
682 | + * @param array $new_instance Values just sent to be saved. |
|
683 | + * @param array $old_instance Previously saved values from database. |
|
684 | + * |
|
685 | + * @return array Updated safe values to be saved. |
|
686 | + */ |
|
687 | + public function update($new_instance, $old_instance) |
|
688 | + { |
|
689 | + //save the widget |
|
690 | + $instance = $old_instance; |
|
691 | + $instance['desc1'] = ($new_instance['desc1']); |
|
692 | + return $instance; |
|
693 | + } |
|
694 | + |
|
695 | + /** |
|
696 | + * Back-end advertise widget settings form. |
|
697 | + * |
|
698 | + * @since 1.0.0 |
|
699 | + * @since 1.5.1 Declare function public. |
|
700 | + * |
|
701 | + * @param array $instance Previously saved values from database. |
|
702 | + * @return string|void |
|
703 | + */ |
|
704 | + public function form($instance) |
|
705 | + { |
|
706 | + //widgetform in backend |
|
707 | + $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => '')); |
|
708 | + |
|
709 | + $desc1 = ($instance['desc1']); |
|
710 | + ?> |
|
711 | 711 | <p><label |
712 | 712 | for="<?php echo $this->get_field_id('desc1'); ?>"><?php _e('Your Advt code (ex.google adsense, etc.)', 'geodirectory');?> |
713 | 713 | <textarea class="widefat" rows="6" cols="20" id="<?php echo $this->get_field_id('desc1'); ?>" |
@@ -715,65 +715,65 @@ discard block |
||
715 | 715 | </p> |
716 | 716 | |
717 | 717 | <?php |
718 | - } |
|
719 | - } |
|
720 | - |
|
721 | - register_widget('geodiradvtwidget'); |
|
722 | - |
|
723 | - /** |
|
724 | - * GeoDirectory Flickr widget. |
|
725 | - * |
|
726 | - * @since 1.0.0 |
|
727 | - */ |
|
728 | - class GeodirFlickrWidget extends WP_Widget |
|
729 | - { |
|
730 | - |
|
731 | - /** |
|
732 | - * Register the flickr widget with WordPress. |
|
733 | - * |
|
734 | - * @since 1.0.0 |
|
735 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
736 | - */ |
|
737 | - public function __construct() { |
|
738 | - $widget_ops = array('classname' => 'Geo Dir Flickr Photos ', 'description' => __('GD > Flickr Photos', 'geodirectory')); |
|
739 | - parent::__construct( |
|
740 | - 'widget_flickrwidget', // Base ID |
|
741 | - __('GD > Flickr Photos', 'geodirectory'), // Name |
|
742 | - $widget_ops// Args |
|
743 | - ); |
|
744 | - } |
|
745 | - |
|
746 | - /** |
|
747 | - * Front-end display content for flickr widget. |
|
748 | - * |
|
749 | - * @since 1.0.0 |
|
750 | - * @since 1.5.1 Declare function public. |
|
751 | - * |
|
752 | - * @param array $args Widget arguments. |
|
753 | - * @param array $instance Saved values from database. |
|
754 | - */ |
|
755 | - public function widget($args, $instance) |
|
756 | - { |
|
757 | - |
|
758 | - // prints the widget |
|
759 | - extract($args, EXTR_SKIP); |
|
760 | - |
|
761 | - echo $before_widget; |
|
762 | - |
|
763 | - /** This filter is documented in geodirectory_widgets.php */ |
|
764 | - $id = empty($instance['id']) ? ' ' : apply_filters('widget_id', $instance['id']); |
|
765 | - |
|
766 | - /** |
|
767 | - * Filter the widget number. |
|
768 | - * |
|
769 | - * This is used in the flicker widget to show how many images to show. |
|
770 | - * |
|
771 | - * @since 1.0.0 |
|
772 | - * @param string $number The image count. |
|
773 | - */ |
|
774 | - $number = empty($instance['number']) ? ' ' : apply_filters('widget_number', $instance['number']); |
|
775 | - echo $before_title . __('Photo Gallery', 'geodirectory') . $after_title; |
|
776 | - ?> |
|
718 | + } |
|
719 | + } |
|
720 | + |
|
721 | + register_widget('geodiradvtwidget'); |
|
722 | + |
|
723 | + /** |
|
724 | + * GeoDirectory Flickr widget. |
|
725 | + * |
|
726 | + * @since 1.0.0 |
|
727 | + */ |
|
728 | + class GeodirFlickrWidget extends WP_Widget |
|
729 | + { |
|
730 | + |
|
731 | + /** |
|
732 | + * Register the flickr widget with WordPress. |
|
733 | + * |
|
734 | + * @since 1.0.0 |
|
735 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
736 | + */ |
|
737 | + public function __construct() { |
|
738 | + $widget_ops = array('classname' => 'Geo Dir Flickr Photos ', 'description' => __('GD > Flickr Photos', 'geodirectory')); |
|
739 | + parent::__construct( |
|
740 | + 'widget_flickrwidget', // Base ID |
|
741 | + __('GD > Flickr Photos', 'geodirectory'), // Name |
|
742 | + $widget_ops// Args |
|
743 | + ); |
|
744 | + } |
|
745 | + |
|
746 | + /** |
|
747 | + * Front-end display content for flickr widget. |
|
748 | + * |
|
749 | + * @since 1.0.0 |
|
750 | + * @since 1.5.1 Declare function public. |
|
751 | + * |
|
752 | + * @param array $args Widget arguments. |
|
753 | + * @param array $instance Saved values from database. |
|
754 | + */ |
|
755 | + public function widget($args, $instance) |
|
756 | + { |
|
757 | + |
|
758 | + // prints the widget |
|
759 | + extract($args, EXTR_SKIP); |
|
760 | + |
|
761 | + echo $before_widget; |
|
762 | + |
|
763 | + /** This filter is documented in geodirectory_widgets.php */ |
|
764 | + $id = empty($instance['id']) ? ' ' : apply_filters('widget_id', $instance['id']); |
|
765 | + |
|
766 | + /** |
|
767 | + * Filter the widget number. |
|
768 | + * |
|
769 | + * This is used in the flicker widget to show how many images to show. |
|
770 | + * |
|
771 | + * @since 1.0.0 |
|
772 | + * @param string $number The image count. |
|
773 | + */ |
|
774 | + $number = empty($instance['number']) ? ' ' : apply_filters('widget_number', $instance['number']); |
|
775 | + echo $before_title . __('Photo Gallery', 'geodirectory') . $after_title; |
|
776 | + ?> |
|
777 | 777 | |
778 | 778 | <div class="geodir-flickr clearfix"> |
779 | 779 | |
@@ -784,45 +784,45 @@ discard block |
||
784 | 784 | |
785 | 785 | |
786 | 786 | <?php echo $after_widget; |
787 | - } |
|
788 | - |
|
789 | - /** |
|
790 | - * Sanitize flickr widget form values as they are saved. |
|
791 | - * |
|
792 | - * @since 1.0.0 |
|
793 | - * @since 1.5.1 Declare function public. |
|
794 | - * |
|
795 | - * @param array $new_instance Values just sent to be saved. |
|
796 | - * @param array $old_instance Previously saved values from database. |
|
797 | - * |
|
798 | - * @return array Updated safe values to be saved. |
|
799 | - */ |
|
800 | - public function update($new_instance, $old_instance) |
|
801 | - { |
|
802 | - //save the widget |
|
803 | - $instance = $old_instance; |
|
804 | - $instance['id'] = strip_tags($new_instance['id']); |
|
805 | - $instance['number'] = strip_tags($new_instance['number']); |
|
806 | - return $instance; |
|
807 | - } |
|
808 | - |
|
809 | - /** |
|
810 | - * Back-end flickr widget settings form. |
|
811 | - * |
|
812 | - * @since 1.0.0 |
|
813 | - * @since 1.5.1 Declare function public. |
|
814 | - * |
|
815 | - * @param array $instance Previously saved values from database. |
|
816 | - * @return string|void |
|
817 | - */ |
|
818 | - public function form($instance) |
|
819 | - { |
|
820 | - |
|
821 | - //widgetform in backend |
|
822 | - $instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'number' => '')); |
|
823 | - $id = strip_tags($instance['id']); |
|
824 | - $number = strip_tags($instance['number']); |
|
825 | - ?> |
|
787 | + } |
|
788 | + |
|
789 | + /** |
|
790 | + * Sanitize flickr widget form values as they are saved. |
|
791 | + * |
|
792 | + * @since 1.0.0 |
|
793 | + * @since 1.5.1 Declare function public. |
|
794 | + * |
|
795 | + * @param array $new_instance Values just sent to be saved. |
|
796 | + * @param array $old_instance Previously saved values from database. |
|
797 | + * |
|
798 | + * @return array Updated safe values to be saved. |
|
799 | + */ |
|
800 | + public function update($new_instance, $old_instance) |
|
801 | + { |
|
802 | + //save the widget |
|
803 | + $instance = $old_instance; |
|
804 | + $instance['id'] = strip_tags($new_instance['id']); |
|
805 | + $instance['number'] = strip_tags($new_instance['number']); |
|
806 | + return $instance; |
|
807 | + } |
|
808 | + |
|
809 | + /** |
|
810 | + * Back-end flickr widget settings form. |
|
811 | + * |
|
812 | + * @since 1.0.0 |
|
813 | + * @since 1.5.1 Declare function public. |
|
814 | + * |
|
815 | + * @param array $instance Previously saved values from database. |
|
816 | + * @return string|void |
|
817 | + */ |
|
818 | + public function form($instance) |
|
819 | + { |
|
820 | + |
|
821 | + //widgetform in backend |
|
822 | + $instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'number' => '')); |
|
823 | + $id = strip_tags($instance['id']); |
|
824 | + $number = strip_tags($instance['number']); |
|
825 | + ?> |
|
826 | 826 | |
827 | 827 | <p> |
828 | 828 | <label |
@@ -843,99 +843,99 @@ discard block |
||
843 | 843 | </label> |
844 | 844 | </p> |
845 | 845 | <?php |
846 | - } |
|
847 | - } |
|
848 | - |
|
849 | - register_widget('GeodirFlickrWidget'); |
|
850 | - |
|
851 | - /** |
|
852 | - * GeoDirectory Twitter widget. |
|
853 | - * |
|
854 | - * @since 1.0.0 |
|
855 | - */ |
|
856 | - class geodir_twitter extends WP_Widget |
|
857 | - { |
|
858 | - /** |
|
859 | - * Register the Twitter widget with WordPress. |
|
860 | - * |
|
861 | - * @since 1.0.0 |
|
862 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
863 | - */ |
|
864 | - public function __construct() { |
|
865 | - $widget_ops = array('classname' => 'Twitter', 'description' => __('GD > Twitter Feed', 'geodirectory')); |
|
866 | - parent::__construct( |
|
867 | - 'widget_Twidget', // Base ID |
|
868 | - __('GD > Twitter', 'geodirectory'), // Name |
|
869 | - $widget_ops// Args |
|
870 | - ); |
|
871 | - } |
|
872 | - |
|
873 | - |
|
874 | - /** |
|
875 | - * Front-end display content for Twitter widget. |
|
876 | - * |
|
877 | - * @since 1.0.0 |
|
878 | - * @since 1.5.1 Declare function public. |
|
879 | - * |
|
880 | - * @param array $args Widget arguments. |
|
881 | - * @param array $instance Saved values from database. |
|
882 | - */ |
|
883 | - public function widget($args, $instance) |
|
884 | - { |
|
885 | - |
|
886 | - // prints the widget |
|
887 | - |
|
888 | - extract($args, EXTR_SKIP); |
|
889 | - |
|
890 | - /** |
|
891 | - * Filter the twitter widget description text. |
|
892 | - * |
|
893 | - * @since 1.0.0 |
|
894 | - * @param string $desc1 The widget description text. |
|
895 | - */ |
|
896 | - $desc1 = empty($instance['gd_tw_desc1']) ? ' ' : apply_filters('gd_tw_widget_desc1', $instance['gd_tw_desc1']); |
|
897 | - echo $before_widget; |
|
898 | - if ($desc1 <> "") { |
|
899 | - echo $desc1; |
|
900 | - } |
|
901 | - echo $after_widget; |
|
902 | - } |
|
903 | - |
|
904 | - /** |
|
905 | - * Sanitize twitter widget form values as they are saved. |
|
906 | - * |
|
907 | - * @since 1.0.0 |
|
908 | - * @since 1.5.1 Declare function public. |
|
909 | - * |
|
910 | - * @param array $new_instance Values just sent to be saved. |
|
911 | - * @param array $old_instance Previously saved values from database. |
|
912 | - * |
|
913 | - * @return array Updated safe values to be saved. |
|
914 | - */ |
|
915 | - public function update($new_instance, $old_instance) |
|
916 | - { |
|
917 | - //save the widget |
|
918 | - $instance = $old_instance; |
|
919 | - $instance['gd_tw_desc1'] = ($new_instance['gd_tw_desc1']); |
|
920 | - return $instance; |
|
921 | - } |
|
922 | - |
|
923 | - /** |
|
924 | - * Back-end twitter widget settings form. |
|
925 | - * |
|
926 | - * @since 1.0.0 |
|
927 | - * @since 1.5.1 Declare function public. |
|
928 | - * |
|
929 | - * @param array $instance Previously saved values from database. |
|
930 | - * @return string|void |
|
931 | - */ |
|
932 | - public function form($instance) |
|
933 | - { |
|
934 | - //widgetform in backend |
|
935 | - $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'gd_tw_desc1' => '')); |
|
936 | - |
|
937 | - $desc1 = ($instance['gd_tw_desc1']); |
|
938 | - ?> |
|
846 | + } |
|
847 | + } |
|
848 | + |
|
849 | + register_widget('GeodirFlickrWidget'); |
|
850 | + |
|
851 | + /** |
|
852 | + * GeoDirectory Twitter widget. |
|
853 | + * |
|
854 | + * @since 1.0.0 |
|
855 | + */ |
|
856 | + class geodir_twitter extends WP_Widget |
|
857 | + { |
|
858 | + /** |
|
859 | + * Register the Twitter widget with WordPress. |
|
860 | + * |
|
861 | + * @since 1.0.0 |
|
862 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
863 | + */ |
|
864 | + public function __construct() { |
|
865 | + $widget_ops = array('classname' => 'Twitter', 'description' => __('GD > Twitter Feed', 'geodirectory')); |
|
866 | + parent::__construct( |
|
867 | + 'widget_Twidget', // Base ID |
|
868 | + __('GD > Twitter', 'geodirectory'), // Name |
|
869 | + $widget_ops// Args |
|
870 | + ); |
|
871 | + } |
|
872 | + |
|
873 | + |
|
874 | + /** |
|
875 | + * Front-end display content for Twitter widget. |
|
876 | + * |
|
877 | + * @since 1.0.0 |
|
878 | + * @since 1.5.1 Declare function public. |
|
879 | + * |
|
880 | + * @param array $args Widget arguments. |
|
881 | + * @param array $instance Saved values from database. |
|
882 | + */ |
|
883 | + public function widget($args, $instance) |
|
884 | + { |
|
885 | + |
|
886 | + // prints the widget |
|
887 | + |
|
888 | + extract($args, EXTR_SKIP); |
|
889 | + |
|
890 | + /** |
|
891 | + * Filter the twitter widget description text. |
|
892 | + * |
|
893 | + * @since 1.0.0 |
|
894 | + * @param string $desc1 The widget description text. |
|
895 | + */ |
|
896 | + $desc1 = empty($instance['gd_tw_desc1']) ? ' ' : apply_filters('gd_tw_widget_desc1', $instance['gd_tw_desc1']); |
|
897 | + echo $before_widget; |
|
898 | + if ($desc1 <> "") { |
|
899 | + echo $desc1; |
|
900 | + } |
|
901 | + echo $after_widget; |
|
902 | + } |
|
903 | + |
|
904 | + /** |
|
905 | + * Sanitize twitter widget form values as they are saved. |
|
906 | + * |
|
907 | + * @since 1.0.0 |
|
908 | + * @since 1.5.1 Declare function public. |
|
909 | + * |
|
910 | + * @param array $new_instance Values just sent to be saved. |
|
911 | + * @param array $old_instance Previously saved values from database. |
|
912 | + * |
|
913 | + * @return array Updated safe values to be saved. |
|
914 | + */ |
|
915 | + public function update($new_instance, $old_instance) |
|
916 | + { |
|
917 | + //save the widget |
|
918 | + $instance = $old_instance; |
|
919 | + $instance['gd_tw_desc1'] = ($new_instance['gd_tw_desc1']); |
|
920 | + return $instance; |
|
921 | + } |
|
922 | + |
|
923 | + /** |
|
924 | + * Back-end twitter widget settings form. |
|
925 | + * |
|
926 | + * @since 1.0.0 |
|
927 | + * @since 1.5.1 Declare function public. |
|
928 | + * |
|
929 | + * @param array $instance Previously saved values from database. |
|
930 | + * @return string|void |
|
931 | + */ |
|
932 | + public function form($instance) |
|
933 | + { |
|
934 | + //widgetform in backend |
|
935 | + $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'gd_tw_desc1' => '')); |
|
936 | + |
|
937 | + $desc1 = ($instance['gd_tw_desc1']); |
|
938 | + ?> |
|
939 | 939 | <p><label |
940 | 940 | for="<?php echo $this->get_field_id('gd_tw_desc1'); ?>"><?php _e('Your twitter code', 'geodirectory');?> |
941 | 941 | <textarea class="widefat" rows="6" cols="20" |
@@ -944,179 +944,179 @@ discard block |
||
944 | 944 | </p> |
945 | 945 | |
946 | 946 | <?php |
947 | - } |
|
948 | - } |
|
949 | - |
|
950 | - register_widget('geodir_twitter'); |
|
951 | - |
|
952 | - /** |
|
953 | - * GeoDirectory Advanced Search widget. |
|
954 | - * |
|
955 | - * @since 1.0.0 |
|
956 | - */ |
|
957 | - class geodir_advance_search_widget extends WP_Widget |
|
958 | - { |
|
959 | - /** |
|
960 | - * Register the advanced search widget with WordPress. |
|
961 | - * |
|
962 | - * @since 1.0.0 |
|
963 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
964 | - */ |
|
965 | - public function __construct() { |
|
966 | - $widget_ops = array('classname' => 'geodir_advance_search_widget', 'description' => __('GD > Search', 'geodirectory'),'post_type'=>''); |
|
967 | - parent::__construct( |
|
968 | - 'geodir_advance_search', // Base ID |
|
969 | - __('GD > Search', 'geodirectory'), // Name |
|
970 | - $widget_ops// Args |
|
971 | - ); |
|
972 | - } |
|
973 | - |
|
974 | - |
|
975 | - /** |
|
976 | - * Front-end display content for advanced search widget. |
|
977 | - * |
|
978 | - * @since 1.0.0 |
|
979 | - * @since 1.5.1 Declare function public. |
|
980 | - * |
|
981 | - * @param array $args Widget arguments. |
|
982 | - * @param array $instance Saved values from database. |
|
983 | - */ |
|
984 | - public function widget($args, $instance) |
|
985 | - { |
|
986 | - /** |
|
987 | - * Filter the search widget arguments. |
|
988 | - * |
|
989 | - * @since 1.5.7 |
|
990 | - * @param array $args The widget arguments. |
|
991 | - * @param array $instance The widget instance. |
|
992 | - */ |
|
993 | - $args = apply_filters('widget_geodir_advance_search_args',$args,$instance); |
|
994 | - |
|
995 | - // prints the widget |
|
996 | - extract($args, EXTR_SKIP); |
|
997 | - |
|
998 | - if(isset($post_type) && $post_type){ |
|
999 | - geodir_get_search_post_type($post_type);// set the post type |
|
1000 | - }else{ |
|
1001 | - geodir_get_search_post_type();// set the post type |
|
1002 | - } |
|
1003 | - |
|
1004 | - echo $before_widget; |
|
1005 | - |
|
1006 | - /** This filter is documented in geodirectory_widgets.php */ |
|
1007 | - $title = empty($instance['title']) ? __('Search', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory')); |
|
1008 | - |
|
1009 | - geodir_get_template_part('listing', 'filter-form'); |
|
1010 | - |
|
1011 | - echo $after_widget; |
|
1012 | - |
|
1013 | - // after outputing the search reset the CPT |
|
1014 | - global $geodir_search_post_type; |
|
1015 | - $geodir_search_post_type = ''; |
|
1016 | - } |
|
1017 | - |
|
1018 | - /** |
|
1019 | - * Sanitize advanced search widget form values as they are saved. |
|
1020 | - * |
|
1021 | - * @since 1.0.0 |
|
1022 | - * @since 1.5.1 Declare function public. |
|
1023 | - * |
|
1024 | - * @param array $new_instance Values just sent to be saved. |
|
1025 | - * @param array $old_instance Previously saved values from database. |
|
1026 | - * |
|
1027 | - * @return array Updated safe values to be saved. |
|
1028 | - */ |
|
1029 | - public function update($new_instance, $old_instance) |
|
1030 | - { |
|
1031 | - //save the widget |
|
1032 | - //Nothing to save |
|
1033 | - return isset($instance) ? $instance : array(); |
|
1034 | - } |
|
1035 | - |
|
1036 | - /** |
|
1037 | - * Back-end advanced search widget settings form. |
|
1038 | - * |
|
1039 | - * @since 1.0.0 |
|
1040 | - * @since 1.5.1 Declare function public. |
|
1041 | - * |
|
1042 | - * @param array $instance Previously saved values from database. |
|
1043 | - * @return string|void |
|
1044 | - */ |
|
1045 | - public function form($instance) |
|
1046 | - { |
|
1047 | - //widgetform in backend |
|
1048 | - echo __("This is a search widget to show advance search for gedodirectory listings.", 'geodirectory'); |
|
1049 | - } |
|
1050 | - } |
|
1051 | - |
|
1052 | - register_widget('geodir_advance_search_widget'); |
|
1053 | - |
|
1054 | - |
|
1055 | - /** |
|
1056 | - * Contains all functions for popular widget. |
|
1057 | - * |
|
1058 | - * @since 1.0.0 |
|
1059 | - * @package GeoDirectory |
|
1060 | - */ |
|
1061 | - include_once('geodirectory-widgets/geodirectory_popular_widget.php'); |
|
1062 | - /** |
|
1063 | - * Contains all functions for listing slider widget. |
|
1064 | - * |
|
1065 | - * @since 1.0.0 |
|
1066 | - * @package GeoDirectory |
|
1067 | - */ |
|
1068 | - include_once('geodirectory-widgets/geodirectory_listing_slider_widget.php'); |
|
1069 | - /** |
|
1070 | - * Contains all functions for home map widget. |
|
1071 | - * |
|
1072 | - * @since 1.0.0 |
|
1073 | - * @package GeoDirectory |
|
1074 | - */ |
|
1075 | - include_once('geodirectory-widgets/home_map_widget.php'); |
|
1076 | - /** |
|
1077 | - * Contains all functions for listing map widget. |
|
1078 | - * |
|
1079 | - * @since 1.0.0 |
|
1080 | - * @package GeoDirectory |
|
1081 | - */ |
|
1082 | - include_once('geodirectory-widgets/listing_map_widget.php'); |
|
1083 | - /** |
|
1084 | - * Contains all functions for reviews widget. |
|
1085 | - * |
|
1086 | - * @since 1.0.0 |
|
1087 | - * @package GeoDirectory |
|
1088 | - */ |
|
1089 | - include_once('geodirectory-widgets/geodirectory_reviews_widget.php'); |
|
1090 | - /** |
|
1091 | - * Contains all functions for related listing widget. |
|
1092 | - * |
|
1093 | - * @since 1.0.0 |
|
1094 | - * @package GeoDirectory |
|
1095 | - */ |
|
1096 | - include_once('geodirectory-widgets/geodirectory_related_listing_widget.php'); |
|
1097 | - /** |
|
1098 | - * Contains all functions for bestof widget. |
|
1099 | - * |
|
1100 | - * @since 1.0.0 |
|
1101 | - * @package GeoDirectory |
|
1102 | - */ |
|
1103 | - include_once('geodirectory-widgets/geodirectory_bestof_widget.php'); |
|
947 | + } |
|
948 | + } |
|
949 | + |
|
950 | + register_widget('geodir_twitter'); |
|
951 | + |
|
952 | + /** |
|
953 | + * GeoDirectory Advanced Search widget. |
|
954 | + * |
|
955 | + * @since 1.0.0 |
|
956 | + */ |
|
957 | + class geodir_advance_search_widget extends WP_Widget |
|
958 | + { |
|
959 | + /** |
|
960 | + * Register the advanced search widget with WordPress. |
|
961 | + * |
|
962 | + * @since 1.0.0 |
|
963 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
964 | + */ |
|
965 | + public function __construct() { |
|
966 | + $widget_ops = array('classname' => 'geodir_advance_search_widget', 'description' => __('GD > Search', 'geodirectory'),'post_type'=>''); |
|
967 | + parent::__construct( |
|
968 | + 'geodir_advance_search', // Base ID |
|
969 | + __('GD > Search', 'geodirectory'), // Name |
|
970 | + $widget_ops// Args |
|
971 | + ); |
|
972 | + } |
|
973 | + |
|
974 | + |
|
975 | + /** |
|
976 | + * Front-end display content for advanced search widget. |
|
977 | + * |
|
978 | + * @since 1.0.0 |
|
979 | + * @since 1.5.1 Declare function public. |
|
980 | + * |
|
981 | + * @param array $args Widget arguments. |
|
982 | + * @param array $instance Saved values from database. |
|
983 | + */ |
|
984 | + public function widget($args, $instance) |
|
985 | + { |
|
986 | + /** |
|
987 | + * Filter the search widget arguments. |
|
988 | + * |
|
989 | + * @since 1.5.7 |
|
990 | + * @param array $args The widget arguments. |
|
991 | + * @param array $instance The widget instance. |
|
992 | + */ |
|
993 | + $args = apply_filters('widget_geodir_advance_search_args',$args,$instance); |
|
994 | + |
|
995 | + // prints the widget |
|
996 | + extract($args, EXTR_SKIP); |
|
997 | + |
|
998 | + if(isset($post_type) && $post_type){ |
|
999 | + geodir_get_search_post_type($post_type);// set the post type |
|
1000 | + }else{ |
|
1001 | + geodir_get_search_post_type();// set the post type |
|
1002 | + } |
|
1003 | + |
|
1004 | + echo $before_widget; |
|
1005 | + |
|
1006 | + /** This filter is documented in geodirectory_widgets.php */ |
|
1007 | + $title = empty($instance['title']) ? __('Search', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory')); |
|
1008 | + |
|
1009 | + geodir_get_template_part('listing', 'filter-form'); |
|
1010 | + |
|
1011 | + echo $after_widget; |
|
1012 | + |
|
1013 | + // after outputing the search reset the CPT |
|
1014 | + global $geodir_search_post_type; |
|
1015 | + $geodir_search_post_type = ''; |
|
1016 | + } |
|
1017 | + |
|
1018 | + /** |
|
1019 | + * Sanitize advanced search widget form values as they are saved. |
|
1020 | + * |
|
1021 | + * @since 1.0.0 |
|
1022 | + * @since 1.5.1 Declare function public. |
|
1023 | + * |
|
1024 | + * @param array $new_instance Values just sent to be saved. |
|
1025 | + * @param array $old_instance Previously saved values from database. |
|
1026 | + * |
|
1027 | + * @return array Updated safe values to be saved. |
|
1028 | + */ |
|
1029 | + public function update($new_instance, $old_instance) |
|
1030 | + { |
|
1031 | + //save the widget |
|
1032 | + //Nothing to save |
|
1033 | + return isset($instance) ? $instance : array(); |
|
1034 | + } |
|
1035 | + |
|
1036 | + /** |
|
1037 | + * Back-end advanced search widget settings form. |
|
1038 | + * |
|
1039 | + * @since 1.0.0 |
|
1040 | + * @since 1.5.1 Declare function public. |
|
1041 | + * |
|
1042 | + * @param array $instance Previously saved values from database. |
|
1043 | + * @return string|void |
|
1044 | + */ |
|
1045 | + public function form($instance) |
|
1046 | + { |
|
1047 | + //widgetform in backend |
|
1048 | + echo __("This is a search widget to show advance search for gedodirectory listings.", 'geodirectory'); |
|
1049 | + } |
|
1050 | + } |
|
1051 | + |
|
1052 | + register_widget('geodir_advance_search_widget'); |
|
1053 | + |
|
1054 | + |
|
1055 | + /** |
|
1056 | + * Contains all functions for popular widget. |
|
1057 | + * |
|
1058 | + * @since 1.0.0 |
|
1059 | + * @package GeoDirectory |
|
1060 | + */ |
|
1061 | + include_once('geodirectory-widgets/geodirectory_popular_widget.php'); |
|
1062 | + /** |
|
1063 | + * Contains all functions for listing slider widget. |
|
1064 | + * |
|
1065 | + * @since 1.0.0 |
|
1066 | + * @package GeoDirectory |
|
1067 | + */ |
|
1068 | + include_once('geodirectory-widgets/geodirectory_listing_slider_widget.php'); |
|
1069 | + /** |
|
1070 | + * Contains all functions for home map widget. |
|
1071 | + * |
|
1072 | + * @since 1.0.0 |
|
1073 | + * @package GeoDirectory |
|
1074 | + */ |
|
1075 | + include_once('geodirectory-widgets/home_map_widget.php'); |
|
1076 | + /** |
|
1077 | + * Contains all functions for listing map widget. |
|
1078 | + * |
|
1079 | + * @since 1.0.0 |
|
1080 | + * @package GeoDirectory |
|
1081 | + */ |
|
1082 | + include_once('geodirectory-widgets/listing_map_widget.php'); |
|
1083 | + /** |
|
1084 | + * Contains all functions for reviews widget. |
|
1085 | + * |
|
1086 | + * @since 1.0.0 |
|
1087 | + * @package GeoDirectory |
|
1088 | + */ |
|
1089 | + include_once('geodirectory-widgets/geodirectory_reviews_widget.php'); |
|
1090 | + /** |
|
1091 | + * Contains all functions for related listing widget. |
|
1092 | + * |
|
1093 | + * @since 1.0.0 |
|
1094 | + * @package GeoDirectory |
|
1095 | + */ |
|
1096 | + include_once('geodirectory-widgets/geodirectory_related_listing_widget.php'); |
|
1097 | + /** |
|
1098 | + * Contains all functions for bestof widget. |
|
1099 | + * |
|
1100 | + * @since 1.0.0 |
|
1101 | + * @package GeoDirectory |
|
1102 | + */ |
|
1103 | + include_once('geodirectory-widgets/geodirectory_bestof_widget.php'); |
|
1104 | + /** |
|
1105 | + * Contains all functions for cpt categories widget. |
|
1106 | + * |
|
1107 | + * @since 1.5.4 |
|
1108 | + * @package GeoDirectory |
|
1109 | + */ |
|
1110 | + include_once('geodirectory-widgets/geodirectory_cpt_categories_widget.php'); |
|
1104 | 1111 | /** |
1105 | - * Contains all functions for cpt categories widget. |
|
1106 | - * |
|
1107 | - * @since 1.5.4 |
|
1108 | - * @package GeoDirectory |
|
1109 | - */ |
|
1110 | - include_once('geodirectory-widgets/geodirectory_cpt_categories_widget.php'); |
|
1111 | - /** |
|
1112 | - * Contains all functions for features widget. |
|
1113 | - * |
|
1114 | - * @since 1.5.6 |
|
1115 | - * @package GeoDirectory |
|
1116 | - * @todo make the image field recurring |
|
1117 | - */ |
|
1118 | - include_once('geodirectory-widgets/geodirectory_features_widget.php'); |
|
1119 | - } |
|
1112 | + * Contains all functions for features widget. |
|
1113 | + * |
|
1114 | + * @since 1.5.6 |
|
1115 | + * @package GeoDirectory |
|
1116 | + * @todo make the image field recurring |
|
1117 | + */ |
|
1118 | + include_once('geodirectory-widgets/geodirectory_features_widget.php'); |
|
1119 | + } |
|
1120 | 1120 | |
1121 | 1121 | } |
1122 | 1122 |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | public function form($instance) |
302 | 302 | { |
303 | 303 | //widgetform in backend |
304 | - $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => '')); |
|
304 | + $instance = wp_parse_args((array) $instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => '')); |
|
305 | 305 | $title = strip_tags($instance['title']); |
306 | 306 | |
307 | 307 | ?> |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | ?> |
374 | 374 | |
375 | 375 | <a href="http://twitter.com/share" |
376 | - class="twitter-share-button"><?php _e('Tweet', 'geodirectory');?></a> |
|
376 | + class="twitter-share-button"><?php _e('Tweet', 'geodirectory'); ?></a> |
|
377 | 377 | |
378 | 378 | <script type="text/javascript" src="//platform.twitter.com/widgets.js"></script> |
379 | 379 | |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | public function form($instance) |
444 | 444 | { |
445 | 445 | //widgetform in backend |
446 | - $instance = wp_parse_args((array)$instance, array('title' => '')); |
|
446 | + $instance = wp_parse_args((array) $instance, array('title' => '')); |
|
447 | 447 | $title = strip_tags($instance['title']); |
448 | 448 | ?> |
449 | 449 | <p>No settings for this widget</p> |
@@ -515,11 +515,11 @@ discard block |
||
515 | 515 | echo $before_widget; |
516 | 516 | ?> |
517 | 517 | |
518 | - <?php echo $before_title . $title; ?> <a href="<?php if ($id) { |
|
519 | - echo 'http://feeds2.feedburner.com/' . $id; |
|
518 | + <?php echo $before_title.$title; ?> <a href="<?php if ($id) { |
|
519 | + echo 'http://feeds2.feedburner.com/'.$id; |
|
520 | 520 | } else { |
521 | 521 | bloginfo('rss_url'); |
522 | - } ?>"><i class="fa fa-rss-square"></i> </a><?php echo $after_title;?> |
|
522 | + } ?>"><i class="fa fa-rss-square"></i> </a><?php echo $after_title; ?> |
|
523 | 523 | |
524 | 524 | <?php if ($text <> "") { ?> |
525 | 525 | |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | public function form($instance) |
585 | 585 | { |
586 | 586 | //widgetform in backend |
587 | - $instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'advt1' => '', 'text' => '', 'twitter' => '', 'facebook' => '', 'digg' => '', 'myspace' => '')); |
|
587 | + $instance = wp_parse_args((array) $instance, array('title' => '', 'id' => '', 'advt1' => '', 'text' => '', 'twitter' => '', 'facebook' => '', 'digg' => '', 'myspace' => '')); |
|
588 | 588 | |
589 | 589 | $id = strip_tags($instance['id']); |
590 | 590 | |
@@ -596,19 +596,19 @@ discard block |
||
596 | 596 | |
597 | 597 | ?> |
598 | 598 | <p><label |
599 | - for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title', 'geodirectory');?>: |
|
599 | + for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title', 'geodirectory'); ?>: |
|
600 | 600 | <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" |
601 | 601 | name="<?php echo $this->get_field_name('title'); ?>" type="text" |
602 | 602 | value="<?php echo esc_attr($title); ?>"/></label></p> |
603 | 603 | |
604 | 604 | <p><label |
605 | - for="<?php echo $this->get_field_id('id'); ?>"><?php _e('Feedburner ID (ex :- geotheme)', 'geodirectory');?> |
|
605 | + for="<?php echo $this->get_field_id('id'); ?>"><?php _e('Feedburner ID (ex :- geotheme)', 'geodirectory'); ?> |
|
606 | 606 | : <input class="widefat" id="<?php echo $this->get_field_id('id'); ?>" |
607 | 607 | name="<?php echo $this->get_field_name('id'); ?>" type="text" |
608 | 608 | value="<?php echo esc_attr($id); ?>"/></label></p> |
609 | 609 | |
610 | 610 | <p><label |
611 | - for="<?php echo $this->get_field_id('text'); ?>"><?php _e('Short Description', 'geodirectory');?> |
|
611 | + for="<?php echo $this->get_field_id('text'); ?>"><?php _e('Short Description', 'geodirectory'); ?> |
|
612 | 612 | <textarea class="widefat" rows="6" cols="20" id="<?php echo $this->get_field_id('text'); ?>" |
613 | 613 | name="<?php echo $this->get_field_name('text'); ?>"><?php echo esc_attr($text); ?></textarea></label> |
614 | 614 | </p> |
@@ -704,12 +704,12 @@ discard block |
||
704 | 704 | public function form($instance) |
705 | 705 | { |
706 | 706 | //widgetform in backend |
707 | - $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => '')); |
|
707 | + $instance = wp_parse_args((array) $instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => '')); |
|
708 | 708 | |
709 | 709 | $desc1 = ($instance['desc1']); |
710 | 710 | ?> |
711 | 711 | <p><label |
712 | - for="<?php echo $this->get_field_id('desc1'); ?>"><?php _e('Your Advt code (ex.google adsense, etc.)', 'geodirectory');?> |
|
712 | + for="<?php echo $this->get_field_id('desc1'); ?>"><?php _e('Your Advt code (ex.google adsense, etc.)', 'geodirectory'); ?> |
|
713 | 713 | <textarea class="widefat" rows="6" cols="20" id="<?php echo $this->get_field_id('desc1'); ?>" |
714 | 714 | name="<?php echo $this->get_field_name('desc1'); ?>"><?php echo esc_attr($desc1); ?></textarea></label> |
715 | 715 | </p> |
@@ -772,7 +772,7 @@ discard block |
||
772 | 772 | * @param string $number The image count. |
773 | 773 | */ |
774 | 774 | $number = empty($instance['number']) ? ' ' : apply_filters('widget_number', $instance['number']); |
775 | - echo $before_title . __('Photo Gallery', 'geodirectory') . $after_title; |
|
775 | + echo $before_title.__('Photo Gallery', 'geodirectory').$after_title; |
|
776 | 776 | ?> |
777 | 777 | |
778 | 778 | <div class="geodir-flickr clearfix"> |
@@ -819,14 +819,14 @@ discard block |
||
819 | 819 | { |
820 | 820 | |
821 | 821 | //widgetform in backend |
822 | - $instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'number' => '')); |
|
822 | + $instance = wp_parse_args((array) $instance, array('title' => '', 'id' => '', 'number' => '')); |
|
823 | 823 | $id = strip_tags($instance['id']); |
824 | 824 | $number = strip_tags($instance['number']); |
825 | 825 | ?> |
826 | 826 | |
827 | 827 | <p> |
828 | 828 | <label |
829 | - for="<?php echo $this->get_field_id('id'); ?>"><?php _e('Flickr ID', 'geodirectory');?> |
|
829 | + for="<?php echo $this->get_field_id('id'); ?>"><?php _e('Flickr ID', 'geodirectory'); ?> |
|
830 | 830 | (<a href="http://www.idgettr.com">idGettr</a>): |
831 | 831 | <input class="widefat" id="<?php echo $this->get_field_id('id'); ?>" |
832 | 832 | name="<?php echo $this->get_field_name('id'); ?>" type="text" |
@@ -836,7 +836,7 @@ discard block |
||
836 | 836 | |
837 | 837 | <p> |
838 | 838 | <label |
839 | - for="<?php echo $this->get_field_id('number'); ?>"><?php _e('Number of photos:', 'geodirectory');?> |
|
839 | + for="<?php echo $this->get_field_id('number'); ?>"><?php _e('Number of photos:', 'geodirectory'); ?> |
|
840 | 840 | <input class="widefat" id="<?php echo $this->get_field_id('number'); ?>" |
841 | 841 | name="<?php echo $this->get_field_name('number'); ?>" type="text" |
842 | 842 | value="<?php echo esc_attr($number); ?>"/> |
@@ -932,12 +932,12 @@ discard block |
||
932 | 932 | public function form($instance) |
933 | 933 | { |
934 | 934 | //widgetform in backend |
935 | - $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'gd_tw_desc1' => '')); |
|
935 | + $instance = wp_parse_args((array) $instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'gd_tw_desc1' => '')); |
|
936 | 936 | |
937 | 937 | $desc1 = ($instance['gd_tw_desc1']); |
938 | 938 | ?> |
939 | 939 | <p><label |
940 | - for="<?php echo $this->get_field_id('gd_tw_desc1'); ?>"><?php _e('Your twitter code', 'geodirectory');?> |
|
940 | + for="<?php echo $this->get_field_id('gd_tw_desc1'); ?>"><?php _e('Your twitter code', 'geodirectory'); ?> |
|
941 | 941 | <textarea class="widefat" rows="6" cols="20" |
942 | 942 | id="<?php echo $this->get_field_id('gd_tw_desc1'); ?>" |
943 | 943 | name="<?php echo $this->get_field_name('gd_tw_desc1'); ?>"><?php echo esc_attr($desc1); ?></textarea></label> |
@@ -963,7 +963,7 @@ discard block |
||
963 | 963 | * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
964 | 964 | */ |
965 | 965 | public function __construct() { |
966 | - $widget_ops = array('classname' => 'geodir_advance_search_widget', 'description' => __('GD > Search', 'geodirectory'),'post_type'=>''); |
|
966 | + $widget_ops = array('classname' => 'geodir_advance_search_widget', 'description' => __('GD > Search', 'geodirectory'), 'post_type'=>''); |
|
967 | 967 | parent::__construct( |
968 | 968 | 'geodir_advance_search', // Base ID |
969 | 969 | __('GD > Search', 'geodirectory'), // Name |
@@ -990,15 +990,15 @@ discard block |
||
990 | 990 | * @param array $args The widget arguments. |
991 | 991 | * @param array $instance The widget instance. |
992 | 992 | */ |
993 | - $args = apply_filters('widget_geodir_advance_search_args',$args,$instance); |
|
993 | + $args = apply_filters('widget_geodir_advance_search_args', $args, $instance); |
|
994 | 994 | |
995 | 995 | // prints the widget |
996 | 996 | extract($args, EXTR_SKIP); |
997 | 997 | |
998 | - if(isset($post_type) && $post_type){ |
|
999 | - geodir_get_search_post_type($post_type);// set the post type |
|
1000 | - }else{ |
|
1001 | - geodir_get_search_post_type();// set the post type |
|
998 | + if (isset($post_type) && $post_type) { |
|
999 | + geodir_get_search_post_type($post_type); // set the post type |
|
1000 | + } else { |
|
1001 | + geodir_get_search_post_type(); // set the post type |
|
1002 | 1002 | } |
1003 | 1003 | |
1004 | 1004 | echo $before_widget; |
@@ -997,7 +997,7 @@ |
||
997 | 997 | |
998 | 998 | if(isset($post_type) && $post_type){ |
999 | 999 | geodir_get_search_post_type($post_type);// set the post type |
1000 | - }else{ |
|
1000 | + } else{ |
|
1001 | 1001 | geodir_get_search_post_type();// set the post type |
1002 | 1002 | } |
1003 | 1003 |
@@ -17,26 +17,26 @@ discard block |
||
17 | 17 | function gd_compat_php_genesis() |
18 | 18 | { |
19 | 19 | // REPLACE GENESIS BREADCRUMBS WITH GD BREADCRUMBS |
20 | - remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20); |
|
21 | - remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20); |
|
22 | - remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20); |
|
23 | - remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20); |
|
24 | - remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20); |
|
25 | - remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20); |
|
20 | + remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20); |
|
21 | + remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20); |
|
22 | + remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20); |
|
23 | + remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20); |
|
24 | + remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20); |
|
25 | + remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20); |
|
26 | 26 | |
27 | 27 | |
28 | - // make top section wide |
|
29 | - remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
30 | - remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
31 | - remove_action('geodir_author_before_main_content', 'geodir_action_geodir_sidebar_author_top', 10); |
|
32 | - remove_action('geodir_search_before_main_content', 'geodir_action_geodir_sidebar_search_top', 10); |
|
33 | - remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_sidebar_detail_top', 10); |
|
34 | - remove_action('geodir_listings_before_main_content', 'geodir_action_geodir_sidebar_listings_top', 10); |
|
28 | + // make top section wide |
|
29 | + remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
30 | + remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
31 | + remove_action('geodir_author_before_main_content', 'geodir_action_geodir_sidebar_author_top', 10); |
|
32 | + remove_action('geodir_search_before_main_content', 'geodir_action_geodir_sidebar_search_top', 10); |
|
33 | + remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_sidebar_detail_top', 10); |
|
34 | + remove_action('geodir_listings_before_main_content', 'geodir_action_geodir_sidebar_listings_top', 10); |
|
35 | 35 | |
36 | - // REMOVE PAGE TITLES |
|
37 | - remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10); |
|
38 | - remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10); |
|
39 | - remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10); |
|
36 | + // REMOVE PAGE TITLES |
|
37 | + remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10); |
|
38 | + remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10); |
|
39 | + remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10); |
|
40 | 40 | |
41 | 41 | |
42 | 42 | } |
@@ -53,25 +53,25 @@ discard block |
||
53 | 53 | function gd_genesis_compat_left_sidebars() |
54 | 54 | { |
55 | 55 | |
56 | - if (is_page_geodir_home()) { |
|
57 | - remove_action('geodir_home_sidebar_left', 'geodir_action_home_sidebar_left', 10); |
|
58 | - add_action('geodir_wrapper_close', 'geodir_action_home_sidebar_left', 11); |
|
59 | - } elseif (geodir_is_page('location')) { |
|
60 | - remove_action('geodir_location_sidebar_left', 'geodir_action_home_sidebar_left', 10); |
|
61 | - add_action('geodir_wrapper_close', 'geodir_action_home_sidebar_left', 11); |
|
62 | - } elseif (geodir_is_page('listing')) { |
|
63 | - remove_action('geodir_listings_sidebar_left', 'geodir_action_listings_sidebar_left', 10); |
|
64 | - add_action('geodir_wrapper_close', 'geodir_action_listings_sidebar_left', 11); |
|
65 | - } elseif (geodir_is_page('detail') && get_option('geodir_detail_sidebar_left_section')) { |
|
66 | - //remove_action( 'geodir_detail_sidebar', 'geodir_action_details_sidebar', 10 ); |
|
67 | - //add_action( 'geodir_wrapper_close', 'geodir_action_details_sidebar', 11 ); |
|
68 | - } elseif (geodir_is_page('search')) { |
|
69 | - remove_action('geodir_search_sidebar_left', 'geodir_action_search_sidebar_left', 10); |
|
70 | - add_action('geodir_wrapper_close', 'geodir_action_search_sidebar_left', 11); |
|
71 | - } elseif (geodir_is_page('author')) { |
|
72 | - remove_action('geodir_author_sidebar_left', 'geodir_action_author_sidebar_left', 10); |
|
73 | - add_action('geodir_wrapper_close', 'geodir_action_author_sidebar_left', 11); |
|
74 | - } |
|
56 | + if (is_page_geodir_home()) { |
|
57 | + remove_action('geodir_home_sidebar_left', 'geodir_action_home_sidebar_left', 10); |
|
58 | + add_action('geodir_wrapper_close', 'geodir_action_home_sidebar_left', 11); |
|
59 | + } elseif (geodir_is_page('location')) { |
|
60 | + remove_action('geodir_location_sidebar_left', 'geodir_action_home_sidebar_left', 10); |
|
61 | + add_action('geodir_wrapper_close', 'geodir_action_home_sidebar_left', 11); |
|
62 | + } elseif (geodir_is_page('listing')) { |
|
63 | + remove_action('geodir_listings_sidebar_left', 'geodir_action_listings_sidebar_left', 10); |
|
64 | + add_action('geodir_wrapper_close', 'geodir_action_listings_sidebar_left', 11); |
|
65 | + } elseif (geodir_is_page('detail') && get_option('geodir_detail_sidebar_left_section')) { |
|
66 | + //remove_action( 'geodir_detail_sidebar', 'geodir_action_details_sidebar', 10 ); |
|
67 | + //add_action( 'geodir_wrapper_close', 'geodir_action_details_sidebar', 11 ); |
|
68 | + } elseif (geodir_is_page('search')) { |
|
69 | + remove_action('geodir_search_sidebar_left', 'geodir_action_search_sidebar_left', 10); |
|
70 | + add_action('geodir_wrapper_close', 'geodir_action_search_sidebar_left', 11); |
|
71 | + } elseif (geodir_is_page('author')) { |
|
72 | + remove_action('geodir_author_sidebar_left', 'geodir_action_author_sidebar_left', 10); |
|
73 | + add_action('geodir_wrapper_close', 'geodir_action_author_sidebar_left', 11); |
|
74 | + } |
|
75 | 75 | |
76 | 76 | |
77 | 77 | } |
@@ -88,65 +88,65 @@ discard block |
||
88 | 88 | */ |
89 | 89 | function geodir_set_body_scs($classes) |
90 | 90 | { |
91 | - $remove_class = false; |
|
92 | - $new_class = ''; |
|
93 | - if (is_page_geodir_home() || geodir_is_page('location')) { |
|
94 | - $remove_class = true; |
|
95 | - if (get_option('geodir_show_home_left_section')) { |
|
96 | - $new_class .= 'sidebar-'; |
|
97 | - } |
|
98 | - if (get_option('geodir_show_home_contant_section')) { |
|
99 | - $new_class .= 'content'; |
|
100 | - } |
|
101 | - if (get_option('geodir_show_home_right_section')) { |
|
102 | - $new_class .= '-sidebar'; |
|
103 | - } |
|
104 | - } elseif (geodir_is_page('listing')) { |
|
105 | - $remove_class = true; |
|
106 | - if (get_option('geodir_show_listing_left_section')) { |
|
107 | - $new_class .= 'sidebar-'; |
|
108 | - } |
|
109 | - $new_class .= 'content'; |
|
110 | - if (get_option('geodir_show_listing_right_section')) { |
|
111 | - $new_class .= '-sidebar'; |
|
112 | - } |
|
113 | - } elseif (geodir_is_page('detail')) { |
|
114 | - $remove_class = true; |
|
115 | - if (get_option('geodir_detail_sidebar_left_section')) { |
|
116 | - $new_class .= 'sidebar-content gd-details-sidebar-left'; |
|
117 | - } else { |
|
118 | - $new_class .= 'content-sidebar'; |
|
119 | - } |
|
120 | - } elseif (geodir_is_page('search')) { |
|
121 | - $remove_class = true; |
|
122 | - if (get_option('geodir_show_search_left_section')) { |
|
123 | - $new_class .= 'sidebar-'; |
|
124 | - } |
|
125 | - $new_class .= 'content'; |
|
126 | - if (get_option('geodir_show_search_right_section')) { |
|
127 | - $new_class .= '-sidebar'; |
|
128 | - } |
|
129 | - } elseif (geodir_is_page('author')) { |
|
130 | - $remove_class = true; |
|
131 | - if (get_option('geodir_show_author_left_section')) { |
|
132 | - $new_class .= 'sidebar-'; |
|
133 | - } |
|
134 | - $new_class .= 'content'; |
|
135 | - if (get_option('geodir_show_author_right_section')) { |
|
136 | - $new_class .= '-sidebar'; |
|
137 | - } |
|
138 | - } elseif (geodir_is_page('add-listing')) { |
|
139 | - $remove_class = true; |
|
140 | - $new_class .= 'content-sidebar'; |
|
141 | - } |
|
142 | - |
|
143 | - if ($remove_class) { |
|
144 | - $classes = array_diff($classes, array('content-sidebar', 'sidebar-content', 'content-sidebar-sidebar', 'sidebar-sidebar-content', 'sidebar-content-sidebar', 'full-width-content')); |
|
145 | - //str_replace(array('content-sidebar','sidebar-content','content-sidebar-sidebar','sidebar-sidebar-content','sidebar-content-sidebar','full-width-content'),array('','','','','',''),$classes); |
|
146 | - $classes[] = $new_class; |
|
147 | - } |
|
148 | - |
|
149 | - return $classes; |
|
91 | + $remove_class = false; |
|
92 | + $new_class = ''; |
|
93 | + if (is_page_geodir_home() || geodir_is_page('location')) { |
|
94 | + $remove_class = true; |
|
95 | + if (get_option('geodir_show_home_left_section')) { |
|
96 | + $new_class .= 'sidebar-'; |
|
97 | + } |
|
98 | + if (get_option('geodir_show_home_contant_section')) { |
|
99 | + $new_class .= 'content'; |
|
100 | + } |
|
101 | + if (get_option('geodir_show_home_right_section')) { |
|
102 | + $new_class .= '-sidebar'; |
|
103 | + } |
|
104 | + } elseif (geodir_is_page('listing')) { |
|
105 | + $remove_class = true; |
|
106 | + if (get_option('geodir_show_listing_left_section')) { |
|
107 | + $new_class .= 'sidebar-'; |
|
108 | + } |
|
109 | + $new_class .= 'content'; |
|
110 | + if (get_option('geodir_show_listing_right_section')) { |
|
111 | + $new_class .= '-sidebar'; |
|
112 | + } |
|
113 | + } elseif (geodir_is_page('detail')) { |
|
114 | + $remove_class = true; |
|
115 | + if (get_option('geodir_detail_sidebar_left_section')) { |
|
116 | + $new_class .= 'sidebar-content gd-details-sidebar-left'; |
|
117 | + } else { |
|
118 | + $new_class .= 'content-sidebar'; |
|
119 | + } |
|
120 | + } elseif (geodir_is_page('search')) { |
|
121 | + $remove_class = true; |
|
122 | + if (get_option('geodir_show_search_left_section')) { |
|
123 | + $new_class .= 'sidebar-'; |
|
124 | + } |
|
125 | + $new_class .= 'content'; |
|
126 | + if (get_option('geodir_show_search_right_section')) { |
|
127 | + $new_class .= '-sidebar'; |
|
128 | + } |
|
129 | + } elseif (geodir_is_page('author')) { |
|
130 | + $remove_class = true; |
|
131 | + if (get_option('geodir_show_author_left_section')) { |
|
132 | + $new_class .= 'sidebar-'; |
|
133 | + } |
|
134 | + $new_class .= 'content'; |
|
135 | + if (get_option('geodir_show_author_right_section')) { |
|
136 | + $new_class .= '-sidebar'; |
|
137 | + } |
|
138 | + } elseif (geodir_is_page('add-listing')) { |
|
139 | + $remove_class = true; |
|
140 | + $new_class .= 'content-sidebar'; |
|
141 | + } |
|
142 | + |
|
143 | + if ($remove_class) { |
|
144 | + $classes = array_diff($classes, array('content-sidebar', 'sidebar-content', 'content-sidebar-sidebar', 'sidebar-sidebar-content', 'sidebar-content-sidebar', 'full-width-content')); |
|
145 | + //str_replace(array('content-sidebar','sidebar-content','content-sidebar-sidebar','sidebar-sidebar-content','sidebar-content-sidebar','full-width-content'),array('','','','','',''),$classes); |
|
146 | + $classes[] = $new_class; |
|
147 | + } |
|
148 | + |
|
149 | + return $classes; |
|
150 | 150 | |
151 | 151 | } |
152 | 152 | |
@@ -160,17 +160,17 @@ discard block |
||
160 | 160 | function gd_genesis_compat_add_top_section_back() |
161 | 161 | { |
162 | 162 | |
163 | - if (is_page_geodir_home() || geodir_is_page('location')) { |
|
164 | - geodir_action_geodir_sidebar_home_top(); |
|
165 | - } elseif (geodir_is_page('listing')) { |
|
166 | - geodir_action_geodir_sidebar_listings_top(); |
|
167 | - } elseif (geodir_is_page('detail')) { |
|
168 | - geodir_action_geodir_sidebar_detail_top(); |
|
169 | - } elseif (geodir_is_page('search')) { |
|
170 | - geodir_action_geodir_sidebar_search_top(); |
|
171 | - } elseif (geodir_is_page('author')) { |
|
172 | - geodir_action_geodir_sidebar_author_top(); |
|
173 | - } |
|
163 | + if (is_page_geodir_home() || geodir_is_page('location')) { |
|
164 | + geodir_action_geodir_sidebar_home_top(); |
|
165 | + } elseif (geodir_is_page('listing')) { |
|
166 | + geodir_action_geodir_sidebar_listings_top(); |
|
167 | + } elseif (geodir_is_page('detail')) { |
|
168 | + geodir_action_geodir_sidebar_detail_top(); |
|
169 | + } elseif (geodir_is_page('search')) { |
|
170 | + geodir_action_geodir_sidebar_search_top(); |
|
171 | + } elseif (geodir_is_page('author')) { |
|
172 | + geodir_action_geodir_sidebar_author_top(); |
|
173 | + } |
|
174 | 174 | |
175 | 175 | |
176 | 176 | } |
@@ -183,12 +183,12 @@ discard block |
||
183 | 183 | */ |
184 | 184 | function geodir_replace_breadcrumb() |
185 | 185 | { |
186 | - if (is_front_page() && geodir_is_page('home') && !geodir_is_page('login')) { |
|
187 | - } else { |
|
188 | - echo '<div class="geodir-breadcrumb-bar"><div class="wrap">'; |
|
189 | - geodir_breadcrumb(); |
|
190 | - echo '</div></div>'; |
|
191 | - } |
|
186 | + if (is_front_page() && geodir_is_page('home') && !geodir_is_page('login')) { |
|
187 | + } else { |
|
188 | + echo '<div class="geodir-breadcrumb-bar"><div class="wrap">'; |
|
189 | + geodir_breadcrumb(); |
|
190 | + echo '</div></div>'; |
|
191 | + } |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | // Force Full Width on signup page |
@@ -201,9 +201,9 @@ discard block |
||
201 | 201 | */ |
202 | 202 | function geodir_genesis_meta() |
203 | 203 | { |
204 | - if (geodir_is_page('login')) { |
|
205 | - add_filter('genesis_pre_get_option_site_layout', '__genesis_return_full_width_content'); |
|
206 | - } |
|
204 | + if (geodir_is_page('login')) { |
|
205 | + add_filter('genesis_pre_get_option_site_layout', '__genesis_return_full_width_content'); |
|
206 | + } |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | add_action('geodir_add_listing_page_title', 'geodir_add_listing_page_title_genesis_before', 8); |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | function geodir_add_listing_page_title_genesis_before() |
217 | 217 | { |
218 | 218 | |
219 | - echo "<div class='entry' >"; |
|
219 | + echo "<div class='entry' >"; |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | function geodir_add_listing_form_genesis_after() |
231 | 231 | { |
232 | 232 | |
233 | - echo "</div>"; |
|
233 | + echo "</div>"; |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | |
@@ -249,38 +249,38 @@ discard block |
||
249 | 249 | { |
250 | 250 | |
251 | 251 | |
252 | - $title = ''; |
|
253 | - $subtitle = ''; |
|
254 | - |
|
255 | - if (geodir_is_page('listing')) { |
|
256 | - echo '<div class="wrap gd-title-wrap">'; |
|
257 | - geodir_action_listings_title(); |
|
258 | - echo '</div>'; |
|
259 | - } |
|
260 | - |
|
261 | - if (geodir_is_page('add-listing')) { |
|
262 | - echo '<div class="wrap gd-title-wrap">'; |
|
263 | - geodir_action_add_listing_page_title(); |
|
264 | - echo '</div>'; |
|
265 | - } |
|
266 | - |
|
267 | - if (geodir_is_page('author')) { |
|
268 | - echo '<div class="wrap gd-title-wrap">'; |
|
269 | - geodir_action_author_page_title(); |
|
270 | - echo '</div>'; |
|
271 | - } |
|
272 | - |
|
273 | - if (geodir_is_page('detail') || geodir_is_page('preview')) { |
|
274 | - echo '<div class="wrap gd-title-wrap">'; |
|
275 | - echo get_the_title(); |
|
276 | - echo '</div>'; |
|
277 | - } |
|
278 | - |
|
279 | - if (geodir_is_page('search')) { |
|
280 | - echo '<div class="wrap gd-title-wrap">'; |
|
281 | - geodir_action_search_page_title(); |
|
282 | - echo '</div>'; |
|
283 | - } |
|
252 | + $title = ''; |
|
253 | + $subtitle = ''; |
|
254 | + |
|
255 | + if (geodir_is_page('listing')) { |
|
256 | + echo '<div class="wrap gd-title-wrap">'; |
|
257 | + geodir_action_listings_title(); |
|
258 | + echo '</div>'; |
|
259 | + } |
|
260 | + |
|
261 | + if (geodir_is_page('add-listing')) { |
|
262 | + echo '<div class="wrap gd-title-wrap">'; |
|
263 | + geodir_action_add_listing_page_title(); |
|
264 | + echo '</div>'; |
|
265 | + } |
|
266 | + |
|
267 | + if (geodir_is_page('author')) { |
|
268 | + echo '<div class="wrap gd-title-wrap">'; |
|
269 | + geodir_action_author_page_title(); |
|
270 | + echo '</div>'; |
|
271 | + } |
|
272 | + |
|
273 | + if (geodir_is_page('detail') || geodir_is_page('preview')) { |
|
274 | + echo '<div class="wrap gd-title-wrap">'; |
|
275 | + echo get_the_title(); |
|
276 | + echo '</div>'; |
|
277 | + } |
|
278 | + |
|
279 | + if (geodir_is_page('search')) { |
|
280 | + echo '<div class="wrap gd-title-wrap">'; |
|
281 | + geodir_action_search_page_title(); |
|
282 | + echo '</div>'; |
|
283 | + } |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | |
@@ -293,8 +293,8 @@ discard block |
||
293 | 293 | */ |
294 | 294 | function gd_genesis_listing_page_title_bar() |
295 | 295 | { |
296 | - geodir_action_listings_title(); |
|
297 | - //geodir_action_listings_description(); |
|
296 | + geodir_action_listings_title(); |
|
297 | + //geodir_action_listings_description(); |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | |
@@ -307,19 +307,19 @@ discard block |
||
307 | 307 | */ |
308 | 308 | function gd_compat_php_genesis_geo_1280_fix() |
309 | 309 | { |
310 | - if (function_exists('geo1280_search_bar')) { |
|
311 | - remove_action('genesis_after_header', 'geo1280_search_bar', 20); |
|
312 | - add_action('genesis_after_header', 'geo1280_search_bar_fix', 4); |
|
310 | + if (function_exists('geo1280_search_bar')) { |
|
311 | + remove_action('genesis_after_header', 'geo1280_search_bar', 20); |
|
312 | + add_action('genesis_after_header', 'geo1280_search_bar_fix', 4); |
|
313 | 313 | |
314 | - // |
|
314 | + // |
|
315 | 315 | |
316 | - remove_action('genesis_after_header', 'geodir_replace_breadcrumb', 20); |
|
317 | - remove_action('genesis_before_content_sidebar_wrap', 'geodir_replace_breadcrumb', 20); |
|
318 | - add_action('geodir_wrapper_open', 'geodir_replace_breadcrumb', 105); |
|
316 | + remove_action('genesis_after_header', 'geodir_replace_breadcrumb', 20); |
|
317 | + remove_action('genesis_before_content_sidebar_wrap', 'geodir_replace_breadcrumb', 20); |
|
318 | + add_action('geodir_wrapper_open', 'geodir_replace_breadcrumb', 105); |
|
319 | 319 | |
320 | - remove_action('genesis_before_content_sidebar_wrap', 'geo1280_page_title', 10); |
|
321 | - add_action('geodir_wrapper_open', 'geo1280_page_title', 101); |
|
322 | - } |
|
320 | + remove_action('genesis_before_content_sidebar_wrap', 'geo1280_page_title', 10); |
|
321 | + add_action('geodir_wrapper_open', 'geo1280_page_title', 101); |
|
322 | + } |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | /** |
@@ -331,11 +331,11 @@ discard block |
||
331 | 331 | function geo1280_search_bar_fix() |
332 | 332 | { |
333 | 333 | |
334 | - echo '<div class="geo1280-placeholder"></div>'; |
|
335 | - if (is_active_sidebar('search-bar')) { |
|
336 | - genesis_widget_area('search-bar', array( |
|
337 | - 'before' => '<div class="search-bar widget-area"><div class="wrap">', |
|
338 | - 'after' => '</div></div>', |
|
339 | - )); |
|
340 | - } |
|
334 | + echo '<div class="geo1280-placeholder"></div>'; |
|
335 | + if (is_active_sidebar('search-bar')) { |
|
336 | + genesis_widget_area('search-bar', array( |
|
337 | + 'before' => '<div class="search-bar widget-area"><div class="wrap">', |
|
338 | + 'after' => '</div></div>', |
|
339 | + )); |
|
340 | + } |
|
341 | 341 | } |
@@ -12,27 +12,27 @@ |
||
12 | 12 | <div class="clearfix"> |
13 | 13 | <div id="geodir_content"> |
14 | 14 | <?php |
15 | - /** This action is documented in geodirectory-templates/geodir-home.php */ |
|
16 | - do_action('geodir_add_page_content', 'before', 'info-page'); |
|
17 | - global $information; |
|
18 | - echo '<h5 class="geodir_information">'; |
|
19 | - echo $information; |
|
20 | - echo '</h5>'; |
|
21 | - /** This action is documented in geodirectory-templates/geodir-home.php */ |
|
22 | - do_action('geodir_add_page_content', 'after', 'info-page'); |
|
23 | - ?> |
|
15 | + /** This action is documented in geodirectory-templates/geodir-home.php */ |
|
16 | + do_action('geodir_add_page_content', 'before', 'info-page'); |
|
17 | + global $information; |
|
18 | + echo '<h5 class="geodir_information">'; |
|
19 | + echo $information; |
|
20 | + echo '</h5>'; |
|
21 | + /** This action is documented in geodirectory-templates/geodir-home.php */ |
|
22 | + do_action('geodir_add_page_content', 'after', 'info-page'); |
|
23 | + ?> |
|
24 | 24 | </div> |
25 | 25 | <!-- geodir_content ends here--> |
26 | 26 | <div id="gd-sidebar-wrapper"> |
27 | 27 | <div class="geodir-sidebar-main"> |
28 | 28 | <div class="geodir-gd-sidebar"> |
29 | 29 | <?php |
30 | - /** |
|
31 | - * Calls the author sidebar. |
|
32 | - * |
|
33 | - * @since 1.6.11 |
|
34 | - */ |
|
35 | - dynamic_sidebar('geodir_author_right_sidebar'); ?> |
|
30 | + /** |
|
31 | + * Calls the author sidebar. |
|
32 | + * |
|
33 | + * @since 1.6.11 |
|
34 | + */ |
|
35 | + dynamic_sidebar('geodir_author_right_sidebar'); ?> |
|
36 | 36 | </div> |
37 | 37 | </div> |
38 | 38 | </div> |