Passed
Pull Request — master (#242)
by Viruthagiri
13:29
created
tests/test-GeoDirectory.php 1 patch
Indentation   +1142 added lines, -1142 removed lines patch added patch discarded remove patch
@@ -1,1164 +1,1164 @@
 block discarded – undo
1 1
 <?php
2 2
 class GeoDirectoryTests extends WP_UnitTestCase
3 3
 {
4
-    public function setUp()
5
-    {
6
-        parent::setUp();
7
-        wp_set_current_user(1);
8
-
9
-        geodir_register_sidebar();
10
-    }
11
-
12
-    public function testBreadcrumbs() {
13
-        $query_args = array(
14
-            'post_status' => 'publish',
15
-            'post_type' => 'gd_place',
16
-            'posts_per_page' => 1,
17
-        );
18
-
19
-        $all_posts = new WP_Query( $query_args );
20
-        $post_id = null;
21
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
22
-            $post_id = get_the_ID();
23
-        endwhile;
24
-
25
-        $this->assertTrue(is_int($post_id));
26
-
27
-        $this->go_to( get_permalink($post_id) );
28
-
29
-        ob_start();
30
-        geodir_breadcrumb();
31
-        $output = ob_get_contents();
32
-        ob_end_clean();
33
-        $this->assertContains('Places', $output);
34
-    }
35
-
36
-    public function testAdminSettingForms() {
37
-        $_REQUEST['listing_type'] = 'gd_place';
38
-        ob_start();
39
-        geodir_admin_option_form('general_settings');
40
-        $output = ob_get_contents();
41
-        ob_end_clean();
42
-        $this->assertContains('General Options', $output);
43
-
44
-        ob_start();
45
-        geodir_admin_option_form('design_settings');
46
-        $output = ob_get_contents();
47
-        ob_end_clean();
48
-        $this->assertContains('Home Top Section Settings', $output);
49
-
50
-        ob_start();
51
-        geodir_admin_option_form('permalink_settings');
52
-        $output = ob_get_contents();
53
-        ob_end_clean();
54
-        $this->assertContains('Listing Detail Permalink Settings', $output);
55
-
56
-        ob_start();
57
-        geodir_admin_option_form('title_meta_settings');
58
-        $output = ob_get_contents();
59
-        ob_end_clean();
60
-        $this->assertContains('Homepage Meta Settings', $output);
61
-
62
-        ob_start();
63
-        geodir_admin_option_form('notifications_settings');
64
-        $output = ob_get_contents();
65
-        ob_end_clean();
66
-        $this->assertContains('Notification Options', $output);
67
-
68
-        ob_start();
69
-        geodir_admin_option_form('default_location_settings');
70
-        $output = ob_get_contents();
71
-        ob_end_clean();
72
-        $this->assertContains('Set Default Location', $output);
73
-
74
-        ob_start();
75
-        geodir_admin_option_form('tools_settings');
76
-        $output = ob_get_contents();
77
-        ob_end_clean();
78
-        $this->assertContains('GD Diagnostic Tools', $output);
79
-
80
-        ob_start();
81
-        geodir_admin_option_form('compatibility_settings');
82
-        $output = ob_get_contents();
83
-        ob_end_clean();
84
-        $this->assertContains('Theme Compatibility Settings', $output);
85
-
86
-        ob_start();
87
-        geodir_admin_option_form('import_export');
88
-        $output = ob_get_contents();
89
-        ob_end_clean();
90
-        $this->assertContains('GD Import & Export CSV', $output);
91
-
92
-        $_REQUEST['subtab'] = 'custom_fields';
93
-        ob_start();
94
-        geodir_admin_option_form('gd_place_fields_settings');
95
-        $output = ob_get_contents();
96
-        ob_end_clean();
97
-        $this->assertContains('general-form-builder-frame', $output);
98
-
99
-    }
100
-
101
-    public function testPopPostWidget() {
102
-        $args = array(
103
-            'before_widget' => '<ul>',
104
-            'after_widget' => '<ul>',
105
-            'before_title' => '<ul>',
106
-            'after_title' => '<ul>'
107
-        );
108
-        ob_start();
109
-        geodir_popular_post_category_output($args);
110
-        $output = ob_get_contents();
111
-        ob_end_clean();
112
-        $this->assertContains('Popular Categories', $output);
113
-    }
114
-
115
-    public function texstBestOfWidget() {
4
+	public function setUp()
5
+	{
6
+		parent::setUp();
7
+		wp_set_current_user(1);
8
+
9
+		geodir_register_sidebar();
10
+	}
11
+
12
+	public function testBreadcrumbs() {
13
+		$query_args = array(
14
+			'post_status' => 'publish',
15
+			'post_type' => 'gd_place',
16
+			'posts_per_page' => 1,
17
+		);
18
+
19
+		$all_posts = new WP_Query( $query_args );
20
+		$post_id = null;
21
+		while ( $all_posts->have_posts() ) : $all_posts->the_post();
22
+			$post_id = get_the_ID();
23
+		endwhile;
24
+
25
+		$this->assertTrue(is_int($post_id));
26
+
27
+		$this->go_to( get_permalink($post_id) );
28
+
29
+		ob_start();
30
+		geodir_breadcrumb();
31
+		$output = ob_get_contents();
32
+		ob_end_clean();
33
+		$this->assertContains('Places', $output);
34
+	}
35
+
36
+	public function testAdminSettingForms() {
37
+		$_REQUEST['listing_type'] = 'gd_place';
38
+		ob_start();
39
+		geodir_admin_option_form('general_settings');
40
+		$output = ob_get_contents();
41
+		ob_end_clean();
42
+		$this->assertContains('General Options', $output);
43
+
44
+		ob_start();
45
+		geodir_admin_option_form('design_settings');
46
+		$output = ob_get_contents();
47
+		ob_end_clean();
48
+		$this->assertContains('Home Top Section Settings', $output);
49
+
50
+		ob_start();
51
+		geodir_admin_option_form('permalink_settings');
52
+		$output = ob_get_contents();
53
+		ob_end_clean();
54
+		$this->assertContains('Listing Detail Permalink Settings', $output);
55
+
56
+		ob_start();
57
+		geodir_admin_option_form('title_meta_settings');
58
+		$output = ob_get_contents();
59
+		ob_end_clean();
60
+		$this->assertContains('Homepage Meta Settings', $output);
61
+
62
+		ob_start();
63
+		geodir_admin_option_form('notifications_settings');
64
+		$output = ob_get_contents();
65
+		ob_end_clean();
66
+		$this->assertContains('Notification Options', $output);
67
+
68
+		ob_start();
69
+		geodir_admin_option_form('default_location_settings');
70
+		$output = ob_get_contents();
71
+		ob_end_clean();
72
+		$this->assertContains('Set Default Location', $output);
73
+
74
+		ob_start();
75
+		geodir_admin_option_form('tools_settings');
76
+		$output = ob_get_contents();
77
+		ob_end_clean();
78
+		$this->assertContains('GD Diagnostic Tools', $output);
79
+
80
+		ob_start();
81
+		geodir_admin_option_form('compatibility_settings');
82
+		$output = ob_get_contents();
83
+		ob_end_clean();
84
+		$this->assertContains('Theme Compatibility Settings', $output);
85
+
86
+		ob_start();
87
+		geodir_admin_option_form('import_export');
88
+		$output = ob_get_contents();
89
+		ob_end_clean();
90
+		$this->assertContains('GD Import & Export CSV', $output);
91
+
92
+		$_REQUEST['subtab'] = 'custom_fields';
93
+		ob_start();
94
+		geodir_admin_option_form('gd_place_fields_settings');
95
+		$output = ob_get_contents();
96
+		ob_end_clean();
97
+		$this->assertContains('general-form-builder-frame', $output);
98
+
99
+	}
100
+
101
+	public function testPopPostWidget() {
102
+		$args = array(
103
+			'before_widget' => '<ul>',
104
+			'after_widget' => '<ul>',
105
+			'before_title' => '<ul>',
106
+			'after_title' => '<ul>'
107
+		);
108
+		ob_start();
109
+		geodir_popular_post_category_output($args);
110
+		$output = ob_get_contents();
111
+		ob_end_clean();
112
+		$this->assertContains('Popular Categories', $output);
113
+	}
114
+
115
+	public function texstBestOfWidget() {
116 116
 //        $args = array(
117 117
 //            'before_widget' => '<ul>',
118 118
 //            'after_widget' => '<ul>',
119 119
 //            'before_title' => '<ul>',
120 120
 //            'after_title' => '<ul>'
121 121
 //        );
122
-        include_once geodir_plugin_path() . "/geodirectory-widgets/geodirectory_cpt_categories_widget.php";
123
-        $params = array(
124
-            'title' => '',
125
-            'post_type' => array(), // NULL for all
126
-            'hide_empty' => '',
127
-            'show_count' => '',
128
-            'hide_icon' => '',
129
-            'cpt_left' => '',
130
-            'sort_by' => 'count',
131
-            'max_count' => 'all',
132
-            'max_level' => '1'
133
-        );
134
-        ob_start();
135
-        geodir_cpt_categories_output($params);
136
-        $output = ob_get_contents();
137
-        ob_end_clean();
138
-        $this->assertContains('gd-cptcat-title', $output);
139
-    }
140
-
141
-    public function testGDWidgetListView() {
142
-        global $gridview_columns_widget, $geodir_is_widget_listing;
143
-
144
-        $_REQUEST['sgeo_lat'] = '40.7127837';
145
-        $_REQUEST['sgeo_lon'] = '-74.00594130000002';
146
-        $query_args = array(
147
-            'posts_per_page' => 1,
148
-            'is_geodir_loop' => true,
149
-            'gd_location' => false,
150
-            'post_type' => 'gd_place',
151
-        );
152
-        $widget_listings = geodir_get_widget_listings($query_args);
153
-        $template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview'));
154
-        global $post, $map_jason, $map_canvas_arr;
155
-
156
-        $current_post = $post;
157
-        $current_map_jason = $map_jason;
158
-        $current_map_canvas_arr = $map_canvas_arr;
159
-        $geodir_is_widget_listing = true;
160
-
161
-        ob_start();
162
-        include($template);
163
-        $output = ob_get_contents();
164
-        ob_end_clean();
165
-        $this->assertContains('geodir-entry-content', $output);
166
-
167
-        $geodir_is_widget_listing = false;
168
-
169
-        $GLOBALS['post'] = $current_post;
170
-        if (!empty($current_post))
171
-            setup_postdata($current_post);
172
-        $map_jason = $current_map_jason;
173
-        $map_canvas_arr = $current_map_canvas_arr;
174
-
175
-    }
176
-
177
-    public function testRegTemplate() {
122
+		include_once geodir_plugin_path() . "/geodirectory-widgets/geodirectory_cpt_categories_widget.php";
123
+		$params = array(
124
+			'title' => '',
125
+			'post_type' => array(), // NULL for all
126
+			'hide_empty' => '',
127
+			'show_count' => '',
128
+			'hide_icon' => '',
129
+			'cpt_left' => '',
130
+			'sort_by' => 'count',
131
+			'max_count' => 'all',
132
+			'max_level' => '1'
133
+		);
134
+		ob_start();
135
+		geodir_cpt_categories_output($params);
136
+		$output = ob_get_contents();
137
+		ob_end_clean();
138
+		$this->assertContains('gd-cptcat-title', $output);
139
+	}
140
+
141
+	public function testGDWidgetListView() {
142
+		global $gridview_columns_widget, $geodir_is_widget_listing;
143
+
144
+		$_REQUEST['sgeo_lat'] = '40.7127837';
145
+		$_REQUEST['sgeo_lon'] = '-74.00594130000002';
146
+		$query_args = array(
147
+			'posts_per_page' => 1,
148
+			'is_geodir_loop' => true,
149
+			'gd_location' => false,
150
+			'post_type' => 'gd_place',
151
+		);
152
+		$widget_listings = geodir_get_widget_listings($query_args);
153
+		$template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview'));
154
+		global $post, $map_jason, $map_canvas_arr;
155
+
156
+		$current_post = $post;
157
+		$current_map_jason = $map_jason;
158
+		$current_map_canvas_arr = $map_canvas_arr;
159
+		$geodir_is_widget_listing = true;
160
+
161
+		ob_start();
162
+		include($template);
163
+		$output = ob_get_contents();
164
+		ob_end_clean();
165
+		$this->assertContains('geodir-entry-content', $output);
166
+
167
+		$geodir_is_widget_listing = false;
168
+
169
+		$GLOBALS['post'] = $current_post;
170
+		if (!empty($current_post))
171
+			setup_postdata($current_post);
172
+		$map_jason = $current_map_jason;
173
+		$map_canvas_arr = $current_map_canvas_arr;
174
+
175
+	}
176
+
177
+	public function testRegTemplate() {
178 178
 //        var_dump(geodir_login_page_id());
179
-        wp_set_current_user(0);
180
-        $template = geodir_plugin_path() . '/geodirectory-templates/geodir-signup.php';
181
-
182
-        ob_start();
183
-        include($template);
184
-        $output = ob_get_contents();
185
-        ob_end_clean();
186
-        $this->assertContains('Sign In', $output);
187
-    }
188
-
189
-    public function testInfoTemplate() {
190
-        wp_set_current_user(1);
191
-        global $information;
192
-        $information = "hello world";
193
-
194
-        $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
195
-
196
-        ob_start();
197
-        include($template);
198
-        $output = ob_get_contents();
199
-        ob_end_clean();
200
-        $this->assertContains('hello world', $output);
201
-    }
202
-
203
-    public function testSuccessPage() {
204
-        wp_set_current_user(1);
205
-
206
-        $query_args = array(
207
-            'post_status' => 'publish',
208
-            'post_type' => 'gd_place',
209
-            'posts_per_page' => 1,
210
-        );
211
-
212
-        $all_posts = new WP_Query( $query_args );
213
-        $post_id = null;
214
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
215
-            $post_id = get_the_ID();
216
-        endwhile;
217
-
218
-        $this->assertTrue(is_int($post_id));
219
-
220
-        $_REQUEST['listing_type'] = 'gd_place';
221
-        $_REQUEST['pid'] = $post_id;
222
-        ob_start();
223
-        $this->go_to( get_permalink(geodir_success_page_id()) );
224
-        $this->load_template();
225
-        $output = ob_get_contents();
226
-        ob_end_clean();
227
-        $this->assertContains('View your submitted information', $output);
228
-    }
229
-
230
-    public function testPreviewPage() {
231
-        wp_set_current_user(1);
232
-
233
-        $query_args = array(
234
-            'post_status' => 'publish',
235
-            'post_type' => 'gd_place',
236
-            'posts_per_page' => 1,
237
-        );
238
-
239
-        $all_posts = new WP_Query( $query_args );
240
-        $post_id = null;
241
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
242
-            $post_id = get_the_ID();
243
-        endwhile;
244
-
245
-        $this->assertTrue(is_int($post_id));
246
-
247
-        $_REQUEST = array(
248
-            'pid' => $post_id,
249
-            'listing_type' => 'gd_place',
250
-            'post_title' => 'Test Listing Title Modified',
251
-            'post_desc' => 'Test Desc',
252
-            'post_tags' => 'test1,test2',
253
-            'post_address' => 'New York City Hall',
254
-            'post_zip' => '10007',
255
-            'post_latitude' => '40.7127837',
256
-            'post_longitude' => '-74.00594130000002',
257
-            'post_mapview' => 'ROADMAP',
258
-            'post_mapzoom' => '10',
259
-            'geodir_timing' => '10.00 am to 6 pm every day',
260
-            'geodir_contact' => '1234567890',
261
-            'geodir_email' => '[email protected]',
262
-            'geodir_website' => 'http://test.com',
263
-            'geodir_twitter' => 'http://twitter.com/test',
264
-            'geodir_facebook' => 'http://facebook.com/test',
265
-            'geodir_special_offers' => 'Test offer',
266
-            'preview' => true,
267
-            'post_category' => array(
268
-                'gd_placecategory' => ''
269
-            )
270
-        );
271
-
272
-        ob_start();
273
-        $this->go_to( get_permalink(geodir_preview_page_id()) );
274
-        $this->load_template();
275
-        $output = ob_get_contents();
276
-        ob_end_clean();
277
-        $this->assertContains('This is a preview of your listing', $output);
278
-    }
279
-
280
-    public function testAddListingPage() {
281
-        wp_set_current_user(1);
282
-
283
-        ob_start();
284
-        $this->go_to( get_permalink(geodir_add_listing_page_id()) );
285
-        $this->load_template();
286
-        $output = ob_get_contents();
287
-        ob_end_clean();
288
-        $this->assertContains('Enter Listing Details', $output);
289
-    }
290
-
291
-    public function testLocationPage() {
292
-        wp_set_current_user(1);
293
-
294
-        ob_start();
295
-        $this->go_to( get_permalink(geodir_location_page_id()) );
296
-        $this->load_template();
297
-        $output = ob_get_contents();
298
-        ob_end_clean();
299
-        $this->assertContains('Location', $output);
300
-    }
301
-
302
-    public function testTemplates() {
303
-
304
-        global $current_user;
305
-
306
-        $user_id = $current_user->ID;
307
-
308
-        $this->setPermalinkStructure();
309
-
310
-        $homepage = get_page_by_title( 'GD Home page' );
311
-        if ( $homepage )
312
-        {
313
-            update_option( 'page_on_front', $homepage->ID );
314
-            update_option( 'show_on_front', 'page' );
315
-        }
316
-
317
-        ob_start();
318
-        $this->go_to( home_url('/') );
319
-        $this->load_template();
320
-        $output = ob_get_contents();
321
-        ob_end_clean();
322
-        $this->assertContains('body class="home', $output);
323
-
324
-
325
-        ob_start();
326
-        $this->go_to( home_url('/?post_type=gd_place') );
327
-        $this->load_template();
328
-        $output = ob_get_contents();
329
-        ob_end_clean();
330
-        $this->assertContains('All Places', $output);
331
-
332
-        $query_args = array(
333
-            'post_status' => 'publish',
334
-            'post_type' => 'gd_place',
335
-            'posts_per_page' => 1,
336
-        );
337
-
338
-        $all_posts = new WP_Query( $query_args );
339
-        $post_id = null;
340
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
341
-            $post_id = get_the_ID();
342
-        endwhile;
343
-
344
-        $this->assertTrue(is_int($post_id));
345
-
346
-        global $preview;
347
-        $preview = false;
348
-        ob_start();
349
-        $this->go_to( get_permalink($post_id) );
350
-        $this->load_template();
351
-        $output = ob_get_contents();
352
-        ob_end_clean();
353
-        $this->assertContains('post_profileTab', $output);
354
-
355
-        ob_start();
356
-        $_REQUEST['stype'] = 'gd_place';
357
-        $_REQUEST['geodir_dashbord'] = true;
358
-        $this->go_to( get_author_posts_url($user_id) );
359
-        $this->load_template();
360
-        $output = ob_get_contents();
361
-        ob_end_clean();
362
-        $this->assertContains('gd_list_view', $output);
363
-
364
-    }
365
-
366
-    public function testSearchPage() {
367
-        ob_start();
368
-        $_REQUEST['geodir_search'] = "1";
369
-        $_REQUEST['stype'] = 'gd_place';
370
-        $this->go_to( home_url('/?geodir_search=1&stype=gd_place&s=test&snear=&sgeo_lat=&sgeo_lon=') );
371
-        $this->load_template();
372
-        $output = ob_get_contents();
373
-        ob_end_clean();
374
-        $this->assertContains('Search Results for', $output);
375
-
376
-    }
377
-
378
-    public function testPopupSendEnquiryTemplate() {
379
-
380
-        $query_args = array(
381
-            'post_status' => 'publish',
382
-            'post_type' => 'gd_place',
383
-            'posts_per_page' => 1,
384
-        );
385
-
386
-        $all_posts = new WP_Query( $query_args );
387
-        $post_id = null;
388
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
389
-            $post_id = get_the_ID();
390
-        endwhile;
391
-
392
-        $this->assertTrue(is_int($post_id));
393
-
394
-        $_REQUEST['popuptype'] = 'b_send_inquiry';
395
-        $_REQUEST['post_id'] = $post_id;
396
-        add_filter('wp_redirect', '__return_false');
397
-        ob_start();
398
-        geodir_ajax_handler();
399
-        $output = ob_get_contents();
400
-        ob_end_clean();
401
-        $this->assertContains('send_inqury', $output);
402
-        remove_filter('wp_redirect', '__return_false');
403
-
404
-    }
405
-
406
-    public function texstPopupSendToFrndTemplate() {
407
-
408
-        //include template problem. its already loaded. find a way to fix this
409
-
410
-        $query_args = array(
411
-            'post_status' => 'publish',
412
-            'post_type' => 'gd_place',
413
-            'posts_per_page' => 1,
414
-        );
415
-
416
-        $all_posts = new WP_Query( $query_args );
417
-        $post_id = null;
418
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
419
-            $post_id = get_the_ID();
420
-        endwhile;
421
-
422
-        $this->assertTrue(is_int($post_id));
423
-
424
-        $_REQUEST['popuptype'] = 'b_sendtofriend';
425
-        $_REQUEST['post_id'] = $post_id;
426
-        add_filter('wp_redirect', '__return_false');
427
-        ob_start();
428
-        geodir_ajax_handler();
429
-        $output = ob_get_contents();
430
-        ob_end_clean();
431
-        $this->assertContains('send_inqury', $output);
432
-        remove_filter('wp_redirect', '__return_false');
433
-    }
434
-
435
-    public function testNavMenus() {
436
-        $menuname = 'Primary Menu';
437
-        $menulocation = 'primary';
438
-        // Does the menu exist already?
439
-        $menu_exists = wp_get_nav_menu_object( $menuname );
440
-
441
-        // If it doesn't exist, let's create it.
442
-        if( !$menu_exists){
443
-            $menu_id = wp_create_nav_menu($menuname);
444
-
445
-            // Set up default BuddyPress links and add them to the menu.
446
-            wp_update_nav_menu_item($menu_id, 0, array(
447
-                'menu-item-title' =>  __('Home'),
448
-                'menu-item-classes' => 'home',
449
-                'menu-item-url' => home_url( '/' ),
450
-                'menu-item-status' => 'publish'));
451
-
452
-            if( !has_nav_menu( $menulocation ) ){
453
-                $locations = get_theme_mod('nav_menu_locations');
454
-                $locations[$menulocation] = $menu_id;
455
-                set_theme_mod( 'nav_menu_locations', $locations );
456
-            }
457
-
458
-            update_option('geodir_theme_location_nav', array('primary'));
459
-
460
-            $menu = wp_nav_menu(array(
461
-                'theme_location' => 'primary',
462
-                'echo' => false,
463
-            ));
464
-
465
-            $this->assertContains('Add Listing', $menu);
466
-
467
-
468
-        }
469
-    }
470
-
471
-    public function testBestOfWidget() {
472
-        $template = geodir_plugin_path() . '/geodirectory-widgets/geodirectory_bestof_widget.php';
473
-        include_once($template);
474
-
475
-        ob_start();
476
-        $instance = array();
477
-        $instance['use_viewing_post_type'] = '1';
478
-        $instance['excerpt_type'] = 'show-reviews';
479
-        the_widget( 'geodir_bestof_widget' );
480
-        $output = ob_get_contents();
481
-        ob_end_clean();
482
-        $this->assertContains('bestof-widget-tab-layout', $output);
483
-
484
-        ob_start();
485
-        $this->the_widget_form( 'geodir_bestof_widget' );
486
-        $output = ob_get_contents();
487
-        ob_end_clean();
488
-        $this->assertContains('Number of categories', $output);
489
-
490
-        $new_instance = array(
491
-            'title' => '',
492
-            'post_type' => '',
493
-            'post_limit' => '5',
494
-            'categ_limit' => '3',
495
-            'character_count' => '20',
496
-            'add_location_filter' => '1',
497
-            'tab_layout' => 'bestof-tabs-on-top',
498
-            'excerpt_type' => 'show-desc',
499
-            'use_viewing_post_type' => '1'
500
-        );
501
-        $output = $this->the_widget_form_update( 'geodir_bestof_widget', $new_instance );
502
-        $this->assertContains('20', $output['character_count']);
503
-
504
-        ob_start();
505
-        geodir_bestof_js();
506
-        $output = ob_get_contents();
507
-        ob_end_clean();
508
-        $this->assertContains('bestof-widget-tab-layout', $output);
509
-
510
-    }
511
-
512
-    public function testCptCatsWidget() {
513
-        $template = geodir_plugin_path() . '/geodirectory-widgets/geodirectory_cpt_categories_widget.php';
514
-        include_once($template);
515
-
516
-        ob_start();
517
-        the_widget( 'geodir_cpt_categories_widget' );
518
-        $output = ob_get_contents();
519
-        ob_end_clean();
520
-        $this->assertContains('geodir_cpt_categories_widget', $output);
521
-
522
-        ob_start();
523
-        $this->the_widget_form( 'geodir_cpt_categories_widget' );
524
-        $output = ob_get_contents();
525
-        ob_end_clean();
526
-        $this->assertContains('Select CPT', $output);
527
-
528
-        $new_instance = array(
529
-            'title' => '',
530
-            'post_type' => array(), // NULL for all
531
-            'hide_empty' => '',
532
-            'show_count' => '',
533
-            'hide_icon' => '',
534
-            'cpt_left' => '',
535
-            'sort_by' => 'count',
536
-            'max_count' => 'all',
537
-            'max_level' => '1'
538
-        );
539
-        $output = $this->the_widget_form_update( 'geodir_cpt_categories_widget', $new_instance );
540
-        $this->assertContains('count', $output['sort_by']);
541
-
542
-    }
543
-
544
-    public function testFeaturesWidget() {
545
-        $template = geodir_plugin_path() . '/geodirectory-widgets/geodirectory_features_widget.php';
546
-        include_once($template);
547
-
548
-        $instance = array(
549
-            'title' => 'Features',
550
-            'icon_color' => '',
551
-            'title1' => 'Hello World',
552
-            'image1' => 'fa-recycle',
553
-            'desc1' => 'cool',
554
-        );
555
-
556
-        ob_start();
557
-        the_widget( 'Geodir_Features_Widget', $instance);
558
-        $output = ob_get_contents();
559
-        ob_end_clean();
560
-        $this->assertContains('widget_gd_features', $output);
561
-
562
-        ob_start();
563
-        $this->the_widget_form( 'Geodir_Features_Widget', $instance );
564
-        $output = ob_get_contents();
565
-        ob_end_clean();
566
-        $this->assertContains('Font Awesome Icon Color', $output);
567
-
568
-        $new_instance = array(
569
-            'title' => 'Features',
570
-            'icon_color' => '',
571
-            'title1' => 'Hello World',
572
-            'image1' => 'fa-recycle',
573
-            'desc1' => 'cool',
574
-        );
575
-        $output = $this->the_widget_form_update( 'Geodir_Features_Widget', $new_instance );
576
-        $this->assertContains('Features', $output['title']);
577
-
578
-    }
579
-
580
-    public function testSliderWidget() {
581
-        $template = geodir_plugin_path() . '/geodirectory-widgets/geodirectory_listing_slider_widget.php';
582
-        include_once($template);
583
-
584
-        ob_start();
585
-        the_widget( 'geodir_listing_slider_widget' );
586
-        $output = ob_get_contents();
587
-        ob_end_clean();
588
-        $this->assertContains('geodir_listing_slider_view', $output);
589
-
590
-        ob_start();
591
-        $this->the_widget_form( 'geodir_listing_slider_widget' );
592
-        $output = ob_get_contents();
593
-        ob_end_clean();
594
-        $this->assertContains('Slide Show Speed', $output);
595
-
596
-        $new_instance = array(
597
-            'title' => '',
598
-            'post_type' => '',
599
-            'category' => '',
600
-            'post_number' => '5',
601
-            'max_show' => '1',
602
-            'slide_width' => '',
603
-            'show_title' => '',
604
-            'slideshow' => '',
605
-            'animationLoop' => '',
606
-            'directionNav' => '',
607
-            'slideshowSpeed' => 5000,
608
-            'animationSpeed' => 600,
609
-            'animation' => '',
610
-            'list_sort' => 'latest',
611
-            'show_featured_only' => '',
612
-        );
613
-        $output = $this->the_widget_form_update( 'geodir_listing_slider_widget', $new_instance );
614
-        $this->assertContains('latest', $output['list_sort']);
615
-
616
-    }
617
-
618
-    public function testPopularWidget() {
619
-        $template = geodir_plugin_path() . '/geodirectory-widgets/geodirectory_popular_widget.php';
620
-        include_once($template);
621
-
622
-        ob_start();
623
-        the_widget( 'geodir_popular_post_category' );
624
-        $output = ob_get_contents();
625
-        ob_end_clean();
626
-        $this->assertContains('geodir_popular_post_category', $output);
627
-
628
-        ob_start();
629
-        $this->the_widget_form( 'geodir_popular_post_category' );
630
-        $output = ob_get_contents();
631
-        ob_end_clean();
632
-        $this->assertContains('Default post type to use', $output);
633
-
634
-        $new_instance = array(
635
-            'title' => '',
636
-            'category_limit' => 15,
637
-            'default_post_type' => ''
638
-        );
639
-        $output = $this->the_widget_form_update( 'geodir_popular_post_category', $new_instance );
640
-        $this->assertEquals(15, $output['category_limit']);
641
-
642
-        ob_start();
643
-        $instance = array();
644
-        $instance['category_title'] = '';
645
-        the_widget( 'geodir_popular_postview', $instance );
646
-        $output = ob_get_contents();
647
-        ob_end_clean();
648
-        $this->assertContains('geodir_popular_post_view', $output);
649
-
650
-        ob_start();
651
-        $this->the_widget_form( 'geodir_popular_postview' );
652
-        $output = ob_get_contents();
653
-        ob_end_clean();
654
-        $this->assertContains('Post Category', $output);
655
-
656
-        $new_instance = array(
657
-            'title' => '',
658
-            'post_type' => '',
659
-            'category' => array(),
660
-            'category_title' => '',
661
-            'list_sort' => '',
662
-            'list_order' => '',
663
-            'post_number' => '5',
664
-            'layout' => 'gridview_onehalf',
665
-            'listing_width' => '',
666
-            'add_location_filter' => '1',
667
-            'character_count' => '20',
668
-            'show_featured_only' => '',
669
-            'show_special_only' => '',
670
-            'with_pics_only' => '',
671
-            'with_videos_only' => '',
672
-            'use_viewing_post_type' => ''
673
-        );
674
-        $output = $this->the_widget_form_update( 'geodir_popular_postview', $new_instance );
675
-        $this->assertContains('gridview_onehalf', $output['layout']);
676
-
677
-    }
678
-
679
-    public function testRelatedWidget() {
680
-        $query_args = array(
681
-            'post_status' => 'publish',
682
-            'post_type' => 'gd_place',
683
-            'posts_per_page' => 1,
684
-        );
685
-
686
-        $all_posts = new WP_Query( $query_args );
687
-        $post_id = null;
688
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
689
-            global $post;
690
-            $post_id = get_the_ID();
691
-            $post = geodir_get_post_info($post->ID);
179
+		wp_set_current_user(0);
180
+		$template = geodir_plugin_path() . '/geodirectory-templates/geodir-signup.php';
181
+
182
+		ob_start();
183
+		include($template);
184
+		$output = ob_get_contents();
185
+		ob_end_clean();
186
+		$this->assertContains('Sign In', $output);
187
+	}
188
+
189
+	public function testInfoTemplate() {
190
+		wp_set_current_user(1);
191
+		global $information;
192
+		$information = "hello world";
193
+
194
+		$template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
195
+
196
+		ob_start();
197
+		include($template);
198
+		$output = ob_get_contents();
199
+		ob_end_clean();
200
+		$this->assertContains('hello world', $output);
201
+	}
202
+
203
+	public function testSuccessPage() {
204
+		wp_set_current_user(1);
205
+
206
+		$query_args = array(
207
+			'post_status' => 'publish',
208
+			'post_type' => 'gd_place',
209
+			'posts_per_page' => 1,
210
+		);
211
+
212
+		$all_posts = new WP_Query( $query_args );
213
+		$post_id = null;
214
+		while ( $all_posts->have_posts() ) : $all_posts->the_post();
215
+			$post_id = get_the_ID();
216
+		endwhile;
217
+
218
+		$this->assertTrue(is_int($post_id));
219
+
220
+		$_REQUEST['listing_type'] = 'gd_place';
221
+		$_REQUEST['pid'] = $post_id;
222
+		ob_start();
223
+		$this->go_to( get_permalink(geodir_success_page_id()) );
224
+		$this->load_template();
225
+		$output = ob_get_contents();
226
+		ob_end_clean();
227
+		$this->assertContains('View your submitted information', $output);
228
+	}
229
+
230
+	public function testPreviewPage() {
231
+		wp_set_current_user(1);
232
+
233
+		$query_args = array(
234
+			'post_status' => 'publish',
235
+			'post_type' => 'gd_place',
236
+			'posts_per_page' => 1,
237
+		);
238
+
239
+		$all_posts = new WP_Query( $query_args );
240
+		$post_id = null;
241
+		while ( $all_posts->have_posts() ) : $all_posts->the_post();
242
+			$post_id = get_the_ID();
243
+		endwhile;
244
+
245
+		$this->assertTrue(is_int($post_id));
246
+
247
+		$_REQUEST = array(
248
+			'pid' => $post_id,
249
+			'listing_type' => 'gd_place',
250
+			'post_title' => 'Test Listing Title Modified',
251
+			'post_desc' => 'Test Desc',
252
+			'post_tags' => 'test1,test2',
253
+			'post_address' => 'New York City Hall',
254
+			'post_zip' => '10007',
255
+			'post_latitude' => '40.7127837',
256
+			'post_longitude' => '-74.00594130000002',
257
+			'post_mapview' => 'ROADMAP',
258
+			'post_mapzoom' => '10',
259
+			'geodir_timing' => '10.00 am to 6 pm every day',
260
+			'geodir_contact' => '1234567890',
261
+			'geodir_email' => '[email protected]',
262
+			'geodir_website' => 'http://test.com',
263
+			'geodir_twitter' => 'http://twitter.com/test',
264
+			'geodir_facebook' => 'http://facebook.com/test',
265
+			'geodir_special_offers' => 'Test offer',
266
+			'preview' => true,
267
+			'post_category' => array(
268
+				'gd_placecategory' => ''
269
+			)
270
+		);
271
+
272
+		ob_start();
273
+		$this->go_to( get_permalink(geodir_preview_page_id()) );
274
+		$this->load_template();
275
+		$output = ob_get_contents();
276
+		ob_end_clean();
277
+		$this->assertContains('This is a preview of your listing', $output);
278
+	}
279
+
280
+	public function testAddListingPage() {
281
+		wp_set_current_user(1);
282
+
283
+		ob_start();
284
+		$this->go_to( get_permalink(geodir_add_listing_page_id()) );
285
+		$this->load_template();
286
+		$output = ob_get_contents();
287
+		ob_end_clean();
288
+		$this->assertContains('Enter Listing Details', $output);
289
+	}
290
+
291
+	public function testLocationPage() {
292
+		wp_set_current_user(1);
293
+
294
+		ob_start();
295
+		$this->go_to( get_permalink(geodir_location_page_id()) );
296
+		$this->load_template();
297
+		$output = ob_get_contents();
298
+		ob_end_clean();
299
+		$this->assertContains('Location', $output);
300
+	}
301
+
302
+	public function testTemplates() {
303
+
304
+		global $current_user;
305
+
306
+		$user_id = $current_user->ID;
307
+
308
+		$this->setPermalinkStructure();
309
+
310
+		$homepage = get_page_by_title( 'GD Home page' );
311
+		if ( $homepage )
312
+		{
313
+			update_option( 'page_on_front', $homepage->ID );
314
+			update_option( 'show_on_front', 'page' );
315
+		}
316
+
317
+		ob_start();
318
+		$this->go_to( home_url('/') );
319
+		$this->load_template();
320
+		$output = ob_get_contents();
321
+		ob_end_clean();
322
+		$this->assertContains('body class="home', $output);
323
+
324
+
325
+		ob_start();
326
+		$this->go_to( home_url('/?post_type=gd_place') );
327
+		$this->load_template();
328
+		$output = ob_get_contents();
329
+		ob_end_clean();
330
+		$this->assertContains('All Places', $output);
331
+
332
+		$query_args = array(
333
+			'post_status' => 'publish',
334
+			'post_type' => 'gd_place',
335
+			'posts_per_page' => 1,
336
+		);
337
+
338
+		$all_posts = new WP_Query( $query_args );
339
+		$post_id = null;
340
+		while ( $all_posts->have_posts() ) : $all_posts->the_post();
341
+			$post_id = get_the_ID();
342
+		endwhile;
343
+
344
+		$this->assertTrue(is_int($post_id));
345
+
346
+		global $preview;
347
+		$preview = false;
348
+		ob_start();
349
+		$this->go_to( get_permalink($post_id) );
350
+		$this->load_template();
351
+		$output = ob_get_contents();
352
+		ob_end_clean();
353
+		$this->assertContains('post_profileTab', $output);
354
+
355
+		ob_start();
356
+		$_REQUEST['stype'] = 'gd_place';
357
+		$_REQUEST['geodir_dashbord'] = true;
358
+		$this->go_to( get_author_posts_url($user_id) );
359
+		$this->load_template();
360
+		$output = ob_get_contents();
361
+		ob_end_clean();
362
+		$this->assertContains('gd_list_view', $output);
363
+
364
+	}
365
+
366
+	public function testSearchPage() {
367
+		ob_start();
368
+		$_REQUEST['geodir_search'] = "1";
369
+		$_REQUEST['stype'] = 'gd_place';
370
+		$this->go_to( home_url('/?geodir_search=1&stype=gd_place&s=test&snear=&sgeo_lat=&sgeo_lon=') );
371
+		$this->load_template();
372
+		$output = ob_get_contents();
373
+		ob_end_clean();
374
+		$this->assertContains('Search Results for', $output);
375
+
376
+	}
377
+
378
+	public function testPopupSendEnquiryTemplate() {
379
+
380
+		$query_args = array(
381
+			'post_status' => 'publish',
382
+			'post_type' => 'gd_place',
383
+			'posts_per_page' => 1,
384
+		);
385
+
386
+		$all_posts = new WP_Query( $query_args );
387
+		$post_id = null;
388
+		while ( $all_posts->have_posts() ) : $all_posts->the_post();
389
+			$post_id = get_the_ID();
390
+		endwhile;
391
+
392
+		$this->assertTrue(is_int($post_id));
393
+
394
+		$_REQUEST['popuptype'] = 'b_send_inquiry';
395
+		$_REQUEST['post_id'] = $post_id;
396
+		add_filter('wp_redirect', '__return_false');
397
+		ob_start();
398
+		geodir_ajax_handler();
399
+		$output = ob_get_contents();
400
+		ob_end_clean();
401
+		$this->assertContains('send_inqury', $output);
402
+		remove_filter('wp_redirect', '__return_false');
403
+
404
+	}
405
+
406
+	public function texstPopupSendToFrndTemplate() {
407
+
408
+		//include template problem. its already loaded. find a way to fix this
409
+
410
+		$query_args = array(
411
+			'post_status' => 'publish',
412
+			'post_type' => 'gd_place',
413
+			'posts_per_page' => 1,
414
+		);
415
+
416
+		$all_posts = new WP_Query( $query_args );
417
+		$post_id = null;
418
+		while ( $all_posts->have_posts() ) : $all_posts->the_post();
419
+			$post_id = get_the_ID();
420
+		endwhile;
421
+
422
+		$this->assertTrue(is_int($post_id));
423
+
424
+		$_REQUEST['popuptype'] = 'b_sendtofriend';
425
+		$_REQUEST['post_id'] = $post_id;
426
+		add_filter('wp_redirect', '__return_false');
427
+		ob_start();
428
+		geodir_ajax_handler();
429
+		$output = ob_get_contents();
430
+		ob_end_clean();
431
+		$this->assertContains('send_inqury', $output);
432
+		remove_filter('wp_redirect', '__return_false');
433
+	}
434
+
435
+	public function testNavMenus() {
436
+		$menuname = 'Primary Menu';
437
+		$menulocation = 'primary';
438
+		// Does the menu exist already?
439
+		$menu_exists = wp_get_nav_menu_object( $menuname );
440
+
441
+		// If it doesn't exist, let's create it.
442
+		if( !$menu_exists){
443
+			$menu_id = wp_create_nav_menu($menuname);
444
+
445
+			// Set up default BuddyPress links and add them to the menu.
446
+			wp_update_nav_menu_item($menu_id, 0, array(
447
+				'menu-item-title' =>  __('Home'),
448
+				'menu-item-classes' => 'home',
449
+				'menu-item-url' => home_url( '/' ),
450
+				'menu-item-status' => 'publish'));
451
+
452
+			if( !has_nav_menu( $menulocation ) ){
453
+				$locations = get_theme_mod('nav_menu_locations');
454
+				$locations[$menulocation] = $menu_id;
455
+				set_theme_mod( 'nav_menu_locations', $locations );
456
+			}
457
+
458
+			update_option('geodir_theme_location_nav', array('primary'));
459
+
460
+			$menu = wp_nav_menu(array(
461
+				'theme_location' => 'primary',
462
+				'echo' => false,
463
+			));
464
+
465
+			$this->assertContains('Add Listing', $menu);
466
+
467
+
468
+		}
469
+	}
470
+
471
+	public function testBestOfWidget() {
472
+		$template = geodir_plugin_path() . '/geodirectory-widgets/geodirectory_bestof_widget.php';
473
+		include_once($template);
474
+
475
+		ob_start();
476
+		$instance = array();
477
+		$instance['use_viewing_post_type'] = '1';
478
+		$instance['excerpt_type'] = 'show-reviews';
479
+		the_widget( 'geodir_bestof_widget' );
480
+		$output = ob_get_contents();
481
+		ob_end_clean();
482
+		$this->assertContains('bestof-widget-tab-layout', $output);
483
+
484
+		ob_start();
485
+		$this->the_widget_form( 'geodir_bestof_widget' );
486
+		$output = ob_get_contents();
487
+		ob_end_clean();
488
+		$this->assertContains('Number of categories', $output);
489
+
490
+		$new_instance = array(
491
+			'title' => '',
492
+			'post_type' => '',
493
+			'post_limit' => '5',
494
+			'categ_limit' => '3',
495
+			'character_count' => '20',
496
+			'add_location_filter' => '1',
497
+			'tab_layout' => 'bestof-tabs-on-top',
498
+			'excerpt_type' => 'show-desc',
499
+			'use_viewing_post_type' => '1'
500
+		);
501
+		$output = $this->the_widget_form_update( 'geodir_bestof_widget', $new_instance );
502
+		$this->assertContains('20', $output['character_count']);
503
+
504
+		ob_start();
505
+		geodir_bestof_js();
506
+		$output = ob_get_contents();
507
+		ob_end_clean();
508
+		$this->assertContains('bestof-widget-tab-layout', $output);
509
+
510
+	}
511
+
512
+	public function testCptCatsWidget() {
513
+		$template = geodir_plugin_path() . '/geodirectory-widgets/geodirectory_cpt_categories_widget.php';
514
+		include_once($template);
515
+
516
+		ob_start();
517
+		the_widget( 'geodir_cpt_categories_widget' );
518
+		$output = ob_get_contents();
519
+		ob_end_clean();
520
+		$this->assertContains('geodir_cpt_categories_widget', $output);
521
+
522
+		ob_start();
523
+		$this->the_widget_form( 'geodir_cpt_categories_widget' );
524
+		$output = ob_get_contents();
525
+		ob_end_clean();
526
+		$this->assertContains('Select CPT', $output);
527
+
528
+		$new_instance = array(
529
+			'title' => '',
530
+			'post_type' => array(), // NULL for all
531
+			'hide_empty' => '',
532
+			'show_count' => '',
533
+			'hide_icon' => '',
534
+			'cpt_left' => '',
535
+			'sort_by' => 'count',
536
+			'max_count' => 'all',
537
+			'max_level' => '1'
538
+		);
539
+		$output = $this->the_widget_form_update( 'geodir_cpt_categories_widget', $new_instance );
540
+		$this->assertContains('count', $output['sort_by']);
541
+
542
+	}
543
+
544
+	public function testFeaturesWidget() {
545
+		$template = geodir_plugin_path() . '/geodirectory-widgets/geodirectory_features_widget.php';
546
+		include_once($template);
547
+
548
+		$instance = array(
549
+			'title' => 'Features',
550
+			'icon_color' => '',
551
+			'title1' => 'Hello World',
552
+			'image1' => 'fa-recycle',
553
+			'desc1' => 'cool',
554
+		);
555
+
556
+		ob_start();
557
+		the_widget( 'Geodir_Features_Widget', $instance);
558
+		$output = ob_get_contents();
559
+		ob_end_clean();
560
+		$this->assertContains('widget_gd_features', $output);
561
+
562
+		ob_start();
563
+		$this->the_widget_form( 'Geodir_Features_Widget', $instance );
564
+		$output = ob_get_contents();
565
+		ob_end_clean();
566
+		$this->assertContains('Font Awesome Icon Color', $output);
567
+
568
+		$new_instance = array(
569
+			'title' => 'Features',
570
+			'icon_color' => '',
571
+			'title1' => 'Hello World',
572
+			'image1' => 'fa-recycle',
573
+			'desc1' => 'cool',
574
+		);
575
+		$output = $this->the_widget_form_update( 'Geodir_Features_Widget', $new_instance );
576
+		$this->assertContains('Features', $output['title']);
577
+
578
+	}
579
+
580
+	public function testSliderWidget() {
581
+		$template = geodir_plugin_path() . '/geodirectory-widgets/geodirectory_listing_slider_widget.php';
582
+		include_once($template);
583
+
584
+		ob_start();
585
+		the_widget( 'geodir_listing_slider_widget' );
586
+		$output = ob_get_contents();
587
+		ob_end_clean();
588
+		$this->assertContains('geodir_listing_slider_view', $output);
589
+
590
+		ob_start();
591
+		$this->the_widget_form( 'geodir_listing_slider_widget' );
592
+		$output = ob_get_contents();
593
+		ob_end_clean();
594
+		$this->assertContains('Slide Show Speed', $output);
595
+
596
+		$new_instance = array(
597
+			'title' => '',
598
+			'post_type' => '',
599
+			'category' => '',
600
+			'post_number' => '5',
601
+			'max_show' => '1',
602
+			'slide_width' => '',
603
+			'show_title' => '',
604
+			'slideshow' => '',
605
+			'animationLoop' => '',
606
+			'directionNav' => '',
607
+			'slideshowSpeed' => 5000,
608
+			'animationSpeed' => 600,
609
+			'animation' => '',
610
+			'list_sort' => 'latest',
611
+			'show_featured_only' => '',
612
+		);
613
+		$output = $this->the_widget_form_update( 'geodir_listing_slider_widget', $new_instance );
614
+		$this->assertContains('latest', $output['list_sort']);
615
+
616
+	}
617
+
618
+	public function testPopularWidget() {
619
+		$template = geodir_plugin_path() . '/geodirectory-widgets/geodirectory_popular_widget.php';
620
+		include_once($template);
621
+
622
+		ob_start();
623
+		the_widget( 'geodir_popular_post_category' );
624
+		$output = ob_get_contents();
625
+		ob_end_clean();
626
+		$this->assertContains('geodir_popular_post_category', $output);
627
+
628
+		ob_start();
629
+		$this->the_widget_form( 'geodir_popular_post_category' );
630
+		$output = ob_get_contents();
631
+		ob_end_clean();
632
+		$this->assertContains('Default post type to use', $output);
633
+
634
+		$new_instance = array(
635
+			'title' => '',
636
+			'category_limit' => 15,
637
+			'default_post_type' => ''
638
+		);
639
+		$output = $this->the_widget_form_update( 'geodir_popular_post_category', $new_instance );
640
+		$this->assertEquals(15, $output['category_limit']);
641
+
642
+		ob_start();
643
+		$instance = array();
644
+		$instance['category_title'] = '';
645
+		the_widget( 'geodir_popular_postview', $instance );
646
+		$output = ob_get_contents();
647
+		ob_end_clean();
648
+		$this->assertContains('geodir_popular_post_view', $output);
649
+
650
+		ob_start();
651
+		$this->the_widget_form( 'geodir_popular_postview' );
652
+		$output = ob_get_contents();
653
+		ob_end_clean();
654
+		$this->assertContains('Post Category', $output);
655
+
656
+		$new_instance = array(
657
+			'title' => '',
658
+			'post_type' => '',
659
+			'category' => array(),
660
+			'category_title' => '',
661
+			'list_sort' => '',
662
+			'list_order' => '',
663
+			'post_number' => '5',
664
+			'layout' => 'gridview_onehalf',
665
+			'listing_width' => '',
666
+			'add_location_filter' => '1',
667
+			'character_count' => '20',
668
+			'show_featured_only' => '',
669
+			'show_special_only' => '',
670
+			'with_pics_only' => '',
671
+			'with_videos_only' => '',
672
+			'use_viewing_post_type' => ''
673
+		);
674
+		$output = $this->the_widget_form_update( 'geodir_popular_postview', $new_instance );
675
+		$this->assertContains('gridview_onehalf', $output['layout']);
676
+
677
+	}
678
+
679
+	public function testRelatedWidget() {
680
+		$query_args = array(
681
+			'post_status' => 'publish',
682
+			'post_type' => 'gd_place',
683
+			'posts_per_page' => 1,
684
+		);
685
+
686
+		$all_posts = new WP_Query( $query_args );
687
+		$post_id = null;
688
+		while ( $all_posts->have_posts() ) : $all_posts->the_post();
689
+			global $post;
690
+			$post_id = get_the_ID();
691
+			$post = geodir_get_post_info($post->ID);
692 692
 
693 693
 //            $term_list = wp_get_post_terms($post->ID, 'gd_placecategory');
694 694
 //            $post->gd_placecategory = (string) $term_list[0]->term_id;
695 695
 
696
-            $template = geodir_plugin_path() . '/geodirectory-widgets/geodirectory_related_listing_widget.php';
697
-            include_once($template);
698
-
699
-            ob_start();
700
-            the_widget( 'geodir_related_listing_postview' );
701
-            $output = ob_get_contents();
702
-            ob_end_clean();
703
-            $this->assertContains('Related Listing', $output);
704
-
705
-            ob_start();
706
-            $this->the_widget_form( 'geodir_related_listing_postview' );
707
-            $output = ob_get_contents();
708
-            ob_end_clean();
709
-            $this->assertContains('Relate to', $output);
710
-
711
-            $new_instance = array(
712
-                'title' => '',
713
-                'list_sort' => '',
714
-                'list_order' => '',
715
-                'post_number' => '5',
716
-                'relate_to' => '',
717
-                'layout' => 'gridview_onehalf',
718
-                'listing_width' => '',
719
-                'add_location_filter' => '1',
720
-                'character_count' => '20'
721
-            );
722
-            $output = $this->the_widget_form_update( 'geodir_related_listing_postview', $new_instance );
723
-            $this->assertContains('gridview_onehalf', $output['layout']);
724
-        endwhile;
725
-
726
-        $this->assertTrue(is_int($post_id));
727
-
728
-
729
-    }
730
-
731
-    public function testReviewsWidget() {
732
-
733
-        $time = current_time('mysql');
734
-
735
-        $args = array(
736
-            'listing_type' => 'gd_place',
737
-            'post_title' => 'Test Listing Title',
738
-            'post_desc' => 'Test Desc',
739
-            'post_tags' => 'test1,test2',
740
-            'post_address' => 'New York City Hall',
741
-            'post_zip' => '10007',
742
-            'post_latitude' => '40.7127837',
743
-            'post_longitude' => '-74.00594130000002',
744
-            'post_mapview' => 'ROADMAP',
745
-            'post_mapzoom' => '10',
746
-            'geodir_timing' => '10.00 am to 6 pm every day',
747
-            'geodir_contact' => '1234567890',
748
-            'geodir_email' => '[email protected]',
749
-            'geodir_website' => 'http://test.com',
750
-            'geodir_twitter' => 'http://twitter.com/test',
751
-            'geodir_facebook' => 'http://facebook.com/test',
752
-            'geodir_special_offers' => 'Test offer'
753
-        );
754
-        $post_id = geodir_save_listing($args, true);
755
-
756
-        $data = array(
757
-            'comment_post_ID' => $post_id,
758
-            'comment_author' => 'admin',
759
-            'comment_author_email' => '[email protected]',
760
-            'comment_author_url' => 'http://wpgeodirectory.com',
761
-            'comment_content' => 'content here',
762
-            'comment_type' => '',
763
-            'comment_parent' => 0,
764
-            'user_id' => 1,
765
-            'comment_author_IP' => '127.0.0.1',
766
-            'comment_agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 3.5.30729)',
767
-            'comment_date' => $time,
768
-            'comment_approved' => 1,
769
-        );
770
-
771
-        $comment_id = wp_insert_comment($data);
772
-
773
-        $_REQUEST['geodir_overallrating'] = 5.0;
774
-        geodir_save_rating($comment_id);
775
-
776
-        $this->assertTrue(is_int($comment_id));
777
-
778
-        $template = geodir_plugin_path() . '/geodirectory-widgets/geodirectory_reviews_widget.php';
779
-        include_once($template);
780
-
781
-        ob_start();
782
-        the_widget( 'geodir_recent_reviews_widget' );
783
-        $output = ob_get_contents();
784
-        ob_end_clean();
785
-        $this->assertContains('geodir_recent_reviews', $output);
786
-
787
-        ob_start();
788
-        $this->the_widget_form( 'geodir_recent_reviews_widget' );
789
-        $output = ob_get_contents();
790
-        ob_end_clean();
791
-        $this->assertContains('Number of Reviews', $output);
792
-
793
-        $new_instance = array(
794
-            'title' => '',
795
-            't1' => '',
796
-            't2' => '',
797
-            't3' => '',
798
-            'img1' => '',
799
-            'count' => ''
800
-        );
801
-        $output = $this->the_widget_form_update( 'geodir_recent_reviews_widget', $new_instance );
802
-        $this->assertTrue(empty($output['count']));
803
-    }
804
-
805
-    public function testHomeMapWidget() {
806
-        $template = geodir_plugin_path() . '/geodirectory-widgets/home_map_widget.php';
807
-        include_once($template);
808
-
809
-        ob_start();
810
-        $instance = array();
811
-        $args = array();
812
-        $args["widget_id"] = "geodir_map_v3_home_map-2";
813
-        the_widget( 'geodir_homepage_map', $instance, $args );
814
-        $output = ob_get_contents();
815
-        ob_end_clean();
816
-        $this->assertContains('geodir-map-home-page', $output);
817
-
818
-        ob_start();
819
-        $this->the_widget_form( 'geodir_homepage_map' );
820
-        $output = ob_get_contents();
821
-        ob_end_clean();
822
-        $this->assertContains('Map Zoom level', $output);
823
-
824
-        $new_instance = array(
825
-            'width' => '',
826
-            'heigh' => '',
827
-            'maptype' => '',
828
-            'zoom' => '',
829
-            'autozoom' => '',
830
-            'child_collapse' => '0',
831
-            'scrollwheel' => '0'
832
-        );
833
-        $output = $this->the_widget_form_update( 'geodir_homepage_map', $new_instance );
834
-        $this->assertContains('0', $output['scrollwheel']);
835
-
836
-    }
837
-
838
-    public function testLoginWidget() {
839
-
840
-        register_geodir_widgets();
841
-
842
-        ob_start();
843
-        the_widget( 'geodir_loginwidget' );
844
-        $output = ob_get_contents();
845
-        ob_end_clean();
846
-        $this->assertContains('geodir_loginbox', $output);
847
-
848
-        ob_start();
849
-        $this->the_widget_form( 'geodir_loginwidget' );
850
-        $output = ob_get_contents();
851
-        ob_end_clean();
852
-        $this->assertContains('Widget Title', $output);
853
-
854
-        $new_instance = array(
855
-            'title' => 'Login',
856
-            't1' => '',
857
-            't2' => '',
858
-            't3' => '',
859
-            'img1' => '',
860
-            'desc1' => ''
861
-        );
862
-        $output = $this->the_widget_form_update( 'geodir_loginwidget', $new_instance );
863
-        $this->assertContains('Login', $output['title']);
864
-
865
-    }
866
-
867
-    public function testSocialWidget() {
868
-
869
-        ob_start();
870
-        the_widget( 'geodir_social_like_widget' );
871
-        $output = ob_get_contents();
872
-        ob_end_clean();
873
-        $this->assertContains('twitter.com', $output);
874
-
875
-        ob_start();
876
-        $this->the_widget_form( 'geodir_social_like_widget' );
877
-        $output = ob_get_contents();
878
-        ob_end_clean();
879
-        $this->assertContains('No settings for this widget', $output);
880
-
881
-        $new_instance = array(
882
-            'title' => 'Social',
883
-        );
884
-        $output = $this->the_widget_form_update( 'geodir_social_like_widget', $new_instance );
885
-        $this->assertContains('Social', $output['title']);
886
-
887
-    }
888
-
889
-    public function testSubscribeWidget() {
890
-
891
-        ob_start();
892
-        the_widget( 'geodirsubscribeWidget' );
893
-        $output = ob_get_contents();
894
-        ob_end_clean();
895
-        $this->assertContains('geodir-subscribe-form', $output);
896
-
897
-        ob_start();
898
-        $this->the_widget_form( 'geodirsubscribeWidget' );
899
-        $output = ob_get_contents();
900
-        ob_end_clean();
901
-        $this->assertContains('Feedburner ID', $output);
902
-
903
-        $new_instance = array(
904
-            'title' => 'Subscribe',
905
-            'id' => '',
906
-            'advt1' => '',
907
-            'text' => '',
908
-            'twitter' => '',
909
-            'facebook' => '',
910
-            'digg' => '',
911
-            'myspace' => ''
912
-        );
913
-        $output = $this->the_widget_form_update( 'geodirsubscribeWidget', $new_instance );
914
-        $this->assertContains('Subscribe', $output['title']);
915
-
916
-    }
917
-
918
-    public function testAdvWidget() {
919
-
920
-        ob_start();
921
-        $instance = array();
922
-        $instance['desc1'] = 'hello';
923
-        the_widget( 'geodiradvtwidget', $instance );
924
-        $output = ob_get_contents();
925
-        ob_end_clean();
926
-        $this->assertContains('hello', $output);
927
-
928
-        ob_start();
929
-        $this->the_widget_form( 'geodiradvtwidget' );
930
-        $output = ob_get_contents();
931
-        ob_end_clean();
932
-        $this->assertContains('Your Advt code', $output);
933
-
934
-        $new_instance = array(
935
-            'desc1' => 'Advertise'
936
-        );
937
-        $output = $this->the_widget_form_update( 'geodiradvtwidget', $new_instance );
938
-        $this->assertContains('Advertise', $output['desc1']);
939
-
940
-    }
941
-
942
-    public function testFlickrWidget() {
943
-
944
-        ob_start();
945
-        the_widget( 'GeodirFlickrWidget' );
946
-        $output = ob_get_contents();
947
-        ob_end_clean();
948
-        $this->assertContains('geodir-flickr', $output);
949
-
950
-        ob_start();
951
-        $this->the_widget_form( 'GeodirFlickrWidget' );
952
-        $output = ob_get_contents();
953
-        ob_end_clean();
954
-        $this->assertContains('Flickr ID', $output);
955
-
956
-        $new_instance = array(
957
-            'id' => '',
958
-            'number' => '34'
959
-        );
960
-        $output = $this->the_widget_form_update( 'GeodirFlickrWidget', $new_instance );
961
-        $this->assertContains('34', $output['number']);
962
-
963
-    }
964
-
965
-    public function testTwitterWidget() {
966
-
967
-        ob_start();
968
-        $instance = array();
969
-        $instance['gd_tw_desc1'] = 'hello';
970
-        the_widget( 'geodir_twitter', $instance );
971
-        $output = ob_get_contents();
972
-        ob_end_clean();
973
-        $this->assertContains('hello', $output);
974
-
975
-        ob_start();
976
-        $this->the_widget_form( 'geodir_twitter' );
977
-        $output = ob_get_contents();
978
-        ob_end_clean();
979
-        $this->assertContains('Your twitter code', $output);
980
-
981
-        $new_instance = array(
982
-            'gd_tw_desc1' => 'hello'
983
-        );
984
-        $output = $this->the_widget_form_update( 'geodir_twitter', $new_instance );
985
-        $this->assertContains('hello', $output['gd_tw_desc1']);
986
-
987
-    }
988
-
989
-    public function testAdvSearchWidget() {
990
-
991
-        ob_start();
992
-        the_widget( 'geodir_advance_search_widget' );
993
-        $output = ob_get_contents();
994
-        ob_end_clean();
995
-        $this->assertContains('geodir-loc-bar', $output);
996
-
997
-        ob_start();
998
-        $this->the_widget_form( 'geodir_advance_search_widget' );
999
-        $output = ob_get_contents();
1000
-        ob_end_clean();
1001
-        $this->assertContains('This is a search widget', $output);
696
+			$template = geodir_plugin_path() . '/geodirectory-widgets/geodirectory_related_listing_widget.php';
697
+			include_once($template);
698
+
699
+			ob_start();
700
+			the_widget( 'geodir_related_listing_postview' );
701
+			$output = ob_get_contents();
702
+			ob_end_clean();
703
+			$this->assertContains('Related Listing', $output);
704
+
705
+			ob_start();
706
+			$this->the_widget_form( 'geodir_related_listing_postview' );
707
+			$output = ob_get_contents();
708
+			ob_end_clean();
709
+			$this->assertContains('Relate to', $output);
710
+
711
+			$new_instance = array(
712
+				'title' => '',
713
+				'list_sort' => '',
714
+				'list_order' => '',
715
+				'post_number' => '5',
716
+				'relate_to' => '',
717
+				'layout' => 'gridview_onehalf',
718
+				'listing_width' => '',
719
+				'add_location_filter' => '1',
720
+				'character_count' => '20'
721
+			);
722
+			$output = $this->the_widget_form_update( 'geodir_related_listing_postview', $new_instance );
723
+			$this->assertContains('gridview_onehalf', $output['layout']);
724
+		endwhile;
725
+
726
+		$this->assertTrue(is_int($post_id));
727
+
728
+
729
+	}
730
+
731
+	public function testReviewsWidget() {
732
+
733
+		$time = current_time('mysql');
734
+
735
+		$args = array(
736
+			'listing_type' => 'gd_place',
737
+			'post_title' => 'Test Listing Title',
738
+			'post_desc' => 'Test Desc',
739
+			'post_tags' => 'test1,test2',
740
+			'post_address' => 'New York City Hall',
741
+			'post_zip' => '10007',
742
+			'post_latitude' => '40.7127837',
743
+			'post_longitude' => '-74.00594130000002',
744
+			'post_mapview' => 'ROADMAP',
745
+			'post_mapzoom' => '10',
746
+			'geodir_timing' => '10.00 am to 6 pm every day',
747
+			'geodir_contact' => '1234567890',
748
+			'geodir_email' => '[email protected]',
749
+			'geodir_website' => 'http://test.com',
750
+			'geodir_twitter' => 'http://twitter.com/test',
751
+			'geodir_facebook' => 'http://facebook.com/test',
752
+			'geodir_special_offers' => 'Test offer'
753
+		);
754
+		$post_id = geodir_save_listing($args, true);
755
+
756
+		$data = array(
757
+			'comment_post_ID' => $post_id,
758
+			'comment_author' => 'admin',
759
+			'comment_author_email' => '[email protected]',
760
+			'comment_author_url' => 'http://wpgeodirectory.com',
761
+			'comment_content' => 'content here',
762
+			'comment_type' => '',
763
+			'comment_parent' => 0,
764
+			'user_id' => 1,
765
+			'comment_author_IP' => '127.0.0.1',
766
+			'comment_agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 3.5.30729)',
767
+			'comment_date' => $time,
768
+			'comment_approved' => 1,
769
+		);
770
+
771
+		$comment_id = wp_insert_comment($data);
772
+
773
+		$_REQUEST['geodir_overallrating'] = 5.0;
774
+		geodir_save_rating($comment_id);
775
+
776
+		$this->assertTrue(is_int($comment_id));
777
+
778
+		$template = geodir_plugin_path() . '/geodirectory-widgets/geodirectory_reviews_widget.php';
779
+		include_once($template);
780
+
781
+		ob_start();
782
+		the_widget( 'geodir_recent_reviews_widget' );
783
+		$output = ob_get_contents();
784
+		ob_end_clean();
785
+		$this->assertContains('geodir_recent_reviews', $output);
786
+
787
+		ob_start();
788
+		$this->the_widget_form( 'geodir_recent_reviews_widget' );
789
+		$output = ob_get_contents();
790
+		ob_end_clean();
791
+		$this->assertContains('Number of Reviews', $output);
792
+
793
+		$new_instance = array(
794
+			'title' => '',
795
+			't1' => '',
796
+			't2' => '',
797
+			't3' => '',
798
+			'img1' => '',
799
+			'count' => ''
800
+		);
801
+		$output = $this->the_widget_form_update( 'geodir_recent_reviews_widget', $new_instance );
802
+		$this->assertTrue(empty($output['count']));
803
+	}
804
+
805
+	public function testHomeMapWidget() {
806
+		$template = geodir_plugin_path() . '/geodirectory-widgets/home_map_widget.php';
807
+		include_once($template);
808
+
809
+		ob_start();
810
+		$instance = array();
811
+		$args = array();
812
+		$args["widget_id"] = "geodir_map_v3_home_map-2";
813
+		the_widget( 'geodir_homepage_map', $instance, $args );
814
+		$output = ob_get_contents();
815
+		ob_end_clean();
816
+		$this->assertContains('geodir-map-home-page', $output);
817
+
818
+		ob_start();
819
+		$this->the_widget_form( 'geodir_homepage_map' );
820
+		$output = ob_get_contents();
821
+		ob_end_clean();
822
+		$this->assertContains('Map Zoom level', $output);
823
+
824
+		$new_instance = array(
825
+			'width' => '',
826
+			'heigh' => '',
827
+			'maptype' => '',
828
+			'zoom' => '',
829
+			'autozoom' => '',
830
+			'child_collapse' => '0',
831
+			'scrollwheel' => '0'
832
+		);
833
+		$output = $this->the_widget_form_update( 'geodir_homepage_map', $new_instance );
834
+		$this->assertContains('0', $output['scrollwheel']);
835
+
836
+	}
837
+
838
+	public function testLoginWidget() {
839
+
840
+		register_geodir_widgets();
841
+
842
+		ob_start();
843
+		the_widget( 'geodir_loginwidget' );
844
+		$output = ob_get_contents();
845
+		ob_end_clean();
846
+		$this->assertContains('geodir_loginbox', $output);
847
+
848
+		ob_start();
849
+		$this->the_widget_form( 'geodir_loginwidget' );
850
+		$output = ob_get_contents();
851
+		ob_end_clean();
852
+		$this->assertContains('Widget Title', $output);
853
+
854
+		$new_instance = array(
855
+			'title' => 'Login',
856
+			't1' => '',
857
+			't2' => '',
858
+			't3' => '',
859
+			'img1' => '',
860
+			'desc1' => ''
861
+		);
862
+		$output = $this->the_widget_form_update( 'geodir_loginwidget', $new_instance );
863
+		$this->assertContains('Login', $output['title']);
864
+
865
+	}
866
+
867
+	public function testSocialWidget() {
868
+
869
+		ob_start();
870
+		the_widget( 'geodir_social_like_widget' );
871
+		$output = ob_get_contents();
872
+		ob_end_clean();
873
+		$this->assertContains('twitter.com', $output);
874
+
875
+		ob_start();
876
+		$this->the_widget_form( 'geodir_social_like_widget' );
877
+		$output = ob_get_contents();
878
+		ob_end_clean();
879
+		$this->assertContains('No settings for this widget', $output);
880
+
881
+		$new_instance = array(
882
+			'title' => 'Social',
883
+		);
884
+		$output = $this->the_widget_form_update( 'geodir_social_like_widget', $new_instance );
885
+		$this->assertContains('Social', $output['title']);
886
+
887
+	}
888
+
889
+	public function testSubscribeWidget() {
890
+
891
+		ob_start();
892
+		the_widget( 'geodirsubscribeWidget' );
893
+		$output = ob_get_contents();
894
+		ob_end_clean();
895
+		$this->assertContains('geodir-subscribe-form', $output);
896
+
897
+		ob_start();
898
+		$this->the_widget_form( 'geodirsubscribeWidget' );
899
+		$output = ob_get_contents();
900
+		ob_end_clean();
901
+		$this->assertContains('Feedburner ID', $output);
902
+
903
+		$new_instance = array(
904
+			'title' => 'Subscribe',
905
+			'id' => '',
906
+			'advt1' => '',
907
+			'text' => '',
908
+			'twitter' => '',
909
+			'facebook' => '',
910
+			'digg' => '',
911
+			'myspace' => ''
912
+		);
913
+		$output = $this->the_widget_form_update( 'geodirsubscribeWidget', $new_instance );
914
+		$this->assertContains('Subscribe', $output['title']);
915
+
916
+	}
917
+
918
+	public function testAdvWidget() {
919
+
920
+		ob_start();
921
+		$instance = array();
922
+		$instance['desc1'] = 'hello';
923
+		the_widget( 'geodiradvtwidget', $instance );
924
+		$output = ob_get_contents();
925
+		ob_end_clean();
926
+		$this->assertContains('hello', $output);
927
+
928
+		ob_start();
929
+		$this->the_widget_form( 'geodiradvtwidget' );
930
+		$output = ob_get_contents();
931
+		ob_end_clean();
932
+		$this->assertContains('Your Advt code', $output);
933
+
934
+		$new_instance = array(
935
+			'desc1' => 'Advertise'
936
+		);
937
+		$output = $this->the_widget_form_update( 'geodiradvtwidget', $new_instance );
938
+		$this->assertContains('Advertise', $output['desc1']);
939
+
940
+	}
941
+
942
+	public function testFlickrWidget() {
943
+
944
+		ob_start();
945
+		the_widget( 'GeodirFlickrWidget' );
946
+		$output = ob_get_contents();
947
+		ob_end_clean();
948
+		$this->assertContains('geodir-flickr', $output);
949
+
950
+		ob_start();
951
+		$this->the_widget_form( 'GeodirFlickrWidget' );
952
+		$output = ob_get_contents();
953
+		ob_end_clean();
954
+		$this->assertContains('Flickr ID', $output);
955
+
956
+		$new_instance = array(
957
+			'id' => '',
958
+			'number' => '34'
959
+		);
960
+		$output = $this->the_widget_form_update( 'GeodirFlickrWidget', $new_instance );
961
+		$this->assertContains('34', $output['number']);
962
+
963
+	}
964
+
965
+	public function testTwitterWidget() {
966
+
967
+		ob_start();
968
+		$instance = array();
969
+		$instance['gd_tw_desc1'] = 'hello';
970
+		the_widget( 'geodir_twitter', $instance );
971
+		$output = ob_get_contents();
972
+		ob_end_clean();
973
+		$this->assertContains('hello', $output);
974
+
975
+		ob_start();
976
+		$this->the_widget_form( 'geodir_twitter' );
977
+		$output = ob_get_contents();
978
+		ob_end_clean();
979
+		$this->assertContains('Your twitter code', $output);
980
+
981
+		$new_instance = array(
982
+			'gd_tw_desc1' => 'hello'
983
+		);
984
+		$output = $this->the_widget_form_update( 'geodir_twitter', $new_instance );
985
+		$this->assertContains('hello', $output['gd_tw_desc1']);
986
+
987
+	}
988
+
989
+	public function testAdvSearchWidget() {
990
+
991
+		ob_start();
992
+		the_widget( 'geodir_advance_search_widget' );
993
+		$output = ob_get_contents();
994
+		ob_end_clean();
995
+		$this->assertContains('geodir-loc-bar', $output);
996
+
997
+		ob_start();
998
+		$this->the_widget_form( 'geodir_advance_search_widget' );
999
+		$output = ob_get_contents();
1000
+		ob_end_clean();
1001
+		$this->assertContains('This is a search widget', $output);
1002 1002
 
1003 1003
 //        $new_instance = array(
1004 1004
 //        );
1005 1005
 //        $output = $this->the_widget_form_update( 'geodir_advance_search_widget', $new_instance );
1006 1006
 //        $this->assertContains('Subscribe', $output['title']);
1007 1007
 
1008
-    }
1009
-
1010
-    public function testListingMapWidget() {
1011
-
1012
-        $template = geodir_plugin_path() . '/geodirectory-widgets/listing_map_widget.php';
1013
-        include_once($template);
1014
-
1015
-        //listing page
1016
-        $this->go_to( home_url('/?post_type=gd_place') );
1017
-
1018
-        ob_start();
1019
-        $instance = array();
1020
-        $args = array();
1021
-        $args["widget_id"] = "geodir_map_v3_listing_map-2";
1022
-        the_widget( 'geodir_map_listingpage', $instance, $args );
1023
-        $output = ob_get_contents();
1024
-        ob_end_clean();
1025
-        $this->assertContains('geodir-map-listing-page', $output);
1026
-
1027
-        // detail page
1028
-        $query_args = array(
1029
-            'post_status' => 'publish',
1030
-            'post_type' => 'gd_place',
1031
-            'posts_per_page' => 1,
1032
-        );
1033
-
1034
-        $all_posts = new WP_Query( $query_args );
1035
-        $post_id = null;
1036
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
1037
-            $post_id = get_the_ID();
1038
-        endwhile;
1039
-
1040
-        $this->assertTrue(is_int($post_id));
1041
-
1042
-        $this->go_to( get_permalink($post_id) );
1043
-
1044
-        ob_start();
1045
-        $instance = array();
1046
-        $args = array();
1047
-        $args["widget_id"] = "geodir_map_v3_listing_map-2";
1048
-        the_widget( 'geodir_map_listingpage', $instance, $args );
1049
-        $output = ob_get_contents();
1050
-        ob_end_clean();
1051
-        $this->assertContains('geodir-map-listing-page', $output);
1052
-
1053
-        ob_start();
1054
-        $this->the_widget_form( 'geodir_map_listingpage' );
1055
-        $output = ob_get_contents();
1056
-        ob_end_clean();
1057
-        $this->assertContains('Select Map View', $output);
1058
-
1059
-        $new_instance = array(
1060
-            'width' => '',
1061
-            'heigh' => '',
1062
-            'maptype' => '',
1063
-            'zoom' => '',
1064
-            'autozoom' => '',
1065
-            'sticky' => '',
1066
-            'scrollwheel' => '0',
1067
-            'showall' => '0'
1068
-        );
1069
-        $output = $this->the_widget_form_update( 'geodir_map_listingpage', $new_instance );
1070
-        $this->assertContains('0', $output['scrollwheel']);
1071
-
1072
-
1073
-    }
1074
-
1075
-    private function load_template() {
1076
-        do_action( 'template_redirect' );
1077
-        $template = false;
1078
-        if	 ( is_404()			&& $template = get_404_template()			) :
1079
-        elseif ( is_search()		 && $template = get_search_template()		 ) :
1080
-        elseif ( is_front_page()	 && $template = get_front_page_template()	 ) :
1081
-        elseif ( is_home()		   && $template = get_home_template()		   ) :
1082
-        elseif ( is_post_type_archive() && $template = get_post_type_archive_template() ) :
1083
-        elseif ( is_tax()			&& $template = get_taxonomy_template()	   ) :
1084
-        elseif ( is_attachment()	 && $template = get_attachment_template()	 ) :
1085
-            remove_filter('the_content', 'prepend_attachment');
1086
-        elseif ( is_single()		 && $template = get_single_template()		 ) :
1087
-        elseif ( is_page()		   && $template = get_page_template()		   ) :
1088
-        elseif ( is_category()	   && $template = get_category_template()	   ) :
1089
-        elseif ( is_tag()			&& $template = get_tag_template()			) :
1090
-        elseif ( is_author()		 && $template = get_author_template()		 ) :
1091
-        elseif ( is_date()		   && $template = get_date_template()		   ) :
1092
-        elseif ( is_archive()		&& $template = get_archive_template()		) :
1093
-        elseif ( is_paged()		  && $template = get_paged_template()		  ) :
1094
-        else :
1095
-            $template = get_index_template();
1096
-        endif;
1097
-        /**
1098
-         * Filter the path of the current template before including it.
1099
-         *
1100
-         * @since 3.0.0
1101
-         *
1102
-         * @param string $template The path of the template to include.
1103
-         */
1104
-        if ( $template = apply_filters( 'template_include', $template ) ) {
1105
-            $template_contents = file_get_contents( $template );
1106
-            $included_header = $included_footer = false;
1107
-            if ( false !== stripos( $template_contents, 'get_header();' ) ) {
1108
-                do_action( 'get_header', null );
1109
-                locate_template( 'header.php', true, false );
1110
-                $included_header = true;
1111
-            }
1112
-            include( $template );
1113
-            if ( false !== stripos( $template_contents, 'get_footer();' ) ) {
1114
-                do_action( 'get_footer', null );
1115
-                locate_template( 'footer.php', true, false );
1116
-                $included_footer = true;
1117
-            }
1118
-            if ( $included_header && $included_footer ) {
1119
-                global $wp_scripts;
1120
-                $wp_scripts->done = array();
1121
-            }
1122
-        }
1123
-        return;
1124
-    }
1125
-
1126
-    public static function setPermalinkStructure( $struc = '/%postname%/' ) {
1127
-        global $wp_rewrite;
1128
-        $wp_rewrite->set_permalink_structure( $struc );
1129
-        $wp_rewrite->flush_rules();
1130
-        update_option( 'permalink_structure', $struc );
1131
-        flush_rewrite_rules( true );
1132
-    }
1133
-
1134
-    function the_widget_form( $widget, $instance = array() ) {
1135
-        global $wp_widget_factory;
1136
-
1137
-        $widget_obj = $wp_widget_factory->widgets[$widget];
1138
-        if ( ! ( $widget_obj instanceof WP_Widget ) ) {
1139
-            return;
1140
-        }
1141
-
1142
-        $widget_obj->_set(-1);
1143
-        $widget_obj->form($instance);
1144
-    }
1145
-
1146
-    function the_widget_form_update( $widget, $new_instance = array(), $old_instance = array() ) {
1147
-        global $wp_widget_factory;
1148
-
1149
-        $widget_obj = $wp_widget_factory->widgets[$widget];
1150
-        if ( ! ( $widget_obj instanceof WP_Widget ) ) {
1151
-            return;
1152
-        }
1153
-
1154
-        $widget_obj->_set(-1);
1155
-        return $widget_obj->update($new_instance, $old_instance);
1156
-    }
1157
-
1158
-
1159
-    public function tearDown()
1160
-    {
1161
-        parent::tearDown();
1162
-    }
1008
+	}
1009
+
1010
+	public function testListingMapWidget() {
1011
+
1012
+		$template = geodir_plugin_path() . '/geodirectory-widgets/listing_map_widget.php';
1013
+		include_once($template);
1014
+
1015
+		//listing page
1016
+		$this->go_to( home_url('/?post_type=gd_place') );
1017
+
1018
+		ob_start();
1019
+		$instance = array();
1020
+		$args = array();
1021
+		$args["widget_id"] = "geodir_map_v3_listing_map-2";
1022
+		the_widget( 'geodir_map_listingpage', $instance, $args );
1023
+		$output = ob_get_contents();
1024
+		ob_end_clean();
1025
+		$this->assertContains('geodir-map-listing-page', $output);
1026
+
1027
+		// detail page
1028
+		$query_args = array(
1029
+			'post_status' => 'publish',
1030
+			'post_type' => 'gd_place',
1031
+			'posts_per_page' => 1,
1032
+		);
1033
+
1034
+		$all_posts = new WP_Query( $query_args );
1035
+		$post_id = null;
1036
+		while ( $all_posts->have_posts() ) : $all_posts->the_post();
1037
+			$post_id = get_the_ID();
1038
+		endwhile;
1039
+
1040
+		$this->assertTrue(is_int($post_id));
1041
+
1042
+		$this->go_to( get_permalink($post_id) );
1043
+
1044
+		ob_start();
1045
+		$instance = array();
1046
+		$args = array();
1047
+		$args["widget_id"] = "geodir_map_v3_listing_map-2";
1048
+		the_widget( 'geodir_map_listingpage', $instance, $args );
1049
+		$output = ob_get_contents();
1050
+		ob_end_clean();
1051
+		$this->assertContains('geodir-map-listing-page', $output);
1052
+
1053
+		ob_start();
1054
+		$this->the_widget_form( 'geodir_map_listingpage' );
1055
+		$output = ob_get_contents();
1056
+		ob_end_clean();
1057
+		$this->assertContains('Select Map View', $output);
1058
+
1059
+		$new_instance = array(
1060
+			'width' => '',
1061
+			'heigh' => '',
1062
+			'maptype' => '',
1063
+			'zoom' => '',
1064
+			'autozoom' => '',
1065
+			'sticky' => '',
1066
+			'scrollwheel' => '0',
1067
+			'showall' => '0'
1068
+		);
1069
+		$output = $this->the_widget_form_update( 'geodir_map_listingpage', $new_instance );
1070
+		$this->assertContains('0', $output['scrollwheel']);
1071
+
1072
+
1073
+	}
1074
+
1075
+	private function load_template() {
1076
+		do_action( 'template_redirect' );
1077
+		$template = false;
1078
+		if	 ( is_404()			&& $template = get_404_template()			) :
1079
+		elseif ( is_search()		 && $template = get_search_template()		 ) :
1080
+		elseif ( is_front_page()	 && $template = get_front_page_template()	 ) :
1081
+		elseif ( is_home()		   && $template = get_home_template()		   ) :
1082
+		elseif ( is_post_type_archive() && $template = get_post_type_archive_template() ) :
1083
+		elseif ( is_tax()			&& $template = get_taxonomy_template()	   ) :
1084
+		elseif ( is_attachment()	 && $template = get_attachment_template()	 ) :
1085
+			remove_filter('the_content', 'prepend_attachment');
1086
+		elseif ( is_single()		 && $template = get_single_template()		 ) :
1087
+		elseif ( is_page()		   && $template = get_page_template()		   ) :
1088
+		elseif ( is_category()	   && $template = get_category_template()	   ) :
1089
+		elseif ( is_tag()			&& $template = get_tag_template()			) :
1090
+		elseif ( is_author()		 && $template = get_author_template()		 ) :
1091
+		elseif ( is_date()		   && $template = get_date_template()		   ) :
1092
+		elseif ( is_archive()		&& $template = get_archive_template()		) :
1093
+		elseif ( is_paged()		  && $template = get_paged_template()		  ) :
1094
+		else :
1095
+			$template = get_index_template();
1096
+		endif;
1097
+		/**
1098
+		 * Filter the path of the current template before including it.
1099
+		 *
1100
+		 * @since 3.0.0
1101
+		 *
1102
+		 * @param string $template The path of the template to include.
1103
+		 */
1104
+		if ( $template = apply_filters( 'template_include', $template ) ) {
1105
+			$template_contents = file_get_contents( $template );
1106
+			$included_header = $included_footer = false;
1107
+			if ( false !== stripos( $template_contents, 'get_header();' ) ) {
1108
+				do_action( 'get_header', null );
1109
+				locate_template( 'header.php', true, false );
1110
+				$included_header = true;
1111
+			}
1112
+			include( $template );
1113
+			if ( false !== stripos( $template_contents, 'get_footer();' ) ) {
1114
+				do_action( 'get_footer', null );
1115
+				locate_template( 'footer.php', true, false );
1116
+				$included_footer = true;
1117
+			}
1118
+			if ( $included_header && $included_footer ) {
1119
+				global $wp_scripts;
1120
+				$wp_scripts->done = array();
1121
+			}
1122
+		}
1123
+		return;
1124
+	}
1125
+
1126
+	public static function setPermalinkStructure( $struc = '/%postname%/' ) {
1127
+		global $wp_rewrite;
1128
+		$wp_rewrite->set_permalink_structure( $struc );
1129
+		$wp_rewrite->flush_rules();
1130
+		update_option( 'permalink_structure', $struc );
1131
+		flush_rewrite_rules( true );
1132
+	}
1133
+
1134
+	function the_widget_form( $widget, $instance = array() ) {
1135
+		global $wp_widget_factory;
1136
+
1137
+		$widget_obj = $wp_widget_factory->widgets[$widget];
1138
+		if ( ! ( $widget_obj instanceof WP_Widget ) ) {
1139
+			return;
1140
+		}
1141
+
1142
+		$widget_obj->_set(-1);
1143
+		$widget_obj->form($instance);
1144
+	}
1145
+
1146
+	function the_widget_form_update( $widget, $new_instance = array(), $old_instance = array() ) {
1147
+		global $wp_widget_factory;
1148
+
1149
+		$widget_obj = $wp_widget_factory->widgets[$widget];
1150
+		if ( ! ( $widget_obj instanceof WP_Widget ) ) {
1151
+			return;
1152
+		}
1153
+
1154
+		$widget_obj->_set(-1);
1155
+		return $widget_obj->update($new_instance, $old_instance);
1156
+	}
1157
+
1158
+
1159
+	public function tearDown()
1160
+	{
1161
+		parent::tearDown();
1162
+	}
1163 1163
 }
1164 1164
 ?>
1165 1165
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-admin/admin_functions.php 1 patch
Spacing   +902 added lines, -902 removed lines patch added patch discarded remove patch
@@ -46,31 +46,31 @@  discard block
 block discarded – undo
46 46
     function geodir_admin_styles()
47 47
     {
48 48
 
49
-        wp_register_style('geodirectory-admin-css', geodir_plugin_url() . '/geodirectory-assets/css/admin.css', array(), GEODIRECTORY_VERSION);
49
+        wp_register_style('geodirectory-admin-css', geodir_plugin_url().'/geodirectory-assets/css/admin.css', array(), GEODIRECTORY_VERSION);
50 50
         wp_enqueue_style('geodirectory-admin-css');
51 51
 
52
-        wp_register_style('geodirectory-frontend-style', geodir_plugin_url() . '/geodirectory-assets/css/style.css', array(), GEODIRECTORY_VERSION);
52
+        wp_register_style('geodirectory-frontend-style', geodir_plugin_url().'/geodirectory-assets/css/style.css', array(), GEODIRECTORY_VERSION);
53 53
         wp_enqueue_style('geodirectory-frontend-style');
54 54
 
55
-        wp_register_style('geodir-chosen-style', geodir_plugin_url() . '/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION);
55
+        wp_register_style('geodir-chosen-style', geodir_plugin_url().'/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION);
56 56
         wp_enqueue_style('geodir-chosen-style');
57 57
 
58
-        wp_register_style('geodirectory-jquery-ui-timepicker-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery.ui.timepicker.css', array(), GEODIRECTORY_VERSION);
58
+        wp_register_style('geodirectory-jquery-ui-timepicker-css', geodir_plugin_url().'/geodirectory-assets/css/jquery.ui.timepicker.css', array(), GEODIRECTORY_VERSION);
59 59
         wp_enqueue_style('geodirectory-jquery-ui-timepicker-css');
60 60
 
61
-        wp_register_style('geodirectory-jquery-ui-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery-ui.css', array(), GEODIRECTORY_VERSION);
61
+        wp_register_style('geodirectory-jquery-ui-css', geodir_plugin_url().'/geodirectory-assets/css/jquery-ui.css', array(), GEODIRECTORY_VERSION);
62 62
         wp_enqueue_style('geodirectory-jquery-ui-css');
63 63
 
64
-        wp_register_style('geodirectory-custom-fields-css', geodir_plugin_url() . '/geodirectory-assets/css/custom_field.css', array(), GEODIRECTORY_VERSION);
64
+        wp_register_style('geodirectory-custom-fields-css', geodir_plugin_url().'/geodirectory-assets/css/custom_field.css', array(), GEODIRECTORY_VERSION);
65 65
         wp_enqueue_style('geodirectory-custom-fields-css');
66 66
 
67
-        wp_register_style('geodirectory-pluplodar-css', geodir_plugin_url() . '/geodirectory-assets/css/pluploader.css', array(), GEODIRECTORY_VERSION);
67
+        wp_register_style('geodirectory-pluplodar-css', geodir_plugin_url().'/geodirectory-assets/css/pluploader.css', array(), GEODIRECTORY_VERSION);
68 68
         wp_enqueue_style('geodirectory-pluplodar-css');
69 69
 
70
-        wp_register_style('geodir-rating-style', geodir_plugin_url() . '/geodirectory-assets/css/jRating.jquery.css', array(), GEODIRECTORY_VERSION);
70
+        wp_register_style('geodir-rating-style', geodir_plugin_url().'/geodirectory-assets/css/jRating.jquery.css', array(), GEODIRECTORY_VERSION);
71 71
         wp_enqueue_style('geodir-rating-style');
72 72
 
73
-        wp_register_style('geodir-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl.css', array(), GEODIRECTORY_VERSION);
73
+        wp_register_style('geodir-rtl-style', geodir_plugin_url().'/geodirectory-assets/css/rtl.css', array(), GEODIRECTORY_VERSION);
74 74
         wp_enqueue_style('geodir-rtl-style');
75 75
 
76 76
     }
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
         wp_register_style('geodirectory-font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION);
90 90
         wp_enqueue_style('geodirectory-font-awesome');
91 91
 
92
-        wp_register_script('geodirectory-admin', geodir_plugin_url() . '/geodirectory-assets/js/admin-req.min.js', array('jquery'), GEODIRECTORY_VERSION);
92
+        wp_register_script('geodirectory-admin', geodir_plugin_url().'/geodirectory-assets/js/admin-req.min.js', array('jquery'), GEODIRECTORY_VERSION);
93 93
         wp_enqueue_script('geodirectory-admin');
94 94
 
95 95
     }
@@ -108,59 +108,59 @@  discard block
 block discarded – undo
108 108
         
109 109
         wp_enqueue_script('jquery');
110 110
 
111
-        wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), '', true);
111
+        wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.ui.timepicker.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), '', true);
112 112
 
113
-        wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.js', array(), GEODIRECTORY_VERSION);
113
+        wp_register_script('chosen', geodir_plugin_url().'/geodirectory-assets/js/chosen.jquery.js', array(), GEODIRECTORY_VERSION);
114 114
         wp_enqueue_script('chosen');
115 115
 
116
-        wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.js', array(), GEODIRECTORY_VERSION);
116
+        wp_register_script('geodirectory-choose-ajax', geodir_plugin_url().'/geodirectory-assets/js/ajax-chosen.js', array(), GEODIRECTORY_VERSION);
117 117
         wp_enqueue_script('geodirectory-choose-ajax');
118 118
 
119 119
         if (isset($_REQUEST['listing_type'])) {
120
-            wp_register_script('geodirectory-custom-fields-script', geodir_plugin_url() . '/geodirectory-assets/js/custom_fields.js', array(), GEODIRECTORY_VERSION);
120
+            wp_register_script('geodirectory-custom-fields-script', geodir_plugin_url().'/geodirectory-assets/js/custom_fields.js', array(), GEODIRECTORY_VERSION);
121 121
         }
122 122
 
123 123
         wp_enqueue_script('geodirectory-custom-fields-script');
124
-        $plugin_path = geodir_plugin_url() . '/geodirectory-functions/cat-meta-functions';
124
+        $plugin_path = geodir_plugin_url().'/geodirectory-functions/cat-meta-functions';
125 125
 
126
-        wp_enqueue_script('tax-meta-clss', $plugin_path . '/js/tax-meta-clss.js', array('jquery'), null, true);
126
+        wp_enqueue_script('tax-meta-clss', $plugin_path.'/js/tax-meta-clss.js', array('jquery'), null, true);
127 127
 
128 128
         if (in_array($geodir_map_name, array('auto', 'google'))) {
129
-            $map_lang = "&language=" . geodir_get_map_default_language();
129
+            $map_lang = "&language=".geodir_get_map_default_language();
130 130
             /** This filter is documented in geodirectory_template_tags.php */
131 131
             $map_extra = apply_filters('geodir_googlemap_script_extra', '');
132
-            wp_enqueue_script('geodirectory-googlemap-script', '//maps.google.com/maps/api/js?' . $map_lang . $map_extra, '', NULL);
132
+            wp_enqueue_script('geodirectory-googlemap-script', '//maps.google.com/maps/api/js?'.$map_lang.$map_extra, '', NULL);
133 133
         }
134 134
         
135 135
         if ($geodir_map_name == 'osm') {
136 136
             // Leaflet OpenStreetMap
137
-            wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
137
+            wp_register_style('geodirectory-leaflet-style', geodir_plugin_url().'/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
138 138
             wp_enqueue_style('geodirectory-leaflet-style');
139 139
                 
140
-            wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
140
+            wp_register_script('geodirectory-leaflet-script', geodir_plugin_url().'/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
141 141
             wp_enqueue_script('geodirectory-leaflet-script');
142 142
             
143
-            wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.js', array('geodirectory-leaflet-script'), GEODIRECTORY_VERSION);
143
+            wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url().'/geodirectory-assets/leaflet/osm.geocode.js', array('geodirectory-leaflet-script'), GEODIRECTORY_VERSION);
144 144
             wp_enqueue_script('geodirectory-leaflet-geo-script');
145 145
         }
146
-        wp_enqueue_script( 'jquery-ui-autocomplete' );
146
+        wp_enqueue_script('jquery-ui-autocomplete');
147 147
         
148
-        wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true);
148
+        wp_register_script('geodirectory-goMap-script', geodir_plugin_url().'/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true);
149 149
         wp_enqueue_script('geodirectory-goMap-script');
150 150
 
151
-        wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.js', array(), GEODIRECTORY_VERSION);
151
+        wp_register_script('geodirectory-goMap-script', geodir_plugin_url().'/geodirectory-assets/js/goMap.js', array(), GEODIRECTORY_VERSION);
152 152
         wp_enqueue_script('geodirectory-goMap-script');
153 153
 
154 154
 		// font awesome rating script
155 155
 		if (get_option('geodir_reviewrating_enable_font_awesome')) {
156
-			wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION);
156
+			wp_register_script('geodir-barrating-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION);
157 157
 			wp_enqueue_script('geodir-barrating-js');
158 158
 		} else { // default rating script
159
-			wp_register_script('geodir-jRating-js', geodir_plugin_url() . '/geodirectory-assets/js/jRating.jquery.js', array(), GEODIRECTORY_VERSION);
159
+			wp_register_script('geodir-jRating-js', geodir_plugin_url().'/geodirectory-assets/js/jRating.jquery.js', array(), GEODIRECTORY_VERSION);
160 160
 			wp_enqueue_script('geodir-jRating-js');
161 161
 		}
162 162
 
163
-        wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.js', array(), GEODIRECTORY_VERSION);
163
+        wp_register_script('geodir-on-document-load', geodir_plugin_url().'/geodirectory-assets/js/on_document_load.js', array(), GEODIRECTORY_VERSION);
164 164
         wp_enqueue_script('geodir-on-document-load');
165 165
 
166 166
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
         wp_enqueue_script('plupload-all');
169 169
         wp_enqueue_script('jquery-ui-sortable');
170 170
 
171
-        wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.js', array(), GEODIRECTORY_VERSION);
171
+        wp_register_script('geodirectory-plupload-script', geodir_plugin_url().'/geodirectory-assets/js/geodirectory-plupload.js', array(), GEODIRECTORY_VERSION);
172 172
         wp_enqueue_script('geodirectory-plupload-script');
173 173
 
174 174
         // SCRIPT FOR UPLOAD END
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
         wp_localize_script('geodirectory-custom-fields-script', 'geodir_admin_ajax', $ajax_cons_data);
223 223
 
224 224
 
225
-        wp_register_script('geodirectory-admin-script', geodir_plugin_url() . '/geodirectory-assets/js/admin.js', array(), GEODIRECTORY_VERSION);
225
+        wp_register_script('geodirectory-admin-script', geodir_plugin_url().'/geodirectory-assets/js/admin.js', array(), GEODIRECTORY_VERSION);
226 226
         wp_enqueue_script('geodirectory-admin-script');
227 227
 
228 228
         wp_enqueue_style('farbtastic');
@@ -230,10 +230,10 @@  discard block
 block discarded – undo
230 230
 
231 231
         $screen = get_current_screen();
232 232
         if ($screen->base == 'post' && in_array($screen->post_type, geodir_get_posttypes())) {
233
-            wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation_admin.js');
233
+            wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url().'/geodirectory-assets/js/listing_validation_admin.js');
234 234
         }
235 235
 
236
-        $ajax_cons_data = array('url' => __(get_option('siteurl') . '?geodir_ajax=true'));
236
+        $ajax_cons_data = array('url' => __(get_option('siteurl').'?geodir_ajax=true'));
237 237
         wp_localize_script('geodirectory-admin-script', 'geodir_ajax', $ajax_cons_data);
238 238
 
239 239
     }
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 
257 257
         if (current_user_can('manage_options')) $menu[] = array('', 'read', 'separator-geodirectory', '', 'wp-menu-separator geodirectory');
258 258
 
259
-        add_menu_page(__('Geodirectory', 'geodirectory'), __('Geodirectory', 'geodirectory'), 'manage_options', 'geodirectory', 'geodir_admin_panel', geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico', '55.1984');
259
+        add_menu_page(__('Geodirectory', 'geodirectory'), __('Geodirectory', 'geodirectory'), 'manage_options', 'geodirectory', 'geodir_admin_panel', geodir_plugin_url().'/geodirectory-assets/images/favicon.ico', '55.1984');
260 260
 
261 261
 
262 262
     }
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
                 $geodir_menu_order[] = 'separator-geodirectory';
291 291
                 if (!empty($post_types)) {
292 292
                     foreach ($post_types as $post_type) {
293
-                        $geodir_menu_order[] = 'edit.php?post_type=' . $post_type;
293
+                        $geodir_menu_order[] = 'edit.php?post_type='.$post_type;
294 294
                     }
295 295
                 }
296 296
                 $geodir_menu_order[] = $item;
@@ -333,8 +333,8 @@  discard block
 block discarded – undo
333 333
 {
334 334
     if (isset($_REQUEST['installed']) && $_REQUEST['installed'] != '') {
335 335
         echo '<div id="message" class="updated fade">
336
-                        <p style="float:right;">' . __('Like Geodirectory?', 'geodirectory') . ' <a href="http://wordpress.org/extend/plugins/Geodirectory/" target="_blank">' . __('Support us by leaving a rating!', 'geodirectory') . '</a></p>
337
-                        <p><strong>' . __('Geodirectory has been installed and setup. Enjoy :)', 'geodirectory') . '</strong></p>
336
+                        <p style="float:right;">' . __('Like Geodirectory?', 'geodirectory').' <a href="http://wordpress.org/extend/plugins/Geodirectory/" target="_blank">'.__('Support us by leaving a rating!', 'geodirectory').'</a></p>
337
+                        <p><strong>' . __('Geodirectory has been installed and setup. Enjoy :)', 'geodirectory').'</strong></p>
338 338
                 </div>';
339 339
 
340 340
     }
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
     if (isset($_REQUEST['msg']) && $_REQUEST['msg'] != '') {
343 343
         switch ($_REQUEST['msg']) {
344 344
             case 'success':
345
-                echo '<div id="message" class="updated fade"><p><strong>' . __('Your settings have been saved.', 'geodirectory') . '</strong></p></div>';
345
+                echo '<div id="message" class="updated fade"><p><strong>'.__('Your settings have been saved.', 'geodirectory').'</strong></p></div>';
346 346
                 flush_rewrite_rules(false);
347 347
 
348 348
                 break;
@@ -350,20 +350,20 @@  discard block
 block discarded – undo
350 350
 				$gderr = isset($_REQUEST['gderr']) ? $_REQUEST['gderr'] : '';
351 351
 				
352 352
 				if ($gderr == 21)
353
-			    	echo '<div id="message" class="error fade"><p><strong>' . __('Error: You can not add same permalinks for both Listing and Location, please try again.', 'geodirectory') . '</strong></p></div>';
353
+			    	echo '<div id="message" class="error fade"><p><strong>'.__('Error: You can not add same permalinks for both Listing and Location, please try again.', 'geodirectory').'</strong></p></div>';
354 354
 				else
355
-					echo '<div id="message" class="error fade"><p><strong>' . __('Error: Your settings have not been saved, please try again.', 'geodirectory') . '</strong></p></div>';
355
+					echo '<div id="message" class="error fade"><p><strong>'.__('Error: Your settings have not been saved, please try again.', 'geodirectory').'</strong></p></div>';
356 356
                 break;
357 357
         }
358 358
     }
359 359
 
360 360
     if (!geodir_is_default_location_set()) {
361
-        echo '<div class="updated fade"><p><strong>' . sprintf(__('Please %sclick here%s to set a default location, this will make the plugin work properly.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>') . '</strong></p></div>';
361
+        echo '<div class="updated fade"><p><strong>'.sprintf(__('Please %sclick here%s to set a default location, this will make the plugin work properly.', 'geodirectory'), '<a href=\''.admin_url('admin.php?page=geodirectory&tab=default_location_settings').'\'>', '</a>').'</strong></p></div>';
362 362
 
363 363
     }
364 364
 
365 365
     if (!function_exists('curl_init')) {
366
-        echo '<div class="error"><p><strong>' . __('CURL is not installed on this server, this can cause problems, please ask your server admin to install it.', 'geodirectory') . '</strong></p></div>';
366
+        echo '<div class="error"><p><strong>'.__('CURL is not installed on this server, this can cause problems, please ask your server admin to install it.', 'geodirectory').'</strong></p></div>';
367 367
 
368 368
     }
369 369
 }
@@ -379,18 +379,18 @@  discard block
 block discarded – undo
379 379
 function geodir_handle_option_form_submit($current_tab)
380 380
 {
381 381
     global $geodir_settings;
382
-    if (file_exists(dirname(__FILE__) . '/option-pages/' . $current_tab . '_array.php')) {
382
+    if (file_exists(dirname(__FILE__).'/option-pages/'.$current_tab.'_array.php')) {
383 383
         /**
384 384
          * Contains settings array for current tab.
385 385
          *
386 386
          * @since 1.0.0
387 387
          * @package GeoDirectory
388 388
          */
389
-        include_once('option-pages/' . $current_tab . '_array.php');
389
+        include_once('option-pages/'.$current_tab.'_array.php');
390 390
     }
391 391
     if (isset($_POST) && $_POST && isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') :
392 392
         if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
393
-        if (!wp_verify_nonce($_REQUEST['_wpnonce-' . $current_tab], 'geodir-settings-' . $current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
393
+        if (!wp_verify_nonce($_REQUEST['_wpnonce-'.$current_tab], 'geodir-settings-'.$current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
394 394
 		
395 395
 		/**
396 396
 		 * Fires before updating geodirectory admin settings.
@@ -423,13 +423,13 @@  discard block
 block discarded – undo
423 423
          * @param string $current_tab The current settings tab name.
424 424
          * @param array $geodir_settings[$current_tab] The array of settings for the current settings tab.
425 425
          */
426
-        do_action('geodir_update_options_' . $current_tab, $geodir_settings[$current_tab]);
426
+        do_action('geodir_update_options_'.$current_tab, $geodir_settings[$current_tab]);
427 427
 
428 428
         flush_rewrite_rules(false);
429 429
 
430 430
         $current_tab = isset($_REQUEST['tab']) ? $_REQUEST['tab'] : '';
431 431
 
432
-        $redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $_REQUEST['active_tab'] . '&msg=success');
432
+        $redirect_url = admin_url('admin.php?page=geodirectory&tab='.$current_tab.'&active_tab='.$_REQUEST['active_tab'].'&msg=success');
433 433
 
434 434
         wp_redirect($redirect_url);
435 435
         exit();
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 }
440 440
 
441 441
 
442
-if (!function_exists('geodir_autoinstall_admin_header') && (get_option('geodir_installed') || defined( 'GD_TESTING_MODE' ))) {
442
+if (!function_exists('geodir_autoinstall_admin_header') && (get_option('geodir_installed') || defined('GD_TESTING_MODE'))) {
443 443
     /**
444 444
      * GeoDirectory dummy data installation.
445 445
      *
@@ -455,18 +455,18 @@  discard block
 block discarded – undo
455 455
         global $wpdb, $plugin_prefix;
456 456
 
457 457
         if (!geodir_is_default_location_set()) {
458
-            echo '<div class="updated fade"><p><strong>' . sprintf(__('Please %sclick here%s to set a default location, this will help to set location of all dummy data.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>') . '</strong></p></div>';
458
+            echo '<div class="updated fade"><p><strong>'.sprintf(__('Please %sclick here%s to set a default location, this will help to set location of all dummy data.', 'geodirectory'), '<a href=\''.admin_url('admin.php?page=geodirectory&tab=default_location_settings').'\'>', '</a>').'</strong></p></div>';
459 459
         } else {
460 460
 
461
-            $geodir_url = admin_url() . 'admin.php?page=geodirectory&tab=general_settings&active_tab=';
461
+            $geodir_url = admin_url().'admin.php?page=geodirectory&tab=general_settings&active_tab=';
462 462
 
463
-            $post_counts = $wpdb->get_var("SELECT count(post_id) FROM " . $plugin_prefix . $post_type . "_detail WHERE post_dummy='1'");
463
+            $post_counts = $wpdb->get_var("SELECT count(post_id) FROM ".$plugin_prefix.$post_type."_detail WHERE post_dummy='1'");
464 464
 
465 465
             if ($post_counts > 0) {
466 466
                 $nonce = wp_create_nonce('geodir_dummy_posts_delete_noncename');
467 467
 
468
-                $dummy_msg = '<div id="" class="geodir_auto_install updated highlight fade"><p><b>' . SAMPLE_DATA_SHOW_MSG . '</b><br /><a id="geodir_dummy_delete" class="button_delete" onclick="geodir_autoinstall(this,\'geodir_dummy_delete\',\'' . $nonce . '\',\'' . $post_type . '\')" href="javascript:void(0);" redirect_to="' . $geodir_url . '"  >' . DELETE_BTN_SAMPLE_MSG . '</a></p></div>';
469
-                $dummy_msg .= '<div id="" style="display:none;" class="geodir_show_progress updated highlight fade"><p><b>' . GEODIR_SAMPLE_DATA_DELETE_MSG . '</b><br><img src="' . geodir_plugin_url() . '/geodirectory-assets/images/loadingAnimation.gif" /></p></div>';
468
+                $dummy_msg = '<div id="" class="geodir_auto_install updated highlight fade"><p><b>'.SAMPLE_DATA_SHOW_MSG.'</b><br /><a id="geodir_dummy_delete" class="button_delete" onclick="geodir_autoinstall(this,\'geodir_dummy_delete\',\''.$nonce.'\',\''.$post_type.'\')" href="javascript:void(0);" redirect_to="'.$geodir_url.'"  >'.DELETE_BTN_SAMPLE_MSG.'</a></p></div>';
469
+                $dummy_msg .= '<div id="" style="display:none;" class="geodir_show_progress updated highlight fade"><p><b>'.GEODIR_SAMPLE_DATA_DELETE_MSG.'</b><br><img src="'.geodir_plugin_url().'/geodirectory-assets/images/loadingAnimation.gif" /></p></div>';
470 470
             } else {
471 471
                 $options_list = '';
472 472
                 for ($option = 1; $option <= 30; $option++) {
@@ -474,13 +474,13 @@  discard block
 block discarded – undo
474 474
                     if ($option == 10)
475 475
                         $selected = 'selected="selected"';
476 476
 
477
-                    $options_list .= '<option ' . $selected . ' value="' . $option . '">' . $option . '</option>';
477
+                    $options_list .= '<option '.$selected.' value="'.$option.'">'.$option.'</option>';
478 478
                 }
479 479
 
480 480
                 $nonce = wp_create_nonce('geodir_dummy_posts_insert_noncename');
481 481
 
482
-                $dummy_msg = '<div id="" class="geodir_auto_install updated highlight fade"><p><b>' . AUTO_INSATALL_MSG . '</b><br /><select class="selected_sample_data">' . $options_list . '</select><a id="geodir_dummy_insert" class="button_insert" href="javascript:void(0);" onclick="geodir_autoinstall(this,\'geodir_dummy_insert\',\'' . $nonce . '\',\'' . $post_type . '\')"   redirect_to="' . $geodir_url . '" >' . INSERT_BTN_SAMPLE_MSG . '</a></p></div>';
483
-                $dummy_msg .= '<div id="" style="display:none;" class="geodir_show_progress updated highlight fade"><p><b>' . GEODIR_SAMPLE_DATA_IMPORT_MSG . '</b><br><img src="' . geodir_plugin_url() . '/geodirectory-assets/images/loadingAnimation.gif" /><br><span class="dummy_post_inserted"></span></div>';
482
+                $dummy_msg = '<div id="" class="geodir_auto_install updated highlight fade"><p><b>'.AUTO_INSATALL_MSG.'</b><br /><select class="selected_sample_data">'.$options_list.'</select><a id="geodir_dummy_insert" class="button_insert" href="javascript:void(0);" onclick="geodir_autoinstall(this,\'geodir_dummy_insert\',\''.$nonce.'\',\''.$post_type.'\')"   redirect_to="'.$geodir_url.'" >'.INSERT_BTN_SAMPLE_MSG.'</a></p></div>';
483
+                $dummy_msg .= '<div id="" style="display:none;" class="geodir_show_progress updated highlight fade"><p><b>'.GEODIR_SAMPLE_DATA_IMPORT_MSG.'</b><br><img src="'.geodir_plugin_url().'/geodirectory-assets/images/loadingAnimation.gif" /><br><span class="dummy_post_inserted"></span></div>';
484 484
 
485 485
             }
486 486
             echo $dummy_msg;
@@ -488,14 +488,14 @@  discard block
 block discarded – undo
488 488
             <script>
489 489
                 <?php
490 490
                   $default_location = geodir_get_default_location();
491
-                  $city =  isset($default_location->city) ? $default_location->city : '';
492
-                  $region =isset($default_location->region) ? $default_location->region : '';
493
-                  $country =isset($default_location->country) ? $default_location->country : '';
494
-                  $city_latitude =isset($default_location->city_latitude) ? $default_location->city_latitude : '';
495
-                  $city_longitude =isset($default_location->city_longitude) ? $default_location->city_longitude : '';
491
+                  $city = isset($default_location->city) ? $default_location->city : '';
492
+                  $region = isset($default_location->region) ? $default_location->region : '';
493
+                  $country = isset($default_location->country) ? $default_location->country : '';
494
+                  $city_latitude = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
495
+                  $city_longitude = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
496 496
                 ?>
497 497
                 var geocoder = window.gdMaps == 'google' ? new google.maps.Geocoder() : null;
498
-                var CITY_ADDRESS = '<?php echo $city.','.$region.','.$country;?>';
498
+                var CITY_ADDRESS = '<?php echo $city.','.$region.','.$country; ?>';
499 499
                 var bound_lat_lng;
500 500
                 var latlng = ['<?php echo $city_latitude; ?>', <?php echo $city_longitude; ?>];
501 501
                 var lat = <?php echo $city_latitude; ?>;
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
                                 );
539 539
 
540 540
                             } else {
541
-                                alert("<?php _e('Geocode was not successful for the following reason:','geodirectory');?> " + status);
541
+                                alert("<?php _e('Geocode was not successful for the following reason:', 'geodirectory'); ?> " + status);
542 542
                             }
543 543
                         });
544 544
                 }
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
                     var total_dummy_post_count = jQuery('#sub_' + active_tab).find('.selected_sample_data').val();
552 552
 
553 553
                     if (id == 'geodir_dummy_delete') {
554
-                        if (confirm('<?php _e('Are you sure you want to delete dummy data?' , 'geodirectory'); ?>')) {
554
+                        if (confirm('<?php _e('Are you sure you want to delete dummy data?', 'geodirectory'); ?>')) {
555 555
                             jQuery('#sub_' + active_tab).find('.geodir_auto_install').hide();
556 556
                             jQuery('#sub_' + active_tab).find('.geodir_show_progress').show();
557 557
                             jQuery.post('<?php echo geodir_get_ajax_url(); ?>&geodir_autofill=' + id + '&posttype=' + posttype + '&_wpnonce=' + nonce,
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
                         jQuery.post('<?php echo geodir_get_ajax_url(); ?>&geodir_autofill=' + id + '&posttype=' + posttype + '&insert_dummy_post_index=' + dummy_post_index + '&city_bound_lat1=' + bound_lat_lng[0] + '&city_bound_lng1=' + bound_lat_lng[1] + '&city_bound_lat2=' + bound_lat_lng[2] + '&city_bound_lng2=' + bound_lat_lng[3] + '&_wpnonce=' + nonce,
571 571
                             function (data) {
572 572
 
573
-                                jQuery(obj).closest('form').find('.dummy_post_inserted').html('<?php _e('Dummy post(s) inserted:','geodirectory');?> ' + dummy_post_index + ' <?php _e('of' ,'geodirectory'); ?> ' + total_dummy_post_count + '');
573
+                                jQuery(obj).closest('form').find('.dummy_post_inserted').html('<?php _e('Dummy post(s) inserted:', 'geodirectory'); ?> ' + dummy_post_index + ' <?php _e('of', 'geodirectory'); ?> ' + total_dummy_post_count + '');
574 574
                                 dummy_post_index++;
575 575
                                 if (dummy_post_index <= total_dummy_post_count)
576 576
                                     geodir_autoinstall(obj, id, nonce, posttype);
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
     global $wpdb, $plugin_prefix;
628 628
 
629 629
 
630
-    $post_ids = $wpdb->get_results("SELECT post_id FROM " . $plugin_prefix . "gd_place_detail WHERE post_dummy='1'");
630
+    $post_ids = $wpdb->get_results("SELECT post_id FROM ".$plugin_prefix."gd_place_detail WHERE post_dummy='1'");
631 631
 
632 632
 
633 633
     foreach ($post_ids as $post_ids_obj) {
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
     }
636 636
 
637 637
     //double check posts are deleted
638
-    $wpdb->get_results("DELETE FROM " . $plugin_prefix . "gd_place_detail WHERE post_dummy='1'");
638
+    $wpdb->get_results("DELETE FROM ".$plugin_prefix."gd_place_detail WHERE post_dummy='1'");
639 639
 }
640 640
 
641 641
 /**
@@ -673,14 +673,14 @@  discard block
 block discarded – undo
673 673
 
674 674
 
675 675
                     if (geodir_dummy_folder_exists())
676
-                        $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
676
+                        $dummy_image_url = geodir_plugin_url()."/geodirectory-admin/dummy/cat_icon";
677 677
                     else
678 678
                         $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
679 679
 
680 680
                     $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
681 681
 
682 682
                     $catname = str_replace(' ', '_', $catname);
683
-                    $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
683
+                    $uploaded = (array) fetch_remote_file("$dummy_image_url/".$catname.".png");
684 684
 
685 685
                     if (empty($uploaded['error'])) {
686 686
                         $new_path = $uploaded['file'];
@@ -690,7 +690,7 @@  discard block
 block discarded – undo
690 690
                     $wp_filetype = wp_check_filetype(basename($new_path), null);
691 691
 
692 692
                     $attachment = array(
693
-                        'guid' => $uploads['baseurl'] . '/' . basename($new_path),
693
+                        'guid' => $uploads['baseurl'].'/'.basename($new_path),
694 694
                         'post_mime_type' => $wp_filetype['type'],
695 695
                         'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
696 696
                         'post_content' => '',
@@ -700,7 +700,7 @@  discard block
 block discarded – undo
700 700
 
701 701
                     // you must first include the image.php file
702 702
                     // for the function wp_generate_attachment_metadata() to work
703
-                    require_once(ABSPATH . 'wp-admin/includes/image.php');
703
+                    require_once(ABSPATH.'wp-admin/includes/image.php');
704 704
                     $attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
705 705
                     wp_update_attachment_metadata($attach_id, $attach_data);
706 706
 
@@ -717,14 +717,14 @@  discard block
 block discarded – undo
717 717
                 $last_catid = wp_insert_term($catname, 'gd_placecategory');
718 718
 
719 719
                 if (geodir_dummy_folder_exists())
720
-                    $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
720
+                    $dummy_image_url = geodir_plugin_url()."/geodirectory-admin/dummy/cat_icon";
721 721
                 else
722 722
                     $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
723 723
 
724 724
                 $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
725 725
 
726 726
                 $catname = str_replace(' ', '_', $catname);
727
-                $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
727
+                $uploaded = (array) fetch_remote_file("$dummy_image_url/".$catname.".png");
728 728
 
729 729
                 if (empty($uploaded['error'])) {
730 730
                     $new_path = $uploaded['file'];
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
                 $wp_filetype = wp_check_filetype(basename($new_path), null);
735 735
 
736 736
                 $attachment = array(
737
-                    'guid' => $uploads['baseurl'] . '/' . basename($new_path),
737
+                    'guid' => $uploads['baseurl'].'/'.basename($new_path),
738 738
                     'post_mime_type' => $wp_filetype['type'],
739 739
                     'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
740 740
                     'post_content' => '',
@@ -746,7 +746,7 @@  discard block
 block discarded – undo
746 746
 
747 747
                 // you must first include the image.php file
748 748
                 // for the function wp_generate_attachment_metadata() to work
749
-                require_once(ABSPATH . 'wp-admin/includes/image.php');
749
+                require_once(ABSPATH.'wp-admin/includes/image.php');
750 750
                 $attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
751 751
                 wp_update_attachment_metadata($attach_id, $attach_data);
752 752
 
@@ -788,18 +788,18 @@  discard block
 block discarded – undo
788 788
 
789 789
         elseif (isset($value['type']) && $value['type'] == 'image_width') :
790 790
 
791
-            if (isset($value['id']) && isset($_POST[$value['id'] . '_width'])) {
792
-                update_option($value['id'] . '_width', $_POST[$value['id'] . '_width']);
793
-                update_option($value['id'] . '_height', $_POST[$value['id'] . '_height']);
794
-                if (isset($_POST[$value['id'] . '_crop'])) :
795
-                    update_option($value['id'] . '_crop', 1);
791
+            if (isset($value['id']) && isset($_POST[$value['id'].'_width'])) {
792
+                update_option($value['id'].'_width', $_POST[$value['id'].'_width']);
793
+                update_option($value['id'].'_height', $_POST[$value['id'].'_height']);
794
+                if (isset($_POST[$value['id'].'_crop'])) :
795
+                    update_option($value['id'].'_crop', 1);
796 796
                 else :
797
-                    update_option($value['id'] . '_crop', 0);
797
+                    update_option($value['id'].'_crop', 0);
798 798
                 endif;
799 799
             } else {
800
-                update_option($value['id'] . '_width', $value['std']);
801
-                update_option($value['id'] . '_height', $value['std']);
802
-                update_option($value['id'] . '_crop', 1);
800
+                update_option($value['id'].'_width', $value['std']);
801
+                update_option($value['id'].'_height', $value['std']);
802
+                update_option($value['id'].'_crop', 1);
803 803
             }
804 804
 
805 805
         elseif (isset($value['type']) && $value['type'] == 'map') :
@@ -841,12 +841,12 @@  discard block
 block discarded – undo
841 841
         elseif (isset($value['type']) && $value['type'] == 'file') :
842 842
 
843 843
 
844
-            if (isset($_POST[$value['id'] . '_remove']) && $_POST[$value['id'] . '_remove']) {// if remove is set then remove the file
844
+            if (isset($_POST[$value['id'].'_remove']) && $_POST[$value['id'].'_remove']) {// if remove is set then remove the file
845 845
 
846 846
                 if (get_option($value['id'])) {
847 847
                     $image_name_arr = explode('/', get_option($value['id']));
848 848
                     $noimg_name = end($image_name_arr);
849
-                    $img_path = $uploads['path'] . '/' . $noimg_name;
849
+                    $img_path = $uploads['path'].'/'.$noimg_name;
850 850
                     if (file_exists($img_path))
851 851
                         unlink($img_path);
852 852
                 }
@@ -874,7 +874,7 @@  discard block
 block discarded – undo
874 874
                 if (get_option($value['id'])) {
875 875
                     $image_name_arr = explode('/', get_option($value['id']));
876 876
                     $noimg_name = end($image_name_arr);
877
-                    $img_path = $uploads['path'] . '/' . $noimg_name;
877
+                    $img_path = $uploads['path'].'/'.$noimg_name;
878 878
                     if (file_exists($img_path))
879 879
                         unlink($img_path);
880 880
                 }
@@ -895,7 +895,7 @@  discard block
 block discarded – undo
895 895
             // same menu setting per theme.
896 896
             if (isset($value['id']) && $value['id'] == 'geodir_theme_location_nav' && isset($_POST[$value['id']])) {
897 897
                 $theme = wp_get_theme();
898
-                update_option('geodir_theme_location_nav_' . $theme->name, $_POST[$value['id']]);
898
+                update_option('geodir_theme_location_nav_'.$theme->name, $_POST[$value['id']]);
899 899
             }
900 900
 
901 901
             if (isset($value['id']) && isset($_POST[$value['id']])) {
@@ -965,8 +965,8 @@  discard block
 block discarded – undo
965 965
 
966 966
             $listing_slug = $geodir_posttype_info['labels']['singular_name'];
967 967
 
968
-            $tabs[$geodir_post_type . '_fields_settings'] = array(
969
-                'label' => __(ucfirst($listing_slug) . ' Settings', 'geodirectory'),
968
+            $tabs[$geodir_post_type.'_fields_settings'] = array(
969
+                'label' => __(ucfirst($listing_slug).' Settings', 'geodirectory'),
970 970
                 'subtabs' => array(
971 971
                     array('subtab' => 'custom_fields',
972 972
                         'label' => __('Custom Fields', 'geodirectory'),
@@ -1032,7 +1032,7 @@  discard block
 block discarded – undo
1032 1032
  */
1033 1033
 function geodir_extend_geodirectory_setting_tab($tabs)
1034 1034
 {
1035
-    $tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory'). ' <i class="fa fa-plug"></i>', 'url' => 'http://wpgeodirectory.com', 'target' => '_blank');
1035
+    $tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory').' <i class="fa fa-plug"></i>', 'url' => 'http://wpgeodirectory.com', 'target' => '_blank');
1036 1036
     return $tabs;
1037 1037
 }
1038 1038
 
@@ -1092,8 +1092,8 @@  discard block
 block discarded – undo
1092 1092
                     _e('Unknown', 'geodirectory');
1093 1093
                 } else {
1094 1094
                     /* If there is a city id, append 'city name' to the text string. */
1095
-                    $add_location_id = $location_id > 0 ? ' (' . $location_id . ')' : '';
1096
-                    echo(__($location->country, 'geodirectory') . '-' . $location->region . '-' . $location->city . $add_location_id);
1095
+                    $add_location_id = $location_id > 0 ? ' ('.$location_id.')' : '';
1096
+                    echo(__($location->country, 'geodirectory').'-'.$location->region.'-'.$location->city.$add_location_id);
1097 1097
                 }
1098 1098
                 break;
1099 1099
 
@@ -1111,14 +1111,14 @@  discard block
 block discarded – undo
1111 1111
                         $expire_class = 'expire_over';
1112 1112
                     }
1113 1113
                     $date_diff = round(abs(strtotime($d1) - strtotime($d2)) / 86400); // get the difference in days
1114
-                    $date_diff_text = '<br /><span class="' . $expire_class . '">(' . $date_diff . ' ' . $state . ')</span>';
1114
+                    $date_diff_text = '<br /><span class="'.$expire_class.'">('.$date_diff.' '.$state.')</span>';
1115 1115
                 }
1116 1116
                 /* If no expire_date is found, output a default message. */
1117 1117
                 if (empty($expire_date))
1118 1118
                     echo __('Unknown', 'geodirectory');
1119 1119
                 /* If there is a expire_date, append 'days left' to the text string. */
1120 1120
                 else
1121
-                    echo $expire_date . $date_diff_text;
1121
+                    echo $expire_date.$date_diff_text;
1122 1122
                 break;
1123 1123
 
1124 1124
             /* If displaying the 'categorys' column. */
@@ -1185,7 +1185,7 @@  discard block
 block discarded – undo
1185 1185
 function geodir_post_information_save($post_id, $post) {
1186 1186
     global $wpdb, $current_user;
1187 1187
 
1188
-    if (isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')) {
1188
+    if (isset($post->post_type) && ($post->post_type == 'nav_menu_item' || $post->post_type == 'page' || $post->post_type == 'post')) {
1189 1189
         return;
1190 1190
     }
1191 1191
 
@@ -1253,7 +1253,7 @@  discard block
 block discarded – undo
1253 1253
                     $tab_id = $value['id'];
1254 1254
 
1255 1255
                 if (isset($value['desc']) && $value['desc'])
1256
-                    $desc = '<span style=" text-transform:none;">:- ' . $value['desc'] . '</span>';
1256
+                    $desc = '<span style=" text-transform:none;">:- '.$value['desc'].'</span>';
1257 1257
 
1258 1258
                 if (isset($value['name']) && $value['name']) {
1259 1259
                     if ($first_title === true) {
@@ -1261,9 +1261,9 @@  discard block
 block discarded – undo
1261 1261
                     } else {
1262 1262
                         echo '</div>';
1263 1263
                     }
1264
-                    echo '<dd id="' . trim($tab_id) . '" class="geodir_option_tabs" ><a href="javascript:void(0);">' . $value['name'] . '</a></dd>';
1264
+                    echo '<dd id="'.trim($tab_id).'" class="geodir_option_tabs" ><a href="javascript:void(0);">'.$value['name'].'</a></dd>';
1265 1265
 
1266
-                    echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
1266
+                    echo '<div id="sub_'.trim($tab_id).'" class="gd-content-heading" style=" margin-bottom:10px;" >';
1267 1267
                 }
1268 1268
 
1269 1269
                 /**
@@ -1273,21 +1273,21 @@  discard block
 block discarded – undo
1273 1273
                  *
1274 1274
                  * @since 1.0.0
1275 1275
                  */
1276
-                do_action('geodir_settings_' . sanitize_title($value['id']));
1276
+                do_action('geodir_settings_'.sanitize_title($value['id']));
1277 1277
                 break;
1278 1278
 
1279 1279
             case 'no_tabs':
1280 1280
 
1281 1281
                 echo '<div class="inner_content_tab_main">';
1282
-                echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
1282
+                echo '<div id="sub_'.trim($tab_id).'" class="gd-content-heading" style=" margin-bottom:10px;" >';
1283 1283
 
1284 1284
                 break;
1285 1285
 
1286 1286
             case 'sectionstart':
1287 1287
                 if (isset($value['desc']) && $value['desc'])
1288
-                    $desc = '<span style=" text-transform:none;"> - ' . $value['desc'] . '</span>';
1288
+                    $desc = '<span style=" text-transform:none;"> - '.$value['desc'].'</span>';
1289 1289
                 if (isset($value['name']) && $value['name'])
1290
-                    echo '<h3>' . $value['name'] . $desc . '</h3>';
1290
+                    echo '<h3>'.$value['name'].$desc.'</h3>';
1291 1291
                 /**
1292 1292
                  * Called after a GeoDirectory settings sectionstart is output in the GD settings page.
1293 1293
                  *
@@ -1295,8 +1295,8 @@  discard block
 block discarded – undo
1295 1295
                  *
1296 1296
                  * @since 1.0.0
1297 1297
                  */
1298
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_start');
1299
-                echo '<table class="form-table">' . "\n\n";
1298
+                if (isset($value['id']) && $value['id']) do_action('geodir_settings_'.sanitize_title($value['id']).'_start');
1299
+                echo '<table class="form-table">'."\n\n";
1300 1300
 
1301 1301
                 break;
1302 1302
             case 'sectionend':
@@ -1307,7 +1307,7 @@  discard block
 block discarded – undo
1307 1307
                  *
1308 1308
                  * @since 1.0.0
1309 1309
                  */
1310
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_end');
1310
+                if (isset($value['id']) && $value['id']) do_action('geodir_settings_'.sanitize_title($value['id']).'_end');
1311 1311
                 echo '</table>';
1312 1312
                 /**
1313 1313
                  * Called after a GeoDirectory settings sectionend is output in the GD settings page.
@@ -1316,7 +1316,7 @@  discard block
 block discarded – undo
1316 1316
                  *
1317 1317
                  * @since 1.0.0
1318 1318
                  */
1319
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_after');
1319
+                if (isset($value['id']) && $value['id']) do_action('geodir_settings_'.sanitize_title($value['id']).'_after');
1320 1320
                 break;
1321 1321
             case 'text':
1322 1322
                 ?>
@@ -1325,7 +1325,7 @@  discard block
 block discarded – undo
1325 1325
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
1326 1326
                                            id="<?php echo esc_attr($value['id']); ?>"
1327 1327
                                            type="<?php echo esc_attr($value['type']); ?>"
1328
-                                           <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1328
+                                           <?php if (isset($value['placeholder'])) {?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1329 1329
                                            style=" <?php echo esc_attr($value['css']); ?>"
1330 1330
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
1331 1331
                                                echo esc_attr(stripslashes(get_option($value['id'])));
@@ -1342,7 +1342,7 @@  discard block
 block discarded – undo
1342 1342
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
1343 1343
                                            id="<?php echo esc_attr($value['id']); ?>"
1344 1344
                                            type="<?php echo esc_attr($value['type']); ?>"
1345
-                                           <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1345
+                                           <?php if (isset($value['placeholder'])) {?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1346 1346
                                            style="<?php echo esc_attr($value['css']); ?>"
1347 1347
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
1348 1348
                                                echo esc_attr(stripslashes(get_option($value['id'])));
@@ -1388,17 +1388,17 @@  discard block
 block discarded – undo
1388 1388
                     <?php _e('Width', 'geodirectory'); ?> <input
1389 1389
                         name="<?php echo esc_attr($value['id']); ?>_width"
1390 1390
                         id="<?php echo esc_attr($value['id']); ?>_width" type="text" size="3"
1391
-                        value="<?php if ($size = get_option($value['id'] . '_width')) echo stripslashes($size); else echo $value['std']; ?>"/>
1391
+                        value="<?php if ($size = get_option($value['id'].'_width')) echo stripslashes($size); else echo $value['std']; ?>"/>
1392 1392
 
1393 1393
                     <?php _e('Height', 'geodirectory'); ?> <input
1394 1394
                         name="<?php echo esc_attr($value['id']); ?>_height"
1395 1395
                         id="<?php echo esc_attr($value['id']); ?>_height" type="text" size="3"
1396
-                        value="<?php if ($size = get_option($value['id'] . '_height')) echo stripslashes($size); else echo $value['std']; ?>"/>
1396
+                        value="<?php if ($size = get_option($value['id'].'_height')) echo stripslashes($size); else echo $value['std']; ?>"/>
1397 1397
 
1398 1398
                     <label><?php _e('Hard Crop', 'geodirectory'); ?> <input
1399 1399
                             name="<?php echo esc_attr($value['id']); ?>_crop"
1400 1400
                             id="<?php echo esc_attr($value['id']); ?>_crop"
1401
-                            type="checkbox" <?php if (get_option($value['id'] . '_crop') != '') checked(get_option($value['id'] . '_crop'), 1); else checked(1); ?> /></label>
1401
+                            type="checkbox" <?php if (get_option($value['id'].'_crop') != '') checked(get_option($value['id'].'_crop'), 1); else checked(1); ?> /></label>
1402 1402
 
1403 1403
                     <span class="description"><?php echo $value['desc'] ?></span></td>
1404 1404
                 </tr><?php
@@ -1448,7 +1448,7 @@  discard block
 block discarded – undo
1448 1448
                                             id="<?php echo esc_attr($value['id']); ?>"
1449 1449
                                             style="<?php echo esc_attr($value['css']); ?>"
1450 1450
                                             class="<?php if (isset($value['class'])) echo $value['class']; ?>"
1451
-                                            data-placeholder="<?php if (isset($value['placeholder_text'])) echo $value['placeholder_text'];?>"
1451
+                                            data-placeholder="<?php if (isset($value['placeholder_text'])) echo $value['placeholder_text']; ?>"
1452 1452
                                             option-ajaxchosen="false">
1453 1453
                         <?php
1454 1454
                         foreach ($value['options'] as $key => $val) {
@@ -1459,7 +1459,7 @@  discard block
 block discarded – undo
1459 1459
                             } else {
1460 1460
                                 ?>
1461 1461
                                 <option
1462
-                                    value="<?php echo esc_attr($key); ?>" <?php selected(true, (is_array($option_values) && in_array($key, $option_values)));?>><?php echo ucfirst($val) ?></option>
1462
+                                    value="<?php echo esc_attr($key); ?>" <?php selected(true, (is_array($option_values) && in_array($key, $option_values))); ?>><?php echo ucfirst($val) ?></option>
1463 1463
                             <?php
1464 1464
                             }
1465 1465
                         }
@@ -1494,7 +1494,7 @@  discard block
 block discarded – undo
1494 1494
                 ?>
1495 1495
 
1496 1496
                 <tr valign="top">
1497
-                    <th class="titledesc" width="40%"><?php _e('Default map language', 'geodirectory');?></th>
1497
+                    <th class="titledesc" width="40%"><?php _e('Default map language', 'geodirectory'); ?></th>
1498 1498
                     <td width="60%">
1499 1499
                         <select name="geodir_default_map_language" style="width:60%">
1500 1500
                             <?php
@@ -1576,7 +1576,7 @@  discard block
 block discarded – undo
1576 1576
 
1577 1577
                 <tr valign="top">
1578 1578
                     <th class="titledesc"
1579
-                        width="40%"><?php _e('Default post type search on map', 'geodirectory');?></th>
1579
+                        width="40%"><?php _e('Default post type search on map', 'geodirectory'); ?></th>
1580 1580
                     <td width="60%">
1581 1581
                         <select name="geodir_default_map_search_pt" style="width:60%">
1582 1582
                             <?php
@@ -1617,7 +1617,7 @@  discard block
 block discarded – undo
1617 1617
                         $cat_display = 'checkbox';
1618 1618
                         $gd_post_types = get_option('geodir_exclude_post_type_on_map');
1619 1619
                         $gd_cats = get_option('geodir_exclude_cat_on_map');
1620
-                        $gd_cats_upgrade = (int)get_option('geodir_exclude_cat_on_map_upgrade');
1620
+                        $gd_cats_upgrade = (int) get_option('geodir_exclude_cat_on_map_upgrade');
1621 1621
                         $count = 1;
1622 1622
                         ?>
1623 1623
                         <table width="70%" class="widefat">
@@ -1646,7 +1646,7 @@  discard block
 block discarded – undo
1646 1646
                                                                                            name="home_map_post_types[]"
1647 1647
                                                                                            id="<?php echo esc_attr($value['id']); ?>"
1648 1648
                                                                                            value="<?php echo $key; ?>"
1649
-                                                                                           class="map_post_type" <?php echo $checked;?> />
1649
+                                                                                           class="map_post_type" <?php echo $checked; ?> />
1650 1650
                                         <?php echo $post_types_obj->labels->singular_name; ?></td>
1651 1651
                                     <td width="40%">
1652 1652
                                         <div class="home_map_category" style="overflow:auto;width:200px;height:100px;"
@@ -1704,12 +1704,12 @@  discard block
 block discarded – undo
1704 1704
                 ?>
1705 1705
                 <fieldset>
1706 1706
                     <legend class="screen-reader-text"><span><?php echo $value['name'] ?></span></legend>
1707
-                    <label for="<?php echo $value['id'];?>">
1707
+                    <label for="<?php echo $value['id']; ?>">
1708 1708
                         <input name="<?php echo esc_attr($value['id']); ?>"
1709
-                               id="<?php echo esc_attr($value['id'] . $value['value']); ?>" type="radio"
1709
+                               id="<?php echo esc_attr($value['id'].$value['value']); ?>" type="radio"
1710 1710
                                value="<?php echo $value['value'] ?>" <?php if (get_option($value['id']) == $value['value']) {
1711 1711
                             echo 'checked="checked"';
1712
-                        }elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
1712
+                        }elseif (get_option($value['id']) == '' && $value['std'] == $value['value']) {echo 'checked="checked"'; } ?> />
1713 1713
                         <?php echo $value['desc']; ?></label><br>
1714 1714
                 </fieldset>
1715 1715
                 <?php
@@ -1729,9 +1729,9 @@  discard block
 block discarded – undo
1729 1729
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1730 1730
                 <td class="forminp">
1731 1731
                     <textarea
1732
-                        <?php if (isset($value['args'])) echo $value['args'] . ' '; ?>name="<?php echo esc_attr($value['id']); ?>"
1732
+                        <?php if (isset($value['args'])) echo $value['args'].' '; ?>name="<?php echo esc_attr($value['id']); ?>"
1733 1733
                         id="<?php echo esc_attr($value['id']); ?>"
1734
-                        <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1734
+                        <?php if (isset($value['placeholder'])) {?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1735 1735
                         style="<?php echo esc_attr($value['css']); ?>"><?php if (get_option($value['id'])) echo esc_textarea(stripslashes(get_option($value['id']))); else echo esc_textarea($value['std']); ?></textarea><span
1736 1736
                         class="description"><?php echo $value['desc'] ?></span>
1737 1737
 
@@ -1776,7 +1776,7 @@  discard block
 block discarded – undo
1776 1776
 					}
1777 1777
 				}
1778 1778
 				//
1779
-				$page_setting = (int)get_option($value['id']);
1779
+				$page_setting = (int) get_option($value['id']);
1780 1780
 
1781 1781
                 $args = array('name' => $value['id'],
1782 1782
                     'id' => $value['id'],
@@ -1793,7 +1793,7 @@  discard block
 block discarded – undo
1793 1793
                 <tr valign="top" class="single_select_page">
1794 1794
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1795 1795
                 <td class="forminp">
1796
-                    <?php echo str_replace(' id=', " data-placeholder='" . __('Select a page...', 'geodirectory') . "' style='" . $value['css'] . "' class='" . $value['class'] . "' " . $disabled . " id=", wp_dropdown_pages($args)); ?>
1796
+                    <?php echo str_replace(' id=', " data-placeholder='".__('Select a page...', 'geodirectory')."' style='".$value['css']."' class='".$value['class']."' ".$disabled." id=", wp_dropdown_pages($args)); ?>
1797 1797
                     <span class="description"><?php echo $value['desc'] ?></span>
1798 1798
                 </td>
1799 1799
                 </tr><?php
@@ -1802,7 +1802,7 @@  discard block
 block discarded – undo
1802 1802
 				}
1803 1803
                 break;
1804 1804
             case 'single_select_country' :
1805
-                $country_setting = (string)get_option($value['id']);
1805
+                $country_setting = (string) get_option($value['id']);
1806 1806
                 if (strstr($country_setting, ':')) :
1807 1807
                     $country = current(explode(':', $country_setting));
1808 1808
                     $state = end(explode(':', $country_setting));
@@ -1825,7 +1825,7 @@  discard block
 block discarded – undo
1825 1825
             case 'multi_select_countries' :
1826 1826
                 $countries = $geodirectory->countries->countries;
1827 1827
                 asort($countries);
1828
-                $selections = (array)get_option($value['id']);
1828
+                $selections = (array) get_option($value['id']);
1829 1829
                 ?>
1830 1830
                 <tr valign="top">
1831 1831
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
@@ -1835,7 +1835,7 @@  discard block
 block discarded – undo
1835 1835
                             title="Country" class="chosen_select">
1836 1836
                         <?php
1837 1837
                         if ($countries) foreach ($countries as $key => $val) :
1838
-                            echo '<option value="' . $key . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>';
1838
+                            echo '<option value="'.$key.'" '.selected(in_array($key, $selections), true, false).'>'.$val.'</option>';
1839 1839
                         endforeach;
1840 1840
                         ?>
1841 1841
                     </select>
@@ -1847,8 +1847,8 @@  discard block
 block discarded – undo
1847 1847
                 break;
1848 1848
 
1849 1849
             case 'google_analytics' :
1850
-                $selections = (array)get_option($value['id']);
1851
-                if(get_option('geodir_ga_client_id') && get_option('geodir_ga_client_secret') ) {
1850
+                $selections = (array) get_option($value['id']);
1851
+                if (get_option('geodir_ga_client_id') && get_option('geodir_ga_client_secret')) {
1852 1852
                     ?>
1853 1853
                     <tr valign="top">
1854 1854
                         <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
@@ -1859,20 +1859,20 @@  discard block
 block discarded – undo
1859 1859
 
1860 1860
                             $oAuthURL = "https://accounts.google.com/o/oauth2/auth?";
1861 1861
                             $scope = "scope=https://www.googleapis.com/auth/analytics.readonly";
1862
-                            $state = "&state=123";//any string
1863
-                            $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
1862
+                            $state = "&state=123"; //any string
1863
+                            $redirect_uri = "&redirect_uri=".admin_url('admin-ajax.php')."?action=geodir_ga_callback";
1864 1864
                             $response_type = "&response_type=code";
1865 1865
                             $client_id = "&client_id=".get_option('geodir_ga_client_id');
1866 1866
                             $access_type = "&access_type=offline";
1867 1867
                             $approval_prompt = "&approval_prompt=force";
1868 1868
 
1869
-                            $auth_url = $oAuthURL . $scope . $state . $redirect_uri . $response_type . $client_id . $access_type . $approval_prompt;
1869
+                            $auth_url = $oAuthURL.$scope.$state.$redirect_uri.$response_type.$client_id.$access_type.$approval_prompt;
1870 1870
 
1871 1871
 
1872 1872
                             ?>
1873 1873
                             <script>
1874 1874
                                 function gd_ga_popup() {
1875
-                                    var win = window.open("<?php echo $auth_url;?>", "Google Analytics", "");
1875
+                                    var win = window.open("<?php echo $auth_url; ?>", "Google Analytics", "");
1876 1876
                                     var pollTimer = window.setInterval(function () {
1877 1877
                                         if (win.closed !== false) { // !== is required for compatibility with Opera
1878 1878
                                             window.clearInterval(pollTimer);
@@ -1894,7 +1894,7 @@  discard block
 block discarded – undo
1894 1894
                             } else {
1895 1895
                                 ?>
1896 1896
                                 <span class="button-primary"
1897
-                                      onclick="gd_ga_popup();"><?php _e('Authorize', 'geodirectory');?></span>
1897
+                                      onclick="gd_ga_popup();"><?php _e('Authorize', 'geodirectory'); ?></span>
1898 1898
                             <?php
1899 1899
                             }
1900 1900
                             ?>
@@ -1965,9 +1965,9 @@  discard block
 block discarded – undo
1965 1965
 
1966 1966
             <?php if (isset($_REQUEST['active_tab']) && $_REQUEST['active_tab'] != '') { ?>
1967 1967
             jQuery('.geodir_option_tabs').removeClass('gd-tab-active');
1968
-            jQuery('#<?php echo sanitize_text_field($_REQUEST['active_tab']);?>').addClass('gd-tab-active');
1968
+            jQuery('#<?php echo sanitize_text_field($_REQUEST['active_tab']); ?>').addClass('gd-tab-active');
1969 1969
             jQuery('.gd-content-heading').hide();
1970
-            jQuery('#sub_<?php echo sanitize_text_field($_REQUEST['active_tab']);?>').show();
1970
+            jQuery('#sub_<?php echo sanitize_text_field($_REQUEST['active_tab']); ?>').show();
1971 1971
             <?php } ?>
1972 1972
         });
1973 1973
     </script>
@@ -2053,7 +2053,7 @@  discard block
 block discarded – undo
2053 2053
     wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_attachments_noncename');
2054 2054
 
2055 2055
     if (geodir_get_featured_image($post_id, 'thumbnail')) {
2056
-        echo '<h4>' . __('Featured Image', 'geodirectory') . '</h4>';
2056
+        echo '<h4>'.__('Featured Image', 'geodirectory').'</h4>';
2057 2057
         geodir_show_featured_image($post_id, 'thumbnail');
2058 2058
     }
2059 2059
 
@@ -2064,13 +2064,13 @@  discard block
 block discarded – undo
2064 2064
 
2065 2065
     <h5 class="form_title">
2066 2066
         <?php if ($image_limit != 0 && $image_limit == 1) {
2067
-            echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
2067
+            echo '<br /><small>('.__('You can upload', 'geodirectory').' '.$image_limit.' '.__('image with this package', 'geodirectory').')</small>';
2068 2068
         } ?>
2069 2069
         <?php if ($image_limit != 0 && $image_limit > 1) {
2070
-            echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
2070
+            echo '<br /><small>('.__('You can upload', 'geodirectory').' '.$image_limit.' '.__('images with this package', 'geodirectory').')</small>';
2071 2071
         } ?>
2072 2072
         <?php if ($image_limit == 0) {
2073
-            echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
2073
+            echo '<br /><small>('.__('You can upload unlimited images with this package', 'geodirectory').')</small>';
2074 2074
         } ?>
2075 2075
     </h5>
2076 2076
 
@@ -2109,10 +2109,10 @@  discard block
 block discarded – undo
2109 2109
         <div
2110 2110
             class="plupload-upload-uic hide-if-no-js <?php if ($multiple): ?>plupload-upload-uic-multiple<?php endif; ?>"
2111 2111
             id="<?php echo $id; ?>plupload-upload-ui">
2112
-            <h4><?php _e('Drop files to upload', 'geodirectory');?></h4>
2112
+            <h4><?php _e('Drop files to upload', 'geodirectory'); ?></h4>
2113 2113
             <input id="<?php echo $id; ?>plupload-browse-button" type="button"
2114 2114
                    value="<?php _e('Select Files', 'geodirectory'); ?>" class="button"/>
2115
-            <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce($id . 'pluploadan'); ?>"></span>
2115
+            <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce($id.'pluploadan'); ?>"></span>
2116 2116
             <?php if ($width && $height): ?>
2117 2117
                 <span class="plupload-resize"></span>
2118 2118
                 <span class="plupload-width" id="plupload-width<?php echo $width; ?>"></span>
@@ -2124,7 +2124,7 @@  discard block
 block discarded – undo
2124 2124
              id="<?php echo $id; ?>plupload-thumbs" style="border-top:1px solid #ccc; padding-top:10px;">
2125 2125
         </div>
2126 2126
         <span
2127
-            id="upload-msg"><?php _e('Please drag &amp; drop the images to rearrange the order', 'geodirectory');?></span>
2127
+            id="upload-msg"><?php _e('Please drag &amp; drop the images to rearrange the order', 'geodirectory'); ?></span>
2128 2128
         <span id="<?php echo $id; ?>upload-error" style="display:none"></span>
2129 2129
     </div>
2130 2130
 
@@ -2334,9 +2334,9 @@  discard block
 block discarded – undo
2334 2334
     $plugin = 'avada-nag';
2335 2335
     $timestamp = 'avada-nag1234';
2336 2336
     $message = __('Welcome to GeoDirectory, please have a look <a href="https://docs.wpgeodirectory.com/category/getting-started/" target="_blank">here</a> to get started. :)', 'geodirectory');
2337
-    echo '<div id="' . $timestamp . '"  class="error">';
2338
-    echo '<span class="gd-remove-noti" onclick="gdRemoveANotification(\'' . $plugin . '\',\'' . $timestamp . '\');" ><i class="fa fa-times"></i></span>';
2339
-    echo "<img class='gd-icon-noti' src='" . plugin_dir_url('') . "geodirectory/geodirectory-assets/images/favicon.ico' > ";
2337
+    echo '<div id="'.$timestamp.'"  class="error">';
2338
+    echo '<span class="gd-remove-noti" onclick="gdRemoveANotification(\''.$plugin.'\',\''.$timestamp.'\');" ><i class="fa fa-times"></i></span>';
2339
+    echo "<img class='gd-icon-noti' src='".plugin_dir_url('')."geodirectory/geodirectory-assets/images/favicon.ico' > ";
2340 2340
     echo "<p>$message</p>";
2341 2341
     echo "</div>";
2342 2342
 
@@ -2469,7 +2469,7 @@  discard block
 block discarded – undo
2469 2469
 		
2470 2470
 		// Don't allow same slug url for listing and location
2471 2471
 		if (geodir_strtolower($listing_prefix) == geodir_strtolower($location_prefix)) {
2472
-			$redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $active_tab . '&msg=fail&gderr=21');
2472
+			$redirect_url = admin_url('admin.php?page=geodirectory&tab='.$current_tab.'&active_tab='.$active_tab.'&msg=fail&gderr=21');
2473 2473
         	wp_redirect($redirect_url);
2474 2474
 			exit;
2475 2475
 		}
@@ -2481,7 +2481,7 @@  discard block
 block discarded – undo
2481 2481
 			$default_language = $sitepress->get_default_language();
2482 2482
 			
2483 2483
 			if ($current_language != 'all' && $current_language != $default_language) {
2484
-				$redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $active_tab);
2484
+				$redirect_url = admin_url('admin.php?page=geodirectory&tab='.$current_tab.'&active_tab='.$active_tab);
2485 2485
 				wp_redirect($redirect_url);
2486 2486
 				exit;
2487 2487
 			}
@@ -2502,11 +2502,11 @@  discard block
 block discarded – undo
2502 2502
 function geodir_hide_admin_preview_button() {
2503 2503
     global $post_type;
2504 2504
     $post_types = geodir_get_posttypes();
2505
-    if(in_array($post_type, $post_types))
2505
+    if (in_array($post_type, $post_types))
2506 2506
         echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
2507 2507
 }
2508
-add_action( 'admin_head-post-new.php', 'geodir_hide_admin_preview_button' );
2509
-add_action( 'admin_head-post.php', 'geodir_hide_admin_preview_button' );
2508
+add_action('admin_head-post-new.php', 'geodir_hide_admin_preview_button');
2509
+add_action('admin_head-post.php', 'geodir_hide_admin_preview_button');
2510 2510
 
2511 2511
 /**
2512 2512
  * Add the tab in left sidebar menu fro import & export page.
@@ -2516,8 +2516,8 @@  discard block
 block discarded – undo
2516 2516
  *
2517 2517
  * @return array Array of tab data.
2518 2518
  */
2519
-function geodir_import_export_tab( $tabs ) {
2520
-	$tabs['import_export'] = array( 'label' => __( 'Import & Export', 'geodirectory' ) );
2519
+function geodir_import_export_tab($tabs) {
2520
+	$tabs['import_export'] = array('label' => __('Import & Export', 'geodirectory'));
2521 2521
     return $tabs;
2522 2522
 }
2523 2523
 
@@ -2531,8 +2531,8 @@  discard block
 block discarded – undo
2531 2531
  * @return string Html content.
2532 2532
  */
2533 2533
 function geodir_import_export_page() {
2534
-	$nonce = wp_create_nonce( 'geodir_import_export_nonce' );
2535
-	$gd_cats_sample_csv = geodir_plugin_url() . '/geodirectory-assets/gd_sample_categories.csv';
2534
+	$nonce = wp_create_nonce('geodir_import_export_nonce');
2535
+	$gd_cats_sample_csv = geodir_plugin_url().'/geodirectory-assets/gd_sample_categories.csv';
2536 2536
     /**
2537 2537
      * Filter sample category data csv file url.
2538 2538
      *
@@ -2541,9 +2541,9 @@  discard block
 block discarded – undo
2541 2541
      *
2542 2542
      * @param string $gd_cats_sample_csv Sample category data csv file url.
2543 2543
      */
2544
-	$gd_cats_sample_csv = apply_filters( 'geodir_export_cats_sample_csv', $gd_cats_sample_csv );
2544
+	$gd_cats_sample_csv = apply_filters('geodir_export_cats_sample_csv', $gd_cats_sample_csv);
2545 2545
 	
2546
-	$gd_posts_sample_csv = geodir_plugin_url() . '/geodirectory-assets/place_listing.csv';
2546
+	$gd_posts_sample_csv = geodir_plugin_url().'/geodirectory-assets/place_listing.csv';
2547 2547
     /**
2548 2548
      * Filter sample post data csv file url.
2549 2549
      *
@@ -2552,15 +2552,15 @@  discard block
 block discarded – undo
2552 2552
      *
2553 2553
      * @param string $gd_posts_sample_csv Sample post data csv file url.
2554 2554
      */
2555
-    $gd_posts_sample_csv = apply_filters( 'geodir_export_posts_sample_csv', $gd_posts_sample_csv );
2555
+    $gd_posts_sample_csv = apply_filters('geodir_export_posts_sample_csv', $gd_posts_sample_csv);
2556 2556
 	
2557
-	$gd_posttypes = geodir_get_posttypes( 'array' );
2557
+	$gd_posttypes = geodir_get_posttypes('array');
2558 2558
 	
2559 2559
 	$gd_posttypes_option = '';
2560
-	foreach ( $gd_posttypes as $gd_posttype => $row ) {
2561
-		$gd_posttypes_option .= '<option value="' . $gd_posttype . '" data-cats="' . (int)geodir_get_terms_count( $gd_posttype ) . '" data-posts="' . (int)geodir_get_posts_count( $gd_posttype ) . '">' . __( $row['labels']['name'], 'geodirectory' ) . '</option>';
2560
+	foreach ($gd_posttypes as $gd_posttype => $row) {
2561
+		$gd_posttypes_option .= '<option value="'.$gd_posttype.'" data-cats="'.(int) geodir_get_terms_count($gd_posttype).'" data-posts="'.(int) geodir_get_posts_count($gd_posttype).'">'.__($row['labels']['name'], 'geodirectory').'</option>';
2562 2562
 	}
2563
-	wp_enqueue_script( 'jquery-ui-progressbar' );
2563
+	wp_enqueue_script('jquery-ui-progressbar');
2564 2564
 	
2565 2565
 	$gd_chunksize_options = array();
2566 2566
 	$gd_chunksize_options[100] = 100;
@@ -2582,49 +2582,49 @@  discard block
 block discarded – undo
2582 2582
      *
2583 2583
      * @param string $gd_chunksize_options Entries options.
2584 2584
      */
2585
-    $gd_chunksize_options = apply_filters( 'geodir_export_csv_chunksize_options', $gd_chunksize_options );
2585
+    $gd_chunksize_options = apply_filters('geodir_export_csv_chunksize_options', $gd_chunksize_options);
2586 2586
 	
2587 2587
 	$gd_chunksize_option = '';
2588 2588
 	foreach ($gd_chunksize_options as $value => $title) {
2589
-		$gd_chunksize_option .= '<option value="' . $value . '" ' . selected($value, 5000, false) . '>' . $title . '</option>';
2589
+		$gd_chunksize_option .= '<option value="'.$value.'" '.selected($value, 5000, false).'>'.$title.'</option>';
2590 2590
 	}
2591 2591
 	
2592 2592
 	$uploads = wp_upload_dir();
2593 2593
 ?>
2594 2594
 </form>
2595 2595
 <div class="inner_content_tab_main gd-import-export">
2596
-  <h3><?php _e( 'GD Import & Export CSV', 'geodirectory' ) ;?></h3>
2597
-  <span class="description"><?php _e( 'Import & export csv for GD listings & categories.', 'geodirectory' ) ;?></span>
2596
+  <h3><?php _e('GD Import & Export CSV', 'geodirectory'); ?></h3>
2597
+  <span class="description"><?php _e('Import & export csv for GD listings & categories.', 'geodirectory'); ?></span>
2598 2598
   <div class="gd-content-heading">
2599 2599
 
2600 2600
   <?php
2601 2601
     ini_set('max_execution_time', 999999);
2602
-    $ini_max_execution_time_check = @ini_get( 'max_execution_time' );
2602
+    $ini_max_execution_time_check = @ini_get('max_execution_time');
2603 2603
     ini_restore('max_execution_time');
2604 2604
 
2605
-    if($ini_max_execution_time_check != 999999){ // only show these setting to the user if we can't change the ini setting
2605
+    if ($ini_max_execution_time_check != 999999) { // only show these setting to the user if we can't change the ini setting
2606 2606
         ?>
2607 2607
 	<div id="gd_ie_reqs" class="metabox-holder">
2608 2608
       <div class="meta-box-sortables ui-sortable">
2609 2609
         <div class="postbox">
2610
-          <h3 class="hndle"><span style='vertical-align:top;'><?php echo __( 'PHP Requirements for GD Import & Export CSV', 'geodirectory' );?></span></h3>
2610
+          <h3 class="hndle"><span style='vertical-align:top;'><?php echo __('PHP Requirements for GD Import & Export CSV', 'geodirectory'); ?></span></h3>
2611 2611
           <div class="inside">
2612
-            <span class="description"><?php echo __( 'Note: In case GD import & export csv not working for larger data then please check and configure following php settings.', 'geodirectory' );?></span>
2612
+            <span class="description"><?php echo __('Note: In case GD import & export csv not working for larger data then please check and configure following php settings.', 'geodirectory'); ?></span>
2613 2613
 			<table class="form-table">
2614 2614
 				<thead>
2615 2615
 				  <tr>
2616
-				  	<th><?php _e( 'PHP Settings', 'geodirectory' );?></th><th><?php _e( 'Current Value', 'geodirectory' );?></th><th><?php _e( 'Recommended Value', 'geodirectory' );?></th>
2616
+				  	<th><?php _e('PHP Settings', 'geodirectory'); ?></th><th><?php _e('Current Value', 'geodirectory'); ?></th><th><?php _e('Recommended Value', 'geodirectory'); ?></th>
2617 2617
 				  </tr>
2618 2618
 				</thead>
2619 2619
 				<tbody>
2620 2620
 				  <tr>
2621
-				  	<td>max_input_time</td><td><?php echo @ini_get( 'max_input_time' );?></td><td>3000</td>
2621
+				  	<td>max_input_time</td><td><?php echo @ini_get('max_input_time'); ?></td><td>3000</td>
2622 2622
 				  </tr>
2623 2623
 				  <tr>
2624
-				  	<td>max_execution_time</td><td><?php  echo @ini_get( 'max_execution_time' );?></td><td>3000</td>
2624
+				  	<td>max_execution_time</td><td><?php  echo @ini_get('max_execution_time'); ?></td><td>3000</td>
2625 2625
 				  </tr>
2626 2626
 				  <tr>
2627
-				  	<td>memory_limit</td><td><?php echo @ini_get( 'memory_limit' );?></td><td>256M</td>
2627
+				  	<td>memory_limit</td><td><?php echo @ini_get('memory_limit'); ?></td><td>256M</td>
2628 2628
 				  </tr>
2629 2629
 				</tbody>
2630 2630
 		    </table>
@@ -2636,21 +2636,21 @@  discard block
 block discarded – undo
2636 2636
 	<div id="gd_ie_imposts" class="metabox-holder">
2637 2637
       <div class="meta-box-sortables ui-sortable">
2638 2638
         <div id="gd_ie_im_posts" class="postbox gd-hndle-pbox">
2639
-          <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e( 'Toggle panel - GD Listings: Import CSV', 'geodirectory' );?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2640
-          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Listings: Import CSV', 'geodirectory' );?></span></h3>
2639
+          <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e('Toggle panel - GD Listings: Import CSV', 'geodirectory'); ?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2640
+          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Listings: Import CSV', 'geodirectory'); ?></span></h3>
2641 2641
           <div class="inside">
2642 2642
             <table class="form-table">
2643 2643
 				<tbody>
2644 2644
 				  <tr>
2645 2645
 					<td class="gd-imex-box">
2646 2646
 						<div class="gd-im-choices">
2647
-						<p><input type="radio" value="update" name="gd_im_choicepost" id="gd_im_pchoice_u" /><label for="gd_im_pchoice_u"><?php _e( 'Update listing if post with post_id already exists.', 'geodirectory' );?></label></p>
2648
-						<p><input type="radio" checked="checked" value="skip" name="gd_im_choicepost" id="gd_im_pchoice_s" /><label for="gd_im_pchoice_s"><?php _e( 'Ignore listing if post with post_id already exists.', 'geodirectory' );?></label></p>
2647
+						<p><input type="radio" value="update" name="gd_im_choicepost" id="gd_im_pchoice_u" /><label for="gd_im_pchoice_u"><?php _e('Update listing if post with post_id already exists.', 'geodirectory'); ?></label></p>
2648
+						<p><input type="radio" checked="checked" value="skip" name="gd_im_choicepost" id="gd_im_pchoice_s" /><label for="gd_im_pchoice_s"><?php _e('Ignore listing if post with post_id already exists.', 'geodirectory'); ?></label></p>
2649 2649
 						</div>
2650 2650
 						<div class="plupload-upload-uic hide-if-no-js" id="gd_im_postplupload-upload-ui">
2651 2651
 							<input type="text" readonly="readonly" name="gd_im_post_file" class="gd-imex-file gd_im_post_file" id="gd_im_post" onclick="jQuery('#gd_im_postplupload-browse-button').trigger('click');" />
2652
-							<input id="gd_im_postplupload-browse-button" type="button" value="<?php echo SELECT_UPLOAD_CSV; ?>" class="gd-imex-pupload button-primary" /><input type="button" value="<?php echo esc_attr( __( 'Download Sample CSV', 'geodirectory' ) );?>" class="button-secondary" name="gd_ie_imposts_sample" id="gd_ie_imposts_sample">
2653
-						<input type="hidden" id="gd_ie_imposts_csv" value="<?php echo $gd_posts_sample_csv;?>" />
2652
+							<input id="gd_im_postplupload-browse-button" type="button" value="<?php echo SELECT_UPLOAD_CSV; ?>" class="gd-imex-pupload button-primary" /><input type="button" value="<?php echo esc_attr(__('Download Sample CSV', 'geodirectory')); ?>" class="button-secondary" name="gd_ie_imposts_sample" id="gd_ie_imposts_sample">
2653
+						<input type="hidden" id="gd_ie_imposts_csv" value="<?php echo $gd_posts_sample_csv; ?>" />
2654 2654
 							<?php
2655 2655
 							/**
2656 2656
 							 * Called just after the sample CSV download link.
@@ -2659,7 +2659,7 @@  discard block
 block discarded – undo
2659 2659
 							 */
2660 2660
 							do_action('geodir_sample_csv_download_link');
2661 2661
 							?>
2662
-							<span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce( 'gd_im_postpluploadan' ); ?>"></span>
2662
+							<span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce('gd_im_postpluploadan'); ?>"></span>
2663 2663
 							<div class="filelist"></div>
2664 2664
 						</div>
2665 2665
 						<span id="gd_im_catupload-error" style="display:none"></span>
@@ -2677,7 +2677,7 @@  discard block
 block discarded – undo
2677 2677
 							<input type="hidden" id="gd_terminateaction" value="continue"/>
2678 2678
 						</div>
2679 2679
 						<div class="gd-import-progress" id="gd-import-progress" style="display:none">
2680
-							<div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory');?> </b><font
2680
+							<div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory'); ?> </b><font
2681 2681
 									id="gd-import-done">0</font> / <font id="gd-import-total">0</font>&nbsp;( <font
2682 2682
 									id="gd-import-perc">0%</font> )
2683 2683
 								<div class="gd-fileprogress"></div>
@@ -2689,10 +2689,10 @@  discard block
 block discarded – undo
2689 2689
                     	<div class="gd-imex-btns" style="display:none;">
2690 2690
                         	<input type="hidden" class="geodir_import_file" name="geodir_import_file" value="save"/>
2691 2691
                         	<input onclick="gd_imex_PrepareImport(this, 'post')" type="button" value="<?php echo CSV_IMPORT_DATA; ?>" id="gd_import_data" class="button-primary" />
2692
-                        	<input onclick="gd_imex_ContinueImport(this, 'post')" type="button" value="<?php _e( "Continue Import Data", 'geodirectory' );?>" id="gd_continue_data" class="button-primary" style="display:none"/>
2693
-                        	<input type="button" value="<?php _e("Terminate Import Data", 'geodirectory');?>" id="gd_stop_import" class="button-primary" name="gd_stop_import" style="display:none" onclick="gd_imex_TerminateImport(this, 'post')"/>
2692
+                        	<input onclick="gd_imex_ContinueImport(this, 'post')" type="button" value="<?php _e("Continue Import Data", 'geodirectory'); ?>" id="gd_continue_data" class="button-primary" style="display:none"/>
2693
+                        	<input type="button" value="<?php _e("Terminate Import Data", 'geodirectory'); ?>" id="gd_stop_import" class="button-primary" name="gd_stop_import" style="display:none" onclick="gd_imex_TerminateImport(this, 'post')"/>
2694 2694
 							<div id="gd_process_data" style="display:none">
2695
-								<span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory');?>
2695
+								<span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory'); ?>
2696 2696
 							</div>
2697 2697
 						</div>
2698 2698
 					</td>
@@ -2706,26 +2706,26 @@  discard block
 block discarded – undo
2706 2706
 	<div id="gd_ie_excategs" class="metabox-holder">
2707 2707
 	  <div class="meta-box-sortables ui-sortable">
2708 2708
 		<div id="gd_ie_ex_posts" class="postbox gd-hndle-pbox">
2709
-		  <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e( 'Toggle panel - Listings: Export CSV', 'geodirectory' );?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2710
-          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Listings: Export CSV', 'geodirectory' );?></span></h3>
2709
+		  <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e('Toggle panel - Listings: Export CSV', 'geodirectory'); ?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2710
+          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Listings: Export CSV', 'geodirectory'); ?></span></h3>
2711 2711
 		  <div class="inside">
2712 2712
 			<table class="form-table">
2713 2713
 			  <tbody>
2714 2714
 				<tr>
2715 2715
 				  <td class="fld"><label for="gd_post_type">
2716
-					<?php _e( 'Post Type:', 'geodirectory' );?>
2716
+					<?php _e('Post Type:', 'geodirectory'); ?>
2717 2717
 					</label></td>
2718 2718
 				  <td><select name="gd_post_type" id="gd_post_type" style="min-width:140px">
2719
-					  <?php echo $gd_posttypes_option;?>
2719
+					  <?php echo $gd_posttypes_option; ?>
2720 2720
 					</select></td>
2721 2721
 				</tr>
2722 2722
 				<tr>
2723
-					<td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e( 'Max entries per csv file:', 'geodirectory' );?></label></td>
2724
-					<td><select name="gd_chunk_size" id="gd_chunk_size" style="min-width:140px"><?php echo $gd_chunksize_option;?></select><span class="description"><?php _e( 'Please select the maximum number of entries per csv file (defaults to 5000, you might want to lower this to prevent memory issues on some installs)', 'geodirectory' );?></span></td>
2723
+					<td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e('Max entries per csv file:', 'geodirectory'); ?></label></td>
2724
+					<td><select name="gd_chunk_size" id="gd_chunk_size" style="min-width:140px"><?php echo $gd_chunksize_option; ?></select><span class="description"><?php _e('Please select the maximum number of entries per csv file (defaults to 5000, you might want to lower this to prevent memory issues on some installs)', 'geodirectory'); ?></span></td>
2725 2725
 				  </tr>
2726 2726
 				<tr>
2727 2727
 				  <td class="fld" style="vertical-align:top"><label>
2728
-					<?php _e( 'Progress:', 'geodirectory' );?>
2728
+					<?php _e('Progress:', 'geodirectory'); ?>
2729 2729
 					</label></td>
2730 2730
 				  <td><div id='gd_progressbar_box'>
2731 2731
 					  <div id="gd_progressbar" class="gd_progressbar">
@@ -2733,13 +2733,13 @@  discard block
 block discarded – undo
2733 2733
 					  </div>
2734 2734
 					</div>
2735 2735
 					<p style="display:inline-block">
2736
-					  <?php _e( 'Elapsed Time:', 'geodirectory' );?>
2736
+					  <?php _e('Elapsed Time:', 'geodirectory'); ?>
2737 2737
 					</p>
2738 2738
 					  
2739 2739
 					<p id="gd_timer" class="gd_timer">00:00:00</p></td>
2740 2740
 				</tr>
2741 2741
 				<tr class="gd-ie-actions">
2742
-				  <td style="vertical-align:top"><input type="submit" value="<?php echo esc_attr( __( 'Export CSV', 'geodirectory' ) );?>" class="button-primary" name="gd_ie_exposts_submit" id="gd_ie_exposts_submit">
2742
+				  <td style="vertical-align:top"><input type="submit" value="<?php echo esc_attr(__('Export CSV', 'geodirectory')); ?>" class="button-primary" name="gd_ie_exposts_submit" id="gd_ie_exposts_submit">
2743 2743
 				  </td>
2744 2744
 				  <td id="gd_ie_ex_files" class="gd-ie-files"></td>
2745 2745
 				</tr>
@@ -2752,21 +2752,21 @@  discard block
 block discarded – undo
2752 2752
 	<div id="gd_ie_imcategs" class="metabox-holder">
2753 2753
       <div class="meta-box-sortables ui-sortable">
2754 2754
         <div id="gd_ie_imcats" class="postbox gd-hndle-pbox">
2755
-          <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e( 'Toggle panel - GD Categories: Import CSV', 'geodirectory' );?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2756
-          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Categories: Import CSV', 'geodirectory' );?></span></h3>
2755
+          <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e('Toggle panel - GD Categories: Import CSV', 'geodirectory'); ?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2756
+          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Categories: Import CSV', 'geodirectory'); ?></span></h3>
2757 2757
           <div class="inside">
2758 2758
             <table class="form-table">
2759 2759
 				<tbody>
2760 2760
 				  <tr>
2761 2761
 					<td class="gd-imex-box">
2762 2762
 						<div class="gd-im-choices">
2763
-						<p><input type="radio" value="update" name="gd_im_choicecat" id="gd_im_cchoice_u" /><label for="gd_im_cchoice_u"><?php _e( 'Update item if item with cat_id/cat_slug already exists.', 'geodirectory' );?></label></p>
2764
-						<p><input type="radio" checked="checked" value="skip" name="gd_im_choicecat" id="gd_im_cchoice_s" /><label for="gd_im_cchoice_s"><?php _e( 'Ignore item if item with cat_id/cat_slug already exists.', 'geodirectory' );?></label></p>
2763
+						<p><input type="radio" value="update" name="gd_im_choicecat" id="gd_im_cchoice_u" /><label for="gd_im_cchoice_u"><?php _e('Update item if item with cat_id/cat_slug already exists.', 'geodirectory'); ?></label></p>
2764
+						<p><input type="radio" checked="checked" value="skip" name="gd_im_choicecat" id="gd_im_cchoice_s" /><label for="gd_im_cchoice_s"><?php _e('Ignore item if item with cat_id/cat_slug already exists.', 'geodirectory'); ?></label></p>
2765 2765
 						</div>
2766 2766
 						<div class="plupload-upload-uic hide-if-no-js" id="gd_im_catplupload-upload-ui">
2767 2767
 							<input type="text" readonly="readonly" name="gd_im_cat_file" class="gd-imex-file gd_im_cat_file" id="gd_im_cat" onclick="jQuery('#gd_im_catplupload-browse-button').trigger('click');" />
2768
-							<input id="gd_im_catplupload-browse-button" type="button" value="<?php echo SELECT_UPLOAD_CSV; ?>" class="gd-imex-cupload button-primary" /><input type="button" value="<?php echo esc_attr( __( 'Download Sample CSV', 'geodirectory' ) );?>" class="button-secondary" name="gd_ie_imcats_sample" id="gd_ie_imcats_sample">
2769
-						<input type="hidden" id="gd_ie_imcats_csv" value="<?php echo $gd_cats_sample_csv;?>" />
2768
+							<input id="gd_im_catplupload-browse-button" type="button" value="<?php echo SELECT_UPLOAD_CSV; ?>" class="gd-imex-cupload button-primary" /><input type="button" value="<?php echo esc_attr(__('Download Sample CSV', 'geodirectory')); ?>" class="button-secondary" name="gd_ie_imcats_sample" id="gd_ie_imcats_sample">
2769
+						<input type="hidden" id="gd_ie_imcats_csv" value="<?php echo $gd_cats_sample_csv; ?>" />
2770 2770
 						<?php
2771 2771
 						/**
2772 2772
 						 * Called just after the sample CSV download link.
@@ -2776,7 +2776,7 @@  discard block
 block discarded – undo
2776 2776
 						 */
2777 2777
 						do_action('geodir_sample_cats_csv_download_link');
2778 2778
 						?>
2779
-							<span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce( 'gd_im_catpluploadan' ); ?>"></span>
2779
+							<span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce('gd_im_catpluploadan'); ?>"></span>
2780 2780
 							<div class="filelist"></div>
2781 2781
 						</div>
2782 2782
 						<span id="gd_im_catupload-error" style="display:none"></span>
@@ -2793,7 +2793,7 @@  discard block
 block discarded – undo
2793 2793
 							<input type="hidden" id="gd_terminateaction" value="continue"/>
2794 2794
 						</div>
2795 2795
 						<div class="gd-import-progress" id="gd-import-progress" style="display:none">
2796
-							<div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory');?> </b><font
2796
+							<div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory'); ?> </b><font
2797 2797
 									id="gd-import-done">0</font> / <font id="gd-import-total">0</font>&nbsp;( <font
2798 2798
 									id="gd-import-perc">0%</font> )
2799 2799
 								<div class="gd-fileprogress"></div>
@@ -2805,10 +2805,10 @@  discard block
 block discarded – undo
2805 2805
                     	<div class="gd-imex-btns" style="display:none;">
2806 2806
                         	<input type="hidden" class="geodir_import_file" name="geodir_import_file" value="save"/>
2807 2807
                         	<input onclick="gd_imex_PrepareImport(this, 'cat')" type="button" value="<?php echo CSV_IMPORT_DATA; ?>" id="gd_import_data" class="button-primary" />
2808
-                        	<input onclick="gd_imex_ContinueImport(this, 'cat')" type="button" value="<?php _e( "Continue Import Data", 'geodirectory' );?>" id="gd_continue_data" class="button-primary" style="display:none"/>
2809
-                        	<input type="button" value="<?php _e("Terminate Import Data", 'geodirectory');?>" id="gd_stop_import" class="button-primary" name="gd_stop_import" style="display:none" onclick="gd_imex_TerminateImport(this, 'cat')"/>
2808
+                        	<input onclick="gd_imex_ContinueImport(this, 'cat')" type="button" value="<?php _e("Continue Import Data", 'geodirectory'); ?>" id="gd_continue_data" class="button-primary" style="display:none"/>
2809
+                        	<input type="button" value="<?php _e("Terminate Import Data", 'geodirectory'); ?>" id="gd_stop_import" class="button-primary" name="gd_stop_import" style="display:none" onclick="gd_imex_TerminateImport(this, 'cat')"/>
2810 2810
 							<div id="gd_process_data" style="display:none">
2811
-								<span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory');?>
2811
+								<span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory'); ?>
2812 2812
 							</div>
2813 2813
 						</div>
2814 2814
 					</td>
@@ -2822,26 +2822,26 @@  discard block
 block discarded – undo
2822 2822
 	<div id="gd_ie_excategs" class="metabox-holder">
2823 2823
       <div class="meta-box-sortables ui-sortable">
2824 2824
         <div id="gd_ie_ex_cats" class="postbox gd-hndle-pbox">
2825
-          <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e( 'Toggle panel - GD Categories: Export CSV', 'geodirectory' );?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2826
-          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Categories: Export CSV', 'geodirectory' );?></span></h3>
2825
+          <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e('Toggle panel - GD Categories: Export CSV', 'geodirectory'); ?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2826
+          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Categories: Export CSV', 'geodirectory'); ?></span></h3>
2827 2827
           <div class="inside">
2828 2828
             <table class="form-table">
2829 2829
 				<tbody>
2830 2830
 				  <tr>
2831
-					<td class="fld"><label for="gd_post_type"><?php _e( 'Post Type:', 'geodirectory' );?></label></td>
2832
-					<td><select name="gd_post_type" id="gd_post_type" style="min-width:140px"><?php echo $gd_posttypes_option;?></select></td>
2831
+					<td class="fld"><label for="gd_post_type"><?php _e('Post Type:', 'geodirectory'); ?></label></td>
2832
+					<td><select name="gd_post_type" id="gd_post_type" style="min-width:140px"><?php echo $gd_posttypes_option; ?></select></td>
2833 2833
 				  </tr>
2834 2834
 				   <tr>
2835
-					<td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e( 'Max entries per csv file:', 'geodirectory' );?></label></td>
2836
-					<td><select name="gd_chunk_size" id="gd_chunk_size" style="min-width:140px"><?php echo $gd_chunksize_option;?></select><span class="description"><?php _e( 'Please select the maximum number of entries per csv file (defaults to 5000, you might want to lower this to prevent memory issues on some installs)', 'geodirectory' );?></span></td>
2835
+					<td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e('Max entries per csv file:', 'geodirectory'); ?></label></td>
2836
+					<td><select name="gd_chunk_size" id="gd_chunk_size" style="min-width:140px"><?php echo $gd_chunksize_option; ?></select><span class="description"><?php _e('Please select the maximum number of entries per csv file (defaults to 5000, you might want to lower this to prevent memory issues on some installs)', 'geodirectory'); ?></span></td>
2837 2837
 				  </tr>
2838 2838
 				  <tr>
2839
-					<td class="fld" style="vertical-align:top"><label><?php _e( 'Progress:', 'geodirectory' );?></label></td>
2840
-					<td><div id='gd_progressbar_box'><div id="gd_progressbar" class="gd_progressbar"><div class="gd-progress-label"></div></div></div><p style="display:inline-block"><?php _e( 'Elapsed Time:', 'geodirectory' );?></p>&nbsp;&nbsp;<p id="gd_timer" class="gd_timer">00:00:00</p></td>
2839
+					<td class="fld" style="vertical-align:top"><label><?php _e('Progress:', 'geodirectory'); ?></label></td>
2840
+					<td><div id='gd_progressbar_box'><div id="gd_progressbar" class="gd_progressbar"><div class="gd-progress-label"></div></div></div><p style="display:inline-block"><?php _e('Elapsed Time:', 'geodirectory'); ?></p>&nbsp;&nbsp;<p id="gd_timer" class="gd_timer">00:00:00</p></td>
2841 2841
 				  </tr>
2842 2842
 				  <tr class="gd-ie-actions">
2843 2843
 					<td style="vertical-align:top">
2844
-						<input type="submit" value="<?php echo esc_attr( __( 'Export CSV', 'geodirectory' ) );?>" class="button-primary" name="gd_ie_excats_submit" id="gd_ie_excats_submit">
2844
+						<input type="submit" value="<?php echo esc_attr(__('Export CSV', 'geodirectory')); ?>" class="button-primary" name="gd_ie_excats_submit" id="gd_ie_excats_submit">
2845 2845
 					</td>
2846 2846
 					<td id="gd_ie_ex_files" class="gd-ie-files"></td>
2847 2847
 				  </tr>
@@ -2863,7 +2863,7 @@  discard block
 block discarded – undo
2863 2863
      * @param array $gd_chunksize_options File chunk size options.
2864 2864
      * @param string $nonce Wordpress security token for GD import & export.
2865 2865
 	 */
2866
-	do_action( 'geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce );
2866
+	do_action('geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce);
2867 2867
 	?>
2868 2868
   </div>
2869 2869
 </div>
@@ -2882,7 +2882,7 @@  discard block
 block discarded – undo
2882 2882
         jQuery.ajax({
2883 2883
             url: ajaxurl,
2884 2884
             type: "POST",
2885
-            data: 'action=geodir_import_export&task=prepare_import&_pt=' + type + '&_file=' + uploadedFile + '&_nonce=<?php echo $nonce;?>',
2885
+            data: 'action=geodir_import_export&task=prepare_import&_pt=' + type + '&_file=' + uploadedFile + '&_nonce=<?php echo $nonce; ?>',
2886 2886
             dataType: 'json',
2887 2887
             cache: false,
2888 2888
             success: function(data) {
@@ -2934,7 +2934,7 @@  discard block
 block discarded – undo
2934 2934
 
2935 2935
         jQuery(cont).find('.filelist .file').remove();
2936 2936
         
2937
-        jQuery('#gd-import-msg', cont).find('#message').removeClass('updated').addClass('error').html("<p><?php echo esc_attr( PLZ_SELECT_CSV_FILE );?></p>");
2937
+        jQuery('#gd-import-msg', cont).find('#message').removeClass('updated').addClass('error').html("<p><?php echo esc_attr(PLZ_SELECT_CSV_FILE); ?></p>");
2938 2938
         jQuery('#gd-import-msg', cont).show();
2939 2939
         
2940 2940
         return false;
@@ -2993,7 +2993,7 @@  discard block
 block discarded – undo
2993 2993
     jQuery.ajax({
2994 2994
         url: ajaxurl,
2995 2995
         type: "POST",
2996
-        data: 'action=geodir_import_export&task=import_' + type + '&_pt=' + type + '&_file=' + uploadedFile + gddata + '&_ch=' + choice + '&_nonce=<?php echo $nonce;?>',
2996
+        data: 'action=geodir_import_export&task=import_' + type + '&_pt=' + type + '&_file=' + uploadedFile + gddata + '&_ch=' + choice + '&_nonce=<?php echo $nonce; ?>',
2997 2997
         dataType : 'json',
2998 2998
         cache: false,
2999 2999
         success: function (data) {
@@ -3182,27 +3182,27 @@  discard block
 block discarded – undo
3182 3182
 
3183 3183
     var gdMsg = '<p></p>';
3184 3184
     if ( processed > 0 ) {
3185
-        var msgParse = '<p><?php echo addslashes( sprintf( __( 'Total %s item(s) found.', 'geodirectory' ), '%s' ) );?></p>';
3185
+        var msgParse = '<p><?php echo addslashes(sprintf(__('Total %s item(s) found.', 'geodirectory'), '%s')); ?></p>';
3186 3186
         msgParse = msgParse.replace("%s", processed);
3187 3187
         gdMsg += msgParse;
3188 3188
     }
3189 3189
 
3190 3190
     if ( updated > 0 ) {
3191
-        var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) updated.', 'geodirectory' ), '%s', '%d' ) );?></p>';
3191
+        var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) updated.', 'geodirectory'), '%s', '%d')); ?></p>';
3192 3192
         msgParse = msgParse.replace("%s", updated);
3193 3193
         msgParse = msgParse.replace("%d", processed);
3194 3194
         gdMsg += msgParse;
3195 3195
     }
3196 3196
 
3197 3197
     if ( created > 0 ) {
3198
-        var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) added.', 'geodirectory' ), '%s', '%d' ) );?></p>';
3198
+        var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) added.', 'geodirectory'), '%s', '%d')); ?></p>';
3199 3199
         msgParse = msgParse.replace("%s", created);
3200 3200
         msgParse = msgParse.replace("%d", processed);
3201 3201
         gdMsg += msgParse;
3202 3202
     }
3203 3203
 
3204 3204
     if ( skipped > 0 ) {
3205
-        var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) ignored due to already exists.', 'geodirectory' ), '%s', '%d' ) );?></p>';
3205
+        var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) ignored due to already exists.', 'geodirectory'), '%s', '%d')); ?></p>';
3206 3206
         msgParse = msgParse.replace("%s", skipped);
3207 3207
         msgParse = msgParse.replace("%d", processed);
3208 3208
         gdMsg += msgParse;
@@ -3212,17 +3212,17 @@  discard block
 block discarded – undo
3212 3212
         if (type=='loc') {
3213 3213
             invalid_addr = invalid;
3214 3214
         }
3215
-        var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory' ), '%s', '%d' ) );?></p>';
3215
+        var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory'), '%s', '%d')); ?></p>';
3216 3216
         msgParse = msgParse.replace("%s", invalid_addr);
3217 3217
         msgParse = msgParse.replace("%d", total);
3218 3218
         gdMsg += msgParse;
3219 3219
     }
3220 3220
 
3221 3221
     if (invalid > 0 && type!='loc') {
3222
-        var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) could not be added due to blank title/invalid post type/invalid characters used in data.', 'geodirectory' ), '%s', '%d' ) );?></p>';
3222
+        var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) could not be added due to blank title/invalid post type/invalid characters used in data.', 'geodirectory'), '%s', '%d')); ?></p>';
3223 3223
         
3224 3224
         if (type=='hood') {
3225
-            msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) could not be added due to invalid neighbourhood data(name, latitude, longitude) or invalid location data(either location_id or city/region/country is empty)', 'geodirectory' ), '%s', '%d' ) );?></p>';
3225
+            msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) could not be added due to invalid neighbourhood data(name, latitude, longitude) or invalid location data(either location_id or city/region/country is empty)', 'geodirectory'), '%s', '%d')); ?></p>';
3226 3226
         }
3227 3227
         msgParse = msgParse.replace("%s", invalid);
3228 3228
         msgParse = msgParse.replace("%d", total);
@@ -3230,7 +3230,7 @@  discard block
 block discarded – undo
3230 3230
     }
3231 3231
 
3232 3232
     if (images > 0) {
3233
-        gdMsg += '<p><?php echo addslashes( sprintf( CSV_TRANSFER_IMG_FOLDER, $uploads['subdir'] ) );?></p>';
3233
+        gdMsg += '<p><?php echo addslashes(sprintf(CSV_TRANSFER_IMG_FOLDER, $uploads['subdir'])); ?></p>';
3234 3234
     }
3235 3235
     gdMsg += '<p></p>';
3236 3236
     jQuery('#gd-import-msg', cont).find('#message').removeClass('error').addClass('updated').html(gdMsg);
@@ -3387,7 +3387,7 @@  discard block
 block discarded – undo
3387 3387
         
3388 3388
     function gd_process_export_posts(el, post_type, total_posts, chunk_size, pages, page) {
3389 3389
         if (page < 2) {
3390
-            gd_progressbar(el, 0, '0% (0 / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>');
3390
+            gd_progressbar(el, 0, '0% (0 / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>');
3391 3391
             jQuery(el).find('#gd_timer').text('00:00:01');
3392 3392
             jQuery('#gd_ie_ex_files', el).html('');
3393 3393
         }
@@ -3395,7 +3395,7 @@  discard block
 block discarded – undo
3395 3395
         jQuery.ajax({
3396 3396
             url: ajaxurl,
3397 3397
             type: "POST",
3398
-            data: 'action=geodir_import_export&task=export_posts&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce;?>&_p=' + page,
3398
+            data: 'action=geodir_import_export&task=export_posts&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce; ?>&_p=' + page,
3399 3399
             dataType : 'json',
3400 3400
             cache: false,
3401 3401
             beforeSend: function (jqXHR, settings) {},
@@ -3409,11 +3409,11 @@  discard block
 block discarded – undo
3409 3409
                     } else {
3410 3410
                         if (pages < page || pages == page) {
3411 3411
                             window.clearInterval(timer_posts);
3412
-                            gd_progressbar(el, 100, '100% (' + total_posts + ' / ' + total_posts + ') <i class="fa fa-check"></i><?php echo esc_attr( __( 'Complete!', 'geodirectory' ) );?>');
3412
+                            gd_progressbar(el, 100, '100% (' + total_posts + ' / ' + total_posts + ') <i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirectory')); ?>');
3413 3413
                         } else {
3414 3414
                             var percentage = Math.round(((page * chunk_size) / total_posts) * 100);
3415 3415
                             percentage = percentage > 100 ? 100 : percentage;
3416
-                            gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>');
3416
+                            gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>');
3417 3417
                         }
3418 3418
                         if (typeof data.files != 'undefined' && jQuery(data.files).length ) {
3419 3419
                             var obj_files = data.files;
@@ -3443,7 +3443,7 @@  discard block
 block discarded – undo
3443 3443
 
3444 3444
     function gd_process_export_cats(el, post_type, total_cats, chunk_size, pages, page) {
3445 3445
         if (page < 2) {
3446
-            gd_progressbar(el, 0, '0% (0 / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>');
3446
+            gd_progressbar(el, 0, '0% (0 / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>');
3447 3447
             jQuery(el).find('#gd_timer').text('00:00:01');
3448 3448
             jQuery('#gd_ie_ex_files', el).html('');
3449 3449
         }
@@ -3451,7 +3451,7 @@  discard block
 block discarded – undo
3451 3451
         jQuery.ajax({
3452 3452
             url: ajaxurl,
3453 3453
             type: "POST",
3454
-            data: 'action=geodir_import_export&task=export_cats&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce;?>&_p=' + page,
3454
+            data: 'action=geodir_import_export&task=export_cats&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce; ?>&_p=' + page,
3455 3455
             dataType : 'json',
3456 3456
             cache: false,
3457 3457
             beforeSend: function (jqXHR, settings) {},
@@ -3465,11 +3465,11 @@  discard block
 block discarded – undo
3465 3465
                     } else {
3466 3466
                         if (pages < page || pages == page) {
3467 3467
                             window.clearInterval(timer_cats);
3468
-                            gd_progressbar(el, 100, '100% (' + total_cats + ' / ' + total_cats + ') <i class="fa fa-check"></i><?php echo esc_attr( __( 'Complete!', 'geodirectory' ) );?>');
3468
+                            gd_progressbar(el, 100, '100% (' + total_cats + ' / ' + total_cats + ') <i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirectory')); ?>');
3469 3469
                         } else {
3470 3470
                             var percentage = Math.round(((page * chunk_size) / total_cats) * 100);
3471 3471
                             percentage = percentage > 100 ? 100 : percentage;
3472
-                            gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php esc_attr_e( 'Exporting...', 'geodirectory' );?>');
3472
+                            gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php esc_attr_e('Exporting...', 'geodirectory'); ?>');
3473 3473
                         }
3474 3474
                         if (typeof data.files != 'undefined' && jQuery(data.files).length ) {
3475 3475
                             var obj_files = data.files;
@@ -3526,13 +3526,13 @@  discard block
 block discarded – undo
3526 3526
 function geodir_init_filesystem()
3527 3527
 {
3528 3528
 
3529
-    if(!function_exists('get_filesystem_method')){
3529
+    if (!function_exists('get_filesystem_method')) {
3530 3530
         require_once(ABSPATH."/wp-admin/includes/file.php");
3531 3531
     }
3532 3532
     $access_type = get_filesystem_method();
3533 3533
     if ($access_type === 'direct') {
3534 3534
         /* you can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */
3535
-        $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3535
+        $creds = request_filesystem_credentials(trailingslashit(site_url()).'wp-admin/', '', false, false, array());
3536 3536
 
3537 3537
         /* initialize the API */
3538 3538
         if (!WP_Filesystem($creds)) {
@@ -3545,7 +3545,7 @@  discard block
 block discarded – undo
3545 3545
         return $wp_filesystem;
3546 3546
         /* do our file manipulations below */
3547 3547
     } elseif (defined('FTP_USER')) {
3548
-        $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3548
+        $creds = request_filesystem_credentials(trailingslashit(site_url()).'wp-admin/', '', false, false, array());
3549 3549
 
3550 3550
         /* initialize the API */
3551 3551
         if (!WP_Filesystem($creds)) {
@@ -3580,7 +3580,7 @@  discard block
 block discarded – undo
3580 3580
  * @package GeoDirectory
3581 3581
  */
3582 3582
 function geodir_filesystem_notice()
3583
-{   if ( defined( 'DOING_AJAX' ) ){return;}
3583
+{   if (defined('DOING_AJAX')) {return; }
3584 3584
     $access_type = get_filesystem_method();
3585 3585
     if ($access_type === 'direct') {
3586 3586
     } elseif (!defined('FTP_USER')) {
@@ -3617,64 +3617,64 @@  discard block
 block discarded – undo
3617 3617
     // try to set higher limits for import
3618 3618
     $max_input_time = ini_get('max_input_time');
3619 3619
     $max_execution_time = ini_get('max_execution_time');
3620
-    $memory_limit= ini_get('memory_limit');
3620
+    $memory_limit = ini_get('memory_limit');
3621 3621
 
3622
-    if(!$max_input_time || $max_input_time<3000){
3622
+    if (!$max_input_time || $max_input_time < 3000) {
3623 3623
         ini_set('max_input_time', 3000);
3624 3624
     }
3625 3625
 
3626
-    if(!$max_execution_time || $max_execution_time<3000){
3626
+    if (!$max_execution_time || $max_execution_time < 3000) {
3627 3627
         ini_set('max_execution_time', 3000);
3628 3628
     }
3629 3629
 
3630
-    if($memory_limit && str_replace('M','',$memory_limit)){
3631
-        if(str_replace('M','',$memory_limit)<256){
3630
+    if ($memory_limit && str_replace('M', '', $memory_limit)) {
3631
+        if (str_replace('M', '', $memory_limit) < 256) {
3632 3632
             ini_set('memory_limit', '256M');
3633 3633
         }
3634 3634
     }
3635 3635
 
3636 3636
     $json = array();
3637 3637
 
3638
-    if ( !current_user_can( 'manage_options' ) ) {
3639
-        wp_send_json( $json );
3638
+    if (!current_user_can('manage_options')) {
3639
+        wp_send_json($json);
3640 3640
     }
3641 3641
 
3642
-    $task = isset( $_REQUEST['task'] ) ? $_REQUEST['task'] : NULL;
3643
-    $nonce = isset( $_REQUEST['_nonce'] ) ? $_REQUEST['_nonce'] : NULL;
3644
-    $stat = isset( $_REQUEST['_st'] ) ? $_REQUEST['_st'] : false;
3642
+    $task = isset($_REQUEST['task']) ? $_REQUEST['task'] : NULL;
3643
+    $nonce = isset($_REQUEST['_nonce']) ? $_REQUEST['_nonce'] : NULL;
3644
+    $stat = isset($_REQUEST['_st']) ? $_REQUEST['_st'] : false;
3645 3645
 
3646
-    if ( !wp_verify_nonce( $nonce, 'geodir_import_export_nonce' ) ) {
3647
-        wp_send_json( $json );
3646
+    if (!wp_verify_nonce($nonce, 'geodir_import_export_nonce')) {
3647
+        wp_send_json($json);
3648 3648
     }
3649 3649
 
3650
-    $post_type = isset( $_REQUEST['_pt'] ) ? $_REQUEST['_pt'] : NULL;
3651
-    $chunk_per_page = isset( $_REQUEST['_n'] ) ? absint($_REQUEST['_n']) : NULL;
3650
+    $post_type = isset($_REQUEST['_pt']) ? $_REQUEST['_pt'] : NULL;
3651
+    $chunk_per_page = isset($_REQUEST['_n']) ? absint($_REQUEST['_n']) : NULL;
3652 3652
     $chunk_per_page = $chunk_per_page < 50 || $chunk_per_page > 100000 ? 5000 : $chunk_per_page;
3653
-    $chunk_page_no = isset( $_REQUEST['_p'] ) ? absint($_REQUEST['_p']) : 1;
3653
+    $chunk_page_no = isset($_REQUEST['_p']) ? absint($_REQUEST['_p']) : 1;
3654 3654
 
3655 3655
     $wp_filesystem = geodir_init_filesystem();
3656 3656
     if (!$wp_filesystem) {
3657
-        $json['error'] = __( 'Filesystem ERROR: Could not access filesystem.', 'geodirectory' );
3658
-        wp_send_json( $json );
3657
+        $json['error'] = __('Filesystem ERROR: Could not access filesystem.', 'geodirectory');
3658
+        wp_send_json($json);
3659 3659
     }
3660 3660
 
3661 3661
     if (!empty($wp_filesystem) && isset($wp_filesystem->errors) && is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
3662
-        $json['error'] = __( 'Filesystem ERROR: ' . $wp_filesystem->errors->get_error_message(), 'geodirectory' );
3663
-        wp_send_json( $json );
3662
+        $json['error'] = __('Filesystem ERROR: '.$wp_filesystem->errors->get_error_message(), 'geodirectory');
3663
+        wp_send_json($json);
3664 3664
     }
3665 3665
 
3666
-    $csv_file_dir = geodir_path_import_export( false );
3667
-    if ( !$wp_filesystem->is_dir( $csv_file_dir ) ) {
3668
-        if ( !$wp_filesystem->mkdir( $csv_file_dir, FS_CHMOD_DIR ) ) {
3669
-            $json['error'] = __( 'ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory' );
3670
-            wp_send_json( $json );
3666
+    $csv_file_dir = geodir_path_import_export(false);
3667
+    if (!$wp_filesystem->is_dir($csv_file_dir)) {
3668
+        if (!$wp_filesystem->mkdir($csv_file_dir, FS_CHMOD_DIR)) {
3669
+            $json['error'] = __('ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory');
3670
+            wp_send_json($json);
3671 3671
         }
3672 3672
     }
3673 3673
     
3674 3674
     $location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
3675 3675
     $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
3676 3676
 
3677
-    switch ( $task ) {
3677
+    switch ($task) {
3678 3678
         case 'export_posts': {
3679 3679
             // WPML
3680 3680
             $is_wpml = geodir_is_wpml();
@@ -3685,22 +3685,22 @@  discard block
 block discarded – undo
3685 3685
                 $sitepress->switch_lang('all', true);
3686 3686
             }
3687 3687
             // WPML
3688
-            if ( $post_type == 'gd_event' ) {
3689
-                add_filter( 'geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2 );
3688
+            if ($post_type == 'gd_event') {
3689
+                add_filter('geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2);
3690 3690
             }
3691
-            $file_name = $post_type . '_' . date( 'dmyHi' );
3692
-            $posts_count = geodir_get_posts_count( $post_type );
3693
-            $file_url_base = geodir_path_import_export() . '/';
3694
-            $file_url = $file_url_base . $file_name . '.csv';
3695
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3696
-            $file_path_temp = $csv_file_dir . '/' . $post_type . '_' . $nonce . '.csv';
3691
+            $file_name = $post_type.'_'.date('dmyHi');
3692
+            $posts_count = geodir_get_posts_count($post_type);
3693
+            $file_url_base = geodir_path_import_export().'/';
3694
+            $file_url = $file_url_base.$file_name.'.csv';
3695
+            $file_path = $csv_file_dir.'/'.$file_name.'.csv';
3696
+            $file_path_temp = $csv_file_dir.'/'.$post_type.'_'.$nonce.'.csv';
3697 3697
             
3698 3698
             $chunk_file_paths = array();
3699 3699
 
3700
-            if ( isset( $_REQUEST['_st'] ) ) {
3701
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3702
-                $percentage = count( $posts_count ) > 0 && $line_count > 0 ? ceil( $line_count / $posts_count ) * 100 : 0;
3703
-                $percentage = min( $percentage, 100 );
3700
+            if (isset($_REQUEST['_st'])) {
3701
+                $line_count = (int) geodir_import_export_line_count($file_path_temp);
3702
+                $percentage = count($posts_count) > 0 && $line_count > 0 ? ceil($line_count / $posts_count) * 100 : 0;
3703
+                $percentage = min($percentage, 100);
3704 3704
                 
3705 3705
                 $json['percentage'] = $percentage;
3706 3706
                 // WPML
@@ -3708,45 +3708,45 @@  discard block
 block discarded – undo
3708 3708
                     $sitepress->switch_lang($active_lang, true);
3709 3709
                 }
3710 3710
                 // WPML
3711
-                wp_send_json( $json );
3711
+                wp_send_json($json);
3712 3712
                 gd_die();
3713 3713
             } else {
3714
-                if ( !$posts_count > 0 ) {
3715
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3714
+                if (!$posts_count > 0) {
3715
+                    $json['error'] = __('No records to export.', 'geodirectory');
3716 3716
                 } else {
3717 3717
                     $total_posts = $posts_count;
3718 3718
                     if ($chunk_per_page > $total_posts) {
3719 3719
                         $chunk_per_page = $total_posts;
3720 3720
                     }
3721
-                    $chunk_total_pages = ceil( $total_posts / $chunk_per_page );
3721
+                    $chunk_total_pages = ceil($total_posts / $chunk_per_page);
3722 3722
                     
3723 3723
                     $j = $chunk_page_no;
3724
-                    $chunk_save_posts = geodir_imex_get_posts( $post_type, $chunk_per_page, $j );
3724
+                    $chunk_save_posts = geodir_imex_get_posts($post_type, $chunk_per_page, $j);
3725 3725
                     
3726 3726
                     $per_page = 500;
3727 3727
                     if ($per_page > $chunk_per_page) {
3728 3728
                         $per_page = $chunk_per_page;
3729 3729
                     }
3730
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3730
+                    $total_pages = ceil($chunk_per_page / $per_page);
3731 3731
                     
3732
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3733
-                        $save_posts = array_slice( $chunk_save_posts , ( $i * $per_page ), $per_page );
3732
+                    for ($i = 0; $i <= $total_pages; $i++) {
3733
+                        $save_posts = array_slice($chunk_save_posts, ($i * $per_page), $per_page);
3734 3734
                         
3735 3735
                         $clear = $i == 0 ? true : false;
3736
-                        geodir_save_csv_data( $file_path_temp, $save_posts, $clear );
3736
+                        geodir_save_csv_data($file_path_temp, $save_posts, $clear);
3737 3737
                     }
3738 3738
                         
3739
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3740
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3741
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3742
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3743
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3739
+                    if ($wp_filesystem->exists($file_path_temp)) {
3740
+                        $chunk_page_no = $chunk_total_pages > 1 ? '-'.$j : '';
3741
+                        $chunk_file_name = $file_name.$chunk_page_no.'.csv';
3742
+                        $file_path = $csv_file_dir.'/'.$chunk_file_name;
3743
+                        $wp_filesystem->move($file_path_temp, $file_path, true);
3744 3744
                         
3745
-                        $file_url = $file_url_base . $chunk_file_name;
3746
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3745
+                        $file_url = $file_url_base.$chunk_file_name;
3746
+                        $chunk_file_paths[] = array('i' => $j.'.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3747 3747
                     }
3748 3748
                     
3749
-                    if ( !empty($chunk_file_paths) ) {
3749
+                    if (!empty($chunk_file_paths)) {
3750 3750
                         $json['total'] = $posts_count;
3751 3751
                         $json['files'] = $chunk_file_paths;
3752 3752
                     } else {
@@ -3754,7 +3754,7 @@  discard block
 block discarded – undo
3754 3754
                             $json['total'] = $posts_count;
3755 3755
                             $json['files'] = array();
3756 3756
                         } else {
3757
-                            $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3757
+                            $json['error'] = __('ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory');
3758 3758
                         }
3759 3759
                     }
3760 3760
                 }
@@ -3763,7 +3763,7 @@  discard block
 block discarded – undo
3763 3763
                     $sitepress->switch_lang($active_lang, true);
3764 3764
                 }
3765 3765
                 // WPML
3766
-                wp_send_json( $json );
3766
+                wp_send_json($json);
3767 3767
             }
3768 3768
         }
3769 3769
         break;
@@ -3777,20 +3777,20 @@  discard block
 block discarded – undo
3777 3777
                 $sitepress->switch_lang('all', true);
3778 3778
             }
3779 3779
             // WPML
3780
-            $file_name = $post_type . 'category_' . date( 'dmyHi' );
3780
+            $file_name = $post_type.'category_'.date('dmyHi');
3781 3781
             
3782
-            $terms_count = geodir_get_terms_count( $post_type );
3783
-            $file_url_base = geodir_path_import_export() . '/';
3784
-            $file_url = $file_url_base . $file_name . '.csv';
3785
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3786
-            $file_path_temp = $csv_file_dir . '/' . $post_type . 'category_' . $nonce . '.csv';
3782
+            $terms_count = geodir_get_terms_count($post_type);
3783
+            $file_url_base = geodir_path_import_export().'/';
3784
+            $file_url = $file_url_base.$file_name.'.csv';
3785
+            $file_path = $csv_file_dir.'/'.$file_name.'.csv';
3786
+            $file_path_temp = $csv_file_dir.'/'.$post_type.'category_'.$nonce.'.csv';
3787 3787
             
3788 3788
             $chunk_file_paths = array();
3789 3789
             
3790
-            if ( isset( $_REQUEST['_st'] ) ) {
3791
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3792
-                $percentage = count( $terms_count ) > 0 && $line_count > 0 ? ceil( $line_count / $terms_count ) * 100 : 0;
3793
-                $percentage = min( $percentage, 100 );
3790
+            if (isset($_REQUEST['_st'])) {
3791
+                $line_count = (int) geodir_import_export_line_count($file_path_temp);
3792
+                $percentage = count($terms_count) > 0 && $line_count > 0 ? ceil($line_count / $terms_count) * 100 : 0;
3793
+                $percentage = min($percentage, 100);
3794 3794
                 
3795 3795
                 $json['percentage'] = $percentage;
3796 3796
                 // WPML
@@ -3798,48 +3798,48 @@  discard block
 block discarded – undo
3798 3798
                     $sitepress->switch_lang($active_lang, true);
3799 3799
                 }
3800 3800
                 // WPML
3801
-                wp_send_json( $json );
3801
+                wp_send_json($json);
3802 3802
             } else {
3803
-                if ( !$terms_count > 0 ) {
3804
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3803
+                if (!$terms_count > 0) {
3804
+                    $json['error'] = __('No records to export.', 'geodirectory');
3805 3805
                 } else {
3806 3806
                     $total_terms = $terms_count;
3807 3807
                     if ($chunk_per_page > $terms_count) {
3808 3808
                         $chunk_per_page = $terms_count;
3809 3809
                     }
3810
-                    $chunk_total_pages = ceil( $total_terms / $chunk_per_page );
3810
+                    $chunk_total_pages = ceil($total_terms / $chunk_per_page);
3811 3811
                     
3812 3812
                     $j = $chunk_page_no;
3813
-                    $chunk_save_terms = geodir_imex_get_terms( $post_type, $chunk_per_page, $j );
3813
+                    $chunk_save_terms = geodir_imex_get_terms($post_type, $chunk_per_page, $j);
3814 3814
                     
3815 3815
                     $per_page = 500;
3816 3816
                     if ($per_page > $chunk_per_page) {
3817 3817
                         $per_page = $chunk_per_page;
3818 3818
                     }
3819
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3819
+                    $total_pages = ceil($chunk_per_page / $per_page);
3820 3820
                     
3821
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3822
-                        $save_terms = array_slice( $chunk_save_terms , ( $i * $per_page ), $per_page );
3821
+                    for ($i = 0; $i <= $total_pages; $i++) {
3822
+                        $save_terms = array_slice($chunk_save_terms, ($i * $per_page), $per_page);
3823 3823
                         
3824 3824
                         $clear = $i == 0 ? true : false;
3825
-                        geodir_save_csv_data( $file_path_temp, $save_terms, $clear );
3825
+                        geodir_save_csv_data($file_path_temp, $save_terms, $clear);
3826 3826
                     }
3827 3827
                     
3828
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3829
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3830
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3831
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3832
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3828
+                    if ($wp_filesystem->exists($file_path_temp)) {
3829
+                        $chunk_page_no = $chunk_total_pages > 1 ? '-'.$j : '';
3830
+                        $chunk_file_name = $file_name.$chunk_page_no.'.csv';
3831
+                        $file_path = $csv_file_dir.'/'.$chunk_file_name;
3832
+                        $wp_filesystem->move($file_path_temp, $file_path, true);
3833 3833
                         
3834
-                        $file_url = $file_url_base . $chunk_file_name;
3835
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3834
+                        $file_url = $file_url_base.$chunk_file_name;
3835
+                        $chunk_file_paths[] = array('i' => $j.'.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3836 3836
                     }
3837 3837
                     
3838
-                    if ( !empty($chunk_file_paths) ) {
3838
+                    if (!empty($chunk_file_paths)) {
3839 3839
                         $json['total'] = $terms_count;
3840 3840
                         $json['files'] = $chunk_file_paths;
3841 3841
                     } else {
3842
-                        $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3842
+                        $json['error'] = __('ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory');
3843 3843
                     }
3844 3844
                 }
3845 3845
                 // WPML
@@ -3847,127 +3847,127 @@  discard block
 block discarded – undo
3847 3847
                     $sitepress->switch_lang($active_lang, true);
3848 3848
                 }
3849 3849
                 // WPML
3850
-                wp_send_json( $json );
3850
+                wp_send_json($json);
3851 3851
             }
3852 3852
         }
3853 3853
         break;
3854 3854
         case 'export_locations': {
3855
-            $file_url_base = geodir_path_import_export() . '/';
3856
-            $file_name = 'gd_locations_' . date( 'dmyHi' );
3857
-            $file_url = $file_url_base . $file_name . '.csv';
3858
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3859
-            $file_path_temp = $csv_file_dir . '/gd_locations_' . $nonce . '.csv';
3855
+            $file_url_base = geodir_path_import_export().'/';
3856
+            $file_name = 'gd_locations_'.date('dmyHi');
3857
+            $file_url = $file_url_base.$file_name.'.csv';
3858
+            $file_path = $csv_file_dir.'/'.$file_name.'.csv';
3859
+            $file_path_temp = $csv_file_dir.'/gd_locations_'.$nonce.'.csv';
3860 3860
             
3861
-            $items_count = (int)geodir_location_imex_count_locations();
3861
+            $items_count = (int) geodir_location_imex_count_locations();
3862 3862
             
3863
-            if ( isset( $_REQUEST['_st'] ) ) {
3864
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3865
-                $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3866
-                $percentage = min( $percentage, 100 );
3863
+            if (isset($_REQUEST['_st'])) {
3864
+                $line_count = (int) geodir_import_export_line_count($file_path_temp);
3865
+                $percentage = count($items_count) > 0 && $line_count > 0 ? ceil($line_count / $items_count) * 100 : 0;
3866
+                $percentage = min($percentage, 100);
3867 3867
                 
3868 3868
                 $json['percentage'] = $percentage;
3869
-                wp_send_json( $json );
3869
+                wp_send_json($json);
3870 3870
             } else {
3871 3871
                 $chunk_file_paths = array();
3872 3872
                 
3873
-                if ( !$items_count > 0 ) {
3874
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3873
+                if (!$items_count > 0) {
3874
+                    $json['error'] = __('No records to export.', 'geodirectory');
3875 3875
                 } else {
3876
-                    $chunk_per_page = min( $chunk_per_page, $items_count );
3877
-                    $chunk_total_pages = ceil( $items_count / $chunk_per_page );
3876
+                    $chunk_per_page = min($chunk_per_page, $items_count);
3877
+                    $chunk_total_pages = ceil($items_count / $chunk_per_page);
3878 3878
                     
3879 3879
                     $j = $chunk_page_no;
3880
-                    $chunk_save_items = geodir_location_imex_locations_data( $chunk_per_page, $j );
3880
+                    $chunk_save_items = geodir_location_imex_locations_data($chunk_per_page, $j);
3881 3881
                     
3882 3882
                     $per_page = 500;
3883
-                    $per_page = min( $per_page, $chunk_per_page );
3884
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3883
+                    $per_page = min($per_page, $chunk_per_page);
3884
+                    $total_pages = ceil($chunk_per_page / $per_page);
3885 3885
                     
3886
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3887
-                        $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3886
+                    for ($i = 0; $i <= $total_pages; $i++) {
3887
+                        $save_items = array_slice($chunk_save_items, ($i * $per_page), $per_page);
3888 3888
                         
3889 3889
                         $clear = $i == 0 ? true : false;
3890
-                        geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3890
+                        geodir_save_csv_data($file_path_temp, $save_items, $clear);
3891 3891
                     }
3892 3892
                     
3893
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3894
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3895
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3896
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3897
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3893
+                    if ($wp_filesystem->exists($file_path_temp)) {
3894
+                        $chunk_page_no = $chunk_total_pages > 1 ? '-'.$j : '';
3895
+                        $chunk_file_name = $file_name.$chunk_page_no.'.csv';
3896
+                        $file_path = $csv_file_dir.'/'.$chunk_file_name;
3897
+                        $wp_filesystem->move($file_path_temp, $file_path, true);
3898 3898
                         
3899
-                        $file_url = $file_url_base . $chunk_file_name;
3900
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3899
+                        $file_url = $file_url_base.$chunk_file_name;
3900
+                        $chunk_file_paths[] = array('i' => $j.'.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3901 3901
                     }
3902 3902
                     
3903
-                    if ( !empty($chunk_file_paths) ) {
3903
+                    if (!empty($chunk_file_paths)) {
3904 3904
                         $json['total'] = $items_count;
3905 3905
                         $json['files'] = $chunk_file_paths;
3906 3906
                     } else {
3907
-                        $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3907
+                        $json['error'] = __('Fail, something wrong to create csv file.', 'geodirectory');
3908 3908
                     }
3909 3909
                 }
3910
-                wp_send_json( $json );
3910
+                wp_send_json($json);
3911 3911
             }
3912 3912
         }
3913 3913
         break;
3914 3914
         case 'export_hoods': {
3915
-            $file_url_base = geodir_path_import_export() . '/';
3916
-            $file_name = 'gd_neighbourhoods_' . date( 'dmyHi' );
3917
-            $file_url = $file_url_base . $file_name . '.csv';
3918
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3919
-            $file_path_temp = $csv_file_dir . '/gd_neighbourhoods_' . $nonce . '.csv';
3915
+            $file_url_base = geodir_path_import_export().'/';
3916
+            $file_name = 'gd_neighbourhoods_'.date('dmyHi');
3917
+            $file_url = $file_url_base.$file_name.'.csv';
3918
+            $file_path = $csv_file_dir.'/'.$file_name.'.csv';
3919
+            $file_path_temp = $csv_file_dir.'/gd_neighbourhoods_'.$nonce.'.csv';
3920 3920
             
3921
-            $items_count = (int)geodir_location_imex_count_neighbourhoods();
3921
+            $items_count = (int) geodir_location_imex_count_neighbourhoods();
3922 3922
             
3923
-            if ( isset( $_REQUEST['_st'] ) ) {
3924
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3925
-                $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3926
-                $percentage = min( $percentage, 100 );
3923
+            if (isset($_REQUEST['_st'])) {
3924
+                $line_count = (int) geodir_import_export_line_count($file_path_temp);
3925
+                $percentage = count($items_count) > 0 && $line_count > 0 ? ceil($line_count / $items_count) * 100 : 0;
3926
+                $percentage = min($percentage, 100);
3927 3927
                 
3928 3928
                 $json['percentage'] = $percentage;
3929
-                wp_send_json( $json );
3929
+                wp_send_json($json);
3930 3930
             } else {
3931 3931
                 $chunk_file_paths = array();
3932 3932
                 
3933
-                if ( !$items_count > 0 ) {
3934
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3933
+                if (!$items_count > 0) {
3934
+                    $json['error'] = __('No records to export.', 'geodirectory');
3935 3935
                 } else {
3936
-                    $chunk_per_page = min( $chunk_per_page, $items_count );
3937
-                    $chunk_total_pages = ceil( $items_count / $chunk_per_page );
3936
+                    $chunk_per_page = min($chunk_per_page, $items_count);
3937
+                    $chunk_total_pages = ceil($items_count / $chunk_per_page);
3938 3938
                     
3939 3939
                     $j = $chunk_page_no;
3940
-                    $chunk_save_items = geodir_location_imex_neighbourhoods_data( $chunk_per_page, $j );
3940
+                    $chunk_save_items = geodir_location_imex_neighbourhoods_data($chunk_per_page, $j);
3941 3941
                     
3942 3942
                     $per_page = 500;
3943
-                    $per_page = min( $per_page, $chunk_per_page );
3944
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3943
+                    $per_page = min($per_page, $chunk_per_page);
3944
+                    $total_pages = ceil($chunk_per_page / $per_page);
3945 3945
                     
3946
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3947
-                        $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3946
+                    for ($i = 0; $i <= $total_pages; $i++) {
3947
+                        $save_items = array_slice($chunk_save_items, ($i * $per_page), $per_page);
3948 3948
                         
3949 3949
                         $clear = $i == 0 ? true : false;
3950
-                        geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3950
+                        geodir_save_csv_data($file_path_temp, $save_items, $clear);
3951 3951
                     }
3952 3952
                     
3953
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3954
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3955
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3956
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3957
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3953
+                    if ($wp_filesystem->exists($file_path_temp)) {
3954
+                        $chunk_page_no = $chunk_total_pages > 1 ? '-'.$j : '';
3955
+                        $chunk_file_name = $file_name.$chunk_page_no.'.csv';
3956
+                        $file_path = $csv_file_dir.'/'.$chunk_file_name;
3957
+                        $wp_filesystem->move($file_path_temp, $file_path, true);
3958 3958
                         
3959
-                        $file_url = $file_url_base . $chunk_file_name;
3960
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3959
+                        $file_url = $file_url_base.$chunk_file_name;
3960
+                        $chunk_file_paths[] = array('i' => $j.'.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3961 3961
                     }
3962 3962
                     
3963
-                    if ( !empty($chunk_file_paths) ) {
3963
+                    if (!empty($chunk_file_paths)) {
3964 3964
                         $json['total'] = $items_count;
3965 3965
                         $json['files'] = $chunk_file_paths;
3966 3966
                     } else {
3967
-                        $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3967
+                        $json['error'] = __('Fail, something wrong to create csv file.', 'geodirectory');
3968 3968
                     }
3969 3969
                 }
3970
-                wp_send_json( $json );
3970
+                wp_send_json($json);
3971 3971
             }
3972 3972
         }
3973 3973
         break;
@@ -3984,33 +3984,33 @@  discard block
 block discarded – undo
3984 3984
             }
3985 3985
             // WPML
3986 3986
             
3987
-            ini_set( 'auto_detect_line_endings', true );
3987
+            ini_set('auto_detect_line_endings', true);
3988 3988
             
3989 3989
             $uploads = wp_upload_dir();
3990 3990
             $uploads_dir = $uploads['path'];
3991 3991
             $uploads_subdir = $uploads['subdir'];
3992 3992
             
3993
-            $csv_file = isset( $_POST['_file'] ) ? $_POST['_file'] : NULL;
3994
-            $import_choice = isset( $_REQUEST['_ch'] ) ? $_REQUEST['_ch'] : 'skip';
3993
+            $csv_file = isset($_POST['_file']) ? $_POST['_file'] : NULL;
3994
+            $import_choice = isset($_REQUEST['_ch']) ? $_REQUEST['_ch'] : 'skip';
3995 3995
             
3996
-            $csv_file_arr = explode( '/', $csv_file );
3997
-            $csv_filename = end( $csv_file_arr );
3998
-            $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $csv_filename;
3996
+            $csv_file_arr = explode('/', $csv_file);
3997
+            $csv_filename = end($csv_file_arr);
3998
+            $target_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$csv_filename;
3999 3999
             
4000 4000
             $json['file'] = $csv_file;
4001
-            $json['error'] = __( 'The uploaded file is not a valid csv file. Please try again.', 'geodirectory' );
4001
+            $json['error'] = __('The uploaded file is not a valid csv file. Please try again.', 'geodirectory');
4002 4002
             $file = array();
4003 4003
 
4004
-            if ( $csv_file && $wp_filesystem->is_file( $target_path ) && $wp_filesystem->exists( $target_path ) ) {
4005
-                $wp_filetype = wp_check_filetype_and_ext( $target_path, $csv_filename );
4004
+            if ($csv_file && $wp_filesystem->is_file($target_path) && $wp_filesystem->exists($target_path)) {
4005
+                $wp_filetype = wp_check_filetype_and_ext($target_path, $csv_filename);
4006 4006
                 
4007 4007
                 if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
4008 4008
                     $json['error'] = NULL;
4009 4009
                     $json['rows'] = 0;
4010 4010
                     
4011
-                    if ( ( $handle = fopen($target_path, "r" ) ) !== FALSE ) {
4012
-                        while ( ( $data = fgetcsv( $handle, 100000, "," ) ) !== FALSE ) {
4013
-                            if ( !empty( $data ) ) {
4011
+                    if (($handle = fopen($target_path, "r")) !== FALSE) {
4012
+                        while (($data = fgetcsv($handle, 100000, ",")) !== FALSE) {
4013
+                            if (!empty($data)) {
4014 4014
                                 $file[] = $data;
4015 4015
                             }
4016 4016
                         }
@@ -4023,19 +4023,19 @@  discard block
 block discarded – undo
4023 4023
                         $json['error'] = __('No data found in csv file.', 'geodirectory');
4024 4024
                     }
4025 4025
                 } else {
4026
-                    wp_send_json( $json );
4026
+                    wp_send_json($json);
4027 4027
                 }
4028 4028
             } else {
4029
-                wp_send_json( $json );
4029
+                wp_send_json($json);
4030 4030
             }
4031 4031
             
4032
-            if ( $task == 'prepare_import' || !empty( $json['error'] ) ) {
4033
-                wp_send_json( $json );
4032
+            if ($task == 'prepare_import' || !empty($json['error'])) {
4033
+                wp_send_json($json);
4034 4034
             }
4035 4035
             
4036 4036
             $total = $json['rows'];
4037
-            $limit = isset($_POST['limit']) ? (int)$_POST['limit'] : 1;
4038
-            $processed = isset($_POST['processed']) ? (int)$_POST['processed'] : 0;
4037
+            $limit = isset($_POST['limit']) ? (int) $_POST['limit'] : 1;
4038
+            $processed = isset($_POST['processed']) ? (int) $_POST['processed'] : 0;
4039 4039
             
4040 4040
             $count = $limit;
4041 4041
             
@@ -4060,13 +4060,13 @@  discard block
 block discarded – undo
4060 4060
             
4061 4061
             $post_types = geodir_get_posttypes();
4062 4062
 
4063
-            if ( $task == 'import_cat' ) {
4063
+            if ($task == 'import_cat') {
4064 4064
                 if (!empty($file)) {
4065 4065
                     $columns = isset($file[0]) ? $file[0] : NULL;
4066 4066
                     
4067 4067
                     if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4068 4068
                         $json['error'] = CSV_INVAILD_FILE;
4069
-                        wp_send_json( $json );
4069
+                        wp_send_json($json);
4070 4070
                         exit;
4071 4071
                     }
4072 4072
                     
@@ -4077,7 +4077,7 @@  discard block
 block discarded – undo
4077 4077
                         
4078 4078
                         if (isset($file[$index])) {
4079 4079
                             $row = $file[$index];
4080
-                            $row = array_map( 'trim', $row );
4080
+                            $row = array_map('trim', $row);
4081 4081
                             //$row = array_map( 'utf8_encode', $row );
4082 4082
                             
4083 4083
                             $cat_id = '';
@@ -4094,42 +4094,42 @@  discard block
 block discarded – undo
4094 4094
                             $cat_id_original = '';
4095 4095
                             
4096 4096
                             $c = 0;
4097
-                            foreach ($columns as $column ) {
4098
-                                if ( $column == 'cat_id' ) {
4099
-                                    $cat_id = (int)$row[$c];
4100
-                                } else if ( $column == 'cat_name' ) {
4097
+                            foreach ($columns as $column) {
4098
+                                if ($column == 'cat_id') {
4099
+                                    $cat_id = (int) $row[$c];
4100
+                                } else if ($column == 'cat_name') {
4101 4101
                                     $cat_name = $row[$c];
4102
-                                } else if ( $column == 'cat_slug' ) {
4102
+                                } else if ($column == 'cat_slug') {
4103 4103
                                     $cat_slug = $row[$c];
4104
-                                } else if ( $column == 'cat_posttype' ) {
4104
+                                } else if ($column == 'cat_posttype') {
4105 4105
                                     $cat_posttype = $row[$c];
4106
-                                } else if ( $column == 'cat_parent' ) {
4106
+                                } else if ($column == 'cat_parent') {
4107 4107
                                     $cat_parent = trim($row[$c]);
4108
-                                } else if ( $column == 'cat_schema' && $row[$c] != '' ) {
4108
+                                } else if ($column == 'cat_schema' && $row[$c] != '') {
4109 4109
                                     $cat_schema = $row[$c];
4110
-                                } else if ( $column == 'cat_description' ) {
4110
+                                } else if ($column == 'cat_description') {
4111 4111
                                     $cat_description = $row[$c];
4112
-                                } else if ( $column == 'cat_top_description' ) {
4112
+                                } else if ($column == 'cat_top_description') {
4113 4113
                                     $cat_top_description = $row[$c];
4114
-                                } else if ( $column == 'cat_image' ) {
4114
+                                } else if ($column == 'cat_image') {
4115 4115
                                     $cat_image = $row[$c];
4116
-                                } else if ( $column == 'cat_icon' ) {
4116
+                                } else if ($column == 'cat_icon') {
4117 4117
                                     $cat_icon = $row[$c];
4118 4118
                                 }
4119 4119
                                 // WPML
4120
-                                if ( $is_wpml ) {
4121
-                                    if ( $column == 'cat_language' ) {
4122
-                                        $cat_language = geodir_strtolower( trim( $row[$c] ) );
4123
-                                    } else if ( $column == 'cat_id_original' ) {
4124
-                                        $cat_id_original = (int)$row[$c];
4120
+                                if ($is_wpml) {
4121
+                                    if ($column == 'cat_language') {
4122
+                                        $cat_language = geodir_strtolower(trim($row[$c]));
4123
+                                    } else if ($column == 'cat_id_original') {
4124
+                                        $cat_id_original = (int) $row[$c];
4125 4125
                                     }
4126 4126
                                 }
4127 4127
                                 // WPML
4128 4128
                                 $c++;
4129 4129
                             }
4130 4130
                             
4131
-                            if ( $cat_name == '' || !in_array( $cat_posttype, $post_types ) ) {
4132
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) );
4131
+                            if ($cat_name == '' || !in_array($cat_posttype, $post_types)) {
4132
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be added due to blank title/invalid post type', 'geodirectory'));
4133 4133
                                 
4134 4134
                                 $invalid++;
4135 4135
                                 continue;
@@ -4147,24 +4147,24 @@  discard block
 block discarded – undo
4147 4147
                             $term_data['description'] = $cat_description;
4148 4148
                             $term_data['cat_schema'] = $cat_schema;
4149 4149
                             $term_data['top_description'] = $cat_top_description;
4150
-                            $term_data['image'] = $cat_image != '' ? basename( $cat_image ) : '';
4151
-                            $term_data['icon'] = $cat_icon != '' ? basename( $cat_icon ) : '';
4150
+                            $term_data['image'] = $cat_image != '' ? basename($cat_image) : '';
4151
+                            $term_data['icon'] = $cat_icon != '' ? basename($cat_icon) : '';
4152 4152
                             
4153 4153
                             //$term_data = array_map( 'utf8_encode', $term_data );
4154 4154
                             
4155
-                            $taxonomy = $cat_posttype . 'category';
4155
+                            $taxonomy = $cat_posttype.'category';
4156 4156
                             
4157 4157
                             $term_data['taxonomy'] = $taxonomy;
4158 4158
 
4159 4159
                             $term_parent_id = 0;
4160
-                            if ($cat_parent != "" || (int)$cat_parent > 0) {
4160
+                            if ($cat_parent != "" || (int) $cat_parent > 0) {
4161 4161
                                 $term_parent = '';
4162 4162
                                 
4163
-                                if ( $term_parent = get_term_by( 'name', $cat_parent, $taxonomy ) ) {
4163
+                                if ($term_parent = get_term_by('name', $cat_parent, $taxonomy)) {
4164 4164
                                     //
4165
-                                } else if ( $term_parent = get_term_by( 'slug', $cat_parent, $taxonomy ) ) {
4165
+                                } else if ($term_parent = get_term_by('slug', $cat_parent, $taxonomy)) {
4166 4166
                                     //
4167
-                                } else if ( $term_parent = get_term_by( 'id', $cat_parent, $taxonomy ) ) {
4167
+                                } else if ($term_parent = get_term_by('id', $cat_parent, $taxonomy)) {
4168 4168
                                     //
4169 4169
                                 } else {
4170 4170
                                     $term_parent_data = array();
@@ -4172,104 +4172,104 @@  discard block
 block discarded – undo
4172 4172
                                     //$term_parent_data = array_map( 'utf8_encode', $term_parent_data );
4173 4173
                                     $term_parent_data['taxonomy'] = $taxonomy;
4174 4174
                                     
4175
-                                    $term_parent_id = (int)geodir_imex_insert_term( $taxonomy, $term_parent_data );
4175
+                                    $term_parent_id = (int) geodir_imex_insert_term($taxonomy, $term_parent_data);
4176 4176
                                 }
4177 4177
                                 
4178
-                                if ( !empty( $term_parent ) && !is_wp_error( $term_parent ) ) {
4179
-                                    $term_parent_id = (int)$term_parent->term_id;
4178
+                                if (!empty($term_parent) && !is_wp_error($term_parent)) {
4179
+                                    $term_parent_id = (int) $term_parent->term_id;
4180 4180
                                 }
4181 4181
                             }
4182
-                            $term_data['parent'] = (int)$term_parent_id;
4182
+                            $term_data['parent'] = (int) $term_parent_id;
4183 4183
 
4184 4184
                             $term_id = NULL;
4185
-                            if ( $import_choice == 'update' ) {
4186
-                                if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
4185
+                            if ($import_choice == 'update') {
4186
+                                if ($cat_id > 0 && $term = (array) term_exists($cat_id, $taxonomy)) {
4187 4187
                                     $term_data['term_id'] = $term['term_id'];
4188 4188
                                     
4189
-                                    if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
4189
+                                    if ($term_id = geodir_imex_update_term($taxonomy, $term_data)) {
4190 4190
                                         $updated++;
4191 4191
                                     } else {
4192 4192
                                         $invalid++;
4193
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) );
4193
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory'));
4194 4194
                                     }
4195
-                                } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
4195
+                                } else if ($term_data['slug'] != '' && $term = (array) term_exists($term_data['slug'], $taxonomy)) {
4196 4196
                                     $term_data['term_id'] = $term['term_id'];
4197 4197
                                     
4198
-                                    if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
4198
+                                    if ($term_id = geodir_imex_update_term($taxonomy, $term_data)) {
4199 4199
                                         $updated++;
4200 4200
                                     } else {
4201 4201
                                         $invalid++;
4202
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) );
4202
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory'));
4203 4203
                                     }
4204 4204
                                 } else {
4205
-                                    if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
4205
+                                    if ($term_id = geodir_imex_insert_term($taxonomy, $term_data)) {
4206 4206
                                         $created++;
4207 4207
                                     } else {
4208 4208
                                         $invalid++;
4209
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) );
4209
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be added due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory'));
4210 4210
                                     }
4211 4211
                                 }
4212
-                            } else if ( $import_choice == 'skip' ) {
4213
-                                if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
4212
+                            } else if ($import_choice == 'skip') {
4213
+                                if ($cat_id > 0 && $term = (array) term_exists($cat_id, $taxonomy)) {
4214 4214
                                     $skipped++;
4215
-                                } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
4215
+                                } else if ($term_data['slug'] != '' && $term = (array) term_exists($term_data['slug'], $taxonomy)) {
4216 4216
                                     $skipped++;
4217 4217
                                 } else {
4218
-                                    if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
4218
+                                    if ($term_id = geodir_imex_insert_term($taxonomy, $term_data)) {
4219 4219
                                         $created++;
4220 4220
                                     } else {
4221 4221
                                         $invalid++;
4222
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) );
4222
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory'));
4223 4223
                                     }
4224 4224
                                 }
4225 4225
                             } else {
4226 4226
                                 $invalid++;
4227
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) );
4227
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be added due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory'));
4228 4228
                             }
4229 4229
                             
4230
-                            if ( $term_id ) {
4230
+                            if ($term_id) {
4231 4231
                                 // WPML
4232 4232
                                 if ($is_wpml && $cat_id_original > 0 && $cat_language != '') {
4233
-                                    $wpml_element_type = 'tax_' . $taxonomy;
4234
-                                    $source_language = geodir_get_language_for_element( $cat_id_original, $wpml_element_type );
4233
+                                    $wpml_element_type = 'tax_'.$taxonomy;
4234
+                                    $source_language = geodir_get_language_for_element($cat_id_original, $wpml_element_type);
4235 4235
                                     $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
4236 4236
 
4237
-                                    $trid = $sitepress->get_element_trid( $cat_id_original, $wpml_element_type );
4237
+                                    $trid = $sitepress->get_element_trid($cat_id_original, $wpml_element_type);
4238 4238
                                     
4239
-                                    $sitepress->set_element_language_details( $term_id, $wpml_element_type, $trid, $cat_language, $source_language );
4239
+                                    $sitepress->set_element_language_details($term_id, $wpml_element_type, $trid, $cat_language, $source_language);
4240 4240
                                 }
4241 4241
                                 // WPML
4242 4242
                                 
4243
-                                if ( isset( $term_data['top_description'] ) ) {
4244
-                                    update_tax_meta( $term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype );
4243
+                                if (isset($term_data['top_description'])) {
4244
+                                    update_tax_meta($term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype);
4245 4245
                                 }
4246 4246
                                 
4247
-                                if ( isset( $term_data['cat_schema'] ) ) {
4248
-                                    update_tax_meta( $term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype );
4247
+                                if (isset($term_data['cat_schema'])) {
4248
+                                    update_tax_meta($term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype);
4249 4249
                                 }
4250 4250
             
4251 4251
                                 $attachment = false;
4252
-                                if ( isset( $term_data['image'] ) && $term_data['image'] != '' ) {
4253
-                                    $cat_image = geodir_get_default_catimage( $term_id, $cat_posttype );
4254
-                                    $cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : '';
4252
+                                if (isset($term_data['image']) && $term_data['image'] != '') {
4253
+                                    $cat_image = geodir_get_default_catimage($term_id, $cat_posttype);
4254
+                                    $cat_image = !empty($cat_image) && isset($cat_image['src']) ? $cat_image['src'] : '';
4255 4255
                                     
4256
-                                    if ( basename($cat_image) != $term_data['image'] ) {
4256
+                                    if (basename($cat_image) != $term_data['image']) {
4257 4257
                                         $attachment = true;
4258
-                                        update_tax_meta( $term_id, 'ct_cat_default_img', array( 'id' => 'image', 'src' => $uploads['url'] . '/' . $term_data['image'] ), $cat_posttype );
4258
+                                        update_tax_meta($term_id, 'ct_cat_default_img', array('id' => 'image', 'src' => $uploads['url'].'/'.$term_data['image']), $cat_posttype);
4259 4259
                                     }
4260 4260
                                 }
4261 4261
                                 
4262
-                                if ( isset( $term_data['icon'] ) && $term_data['icon'] != '' ) {
4263
-                                    $cat_icon = get_tax_meta( $term_id, 'ct_cat_icon', false, $cat_posttype );
4264
-                                    $cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : '';
4262
+                                if (isset($term_data['icon']) && $term_data['icon'] != '') {
4263
+                                    $cat_icon = get_tax_meta($term_id, 'ct_cat_icon', false, $cat_posttype);
4264
+                                    $cat_icon = !empty($cat_icon) && isset($cat_icon['src']) ? $cat_icon['src'] : '';
4265 4265
                                         
4266
-                                    if ( basename($cat_icon) != $term_data['icon'] ) {
4266
+                                    if (basename($cat_icon) != $term_data['icon']) {
4267 4267
                                         $attachment = true;
4268
-                                        update_tax_meta( $term_id, 'ct_cat_icon', array( 'id' => 'icon', 'src' => $uploads['url'] . '/' . $term_data['icon'] ), $cat_posttype );
4268
+                                        update_tax_meta($term_id, 'ct_cat_icon', array('id' => 'icon', 'src' => $uploads['url'].'/'.$term_data['icon']), $cat_posttype);
4269 4269
                                     }
4270 4270
                                 }
4271 4271
                                 
4272
-                                if ( $attachment ) {
4272
+                                if ($attachment) {
4273 4273
                                     $images++;
4274 4274
                                 }
4275 4275
                             }
@@ -4291,13 +4291,13 @@  discard block
 block discarded – undo
4291 4291
                 $json['invalid'] = $invalid;
4292 4292
                 $json['images'] = $images;
4293 4293
                 
4294
-                wp_send_json( $json );
4294
+                wp_send_json($json);
4295 4295
                 exit;
4296
-            } else if ( $task == 'import_post' ) {
4296
+            } else if ($task == 'import_post') {
4297 4297
                 //run some stuff to make the import quicker
4298
-                wp_defer_term_counting( true );
4299
-                wp_defer_comment_counting( true );
4300
-                $wpdb->query( 'SET autocommit = 0;' );
4298
+                wp_defer_term_counting(true);
4299
+                wp_defer_comment_counting(true);
4300
+                $wpdb->query('SET autocommit = 0;');
4301 4301
 
4302 4302
                 //remove_all_actions('publish_post');
4303 4303
                 //remove_all_actions('transition_post_status');
@@ -4306,18 +4306,18 @@  discard block
 block discarded – undo
4306 4306
                 if (!empty($file)) {
4307 4307
                     $wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses.
4308 4308
                     $default_status = 'publish';
4309
-                    $current_date = date_i18n( 'Y-m-d', time() );
4309
+                    $current_date = date_i18n('Y-m-d', time());
4310 4310
                     
4311 4311
                     $columns = isset($file[0]) ? $file[0] : NULL;
4312 4312
                     
4313 4313
                     if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4314 4314
                         $json['error'] = CSV_INVAILD_FILE;
4315
-                        wp_send_json( $json );
4315
+                        wp_send_json($json);
4316 4316
                         exit;
4317 4317
                     }
4318 4318
 
4319 4319
                     $gd_error_log = __('GD IMPORT LISTINGS [ROW %d]:', 'geodirectory');
4320
-                    $wp_chars_error = __( '(check & remove if any invalid characters used in data)', 'geodirectory' );
4320
+                    $wp_chars_error = __('(check & remove if any invalid characters used in data)', 'geodirectory');
4321 4321
                     $processed_actual = 0;
4322 4322
                     for ($i = 1; $i <= $limit; $i++) {
4323 4323
                         $index = $processed + $i;
@@ -4326,9 +4326,9 @@  discard block
 block discarded – undo
4326 4326
                         if (isset($file[$index])) {
4327 4327
                             $processed_actual++;
4328 4328
                             $row = $file[$index];
4329
-                            $row = array_map( 'trim', $row );
4329
+                            $row = array_map('trim', $row);
4330 4330
                             //$row = array_map( 'utf8_encode', $row );
4331
-                            $row = array_map( 'addslashes_gpc', $row );
4331
+                            $row = array_map('addslashes_gpc', $row);
4332 4332
                             
4333 4333
                             $post_id = '';
4334 4334
                             $post_title = '';
@@ -4365,78 +4365,78 @@  discard block
 block discarded – undo
4365 4365
                             $original_post_id = '';
4366 4366
                                                         
4367 4367
                             $c = 0;
4368
-                            foreach ($columns as $column ) {
4368
+                            foreach ($columns as $column) {
4369 4369
                                 $gd_post[$column] = $row[$c];
4370 4370
                                 
4371
-                                if ( $column == 'post_id' ) {
4371
+                                if ($column == 'post_id') {
4372 4372
                                     $post_id = $row[$c];
4373
-                                } else if ( $column == 'post_title' ) {
4373
+                                } else if ($column == 'post_title') {
4374 4374
                                     $post_title = sanitize_text_field($row[$c]);
4375
-                                } else if ( $column == 'post_author' ) {
4375
+                                } else if ($column == 'post_author') {
4376 4376
                                     $post_author = $row[$c];
4377
-                                } else if ( $column == 'post_content' ) {
4377
+                                } else if ($column == 'post_content') {
4378 4378
                                     $post_content = $row[$c];
4379
-                                } else if ( $column == 'post_category' && $row[$c] != '' ) {
4380
-                                    $post_category_arr = explode( ',', $row[$c] );
4381
-                                } else if ( $column == 'default_category' ) {
4379
+                                } else if ($column == 'post_category' && $row[$c] != '') {
4380
+                                    $post_category_arr = explode(',', $row[$c]);
4381
+                                } else if ($column == 'default_category') {
4382 4382
                                     $default_category = wp_kses_normalize_entities($row[$c]);
4383
-                                } else if ( $column == 'post_tags' && $row[$c] != '' ) {
4384
-                                    $post_tags = explode( ',', sanitize_text_field($row[$c]) );
4385
-                                } else if ( $column == 'post_type' ) {
4383
+                                } else if ($column == 'post_tags' && $row[$c] != '') {
4384
+                                    $post_tags = explode(',', sanitize_text_field($row[$c]));
4385
+                                } else if ($column == 'post_type') {
4386 4386
                                     $post_type = $row[$c];
4387
-                                } else if ( $column == 'post_status' ) {
4388
-                                    $post_status = sanitize_key( $row[$c] );
4389
-                                } else if ( $column == 'is_featured' ) {
4390
-                                    $is_featured = (int)$row[$c];
4391
-                                } else if ( $column == 'geodir_video' ) {
4387
+                                } else if ($column == 'post_status') {
4388
+                                    $post_status = sanitize_key($row[$c]);
4389
+                                } else if ($column == 'is_featured') {
4390
+                                    $is_featured = (int) $row[$c];
4391
+                                } else if ($column == 'geodir_video') {
4392 4392
                                     $geodir_video = $row[$c];
4393
-                                } else if ( $column == 'post_address' ) {
4393
+                                } else if ($column == 'post_address') {
4394 4394
                                     $post_address = sanitize_text_field($row[$c]);
4395
-                                } else if ( $column == 'post_city' ) {
4395
+                                } else if ($column == 'post_city') {
4396 4396
                                     $post_city = sanitize_text_field($row[$c]);
4397
-                                } else if ( $column == 'post_region' ) {
4397
+                                } else if ($column == 'post_region') {
4398 4398
                                     $post_region = sanitize_text_field($row[$c]);
4399
-                                } else if ( $column == 'post_country' ) {
4399
+                                } else if ($column == 'post_country') {
4400 4400
                                     $post_country = sanitize_text_field($row[$c]);
4401
-                                } else if ( $column == 'post_zip' ) {
4401
+                                } else if ($column == 'post_zip') {
4402 4402
                                     $post_zip = sanitize_text_field($row[$c]);
4403
-                                } else if ( $column == 'post_latitude' ) {
4403
+                                } else if ($column == 'post_latitude') {
4404 4404
                                     $post_latitude = sanitize_text_field($row[$c]);
4405
-                                } else if ( $column == 'post_longitude' ) {
4405
+                                } else if ($column == 'post_longitude') {
4406 4406
                                     $post_longitude = sanitize_text_field($row[$c]);
4407
-                                } else if ( $column == 'post_neighbourhood' ) {
4407
+                                } else if ($column == 'post_neighbourhood') {
4408 4408
                                     $post_neighbourhood = sanitize_text_field($row[$c]);
4409 4409
                                     unset($gd_post[$column]);
4410
-                                } else if ( $column == 'neighbourhood_latitude' ) {
4410
+                                } else if ($column == 'neighbourhood_latitude') {
4411 4411
                                     $neighbourhood_latitude = sanitize_text_field($row[$c]);
4412
-                                } else if ( $column == 'neighbourhood_longitude' ) {
4412
+                                } else if ($column == 'neighbourhood_longitude') {
4413 4413
                                     $neighbourhood_longitude = sanitize_text_field($row[$c]);
4414
-                                } else if ( $column == 'geodir_timing' ) {
4414
+                                } else if ($column == 'geodir_timing') {
4415 4415
                                     $geodir_timing = sanitize_text_field($row[$c]);
4416
-                                } else if ( $column == 'geodir_contact' ) {
4416
+                                } else if ($column == 'geodir_contact') {
4417 4417
                                     $geodir_contact = sanitize_text_field($row[$c]);
4418
-                                } else if ( $column == 'geodir_email' ) {
4418
+                                } else if ($column == 'geodir_email') {
4419 4419
                                     $geodir_email = sanitize_email($row[$c]);
4420
-                                } else if ( $column == 'geodir_website' ) {
4420
+                                } else if ($column == 'geodir_website') {
4421 4421
                                     $geodir_website = sanitize_text_field($row[$c]);
4422
-                                } else if ( $column == 'geodir_twitter' ) {
4422
+                                } else if ($column == 'geodir_twitter') {
4423 4423
                                     $geodir_twitter = sanitize_text_field($row[$c]);
4424
-                                } else if ( $column == 'geodir_facebook' ) {
4424
+                                } else if ($column == 'geodir_facebook') {
4425 4425
                                     $geodir_facebook = sanitize_text_field($row[$c]);
4426
-                                } else if ( $column == 'IMAGE' && !empty( $row[$c] ) && $row[$c] != '' ) {
4426
+                                } else if ($column == 'IMAGE' && !empty($row[$c]) && $row[$c] != '') {
4427 4427
                                     $post_images[] = $row[$c];
4428
-                                } else if ( $column == 'alive_days' && (int)$row[$c] > 0 ) {
4429
-                                    $expire_date = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$row[$c] . ' days' ) );
4430
-                                } else if ( $column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never' ) {
4428
+                                } else if ($column == 'alive_days' && (int) $row[$c] > 0) {
4429
+                                    $expire_date = date_i18n('Y-m-d', strtotime($current_date.'+'.(int) $row[$c].' days'));
4430
+                                } else if ($column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never') {
4431 4431
                                     $row[$c] = str_replace('/', '-', $row[$c]);
4432
-                                    $expire_date = date_i18n( 'Y-m-d', strtotime( $row[$c] ) );
4432
+                                    $expire_date = date_i18n('Y-m-d', strtotime($row[$c]));
4433 4433
                                 }
4434 4434
                                 // WPML
4435 4435
                                 if ($is_wpml) {
4436 4436
                                     if ($column == 'language') {
4437 4437
                                         $language = geodir_strtolower(trim($row[$c]));
4438 4438
                                     } else if ($column == 'original_post_id') {
4439
-                                        $original_post_id = (int)$row[$c];
4439
+                                        $original_post_id = (int) $row[$c];
4440 4440
                                     }
4441 4441
                                 }
4442 4442
                                 // WPML
@@ -4451,43 +4451,43 @@  discard block
 block discarded – undo
4451 4451
 
4452 4452
                             $gd_post['IMAGE'] = $post_images;
4453 4453
                             
4454
-                            $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status;
4455
-                            $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status;
4454
+                            $post_status = !empty($post_status) ? sanitize_key($post_status) : $default_status;
4455
+                            $post_status = !empty($wp_post_statuses) && !isset($wp_post_statuses[$post_status]) ? $default_status : $post_status;
4456 4456
                                                                                                                 
4457 4457
                             $valid = true;
4458 4458
                             
4459
-                            if ( $post_title == '' || !in_array( $post_type, $post_types ) ) {
4459
+                            if ($post_title == '' || !in_array($post_type, $post_types)) {
4460 4460
                                 $invalid++;
4461 4461
                                 $valid = false;
4462
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) );
4462
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be added due to blank title/invalid post type', 'geodirectory'));
4463 4463
                             }
4464 4464
                             
4465
-                            $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
4466
-                            if ( $location_allowed ) {
4465
+                            $location_allowed = function_exists('geodir_cpt_no_location') && geodir_cpt_no_location($post_type) ? false : true;
4466
+                            if ($location_allowed) {
4467 4467
                                 $location_result = geodir_get_default_location();
4468
-                                if ( $post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '' ) {
4468
+                                if ($post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '') {
4469 4469
                                     $invalid_addr++;
4470 4470
                                     $valid = false;
4471
-                                    geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory' ) );
4472
-                                } else if ( !empty( $location_result ) && $location_result->location_id == 0 ) {
4473
-                                    if ( ( geodir_strtolower( $post_city ) != geodir_strtolower( $location_result->city ) ) || ( geodir_strtolower( $post_region ) != geodir_strtolower( $location_result->region ) ) || (geodir_strtolower( $post_country ) != geodir_strtolower( $location_result->country ) ) ) {
4471
+                                    geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory'));
4472
+                                } else if (!empty($location_result) && $location_result->location_id == 0) {
4473
+                                    if ((geodir_strtolower($post_city) != geodir_strtolower($location_result->city)) || (geodir_strtolower($post_region) != geodir_strtolower($location_result->region)) || (geodir_strtolower($post_country) != geodir_strtolower($location_result->country))) {
4474 4474
                                         $invalid_addr++;
4475 4475
                                         $valid = false;
4476
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory' ) );
4476
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory'));
4477 4477
                                     } else {
4478 4478
                                         if (!$location_manager) {
4479
-                                            $gd_post['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // Set the default location when location manager not activated.
4479
+                                            $gd_post['post_locations'] = '['.$location_result->city_slug.'],['.$location_result->region_slug.'],['.$location_result->country_slug.']'; // Set the default location when location manager not activated.
4480 4480
                                         }
4481 4481
                                     }
4482 4482
                                 }
4483 4483
                             }
4484 4484
                             
4485
-                            if ( !$valid ) {
4485
+                            if (!$valid) {
4486 4486
                                 continue;
4487 4487
                             }
4488 4488
 
4489
-                            $cat_taxonomy = $post_type . 'category';
4490
-                            $tags_taxonomy = $post_type . '_tags';
4489
+                            $cat_taxonomy = $post_type.'category';
4490
+                            $tags_taxonomy = $post_type.'_tags';
4491 4491
                             
4492 4492
                             if ($default_category != '' && !in_array($default_category, $post_category_arr)) {
4493 4493
                                 $post_category_arr = array_merge(array($default_category), $post_category_arr);
@@ -4495,29 +4495,29 @@  discard block
 block discarded – undo
4495 4495
 
4496 4496
                             $post_category = array();
4497 4497
                             $default_category_id = NULL;
4498
-                            if ( !empty( $post_category_arr ) ) {
4499
-                                foreach ( $post_category_arr as $value ) {
4500
-                                    $category_name = wp_kses_normalize_entities( trim( $value ) );
4498
+                            if (!empty($post_category_arr)) {
4499
+                                foreach ($post_category_arr as $value) {
4500
+                                    $category_name = wp_kses_normalize_entities(trim($value));
4501 4501
                                     
4502
-                                    if ( $category_name != '' ) {
4502
+                                    if ($category_name != '') {
4503 4503
                                         $term_category = array();
4504 4504
                                         
4505
-                                        if ( $term = get_term_by( 'name', $category_name, $cat_taxonomy ) ) {
4505
+                                        if ($term = get_term_by('name', $category_name, $cat_taxonomy)) {
4506 4506
                                             $term_category = $term;
4507
-                                        } else if ( $term = get_term_by( 'slug', $category_name, $cat_taxonomy ) ) {
4507
+                                        } else if ($term = get_term_by('slug', $category_name, $cat_taxonomy)) {
4508 4508
                                             $term_category = $term;
4509 4509
                                         } else {
4510 4510
                                             $term_data = array();
4511 4511
                                             $term_data['name'] = $category_name;
4512 4512
                                             $term_data['taxonomy'] = $cat_taxonomy;
4513 4513
                                             
4514
-                                            $term_id = geodir_imex_insert_term( $cat_taxonomy, $term_data );
4515
-                                            if ( $term_id ) {
4516
-                                                $term_category = get_term( $term_id, $cat_taxonomy );
4514
+                                            $term_id = geodir_imex_insert_term($cat_taxonomy, $term_data);
4515
+                                            if ($term_id) {
4516
+                                                $term_category = get_term($term_id, $cat_taxonomy);
4517 4517
                                             }
4518 4518
                                         }
4519 4519
                                         
4520
-                                        if ( !empty( $term_category ) && !is_wp_error( $term_category ) ) {
4520
+                                        if (!empty($term_category) && !is_wp_error($term_category)) {
4521 4521
                                             $post_category[] = intval($term_category->term_id);
4522 4522
                                             
4523 4523
                                             if ($category_name == $default_category) {
@@ -4538,15 +4538,15 @@  discard block
 block discarded – undo
4538 4538
                             $save_post['post_tags'] = $post_tags;
4539 4539
 
4540 4540
                             $saved_post_id = NULL;
4541
-                            if ( $import_choice == 'update' ) {
4542
-                                $gd_wp_error = __( 'Unable to add listing, please check the listing data.', 'geodirectory' );
4541
+                            if ($import_choice == 'update') {
4542
+                                $gd_wp_error = __('Unable to add listing, please check the listing data.', 'geodirectory');
4543 4543
                                 
4544
-                                if ( $post_id > 0 && get_post( $post_id ) ) {
4544
+                                if ($post_id > 0 && get_post($post_id)) {
4545 4545
                                     $save_post['ID'] = $post_id;
4546 4546
                                     
4547
-                                    if ( $saved_post_id = wp_update_post( $save_post, true ) ) {
4548
-                                        if ( is_wp_error( $saved_post_id ) ) {
4549
-                                            $gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error;
4547
+                                    if ($saved_post_id = wp_update_post($save_post, true)) {
4548
+                                        if (is_wp_error($saved_post_id)) {
4549
+                                            $gd_wp_error = $saved_post_id->get_error_message().' '.$wp_chars_error;
4550 4550
                                             $saved_post_id = 0;
4551 4551
                                         } else {
4552 4552
                                             $saved_post_id = $post_id;
@@ -4554,9 +4554,9 @@  discard block
 block discarded – undo
4554 4554
                                         }
4555 4555
                                     }
4556 4556
                                 } else {
4557
-                                    if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
4558
-                                        if ( is_wp_error( $saved_post_id ) ) {
4559
-                                            $gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error;
4557
+                                    if ($saved_post_id = wp_insert_post($save_post, true)) {
4558
+                                        if (is_wp_error($saved_post_id)) {
4559
+                                            $gd_wp_error = $saved_post_id->get_error_message().' '.$wp_chars_error;
4560 4560
                                             $saved_post_id = 0;
4561 4561
                                         } else {
4562 4562
                                             $created++;
@@ -4564,19 +4564,19 @@  discard block
 block discarded – undo
4564 4564
                                     }
4565 4565
                                 }
4566 4566
                                 
4567
-                                if ( !$saved_post_id > 0 ) {
4567
+                                if (!$saved_post_id > 0) {
4568 4568
                                     $invalid++;
4569
-                                    geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_wp_error );
4569
+                                    geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_wp_error);
4570 4570
                                 }
4571
-                            } else if ( $import_choice == 'skip' ) {
4572
-                                if ( $post_id > 0 && get_post( $post_id ) ) {
4571
+                            } else if ($import_choice == 'skip') {
4572
+                                if ($post_id > 0 && get_post($post_id)) {
4573 4573
                                     $skipped++;	
4574 4574
                                 } else {
4575
-                                    if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
4576
-                                        if ( is_wp_error( $saved_post_id ) ) {
4575
+                                    if ($saved_post_id = wp_insert_post($save_post, true)) {
4576
+                                        if (is_wp_error($saved_post_id)) {
4577 4577
                                             $invalid++;
4578 4578
                                             
4579
-                                            geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $saved_post_id->get_error_message() . ' ' . $wp_chars_error );
4579
+                                            geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$saved_post_id->get_error_message().' '.$wp_chars_error);
4580 4580
                                             $saved_post_id = 0;
4581 4581
                                         } else {
4582 4582
                                             $created++;
@@ -4584,28 +4584,28 @@  discard block
 block discarded – undo
4584 4584
                                     } else {
4585 4585
                                         $invalid++;
4586 4586
                                         
4587
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error );
4587
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$wp_chars_error);
4588 4588
                                     }
4589 4589
                                 }
4590 4590
                             } else {
4591 4591
                                 $invalid++;
4592 4592
                                 
4593
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error );
4593
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$wp_chars_error);
4594 4594
                             }
4595 4595
 
4596
-                            if ( (int)$saved_post_id > 0 ) {
4596
+                            if ((int) $saved_post_id > 0) {
4597 4597
                                 // WPML
4598 4598
                                 if ($is_wpml && $original_post_id > 0 && $language != '') {
4599
-                                    $wpml_post_type = 'post_' . $post_type;
4600
-                                    $source_language = geodir_get_language_for_element( $original_post_id, $wpml_post_type );
4599
+                                    $wpml_post_type = 'post_'.$post_type;
4600
+                                    $source_language = geodir_get_language_for_element($original_post_id, $wpml_post_type);
4601 4601
                                     $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
4602 4602
 
4603
-                                    $trid = $sitepress->get_element_trid( $original_post_id, $wpml_post_type );
4603
+                                    $trid = $sitepress->get_element_trid($original_post_id, $wpml_post_type);
4604 4604
                                     
4605
-                                    $sitepress->set_element_language_details( $saved_post_id, $wpml_post_type, $trid, $language, $source_language );
4605
+                                    $sitepress->set_element_language_details($saved_post_id, $wpml_post_type, $trid, $language, $source_language);
4606 4606
                                 }
4607 4607
                                 // WPML
4608
-                                $gd_post_info = geodir_get_post_info( $saved_post_id );
4608
+                                $gd_post_info = geodir_get_post_info($saved_post_id);
4609 4609
                                 
4610 4610
                                 $gd_post['post_id'] = $saved_post_id;
4611 4611
                                 $gd_post['ID'] = $saved_post_id;
@@ -4617,7 +4617,7 @@  discard block
 block discarded – undo
4617 4617
                                                     
4618 4618
                                 // post location
4619 4619
                                 $post_location_id = 0;
4620
-                                if ( $location_allowed && !empty( $location_result ) && $location_result->location_id > 0 ) {
4620
+                                if ($location_allowed && !empty($location_result) && $location_result->location_id > 0) {
4621 4621
                                     $gd_post['post_neighbourhood'] = '';
4622 4622
                                     
4623 4623
                                     $post_location_info = array(
@@ -4627,7 +4627,7 @@  discard block
 block discarded – undo
4627 4627
                                                                 'geo_lat' => $post_latitude,
4628 4628
                                                                 'geo_lng' => $post_longitude
4629 4629
                                                             );
4630
-                                    if ( $location_id = (int)geodir_add_new_location( $post_location_info ) ) {
4630
+                                    if ($location_id = (int) geodir_add_new_location($post_location_info)) {
4631 4631
                                         $post_location_id = $location_id;
4632 4632
                                     }
4633 4633
                                     
@@ -4665,14 +4665,14 @@  discard block
 block discarded – undo
4665 4665
                                 $gd_post['post_location_id'] = $post_location_id;
4666 4666
                                 
4667 4667
                                 // post package info
4668
-                                $package_id = isset( $gd_post['package_id'] ) && !empty( $gd_post['package_id'] ) ? (int)$gd_post['package_id'] : 0;
4668
+                                $package_id = isset($gd_post['package_id']) && !empty($gd_post['package_id']) ? (int) $gd_post['package_id'] : 0;
4669 4669
                                 if (!$package_id && !empty($gd_post_info) && isset($gd_post_info->package_id) && $gd_post_info->package_id) {
4670 4670
                                     $package_id = $gd_post_info->package_id;
4671 4671
                                 }
4672 4672
                                 
4673 4673
                                 $package_info = array();
4674 4674
                                 if ($package_id && function_exists('geodir_get_package_info_by_id')) {
4675
-                                    $package_info = (array)geodir_get_package_info_by_id($package_id);
4675
+                                    $package_info = (array) geodir_get_package_info_by_id($package_id);
4676 4676
                                     
4677 4677
                                     if (!(!empty($package_info) && isset($package_info['post_type']) && $package_info['post_type'] == $post_type)) {
4678 4678
                                         $package_info = array();
@@ -4680,18 +4680,18 @@  discard block
 block discarded – undo
4680 4680
                                 }
4681 4681
                                 
4682 4682
                                 if (empty($package_info)) {
4683
-                                    $package_info = (array)geodir_post_package_info( array(), '', $post_type );
4683
+                                    $package_info = (array) geodir_post_package_info(array(), '', $post_type);
4684 4684
                                 }
4685 4685
                                  
4686
-                                if (!empty($package_info))	 {
4686
+                                if (!empty($package_info)) {
4687 4687
                                     $package_id = $package_info['pid'];
4688 4688
                                     
4689 4689
                                     if (isset($gd_post['alive_days']) || isset($gd_post['expire_date'])) {
4690 4690
                                         $gd_post['expire_date'] = $expire_date;
4691 4691
                                     } else {
4692
-                                        if ( isset( $package_info['days'] ) && (int)$package_info['days'] > 0 ) {
4693
-                                            $gd_post['alive_days'] = (int)$package_info['days'];
4694
-                                            $gd_post['expire_date'] = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$package_info['days'] . ' days' ) );
4692
+                                        if (isset($package_info['days']) && (int) $package_info['days'] > 0) {
4693
+                                            $gd_post['alive_days'] = (int) $package_info['days'];
4694
+                                            $gd_post['expire_date'] = date_i18n('Y-m-d', strtotime($current_date.'+'.(int) $package_info['days'].' days'));
4695 4695
                                         } else {
4696 4696
                                             $gd_post['expire_date'] = 'Never';
4697 4697
                                         }
@@ -4700,7 +4700,7 @@  discard block
 block discarded – undo
4700 4700
                                     $gd_post['package_id'] = $package_id;
4701 4701
                                 }
4702 4702
 
4703
-                                $table = $plugin_prefix . $post_type . '_detail';
4703
+                                $table = $plugin_prefix.$post_type.'_detail';
4704 4704
                                 
4705 4705
                                 if ($post_type == 'gd_event') {
4706 4706
                                     $gd_post = geodir_imex_process_event_data($gd_post);
@@ -4711,28 +4711,28 @@  discard block
 block discarded – undo
4711 4711
                                 }
4712 4712
 
4713 4713
                                 // Export franchise fields
4714
-                                $is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false;
4714
+                                $is_franchise_active = is_plugin_active('geodir_franchise/geodir_franchise.php') && geodir_franchise_enabled($post_type) ? true : false;
4715 4715
                                 if ($is_franchise_active) {
4716
-                                    if ( isset( $gd_post['gd_is_franchise'] ) && (int)$gd_post['gd_is_franchise'] == 1 ) {
4716
+                                    if (isset($gd_post['gd_is_franchise']) && (int) $gd_post['gd_is_franchise'] == 1) {
4717 4717
                                         $gd_franchise_lock = array();
4718 4718
                                         
4719
-                                        if ( isset( $gd_post['gd_franchise_lock'] ) ) {
4720
-                                            $gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock'] );
4721
-                                            $gd_franchise_lock = trim( $gd_franchise_lock );
4722
-                                            $gd_franchise_lock = explode( ",", $gd_franchise_lock );
4719
+                                        if (isset($gd_post['gd_franchise_lock'])) {
4720
+                                            $gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock']);
4721
+                                            $gd_franchise_lock = trim($gd_franchise_lock);
4722
+                                            $gd_franchise_lock = explode(",", $gd_franchise_lock);
4723 4723
                                         }
4724 4724
                                         
4725
-                                        update_post_meta( $saved_post_id, 'gd_is_franchise', 1 );
4726
-                                        update_post_meta( $saved_post_id, 'gd_franchise_lock', $gd_franchise_lock );
4725
+                                        update_post_meta($saved_post_id, 'gd_is_franchise', 1);
4726
+                                        update_post_meta($saved_post_id, 'gd_franchise_lock', $gd_franchise_lock);
4727 4727
                                     } else {
4728
-                                        if ( isset( $gd_post['franchise'] ) && (int)$gd_post['franchise'] > 0 && geodir_franchise_check( (int)$gd_post['franchise'] ) ) {
4729
-                                            geodir_save_post_meta( $saved_post_id, 'franchise', (int)$gd_post['franchise'] );
4728
+                                        if (isset($gd_post['franchise']) && (int) $gd_post['franchise'] > 0 && geodir_franchise_check((int) $gd_post['franchise'])) {
4729
+                                            geodir_save_post_meta($saved_post_id, 'franchise', (int) $gd_post['franchise']);
4730 4730
                                         }
4731 4731
                                     }
4732 4732
                                 }
4733 4733
                                 
4734 4734
                                 if (!empty($save_post['post_category']) && is_array($save_post['post_category'])) {
4735
-                                    $save_post['post_category'] = array_unique( array_map( 'intval', $save_post['post_category'] ) );
4735
+                                    $save_post['post_category'] = array_unique(array_map('intval', $save_post['post_category']));
4736 4736
                                     if ($default_category_id) {
4737 4737
                                         $save_post['post_default_category'] = $default_category_id;
4738 4738
                                         $gd_post['default_category'] = $default_category_id;
@@ -4741,34 +4741,34 @@  discard block
 block discarded – undo
4741 4741
                                 }
4742 4742
                                 
4743 4743
                                 // Save post info
4744
-                                geodir_save_post_info( $saved_post_id, $gd_post );
4744
+                                geodir_save_post_info($saved_post_id, $gd_post);
4745 4745
                                 // post taxonomies
4746
-                                if ( !empty( $save_post['post_category'] ) ) {
4747
-                                    wp_set_object_terms( $saved_post_id, $save_post['post_category'], $cat_taxonomy );
4746
+                                if (!empty($save_post['post_category'])) {
4747
+                                    wp_set_object_terms($saved_post_id, $save_post['post_category'], $cat_taxonomy);
4748 4748
                                     
4749
-                                    $post_default_category = isset( $save_post['post_default_category'] ) ? $save_post['post_default_category'] : '';
4749
+                                    $post_default_category = isset($save_post['post_default_category']) ? $save_post['post_default_category'] : '';
4750 4750
                                     if ($default_category_id) {
4751 4751
                                         $post_default_category = $default_category_id;
4752 4752
                                     }
4753 4753
                                     $post_cat_ids = geodir_get_post_meta($saved_post_id, $cat_taxonomy);
4754 4754
                                     $save_post['post_category'] = !empty($post_cat_ids) ? explode(",", trim($post_cat_ids, ",")) : $save_post['post_category'];
4755
-                                    $post_category_str = !empty($save_post['post_category']) ? implode(",y:#", $save_post['post_category']) . ',y:' : '';
4755
+                                    $post_category_str = !empty($save_post['post_category']) ? implode(",y:#", $save_post['post_category']).',y:' : '';
4756 4756
                                     
4757 4757
                                     if ($post_category_str != '' && $post_default_category) {
4758
-                                        $post_category_str = str_replace($post_default_category . ',y:', $post_default_category . ',y,d:', $post_category_str);
4758
+                                        $post_category_str = str_replace($post_default_category.',y:', $post_default_category.',y,d:', $post_category_str);
4759 4759
                                     }
4760 4760
                                     
4761 4761
                                     $post_category_str = $post_category_str != '' ? array($cat_taxonomy => $post_category_str) : '';
4762 4762
                                     
4763
-                                    geodir_set_postcat_structure( $saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str );
4763
+                                    geodir_set_postcat_structure($saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str);
4764 4764
                                 }
4765 4765
 
4766
-                                if ( !empty( $save_post['post_tags'] ) ) {
4767
-                                    wp_set_object_terms( $saved_post_id, $save_post['post_tags'], $tags_taxonomy );
4766
+                                if (!empty($save_post['post_tags'])) {
4767
+                                    wp_set_object_terms($saved_post_id, $save_post['post_tags'], $tags_taxonomy);
4768 4768
                                 }
4769 4769
 
4770 4770
                                 // Post images
4771
-                                if ( !empty( $post_images ) ) {
4771
+                                if (!empty($post_images)) {
4772 4772
                                     $post_images = array_unique($post_images);
4773 4773
                                     
4774 4774
                                     $old_post_images_arr = array();
@@ -4776,82 +4776,82 @@  discard block
 block discarded – undo
4776 4776
                                     
4777 4777
                                     $order = 1;
4778 4778
                                     
4779
-                                    $old_post_images = geodir_get_images( $saved_post_id );
4779
+                                    $old_post_images = geodir_get_images($saved_post_id);
4780 4780
                                     if (!empty($old_post_images)) {
4781
-                                        foreach( $old_post_images as $old_post_image ) {
4781
+                                        foreach ($old_post_images as $old_post_image) {
4782 4782
                                             if (!empty($old_post_image) && isset($old_post_image->file) && $old_post_image->file != '') {
4783 4783
                                                 $old_post_images_arr[] = $old_post_image->file;
4784 4784
                                             }
4785 4785
                                         }
4786 4786
                                     }
4787 4787
                                     
4788
-                                    foreach ( $post_images as $post_image ) {
4789
-                                        $image_name = basename( $post_image );
4788
+                                    foreach ($post_images as $post_image) {
4789
+                                        $image_name = basename($post_image);
4790 4790
                                         $saved_post_images_arr[] = $image_name;
4791 4791
                                         
4792
-                                        if (!empty($old_post_images_arr) && in_array( $image_name, $old_post_images_arr) ) {
4792
+                                        if (!empty($old_post_images_arr) && in_array($image_name, $old_post_images_arr)) {
4793 4793
                                             continue; // Skip if image already exists.
4794 4794
                                         }
4795 4795
                                         
4796
-                                        $image_name_parts = explode( '.', $image_name );
4797
-                                        array_pop( $image_name_parts );
4798
-                                        $proper_image_name = implode( '.', $image_name_parts );
4796
+                                        $image_name_parts = explode('.', $image_name);
4797
+                                        array_pop($image_name_parts);
4798
+                                        $proper_image_name = implode('.', $image_name_parts);
4799 4799
                                         
4800
-                                        $arr_file_type = wp_check_filetype( $image_name );
4800
+                                        $arr_file_type = wp_check_filetype($image_name);
4801 4801
                                         
4802
-                                        if ( !empty( $arr_file_type ) ) {
4802
+                                        if (!empty($arr_file_type)) {
4803 4803
                                             $uploaded_file_type = $arr_file_type['type'];
4804 4804
                                             
4805 4805
                                             $attachment = array();
4806 4806
                                             $attachment['post_id'] = $saved_post_id;
4807 4807
                                             $attachment['title'] = $proper_image_name;
4808 4808
                                             $attachment['content'] = '';
4809
-                                            $attachment['file'] = $uploads_subdir . '/' . $image_name;
4809
+                                            $attachment['file'] = $uploads_subdir.'/'.$image_name;
4810 4810
                                             $attachment['mime_type'] = $uploaded_file_type;
4811 4811
                                             $attachment['menu_order'] = $order;
4812 4812
                                             $attachment['is_featured'] = 0;
4813 4813
 
4814 4814
                                             $attachment_set = '';
4815
-                                            foreach ( $attachment as $key => $val ) {
4816
-                                                if ( $val != '' ) {
4817
-                                                    $attachment_set .= $key . " = '" . $val . "', ";
4815
+                                            foreach ($attachment as $key => $val) {
4816
+                                                if ($val != '') {
4817
+                                                    $attachment_set .= $key." = '".$val."', ";
4818 4818
                                                 }
4819 4819
                                             }
4820
-                                            $attachment_set = trim( $attachment_set, ", " );
4820
+                                            $attachment_set = trim($attachment_set, ", ");
4821 4821
                                                                                         
4822 4822
                                             // Add new attachment
4823
-                                            $wpdb->query( "INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set );
4823
+                                            $wpdb->query("INSERT INTO ".GEODIR_ATTACHMENT_TABLE." SET ".$attachment_set);
4824 4824
                                                                                         
4825 4825
                                             $order++;
4826 4826
                                         }
4827 4827
                                     }
4828 4828
 
4829
-                                    $saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/" . implode("' AND file NOT LIKE '%/",  $saved_post_images_arr) . "' )" : '';
4829
+                                    $saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/".implode("' AND file NOT LIKE '%/", $saved_post_images_arr)."' )" : '';
4830 4830
                                     // Remove previous attachment
4831
-                                    $wpdb->query( "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = " . (int)$saved_post_id . " " . $saved_post_images_sql );
4831
+                                    $wpdb->query("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id = ".(int) $saved_post_id." ".$saved_post_images_sql);
4832 4832
                                     
4833
-                                    if ( !empty( $saved_post_images_arr ) ) {
4833
+                                    if (!empty($saved_post_images_arr)) {
4834 4834
                                         $menu_order = 1;
4835 4835
                                         
4836
-                                        foreach ( $saved_post_images_arr as $img_name ) {
4837
-                                            $wpdb->query( $wpdb->prepare( "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order = %d WHERE post_id =%d AND file LIKE %s", array( $menu_order, $saved_post_id, '%/' . $img_name ) ) );
4836
+                                        foreach ($saved_post_images_arr as $img_name) {
4837
+                                            $wpdb->query($wpdb->prepare("UPDATE ".GEODIR_ATTACHMENT_TABLE." SET menu_order = %d WHERE post_id =%d AND file LIKE %s", array($menu_order, $saved_post_id, '%/'.$img_name)));
4838 4838
                                             
4839
-                                            if( $menu_order == 1 ) {
4840
-                                                if ( $featured_image = $wpdb->get_var( $wpdb->prepare( "SELECT file FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =%d AND file LIKE %s", array( $saved_post_id, '%/' . $img_name ) ) ) ) {
4841
-                                                    $wpdb->query( $wpdb->prepare( "UPDATE " . $table . " SET featured_image = %s WHERE post_id =%d", array( $featured_image, $saved_post_id ) ) );
4839
+                                            if ($menu_order == 1) {
4840
+                                                if ($featured_image = $wpdb->get_var($wpdb->prepare("SELECT file FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id =%d AND file LIKE %s", array($saved_post_id, '%/'.$img_name)))) {
4841
+                                                    $wpdb->query($wpdb->prepare("UPDATE ".$table." SET featured_image = %s WHERE post_id =%d", array($featured_image, $saved_post_id)));
4842 4842
                                                 }
4843 4843
                                             }
4844 4844
                                             $menu_order++;
4845 4845
                                         }
4846 4846
                                     }
4847 4847
                                     
4848
-                                    if ( $order > 1 ) {
4848
+                                    if ($order > 1) {
4849 4849
                                         $images++;
4850 4850
                                     }
4851 4851
                                 }
4852 4852
 
4853 4853
                                 /** This action is documented in geodirectory-functions/post-functions.php */
4854
-                                do_action( 'geodir_after_save_listing', $saved_post_id, $gd_post );
4854
+                                do_action('geodir_after_save_listing', $saved_post_id, $gd_post);
4855 4855
                                 
4856 4856
                                 if (isset($is_featured)) {
4857 4857
                                     geodir_save_post_meta($saved_post_id, 'is_featured', $is_featured);
@@ -4871,10 +4871,10 @@  discard block
 block discarded – undo
4871 4871
                 }
4872 4872
 
4873 4873
                 //undo some stuff to make the import quicker
4874
-                wp_defer_term_counting( false );
4875
-                wp_defer_comment_counting( false );
4876
-                $wpdb->query( 'COMMIT;' );
4877
-                $wpdb->query( 'SET autocommit = 1;' );
4874
+                wp_defer_term_counting(false);
4875
+                wp_defer_comment_counting(false);
4876
+                $wpdb->query('COMMIT;');
4877
+                $wpdb->query('SET autocommit = 1;');
4878 4878
 
4879 4879
                 $json = array();
4880 4880
                 $json['processed'] = $processed_actual;
@@ -4885,9 +4885,9 @@  discard block
 block discarded – undo
4885 4885
                 $json['invalid_addr'] = $invalid_addr;
4886 4886
                 $json['images'] = $images;
4887 4887
                 
4888
-                wp_send_json( $json );
4888
+                wp_send_json($json);
4889 4889
                 exit;
4890
-            } else if ( $task == 'import_loc' ) {
4890
+            } else if ($task == 'import_loc') {
4891 4891
                 global $gd_post_types;
4892 4892
                 $gd_post_types = $post_types;
4893 4893
                 
@@ -4896,82 +4896,82 @@  discard block
 block discarded – undo
4896 4896
                     
4897 4897
                     if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4898 4898
                         $json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
4899
-                        wp_send_json( $json );
4899
+                        wp_send_json($json);
4900 4900
                     }
4901 4901
                     
4902 4902
                     $gd_error_log = __('GD IMPORT LOCATIONS [ROW %d]:', 'geodirectory');
4903
-                    $gd_error_location = __( 'Could not be saved due to blank/invalid address(city, region, country, latitude, longitude)', 'geodirectory' );
4903
+                    $gd_error_location = __('Could not be saved due to blank/invalid address(city, region, country, latitude, longitude)', 'geodirectory');
4904 4904
                     for ($i = 1; $i <= $limit; $i++) {
4905 4905
                         $index = $processed + $i;
4906 4906
                         
4907 4907
                         if (isset($file[$index])) {
4908 4908
                             $row = $file[$index];
4909
-                            $row = array_map( 'trim', $row );
4909
+                            $row = array_map('trim', $row);
4910 4910
                             $data = array();
4911 4911
                             
4912
-                            foreach ($columns as $c => $column ) {
4912
+                            foreach ($columns as $c => $column) {
4913 4913
                                 if (in_array($column, array('location_id', 'latitude', 'longitude', 'city', 'city_slug', 'region', 'country', 'city_meta', 'city_desc', 'region_meta', 'region_desc', 'country_meta', 'country_desc'))) {
4914 4914
                                     $data[$column] = $row[$c];
4915 4915
                                 }
4916 4916
                             }
4917 4917
 
4918
-                            if ( empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude']) ) {
4918
+                            if (empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude'])) {
4919 4919
                                 $invalid++;
4920
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4920
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location);
4921 4921
                                 continue;
4922 4922
                             }
4923 4923
                             
4924 4924
                             $data['location_id'] = isset($data['location_id']) ? absint($data['location_id']) : 0;
4925 4925
                             
4926
-                            if ( $import_choice == 'update' ) {
4927
-                                if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4928
-                                    if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4926
+                            if ($import_choice == 'update') {
4927
+                                if ((int) $data['location_id'] > 0 && $location = geodir_get_location_by_id('', (int) $data['location_id'])) {
4928
+                                    if ($location_id = geodir_location_update_city($data, true, $location)) {
4929 4929
                                         $updated++;
4930 4930
                                     } else {
4931 4931
                                         $invalid++;
4932
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4932
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location);
4933 4933
                                     }
4934
-                                } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4935
-                                    $data['location_id'] = (int)$location->location_id;
4934
+                                } else if (!empty($data['city_slug']) && $location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug']))) {
4935
+                                    $data['location_id'] = (int) $location->location_id;
4936 4936
                                     
4937
-                                    if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region'] ) ) ) {
4938
-                                        $data['location_id'] = (int)$location->location_id;
4939
-                                    } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'region' => $data['region'] ) ) ) {
4940
-                                        $data['location_id'] = (int)$location->location_id;
4941
-                                    } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'] ) ) ) {
4942
-                                        $data['location_id'] = (int)$location->location_id;
4937
+                                    if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region']))) {
4938
+                                        $data['location_id'] = (int) $location->location_id;
4939
+                                    } else if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'region' => $data['region']))) {
4940
+                                        $data['location_id'] = (int) $location->location_id;
4941
+                                    } else if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'country' => $data['country']))) {
4942
+                                        $data['location_id'] = (int) $location->location_id;
4943 4943
                                     }
4944 4944
                                     
4945
-                                    if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4945
+                                    if ($location_id = geodir_location_update_city($data, true, $location)) {
4946 4946
                                         $updated++;
4947 4947
                                     } else {
4948 4948
                                         $invalid++;
4949
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4949
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location);
4950 4950
                                     }
4951 4951
                                 } else {
4952
-                                    if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4952
+                                    if ($location_id = geodir_location_insert_city($data, true)) {
4953 4953
                                         $created++;
4954 4954
                                     } else {
4955 4955
                                         $invalid++;
4956
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4956
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location);
4957 4957
                                     }
4958 4958
                                 }
4959
-                            } elseif ( $import_choice == 'skip' ) {
4960
-                                if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4959
+                            } elseif ($import_choice == 'skip') {
4960
+                                if ((int) $data['location_id'] > 0 && $location = geodir_get_location_by_id('', (int) $data['location_id'])) {
4961 4961
                                     $skipped++;
4962
-                                } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4962
+                                } else if (!empty($data['city_slug']) && $location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug']))) {
4963 4963
                                     $skipped++;
4964 4964
                                 } else {
4965
-                                    if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4965
+                                    if ($location_id = geodir_location_insert_city($data, true)) {
4966 4966
                                         $created++;
4967 4967
                                     } else {
4968 4968
                                         $invalid++;
4969
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4969
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location);
4970 4970
                                     }
4971 4971
                                 }
4972 4972
                             } else {
4973 4973
                                 $invalid++;
4974
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4974
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location);
4975 4975
                             }
4976 4976
                         }
4977 4977
                     }
@@ -4985,24 +4985,24 @@  discard block
 block discarded – undo
4985 4985
                 $json['invalid'] = $invalid;
4986 4986
                 $json['images'] = $images;
4987 4987
                 
4988
-                wp_send_json( $json );
4989
-            } else if ( $task == 'import_hood' ) {               
4988
+                wp_send_json($json);
4989
+            } else if ($task == 'import_hood') {               
4990 4990
                 if (!empty($file)) {
4991 4991
                     $columns = isset($file[0]) ? $file[0] : NULL;
4992 4992
                     
4993 4993
                     if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4994 4994
                         $json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
4995
-                        wp_send_json( $json );
4995
+                        wp_send_json($json);
4996 4996
                     }
4997 4997
                     
4998 4998
                     $gd_error_log = __('GD IMPORT NEIGHBOURHOODS [ROW %d]:', 'geodirectory');
4999
-                    $gd_error_hood = __( 'Could not be saved due to invalid neighbourhood data(name, latitude, longitude) or invalid location data(either location_id or city/region/country is empty)', 'geodirectory' );
4999
+                    $gd_error_hood = __('Could not be saved due to invalid neighbourhood data(name, latitude, longitude) or invalid location data(either location_id or city/region/country is empty)', 'geodirectory');
5000 5000
                     for ($i = 1; $i <= $limit; $i++) {
5001 5001
                         $index = $processed + $i;
5002 5002
                         
5003 5003
                         if (isset($file[$index])) {
5004 5004
                             $row = $file[$index];
5005
-                            $row = array_map( 'trim', $row );
5005
+                            $row = array_map('trim', $row);
5006 5006
                             $data = array();
5007 5007
                             
5008 5008
                             foreach ($columns as $c => $column) {
@@ -5013,20 +5013,20 @@  discard block
 block discarded – undo
5013 5013
 
5014 5014
                             if (empty($data['neighbourhood_name']) || empty($data['latitude']) || empty($data['longitude'])) {
5015 5015
                                 $invalid++;
5016
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5016
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
5017 5017
                                 continue;
5018 5018
                             }
5019 5019
                             
5020 5020
                             $location_info = array();
5021
-                            if (!empty($data['location_id']) && (int)$data['location_id'] > 0) {
5022
-                                $location_info = geodir_get_location_by_id('', (int)$data['location_id']);
5021
+                            if (!empty($data['location_id']) && (int) $data['location_id'] > 0) {
5022
+                                $location_info = geodir_get_location_by_id('', (int) $data['location_id']);
5023 5023
                             } else if (!empty($data['city']) && !empty($data['region']) && !empty($data['country'])) {
5024 5024
                                 $location_info = geodir_get_location_by_slug('city', array('fields' => 'location_id', 'city' => $data['city'], 'country' => $data['country'], 'region' => $data['region']));
5025 5025
                             }
5026 5026
 
5027 5027
                             if (empty($location_info)) {
5028 5028
                                 $invalid++;
5029
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5029
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
5030 5030
                                 continue;
5031 5031
                             }
5032 5032
                             
@@ -5041,35 +5041,35 @@  discard block
 block discarded – undo
5041 5041
                             $hood_data['hood_longitude'] = $data['longitude'];
5042 5042
                             $hood_data['hood_location_id'] = $location_id;
5043 5043
                                     
5044
-                            if ( $import_choice == 'update' ) {
5045
-                                if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
5046
-                                    $hood_data['hood_id'] = (int)$data['neighbourhood_id'];
5044
+                            if ($import_choice == 'update') {
5045
+                                if ((int) $data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int) $data['neighbourhood_id']))) {
5046
+                                    $hood_data['hood_id'] = (int) $data['neighbourhood_id'];
5047 5047
                                     
5048 5048
                                     if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
5049 5049
                                         $updated++;
5050 5050
                                     } else {
5051 5051
                                         $invalid++;
5052
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5052
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
5053 5053
                                     }
5054 5054
                                 } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
5055
-                                    $hood_data['hood_id'] = (int)$neighbourhood->hood_id;
5055
+                                    $hood_data['hood_id'] = (int) $neighbourhood->hood_id;
5056 5056
                                     
5057 5057
                                     if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
5058 5058
                                         $updated++;
5059 5059
                                     } else {
5060 5060
                                         $invalid++;
5061
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5061
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
5062 5062
                                     }
5063 5063
                                 } else {
5064 5064
                                     if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
5065 5065
                                         $created++;
5066 5066
                                     } else {
5067 5067
                                         $invalid++;
5068
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5068
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
5069 5069
                                     }
5070 5070
                                 }
5071
-                            } elseif ( $import_choice == 'skip' ) {
5072
-                                if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
5071
+                            } elseif ($import_choice == 'skip') {
5072
+                                if ((int) $data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int) $data['neighbourhood_id']))) {
5073 5073
                                     $skipped++;
5074 5074
                                 } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
5075 5075
                                     $skipped++;
@@ -5079,12 +5079,12 @@  discard block
 block discarded – undo
5079 5079
                                         $created++;
5080 5080
                                     } else {
5081 5081
                                         $invalid++;
5082
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5082
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
5083 5083
                                     }
5084 5084
                                 }
5085 5085
                             } else {
5086 5086
                                 $invalid++;
5087
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5087
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
5088 5088
                             }
5089 5089
                         }
5090 5090
                     }
@@ -5098,7 +5098,7 @@  discard block
 block discarded – undo
5098 5098
                 $json['invalid'] = $invalid;
5099 5099
                 $json['images'] = $images;
5100 5100
                 
5101
-                wp_send_json( $json );
5101
+                wp_send_json($json);
5102 5102
             }
5103 5103
         }
5104 5104
         break;
@@ -5142,29 +5142,29 @@  discard block
 block discarded – undo
5142 5142
  * }
5143 5143
  * @return int|bool Term id when success, false when fail.
5144 5144
  */
5145
-function geodir_imex_insert_term( $taxonomy, $term_data ) {
5146
-	if ( empty( $taxonomy ) || empty( $term_data ) ) {
5145
+function geodir_imex_insert_term($taxonomy, $term_data) {
5146
+	if (empty($taxonomy) || empty($term_data)) {
5147 5147
 		return false;
5148 5148
 	}
5149 5149
 	
5150
-	$term = isset( $term_data['name'] ) && !empty( $term_data['name'] ) ? $term_data['name'] : '';
5150
+	$term = isset($term_data['name']) && !empty($term_data['name']) ? $term_data['name'] : '';
5151 5151
 	$args = array();
5152
-	$args['description'] = isset( $term_data['description'] ) ? $term_data['description'] : '';
5153
-	$args['slug'] = isset( $term_data['slug'] ) ? $term_data['slug'] : '';
5154
-	$args['parent'] = isset( $term_data['parent'] ) ? (int)$term_data['parent'] : '';
5152
+	$args['description'] = isset($term_data['description']) ? $term_data['description'] : '';
5153
+	$args['slug'] = isset($term_data['slug']) ? $term_data['slug'] : '';
5154
+	$args['parent'] = isset($term_data['parent']) ? (int) $term_data['parent'] : '';
5155 5155
 	
5156
-	if ( ( !empty( $args['slug'] ) && term_exists( $args['slug'], $taxonomy ) ) || empty( $args['slug'] ) ) {
5157
-		$term_args = array_merge( $term_data, $args );
5158
-		$defaults = array( 'alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '');
5159
-		$term_args = wp_parse_args( $term_args, $defaults );
5160
-		$term_args = sanitize_term( $term_args, $taxonomy, 'db' );
5161
-		$args['slug'] = wp_unique_term_slug( $args['slug'], (object)$term_args );
5156
+	if ((!empty($args['slug']) && term_exists($args['slug'], $taxonomy)) || empty($args['slug'])) {
5157
+		$term_args = array_merge($term_data, $args);
5158
+		$defaults = array('alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '');
5159
+		$term_args = wp_parse_args($term_args, $defaults);
5160
+		$term_args = sanitize_term($term_args, $taxonomy, 'db');
5161
+		$args['slug'] = wp_unique_term_slug($args['slug'], (object) $term_args);
5162 5162
 	}
5163 5163
 	
5164
-    if( !empty( $term ) ) {
5165
-		$result = wp_insert_term( $term, $taxonomy, $args );
5166
-        if( !is_wp_error( $result ) ) {
5167
-            return isset( $result['term_id'] ) ? $result['term_id'] : 0;
5164
+    if (!empty($term)) {
5165
+		$result = wp_insert_term($term, $taxonomy, $args);
5166
+        if (!is_wp_error($result)) {
5167
+            return isset($result['term_id']) ? $result['term_id'] : 0;
5168 5168
         }
5169 5169
     }
5170 5170
 	
@@ -5194,36 +5194,36 @@  discard block
 block discarded – undo
5194 5194
  * }
5195 5195
  * @return int|bool Term id when success, false when fail.
5196 5196
  */
5197
-function geodir_imex_update_term( $taxonomy, $term_data ) {
5198
-	if ( empty( $taxonomy ) || empty( $term_data ) ) {
5197
+function geodir_imex_update_term($taxonomy, $term_data) {
5198
+	if (empty($taxonomy) || empty($term_data)) {
5199 5199
 		return false;
5200 5200
 	}
5201 5201
 	
5202
-	$term_id = isset( $term_data['term_id'] ) && !empty( $term_data['term_id'] ) ? $term_data['term_id'] : 0;
5202
+	$term_id = isset($term_data['term_id']) && !empty($term_data['term_id']) ? $term_data['term_id'] : 0;
5203 5203
 	
5204 5204
 	$args = array();
5205
-	$args['description'] = isset( $term_data['description'] ) ? $term_data['description'] : '';
5206
-	$args['slug'] = isset( $term_data['slug'] ) ? $term_data['slug'] : '';
5207
-	$args['parent'] = isset( $term_data['parent'] ) ? (int)$term_data['parent'] : '';
5205
+	$args['description'] = isset($term_data['description']) ? $term_data['description'] : '';
5206
+	$args['slug'] = isset($term_data['slug']) ? $term_data['slug'] : '';
5207
+	$args['parent'] = isset($term_data['parent']) ? (int) $term_data['parent'] : '';
5208 5208
 	
5209
-	if ( $term_id > 0 && $term_info = (array)get_term( $term_id, $taxonomy ) ) {
5209
+	if ($term_id > 0 && $term_info = (array) get_term($term_id, $taxonomy)) {
5210 5210
 		$term_data['term_id'] = $term_info['term_id'];
5211 5211
 		
5212
-		$result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
5212
+		$result = wp_update_term($term_data['term_id'], $taxonomy, $term_data);
5213 5213
 		
5214
-		if( !is_wp_error( $result ) ) {
5215
-            return isset( $result['term_id'] ) ? $result['term_id'] : 0;
5214
+		if (!is_wp_error($result)) {
5215
+            return isset($result['term_id']) ? $result['term_id'] : 0;
5216 5216
         }
5217
-	} else if ( $term_data['slug'] != '' && $term_info = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
5217
+	} else if ($term_data['slug'] != '' && $term_info = (array) term_exists($term_data['slug'], $taxonomy)) {
5218 5218
 		$term_data['term_id'] = $term_info['term_id'];
5219 5219
 		
5220
-		$result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
5220
+		$result = wp_update_term($term_data['term_id'], $taxonomy, $term_data);
5221 5221
 		
5222
-		if( !is_wp_error( $result ) ) {
5223
-            return isset( $result['term_id'] ) ? $result['term_id'] : 0;
5222
+		if (!is_wp_error($result)) {
5223
+            return isset($result['term_id']) ? $result['term_id'] : 0;
5224 5224
         }
5225 5225
 	} else {
5226
-		return geodir_imex_insert_term( $taxonomy, $term_data );
5226
+		return geodir_imex_insert_term($taxonomy, $term_data);
5227 5227
 	}
5228 5228
 	
5229 5229
 	return false;
@@ -5241,25 +5241,25 @@  discard block
 block discarded – undo
5241 5241
  * @param string $post_type Post type.
5242 5242
  * @return int Posts count.
5243 5243
  */
5244
-function geodir_get_posts_count( $post_type ) {
5244
+function geodir_get_posts_count($post_type) {
5245 5245
     global $wpdb, $plugin_prefix;
5246 5246
 
5247
-    if ( !post_type_exists( $post_type ) ) {
5247
+    if (!post_type_exists($post_type)) {
5248 5248
         return 0;
5249 5249
     }
5250 5250
         
5251
-    $table = $plugin_prefix . $post_type . '_detail';
5251
+    $table = $plugin_prefix.$post_type.'_detail';
5252 5252
 
5253 5253
     // Skip listing with statuses trash, auto-draft etc...
5254 5254
     $skip_statuses = geodir_imex_export_skip_statuses();
5255 5255
     $where_statuses = '';
5256
-    if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5257
-        $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5256
+    if (!empty($skip_statuses) && is_array($skip_statuses)) {
5257
+        $where_statuses = "AND `".$wpdb->posts."`.`post_status` NOT IN('".implode("','", $skip_statuses)."')";
5258 5258
     }
5259 5259
 
5260
-    $query = $wpdb->prepare( "SELECT COUNT({$wpdb->posts}.ID) FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s " . $where_statuses, $post_type );
5260
+    $query = $wpdb->prepare("SELECT COUNT({$wpdb->posts}.ID) FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s ".$where_statuses, $post_type);
5261 5261
 
5262
-    $posts_count = (int)$wpdb->get_var( $query );
5262
+    $posts_count = (int) $wpdb->get_var($query);
5263 5263
     
5264 5264
     /**
5265 5265
      * Modify returned post counts for the current post type.
@@ -5270,7 +5270,7 @@  discard block
 block discarded – undo
5270 5270
      * @param int $posts_count Post counts.
5271 5271
      * @param string $post_type Post type.
5272 5272
      */
5273
-    $posts_count = apply_filters( 'geodir_imex_count_posts', $posts_count, $post_type );
5273
+    $posts_count = apply_filters('geodir_imex_count_posts', $posts_count, $post_type);
5274 5274
 
5275 5275
     return $posts_count;
5276 5276
 }
@@ -5291,17 +5291,17 @@  discard block
 block discarded – undo
5291 5291
  * @param int $page_no Page number. Default 0.
5292 5292
  * @return array Array of posts data.
5293 5293
  */
5294
-function geodir_imex_get_posts( $post_type, $per_page = 0, $page_no = 0 ) {	
5294
+function geodir_imex_get_posts($post_type, $per_page = 0, $page_no = 0) {	
5295 5295
 	global $wp_filesystem;
5296 5296
 
5297
-	$posts = geodir_get_export_posts( $post_type, $per_page, $page_no );
5297
+	$posts = geodir_get_export_posts($post_type, $per_page, $page_no);
5298 5298
 
5299 5299
 	$csv_rows = array();
5300 5300
 	
5301
-	if ( !empty( $posts ) ) {
5302
-		$is_payment_plugin = is_plugin_active( 'geodir_payment_manager/geodir_payment_manager.php' );
5301
+	if (!empty($posts)) {
5302
+		$is_payment_plugin = is_plugin_active('geodir_payment_manager/geodir_payment_manager.php');
5303 5303
         $location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
5304
-        $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
5304
+        $location_allowed = function_exists('geodir_cpt_no_location') && geodir_cpt_no_location($post_type) ? false : true;
5305 5305
         $neighbourhood_active = $location_manager && $location_allowed && get_option('location_neighbourhoods') ? true : false;
5306 5306
 		
5307 5307
 		$csv_row = array();
@@ -5313,7 +5313,7 @@  discard block
 block discarded – undo
5313 5313
 		$csv_row[] = 'default_category';
5314 5314
 		$csv_row[] = 'post_tags';
5315 5315
 		$csv_row[] = 'post_type';
5316
-		if ( $post_type == 'gd_event' ) {
5316
+		if ($post_type == 'gd_event') {
5317 5317
 			$csv_row[] = 'event_date';
5318 5318
 			$csv_row[] = 'event_enddate';
5319 5319
 			$csv_row[] = 'starttime';
@@ -5367,15 +5367,15 @@  discard block
 block discarded – undo
5367 5367
 		}
5368 5368
 		// WPML
5369 5369
 
5370
-		$custom_fields = geodir_imex_get_custom_fields( $post_type );
5371
-		if ( !empty( $custom_fields ) ) {
5372
-			foreach ( $custom_fields as $custom_field ) {
5370
+		$custom_fields = geodir_imex_get_custom_fields($post_type);
5371
+		if (!empty($custom_fields)) {
5372
+			foreach ($custom_fields as $custom_field) {
5373 5373
 				$csv_row[] = $custom_field->htmlvar_name;
5374 5374
 			}
5375 5375
 		}
5376 5376
 
5377 5377
 		// Export franchise fields
5378
-		$is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false;
5378
+		$is_franchise_active = is_plugin_active('geodir_franchise/geodir_franchise.php') && geodir_franchise_enabled($post_type) ? true : false;
5379 5379
 		if ($is_franchise_active) {
5380 5380
 			$csv_row[] = 'gd_is_franchise';
5381 5381
 			$csv_row[] = 'gd_franchise_lock';
@@ -5385,28 +5385,28 @@  discard block
 block discarded – undo
5385 5385
 		$csv_rows[] = $csv_row;
5386 5386
 
5387 5387
 		$images_count = 5;
5388
-        $xx=0;
5389
-		foreach ( $posts as $post ) {$xx++;
5388
+        $xx = 0;
5389
+		foreach ($posts as $post) {$xx++;
5390 5390
 			$post_id = $post['ID'];
5391 5391
 			
5392
-			$gd_post_info = geodir_get_post_info( $post_id );
5393
-			$post_info = (array)$gd_post_info;
5392
+			$gd_post_info = geodir_get_post_info($post_id);
5393
+			$post_info = (array) $gd_post_info;
5394 5394
 						
5395
-			$taxonomy_category = $post_type . 'category';
5396
-			$taxonomy_tags = $post_type . '_tags';
5395
+			$taxonomy_category = $post_type.'category';
5396
+			$taxonomy_tags = $post_type.'_tags';
5397 5397
 			
5398 5398
 			$post_category = '';
5399 5399
 			$default_category_id = $gd_post_info->default_category;
5400 5400
 			$default_category = '';
5401 5401
 			$post_tags = '';
5402
-			$terms = wp_get_post_terms( $post_id, array( $taxonomy_category, $taxonomy_tags ) );
5402
+			$terms = wp_get_post_terms($post_id, array($taxonomy_category, $taxonomy_tags));
5403 5403
 			
5404
-			if ( !empty( $terms ) && !is_wp_error( $terms ) ) {
5404
+			if (!empty($terms) && !is_wp_error($terms)) {
5405 5405
 				$post_category = array();
5406 5406
 				$post_tags = array();
5407 5407
 			
5408
-				foreach ( $terms as $term ) {
5409
-					if ( $term->taxonomy == $taxonomy_category ) {
5408
+				foreach ($terms as $term) {
5409
+					if ($term->taxonomy == $taxonomy_category) {
5410 5410
 						$post_category[] = $term->name;
5411 5411
 						
5412 5412
 						if ($default_category_id == $term->term_id) {
@@ -5414,7 +5414,7 @@  discard block
 block discarded – undo
5414 5414
 						}
5415 5415
 					}
5416 5416
 					
5417
-					if ( $term->taxonomy == $taxonomy_tags ) {
5417
+					if ($term->taxonomy == $taxonomy_tags) {
5418 5418
 						$post_tags[] = $term->name;
5419 5419
 					}
5420 5420
 				}
@@ -5422,47 +5422,47 @@  discard block
 block discarded – undo
5422 5422
 				if (empty($default_category) && !empty($post_category)) {
5423 5423
 					$default_category = $post_category[0]; // Set first one as default category.
5424 5424
 				}
5425
-				$post_category = !empty( $post_category ) ? implode( ',', $post_category ) : '';
5426
-				$post_tags = !empty( $post_tags ) ? implode( ',', $post_tags ) : '';
5425
+				$post_category = !empty($post_category) ? implode(',', $post_category) : '';
5426
+				$post_tags = !empty($post_tags) ? implode(',', $post_tags) : '';
5427 5427
 			}
5428 5428
 
5429 5429
 			// Franchise data
5430
-			if ($is_franchise_active && isset($post_info['franchise']) && (int)$post_info['franchise'] > 0 && geodir_franchise_check((int)$post_info['franchise'])) {
5430
+			if ($is_franchise_active && isset($post_info['franchise']) && (int) $post_info['franchise'] > 0 && geodir_franchise_check((int) $post_info['franchise'])) {
5431 5431
 				$franchise_id = $post_info['franchise'];
5432 5432
 				$gd_franchise_info = geodir_get_post_info($franchise_id);
5433 5433
 
5434 5434
 				if (geodir_franchise_pkg_is_active($gd_franchise_info)) {
5435
-					$franchise_info = (array)$gd_franchise_info;
5435
+					$franchise_info = (array) $gd_franchise_info;
5436 5436
 					$locked_fields = geodir_franchise_get_locked_fields($franchise_id, true);
5437 5437
 					
5438 5438
 					if (!empty($locked_fields)) {
5439
-						foreach( $locked_fields as $locked_field) {
5439
+						foreach ($locked_fields as $locked_field) {
5440 5440
 							if (isset($post_info[$locked_field]) && isset($franchise_info[$locked_field])) {
5441 5441
 								$post_info[$locked_field] = $franchise_info[$locked_field];
5442 5442
 							}
5443 5443
 							
5444 5444
 							if (in_array($taxonomy_category, $locked_fields) || in_array('post_tags', $locked_fields)) {
5445
-								$franchise_terms = wp_get_post_terms( $franchise_id, array( $taxonomy_category, $taxonomy_tags ) );
5445
+								$franchise_terms = wp_get_post_terms($franchise_id, array($taxonomy_category, $taxonomy_tags));
5446 5446
 			
5447
-								if ( !empty( $franchise_terms ) && !is_wp_error( $franchise_terms ) ) {
5447
+								if (!empty($franchise_terms) && !is_wp_error($franchise_terms)) {
5448 5448
 									$franchise_post_category = array();
5449 5449
 									$franchise_post_tags = array();
5450 5450
 								
5451
-									foreach ( $franchise_terms as $franchise_term ) {
5452
-										if ( $franchise_term->taxonomy == $taxonomy_category ) {
5451
+									foreach ($franchise_terms as $franchise_term) {
5452
+										if ($franchise_term->taxonomy == $taxonomy_category) {
5453 5453
 											$franchise_post_category[] = $franchise_term->name;
5454 5454
 										}
5455 5455
 										
5456
-										if ( $franchise_term->taxonomy == $taxonomy_tags ) {
5456
+										if ($franchise_term->taxonomy == $taxonomy_tags) {
5457 5457
 											$franchise_post_tags[] = $franchise_term->name;
5458 5458
 										}
5459 5459
 									}
5460 5460
 									
5461 5461
 									if (in_array($taxonomy_category, $locked_fields)) {
5462
-										$post_category = !empty( $franchise_post_category ) ? implode( ',', $franchise_post_category ) : '';
5462
+										$post_category = !empty($franchise_post_category) ? implode(',', $franchise_post_category) : '';
5463 5463
 									}
5464 5464
 									if (in_array('post_tags', $locked_fields)) {
5465
-										$post_tags = !empty( $franchise_post_tags ) ? implode( ',', $franchise_post_tags ) : '';
5465
+										$post_tags = !empty($franchise_post_tags) ? implode(',', $franchise_post_tags) : '';
5466 5466
 									}
5467 5467
 								}
5468 5468
 							}
@@ -5471,18 +5471,18 @@  discard block
 block discarded – undo
5471 5471
 				}
5472 5472
 			}
5473 5473
 						
5474
-			$post_images = geodir_get_images( $post_id );
5474
+			$post_images = geodir_get_images($post_id);
5475 5475
 			$current_images = array();
5476
-			if ( !empty( $post_images ) ) {
5477
-				foreach ( $post_images as $post_image ) {
5478
-					$post_image = (array)$post_image;
5479
-					$image = !empty( $post_image ) && isset( $post_image['path'] ) && $wp_filesystem->is_file( $post_image['path'] ) && $wp_filesystem->exists( $post_image['path'] ) ? $post_image['src'] : '';
5480
-					if ( $image ) {
5476
+			if (!empty($post_images)) {
5477
+				foreach ($post_images as $post_image) {
5478
+					$post_image = (array) $post_image;
5479
+					$image = !empty($post_image) && isset($post_image['path']) && $wp_filesystem->is_file($post_image['path']) && $wp_filesystem->exists($post_image['path']) ? $post_image['src'] : '';
5480
+					if ($image) {
5481 5481
 						$current_images[] = $image;
5482 5482
 					}
5483 5483
 				}
5484 5484
 				
5485
-				$images_count = max( $images_count, count( $current_images ) );
5485
+				$images_count = max($images_count, count($current_images));
5486 5486
 			}
5487 5487
 
5488 5488
 			$csv_row = array();
@@ -5494,7 +5494,7 @@  discard block
 block discarded – undo
5494 5494
 			$csv_row[] = $default_category; // default_category
5495 5495
 			$csv_row[] = $post_tags; // post_tags
5496 5496
 			$csv_row[] = $post_type; // post_type
5497
-			if ( $post_type == 'gd_event' ) {
5497
+			if ($post_type == 'gd_event') {
5498 5498
 				$event_data = geodir_imex_get_event_data($post, $gd_post_info);
5499 5499
 				$csv_row[] = $event_data['event_date']; // event_date
5500 5500
 				$csv_row[] = $event_data['event_enddate']; // enddate
@@ -5515,9 +5515,9 @@  discard block
 block discarded – undo
5515 5515
 				$csv_row[] = $event_data['recurring_end_date']; // repeat_end
5516 5516
 			}
5517 5517
 			$csv_row[] = $post_info['post_status']; // post_status
5518
-			$csv_row[] = (int)$post_info['is_featured'] == 1 ? 1 : ''; // is_featured
5518
+			$csv_row[] = (int) $post_info['is_featured'] == 1 ? 1 : ''; // is_featured
5519 5519
 			if ($is_payment_plugin) {
5520
-				$csv_row[] = (int)$post_info['package_id']; // package_id
5520
+				$csv_row[] = (int) $post_info['package_id']; // package_id
5521 5521
 				$csv_row[] = $post_info['expire_date'] != '' && geodir_strtolower($post_info['expire_date']) != 'never' ? date_i18n('Y-m-d', strtotime($post_info['expire_date'])) : 'Never'; // expire_date
5522 5522
 			}
5523 5523
 			$csv_row[] = $post_info['geodir_video']; // geodir_video
@@ -5553,14 +5553,14 @@  discard block
 block discarded – undo
5553 5553
 			$csv_row[] = $post_info['geodir_special_offers']; // geodir_special_offers
5554 5554
 			// WPML
5555 5555
 			if ($is_wpml) {
5556
-				$csv_row[] = geodir_get_language_for_element( $post_id, 'post_' . $post_type );
5557
-				$csv_row[] = geodir_imex_original_post_id( $post_id, 'post_' . $post_type );
5556
+				$csv_row[] = geodir_get_language_for_element($post_id, 'post_'.$post_type);
5557
+				$csv_row[] = geodir_imex_original_post_id($post_id, 'post_'.$post_type);
5558 5558
 			}
5559 5559
 			// WPML
5560 5560
 			
5561
-			if ( !empty( $custom_fields ) ) {
5562
-				foreach ( $custom_fields as $custom_field ) {
5563
-					$csv_row[] = isset( $post_info[$custom_field->htmlvar_name] ) ? $post_info[$custom_field->htmlvar_name] : '';
5561
+			if (!empty($custom_fields)) {
5562
+				foreach ($custom_fields as $custom_field) {
5563
+					$csv_row[] = isset($post_info[$custom_field->htmlvar_name]) ? $post_info[$custom_field->htmlvar_name] : '';
5564 5564
 				}
5565 5565
 			}
5566 5566
 			
@@ -5571,26 +5571,26 @@  discard block
 block discarded – undo
5571 5571
 				$franchise = '';
5572 5572
 					
5573 5573
 				if (geodir_franchise_pkg_is_active($gd_post_info)) {
5574
-					$gd_is_franchise = (int)get_post_meta( $post_id, 'gd_is_franchise', true );
5575
-					$locaked_fields = $gd_is_franchise ? get_post_meta( $post_id, 'gd_franchise_lock', true ) : '';
5574
+					$gd_is_franchise = (int) get_post_meta($post_id, 'gd_is_franchise', true);
5575
+					$locaked_fields = $gd_is_franchise ? get_post_meta($post_id, 'gd_franchise_lock', true) : '';
5576 5576
 					$locaked_fields = (is_array($locaked_fields) && !empty($locaked_fields) ? implode(",", $locaked_fields) : '');
5577
-					$franchise = !$gd_is_franchise && isset($post_info['franchise']) && (int)$post_info['franchise'] > 0 ? (int)$post_info['franchise'] : 0; // franchise id
5577
+					$franchise = !$gd_is_franchise && isset($post_info['franchise']) && (int) $post_info['franchise'] > 0 ? (int) $post_info['franchise'] : 0; // franchise id
5578 5578
 				}
5579 5579
 				
5580
-				$csv_row[] = (int)$gd_is_franchise; // gd_is_franchise
5580
+				$csv_row[] = (int) $gd_is_franchise; // gd_is_franchise
5581 5581
 				$csv_row[] = $locaked_fields; // gd_franchise_lock fields
5582
-				$csv_row[] = (int)$franchise; // franchise id
5582
+				$csv_row[] = (int) $franchise; // franchise id
5583 5583
 			}
5584 5584
 			
5585
-			for ( $c = 0; $c < $images_count; $c++ ) {
5586
-				$csv_row[] = isset( $current_images[$c] ) ? $current_images[$c] : ''; // IMAGE
5585
+			for ($c = 0; $c < $images_count; $c++) {
5586
+				$csv_row[] = isset($current_images[$c]) ? $current_images[$c] : ''; // IMAGE
5587 5587
 			}
5588 5588
 			
5589 5589
 			$csv_rows[] = $csv_row;
5590 5590
 
5591 5591
 		}
5592 5592
 
5593
-		for ( $c = 0; $c < $images_count; $c++ ) {
5593
+		for ($c = 0; $c < $images_count; $c++) {
5594 5594
 			$csv_rows[0][] = 'IMAGE';
5595 5595
 		}
5596 5596
 	}
@@ -5612,33 +5612,33 @@  discard block
 block discarded – undo
5612 5612
  * @param int $page_no Page number. Default 0.
5613 5613
  * @return array Array of posts data.
5614 5614
  */
5615
-function geodir_get_export_posts( $post_type, $per_page = 0, $page_no = 0 ) {
5615
+function geodir_get_export_posts($post_type, $per_page = 0, $page_no = 0) {
5616 5616
     global $wpdb, $plugin_prefix;
5617 5617
 
5618
-    if ( ! post_type_exists( $post_type ) )
5618
+    if (!post_type_exists($post_type))
5619 5619
         return new stdClass;
5620 5620
         
5621
-    $table = $plugin_prefix . $post_type . '_detail';
5621
+    $table = $plugin_prefix.$post_type.'_detail';
5622 5622
 
5623 5623
     $limit = '';
5624
-    if ( $per_page > 0 && $page_no > 0 ) {
5625
-        $offset = ( $page_no - 1 ) * $per_page;
5624
+    if ($per_page > 0 && $page_no > 0) {
5625
+        $offset = ($page_no - 1) * $per_page;
5626 5626
         
5627
-        if ( $offset > 0 ) {
5628
-            $limit = " LIMIT " . $offset . "," . $per_page;
5627
+        if ($offset > 0) {
5628
+            $limit = " LIMIT ".$offset.",".$per_page;
5629 5629
         } else {
5630
-            $limit = " LIMIT " . $per_page;
5630
+            $limit = " LIMIT ".$per_page;
5631 5631
         }
5632 5632
     }
5633 5633
 
5634 5634
     // Skip listing with statuses trash, auto-draft etc...
5635 5635
     $skip_statuses = geodir_imex_export_skip_statuses();
5636 5636
     $where_statuses = '';
5637
-    if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5638
-        $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5637
+    if (!empty($skip_statuses) && is_array($skip_statuses)) {
5638
+        $where_statuses = "AND `".$wpdb->posts."`.`post_status` NOT IN('".implode("','", $skip_statuses)."')";
5639 5639
     }
5640 5640
 
5641
-    $query = "SELECT {$wpdb->posts}.ID FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s " . $where_statuses . " ORDER BY {$wpdb->posts}.ID ASC" . $limit;
5641
+    $query = "SELECT {$wpdb->posts}.ID FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s ".$where_statuses." ORDER BY {$wpdb->posts}.ID ASC".$limit;
5642 5642
     /**
5643 5643
      * Modify returned posts SQL query for the current post type.
5644 5644
      *
@@ -5648,9 +5648,9 @@  discard block
 block discarded – undo
5648 5648
      * @param int $query The SQL query.
5649 5649
      * @param string $post_type Post type.
5650 5650
      */
5651
-    $query = apply_filters( 'geodir_imex_export_posts_query', $query, $post_type );
5651
+    $query = apply_filters('geodir_imex_export_posts_query', $query, $post_type);
5652 5652
 
5653
-    $results = (array)$wpdb->get_results( $wpdb->prepare( $query, $post_type ), ARRAY_A );
5653
+    $results = (array) $wpdb->get_results($wpdb->prepare($query, $post_type), ARRAY_A);
5654 5654
 
5655 5655
     /**
5656 5656
      * Modify returned post results for the current post type.
@@ -5661,7 +5661,7 @@  discard block
 block discarded – undo
5661 5661
      * @param object $results An object containing all post ids.
5662 5662
      * @param string $post_type Post type.
5663 5663
      */
5664
-    return apply_filters( 'geodir_export_posts', $results, $post_type );
5664
+    return apply_filters('geodir_export_posts', $results, $post_type);
5665 5665
 }
5666 5666
 
5667 5667
 /**
@@ -5678,21 +5678,21 @@  discard block
 block discarded – undo
5678 5678
  * @param string $post_type Post type.
5679 5679
  * @return string The SQL query.
5680 5680
  */
5681
-function geodir_imex_get_events_query( $query, $post_type ) {
5682
-    if ( $post_type == 'gd_event' ) {
5681
+function geodir_imex_get_events_query($query, $post_type) {
5682
+    if ($post_type == 'gd_event') {
5683 5683
         global $wpdb, $plugin_prefix;
5684 5684
         
5685
-        $table = $plugin_prefix . $post_type . '_detail';
5685
+        $table = $plugin_prefix.$post_type.'_detail';
5686 5686
         $schedule_table = EVENT_SCHEDULE;
5687 5687
         
5688 5688
         // Skip listing with statuses trash, auto-draft etc...
5689 5689
         $skip_statuses = geodir_imex_export_skip_statuses();
5690 5690
         $where_statuses = '';
5691
-        if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5692
-            $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5691
+        if (!empty($skip_statuses) && is_array($skip_statuses)) {
5692
+            $where_statuses = "AND `".$wpdb->posts."`.`post_status` NOT IN('".implode("','", $skip_statuses)."')";
5693 5693
         }
5694 5694
 
5695
-        $query = "SELECT {$wpdb->posts}.ID, {$schedule_table}.event_date, {$schedule_table}.event_enddate AS enddate, {$schedule_table}.event_starttime AS starttime, {$schedule_table}.event_endtime AS endtime FROM {$wpdb->posts} INNER JOIN {$table} ON ({$table}.post_id = {$wpdb->posts}.ID) INNER JOIN {$schedule_table} ON ({$schedule_table}.event_id = {$wpdb->posts}.ID) WHERE {$wpdb->posts}.post_type = %s " . $where_statuses . " GROUP BY {$table}.post_id ORDER BY {$wpdb->posts}.ID ASC, {$schedule_table}.schedule_id ASC";
5695
+        $query = "SELECT {$wpdb->posts}.ID, {$schedule_table}.event_date, {$schedule_table}.event_enddate AS enddate, {$schedule_table}.event_starttime AS starttime, {$schedule_table}.event_endtime AS endtime FROM {$wpdb->posts} INNER JOIN {$table} ON ({$table}.post_id = {$wpdb->posts}.ID) INNER JOIN {$schedule_table} ON ({$schedule_table}.event_id = {$wpdb->posts}.ID) WHERE {$wpdb->posts}.post_type = %s ".$where_statuses." GROUP BY {$table}.post_id ORDER BY {$wpdb->posts}.ID ASC, {$schedule_table}.schedule_id ASC";
5696 5696
     }
5697 5697
 
5698 5698
     return $query;
@@ -5716,35 +5716,35 @@  discard block
 block discarded – undo
5716 5716
  * @param  string $post_type Post type.
5717 5717
  * @return int Total terms count.
5718 5718
  */
5719
-function geodir_get_terms_count( $post_type ) {
5720
-    $args = array( 'hide_empty' => 0 );
5719
+function geodir_get_terms_count($post_type) {
5720
+    $args = array('hide_empty' => 0);
5721 5721
 
5722
-    remove_all_filters( 'get_terms' );
5722
+    remove_all_filters('get_terms');
5723 5723
 
5724
-    $taxonomy = $post_type . 'category';
5724
+    $taxonomy = $post_type.'category';
5725 5725
 
5726 5726
     // WPML
5727 5727
     $is_wpml = geodir_is_wpml();
5728 5728
     $active_lang = 'all';
5729
-    if ( $is_wpml ) {
5729
+    if ($is_wpml) {
5730 5730
         global $sitepress;
5731 5731
         $active_lang = $sitepress->get_current_language();
5732 5732
         
5733
-        if ( $active_lang != 'all' ) {
5734
-            $sitepress->switch_lang( 'all', true );
5733
+        if ($active_lang != 'all') {
5734
+            $sitepress->switch_lang('all', true);
5735 5735
         }
5736 5736
     }
5737 5737
     // WPML
5738 5738
             
5739
-    $count_terms = wp_count_terms( $taxonomy, $args );
5739
+    $count_terms = wp_count_terms($taxonomy, $args);
5740 5740
 
5741 5741
     // WPML
5742
-    if ( $is_wpml && $active_lang !== 'all' ) {
5742
+    if ($is_wpml && $active_lang !== 'all') {
5743 5743
         global $sitepress;
5744
-        $sitepress->switch_lang( $active_lang, true );
5744
+        $sitepress->switch_lang($active_lang, true);
5745 5745
     }
5746 5746
     // WPML
5747
-    $count_terms = !is_wp_error( $count_terms ) ? $count_terms : 0;
5747
+    $count_terms = !is_wp_error($count_terms) ? $count_terms : 0;
5748 5748
      
5749 5749
     return $count_terms;
5750 5750
 }
@@ -5761,23 +5761,23 @@  discard block
 block discarded – undo
5761 5761
  * @param int $page_no Page number. Default 0.
5762 5762
  * @return array Array of terms data.
5763 5763
  */
5764
-function geodir_imex_get_terms( $post_type, $per_page = 0, $page_no = 0 ) {
5765
-	$args = array( 'hide_empty' => 0, 'orderby' => 'id' );
5764
+function geodir_imex_get_terms($post_type, $per_page = 0, $page_no = 0) {
5765
+	$args = array('hide_empty' => 0, 'orderby' => 'id');
5766 5766
 	
5767
-	remove_all_filters( 'get_terms' );
5767
+	remove_all_filters('get_terms');
5768 5768
 	
5769
-	$taxonomy = $post_type . 'category';
5769
+	$taxonomy = $post_type.'category';
5770 5770
 	
5771
-	if ( $per_page > 0 && $page_no > 0 ) {
5772
-		$args['offset'] = ( $page_no - 1 ) * $per_page;
5771
+	if ($per_page > 0 && $page_no > 0) {
5772
+		$args['offset'] = ($page_no - 1) * $per_page;
5773 5773
 		$args['number'] = $per_page;
5774 5774
 	}
5775 5775
 	
5776
-	$terms = get_terms( $taxonomy, $args );
5776
+	$terms = get_terms($taxonomy, $args);
5777 5777
 
5778 5778
 	$csv_rows = array();
5779 5779
 	
5780
-	if ( !empty( $terms ) ) {
5780
+	if (!empty($terms)) {
5781 5781
 		$csv_row = array();
5782 5782
 		$csv_row[] = 'cat_id';
5783 5783
 		$csv_row[] = 'cat_name';
@@ -5799,16 +5799,16 @@  discard block
 block discarded – undo
5799 5799
 		
5800 5800
 		$csv_rows[] = $csv_row;
5801 5801
 		
5802
-		foreach ( $terms as $term ) {
5803
-			$cat_icon = get_tax_meta( $term->term_id, 'ct_cat_icon', false, $post_type );
5804
-			$cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : '';
5802
+		foreach ($terms as $term) {
5803
+			$cat_icon = get_tax_meta($term->term_id, 'ct_cat_icon', false, $post_type);
5804
+			$cat_icon = !empty($cat_icon) && isset($cat_icon['src']) ? $cat_icon['src'] : '';
5805 5805
 			
5806
-			$cat_image = geodir_get_default_catimage( $term->term_id, $post_type );
5807
-			$cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : ''; 
5806
+			$cat_image = geodir_get_default_catimage($term->term_id, $post_type);
5807
+			$cat_image = !empty($cat_image) && isset($cat_image['src']) ? $cat_image['src'] : ''; 
5808 5808
 			
5809 5809
 			$cat_parent = '';
5810
-			if (isset($term->parent) && (int)$term->parent > 0 && term_exists((int)$term->parent, $taxonomy)) {
5811
-				$parent_term = (array)get_term_by( 'id', (int)$term->parent, $taxonomy );
5810
+			if (isset($term->parent) && (int) $term->parent > 0 && term_exists((int) $term->parent, $taxonomy)) {
5811
+				$parent_term = (array) get_term_by('id', (int) $term->parent, $taxonomy);
5812 5812
 				$cat_parent = !empty($parent_term) && isset($parent_term['name']) ? $parent_term['name'] : '';
5813 5813
 			}
5814 5814
 			
@@ -5818,15 +5818,15 @@  discard block
 block discarded – undo
5818 5818
 			$csv_row[] = $term->slug;
5819 5819
 			$csv_row[] = $post_type;
5820 5820
 			$csv_row[] = $cat_parent;
5821
-			$csv_row[] = get_tax_meta( $term->term_id, 'ct_cat_schema', false, $post_type );
5821
+			$csv_row[] = get_tax_meta($term->term_id, 'ct_cat_schema', false, $post_type);
5822 5822
             // WPML
5823 5823
 			if ($is_wpml) {
5824
-				$csv_row[] = geodir_get_language_for_element( $term->term_id, 'tax_' . $taxonomy );
5825
-                $csv_row[] = geodir_imex_original_post_id( $term->term_id, 'tax_' . $taxonomy );
5824
+				$csv_row[] = geodir_get_language_for_element($term->term_id, 'tax_'.$taxonomy);
5825
+                $csv_row[] = geodir_imex_original_post_id($term->term_id, 'tax_'.$taxonomy);
5826 5826
 			}
5827 5827
 			// WPML
5828 5828
 			$csv_row[] = $term->description;
5829
-			$csv_row[] = get_tax_meta( $term->term_id, 'ct_cat_top_desc', false, $post_type );
5829
+			$csv_row[] = get_tax_meta($term->term_id, 'ct_cat_top_desc', false, $post_type);
5830 5830
 			$csv_row[] = $cat_image;
5831 5831
 			$csv_row[] = $cat_icon;
5832 5832
 			
@@ -5845,10 +5845,10 @@  discard block
 block discarded – undo
5845 5845
  * @param  bool $relative True for relative path & False for absolute path.
5846 5846
  * @return string Path to the cache directory.
5847 5847
  */
5848
-function geodir_path_import_export( $relative = true ) {
5848
+function geodir_path_import_export($relative = true) {
5849 5849
 	$upload_dir = wp_upload_dir();
5850 5850
 	
5851
-	return $relative ? $upload_dir['baseurl'] . '/cache' : $upload_dir['basedir'] . '/cache';
5851
+	return $relative ? $upload_dir['baseurl'].'/cache' : $upload_dir['basedir'].'/cache';
5852 5852
 }
5853 5853
 
5854 5854
 /**
@@ -5864,8 +5864,8 @@  discard block
 block discarded – undo
5864 5864
  * @param  bool $clear If true then it overwrite data otherwise add rows at the end of file.
5865 5865
  * @return bool true if success otherwise false.
5866 5866
  */
5867
-function geodir_save_csv_data( $file_path, $csv_data = array(), $clear = true ) {
5868
-	if ( empty( $csv_data ) ) {
5867
+function geodir_save_csv_data($file_path, $csv_data = array(), $clear = true) {
5868
+	if (empty($csv_data)) {
5869 5869
 		return false;
5870 5870
 	}
5871 5871
 	
@@ -5873,17 +5873,17 @@  discard block
 block discarded – undo
5873 5873
 	
5874 5874
 	$mode = $clear ? 'w+' : 'a+';
5875 5875
 	
5876
-	if ( function_exists( 'fputcsv' ) ) {
5877
-		$file = fopen( $file_path, $mode );
5878
-		foreach( $csv_data as $csv_row ) {
5876
+	if (function_exists('fputcsv')) {
5877
+		$file = fopen($file_path, $mode);
5878
+		foreach ($csv_data as $csv_row) {
5879 5879
 			//$csv_row = array_map( 'utf8_decode', $csv_row );
5880
-			$write_successful = fputcsv( $file, $csv_row, ",", $enclosure = '"' );
5880
+			$write_successful = fputcsv($file, $csv_row, ",", $enclosure = '"');
5881 5881
 		}
5882
-		fclose( $file );
5882
+		fclose($file);
5883 5883
 	} else {
5884
-		foreach( $csv_data as $csv_row ) {
5884
+		foreach ($csv_data as $csv_row) {
5885 5885
 			//$csv_row = array_map( 'utf8_decode', $csv_row );
5886
-			$wp_filesystem->put_contents( $file_path, $csv_row );
5886
+			$wp_filesystem->put_contents($file_path, $csv_row);
5887 5887
 		}
5888 5888
 	}
5889 5889
 		
@@ -5901,14 +5901,14 @@  discard block
 block discarded – undo
5901 5901
  * @param  string $file Full path to file.
5902 5902
  * @return int No of file rows.
5903 5903
  */
5904
-function geodir_import_export_line_count( $file ) {
5904
+function geodir_import_export_line_count($file) {
5905 5905
 	global $wp_filesystem;
5906 5906
 	
5907
-	if ( $wp_filesystem->is_file( $file ) && $wp_filesystem->exists( $file ) ) {
5908
-		$contents = $wp_filesystem->get_contents_array( $file );
5907
+	if ($wp_filesystem->is_file($file) && $wp_filesystem->exists($file)) {
5908
+		$contents = $wp_filesystem->get_contents_array($file);
5909 5909
 		
5910
-		if ( !empty( $contents ) && is_array( $contents ) ) {
5911
-			return count( $contents ) - 1;
5910
+		if (!empty($contents) && is_array($contents)) {
5911
+			return count($contents) - 1;
5912 5912
 		}
5913 5913
 	}
5914 5914
 	
@@ -5925,11 +5925,11 @@  discard block
 block discarded – undo
5925 5925
  * @param string $post_type The post type.
5926 5926
  * @return object Queried object.
5927 5927
  */
5928
-function geodir_imex_get_custom_fields( $post_type ) {
5928
+function geodir_imex_get_custom_fields($post_type) {
5929 5929
 	global $wpdb;
5930 5930
 	 
5931
-	$sql = $wpdb->prepare("SELECT htmlvar_name FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND is_active='1' AND is_admin!='1' AND field_type != 'fieldset' AND htmlvar_name != '' ORDER BY id ASC", array( $post_type ) );
5932
-	$rows = $wpdb->get_results( $sql );
5931
+	$sql = $wpdb->prepare("SELECT htmlvar_name FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE post_type=%s AND is_active='1' AND is_admin!='1' AND field_type != 'fieldset' AND htmlvar_name != '' ORDER BY id ASC", array($post_type));
5932
+	$rows = $wpdb->get_results($sql);
5933 5933
 	 
5934 5934
 	return $rows;
5935 5935
 }
@@ -6008,14 +6008,14 @@  discard block
 block discarded – undo
6008 6008
 	global $wpdb, $plugin_prefix;
6009 6009
 	
6010 6010
 	$post_type = get_post_type($master_post_id);
6011
-	$post_table = $plugin_prefix . $post_type . '_detail';
6011
+	$post_table = $plugin_prefix.$post_type.'_detail';
6012 6012
 	
6013
-	$query = $wpdb->prepare("SELECT * FROM " . $post_table . " WHERE post_id = %d", array($master_post_id));
6014
-	$data = (array)$wpdb->get_row($query);
6013
+	$query = $wpdb->prepare("SELECT * FROM ".$post_table." WHERE post_id = %d", array($master_post_id));
6014
+	$data = (array) $wpdb->get_row($query);
6015 6015
 	
6016
-	if ( !empty( $data ) ) {
6016
+	if (!empty($data)) {
6017 6017
 		$data['post_id'] = $tr_post_id;
6018
-		unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type . 'category'], $data['overall_rating'], $data['rating_count'], $data['ratings']);
6018
+		unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type.'category'], $data['overall_rating'], $data['rating_count'], $data['ratings']);
6019 6019
 		
6020 6020
 		$wpdb->update($post_table, $data, array('post_id' => $tr_post_id));		
6021 6021
 		return true;
@@ -6041,7 +6041,7 @@  discard block
 block discarded – undo
6041 6041
 	global $sitepress, $wpdb;
6042 6042
 	$post_type = get_post_type($master_post_id);
6043 6043
 	
6044
-	remove_filter('get_term', array($sitepress,'get_term_adjust_id')); // AVOID filtering to current language
6044
+	remove_filter('get_term', array($sitepress, 'get_term_adjust_id')); // AVOID filtering to current language
6045 6045
 
6046 6046
 	$taxonomies = get_object_taxonomies($post_type);
6047 6047
 	foreach ($taxonomies as $taxonomy) {
@@ -6050,9 +6050,9 @@  discard block
 block discarded – undo
6050 6050
 		
6051 6051
 		if ($terms) {
6052 6052
 			foreach ($terms as $term) {
6053
-				$tr_id = apply_filters( 'translate_object_id',$term->term_id, $taxonomy, false, $lang);
6053
+				$tr_id = apply_filters('translate_object_id', $term->term_id, $taxonomy, false, $lang);
6054 6054
 				
6055
-				if (!is_null($tr_id)){
6055
+				if (!is_null($tr_id)) {
6056 6056
 					// not using get_term - unfiltered get_term
6057 6057
 					$translated_term = $wpdb->get_row($wpdb->prepare("
6058 6058
 						SELECT * FROM {$wpdb->terms} t JOIN {$wpdb->term_taxonomy} x ON x.term_id = t.term_id WHERE t.term_id = %d AND x.taxonomy = %s", $tr_id, $taxonomy));
@@ -6061,14 +6061,14 @@  discard block
 block discarded – undo
6061 6061
 				}
6062 6062
 			}
6063 6063
 
6064
-			if (!is_taxonomy_hierarchical($taxonomy)){
6065
-				$terms_array = array_unique( array_map( 'intval', $terms_array ) );
6064
+			if (!is_taxonomy_hierarchical($taxonomy)) {
6065
+				$terms_array = array_unique(array_map('intval', $terms_array));
6066 6066
 			}
6067 6067
 
6068 6068
 			wp_set_post_terms($tr_post_id, $terms_array, $taxonomy);
6069 6069
 			
6070
-			if ($taxonomy == $post_type . 'category') {
6071
-				geodir_set_postcat_structure($tr_post_id, $post_type . 'category');
6070
+			if ($taxonomy == $post_type.'category') {
6071
+				geodir_set_postcat_structure($tr_post_id, $post_type.'category');
6072 6072
 			}
6073 6073
 		}
6074 6074
 	}
@@ -6089,15 +6089,15 @@  discard block
 block discarded – undo
6089 6089
 function geodir_icl_duplicate_post_images($master_post_id, $tr_post_id, $lang) {
6090 6090
 	global $wpdb;
6091 6091
 	
6092
-	$query = $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id));
6092
+	$query = $wpdb->prepare("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id));
6093 6093
 	$wpdb->query($query);
6094 6094
 	
6095
-	$query = $wpdb->prepare("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id));
6095
+	$query = $wpdb->prepare("SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id));
6096 6096
 	$post_images = $wpdb->get_results($query);
6097 6097
 	
6098
-	if ( !empty( $post_images ) ) {
6099
-		foreach ( $post_images as $post_image) {
6100
-			$image_data = (array)$post_image;
6098
+	if (!empty($post_images)) {
6099
+		foreach ($post_images as $post_image) {
6100
+			$image_data = (array) $post_image;
6101 6101
 			unset($image_data['ID']);
6102 6102
 			$image_data['post_id'] = $tr_post_id;
6103 6103
 			
@@ -6123,10 +6123,10 @@  discard block
 block discarded – undo
6123 6123
  * @return array Event data array.
6124 6124
  */
6125 6125
 function geodir_imex_get_event_data($post, $gd_post_info) {
6126
-	$event_date = isset( $post['event_date'] ) && $post['event_date'] != '' && $post['event_date'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $post['event_date'] ) ) : '';
6126
+	$event_date = isset($post['event_date']) && $post['event_date'] != '' && $post['event_date'] != '0000-00-00 00:00:00' ? date_i18n('d/m/Y', strtotime($post['event_date'])) : '';
6127 6127
 	$event_enddate = $event_date;
6128
-	$starttime = isset( $post['starttime'] ) && $post['starttime'] != '' && $post['starttime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $post['starttime'] ) ) : '';
6129
-	$endtime = isset( $post['endtime'] ) && $post['endtime'] != '' && $post['endtime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $post['endtime'] ) ) : '';
6128
+	$starttime = isset($post['starttime']) && $post['starttime'] != '' && $post['starttime'] != '00:00:00' ? date_i18n('H:i', strtotime($post['starttime'])) : '';
6129
+	$endtime = isset($post['endtime']) && $post['endtime'] != '' && $post['endtime'] != '00:00:00' ? date_i18n('H:i', strtotime($post['endtime'])) : '';
6130 6130
 	
6131 6131
 	$is_recurring_event = '';
6132 6132
 	$event_duration_days = '';
@@ -6143,15 +6143,15 @@  discard block
 block discarded – undo
6143 6143
 		
6144 6144
 	$recurring_data = isset($gd_post_info->recurring_dates) ? maybe_unserialize($gd_post_info->recurring_dates) : array();
6145 6145
 	if (!empty($recurring_data)) {
6146
-		$event_date = isset( $recurring_data['event_start'] ) && $recurring_data['event_start'] != '' && $recurring_data['event_start'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $recurring_data['event_start'] ) ) : $event_date;
6147
-		$event_enddate = isset( $recurring_data['event_end'] ) && $recurring_data['event_end'] != '' && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $recurring_data['event_end'] ) ) : $event_date;
6148
-		$starttime = isset( $recurring_data['starttime'] ) && $recurring_data['starttime'] != '' && $recurring_data['starttime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $recurring_data['starttime'] ) ) : $starttime;
6149
-		$endtime = isset( $recurring_data['endtime'] ) && $recurring_data['endtime'] != '' && $recurring_data['endtime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $recurring_data['endtime'] ) ) : $endtime;
6146
+		$event_date = isset($recurring_data['event_start']) && $recurring_data['event_start'] != '' && $recurring_data['event_start'] != '0000-00-00 00:00:00' ? date_i18n('d/m/Y', strtotime($recurring_data['event_start'])) : $event_date;
6147
+		$event_enddate = isset($recurring_data['event_end']) && $recurring_data['event_end'] != '' && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? date_i18n('d/m/Y', strtotime($recurring_data['event_end'])) : $event_date;
6148
+		$starttime = isset($recurring_data['starttime']) && $recurring_data['starttime'] != '' && $recurring_data['starttime'] != '00:00:00' ? date_i18n('H:i', strtotime($recurring_data['starttime'])) : $starttime;
6149
+		$endtime = isset($recurring_data['endtime']) && $recurring_data['endtime'] != '' && $recurring_data['endtime'] != '00:00:00' ? date_i18n('H:i', strtotime($recurring_data['endtime'])) : $endtime;
6150 6150
 		$is_whole_day_event = !empty($recurring_data['all_day']) ? 1 : '';
6151 6151
 		$different_times = !empty($recurring_data['different_times']) ? true : false;
6152 6152
 	
6153
-		$recurring_pkg = geodir_event_recurring_pkg( $gd_post_info );
6154
-		$is_recurring = isset( $gd_post_info->is_recurring ) && (int)$gd_post_info->is_recurring == 0 ? false : true;
6153
+		$recurring_pkg = geodir_event_recurring_pkg($gd_post_info);
6154
+		$is_recurring = isset($gd_post_info->is_recurring) && (int) $gd_post_info->is_recurring == 0 ? false : true;
6155 6155
 			
6156 6156
 		if ($recurring_pkg && $is_recurring) {
6157 6157
 			$recurring_dates = $event_date;
@@ -6161,13 +6161,13 @@  discard block
 block discarded – undo
6161 6161
 			$recurring_type = !empty($recurring_data['repeat_type']) && in_array($recurring_data['repeat_type'], array('day', 'week', 'month', 'year', 'custom')) ? $recurring_data['repeat_type'] : 'custom';
6162 6162
 			
6163 6163
 			if (!empty($recurring_data['event_recurring_dates'])) {
6164
-				$event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] );
6164
+				$event_recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
6165 6165
 				
6166 6166
 				if (!empty($event_recurring_dates)) {
6167 6167
 					$recurring_dates = array();
6168 6168
 					
6169 6169
 					foreach ($event_recurring_dates as $date) {
6170
-						$recurring_dates[] = date_i18n( 'd/m/Y', strtotime( $date ) );
6170
+						$recurring_dates[] = date_i18n('d/m/Y', strtotime($date));
6171 6171
 					}
6172 6172
 					
6173 6173
 					$recurring_dates = implode(",", $recurring_dates);
@@ -6183,7 +6183,7 @@  discard block
 block discarded – undo
6183 6183
 						$times = array();
6184 6184
 						
6185 6185
 						foreach ($recurring_data['starttimes'] as $time) {
6186
-							$times[] = $time != '00:00:00' ? date_i18n( 'H:i', strtotime( $time ) ) : '00:00';
6186
+							$times[] = $time != '00:00:00' ? date_i18n('H:i', strtotime($time)) : '00:00';
6187 6187
 						}
6188 6188
 						
6189 6189
 						$event_starttimes = implode(",", $times);
@@ -6193,7 +6193,7 @@  discard block
 block discarded – undo
6193 6193
 						$times = array();
6194 6194
 						
6195 6195
 						foreach ($recurring_data['endtimes'] as $time) {
6196
-							$times[] = $time != '00:00:00' ? date_i18n( 'H:i', strtotime( $time ) ) : '00:00';
6196
+							$times[] = $time != '00:00:00' ? date_i18n('H:i', strtotime($time)) : '00:00';
6197 6197
 						}
6198 6198
 						
6199 6199
 						$event_endtimes = implode(",", $times);
@@ -6205,8 +6205,8 @@  discard block
 block discarded – undo
6205 6205
 					}
6206 6206
 				}
6207 6207
 			} else {
6208
-				$event_duration_days = isset($recurring_data['duration_x']) ? (int)$recurring_data['duration_x'] : 1;
6209
-				$recurring_interval = !empty($recurring_data['repeat_x']) && (int)$recurring_data['repeat_x'] > 0 ? $recurring_data['repeat_x'] : 1;
6208
+				$event_duration_days = isset($recurring_data['duration_x']) ? (int) $recurring_data['duration_x'] : 1;
6209
+				$recurring_interval = !empty($recurring_data['repeat_x']) && (int) $recurring_data['repeat_x'] > 0 ? $recurring_data['repeat_x'] : 1;
6210 6210
 				
6211 6211
 				if (($recurring_type == 'week' || $recurring_type == 'month') && !empty($recurring_data['repeat_days'])) {
6212 6212
 					$week_days = array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
@@ -6222,11 +6222,11 @@  discard block
 block discarded – undo
6222 6222
 				}
6223 6223
 				
6224 6224
 				$recurring_week_nos = $recurring_type == 'month' && !empty($recurring_data['repeat_weeks']) ? implode(",", $recurring_data['repeat_weeks']) : $recurring_week_nos;
6225
-				if (!empty($recurring_data['repeat_end_type']) && (int)$recurring_data['repeat_end_type'] == 1) {
6226
-					$recurring_end_date = isset($recurring_data['repeat_end']) && $recurring_data['repeat_end'] != '' && $recurring_data['repeat_end'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $recurring_data['repeat_end'] ) ) : '';
6225
+				if (!empty($recurring_data['repeat_end_type']) && (int) $recurring_data['repeat_end_type'] == 1) {
6226
+					$recurring_end_date = isset($recurring_data['repeat_end']) && $recurring_data['repeat_end'] != '' && $recurring_data['repeat_end'] != '0000-00-00 00:00:00' ? date_i18n('d/m/Y', strtotime($recurring_data['repeat_end'])) : '';
6227 6227
 					$max_recurring_count = empty($recurring_end_date) ? 1 : '';
6228 6228
 				} else {
6229
-					$max_recurring_count = (!empty($recurring_data['max_repeat']) && (int)$recurring_data['max_repeat'] > 0 ? (int)$recurring_data['max_repeat'] : 1);
6229
+					$max_recurring_count = (!empty($recurring_data['max_repeat']) && (int) $recurring_data['max_repeat'] > 0 ? (int) $recurring_data['max_repeat'] : 1);
6230 6230
 				}
6231 6231
 			}
6232 6232
 		}
@@ -6290,9 +6290,9 @@  discard block
 block discarded – undo
6290 6290
  * @return array Event data array.
6291 6291
  */
6292 6292
 function geodir_imex_process_event_data($gd_post) {
6293
-	$recurring_pkg = geodir_event_recurring_pkg( (object)$gd_post );
6293
+	$recurring_pkg = geodir_event_recurring_pkg((object) $gd_post);
6294 6294
 
6295
-	$is_recurring = isset( $gd_post['is_recurring_event'] ) && (int)$gd_post['is_recurring_event'] == 0 ? false : true;
6295
+	$is_recurring = isset($gd_post['is_recurring_event']) && (int) $gd_post['is_recurring_event'] == 0 ? false : true;
6296 6296
 	$event_date = isset($gd_post['event_date']) && $gd_post['event_date'] != '' ? geodir_imex_get_date_ymd($gd_post['event_date']) : '';
6297 6297
 	$event_enddate = isset($gd_post['event_enddate']) && $gd_post['event_enddate'] != '' ? geodir_imex_get_date_ymd($gd_post['event_enddate']) : $event_date;
6298 6298
 	$all_day = isset($gd_post['is_whole_day_event']) && !empty($gd_post['is_whole_day_event']) ? true : false;
@@ -6339,17 +6339,17 @@  discard block
 block discarded – undo
6339 6339
 				$event_recurring_dates = implode(",", $event_recurring_dates);
6340 6340
 			}
6341 6341
 		} else {
6342
-			$duration_x = !empty( $gd_post['event_duration_days'] ) ? (int)$gd_post['event_duration_days'] : 1;
6343
-			$repeat_x = !empty( $gd_post['recurring_interval'] ) ? (int)$gd_post['recurring_interval'] : 1;
6344
-			$max_repeat = !empty( $gd_post['max_recurring_count'] ) ? (int)$gd_post['max_recurring_count'] : 1;
6345
-			$repeat_end = !empty( $gd_post['recurring_end_date'] ) ? geodir_imex_get_date_ymd($gd_post['recurring_end_date']) : '';
6342
+			$duration_x = !empty($gd_post['event_duration_days']) ? (int) $gd_post['event_duration_days'] : 1;
6343
+			$repeat_x = !empty($gd_post['recurring_interval']) ? (int) $gd_post['recurring_interval'] : 1;
6344
+			$max_repeat = !empty($gd_post['max_recurring_count']) ? (int) $gd_post['max_recurring_count'] : 1;
6345
+			$repeat_end = !empty($gd_post['recurring_end_date']) ? geodir_imex_get_date_ymd($gd_post['recurring_end_date']) : '';
6346 6346
 			
6347 6347
 			$repeat_end_type = $repeat_end != '' ? 1 : 0;
6348 6348
 			$max_repeat = $repeat_end != '' ? '' : $max_repeat;
6349 6349
 			
6350 6350
 			$week_days = array_flip(array('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'));
6351 6351
 			
6352
-			$a_repeat_days = isset($gd_post['recurring_week_days']) && trim($gd_post['recurring_week_days'])!='' ? explode(',', trim($gd_post['recurring_week_days'])) : array();
6352
+			$a_repeat_days = isset($gd_post['recurring_week_days']) && trim($gd_post['recurring_week_days']) != '' ? explode(',', trim($gd_post['recurring_week_days'])) : array();
6353 6353
 			$repeat_days = array();
6354 6354
 			if (!empty($a_repeat_days)) {
6355 6355
 				foreach ($a_repeat_days as $repeat_day) {
@@ -6367,7 +6367,7 @@  discard block
 block discarded – undo
6367 6367
 			$repeat_weeks = array();
6368 6368
 			if (!empty($a_repeat_weeks)) {
6369 6369
 				foreach ($a_repeat_weeks as $repeat_week) {
6370
-					$repeat_weeks[] = (int)$repeat_week;
6370
+					$repeat_weeks[] = (int) $repeat_week;
6371 6371
 				}
6372 6372
 				
6373 6373
 				$repeat_weeks = array_unique($repeat_weeks);
@@ -6431,7 +6431,7 @@  discard block
 block discarded – undo
6431 6431
 
6432 6432
     $page_found = $wpdb->get_var(
6433 6433
         $wpdb->prepare(
6434
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;",
6434
+            "SELECT ID FROM ".$wpdb->posts." WHERE post_name = %s LIMIT 1;",
6435 6435
             array($slug)
6436 6436
         )
6437 6437
     );
@@ -6486,7 +6486,7 @@  discard block
 block discarded – undo
6486 6486
  */
6487 6487
 function geodir_admin_upgrade_notice() {
6488 6488
     $class = "error";
6489
-    $message = __("Please update core GeoDirectory or some addons may not function correctly.","geodirectory");
6489
+    $message = __("Please update core GeoDirectory or some addons may not function correctly.", "geodirectory");
6490 6490
     echo"<div class=\"$class\"> <p>$message</p></div>";
6491 6491
 }
6492 6492
 
@@ -6498,7 +6498,7 @@  discard block
 block discarded – undo
6498 6498
  * @param (object) $r
6499 6499
  * @return (string) $output
6500 6500
  */
6501
-function geodire_admin_upgrade_notice( $plugin_data, $r )
6501
+function geodire_admin_upgrade_notice($plugin_data, $r)
6502 6502
 {
6503 6503
     // readme contents
6504 6504
     $args = array(
@@ -6506,7 +6506,7 @@  discard block
 block discarded – undo
6506 6506
         'redirection' => 5
6507 6507
     );
6508 6508
     $url = "http://plugins.svn.wordpress.org/geodirectory/trunk/readme.txt";
6509
-    $data       = wp_remote_get( $url, $args );
6509
+    $data = wp_remote_get($url, $args);
6510 6510
 
6511 6511
     if (!is_wp_error($data) && $data['response']['code'] == 200) {
6512 6512
 
@@ -6521,20 +6521,20 @@  discard block
 block discarded – undo
6521 6521
 function geodir_in_plugin_update_message($content) {
6522 6522
     // Output Upgrade Notice
6523 6523
     $matches        = null;
6524
-    $regexp         = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( GEODIRECTORY_VERSION ) . '\s*=|$)~Uis';
6524
+    $regexp         = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*'.preg_quote(GEODIRECTORY_VERSION).'\s*=|$)~Uis';
6525 6525
     $upgrade_notice = '';
6526
-    if ( preg_match( $regexp, $content, $matches ) ) {
6527
-        if(empty($matches)){return;}
6526
+    if (preg_match($regexp, $content, $matches)) {
6527
+        if (empty($matches)) {return; }
6528 6528
 
6529
-        $version = trim( $matches[1] );
6530
-        if($version && $version>GEODIRECTORY_VERSION){
6529
+        $version = trim($matches[1]);
6530
+        if ($version && $version > GEODIRECTORY_VERSION) {
6531 6531
 
6532 6532
 
6533
-        $notices = (array) preg_split('~[\r\n]+~', trim( $matches[2] ) );
6534
-        if ( version_compare( GEODIRECTORY_VERSION, $version, '<' ) ) {
6533
+        $notices = (array) preg_split('~[\r\n]+~', trim($matches[2]));
6534
+        if (version_compare(GEODIRECTORY_VERSION, $version, '<')) {
6535 6535
             $upgrade_notice .= '<div class="geodir_plugin_upgrade_notice">';
6536
-            foreach ( $notices as $index => $line ) {
6537
-                $upgrade_notice .= wp_kses_post( preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line ) );
6536
+            foreach ($notices as $index => $line) {
6537
+                $upgrade_notice .= wp_kses_post(preg_replace('~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line));
6538 6538
             }
6539 6539
             $upgrade_notice .= '</div> ';
6540 6540
         }
@@ -6558,7 +6558,7 @@  discard block
 block discarded – undo
6558 6558
 		$default_language = $sitepress->get_default_language();
6559 6559
 		if ($current_language != 'all' && $current_language != $default_language) {
6560 6560
 	?>
6561
-	<div class="updated error notice-success" id="message"><p style="color:red"><strong><?php _e('Saving GeoDirectory pages settings on a different language breaks pages settings. Try to save after switching to default language.', 'geodirectory');?></strong></p></div>
6561
+	<div class="updated error notice-success" id="message"><p style="color:red"><strong><?php _e('Saving GeoDirectory pages settings on a different language breaks pages settings. Try to save after switching to default language.', 'geodirectory'); ?></strong></p></div>
6562 6562
 	<?php
6563 6563
 		}
6564 6564
 	}
@@ -6573,7 +6573,7 @@  discard block
 block discarded – undo
6573 6573
  * @param array Listing statuses to be skipped.
6574 6574
  */
6575 6575
 function geodir_imex_export_skip_statuses() {
6576
-    $statuses = array( 'trash', 'auto-draft' );
6576
+    $statuses = array('trash', 'auto-draft');
6577 6577
     
6578 6578
     /**
6579 6579
      * Filter the statuses to skip during GD export listings.
@@ -6583,7 +6583,7 @@  discard block
 block discarded – undo
6583 6583
      *
6584 6584
      * @param array $statuses Listing statuses to be skipped.
6585 6585
      */
6586
-    $statuses = apply_filters( 'geodir_imex_export_skip_statuses', $statuses );
6586
+    $statuses = apply_filters('geodir_imex_export_skip_statuses', $statuses);
6587 6587
      
6588 6588
     return $statuses;
6589 6589
 }
Please login to merge, or discard this patch.