Completed
Pull Request — master (#206)
by Kiran
05:47
created
geodirectory-widgets/listing_map_widget.php 3 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
          * @param string $post->marker_json JSON representation of the post marker info.
46 46
          * @param object $post The post object.
47 47
          */
48
-        $list_map_json[] = apply_filters('geodir_create_list_jsondata',$post->marker_json,$post);
48
+        $list_map_json[] = apply_filters('geodir_create_list_jsondata', $post->marker_json, $post);
49 49
     }
50 50
 
51 51
 }
@@ -157,8 +157,8 @@  discard block
 block discarded – undo
157 157
 			 *
158 158
              * @param bool $display true if map should be displayed, false if not.
159 159
              */
160
-			$show_map = apply_filters( 'geodir_show_map_listing', $display = true );
161
-			if ( !$show_map ) {
160
+			$show_map = apply_filters('geodir_show_map_listing', $display = true);
161
+			if (!$show_map) {
162 162
 				return;
163 163
 			}
164 164
 
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
     public function form($instance)
258 258
     {
259 259
         //widgetform in backend
260
-        $instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0'));
260
+        $instance = wp_parse_args((array) $instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0'));
261 261
         $width = strip_tags($instance['width']);
262 262
         $heigh = strip_tags($instance['heigh']);
263 263
         $maptype = strip_tags($instance['maptype']);
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
                     <option <?php if (isset($maptype) && $maptype == 'HYBRID') {
304 304
                         echo 'selected="selected"';
305 305
                     } ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option>
306
-					<option <?php selected($maptype, 'TERRAIN');?> 
306
+					<option <?php selected($maptype, 'TERRAIN'); ?> 
307 307
 							value="TERRAIN"><?php _e('Terrain Map', 'geodirectory'); ?></option>
308 308
                 </select>
309 309
             </label>
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
                 :
362 362
                 <input id="<?php echo $this->get_field_id('scrollwheel'); ?>"
363 363
                        name="<?php echo $this->get_field_name('scrollwheel'); ?>" type="checkbox" value="1"
364
-                       <?php if ($scrollwheel){ ?>checked="checked" <?php } ?> />
364
+                       <?php if ($scrollwheel) { ?>checked="checked" <?php } ?> />
365 365
             </label>
366 366
         </p>
367 367
 
Please login to merge, or discard this patch.
Indentation   +180 added lines, -180 removed lines patch added patch discarded remove patch
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
  */
19 19
 function init_listing_map_script()
20 20
 {
21
-    global $list_map_json;
21
+	global $list_map_json;
22 22
 
23
-    $list_map_json = array();
23
+	$list_map_json = array();
24 24
 
25 25
 }
26 26
 
@@ -35,18 +35,18 @@  discard block
 block discarded – undo
35 35
  */
36 36
 function create_list_jsondata($post)
37 37
 {
38
-    global $wpdb, $list_map_json, $add_post_in_marker_array;
39
-
40
-    if ((is_main_query() || $add_post_in_marker_array) && isset($post->marker_json) && $post->marker_json != '') {
41
-        /**
42
-         * Filter the json data for search listing map.
43
-         *
44
-         * @since 1.5.7
45
-         * @param string $post->marker_json JSON representation of the post marker info.
46
-         * @param object $post The post object.
47
-         */
48
-        $list_map_json[] = apply_filters('geodir_create_list_jsondata',$post->marker_json,$post);
49
-    }
38
+	global $wpdb, $list_map_json, $add_post_in_marker_array;
39
+
40
+	if ((is_main_query() || $add_post_in_marker_array) && isset($post->marker_json) && $post->marker_json != '') {
41
+		/**
42
+		 * Filter the json data for search listing map.
43
+		 *
44
+		 * @since 1.5.7
45
+		 * @param string $post->marker_json JSON representation of the post marker info.
46
+		 * @param object $post The post object.
47
+		 */
48
+		$list_map_json[] = apply_filters('geodir_create_list_jsondata',$post->marker_json,$post);
49
+	}
50 50
 
51 51
 }
52 52
 
@@ -59,25 +59,25 @@  discard block
 block discarded – undo
59 59
  */
60 60
 function show_listing_widget_map()
61 61
 {
62
-    global $list_map_json;
62
+	global $list_map_json;
63 63
 
64
-    if (!empty($list_map_json)) {
65
-        $list_map_json = array_unique($list_map_json);
66
-        $cat_content_info[] = implode(',', $list_map_json);
67
-    }
64
+	if (!empty($list_map_json)) {
65
+		$list_map_json = array_unique($list_map_json);
66
+		$cat_content_info[] = implode(',', $list_map_json);
67
+	}
68 68
 
69
-    $totalcount = count(array_unique($list_map_json));
69
+	$totalcount = count(array_unique($list_map_json));
70 70
 
71 71
 
72
-    if (!empty($cat_content_info))
73
-        $list_json = '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
74
-    else
75
-        $list_json = '[{"totalcount":"0"}]';
72
+	if (!empty($cat_content_info))
73
+		$list_json = '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
74
+	else
75
+		$list_json = '[{"totalcount":"0"}]';
76 76
 
77
-    $listing_map_args = array('list_json' => $list_json);
77
+	$listing_map_args = array('list_json' => $list_json);
78 78
 
79
-    // Pass the json data in listing map script
80
-    wp_localize_script('geodir-listing-map-widget', 'listing_map_args', $listing_map_args);
79
+	// Pass the json data in listing map script
80
+	wp_localize_script('geodir-listing-map-widget', 'listing_map_args', $listing_map_args);
81 81
 
82 82
 }
83 83
 
@@ -89,184 +89,184 @@  discard block
 block discarded – undo
89 89
 class geodir_map_listingpage extends WP_Widget
90 90
 {
91 91
 
92
-    /**
92
+	/**
93 93
 	 * Register the listing page map widget.
94 94
 	 *
95 95
 	 * @since 1.0.0
96
-     * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
96
+	 * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
97 97
 	 */
98
-    public function __construct() {
99
-        $widget_ops = array('classname' => 'widget geodir-map-listing-page', 'description' => __('Google Map for Listing page. It will show you google map V3 for Listing page.', 'geodirectory'));
100
-        parent::__construct(
101
-            'geodir_map_v3_listing_map', // Base ID
102
-            __('GD > GMap - Listing page', 'geodirectory'), // Name
103
-            $widget_ops// Args
104
-        );
98
+	public function __construct() {
99
+		$widget_ops = array('classname' => 'widget geodir-map-listing-page', 'description' => __('Google Map for Listing page. It will show you google map V3 for Listing page.', 'geodirectory'));
100
+		parent::__construct(
101
+			'geodir_map_v3_listing_map', // Base ID
102
+			__('GD > GMap - Listing page', 'geodirectory'), // Name
103
+			$widget_ops// Args
104
+		);
105 105
 
106
-        add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array
106
+		add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array
107 107
 
108
-        add_action('the_post', 'create_list_jsondata'); // Add marker in json array
108
+		add_action('the_post', 'create_list_jsondata'); // Add marker in json array
109 109
 
110
-        add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers
111
-    }
110
+		add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers
111
+	}
112 112
 
113 113
 	/**
114 114
 	 * Front-end display content for listing page map widget.
115 115
 	 *
116 116
 	 * @since 1.0.0
117
-     * @since 1.5.1 Declare function public.
117
+	 * @since 1.5.1 Declare function public.
118
+	 *
119
+	 * @global object $post The current post object.
118 120
 	 *
119
-     * @global object $post The current post object.
120
-     *
121 121
 	 * @param array $args     Widget arguments.
122 122
 	 * @param array $instance Saved values from database.
123 123
 	 */
124
-    public function widget($args, $instance)
125
-    {
126
-
127
-        if (geodir_is_page('listing') || geodir_is_page('author') || geodir_is_page('search')
128
-            || geodir_is_page('detail')
129
-        ) :
130
-
131
-            extract($args, EXTR_SKIP);
132
-            /** This action is documented in geodirectory_shortcodes.php */
133
-            $width = empty($instance['width']) ? '294' : apply_filters('widget_width', $instance['width']);
134
-            /** This action is documented in geodirectory_shortcodes.php */
135
-            $height = empty($instance['heigh']) ? '370' : apply_filters('widget_heigh', $instance['heigh']);
136
-            /** This action is documented in geodirectory_shortcodes.php */
137
-            $maptype = empty($instance['maptype']) ? 'ROADMAP' : apply_filters('widget_maptype', $instance['maptype']);
138
-            /** This action is documented in geodirectory_shortcodes.php */
139
-            $zoom = empty($instance['zoom']) ? '13' : apply_filters('widget_zoom', $instance['zoom']);
140
-            /** This action is documented in geodirectory_shortcodes.php */
141
-            $autozoom = empty($instance['autozoom']) ? '' : apply_filters('widget_autozoom', $instance['autozoom']);
142
-            /**
143
-             * Filter the listing map value widget_sticky, to set if the map should be sticky or not (scroll with page).
144
-             *
145
-             * @since 1.0.0
146
-             * @param bool $sticky True if should be sticky, false if not
147
-             */
148
-            $sticky = empty($instance['sticky']) ? '' : apply_filters('widget_sticky', $instance['sticky']);
149
-            /** This action is documented in geodirectory_shortcodes.php */
150
-            $scrollwheel = empty($instance['scrollwheel']) ? '0' : apply_filters('widget_scrollwheel', $instance['scrollwheel']);
151
-            $showall = empty($instance['showall']) ? '0' : apply_filters('widget_showall', $instance['showall']);
124
+	public function widget($args, $instance)
125
+	{
126
+
127
+		if (geodir_is_page('listing') || geodir_is_page('author') || geodir_is_page('search')
128
+			|| geodir_is_page('detail')
129
+		) :
130
+
131
+			extract($args, EXTR_SKIP);
132
+			/** This action is documented in geodirectory_shortcodes.php */
133
+			$width = empty($instance['width']) ? '294' : apply_filters('widget_width', $instance['width']);
134
+			/** This action is documented in geodirectory_shortcodes.php */
135
+			$height = empty($instance['heigh']) ? '370' : apply_filters('widget_heigh', $instance['heigh']);
136
+			/** This action is documented in geodirectory_shortcodes.php */
137
+			$maptype = empty($instance['maptype']) ? 'ROADMAP' : apply_filters('widget_maptype', $instance['maptype']);
138
+			/** This action is documented in geodirectory_shortcodes.php */
139
+			$zoom = empty($instance['zoom']) ? '13' : apply_filters('widget_zoom', $instance['zoom']);
140
+			/** This action is documented in geodirectory_shortcodes.php */
141
+			$autozoom = empty($instance['autozoom']) ? '' : apply_filters('widget_autozoom', $instance['autozoom']);
142
+			/**
143
+			 * Filter the listing map value widget_sticky, to set if the map should be sticky or not (scroll with page).
144
+			 *
145
+			 * @since 1.0.0
146
+			 * @param bool $sticky True if should be sticky, false if not
147
+			 */
148
+			$sticky = empty($instance['sticky']) ? '' : apply_filters('widget_sticky', $instance['sticky']);
149
+			/** This action is documented in geodirectory_shortcodes.php */
150
+			$scrollwheel = empty($instance['scrollwheel']) ? '0' : apply_filters('widget_scrollwheel', $instance['scrollwheel']);
151
+			$showall = empty($instance['showall']) ? '0' : apply_filters('widget_showall', $instance['showall']);
152 152
 			
153 153
 			/**
154
-             * Filter the listing map should to be displayed or not.
155
-             *
156
-             * @since 1.4.6
154
+			 * Filter the listing map should to be displayed or not.
157 155
 			 *
158
-             * @param bool $display true if map should be displayed, false if not.
159
-             */
156
+			 * @since 1.4.6
157
+			 *
158
+			 * @param bool $display true if map should be displayed, false if not.
159
+			 */
160 160
 			$show_map = apply_filters( 'geodir_show_map_listing', $display = true );
161 161
 			if ( !$show_map ) {
162 162
 				return;
163 163
 			}
164 164
 
165
-            $map_args = array();
166
-            $map_args['map_canvas_name'] = str_replace('-', '_', $args['widget_id']);
167
-            $map_args['width'] = $width;
168
-            $map_args['height'] = $height;
169
-
170
-            $map_args['scrollwheel'] = $scrollwheel;
171
-            $map_args['showall'] = $showall;
172
-            $map_args['child_collapse'] = '0';
173
-            $map_args['sticky'] = $sticky;
174
-            $map_args['enable_cat_filters'] = false;
175
-            $map_args['enable_text_search'] = false;
176
-            $map_args['enable_post_type_filters'] = false;
177
-            $map_args['enable_location_filters'] = false;
178
-            $map_args['enable_jason_on_load'] = true;
165
+			$map_args = array();
166
+			$map_args['map_canvas_name'] = str_replace('-', '_', $args['widget_id']);
167
+			$map_args['width'] = $width;
168
+			$map_args['height'] = $height;
169
+
170
+			$map_args['scrollwheel'] = $scrollwheel;
171
+			$map_args['showall'] = $showall;
172
+			$map_args['child_collapse'] = '0';
173
+			$map_args['sticky'] = $sticky;
174
+			$map_args['enable_cat_filters'] = false;
175
+			$map_args['enable_text_search'] = false;
176
+			$map_args['enable_post_type_filters'] = false;
177
+			$map_args['enable_location_filters'] = false;
178
+			$map_args['enable_jason_on_load'] = true;
179 179
 			
180
-            if (is_single()) {
181
-
182
-                global $post;
183
-                $map_default_lat = $address_latitude = $post->post_latitude;
184
-                $map_default_lng = $address_longitude = $post->post_longitude;
185
-                $mapview = $post->post_mapview;
186
-                $mapzoom = $post->post_mapzoom;
187
-                $map_args['map_class_name'] = 'geodir-map-listing-page-single';
188
-
189
-            } else {
190
-                $default_location = geodir_get_default_location();
191
-
192
-                $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
193
-                $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
194
-                $map_args['map_class_name'] = 'geodir-map-listing-page';
195
-                $mapview = $maptype;
196
-            }
197
-
198
-            if (empty($mapzoom)) $mapzoom = $zoom;
199
-
200
-            // Set default map options
201
-            $map_args['ajax_url'] = geodir_get_ajax_url();
202
-            $map_args['latitude'] = $map_default_lat;
203
-            $map_args['longitude'] = $map_default_lng;
204
-            $map_args['zoom'] = $zoom;
205
-            //$map_args['scrollwheel'] = true;
206
-            $map_args['scrollwheel'] = $scrollwheel;
207
-            $map_args['showall'] = $showall;
208
-            $map_args['streetViewControl'] = true;
209
-            $map_args['maptype'] = $maptype;
210
-            $map_args['showPreview'] = '0';
211
-            $map_args['maxZoom'] = 21;
212
-            $map_args['autozoom'] = $autozoom;
213
-            $map_args['bubble_size'] = 'small';
214
-
215
-            echo $before_widget;
216
-            geodir_draw_map($map_args);
217
-            echo $after_widget;
218
-
219
-        endif;
220
-    }
180
+			if (is_single()) {
181
+
182
+				global $post;
183
+				$map_default_lat = $address_latitude = $post->post_latitude;
184
+				$map_default_lng = $address_longitude = $post->post_longitude;
185
+				$mapview = $post->post_mapview;
186
+				$mapzoom = $post->post_mapzoom;
187
+				$map_args['map_class_name'] = 'geodir-map-listing-page-single';
188
+
189
+			} else {
190
+				$default_location = geodir_get_default_location();
191
+
192
+				$map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
193
+				$map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
194
+				$map_args['map_class_name'] = 'geodir-map-listing-page';
195
+				$mapview = $maptype;
196
+			}
197
+
198
+			if (empty($mapzoom)) $mapzoom = $zoom;
199
+
200
+			// Set default map options
201
+			$map_args['ajax_url'] = geodir_get_ajax_url();
202
+			$map_args['latitude'] = $map_default_lat;
203
+			$map_args['longitude'] = $map_default_lng;
204
+			$map_args['zoom'] = $zoom;
205
+			//$map_args['scrollwheel'] = true;
206
+			$map_args['scrollwheel'] = $scrollwheel;
207
+			$map_args['showall'] = $showall;
208
+			$map_args['streetViewControl'] = true;
209
+			$map_args['maptype'] = $maptype;
210
+			$map_args['showPreview'] = '0';
211
+			$map_args['maxZoom'] = 21;
212
+			$map_args['autozoom'] = $autozoom;
213
+			$map_args['bubble_size'] = 'small';
214
+
215
+			echo $before_widget;
216
+			geodir_draw_map($map_args);
217
+			echo $after_widget;
218
+
219
+		endif;
220
+	}
221 221
 
222 222
 	/**
223 223
 	 * Sanitize listing page map widget form values as they are saved.
224 224
 	 *
225 225
 	 * @since 1.0.0
226
-     * @since 1.5.1 Declare function public.
226
+	 * @since 1.5.1 Declare function public.
227 227
 	 *
228 228
 	 * @param array $new_instance Values just sent to be saved.
229 229
 	 * @param array $old_instance Previously saved values from database.
230 230
 	 *
231 231
 	 * @return array Updated safe values to be saved.
232 232
 	 */
233
-    public function update($new_instance, $old_instance)
234
-    {
235
-        //save the widget
236
-        $instance = $old_instance;
237
-        $instance['width'] = strip_tags($new_instance['width']);
238
-        $instance['heigh'] = ($new_instance['heigh']);
239
-        $instance['maptype'] = ($new_instance['maptype']);
240
-        $instance['zoom'] = ($new_instance['zoom']);
241
-        $instance['autozoom'] = isset($new_instance['autozoom']) ? $new_instance['autozoom'] : '';
242
-        $instance['sticky'] = isset($new_instance['sticky']) ? $new_instance['sticky'] : '';
243
-        $instance['scrollwheel'] = isset($new_instance['scrollwheel']) ? ($new_instance['scrollwheel']) : '';
244
-        $instance['showall'] = isset($new_instance['showall']) ? ($new_instance['showall']) : '';
245
-
246
-        return $instance;
247
-    }
233
+	public function update($new_instance, $old_instance)
234
+	{
235
+		//save the widget
236
+		$instance = $old_instance;
237
+		$instance['width'] = strip_tags($new_instance['width']);
238
+		$instance['heigh'] = ($new_instance['heigh']);
239
+		$instance['maptype'] = ($new_instance['maptype']);
240
+		$instance['zoom'] = ($new_instance['zoom']);
241
+		$instance['autozoom'] = isset($new_instance['autozoom']) ? $new_instance['autozoom'] : '';
242
+		$instance['sticky'] = isset($new_instance['sticky']) ? $new_instance['sticky'] : '';
243
+		$instance['scrollwheel'] = isset($new_instance['scrollwheel']) ? ($new_instance['scrollwheel']) : '';
244
+		$instance['showall'] = isset($new_instance['showall']) ? ($new_instance['showall']) : '';
245
+
246
+		return $instance;
247
+	}
248 248
 
249 249
 	/**
250 250
 	 * Back-end listing page map widget settings form.
251 251
 	 *
252 252
 	 * @since 1.0.0
253
-     * @since 1.5.1 Declare function public.
253
+	 * @since 1.5.1 Declare function public.
254 254
 	 *
255 255
 	 * @param array $instance Previously saved values from database.
256 256
 	 */
257
-    public function form($instance)
258
-    {
259
-        //widgetform in backend
260
-        $instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0'));
261
-        $width = strip_tags($instance['width']);
262
-        $heigh = strip_tags($instance['heigh']);
263
-        $maptype = strip_tags($instance['maptype']);
264
-        $zoom = strip_tags($instance['zoom']);
265
-        $autozoom = strip_tags($instance['autozoom']);
266
-        $sticky = strip_tags($instance['sticky']);
267
-        $scrollwheel = strip_tags($instance['scrollwheel']);
268
-        $showall = strip_tags($instance['showall']);
269
-        ?>
257
+	public function form($instance)
258
+	{
259
+		//widgetform in backend
260
+		$instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0'));
261
+		$width = strip_tags($instance['width']);
262
+		$heigh = strip_tags($instance['heigh']);
263
+		$maptype = strip_tags($instance['maptype']);
264
+		$zoom = strip_tags($instance['zoom']);
265
+		$autozoom = strip_tags($instance['autozoom']);
266
+		$sticky = strip_tags($instance['sticky']);
267
+		$scrollwheel = strip_tags($instance['scrollwheel']);
268
+		$showall = strip_tags($instance['showall']);
269
+		?>
270 270
         <p>
271 271
             <label
272 272
                 for="<?php echo $this->get_field_id('width'); ?>"><?php _e('Map Width <small>(Default is : 294) you can use px or % here</small>', 'geodirectory'); ?>
@@ -295,14 +295,14 @@  discard block
 block discarded – undo
295 295
                         name="<?php echo $this->get_field_name('maptype'); ?>">
296 296
 
297 297
                     <option <?php if (isset($maptype) && $maptype == 'ROADMAP') {
298
-                        echo 'selected="selected"';
299
-                    } ?> value="ROADMAP"><?php _e('Road Map', 'geodirectory'); ?></option>
298
+						echo 'selected="selected"';
299
+					} ?> value="ROADMAP"><?php _e('Road Map', 'geodirectory'); ?></option>
300 300
                     <option <?php if (isset($maptype) && $maptype == 'SATELLITE') {
301
-                        echo 'selected="selected"';
302
-                    } ?> value="SATELLITE"><?php _e('Satellite Map', 'geodirectory'); ?></option>
301
+						echo 'selected="selected"';
302
+					} ?> value="SATELLITE"><?php _e('Satellite Map', 'geodirectory'); ?></option>
303 303
                     <option <?php if (isset($maptype) && $maptype == 'HYBRID') {
304
-                        echo 'selected="selected"';
305
-                    } ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option>
304
+						echo 'selected="selected"';
305
+					} ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option>
306 306
 					<option <?php selected($maptype, 'TERRAIN');?> 
307 307
 							value="TERRAIN"><?php _e('Terrain Map', 'geodirectory'); ?></option>
308 308
                 </select>
@@ -310,8 +310,8 @@  discard block
 block discarded – undo
310 310
         </p>
311 311
 
312 312
         <?php
313
-        $map_zoom_level = geodir_map_zoom_level();
314
-        ?>
313
+		$map_zoom_level = geodir_map_zoom_level();
314
+		?>
315 315
 
316 316
         <p>
317 317
             <label
@@ -321,14 +321,14 @@  discard block
 block discarded – undo
321 321
                 <select class="widefat" id="<?php echo $this->get_field_id('zoom'); ?>"
322 322
                         name="<?php echo $this->get_field_name('zoom'); ?>"> <?php
323 323
 
324
-                    foreach ($map_zoom_level as $level) {
325
-                        $selected = '';
326
-                        if ($level == $zoom)
327
-                            $selected = 'selected="selected"';
324
+					foreach ($map_zoom_level as $level) {
325
+						$selected = '';
326
+						if ($level == $zoom)
327
+							$selected = 'selected="selected"';
328 328
 
329
-                        echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>';
329
+						echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>';
330 330
 
331
-                    } ?>
331
+					} ?>
332 332
 
333 333
                 </select>
334 334
 
@@ -341,8 +341,8 @@  discard block
 block discarded – undo
341 341
                 :
342 342
                 <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('autozoom'); ?>"
343 343
                        name="<?php echo $this->get_field_name('autozoom'); ?>"<?php if ($autozoom) {
344
-                    echo 'checked="checked"';
345
-                } ?> /></label>
344
+					echo 'checked="checked"';
345
+				} ?> /></label>
346 346
         </p>
347 347
 
348 348
         <p>
@@ -351,8 +351,8 @@  discard block
 block discarded – undo
351 351
                 :
352 352
                 <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('sticky'); ?>"
353 353
                        name="<?php echo $this->get_field_name('sticky'); ?>"<?php if ($sticky) {
354
-                    echo 'checked="checked"';
355
-                } ?> /> </label>
354
+					echo 'checked="checked"';
355
+				} ?> /> </label>
356 356
         </p>
357 357
 
358 358
         <p>
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
     </p> -->
373 373
 
374 374
     <?php
375
-    }
375
+	}
376 376
 } // class geodir_map_listingpage
377 377
 
378 378
 register_widget('geodir_map_listingpage');
Please login to merge, or discard this patch.
Braces   +11 added lines, -7 removed lines patch added patch discarded remove patch
@@ -69,10 +69,11 @@  discard block
 block discarded – undo
69 69
     $totalcount = count(array_unique($list_map_json));
70 70
 
71 71
 
72
-    if (!empty($cat_content_info))
73
-        $list_json = '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
74
-    else
75
-        $list_json = '[{"totalcount":"0"}]';
72
+    if (!empty($cat_content_info)) {
73
+            $list_json = '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
74
+    } else {
75
+            $list_json = '[{"totalcount":"0"}]';
76
+    }
76 77
 
77 78
     $listing_map_args = array('list_json' => $list_json);
78 79
 
@@ -195,7 +196,9 @@  discard block
 block discarded – undo
195 196
                 $mapview = $maptype;
196 197
             }
197 198
 
198
-            if (empty($mapzoom)) $mapzoom = $zoom;
199
+            if (empty($mapzoom)) {
200
+            	$mapzoom = $zoom;
201
+            }
199 202
 
200 203
             // Set default map options
201 204
             $map_args['ajax_url'] = geodir_get_ajax_url();
@@ -323,8 +326,9 @@  discard block
 block discarded – undo
323 326
 
324 327
                     foreach ($map_zoom_level as $level) {
325 328
                         $selected = '';
326
-                        if ($level == $zoom)
327
-                            $selected = 'selected="selected"';
329
+                        if ($level == $zoom) {
330
+                                                    $selected = 'selected="selected"';
331
+                        }
328 332
 
329 333
                         echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>';
330 334
 
Please login to merge, or discard this patch.
geodirectory_shortcodes.php 2 patches
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -202,14 +202,14 @@  discard block
 block discarded – undo
202 202
 	// Add marker cluster
203 203
 	if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) {
204 204
         $map_args['enable_marker_cluster'] = true;
205
-        if(get_option('geodir_marker_cluster_type')) {
205
+        if (get_option('geodir_marker_cluster_type')) {
206 206
             if ($map_args['autozoom']) {
207 207
                 $map_args['enable_marker_cluster_no_reposition'] = false;
208 208
             } else {
209 209
                 $map_args['enable_marker_cluster_no_reposition'] = true;
210 210
             }
211 211
 
212
-            $map_args['enable_marker_cluster_server'] = true ;
212
+            $map_args['enable_marker_cluster_server'] = true;
213 213
 
214 214
         }
215 215
 	} else {
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 	}
218 218
 
219 219
     // if lat and long set in shortcode, hack it so the map is not repositioned
220
-    if(!empty($params['latitude']) && !empty($params['longitude']) ){
220
+    if (!empty($params['latitude']) && !empty($params['longitude'])) {
221 221
         $map_args['enable_marker_cluster_no_reposition'] = true;
222 222
     }
223 223
 
@@ -890,7 +890,7 @@  discard block
 block discarded – undo
890 890
 	
891 891
 	$show_adv_search = isset($params['show_adv_search']) && in_array($params['show_adv_search'], array('default', 'always', 'searched')) ? $params['show_adv_search'] : '';
892 892
 	
893
-	if ($show_adv_search != '' ) {
893
+	if ($show_adv_search != '') {
894 894
 		$show_adv_class = 'geodir-advance-search-' . $show_adv_search . ' ';
895 895
 		if ($show_adv_search == 'searched' && geodir_is_page('search')) {
896 896
 			$show_adv_search = 'search';
@@ -903,7 +903,7 @@  discard block
 block discarded – undo
903 903
 	ob_start();
904 904
 	
905 905
 	//geodir_get_template_part('listing', 'filter-form');
906
-	the_widget('geodir_advance_search_widget', $params, $params );
906
+	the_widget('geodir_advance_search_widget', $params, $params);
907 907
 	
908 908
 	$output = ob_get_contents();
909 909
     ob_end_clean();
@@ -1057,12 +1057,12 @@  discard block
 block discarded – undo
1057 1057
 	);
1058 1058
 	$params = shortcode_atts($defaults, $atts);
1059 1059
 
1060
-	$params['title'] 		= wp_strip_all_tags($params['title']);
1061
-    $params['post_type'] 	= gdsc_is_post_type_valid($params['post_type']) ? $params['post_type'] : 'gd_place';
1060
+	$params['title'] = wp_strip_all_tags($params['title']);
1061
+    $params['post_type'] = gdsc_is_post_type_valid($params['post_type']) ? $params['post_type'] : 'gd_place';
1062 1062
 	
1063 1063
 	// Validate the selected category/ies - Grab the current list based on post_type
1064
-    $category_taxonomy 		= geodir_get_taxonomies($params['post_type']);
1065
-    $categories 			= get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids'));
1064
+    $category_taxonomy = geodir_get_taxonomies($params['post_type']);
1065
+    $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids'));
1066 1066
 
1067 1067
     // Make sure we have an array
1068 1068
     if (!(is_array($params['category']))) {
@@ -1071,37 +1071,37 @@  discard block
 block discarded – undo
1071 1071
 
1072 1072
     // Array_intersect returns only the items in $params['category'] that are also in our category list
1073 1073
     // Otherwise it becomes empty and later on that will mean "All"
1074
-    $params['category'] 	= array_intersect($params['category'], $categories);
1074
+    $params['category'] = array_intersect($params['category'], $categories);
1075 1075
 	
1076 1076
 	// Post_number needs to be a positive integer
1077
-    $params['post_number'] 	= absint($params['post_number']);
1078
-    $params['post_number']	= $params['post_number'] > 0 ? $params['post_number'] : 10;
1077
+    $params['post_number'] = absint($params['post_number']);
1078
+    $params['post_number'] = $params['post_number'] > 0 ? $params['post_number'] : 10;
1079 1079
 	
1080 1080
 	// Validate character_count
1081 1081
     //todo: is this necessary?
1082
-    $params['character_count'] 	= $params['character_count'];
1082
+    $params['character_count'] = $params['character_count'];
1083 1083
 	
1084 1084
 	// Validate our layout choice
1085 1085
     // Outside of the norm, I added some more simple terms to match the existing
1086 1086
     // So now I just run the switch to set it properly.
1087
-    $params['layout'] 			= gdsc_validate_layout_choice($params['layout']);
1087
+    $params['layout'] = gdsc_validate_layout_choice($params['layout']);
1088 1088
 
1089 1089
     // Validate our sorting choice
1090
-    $params['list_sort'] 		= gdsc_validate_sort_choice($params['list_sort']);
1090
+    $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']);
1091 1091
 	
1092 1092
 	// Validate Listing width, used in the template widget-listing-listview.php
1093 1093
     // The context is in width=$listing_width% - So we need a positive number between 0 & 100
1094
-    $params['listing_width'] 	= gdsc_validate_listing_width($params['listing_width']);
1094
+    $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']);
1095 1095
 
1096 1096
     // Validate the checkboxes used on the widget
1097
-    $params['add_location_filter'] 	= gdsc_to_bool_val($params['add_location_filter']);
1098
-    $params['show_featured_only'] 	= gdsc_to_bool_val($params['show_featured_only']);
1099
-    $params['show_special_only'] 	= gdsc_to_bool_val($params['show_special_only']);
1100
-    $params['with_pics_only'] 		= gdsc_to_bool_val($params['with_pics_only']);
1101
-    $params['with_videos_only'] 	= gdsc_to_bool_val($params['with_videos_only']);
1102
-	$params['with_pagination'] 		= gdsc_to_bool_val($params['with_pagination']);
1103
-	$params['top_pagination'] 		= gdsc_to_bool_val($params['top_pagination']);
1104
-	$params['bottom_pagination'] 	= gdsc_to_bool_val($params['bottom_pagination']);
1097
+    $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']);
1098
+    $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']);
1099
+    $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']);
1100
+    $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']);
1101
+    $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']);
1102
+	$params['with_pagination'] = gdsc_to_bool_val($params['with_pagination']);
1103
+	$params['top_pagination'] = gdsc_to_bool_val($params['top_pagination']);
1104
+	$params['bottom_pagination'] = gdsc_to_bool_val($params['bottom_pagination']);
1105 1105
 	
1106 1106
     /**
1107 1107
      * End of validation
@@ -1114,7 +1114,7 @@  discard block
 block discarded – undo
1114 1114
 		$params['pageno'] = $atts['pageno'];
1115 1115
 		unset($atts['pageno']);
1116 1116
 	}
1117
-	$params['shortcode_atts'] 		= $atts;
1117
+	$params['shortcode_atts'] = $atts;
1118 1118
 
1119 1119
 	$output = geodir_sc_gd_listings_output($params);
1120 1120
 
@@ -1181,8 +1181,8 @@  discard block
 block discarded – undo
1181 1181
 	// Validate the checkboxes used on the widget
1182 1182
     $params['hide_empty'] 	= gdsc_to_bool_val($params['hide_empty']);
1183 1183
     $params['show_count'] 	= gdsc_to_bool_val($params['show_count']);
1184
-    $params['hide_icon'] 	= gdsc_to_bool_val($params['hide_icon']);
1185
-    $params['cpt_left'] 	= gdsc_to_bool_val($params['cpt_left']);
1184
+    $params['hide_icon'] = gdsc_to_bool_val($params['hide_icon']);
1185
+    $params['cpt_left'] = gdsc_to_bool_val($params['cpt_left']);
1186 1186
 	
1187 1187
 	if ($params['max_count'] != 'all') {
1188 1188
 		$params['max_count'] = absint($params['max_count']);
Please login to merge, or discard this patch.
Indentation   +591 added lines, -591 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  */
8 8
 // If this file is called directly, abort.
9 9
 if (!defined('WPINC')) {
10
-    die;
10
+	die;
11 11
 }
12 12
 require_once('geodirectory-functions/shortcode_functions.php');
13 13
 
@@ -32,48 +32,48 @@  discard block
 block discarded – undo
32 32
  */
33 33
 function geodir_sc_add_listing($atts)
34 34
 {
35
-    ob_start();
36
-    $defaults = array(
37
-        'pid' => '',
38
-        'listing_type' => 'gd_place',
39
-        'login_msg' => __('You must login to post.', 'geodirectory'),
40
-        'show_login' => false,
41
-    );
42
-    $params = shortcode_atts($defaults, $atts);
43
-
44
-    foreach ($params as $key => $value) {
45
-        $_REQUEST[$key] = $value;
46
-    }
47
-
48
-    $user_id = get_current_user_id();
49
-    if (!$user_id) {
50
-        echo $params['login_msg'];
51
-        if ($params['show_login']) {
52
-            echo "<br />";
53
-            $defaults = array(
54
-                'before_widget' => '',
55
-                'after_widget' => '',
56
-                'before_title' => '',
57
-                'after_title' => '',
58
-            );
59
-
60
-            geodir_loginwidget_output($defaults, $defaults);
61
-        }
62
-
63
-
64
-    } else {
65
-        ###### MAIN CONTENT ######
66
-
67
-        /** This action is documented in geodirectory-templates/add-listing.php */
68
-        do_action('geodir_add_listing_page_mandatory');
69
-        /** This action is documented in geodirectory-templates/add-listing.php */
70
-        do_action('geodir_add_listing_form');
71
-    }
72
-    $output = ob_get_contents();
73
-
74
-    ob_end_clean();
75
-
76
-    return $output;
35
+	ob_start();
36
+	$defaults = array(
37
+		'pid' => '',
38
+		'listing_type' => 'gd_place',
39
+		'login_msg' => __('You must login to post.', 'geodirectory'),
40
+		'show_login' => false,
41
+	);
42
+	$params = shortcode_atts($defaults, $atts);
43
+
44
+	foreach ($params as $key => $value) {
45
+		$_REQUEST[$key] = $value;
46
+	}
47
+
48
+	$user_id = get_current_user_id();
49
+	if (!$user_id) {
50
+		echo $params['login_msg'];
51
+		if ($params['show_login']) {
52
+			echo "<br />";
53
+			$defaults = array(
54
+				'before_widget' => '',
55
+				'after_widget' => '',
56
+				'before_title' => '',
57
+				'after_title' => '',
58
+			);
59
+
60
+			geodir_loginwidget_output($defaults, $defaults);
61
+		}
62
+
63
+
64
+	} else {
65
+		###### MAIN CONTENT ######
66
+
67
+		/** This action is documented in geodirectory-templates/add-listing.php */
68
+		do_action('geodir_add_listing_page_mandatory');
69
+		/** This action is documented in geodirectory-templates/add-listing.php */
70
+		do_action('geodir_add_listing_form');
71
+	}
72
+	$output = ob_get_contents();
73
+
74
+	ob_end_clean();
75
+
76
+	return $output;
77 77
 }
78 78
 
79 79
 /**
@@ -101,136 +101,136 @@  discard block
 block discarded – undo
101 101
  */
102 102
 function geodir_sc_home_map($atts)
103 103
 {
104
-    ob_start();
105
-    $defaults = array(
106
-        'width' => '960',
107
-        'height' => '425',
108
-        'maptype' => 'ROADMAP',
109
-        'zoom' => '13',
110
-        'autozoom' => '',
111
-        'child_collapse' => '0',
112
-        'scrollwheel' => '0',
104
+	ob_start();
105
+	$defaults = array(
106
+		'width' => '960',
107
+		'height' => '425',
108
+		'maptype' => 'ROADMAP',
109
+		'zoom' => '13',
110
+		'autozoom' => '',
111
+		'child_collapse' => '0',
112
+		'scrollwheel' => '0',
113 113
 		'marker_cluster' => false,
114
-        'latitude' => '',
115
-        'longitude' => ''
116
-    );
117
-
118
-    $params = shortcode_atts($defaults, $atts);
119
-
120
-    $params = gdsc_validate_map_args($params);
121
-
122
-    $map_args = array(
123
-        'map_canvas_name' => 'gd_home_map',
124
-        'latitude' => $params['latitude'],
125
-        'longitude' => $params['longitude'],
126
-
127
-        /**
128
-         * Filter the widget width of the map on home/listings page.
129
-         *
130
-         * @since 1.0.0
131
-         * @param mixed(string|int|float) $params['width'] The map width.
132
-         */
133
-        'width' => apply_filters('widget_width', $params['width']),
134
-        /**
135
-         * Filter the widget height of the map on home/listings page.
136
-         *
137
-         * @since 1.0.0
138
-         * @param mixed(string|int|float) $params['height'] The map height.
139
-         */
140
-        'height' => apply_filters('widget_heigh', $params['height']),
141
-        /**
142
-         * Filter the widget maptype of the map on home/listings page.
143
-         *
144
-         * @since 1.0.0
114
+		'latitude' => '',
115
+		'longitude' => ''
116
+	);
117
+
118
+	$params = shortcode_atts($defaults, $atts);
119
+
120
+	$params = gdsc_validate_map_args($params);
121
+
122
+	$map_args = array(
123
+		'map_canvas_name' => 'gd_home_map',
124
+		'latitude' => $params['latitude'],
125
+		'longitude' => $params['longitude'],
126
+
127
+		/**
128
+		 * Filter the widget width of the map on home/listings page.
129
+		 *
130
+		 * @since 1.0.0
131
+		 * @param mixed(string|int|float) $params['width'] The map width.
132
+		 */
133
+		'width' => apply_filters('widget_width', $params['width']),
134
+		/**
135
+		 * Filter the widget height of the map on home/listings page.
136
+		 *
137
+		 * @since 1.0.0
138
+		 * @param mixed(string|int|float) $params['height'] The map height.
139
+		 */
140
+		'height' => apply_filters('widget_heigh', $params['height']),
141
+		/**
142
+		 * Filter the widget maptype of the map on home/listings page.
143
+		 *
144
+		 * @since 1.0.0
145 145
 		 * @since 1.5.2 Added TERRAIN map type.
146
-         * @param string $params['maptype'] The map type. Can be ROADMAP | SATELLITE | HYBRID | TERRAIN.
147
-         */
148
-        'maptype' => apply_filters('widget_maptype', $params['maptype']),
149
-        /**
150
-         * Filter the widget scrollwheel value of the map on home/listings page.
151
-         *
152
-         * Should the scrollwheel zoom the map or not.
153
-         *
154
-         * @since 1.0.0
155
-         * @param bool $params['scrollwheel'] True to allow scroll wheel to scroll map or false if not.
156
-         */
157
-        'scrollwheel' => apply_filters('widget_scrollwheel', $params['scrollwheel']),
158
-        /**
159
-         * Filter the widget zoom level of the map on home/listings page.
160
-         *
161
-         * @since 1.0.0
162
-         * @param int $params['zoom'] The zoom level of the map. Between 1-19.
163
-         */
164
-        'zoom' => apply_filters('widget_zoom', $params['zoom']),
165
-        /**
166
-         * Filter the widget auto zoom value of the map on home/listings page.
167
-         *
168
-         * If the map should autozoom to fit the markers shown.
169
-         *
170
-         * @since 1.0.0
171
-         * @param bool $params['autozoom'] True if the map should autozoom, false if not.
172
-         */
173
-        'autozoom' => apply_filters('widget_autozoom', $params['autozoom']),
174
-        /**
175
-         * Filter the widget child_collapse value of the map on home/listings page.
176
-         *
177
-         * If the map should auto collapse the child categories if the category bar is present.
178
-         *
179
-         * @since 1.0.0
180
-         * @param bool $params['child_collapse'] True if the map should collapse the categories, false if not.
181
-         */
182
-        'child_collapse' => apply_filters('widget_child_collapse', $params['child_collapse']),
183
-        'enable_cat_filters' => true,
184
-        'enable_text_search' => true,
185
-        'enable_post_type_filters' => true,
186
-        /**
187
-         * Filter the widget enable_location_filters value of the map on home/listings page.
188
-         *
189
-         * This is used when the location addon is used.
190
-         *
191
-         * @since 1.0.0
192
-         * @param bool $val True if location filters should be used, false if not.
193
-         */
194
-        'enable_location_filters' => apply_filters('geodir_home_map_enable_location_filters', false),
195
-        'enable_jason_on_load' => false,
196
-        'enable_marker_cluster' => false,
197
-        'enable_map_resize_button' => true,
198
-        'map_class_name' => 'geodir-map-home-page',
199
-        'is_geodir_home_map_widget' => true,
200
-    );
146
+		 * @param string $params['maptype'] The map type. Can be ROADMAP | SATELLITE | HYBRID | TERRAIN.
147
+		 */
148
+		'maptype' => apply_filters('widget_maptype', $params['maptype']),
149
+		/**
150
+		 * Filter the widget scrollwheel value of the map on home/listings page.
151
+		 *
152
+		 * Should the scrollwheel zoom the map or not.
153
+		 *
154
+		 * @since 1.0.0
155
+		 * @param bool $params['scrollwheel'] True to allow scroll wheel to scroll map or false if not.
156
+		 */
157
+		'scrollwheel' => apply_filters('widget_scrollwheel', $params['scrollwheel']),
158
+		/**
159
+		 * Filter the widget zoom level of the map on home/listings page.
160
+		 *
161
+		 * @since 1.0.0
162
+		 * @param int $params['zoom'] The zoom level of the map. Between 1-19.
163
+		 */
164
+		'zoom' => apply_filters('widget_zoom', $params['zoom']),
165
+		/**
166
+		 * Filter the widget auto zoom value of the map on home/listings page.
167
+		 *
168
+		 * If the map should autozoom to fit the markers shown.
169
+		 *
170
+		 * @since 1.0.0
171
+		 * @param bool $params['autozoom'] True if the map should autozoom, false if not.
172
+		 */
173
+		'autozoom' => apply_filters('widget_autozoom', $params['autozoom']),
174
+		/**
175
+		 * Filter the widget child_collapse value of the map on home/listings page.
176
+		 *
177
+		 * If the map should auto collapse the child categories if the category bar is present.
178
+		 *
179
+		 * @since 1.0.0
180
+		 * @param bool $params['child_collapse'] True if the map should collapse the categories, false if not.
181
+		 */
182
+		'child_collapse' => apply_filters('widget_child_collapse', $params['child_collapse']),
183
+		'enable_cat_filters' => true,
184
+		'enable_text_search' => true,
185
+		'enable_post_type_filters' => true,
186
+		/**
187
+		 * Filter the widget enable_location_filters value of the map on home/listings page.
188
+		 *
189
+		 * This is used when the location addon is used.
190
+		 *
191
+		 * @since 1.0.0
192
+		 * @param bool $val True if location filters should be used, false if not.
193
+		 */
194
+		'enable_location_filters' => apply_filters('geodir_home_map_enable_location_filters', false),
195
+		'enable_jason_on_load' => false,
196
+		'enable_marker_cluster' => false,
197
+		'enable_map_resize_button' => true,
198
+		'map_class_name' => 'geodir-map-home-page',
199
+		'is_geodir_home_map_widget' => true,
200
+	);
201 201
 
202 202
 	// Add marker cluster
203 203
 	if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) {
204
-        $map_args['enable_marker_cluster'] = true;
205
-        if(get_option('geodir_marker_cluster_type')) {
206
-            if ($map_args['autozoom']) {
207
-                $map_args['enable_marker_cluster_no_reposition'] = false;
208
-            } else {
209
-                $map_args['enable_marker_cluster_no_reposition'] = true;
210
-            }
204
+		$map_args['enable_marker_cluster'] = true;
205
+		if(get_option('geodir_marker_cluster_type')) {
206
+			if ($map_args['autozoom']) {
207
+				$map_args['enable_marker_cluster_no_reposition'] = false;
208
+			} else {
209
+				$map_args['enable_marker_cluster_no_reposition'] = true;
210
+			}
211 211
 
212
-            $map_args['enable_marker_cluster_server'] = true ;
212
+			$map_args['enable_marker_cluster_server'] = true ;
213 213
 
214
-        }
214
+		}
215 215
 	} else {
216 216
 		$map_args['enable_marker_cluster'] = false;
217 217
 	}
218 218
 
219
-    // if lat and long set in shortcode, hack it so the map is not repositioned
220
-    if(!empty($params['latitude']) && !empty($params['longitude']) ){
221
-        $map_args['enable_marker_cluster_no_reposition'] = true;
222
-    }
219
+	// if lat and long set in shortcode, hack it so the map is not repositioned
220
+	if(!empty($params['latitude']) && !empty($params['longitude']) ){
221
+		$map_args['enable_marker_cluster_no_reposition'] = true;
222
+	}
223 223
 
224 224
 
225
-    geodir_draw_map($map_args);
225
+	geodir_draw_map($map_args);
226 226
 
227
-    add_action('wp_footer', 'geodir_home_map_add_script', 100);
227
+	add_action('wp_footer', 'geodir_home_map_add_script', 100);
228 228
 
229
-    $output = ob_get_contents();
229
+	$output = ob_get_contents();
230 230
 
231
-    ob_end_clean();
231
+	ob_end_clean();
232 232
 
233
-    return $output;
233
+	return $output;
234 234
 }
235 235
 add_shortcode('gd_homepage_map', 'geodir_sc_home_map');
236 236
 
@@ -264,77 +264,77 @@  discard block
 block discarded – undo
264 264
  */
265 265
 function geodir_sc_listing_map($atts)
266 266
 {
267
-    ob_start();
268
-    add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array
269
-
270
-    add_action('the_post', 'create_list_jsondata'); // Add marker in json array
271
-
272
-    add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers
273
-
274
-    $defaults = array(
275
-        'width' => '294',
276
-        'height' => '370',
277
-        'zoom' => '13',
278
-        'autozoom' => '',
279
-        'sticky' => '',
280
-        'showall' => '0',
281
-        'scrollwheel' => '0',
282
-        'maptype' => 'ROADMAP',
283
-        'child_collapse' => 0,
267
+	ob_start();
268
+	add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array
269
+
270
+	add_action('the_post', 'create_list_jsondata'); // Add marker in json array
271
+
272
+	add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers
273
+
274
+	$defaults = array(
275
+		'width' => '294',
276
+		'height' => '370',
277
+		'zoom' => '13',
278
+		'autozoom' => '',
279
+		'sticky' => '',
280
+		'showall' => '0',
281
+		'scrollwheel' => '0',
282
+		'maptype' => 'ROADMAP',
283
+		'child_collapse' => 0,
284 284
 		'marker_cluster' => false
285
-    );
286
-
287
-    $params = shortcode_atts($defaults, $atts);
288
-
289
-    $params = gdsc_validate_map_args($params);
290
-
291
-    $map_args = array(
292
-        'map_canvas_name' => 'gd_listing_map',
293
-        'width' => $params['width'],
294
-        'height' => $params['height'],
295
-        'zoom' => $params['zoom'],
296
-        'autozoom' => $params['autozoom'],
297
-        'sticky' => $params['sticky'],
298
-        'showall' => $params['showall'],
299
-        'scrollwheel' => $params['scrollwheel'],
300
-        'child_collapse' => 0,
301
-        'enable_cat_filters' => false,
302
-        'enable_text_search' => false,
303
-        'enable_post_type_filters' => false,
304
-        'enable_location_filters' => false,
305
-        'enable_jason_on_load' => true,
306
-    );
307
-
308
-    if (is_single()) {
309
-
310
-        global $post;
311
-        $map_default_lat = $address_latitude = $post->post_latitude;
312
-        $map_default_lng = $address_longitude = $post->post_longitude;
313
-        $mapview = $post->post_mapview;
314
-        $map_args['zoom'] = $post->post_mapzoom;
315
-        $map_args['map_class_name'] = 'geodir-map-listing-page-single';
316
-
317
-    } else {
318
-        $default_location = geodir_get_default_location();
319
-
320
-        $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
321
-        $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
322
-        $map_args['map_class_name'] = 'geodir-map-listing-page';
323
-    }
324
-
325
-    if (empty($mapview)) {
326
-        $mapview = 'ROADMAP';
327
-    }
328
-
329
-    // Set default map options
330
-    $map_args['ajax_url'] = geodir_get_ajax_url();
331
-    $map_args['latitude'] = $map_default_lat;
332
-    $map_args['longitude'] = $map_default_lng;
333
-    $map_args['streetViewControl'] = true;
334
-    $map_args['maptype'] = $mapview;
335
-    $map_args['showPreview'] = '0';
336
-    $map_args['maxZoom'] = 21;
337
-    $map_args['bubble_size'] = 'small';
285
+	);
286
+
287
+	$params = shortcode_atts($defaults, $atts);
288
+
289
+	$params = gdsc_validate_map_args($params);
290
+
291
+	$map_args = array(
292
+		'map_canvas_name' => 'gd_listing_map',
293
+		'width' => $params['width'],
294
+		'height' => $params['height'],
295
+		'zoom' => $params['zoom'],
296
+		'autozoom' => $params['autozoom'],
297
+		'sticky' => $params['sticky'],
298
+		'showall' => $params['showall'],
299
+		'scrollwheel' => $params['scrollwheel'],
300
+		'child_collapse' => 0,
301
+		'enable_cat_filters' => false,
302
+		'enable_text_search' => false,
303
+		'enable_post_type_filters' => false,
304
+		'enable_location_filters' => false,
305
+		'enable_jason_on_load' => true,
306
+	);
307
+
308
+	if (is_single()) {
309
+
310
+		global $post;
311
+		$map_default_lat = $address_latitude = $post->post_latitude;
312
+		$map_default_lng = $address_longitude = $post->post_longitude;
313
+		$mapview = $post->post_mapview;
314
+		$map_args['zoom'] = $post->post_mapzoom;
315
+		$map_args['map_class_name'] = 'geodir-map-listing-page-single';
316
+
317
+	} else {
318
+		$default_location = geodir_get_default_location();
319
+
320
+		$map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
321
+		$map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
322
+		$map_args['map_class_name'] = 'geodir-map-listing-page';
323
+	}
324
+
325
+	if (empty($mapview)) {
326
+		$mapview = 'ROADMAP';
327
+	}
328
+
329
+	// Set default map options
330
+	$map_args['ajax_url'] = geodir_get_ajax_url();
331
+	$map_args['latitude'] = $map_default_lat;
332
+	$map_args['longitude'] = $map_default_lng;
333
+	$map_args['streetViewControl'] = true;
334
+	$map_args['maptype'] = $mapview;
335
+	$map_args['showPreview'] = '0';
336
+	$map_args['maxZoom'] = 21;
337
+	$map_args['bubble_size'] = 'small';
338 338
 	
339 339
 	// Add marker cluster
340 340
 	if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) {
@@ -343,13 +343,13 @@  discard block
 block discarded – undo
343 343
 		$map_args['enable_marker_cluster'] = false;
344 344
 	}
345 345
 
346
-    geodir_draw_map($map_args);
346
+	geodir_draw_map($map_args);
347 347
 
348
-    $output = ob_get_contents();
348
+	$output = ob_get_contents();
349 349
 
350
-    ob_end_clean();
350
+	ob_end_clean();
351 351
 
352
-    return $output;
352
+	return $output;
353 353
 }
354 354
 
355 355
 add_shortcode('gd_listing_slider', 'geodir_sc_listing_slider');
@@ -382,120 +382,120 @@  discard block
 block discarded – undo
382 382
  */
383 383
 function geodir_sc_listing_slider($atts)
384 384
 {
385
-    ob_start();
386
-    $defaults = array(
387
-        'post_type' => 'gd_place',
388
-        'category' => '0',
389
-        'post_number' => '5',
390
-        'slideshow' => '0',
391
-        'animation_loop' => 0,
392
-        'direction_nav' => 0,
393
-        'slideshow_speed' => 5000,
394
-        'animation_speed' => 600,
395
-        'animation' => 'slide',
396
-        'order_by' => 'latest',
397
-        'show_title' => '',
398
-        'show_featured_only' => '',
399
-        'title' => '',
400
-    );
401
-
402
-    $params = shortcode_atts($defaults, $atts);
403
-
404
-
405
-    /*
385
+	ob_start();
386
+	$defaults = array(
387
+		'post_type' => 'gd_place',
388
+		'category' => '0',
389
+		'post_number' => '5',
390
+		'slideshow' => '0',
391
+		'animation_loop' => 0,
392
+		'direction_nav' => 0,
393
+		'slideshow_speed' => 5000,
394
+		'animation_speed' => 600,
395
+		'animation' => 'slide',
396
+		'order_by' => 'latest',
397
+		'show_title' => '',
398
+		'show_featured_only' => '',
399
+		'title' => '',
400
+	);
401
+
402
+	$params = shortcode_atts($defaults, $atts);
403
+
404
+
405
+	/*
406 406
      *
407 407
      * Now we begin the validation of the attributes.
408 408
      */
409
-    // Check we have a valid post_type
410
-    if (!(gdsc_is_post_type_valid($params['post_type']))) {
411
-        $params['post_type'] = 'gd_place';
412
-    }
413
-
414
-    // Check we have a valid sort_order
415
-    $params['order_by'] = gdsc_validate_sort_choice($params['order_by']);
416
-
417
-    // Match the chosen animation to our options
418
-    $animation_list = array('slide', 'fade');
419
-    if (!(in_array($params['animation'], $animation_list))) {
420
-        $params['animation'] = 'slide';
421
-    }
422
-
423
-    // Post_number needs to be a positive integer
424
-    $params['post_number'] = absint($params['post_number']);
425
-    if (0 == $params['post_number']) {
426
-        $params['post_number'] = 1;
427
-    }
428
-
429
-    // Manage the entered categories
430
-    if (0 != $params['category'] || '' != $params['category']) {
431
-        $params['category'] = gdsc_manage_category_choice($params['post_type'], $params['category']);
432
-    }
433
-    // Convert show_title to a bool
434
-    $params['show_title'] = intval(gdsc_to_bool_val($params['show_title']));
435
-
436
-    // Convert show_featured_only to a bool
437
-    $params['show_featured_only'] = intval(gdsc_to_bool_val($params['show_featured_only']));
438
-
439
-    /*
409
+	// Check we have a valid post_type
410
+	if (!(gdsc_is_post_type_valid($params['post_type']))) {
411
+		$params['post_type'] = 'gd_place';
412
+	}
413
+
414
+	// Check we have a valid sort_order
415
+	$params['order_by'] = gdsc_validate_sort_choice($params['order_by']);
416
+
417
+	// Match the chosen animation to our options
418
+	$animation_list = array('slide', 'fade');
419
+	if (!(in_array($params['animation'], $animation_list))) {
420
+		$params['animation'] = 'slide';
421
+	}
422
+
423
+	// Post_number needs to be a positive integer
424
+	$params['post_number'] = absint($params['post_number']);
425
+	if (0 == $params['post_number']) {
426
+		$params['post_number'] = 1;
427
+	}
428
+
429
+	// Manage the entered categories
430
+	if (0 != $params['category'] || '' != $params['category']) {
431
+		$params['category'] = gdsc_manage_category_choice($params['post_type'], $params['category']);
432
+	}
433
+	// Convert show_title to a bool
434
+	$params['show_title'] = intval(gdsc_to_bool_val($params['show_title']));
435
+
436
+	// Convert show_featured_only to a bool
437
+	$params['show_featured_only'] = intval(gdsc_to_bool_val($params['show_featured_only']));
438
+
439
+	/*
440 440
      * Hopefully all attributes are now valid, and safe to pass forward
441 441
      */
442 442
 
443
-    // redeclare vars after validation
444
-
445
-    if (isset($params['direction_nav'])) {
446
-        $params['directionNav'] = $params['direction_nav'];
447
-    }
448
-    if (isset($params['animation_loop'])) {
449
-        $params['animationLoop'] = $params['animation_loop'];
450
-    }
451
-    if (isset($params['slideshow_speed'])) {
452
-        $params['slideshowSpeed'] = $params['slideshow_speed'];
453
-    }
454
-    if (isset($params['animation_speed'])) {
455
-        $params['animationSpeed'] = $params['animation_speed'];
456
-    }
457
-    if (isset($params['order_by'])) {
458
-        $params['list_sort'] = $params['order_by'];
459
-    }
460
-
461
-    $query_args = array(
462
-        'post_number' => $params['post_number'],
463
-        'is_geodir_loop' => true,
464
-        'post_type' => $params['post_type'],
465
-        'order_by' => $params['order_by']
466
-    );
467
-
468
-    if (1 == $params['show_featured_only']) {
469
-        $query_args['show_featured_only'] = 1;
470
-    }
471
-
472
-    if (0 != $params['category'] && '' != $params['category']) {
473
-        $category_taxonomy = geodir_get_taxonomies($params['post_type']);
474
-        $tax_query = array(
475
-            'taxonomy' => $category_taxonomy[0],
476
-            'field' => 'id',
477
-            'terms' => $params['category'],
478
-        );
479
-
480
-        $query_args['tax_query'] = array($tax_query);
481
-    }
482
-
483
-    $defaults = array(
484
-        'before_widget' => '',
485
-        'after_widget' => '',
486
-        'before_title' => '',
487
-        'after_title' => '',
488
-    );
489
-
490
-    $query_args = array_merge($query_args, $params);
491
-
492
-    geodir_listing_slider_widget_output($defaults, $query_args);
493
-
494
-    $output = ob_get_contents();
495
-
496
-    ob_end_clean();
497
-
498
-    return $output;
443
+	// redeclare vars after validation
444
+
445
+	if (isset($params['direction_nav'])) {
446
+		$params['directionNav'] = $params['direction_nav'];
447
+	}
448
+	if (isset($params['animation_loop'])) {
449
+		$params['animationLoop'] = $params['animation_loop'];
450
+	}
451
+	if (isset($params['slideshow_speed'])) {
452
+		$params['slideshowSpeed'] = $params['slideshow_speed'];
453
+	}
454
+	if (isset($params['animation_speed'])) {
455
+		$params['animationSpeed'] = $params['animation_speed'];
456
+	}
457
+	if (isset($params['order_by'])) {
458
+		$params['list_sort'] = $params['order_by'];
459
+	}
460
+
461
+	$query_args = array(
462
+		'post_number' => $params['post_number'],
463
+		'is_geodir_loop' => true,
464
+		'post_type' => $params['post_type'],
465
+		'order_by' => $params['order_by']
466
+	);
467
+
468
+	if (1 == $params['show_featured_only']) {
469
+		$query_args['show_featured_only'] = 1;
470
+	}
471
+
472
+	if (0 != $params['category'] && '' != $params['category']) {
473
+		$category_taxonomy = geodir_get_taxonomies($params['post_type']);
474
+		$tax_query = array(
475
+			'taxonomy' => $category_taxonomy[0],
476
+			'field' => 'id',
477
+			'terms' => $params['category'],
478
+		);
479
+
480
+		$query_args['tax_query'] = array($tax_query);
481
+	}
482
+
483
+	$defaults = array(
484
+		'before_widget' => '',
485
+		'after_widget' => '',
486
+		'before_title' => '',
487
+		'after_title' => '',
488
+	);
489
+
490
+	$query_args = array_merge($query_args, $params);
491
+
492
+	geodir_listing_slider_widget_output($defaults, $query_args);
493
+
494
+	$output = ob_get_contents();
495
+
496
+	ob_end_clean();
497
+
498
+	return $output;
499 499
 }
500 500
 
501 501
 add_shortcode('gd_login_box', 'geodir_sc_login_box');
@@ -519,22 +519,22 @@  discard block
 block discarded – undo
519 519
  */
520 520
 function geodir_sc_login_box($atts)
521 521
 {
522
-    ob_start();
522
+	ob_start();
523 523
 
524
-    $defaults = array(
525
-        'before_widget' => '',
526
-        'after_widget' => '',
527
-        'before_title' => '',
528
-        'after_title' => '',
529
-    );
524
+	$defaults = array(
525
+		'before_widget' => '',
526
+		'after_widget' => '',
527
+		'before_title' => '',
528
+		'after_title' => '',
529
+	);
530 530
 
531
-    geodir_loginwidget_output($defaults, $defaults);
531
+	geodir_loginwidget_output($defaults, $defaults);
532 532
 
533
-    $output = ob_get_contents();
533
+	$output = ob_get_contents();
534 534
 
535
-    ob_end_clean();
535
+	ob_end_clean();
536 536
 
537
-    return $output;
537
+	return $output;
538 538
 }
539 539
 
540 540
 add_shortcode('gd_popular_post_category', 'geodir_sc_popular_post_category');
@@ -563,28 +563,28 @@  discard block
 block discarded – undo
563 563
  */
564 564
 function geodir_sc_popular_post_category($atts)
565 565
 {
566
-    ob_start();
567
-    global $geodir_post_category_str;
568
-    $defaults = array(
569
-        'category_limit' => 15,
570
-        'before_widget' => '',
571
-        'after_widget' => '',
572
-        'before_title' => '',
573
-        'after_title' => '',
574
-        'title' => '',
566
+	ob_start();
567
+	global $geodir_post_category_str;
568
+	$defaults = array(
569
+		'category_limit' => 15,
570
+		'before_widget' => '',
571
+		'after_widget' => '',
572
+		'before_title' => '',
573
+		'after_title' => '',
574
+		'title' => '',
575 575
 		'default_post_type' => '',
576
-    );
576
+	);
577 577
 
578
-    $params = shortcode_atts($defaults, $atts, 'popular_post_category');
579
-    $params['category_limit'] = absint($params['category_limit']);
578
+	$params = shortcode_atts($defaults, $atts, 'popular_post_category');
579
+	$params['category_limit'] = absint($params['category_limit']);
580 580
 	$params['default_post_type'] = gdsc_is_post_type_valid($params['default_post_type']) ? $params['default_post_type'] : '';
581
-    geodir_popular_post_category_output($params, $params);
581
+	geodir_popular_post_category_output($params, $params);
582 582
 
583
-    $output = ob_get_contents();
583
+	$output = ob_get_contents();
584 584
 
585
-    ob_end_clean();
585
+	ob_end_clean();
586 586
 
587
-    return $output;
587
+	return $output;
588 588
 }
589 589
 
590 590
 add_shortcode('gd_popular_post_view', 'geodir_sc_popular_post_view');
@@ -624,97 +624,97 @@  discard block
 block discarded – undo
624 624
  */
625 625
 function geodir_sc_popular_post_view($atts)
626 626
 {
627
-    ob_start();
628
-    $defaults = array(
629
-        'post_type' => 'gd_place',
630
-        'category' => '0',
631
-        'post_number' => '5',
632
-        'layout' => 'gridview_onehalf',
633
-        'add_location_filter' => '0',
634
-        'list_sort' => 'latest',
635
-        'use_viewing_post_type' => '1',
636
-        'character_count' => '20',
637
-        'listing_width' => '',
638
-        'show_featured_only' => '0',
639
-        'show_special_only' => '0',
640
-        'with_pics_only' => '0',
641
-        'with_videos_only' => '0',
642
-        'before_widget' => '',
643
-        'after_widget' => '',
644
-        'before_title' => '<h3 class="widget-title">',
645
-        'after_title' => '</h3>',
646
-        'title' => '',
647
-        'category_title' => '',
648
-    );
649
-
650
-    $params = shortcode_atts($defaults, $atts);
651
-
652
-    /**
653
-     * Validate our incoming params
654
-     */
627
+	ob_start();
628
+	$defaults = array(
629
+		'post_type' => 'gd_place',
630
+		'category' => '0',
631
+		'post_number' => '5',
632
+		'layout' => 'gridview_onehalf',
633
+		'add_location_filter' => '0',
634
+		'list_sort' => 'latest',
635
+		'use_viewing_post_type' => '1',
636
+		'character_count' => '20',
637
+		'listing_width' => '',
638
+		'show_featured_only' => '0',
639
+		'show_special_only' => '0',
640
+		'with_pics_only' => '0',
641
+		'with_videos_only' => '0',
642
+		'before_widget' => '',
643
+		'after_widget' => '',
644
+		'before_title' => '<h3 class="widget-title">',
645
+		'after_title' => '</h3>',
646
+		'title' => '',
647
+		'category_title' => '',
648
+	);
655 649
 
656
-    // Validate the selected post type, default to gd_place on fail
657
-    if (!(gdsc_is_post_type_valid($params['post_type']))) {
658
-        $params['post_type'] = 'gd_place';
659
-    }
660
-
661
-    // Validate the selected category/ies - Grab the current list based on post_type
662
-    $category_taxonomy = geodir_get_taxonomies($params['post_type']);
663
-    $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids'));
664
-
665
-    // Make sure we have an array
666
-    if (!(is_array($params['category']))) {
667
-        $params['category'] = explode(',', $params['category']);
668
-    }
669
-
670
-    // Array_intersect returns only the items in $params['category'] that are also in our category list
671
-    // Otherwise it becomes empty and later on that will mean "All"
672
-    $params['category'] = array_intersect($params['category'], $categories);
673
-
674
-    // Post_number needs to be a positive integer
675
-    $params['post_number'] = absint($params['post_number']);
676
-    if (0 == $params['post_number']) {
677
-        $params['post_number'] = 1;
678
-    }
679
-
680
-    // Validate our layout choice
681
-    // Outside of the norm, I added some more simple terms to match the existing
682
-    // So now I just run the switch to set it properly.
683
-    $params['layout'] = gdsc_validate_layout_choice($params['layout']);
684
-
685
-    // Validate our sorting choice
686
-    $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']);
687
-
688
-    // Validate character_count
689
-    $params['character_count'] = absint($params['character_count']);
690
-    if (20 > $params['character_count']) {
691
-        $params['character_count'] = 20;
692
-    }
693
-
694
-    // Validate Listing width, used in the template widget-listing-listview.php
695
-    // The context is in width=$listing_width% - So we need a positive number between 0 & 100
696
-    $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']);
697
-
698
-    // Validate the checkboxes used on the widget
699
-    $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']);
700
-    $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']);
701
-    $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']);
702
-    $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']);
703
-    $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']);
704
-    $params['use_viewing_post_type'] = gdsc_to_bool_val($params['use_viewing_post_type']);
705
-
706
-    /**
707
-     * End of validation
708
-     */
650
+	$params = shortcode_atts($defaults, $atts);
709 651
 
710
-    geodir_popular_postview_output($params, $params);
652
+	/**
653
+	 * Validate our incoming params
654
+	 */
711 655
 
656
+	// Validate the selected post type, default to gd_place on fail
657
+	if (!(gdsc_is_post_type_valid($params['post_type']))) {
658
+		$params['post_type'] = 'gd_place';
659
+	}
712 660
 
713
-    $output = ob_get_contents();
661
+	// Validate the selected category/ies - Grab the current list based on post_type
662
+	$category_taxonomy = geodir_get_taxonomies($params['post_type']);
663
+	$categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids'));
714 664
 
715
-    ob_end_clean();
665
+	// Make sure we have an array
666
+	if (!(is_array($params['category']))) {
667
+		$params['category'] = explode(',', $params['category']);
668
+	}
669
+
670
+	// Array_intersect returns only the items in $params['category'] that are also in our category list
671
+	// Otherwise it becomes empty and later on that will mean "All"
672
+	$params['category'] = array_intersect($params['category'], $categories);
673
+
674
+	// Post_number needs to be a positive integer
675
+	$params['post_number'] = absint($params['post_number']);
676
+	if (0 == $params['post_number']) {
677
+		$params['post_number'] = 1;
678
+	}
679
+
680
+	// Validate our layout choice
681
+	// Outside of the norm, I added some more simple terms to match the existing
682
+	// So now I just run the switch to set it properly.
683
+	$params['layout'] = gdsc_validate_layout_choice($params['layout']);
684
+
685
+	// Validate our sorting choice
686
+	$params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']);
687
+
688
+	// Validate character_count
689
+	$params['character_count'] = absint($params['character_count']);
690
+	if (20 > $params['character_count']) {
691
+		$params['character_count'] = 20;
692
+	}
693
+
694
+	// Validate Listing width, used in the template widget-listing-listview.php
695
+	// The context is in width=$listing_width% - So we need a positive number between 0 & 100
696
+	$params['listing_width'] = gdsc_validate_listing_width($params['listing_width']);
697
+
698
+	// Validate the checkboxes used on the widget
699
+	$params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']);
700
+	$params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']);
701
+	$params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']);
702
+	$params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']);
703
+	$params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']);
704
+	$params['use_viewing_post_type'] = gdsc_to_bool_val($params['use_viewing_post_type']);
716 705
 
717
-    return $output;
706
+	/**
707
+	 * End of validation
708
+	 */
709
+
710
+	geodir_popular_postview_output($params, $params);
711
+
712
+
713
+	$output = ob_get_contents();
714
+
715
+	ob_end_clean();
716
+
717
+	return $output;
718 718
 }
719 719
 
720 720
 add_shortcode('gd_recent_reviews', 'geodir_sc_recent_reviews');
@@ -736,37 +736,37 @@  discard block
 block discarded – undo
736 736
  * @return string Recent reviews HTML.
737 737
  */
738 738
 function geodir_sc_recent_reviews($atts) {
739
-    ob_start();
740
-    $defaults = array(
739
+	ob_start();
740
+	$defaults = array(
741 741
 		'title' => '',
742 742
 		'count' => 5,
743
-    );
743
+	);
744 744
 
745
-    $params = shortcode_atts($defaults, $atts);
745
+	$params = shortcode_atts($defaults, $atts);
746 746
 
747
-    $count = absint($params['count']);
748
-    if (0 == $count) {
749
-        $count = 1;
750
-    }
747
+	$count = absint($params['count']);
748
+	if (0 == $count) {
749
+		$count = 1;
750
+	}
751 751
 	
752 752
 	$title = !empty($params['title']) ? __($params['title'], 'geodirectory') : '';
753 753
 
754
-    $comments_li = geodir_get_recent_reviews(30, $count, 100, false);
754
+	$comments_li = geodir_get_recent_reviews(30, $count, 100, false);
755 755
 
756
-    if ($comments_li) {
757
-        if ($title != '') { ?>
756
+	if ($comments_li) {
757
+		if ($title != '') { ?>
758 758
 		<h3 class="geodir-sc-recent-reviews-title widget-title"><?php echo $title; ?></h3>
759 759
 		<?php } ?>
760 760
         <div class="geodir_sc_recent_reviews_section">
761 761
             <ul class="geodir_sc_recent_reviews"><?php echo $comments_li; ?></ul>
762 762
         </div>
763 763
     <?php
764
-    }
765
-    $output = ob_get_contents();
764
+	}
765
+	$output = ob_get_contents();
766 766
 
767
-    ob_end_clean();
767
+	ob_end_clean();
768 768
 
769
-    return $output;
769
+	return $output;
770 770
 }
771 771
 
772 772
 add_shortcode('gd_related_listings', 'geodir_sc_related_listings');
@@ -796,64 +796,64 @@  discard block
 block discarded – undo
796 796
  */
797 797
 function geodir_sc_related_listings($atts)
798 798
 {
799
-    ob_start();
800
-    $defaults = array(
801
-        'post_number' => 5,
802
-        'relate_to' => 'category',
803
-        'layout' => 'gridview_onehalf',
804
-        'add_location_filter' => 0,
805
-        'listing_width' => '',
806
-        'list_sort' => 'latest',
807
-        'character_count' => 20,
808
-        'is_widget' => 1,
809
-        'before_title' => '<style type="text/css">.geodir_category_list_view li{margin:0px!important}</style>',
810
-    );
811
-    // The "before_title" code is an ugly & terrible hack. But it works for now. I should enqueue a new stylesheet.
812
-
813
-    $params = shortcode_atts($defaults, $atts);
814
-
815
-    /**
816
-     * Begin validating parameters
817
-     */
799
+	ob_start();
800
+	$defaults = array(
801
+		'post_number' => 5,
802
+		'relate_to' => 'category',
803
+		'layout' => 'gridview_onehalf',
804
+		'add_location_filter' => 0,
805
+		'listing_width' => '',
806
+		'list_sort' => 'latest',
807
+		'character_count' => 20,
808
+		'is_widget' => 1,
809
+		'before_title' => '<style type="text/css">.geodir_category_list_view li{margin:0px!important}</style>',
810
+	);
811
+	// The "before_title" code is an ugly & terrible hack. But it works for now. I should enqueue a new stylesheet.
818 812
 
819
-    // Validate that post_number is a number and is 1 or higher
820
-    $params['post_number'] = absint($params['post_number']);
821
-    if (0 === $params['post_number']) {
822
-        $params['post_number'] = 1;
823
-    }
813
+	$params = shortcode_atts($defaults, $atts);
824 814
 
825
-    // Validate relate_to - only category or tags
826
-    $params['relate_to'] = geodir_strtolower($params['relate_to']);
827
-    if ('category' != $params['relate_to'] && 'tags' != $params['relate_to']) {
828
-        $params['relate_to'] = 'category';
829
-    }
815
+	/**
816
+	 * Begin validating parameters
817
+	 */
830 818
 
831
-    // Validate layout selection
832
-    $params['layout'] = gdsc_validate_layout_choice($params['layout']);
819
+	// Validate that post_number is a number and is 1 or higher
820
+	$params['post_number'] = absint($params['post_number']);
821
+	if (0 === $params['post_number']) {
822
+		$params['post_number'] = 1;
823
+	}
833 824
 
834
-    // Validate sorting option
835
-    $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']);
825
+	// Validate relate_to - only category or tags
826
+	$params['relate_to'] = geodir_strtolower($params['relate_to']);
827
+	if ('category' != $params['relate_to'] && 'tags' != $params['relate_to']) {
828
+		$params['relate_to'] = 'category';
829
+	}
836 830
 
837
-    // Validate add_location_filter
838
-    $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']);
831
+	// Validate layout selection
832
+	$params['layout'] = gdsc_validate_layout_choice($params['layout']);
839 833
 
840
-    // Validate listing_width
841
-    $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']);
834
+	// Validate sorting option
835
+	$params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']);
842 836
 
843
-    // Validate character_count
844
-    $params['character_count'] = absint($params['character_count']);
845
-    if (20 > $params['character_count']) {
846
-        $params['character_count'] = 20;
847
-    }
837
+	// Validate add_location_filter
838
+	$params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']);
848 839
 
849
-    if ($related_display = geodir_related_posts_display($params)) {
850
-        echo $related_display;
851
-    }
852
-    $output = ob_get_contents();
840
+	// Validate listing_width
841
+	$params['listing_width'] = gdsc_validate_listing_width($params['listing_width']);
853 842
 
854
-    ob_end_clean();
843
+	// Validate character_count
844
+	$params['character_count'] = absint($params['character_count']);
845
+	if (20 > $params['character_count']) {
846
+		$params['character_count'] = 20;
847
+	}
848
+
849
+	if ($related_display = geodir_related_posts_display($params)) {
850
+		echo $related_display;
851
+	}
852
+	$output = ob_get_contents();
855 853
 
856
-    return $output;
854
+	ob_end_clean();
855
+
856
+	return $output;
857 857
 }
858 858
 
859 859
 /**
@@ -877,12 +877,12 @@  discard block
 block discarded – undo
877 877
  * @return string Advanced search widget HTML.
878 878
  */
879 879
 function geodir_sc_advanced_search($atts) {
880
-    $defaults = array(
880
+	$defaults = array(
881 881
 		'title' => '',
882 882
 		'before_widget' => '<section id="geodir_advanced_search-1" class="widget geodir-widget geodir_advanced_search_widget">',
883
-        'after_widget' => '</section>',
884
-        'before_title' => '<h3 class="widget-title">',
885
-        'after_title' => '</h3>',
883
+		'after_widget' => '</section>',
884
+		'before_title' => '<h3 class="widget-title">',
885
+		'after_title' => '</h3>',
886 886
 		'show_adv_search' => 'default'
887 887
 	);
888 888
 	
@@ -906,9 +906,9 @@  discard block
 block discarded – undo
906 906
 	the_widget('geodir_advance_search_widget', $params, $params );
907 907
 	
908 908
 	$output = ob_get_contents();
909
-    ob_end_clean();
909
+	ob_end_clean();
910 910
 
911
-    return $output;
911
+	return $output;
912 912
 }
913 913
 add_shortcode('gd_advanced_search', 'geodir_sc_advanced_search');
914 914
 
@@ -954,48 +954,48 @@  discard block
 block discarded – undo
954 954
 		'add_location_filter' => '1',
955 955
 		'tab_layout' => 'bestof-tabs-on-top',
956 956
 		'before_widget' => '<section id="bestof_widget-1" class="widget geodir-widget geodir_bestof_widget geodir_sc_bestof_widget">',
957
-        'after_widget' => '</section>',
958
-        'before_title' => '<h3 class="widget-title">',
959
-        'after_title' => '</h3>',
957
+		'after_widget' => '</section>',
958
+		'before_title' => '<h3 class="widget-title">',
959
+		'after_title' => '</h3>',
960 960
 	);
961 961
 	$params = shortcode_atts($defaults, $atts);
962 962
 
963
-    /**
964
-     * Validate our incoming params
965
-     */
963
+	/**
964
+	 * Validate our incoming params
965
+	 */
966 966
 
967
-    // Validate the selected post type, default to gd_place on fail
968
-    if (!(gdsc_is_post_type_valid($params['post_type']))) {
969
-        $params['post_type'] = 'gd_place';
970
-    }
967
+	// Validate the selected post type, default to gd_place on fail
968
+	if (!(gdsc_is_post_type_valid($params['post_type']))) {
969
+		$params['post_type'] = 'gd_place';
970
+	}
971 971
 	
972 972
 	// Post limit needs to be a positive integer
973
-    $params['post_limit'] = absint($params['post_limit']);
974
-    if (0 == $params['post_limit']) {
975
-        $params['post_limit'] = 5;
976
-    }
973
+	$params['post_limit'] = absint($params['post_limit']);
974
+	if (0 == $params['post_limit']) {
975
+		$params['post_limit'] = 5;
976
+	}
977 977
 	
978 978
 	// Category limit needs to be a positive integer
979
-    $params['categ_limit'] = absint($params['categ_limit']);
980
-    if (0 == $params['categ_limit']) {
981
-        $params['categ_limit'] = 3;
982
-    }
979
+	$params['categ_limit'] = absint($params['categ_limit']);
980
+	if (0 == $params['categ_limit']) {
981
+		$params['categ_limit'] = 3;
982
+	}
983 983
 	
984 984
 	// Tab layout validation
985
-    $params['tab_layout'] = $params['tab_layout'];
986
-    if (!in_array($params['tab_layout'], array('bestof-tabs-on-top', 'bestof-tabs-on-left', 'bestof-tabs-as-dropdown'))) {
987
-        $params['tab_layout'] = 'bestof-tabs-on-top';
988
-    }
985
+	$params['tab_layout'] = $params['tab_layout'];
986
+	if (!in_array($params['tab_layout'], array('bestof-tabs-on-top', 'bestof-tabs-on-left', 'bestof-tabs-as-dropdown'))) {
987
+		$params['tab_layout'] = 'bestof-tabs-on-top';
988
+	}
989 989
 	
990 990
 	// Validate character_count
991
-    $params['character_count'] = $params['character_count'];
991
+	$params['character_count'] = $params['character_count'];
992 992
 
993 993
 	ob_start();
994 994
 	the_widget('geodir_bestof_widget', $params, $params);
995
-    $output = ob_get_contents();
996
-    ob_end_clean();
995
+	$output = ob_get_contents();
996
+	ob_end_clean();
997 997
 
998
-    return $output;
998
+	return $output;
999 999
 }
1000 1000
 add_shortcode('gd_bestof_widget', 'geodir_sc_bestof_widget');
1001 1001
 
@@ -1058,54 +1058,54 @@  discard block
 block discarded – undo
1058 1058
 	$params = shortcode_atts($defaults, $atts);
1059 1059
 
1060 1060
 	$params['title'] 		= wp_strip_all_tags($params['title']);
1061
-    $params['post_type'] 	= gdsc_is_post_type_valid($params['post_type']) ? $params['post_type'] : 'gd_place';
1061
+	$params['post_type'] 	= gdsc_is_post_type_valid($params['post_type']) ? $params['post_type'] : 'gd_place';
1062 1062
 	
1063 1063
 	// Validate the selected category/ies - Grab the current list based on post_type
1064
-    $category_taxonomy 		= geodir_get_taxonomies($params['post_type']);
1065
-    $categories 			= get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids'));
1064
+	$category_taxonomy 		= geodir_get_taxonomies($params['post_type']);
1065
+	$categories 			= get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids'));
1066 1066
 
1067
-    // Make sure we have an array
1068
-    if (!(is_array($params['category']))) {
1069
-        $params['category'] = explode(',', $params['category']);
1070
-    }
1067
+	// Make sure we have an array
1068
+	if (!(is_array($params['category']))) {
1069
+		$params['category'] = explode(',', $params['category']);
1070
+	}
1071 1071
 
1072
-    // Array_intersect returns only the items in $params['category'] that are also in our category list
1073
-    // Otherwise it becomes empty and later on that will mean "All"
1074
-    $params['category'] 	= array_intersect($params['category'], $categories);
1072
+	// Array_intersect returns only the items in $params['category'] that are also in our category list
1073
+	// Otherwise it becomes empty and later on that will mean "All"
1074
+	$params['category'] 	= array_intersect($params['category'], $categories);
1075 1075
 	
1076 1076
 	// Post_number needs to be a positive integer
1077
-    $params['post_number'] 	= absint($params['post_number']);
1078
-    $params['post_number']	= $params['post_number'] > 0 ? $params['post_number'] : 10;
1077
+	$params['post_number'] 	= absint($params['post_number']);
1078
+	$params['post_number']	= $params['post_number'] > 0 ? $params['post_number'] : 10;
1079 1079
 	
1080 1080
 	// Validate character_count
1081
-    //todo: is this necessary?
1082
-    $params['character_count'] 	= $params['character_count'];
1081
+	//todo: is this necessary?
1082
+	$params['character_count'] 	= $params['character_count'];
1083 1083
 	
1084 1084
 	// Validate our layout choice
1085
-    // Outside of the norm, I added some more simple terms to match the existing
1086
-    // So now I just run the switch to set it properly.
1087
-    $params['layout'] 			= gdsc_validate_layout_choice($params['layout']);
1085
+	// Outside of the norm, I added some more simple terms to match the existing
1086
+	// So now I just run the switch to set it properly.
1087
+	$params['layout'] 			= gdsc_validate_layout_choice($params['layout']);
1088 1088
 
1089
-    // Validate our sorting choice
1090
-    $params['list_sort'] 		= gdsc_validate_sort_choice($params['list_sort']);
1089
+	// Validate our sorting choice
1090
+	$params['list_sort'] 		= gdsc_validate_sort_choice($params['list_sort']);
1091 1091
 	
1092 1092
 	// Validate Listing width, used in the template widget-listing-listview.php
1093
-    // The context is in width=$listing_width% - So we need a positive number between 0 & 100
1094
-    $params['listing_width'] 	= gdsc_validate_listing_width($params['listing_width']);
1095
-
1096
-    // Validate the checkboxes used on the widget
1097
-    $params['add_location_filter'] 	= gdsc_to_bool_val($params['add_location_filter']);
1098
-    $params['show_featured_only'] 	= gdsc_to_bool_val($params['show_featured_only']);
1099
-    $params['show_special_only'] 	= gdsc_to_bool_val($params['show_special_only']);
1100
-    $params['with_pics_only'] 		= gdsc_to_bool_val($params['with_pics_only']);
1101
-    $params['with_videos_only'] 	= gdsc_to_bool_val($params['with_videos_only']);
1093
+	// The context is in width=$listing_width% - So we need a positive number between 0 & 100
1094
+	$params['listing_width'] 	= gdsc_validate_listing_width($params['listing_width']);
1095
+
1096
+	// Validate the checkboxes used on the widget
1097
+	$params['add_location_filter'] 	= gdsc_to_bool_val($params['add_location_filter']);
1098
+	$params['show_featured_only'] 	= gdsc_to_bool_val($params['show_featured_only']);
1099
+	$params['show_special_only'] 	= gdsc_to_bool_val($params['show_special_only']);
1100
+	$params['with_pics_only'] 		= gdsc_to_bool_val($params['with_pics_only']);
1101
+	$params['with_videos_only'] 	= gdsc_to_bool_val($params['with_videos_only']);
1102 1102
 	$params['with_pagination'] 		= gdsc_to_bool_val($params['with_pagination']);
1103 1103
 	$params['top_pagination'] 		= gdsc_to_bool_val($params['top_pagination']);
1104 1104
 	$params['bottom_pagination'] 	= gdsc_to_bool_val($params['bottom_pagination']);
1105 1105
 	
1106
-    /**
1107
-     * End of validation
1108
-     */
1106
+	/**
1107
+	 * End of validation
1108
+	 */
1109 1109
 	if (isset($atts['geodir_ajax'])) {
1110 1110
 		$params['geodir_ajax'] = $atts['geodir_ajax'];
1111 1111
 		unset($atts['geodir_ajax']);
@@ -1118,7 +1118,7 @@  discard block
 block discarded – undo
1118 1118
 
1119 1119
 	$output = geodir_sc_gd_listings_output($params);
1120 1120
 
1121
-    return $output;
1121
+	return $output;
1122 1122
 }
1123 1123
 add_shortcode('gd_listings', 'geodir_sc_gd_listings');
1124 1124
 
@@ -1166,23 +1166,23 @@  discard block
 block discarded – undo
1166 1166
 		'max_count' => 'all',
1167 1167
 		'max_level' => '1',
1168 1168
 		'before_widget' => '<section id="geodir_cpt_categories_widget-1" class="widget geodir-widget geodir_cpt_categories_widget geodir_sc_cpt_categories_widget">',
1169
-        'after_widget' => '</section>',
1170
-        'before_title' => '<h3 class="widget-title">',
1171
-        'after_title' => '</h3>',
1169
+		'after_widget' => '</section>',
1170
+		'before_title' => '<h3 class="widget-title">',
1171
+		'after_title' => '</h3>',
1172 1172
 	);
1173 1173
 	$params = shortcode_atts($defaults, $atts);
1174 1174
 
1175
-    /**
1176
-     * Validate our incoming params
1177
-     */
1175
+	/**
1176
+	 * Validate our incoming params
1177
+	 */
1178 1178
 	// Make sure we have an array
1179
-    $params['post_type'] = !is_array($params['post_type']) && trim($params['post_type']) != '' ? explode(',', trim($params['post_type'])) : array();
1179
+	$params['post_type'] = !is_array($params['post_type']) && trim($params['post_type']) != '' ? explode(',', trim($params['post_type'])) : array();
1180 1180
 	 
1181 1181
 	// Validate the checkboxes used on the widget
1182
-    $params['hide_empty'] 	= gdsc_to_bool_val($params['hide_empty']);
1183
-    $params['show_count'] 	= gdsc_to_bool_val($params['show_count']);
1184
-    $params['hide_icon'] 	= gdsc_to_bool_val($params['hide_icon']);
1185
-    $params['cpt_left'] 	= gdsc_to_bool_val($params['cpt_left']);
1182
+	$params['hide_empty'] 	= gdsc_to_bool_val($params['hide_empty']);
1183
+	$params['show_count'] 	= gdsc_to_bool_val($params['show_count']);
1184
+	$params['hide_icon'] 	= gdsc_to_bool_val($params['hide_icon']);
1185
+	$params['cpt_left'] 	= gdsc_to_bool_val($params['cpt_left']);
1186 1186
 	
1187 1187
 	if ($params['max_count'] != 'all') {
1188 1188
 		$params['max_count'] = absint($params['max_count']);
@@ -1196,10 +1196,10 @@  discard block
 block discarded – undo
1196 1196
 
1197 1197
 	ob_start();
1198 1198
 	the_widget('geodir_cpt_categories_widget', $params, $params);
1199
-    $output = ob_get_contents();
1200
-    ob_end_clean();
1199
+	$output = ob_get_contents();
1200
+	ob_end_clean();
1201 1201
 
1202
-    return $output;
1202
+	return $output;
1203 1203
 }
1204 1204
 add_shortcode('gd_cpt_categories', 'geodir_sc_cpt_categories_widget');
1205 1205
 ?>
1206 1206
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory_widgets.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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>
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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>
@@ -819,14 +819,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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>
Please login to merge, or discard this patch.
Indentation   +880 added lines, -880 removed lines patch added patch discarded remove patch
@@ -15,296 +15,296 @@  discard block
 block discarded – undo
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
 block discarded – undo
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']) ? '&nbsp;' : 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']) ? '&nbsp;' : 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
 block discarded – undo
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()); ?>&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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']) ? '&nbsp;' : 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']) ? '&nbsp;' : 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
 block discarded – undo
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']) ? '&nbsp;' : 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']) ? '&nbsp;' : 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']) ? '&nbsp;' : 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']) ? '&nbsp;' : 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
 block discarded – undo
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
 block discarded – undo
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']) ? '&nbsp;' : 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']) ? '&nbsp;' : 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,161 +944,161 @@  discard block
 block discarded – undo
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'));
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
-                // prints the widget
988
-                extract($args, EXTR_SKIP);
989
-
990
-                echo $before_widget;
991
-
992
-                /** This filter is documented in geodirectory_widgets.php */
993
-                $title = empty($instance['title']) ? __('Search', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
994
-
995
-                geodir_get_template_part('listing', 'filter-form');
996
-
997
-                echo $after_widget;
998
-            }
999
-
1000
-            /**
1001
-             * Sanitize advanced search widget form values as they are saved.
1002
-             *
1003
-             * @since 1.0.0
1004
-             * @since 1.5.1 Declare function public.
1005
-             *
1006
-             * @param array $new_instance Values just sent to be saved.
1007
-             * @param array $old_instance Previously saved values from database.
1008
-             *
1009
-             * @return array Updated safe values to be saved.
1010
-             */
1011
-            public function update($new_instance, $old_instance)
1012
-            {
1013
-                //save the widget
1014
-                //Nothing to save
1015
-                return isset($instance) ? $instance : '';
1016
-            }
1017
-
1018
-            /**
1019
-             * Back-end advanced search widget settings form.
1020
-             *
1021
-             * @since 1.0.0
1022
-             * @since 1.5.1 Declare function public.
1023
-             *
1024
-             * @param array $instance Previously saved values from database.
1025
-             * @return string|void
1026
-             */
1027
-            public function form($instance)
1028
-            {
1029
-                //widgetform in backend
1030
-                echo __("This is a search widget to show advance search for gedodirectory listings.", 'geodirectory');
1031
-            }
1032
-        }
1033
-
1034
-        register_widget('geodir_advance_search_widget');
1035
-
1036
-
1037
-        /**
1038
-         * Contains all functions for popular widget.
1039
-         *
1040
-         * @since 1.0.0
1041
-         * @package GeoDirectory
1042
-         */
1043
-        include_once('geodirectory-widgets/geodirectory_popular_widget.php');
1044
-        /**
1045
-         * Contains all functions for listing slider widget.
1046
-         *
1047
-         * @since 1.0.0
1048
-         * @package GeoDirectory
1049
-         */
1050
-        include_once('geodirectory-widgets/geodirectory_listing_slider_widget.php');
1051
-        /**
1052
-         * Contains all functions for home map widget.
1053
-         *
1054
-         * @since 1.0.0
1055
-         * @package GeoDirectory
1056
-         */
1057
-        include_once('geodirectory-widgets/home_map_widget.php');
1058
-        /**
1059
-         * Contains all functions for listing map widget.
1060
-         *
1061
-         * @since 1.0.0
1062
-         * @package GeoDirectory
1063
-         */
1064
-        include_once('geodirectory-widgets/listing_map_widget.php');
1065
-        /**
1066
-         * Contains all functions for reviews widget.
1067
-         *
1068
-         * @since 1.0.0
1069
-         * @package GeoDirectory
1070
-         */
1071
-        include_once('geodirectory-widgets/geodirectory_reviews_widget.php');
1072
-        /**
1073
-         * Contains all functions for related listing widget.
1074
-         *
1075
-         * @since 1.0.0
1076
-         * @package GeoDirectory
1077
-         */
1078
-        include_once('geodirectory-widgets/geodirectory_related_listing_widget.php');
1079
-        /**
1080
-         * Contains all functions for bestof widget.
1081
-         *
1082
-         * @since 1.0.0
1083
-         * @package GeoDirectory
1084
-         */
1085
-        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'));
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
+				// prints the widget
988
+				extract($args, EXTR_SKIP);
989
+
990
+				echo $before_widget;
991
+
992
+				/** This filter is documented in geodirectory_widgets.php */
993
+				$title = empty($instance['title']) ? __('Search', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
994
+
995
+				geodir_get_template_part('listing', 'filter-form');
996
+
997
+				echo $after_widget;
998
+			}
999
+
1000
+			/**
1001
+			 * Sanitize advanced search widget form values as they are saved.
1002
+			 *
1003
+			 * @since 1.0.0
1004
+			 * @since 1.5.1 Declare function public.
1005
+			 *
1006
+			 * @param array $new_instance Values just sent to be saved.
1007
+			 * @param array $old_instance Previously saved values from database.
1008
+			 *
1009
+			 * @return array Updated safe values to be saved.
1010
+			 */
1011
+			public function update($new_instance, $old_instance)
1012
+			{
1013
+				//save the widget
1014
+				//Nothing to save
1015
+				return isset($instance) ? $instance : '';
1016
+			}
1017
+
1018
+			/**
1019
+			 * Back-end advanced search widget settings form.
1020
+			 *
1021
+			 * @since 1.0.0
1022
+			 * @since 1.5.1 Declare function public.
1023
+			 *
1024
+			 * @param array $instance Previously saved values from database.
1025
+			 * @return string|void
1026
+			 */
1027
+			public function form($instance)
1028
+			{
1029
+				//widgetform in backend
1030
+				echo __("This is a search widget to show advance search for gedodirectory listings.", 'geodirectory');
1031
+			}
1032
+		}
1033
+
1034
+		register_widget('geodir_advance_search_widget');
1035
+
1036
+
1037
+		/**
1038
+		 * Contains all functions for popular widget.
1039
+		 *
1040
+		 * @since 1.0.0
1041
+		 * @package GeoDirectory
1042
+		 */
1043
+		include_once('geodirectory-widgets/geodirectory_popular_widget.php');
1044
+		/**
1045
+		 * Contains all functions for listing slider widget.
1046
+		 *
1047
+		 * @since 1.0.0
1048
+		 * @package GeoDirectory
1049
+		 */
1050
+		include_once('geodirectory-widgets/geodirectory_listing_slider_widget.php');
1051
+		/**
1052
+		 * Contains all functions for home map widget.
1053
+		 *
1054
+		 * @since 1.0.0
1055
+		 * @package GeoDirectory
1056
+		 */
1057
+		include_once('geodirectory-widgets/home_map_widget.php');
1058
+		/**
1059
+		 * Contains all functions for listing map widget.
1060
+		 *
1061
+		 * @since 1.0.0
1062
+		 * @package GeoDirectory
1063
+		 */
1064
+		include_once('geodirectory-widgets/listing_map_widget.php');
1065
+		/**
1066
+		 * Contains all functions for reviews widget.
1067
+		 *
1068
+		 * @since 1.0.0
1069
+		 * @package GeoDirectory
1070
+		 */
1071
+		include_once('geodirectory-widgets/geodirectory_reviews_widget.php');
1072
+		/**
1073
+		 * Contains all functions for related listing widget.
1074
+		 *
1075
+		 * @since 1.0.0
1076
+		 * @package GeoDirectory
1077
+		 */
1078
+		include_once('geodirectory-widgets/geodirectory_related_listing_widget.php');
1079
+		/**
1080
+		 * Contains all functions for bestof widget.
1081
+		 *
1082
+		 * @since 1.0.0
1083
+		 * @package GeoDirectory
1084
+		 */
1085
+		include_once('geodirectory-widgets/geodirectory_bestof_widget.php');
1086
+		/**
1087
+		 * Contains all functions for cpt categories widget.
1088
+		 *
1089
+		 * @since 1.5.4
1090
+		 * @package GeoDirectory
1091
+		 */
1092
+		include_once('geodirectory-widgets/geodirectory_cpt_categories_widget.php');
1086 1093
 		/**
1087
-         * Contains all functions for cpt categories widget.
1088
-         *
1089
-         * @since 1.5.4
1090
-         * @package GeoDirectory
1091
-         */
1092
-        include_once('geodirectory-widgets/geodirectory_cpt_categories_widget.php');
1093
-        /**
1094
-         * Contains all functions for features widget.
1095
-         *
1096
-         * @since 1.5.6
1097
-         * @package GeoDirectory
1098
-         * @todo make the image field recurring
1099
-         */
1100
-        include_once('geodirectory-widgets/geodirectory_features_widget.php');
1101
-    }
1094
+		 * Contains all functions for features widget.
1095
+		 *
1096
+		 * @since 1.5.6
1097
+		 * @package GeoDirectory
1098
+		 * @todo make the image field recurring
1099
+		 */
1100
+		include_once('geodirectory-widgets/geodirectory_features_widget.php');
1101
+	}
1102 1102
 
1103 1103
 }
1104 1104
 
Please login to merge, or discard this patch.
geodirectory-functions/compatibility/Enfold.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@
 block discarded – undo
113 113
  * @since 1.0.0
114 114
  * @package GeoDirectory
115 115
  * @param array $classes Class array.
116
- * @return array Modified class array.
116
+ * @return string[] Modified class array.
117 117
  */
118 118
 function geodir_x_body_class($classes)
119 119
 {
Please login to merge, or discard this patch.
Indentation   +147 added lines, -147 removed lines patch added patch discarded remove patch
@@ -1,100 +1,100 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Enfold theme compatibility functions.
4
- *
5
- * This file lets the GeoDirectory Plugin use the Enfold theme HTML wrappers to fit and work perfectly.
6
- *
7
- * @since 1.0.0
8
- * @package GeoDirectory
9
- */
3
+	 * Enfold theme compatibility functions.
4
+	 *
5
+	 * This file lets the GeoDirectory Plugin use the Enfold theme HTML wrappers to fit and work perfectly.
6
+	 *
7
+	 * @since 1.0.0
8
+	 * @package GeoDirectory
9
+	 */
10 10
 add_action('after_setup_theme', 'enfold_action_calls', 11);
11 11
 /**
12
- * Action calls for enfold theme compatibility.
13
- *
14
- * @since 1.0.0
15
- * @package GeoDirectory
16
- */
12
+	 * Action calls for enfold theme compatibility.
13
+	 *
14
+	 * @since 1.0.0
15
+	 * @package GeoDirectory
16
+	 */
17 17
 function enfold_action_calls()
18 18
 {
19 19
 
20
-    /* ACTIONS
20
+	/* ACTIONS
21 21
     ****************************************************************************************/
22 22
 
23
-    // Add body class for styling purposes
24
-    add_filter('body_class', 'wpgeo_enfold_body_class');
23
+	// Add body class for styling purposes
24
+	add_filter('body_class', 'wpgeo_enfold_body_class');
25 25
 
26
-    // Pages using the page-builder shouldn't redirect on successful payment
27
-    if (isset($_REQUEST['pay_action'])) {
28
-        add_action('init', 'geodir_allow_payment_urls_enfold', 15);
29
-    }
26
+	// Pages using the page-builder shouldn't redirect on successful payment
27
+	if (isset($_REQUEST['pay_action'])) {
28
+		add_action('init', 'geodir_allow_payment_urls_enfold', 15);
29
+	}
30 30
 
31
-    // LOCATION MANAGER MENU ACTIONS - set the location menu item before the Enfold search
32
-    if (function_exists('geodir_location_menu_items')) {
33
-        remove_filter('wp_nav_menu_items', 'geodir_location_menu_items', 110);
34
-        add_filter('wp_nav_menu_items', 'geodir_location_menu_items', 8, 2);
35
-    }
36
-    // GEODIR MENU ACTIONS - set the GeoDir menu items before the Enfold search
37
-    remove_filter('wp_nav_menu_items', 'geodir_menu_items', 100);
38
-    add_filter('wp_nav_menu_items', 'geodir_menu_items', 7, 2);
31
+	// LOCATION MANAGER MENU ACTIONS - set the location menu item before the Enfold search
32
+	if (function_exists('geodir_location_menu_items')) {
33
+		remove_filter('wp_nav_menu_items', 'geodir_location_menu_items', 110);
34
+		add_filter('wp_nav_menu_items', 'geodir_location_menu_items', 8, 2);
35
+	}
36
+	// GEODIR MENU ACTIONS - set the GeoDir menu items before the Enfold search
37
+	remove_filter('wp_nav_menu_items', 'geodir_menu_items', 100);
38
+	add_filter('wp_nav_menu_items', 'geodir_menu_items', 7, 2);
39 39
 
40
-    // HOME TOP SIDEBAR
41
-    remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10);
42
-    remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10);
43
-    //add_action( 'ava_after_main_container', 'enfold_home_sidebar' );
40
+	// HOME TOP SIDEBAR
41
+	remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10);
42
+	remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10);
43
+	//add_action( 'ava_after_main_container', 'enfold_home_sidebar' );
44 44
 
45 45
 
46
-    // WRAPPER OPEN ACTIONS
47
-    remove_action('geodir_wrapper_open', 'geodir_action_wrapper_open', 10);
48
-    add_action('geodir_wrapper_open', 'enfold_action_wrapper_open', 9);
49
-    add_action('geodir_wrapper_open', 'enfold_detail_title', 8, 2); // ADD GEODIR TITLE
46
+	// WRAPPER OPEN ACTIONS
47
+	remove_action('geodir_wrapper_open', 'geodir_action_wrapper_open', 10);
48
+	add_action('geodir_wrapper_open', 'enfold_action_wrapper_open', 9);
49
+	add_action('geodir_wrapper_open', 'enfold_detail_title', 8, 2); // ADD GEODIR TITLE
50 50
 
51 51
 
52
-    // WRAPPER CONTENT OPEN ACTIONS
53
-    remove_action('geodir_wrapper_content_open', 'geodir_action_wrapper_content_open', 10);
54
-    add_action('geodir_wrapper_content_open', 'enfold_action_wrapper_content_open', 9, 3);
52
+	// WRAPPER CONTENT OPEN ACTIONS
53
+	remove_action('geodir_wrapper_content_open', 'geodir_action_wrapper_content_open', 10);
54
+	add_action('geodir_wrapper_content_open', 'enfold_action_wrapper_content_open', 9, 3);
55 55
 
56 56
 
57
-    // SIDEBAR RIGHT OPEN ACTIONS
58
-    remove_action('geodir_sidebar_right_open', 'geodir_action_sidebar_right_open', 10);
59
-    add_action('geodir_sidebar_right_open', 'enfold_action_sidebar_right_open', 10, 4);
57
+	// SIDEBAR RIGHT OPEN ACTIONS
58
+	remove_action('geodir_sidebar_right_open', 'geodir_action_sidebar_right_open', 10);
59
+	add_action('geodir_sidebar_right_open', 'enfold_action_sidebar_right_open', 10, 4);
60 60
 
61
-    // SIDEBAR LEFT OPEN ACTIONS
62
-    remove_action('geodir_sidebar_left_open', 'geodir_action_sidebar_left_open', 10);
63
-    add_action('geodir_sidebar_left_open', 'enfold_action_sidebar_left_open', 10, 4);
61
+	// SIDEBAR LEFT OPEN ACTIONS
62
+	remove_action('geodir_sidebar_left_open', 'geodir_action_sidebar_left_open', 10);
63
+	add_action('geodir_sidebar_left_open', 'enfold_action_sidebar_left_open', 10, 4);
64 64
 
65 65
 
66
-    // HOME PAGE BREADCRUMBS
67
-    remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20);
68
-    remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20);
66
+	// HOME PAGE BREADCRUMBS
67
+	remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20);
68
+	remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20);
69 69
 
70
-    // LISTINGS PAGE BREADCRUMBS & TITLES
71
-    remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20);
72
-    remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10);
70
+	// LISTINGS PAGE BREADCRUMBS & TITLES
71
+	remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20);
72
+	remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10);
73 73
 
74
-    // DETAILS PAGE BREADCRUMBS & TITLES
75
-    remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20);
76
-    remove_action('geodir_details_main_content', 'geodir_action_page_title', 20);
74
+	// DETAILS PAGE BREADCRUMBS & TITLES
75
+	remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20);
76
+	remove_action('geodir_details_main_content', 'geodir_action_page_title', 20);
77 77
 
78
-    // SEARCH PAGE BREADCRUMBS & TITLES
79
-    remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20);
80
-    remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10);
78
+	// SEARCH PAGE BREADCRUMBS & TITLES
79
+	remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20);
80
+	remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10);
81 81
 
82
-    // AUTHOR PAGE BREADCRUMBS & TITLES
83
-    remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20);
84
-    remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10);
82
+	// AUTHOR PAGE BREADCRUMBS & TITLES
83
+	remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20);
84
+	remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10);
85 85
 
86
-    // DISABLE ENFOLD MAPS CALL
87
-    add_filter('avf_load_google_map_api', 'gd_enfold_remove_maps_api', 10, 1);
86
+	// DISABLE ENFOLD MAPS CALL
87
+	add_filter('avf_load_google_map_api', 'gd_enfold_remove_maps_api', 10, 1);
88 88
 
89
-    // make top section wide
90
-    remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10);
91
-    remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10);
92
-    remove_action('geodir_author_before_main_content', 'geodir_action_geodir_sidebar_author_top', 10);
93
-    remove_action('geodir_search_before_main_content', 'geodir_action_geodir_sidebar_search_top', 10);
94
-    remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_sidebar_detail_top', 10);
95
-    remove_action('geodir_listings_before_main_content', 'geodir_action_geodir_sidebar_listings_top', 10);
89
+	// make top section wide
90
+	remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10);
91
+	remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10);
92
+	remove_action('geodir_author_before_main_content', 'geodir_action_geodir_sidebar_author_top', 10);
93
+	remove_action('geodir_search_before_main_content', 'geodir_action_geodir_sidebar_search_top', 10);
94
+	remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_sidebar_detail_top', 10);
95
+	remove_action('geodir_listings_before_main_content', 'geodir_action_geodir_sidebar_listings_top', 10);
96 96
 
97
-    add_action('geodir_wrapper_open', 'gd_enfold_compat_add_top_section_back', 5);
97
+	add_action('geodir_wrapper_open', 'gd_enfold_compat_add_top_section_back', 5);
98 98
 
99 99
 } // Close enfold_action_calls
100 100
 
@@ -108,17 +108,17 @@  discard block
 block discarded – undo
108 108
 function gd_enfold_compat_add_top_section_back()
109 109
 {
110 110
 
111
-    if (is_page_geodir_home() || geodir_is_page('location')) {
112
-        add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_home_top', 8);
113
-    } elseif (geodir_is_page('listing')) {
114
-        add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_listings_top', 8);
115
-    } elseif (geodir_is_page('detail')) {
116
-        add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_detail_top', 8);
117
-    } elseif (geodir_is_page('search')) {
118
-        add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_search_top', 8);
119
-    } elseif (geodir_is_page('author')) {
120
-        add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_author_top', 8);
121
-    }
111
+	if (is_page_geodir_home() || geodir_is_page('location')) {
112
+		add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_home_top', 8);
113
+	} elseif (geodir_is_page('listing')) {
114
+		add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_listings_top', 8);
115
+	} elseif (geodir_is_page('detail')) {
116
+		add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_detail_top', 8);
117
+	} elseif (geodir_is_page('search')) {
118
+		add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_search_top', 8);
119
+	} elseif (geodir_is_page('author')) {
120
+		add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_author_top', 8);
121
+	}
122 122
 
123 123
 
124 124
 }
@@ -137,8 +137,8 @@  discard block
 block discarded – undo
137 137
  */
138 138
 function wpgeo_enfold_body_class($classes)
139 139
 {
140
-    $classes[] = 'wpgeo-enfold';
141
-    return $classes;
140
+	$classes[] = 'wpgeo-enfold';
141
+	return $classes;
142 142
 }
143 143
 
144 144
 /**
@@ -149,8 +149,8 @@  discard block
 block discarded – undo
149 149
  */
150 150
 function geodir_allow_payment_urls_enfold()
151 151
 {
152
-    global $builder;
153
-    remove_action('template_redirect', array($builder, 'template_redirect'), 1000);
152
+	global $builder;
153
+	remove_action('template_redirect', array($builder, 'template_redirect'), 1000);
154 154
 }
155 155
 
156 156
 
@@ -162,8 +162,8 @@  discard block
 block discarded – undo
162 162
  */
163 163
 function enfold_action_wrapper_open()
164 164
 {
165
-    echo "<div class='container_wrap container_wrap_first main_color " . avia_layout_class('main', false) . "'>";
166
-    echo "<div class='container template-blog '>";
165
+	echo "<div class='container_wrap container_wrap_first main_color " . avia_layout_class('main', false) . "'>";
166
+	echo "<div class='container template-blog '>";
167 167
 }
168 168
 
169 169
 /**
@@ -177,38 +177,38 @@  discard block
 block discarded – undo
177 177
  */
178 178
 function enfold_detail_title($page, $class)
179 179
 {
180
-    //echo '###'.$page;
181
-    global $wp;
182
-    if (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_location_page_id() && !geodir_is_page('login')) {
183
-        add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2);
184
-        echo avia_title();
185
-    } elseif ($page == 'details-page') {
186
-        add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2);
187
-        echo avia_title();
188
-    } elseif ($page == 'listings-page' || $page == 'search-page') {
189
-        add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2);
190
-        ob_start(); // Start buffering;
191
-        geodir_action_listings_title();
192
-        $gd_title = ob_get_clean();
193
-        $title_p = explode('">', $gd_title);
194
-        $title = str_replace('</h1></header>', "", $title_p[2]);
195
-        //print_r($title_p);
196
-        echo avia_title(array('title' => $title));
197
-    } elseif ($page == 'author-page') {
198
-        add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2);
199
-        ob_start(); // Start buffering;
200
-        geodir_action_author_page_title();
201
-        $gd_title = ob_get_clean();
202
-        $gd_title = str_replace('<h1>', "", $gd_title);
203
-        $gd_title = str_replace('</h1>', "", $gd_title);
204
-        echo avia_title(array('title' => $gd_title));
205
-    } elseif ($page == 'add-listing-page') {
206
-        add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2);
207
-        echo avia_title();
208
-    } elseif ($page == 'add-listing-page') {
209
-        add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2);
210
-        echo avia_title();
211
-    }
180
+	//echo '###'.$page;
181
+	global $wp;
182
+	if (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_location_page_id() && !geodir_is_page('login')) {
183
+		add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2);
184
+		echo avia_title();
185
+	} elseif ($page == 'details-page') {
186
+		add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2);
187
+		echo avia_title();
188
+	} elseif ($page == 'listings-page' || $page == 'search-page') {
189
+		add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2);
190
+		ob_start(); // Start buffering;
191
+		geodir_action_listings_title();
192
+		$gd_title = ob_get_clean();
193
+		$title_p = explode('">', $gd_title);
194
+		$title = str_replace('</h1></header>', "", $title_p[2]);
195
+		//print_r($title_p);
196
+		echo avia_title(array('title' => $title));
197
+	} elseif ($page == 'author-page') {
198
+		add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2);
199
+		ob_start(); // Start buffering;
200
+		geodir_action_author_page_title();
201
+		$gd_title = ob_get_clean();
202
+		$gd_title = str_replace('<h1>', "", $gd_title);
203
+		$gd_title = str_replace('</h1>', "", $gd_title);
204
+		echo avia_title(array('title' => $gd_title));
205
+	} elseif ($page == 'add-listing-page') {
206
+		add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2);
207
+		echo avia_title();
208
+	} elseif ($page == 'add-listing-page') {
209
+		add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2);
210
+		echo avia_title();
211
+	}
212 212
 
213 213
 }
214 214
 
@@ -223,22 +223,22 @@  discard block
 block discarded – undo
223 223
  */
224 224
 function enfold_detail_breadcrum($trail, $args)
225 225
 {
226
-    ob_start(); // Start buffering;
227
-    geodir_breadcrumb();
228
-    $gd_crums = ob_get_clean();
229
-    if ($gd_crums) {
230
-        $gd_crums = str_replace('<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs"><li>', "", $gd_crums);
231
-        $gd_crums = str_replace('</li></ul></div>', "", $gd_crums);
232
-        $gd_crums = str_replace('&nbsp;>&nbsp;', " > ", $gd_crums);
233
-        $gd_crums = str_replace('</li><li>', "", $gd_crums);
234
-        $gd_crums = explode(" > ", $gd_crums);
235
-        $trail_end = array_pop($gd_crums);
236
-        $gd_crums['trail_end'] = $trail_end;
237
-        //print_r($gd_crums);
238
-        //print_r($trail);
239
-        $trail = $gd_crums;
240
-    }
241
-    return $trail;
226
+	ob_start(); // Start buffering;
227
+	geodir_breadcrumb();
228
+	$gd_crums = ob_get_clean();
229
+	if ($gd_crums) {
230
+		$gd_crums = str_replace('<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs"><li>', "", $gd_crums);
231
+		$gd_crums = str_replace('</li></ul></div>', "", $gd_crums);
232
+		$gd_crums = str_replace('&nbsp;>&nbsp;', " > ", $gd_crums);
233
+		$gd_crums = str_replace('</li><li>', "", $gd_crums);
234
+		$gd_crums = explode(" > ", $gd_crums);
235
+		$trail_end = array_pop($gd_crums);
236
+		$gd_crums['trail_end'] = $trail_end;
237
+		//print_r($gd_crums);
238
+		//print_r($trail);
239
+		$trail = $gd_crums;
240
+	}
241
+	return $trail;
242 242
 }
243 243
 
244 244
 
@@ -253,12 +253,12 @@  discard block
 block discarded – undo
253 253
  */
254 254
 function enfold_action_wrapper_content_open($type = '', $id = '', $class = '')
255 255
 {
256
-    if (geodir_is_page('login')) {
257
-        echo "<main class='template-page content twelve alpha units " . $class . "' " . avia_markup_helper(array('context' => 'content', 'post_type' => 'page', 'echo' => false)) . ">";
258
-    } else {
259
-        echo "<main class='template-page content " . avia_layout_class('content', false) . " units " . $class . "' " . avia_markup_helper(array('context' => 'content', 'post_type' => 'page', 'echo' => false)) . ">";
260
-    }
261
-    echo '<div class="entry-content-wrapper">';
256
+	if (geodir_is_page('login')) {
257
+		echo "<main class='template-page content twelve alpha units " . $class . "' " . avia_markup_helper(array('context' => 'content', 'post_type' => 'page', 'echo' => false)) . ">";
258
+	} else {
259
+		echo "<main class='template-page content " . avia_layout_class('content', false) . " units " . $class . "' " . avia_markup_helper(array('context' => 'content', 'post_type' => 'page', 'echo' => false)) . ">";
260
+	}
261
+	echo '<div class="entry-content-wrapper">';
262 262
 }
263 263
 
264 264
 
@@ -274,9 +274,9 @@  discard block
 block discarded – undo
274 274
  */
275 275
 function enfold_action_sidebar_right_open($type = '', $id = '', $class = '', $itemtype = '')
276 276
 {
277
-    $sidebar_smartphone = avia_get_option('smartphones_sidebar') == 'smartphones_sidebar' ? 'smartphones_sidebar_active' : "";
278
-    echo "<aside class='sidebar sidebar_right " . $sidebar_smartphone . " " . avia_layout_class('sidebar', false) . " units' " . avia_markup_helper(array('context' => 'sidebar', 'echo' => false)) . ">";
279
-    echo "<div class='inner_sidebar extralight-border'>";
277
+	$sidebar_smartphone = avia_get_option('smartphones_sidebar') == 'smartphones_sidebar' ? 'smartphones_sidebar_active' : "";
278
+	echo "<aside class='sidebar sidebar_right " . $sidebar_smartphone . " " . avia_layout_class('sidebar', false) . " units' " . avia_markup_helper(array('context' => 'sidebar', 'echo' => false)) . ">";
279
+	echo "<div class='inner_sidebar extralight-border'>";
280 280
 }
281 281
 
282 282
 /**
@@ -291,9 +291,9 @@  discard block
 block discarded – undo
291 291
  */
292 292
 function enfold_action_sidebar_left_open($type = '', $id = '', $class = '', $itemtype = '')
293 293
 {
294
-    $sidebar_smartphone = avia_get_option('smartphones_sidebar') == 'smartphones_sidebar' ? 'smartphones_sidebar_active' : "";
295
-    echo "<aside class='sidebar sidebar_left " . $sidebar_smartphone . " " . avia_layout_class('sidebar', false) . " units' " . avia_markup_helper(array('context' => 'sidebar', 'echo' => false)) . ">";
296
-    echo "<div class='inner_sidebar extralight-border'>";
294
+	$sidebar_smartphone = avia_get_option('smartphones_sidebar') == 'smartphones_sidebar' ? 'smartphones_sidebar_active' : "";
295
+	echo "<aside class='sidebar sidebar_left " . $sidebar_smartphone . " " . avia_layout_class('sidebar', false) . " units' " . avia_markup_helper(array('context' => 'sidebar', 'echo' => false)) . ">";
296
+	echo "<div class='inner_sidebar extralight-border'>";
297 297
 }
298 298
 
299 299
 
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
  */
308 308
 function gd_enfold_remove_maps_api($call)
309 309
 {
310
-    return false;
310
+	return false;
311 311
 }
312 312
 
313 313
 
Please login to merge, or discard this patch.
geodirectory.php 3 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
      * This tries to disable cache on homepage as it can be very dynamic.
101 101
      */
102 102
     define('DONOTCACHEPAGE', TRUE);
103
-    $_SERVER['DONOTCACHEPAGE']= TRUE;
103
+    $_SERVER['DONOTCACHEPAGE'] = TRUE;
104 104
 }
105 105
 
106 106
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 if (!defined('GEODIRECTORY_TEXTDOMAIN')) define('GEODIRECTORY_TEXTDOMAIN', 'geodirectory');
111 111
 
112 112
 // Load geodirectory plugin textdomain.
113
-add_action( 'plugins_loaded', 'geodir_load_textdomain' );
113
+add_action('plugins_loaded', 'geodir_load_textdomain');
114 114
 
115 115
 /*
116 116
  * A function to log GD errors no matter the type given.
@@ -121,18 +121,18 @@  discard block
 block discarded – undo
121 121
  * @param mixed $log The thing that should be logged.
122 122
  * @package GeoDirectory
123 123
  */
124
-function geodir_error_log($log){
124
+function geodir_error_log($log) {
125 125
     /*
126 126
      * A filter to override the WP_DEBUG setting for function geodir_error_log().
127 127
      *
128 128
      * @since 1.5.7
129 129
      */
130
-    $should_log = apply_filters( 'geodir_log_errors', WP_DEBUG);
131
-    if ( true === $should_log ) {
132
-        if ( is_array( $log ) || is_object( $log ) ) {
133
-            error_log( print_r( $log, true ) );
130
+    $should_log = apply_filters('geodir_log_errors', WP_DEBUG);
131
+    if (true === $should_log) {
132
+        if (is_array($log) || is_object($log)) {
133
+            error_log(print_r($log, true));
134 134
         } else {
135
-            error_log( $log );
135
+            error_log($log);
136 136
         }
137 137
     }
138 138
 }
@@ -225,11 +225,11 @@  discard block
 block discarded – undo
225 225
    // if ( 'plugins.php' === $pagenow )
226 226
     {
227 227
         // Better update message
228
-        $file   = basename( __FILE__ );
229
-        $folder = basename( dirname( __FILE__ ) );
228
+        $file   = basename(__FILE__);
229
+        $folder = basename(dirname(__FILE__));
230 230
         $hook = "in_plugin_update_message-{$folder}/{$file}";
231 231
         //echo $hook;
232
-        add_action( 'in_plugin_update_message-geodirectory/geodirectory.php', 'geodire_admin_upgrade_notice', 20, 2 );
232
+        add_action('in_plugin_update_message-geodirectory/geodirectory.php', 'geodire_admin_upgrade_notice', 20, 2);
233 233
     }
234 234
 
235 235
 }
Please login to merge, or discard this patch.
Indentation   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -32,30 +32,30 @@  discard block
 block discarded – undo
32 32
  * CHECK FOR OLD COMPATIBILITY PACKS AND DISABLE IF THEY ARE ACTIVE
33 33
  */
34 34
 if (is_admin()) {
35
-    /**
36
-     * Include WordPress core file so we can use core functions to check for active plugins.
37
-     */
38
-    include_once(ABSPATH . 'wp-admin/includes/plugin.php');
35
+	/**
36
+	 * Include WordPress core file so we can use core functions to check for active plugins.
37
+	 */
38
+	include_once(ABSPATH . 'wp-admin/includes/plugin.php');
39 39
 
40
-    if (is_plugin_active('geodirectory-genesis-compatibility-pack/geodir_genesis_compatibility.php')) {
41
-        deactivate_plugins('geodirectory-genesis-compatibility-pack/geodir_genesis_compatibility.php');
42
-    }
40
+	if (is_plugin_active('geodirectory-genesis-compatibility-pack/geodir_genesis_compatibility.php')) {
41
+		deactivate_plugins('geodirectory-genesis-compatibility-pack/geodir_genesis_compatibility.php');
42
+	}
43 43
 
44
-    if (is_plugin_active('geodirectory-x-theme-compatibility-pack/geodir_x_compatibility.php')) {
45
-        deactivate_plugins('geodirectory-x-theme-compatibility-pack/geodir_x_compatibility.php');
46
-    }
44
+	if (is_plugin_active('geodirectory-x-theme-compatibility-pack/geodir_x_compatibility.php')) {
45
+		deactivate_plugins('geodirectory-x-theme-compatibility-pack/geodir_x_compatibility.php');
46
+	}
47 47
 
48
-    if (is_plugin_active('geodirectory-enfold-theme-compatibility-pack/geodir_enfold_compatibility.php')) {
49
-        deactivate_plugins('geodirectory-enfold-theme-compatibility-pack/geodir_enfold_compatibility.php');
50
-    }
48
+	if (is_plugin_active('geodirectory-enfold-theme-compatibility-pack/geodir_enfold_compatibility.php')) {
49
+		deactivate_plugins('geodirectory-enfold-theme-compatibility-pack/geodir_enfold_compatibility.php');
50
+	}
51 51
 
52
-    if (is_plugin_active('geodir_avada_compatibility/geodir_avada_compatibility.php')) {
53
-        deactivate_plugins('geodir_avada_compatibility/geodir_avada_compatibility.php');
54
-    }
52
+	if (is_plugin_active('geodir_avada_compatibility/geodir_avada_compatibility.php')) {
53
+		deactivate_plugins('geodir_avada_compatibility/geodir_avada_compatibility.php');
54
+	}
55 55
 
56
-    if (is_plugin_active('geodir_compat_pack_divi/geodir_divi_compatibility.php')) {
57
-        deactivate_plugins('geodir_compat_pack_divi/geodir_divi_compatibility.php');
58
-    }
56
+	if (is_plugin_active('geodir_compat_pack_divi/geodir_divi_compatibility.php')) {
57
+		deactivate_plugins('geodir_compat_pack_divi/geodir_divi_compatibility.php');
58
+	}
59 59
 
60 60
 }
61 61
 
@@ -96,11 +96,11 @@  discard block
 block discarded – undo
96 96
 
97 97
 
98 98
 if ($_SERVER['REQUEST_URI'] == '' || $_SERVER['REQUEST_URI'] == '/') {
99
-    /**
100
-     * This tries to disable cache on homepage as it can be very dynamic.
101
-     */
102
-    define('DONOTCACHEPAGE', TRUE);
103
-    $_SERVER['DONOTCACHEPAGE']= TRUE;
99
+	/**
100
+	 * This tries to disable cache on homepage as it can be very dynamic.
101
+	 */
102
+	define('DONOTCACHEPAGE', TRUE);
103
+	$_SERVER['DONOTCACHEPAGE']= TRUE;
104 104
 }
105 105
 
106 106
 
@@ -122,19 +122,19 @@  discard block
 block discarded – undo
122 122
  * @package GeoDirectory
123 123
  */
124 124
 function geodir_error_log($log){
125
-    /*
125
+	/*
126 126
      * A filter to override the WP_DEBUG setting for function geodir_error_log().
127 127
      *
128 128
      * @since 1.5.7
129 129
      */
130
-    $should_log = apply_filters( 'geodir_log_errors', WP_DEBUG);
131
-    if ( true === $should_log ) {
132
-        if ( is_array( $log ) || is_object( $log ) ) {
133
-            error_log( print_r( $log, true ) );
134
-        } else {
135
-            error_log( $log );
136
-        }
137
-    }
130
+	$should_log = apply_filters( 'geodir_log_errors', WP_DEBUG);
131
+	if ( true === $should_log ) {
132
+		if ( is_array( $log ) || is_object( $log ) ) {
133
+			error_log( print_r( $log, true ) );
134
+		} else {
135
+			error_log( $log );
136
+		}
137
+	}
138 138
 }
139 139
 
140 140
 /**
@@ -174,62 +174,62 @@  discard block
 block discarded – undo
174 174
  */
175 175
 if (is_admin()) {
176 176
 
177
-    /**
178
-     * Include functions used in admin area only.
179
-     *
180
-     * @since 1.0.0
181
-     */
182
-    require_once('geodirectory-admin/admin_functions.php');
183
-    /**
184
-     * Most actions/hooks used in admin area only are called from here.
185
-     *
186
-     * @since 1.0.0
187
-     */
188
-    require_once('geodirectory-admin/admin_hooks_actions.php');
189
-    /**
190
-     * Most admin JS and CSS is called from here.
191
-     *
192
-     * @since 1.0.0
193
-     */
194
-    require_once('geodirectory-admin/admin_template_tags.php');
195
-    /**
196
-     * Include any functions needed for upgrades.
197
-     *
198
-     * @since 1.0.0
199
-     */
200
-    require_once(geodir_plugin_path() . '/upgrade.php');
201
-    if (get_option('geodir_installed') != 1) {
202
-        /**
203
-         * Define language constants, here as they are not loaded yet.
204
-         *
205
-         * @since 1.0.0
206
-         */
207
-        require_once(geodir_plugin_path() . '/language.php');
208
-        /**
209
-         * Include the plugin install file that sets up the databases and any options on first run.
210
-         *
211
-         * @since 1.0.0
212
-         */
213
-        require_once('geodirectory-admin/admin_install.php');
214
-        register_activation_hook(__FILE__, 'geodir_activation');
215
-    }
216
-    register_deactivation_hook(__FILE__, 'geodir_deactivation');
217
-    register_uninstall_hook(__FILE__, 'geodir_uninstall');
218
-
219
-    /*
177
+	/**
178
+	 * Include functions used in admin area only.
179
+	 *
180
+	 * @since 1.0.0
181
+	 */
182
+	require_once('geodirectory-admin/admin_functions.php');
183
+	/**
184
+	 * Most actions/hooks used in admin area only are called from here.
185
+	 *
186
+	 * @since 1.0.0
187
+	 */
188
+	require_once('geodirectory-admin/admin_hooks_actions.php');
189
+	/**
190
+	 * Most admin JS and CSS is called from here.
191
+	 *
192
+	 * @since 1.0.0
193
+	 */
194
+	require_once('geodirectory-admin/admin_template_tags.php');
195
+	/**
196
+	 * Include any functions needed for upgrades.
197
+	 *
198
+	 * @since 1.0.0
199
+	 */
200
+	require_once(geodir_plugin_path() . '/upgrade.php');
201
+	if (get_option('geodir_installed') != 1) {
202
+		/**
203
+		 * Define language constants, here as they are not loaded yet.
204
+		 *
205
+		 * @since 1.0.0
206
+		 */
207
+		require_once(geodir_plugin_path() . '/language.php');
208
+		/**
209
+		 * Include the plugin install file that sets up the databases and any options on first run.
210
+		 *
211
+		 * @since 1.0.0
212
+		 */
213
+		require_once('geodirectory-admin/admin_install.php');
214
+		register_activation_hook(__FILE__, 'geodir_activation');
215
+	}
216
+	register_deactivation_hook(__FILE__, 'geodir_deactivation');
217
+	register_uninstall_hook(__FILE__, 'geodir_uninstall');
218
+
219
+	/*
220 220
      * Show a upgrade warning message if applicable.
221 221
      *
222 222
      * @since 1.5.6
223 223
      */
224
-    global $pagenow;
224
+	global $pagenow;
225 225
    // if ( 'plugins.php' === $pagenow )
226
-    {
227
-        // Better update message
228
-        $file   = basename( __FILE__ );
229
-        $folder = basename( dirname( __FILE__ ) );
230
-        $hook = "in_plugin_update_message-{$folder}/{$file}";
231
-        //echo $hook;
232
-        add_action( 'in_plugin_update_message-geodirectory/geodirectory.php', 'geodire_admin_upgrade_notice', 20, 2 );
233
-    }
226
+	{
227
+		// Better update message
228
+		$file   = basename( __FILE__ );
229
+		$folder = basename( dirname( __FILE__ ) );
230
+		$hook = "in_plugin_update_message-{$folder}/{$file}";
231
+		//echo $hook;
232
+		add_action( 'in_plugin_update_message-geodirectory/geodirectory.php', 'geodire_admin_upgrade_notice', 20, 2 );
233
+	}
234 234
 
235 235
 }
Please login to merge, or discard this patch.
Braces   +24 added lines, -8 removed lines patch added patch discarded remove patch
@@ -74,7 +74,9 @@  discard block
 block discarded – undo
74 74
 /**
75 75
  * Do not store any revisions (except the one autosave per post).
76 76
  */
77
-if (!defined('WP_POST_REVISIONS')) define('WP_POST_REVISIONS', 0);
77
+if (!defined('WP_POST_REVISIONS')) {
78
+	define('WP_POST_REVISIONS', 0);
79
+}
78 80
 
79 81
 
80 82
 /*
@@ -82,17 +84,29 @@  discard block
 block discarded – undo
82 84
  */
83 85
 
84 86
 /** Define the database name for the countries table. */
85
-if (!defined('GEODIR_COUNTRIES_TABLE')) define('GEODIR_COUNTRIES_TABLE', $plugin_prefix . 'countries');
87
+if (!defined('GEODIR_COUNTRIES_TABLE')) {
88
+	define('GEODIR_COUNTRIES_TABLE', $plugin_prefix . 'countries');
89
+}
86 90
 /** Define the database name for the custom fields table. */
87
-if (!defined('GEODIR_CUSTOM_FIELDS_TABLE')) define('GEODIR_CUSTOM_FIELDS_TABLE', $plugin_prefix . 'custom_fields');
91
+if (!defined('GEODIR_CUSTOM_FIELDS_TABLE')) {
92
+	define('GEODIR_CUSTOM_FIELDS_TABLE', $plugin_prefix . 'custom_fields');
93
+}
88 94
 /** Define the database name for the icons table. */
89
-if (!defined('GEODIR_ICON_TABLE')) define('GEODIR_ICON_TABLE', $plugin_prefix . 'post_icon');
95
+if (!defined('GEODIR_ICON_TABLE')) {
96
+	define('GEODIR_ICON_TABLE', $plugin_prefix . 'post_icon');
97
+}
90 98
 /** Define the database name for the attachments table. */
91
-if (!defined('GEODIR_ATTACHMENT_TABLE')) define('GEODIR_ATTACHMENT_TABLE', $plugin_prefix . 'attachments');
99
+if (!defined('GEODIR_ATTACHMENT_TABLE')) {
100
+	define('GEODIR_ATTACHMENT_TABLE', $plugin_prefix . 'attachments');
101
+}
92 102
 /** Define the database name for the review table. */
93
-if (!defined('GEODIR_REVIEW_TABLE')) define('GEODIR_REVIEW_TABLE', $plugin_prefix . 'post_review');
103
+if (!defined('GEODIR_REVIEW_TABLE')) {
104
+	define('GEODIR_REVIEW_TABLE', $plugin_prefix . 'post_review');
105
+}
94 106
 /** Define the database name for the custom sort fields table. */
95
-if (!defined('GEODIR_CUSTOM_SORT_FIELDS_TABLE')) define('GEODIR_CUSTOM_SORT_FIELDS_TABLE', $plugin_prefix . 'custom_sort_fields');
107
+if (!defined('GEODIR_CUSTOM_SORT_FIELDS_TABLE')) {
108
+	define('GEODIR_CUSTOM_SORT_FIELDS_TABLE', $plugin_prefix . 'custom_sort_fields');
109
+}
96 110
 
97 111
 
98 112
 if ($_SERVER['REQUEST_URI'] == '' || $_SERVER['REQUEST_URI'] == '/') {
@@ -107,7 +121,9 @@  discard block
 block discarded – undo
107 121
 /*
108 122
  * Localisation items.
109 123
  */
110
-if (!defined('GEODIRECTORY_TEXTDOMAIN')) define('GEODIRECTORY_TEXTDOMAIN', 'geodirectory');
124
+if (!defined('GEODIRECTORY_TEXTDOMAIN')) {
125
+	define('GEODIRECTORY_TEXTDOMAIN', 'geodirectory');
126
+}
111 127
 
112 128
 // Load geodirectory plugin textdomain.
113 129
 add_action( 'plugins_loaded', 'geodir_load_textdomain' );
Please login to merge, or discard this patch.
geodirectory-functions/post_functions.php 4 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -721,7 +721,7 @@  discard block
 block discarded – undo
721 721
      * @param int $post_id The post ID.
722 722
      * @param string $postmeta Detail table column name.
723 723
      * @param string $meta_value Detail table column value.
724
-     * @return void|bool
724
+     * @return null|false
725 725
      */
726 726
     function geodir_save_post_meta($post_id, $postmeta = '', $meta_value = '')
727 727
     {
@@ -775,7 +775,7 @@  discard block
 block discarded – undo
775 775
      * @param string $postmeta Detail table column name.
776 776
      * @todo check if this is depreciated
777 777
      * @todo Fix unknown variable mval
778
-     * @return bool
778
+     * @return boolean|null
779 779
      */
780 780
     function geodir_delete_post_meta($post_id, $postmeta)
781 781
     {
@@ -2124,7 +2124,7 @@  discard block
 block discarded – undo
2124 2124
      * @global string $plugin_prefix Geodirectory plugin table prefix.
2125 2125
      * @param int $deleted_postid The post ID.
2126 2126
      * @param bool $force Optional. Do you want to force delete it? Default: false.
2127
-     * @return bool|void
2127
+     * @return null|false
2128 2128
      */
2129 2129
     function geodir_delete_listing_info($deleted_postid, $force = false)
2130 2130
     {
@@ -2693,7 +2693,7 @@  discard block
 block discarded – undo
2693 2693
  * @since 1.0.0
2694 2694
  * @package GeoDirectory
2695 2695
  * @global object $current_user Current user object.
2696
- * @param int|string $listing_id The post ID.
2696
+ * @param integer $listing_id The post ID.
2697 2697
  * @param bool $exclude_admin Optional. Do you want to exclude admin from the check?. Default true.
2698 2698
  * @return bool
2699 2699
  */
Please login to merge, or discard this patch.
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -26,11 +26,11 @@  discard block
 block discarded – undo
26 26
 
27 27
     if (!isset($default_cat) || empty($default_cat)) {
28 28
         $default_cat = isset($post_cat_array[0]) ? $post_cat_array[0] : '';
29
-    }else{
30
-        if(!is_int($default_cat)){
29
+    } else {
30
+        if (!is_int($default_cat)) {
31 31
             $category = get_term_by('name', $default_cat, $taxonomy);
32
-            if(isset($category->term_id)){
33
-                $default_cat =  $category->term_id;
32
+            if (isset($category->term_id)) {
33
+                $default_cat = $category->term_id;
34 34
             }
35 35
         }
36 36
 
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
         $send_post_submit_mail = false;
228 228
 
229 229
         // unhook this function so it doesn't loop infinitely
230
-        remove_action('save_post', 'geodir_post_information_save',10,2);
230
+        remove_action('save_post', 'geodir_post_information_save', 10, 2);
231 231
 
232 232
         if (isset($request_info['pid']) && $request_info['pid'] != '') {
233 233
             $post['ID'] = $request_info['pid'];
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
         }
252 252
 
253 253
         // re-hook this function
254
-        add_action('save_post', 'geodir_post_information_save',10,2);
254
+        add_action('save_post', 'geodir_post_information_save', 10, 2);
255 255
 
256 256
         $post_tags = '';
257 257
         if (!isset($request_info['post_tags'])) {
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
         $payment_info = array();
276 276
         $package_info = array();
277 277
 
278
-        $package_info = (array)geodir_post_package_info($package_info, $post);
278
+        $package_info = (array) geodir_post_package_info($package_info, $post);
279 279
 
280 280
         $post_package_id = geodir_get_post_meta($last_post_id, 'package_id');
281 281
 
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
                 $tmpimgArr = trim($request_info['post_images'], ",");
475 475
                 $tmpimgArr = explode(",", $tmpimgArr);
476 476
                 geodir_save_post_images($last_post_id, $tmpimgArr, $dummy);
477
-            } else{
477
+            } else {
478 478
                 geodir_save_post_images($last_post_id, $request_info['post_images'], $dummy);
479 479
             }
480 480
 
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
 
659 659
             $post_meta_set_query = trim($post_meta_set_query, ", ");
660 660
 
661
-            $post_meta_set_query = str_replace('%', '%%', $post_meta_set_query);// escape %
661
+            $post_meta_set_query = str_replace('%', '%%', $post_meta_set_query); // escape %
662 662
 
663 663
             /**
664 664
              * Called before saving the listing info.
@@ -928,7 +928,7 @@  discard block
 block discarded – undo
928 928
                 $file_path = '';
929 929
                 /* --------- start ------- */
930 930
 
931
-                $split_img_path = explode(str_replace(array('http://','https://'),'',$uploads['baseurl']), str_replace(array('http://','https://'),'',$post_image[$m]));
931
+                $split_img_path = explode(str_replace(array('http://', 'https://'), '', $uploads['baseurl']), str_replace(array('http://', 'https://'), '', $post_image[$m]));
932 932
 
933 933
                 $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
934 934
 
@@ -985,20 +985,20 @@  discard block
 block discarded – undo
985 985
                         }
986 986
 
987 987
                         $external_img = false;
988
-                        if (strpos(str_replace(array('http://','https://'),'',$curr_img_url), str_replace(array('http://','https://'),'',$uploads['baseurl'])) !== false) {
988
+                        if (strpos(str_replace(array('http://', 'https://'), '', $curr_img_url), str_replace(array('http://', 'https://'), '', $uploads['baseurl'])) !== false) {
989 989
                         } else {
990 990
                             $external_img = true;
991 991
                         }
992 992
 
993 993
                         if ($dummy || $external_img) {
994 994
                             $uploaded_file = array();
995
-                            $uploaded = (array)fetch_remote_file($curr_img_url);
995
+                            $uploaded = (array) fetch_remote_file($curr_img_url);
996 996
 
997 997
                             if (isset($uploaded['error']) && empty($uploaded['error'])) {
998 998
                                 $new_name = basename($uploaded['file']);
999 999
                                 $uploaded_file = $uploaded;
1000
-                            }else{
1001
-                                print_r($uploaded);exit;
1000
+                            } else {
1001
+                                print_r($uploaded); exit;
1002 1002
                             }
1003 1003
                             $external_img = false;
1004 1004
                         } else {
@@ -1031,7 +1031,7 @@  discard block
 block discarded – undo
1031 1031
                                 $file_path = $sub_dir . '/' . $new_name;
1032 1032
                             }
1033 1033
 
1034
-                            $postcurr_images[] = str_replace(array('http://','https://'),'',$uploads['baseurl'] . $file_path);
1034
+                            $postcurr_images[] = str_replace(array('http://', 'https://'), '', $uploads['baseurl'] . $file_path);
1035 1035
 
1036 1036
                             if ($menu_order == 1) {
1037 1037
 
@@ -1069,7 +1069,7 @@  discard block
 block discarded – undo
1069 1069
                 } else {
1070 1070
                     $valid_file_ids[] = $find_image;
1071 1071
 
1072
-                    $postcurr_images[] = str_replace(array('http://','https://'),'',$post_image[$m]);
1072
+                    $postcurr_images[] = str_replace(array('http://', 'https://'), '', $post_image[$m]);
1073 1073
 
1074 1074
                     $wpdb->query(
1075 1075
                         $wpdb->prepare(
@@ -1103,9 +1103,9 @@  discard block
 block discarded – undo
1103 1103
 
1104 1104
                 foreach ($post_images as $img) {
1105 1105
 
1106
-                    if (!in_array(str_replace(array('http://','https://'),'',$img->src), $postcurr_images)) {
1106
+                    if (!in_array(str_replace(array('http://', 'https://'), '', $img->src), $postcurr_images)) {
1107 1107
 
1108
-                        $invalid_files[] = (object)array('src' => $img->src);
1108
+                        $invalid_files[] = (object) array('src' => $img->src);
1109 1109
 
1110 1110
                     }
1111 1111
 
@@ -1113,7 +1113,7 @@  discard block
 block discarded – undo
1113 1113
 
1114 1114
             }
1115 1115
 
1116
-            $invalid_files = (object)$invalid_files;
1116
+            $invalid_files = (object) $invalid_files;
1117 1117
         }
1118 1118
 
1119 1119
         $remove_files[] = $post_id;
@@ -1247,7 +1247,7 @@  discard block
 block discarded – undo
1247 1247
         }
1248 1248
 
1249 1249
         if (!in_array($post_type, geodir_get_posttypes())) {
1250
-            return false;// if not a GD CPT return;
1250
+            return false; // if not a GD CPT return;
1251 1251
         }
1252 1252
 
1253 1253
         $table = $plugin_prefix . $post_type . '_detail';
@@ -1284,7 +1284,7 @@  discard block
 block discarded – undo
1284 1284
              * @param string $uploads_url The server upload directory url.
1285 1285
              * @param string $uploads_baseurl The uploads dir base url.
1286 1286
              */
1287
-            $img_arr['src'] = apply_filters('geodir_get_featured_image_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
1287
+            $img_arr['src'] = apply_filters('geodir_get_featured_image_src', $uploads_url . '/' . $file_name, $file_name, $uploads_url, $uploads_baseurl);
1288 1288
             $img_arr['path'] = $uploads_path . '/' . $file_name;
1289 1289
             $imagesize = getimagesize($img_arr['path']);
1290 1290
             $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : 0;
@@ -1337,7 +1337,7 @@  discard block
 block discarded – undo
1337 1337
         }
1338 1338
 
1339 1339
         if (!empty($img_arr))
1340
-            return (object)$img_arr;//return (object)array( 'src' => $file_url, 'path' => $file_path );
1340
+            return (object) $img_arr; //return (object)array( 'src' => $file_url, 'path' => $file_path );
1341 1341
         else
1342 1342
             return false;
1343 1343
     }
@@ -1436,7 +1436,7 @@  discard block
 block discarded – undo
1436 1436
                 * @param string $uploads_url The server upload directory url.
1437 1437
                 * @param string $uploads_baseurl The uploads dir base url.
1438 1438
                 */
1439
-                $img_arr['src'] = apply_filters('geodir_get_images_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
1439
+                $img_arr['src'] = apply_filters('geodir_get_images_src', $uploads_url . '/' . $file_name, $file_name, $uploads_url, $uploads_baseurl);
1440 1440
                 $img_arr['path'] = $uploads_path . '/' . $file_name;
1441 1441
                 $imagesize = getimagesize($img_arr['path']);
1442 1442
                 $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : 0;
@@ -1450,11 +1450,11 @@  discard block
 block discarded – undo
1450 1450
                 $img_arr['content'] = $attechment->content; // add the description to the array
1451 1451
                 $img_arr['is_approved'] = isset($attechment->is_approved) ? $attechment->is_approved : ''; // used for user image moderation. For backward compatibility Default value is 1.
1452 1452
 
1453
-                $return_arr[] = (object)$img_arr;
1453
+                $return_arr[] = (object) $img_arr;
1454 1454
 
1455 1455
                 $counter++;
1456 1456
             }
1457
-            return (object)$return_arr;
1457
+            return (object) $return_arr;
1458 1458
         } else if ($no_images) {
1459 1459
             $default_img = '';
1460 1460
             $default_cat = geodir_get_post_meta($post_id, 'default_category', true);
@@ -1489,7 +1489,7 @@  discard block
 block discarded – undo
1489 1489
                 $img_arr['title'] = $file_name; // add the title to the array
1490 1490
                 $img_arr['content'] = $file_name; // add the description to the array
1491 1491
 
1492
-                $return_arr[] = (object)$img_arr;
1492
+                $return_arr[] = (object) $img_arr;
1493 1493
 
1494 1494
                 return $return_arr;
1495 1495
             } else
@@ -1516,8 +1516,8 @@  discard block
 block discarded – undo
1516 1516
 
1517 1517
         $html = '';
1518 1518
         if (!empty($request)) {
1519
-            if (!is_object($request)){
1520
-                $request = (object)$request;
1519
+            if (!is_object($request)) {
1520
+                $request = (object) $request;
1521 1521
             }
1522 1522
 
1523 1523
             if (isset($request->src) && !isset($request->path)) {
@@ -1528,10 +1528,10 @@  discard block
 block discarded – undo
1528 1528
              * getimagesize() works faster from path than url so we try and get path if we can.
1529 1529
              */
1530 1530
             $upload_dir = wp_upload_dir();
1531
-            $img_no_http = str_replace(array("http://","https://"),"",$request->path);
1532
-            $upload_no_http = str_replace(array("http://","https://"),"",$upload_dir['baseurl']);
1533
-            if (strpos($img_no_http ,$upload_no_http ) !== false) {
1534
-                $request->path = str_replace( $img_no_http,$upload_dir['basedir'],$request->path);
1531
+            $img_no_http = str_replace(array("http://", "https://"), "", $request->path);
1532
+            $upload_no_http = str_replace(array("http://", "https://"), "", $upload_dir['baseurl']);
1533
+            if (strpos($img_no_http, $upload_no_http) !== false) {
1534
+                $request->path = str_replace($img_no_http, $upload_dir['basedir'], $request->path);
1535 1535
             }
1536 1536
 
1537 1537
             $imagesize = getimagesize($request->path);
@@ -1541,7 +1541,7 @@  discard block
 block discarded – undo
1541 1541
             $image->width = $width;
1542 1542
             $image->height = $height;
1543 1543
 
1544
-            $max_size = (object)geodir_get_imagesize($size);
1544
+            $max_size = (object) geodir_get_imagesize($size);
1545 1545
 
1546 1546
             if (!is_wp_error($max_size)) {
1547 1547
 
@@ -1555,10 +1555,10 @@  discard block
 block discarded – undo
1555 1555
                         $width_per = 100;
1556 1556
                 }
1557 1557
 
1558
-                if (is_admin() && !isset($_REQUEST['geodir_ajax'])){
1558
+                if (is_admin() && !isset($_REQUEST['geodir_ajax'])) {
1559 1559
                     $html = '<div class="geodir_thumbnail"><img style="max-height:' . $max_size->h . 'px;" alt="place image" src="' . $image->src . '"  /></div>';
1560 1560
                 }
1561
-                else{
1561
+                else {
1562 1562
                     $html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>';
1563 1563
                 }
1564 1564
 
@@ -1887,7 +1887,7 @@  discard block
 block discarded – undo
1887 1887
                                     } ?>"><img alt="bubble image" style="max-height:50px;"
1888 1888
                                                src="<?php echo $post_images[0]; ?>"/></a></div>
1889 1889
                             <?php
1890
-                            }else{
1890
+                            } else {
1891 1891
                                 echo '<div class="geodir-bubble_image"></div>';
1892 1892
                             }
1893 1893
                         } else {
@@ -1895,7 +1895,7 @@  discard block
 block discarded – undo
1895 1895
                                 ?>
1896 1896
                                 <div class="geodir-bubble_image"><a href="<?php echo $plink; ?>"><?php echo $image; ?></a></div>
1897 1897
                             <?php
1898
-                            }else{
1898
+                            } else {
1899 1899
                                 echo '<div class="geodir-bubble_image"></div>';
1900 1900
                             }
1901 1901
                         }
@@ -1929,7 +1929,7 @@  discard block
 block discarded – undo
1929 1929
                              * @param object $postinfo_obj The posts info as an object.
1930 1930
                              * @param bool|string $post_preview True if currently in post preview page. Empty string if not.                           *
1931 1931
                              */
1932
-                            do_action('geodir_infowindow_meta_after',$postinfo_obj,$post_preview );
1932
+                            do_action('geodir_infowindow_meta_after', $postinfo_obj, $post_preview);
1933 1933
                             ?>
1934 1934
                         </div>
1935 1935
                         <?php
@@ -1941,10 +1941,10 @@  discard block
 block discarded – undo
1941 1941
                             <div class="geodir-bubble-meta-fade"></div>
1942 1942
 
1943 1943
                             <div class="geodir-bubble-meta-bottom">
1944
-                                <span class="geodir-bubble-rating"><?php echo $rating_star;?></span>
1944
+                                <span class="geodir-bubble-rating"><?php echo $rating_star; ?></span>
1945 1945
 
1946 1946
                                 <span
1947
-                                    class="geodir-bubble-fav"><?php echo geodir_favourite_html($post_author, $ID);?></span>
1947
+                                    class="geodir-bubble-fav"><?php echo geodir_favourite_html($post_author, $ID); ?></span>
1948 1948
                   <span class="geodir-bubble-reviews"><a href="<?php echo get_comments_link($ID); ?>"
1949 1949
                                                          class="geodir-pcomments"><i class="fa fa-comments"></i>
1950 1950
                           <?php echo get_comments_number($ID); ?>
@@ -2239,7 +2239,7 @@  discard block
 block discarded – undo
2239 2239
          */
2240 2240
         do_action('geodir_before_add_from_favorite', $post_id);
2241 2241
 
2242
-        echo '<a href="javascript:void(0);" title="' . $remove_favourite_text . '" class="geodir-addtofav geodir-removetofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'remove\');"><i class="'. $favourite_icon .'"></i> ' . $unfavourite_text . '</a>';
2242
+        echo '<a href="javascript:void(0);" title="' . $remove_favourite_text . '" class="geodir-addtofav geodir-removetofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'remove\');"><i class="' . $favourite_icon . '"></i> ' . $unfavourite_text . '</a>';
2243 2243
 
2244 2244
         /**
2245 2245
          * Called after adding the post from favourites.
@@ -2318,7 +2318,7 @@  discard block
 block discarded – undo
2318 2318
          */
2319 2319
         do_action('geodir_before_remove_from_favorite', $post_id);
2320 2320
 
2321
-        echo '<a href="javascript:void(0);"  title="' . $add_favourite_text . '" class="geodir-addtofav geodir-addtofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'add\');"><i class="'. $favourite_icon .'"></i> ' . $favourite_text . '</a>';
2321
+        echo '<a href="javascript:void(0);"  title="' . $add_favourite_text . '" class="geodir-addtofav geodir-addtofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'add\');"><i class="' . $favourite_icon . '"></i> ' . $favourite_text . '</a>';
2322 2322
 
2323 2323
         /**
2324 2324
          * Called after removing the post from favourites.
@@ -2413,10 +2413,10 @@  discard block
 block discarded – undo
2413 2413
             $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2414 2414
 
2415 2415
         if (!empty($user_meta_data) && in_array($post_id, $user_meta_data)) {
2416
-            ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"  ><a
2416
+            ?><span class="geodir-addtofav favorite_property_<?php echo $post_id; ?>"  ><a
2417 2417
                 class="geodir-removetofav-icon" href="javascript:void(0);"
2418
-                onclick="javascript:addToFavourite(<?php echo $post_id;?>,'remove');"
2419
-                title="<?php echo $remove_favourite_text;?>"><i class="<?php echo $unfavourite_icon; ?>"></i> <?php echo $unfavourite_text;?>
2418
+                onclick="javascript:addToFavourite(<?php echo $post_id; ?>,'remove');"
2419
+                title="<?php echo $remove_favourite_text; ?>"><i class="<?php echo $unfavourite_icon; ?>"></i> <?php echo $unfavourite_text; ?>
2420 2420
             </a>   </span><?php
2421 2421
 
2422 2422
         } else {
@@ -2426,11 +2426,11 @@  discard block
 block discarded – undo
2426 2426
             } else
2427 2427
                 $script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')';
2428 2428
 
2429
-            ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"><a class="geodir-addtofav-icon"
2429
+            ?><span class="geodir-addtofav favorite_property_<?php echo $post_id; ?>"><a class="geodir-addtofav-icon"
2430 2430
                                                                                         href="javascript:void(0);"
2431
-                                                                                        onclick="<?php echo $script_text;?>"
2432
-                                                                                        title="<?php echo $add_favourite_text;?>"><i
2433
-                    class="<?php echo $favourite_icon; ?>"></i> <?php echo $favourite_text;?></a></span>
2431
+                                                                                        onclick="<?php echo $script_text; ?>"
2432
+                                                                                        title="<?php echo $add_favourite_text; ?>"><i
2433
+                    class="<?php echo $favourite_icon; ?>"></i> <?php echo $favourite_text; ?></a></span>
2434 2434
         <?php }
2435 2435
     }
2436 2436
 }
@@ -3029,15 +3029,15 @@  discard block
 block discarded – undo
3029 3029
  * @since 1.4.9
3030 3030
  * @package GeoDirectory
3031 3031
  */
3032
-function geodir_fb_like_thumbnail(){
3032
+function geodir_fb_like_thumbnail() {
3033 3033
 
3034 3034
     // return if not a single post
3035
-    if(!is_single()){return;}
3035
+    if (!is_single()) {return; }
3036 3036
 
3037 3037
     global $post;
3038
-    if(isset($post->featured_image) && $post->featured_image){
3038
+    if (isset($post->featured_image) && $post->featured_image) {
3039 3039
         $upload_dir = wp_upload_dir();
3040
-        $thumb = $upload_dir['baseurl'].$post->featured_image;
3040
+        $thumb = $upload_dir['baseurl'] . $post->featured_image;
3041 3041
         echo "\n\n<!-- GD Facebook Like Thumbnail -->\n<link rel=\"image_src\" href=\"$thumb\" />\n<!-- End GD Facebook Like Thumbnail -->\n\n";
3042 3042
 
3043 3043
     }
Please login to merge, or discard this patch.
Indentation   +2201 added lines, -2201 removed lines patch added patch discarded remove patch
@@ -20,468 +20,468 @@  discard block
 block discarded – undo
20 20
 function geodir_set_postcat_structure($post_id, $taxonomy, $default_cat = '', $category_str = '')
21 21
 {
22 22
 
23
-    $post_cat_ids = geodir_get_post_meta($post_id, $taxonomy);
24
-    if (!empty($post_cat_ids))
25
-        $post_cat_array = explode(",", trim($post_cat_ids, ","));
26
-
27
-    if (!isset($default_cat) || empty($default_cat)) {
28
-        $default_cat = isset($post_cat_array[0]) ? $post_cat_array[0] : '';
29
-    }else{
30
-        if(!is_int($default_cat)){
31
-            $category = get_term_by('name', $default_cat, $taxonomy);
32
-            if(isset($category->term_id)){
33
-                $default_cat =  $category->term_id;
34
-            }
35
-        }
23
+	$post_cat_ids = geodir_get_post_meta($post_id, $taxonomy);
24
+	if (!empty($post_cat_ids))
25
+		$post_cat_array = explode(",", trim($post_cat_ids, ","));
26
+
27
+	if (!isset($default_cat) || empty($default_cat)) {
28
+		$default_cat = isset($post_cat_array[0]) ? $post_cat_array[0] : '';
29
+	}else{
30
+		if(!is_int($default_cat)){
31
+			$category = get_term_by('name', $default_cat, $taxonomy);
32
+			if(isset($category->term_id)){
33
+				$default_cat =  $category->term_id;
34
+			}
35
+		}
36 36
 
37
-    }
37
+	}
38 38
 
39 39
 
40
-    geodir_save_post_meta($post_id, 'default_category', $default_cat);
40
+	geodir_save_post_meta($post_id, 'default_category', $default_cat);
41 41
 
42
-    if (isset($category_str) && empty($category_str)) {
42
+	if (isset($category_str) && empty($category_str)) {
43 43
 
44
-        $post_cat_str = '';
45
-        $post_categories = array();
46
-        if (isset($post_cat_array) && is_array($post_cat_array) && !empty($post_cat_array)) {
47
-            $post_cat_str = implode(",y:#", $post_cat_array);
48
-            $post_cat_str .= ",y:";
49
-            $post_cat_str = substr_replace($post_cat_str, ',y,d:', strpos($post_cat_str, ',y:'), strlen(',y:'));
50
-        }
51
-        $post_categories[$taxonomy] = $post_cat_str;
52
-        $category_str = $post_categories;
53
-    }
44
+		$post_cat_str = '';
45
+		$post_categories = array();
46
+		if (isset($post_cat_array) && is_array($post_cat_array) && !empty($post_cat_array)) {
47
+			$post_cat_str = implode(",y:#", $post_cat_array);
48
+			$post_cat_str .= ",y:";
49
+			$post_cat_str = substr_replace($post_cat_str, ',y,d:', strpos($post_cat_str, ',y:'), strlen(',y:'));
50
+		}
51
+		$post_categories[$taxonomy] = $post_cat_str;
52
+		$category_str = $post_categories;
53
+	}
54 54
 
55
-    $change_cat_str = $category_str[$taxonomy];
55
+	$change_cat_str = $category_str[$taxonomy];
56 56
 
57
-    $default_pos = strpos($change_cat_str, 'd:');
57
+	$default_pos = strpos($change_cat_str, 'd:');
58 58
 
59
-    if ($default_pos === false) {
59
+	if ($default_pos === false) {
60 60
 
61
-        $change_cat_str = str_replace($default_cat . ',y:', $default_cat . ',y,d:', $change_cat_str);
61
+		$change_cat_str = str_replace($default_cat . ',y:', $default_cat . ',y,d:', $change_cat_str);
62 62
 
63
-    }
63
+	}
64 64
 
65
-    $category_str[$taxonomy] = $change_cat_str;
65
+	$category_str[$taxonomy] = $change_cat_str;
66 66
 
67
-    update_post_meta($post_id, 'post_categories', $category_str);
67
+	update_post_meta($post_id, 'post_categories', $category_str);
68 68
 
69 69
 }
70 70
 
71 71
 
72 72
 if (!function_exists('geodir_save_listing')) {
73
-    /**
74
-     * Saves listing in the database using given information.
75
-     *
76
-     * @since 1.0.0
77
-     * @since 1.5.4 New parameter $wp_error added.
78
-     * @package GeoDirectory
79
-     * @global object $wpdb WordPress Database object.
80
-     * @global object $post The current post object.
81
-     * @global object $current_user Current user object.
73
+	/**
74
+	 * Saves listing in the database using given information.
75
+	 *
76
+	 * @since 1.0.0
77
+	 * @since 1.5.4 New parameter $wp_error added.
78
+	 * @package GeoDirectory
79
+	 * @global object $wpdb WordPress Database object.
80
+	 * @global object $post The current post object.
81
+	 * @global object $current_user Current user object.
82 82
 	 * @global object $gd_session GeoDirectory Session object.
83
-     * @param array $request_info {
84
-     *    Array of request info arguments.
85
-     *
86
-     *    @type string $action                                  Ajax action name.
87
-     *    @type string $geodir_ajax                             Ajax type.
88
-     *    @type string $ajax_action                             Ajax action.
89
-     *    @type string $listing_type                            Listing type.
90
-     *    @type string $pid                                     Default Post ID.
91
-     *    @type string $preview                                 Todo Desc needed.
92
-     *    @type string $add_listing_page_id                     Add listing page ID.
93
-     *    @type string $post_title                              Listing title.
94
-     *    @type string $post_desc                               Listing Description.
95
-     *    @type string $post_tags                               Listing tags.
96
-     *    @type array  $cat_limit                               Category limit.
97
-     *    @type array  $post_category                           Category IDs.
98
-     *    @type array  $post_category_str                       Category string.
99
-     *    @type string $post_default_category                   Default category ID.
100
-     *    @type string $post_address                            Listing address.
101
-     *    @type string $geodir_location_add_listing_country_val Add listing country value.
102
-     *    @type string $post_country                            Listing country.
103
-     *    @type string $geodir_location_add_listing_region_val  Add listing region value.
104
-     *    @type string $post_region                             Listing region.
105
-     *    @type string $geodir_location_add_listing_city_val    Add listing city value.
106
-     *    @type string $post_city                               Listing city.
107
-     *    @type string $post_zip                                Listing zip.
108
-     *    @type string $post_latitude                           Listing latitude.
109
-     *    @type string $post_longitude                          Listing longitude.
110
-     *    @type string $post_mapview                            Listing mapview. Default "ROADMAP".
111
-     *    @type string $post_mapzoom                            Listing mapzoom Default "9".
112
-     *    @type string $geodir_timing                           Business timing info.
113
-     *    @type string $geodir_contact                          Contact number.
114
-     *    @type string $geodir_email                            Business contact email.
115
-     *    @type string $geodir_website                          Business website.
116
-     *    @type string $geodir_twitter                          Twitter link.
117
-     *    @type string $geodir_facebook                         Facebook link.
118
-     *    @type string $geodir_video                            Video link.
119
-     *    @type string $geodir_special_offers                   Speacial offers.
120
-     *    @type string $post_images                             Post image urls.
121
-     *    @type string $post_imagesimage_limit                  Post images limit.
122
-     *    @type string $post_imagestotImg                       Todo Desc needed.
123
-     *    @type string $geodir_accept_term_condition            Has accepted terms and conditions?.
124
-     *    @type string $geodir_spamblocker                      Todo Desc needed.
125
-     *    @type string $geodir_filled_by_spam_bot               Todo Desc needed.
126
-     *
127
-     * }
128
-     * @param bool $dummy Optional. Is this a dummy listing? Default false.
129
-     * @param bool $wp_error Optional. Allow return of WP_Error on failure. Default false.
130
-     * @return int|string|WP_Error Created post id or WP_Error on failure.
131
-     */
132
-    function geodir_save_listing($request_info = array(), $dummy = false, $wp_error = false)
133
-    {
134
-        global $wpdb, $current_user, $gd_session;
135
-
136
-        $last_post_id = '';
137
-
138
-        if ($gd_session->get('listing') && !$dummy) {
139
-            $request_info = array();
140
-            $request_session = $gd_session->get('listing');
141
-            $request_info = array_merge($_REQUEST, $request_session);
142
-        } else if (!$gd_session->get('listing') && !$dummy) {
143
-            global $post;
144
-            $request_info['pid'] = !empty($post->ID) ? $post->ID : (!empty($request_info['post_id']) ? $request_info['post_id'] : NULL);
145
-            $request_info['post_title'] = $request_info['post_title'];
146
-            $request_info['listing_type'] = $post->post_type;
147
-            $request_info['post_desc'] = $request_info['content'];
148
-        } else if (!$dummy) {
149
-            return false;
150
-        }
151
-
152
-        /**
153
-         * Filter the request_info array.
154
-         *
155
-         * You can use this filter to modify request_info array.
156
-         *
157
-         * @since 1.0.0
158
-         * @package GeoDirectory
159
-         * @param array $request_info See {@see geodir_save_listing()} for accepted args.
160
-         */
161
-        $request_info = apply_filters('geodir_action_get_request_info', $request_info);
162
-
163
-        // Check if we need to save post location as new location
164
-        $location_result = geodir_get_default_location();
165
-
166
-        if ($location_result->location_id > 0) {
167
-            if (isset($request_info['post_city']) && isset($request_info['post_region'])) {
168
-                $request_info['post_location'] = array(
169
-                    'city' => $request_info['post_city'],
170
-                    'region' => isset($request_info['post_region']) ? $request_info['post_region'] : '',
171
-                    'country' => isset($request_info['post_country']) ? $request_info['post_country'] : '',
172
-                    'geo_lat' => isset($request_info['post_latitude']) ? $request_info['post_latitude'] : '',
173
-                    'geo_lng' => isset($request_info['post_longitude']) ? $request_info['post_longitude'] : ''
174
-                );
175
-
176
-                $post_location_info = $request_info['post_location'];
177
-
178
-                if ($location_id = geodir_add_new_location($post_location_info)) {
179
-                    $post_location_id = $location_id;
180
-                }
181
-            } else {
182
-                $post_location_id = $location_result->location_id;
183
-            }
184
-        } else {
185
-            $post_location_id = $location_result->location_id;
186
-        }
187
-
188
-        if ($dummy) {
189
-            $post_status = 'publish';
190
-        } else {
191
-            $post_status = geodir_new_post_default_status();
192
-        }
193
-
194
-        if (isset($request_info['pid']) && $request_info['pid'] != '') {
195
-            $post_status = get_post_status($request_info['pid']);
196
-        }
197
-
198
-        /* fix change of slug on every title edit */
199
-        if (!isset($request_info['post_name'])) {
200
-            $request_info['post_name'] = $request_info['post_title'];
201
-
202
-            if (!empty($request_info['pid'])) {
203
-                $post_info = get_post($request_info['pid']);
204
-
205
-                if (!empty($post_info) && isset($post_info->post_name)) {
206
-                    $request_info['post_name'] = $post_info->post_name;
207
-                }
208
-            }
209
-        }
210
-
211
-        $post = array(
212
-            'post_content' => $request_info['post_desc'],
213
-            'post_status' => $post_status,
214
-            'post_title' => $request_info['post_title'],
215
-            'post_name' => $request_info['post_name'],
216
-            'post_type' => $request_info['listing_type']
217
-        );
218
-
219
-        /**
220
-         * Called before a listing is saved to the database.
221
-         *
222
-         * @since 1.0.0
223
-         * @param object $post The post object.
224
-         */
225
-        do_action_ref_array('geodir_before_save_listing', $post);
83
+	 * @param array $request_info {
84
+	 *    Array of request info arguments.
85
+	 *
86
+	 *    @type string $action                                  Ajax action name.
87
+	 *    @type string $geodir_ajax                             Ajax type.
88
+	 *    @type string $ajax_action                             Ajax action.
89
+	 *    @type string $listing_type                            Listing type.
90
+	 *    @type string $pid                                     Default Post ID.
91
+	 *    @type string $preview                                 Todo Desc needed.
92
+	 *    @type string $add_listing_page_id                     Add listing page ID.
93
+	 *    @type string $post_title                              Listing title.
94
+	 *    @type string $post_desc                               Listing Description.
95
+	 *    @type string $post_tags                               Listing tags.
96
+	 *    @type array  $cat_limit                               Category limit.
97
+	 *    @type array  $post_category                           Category IDs.
98
+	 *    @type array  $post_category_str                       Category string.
99
+	 *    @type string $post_default_category                   Default category ID.
100
+	 *    @type string $post_address                            Listing address.
101
+	 *    @type string $geodir_location_add_listing_country_val Add listing country value.
102
+	 *    @type string $post_country                            Listing country.
103
+	 *    @type string $geodir_location_add_listing_region_val  Add listing region value.
104
+	 *    @type string $post_region                             Listing region.
105
+	 *    @type string $geodir_location_add_listing_city_val    Add listing city value.
106
+	 *    @type string $post_city                               Listing city.
107
+	 *    @type string $post_zip                                Listing zip.
108
+	 *    @type string $post_latitude                           Listing latitude.
109
+	 *    @type string $post_longitude                          Listing longitude.
110
+	 *    @type string $post_mapview                            Listing mapview. Default "ROADMAP".
111
+	 *    @type string $post_mapzoom                            Listing mapzoom Default "9".
112
+	 *    @type string $geodir_timing                           Business timing info.
113
+	 *    @type string $geodir_contact                          Contact number.
114
+	 *    @type string $geodir_email                            Business contact email.
115
+	 *    @type string $geodir_website                          Business website.
116
+	 *    @type string $geodir_twitter                          Twitter link.
117
+	 *    @type string $geodir_facebook                         Facebook link.
118
+	 *    @type string $geodir_video                            Video link.
119
+	 *    @type string $geodir_special_offers                   Speacial offers.
120
+	 *    @type string $post_images                             Post image urls.
121
+	 *    @type string $post_imagesimage_limit                  Post images limit.
122
+	 *    @type string $post_imagestotImg                       Todo Desc needed.
123
+	 *    @type string $geodir_accept_term_condition            Has accepted terms and conditions?.
124
+	 *    @type string $geodir_spamblocker                      Todo Desc needed.
125
+	 *    @type string $geodir_filled_by_spam_bot               Todo Desc needed.
126
+	 *
127
+	 * }
128
+	 * @param bool $dummy Optional. Is this a dummy listing? Default false.
129
+	 * @param bool $wp_error Optional. Allow return of WP_Error on failure. Default false.
130
+	 * @return int|string|WP_Error Created post id or WP_Error on failure.
131
+	 */
132
+	function geodir_save_listing($request_info = array(), $dummy = false, $wp_error = false)
133
+	{
134
+		global $wpdb, $current_user, $gd_session;
135
+
136
+		$last_post_id = '';
137
+
138
+		if ($gd_session->get('listing') && !$dummy) {
139
+			$request_info = array();
140
+			$request_session = $gd_session->get('listing');
141
+			$request_info = array_merge($_REQUEST, $request_session);
142
+		} else if (!$gd_session->get('listing') && !$dummy) {
143
+			global $post;
144
+			$request_info['pid'] = !empty($post->ID) ? $post->ID : (!empty($request_info['post_id']) ? $request_info['post_id'] : NULL);
145
+			$request_info['post_title'] = $request_info['post_title'];
146
+			$request_info['listing_type'] = $post->post_type;
147
+			$request_info['post_desc'] = $request_info['content'];
148
+		} else if (!$dummy) {
149
+			return false;
150
+		}
151
+
152
+		/**
153
+		 * Filter the request_info array.
154
+		 *
155
+		 * You can use this filter to modify request_info array.
156
+		 *
157
+		 * @since 1.0.0
158
+		 * @package GeoDirectory
159
+		 * @param array $request_info See {@see geodir_save_listing()} for accepted args.
160
+		 */
161
+		$request_info = apply_filters('geodir_action_get_request_info', $request_info);
162
+
163
+		// Check if we need to save post location as new location
164
+		$location_result = geodir_get_default_location();
165
+
166
+		if ($location_result->location_id > 0) {
167
+			if (isset($request_info['post_city']) && isset($request_info['post_region'])) {
168
+				$request_info['post_location'] = array(
169
+					'city' => $request_info['post_city'],
170
+					'region' => isset($request_info['post_region']) ? $request_info['post_region'] : '',
171
+					'country' => isset($request_info['post_country']) ? $request_info['post_country'] : '',
172
+					'geo_lat' => isset($request_info['post_latitude']) ? $request_info['post_latitude'] : '',
173
+					'geo_lng' => isset($request_info['post_longitude']) ? $request_info['post_longitude'] : ''
174
+				);
175
+
176
+				$post_location_info = $request_info['post_location'];
177
+
178
+				if ($location_id = geodir_add_new_location($post_location_info)) {
179
+					$post_location_id = $location_id;
180
+				}
181
+			} else {
182
+				$post_location_id = $location_result->location_id;
183
+			}
184
+		} else {
185
+			$post_location_id = $location_result->location_id;
186
+		}
187
+
188
+		if ($dummy) {
189
+			$post_status = 'publish';
190
+		} else {
191
+			$post_status = geodir_new_post_default_status();
192
+		}
193
+
194
+		if (isset($request_info['pid']) && $request_info['pid'] != '') {
195
+			$post_status = get_post_status($request_info['pid']);
196
+		}
226 197
 
227
-        $send_post_submit_mail = false;
198
+		/* fix change of slug on every title edit */
199
+		if (!isset($request_info['post_name'])) {
200
+			$request_info['post_name'] = $request_info['post_title'];
201
+
202
+			if (!empty($request_info['pid'])) {
203
+				$post_info = get_post($request_info['pid']);
204
+
205
+				if (!empty($post_info) && isset($post_info->post_name)) {
206
+					$request_info['post_name'] = $post_info->post_name;
207
+				}
208
+			}
209
+		}
210
+
211
+		$post = array(
212
+			'post_content' => $request_info['post_desc'],
213
+			'post_status' => $post_status,
214
+			'post_title' => $request_info['post_title'],
215
+			'post_name' => $request_info['post_name'],
216
+			'post_type' => $request_info['listing_type']
217
+		);
218
+
219
+		/**
220
+		 * Called before a listing is saved to the database.
221
+		 *
222
+		 * @since 1.0.0
223
+		 * @param object $post The post object.
224
+		 */
225
+		do_action_ref_array('geodir_before_save_listing', $post);
226
+
227
+		$send_post_submit_mail = false;
228
+
229
+		// unhook this function so it doesn't loop infinitely
230
+		remove_action('save_post', 'geodir_post_information_save',10,2);
231
+
232
+		if (isset($request_info['pid']) && $request_info['pid'] != '') {
233
+			$post['ID'] = $request_info['pid'];
234
+
235
+			$last_post_id = wp_update_post($post, $wp_error);
236
+		} else {
237
+			$last_post_id = wp_insert_post($post, $wp_error);
238
+
239
+			if (!$dummy && $last_post_id) {
240
+				$send_post_submit_mail = true; // we move post_submit email from here so the rest of the variables are added to the db first(was breaking permalink in email)
241
+				//geodir_sendEmail('','',$current_user->user_email,$current_user->display_name,'','',$request_info,'post_submit',$last_post_id,$current_user->ID);
242
+			}
243
+		}
228 244
 
229
-        // unhook this function so it doesn't loop infinitely
230
-        remove_action('save_post', 'geodir_post_information_save',10,2);
245
+		if ($wp_error && is_wp_error($last_post_id)) {
246
+			return $last_post_id; // Return WP_Error on save failure.
247
+		}
231 248
 
232
-        if (isset($request_info['pid']) && $request_info['pid'] != '') {
233
-            $post['ID'] = $request_info['pid'];
249
+		if (!$last_post_id) {
250
+			return false; // Save failure.
251
+		}
234 252
 
235
-            $last_post_id = wp_update_post($post, $wp_error);
236
-        } else {
237
-            $last_post_id = wp_insert_post($post, $wp_error);
253
+		// re-hook this function
254
+		add_action('save_post', 'geodir_post_information_save',10,2);
238 255
 
239
-            if (!$dummy && $last_post_id) {
240
-                $send_post_submit_mail = true; // we move post_submit email from here so the rest of the variables are added to the db first(was breaking permalink in email)
241
-                //geodir_sendEmail('','',$current_user->user_email,$current_user->display_name,'','',$request_info,'post_submit',$last_post_id,$current_user->ID);
242
-            }
243
-        }
256
+		$post_tags = '';
257
+		if (!isset($request_info['post_tags'])) {
244 258
 
245
-        if ($wp_error && is_wp_error($last_post_id)) {
246
-            return $last_post_id; // Return WP_Error on save failure.
247
-        }
259
+			$post_type = $request_info['listing_type'];
260
+			$post_tags = implode(",", wp_get_object_terms($last_post_id, $post_type . '_tags', array('fields' => 'names')));
248 261
 
249
-        if (!$last_post_id) {
250
-            return false; // Save failure.
251
-        }
262
+		}
252 263
 
253
-        // re-hook this function
254
-        add_action('save_post', 'geodir_post_information_save',10,2);
264
+		$gd_post_info = array(
265
+			"post_title" => $request_info['post_title'],
266
+			"post_tags" => isset($request_info['post_tags']) ? $request_info['post_tags'] : $post_tags,
267
+			"post_status" => $post_status,
268
+			"post_location_id" => $post_location_id,
269
+			"claimed" => isset($request_info['claimed']) ? $request_info['claimed'] : '',
270
+			"businesses" => isset($request_info['a_businesses']) ? $request_info['a_businesses'] : '',
271
+			"submit_time" => time(),
272
+			"submit_ip" => $_SERVER['REMOTE_ADDR'],
273
+		);
255 274
 
256
-        $post_tags = '';
257
-        if (!isset($request_info['post_tags'])) {
275
+		$payment_info = array();
276
+		$package_info = array();
258 277
 
259
-            $post_type = $request_info['listing_type'];
260
-            $post_tags = implode(",", wp_get_object_terms($last_post_id, $post_type . '_tags', array('fields' => 'names')));
278
+		$package_info = (array)geodir_post_package_info($package_info, $post);
261 279
 
262
-        }
280
+		$post_package_id = geodir_get_post_meta($last_post_id, 'package_id');
263 281
 
264
-        $gd_post_info = array(
265
-            "post_title" => $request_info['post_title'],
266
-            "post_tags" => isset($request_info['post_tags']) ? $request_info['post_tags'] : $post_tags,
267
-            "post_status" => $post_status,
268
-            "post_location_id" => $post_location_id,
269
-            "claimed" => isset($request_info['claimed']) ? $request_info['claimed'] : '',
270
-            "businesses" => isset($request_info['a_businesses']) ? $request_info['a_businesses'] : '',
271
-            "submit_time" => time(),
272
-            "submit_ip" => $_SERVER['REMOTE_ADDR'],
273
-        );
282
+		if (!empty($package_info) && !$post_package_id) {
283
+			if (isset($package_info['days']) && $package_info['days'] != 0) {
284
+				$payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['days'] . " days"));
285
+			} else {
286
+				$payment_info['expire_date'] = 'Never';
287
+			}
274 288
 
275
-        $payment_info = array();
276
-        $package_info = array();
289
+			$payment_info['package_id'] = $package_info['pid'];
290
+			$payment_info['alive_days'] = $package_info['days'];
291
+			$payment_info['is_featured'] = $package_info['is_featured'];
277 292
 
278
-        $package_info = (array)geodir_post_package_info($package_info, $post);
293
+			$gd_post_info = array_merge($gd_post_info, $payment_info);
294
+		}
279 295
 
280
-        $post_package_id = geodir_get_post_meta($last_post_id, 'package_id');
296
+		$custom_metaboxes = geodir_post_custom_fields('', 'all', $request_info['listing_type']);
281 297
 
282
-        if (!empty($package_info) && !$post_package_id) {
283
-            if (isset($package_info['days']) && $package_info['days'] != 0) {
284
-                $payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['days'] . " days"));
285
-            } else {
286
-                $payment_info['expire_date'] = 'Never';
287
-            }
298
+		foreach ($custom_metaboxes as $key => $val):
288 299
 
289
-            $payment_info['package_id'] = $package_info['pid'];
290
-            $payment_info['alive_days'] = $package_info['days'];
291
-            $payment_info['is_featured'] = $package_info['is_featured'];
300
+			$name = $val['name'];
301
+			$type = $val['type'];
302
+			$extrafields = $val['extra_fields'];
292 303
 
293
-            $gd_post_info = array_merge($gd_post_info, $payment_info);
294
-        }
304
+			if (trim($type) == 'address') {
305
+				$prefix = $name . '_';
306
+				$address = $prefix . 'address';
295 307
 
296
-        $custom_metaboxes = geodir_post_custom_fields('', 'all', $request_info['listing_type']);
308
+				if (isset($request_info[$address]) && $request_info[$address] != '') {
309
+					$gd_post_info[$address] = $request_info[$address];
310
+				}
297 311
 
298
-        foreach ($custom_metaboxes as $key => $val):
312
+				if ($extrafields != '') {
313
+					$extrafields = unserialize($extrafields);
299 314
 
300
-            $name = $val['name'];
301
-            $type = $val['type'];
302
-            $extrafields = $val['extra_fields'];
303 315
 
304
-            if (trim($type) == 'address') {
305
-                $prefix = $name . '_';
306
-                $address = $prefix . 'address';
316
+					if (!isset($request_info[$prefix . 'city']) || $request_info[$prefix . 'city'] == '') {
307 317
 
308
-                if (isset($request_info[$address]) && $request_info[$address] != '') {
309
-                    $gd_post_info[$address] = $request_info[$address];
310
-                }
318
+						$location_result = geodir_get_default_location();
311 319
 
312
-                if ($extrafields != '') {
313
-                    $extrafields = unserialize($extrafields);
320
+						$gd_post_info[$prefix . 'city'] = $location_result->city;
321
+						$gd_post_info[$prefix . 'region'] = $location_result->region;
322
+						$gd_post_info[$prefix . 'country'] = $location_result->country;
314 323
 
324
+						$gd_post_info['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // set all overall post location
315 325
 
316
-                    if (!isset($request_info[$prefix . 'city']) || $request_info[$prefix . 'city'] == '') {
326
+					} else {
317 327
 
318
-                        $location_result = geodir_get_default_location();
328
+						$gd_post_info[$prefix . 'city'] = $request_info[$prefix . 'city'];
329
+						$gd_post_info[$prefix . 'region'] = $request_info[$prefix . 'region'];
330
+						$gd_post_info[$prefix . 'country'] = $request_info[$prefix . 'country'];
319 331
 
320
-                        $gd_post_info[$prefix . 'city'] = $location_result->city;
321
-                        $gd_post_info[$prefix . 'region'] = $location_result->region;
322
-                        $gd_post_info[$prefix . 'country'] = $location_result->country;
332
+						//----------set post locations when import dummy data-------
333
+						$location_result = geodir_get_default_location();
323 334
 
324
-                        $gd_post_info['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // set all overall post location
335
+						$gd_post_info['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // set all overall post location
336
+						//-----------------------------------------------------------------
325 337
 
326
-                    } else {
338
+					}
327 339
 
328
-                        $gd_post_info[$prefix . 'city'] = $request_info[$prefix . 'city'];
329
-                        $gd_post_info[$prefix . 'region'] = $request_info[$prefix . 'region'];
330
-                        $gd_post_info[$prefix . 'country'] = $request_info[$prefix . 'country'];
331 340
 
332
-                        //----------set post locations when import dummy data-------
333
-                        $location_result = geodir_get_default_location();
341
+					if (isset($extrafields['show_zip']) && $extrafields['show_zip'] && isset($request_info[$prefix . 'zip'])) {
342
+						$gd_post_info[$prefix . 'zip'] = $request_info[$prefix . 'zip'];
343
+					}
334 344
 
335
-                        $gd_post_info['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // set all overall post location
336
-                        //-----------------------------------------------------------------
337 345
 
338
-                    }
346
+					if (isset($extrafields['show_map']) && $extrafields['show_map']) {
339 347
 
348
+						if (isset($request_info[$prefix . 'latitude']) && $request_info[$prefix . 'latitude'] != '') {
349
+							$gd_post_info[$prefix . 'latitude'] = $request_info[$prefix . 'latitude'];
350
+						}
340 351
 
341
-                    if (isset($extrafields['show_zip']) && $extrafields['show_zip'] && isset($request_info[$prefix . 'zip'])) {
342
-                        $gd_post_info[$prefix . 'zip'] = $request_info[$prefix . 'zip'];
343
-                    }
352
+						if (isset($request_info[$prefix . 'longitude']) && $request_info[$prefix . 'longitude'] != '') {
353
+							$gd_post_info[$prefix . 'longitude'] = $request_info[$prefix . 'longitude'];
354
+						}
344 355
 
356
+						if (isset($request_info[$prefix . 'mapview']) && $request_info[$prefix . 'mapview'] != '') {
357
+							$gd_post_info[$prefix . 'mapview'] = $request_info[$prefix . 'mapview'];
358
+						}
345 359
 
346
-                    if (isset($extrafields['show_map']) && $extrafields['show_map']) {
360
+						if (isset($request_info[$prefix . 'mapzoom']) && $request_info[$prefix . 'mapzoom'] != '') {
361
+							$gd_post_info[$prefix . 'mapzoom'] = $request_info[$prefix . 'mapzoom'];
362
+						}
347 363
 
348
-                        if (isset($request_info[$prefix . 'latitude']) && $request_info[$prefix . 'latitude'] != '') {
349
-                            $gd_post_info[$prefix . 'latitude'] = $request_info[$prefix . 'latitude'];
350
-                        }
364
+					}
351 365
 
352
-                        if (isset($request_info[$prefix . 'longitude']) && $request_info[$prefix . 'longitude'] != '') {
353
-                            $gd_post_info[$prefix . 'longitude'] = $request_info[$prefix . 'longitude'];
354
-                        }
366
+					// show lat lng
367
+					if (isset($extrafields['show_latlng']) && $extrafields['show_latlng'] && isset($request_info[$prefix . 'latlng'])) {
368
+						$gd_post_info[$prefix . 'latlng'] = $request_info[$prefix . 'latlng'];
369
+					}
370
+				}
355 371
 
356
-                        if (isset($request_info[$prefix . 'mapview']) && $request_info[$prefix . 'mapview'] != '') {
357
-                            $gd_post_info[$prefix . 'mapview'] = $request_info[$prefix . 'mapview'];
358
-                        }
372
+			} elseif (trim($type) == 'file') {
373
+				if (isset($request_info[$name])) {
374
+					$request_files = array();
375
+					if ($request_info[$name] != '')
376
+						$request_files = explode(",", $request_info[$name]);
359 377
 
360
-                        if (isset($request_info[$prefix . 'mapzoom']) && $request_info[$prefix . 'mapzoom'] != '') {
361
-                            $gd_post_info[$prefix . 'mapzoom'] = $request_info[$prefix . 'mapzoom'];
362
-                        }
378
+					$extrafields = $extrafields != '' ? maybe_unserialize($extrafields) : NULL;
379
+					geodir_save_post_file_fields($last_post_id, $name, $request_files, $extrafields);
363 380
 
364
-                    }
381
+				}
382
+			} elseif (trim($type) == 'datepicker') {
383
+				$datetime = '';
384
+				if (isset($request_info[$name]) && $request_info[$name] != '') {
385
+					$date_format = geodir_default_date_format();
386
+					if (isset($val['extra_fields']) && $val['extra_fields'] != '') {
387
+						$extra_fields = unserialize($val['extra_fields']);
388
+						$date_format = isset($extra_fields['date_format']) && $extra_fields['date_format'] != '' ? $extra_fields['date_format'] : $date_format;
389
+					}
365 390
 
366
-                    // show lat lng
367
-                    if (isset($extrafields['show_latlng']) && $extrafields['show_latlng'] && isset($request_info[$prefix . 'latlng'])) {
368
-                        $gd_post_info[$prefix . 'latlng'] = $request_info[$prefix . 'latlng'];
369
-                    }
370
-                }
391
+					$search = array('dd', 'mm', 'yy');
392
+					$replace = array('d', 'm', 'Y');
371 393
 
372
-            } elseif (trim($type) == 'file') {
373
-                if (isset($request_info[$name])) {
374
-                    $request_files = array();
375
-                    if ($request_info[$name] != '')
376
-                        $request_files = explode(",", $request_info[$name]);
394
+					$date_format = str_replace($search, $replace, $date_format);
377 395
 
378
-                    $extrafields = $extrafields != '' ? maybe_unserialize($extrafields) : NULL;
379
-                    geodir_save_post_file_fields($last_post_id, $name, $request_files, $extrafields);
396
+					$post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $request_info[$name]) : $request_info[$name]; // PHP doesn't work well with dd/mm/yyyy format
380 397
 
381
-                }
382
-            } elseif (trim($type) == 'datepicker') {
383
-                $datetime = '';
384
-                if (isset($request_info[$name]) && $request_info[$name] != '') {
385
-                    $date_format = geodir_default_date_format();
386
-                    if (isset($val['extra_fields']) && $val['extra_fields'] != '') {
387
-                        $extra_fields = unserialize($val['extra_fields']);
388
-                        $date_format = isset($extra_fields['date_format']) && $extra_fields['date_format'] != '' ? $extra_fields['date_format'] : $date_format;
389
-                    }
398
+					$datetime = date("Y-m-d", strtotime($post_htmlvar_value));
399
+				}
400
+				$gd_post_info[$name] = $datetime;
401
+			} else if ($type == 'multiselect') {
402
+				if (isset($request_info[$name])) {
403
+					$gd_post_info[$name] = $request_info[$name];
404
+				} else {
405
+					if (isset($request_info['gd_field_' . $name])) {
406
+						$gd_post_info[$name] = ''; /* fix de-select for multiselect */
407
+					}
408
+				}
409
+			} else if (isset($request_info[$name])) {
410
+				$gd_post_info[$name] = $request_info[$name];
411
+			}
390 412
 
391
-                    $search = array('dd', 'mm', 'yy');
392
-                    $replace = array('d', 'm', 'Y');
413
+		endforeach;
393 414
 
394
-                    $date_format = str_replace($search, $replace, $date_format);
415
+		if (isset($request_info['post_dummy']) && $request_info['post_dummy'] != '') {
416
+			$gd_post_info['post_dummy'] = $request_info['post_dummy'];
417
+		}
395 418
 
396
-                    $post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $request_info[$name]) : $request_info[$name]; // PHP doesn't work well with dd/mm/yyyy format
419
+		// Save post detail info in detail table
420
+		if (!empty($gd_post_info)) {
421
+			geodir_save_post_info($last_post_id, $gd_post_info);
422
+		}
397 423
 
398
-                    $datetime = date("Y-m-d", strtotime($post_htmlvar_value));
399
-                }
400
-                $gd_post_info[$name] = $datetime;
401
-            } else if ($type == 'multiselect') {
402
-                if (isset($request_info[$name])) {
403
-                    $gd_post_info[$name] = $request_info[$name];
404
-                } else {
405
-                    if (isset($request_info['gd_field_' . $name])) {
406
-                        $gd_post_info[$name] = ''; /* fix de-select for multiselect */
407
-                    }
408
-                }
409
-            } else if (isset($request_info[$name])) {
410
-                $gd_post_info[$name] = $request_info[$name];
411
-            }
412 424
 
413
-        endforeach;
425
+		// Set categories to the listing
426
+		if (isset($request_info['post_category']) && !empty($request_info['post_category'])) {
427
+			$post_category = array();
414 428
 
415
-        if (isset($request_info['post_dummy']) && $request_info['post_dummy'] != '') {
416
-            $gd_post_info['post_dummy'] = $request_info['post_dummy'];
417
-        }
429
+			foreach ($request_info['post_category'] as $taxonomy => $cat) {
418 430
 
419
-        // Save post detail info in detail table
420
-        if (!empty($gd_post_info)) {
421
-            geodir_save_post_info($last_post_id, $gd_post_info);
422
-        }
431
+				if ($dummy)
432
+					$post_category = $cat;
433
+				else {
423 434
 
435
+					if (!is_array($cat) && strstr($cat, ','))
436
+						$cat = explode(',', $cat);
424 437
 
425
-        // Set categories to the listing
426
-        if (isset($request_info['post_category']) && !empty($request_info['post_category'])) {
427
-            $post_category = array();
438
+					if (!empty($cat) && is_array($cat))
439
+						$post_category = array_map('intval', $cat);
440
+				}
428 441
 
429
-            foreach ($request_info['post_category'] as $taxonomy => $cat) {
442
+				wp_set_object_terms($last_post_id, $post_category, $taxonomy);
443
+			}
430 444
 
431
-                if ($dummy)
432
-                    $post_category = $cat;
433
-                else {
445
+			$post_default_category = isset($request_info['post_default_category']) ? $request_info['post_default_category'] : '';
434 446
 
435
-                    if (!is_array($cat) && strstr($cat, ','))
436
-                        $cat = explode(',', $cat);
447
+			$post_category_str = isset($request_info['post_category_str']) ? $request_info['post_category_str'] : '';
448
+			geodir_set_postcat_structure($last_post_id, $taxonomy, $post_default_category, $post_category_str);
437 449
 
438
-                    if (!empty($cat) && is_array($cat))
439
-                        $post_category = array_map('intval', $cat);
440
-                }
450
+		}
441 451
 
442
-                wp_set_object_terms($last_post_id, $post_category, $taxonomy);
443
-            }
452
+		$post_tags = '';
453
+		// Set tags to the listing
454
+		if (isset($request_info['post_tags']) && !is_array($request_info['post_tags']) && !empty($request_info['post_tags'])) {
455
+			$post_tags = explode(",", $request_info['post_tags']);
456
+		} elseif (isset($request_info['post_tags']) && is_array($request_info['post_tags'])) {
457
+			if ($dummy)
458
+				$post_tags = $request_info['post_tags'];
459
+		} else {
460
+			if ($dummy)
461
+				$post_tags = array($request_info['post_title']);
462
+		}
444 463
 
445
-            $post_default_category = isset($request_info['post_default_category']) ? $request_info['post_default_category'] : '';
464
+		if (is_array($post_tags)) {
465
+			$taxonomy = $request_info['listing_type'] . '_tags';
466
+			wp_set_object_terms($last_post_id, $post_tags, $taxonomy);
467
+		}
446 468
 
447
-            $post_category_str = isset($request_info['post_category_str']) ? $request_info['post_category_str'] : '';
448
-            geodir_set_postcat_structure($last_post_id, $taxonomy, $post_default_category, $post_category_str);
449
-
450
-        }
451 469
 
452
-        $post_tags = '';
453
-        // Set tags to the listing
454
-        if (isset($request_info['post_tags']) && !is_array($request_info['post_tags']) && !empty($request_info['post_tags'])) {
455
-            $post_tags = explode(",", $request_info['post_tags']);
456
-        } elseif (isset($request_info['post_tags']) && is_array($request_info['post_tags'])) {
457
-            if ($dummy)
458
-                $post_tags = $request_info['post_tags'];
459
-        } else {
460
-            if ($dummy)
461
-                $post_tags = array($request_info['post_title']);
462
-        }
470
+		// Insert attechment
463 471
 
464
-        if (is_array($post_tags)) {
465
-            $taxonomy = $request_info['listing_type'] . '_tags';
466
-            wp_set_object_terms($last_post_id, $post_tags, $taxonomy);
467
-        }
468
-
469
-
470
-        // Insert attechment
472
+		if (isset($request_info['post_images']) && !is_wp_error($last_post_id)) {
473
+			if (!$dummy) {
474
+				$tmpimgArr = trim($request_info['post_images'], ",");
475
+				$tmpimgArr = explode(",", $tmpimgArr);
476
+				geodir_save_post_images($last_post_id, $tmpimgArr, $dummy);
477
+			} else{
478
+				geodir_save_post_images($last_post_id, $request_info['post_images'], $dummy);
479
+			}
471 480
 
472
-        if (isset($request_info['post_images']) && !is_wp_error($last_post_id)) {
473
-            if (!$dummy) {
474
-                $tmpimgArr = trim($request_info['post_images'], ",");
475
-                $tmpimgArr = explode(",", $tmpimgArr);
476
-                geodir_save_post_images($last_post_id, $tmpimgArr, $dummy);
477
-            } else{
478
-                geodir_save_post_images($last_post_id, $request_info['post_images'], $dummy);
479
-            }
480 481
 
482
+		} elseif (!isset($request_info['post_images']) || $request_info['post_images'] == '') {
481 483
 
482
-        } elseif (!isset($request_info['post_images']) || $request_info['post_images'] == '') {
483
-
484
-            /* Delete Attachments
484
+			/* Delete Attachments
485 485
 			$postcurr_images = geodir_get_images($last_post_id);
486 486
 
487 487
 			$wpdb->query(
@@ -497,34 +497,34 @@  discard block
 block discarded – undo
497 497
 			geodir_save_post_info($last_post_id, $gd_post_featured_img);
498 498
 			*/
499 499
 
500
-        }
500
+		}
501 501
 
502
-        geodir_remove_temp_images();
503
-        geodir_set_wp_featured_image($last_post_id);
502
+		geodir_remove_temp_images();
503
+		geodir_set_wp_featured_image($last_post_id);
504 504
 
505
-        /**
506
-         * Called after a listing is saved to the database and before any email have been sent.
507
-         *
508
-         * @since 1.0.0
509
-         * @param int $last_post_id The saved post ID.
510
-         * @param array $request_info The post details in an array.
511
-         * @see 'geodir_after_save_listinginfo'
512
-         */
513
-        do_action('geodir_after_save_listing', $last_post_id, $request_info);
505
+		/**
506
+		 * Called after a listing is saved to the database and before any email have been sent.
507
+		 *
508
+		 * @since 1.0.0
509
+		 * @param int $last_post_id The saved post ID.
510
+		 * @param array $request_info The post details in an array.
511
+		 * @see 'geodir_after_save_listinginfo'
512
+		 */
513
+		do_action('geodir_after_save_listing', $last_post_id, $request_info);
514 514
 
515
-        //die;
515
+		//die;
516 516
 
517
-        if ($send_post_submit_mail) { // if new post send out email
518
-            $to_name = geodir_get_client_name($current_user->ID);
519
-            geodir_sendEmail('', '', $current_user->user_email, $to_name, '', '', $request_info, 'post_submit', $last_post_id, $current_user->ID);
520
-        }
521
-        /*
517
+		if ($send_post_submit_mail) { // if new post send out email
518
+			$to_name = geodir_get_client_name($current_user->ID);
519
+			geodir_sendEmail('', '', $current_user->user_email, $to_name, '', '', $request_info, 'post_submit', $last_post_id, $current_user->ID);
520
+		}
521
+		/*
522 522
          * Unset the session so we don't loop.
523 523
          */
524
-        $gd_session->un_set('listing');
525
-        return $last_post_id;
524
+		$gd_session->un_set('listing');
525
+		return $last_post_id;
526 526
 
527
-    }
527
+	}
528 528
 
529 529
 }
530 530
 
@@ -543,586 +543,586 @@  discard block
 block discarded – undo
543 543
 function geodir_get_post_info($post_id = '')
544 544
 {
545 545
 
546
-    global $wpdb, $plugin_prefix, $post, $post_info;
546
+	global $wpdb, $plugin_prefix, $post, $post_info;
547 547
 
548
-    if ($post_id == '' && !empty($post))
549
-        $post_id = $post->ID;
548
+	if ($post_id == '' && !empty($post))
549
+		$post_id = $post->ID;
550 550
 
551
-    $post_type = get_post_type($post_id);
551
+	$post_type = get_post_type($post_id);
552 552
 
553
-    $all_postypes = geodir_get_posttypes();
553
+	$all_postypes = geodir_get_posttypes();
554 554
 
555
-    if (!in_array($post_type, $all_postypes))
556
-        return false;
555
+	if (!in_array($post_type, $all_postypes))
556
+		return false;
557 557
 
558
-    $table = $plugin_prefix . $post_type . '_detail';
558
+	$table = $plugin_prefix . $post_type . '_detail';
559 559
 
560
-    /**
561
-     * Apply Filter to change Post info
562
-     *
563
-     * You can use this filter to change Post info.
564
-     *
565
-     * @since 1.0.0
566
-     * @package GeoDirectory
567
-     */
568
-    $query = apply_filters('geodir_post_info_query', "SELECT p.*,pd.* FROM " . $wpdb->posts . " p," . $table . " pd
560
+	/**
561
+	 * Apply Filter to change Post info
562
+	 *
563
+	 * You can use this filter to change Post info.
564
+	 *
565
+	 * @since 1.0.0
566
+	 * @package GeoDirectory
567
+	 */
568
+	$query = apply_filters('geodir_post_info_query', "SELECT p.*,pd.* FROM " . $wpdb->posts . " p," . $table . " pd
569 569
 			  WHERE p.ID = pd.post_id
570 570
 			  AND post_id = " . $post_id);
571 571
 
572
-    $post_detail = $wpdb->get_row($query);
572
+	$post_detail = $wpdb->get_row($query);
573 573
 
574
-    return (!empty($post_detail)) ? $post_info = $post_detail : $post_info = false;
574
+	return (!empty($post_detail)) ? $post_info = $post_detail : $post_info = false;
575 575
 
576 576
 }
577 577
 
578 578
 
579 579
 if (!function_exists('geodir_save_post_info')) {
580
-    /**
581
-     * Saves post detail info in detail table.
582
-     *
583
-     * @since 1.0.0
584
-     * @package GeoDirectory
585
-     * @global object $wpdb WordPress Database object.
586
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
587
-     * @param int $post_id The post ID.
588
-     * @param array $postinfo_array {
589
-     *    Post info that needs to be saved in detail table.
590
-     *
591
-     *    @type string $post_title              Listing title.
592
-     *    @type string $post_tags               Listing tags.
593
-     *    @type string $post_status             Listing post status.
594
-     *    @type string $post_location_id        Listing location ID.
595
-     *    @type string $claimed                 Todo Desc needed.
596
-     *    @type string $businesses              Todo Desc needed.
597
-     *    @type int    $submit_time             Submitted time in unix timestamp.
598
-     *    @type string $submit_ip               Submitted IP.
599
-     *    @type string $expire_date             Listing expiration date.
600
-     *    @type int    $package_id              Listing package ID.
601
-     *    @type int    $alive_days              Todo Desc needed.
602
-     *    @type int    $is_featured             Is this a featured listing?.
603
-     *    @type string $post_address            Listing address.
604
-     *    @type string $post_city               Listing city.
605
-     *    @type string $post_region             Listing region.
606
-     *    @type string $post_country            Listing country.
607
-     *    @type string $post_locations          Listing locations.
608
-     *    @type string $post_zip                Listing zip.
609
-     *    @type string $post_latitude           Listing latitude.
610
-     *    @type string $post_longitude          Listing longitude.
611
-     *    @type string $post_mapview            Listing mapview. Default "ROADMAP".
612
-     *    @type string $post_mapzoom            Listing mapzoom Default "9".
613
-     *    @type string $geodir_timing           Business timing info.
614
-     *    @type string $geodir_contact          Contact number.
615
-     *    @type string $geodir_email            Business contact email.
616
-     *    @type string $geodir_website          Business website.
617
-     *    @type string $geodir_twitter          Twitter link.
618
-     *    @type string $geodir_facebook         Facebook link.
619
-     *    @type string $geodir_video            Video link.
620
-     *    @type string $geodir_special_offers   Speacial offers.
621
-     *
622
-     * }
623
-     * @return bool
624
-     */
625
-    function geodir_save_post_info($post_id, $postinfo_array = array())
626
-    {
627
-        global $wpdb, $plugin_prefix;
628
-
629
-        $post_type = get_post_type($post_id);
630
-
631
-        $table = $plugin_prefix . $post_type . '_detail';
632
-
633
-        /**
634
-         * Filter to change Post info
635
-         *
636
-         * You can use this filter to change Post info.
637
-         *
638
-         * @since 1.0.0
639
-         * @package GeoDirectory
640
-         * @param array $postinfo_array See {@see geodir_save_post_info()} for accepted args.
641
-         * @param int $post_id The post ID.
642
-         */
580
+	/**
581
+	 * Saves post detail info in detail table.
582
+	 *
583
+	 * @since 1.0.0
584
+	 * @package GeoDirectory
585
+	 * @global object $wpdb WordPress Database object.
586
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
587
+	 * @param int $post_id The post ID.
588
+	 * @param array $postinfo_array {
589
+	 *    Post info that needs to be saved in detail table.
590
+	 *
591
+	 *    @type string $post_title              Listing title.
592
+	 *    @type string $post_tags               Listing tags.
593
+	 *    @type string $post_status             Listing post status.
594
+	 *    @type string $post_location_id        Listing location ID.
595
+	 *    @type string $claimed                 Todo Desc needed.
596
+	 *    @type string $businesses              Todo Desc needed.
597
+	 *    @type int    $submit_time             Submitted time in unix timestamp.
598
+	 *    @type string $submit_ip               Submitted IP.
599
+	 *    @type string $expire_date             Listing expiration date.
600
+	 *    @type int    $package_id              Listing package ID.
601
+	 *    @type int    $alive_days              Todo Desc needed.
602
+	 *    @type int    $is_featured             Is this a featured listing?.
603
+	 *    @type string $post_address            Listing address.
604
+	 *    @type string $post_city               Listing city.
605
+	 *    @type string $post_region             Listing region.
606
+	 *    @type string $post_country            Listing country.
607
+	 *    @type string $post_locations          Listing locations.
608
+	 *    @type string $post_zip                Listing zip.
609
+	 *    @type string $post_latitude           Listing latitude.
610
+	 *    @type string $post_longitude          Listing longitude.
611
+	 *    @type string $post_mapview            Listing mapview. Default "ROADMAP".
612
+	 *    @type string $post_mapzoom            Listing mapzoom Default "9".
613
+	 *    @type string $geodir_timing           Business timing info.
614
+	 *    @type string $geodir_contact          Contact number.
615
+	 *    @type string $geodir_email            Business contact email.
616
+	 *    @type string $geodir_website          Business website.
617
+	 *    @type string $geodir_twitter          Twitter link.
618
+	 *    @type string $geodir_facebook         Facebook link.
619
+	 *    @type string $geodir_video            Video link.
620
+	 *    @type string $geodir_special_offers   Speacial offers.
621
+	 *
622
+	 * }
623
+	 * @return bool
624
+	 */
625
+	function geodir_save_post_info($post_id, $postinfo_array = array())
626
+	{
627
+		global $wpdb, $plugin_prefix;
628
+
629
+		$post_type = get_post_type($post_id);
630
+
631
+		$table = $plugin_prefix . $post_type . '_detail';
632
+
633
+		/**
634
+		 * Filter to change Post info
635
+		 *
636
+		 * You can use this filter to change Post info.
637
+		 *
638
+		 * @since 1.0.0
639
+		 * @package GeoDirectory
640
+		 * @param array $postinfo_array See {@see geodir_save_post_info()} for accepted args.
641
+		 * @param int $post_id The post ID.
642
+		 */
643
+
644
+		$postmeta = apply_filters('geodir_listinginfo_request', $postinfo_array, $post_id);
645
+
646
+		if (!empty($postmeta) && $post_id) {
647
+			$post_meta_set_query = '';
648
+
649
+			foreach ($postmeta as $mkey => $mval) {
650
+				if (geodir_column_exist($table, $mkey)) {
651
+					if (is_array($mval)) {
652
+						$mval = implode(",", $mval);
653
+					}
654
+
655
+					$post_meta_set_query .= $mkey . " = '" . $mval . "', ";
656
+				}
657
+			}
643 658
 
644
-        $postmeta = apply_filters('geodir_listinginfo_request', $postinfo_array, $post_id);
659
+			$post_meta_set_query = trim($post_meta_set_query, ", ");
645 660
 
646
-        if (!empty($postmeta) && $post_id) {
647
-            $post_meta_set_query = '';
661
+			$post_meta_set_query = str_replace('%', '%%', $post_meta_set_query);// escape %
648 662
 
649
-            foreach ($postmeta as $mkey => $mval) {
650
-                if (geodir_column_exist($table, $mkey)) {
651
-                    if (is_array($mval)) {
652
-                        $mval = implode(",", $mval);
653
-                    }
663
+			/**
664
+			 * Called before saving the listing info.
665
+			 *
666
+			 * @since 1.0.0
667
+			 * @package GeoDirectory
668
+			 * @param array $postinfo_array See {@see geodir_save_post_info()} for accepted args.
669
+			 * @param int $post_id The post ID.
670
+			 */
671
+			do_action('geodir_before_save_listinginfo', $postinfo_array, $post_id);
654 672
 
655
-                    $post_meta_set_query .= $mkey . " = '" . $mval . "', ";
656
-                }
657
-            }
673
+			if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
658 674
 
659
-            $post_meta_set_query = trim($post_meta_set_query, ", ");
675
+				$wpdb->query(
676
+					$wpdb->prepare(
677
+						"UPDATE " . $table . " SET " . $post_meta_set_query . " where post_id =%d",
678
+						array($post_id)
679
+					)
680
+				);
660 681
 
661
-            $post_meta_set_query = str_replace('%', '%%', $post_meta_set_query);// escape %
662 682
 
663
-            /**
664
-             * Called before saving the listing info.
665
-             *
666
-             * @since 1.0.0
667
-             * @package GeoDirectory
668
-             * @param array $postinfo_array See {@see geodir_save_post_info()} for accepted args.
669
-             * @param int $post_id The post ID.
670
-             */
671
-            do_action('geodir_before_save_listinginfo', $postinfo_array, $post_id);
683
+			} else {
672 684
 
673
-            if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
685
+				$wpdb->query(
686
+					$wpdb->prepare(
687
+						"INSERT INTO " . $table . " SET post_id = %d," . $post_meta_set_query,
688
+						array($post_id)
689
+					)
690
+				);
674 691
 
675
-                $wpdb->query(
676
-                    $wpdb->prepare(
677
-                        "UPDATE " . $table . " SET " . $post_meta_set_query . " where post_id =%d",
678
-                        array($post_id)
679
-                    )
680
-                );
692
+			}
681 693
 
694
+			/**
695
+			 * Called after saving the listing info.
696
+			 *
697
+			 * @since 1.0.0
698
+			 * @package GeoDirectory
699
+			 * @param array $postinfo_array Post info that needs to be saved in detail table.
700
+			 * @param int $post_id The post ID.
701
+			 * @see 'geodir_after_save_listing'
702
+			 */
703
+			do_action('geodir_after_save_listinginfo', $postinfo_array, $post_id);
704
+
705
+			return true;
706
+		} else
707
+			return false;
682 708
 
683
-            } else {
709
+	}
710
+}
684 711
 
685
-                $wpdb->query(
686
-                    $wpdb->prepare(
687
-                        "INSERT INTO " . $table . " SET post_id = %d," . $post_meta_set_query,
688
-                        array($post_id)
689
-                    )
690
-                );
691 712
 
692
-            }
713
+if (!function_exists('geodir_save_post_meta')) {
714
+	/**
715
+	 * Save or update post custom fields.
716
+	 *
717
+	 * @since 1.0.0
718
+	 * @package GeoDirectory
719
+	 * @global object $wpdb WordPress Database object.
720
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
721
+	 * @param int $post_id The post ID.
722
+	 * @param string $postmeta Detail table column name.
723
+	 * @param string $meta_value Detail table column value.
724
+	 * @return void|bool
725
+	 */
726
+	function geodir_save_post_meta($post_id, $postmeta = '', $meta_value = '')
727
+	{
728
+
729
+		global $wpdb, $plugin_prefix;
730
+
731
+		$post_type = get_post_type($post_id);
732
+
733
+		$table = $plugin_prefix . $post_type . '_detail';
734
+
735
+		if ($postmeta != '' && geodir_column_exist($table, $postmeta) && $post_id) {
736
+
737
+			if (is_array($meta_value)) {
738
+				$meta_value = implode(",", $meta_value);
739
+			}
693 740
 
694
-            /**
695
-             * Called after saving the listing info.
696
-             *
697
-             * @since 1.0.0
698
-             * @package GeoDirectory
699
-             * @param array $postinfo_array Post info that needs to be saved in detail table.
700
-             * @param int $post_id The post ID.
701
-             * @see 'geodir_after_save_listing'
702
-             */
703
-            do_action('geodir_after_save_listinginfo', $postinfo_array, $post_id);
741
+			if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
704 742
 
705
-            return true;
706
-        } else
707
-            return false;
743
+				$wpdb->query(
744
+					$wpdb->prepare(
745
+						"UPDATE " . $table . " SET " . $postmeta . " = '" . $meta_value . "' where post_id =%d",
746
+						array($post_id)
747
+					)
748
+				);
708 749
 
709
-    }
710
-}
750
+			} else {
711 751
 
752
+				$wpdb->query(
753
+					$wpdb->prepare(
754
+						"INSERT INTO " . $table . " SET post_id = %d, " . $postmeta . " = '" . $meta_value . "'",
755
+						array($post_id)
756
+					)
757
+				);
758
+			}
712 759
 
713
-if (!function_exists('geodir_save_post_meta')) {
714
-    /**
715
-     * Save or update post custom fields.
716
-     *
717
-     * @since 1.0.0
718
-     * @package GeoDirectory
719
-     * @global object $wpdb WordPress Database object.
720
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
721
-     * @param int $post_id The post ID.
722
-     * @param string $postmeta Detail table column name.
723
-     * @param string $meta_value Detail table column value.
724
-     * @return void|bool
725
-     */
726
-    function geodir_save_post_meta($post_id, $postmeta = '', $meta_value = '')
727
-    {
728
-
729
-        global $wpdb, $plugin_prefix;
730
-
731
-        $post_type = get_post_type($post_id);
732
-
733
-        $table = $plugin_prefix . $post_type . '_detail';
734
-
735
-        if ($postmeta != '' && geodir_column_exist($table, $postmeta) && $post_id) {
736
-
737
-            if (is_array($meta_value)) {
738
-                $meta_value = implode(",", $meta_value);
739
-            }
740
-
741
-            if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
742
-
743
-                $wpdb->query(
744
-                    $wpdb->prepare(
745
-                        "UPDATE " . $table . " SET " . $postmeta . " = '" . $meta_value . "' where post_id =%d",
746
-                        array($post_id)
747
-                    )
748
-                );
749
-
750
-            } else {
751
-
752
-                $wpdb->query(
753
-                    $wpdb->prepare(
754
-                        "INSERT INTO " . $table . " SET post_id = %d, " . $postmeta . " = '" . $meta_value . "'",
755
-                        array($post_id)
756
-                    )
757
-                );
758
-            }
759
-
760
-
761
-        } else
762
-            return false;
763
-    }
760
+
761
+		} else
762
+			return false;
763
+	}
764 764
 }
765 765
 
766 766
 if (!function_exists('geodir_delete_post_meta')) {
767
-    /**
768
-     * Delete post custom fields.
769
-     *
770
-     * @since 1.0.0
771
-     * @package GeoDirectory
772
-     * @global object $wpdb WordPress Database object.
773
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
774
-     * @param int $post_id The post ID.
775
-     * @param string $postmeta Detail table column name.
776
-     * @todo check if this is depreciated
777
-     * @todo Fix unknown variable mval
778
-     * @return bool
779
-     */
780
-    function geodir_delete_post_meta($post_id, $postmeta)
781
-    {
782
-
783
-        global $wpdb, $plugin_prefix;
784
-
785
-        $post_type = get_post_type($post_id);
786
-
787
-        $table = $plugin_prefix . $post_type . '_detail';
788
-
789
-        if (is_array($postmeta) && !empty($postmeta) && $post_id) {
790
-            $post_meta_set_query = '';
791
-
792
-            foreach ($postmeta as $mkey) {
793
-                if ($mval != '')
794
-                    $post_meta_set_query .= $mkey . " = '', ";
795
-            }
796
-
797
-            $post_meta_set_query = trim($post_meta_set_query, ", ");
798
-
799
-            if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $postmeta . "'") != '') {
800
-
801
-                $wpdb->query(
802
-                    $wpdb->prepare(
803
-                        "UPDATE " . $table . " SET " . $post_meta_set_query . " where post_id = %d",
804
-                        array($post_id)
805
-                    )
806
-                );
807
-
808
-                return true;
809
-            }
810
-
811
-        } elseif ($postmeta != '' && $post_id) {
812
-            if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $postmeta . "'") != '') {
813
-
814
-                $wpdb->query(
815
-                    $wpdb->prepare(
816
-                        "UPDATE " . $table . " SET " . $postmeta . "= '' where post_id = %d",
817
-                        array($post_id)
818
-                    )
819
-                );
820
-
821
-                return true;
822
-            }
823
-
824
-        } else
825
-            return false;
826
-    }
767
+	/**
768
+	 * Delete post custom fields.
769
+	 *
770
+	 * @since 1.0.0
771
+	 * @package GeoDirectory
772
+	 * @global object $wpdb WordPress Database object.
773
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
774
+	 * @param int $post_id The post ID.
775
+	 * @param string $postmeta Detail table column name.
776
+	 * @todo check if this is depreciated
777
+	 * @todo Fix unknown variable mval
778
+	 * @return bool
779
+	 */
780
+	function geodir_delete_post_meta($post_id, $postmeta)
781
+	{
782
+
783
+		global $wpdb, $plugin_prefix;
784
+
785
+		$post_type = get_post_type($post_id);
786
+
787
+		$table = $plugin_prefix . $post_type . '_detail';
788
+
789
+		if (is_array($postmeta) && !empty($postmeta) && $post_id) {
790
+			$post_meta_set_query = '';
791
+
792
+			foreach ($postmeta as $mkey) {
793
+				if ($mval != '')
794
+					$post_meta_set_query .= $mkey . " = '', ";
795
+			}
796
+
797
+			$post_meta_set_query = trim($post_meta_set_query, ", ");
798
+
799
+			if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $postmeta . "'") != '') {
800
+
801
+				$wpdb->query(
802
+					$wpdb->prepare(
803
+						"UPDATE " . $table . " SET " . $post_meta_set_query . " where post_id = %d",
804
+						array($post_id)
805
+					)
806
+				);
807
+
808
+				return true;
809
+			}
810
+
811
+		} elseif ($postmeta != '' && $post_id) {
812
+			if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $postmeta . "'") != '') {
813
+
814
+				$wpdb->query(
815
+					$wpdb->prepare(
816
+						"UPDATE " . $table . " SET " . $postmeta . "= '' where post_id = %d",
817
+						array($post_id)
818
+					)
819
+				);
820
+
821
+				return true;
822
+			}
823
+
824
+		} else
825
+			return false;
826
+	}
827 827
 }
828 828
 
829 829
 
830 830
 if (!function_exists('geodir_get_post_meta')) {
831
-    /**
832
-     * Get post custom meta.
833
-     *
834
-     * @since 1.0.0
835
-     * @package GeoDirectory
836
-     * @global object $wpdb WordPress Database object.
837
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
838
-     * @param int $post_id The post ID.
839
-     * @param string $meta_key The meta key to retrieve.
840
-     * @param bool $single Optional. Whether to return a single value. Default false.
841
-     * @todo single variable not yet implemented.
842
-     * @return bool|mixed|null|string Will be an array if $single is false. Will be value of meta data field if $single is true.
843
-     */
844
-    function geodir_get_post_meta($post_id, $meta_key, $single = false)
845
-    {
846
-        if (!$post_id) {
847
-            return false;
848
-        }
849
-        global $wpdb, $plugin_prefix;
850
-
851
-        $all_postypes = geodir_get_posttypes();
852
-
853
-        $post_type = get_post_type($post_id);
854
-
855
-        if (!in_array($post_type, $all_postypes))
856
-            return false;
857
-
858
-        $table = $plugin_prefix . $post_type . '_detail';
859
-
860
-        if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $meta_key . "'") != '') {
861
-
862
-            if ($meta_value = $wpdb->get_var($wpdb->prepare("SELECT " . $meta_key . " from " . $table . " where post_id = %d", array($post_id)))) {
863
-                $meta_value = maybe_serialize($meta_value);
864
-                return $meta_value;
865
-            } else
866
-                return false;
867
-
868
-        } else
869
-            return false;
870
-    }
831
+	/**
832
+	 * Get post custom meta.
833
+	 *
834
+	 * @since 1.0.0
835
+	 * @package GeoDirectory
836
+	 * @global object $wpdb WordPress Database object.
837
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
838
+	 * @param int $post_id The post ID.
839
+	 * @param string $meta_key The meta key to retrieve.
840
+	 * @param bool $single Optional. Whether to return a single value. Default false.
841
+	 * @todo single variable not yet implemented.
842
+	 * @return bool|mixed|null|string Will be an array if $single is false. Will be value of meta data field if $single is true.
843
+	 */
844
+	function geodir_get_post_meta($post_id, $meta_key, $single = false)
845
+	{
846
+		if (!$post_id) {
847
+			return false;
848
+		}
849
+		global $wpdb, $plugin_prefix;
850
+
851
+		$all_postypes = geodir_get_posttypes();
852
+
853
+		$post_type = get_post_type($post_id);
854
+
855
+		if (!in_array($post_type, $all_postypes))
856
+			return false;
857
+
858
+		$table = $plugin_prefix . $post_type . '_detail';
859
+
860
+		if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $meta_key . "'") != '') {
861
+
862
+			if ($meta_value = $wpdb->get_var($wpdb->prepare("SELECT " . $meta_key . " from " . $table . " where post_id = %d", array($post_id)))) {
863
+				$meta_value = maybe_serialize($meta_value);
864
+				return $meta_value;
865
+			} else
866
+				return false;
867
+
868
+		} else
869
+			return false;
870
+	}
871 871
 }
872 872
 
873 873
 
874 874
 if (!function_exists('geodir_save_post_images')) {
875
-    /**
876
-     * Save post attachments.
877
-     *
878
-     * @since 1.0.0
879
-     * @package GeoDirectory
880
-     * @global object $wpdb WordPress Database object.
881
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
882
-     * @global object $current_user Current user object.
883
-     * @param int $post_id The post ID.
884
-     * @param array $post_image Post image urls as an array.
885
-     * @param bool $dummy Optional. Is this a dummy listing? Default false.
886
-     */
887
-    function geodir_save_post_images($post_id = 0, $post_image = array(), $dummy = false)
888
-    {
875
+	/**
876
+	 * Save post attachments.
877
+	 *
878
+	 * @since 1.0.0
879
+	 * @package GeoDirectory
880
+	 * @global object $wpdb WordPress Database object.
881
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
882
+	 * @global object $current_user Current user object.
883
+	 * @param int $post_id The post ID.
884
+	 * @param array $post_image Post image urls as an array.
885
+	 * @param bool $dummy Optional. Is this a dummy listing? Default false.
886
+	 */
887
+	function geodir_save_post_images($post_id = 0, $post_image = array(), $dummy = false)
888
+	{
889 889
 
890 890
 
891
-        global $wpdb, $plugin_prefix, $current_user;
891
+		global $wpdb, $plugin_prefix, $current_user;
892 892
 
893
-        $post_type = get_post_type($post_id);
893
+		$post_type = get_post_type($post_id);
894 894
 
895
-        $table = $plugin_prefix . $post_type . '_detail';
895
+		$table = $plugin_prefix . $post_type . '_detail';
896 896
 
897
-        $post_images = geodir_get_images($post_id);
897
+		$post_images = geodir_get_images($post_id);
898 898
 
899
-        $wpdb->query(
900
-            $wpdb->prepare(
901
-                "UPDATE " . $table . " SET featured_image = '' where post_id =%d",
902
-                array($post_id)
903
-            )
904
-        );
899
+		$wpdb->query(
900
+			$wpdb->prepare(
901
+				"UPDATE " . $table . " SET featured_image = '' where post_id =%d",
902
+				array($post_id)
903
+			)
904
+		);
905 905
 
906
-        $invalid_files = $post_images;
907
-        $valid_file_ids = array();
908
-        $valid_files_condition = '';
909
-        $geodir_uploaddir = '';
906
+		$invalid_files = $post_images;
907
+		$valid_file_ids = array();
908
+		$valid_files_condition = '';
909
+		$geodir_uploaddir = '';
910 910
 
911
-        $remove_files = array();
911
+		$remove_files = array();
912 912
 
913
-        if (!empty($post_image)) {
913
+		if (!empty($post_image)) {
914 914
 
915
-            $uploads = wp_upload_dir();
916
-            $uploads_dir = $uploads['path'];
915
+			$uploads = wp_upload_dir();
916
+			$uploads_dir = $uploads['path'];
917 917
 
918
-            $geodir_uploadpath = $uploads['path'];
919
-            $geodir_uploadurl = $uploads['url'];
920
-            $sub_dir = isset($uploads['subdir']) ? $uploads['subdir'] : '';
918
+			$geodir_uploadpath = $uploads['path'];
919
+			$geodir_uploadurl = $uploads['url'];
920
+			$sub_dir = isset($uploads['subdir']) ? $uploads['subdir'] : '';
921 921
 
922
-            $invalid_files = array();
923
-            $postcurr_images = array();
922
+			$invalid_files = array();
923
+			$postcurr_images = array();
924 924
 
925
-            for ($m = 0; $m < count($post_image); $m++) {
926
-                $menu_order = $m + 1;
925
+			for ($m = 0; $m < count($post_image); $m++) {
926
+				$menu_order = $m + 1;
927 927
 
928
-                $file_path = '';
929
-                /* --------- start ------- */
928
+				$file_path = '';
929
+				/* --------- start ------- */
930 930
 
931
-                $split_img_path = explode(str_replace(array('http://','https://'),'',$uploads['baseurl']), str_replace(array('http://','https://'),'',$post_image[$m]));
931
+				$split_img_path = explode(str_replace(array('http://','https://'),'',$uploads['baseurl']), str_replace(array('http://','https://'),'',$post_image[$m]));
932 932
 
933
-                $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
933
+				$split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
934 934
 
935 935
 
936
-                if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT ID FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE file=%s AND post_id = %d", array($split_img_file_path, $post_id)))) {
936
+				if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT ID FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE file=%s AND post_id = %d", array($split_img_file_path, $post_id)))) {
937 937
 
938
-                    /* --------- end ------- */
939
-                    $curr_img_url = $post_image[$m];
938
+					/* --------- end ------- */
939
+					$curr_img_url = $post_image[$m];
940 940
 
941
-                    $image_name_arr = explode('/', $curr_img_url);
941
+					$image_name_arr = explode('/', $curr_img_url);
942 942
 
943
-                    $count_image_name_arr = count($image_name_arr) - 2;
943
+					$count_image_name_arr = count($image_name_arr) - 2;
944 944
 
945
-                    $count_image_name_arr = ($count_image_name_arr >= 0) ? $count_image_name_arr : 0;
945
+					$count_image_name_arr = ($count_image_name_arr >= 0) ? $count_image_name_arr : 0;
946 946
 
947
-                    $curr_img_dir = $image_name_arr[$count_image_name_arr];
947
+					$curr_img_dir = $image_name_arr[$count_image_name_arr];
948 948
 
949
-                    $filename = end($image_name_arr);
950
-                    if (strpos($filename, '?') !== false) {
951
-                        list($filename) = explode('?', $filename);
952
-                    }
949
+					$filename = end($image_name_arr);
950
+					if (strpos($filename, '?') !== false) {
951
+						list($filename) = explode('?', $filename);
952
+					}
953 953
 
954
-                    $curr_img_dir = str_replace($uploads['baseurl'], "", $curr_img_url);
955
-                    $curr_img_dir = str_replace($filename, "", $curr_img_dir);
954
+					$curr_img_dir = str_replace($uploads['baseurl'], "", $curr_img_url);
955
+					$curr_img_dir = str_replace($filename, "", $curr_img_dir);
956 956
 
957
-                    $img_name_arr = explode('.', $filename);
957
+					$img_name_arr = explode('.', $filename);
958 958
 
959
-                    $file_title = isset($img_name_arr[0]) ? $img_name_arr[0] : $filename;
960
-                    if (!empty($img_name_arr) && count($img_name_arr) > 2) {
961
-                        $new_img_name_arr = $img_name_arr;
962
-                        if (isset($new_img_name_arr[count($img_name_arr) - 1])) {
963
-                            unset($new_img_name_arr[count($img_name_arr) - 1]);
964
-                            $file_title = implode('.', $new_img_name_arr);
965
-                        }
966
-                    }
967
-                    $file_title = sanitize_file_name($file_title);
968
-                    $file_name = sanitize_file_name($filename);
959
+					$file_title = isset($img_name_arr[0]) ? $img_name_arr[0] : $filename;
960
+					if (!empty($img_name_arr) && count($img_name_arr) > 2) {
961
+						$new_img_name_arr = $img_name_arr;
962
+						if (isset($new_img_name_arr[count($img_name_arr) - 1])) {
963
+							unset($new_img_name_arr[count($img_name_arr) - 1]);
964
+							$file_title = implode('.', $new_img_name_arr);
965
+						}
966
+					}
967
+					$file_title = sanitize_file_name($file_title);
968
+					$file_name = sanitize_file_name($filename);
969 969
 
970
-                    $arr_file_type = wp_check_filetype($filename);
970
+					$arr_file_type = wp_check_filetype($filename);
971 971
 
972
-                    $uploaded_file_type = $arr_file_type['type'];
972
+					$uploaded_file_type = $arr_file_type['type'];
973 973
 
974
-                    // Set an array containing a list of acceptable formats
975
-                    $allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png');
974
+					// Set an array containing a list of acceptable formats
975
+					$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png');
976 976
 
977
-                    // If the uploaded file is the right format
978
-                    if (in_array($uploaded_file_type, $allowed_file_types)) {
979
-                        if (!function_exists('wp_handle_upload')) {
980
-                            require_once(ABSPATH . 'wp-admin/includes/file.php');
981
-                        }
977
+					// If the uploaded file is the right format
978
+					if (in_array($uploaded_file_type, $allowed_file_types)) {
979
+						if (!function_exists('wp_handle_upload')) {
980
+							require_once(ABSPATH . 'wp-admin/includes/file.php');
981
+						}
982 982
 
983
-                        if (!is_dir($geodir_uploadpath)) {
984
-                            mkdir($geodir_uploadpath);
985
-                        }
983
+						if (!is_dir($geodir_uploadpath)) {
984
+							mkdir($geodir_uploadpath);
985
+						}
986 986
 
987
-                        $external_img = false;
988
-                        if (strpos(str_replace(array('http://','https://'),'',$curr_img_url), str_replace(array('http://','https://'),'',$uploads['baseurl'])) !== false) {
989
-                        } else {
990
-                            $external_img = true;
991
-                        }
987
+						$external_img = false;
988
+						if (strpos(str_replace(array('http://','https://'),'',$curr_img_url), str_replace(array('http://','https://'),'',$uploads['baseurl'])) !== false) {
989
+						} else {
990
+							$external_img = true;
991
+						}
992 992
 
993
-                        if ($dummy || $external_img) {
994
-                            $uploaded_file = array();
995
-                            $uploaded = (array)fetch_remote_file($curr_img_url);
993
+						if ($dummy || $external_img) {
994
+							$uploaded_file = array();
995
+							$uploaded = (array)fetch_remote_file($curr_img_url);
996 996
 
997
-                            if (isset($uploaded['error']) && empty($uploaded['error'])) {
998
-                                $new_name = basename($uploaded['file']);
999
-                                $uploaded_file = $uploaded;
1000
-                            }else{
1001
-                                print_r($uploaded);exit;
1002
-                            }
1003
-                            $external_img = false;
1004
-                        } else {
1005
-                            $new_name = $post_id . '_' . $file_name;
997
+							if (isset($uploaded['error']) && empty($uploaded['error'])) {
998
+								$new_name = basename($uploaded['file']);
999
+								$uploaded_file = $uploaded;
1000
+							}else{
1001
+								print_r($uploaded);exit;
1002
+							}
1003
+							$external_img = false;
1004
+						} else {
1005
+							$new_name = $post_id . '_' . $file_name;
1006 1006
 
1007
-                            if ($curr_img_dir == $sub_dir) {
1008
-                                $img_path = $geodir_uploadpath . '/' . $filename;
1009
-                                $img_url = $geodir_uploadurl . '/' . $filename;
1010
-                            } else {
1011
-                                $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1012
-                                $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
1013
-                            }
1007
+							if ($curr_img_dir == $sub_dir) {
1008
+								$img_path = $geodir_uploadpath . '/' . $filename;
1009
+								$img_url = $geodir_uploadurl . '/' . $filename;
1010
+							} else {
1011
+								$img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1012
+								$img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
1013
+							}
1014 1014
 
1015
-                            $uploaded_file = '';
1015
+							$uploaded_file = '';
1016 1016
 
1017
-                            if (file_exists($img_path)) {
1018
-                                $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1019
-                                $file_path = '';
1020
-                            } else if (file_exists($uploads['basedir'] . $curr_img_dir . $filename)) {
1021
-                                $uploaded_file = true;
1022
-                                $file_path = $curr_img_dir . '/' . $filename;
1023
-                            }
1017
+							if (file_exists($img_path)) {
1018
+								$uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1019
+								$file_path = '';
1020
+							} else if (file_exists($uploads['basedir'] . $curr_img_dir . $filename)) {
1021
+								$uploaded_file = true;
1022
+								$file_path = $curr_img_dir . '/' . $filename;
1023
+							}
1024 1024
 
1025
-                            if ($curr_img_dir != $geodir_uploaddir && file_exists($img_path))
1026
-                                unlink($img_path);
1027
-                        }
1025
+							if ($curr_img_dir != $geodir_uploaddir && file_exists($img_path))
1026
+								unlink($img_path);
1027
+						}
1028 1028
 
1029
-                        if (!empty($uploaded_file)) {
1030
-                            if (!isset($file_path) || !$file_path) {
1031
-                                $file_path = $sub_dir . '/' . $new_name;
1032
-                            }
1029
+						if (!empty($uploaded_file)) {
1030
+							if (!isset($file_path) || !$file_path) {
1031
+								$file_path = $sub_dir . '/' . $new_name;
1032
+							}
1033 1033
 
1034
-                            $postcurr_images[] = str_replace(array('http://','https://'),'',$uploads['baseurl'] . $file_path);
1034
+							$postcurr_images[] = str_replace(array('http://','https://'),'',$uploads['baseurl'] . $file_path);
1035 1035
 
1036
-                            if ($menu_order == 1) {
1036
+							if ($menu_order == 1) {
1037 1037
 
1038
-                                $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($file_path, $post_id)));
1038
+								$wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($file_path, $post_id)));
1039 1039
 
1040
-                            }
1040
+							}
1041 1041
 
1042
-                            // Set up options array to add this file as an attachment
1043
-                            $attachment = array();
1044
-                            $attachment['post_id'] = $post_id;
1045
-                            $attachment['title'] = $file_title;
1046
-                            $attachment['content'] = '';
1047
-                            $attachment['file'] = $file_path;
1048
-                            $attachment['mime_type'] = $uploaded_file_type;
1049
-                            $attachment['menu_order'] = $menu_order;
1050
-                            $attachment['is_featured'] = 0;
1042
+							// Set up options array to add this file as an attachment
1043
+							$attachment = array();
1044
+							$attachment['post_id'] = $post_id;
1045
+							$attachment['title'] = $file_title;
1046
+							$attachment['content'] = '';
1047
+							$attachment['file'] = $file_path;
1048
+							$attachment['mime_type'] = $uploaded_file_type;
1049
+							$attachment['menu_order'] = $menu_order;
1050
+							$attachment['is_featured'] = 0;
1051 1051
 
1052
-                            $attachment_set = '';
1052
+							$attachment_set = '';
1053 1053
 
1054
-                            foreach ($attachment as $key => $val) {
1055
-                                if ($val != '')
1056
-                                    $attachment_set .= $key . " = '" . $val . "', ";
1057
-                            }
1054
+							foreach ($attachment as $key => $val) {
1055
+								if ($val != '')
1056
+									$attachment_set .= $key . " = '" . $val . "', ";
1057
+							}
1058 1058
 
1059
-                            $attachment_set = trim($attachment_set, ", ");
1059
+							$attachment_set = trim($attachment_set, ", ");
1060
+
1061
+							$wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
1060 1062
 
1061
-                            $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
1063
+							$valid_file_ids[] = $wpdb->insert_id;
1064
+						}
1062 1065
 
1063
-                            $valid_file_ids[] = $wpdb->insert_id;
1064
-                        }
1066
+					}
1065 1067
 
1066
-                    }
1067 1068
 
1069
+				} else {
1070
+					$valid_file_ids[] = $find_image;
1068 1071
 
1069
-                } else {
1070
-                    $valid_file_ids[] = $find_image;
1071
-
1072
-                    $postcurr_images[] = str_replace(array('http://','https://'),'',$post_image[$m]);
1072
+					$postcurr_images[] = str_replace(array('http://','https://'),'',$post_image[$m]);
1073 1073
 
1074
-                    $wpdb->query(
1075
-                        $wpdb->prepare(
1076
-                            "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order = %d where file =%s AND post_id =%d",
1077
-                            array($menu_order, $split_img_path[1], $post_id)
1078
-                        )
1079
-                    );
1074
+					$wpdb->query(
1075
+						$wpdb->prepare(
1076
+							"UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order = %d where file =%s AND post_id =%d",
1077
+							array($menu_order, $split_img_path[1], $post_id)
1078
+						)
1079
+					);
1080 1080
 
1081
-                    if ($menu_order == 1)
1082
-                        $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id)));
1081
+					if ($menu_order == 1)
1082
+						$wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id)));
1083 1083
 
1084
-                }
1084
+				}
1085 1085
 
1086 1086
 
1087
-            }
1087
+			}
1088 1088
 
1089
-            if (!empty($valid_file_ids)) {
1089
+			if (!empty($valid_file_ids)) {
1090 1090
 
1091
-                $remove_files = $valid_file_ids;
1091
+				$remove_files = $valid_file_ids;
1092 1092
 
1093
-                $remove_files_length = count($remove_files);
1094
-                $remove_files_format = array_fill(0, $remove_files_length, '%d');
1095
-                $format = implode(',', $remove_files_format);
1096
-                $valid_files_condition = " ID NOT IN ($format) AND ";
1093
+				$remove_files_length = count($remove_files);
1094
+				$remove_files_format = array_fill(0, $remove_files_length, '%d');
1095
+				$format = implode(',', $remove_files_format);
1096
+				$valid_files_condition = " ID NOT IN ($format) AND ";
1097 1097
 
1098
-            }
1098
+			}
1099 1099
 
1100
-            //Get and remove all old images of post from database to set by new order
1100
+			//Get and remove all old images of post from database to set by new order
1101 1101
 
1102
-            if (!empty($post_images)) {
1102
+			if (!empty($post_images)) {
1103 1103
 
1104
-                foreach ($post_images as $img) {
1104
+				foreach ($post_images as $img) {
1105 1105
 
1106
-                    if (!in_array(str_replace(array('http://','https://'),'',$img->src), $postcurr_images)) {
1106
+					if (!in_array(str_replace(array('http://','https://'),'',$img->src), $postcurr_images)) {
1107 1107
 
1108
-                        $invalid_files[] = (object)array('src' => $img->src);
1108
+						$invalid_files[] = (object)array('src' => $img->src);
1109 1109
 
1110
-                    }
1110
+					}
1111 1111
 
1112
-                }
1112
+				}
1113 1113
 
1114
-            }
1114
+			}
1115 1115
 
1116
-            $invalid_files = (object)$invalid_files;
1117
-        }
1116
+			$invalid_files = (object)$invalid_files;
1117
+		}
1118 1118
 
1119
-        $remove_files[] = $post_id;
1119
+		$remove_files[] = $post_id;
1120 1120
 
1121
-        $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE " . $valid_files_condition . " post_id = %d", $remove_files));
1121
+		$wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE " . $valid_files_condition . " post_id = %d", $remove_files));
1122 1122
 
1123
-        if (!empty($invalid_files))
1124
-            geodir_remove_attachments($invalid_files);
1125
-    }
1123
+		if (!empty($invalid_files))
1124
+			geodir_remove_attachments($invalid_files);
1125
+	}
1126 1126
 
1127 1127
 }
1128 1128
 
@@ -1136,12 +1136,12 @@  discard block
 block discarded – undo
1136 1136
 function geodir_remove_temp_images()
1137 1137
 {
1138 1138
 
1139
-    global $current_user;
1139
+	global $current_user;
1140 1140
 
1141
-    $uploads = wp_upload_dir();
1142
-    $uploads_dir = $uploads['path'];
1141
+	$uploads = wp_upload_dir();
1142
+	$uploads_dir = $uploads['path'];
1143 1143
 
1144
-    /*	if(is_dir($uploads_dir.'/temp_'.$current_user->data->ID)){
1144
+	/*	if(is_dir($uploads_dir.'/temp_'.$current_user->data->ID)){
1145 1145
 
1146 1146
 			$dirPath = $uploads_dir.'/temp_'.$current_user->data->ID;
1147 1147
 			if (substr($dirPath, strlen($dirPath) - 1, 1) != '/') {
@@ -1158,8 +1158,8 @@  discard block
 block discarded – undo
1158 1158
 			rmdir($dirPath);
1159 1159
 	}	*/
1160 1160
 
1161
-    $dirname = $uploads_dir . '/temp_' . $current_user->data->ID;
1162
-    geodir_delete_directory($dirname);
1161
+	$dirname = $uploads_dir . '/temp_' . $current_user->data->ID;
1162
+	geodir_delete_directory($dirname);
1163 1163
 }
1164 1164
 
1165 1165
 
@@ -1173,109 +1173,109 @@  discard block
 block discarded – undo
1173 1173
  */
1174 1174
 function geodir_delete_directory($dirname)
1175 1175
 {
1176
-    $dir_handle = '';
1177
-    if (is_dir($dirname))
1178
-        $dir_handle = opendir($dirname);
1179
-    if (!$dir_handle)
1180
-        return false;
1181
-    while ($file = readdir($dir_handle)) {
1182
-        if ($file != "." && $file != "..") {
1183
-            if (!is_dir($dirname . "/" . $file))
1184
-                unlink($dirname . "/" . $file);
1185
-            else
1186
-                geodir_delete_directory($dirname . '/' . $file);
1187
-        }
1188
-    }
1189
-    closedir($dir_handle);
1190
-    rmdir($dirname);
1191
-    return true;
1176
+	$dir_handle = '';
1177
+	if (is_dir($dirname))
1178
+		$dir_handle = opendir($dirname);
1179
+	if (!$dir_handle)
1180
+		return false;
1181
+	while ($file = readdir($dir_handle)) {
1182
+		if ($file != "." && $file != "..") {
1183
+			if (!is_dir($dirname . "/" . $file))
1184
+				unlink($dirname . "/" . $file);
1185
+			else
1186
+				geodir_delete_directory($dirname . '/' . $file);
1187
+		}
1188
+	}
1189
+	closedir($dir_handle);
1190
+	rmdir($dirname);
1191
+	return true;
1192 1192
 
1193 1193
 }
1194 1194
 
1195 1195
 
1196 1196
 if (!function_exists('geodir_remove_attachments')) {
1197
-    /**
1198
-     * Remove post attachments.
1199
-     *
1200
-     * @since 1.0.0
1201
-     * @package GeoDirectory
1202
-     * @param array $postcurr_images Array of image objects.
1203
-     */
1204
-    function geodir_remove_attachments($postcurr_images = array())
1205
-    {
1206
-        // Unlink all past images of post
1207
-        if (!empty($postcurr_images)) {
1208
-
1209
-            $uploads = wp_upload_dir();
1210
-            $uploads_dir = $uploads['path'];
1211
-
1212
-            foreach ($postcurr_images as $postimg) {
1213
-                $image_name_arr = explode('/', $postimg->src);
1214
-                $filename = end($image_name_arr);
1215
-                if (file_exists($uploads_dir . '/' . $filename))
1216
-                    unlink($uploads_dir . '/' . $filename);
1217
-            }
1218
-
1219
-        } // endif
1220
-        // Unlink all past images of post end
1221
-    }
1197
+	/**
1198
+	 * Remove post attachments.
1199
+	 *
1200
+	 * @since 1.0.0
1201
+	 * @package GeoDirectory
1202
+	 * @param array $postcurr_images Array of image objects.
1203
+	 */
1204
+	function geodir_remove_attachments($postcurr_images = array())
1205
+	{
1206
+		// Unlink all past images of post
1207
+		if (!empty($postcurr_images)) {
1208
+
1209
+			$uploads = wp_upload_dir();
1210
+			$uploads_dir = $uploads['path'];
1211
+
1212
+			foreach ($postcurr_images as $postimg) {
1213
+				$image_name_arr = explode('/', $postimg->src);
1214
+				$filename = end($image_name_arr);
1215
+				if (file_exists($uploads_dir . '/' . $filename))
1216
+					unlink($uploads_dir . '/' . $filename);
1217
+			}
1218
+
1219
+		} // endif
1220
+		// Unlink all past images of post end
1221
+	}
1222 1222
 }
1223 1223
 
1224 1224
 if (!function_exists('geodir_get_featured_image')) {
1225
-    /**
1226
-     * Gets the post featured image.
1227
-     *
1228
-     * @since 1.0.0
1229
-     * @package GeoDirectory
1230
-     * @global object $wpdb WordPress Database object.
1231
-     * @global object $post The current post object.
1232
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
1233
-     * @param int|string $post_id The post ID.
1234
-     * @param string $size Optional. Thumbnail size. Default: thumbnail.
1235
-     * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false.
1236
-     * @param bool|string $file Optional. The file path from which you want to get the image details. Default: false.
1237
-     * @return bool|object Image details as an object.
1238
-     */
1239
-    function geodir_get_featured_image($post_id = '', $size = '', $no_image = false, $file = false)
1240
-    {
1241
-        global $wpdb, $plugin_prefix, $post;
1242
-
1243
-        if (isset($post->ID) && isset($post->post_type) && $post->ID == $post_id) {
1244
-            $post_type = $post->post_type;
1245
-        } else {
1246
-            $post_type = get_post_type($post_id);
1247
-        }
1248
-
1249
-        if (!in_array($post_type, geodir_get_posttypes())) {
1250
-            return false;// if not a GD CPT return;
1251
-        }
1252
-
1253
-        $table = $plugin_prefix . $post_type . '_detail';
1254
-
1255
-        if (!$file) {
1256
-            if (isset($post->featured_image)) {
1257
-                $file = $post->featured_image;
1258
-            } else {
1259
-                $file = $wpdb->get_var($wpdb->prepare("SELECT featured_image FROM " . $table . " WHERE post_id = %d", array($post_id)));
1260
-            }
1261
-        }
1262
-
1263
-        if ($file != NULL && $file != '' && (($uploads = wp_upload_dir()) && false === $uploads['error'])) {
1264
-            $img_arr = array();
1265
-
1266
-            $file_info = pathinfo($file);
1267
-            $sub_dir = '';
1268
-            if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
1269
-                $sub_dir = stripslashes_deep($file_info['dirname']);
1270
-
1271
-            $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
1272
-            $uploads_baseurl = $uploads['baseurl'];
1273
-            $uploads_path = $uploads['path'];
1274
-
1275
-            $file_name = $file_info['basename'];
1276
-
1277
-            $uploads_url = $uploads_baseurl . $sub_dir;
1278
-            /*
1225
+	/**
1226
+	 * Gets the post featured image.
1227
+	 *
1228
+	 * @since 1.0.0
1229
+	 * @package GeoDirectory
1230
+	 * @global object $wpdb WordPress Database object.
1231
+	 * @global object $post The current post object.
1232
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
1233
+	 * @param int|string $post_id The post ID.
1234
+	 * @param string $size Optional. Thumbnail size. Default: thumbnail.
1235
+	 * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false.
1236
+	 * @param bool|string $file Optional. The file path from which you want to get the image details. Default: false.
1237
+	 * @return bool|object Image details as an object.
1238
+	 */
1239
+	function geodir_get_featured_image($post_id = '', $size = '', $no_image = false, $file = false)
1240
+	{
1241
+		global $wpdb, $plugin_prefix, $post;
1242
+
1243
+		if (isset($post->ID) && isset($post->post_type) && $post->ID == $post_id) {
1244
+			$post_type = $post->post_type;
1245
+		} else {
1246
+			$post_type = get_post_type($post_id);
1247
+		}
1248
+
1249
+		if (!in_array($post_type, geodir_get_posttypes())) {
1250
+			return false;// if not a GD CPT return;
1251
+		}
1252
+
1253
+		$table = $plugin_prefix . $post_type . '_detail';
1254
+
1255
+		if (!$file) {
1256
+			if (isset($post->featured_image)) {
1257
+				$file = $post->featured_image;
1258
+			} else {
1259
+				$file = $wpdb->get_var($wpdb->prepare("SELECT featured_image FROM " . $table . " WHERE post_id = %d", array($post_id)));
1260
+			}
1261
+		}
1262
+
1263
+		if ($file != NULL && $file != '' && (($uploads = wp_upload_dir()) && false === $uploads['error'])) {
1264
+			$img_arr = array();
1265
+
1266
+			$file_info = pathinfo($file);
1267
+			$sub_dir = '';
1268
+			if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
1269
+				$sub_dir = stripslashes_deep($file_info['dirname']);
1270
+
1271
+			$uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
1272
+			$uploads_baseurl = $uploads['baseurl'];
1273
+			$uploads_path = $uploads['path'];
1274
+
1275
+			$file_name = $file_info['basename'];
1276
+
1277
+			$uploads_url = $uploads_baseurl . $sub_dir;
1278
+			/*
1279 1279
              * Allows the filter of image src for such things as CDN change.
1280 1280
              *
1281 1281
              * @since 1.5.7
@@ -1284,150 +1284,150 @@  discard block
 block discarded – undo
1284 1284
              * @param string $uploads_url The server upload directory url.
1285 1285
              * @param string $uploads_baseurl The uploads dir base url.
1286 1286
              */
1287
-            $img_arr['src'] = apply_filters('geodir_get_featured_image_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
1288
-            $img_arr['path'] = $uploads_path . '/' . $file_name;
1289
-            $imagesize = getimagesize($img_arr['path']);
1290
-            $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : 0;
1291
-            $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : 0;
1292
-            $img_arr['width'] = $width;
1293
-            $img_arr['height'] = $height;
1294
-            $img_arr['title'] = '';
1295
-        } elseif ($post_images = geodir_get_images($post_id, $size, $no_image, 1)) {
1296
-            foreach ($post_images as $image) {
1297
-                return $image;
1298
-            }
1299
-        } else if ($no_image) {
1300
-            $img_arr = array();
1301
-
1302
-            $default_img = '';
1303
-            if (isset($post->default_category) && $post->default_category) {
1304
-                $default_cat = $post->default_category;
1305
-            } else {
1306
-                $default_cat = geodir_get_post_meta($post_id, 'default_category', true);
1307
-            }
1308
-
1309
-            if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type))
1310
-                $default_img = $default_catimg['src'];
1311
-            elseif ($no_image) {
1312
-                $default_img = get_option('geodir_listing_no_img');
1313
-            }
1314
-
1315
-            if (!empty($default_img)) {
1316
-                $uploads = wp_upload_dir(); // Array of key => value pairs
1317
-                $uploads_baseurl = $uploads['baseurl'];
1318
-                $uploads_path = $uploads['path'];
1319
-
1320
-                $img_arr = array();
1321
-
1322
-                $file_info = pathinfo($default_img);
1323
-
1324
-                $file_name = $file_info['basename'];
1325
-
1326
-                $img_arr['src'] = $default_img;
1327
-                $img_arr['path'] = $uploads_path . '/' . $file_name;
1328
-
1329
-                $imagesize = getimagesize($img_arr['path']);
1330
-                $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : 0;
1331
-                $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : 0;
1332
-                $img_arr['width'] = $width;
1333
-                $img_arr['height'] = $height;
1334
-
1335
-                $img_arr['title'] = ''; // add the title to the array
1336
-            }
1337
-        }
1338
-
1339
-        if (!empty($img_arr))
1340
-            return (object)$img_arr;//return (object)array( 'src' => $file_url, 'path' => $file_path );
1341
-        else
1342
-            return false;
1343
-    }
1287
+			$img_arr['src'] = apply_filters('geodir_get_featured_image_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
1288
+			$img_arr['path'] = $uploads_path . '/' . $file_name;
1289
+			$imagesize = getimagesize($img_arr['path']);
1290
+			$width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : 0;
1291
+			$height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : 0;
1292
+			$img_arr['width'] = $width;
1293
+			$img_arr['height'] = $height;
1294
+			$img_arr['title'] = '';
1295
+		} elseif ($post_images = geodir_get_images($post_id, $size, $no_image, 1)) {
1296
+			foreach ($post_images as $image) {
1297
+				return $image;
1298
+			}
1299
+		} else if ($no_image) {
1300
+			$img_arr = array();
1301
+
1302
+			$default_img = '';
1303
+			if (isset($post->default_category) && $post->default_category) {
1304
+				$default_cat = $post->default_category;
1305
+			} else {
1306
+				$default_cat = geodir_get_post_meta($post_id, 'default_category', true);
1307
+			}
1308
+
1309
+			if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type))
1310
+				$default_img = $default_catimg['src'];
1311
+			elseif ($no_image) {
1312
+				$default_img = get_option('geodir_listing_no_img');
1313
+			}
1314
+
1315
+			if (!empty($default_img)) {
1316
+				$uploads = wp_upload_dir(); // Array of key => value pairs
1317
+				$uploads_baseurl = $uploads['baseurl'];
1318
+				$uploads_path = $uploads['path'];
1319
+
1320
+				$img_arr = array();
1321
+
1322
+				$file_info = pathinfo($default_img);
1323
+
1324
+				$file_name = $file_info['basename'];
1325
+
1326
+				$img_arr['src'] = $default_img;
1327
+				$img_arr['path'] = $uploads_path . '/' . $file_name;
1328
+
1329
+				$imagesize = getimagesize($img_arr['path']);
1330
+				$width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : 0;
1331
+				$height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : 0;
1332
+				$img_arr['width'] = $width;
1333
+				$img_arr['height'] = $height;
1334
+
1335
+				$img_arr['title'] = ''; // add the title to the array
1336
+			}
1337
+		}
1338
+
1339
+		if (!empty($img_arr))
1340
+			return (object)$img_arr;//return (object)array( 'src' => $file_url, 'path' => $file_path );
1341
+		else
1342
+			return false;
1343
+	}
1344 1344
 }
1345 1345
 
1346 1346
 if (!function_exists('geodir_show_featured_image')) {
1347
-    /**
1348
-     * Gets the post featured image.
1349
-     *
1350
-     * @since 1.0.0
1351
-     * @package GeoDirectory
1352
-     * @param int|string $post_id The post ID.
1353
-     * @param string $size Optional. Thumbnail size. Default: thumbnail.
1354
-     * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false.
1355
-     * @param bool $echo Optional. Do you want to print it instead of returning it? Default: true.
1356
-     * @param bool|string $fimage Optional. The file path from which you want to get the image details. Default: false.
1357
-     * @return bool|string Returns image html.
1358
-     */
1359
-    function geodir_show_featured_image($post_id = '', $size = 'thumbnail', $no_image = false, $echo = true, $fimage = false)
1360
-    {
1361
-        $image = geodir_get_featured_image($post_id, $size, $no_image, $fimage);
1362
-
1363
-        $html = geodir_show_image($image, $size, $no_image, false);
1364
-
1365
-        if (!empty($html) && $echo) {
1366
-            echo $html;
1367
-        } elseif (!empty($html)) {
1368
-            return $html;
1369
-        } else
1370
-            return false;
1371
-    }
1347
+	/**
1348
+	 * Gets the post featured image.
1349
+	 *
1350
+	 * @since 1.0.0
1351
+	 * @package GeoDirectory
1352
+	 * @param int|string $post_id The post ID.
1353
+	 * @param string $size Optional. Thumbnail size. Default: thumbnail.
1354
+	 * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false.
1355
+	 * @param bool $echo Optional. Do you want to print it instead of returning it? Default: true.
1356
+	 * @param bool|string $fimage Optional. The file path from which you want to get the image details. Default: false.
1357
+	 * @return bool|string Returns image html.
1358
+	 */
1359
+	function geodir_show_featured_image($post_id = '', $size = 'thumbnail', $no_image = false, $echo = true, $fimage = false)
1360
+	{
1361
+		$image = geodir_get_featured_image($post_id, $size, $no_image, $fimage);
1362
+
1363
+		$html = geodir_show_image($image, $size, $no_image, false);
1364
+
1365
+		if (!empty($html) && $echo) {
1366
+			echo $html;
1367
+		} elseif (!empty($html)) {
1368
+			return $html;
1369
+		} else
1370
+			return false;
1371
+	}
1372 1372
 }
1373 1373
 
1374 1374
 if (!function_exists('geodir_get_images')) {
1375
-    /**
1376
-     * Gets the post images.
1377
-     *
1378
-     * @since 1.0.0
1379
-     * @package GeoDirectory
1380
-     * @global object $wpdb WordPress Database object.
1381
-     * @param int $post_id The post ID.
1382
-     * @param string $img_size Optional. Thumbnail size.
1383
-     * @param bool $no_images Optional. Do you want to return the default image when no image is available? Default: false.
1384
-     * @param bool $add_featured Optional. Do you want to include featured images too? Default: true.
1385
-     * @param int|string $limit Optional. Number of images.
1386
-     * @return array|bool Returns images as an array. Each item is an object.
1387
-     */
1388
-    function geodir_get_images($post_id = 0, $img_size = '', $no_images = false, $add_featured = true, $limit = '')
1389
-    {
1390
-        global $wpdb;
1391
-        if ($limit) {
1392
-            $limit_q = " LIMIT $limit ";
1393
-        } else {
1394
-            $limit_q = '';
1395
-        }
1396
-        $not_featured = '';
1397
-        $sub_dir = '';
1398
-        if (!$add_featured)
1399
-            $not_featured = " AND is_featured = 0 ";
1400
-
1401
-        $arrImages = $wpdb->get_results(
1402
-            $wpdb->prepare(
1403
-                "SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d" . $not_featured . " ORDER BY menu_order ASC, ID DESC $limit_q ",
1404
-                array('%image%', $post_id)
1405
-            )
1406
-        );
1407
-
1408
-        $counter = 0;
1409
-        $return_arr = array();
1410
-
1411
-        if (!empty($arrImages)) {
1412
-            foreach ($arrImages as $attechment) {
1413
-
1414
-                $img_arr = array();
1415
-                $img_arr['id'] = $attechment->ID;
1416
-                $img_arr['user_id'] = isset($attechment->user_id) ? $attechment->user_id : 0;
1417
-
1418
-                $file_info = pathinfo($attechment->file);
1419
-
1420
-                if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
1421
-                    $sub_dir = stripslashes_deep($file_info['dirname']);
1422
-
1423
-                $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
1424
-                $uploads_baseurl = $uploads['baseurl'];
1425
-                $uploads_path = $uploads['path'];
1426
-
1427
-                $file_name = $file_info['basename'];
1428
-
1429
-                $uploads_url = $uploads_baseurl . $sub_dir;
1430
-                /*
1375
+	/**
1376
+	 * Gets the post images.
1377
+	 *
1378
+	 * @since 1.0.0
1379
+	 * @package GeoDirectory
1380
+	 * @global object $wpdb WordPress Database object.
1381
+	 * @param int $post_id The post ID.
1382
+	 * @param string $img_size Optional. Thumbnail size.
1383
+	 * @param bool $no_images Optional. Do you want to return the default image when no image is available? Default: false.
1384
+	 * @param bool $add_featured Optional. Do you want to include featured images too? Default: true.
1385
+	 * @param int|string $limit Optional. Number of images.
1386
+	 * @return array|bool Returns images as an array. Each item is an object.
1387
+	 */
1388
+	function geodir_get_images($post_id = 0, $img_size = '', $no_images = false, $add_featured = true, $limit = '')
1389
+	{
1390
+		global $wpdb;
1391
+		if ($limit) {
1392
+			$limit_q = " LIMIT $limit ";
1393
+		} else {
1394
+			$limit_q = '';
1395
+		}
1396
+		$not_featured = '';
1397
+		$sub_dir = '';
1398
+		if (!$add_featured)
1399
+			$not_featured = " AND is_featured = 0 ";
1400
+
1401
+		$arrImages = $wpdb->get_results(
1402
+			$wpdb->prepare(
1403
+				"SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d" . $not_featured . " ORDER BY menu_order ASC, ID DESC $limit_q ",
1404
+				array('%image%', $post_id)
1405
+			)
1406
+		);
1407
+
1408
+		$counter = 0;
1409
+		$return_arr = array();
1410
+
1411
+		if (!empty($arrImages)) {
1412
+			foreach ($arrImages as $attechment) {
1413
+
1414
+				$img_arr = array();
1415
+				$img_arr['id'] = $attechment->ID;
1416
+				$img_arr['user_id'] = isset($attechment->user_id) ? $attechment->user_id : 0;
1417
+
1418
+				$file_info = pathinfo($attechment->file);
1419
+
1420
+				if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
1421
+					$sub_dir = stripslashes_deep($file_info['dirname']);
1422
+
1423
+				$uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
1424
+				$uploads_baseurl = $uploads['baseurl'];
1425
+				$uploads_path = $uploads['path'];
1426
+
1427
+				$file_name = $file_info['basename'];
1428
+
1429
+				$uploads_url = $uploads_baseurl . $sub_dir;
1430
+				/*
1431 1431
                 * Allows the filter of image src for such things as CDN change.
1432 1432
                 *
1433 1433
                 * @since 1.5.7
@@ -1436,508 +1436,508 @@  discard block
 block discarded – undo
1436 1436
                 * @param string $uploads_url The server upload directory url.
1437 1437
                 * @param string $uploads_baseurl The uploads dir base url.
1438 1438
                 */
1439
-                $img_arr['src'] = apply_filters('geodir_get_images_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
1440
-                $img_arr['path'] = $uploads_path . '/' . $file_name;
1441
-                $imagesize = getimagesize($img_arr['path']);
1442
-                $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : 0;
1443
-                $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : 0;
1444
-                $img_arr['width'] = $width;
1445
-                $img_arr['height'] = $height;
1446
-
1447
-                $img_arr['file'] = $file_name; // add the title to the array
1448
-                $img_arr['title'] = $attechment->title; // add the title to the array
1449
-                $img_arr['caption'] = isset($attechment->caption) ? $attechment->caption : ''; // add the caption to the array
1450
-                $img_arr['content'] = $attechment->content; // add the description to the array
1451
-                $img_arr['is_approved'] = isset($attechment->is_approved) ? $attechment->is_approved : ''; // used for user image moderation. For backward compatibility Default value is 1.
1452
-
1453
-                $return_arr[] = (object)$img_arr;
1454
-
1455
-                $counter++;
1456
-            }
1457
-            return (object)$return_arr;
1458
-        } else if ($no_images) {
1459
-            $default_img = '';
1460
-            $default_cat = geodir_get_post_meta($post_id, 'default_category', true);
1461
-            $post_type = get_post_type($post_id);
1462
-            if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type))
1463
-                $default_img = $default_catimg['src'];
1464
-            elseif ($no_images) {
1465
-                $default_img = get_option('geodir_listing_no_img');
1466
-            }
1467
-
1468
-            if (!empty($default_img)) {
1469
-                $uploads = wp_upload_dir(); // Array of key => value pairs
1470
-                $uploads_baseurl = $uploads['baseurl'];
1471
-                $uploads_path = $uploads['path'];
1472
-
1473
-                $img_arr = array();
1474
-
1475
-                $file_info = pathinfo($default_img);
1476
-
1477
-                $file_name = $file_info['basename'];
1478
-
1479
-                $img_arr['src'] = $default_img;
1480
-                $img_arr['path'] = $uploads_path . '/' . $file_name;
1481
-
1482
-                $imagesize = getimagesize($img_arr['path']);
1483
-                $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : 0;
1484
-                $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : 0;
1485
-                $img_arr['width'] = $width;
1486
-                $img_arr['height'] = $height;
1487
-
1488
-                $img_arr['file'] = $file_name; // add the title to the array
1489
-                $img_arr['title'] = $file_name; // add the title to the array
1490
-                $img_arr['content'] = $file_name; // add the description to the array
1491
-
1492
-                $return_arr[] = (object)$img_arr;
1493
-
1494
-                return $return_arr;
1495
-            } else
1496
-                return false;
1497
-        }
1498
-    }
1439
+				$img_arr['src'] = apply_filters('geodir_get_images_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
1440
+				$img_arr['path'] = $uploads_path . '/' . $file_name;
1441
+				$imagesize = getimagesize($img_arr['path']);
1442
+				$width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : 0;
1443
+				$height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : 0;
1444
+				$img_arr['width'] = $width;
1445
+				$img_arr['height'] = $height;
1446
+
1447
+				$img_arr['file'] = $file_name; // add the title to the array
1448
+				$img_arr['title'] = $attechment->title; // add the title to the array
1449
+				$img_arr['caption'] = isset($attechment->caption) ? $attechment->caption : ''; // add the caption to the array
1450
+				$img_arr['content'] = $attechment->content; // add the description to the array
1451
+				$img_arr['is_approved'] = isset($attechment->is_approved) ? $attechment->is_approved : ''; // used for user image moderation. For backward compatibility Default value is 1.
1452
+
1453
+				$return_arr[] = (object)$img_arr;
1454
+
1455
+				$counter++;
1456
+			}
1457
+			return (object)$return_arr;
1458
+		} else if ($no_images) {
1459
+			$default_img = '';
1460
+			$default_cat = geodir_get_post_meta($post_id, 'default_category', true);
1461
+			$post_type = get_post_type($post_id);
1462
+			if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type))
1463
+				$default_img = $default_catimg['src'];
1464
+			elseif ($no_images) {
1465
+				$default_img = get_option('geodir_listing_no_img');
1466
+			}
1467
+
1468
+			if (!empty($default_img)) {
1469
+				$uploads = wp_upload_dir(); // Array of key => value pairs
1470
+				$uploads_baseurl = $uploads['baseurl'];
1471
+				$uploads_path = $uploads['path'];
1472
+
1473
+				$img_arr = array();
1474
+
1475
+				$file_info = pathinfo($default_img);
1476
+
1477
+				$file_name = $file_info['basename'];
1478
+
1479
+				$img_arr['src'] = $default_img;
1480
+				$img_arr['path'] = $uploads_path . '/' . $file_name;
1481
+
1482
+				$imagesize = getimagesize($img_arr['path']);
1483
+				$width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : 0;
1484
+				$height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : 0;
1485
+				$img_arr['width'] = $width;
1486
+				$img_arr['height'] = $height;
1487
+
1488
+				$img_arr['file'] = $file_name; // add the title to the array
1489
+				$img_arr['title'] = $file_name; // add the title to the array
1490
+				$img_arr['content'] = $file_name; // add the description to the array
1491
+
1492
+				$return_arr[] = (object)$img_arr;
1493
+
1494
+				return $return_arr;
1495
+			} else
1496
+				return false;
1497
+		}
1498
+	}
1499 1499
 }
1500 1500
 
1501 1501
 if (!function_exists('geodir_show_image')) {
1502
-    /**
1503
-     * Show image using image details.
1504
-     *
1505
-     * @since 1.0.0
1506
-     * @package GeoDirectory
1507
-     * @param array|object $request Image info either as an array or object.
1508
-     * @param string $size Optional. Thumbnail size. Default: thumbnail.
1509
-     * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false.
1510
-     * @param bool $echo Optional. Do you want to print it instead of returning it? Default: true.
1511
-     * @return bool|string Returns image html.
1512
-     */
1513
-    function geodir_show_image($request = array(), $size = 'thumbnail', $no_image = false, $echo = true)
1514
-    {
1515
-        $image = new stdClass();
1516
-
1517
-        $html = '';
1518
-        if (!empty($request)) {
1519
-            if (!is_object($request)){
1520
-                $request = (object)$request;
1521
-            }
1522
-
1523
-            if (isset($request->src) && !isset($request->path)) {
1524
-                $request->path = $request->src;
1525
-            }
1526
-
1527
-            /*
1502
+	/**
1503
+	 * Show image using image details.
1504
+	 *
1505
+	 * @since 1.0.0
1506
+	 * @package GeoDirectory
1507
+	 * @param array|object $request Image info either as an array or object.
1508
+	 * @param string $size Optional. Thumbnail size. Default: thumbnail.
1509
+	 * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false.
1510
+	 * @param bool $echo Optional. Do you want to print it instead of returning it? Default: true.
1511
+	 * @return bool|string Returns image html.
1512
+	 */
1513
+	function geodir_show_image($request = array(), $size = 'thumbnail', $no_image = false, $echo = true)
1514
+	{
1515
+		$image = new stdClass();
1516
+
1517
+		$html = '';
1518
+		if (!empty($request)) {
1519
+			if (!is_object($request)){
1520
+				$request = (object)$request;
1521
+			}
1522
+
1523
+			if (isset($request->src) && !isset($request->path)) {
1524
+				$request->path = $request->src;
1525
+			}
1526
+
1527
+			/*
1528 1528
              * getimagesize() works faster from path than url so we try and get path if we can.
1529 1529
              */
1530
-            $upload_dir = wp_upload_dir();
1531
-            $img_no_http = str_replace(array("http://","https://"),"",$request->path);
1532
-            $upload_no_http = str_replace(array("http://","https://"),"",$upload_dir['baseurl']);
1533
-            if (strpos($img_no_http ,$upload_no_http ) !== false) {
1534
-                $request->path = str_replace( $img_no_http,$upload_dir['basedir'],$request->path);
1535
-            }
1536
-
1537
-            $imagesize = getimagesize($request->path);
1538
-            $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : 0;
1539
-            $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : 0;
1540
-            $image->src = $request->src;
1541
-            $image->width = $width;
1542
-            $image->height = $height;
1543
-
1544
-            $max_size = (object)geodir_get_imagesize($size);
1545
-
1546
-            if (!is_wp_error($max_size)) {
1547
-
1548
-
1549
-                if ($image->width) {
1550
-                    if ($image->height >= $image->width) {
1551
-                        $width_per = round(((($image->width * ($max_size->h / $image->height)) / $max_size->w) * 100), 2);
1552
-                    } elseif ($image->width < ($max_size->h)) {
1553
-                        $width_per = round((($image->width / $max_size->w) * 100), 2);
1554
-                    } else
1555
-                        $width_per = 100;
1556
-                }
1557
-
1558
-                if (is_admin() && !isset($_REQUEST['geodir_ajax'])){
1559
-                    $html = '<div class="geodir_thumbnail"><img style="max-height:' . $max_size->h . 'px;" alt="place image" src="' . $image->src . '"  /></div>';
1560
-                }
1561
-                else{
1562
-                    $html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>';
1563
-                }
1564
-
1565
-            }
1566
-
1567
-        }
1568
-
1569
-        if (!empty($html) && $echo) {
1570
-            echo $html;
1571
-        } elseif (!empty($html)) {
1572
-            return $html;
1573
-        } else
1574
-            return false;
1575
-
1576
-    }
1577
-}
1530
+			$upload_dir = wp_upload_dir();
1531
+			$img_no_http = str_replace(array("http://","https://"),"",$request->path);
1532
+			$upload_no_http = str_replace(array("http://","https://"),"",$upload_dir['baseurl']);
1533
+			if (strpos($img_no_http ,$upload_no_http ) !== false) {
1534
+				$request->path = str_replace( $img_no_http,$upload_dir['basedir'],$request->path);
1535
+			}
1578 1536
 
1579
-if (!function_exists('geodir_set_post_terms')) {
1580
-    /**
1581
-     * Set post Categories.
1582
-     *
1583
-     * @since 1.0.0
1584
-     * @package GeoDirectory
1585
-     * @global object $wpdb WordPress Database object.
1586
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
1587
-     * @param int $post_id The post ID.
1588
-     * @param array $terms An array of term objects.
1589
-     * @param array $tt_ids An array of term taxonomy IDs.
1590
-     * @param string $taxonomy Taxonomy slug.
1591
-     */
1592
-    function geodir_set_post_terms($post_id, $terms, $tt_ids, $taxonomy)
1593
-    {
1594
-        global $wpdb, $plugin_prefix;
1537
+			$imagesize = getimagesize($request->path);
1538
+			$width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : 0;
1539
+			$height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : 0;
1540
+			$image->src = $request->src;
1541
+			$image->width = $width;
1542
+			$image->height = $height;
1543
+
1544
+			$max_size = (object)geodir_get_imagesize($size);
1545
+
1546
+			if (!is_wp_error($max_size)) {
1547
+
1548
+
1549
+				if ($image->width) {
1550
+					if ($image->height >= $image->width) {
1551
+						$width_per = round(((($image->width * ($max_size->h / $image->height)) / $max_size->w) * 100), 2);
1552
+					} elseif ($image->width < ($max_size->h)) {
1553
+						$width_per = round((($image->width / $max_size->w) * 100), 2);
1554
+					} else
1555
+						$width_per = 100;
1556
+				}
1557
+
1558
+				if (is_admin() && !isset($_REQUEST['geodir_ajax'])){
1559
+					$html = '<div class="geodir_thumbnail"><img style="max-height:' . $max_size->h . 'px;" alt="place image" src="' . $image->src . '"  /></div>';
1560
+				}
1561
+				else{
1562
+					$html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>';
1563
+				}
1595 1564
 
1596
-        $post_type = get_post_type($post_id);
1565
+			}
1597 1566
 
1598
-        $table = $plugin_prefix . $post_type . '_detail';
1567
+		}
1599 1568
 
1600
-        if (in_array($post_type, geodir_get_posttypes()) && !wp_is_post_revision($post_id)) {
1569
+		if (!empty($html) && $echo) {
1570
+			echo $html;
1571
+		} elseif (!empty($html)) {
1572
+			return $html;
1573
+		} else
1574
+			return false;
1601 1575
 
1602
-            if (strstr($taxonomy, 'tag')) {
1603
-                if (isset($_POST['action']) && $_POST['action'] == 'inline-save') {
1604
-                    geodir_save_post_meta($post_id, 'post_tags', $terms);
1605
-                }
1606
-            } elseif ($taxonomy == $post_type . 'category') {
1607
-                $srcharr = array('"', '\\');
1608
-                $replarr = array("&quot;", '');
1576
+	}
1577
+}
1578
+
1579
+if (!function_exists('geodir_set_post_terms')) {
1580
+	/**
1581
+	 * Set post Categories.
1582
+	 *
1583
+	 * @since 1.0.0
1584
+	 * @package GeoDirectory
1585
+	 * @global object $wpdb WordPress Database object.
1586
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
1587
+	 * @param int $post_id The post ID.
1588
+	 * @param array $terms An array of term objects.
1589
+	 * @param array $tt_ids An array of term taxonomy IDs.
1590
+	 * @param string $taxonomy Taxonomy slug.
1591
+	 */
1592
+	function geodir_set_post_terms($post_id, $terms, $tt_ids, $taxonomy)
1593
+	{
1594
+		global $wpdb, $plugin_prefix;
1595
+
1596
+		$post_type = get_post_type($post_id);
1597
+
1598
+		$table = $plugin_prefix . $post_type . '_detail';
1599
+
1600
+		if (in_array($post_type, geodir_get_posttypes()) && !wp_is_post_revision($post_id)) {
1601
+
1602
+			if (strstr($taxonomy, 'tag')) {
1603
+				if (isset($_POST['action']) && $_POST['action'] == 'inline-save') {
1604
+					geodir_save_post_meta($post_id, 'post_tags', $terms);
1605
+				}
1606
+			} elseif ($taxonomy == $post_type . 'category') {
1607
+				$srcharr = array('"', '\\');
1608
+				$replarr = array("&quot;", '');
1609 1609
 
1610
-                $post_obj = get_post($post_id);
1610
+				$post_obj = get_post($post_id);
1611 1611
 
1612
-                $cat_ids = array('0');
1613
-                if (is_array($tt_ids))
1614
-                    $cat_ids = $tt_ids;
1612
+				$cat_ids = array('0');
1613
+				if (is_array($tt_ids))
1614
+					$cat_ids = $tt_ids;
1615 1615
 
1616 1616
 
1617
-                if (!empty($cat_ids)) {
1618
-                    $cat_ids_array = $cat_ids;
1619
-                    $cat_ids_length = count($cat_ids_array);
1620
-                    $cat_ids_format = array_fill(0, $cat_ids_length, '%d');
1621
-                    $format = implode(',', $cat_ids_format);
1617
+				if (!empty($cat_ids)) {
1618
+					$cat_ids_array = $cat_ids;
1619
+					$cat_ids_length = count($cat_ids_array);
1620
+					$cat_ids_format = array_fill(0, $cat_ids_length, '%d');
1621
+					$format = implode(',', $cat_ids_format);
1622 1622
 
1623
-                    $cat_ids_array_del = $cat_ids_array;
1624
-                    $cat_ids_array_del[] = $post_id;
1623
+					$cat_ids_array_del = $cat_ids_array;
1624
+					$cat_ids_array_del[] = $post_id;
1625 1625
 
1626
-                    $wpdb->get_var(
1627
-                        $wpdb->prepare(
1628
-                            "DELETE from " . GEODIR_ICON_TABLE . " WHERE cat_id NOT IN ($format) AND post_id = %d ",
1629
-                            $cat_ids_array_del
1630
-                        )
1631
-                    );
1626
+					$wpdb->get_var(
1627
+						$wpdb->prepare(
1628
+							"DELETE from " . GEODIR_ICON_TABLE . " WHERE cat_id NOT IN ($format) AND post_id = %d ",
1629
+							$cat_ids_array_del
1630
+						)
1631
+					);
1632 1632
 
1633 1633
 
1634
-                    $post_term = $wpdb->get_col(
1635
-                        $wpdb->prepare(
1636
-                            "SELECT term_id FROM " . $wpdb->term_taxonomy . " WHERE term_taxonomy_id IN($format) GROUP BY term_id",
1637
-                            $cat_ids_array
1638
-                        )
1639
-                    );
1634
+					$post_term = $wpdb->get_col(
1635
+						$wpdb->prepare(
1636
+							"SELECT term_id FROM " . $wpdb->term_taxonomy . " WHERE term_taxonomy_id IN($format) GROUP BY term_id",
1637
+							$cat_ids_array
1638
+						)
1639
+					);
1640 1640
 
1641
-                }
1641
+				}
1642 1642
 
1643
-                $post_marker_json = '';
1643
+				$post_marker_json = '';
1644 1644
 
1645
-                if (!empty($post_term)):
1645
+				if (!empty($post_term)):
1646 1646
 
1647
-                    foreach ($post_term as $cat_id):
1647
+					foreach ($post_term as $cat_id):
1648 1648
 
1649
-                        $term_icon_url = get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type);
1650
-                        $term_icon = isset($term_icon_url['src']) ? $term_icon_url['src'] : '';
1649
+						$term_icon_url = get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type);
1650
+						$term_icon = isset($term_icon_url['src']) ? $term_icon_url['src'] : '';
1651 1651
 
1652
-                        $post_title = $post_obj->title;
1653
-                        $title = str_replace($srcharr, $replarr, $post_title);
1652
+						$post_title = $post_obj->title;
1653
+						$title = str_replace($srcharr, $replarr, $post_title);
1654 1654
 
1655
-                        $lat = geodir_get_post_meta($post_id, 'post_latitude', true);
1656
-                        $lng = geodir_get_post_meta($post_id, 'post_longitude', true);
1655
+						$lat = geodir_get_post_meta($post_id, 'post_latitude', true);
1656
+						$lng = geodir_get_post_meta($post_id, 'post_longitude', true);
1657 1657
 
1658
-                        $timing = ' - ' . date('D M j, Y', strtotime(geodir_get_post_meta($post_id, 'st_date', true)));
1659
-                        $timing .= ' - ' . geodir_get_post_meta($post_id, 'st_time', true);
1658
+						$timing = ' - ' . date('D M j, Y', strtotime(geodir_get_post_meta($post_id, 'st_date', true)));
1659
+						$timing .= ' - ' . geodir_get_post_meta($post_id, 'st_time', true);
1660 1660
 
1661
-                        $json = '{';
1662
-                        $json .= '"id":"' . $post_id . '",';
1663
-                        $json .= '"lat_pos": "' . $lat . '",';
1664
-                        $json .= '"long_pos": "' . $lng . '",';
1665
-                        $json .= '"marker_id":"' . $post_id . '_' . $cat_id . '",';
1666
-                        $json .= '"icon":"' . $term_icon . '",';
1667
-                        $json .= '"group":"catgroup' . $cat_id . '"';
1668
-                        $json .= '}';
1661
+						$json = '{';
1662
+						$json .= '"id":"' . $post_id . '",';
1663
+						$json .= '"lat_pos": "' . $lat . '",';
1664
+						$json .= '"long_pos": "' . $lng . '",';
1665
+						$json .= '"marker_id":"' . $post_id . '_' . $cat_id . '",';
1666
+						$json .= '"icon":"' . $term_icon . '",';
1667
+						$json .= '"group":"catgroup' . $cat_id . '"';
1668
+						$json .= '}';
1669 1669
 
1670 1670
 
1671
-                        if ($cat_id == geodir_get_post_meta($post_id, 'default_category', true))
1672
-                            $post_marker_json = $json;
1671
+						if ($cat_id == geodir_get_post_meta($post_id, 'default_category', true))
1672
+							$post_marker_json = $json;
1673 1673
 
1674 1674
 
1675
-                        if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . GEODIR_ICON_TABLE . " WHERE post_id = %d AND cat_id = %d", array($post_id, $cat_id)))) {
1675
+						if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . GEODIR_ICON_TABLE . " WHERE post_id = %d AND cat_id = %d", array($post_id, $cat_id)))) {
1676 1676
 
1677
-                            $json_query = $wpdb->prepare("UPDATE " . GEODIR_ICON_TABLE . " SET
1677
+							$json_query = $wpdb->prepare("UPDATE " . GEODIR_ICON_TABLE . " SET
1678 1678
 										post_title = %s,
1679 1679
 										json = %s
1680 1680
 										WHERE post_id = %d AND cat_id = %d ",
1681
-                                array($post_title, $json, $post_id, $cat_id));
1681
+								array($post_title, $json, $post_id, $cat_id));
1682 1682
 
1683
-                        } else {
1683
+						} else {
1684 1684
 
1685
-                            $json_query = $wpdb->prepare("INSERT INTO " . GEODIR_ICON_TABLE . " SET
1685
+							$json_query = $wpdb->prepare("INSERT INTO " . GEODIR_ICON_TABLE . " SET
1686 1686
 										post_id = %d,
1687 1687
 										post_title = %s,
1688 1688
 										cat_id = %d,
1689 1689
 										json = %s",
1690
-                                array($post_id, $post_title, $cat_id, $json));
1690
+								array($post_id, $post_title, $cat_id, $json));
1691 1691
 
1692
-                        }
1692
+						}
1693 1693
 
1694
-                        $wpdb->query($json_query);
1694
+						$wpdb->query($json_query);
1695 1695
 
1696
-                    endforeach;
1696
+					endforeach;
1697 1697
 
1698
-                endif;
1698
+				endif;
1699 1699
 
1700
-                if (!empty($post_term) && is_array($post_term)) {
1701
-                    $categories = implode(',', $post_term);
1700
+				if (!empty($post_term) && is_array($post_term)) {
1701
+					$categories = implode(',', $post_term);
1702 1702
 
1703
-                    if ($categories != '' && $categories != 0) $categories = ',' . $categories . ',';
1703
+					if ($categories != '' && $categories != 0) $categories = ',' . $categories . ',';
1704 1704
 
1705
-                    if (empty($post_marker_json))
1706
-                        $post_marker_json = isset($json) ? $json : '';
1705
+					if (empty($post_marker_json))
1706
+						$post_marker_json = isset($json) ? $json : '';
1707 1707
 
1708
-                    if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
1708
+					if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
1709 1709
 
1710
-                        $wpdb->query(
1711
-                            $wpdb->prepare(
1712
-                                "UPDATE " . $table . " SET
1710
+						$wpdb->query(
1711
+							$wpdb->prepare(
1712
+								"UPDATE " . $table . " SET
1713 1713
 								" . $taxonomy . " = %s,
1714 1714
 								marker_json = %s
1715 1715
 								where post_id = %d",
1716
-                                array($categories, $post_marker_json, $post_id)
1717
-                            )
1718
-                        );
1716
+								array($categories, $post_marker_json, $post_id)
1717
+							)
1718
+						);
1719 1719
 
1720
-                        if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'inline-save') {
1720
+						if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'inline-save') {
1721 1721
 
1722
-                            $categories = trim($categories, ',');
1722
+							$categories = trim($categories, ',');
1723 1723
 
1724
-                            if ($categories) {
1724
+							if ($categories) {
1725 1725
 
1726
-                                $categories = explode(',', $categories);
1726
+								$categories = explode(',', $categories);
1727 1727
 
1728
-                                $default_category = geodir_get_post_meta($post_id, 'default_category', true);
1728
+								$default_category = geodir_get_post_meta($post_id, 'default_category', true);
1729 1729
 
1730
-                                if (!in_array($default_category, $categories)) {
1730
+								if (!in_array($default_category, $categories)) {
1731 1731
 
1732
-                                    $wpdb->query(
1733
-                                        $wpdb->prepare(
1734
-                                            "UPDATE " . $table . " SET
1732
+									$wpdb->query(
1733
+										$wpdb->prepare(
1734
+											"UPDATE " . $table . " SET
1735 1735
 											default_category = %s
1736 1736
 											where post_id = %d",
1737
-                                            array($categories[0], $post_id)
1738
-                                        )
1739
-                                    );
1737
+											array($categories[0], $post_id)
1738
+										)
1739
+									);
1740 1740
 
1741
-                                    $default_category = $categories[0];
1741
+									$default_category = $categories[0];
1742 1742
 
1743
-                                }
1743
+								}
1744 1744
 
1745
-                                if ($default_category == '')
1746
-                                    $default_category = $categories[0];
1745
+								if ($default_category == '')
1746
+									$default_category = $categories[0];
1747 1747
 
1748
-                                geodir_set_postcat_structure($post_id, $taxonomy, $default_category, '');
1748
+								geodir_set_postcat_structure($post_id, $taxonomy, $default_category, '');
1749 1749
 
1750
-                            }
1750
+							}
1751 1751
 
1752
-                        }
1752
+						}
1753 1753
 
1754 1754
 
1755
-                    } else {
1755
+					} else {
1756 1756
 
1757
-                        $wpdb->query(
1758
-                            $wpdb->prepare(
1759
-                                "INSERT INTO " . $table . " SET
1757
+						$wpdb->query(
1758
+							$wpdb->prepare(
1759
+								"INSERT INTO " . $table . " SET
1760 1760
 								post_id = %d,
1761 1761
 								" . $taxonomy . " = %s,
1762 1762
 								marker_json = %s ",
1763 1763
 
1764
-                                array($post_id, $categories, $post_marker_json)
1765
-                            )
1766
-                        );
1767
-                    }
1768
-                }
1769
-            }
1770
-        }
1771
-    }
1764
+								array($post_id, $categories, $post_marker_json)
1765
+							)
1766
+						);
1767
+					}
1768
+				}
1769
+			}
1770
+		}
1771
+	}
1772 1772
 }
1773 1773
 
1774 1774
 if (!function_exists('geodir_get_infowindow_html')) {
1775
-    /**
1776
-     * Set post Map Marker info html.
1777
-     *
1778
-     * @since 1.0.0
1779
-     * @since 1.5.4 Modified to add new action "geodir_infowindow_meta_before".
1780
-     * @package GeoDirectory
1781
-     * @global array $geodir_addon_list List of active GeoDirectory extensions.
1782
-     * @global object $gd_session GeoDirectory Session object.
1783
-     * @param object $postinfo_obj The post details object.
1784
-     * @param string $post_preview Is this a post preview?.
1785
-     * @return mixed|string|void
1786
-     */
1787
-    function geodir_get_infowindow_html($postinfo_obj, $post_preview = '')
1788
-    {
1789
-        global $preview, $gd_session;
1790
-        $srcharr = array("'", "/", "-", '"', '\\');
1791
-        $replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
1792
-
1793
-        if ($gd_session->get('listing') && isset($post_preview) && $post_preview != '') {
1794
-            $ID = '';
1795
-            $plink = '';
1796
-
1797
-            if (isset($postinfo_obj->pid)) {
1798
-                $ID = $postinfo_obj->pid;
1799
-                $plink = get_permalink($ID);
1800
-            }
1801
-
1802
-            $title = str_replace($srcharr, $replarr, ($postinfo_obj->post_title));
1803
-            $lat = $postinfo_obj->post_latitude;
1804
-            $lng = $postinfo_obj->post_longitude;
1805
-            $address = str_replace($srcharr, $replarr, ($postinfo_obj->post_address));
1806
-            $contact = str_replace($srcharr, $replarr, ($postinfo_obj->geodir_contact));
1807
-            $timing = str_replace($srcharr, $replarr, ($postinfo_obj->geodir_timing));
1808
-        } else {
1809
-            $ID = $postinfo_obj->post_id;
1810
-            $title = str_replace($srcharr, $replarr, htmlentities($postinfo_obj->post_title, ENT_COMPAT, 'UTF-8')); // fix by Stiofan
1811
-            $plink = get_permalink($ID);
1812
-            $lat = htmlentities(geodir_get_post_meta($ID, 'post_latitude', true));
1813
-            $lng = htmlentities(geodir_get_post_meta($ID, 'post_longitude', true));
1814
-            $address = str_replace($srcharr, $replarr, htmlentities(geodir_get_post_meta($ID, 'post_address', true), ENT_COMPAT, 'UTF-8')); // fix by Stiofan
1815
-            $contact = str_replace($srcharr, $replarr, htmlentities(geodir_get_post_meta($ID, 'geodir_contact', true), ENT_COMPAT, 'UTF-8'));
1816
-            $timing = str_replace($srcharr, $replarr, (geodir_get_post_meta($ID, 'geodir_timing', true)));
1817
-        }
1818
-
1819
-        // filter field as per price package
1820
-        global $geodir_addon_list;
1821
-        if (isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes') {
1822
-            $post_type = get_post_type($ID);
1823
-            $package_id = isset($postinfo_obj->package_id) && $postinfo_obj->package_id ? $postinfo_obj->package_id : NULL;
1824
-            $field_name = 'geodir_contact';
1825
-            if (!check_field_visibility($package_id, $field_name, $post_type)) {
1826
-                $contact = '';
1827
-            }
1828
-
1829
-            $field_name = 'geodir_timing';
1830
-            if (!check_field_visibility($package_id, $field_name, $post_type)) {
1831
-                $timing = '';
1832
-            }
1833
-        }
1834
-
1835
-        if ($lat && $lng) {
1836
-            ob_start(); ?>
1775
+	/**
1776
+	 * Set post Map Marker info html.
1777
+	 *
1778
+	 * @since 1.0.0
1779
+	 * @since 1.5.4 Modified to add new action "geodir_infowindow_meta_before".
1780
+	 * @package GeoDirectory
1781
+	 * @global array $geodir_addon_list List of active GeoDirectory extensions.
1782
+	 * @global object $gd_session GeoDirectory Session object.
1783
+	 * @param object $postinfo_obj The post details object.
1784
+	 * @param string $post_preview Is this a post preview?.
1785
+	 * @return mixed|string|void
1786
+	 */
1787
+	function geodir_get_infowindow_html($postinfo_obj, $post_preview = '')
1788
+	{
1789
+		global $preview, $gd_session;
1790
+		$srcharr = array("'", "/", "-", '"', '\\');
1791
+		$replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
1792
+
1793
+		if ($gd_session->get('listing') && isset($post_preview) && $post_preview != '') {
1794
+			$ID = '';
1795
+			$plink = '';
1796
+
1797
+			if (isset($postinfo_obj->pid)) {
1798
+				$ID = $postinfo_obj->pid;
1799
+				$plink = get_permalink($ID);
1800
+			}
1801
+
1802
+			$title = str_replace($srcharr, $replarr, ($postinfo_obj->post_title));
1803
+			$lat = $postinfo_obj->post_latitude;
1804
+			$lng = $postinfo_obj->post_longitude;
1805
+			$address = str_replace($srcharr, $replarr, ($postinfo_obj->post_address));
1806
+			$contact = str_replace($srcharr, $replarr, ($postinfo_obj->geodir_contact));
1807
+			$timing = str_replace($srcharr, $replarr, ($postinfo_obj->geodir_timing));
1808
+		} else {
1809
+			$ID = $postinfo_obj->post_id;
1810
+			$title = str_replace($srcharr, $replarr, htmlentities($postinfo_obj->post_title, ENT_COMPAT, 'UTF-8')); // fix by Stiofan
1811
+			$plink = get_permalink($ID);
1812
+			$lat = htmlentities(geodir_get_post_meta($ID, 'post_latitude', true));
1813
+			$lng = htmlentities(geodir_get_post_meta($ID, 'post_longitude', true));
1814
+			$address = str_replace($srcharr, $replarr, htmlentities(geodir_get_post_meta($ID, 'post_address', true), ENT_COMPAT, 'UTF-8')); // fix by Stiofan
1815
+			$contact = str_replace($srcharr, $replarr, htmlentities(geodir_get_post_meta($ID, 'geodir_contact', true), ENT_COMPAT, 'UTF-8'));
1816
+			$timing = str_replace($srcharr, $replarr, (geodir_get_post_meta($ID, 'geodir_timing', true)));
1817
+		}
1818
+
1819
+		// filter field as per price package
1820
+		global $geodir_addon_list;
1821
+		if (isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes') {
1822
+			$post_type = get_post_type($ID);
1823
+			$package_id = isset($postinfo_obj->package_id) && $postinfo_obj->package_id ? $postinfo_obj->package_id : NULL;
1824
+			$field_name = 'geodir_contact';
1825
+			if (!check_field_visibility($package_id, $field_name, $post_type)) {
1826
+				$contact = '';
1827
+			}
1828
+
1829
+			$field_name = 'geodir_timing';
1830
+			if (!check_field_visibility($package_id, $field_name, $post_type)) {
1831
+				$timing = '';
1832
+			}
1833
+		}
1834
+
1835
+		if ($lat && $lng) {
1836
+			ob_start(); ?>
1837 1837
             <div class="gd-bubble" style="">
1838 1838
                 <div class="gd-bubble-inside">
1839 1839
                     <?php
1840
-                    $comment_count = '';
1841
-                    $rating_star = '';
1842
-                    if ($ID != '') {
1843
-                        $rating_star = '';
1844
-                        $comment_count = geodir_get_review_count_total($ID);
1845
-
1846
-                        if (!$preview) {
1847
-                            $post_avgratings = geodir_get_post_rating($ID);
1848
-
1849
-                            $rating_star = geodir_get_rating_stars($post_avgratings, $ID, false);
1850
-
1851
-                            /**
1852
-                             * Filter to change rating stars
1853
-                             *
1854
-                             * You can use this filter to change Rating stars.
1855
-                             *
1856
-                             * @since 1.0.0
1857
-                             * @package GeoDirectory
1858
-                             * @param string $rating_star Rating stars.
1859
-                             * @param float $post_avgratings Average ratings of the post.
1860
-                             * @param int $ID The post ID.
1861
-                             */
1862
-                            $rating_star = apply_filters('geodir_review_rating_stars_on_infowindow', $rating_star, $post_avgratings, $ID);
1863
-                        }
1864
-                    }
1865
-                    ?>
1840
+					$comment_count = '';
1841
+					$rating_star = '';
1842
+					if ($ID != '') {
1843
+						$rating_star = '';
1844
+						$comment_count = geodir_get_review_count_total($ID);
1845
+
1846
+						if (!$preview) {
1847
+							$post_avgratings = geodir_get_post_rating($ID);
1848
+
1849
+							$rating_star = geodir_get_rating_stars($post_avgratings, $ID, false);
1850
+
1851
+							/**
1852
+							 * Filter to change rating stars
1853
+							 *
1854
+							 * You can use this filter to change Rating stars.
1855
+							 *
1856
+							 * @since 1.0.0
1857
+							 * @package GeoDirectory
1858
+							 * @param string $rating_star Rating stars.
1859
+							 * @param float $post_avgratings Average ratings of the post.
1860
+							 * @param int $ID The post ID.
1861
+							 */
1862
+							$rating_star = apply_filters('geodir_review_rating_stars_on_infowindow', $rating_star, $post_avgratings, $ID);
1863
+						}
1864
+					}
1865
+					?>
1866 1866
                     <div class="geodir-bubble_desc">
1867 1867
                         <h4>
1868 1868
                             <a href="<?php if ($plink != '') {
1869
-                                echo $plink;
1870
-                            } else {
1871
-                                echo 'javascript:void(0);';
1872
-                            } ?>"><?php echo $title; ?></a>
1869
+								echo $plink;
1870
+							} else {
1871
+								echo 'javascript:void(0);';
1872
+							} ?>"><?php echo $title; ?></a>
1873 1873
                         </h4>
1874 1874
                         <?php
1875
-                        if ($gd_session->get('listing') && isset($post_preview) && $post_preview != '') {
1876
-                            $post_images = array();
1877
-                            if (!empty($postinfo_obj->post_images)) {
1878
-                                $post_images = explode(",", $postinfo_obj->post_images);
1879
-                            }
1880
-
1881
-                            if (!empty($post_images)) {
1882
-                                ?>
1875
+						if ($gd_session->get('listing') && isset($post_preview) && $post_preview != '') {
1876
+							$post_images = array();
1877
+							if (!empty($postinfo_obj->post_images)) {
1878
+								$post_images = explode(",", $postinfo_obj->post_images);
1879
+							}
1880
+
1881
+							if (!empty($post_images)) {
1882
+								?>
1883 1883
                                 <div class="geodir-bubble_image"><a href="<?php if ($plink != '') {
1884
-                                        echo $plink;
1885
-                                    } else {
1886
-                                        echo 'javascript:void(0);';
1887
-                                    } ?>"><img alt="bubble image" style="max-height:50px;"
1884
+										echo $plink;
1885
+									} else {
1886
+										echo 'javascript:void(0);';
1887
+									} ?>"><img alt="bubble image" style="max-height:50px;"
1888 1888
                                                src="<?php echo $post_images[0]; ?>"/></a></div>
1889 1889
                             <?php
1890
-                            }else{
1891
-                                echo '<div class="geodir-bubble_image"></div>';
1892
-                            }
1893
-                        } else {
1894
-                            if ($image = geodir_show_featured_image($ID, 'widget-thumb', true, false, $postinfo_obj->featured_image)) {
1895
-                                ?>
1890
+							}else{
1891
+								echo '<div class="geodir-bubble_image"></div>';
1892
+							}
1893
+						} else {
1894
+							if ($image = geodir_show_featured_image($ID, 'widget-thumb', true, false, $postinfo_obj->featured_image)) {
1895
+								?>
1896 1896
                                 <div class="geodir-bubble_image"><a href="<?php echo $plink; ?>"><?php echo $image; ?></a></div>
1897 1897
                             <?php
1898
-                            }else{
1899
-                                echo '<div class="geodir-bubble_image"></div>';
1900
-                            }
1901
-                        }
1902
-                        ?>
1898
+							}else{
1899
+								echo '<div class="geodir-bubble_image"></div>';
1900
+							}
1901
+						}
1902
+						?>
1903 1903
                         <div class="geodir-bubble-meta-side">
1904 1904
                             <?php
1905
-                            /**
1906
-                             * Fires before the meta info in the map info window.
1907
-                             *
1908
-                             * This can be used to add more info to the map info window before the normal meta info.
1909
-                             *
1910
-                             * @since 1.5.4
1911
-                             * @param int $ID The post id.
1912
-                             * @param object $postinfo_obj The posts info as an object.
1913
-                             * @param bool|string $post_preview True if currently in post preview page. Empty string if not.                           *
1914
-                             */
1915
-                            do_action('geodir_infowindow_meta_before', $ID, $postinfo_obj, $post_preview);
1916
-                            ?>
1905
+							/**
1906
+							 * Fires before the meta info in the map info window.
1907
+							 *
1908
+							 * This can be used to add more info to the map info window before the normal meta info.
1909
+							 *
1910
+							 * @since 1.5.4
1911
+							 * @param int $ID The post id.
1912
+							 * @param object $postinfo_obj The posts info as an object.
1913
+							 * @param bool|string $post_preview True if currently in post preview page. Empty string if not.                           *
1914
+							 */
1915
+							do_action('geodir_infowindow_meta_before', $ID, $postinfo_obj, $post_preview);
1916
+							?>
1917 1917
                             <span class="geodir_address"><i class="fa fa-home"></i> <?php echo $address; ?></span>
1918 1918
                             <?php if ($contact) { ?><span class="geodir_contact"><i
1919 1919
                                 class="fa fa-phone"></i> <?php echo $contact; ?></span><?php } ?>
1920 1920
                             <?php if ($timing) { ?><span class="geodir_timing"><i
1921 1921
                                 class="fa fa-clock-o"></i> <?php echo $timing; ?></span><?php }
1922 1922
 
1923
-                            /**
1924
-                             * Fires after the meta info in the map info window.
1925
-                             *
1926
-                             * This can be used to add more info to the map info window after the normal meta info.
1927
-                             *
1928
-                             * @since 1.4.2
1929
-                             * @param object $postinfo_obj The posts info as an object.
1930
-                             * @param bool|string $post_preview True if currently in post preview page. Empty string if not.                           *
1931
-                             */
1932
-                            do_action('geodir_infowindow_meta_after',$postinfo_obj,$post_preview );
1933
-                            ?>
1923
+							/**
1924
+							 * Fires after the meta info in the map info window.
1925
+							 *
1926
+							 * This can be used to add more info to the map info window after the normal meta info.
1927
+							 *
1928
+							 * @since 1.4.2
1929
+							 * @param object $postinfo_obj The posts info as an object.
1930
+							 * @param bool|string $post_preview True if currently in post preview page. Empty string if not.                           *
1931
+							 */
1932
+							do_action('geodir_infowindow_meta_after',$postinfo_obj,$post_preview );
1933
+							?>
1934 1934
                         </div>
1935 1935
                         <?php
1936 1936
 
1937
-                        if ($ID) {
1937
+						if ($ID) {
1938 1938
 
1939
-                            $post_author = isset($postinfo_obj->post_author) ? $postinfo_obj->post_author : get_post_field('post_author', $ID);
1940
-                            ?>
1939
+							$post_author = isset($postinfo_obj->post_author) ? $postinfo_obj->post_author : get_post_field('post_author', $ID);
1940
+							?>
1941 1941
                             <div class="geodir-bubble-meta-fade"></div>
1942 1942
 
1943 1943
                             <div class="geodir-bubble-meta-bottom">
@@ -1957,69 +1957,69 @@  discard block
 block discarded – undo
1957 1957
                 </div>
1958 1958
             </div>
1959 1959
             <?php
1960
-            $html = ob_get_clean();
1961
-            /**
1962
-             * Filter to change infowindow html
1963
-             *
1964
-             * You can use this filter to change infowindow html.
1965
-             *
1966
-             * @since 1.0.0
1967
-             * @package GeoDirectory
1968
-             * @param string $html Infowindow html.
1969
-             * @param object $postinfo_obj The Post object.
1970
-             * @param bool|string $post_preview Is this a post preview?
1971
-             */
1972
-            $html = apply_filters('geodir_custom_infowindow_html', $html, $postinfo_obj, $post_preview);
1973
-            return $html;
1974
-        }
1975
-    }
1960
+			$html = ob_get_clean();
1961
+			/**
1962
+			 * Filter to change infowindow html
1963
+			 *
1964
+			 * You can use this filter to change infowindow html.
1965
+			 *
1966
+			 * @since 1.0.0
1967
+			 * @package GeoDirectory
1968
+			 * @param string $html Infowindow html.
1969
+			 * @param object $postinfo_obj The Post object.
1970
+			 * @param bool|string $post_preview Is this a post preview?
1971
+			 */
1972
+			$html = apply_filters('geodir_custom_infowindow_html', $html, $postinfo_obj, $post_preview);
1973
+			return $html;
1974
+		}
1975
+	}
1976 1976
 }
1977 1977
 
1978 1978
 
1979 1979
 if (!function_exists('geodir_new_post_default_status')) {
1980
-    /**
1981
-     * Default post status for new posts.
1982
-     *
1983
-     * @since 1.0.0
1984
-     * @package GeoDirectory
1985
-     * @return string Returns the default post status for new posts. Ex: draft, publish etc.
1986
-     */
1987
-    function geodir_new_post_default_status()
1988
-    {
1989
-        if (get_option('geodir_new_post_default_status'))
1990
-            return get_option('geodir_new_post_default_status');
1991
-        else
1992
-            return 'publish';
1993
-
1994
-    }
1980
+	/**
1981
+	 * Default post status for new posts.
1982
+	 *
1983
+	 * @since 1.0.0
1984
+	 * @package GeoDirectory
1985
+	 * @return string Returns the default post status for new posts. Ex: draft, publish etc.
1986
+	 */
1987
+	function geodir_new_post_default_status()
1988
+	{
1989
+		if (get_option('geodir_new_post_default_status'))
1990
+			return get_option('geodir_new_post_default_status');
1991
+		else
1992
+			return 'publish';
1993
+
1994
+	}
1995 1995
 }
1996 1996
 
1997 1997
 if (!function_exists('geodir_change_post_status')) {
1998
-    /**
1999
-     * Change post status of a post.
2000
-     *
2001
-     * @global object $wpdb WordPress Database object.
2002
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
2003
-     * @param int|string $post_id The post ID.
2004
-     * @param string $status New post status. Ex: draft, publish etc.
2005
-     */
2006
-    function geodir_change_post_status($post_id = '', $status = '')
2007
-    {
2008
-        global $wpdb, $plugin_prefix;
2009
-
2010
-        $post_type = get_post_type($post_id);
2011
-
2012
-        $table = $plugin_prefix . $post_type . '_detail';
2013
-
2014
-        $wpdb->query(
2015
-            $wpdb->prepare(
2016
-                "UPDATE " . $table . " SET post_status=%s WHERE post_id=%d",
2017
-                array($status, $post_id)
2018
-            )
2019
-        );
2020
-
2021
-
2022
-    }
1998
+	/**
1999
+	 * Change post status of a post.
2000
+	 *
2001
+	 * @global object $wpdb WordPress Database object.
2002
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
2003
+	 * @param int|string $post_id The post ID.
2004
+	 * @param string $status New post status. Ex: draft, publish etc.
2005
+	 */
2006
+	function geodir_change_post_status($post_id = '', $status = '')
2007
+	{
2008
+		global $wpdb, $plugin_prefix;
2009
+
2010
+		$post_type = get_post_type($post_id);
2011
+
2012
+		$table = $plugin_prefix . $post_type . '_detail';
2013
+
2014
+		$wpdb->query(
2015
+			$wpdb->prepare(
2016
+				"UPDATE " . $table . " SET post_status=%s WHERE post_id=%d",
2017
+				array($status, $post_id)
2018
+			)
2019
+		);
2020
+
2021
+
2022
+	}
2023 2023
 }
2024 2024
 
2025 2025
 /**
@@ -2033,13 +2033,13 @@  discard block
 block discarded – undo
2033 2033
  */
2034 2034
 function geodir_set_post_status($pid, $status)
2035 2035
 {
2036
-    if ($pid) {
2037
-        global $wpdb;
2038
-        $my_post = array();
2039
-        $my_post['post_status'] = $status;
2040
-        $my_post['ID'] = $pid;
2041
-        $last_postid = wp_update_post($my_post);
2042
-    }
2036
+	if ($pid) {
2037
+		global $wpdb;
2038
+		$my_post = array();
2039
+		$my_post['post_status'] = $status;
2040
+		$my_post['ID'] = $pid;
2041
+		$last_postid = wp_update_post($my_post);
2042
+	}
2043 2043
 }
2044 2044
 
2045 2045
 
@@ -2055,384 +2055,384 @@  discard block
 block discarded – undo
2055 2055
  */
2056 2056
 function geodir_update_poststatus($new_status, $old_status, $post)
2057 2057
 {
2058
-    global $wpdb;
2058
+	global $wpdb;
2059 2059
 
2060
-    $geodir_posttypes = geodir_get_posttypes();
2060
+	$geodir_posttypes = geodir_get_posttypes();
2061 2061
 
2062
-    if (!wp_is_post_revision($post->ID) && in_array($post->post_type, $geodir_posttypes)) {
2062
+	if (!wp_is_post_revision($post->ID) && in_array($post->post_type, $geodir_posttypes)) {
2063 2063
 
2064
-        geodir_change_post_status($post->ID, $new_status);
2065
-    }
2064
+		geodir_change_post_status($post->ID, $new_status);
2065
+	}
2066 2066
 }
2067 2067
 
2068 2068
 
2069 2069
 if (!function_exists('geodir_update_listing_info')) {
2070
-    /**
2071
-     * Update post info.
2072
-     *
2073
-     * @since 1.0.0
2074
-     * @package GeoDirectory
2075
-     * @global object $wpdb WordPress Database object.
2076
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
2077
-     * @param int $updatingpost The updating post ID.
2078
-     * @param int $temppost The temporary post ID.
2079
-     * @todo fix post_id variable
2080
-     */
2081
-    function geodir_update_listing_info($updatingpost, $temppost)
2082
-    {
2083
-
2084
-        global $wpdb, $plugin_prefix;
2085
-
2086
-        $post_type = get_post_type($post_id);
2087
-
2088
-        $table = $plugin_prefix . $post_type . '_detail';
2089
-
2090
-        $wpdb->query(
2091
-            $wpdb->prepare(
2092
-                "UPDATE " . $table . " SET `post_id` = %d WHERE `post_id` = %d",
2093
-                array($updatingpost, $temppost)
2094
-            )
2095
-        );
2096
-
2097
-        $wpdb->query(
2098
-            $wpdb->prepare(
2099
-                "UPDATE " . GEODIR_ICON_TABLE . " SET `post_id` = %d WHERE `post_id` = %d",
2100
-                array($updatingpost, $temppost)
2101
-            )
2102
-        );
2103
-
2104
-        /* Update Attachments*/
2105
-
2106
-        $wpdb->query(
2107
-            $wpdb->prepare(
2108
-                "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET `post_id` = %d WHERE `post_id` = %d",
2109
-                array($updatingpost, $temppost)
2110
-            )
2111
-        );
2112
-
2113
-    }
2070
+	/**
2071
+	 * Update post info.
2072
+	 *
2073
+	 * @since 1.0.0
2074
+	 * @package GeoDirectory
2075
+	 * @global object $wpdb WordPress Database object.
2076
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
2077
+	 * @param int $updatingpost The updating post ID.
2078
+	 * @param int $temppost The temporary post ID.
2079
+	 * @todo fix post_id variable
2080
+	 */
2081
+	function geodir_update_listing_info($updatingpost, $temppost)
2082
+	{
2083
+
2084
+		global $wpdb, $plugin_prefix;
2085
+
2086
+		$post_type = get_post_type($post_id);
2087
+
2088
+		$table = $plugin_prefix . $post_type . '_detail';
2089
+
2090
+		$wpdb->query(
2091
+			$wpdb->prepare(
2092
+				"UPDATE " . $table . " SET `post_id` = %d WHERE `post_id` = %d",
2093
+				array($updatingpost, $temppost)
2094
+			)
2095
+		);
2096
+
2097
+		$wpdb->query(
2098
+			$wpdb->prepare(
2099
+				"UPDATE " . GEODIR_ICON_TABLE . " SET `post_id` = %d WHERE `post_id` = %d",
2100
+				array($updatingpost, $temppost)
2101
+			)
2102
+		);
2103
+
2104
+		/* Update Attachments*/
2105
+
2106
+		$wpdb->query(
2107
+			$wpdb->prepare(
2108
+				"UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET `post_id` = %d WHERE `post_id` = %d",
2109
+				array($updatingpost, $temppost)
2110
+			)
2111
+		);
2112
+
2113
+	}
2114 2114
 }
2115 2115
 
2116 2116
 
2117 2117
 if (!function_exists('geodir_delete_listing_info')) {
2118
-    /**
2119
-     * Delete Listing info from details table for the given post id.
2120
-     *
2121
-     * @since 1.0.0
2122
-     * @package GeoDirectory
2123
-     * @global object $wpdb WordPress Database object.
2124
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
2125
-     * @param int $deleted_postid The post ID.
2126
-     * @param bool $force Optional. Do you want to force delete it? Default: false.
2127
-     * @return bool|void
2128
-     */
2129
-    function geodir_delete_listing_info($deleted_postid, $force = false)
2130
-    {
2131
-        global $wpdb, $plugin_prefix;
2132
-
2133
-        // check for multisite deletions
2134
-        if (strpos($plugin_prefix, $wpdb->prefix) !== false) {
2135
-        } else {
2136
-            return;
2137
-        }
2138
-
2139
-        $post_type = get_post_type($deleted_postid);
2140
-
2141
-        $all_postypes = geodir_get_posttypes();
2142
-
2143
-        if (!in_array($post_type, $all_postypes))
2144
-            return false;
2145
-
2146
-        $table = $plugin_prefix . $post_type . '_detail';
2147
-
2148
-        /* Delete custom post meta*/
2149
-        $wpdb->query(
2150
-            $wpdb->prepare(
2151
-                "DELETE FROM " . $table . " WHERE `post_id` = %d",
2152
-                array($deleted_postid)
2153
-            )
2154
-        );
2155
-
2156
-        /* Delete post map icons*/
2157
-
2158
-        $wpdb->query(
2159
-            $wpdb->prepare(
2160
-                "DELETE FROM " . GEODIR_ICON_TABLE . " WHERE `post_id` = %d",
2161
-                array($deleted_postid)
2162
-            )
2163
-        );
2164
-
2165
-        /* Delete Attachments*/
2166
-        $postcurr_images = geodir_get_images($deleted_postid);
2167
-
2168
-        $wpdb->query(
2169
-            $wpdb->prepare(
2170
-                "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE `post_id` = %d",
2171
-                array($deleted_postid)
2172
-            )
2173
-        );
2174
-        geodir_remove_attachments($postcurr_images);
2175
-
2176
-    }
2118
+	/**
2119
+	 * Delete Listing info from details table for the given post id.
2120
+	 *
2121
+	 * @since 1.0.0
2122
+	 * @package GeoDirectory
2123
+	 * @global object $wpdb WordPress Database object.
2124
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
2125
+	 * @param int $deleted_postid The post ID.
2126
+	 * @param bool $force Optional. Do you want to force delete it? Default: false.
2127
+	 * @return bool|void
2128
+	 */
2129
+	function geodir_delete_listing_info($deleted_postid, $force = false)
2130
+	{
2131
+		global $wpdb, $plugin_prefix;
2132
+
2133
+		// check for multisite deletions
2134
+		if (strpos($plugin_prefix, $wpdb->prefix) !== false) {
2135
+		} else {
2136
+			return;
2137
+		}
2138
+
2139
+		$post_type = get_post_type($deleted_postid);
2140
+
2141
+		$all_postypes = geodir_get_posttypes();
2142
+
2143
+		if (!in_array($post_type, $all_postypes))
2144
+			return false;
2145
+
2146
+		$table = $plugin_prefix . $post_type . '_detail';
2147
+
2148
+		/* Delete custom post meta*/
2149
+		$wpdb->query(
2150
+			$wpdb->prepare(
2151
+				"DELETE FROM " . $table . " WHERE `post_id` = %d",
2152
+				array($deleted_postid)
2153
+			)
2154
+		);
2155
+
2156
+		/* Delete post map icons*/
2157
+
2158
+		$wpdb->query(
2159
+			$wpdb->prepare(
2160
+				"DELETE FROM " . GEODIR_ICON_TABLE . " WHERE `post_id` = %d",
2161
+				array($deleted_postid)
2162
+			)
2163
+		);
2164
+
2165
+		/* Delete Attachments*/
2166
+		$postcurr_images = geodir_get_images($deleted_postid);
2167
+
2168
+		$wpdb->query(
2169
+			$wpdb->prepare(
2170
+				"DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE `post_id` = %d",
2171
+				array($deleted_postid)
2172
+			)
2173
+		);
2174
+		geodir_remove_attachments($postcurr_images);
2175
+
2176
+	}
2177 2177
 }
2178 2178
 
2179 2179
 
2180 2180
 if (!function_exists('geodir_add_to_favorite')) {
2181
-    /**
2182
-     * This function would add listing to favorite listing.
2183
-     *
2184
-     * @since 1.0.0
2185
-     * @package GeoDirectory
2186
-     * @global object $current_user Current user object.
2187
-     * @param int $post_id The post ID.
2188
-     */
2189
-    function geodir_add_to_favorite($post_id)
2190
-    {
2191
-
2192
-        global $current_user;
2193
-
2194
-        /**
2195
-         * Filter to modify "Unfavorite" text
2196
-         *
2197
-         * You can use this filter to rename "Unfavorite" text to something else.
2198
-         *
2199
-         * @since 1.0.0
2200
-         * @package GeoDirectory
2201
-         */
2202
-        $remove_favourite_text = apply_filters('geodir_remove_favourite_text', REMOVE_FAVOURITE_TEXT);
2203
-
2204
-        /**
2205
-         * Filter to modify "Remove from Favorites" text
2206
-         *
2207
-         * You can use this filter to rename "Remove from Favorites" text to something else.
2208
-         *
2209
-         * @since 1.0.0
2210
-         * @package GeoDirectory
2211
-         */
2212
-        $unfavourite_text = apply_filters('geodir_unfavourite_text', UNFAVOURITE_TEXT);
2213
-
2214
-        /**
2215
-         * Filter to modify "fa fa-heart" icon
2216
-         *
2217
-         * You can use this filter to change "fa fa-heart" icon to something else.
2218
-         *
2219
-         * @since 1.0.0
2220
-         * @package GeoDirectory
2221
-         */
2222
-        $favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
2223
-
2224
-        $user_meta_data = array();
2225
-        $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2226
-
2227
-        if (empty($user_meta_data) || (!empty($user_meta_data) && !in_array($post_id, $user_meta_data))) {
2228
-            $user_meta_data[] = $post_id;
2229
-        }
2230
-
2231
-        update_user_meta($current_user->data->ID, 'gd_user_favourite_post', $user_meta_data);
2232
-
2233
-        /**
2234
-         * Called before adding the post from favourites.
2235
-         *
2236
-         * @since 1.0.0
2237
-         * @package GeoDirectory
2238
-         * @param int $post_id The post ID.
2239
-         */
2240
-        do_action('geodir_before_add_from_favorite', $post_id);
2181
+	/**
2182
+	 * This function would add listing to favorite listing.
2183
+	 *
2184
+	 * @since 1.0.0
2185
+	 * @package GeoDirectory
2186
+	 * @global object $current_user Current user object.
2187
+	 * @param int $post_id The post ID.
2188
+	 */
2189
+	function geodir_add_to_favorite($post_id)
2190
+	{
2191
+
2192
+		global $current_user;
2193
+
2194
+		/**
2195
+		 * Filter to modify "Unfavorite" text
2196
+		 *
2197
+		 * You can use this filter to rename "Unfavorite" text to something else.
2198
+		 *
2199
+		 * @since 1.0.0
2200
+		 * @package GeoDirectory
2201
+		 */
2202
+		$remove_favourite_text = apply_filters('geodir_remove_favourite_text', REMOVE_FAVOURITE_TEXT);
2203
+
2204
+		/**
2205
+		 * Filter to modify "Remove from Favorites" text
2206
+		 *
2207
+		 * You can use this filter to rename "Remove from Favorites" text to something else.
2208
+		 *
2209
+		 * @since 1.0.0
2210
+		 * @package GeoDirectory
2211
+		 */
2212
+		$unfavourite_text = apply_filters('geodir_unfavourite_text', UNFAVOURITE_TEXT);
2213
+
2214
+		/**
2215
+		 * Filter to modify "fa fa-heart" icon
2216
+		 *
2217
+		 * You can use this filter to change "fa fa-heart" icon to something else.
2218
+		 *
2219
+		 * @since 1.0.0
2220
+		 * @package GeoDirectory
2221
+		 */
2222
+		$favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
2223
+
2224
+		$user_meta_data = array();
2225
+		$user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2226
+
2227
+		if (empty($user_meta_data) || (!empty($user_meta_data) && !in_array($post_id, $user_meta_data))) {
2228
+			$user_meta_data[] = $post_id;
2229
+		}
2230
+
2231
+		update_user_meta($current_user->data->ID, 'gd_user_favourite_post', $user_meta_data);
2232
+
2233
+		/**
2234
+		 * Called before adding the post from favourites.
2235
+		 *
2236
+		 * @since 1.0.0
2237
+		 * @package GeoDirectory
2238
+		 * @param int $post_id The post ID.
2239
+		 */
2240
+		do_action('geodir_before_add_from_favorite', $post_id);
2241
+
2242
+		echo '<a href="javascript:void(0);" title="' . $remove_favourite_text . '" class="geodir-addtofav geodir-removetofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'remove\');"><i class="'. $favourite_icon .'"></i> ' . $unfavourite_text . '</a>';
2243
+
2244
+		/**
2245
+		 * Called after adding the post from favourites.
2246
+		 *
2247
+		 * @since 1.0.0
2248
+		 * @package GeoDirectory
2249
+		 * @param int $post_id The post ID.
2250
+		 */
2251
+		do_action('geodir_after_add_from_favorite', $post_id);
2241 2252
 
2242
-        echo '<a href="javascript:void(0);" title="' . $remove_favourite_text . '" class="geodir-addtofav geodir-removetofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'remove\');"><i class="'. $favourite_icon .'"></i> ' . $unfavourite_text . '</a>';
2243
-
2244
-        /**
2245
-         * Called after adding the post from favourites.
2246
-         *
2247
-         * @since 1.0.0
2248
-         * @package GeoDirectory
2249
-         * @param int $post_id The post ID.
2250
-         */
2251
-        do_action('geodir_after_add_from_favorite', $post_id);
2252
-
2253
-    }
2253
+	}
2254 2254
 }
2255 2255
 
2256 2256
 if (!function_exists('geodir_remove_from_favorite')) {
2257
-    /**
2258
-     * This function would remove the favourited property earlier.
2259
-     *
2260
-     * @since 1.0.0
2261
-     * @package GeoDirectory
2262
-     * @global object $current_user Current user object.
2263
-     * @param int $post_id The post ID.
2264
-     */
2265
-    function geodir_remove_from_favorite($post_id)
2266
-    {
2267
-        global $current_user;
2268
-
2269
-        /**
2270
-         * Filter to modify "Add to Favorites" text
2271
-         *
2272
-         * You can use this filter to rename "Add to Favorites" text to something else.
2273
-         *
2274
-         * @since 1.0.0
2275
-         * @package GeoDirectory
2276
-         */
2277
-        $add_favourite_text = apply_filters('geodir_add_favourite_text', ADD_FAVOURITE_TEXT);
2278
-
2279
-        /**
2280
-         * Filter to modify "Favourite" text
2281
-         *
2282
-         * You can use this filter to rename "Favourite" text to something else.
2283
-         *
2284
-         * @since 1.0.0
2285
-         * @package GeoDirectory
2286
-         */
2287
-        $favourite_text = apply_filters('geodir_favourite_text', FAVOURITE_TEXT);
2288
-
2289
-        /**
2290
-         * Filter to modify "fa fa-heart" icon
2291
-         *
2292
-         * You can use this filter to change "fa fa-heart" icon to something else.
2293
-         *
2294
-         * @since 1.0.0
2295
-         * @package GeoDirectory
2296
-         */
2297
-        $favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
2298
-
2299
-        $user_meta_data = array();
2300
-        $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2301
-
2302
-        if (!empty($user_meta_data)) {
2303
-
2304
-            if (($key = array_search($post_id, $user_meta_data)) !== false) {
2305
-                unset($user_meta_data[$key]);
2306
-            }
2257
+	/**
2258
+	 * This function would remove the favourited property earlier.
2259
+	 *
2260
+	 * @since 1.0.0
2261
+	 * @package GeoDirectory
2262
+	 * @global object $current_user Current user object.
2263
+	 * @param int $post_id The post ID.
2264
+	 */
2265
+	function geodir_remove_from_favorite($post_id)
2266
+	{
2267
+		global $current_user;
2268
+
2269
+		/**
2270
+		 * Filter to modify "Add to Favorites" text
2271
+		 *
2272
+		 * You can use this filter to rename "Add to Favorites" text to something else.
2273
+		 *
2274
+		 * @since 1.0.0
2275
+		 * @package GeoDirectory
2276
+		 */
2277
+		$add_favourite_text = apply_filters('geodir_add_favourite_text', ADD_FAVOURITE_TEXT);
2278
+
2279
+		/**
2280
+		 * Filter to modify "Favourite" text
2281
+		 *
2282
+		 * You can use this filter to rename "Favourite" text to something else.
2283
+		 *
2284
+		 * @since 1.0.0
2285
+		 * @package GeoDirectory
2286
+		 */
2287
+		$favourite_text = apply_filters('geodir_favourite_text', FAVOURITE_TEXT);
2288
+
2289
+		/**
2290
+		 * Filter to modify "fa fa-heart" icon
2291
+		 *
2292
+		 * You can use this filter to change "fa fa-heart" icon to something else.
2293
+		 *
2294
+		 * @since 1.0.0
2295
+		 * @package GeoDirectory
2296
+		 */
2297
+		$favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
2298
+
2299
+		$user_meta_data = array();
2300
+		$user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2301
+
2302
+		if (!empty($user_meta_data)) {
2303
+
2304
+			if (($key = array_search($post_id, $user_meta_data)) !== false) {
2305
+				unset($user_meta_data[$key]);
2306
+			}
2307 2307
 
2308
-        }
2308
+		}
2309 2309
 
2310
-        update_user_meta($current_user->data->ID, 'gd_user_favourite_post', $user_meta_data);
2310
+		update_user_meta($current_user->data->ID, 'gd_user_favourite_post', $user_meta_data);
2311 2311
 
2312
-        /**
2313
-         * Called before removing the post from favourites.
2314
-         *
2315
-         * @since 1.0.0
2316
-         * @package GeoDirectory
2317
-         * @param int $post_id The post ID.
2318
-         */
2319
-        do_action('geodir_before_remove_from_favorite', $post_id);
2312
+		/**
2313
+		 * Called before removing the post from favourites.
2314
+		 *
2315
+		 * @since 1.0.0
2316
+		 * @package GeoDirectory
2317
+		 * @param int $post_id The post ID.
2318
+		 */
2319
+		do_action('geodir_before_remove_from_favorite', $post_id);
2320 2320
 
2321
-        echo '<a href="javascript:void(0);"  title="' . $add_favourite_text . '" class="geodir-addtofav geodir-addtofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'add\');"><i class="'. $favourite_icon .'"></i> ' . $favourite_text . '</a>';
2321
+		echo '<a href="javascript:void(0);"  title="' . $add_favourite_text . '" class="geodir-addtofav geodir-addtofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'add\');"><i class="'. $favourite_icon .'"></i> ' . $favourite_text . '</a>';
2322 2322
 
2323
-        /**
2324
-         * Called after removing the post from favourites.
2325
-         *
2326
-         * @since 1.0.0
2327
-         * @package GeoDirectory
2328
-         * @param int $post_id The post ID.
2329
-         */
2330
-        do_action('geodir_after_remove_from_favorite', $post_id);
2323
+		/**
2324
+		 * Called after removing the post from favourites.
2325
+		 *
2326
+		 * @since 1.0.0
2327
+		 * @package GeoDirectory
2328
+		 * @param int $post_id The post ID.
2329
+		 */
2330
+		do_action('geodir_after_remove_from_favorite', $post_id);
2331 2331
 
2332
-    }
2332
+	}
2333 2333
 }
2334 2334
 
2335 2335
 if (!function_exists('geodir_favourite_html')) {
2336
-    /**
2337
-     * This function would display the html content for add to favorite or remove from favorite.
2338
-     *
2339
-     * @since 1.0.0
2340
-     * @package GeoDirectory
2341
-     * @global object $current_user Current user object.
2342
-     * @global object $post The current post object.
2343
-     * @param int $user_id The user ID.
2344
-     * @param int $post_id The post ID.
2345
-     */
2346
-    function geodir_favourite_html($user_id, $post_id)
2347
-    {
2348
-
2349
-        global $current_user, $post;
2350
-
2351
-        /**
2352
-         * Filter to modify "Add to Favorites" text
2353
-         *
2354
-         * You can use this filter to rename "Add to Favorites" text to something else.
2355
-         *
2356
-         * @since 1.0.0
2357
-         * @package GeoDirectory
2358
-         */
2359
-        $add_favourite_text = apply_filters('geodir_add_favourite_text', ADD_FAVOURITE_TEXT);
2360
-
2361
-        /**
2362
-         * Filter to modify "Favourite" text
2363
-         *
2364
-         * You can use this filter to rename "Favourite" text to something else.
2365
-         *
2366
-         * @since 1.0.0
2367
-         * @package GeoDirectory
2368
-         */
2369
-        $favourite_text = apply_filters('geodir_favourite_text', FAVOURITE_TEXT);
2370
-
2371
-        /**
2372
-         * Filter to modify "Unfavorite" text
2373
-         *
2374
-         * You can use this filter to rename "Unfavorite" text to something else.
2375
-         *
2376
-         * @since 1.0.0
2377
-         * @package GeoDirectory
2378
-         */
2379
-        $remove_favourite_text = apply_filters('geodir_remove_favourite_text', REMOVE_FAVOURITE_TEXT);
2380
-
2381
-        /**
2382
-         * Filter to modify "Remove from Favorites" text
2383
-         *
2384
-         * You can use this filter to rename "Remove from Favorites" text to something else.
2385
-         *
2386
-         * @since 1.0.0
2387
-         * @package GeoDirectory
2388
-         */
2389
-        $unfavourite_text = apply_filters('geodir_unfavourite_text', UNFAVOURITE_TEXT);
2390
-
2391
-        /**
2392
-         * Filter to modify "fa fa-heart" icon
2393
-         *
2394
-         * You can use this filter to change "fa fa-heart" icon to something else.
2395
-         *
2396
-         * @since 1.0.0
2397
-         * @package GeoDirectory
2398
-         */
2399
-        $favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
2400
-
2401
-        /**
2402
-         * Filter to modify "fa fa-heart" icon for "remove from favorites" link
2403
-         *
2404
-         * You can use this filter to change "fa fa-heart" icon to something else.
2405
-         *
2406
-         * @since 1.0.0
2407
-         * @package GeoDirectory
2408
-         */
2409
-        $unfavourite_icon = apply_filters('geodir_unfavourite_icon', 'fa fa-heart');
2410
-
2411
-        $user_meta_data = '';
2412
-        if (isset($current_user->data->ID))
2413
-            $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2414
-
2415
-        if (!empty($user_meta_data) && in_array($post_id, $user_meta_data)) {
2416
-            ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"  ><a
2336
+	/**
2337
+	 * This function would display the html content for add to favorite or remove from favorite.
2338
+	 *
2339
+	 * @since 1.0.0
2340
+	 * @package GeoDirectory
2341
+	 * @global object $current_user Current user object.
2342
+	 * @global object $post The current post object.
2343
+	 * @param int $user_id The user ID.
2344
+	 * @param int $post_id The post ID.
2345
+	 */
2346
+	function geodir_favourite_html($user_id, $post_id)
2347
+	{
2348
+
2349
+		global $current_user, $post;
2350
+
2351
+		/**
2352
+		 * Filter to modify "Add to Favorites" text
2353
+		 *
2354
+		 * You can use this filter to rename "Add to Favorites" text to something else.
2355
+		 *
2356
+		 * @since 1.0.0
2357
+		 * @package GeoDirectory
2358
+		 */
2359
+		$add_favourite_text = apply_filters('geodir_add_favourite_text', ADD_FAVOURITE_TEXT);
2360
+
2361
+		/**
2362
+		 * Filter to modify "Favourite" text
2363
+		 *
2364
+		 * You can use this filter to rename "Favourite" text to something else.
2365
+		 *
2366
+		 * @since 1.0.0
2367
+		 * @package GeoDirectory
2368
+		 */
2369
+		$favourite_text = apply_filters('geodir_favourite_text', FAVOURITE_TEXT);
2370
+
2371
+		/**
2372
+		 * Filter to modify "Unfavorite" text
2373
+		 *
2374
+		 * You can use this filter to rename "Unfavorite" text to something else.
2375
+		 *
2376
+		 * @since 1.0.0
2377
+		 * @package GeoDirectory
2378
+		 */
2379
+		$remove_favourite_text = apply_filters('geodir_remove_favourite_text', REMOVE_FAVOURITE_TEXT);
2380
+
2381
+		/**
2382
+		 * Filter to modify "Remove from Favorites" text
2383
+		 *
2384
+		 * You can use this filter to rename "Remove from Favorites" text to something else.
2385
+		 *
2386
+		 * @since 1.0.0
2387
+		 * @package GeoDirectory
2388
+		 */
2389
+		$unfavourite_text = apply_filters('geodir_unfavourite_text', UNFAVOURITE_TEXT);
2390
+
2391
+		/**
2392
+		 * Filter to modify "fa fa-heart" icon
2393
+		 *
2394
+		 * You can use this filter to change "fa fa-heart" icon to something else.
2395
+		 *
2396
+		 * @since 1.0.0
2397
+		 * @package GeoDirectory
2398
+		 */
2399
+		$favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
2400
+
2401
+		/**
2402
+		 * Filter to modify "fa fa-heart" icon for "remove from favorites" link
2403
+		 *
2404
+		 * You can use this filter to change "fa fa-heart" icon to something else.
2405
+		 *
2406
+		 * @since 1.0.0
2407
+		 * @package GeoDirectory
2408
+		 */
2409
+		$unfavourite_icon = apply_filters('geodir_unfavourite_icon', 'fa fa-heart');
2410
+
2411
+		$user_meta_data = '';
2412
+		if (isset($current_user->data->ID))
2413
+			$user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2414
+
2415
+		if (!empty($user_meta_data) && in_array($post_id, $user_meta_data)) {
2416
+			?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"  ><a
2417 2417
                 class="geodir-removetofav-icon" href="javascript:void(0);"
2418 2418
                 onclick="javascript:addToFavourite(<?php echo $post_id;?>,'remove');"
2419 2419
                 title="<?php echo $remove_favourite_text;?>"><i class="<?php echo $unfavourite_icon; ?>"></i> <?php echo $unfavourite_text;?>
2420 2420
             </a>   </span><?php
2421 2421
 
2422
-        } else {
2422
+		} else {
2423 2423
 
2424
-            if (!isset($current_user->data->ID) || $current_user->data->ID == '') {
2425
-                $script_text = 'javascript:window.location.href=\'' . geodir_login_url() . '\'';
2426
-            } else
2427
-                $script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')';
2424
+			if (!isset($current_user->data->ID) || $current_user->data->ID == '') {
2425
+				$script_text = 'javascript:window.location.href=\'' . geodir_login_url() . '\'';
2426
+			} else
2427
+				$script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')';
2428 2428
 
2429
-            ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"><a class="geodir-addtofav-icon"
2429
+			?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"><a class="geodir-addtofav-icon"
2430 2430
                                                                                         href="javascript:void(0);"
2431 2431
                                                                                         onclick="<?php echo $script_text;?>"
2432 2432
                                                                                         title="<?php echo $add_favourite_text;?>"><i
2433 2433
                     class="<?php echo $favourite_icon; ?>"></i> <?php echo $favourite_text;?></a></span>
2434 2434
         <?php }
2435
-    }
2435
+	}
2436 2436
 }
2437 2437
 
2438 2438
 
@@ -2449,54 +2449,54 @@  discard block
 block discarded – undo
2449 2449
 function geodir_get_cat_postcount($term = array())
2450 2450
 {
2451 2451
 
2452
-    if (!empty($term)) {
2452
+	if (!empty($term)) {
2453 2453
 
2454
-        global $wpdb, $plugin_prefix;
2454
+		global $wpdb, $plugin_prefix;
2455 2455
 
2456
-        $where = '';
2457
-        $join = '';
2458
-        if (get_query_var('gd_country') != '' || get_query_var('gd_region') != '' || get_query_var('gd_city') != '') {
2459
-            $taxonomy_obj = get_taxonomy($term->taxonomy);
2456
+		$where = '';
2457
+		$join = '';
2458
+		if (get_query_var('gd_country') != '' || get_query_var('gd_region') != '' || get_query_var('gd_city') != '') {
2459
+			$taxonomy_obj = get_taxonomy($term->taxonomy);
2460 2460
 
2461
-            $post_type = $taxonomy_obj->object_type[0];
2461
+			$post_type = $taxonomy_obj->object_type[0];
2462 2462
 
2463
-            $table = $plugin_prefix . $post_type . '_detail';
2463
+			$table = $plugin_prefix . $post_type . '_detail';
2464 2464
 
2465
-            /**
2466
-             * Filter to modify the 'join' query
2467
-             *
2468
-             * @since 1.0.0
2469
-             * @package GeoDirectory
2470
-             * @param object|array $term category / term object that need to be processed.
2471
-             * @param string $join The join query.
2472
-             */
2473
-            $join = apply_filters('geodir_cat_post_count_join', $join, $term);
2465
+			/**
2466
+			 * Filter to modify the 'join' query
2467
+			 *
2468
+			 * @since 1.0.0
2469
+			 * @package GeoDirectory
2470
+			 * @param object|array $term category / term object that need to be processed.
2471
+			 * @param string $join The join query.
2472
+			 */
2473
+			$join = apply_filters('geodir_cat_post_count_join', $join, $term);
2474 2474
 
2475
-            /**
2476
-             * Filter to modify the 'where' query
2477
-             *
2478
-             * @since 1.0.0
2479
-             * @package GeoDirectory
2480
-             * @param object|array $term category / term object that need to be processed.
2481
-             * @param string $where The where query.
2482
-             */
2483
-            $where = apply_filters('geodir_cat_post_count_where', $where, $term);
2475
+			/**
2476
+			 * Filter to modify the 'where' query
2477
+			 *
2478
+			 * @since 1.0.0
2479
+			 * @package GeoDirectory
2480
+			 * @param object|array $term category / term object that need to be processed.
2481
+			 * @param string $where The where query.
2482
+			 */
2483
+			$where = apply_filters('geodir_cat_post_count_where', $where, $term);
2484 2484
 
2485
-            $count_query = "SELECT count(post_id) FROM
2485
+			$count_query = "SELECT count(post_id) FROM
2486 2486
 							" . $table . " as pd " . $join . "
2487 2487
 							WHERE pd.post_status='publish' AND FIND_IN_SET('" . $term->term_id . "'," . $term->taxonomy . ") " . $where;
2488 2488
 
2489
-            $cat_post_count = $wpdb->get_var($count_query);
2490
-            if (empty($cat_post_count) || is_wp_error($cat_post_count))
2491
-                $cat_post_count = 0;
2489
+			$cat_post_count = $wpdb->get_var($count_query);
2490
+			if (empty($cat_post_count) || is_wp_error($cat_post_count))
2491
+				$cat_post_count = 0;
2492 2492
 
2493
-            return $cat_post_count;
2493
+			return $cat_post_count;
2494 2494
 
2495
-        } else
2495
+		} else
2496 2496
 
2497
-            return $term->count;
2498
-    }
2499
-    return false;
2497
+			return $term->count;
2498
+	}
2499
+	return false;
2500 2500
 
2501 2501
 }
2502 2502
 
@@ -2509,17 +2509,17 @@  discard block
 block discarded – undo
2509 2509
  */
2510 2510
 function geodir_allow_post_type_frontend()
2511 2511
 {
2512
-    $geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
2512
+	$geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
2513 2513
 
2514
-    if (!is_admin() && isset($_REQUEST['listing_type'])
2515
-        && !empty($geodir_allow_posttype_frontend)
2516
-        && !in_array($_REQUEST['listing_type'], $geodir_allow_posttype_frontend)
2517
-    ) {
2514
+	if (!is_admin() && isset($_REQUEST['listing_type'])
2515
+		&& !empty($geodir_allow_posttype_frontend)
2516
+		&& !in_array($_REQUEST['listing_type'], $geodir_allow_posttype_frontend)
2517
+	) {
2518 2518
 
2519
-        wp_redirect(home_url());
2520
-        exit;
2519
+		wp_redirect(home_url());
2520
+		exit;
2521 2521
 
2522
-    }
2522
+	}
2523 2523
 
2524 2524
 }
2525 2525
 
@@ -2536,20 +2536,20 @@  discard block
 block discarded – undo
2536 2536
  */
2537 2537
 function geodir_excerpt_length($length)
2538 2538
 {
2539
-    global $wp_query, $geodir_is_widget_listing;
2539
+	global $wp_query, $geodir_is_widget_listing;
2540 2540
 	if ($geodir_is_widget_listing) {
2541 2541
 		return $length;
2542 2542
 	}
2543 2543
 	
2544
-    if (isset($wp_query->query_vars['is_geodir_loop']) && $wp_query->query_vars['is_geodir_loop'] && get_option('geodir_desc_word_limit'))
2545
-        $length = get_option('geodir_desc_word_limit');
2546
-    elseif (get_query_var('excerpt_length'))
2547
-        $length = get_query_var('excerpt_length');
2544
+	if (isset($wp_query->query_vars['is_geodir_loop']) && $wp_query->query_vars['is_geodir_loop'] && get_option('geodir_desc_word_limit'))
2545
+		$length = get_option('geodir_desc_word_limit');
2546
+	elseif (get_query_var('excerpt_length'))
2547
+		$length = get_query_var('excerpt_length');
2548 2548
 
2549
-    if (geodir_is_page('author') && get_option('geodir_author_desc_word_limit'))
2550
-        $length = get_option('geodir_author_desc_word_limit');
2549
+	if (geodir_is_page('author') && get_option('geodir_author_desc_word_limit'))
2550
+		$length = get_option('geodir_author_desc_word_limit');
2551 2551
 
2552
-    return $length;
2552
+	return $length;
2553 2553
 }
2554 2554
 
2555 2555
 /**
@@ -2564,13 +2564,13 @@  discard block
 block discarded – undo
2564 2564
  */
2565 2565
 function geodir_excerpt_more($more)
2566 2566
 {
2567
-    global $post;
2568
-    $all_postypes = geodir_get_posttypes();
2569
-    if (is_array($all_postypes) && in_array($post->post_type, $all_postypes)) {
2570
-        return ' <a href="' . get_permalink($post->ID) . '">' . READ_MORE_TXT . '</a>';
2571
-    }
2567
+	global $post;
2568
+	$all_postypes = geodir_get_posttypes();
2569
+	if (is_array($all_postypes) && in_array($post->post_type, $all_postypes)) {
2570
+		return ' <a href="' . get_permalink($post->ID) . '">' . READ_MORE_TXT . '</a>';
2571
+	}
2572 2572
 
2573
-    return $more;
2573
+	return $more;
2574 2574
 }
2575 2575
 
2576 2576
 
@@ -2587,63 +2587,63 @@  discard block
 block discarded – undo
2587 2587
  */
2588 2588
 function geodir_update_markers_oncatedit($term_id, $tt_id, $taxonomy)
2589 2589
 {
2590
-    global $plugin_prefix, $wpdb;
2590
+	global $plugin_prefix, $wpdb;
2591 2591
 
2592
-    $gd_taxonomies = geodir_get_taxonomies();
2592
+	$gd_taxonomies = geodir_get_taxonomies();
2593 2593
 
2594
-    if (is_array($gd_taxonomies) && in_array($taxonomy, $gd_taxonomies)) {
2594
+	if (is_array($gd_taxonomies) && in_array($taxonomy, $gd_taxonomies)) {
2595 2595
 
2596
-        $geodir_post_type = geodir_get_taxonomy_posttype($taxonomy);
2597
-        $table = $plugin_prefix . $geodir_post_type . '_detail';
2596
+		$geodir_post_type = geodir_get_taxonomy_posttype($taxonomy);
2597
+		$table = $plugin_prefix . $geodir_post_type . '_detail';
2598 2598
 
2599
-        $path_parts = pathinfo($_REQUEST['ct_cat_icon']['src']);
2600
-        $term_icon = $path_parts['dirname'] . '/cat_icon_' . $term_id . '.png';
2599
+		$path_parts = pathinfo($_REQUEST['ct_cat_icon']['src']);
2600
+		$term_icon = $path_parts['dirname'] . '/cat_icon_' . $term_id . '.png';
2601 2601
 
2602
-        $posts = $wpdb->get_results(
2603
-            $wpdb->prepare(
2604
-                "SELECT post_id,post_title,post_latitude,post_longitude,default_category FROM " . $table . " WHERE FIND_IN_SET(%s,%1\$s ) ",
2605
-                array($term_id, $taxonomy)
2606
-            )
2607
-        );
2602
+		$posts = $wpdb->get_results(
2603
+			$wpdb->prepare(
2604
+				"SELECT post_id,post_title,post_latitude,post_longitude,default_category FROM " . $table . " WHERE FIND_IN_SET(%s,%1\$s ) ",
2605
+				array($term_id, $taxonomy)
2606
+			)
2607
+		);
2608 2608
 
2609
-        if (!empty($posts)):
2610
-            foreach ($posts as $post_obj) {
2609
+		if (!empty($posts)):
2610
+			foreach ($posts as $post_obj) {
2611 2611
 
2612
-                $lat = $post_obj->post_latitude;
2613
-                $lng = $post_obj->post_longitude;
2612
+				$lat = $post_obj->post_latitude;
2613
+				$lng = $post_obj->post_longitude;
2614 2614
 
2615
-                $json = '{';
2616
-                $json .= '"id":"' . $post_obj->post_id . '",';
2617
-                $json .= '"lat_pos": "' . $lat . '",';
2618
-                $json .= '"long_pos": "' . $lng . '",';
2619
-                $json .= '"marker_id":"' . $post_obj->post_id . '_' . $term_id . '",';
2620
-                $json .= '"icon":"' . $term_icon . '",';
2621
-                $json .= '"group":"catgroup' . $term_id . '"';
2622
-                $json .= '}';
2615
+				$json = '{';
2616
+				$json .= '"id":"' . $post_obj->post_id . '",';
2617
+				$json .= '"lat_pos": "' . $lat . '",';
2618
+				$json .= '"long_pos": "' . $lng . '",';
2619
+				$json .= '"marker_id":"' . $post_obj->post_id . '_' . $term_id . '",';
2620
+				$json .= '"icon":"' . $term_icon . '",';
2621
+				$json .= '"group":"catgroup' . $term_id . '"';
2622
+				$json .= '}';
2623 2623
 
2624
-                if ($post_obj->default_category == $term_id) {
2624
+				if ($post_obj->default_category == $term_id) {
2625 2625
 
2626
-                    $wpdb->query(
2627
-                        $wpdb->prepare(
2628
-                            "UPDATE " . $table . " SET marker_json = %s where post_id = %d",
2629
-                            array($json, $post_obj->post_id)
2630
-                        )
2631
-                    );
2632
-                }
2626
+					$wpdb->query(
2627
+						$wpdb->prepare(
2628
+							"UPDATE " . $table . " SET marker_json = %s where post_id = %d",
2629
+							array($json, $post_obj->post_id)
2630
+						)
2631
+					);
2632
+				}
2633 2633
 
2634
-                $wpdb->query(
2635
-                    $wpdb->prepare(
2636
-                        "UPDATE " . GEODIR_ICON_TABLE . " SET json = %s WHERE post_id = %d AND cat_id = %d",
2637
-                        array($json, $post_obj->post_id, $term_id)
2638
-                    )
2639
-                );
2634
+				$wpdb->query(
2635
+					$wpdb->prepare(
2636
+						"UPDATE " . GEODIR_ICON_TABLE . " SET json = %s WHERE post_id = %d AND cat_id = %d",
2637
+						array($json, $post_obj->post_id, $term_id)
2638
+					)
2639
+				);
2640 2640
 
2641
-            }
2641
+			}
2642 2642
 
2643 2643
 
2644
-        endif;
2644
+		endif;
2645 2645
 
2646
-    }
2646
+	}
2647 2647
 
2648 2648
 }
2649 2649
 
@@ -2657,14 +2657,14 @@  discard block
 block discarded – undo
2657 2657
  */
2658 2658
 function geodir_get_listing_author($listing_id = '')
2659 2659
 {
2660
-    if ($listing_id == '') {
2661
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2662
-            $listing_id = $_REQUEST['pid'];
2663
-        }
2664
-    }
2665
-    $listing = get_post(strip_tags($listing_id));
2666
-    $listing_author_id = $listing->post_author;
2667
-    return $listing_author_id;
2660
+	if ($listing_id == '') {
2661
+		if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2662
+			$listing_id = $_REQUEST['pid'];
2663
+		}
2664
+	}
2665
+	$listing = get_post(strip_tags($listing_id));
2666
+	$listing_author_id = $listing->post_author;
2667
+	return $listing_author_id;
2668 2668
 }
2669 2669
 
2670 2670
 
@@ -2679,11 +2679,11 @@  discard block
 block discarded – undo
2679 2679
  */
2680 2680
 function geodir_lisiting_belong_to_user($listing_id, $user_id)
2681 2681
 {
2682
-    $listing_author_id = geodir_get_listing_author($listing_id);
2683
-    if ($listing_author_id == $user_id)
2684
-        return true;
2685
-    else
2686
-        return false;
2682
+	$listing_author_id = geodir_get_listing_author($listing_id);
2683
+	if ($listing_author_id == $user_id)
2684
+		return true;
2685
+	else
2686
+		return false;
2687 2687
 
2688 2688
 }
2689 2689
 
@@ -2699,17 +2699,17 @@  discard block
 block discarded – undo
2699 2699
  */
2700 2700
 function geodir_listing_belong_to_current_user($listing_id = '', $exclude_admin = true)
2701 2701
 {
2702
-    global $current_user;
2703
-    if ($exclude_admin) {
2704
-        foreach ($current_user->caps as $key => $caps) {
2705
-            if (geodir_strtolower($key) == 'administrator') {
2706
-                return true;
2707
-                break;
2708
-            }
2709
-        }
2710
-    }
2711
-
2712
-    return geodir_lisiting_belong_to_user($listing_id, $current_user->ID);
2702
+	global $current_user;
2703
+	if ($exclude_admin) {
2704
+		foreach ($current_user->caps as $key => $caps) {
2705
+			if (geodir_strtolower($key) == 'administrator') {
2706
+				return true;
2707
+				break;
2708
+			}
2709
+		}
2710
+	}
2711
+
2712
+	return geodir_lisiting_belong_to_user($listing_id, $current_user->ID);
2713 2713
 }
2714 2714
 
2715 2715
 
@@ -2725,17 +2725,17 @@  discard block
 block discarded – undo
2725 2725
 function geodir_only_supportable_attachments_remove($file)
2726 2726
 {
2727 2727
 
2728
-    global $wpdb;
2728
+	global $wpdb;
2729 2729
 
2730
-    $matches = array();
2730
+	$matches = array();
2731 2731
 
2732
-    $pattern = '/-\d+x\d+\./';
2733
-    preg_match($pattern, $file, $matches, PREG_OFFSET_CAPTURE);
2732
+	$pattern = '/-\d+x\d+\./';
2733
+	preg_match($pattern, $file, $matches, PREG_OFFSET_CAPTURE);
2734 2734
 
2735
-    if (empty($matches))
2736
-        return '';
2737
-    else
2738
-        return $file;
2735
+	if (empty($matches))
2736
+		return '';
2737
+	else
2738
+		return $file;
2739 2739
 
2740 2740
 }
2741 2741
 
@@ -2752,78 +2752,78 @@  discard block
 block discarded – undo
2752 2752
 function geodir_set_wp_featured_image($post_id)
2753 2753
 {
2754 2754
 
2755
-    global $wpdb, $plugin_prefix;
2756
-    $uploads = wp_upload_dir();
2755
+	global $wpdb, $plugin_prefix;
2756
+	$uploads = wp_upload_dir();
2757 2757
 //	print_r($uploads ) ;
2758
-    $post_first_image = $wpdb->get_results(
2759
-        $wpdb->prepare(
2760
-            "SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d and menu_order = 1  ", array($post_id)
2761
-        )
2762
-    );
2763
-
2764
-    $old_attachment_name = '';
2765
-    $post_thumbnail_id = '';
2766
-    if (has_post_thumbnail($post_id)) {
2758
+	$post_first_image = $wpdb->get_results(
2759
+		$wpdb->prepare(
2760
+			"SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d and menu_order = 1  ", array($post_id)
2761
+		)
2762
+	);
2767 2763
 
2768
-        if (has_post_thumbnail($post_id)) {
2764
+	$old_attachment_name = '';
2765
+	$post_thumbnail_id = '';
2766
+	if (has_post_thumbnail($post_id)) {
2769 2767
 
2770
-            $post_thumbnail_id = get_post_thumbnail_id($post_id);
2768
+		if (has_post_thumbnail($post_id)) {
2771 2769
 
2772
-            $old_attachment_name = basename(get_attached_file($post_thumbnail_id));
2770
+			$post_thumbnail_id = get_post_thumbnail_id($post_id);
2773 2771
 
2774
-        }
2775
-    }
2772
+			$old_attachment_name = basename(get_attached_file($post_thumbnail_id));
2776 2773
 
2777
-    if (!empty($post_first_image)) {
2774
+		}
2775
+	}
2778 2776
 
2779
-        $post_type = get_post_type($post_id);
2777
+	if (!empty($post_first_image)) {
2780 2778
 
2781
-        $table_name = $plugin_prefix . $post_type . '_detail';
2779
+		$post_type = get_post_type($post_id);
2782 2780
 
2783
-        $wpdb->query("UPDATE " . $table_name . " SET featured_image='" . $post_first_image[0]->file . "' WHERE post_id =" . $post_id);
2781
+		$table_name = $plugin_prefix . $post_type . '_detail';
2784 2782
 
2785
-        $new_attachment_name = basename($post_first_image[0]->file);
2783
+		$wpdb->query("UPDATE " . $table_name . " SET featured_image='" . $post_first_image[0]->file . "' WHERE post_id =" . $post_id);
2786 2784
 
2787
-        if (geodir_strtolower($new_attachment_name) != geodir_strtolower($old_attachment_name)) {
2785
+		$new_attachment_name = basename($post_first_image[0]->file);
2788 2786
 
2789
-            if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete')) {
2787
+		if (geodir_strtolower($new_attachment_name) != geodir_strtolower($old_attachment_name)) {
2790 2788
 
2791
-                add_filter('wp_delete_file', 'geodir_only_supportable_attachments_remove');
2789
+			if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete')) {
2792 2790
 
2793
-                wp_delete_attachment($post_thumbnail_id);
2791
+				add_filter('wp_delete_file', 'geodir_only_supportable_attachments_remove');
2794 2792
 
2795
-            }
2796
-            $filename = $uploads['basedir'] . $post_first_image[0]->file;
2793
+				wp_delete_attachment($post_thumbnail_id);
2797 2794
 
2798
-            $attachment = array(
2799
-                'post_mime_type' => $post_first_image[0]->mime_type,
2800
-                'guid' => $uploads['baseurl'] . $post_first_image[0]->file,
2801
-                'post_parent' => $post_id,
2802
-                'post_title' => preg_replace('/\.[^.]+$/', '', $post_first_image[0]->title),
2803
-                'post_content' => ''
2804
-            );
2795
+			}
2796
+			$filename = $uploads['basedir'] . $post_first_image[0]->file;
2797
+
2798
+			$attachment = array(
2799
+				'post_mime_type' => $post_first_image[0]->mime_type,
2800
+				'guid' => $uploads['baseurl'] . $post_first_image[0]->file,
2801
+				'post_parent' => $post_id,
2802
+				'post_title' => preg_replace('/\.[^.]+$/', '', $post_first_image[0]->title),
2803
+				'post_content' => ''
2804
+			);
2805 2805
 
2806 2806
 
2807
-            $id = wp_insert_attachment($attachment, $filename, $post_id);
2807
+			$id = wp_insert_attachment($attachment, $filename, $post_id);
2808 2808
 
2809
-            if (!is_wp_error($id)) {
2809
+			if (!is_wp_error($id)) {
2810 2810
 
2811
-                set_post_thumbnail($post_id, $id);
2811
+				set_post_thumbnail($post_id, $id);
2812 2812
 
2813
-                require_once(ABSPATH . 'wp-admin/includes/image.php');
2814
-                wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename));
2813
+				require_once(ABSPATH . 'wp-admin/includes/image.php');
2814
+				wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename));
2815 2815
 
2816
-            }
2816
+			}
2817 2817
 
2818
-        }
2818
+		}
2819 2819
 
2820
-    } else {
2821
-        //set_post_thumbnail($post_id,-1);
2820
+	} else {
2821
+		//set_post_thumbnail($post_id,-1);
2822 2822
 
2823
-        if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete'))
2824
-            wp_delete_attachment($post_thumbnail_id);
2823
+		if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete'))
2824
+			wp_delete_attachment($post_thumbnail_id);
2825 2825
 
2826
-    }
2826
+	}
2827 2827
 }
2828 2828
 
2829 2829
 
@@ -2838,53 +2838,53 @@  discard block
 block discarded – undo
2838 2838
  */
2839 2839
 function gd_copy_original_translation()
2840 2840
 {
2841
-    if (function_exists('icl_object_id')) {
2842
-        global $wpdb, $table_prefix, $plugin_prefix;
2843
-        $post_id = absint($_POST['post_id']);
2844
-        $upload_dir = wp_upload_dir();
2845
-        $post_type = get_post_type($_POST['post_id']);
2846
-        $table = $plugin_prefix . $post_type . '_detail';
2847
-
2848
-        $post_arr = $wpdb->get_results($wpdb->prepare(
2849
-            "SELECT * FROM $wpdb->posts p JOIN " . $table . " gd ON gd.post_id=p.ID WHERE p.ID=%d LIMIT 1",
2850
-            array($post_id)
2851
-        )
2852
-            , ARRAY_A);
2853
-
2854
-        $arrImages = $wpdb->get_results(
2855
-            $wpdb->prepare(
2856
-                "SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC, ID DESC ",
2857
-                array('%image%', $post_id)
2858
-            )
2859
-        );
2860
-        if ($arrImages) {
2861
-            $image_arr = array();
2862
-            foreach ($arrImages as $img) {
2863
-                $image_arr[] = $upload_dir['baseurl'] . $img->file;
2864
-            }
2865
-            $comma_separated = implode(",", $image_arr);
2866
-            $post_arr[0]['post_images'] = $comma_separated;
2867
-        }
2868
-
2869
-
2870
-        $cats = $post_arr[0][$post_arr[0]['post_type'] . 'category'];
2871
-        $cat_arr = array_filter(explode(",", $cats));
2872
-        $trans_cat = array();
2873
-        foreach ($cat_arr as $cat) {
2874
-            $trans_cat[] = icl_object_id($cat, $post_arr[0]['post_type'] . 'category', false);
2875
-        }
2876
-
2877
-
2878
-        $post_arr[0]['categories'] = array_filter($trans_cat);
2841
+	if (function_exists('icl_object_id')) {
2842
+		global $wpdb, $table_prefix, $plugin_prefix;
2843
+		$post_id = absint($_POST['post_id']);
2844
+		$upload_dir = wp_upload_dir();
2845
+		$post_type = get_post_type($_POST['post_id']);
2846
+		$table = $plugin_prefix . $post_type . '_detail';
2847
+
2848
+		$post_arr = $wpdb->get_results($wpdb->prepare(
2849
+			"SELECT * FROM $wpdb->posts p JOIN " . $table . " gd ON gd.post_id=p.ID WHERE p.ID=%d LIMIT 1",
2850
+			array($post_id)
2851
+		)
2852
+			, ARRAY_A);
2853
+
2854
+		$arrImages = $wpdb->get_results(
2855
+			$wpdb->prepare(
2856
+				"SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC, ID DESC ",
2857
+				array('%image%', $post_id)
2858
+			)
2859
+		);
2860
+		if ($arrImages) {
2861
+			$image_arr = array();
2862
+			foreach ($arrImages as $img) {
2863
+				$image_arr[] = $upload_dir['baseurl'] . $img->file;
2864
+			}
2865
+			$comma_separated = implode(",", $image_arr);
2866
+			$post_arr[0]['post_images'] = $comma_separated;
2867
+		}
2868
+
2869
+
2870
+		$cats = $post_arr[0][$post_arr[0]['post_type'] . 'category'];
2871
+		$cat_arr = array_filter(explode(",", $cats));
2872
+		$trans_cat = array();
2873
+		foreach ($cat_arr as $cat) {
2874
+			$trans_cat[] = icl_object_id($cat, $post_arr[0]['post_type'] . 'category', false);
2875
+		}
2876
+
2877
+
2878
+		$post_arr[0]['categories'] = array_filter($trans_cat);
2879 2879
 //print_r($image_arr);
2880
-        //print_r($arrImages);
2881
-        //echo $_REQUEST['lang'];
2880
+		//print_r($arrImages);
2881
+		//echo $_REQUEST['lang'];
2882 2882
 //print_r($post_arr);
2883 2883
 //print_r($trans_cat);
2884
-        echo json_encode($post_arr[0]);
2884
+		echo json_encode($post_arr[0]);
2885 2885
 
2886
-    }
2887
-    die();
2886
+	}
2887
+	die();
2888 2888
 }
2889 2889
 
2890 2890
 
@@ -2904,54 +2904,54 @@  discard block
 block discarded – undo
2904 2904
 function geodir_get_custom_fields_type($listing_type = '')
2905 2905
 {
2906 2906
 
2907
-    global $wpdb;
2907
+	global $wpdb;
2908 2908
 
2909
-    if ($listing_type == '')
2910
-        $listing_type = 'gd_place';
2909
+	if ($listing_type == '')
2910
+		$listing_type = 'gd_place';
2911 2911
 
2912
-    $fields_info = array();
2912
+	$fields_info = array();
2913 2913
 
2914
-    $get_data = $wpdb->get_results(
2915
-        $wpdb->prepare(
2916
-            "SELECT htmlvar_name, field_type, extra_fields FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND is_active='1'",
2917
-            array($listing_type)
2918
-        )
2919
-    );
2914
+	$get_data = $wpdb->get_results(
2915
+		$wpdb->prepare(
2916
+			"SELECT htmlvar_name, field_type, extra_fields FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND is_active='1'",
2917
+			array($listing_type)
2918
+		)
2919
+	);
2920 2920
 
2921
-    if (!empty($get_data)) {
2921
+	if (!empty($get_data)) {
2922 2922
 
2923
-        foreach ($get_data as $data) {
2923
+		foreach ($get_data as $data) {
2924 2924
 
2925
-            if ($data->field_type == 'address') {
2925
+			if ($data->field_type == 'address') {
2926 2926
 
2927
-                $extra_fields = unserialize($data->extra_fields);
2927
+				$extra_fields = unserialize($data->extra_fields);
2928 2928
 
2929
-                $prefix = $data->htmlvar_name . '_';
2929
+				$prefix = $data->htmlvar_name . '_';
2930 2930
 
2931
-                $fields_info[$prefix . 'address'] = $data->field_type;
2931
+				$fields_info[$prefix . 'address'] = $data->field_type;
2932 2932
 
2933
-                if (isset($extra_fields['show_zip']) && $extra_fields['show_zip'])
2934
-                    $fields_info[$prefix . 'zip'] = $data->field_type;
2933
+				if (isset($extra_fields['show_zip']) && $extra_fields['show_zip'])
2934
+					$fields_info[$prefix . 'zip'] = $data->field_type;
2935 2935
 
2936
-            } else {
2936
+			} else {
2937 2937
 
2938
-                $fields_info[$data->htmlvar_name] = $data->field_type;
2938
+				$fields_info[$data->htmlvar_name] = $data->field_type;
2939 2939
 
2940
-            }
2940
+			}
2941 2941
 
2942
-        }
2942
+		}
2943 2943
 
2944
-    }
2944
+	}
2945 2945
 
2946
-    /**
2947
-     * Filter to modify custom fields info using listing post type.
2948
-     *
2949
-     * @since 1.0.0
2950
-     * @package GeoDirectory
2951
-     * @return array $fields_info Custom fields info.
2952
-     * @param string $listing_type The listing post type.
2953
-     */
2954
-    return apply_filters('geodir_get_custom_fields_type', $fields_info, $listing_type);
2946
+	/**
2947
+	 * Filter to modify custom fields info using listing post type.
2948
+	 *
2949
+	 * @since 1.0.0
2950
+	 * @package GeoDirectory
2951
+	 * @return array $fields_info Custom fields info.
2952
+	 * @param string $listing_type The listing post type.
2953
+	 */
2954
+	return apply_filters('geodir_get_custom_fields_type', $fields_info, $listing_type);
2955 2955
 }
2956 2956
 
2957 2957
 
@@ -2966,58 +2966,58 @@  discard block
 block discarded – undo
2966 2966
  */
2967 2967
 function geodir_function_post_updated($post_ID, $post_after, $post_before)
2968 2968
 {
2969
-    $post_type = get_post_type($post_ID);
2969
+	$post_type = get_post_type($post_ID);
2970 2970
 
2971
-    if ($post_type != '' && in_array($post_type, geodir_get_posttypes())) {
2972
-        // send notification to client when post moves from draft to publish
2973
-        if (!empty($post_after->post_status) && $post_after->post_status == 'publish' && !empty($post_before->post_status) && ($post_before->post_status == 'draft' || $post_before->post_status == 'auto-draft')) {
2974
-            $post_author_id = !empty($post_after->post_author) ? $post_after->post_author : NULL;
2975
-            $post_author_data = get_userdata($post_author_id);
2971
+	if ($post_type != '' && in_array($post_type, geodir_get_posttypes())) {
2972
+		// send notification to client when post moves from draft to publish
2973
+		if (!empty($post_after->post_status) && $post_after->post_status == 'publish' && !empty($post_before->post_status) && ($post_before->post_status == 'draft' || $post_before->post_status == 'auto-draft')) {
2974
+			$post_author_id = !empty($post_after->post_author) ? $post_after->post_author : NULL;
2975
+			$post_author_data = get_userdata($post_author_id);
2976 2976
 
2977
-            $to_name = geodir_get_client_name($post_author_id);
2977
+			$to_name = geodir_get_client_name($post_author_id);
2978 2978
 
2979
-            $from_email = geodir_get_site_email_id();
2980
-            $from_name = get_site_emailName();
2981
-            $to_email = $post_author_data->user_email;
2979
+			$from_email = geodir_get_site_email_id();
2980
+			$from_name = get_site_emailName();
2981
+			$to_email = $post_author_data->user_email;
2982 2982
 
2983
-            if (!is_email($to_email) && !empty($post_author_data->user_email)) {
2984
-                $to_email = $post_author_data->user_email;
2985
-            }
2983
+			if (!is_email($to_email) && !empty($post_author_data->user_email)) {
2984
+				$to_email = $post_author_data->user_email;
2985
+			}
2986 2986
 
2987
-            $message_type = 'listing_published';
2987
+			$message_type = 'listing_published';
2988 2988
 
2989
-            if (get_option('geodir_post_published_email_subject') == '') {
2990
-                update_option('geodir_post_published_email_subject', __('Listing Published Successfully', 'geodirectory'));
2991
-            }
2989
+			if (get_option('geodir_post_published_email_subject') == '') {
2990
+				update_option('geodir_post_published_email_subject', __('Listing Published Successfully', 'geodirectory'));
2991
+			}
2992 2992
 
2993
-            if (get_option('geodir_post_published_email_content') == '') {
2994
-                update_option('geodir_post_published_email_content', __("<p>Dear [#client_name#],</p><p>Your listing [#listing_link#] has been published. This email is just for your information.</p><p>[#listing_link#]</p><br><p>Thank you for your contribution.</p><p>[#site_name#]</p>", 'geodirectory'));
2995
-            }
2993
+			if (get_option('geodir_post_published_email_content') == '') {
2994
+				update_option('geodir_post_published_email_content', __("<p>Dear [#client_name#],</p><p>Your listing [#listing_link#] has been published. This email is just for your information.</p><p>[#listing_link#]</p><br><p>Thank you for your contribution.</p><p>[#site_name#]</p>", 'geodirectory'));
2995
+			}
2996 2996
 
2997
-            /**
2998
-             * Called before sending the email when listing gets published.
2999
-             *
3000
-             * @since 1.0.0
3001
-             * @package GeoDirectory
3002
-             * @param object $post_after The post object after update.
3003
-             * @param object $post_before The post object before update.
3004
-             */
3005
-            do_action('geodir_before_listing_published_email', $post_after, $post_before);
3006
-            if (is_email($to_email)) {
3007
-                geodir_sendEmail($from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID);
3008
-            }
2997
+			/**
2998
+			 * Called before sending the email when listing gets published.
2999
+			 *
3000
+			 * @since 1.0.0
3001
+			 * @package GeoDirectory
3002
+			 * @param object $post_after The post object after update.
3003
+			 * @param object $post_before The post object before update.
3004
+			 */
3005
+			do_action('geodir_before_listing_published_email', $post_after, $post_before);
3006
+			if (is_email($to_email)) {
3007
+				geodir_sendEmail($from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID);
3008
+			}
3009 3009
 
3010
-            /**
3011
-             * Called after sending the email when listing gets published.
3012
-             *
3013
-             * @since 1.0.0
3014
-             * @package GeoDirectory
3015
-             * @param object $post_after The post object after update.
3016
-             * @param object $post_before The post object before update.
3017
-             */
3018
-            do_action('geodir_after_listing_published_email', $post_after, $post_before);
3019
-        }
3020
-    }
3010
+			/**
3011
+			 * Called after sending the email when listing gets published.
3012
+			 *
3013
+			 * @since 1.0.0
3014
+			 * @package GeoDirectory
3015
+			 * @param object $post_after The post object after update.
3016
+			 * @param object $post_before The post object before update.
3017
+			 */
3018
+			do_action('geodir_after_listing_published_email', $post_after, $post_before);
3019
+		}
3020
+	}
3021 3021
 }
3022 3022
 
3023 3023
 add_action('wp_head', 'geodir_fb_like_thumbnail');
@@ -3031,14 +3031,14 @@  discard block
 block discarded – undo
3031 3031
  */
3032 3032
 function geodir_fb_like_thumbnail(){
3033 3033
 
3034
-    // return if not a single post
3035
-    if(!is_single()){return;}
3034
+	// return if not a single post
3035
+	if(!is_single()){return;}
3036 3036
 
3037
-    global $post;
3038
-    if(isset($post->featured_image) && $post->featured_image){
3039
-        $upload_dir = wp_upload_dir();
3040
-        $thumb = $upload_dir['baseurl'].$post->featured_image;
3041
-        echo "\n\n<!-- GD Facebook Like Thumbnail -->\n<link rel=\"image_src\" href=\"$thumb\" />\n<!-- End GD Facebook Like Thumbnail -->\n\n";
3037
+	global $post;
3038
+	if(isset($post->featured_image) && $post->featured_image){
3039
+		$upload_dir = wp_upload_dir();
3040
+		$thumb = $upload_dir['baseurl'].$post->featured_image;
3041
+		echo "\n\n<!-- GD Facebook Like Thumbnail -->\n<link rel=\"image_src\" href=\"$thumb\" />\n<!-- End GD Facebook Like Thumbnail -->\n\n";
3042 3042
 
3043
-    }
3043
+	}
3044 3044
 }
3045 3045
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +176 added lines, -125 removed lines patch added patch discarded remove patch
@@ -21,12 +21,13 @@  discard block
 block discarded – undo
21 21
 {
22 22
 
23 23
     $post_cat_ids = geodir_get_post_meta($post_id, $taxonomy);
24
-    if (!empty($post_cat_ids))
25
-        $post_cat_array = explode(",", trim($post_cat_ids, ","));
24
+    if (!empty($post_cat_ids)) {
25
+            $post_cat_array = explode(",", trim($post_cat_ids, ","));
26
+    }
26 27
 
27 28
     if (!isset($default_cat) || empty($default_cat)) {
28 29
         $default_cat = isset($post_cat_array[0]) ? $post_cat_array[0] : '';
29
-    }else{
30
+    } else{
30 31
         if(!is_int($default_cat)){
31 32
             $category = get_term_by('name', $default_cat, $taxonomy);
32 33
             if(isset($category->term_id)){
@@ -372,8 +373,9 @@  discard block
 block discarded – undo
372 373
             } elseif (trim($type) == 'file') {
373 374
                 if (isset($request_info[$name])) {
374 375
                     $request_files = array();
375
-                    if ($request_info[$name] != '')
376
-                        $request_files = explode(",", $request_info[$name]);
376
+                    if ($request_info[$name] != '') {
377
+                                            $request_files = explode(",", $request_info[$name]);
378
+                    }
377 379
 
378 380
                     $extrafields = $extrafields != '' ? maybe_unserialize($extrafields) : NULL;
379 381
                     geodir_save_post_file_fields($last_post_id, $name, $request_files, $extrafields);
@@ -428,15 +430,17 @@  discard block
 block discarded – undo
428 430
 
429 431
             foreach ($request_info['post_category'] as $taxonomy => $cat) {
430 432
 
431
-                if ($dummy)
432
-                    $post_category = $cat;
433
-                else {
433
+                if ($dummy) {
434
+                                    $post_category = $cat;
435
+                } else {
434 436
 
435
-                    if (!is_array($cat) && strstr($cat, ','))
436
-                        $cat = explode(',', $cat);
437
+                    if (!is_array($cat) && strstr($cat, ',')) {
438
+                                            $cat = explode(',', $cat);
439
+                    }
437 440
 
438
-                    if (!empty($cat) && is_array($cat))
439
-                        $post_category = array_map('intval', $cat);
441
+                    if (!empty($cat) && is_array($cat)) {
442
+                                            $post_category = array_map('intval', $cat);
443
+                    }
440 444
                 }
441 445
 
442 446
                 wp_set_object_terms($last_post_id, $post_category, $taxonomy);
@@ -454,11 +458,13 @@  discard block
 block discarded – undo
454 458
         if (isset($request_info['post_tags']) && !is_array($request_info['post_tags']) && !empty($request_info['post_tags'])) {
455 459
             $post_tags = explode(",", $request_info['post_tags']);
456 460
         } elseif (isset($request_info['post_tags']) && is_array($request_info['post_tags'])) {
457
-            if ($dummy)
458
-                $post_tags = $request_info['post_tags'];
461
+            if ($dummy) {
462
+                            $post_tags = $request_info['post_tags'];
463
+            }
459 464
         } else {
460
-            if ($dummy)
461
-                $post_tags = array($request_info['post_title']);
465
+            if ($dummy) {
466
+                            $post_tags = array($request_info['post_title']);
467
+            }
462 468
         }
463 469
 
464 470
         if (is_array($post_tags)) {
@@ -545,15 +551,17 @@  discard block
 block discarded – undo
545 551
 
546 552
     global $wpdb, $plugin_prefix, $post, $post_info;
547 553
 
548
-    if ($post_id == '' && !empty($post))
549
-        $post_id = $post->ID;
554
+    if ($post_id == '' && !empty($post)) {
555
+            $post_id = $post->ID;
556
+    }
550 557
 
551 558
     $post_type = get_post_type($post_id);
552 559
 
553 560
     $all_postypes = geodir_get_posttypes();
554 561
 
555
-    if (!in_array($post_type, $all_postypes))
556
-        return false;
562
+    if (!in_array($post_type, $all_postypes)) {
563
+            return false;
564
+    }
557 565
 
558 566
     $table = $plugin_prefix . $post_type . '_detail';
559 567
 
@@ -703,8 +711,9 @@  discard block
 block discarded – undo
703 711
             do_action('geodir_after_save_listinginfo', $postinfo_array, $post_id);
704 712
 
705 713
             return true;
706
-        } else
707
-            return false;
714
+        } else {
715
+                    return false;
716
+        }
708 717
 
709 718
     }
710 719
 }
@@ -758,8 +767,9 @@  discard block
 block discarded – undo
758 767
             }
759 768
 
760 769
 
761
-        } else
762
-            return false;
770
+        } else {
771
+                    return false;
772
+        }
763 773
     }
764 774
 }
765 775
 
@@ -790,8 +800,9 @@  discard block
 block discarded – undo
790 800
             $post_meta_set_query = '';
791 801
 
792 802
             foreach ($postmeta as $mkey) {
793
-                if ($mval != '')
794
-                    $post_meta_set_query .= $mkey . " = '', ";
803
+                if ($mval != '') {
804
+                                    $post_meta_set_query .= $mkey . " = '', ";
805
+                }
795 806
             }
796 807
 
797 808
             $post_meta_set_query = trim($post_meta_set_query, ", ");
@@ -821,8 +832,9 @@  discard block
 block discarded – undo
821 832
                 return true;
822 833
             }
823 834
 
824
-        } else
825
-            return false;
835
+        } else {
836
+                    return false;
837
+        }
826 838
     }
827 839
 }
828 840
 
@@ -852,8 +864,9 @@  discard block
 block discarded – undo
852 864
 
853 865
         $post_type = get_post_type($post_id);
854 866
 
855
-        if (!in_array($post_type, $all_postypes))
856
-            return false;
867
+        if (!in_array($post_type, $all_postypes)) {
868
+                    return false;
869
+        }
857 870
 
858 871
         $table = $plugin_prefix . $post_type . '_detail';
859 872
 
@@ -862,11 +875,13 @@  discard block
 block discarded – undo
862 875
             if ($meta_value = $wpdb->get_var($wpdb->prepare("SELECT " . $meta_key . " from " . $table . " where post_id = %d", array($post_id)))) {
863 876
                 $meta_value = maybe_serialize($meta_value);
864 877
                 return $meta_value;
865
-            } else
866
-                return false;
878
+            } else {
879
+                            return false;
880
+            }
867 881
 
868
-        } else
869
-            return false;
882
+        } else {
883
+                    return false;
884
+        }
870 885
     }
871 886
 }
872 887
 
@@ -997,7 +1012,7 @@  discard block
 block discarded – undo
997 1012
                             if (isset($uploaded['error']) && empty($uploaded['error'])) {
998 1013
                                 $new_name = basename($uploaded['file']);
999 1014
                                 $uploaded_file = $uploaded;
1000
-                            }else{
1015
+                            } else{
1001 1016
                                 print_r($uploaded);exit;
1002 1017
                             }
1003 1018
                             $external_img = false;
@@ -1022,8 +1037,9 @@  discard block
 block discarded – undo
1022 1037
                                 $file_path = $curr_img_dir . '/' . $filename;
1023 1038
                             }
1024 1039
 
1025
-                            if ($curr_img_dir != $geodir_uploaddir && file_exists($img_path))
1026
-                                unlink($img_path);
1040
+                            if ($curr_img_dir != $geodir_uploaddir && file_exists($img_path)) {
1041
+                                                            unlink($img_path);
1042
+                            }
1027 1043
                         }
1028 1044
 
1029 1045
                         if (!empty($uploaded_file)) {
@@ -1052,8 +1068,9 @@  discard block
 block discarded – undo
1052 1068
                             $attachment_set = '';
1053 1069
 
1054 1070
                             foreach ($attachment as $key => $val) {
1055
-                                if ($val != '')
1056
-                                    $attachment_set .= $key . " = '" . $val . "', ";
1071
+                                if ($val != '') {
1072
+                                                                    $attachment_set .= $key . " = '" . $val . "', ";
1073
+                                }
1057 1074
                             }
1058 1075
 
1059 1076
                             $attachment_set = trim($attachment_set, ", ");
@@ -1078,8 +1095,9 @@  discard block
 block discarded – undo
1078 1095
                         )
1079 1096
                     );
1080 1097
 
1081
-                    if ($menu_order == 1)
1082
-                        $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id)));
1098
+                    if ($menu_order == 1) {
1099
+                                            $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id)));
1100
+                    }
1083 1101
 
1084 1102
                 }
1085 1103
 
@@ -1120,8 +1138,9 @@  discard block
 block discarded – undo
1120 1138
 
1121 1139
         $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE " . $valid_files_condition . " post_id = %d", $remove_files));
1122 1140
 
1123
-        if (!empty($invalid_files))
1124
-            geodir_remove_attachments($invalid_files);
1141
+        if (!empty($invalid_files)) {
1142
+                    geodir_remove_attachments($invalid_files);
1143
+        }
1125 1144
     }
1126 1145
 
1127 1146
 }
@@ -1174,16 +1193,19 @@  discard block
 block discarded – undo
1174 1193
 function geodir_delete_directory($dirname)
1175 1194
 {
1176 1195
     $dir_handle = '';
1177
-    if (is_dir($dirname))
1178
-        $dir_handle = opendir($dirname);
1179
-    if (!$dir_handle)
1180
-        return false;
1196
+    if (is_dir($dirname)) {
1197
+            $dir_handle = opendir($dirname);
1198
+    }
1199
+    if (!$dir_handle) {
1200
+            return false;
1201
+    }
1181 1202
     while ($file = readdir($dir_handle)) {
1182 1203
         if ($file != "." && $file != "..") {
1183
-            if (!is_dir($dirname . "/" . $file))
1184
-                unlink($dirname . "/" . $file);
1185
-            else
1186
-                geodir_delete_directory($dirname . '/' . $file);
1204
+            if (!is_dir($dirname . "/" . $file)) {
1205
+                            unlink($dirname . "/" . $file);
1206
+            } else {
1207
+                            geodir_delete_directory($dirname . '/' . $file);
1208
+            }
1187 1209
         }
1188 1210
     }
1189 1211
     closedir($dir_handle);
@@ -1212,8 +1234,9 @@  discard block
 block discarded – undo
1212 1234
             foreach ($postcurr_images as $postimg) {
1213 1235
                 $image_name_arr = explode('/', $postimg->src);
1214 1236
                 $filename = end($image_name_arr);
1215
-                if (file_exists($uploads_dir . '/' . $filename))
1216
-                    unlink($uploads_dir . '/' . $filename);
1237
+                if (file_exists($uploads_dir . '/' . $filename)) {
1238
+                                    unlink($uploads_dir . '/' . $filename);
1239
+                }
1217 1240
             }
1218 1241
 
1219 1242
         } // endif
@@ -1265,8 +1288,9 @@  discard block
 block discarded – undo
1265 1288
 
1266 1289
             $file_info = pathinfo($file);
1267 1290
             $sub_dir = '';
1268
-            if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
1269
-                $sub_dir = stripslashes_deep($file_info['dirname']);
1291
+            if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') {
1292
+                            $sub_dir = stripslashes_deep($file_info['dirname']);
1293
+            }
1270 1294
 
1271 1295
             $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
1272 1296
             $uploads_baseurl = $uploads['baseurl'];
@@ -1306,9 +1330,9 @@  discard block
 block discarded – undo
1306 1330
                 $default_cat = geodir_get_post_meta($post_id, 'default_category', true);
1307 1331
             }
1308 1332
 
1309
-            if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type))
1310
-                $default_img = $default_catimg['src'];
1311
-            elseif ($no_image) {
1333
+            if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type)) {
1334
+                            $default_img = $default_catimg['src'];
1335
+            } elseif ($no_image) {
1312 1336
                 $default_img = get_option('geodir_listing_no_img');
1313 1337
             }
1314 1338
 
@@ -1336,10 +1360,13 @@  discard block
 block discarded – undo
1336 1360
             }
1337 1361
         }
1338 1362
 
1339
-        if (!empty($img_arr))
1340
-            return (object)$img_arr;//return (object)array( 'src' => $file_url, 'path' => $file_path );
1341
-        else
1342
-            return false;
1363
+        if (!empty($img_arr)) {
1364
+                    return (object)$img_arr;
1365
+        }
1366
+        //return (object)array( 'src' => $file_url, 'path' => $file_path );
1367
+        else {
1368
+                    return false;
1369
+        }
1343 1370
     }
1344 1371
 }
1345 1372
 
@@ -1366,8 +1393,9 @@  discard block
 block discarded – undo
1366 1393
             echo $html;
1367 1394
         } elseif (!empty($html)) {
1368 1395
             return $html;
1369
-        } else
1370
-            return false;
1396
+        } else {
1397
+                    return false;
1398
+        }
1371 1399
     }
1372 1400
 }
1373 1401
 
@@ -1395,8 +1423,9 @@  discard block
 block discarded – undo
1395 1423
         }
1396 1424
         $not_featured = '';
1397 1425
         $sub_dir = '';
1398
-        if (!$add_featured)
1399
-            $not_featured = " AND is_featured = 0 ";
1426
+        if (!$add_featured) {
1427
+                    $not_featured = " AND is_featured = 0 ";
1428
+        }
1400 1429
 
1401 1430
         $arrImages = $wpdb->get_results(
1402 1431
             $wpdb->prepare(
@@ -1417,8 +1446,9 @@  discard block
 block discarded – undo
1417 1446
 
1418 1447
                 $file_info = pathinfo($attechment->file);
1419 1448
 
1420
-                if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
1421
-                    $sub_dir = stripslashes_deep($file_info['dirname']);
1449
+                if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') {
1450
+                                    $sub_dir = stripslashes_deep($file_info['dirname']);
1451
+                }
1422 1452
 
1423 1453
                 $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
1424 1454
                 $uploads_baseurl = $uploads['baseurl'];
@@ -1459,9 +1489,9 @@  discard block
 block discarded – undo
1459 1489
             $default_img = '';
1460 1490
             $default_cat = geodir_get_post_meta($post_id, 'default_category', true);
1461 1491
             $post_type = get_post_type($post_id);
1462
-            if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type))
1463
-                $default_img = $default_catimg['src'];
1464
-            elseif ($no_images) {
1492
+            if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type)) {
1493
+                            $default_img = $default_catimg['src'];
1494
+            } elseif ($no_images) {
1465 1495
                 $default_img = get_option('geodir_listing_no_img');
1466 1496
             }
1467 1497
 
@@ -1492,8 +1522,9 @@  discard block
 block discarded – undo
1492 1522
                 $return_arr[] = (object)$img_arr;
1493 1523
 
1494 1524
                 return $return_arr;
1495
-            } else
1496
-                return false;
1525
+            } else {
1526
+                            return false;
1527
+            }
1497 1528
         }
1498 1529
     }
1499 1530
 }
@@ -1551,14 +1582,14 @@  discard block
 block discarded – undo
1551 1582
                         $width_per = round(((($image->width * ($max_size->h / $image->height)) / $max_size->w) * 100), 2);
1552 1583
                     } elseif ($image->width < ($max_size->h)) {
1553 1584
                         $width_per = round((($image->width / $max_size->w) * 100), 2);
1554
-                    } else
1555
-                        $width_per = 100;
1585
+                    } else {
1586
+                                            $width_per = 100;
1587
+                    }
1556 1588
                 }
1557 1589
 
1558 1590
                 if (is_admin() && !isset($_REQUEST['geodir_ajax'])){
1559 1591
                     $html = '<div class="geodir_thumbnail"><img style="max-height:' . $max_size->h . 'px;" alt="place image" src="' . $image->src . '"  /></div>';
1560
-                }
1561
-                else{
1592
+                } else{
1562 1593
                     $html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>';
1563 1594
                 }
1564 1595
 
@@ -1570,8 +1601,9 @@  discard block
 block discarded – undo
1570 1601
             echo $html;
1571 1602
         } elseif (!empty($html)) {
1572 1603
             return $html;
1573
-        } else
1574
-            return false;
1604
+        } else {
1605
+                    return false;
1606
+        }
1575 1607
 
1576 1608
     }
1577 1609
 }
@@ -1610,8 +1642,9 @@  discard block
 block discarded – undo
1610 1642
                 $post_obj = get_post($post_id);
1611 1643
 
1612 1644
                 $cat_ids = array('0');
1613
-                if (is_array($tt_ids))
1614
-                    $cat_ids = $tt_ids;
1645
+                if (is_array($tt_ids)) {
1646
+                                    $cat_ids = $tt_ids;
1647
+                }
1615 1648
 
1616 1649
 
1617 1650
                 if (!empty($cat_ids)) {
@@ -1668,8 +1701,9 @@  discard block
 block discarded – undo
1668 1701
                         $json .= '}';
1669 1702
 
1670 1703
 
1671
-                        if ($cat_id == geodir_get_post_meta($post_id, 'default_category', true))
1672
-                            $post_marker_json = $json;
1704
+                        if ($cat_id == geodir_get_post_meta($post_id, 'default_category', true)) {
1705
+                                                    $post_marker_json = $json;
1706
+                        }
1673 1707
 
1674 1708
 
1675 1709
                         if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . GEODIR_ICON_TABLE . " WHERE post_id = %d AND cat_id = %d", array($post_id, $cat_id)))) {
@@ -1700,10 +1734,13 @@  discard block
 block discarded – undo
1700 1734
                 if (!empty($post_term) && is_array($post_term)) {
1701 1735
                     $categories = implode(',', $post_term);
1702 1736
 
1703
-                    if ($categories != '' && $categories != 0) $categories = ',' . $categories . ',';
1737
+                    if ($categories != '' && $categories != 0) {
1738
+                    	$categories = ',' . $categories . ',';
1739
+                    }
1704 1740
 
1705
-                    if (empty($post_marker_json))
1706
-                        $post_marker_json = isset($json) ? $json : '';
1741
+                    if (empty($post_marker_json)) {
1742
+                                            $post_marker_json = isset($json) ? $json : '';
1743
+                    }
1707 1744
 
1708 1745
                     if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
1709 1746
 
@@ -1742,8 +1779,9 @@  discard block
 block discarded – undo
1742 1779
 
1743 1780
                                 }
1744 1781
 
1745
-                                if ($default_category == '')
1746
-                                    $default_category = $categories[0];
1782
+                                if ($default_category == '') {
1783
+                                                                    $default_category = $categories[0];
1784
+                                }
1747 1785
 
1748 1786
                                 geodir_set_postcat_structure($post_id, $taxonomy, $default_category, '');
1749 1787
 
@@ -1887,7 +1925,7 @@  discard block
 block discarded – undo
1887 1925
                                     } ?>"><img alt="bubble image" style="max-height:50px;"
1888 1926
                                                src="<?php echo $post_images[0]; ?>"/></a></div>
1889 1927
                             <?php
1890
-                            }else{
1928
+                            } else{
1891 1929
                                 echo '<div class="geodir-bubble_image"></div>';
1892 1930
                             }
1893 1931
                         } else {
@@ -1895,7 +1933,7 @@  discard block
 block discarded – undo
1895 1933
                                 ?>
1896 1934
                                 <div class="geodir-bubble_image"><a href="<?php echo $plink; ?>"><?php echo $image; ?></a></div>
1897 1935
                             <?php
1898
-                            }else{
1936
+                            } else{
1899 1937
                                 echo '<div class="geodir-bubble_image"></div>';
1900 1938
                             }
1901 1939
                         }
@@ -1986,10 +2024,11 @@  discard block
 block discarded – undo
1986 2024
      */
1987 2025
     function geodir_new_post_default_status()
1988 2026
     {
1989
-        if (get_option('geodir_new_post_default_status'))
1990
-            return get_option('geodir_new_post_default_status');
1991
-        else
1992
-            return 'publish';
2027
+        if (get_option('geodir_new_post_default_status')) {
2028
+                    return get_option('geodir_new_post_default_status');
2029
+        } else {
2030
+                    return 'publish';
2031
+        }
1993 2032
 
1994 2033
     }
1995 2034
 }
@@ -2140,8 +2179,9 @@  discard block
 block discarded – undo
2140 2179
 
2141 2180
         $all_postypes = geodir_get_posttypes();
2142 2181
 
2143
-        if (!in_array($post_type, $all_postypes))
2144
-            return false;
2182
+        if (!in_array($post_type, $all_postypes)) {
2183
+                    return false;
2184
+        }
2145 2185
 
2146 2186
         $table = $plugin_prefix . $post_type . '_detail';
2147 2187
 
@@ -2409,8 +2449,9 @@  discard block
 block discarded – undo
2409 2449
         $unfavourite_icon = apply_filters('geodir_unfavourite_icon', 'fa fa-heart');
2410 2450
 
2411 2451
         $user_meta_data = '';
2412
-        if (isset($current_user->data->ID))
2413
-            $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2452
+        if (isset($current_user->data->ID)) {
2453
+                    $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2454
+        }
2414 2455
 
2415 2456
         if (!empty($user_meta_data) && in_array($post_id, $user_meta_data)) {
2416 2457
             ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"  ><a
@@ -2423,8 +2464,9 @@  discard block
 block discarded – undo
2423 2464
 
2424 2465
             if (!isset($current_user->data->ID) || $current_user->data->ID == '') {
2425 2466
                 $script_text = 'javascript:window.location.href=\'' . geodir_login_url() . '\'';
2426
-            } else
2427
-                $script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')';
2467
+            } else {
2468
+                            $script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')';
2469
+            }
2428 2470
 
2429 2471
             ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"><a class="geodir-addtofav-icon"
2430 2472
                                                                                         href="javascript:void(0);"
@@ -2487,14 +2529,16 @@  discard block
 block discarded – undo
2487 2529
 							WHERE pd.post_status='publish' AND FIND_IN_SET('" . $term->term_id . "'," . $term->taxonomy . ") " . $where;
2488 2530
 
2489 2531
             $cat_post_count = $wpdb->get_var($count_query);
2490
-            if (empty($cat_post_count) || is_wp_error($cat_post_count))
2491
-                $cat_post_count = 0;
2532
+            if (empty($cat_post_count) || is_wp_error($cat_post_count)) {
2533
+                            $cat_post_count = 0;
2534
+            }
2492 2535
 
2493 2536
             return $cat_post_count;
2494 2537
 
2495
-        } else
2496
-
2497
-            return $term->count;
2538
+        } else {
2539
+        
2540
+            return $term->count;
2541
+        }
2498 2542
     }
2499 2543
     return false;
2500 2544
 
@@ -2541,13 +2585,15 @@  discard block
 block discarded – undo
2541 2585
 		return $length;
2542 2586
 	}
2543 2587
 	
2544
-    if (isset($wp_query->query_vars['is_geodir_loop']) && $wp_query->query_vars['is_geodir_loop'] && get_option('geodir_desc_word_limit'))
2545
-        $length = get_option('geodir_desc_word_limit');
2546
-    elseif (get_query_var('excerpt_length'))
2547
-        $length = get_query_var('excerpt_length');
2588
+    if (isset($wp_query->query_vars['is_geodir_loop']) && $wp_query->query_vars['is_geodir_loop'] && get_option('geodir_desc_word_limit')) {
2589
+            $length = get_option('geodir_desc_word_limit');
2590
+    } elseif (get_query_var('excerpt_length')) {
2591
+            $length = get_query_var('excerpt_length');
2592
+    }
2548 2593
 
2549
-    if (geodir_is_page('author') && get_option('geodir_author_desc_word_limit'))
2550
-        $length = get_option('geodir_author_desc_word_limit');
2594
+    if (geodir_is_page('author') && get_option('geodir_author_desc_word_limit')) {
2595
+            $length = get_option('geodir_author_desc_word_limit');
2596
+    }
2551 2597
 
2552 2598
     return $length;
2553 2599
 }
@@ -2680,10 +2726,11 @@  discard block
 block discarded – undo
2680 2726
 function geodir_lisiting_belong_to_user($listing_id, $user_id)
2681 2727
 {
2682 2728
     $listing_author_id = geodir_get_listing_author($listing_id);
2683
-    if ($listing_author_id == $user_id)
2684
-        return true;
2685
-    else
2686
-        return false;
2729
+    if ($listing_author_id == $user_id) {
2730
+            return true;
2731
+    } else {
2732
+            return false;
2733
+    }
2687 2734
 
2688 2735
 }
2689 2736
 
@@ -2732,10 +2779,11 @@  discard block
 block discarded – undo
2732 2779
     $pattern = '/-\d+x\d+\./';
2733 2780
     preg_match($pattern, $file, $matches, PREG_OFFSET_CAPTURE);
2734 2781
 
2735
-    if (empty($matches))
2736
-        return '';
2737
-    else
2738
-        return $file;
2782
+    if (empty($matches)) {
2783
+            return '';
2784
+    } else {
2785
+            return $file;
2786
+    }
2739 2787
 
2740 2788
 }
2741 2789
 
@@ -2820,8 +2868,9 @@  discard block
 block discarded – undo
2820 2868
     } else {
2821 2869
         //set_post_thumbnail($post_id,-1);
2822 2870
 
2823
-        if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete'))
2824
-            wp_delete_attachment($post_thumbnail_id);
2871
+        if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete')) {
2872
+                    wp_delete_attachment($post_thumbnail_id);
2873
+        }
2825 2874
 
2826 2875
     }
2827 2876
 }
@@ -2906,8 +2955,9 @@  discard block
 block discarded – undo
2906 2955
 
2907 2956
     global $wpdb;
2908 2957
 
2909
-    if ($listing_type == '')
2910
-        $listing_type = 'gd_place';
2958
+    if ($listing_type == '') {
2959
+            $listing_type = 'gd_place';
2960
+    }
2911 2961
 
2912 2962
     $fields_info = array();
2913 2963
 
@@ -2930,8 +2980,9 @@  discard block
 block discarded – undo
2930 2980
 
2931 2981
                 $fields_info[$prefix . 'address'] = $data->field_type;
2932 2982
 
2933
-                if (isset($extra_fields['show_zip']) && $extra_fields['show_zip'])
2934
-                    $fields_info[$prefix . 'zip'] = $data->field_type;
2983
+                if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
2984
+                                    $fields_info[$prefix . 'zip'] = $data->field_type;
2985
+                }
2935 2986
 
2936 2987
             } else {
2937 2988
 
Please login to merge, or discard this patch.
geodirectory-admin/admin_template_tags.php 3 patches
Spacing   +96 added lines, -96 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
                          * @param array $tabs The array of tabs to display.
53 53
                          */
54 54
                         $tabs = apply_filters('geodir_settings_tabs_array', $tabs);
55
-                        update_option('geodir_tabs', $tabs);// Important to show settings menu dropdown
55
+                        update_option('geodir_tabs', $tabs); // Important to show settings menu dropdown
56 56
 
57 57
                         foreach ($tabs as $name => $args) :
58 58
                             $label = $args['label'];
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
                     jQuery('.geodirectory-nav-tab-wrapper a').click(function () {
223 223
                         if (changed) {
224 224
                             window.onbeforeunload = function () {
225
-                                return '<?php echo __( 'The changes you made will be lost if you navigate away from this page.', 'geodirectory'); ?>';
225
+                                return '<?php echo __('The changes you made will be lost if you navigate away from this page.', 'geodirectory'); ?>';
226 226
                             }
227 227
                         } else {
228 228
                             window.onbeforeunload = '';
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
             ?>
328 328
 
329 329
             <p class="submit">
330
-            <input <?php echo $hide_save_button;?> name="save" class="button-primary" type="submit" value="<?php _e('Save changes', 'geodirectory'); ?>" />
330
+            <input <?php echo $hide_save_button; ?> name="save" class="button-primary" type="submit" value="<?php _e('Save changes', 'geodirectory'); ?>" />
331 331
             <input type="hidden" name="subtab" id="last_tab" />
332 332
             </p>
333 333
             
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 
397 397
                     ?>
398 398
 
399
-                    <h3><?php _e('Set Default Location', 'geodirectory');?></h3>
399
+                    <h3><?php _e('Set Default Location', 'geodirectory'); ?></h3>
400 400
 
401 401
                     <input type="hidden" name="add_location" value="location">
402 402
 
@@ -404,16 +404,16 @@  discard block
 block discarded – undo
404 404
                         echo $location_result->location_id;
405 405
                     } ?>">
406 406
 
407
-                    <input type="hidden" name="address" id="<?php echo $prefix;?>address" value="">
407
+                    <input type="hidden" name="address" id="<?php echo $prefix; ?>address" value="">
408 408
 
409 409
                     <table class="form-table default_location_form">
410 410
                         <tbody>
411 411
                         <tr valign="top" class="single_select_page">
412
-                            <th class="titledesc" scope="row"><?php _e('City', 'geodirectory');?></th>
412
+                            <th class="titledesc" scope="row"><?php _e('City', 'geodirectory'); ?></th>
413 413
                             <td class="forminp">
414 414
                                 <div class="gtd-formfeild required">
415 415
                                     <input class="require" type="text" size="80" style="width:440px"
416
-                                           id="<?php echo $prefix;?>city" name="city"
416
+                                           id="<?php echo $prefix; ?>city" name="city"
417 417
                                            value="<?php if (isset($location_result->city)) {
418 418
                                                echo $location_result->city;
419 419
                                            } ?>"/>
@@ -425,11 +425,11 @@  discard block
 block discarded – undo
425 425
                             </td>
426 426
                         </tr>
427 427
                         <tr valign="top" class="single_select_page">
428
-                            <th class="titledesc" scope="row"><?php _e('Region', 'geodirectory');?></th>
428
+                            <th class="titledesc" scope="row"><?php _e('Region', 'geodirectory'); ?></th>
429 429
                             <td class="forminp">
430 430
                                 <div class="gtd-formfeild required">
431 431
                                     <input class="require" type="text" size="80" style="width:440px"
432
-                                           id="<?php echo $prefix;?>region" name="region"
432
+                                           id="<?php echo $prefix; ?>region" name="region"
433 433
                                            value="<?php if (isset($location_result->region)) {
434 434
                                                echo $location_result->region;
435 435
                                            } ?>"/>
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
                             </td>
442 442
                         </tr>
443 443
                         <tr valign="top" class="single_select_page">
444
-                            <th class="titledesc" scope="row"><?php _e('Country', 'geodirectory');?></th>
444
+                            <th class="titledesc" scope="row"><?php _e('Country', 'geodirectory'); ?></th>
445 445
                             <td class="forminp">
446 446
                                 <div class="gtd-formfeild required" style="padding-top:10px;">
447 447
                                     <?php
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
                                     ?>
451 451
                                     <select id="<?php echo $prefix ?>country" class="chosen_select"
452 452
                                             data-location_type="country" name="<?php echo $prefix ?>country"
453
-                                            data-placeholder="<?php _e('Choose a country.', 'geodirectory');?>"
453
+                                            data-placeholder="<?php _e('Choose a country.', 'geodirectory'); ?>"
454 454
                                             data-addsearchtermonnorecord="1" data-ajaxchosen="0" data-autoredirect="0"
455 455
                                             data-showeverywhere="0">
456 456
                                         <?php geodir_get_country_dl($country, $prefix); ?>
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
                         </tr>
468 468
                         <tr valign="top" class="single_select_page">
469 469
                             <th class="titledesc"
470
-                                scope="row"><?php _e('Set Location on Map', 'geodirectory');?></th>
470
+                                scope="row"><?php _e('Set Location on Map', 'geodirectory'); ?></th>
471 471
                             <td class="forminp">
472 472
                                 <?php
473 473
                                 /**
@@ -475,15 +475,15 @@  discard block
 block discarded – undo
475 475
                                  *
476 476
                                  * @since 1.0.0
477 477
                                  */
478
-                                include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php");?>
478
+                                include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php"); ?>
479 479
                             </td>
480 480
                         </tr>
481 481
                         <tr valign="top" class="single_select_page">
482
-                            <th class="titledesc" scope="row"><?php _e('City Latitude', 'geodirectory');?></th>
482
+                            <th class="titledesc" scope="row"><?php _e('City Latitude', 'geodirectory'); ?></th>
483 483
                             <td class="forminp">
484 484
                                 <div class="gtd-formfeild required" style="padding-top:10px;">
485 485
                                     <input type="text" class="require" size="80" style="width:440px"
486
-                                           id="<?php echo $prefix;?>latitude" name="latitude"
486
+                                           id="<?php echo $prefix; ?>latitude" name="latitude"
487 487
                                            value="<?php if (isset($location_result->city_latitude)) {
488 488
                                                echo $location_result->city_latitude;
489 489
                                            } ?>"/>
@@ -496,11 +496,11 @@  discard block
 block discarded – undo
496 496
                         </tr>
497 497
                         <tr valign="top" class="single_select_page">
498 498
                             <th class="titledesc"
499
-                                scope="row"><?php _e('City Longitude', 'geodirectory');?></th>
499
+                                scope="row"><?php _e('City Longitude', 'geodirectory'); ?></th>
500 500
                             <td class="forminp">
501 501
                                 <div class="gtd-formfeild required" style="padding-top:10px;">
502 502
                                     <input type="text" class="require" size="80" style="width:440px"
503
-                                           id="<?php echo $prefix;?>longitude" name="longitude"
503
+                                           id="<?php echo $prefix; ?>longitude" name="longitude"
504 504
                                            value="<?php if (isset($location_result->city_longitude)) {
505 505
                                                echo $location_result->city_longitude;
506 506
                                            } ?>"/>
@@ -776,7 +776,7 @@  discard block
 block discarded – undo
776 776
         <div class="gd-content-heading">
777 777
 
778 778
 
779
-            <h3><?php _e('Theme Compatability Settings', 'geodirectory');?></h3>
779
+            <h3><?php _e('Theme Compatability Settings', 'geodirectory'); ?></h3>
780 780
             <style>
781 781
                 .gd-theme-compat-table {
782 782
                     width: 100%;
@@ -807,11 +807,11 @@  discard block
 block discarded – undo
807 807
                 </div>
808 808
             <?php }?>
809 809
 
810
-            <h4><?php _e('Select Theme Compatibility Pack', 'geodirectory');?></h4>
810
+            <h4><?php _e('Select Theme Compatibility Pack', 'geodirectory'); ?></h4>
811 811
 
812 812
             <select name="gd_theme_compat" id="gd_theme_compat">
813
-                <option value=""><?php _e('Select Theme', 'geodirectory');?></option>
814
-                <option value="custom"><?php _e('Custom', 'geodirectory');?></option>
813
+                <option value=""><?php _e('Select Theme', 'geodirectory'); ?></option>
814
+                <option value="custom"><?php _e('Custom', 'geodirectory'); ?></option>
815 815
                 <?php
816 816
                 $theme_arr = get_option('gd_theme_compats');
817 817
                 $theme_active = get_option('gd_theme_compat');
@@ -830,20 +830,20 @@  discard block
 block discarded – undo
830 830
                 ?>
831 831
             </select>
832 832
             <button onclick="gd_comp_export();" type="button"
833
-                    class="button-primary"><?php _e('Export', 'geodirectory');?></button>
833
+                    class="button-primary"><?php _e('Export', 'geodirectory'); ?></button>
834 834
             <button onclick="gd_comp_import();" type="button"
835
-                    class="button-primary"><?php _e('Import', 'geodirectory');?></button>
835
+                    class="button-primary"><?php _e('Import', 'geodirectory'); ?></button>
836 836
 
837 837
             <div class="gd-comp-import-export">
838 838
                 <textarea id="gd-import-export-theme-comp"
839
-                          placeholder="<?php _e('Paste the JSON code here and then click import again', 'geodirectory');?>"></textarea>
839
+                          placeholder="<?php _e('Paste the JSON code here and then click import again', 'geodirectory'); ?>"></textarea>
840 840
             </div>
841 841
             <script>
842 842
 
843 843
                 function gd_comp_export() {
844 844
                     theme = jQuery('#gd_theme_compat').val();
845 845
                     if (theme == '' || theme == 'custom') {
846
-                        alert("<?php _e('Please select a theme to export','geodirectory');?>");
846
+                        alert("<?php _e('Please select a theme to export', 'geodirectory'); ?>");
847 847
                         return false;
848 848
                     }
849 849
                     jQuery('.gd-comp-import-export').show();
@@ -877,9 +877,9 @@  discard block
 block discarded – undo
877 877
 
878 878
                     jQuery.post(ajaxurl, data, function (response) {
879 879
                         if (response == '0') {
880
-                            alert("<?php _e('Something went wrong','geodirectory');?>");
880
+                            alert("<?php _e('Something went wrong', 'geodirectory'); ?>");
881 881
                         } else {
882
-                            alert("<?php _e('Theme Compatibility Imported','geodirectory');?>");
882
+                            alert("<?php _e('Theme Compatibility Imported', 'geodirectory'); ?>");
883 883
                             jQuery('#gd-import-export-theme-comp').val('');
884 884
                             jQuery('.gd-comp-import-export').hide();
885 885
                             jQuery('#gd_theme_compat').append(new Option(response, response));
@@ -920,14 +920,14 @@  discard block
 block discarded – undo
920 920
 
921 921
             </script>
922 922
 
923
-            <h4><?php _e('Main Wrapper Actions', 'geodirectory');?></h4>
923
+            <h4><?php _e('Main Wrapper Actions', 'geodirectory'); ?></h4>
924 924
 
925 925
             <table class="form-table gd-theme-compat-table">
926 926
                 <tbody>
927 927
                 <tr>
928
-                    <td><strong><?php _e('Hook', 'geodirectory');?></strong></td>
929
-                    <td><strong><?php _e('ID', 'geodirectory');?></strong></td>
930
-                    <td><strong><?php _e('Class', 'geodirectory');?></strong></td>
928
+                    <td><strong><?php _e('Hook', 'geodirectory'); ?></strong></td>
929
+                    <td><strong><?php _e('ID', 'geodirectory'); ?></strong></td>
930
+                    <td><strong><?php _e('Class', 'geodirectory'); ?></strong></td>
931 931
                 </tr>
932 932
 
933 933
 
@@ -945,7 +945,7 @@  discard block
 block discarded – undo
945 945
 
946 946
                 <tr class="gd-theme-comp-out">
947 947
                     <td colspan="3">
948
-                        <span><?php _e('Output:', 'geodirectory');?></span>
948
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
949 949
                         <textarea name="geodir_wrapper_open_replace"
950 950
                                   placeholder='<div id="[id]" class="[class]">'><?php if (isset($tc['geodir_wrapper_open_replace'])) {
951 951
                                 echo $tc['geodir_wrapper_open_replace'];
@@ -959,14 +959,14 @@  discard block
 block discarded – undo
959 959
                         <small>geodir_wrapper_close</small>
960 960
                     </td>
961 961
                     <td><input disabled="disabled" type="text" name="geodir_wrapper_open_id"
962
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
962
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
963 963
                     <td><input disabled="disabled" type="text" name="geodir_wrapper_open_class"
964
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
964
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
965 965
                 </tr>
966 966
 
967 967
                 <tr class="gd-theme-comp-out">
968 968
                     <td colspan="3">
969
-                        <span><?php _e('Output:', 'geodirectory');?></span>
969
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
970 970
                         <textarea name="geodir_wrapper_close_replace"
971 971
                                   placeholder='</div><!-- wrapper ends here-->'><?php if (isset($tc['geodir_wrapper_close_replace'])) {
972 972
                                 echo $tc['geodir_wrapper_close_replace'];
@@ -990,7 +990,7 @@  discard block
 block discarded – undo
990 990
 
991 991
                 <tr class="gd-theme-comp-out">
992 992
                     <td colspan="3">
993
-                        <span><?php _e('Output:', 'geodirectory');?></span>
993
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
994 994
                         <textarea name="geodir_wrapper_content_open_replace"
995 995
                                   placeholder='<div id="[id]" class="[class]" role="main" [width_css]>'><?php if (isset($tc['geodir_wrapper_content_open_replace'])) {
996 996
                                 echo $tc['geodir_wrapper_content_open_replace'];
@@ -1004,14 +1004,14 @@  discard block
 block discarded – undo
1004 1004
                         <small>geodir_wrapper_content_close</small>
1005 1005
                     </td>
1006 1006
                     <td><input disabled="disabled" type="text" name="geodir_wrapper_content_close_id"
1007
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1007
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1008 1008
                     <td><input disabled="disabled" type="text" name="geodir_wrapper_content_close_class"
1009
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1009
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1010 1010
                 </tr>
1011 1011
 
1012 1012
                 <tr class="gd-theme-comp-out">
1013 1013
                     <td colspan="3">
1014
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1014
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1015 1015
                         <textarea name="geodir_wrapper_content_close_replace"
1016 1016
                                   placeholder='</div><!-- content ends here-->'><?php if (isset($tc['geodir_wrapper_content_close_replace'])) {
1017 1017
                                 echo $tc['geodir_wrapper_content_close_replace'];
@@ -1033,7 +1033,7 @@  discard block
 block discarded – undo
1033 1033
 
1034 1034
                 <tr class="gd-theme-comp-out">
1035 1035
                     <td colspan="3">
1036
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1036
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1037 1037
                         <textarea name="geodir_article_open_replace"
1038 1038
                                   placeholder='<article  id="[id]" class="[class]" itemscope itemtype="[itemtype]">'><?php if (isset($tc['geodir_article_open_replace'])) {
1039 1039
                                 echo $tc['geodir_article_open_replace'];
@@ -1046,14 +1046,14 @@  discard block
 block discarded – undo
1046 1046
                         <small>geodir_article_close</small>
1047 1047
                     </td>
1048 1048
                     <td><input disabled="disabled" type="text" name="geodir_article_close_id"
1049
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1049
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1050 1050
                     <td><input disabled="disabled" type="text" name="geodir_article_close_class"
1051
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1051
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1052 1052
                 </tr>
1053 1053
 
1054 1054
                 <tr class="gd-theme-comp-out">
1055 1055
                     <td colspan="3">
1056
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1056
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1057 1057
                         <textarea name="geodir_article_close_replace"
1058 1058
                                   placeholder='</article><!-- article ends here-->'><?php if (isset($tc['geodir_article_close_replace'])) {
1059 1059
                                 echo $tc['geodir_article_close_replace'];
@@ -1076,7 +1076,7 @@  discard block
 block discarded – undo
1076 1076
 
1077 1077
                 <tr class="gd-theme-comp-out">
1078 1078
                     <td colspan="3">
1079
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1079
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1080 1080
                         <textarea name="geodir_sidebar_right_open_replace"
1081 1081
                                   placeholder='<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>'><?php if (isset($tc['geodir_sidebar_right_open_replace'])) {
1082 1082
                                 echo $tc['geodir_sidebar_right_open_replace'];
@@ -1089,14 +1089,14 @@  discard block
 block discarded – undo
1089 1089
                         <small>geodir_sidebar_right_close</small>
1090 1090
                     </td>
1091 1091
                     <td><input disabled="disabled" type="text" name="geodir_sidebar_right_close_id"
1092
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1092
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1093 1093
                     <td><input disabled="disabled" type="text" name="geodir_sidebar_right_close_class"
1094
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1094
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1095 1095
                 </tr>
1096 1096
 
1097 1097
                 <tr class="gd-theme-comp-out">
1098 1098
                     <td colspan="3">
1099
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1099
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1100 1100
                         <textarea name="geodir_sidebar_right_close_replace"
1101 1101
                                   placeholder='</aside><!-- sidebar ends here-->'><?php if (isset($tc['geodir_sidebar_right_close_replace'])) {
1102 1102
                                 echo $tc['geodir_sidebar_right_close_replace'];
@@ -1120,7 +1120,7 @@  discard block
 block discarded – undo
1120 1120
 
1121 1121
                 <tr class="gd-theme-comp-out">
1122 1122
                     <td colspan="3">
1123
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1123
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1124 1124
                         <textarea name="geodir_sidebar_left_open_replace"
1125 1125
                                   placeholder='<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>'><?php if (isset($tc['geodir_sidebar_left_open_replace'])) {
1126 1126
                                 echo $tc['geodir_sidebar_left_open_replace'];
@@ -1133,14 +1133,14 @@  discard block
 block discarded – undo
1133 1133
                         <small>geodir_sidebar_left_close</small>
1134 1134
                     </td>
1135 1135
                     <td><input disabled="disabled" type="text" name="geodir_sidebar_left_close_id"
1136
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1136
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1137 1137
                     <td><input disabled="disabled" type="text" name="geodir_sidebar_left_close_class"
1138
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1138
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1139 1139
                 </tr>
1140 1140
 
1141 1141
                 <tr class="gd-theme-comp-out">
1142 1142
                     <td colspan="3">
1143
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1143
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1144 1144
                         <textarea name="geodir_sidebar_left_close_replace"
1145 1145
                                   placeholder='</aside><!-- sidebar ends here-->'><?php if (isset($tc['geodir_sidebar_left_close_replace'])) {
1146 1146
                                 echo $tc['geodir_sidebar_left_close_replace'];
@@ -1162,7 +1162,7 @@  discard block
 block discarded – undo
1162 1162
 
1163 1163
                 <tr class="gd-theme-comp-out">
1164 1164
                     <td colspan="3">
1165
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1165
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1166 1166
                         <textarea name="geodir_main_content_open_replace"
1167 1167
                                   placeholder='<main  id="[id]" class="[class]"  role="main">'><?php if (isset($tc['geodir_main_content_open_replace'])) {
1168 1168
                                 echo $tc['geodir_main_content_open_replace'];
@@ -1175,14 +1175,14 @@  discard block
 block discarded – undo
1175 1175
                         <small>geodir_main_content_close</small>
1176 1176
                     </td>
1177 1177
                     <td><input disabled="disabled" type="text" name="geodir_main_content_close_id"
1178
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1178
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1179 1179
                     <td><input disabled="disabled" type="text" name="geodir_main_content_close_class"
1180
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1180
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1181 1181
                 </tr>
1182 1182
 
1183 1183
                 <tr class="gd-theme-comp-out">
1184 1184
                     <td colspan="3">
1185
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1185
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1186 1186
                         <textarea name="geodir_main_content_close_replace"
1187 1187
                                   placeholder='</main><!-- main ends here-->'><?php if (isset($tc['geodir_main_content_close_replace'])) {
1188 1188
                                 echo $tc['geodir_main_content_close_replace'];
@@ -1194,13 +1194,13 @@  discard block
 block discarded – undo
1194 1194
                 </tbody>
1195 1195
             </table>
1196 1196
 
1197
-            <h4><?php _e('Other Actions', 'geodirectory');?></h4>
1197
+            <h4><?php _e('Other Actions', 'geodirectory'); ?></h4>
1198 1198
 
1199 1199
             <table class="form-table gd-theme-compat-table">
1200 1200
                 <tbody>
1201 1201
                 <tr>
1202
-                    <td><strong><?php _e('Hook', 'geodirectory');?></strong></td>
1203
-                    <td><strong><?php _e('Content', 'geodirectory');?></strong></td>
1202
+                    <td><strong><?php _e('Hook', 'geodirectory'); ?></strong></td>
1203
+                    <td><strong><?php _e('Content', 'geodirectory'); ?></strong></td>
1204 1204
                 </tr>
1205 1205
 
1206 1206
 
@@ -1229,13 +1229,13 @@  discard block
 block discarded – undo
1229 1229
             </table>
1230 1230
 
1231 1231
 
1232
-            <h4><?php _e('Other Filters', 'geodirectory');?></h4>
1232
+            <h4><?php _e('Other Filters', 'geodirectory'); ?></h4>
1233 1233
 
1234 1234
             <table class="form-table gd-theme-compat-table">
1235 1235
                 <tbody>
1236 1236
                 <tr>
1237
-                    <td><strong><?php _e('Filter', 'geodirectory');?></strong></td>
1238
-                    <td><strong><?php _e('Content', 'geodirectory');?></strong></td>
1237
+                    <td><strong><?php _e('Filter', 'geodirectory'); ?></strong></td>
1238
+                    <td><strong><?php _e('Content', 'geodirectory'); ?></strong></td>
1239 1239
                 </tr>
1240 1240
 
1241 1241
                 <tr>
@@ -1389,13 +1389,13 @@  discard block
 block discarded – undo
1389 1389
                  *
1390 1390
                  * @since 1.4.0
1391 1391
                  */
1392
-                do_action('gd_compat_other_filters');?>
1392
+                do_action('gd_compat_other_filters'); ?>
1393 1393
 
1394 1394
                 </tbody>
1395 1395
             </table>
1396 1396
 
1397 1397
 
1398
-            <h4><?php _e('Required CSS', 'geodirectory');?></h4>
1398
+            <h4><?php _e('Required CSS', 'geodirectory'); ?></h4>
1399 1399
 
1400 1400
             <table class="form-table gd-theme-compat-table">
1401 1401
                 <tbody>
@@ -1410,7 +1410,7 @@  discard block
 block discarded – undo
1410 1410
                 </tbody>
1411 1411
             </table>
1412 1412
 
1413
-            <h4><?php _e('Required JS', 'geodirectory');?></h4>
1413
+            <h4><?php _e('Required JS', 'geodirectory'); ?></h4>
1414 1414
 
1415 1415
             <table class="form-table gd-theme-compat-table">
1416 1416
                 <tbody>
@@ -1428,7 +1428,7 @@  discard block
 block discarded – undo
1428 1428
 
1429 1429
             <p class="submit">
1430 1430
                 <input name="save" class="button-primary" type="submit"
1431
-                       value="<?php _e('Save changes', 'geodirectory');?>">
1431
+                       value="<?php _e('Save changes', 'geodirectory'); ?>">
1432 1432
             </p>
1433 1433
 
1434 1434
         </div>
@@ -1462,7 +1462,7 @@  discard block
 block discarded – undo
1462 1462
          * @param string $listing_type Post type.
1463 1463
          */
1464 1464
         ?>
1465
-        <h3><?php echo apply_filters('geodir_custom_fields_panel_head', '', $sub_tab, $listing_type);?></h3>
1465
+        <h3><?php echo apply_filters('geodir_custom_fields_panel_head', '', $sub_tab, $listing_type); ?></h3>
1466 1466
     </div>
1467 1467
     <div id="container_general" class="clearfix">
1468 1468
         <div class="general-form-builder-frame">
@@ -1477,7 +1477,7 @@  discard block
 block discarded – undo
1477 1477
                  * @param string $listing_type Post type.
1478 1478
                  */
1479 1479
                 ?>
1480
-                <h3 class="hndle"><span><?php echo apply_filters('geodir_cf_panel_available_fields_head', '', $sub_tab, $listing_type);?>
1480
+                <h3 class="hndle"><span><?php echo apply_filters('geodir_cf_panel_available_fields_head', '', $sub_tab, $listing_type); ?>
1481 1481
 							</span></h3>
1482 1482
                 <?php
1483 1483
                 /**
@@ -1488,7 +1488,7 @@  discard block
 block discarded – undo
1488 1488
                  * @param string $listing_type Post type.
1489 1489
                  */
1490 1490
                 ?>
1491
-                <p><?php echo apply_filters('geodir_cf_panel_available_fields_note', '', $sub_tab, $listing_type);?></p>
1491
+                <p><?php echo apply_filters('geodir_cf_panel_available_fields_note', '', $sub_tab, $listing_type); ?></p>
1492 1492
 
1493 1493
                 <div class="inside">
1494 1494
 
@@ -1522,7 +1522,7 @@  discard block
 block discarded – undo
1522 1522
                      * @param string $listing_type Post type.
1523 1523
                      */
1524 1524
                     ?>
1525
-                    <span><?php echo apply_filters('geodir_cf_panel_selected_fields_head', '', $sub_tab, $listing_type);?></span>
1525
+                    <span><?php echo apply_filters('geodir_cf_panel_selected_fields_head', '', $sub_tab, $listing_type); ?></span>
1526 1526
                 </h3>
1527 1527
                 <?php
1528 1528
                 /**
@@ -1533,7 +1533,7 @@  discard block
 block discarded – undo
1533 1533
                  * @param string $listing_type Post type.
1534 1534
                  */
1535 1535
                 ?>
1536
-                <p><?php echo apply_filters('geodir_cf_panel_selected_fields_note', '', $sub_tab, $listing_type);?></p>
1536
+                <p><?php echo apply_filters('geodir_cf_panel_selected_fields_note', '', $sub_tab, $listing_type); ?></p>
1537 1537
 
1538 1538
                 <div class="inside">
1539 1539
 
@@ -1574,7 +1574,7 @@  discard block
 block discarded – undo
1574 1574
         <div class="gd-content-heading">
1575 1575
 
1576 1576
 
1577
-            <h3><?php _e('GD Diagnostic Tools', 'geodirectory');?></h3>
1577
+            <h3><?php _e('GD Diagnostic Tools', 'geodirectory'); ?></h3>
1578 1578
             <style>
1579 1579
                 .gd-tools-table {
1580 1580
                     width: 100%;
@@ -1593,81 +1593,81 @@  discard block
 block discarded – undo
1593 1593
             <table class="form-table gd-tools-table">
1594 1594
                 <tbody>
1595 1595
                 <tr>
1596
-                    <td><strong><?php _e('Tool', 'geodirectory');?></strong></td>
1597
-                    <td><strong><?php _e('Description', 'geodirectory');?></strong></td>
1598
-                    <td><strong><?php _e('Action', 'geodirectory');?></strong></td>
1596
+                    <td><strong><?php _e('Tool', 'geodirectory'); ?></strong></td>
1597
+                    <td><strong><?php _e('Description', 'geodirectory'); ?></strong></td>
1598
+                    <td><strong><?php _e('Action', 'geodirectory'); ?></strong></td>
1599 1599
                 </tr>
1600 1600
 
1601 1601
 
1602 1602
                 <tr>
1603
-                    <td><?php _e('GD pages check', 'geodirectory');?></td>
1603
+                    <td><?php _e('GD pages check', 'geodirectory'); ?></td>
1604 1604
                     <td>
1605
-                        <small><?php _e('Checks if the GD pages are installed correctly or not.', 'geodirectory');?></small>
1605
+                        <small><?php _e('Checks if the GD pages are installed correctly or not.', 'geodirectory'); ?></small>
1606 1606
                     </td>
1607 1607
                     <td>
1608
-                        <input type="button" value="<?php _e('Run', 'geodirectory');?>"
1608
+                        <input type="button" value="<?php _e('Run', 'geodirectory'); ?>"
1609 1609
                                class="button-primary geodir_diagnosis_button" data-diagnose="default_pages"/>
1610 1610
                     </td>
1611 1611
                 </tr>
1612 1612
 
1613 1613
 
1614 1614
                 <tr>
1615
-                    <td><?php _e('Multisite DB conversion check', 'geodirectory');?></td>
1615
+                    <td><?php _e('Multisite DB conversion check', 'geodirectory'); ?></td>
1616 1616
                     <td>
1617
-                        <small><?php _e('Checks if the GD database tables have been converted to use multisite correctly.', 'geodirectory');?></small>
1617
+                        <small><?php _e('Checks if the GD database tables have been converted to use multisite correctly.', 'geodirectory'); ?></small>
1618 1618
                     </td>
1619
-                    <td><input type="button" value="<?php _e('Run', 'geodirectory');?>"
1619
+                    <td><input type="button" value="<?php _e('Run', 'geodirectory'); ?>"
1620 1620
                                class="button-primary geodir_diagnosis_button" data-diagnose="multisite_conversion"/>
1621 1621
                     </td>
1622 1622
                 </tr>
1623 1623
 
1624 1624
                 <tr>
1625
-                    <td><?php _e('Ratings check', 'geodirectory');?></td>
1625
+                    <td><?php _e('Ratings check', 'geodirectory'); ?></td>
1626 1626
                     <td>
1627
-                        <small><?php _e('Checks ratings for correct location and content settings', 'geodirectory');?></small>
1627
+                        <small><?php _e('Checks ratings for correct location and content settings', 'geodirectory'); ?></small>
1628 1628
                     </td>
1629
-                    <td><input type="button" value="<?php _e('Run', 'geodirectory');?>"
1629
+                    <td><input type="button" value="<?php _e('Run', 'geodirectory'); ?>"
1630 1630
                                class="button-primary geodir_diagnosis_button" data-diagnose="ratings"/>
1631 1631
                     </td>
1632 1632
                 </tr>
1633 1633
 
1634 1634
                 <tr>
1635
-                    <td><?php _e('Sync GD tags', 'geodirectory');?></td>
1635
+                    <td><?php _e('Sync GD tags', 'geodirectory'); ?></td>
1636 1636
                     <td>
1637
-                        <small><?php _e('This tool can be used when tags are showing in the backend but missing from the front end.', 'geodirectory');?></small>
1637
+                        <small><?php _e('This tool can be used when tags are showing in the backend but missing from the front end.', 'geodirectory'); ?></small>
1638 1638
                     </td>
1639
-                    <td><input type="button" value="<?php _e('Run', 'geodirectory');?>"
1639
+                    <td><input type="button" value="<?php _e('Run', 'geodirectory'); ?>"
1640 1640
                                class="button-primary geodir_diagnosis_button" data-diagnose="tags_sync"/>
1641 1641
                     </td>
1642 1642
                 </tr>
1643 1643
 
1644 1644
                 <tr>
1645
-                    <td><?php _e('Sync GD Categories', 'geodirectory');?></td>
1645
+                    <td><?php _e('Sync GD Categories', 'geodirectory'); ?></td>
1646 1646
                     <td>
1647
-                        <small><?php _e('This tool can be used when categories are missing from the details table but showing in other places in the backend (only checks posts with missing category info in details table)', 'geodirectory');?></small>
1647
+                        <small><?php _e('This tool can be used when categories are missing from the details table but showing in other places in the backend (only checks posts with missing category info in details table)', 'geodirectory'); ?></small>
1648 1648
                     </td>
1649
-                    <td><input type="button" value="<?php _e('Run', 'geodirectory');?>"
1649
+                    <td><input type="button" value="<?php _e('Run', 'geodirectory'); ?>"
1650 1650
                                class="button-primary geodir_diagnosis_button" data-diagnose="cats_sync"/>
1651 1651
                     </td>
1652 1652
                 </tr>
1653 1653
 
1654 1654
 
1655 1655
                 <tr>
1656
-                    <td><?php _e('Clear all GD version numbers', 'geodirectory');?></td>
1656
+                    <td><?php _e('Clear all GD version numbers', 'geodirectory'); ?></td>
1657 1657
                     <td>
1658
-                        <small><?php _e('This tool will clear all GD version numbers so any upgrade functions will run again.', 'geodirectory');?></small>
1658
+                        <small><?php _e('This tool will clear all GD version numbers so any upgrade functions will run again.', 'geodirectory'); ?></small>
1659 1659
                     </td>
1660
-                    <td><input type="button" value="<?php _e('Run', 'geodirectory');?>"
1660
+                    <td><input type="button" value="<?php _e('Run', 'geodirectory'); ?>"
1661 1661
                                class="button-primary geodir_diagnosis_button" data-diagnose="version_clear"/>
1662 1662
                     </td>
1663 1663
                 </tr>
1664 1664
 				<tr>
1665
-					<td><?php _e('Load custom fields translation', 'geodirectory');?></td>
1665
+					<td><?php _e('Load custom fields translation', 'geodirectory'); ?></td>
1666 1666
 					<td>
1667
-						<small><?php _e('This tool will load strings from the database into a file to translate via po editor.Ex: custom fields', 'geodirectory');?></small>
1667
+						<small><?php _e('This tool will load strings from the database into a file to translate via po editor.Ex: custom fields', 'geodirectory'); ?></small>
1668 1668
 					</td>
1669 1669
 					<td>
1670
-						<input type="button" value="<?php _e('Run', 'geodirectory');?>" class="button-primary geodir_diagnosis_button" data-diagnose="load_db_language"/>
1670
+						<input type="button" value="<?php _e('Run', 'geodirectory'); ?>" class="button-primary geodir_diagnosis_button" data-diagnose="load_db_language"/>
1671 1671
 					</td>
1672 1672
 				</tr>
1673 1673
                 <?php
@@ -1677,7 +1677,7 @@  discard block
 block discarded – undo
1677 1677
                  * Called after the last setting on the GD>Tools page.
1678 1678
                  * @since 1.0.0
1679 1679
                  */
1680
-                do_action('geodir_diagnostic_tool');?>
1680
+                do_action('geodir_diagnostic_tool'); ?>
1681 1681
 
1682 1682
                 </tbody>
1683 1683
             </table>
Please login to merge, or discard this patch.
Indentation   +515 added lines, -515 removed lines patch added patch discarded remove patch
@@ -7,33 +7,33 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 if (!function_exists('geodir_admin_panel')) {
10
-    /**
11
-     * GeoDirectory Backend Admin Panel.
12
-     *
13
-     * Handles the display of the main GeoDirectory admin panel.
14
-     *
15
-     * @since 1.0.0
16
-     * @package GeoDirectory
17
-     * @global string $current_tab Current tab in geodirectory settings.
18
-     * @global object $geodirectory GeoDirectory plugin object.
19
-     */
20
-    function geodir_admin_panel()
21
-    {
22
-        global $geodirectory;
23
-        global $current_tab;
24
-
25
-
26
-        ?>
10
+	/**
11
+	 * GeoDirectory Backend Admin Panel.
12
+	 *
13
+	 * Handles the display of the main GeoDirectory admin panel.
14
+	 *
15
+	 * @since 1.0.0
16
+	 * @package GeoDirectory
17
+	 * @global string $current_tab Current tab in geodirectory settings.
18
+	 * @global object $geodirectory GeoDirectory plugin object.
19
+	 */
20
+	function geodir_admin_panel()
21
+	{
22
+		global $geodirectory;
23
+		global $current_tab;
24
+
25
+
26
+		?>
27 27
 
28 28
         <div id="gd-wrapper-main" class="wrap geodirectory">
29 29
             <?php
30
-            /**
31
-             * Called just after the opening wrapper div for the GD settings page in the admin area.
32
-             *
33
-             * @since 1.0.0
34
-             */
35
-            do_action('geodir_before_admin_panel');
36
-            ?>
30
+			/**
31
+			 * Called just after the opening wrapper div for the GD settings page in the admin area.
32
+			 *
33
+			 * @since 1.0.0
34
+			 */
35
+			do_action('geodir_before_admin_panel');
36
+			?>
37 37
 
38 38
             <div class="gd-wrapper gd-wrapper-vr clearfix">
39 39
 
@@ -44,75 +44,75 @@  discard block
 block discarded – undo
44 44
                          alt="geo-logo" class="geo-logoalter"/>
45 45
                     <ul>
46 46
                         <?php
47
-                        $tabs = array();
48
-                        /**
49
-                         * Filter the GD admin settings tabs on the left of the admin menu.
50
-                         *
51
-                         * @since 1.0.0
52
-                         * @param array $tabs The array of tabs to display.
53
-                         */
54
-                        $tabs = apply_filters('geodir_settings_tabs_array', $tabs);
55
-                        update_option('geodir_tabs', $tabs);// Important to show settings menu dropdown
56
-
57
-                        foreach ($tabs as $name => $args) :
58
-                            $label = $args['label'];
59
-
60
-
61
-                            $query_string = '';
62
-                            if (isset($args['subtabs']) && !empty($args['subtabs'])):
63
-
64
-                                $subtabs = $args['subtabs'];
65
-
66
-                                $query_string = '&subtab=' . $subtabs[0]['subtab'];
67
-
68
-                            endif;
69
-
70
-
71
-                            $tab_link = admin_url('admin.php?page=geodirectory&tab=' . $name . $query_string);
72
-
73
-                            if (isset($args['url']) && $args['url'] != '') {
74
-                                $tab_link = $args['url'];
75
-                            }
76
-
77
-                            if (!empty($args['request']))
78
-                                $tab_link = geodir_getlink($tab_link, $args['request']);
79
-
80
-                            if (isset($args['target']) && $args['target'] != '') {
81
-                                $tab_target = " target='" . sanitize_text_field($args['target']) . "' ";
82
-                            } else
83
-                                $tab_target = '';
84
-
85
-                            $tab_active = '';
86
-                            if ($current_tab == $name)
87
-                                $tab_active = ' class="tab-active" ';
88
-                            /**
89
-                             * Called before the individual settings tabs are output.
90
-                             *
91
-                             * @since 1.0.0
92
-                             * @param string $name The name of the settings tab.
93
-                             * @see 'geodir_after_settings_tabs'
94
-                             */
95
-                            do_action('geodir_before_settings_tabs', $name);
96
-                            echo '<li ' . $tab_active . ' ><a href="' . esc_url($tab_link) . '"  ' . $tab_target . ' >' . sanitize_text_field($label) . '</a></li>';
97
-                            /**
98
-                             * Called after the individual settings tabs are output.
99
-                             *
100
-                             * @since 1.0.0
101
-                             * @param string $name The name of the settings tab.
102
-                             * @see 'geodir_before_settings_tabs'
103
-                             */
104
-                            do_action('geodir_after_settings_tabs', $name);
105
-                        endforeach;
106
-
107
-                        /**
108
-                         * Called after the GD settings tabs have been output.
109
-                         *
110
-                         * Called before the closing `ul` so can be used to add new settings tab links.
111
-                         *
112
-                         * @since 1.0.0
113
-                         */
114
-                        do_action('geodir_settings_tabs');
115
-                        ?>
47
+						$tabs = array();
48
+						/**
49
+						 * Filter the GD admin settings tabs on the left of the admin menu.
50
+						 *
51
+						 * @since 1.0.0
52
+						 * @param array $tabs The array of tabs to display.
53
+						 */
54
+						$tabs = apply_filters('geodir_settings_tabs_array', $tabs);
55
+						update_option('geodir_tabs', $tabs);// Important to show settings menu dropdown
56
+
57
+						foreach ($tabs as $name => $args) :
58
+							$label = $args['label'];
59
+
60
+
61
+							$query_string = '';
62
+							if (isset($args['subtabs']) && !empty($args['subtabs'])):
63
+
64
+								$subtabs = $args['subtabs'];
65
+
66
+								$query_string = '&subtab=' . $subtabs[0]['subtab'];
67
+
68
+							endif;
69
+
70
+
71
+							$tab_link = admin_url('admin.php?page=geodirectory&tab=' . $name . $query_string);
72
+
73
+							if (isset($args['url']) && $args['url'] != '') {
74
+								$tab_link = $args['url'];
75
+							}
76
+
77
+							if (!empty($args['request']))
78
+								$tab_link = geodir_getlink($tab_link, $args['request']);
79
+
80
+							if (isset($args['target']) && $args['target'] != '') {
81
+								$tab_target = " target='" . sanitize_text_field($args['target']) . "' ";
82
+							} else
83
+								$tab_target = '';
84
+
85
+							$tab_active = '';
86
+							if ($current_tab == $name)
87
+								$tab_active = ' class="tab-active" ';
88
+							/**
89
+							 * Called before the individual settings tabs are output.
90
+							 *
91
+							 * @since 1.0.0
92
+							 * @param string $name The name of the settings tab.
93
+							 * @see 'geodir_after_settings_tabs'
94
+							 */
95
+							do_action('geodir_before_settings_tabs', $name);
96
+							echo '<li ' . $tab_active . ' ><a href="' . esc_url($tab_link) . '"  ' . $tab_target . ' >' . sanitize_text_field($label) . '</a></li>';
97
+							/**
98
+							 * Called after the individual settings tabs are output.
99
+							 *
100
+							 * @since 1.0.0
101
+							 * @param string $name The name of the settings tab.
102
+							 * @see 'geodir_before_settings_tabs'
103
+							 */
104
+							do_action('geodir_after_settings_tabs', $name);
105
+						endforeach;
106
+
107
+						/**
108
+						 * Called after the GD settings tabs have been output.
109
+						 *
110
+						 * Called before the closing `ul` so can be used to add new settings tab links.
111
+						 *
112
+						 * @since 1.0.0
113
+						 */
114
+						do_action('geodir_settings_tabs');
115
+						?>
116 116
                     </ul>
117 117
                 </div>
118 118
                 <!--gd-left-nav ends here-->
@@ -121,52 +121,52 @@  discard block
 block discarded – undo
121 121
                     <div class="gd-tabs-main">
122 122
 
123 123
                         <?php
124
-                        unset($subtabs);
125
-                        if (isset($tabs[$current_tab]['subtabs']))
126
-                            $subtabs = $tabs[$current_tab]['subtabs'];
127
-                        $form_action = '';
124
+						unset($subtabs);
125
+						if (isset($tabs[$current_tab]['subtabs']))
126
+							$subtabs = $tabs[$current_tab]['subtabs'];
127
+						$form_action = '';
128 128
 
129
-                        if (!empty($subtabs)):
130
-                        ?>
129
+						if (!empty($subtabs)):
130
+						?>
131 131
                             <dl class="gd-tab-head">
132 132
                                 <?php
133
-                                foreach ($subtabs as $sub) {
134
-                                    $subtab_active = '';
135
-                                    if (isset($_REQUEST['subtab']) && $sub['subtab'] == $_REQUEST['subtab']) {
136
-                                        $subtab_active = 'class="gd-tab-active"';
137
-                                        $form_action = isset($sub['form_action']) ? $sub['form_action'] : '';
138
-                                    }
139
-
140
-                                    $sub_tabs_link = admin_url() . 'admin.php?page=geodirectory&tab=' . $current_tab . '&subtab=' . $sub['subtab'];
141
-                                    if (isset($sub['request']) && is_array($sub['request']) && !empty($sub['request'])) {
142
-                                        $sub_tabs_link = geodir_getlink($sub_tabs_link, $sub['request']);
143
-                                    }
144
-                                    echo '<dd ' . $subtab_active . ' id="claim_listing"><a href="' . esc_url($sub_tabs_link) . '" >' . sanitize_text_field($sub['label']) . '</a></dd>';
145
-                                }
146
-                                ?>
133
+								foreach ($subtabs as $sub) {
134
+									$subtab_active = '';
135
+									if (isset($_REQUEST['subtab']) && $sub['subtab'] == $_REQUEST['subtab']) {
136
+										$subtab_active = 'class="gd-tab-active"';
137
+										$form_action = isset($sub['form_action']) ? $sub['form_action'] : '';
138
+									}
139
+
140
+									$sub_tabs_link = admin_url() . 'admin.php?page=geodirectory&tab=' . $current_tab . '&subtab=' . $sub['subtab'];
141
+									if (isset($sub['request']) && is_array($sub['request']) && !empty($sub['request'])) {
142
+										$sub_tabs_link = geodir_getlink($sub_tabs_link, $sub['request']);
143
+									}
144
+									echo '<dd ' . $subtab_active . ' id="claim_listing"><a href="' . esc_url($sub_tabs_link) . '" >' . sanitize_text_field($sub['label']) . '</a></dd>';
145
+								}
146
+								?>
147 147
                             </dl>
148 148
 
149 149
                         <?php endif; ?>
150 150
                         <div class="gd-tab-content <?php if (empty($subtabs)) {
151
-                            echo "inner_contet_tabs";
152
-                        } ?>">
151
+							echo "inner_contet_tabs";
152
+						} ?>">
153 153
                             <form method="post" id="mainform"
154 154
                                   class="geodir_optionform <?php echo $current_tab . ' '; ?><?php if (isset($sub['subtab'])) {
155
-                                      echo sanitize_text_field($sub['subtab']);
156
-                                  } ?>" action="<?php echo $form_action; ?>" enctype="multipart/form-data">
155
+									  echo sanitize_text_field($sub['subtab']);
156
+								  } ?>" action="<?php echo $form_action; ?>" enctype="multipart/form-data">
157 157
                                 <input type="hidden" class="active_tab" name="active_tab"
158 158
                                        value="<?php if (isset($_REQUEST['active_tab'])) {
159
-                                           echo sanitize_text_field($_REQUEST['active_tab']);
160
-                                       } ?>"/>
159
+										   echo sanitize_text_field($_REQUEST['active_tab']);
160
+									   } ?>"/>
161 161
                                 <?php wp_nonce_field('geodir-settings', '_wpnonce', true, true); ?>
162 162
                                 <?php wp_nonce_field('geodir-settings-' . $current_tab, '_wpnonce-' . $current_tab, true, true); ?>
163 163
                                 <?php
164
-                                /**
165
-                                 * Used to call the content of each GD settings tab page.
166
-                                 *
167
-                                 * @since 1.0.0
168
-                                 */
169
-                                do_action('geodir_admin_option_form', $current_tab); ?>
164
+								/**
165
+								 * Used to call the content of each GD settings tab page.
166
+								 *
167
+								 * @since 1.0.0
168
+								 */
169
+								do_action('geodir_admin_option_form', $current_tab); ?>
170 170
                             </form>
171 171
                         </div>
172 172
 
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
         </script>
268 268
     <?php
269 269
 
270
-    }
270
+	}
271 271
 }
272 272
 
273 273
 
@@ -283,48 +283,48 @@  discard block
 block discarded – undo
283 283
 function geodir_admin_option_form($tab_name)
284 284
 {
285 285
 
286
-    //echo $tab_name.'_array.php' ;
287
-    global $geodir_settings, $is_default, $mapzoom;
288
-    if (file_exists(dirname(__FILE__) . '/option-pages/' . $tab_name . '_array.php')) {
289
-        /**
290
-         * Contains settings array for given tab.
291
-         *
292
-         * @since 1.0.0
293
-         * @package GeoDirectory
294
-         */
295
-        include_once('option-pages/' . $tab_name . '_array.php');
296
-    }
297
-
298
-    $listing_type = isset($_REQUEST['listing_type']) ? $_REQUEST['listing_type'] : '';
299
-
300
-    switch ($tab_name) {
301
-
302
-        case 'general_settings':
303
-
304
-            geodir_admin_fields($geodir_settings['general_settings']);
305
-            /**
306
-             *
307
-             * Update Taxonomy Options *
308
-             *
309
-             **/
310
-            /*add_action('updated_option_place_prefix','update_listing_prefix');
286
+	//echo $tab_name.'_array.php' ;
287
+	global $geodir_settings, $is_default, $mapzoom;
288
+	if (file_exists(dirname(__FILE__) . '/option-pages/' . $tab_name . '_array.php')) {
289
+		/**
290
+		 * Contains settings array for given tab.
291
+		 *
292
+		 * @since 1.0.0
293
+		 * @package GeoDirectory
294
+		 */
295
+		include_once('option-pages/' . $tab_name . '_array.php');
296
+	}
297
+
298
+	$listing_type = isset($_REQUEST['listing_type']) ? $_REQUEST['listing_type'] : '';
299
+
300
+	switch ($tab_name) {
301
+
302
+		case 'general_settings':
303
+
304
+			geodir_admin_fields($geodir_settings['general_settings']);
305
+			/**
306
+			 *
307
+			 * Update Taxonomy Options *
308
+			 *
309
+			 **/
310
+			/*add_action('updated_option_place_prefix','update_listing_prefix');
311 311
             function update_listing_prefix(){
312 312
                 geodir_register_defaults();
313 313
             }*/
314 314
 
315
-            if (isset($_REQUEST['active_tab']) && ($_REQUEST['active_tab'] == 'dummy_data_settings' || $_REQUEST['active_tab'] == 'csv_upload_settings'))
316
-                $hide_save_button = "style='display:none;'";
317
-            else
318
-                $hide_save_button = '';
315
+			if (isset($_REQUEST['active_tab']) && ($_REQUEST['active_tab'] == 'dummy_data_settings' || $_REQUEST['active_tab'] == 'csv_upload_settings'))
316
+				$hide_save_button = "style='display:none;'";
317
+			else
318
+				$hide_save_button = '';
319 319
 
320
-            /**
321
-             * Filter weather the default save button in the GD admin settings pages should be shown.
322
-             *
323
-             * @since 1.0.0
324
-             * @param string $hide_save_button The style element, either blank or: style='display:none;'.
325
-             */
326
-            $hide_save_button = apply_filters('geodir_hide_save_button', $hide_save_button);
327
-            ?>
320
+			/**
321
+			 * Filter weather the default save button in the GD admin settings pages should be shown.
322
+			 *
323
+			 * @since 1.0.0
324
+			 * @param string $hide_save_button The style element, either blank or: style='display:none;'.
325
+			 */
326
+			$hide_save_button = apply_filters('geodir_hide_save_button', $hide_save_button);
327
+			?>
328 328
 
329 329
             <p class="submit">
330 330
             <input <?php echo $hide_save_button;?> name="save" class="button-primary" type="submit" value="<?php _e('Save changes', 'geodirectory'); ?>" />
@@ -334,36 +334,36 @@  discard block
 block discarded – undo
334 334
             </div>
335 335
             
336 336
 		<?php break;
337
-        case 'design_settings' :
338
-            geodir_admin_fields($geodir_settings['design_settings']);
337
+		case 'design_settings' :
338
+			geodir_admin_fields($geodir_settings['design_settings']);
339 339
 
340 340
 
341 341
 
342
-            ?>
342
+			?>
343 343
 			<p class="submit">
344 344
 			<input name="save" class="button-primary" type="submit" value="<?php _e('Save changes', 'geodirectory'); ?>" />
345 345
 			<input type="hidden" name="subtab" id="last_tab" />
346 346
 			</p>
347 347
 			</div>
348 348
         <?php break;
349
-        case 'permalink_settings' :
350
-            geodir_admin_fields($geodir_settings['permalink_settings']); ?>
349
+		case 'permalink_settings' :
350
+			geodir_admin_fields($geodir_settings['permalink_settings']); ?>
351 351
             <p class="submit">
352 352
             <input name="save" class="button-primary" type="submit" value="<?php _e('Save changes', 'geodirectory'); ?>" />
353 353
             <input type="hidden" name="subtab" id="last_tab" />
354 354
             </p>
355 355
             </div>	
356 356
 		<?php break;
357
-        case 'title_meta_settings' :
358
-            geodir_admin_fields($geodir_settings['title_meta_settings']); ?>
357
+		case 'title_meta_settings' :
358
+			geodir_admin_fields($geodir_settings['title_meta_settings']); ?>
359 359
             <p class="submit">
360 360
             <input name="save" class="button-primary" type="submit" value="<?php _e('Save changes', 'geodirectory'); ?>" />
361 361
             <input type="hidden" name="subtab" id="last_tab" />
362 362
             </p>
363 363
             </div>
364 364
 		<?php break;
365
-        case 'notifications_settings' :
366
-            geodir_admin_fields($geodir_settings['notifications_settings']); ?>
365
+		case 'notifications_settings' :
366
+			geodir_admin_fields($geodir_settings['notifications_settings']); ?>
367 367
 			
368 368
 			<p class="submit">
369 369
 				
@@ -373,36 +373,36 @@  discard block
 block discarded – undo
373 373
 			</div>
374 374
 			
375 375
 		<?php break;
376
-        case 'default_location_settings' :
377
-            ?>
376
+		case 'default_location_settings' :
377
+			?>
378 378
             <div class="inner_content_tab_main">
379 379
                 <div class="gd-content-heading">
380 380
                     <?php global $wpdb;
381 381
 
382 382
 
383
-                    $location_result = geodir_get_default_location();
383
+					$location_result = geodir_get_default_location();
384 384
 
385
-                    $prefix = '';
385
+					$prefix = '';
386 386
 
387 387
 
388
-                    $lat = isset($location_result->city_latitude) ? $location_result->city_latitude : '';
389
-                    $lng = isset($location_result->city_longitude) ? $location_result->city_longitude : '';
390
-                    $city = isset($location_result->city) ? $location_result->city : '';
391
-                    $region = isset($location_result->region) ? $location_result->region : '';
392
-                    $country = isset($location_result->country) ? $location_result->country : '';
388
+					$lat = isset($location_result->city_latitude) ? $location_result->city_latitude : '';
389
+					$lng = isset($location_result->city_longitude) ? $location_result->city_longitude : '';
390
+					$city = isset($location_result->city) ? $location_result->city : '';
391
+					$region = isset($location_result->region) ? $location_result->region : '';
392
+					$country = isset($location_result->country) ? $location_result->country : '';
393 393
 
394 394
 
395
-                    $map_title = __("Set Address On Map", 'geodirectory');
395
+					$map_title = __("Set Address On Map", 'geodirectory');
396 396
 
397
-                    ?>
397
+					?>
398 398
 
399 399
                     <h3><?php _e('Set Default Location', 'geodirectory');?></h3>
400 400
 
401 401
                     <input type="hidden" name="add_location" value="location">
402 402
 
403 403
                     <input type="hidden" name="update_city" value="<?php if (isset($location_result->location_id)) {
404
-                        echo $location_result->location_id;
405
-                    } ?>">
404
+						echo $location_result->location_id;
405
+					} ?>">
406 406
 
407 407
                     <input type="hidden" name="address" id="<?php echo $prefix;?>address" value="">
408 408
 
@@ -415,8 +415,8 @@  discard block
 block discarded – undo
415 415
                                     <input class="require" type="text" size="80" style="width:440px"
416 416
                                            id="<?php echo $prefix;?>city" name="city"
417 417
                                            value="<?php if (isset($location_result->city)) {
418
-                                               echo $location_result->city;
419
-                                           } ?>"/>
418
+											   echo $location_result->city;
419
+										   } ?>"/>
420 420
 
421 421
                                     <div
422 422
                                         class="gd-location_message_error"> <?php _e('This field is required.', 'geodirectory'); ?></div>
@@ -431,8 +431,8 @@  discard block
 block discarded – undo
431 431
                                     <input class="require" type="text" size="80" style="width:440px"
432 432
                                            id="<?php echo $prefix;?>region" name="region"
433 433
                                            value="<?php if (isset($location_result->region)) {
434
-                                               echo $location_result->region;
435
-                                           } ?>"/>
434
+											   echo $location_result->region;
435
+										   } ?>"/>
436 436
 
437 437
                                     <div
438 438
                                         class="gd-location_message_error"> <?php _e('This field is required.', 'geodirectory'); ?></div>
@@ -446,8 +446,8 @@  discard block
 block discarded – undo
446 446
                                 <div class="gtd-formfeild required" style="padding-top:10px;">
447 447
                                     <?php
448 448
 
449
-                                    $country_result = isset($location_result->country) ? $location_result->country : '';
450
-                                    ?>
449
+									$country_result = isset($location_result->country) ? $location_result->country : '';
450
+									?>
451 451
                                     <select id="<?php echo $prefix ?>country" class="chosen_select"
452 452
                                             data-location_type="country" name="<?php echo $prefix ?>country"
453 453
                                             data-placeholder="<?php _e('Choose a country.', 'geodirectory');?>"
@@ -470,12 +470,12 @@  discard block
 block discarded – undo
470 470
                                 scope="row"><?php _e('Set Location on Map', 'geodirectory');?></th>
471 471
                             <td class="forminp">
472 472
                                 <?php
473
-                                /**
474
-                                 * Contains add listing page map functions.
475
-                                 *
476
-                                 * @since 1.0.0
477
-                                 */
478
-                                include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php");?>
473
+								/**
474
+								 * Contains add listing page map functions.
475
+								 *
476
+								 * @since 1.0.0
477
+								 */
478
+								include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php");?>
479 479
                             </td>
480 480
                         </tr>
481 481
                         <tr valign="top" class="single_select_page">
@@ -485,8 +485,8 @@  discard block
 block discarded – undo
485 485
                                     <input type="text" class="require" size="80" style="width:440px"
486 486
                                            id="<?php echo $prefix;?>latitude" name="latitude"
487 487
                                            value="<?php if (isset($location_result->city_latitude)) {
488
-                                               echo $location_result->city_latitude;
489
-                                           } ?>"/>
488
+											   echo $location_result->city_latitude;
489
+										   } ?>"/>
490 490
 
491 491
                                     <div
492 492
                                         class="gd-location_message_error"><?php _e('This field is required.', 'geodirectory'); ?></div>
@@ -502,8 +502,8 @@  discard block
 block discarded – undo
502 502
                                     <input type="text" class="require" size="80" style="width:440px"
503 503
                                            id="<?php echo $prefix;?>longitude" name="longitude"
504 504
                                            value="<?php if (isset($location_result->city_longitude)) {
505
-                                               echo $location_result->city_longitude;
506
-                                           } ?>"/>
505
+											   echo $location_result->city_longitude;
506
+										   } ?>"/>
507 507
 
508 508
                                     <div
509 509
                                         class="gd-location_message_error"><?php _e('This field is required.', 'geodirectory'); ?></div>
@@ -535,22 +535,22 @@  discard block
 block discarded – undo
535 535
                 </div>
536 536
             </div>
537 537
             <?php break;
538
-        case $listing_type . '_fields_settings' :
538
+		case $listing_type . '_fields_settings' :
539 539
 
540
-            geodir_custom_post_type_form();
540
+			geodir_custom_post_type_form();
541 541
 
542
-            break;
543
-        case 'tools_settings' :
544
-            geodir_diagnostic_tools_setting_page();
545
-            break;
546
-        case 'compatibility_settings' :
547
-            geodir_theme_compatibility_setting_page();
548
-            break;		
542
+			break;
543
+		case 'tools_settings' :
544
+			geodir_diagnostic_tools_setting_page();
545
+			break;
546
+		case 'compatibility_settings' :
547
+			geodir_theme_compatibility_setting_page();
548
+			break;		
549 549
 		case 'import_export' :
550
-            geodir_import_export_page();
551
-            break;
550
+			geodir_import_export_page();
551
+			break;
552 552
 
553
-    }// end of switch
553
+	}// end of switch
554 554
 }
555 555
 
556 556
 
@@ -590,170 +590,170 @@  discard block
 block discarded – undo
590 590
 function geodir_update_options_compatibility_settings()
591 591
 {
592 592
 
593
-    global $wpdb;
593
+	global $wpdb;
594 594
 
595 595
 
596
-    $theme_settings = array();
596
+	$theme_settings = array();
597 597
 
598
-    $theme_settings['geodir_wrapper_open_id'] = $_POST['geodir_wrapper_open_id'];
599
-    $theme_settings['geodir_wrapper_open_class'] = $_POST['geodir_wrapper_open_class'];
600
-    $theme_settings['geodir_wrapper_open_replace'] = stripslashes($_POST['geodir_wrapper_open_replace']);
598
+	$theme_settings['geodir_wrapper_open_id'] = $_POST['geodir_wrapper_open_id'];
599
+	$theme_settings['geodir_wrapper_open_class'] = $_POST['geodir_wrapper_open_class'];
600
+	$theme_settings['geodir_wrapper_open_replace'] = stripslashes($_POST['geodir_wrapper_open_replace']);
601 601
 
602
-    $theme_settings['geodir_wrapper_close_replace'] = stripslashes($_POST['geodir_wrapper_close_replace']);
602
+	$theme_settings['geodir_wrapper_close_replace'] = stripslashes($_POST['geodir_wrapper_close_replace']);
603 603
 
604
-    $theme_settings['geodir_wrapper_content_open_id'] = $_POST['geodir_wrapper_content_open_id'];
605
-    $theme_settings['geodir_wrapper_content_open_class'] = $_POST['geodir_wrapper_content_open_class'];
606
-    $theme_settings['geodir_wrapper_content_open_replace'] = stripslashes($_POST['geodir_wrapper_content_open_replace']);
604
+	$theme_settings['geodir_wrapper_content_open_id'] = $_POST['geodir_wrapper_content_open_id'];
605
+	$theme_settings['geodir_wrapper_content_open_class'] = $_POST['geodir_wrapper_content_open_class'];
606
+	$theme_settings['geodir_wrapper_content_open_replace'] = stripslashes($_POST['geodir_wrapper_content_open_replace']);
607 607
 
608
-    $theme_settings['geodir_wrapper_content_close_replace'] = stripslashes($_POST['geodir_wrapper_content_close_replace']);
608
+	$theme_settings['geodir_wrapper_content_close_replace'] = stripslashes($_POST['geodir_wrapper_content_close_replace']);
609 609
 
610
-    $theme_settings['geodir_article_open_id'] = $_POST['geodir_article_open_id'];
611
-    $theme_settings['geodir_article_open_class'] = $_POST['geodir_article_open_class'];
612
-    $theme_settings['geodir_article_open_replace'] = stripslashes($_POST['geodir_article_open_replace']);
610
+	$theme_settings['geodir_article_open_id'] = $_POST['geodir_article_open_id'];
611
+	$theme_settings['geodir_article_open_class'] = $_POST['geodir_article_open_class'];
612
+	$theme_settings['geodir_article_open_replace'] = stripslashes($_POST['geodir_article_open_replace']);
613 613
 
614
-    $theme_settings['geodir_article_close_replace'] = stripslashes($_POST['geodir_article_close_replace']);
614
+	$theme_settings['geodir_article_close_replace'] = stripslashes($_POST['geodir_article_close_replace']);
615 615
 
616
-    $theme_settings['geodir_sidebar_right_open_id'] = $_POST['geodir_sidebar_right_open_id'];
617
-    $theme_settings['geodir_sidebar_right_open_class'] = $_POST['geodir_sidebar_right_open_class'];
618
-    $theme_settings['geodir_sidebar_right_open_replace'] = stripslashes($_POST['geodir_sidebar_right_open_replace']);
616
+	$theme_settings['geodir_sidebar_right_open_id'] = $_POST['geodir_sidebar_right_open_id'];
617
+	$theme_settings['geodir_sidebar_right_open_class'] = $_POST['geodir_sidebar_right_open_class'];
618
+	$theme_settings['geodir_sidebar_right_open_replace'] = stripslashes($_POST['geodir_sidebar_right_open_replace']);
619 619
 
620
-    $theme_settings['geodir_sidebar_right_close_replace'] = stripslashes($_POST['geodir_sidebar_right_close_replace']);
620
+	$theme_settings['geodir_sidebar_right_close_replace'] = stripslashes($_POST['geodir_sidebar_right_close_replace']);
621 621
 
622
-    $theme_settings['geodir_sidebar_left_open_id'] = $_POST['geodir_sidebar_left_open_id'];
623
-    $theme_settings['geodir_sidebar_left_open_class'] = $_POST['geodir_sidebar_left_open_class'];
624
-    $theme_settings['geodir_sidebar_left_open_replace'] = stripslashes($_POST['geodir_sidebar_left_open_replace']);
622
+	$theme_settings['geodir_sidebar_left_open_id'] = $_POST['geodir_sidebar_left_open_id'];
623
+	$theme_settings['geodir_sidebar_left_open_class'] = $_POST['geodir_sidebar_left_open_class'];
624
+	$theme_settings['geodir_sidebar_left_open_replace'] = stripslashes($_POST['geodir_sidebar_left_open_replace']);
625 625
 
626
-    $theme_settings['geodir_sidebar_left_close_replace'] = stripslashes($_POST['geodir_sidebar_left_close_replace']);
626
+	$theme_settings['geodir_sidebar_left_close_replace'] = stripslashes($_POST['geodir_sidebar_left_close_replace']);
627 627
 
628
-    $theme_settings['geodir_main_content_open_id'] = $_POST['geodir_main_content_open_id'];
629
-    $theme_settings['geodir_main_content_open_class'] = $_POST['geodir_main_content_open_class'];
630
-    $theme_settings['geodir_main_content_open_replace'] = stripslashes($_POST['geodir_main_content_open_replace']);
628
+	$theme_settings['geodir_main_content_open_id'] = $_POST['geodir_main_content_open_id'];
629
+	$theme_settings['geodir_main_content_open_class'] = $_POST['geodir_main_content_open_class'];
630
+	$theme_settings['geodir_main_content_open_replace'] = stripslashes($_POST['geodir_main_content_open_replace']);
631 631
 
632
-    $theme_settings['geodir_main_content_close_replace'] = stripslashes($_POST['geodir_main_content_close_replace']);
632
+	$theme_settings['geodir_main_content_close_replace'] = stripslashes($_POST['geodir_main_content_close_replace']);
633 633
 
634 634
 // Other Actions
635
-    $theme_settings['geodir_top_content_add'] = stripslashes($_POST['geodir_top_content_add']);
636
-    $theme_settings['geodir_before_main_content_add'] = stripslashes($_POST['geodir_before_main_content_add']);
635
+	$theme_settings['geodir_top_content_add'] = stripslashes($_POST['geodir_top_content_add']);
636
+	$theme_settings['geodir_before_main_content_add'] = stripslashes($_POST['geodir_before_main_content_add']);
637 637
 
638 638
 // Filters
639
-    $theme_settings['geodir_full_page_class_filter'] = stripslashes($_POST['geodir_full_page_class_filter']);
640
-    $theme_settings['geodir_before_widget_filter'] = stripslashes($_POST['geodir_before_widget_filter']);
641
-    $theme_settings['geodir_after_widget_filter'] = stripslashes($_POST['geodir_after_widget_filter']);
642
-    $theme_settings['geodir_before_title_filter'] = stripslashes($_POST['geodir_before_title_filter']);
643
-    $theme_settings['geodir_after_title_filter'] = stripslashes($_POST['geodir_after_title_filter']);
644
-    $theme_settings['geodir_menu_li_class_filter'] = stripslashes($_POST['geodir_menu_li_class_filter']);
645
-    $theme_settings['geodir_sub_menu_ul_class_filter'] = stripslashes($_POST['geodir_sub_menu_ul_class_filter']);
646
-    $theme_settings['geodir_sub_menu_li_class_filter'] = stripslashes($_POST['geodir_sub_menu_li_class_filter']);
647
-    $theme_settings['geodir_menu_a_class_filter'] = stripslashes($_POST['geodir_menu_a_class_filter']);
648
-    $theme_settings['geodir_sub_menu_a_class_filter'] = stripslashes($_POST['geodir_sub_menu_a_class_filter']);
639
+	$theme_settings['geodir_full_page_class_filter'] = stripslashes($_POST['geodir_full_page_class_filter']);
640
+	$theme_settings['geodir_before_widget_filter'] = stripslashes($_POST['geodir_before_widget_filter']);
641
+	$theme_settings['geodir_after_widget_filter'] = stripslashes($_POST['geodir_after_widget_filter']);
642
+	$theme_settings['geodir_before_title_filter'] = stripslashes($_POST['geodir_before_title_filter']);
643
+	$theme_settings['geodir_after_title_filter'] = stripslashes($_POST['geodir_after_title_filter']);
644
+	$theme_settings['geodir_menu_li_class_filter'] = stripslashes($_POST['geodir_menu_li_class_filter']);
645
+	$theme_settings['geodir_sub_menu_ul_class_filter'] = stripslashes($_POST['geodir_sub_menu_ul_class_filter']);
646
+	$theme_settings['geodir_sub_menu_li_class_filter'] = stripslashes($_POST['geodir_sub_menu_li_class_filter']);
647
+	$theme_settings['geodir_menu_a_class_filter'] = stripslashes($_POST['geodir_menu_a_class_filter']);
648
+	$theme_settings['geodir_sub_menu_a_class_filter'] = stripslashes($_POST['geodir_sub_menu_a_class_filter']);
649 649
 //location manager filters
650
-    $theme_settings['geodir_location_switcher_menu_li_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_li_class_filter']);
651
-    $theme_settings['geodir_location_switcher_menu_a_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_a_class_filter']);
652
-    $theme_settings['geodir_location_switcher_menu_sub_ul_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_sub_ul_class_filter']);
653
-    $theme_settings['geodir_location_switcher_menu_sub_li_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_sub_li_class_filter']);
650
+	$theme_settings['geodir_location_switcher_menu_li_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_li_class_filter']);
651
+	$theme_settings['geodir_location_switcher_menu_a_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_a_class_filter']);
652
+	$theme_settings['geodir_location_switcher_menu_sub_ul_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_sub_ul_class_filter']);
653
+	$theme_settings['geodir_location_switcher_menu_sub_li_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_sub_li_class_filter']);
654 654
 
655 655
 
656 656
 // theme required css
657
-    $theme_settings['geodir_theme_compat_css'] = stripslashes($_POST['geodir_theme_compat_css']);
657
+	$theme_settings['geodir_theme_compat_css'] = stripslashes($_POST['geodir_theme_compat_css']);
658 658
 
659 659
 // theme required js
660
-    $theme_settings['geodir_theme_compat_js'] = stripslashes($_POST['geodir_theme_compat_js']);
660
+	$theme_settings['geodir_theme_compat_js'] = stripslashes($_POST['geodir_theme_compat_js']);
661 661
 
662 662
 // theme compat name
663
-    $theme_settings['gd_theme_compat'] = $_POST['gd_theme_compat'];
664
-    if ($theme_settings['gd_theme_compat'] == '') {
665
-        update_option('gd_theme_compat', '');
666
-        update_option('theme_compatibility_setting', '');
667
-        return;
668
-    }
663
+	$theme_settings['gd_theme_compat'] = $_POST['gd_theme_compat'];
664
+	if ($theme_settings['gd_theme_compat'] == '') {
665
+		update_option('gd_theme_compat', '');
666
+		update_option('theme_compatibility_setting', '');
667
+		return;
668
+	}
669 669
 
670 670
 // theme default options
671
-    $theme_settings['geodir_theme_compat_default_options'] = '';
671
+	$theme_settings['geodir_theme_compat_default_options'] = '';
672 672
 
673 673
 
674 674
 //suported theme code
675
-    $theme_settings['geodir_theme_compat_code'] = false;
676
-
677
-    $theme = wp_get_theme();
678
-
679
-    if ($theme->parent()) {
680
-        $theme_name = str_replace(" ", "_", $theme->parent()->get('Name'));
681
-    } else {
682
-        $theme_name = str_replace(" ", "_", $theme->get('Name'));
683
-    }
684
-
685
-    if (in_array($theme_name, array('Avada', 'Enfold', 'X', 'Divi', 'Genesis', 'Jupiter', 'Multi_News'))) {// list of themes that have php files
686
-        $theme_settings['geodir_theme_compat_code'] = $theme_name;
687
-    }
688
-
689
-
690
-    $theme_name = $theme_name . "_custom";
691
-    $theme_arr = get_option('gd_theme_compats');
692
-    update_option('gd_theme_compat', $theme_name);
693
-    /**
694
-     * Called before the theme compatibility settings are saved to the DB.
695
-     *
696
-     * @since 1.4.0
697
-     * @param array $theme_settings {
698
-     *    Attributes of the theme compatibility settings array.
699
-     *
700
-     *    @type string $geodir_wrapper_open_id Geodir wrapper open html id.
701
-     *    @type string $geodir_wrapper_open_class Geodir wrapper open html class.
702
-     *    @type string $geodir_wrapper_open_replace Geodir wrapper open content replace.
703
-     *    @type string $geodir_wrapper_close_replace Geodir wrapper close content replace.
704
-     *    @type string $geodir_wrapper_content_open_id Geodir wrapper content open html id.
705
-     *    @type string $geodir_wrapper_content_open_class Geodir wrapper content open html class.
706
-     *    @type string $geodir_wrapper_content_open_replace Geodir wrapper content open content replace.
707
-     *    @type string $geodir_wrapper_content_close_replace Geodir wrapper content close content replace.
708
-     *    @type string $geodir_article_open_id Geodir article open html id.
709
-     *    @type string $geodir_article_open_class Geodir article open html class.
710
-     *    @type string $geodir_article_open_replace Geodir article open content replace.
711
-     *    @type string $geodir_article_close_replace Geodir article close content replace.
712
-     *    @type string $geodir_sidebar_right_open_id Geodir sidebar right open html id.
713
-     *    @type string $geodir_sidebar_right_open_class Geodir sidebar right open html class.
714
-     *    @type string $geodir_sidebar_right_open_replace Geodir sidebar right open content replace.
715
-     *    @type string $geodir_sidebar_right_close_replace Geodir sidebar right close content replace.
716
-     *    @type string $geodir_sidebar_left_open_id Geodir sidebar left open html id.
717
-     *    @type string $geodir_sidebar_left_open_class Geodir sidebar left open html class.
718
-     *    @type string $geodir_sidebar_left_open_replace Geodir sidebar left open content replace.
719
-     *    @type string $geodir_sidebar_left_close_replace Geodir sidebar left close content replace.
720
-     *    @type string $geodir_main_content_open_id Geodir main content open html id.
721
-     *    @type string $geodir_main_content_open_class Geodir main content open html class.
722
-     *    @type string $geodir_main_content_open_replace Geodir main content open content replace.
723
-     *    @type string $geodir_main_content_close_replace Geodir main content close content replace.
724
-     *    @type string $geodir_top_content_add Geodir top content add.
725
-     *    @type string $geodir_before_main_content_add Geodir before main content add.
726
-     *    @type string $geodir_full_page_class_filter Geodir full page class filter.
727
-     *    @type string $geodir_before_widget_filter Geodir before widget filter.
728
-     *    @type string $geodir_after_widget_filter Geodir after widget filter.
729
-     *    @type string $geodir_before_title_filter Geodir before title filter.
730
-     *    @type string $geodir_after_title_filter Geodir after title filter.
731
-     *    @type string $geodir_menu_li_class_filter Geodir menu li class filter.
732
-     *    @type string $geodir_sub_menu_ul_class_filter Geodir sub menu ul class filter.
733
-     *    @type string $geodir_sub_menu_li_class_filter Geodir sub menu li class filter.
734
-     *    @type string $geodir_menu_a_class_filter Geodir menu a class filter.
735
-     *    @type string $geodir_sub_menu_a_class_filter Geodir sub menu a class filter.
736
-     *    @type string $geodir_location_switcher_menu_li_class_filter Geodir location switcher menu li class filter.
737
-     *    @type string $geodir_location_switcher_menu_a_class_filter Geodir location switcher menu a class filter.
738
-     *    @type string $geodir_location_switcher_menu_sub_ul_class_filter Geodir location switcher menu sub ul class filter.
739
-     *    @type string $geodir_location_switcher_menu_sub_li_class_filter Geodir location switcher menu sub li class filter.
740
-     *    @type string $geodir_theme_compat_css Geodir theme compatibility css.
741
-     *    @type string $geodir_theme_compat_js Geodir theme compatibility js.
742
-     *    @type string $gd_theme_compat Gd theme compatibility.
743
-     *    @type string $geodir_theme_compat_default_options Geodir theme compatibility default options.
744
-     *    @type bool $geodir_theme_compat_code Geodir theme compatibility code Ex: 'Avada.
745
-     *
746
-     * }
747
-     */
748
-    do_action('gd_compat_save_settings', $theme_settings);
675
+	$theme_settings['geodir_theme_compat_code'] = false;
676
+
677
+	$theme = wp_get_theme();
678
+
679
+	if ($theme->parent()) {
680
+		$theme_name = str_replace(" ", "_", $theme->parent()->get('Name'));
681
+	} else {
682
+		$theme_name = str_replace(" ", "_", $theme->get('Name'));
683
+	}
684
+
685
+	if (in_array($theme_name, array('Avada', 'Enfold', 'X', 'Divi', 'Genesis', 'Jupiter', 'Multi_News'))) {// list of themes that have php files
686
+		$theme_settings['geodir_theme_compat_code'] = $theme_name;
687
+	}
688
+
689
+
690
+	$theme_name = $theme_name . "_custom";
691
+	$theme_arr = get_option('gd_theme_compats');
692
+	update_option('gd_theme_compat', $theme_name);
693
+	/**
694
+	 * Called before the theme compatibility settings are saved to the DB.
695
+	 *
696
+	 * @since 1.4.0
697
+	 * @param array $theme_settings {
698
+	 *    Attributes of the theme compatibility settings array.
699
+	 *
700
+	 *    @type string $geodir_wrapper_open_id Geodir wrapper open html id.
701
+	 *    @type string $geodir_wrapper_open_class Geodir wrapper open html class.
702
+	 *    @type string $geodir_wrapper_open_replace Geodir wrapper open content replace.
703
+	 *    @type string $geodir_wrapper_close_replace Geodir wrapper close content replace.
704
+	 *    @type string $geodir_wrapper_content_open_id Geodir wrapper content open html id.
705
+	 *    @type string $geodir_wrapper_content_open_class Geodir wrapper content open html class.
706
+	 *    @type string $geodir_wrapper_content_open_replace Geodir wrapper content open content replace.
707
+	 *    @type string $geodir_wrapper_content_close_replace Geodir wrapper content close content replace.
708
+	 *    @type string $geodir_article_open_id Geodir article open html id.
709
+	 *    @type string $geodir_article_open_class Geodir article open html class.
710
+	 *    @type string $geodir_article_open_replace Geodir article open content replace.
711
+	 *    @type string $geodir_article_close_replace Geodir article close content replace.
712
+	 *    @type string $geodir_sidebar_right_open_id Geodir sidebar right open html id.
713
+	 *    @type string $geodir_sidebar_right_open_class Geodir sidebar right open html class.
714
+	 *    @type string $geodir_sidebar_right_open_replace Geodir sidebar right open content replace.
715
+	 *    @type string $geodir_sidebar_right_close_replace Geodir sidebar right close content replace.
716
+	 *    @type string $geodir_sidebar_left_open_id Geodir sidebar left open html id.
717
+	 *    @type string $geodir_sidebar_left_open_class Geodir sidebar left open html class.
718
+	 *    @type string $geodir_sidebar_left_open_replace Geodir sidebar left open content replace.
719
+	 *    @type string $geodir_sidebar_left_close_replace Geodir sidebar left close content replace.
720
+	 *    @type string $geodir_main_content_open_id Geodir main content open html id.
721
+	 *    @type string $geodir_main_content_open_class Geodir main content open html class.
722
+	 *    @type string $geodir_main_content_open_replace Geodir main content open content replace.
723
+	 *    @type string $geodir_main_content_close_replace Geodir main content close content replace.
724
+	 *    @type string $geodir_top_content_add Geodir top content add.
725
+	 *    @type string $geodir_before_main_content_add Geodir before main content add.
726
+	 *    @type string $geodir_full_page_class_filter Geodir full page class filter.
727
+	 *    @type string $geodir_before_widget_filter Geodir before widget filter.
728
+	 *    @type string $geodir_after_widget_filter Geodir after widget filter.
729
+	 *    @type string $geodir_before_title_filter Geodir before title filter.
730
+	 *    @type string $geodir_after_title_filter Geodir after title filter.
731
+	 *    @type string $geodir_menu_li_class_filter Geodir menu li class filter.
732
+	 *    @type string $geodir_sub_menu_ul_class_filter Geodir sub menu ul class filter.
733
+	 *    @type string $geodir_sub_menu_li_class_filter Geodir sub menu li class filter.
734
+	 *    @type string $geodir_menu_a_class_filter Geodir menu a class filter.
735
+	 *    @type string $geodir_sub_menu_a_class_filter Geodir sub menu a class filter.
736
+	 *    @type string $geodir_location_switcher_menu_li_class_filter Geodir location switcher menu li class filter.
737
+	 *    @type string $geodir_location_switcher_menu_a_class_filter Geodir location switcher menu a class filter.
738
+	 *    @type string $geodir_location_switcher_menu_sub_ul_class_filter Geodir location switcher menu sub ul class filter.
739
+	 *    @type string $geodir_location_switcher_menu_sub_li_class_filter Geodir location switcher menu sub li class filter.
740
+	 *    @type string $geodir_theme_compat_css Geodir theme compatibility css.
741
+	 *    @type string $geodir_theme_compat_js Geodir theme compatibility js.
742
+	 *    @type string $gd_theme_compat Gd theme compatibility.
743
+	 *    @type string $geodir_theme_compat_default_options Geodir theme compatibility default options.
744
+	 *    @type bool $geodir_theme_compat_code Geodir theme compatibility code Ex: 'Avada.
745
+	 *
746
+	 * }
747
+	 */
748
+	do_action('gd_compat_save_settings', $theme_settings);
749 749
 
750 750
 //if($_POST['gd_theme_compat'])==
751
-    $theme_arr[$theme_name] = $theme_settings;
752
-    update_option('gd_theme_compats', $theme_arr);
751
+	$theme_arr[$theme_name] = $theme_settings;
752
+	update_option('gd_theme_compats', $theme_arr);
753 753
 
754 754
 
755 755
 //print_r($theme_settings);exit;
756
-    update_option('theme_compatibility_setting', $theme_settings);
756
+	update_option('theme_compatibility_setting', $theme_settings);
757 757
 
758 758
 }
759 759
 
@@ -766,12 +766,12 @@  discard block
 block discarded – undo
766 766
  */
767 767
 function geodir_theme_compatibility_setting_page()
768 768
 {
769
-    global $wpdb;
770
-    $tc = get_option('theme_compatibility_setting');
771
-    //print_r($tc);
772
-    //print_r(wp_get_theme());
769
+	global $wpdb;
770
+	$tc = get_option('theme_compatibility_setting');
771
+	//print_r($tc);
772
+	//print_r(wp_get_theme());
773 773
 
774
-    ?>
774
+	?>
775 775
     <div class="inner_content_tab_main">
776 776
         <div class="gd-content-heading">
777 777
 
@@ -813,21 +813,21 @@  discard block
 block discarded – undo
813 813
                 <option value=""><?php _e('Select Theme', 'geodirectory');?></option>
814 814
                 <option value="custom"><?php _e('Custom', 'geodirectory');?></option>
815 815
                 <?php
816
-                $theme_arr = get_option('gd_theme_compats');
817
-                $theme_active = get_option('gd_theme_compat');
818
-                if (is_array($theme_arr)) {
819
-                    foreach ($theme_arr as $key => $theme) {
820
-                        $sel = '';
821
-                        if ($theme_active == $key) {
822
-                            $sel = "selected";
823
-                        }
824
-                        echo "<option $sel>$key</option>";
825
-                    }
816
+				$theme_arr = get_option('gd_theme_compats');
817
+				$theme_active = get_option('gd_theme_compat');
818
+				if (is_array($theme_arr)) {
819
+					foreach ($theme_arr as $key => $theme) {
820
+						$sel = '';
821
+						if ($theme_active == $key) {
822
+							$sel = "selected";
823
+						}
824
+						echo "<option $sel>$key</option>";
825
+					}
826 826
 
827 827
 
828
-                }
828
+				}
829 829
 
830
-                ?>
830
+				?>
831 831
             </select>
832 832
             <button onclick="gd_comp_export();" type="button"
833 833
                     class="button-primary"><?php _e('Export', 'geodirectory');?></button>
@@ -936,11 +936,11 @@  discard block
 block discarded – undo
936 936
                         <small>geodir_wrapper_open</small>
937 937
                     </td>
938 938
                     <td><input value="<?php if (isset($tc['geodir_wrapper_open_id'])) {
939
-                            echo $tc['geodir_wrapper_open_id'];
940
-                        }?>" type="text" name="geodir_wrapper_open_id" placeholder="geodir-wrapper"/></td>
939
+							echo $tc['geodir_wrapper_open_id'];
940
+						}?>" type="text" name="geodir_wrapper_open_id" placeholder="geodir-wrapper"/></td>
941 941
                     <td><input value="<?php if (isset($tc['geodir_wrapper_open_class'])) {
942
-                            echo $tc['geodir_wrapper_open_class'];
943
-                        }?>" type="text" name="geodir_wrapper_open_class" placeholder=""/></td>
942
+							echo $tc['geodir_wrapper_open_class'];
943
+						}?>" type="text" name="geodir_wrapper_open_class" placeholder=""/></td>
944 944
                 </tr>
945 945
 
946 946
                 <tr class="gd-theme-comp-out">
@@ -948,8 +948,8 @@  discard block
 block discarded – undo
948 948
                         <span><?php _e('Output:', 'geodirectory');?></span>
949 949
                         <textarea name="geodir_wrapper_open_replace"
950 950
                                   placeholder='<div id="[id]" class="[class]">'><?php if (isset($tc['geodir_wrapper_open_replace'])) {
951
-                                echo $tc['geodir_wrapper_open_replace'];
952
-                            }?></textarea>
951
+								echo $tc['geodir_wrapper_open_replace'];
952
+							}?></textarea>
953 953
                     </td>
954 954
                 </tr>
955 955
 
@@ -969,8 +969,8 @@  discard block
 block discarded – undo
969 969
                         <span><?php _e('Output:', 'geodirectory');?></span>
970 970
                         <textarea name="geodir_wrapper_close_replace"
971 971
                                   placeholder='</div><!-- wrapper ends here-->'><?php if (isset($tc['geodir_wrapper_close_replace'])) {
972
-                                echo $tc['geodir_wrapper_close_replace'];
973
-                            }?></textarea>
972
+								echo $tc['geodir_wrapper_close_replace'];
973
+							}?></textarea>
974 974
                     </td>
975 975
                 </tr>
976 976
 
@@ -980,12 +980,12 @@  discard block
 block discarded – undo
980 980
                         <small>geodir_wrapper_content_open</small>
981 981
                     </td>
982 982
                     <td><input value="<?php if (isset($tc['geodir_wrapper_content_open_id'])) {
983
-                            echo $tc['geodir_wrapper_content_open_id'];
984
-                        }?>" type="text" name="geodir_wrapper_content_open_id" placeholder="geodir-wrapper-content"/>
983
+							echo $tc['geodir_wrapper_content_open_id'];
984
+						}?>" type="text" name="geodir_wrapper_content_open_id" placeholder="geodir-wrapper-content"/>
985 985
                     </td>
986 986
                     <td><input value="<?php if (isset($tc['geodir_wrapper_content_open_class'])) {
987
-                            echo $tc['geodir_wrapper_content_open_class'];
988
-                        }?>" type="text" name="geodir_wrapper_content_open_class" placeholder=""/></td>
987
+							echo $tc['geodir_wrapper_content_open_class'];
988
+						}?>" type="text" name="geodir_wrapper_content_open_class" placeholder=""/></td>
989 989
                 </tr>
990 990
 
991 991
                 <tr class="gd-theme-comp-out">
@@ -993,8 +993,8 @@  discard block
 block discarded – undo
993 993
                         <span><?php _e('Output:', 'geodirectory');?></span>
994 994
                         <textarea name="geodir_wrapper_content_open_replace"
995 995
                                   placeholder='<div id="[id]" class="[class]" role="main" [width_css]>'><?php if (isset($tc['geodir_wrapper_content_open_replace'])) {
996
-                                echo $tc['geodir_wrapper_content_open_replace'];
997
-                            }?></textarea>
996
+								echo $tc['geodir_wrapper_content_open_replace'];
997
+							}?></textarea>
998 998
                     </td>
999 999
                 </tr>
1000 1000
 
@@ -1014,8 +1014,8 @@  discard block
 block discarded – undo
1014 1014
                         <span><?php _e('Output:', 'geodirectory');?></span>
1015 1015
                         <textarea name="geodir_wrapper_content_close_replace"
1016 1016
                                   placeholder='</div><!-- content ends here-->'><?php if (isset($tc['geodir_wrapper_content_close_replace'])) {
1017
-                                echo $tc['geodir_wrapper_content_close_replace'];
1018
-                            }?></textarea>
1017
+								echo $tc['geodir_wrapper_content_close_replace'];
1018
+							}?></textarea>
1019 1019
                     </td>
1020 1020
                 </tr>
1021 1021
 
@@ -1024,11 +1024,11 @@  discard block
 block discarded – undo
1024 1024
                         <small>geodir_article_open</small>
1025 1025
                     </td>
1026 1026
                     <td><input value="<?php if (isset($tc['geodir_article_open_id'])) {
1027
-                            echo $tc['geodir_article_open_id'];
1028
-                        }?>" type="text" name="geodir_article_open_id" placeholder="geodir-wrapper-content"/></td>
1027
+							echo $tc['geodir_article_open_id'];
1028
+						}?>" type="text" name="geodir_article_open_id" placeholder="geodir-wrapper-content"/></td>
1029 1029
                     <td><input value="<?php if (isset($tc['geodir_article_open_class'])) {
1030
-                            echo $tc['geodir_article_open_class'];
1031
-                        }?>" type="text" name="geodir_article_open_class" placeholder=""/></td>
1030
+							echo $tc['geodir_article_open_class'];
1031
+						}?>" type="text" name="geodir_article_open_class" placeholder=""/></td>
1032 1032
                 </tr>
1033 1033
 
1034 1034
                 <tr class="gd-theme-comp-out">
@@ -1036,8 +1036,8 @@  discard block
 block discarded – undo
1036 1036
                         <span><?php _e('Output:', 'geodirectory');?></span>
1037 1037
                         <textarea name="geodir_article_open_replace"
1038 1038
                                   placeholder='<article  id="[id]" class="[class]" itemscope itemtype="[itemtype]">'><?php if (isset($tc['geodir_article_open_replace'])) {
1039
-                                echo $tc['geodir_article_open_replace'];
1040
-                            }?></textarea>
1039
+								echo $tc['geodir_article_open_replace'];
1040
+							}?></textarea>
1041 1041
                     </td>
1042 1042
                 </tr>
1043 1043
 
@@ -1056,8 +1056,8 @@  discard block
 block discarded – undo
1056 1056
                         <span><?php _e('Output:', 'geodirectory');?></span>
1057 1057
                         <textarea name="geodir_article_close_replace"
1058 1058
                                   placeholder='</article><!-- article ends here-->'><?php if (isset($tc['geodir_article_close_replace'])) {
1059
-                                echo $tc['geodir_article_close_replace'];
1060
-                            }?></textarea>
1059
+								echo $tc['geodir_article_close_replace'];
1060
+							}?></textarea>
1061 1061
                     </td>
1062 1062
                 </tr>
1063 1063
 
@@ -1066,11 +1066,11 @@  discard block
 block discarded – undo
1066 1066
                         <small>geodir_sidebar_right_open</small>
1067 1067
                     </td>
1068 1068
                     <td><input value="<?php if (isset($tc['geodir_sidebar_right_open_id'])) {
1069
-                            echo $tc['geodir_sidebar_right_open_id'];
1070
-                        }?>" type="text" name="geodir_sidebar_right_open_id" placeholder="geodir-sidebar-right"/></td>
1069
+							echo $tc['geodir_sidebar_right_open_id'];
1070
+						}?>" type="text" name="geodir_sidebar_right_open_id" placeholder="geodir-sidebar-right"/></td>
1071 1071
                     <td><input value="<?php if (isset($tc['geodir_sidebar_right_open_class'])) {
1072
-                            echo $tc['geodir_sidebar_right_open_class'];
1073
-                        }?>" type="text" name="geodir_sidebar_right_open_class"
1072
+							echo $tc['geodir_sidebar_right_open_class'];
1073
+						}?>" type="text" name="geodir_sidebar_right_open_class"
1074 1074
                                placeholder="geodir-sidebar-right geodir-listings-sidebar-right"/></td>
1075 1075
                 </tr>
1076 1076
 
@@ -1079,8 +1079,8 @@  discard block
 block discarded – undo
1079 1079
                         <span><?php _e('Output:', 'geodirectory');?></span>
1080 1080
                         <textarea name="geodir_sidebar_right_open_replace"
1081 1081
                                   placeholder='<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>'><?php if (isset($tc['geodir_sidebar_right_open_replace'])) {
1082
-                                echo $tc['geodir_sidebar_right_open_replace'];
1083
-                            }?></textarea>
1082
+								echo $tc['geodir_sidebar_right_open_replace'];
1083
+							}?></textarea>
1084 1084
                     </td>
1085 1085
                 </tr>
1086 1086
 
@@ -1099,8 +1099,8 @@  discard block
 block discarded – undo
1099 1099
                         <span><?php _e('Output:', 'geodirectory');?></span>
1100 1100
                         <textarea name="geodir_sidebar_right_close_replace"
1101 1101
                                   placeholder='</aside><!-- sidebar ends here-->'><?php if (isset($tc['geodir_sidebar_right_close_replace'])) {
1102
-                                echo $tc['geodir_sidebar_right_close_replace'];
1103
-                            }?></textarea>
1102
+								echo $tc['geodir_sidebar_right_close_replace'];
1103
+							}?></textarea>
1104 1104
                     </td>
1105 1105
                 </tr>
1106 1106
 
@@ -1110,11 +1110,11 @@  discard block
 block discarded – undo
1110 1110
                         <small>geodir_sidebar_left_open</small>
1111 1111
                     </td>
1112 1112
                     <td><input value="<?php if (isset($tc['geodir_sidebar_left_open_id'])) {
1113
-                            echo $tc['geodir_sidebar_left_open_id'];
1114
-                        }?>" type="text" name="geodir_sidebar_left_open_id" placeholder="geodir-sidebar-left"/></td>
1113
+							echo $tc['geodir_sidebar_left_open_id'];
1114
+						}?>" type="text" name="geodir_sidebar_left_open_id" placeholder="geodir-sidebar-left"/></td>
1115 1115
                     <td><input value="<?php if (isset($tc['geodir_sidebar_left_open_class'])) {
1116
-                            echo $tc['geodir_sidebar_left_open_class'];
1117
-                        }?>" type="text" name="geodir_sidebar_left_open_class"
1116
+							echo $tc['geodir_sidebar_left_open_class'];
1117
+						}?>" type="text" name="geodir_sidebar_left_open_class"
1118 1118
                                placeholder="geodir-sidebar-left geodir-listings-sidebar-left"/></td>
1119 1119
                 </tr>
1120 1120
 
@@ -1123,8 +1123,8 @@  discard block
 block discarded – undo
1123 1123
                         <span><?php _e('Output:', 'geodirectory');?></span>
1124 1124
                         <textarea name="geodir_sidebar_left_open_replace"
1125 1125
                                   placeholder='<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>'><?php if (isset($tc['geodir_sidebar_left_open_replace'])) {
1126
-                                echo $tc['geodir_sidebar_left_open_replace'];
1127
-                            }?></textarea>
1126
+								echo $tc['geodir_sidebar_left_open_replace'];
1127
+							}?></textarea>
1128 1128
                     </td>
1129 1129
                 </tr>
1130 1130
 
@@ -1143,8 +1143,8 @@  discard block
 block discarded – undo
1143 1143
                         <span><?php _e('Output:', 'geodirectory');?></span>
1144 1144
                         <textarea name="geodir_sidebar_left_close_replace"
1145 1145
                                   placeholder='</aside><!-- sidebar ends here-->'><?php if (isset($tc['geodir_sidebar_left_close_replace'])) {
1146
-                                echo $tc['geodir_sidebar_left_close_replace'];
1147
-                            }?></textarea>
1146
+								echo $tc['geodir_sidebar_left_close_replace'];
1147
+							}?></textarea>
1148 1148
                     </td>
1149 1149
                 </tr>
1150 1150
 
@@ -1153,11 +1153,11 @@  discard block
 block discarded – undo
1153 1153
                         <small>geodir_main_content_open</small>
1154 1154
                     </td>
1155 1155
                     <td><input value="<?php if (isset($tc['geodir_main_content_open_id'])) {
1156
-                            echo $tc['geodir_main_content_open_id'];
1157
-                        }?>" type="text" name="geodir_main_content_open_id" placeholder="geodir-main-content"/></td>
1156
+							echo $tc['geodir_main_content_open_id'];
1157
+						}?>" type="text" name="geodir_main_content_open_id" placeholder="geodir-main-content"/></td>
1158 1158
                     <td><input value="<?php if (isset($tc['geodir_main_content_open_class'])) {
1159
-                            echo $tc['geodir_main_content_open_class'];
1160
-                        }?>" type="text" name="geodir_main_content_open_class" placeholder="CURRENT-PAGE-page"/></td>
1159
+							echo $tc['geodir_main_content_open_class'];
1160
+						}?>" type="text" name="geodir_main_content_open_class" placeholder="CURRENT-PAGE-page"/></td>
1161 1161
                 </tr>
1162 1162
 
1163 1163
                 <tr class="gd-theme-comp-out">
@@ -1165,8 +1165,8 @@  discard block
 block discarded – undo
1165 1165
                         <span><?php _e('Output:', 'geodirectory');?></span>
1166 1166
                         <textarea name="geodir_main_content_open_replace"
1167 1167
                                   placeholder='<main  id="[id]" class="[class]"  role="main">'><?php if (isset($tc['geodir_main_content_open_replace'])) {
1168
-                                echo $tc['geodir_main_content_open_replace'];
1169
-                            }?></textarea>
1168
+								echo $tc['geodir_main_content_open_replace'];
1169
+							}?></textarea>
1170 1170
                     </td>
1171 1171
                 </tr>
1172 1172
 
@@ -1185,8 +1185,8 @@  discard block
 block discarded – undo
1185 1185
                         <span><?php _e('Output:', 'geodirectory');?></span>
1186 1186
                         <textarea name="geodir_main_content_close_replace"
1187 1187
                                   placeholder='</main><!-- main ends here-->'><?php if (isset($tc['geodir_main_content_close_replace'])) {
1188
-                                echo $tc['geodir_main_content_close_replace'];
1189
-                            }?></textarea>
1188
+								echo $tc['geodir_main_content_close_replace'];
1189
+							}?></textarea>
1190 1190
                     </td>
1191 1191
                 </tr>
1192 1192
 
@@ -1210,8 +1210,8 @@  discard block
 block discarded – undo
1210 1210
                     </td>
1211 1211
                     <td><textarea name="geodir_top_content_add"
1212 1212
                                   placeholder=''><?php if (isset($tc['geodir_top_content_add'])) {
1213
-                                echo $tc['geodir_top_content_add'];
1214
-                            }?></textarea></td>
1213
+								echo $tc['geodir_top_content_add'];
1214
+							}?></textarea></td>
1215 1215
                 </tr>
1216 1216
 
1217 1217
                 <tr>
@@ -1220,8 +1220,8 @@  discard block
 block discarded – undo
1220 1220
                     </td>
1221 1221
                     <td><textarea name="geodir_before_main_content_add"
1222 1222
                                   placeholder=''><?php if (isset($tc['geodir_before_main_content_add'])) {
1223
-                                echo $tc['geodir_before_main_content_add'];
1224
-                            }?></textarea></td>
1223
+								echo $tc['geodir_before_main_content_add'];
1224
+							}?></textarea></td>
1225 1225
                 </tr>
1226 1226
 
1227 1227
 
@@ -1244,8 +1244,8 @@  discard block
 block discarded – undo
1244 1244
                     </td>
1245 1245
                     <td><textarea name="geodir_full_page_class_filter"
1246 1246
                                   placeholder='geodir_full_page clearfix'><?php if (isset($tc['geodir_full_page_class_filter'])) {
1247
-                                echo $tc['geodir_full_page_class_filter'];
1248
-                            }?></textarea></td>
1247
+								echo $tc['geodir_full_page_class_filter'];
1248
+							}?></textarea></td>
1249 1249
                 </tr>
1250 1250
 
1251 1251
                 <tr>
@@ -1254,8 +1254,8 @@  discard block
 block discarded – undo
1254 1254
                     </td>
1255 1255
                     <td><textarea name="geodir_before_widget_filter"
1256 1256
                                   placeholder='<section id="%1$s" class="widget geodir-widget %2$s">'><?php if (isset($tc['geodir_before_widget_filter'])) {
1257
-                                echo $tc['geodir_before_widget_filter'];
1258
-                            }?></textarea></td>
1257
+								echo $tc['geodir_before_widget_filter'];
1258
+							}?></textarea></td>
1259 1259
                 </tr>
1260 1260
 
1261 1261
                 <tr>
@@ -1264,8 +1264,8 @@  discard block
 block discarded – undo
1264 1264
                     </td>
1265 1265
                     <td><textarea name="geodir_after_widget_filter"
1266 1266
                                   placeholder='</section>'><?php if (isset($tc['geodir_after_widget_filter'])) {
1267
-                                echo $tc['geodir_after_widget_filter'];
1268
-                            }?></textarea></td>
1267
+								echo $tc['geodir_after_widget_filter'];
1268
+							}?></textarea></td>
1269 1269
                 </tr>
1270 1270
 
1271 1271
                 <tr>
@@ -1274,8 +1274,8 @@  discard block
 block discarded – undo
1274 1274
                     </td>
1275 1275
                     <td><textarea name="geodir_before_title_filter"
1276 1276
                                   placeholder='<h3 class="widget-title">'><?php if (isset($tc['geodir_before_title_filter'])) {
1277
-                                echo $tc['geodir_before_title_filter'];
1278
-                            }?></textarea></td>
1277
+								echo $tc['geodir_before_title_filter'];
1278
+							}?></textarea></td>
1279 1279
                 </tr>
1280 1280
 
1281 1281
                 <tr>
@@ -1284,8 +1284,8 @@  discard block
 block discarded – undo
1284 1284
                     </td>
1285 1285
                     <td><textarea name="geodir_after_title_filter"
1286 1286
                                   placeholder='</h3>'><?php if (isset($tc['geodir_after_title_filter'])) {
1287
-                                echo $tc['geodir_after_title_filter'];
1288
-                            }?></textarea></td>
1287
+								echo $tc['geodir_after_title_filter'];
1288
+							}?></textarea></td>
1289 1289
                 </tr>
1290 1290
 
1291 1291
                 <tr>
@@ -1294,8 +1294,8 @@  discard block
 block discarded – undo
1294 1294
                     </td>
1295 1295
                     <td><textarea name="geodir_menu_li_class_filter"
1296 1296
                                   placeholder='menu-item'><?php if (isset($tc['geodir_menu_li_class_filter'])) {
1297
-                                echo $tc['geodir_menu_li_class_filter'];
1298
-                            }?></textarea></td>
1297
+								echo $tc['geodir_menu_li_class_filter'];
1298
+							}?></textarea></td>
1299 1299
                 </tr>
1300 1300
 
1301 1301
                 <tr>
@@ -1304,8 +1304,8 @@  discard block
 block discarded – undo
1304 1304
                     </td>
1305 1305
                     <td><textarea name="geodir_sub_menu_ul_class_filter"
1306 1306
                                   placeholder='sub-menu'><?php if (isset($tc['geodir_sub_menu_ul_class_filter'])) {
1307
-                                echo $tc['geodir_sub_menu_ul_class_filter'];
1308
-                            }?></textarea></td>
1307
+								echo $tc['geodir_sub_menu_ul_class_filter'];
1308
+							}?></textarea></td>
1309 1309
                 </tr>
1310 1310
 
1311 1311
                 <tr>
@@ -1314,8 +1314,8 @@  discard block
 block discarded – undo
1314 1314
                     </td>
1315 1315
                     <td><textarea name="geodir_sub_menu_li_class_filter"
1316 1316
                                   placeholder='menu-item'><?php if (isset($tc['geodir_sub_menu_li_class_filter'])) {
1317
-                                echo $tc['geodir_sub_menu_li_class_filter'];
1318
-                            }?></textarea></td>
1317
+								echo $tc['geodir_sub_menu_li_class_filter'];
1318
+							}?></textarea></td>
1319 1319
                 </tr>
1320 1320
 
1321 1321
                 <tr>
@@ -1324,8 +1324,8 @@  discard block
 block discarded – undo
1324 1324
                     </td>
1325 1325
                     <td><textarea name="geodir_menu_a_class_filter"
1326 1326
                                   placeholder=''><?php if (isset($tc['geodir_menu_a_class_filter'])) {
1327
-                                echo $tc['geodir_menu_a_class_filter'];
1328
-                            }?></textarea></td>
1327
+								echo $tc['geodir_menu_a_class_filter'];
1328
+							}?></textarea></td>
1329 1329
                 </tr>
1330 1330
 
1331 1331
                 <tr>
@@ -1334,8 +1334,8 @@  discard block
 block discarded – undo
1334 1334
                     </td>
1335 1335
                     <td><textarea name="geodir_sub_menu_a_class_filter"
1336 1336
                                   placeholder=''><?php if (isset($tc['geodir_sub_menu_a_class_filter'])) {
1337
-                                echo $tc['geodir_sub_menu_a_class_filter'];
1338
-                            }?></textarea></td>
1337
+								echo $tc['geodir_sub_menu_a_class_filter'];
1338
+							}?></textarea></td>
1339 1339
                 </tr>
1340 1340
 
1341 1341
 
@@ -1345,8 +1345,8 @@  discard block
 block discarded – undo
1345 1345
                     </td>
1346 1346
                     <td><textarea name="geodir_location_switcher_menu_li_class_filter"
1347 1347
                                   placeholder='menu-item menu-item-type-social menu-item-type-social gd-location-switcher'><?php if (isset($tc['geodir_location_switcher_menu_li_class_filter'])) {
1348
-                                echo $tc['geodir_location_switcher_menu_li_class_filter'];
1349
-                            }?></textarea></td>
1348
+								echo $tc['geodir_location_switcher_menu_li_class_filter'];
1349
+							}?></textarea></td>
1350 1350
                 </tr>
1351 1351
 
1352 1352
                 <tr>
@@ -1355,8 +1355,8 @@  discard block
 block discarded – undo
1355 1355
                     </td>
1356 1356
                     <td><textarea name="geodir_location_switcher_menu_a_class_filter"
1357 1357
                                   placeholder=''><?php if (isset($tc['geodir_location_switcher_menu_a_class_filter'])) {
1358
-                                echo $tc['geodir_location_switcher_menu_a_class_filter'];
1359
-                            }?></textarea></td>
1358
+								echo $tc['geodir_location_switcher_menu_a_class_filter'];
1359
+							}?></textarea></td>
1360 1360
                 </tr>
1361 1361
 
1362 1362
                 <tr>
@@ -1365,8 +1365,8 @@  discard block
 block discarded – undo
1365 1365
                     </td>
1366 1366
                     <td><textarea name="geodir_location_switcher_menu_sub_ul_class_filter"
1367 1367
                                   placeholder='sub-menu'><?php if (isset($tc['geodir_location_switcher_menu_sub_ul_class_filter'])) {
1368
-                                echo $tc['geodir_location_switcher_menu_sub_ul_class_filter'];
1369
-                            }?></textarea></td>
1368
+								echo $tc['geodir_location_switcher_menu_sub_ul_class_filter'];
1369
+							}?></textarea></td>
1370 1370
                 </tr>
1371 1371
 
1372 1372
                 <tr>
@@ -1375,21 +1375,21 @@  discard block
 block discarded – undo
1375 1375
                     </td>
1376 1376
                     <td><textarea name="geodir_location_switcher_menu_sub_li_class_filter"
1377 1377
                                   placeholder='menu-item gd-location-switcher-menu-item'><?php if (isset($tc['geodir_location_switcher_menu_sub_li_class_filter'])) {
1378
-                                echo $tc['geodir_location_switcher_menu_sub_li_class_filter'];
1379
-                            }?></textarea></td>
1378
+								echo $tc['geodir_location_switcher_menu_sub_li_class_filter'];
1379
+							}?></textarea></td>
1380 1380
                 </tr>
1381 1381
 
1382 1382
 
1383 1383
 
1384 1384
                 <?php
1385
-                /**
1386
-                 * Allows more filter setting to be added to theme compatibility settings page.
1387
-                 *
1388
-                 * Called after the last setting in "Other filters" section of theme compatibility settings.
1389
-                 *
1390
-                 * @since 1.4.0
1391
-                 */
1392
-                do_action('gd_compat_other_filters');?>
1385
+				/**
1386
+				 * Allows more filter setting to be added to theme compatibility settings page.
1387
+				 *
1388
+				 * Called after the last setting in "Other filters" section of theme compatibility settings.
1389
+				 *
1390
+				 * @since 1.4.0
1391
+				 */
1392
+				do_action('gd_compat_other_filters');?>
1393 1393
 
1394 1394
                 </tbody>
1395 1395
             </table>
@@ -1402,8 +1402,8 @@  discard block
 block discarded – undo
1402 1402
                 <tr>
1403 1403
                     <td><textarea name="geodir_theme_compat_css"
1404 1404
                                   placeholder=''><?php if (isset($tc['geodir_theme_compat_css'])) {
1405
-                                echo $tc['geodir_theme_compat_css'];
1406
-                            }?></textarea></td>
1405
+								echo $tc['geodir_theme_compat_css'];
1406
+							}?></textarea></td>
1407 1407
                 </tr>
1408 1408
 
1409 1409
 
@@ -1417,8 +1417,8 @@  discard block
 block discarded – undo
1417 1417
                 <tr>
1418 1418
                     <td><textarea name="geodir_theme_compat_js"
1419 1419
                                   placeholder=''><?php if (isset($tc['geodir_theme_compat_js'])) {
1420
-                                echo $tc['geodir_theme_compat_js'];
1421
-                            }?></textarea></td>
1420
+								echo $tc['geodir_theme_compat_js'];
1421
+							}?></textarea></td>
1422 1422
                 </tr>
1423 1423
 
1424 1424
 
@@ -1445,23 +1445,23 @@  discard block
 block discarded – undo
1445 1445
  */
1446 1446
 function geodir_custom_post_type_form()
1447 1447
 {
1448
-    $listing_type = ($_REQUEST['listing_type'] != '') ? $_REQUEST['listing_type'] : 'gd_place';
1448
+	$listing_type = ($_REQUEST['listing_type'] != '') ? $_REQUEST['listing_type'] : 'gd_place';
1449 1449
 
1450
-    $sub_tab = ($_REQUEST['subtab'] != '') ? $_REQUEST['subtab'] : '';
1450
+	$sub_tab = ($_REQUEST['subtab'] != '') ? $_REQUEST['subtab'] : '';
1451 1451
 
1452 1452
 
1453
-    ?>
1453
+	?>
1454 1454
 
1455 1455
     <div class="gd-content-heading">
1456 1456
         <?php
1457
-        /**
1458
-         * Filter custom fields panel heading.
1459
-         *
1460
-         * @since 1.0.0
1461
-         * @param string $sub_tab Sub tab name.
1462
-         * @param string $listing_type Post type.
1463
-         */
1464
-        ?>
1457
+		/**
1458
+		 * Filter custom fields panel heading.
1459
+		 *
1460
+		 * @since 1.0.0
1461
+		 * @param string $sub_tab Sub tab name.
1462
+		 * @param string $listing_type Post type.
1463
+		 */
1464
+		?>
1465 1465
         <h3><?php echo apply_filters('geodir_custom_fields_panel_head', '', $sub_tab, $listing_type);?></h3>
1466 1466
     </div>
1467 1467
     <div id="container_general" class="clearfix">
@@ -1469,25 +1469,25 @@  discard block
 block discarded – undo
1469 1469
 
1470 1470
             <div class="side-sortables" id="geodir-available-fields">
1471 1471
                 <?php
1472
-                /**
1473
-                 * Filter custom field available fields heading.
1474
-                 *
1475
-                 * @since 1.0.0
1476
-                 * @param string $sub_tab Sub tab name.
1477
-                 * @param string $listing_type Post type.
1478
-                 */
1479
-                ?>
1472
+				/**
1473
+				 * Filter custom field available fields heading.
1474
+				 *
1475
+				 * @since 1.0.0
1476
+				 * @param string $sub_tab Sub tab name.
1477
+				 * @param string $listing_type Post type.
1478
+				 */
1479
+				?>
1480 1480
                 <h3 class="hndle"><span><?php echo apply_filters('geodir_cf_panel_available_fields_head', '', $sub_tab, $listing_type);?>
1481 1481
 							</span></h3>
1482 1482
                 <?php
1483
-                /**
1484
-                 * Filter custom field available fields note text.
1485
-                 *
1486
-                 * @since 1.0.0
1487
-                 * @param string $sub_tab Sub tab name.
1488
-                 * @param string $listing_type Post type.
1489
-                 */
1490
-                ?>
1483
+				/**
1484
+				 * Filter custom field available fields note text.
1485
+				 *
1486
+				 * @since 1.0.0
1487
+				 * @param string $sub_tab Sub tab name.
1488
+				 * @param string $listing_type Post type.
1489
+				 */
1490
+				?>
1491 1491
                 <p><?php echo apply_filters('geodir_cf_panel_available_fields_note', '', $sub_tab, $listing_type);?></p>
1492 1492
 
1493 1493
                 <div class="inside">
@@ -1495,13 +1495,13 @@  discard block
 block discarded – undo
1495 1495
                     <div id="gt-form-builder-tab" class="gt-tabs-panel">
1496 1496
 
1497 1497
                         <?php
1498
-                        /**
1499
-                         * Adds the available fields to the custom fields settings page per post type.
1500
-                         *
1501
-                         * @since 1.0.0
1502
-                         * @param string $sub_tab The current settings tab name.
1503
-                         */
1504
-                        do_action('geodir_manage_available_fields', $sub_tab); ?>
1498
+						/**
1499
+						 * Adds the available fields to the custom fields settings page per post type.
1500
+						 *
1501
+						 * @since 1.0.0
1502
+						 * @param string $sub_tab The current settings tab name.
1503
+						 */
1504
+						do_action('geodir_manage_available_fields', $sub_tab); ?>
1505 1505
 
1506 1506
                         <div style="clear:both"></div>
1507 1507
                     </div>
@@ -1514,25 +1514,25 @@  discard block
 block discarded – undo
1514 1514
             <div class="side-sortables" id="geodir-selected-fields">
1515 1515
                 <h3 class="hndle">
1516 1516
                     <?php
1517
-                    /**
1518
-                     * Filter custom field selected fields heading.
1519
-                     *
1520
-                     * @since 1.0.0
1521
-                     * @param string $sub_tab Sub tab name.
1522
-                     * @param string $listing_type Post type.
1523
-                     */
1524
-                    ?>
1517
+					/**
1518
+					 * Filter custom field selected fields heading.
1519
+					 *
1520
+					 * @since 1.0.0
1521
+					 * @param string $sub_tab Sub tab name.
1522
+					 * @param string $listing_type Post type.
1523
+					 */
1524
+					?>
1525 1525
                     <span><?php echo apply_filters('geodir_cf_panel_selected_fields_head', '', $sub_tab, $listing_type);?></span>
1526 1526
                 </h3>
1527 1527
                 <?php
1528
-                /**
1529
-                 * Filter custom field selected fields note text.
1530
-                 *
1531
-                 * @since 1.0.0
1532
-                 * @param string $sub_tab Sub tab name.
1533
-                 * @param string $listing_type Post type.
1534
-                 */
1535
-                ?>
1528
+				/**
1529
+				 * Filter custom field selected fields note text.
1530
+				 *
1531
+				 * @since 1.0.0
1532
+				 * @param string $sub_tab Sub tab name.
1533
+				 * @param string $listing_type Post type.
1534
+				 */
1535
+				?>
1536 1536
                 <p><?php echo apply_filters('geodir_cf_panel_selected_fields_note', '', $sub_tab, $listing_type);?></p>
1537 1537
 
1538 1538
                 <div class="inside">
@@ -1540,13 +1540,13 @@  discard block
 block discarded – undo
1540 1540
                     <div id="gt-form-builder-tab" class="gt-tabs-panel">
1541 1541
                         <div class="field_row_main">
1542 1542
                             <?php
1543
-                            /**
1544
-                             * Adds the selected fields and setting to the custom fields settings page per post type.
1545
-                             *
1546
-                             * @since 1.0.0
1547
-                             * @param string $sub_tab The current settings tab name.
1548
-                             */
1549
-                            do_action('geodir_manage_selected_fields', $sub_tab); ?>
1543
+							/**
1544
+							 * Adds the selected fields and setting to the custom fields settings page per post type.
1545
+							 *
1546
+							 * @since 1.0.0
1547
+							 * @param string $sub_tab The current settings tab name.
1548
+							 */
1549
+							do_action('geodir_manage_selected_fields', $sub_tab); ?>
1550 1550
                         </div>
1551 1551
                         <div style="clear:both"></div>
1552 1552
                     </div>
@@ -1569,7 +1569,7 @@  discard block
 block discarded – undo
1569 1569
  */
1570 1570
 function geodir_diagnostic_tools_setting_page()
1571 1571
 {
1572
-    ?>
1572
+	?>
1573 1573
     <div class="inner_content_tab_main">
1574 1574
         <div class="gd-content-heading">
1575 1575
 
@@ -1671,13 +1671,13 @@  discard block
 block discarded – undo
1671 1671
 					</td>
1672 1672
 				</tr>
1673 1673
                 <?php
1674
-                /**
1675
-                 * Allows you to add more setting to the GD>Tools settings page.
1676
-                 *
1677
-                 * Called after the last setting on the GD>Tools page.
1678
-                 * @since 1.0.0
1679
-                 */
1680
-                do_action('geodir_diagnostic_tool');?>
1674
+				/**
1675
+				 * Allows you to add more setting to the GD>Tools settings page.
1676
+				 *
1677
+				 * Called after the last setting on the GD>Tools page.
1678
+				 * @since 1.0.0
1679
+				 */
1680
+				do_action('geodir_diagnostic_tool');?>
1681 1681
 
1682 1682
                 </tbody>
1683 1683
             </table>
Please login to merge, or discard this patch.
Braces   +21 added lines, -13 removed lines patch added patch discarded remove patch
@@ -74,17 +74,20 @@  discard block
 block discarded – undo
74 74
                                 $tab_link = $args['url'];
75 75
                             }
76 76
 
77
-                            if (!empty($args['request']))
78
-                                $tab_link = geodir_getlink($tab_link, $args['request']);
77
+                            if (!empty($args['request'])) {
78
+                                                            $tab_link = geodir_getlink($tab_link, $args['request']);
79
+                            }
79 80
 
80 81
                             if (isset($args['target']) && $args['target'] != '') {
81 82
                                 $tab_target = " target='" . sanitize_text_field($args['target']) . "' ";
82
-                            } else
83
-                                $tab_target = '';
83
+                            } else {
84
+                                                            $tab_target = '';
85
+                            }
84 86
 
85 87
                             $tab_active = '';
86
-                            if ($current_tab == $name)
87
-                                $tab_active = ' class="tab-active" ';
88
+                            if ($current_tab == $name) {
89
+                                                            $tab_active = ' class="tab-active" ';
90
+                            }
88 91
                             /**
89 92
                              * Called before the individual settings tabs are output.
90 93
                              *
@@ -122,8 +125,9 @@  discard block
 block discarded – undo
122 125
 
123 126
                         <?php
124 127
                         unset($subtabs);
125
-                        if (isset($tabs[$current_tab]['subtabs']))
126
-                            $subtabs = $tabs[$current_tab]['subtabs'];
128
+                        if (isset($tabs[$current_tab]['subtabs'])) {
129
+                                                    $subtabs = $tabs[$current_tab]['subtabs'];
130
+                        }
127 131
                         $form_action = '';
128 132
 
129 133
                         if (!empty($subtabs)):
@@ -189,7 +193,10 @@  discard block
 block discarded – undo
189 193
                      jQuery('#last_tab').val( jQuery(this).attr('href') );
190 194
                      return false;*/
191 195
                 });
192
-                <?php if (isset($_GET['subtab']) && $_GET['subtab']) echo 'jQuery("ul.subsubsub li a[href=#' . sanitize_text_field($_GET['subtab']) . ']").click();'; ?>
196
+                <?php if (isset($_GET['subtab']) && $_GET['subtab']) {
197
+	echo 'jQuery("ul.subsubsub li a[href=#' . sanitize_text_field($_GET['subtab']) . ']").click();';
198
+}
199
+?>
193 200
                 // Countries
194 201
                 jQuery('select#geodirectory_allowed_countries').change(function () {
195 202
                     if (jQuery(this).val() == "specific") {
@@ -312,10 +319,11 @@  discard block
 block discarded – undo
312 319
                 geodir_register_defaults();
313 320
             }*/
314 321
 
315
-            if (isset($_REQUEST['active_tab']) && ($_REQUEST['active_tab'] == 'dummy_data_settings' || $_REQUEST['active_tab'] == 'csv_upload_settings'))
316
-                $hide_save_button = "style='display:none;'";
317
-            else
318
-                $hide_save_button = '';
322
+            if (isset($_REQUEST['active_tab']) && ($_REQUEST['active_tab'] == 'dummy_data_settings' || $_REQUEST['active_tab'] == 'csv_upload_settings')) {
323
+                            $hide_save_button = "style='display:none;'";
324
+            } else {
325
+                            $hide_save_button = '';
326
+            }
319 327
 
320 328
             /**
321 329
              * Filter weather the default save button in the GD admin settings pages should be shown.
Please login to merge, or discard this patch.
geodirectory-admin/option-pages/create_field.php 2 patches
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -35,23 +35,26 @@  discard block
 block discarded – undo
35 35
 
36 36
 /* ---- Delete field ---- */
37 37
 if ($field_id != '' && $field_action == 'delete' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
38
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
39
-        return;
38
+    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) {
39
+            return;
40
+    }
40 41
     
41 42
     echo geodir_custom_field_delete($field_id);
42 43
 }
43 44
 
44 45
 if ($field_id != '' && $field_action == 'delete' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
45
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
46
-        return;
46
+    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) {
47
+            return;
48
+    }
47 49
     
48 50
     echo geodir_custom_sort_field_delete($field_id);
49 51
 }
50 52
 
51 53
 /* ---- Save field  ---- */
52 54
 if ($field_id != '' && $field_action == 'submit' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
53
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
54
-        return;
55
+    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) {
56
+            return;
57
+    }
55 58
 
56 59
     foreach ($_REQUEST as $pkey => $pval) {
57 60
         if (is_array($_REQUEST[$pkey])) {
@@ -77,8 +80,9 @@  discard block
 block discarded – undo
77 80
 
78 81
 /* ---- Save sort field  ---- */
79 82
 if ($field_id != '' && $field_action == 'submit' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
80
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
81
-        return;
83
+    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) {
84
+            return;
85
+    }
82 86
 
83 87
     foreach ($_REQUEST as $pkey => $pval) {
84 88
         if (is_array($_REQUEST[$pkey])) {
Please login to merge, or discard this patch.
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Creates custom fields
4
- *
5
- * @since 1.0.0
6
- * @package GeoDirectory
7
- */
3
+	 * Creates custom fields
4
+	 *
5
+	 * @since 1.0.0
6
+	 * @package GeoDirectory
7
+	 */
8 8
 
9 9
 $data_type = isset($_REQUEST['data_type']) ? sanitize_text_field($_REQUEST['data_type']) : '';
10 10
 $field_type = isset($_REQUEST['field_type']) ? sanitize_text_field($_REQUEST['field_type']) : '';
@@ -15,95 +15,95 @@  discard block
 block discarded – undo
15 15
 
16 16
 $field_ids = array();
17 17
 if (!empty($_REQUEST['licontainer']) && is_array($_REQUEST['licontainer'])) {
18
-    foreach ($_REQUEST['licontainer'] as $lic_id) {
19
-        $field_ids[] = sanitize_text_field($lic_id);
20
-    }
18
+	foreach ($_REQUEST['licontainer'] as $lic_id) {
19
+		$field_ids[] = sanitize_text_field($lic_id);
20
+	}
21 21
 }
22 22
 
23 23
 /* ------- check nonce field ------- */
24 24
 if (isset($_REQUEST['update']) && $_REQUEST['update'] == "update" && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
25
-    echo godir_set_field_order($field_ids);
25
+	echo godir_set_field_order($field_ids);
26 26
 }
27 27
 
28 28
 if (isset($_REQUEST['update']) && $_REQUEST['update'] == "update" && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
29
-    echo godir_set_sort_field_order($field_ids);
29
+	echo godir_set_sort_field_order($field_ids);
30 30
 }
31 31
 
32 32
 /* ---- Show field form in admin ---- */
33 33
 if ($field_type != '' && $field_id != '' && $field_action == 'new' && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
34
-    geodir_custom_field_adminhtml($field_type, $field_id, $field_action);
34
+	geodir_custom_field_adminhtml($field_type, $field_id, $field_action);
35 35
 }
36 36
 
37 37
 if ($field_type != '' && $field_id != '' && $field_action == 'new' && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
38
-    geodir_custom_sort_field_adminhtml($field_type, $field_id, $field_action);
38
+	geodir_custom_sort_field_adminhtml($field_type, $field_id, $field_action);
39 39
 }
40 40
 
41 41
 /* ---- Delete field ---- */
42 42
 if ($field_id != '' && $field_action == 'delete' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
43
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
44
-        return;
43
+	if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
44
+		return;
45 45
     
46
-    echo geodir_custom_field_delete($field_id);
46
+	echo geodir_custom_field_delete($field_id);
47 47
 }
48 48
 
49 49
 if ($field_id != '' && $field_action == 'delete' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
50
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
51
-        return;
50
+	if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
51
+		return;
52 52
     
53
-    echo geodir_custom_sort_field_delete($field_id);
53
+	echo geodir_custom_sort_field_delete($field_id);
54 54
 }
55 55
 
56 56
 /* ---- Save field  ---- */
57 57
 if ($field_id != '' && $field_action == 'submit' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
58
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
59
-        return;
60
-
61
-    foreach ($_REQUEST as $pkey => $pval) {
62
-        if (is_array($_REQUEST[$pkey])) {
63
-            $tags = 'skip_field';
64
-        } else {
65
-            $tags = '';
66
-        }
67
-
68
-        if ($tags != 'skip_field') {
69
-            $_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags);
70
-        }
71
-    }
72
-
73
-    $return = geodir_custom_field_save($_REQUEST);
74
-
75
-    if (is_int($return)) {
76
-        $lastid = $return;
77
-        geodir_custom_field_adminhtml($field_type, $lastid, 'submit');
78
-    } else {
79
-        echo $return;
80
-    }
58
+	if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
59
+		return;
60
+
61
+	foreach ($_REQUEST as $pkey => $pval) {
62
+		if (is_array($_REQUEST[$pkey])) {
63
+			$tags = 'skip_field';
64
+		} else {
65
+			$tags = '';
66
+		}
67
+
68
+		if ($tags != 'skip_field') {
69
+			$_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags);
70
+		}
71
+	}
72
+
73
+	$return = geodir_custom_field_save($_REQUEST);
74
+
75
+	if (is_int($return)) {
76
+		$lastid = $return;
77
+		geodir_custom_field_adminhtml($field_type, $lastid, 'submit');
78
+	} else {
79
+		echo $return;
80
+	}
81 81
 }
82 82
 
83 83
 /* ---- Save sort field  ---- */
84 84
 if ($field_id != '' && $field_action == 'submit' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
85
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
86
-        return;
87
-
88
-    foreach ($_REQUEST as $pkey => $pval) {
89
-        if (is_array($_REQUEST[$pkey])) {
90
-            $tags = 'skip_field';
91
-        } else {
92
-            $tags = '';
93
-        }
94
-
95
-        if ($tags != 'skip_field') {
96
-            $_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags);
97
-        }
98
-    }
99
-
100
-    $return = geodir_custom_sort_field_save($_REQUEST);
101
-
102
-    if (is_int($return)) {
103
-        $lastid = $return;
104
-        $default = false;
105
-        geodir_custom_sort_field_adminhtml($field_type, $lastid, 'submit', $default);
106
-    } else {
107
-        echo $return;
108
-    }
85
+	if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
86
+		return;
87
+
88
+	foreach ($_REQUEST as $pkey => $pval) {
89
+		if (is_array($_REQUEST[$pkey])) {
90
+			$tags = 'skip_field';
91
+		} else {
92
+			$tags = '';
93
+		}
94
+
95
+		if ($tags != 'skip_field') {
96
+			$_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags);
97
+		}
98
+	}
99
+
100
+	$return = geodir_custom_sort_field_save($_REQUEST);
101
+
102
+	if (is_int($return)) {
103
+		$lastid = $return;
104
+		$default = false;
105
+		geodir_custom_sort_field_adminhtml($field_type, $lastid, 'submit', $default);
106
+	} else {
107
+		echo $return;
108
+	}
109 109
 }
110 110
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-functions/taxonomy_functions.php 3 patches
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
                                     $cpt_name = __($args->labels->singular_name, 'geodirectory');
189 189
                                     $items .= '<li class="' . $li_class . '">
190 190
 											<a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $a_class . '">
191
-												' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . '
191
+												' . sprintf(__('Add %s', 'geodirectory'), $cpt_name) . '
192 192
 											</a>
193 193
 										</li>';
194 194
                                 }
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
                                         $cpt_name = __($args->labels->singular_name, 'geodirectory');
268 268
                                         $items .= '<li class="' . $li_class . '">
269 269
 														<a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $sub_a_class . '">
270
-															' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . '
270
+															' . sprintf(__('Add %s', 'geodirectory'), $cpt_name) . '
271 271
 														</a>
272 272
 													</li>';
273 273
                                     }
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 
400 400
     if (geodir_is_page('add-listing') || geodir_is_page('preview')) {
401 401
         if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
402
-            $geodir_post_type = get_post_type((int)$_REQUEST['pid']);
402
+            $geodir_post_type = get_post_type((int) $_REQUEST['pid']);
403 403
         elseif (isset($_REQUEST['listing_type']))
404 404
             $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']);
405 405
     }
@@ -439,14 +439,14 @@  discard block
 block discarded – undo
439 439
         switch ($output):
440 440
             case 'object':
441 441
             case 'Object':
442
-                $post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types;
442
+                $post_types = json_decode(json_encode($post_types), FALSE); //(object)$post_types;
443 443
                 break;
444 444
             case 'array':
445 445
             case 'Array':
446
-                $post_types = (array)$post_types;
446
+                $post_types = (array) $post_types;
447 447
                 break;
448 448
 			case 'options':
449
-                $post_types = (array)$post_types;
449
+                $post_types = (array) $post_types;
450 450
 				
451 451
 				$options = array();
452 452
 				if (!empty($post_types)) {
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
     } elseif (isset($wp_query->tax_query->queries)) {
641 641
         $tax_arr = $wp_query->tax_query->queries;
642 642
         //if tax query has 'relation' set then it will break wp_list_pluck so we remove it
643
-        if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);}
643
+        if (isset($tax_arr['relation'])) {unset($tax_arr['relation']); }
644 644
         $taxonomies = wp_list_pluck($tax_arr, 'taxonomy');
645 645
     }
646 646
 
@@ -763,7 +763,7 @@  discard block
 block discarded – undo
763 763
             $cat_exclude = serialize($exclude_cats);
764 764
 
765 765
         if (isset($_REQUEST['backandedit'])) {
766
-            $post = (object)$gd_session->get('listing');
766
+            $post = (object) $gd_session->get('listing');
767 767
 
768 768
             if (!is_array($post->post_category[$cat_taxonomy]))
769 769
                 $post_category = $post->post_category[$cat_taxonomy];
@@ -841,14 +841,14 @@  discard block
 block discarded – undo
841 841
 
842 842
             function show_subcatlist(main_cat, catObj) {
843 843
                 if (main_cat != '') {
844
-					var url = '<?php echo geodir_get_ajax_url();?>';
845
-                    var cat_taxonomy = '<?php echo $cat_taxonomy;?>';
846
-                    var cat_exclude = '<?php echo base64_encode($cat_exclude);?>';
844
+					var url = '<?php echo geodir_get_ajax_url(); ?>';
845
+                    var cat_taxonomy = '<?php echo $cat_taxonomy; ?>';
846
+                    var cat_exclude = '<?php echo base64_encode($cat_exclude); ?>';
847 847
                     var cat_limit = jQuery('#' + cat_taxonomy).find('#cat_limit').val();
848
-					<?php if ((int)$cat_limit > 0) { ?>
848
+					<?php if ((int) $cat_limit > 0) { ?>
849 849
 					var selected = parseInt(jQuery('#' + cat_taxonomy).find('.cat_sublist > div.post_catlist_item').length);
850 850
 					if (cat_limit != '' && selected > 0 && selected >= cat_limit && cat_limit != 0) {
851
-						alert("<?php echo esc_attr(wp_sprintf(__('You have reached category limit of %d categories.', 'geodirectory'), (int)$cat_limit));?>");
851
+						alert("<?php echo esc_attr(wp_sprintf(__('You have reached category limit of %d categories.', 'geodirectory'), (int) $cat_limit)); ?>");
852 852
 						return false;
853 853
 					}
854 854
 					<?php } ?>
@@ -887,7 +887,7 @@  discard block
 block discarded – undo
887 887
             }
888 888
 
889 889
             function update_listing_cat(el) {
890
-                var cat_taxonomy = '<?php echo $cat_taxonomy;?>';
890
+                var cat_taxonomy = '<?php echo $cat_taxonomy; ?>';
891 891
                 var cat_ids = '';
892 892
                 var main_cat = '';
893 893
                 var sub_cat = '';
@@ -968,7 +968,7 @@  discard block
 block discarded – undo
968 968
         <div class="main_cat_list" style=" <?php if (isset($style)) {
969 969
             echo $style;
970 970
         }?> ">
971
-            <?php geodir_get_catlist($cat_taxonomy, 0);  // print main categories list
971
+            <?php geodir_get_catlist($cat_taxonomy, 0); // print main categories list
972 972
             ?>
973 973
         </div>
974 974
     <?php
@@ -995,9 +995,9 @@  discard block
 block discarded – undo
995 995
     if ($exclude != '') {
996 996
         $exclude_cats = maybe_unserialize(base64_decode($exclude));
997 997
         print_r($exclude_cats);
998
-        if(is_array( $exclude_cats)){
999
-            $exclude_cats = array_map( 'intval', $exclude_cats );
1000
-        }else{
998
+        if (is_array($exclude_cats)) {
999
+            $exclude_cats = array_map('intval', $exclude_cats);
1000
+        } else {
1001 1001
             $exclude_cats = intval($exclude_cats);
1002 1002
         }
1003 1003
 
@@ -1011,25 +1011,25 @@  discard block
 block discarded – undo
1011 1011
         <?php $main_cat = get_term($parrent, $request_taxonomy); ?>
1012 1012
 
1013 1013
         <div class="post_catlist_item" style="border:1px solid #CCCCCC; margin:5px auto; padding:5px;">
1014
-            <img alt="move icon" src="<?php echo geodir_plugin_url() . '/geodirectory-assets/images/move.png';?>"
1014
+            <img alt="move icon" src="<?php echo geodir_plugin_url() . '/geodirectory-assets/images/move.png'; ?>"
1015 1015
                  onclick="jQuery(this).closest('div').remove();update_listing_cat(this);" align="right"/>
1016 1016
             <?php /* ?>
1017 1017
 		<img src="<?php echo geodir_plugin_url().'/geodirectory-assets/images/move.png';?>" onclick="jQuery(this).closest('div').remove();show_subcatlist();" align="right" /> 
1018 1018
 		<?php */ ?>
1019 1019
 
1020
-            <input type="checkbox" value="<?php echo $main_cat->term_id;?>" class="listing_main_cat"
1020
+            <input type="checkbox" value="<?php echo $main_cat->term_id; ?>" class="listing_main_cat"
1021 1021
                    onchange="if(jQuery(this).is(':checked')){jQuery(this).closest('div').find('.post_default_category').prop('checked',false).show();}else{jQuery(this).closest('div').find('.post_default_category').prop('checked',false).hide();};update_listing_cat()"
1022 1022
                    checked="checked" disabled="disabled"/>
1023 1023
        <span> 
1024
-        <?php printf(__('Add listing in %s category', 'geodirectory'), geodir_ucwords($main_cat->name));?>
1024
+        <?php printf(__('Add listing in %s category', 'geodirectory'), geodir_ucwords($main_cat->name)); ?>
1025 1025
         </span>
1026 1026
             <br/>
1027 1027
 
1028 1028
             <div class="post_default_category">
1029
-                <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id;?>"
1030
-                       onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" ';?>   />
1029
+                <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id; ?>"
1030
+                       onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" '; ?>   />
1031 1031
         <span> 
1032
-        <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name));?>
1032
+        <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name)); ?>
1033 1033
         </span>
1034 1034
             </div>
1035 1035
 
@@ -1062,7 +1062,7 @@  discard block
 block discarded – undo
1062 1062
         $post_cat_str = $post_categories[$request_taxonomy];
1063 1063
         $post_cat_array = explode("#", $post_cat_str);
1064 1064
         if (is_array($post_cat_array)) {
1065
-            $post_cat_array = array_unique( $post_cat_array );
1065
+            $post_cat_array = array_unique($post_cat_array);
1066 1066
 
1067 1067
 			foreach ($post_cat_array as $post_cat_html) {
1068 1068
 
@@ -1077,7 +1077,7 @@  discard block
 block discarded – undo
1077 1077
                 }
1078 1078
                 $post_sub_catid = '';
1079 1079
                 if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1080
-                    $post_sub_catid = (int)$post_cat_info[1];
1080
+                    $post_sub_catid = (int) $post_cat_info[1];
1081 1081
                 }
1082 1082
 
1083 1083
                 geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
@@ -1098,7 +1098,7 @@  discard block
 block discarded – undo
1098 1098
             }
1099 1099
 
1100 1100
             if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1101
-                $post_sub_catid = (int)$post_cat_info[1];
1101
+                $post_sub_catid = (int) $post_cat_info[1];
1102 1102
             }
1103 1103
 
1104 1104
             geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
@@ -1140,8 +1140,8 @@  discard block
 block discarded – undo
1140 1140
                 $option_selected = ' selected="selected" ';
1141 1141
 
1142 1142
             // Count child terms
1143
-            $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) );
1144
-            $has_child = !empty( $child_terms ) ? 't' : 'f';
1143
+            $child_terms = get_terms($cat_taxonomy, array('parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1));
1144
+            $has_child = !empty($child_terms) ? 't' : 'f';
1145 1145
 
1146 1146
             echo '<option  ' . $option_selected . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" _hc="' . $has_child . '" >' . ucfirst($cat_term->name) . '</option>';
1147 1147
         }
@@ -1174,7 +1174,7 @@  discard block
 block discarded – undo
1174 1174
             2 => __('Custom field updated.', 'geodirectory'),
1175 1175
             3 => __('Custom field deleted.', 'geodirectory'),
1176 1176
             4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name),
1177
-            5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int)$_GET['revision'], false)) : false,
1177
+            5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int) $_GET['revision'], false)) : false,
1178 1178
             6 => sprintf(__('%s published. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1179 1179
             7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name),
1180 1180
             8 => sprintf(__('%s submitted. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
@@ -1311,7 +1311,7 @@  discard block
 block discarded – undo
1311 1311
             'menu_icon' => $menu_icon,
1312 1312
             'public' => true,
1313 1313
             'query_var' => true,
1314
-            'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true),
1314
+            'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true),
1315 1315
             'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/),
1316 1316
             'taxonomies' => array('gd_placecategory', 'gd_place_tags'));
1317 1317
 
@@ -1333,25 +1333,25 @@  discard block
 block discarded – undo
1333 1333
 }
1334 1334
 
1335 1335
 $gd_wpml_get_languages = "";
1336
-function gd_wpml_get_lang_from_url($url){
1336
+function gd_wpml_get_lang_from_url($url) {
1337 1337
 
1338 1338
     global $gd_wpml_get_languages;
1339
-    if(isset($_REQUEST['lang']) && $_REQUEST['lang']){return $_REQUEST['lang'];}
1339
+    if (isset($_REQUEST['lang']) && $_REQUEST['lang']) {return $_REQUEST['lang']; }
1340 1340
 
1341 1341
 
1342 1342
     //
1343
-    $url = str_replace(array("http://","https://"),"",$url);
1344
-    $site_url = str_replace(array("http://","https://"),"",get_bloginfo('url'));
1343
+    $url = str_replace(array("http://", "https://"), "", $url);
1344
+    $site_url = str_replace(array("http://", "https://"), "", get_bloginfo('url'));
1345 1345
 
1346
-    $url = str_replace($site_url,"",$url);
1346
+    $url = str_replace($site_url, "", $url);
1347 1347
 
1348 1348
 
1349 1349
     $segments = explode('/', trim($url, '/'));
1350 1350
 
1351 1351
     //print_r( $segments);
1352
-    if($gd_wpml_get_languages){
1352
+    if ($gd_wpml_get_languages) {
1353 1353
         $langs = $gd_wpml_get_languages;
1354
-    }else{
1354
+    } else {
1355 1355
         global $sitepress;
1356 1356
         $gd_wpml_get_languages = $sitepress->get_active_languages();
1357 1357
     }
@@ -1414,17 +1414,17 @@  discard block
 block discarded – undo
1414 1414
         $slug = $post_types[$post->post_type]['rewrite']['slug'];
1415 1415
 
1416 1416
         // Alter the CPT slug if WPML is set to do so
1417
-        if(function_exists('icl_object_id')){
1418
-            if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
1417
+        if (function_exists('icl_object_id')) {
1418
+            if (gd_wpml_slug_translation_turned_on($post->post_type) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
1419 1419
 
1420 1420
                 $org_slug = $slug;
1421
-                $slug = apply_filters( 'wpml_translate_single_string',
1421
+                $slug = apply_filters('wpml_translate_single_string',
1422 1422
                     $slug,
1423 1423
                     'WordPress',
1424 1424
                     'URL slug: ' . $slug,
1425 1425
                     $language_code);
1426 1426
 
1427
-                if(!$slug){$slug = $org_slug;}
1427
+                if (!$slug) {$slug = $org_slug; }
1428 1428
 
1429 1429
             }
1430 1430
         }
@@ -1438,7 +1438,7 @@  discard block
 block discarded – undo
1438 1438
 		}
1439 1439
 		
1440 1440
         $post_link = trailingslashit(
1441
-            preg_replace(  "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 )
1441
+            preg_replace("/" . preg_quote($slug, "/") . "/", $slug . "/%gd_taxonomy%", $post_link, 1)
1442 1442
         );
1443 1443
 
1444 1444
 		if ($fix_url) {
@@ -1466,7 +1466,7 @@  discard block
 block discarded – undo
1466 1466
                 )
1467 1467
             );
1468 1468
 
1469
-            $post = (object)array_merge((array)$post, (array)$post2);
1469
+            $post = (object) array_merge((array) $post, (array) $post2);
1470 1470
 
1471 1471
             $comment_post_cache[$post->ID] = $post;
1472 1472
         }
@@ -1475,7 +1475,7 @@  discard block
 block discarded – undo
1475 1475
 
1476 1476
         if (false !== strpos($post_link, '%gd_taxonomy%')) {
1477 1477
 
1478
-            if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) {
1478
+            if (apply_filters("geodir_add_location_url_to_url", get_option('geodir_add_location_url'), $post->post_type, $post)) {
1479 1479
                 $location_request = '';
1480 1480
 
1481 1481
 
@@ -1489,7 +1489,7 @@  discard block
 block discarded – undo
1489 1489
                         $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1490 1490
                         $post->country_slug = str_replace(']', '', $post->country_slug);
1491 1491
 
1492
-                        $post_location = (object)array('country_slug' => $post->country_slug,
1492
+                        $post_location = (object) array('country_slug' => $post->country_slug,
1493 1493
                             'region_slug' => $post->region_slug,
1494 1494
                             'city_slug' => $post->city_slug
1495 1495
                         );
@@ -1518,7 +1518,7 @@  discard block
 block discarded – undo
1518 1518
                             $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1519 1519
                             $post->country_slug = str_replace(']', '', $post->country_slug);
1520 1520
 
1521
-                            $post_location = (object)array('country_slug' => $post->country_slug,
1521
+                            $post_location = (object) array('country_slug' => $post->country_slug,
1522 1522
                                 'region_slug' => $post->region_slug,
1523 1523
                                 'city_slug' => $post->city_slug
1524 1524
                             );
@@ -1658,7 +1658,7 @@  discard block
 block discarded – undo
1658 1658
 			$location_manager = defined('POST_LOCATION_TABLE') ? true : false;
1659 1659
 			$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
1660 1660
             
1661
-			if(geodir_is_page('detail') && isset($post->country_slug)){
1661
+			if (geodir_is_page('detail') && isset($post->country_slug)) {
1662 1662
                 $location_terms = array(
1663 1663
                     'gd_country' => $post->country_slug,
1664 1664
                     'gd_region' => $post->region_slug,
@@ -1677,7 +1677,7 @@  discard block
 block discarded – undo
1677 1677
 
1678 1678
             if (!empty($location_terms)) {
1679 1679
 
1680
-                $url_separator = '';//get_option('geodir_listingurl_separator');
1680
+                $url_separator = ''; //get_option('geodir_listingurl_separator');
1681 1681
 
1682 1682
                 if (get_option('permalink_structure') != '') {
1683 1683
                     $old_listing_slug = '/' . $listing_slug . '/';
@@ -1700,31 +1700,31 @@  discard block
 block discarded – undo
1700 1700
         }*/
1701 1701
 
1702 1702
         // Alter the CPT slug if WPML is set to do so
1703
-        if(function_exists('icl_object_id')){
1703
+        if (function_exists('icl_object_id')) {
1704 1704
             $post_types = get_option('geodir_post_types');
1705
-            $post_type = str_replace("category","",$taxonomy);
1706
-			$post_type = str_replace("_tags","",$post_type);
1705
+            $post_type = str_replace("category", "", $taxonomy);
1706
+			$post_type = str_replace("_tags", "", $post_type);
1707 1707
             $slug = $post_types[$post_type]['rewrite']['slug'];
1708
-            if ( gd_wpml_slug_translation_turned_on( $post_type )) {
1708
+            if (gd_wpml_slug_translation_turned_on($post_type)) {
1709 1709
 
1710 1710
                 global $sitepress;
1711 1711
                 $default_lang = $sitepress->get_default_language();
1712 1712
                 $language_code = gd_wpml_get_lang_from_url($termlink);
1713
-                if(!$language_code ){$language_code  = $default_lang;}
1713
+                if (!$language_code) {$language_code = $default_lang; }
1714 1714
 
1715 1715
                 $org_slug = $slug;
1716
-                $slug = apply_filters( 'wpml_translate_single_string',
1716
+                $slug = apply_filters('wpml_translate_single_string',
1717 1717
                     $slug,
1718 1718
                     'WordPress',
1719 1719
                     'URL slug: ' . $slug,
1720 1720
                     $language_code);
1721 1721
 
1722 1722
 
1723
-                if(!$slug){$slug = $org_slug;}
1723
+                if (!$slug) {$slug = $org_slug; }
1724 1724
 
1725 1725
                 $termlink = trailingslashit(
1726 1726
 
1727
-                    preg_replace(  "/" . preg_quote( $org_slug, "/" ) . "/", $slug  ,$termlink, 1 )
1727
+                    preg_replace("/" . preg_quote($org_slug, "/") . "/", $slug, $termlink, 1)
1728 1728
                 );
1729 1729
 
1730 1730
             }
@@ -1757,7 +1757,7 @@  discard block
 block discarded – undo
1757 1757
 	
1758 1758
 	if (in_array($post_type, geodir_get_posttypes())) {
1759 1759
 		if (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) {
1760
-			if(geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) {
1760
+			if (geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) {
1761 1761
                 $location_terms = array(
1762 1762
                     'gd_country' => $post->country_slug,
1763 1763
                     'gd_region' => $post->region_slug,
@@ -1870,7 +1870,7 @@  discard block
 block discarded – undo
1870 1870
 
1871 1871
     $where_fields = array($slug);
1872 1872
     if (!empty($taxonomy)) {
1873
-        $parent = (int)$parent;
1873
+        $parent = (int) $parent;
1874 1874
         if ($parent > 0) {
1875 1875
             $where_fields[] = $parent;
1876 1876
             $else_where_fields[] = $parent;
@@ -1939,7 +1939,7 @@  discard block
 block discarded – undo
1939 1939
         $terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)");
1940 1940
         //$terms = get_terms( $taxonomy );
1941 1941
 
1942
-        if($terms) {
1942
+        if ($terms) {
1943 1943
             foreach ($terms as $term) {
1944 1944
                 $post_type = str_replace("category", "", $term->taxonomy);
1945 1945
                 $a_terms[$post_type][] = $term;
@@ -1947,7 +1947,7 @@  discard block
 block discarded – undo
1947 1947
             }
1948 1948
         }
1949 1949
 
1950
-        if($a_terms) {
1950
+        if ($a_terms) {
1951 1951
             foreach ($a_terms as $pt => $t2) {
1952 1952
 
1953 1953
                 foreach ($t2 as $term) {
@@ -1972,7 +1972,7 @@  discard block
 block discarded – undo
1972 1972
     }
1973 1973
 
1974 1974
     if (is_ssl()) {
1975
-        $terms_icons = str_replace("http:","https:",$terms_icons );
1975
+        $terms_icons = str_replace("http:", "https:", $terms_icons);
1976 1976
     }
1977 1977
 
1978 1978
     return $terms_icons;
Please login to merge, or discard this patch.
Indentation   +1163 added lines, -1163 removed lines patch added patch discarded remove patch
@@ -33,257 +33,257 @@  discard block
 block discarded – undo
33 33
  */
34 34
 function geodir_add_nav_menu_items()
35 35
 {
36
-    $items = '';
37
-    // apply filter to add more navigations // -Filter-Location-Manager
38
-
39
-    if (get_option('geodir_show_listing_nav')) {
40
-
41
-        $menu_class = '';
42
-        if (geodir_is_page('listing'))
43
-            $menu_class = 'current-menu-item';
44
-
45
-
46
-        //SHOW LISTING OF POST TYPE IN MAIN NAVIGATION
47
-        $post_types = geodir_get_posttypes('object');
48
-        $show_post_type_main_nav = get_option('geodir_add_posttype_in_main_nav');
49
-        if (!empty($post_types)) {
50
-            foreach ($post_types as $post_type => $args) {
51
-                if (!empty($show_post_type_main_nav)) {
52
-                    if (in_array($post_type, $show_post_type_main_nav)) {
53
-                        if (get_post_type_archive_link($post_type)) {
54
-                            $menu_class = '';
55
-                            if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
56
-                                $menu_class = 'current-menu-item';
57
-                            /**
58
-                             * Filter the menu li class.
59
-                             *
60
-                             * @since 1.0.0
61
-                             * @param string $menu_class The menu HTML class.
62
-                             */
63
-                            $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
64
-                            /**
65
-                             * Filter the menu a class.
66
-                             *
67
-                             * @since 1.0.0
68
-                             */
69
-                            $a_class = apply_filters('geodir_menu_a_class', '');
70
-                            $items .= '<li class="' . $li_class . '">
36
+	$items = '';
37
+	// apply filter to add more navigations // -Filter-Location-Manager
38
+
39
+	if (get_option('geodir_show_listing_nav')) {
40
+
41
+		$menu_class = '';
42
+		if (geodir_is_page('listing'))
43
+			$menu_class = 'current-menu-item';
44
+
45
+
46
+		//SHOW LISTING OF POST TYPE IN MAIN NAVIGATION
47
+		$post_types = geodir_get_posttypes('object');
48
+		$show_post_type_main_nav = get_option('geodir_add_posttype_in_main_nav');
49
+		if (!empty($post_types)) {
50
+			foreach ($post_types as $post_type => $args) {
51
+				if (!empty($show_post_type_main_nav)) {
52
+					if (in_array($post_type, $show_post_type_main_nav)) {
53
+						if (get_post_type_archive_link($post_type)) {
54
+							$menu_class = '';
55
+							if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
56
+								$menu_class = 'current-menu-item';
57
+							/**
58
+							 * Filter the menu li class.
59
+							 *
60
+							 * @since 1.0.0
61
+							 * @param string $menu_class The menu HTML class.
62
+							 */
63
+							$li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
64
+							/**
65
+							 * Filter the menu a class.
66
+							 *
67
+							 * @since 1.0.0
68
+							 */
69
+							$a_class = apply_filters('geodir_menu_a_class', '');
70
+							$items .= '<li class="' . $li_class . '">
71 71
 									<a href="' . get_post_type_archive_link($post_type) . '" class="' . $a_class . '">
72 72
 										' . __(ucfirst($args->labels->name)) . '
73 73
 									</a>
74 74
 								</li>';
75
-                        }
76
-                    }
77
-                }
78
-            }
79
-        }
80
-        //END LISTING OF POST TYPE IN MAIN NAVIGATION
81
-
82
-        $view_posttype_listing = get_option('geodir_add_posttype_in_listing_nav');
83
-        $is_listing_sub_meny_exists = (!empty($view_posttype_listing)) ? true : false;
84
-        if ($is_listing_sub_meny_exists) {
85
-            /**
86
-             * Filter the menu li class.
87
-             *
88
-             * @since 1.0.0
89
-             * @param string $menu_class The menu HTML class.
90
-             */
91
-            $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings ' . $menu_class);
92
-            /**
93
-             * Filter the sub menu li class.
94
-             *
95
-             * @since 1.0.0
96
-             * @param string $menu_class The menu HTML class.
97
-             */
98
-            $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
99
-            /**
100
-             * Filter the sub menu ul class.
101
-             *
102
-             * @since 1.0.0
103
-             */
104
-            $sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
105
-            /**
106
-             * Filter the menu a class.
107
-             *
108
-             * @since 1.0.0
109
-             */
110
-            $a_class = apply_filters('geodir_menu_a_class', '');
111
-            /**
112
-             * Filter the sub menu a class.
113
-             *
114
-             * @since 1.0.0
115
-             */
116
-            $sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
117
-            $items .= '<li class="' . $li_class . '">
75
+						}
76
+					}
77
+				}
78
+			}
79
+		}
80
+		//END LISTING OF POST TYPE IN MAIN NAVIGATION
81
+
82
+		$view_posttype_listing = get_option('geodir_add_posttype_in_listing_nav');
83
+		$is_listing_sub_meny_exists = (!empty($view_posttype_listing)) ? true : false;
84
+		if ($is_listing_sub_meny_exists) {
85
+			/**
86
+			 * Filter the menu li class.
87
+			 *
88
+			 * @since 1.0.0
89
+			 * @param string $menu_class The menu HTML class.
90
+			 */
91
+			$li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings ' . $menu_class);
92
+			/**
93
+			 * Filter the sub menu li class.
94
+			 *
95
+			 * @since 1.0.0
96
+			 * @param string $menu_class The menu HTML class.
97
+			 */
98
+			$sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
99
+			/**
100
+			 * Filter the sub menu ul class.
101
+			 *
102
+			 * @since 1.0.0
103
+			 */
104
+			$sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
105
+			/**
106
+			 * Filter the menu a class.
107
+			 *
108
+			 * @since 1.0.0
109
+			 */
110
+			$a_class = apply_filters('geodir_menu_a_class', '');
111
+			/**
112
+			 * Filter the sub menu a class.
113
+			 *
114
+			 * @since 1.0.0
115
+			 */
116
+			$sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
117
+			$items .= '<li class="' . $li_class . '">
118 118
 					<a href="#" class="' . $a_class . '">' . __('Listing', 'geodirectory') . '</a>
119 119
 					<ul class="' . $sub_ul_class . '">';
120
-            $post_types = geodir_get_posttypes('object');
120
+			$post_types = geodir_get_posttypes('object');
121 121
 
122
-            $show_listing_post_types = get_option('geodir_add_posttype_in_listing_nav');
122
+			$show_listing_post_types = get_option('geodir_add_posttype_in_listing_nav');
123 123
 
124
-            if (!empty($post_types)) {
125
-                global $geodir_add_location_url;
126
-                $geodir_add_location_url = true;
127
-                foreach ($post_types as $post_type => $args) {
128
-                    if (!empty($show_listing_post_types)) {
129
-                        if (in_array($post_type, $show_listing_post_types)) {
130
-                            if (get_post_type_archive_link($post_type)) {
124
+			if (!empty($post_types)) {
125
+				global $geodir_add_location_url;
126
+				$geodir_add_location_url = true;
127
+				foreach ($post_types as $post_type => $args) {
128
+					if (!empty($show_listing_post_types)) {
129
+						if (in_array($post_type, $show_listing_post_types)) {
130
+							if (get_post_type_archive_link($post_type)) {
131 131
 
132
-                                $menu_class = '';
133
-                                if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
134
-                                    $menu_class = 'current-menu-item';
132
+								$menu_class = '';
133
+								if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
134
+									$menu_class = 'current-menu-item';
135 135
 
136
-                                $items .= '<li class="' . $sub_li_class . '">
136
+								$items .= '<li class="' . $sub_li_class . '">
137 137
 														<a href="' . get_post_type_archive_link($post_type) . '" class="' . $sub_a_class . '">
138 138
 															' . __(ucfirst($args->labels->name)) . '
139 139
 														</a>
140 140
 													</li>';
141
-                            }
142
-                        }
143
-                    }
144
-                }
145
-                $geodir_add_location_url = NULL;
146
-            }
141
+							}
142
+						}
143
+					}
144
+				}
145
+				$geodir_add_location_url = NULL;
146
+			}
147 147
 
148
-            $items .= '	</ul>
148
+			$items .= '	</ul>
149 149
 				</li>';
150
-        }
151
-    }
152
-
153
-    if (get_option('geodir_show_addlisting_nav')) {
154
-
155
-        $menu_class = '';
156
-        if (geodir_is_page('add-listing'))
157
-            $menu_class = 'current-menu-item';
158
-
159
-        //SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION
160
-        $post_types = geodir_get_posttypes('object');
161
-        $show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_main_nav');
162
-        $geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
163
-
164
-        if (!empty($post_types)) {
165
-            foreach ($post_types as $post_type => $args) {
166
-                if (!empty($geodir_allow_posttype_frontend)) {
167
-                    if (in_array($post_type, $geodir_allow_posttype_frontend)) {
168
-                        if (!empty($show_add_listing_post_types_main_nav)) {
169
-                            if (in_array($post_type, $show_add_listing_post_types_main_nav)) {
170
-                                if (geodir_get_addlisting_link($post_type)) {
171
-
172
-                                    $menu_class = '';
173
-                                    if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
174
-                                        $menu_class = 'current-menu-item';
175
-                                    /**
176
-                                     * Filter the menu li class.
177
-                                     *
178
-                                     * @since 1.0.0
179
-                                     * @param string $menu_class The menu HTML class.
180
-                                     */
181
-                                    $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
182
-                                    /**
183
-                                     * Filter the menu a class.
184
-                                     *
185
-                                     * @since 1.0.0
186
-                                     */
187
-                                    $a_class = apply_filters('geodir_menu_a_class', '');
188
-                                    $cpt_name = __($args->labels->singular_name, 'geodirectory');
189
-                                    $items .= '<li class="' . $li_class . '">
150
+		}
151
+	}
152
+
153
+	if (get_option('geodir_show_addlisting_nav')) {
154
+
155
+		$menu_class = '';
156
+		if (geodir_is_page('add-listing'))
157
+			$menu_class = 'current-menu-item';
158
+
159
+		//SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION
160
+		$post_types = geodir_get_posttypes('object');
161
+		$show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_main_nav');
162
+		$geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
163
+
164
+		if (!empty($post_types)) {
165
+			foreach ($post_types as $post_type => $args) {
166
+				if (!empty($geodir_allow_posttype_frontend)) {
167
+					if (in_array($post_type, $geodir_allow_posttype_frontend)) {
168
+						if (!empty($show_add_listing_post_types_main_nav)) {
169
+							if (in_array($post_type, $show_add_listing_post_types_main_nav)) {
170
+								if (geodir_get_addlisting_link($post_type)) {
171
+
172
+									$menu_class = '';
173
+									if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
174
+										$menu_class = 'current-menu-item';
175
+									/**
176
+									 * Filter the menu li class.
177
+									 *
178
+									 * @since 1.0.0
179
+									 * @param string $menu_class The menu HTML class.
180
+									 */
181
+									$li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
182
+									/**
183
+									 * Filter the menu a class.
184
+									 *
185
+									 * @since 1.0.0
186
+									 */
187
+									$a_class = apply_filters('geodir_menu_a_class', '');
188
+									$cpt_name = __($args->labels->singular_name, 'geodirectory');
189
+									$items .= '<li class="' . $li_class . '">
190 190
 											<a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $a_class . '">
191 191
 												' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . '
192 192
 											</a>
193 193
 										</li>';
194
-                                }
195
-                            }
196
-                        }
197
-                    }
198
-                }
199
-            }
200
-        }
201
-        //END SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION
202
-    }
203
-
204
-    $view_add_posttype_listing = get_option('geodir_add_listing_link_add_listing_nav');
205
-    $is_add_listing_sub_meny_exists = (!empty($view_add_posttype_listing)) ? true : false;
206
-    if ($is_add_listing_sub_meny_exists) {
207
-
208
-        if (get_option('geodir_show_addlisting_nav')) {
209
-            /**
210
-             * Filter the menu li class.
211
-             *
212
-             * @since 1.0.0
213
-             * @param string $menu_class The menu HTML class.
214
-             */
215
-            $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing ' . $menu_class);
216
-            /**
217
-             * Filter the sub menu li class.
218
-             *
219
-             * @since 1.0.0
220
-             * @param string $menu_class The menu HTML class.
221
-             */
222
-            $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
223
-            /**
224
-             * Filter the sub menu ul class.
225
-             *
226
-             * @since 1.0.0
227
-             */
228
-            $sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
229
-            /**
230
-             * Filter the menu a class.
231
-             *
232
-             * @since 1.0.0
233
-             */
234
-            $a_class = apply_filters('geodir_menu_a_class', '');
235
-            /**
236
-             * Filter the sub menu a class.
237
-             *
238
-             * @since 1.0.0
239
-             */
240
-            $sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
241
-            $items .= '<li  class="' . $li_class . '">
194
+								}
195
+							}
196
+						}
197
+					}
198
+				}
199
+			}
200
+		}
201
+		//END SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION
202
+	}
203
+
204
+	$view_add_posttype_listing = get_option('geodir_add_listing_link_add_listing_nav');
205
+	$is_add_listing_sub_meny_exists = (!empty($view_add_posttype_listing)) ? true : false;
206
+	if ($is_add_listing_sub_meny_exists) {
207
+
208
+		if (get_option('geodir_show_addlisting_nav')) {
209
+			/**
210
+			 * Filter the menu li class.
211
+			 *
212
+			 * @since 1.0.0
213
+			 * @param string $menu_class The menu HTML class.
214
+			 */
215
+			$li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing ' . $menu_class);
216
+			/**
217
+			 * Filter the sub menu li class.
218
+			 *
219
+			 * @since 1.0.0
220
+			 * @param string $menu_class The menu HTML class.
221
+			 */
222
+			$sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
223
+			/**
224
+			 * Filter the sub menu ul class.
225
+			 *
226
+			 * @since 1.0.0
227
+			 */
228
+			$sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
229
+			/**
230
+			 * Filter the menu a class.
231
+			 *
232
+			 * @since 1.0.0
233
+			 */
234
+			$a_class = apply_filters('geodir_menu_a_class', '');
235
+			/**
236
+			 * Filter the sub menu a class.
237
+			 *
238
+			 * @since 1.0.0
239
+			 */
240
+			$sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
241
+			$items .= '<li  class="' . $li_class . '">
242 242
 					<a href="#" class="' . $a_class . '">' . __('Add Listing', 'geodirectory') . '</a>
243 243
 					<ul class="' . $sub_ul_class . '">';
244 244
 
245
-            $post_types = geodir_get_posttypes('object');
246
-
247
-            $show_add_listing_post_types = get_option('geodir_add_listing_link_add_listing_nav');
248
-
249
-            if (!empty($post_types)) {
250
-                foreach ($post_types as $post_type => $args) {
251
-                    if (!empty($geodir_allow_posttype_frontend)) {
252
-                        if (in_array($post_type, $geodir_allow_posttype_frontend)) {
253
-                            if (!empty($show_add_listing_post_types)) {
254
-                                if (in_array($post_type, $show_add_listing_post_types)) {
255
-                                    if (geodir_get_addlisting_link($post_type)) {
256
-
257
-                                        $menu_class = '';
258
-                                        if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
259
-                                            $menu_class = 'current-menu-item';
260
-                                        /**
261
-                                         * Filter the menu li class.
262
-                                         *
263
-                                         * @since 1.0.0
264
-                                         * @param string $menu_class The menu HTML class.
265
-                                         */
266
-                                        $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
267
-                                        $cpt_name = __($args->labels->singular_name, 'geodirectory');
268
-                                        $items .= '<li class="' . $li_class . '">
245
+			$post_types = geodir_get_posttypes('object');
246
+
247
+			$show_add_listing_post_types = get_option('geodir_add_listing_link_add_listing_nav');
248
+
249
+			if (!empty($post_types)) {
250
+				foreach ($post_types as $post_type => $args) {
251
+					if (!empty($geodir_allow_posttype_frontend)) {
252
+						if (in_array($post_type, $geodir_allow_posttype_frontend)) {
253
+							if (!empty($show_add_listing_post_types)) {
254
+								if (in_array($post_type, $show_add_listing_post_types)) {
255
+									if (geodir_get_addlisting_link($post_type)) {
256
+
257
+										$menu_class = '';
258
+										if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
259
+											$menu_class = 'current-menu-item';
260
+										/**
261
+										 * Filter the menu li class.
262
+										 *
263
+										 * @since 1.0.0
264
+										 * @param string $menu_class The menu HTML class.
265
+										 */
266
+										$li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
267
+										$cpt_name = __($args->labels->singular_name, 'geodirectory');
268
+										$items .= '<li class="' . $li_class . '">
269 269
 														<a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $sub_a_class . '">
270 270
 															' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . '
271 271
 														</a>
272 272
 													</li>';
273
-                                    }
274
-                                }
275
-                            }
276
-                        }
277
-                    }
278
-                }
279
-            }
273
+									}
274
+								}
275
+							}
276
+						}
277
+					}
278
+				}
279
+			}
280 280
 
281
-            $items .= '	</ul>
281
+			$items .= '	</ul>
282 282
 				</li>';
283
-        }
284
-    }
285
-    // apply filter to add more navigations // -Filter-Location-Manager
286
-    return $items;
283
+		}
284
+	}
285
+	// apply filter to add more navigations // -Filter-Location-Manager
286
+	return $items;
287 287
 }
288 288
 
289 289
 
@@ -301,20 +301,20 @@  discard block
 block discarded – undo
301 301
  */
302 302
 function geodir_pagemenu_items($menu, $args)
303 303
 {
304
-    $locations = get_nav_menu_locations();
305
-    $geodir_theme_location = get_option('geodir_theme_location_nav');
306
-    $geodir_theme_location_nav = array();
307
-    if (empty($locations) && empty($geodir_theme_location)) {
308
-        $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
309
-        $geodir_theme_location_nav[] = $args['theme_location'];
310
-        update_option('geodir_theme_location_nav', $geodir_theme_location_nav);
311
-    }
312
-    //else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet.
304
+	$locations = get_nav_menu_locations();
305
+	$geodir_theme_location = get_option('geodir_theme_location_nav');
306
+	$geodir_theme_location_nav = array();
307
+	if (empty($locations) && empty($geodir_theme_location)) {
308
+		$menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
309
+		$geodir_theme_location_nav[] = $args['theme_location'];
310
+		update_option('geodir_theme_location_nav', $geodir_theme_location_nav);
311
+	}
312
+	//else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet.
313 313
 //		$menu = str_replace("</ul></div>",geodir_add_nav_menu_items()."</ul></div>",$menu);
314
-    else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location))
315
-        $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
314
+	else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location))
315
+		$menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
316 316
 
317
-    return $menu;
317
+	return $menu;
318 318
 
319 319
 }
320 320
 
@@ -334,18 +334,18 @@  discard block
 block discarded – undo
334 334
 function geodir_menu_items($items, $args)
335 335
 {
336 336
 
337
-    $location = $args->theme_location;
337
+	$location = $args->theme_location;
338 338
 
339
-    $geodir_theme_location = get_option('geodir_theme_location_nav');
339
+	$geodir_theme_location = get_option('geodir_theme_location_nav');
340 340
 
341
-    if (has_nav_menu($location) == '1' && is_array($geodir_theme_location) && in_array($location, $geodir_theme_location)) {
341
+	if (has_nav_menu($location) == '1' && is_array($geodir_theme_location) && in_array($location, $geodir_theme_location)) {
342 342
 
343
-        $items = $items . geodir_add_nav_menu_items();
344
-        return $items;
343
+		$items = $items . geodir_add_nav_menu_items();
344
+		return $items;
345 345
 
346
-    } else {
347
-        return $items;
348
-    }
346
+	} else {
347
+		return $items;
348
+	}
349 349
 }
350 350
 
351 351
 /**
@@ -360,25 +360,25 @@  discard block
 block discarded – undo
360 360
  */
361 361
 function geodir_get_category_all_array()
362 362
 {
363
-    global $wpdb;
364
-    $return_array = array();
365
-
366
-    $taxonomies = geodir_get_taxonomies();
367
-    $taxonomies = implode("','", $taxonomies);
368
-    $taxonomies = "'" . $taxonomies . "'";
369
-
370
-    $pn_categories = $wpdb->get_results(
371
-        $wpdb->prepare(
372
-            "SELECT $wpdb->terms.name as name, $wpdb->term_taxonomy.count as count, $wpdb->terms.term_id as cat_ID FROM $wpdb->term_taxonomy,  $wpdb->terms WHERE $wpdb->term_taxonomy.term_id = %d AND $wpdb->term_taxonomy.taxonomy in ( $taxonomies ) ORDER BY name",
373
-            array($wpdb->terms . term_id)
374
-        )
375
-    );
376
-
377
-    foreach ($pn_categories as $pn_categories_obj) {
378
-        $return_array[] = array("id" => $pn_categories_obj->cat_ID,
379
-            "title" => $pn_categories_obj->name,);
380
-    }
381
-    return $return_array;
363
+	global $wpdb;
364
+	$return_array = array();
365
+
366
+	$taxonomies = geodir_get_taxonomies();
367
+	$taxonomies = implode("','", $taxonomies);
368
+	$taxonomies = "'" . $taxonomies . "'";
369
+
370
+	$pn_categories = $wpdb->get_results(
371
+		$wpdb->prepare(
372
+			"SELECT $wpdb->terms.name as name, $wpdb->term_taxonomy.count as count, $wpdb->terms.term_id as cat_ID FROM $wpdb->term_taxonomy,  $wpdb->terms WHERE $wpdb->term_taxonomy.term_id = %d AND $wpdb->term_taxonomy.taxonomy in ( $taxonomies ) ORDER BY name",
373
+			array($wpdb->terms . term_id)
374
+		)
375
+	);
376
+
377
+	foreach ($pn_categories as $pn_categories_obj) {
378
+		$return_array[] = array("id" => $pn_categories_obj->cat_ID,
379
+			"title" => $pn_categories_obj->name,);
380
+	}
381
+	return $return_array;
382 382
 }
383 383
 
384 384
 
@@ -393,32 +393,32 @@  discard block
 block discarded – undo
393 393
  */
394 394
 function geodir_get_current_posttype()
395 395
 {
396
-    global $wp_query, $geodir_post_type;
396
+	global $wp_query, $geodir_post_type;
397 397
 
398
-    $geodir_post_type = get_query_var('post_type');
398
+	$geodir_post_type = get_query_var('post_type');
399 399
 
400
-    if (geodir_is_page('add-listing') || geodir_is_page('preview')) {
401
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
402
-            $geodir_post_type = get_post_type((int)$_REQUEST['pid']);
403
-        elseif (isset($_REQUEST['listing_type']))
404
-            $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']);
405
-    }
400
+	if (geodir_is_page('add-listing') || geodir_is_page('preview')) {
401
+		if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
402
+			$geodir_post_type = get_post_type((int)$_REQUEST['pid']);
403
+		elseif (isset($_REQUEST['listing_type']))
404
+			$geodir_post_type = sanitize_text_field($_REQUEST['listing_type']);
405
+	}
406 406
 
407
-    if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype']))
408
-        $geodir_post_type = sanitize_text_field($_REQUEST['stype']);
407
+	if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype']))
408
+		$geodir_post_type = sanitize_text_field($_REQUEST['stype']);
409 409
 
410
-    if (is_tax())
411
-        $geodir_post_type = geodir_get_taxonomy_posttype();
410
+	if (is_tax())
411
+		$geodir_post_type = geodir_get_taxonomy_posttype();
412 412
 
413 413
 
414
-    $all_postypes = geodir_get_posttypes();
415
-    $all_postypes = stripslashes_deep($all_postypes);
414
+	$all_postypes = geodir_get_posttypes();
415
+	$all_postypes = stripslashes_deep($all_postypes);
416 416
 
417
-    if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes))
418
-        $geodir_post_type = '';
417
+	if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes))
418
+		$geodir_post_type = '';
419 419
 
420 420
 
421
-    return $geodir_post_type;
421
+	return $geodir_post_type;
422 422
 }
423 423
 
424 424
 /**
@@ -432,21 +432,21 @@  discard block
 block discarded – undo
432 432
  */
433 433
 function geodir_get_posttypes($output = 'names')
434 434
 {
435
-    $post_types = array();
436
-    $post_types = get_option('geodir_post_types');
437
-    $post_types = stripslashes_deep($post_types);
438
-    if (!empty($post_types)) {
439
-        switch ($output):
440
-            case 'object':
441
-            case 'Object':
442
-                $post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types;
443
-                break;
444
-            case 'array':
445
-            case 'Array':
446
-                $post_types = (array)$post_types;
447
-                break;
435
+	$post_types = array();
436
+	$post_types = get_option('geodir_post_types');
437
+	$post_types = stripslashes_deep($post_types);
438
+	if (!empty($post_types)) {
439
+		switch ($output):
440
+			case 'object':
441
+			case 'Object':
442
+				$post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types;
443
+				break;
444
+			case 'array':
445
+			case 'Array':
446
+				$post_types = (array)$post_types;
447
+				break;
448 448
 			case 'options':
449
-                $post_types = (array)$post_types;
449
+				$post_types = (array)$post_types;
450 450
 				
451 451
 				$options = array();
452 452
 				if (!empty($post_types)) {
@@ -455,17 +455,17 @@  discard block
 block discarded – undo
455 455
 					}
456 456
 				}
457 457
 				$post_types = $options;
458
-                break;
459
-            default:
460
-                $post_types = array_keys($post_types);
461
-                break;
462
-        endswitch;
463
-    }
464
-
465
-    if (!empty($post_types))
466
-        return $post_types;
467
-    else
468
-        return array();
458
+				break;
459
+			default:
460
+				$post_types = array_keys($post_types);
461
+				break;
462
+		endswitch;
463
+	}
464
+
465
+	if (!empty($post_types))
466
+		return $post_types;
467
+	else
468
+		return array();
469 469
 }
470 470
 
471 471
 /**
@@ -478,108 +478,108 @@  discard block
 block discarded – undo
478 478
  */
479 479
 function geodir_get_posttype_info($post_type = '')
480 480
 {
481
-    $post_types = array();
482
-    $post_types = get_option('geodir_post_types');
483
-    $post_types = stripslashes_deep($post_types);
484
-    if (!empty($post_types) && $post_type != '') {
485
-        return $post_types[$post_type];
486
-    } else
487
-        return false;
481
+	$post_types = array();
482
+	$post_types = get_option('geodir_post_types');
483
+	$post_types = stripslashes_deep($post_types);
484
+	if (!empty($post_types) && $post_type != '') {
485
+		return $post_types[$post_type];
486
+	} else
487
+		return false;
488 488
 }
489 489
 
490 490
 if (!function_exists('geodir_get_taxonomies')) {
491
-    /**
492
-     * Get all custom taxonomies.
493
-     *
494
-     * @since 1.0.0
495
-     * @package GeoDirectory
496
-     * @param string $post_type The post type.
497
-     * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false.
498
-     * @return array|bool Taxonomies on success. false on failure.
499
-     */
500
-    function geodir_get_taxonomies($post_type = '', $tages_taxonomies = false)
501
-    {
491
+	/**
492
+	 * Get all custom taxonomies.
493
+	 *
494
+	 * @since 1.0.0
495
+	 * @package GeoDirectory
496
+	 * @param string $post_type The post type.
497
+	 * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false.
498
+	 * @return array|bool Taxonomies on success. false on failure.
499
+	 */
500
+	function geodir_get_taxonomies($post_type = '', $tages_taxonomies = false)
501
+	{
502 502
 
503
-        $taxonomies = array();
504
-        $gd_taxonomies = array();
503
+		$taxonomies = array();
504
+		$gd_taxonomies = array();
505 505
 
506
-        if ($taxonomies = get_option('geodir_taxonomies')) {
506
+		if ($taxonomies = get_option('geodir_taxonomies')) {
507 507
 
508 508
 
509
-            $gd_taxonomies = array_keys($taxonomies);
509
+			$gd_taxonomies = array_keys($taxonomies);
510 510
 
511 511
 
512
-            if ($post_type != '')
513
-                $gd_taxonomies = array();
512
+			if ($post_type != '')
513
+				$gd_taxonomies = array();
514 514
 
515
-            $i = 0;
516
-            foreach ($taxonomies as $taxonomy => $args) {
515
+			$i = 0;
516
+			foreach ($taxonomies as $taxonomy => $args) {
517 517
 
518
-                if ($post_type != '' && $args['object_type'] == $post_type)
519
-                    $gd_taxonomies[] = $taxonomy;
518
+				if ($post_type != '' && $args['object_type'] == $post_type)
519
+					$gd_taxonomies[] = $taxonomy;
520 520
 
521
-                if ($tages_taxonomies === false && strpos($taxonomy, '_tag') !== false) {
522
-                    if (array_search($taxonomy, $gd_taxonomies) !== false)
523
-                        unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]);
524
-                }
521
+				if ($tages_taxonomies === false && strpos($taxonomy, '_tag') !== false) {
522
+					if (array_search($taxonomy, $gd_taxonomies) !== false)
523
+						unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]);
524
+				}
525 525
 
526
-            }
526
+			}
527
+
528
+			$gd_taxonomies = array_values($gd_taxonomies);
529
+		}
527 530
 
528
-            $gd_taxonomies = array_values($gd_taxonomies);
529
-        }
530
-
531
-        /**
532
-         * Filter the taxonomies.
533
-         *
534
-         * @since 1.0.0
535
-         * @param array $gd_taxonomies The taxonomy array.
536
-         */
537
-        $taxonomies = apply_filters('geodir_taxonomy', $gd_taxonomies);
538
-
539
-        if (!empty($taxonomies)) {
540
-            return $taxonomies;
541
-        } else {
542
-            return false;
543
-        }
544
-    }
531
+		/**
532
+		 * Filter the taxonomies.
533
+		 *
534
+		 * @since 1.0.0
535
+		 * @param array $gd_taxonomies The taxonomy array.
536
+		 */
537
+		$taxonomies = apply_filters('geodir_taxonomy', $gd_taxonomies);
538
+
539
+		if (!empty($taxonomies)) {
540
+			return $taxonomies;
541
+		} else {
542
+			return false;
543
+		}
544
+	}
545 545
 }
546 546
 
547 547
 if (!function_exists(' geodir_get_categories_dl')) {
548
-    /**
549
-     * Get categories dropdown HTML.
550
-     *
551
-     * @since 1.0.0
552
-     * @package GeoDirectory
553
-     * @param string $post_type The post type.
554
-     * @param string $selected The selected value.
555
-     * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false.
556
-     * @param bool $echo Prints the HTML when set to true. Default: true.
557
-     * @return void|string Dropdown HTML.
558
-     */
559
-    function  geodir_get_categories_dl($post_type = '', $selected = '', $tages_taxonomies = false, $echo = true)
560
-    {
561
-
562
-        $html = '';
563
-        $taxonomies = geodir_get_taxonomies($post_type, $tages_taxonomies);
564
-
565
-        $categories = get_terms($taxonomies);
566
-
567
-        $html .= '<option value="0">' . __('All', 'geodirectory') . '</option>';
568
-
569
-        foreach ($categories as $category_obj) {
570
-            $select_opt = '';
571
-            if ($selected == $category_obj->term_id) {
572
-                $select_opt = 'selected="selected"';
573
-            }
574
-            $html .= '<option ' . $select_opt . ' value="' . $category_obj->term_id . '">'
575
-                . ucfirst($category_obj->name) . '</option>';
576
-        }
577
-
578
-        if ($echo)
579
-            echo $html;
580
-        else
581
-            return $html;
582
-    }
548
+	/**
549
+	 * Get categories dropdown HTML.
550
+	 *
551
+	 * @since 1.0.0
552
+	 * @package GeoDirectory
553
+	 * @param string $post_type The post type.
554
+	 * @param string $selected The selected value.
555
+	 * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false.
556
+	 * @param bool $echo Prints the HTML when set to true. Default: true.
557
+	 * @return void|string Dropdown HTML.
558
+	 */
559
+	function  geodir_get_categories_dl($post_type = '', $selected = '', $tages_taxonomies = false, $echo = true)
560
+	{
561
+
562
+		$html = '';
563
+		$taxonomies = geodir_get_taxonomies($post_type, $tages_taxonomies);
564
+
565
+		$categories = get_terms($taxonomies);
566
+
567
+		$html .= '<option value="0">' . __('All', 'geodirectory') . '</option>';
568
+
569
+		foreach ($categories as $category_obj) {
570
+			$select_opt = '';
571
+			if ($selected == $category_obj->term_id) {
572
+				$select_opt = 'selected="selected"';
573
+			}
574
+			$html .= '<option ' . $select_opt . ' value="' . $category_obj->term_id . '">'
575
+				. ucfirst($category_obj->name) . '</option>';
576
+		}
577
+
578
+		if ($echo)
579
+			echo $html;
580
+		else
581
+			return $html;
582
+	}
583 583
 }
584 584
 
585 585
 
@@ -594,28 +594,28 @@  discard block
 block discarded – undo
594 594
 function geodir_get_listing_slug($object_type = '')
595 595
 {
596 596
 
597
-    $listing_slug = '';
597
+	$listing_slug = '';
598 598
 
599
-    $post_types = get_option('geodir_post_types');
600
-    $taxonomies = get_option('geodir_taxonomies');
599
+	$post_types = get_option('geodir_post_types');
600
+	$taxonomies = get_option('geodir_taxonomies');
601 601
 
602 602
 
603
-    if ($object_type != '') {
604
-        if (!empty($post_types) && array_key_exists($object_type, $post_types)) {
603
+	if ($object_type != '') {
604
+		if (!empty($post_types) && array_key_exists($object_type, $post_types)) {
605 605
 
606
-            $object_info = $post_types[$object_type];
607
-            $listing_slug = $object_info['listing_slug'];
608
-        } elseif (!empty($taxonomies) && array_key_exists($object_type, $taxonomies)) {
609
-            $object_info = $taxonomies[$object_type];
610
-            $listing_slug = $object_info['listing_slug'];
611
-        }
606
+			$object_info = $post_types[$object_type];
607
+			$listing_slug = $object_info['listing_slug'];
608
+		} elseif (!empty($taxonomies) && array_key_exists($object_type, $taxonomies)) {
609
+			$object_info = $taxonomies[$object_type];
610
+			$listing_slug = $object_info['listing_slug'];
611
+		}
612 612
 
613
-    }
613
+	}
614 614
 
615
-    if (!empty($listing_slug))
616
-        return $listing_slug;
617
-    else
618
-        return false;
615
+	if (!empty($listing_slug))
616
+		return $listing_slug;
617
+	else
618
+		return false;
619 619
 }
620 620
 
621 621
 
@@ -630,212 +630,212 @@  discard block
 block discarded – undo
630 630
  */
631 631
 function geodir_get_taxonomy_posttype($taxonomy = '')
632 632
 {
633
-    global $wp_query;
634
-
635
-    $post_type = array();
636
-    $taxonomies = array();
637
-
638
-    if (!empty($taxonomy)) {
639
-        $taxonomies[] = $taxonomy;
640
-    } elseif (isset($wp_query->tax_query->queries)) {
641
-        $tax_arr = $wp_query->tax_query->queries;
642
-        //if tax query has 'relation' set then it will break wp_list_pluck so we remove it
643
-        if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);}
644
-        $taxonomies = wp_list_pluck($tax_arr, 'taxonomy');
645
-    }
646
-
647
-    if (!empty($taxonomies)) {
648
-        foreach (geodir_get_posttypes() as $pt) {
649
-            $object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt);
650
-            if (array_intersect($taxonomies, $object_taxonomies))
651
-                $post_type[] = $pt;
652
-        }
653
-    }
654
-
655
-    if (!empty($post_type))
656
-        return $post_type[0];
657
-    else
658
-        return false;
633
+	global $wp_query;
634
+
635
+	$post_type = array();
636
+	$taxonomies = array();
637
+
638
+	if (!empty($taxonomy)) {
639
+		$taxonomies[] = $taxonomy;
640
+	} elseif (isset($wp_query->tax_query->queries)) {
641
+		$tax_arr = $wp_query->tax_query->queries;
642
+		//if tax query has 'relation' set then it will break wp_list_pluck so we remove it
643
+		if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);}
644
+		$taxonomies = wp_list_pluck($tax_arr, 'taxonomy');
645
+	}
646
+
647
+	if (!empty($taxonomies)) {
648
+		foreach (geodir_get_posttypes() as $pt) {
649
+			$object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt);
650
+			if (array_intersect($taxonomies, $object_taxonomies))
651
+				$post_type[] = $pt;
652
+		}
653
+	}
654
+
655
+	if (!empty($post_type))
656
+		return $post_type[0];
657
+	else
658
+		return false;
659 659
 }
660 660
 
661 661
 if (!function_exists('geodir_custom_taxonomy_walker')) {
662
-    /**
663
-     * Custom taxonomy walker function.
664
-     *
665
-     * @since 1.0.0
666
-     * @package GeoDirectory
667
-     * @param string $cat_taxonomy The taxonomy name.
668
-     * @param int $cat_parent The parent term ID.
669
-     * @param bool $hide_empty Hide empty taxonomies? Default: false.
670
-     * @param int $pading CSS padding in pixels.
671
-     * @return string|void taxonomy HTML.
672
-     */
673
-    function geodir_custom_taxonomy_walker($cat_taxonomy, $cat_parent = 0, $hide_empty = false, $pading = 0)
674
-    {
675
-        global $cat_display, $post_cat, $exclude_cats;
676
-
677
-        $search_terms = trim($post_cat, ",");
678
-
679
-        $search_terms = explode(",", $search_terms);
680
-
681
-        $cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'hide_empty' => $hide_empty, 'exclude' => $exclude_cats));
682
-
683
-        $display = '';
684
-        $onchange = '';
685
-        $term_check = '';
686
-        $main_list_class = '';
687
-        $out = '';
688
-        //If there are terms, start displaying
689
-        if (count($cat_terms) > 0) {
690
-            //Displaying as a list
691
-            $p = $pading * 20;
692
-            $pading++;
693
-
694
-
695
-            if ((!geodir_is_page('listing')) || (is_search() && $_REQUEST['search_taxonomy'] == '')) {
696
-                if ($cat_parent == 0) {
697
-                    $list_class = 'main_list gd-parent-cats-list gd-cats-display-' . $cat_display;
698
-                    $main_list_class = 'class="main_list_selecter"';
699
-                } else {
700
-                    //$display = 'display:none';
701
-                    $list_class = 'sub_list gd-sub-cats-list';
702
-                }
703
-            }
662
+	/**
663
+	 * Custom taxonomy walker function.
664
+	 *
665
+	 * @since 1.0.0
666
+	 * @package GeoDirectory
667
+	 * @param string $cat_taxonomy The taxonomy name.
668
+	 * @param int $cat_parent The parent term ID.
669
+	 * @param bool $hide_empty Hide empty taxonomies? Default: false.
670
+	 * @param int $pading CSS padding in pixels.
671
+	 * @return string|void taxonomy HTML.
672
+	 */
673
+	function geodir_custom_taxonomy_walker($cat_taxonomy, $cat_parent = 0, $hide_empty = false, $pading = 0)
674
+	{
675
+		global $cat_display, $post_cat, $exclude_cats;
676
+
677
+		$search_terms = trim($post_cat, ",");
678
+
679
+		$search_terms = explode(",", $search_terms);
680
+
681
+		$cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'hide_empty' => $hide_empty, 'exclude' => $exclude_cats));
682
+
683
+		$display = '';
684
+		$onchange = '';
685
+		$term_check = '';
686
+		$main_list_class = '';
687
+		$out = '';
688
+		//If there are terms, start displaying
689
+		if (count($cat_terms) > 0) {
690
+			//Displaying as a list
691
+			$p = $pading * 20;
692
+			$pading++;
693
+
694
+
695
+			if ((!geodir_is_page('listing')) || (is_search() && $_REQUEST['search_taxonomy'] == '')) {
696
+				if ($cat_parent == 0) {
697
+					$list_class = 'main_list gd-parent-cats-list gd-cats-display-' . $cat_display;
698
+					$main_list_class = 'class="main_list_selecter"';
699
+				} else {
700
+					//$display = 'display:none';
701
+					$list_class = 'sub_list gd-sub-cats-list';
702
+				}
703
+			}
704 704
 
705
-            if ($cat_display == 'checkbox' || $cat_display == 'radio') {
706
-                $p = 0;
707
-                $out = '<div class="' . $list_class . ' gd-cat-row-' . $cat_parent . '" style="margin-left:' . $p . 'px;' . $display . ';">';
708
-            }
705
+			if ($cat_display == 'checkbox' || $cat_display == 'radio') {
706
+				$p = 0;
707
+				$out = '<div class="' . $list_class . ' gd-cat-row-' . $cat_parent . '" style="margin-left:' . $p . 'px;' . $display . ';">';
708
+			}
709 709
 
710
-            foreach ($cat_terms as $cat_term) {
710
+			foreach ($cat_terms as $cat_term) {
711 711
 
712
-                $checked = '';
712
+				$checked = '';
713 713
 
714
-                if (in_array($cat_term->term_id, $search_terms)) {
715
-                    if ($cat_display == 'select' || $cat_display == 'multiselect')
716
-                        $checked = 'selected="selected"';
717
-                    else
718
-                        $checked = 'checked="checked"';
719
-                }
714
+				if (in_array($cat_term->term_id, $search_terms)) {
715
+					if ($cat_display == 'select' || $cat_display == 'multiselect')
716
+						$checked = 'selected="selected"';
717
+					else
718
+						$checked = 'checked="checked"';
719
+				}
720 720
 
721
-                if ($cat_display == 'radio')
722
-                    $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
723
-                elseif ($cat_display == 'select' || $cat_display == 'multiselect')
724
-                    $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . ucfirst($cat_term->name) . '</option>';
721
+				if ($cat_display == 'radio')
722
+					$out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
723
+				elseif ($cat_display == 'select' || $cat_display == 'multiselect')
724
+					$out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . ucfirst($cat_term->name) . '</option>';
725 725
 
726
-                else {
727
-                    $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
728
-                }
726
+				else {
727
+					$out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
728
+				}
729 729
 
730
-                // Call recurson to print sub cats
731
-                $out .= geodir_custom_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading);
730
+				// Call recurson to print sub cats
731
+				$out .= geodir_custom_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading);
732 732
 
733
-            }
733
+			}
734 734
 
735
-            if ($cat_display == 'checkbox' || $cat_display == 'radio')
736
-                $out .= '</div>';
735
+			if ($cat_display == 'checkbox' || $cat_display == 'radio')
736
+				$out .= '</div>';
737 737
 
738
-            return $out;
739
-        }
740
-        return;
741
-    }
738
+			return $out;
739
+		}
740
+		return;
741
+	}
742 742
 }
743 743
 
744 744
 if (!function_exists('geodir_custom_taxonomy_walker2')) {
745
-    /**
746
-     * Custom taxonomy walker function.
747
-     *
748
-     * @since 1.0.0
749
-     * @package GeoDirectory
750
-     * @global object $post WordPress Post object.
751
-     * @global object $gd_session GeoDirectory Session object.
752
-     * @param string $cat_taxonomy The taxonomy name.
753
-     * @param string $cat_limit Number of categories to display.
754
-     */
755
-    function geodir_custom_taxonomy_walker2($cat_taxonomy, $cat_limit = '')
756
-    {
757
-        $post_category = '';
758
-        $post_category_str = '';
759
-        global $exclude_cats, $gd_session;
760
-
761
-        $cat_exclude = '';
762
-        if (is_array($exclude_cats) && !empty($exclude_cats))
763
-            $cat_exclude = serialize($exclude_cats);
764
-
765
-        if (isset($_REQUEST['backandedit'])) {
766
-            $post = (object)$gd_session->get('listing');
767
-
768
-            if (!is_array($post->post_category[$cat_taxonomy]))
769
-                $post_category = $post->post_category[$cat_taxonomy];
770
-
771
-            $post_categories = $post->post_category_str;
772
-            if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories))
773
-                $post_category_str = $post_categories[$cat_taxonomy];
774
-
775
-        } elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) {
776
-            global $post;
777
-
778
-            $post_category = geodir_get_post_meta($post->ID, $cat_taxonomy, true);
779
-            if (empty($post_category) && isset($post->$cat_taxonomy)) {
780
-                $post_category = $post->$cat_taxonomy;
781
-            }
745
+	/**
746
+	 * Custom taxonomy walker function.
747
+	 *
748
+	 * @since 1.0.0
749
+	 * @package GeoDirectory
750
+	 * @global object $post WordPress Post object.
751
+	 * @global object $gd_session GeoDirectory Session object.
752
+	 * @param string $cat_taxonomy The taxonomy name.
753
+	 * @param string $cat_limit Number of categories to display.
754
+	 */
755
+	function geodir_custom_taxonomy_walker2($cat_taxonomy, $cat_limit = '')
756
+	{
757
+		$post_category = '';
758
+		$post_category_str = '';
759
+		global $exclude_cats, $gd_session;
760
+
761
+		$cat_exclude = '';
762
+		if (is_array($exclude_cats) && !empty($exclude_cats))
763
+			$cat_exclude = serialize($exclude_cats);
764
+
765
+		if (isset($_REQUEST['backandedit'])) {
766
+			$post = (object)$gd_session->get('listing');
767
+
768
+			if (!is_array($post->post_category[$cat_taxonomy]))
769
+				$post_category = $post->post_category[$cat_taxonomy];
770
+
771
+			$post_categories = $post->post_category_str;
772
+			if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories))
773
+				$post_category_str = $post_categories[$cat_taxonomy];
774
+
775
+		} elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) {
776
+			global $post;
777
+
778
+			$post_category = geodir_get_post_meta($post->ID, $cat_taxonomy, true);
779
+			if (empty($post_category) && isset($post->$cat_taxonomy)) {
780
+				$post_category = $post->$cat_taxonomy;
781
+			}
782 782
 
783
-            $post_categories = get_post_meta($post->ID, 'post_categories', true);
783
+			$post_categories = get_post_meta($post->ID, 'post_categories', true);
784 784
 
785
-            if (empty($post_category) && !empty($post_categories) && !empty($post_categories[$cat_taxonomy])) {
786
-                foreach (explode(",", $post_categories[$cat_taxonomy]) as $cat_part) {
787
-                    if (is_numeric($cat_part)) {
788
-                        $cat_part_arr[] = $cat_part;
789
-                    }
790
-                }
791
-                if (is_array($cat_part_arr)) {
792
-                    $post_category = implode(',', $cat_part_arr);
793
-                }
794
-            }
785
+			if (empty($post_category) && !empty($post_categories) && !empty($post_categories[$cat_taxonomy])) {
786
+				foreach (explode(",", $post_categories[$cat_taxonomy]) as $cat_part) {
787
+					if (is_numeric($cat_part)) {
788
+						$cat_part_arr[] = $cat_part;
789
+					}
790
+				}
791
+				if (is_array($cat_part_arr)) {
792
+					$post_category = implode(',', $cat_part_arr);
793
+				}
794
+			}
795 795
 
796
-            if (!empty($post_category)) {
797
-                $cat1 = array_filter(explode(',', $post_category));
798
-                $post_category = ',' . implode(',', $cat1) . ',';
796
+			if (!empty($post_category)) {
797
+				$cat1 = array_filter(explode(',', $post_category));
798
+				$post_category = ',' . implode(',', $cat1) . ',';
799 799
 
800
-            }
800
+			}
801 801
 
802
-            if ($post_category != '' && is_array($exclude_cats) && !empty($exclude_cats)) {
802
+			if ($post_category != '' && is_array($exclude_cats) && !empty($exclude_cats)) {
803 803
 
804
-                $post_category_upd = explode(',', $post_category);
805
-                $post_category_change = '';
806
-                foreach ($post_category_upd as $cat) {
804
+				$post_category_upd = explode(',', $post_category);
805
+				$post_category_change = '';
806
+				foreach ($post_category_upd as $cat) {
807 807
 
808
-                    if (!in_array($cat, $exclude_cats) && $cat != '') {
809
-                        $post_category_change .= ',' . $cat;
810
-                    }
811
-                }
812
-                $post_category = $post_category_change;
813
-            }
808
+					if (!in_array($cat, $exclude_cats) && $cat != '') {
809
+						$post_category_change .= ',' . $cat;
810
+					}
811
+				}
812
+				$post_category = $post_category_change;
813
+			}
814 814
 
815 815
 
816
-            if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
817
-                $post_category_str = $post_categories[$cat_taxonomy];
818
-            }
819
-        }
816
+			if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
817
+				$post_category_str = $post_categories[$cat_taxonomy];
818
+			}
819
+		}
820 820
 
821
-        echo '<input type="hidden" id="cat_limit" value="' . $cat_limit . '" name="cat_limit[' . $cat_taxonomy . ']"  />';
821
+		echo '<input type="hidden" id="cat_limit" value="' . $cat_limit . '" name="cat_limit[' . $cat_taxonomy . ']"  />';
822 822
 
823
-        echo '<input type="hidden" id="post_category" value="' . $post_category . '" name="post_category[' . $cat_taxonomy . ']"  />';
823
+		echo '<input type="hidden" id="post_category" value="' . $post_category . '" name="post_category[' . $cat_taxonomy . ']"  />';
824 824
 
825
-        echo '<input type="hidden" id="post_category_str" value="' . $post_category_str . '" name="post_category_str[' . $cat_taxonomy . ']"  />';
825
+		echo '<input type="hidden" id="post_category_str" value="' . $post_category_str . '" name="post_category_str[' . $cat_taxonomy . ']"  />';
826 826
 
827 827
 
828
-        ?>
828
+		?>
829 829
         <div class="cat_sublist">
830 830
             <?php
831 831
 
832
-            $post_id = isset($post->ID) ? $post->ID : '';
832
+			$post_id = isset($post->ID) ? $post->ID : '';
833 833
 
834
-            if ((geodir_is_page('add-listing') || is_admin()) && !empty($post_categories[$cat_taxonomy])) {
834
+			if ((geodir_is_page('add-listing') || is_admin()) && !empty($post_categories[$cat_taxonomy])) {
835 835
 
836
-                geodir_editpost_categories_html($cat_taxonomy, $post_id, $post_categories);
837
-            }
838
-            ?>
836
+				geodir_editpost_categories_html($cat_taxonomy, $post_id, $post_categories);
837
+			}
838
+			?>
839 839
         </div>
840 840
         <script type="text/javascript">
841 841
 
@@ -958,22 +958,22 @@  discard block
 block discarded – undo
958 958
 
959 959
         </script>
960 960
         <?php
961
-        if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
962
-            $post_cat_str = $post_categories[$cat_taxonomy];
963
-            $post_cat_array = explode("#", $post_cat_str);
964
-            if (count($post_cat_array) >= $cat_limit && $cat_limit != 0)
965
-                $style = "display:none;";
966
-        }
967
-        ?>
961
+		if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
962
+			$post_cat_str = $post_categories[$cat_taxonomy];
963
+			$post_cat_array = explode("#", $post_cat_str);
964
+			if (count($post_cat_array) >= $cat_limit && $cat_limit != 0)
965
+				$style = "display:none;";
966
+		}
967
+		?>
968 968
         <div class="main_cat_list" style=" <?php if (isset($style)) {
969
-            echo $style;
970
-        }?> ">
969
+			echo $style;
970
+		}?> ">
971 971
             <?php geodir_get_catlist($cat_taxonomy, 0);  // print main categories list
972
-            ?>
972
+			?>
973 973
         </div>
974 974
     <?php
975 975
 
976
-    }
976
+	}
977 977
 }
978 978
 
979 979
 /**
@@ -990,23 +990,23 @@  discard block
 block discarded – undo
990 990
  */
991 991
 function geodir_addpost_categories_html($request_taxonomy, $parrent, $selected = false, $main_selected = true, $default = false, $exclude = '')
992 992
 {
993
-    global $exclude_cats;
994
-
995
-    if ($exclude != '') {
996
-        $exclude_cats = maybe_unserialize(base64_decode($exclude));
997
-        print_r($exclude_cats);
998
-        if(is_array( $exclude_cats)){
999
-            $exclude_cats = array_map( 'intval', $exclude_cats );
1000
-        }else{
1001
-            $exclude_cats = intval($exclude_cats);
1002
-        }
993
+	global $exclude_cats;
994
+
995
+	if ($exclude != '') {
996
+		$exclude_cats = maybe_unserialize(base64_decode($exclude));
997
+		print_r($exclude_cats);
998
+		if(is_array( $exclude_cats)){
999
+			$exclude_cats = array_map( 'intval', $exclude_cats );
1000
+		}else{
1001
+			$exclude_cats = intval($exclude_cats);
1002
+		}
1003 1003
 
1004
-    }
1004
+	}
1005 1005
 
1006
-    if ((is_array($exclude_cats) && !empty($exclude_cats) && !in_array($parrent, $exclude_cats)) ||
1007
-        (!is_array($exclude_cats) || empty($exclude_cats))
1008
-    ) {
1009
-        ?>
1006
+	if ((is_array($exclude_cats) && !empty($exclude_cats) && !in_array($parrent, $exclude_cats)) ||
1007
+		(!is_array($exclude_cats) || empty($exclude_cats))
1008
+	) {
1009
+		?>
1010 1010
 
1011 1011
         <?php $main_cat = get_term($parrent, $request_taxonomy); ?>
1012 1012
 
@@ -1035,8 +1035,8 @@  discard block
 block discarded – undo
1035 1035
 
1036 1036
             <br/>
1037 1037
             <?php
1038
-            $cat_terms = get_terms($request_taxonomy, array('parent' => $main_cat->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats));
1039
-            if (!empty($cat_terms)) { ?>
1038
+			$cat_terms = get_terms($request_taxonomy, array('parent' => $main_cat->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats));
1039
+			if (!empty($cat_terms)) { ?>
1040 1040
                 <span> <?php printf(__('Add listing in category', 'geodirectory')); ?></span>
1041 1041
                 <?php geodir_get_catlist($request_taxonomy, $parrent, $selected) ?>
1042 1042
             <?php } ?>
@@ -1058,53 +1058,53 @@  discard block
 block discarded – undo
1058 1058
 function geodir_editpost_categories_html($request_taxonomy, $request_postid, $post_categories)
1059 1059
 {
1060 1060
 
1061
-    if (!empty($post_categories) && array_key_exists($request_taxonomy, $post_categories)) {
1062
-        $post_cat_str = $post_categories[$request_taxonomy];
1063
-        $post_cat_array = explode("#", $post_cat_str);
1064
-        if (is_array($post_cat_array)) {
1065
-            $post_cat_array = array_unique( $post_cat_array );
1061
+	if (!empty($post_categories) && array_key_exists($request_taxonomy, $post_categories)) {
1062
+		$post_cat_str = $post_categories[$request_taxonomy];
1063
+		$post_cat_array = explode("#", $post_cat_str);
1064
+		if (is_array($post_cat_array)) {
1065
+			$post_cat_array = array_unique( $post_cat_array );
1066 1066
 
1067 1067
 			foreach ($post_cat_array as $post_cat_html) {
1068 1068
 
1069
-                $post_cat_info = explode(":", $post_cat_html);
1070
-                $post_maincat_str = $post_cat_info[0];
1069
+				$post_cat_info = explode(":", $post_cat_html);
1070
+				$post_maincat_str = $post_cat_info[0];
1071 1071
 
1072
-                if (!empty($post_maincat_str)) {
1073
-                    $post_maincat_info = explode(",", $post_maincat_str);
1074
-                    $post_maincat_id = $post_maincat_info[0];
1075
-                    ($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false;
1076
-                    (end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false;
1077
-                }
1078
-                $post_sub_catid = '';
1079
-                if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1080
-                    $post_sub_catid = (int)$post_cat_info[1];
1081
-                }
1072
+				if (!empty($post_maincat_str)) {
1073
+					$post_maincat_info = explode(",", $post_maincat_str);
1074
+					$post_maincat_id = $post_maincat_info[0];
1075
+					($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false;
1076
+					(end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false;
1077
+				}
1078
+				$post_sub_catid = '';
1079
+				if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1080
+					$post_sub_catid = (int)$post_cat_info[1];
1081
+				}
1082 1082
 
1083
-                geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
1083
+				geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
1084 1084
 
1085
-            }
1086
-        } else {
1085
+			}
1086
+		} else {
1087 1087
 
1088
-            $post_cat_info = explode(":", $post_cat_str);
1089
-            $post_maincat_str = $post_cat_info[0];
1088
+			$post_cat_info = explode(":", $post_cat_str);
1089
+			$post_maincat_str = $post_cat_info[0];
1090 1090
 
1091
-            $post_sub_catid = '';
1091
+			$post_sub_catid = '';
1092 1092
 
1093
-            if (!empty($post_maincat_str)) {
1094
-                $post_maincat_info = explode(",", $post_maincat_str);
1095
-                $post_maincat_id = $post_maincat_info[0];
1096
-                ($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false;
1097
-                (end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false;
1098
-            }
1093
+			if (!empty($post_maincat_str)) {
1094
+				$post_maincat_info = explode(",", $post_maincat_str);
1095
+				$post_maincat_id = $post_maincat_info[0];
1096
+				($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false;
1097
+				(end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false;
1098
+			}
1099 1099
 
1100
-            if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1101
-                $post_sub_catid = (int)$post_cat_info[1];
1102
-            }
1100
+			if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1101
+				$post_sub_catid = (int)$post_cat_info[1];
1102
+			}
1103 1103
 
1104
-            geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
1104
+			geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
1105 1105
 
1106
-        }
1107
-    }
1106
+		}
1107
+	}
1108 1108
 }
1109 1109
 
1110 1110
 /**
@@ -1118,35 +1118,35 @@  discard block
 block discarded – undo
1118 1118
  */
1119 1119
 function geodir_get_catlist($cat_taxonomy, $parrent = 0, $selected = false)
1120 1120
 {
1121
-    global $exclude_cats;
1121
+	global $exclude_cats;
1122 1122
 
1123
-    $cat_terms = get_terms($cat_taxonomy, array('parent' => $parrent, 'hide_empty' => false, 'exclude' => $exclude_cats));
1123
+	$cat_terms = get_terms($cat_taxonomy, array('parent' => $parrent, 'hide_empty' => false, 'exclude' => $exclude_cats));
1124 1124
 
1125
-    if (!empty($cat_terms)) {
1126
-        $onchange = '';
1127
-        $onchange = ' onchange="show_subcatlist(this.value, this)" ';
1125
+	if (!empty($cat_terms)) {
1126
+		$onchange = '';
1127
+		$onchange = ' onchange="show_subcatlist(this.value, this)" ';
1128 1128
 
1129
-        $option_selected = '';
1130
-        if (!$selected)
1131
-            $option_slected = ' selected="selected" ';
1129
+		$option_selected = '';
1130
+		if (!$selected)
1131
+			$option_slected = ' selected="selected" ';
1132 1132
 
1133
-        echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >';
1133
+		echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >';
1134 1134
 
1135
-        echo '<option value="" ' . $option_selected . ' >' . __('Select Category', 'geodirectory') . '</option>';
1135
+		echo '<option value="" ' . $option_selected . ' >' . __('Select Category', 'geodirectory') . '</option>';
1136 1136
 
1137
-        foreach ($cat_terms as $cat_term) {
1138
-            $option_selected = '';
1139
-            if ($selected == $cat_term->term_id)
1140
-                $option_selected = ' selected="selected" ';
1137
+		foreach ($cat_terms as $cat_term) {
1138
+			$option_selected = '';
1139
+			if ($selected == $cat_term->term_id)
1140
+				$option_selected = ' selected="selected" ';
1141 1141
 
1142
-            // Count child terms
1143
-            $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) );
1144
-            $has_child = !empty( $child_terms ) ? 't' : 'f';
1142
+			// Count child terms
1143
+			$child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) );
1144
+			$has_child = !empty( $child_terms ) ? 't' : 'f';
1145 1145
 
1146
-            echo '<option  ' . $option_selected . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" _hc="' . $has_child . '" >' . ucfirst($cat_term->name) . '</option>';
1147
-        }
1148
-        echo '</select>';
1149
-    }
1146
+			echo '<option  ' . $option_selected . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" _hc="' . $has_child . '" >' . ucfirst($cat_term->name) . '</option>';
1147
+		}
1148
+		echo '</select>';
1149
+	}
1150 1150
 }
1151 1151
 
1152 1152
 /**
@@ -1162,28 +1162,28 @@  discard block
 block discarded – undo
1162 1162
  */
1163 1163
 function geodir_custom_update_messages($messages)
1164 1164
 {
1165
-    global $post, $post_ID;
1166
-
1167
-    $post_types = get_post_types(array('show_ui' => true, '_builtin' => false), 'objects');
1168
-
1169
-    foreach ($post_types as $post_type => $post_object) {
1170
-
1171
-        $messages[$post_type] = array(
1172
-            0 => '', // Unused. Messages start at index 1.
1173
-            1 => sprintf(__('%s updated. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1174
-            2 => __('Custom field updated.', 'geodirectory'),
1175
-            3 => __('Custom field deleted.', 'geodirectory'),
1176
-            4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name),
1177
-            5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int)$_GET['revision'], false)) : false,
1178
-            6 => sprintf(__('%s published. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1179
-            7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name),
1180
-            8 => sprintf(__('%s submitted. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
1181
-            9 => sprintf(__('%s scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, date_i18n(__('M j, Y @ G:i', 'geodirectory'), strtotime($post->post_date)), esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1182
-            10 => sprintf(__('%s draft updated. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
1183
-        );
1184
-    }
1185
-
1186
-    return $messages;
1165
+	global $post, $post_ID;
1166
+
1167
+	$post_types = get_post_types(array('show_ui' => true, '_builtin' => false), 'objects');
1168
+
1169
+	foreach ($post_types as $post_type => $post_object) {
1170
+
1171
+		$messages[$post_type] = array(
1172
+			0 => '', // Unused. Messages start at index 1.
1173
+			1 => sprintf(__('%s updated. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1174
+			2 => __('Custom field updated.', 'geodirectory'),
1175
+			3 => __('Custom field deleted.', 'geodirectory'),
1176
+			4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name),
1177
+			5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int)$_GET['revision'], false)) : false,
1178
+			6 => sprintf(__('%s published. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1179
+			7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name),
1180
+			8 => sprintf(__('%s submitted. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
1181
+			9 => sprintf(__('%s scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, date_i18n(__('M j, Y @ G:i', 'geodirectory'), strtotime($post->post_date)), esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1182
+			10 => sprintf(__('%s draft updated. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
1183
+		);
1184
+	}
1185
+
1186
+	return $messages;
1187 1187
 }
1188 1188
 
1189 1189
 
@@ -1198,181 +1198,181 @@  discard block
 block discarded – undo
1198 1198
 function geodir_register_defaults()
1199 1199
 {
1200 1200
 
1201
-    global $wpdb;
1202
-
1203
-    $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico';
1204
-
1205
-    if (!$listing_slug = get_option('geodir_listing_prefix'))
1206
-        $listing_slug = 'places';
1207
-
1208
-    /**
1209
-     * Taxonomies
1210
-     **/
1211
-    //if ( ! taxonomy_exists('gd_place_tags') )
1212
-    {
1213
-
1214
-        $gd_placetags = array();
1215
-        $gd_placetags['object_type'] = 'gd_place';
1216
-        $gd_placetags['listing_slug'] = $listing_slug . '/tags';
1217
-        $gd_placetags['args'] = array(
1218
-            'public' => true,
1219
-            'hierarchical' => false,
1220
-            'rewrite' => array('slug' => $listing_slug . '/tags', 'with_front' => false, 'hierarchical' => true),
1221
-            'query_var' => true,
1222
-
1223
-            'labels' => array(
1224
-                'name' => __('Place Tags', 'geodirectory'),
1225
-                'singular_name' => __('Place Tag', 'geodirectory'),
1226
-                'search_items' => __('Search Place Tags', 'geodirectory'),
1227
-                'popular_items' => __('Popular Place Tags', 'geodirectory'),
1228
-                'all_items' => __('All Place Tags', 'geodirectory'),
1229
-                'edit_item' => __('Edit Place Tag', 'geodirectory'),
1230
-                'update_item' => __('Update Place Tag', 'geodirectory'),
1231
-                'add_new_item' => __('Add New Place Tag', 'geodirectory'),
1232
-                'new_item_name' => __('New Place Tag Name', 'geodirectory'),
1233
-                'add_or_remove_items' => __('Add or remove Place tags', 'geodirectory'),
1234
-                'choose_from_most_used' => __('Choose from the most used Place tags', 'geodirectory'),
1235
-                'separate_items_with_commas' => __('Separate Place tags with commas', 'geodirectory'),
1236
-            ),
1237
-        );
1238
-
1239
-
1240
-        $geodir_taxonomies = get_option('geodir_taxonomies');
1241
-        $geodir_taxonomies['gd_place_tags'] = $gd_placetags;
1242
-        update_option('geodir_taxonomies', $geodir_taxonomies);
1243
-
1244
-
1245
-        // Update post types and delete tmp options
1246
-        flush_rewrite_rules();
1247
-
1248
-    }
1249
-
1250
-    //if ( ! taxonomy_exists('gd_placecategory') )
1251
-    {
1252
-
1253
-        $gd_placecategory = array();
1254
-        $gd_placecategory['object_type'] = 'gd_place';
1255
-        $gd_placecategory['listing_slug'] = $listing_slug;
1256
-        $gd_placecategory['args'] = array(
1257
-            'public' => true,
1258
-            'hierarchical' => true,
1259
-            'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true),
1260
-            'query_var' => true,
1261
-            'labels' => array(
1262
-                'name' => __('Place Categories', 'geodirectory'),
1263
-                'singular_name' => __('Place Category', 'geodirectory'),
1264
-                'search_items' => __('Search Place Categories', 'geodirectory'),
1265
-                'popular_items' => __('Popular Place Categories', 'geodirectory'),
1266
-                'all_items' => __('All Place Categories', 'geodirectory'),
1267
-                'edit_item' => __('Edit Place Category', 'geodirectory'),
1268
-                'update_item' => __('Update Place Category', 'geodirectory'),
1269
-                'add_new_item' => __('Add New Place Category', 'geodirectory'),
1270
-                'new_item_name' => __('New Place Category', 'geodirectory'),
1271
-                'add_or_remove_items' => __('Add or remove Place categories', 'geodirectory'),
1272
-            ),
1273
-        );
1274
-
1275
-
1276
-        $geodir_taxonomies = get_option('geodir_taxonomies');
1277
-        $geodir_taxonomies['gd_placecategory'] = $gd_placecategory;
1278
-        update_option('geodir_taxonomies', $geodir_taxonomies);
1279
-
1280
-
1281
-        flush_rewrite_rules();
1282
-    }
1283
-
1284
-    /**
1285
-     * Post Types
1286
-     **/
1287
-
1288
-    //if ( ! post_type_exists('gd_place') )
1289
-    {
1290
-
1291
-        $labels = array(
1292
-            'name' => __('Places', 'geodirectory'),
1293
-            'singular_name' => __('Place', 'geodirectory'),
1294
-            'add_new' => __('Add New', 'geodirectory'),
1295
-            'add_new_item' => __('Add New Place', 'geodirectory'),
1296
-            'edit_item' => __('Edit Place', 'geodirectory'),
1297
-            'new_item' => __('New Place', 'geodirectory'),
1298
-            'view_item' => __('View Place', 'geodirectory'),
1299
-            'search_items' => __('Search Places', 'geodirectory'),
1300
-            'not_found' => __('No Place Found', 'geodirectory'),
1301
-            'not_found_in_trash' => __('No Place Found In Trash', 'geodirectory'));
1302
-
1303
-        $place_default = array(
1304
-            'labels' => $labels,
1305
-            'can_export' => true,
1306
-            'capability_type' => 'post',
1307
-            'description' => 'Place post type.',
1308
-            'has_archive' => $listing_slug,
1309
-            'hierarchical' => false,
1310
-            'map_meta_cap' => true,
1311
-            'menu_icon' => $menu_icon,
1312
-            'public' => true,
1313
-            'query_var' => true,
1314
-            'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true),
1315
-            'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/),
1316
-            'taxonomies' => array('gd_placecategory', 'gd_place_tags'));
1317
-
1318
-        //Update custom post types
1319
-        $geodir_post_types = get_option('geodir_post_types');
1320
-        $geodir_post_types['gd_place'] = $place_default;
1321
-        update_option('geodir_post_types', $geodir_post_types);
1322
-
1323
-        // Update post types and delete tmp options
1324
-        flush_rewrite_rules();
1325
-    }
1326
-
1327
-
1328
-    geodir_register_taxonomies();
1329
-    geodir_register_post_types();
1330
-
1331
-    //die;
1201
+	global $wpdb;
1202
+
1203
+	$menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico';
1204
+
1205
+	if (!$listing_slug = get_option('geodir_listing_prefix'))
1206
+		$listing_slug = 'places';
1207
+
1208
+	/**
1209
+	 * Taxonomies
1210
+	 **/
1211
+	//if ( ! taxonomy_exists('gd_place_tags') )
1212
+	{
1213
+
1214
+		$gd_placetags = array();
1215
+		$gd_placetags['object_type'] = 'gd_place';
1216
+		$gd_placetags['listing_slug'] = $listing_slug . '/tags';
1217
+		$gd_placetags['args'] = array(
1218
+			'public' => true,
1219
+			'hierarchical' => false,
1220
+			'rewrite' => array('slug' => $listing_slug . '/tags', 'with_front' => false, 'hierarchical' => true),
1221
+			'query_var' => true,
1222
+
1223
+			'labels' => array(
1224
+				'name' => __('Place Tags', 'geodirectory'),
1225
+				'singular_name' => __('Place Tag', 'geodirectory'),
1226
+				'search_items' => __('Search Place Tags', 'geodirectory'),
1227
+				'popular_items' => __('Popular Place Tags', 'geodirectory'),
1228
+				'all_items' => __('All Place Tags', 'geodirectory'),
1229
+				'edit_item' => __('Edit Place Tag', 'geodirectory'),
1230
+				'update_item' => __('Update Place Tag', 'geodirectory'),
1231
+				'add_new_item' => __('Add New Place Tag', 'geodirectory'),
1232
+				'new_item_name' => __('New Place Tag Name', 'geodirectory'),
1233
+				'add_or_remove_items' => __('Add or remove Place tags', 'geodirectory'),
1234
+				'choose_from_most_used' => __('Choose from the most used Place tags', 'geodirectory'),
1235
+				'separate_items_with_commas' => __('Separate Place tags with commas', 'geodirectory'),
1236
+			),
1237
+		);
1238
+
1239
+
1240
+		$geodir_taxonomies = get_option('geodir_taxonomies');
1241
+		$geodir_taxonomies['gd_place_tags'] = $gd_placetags;
1242
+		update_option('geodir_taxonomies', $geodir_taxonomies);
1243
+
1244
+
1245
+		// Update post types and delete tmp options
1246
+		flush_rewrite_rules();
1247
+
1248
+	}
1249
+
1250
+	//if ( ! taxonomy_exists('gd_placecategory') )
1251
+	{
1252
+
1253
+		$gd_placecategory = array();
1254
+		$gd_placecategory['object_type'] = 'gd_place';
1255
+		$gd_placecategory['listing_slug'] = $listing_slug;
1256
+		$gd_placecategory['args'] = array(
1257
+			'public' => true,
1258
+			'hierarchical' => true,
1259
+			'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true),
1260
+			'query_var' => true,
1261
+			'labels' => array(
1262
+				'name' => __('Place Categories', 'geodirectory'),
1263
+				'singular_name' => __('Place Category', 'geodirectory'),
1264
+				'search_items' => __('Search Place Categories', 'geodirectory'),
1265
+				'popular_items' => __('Popular Place Categories', 'geodirectory'),
1266
+				'all_items' => __('All Place Categories', 'geodirectory'),
1267
+				'edit_item' => __('Edit Place Category', 'geodirectory'),
1268
+				'update_item' => __('Update Place Category', 'geodirectory'),
1269
+				'add_new_item' => __('Add New Place Category', 'geodirectory'),
1270
+				'new_item_name' => __('New Place Category', 'geodirectory'),
1271
+				'add_or_remove_items' => __('Add or remove Place categories', 'geodirectory'),
1272
+			),
1273
+		);
1274
+
1275
+
1276
+		$geodir_taxonomies = get_option('geodir_taxonomies');
1277
+		$geodir_taxonomies['gd_placecategory'] = $gd_placecategory;
1278
+		update_option('geodir_taxonomies', $geodir_taxonomies);
1279
+
1280
+
1281
+		flush_rewrite_rules();
1282
+	}
1283
+
1284
+	/**
1285
+	 * Post Types
1286
+	 **/
1287
+
1288
+	//if ( ! post_type_exists('gd_place') )
1289
+	{
1290
+
1291
+		$labels = array(
1292
+			'name' => __('Places', 'geodirectory'),
1293
+			'singular_name' => __('Place', 'geodirectory'),
1294
+			'add_new' => __('Add New', 'geodirectory'),
1295
+			'add_new_item' => __('Add New Place', 'geodirectory'),
1296
+			'edit_item' => __('Edit Place', 'geodirectory'),
1297
+			'new_item' => __('New Place', 'geodirectory'),
1298
+			'view_item' => __('View Place', 'geodirectory'),
1299
+			'search_items' => __('Search Places', 'geodirectory'),
1300
+			'not_found' => __('No Place Found', 'geodirectory'),
1301
+			'not_found_in_trash' => __('No Place Found In Trash', 'geodirectory'));
1302
+
1303
+		$place_default = array(
1304
+			'labels' => $labels,
1305
+			'can_export' => true,
1306
+			'capability_type' => 'post',
1307
+			'description' => 'Place post type.',
1308
+			'has_archive' => $listing_slug,
1309
+			'hierarchical' => false,
1310
+			'map_meta_cap' => true,
1311
+			'menu_icon' => $menu_icon,
1312
+			'public' => true,
1313
+			'query_var' => true,
1314
+			'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true),
1315
+			'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/),
1316
+			'taxonomies' => array('gd_placecategory', 'gd_place_tags'));
1317
+
1318
+		//Update custom post types
1319
+		$geodir_post_types = get_option('geodir_post_types');
1320
+		$geodir_post_types['gd_place'] = $place_default;
1321
+		update_option('geodir_post_types', $geodir_post_types);
1322
+
1323
+		// Update post types and delete tmp options
1324
+		flush_rewrite_rules();
1325
+	}
1326
+
1327
+
1328
+	geodir_register_taxonomies();
1329
+	geodir_register_post_types();
1330
+
1331
+	//die;
1332 1332
 
1333 1333
 }
1334 1334
 
1335 1335
 $gd_wpml_get_languages = "";
1336 1336
 function gd_wpml_get_lang_from_url($url){
1337 1337
 
1338
-    global $gd_wpml_get_languages;
1339
-    if(isset($_REQUEST['lang']) && $_REQUEST['lang']){return $_REQUEST['lang'];}
1338
+	global $gd_wpml_get_languages;
1339
+	if(isset($_REQUEST['lang']) && $_REQUEST['lang']){return $_REQUEST['lang'];}
1340 1340
 
1341 1341
 
1342
-    //
1343
-    $url = str_replace(array("http://","https://"),"",$url);
1344
-    $site_url = str_replace(array("http://","https://"),"",get_bloginfo('url'));
1342
+	//
1343
+	$url = str_replace(array("http://","https://"),"",$url);
1344
+	$site_url = str_replace(array("http://","https://"),"",get_bloginfo('url'));
1345 1345
 
1346
-    $url = str_replace($site_url,"",$url);
1346
+	$url = str_replace($site_url,"",$url);
1347 1347
 
1348 1348
 
1349
-    $segments = explode('/', trim($url, '/'));
1349
+	$segments = explode('/', trim($url, '/'));
1350 1350
 
1351
-    //print_r( $segments);
1352
-    if($gd_wpml_get_languages){
1353
-        $langs = $gd_wpml_get_languages;
1354
-    }else{
1355
-        global $sitepress;
1356
-        $gd_wpml_get_languages = $sitepress->get_active_languages();
1357
-    }
1351
+	//print_r( $segments);
1352
+	if($gd_wpml_get_languages){
1353
+		$langs = $gd_wpml_get_languages;
1354
+	}else{
1355
+		global $sitepress;
1356
+		$gd_wpml_get_languages = $sitepress->get_active_languages();
1357
+	}
1358 1358
 
1359
-    if (isset($segments[0]) && $segments[0] && array_key_exists($segments[0], $gd_wpml_get_languages)) {
1360
-        return $segments[0];
1361
-    }
1359
+	if (isset($segments[0]) && $segments[0] && array_key_exists($segments[0], $gd_wpml_get_languages)) {
1360
+		return $segments[0];
1361
+	}
1362 1362
 
1363
-    return false;
1363
+	return false;
1364 1364
 
1365 1365
 
1366 1366
 }
1367 1367
 
1368 1368
 function gd_wpml_slug_translation_turned_on($post_type) {
1369 1369
 
1370
-    global $sitepress;
1371
-    $settings = $sitepress->get_settings();
1372
-    return isset($settings['posts_slug_translation']['types'][$post_type])
1373
-    && $settings['posts_slug_translation']['types'][$post_type]
1374
-    && isset($settings['posts_slug_translation']['on'])
1375
-    && $settings['posts_slug_translation']['on'];
1370
+	global $sitepress;
1371
+	$settings = $sitepress->get_settings();
1372
+	return isset($settings['posts_slug_translation']['types'][$post_type])
1373
+	&& $settings['posts_slug_translation']['types'][$post_type]
1374
+	&& isset($settings['posts_slug_translation']['on'])
1375
+	&& $settings['posts_slug_translation']['on'];
1376 1376
 }
1377 1377
 
1378 1378
 
@@ -1395,142 +1395,142 @@  discard block
 block discarded – undo
1395 1395
  */
1396 1396
 function geodir_listing_permalink_structure($post_link, $post_obj, $leavename, $sample)
1397 1397
 {
1398
-    //echo $post_link."<br />".$sample ;
1398
+	//echo $post_link."<br />".$sample ;
1399 1399
 
1400 1400
 
1401
-    global $wpdb, $wp_query, $plugin_prefix, $post, $comment_post_cache, $gd_permalink_cache;
1402
-    if (isset($post_obj->ID) && isset($post->ID) && $post_obj->ID == $post->ID) {
1403
-    } elseif (isset($post_obj->post_status) && $post_obj->post_status == 'auto-draft') {
1404
-        return $post_link;
1405
-    } else {
1406
-        $orig_post = $post;
1407
-        $post = $post_obj;
1408
-    }
1401
+	global $wpdb, $wp_query, $plugin_prefix, $post, $comment_post_cache, $gd_permalink_cache;
1402
+	if (isset($post_obj->ID) && isset($post->ID) && $post_obj->ID == $post->ID) {
1403
+	} elseif (isset($post_obj->post_status) && $post_obj->post_status == 'auto-draft') {
1404
+		return $post_link;
1405
+	} else {
1406
+		$orig_post = $post;
1407
+		$post = $post_obj;
1408
+	}
1409 1409
 
1410
-    if (in_array($post->post_type, geodir_get_posttypes())) {
1410
+	if (in_array($post->post_type, geodir_get_posttypes())) {
1411 1411
 
1412 1412
 
1413
-        $post_types = get_option('geodir_post_types');
1414
-        $slug = $post_types[$post->post_type]['rewrite']['slug'];
1413
+		$post_types = get_option('geodir_post_types');
1414
+		$slug = $post_types[$post->post_type]['rewrite']['slug'];
1415 1415
 
1416
-        // Alter the CPT slug if WPML is set to do so
1417
-        if(function_exists('icl_object_id')){
1418
-            if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
1416
+		// Alter the CPT slug if WPML is set to do so
1417
+		if(function_exists('icl_object_id')){
1418
+			if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
1419 1419
 
1420
-                $org_slug = $slug;
1421
-                $slug = apply_filters( 'wpml_translate_single_string',
1422
-                    $slug,
1423
-                    'WordPress',
1424
-                    'URL slug: ' . $slug,
1425
-                    $language_code);
1420
+				$org_slug = $slug;
1421
+				$slug = apply_filters( 'wpml_translate_single_string',
1422
+					$slug,
1423
+					'WordPress',
1424
+					'URL slug: ' . $slug,
1425
+					$language_code);
1426 1426
 
1427
-                if(!$slug){$slug = $org_slug;}
1427
+				if(!$slug){$slug = $org_slug;}
1428 1428
 
1429
-            }
1430
-        }
1429
+			}
1430
+		}
1431 1431
 
1432 1432
 		// Fix slug problem when slug matches part of host or base url/ Ex: url -> www.abcxyz.com & slug -> xyz.
1433
-        $site_url = trailingslashit(get_bloginfo('url'));
1433
+		$site_url = trailingslashit(get_bloginfo('url'));
1434 1434
 
1435 1435
 		$fix_url = strpos($post_link, $site_url) === 0 ? true : false;
1436 1436
 		if ($fix_url) {
1437 1437
 			$post_link = str_replace($site_url, '', $post_link);
1438 1438
 		}
1439 1439
 		
1440
-        $post_link = trailingslashit(
1441
-            preg_replace(  "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 )
1442
-        );
1440
+		$post_link = trailingslashit(
1441
+			preg_replace(  "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 )
1442
+		);
1443 1443
 
1444 1444
 		if ($fix_url) {
1445 1445
 			$post_link = $site_url . $post_link;
1446 1446
 		}
1447 1447
 
1448
-        if (isset($comment_post_cache[$post->ID])) {
1449
-            $post = $comment_post_cache[$post->ID];
1450
-        }
1451
-        if (isset($gd_permalink_cache[$post->ID]) && $gd_permalink_cache[$post->ID] && !$sample) {
1452
-            $post_id = $post->ID;
1453
-            if (isset($orig_post)) {
1454
-                $post = $orig_post;
1455
-            }
1456
-            return $gd_permalink_cache[$post_id];
1457
-        }
1458
-
1459
-        if (!isset($post->post_locations)) {
1460
-            $post_type = $post->post_type;
1461
-            $ID = $post->ID;
1462
-            $post2 = $wpdb->get_row(
1463
-                $wpdb->prepare(
1464
-                    "SELECT * from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1465
-                    array($post->ID)
1466
-                )
1467
-            );
1448
+		if (isset($comment_post_cache[$post->ID])) {
1449
+			$post = $comment_post_cache[$post->ID];
1450
+		}
1451
+		if (isset($gd_permalink_cache[$post->ID]) && $gd_permalink_cache[$post->ID] && !$sample) {
1452
+			$post_id = $post->ID;
1453
+			if (isset($orig_post)) {
1454
+				$post = $orig_post;
1455
+			}
1456
+			return $gd_permalink_cache[$post_id];
1457
+		}
1468 1458
 
1469
-            $post = (object)array_merge((array)$post, (array)$post2);
1459
+		if (!isset($post->post_locations)) {
1460
+			$post_type = $post->post_type;
1461
+			$ID = $post->ID;
1462
+			$post2 = $wpdb->get_row(
1463
+				$wpdb->prepare(
1464
+					"SELECT * from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1465
+					array($post->ID)
1466
+				)
1467
+			);
1470 1468
 
1471
-            $comment_post_cache[$post->ID] = $post;
1472
-        }
1469
+			$post = (object)array_merge((array)$post, (array)$post2);
1473 1470
 
1471
+			$comment_post_cache[$post->ID] = $post;
1472
+		}
1474 1473
 
1475 1474
 
1476
-        if (false !== strpos($post_link, '%gd_taxonomy%')) {
1477 1475
 
1478
-            if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) {
1479
-                $location_request = '';
1476
+		if (false !== strpos($post_link, '%gd_taxonomy%')) {
1480 1477
 
1478
+			if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) {
1479
+				$location_request = '';
1481 1480
 
1482
-                if (!empty($post->post_locations)) {
1483
-                    $geodir_arr_locations = explode(',', $post->post_locations);
1484
-                    if (count($geodir_arr_locations) == 3) {
1485
-                        $post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
1486
-                        $post->city_slug = str_replace(']', '', $post->city_slug);
1487
-                        $post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
1488
-                        $post->region_slug = str_replace(']', '', $post->region_slug);
1489
-                        $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1490
-                        $post->country_slug = str_replace(']', '', $post->country_slug);
1491 1481
 
1492
-                        $post_location = (object)array('country_slug' => $post->country_slug,
1493
-                            'region_slug' => $post->region_slug,
1494
-                            'city_slug' => $post->city_slug
1495
-                        );
1482
+				if (!empty($post->post_locations)) {
1483
+					$geodir_arr_locations = explode(',', $post->post_locations);
1484
+					if (count($geodir_arr_locations) == 3) {
1485
+						$post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
1486
+						$post->city_slug = str_replace(']', '', $post->city_slug);
1487
+						$post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
1488
+						$post->region_slug = str_replace(']', '', $post->region_slug);
1489
+						$post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1490
+						$post->country_slug = str_replace(']', '', $post->country_slug);
1496 1491
 
1497
-                    } else
1498
-                        $post_location = geodir_get_location();
1492
+						$post_location = (object)array('country_slug' => $post->country_slug,
1493
+							'region_slug' => $post->region_slug,
1494
+							'city_slug' => $post->city_slug
1495
+						);
1499 1496
 
1497
+					} else
1498
+						$post_location = geodir_get_location();
1500 1499
 
1501
-                } else {
1502 1500
 
1503
-                    $post_location_sql = $wpdb->get_results(
1504
-                        $wpdb->prepare(
1505
-                            "SELECT post_locations from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1506
-                            array($post->ID)
1507
-                        )
1508
-                    );
1509
-
1510
-                    if (!empty($post_location_sql) && is_array($post_location_sql) && !empty($post_location_sql[0]->post_locations)) {
1511
-
1512
-                        $geodir_arr_locations = explode(',', $post_location_sql[0]->post_locations);
1513
-                        if (count($geodir_arr_locations) == 3) {
1514
-                            $post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
1515
-                            $post->city_slug = str_replace(']', '', $post->city_slug);
1516
-                            $post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
1517
-                            $post->region_slug = str_replace(']', '', $post->region_slug);
1518
-                            $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1519
-                            $post->country_slug = str_replace(']', '', $post->country_slug);
1520
-
1521
-                            $post_location = (object)array('country_slug' => $post->country_slug,
1522
-                                'region_slug' => $post->region_slug,
1523
-                                'city_slug' => $post->city_slug
1524
-                            );
1501
+				} else {
1525 1502
 
1526
-                        }
1527
-                    } else
1528
-                        $post_location = geodir_get_location();
1529
-                }
1503
+					$post_location_sql = $wpdb->get_results(
1504
+						$wpdb->prepare(
1505
+							"SELECT post_locations from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1506
+							array($post->ID)
1507
+						)
1508
+					);
1509
+
1510
+					if (!empty($post_location_sql) && is_array($post_location_sql) && !empty($post_location_sql[0]->post_locations)) {
1511
+
1512
+						$geodir_arr_locations = explode(',', $post_location_sql[0]->post_locations);
1513
+						if (count($geodir_arr_locations) == 3) {
1514
+							$post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
1515
+							$post->city_slug = str_replace(']', '', $post->city_slug);
1516
+							$post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
1517
+							$post->region_slug = str_replace(']', '', $post->region_slug);
1518
+							$post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1519
+							$post->country_slug = str_replace(']', '', $post->country_slug);
1520
+
1521
+							$post_location = (object)array('country_slug' => $post->country_slug,
1522
+								'region_slug' => $post->region_slug,
1523
+								'city_slug' => $post->city_slug
1524
+							);
1525
+
1526
+						}
1527
+					} else
1528
+						$post_location = geodir_get_location();
1529
+				}
1530 1530
 
1531 1531
 
1532
-                if (!empty($post_location)) {
1533
-                    $country_slug = isset($post_location->country_slug) ? $post_location->country_slug : '';
1532
+				if (!empty($post_location)) {
1533
+					$country_slug = isset($post_location->country_slug) ? $post_location->country_slug : '';
1534 1534
 					$region_slug = isset($post_location->region_slug) ? $post_location->region_slug : '';
1535 1535
 					$city_slug = isset($post_location->city_slug) ? $post_location->city_slug : '';
1536 1536
 					
@@ -1548,78 +1548,78 @@  discard block
 block discarded – undo
1548 1548
 					$location_slug[] = $city_slug;
1549 1549
 					
1550 1550
 					$location_request .= implode('/', $location_slug) . '/';
1551
-                }
1552
-            }
1551
+				}
1552
+			}
1553 1553
 
1554
-            if (get_option('geodir_add_categories_url')) {
1554
+			if (get_option('geodir_add_categories_url')) {
1555 1555
 
1556
-                $term_request = '';
1557
-                $taxonomies = geodir_get_taxonomies($post->post_type);
1556
+				$term_request = '';
1557
+				$taxonomies = geodir_get_taxonomies($post->post_type);
1558 1558
 
1559
-                $taxonomies = end($taxonomies);
1559
+				$taxonomies = end($taxonomies);
1560 1560
 
1561
-                if (!empty($post->default_category)) {
1562
-                    $post_terms = $post->default_category;
1563
-                } else {
1564
-                    $post_terms = '';
1561
+				if (!empty($post->default_category)) {
1562
+					$post_terms = $post->default_category;
1563
+				} else {
1564
+					$post_terms = '';
1565 1565
 
1566
-                    if (isset($post->$taxonomies)) {
1567
-                        $post_terms = explode(",", trim($post->$taxonomies, ","));
1568
-                        $post_terms = $post_terms[0];
1569
-                    }
1566
+					if (isset($post->$taxonomies)) {
1567
+						$post_terms = explode(",", trim($post->$taxonomies, ","));
1568
+						$post_terms = $post_terms[0];
1569
+					}
1570 1570
 
1571
-                    if (!$post_terms)
1572
-                        $post_terms = geodir_get_post_meta($post->ID, 'default_category', true);
1571
+					if (!$post_terms)
1572
+						$post_terms = geodir_get_post_meta($post->ID, 'default_category', true);
1573 1573
 
1574
-                    if (!$post_terms) {
1575
-                        $post_terms = geodir_get_post_meta($post->ID, $taxonomies, true);
1574
+					if (!$post_terms) {
1575
+						$post_terms = geodir_get_post_meta($post->ID, $taxonomies, true);
1576 1576
 
1577
-                        if ($post_terms) {
1578
-                            $post_terms = explode(",", trim($post_terms, ","));
1579
-                            $post_terms = $post_terms[0];
1580
-                        }
1581
-                    }
1582
-                }
1577
+						if ($post_terms) {
1578
+							$post_terms = explode(",", trim($post_terms, ","));
1579
+							$post_terms = $post_terms[0];
1580
+						}
1581
+					}
1582
+				}
1583 1583
 
1584
-                $term = get_term_by('id', $post_terms, $taxonomies);
1584
+				$term = get_term_by('id', $post_terms, $taxonomies);
1585 1585
 
1586
-                if (!empty($term))
1587
-                    $term_request = $term->slug;
1588
-                //$term_request = $term->slug.'/';
1589
-            }
1586
+				if (!empty($term))
1587
+					$term_request = $term->slug;
1588
+				//$term_request = $term->slug.'/';
1589
+			}
1590 1590
 
1591
-            $request_term = '';
1592
-            $listingurl_separator = '';
1593
-            //$detailurl_separator = get_option('geodir_detailurl_separator');
1594
-            $detailurl_separator = '';
1595
-            if (isset($location_request) && $location_request != '' && isset($term_request) && $term_request != '') {
1596
-                $request_term = $location_request;
1597
-                //$listingurl_separator = get_option('geodir_listingurl_separator');
1598
-                //$request_term .= $listingurl_separator.'/'.$term_request;
1599
-                $request_term .= $term_request;
1591
+			$request_term = '';
1592
+			$listingurl_separator = '';
1593
+			//$detailurl_separator = get_option('geodir_detailurl_separator');
1594
+			$detailurl_separator = '';
1595
+			if (isset($location_request) && $location_request != '' && isset($term_request) && $term_request != '') {
1596
+				$request_term = $location_request;
1597
+				//$listingurl_separator = get_option('geodir_listingurl_separator');
1598
+				//$request_term .= $listingurl_separator.'/'.$term_request;
1599
+				$request_term .= $term_request;
1600 1600
 
1601
-            } else {
1602
-                if (isset($location_request) && $location_request != '') $request_term = $location_request;
1601
+			} else {
1602
+				if (isset($location_request) && $location_request != '') $request_term = $location_request;
1603 1603
 
1604
-                if (isset($term_request) && $term_request != '') $request_term .= $term_request;
1605
-            }
1606
-            $request_term = trim($request_term, '/');
1607
-            if (!empty($request_term))
1608
-                $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1609
-            else
1610
-                $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1611
-            //echo $post_link ;
1612
-        }
1613
-        // temp cache the permalink
1614
-        if (!$sample && (!isset($_REQUEST['geodir_ajax']) || (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] != 'add_listing'))) {
1615
-            $gd_permalink_cache[$post->ID] = $post_link;
1616
-        }
1617
-    }
1618
-    if (isset($orig_post)) {
1619
-        $post = $orig_post;
1620
-    }
1621
-    //echo $post_link ;
1622
-    return $post_link;
1604
+				if (isset($term_request) && $term_request != '') $request_term .= $term_request;
1605
+			}
1606
+			$request_term = trim($request_term, '/');
1607
+			if (!empty($request_term))
1608
+				$post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1609
+			else
1610
+				$post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1611
+			//echo $post_link ;
1612
+		}
1613
+		// temp cache the permalink
1614
+		if (!$sample && (!isset($_REQUEST['geodir_ajax']) || (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] != 'add_listing'))) {
1615
+			$gd_permalink_cache[$post->ID] = $post_link;
1616
+		}
1617
+	}
1618
+	if (isset($orig_post)) {
1619
+		$post = $orig_post;
1620
+	}
1621
+	//echo $post_link ;
1622
+	return $post_link;
1623 1623
 
1624 1624
 }
1625 1625
 
@@ -1636,103 +1636,103 @@  discard block
 block discarded – undo
1636 1636
  * @return string The term link.
1637 1637
  */
1638 1638
 function geodir_term_link($termlink, $term, $taxonomy) {
1639
-    $geodir_taxonomies = geodir_get_taxonomies('', true);
1639
+	$geodir_taxonomies = geodir_get_taxonomies('', true);
1640 1640
 
1641
-    if (isset($taxonomy) && !empty($geodir_taxonomies) && in_array($taxonomy, $geodir_taxonomies)) {
1642
-        global $geodir_add_location_url, $gd_session;
1643
-        $include_location = false;
1644
-        $request_term = array();
1641
+	if (isset($taxonomy) && !empty($geodir_taxonomies) && in_array($taxonomy, $geodir_taxonomies)) {
1642
+		global $geodir_add_location_url, $gd_session;
1643
+		$include_location = false;
1644
+		$request_term = array();
1645 1645
 
1646
-        $listing_slug = geodir_get_listing_slug($taxonomy);
1646
+		$listing_slug = geodir_get_listing_slug($taxonomy);
1647 1647
 
1648
-        if ($geodir_add_location_url != NULL && $geodir_add_location_url != '') {
1649
-            if ($geodir_add_location_url && get_option('geodir_add_location_url')) {
1650
-                $include_location = true;
1651
-            }
1652
-        } elseif (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1)
1653
-            $include_location = true;
1648
+		if ($geodir_add_location_url != NULL && $geodir_add_location_url != '') {
1649
+			if ($geodir_add_location_url && get_option('geodir_add_location_url')) {
1650
+				$include_location = true;
1651
+			}
1652
+		} elseif (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1)
1653
+			$include_location = true;
1654 1654
 
1655
-        if ($include_location) {
1656
-            global $post;
1655
+		if ($include_location) {
1656
+			global $post;
1657 1657
 			
1658 1658
 			$location_manager = defined('POST_LOCATION_TABLE') ? true : false;
1659 1659
 			$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
1660 1660
             
1661 1661
 			if(geodir_is_page('detail') && isset($post->country_slug)){
1662
-                $location_terms = array(
1663
-                    'gd_country' => $post->country_slug,
1664
-                    'gd_region' => $post->region_slug,
1665
-                    'gd_city' => $post->city_slug
1666
-                );
1662
+				$location_terms = array(
1663
+					'gd_country' => $post->country_slug,
1664
+					'gd_region' => $post->region_slug,
1665
+					'gd_city' => $post->city_slug
1666
+				);
1667 1667
 				
1668 1668
 				if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) {
1669 1669
 					$location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood;
1670 1670
 				}
1671
-            } else {
1672
-                $location_terms = geodir_get_current_location_terms('query_vars');
1673
-            }
1671
+			} else {
1672
+				$location_terms = geodir_get_current_location_terms('query_vars');
1673
+			}
1674 1674
 
1675
-            $geodir_show_location_url = get_option('geodir_show_location_url');
1676
-            $location_terms = geodir_remove_location_terms($location_terms);
1675
+			$geodir_show_location_url = get_option('geodir_show_location_url');
1676
+			$location_terms = geodir_remove_location_terms($location_terms);
1677 1677
 
1678
-            if (!empty($location_terms)) {
1678
+			if (!empty($location_terms)) {
1679 1679
 
1680
-                $url_separator = '';//get_option('geodir_listingurl_separator');
1680
+				$url_separator = '';//get_option('geodir_listingurl_separator');
1681 1681
 
1682
-                if (get_option('permalink_structure') != '') {
1683
-                    $old_listing_slug = '/' . $listing_slug . '/';
1684
-                    $request_term = implode("/", $location_terms);
1685
-                    $new_listing_slug = '/' . $listing_slug . '/' . $request_term . '/';
1682
+				if (get_option('permalink_structure') != '') {
1683
+					$old_listing_slug = '/' . $listing_slug . '/';
1684
+					$request_term = implode("/", $location_terms);
1685
+					$new_listing_slug = '/' . $listing_slug . '/' . $request_term . '/';
1686 1686
 
1687
-                    $termlink = substr_replace($termlink, $new_listing_slug, strpos($termlink, $old_listing_slug), strlen($old_listing_slug));
1688
-                } else {
1689
-                    $termlink = geodir_getlink($termlink, $request_term);
1690
-                }
1691
-            }
1692
-        }
1687
+					$termlink = substr_replace($termlink, $new_listing_slug, strpos($termlink, $old_listing_slug), strlen($old_listing_slug));
1688
+				} else {
1689
+					$termlink = geodir_getlink($termlink, $request_term);
1690
+				}
1691
+			}
1692
+		}
1693 1693
 
1694
-        // Alter the CPT slug is WPML is set to do so
1695
-        /* we can replace this with the below function
1694
+		// Alter the CPT slug is WPML is set to do so
1695
+		/* we can replace this with the below function
1696 1696
         if(function_exists('icl_object_id')){
1697 1697
             global $sitepress;
1698 1698
             $post_type = str_replace("category","",$taxonomy);
1699 1699
             $termlink = $sitepress->post_type_archive_link_filter( $termlink, $post_type);
1700 1700
         }*/
1701 1701
 
1702
-        // Alter the CPT slug if WPML is set to do so
1703
-        if(function_exists('icl_object_id')){
1704
-            $post_types = get_option('geodir_post_types');
1705
-            $post_type = str_replace("category","",$taxonomy);
1702
+		// Alter the CPT slug if WPML is set to do so
1703
+		if(function_exists('icl_object_id')){
1704
+			$post_types = get_option('geodir_post_types');
1705
+			$post_type = str_replace("category","",$taxonomy);
1706 1706
 			$post_type = str_replace("_tags","",$post_type);
1707
-            $slug = $post_types[$post_type]['rewrite']['slug'];
1708
-            if ( gd_wpml_slug_translation_turned_on( $post_type )) {
1707
+			$slug = $post_types[$post_type]['rewrite']['slug'];
1708
+			if ( gd_wpml_slug_translation_turned_on( $post_type )) {
1709 1709
 
1710
-                global $sitepress;
1711
-                $default_lang = $sitepress->get_default_language();
1712
-                $language_code = gd_wpml_get_lang_from_url($termlink);
1713
-                if(!$language_code ){$language_code  = $default_lang;}
1710
+				global $sitepress;
1711
+				$default_lang = $sitepress->get_default_language();
1712
+				$language_code = gd_wpml_get_lang_from_url($termlink);
1713
+				if(!$language_code ){$language_code  = $default_lang;}
1714 1714
 
1715
-                $org_slug = $slug;
1716
-                $slug = apply_filters( 'wpml_translate_single_string',
1717
-                    $slug,
1718
-                    'WordPress',
1719
-                    'URL slug: ' . $slug,
1720
-                    $language_code);
1715
+				$org_slug = $slug;
1716
+				$slug = apply_filters( 'wpml_translate_single_string',
1717
+					$slug,
1718
+					'WordPress',
1719
+					'URL slug: ' . $slug,
1720
+					$language_code);
1721 1721
 
1722 1722
 
1723
-                if(!$slug){$slug = $org_slug;}
1723
+				if(!$slug){$slug = $org_slug;}
1724 1724
 
1725
-                $termlink = trailingslashit(
1725
+				$termlink = trailingslashit(
1726 1726
 
1727
-                    preg_replace(  "/" . preg_quote( $org_slug, "/" ) . "/", $slug  ,$termlink, 1 )
1728
-                );
1727
+					preg_replace(  "/" . preg_quote( $org_slug, "/" ) . "/", $slug  ,$termlink, 1 )
1728
+				);
1729 1729
 
1730
-            }
1731
-        }
1730
+			}
1731
+		}
1732 1732
 
1733
-    }
1733
+	}
1734 1734
 	
1735
-    return $termlink;
1735
+	return $termlink;
1736 1736
 }
1737 1737
 
1738 1738
 /**
@@ -1758,14 +1758,14 @@  discard block
 block discarded – undo
1758 1758
 	if (in_array($post_type, geodir_get_posttypes())) {
1759 1759
 		if (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) {
1760 1760
 			if(geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) {
1761
-                $location_terms = array(
1762
-                    'gd_country' => $post->country_slug,
1763
-                    'gd_region' => $post->region_slug,
1764
-                    'gd_city' => $post->city_slug
1765
-                );
1766
-            } else {
1767
-                $location_terms = geodir_get_current_location_terms('query_vars');
1768
-            }
1761
+				$location_terms = array(
1762
+					'gd_country' => $post->country_slug,
1763
+					'gd_region' => $post->region_slug,
1764
+					'gd_city' => $post->city_slug
1765
+				);
1766
+			} else {
1767
+				$location_terms = geodir_get_current_location_terms('query_vars');
1768
+			}
1769 1769
 			
1770 1770
 			$location_terms = geodir_remove_location_terms($location_terms);
1771 1771
 			
@@ -1796,14 +1796,14 @@  discard block
 block discarded – undo
1796 1796
  */
1797 1797
 function get_post_type_singular_label($post_type, $echo = false)
1798 1798
 {
1799
-    $obj_post_type = get_post_type_object($post_type);
1800
-    if (!is_object($obj_post_type)) {
1801
-        return;
1802
-    }
1803
-    if ($echo)
1804
-        echo $obj_post_type->labels->singular_name;
1805
-    else
1806
-        return $obj_post_type->labels->singular_name;
1799
+	$obj_post_type = get_post_type_object($post_type);
1800
+	if (!is_object($obj_post_type)) {
1801
+		return;
1802
+	}
1803
+	if ($echo)
1804
+		echo $obj_post_type->labels->singular_name;
1805
+	else
1806
+		return $obj_post_type->labels->singular_name;
1807 1807
 
1808 1808
 }
1809 1809
 
@@ -1818,16 +1818,16 @@  discard block
 block discarded – undo
1818 1818
  */
1819 1819
 function get_post_type_plural_label($post_type, $echo = false)
1820 1820
 {
1821
-    $all_postypes = geodir_get_posttypes();
1821
+	$all_postypes = geodir_get_posttypes();
1822 1822
 
1823
-    if (!in_array($post_type, $all_postypes))
1824
-        return false;
1823
+	if (!in_array($post_type, $all_postypes))
1824
+		return false;
1825 1825
 
1826
-    $obj_post_type = get_post_type_object($post_type);
1827
-    if ($echo)
1828
-        echo $obj_post_type->labels->name;
1829
-    else
1830
-        return $obj_post_type->labels->name;
1826
+	$obj_post_type = get_post_type_object($post_type);
1827
+	if ($echo)
1828
+		echo $obj_post_type->labels->name;
1829
+	else
1830
+		return $obj_post_type->labels->name;
1831 1831
 
1832 1832
 }
1833 1833
 
@@ -1846,51 +1846,51 @@  discard block
 block discarded – undo
1846 1846
  */
1847 1847
 function geodir_term_exists($term, $taxonomy = '', $parent = 0)
1848 1848
 {
1849
-    global $wpdb;
1850
-
1851
-    $select = "SELECT term_id FROM $wpdb->terms as t WHERE ";
1852
-    $tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE ";
1853
-
1854
-    if (is_int($term)) {
1855
-        if (0 == $term)
1856
-            return 0;
1857
-        $where = 't.term_id = %d';
1858
-        if (!empty($taxonomy))
1859
-            return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1860
-        else
1861
-            return $wpdb->get_var($wpdb->prepare($select . $where, $term));
1862
-    }
1849
+	global $wpdb;
1850
+
1851
+	$select = "SELECT term_id FROM $wpdb->terms as t WHERE ";
1852
+	$tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE ";
1853
+
1854
+	if (is_int($term)) {
1855
+		if (0 == $term)
1856
+			return 0;
1857
+		$where = 't.term_id = %d';
1858
+		if (!empty($taxonomy))
1859
+			return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1860
+		else
1861
+			return $wpdb->get_var($wpdb->prepare($select . $where, $term));
1862
+	}
1863 1863
 
1864
-    $term = trim(wp_unslash($term));
1864
+	$term = trim(wp_unslash($term));
1865 1865
 
1866
-    if ('' === $slug = sanitize_title($term))
1867
-        return 0;
1866
+	if ('' === $slug = sanitize_title($term))
1867
+		return 0;
1868 1868
 
1869
-    $where = 't.slug = %s';
1869
+	$where = 't.slug = %s';
1870 1870
 
1871
-    $where_fields = array($slug);
1872
-    if (!empty($taxonomy)) {
1873
-        $parent = (int)$parent;
1874
-        if ($parent > 0) {
1875
-            $where_fields[] = $parent;
1876
-            $else_where_fields[] = $parent;
1877
-            $where .= ' AND tt.parent = %d';
1871
+	$where_fields = array($slug);
1872
+	if (!empty($taxonomy)) {
1873
+		$parent = (int)$parent;
1874
+		if ($parent > 0) {
1875
+			$where_fields[] = $parent;
1876
+			$else_where_fields[] = $parent;
1877
+			$where .= ' AND tt.parent = %d';
1878 1878
 
1879
-        }
1879
+		}
1880 1880
 
1881
-        $where_fields[] = $taxonomy;
1881
+		$where_fields[] = $taxonomy;
1882 1882
 
1883 1883
 
1884
-        if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A))
1885
-            return $result;
1884
+		if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A))
1885
+			return $result;
1886 1886
 
1887
-        return false;
1888
-    }
1887
+		return false;
1888
+	}
1889 1889
 
1890
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields)))
1891
-        return $result;
1890
+	if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields)))
1891
+		return $result;
1892 1892
 
1893
-    return false;
1893
+	return false;
1894 1894
 }
1895 1895
 
1896 1896
 /**
@@ -1902,7 +1902,7 @@  discard block
 block discarded – undo
1902 1902
 function geodir_get_term_icon_rebuild()
1903 1903
 {
1904 1904
 
1905
-    update_option('gd_term_icons', '');
1905
+	update_option('gd_term_icons', '');
1906 1906
 
1907 1907
 }
1908 1908
 
@@ -1920,60 +1920,60 @@  discard block
 block discarded – undo
1920 1920
  */
1921 1921
 function geodir_get_term_icon($term_id = false, $rebuild = false)
1922 1922
 {
1923
-    global $wpdb;
1924
-    if (!$rebuild) {
1925
-        $terms_icons = get_option('gd_term_icons');
1926
-    } else {
1927
-        $terms_icons = '';
1928
-    }
1929
-
1930
-    if (empty($terms_icons)) {
1931
-        $default_icon_url = get_option('geodir_default_marker_icon');
1932
-        $taxonomy = geodir_get_taxonomies();
1933
-        $post_types = geodir_get_posttypes();
1934
-        $tax_arr = array();
1935
-        foreach ($post_types as $post_type) {
1936
-            $tax_arr[] = "'" . $post_type . "category'";
1937
-        }
1938
-        $tax_c = implode(',', $tax_arr);
1939
-        $terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)");
1940
-        //$terms = get_terms( $taxonomy );
1941
-
1942
-        if($terms) {
1943
-            foreach ($terms as $term) {
1944
-                $post_type = str_replace("category", "", $term->taxonomy);
1945
-                $a_terms[$post_type][] = $term;
1923
+	global $wpdb;
1924
+	if (!$rebuild) {
1925
+		$terms_icons = get_option('gd_term_icons');
1926
+	} else {
1927
+		$terms_icons = '';
1928
+	}
1946 1929
 
1947
-            }
1948
-        }
1930
+	if (empty($terms_icons)) {
1931
+		$default_icon_url = get_option('geodir_default_marker_icon');
1932
+		$taxonomy = geodir_get_taxonomies();
1933
+		$post_types = geodir_get_posttypes();
1934
+		$tax_arr = array();
1935
+		foreach ($post_types as $post_type) {
1936
+			$tax_arr[] = "'" . $post_type . "category'";
1937
+		}
1938
+		$tax_c = implode(',', $tax_arr);
1939
+		$terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)");
1940
+		//$terms = get_terms( $taxonomy );
1949 1941
 
1950
-        if($a_terms) {
1951
-            foreach ($a_terms as $pt => $t2) {
1942
+		if($terms) {
1943
+			foreach ($terms as $term) {
1944
+				$post_type = str_replace("category", "", $term->taxonomy);
1945
+				$a_terms[$post_type][] = $term;
1952 1946
 
1953
-                foreach ($t2 as $term) {
1954
-                    $term_icon = get_tax_meta($term->term_id, 'ct_cat_icon', false, $pt);
1955
-                    if ($term_icon) {
1956
-                        $term_icon_url = $term_icon["src"];
1957
-                    } else {
1958
-                        $term_icon_url = $default_icon_url;
1959
-                    }
1960
-                    $terms_icons[$term->term_id] = $term_icon_url;
1961
-                }
1962
-            }
1963
-        }
1947
+			}
1948
+		}
1964 1949
 
1965
-        update_option('gd_term_icons', $terms_icons);
1966
-    }
1950
+		if($a_terms) {
1951
+			foreach ($a_terms as $pt => $t2) {
1967 1952
 
1968
-    if ($term_id && isset($terms_icons[$term_id])) {
1969
-        return $terms_icons[$term_id];
1970
-    } elseif ($term_id && !isset($terms_icons[$term_id])) {
1971
-        return get_option('geodir_default_marker_icon');
1972
-    }
1953
+				foreach ($t2 as $term) {
1954
+					$term_icon = get_tax_meta($term->term_id, 'ct_cat_icon', false, $pt);
1955
+					if ($term_icon) {
1956
+						$term_icon_url = $term_icon["src"];
1957
+					} else {
1958
+						$term_icon_url = $default_icon_url;
1959
+					}
1960
+					$terms_icons[$term->term_id] = $term_icon_url;
1961
+				}
1962
+			}
1963
+		}
1964
+
1965
+		update_option('gd_term_icons', $terms_icons);
1966
+	}
1973 1967
 
1974
-    if (is_ssl()) {
1975
-        $terms_icons = str_replace("http:","https:",$terms_icons );
1976
-    }
1968
+	if ($term_id && isset($terms_icons[$term_id])) {
1969
+		return $terms_icons[$term_id];
1970
+	} elseif ($term_id && !isset($terms_icons[$term_id])) {
1971
+		return get_option('geodir_default_marker_icon');
1972
+	}
1973
+
1974
+	if (is_ssl()) {
1975
+		$terms_icons = str_replace("http:","https:",$terms_icons );
1976
+	}
1977 1977
 
1978
-    return $terms_icons;
1978
+	return $terms_icons;
1979 1979
 }
1980 1980
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +170 added lines, -121 removed lines patch added patch discarded remove patch
@@ -39,8 +39,9 @@  discard block
 block discarded – undo
39 39
     if (get_option('geodir_show_listing_nav')) {
40 40
 
41 41
         $menu_class = '';
42
-        if (geodir_is_page('listing'))
43
-            $menu_class = 'current-menu-item';
42
+        if (geodir_is_page('listing')) {
43
+                    $menu_class = 'current-menu-item';
44
+        }
44 45
 
45 46
 
46 47
         //SHOW LISTING OF POST TYPE IN MAIN NAVIGATION
@@ -52,8 +53,9 @@  discard block
 block discarded – undo
52 53
                     if (in_array($post_type, $show_post_type_main_nav)) {
53 54
                         if (get_post_type_archive_link($post_type)) {
54 55
                             $menu_class = '';
55
-                            if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
56
-                                $menu_class = 'current-menu-item';
56
+                            if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) {
57
+                                                            $menu_class = 'current-menu-item';
58
+                            }
57 59
                             /**
58 60
                              * Filter the menu li class.
59 61
                              *
@@ -130,8 +132,9 @@  discard block
 block discarded – undo
130 132
                             if (get_post_type_archive_link($post_type)) {
131 133
 
132 134
                                 $menu_class = '';
133
-                                if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
134
-                                    $menu_class = 'current-menu-item';
135
+                                if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) {
136
+                                                                    $menu_class = 'current-menu-item';
137
+                                }
135 138
 
136 139
                                 $items .= '<li class="' . $sub_li_class . '">
137 140
 														<a href="' . get_post_type_archive_link($post_type) . '" class="' . $sub_a_class . '">
@@ -153,8 +156,9 @@  discard block
 block discarded – undo
153 156
     if (get_option('geodir_show_addlisting_nav')) {
154 157
 
155 158
         $menu_class = '';
156
-        if (geodir_is_page('add-listing'))
157
-            $menu_class = 'current-menu-item';
159
+        if (geodir_is_page('add-listing')) {
160
+                    $menu_class = 'current-menu-item';
161
+        }
158 162
 
159 163
         //SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION
160 164
         $post_types = geodir_get_posttypes('object');
@@ -170,8 +174,9 @@  discard block
 block discarded – undo
170 174
                                 if (geodir_get_addlisting_link($post_type)) {
171 175
 
172 176
                                     $menu_class = '';
173
-                                    if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
174
-                                        $menu_class = 'current-menu-item';
177
+                                    if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) {
178
+                                                                            $menu_class = 'current-menu-item';
179
+                                    }
175 180
                                     /**
176 181
                                      * Filter the menu li class.
177 182
                                      *
@@ -255,8 +260,9 @@  discard block
 block discarded – undo
255 260
                                     if (geodir_get_addlisting_link($post_type)) {
256 261
 
257 262
                                         $menu_class = '';
258
-                                        if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
259
-                                            $menu_class = 'current-menu-item';
263
+                                        if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) {
264
+                                                                                    $menu_class = 'current-menu-item';
265
+                                        }
260 266
                                         /**
261 267
                                          * Filter the menu li class.
262 268
                                          *
@@ -311,8 +317,9 @@  discard block
 block discarded – undo
311 317
     }
312 318
     //else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet.
313 319
 //		$menu = str_replace("</ul></div>",geodir_add_nav_menu_items()."</ul></div>",$menu);
314
-    else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location))
315
-        $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
320
+    else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location)) {
321
+            $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
322
+    }
316 323
 
317 324
     return $menu;
318 325
 
@@ -398,24 +405,28 @@  discard block
 block discarded – undo
398 405
     $geodir_post_type = get_query_var('post_type');
399 406
 
400 407
     if (geodir_is_page('add-listing') || geodir_is_page('preview')) {
401
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
402
-            $geodir_post_type = get_post_type((int)$_REQUEST['pid']);
403
-        elseif (isset($_REQUEST['listing_type']))
404
-            $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']);
408
+        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
409
+                    $geodir_post_type = get_post_type((int)$_REQUEST['pid']);
410
+        } elseif (isset($_REQUEST['listing_type'])) {
411
+                    $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']);
412
+        }
405 413
     }
406 414
 
407
-    if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype']))
408
-        $geodir_post_type = sanitize_text_field($_REQUEST['stype']);
415
+    if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype'])) {
416
+            $geodir_post_type = sanitize_text_field($_REQUEST['stype']);
417
+    }
409 418
 
410
-    if (is_tax())
411
-        $geodir_post_type = geodir_get_taxonomy_posttype();
419
+    if (is_tax()) {
420
+            $geodir_post_type = geodir_get_taxonomy_posttype();
421
+    }
412 422
 
413 423
 
414 424
     $all_postypes = geodir_get_posttypes();
415 425
     $all_postypes = stripslashes_deep($all_postypes);
416 426
 
417
-    if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes))
418
-        $geodir_post_type = '';
427
+    if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes)) {
428
+            $geodir_post_type = '';
429
+    }
419 430
 
420 431
 
421 432
     return $geodir_post_type;
@@ -462,11 +473,12 @@  discard block
 block discarded – undo
462 473
         endswitch;
463 474
     }
464 475
 
465
-    if (!empty($post_types))
466
-        return $post_types;
467
-    else
468
-        return array();
469
-}
476
+    if (!empty($post_types)) {
477
+            return $post_types;
478
+    } else {
479
+            return array();
480
+    }
481
+    }
470 482
 
471 483
 /**
472 484
  * Get Custom Post Type info.
@@ -483,9 +495,10 @@  discard block
 block discarded – undo
483 495
     $post_types = stripslashes_deep($post_types);
484 496
     if (!empty($post_types) && $post_type != '') {
485 497
         return $post_types[$post_type];
486
-    } else
487
-        return false;
488
-}
498
+    } else {
499
+            return false;
500
+    }
501
+    }
489 502
 
490 503
 if (!function_exists('geodir_get_taxonomies')) {
491 504
     /**
@@ -509,18 +522,21 @@  discard block
 block discarded – undo
509 522
             $gd_taxonomies = array_keys($taxonomies);
510 523
 
511 524
 
512
-            if ($post_type != '')
513
-                $gd_taxonomies = array();
525
+            if ($post_type != '') {
526
+                            $gd_taxonomies = array();
527
+            }
514 528
 
515 529
             $i = 0;
516 530
             foreach ($taxonomies as $taxonomy => $args) {
517 531
 
518
-                if ($post_type != '' && $args['object_type'] == $post_type)
519
-                    $gd_taxonomies[] = $taxonomy;
532
+                if ($post_type != '' && $args['object_type'] == $post_type) {
533
+                                    $gd_taxonomies[] = $taxonomy;
534
+                }
520 535
 
521 536
                 if ($tages_taxonomies === false && strpos($taxonomy, '_tag') !== false) {
522
-                    if (array_search($taxonomy, $gd_taxonomies) !== false)
523
-                        unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]);
537
+                    if (array_search($taxonomy, $gd_taxonomies) !== false) {
538
+                                            unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]);
539
+                    }
524 540
                 }
525 541
 
526 542
             }
@@ -575,10 +591,11 @@  discard block
 block discarded – undo
575 591
                 . ucfirst($category_obj->name) . '</option>';
576 592
         }
577 593
 
578
-        if ($echo)
579
-            echo $html;
580
-        else
581
-            return $html;
594
+        if ($echo) {
595
+                    echo $html;
596
+        } else {
597
+                    return $html;
598
+        }
582 599
     }
583 600
 }
584 601
 
@@ -612,11 +629,12 @@  discard block
 block discarded – undo
612 629
 
613 630
     }
614 631
 
615
-    if (!empty($listing_slug))
616
-        return $listing_slug;
617
-    else
618
-        return false;
619
-}
632
+    if (!empty($listing_slug)) {
633
+            return $listing_slug;
634
+    } else {
635
+            return false;
636
+    }
637
+    }
620 638
 
621 639
 
622 640
 /**
@@ -647,16 +665,18 @@  discard block
 block discarded – undo
647 665
     if (!empty($taxonomies)) {
648 666
         foreach (geodir_get_posttypes() as $pt) {
649 667
             $object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt);
650
-            if (array_intersect($taxonomies, $object_taxonomies))
651
-                $post_type[] = $pt;
668
+            if (array_intersect($taxonomies, $object_taxonomies)) {
669
+                            $post_type[] = $pt;
670
+            }
652 671
         }
653 672
     }
654 673
 
655
-    if (!empty($post_type))
656
-        return $post_type[0];
657
-    else
658
-        return false;
659
-}
674
+    if (!empty($post_type)) {
675
+            return $post_type[0];
676
+    } else {
677
+            return false;
678
+    }
679
+    }
660 680
 
661 681
 if (!function_exists('geodir_custom_taxonomy_walker')) {
662 682
     /**
@@ -712,18 +732,18 @@  discard block
 block discarded – undo
712 732
                 $checked = '';
713 733
 
714 734
                 if (in_array($cat_term->term_id, $search_terms)) {
715
-                    if ($cat_display == 'select' || $cat_display == 'multiselect')
716
-                        $checked = 'selected="selected"';
717
-                    else
718
-                        $checked = 'checked="checked"';
735
+                    if ($cat_display == 'select' || $cat_display == 'multiselect') {
736
+                                            $checked = 'selected="selected"';
737
+                    } else {
738
+                                            $checked = 'checked="checked"';
739
+                    }
719 740
                 }
720 741
 
721
-                if ($cat_display == 'radio')
722
-                    $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
723
-                elseif ($cat_display == 'select' || $cat_display == 'multiselect')
724
-                    $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . ucfirst($cat_term->name) . '</option>';
725
-
726
-                else {
742
+                if ($cat_display == 'radio') {
743
+                                    $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
744
+                } elseif ($cat_display == 'select' || $cat_display == 'multiselect') {
745
+                                    $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . ucfirst($cat_term->name) . '</option>';
746
+                } else {
727 747
                     $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
728 748
                 }
729 749
 
@@ -732,8 +752,9 @@  discard block
 block discarded – undo
732 752
 
733 753
             }
734 754
 
735
-            if ($cat_display == 'checkbox' || $cat_display == 'radio')
736
-                $out .= '</div>';
755
+            if ($cat_display == 'checkbox' || $cat_display == 'radio') {
756
+                            $out .= '</div>';
757
+            }
737 758
 
738 759
             return $out;
739 760
         }
@@ -759,18 +780,21 @@  discard block
 block discarded – undo
759 780
         global $exclude_cats, $gd_session;
760 781
 
761 782
         $cat_exclude = '';
762
-        if (is_array($exclude_cats) && !empty($exclude_cats))
763
-            $cat_exclude = serialize($exclude_cats);
783
+        if (is_array($exclude_cats) && !empty($exclude_cats)) {
784
+                    $cat_exclude = serialize($exclude_cats);
785
+        }
764 786
 
765 787
         if (isset($_REQUEST['backandedit'])) {
766 788
             $post = (object)$gd_session->get('listing');
767 789
 
768
-            if (!is_array($post->post_category[$cat_taxonomy]))
769
-                $post_category = $post->post_category[$cat_taxonomy];
790
+            if (!is_array($post->post_category[$cat_taxonomy])) {
791
+                            $post_category = $post->post_category[$cat_taxonomy];
792
+            }
770 793
 
771 794
             $post_categories = $post->post_category_str;
772
-            if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories))
773
-                $post_category_str = $post_categories[$cat_taxonomy];
795
+            if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
796
+                            $post_category_str = $post_categories[$cat_taxonomy];
797
+            }
774 798
 
775 799
         } elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) {
776 800
             global $post;
@@ -961,8 +985,9 @@  discard block
 block discarded – undo
961 985
         if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
962 986
             $post_cat_str = $post_categories[$cat_taxonomy];
963 987
             $post_cat_array = explode("#", $post_cat_str);
964
-            if (count($post_cat_array) >= $cat_limit && $cat_limit != 0)
965
-                $style = "display:none;";
988
+            if (count($post_cat_array) >= $cat_limit && $cat_limit != 0) {
989
+                            $style = "display:none;";
990
+            }
966 991
         }
967 992
         ?>
968 993
         <div class="main_cat_list" style=" <?php if (isset($style)) {
@@ -997,7 +1022,7 @@  discard block
 block discarded – undo
997 1022
         print_r($exclude_cats);
998 1023
         if(is_array( $exclude_cats)){
999 1024
             $exclude_cats = array_map( 'intval', $exclude_cats );
1000
-        }else{
1025
+        } else{
1001 1026
             $exclude_cats = intval($exclude_cats);
1002 1027
         }
1003 1028
 
@@ -1027,7 +1052,10 @@  discard block
 block discarded – undo
1027 1052
 
1028 1053
             <div class="post_default_category">
1029 1054
                 <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id;?>"
1030
-                       onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" ';?>   />
1055
+                       onchange="update_listing_cat()" <?php if ($default) {
1056
+	echo ' checked="checked" ';
1057
+}
1058
+?>   />
1031 1059
         <span> 
1032 1060
         <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name));?>
1033 1061
         </span>
@@ -1127,8 +1155,9 @@  discard block
 block discarded – undo
1127 1155
         $onchange = ' onchange="show_subcatlist(this.value, this)" ';
1128 1156
 
1129 1157
         $option_selected = '';
1130
-        if (!$selected)
1131
-            $option_slected = ' selected="selected" ';
1158
+        if (!$selected) {
1159
+                    $option_slected = ' selected="selected" ';
1160
+        }
1132 1161
 
1133 1162
         echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >';
1134 1163
 
@@ -1136,8 +1165,9 @@  discard block
 block discarded – undo
1136 1165
 
1137 1166
         foreach ($cat_terms as $cat_term) {
1138 1167
             $option_selected = '';
1139
-            if ($selected == $cat_term->term_id)
1140
-                $option_selected = ' selected="selected" ';
1168
+            if ($selected == $cat_term->term_id) {
1169
+                            $option_selected = ' selected="selected" ';
1170
+            }
1141 1171
 
1142 1172
             // Count child terms
1143 1173
             $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) );
@@ -1202,8 +1232,9 @@  discard block
 block discarded – undo
1202 1232
 
1203 1233
     $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico';
1204 1234
 
1205
-    if (!$listing_slug = get_option('geodir_listing_prefix'))
1206
-        $listing_slug = 'places';
1235
+    if (!$listing_slug = get_option('geodir_listing_prefix')) {
1236
+            $listing_slug = 'places';
1237
+    }
1207 1238
 
1208 1239
     /**
1209 1240
      * Taxonomies
@@ -1351,7 +1382,7 @@  discard block
 block discarded – undo
1351 1382
     //print_r( $segments);
1352 1383
     if($gd_wpml_get_languages){
1353 1384
         $langs = $gd_wpml_get_languages;
1354
-    }else{
1385
+    } else{
1355 1386
         global $sitepress;
1356 1387
         $gd_wpml_get_languages = $sitepress->get_active_languages();
1357 1388
     }
@@ -1494,8 +1525,9 @@  discard block
 block discarded – undo
1494 1525
                             'city_slug' => $post->city_slug
1495 1526
                         );
1496 1527
 
1497
-                    } else
1498
-                        $post_location = geodir_get_location();
1528
+                    } else {
1529
+                                            $post_location = geodir_get_location();
1530
+                    }
1499 1531
 
1500 1532
 
1501 1533
                 } else {
@@ -1524,8 +1556,9 @@  discard block
 block discarded – undo
1524 1556
                             );
1525 1557
 
1526 1558
                         }
1527
-                    } else
1528
-                        $post_location = geodir_get_location();
1559
+                    } else {
1560
+                                            $post_location = geodir_get_location();
1561
+                    }
1529 1562
                 }
1530 1563
 
1531 1564
 
@@ -1568,8 +1601,9 @@  discard block
 block discarded – undo
1568 1601
                         $post_terms = $post_terms[0];
1569 1602
                     }
1570 1603
 
1571
-                    if (!$post_terms)
1572
-                        $post_terms = geodir_get_post_meta($post->ID, 'default_category', true);
1604
+                    if (!$post_terms) {
1605
+                                            $post_terms = geodir_get_post_meta($post->ID, 'default_category', true);
1606
+                    }
1573 1607
 
1574 1608
                     if (!$post_terms) {
1575 1609
                         $post_terms = geodir_get_post_meta($post->ID, $taxonomies, true);
@@ -1583,8 +1617,9 @@  discard block
 block discarded – undo
1583 1617
 
1584 1618
                 $term = get_term_by('id', $post_terms, $taxonomies);
1585 1619
 
1586
-                if (!empty($term))
1587
-                    $term_request = $term->slug;
1620
+                if (!empty($term)) {
1621
+                                    $term_request = $term->slug;
1622
+                }
1588 1623
                 //$term_request = $term->slug.'/';
1589 1624
             }
1590 1625
 
@@ -1599,15 +1634,20 @@  discard block
 block discarded – undo
1599 1634
                 $request_term .= $term_request;
1600 1635
 
1601 1636
             } else {
1602
-                if (isset($location_request) && $location_request != '') $request_term = $location_request;
1637
+                if (isset($location_request) && $location_request != '') {
1638
+                	$request_term = $location_request;
1639
+                }
1603 1640
 
1604
-                if (isset($term_request) && $term_request != '') $request_term .= $term_request;
1641
+                if (isset($term_request) && $term_request != '') {
1642
+                	$request_term .= $term_request;
1643
+                }
1605 1644
             }
1606 1645
             $request_term = trim($request_term, '/');
1607
-            if (!empty($request_term))
1608
-                $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1609
-            else
1610
-                $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1646
+            if (!empty($request_term)) {
1647
+                            $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1648
+            } else {
1649
+                            $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1650
+            }
1611 1651
             //echo $post_link ;
1612 1652
         }
1613 1653
         // temp cache the permalink
@@ -1649,8 +1689,9 @@  discard block
 block discarded – undo
1649 1689
             if ($geodir_add_location_url && get_option('geodir_add_location_url')) {
1650 1690
                 $include_location = true;
1651 1691
             }
1652
-        } elseif (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1)
1653
-            $include_location = true;
1692
+        } elseif (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) {
1693
+                    $include_location = true;
1694
+        }
1654 1695
 
1655 1696
         if ($include_location) {
1656 1697
             global $post;
@@ -1800,10 +1841,11 @@  discard block
 block discarded – undo
1800 1841
     if (!is_object($obj_post_type)) {
1801 1842
         return;
1802 1843
     }
1803
-    if ($echo)
1804
-        echo $obj_post_type->labels->singular_name;
1805
-    else
1806
-        return $obj_post_type->labels->singular_name;
1844
+    if ($echo) {
1845
+            echo $obj_post_type->labels->singular_name;
1846
+    } else {
1847
+            return $obj_post_type->labels->singular_name;
1848
+    }
1807 1849
 
1808 1850
 }
1809 1851
 
@@ -1820,14 +1862,16 @@  discard block
 block discarded – undo
1820 1862
 {
1821 1863
     $all_postypes = geodir_get_posttypes();
1822 1864
 
1823
-    if (!in_array($post_type, $all_postypes))
1824
-        return false;
1865
+    if (!in_array($post_type, $all_postypes)) {
1866
+            return false;
1867
+    }
1825 1868
 
1826 1869
     $obj_post_type = get_post_type_object($post_type);
1827
-    if ($echo)
1828
-        echo $obj_post_type->labels->name;
1829
-    else
1830
-        return $obj_post_type->labels->name;
1870
+    if ($echo) {
1871
+            echo $obj_post_type->labels->name;
1872
+    } else {
1873
+            return $obj_post_type->labels->name;
1874
+    }
1831 1875
 
1832 1876
 }
1833 1877
 
@@ -1852,19 +1896,22 @@  discard block
 block discarded – undo
1852 1896
     $tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE ";
1853 1897
 
1854 1898
     if (is_int($term)) {
1855
-        if (0 == $term)
1856
-            return 0;
1899
+        if (0 == $term) {
1900
+                    return 0;
1901
+        }
1857 1902
         $where = 't.term_id = %d';
1858
-        if (!empty($taxonomy))
1859
-            return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1860
-        else
1861
-            return $wpdb->get_var($wpdb->prepare($select . $where, $term));
1903
+        if (!empty($taxonomy)) {
1904
+                    return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1905
+        } else {
1906
+                    return $wpdb->get_var($wpdb->prepare($select . $where, $term));
1907
+        }
1862 1908
     }
1863 1909
 
1864 1910
     $term = trim(wp_unslash($term));
1865 1911
 
1866
-    if ('' === $slug = sanitize_title($term))
1867
-        return 0;
1912
+    if ('' === $slug = sanitize_title($term)) {
1913
+            return 0;
1914
+    }
1868 1915
 
1869 1916
     $where = 't.slug = %s';
1870 1917
 
@@ -1881,14 +1928,16 @@  discard block
 block discarded – undo
1881 1928
         $where_fields[] = $taxonomy;
1882 1929
 
1883 1930
 
1884
-        if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A))
1885
-            return $result;
1931
+        if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A)) {
1932
+                    return $result;
1933
+        }
1886 1934
 
1887 1935
         return false;
1888 1936
     }
1889 1937
 
1890
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields)))
1891
-        return $result;
1938
+    if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields))) {
1939
+            return $result;
1940
+    }
1892 1941
 
1893 1942
     return false;
1894 1943
 }
Please login to merge, or discard this patch.