Test Failed
Push — master ( a58216...f3cf1b )
by Stiofan
12:53
created
geodirectory-admin/admin_functions.php 1 patch
Spacing   +962 added lines, -962 removed lines patch added patch discarded remove patch
@@ -28,31 +28,31 @@  discard block
 block discarded – undo
28 28
      * @package GeoDirectory
29 29
      */
30 30
     function geodir_admin_styles() {
31
-        wp_register_style('geodirectory-admin-css', geodir_plugin_url() . '/geodirectory-assets/css/admin.css', array(), GEODIRECTORY_VERSION);
31
+        wp_register_style('geodirectory-admin-css', geodir_plugin_url().'/geodirectory-assets/css/admin.css', array(), GEODIRECTORY_VERSION);
32 32
         wp_enqueue_style('geodirectory-admin-css');
33 33
 
34
-        wp_register_style('geodirectory-frontend-style', geodir_plugin_url() . '/geodirectory-assets/css/style.css', array(), GEODIRECTORY_VERSION);
34
+        wp_register_style('geodirectory-frontend-style', geodir_plugin_url().'/geodirectory-assets/css/style.css', array(), GEODIRECTORY_VERSION);
35 35
         wp_enqueue_style('geodirectory-frontend-style');
36 36
 
37
-        wp_register_style('geodir-chosen-style', geodir_plugin_url() . '/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION);
37
+        wp_register_style('geodir-chosen-style', geodir_plugin_url().'/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION);
38 38
         wp_enqueue_style('geodir-chosen-style');
39 39
 
40
-        wp_register_style('geodirectory-jquery-ui-timepicker-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery.ui.timepicker.css', array(), GEODIRECTORY_VERSION);
40
+        wp_register_style('geodirectory-jquery-ui-timepicker-css', geodir_plugin_url().'/geodirectory-assets/css/jquery.ui.timepicker.css', array(), GEODIRECTORY_VERSION);
41 41
         wp_enqueue_style('geodirectory-jquery-ui-timepicker-css');
42 42
 
43
-        wp_register_style('geodirectory-jquery-ui-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery-ui.css', array(), GEODIRECTORY_VERSION);
43
+        wp_register_style('geodirectory-jquery-ui-css', geodir_plugin_url().'/geodirectory-assets/css/jquery-ui.css', array(), GEODIRECTORY_VERSION);
44 44
         wp_enqueue_style('geodirectory-jquery-ui-css');
45 45
 
46
-        wp_register_style('geodirectory-custom-fields-css', geodir_plugin_url() . '/geodirectory-assets/css/custom_field.css', array(), GEODIRECTORY_VERSION);
46
+        wp_register_style('geodirectory-custom-fields-css', geodir_plugin_url().'/geodirectory-assets/css/custom_field.css', array(), GEODIRECTORY_VERSION);
47 47
         wp_enqueue_style('geodirectory-custom-fields-css');
48 48
 
49
-        wp_register_style('geodirectory-pluplodar-css', geodir_plugin_url() . '/geodirectory-assets/css/pluploader.css', array(), GEODIRECTORY_VERSION);
49
+        wp_register_style('geodirectory-pluplodar-css', geodir_plugin_url().'/geodirectory-assets/css/pluploader.css', array(), GEODIRECTORY_VERSION);
50 50
         wp_enqueue_style('geodirectory-pluplodar-css');
51 51
 
52
-        wp_register_style('geodir-rating-style', geodir_plugin_url() . '/geodirectory-assets/css/jRating.jquery.css', array(), GEODIRECTORY_VERSION);
52
+        wp_register_style('geodir-rating-style', geodir_plugin_url().'/geodirectory-assets/css/jRating.jquery.css', array(), GEODIRECTORY_VERSION);
53 53
         wp_enqueue_style('geodir-rating-style');
54 54
 
55
-        wp_register_style('geodir-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl.css', array(), GEODIRECTORY_VERSION);
55
+        wp_register_style('geodir-rtl-style', geodir_plugin_url().'/geodirectory-assets/css/rtl.css', array(), GEODIRECTORY_VERSION);
56 56
         wp_enqueue_style('geodir-rtl-style');
57 57
     }
58 58
 }
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
69 69
 
70 70
         wp_register_script('font-awesome', 'https://use.fontawesome.com/releases/v5.5.0/js/all.js#faload', array('font-awesome-shim'), GEODIRECTORY_VERSION);
71 71
         wp_register_script('font-awesome-shim', 'https://use.fontawesome.com/releases/v5.5.0/js/v4-shims.js', array(), GEODIRECTORY_VERSION);
72
-        wp_enqueue_script( 'font-awesome' );
72
+        wp_enqueue_script('font-awesome');
73 73
 
74
-        wp_register_script('geodirectory-admin', geodir_plugin_url() . '/geodirectory-assets/js/admin-req.min.js', array('jquery'), GEODIRECTORY_VERSION);
74
+        wp_register_script('geodirectory-admin', geodir_plugin_url().'/geodirectory-assets/js/admin-req.min.js', array('jquery'), GEODIRECTORY_VERSION);
75 75
         wp_enqueue_script('geodirectory-admin');
76 76
 
77 77
     }
@@ -90,68 +90,68 @@  discard block
 block discarded – undo
90 90
         
91 91
         wp_enqueue_script('jquery');
92 92
 
93
-        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);
93
+        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);
94 94
 
95
-        wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.js', array('jquery'), GEODIRECTORY_VERSION);
95
+        wp_register_script('chosen', geodir_plugin_url().'/geodirectory-assets/js/chosen.jquery.js', array('jquery'), GEODIRECTORY_VERSION);
96 96
         wp_enqueue_script('chosen');
97 97
 
98
-        wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.js', array(), GEODIRECTORY_VERSION);
98
+        wp_register_script('geodirectory-choose-ajax', geodir_plugin_url().'/geodirectory-assets/js/ajax-chosen.js', array(), GEODIRECTORY_VERSION);
99 99
         wp_enqueue_script('geodirectory-choose-ajax');
100 100
 
101 101
         if (isset($_REQUEST['listing_type'])) {
102
-            wp_register_script('geodirectory-custom-fields-script', geodir_plugin_url() . '/geodirectory-assets/js/custom_fields.js', array(), GEODIRECTORY_VERSION);
102
+            wp_register_script('geodirectory-custom-fields-script', geodir_plugin_url().'/geodirectory-assets/js/custom_fields.js', array(), GEODIRECTORY_VERSION);
103 103
         }
104 104
 
105 105
         wp_enqueue_script('geodirectory-custom-fields-script');
106
-        $plugin_path = geodir_plugin_url() . '/geodirectory-functions/cat-meta-functions';
106
+        $plugin_path = geodir_plugin_url().'/geodirectory-functions/cat-meta-functions';
107 107
 
108
-        wp_enqueue_script('tax-meta-clss', $plugin_path . '/js/tax-meta-clss.js', array('jquery'), null, true);
108
+        wp_enqueue_script('tax-meta-clss', $plugin_path.'/js/tax-meta-clss.js', array('jquery'), null, true);
109 109
 
110 110
         if (in_array($geodir_map_name, array('auto', 'google'))) {
111
-            $map_lang = "&language=" . geodir_get_map_default_language();
112
-            $map_key = "&key=" . geodir_get_map_api_key();
111
+            $map_lang = "&language=".geodir_get_map_default_language();
112
+            $map_key = "&key=".geodir_get_map_api_key();
113 113
             /** This filter is documented in geodirectory_template_tags.php */
114 114
             $map_extra = apply_filters('geodir_googlemap_script_extra', '');
115
-            wp_enqueue_script('google-maps-api', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra, '', NULL);
115
+            wp_enqueue_script('google-maps-api', 'https://maps.google.com/maps/api/js?'.$map_lang.$map_key.$map_extra, '', NULL);
116 116
             
117 117
             // Overlapping Marker Spiderfier
118
-            wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION);
118
+            wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url().'/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION);
119 119
             wp_enqueue_script('geodirectory-g-overlappingmarker-script');
120 120
         }
121 121
         
122 122
         if ($geodir_map_name == 'osm') {
123 123
             // Leaflet OpenStreetMap
124
-            wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
124
+            wp_register_style('geodirectory-leaflet-style', geodir_plugin_url().'/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
125 125
             wp_enqueue_style('geodirectory-leaflet-style');
126 126
                 
127
-            wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
127
+            wp_register_script('geodirectory-leaflet-script', geodir_plugin_url().'/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
128 128
             wp_enqueue_script('geodirectory-leaflet-script');
129 129
             
130
-            wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.min.js', array('geodirectory-leaflet-script'), GEODIRECTORY_VERSION);
130
+            wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url().'/geodirectory-assets/leaflet/osm.geocode.min.js', array('geodirectory-leaflet-script'), GEODIRECTORY_VERSION);
131 131
             wp_enqueue_script('geodirectory-leaflet-geo-script');
132 132
             
133 133
             // Overlapping Marker Spiderfier Leaflet
134
-            wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION);
134
+            wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url().'/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION);
135 135
             wp_enqueue_script('geodirectory-o-overlappingmarker-script');
136 136
         }
137
-        wp_enqueue_script( 'jquery-ui-autocomplete' );
137
+        wp_enqueue_script('jquery-ui-autocomplete');
138 138
         
139
-        wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true);
139
+        wp_register_script('geodirectory-goMap-script', geodir_plugin_url().'/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true);
140 140
         wp_enqueue_script('geodirectory-goMap-script');
141 141
 
142
-        wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.js', array(), GEODIRECTORY_VERSION);
142
+        wp_register_script('geodirectory-goMap-script', geodir_plugin_url().'/geodirectory-assets/js/goMap.js', array(), GEODIRECTORY_VERSION);
143 143
         wp_enqueue_script('geodirectory-goMap-script');
144 144
 
145 145
 		// font awesome rating script
146 146
 		if (get_option('geodir_reviewrating_enable_font_awesome')) {
147
-			wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION);
147
+			wp_register_script('geodir-barrating-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION);
148 148
 			wp_enqueue_script('geodir-barrating-js');
149 149
 		} else { // default rating script
150
-			wp_register_script('geodir-jRating-js', geodir_plugin_url() . '/geodirectory-assets/js/jRating.jquery.js', array(), GEODIRECTORY_VERSION);
150
+			wp_register_script('geodir-jRating-js', geodir_plugin_url().'/geodirectory-assets/js/jRating.jquery.js', array(), GEODIRECTORY_VERSION);
151 151
 			wp_enqueue_script('geodir-jRating-js');
152 152
 		}
153 153
 
154
-        wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js', array(), GEODIRECTORY_VERSION);
154
+        wp_register_script('geodir-on-document-load', geodir_plugin_url().'/geodirectory-assets/js/on_document_load.min.js', array(), GEODIRECTORY_VERSION);
155 155
         wp_enqueue_script('geodir-on-document-load');
156 156
 
157 157
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
         wp_enqueue_script('plupload-all');
160 160
         wp_enqueue_script('jquery-ui-sortable');
161 161
 
162
-        wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.js', array(), GEODIRECTORY_VERSION);
162
+        wp_register_script('geodirectory-plupload-script', geodir_plugin_url().'/geodirectory-assets/js/geodirectory-plupload.js', array(), GEODIRECTORY_VERSION);
163 163
         wp_enqueue_script('geodirectory-plupload-script');
164 164
 
165 165
         // SCRIPT FOR UPLOAD END
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
         wp_localize_script('geodirectory-custom-fields-script', 'geodir_admin_ajax', $ajax_cons_data);
214 214
 
215 215
 
216
-        wp_register_script('geodirectory-admin-script', geodir_plugin_url() . '/geodirectory-assets/js/admin.js', array(), GEODIRECTORY_VERSION);
216
+        wp_register_script('geodirectory-admin-script', geodir_plugin_url().'/geodirectory-assets/js/admin.js', array(), GEODIRECTORY_VERSION);
217 217
         wp_enqueue_script('geodirectory-admin-script');
218 218
 
219 219
         wp_enqueue_style('farbtastic');
@@ -221,10 +221,10 @@  discard block
 block discarded – undo
221 221
 
222 222
         $screen = get_current_screen();
223 223
         if ($screen->base == 'post' && in_array($screen->post_type, geodir_get_posttypes())) {
224
-            wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation_admin.js');
224
+            wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url().'/geodirectory-assets/js/listing_validation_admin.js');
225 225
         }
226 226
 
227
-        $ajax_cons_data = array('url' => esc_url(__(get_option('siteurl') . '?geodir_ajax=true')));
227
+        $ajax_cons_data = array('url' => esc_url(__(get_option('siteurl').'?geodir_ajax=true')));
228 228
         wp_localize_script('geodirectory-admin-script', 'geodir_ajax', $ajax_cons_data);
229 229
 
230 230
     }
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 
248 248
         if (current_user_can('manage_options')) $menu[] = array('', 'read', 'separator-geodirectory', '', 'wp-menu-separator geodirectory');
249 249
 
250
-        add_menu_page(__('Geodirectory', 'geodirectory'), __('Geodirectory', 'geodirectory'), 'manage_options', 'geodirectory', 'geodir_admin_panel', geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico', '55.1984');
250
+        add_menu_page(__('Geodirectory', 'geodirectory'), __('Geodirectory', 'geodirectory'), 'manage_options', 'geodirectory', 'geodir_admin_panel', geodir_plugin_url().'/geodirectory-assets/images/favicon.ico', '55.1984');
251 251
 
252 252
 
253 253
     }
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
                 $geodir_menu_order[] = 'separator-geodirectory';
282 282
                 if (!empty($post_types)) {
283 283
                     foreach ($post_types as $post_type) {
284
-                        $geodir_menu_order[] = 'edit.php?post_type=' . $post_type;
284
+                        $geodir_menu_order[] = 'edit.php?post_type='.$post_type;
285 285
                     }
286 286
                 }
287 287
                 $geodir_menu_order[] = $item;
@@ -324,8 +324,8 @@  discard block
 block discarded – undo
324 324
 {
325 325
     if (isset($_REQUEST['installed']) && $_REQUEST['installed'] != '') {
326 326
         echo '<div id="message" class="updated fade">
327
-                        <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>
328
-                        <p><strong>' . __('Geodirectory has been installed and setup. Enjoy :)', 'geodirectory') . '</strong></p>
327
+                        <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>
328
+                        <p><strong>' . __('Geodirectory has been installed and setup. Enjoy :)', 'geodirectory').'</strong></p>
329 329
                 </div>';
330 330
 
331 331
     }
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
     if (isset($_REQUEST['msg']) && $_REQUEST['msg'] != '') {
334 334
         switch ($_REQUEST['msg']) {
335 335
             case 'success':
336
-                echo '<div id="message" class="updated fade"><p><strong>' . __('Your settings have been saved.', 'geodirectory') . '</strong></p></div>';
336
+                echo '<div id="message" class="updated fade"><p><strong>'.__('Your settings have been saved.', 'geodirectory').'</strong></p></div>';
337 337
                 flush_rewrite_rules(false);
338 338
 
339 339
                 break;
@@ -341,30 +341,30 @@  discard block
 block discarded – undo
341 341
 				$gderr = isset($_REQUEST['gderr']) ? $_REQUEST['gderr'] : '';
342 342
 				
343 343
 				if ($gderr == 21)
344
-			    	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>';
344
+			    	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>';
345 345
 				else
346
-					echo '<div id="message" class="error fade"><p><strong>' . __('Error: Your settings have not been saved, please try again.', 'geodirectory') . '</strong></p></div>';
346
+					echo '<div id="message" class="error fade"><p><strong>'.__('Error: Your settings have not been saved, please try again.', 'geodirectory').'</strong></p></div>';
347 347
                 break;
348 348
         }
349 349
     }
350 350
 
351 351
     $geodir_load_map = get_option('geodir_load_map');
352 352
     $need_map_key = false;
353
-    if($geodir_load_map=='' || $geodir_load_map=='google' || $geodir_load_map=='auto' ){
353
+    if ($geodir_load_map == '' || $geodir_load_map == 'google' || $geodir_load_map == 'auto') {
354 354
         $need_map_key = true;
355 355
     }
356 356
 
357 357
     if (!geodir_get_map_api_key() && $need_map_key) {
358
-        echo '<div class="error"><p><strong>' . sprintf(__('Google Maps API KEY not set, %sclick here%s to set one OR use Open Street Maps instead.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=design_settings&active_tab=geodir_map_settings') . '\'>', '</a>') . '</strong></p></div>';
358
+        echo '<div class="error"><p><strong>'.sprintf(__('Google Maps API KEY not set, %sclick here%s to set one OR use Open Street Maps instead.', 'geodirectory'), '<a href=\''.admin_url('admin.php?page=geodirectory&tab=design_settings&active_tab=geodir_map_settings').'\'>', '</a>').'</strong></p></div>';
359 359
     }
360 360
 
361 361
     if (!geodir_is_default_location_set()) {
362
-        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
+        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>';
363 363
 
364 364
     }
365 365
 
366 366
     if (!function_exists('curl_init')) {
367
-        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
+        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>';
368 368
 
369 369
     }
370 370
 
@@ -384,18 +384,18 @@  discard block
 block discarded – undo
384 384
 function geodir_handle_option_form_submit($current_tab)
385 385
 {
386 386
     global $geodir_settings;
387
-    if (file_exists(dirname(__FILE__) . '/option-pages/' . $current_tab . '_array.php')) {
387
+    if (file_exists(dirname(__FILE__).'/option-pages/'.$current_tab.'_array.php')) {
388 388
         /**
389 389
          * Contains settings array for current tab.
390 390
          *
391 391
          * @since 1.0.0
392 392
          * @package GeoDirectory
393 393
          */
394
-        include_once('option-pages/' . $current_tab . '_array.php');
394
+        include_once('option-pages/'.$current_tab.'_array.php');
395 395
     }
396 396
     if (isset($_POST) && $_POST && isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') :
397 397
         if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
398
-        if (!wp_verify_nonce($_REQUEST['_wpnonce-' . $current_tab], 'geodir-settings-' . $current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
398
+        if (!wp_verify_nonce($_REQUEST['_wpnonce-'.$current_tab], 'geodir-settings-'.$current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
399 399
 		
400 400
 		/**
401 401
 		 * Fires before updating geodirectory admin settings.
@@ -428,13 +428,13 @@  discard block
 block discarded – undo
428 428
          * @param string $current_tab The current settings tab name.
429 429
          * @param array $geodir_settings[$current_tab] The array of settings for the current settings tab.
430 430
          */
431
-        do_action('geodir_update_options_' . $current_tab, $geodir_settings[$current_tab]);
431
+        do_action('geodir_update_options_'.$current_tab, $geodir_settings[$current_tab]);
432 432
 
433 433
         flush_rewrite_rules(false);
434 434
 
435 435
         $current_tab = isset($_REQUEST['tab']) ? $_REQUEST['tab'] : '';
436 436
 
437
-        $redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $_REQUEST['active_tab'] . '&msg=success');
437
+        $redirect_url = admin_url('admin.php?page=geodirectory&tab='.$current_tab.'&active_tab='.$_REQUEST['active_tab'].'&msg=success');
438 438
 
439 439
         wp_redirect($redirect_url);
440 440
         exit();
@@ -473,18 +473,18 @@  discard block
 block discarded – undo
473 473
 
474 474
         elseif (isset($value['type']) && $value['type'] == 'image_width') :
475 475
 
476
-            if (isset($value['id']) && isset($_POST[$value['id'] . '_width'])) {
477
-                update_option($value['id'] . '_width', $_POST[$value['id'] . '_width']);
478
-                update_option($value['id'] . '_height', $_POST[$value['id'] . '_height']);
479
-                if (isset($_POST[$value['id'] . '_crop'])) :
480
-                    update_option($value['id'] . '_crop', 1);
476
+            if (isset($value['id']) && isset($_POST[$value['id'].'_width'])) {
477
+                update_option($value['id'].'_width', $_POST[$value['id'].'_width']);
478
+                update_option($value['id'].'_height', $_POST[$value['id'].'_height']);
479
+                if (isset($_POST[$value['id'].'_crop'])) :
480
+                    update_option($value['id'].'_crop', 1);
481 481
                 else :
482
-                    update_option($value['id'] . '_crop', 0);
482
+                    update_option($value['id'].'_crop', 0);
483 483
                 endif;
484 484
             } else {
485
-                update_option($value['id'] . '_width', $value['std']);
486
-                update_option($value['id'] . '_height', $value['std']);
487
-                update_option($value['id'] . '_crop', 1);
485
+                update_option($value['id'].'_width', $value['std']);
486
+                update_option($value['id'].'_height', $value['std']);
487
+                update_option($value['id'].'_crop', 1);
488 488
             }
489 489
 
490 490
         elseif (isset($value['type']) && $value['type'] == 'map') :
@@ -526,12 +526,12 @@  discard block
 block discarded – undo
526 526
         elseif (isset($value['type']) && $value['type'] == 'file') :
527 527
 
528 528
 
529
-            if (isset($_POST[$value['id'] . '_remove']) && $_POST[$value['id'] . '_remove']) {// if remove is set then remove the file
529
+            if (isset($_POST[$value['id'].'_remove']) && $_POST[$value['id'].'_remove']) {// if remove is set then remove the file
530 530
 
531 531
                 if (get_option($value['id'])) {
532 532
                     $image_name_arr = explode('/', get_option($value['id']));
533 533
                     $noimg_name = end($image_name_arr);
534
-                    $img_path = $uploads['path'] . '/' . $noimg_name;
534
+                    $img_path = $uploads['path'].'/'.$noimg_name;
535 535
                     if (file_exists($img_path))
536 536
                         unlink($img_path);
537 537
                 }
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
                 if (get_option($value['id'])) {
560 560
                     $image_name_arr = explode('/', get_option($value['id']));
561 561
                     $noimg_name = end($image_name_arr);
562
-                    $img_path = $uploads['path'] . '/' . $noimg_name;
562
+                    $img_path = $uploads['path'].'/'.$noimg_name;
563 563
                     if (file_exists($img_path))
564 564
                         unlink($img_path);
565 565
                 }
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
             // same menu setting per theme.
581 581
             if (isset($value['id']) && $value['id'] == 'geodir_theme_location_nav' && isset($_POST[$value['id']])) {
582 582
                 $theme = wp_get_theme();
583
-                update_option('geodir_theme_location_nav_' . $theme->name, $_POST[$value['id']]);
583
+                update_option('geodir_theme_location_nav_'.$theme->name, $_POST[$value['id']]);
584 584
             }
585 585
 
586 586
             if (isset($value['id']) && isset($_POST[$value['id']])) {
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
 
651 651
             $listing_slug = __($geodir_posttype_info['labels']['singular_name'], 'geodirectory');
652 652
 
653
-            $tabs[$geodir_post_type . '_fields_settings'] = array(
653
+            $tabs[$geodir_post_type.'_fields_settings'] = array(
654 654
                 'label' => wp_sprintf(__('%s Settings', 'geodirectory'), $listing_slug),
655 655
                 'subtabs' => array(
656 656
                     array('subtab' => 'custom_fields',
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
  */
685 685
 function geodir_tools_setting_tab($tabs)
686 686
 {
687
-    wp_enqueue_script( 'jquery-ui-progressbar' );
687
+    wp_enqueue_script('jquery-ui-progressbar');
688 688
     $tabs['tools_settings'] = array('label' => __('GD Tools', 'geodirectory'));
689 689
     return $tabs;
690 690
 }
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
  */
719 719
 function geodir_extend_geodirectory_setting_tab($tabs)
720 720
 {
721
-    $tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory'). ' <i class="fas fa-plug"></i>', 'url' => 'https://wpgeodirectory.com', 'target' => '_blank');
721
+    $tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory').' <i class="fas fa-plug"></i>', 'url' => 'https://wpgeodirectory.com', 'target' => '_blank');
722 722
     return $tabs;
723 723
 }
724 724
 
@@ -778,8 +778,8 @@  discard block
 block discarded – undo
778 778
                     _e('Unknown', 'geodirectory');
779 779
                 } else {
780 780
                     /* If there is a city id, append 'city name' to the text string. */
781
-                    $add_location_id = $location_id > 0 ? ' (' . $location_id . ')' : '';
782
-                    echo(__($location->country, 'geodirectory') . '-' . $location->region . '-' . $location->city . $add_location_id);
781
+                    $add_location_id = $location_id > 0 ? ' ('.$location_id.')' : '';
782
+                    echo(__($location->country, 'geodirectory').'-'.$location->region.'-'.$location->city.$add_location_id);
783 783
                 }
784 784
                 break;
785 785
 
@@ -797,14 +797,14 @@  discard block
 block discarded – undo
797 797
                         $expire_class = 'expire_over';
798 798
                     }
799 799
                     $date_diff = round(abs(strtotime($d1) - strtotime($d2)) / 86400); // get the difference in days
800
-                    $date_diff_text = '<br /><span class="' . $expire_class . '">(' . $date_diff . ' ' . $state . ')</span>';
800
+                    $date_diff_text = '<br /><span class="'.$expire_class.'">('.$date_diff.' '.$state.')</span>';
801 801
                 }
802 802
                 /* If no expire_date is found, output a default message. */
803 803
                 if (empty($expire_date))
804 804
                     echo __('Unknown', 'geodirectory');
805 805
                 /* If there is a expire_date, append 'days left' to the text string. */
806 806
                 else
807
-                    echo $expire_date . $date_diff_text;
807
+                    echo $expire_date.$date_diff_text;
808 808
                 break;
809 809
 
810 810
             /* If displaying the 'categorys' column. */
@@ -871,7 +871,7 @@  discard block
 block discarded – undo
871 871
 function geodir_post_information_save($post_id, $post) {
872 872
     global $wpdb, $current_user;
873 873
 
874
-    if (isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')) {
874
+    if (isset($post->post_type) && ($post->post_type == 'nav_menu_item' || $post->post_type == 'page' || $post->post_type == 'post')) {
875 875
         return;
876 876
     }
877 877
 
@@ -939,7 +939,7 @@  discard block
 block discarded – undo
939 939
                     $tab_id = $value['id'];
940 940
 
941 941
                 if (isset($value['desc']) && $value['desc'])
942
-                    $desc = '<span style=" text-transform:none;">:- ' . $value['desc'] . '</span>';
942
+                    $desc = '<span style=" text-transform:none;">:- '.$value['desc'].'</span>';
943 943
 
944 944
                 if (isset($value['name']) && $value['name']) {
945 945
                     if ($first_title === true) {
@@ -947,9 +947,9 @@  discard block
 block discarded – undo
947 947
                     } else {
948 948
                         echo '</div>';
949 949
                     }
950
-                    echo '<dd id="' . trim($tab_id) . '" class="geodir_option_tabs" ><a href="javascript:void(0);">' . $value['name'] . '</a></dd>';
950
+                    echo '<dd id="'.trim($tab_id).'" class="geodir_option_tabs" ><a href="javascript:void(0);">'.$value['name'].'</a></dd>';
951 951
 
952
-                    echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
952
+                    echo '<div id="sub_'.trim($tab_id).'" class="gd-content-heading" style=" margin-bottom:10px;" >';
953 953
                 }
954 954
 
955 955
                 /**
@@ -959,21 +959,21 @@  discard block
 block discarded – undo
959 959
                  *
960 960
                  * @since 1.0.0
961 961
                  */
962
-                do_action('geodir_settings_' . sanitize_title($value['id']));
962
+                do_action('geodir_settings_'.sanitize_title($value['id']));
963 963
                 break;
964 964
 
965 965
             case 'no_tabs':
966 966
 
967 967
                 echo '<div class="inner_content_tab_main">';
968
-                echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
968
+                echo '<div id="sub_'.trim($tab_id).'" class="gd-content-heading" style=" margin-bottom:10px;" >';
969 969
 
970 970
                 break;
971 971
 
972 972
             case 'sectionstart':
973 973
                 if (isset($value['desc']) && $value['desc'])
974
-                    $desc = '<span style=" text-transform:none;"> - ' . $value['desc'] . '</span>';
974
+                    $desc = '<span style=" text-transform:none;"> - '.$value['desc'].'</span>';
975 975
                 if (isset($value['name']) && $value['name'])
976
-                    echo '<h3>' . $value['name'] . $desc . '</h3>';
976
+                    echo '<h3>'.$value['name'].$desc.'</h3>';
977 977
                 /**
978 978
                  * Called after a GeoDirectory settings sectionstart is output in the GD settings page.
979 979
                  *
@@ -981,8 +981,8 @@  discard block
 block discarded – undo
981 981
                  *
982 982
                  * @since 1.0.0
983 983
                  */
984
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_start');
985
-                echo '<table class="form-table">' . "\n\n";
984
+                if (isset($value['id']) && $value['id']) do_action('geodir_settings_'.sanitize_title($value['id']).'_start');
985
+                echo '<table class="form-table">'."\n\n";
986 986
 
987 987
                 break;
988 988
             case 'sectionend':
@@ -993,7 +993,7 @@  discard block
 block discarded – undo
993 993
                  *
994 994
                  * @since 1.0.0
995 995
                  */
996
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_end');
996
+                if (isset($value['id']) && $value['id']) do_action('geodir_settings_'.sanitize_title($value['id']).'_end');
997 997
                 echo '</table>';
998 998
                 /**
999 999
                  * Called after a GeoDirectory settings sectionend is output in the GD settings page.
@@ -1002,7 +1002,7 @@  discard block
 block discarded – undo
1002 1002
                  *
1003 1003
                  * @since 1.0.0
1004 1004
                  */
1005
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_after');
1005
+                if (isset($value['id']) && $value['id']) do_action('geodir_settings_'.sanitize_title($value['id']).'_after');
1006 1006
                 break;
1007 1007
             case 'text':
1008 1008
                 ?>
@@ -1011,7 +1011,7 @@  discard block
 block discarded – undo
1011 1011
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
1012 1012
                                            id="<?php echo esc_attr($value['id']); ?>"
1013 1013
                                            type="<?php echo esc_attr($value['type']); ?>"
1014
-                                           <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1014
+                                           <?php if (isset($value['placeholder'])) {?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1015 1015
                                            style=" <?php echo esc_attr($value['css']); ?>"
1016 1016
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
1017 1017
                                                echo esc_attr(stripslashes(get_option($value['id'])));
@@ -1028,15 +1028,15 @@  discard block
 block discarded – undo
1028 1028
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
1029 1029
                                            id="<?php echo esc_attr($value['id']); ?>"
1030 1030
                                            type="<?php echo esc_attr($value['type']); ?>"
1031
-                                           <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1031
+                                           <?php if (isset($value['placeholder'])) {?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1032 1032
                                            style=" <?php echo esc_attr($value['css']); ?>"
1033 1033
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
1034 1034
                                                echo esc_attr(stripslashes(get_option($value['id'])));
1035 1035
                                            } else {
1036 1036
                                                echo esc_attr($value['std']);
1037 1037
                                            } ?>"/>
1038
-                    <?php $gm_api_url = 'https://console.developers.google.com/henhouse/?pb=["hh-1","maps_backend",null,[],"https://developers.google.com",null,["static_maps_backend","street_view_image_backend","maps_embed_backend","places_backend","geocoding_backend","directions_backend","distance_matrix_backend","geolocation","elevation_backend","timezone_backend","maps_backend"],null]';?>
1039
-                    <a id="gd-api-key" onclick='window.open("<?php echo wp_slash($gm_api_url);?>", "newwindow", "width=600, height=400"); return false;' href='<?php echo $gm_api_url;?>' class="button-primary" name="<?php _e('Generate API Key - ( MUST be logged in to your Google account )','geodirectory');?>" ><?php _e('Generate API Key','geodirectory');?></a>
1038
+                    <?php $gm_api_url = 'https://console.developers.google.com/henhouse/?pb=["hh-1","maps_backend",null,[],"https://developers.google.com",null,["static_maps_backend","street_view_image_backend","maps_embed_backend","places_backend","geocoding_backend","directions_backend","distance_matrix_backend","geolocation","elevation_backend","timezone_backend","maps_backend"],null]'; ?>
1039
+                    <a id="gd-api-key" onclick='window.open("<?php echo wp_slash($gm_api_url); ?>", "newwindow", "width=600, height=400"); return false;' href='<?php echo $gm_api_url; ?>' class="button-primary" name="<?php _e('Generate API Key - ( MUST be logged in to your Google account )', 'geodirectory'); ?>" ><?php _e('Generate API Key', 'geodirectory'); ?></a>
1040 1040
                     <span class="description"><?php echo $value['desc']; ?></span></td>
1041 1041
                 </tr><?php
1042 1042
                 break;
@@ -1048,7 +1048,7 @@  discard block
 block discarded – undo
1048 1048
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
1049 1049
                                            id="<?php echo esc_attr($value['id']); ?>"
1050 1050
                                            type="<?php echo esc_attr($value['type']); ?>"
1051
-                                           <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1051
+                                           <?php if (isset($value['placeholder'])) {?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1052 1052
                                            style="<?php echo esc_attr($value['css']); ?>"
1053 1053
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
1054 1054
                                                echo esc_attr(stripslashes(get_option($value['id'])));
@@ -1094,17 +1094,17 @@  discard block
 block discarded – undo
1094 1094
                     <?php _e('Width', 'geodirectory'); ?> <input
1095 1095
                         name="<?php echo esc_attr($value['id']); ?>_width"
1096 1096
                         id="<?php echo esc_attr($value['id']); ?>_width" type="text" size="3"
1097
-                        value="<?php if ($size = get_option($value['id'] . '_width')) echo stripslashes($size); else echo $value['std']; ?>"/>
1097
+                        value="<?php if ($size = get_option($value['id'].'_width')) echo stripslashes($size); else echo $value['std']; ?>"/>
1098 1098
 
1099 1099
                     <?php _e('Height', 'geodirectory'); ?> <input
1100 1100
                         name="<?php echo esc_attr($value['id']); ?>_height"
1101 1101
                         id="<?php echo esc_attr($value['id']); ?>_height" type="text" size="3"
1102
-                        value="<?php if ($size = get_option($value['id'] . '_height')) echo stripslashes($size); else echo $value['std']; ?>"/>
1102
+                        value="<?php if ($size = get_option($value['id'].'_height')) echo stripslashes($size); else echo $value['std']; ?>"/>
1103 1103
 
1104 1104
                     <label><?php _e('Hard Crop', 'geodirectory'); ?> <input
1105 1105
                             name="<?php echo esc_attr($value['id']); ?>_crop"
1106 1106
                             id="<?php echo esc_attr($value['id']); ?>_crop"
1107
-                            type="checkbox" <?php if (get_option($value['id'] . '_crop') != '') checked(get_option($value['id'] . '_crop'), 1); else checked(1); ?> /></label>
1107
+                            type="checkbox" <?php if (get_option($value['id'].'_crop') != '') checked(get_option($value['id'].'_crop'), 1); else checked(1); ?> /></label>
1108 1108
 
1109 1109
                     <span class="description"><?php echo $value['desc'] ?></span></td>
1110 1110
                 </tr><?php
@@ -1154,7 +1154,7 @@  discard block
 block discarded – undo
1154 1154
                                             id="<?php echo esc_attr($value['id']); ?>"
1155 1155
                                             style="<?php echo esc_attr($value['css']); ?>"
1156 1156
                                             class="<?php if (isset($value['class'])) echo $value['class']; ?>"
1157
-                                            data-placeholder="<?php if (isset($value['placeholder_text'])) echo $value['placeholder_text'];?>"
1157
+                                            data-placeholder="<?php if (isset($value['placeholder_text'])) echo $value['placeholder_text']; ?>"
1158 1158
                                             option-ajaxchosen="false">
1159 1159
                         <?php
1160 1160
                         foreach ($value['options'] as $key => $val) {
@@ -1164,7 +1164,7 @@  discard block
 block discarded – undo
1164 1164
                                 ?></optgroup><?php
1165 1165
                             } else {
1166 1166
                                 ?>
1167
-                                <option value="<?php echo esc_attr($key); ?>" <?php selected(true, (is_array($option_values) && in_array($key, $option_values)));?>>
1167
+                                <option value="<?php echo esc_attr($key); ?>" <?php selected(true, (is_array($option_values) && in_array($key, $option_values))); ?>>
1168 1168
                                     <?php echo geodir_utf8_ucfirst($val) ?>
1169 1169
                                 </option>
1170 1170
                             <?php
@@ -1201,7 +1201,7 @@  discard block
 block discarded – undo
1201 1201
                 ?>
1202 1202
 
1203 1203
                 <tr valign="top">
1204
-                    <th class="titledesc" width="40%"><?php _e('Default map language', 'geodirectory');?></th>
1204
+                    <th class="titledesc" width="40%"><?php _e('Default map language', 'geodirectory'); ?></th>
1205 1205
                     <td width="60%">
1206 1206
                         <select name="geodir_default_map_language" style="width:60%">
1207 1207
                             <?php
@@ -1283,7 +1283,7 @@  discard block
 block discarded – undo
1283 1283
 
1284 1284
                 <tr valign="top">
1285 1285
                     <th class="titledesc"
1286
-                        width="40%"><?php _e('Default post type search on map', 'geodirectory');?></th>
1286
+                        width="40%"><?php _e('Default post type search on map', 'geodirectory'); ?></th>
1287 1287
                     <td width="60%">
1288 1288
                         <select name="geodir_default_map_search_pt" style="width:60%">
1289 1289
                             <?php
@@ -1324,7 +1324,7 @@  discard block
 block discarded – undo
1324 1324
                         $cat_display = 'checkbox';
1325 1325
                         $gd_post_types = get_option('geodir_exclude_post_type_on_map');
1326 1326
                         $gd_cats = get_option('geodir_exclude_cat_on_map');
1327
-                        $gd_cats_upgrade = (int)get_option('geodir_exclude_cat_on_map_upgrade');
1327
+                        $gd_cats_upgrade = (int) get_option('geodir_exclude_cat_on_map_upgrade');
1328 1328
                         $count = 1;
1329 1329
                         ?>
1330 1330
                         <table width="70%" class="widefat">
@@ -1353,7 +1353,7 @@  discard block
 block discarded – undo
1353 1353
                                                                                            name="home_map_post_types[]"
1354 1354
                                                                                            id="<?php echo esc_attr($value['id']); ?>"
1355 1355
                                                                                            value="<?php echo $key; ?>"
1356
-                                                                                           class="map_post_type" <?php echo $checked;?> />
1356
+                                                                                           class="map_post_type" <?php echo $checked; ?> />
1357 1357
                                         <?php echo __($post_types_obj->labels->singular_name, 'geodirectory'); ?></td>
1358 1358
                                     <td width="40%">
1359 1359
                                         <div class="home_map_category" style="overflow:auto;width:200px;height:100px;"
@@ -1411,12 +1411,12 @@  discard block
 block discarded – undo
1411 1411
                 ?>
1412 1412
                 <fieldset>
1413 1413
                     <legend class="screen-reader-text"><span><?php echo $value['name'] ?></span></legend>
1414
-                    <label for="<?php echo $value['id'];?>">
1414
+                    <label for="<?php echo $value['id']; ?>">
1415 1415
                         <input name="<?php echo esc_attr($value['id']); ?>"
1416
-                               id="<?php echo esc_attr($value['id'] . $value['value']); ?>" type="radio"
1416
+                               id="<?php echo esc_attr($value['id'].$value['value']); ?>" type="radio"
1417 1417
                                value="<?php echo $value['value'] ?>" <?php if (get_option($value['id']) == $value['value']) {
1418 1418
                             echo 'checked="checked"';
1419
-                        }elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
1419
+                        }elseif (get_option($value['id']) == '' && $value['std'] == $value['value']) {echo 'checked="checked"'; } ?> />
1420 1420
                         <?php echo $value['desc']; ?></label><br>
1421 1421
                 </fieldset>
1422 1422
                 <?php
@@ -1436,9 +1436,9 @@  discard block
 block discarded – undo
1436 1436
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1437 1437
                 <td class="forminp">
1438 1438
                     <textarea
1439
-                        <?php if (isset($value['args'])) echo $value['args'] . ' '; ?>name="<?php echo esc_attr($value['id']); ?>"
1439
+                        <?php if (isset($value['args'])) echo $value['args'].' '; ?>name="<?php echo esc_attr($value['id']); ?>"
1440 1440
                         id="<?php echo esc_attr($value['id']); ?>"
1441
-                        <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1441
+                        <?php if (isset($value['placeholder'])) {?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1442 1442
                         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
1443 1443
                         class="description"><?php echo $value['desc'] ?></span>
1444 1444
 
@@ -1483,7 +1483,7 @@  discard block
 block discarded – undo
1483 1483
 					}
1484 1484
 				}
1485 1485
 				//
1486
-				$page_setting = (int)get_option($value['id']);
1486
+				$page_setting = (int) get_option($value['id']);
1487 1487
 
1488 1488
                 $args = array('name' => $value['id'],
1489 1489
                     'id' => $value['id'],
@@ -1500,7 +1500,7 @@  discard block
 block discarded – undo
1500 1500
                 <tr valign="top" class="single_select_page">
1501 1501
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1502 1502
                 <td class="forminp">
1503
-                    <?php echo str_replace(' id=', " data-placeholder='" . __('Select a page...', 'geodirectory') . "' style='" . $value['css'] . "' class='" . $value['class'] . "' " . $disabled . " id=", wp_dropdown_pages($args)); ?>
1503
+                    <?php echo str_replace(' id=', " data-placeholder='".__('Select a page...', 'geodirectory')."' style='".$value['css']."' class='".$value['class']."' ".$disabled." id=", wp_dropdown_pages($args)); ?>
1504 1504
                     <span class="description"><?php echo $value['desc'] ?></span>
1505 1505
                 </td>
1506 1506
                 </tr><?php
@@ -1509,7 +1509,7 @@  discard block
 block discarded – undo
1509 1509
 				}
1510 1510
                 break;
1511 1511
             case 'single_select_country' :
1512
-                $country_setting = (string)get_option($value['id']);
1512
+                $country_setting = (string) get_option($value['id']);
1513 1513
                 if (strstr($country_setting, ':')) :
1514 1514
                     $country = current(explode(':', $country_setting));
1515 1515
                     $state = end(explode(':', $country_setting));
@@ -1532,7 +1532,7 @@  discard block
 block discarded – undo
1532 1532
             case 'multi_select_countries' :
1533 1533
                 $countries = $geodirectory->countries->countries;
1534 1534
                 asort($countries);
1535
-                $selections = (array)get_option($value['id']);
1535
+                $selections = (array) get_option($value['id']);
1536 1536
                 ?>
1537 1537
                 <tr valign="top">
1538 1538
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
@@ -1542,7 +1542,7 @@  discard block
 block discarded – undo
1542 1542
                             title="Country" class="chosen_select">
1543 1543
                         <?php
1544 1544
                         if ($countries) foreach ($countries as $key => $val) :
1545
-                            echo '<option value="' . $key . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>';
1545
+                            echo '<option value="'.$key.'" '.selected(in_array($key, $selections), true, false).'>'.$val.'</option>';
1546 1546
                         endforeach;
1547 1547
                         ?>
1548 1548
                     </select>
@@ -1554,7 +1554,7 @@  discard block
 block discarded – undo
1554 1554
                 break;
1555 1555
 
1556 1556
             case 'google_analytics' :
1557
-                $selections = (array)get_option($value['id']);
1557
+                $selections = (array) get_option($value['id']);
1558 1558
                     ?>
1559 1559
                     <tr valign="top">
1560 1560
                         <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
@@ -1565,30 +1565,30 @@  discard block
 block discarded – undo
1565 1565
 
1566 1566
                             $oAuthURL = "https://accounts.google.com/o/oauth2/auth?";
1567 1567
                             $scope = "scope=https://www.googleapis.com/auth/analytics.readonly";
1568
-                            $state = "&state=123";//any string
1569
-                            $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
1568
+                            $state = "&state=123"; //any string
1569
+                            $redirect_uri = "&redirect_uri=".admin_url('admin-ajax.php')."?action=geodir_ga_callback";
1570 1570
                             $response_type = "&response_type=code";
1571 1571
                             $client_id = "&client_id=".get_option('geodir_ga_client_id');
1572 1572
                             $access_type = "&access_type=offline";
1573 1573
                             $approval_prompt = "&approval_prompt=force";
1574 1574
 
1575
-                            $auth_url = $oAuthURL . $scope . $state . $redirect_uri . $response_type . $client_id . $access_type . $approval_prompt;
1575
+                            $auth_url = $oAuthURL.$scope.$state.$redirect_uri.$response_type.$client_id.$access_type.$approval_prompt;
1576 1576
 
1577 1577
 
1578 1578
                             if (get_option('geodir_ga_auth_token')) {
1579 1579
                                 ?>
1580 1580
                                 <span class="button-primary"
1581
-                                      onclick="gd_GA_Deauthorize('<?php echo wp_create_nonce('gd_ga_deauthorize');?>');"><?php _e('Deauthorize', 'geodirectory'); ?></span>
1581
+                                      onclick="gd_GA_Deauthorize('<?php echo wp_create_nonce('gd_ga_deauthorize'); ?>');"><?php _e('Deauthorize', 'geodirectory'); ?></span>
1582 1582
                                 <span style="color: green; font-weight: bold;"><?php _e('Authorized', 'geodirectory'); ?></span>
1583 1583
                             <?php
1584 1584
                                 global $gd_ga_errors;
1585
-                                if(!empty($gd_ga_errors)){
1585
+                                if (!empty($gd_ga_errors)) {
1586 1586
                                     print_r($gd_ga_errors);
1587 1587
                                 }
1588 1588
                             } else {
1589 1589
                                 ?>
1590 1590
                                 <span class="button-primary"
1591
-                                      onclick="window.open('<?php echo  geodir_ga_activation_url();?>', 'activate','width=700, height=600, menubar=0, status=0, location=0, toolbar=0')"><?php _e('Authorize', 'geodirectory');?></span>
1591
+                                      onclick="window.open('<?php echo  geodir_ga_activation_url(); ?>', 'activate','width=700, height=600, menubar=0, status=0, location=0, toolbar=0')"><?php _e('Authorize', 'geodirectory'); ?></span>
1592 1592
                             <?php
1593 1593
                             }
1594 1594
                             ?>
@@ -1659,9 +1659,9 @@  discard block
 block discarded – undo
1659 1659
 
1660 1660
             <?php if (isset($_REQUEST['active_tab']) && $_REQUEST['active_tab'] != '') { ?>
1661 1661
             jQuery('.geodir_option_tabs').removeClass('gd-tab-active');
1662
-            jQuery('#<?php echo sanitize_text_field($_REQUEST['active_tab']);?>').addClass('gd-tab-active');
1662
+            jQuery('#<?php echo sanitize_text_field($_REQUEST['active_tab']); ?>').addClass('gd-tab-active');
1663 1663
             jQuery('.gd-content-heading').hide();
1664
-            jQuery('#sub_<?php echo sanitize_text_field($_REQUEST['active_tab']);?>').show();
1664
+            jQuery('#sub_<?php echo sanitize_text_field($_REQUEST['active_tab']); ?>').show();
1665 1665
             <?php } ?>
1666 1666
         });
1667 1667
     </script>
@@ -1747,7 +1747,7 @@  discard block
 block discarded – undo
1747 1747
     wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_attachments_noncename');
1748 1748
 
1749 1749
     if (geodir_get_featured_image($post_id, 'thumbnail')) {
1750
-        echo '<h4>' . __('Featured Image', 'geodirectory') . '</h4>';
1750
+        echo '<h4>'.__('Featured Image', 'geodirectory').'</h4>';
1751 1751
         geodir_show_featured_image($post_id, 'thumbnail');
1752 1752
     }
1753 1753
 
@@ -1758,13 +1758,13 @@  discard block
 block discarded – undo
1758 1758
 
1759 1759
     <h5 class="form_title">
1760 1760
         <?php if ($image_limit != 0 && $image_limit == 1) {
1761
-            echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
1761
+            echo '<br /><small>('.__('You can upload', 'geodirectory').' '.$image_limit.' '.__('image with this package', 'geodirectory').')</small>';
1762 1762
         } ?>
1763 1763
         <?php if ($image_limit != 0 && $image_limit > 1) {
1764
-            echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
1764
+            echo '<br /><small>('.__('You can upload', 'geodirectory').' '.$image_limit.' '.__('images with this package', 'geodirectory').')</small>';
1765 1765
         } ?>
1766 1766
         <?php if ($image_limit == 0) {
1767
-            echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
1767
+            echo '<br /><small>('.__('You can upload unlimited images with this package', 'geodirectory').')</small>';
1768 1768
         } ?>
1769 1769
     </h5>
1770 1770
 
@@ -1803,10 +1803,10 @@  discard block
 block discarded – undo
1803 1803
         <div
1804 1804
             class="plupload-upload-uic hide-if-no-js <?php if ($multiple): ?>plupload-upload-uic-multiple<?php endif; ?>"
1805 1805
             id="<?php echo $id; ?>plupload-upload-ui">
1806
-            <h4><?php _e('Drop files to upload', 'geodirectory');?></h4>
1806
+            <h4><?php _e('Drop files to upload', 'geodirectory'); ?></h4>
1807 1807
             <input id="<?php echo $id; ?>plupload-browse-button" type="button"
1808 1808
                    value="<?php _e('Select Files', 'geodirectory'); ?>" class="button"/>
1809
-            <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce($id . 'pluploadan'); ?>"></span>
1809
+            <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce($id.'pluploadan'); ?>"></span>
1810 1810
             <?php if ($width && $height): ?>
1811 1811
                 <span class="plupload-resize"></span>
1812 1812
                 <span class="plupload-width" id="plupload-width<?php echo $width; ?>"></span>
@@ -1818,7 +1818,7 @@  discard block
 block discarded – undo
1818 1818
              id="<?php echo $id; ?>plupload-thumbs" style="border-top:1px solid #ccc; padding-top:10px;">
1819 1819
         </div>
1820 1820
         <span
1821
-            id="upload-msg"><?php _e('Please drag &amp; drop the images to rearrange the order', 'geodirectory');?></span>
1821
+            id="upload-msg"><?php _e('Please drag &amp; drop the images to rearrange the order', 'geodirectory'); ?></span>
1822 1822
         <span id="<?php echo $id; ?>upload-error" style="display:none"></span>
1823 1823
     </div>
1824 1824
 
@@ -2028,9 +2028,9 @@  discard block
 block discarded – undo
2028 2028
     $plugin = 'avada-nag';
2029 2029
     $timestamp = 'avada-nag1234';
2030 2030
     $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');
2031
-    echo '<div id="' . $timestamp . '"  class="error">';
2032
-    echo '<span class="gd-remove-noti" onclick="gdRemoveANotification(\'' . $plugin . '\',\'' . $timestamp . '\');" ><i class="fas fa-times"></i></span>';
2033
-    echo "<img class='gd-icon-noti' src='" . plugin_dir_url('') . "geodirectory/geodirectory-assets/images/favicon.ico' > ";
2031
+    echo '<div id="'.$timestamp.'"  class="error">';
2032
+    echo '<span class="gd-remove-noti" onclick="gdRemoveANotification(\''.$plugin.'\',\''.$timestamp.'\');" ><i class="fas fa-times"></i></span>';
2033
+    echo "<img class='gd-icon-noti' src='".plugin_dir_url('')."geodirectory/geodirectory-assets/images/favicon.ico' > ";
2034 2034
     echo "<p>$message</p>";
2035 2035
     echo "</div>";
2036 2036
 
@@ -2164,7 +2164,7 @@  discard block
 block discarded – undo
2164 2164
 		
2165 2165
 		// Don't allow same slug url for listing and location
2166 2166
 		if (geodir_strtolower($listing_prefix) == geodir_strtolower($location_prefix)) {
2167
-			$redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $active_tab . '&msg=fail&gderr=21');
2167
+			$redirect_url = admin_url('admin.php?page=geodirectory&tab='.$current_tab.'&active_tab='.$active_tab.'&msg=fail&gderr=21');
2168 2168
         	wp_redirect($redirect_url);
2169 2169
 			exit;
2170 2170
 		}
@@ -2176,7 +2176,7 @@  discard block
 block discarded – undo
2176 2176
 			$default_language = $sitepress->get_default_language();
2177 2177
 			
2178 2178
 			if ($current_language != 'all' && $current_language != $default_language) {
2179
-				$redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $active_tab);
2179
+				$redirect_url = admin_url('admin.php?page=geodirectory&tab='.$current_tab.'&active_tab='.$active_tab);
2180 2180
 				wp_redirect($redirect_url);
2181 2181
 				exit;
2182 2182
 			}
@@ -2197,11 +2197,11 @@  discard block
 block discarded – undo
2197 2197
 function geodir_hide_admin_preview_button() {
2198 2198
     global $post_type;
2199 2199
     $post_types = geodir_get_posttypes();
2200
-    if(in_array($post_type, $post_types))
2200
+    if (in_array($post_type, $post_types))
2201 2201
         echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
2202 2202
 }
2203
-add_action( 'admin_head-post-new.php', 'geodir_hide_admin_preview_button' );
2204
-add_action( 'admin_head-post.php', 'geodir_hide_admin_preview_button' );
2203
+add_action('admin_head-post-new.php', 'geodir_hide_admin_preview_button');
2204
+add_action('admin_head-post.php', 'geodir_hide_admin_preview_button');
2205 2205
 
2206 2206
 /**
2207 2207
  * Add the tab in left sidebar menu fro import & export page.
@@ -2211,8 +2211,8 @@  discard block
 block discarded – undo
2211 2211
  *
2212 2212
  * @return array Array of tab data.
2213 2213
  */
2214
-function geodir_import_export_tab( $tabs ) {
2215
-	$tabs['import_export'] = array( 'label' => __( 'Import & Export', 'geodirectory' ) );
2214
+function geodir_import_export_tab($tabs) {
2215
+	$tabs['import_export'] = array('label' => __('Import & Export', 'geodirectory'));
2216 2216
     return $tabs;
2217 2217
 }
2218 2218
 
@@ -2226,8 +2226,8 @@  discard block
 block discarded – undo
2226 2226
  * @return string Html content.
2227 2227
  */
2228 2228
 function geodir_import_export_page() {
2229
-	$nonce = wp_create_nonce( 'geodir_import_export_nonce' );
2230
-	$gd_cats_sample_csv = geodir_plugin_url() . '/geodirectory-assets/gd_sample_categories.csv';
2229
+	$nonce = wp_create_nonce('geodir_import_export_nonce');
2230
+	$gd_cats_sample_csv = geodir_plugin_url().'/geodirectory-assets/gd_sample_categories.csv';
2231 2231
     /**
2232 2232
      * Filter sample category data csv file url.
2233 2233
      *
@@ -2236,9 +2236,9 @@  discard block
 block discarded – undo
2236 2236
      *
2237 2237
      * @param string $gd_cats_sample_csv Sample category data csv file url.
2238 2238
      */
2239
-	$gd_cats_sample_csv = apply_filters( 'geodir_export_cats_sample_csv', $gd_cats_sample_csv );
2239
+	$gd_cats_sample_csv = apply_filters('geodir_export_cats_sample_csv', $gd_cats_sample_csv);
2240 2240
 	
2241
-	$gd_posts_sample_csv = geodir_plugin_url() . '/geodirectory-assets/place_listing.csv';
2241
+	$gd_posts_sample_csv = geodir_plugin_url().'/geodirectory-assets/place_listing.csv';
2242 2242
     /**
2243 2243
      * Filter sample post data csv file url.
2244 2244
      *
@@ -2247,15 +2247,15 @@  discard block
 block discarded – undo
2247 2247
      *
2248 2248
      * @param string $gd_posts_sample_csv Sample post data csv file url.
2249 2249
      */
2250
-    $gd_posts_sample_csv = apply_filters( 'geodir_export_posts_sample_csv', $gd_posts_sample_csv );
2250
+    $gd_posts_sample_csv = apply_filters('geodir_export_posts_sample_csv', $gd_posts_sample_csv);
2251 2251
 	
2252
-	$gd_posttypes = geodir_get_posttypes( 'array' );
2252
+	$gd_posttypes = geodir_get_posttypes('array');
2253 2253
 	
2254 2254
 	$gd_posttypes_option = '';
2255
-	foreach ( $gd_posttypes as $gd_posttype => $row ) {
2256
-		$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>';
2255
+	foreach ($gd_posttypes as $gd_posttype => $row) {
2256
+		$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>';
2257 2257
 	}
2258
-	wp_enqueue_script( 'jquery-ui-progressbar' );
2258
+	wp_enqueue_script('jquery-ui-progressbar');
2259 2259
 	
2260 2260
 	$gd_chunksize_options = array();
2261 2261
 	$gd_chunksize_options[100] = 100;
@@ -2277,50 +2277,50 @@  discard block
 block discarded – undo
2277 2277
      *
2278 2278
      * @param string $gd_chunksize_options Entries options.
2279 2279
      */
2280
-    $gd_chunksize_options = apply_filters( 'geodir_export_csv_chunksize_options', $gd_chunksize_options );
2280
+    $gd_chunksize_options = apply_filters('geodir_export_csv_chunksize_options', $gd_chunksize_options);
2281 2281
 	
2282 2282
 	$gd_chunksize_option = '';
2283 2283
 	foreach ($gd_chunksize_options as $value => $title) {
2284
-		$gd_chunksize_option .= '<option value="' . $value . '" ' . selected($value, 5000, false) . '>' . $title . '</option>';
2284
+		$gd_chunksize_option .= '<option value="'.$value.'" '.selected($value, 5000, false).'>'.$title.'</option>';
2285 2285
 	}
2286 2286
 	
2287 2287
 	$uploads = wp_upload_dir();
2288
-	$upload_dir = wp_sprintf( CSV_TRANSFER_IMG_FOLDER, str_replace( ABSPATH, '', $uploads['path'] ) );
2288
+	$upload_dir = wp_sprintf(CSV_TRANSFER_IMG_FOLDER, str_replace(ABSPATH, '', $uploads['path']));
2289 2289
 ?>
2290 2290
 </form>
2291 2291
 <div class="inner_content_tab_main gd-import-export">
2292
-  <h3><?php _e( 'GD Import & Export CSV', 'geodirectory' ) ;?></h3>
2293
-  <span class="description"><?php _e( 'Import & export csv for GD listings & categories.', 'geodirectory' ) ;?></span>
2292
+  <h3><?php _e('GD Import & Export CSV', 'geodirectory'); ?></h3>
2293
+  <span class="description"><?php _e('Import & export csv for GD listings & categories.', 'geodirectory'); ?></span>
2294 2294
   <div class="gd-content-heading">
2295 2295
 
2296 2296
   <?php
2297 2297
     @ini_set('max_execution_time', 999999);
2298
-    $ini_max_execution_time_check = @ini_get( 'max_execution_time' );
2298
+    $ini_max_execution_time_check = @ini_get('max_execution_time');
2299 2299
     @ini_restore('max_execution_time');
2300 2300
 
2301
-    if($ini_max_execution_time_check != 999999){ // only show these setting to the user if we can't change the ini setting
2301
+    if ($ini_max_execution_time_check != 999999) { // only show these setting to the user if we can't change the ini setting
2302 2302
         ?>
2303 2303
 	<div id="gd_ie_reqs" class="metabox-holder">
2304 2304
       <div class="meta-box-sortables ui-sortable">
2305 2305
         <div class="postbox">
2306
-          <h3 class="hndle"><span style='vertical-align:top;'><?php echo __( 'PHP Requirements for GD Import & Export CSV', 'geodirectory' );?></span></h3>
2306
+          <h3 class="hndle"><span style='vertical-align:top;'><?php echo __('PHP Requirements for GD Import & Export CSV', 'geodirectory'); ?></span></h3>
2307 2307
           <div class="inside">
2308
-            <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>
2308
+            <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>
2309 2309
 			<table class="form-table">
2310 2310
 				<thead>
2311 2311
 				  <tr>
2312
-				  	<th><?php _e( 'PHP Settings', 'geodirectory' );?></th><th><?php _e( 'Current Value', 'geodirectory' );?></th><th><?php _e( 'Recommended Value', 'geodirectory' );?></th>
2312
+				  	<th><?php _e('PHP Settings', 'geodirectory'); ?></th><th><?php _e('Current Value', 'geodirectory'); ?></th><th><?php _e('Recommended Value', 'geodirectory'); ?></th>
2313 2313
 				  </tr>
2314 2314
 				</thead>
2315 2315
 				<tbody>
2316 2316
 				  <tr>
2317
-				  	<td>max_input_time</td><td><?php echo @ini_get( 'max_input_time' );?></td><td>3000</td>
2317
+				  	<td>max_input_time</td><td><?php echo @ini_get('max_input_time'); ?></td><td>3000</td>
2318 2318
 				  </tr>
2319 2319
 				  <tr>
2320
-				  	<td>max_execution_time</td><td><?php  echo @ini_get( 'max_execution_time' );?></td><td>3000</td>
2320
+				  	<td>max_execution_time</td><td><?php  echo @ini_get('max_execution_time'); ?></td><td>3000</td>
2321 2321
 				  </tr>
2322 2322
 				  <tr>
2323
-				  	<td>memory_limit</td><td><?php echo @ini_get( 'memory_limit' );?></td><td>256M</td>
2323
+				  	<td>memory_limit</td><td><?php echo @ini_get('memory_limit'); ?></td><td>256M</td>
2324 2324
 				  </tr>
2325 2325
 				</tbody>
2326 2326
 		    </table>
@@ -2332,21 +2332,21 @@  discard block
 block discarded – undo
2332 2332
 	<div id="gd_ie_imposts" class="metabox-holder">
2333 2333
       <div class="meta-box-sortables ui-sortable">
2334 2334
         <div id="gd_ie_im_posts" class="postbox gd-hndle-pbox">
2335
-          <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>
2336
-          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Listings: Import CSV', 'geodirectory' );?></span></h3>
2335
+          <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>
2336
+          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Listings: Import CSV', 'geodirectory'); ?></span></h3>
2337 2337
           <div class="inside">
2338 2338
             <table class="form-table">
2339 2339
 				<tbody>
2340 2340
 				  <tr>
2341 2341
 					<td class="gd-imex-box">
2342 2342
 						<div class="gd-im-choices">
2343
-						<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>
2344
-						<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>
2343
+						<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>
2344
+						<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>
2345 2345
 						</div>
2346 2346
 						<div class="plupload-upload-uic hide-if-no-js" id="gd_im_postplupload-upload-ui">
2347 2347
 							<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');" />
2348
-							<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">
2349
-						<input type="hidden" id="gd_ie_imposts_csv" value="<?php echo $gd_posts_sample_csv;?>" />
2348
+							<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">
2349
+						<input type="hidden" id="gd_ie_imposts_csv" value="<?php echo $gd_posts_sample_csv; ?>" />
2350 2350
 						<input type="hidden" id="gd_im_post_allowed_types" data-exts=".csv" value="csv" />
2351 2351
 							<?php
2352 2352
 							/**
@@ -2356,7 +2356,7 @@  discard block
 block discarded – undo
2356 2356
 							 */
2357 2357
 							do_action('geodir_sample_csv_download_link');
2358 2358
 							?>
2359
-							<span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce( 'gd_im_postpluploadan' ); ?>"></span>
2359
+							<span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce('gd_im_postpluploadan'); ?>"></span>
2360 2360
 							<div class="filelist"></div>
2361 2361
 						</div>
2362 2362
 						<span id="gd_im_postupload-error" style="display:none"></span>
@@ -2374,7 +2374,7 @@  discard block
 block discarded – undo
2374 2374
 							<input type="hidden" id="gd_terminateaction" value="continue"/>
2375 2375
 						</div>
2376 2376
 						<div class="gd-import-progress" id="gd-import-progress" style="display:none">
2377
-							<div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory');?> </b><font
2377
+							<div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory'); ?> </b><font
2378 2378
 									id="gd-import-done">0</font> / <font id="gd-import-total">0</font>&nbsp;( <font
2379 2379
 									id="gd-import-perc">0%</font> )
2380 2380
 								<div class="gd-fileprogress"></div>
@@ -2386,10 +2386,10 @@  discard block
 block discarded – undo
2386 2386
                     	<div class="gd-imex-btns" style="display:none;">
2387 2387
                         	<input type="hidden" class="geodir_import_file" name="geodir_import_file" value="save"/>
2388 2388
                         	<input onclick="gd_imex_PrepareImport(this, 'post')" type="button" value="<?php echo CSV_IMPORT_DATA; ?>" id="gd_import_data" class="button-primary" />
2389
-                        	<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"/>
2390
-                        	<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')"/>
2389
+                        	<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"/>
2390
+                        	<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')"/>
2391 2391
 							<div id="gd_process_data" style="display:none">
2392
-								<span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory');?>
2392
+								<span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory'); ?>
2393 2393
 							</div>
2394 2394
 						</div>
2395 2395
 					</td>
@@ -2403,30 +2403,30 @@  discard block
 block discarded – undo
2403 2403
 	<div id="gd_ie_excategs" class="metabox-holder">
2404 2404
 	  <div class="meta-box-sortables ui-sortable">
2405 2405
 		<div id="gd_ie_ex_posts" class="postbox gd-hndle-pbox">
2406
-		  <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>
2407
-          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Listings: Export CSV', 'geodirectory' );?></span></h3>
2406
+		  <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>
2407
+          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Listings: Export CSV', 'geodirectory'); ?></span></h3>
2408 2408
 		  <div class="inside">
2409 2409
 			<table class="form-table">
2410 2410
 			  <tbody>
2411 2411
 				<tr>
2412 2412
 				  <td class="fld"><label for="gd_post_type">
2413
-					<?php _e( 'Post Type:', 'geodirectory' );?>
2413
+					<?php _e('Post Type:', 'geodirectory'); ?>
2414 2414
 					</label></td>
2415 2415
 				  <td><select name="gd_post_type" id="gd_post_type" style="min-width:140px">
2416
-					  <?php echo $gd_posttypes_option;?>
2416
+					  <?php echo $gd_posttypes_option; ?>
2417 2417
 					</select></td>
2418 2418
 				</tr>
2419 2419
 				<tr>
2420
-					<td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e( 'Max entries per csv file:', 'geodirectory' );?></label></td>
2421
-					<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>
2420
+					<td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e('Max entries per csv file:', 'geodirectory'); ?></label></td>
2421
+					<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>
2422 2422
 				</tr>
2423 2423
                 <tr class="gd-imex-dates">
2424
-					<td class="fld"><label><?php _e( 'Published Date:', 'geodirectory' );?></label></td>
2425
-					<td><label><span class="label-responsive"><?php _e( 'Start date:', 'geodirectory' );?></span><input type="text" id="gd_imex_start_date" name="gd_imex[start_date]" data-type="date" /></label><label><span class="label-responsive"><?php _e( 'End date:', 'geodirectory' );?></span><input type="text" id="gd_imex_end_date" name="gd_imex[end_date]" data-type="date" /></label></td>
2424
+					<td class="fld"><label><?php _e('Published Date:', 'geodirectory'); ?></label></td>
2425
+					<td><label><span class="label-responsive"><?php _e('Start date:', 'geodirectory'); ?></span><input type="text" id="gd_imex_start_date" name="gd_imex[start_date]" data-type="date" /></label><label><span class="label-responsive"><?php _e('End date:', 'geodirectory'); ?></span><input type="text" id="gd_imex_end_date" name="gd_imex[end_date]" data-type="date" /></label></td>
2426 2426
 				</tr>
2427 2427
 				<tr>
2428 2428
 				  <td class="fld" style="vertical-align:top"><label>
2429
-					<?php _e( 'Progress:', 'geodirectory' );?>
2429
+					<?php _e('Progress:', 'geodirectory'); ?>
2430 2430
 					</label></td>
2431 2431
 				  <td><div id='gd_progressbar_box'>
2432 2432
 					  <div id="gd_progressbar" class="gd_progressbar">
@@ -2434,13 +2434,13 @@  discard block
 block discarded – undo
2434 2434
 					  </div>
2435 2435
 					</div>
2436 2436
 					<p style="display:inline-block">
2437
-					  <?php _e( 'Elapsed Time:', 'geodirectory' );?>
2437
+					  <?php _e('Elapsed Time:', 'geodirectory'); ?>
2438 2438
 					</p>
2439 2439
 					  
2440 2440
 					<p id="gd_timer" class="gd_timer">00:00:00</p></td>
2441 2441
 				</tr>
2442 2442
 				<tr class="gd-ie-actions">
2443
-				  <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">
2443
+				  <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">
2444 2444
 				  </td>
2445 2445
 				  <td id="gd_ie_ex_files" class="gd-ie-files"></td>
2446 2446
 				</tr>
@@ -2453,21 +2453,21 @@  discard block
 block discarded – undo
2453 2453
 	<div id="gd_ie_imcategs" class="metabox-holder">
2454 2454
       <div class="meta-box-sortables ui-sortable">
2455 2455
         <div id="gd_ie_imcats" class="postbox gd-hndle-pbox">
2456
-          <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>
2457
-          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Categories: Import CSV', 'geodirectory' );?></span></h3>
2456
+          <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>
2457
+          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Categories: Import CSV', 'geodirectory'); ?></span></h3>
2458 2458
           <div class="inside">
2459 2459
             <table class="form-table">
2460 2460
 				<tbody>
2461 2461
 				  <tr>
2462 2462
 					<td class="gd-imex-box">
2463 2463
 						<div class="gd-im-choices">
2464
-						<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>
2465
-						<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>
2464
+						<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>
2465
+						<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>
2466 2466
 						</div>
2467 2467
 						<div class="plupload-upload-uic hide-if-no-js" id="gd_im_catplupload-upload-ui">
2468 2468
 							<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');" />
2469
-							<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">
2470
-						<input type="hidden" id="gd_ie_imcats_csv" value="<?php echo $gd_cats_sample_csv;?>" />
2469
+							<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">
2470
+						<input type="hidden" id="gd_ie_imcats_csv" value="<?php echo $gd_cats_sample_csv; ?>" />
2471 2471
 						<input type="hidden" id="gd_im_cat_allowed_types" data-exts=".csv" value="csv" />
2472 2472
 						<?php
2473 2473
 						/**
@@ -2478,7 +2478,7 @@  discard block
 block discarded – undo
2478 2478
 						 */
2479 2479
 						do_action('geodir_sample_cats_csv_download_link');
2480 2480
 						?>
2481
-							<span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce( 'gd_im_catpluploadan' ); ?>"></span>
2481
+							<span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce('gd_im_catpluploadan'); ?>"></span>
2482 2482
 							<div class="filelist"></div>
2483 2483
 						</div>
2484 2484
 						<span id="gd_im_catupload-error" style="display:none"></span>
@@ -2495,7 +2495,7 @@  discard block
 block discarded – undo
2495 2495
 							<input type="hidden" id="gd_terminateaction" value="continue"/>
2496 2496
 						</div>
2497 2497
 						<div class="gd-import-progress" id="gd-import-progress" style="display:none">
2498
-							<div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory');?> </b><font
2498
+							<div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory'); ?> </b><font
2499 2499
 									id="gd-import-done">0</font> / <font id="gd-import-total">0</font>&nbsp;( <font
2500 2500
 									id="gd-import-perc">0%</font> )
2501 2501
 								<div class="gd-fileprogress"></div>
@@ -2507,10 +2507,10 @@  discard block
 block discarded – undo
2507 2507
                     	<div class="gd-imex-btns" style="display:none;">
2508 2508
                         	<input type="hidden" class="geodir_import_file" name="geodir_import_file" value="save"/>
2509 2509
                         	<input onclick="gd_imex_PrepareImport(this, 'cat')" type="button" value="<?php echo CSV_IMPORT_DATA; ?>" id="gd_import_data" class="button-primary" />
2510
-                        	<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"/>
2511
-                        	<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')"/>
2510
+                        	<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"/>
2511
+                        	<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')"/>
2512 2512
 							<div id="gd_process_data" style="display:none">
2513
-								<span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory');?>
2513
+								<span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory'); ?>
2514 2514
 							</div>
2515 2515
 						</div>
2516 2516
 					</td>
@@ -2524,26 +2524,26 @@  discard block
 block discarded – undo
2524 2524
 	<div id="gd_ie_excategs" class="metabox-holder">
2525 2525
       <div class="meta-box-sortables ui-sortable">
2526 2526
         <div id="gd_ie_ex_cats" class="postbox gd-hndle-pbox">
2527
-          <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>
2528
-          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Categories: Export CSV', 'geodirectory' );?></span></h3>
2527
+          <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>
2528
+          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Categories: Export CSV', 'geodirectory'); ?></span></h3>
2529 2529
           <div class="inside">
2530 2530
             <table class="form-table">
2531 2531
 				<tbody>
2532 2532
 				  <tr>
2533
-					<td class="fld"><label for="gd_post_type"><?php _e( 'Post Type:', 'geodirectory' );?></label></td>
2534
-					<td><select name="gd_post_type" id="gd_post_type" style="min-width:140px"><?php echo $gd_posttypes_option;?></select></td>
2533
+					<td class="fld"><label for="gd_post_type"><?php _e('Post Type:', 'geodirectory'); ?></label></td>
2534
+					<td><select name="gd_post_type" id="gd_post_type" style="min-width:140px"><?php echo $gd_posttypes_option; ?></select></td>
2535 2535
 				  </tr>
2536 2536
 				   <tr>
2537
-					<td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e( 'Max entries per csv file:', 'geodirectory' );?></label></td>
2538
-					<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>
2537
+					<td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e('Max entries per csv file:', 'geodirectory'); ?></label></td>
2538
+					<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>
2539 2539
 				  </tr>
2540 2540
 				  <tr>
2541
-					<td class="fld" style="vertical-align:top"><label><?php _e( 'Progress:', 'geodirectory' );?></label></td>
2542
-					<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>
2541
+					<td class="fld" style="vertical-align:top"><label><?php _e('Progress:', 'geodirectory'); ?></label></td>
2542
+					<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>
2543 2543
 				  </tr>
2544 2544
 				  <tr class="gd-ie-actions">
2545 2545
 					<td style="vertical-align:top">
2546
-						<input type="submit" value="<?php echo esc_attr( __( 'Export CSV', 'geodirectory' ) );?>" class="button-primary" name="gd_ie_excats_submit" id="gd_ie_excats_submit">
2546
+						<input type="submit" value="<?php echo esc_attr(__('Export CSV', 'geodirectory')); ?>" class="button-primary" name="gd_ie_excats_submit" id="gd_ie_excats_submit">
2547 2547
 					</td>
2548 2548
 					<td id="gd_ie_ex_files" class="gd-ie-files"></td>
2549 2549
 				  </tr>
@@ -2565,7 +2565,7 @@  discard block
 block discarded – undo
2565 2565
      * @param array $gd_chunksize_options File chunk size options.
2566 2566
      * @param string $nonce Wordpress security token for GD import & export.
2567 2567
 	 */
2568
-	do_action( 'geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce );
2568
+	do_action('geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce);
2569 2569
 	?>
2570 2570
   </div>
2571 2571
 </div>
@@ -2584,7 +2584,7 @@  discard block
 block discarded – undo
2584 2584
         jQuery.ajax({
2585 2585
             url: ajaxurl,
2586 2586
             type: "POST",
2587
-            data: 'action=geodir_import_export&task=prepare_import&_pt=' + type + '&_file=' + uploadedFile + '&_nonce=<?php echo $nonce;?>',
2587
+            data: 'action=geodir_import_export&task=prepare_import&_pt=' + type + '&_file=' + uploadedFile + '&_nonce=<?php echo $nonce; ?>',
2588 2588
             dataType: 'json',
2589 2589
             cache: false,
2590 2590
             success: function(data) {
@@ -2636,7 +2636,7 @@  discard block
 block discarded – undo
2636 2636
 
2637 2637
         jQuery(cont).find('.filelist .file').remove();
2638 2638
         
2639
-        jQuery('#gd-import-msg', cont).find('#message').removeClass('updated').addClass('error').html("<p><?php echo esc_attr( PLZ_SELECT_CSV_FILE );?></p>");
2639
+        jQuery('#gd-import-msg', cont).find('#message').removeClass('updated').addClass('error').html("<p><?php echo esc_attr(PLZ_SELECT_CSV_FILE); ?></p>");
2640 2640
         jQuery('#gd-import-msg', cont).show();
2641 2641
         
2642 2642
         return false;
@@ -2695,7 +2695,7 @@  discard block
 block discarded – undo
2695 2695
     jQuery.ajax({
2696 2696
         url: ajaxurl,
2697 2697
         type: "POST",
2698
-        data: 'action=geodir_import_export&task=import_' + type + '&_pt=' + type + '&_file=' + uploadedFile + gddata + '&_ch=' + choice + '&_nonce=<?php echo $nonce;?>',
2698
+        data: 'action=geodir_import_export&task=import_' + type + '&_pt=' + type + '&_file=' + uploadedFile + gddata + '&_ch=' + choice + '&_nonce=<?php echo $nonce; ?>',
2699 2699
         dataType : 'json',
2700 2700
         cache: false,
2701 2701
         success: function (data) {
@@ -2884,27 +2884,27 @@  discard block
 block discarded – undo
2884 2884
 
2885 2885
     var gdMsg = '<p></p>';
2886 2886
     if ( processed > 0 ) {
2887
-        var msgParse = '<p><?php echo addslashes( sprintf( __( 'Total %s item(s) found.', 'geodirectory' ), '%s' ) );?></p>';
2887
+        var msgParse = '<p><?php echo addslashes(sprintf(__('Total %s item(s) found.', 'geodirectory'), '%s')); ?></p>';
2888 2888
         msgParse = msgParse.replace("%s", processed);
2889 2889
         gdMsg += msgParse;
2890 2890
     }
2891 2891
 
2892 2892
     if ( updated > 0 ) {
2893
-        var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) updated.', 'geodirectory' ), '%s', '%d' ) );?></p>';
2893
+        var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) updated.', 'geodirectory'), '%s', '%d')); ?></p>';
2894 2894
         msgParse = msgParse.replace("%s", updated);
2895 2895
         msgParse = msgParse.replace("%d", processed);
2896 2896
         gdMsg += msgParse;
2897 2897
     }
2898 2898
 
2899 2899
     if ( created > 0 ) {
2900
-        var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) added.', 'geodirectory' ), '%s', '%d' ) );?></p>';
2900
+        var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) added.', 'geodirectory'), '%s', '%d')); ?></p>';
2901 2901
         msgParse = msgParse.replace("%s", created);
2902 2902
         msgParse = msgParse.replace("%d", processed);
2903 2903
         gdMsg += msgParse;
2904 2904
     }
2905 2905
 
2906 2906
     if ( skipped > 0 ) {
2907
-        var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) ignored due to already exists.', 'geodirectory' ), '%s', '%d' ) );?></p>';
2907
+        var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) ignored due to already exists.', 'geodirectory'), '%s', '%d')); ?></p>';
2908 2908
         msgParse = msgParse.replace("%s", skipped);
2909 2909
         msgParse = msgParse.replace("%d", processed);
2910 2910
         gdMsg += msgParse;
@@ -2914,17 +2914,17 @@  discard block
 block discarded – undo
2914 2914
         if (type=='loc') {
2915 2915
             invalid_addr = invalid;
2916 2916
         }
2917
-        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>';
2917
+        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>';
2918 2918
         msgParse = msgParse.replace("%s", invalid_addr);
2919 2919
         msgParse = msgParse.replace("%d", total);
2920 2920
         gdMsg += msgParse;
2921 2921
     }
2922 2922
 
2923 2923
     if (invalid > 0 && type!='loc') {
2924
-        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>';
2924
+        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>';
2925 2925
         
2926 2926
         if (type=='hood') {
2927
-            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>';
2927
+            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>';
2928 2928
         }
2929 2929
         msgParse = msgParse.replace("%s", invalid);
2930 2930
         msgParse = msgParse.replace("%d", total);
@@ -2932,7 +2932,7 @@  discard block
 block discarded – undo
2932 2932
     }
2933 2933
 
2934 2934
     if (images > 0) {
2935
-        gdMsg += '<p><?php echo addslashes( $upload_dir );?></p>';
2935
+        gdMsg += '<p><?php echo addslashes($upload_dir); ?></p>';
2936 2936
     }
2937 2937
     gdMsg += '<p></p>';
2938 2938
     jQuery('#gd-import-msg', cont).find('#message').removeClass('error').addClass('updated').html(gdMsg);
@@ -3096,9 +3096,9 @@  discard block
 block discarded – undo
3096 3096
             if (typeof filters !== 'undefined' && filters && doFilter) {
3097 3097
                 getTotal = true;
3098 3098
                 attach += '&_c=1';
3099
-                gd_progressbar(el, 0, '<i class="fas fa-sync fa-spin"></i><?php echo esc_attr( __( 'Preparing...', 'geodirectory' ) );?>');
3099
+                gd_progressbar(el, 0, '<i class="fas fa-sync fa-spin"></i><?php echo esc_attr(__('Preparing...', 'geodirectory')); ?>');
3100 3100
             } else {
3101
-                gd_progressbar(el, 0, '0% (0 / ' + total_posts + ') <i class="fas fa-sync fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>');
3101
+                gd_progressbar(el, 0, '0% (0 / ' + total_posts + ') <i class="fas fa-sync fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>');
3102 3102
             }
3103 3103
             jQuery(el).find('#gd_timer').text('00:00:01');
3104 3104
             jQuery('#gd_ie_ex_files', el).html('');
@@ -3107,7 +3107,7 @@  discard block
 block discarded – undo
3107 3107
         jQuery.ajax({
3108 3108
             url: ajaxurl,
3109 3109
             type: "POST",
3110
-            data: 'action=geodir_import_export&task=export_posts&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce;?>&_p=' + page + attach,
3110
+            data: 'action=geodir_import_export&task=export_posts&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce; ?>&_p=' + page + attach,
3111 3111
             dataType : 'json',
3112 3112
             cache: false,
3113 3113
             beforeSend: function (jqXHR, settings) {},
@@ -3132,11 +3132,11 @@  discard block
 block discarded – undo
3132 3132
                         } else {
3133 3133
                             if (pages < page || pages == page) {
3134 3134
                                 window.clearInterval(timer_posts);
3135
-                                gd_progressbar(el, 100, '100% (' + total_posts + ' / ' + total_posts + ') <i class="fas fa-check"></i><?php echo esc_attr( __( 'Complete!', 'geodirectory' ) );?>');
3135
+                                gd_progressbar(el, 100, '100% (' + total_posts + ' / ' + total_posts + ') <i class="fas fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirectory')); ?>');
3136 3136
                             } else {
3137 3137
                                 var percentage = Math.round(((page * chunk_size) / total_posts) * 100);
3138 3138
                                 percentage = percentage > 100 ? 100 : percentage;
3139
-                                gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_posts + ') <i class="fas fa-sync fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>');
3139
+                                gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_posts + ') <i class="fas fa-sync fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>');
3140 3140
                             }
3141 3141
                             if (typeof data.files != 'undefined' && jQuery(data.files).length ) {
3142 3142
                                 var obj_files = data.files;
@@ -3167,7 +3167,7 @@  discard block
 block discarded – undo
3167 3167
 
3168 3168
     function gd_process_export_cats(el, post_type, total_cats, chunk_size, pages, page) {
3169 3169
         if (page < 2) {
3170
-            gd_progressbar(el, 0, '0% (0 / ' + total_cats + ') <i class="fas fa-sync fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>');
3170
+            gd_progressbar(el, 0, '0% (0 / ' + total_cats + ') <i class="fas fa-sync fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>');
3171 3171
             jQuery(el).find('#gd_timer').text('00:00:01');
3172 3172
             jQuery('#gd_ie_ex_files', el).html('');
3173 3173
         }
@@ -3175,7 +3175,7 @@  discard block
 block discarded – undo
3175 3175
         jQuery.ajax({
3176 3176
             url: ajaxurl,
3177 3177
             type: "POST",
3178
-            data: 'action=geodir_import_export&task=export_cats&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce;?>&_p=' + page,
3178
+            data: 'action=geodir_import_export&task=export_cats&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce; ?>&_p=' + page,
3179 3179
             dataType : 'json',
3180 3180
             cache: false,
3181 3181
             beforeSend: function (jqXHR, settings) {},
@@ -3189,11 +3189,11 @@  discard block
 block discarded – undo
3189 3189
                     } else {
3190 3190
                         if (pages < page || pages == page) {
3191 3191
                             window.clearInterval(timer_cats);
3192
-                            gd_progressbar(el, 100, '100% (' + total_cats + ' / ' + total_cats + ') <i class="fas fa-check"></i><?php echo esc_attr( __( 'Complete!', 'geodirectory' ) );?>');
3192
+                            gd_progressbar(el, 100, '100% (' + total_cats + ' / ' + total_cats + ') <i class="fas fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirectory')); ?>');
3193 3193
                         } else {
3194 3194
                             var percentage = Math.round(((page * chunk_size) / total_cats) * 100);
3195 3195
                             percentage = percentage > 100 ? 100 : percentage;
3196
-                            gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_cats + ') <i class="fas fa-sync fa-spin"></i><?php esc_attr_e( 'Exporting...', 'geodirectory' );?>');
3196
+                            gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_cats + ') <i class="fas fa-sync fa-spin"></i><?php esc_attr_e('Exporting...', 'geodirectory'); ?>');
3197 3197
                         }
3198 3198
                         if (typeof data.files != 'undefined' && jQuery(data.files).length ) {
3199 3199
                             var obj_files = data.files;
@@ -3250,13 +3250,13 @@  discard block
 block discarded – undo
3250 3250
 function geodir_init_filesystem()
3251 3251
 {
3252 3252
 
3253
-    if(!function_exists('get_filesystem_method')){
3253
+    if (!function_exists('get_filesystem_method')) {
3254 3254
         require_once(ABSPATH."/wp-admin/includes/file.php");
3255 3255
     }
3256 3256
     $access_type = get_filesystem_method();
3257 3257
     if ($access_type === 'direct') {
3258 3258
         /* you can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */
3259
-        $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3259
+        $creds = request_filesystem_credentials(trailingslashit(site_url()).'wp-admin/', '', false, false, array());
3260 3260
 
3261 3261
         /* initialize the API */
3262 3262
         if (!WP_Filesystem($creds)) {
@@ -3269,7 +3269,7 @@  discard block
 block discarded – undo
3269 3269
         return $wp_filesystem;
3270 3270
         /* do our file manipulations below */
3271 3271
     } elseif (defined('FTP_USER')) {
3272
-        $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3272
+        $creds = request_filesystem_credentials(trailingslashit(site_url()).'wp-admin/', '', false, false, array());
3273 3273
 
3274 3274
         /* initialize the API */
3275 3275
         if (!WP_Filesystem($creds)) {
@@ -3304,7 +3304,7 @@  discard block
 block discarded – undo
3304 3304
  * @package GeoDirectory
3305 3305
  */
3306 3306
 function geodir_filesystem_notice()
3307
-{   if ( defined( 'DOING_AJAX' ) ){return;}
3307
+{   if (defined('DOING_AJAX')) {return; }
3308 3308
     $access_type = get_filesystem_method();
3309 3309
     if ($access_type === 'direct') {
3310 3310
     } elseif (!defined('FTP_USER')) {
@@ -3345,64 +3345,64 @@  discard block
 block discarded – undo
3345 3345
     // try to set higher limits for import
3346 3346
     $max_input_time = ini_get('max_input_time');
3347 3347
     $max_execution_time = ini_get('max_execution_time');
3348
-    $memory_limit= ini_get('memory_limit');
3348
+    $memory_limit = ini_get('memory_limit');
3349 3349
 
3350
-    if(!$max_input_time || $max_input_time<3000){
3350
+    if (!$max_input_time || $max_input_time < 3000) {
3351 3351
         @ini_set('max_input_time', 3000);
3352 3352
     }
3353 3353
 
3354
-    if(!$max_execution_time || $max_execution_time<3000){
3354
+    if (!$max_execution_time || $max_execution_time < 3000) {
3355 3355
         @ini_set('max_execution_time', 3000);
3356 3356
     }
3357 3357
 
3358
-    if($memory_limit && str_replace('M','',$memory_limit)){
3359
-        if(str_replace('M','',$memory_limit)<256){
3358
+    if ($memory_limit && str_replace('M', '', $memory_limit)) {
3359
+        if (str_replace('M', '', $memory_limit) < 256) {
3360 3360
             @ini_set('memory_limit', '256M');
3361 3361
         }
3362 3362
     }
3363 3363
 
3364 3364
     $json = array();
3365 3365
 
3366
-    if ( !current_user_can( 'manage_options' ) ) {
3367
-        wp_send_json( $json );
3366
+    if (!current_user_can('manage_options')) {
3367
+        wp_send_json($json);
3368 3368
     }
3369 3369
 
3370
-    $task = isset( $_REQUEST['task'] ) ? $_REQUEST['task'] : NULL;
3371
-    $nonce = isset( $_REQUEST['_nonce'] ) ? $_REQUEST['_nonce'] : NULL;
3372
-    $stat = isset( $_REQUEST['_st'] ) ? $_REQUEST['_st'] : false;
3370
+    $task = isset($_REQUEST['task']) ? $_REQUEST['task'] : NULL;
3371
+    $nonce = isset($_REQUEST['_nonce']) ? $_REQUEST['_nonce'] : NULL;
3372
+    $stat = isset($_REQUEST['_st']) ? $_REQUEST['_st'] : false;
3373 3373
 
3374
-    if ( !wp_verify_nonce( $nonce, 'geodir_import_export_nonce' ) ) {
3375
-        wp_send_json( $json );
3374
+    if (!wp_verify_nonce($nonce, 'geodir_import_export_nonce')) {
3375
+        wp_send_json($json);
3376 3376
     }
3377 3377
 
3378
-    $post_type = isset( $_REQUEST['_pt'] ) ? $_REQUEST['_pt'] : NULL;
3379
-    $chunk_per_page = isset( $_REQUEST['_n'] ) ? absint($_REQUEST['_n']) : NULL;
3378
+    $post_type = isset($_REQUEST['_pt']) ? $_REQUEST['_pt'] : NULL;
3379
+    $chunk_per_page = isset($_REQUEST['_n']) ? absint($_REQUEST['_n']) : NULL;
3380 3380
     $chunk_per_page = $chunk_per_page < 50 || $chunk_per_page > 100000 ? 5000 : $chunk_per_page;
3381
-    $chunk_page_no = isset( $_REQUEST['_p'] ) ? absint($_REQUEST['_p']) : 1;
3381
+    $chunk_page_no = isset($_REQUEST['_p']) ? absint($_REQUEST['_p']) : 1;
3382 3382
 
3383 3383
     $wp_filesystem = geodir_init_filesystem();
3384 3384
     if (!$wp_filesystem) {
3385
-        $json['error'] = __( 'Filesystem ERROR: Could not access filesystem.', 'geodirectory' );
3386
-        wp_send_json( $json );
3385
+        $json['error'] = __('Filesystem ERROR: Could not access filesystem.', 'geodirectory');
3386
+        wp_send_json($json);
3387 3387
     }
3388 3388
 
3389 3389
     if (!empty($wp_filesystem) && isset($wp_filesystem->errors) && is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
3390
-        $json['error'] = __( 'Filesystem ERROR: ' . $wp_filesystem->errors->get_error_message(), 'geodirectory' );
3391
-        wp_send_json( $json );
3390
+        $json['error'] = __('Filesystem ERROR: '.$wp_filesystem->errors->get_error_message(), 'geodirectory');
3391
+        wp_send_json($json);
3392 3392
     }
3393 3393
 
3394
-    $csv_file_dir = geodir_path_import_export( false );
3395
-    if ( !$wp_filesystem->is_dir( $csv_file_dir ) ) {
3396
-        if ( !$wp_filesystem->mkdir( $csv_file_dir, FS_CHMOD_DIR ) ) {
3397
-            $json['error'] = __( 'ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory' );
3398
-            wp_send_json( $json );
3394
+    $csv_file_dir = geodir_path_import_export(false);
3395
+    if (!$wp_filesystem->is_dir($csv_file_dir)) {
3396
+        if (!$wp_filesystem->mkdir($csv_file_dir, FS_CHMOD_DIR)) {
3397
+            $json['error'] = __('ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory');
3398
+            wp_send_json($json);
3399 3399
         }
3400 3400
     }
3401 3401
     
3402 3402
     $location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
3403 3403
     $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
3404 3404
 
3405
-    switch ( $task ) {
3405
+    switch ($task) {
3406 3406
         case 'export_posts': {
3407 3407
             // WPML
3408 3408
             $is_wpml = geodir_is_wpml();
@@ -3413,36 +3413,36 @@  discard block
 block discarded – undo
3413 3413
                 $sitepress->switch_lang('all', true);
3414 3414
             }
3415 3415
             // WPML
3416
-            if ( $post_type == 'gd_event' ) {
3417
-                add_filter( 'geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2 );
3416
+            if ($post_type == 'gd_event') {
3417
+                add_filter('geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2);
3418 3418
             }
3419
-            $filters = !empty( $_REQUEST['gd_imex'] ) && is_array( $_REQUEST['gd_imex'] ) ? $_REQUEST['gd_imex'] : NULL;
3419
+            $filters = !empty($_REQUEST['gd_imex']) && is_array($_REQUEST['gd_imex']) ? $_REQUEST['gd_imex'] : NULL;
3420 3420
             
3421
-            $file_name = $post_type . '_' . date( 'dmyHi' );
3422
-            if ( $filters && isset( $filters['start_date'] ) && isset( $filters['end_date'] ) ) {
3423
-                $file_name = $post_type . '_' . date_i18n( 'dmy', strtotime( $filters['start_date'] ) ) . '_' . date_i18n( 'dmy', strtotime( $filters['end_date'] ) );
3421
+            $file_name = $post_type.'_'.date('dmyHi');
3422
+            if ($filters && isset($filters['start_date']) && isset($filters['end_date'])) {
3423
+                $file_name = $post_type.'_'.date_i18n('dmy', strtotime($filters['start_date'])).'_'.date_i18n('dmy', strtotime($filters['end_date']));
3424 3424
             }
3425
-            $posts_count = geodir_get_posts_count( $post_type );
3426
-            $file_url_base = geodir_path_import_export() . '/';
3427
-            $file_url = $file_url_base . $file_name . '.csv';
3428
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3429
-            $file_path_temp = $csv_file_dir . '/' . $post_type . '_' . $nonce . '.csv';
3425
+            $posts_count = geodir_get_posts_count($post_type);
3426
+            $file_url_base = geodir_path_import_export().'/';
3427
+            $file_url = $file_url_base.$file_name.'.csv';
3428
+            $file_path = $csv_file_dir.'/'.$file_name.'.csv';
3429
+            $file_path_temp = $csv_file_dir.'/'.$post_type.'_'.$nonce.'.csv';
3430 3430
             
3431 3431
             $chunk_file_paths = array();
3432 3432
 
3433
-            if ( isset( $_REQUEST['_c'] ) ) {
3433
+            if (isset($_REQUEST['_c'])) {
3434 3434
                 $json['total'] = $posts_count;
3435 3435
                 // WPML
3436 3436
                 if ($is_wpml) {
3437 3437
                     $sitepress->switch_lang($active_lang, true);
3438 3438
                 }
3439 3439
                 // WPML
3440
-                wp_send_json( $json );
3440
+                wp_send_json($json);
3441 3441
                 gd_die();
3442
-            } else if ( isset( $_REQUEST['_st'] ) ) {
3443
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3444
-                $percentage = count( $posts_count ) > 0 && $line_count > 0 ? ceil( $line_count / $posts_count ) * 100 : 0;
3445
-                $percentage = min( $percentage, 100 );
3442
+            } else if (isset($_REQUEST['_st'])) {
3443
+                $line_count = (int) geodir_import_export_line_count($file_path_temp);
3444
+                $percentage = count($posts_count) > 0 && $line_count > 0 ? ceil($line_count / $posts_count) * 100 : 0;
3445
+                $percentage = min($percentage, 100);
3446 3446
                 
3447 3447
                 $json['percentage'] = $percentage;
3448 3448
                 // WPML
@@ -3450,45 +3450,45 @@  discard block
 block discarded – undo
3450 3450
                     $sitepress->switch_lang($active_lang, true);
3451 3451
                 }
3452 3452
                 // WPML
3453
-                wp_send_json( $json );
3453
+                wp_send_json($json);
3454 3454
                 gd_die();
3455 3455
             } else {
3456
-                if ( !$posts_count > 0 ) {
3457
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3456
+                if (!$posts_count > 0) {
3457
+                    $json['error'] = __('No records to export.', 'geodirectory');
3458 3458
                 } else {
3459 3459
                     $total_posts = $posts_count;
3460 3460
                     if ($chunk_per_page > $total_posts) {
3461 3461
                         $chunk_per_page = $total_posts;
3462 3462
                     }
3463
-                    $chunk_total_pages = ceil( $total_posts / $chunk_per_page );
3463
+                    $chunk_total_pages = ceil($total_posts / $chunk_per_page);
3464 3464
                     
3465 3465
                     $j = $chunk_page_no;
3466
-                    $chunk_save_posts = geodir_imex_get_posts( $post_type, $chunk_per_page, $j );
3466
+                    $chunk_save_posts = geodir_imex_get_posts($post_type, $chunk_per_page, $j);
3467 3467
                     
3468 3468
                     $per_page = 500;
3469 3469
                     if ($per_page > $chunk_per_page) {
3470 3470
                         $per_page = $chunk_per_page;
3471 3471
                     }
3472
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3472
+                    $total_pages = ceil($chunk_per_page / $per_page);
3473 3473
                     
3474
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3475
-                        $save_posts = array_slice( $chunk_save_posts , ( $i * $per_page ), $per_page );
3474
+                    for ($i = 0; $i <= $total_pages; $i++) {
3475
+                        $save_posts = array_slice($chunk_save_posts, ($i * $per_page), $per_page);
3476 3476
                         
3477 3477
                         $clear = $i == 0 ? true : false;
3478
-                        geodir_save_csv_data( $file_path_temp, $save_posts, $clear );
3478
+                        geodir_save_csv_data($file_path_temp, $save_posts, $clear);
3479 3479
                     }
3480 3480
                         
3481
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3482
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3483
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3484
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3485
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3481
+                    if ($wp_filesystem->exists($file_path_temp)) {
3482
+                        $chunk_page_no = $chunk_total_pages > 1 ? '-'.$j : '';
3483
+                        $chunk_file_name = $file_name.$chunk_page_no.'.csv';
3484
+                        $file_path = $csv_file_dir.'/'.$chunk_file_name;
3485
+                        $wp_filesystem->move($file_path_temp, $file_path, true);
3486 3486
                         
3487
-                        $file_url = $file_url_base . $chunk_file_name;
3488
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3487
+                        $file_url = $file_url_base.$chunk_file_name;
3488
+                        $chunk_file_paths[] = array('i' => $j.'.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3489 3489
                     }
3490 3490
                     
3491
-                    if ( !empty($chunk_file_paths) ) {
3491
+                    if (!empty($chunk_file_paths)) {
3492 3492
                         $json['total'] = $posts_count;
3493 3493
                         $json['files'] = $chunk_file_paths;
3494 3494
                     } else {
@@ -3496,7 +3496,7 @@  discard block
 block discarded – undo
3496 3496
                             $json['total'] = $posts_count;
3497 3497
                             $json['files'] = array();
3498 3498
                         } else {
3499
-                            $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3499
+                            $json['error'] = __('ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory');
3500 3500
                         }
3501 3501
                     }
3502 3502
                 }
@@ -3505,7 +3505,7 @@  discard block
 block discarded – undo
3505 3505
                     $sitepress->switch_lang($active_lang, true);
3506 3506
                 }
3507 3507
                 // WPML
3508
-                wp_send_json( $json );
3508
+                wp_send_json($json);
3509 3509
             }
3510 3510
         }
3511 3511
         break;
@@ -3519,20 +3519,20 @@  discard block
 block discarded – undo
3519 3519
                 $sitepress->switch_lang('all', true);
3520 3520
             }
3521 3521
             // WPML
3522
-            $file_name = $post_type . 'category_' . date( 'dmyHi' );
3522
+            $file_name = $post_type.'category_'.date('dmyHi');
3523 3523
             
3524
-            $terms_count = geodir_get_terms_count( $post_type );
3525
-            $file_url_base = geodir_path_import_export() . '/';
3526
-            $file_url = $file_url_base . $file_name . '.csv';
3527
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3528
-            $file_path_temp = $csv_file_dir . '/' . $post_type . 'category_' . $nonce . '.csv';
3524
+            $terms_count = geodir_get_terms_count($post_type);
3525
+            $file_url_base = geodir_path_import_export().'/';
3526
+            $file_url = $file_url_base.$file_name.'.csv';
3527
+            $file_path = $csv_file_dir.'/'.$file_name.'.csv';
3528
+            $file_path_temp = $csv_file_dir.'/'.$post_type.'category_'.$nonce.'.csv';
3529 3529
             
3530 3530
             $chunk_file_paths = array();
3531 3531
             
3532
-            if ( isset( $_REQUEST['_st'] ) ) {
3533
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3534
-                $percentage = count( $terms_count ) > 0 && $line_count > 0 ? ceil( $line_count / $terms_count ) * 100 : 0;
3535
-                $percentage = min( $percentage, 100 );
3532
+            if (isset($_REQUEST['_st'])) {
3533
+                $line_count = (int) geodir_import_export_line_count($file_path_temp);
3534
+                $percentage = count($terms_count) > 0 && $line_count > 0 ? ceil($line_count / $terms_count) * 100 : 0;
3535
+                $percentage = min($percentage, 100);
3536 3536
                 
3537 3537
                 $json['percentage'] = $percentage;
3538 3538
                 // WPML
@@ -3540,48 +3540,48 @@  discard block
 block discarded – undo
3540 3540
                     $sitepress->switch_lang($active_lang, true);
3541 3541
                 }
3542 3542
                 // WPML
3543
-                wp_send_json( $json );
3543
+                wp_send_json($json);
3544 3544
             } else {
3545
-                if ( !$terms_count > 0 ) {
3546
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3545
+                if (!$terms_count > 0) {
3546
+                    $json['error'] = __('No records to export.', 'geodirectory');
3547 3547
                 } else {
3548 3548
                     $total_terms = $terms_count;
3549 3549
                     if ($chunk_per_page > $terms_count) {
3550 3550
                         $chunk_per_page = $terms_count;
3551 3551
                     }
3552
-                    $chunk_total_pages = ceil( $total_terms / $chunk_per_page );
3552
+                    $chunk_total_pages = ceil($total_terms / $chunk_per_page);
3553 3553
                     
3554 3554
                     $j = $chunk_page_no;
3555
-                    $chunk_save_terms = geodir_imex_get_terms( $post_type, $chunk_per_page, $j );
3555
+                    $chunk_save_terms = geodir_imex_get_terms($post_type, $chunk_per_page, $j);
3556 3556
                     
3557 3557
                     $per_page = 500;
3558 3558
                     if ($per_page > $chunk_per_page) {
3559 3559
                         $per_page = $chunk_per_page;
3560 3560
                     }
3561
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3561
+                    $total_pages = ceil($chunk_per_page / $per_page);
3562 3562
                     
3563
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3564
-                        $save_terms = array_slice( $chunk_save_terms , ( $i * $per_page ), $per_page );
3563
+                    for ($i = 0; $i <= $total_pages; $i++) {
3564
+                        $save_terms = array_slice($chunk_save_terms, ($i * $per_page), $per_page);
3565 3565
                         
3566 3566
                         $clear = $i == 0 ? true : false;
3567
-                        geodir_save_csv_data( $file_path_temp, $save_terms, $clear );
3567
+                        geodir_save_csv_data($file_path_temp, $save_terms, $clear);
3568 3568
                     }
3569 3569
                     
3570
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3571
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3572
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3573
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3574
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3570
+                    if ($wp_filesystem->exists($file_path_temp)) {
3571
+                        $chunk_page_no = $chunk_total_pages > 1 ? '-'.$j : '';
3572
+                        $chunk_file_name = $file_name.$chunk_page_no.'.csv';
3573
+                        $file_path = $csv_file_dir.'/'.$chunk_file_name;
3574
+                        $wp_filesystem->move($file_path_temp, $file_path, true);
3575 3575
                         
3576
-                        $file_url = $file_url_base . $chunk_file_name;
3577
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3576
+                        $file_url = $file_url_base.$chunk_file_name;
3577
+                        $chunk_file_paths[] = array('i' => $j.'.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3578 3578
                     }
3579 3579
                     
3580
-                    if ( !empty($chunk_file_paths) ) {
3580
+                    if (!empty($chunk_file_paths)) {
3581 3581
                         $json['total'] = $terms_count;
3582 3582
                         $json['files'] = $chunk_file_paths;
3583 3583
                     } else {
3584
-                        $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3584
+                        $json['error'] = __('ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory');
3585 3585
                     }
3586 3586
                 }
3587 3587
                 // WPML
@@ -3589,127 +3589,127 @@  discard block
 block discarded – undo
3589 3589
                     $sitepress->switch_lang($active_lang, true);
3590 3590
                 }
3591 3591
                 // WPML
3592
-                wp_send_json( $json );
3592
+                wp_send_json($json);
3593 3593
             }
3594 3594
         }
3595 3595
         break;
3596 3596
         case 'export_locations': {
3597
-            $file_url_base = geodir_path_import_export() . '/';
3598
-            $file_name = 'gd_locations_' . date( 'dmyHi' );
3599
-            $file_url = $file_url_base . $file_name . '.csv';
3600
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3601
-            $file_path_temp = $csv_file_dir . '/gd_locations_' . $nonce . '.csv';
3597
+            $file_url_base = geodir_path_import_export().'/';
3598
+            $file_name = 'gd_locations_'.date('dmyHi');
3599
+            $file_url = $file_url_base.$file_name.'.csv';
3600
+            $file_path = $csv_file_dir.'/'.$file_name.'.csv';
3601
+            $file_path_temp = $csv_file_dir.'/gd_locations_'.$nonce.'.csv';
3602 3602
             
3603
-            $items_count = (int)geodir_location_imex_count_locations();
3603
+            $items_count = (int) geodir_location_imex_count_locations();
3604 3604
             
3605
-            if ( isset( $_REQUEST['_st'] ) ) {
3606
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3607
-                $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3608
-                $percentage = min( $percentage, 100 );
3605
+            if (isset($_REQUEST['_st'])) {
3606
+                $line_count = (int) geodir_import_export_line_count($file_path_temp);
3607
+                $percentage = count($items_count) > 0 && $line_count > 0 ? ceil($line_count / $items_count) * 100 : 0;
3608
+                $percentage = min($percentage, 100);
3609 3609
                 
3610 3610
                 $json['percentage'] = $percentage;
3611
-                wp_send_json( $json );
3611
+                wp_send_json($json);
3612 3612
             } else {
3613 3613
                 $chunk_file_paths = array();
3614 3614
                 
3615
-                if ( !$items_count > 0 ) {
3616
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3615
+                if (!$items_count > 0) {
3616
+                    $json['error'] = __('No records to export.', 'geodirectory');
3617 3617
                 } else {
3618
-                    $chunk_per_page = min( $chunk_per_page, $items_count );
3619
-                    $chunk_total_pages = ceil( $items_count / $chunk_per_page );
3618
+                    $chunk_per_page = min($chunk_per_page, $items_count);
3619
+                    $chunk_total_pages = ceil($items_count / $chunk_per_page);
3620 3620
                     
3621 3621
                     $j = $chunk_page_no;
3622
-                    $chunk_save_items = geodir_location_imex_locations_data( $chunk_per_page, $j );
3622
+                    $chunk_save_items = geodir_location_imex_locations_data($chunk_per_page, $j);
3623 3623
                     
3624 3624
                     $per_page = 500;
3625
-                    $per_page = min( $per_page, $chunk_per_page );
3626
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3625
+                    $per_page = min($per_page, $chunk_per_page);
3626
+                    $total_pages = ceil($chunk_per_page / $per_page);
3627 3627
                     
3628
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3629
-                        $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3628
+                    for ($i = 0; $i <= $total_pages; $i++) {
3629
+                        $save_items = array_slice($chunk_save_items, ($i * $per_page), $per_page);
3630 3630
                         
3631 3631
                         $clear = $i == 0 ? true : false;
3632
-                        geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3632
+                        geodir_save_csv_data($file_path_temp, $save_items, $clear);
3633 3633
                     }
3634 3634
                     
3635
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3636
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3637
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3638
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3639
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3635
+                    if ($wp_filesystem->exists($file_path_temp)) {
3636
+                        $chunk_page_no = $chunk_total_pages > 1 ? '-'.$j : '';
3637
+                        $chunk_file_name = $file_name.$chunk_page_no.'.csv';
3638
+                        $file_path = $csv_file_dir.'/'.$chunk_file_name;
3639
+                        $wp_filesystem->move($file_path_temp, $file_path, true);
3640 3640
                         
3641
-                        $file_url = $file_url_base . $chunk_file_name;
3642
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3641
+                        $file_url = $file_url_base.$chunk_file_name;
3642
+                        $chunk_file_paths[] = array('i' => $j.'.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3643 3643
                     }
3644 3644
                     
3645
-                    if ( !empty($chunk_file_paths) ) {
3645
+                    if (!empty($chunk_file_paths)) {
3646 3646
                         $json['total'] = $items_count;
3647 3647
                         $json['files'] = $chunk_file_paths;
3648 3648
                     } else {
3649
-                        $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3649
+                        $json['error'] = __('Fail, something wrong to create csv file.', 'geodirectory');
3650 3650
                     }
3651 3651
                 }
3652
-                wp_send_json( $json );
3652
+                wp_send_json($json);
3653 3653
             }
3654 3654
         }
3655 3655
         break;
3656 3656
         case 'export_hoods': {
3657
-            $file_url_base = geodir_path_import_export() . '/';
3658
-            $file_name = 'gd_neighbourhoods_' . date( 'dmyHi' );
3659
-            $file_url = $file_url_base . $file_name . '.csv';
3660
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3661
-            $file_path_temp = $csv_file_dir . '/gd_neighbourhoods_' . $nonce . '.csv';
3657
+            $file_url_base = geodir_path_import_export().'/';
3658
+            $file_name = 'gd_neighbourhoods_'.date('dmyHi');
3659
+            $file_url = $file_url_base.$file_name.'.csv';
3660
+            $file_path = $csv_file_dir.'/'.$file_name.'.csv';
3661
+            $file_path_temp = $csv_file_dir.'/gd_neighbourhoods_'.$nonce.'.csv';
3662 3662
             
3663
-            $items_count = (int)geodir_location_imex_count_neighbourhoods();
3663
+            $items_count = (int) geodir_location_imex_count_neighbourhoods();
3664 3664
             
3665
-            if ( isset( $_REQUEST['_st'] ) ) {
3666
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3667
-                $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3668
-                $percentage = min( $percentage, 100 );
3665
+            if (isset($_REQUEST['_st'])) {
3666
+                $line_count = (int) geodir_import_export_line_count($file_path_temp);
3667
+                $percentage = count($items_count) > 0 && $line_count > 0 ? ceil($line_count / $items_count) * 100 : 0;
3668
+                $percentage = min($percentage, 100);
3669 3669
                 
3670 3670
                 $json['percentage'] = $percentage;
3671
-                wp_send_json( $json );
3671
+                wp_send_json($json);
3672 3672
             } else {
3673 3673
                 $chunk_file_paths = array();
3674 3674
                 
3675
-                if ( !$items_count > 0 ) {
3676
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3675
+                if (!$items_count > 0) {
3676
+                    $json['error'] = __('No records to export.', 'geodirectory');
3677 3677
                 } else {
3678
-                    $chunk_per_page = min( $chunk_per_page, $items_count );
3679
-                    $chunk_total_pages = ceil( $items_count / $chunk_per_page );
3678
+                    $chunk_per_page = min($chunk_per_page, $items_count);
3679
+                    $chunk_total_pages = ceil($items_count / $chunk_per_page);
3680 3680
                     
3681 3681
                     $j = $chunk_page_no;
3682
-                    $chunk_save_items = geodir_location_imex_neighbourhoods_data( $chunk_per_page, $j );
3682
+                    $chunk_save_items = geodir_location_imex_neighbourhoods_data($chunk_per_page, $j);
3683 3683
                     
3684 3684
                     $per_page = 500;
3685
-                    $per_page = min( $per_page, $chunk_per_page );
3686
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3685
+                    $per_page = min($per_page, $chunk_per_page);
3686
+                    $total_pages = ceil($chunk_per_page / $per_page);
3687 3687
                     
3688
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3689
-                        $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3688
+                    for ($i = 0; $i <= $total_pages; $i++) {
3689
+                        $save_items = array_slice($chunk_save_items, ($i * $per_page), $per_page);
3690 3690
                         
3691 3691
                         $clear = $i == 0 ? true : false;
3692
-                        geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3692
+                        geodir_save_csv_data($file_path_temp, $save_items, $clear);
3693 3693
                     }
3694 3694
                     
3695
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3696
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3697
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3698
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3699
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3695
+                    if ($wp_filesystem->exists($file_path_temp)) {
3696
+                        $chunk_page_no = $chunk_total_pages > 1 ? '-'.$j : '';
3697
+                        $chunk_file_name = $file_name.$chunk_page_no.'.csv';
3698
+                        $file_path = $csv_file_dir.'/'.$chunk_file_name;
3699
+                        $wp_filesystem->move($file_path_temp, $file_path, true);
3700 3700
                         
3701
-                        $file_url = $file_url_base . $chunk_file_name;
3702
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3701
+                        $file_url = $file_url_base.$chunk_file_name;
3702
+                        $chunk_file_paths[] = array('i' => $j.'.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3703 3703
                     }
3704 3704
                     
3705
-                    if ( !empty($chunk_file_paths) ) {
3705
+                    if (!empty($chunk_file_paths)) {
3706 3706
                         $json['total'] = $items_count;
3707 3707
                         $json['files'] = $chunk_file_paths;
3708 3708
                     } else {
3709
-                        $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3709
+                        $json['error'] = __('Fail, something wrong to create csv file.', 'geodirectory');
3710 3710
                     }
3711 3711
                 }
3712
-                wp_send_json( $json );
3712
+                wp_send_json($json);
3713 3713
             }
3714 3714
         }
3715 3715
         break;
@@ -3726,34 +3726,34 @@  discard block
 block discarded – undo
3726 3726
             }
3727 3727
             // WPML
3728 3728
             
3729
-            @ini_set( 'auto_detect_line_endings', true );
3729
+            @ini_set('auto_detect_line_endings', true);
3730 3730
             
3731 3731
             $uploads = wp_upload_dir();
3732 3732
             $uploads_dir = $uploads['path'];
3733 3733
             $uploads_subdir = $uploads['subdir'];
3734 3734
             
3735
-            $csv_file = isset( $_POST['_file'] ) ? $_POST['_file'] : NULL;
3736
-            $import_choice = isset( $_REQUEST['_ch'] ) ? $_REQUEST['_ch'] : 'skip';
3735
+            $csv_file = isset($_POST['_file']) ? $_POST['_file'] : NULL;
3736
+            $import_choice = isset($_REQUEST['_ch']) ? $_REQUEST['_ch'] : 'skip';
3737 3737
             
3738
-            $csv_file_arr = explode( '/', $csv_file );
3739
-            $csv_filename = end( $csv_file_arr );
3740
-            $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $csv_filename;
3738
+            $csv_file_arr = explode('/', $csv_file);
3739
+            $csv_filename = end($csv_file_arr);
3740
+            $target_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$csv_filename;
3741 3741
             
3742 3742
             $json['file'] = $csv_file;
3743
-            $json['error'] = __( 'The uploaded file is not a valid csv file. Please try again.', 'geodirectory' );
3743
+            $json['error'] = __('The uploaded file is not a valid csv file. Please try again.', 'geodirectory');
3744 3744
             $file = array();
3745 3745
 
3746
-            if ( $csv_file && $wp_filesystem->is_file( $target_path ) && $wp_filesystem->exists( $target_path ) ) {
3747
-                $wp_filetype = wp_check_filetype_and_ext( $target_path, $csv_filename );
3746
+            if ($csv_file && $wp_filesystem->is_file($target_path) && $wp_filesystem->exists($target_path)) {
3747
+                $wp_filetype = wp_check_filetype_and_ext($target_path, $csv_filename);
3748 3748
 
3749 3749
                 if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
3750 3750
                     $json['error'] = NULL;
3751 3751
 
3752 3752
                     $lc_all = setlocale(LC_ALL, 0); // Fix issue of fgetcsv ignores special characters when they are at the beginning of line
3753 3753
                     setlocale(LC_ALL, 'en_US.UTF-8');
3754
-                    if ( ( $handle = fopen($target_path, "r" ) ) !== FALSE ) {
3755
-                        while ( ( $data = fgetcsv( $handle, 100000, "," ) ) !== FALSE ) {
3756
-                            if ( !empty( $data ) ) {
3754
+                    if (($handle = fopen($target_path, "r")) !== FALSE) {
3755
+                        while (($data = fgetcsv($handle, 100000, ",")) !== FALSE) {
3756
+                            if (!empty($data)) {
3757 3757
                                 $file[] = $data;
3758 3758
                             }
3759 3759
                         }
@@ -3767,19 +3767,19 @@  discard block
 block discarded – undo
3767 3767
                         $json['error'] = __('No data found in csv file.', 'geodirectory');
3768 3768
                     }
3769 3769
                 } else {
3770
-                    wp_send_json( $json );
3770
+                    wp_send_json($json);
3771 3771
                 }
3772 3772
             } else {
3773
-                wp_send_json( $json );
3773
+                wp_send_json($json);
3774 3774
             }
3775 3775
             
3776
-            if ( $task == 'prepare_import' || !empty( $json['error'] ) ) {
3777
-                wp_send_json( $json );
3776
+            if ($task == 'prepare_import' || !empty($json['error'])) {
3777
+                wp_send_json($json);
3778 3778
             }
3779 3779
             
3780 3780
             $total = $json['rows'];
3781
-            $limit = isset($_POST['limit']) ? (int)$_POST['limit'] : 1;
3782
-            $processed = isset($_POST['processed']) ? (int)$_POST['processed'] : 0;
3781
+            $limit = isset($_POST['limit']) ? (int) $_POST['limit'] : 1;
3782
+            $processed = isset($_POST['processed']) ? (int) $_POST['processed'] : 0;
3783 3783
             
3784 3784
             $count = $limit;
3785 3785
             
@@ -3804,13 +3804,13 @@  discard block
 block discarded – undo
3804 3804
             
3805 3805
             $post_types = geodir_get_posttypes();
3806 3806
 
3807
-            if ( $task == 'import_cat' ) {
3807
+            if ($task == 'import_cat') {
3808 3808
                 if (!empty($file)) {
3809 3809
                     $columns = isset($file[0]) ? $file[0] : NULL;
3810 3810
                     
3811 3811
                     if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
3812 3812
                         $json['error'] = CSV_INVAILD_FILE;
3813
-                        wp_send_json( $json );
3813
+                        wp_send_json($json);
3814 3814
                         exit;
3815 3815
                     }
3816 3816
                     
@@ -3821,7 +3821,7 @@  discard block
 block discarded – undo
3821 3821
                         
3822 3822
                         if (isset($file[$index])) {
3823 3823
                             $row = $file[$index];
3824
-                            $row = array_map( 'trim', $row );
3824
+                            $row = array_map('trim', $row);
3825 3825
                             //$row = array_map( 'utf8_encode', $row );
3826 3826
                             
3827 3827
                             $cat_id = '';
@@ -3838,42 +3838,42 @@  discard block
 block discarded – undo
3838 3838
                             $cat_id_original = '';
3839 3839
                             
3840 3840
                             $c = 0;
3841
-                            foreach ($columns as $column ) {
3842
-                                if ( $column == 'cat_id' ) {
3843
-                                    $cat_id = (int)$row[$c];
3844
-                                } else if ( $column == 'cat_name' ) {
3841
+                            foreach ($columns as $column) {
3842
+                                if ($column == 'cat_id') {
3843
+                                    $cat_id = (int) $row[$c];
3844
+                                } else if ($column == 'cat_name') {
3845 3845
                                     $cat_name = $row[$c];
3846
-                                } else if ( $column == 'cat_slug' ) {
3846
+                                } else if ($column == 'cat_slug') {
3847 3847
                                     $cat_slug = $row[$c];
3848
-                                } else if ( $column == 'cat_posttype' ) {
3848
+                                } else if ($column == 'cat_posttype') {
3849 3849
                                     $cat_posttype = $row[$c];
3850
-                                } else if ( $column == 'cat_parent' ) {
3850
+                                } else if ($column == 'cat_parent') {
3851 3851
                                     $cat_parent = trim($row[$c]);
3852
-                                } else if ( $column == 'cat_schema' && $row[$c] != '' ) {
3852
+                                } else if ($column == 'cat_schema' && $row[$c] != '') {
3853 3853
                                     $cat_schema = $row[$c];
3854
-                                } else if ( $column == 'cat_description' ) {
3854
+                                } else if ($column == 'cat_description') {
3855 3855
                                     $cat_description = $row[$c];
3856
-                                } else if ( $column == 'cat_top_description' ) {
3856
+                                } else if ($column == 'cat_top_description') {
3857 3857
                                     $cat_top_description = $row[$c];
3858
-                                } else if ( $column == 'cat_image' ) {
3858
+                                } else if ($column == 'cat_image') {
3859 3859
                                     $cat_image = $row[$c];
3860
-                                } else if ( $column == 'cat_icon' ) {
3860
+                                } else if ($column == 'cat_icon') {
3861 3861
                                     $cat_icon = $row[$c];
3862 3862
                                 }
3863 3863
                                 // WPML
3864
-                                if ( $is_wpml ) {
3865
-                                    if ( $column == 'cat_language' ) {
3866
-                                        $cat_language = geodir_strtolower( trim( $row[$c] ) );
3867
-                                    } else if ( $column == 'cat_id_original' ) {
3868
-                                        $cat_id_original = (int)$row[$c];
3864
+                                if ($is_wpml) {
3865
+                                    if ($column == 'cat_language') {
3866
+                                        $cat_language = geodir_strtolower(trim($row[$c]));
3867
+                                    } else if ($column == 'cat_id_original') {
3868
+                                        $cat_id_original = (int) $row[$c];
3869 3869
                                     }
3870 3870
                                 }
3871 3871
                                 // WPML
3872 3872
                                 $c++;
3873 3873
                             }
3874 3874
                             
3875
-                            if ( $cat_name == '' || !in_array( $cat_posttype, $post_types ) ) {
3876
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) );
3875
+                            if ($cat_name == '' || !in_array($cat_posttype, $post_types)) {
3876
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be added due to blank title/invalid post type', 'geodirectory'));
3877 3877
                                 
3878 3878
                                 $invalid++;
3879 3879
                                 continue;
@@ -3891,24 +3891,24 @@  discard block
 block discarded – undo
3891 3891
                             $term_data['description'] = $cat_description;
3892 3892
                             $term_data['cat_schema'] = $cat_schema;
3893 3893
                             $term_data['top_description'] = $cat_top_description;
3894
-                            $term_data['image'] = $cat_image != '' ? basename( $cat_image ) : '';
3895
-                            $term_data['icon'] = $cat_icon != '' ? basename( $cat_icon ) : '';
3894
+                            $term_data['image'] = $cat_image != '' ? basename($cat_image) : '';
3895
+                            $term_data['icon'] = $cat_icon != '' ? basename($cat_icon) : '';
3896 3896
                             
3897 3897
                             //$term_data = array_map( 'utf8_encode', $term_data );
3898 3898
                             
3899
-                            $taxonomy = $cat_posttype . 'category';
3899
+                            $taxonomy = $cat_posttype.'category';
3900 3900
                             
3901 3901
                             $term_data['taxonomy'] = $taxonomy;
3902 3902
 
3903 3903
                             $term_parent_id = 0;
3904
-                            if ($cat_parent != "" || (int)$cat_parent > 0) {
3904
+                            if ($cat_parent != "" || (int) $cat_parent > 0) {
3905 3905
                                 $term_parent = '';
3906 3906
                                 
3907
-                                if ( $term_parent = get_term_by( 'name', $cat_parent, $taxonomy ) ) {
3907
+                                if ($term_parent = get_term_by('name', $cat_parent, $taxonomy)) {
3908 3908
                                     //
3909
-                                } else if ( $term_parent = get_term_by( 'slug', $cat_parent, $taxonomy ) ) {
3909
+                                } else if ($term_parent = get_term_by('slug', $cat_parent, $taxonomy)) {
3910 3910
                                     //
3911
-                                } else if ( $term_parent = get_term_by( 'id', $cat_parent, $taxonomy ) ) {
3911
+                                } else if ($term_parent = get_term_by('id', $cat_parent, $taxonomy)) {
3912 3912
                                     //
3913 3913
                                 } else {
3914 3914
                                     $term_parent_data = array();
@@ -3916,104 +3916,104 @@  discard block
 block discarded – undo
3916 3916
                                     //$term_parent_data = array_map( 'utf8_encode', $term_parent_data );
3917 3917
                                     $term_parent_data['taxonomy'] = $taxonomy;
3918 3918
                                     
3919
-                                    $term_parent_id = (int)geodir_imex_insert_term( $taxonomy, $term_parent_data );
3919
+                                    $term_parent_id = (int) geodir_imex_insert_term($taxonomy, $term_parent_data);
3920 3920
                                 }
3921 3921
                                 
3922
-                                if ( !empty( $term_parent ) && !is_wp_error( $term_parent ) ) {
3923
-                                    $term_parent_id = (int)$term_parent->term_id;
3922
+                                if (!empty($term_parent) && !is_wp_error($term_parent)) {
3923
+                                    $term_parent_id = (int) $term_parent->term_id;
3924 3924
                                 }
3925 3925
                             }
3926
-                            $term_data['parent'] = (int)$term_parent_id;
3926
+                            $term_data['parent'] = (int) $term_parent_id;
3927 3927
 
3928 3928
                             $term_id = NULL;
3929
-                            if ( $import_choice == 'update' ) {
3930
-                                if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
3929
+                            if ($import_choice == 'update') {
3930
+                                if ($cat_id > 0 && $term = (array) term_exists($cat_id, $taxonomy)) {
3931 3931
                                     $term_data['term_id'] = $term['term_id'];
3932 3932
                                     
3933
-                                    if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
3933
+                                    if ($term_id = geodir_imex_update_term($taxonomy, $term_data)) {
3934 3934
                                         $updated++;
3935 3935
                                     } else {
3936 3936
                                         $invalid++;
3937
-                                        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' ) );
3937
+                                        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'));
3938 3938
                                     }
3939
-                                } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
3939
+                                } else if ($term_data['slug'] != '' && $term = (array) term_exists($term_data['slug'], $taxonomy)) {
3940 3940
                                     $term_data['term_id'] = $term['term_id'];
3941 3941
                                     
3942
-                                    if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
3942
+                                    if ($term_id = geodir_imex_update_term($taxonomy, $term_data)) {
3943 3943
                                         $updated++;
3944 3944
                                     } else {
3945 3945
                                         $invalid++;
3946
-                                        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' ) );
3946
+                                        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'));
3947 3947
                                     }
3948 3948
                                 } else {
3949
-                                    if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
3949
+                                    if ($term_id = geodir_imex_insert_term($taxonomy, $term_data)) {
3950 3950
                                         $created++;
3951 3951
                                     } else {
3952 3952
                                         $invalid++;
3953
-                                        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' ) );
3953
+                                        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'));
3954 3954
                                     }
3955 3955
                                 }
3956
-                            } else if ( $import_choice == 'skip' ) {
3957
-                                if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
3956
+                            } else if ($import_choice == 'skip') {
3957
+                                if ($cat_id > 0 && $term = (array) term_exists($cat_id, $taxonomy)) {
3958 3958
                                     $skipped++;
3959
-                                } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
3959
+                                } else if ($term_data['slug'] != '' && $term = (array) term_exists($term_data['slug'], $taxonomy)) {
3960 3960
                                     $skipped++;
3961 3961
                                 } else {
3962
-                                    if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
3962
+                                    if ($term_id = geodir_imex_insert_term($taxonomy, $term_data)) {
3963 3963
                                         $created++;
3964 3964
                                     } else {
3965 3965
                                         $invalid++;
3966
-                                        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' ) );
3966
+                                        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'));
3967 3967
                                     }
3968 3968
                                 }
3969 3969
                             } else {
3970 3970
                                 $invalid++;
3971
-                                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' ) );
3971
+                                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'));
3972 3972
                             }
3973 3973
                             
3974
-                            if ( $term_id ) {
3974
+                            if ($term_id) {
3975 3975
                                 // WPML
3976 3976
                                 if ($is_wpml && geodir_wpml_is_taxonomy_translated($taxonomy) && $cat_id_original > 0 && $cat_language != '') {
3977
-                                    $wpml_element_type = 'tax_' . $taxonomy;
3978
-                                    $source_language = geodir_get_language_for_element( $cat_id_original, $wpml_element_type );
3977
+                                    $wpml_element_type = 'tax_'.$taxonomy;
3978
+                                    $source_language = geodir_get_language_for_element($cat_id_original, $wpml_element_type);
3979 3979
                                     $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
3980 3980
 
3981
-                                    $trid = $sitepress->get_element_trid( $cat_id_original, $wpml_element_type );
3981
+                                    $trid = $sitepress->get_element_trid($cat_id_original, $wpml_element_type);
3982 3982
                                     
3983
-                                    $sitepress->set_element_language_details( $term_id, $wpml_element_type, $trid, $cat_language, $source_language );
3983
+                                    $sitepress->set_element_language_details($term_id, $wpml_element_type, $trid, $cat_language, $source_language);
3984 3984
                                 }
3985 3985
                                 // WPML
3986 3986
                                 
3987
-                                if ( isset( $term_data['top_description'] ) ) {
3988
-                                    geodir_update_tax_meta( $term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype );
3987
+                                if (isset($term_data['top_description'])) {
3988
+                                    geodir_update_tax_meta($term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype);
3989 3989
                                 }
3990 3990
                                 
3991
-                                if ( isset( $term_data['cat_schema'] ) ) {
3992
-                                    geodir_update_tax_meta( $term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype );
3991
+                                if (isset($term_data['cat_schema'])) {
3992
+                                    geodir_update_tax_meta($term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype);
3993 3993
                                 }
3994 3994
             
3995 3995
                                 $attachment = false;
3996
-                                if ( isset( $term_data['image'] ) && $term_data['image'] != '' ) {
3997
-                                    $cat_image = geodir_get_default_catimage( $term_id, $cat_posttype );
3998
-                                    $cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : '';
3996
+                                if (isset($term_data['image']) && $term_data['image'] != '') {
3997
+                                    $cat_image = geodir_get_default_catimage($term_id, $cat_posttype);
3998
+                                    $cat_image = !empty($cat_image) && isset($cat_image['src']) ? $cat_image['src'] : '';
3999 3999
                                     
4000
-                                    if ( basename($cat_image) != $term_data['image'] ) {
4000
+                                    if (basename($cat_image) != $term_data['image']) {
4001 4001
                                         $attachment = true;
4002
-                                        geodir_update_tax_meta( $term_id, 'ct_cat_default_img', array( 'id' => 'image', 'src' => $uploads['url'] . '/' . $term_data['image'] ), $cat_posttype );
4002
+                                        geodir_update_tax_meta($term_id, 'ct_cat_default_img', array('id' => 'image', 'src' => $uploads['url'].'/'.$term_data['image']), $cat_posttype);
4003 4003
                                     }
4004 4004
                                 }
4005 4005
                                 
4006
-                                if ( isset( $term_data['icon'] ) && $term_data['icon'] != '' ) {
4007
-                                    $cat_icon = geodir_get_tax_meta( $term_id, 'ct_cat_icon', false, $cat_posttype );
4008
-                                    $cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : '';
4006
+                                if (isset($term_data['icon']) && $term_data['icon'] != '') {
4007
+                                    $cat_icon = geodir_get_tax_meta($term_id, 'ct_cat_icon', false, $cat_posttype);
4008
+                                    $cat_icon = !empty($cat_icon) && isset($cat_icon['src']) ? $cat_icon['src'] : '';
4009 4009
 
4010
-                                    if ( basename($cat_icon) != $term_data['icon'] ) {
4010
+                                    if (basename($cat_icon) != $term_data['icon']) {
4011 4011
                                         $attachment = true;
4012
-                                        geodir_update_tax_meta( $term_id, 'ct_cat_icon', array( 'id' => 'icon', 'src' => $uploads['url'] . '/' . $term_data['icon'] ), $cat_posttype );
4012
+                                        geodir_update_tax_meta($term_id, 'ct_cat_icon', array('id' => 'icon', 'src' => $uploads['url'].'/'.$term_data['icon']), $cat_posttype);
4013 4013
                                     }
4014 4014
                                 }
4015 4015
                                 
4016
-                                if ( $attachment ) {
4016
+                                if ($attachment) {
4017 4017
                                     $images++;
4018 4018
                                 }
4019 4019
                             }
@@ -4035,35 +4035,35 @@  discard block
 block discarded – undo
4035 4035
                 $json['invalid'] = $invalid;
4036 4036
                 $json['images'] = $images;
4037 4037
                 
4038
-                wp_send_json( $json );
4038
+                wp_send_json($json);
4039 4039
                 exit;
4040
-            } else if ( $task == 'import_post' ) {
4041
-                $xtimings['###1'] = microtime(true)-$xstart;
4040
+            } else if ($task == 'import_post') {
4041
+                $xtimings['###1'] = microtime(true) - $xstart;
4042 4042
                 //run some stuff to make the import quicker
4043
-                wp_defer_term_counting( true );
4044
-                wp_defer_comment_counting( true );
4045
-                $wpdb->query( 'SET autocommit = 0;' );
4043
+                wp_defer_term_counting(true);
4044
+                wp_defer_comment_counting(true);
4045
+                $wpdb->query('SET autocommit = 0;');
4046 4046
 //
4047 4047
 //                remove_all_actions('publish_post');
4048 4048
 //                remove_all_actions('transition_post_status');
4049 4049
 //                remove_all_actions('publish_future_post');
4050 4050
 
4051 4051
                 if (!empty($file)) {
4052
-                    $is_claim_active = is_plugin_active( 'geodir_claim_listing/geodir_claim_listing.php' ) && get_option('geodir_claim_enable') === 'yes' ? true : false;
4052
+                    $is_claim_active = is_plugin_active('geodir_claim_listing/geodir_claim_listing.php') && get_option('geodir_claim_enable') === 'yes' ? true : false;
4053 4053
                     $wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses.
4054 4054
                     $default_status = 'publish';
4055
-                    $current_date = date_i18n( 'Y-m-d', time() );
4055
+                    $current_date = date_i18n('Y-m-d', time());
4056 4056
                     
4057 4057
                     $columns = isset($file[0]) ? $file[0] : NULL;
4058 4058
                     
4059 4059
                     if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4060 4060
                         $json['error'] = CSV_INVAILD_FILE;
4061
-                        wp_send_json( $json );
4061
+                        wp_send_json($json);
4062 4062
                         exit;
4063 4063
                     }
4064
-                    $xtimings['###2'] = microtime(true)-$xstart;
4064
+                    $xtimings['###2'] = microtime(true) - $xstart;
4065 4065
                     $gd_error_log = __('GD IMPORT LISTINGS [ROW %d]:', 'geodirectory');
4066
-                    $wp_chars_error = __( '(check & remove if any invalid characters used in data)', 'geodirectory' );
4066
+                    $wp_chars_error = __('(check & remove if any invalid characters used in data)', 'geodirectory');
4067 4067
                     $processed_actual = 0;
4068 4068
                     for ($i = 1; $i <= $limit; $i++) {
4069 4069
                         $index = $processed + $i;
@@ -4072,9 +4072,9 @@  discard block
 block discarded – undo
4072 4072
                         if (isset($file[$index])) {
4073 4073
                             $processed_actual++;
4074 4074
                             $row = $file[$index];
4075
-                            $row = array_map( 'trim', $row );
4075
+                            $row = array_map('trim', $row);
4076 4076
                             //$row = array_map( 'utf8_encode', $row );
4077
-                            $row = array_map( 'addslashes_gpc', $row );
4077
+                            $row = array_map('addslashes_gpc', $row);
4078 4078
                             
4079 4079
                             $post_id = '';
4080 4080
                             $post_title = '';
@@ -4114,82 +4114,82 @@  discard block
 block discarded – undo
4114 4114
                             $original_post_id = '';
4115 4115
                             
4116 4116
                             $c = 0;
4117
-                            foreach ($columns as $column ) {
4117
+                            foreach ($columns as $column) {
4118 4118
                                 $gd_post[$column] = $row[$c];
4119 4119
                                 
4120
-                                if ( $column == 'post_id' ) {
4120
+                                if ($column == 'post_id') {
4121 4121
                                     $post_id = $row[$c];
4122
-                                } else if ( $column == 'post_title' ) {
4122
+                                } else if ($column == 'post_title') {
4123 4123
                                     $post_title = sanitize_text_field($row[$c]);
4124
-                                } else if ( $column == 'post_author' ) {
4124
+                                } else if ($column == 'post_author') {
4125 4125
                                     $post_author = $row[$c];
4126
-                                } else if ( $column == 'post_date' ) {
4126
+                                } else if ($column == 'post_date') {
4127 4127
                                     $post_date = $row[$c];
4128
-                                } else if ( $column == 'post_content' ) {
4128
+                                } else if ($column == 'post_content') {
4129 4129
                                     $post_content = $row[$c];
4130
-                                } else if ( $column == 'post_category' && $row[$c] != '' ) {
4131
-                                    $post_category_arr = explode( ',', $row[$c] );
4132
-                                } else if ( $column == 'default_category' ) {
4130
+                                } else if ($column == 'post_category' && $row[$c] != '') {
4131
+                                    $post_category_arr = explode(',', $row[$c]);
4132
+                                } else if ($column == 'default_category') {
4133 4133
                                     $default_category = wp_kses_normalize_entities($row[$c]);
4134
-                                } else if ( $column == 'post_tags' && $row[$c] != '' ) {
4135
-                                    $post_tags = explode( ',', sanitize_text_field($row[$c]) );
4136
-                                } else if ( $column == 'post_type' ) {
4134
+                                } else if ($column == 'post_tags' && $row[$c] != '') {
4135
+                                    $post_tags = explode(',', sanitize_text_field($row[$c]));
4136
+                                } else if ($column == 'post_type') {
4137 4137
                                     $post_type = $row[$c];
4138
-                                } else if ( $column == 'post_status' ) {
4139
-                                    $post_status = sanitize_key( $row[$c] );
4140
-                                } else if ( $column == 'is_featured' ) {
4141
-                                    $is_featured = (int)$row[$c];
4142
-                                } else if ( $column == 'geodir_video' ) {
4138
+                                } else if ($column == 'post_status') {
4139
+                                    $post_status = sanitize_key($row[$c]);
4140
+                                } else if ($column == 'is_featured') {
4141
+                                    $is_featured = (int) $row[$c];
4142
+                                } else if ($column == 'geodir_video') {
4143 4143
                                     $geodir_video = $row[$c];
4144
-                                } else if ( $column == 'post_address' ) {
4144
+                                } else if ($column == 'post_address') {
4145 4145
                                     $post_address = sanitize_text_field($row[$c]);
4146
-                                } else if ( $column == 'post_city' ) {
4146
+                                } else if ($column == 'post_city') {
4147 4147
                                     $post_city = sanitize_text_field($row[$c]);
4148
-                                } else if ( $column == 'post_region' ) {
4148
+                                } else if ($column == 'post_region') {
4149 4149
                                     $post_region = sanitize_text_field($row[$c]);
4150
-                                } else if ( $column == 'post_country' ) {
4150
+                                } else if ($column == 'post_country') {
4151 4151
                                     $post_country = sanitize_text_field($row[$c]);
4152
-                                } else if ( $column == 'post_zip' ) {
4152
+                                } else if ($column == 'post_zip') {
4153 4153
                                     $post_zip = sanitize_text_field($row[$c]);
4154
-                                } else if ( $column == 'post_latitude' ) {
4154
+                                } else if ($column == 'post_latitude') {
4155 4155
                                     $post_latitude = sanitize_text_field($row[$c]);
4156
-                                } else if ( $column == 'post_longitude' ) {
4156
+                                } else if ($column == 'post_longitude') {
4157 4157
                                     $post_longitude = sanitize_text_field($row[$c]);
4158
-                                } else if ( $column == 'post_neighbourhood' ) {
4158
+                                } else if ($column == 'post_neighbourhood') {
4159 4159
                                     $post_neighbourhood = sanitize_text_field($row[$c]);
4160 4160
                                     unset($gd_post[$column]);
4161
-                                } else if ( $column == 'neighbourhood_latitude' ) {
4161
+                                } else if ($column == 'neighbourhood_latitude') {
4162 4162
                                     $neighbourhood_latitude = sanitize_text_field($row[$c]);
4163
-                                } else if ( $column == 'neighbourhood_longitude' ) {
4163
+                                } else if ($column == 'neighbourhood_longitude') {
4164 4164
                                     $neighbourhood_longitude = sanitize_text_field($row[$c]);
4165
-                                } else if ( $column == 'geodir_timing' ) {
4165
+                                } else if ($column == 'geodir_timing') {
4166 4166
                                     $geodir_timing = sanitize_text_field($row[$c]);
4167
-                                } else if ( $column == 'geodir_contact' ) {
4167
+                                } else if ($column == 'geodir_contact') {
4168 4168
                                     $geodir_contact = sanitize_text_field($row[$c]);
4169
-                                } else if ( $column == 'geodir_email' ) {
4169
+                                } else if ($column == 'geodir_email') {
4170 4170
                                     $geodir_email = sanitize_email($row[$c]);
4171
-                                } else if ( $column == 'geodir_website' ) {
4171
+                                } else if ($column == 'geodir_website') {
4172 4172
                                     $geodir_website = sanitize_text_field($row[$c]);
4173
-                                } else if ( $column == 'geodir_twitter' ) {
4173
+                                } else if ($column == 'geodir_twitter') {
4174 4174
                                     $geodir_twitter = sanitize_text_field($row[$c]);
4175
-                                } else if ( $column == 'geodir_facebook' ) {
4175
+                                } else if ($column == 'geodir_facebook') {
4176 4176
                                     $geodir_facebook = sanitize_text_field($row[$c]);
4177
-                                } else if ( $column == 'IMAGE' && !empty( $row[$c] ) && $row[$c] != '' ) {
4177
+                                } else if ($column == 'IMAGE' && !empty($row[$c]) && $row[$c] != '') {
4178 4178
                                     $post_images[] = $row[$c];
4179
-                                } else if ( $column == 'alive_days' && (int)$row[$c] > 0 ) {
4180
-                                    $expire_date = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$row[$c] . ' days' ) );
4181
-                                } else if ( $column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never' ) {
4179
+                                } else if ($column == 'alive_days' && (int) $row[$c] > 0) {
4180
+                                    $expire_date = date_i18n('Y-m-d', strtotime($current_date.'+'.(int) $row[$c].' days'));
4181
+                                } else if ($column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never') {
4182 4182
                                     $row[$c] = str_replace('/', '-', $row[$c]);
4183
-                                    $expire_date = date_i18n( 'Y-m-d', strtotime( $row[$c] ) );
4184
-                                } else if ( strpos( $column, 'linked_' ) === 0 ) {
4185
-                                    $geodir_link_business = (int)$row[$c];
4183
+                                    $expire_date = date_i18n('Y-m-d', strtotime($row[$c]));
4184
+                                } else if (strpos($column, 'linked_') === 0) {
4185
+                                    $geodir_link_business = (int) $row[$c];
4186 4186
                                 }
4187 4187
                                 // WPML
4188 4188
                                 if ($is_wpml) {
4189 4189
                                     if ($column == 'language') {
4190 4190
                                         $language = geodir_strtolower(trim($row[$c]));
4191 4191
                                     } else if ($column == 'original_post_id') {
4192
-                                        $original_post_id = (int)$row[$c];
4192
+                                        $original_post_id = (int) $row[$c];
4193 4193
                                     }
4194 4194
                                 }
4195 4195
                                 // WPML
@@ -4197,7 +4197,7 @@  discard block
 block discarded – undo
4197 4197
                             }
4198 4198
                             // listing claimed or not
4199 4199
                             if ($is_claim_active && isset($gd_post['claimed'])) {
4200
-                                $gd_post['claimed'] = (int)$gd_post['claimed'] == 1 ? 1 : 0;
4200
+                                $gd_post['claimed'] = (int) $gd_post['claimed'] == 1 ? 1 : 0;
4201 4201
                             }
4202 4202
                             
4203 4203
                             // WPML
@@ -4208,43 +4208,43 @@  discard block
 block discarded – undo
4208 4208
 
4209 4209
                             $gd_post['IMAGE'] = $post_images;
4210 4210
                             
4211
-                            $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status;
4212
-                            $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status;
4211
+                            $post_status = !empty($post_status) ? sanitize_key($post_status) : $default_status;
4212
+                            $post_status = !empty($wp_post_statuses) && !isset($wp_post_statuses[$post_status]) ? $default_status : $post_status;
4213 4213
                                                                                                                 
4214 4214
                             $valid = true;
4215 4215
                             
4216
-                            if ( $post_title == '' || !in_array( $post_type, $post_types ) ) {
4216
+                            if ($post_title == '' || !in_array($post_type, $post_types)) {
4217 4217
                                 $invalid++;
4218 4218
                                 $valid = false;
4219
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) );
4219
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be added due to blank title/invalid post type', 'geodirectory'));
4220 4220
                             }
4221
-                            $xtimings['###3'] = microtime(true)-$xstart;
4222
-                            $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
4223
-                            if ( $location_allowed ) {
4221
+                            $xtimings['###3'] = microtime(true) - $xstart;
4222
+                            $location_allowed = function_exists('geodir_cpt_no_location') && geodir_cpt_no_location($post_type) ? false : true;
4223
+                            if ($location_allowed) {
4224 4224
                                 $location_result = geodir_get_default_location();
4225
-                                if ( $post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '' ) {
4225
+                                if ($post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '') {
4226 4226
                                     $invalid_addr++;
4227 4227
                                     $valid = false;
4228
-                                    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' ) );
4229
-                                } else if ( !empty( $location_result ) && $location_result->location_id == 0 ) {
4230
-                                    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 ) ) ) {
4228
+                                    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'));
4229
+                                } else if (!empty($location_result) && $location_result->location_id == 0) {
4230
+                                    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))) {
4231 4231
                                         $invalid_addr++;
4232 4232
                                         $valid = false;
4233
-                                        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' ) );
4233
+                                        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'));
4234 4234
                                     } else {
4235 4235
                                         if (!$location_manager) {
4236
-                                            $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.
4236
+                                            $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.
4237 4237
                                         }
4238 4238
                                     }
4239 4239
                                 }
4240 4240
                             }
4241
-                            $xtimings['###4']   = microtime(true)-$xstart;
4242
-                            if ( !$valid ) {
4241
+                            $xtimings['###4'] = microtime(true) - $xstart;
4242
+                            if (!$valid) {
4243 4243
                                 continue;
4244 4244
                             }
4245 4245
 
4246
-                            $cat_taxonomy = $post_type . 'category';
4247
-                            $tags_taxonomy = $post_type . '_tags';
4246
+                            $cat_taxonomy = $post_type.'category';
4247
+                            $tags_taxonomy = $post_type.'_tags';
4248 4248
                             
4249 4249
                             if ($default_category != '' && !in_array($default_category, $post_category_arr)) {
4250 4250
                                 $post_category_arr = array_merge(array($default_category), $post_category_arr);
@@ -4252,29 +4252,29 @@  discard block
 block discarded – undo
4252 4252
 
4253 4253
                             $post_category = array();
4254 4254
                             $default_category_id = NULL;
4255
-                            if ( !empty( $post_category_arr ) ) {
4256
-                                foreach ( $post_category_arr as $value ) {
4257
-                                    $category_name = wp_kses_normalize_entities( trim( $value ) );
4255
+                            if (!empty($post_category_arr)) {
4256
+                                foreach ($post_category_arr as $value) {
4257
+                                    $category_name = wp_kses_normalize_entities(trim($value));
4258 4258
                                     
4259
-                                    if ( $category_name != '' ) {
4259
+                                    if ($category_name != '') {
4260 4260
                                         $term_category = array();
4261 4261
                                         
4262
-                                        if ( $term = get_term_by( 'name', $category_name, $cat_taxonomy ) ) {
4262
+                                        if ($term = get_term_by('name', $category_name, $cat_taxonomy)) {
4263 4263
                                             $term_category = $term;
4264
-                                        } else if ( $term = get_term_by( 'slug', $category_name, $cat_taxonomy ) ) {
4264
+                                        } else if ($term = get_term_by('slug', $category_name, $cat_taxonomy)) {
4265 4265
                                             $term_category = $term;
4266 4266
                                         } else {
4267 4267
                                             $term_data = array();
4268 4268
                                             $term_data['name'] = $category_name;
4269 4269
                                             $term_data['taxonomy'] = $cat_taxonomy;
4270 4270
                                             
4271
-                                            $term_id = geodir_imex_insert_term( $cat_taxonomy, $term_data );
4272
-                                            if ( $term_id ) {
4273
-                                                $term_category = get_term( $term_id, $cat_taxonomy );
4271
+                                            $term_id = geodir_imex_insert_term($cat_taxonomy, $term_data);
4272
+                                            if ($term_id) {
4273
+                                                $term_category = get_term($term_id, $cat_taxonomy);
4274 4274
                                             }
4275 4275
                                         }
4276 4276
                                         
4277
-                                        if ( !empty( $term_category ) && !is_wp_error( $term_category ) ) {
4277
+                                        if (!empty($term_category) && !is_wp_error($term_category)) {
4278 4278
                                             $post_category[] = intval($term_category->term_id);
4279 4279
                                             
4280 4280
                                             if ($category_name == $default_category) {
@@ -4284,14 +4284,14 @@  discard block
 block discarded – undo
4284 4284
                                     }
4285 4285
                                 }
4286 4286
                             }
4287
-                            $xtimings['###5'] = microtime(true)-$xstart;
4287
+                            $xtimings['###5'] = microtime(true) - $xstart;
4288 4288
                             $save_post = array();
4289 4289
                             $save_post['post_title'] = $post_title;
4290 4290
                             if (!empty($post_date)) {
4291
-                                $post_date = geodir_date( $post_date, 'Y-m-d H:i:s' ); // convert to mysql date format.
4291
+                                $post_date = geodir_date($post_date, 'Y-m-d H:i:s'); // convert to mysql date format.
4292 4292
                                 
4293 4293
                                 $save_post['post_date'] = $post_date;
4294
-                                $save_post['post_date_gmt'] = get_gmt_from_date( $post_date );
4294
+                                $save_post['post_date_gmt'] = get_gmt_from_date($post_date);
4295 4295
                             }
4296 4296
                             $save_post['post_content'] = $post_content;
4297 4297
                             $save_post['post_type'] = $post_type;
@@ -4301,15 +4301,15 @@  discard block
 block discarded – undo
4301 4301
                             $save_post['post_tags'] = $post_tags;
4302 4302
 
4303 4303
                             $saved_post_id = NULL;
4304
-                            if ( $import_choice == 'update' ) {
4305
-                                $gd_wp_error = __( 'Unable to add listing, please check the listing data.', 'geodirectory' );
4304
+                            if ($import_choice == 'update') {
4305
+                                $gd_wp_error = __('Unable to add listing, please check the listing data.', 'geodirectory');
4306 4306
                                 
4307
-                                if ( $post_id > 0 && get_post( $post_id ) ) {
4307
+                                if ($post_id > 0 && get_post($post_id)) {
4308 4308
                                     $save_post['ID'] = $post_id;
4309 4309
                                     
4310
-                                    if ( $saved_post_id = wp_update_post( $save_post, true ) ) {
4311
-                                        if ( is_wp_error( $saved_post_id ) ) {
4312
-                                            $gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error;
4310
+                                    if ($saved_post_id = wp_update_post($save_post, true)) {
4311
+                                        if (is_wp_error($saved_post_id)) {
4312
+                                            $gd_wp_error = $saved_post_id->get_error_message().' '.$wp_chars_error;
4313 4313
                                             $saved_post_id = 0;
4314 4314
                                         } else {
4315 4315
                                             $saved_post_id = $post_id;
@@ -4317,9 +4317,9 @@  discard block
 block discarded – undo
4317 4317
                                         }
4318 4318
                                     }
4319 4319
                                 } else {
4320
-                                    if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
4321
-                                        if ( is_wp_error( $saved_post_id ) ) {
4322
-                                            $gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error;
4320
+                                    if ($saved_post_id = wp_insert_post($save_post, true)) {
4321
+                                        if (is_wp_error($saved_post_id)) {
4322
+                                            $gd_wp_error = $saved_post_id->get_error_message().' '.$wp_chars_error;
4323 4323
                                             $saved_post_id = 0;
4324 4324
                                         } else {
4325 4325
                                             $created++;
@@ -4327,19 +4327,19 @@  discard block
 block discarded – undo
4327 4327
                                     }
4328 4328
                                 }
4329 4329
                                 
4330
-                                if ( !$saved_post_id > 0 ) {
4330
+                                if (!$saved_post_id > 0) {
4331 4331
                                     $invalid++;
4332
-                                    geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_wp_error );
4332
+                                    geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_wp_error);
4333 4333
                                 }
4334
-                            } else if ( $import_choice == 'skip' ) {
4335
-                                if ( $post_id > 0 && get_post( $post_id ) ) {
4334
+                            } else if ($import_choice == 'skip') {
4335
+                                if ($post_id > 0 && get_post($post_id)) {
4336 4336
                                     $skipped++;	
4337 4337
                                 } else {
4338
-                                    if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
4339
-                                        if ( is_wp_error( $saved_post_id ) ) {
4338
+                                    if ($saved_post_id = wp_insert_post($save_post, true)) {
4339
+                                        if (is_wp_error($saved_post_id)) {
4340 4340
                                             $invalid++;
4341 4341
                                             
4342
-                                            geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $saved_post_id->get_error_message() . ' ' . $wp_chars_error );
4342
+                                            geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$saved_post_id->get_error_message().' '.$wp_chars_error);
4343 4343
                                             $saved_post_id = 0;
4344 4344
                                         } else {
4345 4345
                                             $created++;
@@ -4347,28 +4347,28 @@  discard block
 block discarded – undo
4347 4347
                                     } else {
4348 4348
                                         $invalid++;
4349 4349
                                         
4350
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error );
4350
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$wp_chars_error);
4351 4351
                                     }
4352 4352
                                 }
4353 4353
                             } else {
4354 4354
                                 $invalid++;
4355 4355
                                 
4356
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error );
4356
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$wp_chars_error);
4357 4357
                             }
4358
-                            $xtimings['###6'] = microtime(true)-$xstart;
4359
-                            if ( (int)$saved_post_id > 0 ) {
4358
+                            $xtimings['###6'] = microtime(true) - $xstart;
4359
+                            if ((int) $saved_post_id > 0) {
4360 4360
                                 // WPML
4361 4361
                                 if ($is_wpml && geodir_wpml_is_post_type_translated($post_type) && $original_post_id > 0 && $language != '') {
4362
-                                    $wpml_post_type = 'post_' . $post_type;
4363
-                                    $source_language = geodir_get_language_for_element( $original_post_id, $wpml_post_type );
4362
+                                    $wpml_post_type = 'post_'.$post_type;
4363
+                                    $source_language = geodir_get_language_for_element($original_post_id, $wpml_post_type);
4364 4364
                                     $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
4365 4365
 
4366
-                                    $trid = $sitepress->get_element_trid( $original_post_id, $wpml_post_type );
4366
+                                    $trid = $sitepress->get_element_trid($original_post_id, $wpml_post_type);
4367 4367
                                     
4368
-                                    $sitepress->set_element_language_details( $saved_post_id, $wpml_post_type, $trid, $language, $source_language );
4368
+                                    $sitepress->set_element_language_details($saved_post_id, $wpml_post_type, $trid, $language, $source_language);
4369 4369
                                 }
4370 4370
                                 // WPML
4371
-                                $gd_post_info = geodir_get_post_info( $saved_post_id );
4371
+                                $gd_post_info = geodir_get_post_info($saved_post_id);
4372 4372
                                 
4373 4373
                                 $gd_post['post_id'] = $saved_post_id;
4374 4374
                                 $gd_post['ID'] = $saved_post_id;
@@ -4380,7 +4380,7 @@  discard block
 block discarded – undo
4380 4380
                                                     
4381 4381
                                 // post location
4382 4382
                                 $post_location_id = 0;
4383
-                                if ( $location_allowed && !empty( $location_result ) && $location_result->location_id > 0 ) {
4383
+                                if ($location_allowed && !empty($location_result) && $location_result->location_id > 0) {
4384 4384
                                     $gd_post['post_neighbourhood'] = '';
4385 4385
                                     
4386 4386
                                     $post_location_info = array(
@@ -4390,7 +4390,7 @@  discard block
 block discarded – undo
4390 4390
                                                                 'geo_lat' => $post_latitude,
4391 4391
                                                                 'geo_lng' => $post_longitude
4392 4392
                                                             );
4393
-                                    if ( $location_id = (int)geodir_add_new_location( $post_location_info ) ) {
4393
+                                    if ($location_id = (int) geodir_add_new_location($post_location_info)) {
4394 4394
                                         $post_location_id = $location_id;
4395 4395
                                     }
4396 4396
                                     
@@ -4432,14 +4432,14 @@  discard block
 block discarded – undo
4432 4432
                                 }
4433 4433
                                 
4434 4434
                                 // post package info
4435
-                                $package_id = isset( $gd_post['package_id'] ) && !empty( $gd_post['package_id'] ) ? (int)$gd_post['package_id'] : 0;
4435
+                                $package_id = isset($gd_post['package_id']) && !empty($gd_post['package_id']) ? (int) $gd_post['package_id'] : 0;
4436 4436
                                 if (!$package_id && !empty($gd_post_info) && isset($gd_post_info->package_id) && $gd_post_info->package_id) {
4437 4437
                                     $package_id = $gd_post_info->package_id;
4438 4438
                                 }
4439 4439
                                 
4440 4440
                                 $package_info = array();
4441 4441
                                 if ($package_id && function_exists('geodir_get_package_info_by_id')) {
4442
-                                    $package_info = (array)geodir_get_package_info_by_id($package_id);
4442
+                                    $package_info = (array) geodir_get_package_info_by_id($package_id);
4443 4443
                                     
4444 4444
                                     if (!(!empty($package_info) && isset($package_info['post_type']) && $package_info['post_type'] == $post_type)) {
4445 4445
                                         $package_info = array();
@@ -4447,18 +4447,18 @@  discard block
 block discarded – undo
4447 4447
                                 }
4448 4448
                                 
4449 4449
                                 if (empty($package_info)) {
4450
-                                    $package_info = (array)geodir_post_package_info( array(), '', $post_type );
4450
+                                    $package_info = (array) geodir_post_package_info(array(), '', $post_type);
4451 4451
                                 }
4452 4452
                                  
4453
-                                if (!empty($package_info))	 {
4453
+                                if (!empty($package_info)) {
4454 4454
                                     $package_id = $package_info['pid'];
4455 4455
                                     
4456 4456
                                     if (isset($gd_post['alive_days']) || isset($gd_post['expire_date'])) {
4457 4457
                                         $gd_post['expire_date'] = $expire_date;
4458 4458
                                     } else {
4459
-                                        if ( isset( $package_info['days'] ) && (int)$package_info['days'] > 0 ) {
4460
-                                            $gd_post['alive_days'] = (int)$package_info['days'];
4461
-                                            $gd_post['expire_date'] = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$package_info['days'] . ' days' ) );
4459
+                                        if (isset($package_info['days']) && (int) $package_info['days'] > 0) {
4460
+                                            $gd_post['alive_days'] = (int) $package_info['days'];
4461
+                                            $gd_post['expire_date'] = date_i18n('Y-m-d', strtotime($current_date.'+'.(int) $package_info['days'].' days'));
4462 4462
                                         } else {
4463 4463
                                             $gd_post['expire_date'] = 'Never';
4464 4464
                                         }
@@ -4467,7 +4467,7 @@  discard block
 block discarded – undo
4467 4467
                                     $gd_post['package_id'] = $package_id;
4468 4468
                                 }
4469 4469
 
4470
-                                $table = $plugin_prefix . $post_type . '_detail';
4470
+                                $table = $plugin_prefix.$post_type.'_detail';
4471 4471
                                 
4472 4472
                                 if ($post_type == 'gd_event') {
4473 4473
                                     $gd_post = geodir_imex_process_event_data($gd_post);
@@ -4478,71 +4478,71 @@  discard block
 block discarded – undo
4478 4478
                                 }
4479 4479
 
4480 4480
                                 // Export franchise fields
4481
-                                $is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false;
4481
+                                $is_franchise_active = is_plugin_active('geodir_franchise/geodir_franchise.php') && geodir_franchise_enabled($post_type) ? true : false;
4482 4482
                                 if ($is_franchise_active) {
4483
-                                    if ( isset( $gd_post['gd_is_franchise'] ) && empty( $gd_post['franchise'] ) ) {
4484
-                                        if ( absint( $gd_post['gd_is_franchise'] ) != 0 ) {
4483
+                                    if (isset($gd_post['gd_is_franchise']) && empty($gd_post['franchise'])) {
4484
+                                        if (absint($gd_post['gd_is_franchise']) != 0) {
4485 4485
                                             $gd_franchise_lock = array();
4486 4486
                                             
4487
-                                            if ( isset( $gd_post['gd_franchise_lock'] ) ) {
4488
-                                                $gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock'] );
4489
-                                                $gd_franchise_lock = trim( $gd_franchise_lock );
4490
-                                                $gd_franchise_lock = explode( ",", $gd_franchise_lock );
4487
+                                            if (isset($gd_post['gd_franchise_lock'])) {
4488
+                                                $gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock']);
4489
+                                                $gd_franchise_lock = trim($gd_franchise_lock);
4490
+                                                $gd_franchise_lock = explode(",", $gd_franchise_lock);
4491 4491
                                             }
4492 4492
                                             
4493
-                                            update_post_meta( $saved_post_id, 'gd_is_franchise', 1 );
4494
-                                            update_post_meta( $saved_post_id, 'gd_franchise_lock', $gd_franchise_lock );
4493
+                                            update_post_meta($saved_post_id, 'gd_is_franchise', 1);
4494
+                                            update_post_meta($saved_post_id, 'gd_franchise_lock', $gd_franchise_lock);
4495 4495
                                         } else {
4496
-                                            if ( function_exists( 'geodir_franchise_remove_franchise' ) ) {
4497
-                                                geodir_franchise_remove_franchise( $saved_post_id );
4496
+                                            if (function_exists('geodir_franchise_remove_franchise')) {
4497
+                                                geodir_franchise_remove_franchise($saved_post_id);
4498 4498
                                             }
4499 4499
                                         }
4500 4500
                                     } else {
4501
-                                        if ( isset( $gd_post['franchise'] ) && (int)$gd_post['franchise'] > 0 && geodir_franchise_check( (int)$gd_post['franchise'] ) ) {
4502
-                                            geodir_save_post_meta( $saved_post_id, 'franchise', (int)$gd_post['franchise'] );
4501
+                                        if (isset($gd_post['franchise']) && (int) $gd_post['franchise'] > 0 && geodir_franchise_check((int) $gd_post['franchise'])) {
4502
+                                            geodir_save_post_meta($saved_post_id, 'franchise', (int) $gd_post['franchise']);
4503 4503
                                         }
4504 4504
                                     }
4505 4505
                                 }
4506 4506
                                 
4507 4507
                                 if (!empty($save_post['post_category']) && is_array($save_post['post_category'])) {
4508
-                                    $save_post['post_category'] = array_unique( array_map( 'intval', $save_post['post_category'] ) );
4508
+                                    $save_post['post_category'] = array_unique(array_map('intval', $save_post['post_category']));
4509 4509
                                     if ($default_category_id) {
4510 4510
                                         $save_post['post_default_category'] = $default_category_id;
4511 4511
                                         $gd_post['default_category'] = $default_category_id;
4512 4512
                                     }
4513 4513
                                     $gd_post[$cat_taxonomy] = $save_post['post_category'];
4514 4514
                                 }
4515
-                                $xtimings['###7'] = microtime(true)-$xstart;
4515
+                                $xtimings['###7'] = microtime(true) - $xstart;
4516 4516
                                 // Save post info
4517
-                                geodir_save_post_info( $saved_post_id, $gd_post );
4518
-                                $xtimings['###8'] = microtime(true)-$xstart;
4517
+                                geodir_save_post_info($saved_post_id, $gd_post);
4518
+                                $xtimings['###8'] = microtime(true) - $xstart;
4519 4519
                                 // post taxonomies
4520
-                                if ( !empty( $save_post['post_category'] ) ) {
4521
-                                    wp_set_object_terms( $saved_post_id, $save_post['post_category'], $cat_taxonomy );
4520
+                                if (!empty($save_post['post_category'])) {
4521
+                                    wp_set_object_terms($saved_post_id, $save_post['post_category'], $cat_taxonomy);
4522 4522
                                     
4523
-                                    $post_default_category = isset( $save_post['post_default_category'] ) ? $save_post['post_default_category'] : '';
4523
+                                    $post_default_category = isset($save_post['post_default_category']) ? $save_post['post_default_category'] : '';
4524 4524
                                     if ($default_category_id) {
4525 4525
                                         $post_default_category = $default_category_id;
4526 4526
                                     }
4527 4527
                                     $post_cat_ids = geodir_get_post_meta($saved_post_id, $cat_taxonomy);
4528 4528
                                     $save_post['post_category'] = !empty($post_cat_ids) ? explode(",", trim($post_cat_ids, ",")) : $save_post['post_category'];
4529
-                                    $post_category_str = !empty($save_post['post_category']) ? implode(",y:#", $save_post['post_category']) . ',y:' : '';
4529
+                                    $post_category_str = !empty($save_post['post_category']) ? implode(",y:#", $save_post['post_category']).',y:' : '';
4530 4530
                                     
4531 4531
                                     if ($post_category_str != '' && $post_default_category) {
4532
-                                        $post_category_str = str_replace($post_default_category . ',y:', $post_default_category . ',y,d:', $post_category_str);
4532
+                                        $post_category_str = str_replace($post_default_category.',y:', $post_default_category.',y,d:', $post_category_str);
4533 4533
                                     }
4534 4534
                                     
4535 4535
                                     $post_category_str = $post_category_str != '' ? array($cat_taxonomy => $post_category_str) : '';
4536 4536
                                     
4537
-                                    geodir_set_postcat_structure( $saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str );
4537
+                                    geodir_set_postcat_structure($saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str);
4538 4538
                                 }
4539
-                                $xtimings['###8.1'] = microtime(true)-$xstart;
4540
-                                if ( !empty( $save_post['post_tags'] ) ) {
4541
-                                    wp_set_object_terms( $saved_post_id, $save_post['post_tags'], $tags_taxonomy );
4539
+                                $xtimings['###8.1'] = microtime(true) - $xstart;
4540
+                                if (!empty($save_post['post_tags'])) {
4541
+                                    wp_set_object_terms($saved_post_id, $save_post['post_tags'], $tags_taxonomy);
4542 4542
                                 }
4543
-                                $xtimings['###9'] = microtime(true)-$xstart;
4543
+                                $xtimings['###9'] = microtime(true) - $xstart;
4544 4544
                                 // Post images
4545
-                                if ( !empty( $post_images ) ) {
4545
+                                if (!empty($post_images)) {
4546 4546
                                     $post_images = array_unique($post_images);
4547 4547
                                     
4548 4548
                                     $old_post_images_arr = array();
@@ -4550,65 +4550,65 @@  discard block
 block discarded – undo
4550 4550
                                     
4551 4551
                                     $order = 1;
4552 4552
                                     
4553
-                                    $old_post_images = geodir_get_images( $saved_post_id );
4554
-                                    $xtimings['###9.1'] = microtime(true)-$xstart;
4553
+                                    $old_post_images = geodir_get_images($saved_post_id);
4554
+                                    $xtimings['###9.1'] = microtime(true) - $xstart;
4555 4555
                                     if (!empty($old_post_images)) {
4556
-                                        foreach( $old_post_images as $old_post_image ) {
4556
+                                        foreach ($old_post_images as $old_post_image) {
4557 4557
                                             if (!empty($old_post_image) && isset($old_post_image->file) && $old_post_image->file != '') {
4558 4558
                                                 $old_post_images_arr[] = $old_post_image->file;
4559 4559
                                             }
4560 4560
                                         }
4561 4561
                                     }
4562 4562
 
4563
-                                    foreach ( $post_images as $post_image ) {
4564
-                                        $image_name = basename( $post_image );
4563
+                                    foreach ($post_images as $post_image) {
4564
+                                        $image_name = basename($post_image);
4565 4565
                                         $saved_post_images_arr[] = $image_name;
4566 4566
                                         
4567
-                                        if (!empty($old_post_images_arr) && in_array( $image_name, $old_post_images_arr) ) {
4567
+                                        if (!empty($old_post_images_arr) && in_array($image_name, $old_post_images_arr)) {
4568 4568
                                             continue; // Skip if image already exists.
4569 4569
                                         }
4570 4570
                                         
4571
-                                        $image_name_parts = explode( '.', $image_name );
4572
-                                        array_pop( $image_name_parts );
4573
-                                        $proper_image_name = implode( '.', $image_name_parts );
4574
-                                        $xtimings['###9.2'] = microtime(true)-$xstart;
4575
-                                        $arr_file_type = wp_check_filetype( $image_name );
4576
-                                        $xtimings['###9.3'] = microtime(true)-$xstart;
4577
-                                        if ( !empty( $arr_file_type ) ) {
4571
+                                        $image_name_parts = explode('.', $image_name);
4572
+                                        array_pop($image_name_parts);
4573
+                                        $proper_image_name = implode('.', $image_name_parts);
4574
+                                        $xtimings['###9.2'] = microtime(true) - $xstart;
4575
+                                        $arr_file_type = wp_check_filetype($image_name);
4576
+                                        $xtimings['###9.3'] = microtime(true) - $xstart;
4577
+                                        if (!empty($arr_file_type)) {
4578 4578
                                             $uploaded_file_type = $arr_file_type['type'];
4579 4579
                                             
4580 4580
                                             $attachment = array();
4581 4581
                                             $attachment['post_id'] = $saved_post_id;
4582 4582
                                             $attachment['title'] = $proper_image_name;
4583 4583
                                             $attachment['content'] = '';
4584
-                                            $attachment['file'] = $uploads_subdir . '/' . $image_name;
4584
+                                            $attachment['file'] = $uploads_subdir.'/'.$image_name;
4585 4585
                                             $attachment['mime_type'] = $uploaded_file_type;
4586 4586
                                             $attachment['menu_order'] = $order;
4587 4587
                                             $attachment['is_featured'] = 0;
4588 4588
 
4589 4589
                                             $attachment_set = '';
4590
-                                            foreach ( $attachment as $key => $val ) {
4591
-                                                if ( $val != '' ) {
4592
-                                                    $attachment_set .= $key . " = '" . $val . "', ";
4590
+                                            foreach ($attachment as $key => $val) {
4591
+                                                if ($val != '') {
4592
+                                                    $attachment_set .= $key." = '".$val."', ";
4593 4593
                                                 }
4594 4594
                                             }
4595
-                                            $attachment_set = trim( $attachment_set, ", " );
4595
+                                            $attachment_set = trim($attachment_set, ", ");
4596 4596
                                                                                         
4597 4597
                                             // Add new attachment
4598
-                                            $xtimings['###9.4'] = microtime(true)-$xstart;
4599
-                                            $wpdb->query( "INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set );
4600
-                                            $xtimings['###9.5'] = microtime(true)-$xstart;
4598
+                                            $xtimings['###9.4'] = microtime(true) - $xstart;
4599
+                                            $wpdb->query("INSERT INTO ".GEODIR_ATTACHMENT_TABLE." SET ".$attachment_set);
4600
+                                            $xtimings['###9.5'] = microtime(true) - $xstart;
4601 4601
                                             $order++;
4602 4602
                                         }
4603 4603
                                     }
4604 4604
 
4605
-                                    $saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/" . implode("' AND file NOT LIKE '%/",  $saved_post_images_arr) . "' )" : '';
4605
+                                    $saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/".implode("' AND file NOT LIKE '%/", $saved_post_images_arr)."' )" : '';
4606 4606
                                     // Remove previous attachment
4607
-                                    $wpdb->query( "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = " . (int)$saved_post_id . " " . $saved_post_images_sql );
4608
-                                    $xtimings['###9.6'] = microtime(true)-$xstart;
4609
-                                    if ( !empty( $saved_post_images_arr ) ) {
4607
+                                    $wpdb->query("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id = ".(int) $saved_post_id." ".$saved_post_images_sql);
4608
+                                    $xtimings['###9.6'] = microtime(true) - $xstart;
4609
+                                    if (!empty($saved_post_images_arr)) {
4610 4610
                                         geodir_set_wp_featured_image($saved_post_id);
4611
-                                        $xtimings['###9.7'] = microtime(true)-$xstart;
4611
+                                        $xtimings['###9.7'] = microtime(true) - $xstart;
4612 4612
                                         /*
4613 4613
                                         $menu_order = 1;
4614 4614
                                         
@@ -4624,14 +4624,14 @@  discard block
 block discarded – undo
4624 4624
                                         }*/
4625 4625
                                     }
4626 4626
                                     
4627
-                                    if ( $order > 1 ) {
4627
+                                    if ($order > 1) {
4628 4628
                                         $images++;
4629 4629
                                     }
4630 4630
                                 }
4631
-                                $xtimings['###10'] = microtime(true)-$xstart;
4631
+                                $xtimings['###10'] = microtime(true) - $xstart;
4632 4632
                                 /** This action is documented in geodirectory-functions/post-functions.php */
4633
-                                do_action( 'geodir_after_save_listing', $saved_post_id, $gd_post );
4634
-                                $xtimings['###11'] = microtime(true)-$xstart;
4633
+                                do_action('geodir_after_save_listing', $saved_post_id, $gd_post);
4634
+                                $xtimings['###11'] = microtime(true) - $xstart;
4635 4635
                                 if (isset($is_featured)) {
4636 4636
                                     geodir_save_post_meta($saved_post_id, 'is_featured', $is_featured);
4637 4637
                                 }
@@ -4641,7 +4641,7 @@  discard block
 block discarded – undo
4641 4641
                                 if (isset($gd_post['expire_date'])) {
4642 4642
                                     geodir_save_post_meta($saved_post_id, 'expire_date', $gd_post['expire_date']);
4643 4643
                                 }
4644
-                                $xtimings['###12'] = microtime(true)-$xstart;
4644
+                                $xtimings['###12'] = microtime(true) - $xstart;
4645 4645
                             }
4646 4646
                             
4647 4647
                             // WPML
@@ -4654,11 +4654,11 @@  discard block
 block discarded – undo
4654 4654
                 }
4655 4655
 
4656 4656
                 //undo some stuff to make the import quicker
4657
-                wp_defer_term_counting( false );
4658
-                wp_defer_comment_counting( false );
4659
-                $wpdb->query( 'COMMIT;' );
4660
-                $wpdb->query( 'SET autocommit = 1;' );
4661
-                $xtimings['###13'] = microtime(true)-$xstart;
4657
+                wp_defer_term_counting(false);
4658
+                wp_defer_comment_counting(false);
4659
+                $wpdb->query('COMMIT;');
4660
+                $wpdb->query('SET autocommit = 1;');
4661
+                $xtimings['###13'] = microtime(true) - $xstart;
4662 4662
                 $json = array();
4663 4663
                 $json['processed'] = $processed_actual;
4664 4664
                 $json['created'] = $created;
@@ -4667,13 +4667,13 @@  discard block
 block discarded – undo
4667 4667
                 $json['invalid'] = $invalid;
4668 4668
                 $json['invalid_addr'] = $invalid_addr;
4669 4669
                 $json['images'] = $images;
4670
-                $json['timing'] = microtime(true)-$xstart;
4670
+                $json['timing'] = microtime(true) - $xstart;
4671 4671
                 $json['timings'] = $xtimings;
4672 4672
                 
4673 4673
 
4674
-                wp_send_json( $json );
4674
+                wp_send_json($json);
4675 4675
                 exit;
4676
-            } else if ( $task == 'import_loc' ) {
4676
+            } else if ($task == 'import_loc') {
4677 4677
                 global $gd_post_types;
4678 4678
                 $gd_post_types = $post_types;
4679 4679
                 
@@ -4682,82 +4682,82 @@  discard block
 block discarded – undo
4682 4682
                     
4683 4683
                     if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4684 4684
                         $json['error'] = __('The file you are uploading is not valid. There are problems with the file columns.', 'geodirectory');
4685
-                        wp_send_json( $json );
4685
+                        wp_send_json($json);
4686 4686
                     }
4687 4687
                     
4688 4688
                     $gd_error_log = __('GD IMPORT LOCATIONS [ROW %d]:', 'geodirectory');
4689
-                    $gd_error_location = __( 'Could not be saved due to blank/invalid address(city, region, country, latitude, longitude)', 'geodirectory' );
4689
+                    $gd_error_location = __('Could not be saved due to blank/invalid address(city, region, country, latitude, longitude)', 'geodirectory');
4690 4690
                     for ($i = 1; $i <= $limit; $i++) {
4691 4691
                         $index = $processed + $i;
4692 4692
                         
4693 4693
                         if (isset($file[$index])) {
4694 4694
                             $row = $file[$index];
4695
-                            $row = array_map( 'trim', $row );
4695
+                            $row = array_map('trim', $row);
4696 4696
                             $data = array();
4697 4697
                             
4698
-                            foreach ($columns as $c => $column ) {
4698
+                            foreach ($columns as $c => $column) {
4699 4699
                                 if (in_array($column, array('location_id', 'latitude', 'longitude', 'city', 'city_slug', 'region', 'country', 'city_meta_title', 'city_meta_desc', 'city_desc', 'region_meta_title', 'region_meta_desc', 'region_desc', 'country_meta_title', 'country_meta_desc', 'country_desc'))) {
4700 4700
                                     $data[$column] = $row[$c];
4701 4701
                                 }
4702 4702
                             }
4703 4703
 
4704
-                            if ( empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude']) ) {
4704
+                            if (empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude'])) {
4705 4705
                                 $invalid++;
4706
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4706
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location);
4707 4707
                                 continue;
4708 4708
                             }
4709 4709
                             
4710 4710
                             $data['location_id'] = isset($data['location_id']) ? absint($data['location_id']) : 0;
4711 4711
                             
4712
-                            if ( $import_choice == 'update' ) {
4713
-                                if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4714
-                                    if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4712
+                            if ($import_choice == 'update') {
4713
+                                if ((int) $data['location_id'] > 0 && $location = geodir_get_location_by_id('', (int) $data['location_id'])) {
4714
+                                    if ($location_id = geodir_location_update_city($data, true, $location)) {
4715 4715
                                         $updated++;
4716 4716
                                     } else {
4717 4717
                                         $invalid++;
4718
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4718
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location);
4719 4719
                                     }
4720
-                                } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4721
-                                    $data['location_id'] = (int)$location->location_id;
4720
+                                } else if (!empty($data['city_slug']) && $location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug']))) {
4721
+                                    $data['location_id'] = (int) $location->location_id;
4722 4722
                                     
4723
-                                    if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region'] ) ) ) {
4724
-                                        $data['location_id'] = (int)$location->location_id;
4725
-                                    } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'region' => $data['region'] ) ) ) {
4726
-                                        $data['location_id'] = (int)$location->location_id;
4727
-                                    } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'] ) ) ) {
4728
-                                        $data['location_id'] = (int)$location->location_id;
4723
+                                    if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region']))) {
4724
+                                        $data['location_id'] = (int) $location->location_id;
4725
+                                    } else if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'region' => $data['region']))) {
4726
+                                        $data['location_id'] = (int) $location->location_id;
4727
+                                    } else if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'country' => $data['country']))) {
4728
+                                        $data['location_id'] = (int) $location->location_id;
4729 4729
                                     }
4730 4730
                                     
4731
-                                    if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4731
+                                    if ($location_id = geodir_location_update_city($data, true, $location)) {
4732 4732
                                         $updated++;
4733 4733
                                     } else {
4734 4734
                                         $invalid++;
4735
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4735
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location);
4736 4736
                                     }
4737 4737
                                 } else {
4738
-                                    if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4738
+                                    if ($location_id = geodir_location_insert_city($data, true)) {
4739 4739
                                         $created++;
4740 4740
                                     } else {
4741 4741
                                         $invalid++;
4742
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4742
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location);
4743 4743
                                     }
4744 4744
                                 }
4745
-                            } elseif ( $import_choice == 'skip' ) {
4746
-                                if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4745
+                            } elseif ($import_choice == 'skip') {
4746
+                                if ((int) $data['location_id'] > 0 && $location = geodir_get_location_by_id('', (int) $data['location_id'])) {
4747 4747
                                     $skipped++;
4748
-                                } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4748
+                                } else if (!empty($data['city_slug']) && $location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug']))) {
4749 4749
                                     $skipped++;
4750 4750
                                 } else {
4751
-                                    if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4751
+                                    if ($location_id = geodir_location_insert_city($data, true)) {
4752 4752
                                         $created++;
4753 4753
                                     } else {
4754 4754
                                         $invalid++;
4755
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4755
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location);
4756 4756
                                     }
4757 4757
                                 }
4758 4758
                             } else {
4759 4759
                                 $invalid++;
4760
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4760
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location);
4761 4761
                             }
4762 4762
                         }
4763 4763
                     }
@@ -4771,24 +4771,24 @@  discard block
 block discarded – undo
4771 4771
                 $json['invalid'] = $invalid;
4772 4772
                 $json['images'] = $images;
4773 4773
                 
4774
-                wp_send_json( $json );
4775
-            } else if ( $task == 'import_hood' ) {               
4774
+                wp_send_json($json);
4775
+            } else if ($task == 'import_hood') {               
4776 4776
                 if (!empty($file)) {
4777 4777
                     $columns = isset($file[0]) ? $file[0] : NULL;
4778 4778
                     
4779 4779
                     if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4780 4780
                         $json['error'] = __('The file you are uploading is not valid. There are problems with the file columns.', 'geodirectory');
4781
-                        wp_send_json( $json );
4781
+                        wp_send_json($json);
4782 4782
                     }
4783 4783
                     
4784 4784
                     $gd_error_log = __('GD IMPORT NEIGHBOURHOODS [ROW %d]:', 'geodirectory');
4785
-                    $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' );
4785
+                    $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');
4786 4786
                     for ($i = 1; $i <= $limit; $i++) {
4787 4787
                         $index = $processed + $i;
4788 4788
                         
4789 4789
                         if (isset($file[$index])) {
4790 4790
                             $row = $file[$index];
4791
-                            $row = array_map( 'trim', $row );
4791
+                            $row = array_map('trim', $row);
4792 4792
                             $data = array();
4793 4793
                             
4794 4794
                             foreach ($columns as $c => $column) {
@@ -4799,20 +4799,20 @@  discard block
 block discarded – undo
4799 4799
 
4800 4800
                             if (empty($data['neighbourhood_name']) || empty($data['latitude']) || empty($data['longitude'])) {
4801 4801
                                 $invalid++;
4802
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4802
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
4803 4803
                                 continue;
4804 4804
                             }
4805 4805
                             
4806 4806
                             $location_info = array();
4807
-                            if (!empty($data['location_id']) && (int)$data['location_id'] > 0) {
4808
-                                $location_info = geodir_get_location_by_id('', (int)$data['location_id']);
4807
+                            if (!empty($data['location_id']) && (int) $data['location_id'] > 0) {
4808
+                                $location_info = geodir_get_location_by_id('', (int) $data['location_id']);
4809 4809
                             } else if (!empty($data['city']) && !empty($data['region']) && !empty($data['country'])) {
4810 4810
                                 $location_info = geodir_get_location_by_slug('city', array('fields' => 'location_id', 'city' => $data['city'], 'country' => $data['country'], 'region' => $data['region']));
4811 4811
                             }
4812 4812
 
4813 4813
                             if (empty($location_info)) {
4814 4814
                                 $invalid++;
4815
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4815
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
4816 4816
                                 continue;
4817 4817
                             }
4818 4818
                             
@@ -4827,35 +4827,35 @@  discard block
 block discarded – undo
4827 4827
                             $hood_data['hood_longitude'] = $data['longitude'];
4828 4828
                             $hood_data['hood_location_id'] = $location_id;
4829 4829
                                     
4830
-                            if ( $import_choice == 'update' ) {
4831
-                                if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
4832
-                                    $hood_data['hood_id'] = (int)$data['neighbourhood_id'];
4830
+                            if ($import_choice == 'update') {
4831
+                                if ((int) $data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int) $data['neighbourhood_id']))) {
4832
+                                    $hood_data['hood_id'] = (int) $data['neighbourhood_id'];
4833 4833
                                     
4834 4834
                                     if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4835 4835
                                         $updated++;
4836 4836
                                     } else {
4837 4837
                                         $invalid++;
4838
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4838
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
4839 4839
                                     }
4840 4840
                                 } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
4841
-                                    $hood_data['hood_id'] = (int)$neighbourhood->hood_id;
4841
+                                    $hood_data['hood_id'] = (int) $neighbourhood->hood_id;
4842 4842
                                     
4843 4843
                                     if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4844 4844
                                         $updated++;
4845 4845
                                     } else {
4846 4846
                                         $invalid++;
4847
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4847
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
4848 4848
                                     }
4849 4849
                                 } else {
4850 4850
                                     if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4851 4851
                                         $created++;
4852 4852
                                     } else {
4853 4853
                                         $invalid++;
4854
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4854
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
4855 4855
                                     }
4856 4856
                                 }
4857
-                            } elseif ( $import_choice == 'skip' ) {
4858
-                                if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
4857
+                            } elseif ($import_choice == 'skip') {
4858
+                                if ((int) $data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int) $data['neighbourhood_id']))) {
4859 4859
                                     $skipped++;
4860 4860
                                 } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
4861 4861
                                     $skipped++;
@@ -4865,12 +4865,12 @@  discard block
 block discarded – undo
4865 4865
                                         $created++;
4866 4866
                                     } else {
4867 4867
                                         $invalid++;
4868
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4868
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
4869 4869
                                     }
4870 4870
                                 }
4871 4871
                             } else {
4872 4872
                                 $invalid++;
4873
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4873
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
4874 4874
                             }
4875 4875
                         }
4876 4876
                     }
@@ -4884,7 +4884,7 @@  discard block
 block discarded – undo
4884 4884
                 $json['invalid'] = $invalid;
4885 4885
                 $json['images'] = $images;
4886 4886
                 
4887
-                wp_send_json( $json );
4887
+                wp_send_json($json);
4888 4888
             }
4889 4889
         }
4890 4890
         break;
@@ -4928,29 +4928,29 @@  discard block
 block discarded – undo
4928 4928
  * }
4929 4929
  * @return int|bool Term id when success, false when fail.
4930 4930
  */
4931
-function geodir_imex_insert_term( $taxonomy, $term_data ) {
4932
-	if ( empty( $taxonomy ) || empty( $term_data ) ) {
4931
+function geodir_imex_insert_term($taxonomy, $term_data) {
4932
+	if (empty($taxonomy) || empty($term_data)) {
4933 4933
 		return false;
4934 4934
 	}
4935 4935
 	
4936
-	$term = isset( $term_data['name'] ) && !empty( $term_data['name'] ) ? $term_data['name'] : '';
4936
+	$term = isset($term_data['name']) && !empty($term_data['name']) ? $term_data['name'] : '';
4937 4937
 	$args = array();
4938
-	$args['description'] = isset( $term_data['description'] ) ? $term_data['description'] : '';
4939
-	$args['slug'] = isset( $term_data['slug'] ) ? $term_data['slug'] : '';
4940
-	$args['parent'] = isset( $term_data['parent'] ) ? (int)$term_data['parent'] : '';
4938
+	$args['description'] = isset($term_data['description']) ? $term_data['description'] : '';
4939
+	$args['slug'] = isset($term_data['slug']) ? $term_data['slug'] : '';
4940
+	$args['parent'] = isset($term_data['parent']) ? (int) $term_data['parent'] : '';
4941 4941
 	
4942
-	if ( ( !empty( $args['slug'] ) && term_exists( $args['slug'], $taxonomy ) ) || empty( $args['slug'] ) ) {
4943
-		$term_args = array_merge( $term_data, $args );
4944
-		$defaults = array( 'alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '');
4945
-		$term_args = wp_parse_args( $term_args, $defaults );
4946
-		$term_args = sanitize_term( $term_args, $taxonomy, 'db' );
4947
-		$args['slug'] = wp_unique_term_slug( $args['slug'], (object)$term_args );
4942
+	if ((!empty($args['slug']) && term_exists($args['slug'], $taxonomy)) || empty($args['slug'])) {
4943
+		$term_args = array_merge($term_data, $args);
4944
+		$defaults = array('alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '');
4945
+		$term_args = wp_parse_args($term_args, $defaults);
4946
+		$term_args = sanitize_term($term_args, $taxonomy, 'db');
4947
+		$args['slug'] = wp_unique_term_slug($args['slug'], (object) $term_args);
4948 4948
 	}
4949 4949
 	
4950
-    if( !empty( $term ) ) {
4951
-		$result = wp_insert_term( $term, $taxonomy, $args );
4952
-        if( !is_wp_error( $result ) ) {
4953
-            return isset( $result['term_id'] ) ? $result['term_id'] : 0;
4950
+    if (!empty($term)) {
4951
+		$result = wp_insert_term($term, $taxonomy, $args);
4952
+        if (!is_wp_error($result)) {
4953
+            return isset($result['term_id']) ? $result['term_id'] : 0;
4954 4954
         }
4955 4955
     }
4956 4956
 	
@@ -4980,36 +4980,36 @@  discard block
 block discarded – undo
4980 4980
  * }
4981 4981
  * @return int|bool Term id when success, false when fail.
4982 4982
  */
4983
-function geodir_imex_update_term( $taxonomy, $term_data ) {
4984
-	if ( empty( $taxonomy ) || empty( $term_data ) ) {
4983
+function geodir_imex_update_term($taxonomy, $term_data) {
4984
+	if (empty($taxonomy) || empty($term_data)) {
4985 4985
 		return false;
4986 4986
 	}
4987 4987
 	
4988
-	$term_id = isset( $term_data['term_id'] ) && !empty( $term_data['term_id'] ) ? $term_data['term_id'] : 0;
4988
+	$term_id = isset($term_data['term_id']) && !empty($term_data['term_id']) ? $term_data['term_id'] : 0;
4989 4989
 	
4990 4990
 	$args = array();
4991
-	$args['description'] = isset( $term_data['description'] ) ? $term_data['description'] : '';
4992
-	$args['slug'] = isset( $term_data['slug'] ) ? $term_data['slug'] : '';
4993
-	$args['parent'] = isset( $term_data['parent'] ) ? (int)$term_data['parent'] : '';
4991
+	$args['description'] = isset($term_data['description']) ? $term_data['description'] : '';
4992
+	$args['slug'] = isset($term_data['slug']) ? $term_data['slug'] : '';
4993
+	$args['parent'] = isset($term_data['parent']) ? (int) $term_data['parent'] : '';
4994 4994
 	
4995
-	if ( $term_id > 0 && $term_info = (array)get_term( $term_id, $taxonomy ) ) {
4995
+	if ($term_id > 0 && $term_info = (array) get_term($term_id, $taxonomy)) {
4996 4996
 		$term_data['term_id'] = $term_info['term_id'];
4997 4997
 		
4998
-		$result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
4998
+		$result = wp_update_term($term_data['term_id'], $taxonomy, $term_data);
4999 4999
 		
5000
-		if( !is_wp_error( $result ) ) {
5001
-            return isset( $result['term_id'] ) ? $result['term_id'] : 0;
5000
+		if (!is_wp_error($result)) {
5001
+            return isset($result['term_id']) ? $result['term_id'] : 0;
5002 5002
         }
5003
-	} else if ( $term_data['slug'] != '' && $term_info = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
5003
+	} else if ($term_data['slug'] != '' && $term_info = (array) term_exists($term_data['slug'], $taxonomy)) {
5004 5004
 		$term_data['term_id'] = $term_info['term_id'];
5005 5005
 		
5006
-		$result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
5006
+		$result = wp_update_term($term_data['term_id'], $taxonomy, $term_data);
5007 5007
 		
5008
-		if( !is_wp_error( $result ) ) {
5009
-            return isset( $result['term_id'] ) ? $result['term_id'] : 0;
5008
+		if (!is_wp_error($result)) {
5009
+            return isset($result['term_id']) ? $result['term_id'] : 0;
5010 5010
         }
5011 5011
 	} else {
5012
-		return geodir_imex_insert_term( $taxonomy, $term_data );
5012
+		return geodir_imex_insert_term($taxonomy, $term_data);
5013 5013
 	}
5014 5014
 	
5015 5015
 	return false;
@@ -5028,20 +5028,20 @@  discard block
 block discarded – undo
5028 5028
  * @param string $post_type Post type.
5029 5029
  * @return int Posts count.
5030 5030
  */
5031
-function geodir_get_posts_count( $post_type ) {
5031
+function geodir_get_posts_count($post_type) {
5032 5032
     global $wpdb, $plugin_prefix;
5033 5033
 
5034
-    if ( !post_type_exists( $post_type ) ) {
5034
+    if (!post_type_exists($post_type)) {
5035 5035
         return 0;
5036 5036
     }
5037 5037
         
5038
-    $table = $plugin_prefix . $post_type . '_detail';
5038
+    $table = $plugin_prefix.$post_type.'_detail';
5039 5039
 
5040 5040
     // Skip listing with statuses trash, auto-draft etc...
5041 5041
     $skip_statuses = geodir_imex_export_skip_statuses();
5042 5042
     $where_statuses = '';
5043
-    if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5044
-        $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5043
+    if (!empty($skip_statuses) && is_array($skip_statuses)) {
5044
+        $where_statuses = "AND `".$wpdb->posts."`.`post_status` NOT IN('".implode("','", $skip_statuses)."')";
5045 5045
     }
5046 5046
     
5047 5047
     /**
@@ -5052,11 +5052,11 @@  discard block
 block discarded – undo
5052 5052
      *
5053 5053
      * @param string $where SQL where clause part.
5054 5054
      */
5055
-    $where_statuses = apply_filters( 'geodir_get_posts_count', $where_statuses, $post_type );
5055
+    $where_statuses = apply_filters('geodir_get_posts_count', $where_statuses, $post_type);
5056 5056
 
5057
-    $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 );
5057
+    $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);
5058 5058
 
5059
-    $posts_count = (int)$wpdb->get_var( $query );
5059
+    $posts_count = (int) $wpdb->get_var($query);
5060 5060
     
5061 5061
     /**
5062 5062
      * Modify returned post counts for the current post type.
@@ -5067,7 +5067,7 @@  discard block
 block discarded – undo
5067 5067
      * @param int $posts_count Post counts.
5068 5068
      * @param string $post_type Post type.
5069 5069
      */
5070
-    $posts_count = apply_filters( 'geodir_imex_count_posts', $posts_count, $post_type );
5070
+    $posts_count = apply_filters('geodir_imex_count_posts', $posts_count, $post_type);
5071 5071
 
5072 5072
     return $posts_count;
5073 5073
 }
@@ -5089,19 +5089,19 @@  discard block
 block discarded – undo
5089 5089
  * @param int $page_no Page number. Default 0.
5090 5090
  * @return array Array of posts data.
5091 5091
  */
5092
-function geodir_imex_get_posts( $post_type, $per_page = 0, $page_no = 0 ) {	
5092
+function geodir_imex_get_posts($post_type, $per_page = 0, $page_no = 0) {	
5093 5093
 	global $wp_filesystem;
5094 5094
 
5095
-	$posts = geodir_get_export_posts( $post_type, $per_page, $page_no );
5095
+	$posts = geodir_get_export_posts($post_type, $per_page, $page_no);
5096 5096
 
5097 5097
 	$csv_rows = array();
5098 5098
 	
5099
-	if ( !empty( $posts ) ) {
5100
-		$is_payment_plugin = is_plugin_active( 'geodir_payment_manager/geodir_payment_manager.php' );
5099
+	if (!empty($posts)) {
5100
+		$is_payment_plugin = is_plugin_active('geodir_payment_manager/geodir_payment_manager.php');
5101 5101
 		$location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
5102
-		$location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
5102
+		$location_allowed = function_exists('geodir_cpt_no_location') && geodir_cpt_no_location($post_type) ? false : true;
5103 5103
 		$neighbourhood_active = $location_manager && $location_allowed && get_option('location_neighbourhoods') ? true : false;
5104
-		$is_claim_active = is_plugin_active( 'geodir_claim_listing/geodir_claim_listing.php' ) && get_option('geodir_claim_enable') === 'yes' ? true : false;
5104
+		$is_claim_active = is_plugin_active('geodir_claim_listing/geodir_claim_listing.php') && get_option('geodir_claim_enable') === 'yes' ? true : false;
5105 5105
 		$is_events_active = function_exists('geodir_event_plugin_activated') ? true : false;
5106 5106
 		$is_custom_posts_active = function_exists('geodir_custom_post_type_plugin_activated') ? true : false;
5107 5107
 		
@@ -5116,7 +5116,7 @@  discard block
 block discarded – undo
5116 5116
 		$csv_row[] = 'default_category';
5117 5117
 		$csv_row[] = 'post_tags';
5118 5118
 		$csv_row[] = 'post_type';
5119
-		if ( $post_type == 'gd_event' ) {
5119
+		if ($post_type == 'gd_event') {
5120 5120
 			$csv_row[] = 'event_date';
5121 5121
 			$csv_row[] = 'event_enddate';
5122 5122
 			$csv_row[] = 'starttime';
@@ -5168,25 +5168,25 @@  discard block
 block discarded – undo
5168 5168
 		$csv_row[] = 'geodir_video';
5169 5169
 		$csv_row[] = 'geodir_special_offers';
5170 5170
 		if ($is_events_active || $is_custom_posts_active) {
5171
-			$csv_row[] = !empty($post_ypes[$post_type]['linkable_to']) ? 'linked_' . $post_ypes[$post_type]['linkable_to'] . '_ID' : 'linked_cpt_ID';
5171
+			$csv_row[] = !empty($post_ypes[$post_type]['linkable_to']) ? 'linked_'.$post_ypes[$post_type]['linkable_to'].'_ID' : 'linked_cpt_ID';
5172 5172
 		}
5173 5173
 		// WPML
5174
-		$is_wpml = geodir_wpml_is_post_type_translated( $post_type );
5174
+		$is_wpml = geodir_wpml_is_post_type_translated($post_type);
5175 5175
 		if ($is_wpml) {
5176 5176
 			$csv_row[] = 'language';
5177 5177
 			$csv_row[] = 'original_post_id';
5178 5178
 		}
5179 5179
 		// WPML
5180 5180
 
5181
-		$custom_fields = geodir_imex_get_custom_fields( $post_type );
5182
-		if ( !empty( $custom_fields ) ) {
5183
-			foreach ( $custom_fields as $custom_field ) {
5181
+		$custom_fields = geodir_imex_get_custom_fields($post_type);
5182
+		if (!empty($custom_fields)) {
5183
+			foreach ($custom_fields as $custom_field) {
5184 5184
 				$csv_row[] = $custom_field->htmlvar_name;
5185 5185
 			}
5186 5186
 		}
5187 5187
 
5188 5188
 		// Export franchise fields
5189
-		$is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false;
5189
+		$is_franchise_active = is_plugin_active('geodir_franchise/geodir_franchise.php') && geodir_franchise_enabled($post_type) ? true : false;
5190 5190
 		if ($is_franchise_active) {
5191 5191
 			$csv_row[] = 'gd_is_franchise';
5192 5192
 			$csv_row[] = 'gd_franchise_lock';
@@ -5207,28 +5207,28 @@  discard block
 block discarded – undo
5207 5207
 		$csv_rows[] = $csv_row;
5208 5208
 
5209 5209
 		$images_count = 5;
5210
-        $xx=0;
5211
-		foreach ( $posts as $post ) {$xx++;
5210
+        $xx = 0;
5211
+		foreach ($posts as $post) {$xx++;
5212 5212
 			$post_id = $post['ID'];
5213 5213
 			
5214
-			$gd_post_info = geodir_get_post_info( $post_id );
5215
-			$post_info = (array)$gd_post_info;
5214
+			$gd_post_info = geodir_get_post_info($post_id);
5215
+			$post_info = (array) $gd_post_info;
5216 5216
 			
5217
-			$taxonomy_category = $post_type . 'category';
5218
-			$taxonomy_tags = $post_type . '_tags';
5217
+			$taxonomy_category = $post_type.'category';
5218
+			$taxonomy_tags = $post_type.'_tags';
5219 5219
 			
5220 5220
 			$post_category = '';
5221 5221
 			$default_category_id = $gd_post_info->default_category;
5222 5222
 			$default_category = '';
5223 5223
 			$post_tags = '';
5224
-			$terms = wp_get_post_terms( $post_id, array( $taxonomy_category, $taxonomy_tags ) );
5224
+			$terms = wp_get_post_terms($post_id, array($taxonomy_category, $taxonomy_tags));
5225 5225
 			
5226
-			if ( !empty( $terms ) && !is_wp_error( $terms ) ) {
5226
+			if (!empty($terms) && !is_wp_error($terms)) {
5227 5227
 				$post_category = array();
5228 5228
 				$post_tags = array();
5229 5229
 			
5230
-				foreach ( $terms as $term ) {
5231
-					if ( $term->taxonomy == $taxonomy_category ) {
5230
+				foreach ($terms as $term) {
5231
+					if ($term->taxonomy == $taxonomy_category) {
5232 5232
 						$post_category[] = $term->name;
5233 5233
 						
5234 5234
 						if ($default_category_id == $term->term_id) {
@@ -5236,7 +5236,7 @@  discard block
 block discarded – undo
5236 5236
 						}
5237 5237
 					}
5238 5238
 					
5239
-					if ( $term->taxonomy == $taxonomy_tags ) {
5239
+					if ($term->taxonomy == $taxonomy_tags) {
5240 5240
 						$post_tags[] = $term->name;
5241 5241
 					}
5242 5242
 				}
@@ -5244,47 +5244,47 @@  discard block
 block discarded – undo
5244 5244
 				if (empty($default_category) && !empty($post_category)) {
5245 5245
 					$default_category = $post_category[0]; // Set first one as default category.
5246 5246
 				}
5247
-				$post_category = !empty( $post_category ) ? implode( ',', $post_category ) : '';
5248
-				$post_tags = !empty( $post_tags ) ? implode( ',', $post_tags ) : '';
5247
+				$post_category = !empty($post_category) ? implode(',', $post_category) : '';
5248
+				$post_tags = !empty($post_tags) ? implode(',', $post_tags) : '';
5249 5249
 			}
5250 5250
 
5251 5251
 			// Franchise data
5252
-			if ($is_franchise_active && isset($post_info['franchise']) && (int)$post_info['franchise'] > 0 && geodir_franchise_check((int)$post_info['franchise'])) {
5252
+			if ($is_franchise_active && isset($post_info['franchise']) && (int) $post_info['franchise'] > 0 && geodir_franchise_check((int) $post_info['franchise'])) {
5253 5253
 				$franchise_id = $post_info['franchise'];
5254 5254
 				$gd_franchise_info = geodir_get_post_info($franchise_id);
5255 5255
 
5256 5256
 				if (geodir_franchise_pkg_is_active($gd_franchise_info)) {
5257
-					$franchise_info = (array)$gd_franchise_info;
5257
+					$franchise_info = (array) $gd_franchise_info;
5258 5258
 					$locked_fields = geodir_franchise_get_locked_fields($franchise_id, true);
5259 5259
 					
5260 5260
 					if (!empty($locked_fields)) {
5261
-						foreach( $locked_fields as $locked_field) {
5261
+						foreach ($locked_fields as $locked_field) {
5262 5262
 							if (isset($post_info[$locked_field]) && isset($franchise_info[$locked_field])) {
5263 5263
 								$post_info[$locked_field] = $franchise_info[$locked_field];
5264 5264
 							}
5265 5265
 							
5266 5266
 							if (in_array($taxonomy_category, $locked_fields) || in_array('post_tags', $locked_fields)) {
5267
-								$franchise_terms = wp_get_post_terms( $franchise_id, array( $taxonomy_category, $taxonomy_tags ) );
5267
+								$franchise_terms = wp_get_post_terms($franchise_id, array($taxonomy_category, $taxonomy_tags));
5268 5268
 			
5269
-								if ( !empty( $franchise_terms ) && !is_wp_error( $franchise_terms ) ) {
5269
+								if (!empty($franchise_terms) && !is_wp_error($franchise_terms)) {
5270 5270
 									$franchise_post_category = array();
5271 5271
 									$franchise_post_tags = array();
5272 5272
 								
5273
-									foreach ( $franchise_terms as $franchise_term ) {
5274
-										if ( $franchise_term->taxonomy == $taxonomy_category ) {
5273
+									foreach ($franchise_terms as $franchise_term) {
5274
+										if ($franchise_term->taxonomy == $taxonomy_category) {
5275 5275
 											$franchise_post_category[] = $franchise_term->name;
5276 5276
 										}
5277 5277
 										
5278
-										if ( $franchise_term->taxonomy == $taxonomy_tags ) {
5278
+										if ($franchise_term->taxonomy == $taxonomy_tags) {
5279 5279
 											$franchise_post_tags[] = $franchise_term->name;
5280 5280
 										}
5281 5281
 									}
5282 5282
 									
5283 5283
 									if (in_array($taxonomy_category, $locked_fields)) {
5284
-										$post_category = !empty( $franchise_post_category ) ? implode( ',', $franchise_post_category ) : '';
5284
+										$post_category = !empty($franchise_post_category) ? implode(',', $franchise_post_category) : '';
5285 5285
 									}
5286 5286
 									if (in_array('post_tags', $locked_fields)) {
5287
-										$post_tags = !empty( $franchise_post_tags ) ? implode( ',', $franchise_post_tags ) : '';
5287
+										$post_tags = !empty($franchise_post_tags) ? implode(',', $franchise_post_tags) : '';
5288 5288
 									}
5289 5289
 								}
5290 5290
 							}
@@ -5293,18 +5293,18 @@  discard block
 block discarded – undo
5293 5293
 				}
5294 5294
 			}
5295 5295
 						
5296
-			$post_images = geodir_get_images( $post_id );
5296
+			$post_images = geodir_get_images($post_id);
5297 5297
 			$current_images = array();
5298
-			if ( !empty( $post_images ) ) {
5299
-				foreach ( $post_images as $post_image ) {
5300
-					$post_image = (array)$post_image;
5301
-					$image = !empty( $post_image ) && isset( $post_image['path'] ) && $wp_filesystem->is_file( $post_image['path'] ) && $wp_filesystem->exists( $post_image['path'] ) ? $post_image['src'] : '';
5302
-					if ( $image ) {
5298
+			if (!empty($post_images)) {
5299
+				foreach ($post_images as $post_image) {
5300
+					$post_image = (array) $post_image;
5301
+					$image = !empty($post_image) && isset($post_image['path']) && $wp_filesystem->is_file($post_image['path']) && $wp_filesystem->exists($post_image['path']) ? $post_image['src'] : '';
5302
+					if ($image) {
5303 5303
 						$current_images[] = $image;
5304 5304
 					}
5305 5305
 				}
5306 5306
 				
5307
-				$images_count = max( $images_count, count( $current_images ) );
5307
+				$images_count = max($images_count, count($current_images));
5308 5308
 			}
5309 5309
 
5310 5310
 			$csv_row = array();
@@ -5316,7 +5316,7 @@  discard block
 block discarded – undo
5316 5316
 			$csv_row[] = $default_category; // default_category
5317 5317
 			$csv_row[] = $post_tags; // post_tags
5318 5318
 			$csv_row[] = $post_type; // post_type
5319
-			if ( $post_type == 'gd_event' ) {
5319
+			if ($post_type == 'gd_event') {
5320 5320
 				$event_data = geodir_imex_get_event_data($post, $gd_post_info);
5321 5321
 				$csv_row[] = $event_data['event_date']; // event_date
5322 5322
 				$csv_row[] = $event_data['event_enddate']; // enddate
@@ -5337,12 +5337,12 @@  discard block
 block discarded – undo
5337 5337
 				$csv_row[] = $event_data['recurring_end_date']; // repeat_end
5338 5338
 			}
5339 5339
 			$csv_row[] = $post_info['post_status']; // post_status
5340
-			$csv_row[] = (int)$post_info['is_featured'] == 1 ? 1 : ''; // is_featured
5340
+			$csv_row[] = (int) $post_info['is_featured'] == 1 ? 1 : ''; // is_featured
5341 5341
             if ($is_claim_active) {
5342
-                $csv_row[] = !empty($post_info['claimed']) && (int)$post_info['claimed'] == 1 ? 1 : ''; // claimed
5342
+                $csv_row[] = !empty($post_info['claimed']) && (int) $post_info['claimed'] == 1 ? 1 : ''; // claimed
5343 5343
             }
5344 5344
 			if ($is_payment_plugin) {
5345
-				$csv_row[] = (int)$post_info['package_id']; // package_id
5345
+				$csv_row[] = (int) $post_info['package_id']; // package_id
5346 5346
 				$csv_row[] = $post_info['alive_days'] !== '' ? absint($post_info['alive_days']) : ''; // alive_days
5347 5347
 				$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
5348 5348
 			}
@@ -5378,18 +5378,18 @@  discard block
 block discarded – undo
5378 5378
 			$csv_row[] = stripslashes($post_info['geodir_video']); // geodir_video
5379 5379
 			$csv_row[] = stripslashes($post_info['geodir_special_offers']); // geodir_special_offers
5380 5380
 			if ($is_events_active || $is_custom_posts_active) {
5381
-				$csv_row[] = !empty($post_info['geodir_link_business']) ? (int)$post_info['geodir_link_business'] : ''; // linked business
5381
+				$csv_row[] = !empty($post_info['geodir_link_business']) ? (int) $post_info['geodir_link_business'] : ''; // linked business
5382 5382
 			}
5383 5383
 			// WPML
5384 5384
 			if ($is_wpml) {
5385
-				$csv_row[] = geodir_get_language_for_element( $post_id, 'post_' . $post_type );
5386
-				$csv_row[] = geodir_imex_original_post_id( $post_id, 'post_' . $post_type );
5385
+				$csv_row[] = geodir_get_language_for_element($post_id, 'post_'.$post_type);
5386
+				$csv_row[] = geodir_imex_original_post_id($post_id, 'post_'.$post_type);
5387 5387
 			}
5388 5388
 			// WPML
5389 5389
 			
5390
-			if ( !empty( $custom_fields ) ) {
5391
-				foreach ( $custom_fields as $custom_field ) {
5392
-					$csv_row[] = isset( $post_info[$custom_field->htmlvar_name] ) ? $post_info[$custom_field->htmlvar_name] : '';
5390
+			if (!empty($custom_fields)) {
5391
+				foreach ($custom_fields as $custom_field) {
5392
+					$csv_row[] = isset($post_info[$custom_field->htmlvar_name]) ? $post_info[$custom_field->htmlvar_name] : '';
5393 5393
 				}
5394 5394
 			}
5395 5395
 			
@@ -5400,15 +5400,15 @@  discard block
 block discarded – undo
5400 5400
 				$franchise = '';
5401 5401
 					
5402 5402
 				if (geodir_franchise_pkg_is_active($gd_post_info)) {
5403
-					$gd_is_franchise = (int)get_post_meta( $post_id, 'gd_is_franchise', true );
5404
-					$locaked_fields = $gd_is_franchise ? get_post_meta( $post_id, 'gd_franchise_lock', true ) : '';
5403
+					$gd_is_franchise = (int) get_post_meta($post_id, 'gd_is_franchise', true);
5404
+					$locaked_fields = $gd_is_franchise ? get_post_meta($post_id, 'gd_franchise_lock', true) : '';
5405 5405
 					$locaked_fields = (is_array($locaked_fields) && !empty($locaked_fields) ? implode(",", $locaked_fields) : '');
5406
-					$franchise = !$gd_is_franchise && isset($post_info['franchise']) && (int)$post_info['franchise'] > 0 ? (int)$post_info['franchise'] : 0; // franchise id
5406
+					$franchise = !$gd_is_franchise && isset($post_info['franchise']) && (int) $post_info['franchise'] > 0 ? (int) $post_info['franchise'] : 0; // franchise id
5407 5407
 				}
5408 5408
 				
5409
-				$csv_row[] = (int)$gd_is_franchise; // gd_is_franchise
5409
+				$csv_row[] = (int) $gd_is_franchise; // gd_is_franchise
5410 5410
 				$csv_row[] = $locaked_fields; // gd_franchise_lock fields
5411
-				$csv_row[] = (int)$franchise; // franchise id
5411
+				$csv_row[] = (int) $franchise; // franchise id
5412 5412
 			}
5413 5413
             
5414 5414
             /**
@@ -5422,15 +5422,15 @@  discard block
 block discarded – undo
5422 5422
              */
5423 5423
             $csv_row = apply_filters('geodir_export_listing_csv_column_values', $csv_row, $post_info);
5424 5424
 			
5425
-			for ( $c = 0; $c < $images_count; $c++ ) {
5426
-				$csv_row[] = isset( $current_images[$c] ) ? $current_images[$c] : ''; // IMAGE
5425
+			for ($c = 0; $c < $images_count; $c++) {
5426
+				$csv_row[] = isset($current_images[$c]) ? $current_images[$c] : ''; // IMAGE
5427 5427
 			}
5428 5428
 			
5429 5429
 			$csv_rows[] = $csv_row;
5430 5430
 
5431 5431
 		}
5432 5432
 
5433
-		for ( $c = 0; $c < $images_count; $c++ ) {
5433
+		for ($c = 0; $c < $images_count; $c++) {
5434 5434
 			$csv_rows[0][] = 'IMAGE';
5435 5435
 		}
5436 5436
 	}
@@ -5452,30 +5452,30 @@  discard block
 block discarded – undo
5452 5452
  * @param int $page_no Page number. Default 0.
5453 5453
  * @return array Array of posts data.
5454 5454
  */
5455
-function geodir_get_export_posts( $post_type, $per_page = 0, $page_no = 0 ) {
5455
+function geodir_get_export_posts($post_type, $per_page = 0, $page_no = 0) {
5456 5456
     global $wpdb, $plugin_prefix;
5457 5457
 
5458
-    if ( ! post_type_exists( $post_type ) )
5458
+    if (!post_type_exists($post_type))
5459 5459
         return new stdClass;
5460 5460
         
5461
-    $table = $plugin_prefix . $post_type . '_detail';
5461
+    $table = $plugin_prefix.$post_type.'_detail';
5462 5462
 
5463 5463
     $limit = '';
5464
-    if ( $per_page > 0 && $page_no > 0 ) {
5465
-        $offset = ( $page_no - 1 ) * $per_page;
5464
+    if ($per_page > 0 && $page_no > 0) {
5465
+        $offset = ($page_no - 1) * $per_page;
5466 5466
         
5467
-        if ( $offset > 0 ) {
5468
-            $limit = " LIMIT " . $offset . "," . $per_page;
5467
+        if ($offset > 0) {
5468
+            $limit = " LIMIT ".$offset.",".$per_page;
5469 5469
         } else {
5470
-            $limit = " LIMIT " . $per_page;
5470
+            $limit = " LIMIT ".$per_page;
5471 5471
         }
5472 5472
     }
5473 5473
 
5474 5474
     // Skip listing with statuses trash, auto-draft etc...
5475 5475
     $skip_statuses = geodir_imex_export_skip_statuses();
5476 5476
     $where_statuses = '';
5477
-    if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5478
-        $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5477
+    if (!empty($skip_statuses) && is_array($skip_statuses)) {
5478
+        $where_statuses = "AND `".$wpdb->posts."`.`post_status` NOT IN('".implode("','", $skip_statuses)."')";
5479 5479
     }
5480 5480
     
5481 5481
     /**
@@ -5486,9 +5486,9 @@  discard block
 block discarded – undo
5486 5486
      *
5487 5487
      * @param string $where SQL where clause part.
5488 5488
      */
5489
-    $where_statuses = apply_filters( 'geodir_get_export_posts', $where_statuses, $post_type );
5489
+    $where_statuses = apply_filters('geodir_get_export_posts', $where_statuses, $post_type);
5490 5490
 
5491
-    $query = $wpdb->prepare( "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, $post_type );
5491
+    $query = $wpdb->prepare("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, $post_type);
5492 5492
     /**
5493 5493
      * Modify returned posts SQL query for the current post type.
5494 5494
      *
@@ -5498,8 +5498,8 @@  discard block
 block discarded – undo
5498 5498
      * @param int $query The SQL query.
5499 5499
      * @param string $post_type Post type.
5500 5500
      */
5501
-    $query = apply_filters( 'geodir_imex_export_posts_query', $query, $post_type );
5502
-    $results = (array)$wpdb->get_results( $query, ARRAY_A );
5501
+    $query = apply_filters('geodir_imex_export_posts_query', $query, $post_type);
5502
+    $results = (array) $wpdb->get_results($query, ARRAY_A);
5503 5503
 
5504 5504
     /**
5505 5505
      * Modify returned post results for the current post type.
@@ -5510,7 +5510,7 @@  discard block
 block discarded – undo
5510 5510
      * @param object $results An object containing all post ids.
5511 5511
      * @param string $post_type Post type.
5512 5512
      */
5513
-    return apply_filters( 'geodir_export_posts', $results, $post_type );
5513
+    return apply_filters('geodir_export_posts', $results, $post_type);
5514 5514
 }
5515 5515
 
5516 5516
 /**
@@ -5528,24 +5528,24 @@  discard block
 block discarded – undo
5528 5528
  * @param string $post_type Post type.
5529 5529
  * @return string The SQL query.
5530 5530
  */
5531
-function geodir_imex_get_events_query( $query, $post_type ) {
5532
-    if ( $post_type == 'gd_event' ) {
5531
+function geodir_imex_get_events_query($query, $post_type) {
5532
+    if ($post_type == 'gd_event') {
5533 5533
         global $wpdb, $plugin_prefix;
5534 5534
         
5535
-        $table = $plugin_prefix . $post_type . '_detail';
5535
+        $table = $plugin_prefix.$post_type.'_detail';
5536 5536
         $schedule_table = EVENT_SCHEDULE;
5537 5537
         
5538 5538
         // Skip listing with statuses trash, auto-draft etc...
5539 5539
         $skip_statuses = geodir_imex_export_skip_statuses();
5540 5540
         $where_statuses = '';
5541
-        if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5542
-            $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5541
+        if (!empty($skip_statuses) && is_array($skip_statuses)) {
5542
+            $where_statuses = "AND `".$wpdb->posts."`.`post_status` NOT IN('".implode("','", $skip_statuses)."')";
5543 5543
         }
5544 5544
         
5545 5545
         /** This action is documented in geodirectory-functions/geodirectory-admin/admin_functions.php */
5546
-        $where_statuses = apply_filters( 'geodir_get_export_posts', $where_statuses, $post_type );
5546
+        $where_statuses = apply_filters('geodir_get_export_posts', $where_statuses, $post_type);
5547 5547
 
5548
-        $query = $wpdb->prepare( "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", $post_type );
5548
+        $query = $wpdb->prepare("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", $post_type);
5549 5549
     }
5550 5550
 
5551 5551
     return $query;
@@ -5569,35 +5569,35 @@  discard block
 block discarded – undo
5569 5569
  * @param  string $post_type Post type.
5570 5570
  * @return int Total terms count.
5571 5571
  */
5572
-function geodir_get_terms_count( $post_type ) {
5573
-    $args = array( 'hide_empty' => 0 );
5572
+function geodir_get_terms_count($post_type) {
5573
+    $args = array('hide_empty' => 0);
5574 5574
 
5575
-    remove_all_filters( 'get_terms' );
5575
+    remove_all_filters('get_terms');
5576 5576
 
5577
-    $taxonomy = $post_type . 'category';
5577
+    $taxonomy = $post_type.'category';
5578 5578
 
5579 5579
     // WPML
5580 5580
     $is_wpml = geodir_is_wpml();
5581 5581
     $active_lang = 'all';
5582
-    if ( $is_wpml ) {
5582
+    if ($is_wpml) {
5583 5583
         global $sitepress;
5584 5584
         $active_lang = $sitepress->get_current_language();
5585 5585
         
5586
-        if ( $active_lang != 'all' ) {
5587
-            $sitepress->switch_lang( 'all', true );
5586
+        if ($active_lang != 'all') {
5587
+            $sitepress->switch_lang('all', true);
5588 5588
         }
5589 5589
     }
5590 5590
     // WPML
5591 5591
             
5592
-    $count_terms = wp_count_terms( $taxonomy, $args );
5592
+    $count_terms = wp_count_terms($taxonomy, $args);
5593 5593
 
5594 5594
     // WPML
5595
-    if ( $is_wpml && $active_lang !== 'all' ) {
5595
+    if ($is_wpml && $active_lang !== 'all') {
5596 5596
         global $sitepress;
5597
-        $sitepress->switch_lang( $active_lang, true );
5597
+        $sitepress->switch_lang($active_lang, true);
5598 5598
     }
5599 5599
     // WPML
5600
-    $count_terms = !is_wp_error( $count_terms ) ? $count_terms : 0;
5600
+    $count_terms = !is_wp_error($count_terms) ? $count_terms : 0;
5601 5601
      
5602 5602
     return $count_terms;
5603 5603
 }
@@ -5614,23 +5614,23 @@  discard block
 block discarded – undo
5614 5614
  * @param int $page_no Page number. Default 0.
5615 5615
  * @return array Array of terms data.
5616 5616
  */
5617
-function geodir_imex_get_terms( $post_type, $per_page = 0, $page_no = 0 ) {
5618
-	$args = array( 'hide_empty' => 0, 'orderby' => 'id' );
5617
+function geodir_imex_get_terms($post_type, $per_page = 0, $page_no = 0) {
5618
+	$args = array('hide_empty' => 0, 'orderby' => 'id');
5619 5619
 	
5620
-	remove_all_filters( 'get_terms' );
5620
+	remove_all_filters('get_terms');
5621 5621
 	
5622
-	$taxonomy = $post_type . 'category';
5622
+	$taxonomy = $post_type.'category';
5623 5623
 	
5624
-	if ( $per_page > 0 && $page_no > 0 ) {
5625
-		$args['offset'] = ( $page_no - 1 ) * $per_page;
5624
+	if ($per_page > 0 && $page_no > 0) {
5625
+		$args['offset'] = ($page_no - 1) * $per_page;
5626 5626
 		$args['number'] = $per_page;
5627 5627
 	}
5628 5628
 	
5629
-	$terms = get_terms( $taxonomy, $args );
5629
+	$terms = get_terms($taxonomy, $args);
5630 5630
 
5631 5631
 	$csv_rows = array();
5632 5632
 	
5633
-	if ( !empty( $terms ) ) {
5633
+	if (!empty($terms)) {
5634 5634
 		$csv_row = array();
5635 5635
 		$csv_row[] = 'cat_id';
5636 5636
 		$csv_row[] = 'cat_name';
@@ -5639,7 +5639,7 @@  discard block
 block discarded – undo
5639 5639
 		$csv_row[] = 'cat_parent';
5640 5640
 		$csv_row[] = 'cat_schema';
5641 5641
         // WPML
5642
-		$is_wpml = geodir_wpml_is_taxonomy_translated( $taxonomy );
5642
+		$is_wpml = geodir_wpml_is_taxonomy_translated($taxonomy);
5643 5643
 		if ($is_wpml) {
5644 5644
 			$csv_row[] = 'cat_language';
5645 5645
             $csv_row[] = 'cat_id_original';
@@ -5652,16 +5652,16 @@  discard block
 block discarded – undo
5652 5652
 		
5653 5653
 		$csv_rows[] = $csv_row;
5654 5654
 		
5655
-		foreach ( $terms as $term ) {
5656
-			$cat_icon = geodir_get_tax_meta( $term->term_id, 'ct_cat_icon', false, $post_type );
5657
-			$cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : '';
5655
+		foreach ($terms as $term) {
5656
+			$cat_icon = geodir_get_tax_meta($term->term_id, 'ct_cat_icon', false, $post_type);
5657
+			$cat_icon = !empty($cat_icon) && isset($cat_icon['src']) ? $cat_icon['src'] : '';
5658 5658
 			
5659
-			$cat_image = geodir_get_default_catimage( $term->term_id, $post_type );
5660
-			$cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : ''; 
5659
+			$cat_image = geodir_get_default_catimage($term->term_id, $post_type);
5660
+			$cat_image = !empty($cat_image) && isset($cat_image['src']) ? $cat_image['src'] : ''; 
5661 5661
 			
5662 5662
 			$cat_parent = '';
5663
-			if (isset($term->parent) && (int)$term->parent > 0 && term_exists((int)$term->parent, $taxonomy)) {
5664
-				$parent_term = (array)get_term_by( 'id', (int)$term->parent, $taxonomy );
5663
+			if (isset($term->parent) && (int) $term->parent > 0 && term_exists((int) $term->parent, $taxonomy)) {
5664
+				$parent_term = (array) get_term_by('id', (int) $term->parent, $taxonomy);
5665 5665
 				$cat_parent = !empty($parent_term) && isset($parent_term['name']) ? $parent_term['name'] : '';
5666 5666
 			}
5667 5667
 			
@@ -5671,15 +5671,15 @@  discard block
 block discarded – undo
5671 5671
 			$csv_row[] = $term->slug;
5672 5672
 			$csv_row[] = $post_type;
5673 5673
 			$csv_row[] = $cat_parent;
5674
-			$csv_row[] = geodir_get_tax_meta( $term->term_id, 'ct_cat_schema', false, $post_type );
5674
+			$csv_row[] = geodir_get_tax_meta($term->term_id, 'ct_cat_schema', false, $post_type);
5675 5675
             // WPML
5676 5676
 			if ($is_wpml) {
5677
-				$csv_row[] = geodir_get_language_for_element( $term->term_id, 'tax_' . $taxonomy );
5678
-                $csv_row[] = geodir_imex_original_post_id( $term->term_id, 'tax_' . $taxonomy );
5677
+				$csv_row[] = geodir_get_language_for_element($term->term_id, 'tax_'.$taxonomy);
5678
+                $csv_row[] = geodir_imex_original_post_id($term->term_id, 'tax_'.$taxonomy);
5679 5679
 			}
5680 5680
 			// WPML
5681 5681
 			$csv_row[] = $term->description;
5682
-			$csv_row[] = geodir_get_tax_meta( $term->term_id, 'ct_cat_top_desc', false, $post_type );
5682
+			$csv_row[] = geodir_get_tax_meta($term->term_id, 'ct_cat_top_desc', false, $post_type);
5683 5683
 			$csv_row[] = $cat_image;
5684 5684
 			$csv_row[] = $cat_icon;
5685 5685
 			
@@ -5698,10 +5698,10 @@  discard block
 block discarded – undo
5698 5698
  * @param  bool $relative True for relative path & False for absolute path.
5699 5699
  * @return string Path to the cache directory.
5700 5700
  */
5701
-function geodir_path_import_export( $relative = true ) {
5701
+function geodir_path_import_export($relative = true) {
5702 5702
 	$upload_dir = wp_upload_dir();
5703 5703
 	
5704
-	return $relative ? $upload_dir['baseurl'] . '/cache' : $upload_dir['basedir'] . '/cache';
5704
+	return $relative ? $upload_dir['baseurl'].'/cache' : $upload_dir['basedir'].'/cache';
5705 5705
 }
5706 5706
 
5707 5707
 /**
@@ -5717,8 +5717,8 @@  discard block
 block discarded – undo
5717 5717
  * @param  bool $clear If true then it overwrite data otherwise add rows at the end of file.
5718 5718
  * @return bool true if success otherwise false.
5719 5719
  */
5720
-function geodir_save_csv_data( $file_path, $csv_data = array(), $clear = true ) {
5721
-	if ( empty( $csv_data ) ) {
5720
+function geodir_save_csv_data($file_path, $csv_data = array(), $clear = true) {
5721
+	if (empty($csv_data)) {
5722 5722
 		return false;
5723 5723
 	}
5724 5724
 	
@@ -5726,17 +5726,17 @@  discard block
 block discarded – undo
5726 5726
 	
5727 5727
 	$mode = $clear ? 'w+' : 'a+';
5728 5728
 	
5729
-	if ( function_exists( 'fputcsv' ) ) {
5730
-		$file = fopen( $file_path, $mode );
5731
-		foreach( $csv_data as $csv_row ) {
5729
+	if (function_exists('fputcsv')) {
5730
+		$file = fopen($file_path, $mode);
5731
+		foreach ($csv_data as $csv_row) {
5732 5732
 			//$csv_row = array_map( 'utf8_decode', $csv_row );
5733
-			$write_successful = fputcsv( $file, $csv_row, ",", $enclosure = '"' );
5733
+			$write_successful = fputcsv($file, $csv_row, ",", $enclosure = '"');
5734 5734
 		}
5735
-		fclose( $file );
5735
+		fclose($file);
5736 5736
 	} else {
5737
-		foreach( $csv_data as $csv_row ) {
5737
+		foreach ($csv_data as $csv_row) {
5738 5738
 			//$csv_row = array_map( 'utf8_decode', $csv_row );
5739
-			$wp_filesystem->put_contents( $file_path, $csv_row );
5739
+			$wp_filesystem->put_contents($file_path, $csv_row);
5740 5740
 		}
5741 5741
 	}
5742 5742
 		
@@ -5754,14 +5754,14 @@  discard block
 block discarded – undo
5754 5754
  * @param  string $file Full path to file.
5755 5755
  * @return int No of file rows.
5756 5756
  */
5757
-function geodir_import_export_line_count( $file ) {
5757
+function geodir_import_export_line_count($file) {
5758 5758
 	global $wp_filesystem;
5759 5759
 	
5760
-	if ( $wp_filesystem->is_file( $file ) && $wp_filesystem->exists( $file ) ) {
5761
-		$contents = $wp_filesystem->get_contents_array( $file );
5760
+	if ($wp_filesystem->is_file($file) && $wp_filesystem->exists($file)) {
5761
+		$contents = $wp_filesystem->get_contents_array($file);
5762 5762
 		
5763
-		if ( !empty( $contents ) && is_array( $contents ) ) {
5764
-			return count( $contents ) - 1;
5763
+		if (!empty($contents) && is_array($contents)) {
5764
+			return count($contents) - 1;
5765 5765
 		}
5766 5766
 	}
5767 5767
 	
@@ -5778,11 +5778,11 @@  discard block
 block discarded – undo
5778 5778
  * @param string $post_type The post type.
5779 5779
  * @return object Queried object.
5780 5780
  */
5781
-function geodir_imex_get_custom_fields( $post_type ) {
5781
+function geodir_imex_get_custom_fields($post_type) {
5782 5782
 	global $wpdb;
5783 5783
 	 
5784
-	$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 ) );
5785
-	$rows = $wpdb->get_results( $sql );
5784
+	$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));
5785
+	$rows = $wpdb->get_results($sql);
5786 5786
 	 
5787 5787
 	return $rows;
5788 5788
 }
@@ -5798,10 +5798,10 @@  discard block
 block discarded – undo
5798 5798
  * @return array Event data array.
5799 5799
  */
5800 5800
 function geodir_imex_get_event_data($post, $gd_post_info) {
5801
-	$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'] ) ) : '';
5801
+	$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'])) : '';
5802 5802
 	$event_enddate = $event_date;
5803
-	$starttime = isset( $post['starttime'] ) && $post['starttime'] != '' && $post['starttime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $post['starttime'] ) ) : '';
5804
-	$endtime = isset( $post['endtime'] ) && $post['endtime'] != '' && $post['endtime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $post['endtime'] ) ) : '';
5803
+	$starttime = isset($post['starttime']) && $post['starttime'] != '' && $post['starttime'] != '00:00:00' ? date_i18n('H:i', strtotime($post['starttime'])) : '';
5804
+	$endtime = isset($post['endtime']) && $post['endtime'] != '' && $post['endtime'] != '00:00:00' ? date_i18n('H:i', strtotime($post['endtime'])) : '';
5805 5805
 	
5806 5806
 	$is_recurring_event = '';
5807 5807
 	$event_duration_days = '';
@@ -5818,15 +5818,15 @@  discard block
 block discarded – undo
5818 5818
 		
5819 5819
 	$recurring_data = isset($gd_post_info->recurring_dates) ? maybe_unserialize($gd_post_info->recurring_dates) : array();
5820 5820
 	if (!empty($recurring_data)) {
5821
-		$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;
5822
-		$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;
5823
-		$starttime = isset( $recurring_data['starttime'] ) && $recurring_data['starttime'] != '' && $recurring_data['starttime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $recurring_data['starttime'] ) ) : $starttime;
5824
-		$endtime = isset( $recurring_data['endtime'] ) && $recurring_data['endtime'] != '' && $recurring_data['endtime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $recurring_data['endtime'] ) ) : $endtime;
5821
+		$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;
5822
+		$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;
5823
+		$starttime = isset($recurring_data['starttime']) && $recurring_data['starttime'] != '' && $recurring_data['starttime'] != '00:00:00' ? date_i18n('H:i', strtotime($recurring_data['starttime'])) : $starttime;
5824
+		$endtime = isset($recurring_data['endtime']) && $recurring_data['endtime'] != '' && $recurring_data['endtime'] != '00:00:00' ? date_i18n('H:i', strtotime($recurring_data['endtime'])) : $endtime;
5825 5825
 		$is_whole_day_event = !empty($recurring_data['all_day']) ? 1 : '';
5826 5826
 		$different_times = !empty($recurring_data['different_times']) ? true : false;
5827 5827
 	
5828
-		$recurring_pkg = geodir_event_recurring_pkg( $gd_post_info );
5829
-		$is_recurring = isset( $gd_post_info->is_recurring ) && (int)$gd_post_info->is_recurring == 0 ? false : true;
5828
+		$recurring_pkg = geodir_event_recurring_pkg($gd_post_info);
5829
+		$is_recurring = isset($gd_post_info->is_recurring) && (int) $gd_post_info->is_recurring == 0 ? false : true;
5830 5830
 			
5831 5831
 		if ($recurring_pkg && $is_recurring) {
5832 5832
 			$recurring_dates = $event_date;
@@ -5836,13 +5836,13 @@  discard block
 block discarded – undo
5836 5836
 			$recurring_type = !empty($recurring_data['repeat_type']) && in_array($recurring_data['repeat_type'], array('day', 'week', 'month', 'year', 'custom')) ? $recurring_data['repeat_type'] : 'custom';
5837 5837
 			
5838 5838
 			if (!empty($recurring_data['event_recurring_dates'])) {
5839
-				$event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] );
5839
+				$event_recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
5840 5840
 				
5841 5841
 				if (!empty($event_recurring_dates)) {
5842 5842
 					$recurring_dates = array();
5843 5843
 					
5844 5844
 					foreach ($event_recurring_dates as $date) {
5845
-						$recurring_dates[] = date_i18n( 'd/m/Y', strtotime( $date ) );
5845
+						$recurring_dates[] = date_i18n('d/m/Y', strtotime($date));
5846 5846
 					}
5847 5847
 					
5848 5848
 					$recurring_dates = implode(",", $recurring_dates);
@@ -5858,7 +5858,7 @@  discard block
 block discarded – undo
5858 5858
 						$times = array();
5859 5859
 						
5860 5860
 						foreach ($recurring_data['starttimes'] as $time) {
5861
-							$times[] = $time != '00:00:00' ? date_i18n( 'H:i', strtotime( $time ) ) : '00:00';
5861
+							$times[] = $time != '00:00:00' ? date_i18n('H:i', strtotime($time)) : '00:00';
5862 5862
 						}
5863 5863
 						
5864 5864
 						$event_starttimes = implode(",", $times);
@@ -5868,7 +5868,7 @@  discard block
 block discarded – undo
5868 5868
 						$times = array();
5869 5869
 						
5870 5870
 						foreach ($recurring_data['endtimes'] as $time) {
5871
-							$times[] = $time != '00:00:00' ? date_i18n( 'H:i', strtotime( $time ) ) : '00:00';
5871
+							$times[] = $time != '00:00:00' ? date_i18n('H:i', strtotime($time)) : '00:00';
5872 5872
 						}
5873 5873
 						
5874 5874
 						$event_endtimes = implode(",", $times);
@@ -5880,8 +5880,8 @@  discard block
 block discarded – undo
5880 5880
 					}
5881 5881
 				}
5882 5882
 			} else {
5883
-				$event_duration_days = isset($recurring_data['duration_x']) ? (int)$recurring_data['duration_x'] : 1;
5884
-				$recurring_interval = !empty($recurring_data['repeat_x']) && (int)$recurring_data['repeat_x'] > 0 ? $recurring_data['repeat_x'] : 1;
5883
+				$event_duration_days = isset($recurring_data['duration_x']) ? (int) $recurring_data['duration_x'] : 1;
5884
+				$recurring_interval = !empty($recurring_data['repeat_x']) && (int) $recurring_data['repeat_x'] > 0 ? $recurring_data['repeat_x'] : 1;
5885 5885
 				
5886 5886
 				if (($recurring_type == 'week' || $recurring_type == 'month') && !empty($recurring_data['repeat_days'])) {
5887 5887
 					$week_days = array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
@@ -5897,11 +5897,11 @@  discard block
 block discarded – undo
5897 5897
 				}
5898 5898
 				
5899 5899
 				$recurring_week_nos = $recurring_type == 'month' && !empty($recurring_data['repeat_weeks']) ? implode(",", $recurring_data['repeat_weeks']) : $recurring_week_nos;
5900
-				if (!empty($recurring_data['repeat_end_type']) && (int)$recurring_data['repeat_end_type'] == 1) {
5901
-					$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'] ) ) : '';
5900
+				if (!empty($recurring_data['repeat_end_type']) && (int) $recurring_data['repeat_end_type'] == 1) {
5901
+					$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'])) : '';
5902 5902
 					$max_recurring_count = empty($recurring_end_date) ? 1 : '';
5903 5903
 				} else {
5904
-					$max_recurring_count = (!empty($recurring_data['max_repeat']) && (int)$recurring_data['max_repeat'] > 0 ? (int)$recurring_data['max_repeat'] : 1);
5904
+					$max_recurring_count = (!empty($recurring_data['max_repeat']) && (int) $recurring_data['max_repeat'] > 0 ? (int) $recurring_data['max_repeat'] : 1);
5905 5905
 				}
5906 5906
 			}
5907 5907
 		}
@@ -5965,9 +5965,9 @@  discard block
 block discarded – undo
5965 5965
  * @return array Event data array.
5966 5966
  */
5967 5967
 function geodir_imex_process_event_data($gd_post) {
5968
-	$recurring_pkg = geodir_event_recurring_pkg( (object)$gd_post );
5968
+	$recurring_pkg = geodir_event_recurring_pkg((object) $gd_post);
5969 5969
 
5970
-	$is_recurring = isset( $gd_post['is_recurring_event'] ) && (int)$gd_post['is_recurring_event'] == 0 ? false : true;
5970
+	$is_recurring = isset($gd_post['is_recurring_event']) && (int) $gd_post['is_recurring_event'] == 0 ? false : true;
5971 5971
 	$event_date = isset($gd_post['event_date']) && $gd_post['event_date'] != '' ? geodir_date($gd_post['event_date'], 'Y-m-d') : '';
5972 5972
 	$event_enddate = isset($gd_post['event_enddate']) && $gd_post['event_enddate'] != '' ? geodir_date($gd_post['event_enddate'], 'Y-m-d') : $event_date;
5973 5973
 	$all_day = isset($gd_post['is_whole_day_event']) && !empty($gd_post['is_whole_day_event']) ? true : false;
@@ -6014,17 +6014,17 @@  discard block
 block discarded – undo
6014 6014
 				$event_recurring_dates = implode(",", $event_recurring_dates);
6015 6015
 			}
6016 6016
 		} else {
6017
-			$duration_x = !empty( $gd_post['event_duration_days'] ) ? (int)$gd_post['event_duration_days'] : 1;
6018
-			$repeat_x = !empty( $gd_post['recurring_interval'] ) ? (int)$gd_post['recurring_interval'] : 1;
6019
-			$max_repeat = !empty( $gd_post['max_recurring_count'] ) ? (int)$gd_post['max_recurring_count'] : 1;
6020
-			$repeat_end = !empty( $gd_post['recurring_end_date'] ) ? geodir_date($gd_post['recurring_end_date'], 'Y-m-d') : '';
6017
+			$duration_x = !empty($gd_post['event_duration_days']) ? (int) $gd_post['event_duration_days'] : 1;
6018
+			$repeat_x = !empty($gd_post['recurring_interval']) ? (int) $gd_post['recurring_interval'] : 1;
6019
+			$max_repeat = !empty($gd_post['max_recurring_count']) ? (int) $gd_post['max_recurring_count'] : 1;
6020
+			$repeat_end = !empty($gd_post['recurring_end_date']) ? geodir_date($gd_post['recurring_end_date'], 'Y-m-d') : '';
6021 6021
 			
6022 6022
 			$repeat_end_type = $repeat_end != '' ? 1 : 0;
6023 6023
 			$max_repeat = $repeat_end != '' ? '' : $max_repeat;
6024 6024
 			
6025 6025
 			$week_days = array_flip(array('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'));
6026 6026
 			
6027
-			$a_repeat_days = isset($gd_post['recurring_week_days']) && trim($gd_post['recurring_week_days'])!='' ? explode(',', trim($gd_post['recurring_week_days'])) : array();
6027
+			$a_repeat_days = isset($gd_post['recurring_week_days']) && trim($gd_post['recurring_week_days']) != '' ? explode(',', trim($gd_post['recurring_week_days'])) : array();
6028 6028
 			$repeat_days = array();
6029 6029
 			if (!empty($a_repeat_days)) {
6030 6030
 				foreach ($a_repeat_days as $repeat_day) {
@@ -6042,7 +6042,7 @@  discard block
 block discarded – undo
6042 6042
 			$repeat_weeks = array();
6043 6043
 			if (!empty($a_repeat_weeks)) {
6044 6044
 				foreach ($a_repeat_weeks as $repeat_week) {
6045
-					$repeat_weeks[] = (int)$repeat_week;
6045
+					$repeat_weeks[] = (int) $repeat_week;
6046 6046
 				}
6047 6047
 				
6048 6048
 				$repeat_weeks = array_unique($repeat_weeks);
@@ -6106,7 +6106,7 @@  discard block
 block discarded – undo
6106 6106
 
6107 6107
     $page_found = $wpdb->get_var(
6108 6108
         $wpdb->prepare(
6109
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;",
6109
+            "SELECT ID FROM ".$wpdb->posts." WHERE post_name = %s LIMIT 1;",
6110 6110
             array($slug)
6111 6111
         )
6112 6112
     );
@@ -6161,7 +6161,7 @@  discard block
 block discarded – undo
6161 6161
  */
6162 6162
 function geodir_admin_upgrade_notice() {
6163 6163
     $class = "error";
6164
-    $message = __("Please update core GeoDirectory or some addons may not function correctly.","geodirectory");
6164
+    $message = __("Please update core GeoDirectory or some addons may not function correctly.", "geodirectory");
6165 6165
     echo"<div class=\"$class\"> <p>$message</p></div>";
6166 6166
 }
6167 6167
 
@@ -6173,7 +6173,7 @@  discard block
 block discarded – undo
6173 6173
  * @param (object) $r
6174 6174
  * @return (string) $output
6175 6175
  */
6176
-function geodire_admin_upgrade_notice( $plugin_data, $r )
6176
+function geodire_admin_upgrade_notice($plugin_data, $r)
6177 6177
 {
6178 6178
     // readme contents
6179 6179
     $args = array(
@@ -6181,7 +6181,7 @@  discard block
 block discarded – undo
6181 6181
         'redirection' => 5
6182 6182
     );
6183 6183
     $url = "http://plugins.svn.wordpress.org/geodirectory/trunk/readme.txt";
6184
-    $data       = wp_remote_get( $url, $args );
6184
+    $data = wp_remote_get($url, $args);
6185 6185
 
6186 6186
     if (!is_wp_error($data) && $data['response']['code'] == 200) {
6187 6187
 
@@ -6196,20 +6196,20 @@  discard block
 block discarded – undo
6196 6196
 function geodir_in_plugin_update_message($content) {
6197 6197
     // Output Upgrade Notice
6198 6198
     $matches        = null;
6199
-    $regexp         = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( GEODIRECTORY_VERSION ) . '\s*=|$)~Uis';
6199
+    $regexp         = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*'.preg_quote(GEODIRECTORY_VERSION).'\s*=|$)~Uis';
6200 6200
     $upgrade_notice = '';
6201
-    if ( preg_match( $regexp, $content, $matches ) ) {
6202
-        if(empty($matches)){return;}
6201
+    if (preg_match($regexp, $content, $matches)) {
6202
+        if (empty($matches)) {return; }
6203 6203
 
6204
-        $version = trim( $matches[1] );
6205
-        if($version && $version>GEODIRECTORY_VERSION){
6204
+        $version = trim($matches[1]);
6205
+        if ($version && $version > GEODIRECTORY_VERSION) {
6206 6206
 
6207 6207
 
6208
-        $notices = (array) preg_split('~[\r\n]+~', trim( $matches[2] ) );
6209
-        if ( version_compare( GEODIRECTORY_VERSION, $version, '<' ) ) {
6208
+        $notices = (array) preg_split('~[\r\n]+~', trim($matches[2]));
6209
+        if (version_compare(GEODIRECTORY_VERSION, $version, '<')) {
6210 6210
             $upgrade_notice .= '<div class="geodir_plugin_upgrade_notice">';
6211
-            foreach ( $notices as $index => $line ) {
6212
-                $upgrade_notice .= wp_kses_post( preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line ) );
6211
+            foreach ($notices as $index => $line) {
6212
+                $upgrade_notice .= wp_kses_post(preg_replace('~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line));
6213 6213
             }
6214 6214
             $upgrade_notice .= '</div> ';
6215 6215
         }
@@ -6233,7 +6233,7 @@  discard block
 block discarded – undo
6233 6233
 		$default_language = $sitepress->get_default_language();
6234 6234
 		if ($current_language != 'all' && $current_language != $default_language) {
6235 6235
 	?>
6236
-	<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>
6236
+	<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>
6237 6237
 	<?php
6238 6238
 		}
6239 6239
 	}
@@ -6248,7 +6248,7 @@  discard block
 block discarded – undo
6248 6248
  * @param array Listing statuses to be skipped.
6249 6249
  */
6250 6250
 function geodir_imex_export_skip_statuses() {
6251
-    $statuses = array( 'trash', 'auto-draft' );
6251
+    $statuses = array('trash', 'auto-draft');
6252 6252
     
6253 6253
     /**
6254 6254
      * Filter the statuses to skip during GD export listings.
@@ -6258,7 +6258,7 @@  discard block
 block discarded – undo
6258 6258
      *
6259 6259
      * @param array $statuses Listing statuses to be skipped.
6260 6260
      */
6261
-    $statuses = apply_filters( 'geodir_imex_export_skip_statuses', $statuses );
6261
+    $statuses = apply_filters('geodir_imex_export_skip_statuses', $statuses);
6262 6262
      
6263 6263
     return $statuses;
6264 6264
 }
@@ -6329,16 +6329,16 @@  discard block
 block discarded – undo
6329 6329
 function geodir_imex_get_filter_where($where = '', $post_type = '') {
6330 6330
     global $wpdb;
6331 6331
     
6332
-    $filters = !empty( $_REQUEST['gd_imex'] ) && is_array( $_REQUEST['gd_imex'] ) ? $_REQUEST['gd_imex'] : NULL;
6332
+    $filters = !empty($_REQUEST['gd_imex']) && is_array($_REQUEST['gd_imex']) ? $_REQUEST['gd_imex'] : NULL;
6333 6333
     
6334
-    if ( !empty( $filters ) ) {
6335
-        foreach ( $filters as $field => $value ) {
6334
+    if (!empty($filters)) {
6335
+        foreach ($filters as $field => $value) {
6336 6336
             switch ($field) {
6337 6337
                 case 'start_date':
6338
-                    $where .= " AND `" . $wpdb->posts . "`.`post_date` >= '" . sanitize_text_field( $value ) . " 00:00:00'";
6338
+                    $where .= " AND `".$wpdb->posts."`.`post_date` >= '".sanitize_text_field($value)." 00:00:00'";
6339 6339
                 break;
6340 6340
                 case 'end_date':
6341
-                    $where .= " AND `" . $wpdb->posts . "`.`post_date` <= '" . sanitize_text_field( $value ) . " 23:59:59'";
6341
+                    $where .= " AND `".$wpdb->posts."`.`post_date` <= '".sanitize_text_field($value)." 23:59:59'";
6342 6342
                 break;
6343 6343
             }
6344 6344
         }
@@ -6350,25 +6350,25 @@  discard block
 block discarded – undo
6350 6350
 add_filter('geodir_get_export_posts', 'geodir_imex_get_filter_where', 10, 2);
6351 6351
 
6352 6352
 
6353
-function geodir_fix_for_primer_theme(){
6354
-    if(!defined( 'PRIMER_VERSION' )){return;}
6353
+function geodir_fix_for_primer_theme() {
6354
+    if (!defined('PRIMER_VERSION')) {return; }
6355 6355
     global $pagenow;
6356 6356
 
6357
-    if ( ( 'post.php' === $pagenow || 'post-new.php' === $pagenow ) && (isset($_REQUEST['post_type']) || isset($_REQUEST['post']) )  ){
6357
+    if (('post.php' === $pagenow || 'post-new.php' === $pagenow) && (isset($_REQUEST['post_type']) || isset($_REQUEST['post']))) {
6358 6358
 
6359
-        $post_type = isset($_REQUEST['post_type']) ? esc_attr($_REQUEST['post_type']) : get_post_type( $_GET['post'] );
6359
+        $post_type = isset($_REQUEST['post_type']) ? esc_attr($_REQUEST['post_type']) : get_post_type($_GET['post']);
6360 6360
 
6361 6361
         $post_types = geodir_get_posttypes();
6362
-        if ($post_type && in_array($post_type, $post_types) ) {
6362
+        if ($post_type && in_array($post_type, $post_types)) {
6363 6363
             global $primer_customizer_layouts;
6364
-            remove_action( 'add_meta_boxes', array( $primer_customizer_layouts, 'add_meta_box' ), 10);
6364
+            remove_action('add_meta_boxes', array($primer_customizer_layouts, 'add_meta_box'), 10);
6365 6365
         }
6366 6366
     }
6367 6367
 
6368 6368
 }
6369 6369
 
6370
-if(is_admin()){
6371
-    add_action('add_meta_boxes','geodir_fix_for_primer_theme',0);  
6370
+if (is_admin()) {
6371
+    add_action('add_meta_boxes', 'geodir_fix_for_primer_theme', 0);  
6372 6372
 }
6373 6373
 
6374 6374
 
@@ -6501,32 +6501,32 @@  discard block
 block discarded – undo
6501 6501
 
6502 6502
 function geodir_ga_activation_url() {
6503 6503
 
6504
-    return add_query_arg( array(
6504
+    return add_query_arg(array(
6505 6505
         'next'          => admin_url("admin.php?page=geodirectory&active_tab=google_analytic_settings"),
6506 6506
         'scope'         => GEODIR_GA_SCOPE,
6507 6507
         'response_type' => 'code',
6508 6508
         'redirect_uri'  => GEODIR_GA_REDIRECT,
6509 6509
         'client_id'     => GEODIR_GA_CLIENTID,
6510
-    ), 'https://accounts.google.com/o/oauth2/auth' );
6510
+    ), 'https://accounts.google.com/o/oauth2/auth');
6511 6511
 
6512 6512
     return $url;
6513 6513
 }
6514 6514
 
6515
-function geodir_gd_accounts(){
6515
+function geodir_gd_accounts() {
6516 6516
     $accounts = array();
6517
-    $useAuth = ( get_option( 'geodir_ga_auth_code' ) == '' ? false : true );
6518
-    if($useAuth){
6517
+    $useAuth = (get_option('geodir_ga_auth_code') == '' ? false : true);
6518
+    if ($useAuth) {
6519 6519
         try {
6520 6520
             $accounts = geodir_ga_get_analytics_accounts();
6521 6521
         } catch (Exception $e) {
6522
-            geodir_error_log( wp_sprintf( __( 'GD Google Analytics API Error(%s) : %s', 'geodirectory' ), $e->getCode(), $e->getMessage() ) );
6522
+            geodir_error_log(wp_sprintf(__('GD Google Analytics API Error(%s) : %s', 'geodirectory'), $e->getCode(), $e->getMessage()));
6523 6523
         }
6524 6524
         
6525
-        if(is_array($accounts)){
6526
-            $accounts = array_merge(array(__('Select Account','geodirectory')),$accounts);
6527
-        }elseif(get_option('geodir_ga_account_id')){
6525
+        if (is_array($accounts)) {
6526
+            $accounts = array_merge(array(__('Select Account', 'geodirectory')), $accounts);
6527
+        }elseif (get_option('geodir_ga_account_id')) {
6528 6528
             $accounts = array();
6529
-            $accounts[get_option('geodir_ga_account_id')] = __('Account re-authorization may be required','geodirectory').' ('.get_option('geodir_ga_account_id').')';
6529
+            $accounts[get_option('geodir_ga_account_id')] = __('Account re-authorization may be required', 'geodirectory').' ('.get_option('geodir_ga_account_id').')';
6530 6530
         }
6531 6531
     }
6532 6532
     return $accounts;
@@ -6537,21 +6537,21 @@  discard block
 block discarded – undo
6537 6537
     global $gd_ga_errors;
6538 6538
     $accounts = array();
6539 6539
 
6540
-    if(get_option('geodir_ga_auth_token')===false){update_option('geodir_ga_auth_token','');}
6540
+    if (get_option('geodir_ga_auth_token') === false) {update_option('geodir_ga_auth_token', ''); }
6541 6541
 
6542 6542
 
6543
-    if(get_option('geodir_gd_uids') && !isset($_POST['geodir_ga_auth_code'])){
6543
+    if (get_option('geodir_gd_uids') && !isset($_POST['geodir_ga_auth_code'])) {
6544 6544
       return get_option('geodir_gd_uids');
6545 6545
     }
6546 6546
 
6547 6547
     # Create a new Gdata call
6548
-    if ( trim(get_option('geodir_ga_auth_code')) != '' )
6548
+    if (trim(get_option('geodir_ga_auth_code')) != '')
6549 6549
         $stats = new GDGoogleAnalyticsStats();
6550 6550
     else
6551 6551
         return false;
6552 6552
 
6553 6553
     # Check if Google sucessfully logged in
6554
-    if ( ! $stats->checkLogin() )
6554
+    if (!$stats->checkLogin())
6555 6555
         return false;
6556 6556
 
6557 6557
     # Get a list of accounts
@@ -6563,28 +6563,28 @@  discard block
 block discarded – undo
6563 6563
     }
6564 6564
 
6565 6565
 
6566
-    natcasesort ($accounts);
6566
+    natcasesort($accounts);
6567 6567
 
6568 6568
     # Return the account array if there are accounts
6569
-    if ( count($accounts) > 0 ){
6570
-        update_option('geodir_gd_uids',$accounts);
6569
+    if (count($accounts) > 0) {
6570
+        update_option('geodir_gd_uids', $accounts);
6571 6571
         return $accounts;
6572 6572
     }
6573 6573
     else
6574 6574
         return false;
6575 6575
 }
6576 6576
 
6577
-add_action( 'wp_ajax_geodir_ga_deauthorize', 'geodir_ga_deauthorize' );
6578
-function geodir_ga_deauthorize(){
6577
+add_action('wp_ajax_geodir_ga_deauthorize', 'geodir_ga_deauthorize');
6578
+function geodir_ga_deauthorize() {
6579 6579
 
6580
-    if ( ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'gd_ga_deauthorize' ) ) {
6580
+    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'gd_ga_deauthorize')) {
6581 6581
 
6582
-        die( 'Security check' );
6582
+        die('Security check');
6583 6583
 
6584 6584
     } else {
6585
-        update_option('geodir_ga_auth_token','');
6586
-        update_option('geodir_ga_auth_code','');
6587
-        update_option('geodir_gd_uids','');
6585
+        update_option('geodir_ga_auth_token', '');
6586
+        update_option('geodir_ga_auth_code', '');
6587
+        update_option('geodir_gd_uids', '');
6588 6588
 
6589 6589
 
6590 6590
         echo admin_url('?page=geodirectory&active_tab=google_analytic_settings');
@@ -6617,22 +6617,22 @@  discard block
 block discarded – undo
6617 6617
  * @since 1.6.21
6618 6618
  * @return array
6619 6619
  */
6620
-function geodir_listing_image_size_arr(){
6620
+function geodir_listing_image_size_arr() {
6621 6621
 
6622 6622
     global $_wp_additional_image_sizes;
6623 6623
 
6624 6624
     $sizes = array();
6625 6625
 
6626
-    foreach ( get_intermediate_image_sizes() as $_size ) {
6627
-        if ( in_array( $_size, array('thumbnail', 'medium', 'medium_large', 'large') ) ) {
6628
-            $sizes[ $_size ]['width']  = get_option( "{$_size}_size_w" );
6629
-            $sizes[ $_size ]['height'] = get_option( "{$_size}_size_h" );
6630
-            $sizes[ $_size ]['crop']   = (bool) get_option( "{$_size}_crop" );
6631
-        } elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) {
6632
-            $sizes[ $_size ] = array(
6633
-                'width'  => $_wp_additional_image_sizes[ $_size ]['width'],
6634
-                'height' => $_wp_additional_image_sizes[ $_size ]['height'],
6635
-                'crop'   => $_wp_additional_image_sizes[ $_size ]['crop'],
6626
+    foreach (get_intermediate_image_sizes() as $_size) {
6627
+        if (in_array($_size, array('thumbnail', 'medium', 'medium_large', 'large'))) {
6628
+            $sizes[$_size]['width']  = get_option("{$_size}_size_w");
6629
+            $sizes[$_size]['height'] = get_option("{$_size}_size_h");
6630
+            $sizes[$_size]['crop']   = (bool) get_option("{$_size}_crop");
6631
+        } elseif (isset($_wp_additional_image_sizes[$_size])) {
6632
+            $sizes[$_size] = array(
6633
+                'width'  => $_wp_additional_image_sizes[$_size]['width'],
6634
+                'height' => $_wp_additional_image_sizes[$_size]['height'],
6635
+                'crop'   => $_wp_additional_image_sizes[$_size]['crop'],
6636 6636
             );
6637 6637
         }
6638 6638
     }
@@ -6643,9 +6643,9 @@  discard block
 block discarded – undo
6643 6643
 
6644 6644
     $options['default'] = __('GD Default', 'geodirectory');
6645 6645
 
6646
-    if(!empty($sizes)){
6647
-        foreach($sizes as $key=>$val){
6648
-            $options[$key] = $key. ' ( '.$val['width'].' x '.$val['height']. ' )';
6646
+    if (!empty($sizes)) {
6647
+        foreach ($sizes as $key=>$val) {
6648
+            $options[$key] = $key.' ( '.$val['width'].' x '.$val['height'].' )';
6649 6649
         }
6650 6650
     }
6651 6651
 
Please login to merge, or discard this patch.
geodirectory_template_tags.php 1 patch
Spacing   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -39,21 +39,21 @@  discard block
 block discarded – undo
39 39
     $is_detail_page = false;
40 40
     $geodir_map_name = geodir_map_name();
41 41
 
42
-    if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) {
42
+    if ((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview'))) {
43 43
         $is_detail_page = true;
44 44
     }
45 45
 
46 46
     wp_enqueue_script('jquery');
47 47
 
48
-    wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js', array(), GEODIRECTORY_VERSION);
48
+    wp_register_script('geodirectory-script', geodir_plugin_url().'/geodirectory-assets/js/geodirectory.min.js', array(), GEODIRECTORY_VERSION);
49 49
     wp_enqueue_script('geodirectory-script');
50 50
 
51 51
     $geodir_vars_data = array(
52 52
         'siteurl' => get_option('siteurl'),
53 53
         'geodir_plugin_url' => geodir_plugin_url(),
54
-        'geodir_lazy_load' => get_option('geodir_lazy_load',1),
54
+        'geodir_lazy_load' => get_option('geodir_lazy_load', 1),
55 55
         'geodir_ajax_url' => geodir_get_ajax_url(),
56
-        'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'),
56
+        'geodir_gd_modal' => (int) get_option('geodir_disable_gb_modal'),
57 57
         'is_rtl' => is_rtl() ? 1 : 0, // fix rtl issue
58 58
 		'lightBox_txtImage' => addslashes(__('Image', 'geodirectory')),
59 59
 		'lightBox_txtOf' => addslashes(__('of', 'geodirectory')),
@@ -76,24 +76,24 @@  discard block
 block discarded – undo
76 76
      *
77 77
      * }
78 78
      */
79
-    $geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data);
79
+    $geodir_vars_data = apply_filters('geodir_vars_data', $geodir_vars_data);
80 80
 
81 81
     wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data);
82 82
 
83
-    wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true);
84
-    if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');}
83
+    wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION, true);
84
+    if ($is_detail_page) {wp_enqueue_script('geodirectory-jquery-flexslider-js'); }
85 85
 
86
-    wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true);
86
+    wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url().'/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION, true);
87 87
     wp_enqueue_script('geodirectory-lightbox-jquery');
88 88
 
89
-    wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true);
89
+    wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url().'/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION, true);
90 90
     if ($is_detail_page) {
91 91
         wp_enqueue_script('geodirectory-jquery-simplemodal');
92 92
     }
93 93
 
94 94
     if (in_array($geodir_map_name, array('auto', 'google'))) {
95
-        $map_lang = "&language=" . geodir_get_map_default_language();
96
-        $map_key = "&key=" . geodir_get_map_api_key();
95
+        $map_lang = "&language=".geodir_get_map_default_language();
96
+        $map_key = "&key=".geodir_get_map_api_key();
97 97
         /**
98 98
          * Filter the variables that are added to the end of the google maps script call.
99 99
          *
@@ -103,55 +103,55 @@  discard block
 block discarded – undo
103 103
          * @param string $var The string to filter, default is empty string.
104 104
          */
105 105
         $map_extra = apply_filters('geodir_googlemap_script_extra', '');
106
-        wp_enqueue_script('google-maps-api', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra , '', NULL);
106
+        wp_enqueue_script('google-maps-api', 'https://maps.google.com/maps/api/js?'.$map_lang.$map_key.$map_extra, '', NULL);
107 107
         
108 108
         // Overlapping Marker Spiderfier
109
-        wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION);
109
+        wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url().'/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION);
110 110
         wp_enqueue_script('geodirectory-g-overlappingmarker-script');
111 111
     }
112 112
     
113 113
     if ($geodir_map_name == 'osm') {
114 114
         // Leaflet OpenStreetMap
115
-        wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
115
+        wp_register_style('geodirectory-leaflet-style', geodir_plugin_url().'/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
116 116
         wp_enqueue_style('geodirectory-leaflet-style');
117 117
             
118
-        wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
118
+        wp_register_script('geodirectory-leaflet-script', geodir_plugin_url().'/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
119 119
         wp_enqueue_script('geodirectory-leaflet-script');
120 120
         
121
-        wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.min.js', array(), GEODIRECTORY_VERSION);
121
+        wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url().'/geodirectory-assets/leaflet/osm.geocode.min.js', array(), GEODIRECTORY_VERSION);
122 122
         wp_enqueue_script('geodirectory-leaflet-geo-script');
123 123
         
124 124
         if ($is_detail_page) {
125
-            wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION);
125
+            wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url().'/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION);
126 126
             wp_enqueue_style('geodirectory-leaflet-routing-style');
127 127
                 
128
-            wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.min.js', array(), GEODIRECTORY_VERSION);
128
+            wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url().'/geodirectory-assets/leaflet/routing/leaflet-routing-machine.min.js', array(), GEODIRECTORY_VERSION);
129 129
             wp_enqueue_script('geodirectory-leaflet-routing-script');
130 130
         }
131 131
         
132 132
         // Overlapping Marker Spiderfier Leaflet
133
-        wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION);
133
+        wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url().'/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION);
134 134
         wp_enqueue_script('geodirectory-o-overlappingmarker-script');
135 135
     }
136
-    wp_enqueue_script( 'jquery-ui-autocomplete' );
136
+    wp_enqueue_script('jquery-ui-autocomplete');
137 137
     
138
-    wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true);
138
+    wp_register_script('geodirectory-goMap-script', geodir_plugin_url().'/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true);
139 139
     wp_enqueue_script('geodirectory-goMap-script');
140 140
 
141
-    wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION);
141
+    wp_register_script('chosen', geodir_plugin_url().'/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION);
142 142
     wp_enqueue_script('chosen');
143 143
 
144
-    wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION);
144
+    wp_register_script('geodirectory-choose-ajax', geodir_plugin_url().'/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION);
145 145
     wp_enqueue_script('geodirectory-choose-ajax');
146 146
 
147
-    wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.min.js', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true);
147
+    wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.ui.timepicker.min.js', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true);
148 148
 
149 149
     if (is_page() && geodir_is_page('add-listing')) {
150 150
         // SCRIPT FOR UPLOAD
151 151
         wp_enqueue_script('plupload-all');
152 152
         wp_enqueue_script('jquery-ui-sortable');
153 153
 
154
-        wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true);
154
+        wp_register_script('geodirectory-plupload-script', geodir_plugin_url().'/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
155 155
         wp_enqueue_script('geodirectory-plupload-script');
156 156
         // SCRIPT FOR UPLOAD END
157 157
 
@@ -198,27 +198,27 @@  discard block
 block discarded – undo
198 198
 
199 199
         wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
200 200
 
201
-        wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload');
201
+        wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url().'/geodirectory-assets/js/listing_validation.min.js#asyncload');
202 202
     } // End if for add place page
203 203
 
204
-    wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
204
+    wp_register_script('geodirectory-post-custom-js', geodir_plugin_url().'/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
205 205
     if ($is_detail_page) {
206 206
 		wp_enqueue_script('geodirectory-post-custom-js');
207 207
 	}
208 208
 
209 209
     // font awesome rating script
210 210
 	if (get_option('geodir_reviewrating_enable_font_awesome')) {
211
-		wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION, true);
211
+		wp_register_script('geodir-barrating-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION, true);
212 212
 		wp_enqueue_script('geodir-barrating-js');
213 213
 	} else { // default rating script
214
-		wp_register_script('geodir-jRating-js', geodir_plugin_url() . '/geodirectory-assets/js/jRating.jquery.min.js', array(), GEODIRECTORY_VERSION, true);
214
+		wp_register_script('geodir-jRating-js', geodir_plugin_url().'/geodirectory-assets/js/jRating.jquery.min.js', array(), GEODIRECTORY_VERSION, true);
215 215
 		wp_enqueue_script('geodir-jRating-js');
216 216
 	}
217 217
 
218
-    wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
218
+    wp_register_script('geodir-on-document-load', geodir_plugin_url().'/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
219 219
     wp_enqueue_script('geodir-on-document-load');
220 220
 
221
-    wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
221
+    wp_register_script('google-geometa', geodir_plugin_url().'/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
222 222
     wp_enqueue_script('google-geometa');
223 223
 }
224 224
 
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
  */
234 234
 function geodir_header_scripts()
235 235
 {
236
-    echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>';
236
+    echo '<style>'.stripslashes(get_option('geodir_coustem_css')).'</style>';
237 237
     echo stripslashes(get_option('geodir_header_scripts'));
238 238
 }
239 239
 
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
  */
248 248
 function geodir_google_analytics_tracking_code()
249 249
 {
250
-    if(get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')){?>
250
+    if (get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')) {?>
251 251
 
252 252
         <script>
253 253
             (function(i,s,o,g,r,a,m){ i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
@@ -255,14 +255,14 @@  discard block
 block discarded – undo
255 255
                 m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
256 256
             })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
257 257
 
258
-            ga('create', '<?php echo esc_attr(get_option('geodir_ga_account_id'));?>', 'auto');
259
-            <?php if(get_option('geodir_ga_anonymize_ip')){echo "ga('set', 'anonymizeIP', true);";}?>
258
+            ga('create', '<?php echo esc_attr(get_option('geodir_ga_account_id')); ?>', 'auto');
259
+            <?php if (get_option('geodir_ga_anonymize_ip')) {echo "ga('set', 'anonymizeIP', true);"; }?>
260 260
             ga('send', 'pageview');
261 261
 
262 262
         </script>
263 263
 
264 264
         <?php
265
-    }elseif( get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){
265
+    }elseif (get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')) {
266 266
         echo stripslashes(get_option('geodir_ga_tracking_code'));
267 267
     }
268 268
 }
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
      *
286 286
      * Flexbox wont wrap on ios for search form items
287 287
      */
288
-    if ( !empty( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'] ) ) {
288
+    if (!empty($_SERVER['HTTP_USER_AGENT']) && preg_match('/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'])) {
289 289
         echo "<style>body .geodir-listing-search.gd-search-bar-style .geodir-loc-bar .clearfix.geodir-loc-bar-in .geodir-search .gd-search-input-wrapper{flex:50 1 auto !important;min-width: initial !important;width:auto !important;}.geodir-filter-container .geodir-filter-cat{width:auto !important;}</style>";
290 290
     }
291 291
 }
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
  */
302 302
 function geodir_add_async_forscript($url)
303 303
 {
304
-    if (strpos($url, '#asyncload')===false)
304
+    if (strpos($url, '#asyncload') === false)
305 305
         return $url;
306 306
     else if (is_admin())
307 307
         return str_replace('#asyncload', '', $url);
@@ -319,18 +319,18 @@  discard block
 block discarded – undo
319 319
 function geodir_templates_styles()
320 320
 {
321 321
 
322
-    wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION);
322
+    wp_register_style('geodir-core-scss', geodir_plugin_url().'/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION);
323 323
     wp_enqueue_style('geodir-core-scss');
324
-    wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION);
324
+    wp_register_style('geodir-core-scss-footer', geodir_plugin_url().'/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION);
325 325
 
326
-    if(is_rtl()){
327
-    wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION);
326
+    if (is_rtl()) {
327
+    wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url().'/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION);
328 328
     wp_enqueue_style('geodirectory-frontend-rtl-style');
329 329
     }
330 330
 
331 331
     wp_register_script('font-awesome', 'https://use.fontawesome.com/releases/v5.5.0/js/all.js#faload', array('font-awesome-shim'), GEODIRECTORY_VERSION);
332 332
     wp_register_script('font-awesome-shim', 'https://use.fontawesome.com/releases/v5.5.0/js/v4-shims.js', array(), GEODIRECTORY_VERSION);
333
-    wp_enqueue_script( 'font-awesome' );
333
+    wp_enqueue_script('font-awesome');
334 334
 
335 335
 
336 336
 }
@@ -399,18 +399,18 @@  discard block
 block discarded – undo
399 399
                 $term_id = get_queried_object_id();
400 400
                 $taxonomy = get_query_var('taxonomy');
401 401
 
402
-                if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) {
403
-                    $term = get_term($term_id, $post_type . 'category');
402
+                if ($term_id && $post_type && get_query_var('taxonomy') == $post_type.'category') {
403
+                    $term = get_term($term_id, $post_type.'category');
404 404
                 }
405 405
             }
406 406
             
407
-            if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) {
408
-                $taxonomy_search = $_REQUEST['s' . $post_type . 'category'];
407
+            if (geodir_is_page('search') && !empty($_REQUEST['s'.$post_type.'category'])) {
408
+                $taxonomy_search = $_REQUEST['s'.$post_type.'category'];
409 409
                 
410 410
                 if (!is_array($taxonomy_search)) {
411
-                    $term = get_term((int)$taxonomy_search, $post_type . 'category');
412
-                } else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search
413
-                    $term = get_term((int)$taxonomy_search[0], $post_type . 'category');
411
+                    $term = get_term((int) $taxonomy_search, $post_type.'category');
412
+                } else if (is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search
413
+                    $term = get_term((int) $taxonomy_search[0], $post_type.'category');
414 414
                 }
415 415
             }
416 416
             
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
         if ($max_page > 1 || $always_show) {            
423 423
             // Extra pagination info
424 424
             $geodir_pagination_more_info = get_option('geodir_pagination_advance_info');
425
-            $start_no = ( $paged - 1 ) * $posts_per_page + 1;
425
+            $start_no = ($paged - 1) * $posts_per_page + 1;
426 426
             $end_no = min($paged * $posts_per_page, $numposts);
427 427
 
428 428
             if ($geodir_pagination_more_info != '') {
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
                 } else {
433 433
                     $pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts);
434 434
                 }
435
-                $pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>';
435
+                $pagination_info = '<div class="gd-pagination-details">'.$pegination_desc.'</div>';
436 436
                 /**
437 437
                  * Adds an extra pagination info above/under pagination.
438 438
                  *
@@ -448,15 +448,15 @@  discard block
 block discarded – undo
448 448
                 $pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type);
449 449
                 
450 450
                 if ($geodir_pagination_more_info == 'before') {
451
-                    $before = $before . $pagination_info;
451
+                    $before = $before.$pagination_info;
452 452
                 } else if ($geodir_pagination_more_info == 'after') {
453
-                    $after = $pagination_info . $after;
453
+                    $after = $pagination_info.$after;
454 454
                 }
455 455
             }
456 456
             
457 457
             echo "$before <div class='Navi gd-navi'>";
458 458
             if ($paged >= ($pages_to_show - 1)) {
459
-                echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link()) . '">&laquo;</a>';
459
+                echo '<a href="'.str_replace('&paged', '&amp;paged', get_pagenum_link()).'">&laquo;</a>';
460 460
             }
461 461
             previous_posts_link($prelabel);
462 462
             for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) {
@@ -464,13 +464,13 @@  discard block
 block discarded – undo
464 464
                     if ($i == $paged) {
465 465
                         echo "<strong class='on'>$i</strong>";
466 466
                     } else {
467
-                        echo ' <a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($i)) . '">' . $i . '</a> ';
467
+                        echo ' <a href="'.str_replace('&paged', '&amp;paged', get_pagenum_link($i)).'">'.$i.'</a> ';
468 468
                     }
469 469
                 }
470 470
             }
471 471
             next_posts_link($nxtlabel, $max_page);
472 472
             if (($paged + $half_pages_to_show) < ($max_page)) {
473
-                echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($max_page)) . '">&raquo;</a>';
473
+                echo '<a href="'.str_replace('&paged', '&amp;paged', get_pagenum_link($max_page)).'">&raquo;</a>';
474 474
             }
475 475
             echo "</div> $after";
476 476
         }
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
         jQuery(function ($) {
509 509
             $("#distance_slider").slider({
510 510
                 range: true,
511
-                values: [0, <?php echo ($_REQUEST['sdist']!='') ? sanitize_text_field($_REQUEST['sdist']) : "0"; ?>],
511
+                values: [0, <?php echo ($_REQUEST['sdist'] != '') ? sanitize_text_field($_REQUEST['sdist']) : "0"; ?>],
512 512
                 min: 0,
513 513
                 max: <?php echo $dist; ?>,
514 514
                 step: <?php echo $dist_dif; ?>,
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
     $city = !empty($search_location) ? addslashes(stripslashes($search_location->city)) : '';
576 576
     ?>
577 577
     <script type="text/javascript">
578
-        var default_location = '<?php echo $city ;?>';
578
+        var default_location = '<?php echo $city; ?>';
579 579
         var latlng;
580 580
         var address;
581 581
         var dist = 0;
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
 				var $form = jQuery(this).closest('form');
592 592
 
593 593
 				if (jQuery("#sdist input[type='radio']:checked").length != 0) dist = jQuery("#sdist input[type='radio']:checked").val();
594
-				if (jQuery('.search_text', $form).val() == '' || jQuery('.search_text', $form).val() == '<?php echo $default_search_for_text;?>') jQuery('.search_text', $form).val(s);
594
+				if (jQuery('.search_text', $form).val() == '' || jQuery('.search_text', $form).val() == '<?php echo $default_search_for_text; ?>') jQuery('.search_text', $form).val(s);
595 595
 				
596 596
 				// Disable location based search for disabled location post type.
597 597
 				if (jQuery('.search_by_post', $form).val() != '' && typeof gd_cpt_no_location == 'function') {
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
 					}
606 606
 				}
607 607
 				
608
-				if (dist > 0 || (jQuery('select[name="sort_by"]').val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest') || (jQuery(".snear", $form).val() != '' && jQuery(".snear", $form).val() != '<?php echo $default_near_text;?>')) {
608
+				if (dist > 0 || (jQuery('select[name="sort_by"]').val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest') || (jQuery(".snear", $form).val() != '' && jQuery(".snear", $form).val() != '<?php echo $default_near_text; ?>')) {
609 609
 
610 610
                     // OSM can't handel post code with no space so we test for it and add one if needed
611 611
                     if(window.gdMaps === 'osm'){
@@ -634,7 +634,7 @@  discard block
 block discarded – undo
634 634
         });
635 635
         
636 636
 		function geodir_setsearch($form) {
637
-			if ((dist > 0 || (jQuery('select[name="sort_by"]', $form).val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest')) && (jQuery(".snear", $form).val() == '' || jQuery(".snear", $form).val() == '<?php echo $default_near_text;?>')) jQuery(".snear", $form).val(default_location);
637
+			if ((dist > 0 || (jQuery('select[name="sort_by"]', $form).val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest')) && (jQuery(".snear", $form).val() == '' || jQuery(".snear", $form).val() == '<?php echo $default_near_text; ?>')) jQuery(".snear", $form).val(default_location);
638 638
 			geocodeAddress($form);
639 639
 		}
640 640
 
@@ -653,15 +653,15 @@  discard block
 block discarded – undo
653 653
             // Call the geocode function
654 654
             Sgeocoder = window.gdMaps == 'google' ? new google.maps.Geocoder() : null;
655 655
 
656
-            if (jQuery('.snear', $form).val() == '' || ( jQuery('.sgeo_lat').val() != '' && jQuery('.sgeo_lon').val() != ''  ) || jQuery('.snear', $form).val().match("^<?php _e('In:','geodirectory');?>")) {
657
-                if (jQuery('.snear', $form).val().match("^<?php _e('In:','geodirectory');?>")) {
656
+            if (jQuery('.snear', $form).val() == '' || ( jQuery('.sgeo_lat').val() != '' && jQuery('.sgeo_lon').val() != ''  ) || jQuery('.snear', $form).val().match("^<?php _e('In:', 'geodirectory'); ?>")) {
657
+                if (jQuery('.snear', $form).val().match("^<?php _e('In:', 'geodirectory'); ?>")) {
658 658
                     jQuery(".snear", $form).val('');
659 659
                 }
660 660
                 jQuery($form).submit();
661 661
             } else {
662 662
                 var address = jQuery(".snear", $form).val();
663 663
 
664
-                if (jQuery('.snear', $form).val() == '<?php echo $default_near_text;?>') {
664
+                if (jQuery('.snear', $form).val() == '<?php echo $default_near_text; ?>') {
665 665
                     initialise2();
666 666
                 } else {
667 667
                     <?php
@@ -674,21 +674,21 @@  discard block
 block discarded – undo
674 674
                     $near_add2 = apply_filters('geodir_search_near_addition', '');
675 675
                     ?>
676 676
                     if (window.gdMaps === 'google') {
677
-                        Sgeocoder.geocode({'address': address<?php echo ($near_add ? '+", ' . $near_add . '"' : '') . $near_add2;?>},
677
+                        Sgeocoder.geocode({'address': address<?php echo ($near_add ? '+", '.$near_add.'"' : '').$near_add2; ?>},
678 678
                             function (results, status) {
679 679
                                 if (status == google.maps.GeocoderStatus.OK) {
680 680
                                     updateSearchPosition(results[0].geometry.location, $form);
681 681
                                 } else {
682
-                                    alert("<?php esc_attr_e('Search was not successful for the following reason :', 'geodirectory');?>" + status);
682
+                                    alert("<?php esc_attr_e('Search was not successful for the following reason :', 'geodirectory'); ?>" + status);
683 683
                                 }
684 684
                             });
685 685
                     } else if (window.gdMaps === 'osm') {
686
-                        geocodePositionOSM(false, address<?php echo ($near_add ? '+", ' . $near_add . '"' : '') . $near_add2;?>, false, false,
686
+                        geocodePositionOSM(false, address<?php echo ($near_add ? '+", '.$near_add.'"' : '').$near_add2; ?>, false, false,
687 687
                             function(geo) {
688 688
                                 if (typeof geo !== 'undefined' && geo.lat && geo.lon) {
689 689
                                     updateSearchPosition(geo, $form);
690 690
                                 } else {
691
-                                    alert("<?php esc_attr_e('Search was not successful for the requested address.', 'geodirectory');?>");
691
+                                    alert("<?php esc_attr_e('Search was not successful for the requested address.', 'geodirectory'); ?>");
692 692
                                 }
693 693
                             });
694 694
                     } else {
@@ -734,19 +734,19 @@  discard block
 block discarded – undo
734 734
             var msg;
735 735
             switch (err.code) {
736 736
                 case err.UNKNOWN_ERROR:
737
-                    msg = "<?php _e('Unable to find your location','geodirectory');?>";
737
+                    msg = "<?php _e('Unable to find your location', 'geodirectory'); ?>";
738 738
                     break;
739 739
                 case err.PERMISSION_DENINED:
740
-                    msg = "<?php _e('Permission denied in finding your location','geodirectory');?>";
740
+                    msg = "<?php _e('Permission denied in finding your location', 'geodirectory'); ?>";
741 741
                     break;
742 742
                 case err.POSITION_UNAVAILABLE:
743
-                    msg = "<?php _e('Your location is currently unknown','geodirectory');?>";
743
+                    msg = "<?php _e('Your location is currently unknown', 'geodirectory'); ?>";
744 744
                     break;
745 745
                 case err.BREAK:
746
-                    msg = "<?php _e('Attempt to find location took too long','geodirectory');?>";
746
+                    msg = "<?php _e('Attempt to find location took too long', 'geodirectory'); ?>";
747 747
                     break;
748 748
                 default:
749
-                    msg = "<?php _e('Location detection not supported in browser','geodirectory');?>";
749
+                    msg = "<?php _e('Location detection not supported in browser', 'geodirectory'); ?>";
750 750
             }
751 751
             jQuery('#info').html(msg);
752 752
         }
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
              * @param object $post The post object.
797 797
              * @param string $link The link to the post.
798 798
              */
799
-            $return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img">&nbsp;</span></a>',$post,$link);
799
+            $return = apply_filters('geodir_featured_badge_on_image', '<a href="'.$link.'"><span class="geodir_featured_img">&nbsp;</span></a>', $post, $link);
800 800
             break;
801 801
         case 'new' :
802 802
             /**
@@ -806,7 +806,7 @@  discard block
 block discarded – undo
806 806
              * @param object $post The post object.
807 807
              * @param string $link The link to the post.
808 808
              */
809
-            $return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing">&nbsp;</span></a>',$post,$link);
809
+            $return = apply_filters('geodir_new_badge_on_image', '<a href="'.$link.'"><span class="geodir_new_listing">&nbsp;</span></a>', $post, $link);
810 810
             break;
811 811
 
812 812
     }
@@ -820,11 +820,11 @@  discard block
 block discarded – undo
820 820
  * @since 1.6.22
821 821
  */
822 822
 function geodir_fix_script_conflict() {
823
-    if ( wp_script_is( 'flexslider', 'enqueued' ) && wp_script_is( 'geodirectory-jquery-flexslider-js', 'enqueued' ) ) {
824
-        wp_dequeue_script( 'flexslider' );
823
+    if (wp_script_is('flexslider', 'enqueued') && wp_script_is('geodirectory-jquery-flexslider-js', 'enqueued')) {
824
+        wp_dequeue_script('flexslider');
825 825
     }
826 826
 }
827
-add_action( 'wp_enqueue_scripts', 'geodir_fix_script_conflict', 100 );
827
+add_action('wp_enqueue_scripts', 'geodir_fix_script_conflict', 100);
828 828
 
829 829
 /**
830 830
  * make fontawesome search for inline before and after icons
@@ -835,7 +835,7 @@  discard block
 block discarded – undo
835 835
  */
836 836
 function geodir_fontawesome_defer($url)
837 837
 {
838
-    if (strpos($url, '#faload')===false)
838
+    if (strpos($url, '#faload') === false)
839 839
         return $url;
840 840
     else if (is_admin())
841 841
         return str_replace('#faload', '', $url);
@@ -849,9 +849,9 @@  discard block
 block discarded – undo
849 849
 /**
850 850
  * Dequeue our fontawesome if using BB page.
851 851
  */
852
-function geodir_fix_beaver_builder(){
853
-    if(isset($_REQUEST['fl_builder'])){
854
-        wp_dequeue_script( 'font-awesome' );
852
+function geodir_fix_beaver_builder() {
853
+    if (isset($_REQUEST['fl_builder'])) {
854
+        wp_dequeue_script('font-awesome');
855 855
     }
856 856
 }
857
-add_filter('wp_print_scripts','geodir_fix_beaver_builder',100);
857
+add_filter('wp_print_scripts', 'geodir_fix_beaver_builder', 100);
Please login to merge, or discard this patch.