Test Failed
Push — master ( dc11f8...b6268a )
by Stiofan
54s
created
geodirectory-widgets/listing_map_widget.php 3 patches
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,29 +59,29 @@  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
-        $json_content = substr(implode(',', $cat_content_info), 1);
74
-        $json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016
75
-        $json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08
76
-        $list_json = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']';
77
-    } else {
78
-        $list_json = '[{"totalcount":"0"}]';
79
-    }
72
+	if (!empty($cat_content_info)) {
73
+		$json_content = substr(implode(',', $cat_content_info), 1);
74
+		$json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016
75
+		$json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08
76
+		$list_json = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']';
77
+	} else {
78
+		$list_json = '[{"totalcount":"0"}]';
79
+	}
80 80
 
81
-    $listing_map_args = array('list_json' => $list_json);
81
+	$listing_map_args = array('list_json' => $list_json);
82 82
 
83
-    // Pass the json data in listing map script
84
-    wp_localize_script('geodir-listing-map-widget', 'listing_map_args', $listing_map_args);
83
+	// Pass the json data in listing map script
84
+	wp_localize_script('geodir-listing-map-widget', 'listing_map_args', $listing_map_args);
85 85
 
86 86
 }
87 87
 
@@ -93,110 +93,110 @@  discard block
 block discarded – undo
93 93
 class geodir_map_listingpage extends WP_Widget
94 94
 {
95 95
 
96
-    /**
96
+	/**
97 97
 	 * Register the listing page map widget.
98 98
 	 *
99 99
 	 * @since 1.0.0
100
-     * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
100
+	 * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
101 101
 	 */
102
-    public function __construct() {
103
-        $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'));
104
-        parent::__construct(
105
-            'geodir_map_v3_listing_map', // Base ID
106
-            __('GD > GMap - Listing page', 'geodirectory'), // Name
107
-            $widget_ops// Args
108
-        );
102
+	public function __construct() {
103
+		$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'));
104
+		parent::__construct(
105
+			'geodir_map_v3_listing_map', // Base ID
106
+			__('GD > GMap - Listing page', 'geodirectory'), // Name
107
+			$widget_ops// Args
108
+		);
109 109
 
110
-        add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array
110
+		add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array
111 111
 
112
-        add_action('the_post', 'create_list_jsondata'); // Add marker in json array
112
+		add_action('the_post', 'create_list_jsondata'); // Add marker in json array
113 113
 
114
-        add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers
115
-    }
114
+		add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers
115
+	}
116 116
 
117 117
 	/**
118 118
 	 * Front-end display content for listing page map widget.
119 119
 	 *
120 120
 	 * @since 1.0.0
121
-     * @since 1.5.1 Declare function public.
121
+	 * @since 1.5.1 Declare function public.
122
+	 *
123
+	 * @global object $post The current post object.
122 124
 	 *
123
-     * @global object $post The current post object.
124
-     *
125 125
 	 * @param array $args     Widget arguments.
126 126
 	 * @param array $instance Saved values from database.
127 127
 	 */
128
-    public function widget($args, $instance)
129
-    {
130
-
131
-        if (geodir_is_page('listing') || geodir_is_page('author') || geodir_is_page('search')
132
-            || geodir_is_page('detail')
133
-        ) :
134
-
135
-            extract($args, EXTR_SKIP);
136
-            /** This action is documented in geodirectory_shortcodes.php */
137
-            $width = empty($instance['width']) ? '294' : apply_filters('widget_width', $instance['width']);
138
-            /** This action is documented in geodirectory_shortcodes.php */
139
-            $height = empty($instance['heigh']) ? '370' : apply_filters('widget_heigh', $instance['heigh']);
140
-            /** This action is documented in geodirectory_shortcodes.php */
141
-            $maptype = empty($instance['maptype']) ? 'ROADMAP' : apply_filters('widget_maptype', $instance['maptype']);
142
-            /** This action is documented in geodirectory_shortcodes.php */
143
-            $zoom = empty($instance['zoom']) ? '13' : apply_filters('widget_zoom', $instance['zoom']);
144
-            /** This action is documented in geodirectory_shortcodes.php */
145
-            $autozoom = empty($instance['autozoom']) ? '' : apply_filters('widget_autozoom', $instance['autozoom']);
146
-            /**
147
-             * Filter the listing map value widget_sticky, to set if the map should be sticky or not (scroll with page).
148
-             *
149
-             * @since 1.0.0
150
-             * @param bool $sticky True if should be sticky, false if not
151
-             */
152
-            $sticky = empty($instance['sticky']) ? '' : apply_filters('widget_sticky', $instance['sticky']);
153
-            /** This action is documented in geodirectory_shortcodes.php */
154
-            $scrollwheel = empty($instance['scrollwheel']) ? '0' : apply_filters('widget_scrollwheel', $instance['scrollwheel']);
155
-            $showall = empty($instance['showall']) ? '0' : apply_filters('widget_showall', $instance['showall']);
128
+	public function widget($args, $instance)
129
+	{
130
+
131
+		if (geodir_is_page('listing') || geodir_is_page('author') || geodir_is_page('search')
132
+			|| geodir_is_page('detail')
133
+		) :
134
+
135
+			extract($args, EXTR_SKIP);
136
+			/** This action is documented in geodirectory_shortcodes.php */
137
+			$width = empty($instance['width']) ? '294' : apply_filters('widget_width', $instance['width']);
138
+			/** This action is documented in geodirectory_shortcodes.php */
139
+			$height = empty($instance['heigh']) ? '370' : apply_filters('widget_heigh', $instance['heigh']);
140
+			/** This action is documented in geodirectory_shortcodes.php */
141
+			$maptype = empty($instance['maptype']) ? 'ROADMAP' : apply_filters('widget_maptype', $instance['maptype']);
142
+			/** This action is documented in geodirectory_shortcodes.php */
143
+			$zoom = empty($instance['zoom']) ? '13' : apply_filters('widget_zoom', $instance['zoom']);
144
+			/** This action is documented in geodirectory_shortcodes.php */
145
+			$autozoom = empty($instance['autozoom']) ? '' : apply_filters('widget_autozoom', $instance['autozoom']);
146
+			/**
147
+			 * Filter the listing map value widget_sticky, to set if the map should be sticky or not (scroll with page).
148
+			 *
149
+			 * @since 1.0.0
150
+			 * @param bool $sticky True if should be sticky, false if not
151
+			 */
152
+			$sticky = empty($instance['sticky']) ? '' : apply_filters('widget_sticky', $instance['sticky']);
153
+			/** This action is documented in geodirectory_shortcodes.php */
154
+			$scrollwheel = empty($instance['scrollwheel']) ? '0' : apply_filters('widget_scrollwheel', $instance['scrollwheel']);
155
+			$showall = empty($instance['showall']) ? '0' : apply_filters('widget_showall', $instance['showall']);
156 156
 			
157 157
 			/**
158
-             * Filter the listing map should to be displayed or not.
159
-             *
160
-             * @since 1.4.6
158
+			 * Filter the listing map should to be displayed or not.
161 159
 			 *
162
-             * @param bool $display true if map should be displayed, false if not.
163
-             */
160
+			 * @since 1.4.6
161
+			 *
162
+			 * @param bool $display true if map should be displayed, false if not.
163
+			 */
164 164
 			$show_map = apply_filters( 'geodir_show_map_listing', $display = true );
165 165
 			if ( !$show_map ) {
166 166
 				return;
167 167
 			}
168 168
 
169
-            $map_args = array();
170
-            $map_args['map_canvas_name'] = str_replace('-', '_', $args['widget_id']);
171
-            $map_args['width'] = $width;
172
-            $map_args['height'] = $height;
173
-
174
-            $map_args['scrollwheel'] = $scrollwheel;
175
-            $map_args['showall'] = $showall;
176
-            $map_args['child_collapse'] = '0';
177
-            $map_args['sticky'] = $sticky;
178
-            $map_args['enable_cat_filters'] = false;
179
-            $map_args['enable_text_search'] = false;
180
-            $map_args['enable_post_type_filters'] = false;
181
-            $map_args['enable_location_filters'] = false;
182
-            $map_args['enable_jason_on_load'] = true;
169
+			$map_args = array();
170
+			$map_args['map_canvas_name'] = str_replace('-', '_', $args['widget_id']);
171
+			$map_args['width'] = $width;
172
+			$map_args['height'] = $height;
173
+
174
+			$map_args['scrollwheel'] = $scrollwheel;
175
+			$map_args['showall'] = $showall;
176
+			$map_args['child_collapse'] = '0';
177
+			$map_args['sticky'] = $sticky;
178
+			$map_args['enable_cat_filters'] = false;
179
+			$map_args['enable_text_search'] = false;
180
+			$map_args['enable_post_type_filters'] = false;
181
+			$map_args['enable_location_filters'] = false;
182
+			$map_args['enable_jason_on_load'] = true;
183 183
 			
184
-            if (is_single()) {
184
+			if (is_single()) {
185 185
 
186
-                global $post;
187
-                $map_default_lat = $address_latitude = $post->post_latitude;
188
-                $map_default_lng = $address_longitude = $post->post_longitude;
189
-                $mapview = $post->post_mapview;
190
-                $mapzoom = $post->post_mapzoom;
191
-                $map_args['map_class_name'] = 'geodir-map-listing-page-single';
186
+				global $post;
187
+				$map_default_lat = $address_latitude = $post->post_latitude;
188
+				$map_default_lng = $address_longitude = $post->post_longitude;
189
+				$mapview = $post->post_mapview;
190
+				$mapzoom = $post->post_mapzoom;
191
+				$map_args['map_class_name'] = 'geodir-map-listing-page-single';
192 192
 
193
-            } else {
194
-                $default_location = geodir_get_default_location();
193
+			} else {
194
+				$default_location = geodir_get_default_location();
195 195
 
196
-                $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
197
-                $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
198
-                $map_args['map_class_name'] = 'geodir-map-listing-page';
199
-                $mapview = $maptype;
196
+				$map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
197
+				$map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
198
+				$map_args['map_class_name'] = 'geodir-map-listing-page';
199
+				$mapview = $maptype;
200 200
 
201 201
 				if ( geodir_is_page( 'search' ) ) {
202 202
 					$map_default_lat = '';
@@ -213,83 +213,83 @@  discard block
 block discarded – undo
213 213
 						}
214 214
 					}
215 215
 				}
216
-            }
217
-
218
-            if (empty($mapzoom)) $mapzoom = $zoom;
219
-
220
-            // Set default map options
221
-            $map_args['ajax_url'] = geodir_get_ajax_url();
222
-            $map_args['latitude'] = $map_default_lat;
223
-            $map_args['longitude'] = $map_default_lng;
224
-            $map_args['zoom'] = $zoom;
225
-            //$map_args['scrollwheel'] = true;
226
-            $map_args['scrollwheel'] = $scrollwheel;
227
-            $map_args['showall'] = $showall;
228
-            $map_args['streetViewControl'] = true;
229
-            $map_args['maptype'] = $maptype;
230
-            $map_args['showPreview'] = '0';
231
-            $map_args['maxZoom'] = 21;
232
-            $map_args['autozoom'] = $autozoom;
233
-            $map_args['bubble_size'] = 'small';
216
+			}
217
+
218
+			if (empty($mapzoom)) $mapzoom = $zoom;
219
+
220
+			// Set default map options
221
+			$map_args['ajax_url'] = geodir_get_ajax_url();
222
+			$map_args['latitude'] = $map_default_lat;
223
+			$map_args['longitude'] = $map_default_lng;
224
+			$map_args['zoom'] = $zoom;
225
+			//$map_args['scrollwheel'] = true;
226
+			$map_args['scrollwheel'] = $scrollwheel;
227
+			$map_args['showall'] = $showall;
228
+			$map_args['streetViewControl'] = true;
229
+			$map_args['maptype'] = $maptype;
230
+			$map_args['showPreview'] = '0';
231
+			$map_args['maxZoom'] = 21;
232
+			$map_args['autozoom'] = $autozoom;
233
+			$map_args['bubble_size'] = 'small';
234 234
             
235
-            $map_args['enable_marker_cluster'] = defined('GDCLUSTER_VERSION') && !empty($instance['marker_cluster']) ? true : false;
235
+			$map_args['enable_marker_cluster'] = defined('GDCLUSTER_VERSION') && !empty($instance['marker_cluster']) ? true : false;
236 236
 
237
-            echo $before_widget;
238
-            geodir_draw_map($map_args);
239
-            echo $after_widget;
237
+			echo $before_widget;
238
+			geodir_draw_map($map_args);
239
+			echo $after_widget;
240 240
 
241
-        endif;
242
-    }
241
+		endif;
242
+	}
243 243
 
244 244
 	/**
245 245
 	 * Sanitize listing page map widget form values as they are saved.
246 246
 	 *
247 247
 	 * @since 1.0.0
248
-     * @since 1.5.1 Declare function public.
248
+	 * @since 1.5.1 Declare function public.
249 249
 	 *
250 250
 	 * @param array $new_instance Values just sent to be saved.
251 251
 	 * @param array $old_instance Previously saved values from database.
252 252
 	 *
253 253
 	 * @return array Updated safe values to be saved.
254 254
 	 */
255
-    public function update($new_instance, $old_instance) {
256
-        //save the widget
257
-        $instance = $old_instance;
258
-        $instance['width'] = strip_tags($new_instance['width']);
259
-        $instance['heigh'] = ($new_instance['heigh']);
260
-        $instance['maptype'] = ($new_instance['maptype']);
261
-        $instance['zoom'] = ($new_instance['zoom']);
262
-        $instance['autozoom'] = isset($new_instance['autozoom']) ? $new_instance['autozoom'] : '';
263
-        $instance['sticky'] = isset($new_instance['sticky']) ? $new_instance['sticky'] : '';
264
-        $instance['scrollwheel'] = isset($new_instance['scrollwheel']) ? ($new_instance['scrollwheel']) : '';
265
-        $instance['showall'] = isset($new_instance['showall']) ? ($new_instance['showall']) : '';
266
-        $instance['marker_cluster'] = defined('GDCLUSTER_VERSION') && !empty($new_instance['marker_cluster']) ? 1 : '';
267
-
268
-        return $instance;
269
-    }
255
+	public function update($new_instance, $old_instance) {
256
+		//save the widget
257
+		$instance = $old_instance;
258
+		$instance['width'] = strip_tags($new_instance['width']);
259
+		$instance['heigh'] = ($new_instance['heigh']);
260
+		$instance['maptype'] = ($new_instance['maptype']);
261
+		$instance['zoom'] = ($new_instance['zoom']);
262
+		$instance['autozoom'] = isset($new_instance['autozoom']) ? $new_instance['autozoom'] : '';
263
+		$instance['sticky'] = isset($new_instance['sticky']) ? $new_instance['sticky'] : '';
264
+		$instance['scrollwheel'] = isset($new_instance['scrollwheel']) ? ($new_instance['scrollwheel']) : '';
265
+		$instance['showall'] = isset($new_instance['showall']) ? ($new_instance['showall']) : '';
266
+		$instance['marker_cluster'] = defined('GDCLUSTER_VERSION') && !empty($new_instance['marker_cluster']) ? 1 : '';
267
+
268
+		return $instance;
269
+	}
270 270
 
271 271
 	/**
272 272
 	 * Back-end listing page map widget settings form.
273 273
 	 *
274 274
 	 * @since 1.0.0
275
-     * @since 1.5.1 Declare function public.
275
+	 * @since 1.5.1 Declare function public.
276 276
 	 *
277 277
 	 * @param array $instance Previously saved values from database.
278 278
 	 */
279
-    public function form($instance) {
280
-        // widget form in backend
281
-        $instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0', 'marker_cluster' => '0'));
279
+	public function form($instance) {
280
+		// widget form in backend
281
+		$instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0', 'marker_cluster' => '0'));
282 282
         
283
-        $width = strip_tags($instance['width']);
284
-        $heigh = strip_tags($instance['heigh']);
285
-        $maptype = strip_tags($instance['maptype']);
286
-        $zoom = strip_tags($instance['zoom']);
287
-        $autozoom = strip_tags($instance['autozoom']);
288
-        $sticky = strip_tags($instance['sticky']);
289
-        $scrollwheel = strip_tags($instance['scrollwheel']);
290
-        $showall = strip_tags($instance['showall']);
291
-        $marker_cluster = (int)$instance['marker_cluster'];
292
-        ?>
283
+		$width = strip_tags($instance['width']);
284
+		$heigh = strip_tags($instance['heigh']);
285
+		$maptype = strip_tags($instance['maptype']);
286
+		$zoom = strip_tags($instance['zoom']);
287
+		$autozoom = strip_tags($instance['autozoom']);
288
+		$sticky = strip_tags($instance['sticky']);
289
+		$scrollwheel = strip_tags($instance['scrollwheel']);
290
+		$showall = strip_tags($instance['showall']);
291
+		$marker_cluster = (int)$instance['marker_cluster'];
292
+		?>
293 293
         <p>
294 294
             <label
295 295
                 for="<?php echo $this->get_field_id('width'); ?>"><?php _e('Map Width <small>(Default is : 294) you can use px or % here</small>', 'geodirectory'); ?>
@@ -318,14 +318,14 @@  discard block
 block discarded – undo
318 318
                         name="<?php echo $this->get_field_name('maptype'); ?>">
319 319
 
320 320
                     <option <?php if (isset($maptype) && $maptype == 'ROADMAP') {
321
-                        echo 'selected="selected"';
322
-                    } ?> value="ROADMAP"><?php _e('Road Map', 'geodirectory'); ?></option>
321
+						echo 'selected="selected"';
322
+					} ?> value="ROADMAP"><?php _e('Road Map', 'geodirectory'); ?></option>
323 323
                     <option <?php if (isset($maptype) && $maptype == 'SATELLITE') {
324
-                        echo 'selected="selected"';
325
-                    } ?> value="SATELLITE"><?php _e('Satellite Map', 'geodirectory'); ?></option>
324
+						echo 'selected="selected"';
325
+					} ?> value="SATELLITE"><?php _e('Satellite Map', 'geodirectory'); ?></option>
326 326
                     <option <?php if (isset($maptype) && $maptype == 'HYBRID') {
327
-                        echo 'selected="selected"';
328
-                    } ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option>
327
+						echo 'selected="selected"';
328
+					} ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option>
329 329
 					<option <?php selected($maptype, 'TERRAIN');?> 
330 330
 							value="TERRAIN"><?php _e('Terrain Map', 'geodirectory'); ?></option>
331 331
                 </select>
@@ -333,8 +333,8 @@  discard block
 block discarded – undo
333 333
         </p>
334 334
 
335 335
         <?php
336
-        $map_zoom_level = geodir_map_zoom_level();
337
-        ?>
336
+		$map_zoom_level = geodir_map_zoom_level();
337
+		?>
338 338
 
339 339
         <p>
340 340
             <label
@@ -344,14 +344,14 @@  discard block
 block discarded – undo
344 344
                 <select class="widefat" id="<?php echo $this->get_field_id('zoom'); ?>"
345 345
                         name="<?php echo $this->get_field_name('zoom'); ?>"> <?php
346 346
 
347
-                    foreach ($map_zoom_level as $level) {
348
-                        $selected = '';
349
-                        if ($level == $zoom)
350
-                            $selected = 'selected="selected"';
347
+					foreach ($map_zoom_level as $level) {
348
+						$selected = '';
349
+						if ($level == $zoom)
350
+							$selected = 'selected="selected"';
351 351
 
352
-                        echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>';
352
+						echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>';
353 353
 
354
-                    } ?>
354
+					} ?>
355 355
 
356 356
                 </select>
357 357
 
@@ -363,8 +363,8 @@  discard block
 block discarded – undo
363 363
                 for="<?php echo $this->get_field_id('autozoom'); ?>">
364 364
                 <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('autozoom'); ?>"
365 365
                        name="<?php echo $this->get_field_name('autozoom'); ?>"<?php if ($autozoom) {
366
-                    echo 'checked="checked"';
367
-                } ?> /> <?php _e('Map Auto Zoom ?', 'geodirectory'); ?></label>
366
+					echo 'checked="checked"';
367
+				} ?> /> <?php _e('Map Auto Zoom ?', 'geodirectory'); ?></label>
368 368
         </p>
369 369
 
370 370
         <p>
@@ -372,8 +372,8 @@  discard block
 block discarded – undo
372 372
                 for="<?php echo $this->get_field_id('sticky'); ?>">
373 373
                 <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('sticky'); ?>"
374 374
                        name="<?php echo $this->get_field_name('sticky'); ?>"<?php if ($sticky) {
375
-                    echo 'checked="checked"';
376
-                } ?> /> <?php _e('Map Sticky(should stick to the right of screen) ?', 'geodirectory'); ?>
375
+					echo 'checked="checked"';
376
+				} ?> /> <?php _e('Map Sticky(should stick to the right of screen) ?', 'geodirectory'); ?>
377 377
             </label>
378 378
         </p>
379 379
 
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
     </p> -->
400 400
 
401 401
     <?php
402
-    }
402
+	}
403 403
 } // class geodir_map_listingpage
404 404
 
405 405
 register_widget('geodir_map_listingpage');
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 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
 }
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
         $json_content = substr(implode(',', $cat_content_info), 1);
74 74
         $json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016
75 75
         $json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08
76
-        $list_json = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']';
76
+        $list_json = '[{"totalcount":"'.$totalcount.'",'.$json_content.']';
77 77
     } else {
78 78
         $list_json = '[{"totalcount":"0"}]';
79 79
     }
@@ -161,8 +161,8 @@  discard block
 block discarded – undo
161 161
 			 *
162 162
              * @param bool $display true if map should be displayed, false if not.
163 163
              */
164
-			$show_map = apply_filters( 'geodir_show_map_listing', $display = true );
165
-			if ( !$show_map ) {
164
+			$show_map = apply_filters('geodir_show_map_listing', $display = true);
165
+			if (!$show_map) {
166 166
 				return;
167 167
 			}
168 168
 
@@ -198,16 +198,16 @@  discard block
 block discarded – undo
198 198
                 $map_args['map_class_name'] = 'geodir-map-listing-page';
199 199
                 $mapview = $maptype;
200 200
 
201
-				if ( geodir_is_page( 'search' ) ) {
201
+				if (geodir_is_page('search')) {
202 202
 					$map_default_lat = '';
203 203
 					$map_default_lng = '';
204
-					if ( isset( $_REQUEST['sgeo_lat'] ) && isset( $_REQUEST['sgeo_lon'] ) ) {
205
-						$map_default_lat = (float)sanitize_text_field( $_REQUEST['sgeo_lat'] );
206
-						$map_default_lng = (float)sanitize_text_field( $_REQUEST['sgeo_lon'] );
204
+					if (isset($_REQUEST['sgeo_lat']) && isset($_REQUEST['sgeo_lon'])) {
205
+						$map_default_lat = (float) sanitize_text_field($_REQUEST['sgeo_lat']);
206
+						$map_default_lng = (float) sanitize_text_field($_REQUEST['sgeo_lon']);
207 207
 					}
208
-					if ( empty( $map_default_lat ) && empty( $map_default_lng ) && ! empty( $_REQUEST['set_location_type'] ) && ! empty( $_REQUEST['set_location_val'] ) && function_exists( 'geodir_get_location_by_id' ) ) {
209
-						$location = geodir_get_location_by_id( '', (int)$_REQUEST['set_location_val'] );
210
-						if ( ! empty( $location ) ) {
208
+					if (empty($map_default_lat) && empty($map_default_lng) && !empty($_REQUEST['set_location_type']) && !empty($_REQUEST['set_location_val']) && function_exists('geodir_get_location_by_id')) {
209
+						$location = geodir_get_location_by_id('', (int) $_REQUEST['set_location_val']);
210
+						if (!empty($location)) {
211 211
 							$map_default_lat = $location->city_latitude;
212 212
 							$map_default_lng = $location->city_longitude;
213 213
 						}
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 	 */
279 279
     public function form($instance) {
280 280
         // widget form in backend
281
-        $instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0', 'marker_cluster' => '0'));
281
+        $instance = wp_parse_args((array) $instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0', 'marker_cluster' => '0'));
282 282
         
283 283
         $width = strip_tags($instance['width']);
284 284
         $heigh = strip_tags($instance['heigh']);
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
         $sticky = strip_tags($instance['sticky']);
289 289
         $scrollwheel = strip_tags($instance['scrollwheel']);
290 290
         $showall = strip_tags($instance['showall']);
291
-        $marker_cluster = (int)$instance['marker_cluster'];
291
+        $marker_cluster = (int) $instance['marker_cluster'];
292 292
         ?>
293 293
         <p>
294 294
             <label
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
                     <option <?php if (isset($maptype) && $maptype == 'HYBRID') {
327 327
                         echo 'selected="selected"';
328 328
                     } ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option>
329
-					<option <?php selected($maptype, 'TERRAIN');?> 
329
+					<option <?php selected($maptype, 'TERRAIN'); ?> 
330 330
 							value="TERRAIN"><?php _e('Terrain Map', 'geodirectory'); ?></option>
331 331
                 </select>
332 332
             </label>
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
                         if ($level == $zoom)
350 350
                             $selected = 'selected="selected"';
351 351
 
352
-                        echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>';
352
+                        echo '<option '.$selected.' value="'.$level.'">'.$level.'</option>';
353 353
 
354 354
                     } ?>
355 355
 
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
                 for="<?php echo $this->get_field_id('scrollwheel'); ?>">
383 383
                 <input id="<?php echo $this->get_field_id('scrollwheel'); ?>"
384 384
                        name="<?php echo $this->get_field_name('scrollwheel'); ?>" type="checkbox" value="1"
385
-                       <?php if ($scrollwheel){ ?>checked="checked" <?php } ?> /> <?php _e('Enable mouse scroll zoom ?', 'geodirectory'); ?>
385
+                       <?php if ($scrollwheel) { ?>checked="checked" <?php } ?> /> <?php _e('Enable mouse scroll zoom ?', 'geodirectory'); ?>
386 386
             </label>
387 387
         </p>
388 388
         <?php if (defined('GDCLUSTER_VERSION')) { ?>
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -215,7 +215,9 @@  discard block
 block discarded – undo
215 215
 				}
216 216
             }
217 217
 
218
-            if (empty($mapzoom)) $mapzoom = $zoom;
218
+            if (empty($mapzoom)) {
219
+            	$mapzoom = $zoom;
220
+            }
219 221
 
220 222
             // Set default map options
221 223
             $map_args['ajax_url'] = geodir_get_ajax_url();
@@ -346,8 +348,9 @@  discard block
 block discarded – undo
346 348
 
347 349
                     foreach ($map_zoom_level as $level) {
348 350
                         $selected = '';
349
-                        if ($level == $zoom)
350
-                            $selected = 'selected="selected"';
351
+                        if ($level == $zoom) {
352
+                                                    $selected = 'selected="selected"';
353
+                        }
351 354
 
352 355
                         echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>';
353 356
 
Please login to merge, or discard this patch.
geodirectory_functions.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -136,8 +136,8 @@
 block discarded – undo
136 136
 
137 137
 global $wp_version;
138 138
 // If curent WP Version >= 4.9.6.
139
-if ( version_compare( $wp_version, '4.9.6', '>=' ) ) {
140
-	include_once( 'geodirectory-functions/privacy/abstract-geodir-privacy.php' );
141
-	include_once( 'geodirectory-functions/privacy/class-geodir-privacy-background-process.php' );
142
-	include_once( 'geodirectory-functions/privacy/class-geodir-privacy.php' );
139
+if (version_compare($wp_version, '4.9.6', '>=')) {
140
+	include_once('geodirectory-functions/privacy/abstract-geodir-privacy.php');
141
+	include_once('geodirectory-functions/privacy/class-geodir-privacy-background-process.php');
142
+	include_once('geodirectory-functions/privacy/class-geodir-privacy.php');
143 143
 }
144 144
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-functions/privacy/libraries/wp-async-request.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  * @package WP-Background-Processing
6 6
  */
7 7
 
8
-defined( 'ABSPATH' ) || exit;
8
+defined('ABSPATH') || exit;
9 9
 
10 10
 /**
11 11
  * Abstract WP_Async_Request class.
@@ -54,10 +54,10 @@  discard block
 block discarded – undo
54 54
 	 * Initiate new async request
55 55
 	 */
56 56
 	public function __construct() {
57
-		$this->identifier = $this->prefix . '_' . $this->action;
57
+		$this->identifier = $this->prefix.'_'.$this->action;
58 58
 
59
-		add_action( 'wp_ajax_' . $this->identifier, array( $this, 'maybe_handle' ) );
60
-		add_action( 'wp_ajax_nopriv_' . $this->identifier, array( $this, 'maybe_handle' ) );
59
+		add_action('wp_ajax_'.$this->identifier, array($this, 'maybe_handle'));
60
+		add_action('wp_ajax_nopriv_'.$this->identifier, array($this, 'maybe_handle'));
61 61
 	}
62 62
 
63 63
 	/**
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	 *
68 68
 	 * @return $this
69 69
 	 */
70
-	public function data( $data ) {
70
+	public function data($data) {
71 71
 		$this->data = $data;
72 72
 
73 73
 		return $this;
@@ -79,10 +79,10 @@  discard block
 block discarded – undo
79 79
 	 * @return array|WP_Error
80 80
 	 */
81 81
 	public function dispatch() {
82
-		$url  = add_query_arg( $this->get_query_args(), $this->get_query_url() );
82
+		$url  = add_query_arg($this->get_query_args(), $this->get_query_url());
83 83
 		$args = $this->get_post_args();
84 84
 
85
-		return wp_remote_post( esc_url_raw( $url ), $args );
85
+		return wp_remote_post(esc_url_raw($url), $args);
86 86
 	}
87 87
 
88 88
 	/**
@@ -91,13 +91,13 @@  discard block
 block discarded – undo
91 91
 	 * @return array
92 92
 	 */
93 93
 	protected function get_query_args() {
94
-		if ( property_exists( $this, 'query_args' ) ) {
94
+		if (property_exists($this, 'query_args')) {
95 95
 			return $this->query_args;
96 96
 		}
97 97
 
98 98
 		return array(
99 99
 			'action' => $this->identifier,
100
-			'nonce'  => wp_create_nonce( $this->identifier ),
100
+			'nonce'  => wp_create_nonce($this->identifier),
101 101
 		);
102 102
 	}
103 103
 
@@ -107,11 +107,11 @@  discard block
 block discarded – undo
107 107
 	 * @return string
108 108
 	 */
109 109
 	protected function get_query_url() {
110
-		if ( property_exists( $this, 'query_url' ) ) {
110
+		if (property_exists($this, 'query_url')) {
111 111
 			return $this->query_url;
112 112
 		}
113 113
 
114
-		return admin_url( 'admin-ajax.php' );
114
+		return admin_url('admin-ajax.php');
115 115
 	}
116 116
 
117 117
 	/**
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	 * @return array
121 121
 	 */
122 122
 	protected function get_post_args() {
123
-		if ( property_exists( $this, 'post_args' ) ) {
123
+		if (property_exists($this, 'post_args')) {
124 124
 			return $this->post_args;
125 125
 		}
126 126
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 			'blocking'  => false,
130 130
 			'body'      => $this->data,
131 131
 			'cookies'   => $_COOKIE,
132
-			'sslverify' => apply_filters( 'https_local_ssl_verify', false ),
132
+			'sslverify' => apply_filters('https_local_ssl_verify', false),
133 133
 		);
134 134
 	}
135 135
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 		// Don't lock up other requests while processing
143 143
 		session_write_close();
144 144
 
145
-		check_ajax_referer( $this->identifier, 'nonce' );
145
+		check_ajax_referer($this->identifier, 'nonce');
146 146
 
147 147
 		$this->handle();
148 148
 
Please login to merge, or discard this patch.
geodirectory-functions/privacy/libraries/wp-background-process.php 1 patch
Spacing   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @extends WP_Async_Request
7 7
  */
8 8
 
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 /**
12 12
  * Abstract WP_Background_Process class.
@@ -55,11 +55,11 @@  discard block
 block discarded – undo
55 55
 	public function __construct() {
56 56
 		parent::__construct();
57 57
 
58
-		$this->cron_hook_identifier     = $this->identifier . '_cron';
59
-		$this->cron_interval_identifier = $this->identifier . '_cron_interval';
58
+		$this->cron_hook_identifier     = $this->identifier.'_cron';
59
+		$this->cron_interval_identifier = $this->identifier.'_cron_interval';
60 60
 
61
-		add_action( $this->cron_hook_identifier, array( $this, 'handle_cron_healthcheck' ) );
62
-		add_filter( 'cron_schedules', array( $this, 'schedule_cron_healthcheck' ) );
61
+		add_action($this->cron_hook_identifier, array($this, 'handle_cron_healthcheck'));
62
+		add_filter('cron_schedules', array($this, 'schedule_cron_healthcheck'));
63 63
 	}
64 64
 
65 65
 	/**
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 *
84 84
 	 * @return $this
85 85
 	 */
86
-	public function push_to_queue( $data ) {
86
+	public function push_to_queue($data) {
87 87
 		$this->data[] = $data;
88 88
 
89 89
 		return $this;
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
 	public function save() {
98 98
 		$key = $this->generate_key();
99 99
 
100
-		if ( ! empty( $this->data ) ) {
101
-			update_site_option( $key, $this->data );
100
+		if (!empty($this->data)) {
101
+			update_site_option($key, $this->data);
102 102
 		}
103 103
 
104 104
 		return $this;
@@ -112,9 +112,9 @@  discard block
 block discarded – undo
112 112
 	 *
113 113
 	 * @return $this
114 114
 	 */
115
-	public function update( $key, $data ) {
116
-		if ( ! empty( $data ) ) {
117
-			update_site_option( $key, $data );
115
+	public function update($key, $data) {
116
+		if (!empty($data)) {
117
+			update_site_option($key, $data);
118 118
 		}
119 119
 
120 120
 		return $this;
@@ -127,8 +127,8 @@  discard block
 block discarded – undo
127 127
 	 *
128 128
 	 * @return $this
129 129
 	 */
130
-	public function delete( $key ) {
131
-		delete_site_option( $key );
130
+	public function delete($key) {
131
+		delete_site_option($key);
132 132
 
133 133
 		return $this;
134 134
 	}
@@ -143,11 +143,11 @@  discard block
 block discarded – undo
143 143
 	 *
144 144
 	 * @return string
145 145
 	 */
146
-	protected function generate_key( $length = 64 ) {
147
-		$unique  = md5( microtime() . rand() );
148
-		$prepend = $this->identifier . '_batch_';
146
+	protected function generate_key($length = 64) {
147
+		$unique  = md5(microtime().rand());
148
+		$prepend = $this->identifier.'_batch_';
149 149
 
150
-		return substr( $prepend . $unique, 0, $length );
150
+		return substr($prepend.$unique, 0, $length);
151 151
 	}
152 152
 
153 153
 	/**
@@ -160,17 +160,17 @@  discard block
 block discarded – undo
160 160
 		// Don't lock up other requests while processing
161 161
 		session_write_close();
162 162
 
163
-		if ( $this->is_process_running() ) {
163
+		if ($this->is_process_running()) {
164 164
 			// Background process already running.
165 165
 			wp_die();
166 166
 		}
167 167
 
168
-		if ( $this->is_queue_empty() ) {
168
+		if ($this->is_queue_empty()) {
169 169
 			// No data to process.
170 170
 			wp_die();
171 171
 		}
172 172
 
173
-		check_ajax_referer( $this->identifier, 'nonce' );
173
+		check_ajax_referer($this->identifier, 'nonce');
174 174
 
175 175
 		$this->handle();
176 176
 
@@ -188,20 +188,20 @@  discard block
 block discarded – undo
188 188
 		$table  = $wpdb->options;
189 189
 		$column = 'option_name';
190 190
 
191
-		if ( is_multisite() ) {
191
+		if (is_multisite()) {
192 192
 			$table  = $wpdb->sitemeta;
193 193
 			$column = 'meta_key';
194 194
 		}
195 195
 
196
-		$key = $this->identifier . '_batch_%';
196
+		$key = $this->identifier.'_batch_%';
197 197
 
198
-		$count = $wpdb->get_var( $wpdb->prepare( "
198
+		$count = $wpdb->get_var($wpdb->prepare("
199 199
 			SELECT COUNT(*)
200 200
 			FROM {$table}
201 201
 			WHERE {$column} LIKE %s
202
-		", $key ) );
202
+		", $key));
203 203
 
204
-		return ! ( $count > 0 );
204
+		return !($count > 0);
205 205
 	}
206 206
 
207 207
 	/**
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 	 * in a background process.
212 212
 	 */
213 213
 	protected function is_process_running() {
214
-		if ( get_site_transient( $this->identifier . '_process_lock' ) ) {
214
+		if (get_site_transient($this->identifier.'_process_lock')) {
215 215
 			// Process already running.
216 216
 			return true;
217 217
 		}
@@ -229,10 +229,10 @@  discard block
 block discarded – undo
229 229
 	protected function lock_process() {
230 230
 		$this->start_time = time(); // Set start time of current process.
231 231
 
232
-		$lock_duration = ( property_exists( $this, 'queue_lock_time' ) ) ? $this->queue_lock_time : 60; // 1 minute
233
-		$lock_duration = apply_filters( $this->identifier . '_queue_lock_time', $lock_duration );
232
+		$lock_duration = (property_exists($this, 'queue_lock_time')) ? $this->queue_lock_time : 60; // 1 minute
233
+		$lock_duration = apply_filters($this->identifier.'_queue_lock_time', $lock_duration);
234 234
 
235
-		set_site_transient( $this->identifier . '_process_lock', microtime(), $lock_duration );
235
+		set_site_transient($this->identifier.'_process_lock', microtime(), $lock_duration);
236 236
 	}
237 237
 
238 238
 	/**
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 	 * @return $this
244 244
 	 */
245 245
 	protected function unlock_process() {
246
-		delete_site_transient( $this->identifier . '_process_lock' );
246
+		delete_site_transient($this->identifier.'_process_lock');
247 247
 
248 248
 		return $this;
249 249
 	}
@@ -261,26 +261,26 @@  discard block
 block discarded – undo
261 261
 		$key_column   = 'option_id';
262 262
 		$value_column = 'option_value';
263 263
 
264
-		if ( is_multisite() ) {
264
+		if (is_multisite()) {
265 265
 			$table        = $wpdb->sitemeta;
266 266
 			$column       = 'meta_key';
267 267
 			$key_column   = 'meta_id';
268 268
 			$value_column = 'meta_value';
269 269
 		}
270 270
 
271
-		$key = $this->identifier . '_batch_%';
271
+		$key = $this->identifier.'_batch_%';
272 272
 
273
-		$query = $wpdb->get_row( $wpdb->prepare( "
273
+		$query = $wpdb->get_row($wpdb->prepare("
274 274
 			SELECT *
275 275
 			FROM {$table}
276 276
 			WHERE {$column} LIKE %s
277 277
 			ORDER BY {$key_column} ASC
278 278
 			LIMIT 1
279
-		", $key ) );
279
+		", $key));
280 280
 
281 281
 		$batch       = new stdClass();
282 282
 		$batch->key  = $query->$column;
283
-		$batch->data = maybe_unserialize( $query->$value_column );
283
+		$batch->data = maybe_unserialize($query->$value_column);
284 284
 
285 285
 		return $batch;
286 286
 	}
@@ -297,33 +297,33 @@  discard block
 block discarded – undo
297 297
 		do {
298 298
 			$batch = $this->get_batch();
299 299
 
300
-			foreach ( $batch->data as $key => $value ) {
301
-				$task = $this->task( $value );
300
+			foreach ($batch->data as $key => $value) {
301
+				$task = $this->task($value);
302 302
 
303
-				if ( false !== $task ) {
304
-					$batch->data[ $key ] = $task;
303
+				if (false !== $task) {
304
+					$batch->data[$key] = $task;
305 305
 				} else {
306
-					unset( $batch->data[ $key ] );
306
+					unset($batch->data[$key]);
307 307
 				}
308 308
 
309
-				if ( $this->time_exceeded() || $this->memory_exceeded() ) {
309
+				if ($this->time_exceeded() || $this->memory_exceeded()) {
310 310
 					// Batch limits reached.
311 311
 					break;
312 312
 				}
313 313
 			}
314 314
 
315 315
 			// Update or delete current batch.
316
-			if ( ! empty( $batch->data ) ) {
317
-				$this->update( $batch->key, $batch->data );
316
+			if (!empty($batch->data)) {
317
+				$this->update($batch->key, $batch->data);
318 318
 			} else {
319
-				$this->delete( $batch->key );
319
+				$this->delete($batch->key);
320 320
 			}
321
-		} while ( ! $this->time_exceeded() && ! $this->memory_exceeded() && ! $this->is_queue_empty() );
321
+		} while (!$this->time_exceeded() && !$this->memory_exceeded() && !$this->is_queue_empty());
322 322
 
323 323
 		$this->unlock_process();
324 324
 
325 325
 		// Start next batch or complete process.
326
-		if ( ! $this->is_queue_empty() ) {
326
+		if (!$this->is_queue_empty()) {
327 327
 			$this->dispatch();
328 328
 		} else {
329 329
 			$this->complete();
@@ -342,14 +342,14 @@  discard block
 block discarded – undo
342 342
 	 */
343 343
 	protected function memory_exceeded() {
344 344
 		$memory_limit   = $this->get_memory_limit() * 0.9; // 90% of max memory
345
-		$current_memory = memory_get_usage( true );
345
+		$current_memory = memory_get_usage(true);
346 346
 		$return         = false;
347 347
 
348
-		if ( $current_memory >= $memory_limit ) {
348
+		if ($current_memory >= $memory_limit) {
349 349
 			$return = true;
350 350
 		}
351 351
 
352
-		return apply_filters( $this->identifier . '_memory_exceeded', $return );
352
+		return apply_filters($this->identifier.'_memory_exceeded', $return);
353 353
 	}
354 354
 
355 355
 	/**
@@ -358,19 +358,19 @@  discard block
 block discarded – undo
358 358
 	 * @return int
359 359
 	 */
360 360
 	protected function get_memory_limit() {
361
-		if ( function_exists( 'ini_get' ) ) {
362
-			$memory_limit = ini_get( 'memory_limit' );
361
+		if (function_exists('ini_get')) {
362
+			$memory_limit = ini_get('memory_limit');
363 363
 		} else {
364 364
 			// Sensible default.
365 365
 			$memory_limit = '128M';
366 366
 		}
367 367
 
368
-		if ( ! $memory_limit || -1 === $memory_limit ) {
368
+		if (!$memory_limit || -1 === $memory_limit) {
369 369
 			// Unlimited, set to 32GB.
370 370
 			$memory_limit = '32000M';
371 371
 		}
372 372
 
373
-		return intval( $memory_limit ) * 1024 * 1024;
373
+		return intval($memory_limit) * 1024 * 1024;
374 374
 	}
375 375
 
376 376
 	/**
@@ -382,14 +382,14 @@  discard block
 block discarded – undo
382 382
 	 * @return bool
383 383
 	 */
384 384
 	protected function time_exceeded() {
385
-		$finish = $this->start_time + apply_filters( $this->identifier . '_default_time_limit', 20 ); // 20 seconds
385
+		$finish = $this->start_time + apply_filters($this->identifier.'_default_time_limit', 20); // 20 seconds
386 386
 		$return = false;
387 387
 
388
-		if ( time() >= $finish ) {
388
+		if (time() >= $finish) {
389 389
 			$return = true;
390 390
 		}
391 391
 
392
-		return apply_filters( $this->identifier . '_time_exceeded', $return );
392
+		return apply_filters($this->identifier.'_time_exceeded', $return);
393 393
 	}
394 394
 
395 395
 	/**
@@ -410,17 +410,17 @@  discard block
 block discarded – undo
410 410
 	 * @param mixed $schedules Schedules.
411 411
 	 * @return mixed
412 412
 	 */
413
-	public function schedule_cron_healthcheck( $schedules ) {
414
-		$interval = apply_filters( $this->identifier . '_cron_interval', 5 );
413
+	public function schedule_cron_healthcheck($schedules) {
414
+		$interval = apply_filters($this->identifier.'_cron_interval', 5);
415 415
 
416
-		if ( property_exists( $this, 'cron_interval' ) ) {
417
-			$interval = apply_filters( $this->identifier . '_cron_interval', $this->cron_interval_identifier );
416
+		if (property_exists($this, 'cron_interval')) {
417
+			$interval = apply_filters($this->identifier.'_cron_interval', $this->cron_interval_identifier);
418 418
 		}
419 419
 
420 420
 		// Adds every 5 minutes to the existing schedules.
421
-		$schedules[ $this->identifier . '_cron_interval' ] = array(
421
+		$schedules[$this->identifier.'_cron_interval'] = array(
422 422
 			'interval' => MINUTE_IN_SECONDS * $interval,
423
-			'display'  => sprintf( __( 'Every %d Minutes' ), $interval ),
423
+			'display'  => sprintf(__('Every %d Minutes'), $interval),
424 424
 		);
425 425
 
426 426
 		return $schedules;
@@ -433,12 +433,12 @@  discard block
 block discarded – undo
433 433
 	 * and data exists in the queue.
434 434
 	 */
435 435
 	public function handle_cron_healthcheck() {
436
-		if ( $this->is_process_running() ) {
436
+		if ($this->is_process_running()) {
437 437
 			// Background process already running.
438 438
 			exit;
439 439
 		}
440 440
 
441
-		if ( $this->is_queue_empty() ) {
441
+		if ($this->is_queue_empty()) {
442 442
 			// No data to process.
443 443
 			$this->clear_scheduled_event();
444 444
 			exit;
@@ -453,8 +453,8 @@  discard block
 block discarded – undo
453 453
 	 * Schedule event
454 454
 	 */
455 455
 	protected function schedule_event() {
456
-		if ( ! wp_next_scheduled( $this->cron_hook_identifier ) ) {
457
-			wp_schedule_event( time(), $this->cron_interval_identifier, $this->cron_hook_identifier );
456
+		if (!wp_next_scheduled($this->cron_hook_identifier)) {
457
+			wp_schedule_event(time(), $this->cron_interval_identifier, $this->cron_hook_identifier);
458 458
 		}
459 459
 	}
460 460
 
@@ -462,10 +462,10 @@  discard block
 block discarded – undo
462 462
 	 * Clear scheduled event
463 463
 	 */
464 464
 	protected function clear_scheduled_event() {
465
-		$timestamp = wp_next_scheduled( $this->cron_hook_identifier );
465
+		$timestamp = wp_next_scheduled($this->cron_hook_identifier);
466 466
 
467
-		if ( $timestamp ) {
468
-			wp_unschedule_event( $timestamp, $this->cron_hook_identifier );
467
+		if ($timestamp) {
468
+			wp_unschedule_event($timestamp, $this->cron_hook_identifier);
469 469
 		}
470 470
 	}
471 471
 
@@ -476,12 +476,12 @@  discard block
 block discarded – undo
476 476
 	 *
477 477
 	 */
478 478
 	public function cancel_process() {
479
-		if ( ! $this->is_queue_empty() ) {
479
+		if (!$this->is_queue_empty()) {
480 480
 			$batch = $this->get_batch();
481 481
 
482
-			$this->delete( $batch->key );
482
+			$this->delete($batch->key);
483 483
 
484
-			wp_clear_scheduled_hook( $this->cron_hook_identifier );
484
+			wp_clear_scheduled_hook($this->cron_hook_identifier);
485 485
 		}
486 486
 
487 487
 	}
@@ -498,6 +498,6 @@  discard block
 block discarded – undo
498 498
 	 *
499 499
 	 * @return mixed
500 500
 	 */
501
-	abstract protected function task( $item );
501
+	abstract protected function task($item);
502 502
 
503 503
 }
Please login to merge, or discard this patch.
geodirectory-functions/privacy/class-geodir-privacy-erasers.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @package GeoDirectory
7 7
  */
8 8
 
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 /**
12 12
  * GeoDir_Privacy_Erasers Class.
@@ -22,11 +22,11 @@  discard block
 block discarded – undo
22 22
 	 * @param int    $page  Page.
23 23
 	 * @return array An array of personal data in name value pairs
24 24
 	 */
25
-	public static function post_data_eraser( $email_address, $page ) {
25
+	public static function post_data_eraser($email_address, $page) {
26 26
 		$page            = (int) $page;
27
-		$user            = get_user_by( 'email', $email_address ); // Check if user has an ID in the DB to load stored personal data.
27
+		$user            = get_user_by('email', $email_address); // Check if user has an ID in the DB to load stored personal data.
28 28
 
29
-		$erasure_enabled = get_option( 'geodir_erasure_request_removes_post_data', false );
29
+		$erasure_enabled = get_option('geodir_erasure_request_removes_post_data', false);
30 30
 
31 31
 		$response        = array(
32 32
 			'items_removed'  => false,
@@ -38,30 +38,30 @@  discard block
 block discarded – undo
38 38
 		$post_query = array(
39 39
 			'limit'    => 10,
40 40
 			'page'     => $page,
41
-			'user'     => array( $email_address ),
41
+			'user'     => array($email_address),
42 42
 		);
43 43
 
44
-		if ( $user instanceof WP_User ) {
44
+		if ($user instanceof WP_User) {
45 45
 			$post_query['user'][] = (int) $user->ID;
46 46
 		}
47 47
 
48 48
 		$posts = array();
49 49
 
50
-		if ( 0 < count( $posts ) ) {
51
-			foreach ( $posts as $post ) {
52
-				if ( apply_filters( 'geodir_privacy_erase_post_personal_data', $erasure_enabled, $post ) ) {
53
-					self::remove_post_personal_data( $post );
50
+		if (0 < count($posts)) {
51
+			foreach ($posts as $post) {
52
+				if (apply_filters('geodir_privacy_erase_post_personal_data', $erasure_enabled, $post)) {
53
+					self::remove_post_personal_data($post);
54 54
 
55 55
 					/* Translators: %s Post number. */
56
-					$response['messages'][]    = sprintf( __( 'Removed personal data from post %s.', 'geodirectory' ), $post->ID );
56
+					$response['messages'][]    = sprintf(__('Removed personal data from post %s.', 'geodirectory'), $post->ID);
57 57
 					$response['items_removed'] = true;
58 58
 				} else {
59 59
 					/* Translators: %s Post number. */
60
-					$response['messages'][]     = sprintf( __( 'Personal data within post %s has been retained.', 'geodirectory' ), $post->ID );
60
+					$response['messages'][]     = sprintf(__('Personal data within post %s has been retained.', 'geodirectory'), $post->ID);
61 61
 					$response['items_retained'] = true;
62 62
 				}
63 63
 			}
64
-			$response['done'] = 10 > count( $posts );
64
+			$response['done'] = 10 > count($posts);
65 65
 		} else {
66 66
 			$response['done'] = true;
67 67
 		}
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	 *
77 77
 	 * @param WP_Post $post Post object.
78 78
 	 */
79
-	public static function remove_post_personal_data( $post ) {
79
+	public static function remove_post_personal_data($post) {
80 80
 		$anonymized_data = array();
81 81
 
82 82
 		/**
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 		 * @since 1.6.26
86 86
 		 * @param WP_Post $post A post object.
87 87
 		 */
88
-		do_action( 'geodir_privacy_before_remove_post_personal_data', $post );
88
+		do_action('geodir_privacy_before_remove_post_personal_data', $post);
89 89
 
90 90
 		/**
91 91
 		 * Expose props and data types we'll be anonymizing.
@@ -94,23 +94,23 @@  discard block
 block discarded – undo
94 94
 		 * @param array    $props Keys are the prop names, values are the data type we'll be passing to wp_privacy_anonymize_data().
95 95
 		 * @param WP_Post $post A post object.
96 96
 		 */
97
-		$props_to_remove = apply_filters( 'geodir_privacy_remove_post_personal_data_props', array(
97
+		$props_to_remove = apply_filters('geodir_privacy_remove_post_personal_data_props', array(
98 98
 			'phone'       => 'phone',
99 99
 			'email'       => 'email'
100 100
 			// TODO more fields
101
-		), $post );
101
+		), $post);
102 102
 
103
-		if ( ! empty( $props_to_remove ) && is_array( $props_to_remove ) ) {
104
-			foreach ( $props_to_remove as $prop => $data_type ) {
103
+		if (!empty($props_to_remove) && is_array($props_to_remove)) {
104
+			foreach ($props_to_remove as $prop => $data_type) {
105 105
 				// Get the current value in edit context.
106
-				$value = isset( $post->{$prop} ) ? $post->{$prop} : '';
106
+				$value = isset($post->{$prop} ) ? $post->{$prop} : '';
107 107
 
108 108
 				// If the value is empty, it does not need to be anonymized.
109
-				if ( empty( $value ) || empty( $data_type ) ) {
109
+				if (empty($value) || empty($data_type)) {
110 110
 					continue;
111 111
 				}
112 112
 
113
-				$anon_value = wp_privacy_anonymize_data( $data_type, $value );
113
+				$anon_value = wp_privacy_anonymize_data($data_type, $value);
114 114
 
115 115
 				/**
116 116
 				 * Expose a way to control the anonymized value of a prop via 3rd party code.
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 				 * @param string   $data_type Type of data.
123 123
 				 * @param WP_Post $post The post object.
124 124
 				 */
125
-				$anonymized_data[ $prop ] = apply_filters( 'geodir_privacy_remove_post_personal_data_prop_value', $anon_value, $prop, $value, $data_type, $post );
125
+				$anonymized_data[$prop] = apply_filters('geodir_privacy_remove_post_personal_data_prop_value', $anon_value, $prop, $value, $data_type, $post);
126 126
 			}
127 127
 		}
128 128
 
@@ -137,6 +137,6 @@  discard block
 block discarded – undo
137 137
 		 * @since 1.6.26
138 138
 		 * @param WP_Post $post The post object.
139 139
 		 */
140
-		do_action( 'geodir_privacy_remove_post_personal_data', $post );
140
+		do_action('geodir_privacy_remove_post_personal_data', $post);
141 141
 	}
142 142
 }
Please login to merge, or discard this patch.
geodirectory-functions/privacy/class-geodir-background-process.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -8,14 +8,14 @@  discard block
 block discarded – undo
8 8
  * @package GeoDirectory
9 9
  */
10 10
 
11
-defined( 'ABSPATH' ) || exit;
11
+defined('ABSPATH') || exit;
12 12
 
13
-if ( ! class_exists( 'WP_Async_Request', false ) ) {
14
-	include_once( 'libraries/wp-async-request.php' );
13
+if (!class_exists('WP_Async_Request', false)) {
14
+	include_once('libraries/wp-async-request.php');
15 15
 }
16 16
 
17
-if ( ! class_exists( 'WP_Background_Process', false ) ) {
18
-	include_once( 'libraries/wp-background-process.php' );
17
+if (!class_exists('WP_Background_Process', false)) {
18
+	include_once('libraries/wp-background-process.php');
19 19
 }
20 20
 
21 21
 /**
@@ -34,16 +34,16 @@  discard block
 block discarded – undo
34 34
 		$table  = $wpdb->options;
35 35
 		$column = 'option_name';
36 36
 
37
-		if ( is_multisite() ) {
37
+		if (is_multisite()) {
38 38
 			$table  = $wpdb->sitemeta;
39 39
 			$column = 'meta_key';
40 40
 		}
41 41
 
42
-		$key = $wpdb->esc_like( $this->identifier . '_batch_' ) . '%';
42
+		$key = $wpdb->esc_like($this->identifier.'_batch_').'%';
43 43
 
44
-		$count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$table} WHERE {$column} LIKE %s", $key ) ); // @codingStandardsIgnoreLine.
44
+		$count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM {$table} WHERE {$column} LIKE %s", $key)); // @codingStandardsIgnoreLine.
45 45
 
46
-		return ! ( $count > 0 );
46
+		return !($count > 0);
47 47
 	}
48 48
 
49 49
 	/**
@@ -59,20 +59,20 @@  discard block
 block discarded – undo
59 59
 		$key_column   = 'option_id';
60 60
 		$value_column = 'option_value';
61 61
 
62
-		if ( is_multisite() ) {
62
+		if (is_multisite()) {
63 63
 			$table        = $wpdb->sitemeta;
64 64
 			$column       = 'meta_key';
65 65
 			$key_column   = 'meta_id';
66 66
 			$value_column = 'meta_value';
67 67
 		}
68 68
 
69
-		$key = $wpdb->esc_like( $this->identifier . '_batch_' ) . '%';
69
+		$key = $wpdb->esc_like($this->identifier.'_batch_').'%';
70 70
 
71
-		$query = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$table} WHERE {$column} LIKE %s ORDER BY {$key_column} ASC LIMIT 1", $key ) ); // @codingStandardsIgnoreLine.
71
+		$query = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$table} WHERE {$column} LIKE %s ORDER BY {$key_column} ASC LIMIT 1", $key)); // @codingStandardsIgnoreLine.
72 72
 
73 73
 		$batch       = new stdClass();
74 74
 		$batch->key  = $query->$column;
75
-		$batch->data = array_filter( (array) maybe_unserialize( $query->$value_column ) );
75
+		$batch->data = array_filter((array) maybe_unserialize($query->$value_column));
76 76
 
77 77
 		return $batch;
78 78
 	}
@@ -98,33 +98,33 @@  discard block
 block discarded – undo
98 98
 		do {
99 99
 			$batch = $this->get_batch();
100 100
 
101
-			foreach ( $batch->data as $key => $value ) {
102
-				$task = $this->task( $value );
101
+			foreach ($batch->data as $key => $value) {
102
+				$task = $this->task($value);
103 103
 
104
-				if ( false !== $task ) {
105
-					$batch->data[ $key ] = $task;
104
+				if (false !== $task) {
105
+					$batch->data[$key] = $task;
106 106
 				} else {
107
-					unset( $batch->data[ $key ] );
107
+					unset($batch->data[$key]);
108 108
 				}
109 109
 
110
-				if ( $this->batch_limit_exceeded() ) {
110
+				if ($this->batch_limit_exceeded()) {
111 111
 					// Batch limits reached.
112 112
 					break;
113 113
 				}
114 114
 			}
115 115
 
116 116
 			// Update or delete current batch.
117
-			if ( ! empty( $batch->data ) ) {
118
-				$this->update( $batch->key, $batch->data );
117
+			if (!empty($batch->data)) {
118
+				$this->update($batch->key, $batch->data);
119 119
 			} else {
120
-				$this->delete( $batch->key );
120
+				$this->delete($batch->key);
121 121
 			}
122
-		} while ( ! $this->batch_limit_exceeded() && ! $this->is_queue_empty() );
122
+		} while (!$this->batch_limit_exceeded() && !$this->is_queue_empty());
123 123
 
124 124
 		$this->unlock_process();
125 125
 
126 126
 		// Start next batch or complete process.
127
-		if ( ! $this->is_queue_empty() ) {
127
+		if (!$this->is_queue_empty()) {
128 128
 			$this->dispatch();
129 129
 		} else {
130 130
 			$this->complete();
@@ -137,19 +137,19 @@  discard block
 block discarded – undo
137 137
 	 * @return int
138 138
 	 */
139 139
 	protected function get_memory_limit() {
140
-		if ( function_exists( 'ini_get' ) ) {
141
-			$memory_limit = ini_get( 'memory_limit' );
140
+		if (function_exists('ini_get')) {
141
+			$memory_limit = ini_get('memory_limit');
142 142
 		} else {
143 143
 			// Sensible default.
144 144
 			$memory_limit = '128M';
145 145
 		}
146 146
 
147
-		if ( ! $memory_limit || -1 === intval( $memory_limit ) ) {
147
+		if (!$memory_limit || -1 === intval($memory_limit)) {
148 148
 			// Unlimited, set to 32GB.
149 149
 			$memory_limit = '32000M';
150 150
 		}
151 151
 
152
-		return intval( $memory_limit ) * 1024 * 1024;
152
+		return intval($memory_limit) * 1024 * 1024;
153 153
 	}
154 154
 
155 155
 	/**
@@ -158,18 +158,18 @@  discard block
 block discarded – undo
158 158
 	 * @param array $schedules Schedules.
159 159
 	 * @return array
160 160
 	 */
161
-	public function schedule_cron_healthcheck( $schedules ) {
162
-		$interval = apply_filters( $this->identifier . '_cron_interval', 5 );
161
+	public function schedule_cron_healthcheck($schedules) {
162
+		$interval = apply_filters($this->identifier.'_cron_interval', 5);
163 163
 
164
-		if ( property_exists( $this, 'cron_interval' ) ) {
165
-			$interval = apply_filters( $this->identifier . '_cron_interval', $this->cron_interval );
164
+		if (property_exists($this, 'cron_interval')) {
165
+			$interval = apply_filters($this->identifier.'_cron_interval', $this->cron_interval);
166 166
 		}
167 167
 
168 168
 		// Adds every 5 minutes to the existing schedules.
169
-		$schedules[ $this->identifier . '_cron_interval' ] = array(
169
+		$schedules[$this->identifier.'_cron_interval'] = array(
170 170
 			'interval' => MINUTE_IN_SECONDS * $interval,
171 171
 			/* translators: %d: interval */
172
-			'display'  => sprintf( __( 'Every %d minutes', 'geodirectory' ), $interval ),
172
+			'display'  => sprintf(__('Every %d minutes', 'geodirectory'), $interval),
173 173
 		);
174 174
 
175 175
 		return $schedules;
@@ -186,14 +186,14 @@  discard block
 block discarded – undo
186 186
 		$table  = $wpdb->options;
187 187
 		$column = 'option_name';
188 188
 
189
-		if ( is_multisite() ) {
189
+		if (is_multisite()) {
190 190
 			$table  = $wpdb->sitemeta;
191 191
 			$column = 'meta_key';
192 192
 		}
193 193
 
194
-		$key = $wpdb->esc_like( $this->identifier . '_batch_' ) . '%';
194
+		$key = $wpdb->esc_like($this->identifier.'_batch_').'%';
195 195
 
196
-		$wpdb->query( $wpdb->prepare( "DELETE FROM {$table} WHERE {$column} LIKE %s", $key ) ); // @codingStandardsIgnoreLine.
196
+		$wpdb->query($wpdb->prepare("DELETE FROM {$table} WHERE {$column} LIKE %s", $key)); // @codingStandardsIgnoreLine.
197 197
 
198 198
 		return $this;
199 199
 	}
@@ -204,9 +204,9 @@  discard block
 block discarded – undo
204 204
 	 * Stop processing queue items, clear cronjob and delete all batches.
205 205
 	 */
206 206
 	public function kill_process() {
207
-		if ( ! $this->is_queue_empty() ) {
207
+		if (!$this->is_queue_empty()) {
208 208
 			$this->delete_all_batches();
209
-			wp_clear_scheduled_hook( $this->cron_hook_identifier );
209
+			wp_clear_scheduled_hook($this->cron_hook_identifier);
210 210
 		}
211 211
 	}
212 212
 }
Please login to merge, or discard this patch.
geodirectory-functions/privacy/abstract-geodir-privacy.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @package GeoDirectory
7 7
  */
8 8
 
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 /**
12 12
  * Abstract class that is intended to be extended by specific privacy class. 
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 *
44 44
 	 * @param string $name Plugin identifier.
45 45
 	 */
46
-	public function __construct( $name = '' ) {
46
+	public function __construct($name = '') {
47 47
 		$this->name = $name;
48 48
 		$this->init();
49 49
 	}
@@ -52,11 +52,11 @@  discard block
 block discarded – undo
52 52
 	 * Hook in events.
53 53
 	 */
54 54
 	protected function init() {
55
-		add_action( 'admin_init', array( $this, 'add_privacy_message' ) );
55
+		add_action('admin_init', array($this, 'add_privacy_message'));
56 56
 		// Register data exporters
57
-		add_filter( 'wp_privacy_personal_data_exporters', array( $this, 'register_exporters' ), 5 );
57
+		add_filter('wp_privacy_personal_data_exporters', array($this, 'register_exporters'), 5);
58 58
 		// Register data erasers
59
-		add_filter( 'wp_privacy_personal_data_erasers', array( $this, 'register_erasers' ) );
59
+		add_filter('wp_privacy_personal_data_erasers', array($this, 'register_erasers'));
60 60
 	}
61 61
 
62 62
 	/**
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
 	public function add_privacy_message() {
66 66
 		$content = $this->get_privacy_message();
67 67
 
68
-		if ( $content ) {
69
-			wp_add_privacy_policy_content( $this->name, $this->get_privacy_message() );
68
+		if ($content) {
69
+			wp_add_privacy_policy_content($this->name, $this->get_privacy_message());
70 70
 		}
71 71
 	}
72 72
 
@@ -86,9 +86,9 @@  discard block
 block discarded – undo
86 86
 	 * @param array $exporters List of exporter callbacks.
87 87
 	 * @return array
88 88
 	 */
89
-	public function register_exporters( $exporters = array() ) {
90
-		foreach ( $this->exporters as $id => $exporter ) {
91
-			$exporters[ $id ] = $exporter;
89
+	public function register_exporters($exporters = array()) {
90
+		foreach ($this->exporters as $id => $exporter) {
91
+			$exporters[$id] = $exporter;
92 92
 		}
93 93
 		return $exporters;
94 94
 	}
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
 	 * @param array $erasers List of eraser callbacks.
100 100
 	 * @return array
101 101
 	 */
102
-	public function register_erasers( $erasers = array() ) {
103
-		foreach ( $this->erasers as $id => $eraser ) {
104
-			$erasers[ $id ] = $eraser;
102
+	public function register_erasers($erasers = array()) {
103
+		foreach ($this->erasers as $id => $eraser) {
104
+			$erasers[$id] = $eraser;
105 105
 		}
106 106
 		return $erasers;
107 107
 	}
@@ -113,8 +113,8 @@  discard block
 block discarded – undo
113 113
 	 * @param string $name     Exporter name.
114 114
 	 * @param string $callback Exporter callback.
115 115
 	 */
116
-	public function add_exporter( $id, $name, $callback ) {
117
-		$this->exporters[ $id ] = array(
116
+	public function add_exporter($id, $name, $callback) {
117
+		$this->exporters[$id] = array(
118 118
 			'exporter_friendly_name' => $name,
119 119
 			'callback'               => $callback,
120 120
 		);
@@ -128,8 +128,8 @@  discard block
 block discarded – undo
128 128
 	 * @param string $name     Exporter name.
129 129
 	 * @param string $callback Exporter callback.
130 130
 	 */
131
-	public function add_eraser( $id, $name, $callback ) {
132
-		$this->erasers[ $id ] = array(
131
+	public function add_eraser($id, $name, $callback) {
132
+		$this->erasers[$id] = array(
133 133
 			'eraser_friendly_name' => $name,
134 134
 			'callback'             => $callback,
135 135
 		);
Please login to merge, or discard this patch.
geodirectory-functions/privacy/class-geodir-privacy-background-process.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -6,10 +6,10 @@  discard block
 block discarded – undo
6 6
  * @since   1.2.26
7 7
  */
8 8
 
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11
-if ( ! class_exists( 'GeoDir_Background_Process', false ) ) {
12
-	include_once( 'class-geodir-background-process.php' );
11
+if (!class_exists('GeoDir_Background_Process', false)) {
12
+	include_once('class-geodir-background-process.php');
13 13
 }
14 14
 
15 15
 /**
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 	 */
23 23
 	public function __construct() {
24 24
 		// Uses unique prefix per blog so each blog has separate queue.
25
-		$this->prefix = 'wp_' . get_current_blog_id();
25
+		$this->prefix = 'wp_'.get_current_blog_id();
26 26
 		$this->action = 'geodir_privacy_cleanup';
27 27
 		parent::__construct();
28 28
 	}
@@ -33,24 +33,24 @@  discard block
 block discarded – undo
33 33
 	 * @param string $item Queue item to iterate over.
34 34
 	 * @return bool
35 35
 	 */
36
-	protected function task( $item ) {
37
-		if ( ! $item || empty( $item['task'] ) ) {
36
+	protected function task($item) {
37
+		if (!$item || empty($item['task'])) {
38 38
 			return false;
39 39
 		}
40 40
 
41 41
 		$process_count = 0;
42 42
 		$process_limit = 20;
43 43
 
44
-		switch ( $item['task'] ) {
44
+		switch ($item['task']) {
45 45
 			case 'trash_pending_posts':
46
-				$process_count = GeoDir_Privacy::trash_pending_posts( $process_limit );
46
+				$process_count = GeoDir_Privacy::trash_pending_posts($process_limit);
47 47
 				break;
48 48
 			case 'anonymize_published_posts':
49
-				$process_count = GeoDir_Privacy::anonymize_published_posts( $process_limit );
49
+				$process_count = GeoDir_Privacy::anonymize_published_posts($process_limit);
50 50
 				break;
51 51
 		}
52 52
 
53
-		if ( $process_limit === $process_count ) {
53
+		if ($process_limit === $process_count) {
54 54
 			return $item;
55 55
 		}
56 56
 
Please login to merge, or discard this patch.
geodirectory-functions/privacy/class-geodir-privacy-exporters.php 2 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -316,6 +316,10 @@
 block discarded – undo
316 316
 		return $personal_data;
317 317
 	}
318 318
 
319
+	/**
320
+	 * @param string $email_address
321
+	 * @param integer $page
322
+	 */
319 323
 	public static function posts_by_author( $email_address, $post_type, $page ) {
320 324
 		if ( empty( $email_address ) || empty( $post_type ) || empty( $page ) ) {
321 325
 			return array();
Please login to merge, or discard this patch.
Spacing   +137 added lines, -137 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @package GeoDirectory
7 7
  */
8 8
 
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 /**
12 12
  * GeoDir_Privacy_Exporters Class.
@@ -22,32 +22,32 @@  discard block
 block discarded – undo
22 22
 	 * @param int    $page  Page.
23 23
 	 * @return array An array of personal data in name value pairs
24 24
 	 */
25
-	public static function post_data_exporter( $email_address, $page ) {
26
-		$post_type 		= GeoDir_Privacy::exporter_post_type();
25
+	public static function post_data_exporter($email_address, $page) {
26
+		$post_type = GeoDir_Privacy::exporter_post_type();
27 27
 
28 28
 		$done           = false;
29 29
 		$page           = (int) $page;
30 30
 		$data_to_export = array();
31 31
 
32
-		$posts 			= self::posts_by_author( $email_address, $post_type, $page );
32
+		$posts = self::posts_by_author($email_address, $post_type, $page);
33 33
 
34
-		if ( 0 < count( $posts ) ) {
35
-			$obj_post_type = get_post_type_object( $post_type );
34
+		if (0 < count($posts)) {
35
+			$obj_post_type = get_post_type_object($post_type);
36 36
 
37
-			foreach ( $posts as $post_ID ) {
38
-				$gd_post = geodir_get_post_info( $post_ID );
39
-				if ( empty( $gd_post ) ) {
37
+			foreach ($posts as $post_ID) {
38
+				$gd_post = geodir_get_post_info($post_ID);
39
+				if (empty($gd_post)) {
40 40
 					continue;
41 41
 				}
42 42
 
43 43
 				$data_to_export[] = array(
44
-					'group_id'    => 'geodirectory-post-' . $post_type,
45
-					'group_label' => __( $obj_post_type->labels->name, 'geodirectory' ),
46
-					'item_id'     => 'post-' . $post_ID,
47
-					'data'        => self::get_post_personal_data( $gd_post ),
44
+					'group_id'    => 'geodirectory-post-'.$post_type,
45
+					'group_label' => __($obj_post_type->labels->name, 'geodirectory'),
46
+					'item_id'     => 'post-'.$post_ID,
47
+					'data'        => self::get_post_personal_data($gd_post),
48 48
 				);
49 49
 			}
50
-			$done = 10 > count( $posts );
50
+			$done = 10 > count($posts);
51 51
 		} else {
52 52
 			$done = true;
53 53
 		}
@@ -65,24 +65,24 @@  discard block
 block discarded – undo
65 65
 	 * @param WP_Post $gd_post The post object.
66 66
 	 * @return array
67 67
 	 */
68
-	protected static function get_post_personal_data( $gd_post ) {
68
+	protected static function get_post_personal_data($gd_post) {
69 69
 		$post_categories = array();
70 70
 		$post_tags = array();
71 71
 		$default_category = '';
72 72
 
73
-		$cat_taxonomy = $gd_post->post_type . 'category';
74
-		$tag_taxonomy = $gd_post->post_type . '_tags';
73
+		$cat_taxonomy = $gd_post->post_type.'category';
74
+		$tag_taxonomy = $gd_post->post_type.'_tags';
75 75
 
76
-		$post_terms = wp_get_post_terms( $gd_post->ID, array( $cat_taxonomy, $tag_taxonomy ) );
77
-		if ( ! empty( $post_terms ) && ! is_wp_error( $post_terms ) ) {
78
-			foreach ( $post_terms as $term ) {
79
-				if ( $term->taxonomy == $cat_taxonomy ) {
76
+		$post_terms = wp_get_post_terms($gd_post->ID, array($cat_taxonomy, $tag_taxonomy));
77
+		if (!empty($post_terms) && !is_wp_error($post_terms)) {
78
+			foreach ($post_terms as $term) {
79
+				if ($term->taxonomy == $cat_taxonomy) {
80 80
 					$post_categories[] = $term->name;
81 81
 				} else {
82 82
 					$post_tags[] = $term->name;
83 83
 				}
84 84
 
85
-				if ( $gd_post->default_category == $term->term_id ) {
85
+				if ($gd_post->default_category == $term->term_id) {
86 86
 					$default_category = $term->name;
87 87
 				}
88 88
 			}
@@ -90,123 +90,123 @@  discard block
 block discarded – undo
90 90
 
91 91
 		$personal_data = array();
92 92
 		$personal_data[] = array(
93
-			'name'  => __( 'Post ID', 'geodirectory' ),
93
+			'name'  => __('Post ID', 'geodirectory'),
94 94
 			'value' => $gd_post->ID,
95 95
 		);
96 96
 		$personal_data[] = array(
97
-			'name'  => __( 'Post Title', 'geodirectory' ),
97
+			'name'  => __('Post Title', 'geodirectory'),
98 98
 			'value' => $gd_post->post_title,
99 99
 		);
100 100
 		$personal_data[] = array(
101
-			'name'  => __( 'Post Date', 'geodirectory' ),
101
+			'name'  => __('Post Date', 'geodirectory'),
102 102
 			'value' => $gd_post->post_date,
103 103
 		);
104 104
 		$personal_data[] = array(
105
-			'name'  => __( 'Post Status', 'geodirectory' ),
105
+			'name'  => __('Post Status', 'geodirectory'),
106 106
 			'value' => $gd_post->post_status,
107 107
 		);
108 108
 		$personal_data[] = array(
109
-			'name'  => __( 'Post Categories', 'geodirectory' ),
110
-			'value' => ( ! empty( $post_categories ) ? implode( ', ', $post_categories ) : '' ),
109
+			'name'  => __('Post Categories', 'geodirectory'),
110
+			'value' => (!empty($post_categories) ? implode(', ', $post_categories) : ''),
111 111
 		);
112
-		if ( $default_category ) {
112
+		if ($default_category) {
113 113
 			$personal_data[] = array(
114
-				'name'  => __( 'Default Category', 'geodirectory' ),
114
+				'name'  => __('Default Category', 'geodirectory'),
115 115
 				'value' => $default_category,
116 116
 			);
117 117
 		}
118
-		if ( ! empty( $post_tags ) ) {
118
+		if (!empty($post_tags)) {
119 119
 			$personal_data[] = array(
120
-				'name'  => __( 'Post Tags', 'geodirectory' ),
121
-				'value' => implode( ', ', $post_tags ),
120
+				'name'  => __('Post Tags', 'geodirectory'),
121
+				'value' => implode(', ', $post_tags),
122 122
 			);
123 123
 		}
124 124
 		$personal_data[] = array(
125
-			'name'  => __( 'Post URL', 'geodirectory' ),
126
-			'value' => get_permalink( $gd_post->ID ),
125
+			'name'  => __('Post URL', 'geodirectory'),
126
+			'value' => get_permalink($gd_post->ID),
127 127
 		);
128 128
 
129
-		$custom_fields 	= geodir_post_custom_fields( $gd_post->package_id, 'all', $gd_post->post_type );
130
-		$post_fields 	= array_keys( (array) $gd_post );
129
+		$custom_fields = geodir_post_custom_fields($gd_post->package_id, 'all', $gd_post->post_type);
130
+		$post_fields = array_keys((array) $gd_post);
131 131
 
132
-		foreach ( $custom_fields as $key => $field ) {
133
-			$field_name 			= ! empty( $field['htmlvar_name'] ) ? $field['htmlvar_name'] : '';
134
-			if ( empty( $field_name ) ) {
132
+		foreach ($custom_fields as $key => $field) {
133
+			$field_name = !empty($field['htmlvar_name']) ? $field['htmlvar_name'] : '';
134
+			if (empty($field_name)) {
135 135
 				continue;
136 136
 			}
137 137
 
138
-			$field 					= stripslashes_deep( $field );
138
+			$field = stripslashes_deep($field);
139 139
 
140
-			$extra_fields 			= ! empty( $field['extra_fields'] ) ? $field['extra_fields'] : array();
140
+			$extra_fields = !empty($field['extra_fields']) ? $field['extra_fields'] : array();
141 141
 			$data_type              = $field['data_type'];
142 142
 			$field_type             = $field['field_type'];
143
-			$field_title			= $field['site_title'];
144
-			if ( $field_name == 'post' ) {
143
+			$field_title = $field['site_title'];
144
+			if ($field_name == 'post') {
145 145
 				$field_name = 'post_address';
146 146
 			}
147 147
 
148
-			if ( ! in_array( $field_name, $post_fields ) ) {
148
+			if (!in_array($field_name, $post_fields)) {
149 149
 				continue;
150 150
 			}
151 151
 
152 152
 			$name = $field_title;
153 153
 			$value = '';
154
-			switch ( $field_type ) {
154
+			switch ($field_type) {
155 155
 				case 'address':
156
-					$location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $gd_post->post_type ) ? false : true;
157
-					if ( $location_allowed && ! empty( $gd_post->post_country ) && ! empty( $gd_post->post_region ) && ! empty( $gd_post->post_city ) ) {
156
+					$location_allowed = function_exists('geodir_cpt_no_location') && geodir_cpt_no_location($gd_post->post_type) ? false : true;
157
+					if ($location_allowed && !empty($gd_post->post_country) && !empty($gd_post->post_region) && !empty($gd_post->post_city)) {
158 158
 						$personal_data[] = array(
159
-							'name'  => __( 'Post Address', 'geodirectory' ),
159
+							'name'  => __('Post Address', 'geodirectory'),
160 160
 							'value' => $gd_post->post_address,
161 161
 						);
162 162
 						$personal_data[] = array(
163
-							'name'  => __( 'Post City', 'geodirectory' ),
163
+							'name'  => __('Post City', 'geodirectory'),
164 164
 							'value' => $gd_post->post_city,
165 165
 						);
166 166
 						$personal_data[] = array(
167
-							'name'  => __( 'Post Region', 'geodirectory' ),
167
+							'name'  => __('Post Region', 'geodirectory'),
168 168
 							'value' => $gd_post->post_region,
169 169
 						);
170 170
 						$personal_data[] = array(
171
-							'name'  => __( 'Post Country', 'geodirectory' ),
171
+							'name'  => __('Post Country', 'geodirectory'),
172 172
 							'value' => $gd_post->post_country,
173 173
 						);
174 174
 						$personal_data[] = array(
175
-							'name'  => __( 'Post Zip', 'geodirectory' ),
175
+							'name'  => __('Post Zip', 'geodirectory'),
176 176
 							'value' => $gd_post->post_zip,
177 177
 						);
178 178
 						$personal_data[] = array(
179
-							'name'  => __( 'Post Latitude', 'geodirectory' ),
179
+							'name'  => __('Post Latitude', 'geodirectory'),
180 180
 							'value' => $gd_post->post_latitude,
181 181
 						);
182 182
 						$personal_data[] = array(
183
-							'name'  => __( 'Post Longitude', 'geodirectory' ),
183
+							'name'  => __('Post Longitude', 'geodirectory'),
184 184
 							'value' => $gd_post->post_longitude,
185 185
 						);
186 186
 					}
187 187
 				break;
188 188
 				case 'checkbox':
189
-					if ( ! empty( $gd_post->{$field_name} ) ) {
190
-						$value = __( 'Yes', 'geodirectory' );
189
+					if (!empty($gd_post->{$field_name} )) {
190
+						$value = __('Yes', 'geodirectory');
191 191
 					} else {
192
-						$value = __( 'No', 'geodirectory' );
192
+						$value = __('No', 'geodirectory');
193 193
 					}
194 194
 					break;
195 195
 				case 'datepicker':
196 196
 					$value = $gd_post->{$field_name} != '0000-00-00' ? $gd_post->{$field_name} : '';
197 197
 					break;
198 198
 				case 'radio':
199
-					if ( $gd_post->{$field_name} !== '' ) {
200
-						if ( $gd_post->{$field_name} == 'f' || $gd_post->{$field_name} == '0') {
201
-							$value = __( 'No', 'geodirectory' );
202
-						} else if ( $gd_post->{$field_name} == 't' || $gd_post->{$field_name} == '1') {
203
-							$value = __( 'Yes', 'geodirectory' );
199
+					if ($gd_post->{$field_name} !== '') {
200
+						if ($gd_post->{$field_name} == 'f' || $gd_post->{$field_name} == '0') {
201
+							$value = __('No', 'geodirectory');
202
+						} else if ($gd_post->{$field_name} == 't' || $gd_post->{$field_name} == '1') {
203
+							$value = __('Yes', 'geodirectory');
204 204
 						} else {
205
-							if ( !empty( $field['option_values'] ) ) {
206
-								$cf_option_values = geodir_string_values_to_options(stripslashes_deep( $field['option_values'] ), true );
207
-								if ( ! empty( $cf_option_values ) ) {
208
-									foreach ( $cf_option_values as $cf_option_value ) {
209
-										if ( isset( $cf_option_value['value'] ) && $cf_option_value['value'] == $gd_post->{$field_name} ) {
205
+							if (!empty($field['option_values'])) {
206
+								$cf_option_values = geodir_string_values_to_options(stripslashes_deep($field['option_values']), true);
207
+								if (!empty($cf_option_values)) {
208
+									foreach ($cf_option_values as $cf_option_value) {
209
+										if (isset($cf_option_value['value']) && $cf_option_value['value'] == $gd_post->{$field_name} ) {
210 210
 											$value = $cf_option_value['label'];
211 211
 										}
212 212
 									}
@@ -216,12 +216,12 @@  discard block
 block discarded – undo
216 216
 					}
217 217
 					break;
218 218
 				case 'select':
219
-					$value = __( $gd_post->{$field_name}, 'geodirectory');
220
-					if ( !empty( $field['option_values'] ) ) {
221
-						$cf_option_values = geodir_string_values_to_options(stripslashes_deep( $field['option_values'] ), true );
222
-						if ( ! empty( $cf_option_values ) ) {
223
-							foreach ( $cf_option_values as $cf_option_value ) {
224
-								if ( isset( $cf_option_value['value'] ) && $cf_option_value['value'] == $gd_post->{$field_name} ) {
219
+					$value = __($gd_post->{$field_name}, 'geodirectory');
220
+					if (!empty($field['option_values'])) {
221
+						$cf_option_values = geodir_string_values_to_options(stripslashes_deep($field['option_values']), true);
222
+						if (!empty($cf_option_values)) {
223
+							foreach ($cf_option_values as $cf_option_value) {
224
+								if (isset($cf_option_value['value']) && $cf_option_value['value'] == $gd_post->{$field_name} ) {
225 225
 									$value = $cf_option_value['label'];
226 226
 								}
227 227
 							}
@@ -229,23 +229,23 @@  discard block
 block discarded – undo
229 229
 					}
230 230
 					break;
231 231
 				case 'multiselect':
232
-					$field_values = explode( ',', trim( $gd_post->{$field_name}, "," ) );
233
-					if ( is_array( $field_values ) ) {
234
-						$field_values = array_map( 'trim', $field_values );
232
+					$field_values = explode(',', trim($gd_post->{$field_name}, ","));
233
+					if (is_array($field_values)) {
234
+						$field_values = array_map('trim', $field_values);
235 235
 					}
236 236
 					$values = array();
237
-					if ( ! empty( $field['option_values'] ) ) {
238
-						$cf_option_values = geodir_string_values_to_options(stripslashes_deep( $field['option_values'] ), true );
237
+					if (!empty($field['option_values'])) {
238
+						$cf_option_values = geodir_string_values_to_options(stripslashes_deep($field['option_values']), true);
239 239
 
240
-						if ( ! empty( $cf_option_values ) ) {
241
-							foreach ( $cf_option_values as $cf_option_value ) {
242
-								if ( isset( $cf_option_value['value'] ) && in_array( $cf_option_value['value'], $field_values ) ) {
240
+						if (!empty($cf_option_values)) {
241
+							foreach ($cf_option_values as $cf_option_value) {
242
+								if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
243 243
 									$values[] = $cf_option_value['label'];
244 244
 								}
245 245
 							}
246 246
 						}
247 247
 					}
248
-					$value = ! empty( $values ) ? implode( ', ', $values ) : '';
248
+					$value = !empty($values) ? implode(', ', $values) : '';
249 249
 					break;
250 250
 				case 'time':
251 251
 					$value = $gd_post->{$field_name} != '00:00:00' ? $gd_post->{$field_name} : '';
@@ -256,49 +256,49 @@  discard block
 block discarded – undo
256 256
 				case 'url':
257 257
 				case 'html':
258 258
 				case 'textarea':
259
-					$value = $gd_post->{$field_name} ? strip_tags( $gd_post->{$field_name} ) : '';
259
+					$value = $gd_post->{$field_name} ? strip_tags($gd_post->{$field_name} ) : '';
260 260
 					break;
261 261
 				case 'file':
262
-					$files = explode( ",", $gd_post->{$field_name} );
263
-					if ( ! empty( $files ) ) {
264
-						$allowed_file_types = !empty( $extra_fields['gd_file_types'] ) && is_array( $extra_fields['gd_file_types'] ) && !in_array( "*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
262
+					$files = explode(",", $gd_post->{$field_name} );
263
+					if (!empty($files)) {
264
+						$allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : '';
265 265
 
266 266
 						$file_urls = array();
267
-						foreach ( $files as $file ) {
268
-							if ( ! empty( $file ) ) {
269
-								$image_name_arr = explode( '/', $file );
270
-								$curr_img_dir = $image_name_arr[ count( $image_name_arr ) - 2];
267
+						foreach ($files as $file) {
268
+							if (!empty($file)) {
269
+								$image_name_arr = explode('/', $file);
270
+								$curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
271 271
 								$filename = end($image_name_arr);
272 272
 								$img_name_arr = explode('.', $filename);
273 273
 
274
-								$arr_file_type = wp_check_filetype( $filename );
275
-								if ( empty( $arr_file_type['ext'] ) || empty( $arr_file_type['type'] ) ) {
274
+								$arr_file_type = wp_check_filetype($filename);
275
+								if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
276 276
 									continue;
277 277
 								}
278 278
 
279 279
 								$uploaded_file_type = $arr_file_type['type'];
280 280
 								$uploaded_file_ext = $arr_file_type['ext'];
281 281
 
282
-								if ( ! empty( $allowed_file_types ) && !in_array( $uploaded_file_ext, $allowed_file_types ) ) {
282
+								if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
283 283
 									continue; // Invalid file type.
284 284
 								}
285
-								$image_file_types = array( 'image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon' );
286
-								$audio_file_types = array( 'audio/mpeg', 'audio/ogg', 'audio/mp4', 'audio/vnd.wav', 'audio/basic', 'audio/mid' );
285
+								$image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
286
+								$audio_file_types = array('audio/mpeg', 'audio/ogg', 'audio/mp4', 'audio/vnd.wav', 'audio/basic', 'audio/mid');
287 287
 
288 288
 								// If the uploaded file is image
289
-								if ( in_array( $uploaded_file_type, $image_file_types ) ) {
289
+								if (in_array($uploaded_file_type, $image_file_types)) {
290 290
 									$file_urls[] = $file;
291 291
 								}
292 292
 							}
293 293
 						}
294
-						$value = ! empty( $file_urls ) ? implode( ', ', $file_urls ) : '';
294
+						$value = !empty($file_urls) ? implode(', ', $file_urls) : '';
295 295
 					}
296 296
 					break;
297 297
 			}
298 298
 
299
-			if ( ! empty( $name ) && $value !== '' ) {
299
+			if (!empty($name) && $value !== '') {
300 300
 				$personal_data[] = array(
301
-					'name'  => __( $name, 'geodirectory' ),
301
+					'name'  => __($name, 'geodirectory'),
302 302
 					'value' => $value,
303 303
 				);
304 304
 			}
@@ -311,28 +311,28 @@  discard block
 block discarded – undo
311 311
 		 * @param array    $personal_data Array of name value pairs to expose in the export.
312 312
 		 * @param WP_Post $gd_post The post object.
313 313
 		 */
314
-		$personal_data = apply_filters( 'geodir_privacy_export_post_personal_data', $personal_data, $gd_post );
314
+		$personal_data = apply_filters('geodir_privacy_export_post_personal_data', $personal_data, $gd_post);
315 315
 
316 316
 		return $personal_data;
317 317
 	}
318 318
 
319
-	public static function posts_by_author( $email_address, $post_type, $page ) {
320
-		if ( empty( $email_address ) || empty( $post_type ) || empty( $page ) ) {
319
+	public static function posts_by_author($email_address, $post_type, $page) {
320
+		if (empty($email_address) || empty($post_type) || empty($page)) {
321 321
 			return array();
322 322
 		}
323 323
 
324
-		$user = get_user_by( 'email', $email_address );
325
-		if ( empty( $user ) ) {
324
+		$user = get_user_by('email', $email_address);
325
+		if (empty($user)) {
326 326
 			return array();
327 327
 		}
328 328
 
329
-		$statuses = array_keys( get_post_statuses() );
329
+		$statuses = array_keys(get_post_statuses());
330 330
 		$skip_statuses = geodir_imex_export_skip_statuses();
331
-		if ( ! empty( $skip_statuses ) ) {
332
-			$statuses = array_diff( $statuses, $skip_statuses );
331
+		if (!empty($skip_statuses)) {
332
+			$statuses = array_diff($statuses, $skip_statuses);
333 333
 		}
334 334
 
335
-		$query_args    = array(
335
+		$query_args = array(
336 336
 			'post_type'			=> $post_type,
337 337
 			'post_status'		=> $statuses,
338 338
 			'fields'			=> 'ids',
@@ -343,55 +343,55 @@  discard block
 block discarded – undo
343 343
 			'order'	   			=> 'ASC'
344 344
 		);
345 345
 
346
-		$query_args = apply_filters( 'geodir_privacy_post_data_exporter_post_query', $query_args, $post_type, $email_address, $page );
346
+		$query_args = apply_filters('geodir_privacy_post_data_exporter_post_query', $query_args, $post_type, $email_address, $page);
347 347
 
348
-		$posts = get_posts( $query_args );
348
+		$posts = get_posts($query_args);
349 349
 
350
-		return apply_filters( 'geodir_privacy_post_data_exporter_posts', $posts, $query_args, $post_type, $email_address, $page );
350
+		return apply_filters('geodir_privacy_post_data_exporter_posts', $posts, $query_args, $post_type, $email_address, $page);
351 351
 	}
352 352
 
353
-	public static function review_data_exporter( $response, $exporter_index, $email_address, $page, $request_id, $send_as_email, $exporter_key ) {
353
+	public static function review_data_exporter($response, $exporter_index, $email_address, $page, $request_id, $send_as_email, $exporter_key) {
354 354
 		$exporter_key = GeoDir_Privacy::personal_data_exporter_key();
355 355
 
356
-		if ( $exporter_key == 'wordpress-comments' && ! empty( $response['data'] ) ) {
357
-			foreach ( $response['data'] as $key => $data ) {
358
-				$comment_id = str_replace( 'comment-', '', $data['item_id'] );
356
+		if ($exporter_key == 'wordpress-comments' && !empty($response['data'])) {
357
+			foreach ($response['data'] as $key => $data) {
358
+				$comment_id = str_replace('comment-', '', $data['item_id']);
359 359
 
360
-				$review = geodir_get_review( $comment_id );
361
-				if ( ! empty( $review ) ) {
362
-					if ( ! empty( $review->overall_rating ) ) {
363
-						$response['data'][ $key ]['data'][] = array(
364
-							'name'  => __( 'Review Rating', 'geodirectory' ),
365
-							'value' => (float)$review->overall_rating,
360
+				$review = geodir_get_review($comment_id);
361
+				if (!empty($review)) {
362
+					if (!empty($review->overall_rating)) {
363
+						$response['data'][$key]['data'][] = array(
364
+							'name'  => __('Review Rating', 'geodirectory'),
365
+							'value' => (float) $review->overall_rating,
366 366
 						);
367 367
 					}
368
-					if ( ! empty( $review->post_city ) ) {
369
-						$response['data'][ $key ]['data'][] = array(
370
-							'name'  => __( 'Review City', 'geodirectory' ),
368
+					if (!empty($review->post_city)) {
369
+						$response['data'][$key]['data'][] = array(
370
+							'name'  => __('Review City', 'geodirectory'),
371 371
 							'value' => $review->post_city,
372 372
 						);
373 373
 					}
374
-					if ( ! empty( $review->post_region ) ) {
375
-						$response['data'][ $key ]['data'][] = array(
376
-							'name'  => __( 'Review Region', 'geodirectory' ),
374
+					if (!empty($review->post_region)) {
375
+						$response['data'][$key]['data'][] = array(
376
+							'name'  => __('Review Region', 'geodirectory'),
377 377
 							'value' => $review->post_region,
378 378
 						);
379 379
 					}
380
-					if ( ! empty( $review->post_country ) ) {
381
-						$response['data'][ $key ]['data'][] = array(
382
-							'name'  => __( 'Review Country', 'geodirectory' ),
380
+					if (!empty($review->post_country)) {
381
+						$response['data'][$key]['data'][] = array(
382
+							'name'  => __('Review Country', 'geodirectory'),
383 383
 							'value' => $review->post_country,
384 384
 						);
385 385
 					}
386
-					if ( ! empty( $review->post_latitude ) ) {
387
-						$response['data'][ $key ]['data'][] = array(
388
-							'name'  => __( 'Review Latitude', 'geodirectory' ),
386
+					if (!empty($review->post_latitude)) {
387
+						$response['data'][$key]['data'][] = array(
388
+							'name'  => __('Review Latitude', 'geodirectory'),
389 389
 							'value' => $review->post_latitude,
390 390
 						);
391 391
 					}
392
-					if ( ! empty( $review->post_longitude ) ) {
393
-						$response['data'][ $key ]['data'][] = array(
394
-							'name'  => __( 'Review Longitude', 'geodirectory' ),
392
+					if (!empty($review->post_longitude)) {
393
+						$response['data'][$key]['data'][] = array(
394
+							'name'  => __('Review Longitude', 'geodirectory'),
395 395
 							'value' => $review->post_longitude,
396 396
 						);
397 397
 					}
Please login to merge, or discard this patch.