Passed
Push — master ( 9c92c6...54f1c2 )
by Stiofan
10:39
created
geodirectory-admin/admin_functions.php 1 patch
Spacing   +899 added lines, -899 removed lines patch added patch discarded remove patch
@@ -46,31 +46,31 @@  discard block
 block discarded – undo
46 46
     function geodir_admin_styles()
47 47
     {
48 48
 
49
-        wp_register_style('geodirectory-admin-css', geodir_plugin_url() . '/geodirectory-assets/css/admin.css', array(), GEODIRECTORY_VERSION);
49
+        wp_register_style('geodirectory-admin-css', geodir_plugin_url().'/geodirectory-assets/css/admin.css', array(), GEODIRECTORY_VERSION);
50 50
         wp_enqueue_style('geodirectory-admin-css');
51 51
 
52
-        wp_register_style('geodirectory-frontend-style', geodir_plugin_url() . '/geodirectory-assets/css/style.css', array(), GEODIRECTORY_VERSION);
52
+        wp_register_style('geodirectory-frontend-style', geodir_plugin_url().'/geodirectory-assets/css/style.css', array(), GEODIRECTORY_VERSION);
53 53
         wp_enqueue_style('geodirectory-frontend-style');
54 54
 
55
-        wp_register_style('geodir-chosen-style', geodir_plugin_url() . '/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION);
55
+        wp_register_style('geodir-chosen-style', geodir_plugin_url().'/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION);
56 56
         wp_enqueue_style('geodir-chosen-style');
57 57
 
58
-        wp_register_style('geodirectory-jquery-ui-timepicker-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery.ui.timepicker.css', array(), GEODIRECTORY_VERSION);
58
+        wp_register_style('geodirectory-jquery-ui-timepicker-css', geodir_plugin_url().'/geodirectory-assets/css/jquery.ui.timepicker.css', array(), GEODIRECTORY_VERSION);
59 59
         wp_enqueue_style('geodirectory-jquery-ui-timepicker-css');
60 60
 
61
-        wp_register_style('geodirectory-jquery-ui-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery-ui.css', array(), GEODIRECTORY_VERSION);
61
+        wp_register_style('geodirectory-jquery-ui-css', geodir_plugin_url().'/geodirectory-assets/css/jquery-ui.css', array(), GEODIRECTORY_VERSION);
62 62
         wp_enqueue_style('geodirectory-jquery-ui-css');
63 63
 
64
-        wp_register_style('geodirectory-custom-fields-css', geodir_plugin_url() . '/geodirectory-assets/css/custom_field.css', array(), GEODIRECTORY_VERSION);
64
+        wp_register_style('geodirectory-custom-fields-css', geodir_plugin_url().'/geodirectory-assets/css/custom_field.css', array(), GEODIRECTORY_VERSION);
65 65
         wp_enqueue_style('geodirectory-custom-fields-css');
66 66
 
67
-        wp_register_style('geodirectory-pluplodar-css', geodir_plugin_url() . '/geodirectory-assets/css/pluploader.css', array(), GEODIRECTORY_VERSION);
67
+        wp_register_style('geodirectory-pluplodar-css', geodir_plugin_url().'/geodirectory-assets/css/pluploader.css', array(), GEODIRECTORY_VERSION);
68 68
         wp_enqueue_style('geodirectory-pluplodar-css');
69 69
 
70
-        wp_register_style('geodir-rating-style', geodir_plugin_url() . '/geodirectory-assets/css/jRating.jquery.css', array(), GEODIRECTORY_VERSION);
70
+        wp_register_style('geodir-rating-style', geodir_plugin_url().'/geodirectory-assets/css/jRating.jquery.css', array(), GEODIRECTORY_VERSION);
71 71
         wp_enqueue_style('geodir-rating-style');
72 72
 
73
-        wp_register_style('geodir-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl.css', array(), GEODIRECTORY_VERSION);
73
+        wp_register_style('geodir-rtl-style', geodir_plugin_url().'/geodirectory-assets/css/rtl.css', array(), GEODIRECTORY_VERSION);
74 74
         wp_enqueue_style('geodir-rtl-style');
75 75
 
76 76
     }
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
         wp_register_style('geodirectory-font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION);
90 90
         wp_enqueue_style('geodirectory-font-awesome');
91 91
 
92
-        wp_register_script('geodirectory-admin', geodir_plugin_url() . '/geodirectory-assets/js/admin-req.min.js', array('jquery'), GEODIRECTORY_VERSION);
92
+        wp_register_script('geodirectory-admin', geodir_plugin_url().'/geodirectory-assets/js/admin-req.min.js', array('jquery'), GEODIRECTORY_VERSION);
93 93
         wp_enqueue_script('geodirectory-admin');
94 94
 
95 95
     }
@@ -108,59 +108,59 @@  discard block
 block discarded – undo
108 108
         
109 109
         wp_enqueue_script('jquery');
110 110
 
111
-        wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), '', true);
111
+        wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.ui.timepicker.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), '', true);
112 112
 
113
-        wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.js', array('jquery'), GEODIRECTORY_VERSION);
113
+        wp_register_script('chosen', geodir_plugin_url().'/geodirectory-assets/js/chosen.jquery.js', array('jquery'), GEODIRECTORY_VERSION);
114 114
         wp_enqueue_script('chosen');
115 115
 
116
-        wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.js', array(), GEODIRECTORY_VERSION);
116
+        wp_register_script('geodirectory-choose-ajax', geodir_plugin_url().'/geodirectory-assets/js/ajax-chosen.js', array(), GEODIRECTORY_VERSION);
117 117
         wp_enqueue_script('geodirectory-choose-ajax');
118 118
 
119 119
         if (isset($_REQUEST['listing_type'])) {
120
-            wp_register_script('geodirectory-custom-fields-script', geodir_plugin_url() . '/geodirectory-assets/js/custom_fields.js', array(), GEODIRECTORY_VERSION);
120
+            wp_register_script('geodirectory-custom-fields-script', geodir_plugin_url().'/geodirectory-assets/js/custom_fields.js', array(), GEODIRECTORY_VERSION);
121 121
         }
122 122
 
123 123
         wp_enqueue_script('geodirectory-custom-fields-script');
124
-        $plugin_path = geodir_plugin_url() . '/geodirectory-functions/cat-meta-functions';
124
+        $plugin_path = geodir_plugin_url().'/geodirectory-functions/cat-meta-functions';
125 125
 
126
-        wp_enqueue_script('tax-meta-clss', $plugin_path . '/js/tax-meta-clss.js', array('jquery'), null, true);
126
+        wp_enqueue_script('tax-meta-clss', $plugin_path.'/js/tax-meta-clss.js', array('jquery'), null, true);
127 127
 
128 128
         if (in_array($geodir_map_name, array('auto', 'google'))) {
129
-            $map_lang = "&language=" . geodir_get_map_default_language();
129
+            $map_lang = "&language=".geodir_get_map_default_language();
130 130
             /** This filter is documented in geodirectory_template_tags.php */
131 131
             $map_extra = apply_filters('geodir_googlemap_script_extra', '');
132
-            wp_enqueue_script('geodirectory-googlemap-script', '//maps.google.com/maps/api/js?' . $map_lang . $map_extra, '', NULL);
132
+            wp_enqueue_script('geodirectory-googlemap-script', '//maps.google.com/maps/api/js?'.$map_lang.$map_extra, '', NULL);
133 133
         }
134 134
         
135 135
         if ($geodir_map_name == 'osm') {
136 136
             // Leaflet OpenStreetMap
137
-            wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
137
+            wp_register_style('geodirectory-leaflet-style', geodir_plugin_url().'/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
138 138
             wp_enqueue_style('geodirectory-leaflet-style');
139 139
                 
140
-            wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
140
+            wp_register_script('geodirectory-leaflet-script', geodir_plugin_url().'/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
141 141
             wp_enqueue_script('geodirectory-leaflet-script');
142 142
             
143
-            wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.js', array('geodirectory-leaflet-script'), GEODIRECTORY_VERSION);
143
+            wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url().'/geodirectory-assets/leaflet/osm.geocode.js', array('geodirectory-leaflet-script'), GEODIRECTORY_VERSION);
144 144
             wp_enqueue_script('geodirectory-leaflet-geo-script');
145 145
         }
146
-        wp_enqueue_script( 'jquery-ui-autocomplete' );
146
+        wp_enqueue_script('jquery-ui-autocomplete');
147 147
         
148
-        wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true);
148
+        wp_register_script('geodirectory-goMap-script', geodir_plugin_url().'/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true);
149 149
         wp_enqueue_script('geodirectory-goMap-script');
150 150
 
151
-        wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.js', array(), GEODIRECTORY_VERSION);
151
+        wp_register_script('geodirectory-goMap-script', geodir_plugin_url().'/geodirectory-assets/js/goMap.js', array(), GEODIRECTORY_VERSION);
152 152
         wp_enqueue_script('geodirectory-goMap-script');
153 153
 
154 154
 		// font awesome rating script
155 155
 		if (get_option('geodir_reviewrating_enable_font_awesome')) {
156
-			wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION);
156
+			wp_register_script('geodir-barrating-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION);
157 157
 			wp_enqueue_script('geodir-barrating-js');
158 158
 		} else { // default rating script
159
-			wp_register_script('geodir-jRating-js', geodir_plugin_url() . '/geodirectory-assets/js/jRating.jquery.js', array(), GEODIRECTORY_VERSION);
159
+			wp_register_script('geodir-jRating-js', geodir_plugin_url().'/geodirectory-assets/js/jRating.jquery.js', array(), GEODIRECTORY_VERSION);
160 160
 			wp_enqueue_script('geodir-jRating-js');
161 161
 		}
162 162
 
163
-        wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.js', array(), GEODIRECTORY_VERSION);
163
+        wp_register_script('geodir-on-document-load', geodir_plugin_url().'/geodirectory-assets/js/on_document_load.js', array(), GEODIRECTORY_VERSION);
164 164
         wp_enqueue_script('geodir-on-document-load');
165 165
 
166 166
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
         wp_enqueue_script('plupload-all');
169 169
         wp_enqueue_script('jquery-ui-sortable');
170 170
 
171
-        wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.js', array(), GEODIRECTORY_VERSION);
171
+        wp_register_script('geodirectory-plupload-script', geodir_plugin_url().'/geodirectory-assets/js/geodirectory-plupload.js', array(), GEODIRECTORY_VERSION);
172 172
         wp_enqueue_script('geodirectory-plupload-script');
173 173
 
174 174
         // SCRIPT FOR UPLOAD END
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
         wp_localize_script('geodirectory-custom-fields-script', 'geodir_admin_ajax', $ajax_cons_data);
223 223
 
224 224
 
225
-        wp_register_script('geodirectory-admin-script', geodir_plugin_url() . '/geodirectory-assets/js/admin.js', array(), GEODIRECTORY_VERSION);
225
+        wp_register_script('geodirectory-admin-script', geodir_plugin_url().'/geodirectory-assets/js/admin.js', array(), GEODIRECTORY_VERSION);
226 226
         wp_enqueue_script('geodirectory-admin-script');
227 227
 
228 228
         wp_enqueue_style('farbtastic');
@@ -230,10 +230,10 @@  discard block
 block discarded – undo
230 230
 
231 231
         $screen = get_current_screen();
232 232
         if ($screen->base == 'post' && in_array($screen->post_type, geodir_get_posttypes())) {
233
-            wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation_admin.js');
233
+            wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url().'/geodirectory-assets/js/listing_validation_admin.js');
234 234
         }
235 235
 
236
-        $ajax_cons_data = array('url' => __(get_option('siteurl') . '?geodir_ajax=true'));
236
+        $ajax_cons_data = array('url' => __(get_option('siteurl').'?geodir_ajax=true'));
237 237
         wp_localize_script('geodirectory-admin-script', 'geodir_ajax', $ajax_cons_data);
238 238
 
239 239
     }
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 
257 257
         if (current_user_can('manage_options')) $menu[] = array('', 'read', 'separator-geodirectory', '', 'wp-menu-separator geodirectory');
258 258
 
259
-        add_menu_page(__('Geodirectory', 'geodirectory'), __('Geodirectory', 'geodirectory'), 'manage_options', 'geodirectory', 'geodir_admin_panel', geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico', '55.1984');
259
+        add_menu_page(__('Geodirectory', 'geodirectory'), __('Geodirectory', 'geodirectory'), 'manage_options', 'geodirectory', 'geodir_admin_panel', geodir_plugin_url().'/geodirectory-assets/images/favicon.ico', '55.1984');
260 260
 
261 261
 
262 262
     }
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
                 $geodir_menu_order[] = 'separator-geodirectory';
291 291
                 if (!empty($post_types)) {
292 292
                     foreach ($post_types as $post_type) {
293
-                        $geodir_menu_order[] = 'edit.php?post_type=' . $post_type;
293
+                        $geodir_menu_order[] = 'edit.php?post_type='.$post_type;
294 294
                     }
295 295
                 }
296 296
                 $geodir_menu_order[] = $item;
@@ -333,8 +333,8 @@  discard block
 block discarded – undo
333 333
 {
334 334
     if (isset($_REQUEST['installed']) && $_REQUEST['installed'] != '') {
335 335
         echo '<div id="message" class="updated fade">
336
-                        <p style="float:right;">' . __('Like Geodirectory?', 'geodirectory') . ' <a href="http://wordpress.org/extend/plugins/Geodirectory/" target="_blank">' . __('Support us by leaving a rating!', 'geodirectory') . '</a></p>
337
-                        <p><strong>' . __('Geodirectory has been installed and setup. Enjoy :)', 'geodirectory') . '</strong></p>
336
+                        <p style="float:right;">' . __('Like Geodirectory?', 'geodirectory').' <a href="http://wordpress.org/extend/plugins/Geodirectory/" target="_blank">'.__('Support us by leaving a rating!', 'geodirectory').'</a></p>
337
+                        <p><strong>' . __('Geodirectory has been installed and setup. Enjoy :)', 'geodirectory').'</strong></p>
338 338
                 </div>';
339 339
 
340 340
     }
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
     if (isset($_REQUEST['msg']) && $_REQUEST['msg'] != '') {
343 343
         switch ($_REQUEST['msg']) {
344 344
             case 'success':
345
-                echo '<div id="message" class="updated fade"><p><strong>' . __('Your settings have been saved.', 'geodirectory') . '</strong></p></div>';
345
+                echo '<div id="message" class="updated fade"><p><strong>'.__('Your settings have been saved.', 'geodirectory').'</strong></p></div>';
346 346
                 flush_rewrite_rules(false);
347 347
 
348 348
                 break;
@@ -350,20 +350,20 @@  discard block
 block discarded – undo
350 350
 				$gderr = isset($_REQUEST['gderr']) ? $_REQUEST['gderr'] : '';
351 351
 				
352 352
 				if ($gderr == 21)
353
-			    	echo '<div id="message" class="error fade"><p><strong>' . __('Error: You can not add same permalinks for both Listing and Location, please try again.', 'geodirectory') . '</strong></p></div>';
353
+			    	echo '<div id="message" class="error fade"><p><strong>'.__('Error: You can not add same permalinks for both Listing and Location, please try again.', 'geodirectory').'</strong></p></div>';
354 354
 				else
355
-					echo '<div id="message" class="error fade"><p><strong>' . __('Error: Your settings have not been saved, please try again.', 'geodirectory') . '</strong></p></div>';
355
+					echo '<div id="message" class="error fade"><p><strong>'.__('Error: Your settings have not been saved, please try again.', 'geodirectory').'</strong></p></div>';
356 356
                 break;
357 357
         }
358 358
     }
359 359
 
360 360
     if (!geodir_is_default_location_set()) {
361
-        echo '<div class="updated fade"><p><strong>' . sprintf(__('Please %sclick here%s to set a default location, this will make the plugin work properly.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>') . '</strong></p></div>';
361
+        echo '<div class="updated fade"><p><strong>'.sprintf(__('Please %sclick here%s to set a default location, this will make the plugin work properly.', 'geodirectory'), '<a href=\''.admin_url('admin.php?page=geodirectory&tab=default_location_settings').'\'>', '</a>').'</strong></p></div>';
362 362
 
363 363
     }
364 364
 
365 365
     if (!function_exists('curl_init')) {
366
-        echo '<div class="error"><p><strong>' . __('CURL is not installed on this server, this can cause problems, please ask your server admin to install it.', 'geodirectory') . '</strong></p></div>';
366
+        echo '<div class="error"><p><strong>'.__('CURL is not installed on this server, this can cause problems, please ask your server admin to install it.', 'geodirectory').'</strong></p></div>';
367 367
 
368 368
     }
369 369
 }
@@ -379,18 +379,18 @@  discard block
 block discarded – undo
379 379
 function geodir_handle_option_form_submit($current_tab)
380 380
 {
381 381
     global $geodir_settings;
382
-    if (file_exists(dirname(__FILE__) . '/option-pages/' . $current_tab . '_array.php')) {
382
+    if (file_exists(dirname(__FILE__).'/option-pages/'.$current_tab.'_array.php')) {
383 383
         /**
384 384
          * Contains settings array for current tab.
385 385
          *
386 386
          * @since 1.0.0
387 387
          * @package GeoDirectory
388 388
          */
389
-        include_once('option-pages/' . $current_tab . '_array.php');
389
+        include_once('option-pages/'.$current_tab.'_array.php');
390 390
     }
391 391
     if (isset($_POST) && $_POST && isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') :
392 392
         if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
393
-        if (!wp_verify_nonce($_REQUEST['_wpnonce-' . $current_tab], 'geodir-settings-' . $current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
393
+        if (!wp_verify_nonce($_REQUEST['_wpnonce-'.$current_tab], 'geodir-settings-'.$current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
394 394
 		
395 395
 		/**
396 396
 		 * Fires before updating geodirectory admin settings.
@@ -423,13 +423,13 @@  discard block
 block discarded – undo
423 423
          * @param string $current_tab The current settings tab name.
424 424
          * @param array $geodir_settings[$current_tab] The array of settings for the current settings tab.
425 425
          */
426
-        do_action('geodir_update_options_' . $current_tab, $geodir_settings[$current_tab]);
426
+        do_action('geodir_update_options_'.$current_tab, $geodir_settings[$current_tab]);
427 427
 
428 428
         flush_rewrite_rules(false);
429 429
 
430 430
         $current_tab = isset($_REQUEST['tab']) ? $_REQUEST['tab'] : '';
431 431
 
432
-        $redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $_REQUEST['active_tab'] . '&msg=success');
432
+        $redirect_url = admin_url('admin.php?page=geodirectory&tab='.$current_tab.'&active_tab='.$_REQUEST['active_tab'].'&msg=success');
433 433
 
434 434
         wp_redirect($redirect_url);
435 435
         exit();
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 }
440 440
 
441 441
 
442
-if (!function_exists('geodir_autoinstall_admin_header') && (get_option('geodir_installed') || defined( 'GD_TESTING_MODE' ))) {
442
+if (!function_exists('geodir_autoinstall_admin_header') && (get_option('geodir_installed') || defined('GD_TESTING_MODE'))) {
443 443
     /**
444 444
      * GeoDirectory dummy data installation.
445 445
      *
@@ -455,18 +455,18 @@  discard block
 block discarded – undo
455 455
         global $wpdb, $plugin_prefix;
456 456
 
457 457
         if (!geodir_is_default_location_set()) {
458
-            echo '<div class="updated fade"><p><strong>' . sprintf(__('Please %sclick here%s to set a default location, this will help to set location of all dummy data.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>') . '</strong></p></div>';
458
+            echo '<div class="updated fade"><p><strong>'.sprintf(__('Please %sclick here%s to set a default location, this will help to set location of all dummy data.', 'geodirectory'), '<a href=\''.admin_url('admin.php?page=geodirectory&tab=default_location_settings').'\'>', '</a>').'</strong></p></div>';
459 459
         } else {
460 460
 
461
-            $geodir_url = admin_url() . 'admin.php?page=geodirectory&tab=general_settings&active_tab=';
461
+            $geodir_url = admin_url().'admin.php?page=geodirectory&tab=general_settings&active_tab=';
462 462
 
463
-            $post_counts = $wpdb->get_var("SELECT count(post_id) FROM " . $plugin_prefix . $post_type . "_detail WHERE post_dummy='1'");
463
+            $post_counts = $wpdb->get_var("SELECT count(post_id) FROM ".$plugin_prefix.$post_type."_detail WHERE post_dummy='1'");
464 464
 
465 465
             if ($post_counts > 0) {
466 466
                 $nonce = wp_create_nonce('geodir_dummy_posts_delete_noncename');
467 467
 
468
-                $dummy_msg = '<div id="" class="geodir_auto_install updated highlight fade"><p><b>' . SAMPLE_DATA_SHOW_MSG . '</b><br /><a id="geodir_dummy_delete" class="button_delete" onclick="geodir_autoinstall(this,\'geodir_dummy_delete\',\'' . $nonce . '\',\'' . $post_type . '\')" href="javascript:void(0);" redirect_to="' . $geodir_url . '"  >' . DELETE_BTN_SAMPLE_MSG . '</a></p></div>';
469
-                $dummy_msg .= '<div id="" style="display:none;" class="geodir_show_progress updated highlight fade"><p><b>' . GEODIR_SAMPLE_DATA_DELETE_MSG . '</b><br><img src="' . geodir_plugin_url() . '/geodirectory-assets/images/loadingAnimation.gif" /></p></div>';
468
+                $dummy_msg = '<div id="" class="geodir_auto_install updated highlight fade"><p><b>'.SAMPLE_DATA_SHOW_MSG.'</b><br /><a id="geodir_dummy_delete" class="button_delete" onclick="geodir_autoinstall(this,\'geodir_dummy_delete\',\''.$nonce.'\',\''.$post_type.'\')" href="javascript:void(0);" redirect_to="'.$geodir_url.'"  >'.DELETE_BTN_SAMPLE_MSG.'</a></p></div>';
469
+                $dummy_msg .= '<div id="" style="display:none;" class="geodir_show_progress updated highlight fade"><p><b>'.GEODIR_SAMPLE_DATA_DELETE_MSG.'</b><br><img src="'.geodir_plugin_url().'/geodirectory-assets/images/loadingAnimation.gif" /></p></div>';
470 470
             } else {
471 471
                 $options_list = '';
472 472
                 for ($option = 1; $option <= 30; $option++) {
@@ -474,13 +474,13 @@  discard block
 block discarded – undo
474 474
                     if ($option == 10)
475 475
                         $selected = 'selected="selected"';
476 476
 
477
-                    $options_list .= '<option ' . $selected . ' value="' . $option . '">' . $option . '</option>';
477
+                    $options_list .= '<option '.$selected.' value="'.$option.'">'.$option.'</option>';
478 478
                 }
479 479
 
480 480
                 $nonce = wp_create_nonce('geodir_dummy_posts_insert_noncename');
481 481
 
482
-                $dummy_msg = '<div id="" class="geodir_auto_install updated highlight fade"><p><b>' . AUTO_INSATALL_MSG . '</b><br /><select class="selected_sample_data">' . $options_list . '</select><a id="geodir_dummy_insert" class="button_insert" href="javascript:void(0);" onclick="geodir_autoinstall(this,\'geodir_dummy_insert\',\'' . $nonce . '\',\'' . $post_type . '\')"   redirect_to="' . $geodir_url . '" >' . INSERT_BTN_SAMPLE_MSG . '</a></p></div>';
483
-                $dummy_msg .= '<div id="" style="display:none;" class="geodir_show_progress updated highlight fade"><p><b>' . GEODIR_SAMPLE_DATA_IMPORT_MSG . '</b><br><img src="' . geodir_plugin_url() . '/geodirectory-assets/images/loadingAnimation.gif" /><br><span class="dummy_post_inserted"></span></div>';
482
+                $dummy_msg = '<div id="" class="geodir_auto_install updated highlight fade"><p><b>'.AUTO_INSATALL_MSG.'</b><br /><select class="selected_sample_data">'.$options_list.'</select><a id="geodir_dummy_insert" class="button_insert" href="javascript:void(0);" onclick="geodir_autoinstall(this,\'geodir_dummy_insert\',\''.$nonce.'\',\''.$post_type.'\')"   redirect_to="'.$geodir_url.'" >'.INSERT_BTN_SAMPLE_MSG.'</a></p></div>';
483
+                $dummy_msg .= '<div id="" style="display:none;" class="geodir_show_progress updated highlight fade"><p><b>'.GEODIR_SAMPLE_DATA_IMPORT_MSG.'</b><br><img src="'.geodir_plugin_url().'/geodirectory-assets/images/loadingAnimation.gif" /><br><span class="dummy_post_inserted"></span></div>';
484 484
 
485 485
             }
486 486
             echo $dummy_msg;
@@ -488,14 +488,14 @@  discard block
 block discarded – undo
488 488
             <script>
489 489
                 <?php
490 490
                   $default_location = geodir_get_default_location();
491
-                  $city =  isset($default_location->city) ? $default_location->city : '';
492
-                  $region =isset($default_location->region) ? $default_location->region : '';
493
-                  $country =isset($default_location->country) ? $default_location->country : '';
494
-                  $city_latitude =isset($default_location->city_latitude) ? $default_location->city_latitude : '';
495
-                  $city_longitude =isset($default_location->city_longitude) ? $default_location->city_longitude : '';
491
+                  $city = isset($default_location->city) ? $default_location->city : '';
492
+                  $region = isset($default_location->region) ? $default_location->region : '';
493
+                  $country = isset($default_location->country) ? $default_location->country : '';
494
+                  $city_latitude = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
495
+                  $city_longitude = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
496 496
                 ?>
497 497
                 var geocoder = window.gdMaps == 'google' ? new google.maps.Geocoder() : null;
498
-                var CITY_ADDRESS = '<?php echo $city.','.$region.','.$country;?>';
498
+                var CITY_ADDRESS = '<?php echo $city.','.$region.','.$country; ?>';
499 499
                 var bound_lat_lng;
500 500
                 var latlng = ['<?php echo $city_latitude; ?>', <?php echo $city_longitude; ?>];
501 501
                 var lat = <?php echo $city_latitude; ?>;
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
                                 );
539 539
 
540 540
                             } else {
541
-                                alert("<?php _e('Geocode was not successful for the following reason:','geodirectory');?> " + status);
541
+                                alert("<?php _e('Geocode was not successful for the following reason:', 'geodirectory'); ?> " + status);
542 542
                             }
543 543
                         });
544 544
                 }
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
                     var total_dummy_post_count = jQuery('#sub_' + active_tab).find('.selected_sample_data').val();
552 552
 
553 553
                     if (id == 'geodir_dummy_delete') {
554
-                        if (confirm('<?php _e('Are you sure you want to delete dummy data?' , 'geodirectory'); ?>')) {
554
+                        if (confirm('<?php _e('Are you sure you want to delete dummy data?', 'geodirectory'); ?>')) {
555 555
                             jQuery('#sub_' + active_tab).find('.geodir_auto_install').hide();
556 556
                             jQuery('#sub_' + active_tab).find('.geodir_show_progress').show();
557 557
                             jQuery.post('<?php echo geodir_get_ajax_url(); ?>&geodir_autofill=' + id + '&posttype=' + posttype + '&_wpnonce=' + nonce,
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
                         jQuery.post('<?php echo geodir_get_ajax_url(); ?>&geodir_autofill=' + id + '&posttype=' + posttype + '&insert_dummy_post_index=' + dummy_post_index + '&city_bound_lat1=' + bound_lat_lng[0] + '&city_bound_lng1=' + bound_lat_lng[1] + '&city_bound_lat2=' + bound_lat_lng[2] + '&city_bound_lng2=' + bound_lat_lng[3] + '&_wpnonce=' + nonce,
571 571
                             function (data) {
572 572
 
573
-                                jQuery(obj).closest('form').find('.dummy_post_inserted').html('<?php _e('Dummy post(s) inserted:','geodirectory');?> ' + dummy_post_index + ' <?php _e('of' ,'geodirectory'); ?> ' + total_dummy_post_count + '');
573
+                                jQuery(obj).closest('form').find('.dummy_post_inserted').html('<?php _e('Dummy post(s) inserted:', 'geodirectory'); ?> ' + dummy_post_index + ' <?php _e('of', 'geodirectory'); ?> ' + total_dummy_post_count + '');
574 574
                                 dummy_post_index++;
575 575
                                 if (dummy_post_index <= total_dummy_post_count)
576 576
                                     geodir_autoinstall(obj, id, nonce, posttype);
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
      * @package GeoDirectory
612 612
      */
613 613
     include_once('place_dummy_post.php');
614
-    delete_transient( 'cached_dummy_images' );
614
+    delete_transient('cached_dummy_images');
615 615
 
616 616
 }
617 617
 
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
     global $wpdb, $plugin_prefix;
629 629
 
630 630
 
631
-    $post_ids = $wpdb->get_results("SELECT post_id FROM " . $plugin_prefix . "gd_place_detail WHERE post_dummy='1'");
631
+    $post_ids = $wpdb->get_results("SELECT post_id FROM ".$plugin_prefix."gd_place_detail WHERE post_dummy='1'");
632 632
 
633 633
 
634 634
     foreach ($post_ids as $post_ids_obj) {
@@ -636,7 +636,7 @@  discard block
 block discarded – undo
636 636
     }
637 637
 
638 638
     //double check posts are deleted
639
-    $wpdb->get_results("DELETE FROM " . $plugin_prefix . "gd_place_detail WHERE post_dummy='1'");
639
+    $wpdb->get_results("DELETE FROM ".$plugin_prefix."gd_place_detail WHERE post_dummy='1'");
640 640
 }
641 641
 
642 642
 /**
@@ -674,14 +674,14 @@  discard block
 block discarded – undo
674 674
 
675 675
 
676 676
                     if (geodir_dummy_folder_exists())
677
-                        $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
677
+                        $dummy_image_url = geodir_plugin_url()."/geodirectory-admin/dummy/cat_icon";
678 678
                     else
679 679
                         $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
680 680
 
681 681
                     $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
682 682
 
683 683
                     $catname = str_replace(' ', '_', $catname);
684
-                    $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
684
+                    $uploaded = (array) fetch_remote_file("$dummy_image_url/".$catname.".png");
685 685
 
686 686
                     if (empty($uploaded['error'])) {
687 687
                         $new_path = $uploaded['file'];
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
                     $wp_filetype = wp_check_filetype(basename($new_path), null);
692 692
 
693 693
                     $attachment = array(
694
-                        'guid' => $uploads['baseurl'] . '/' . basename($new_path),
694
+                        'guid' => $uploads['baseurl'].'/'.basename($new_path),
695 695
                         'post_mime_type' => $wp_filetype['type'],
696 696
                         'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
697 697
                         'post_content' => '',
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
 
702 702
                     // you must first include the image.php file
703 703
                     // for the function wp_generate_attachment_metadata() to work
704
-                    require_once(ABSPATH . 'wp-admin/includes/image.php');
704
+                    require_once(ABSPATH.'wp-admin/includes/image.php');
705 705
                     $attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
706 706
                     wp_update_attachment_metadata($attach_id, $attach_data);
707 707
 
@@ -718,14 +718,14 @@  discard block
 block discarded – undo
718 718
                 $last_catid = wp_insert_term($catname, 'gd_placecategory');
719 719
 
720 720
                 if (geodir_dummy_folder_exists())
721
-                    $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
721
+                    $dummy_image_url = geodir_plugin_url()."/geodirectory-admin/dummy/cat_icon";
722 722
                 else
723 723
                     $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
724 724
 
725 725
                 $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
726 726
 
727 727
                 $catname = str_replace(' ', '_', $catname);
728
-                $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
728
+                $uploaded = (array) fetch_remote_file("$dummy_image_url/".$catname.".png");
729 729
 
730 730
                 if (empty($uploaded['error'])) {
731 731
                     $new_path = $uploaded['file'];
@@ -735,7 +735,7 @@  discard block
 block discarded – undo
735 735
                 $wp_filetype = wp_check_filetype(basename($new_path), null);
736 736
 
737 737
                 $attachment = array(
738
-                    'guid' => $uploads['baseurl'] . '/' . basename($new_path),
738
+                    'guid' => $uploads['baseurl'].'/'.basename($new_path),
739 739
                     'post_mime_type' => $wp_filetype['type'],
740 740
                     'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
741 741
                     'post_content' => '',
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
 
748 748
                 // you must first include the image.php file
749 749
                 // for the function wp_generate_attachment_metadata() to work
750
-                require_once(ABSPATH . 'wp-admin/includes/image.php');
750
+                require_once(ABSPATH.'wp-admin/includes/image.php');
751 751
                 $attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
752 752
                 wp_update_attachment_metadata($attach_id, $attach_data);
753 753
 
@@ -789,18 +789,18 @@  discard block
 block discarded – undo
789 789
 
790 790
         elseif (isset($value['type']) && $value['type'] == 'image_width') :
791 791
 
792
-            if (isset($value['id']) && isset($_POST[$value['id'] . '_width'])) {
793
-                update_option($value['id'] . '_width', $_POST[$value['id'] . '_width']);
794
-                update_option($value['id'] . '_height', $_POST[$value['id'] . '_height']);
795
-                if (isset($_POST[$value['id'] . '_crop'])) :
796
-                    update_option($value['id'] . '_crop', 1);
792
+            if (isset($value['id']) && isset($_POST[$value['id'].'_width'])) {
793
+                update_option($value['id'].'_width', $_POST[$value['id'].'_width']);
794
+                update_option($value['id'].'_height', $_POST[$value['id'].'_height']);
795
+                if (isset($_POST[$value['id'].'_crop'])) :
796
+                    update_option($value['id'].'_crop', 1);
797 797
                 else :
798
-                    update_option($value['id'] . '_crop', 0);
798
+                    update_option($value['id'].'_crop', 0);
799 799
                 endif;
800 800
             } else {
801
-                update_option($value['id'] . '_width', $value['std']);
802
-                update_option($value['id'] . '_height', $value['std']);
803
-                update_option($value['id'] . '_crop', 1);
801
+                update_option($value['id'].'_width', $value['std']);
802
+                update_option($value['id'].'_height', $value['std']);
803
+                update_option($value['id'].'_crop', 1);
804 804
             }
805 805
 
806 806
         elseif (isset($value['type']) && $value['type'] == 'map') :
@@ -842,12 +842,12 @@  discard block
 block discarded – undo
842 842
         elseif (isset($value['type']) && $value['type'] == 'file') :
843 843
 
844 844
 
845
-            if (isset($_POST[$value['id'] . '_remove']) && $_POST[$value['id'] . '_remove']) {// if remove is set then remove the file
845
+            if (isset($_POST[$value['id'].'_remove']) && $_POST[$value['id'].'_remove']) {// if remove is set then remove the file
846 846
 
847 847
                 if (get_option($value['id'])) {
848 848
                     $image_name_arr = explode('/', get_option($value['id']));
849 849
                     $noimg_name = end($image_name_arr);
850
-                    $img_path = $uploads['path'] . '/' . $noimg_name;
850
+                    $img_path = $uploads['path'].'/'.$noimg_name;
851 851
                     if (file_exists($img_path))
852 852
                         unlink($img_path);
853 853
                 }
@@ -875,7 +875,7 @@  discard block
 block discarded – undo
875 875
                 if (get_option($value['id'])) {
876 876
                     $image_name_arr = explode('/', get_option($value['id']));
877 877
                     $noimg_name = end($image_name_arr);
878
-                    $img_path = $uploads['path'] . '/' . $noimg_name;
878
+                    $img_path = $uploads['path'].'/'.$noimg_name;
879 879
                     if (file_exists($img_path))
880 880
                         unlink($img_path);
881 881
                 }
@@ -896,7 +896,7 @@  discard block
 block discarded – undo
896 896
             // same menu setting per theme.
897 897
             if (isset($value['id']) && $value['id'] == 'geodir_theme_location_nav' && isset($_POST[$value['id']])) {
898 898
                 $theme = wp_get_theme();
899
-                update_option('geodir_theme_location_nav_' . $theme->name, $_POST[$value['id']]);
899
+                update_option('geodir_theme_location_nav_'.$theme->name, $_POST[$value['id']]);
900 900
             }
901 901
 
902 902
             if (isset($value['id']) && isset($_POST[$value['id']])) {
@@ -966,8 +966,8 @@  discard block
 block discarded – undo
966 966
 
967 967
             $listing_slug = $geodir_posttype_info['labels']['singular_name'];
968 968
 
969
-            $tabs[$geodir_post_type . '_fields_settings'] = array(
970
-                'label' => __(ucfirst($listing_slug) . ' Settings', 'geodirectory'),
969
+            $tabs[$geodir_post_type.'_fields_settings'] = array(
970
+                'label' => __(ucfirst($listing_slug).' Settings', 'geodirectory'),
971 971
                 'subtabs' => array(
972 972
                     array('subtab' => 'custom_fields',
973 973
                         'label' => __('Custom Fields', 'geodirectory'),
@@ -1000,7 +1000,7 @@  discard block
 block discarded – undo
1000 1000
  */
1001 1001
 function geodir_tools_setting_tab($tabs)
1002 1002
 {
1003
-    wp_enqueue_script( 'jquery-ui-progressbar' );
1003
+    wp_enqueue_script('jquery-ui-progressbar');
1004 1004
     $tabs['tools_settings'] = array('label' => __('GD Tools', 'geodirectory'));
1005 1005
     return $tabs;
1006 1006
 }
@@ -1034,7 +1034,7 @@  discard block
 block discarded – undo
1034 1034
  */
1035 1035
 function geodir_extend_geodirectory_setting_tab($tabs)
1036 1036
 {
1037
-    $tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory'). ' <i class="fa fa-plug"></i>', 'url' => 'http://wpgeodirectory.com', 'target' => '_blank');
1037
+    $tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory').' <i class="fa fa-plug"></i>', 'url' => 'http://wpgeodirectory.com', 'target' => '_blank');
1038 1038
     return $tabs;
1039 1039
 }
1040 1040
 
@@ -1094,8 +1094,8 @@  discard block
 block discarded – undo
1094 1094
                     _e('Unknown', 'geodirectory');
1095 1095
                 } else {
1096 1096
                     /* If there is a city id, append 'city name' to the text string. */
1097
-                    $add_location_id = $location_id > 0 ? ' (' . $location_id . ')' : '';
1098
-                    echo(__($location->country, 'geodirectory') . '-' . $location->region . '-' . $location->city . $add_location_id);
1097
+                    $add_location_id = $location_id > 0 ? ' ('.$location_id.')' : '';
1098
+                    echo(__($location->country, 'geodirectory').'-'.$location->region.'-'.$location->city.$add_location_id);
1099 1099
                 }
1100 1100
                 break;
1101 1101
 
@@ -1113,14 +1113,14 @@  discard block
 block discarded – undo
1113 1113
                         $expire_class = 'expire_over';
1114 1114
                     }
1115 1115
                     $date_diff = round(abs(strtotime($d1) - strtotime($d2)) / 86400); // get the difference in days
1116
-                    $date_diff_text = '<br /><span class="' . $expire_class . '">(' . $date_diff . ' ' . $state . ')</span>';
1116
+                    $date_diff_text = '<br /><span class="'.$expire_class.'">('.$date_diff.' '.$state.')</span>';
1117 1117
                 }
1118 1118
                 /* If no expire_date is found, output a default message. */
1119 1119
                 if (empty($expire_date))
1120 1120
                     echo __('Unknown', 'geodirectory');
1121 1121
                 /* If there is a expire_date, append 'days left' to the text string. */
1122 1122
                 else
1123
-                    echo $expire_date . $date_diff_text;
1123
+                    echo $expire_date.$date_diff_text;
1124 1124
                 break;
1125 1125
 
1126 1126
             /* If displaying the 'categorys' column. */
@@ -1187,7 +1187,7 @@  discard block
 block discarded – undo
1187 1187
 function geodir_post_information_save($post_id, $post) {
1188 1188
     global $wpdb, $current_user;
1189 1189
 
1190
-    if (isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')) {
1190
+    if (isset($post->post_type) && ($post->post_type == 'nav_menu_item' || $post->post_type == 'page' || $post->post_type == 'post')) {
1191 1191
         return;
1192 1192
     }
1193 1193
 
@@ -1255,7 +1255,7 @@  discard block
 block discarded – undo
1255 1255
                     $tab_id = $value['id'];
1256 1256
 
1257 1257
                 if (isset($value['desc']) && $value['desc'])
1258
-                    $desc = '<span style=" text-transform:none;">:- ' . $value['desc'] . '</span>';
1258
+                    $desc = '<span style=" text-transform:none;">:- '.$value['desc'].'</span>';
1259 1259
 
1260 1260
                 if (isset($value['name']) && $value['name']) {
1261 1261
                     if ($first_title === true) {
@@ -1263,9 +1263,9 @@  discard block
 block discarded – undo
1263 1263
                     } else {
1264 1264
                         echo '</div>';
1265 1265
                     }
1266
-                    echo '<dd id="' . trim($tab_id) . '" class="geodir_option_tabs" ><a href="javascript:void(0);">' . $value['name'] . '</a></dd>';
1266
+                    echo '<dd id="'.trim($tab_id).'" class="geodir_option_tabs" ><a href="javascript:void(0);">'.$value['name'].'</a></dd>';
1267 1267
 
1268
-                    echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
1268
+                    echo '<div id="sub_'.trim($tab_id).'" class="gd-content-heading" style=" margin-bottom:10px;" >';
1269 1269
                 }
1270 1270
 
1271 1271
                 /**
@@ -1275,21 +1275,21 @@  discard block
 block discarded – undo
1275 1275
                  *
1276 1276
                  * @since 1.0.0
1277 1277
                  */
1278
-                do_action('geodir_settings_' . sanitize_title($value['id']));
1278
+                do_action('geodir_settings_'.sanitize_title($value['id']));
1279 1279
                 break;
1280 1280
 
1281 1281
             case 'no_tabs':
1282 1282
 
1283 1283
                 echo '<div class="inner_content_tab_main">';
1284
-                echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
1284
+                echo '<div id="sub_'.trim($tab_id).'" class="gd-content-heading" style=" margin-bottom:10px;" >';
1285 1285
 
1286 1286
                 break;
1287 1287
 
1288 1288
             case 'sectionstart':
1289 1289
                 if (isset($value['desc']) && $value['desc'])
1290
-                    $desc = '<span style=" text-transform:none;"> - ' . $value['desc'] . '</span>';
1290
+                    $desc = '<span style=" text-transform:none;"> - '.$value['desc'].'</span>';
1291 1291
                 if (isset($value['name']) && $value['name'])
1292
-                    echo '<h3>' . $value['name'] . $desc . '</h3>';
1292
+                    echo '<h3>'.$value['name'].$desc.'</h3>';
1293 1293
                 /**
1294 1294
                  * Called after a GeoDirectory settings sectionstart is output in the GD settings page.
1295 1295
                  *
@@ -1297,8 +1297,8 @@  discard block
 block discarded – undo
1297 1297
                  *
1298 1298
                  * @since 1.0.0
1299 1299
                  */
1300
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_start');
1301
-                echo '<table class="form-table">' . "\n\n";
1300
+                if (isset($value['id']) && $value['id']) do_action('geodir_settings_'.sanitize_title($value['id']).'_start');
1301
+                echo '<table class="form-table">'."\n\n";
1302 1302
 
1303 1303
                 break;
1304 1304
             case 'sectionend':
@@ -1309,7 +1309,7 @@  discard block
 block discarded – undo
1309 1309
                  *
1310 1310
                  * @since 1.0.0
1311 1311
                  */
1312
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_end');
1312
+                if (isset($value['id']) && $value['id']) do_action('geodir_settings_'.sanitize_title($value['id']).'_end');
1313 1313
                 echo '</table>';
1314 1314
                 /**
1315 1315
                  * Called after a GeoDirectory settings sectionend is output in the GD settings page.
@@ -1318,7 +1318,7 @@  discard block
 block discarded – undo
1318 1318
                  *
1319 1319
                  * @since 1.0.0
1320 1320
                  */
1321
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_after');
1321
+                if (isset($value['id']) && $value['id']) do_action('geodir_settings_'.sanitize_title($value['id']).'_after');
1322 1322
                 break;
1323 1323
             case 'text':
1324 1324
                 ?>
@@ -1327,7 +1327,7 @@  discard block
 block discarded – undo
1327 1327
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
1328 1328
                                            id="<?php echo esc_attr($value['id']); ?>"
1329 1329
                                            type="<?php echo esc_attr($value['type']); ?>"
1330
-                                           <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1330
+                                           <?php if (isset($value['placeholder'])) {?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1331 1331
                                            style=" <?php echo esc_attr($value['css']); ?>"
1332 1332
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
1333 1333
                                                echo esc_attr(stripslashes(get_option($value['id'])));
@@ -1344,7 +1344,7 @@  discard block
 block discarded – undo
1344 1344
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
1345 1345
                                            id="<?php echo esc_attr($value['id']); ?>"
1346 1346
                                            type="<?php echo esc_attr($value['type']); ?>"
1347
-                                           <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1347
+                                           <?php if (isset($value['placeholder'])) {?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1348 1348
                                            style="<?php echo esc_attr($value['css']); ?>"
1349 1349
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
1350 1350
                                                echo esc_attr(stripslashes(get_option($value['id'])));
@@ -1390,17 +1390,17 @@  discard block
 block discarded – undo
1390 1390
                     <?php _e('Width', 'geodirectory'); ?> <input
1391 1391
                         name="<?php echo esc_attr($value['id']); ?>_width"
1392 1392
                         id="<?php echo esc_attr($value['id']); ?>_width" type="text" size="3"
1393
-                        value="<?php if ($size = get_option($value['id'] . '_width')) echo stripslashes($size); else echo $value['std']; ?>"/>
1393
+                        value="<?php if ($size = get_option($value['id'].'_width')) echo stripslashes($size); else echo $value['std']; ?>"/>
1394 1394
 
1395 1395
                     <?php _e('Height', 'geodirectory'); ?> <input
1396 1396
                         name="<?php echo esc_attr($value['id']); ?>_height"
1397 1397
                         id="<?php echo esc_attr($value['id']); ?>_height" type="text" size="3"
1398
-                        value="<?php if ($size = get_option($value['id'] . '_height')) echo stripslashes($size); else echo $value['std']; ?>"/>
1398
+                        value="<?php if ($size = get_option($value['id'].'_height')) echo stripslashes($size); else echo $value['std']; ?>"/>
1399 1399
 
1400 1400
                     <label><?php _e('Hard Crop', 'geodirectory'); ?> <input
1401 1401
                             name="<?php echo esc_attr($value['id']); ?>_crop"
1402 1402
                             id="<?php echo esc_attr($value['id']); ?>_crop"
1403
-                            type="checkbox" <?php if (get_option($value['id'] . '_crop') != '') checked(get_option($value['id'] . '_crop'), 1); else checked(1); ?> /></label>
1403
+                            type="checkbox" <?php if (get_option($value['id'].'_crop') != '') checked(get_option($value['id'].'_crop'), 1); else checked(1); ?> /></label>
1404 1404
 
1405 1405
                     <span class="description"><?php echo $value['desc'] ?></span></td>
1406 1406
                 </tr><?php
@@ -1450,7 +1450,7 @@  discard block
 block discarded – undo
1450 1450
                                             id="<?php echo esc_attr($value['id']); ?>"
1451 1451
                                             style="<?php echo esc_attr($value['css']); ?>"
1452 1452
                                             class="<?php if (isset($value['class'])) echo $value['class']; ?>"
1453
-                                            data-placeholder="<?php if (isset($value['placeholder_text'])) echo $value['placeholder_text'];?>"
1453
+                                            data-placeholder="<?php if (isset($value['placeholder_text'])) echo $value['placeholder_text']; ?>"
1454 1454
                                             option-ajaxchosen="false">
1455 1455
                         <?php
1456 1456
                         foreach ($value['options'] as $key => $val) {
@@ -1461,7 +1461,7 @@  discard block
 block discarded – undo
1461 1461
                             } else {
1462 1462
                                 ?>
1463 1463
                                 <option
1464
-                                    value="<?php echo esc_attr($key); ?>" <?php selected(true, (is_array($option_values) && in_array($key, $option_values)));?>><?php echo ucfirst($val) ?></option>
1464
+                                    value="<?php echo esc_attr($key); ?>" <?php selected(true, (is_array($option_values) && in_array($key, $option_values))); ?>><?php echo ucfirst($val) ?></option>
1465 1465
                             <?php
1466 1466
                             }
1467 1467
                         }
@@ -1496,7 +1496,7 @@  discard block
 block discarded – undo
1496 1496
                 ?>
1497 1497
 
1498 1498
                 <tr valign="top">
1499
-                    <th class="titledesc" width="40%"><?php _e('Default map language', 'geodirectory');?></th>
1499
+                    <th class="titledesc" width="40%"><?php _e('Default map language', 'geodirectory'); ?></th>
1500 1500
                     <td width="60%">
1501 1501
                         <select name="geodir_default_map_language" style="width:60%">
1502 1502
                             <?php
@@ -1578,7 +1578,7 @@  discard block
 block discarded – undo
1578 1578
 
1579 1579
                 <tr valign="top">
1580 1580
                     <th class="titledesc"
1581
-                        width="40%"><?php _e('Default post type search on map', 'geodirectory');?></th>
1581
+                        width="40%"><?php _e('Default post type search on map', 'geodirectory'); ?></th>
1582 1582
                     <td width="60%">
1583 1583
                         <select name="geodir_default_map_search_pt" style="width:60%">
1584 1584
                             <?php
@@ -1619,7 +1619,7 @@  discard block
 block discarded – undo
1619 1619
                         $cat_display = 'checkbox';
1620 1620
                         $gd_post_types = get_option('geodir_exclude_post_type_on_map');
1621 1621
                         $gd_cats = get_option('geodir_exclude_cat_on_map');
1622
-                        $gd_cats_upgrade = (int)get_option('geodir_exclude_cat_on_map_upgrade');
1622
+                        $gd_cats_upgrade = (int) get_option('geodir_exclude_cat_on_map_upgrade');
1623 1623
                         $count = 1;
1624 1624
                         ?>
1625 1625
                         <table width="70%" class="widefat">
@@ -1648,7 +1648,7 @@  discard block
 block discarded – undo
1648 1648
                                                                                            name="home_map_post_types[]"
1649 1649
                                                                                            id="<?php echo esc_attr($value['id']); ?>"
1650 1650
                                                                                            value="<?php echo $key; ?>"
1651
-                                                                                           class="map_post_type" <?php echo $checked;?> />
1651
+                                                                                           class="map_post_type" <?php echo $checked; ?> />
1652 1652
                                         <?php echo $post_types_obj->labels->singular_name; ?></td>
1653 1653
                                     <td width="40%">
1654 1654
                                         <div class="home_map_category" style="overflow:auto;width:200px;height:100px;"
@@ -1706,12 +1706,12 @@  discard block
 block discarded – undo
1706 1706
                 ?>
1707 1707
                 <fieldset>
1708 1708
                     <legend class="screen-reader-text"><span><?php echo $value['name'] ?></span></legend>
1709
-                    <label for="<?php echo $value['id'];?>">
1709
+                    <label for="<?php echo $value['id']; ?>">
1710 1710
                         <input name="<?php echo esc_attr($value['id']); ?>"
1711
-                               id="<?php echo esc_attr($value['id'] . $value['value']); ?>" type="radio"
1711
+                               id="<?php echo esc_attr($value['id'].$value['value']); ?>" type="radio"
1712 1712
                                value="<?php echo $value['value'] ?>" <?php if (get_option($value['id']) == $value['value']) {
1713 1713
                             echo 'checked="checked"';
1714
-                        }elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
1714
+                        }elseif (get_option($value['id']) == '' && $value['std'] == $value['value']) {echo 'checked="checked"'; } ?> />
1715 1715
                         <?php echo $value['desc']; ?></label><br>
1716 1716
                 </fieldset>
1717 1717
                 <?php
@@ -1731,9 +1731,9 @@  discard block
 block discarded – undo
1731 1731
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1732 1732
                 <td class="forminp">
1733 1733
                     <textarea
1734
-                        <?php if (isset($value['args'])) echo $value['args'] . ' '; ?>name="<?php echo esc_attr($value['id']); ?>"
1734
+                        <?php if (isset($value['args'])) echo $value['args'].' '; ?>name="<?php echo esc_attr($value['id']); ?>"
1735 1735
                         id="<?php echo esc_attr($value['id']); ?>"
1736
-                        <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1736
+                        <?php if (isset($value['placeholder'])) {?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1737 1737
                         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
1738 1738
                         class="description"><?php echo $value['desc'] ?></span>
1739 1739
 
@@ -1778,7 +1778,7 @@  discard block
 block discarded – undo
1778 1778
 					}
1779 1779
 				}
1780 1780
 				//
1781
-				$page_setting = (int)get_option($value['id']);
1781
+				$page_setting = (int) get_option($value['id']);
1782 1782
 
1783 1783
                 $args = array('name' => $value['id'],
1784 1784
                     'id' => $value['id'],
@@ -1795,7 +1795,7 @@  discard block
 block discarded – undo
1795 1795
                 <tr valign="top" class="single_select_page">
1796 1796
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1797 1797
                 <td class="forminp">
1798
-                    <?php echo str_replace(' id=', " data-placeholder='" . __('Select a page...', 'geodirectory') . "' style='" . $value['css'] . "' class='" . $value['class'] . "' " . $disabled . " id=", wp_dropdown_pages($args)); ?>
1798
+                    <?php echo str_replace(' id=', " data-placeholder='".__('Select a page...', 'geodirectory')."' style='".$value['css']."' class='".$value['class']."' ".$disabled." id=", wp_dropdown_pages($args)); ?>
1799 1799
                     <span class="description"><?php echo $value['desc'] ?></span>
1800 1800
                 </td>
1801 1801
                 </tr><?php
@@ -1804,7 +1804,7 @@  discard block
 block discarded – undo
1804 1804
 				}
1805 1805
                 break;
1806 1806
             case 'single_select_country' :
1807
-                $country_setting = (string)get_option($value['id']);
1807
+                $country_setting = (string) get_option($value['id']);
1808 1808
                 if (strstr($country_setting, ':')) :
1809 1809
                     $country = current(explode(':', $country_setting));
1810 1810
                     $state = end(explode(':', $country_setting));
@@ -1827,7 +1827,7 @@  discard block
 block discarded – undo
1827 1827
             case 'multi_select_countries' :
1828 1828
                 $countries = $geodirectory->countries->countries;
1829 1829
                 asort($countries);
1830
-                $selections = (array)get_option($value['id']);
1830
+                $selections = (array) get_option($value['id']);
1831 1831
                 ?>
1832 1832
                 <tr valign="top">
1833 1833
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
@@ -1837,7 +1837,7 @@  discard block
 block discarded – undo
1837 1837
                             title="Country" class="chosen_select">
1838 1838
                         <?php
1839 1839
                         if ($countries) foreach ($countries as $key => $val) :
1840
-                            echo '<option value="' . $key . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>';
1840
+                            echo '<option value="'.$key.'" '.selected(in_array($key, $selections), true, false).'>'.$val.'</option>';
1841 1841
                         endforeach;
1842 1842
                         ?>
1843 1843
                     </select>
@@ -1849,8 +1849,8 @@  discard block
 block discarded – undo
1849 1849
                 break;
1850 1850
 
1851 1851
             case 'google_analytics' :
1852
-                $selections = (array)get_option($value['id']);
1853
-                if(get_option('geodir_ga_client_id') && get_option('geodir_ga_client_secret') ) {
1852
+                $selections = (array) get_option($value['id']);
1853
+                if (get_option('geodir_ga_client_id') && get_option('geodir_ga_client_secret')) {
1854 1854
                     ?>
1855 1855
                     <tr valign="top">
1856 1856
                         <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
@@ -1861,20 +1861,20 @@  discard block
 block discarded – undo
1861 1861
 
1862 1862
                             $oAuthURL = "https://accounts.google.com/o/oauth2/auth?";
1863 1863
                             $scope = "scope=https://www.googleapis.com/auth/analytics.readonly";
1864
-                            $state = "&state=123";//any string
1865
-                            $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
1864
+                            $state = "&state=123"; //any string
1865
+                            $redirect_uri = "&redirect_uri=".admin_url('admin-ajax.php')."?action=geodir_ga_callback";
1866 1866
                             $response_type = "&response_type=code";
1867 1867
                             $client_id = "&client_id=".get_option('geodir_ga_client_id');
1868 1868
                             $access_type = "&access_type=offline";
1869 1869
                             $approval_prompt = "&approval_prompt=force";
1870 1870
 
1871
-                            $auth_url = $oAuthURL . $scope . $state . $redirect_uri . $response_type . $client_id . $access_type . $approval_prompt;
1871
+                            $auth_url = $oAuthURL.$scope.$state.$redirect_uri.$response_type.$client_id.$access_type.$approval_prompt;
1872 1872
 
1873 1873
 
1874 1874
                             ?>
1875 1875
                             <script>
1876 1876
                                 function gd_ga_popup() {
1877
-                                    var win = window.open("<?php echo $auth_url;?>", "Google Analytics", "");
1877
+                                    var win = window.open("<?php echo $auth_url; ?>", "Google Analytics", "");
1878 1878
                                     var pollTimer = window.setInterval(function () {
1879 1879
                                         if (win.closed !== false) { // !== is required for compatibility with Opera
1880 1880
                                             window.clearInterval(pollTimer);
@@ -1896,7 +1896,7 @@  discard block
 block discarded – undo
1896 1896
                             } else {
1897 1897
                                 ?>
1898 1898
                                 <span class="button-primary"
1899
-                                      onclick="gd_ga_popup();"><?php _e('Authorize', 'geodirectory');?></span>
1899
+                                      onclick="gd_ga_popup();"><?php _e('Authorize', 'geodirectory'); ?></span>
1900 1900
                             <?php
1901 1901
                             }
1902 1902
                             ?>
@@ -1967,9 +1967,9 @@  discard block
 block discarded – undo
1967 1967
 
1968 1968
             <?php if (isset($_REQUEST['active_tab']) && $_REQUEST['active_tab'] != '') { ?>
1969 1969
             jQuery('.geodir_option_tabs').removeClass('gd-tab-active');
1970
-            jQuery('#<?php echo sanitize_text_field($_REQUEST['active_tab']);?>').addClass('gd-tab-active');
1970
+            jQuery('#<?php echo sanitize_text_field($_REQUEST['active_tab']); ?>').addClass('gd-tab-active');
1971 1971
             jQuery('.gd-content-heading').hide();
1972
-            jQuery('#sub_<?php echo sanitize_text_field($_REQUEST['active_tab']);?>').show();
1972
+            jQuery('#sub_<?php echo sanitize_text_field($_REQUEST['active_tab']); ?>').show();
1973 1973
             <?php } ?>
1974 1974
         });
1975 1975
     </script>
@@ -2055,7 +2055,7 @@  discard block
 block discarded – undo
2055 2055
     wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_attachments_noncename');
2056 2056
 
2057 2057
     if (geodir_get_featured_image($post_id, 'thumbnail')) {
2058
-        echo '<h4>' . __('Featured Image', 'geodirectory') . '</h4>';
2058
+        echo '<h4>'.__('Featured Image', 'geodirectory').'</h4>';
2059 2059
         geodir_show_featured_image($post_id, 'thumbnail');
2060 2060
     }
2061 2061
 
@@ -2066,13 +2066,13 @@  discard block
 block discarded – undo
2066 2066
 
2067 2067
     <h5 class="form_title">
2068 2068
         <?php if ($image_limit != 0 && $image_limit == 1) {
2069
-            echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
2069
+            echo '<br /><small>('.__('You can upload', 'geodirectory').' '.$image_limit.' '.__('image with this package', 'geodirectory').')</small>';
2070 2070
         } ?>
2071 2071
         <?php if ($image_limit != 0 && $image_limit > 1) {
2072
-            echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
2072
+            echo '<br /><small>('.__('You can upload', 'geodirectory').' '.$image_limit.' '.__('images with this package', 'geodirectory').')</small>';
2073 2073
         } ?>
2074 2074
         <?php if ($image_limit == 0) {
2075
-            echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
2075
+            echo '<br /><small>('.__('You can upload unlimited images with this package', 'geodirectory').')</small>';
2076 2076
         } ?>
2077 2077
     </h5>
2078 2078
 
@@ -2111,10 +2111,10 @@  discard block
 block discarded – undo
2111 2111
         <div
2112 2112
             class="plupload-upload-uic hide-if-no-js <?php if ($multiple): ?>plupload-upload-uic-multiple<?php endif; ?>"
2113 2113
             id="<?php echo $id; ?>plupload-upload-ui">
2114
-            <h4><?php _e('Drop files to upload', 'geodirectory');?></h4>
2114
+            <h4><?php _e('Drop files to upload', 'geodirectory'); ?></h4>
2115 2115
             <input id="<?php echo $id; ?>plupload-browse-button" type="button"
2116 2116
                    value="<?php _e('Select Files', 'geodirectory'); ?>" class="button"/>
2117
-            <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce($id . 'pluploadan'); ?>"></span>
2117
+            <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce($id.'pluploadan'); ?>"></span>
2118 2118
             <?php if ($width && $height): ?>
2119 2119
                 <span class="plupload-resize"></span>
2120 2120
                 <span class="plupload-width" id="plupload-width<?php echo $width; ?>"></span>
@@ -2126,7 +2126,7 @@  discard block
 block discarded – undo
2126 2126
              id="<?php echo $id; ?>plupload-thumbs" style="border-top:1px solid #ccc; padding-top:10px;">
2127 2127
         </div>
2128 2128
         <span
2129
-            id="upload-msg"><?php _e('Please drag &amp; drop the images to rearrange the order', 'geodirectory');?></span>
2129
+            id="upload-msg"><?php _e('Please drag &amp; drop the images to rearrange the order', 'geodirectory'); ?></span>
2130 2130
         <span id="<?php echo $id; ?>upload-error" style="display:none"></span>
2131 2131
     </div>
2132 2132
 
@@ -2336,9 +2336,9 @@  discard block
 block discarded – undo
2336 2336
     $plugin = 'avada-nag';
2337 2337
     $timestamp = 'avada-nag1234';
2338 2338
     $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');
2339
-    echo '<div id="' . $timestamp . '"  class="error">';
2340
-    echo '<span class="gd-remove-noti" onclick="gdRemoveANotification(\'' . $plugin . '\',\'' . $timestamp . '\');" ><i class="fa fa-times"></i></span>';
2341
-    echo "<img class='gd-icon-noti' src='" . plugin_dir_url('') . "geodirectory/geodirectory-assets/images/favicon.ico' > ";
2339
+    echo '<div id="'.$timestamp.'"  class="error">';
2340
+    echo '<span class="gd-remove-noti" onclick="gdRemoveANotification(\''.$plugin.'\',\''.$timestamp.'\');" ><i class="fa fa-times"></i></span>';
2341
+    echo "<img class='gd-icon-noti' src='".plugin_dir_url('')."geodirectory/geodirectory-assets/images/favicon.ico' > ";
2342 2342
     echo "<p>$message</p>";
2343 2343
     echo "</div>";
2344 2344
 
@@ -2471,7 +2471,7 @@  discard block
 block discarded – undo
2471 2471
 		
2472 2472
 		// Don't allow same slug url for listing and location
2473 2473
 		if (geodir_strtolower($listing_prefix) == geodir_strtolower($location_prefix)) {
2474
-			$redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $active_tab . '&msg=fail&gderr=21');
2474
+			$redirect_url = admin_url('admin.php?page=geodirectory&tab='.$current_tab.'&active_tab='.$active_tab.'&msg=fail&gderr=21');
2475 2475
         	wp_redirect($redirect_url);
2476 2476
 			exit;
2477 2477
 		}
@@ -2483,7 +2483,7 @@  discard block
 block discarded – undo
2483 2483
 			$default_language = $sitepress->get_default_language();
2484 2484
 			
2485 2485
 			if ($current_language != 'all' && $current_language != $default_language) {
2486
-				$redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $active_tab);
2486
+				$redirect_url = admin_url('admin.php?page=geodirectory&tab='.$current_tab.'&active_tab='.$active_tab);
2487 2487
 				wp_redirect($redirect_url);
2488 2488
 				exit;
2489 2489
 			}
@@ -2504,11 +2504,11 @@  discard block
 block discarded – undo
2504 2504
 function geodir_hide_admin_preview_button() {
2505 2505
     global $post_type;
2506 2506
     $post_types = geodir_get_posttypes();
2507
-    if(in_array($post_type, $post_types))
2507
+    if (in_array($post_type, $post_types))
2508 2508
         echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
2509 2509
 }
2510
-add_action( 'admin_head-post-new.php', 'geodir_hide_admin_preview_button' );
2511
-add_action( 'admin_head-post.php', 'geodir_hide_admin_preview_button' );
2510
+add_action('admin_head-post-new.php', 'geodir_hide_admin_preview_button');
2511
+add_action('admin_head-post.php', 'geodir_hide_admin_preview_button');
2512 2512
 
2513 2513
 /**
2514 2514
  * Add the tab in left sidebar menu fro import & export page.
@@ -2518,8 +2518,8 @@  discard block
 block discarded – undo
2518 2518
  *
2519 2519
  * @return array Array of tab data.
2520 2520
  */
2521
-function geodir_import_export_tab( $tabs ) {
2522
-	$tabs['import_export'] = array( 'label' => __( 'Import & Export', 'geodirectory' ) );
2521
+function geodir_import_export_tab($tabs) {
2522
+	$tabs['import_export'] = array('label' => __('Import & Export', 'geodirectory'));
2523 2523
     return $tabs;
2524 2524
 }
2525 2525
 
@@ -2533,8 +2533,8 @@  discard block
 block discarded – undo
2533 2533
  * @return string Html content.
2534 2534
  */
2535 2535
 function geodir_import_export_page() {
2536
-	$nonce = wp_create_nonce( 'geodir_import_export_nonce' );
2537
-	$gd_cats_sample_csv = geodir_plugin_url() . '/geodirectory-assets/gd_sample_categories.csv';
2536
+	$nonce = wp_create_nonce('geodir_import_export_nonce');
2537
+	$gd_cats_sample_csv = geodir_plugin_url().'/geodirectory-assets/gd_sample_categories.csv';
2538 2538
     /**
2539 2539
      * Filter sample category data csv file url.
2540 2540
      *
@@ -2543,9 +2543,9 @@  discard block
 block discarded – undo
2543 2543
      *
2544 2544
      * @param string $gd_cats_sample_csv Sample category data csv file url.
2545 2545
      */
2546
-	$gd_cats_sample_csv = apply_filters( 'geodir_export_cats_sample_csv', $gd_cats_sample_csv );
2546
+	$gd_cats_sample_csv = apply_filters('geodir_export_cats_sample_csv', $gd_cats_sample_csv);
2547 2547
 	
2548
-	$gd_posts_sample_csv = geodir_plugin_url() . '/geodirectory-assets/place_listing.csv';
2548
+	$gd_posts_sample_csv = geodir_plugin_url().'/geodirectory-assets/place_listing.csv';
2549 2549
     /**
2550 2550
      * Filter sample post data csv file url.
2551 2551
      *
@@ -2554,15 +2554,15 @@  discard block
 block discarded – undo
2554 2554
      *
2555 2555
      * @param string $gd_posts_sample_csv Sample post data csv file url.
2556 2556
      */
2557
-    $gd_posts_sample_csv = apply_filters( 'geodir_export_posts_sample_csv', $gd_posts_sample_csv );
2557
+    $gd_posts_sample_csv = apply_filters('geodir_export_posts_sample_csv', $gd_posts_sample_csv);
2558 2558
 	
2559
-	$gd_posttypes = geodir_get_posttypes( 'array' );
2559
+	$gd_posttypes = geodir_get_posttypes('array');
2560 2560
 	
2561 2561
 	$gd_posttypes_option = '';
2562
-	foreach ( $gd_posttypes as $gd_posttype => $row ) {
2563
-		$gd_posttypes_option .= '<option value="' . $gd_posttype . '" data-cats="' . (int)geodir_get_terms_count( $gd_posttype ) . '" data-posts="' . (int)geodir_get_posts_count( $gd_posttype ) . '">' . __( $row['labels']['name'], 'geodirectory' ) . '</option>';
2562
+	foreach ($gd_posttypes as $gd_posttype => $row) {
2563
+		$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>';
2564 2564
 	}
2565
-	wp_enqueue_script( 'jquery-ui-progressbar' );
2565
+	wp_enqueue_script('jquery-ui-progressbar');
2566 2566
 	
2567 2567
 	$gd_chunksize_options = array();
2568 2568
 	$gd_chunksize_options[100] = 100;
@@ -2584,49 +2584,49 @@  discard block
 block discarded – undo
2584 2584
      *
2585 2585
      * @param string $gd_chunksize_options Entries options.
2586 2586
      */
2587
-    $gd_chunksize_options = apply_filters( 'geodir_export_csv_chunksize_options', $gd_chunksize_options );
2587
+    $gd_chunksize_options = apply_filters('geodir_export_csv_chunksize_options', $gd_chunksize_options);
2588 2588
 	
2589 2589
 	$gd_chunksize_option = '';
2590 2590
 	foreach ($gd_chunksize_options as $value => $title) {
2591
-		$gd_chunksize_option .= '<option value="' . $value . '" ' . selected($value, 5000, false) . '>' . $title . '</option>';
2591
+		$gd_chunksize_option .= '<option value="'.$value.'" '.selected($value, 5000, false).'>'.$title.'</option>';
2592 2592
 	}
2593 2593
 	
2594 2594
 	$uploads = wp_upload_dir();
2595 2595
 ?>
2596 2596
 </form>
2597 2597
 <div class="inner_content_tab_main gd-import-export">
2598
-  <h3><?php _e( 'GD Import & Export CSV', 'geodirectory' ) ;?></h3>
2599
-  <span class="description"><?php _e( 'Import & export csv for GD listings & categories.', 'geodirectory' ) ;?></span>
2598
+  <h3><?php _e('GD Import & Export CSV', 'geodirectory'); ?></h3>
2599
+  <span class="description"><?php _e('Import & export csv for GD listings & categories.', 'geodirectory'); ?></span>
2600 2600
   <div class="gd-content-heading">
2601 2601
 
2602 2602
   <?php
2603 2603
     ini_set('max_execution_time', 999999);
2604
-    $ini_max_execution_time_check = @ini_get( 'max_execution_time' );
2604
+    $ini_max_execution_time_check = @ini_get('max_execution_time');
2605 2605
     ini_restore('max_execution_time');
2606 2606
 
2607
-    if($ini_max_execution_time_check != 999999){ // only show these setting to the user if we can't change the ini setting
2607
+    if ($ini_max_execution_time_check != 999999) { // only show these setting to the user if we can't change the ini setting
2608 2608
         ?>
2609 2609
 	<div id="gd_ie_reqs" class="metabox-holder">
2610 2610
       <div class="meta-box-sortables ui-sortable">
2611 2611
         <div class="postbox">
2612
-          <h3 class="hndle"><span style='vertical-align:top;'><?php echo __( 'PHP Requirements for GD Import & Export CSV', 'geodirectory' );?></span></h3>
2612
+          <h3 class="hndle"><span style='vertical-align:top;'><?php echo __('PHP Requirements for GD Import & Export CSV', 'geodirectory'); ?></span></h3>
2613 2613
           <div class="inside">
2614
-            <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>
2614
+            <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>
2615 2615
 			<table class="form-table">
2616 2616
 				<thead>
2617 2617
 				  <tr>
2618
-				  	<th><?php _e( 'PHP Settings', 'geodirectory' );?></th><th><?php _e( 'Current Value', 'geodirectory' );?></th><th><?php _e( 'Recommended Value', 'geodirectory' );?></th>
2618
+				  	<th><?php _e('PHP Settings', 'geodirectory'); ?></th><th><?php _e('Current Value', 'geodirectory'); ?></th><th><?php _e('Recommended Value', 'geodirectory'); ?></th>
2619 2619
 				  </tr>
2620 2620
 				</thead>
2621 2621
 				<tbody>
2622 2622
 				  <tr>
2623
-				  	<td>max_input_time</td><td><?php echo @ini_get( 'max_input_time' );?></td><td>3000</td>
2623
+				  	<td>max_input_time</td><td><?php echo @ini_get('max_input_time'); ?></td><td>3000</td>
2624 2624
 				  </tr>
2625 2625
 				  <tr>
2626
-				  	<td>max_execution_time</td><td><?php  echo @ini_get( 'max_execution_time' );?></td><td>3000</td>
2626
+				  	<td>max_execution_time</td><td><?php  echo @ini_get('max_execution_time'); ?></td><td>3000</td>
2627 2627
 				  </tr>
2628 2628
 				  <tr>
2629
-				  	<td>memory_limit</td><td><?php echo @ini_get( 'memory_limit' );?></td><td>256M</td>
2629
+				  	<td>memory_limit</td><td><?php echo @ini_get('memory_limit'); ?></td><td>256M</td>
2630 2630
 				  </tr>
2631 2631
 				</tbody>
2632 2632
 		    </table>
@@ -2638,21 +2638,21 @@  discard block
 block discarded – undo
2638 2638
 	<div id="gd_ie_imposts" class="metabox-holder">
2639 2639
       <div class="meta-box-sortables ui-sortable">
2640 2640
         <div id="gd_ie_im_posts" class="postbox gd-hndle-pbox">
2641
-          <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>
2642
-          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Listings: Import CSV', 'geodirectory' );?></span></h3>
2641
+          <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>
2642
+          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Listings: Import CSV', 'geodirectory'); ?></span></h3>
2643 2643
           <div class="inside">
2644 2644
             <table class="form-table">
2645 2645
 				<tbody>
2646 2646
 				  <tr>
2647 2647
 					<td class="gd-imex-box">
2648 2648
 						<div class="gd-im-choices">
2649
-						<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>
2650
-						<p><input type="radio" checked="checked" value="skip" name="gd_im_choicepost" id="gd_im_pchoice_s" /><label for="gd_im_pchoice_s"><?php _e( 'Ignore listing if post with post_id already exists.', 'geodirectory' );?></label></p>
2649
+						<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>
2650
+						<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>
2651 2651
 						</div>
2652 2652
 						<div class="plupload-upload-uic hide-if-no-js" id="gd_im_postplupload-upload-ui">
2653 2653
 							<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');" />
2654
-							<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">
2655
-						<input type="hidden" id="gd_ie_imposts_csv" value="<?php echo $gd_posts_sample_csv;?>" />
2654
+							<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">
2655
+						<input type="hidden" id="gd_ie_imposts_csv" value="<?php echo $gd_posts_sample_csv; ?>" />
2656 2656
 							<?php
2657 2657
 							/**
2658 2658
 							 * Called just after the sample CSV download link.
@@ -2661,7 +2661,7 @@  discard block
 block discarded – undo
2661 2661
 							 */
2662 2662
 							do_action('geodir_sample_csv_download_link');
2663 2663
 							?>
2664
-							<span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce( 'gd_im_postpluploadan' ); ?>"></span>
2664
+							<span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce('gd_im_postpluploadan'); ?>"></span>
2665 2665
 							<div class="filelist"></div>
2666 2666
 						</div>
2667 2667
 						<span id="gd_im_catupload-error" style="display:none"></span>
@@ -2679,7 +2679,7 @@  discard block
 block discarded – undo
2679 2679
 							<input type="hidden" id="gd_terminateaction" value="continue"/>
2680 2680
 						</div>
2681 2681
 						<div class="gd-import-progress" id="gd-import-progress" style="display:none">
2682
-							<div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory');?> </b><font
2682
+							<div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory'); ?> </b><font
2683 2683
 									id="gd-import-done">0</font> / <font id="gd-import-total">0</font>&nbsp;( <font
2684 2684
 									id="gd-import-perc">0%</font> )
2685 2685
 								<div class="gd-fileprogress"></div>
@@ -2691,10 +2691,10 @@  discard block
 block discarded – undo
2691 2691
                     	<div class="gd-imex-btns" style="display:none;">
2692 2692
                         	<input type="hidden" class="geodir_import_file" name="geodir_import_file" value="save"/>
2693 2693
                         	<input onclick="gd_imex_PrepareImport(this, 'post')" type="button" value="<?php echo CSV_IMPORT_DATA; ?>" id="gd_import_data" class="button-primary" />
2694
-                        	<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"/>
2695
-                        	<input type="button" value="<?php _e("Terminate Import Data", 'geodirectory');?>" id="gd_stop_import" class="button-primary" name="gd_stop_import" style="display:none" onclick="gd_imex_TerminateImport(this, 'post')"/>
2694
+                        	<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"/>
2695
+                        	<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')"/>
2696 2696
 							<div id="gd_process_data" style="display:none">
2697
-								<span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory');?>
2697
+								<span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory'); ?>
2698 2698
 							</div>
2699 2699
 						</div>
2700 2700
 					</td>
@@ -2708,26 +2708,26 @@  discard block
 block discarded – undo
2708 2708
 	<div id="gd_ie_excategs" class="metabox-holder">
2709 2709
 	  <div class="meta-box-sortables ui-sortable">
2710 2710
 		<div id="gd_ie_ex_posts" class="postbox gd-hndle-pbox">
2711
-		  <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>
2712
-          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Listings: Export CSV', 'geodirectory' );?></span></h3>
2711
+		  <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>
2712
+          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Listings: Export CSV', 'geodirectory'); ?></span></h3>
2713 2713
 		  <div class="inside">
2714 2714
 			<table class="form-table">
2715 2715
 			  <tbody>
2716 2716
 				<tr>
2717 2717
 				  <td class="fld"><label for="gd_post_type">
2718
-					<?php _e( 'Post Type:', 'geodirectory' );?>
2718
+					<?php _e('Post Type:', 'geodirectory'); ?>
2719 2719
 					</label></td>
2720 2720
 				  <td><select name="gd_post_type" id="gd_post_type" style="min-width:140px">
2721
-					  <?php echo $gd_posttypes_option;?>
2721
+					  <?php echo $gd_posttypes_option; ?>
2722 2722
 					</select></td>
2723 2723
 				</tr>
2724 2724
 				<tr>
2725
-					<td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e( 'Max entries per csv file:', 'geodirectory' );?></label></td>
2726
-					<td><select name="gd_chunk_size" id="gd_chunk_size" style="min-width:140px"><?php echo $gd_chunksize_option;?></select><span class="description"><?php _e( 'Please select the maximum number of entries per csv file (defaults to 5000, you might want to lower this to prevent memory issues on some installs)', 'geodirectory' );?></span></td>
2725
+					<td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e('Max entries per csv file:', 'geodirectory'); ?></label></td>
2726
+					<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>
2727 2727
 				  </tr>
2728 2728
 				<tr>
2729 2729
 				  <td class="fld" style="vertical-align:top"><label>
2730
-					<?php _e( 'Progress:', 'geodirectory' );?>
2730
+					<?php _e('Progress:', 'geodirectory'); ?>
2731 2731
 					</label></td>
2732 2732
 				  <td><div id='gd_progressbar_box'>
2733 2733
 					  <div id="gd_progressbar" class="gd_progressbar">
@@ -2735,13 +2735,13 @@  discard block
 block discarded – undo
2735 2735
 					  </div>
2736 2736
 					</div>
2737 2737
 					<p style="display:inline-block">
2738
-					  <?php _e( 'Elapsed Time:', 'geodirectory' );?>
2738
+					  <?php _e('Elapsed Time:', 'geodirectory'); ?>
2739 2739
 					</p>
2740 2740
 					  
2741 2741
 					<p id="gd_timer" class="gd_timer">00:00:00</p></td>
2742 2742
 				</tr>
2743 2743
 				<tr class="gd-ie-actions">
2744
-				  <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">
2744
+				  <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">
2745 2745
 				  </td>
2746 2746
 				  <td id="gd_ie_ex_files" class="gd-ie-files"></td>
2747 2747
 				</tr>
@@ -2754,21 +2754,21 @@  discard block
 block discarded – undo
2754 2754
 	<div id="gd_ie_imcategs" class="metabox-holder">
2755 2755
       <div class="meta-box-sortables ui-sortable">
2756 2756
         <div id="gd_ie_imcats" class="postbox gd-hndle-pbox">
2757
-          <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>
2758
-          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Categories: Import CSV', 'geodirectory' );?></span></h3>
2757
+          <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>
2758
+          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Categories: Import CSV', 'geodirectory'); ?></span></h3>
2759 2759
           <div class="inside">
2760 2760
             <table class="form-table">
2761 2761
 				<tbody>
2762 2762
 				  <tr>
2763 2763
 					<td class="gd-imex-box">
2764 2764
 						<div class="gd-im-choices">
2765
-						<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>
2766
-						<p><input type="radio" checked="checked" value="skip" name="gd_im_choicecat" id="gd_im_cchoice_s" /><label for="gd_im_cchoice_s"><?php _e( 'Ignore item if item with cat_id/cat_slug already exists.', 'geodirectory' );?></label></p>
2765
+						<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>
2766
+						<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>
2767 2767
 						</div>
2768 2768
 						<div class="plupload-upload-uic hide-if-no-js" id="gd_im_catplupload-upload-ui">
2769 2769
 							<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');" />
2770
-							<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">
2771
-						<input type="hidden" id="gd_ie_imcats_csv" value="<?php echo $gd_cats_sample_csv;?>" />
2770
+							<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">
2771
+						<input type="hidden" id="gd_ie_imcats_csv" value="<?php echo $gd_cats_sample_csv; ?>" />
2772 2772
 						<?php
2773 2773
 						/**
2774 2774
 						 * Called just after the sample CSV download link.
@@ -2778,7 +2778,7 @@  discard block
 block discarded – undo
2778 2778
 						 */
2779 2779
 						do_action('geodir_sample_cats_csv_download_link');
2780 2780
 						?>
2781
-							<span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce( 'gd_im_catpluploadan' ); ?>"></span>
2781
+							<span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce('gd_im_catpluploadan'); ?>"></span>
2782 2782
 							<div class="filelist"></div>
2783 2783
 						</div>
2784 2784
 						<span id="gd_im_catupload-error" style="display:none"></span>
@@ -2795,7 +2795,7 @@  discard block
 block discarded – undo
2795 2795
 							<input type="hidden" id="gd_terminateaction" value="continue"/>
2796 2796
 						</div>
2797 2797
 						<div class="gd-import-progress" id="gd-import-progress" style="display:none">
2798
-							<div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory');?> </b><font
2798
+							<div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory'); ?> </b><font
2799 2799
 									id="gd-import-done">0</font> / <font id="gd-import-total">0</font>&nbsp;( <font
2800 2800
 									id="gd-import-perc">0%</font> )
2801 2801
 								<div class="gd-fileprogress"></div>
@@ -2807,10 +2807,10 @@  discard block
 block discarded – undo
2807 2807
                     	<div class="gd-imex-btns" style="display:none;">
2808 2808
                         	<input type="hidden" class="geodir_import_file" name="geodir_import_file" value="save"/>
2809 2809
                         	<input onclick="gd_imex_PrepareImport(this, 'cat')" type="button" value="<?php echo CSV_IMPORT_DATA; ?>" id="gd_import_data" class="button-primary" />
2810
-                        	<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"/>
2811
-                        	<input type="button" value="<?php _e("Terminate Import Data", 'geodirectory');?>" id="gd_stop_import" class="button-primary" name="gd_stop_import" style="display:none" onclick="gd_imex_TerminateImport(this, 'cat')"/>
2810
+                        	<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"/>
2811
+                        	<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')"/>
2812 2812
 							<div id="gd_process_data" style="display:none">
2813
-								<span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory');?>
2813
+								<span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory'); ?>
2814 2814
 							</div>
2815 2815
 						</div>
2816 2816
 					</td>
@@ -2824,26 +2824,26 @@  discard block
 block discarded – undo
2824 2824
 	<div id="gd_ie_excategs" class="metabox-holder">
2825 2825
       <div class="meta-box-sortables ui-sortable">
2826 2826
         <div id="gd_ie_ex_cats" class="postbox gd-hndle-pbox">
2827
-          <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>
2828
-          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Categories: Export CSV', 'geodirectory' );?></span></h3>
2827
+          <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>
2828
+          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Categories: Export CSV', 'geodirectory'); ?></span></h3>
2829 2829
           <div class="inside">
2830 2830
             <table class="form-table">
2831 2831
 				<tbody>
2832 2832
 				  <tr>
2833
-					<td class="fld"><label for="gd_post_type"><?php _e( 'Post Type:', 'geodirectory' );?></label></td>
2834
-					<td><select name="gd_post_type" id="gd_post_type" style="min-width:140px"><?php echo $gd_posttypes_option;?></select></td>
2833
+					<td class="fld"><label for="gd_post_type"><?php _e('Post Type:', 'geodirectory'); ?></label></td>
2834
+					<td><select name="gd_post_type" id="gd_post_type" style="min-width:140px"><?php echo $gd_posttypes_option; ?></select></td>
2835 2835
 				  </tr>
2836 2836
 				   <tr>
2837
-					<td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e( 'Max entries per csv file:', 'geodirectory' );?></label></td>
2838
-					<td><select name="gd_chunk_size" id="gd_chunk_size" style="min-width:140px"><?php echo $gd_chunksize_option;?></select><span class="description"><?php _e( 'Please select the maximum number of entries per csv file (defaults to 5000, you might want to lower this to prevent memory issues on some installs)', 'geodirectory' );?></span></td>
2837
+					<td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e('Max entries per csv file:', 'geodirectory'); ?></label></td>
2838
+					<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>
2839 2839
 				  </tr>
2840 2840
 				  <tr>
2841
-					<td class="fld" style="vertical-align:top"><label><?php _e( 'Progress:', 'geodirectory' );?></label></td>
2842
-					<td><div id='gd_progressbar_box'><div id="gd_progressbar" class="gd_progressbar"><div class="gd-progress-label"></div></div></div><p style="display:inline-block"><?php _e( 'Elapsed Time:', 'geodirectory' );?></p>&nbsp;&nbsp;<p id="gd_timer" class="gd_timer">00:00:00</p></td>
2841
+					<td class="fld" style="vertical-align:top"><label><?php _e('Progress:', 'geodirectory'); ?></label></td>
2842
+					<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>
2843 2843
 				  </tr>
2844 2844
 				  <tr class="gd-ie-actions">
2845 2845
 					<td style="vertical-align:top">
2846
-						<input type="submit" value="<?php echo esc_attr( __( 'Export CSV', 'geodirectory' ) );?>" class="button-primary" name="gd_ie_excats_submit" id="gd_ie_excats_submit">
2846
+						<input type="submit" value="<?php echo esc_attr(__('Export CSV', 'geodirectory')); ?>" class="button-primary" name="gd_ie_excats_submit" id="gd_ie_excats_submit">
2847 2847
 					</td>
2848 2848
 					<td id="gd_ie_ex_files" class="gd-ie-files"></td>
2849 2849
 				  </tr>
@@ -2865,7 +2865,7 @@  discard block
 block discarded – undo
2865 2865
      * @param array $gd_chunksize_options File chunk size options.
2866 2866
      * @param string $nonce Wordpress security token for GD import & export.
2867 2867
 	 */
2868
-	do_action( 'geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce );
2868
+	do_action('geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce);
2869 2869
 	?>
2870 2870
   </div>
2871 2871
 </div>
@@ -2884,7 +2884,7 @@  discard block
 block discarded – undo
2884 2884
         jQuery.ajax({
2885 2885
             url: ajaxurl,
2886 2886
             type: "POST",
2887
-            data: 'action=geodir_import_export&task=prepare_import&_pt=' + type + '&_file=' + uploadedFile + '&_nonce=<?php echo $nonce;?>',
2887
+            data: 'action=geodir_import_export&task=prepare_import&_pt=' + type + '&_file=' + uploadedFile + '&_nonce=<?php echo $nonce; ?>',
2888 2888
             dataType: 'json',
2889 2889
             cache: false,
2890 2890
             success: function(data) {
@@ -2936,7 +2936,7 @@  discard block
 block discarded – undo
2936 2936
 
2937 2937
         jQuery(cont).find('.filelist .file').remove();
2938 2938
         
2939
-        jQuery('#gd-import-msg', cont).find('#message').removeClass('updated').addClass('error').html("<p><?php echo esc_attr( PLZ_SELECT_CSV_FILE );?></p>");
2939
+        jQuery('#gd-import-msg', cont).find('#message').removeClass('updated').addClass('error').html("<p><?php echo esc_attr(PLZ_SELECT_CSV_FILE); ?></p>");
2940 2940
         jQuery('#gd-import-msg', cont).show();
2941 2941
         
2942 2942
         return false;
@@ -2995,7 +2995,7 @@  discard block
 block discarded – undo
2995 2995
     jQuery.ajax({
2996 2996
         url: ajaxurl,
2997 2997
         type: "POST",
2998
-        data: 'action=geodir_import_export&task=import_' + type + '&_pt=' + type + '&_file=' + uploadedFile + gddata + '&_ch=' + choice + '&_nonce=<?php echo $nonce;?>',
2998
+        data: 'action=geodir_import_export&task=import_' + type + '&_pt=' + type + '&_file=' + uploadedFile + gddata + '&_ch=' + choice + '&_nonce=<?php echo $nonce; ?>',
2999 2999
         dataType : 'json',
3000 3000
         cache: false,
3001 3001
         success: function (data) {
@@ -3184,27 +3184,27 @@  discard block
 block discarded – undo
3184 3184
 
3185 3185
     var gdMsg = '<p></p>';
3186 3186
     if ( processed > 0 ) {
3187
-        var msgParse = '<p><?php echo addslashes( sprintf( __( 'Total %s item(s) found.', 'geodirectory' ), '%s' ) );?></p>';
3187
+        var msgParse = '<p><?php echo addslashes(sprintf(__('Total %s item(s) found.', 'geodirectory'), '%s')); ?></p>';
3188 3188
         msgParse = msgParse.replace("%s", processed);
3189 3189
         gdMsg += msgParse;
3190 3190
     }
3191 3191
 
3192 3192
     if ( updated > 0 ) {
3193
-        var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) updated.', 'geodirectory' ), '%s', '%d' ) );?></p>';
3193
+        var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) updated.', 'geodirectory'), '%s', '%d')); ?></p>';
3194 3194
         msgParse = msgParse.replace("%s", updated);
3195 3195
         msgParse = msgParse.replace("%d", processed);
3196 3196
         gdMsg += msgParse;
3197 3197
     }
3198 3198
 
3199 3199
     if ( created > 0 ) {
3200
-        var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) added.', 'geodirectory' ), '%s', '%d' ) );?></p>';
3200
+        var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) added.', 'geodirectory'), '%s', '%d')); ?></p>';
3201 3201
         msgParse = msgParse.replace("%s", created);
3202 3202
         msgParse = msgParse.replace("%d", processed);
3203 3203
         gdMsg += msgParse;
3204 3204
     }
3205 3205
 
3206 3206
     if ( skipped > 0 ) {
3207
-        var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) ignored due to already exists.', 'geodirectory' ), '%s', '%d' ) );?></p>';
3207
+        var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) ignored due to already exists.', 'geodirectory'), '%s', '%d')); ?></p>';
3208 3208
         msgParse = msgParse.replace("%s", skipped);
3209 3209
         msgParse = msgParse.replace("%d", processed);
3210 3210
         gdMsg += msgParse;
@@ -3214,17 +3214,17 @@  discard block
 block discarded – undo
3214 3214
         if (type=='loc') {
3215 3215
             invalid_addr = invalid;
3216 3216
         }
3217
-        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>';
3217
+        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>';
3218 3218
         msgParse = msgParse.replace("%s", invalid_addr);
3219 3219
         msgParse = msgParse.replace("%d", total);
3220 3220
         gdMsg += msgParse;
3221 3221
     }
3222 3222
 
3223 3223
     if (invalid > 0 && type!='loc') {
3224
-        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>';
3224
+        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>';
3225 3225
         
3226 3226
         if (type=='hood') {
3227
-            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>';
3227
+            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>';
3228 3228
         }
3229 3229
         msgParse = msgParse.replace("%s", invalid);
3230 3230
         msgParse = msgParse.replace("%d", total);
@@ -3232,7 +3232,7 @@  discard block
 block discarded – undo
3232 3232
     }
3233 3233
 
3234 3234
     if (images > 0) {
3235
-        gdMsg += '<p><?php echo addslashes( sprintf( CSV_TRANSFER_IMG_FOLDER, $uploads['subdir'] ) );?></p>';
3235
+        gdMsg += '<p><?php echo addslashes(sprintf(CSV_TRANSFER_IMG_FOLDER, $uploads['subdir'])); ?></p>';
3236 3236
     }
3237 3237
     gdMsg += '<p></p>';
3238 3238
     jQuery('#gd-import-msg', cont).find('#message').removeClass('error').addClass('updated').html(gdMsg);
@@ -3381,7 +3381,7 @@  discard block
 block discarded – undo
3381 3381
         
3382 3382
     function gd_process_export_posts(el, post_type, total_posts, chunk_size, pages, page) {
3383 3383
         if (page < 2) {
3384
-            gd_progressbar(el, 0, '0% (0 / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>');
3384
+            gd_progressbar(el, 0, '0% (0 / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>');
3385 3385
             jQuery(el).find('#gd_timer').text('00:00:01');
3386 3386
             jQuery('#gd_ie_ex_files', el).html('');
3387 3387
         }
@@ -3389,7 +3389,7 @@  discard block
 block discarded – undo
3389 3389
         jQuery.ajax({
3390 3390
             url: ajaxurl,
3391 3391
             type: "POST",
3392
-            data: 'action=geodir_import_export&task=export_posts&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce;?>&_p=' + page,
3392
+            data: 'action=geodir_import_export&task=export_posts&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce; ?>&_p=' + page,
3393 3393
             dataType : 'json',
3394 3394
             cache: false,
3395 3395
             beforeSend: function (jqXHR, settings) {},
@@ -3403,11 +3403,11 @@  discard block
 block discarded – undo
3403 3403
                     } else {
3404 3404
                         if (pages < page || pages == page) {
3405 3405
                             window.clearInterval(timer_posts);
3406
-                            gd_progressbar(el, 100, '100% (' + total_posts + ' / ' + total_posts + ') <i class="fa fa-check"></i><?php echo esc_attr( __( 'Complete!', 'geodirectory' ) );?>');
3406
+                            gd_progressbar(el, 100, '100% (' + total_posts + ' / ' + total_posts + ') <i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirectory')); ?>');
3407 3407
                         } else {
3408 3408
                             var percentage = Math.round(((page * chunk_size) / total_posts) * 100);
3409 3409
                             percentage = percentage > 100 ? 100 : percentage;
3410
-                            gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>');
3410
+                            gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>');
3411 3411
                         }
3412 3412
                         if (typeof data.files != 'undefined' && jQuery(data.files).length ) {
3413 3413
                             var obj_files = data.files;
@@ -3437,7 +3437,7 @@  discard block
 block discarded – undo
3437 3437
 
3438 3438
     function gd_process_export_cats(el, post_type, total_cats, chunk_size, pages, page) {
3439 3439
         if (page < 2) {
3440
-            gd_progressbar(el, 0, '0% (0 / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>');
3440
+            gd_progressbar(el, 0, '0% (0 / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>');
3441 3441
             jQuery(el).find('#gd_timer').text('00:00:01');
3442 3442
             jQuery('#gd_ie_ex_files', el).html('');
3443 3443
         }
@@ -3445,7 +3445,7 @@  discard block
 block discarded – undo
3445 3445
         jQuery.ajax({
3446 3446
             url: ajaxurl,
3447 3447
             type: "POST",
3448
-            data: 'action=geodir_import_export&task=export_cats&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce;?>&_p=' + page,
3448
+            data: 'action=geodir_import_export&task=export_cats&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce; ?>&_p=' + page,
3449 3449
             dataType : 'json',
3450 3450
             cache: false,
3451 3451
             beforeSend: function (jqXHR, settings) {},
@@ -3459,11 +3459,11 @@  discard block
 block discarded – undo
3459 3459
                     } else {
3460 3460
                         if (pages < page || pages == page) {
3461 3461
                             window.clearInterval(timer_cats);
3462
-                            gd_progressbar(el, 100, '100% (' + total_cats + ' / ' + total_cats + ') <i class="fa fa-check"></i><?php echo esc_attr( __( 'Complete!', 'geodirectory' ) );?>');
3462
+                            gd_progressbar(el, 100, '100% (' + total_cats + ' / ' + total_cats + ') <i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirectory')); ?>');
3463 3463
                         } else {
3464 3464
                             var percentage = Math.round(((page * chunk_size) / total_cats) * 100);
3465 3465
                             percentage = percentage > 100 ? 100 : percentage;
3466
-                            gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php esc_attr_e( 'Exporting...', 'geodirectory' );?>');
3466
+                            gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php esc_attr_e('Exporting...', 'geodirectory'); ?>');
3467 3467
                         }
3468 3468
                         if (typeof data.files != 'undefined' && jQuery(data.files).length ) {
3469 3469
                             var obj_files = data.files;
@@ -3520,13 +3520,13 @@  discard block
 block discarded – undo
3520 3520
 function geodir_init_filesystem()
3521 3521
 {
3522 3522
 
3523
-    if(!function_exists('get_filesystem_method')){
3523
+    if (!function_exists('get_filesystem_method')) {
3524 3524
         require_once(ABSPATH."/wp-admin/includes/file.php");
3525 3525
     }
3526 3526
     $access_type = get_filesystem_method();
3527 3527
     if ($access_type === 'direct') {
3528 3528
         /* you can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */
3529
-        $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3529
+        $creds = request_filesystem_credentials(trailingslashit(site_url()).'wp-admin/', '', false, false, array());
3530 3530
 
3531 3531
         /* initialize the API */
3532 3532
         if (!WP_Filesystem($creds)) {
@@ -3539,7 +3539,7 @@  discard block
 block discarded – undo
3539 3539
         return $wp_filesystem;
3540 3540
         /* do our file manipulations below */
3541 3541
     } elseif (defined('FTP_USER')) {
3542
-        $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3542
+        $creds = request_filesystem_credentials(trailingslashit(site_url()).'wp-admin/', '', false, false, array());
3543 3543
 
3544 3544
         /* initialize the API */
3545 3545
         if (!WP_Filesystem($creds)) {
@@ -3574,7 +3574,7 @@  discard block
 block discarded – undo
3574 3574
  * @package GeoDirectory
3575 3575
  */
3576 3576
 function geodir_filesystem_notice()
3577
-{   if ( defined( 'DOING_AJAX' ) ){return;}
3577
+{   if (defined('DOING_AJAX')) {return; }
3578 3578
     $access_type = get_filesystem_method();
3579 3579
     if ($access_type === 'direct') {
3580 3580
     } elseif (!defined('FTP_USER')) {
@@ -3611,64 +3611,64 @@  discard block
 block discarded – undo
3611 3611
     // try to set higher limits for import
3612 3612
     $max_input_time = ini_get('max_input_time');
3613 3613
     $max_execution_time = ini_get('max_execution_time');
3614
-    $memory_limit= ini_get('memory_limit');
3614
+    $memory_limit = ini_get('memory_limit');
3615 3615
 
3616
-    if(!$max_input_time || $max_input_time<3000){
3616
+    if (!$max_input_time || $max_input_time < 3000) {
3617 3617
         ini_set('max_input_time', 3000);
3618 3618
     }
3619 3619
 
3620
-    if(!$max_execution_time || $max_execution_time<3000){
3620
+    if (!$max_execution_time || $max_execution_time < 3000) {
3621 3621
         ini_set('max_execution_time', 3000);
3622 3622
     }
3623 3623
 
3624
-    if($memory_limit && str_replace('M','',$memory_limit)){
3625
-        if(str_replace('M','',$memory_limit)<256){
3624
+    if ($memory_limit && str_replace('M', '', $memory_limit)) {
3625
+        if (str_replace('M', '', $memory_limit) < 256) {
3626 3626
             ini_set('memory_limit', '256M');
3627 3627
         }
3628 3628
     }
3629 3629
 
3630 3630
     $json = array();
3631 3631
 
3632
-    if ( !current_user_can( 'manage_options' ) ) {
3633
-        wp_send_json( $json );
3632
+    if (!current_user_can('manage_options')) {
3633
+        wp_send_json($json);
3634 3634
     }
3635 3635
 
3636
-    $task = isset( $_REQUEST['task'] ) ? $_REQUEST['task'] : NULL;
3637
-    $nonce = isset( $_REQUEST['_nonce'] ) ? $_REQUEST['_nonce'] : NULL;
3638
-    $stat = isset( $_REQUEST['_st'] ) ? $_REQUEST['_st'] : false;
3636
+    $task = isset($_REQUEST['task']) ? $_REQUEST['task'] : NULL;
3637
+    $nonce = isset($_REQUEST['_nonce']) ? $_REQUEST['_nonce'] : NULL;
3638
+    $stat = isset($_REQUEST['_st']) ? $_REQUEST['_st'] : false;
3639 3639
 
3640
-    if ( !wp_verify_nonce( $nonce, 'geodir_import_export_nonce' ) ) {
3641
-        wp_send_json( $json );
3640
+    if (!wp_verify_nonce($nonce, 'geodir_import_export_nonce')) {
3641
+        wp_send_json($json);
3642 3642
     }
3643 3643
 
3644
-    $post_type = isset( $_REQUEST['_pt'] ) ? $_REQUEST['_pt'] : NULL;
3645
-    $chunk_per_page = isset( $_REQUEST['_n'] ) ? absint($_REQUEST['_n']) : NULL;
3644
+    $post_type = isset($_REQUEST['_pt']) ? $_REQUEST['_pt'] : NULL;
3645
+    $chunk_per_page = isset($_REQUEST['_n']) ? absint($_REQUEST['_n']) : NULL;
3646 3646
     $chunk_per_page = $chunk_per_page < 50 || $chunk_per_page > 100000 ? 5000 : $chunk_per_page;
3647
-    $chunk_page_no = isset( $_REQUEST['_p'] ) ? absint($_REQUEST['_p']) : 1;
3647
+    $chunk_page_no = isset($_REQUEST['_p']) ? absint($_REQUEST['_p']) : 1;
3648 3648
 
3649 3649
     $wp_filesystem = geodir_init_filesystem();
3650 3650
     if (!$wp_filesystem) {
3651
-        $json['error'] = __( 'Filesystem ERROR: Could not access filesystem.', 'geodirectory' );
3652
-        wp_send_json( $json );
3651
+        $json['error'] = __('Filesystem ERROR: Could not access filesystem.', 'geodirectory');
3652
+        wp_send_json($json);
3653 3653
     }
3654 3654
 
3655 3655
     if (!empty($wp_filesystem) && isset($wp_filesystem->errors) && is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
3656
-        $json['error'] = __( 'Filesystem ERROR: ' . $wp_filesystem->errors->get_error_message(), 'geodirectory' );
3657
-        wp_send_json( $json );
3656
+        $json['error'] = __('Filesystem ERROR: '.$wp_filesystem->errors->get_error_message(), 'geodirectory');
3657
+        wp_send_json($json);
3658 3658
     }
3659 3659
 
3660
-    $csv_file_dir = geodir_path_import_export( false );
3661
-    if ( !$wp_filesystem->is_dir( $csv_file_dir ) ) {
3662
-        if ( !$wp_filesystem->mkdir( $csv_file_dir, FS_CHMOD_DIR ) ) {
3663
-            $json['error'] = __( 'ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory' );
3664
-            wp_send_json( $json );
3660
+    $csv_file_dir = geodir_path_import_export(false);
3661
+    if (!$wp_filesystem->is_dir($csv_file_dir)) {
3662
+        if (!$wp_filesystem->mkdir($csv_file_dir, FS_CHMOD_DIR)) {
3663
+            $json['error'] = __('ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory');
3664
+            wp_send_json($json);
3665 3665
         }
3666 3666
     }
3667 3667
     
3668 3668
     $location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
3669 3669
     $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
3670 3670
 
3671
-    switch ( $task ) {
3671
+    switch ($task) {
3672 3672
         case 'export_posts': {
3673 3673
             // WPML
3674 3674
             $is_wpml = geodir_is_wpml();
@@ -3679,22 +3679,22 @@  discard block
 block discarded – undo
3679 3679
                 $sitepress->switch_lang('all', true);
3680 3680
             }
3681 3681
             // WPML
3682
-            if ( $post_type == 'gd_event' ) {
3683
-                add_filter( 'geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2 );
3682
+            if ($post_type == 'gd_event') {
3683
+                add_filter('geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2);
3684 3684
             }
3685
-            $file_name = $post_type . '_' . date( 'dmyHi' );
3686
-            $posts_count = geodir_get_posts_count( $post_type );
3687
-            $file_url_base = geodir_path_import_export() . '/';
3688
-            $file_url = $file_url_base . $file_name . '.csv';
3689
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3690
-            $file_path_temp = $csv_file_dir . '/' . $post_type . '_' . $nonce . '.csv';
3685
+            $file_name = $post_type.'_'.date('dmyHi');
3686
+            $posts_count = geodir_get_posts_count($post_type);
3687
+            $file_url_base = geodir_path_import_export().'/';
3688
+            $file_url = $file_url_base.$file_name.'.csv';
3689
+            $file_path = $csv_file_dir.'/'.$file_name.'.csv';
3690
+            $file_path_temp = $csv_file_dir.'/'.$post_type.'_'.$nonce.'.csv';
3691 3691
             
3692 3692
             $chunk_file_paths = array();
3693 3693
 
3694
-            if ( isset( $_REQUEST['_st'] ) ) {
3695
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3696
-                $percentage = count( $posts_count ) > 0 && $line_count > 0 ? ceil( $line_count / $posts_count ) * 100 : 0;
3697
-                $percentage = min( $percentage, 100 );
3694
+            if (isset($_REQUEST['_st'])) {
3695
+                $line_count = (int) geodir_import_export_line_count($file_path_temp);
3696
+                $percentage = count($posts_count) > 0 && $line_count > 0 ? ceil($line_count / $posts_count) * 100 : 0;
3697
+                $percentage = min($percentage, 100);
3698 3698
                 
3699 3699
                 $json['percentage'] = $percentage;
3700 3700
                 // WPML
@@ -3702,45 +3702,45 @@  discard block
 block discarded – undo
3702 3702
                     $sitepress->switch_lang($active_lang, true);
3703 3703
                 }
3704 3704
                 // WPML
3705
-                wp_send_json( $json );
3705
+                wp_send_json($json);
3706 3706
                 gd_die();
3707 3707
             } else {
3708
-                if ( !$posts_count > 0 ) {
3709
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3708
+                if (!$posts_count > 0) {
3709
+                    $json['error'] = __('No records to export.', 'geodirectory');
3710 3710
                 } else {
3711 3711
                     $total_posts = $posts_count;
3712 3712
                     if ($chunk_per_page > $total_posts) {
3713 3713
                         $chunk_per_page = $total_posts;
3714 3714
                     }
3715
-                    $chunk_total_pages = ceil( $total_posts / $chunk_per_page );
3715
+                    $chunk_total_pages = ceil($total_posts / $chunk_per_page);
3716 3716
                     
3717 3717
                     $j = $chunk_page_no;
3718
-                    $chunk_save_posts = geodir_imex_get_posts( $post_type, $chunk_per_page, $j );
3718
+                    $chunk_save_posts = geodir_imex_get_posts($post_type, $chunk_per_page, $j);
3719 3719
                     
3720 3720
                     $per_page = 500;
3721 3721
                     if ($per_page > $chunk_per_page) {
3722 3722
                         $per_page = $chunk_per_page;
3723 3723
                     }
3724
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3724
+                    $total_pages = ceil($chunk_per_page / $per_page);
3725 3725
                     
3726
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3727
-                        $save_posts = array_slice( $chunk_save_posts , ( $i * $per_page ), $per_page );
3726
+                    for ($i = 0; $i <= $total_pages; $i++) {
3727
+                        $save_posts = array_slice($chunk_save_posts, ($i * $per_page), $per_page);
3728 3728
                         
3729 3729
                         $clear = $i == 0 ? true : false;
3730
-                        geodir_save_csv_data( $file_path_temp, $save_posts, $clear );
3730
+                        geodir_save_csv_data($file_path_temp, $save_posts, $clear);
3731 3731
                     }
3732 3732
                         
3733
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3734
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3735
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3736
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3737
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3733
+                    if ($wp_filesystem->exists($file_path_temp)) {
3734
+                        $chunk_page_no = $chunk_total_pages > 1 ? '-'.$j : '';
3735
+                        $chunk_file_name = $file_name.$chunk_page_no.'.csv';
3736
+                        $file_path = $csv_file_dir.'/'.$chunk_file_name;
3737
+                        $wp_filesystem->move($file_path_temp, $file_path, true);
3738 3738
                         
3739
-                        $file_url = $file_url_base . $chunk_file_name;
3740
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3739
+                        $file_url = $file_url_base.$chunk_file_name;
3740
+                        $chunk_file_paths[] = array('i' => $j.'.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3741 3741
                     }
3742 3742
                     
3743
-                    if ( !empty($chunk_file_paths) ) {
3743
+                    if (!empty($chunk_file_paths)) {
3744 3744
                         $json['total'] = $posts_count;
3745 3745
                         $json['files'] = $chunk_file_paths;
3746 3746
                     } else {
@@ -3748,7 +3748,7 @@  discard block
 block discarded – undo
3748 3748
                             $json['total'] = $posts_count;
3749 3749
                             $json['files'] = array();
3750 3750
                         } else {
3751
-                            $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3751
+                            $json['error'] = __('ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory');
3752 3752
                         }
3753 3753
                     }
3754 3754
                 }
@@ -3757,7 +3757,7 @@  discard block
 block discarded – undo
3757 3757
                     $sitepress->switch_lang($active_lang, true);
3758 3758
                 }
3759 3759
                 // WPML
3760
-                wp_send_json( $json );
3760
+                wp_send_json($json);
3761 3761
             }
3762 3762
         }
3763 3763
         break;
@@ -3771,20 +3771,20 @@  discard block
 block discarded – undo
3771 3771
                 $sitepress->switch_lang('all', true);
3772 3772
             }
3773 3773
             // WPML
3774
-            $file_name = $post_type . 'category_' . date( 'dmyHi' );
3774
+            $file_name = $post_type.'category_'.date('dmyHi');
3775 3775
             
3776
-            $terms_count = geodir_get_terms_count( $post_type );
3777
-            $file_url_base = geodir_path_import_export() . '/';
3778
-            $file_url = $file_url_base . $file_name . '.csv';
3779
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3780
-            $file_path_temp = $csv_file_dir . '/' . $post_type . 'category_' . $nonce . '.csv';
3776
+            $terms_count = geodir_get_terms_count($post_type);
3777
+            $file_url_base = geodir_path_import_export().'/';
3778
+            $file_url = $file_url_base.$file_name.'.csv';
3779
+            $file_path = $csv_file_dir.'/'.$file_name.'.csv';
3780
+            $file_path_temp = $csv_file_dir.'/'.$post_type.'category_'.$nonce.'.csv';
3781 3781
             
3782 3782
             $chunk_file_paths = array();
3783 3783
             
3784
-            if ( isset( $_REQUEST['_st'] ) ) {
3785
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3786
-                $percentage = count( $terms_count ) > 0 && $line_count > 0 ? ceil( $line_count / $terms_count ) * 100 : 0;
3787
-                $percentage = min( $percentage, 100 );
3784
+            if (isset($_REQUEST['_st'])) {
3785
+                $line_count = (int) geodir_import_export_line_count($file_path_temp);
3786
+                $percentage = count($terms_count) > 0 && $line_count > 0 ? ceil($line_count / $terms_count) * 100 : 0;
3787
+                $percentage = min($percentage, 100);
3788 3788
                 
3789 3789
                 $json['percentage'] = $percentage;
3790 3790
                 // WPML
@@ -3792,48 +3792,48 @@  discard block
 block discarded – undo
3792 3792
                     $sitepress->switch_lang($active_lang, true);
3793 3793
                 }
3794 3794
                 // WPML
3795
-                wp_send_json( $json );
3795
+                wp_send_json($json);
3796 3796
             } else {
3797
-                if ( !$terms_count > 0 ) {
3798
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3797
+                if (!$terms_count > 0) {
3798
+                    $json['error'] = __('No records to export.', 'geodirectory');
3799 3799
                 } else {
3800 3800
                     $total_terms = $terms_count;
3801 3801
                     if ($chunk_per_page > $terms_count) {
3802 3802
                         $chunk_per_page = $terms_count;
3803 3803
                     }
3804
-                    $chunk_total_pages = ceil( $total_terms / $chunk_per_page );
3804
+                    $chunk_total_pages = ceil($total_terms / $chunk_per_page);
3805 3805
                     
3806 3806
                     $j = $chunk_page_no;
3807
-                    $chunk_save_terms = geodir_imex_get_terms( $post_type, $chunk_per_page, $j );
3807
+                    $chunk_save_terms = geodir_imex_get_terms($post_type, $chunk_per_page, $j);
3808 3808
                     
3809 3809
                     $per_page = 500;
3810 3810
                     if ($per_page > $chunk_per_page) {
3811 3811
                         $per_page = $chunk_per_page;
3812 3812
                     }
3813
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3813
+                    $total_pages = ceil($chunk_per_page / $per_page);
3814 3814
                     
3815
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3816
-                        $save_terms = array_slice( $chunk_save_terms , ( $i * $per_page ), $per_page );
3815
+                    for ($i = 0; $i <= $total_pages; $i++) {
3816
+                        $save_terms = array_slice($chunk_save_terms, ($i * $per_page), $per_page);
3817 3817
                         
3818 3818
                         $clear = $i == 0 ? true : false;
3819
-                        geodir_save_csv_data( $file_path_temp, $save_terms, $clear );
3819
+                        geodir_save_csv_data($file_path_temp, $save_terms, $clear);
3820 3820
                     }
3821 3821
                     
3822
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3823
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3824
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3825
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3826
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3822
+                    if ($wp_filesystem->exists($file_path_temp)) {
3823
+                        $chunk_page_no = $chunk_total_pages > 1 ? '-'.$j : '';
3824
+                        $chunk_file_name = $file_name.$chunk_page_no.'.csv';
3825
+                        $file_path = $csv_file_dir.'/'.$chunk_file_name;
3826
+                        $wp_filesystem->move($file_path_temp, $file_path, true);
3827 3827
                         
3828
-                        $file_url = $file_url_base . $chunk_file_name;
3829
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3828
+                        $file_url = $file_url_base.$chunk_file_name;
3829
+                        $chunk_file_paths[] = array('i' => $j.'.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3830 3830
                     }
3831 3831
                     
3832
-                    if ( !empty($chunk_file_paths) ) {
3832
+                    if (!empty($chunk_file_paths)) {
3833 3833
                         $json['total'] = $terms_count;
3834 3834
                         $json['files'] = $chunk_file_paths;
3835 3835
                     } else {
3836
-                        $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3836
+                        $json['error'] = __('ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory');
3837 3837
                     }
3838 3838
                 }
3839 3839
                 // WPML
@@ -3841,127 +3841,127 @@  discard block
 block discarded – undo
3841 3841
                     $sitepress->switch_lang($active_lang, true);
3842 3842
                 }
3843 3843
                 // WPML
3844
-                wp_send_json( $json );
3844
+                wp_send_json($json);
3845 3845
             }
3846 3846
         }
3847 3847
         break;
3848 3848
         case 'export_locations': {
3849
-            $file_url_base = geodir_path_import_export() . '/';
3850
-            $file_name = 'gd_locations_' . date( 'dmyHi' );
3851
-            $file_url = $file_url_base . $file_name . '.csv';
3852
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3853
-            $file_path_temp = $csv_file_dir . '/gd_locations_' . $nonce . '.csv';
3849
+            $file_url_base = geodir_path_import_export().'/';
3850
+            $file_name = 'gd_locations_'.date('dmyHi');
3851
+            $file_url = $file_url_base.$file_name.'.csv';
3852
+            $file_path = $csv_file_dir.'/'.$file_name.'.csv';
3853
+            $file_path_temp = $csv_file_dir.'/gd_locations_'.$nonce.'.csv';
3854 3854
             
3855
-            $items_count = (int)geodir_location_imex_count_locations();
3855
+            $items_count = (int) geodir_location_imex_count_locations();
3856 3856
             
3857
-            if ( isset( $_REQUEST['_st'] ) ) {
3858
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3859
-                $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3860
-                $percentage = min( $percentage, 100 );
3857
+            if (isset($_REQUEST['_st'])) {
3858
+                $line_count = (int) geodir_import_export_line_count($file_path_temp);
3859
+                $percentage = count($items_count) > 0 && $line_count > 0 ? ceil($line_count / $items_count) * 100 : 0;
3860
+                $percentage = min($percentage, 100);
3861 3861
                 
3862 3862
                 $json['percentage'] = $percentage;
3863
-                wp_send_json( $json );
3863
+                wp_send_json($json);
3864 3864
             } else {
3865 3865
                 $chunk_file_paths = array();
3866 3866
                 
3867
-                if ( !$items_count > 0 ) {
3868
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3867
+                if (!$items_count > 0) {
3868
+                    $json['error'] = __('No records to export.', 'geodirectory');
3869 3869
                 } else {
3870
-                    $chunk_per_page = min( $chunk_per_page, $items_count );
3871
-                    $chunk_total_pages = ceil( $items_count / $chunk_per_page );
3870
+                    $chunk_per_page = min($chunk_per_page, $items_count);
3871
+                    $chunk_total_pages = ceil($items_count / $chunk_per_page);
3872 3872
                     
3873 3873
                     $j = $chunk_page_no;
3874
-                    $chunk_save_items = geodir_location_imex_locations_data( $chunk_per_page, $j );
3874
+                    $chunk_save_items = geodir_location_imex_locations_data($chunk_per_page, $j);
3875 3875
                     
3876 3876
                     $per_page = 500;
3877
-                    $per_page = min( $per_page, $chunk_per_page );
3878
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3877
+                    $per_page = min($per_page, $chunk_per_page);
3878
+                    $total_pages = ceil($chunk_per_page / $per_page);
3879 3879
                     
3880
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3881
-                        $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3880
+                    for ($i = 0; $i <= $total_pages; $i++) {
3881
+                        $save_items = array_slice($chunk_save_items, ($i * $per_page), $per_page);
3882 3882
                         
3883 3883
                         $clear = $i == 0 ? true : false;
3884
-                        geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3884
+                        geodir_save_csv_data($file_path_temp, $save_items, $clear);
3885 3885
                     }
3886 3886
                     
3887
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3888
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3889
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3890
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3891
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3887
+                    if ($wp_filesystem->exists($file_path_temp)) {
3888
+                        $chunk_page_no = $chunk_total_pages > 1 ? '-'.$j : '';
3889
+                        $chunk_file_name = $file_name.$chunk_page_no.'.csv';
3890
+                        $file_path = $csv_file_dir.'/'.$chunk_file_name;
3891
+                        $wp_filesystem->move($file_path_temp, $file_path, true);
3892 3892
                         
3893
-                        $file_url = $file_url_base . $chunk_file_name;
3894
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3893
+                        $file_url = $file_url_base.$chunk_file_name;
3894
+                        $chunk_file_paths[] = array('i' => $j.'.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3895 3895
                     }
3896 3896
                     
3897
-                    if ( !empty($chunk_file_paths) ) {
3897
+                    if (!empty($chunk_file_paths)) {
3898 3898
                         $json['total'] = $items_count;
3899 3899
                         $json['files'] = $chunk_file_paths;
3900 3900
                     } else {
3901
-                        $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3901
+                        $json['error'] = __('Fail, something wrong to create csv file.', 'geodirectory');
3902 3902
                     }
3903 3903
                 }
3904
-                wp_send_json( $json );
3904
+                wp_send_json($json);
3905 3905
             }
3906 3906
         }
3907 3907
         break;
3908 3908
         case 'export_hoods': {
3909
-            $file_url_base = geodir_path_import_export() . '/';
3910
-            $file_name = 'gd_neighbourhoods_' . date( 'dmyHi' );
3911
-            $file_url = $file_url_base . $file_name . '.csv';
3912
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3913
-            $file_path_temp = $csv_file_dir . '/gd_neighbourhoods_' . $nonce . '.csv';
3909
+            $file_url_base = geodir_path_import_export().'/';
3910
+            $file_name = 'gd_neighbourhoods_'.date('dmyHi');
3911
+            $file_url = $file_url_base.$file_name.'.csv';
3912
+            $file_path = $csv_file_dir.'/'.$file_name.'.csv';
3913
+            $file_path_temp = $csv_file_dir.'/gd_neighbourhoods_'.$nonce.'.csv';
3914 3914
             
3915
-            $items_count = (int)geodir_location_imex_count_neighbourhoods();
3915
+            $items_count = (int) geodir_location_imex_count_neighbourhoods();
3916 3916
             
3917
-            if ( isset( $_REQUEST['_st'] ) ) {
3918
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3919
-                $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3920
-                $percentage = min( $percentage, 100 );
3917
+            if (isset($_REQUEST['_st'])) {
3918
+                $line_count = (int) geodir_import_export_line_count($file_path_temp);
3919
+                $percentage = count($items_count) > 0 && $line_count > 0 ? ceil($line_count / $items_count) * 100 : 0;
3920
+                $percentage = min($percentage, 100);
3921 3921
                 
3922 3922
                 $json['percentage'] = $percentage;
3923
-                wp_send_json( $json );
3923
+                wp_send_json($json);
3924 3924
             } else {
3925 3925
                 $chunk_file_paths = array();
3926 3926
                 
3927
-                if ( !$items_count > 0 ) {
3928
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3927
+                if (!$items_count > 0) {
3928
+                    $json['error'] = __('No records to export.', 'geodirectory');
3929 3929
                 } else {
3930
-                    $chunk_per_page = min( $chunk_per_page, $items_count );
3931
-                    $chunk_total_pages = ceil( $items_count / $chunk_per_page );
3930
+                    $chunk_per_page = min($chunk_per_page, $items_count);
3931
+                    $chunk_total_pages = ceil($items_count / $chunk_per_page);
3932 3932
                     
3933 3933
                     $j = $chunk_page_no;
3934
-                    $chunk_save_items = geodir_location_imex_neighbourhoods_data( $chunk_per_page, $j );
3934
+                    $chunk_save_items = geodir_location_imex_neighbourhoods_data($chunk_per_page, $j);
3935 3935
                     
3936 3936
                     $per_page = 500;
3937
-                    $per_page = min( $per_page, $chunk_per_page );
3938
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3937
+                    $per_page = min($per_page, $chunk_per_page);
3938
+                    $total_pages = ceil($chunk_per_page / $per_page);
3939 3939
                     
3940
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3941
-                        $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3940
+                    for ($i = 0; $i <= $total_pages; $i++) {
3941
+                        $save_items = array_slice($chunk_save_items, ($i * $per_page), $per_page);
3942 3942
                         
3943 3943
                         $clear = $i == 0 ? true : false;
3944
-                        geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3944
+                        geodir_save_csv_data($file_path_temp, $save_items, $clear);
3945 3945
                     }
3946 3946
                     
3947
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3948
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3949
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3950
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3951
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3947
+                    if ($wp_filesystem->exists($file_path_temp)) {
3948
+                        $chunk_page_no = $chunk_total_pages > 1 ? '-'.$j : '';
3949
+                        $chunk_file_name = $file_name.$chunk_page_no.'.csv';
3950
+                        $file_path = $csv_file_dir.'/'.$chunk_file_name;
3951
+                        $wp_filesystem->move($file_path_temp, $file_path, true);
3952 3952
                         
3953
-                        $file_url = $file_url_base . $chunk_file_name;
3954
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3953
+                        $file_url = $file_url_base.$chunk_file_name;
3954
+                        $chunk_file_paths[] = array('i' => $j.'.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3955 3955
                     }
3956 3956
                     
3957
-                    if ( !empty($chunk_file_paths) ) {
3957
+                    if (!empty($chunk_file_paths)) {
3958 3958
                         $json['total'] = $items_count;
3959 3959
                         $json['files'] = $chunk_file_paths;
3960 3960
                     } else {
3961
-                        $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3961
+                        $json['error'] = __('Fail, something wrong to create csv file.', 'geodirectory');
3962 3962
                     }
3963 3963
                 }
3964
-                wp_send_json( $json );
3964
+                wp_send_json($json);
3965 3965
             }
3966 3966
         }
3967 3967
         break;
@@ -3978,33 +3978,33 @@  discard block
 block discarded – undo
3978 3978
             }
3979 3979
             // WPML
3980 3980
             
3981
-            ini_set( 'auto_detect_line_endings', true );
3981
+            ini_set('auto_detect_line_endings', true);
3982 3982
             
3983 3983
             $uploads = wp_upload_dir();
3984 3984
             $uploads_dir = $uploads['path'];
3985 3985
             $uploads_subdir = $uploads['subdir'];
3986 3986
             
3987
-            $csv_file = isset( $_POST['_file'] ) ? $_POST['_file'] : NULL;
3988
-            $import_choice = isset( $_REQUEST['_ch'] ) ? $_REQUEST['_ch'] : 'skip';
3987
+            $csv_file = isset($_POST['_file']) ? $_POST['_file'] : NULL;
3988
+            $import_choice = isset($_REQUEST['_ch']) ? $_REQUEST['_ch'] : 'skip';
3989 3989
             
3990
-            $csv_file_arr = explode( '/', $csv_file );
3991
-            $csv_filename = end( $csv_file_arr );
3992
-            $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $csv_filename;
3990
+            $csv_file_arr = explode('/', $csv_file);
3991
+            $csv_filename = end($csv_file_arr);
3992
+            $target_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$csv_filename;
3993 3993
             
3994 3994
             $json['file'] = $csv_file;
3995
-            $json['error'] = __( 'The uploaded file is not a valid csv file. Please try again.', 'geodirectory' );
3995
+            $json['error'] = __('The uploaded file is not a valid csv file. Please try again.', 'geodirectory');
3996 3996
             $file = array();
3997 3997
 
3998
-            if ( $csv_file && $wp_filesystem->is_file( $target_path ) && $wp_filesystem->exists( $target_path ) ) {
3999
-                $wp_filetype = wp_check_filetype_and_ext( $target_path, $csv_filename );
3998
+            if ($csv_file && $wp_filesystem->is_file($target_path) && $wp_filesystem->exists($target_path)) {
3999
+                $wp_filetype = wp_check_filetype_and_ext($target_path, $csv_filename);
4000 4000
                 
4001 4001
                 if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
4002 4002
                     $json['error'] = NULL;
4003 4003
                     $json['rows'] = 0;
4004 4004
                     
4005
-                    if ( ( $handle = fopen($target_path, "r" ) ) !== FALSE ) {
4006
-                        while ( ( $data = fgetcsv( $handle, 100000, "," ) ) !== FALSE ) {
4007
-                            if ( !empty( $data ) ) {
4005
+                    if (($handle = fopen($target_path, "r")) !== FALSE) {
4006
+                        while (($data = fgetcsv($handle, 100000, ",")) !== FALSE) {
4007
+                            if (!empty($data)) {
4008 4008
                                 $file[] = $data;
4009 4009
                             }
4010 4010
                         }
@@ -4017,19 +4017,19 @@  discard block
 block discarded – undo
4017 4017
                         $json['error'] = __('No data found in csv file.', 'geodirectory');
4018 4018
                     }
4019 4019
                 } else {
4020
-                    wp_send_json( $json );
4020
+                    wp_send_json($json);
4021 4021
                 }
4022 4022
             } else {
4023
-                wp_send_json( $json );
4023
+                wp_send_json($json);
4024 4024
             }
4025 4025
             
4026
-            if ( $task == 'prepare_import' || !empty( $json['error'] ) ) {
4027
-                wp_send_json( $json );
4026
+            if ($task == 'prepare_import' || !empty($json['error'])) {
4027
+                wp_send_json($json);
4028 4028
             }
4029 4029
             
4030 4030
             $total = $json['rows'];
4031
-            $limit = isset($_POST['limit']) ? (int)$_POST['limit'] : 1;
4032
-            $processed = isset($_POST['processed']) ? (int)$_POST['processed'] : 0;
4031
+            $limit = isset($_POST['limit']) ? (int) $_POST['limit'] : 1;
4032
+            $processed = isset($_POST['processed']) ? (int) $_POST['processed'] : 0;
4033 4033
             
4034 4034
             $count = $limit;
4035 4035
             
@@ -4054,13 +4054,13 @@  discard block
 block discarded – undo
4054 4054
             
4055 4055
             $post_types = geodir_get_posttypes();
4056 4056
 
4057
-            if ( $task == 'import_cat' ) {
4057
+            if ($task == 'import_cat') {
4058 4058
                 if (!empty($file)) {
4059 4059
                     $columns = isset($file[0]) ? $file[0] : NULL;
4060 4060
                     
4061 4061
                     if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4062 4062
                         $json['error'] = CSV_INVAILD_FILE;
4063
-                        wp_send_json( $json );
4063
+                        wp_send_json($json);
4064 4064
                         exit;
4065 4065
                     }
4066 4066
                     
@@ -4071,7 +4071,7 @@  discard block
 block discarded – undo
4071 4071
                         
4072 4072
                         if (isset($file[$index])) {
4073 4073
                             $row = $file[$index];
4074
-                            $row = array_map( 'trim', $row );
4074
+                            $row = array_map('trim', $row);
4075 4075
                             //$row = array_map( 'utf8_encode', $row );
4076 4076
                             
4077 4077
                             $cat_id = '';
@@ -4088,42 +4088,42 @@  discard block
 block discarded – undo
4088 4088
                             $cat_id_original = '';
4089 4089
                             
4090 4090
                             $c = 0;
4091
-                            foreach ($columns as $column ) {
4092
-                                if ( $column == 'cat_id' ) {
4093
-                                    $cat_id = (int)$row[$c];
4094
-                                } else if ( $column == 'cat_name' ) {
4091
+                            foreach ($columns as $column) {
4092
+                                if ($column == 'cat_id') {
4093
+                                    $cat_id = (int) $row[$c];
4094
+                                } else if ($column == 'cat_name') {
4095 4095
                                     $cat_name = $row[$c];
4096
-                                } else if ( $column == 'cat_slug' ) {
4096
+                                } else if ($column == 'cat_slug') {
4097 4097
                                     $cat_slug = $row[$c];
4098
-                                } else if ( $column == 'cat_posttype' ) {
4098
+                                } else if ($column == 'cat_posttype') {
4099 4099
                                     $cat_posttype = $row[$c];
4100
-                                } else if ( $column == 'cat_parent' ) {
4100
+                                } else if ($column == 'cat_parent') {
4101 4101
                                     $cat_parent = trim($row[$c]);
4102
-                                } else if ( $column == 'cat_schema' && $row[$c] != '' ) {
4102
+                                } else if ($column == 'cat_schema' && $row[$c] != '') {
4103 4103
                                     $cat_schema = $row[$c];
4104
-                                } else if ( $column == 'cat_description' ) {
4104
+                                } else if ($column == 'cat_description') {
4105 4105
                                     $cat_description = $row[$c];
4106
-                                } else if ( $column == 'cat_top_description' ) {
4106
+                                } else if ($column == 'cat_top_description') {
4107 4107
                                     $cat_top_description = $row[$c];
4108
-                                } else if ( $column == 'cat_image' ) {
4108
+                                } else if ($column == 'cat_image') {
4109 4109
                                     $cat_image = $row[$c];
4110
-                                } else if ( $column == 'cat_icon' ) {
4110
+                                } else if ($column == 'cat_icon') {
4111 4111
                                     $cat_icon = $row[$c];
4112 4112
                                 }
4113 4113
                                 // WPML
4114
-                                if ( $is_wpml ) {
4115
-                                    if ( $column == 'cat_language' ) {
4116
-                                        $cat_language = geodir_strtolower( trim( $row[$c] ) );
4117
-                                    } else if ( $column == 'cat_id_original' ) {
4118
-                                        $cat_id_original = (int)$row[$c];
4114
+                                if ($is_wpml) {
4115
+                                    if ($column == 'cat_language') {
4116
+                                        $cat_language = geodir_strtolower(trim($row[$c]));
4117
+                                    } else if ($column == 'cat_id_original') {
4118
+                                        $cat_id_original = (int) $row[$c];
4119 4119
                                     }
4120 4120
                                 }
4121 4121
                                 // WPML
4122 4122
                                 $c++;
4123 4123
                             }
4124 4124
                             
4125
-                            if ( $cat_name == '' || !in_array( $cat_posttype, $post_types ) ) {
4126
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) );
4125
+                            if ($cat_name == '' || !in_array($cat_posttype, $post_types)) {
4126
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be added due to blank title/invalid post type', 'geodirectory'));
4127 4127
                                 
4128 4128
                                 $invalid++;
4129 4129
                                 continue;
@@ -4141,24 +4141,24 @@  discard block
 block discarded – undo
4141 4141
                             $term_data['description'] = $cat_description;
4142 4142
                             $term_data['cat_schema'] = $cat_schema;
4143 4143
                             $term_data['top_description'] = $cat_top_description;
4144
-                            $term_data['image'] = $cat_image != '' ? basename( $cat_image ) : '';
4145
-                            $term_data['icon'] = $cat_icon != '' ? basename( $cat_icon ) : '';
4144
+                            $term_data['image'] = $cat_image != '' ? basename($cat_image) : '';
4145
+                            $term_data['icon'] = $cat_icon != '' ? basename($cat_icon) : '';
4146 4146
                             
4147 4147
                             //$term_data = array_map( 'utf8_encode', $term_data );
4148 4148
                             
4149
-                            $taxonomy = $cat_posttype . 'category';
4149
+                            $taxonomy = $cat_posttype.'category';
4150 4150
                             
4151 4151
                             $term_data['taxonomy'] = $taxonomy;
4152 4152
 
4153 4153
                             $term_parent_id = 0;
4154
-                            if ($cat_parent != "" || (int)$cat_parent > 0) {
4154
+                            if ($cat_parent != "" || (int) $cat_parent > 0) {
4155 4155
                                 $term_parent = '';
4156 4156
                                 
4157
-                                if ( $term_parent = get_term_by( 'name', $cat_parent, $taxonomy ) ) {
4157
+                                if ($term_parent = get_term_by('name', $cat_parent, $taxonomy)) {
4158 4158
                                     //
4159
-                                } else if ( $term_parent = get_term_by( 'slug', $cat_parent, $taxonomy ) ) {
4159
+                                } else if ($term_parent = get_term_by('slug', $cat_parent, $taxonomy)) {
4160 4160
                                     //
4161
-                                } else if ( $term_parent = get_term_by( 'id', $cat_parent, $taxonomy ) ) {
4161
+                                } else if ($term_parent = get_term_by('id', $cat_parent, $taxonomy)) {
4162 4162
                                     //
4163 4163
                                 } else {
4164 4164
                                     $term_parent_data = array();
@@ -4166,104 +4166,104 @@  discard block
 block discarded – undo
4166 4166
                                     //$term_parent_data = array_map( 'utf8_encode', $term_parent_data );
4167 4167
                                     $term_parent_data['taxonomy'] = $taxonomy;
4168 4168
                                     
4169
-                                    $term_parent_id = (int)geodir_imex_insert_term( $taxonomy, $term_parent_data );
4169
+                                    $term_parent_id = (int) geodir_imex_insert_term($taxonomy, $term_parent_data);
4170 4170
                                 }
4171 4171
                                 
4172
-                                if ( !empty( $term_parent ) && !is_wp_error( $term_parent ) ) {
4173
-                                    $term_parent_id = (int)$term_parent->term_id;
4172
+                                if (!empty($term_parent) && !is_wp_error($term_parent)) {
4173
+                                    $term_parent_id = (int) $term_parent->term_id;
4174 4174
                                 }
4175 4175
                             }
4176
-                            $term_data['parent'] = (int)$term_parent_id;
4176
+                            $term_data['parent'] = (int) $term_parent_id;
4177 4177
 
4178 4178
                             $term_id = NULL;
4179
-                            if ( $import_choice == 'update' ) {
4180
-                                if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
4179
+                            if ($import_choice == 'update') {
4180
+                                if ($cat_id > 0 && $term = (array) term_exists($cat_id, $taxonomy)) {
4181 4181
                                     $term_data['term_id'] = $term['term_id'];
4182 4182
                                     
4183
-                                    if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
4183
+                                    if ($term_id = geodir_imex_update_term($taxonomy, $term_data)) {
4184 4184
                                         $updated++;
4185 4185
                                     } else {
4186 4186
                                         $invalid++;
4187
-                                        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' ) );
4187
+                                        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'));
4188 4188
                                     }
4189
-                                } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
4189
+                                } else if ($term_data['slug'] != '' && $term = (array) term_exists($term_data['slug'], $taxonomy)) {
4190 4190
                                     $term_data['term_id'] = $term['term_id'];
4191 4191
                                     
4192
-                                    if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
4192
+                                    if ($term_id = geodir_imex_update_term($taxonomy, $term_data)) {
4193 4193
                                         $updated++;
4194 4194
                                     } else {
4195 4195
                                         $invalid++;
4196
-                                        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' ) );
4196
+                                        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'));
4197 4197
                                     }
4198 4198
                                 } else {
4199
-                                    if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
4199
+                                    if ($term_id = geodir_imex_insert_term($taxonomy, $term_data)) {
4200 4200
                                         $created++;
4201 4201
                                     } else {
4202 4202
                                         $invalid++;
4203
-                                        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' ) );
4203
+                                        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'));
4204 4204
                                     }
4205 4205
                                 }
4206
-                            } else if ( $import_choice == 'skip' ) {
4207
-                                if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
4206
+                            } else if ($import_choice == 'skip') {
4207
+                                if ($cat_id > 0 && $term = (array) term_exists($cat_id, $taxonomy)) {
4208 4208
                                     $skipped++;
4209
-                                } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
4209
+                                } else if ($term_data['slug'] != '' && $term = (array) term_exists($term_data['slug'], $taxonomy)) {
4210 4210
                                     $skipped++;
4211 4211
                                 } else {
4212
-                                    if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
4212
+                                    if ($term_id = geodir_imex_insert_term($taxonomy, $term_data)) {
4213 4213
                                         $created++;
4214 4214
                                     } else {
4215 4215
                                         $invalid++;
4216
-                                        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' ) );
4216
+                                        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'));
4217 4217
                                     }
4218 4218
                                 }
4219 4219
                             } else {
4220 4220
                                 $invalid++;
4221
-                                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' ) );
4221
+                                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'));
4222 4222
                             }
4223 4223
                             
4224
-                            if ( $term_id ) {
4224
+                            if ($term_id) {
4225 4225
                                 // WPML
4226 4226
                                 if ($is_wpml && $cat_id_original > 0 && $cat_language != '') {
4227
-                                    $wpml_element_type = 'tax_' . $taxonomy;
4228
-                                    $source_language = geodir_get_language_for_element( $cat_id_original, $wpml_element_type );
4227
+                                    $wpml_element_type = 'tax_'.$taxonomy;
4228
+                                    $source_language = geodir_get_language_for_element($cat_id_original, $wpml_element_type);
4229 4229
                                     $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
4230 4230
 
4231
-                                    $trid = $sitepress->get_element_trid( $cat_id_original, $wpml_element_type );
4231
+                                    $trid = $sitepress->get_element_trid($cat_id_original, $wpml_element_type);
4232 4232
                                     
4233
-                                    $sitepress->set_element_language_details( $term_id, $wpml_element_type, $trid, $cat_language, $source_language );
4233
+                                    $sitepress->set_element_language_details($term_id, $wpml_element_type, $trid, $cat_language, $source_language);
4234 4234
                                 }
4235 4235
                                 // WPML
4236 4236
                                 
4237
-                                if ( isset( $term_data['top_description'] ) ) {
4238
-                                    update_tax_meta( $term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype );
4237
+                                if (isset($term_data['top_description'])) {
4238
+                                    update_tax_meta($term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype);
4239 4239
                                 }
4240 4240
                                 
4241
-                                if ( isset( $term_data['cat_schema'] ) ) {
4242
-                                    update_tax_meta( $term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype );
4241
+                                if (isset($term_data['cat_schema'])) {
4242
+                                    update_tax_meta($term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype);
4243 4243
                                 }
4244 4244
             
4245 4245
                                 $attachment = false;
4246
-                                if ( isset( $term_data['image'] ) && $term_data['image'] != '' ) {
4247
-                                    $cat_image = geodir_get_default_catimage( $term_id, $cat_posttype );
4248
-                                    $cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : '';
4246
+                                if (isset($term_data['image']) && $term_data['image'] != '') {
4247
+                                    $cat_image = geodir_get_default_catimage($term_id, $cat_posttype);
4248
+                                    $cat_image = !empty($cat_image) && isset($cat_image['src']) ? $cat_image['src'] : '';
4249 4249
                                     
4250
-                                    if ( basename($cat_image) != $term_data['image'] ) {
4250
+                                    if (basename($cat_image) != $term_data['image']) {
4251 4251
                                         $attachment = true;
4252
-                                        update_tax_meta( $term_id, 'ct_cat_default_img', array( 'id' => 'image', 'src' => $uploads['url'] . '/' . $term_data['image'] ), $cat_posttype );
4252
+                                        update_tax_meta($term_id, 'ct_cat_default_img', array('id' => 'image', 'src' => $uploads['url'].'/'.$term_data['image']), $cat_posttype);
4253 4253
                                     }
4254 4254
                                 }
4255 4255
                                 
4256
-                                if ( isset( $term_data['icon'] ) && $term_data['icon'] != '' ) {
4257
-                                    $cat_icon = get_tax_meta( $term_id, 'ct_cat_icon', false, $cat_posttype );
4258
-                                    $cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : '';
4256
+                                if (isset($term_data['icon']) && $term_data['icon'] != '') {
4257
+                                    $cat_icon = get_tax_meta($term_id, 'ct_cat_icon', false, $cat_posttype);
4258
+                                    $cat_icon = !empty($cat_icon) && isset($cat_icon['src']) ? $cat_icon['src'] : '';
4259 4259
                                         
4260
-                                    if ( basename($cat_icon) != $term_data['icon'] ) {
4260
+                                    if (basename($cat_icon) != $term_data['icon']) {
4261 4261
                                         $attachment = true;
4262
-                                        update_tax_meta( $term_id, 'ct_cat_icon', array( 'id' => 'icon', 'src' => $uploads['url'] . '/' . $term_data['icon'] ), $cat_posttype );
4262
+                                        update_tax_meta($term_id, 'ct_cat_icon', array('id' => 'icon', 'src' => $uploads['url'].'/'.$term_data['icon']), $cat_posttype);
4263 4263
                                     }
4264 4264
                                 }
4265 4265
                                 
4266
-                                if ( $attachment ) {
4266
+                                if ($attachment) {
4267 4267
                                     $images++;
4268 4268
                                 }
4269 4269
                             }
@@ -4285,13 +4285,13 @@  discard block
 block discarded – undo
4285 4285
                 $json['invalid'] = $invalid;
4286 4286
                 $json['images'] = $images;
4287 4287
                 
4288
-                wp_send_json( $json );
4288
+                wp_send_json($json);
4289 4289
                 exit;
4290
-            } else if ( $task == 'import_post' ) {
4290
+            } else if ($task == 'import_post') {
4291 4291
                 //run some stuff to make the import quicker
4292
-                wp_defer_term_counting( true );
4293
-                wp_defer_comment_counting( true );
4294
-                $wpdb->query( 'SET autocommit = 0;' );
4292
+                wp_defer_term_counting(true);
4293
+                wp_defer_comment_counting(true);
4294
+                $wpdb->query('SET autocommit = 0;');
4295 4295
 
4296 4296
                 //remove_all_actions('publish_post');
4297 4297
                 //remove_all_actions('transition_post_status');
@@ -4300,18 +4300,18 @@  discard block
 block discarded – undo
4300 4300
                 if (!empty($file)) {
4301 4301
                     $wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses.
4302 4302
                     $default_status = 'publish';
4303
-                    $current_date = date_i18n( 'Y-m-d', time() );
4303
+                    $current_date = date_i18n('Y-m-d', time());
4304 4304
                     
4305 4305
                     $columns = isset($file[0]) ? $file[0] : NULL;
4306 4306
                     
4307 4307
                     if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4308 4308
                         $json['error'] = CSV_INVAILD_FILE;
4309
-                        wp_send_json( $json );
4309
+                        wp_send_json($json);
4310 4310
                         exit;
4311 4311
                     }
4312 4312
 
4313 4313
                     $gd_error_log = __('GD IMPORT LISTINGS [ROW %d]:', 'geodirectory');
4314
-                    $wp_chars_error = __( '(check & remove if any invalid characters used in data)', 'geodirectory' );
4314
+                    $wp_chars_error = __('(check & remove if any invalid characters used in data)', 'geodirectory');
4315 4315
                     $processed_actual = 0;
4316 4316
                     for ($i = 1; $i <= $limit; $i++) {
4317 4317
                         $index = $processed + $i;
@@ -4320,9 +4320,9 @@  discard block
 block discarded – undo
4320 4320
                         if (isset($file[$index])) {
4321 4321
                             $processed_actual++;
4322 4322
                             $row = $file[$index];
4323
-                            $row = array_map( 'trim', $row );
4323
+                            $row = array_map('trim', $row);
4324 4324
                             //$row = array_map( 'utf8_encode', $row );
4325
-                            $row = array_map( 'addslashes_gpc', $row );
4325
+                            $row = array_map('addslashes_gpc', $row);
4326 4326
                             
4327 4327
                             $post_id = '';
4328 4328
                             $post_title = '';
@@ -4359,78 +4359,78 @@  discard block
 block discarded – undo
4359 4359
                             $original_post_id = '';
4360 4360
                                                         
4361 4361
                             $c = 0;
4362
-                            foreach ($columns as $column ) {
4362
+                            foreach ($columns as $column) {
4363 4363
                                 $gd_post[$column] = $row[$c];
4364 4364
                                 
4365
-                                if ( $column == 'post_id' ) {
4365
+                                if ($column == 'post_id') {
4366 4366
                                     $post_id = $row[$c];
4367
-                                } else if ( $column == 'post_title' ) {
4367
+                                } else if ($column == 'post_title') {
4368 4368
                                     $post_title = sanitize_text_field($row[$c]);
4369
-                                } else if ( $column == 'post_author' ) {
4369
+                                } else if ($column == 'post_author') {
4370 4370
                                     $post_author = $row[$c];
4371
-                                } else if ( $column == 'post_content' ) {
4371
+                                } else if ($column == 'post_content') {
4372 4372
                                     $post_content = $row[$c];
4373
-                                } else if ( $column == 'post_category' && $row[$c] != '' ) {
4374
-                                    $post_category_arr = explode( ',', $row[$c] );
4375
-                                } else if ( $column == 'default_category' ) {
4373
+                                } else if ($column == 'post_category' && $row[$c] != '') {
4374
+                                    $post_category_arr = explode(',', $row[$c]);
4375
+                                } else if ($column == 'default_category') {
4376 4376
                                     $default_category = wp_kses_normalize_entities($row[$c]);
4377
-                                } else if ( $column == 'post_tags' && $row[$c] != '' ) {
4378
-                                    $post_tags = explode( ',', sanitize_text_field($row[$c]) );
4379
-                                } else if ( $column == 'post_type' ) {
4377
+                                } else if ($column == 'post_tags' && $row[$c] != '') {
4378
+                                    $post_tags = explode(',', sanitize_text_field($row[$c]));
4379
+                                } else if ($column == 'post_type') {
4380 4380
                                     $post_type = $row[$c];
4381
-                                } else if ( $column == 'post_status' ) {
4382
-                                    $post_status = sanitize_key( $row[$c] );
4383
-                                } else if ( $column == 'is_featured' ) {
4384
-                                    $is_featured = (int)$row[$c];
4385
-                                } else if ( $column == 'geodir_video' ) {
4381
+                                } else if ($column == 'post_status') {
4382
+                                    $post_status = sanitize_key($row[$c]);
4383
+                                } else if ($column == 'is_featured') {
4384
+                                    $is_featured = (int) $row[$c];
4385
+                                } else if ($column == 'geodir_video') {
4386 4386
                                     $geodir_video = $row[$c];
4387
-                                } else if ( $column == 'post_address' ) {
4387
+                                } else if ($column == 'post_address') {
4388 4388
                                     $post_address = sanitize_text_field($row[$c]);
4389
-                                } else if ( $column == 'post_city' ) {
4389
+                                } else if ($column == 'post_city') {
4390 4390
                                     $post_city = sanitize_text_field($row[$c]);
4391
-                                } else if ( $column == 'post_region' ) {
4391
+                                } else if ($column == 'post_region') {
4392 4392
                                     $post_region = sanitize_text_field($row[$c]);
4393
-                                } else if ( $column == 'post_country' ) {
4393
+                                } else if ($column == 'post_country') {
4394 4394
                                     $post_country = sanitize_text_field($row[$c]);
4395
-                                } else if ( $column == 'post_zip' ) {
4395
+                                } else if ($column == 'post_zip') {
4396 4396
                                     $post_zip = sanitize_text_field($row[$c]);
4397
-                                } else if ( $column == 'post_latitude' ) {
4397
+                                } else if ($column == 'post_latitude') {
4398 4398
                                     $post_latitude = sanitize_text_field($row[$c]);
4399
-                                } else if ( $column == 'post_longitude' ) {
4399
+                                } else if ($column == 'post_longitude') {
4400 4400
                                     $post_longitude = sanitize_text_field($row[$c]);
4401
-                                } else if ( $column == 'post_neighbourhood' ) {
4401
+                                } else if ($column == 'post_neighbourhood') {
4402 4402
                                     $post_neighbourhood = sanitize_text_field($row[$c]);
4403 4403
                                     unset($gd_post[$column]);
4404
-                                } else if ( $column == 'neighbourhood_latitude' ) {
4404
+                                } else if ($column == 'neighbourhood_latitude') {
4405 4405
                                     $neighbourhood_latitude = sanitize_text_field($row[$c]);
4406
-                                } else if ( $column == 'neighbourhood_longitude' ) {
4406
+                                } else if ($column == 'neighbourhood_longitude') {
4407 4407
                                     $neighbourhood_longitude = sanitize_text_field($row[$c]);
4408
-                                } else if ( $column == 'geodir_timing' ) {
4408
+                                } else if ($column == 'geodir_timing') {
4409 4409
                                     $geodir_timing = sanitize_text_field($row[$c]);
4410
-                                } else if ( $column == 'geodir_contact' ) {
4410
+                                } else if ($column == 'geodir_contact') {
4411 4411
                                     $geodir_contact = sanitize_text_field($row[$c]);
4412
-                                } else if ( $column == 'geodir_email' ) {
4412
+                                } else if ($column == 'geodir_email') {
4413 4413
                                     $geodir_email = sanitize_email($row[$c]);
4414
-                                } else if ( $column == 'geodir_website' ) {
4414
+                                } else if ($column == 'geodir_website') {
4415 4415
                                     $geodir_website = sanitize_text_field($row[$c]);
4416
-                                } else if ( $column == 'geodir_twitter' ) {
4416
+                                } else if ($column == 'geodir_twitter') {
4417 4417
                                     $geodir_twitter = sanitize_text_field($row[$c]);
4418
-                                } else if ( $column == 'geodir_facebook' ) {
4418
+                                } else if ($column == 'geodir_facebook') {
4419 4419
                                     $geodir_facebook = sanitize_text_field($row[$c]);
4420
-                                } else if ( $column == 'IMAGE' && !empty( $row[$c] ) && $row[$c] != '' ) {
4420
+                                } else if ($column == 'IMAGE' && !empty($row[$c]) && $row[$c] != '') {
4421 4421
                                     $post_images[] = $row[$c];
4422
-                                } else if ( $column == 'alive_days' && (int)$row[$c] > 0 ) {
4423
-                                    $expire_date = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$row[$c] . ' days' ) );
4424
-                                } else if ( $column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never' ) {
4422
+                                } else if ($column == 'alive_days' && (int) $row[$c] > 0) {
4423
+                                    $expire_date = date_i18n('Y-m-d', strtotime($current_date.'+'.(int) $row[$c].' days'));
4424
+                                } else if ($column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never') {
4425 4425
                                     $row[$c] = str_replace('/', '-', $row[$c]);
4426
-                                    $expire_date = date_i18n( 'Y-m-d', strtotime( $row[$c] ) );
4426
+                                    $expire_date = date_i18n('Y-m-d', strtotime($row[$c]));
4427 4427
                                 }
4428 4428
                                 // WPML
4429 4429
                                 if ($is_wpml) {
4430 4430
                                     if ($column == 'language') {
4431 4431
                                         $language = geodir_strtolower(trim($row[$c]));
4432 4432
                                     } else if ($column == 'original_post_id') {
4433
-                                        $original_post_id = (int)$row[$c];
4433
+                                        $original_post_id = (int) $row[$c];
4434 4434
                                     }
4435 4435
                                 }
4436 4436
                                 // WPML
@@ -4445,43 +4445,43 @@  discard block
 block discarded – undo
4445 4445
 
4446 4446
                             $gd_post['IMAGE'] = $post_images;
4447 4447
                             
4448
-                            $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status;
4449
-                            $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status;
4448
+                            $post_status = !empty($post_status) ? sanitize_key($post_status) : $default_status;
4449
+                            $post_status = !empty($wp_post_statuses) && !isset($wp_post_statuses[$post_status]) ? $default_status : $post_status;
4450 4450
                                                                                                                 
4451 4451
                             $valid = true;
4452 4452
                             
4453
-                            if ( $post_title == '' || !in_array( $post_type, $post_types ) ) {
4453
+                            if ($post_title == '' || !in_array($post_type, $post_types)) {
4454 4454
                                 $invalid++;
4455 4455
                                 $valid = false;
4456
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) );
4456
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be added due to blank title/invalid post type', 'geodirectory'));
4457 4457
                             }
4458 4458
                             
4459
-                            $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
4460
-                            if ( $location_allowed ) {
4459
+                            $location_allowed = function_exists('geodir_cpt_no_location') && geodir_cpt_no_location($post_type) ? false : true;
4460
+                            if ($location_allowed) {
4461 4461
                                 $location_result = geodir_get_default_location();
4462
-                                if ( $post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '' ) {
4462
+                                if ($post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '') {
4463 4463
                                     $invalid_addr++;
4464 4464
                                     $valid = false;
4465
-                                    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' ) );
4466
-                                } else if ( !empty( $location_result ) && $location_result->location_id == 0 ) {
4467
-                                    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 ) ) ) {
4465
+                                    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'));
4466
+                                } else if (!empty($location_result) && $location_result->location_id == 0) {
4467
+                                    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))) {
4468 4468
                                         $invalid_addr++;
4469 4469
                                         $valid = false;
4470
-                                        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' ) );
4470
+                                        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'));
4471 4471
                                     } else {
4472 4472
                                         if (!$location_manager) {
4473
-                                            $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.
4473
+                                            $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.
4474 4474
                                         }
4475 4475
                                     }
4476 4476
                                 }
4477 4477
                             }
4478 4478
                             
4479
-                            if ( !$valid ) {
4479
+                            if (!$valid) {
4480 4480
                                 continue;
4481 4481
                             }
4482 4482
 
4483
-                            $cat_taxonomy = $post_type . 'category';
4484
-                            $tags_taxonomy = $post_type . '_tags';
4483
+                            $cat_taxonomy = $post_type.'category';
4484
+                            $tags_taxonomy = $post_type.'_tags';
4485 4485
                             
4486 4486
                             if ($default_category != '' && !in_array($default_category, $post_category_arr)) {
4487 4487
                                 $post_category_arr = array_merge(array($default_category), $post_category_arr);
@@ -4489,29 +4489,29 @@  discard block
 block discarded – undo
4489 4489
 
4490 4490
                             $post_category = array();
4491 4491
                             $default_category_id = NULL;
4492
-                            if ( !empty( $post_category_arr ) ) {
4493
-                                foreach ( $post_category_arr as $value ) {
4494
-                                    $category_name = wp_kses_normalize_entities( trim( $value ) );
4492
+                            if (!empty($post_category_arr)) {
4493
+                                foreach ($post_category_arr as $value) {
4494
+                                    $category_name = wp_kses_normalize_entities(trim($value));
4495 4495
                                     
4496
-                                    if ( $category_name != '' ) {
4496
+                                    if ($category_name != '') {
4497 4497
                                         $term_category = array();
4498 4498
                                         
4499
-                                        if ( $term = get_term_by( 'name', $category_name, $cat_taxonomy ) ) {
4499
+                                        if ($term = get_term_by('name', $category_name, $cat_taxonomy)) {
4500 4500
                                             $term_category = $term;
4501
-                                        } else if ( $term = get_term_by( 'slug', $category_name, $cat_taxonomy ) ) {
4501
+                                        } else if ($term = get_term_by('slug', $category_name, $cat_taxonomy)) {
4502 4502
                                             $term_category = $term;
4503 4503
                                         } else {
4504 4504
                                             $term_data = array();
4505 4505
                                             $term_data['name'] = $category_name;
4506 4506
                                             $term_data['taxonomy'] = $cat_taxonomy;
4507 4507
                                             
4508
-                                            $term_id = geodir_imex_insert_term( $cat_taxonomy, $term_data );
4509
-                                            if ( $term_id ) {
4510
-                                                $term_category = get_term( $term_id, $cat_taxonomy );
4508
+                                            $term_id = geodir_imex_insert_term($cat_taxonomy, $term_data);
4509
+                                            if ($term_id) {
4510
+                                                $term_category = get_term($term_id, $cat_taxonomy);
4511 4511
                                             }
4512 4512
                                         }
4513 4513
                                         
4514
-                                        if ( !empty( $term_category ) && !is_wp_error( $term_category ) ) {
4514
+                                        if (!empty($term_category) && !is_wp_error($term_category)) {
4515 4515
                                             $post_category[] = intval($term_category->term_id);
4516 4516
                                             
4517 4517
                                             if ($category_name == $default_category) {
@@ -4532,15 +4532,15 @@  discard block
 block discarded – undo
4532 4532
                             $save_post['post_tags'] = $post_tags;
4533 4533
 
4534 4534
                             $saved_post_id = NULL;
4535
-                            if ( $import_choice == 'update' ) {
4536
-                                $gd_wp_error = __( 'Unable to add listing, please check the listing data.', 'geodirectory' );
4535
+                            if ($import_choice == 'update') {
4536
+                                $gd_wp_error = __('Unable to add listing, please check the listing data.', 'geodirectory');
4537 4537
                                 
4538
-                                if ( $post_id > 0 && get_post( $post_id ) ) {
4538
+                                if ($post_id > 0 && get_post($post_id)) {
4539 4539
                                     $save_post['ID'] = $post_id;
4540 4540
                                     
4541
-                                    if ( $saved_post_id = wp_update_post( $save_post, true ) ) {
4542
-                                        if ( is_wp_error( $saved_post_id ) ) {
4543
-                                            $gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error;
4541
+                                    if ($saved_post_id = wp_update_post($save_post, true)) {
4542
+                                        if (is_wp_error($saved_post_id)) {
4543
+                                            $gd_wp_error = $saved_post_id->get_error_message().' '.$wp_chars_error;
4544 4544
                                             $saved_post_id = 0;
4545 4545
                                         } else {
4546 4546
                                             $saved_post_id = $post_id;
@@ -4548,9 +4548,9 @@  discard block
 block discarded – undo
4548 4548
                                         }
4549 4549
                                     }
4550 4550
                                 } else {
4551
-                                    if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
4552
-                                        if ( is_wp_error( $saved_post_id ) ) {
4553
-                                            $gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error;
4551
+                                    if ($saved_post_id = wp_insert_post($save_post, true)) {
4552
+                                        if (is_wp_error($saved_post_id)) {
4553
+                                            $gd_wp_error = $saved_post_id->get_error_message().' '.$wp_chars_error;
4554 4554
                                             $saved_post_id = 0;
4555 4555
                                         } else {
4556 4556
                                             $created++;
@@ -4558,19 +4558,19 @@  discard block
 block discarded – undo
4558 4558
                                     }
4559 4559
                                 }
4560 4560
                                 
4561
-                                if ( !$saved_post_id > 0 ) {
4561
+                                if (!$saved_post_id > 0) {
4562 4562
                                     $invalid++;
4563
-                                    geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_wp_error );
4563
+                                    geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_wp_error);
4564 4564
                                 }
4565
-                            } else if ( $import_choice == 'skip' ) {
4566
-                                if ( $post_id > 0 && get_post( $post_id ) ) {
4565
+                            } else if ($import_choice == 'skip') {
4566
+                                if ($post_id > 0 && get_post($post_id)) {
4567 4567
                                     $skipped++;	
4568 4568
                                 } else {
4569
-                                    if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
4570
-                                        if ( is_wp_error( $saved_post_id ) ) {
4569
+                                    if ($saved_post_id = wp_insert_post($save_post, true)) {
4570
+                                        if (is_wp_error($saved_post_id)) {
4571 4571
                                             $invalid++;
4572 4572
                                             
4573
-                                            geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $saved_post_id->get_error_message() . ' ' . $wp_chars_error );
4573
+                                            geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$saved_post_id->get_error_message().' '.$wp_chars_error);
4574 4574
                                             $saved_post_id = 0;
4575 4575
                                         } else {
4576 4576
                                             $created++;
@@ -4578,28 +4578,28 @@  discard block
 block discarded – undo
4578 4578
                                     } else {
4579 4579
                                         $invalid++;
4580 4580
                                         
4581
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error );
4581
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$wp_chars_error);
4582 4582
                                     }
4583 4583
                                 }
4584 4584
                             } else {
4585 4585
                                 $invalid++;
4586 4586
                                 
4587
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error );
4587
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$wp_chars_error);
4588 4588
                             }
4589 4589
 
4590
-                            if ( (int)$saved_post_id > 0 ) {
4590
+                            if ((int) $saved_post_id > 0) {
4591 4591
                                 // WPML
4592 4592
                                 if ($is_wpml && $original_post_id > 0 && $language != '') {
4593
-                                    $wpml_post_type = 'post_' . $post_type;
4594
-                                    $source_language = geodir_get_language_for_element( $original_post_id, $wpml_post_type );
4593
+                                    $wpml_post_type = 'post_'.$post_type;
4594
+                                    $source_language = geodir_get_language_for_element($original_post_id, $wpml_post_type);
4595 4595
                                     $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
4596 4596
 
4597
-                                    $trid = $sitepress->get_element_trid( $original_post_id, $wpml_post_type );
4597
+                                    $trid = $sitepress->get_element_trid($original_post_id, $wpml_post_type);
4598 4598
                                     
4599
-                                    $sitepress->set_element_language_details( $saved_post_id, $wpml_post_type, $trid, $language, $source_language );
4599
+                                    $sitepress->set_element_language_details($saved_post_id, $wpml_post_type, $trid, $language, $source_language);
4600 4600
                                 }
4601 4601
                                 // WPML
4602
-                                $gd_post_info = geodir_get_post_info( $saved_post_id );
4602
+                                $gd_post_info = geodir_get_post_info($saved_post_id);
4603 4603
                                 
4604 4604
                                 $gd_post['post_id'] = $saved_post_id;
4605 4605
                                 $gd_post['ID'] = $saved_post_id;
@@ -4611,7 +4611,7 @@  discard block
 block discarded – undo
4611 4611
                                                     
4612 4612
                                 // post location
4613 4613
                                 $post_location_id = 0;
4614
-                                if ( $location_allowed && !empty( $location_result ) && $location_result->location_id > 0 ) {
4614
+                                if ($location_allowed && !empty($location_result) && $location_result->location_id > 0) {
4615 4615
                                     $gd_post['post_neighbourhood'] = '';
4616 4616
                                     
4617 4617
                                     $post_location_info = array(
@@ -4621,7 +4621,7 @@  discard block
 block discarded – undo
4621 4621
                                                                 'geo_lat' => $post_latitude,
4622 4622
                                                                 'geo_lng' => $post_longitude
4623 4623
                                                             );
4624
-                                    if ( $location_id = (int)geodir_add_new_location( $post_location_info ) ) {
4624
+                                    if ($location_id = (int) geodir_add_new_location($post_location_info)) {
4625 4625
                                         $post_location_id = $location_id;
4626 4626
                                     }
4627 4627
                                     
@@ -4659,14 +4659,14 @@  discard block
 block discarded – undo
4659 4659
                                 $gd_post['post_location_id'] = $post_location_id;
4660 4660
                                 
4661 4661
                                 // post package info
4662
-                                $package_id = isset( $gd_post['package_id'] ) && !empty( $gd_post['package_id'] ) ? (int)$gd_post['package_id'] : 0;
4662
+                                $package_id = isset($gd_post['package_id']) && !empty($gd_post['package_id']) ? (int) $gd_post['package_id'] : 0;
4663 4663
                                 if (!$package_id && !empty($gd_post_info) && isset($gd_post_info->package_id) && $gd_post_info->package_id) {
4664 4664
                                     $package_id = $gd_post_info->package_id;
4665 4665
                                 }
4666 4666
                                 
4667 4667
                                 $package_info = array();
4668 4668
                                 if ($package_id && function_exists('geodir_get_package_info_by_id')) {
4669
-                                    $package_info = (array)geodir_get_package_info_by_id($package_id);
4669
+                                    $package_info = (array) geodir_get_package_info_by_id($package_id);
4670 4670
                                     
4671 4671
                                     if (!(!empty($package_info) && isset($package_info['post_type']) && $package_info['post_type'] == $post_type)) {
4672 4672
                                         $package_info = array();
@@ -4674,18 +4674,18 @@  discard block
 block discarded – undo
4674 4674
                                 }
4675 4675
                                 
4676 4676
                                 if (empty($package_info)) {
4677
-                                    $package_info = (array)geodir_post_package_info( array(), '', $post_type );
4677
+                                    $package_info = (array) geodir_post_package_info(array(), '', $post_type);
4678 4678
                                 }
4679 4679
                                  
4680
-                                if (!empty($package_info))	 {
4680
+                                if (!empty($package_info)) {
4681 4681
                                     $package_id = $package_info['pid'];
4682 4682
                                     
4683 4683
                                     if (isset($gd_post['alive_days']) || isset($gd_post['expire_date'])) {
4684 4684
                                         $gd_post['expire_date'] = $expire_date;
4685 4685
                                     } else {
4686
-                                        if ( isset( $package_info['days'] ) && (int)$package_info['days'] > 0 ) {
4687
-                                            $gd_post['alive_days'] = (int)$package_info['days'];
4688
-                                            $gd_post['expire_date'] = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$package_info['days'] . ' days' ) );
4686
+                                        if (isset($package_info['days']) && (int) $package_info['days'] > 0) {
4687
+                                            $gd_post['alive_days'] = (int) $package_info['days'];
4688
+                                            $gd_post['expire_date'] = date_i18n('Y-m-d', strtotime($current_date.'+'.(int) $package_info['days'].' days'));
4689 4689
                                         } else {
4690 4690
                                             $gd_post['expire_date'] = 'Never';
4691 4691
                                         }
@@ -4694,7 +4694,7 @@  discard block
 block discarded – undo
4694 4694
                                     $gd_post['package_id'] = $package_id;
4695 4695
                                 }
4696 4696
 
4697
-                                $table = $plugin_prefix . $post_type . '_detail';
4697
+                                $table = $plugin_prefix.$post_type.'_detail';
4698 4698
                                 
4699 4699
                                 if ($post_type == 'gd_event') {
4700 4700
                                     $gd_post = geodir_imex_process_event_data($gd_post);
@@ -4705,28 +4705,28 @@  discard block
 block discarded – undo
4705 4705
                                 }
4706 4706
 
4707 4707
                                 // Export franchise fields
4708
-                                $is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false;
4708
+                                $is_franchise_active = is_plugin_active('geodir_franchise/geodir_franchise.php') && geodir_franchise_enabled($post_type) ? true : false;
4709 4709
                                 if ($is_franchise_active) {
4710
-                                    if ( isset( $gd_post['gd_is_franchise'] ) && (int)$gd_post['gd_is_franchise'] == 1 ) {
4710
+                                    if (isset($gd_post['gd_is_franchise']) && (int) $gd_post['gd_is_franchise'] == 1) {
4711 4711
                                         $gd_franchise_lock = array();
4712 4712
                                         
4713
-                                        if ( isset( $gd_post['gd_franchise_lock'] ) ) {
4714
-                                            $gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock'] );
4715
-                                            $gd_franchise_lock = trim( $gd_franchise_lock );
4716
-                                            $gd_franchise_lock = explode( ",", $gd_franchise_lock );
4713
+                                        if (isset($gd_post['gd_franchise_lock'])) {
4714
+                                            $gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock']);
4715
+                                            $gd_franchise_lock = trim($gd_franchise_lock);
4716
+                                            $gd_franchise_lock = explode(",", $gd_franchise_lock);
4717 4717
                                         }
4718 4718
                                         
4719
-                                        update_post_meta( $saved_post_id, 'gd_is_franchise', 1 );
4720
-                                        update_post_meta( $saved_post_id, 'gd_franchise_lock', $gd_franchise_lock );
4719
+                                        update_post_meta($saved_post_id, 'gd_is_franchise', 1);
4720
+                                        update_post_meta($saved_post_id, 'gd_franchise_lock', $gd_franchise_lock);
4721 4721
                                     } else {
4722
-                                        if ( isset( $gd_post['franchise'] ) && (int)$gd_post['franchise'] > 0 && geodir_franchise_check( (int)$gd_post['franchise'] ) ) {
4723
-                                            geodir_save_post_meta( $saved_post_id, 'franchise', (int)$gd_post['franchise'] );
4722
+                                        if (isset($gd_post['franchise']) && (int) $gd_post['franchise'] > 0 && geodir_franchise_check((int) $gd_post['franchise'])) {
4723
+                                            geodir_save_post_meta($saved_post_id, 'franchise', (int) $gd_post['franchise']);
4724 4724
                                         }
4725 4725
                                     }
4726 4726
                                 }
4727 4727
                                 
4728 4728
                                 if (!empty($save_post['post_category']) && is_array($save_post['post_category'])) {
4729
-                                    $save_post['post_category'] = array_unique( array_map( 'intval', $save_post['post_category'] ) );
4729
+                                    $save_post['post_category'] = array_unique(array_map('intval', $save_post['post_category']));
4730 4730
                                     if ($default_category_id) {
4731 4731
                                         $save_post['post_default_category'] = $default_category_id;
4732 4732
                                         $gd_post['default_category'] = $default_category_id;
@@ -4735,34 +4735,34 @@  discard block
 block discarded – undo
4735 4735
                                 }
4736 4736
                                 
4737 4737
                                 // Save post info
4738
-                                geodir_save_post_info( $saved_post_id, $gd_post );
4738
+                                geodir_save_post_info($saved_post_id, $gd_post);
4739 4739
                                 // post taxonomies
4740
-                                if ( !empty( $save_post['post_category'] ) ) {
4741
-                                    wp_set_object_terms( $saved_post_id, $save_post['post_category'], $cat_taxonomy );
4740
+                                if (!empty($save_post['post_category'])) {
4741
+                                    wp_set_object_terms($saved_post_id, $save_post['post_category'], $cat_taxonomy);
4742 4742
                                     
4743
-                                    $post_default_category = isset( $save_post['post_default_category'] ) ? $save_post['post_default_category'] : '';
4743
+                                    $post_default_category = isset($save_post['post_default_category']) ? $save_post['post_default_category'] : '';
4744 4744
                                     if ($default_category_id) {
4745 4745
                                         $post_default_category = $default_category_id;
4746 4746
                                     }
4747 4747
                                     $post_cat_ids = geodir_get_post_meta($saved_post_id, $cat_taxonomy);
4748 4748
                                     $save_post['post_category'] = !empty($post_cat_ids) ? explode(",", trim($post_cat_ids, ",")) : $save_post['post_category'];
4749
-                                    $post_category_str = !empty($save_post['post_category']) ? implode(",y:#", $save_post['post_category']) . ',y:' : '';
4749
+                                    $post_category_str = !empty($save_post['post_category']) ? implode(",y:#", $save_post['post_category']).',y:' : '';
4750 4750
                                     
4751 4751
                                     if ($post_category_str != '' && $post_default_category) {
4752
-                                        $post_category_str = str_replace($post_default_category . ',y:', $post_default_category . ',y,d:', $post_category_str);
4752
+                                        $post_category_str = str_replace($post_default_category.',y:', $post_default_category.',y,d:', $post_category_str);
4753 4753
                                     }
4754 4754
                                     
4755 4755
                                     $post_category_str = $post_category_str != '' ? array($cat_taxonomy => $post_category_str) : '';
4756 4756
                                     
4757
-                                    geodir_set_postcat_structure( $saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str );
4757
+                                    geodir_set_postcat_structure($saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str);
4758 4758
                                 }
4759 4759
 
4760
-                                if ( !empty( $save_post['post_tags'] ) ) {
4761
-                                    wp_set_object_terms( $saved_post_id, $save_post['post_tags'], $tags_taxonomy );
4760
+                                if (!empty($save_post['post_tags'])) {
4761
+                                    wp_set_object_terms($saved_post_id, $save_post['post_tags'], $tags_taxonomy);
4762 4762
                                 }
4763 4763
 
4764 4764
                                 // Post images
4765
-                                if ( !empty( $post_images ) ) {
4765
+                                if (!empty($post_images)) {
4766 4766
                                     $post_images = array_unique($post_images);
4767 4767
                                     
4768 4768
                                     $old_post_images_arr = array();
@@ -4770,61 +4770,61 @@  discard block
 block discarded – undo
4770 4770
                                     
4771 4771
                                     $order = 1;
4772 4772
                                     
4773
-                                    $old_post_images = geodir_get_images( $saved_post_id );
4773
+                                    $old_post_images = geodir_get_images($saved_post_id);
4774 4774
                                     if (!empty($old_post_images)) {
4775
-                                        foreach( $old_post_images as $old_post_image ) {
4775
+                                        foreach ($old_post_images as $old_post_image) {
4776 4776
                                             if (!empty($old_post_image) && isset($old_post_image->file) && $old_post_image->file != '') {
4777 4777
                                                 $old_post_images_arr[] = $old_post_image->file;
4778 4778
                                             }
4779 4779
                                         }
4780 4780
                                     }
4781 4781
 
4782
-                                    foreach ( $post_images as $post_image ) {
4783
-                                        $image_name = basename( $post_image );
4782
+                                    foreach ($post_images as $post_image) {
4783
+                                        $image_name = basename($post_image);
4784 4784
                                         $saved_post_images_arr[] = $image_name;
4785 4785
                                         
4786
-                                        if (!empty($old_post_images_arr) && in_array( $image_name, $old_post_images_arr) ) {
4786
+                                        if (!empty($old_post_images_arr) && in_array($image_name, $old_post_images_arr)) {
4787 4787
                                             continue; // Skip if image already exists.
4788 4788
                                         }
4789 4789
                                         
4790
-                                        $image_name_parts = explode( '.', $image_name );
4791
-                                        array_pop( $image_name_parts );
4792
-                                        $proper_image_name = implode( '.', $image_name_parts );
4790
+                                        $image_name_parts = explode('.', $image_name);
4791
+                                        array_pop($image_name_parts);
4792
+                                        $proper_image_name = implode('.', $image_name_parts);
4793 4793
                                         
4794
-                                        $arr_file_type = wp_check_filetype( $image_name );
4794
+                                        $arr_file_type = wp_check_filetype($image_name);
4795 4795
                                         
4796
-                                        if ( !empty( $arr_file_type ) ) {
4796
+                                        if (!empty($arr_file_type)) {
4797 4797
                                             $uploaded_file_type = $arr_file_type['type'];
4798 4798
                                             
4799 4799
                                             $attachment = array();
4800 4800
                                             $attachment['post_id'] = $saved_post_id;
4801 4801
                                             $attachment['title'] = $proper_image_name;
4802 4802
                                             $attachment['content'] = '';
4803
-                                            $attachment['file'] = $uploads_subdir . '/' . $image_name;
4803
+                                            $attachment['file'] = $uploads_subdir.'/'.$image_name;
4804 4804
                                             $attachment['mime_type'] = $uploaded_file_type;
4805 4805
                                             $attachment['menu_order'] = $order;
4806 4806
                                             $attachment['is_featured'] = 0;
4807 4807
 
4808 4808
                                             $attachment_set = '';
4809
-                                            foreach ( $attachment as $key => $val ) {
4810
-                                                if ( $val != '' ) {
4811
-                                                    $attachment_set .= $key . " = '" . $val . "', ";
4809
+                                            foreach ($attachment as $key => $val) {
4810
+                                                if ($val != '') {
4811
+                                                    $attachment_set .= $key." = '".$val."', ";
4812 4812
                                                 }
4813 4813
                                             }
4814
-                                            $attachment_set = trim( $attachment_set, ", " );
4814
+                                            $attachment_set = trim($attachment_set, ", ");
4815 4815
                                                                                         
4816 4816
                                             // Add new attachment
4817
-                                            $wpdb->query( "INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set );
4817
+                                            $wpdb->query("INSERT INTO ".GEODIR_ATTACHMENT_TABLE." SET ".$attachment_set);
4818 4818
                                                                                         
4819 4819
                                             $order++;
4820 4820
                                         }
4821 4821
                                     }
4822 4822
 
4823
-                                    $saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/" . implode("' AND file NOT LIKE '%/",  $saved_post_images_arr) . "' )" : '';
4823
+                                    $saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/".implode("' AND file NOT LIKE '%/", $saved_post_images_arr)."' )" : '';
4824 4824
                                     // Remove previous attachment
4825
-                                    $wpdb->query( "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = " . (int)$saved_post_id . " " . $saved_post_images_sql );
4825
+                                    $wpdb->query("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id = ".(int) $saved_post_id." ".$saved_post_images_sql);
4826 4826
                                     
4827
-                                    if ( !empty( $saved_post_images_arr ) ) {
4827
+                                    if (!empty($saved_post_images_arr)) {
4828 4828
                                         geodir_set_wp_featured_image($saved_post_id);
4829 4829
                                         /*
4830 4830
                                         $menu_order = 1;
@@ -4841,13 +4841,13 @@  discard block
 block discarded – undo
4841 4841
                                         }*/
4842 4842
                                     }
4843 4843
                                     
4844
-                                    if ( $order > 1 ) {
4844
+                                    if ($order > 1) {
4845 4845
                                         $images++;
4846 4846
                                     }
4847 4847
                                 }
4848 4848
 
4849 4849
                                 /** This action is documented in geodirectory-functions/post-functions.php */
4850
-                                do_action( 'geodir_after_save_listing', $saved_post_id, $gd_post );
4850
+                                do_action('geodir_after_save_listing', $saved_post_id, $gd_post);
4851 4851
                                 
4852 4852
                                 if (isset($is_featured)) {
4853 4853
                                     geodir_save_post_meta($saved_post_id, 'is_featured', $is_featured);
@@ -4867,10 +4867,10 @@  discard block
 block discarded – undo
4867 4867
                 }
4868 4868
 
4869 4869
                 //undo some stuff to make the import quicker
4870
-                wp_defer_term_counting( false );
4871
-                wp_defer_comment_counting( false );
4872
-                $wpdb->query( 'COMMIT;' );
4873
-                $wpdb->query( 'SET autocommit = 1;' );
4870
+                wp_defer_term_counting(false);
4871
+                wp_defer_comment_counting(false);
4872
+                $wpdb->query('COMMIT;');
4873
+                $wpdb->query('SET autocommit = 1;');
4874 4874
 
4875 4875
                 $json = array();
4876 4876
                 $json['processed'] = $processed_actual;
@@ -4881,9 +4881,9 @@  discard block
 block discarded – undo
4881 4881
                 $json['invalid_addr'] = $invalid_addr;
4882 4882
                 $json['images'] = $images;
4883 4883
                 
4884
-                wp_send_json( $json );
4884
+                wp_send_json($json);
4885 4885
                 exit;
4886
-            } else if ( $task == 'import_loc' ) {
4886
+            } else if ($task == 'import_loc') {
4887 4887
                 global $gd_post_types;
4888 4888
                 $gd_post_types = $post_types;
4889 4889
                 
@@ -4892,82 +4892,82 @@  discard block
 block discarded – undo
4892 4892
                     
4893 4893
                     if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4894 4894
                         $json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
4895
-                        wp_send_json( $json );
4895
+                        wp_send_json($json);
4896 4896
                     }
4897 4897
                     
4898 4898
                     $gd_error_log = __('GD IMPORT LOCATIONS [ROW %d]:', 'geodirectory');
4899
-                    $gd_error_location = __( 'Could not be saved due to blank/invalid address(city, region, country, latitude, longitude)', 'geodirectory' );
4899
+                    $gd_error_location = __('Could not be saved due to blank/invalid address(city, region, country, latitude, longitude)', 'geodirectory');
4900 4900
                     for ($i = 1; $i <= $limit; $i++) {
4901 4901
                         $index = $processed + $i;
4902 4902
                         
4903 4903
                         if (isset($file[$index])) {
4904 4904
                             $row = $file[$index];
4905
-                            $row = array_map( 'trim', $row );
4905
+                            $row = array_map('trim', $row);
4906 4906
                             $data = array();
4907 4907
                             
4908
-                            foreach ($columns as $c => $column ) {
4908
+                            foreach ($columns as $c => $column) {
4909 4909
                                 if (in_array($column, array('location_id', 'latitude', 'longitude', 'city', 'city_slug', 'region', 'country', 'city_meta', 'city_desc', 'region_meta', 'region_desc', 'country_meta', 'country_desc'))) {
4910 4910
                                     $data[$column] = $row[$c];
4911 4911
                                 }
4912 4912
                             }
4913 4913
 
4914
-                            if ( empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude']) ) {
4914
+                            if (empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude'])) {
4915 4915
                                 $invalid++;
4916
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4916
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location);
4917 4917
                                 continue;
4918 4918
                             }
4919 4919
                             
4920 4920
                             $data['location_id'] = isset($data['location_id']) ? absint($data['location_id']) : 0;
4921 4921
                             
4922
-                            if ( $import_choice == 'update' ) {
4923
-                                if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4924
-                                    if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4922
+                            if ($import_choice == 'update') {
4923
+                                if ((int) $data['location_id'] > 0 && $location = geodir_get_location_by_id('', (int) $data['location_id'])) {
4924
+                                    if ($location_id = geodir_location_update_city($data, true, $location)) {
4925 4925
                                         $updated++;
4926 4926
                                     } else {
4927 4927
                                         $invalid++;
4928
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4928
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location);
4929 4929
                                     }
4930
-                                } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4931
-                                    $data['location_id'] = (int)$location->location_id;
4930
+                                } else if (!empty($data['city_slug']) && $location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug']))) {
4931
+                                    $data['location_id'] = (int) $location->location_id;
4932 4932
                                     
4933
-                                    if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region'] ) ) ) {
4934
-                                        $data['location_id'] = (int)$location->location_id;
4935
-                                    } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'region' => $data['region'] ) ) ) {
4936
-                                        $data['location_id'] = (int)$location->location_id;
4937
-                                    } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'] ) ) ) {
4938
-                                        $data['location_id'] = (int)$location->location_id;
4933
+                                    if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region']))) {
4934
+                                        $data['location_id'] = (int) $location->location_id;
4935
+                                    } else if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'region' => $data['region']))) {
4936
+                                        $data['location_id'] = (int) $location->location_id;
4937
+                                    } else if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'country' => $data['country']))) {
4938
+                                        $data['location_id'] = (int) $location->location_id;
4939 4939
                                     }
4940 4940
                                     
4941
-                                    if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4941
+                                    if ($location_id = geodir_location_update_city($data, true, $location)) {
4942 4942
                                         $updated++;
4943 4943
                                     } else {
4944 4944
                                         $invalid++;
4945
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4945
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location);
4946 4946
                                     }
4947 4947
                                 } else {
4948
-                                    if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4948
+                                    if ($location_id = geodir_location_insert_city($data, true)) {
4949 4949
                                         $created++;
4950 4950
                                     } else {
4951 4951
                                         $invalid++;
4952
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4952
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location);
4953 4953
                                     }
4954 4954
                                 }
4955
-                            } elseif ( $import_choice == 'skip' ) {
4956
-                                if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4955
+                            } elseif ($import_choice == 'skip') {
4956
+                                if ((int) $data['location_id'] > 0 && $location = geodir_get_location_by_id('', (int) $data['location_id'])) {
4957 4957
                                     $skipped++;
4958
-                                } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4958
+                                } else if (!empty($data['city_slug']) && $location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug']))) {
4959 4959
                                     $skipped++;
4960 4960
                                 } else {
4961
-                                    if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4961
+                                    if ($location_id = geodir_location_insert_city($data, true)) {
4962 4962
                                         $created++;
4963 4963
                                     } else {
4964 4964
                                         $invalid++;
4965
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4965
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location);
4966 4966
                                     }
4967 4967
                                 }
4968 4968
                             } else {
4969 4969
                                 $invalid++;
4970
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4970
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location);
4971 4971
                             }
4972 4972
                         }
4973 4973
                     }
@@ -4981,24 +4981,24 @@  discard block
 block discarded – undo
4981 4981
                 $json['invalid'] = $invalid;
4982 4982
                 $json['images'] = $images;
4983 4983
                 
4984
-                wp_send_json( $json );
4985
-            } else if ( $task == 'import_hood' ) {               
4984
+                wp_send_json($json);
4985
+            } else if ($task == 'import_hood') {               
4986 4986
                 if (!empty($file)) {
4987 4987
                     $columns = isset($file[0]) ? $file[0] : NULL;
4988 4988
                     
4989 4989
                     if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4990 4990
                         $json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
4991
-                        wp_send_json( $json );
4991
+                        wp_send_json($json);
4992 4992
                     }
4993 4993
                     
4994 4994
                     $gd_error_log = __('GD IMPORT NEIGHBOURHOODS [ROW %d]:', 'geodirectory');
4995
-                    $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' );
4995
+                    $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');
4996 4996
                     for ($i = 1; $i <= $limit; $i++) {
4997 4997
                         $index = $processed + $i;
4998 4998
                         
4999 4999
                         if (isset($file[$index])) {
5000 5000
                             $row = $file[$index];
5001
-                            $row = array_map( 'trim', $row );
5001
+                            $row = array_map('trim', $row);
5002 5002
                             $data = array();
5003 5003
                             
5004 5004
                             foreach ($columns as $c => $column) {
@@ -5009,20 +5009,20 @@  discard block
 block discarded – undo
5009 5009
 
5010 5010
                             if (empty($data['neighbourhood_name']) || empty($data['latitude']) || empty($data['longitude'])) {
5011 5011
                                 $invalid++;
5012
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5012
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
5013 5013
                                 continue;
5014 5014
                             }
5015 5015
                             
5016 5016
                             $location_info = array();
5017
-                            if (!empty($data['location_id']) && (int)$data['location_id'] > 0) {
5018
-                                $location_info = geodir_get_location_by_id('', (int)$data['location_id']);
5017
+                            if (!empty($data['location_id']) && (int) $data['location_id'] > 0) {
5018
+                                $location_info = geodir_get_location_by_id('', (int) $data['location_id']);
5019 5019
                             } else if (!empty($data['city']) && !empty($data['region']) && !empty($data['country'])) {
5020 5020
                                 $location_info = geodir_get_location_by_slug('city', array('fields' => 'location_id', 'city' => $data['city'], 'country' => $data['country'], 'region' => $data['region']));
5021 5021
                             }
5022 5022
 
5023 5023
                             if (empty($location_info)) {
5024 5024
                                 $invalid++;
5025
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5025
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
5026 5026
                                 continue;
5027 5027
                             }
5028 5028
                             
@@ -5037,35 +5037,35 @@  discard block
 block discarded – undo
5037 5037
                             $hood_data['hood_longitude'] = $data['longitude'];
5038 5038
                             $hood_data['hood_location_id'] = $location_id;
5039 5039
                                     
5040
-                            if ( $import_choice == 'update' ) {
5041
-                                if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
5042
-                                    $hood_data['hood_id'] = (int)$data['neighbourhood_id'];
5040
+                            if ($import_choice == 'update') {
5041
+                                if ((int) $data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int) $data['neighbourhood_id']))) {
5042
+                                    $hood_data['hood_id'] = (int) $data['neighbourhood_id'];
5043 5043
                                     
5044 5044
                                     if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
5045 5045
                                         $updated++;
5046 5046
                                     } else {
5047 5047
                                         $invalid++;
5048
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5048
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
5049 5049
                                     }
5050 5050
                                 } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
5051
-                                    $hood_data['hood_id'] = (int)$neighbourhood->hood_id;
5051
+                                    $hood_data['hood_id'] = (int) $neighbourhood->hood_id;
5052 5052
                                     
5053 5053
                                     if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
5054 5054
                                         $updated++;
5055 5055
                                     } else {
5056 5056
                                         $invalid++;
5057
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5057
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
5058 5058
                                     }
5059 5059
                                 } else {
5060 5060
                                     if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
5061 5061
                                         $created++;
5062 5062
                                     } else {
5063 5063
                                         $invalid++;
5064
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5064
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
5065 5065
                                     }
5066 5066
                                 }
5067
-                            } elseif ( $import_choice == 'skip' ) {
5068
-                                if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
5067
+                            } elseif ($import_choice == 'skip') {
5068
+                                if ((int) $data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int) $data['neighbourhood_id']))) {
5069 5069
                                     $skipped++;
5070 5070
                                 } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
5071 5071
                                     $skipped++;
@@ -5075,12 +5075,12 @@  discard block
 block discarded – undo
5075 5075
                                         $created++;
5076 5076
                                     } else {
5077 5077
                                         $invalid++;
5078
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5078
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
5079 5079
                                     }
5080 5080
                                 }
5081 5081
                             } else {
5082 5082
                                 $invalid++;
5083
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
5083
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
5084 5084
                             }
5085 5085
                         }
5086 5086
                     }
@@ -5094,7 +5094,7 @@  discard block
 block discarded – undo
5094 5094
                 $json['invalid'] = $invalid;
5095 5095
                 $json['images'] = $images;
5096 5096
                 
5097
-                wp_send_json( $json );
5097
+                wp_send_json($json);
5098 5098
             }
5099 5099
         }
5100 5100
         break;
@@ -5138,29 +5138,29 @@  discard block
 block discarded – undo
5138 5138
  * }
5139 5139
  * @return int|bool Term id when success, false when fail.
5140 5140
  */
5141
-function geodir_imex_insert_term( $taxonomy, $term_data ) {
5142
-	if ( empty( $taxonomy ) || empty( $term_data ) ) {
5141
+function geodir_imex_insert_term($taxonomy, $term_data) {
5142
+	if (empty($taxonomy) || empty($term_data)) {
5143 5143
 		return false;
5144 5144
 	}
5145 5145
 	
5146
-	$term = isset( $term_data['name'] ) && !empty( $term_data['name'] ) ? $term_data['name'] : '';
5146
+	$term = isset($term_data['name']) && !empty($term_data['name']) ? $term_data['name'] : '';
5147 5147
 	$args = array();
5148
-	$args['description'] = isset( $term_data['description'] ) ? $term_data['description'] : '';
5149
-	$args['slug'] = isset( $term_data['slug'] ) ? $term_data['slug'] : '';
5150
-	$args['parent'] = isset( $term_data['parent'] ) ? (int)$term_data['parent'] : '';
5148
+	$args['description'] = isset($term_data['description']) ? $term_data['description'] : '';
5149
+	$args['slug'] = isset($term_data['slug']) ? $term_data['slug'] : '';
5150
+	$args['parent'] = isset($term_data['parent']) ? (int) $term_data['parent'] : '';
5151 5151
 	
5152
-	if ( ( !empty( $args['slug'] ) && term_exists( $args['slug'], $taxonomy ) ) || empty( $args['slug'] ) ) {
5153
-		$term_args = array_merge( $term_data, $args );
5154
-		$defaults = array( 'alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '');
5155
-		$term_args = wp_parse_args( $term_args, $defaults );
5156
-		$term_args = sanitize_term( $term_args, $taxonomy, 'db' );
5157
-		$args['slug'] = wp_unique_term_slug( $args['slug'], (object)$term_args );
5152
+	if ((!empty($args['slug']) && term_exists($args['slug'], $taxonomy)) || empty($args['slug'])) {
5153
+		$term_args = array_merge($term_data, $args);
5154
+		$defaults = array('alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '');
5155
+		$term_args = wp_parse_args($term_args, $defaults);
5156
+		$term_args = sanitize_term($term_args, $taxonomy, 'db');
5157
+		$args['slug'] = wp_unique_term_slug($args['slug'], (object) $term_args);
5158 5158
 	}
5159 5159
 	
5160
-    if( !empty( $term ) ) {
5161
-		$result = wp_insert_term( $term, $taxonomy, $args );
5162
-        if( !is_wp_error( $result ) ) {
5163
-            return isset( $result['term_id'] ) ? $result['term_id'] : 0;
5160
+    if (!empty($term)) {
5161
+		$result = wp_insert_term($term, $taxonomy, $args);
5162
+        if (!is_wp_error($result)) {
5163
+            return isset($result['term_id']) ? $result['term_id'] : 0;
5164 5164
         }
5165 5165
     }
5166 5166
 	
@@ -5190,36 +5190,36 @@  discard block
 block discarded – undo
5190 5190
  * }
5191 5191
  * @return int|bool Term id when success, false when fail.
5192 5192
  */
5193
-function geodir_imex_update_term( $taxonomy, $term_data ) {
5194
-	if ( empty( $taxonomy ) || empty( $term_data ) ) {
5193
+function geodir_imex_update_term($taxonomy, $term_data) {
5194
+	if (empty($taxonomy) || empty($term_data)) {
5195 5195
 		return false;
5196 5196
 	}
5197 5197
 	
5198
-	$term_id = isset( $term_data['term_id'] ) && !empty( $term_data['term_id'] ) ? $term_data['term_id'] : 0;
5198
+	$term_id = isset($term_data['term_id']) && !empty($term_data['term_id']) ? $term_data['term_id'] : 0;
5199 5199
 	
5200 5200
 	$args = array();
5201
-	$args['description'] = isset( $term_data['description'] ) ? $term_data['description'] : '';
5202
-	$args['slug'] = isset( $term_data['slug'] ) ? $term_data['slug'] : '';
5203
-	$args['parent'] = isset( $term_data['parent'] ) ? (int)$term_data['parent'] : '';
5201
+	$args['description'] = isset($term_data['description']) ? $term_data['description'] : '';
5202
+	$args['slug'] = isset($term_data['slug']) ? $term_data['slug'] : '';
5203
+	$args['parent'] = isset($term_data['parent']) ? (int) $term_data['parent'] : '';
5204 5204
 	
5205
-	if ( $term_id > 0 && $term_info = (array)get_term( $term_id, $taxonomy ) ) {
5205
+	if ($term_id > 0 && $term_info = (array) get_term($term_id, $taxonomy)) {
5206 5206
 		$term_data['term_id'] = $term_info['term_id'];
5207 5207
 		
5208
-		$result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
5208
+		$result = wp_update_term($term_data['term_id'], $taxonomy, $term_data);
5209 5209
 		
5210
-		if( !is_wp_error( $result ) ) {
5211
-            return isset( $result['term_id'] ) ? $result['term_id'] : 0;
5210
+		if (!is_wp_error($result)) {
5211
+            return isset($result['term_id']) ? $result['term_id'] : 0;
5212 5212
         }
5213
-	} else if ( $term_data['slug'] != '' && $term_info = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
5213
+	} else if ($term_data['slug'] != '' && $term_info = (array) term_exists($term_data['slug'], $taxonomy)) {
5214 5214
 		$term_data['term_id'] = $term_info['term_id'];
5215 5215
 		
5216
-		$result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
5216
+		$result = wp_update_term($term_data['term_id'], $taxonomy, $term_data);
5217 5217
 		
5218
-		if( !is_wp_error( $result ) ) {
5219
-            return isset( $result['term_id'] ) ? $result['term_id'] : 0;
5218
+		if (!is_wp_error($result)) {
5219
+            return isset($result['term_id']) ? $result['term_id'] : 0;
5220 5220
         }
5221 5221
 	} else {
5222
-		return geodir_imex_insert_term( $taxonomy, $term_data );
5222
+		return geodir_imex_insert_term($taxonomy, $term_data);
5223 5223
 	}
5224 5224
 	
5225 5225
 	return false;
@@ -5237,25 +5237,25 @@  discard block
 block discarded – undo
5237 5237
  * @param string $post_type Post type.
5238 5238
  * @return int Posts count.
5239 5239
  */
5240
-function geodir_get_posts_count( $post_type ) {
5240
+function geodir_get_posts_count($post_type) {
5241 5241
     global $wpdb, $plugin_prefix;
5242 5242
 
5243
-    if ( !post_type_exists( $post_type ) ) {
5243
+    if (!post_type_exists($post_type)) {
5244 5244
         return 0;
5245 5245
     }
5246 5246
         
5247
-    $table = $plugin_prefix . $post_type . '_detail';
5247
+    $table = $plugin_prefix.$post_type.'_detail';
5248 5248
 
5249 5249
     // Skip listing with statuses trash, auto-draft etc...
5250 5250
     $skip_statuses = geodir_imex_export_skip_statuses();
5251 5251
     $where_statuses = '';
5252
-    if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5253
-        $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5252
+    if (!empty($skip_statuses) && is_array($skip_statuses)) {
5253
+        $where_statuses = "AND `".$wpdb->posts."`.`post_status` NOT IN('".implode("','", $skip_statuses)."')";
5254 5254
     }
5255 5255
 
5256
-    $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 );
5256
+    $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);
5257 5257
 
5258
-    $posts_count = (int)$wpdb->get_var( $query );
5258
+    $posts_count = (int) $wpdb->get_var($query);
5259 5259
     
5260 5260
     /**
5261 5261
      * Modify returned post counts for the current post type.
@@ -5266,7 +5266,7 @@  discard block
 block discarded – undo
5266 5266
      * @param int $posts_count Post counts.
5267 5267
      * @param string $post_type Post type.
5268 5268
      */
5269
-    $posts_count = apply_filters( 'geodir_imex_count_posts', $posts_count, $post_type );
5269
+    $posts_count = apply_filters('geodir_imex_count_posts', $posts_count, $post_type);
5270 5270
 
5271 5271
     return $posts_count;
5272 5272
 }
@@ -5287,17 +5287,17 @@  discard block
 block discarded – undo
5287 5287
  * @param int $page_no Page number. Default 0.
5288 5288
  * @return array Array of posts data.
5289 5289
  */
5290
-function geodir_imex_get_posts( $post_type, $per_page = 0, $page_no = 0 ) {	
5290
+function geodir_imex_get_posts($post_type, $per_page = 0, $page_no = 0) {	
5291 5291
 	global $wp_filesystem;
5292 5292
 
5293
-	$posts = geodir_get_export_posts( $post_type, $per_page, $page_no );
5293
+	$posts = geodir_get_export_posts($post_type, $per_page, $page_no);
5294 5294
 
5295 5295
 	$csv_rows = array();
5296 5296
 	
5297
-	if ( !empty( $posts ) ) {
5298
-		$is_payment_plugin = is_plugin_active( 'geodir_payment_manager/geodir_payment_manager.php' );
5297
+	if (!empty($posts)) {
5298
+		$is_payment_plugin = is_plugin_active('geodir_payment_manager/geodir_payment_manager.php');
5299 5299
         $location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
5300
-        $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
5300
+        $location_allowed = function_exists('geodir_cpt_no_location') && geodir_cpt_no_location($post_type) ? false : true;
5301 5301
         $neighbourhood_active = $location_manager && $location_allowed && get_option('location_neighbourhoods') ? true : false;
5302 5302
 		
5303 5303
 		$csv_row = array();
@@ -5309,7 +5309,7 @@  discard block
 block discarded – undo
5309 5309
 		$csv_row[] = 'default_category';
5310 5310
 		$csv_row[] = 'post_tags';
5311 5311
 		$csv_row[] = 'post_type';
5312
-		if ( $post_type == 'gd_event' ) {
5312
+		if ($post_type == 'gd_event') {
5313 5313
 			$csv_row[] = 'event_date';
5314 5314
 			$csv_row[] = 'event_enddate';
5315 5315
 			$csv_row[] = 'starttime';
@@ -5363,15 +5363,15 @@  discard block
 block discarded – undo
5363 5363
 		}
5364 5364
 		// WPML
5365 5365
 
5366
-		$custom_fields = geodir_imex_get_custom_fields( $post_type );
5367
-		if ( !empty( $custom_fields ) ) {
5368
-			foreach ( $custom_fields as $custom_field ) {
5366
+		$custom_fields = geodir_imex_get_custom_fields($post_type);
5367
+		if (!empty($custom_fields)) {
5368
+			foreach ($custom_fields as $custom_field) {
5369 5369
 				$csv_row[] = $custom_field->htmlvar_name;
5370 5370
 			}
5371 5371
 		}
5372 5372
 
5373 5373
 		// Export franchise fields
5374
-		$is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false;
5374
+		$is_franchise_active = is_plugin_active('geodir_franchise/geodir_franchise.php') && geodir_franchise_enabled($post_type) ? true : false;
5375 5375
 		if ($is_franchise_active) {
5376 5376
 			$csv_row[] = 'gd_is_franchise';
5377 5377
 			$csv_row[] = 'gd_franchise_lock';
@@ -5381,28 +5381,28 @@  discard block
 block discarded – undo
5381 5381
 		$csv_rows[] = $csv_row;
5382 5382
 
5383 5383
 		$images_count = 5;
5384
-        $xx=0;
5385
-		foreach ( $posts as $post ) {$xx++;
5384
+        $xx = 0;
5385
+		foreach ($posts as $post) {$xx++;
5386 5386
 			$post_id = $post['ID'];
5387 5387
 			
5388
-			$gd_post_info = geodir_get_post_info( $post_id );
5389
-			$post_info = (array)$gd_post_info;
5388
+			$gd_post_info = geodir_get_post_info($post_id);
5389
+			$post_info = (array) $gd_post_info;
5390 5390
 						
5391
-			$taxonomy_category = $post_type . 'category';
5392
-			$taxonomy_tags = $post_type . '_tags';
5391
+			$taxonomy_category = $post_type.'category';
5392
+			$taxonomy_tags = $post_type.'_tags';
5393 5393
 			
5394 5394
 			$post_category = '';
5395 5395
 			$default_category_id = $gd_post_info->default_category;
5396 5396
 			$default_category = '';
5397 5397
 			$post_tags = '';
5398
-			$terms = wp_get_post_terms( $post_id, array( $taxonomy_category, $taxonomy_tags ) );
5398
+			$terms = wp_get_post_terms($post_id, array($taxonomy_category, $taxonomy_tags));
5399 5399
 			
5400
-			if ( !empty( $terms ) && !is_wp_error( $terms ) ) {
5400
+			if (!empty($terms) && !is_wp_error($terms)) {
5401 5401
 				$post_category = array();
5402 5402
 				$post_tags = array();
5403 5403
 			
5404
-				foreach ( $terms as $term ) {
5405
-					if ( $term->taxonomy == $taxonomy_category ) {
5404
+				foreach ($terms as $term) {
5405
+					if ($term->taxonomy == $taxonomy_category) {
5406 5406
 						$post_category[] = $term->name;
5407 5407
 						
5408 5408
 						if ($default_category_id == $term->term_id) {
@@ -5410,7 +5410,7 @@  discard block
 block discarded – undo
5410 5410
 						}
5411 5411
 					}
5412 5412
 					
5413
-					if ( $term->taxonomy == $taxonomy_tags ) {
5413
+					if ($term->taxonomy == $taxonomy_tags) {
5414 5414
 						$post_tags[] = $term->name;
5415 5415
 					}
5416 5416
 				}
@@ -5418,47 +5418,47 @@  discard block
 block discarded – undo
5418 5418
 				if (empty($default_category) && !empty($post_category)) {
5419 5419
 					$default_category = $post_category[0]; // Set first one as default category.
5420 5420
 				}
5421
-				$post_category = !empty( $post_category ) ? implode( ',', $post_category ) : '';
5422
-				$post_tags = !empty( $post_tags ) ? implode( ',', $post_tags ) : '';
5421
+				$post_category = !empty($post_category) ? implode(',', $post_category) : '';
5422
+				$post_tags = !empty($post_tags) ? implode(',', $post_tags) : '';
5423 5423
 			}
5424 5424
 
5425 5425
 			// Franchise data
5426
-			if ($is_franchise_active && isset($post_info['franchise']) && (int)$post_info['franchise'] > 0 && geodir_franchise_check((int)$post_info['franchise'])) {
5426
+			if ($is_franchise_active && isset($post_info['franchise']) && (int) $post_info['franchise'] > 0 && geodir_franchise_check((int) $post_info['franchise'])) {
5427 5427
 				$franchise_id = $post_info['franchise'];
5428 5428
 				$gd_franchise_info = geodir_get_post_info($franchise_id);
5429 5429
 
5430 5430
 				if (geodir_franchise_pkg_is_active($gd_franchise_info)) {
5431
-					$franchise_info = (array)$gd_franchise_info;
5431
+					$franchise_info = (array) $gd_franchise_info;
5432 5432
 					$locked_fields = geodir_franchise_get_locked_fields($franchise_id, true);
5433 5433
 					
5434 5434
 					if (!empty($locked_fields)) {
5435
-						foreach( $locked_fields as $locked_field) {
5435
+						foreach ($locked_fields as $locked_field) {
5436 5436
 							if (isset($post_info[$locked_field]) && isset($franchise_info[$locked_field])) {
5437 5437
 								$post_info[$locked_field] = $franchise_info[$locked_field];
5438 5438
 							}
5439 5439
 							
5440 5440
 							if (in_array($taxonomy_category, $locked_fields) || in_array('post_tags', $locked_fields)) {
5441
-								$franchise_terms = wp_get_post_terms( $franchise_id, array( $taxonomy_category, $taxonomy_tags ) );
5441
+								$franchise_terms = wp_get_post_terms($franchise_id, array($taxonomy_category, $taxonomy_tags));
5442 5442
 			
5443
-								if ( !empty( $franchise_terms ) && !is_wp_error( $franchise_terms ) ) {
5443
+								if (!empty($franchise_terms) && !is_wp_error($franchise_terms)) {
5444 5444
 									$franchise_post_category = array();
5445 5445
 									$franchise_post_tags = array();
5446 5446
 								
5447
-									foreach ( $franchise_terms as $franchise_term ) {
5448
-										if ( $franchise_term->taxonomy == $taxonomy_category ) {
5447
+									foreach ($franchise_terms as $franchise_term) {
5448
+										if ($franchise_term->taxonomy == $taxonomy_category) {
5449 5449
 											$franchise_post_category[] = $franchise_term->name;
5450 5450
 										}
5451 5451
 										
5452
-										if ( $franchise_term->taxonomy == $taxonomy_tags ) {
5452
+										if ($franchise_term->taxonomy == $taxonomy_tags) {
5453 5453
 											$franchise_post_tags[] = $franchise_term->name;
5454 5454
 										}
5455 5455
 									}
5456 5456
 									
5457 5457
 									if (in_array($taxonomy_category, $locked_fields)) {
5458
-										$post_category = !empty( $franchise_post_category ) ? implode( ',', $franchise_post_category ) : '';
5458
+										$post_category = !empty($franchise_post_category) ? implode(',', $franchise_post_category) : '';
5459 5459
 									}
5460 5460
 									if (in_array('post_tags', $locked_fields)) {
5461
-										$post_tags = !empty( $franchise_post_tags ) ? implode( ',', $franchise_post_tags ) : '';
5461
+										$post_tags = !empty($franchise_post_tags) ? implode(',', $franchise_post_tags) : '';
5462 5462
 									}
5463 5463
 								}
5464 5464
 							}
@@ -5467,18 +5467,18 @@  discard block
 block discarded – undo
5467 5467
 				}
5468 5468
 			}
5469 5469
 						
5470
-			$post_images = geodir_get_images( $post_id );
5470
+			$post_images = geodir_get_images($post_id);
5471 5471
 			$current_images = array();
5472
-			if ( !empty( $post_images ) ) {
5473
-				foreach ( $post_images as $post_image ) {
5474
-					$post_image = (array)$post_image;
5475
-					$image = !empty( $post_image ) && isset( $post_image['path'] ) && $wp_filesystem->is_file( $post_image['path'] ) && $wp_filesystem->exists( $post_image['path'] ) ? $post_image['src'] : '';
5476
-					if ( $image ) {
5472
+			if (!empty($post_images)) {
5473
+				foreach ($post_images as $post_image) {
5474
+					$post_image = (array) $post_image;
5475
+					$image = !empty($post_image) && isset($post_image['path']) && $wp_filesystem->is_file($post_image['path']) && $wp_filesystem->exists($post_image['path']) ? $post_image['src'] : '';
5476
+					if ($image) {
5477 5477
 						$current_images[] = $image;
5478 5478
 					}
5479 5479
 				}
5480 5480
 				
5481
-				$images_count = max( $images_count, count( $current_images ) );
5481
+				$images_count = max($images_count, count($current_images));
5482 5482
 			}
5483 5483
 
5484 5484
 			$csv_row = array();
@@ -5490,7 +5490,7 @@  discard block
 block discarded – undo
5490 5490
 			$csv_row[] = $default_category; // default_category
5491 5491
 			$csv_row[] = $post_tags; // post_tags
5492 5492
 			$csv_row[] = $post_type; // post_type
5493
-			if ( $post_type == 'gd_event' ) {
5493
+			if ($post_type == 'gd_event') {
5494 5494
 				$event_data = geodir_imex_get_event_data($post, $gd_post_info);
5495 5495
 				$csv_row[] = $event_data['event_date']; // event_date
5496 5496
 				$csv_row[] = $event_data['event_enddate']; // enddate
@@ -5511,9 +5511,9 @@  discard block
 block discarded – undo
5511 5511
 				$csv_row[] = $event_data['recurring_end_date']; // repeat_end
5512 5512
 			}
5513 5513
 			$csv_row[] = $post_info['post_status']; // post_status
5514
-			$csv_row[] = (int)$post_info['is_featured'] == 1 ? 1 : ''; // is_featured
5514
+			$csv_row[] = (int) $post_info['is_featured'] == 1 ? 1 : ''; // is_featured
5515 5515
 			if ($is_payment_plugin) {
5516
-				$csv_row[] = (int)$post_info['package_id']; // package_id
5516
+				$csv_row[] = (int) $post_info['package_id']; // package_id
5517 5517
 				$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
5518 5518
 			}
5519 5519
 			$csv_row[] = $post_info['geodir_video']; // geodir_video
@@ -5549,14 +5549,14 @@  discard block
 block discarded – undo
5549 5549
 			$csv_row[] = $post_info['geodir_special_offers']; // geodir_special_offers
5550 5550
 			// WPML
5551 5551
 			if ($is_wpml) {
5552
-				$csv_row[] = geodir_get_language_for_element( $post_id, 'post_' . $post_type );
5553
-				$csv_row[] = geodir_imex_original_post_id( $post_id, 'post_' . $post_type );
5552
+				$csv_row[] = geodir_get_language_for_element($post_id, 'post_'.$post_type);
5553
+				$csv_row[] = geodir_imex_original_post_id($post_id, 'post_'.$post_type);
5554 5554
 			}
5555 5555
 			// WPML
5556 5556
 			
5557
-			if ( !empty( $custom_fields ) ) {
5558
-				foreach ( $custom_fields as $custom_field ) {
5559
-					$csv_row[] = isset( $post_info[$custom_field->htmlvar_name] ) ? $post_info[$custom_field->htmlvar_name] : '';
5557
+			if (!empty($custom_fields)) {
5558
+				foreach ($custom_fields as $custom_field) {
5559
+					$csv_row[] = isset($post_info[$custom_field->htmlvar_name]) ? $post_info[$custom_field->htmlvar_name] : '';
5560 5560
 				}
5561 5561
 			}
5562 5562
 			
@@ -5567,26 +5567,26 @@  discard block
 block discarded – undo
5567 5567
 				$franchise = '';
5568 5568
 					
5569 5569
 				if (geodir_franchise_pkg_is_active($gd_post_info)) {
5570
-					$gd_is_franchise = (int)get_post_meta( $post_id, 'gd_is_franchise', true );
5571
-					$locaked_fields = $gd_is_franchise ? get_post_meta( $post_id, 'gd_franchise_lock', true ) : '';
5570
+					$gd_is_franchise = (int) get_post_meta($post_id, 'gd_is_franchise', true);
5571
+					$locaked_fields = $gd_is_franchise ? get_post_meta($post_id, 'gd_franchise_lock', true) : '';
5572 5572
 					$locaked_fields = (is_array($locaked_fields) && !empty($locaked_fields) ? implode(",", $locaked_fields) : '');
5573
-					$franchise = !$gd_is_franchise && isset($post_info['franchise']) && (int)$post_info['franchise'] > 0 ? (int)$post_info['franchise'] : 0; // franchise id
5573
+					$franchise = !$gd_is_franchise && isset($post_info['franchise']) && (int) $post_info['franchise'] > 0 ? (int) $post_info['franchise'] : 0; // franchise id
5574 5574
 				}
5575 5575
 				
5576
-				$csv_row[] = (int)$gd_is_franchise; // gd_is_franchise
5576
+				$csv_row[] = (int) $gd_is_franchise; // gd_is_franchise
5577 5577
 				$csv_row[] = $locaked_fields; // gd_franchise_lock fields
5578
-				$csv_row[] = (int)$franchise; // franchise id
5578
+				$csv_row[] = (int) $franchise; // franchise id
5579 5579
 			}
5580 5580
 			
5581
-			for ( $c = 0; $c < $images_count; $c++ ) {
5582
-				$csv_row[] = isset( $current_images[$c] ) ? $current_images[$c] : ''; // IMAGE
5581
+			for ($c = 0; $c < $images_count; $c++) {
5582
+				$csv_row[] = isset($current_images[$c]) ? $current_images[$c] : ''; // IMAGE
5583 5583
 			}
5584 5584
 			
5585 5585
 			$csv_rows[] = $csv_row;
5586 5586
 
5587 5587
 		}
5588 5588
 
5589
-		for ( $c = 0; $c < $images_count; $c++ ) {
5589
+		for ($c = 0; $c < $images_count; $c++) {
5590 5590
 			$csv_rows[0][] = 'IMAGE';
5591 5591
 		}
5592 5592
 	}
@@ -5608,33 +5608,33 @@  discard block
 block discarded – undo
5608 5608
  * @param int $page_no Page number. Default 0.
5609 5609
  * @return array Array of posts data.
5610 5610
  */
5611
-function geodir_get_export_posts( $post_type, $per_page = 0, $page_no = 0 ) {
5611
+function geodir_get_export_posts($post_type, $per_page = 0, $page_no = 0) {
5612 5612
     global $wpdb, $plugin_prefix;
5613 5613
 
5614
-    if ( ! post_type_exists( $post_type ) )
5614
+    if (!post_type_exists($post_type))
5615 5615
         return new stdClass;
5616 5616
         
5617
-    $table = $plugin_prefix . $post_type . '_detail';
5617
+    $table = $plugin_prefix.$post_type.'_detail';
5618 5618
 
5619 5619
     $limit = '';
5620
-    if ( $per_page > 0 && $page_no > 0 ) {
5621
-        $offset = ( $page_no - 1 ) * $per_page;
5620
+    if ($per_page > 0 && $page_no > 0) {
5621
+        $offset = ($page_no - 1) * $per_page;
5622 5622
         
5623
-        if ( $offset > 0 ) {
5624
-            $limit = " LIMIT " . $offset . "," . $per_page;
5623
+        if ($offset > 0) {
5624
+            $limit = " LIMIT ".$offset.",".$per_page;
5625 5625
         } else {
5626
-            $limit = " LIMIT " . $per_page;
5626
+            $limit = " LIMIT ".$per_page;
5627 5627
         }
5628 5628
     }
5629 5629
 
5630 5630
     // Skip listing with statuses trash, auto-draft etc...
5631 5631
     $skip_statuses = geodir_imex_export_skip_statuses();
5632 5632
     $where_statuses = '';
5633
-    if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5634
-        $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5633
+    if (!empty($skip_statuses) && is_array($skip_statuses)) {
5634
+        $where_statuses = "AND `".$wpdb->posts."`.`post_status` NOT IN('".implode("','", $skip_statuses)."')";
5635 5635
     }
5636 5636
 
5637
-    $query = "SELECT {$wpdb->posts}.ID FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s " . $where_statuses . " ORDER BY {$wpdb->posts}.ID ASC" . $limit;
5637
+    $query = "SELECT {$wpdb->posts}.ID FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s ".$where_statuses." ORDER BY {$wpdb->posts}.ID ASC".$limit;
5638 5638
     /**
5639 5639
      * Modify returned posts SQL query for the current post type.
5640 5640
      *
@@ -5644,9 +5644,9 @@  discard block
 block discarded – undo
5644 5644
      * @param int $query The SQL query.
5645 5645
      * @param string $post_type Post type.
5646 5646
      */
5647
-    $query = apply_filters( 'geodir_imex_export_posts_query', $query, $post_type );
5647
+    $query = apply_filters('geodir_imex_export_posts_query', $query, $post_type);
5648 5648
 
5649
-    $results = (array)$wpdb->get_results( $wpdb->prepare( $query, $post_type ), ARRAY_A );
5649
+    $results = (array) $wpdb->get_results($wpdb->prepare($query, $post_type), ARRAY_A);
5650 5650
 
5651 5651
     /**
5652 5652
      * Modify returned post results for the current post type.
@@ -5657,7 +5657,7 @@  discard block
 block discarded – undo
5657 5657
      * @param object $results An object containing all post ids.
5658 5658
      * @param string $post_type Post type.
5659 5659
      */
5660
-    return apply_filters( 'geodir_export_posts', $results, $post_type );
5660
+    return apply_filters('geodir_export_posts', $results, $post_type);
5661 5661
 }
5662 5662
 
5663 5663
 /**
@@ -5674,21 +5674,21 @@  discard block
 block discarded – undo
5674 5674
  * @param string $post_type Post type.
5675 5675
  * @return string The SQL query.
5676 5676
  */
5677
-function geodir_imex_get_events_query( $query, $post_type ) {
5678
-    if ( $post_type == 'gd_event' ) {
5677
+function geodir_imex_get_events_query($query, $post_type) {
5678
+    if ($post_type == 'gd_event') {
5679 5679
         global $wpdb, $plugin_prefix;
5680 5680
         
5681
-        $table = $plugin_prefix . $post_type . '_detail';
5681
+        $table = $plugin_prefix.$post_type.'_detail';
5682 5682
         $schedule_table = EVENT_SCHEDULE;
5683 5683
         
5684 5684
         // Skip listing with statuses trash, auto-draft etc...
5685 5685
         $skip_statuses = geodir_imex_export_skip_statuses();
5686 5686
         $where_statuses = '';
5687
-        if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5688
-            $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5687
+        if (!empty($skip_statuses) && is_array($skip_statuses)) {
5688
+            $where_statuses = "AND `".$wpdb->posts."`.`post_status` NOT IN('".implode("','", $skip_statuses)."')";
5689 5689
         }
5690 5690
 
5691
-        $query = "SELECT {$wpdb->posts}.ID, {$schedule_table}.event_date, {$schedule_table}.event_enddate AS enddate, {$schedule_table}.event_starttime AS starttime, {$schedule_table}.event_endtime AS endtime FROM {$wpdb->posts} INNER JOIN {$table} ON ({$table}.post_id = {$wpdb->posts}.ID) INNER JOIN {$schedule_table} ON ({$schedule_table}.event_id = {$wpdb->posts}.ID) WHERE {$wpdb->posts}.post_type = %s " . $where_statuses . " GROUP BY {$table}.post_id ORDER BY {$wpdb->posts}.ID ASC, {$schedule_table}.schedule_id ASC";
5691
+        $query = "SELECT {$wpdb->posts}.ID, {$schedule_table}.event_date, {$schedule_table}.event_enddate AS enddate, {$schedule_table}.event_starttime AS starttime, {$schedule_table}.event_endtime AS endtime FROM {$wpdb->posts} INNER JOIN {$table} ON ({$table}.post_id = {$wpdb->posts}.ID) INNER JOIN {$schedule_table} ON ({$schedule_table}.event_id = {$wpdb->posts}.ID) WHERE {$wpdb->posts}.post_type = %s ".$where_statuses." GROUP BY {$table}.post_id ORDER BY {$wpdb->posts}.ID ASC, {$schedule_table}.schedule_id ASC";
5692 5692
     }
5693 5693
 
5694 5694
     return $query;
@@ -5712,35 +5712,35 @@  discard block
 block discarded – undo
5712 5712
  * @param  string $post_type Post type.
5713 5713
  * @return int Total terms count.
5714 5714
  */
5715
-function geodir_get_terms_count( $post_type ) {
5716
-    $args = array( 'hide_empty' => 0 );
5715
+function geodir_get_terms_count($post_type) {
5716
+    $args = array('hide_empty' => 0);
5717 5717
 
5718
-    remove_all_filters( 'get_terms' );
5718
+    remove_all_filters('get_terms');
5719 5719
 
5720
-    $taxonomy = $post_type . 'category';
5720
+    $taxonomy = $post_type.'category';
5721 5721
 
5722 5722
     // WPML
5723 5723
     $is_wpml = geodir_is_wpml();
5724 5724
     $active_lang = 'all';
5725
-    if ( $is_wpml ) {
5725
+    if ($is_wpml) {
5726 5726
         global $sitepress;
5727 5727
         $active_lang = $sitepress->get_current_language();
5728 5728
         
5729
-        if ( $active_lang != 'all' ) {
5730
-            $sitepress->switch_lang( 'all', true );
5729
+        if ($active_lang != 'all') {
5730
+            $sitepress->switch_lang('all', true);
5731 5731
         }
5732 5732
     }
5733 5733
     // WPML
5734 5734
             
5735
-    $count_terms = wp_count_terms( $taxonomy, $args );
5735
+    $count_terms = wp_count_terms($taxonomy, $args);
5736 5736
 
5737 5737
     // WPML
5738
-    if ( $is_wpml && $active_lang !== 'all' ) {
5738
+    if ($is_wpml && $active_lang !== 'all') {
5739 5739
         global $sitepress;
5740
-        $sitepress->switch_lang( $active_lang, true );
5740
+        $sitepress->switch_lang($active_lang, true);
5741 5741
     }
5742 5742
     // WPML
5743
-    $count_terms = !is_wp_error( $count_terms ) ? $count_terms : 0;
5743
+    $count_terms = !is_wp_error($count_terms) ? $count_terms : 0;
5744 5744
      
5745 5745
     return $count_terms;
5746 5746
 }
@@ -5757,23 +5757,23 @@  discard block
 block discarded – undo
5757 5757
  * @param int $page_no Page number. Default 0.
5758 5758
  * @return array Array of terms data.
5759 5759
  */
5760
-function geodir_imex_get_terms( $post_type, $per_page = 0, $page_no = 0 ) {
5761
-	$args = array( 'hide_empty' => 0, 'orderby' => 'id' );
5760
+function geodir_imex_get_terms($post_type, $per_page = 0, $page_no = 0) {
5761
+	$args = array('hide_empty' => 0, 'orderby' => 'id');
5762 5762
 	
5763
-	remove_all_filters( 'get_terms' );
5763
+	remove_all_filters('get_terms');
5764 5764
 	
5765
-	$taxonomy = $post_type . 'category';
5765
+	$taxonomy = $post_type.'category';
5766 5766
 	
5767
-	if ( $per_page > 0 && $page_no > 0 ) {
5768
-		$args['offset'] = ( $page_no - 1 ) * $per_page;
5767
+	if ($per_page > 0 && $page_no > 0) {
5768
+		$args['offset'] = ($page_no - 1) * $per_page;
5769 5769
 		$args['number'] = $per_page;
5770 5770
 	}
5771 5771
 	
5772
-	$terms = get_terms( $taxonomy, $args );
5772
+	$terms = get_terms($taxonomy, $args);
5773 5773
 
5774 5774
 	$csv_rows = array();
5775 5775
 	
5776
-	if ( !empty( $terms ) ) {
5776
+	if (!empty($terms)) {
5777 5777
 		$csv_row = array();
5778 5778
 		$csv_row[] = 'cat_id';
5779 5779
 		$csv_row[] = 'cat_name';
@@ -5795,16 +5795,16 @@  discard block
 block discarded – undo
5795 5795
 		
5796 5796
 		$csv_rows[] = $csv_row;
5797 5797
 		
5798
-		foreach ( $terms as $term ) {
5799
-			$cat_icon = get_tax_meta( $term->term_id, 'ct_cat_icon', false, $post_type );
5800
-			$cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : '';
5798
+		foreach ($terms as $term) {
5799
+			$cat_icon = get_tax_meta($term->term_id, 'ct_cat_icon', false, $post_type);
5800
+			$cat_icon = !empty($cat_icon) && isset($cat_icon['src']) ? $cat_icon['src'] : '';
5801 5801
 			
5802
-			$cat_image = geodir_get_default_catimage( $term->term_id, $post_type );
5803
-			$cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : ''; 
5802
+			$cat_image = geodir_get_default_catimage($term->term_id, $post_type);
5803
+			$cat_image = !empty($cat_image) && isset($cat_image['src']) ? $cat_image['src'] : ''; 
5804 5804
 			
5805 5805
 			$cat_parent = '';
5806
-			if (isset($term->parent) && (int)$term->parent > 0 && term_exists((int)$term->parent, $taxonomy)) {
5807
-				$parent_term = (array)get_term_by( 'id', (int)$term->parent, $taxonomy );
5806
+			if (isset($term->parent) && (int) $term->parent > 0 && term_exists((int) $term->parent, $taxonomy)) {
5807
+				$parent_term = (array) get_term_by('id', (int) $term->parent, $taxonomy);
5808 5808
 				$cat_parent = !empty($parent_term) && isset($parent_term['name']) ? $parent_term['name'] : '';
5809 5809
 			}
5810 5810
 			
@@ -5814,15 +5814,15 @@  discard block
 block discarded – undo
5814 5814
 			$csv_row[] = $term->slug;
5815 5815
 			$csv_row[] = $post_type;
5816 5816
 			$csv_row[] = $cat_parent;
5817
-			$csv_row[] = get_tax_meta( $term->term_id, 'ct_cat_schema', false, $post_type );
5817
+			$csv_row[] = get_tax_meta($term->term_id, 'ct_cat_schema', false, $post_type);
5818 5818
             // WPML
5819 5819
 			if ($is_wpml) {
5820
-				$csv_row[] = geodir_get_language_for_element( $term->term_id, 'tax_' . $taxonomy );
5821
-                $csv_row[] = geodir_imex_original_post_id( $term->term_id, 'tax_' . $taxonomy );
5820
+				$csv_row[] = geodir_get_language_for_element($term->term_id, 'tax_'.$taxonomy);
5821
+                $csv_row[] = geodir_imex_original_post_id($term->term_id, 'tax_'.$taxonomy);
5822 5822
 			}
5823 5823
 			// WPML
5824 5824
 			$csv_row[] = $term->description;
5825
-			$csv_row[] = get_tax_meta( $term->term_id, 'ct_cat_top_desc', false, $post_type );
5825
+			$csv_row[] = get_tax_meta($term->term_id, 'ct_cat_top_desc', false, $post_type);
5826 5826
 			$csv_row[] = $cat_image;
5827 5827
 			$csv_row[] = $cat_icon;
5828 5828
 			
@@ -5841,10 +5841,10 @@  discard block
 block discarded – undo
5841 5841
  * @param  bool $relative True for relative path & False for absolute path.
5842 5842
  * @return string Path to the cache directory.
5843 5843
  */
5844
-function geodir_path_import_export( $relative = true ) {
5844
+function geodir_path_import_export($relative = true) {
5845 5845
 	$upload_dir = wp_upload_dir();
5846 5846
 	
5847
-	return $relative ? $upload_dir['baseurl'] . '/cache' : $upload_dir['basedir'] . '/cache';
5847
+	return $relative ? $upload_dir['baseurl'].'/cache' : $upload_dir['basedir'].'/cache';
5848 5848
 }
5849 5849
 
5850 5850
 /**
@@ -5860,8 +5860,8 @@  discard block
 block discarded – undo
5860 5860
  * @param  bool $clear If true then it overwrite data otherwise add rows at the end of file.
5861 5861
  * @return bool true if success otherwise false.
5862 5862
  */
5863
-function geodir_save_csv_data( $file_path, $csv_data = array(), $clear = true ) {
5864
-	if ( empty( $csv_data ) ) {
5863
+function geodir_save_csv_data($file_path, $csv_data = array(), $clear = true) {
5864
+	if (empty($csv_data)) {
5865 5865
 		return false;
5866 5866
 	}
5867 5867
 	
@@ -5869,17 +5869,17 @@  discard block
 block discarded – undo
5869 5869
 	
5870 5870
 	$mode = $clear ? 'w+' : 'a+';
5871 5871
 	
5872
-	if ( function_exists( 'fputcsv' ) ) {
5873
-		$file = fopen( $file_path, $mode );
5874
-		foreach( $csv_data as $csv_row ) {
5872
+	if (function_exists('fputcsv')) {
5873
+		$file = fopen($file_path, $mode);
5874
+		foreach ($csv_data as $csv_row) {
5875 5875
 			//$csv_row = array_map( 'utf8_decode', $csv_row );
5876
-			$write_successful = fputcsv( $file, $csv_row, ",", $enclosure = '"' );
5876
+			$write_successful = fputcsv($file, $csv_row, ",", $enclosure = '"');
5877 5877
 		}
5878
-		fclose( $file );
5878
+		fclose($file);
5879 5879
 	} else {
5880
-		foreach( $csv_data as $csv_row ) {
5880
+		foreach ($csv_data as $csv_row) {
5881 5881
 			//$csv_row = array_map( 'utf8_decode', $csv_row );
5882
-			$wp_filesystem->put_contents( $file_path, $csv_row );
5882
+			$wp_filesystem->put_contents($file_path, $csv_row);
5883 5883
 		}
5884 5884
 	}
5885 5885
 		
@@ -5897,14 +5897,14 @@  discard block
 block discarded – undo
5897 5897
  * @param  string $file Full path to file.
5898 5898
  * @return int No of file rows.
5899 5899
  */
5900
-function geodir_import_export_line_count( $file ) {
5900
+function geodir_import_export_line_count($file) {
5901 5901
 	global $wp_filesystem;
5902 5902
 	
5903
-	if ( $wp_filesystem->is_file( $file ) && $wp_filesystem->exists( $file ) ) {
5904
-		$contents = $wp_filesystem->get_contents_array( $file );
5903
+	if ($wp_filesystem->is_file($file) && $wp_filesystem->exists($file)) {
5904
+		$contents = $wp_filesystem->get_contents_array($file);
5905 5905
 		
5906
-		if ( !empty( $contents ) && is_array( $contents ) ) {
5907
-			return count( $contents ) - 1;
5906
+		if (!empty($contents) && is_array($contents)) {
5907
+			return count($contents) - 1;
5908 5908
 		}
5909 5909
 	}
5910 5910
 	
@@ -5921,11 +5921,11 @@  discard block
 block discarded – undo
5921 5921
  * @param string $post_type The post type.
5922 5922
  * @return object Queried object.
5923 5923
  */
5924
-function geodir_imex_get_custom_fields( $post_type ) {
5924
+function geodir_imex_get_custom_fields($post_type) {
5925 5925
 	global $wpdb;
5926 5926
 	 
5927
-	$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 ) );
5928
-	$rows = $wpdb->get_results( $sql );
5927
+	$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));
5928
+	$rows = $wpdb->get_results($sql);
5929 5929
 	 
5930 5930
 	return $rows;
5931 5931
 }
@@ -6004,14 +6004,14 @@  discard block
 block discarded – undo
6004 6004
 	global $wpdb, $plugin_prefix;
6005 6005
 	
6006 6006
 	$post_type = get_post_type($master_post_id);
6007
-	$post_table = $plugin_prefix . $post_type . '_detail';
6007
+	$post_table = $plugin_prefix.$post_type.'_detail';
6008 6008
 	
6009
-	$query = $wpdb->prepare("SELECT * FROM " . $post_table . " WHERE post_id = %d", array($master_post_id));
6010
-	$data = (array)$wpdb->get_row($query);
6009
+	$query = $wpdb->prepare("SELECT * FROM ".$post_table." WHERE post_id = %d", array($master_post_id));
6010
+	$data = (array) $wpdb->get_row($query);
6011 6011
 	
6012
-	if ( !empty( $data ) ) {
6012
+	if (!empty($data)) {
6013 6013
 		$data['post_id'] = $tr_post_id;
6014
-		unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type . 'category'], $data['overall_rating'], $data['rating_count'], $data['ratings']);
6014
+		unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type.'category'], $data['overall_rating'], $data['rating_count'], $data['ratings']);
6015 6015
 		
6016 6016
 		$wpdb->update($post_table, $data, array('post_id' => $tr_post_id));		
6017 6017
 		return true;
@@ -6037,7 +6037,7 @@  discard block
 block discarded – undo
6037 6037
 	global $sitepress, $wpdb;
6038 6038
 	$post_type = get_post_type($master_post_id);
6039 6039
 	
6040
-	remove_filter('get_term', array($sitepress,'get_term_adjust_id')); // AVOID filtering to current language
6040
+	remove_filter('get_term', array($sitepress, 'get_term_adjust_id')); // AVOID filtering to current language
6041 6041
 
6042 6042
 	$taxonomies = get_object_taxonomies($post_type);
6043 6043
 	foreach ($taxonomies as $taxonomy) {
@@ -6046,9 +6046,9 @@  discard block
 block discarded – undo
6046 6046
 		
6047 6047
 		if ($terms) {
6048 6048
 			foreach ($terms as $term) {
6049
-				$tr_id = apply_filters( 'translate_object_id',$term->term_id, $taxonomy, false, $lang);
6049
+				$tr_id = apply_filters('translate_object_id', $term->term_id, $taxonomy, false, $lang);
6050 6050
 				
6051
-				if (!is_null($tr_id)){
6051
+				if (!is_null($tr_id)) {
6052 6052
 					// not using get_term - unfiltered get_term
6053 6053
 					$translated_term = $wpdb->get_row($wpdb->prepare("
6054 6054
 						SELECT * FROM {$wpdb->terms} t JOIN {$wpdb->term_taxonomy} x ON x.term_id = t.term_id WHERE t.term_id = %d AND x.taxonomy = %s", $tr_id, $taxonomy));
@@ -6057,14 +6057,14 @@  discard block
 block discarded – undo
6057 6057
 				}
6058 6058
 			}
6059 6059
 
6060
-			if (!is_taxonomy_hierarchical($taxonomy)){
6061
-				$terms_array = array_unique( array_map( 'intval', $terms_array ) );
6060
+			if (!is_taxonomy_hierarchical($taxonomy)) {
6061
+				$terms_array = array_unique(array_map('intval', $terms_array));
6062 6062
 			}
6063 6063
 
6064 6064
 			wp_set_post_terms($tr_post_id, $terms_array, $taxonomy);
6065 6065
 			
6066
-			if ($taxonomy == $post_type . 'category') {
6067
-				geodir_set_postcat_structure($tr_post_id, $post_type . 'category');
6066
+			if ($taxonomy == $post_type.'category') {
6067
+				geodir_set_postcat_structure($tr_post_id, $post_type.'category');
6068 6068
 			}
6069 6069
 		}
6070 6070
 	}
@@ -6085,15 +6085,15 @@  discard block
 block discarded – undo
6085 6085
 function geodir_icl_duplicate_post_images($master_post_id, $tr_post_id, $lang) {
6086 6086
 	global $wpdb;
6087 6087
 	
6088
-	$query = $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id));
6088
+	$query = $wpdb->prepare("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id));
6089 6089
 	$wpdb->query($query);
6090 6090
 	
6091
-	$query = $wpdb->prepare("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id));
6091
+	$query = $wpdb->prepare("SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id));
6092 6092
 	$post_images = $wpdb->get_results($query);
6093 6093
 	
6094
-	if ( !empty( $post_images ) ) {
6095
-		foreach ( $post_images as $post_image) {
6096
-			$image_data = (array)$post_image;
6094
+	if (!empty($post_images)) {
6095
+		foreach ($post_images as $post_image) {
6096
+			$image_data = (array) $post_image;
6097 6097
 			unset($image_data['ID']);
6098 6098
 			$image_data['post_id'] = $tr_post_id;
6099 6099
 			
@@ -6119,10 +6119,10 @@  discard block
 block discarded – undo
6119 6119
  * @return array Event data array.
6120 6120
  */
6121 6121
 function geodir_imex_get_event_data($post, $gd_post_info) {
6122
-	$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'] ) ) : '';
6122
+	$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'])) : '';
6123 6123
 	$event_enddate = $event_date;
6124
-	$starttime = isset( $post['starttime'] ) && $post['starttime'] != '' && $post['starttime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $post['starttime'] ) ) : '';
6125
-	$endtime = isset( $post['endtime'] ) && $post['endtime'] != '' && $post['endtime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $post['endtime'] ) ) : '';
6124
+	$starttime = isset($post['starttime']) && $post['starttime'] != '' && $post['starttime'] != '00:00:00' ? date_i18n('H:i', strtotime($post['starttime'])) : '';
6125
+	$endtime = isset($post['endtime']) && $post['endtime'] != '' && $post['endtime'] != '00:00:00' ? date_i18n('H:i', strtotime($post['endtime'])) : '';
6126 6126
 	
6127 6127
 	$is_recurring_event = '';
6128 6128
 	$event_duration_days = '';
@@ -6139,15 +6139,15 @@  discard block
 block discarded – undo
6139 6139
 		
6140 6140
 	$recurring_data = isset($gd_post_info->recurring_dates) ? maybe_unserialize($gd_post_info->recurring_dates) : array();
6141 6141
 	if (!empty($recurring_data)) {
6142
-		$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;
6143
-		$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;
6144
-		$starttime = isset( $recurring_data['starttime'] ) && $recurring_data['starttime'] != '' && $recurring_data['starttime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $recurring_data['starttime'] ) ) : $starttime;
6145
-		$endtime = isset( $recurring_data['endtime'] ) && $recurring_data['endtime'] != '' && $recurring_data['endtime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $recurring_data['endtime'] ) ) : $endtime;
6142
+		$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;
6143
+		$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;
6144
+		$starttime = isset($recurring_data['starttime']) && $recurring_data['starttime'] != '' && $recurring_data['starttime'] != '00:00:00' ? date_i18n('H:i', strtotime($recurring_data['starttime'])) : $starttime;
6145
+		$endtime = isset($recurring_data['endtime']) && $recurring_data['endtime'] != '' && $recurring_data['endtime'] != '00:00:00' ? date_i18n('H:i', strtotime($recurring_data['endtime'])) : $endtime;
6146 6146
 		$is_whole_day_event = !empty($recurring_data['all_day']) ? 1 : '';
6147 6147
 		$different_times = !empty($recurring_data['different_times']) ? true : false;
6148 6148
 	
6149
-		$recurring_pkg = geodir_event_recurring_pkg( $gd_post_info );
6150
-		$is_recurring = isset( $gd_post_info->is_recurring ) && (int)$gd_post_info->is_recurring == 0 ? false : true;
6149
+		$recurring_pkg = geodir_event_recurring_pkg($gd_post_info);
6150
+		$is_recurring = isset($gd_post_info->is_recurring) && (int) $gd_post_info->is_recurring == 0 ? false : true;
6151 6151
 			
6152 6152
 		if ($recurring_pkg && $is_recurring) {
6153 6153
 			$recurring_dates = $event_date;
@@ -6157,13 +6157,13 @@  discard block
 block discarded – undo
6157 6157
 			$recurring_type = !empty($recurring_data['repeat_type']) && in_array($recurring_data['repeat_type'], array('day', 'week', 'month', 'year', 'custom')) ? $recurring_data['repeat_type'] : 'custom';
6158 6158
 			
6159 6159
 			if (!empty($recurring_data['event_recurring_dates'])) {
6160
-				$event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] );
6160
+				$event_recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
6161 6161
 				
6162 6162
 				if (!empty($event_recurring_dates)) {
6163 6163
 					$recurring_dates = array();
6164 6164
 					
6165 6165
 					foreach ($event_recurring_dates as $date) {
6166
-						$recurring_dates[] = date_i18n( 'd/m/Y', strtotime( $date ) );
6166
+						$recurring_dates[] = date_i18n('d/m/Y', strtotime($date));
6167 6167
 					}
6168 6168
 					
6169 6169
 					$recurring_dates = implode(",", $recurring_dates);
@@ -6179,7 +6179,7 @@  discard block
 block discarded – undo
6179 6179
 						$times = array();
6180 6180
 						
6181 6181
 						foreach ($recurring_data['starttimes'] as $time) {
6182
-							$times[] = $time != '00:00:00' ? date_i18n( 'H:i', strtotime( $time ) ) : '00:00';
6182
+							$times[] = $time != '00:00:00' ? date_i18n('H:i', strtotime($time)) : '00:00';
6183 6183
 						}
6184 6184
 						
6185 6185
 						$event_starttimes = implode(",", $times);
@@ -6189,7 +6189,7 @@  discard block
 block discarded – undo
6189 6189
 						$times = array();
6190 6190
 						
6191 6191
 						foreach ($recurring_data['endtimes'] as $time) {
6192
-							$times[] = $time != '00:00:00' ? date_i18n( 'H:i', strtotime( $time ) ) : '00:00';
6192
+							$times[] = $time != '00:00:00' ? date_i18n('H:i', strtotime($time)) : '00:00';
6193 6193
 						}
6194 6194
 						
6195 6195
 						$event_endtimes = implode(",", $times);
@@ -6201,8 +6201,8 @@  discard block
 block discarded – undo
6201 6201
 					}
6202 6202
 				}
6203 6203
 			} else {
6204
-				$event_duration_days = isset($recurring_data['duration_x']) ? (int)$recurring_data['duration_x'] : 1;
6205
-				$recurring_interval = !empty($recurring_data['repeat_x']) && (int)$recurring_data['repeat_x'] > 0 ? $recurring_data['repeat_x'] : 1;
6204
+				$event_duration_days = isset($recurring_data['duration_x']) ? (int) $recurring_data['duration_x'] : 1;
6205
+				$recurring_interval = !empty($recurring_data['repeat_x']) && (int) $recurring_data['repeat_x'] > 0 ? $recurring_data['repeat_x'] : 1;
6206 6206
 				
6207 6207
 				if (($recurring_type == 'week' || $recurring_type == 'month') && !empty($recurring_data['repeat_days'])) {
6208 6208
 					$week_days = array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
@@ -6218,11 +6218,11 @@  discard block
 block discarded – undo
6218 6218
 				}
6219 6219
 				
6220 6220
 				$recurring_week_nos = $recurring_type == 'month' && !empty($recurring_data['repeat_weeks']) ? implode(",", $recurring_data['repeat_weeks']) : $recurring_week_nos;
6221
-				if (!empty($recurring_data['repeat_end_type']) && (int)$recurring_data['repeat_end_type'] == 1) {
6222
-					$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'] ) ) : '';
6221
+				if (!empty($recurring_data['repeat_end_type']) && (int) $recurring_data['repeat_end_type'] == 1) {
6222
+					$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'])) : '';
6223 6223
 					$max_recurring_count = empty($recurring_end_date) ? 1 : '';
6224 6224
 				} else {
6225
-					$max_recurring_count = (!empty($recurring_data['max_repeat']) && (int)$recurring_data['max_repeat'] > 0 ? (int)$recurring_data['max_repeat'] : 1);
6225
+					$max_recurring_count = (!empty($recurring_data['max_repeat']) && (int) $recurring_data['max_repeat'] > 0 ? (int) $recurring_data['max_repeat'] : 1);
6226 6226
 				}
6227 6227
 			}
6228 6228
 		}
@@ -6286,9 +6286,9 @@  discard block
 block discarded – undo
6286 6286
  * @return array Event data array.
6287 6287
  */
6288 6288
 function geodir_imex_process_event_data($gd_post) {
6289
-	$recurring_pkg = geodir_event_recurring_pkg( (object)$gd_post );
6289
+	$recurring_pkg = geodir_event_recurring_pkg((object) $gd_post);
6290 6290
 
6291
-	$is_recurring = isset( $gd_post['is_recurring_event'] ) && (int)$gd_post['is_recurring_event'] == 0 ? false : true;
6291
+	$is_recurring = isset($gd_post['is_recurring_event']) && (int) $gd_post['is_recurring_event'] == 0 ? false : true;
6292 6292
 	$event_date = isset($gd_post['event_date']) && $gd_post['event_date'] != '' ? geodir_imex_get_date_ymd($gd_post['event_date']) : '';
6293 6293
 	$event_enddate = isset($gd_post['event_enddate']) && $gd_post['event_enddate'] != '' ? geodir_imex_get_date_ymd($gd_post['event_enddate']) : $event_date;
6294 6294
 	$all_day = isset($gd_post['is_whole_day_event']) && !empty($gd_post['is_whole_day_event']) ? true : false;
@@ -6335,17 +6335,17 @@  discard block
 block discarded – undo
6335 6335
 				$event_recurring_dates = implode(",", $event_recurring_dates);
6336 6336
 			}
6337 6337
 		} else {
6338
-			$duration_x = !empty( $gd_post['event_duration_days'] ) ? (int)$gd_post['event_duration_days'] : 1;
6339
-			$repeat_x = !empty( $gd_post['recurring_interval'] ) ? (int)$gd_post['recurring_interval'] : 1;
6340
-			$max_repeat = !empty( $gd_post['max_recurring_count'] ) ? (int)$gd_post['max_recurring_count'] : 1;
6341
-			$repeat_end = !empty( $gd_post['recurring_end_date'] ) ? geodir_imex_get_date_ymd($gd_post['recurring_end_date']) : '';
6338
+			$duration_x = !empty($gd_post['event_duration_days']) ? (int) $gd_post['event_duration_days'] : 1;
6339
+			$repeat_x = !empty($gd_post['recurring_interval']) ? (int) $gd_post['recurring_interval'] : 1;
6340
+			$max_repeat = !empty($gd_post['max_recurring_count']) ? (int) $gd_post['max_recurring_count'] : 1;
6341
+			$repeat_end = !empty($gd_post['recurring_end_date']) ? geodir_imex_get_date_ymd($gd_post['recurring_end_date']) : '';
6342 6342
 			
6343 6343
 			$repeat_end_type = $repeat_end != '' ? 1 : 0;
6344 6344
 			$max_repeat = $repeat_end != '' ? '' : $max_repeat;
6345 6345
 			
6346 6346
 			$week_days = array_flip(array('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'));
6347 6347
 			
6348
-			$a_repeat_days = isset($gd_post['recurring_week_days']) && trim($gd_post['recurring_week_days'])!='' ? explode(',', trim($gd_post['recurring_week_days'])) : array();
6348
+			$a_repeat_days = isset($gd_post['recurring_week_days']) && trim($gd_post['recurring_week_days']) != '' ? explode(',', trim($gd_post['recurring_week_days'])) : array();
6349 6349
 			$repeat_days = array();
6350 6350
 			if (!empty($a_repeat_days)) {
6351 6351
 				foreach ($a_repeat_days as $repeat_day) {
@@ -6363,7 +6363,7 @@  discard block
 block discarded – undo
6363 6363
 			$repeat_weeks = array();
6364 6364
 			if (!empty($a_repeat_weeks)) {
6365 6365
 				foreach ($a_repeat_weeks as $repeat_week) {
6366
-					$repeat_weeks[] = (int)$repeat_week;
6366
+					$repeat_weeks[] = (int) $repeat_week;
6367 6367
 				}
6368 6368
 				
6369 6369
 				$repeat_weeks = array_unique($repeat_weeks);
@@ -6427,7 +6427,7 @@  discard block
 block discarded – undo
6427 6427
 
6428 6428
     $page_found = $wpdb->get_var(
6429 6429
         $wpdb->prepare(
6430
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;",
6430
+            "SELECT ID FROM ".$wpdb->posts." WHERE post_name = %s LIMIT 1;",
6431 6431
             array($slug)
6432 6432
         )
6433 6433
     );
@@ -6482,7 +6482,7 @@  discard block
 block discarded – undo
6482 6482
  */
6483 6483
 function geodir_admin_upgrade_notice() {
6484 6484
     $class = "error";
6485
-    $message = __("Please update core GeoDirectory or some addons may not function correctly.","geodirectory");
6485
+    $message = __("Please update core GeoDirectory or some addons may not function correctly.", "geodirectory");
6486 6486
     echo"<div class=\"$class\"> <p>$message</p></div>";
6487 6487
 }
6488 6488
 
@@ -6494,7 +6494,7 @@  discard block
 block discarded – undo
6494 6494
  * @param (object) $r
6495 6495
  * @return (string) $output
6496 6496
  */
6497
-function geodire_admin_upgrade_notice( $plugin_data, $r )
6497
+function geodire_admin_upgrade_notice($plugin_data, $r)
6498 6498
 {
6499 6499
     // readme contents
6500 6500
     $args = array(
@@ -6502,7 +6502,7 @@  discard block
 block discarded – undo
6502 6502
         'redirection' => 5
6503 6503
     );
6504 6504
     $url = "http://plugins.svn.wordpress.org/geodirectory/trunk/readme.txt";
6505
-    $data       = wp_remote_get( $url, $args );
6505
+    $data = wp_remote_get($url, $args);
6506 6506
 
6507 6507
     if (!is_wp_error($data) && $data['response']['code'] == 200) {
6508 6508
 
@@ -6517,20 +6517,20 @@  discard block
 block discarded – undo
6517 6517
 function geodir_in_plugin_update_message($content) {
6518 6518
     // Output Upgrade Notice
6519 6519
     $matches        = null;
6520
-    $regexp         = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( GEODIRECTORY_VERSION ) . '\s*=|$)~Uis';
6520
+    $regexp         = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*'.preg_quote(GEODIRECTORY_VERSION).'\s*=|$)~Uis';
6521 6521
     $upgrade_notice = '';
6522
-    if ( preg_match( $regexp, $content, $matches ) ) {
6523
-        if(empty($matches)){return;}
6522
+    if (preg_match($regexp, $content, $matches)) {
6523
+        if (empty($matches)) {return; }
6524 6524
 
6525
-        $version = trim( $matches[1] );
6526
-        if($version && $version>GEODIRECTORY_VERSION){
6525
+        $version = trim($matches[1]);
6526
+        if ($version && $version > GEODIRECTORY_VERSION) {
6527 6527
 
6528 6528
 
6529
-        $notices = (array) preg_split('~[\r\n]+~', trim( $matches[2] ) );
6530
-        if ( version_compare( GEODIRECTORY_VERSION, $version, '<' ) ) {
6529
+        $notices = (array) preg_split('~[\r\n]+~', trim($matches[2]));
6530
+        if (version_compare(GEODIRECTORY_VERSION, $version, '<')) {
6531 6531
             $upgrade_notice .= '<div class="geodir_plugin_upgrade_notice">';
6532
-            foreach ( $notices as $index => $line ) {
6533
-                $upgrade_notice .= wp_kses_post( preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line ) );
6532
+            foreach ($notices as $index => $line) {
6533
+                $upgrade_notice .= wp_kses_post(preg_replace('~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line));
6534 6534
             }
6535 6535
             $upgrade_notice .= '</div> ';
6536 6536
         }
@@ -6554,7 +6554,7 @@  discard block
 block discarded – undo
6554 6554
 		$default_language = $sitepress->get_default_language();
6555 6555
 		if ($current_language != 'all' && $current_language != $default_language) {
6556 6556
 	?>
6557
-	<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>
6557
+	<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>
6558 6558
 	<?php
6559 6559
 		}
6560 6560
 	}
@@ -6569,7 +6569,7 @@  discard block
 block discarded – undo
6569 6569
  * @param array Listing statuses to be skipped.
6570 6570
  */
6571 6571
 function geodir_imex_export_skip_statuses() {
6572
-    $statuses = array( 'trash', 'auto-draft' );
6572
+    $statuses = array('trash', 'auto-draft');
6573 6573
     
6574 6574
     /**
6575 6575
      * Filter the statuses to skip during GD export listings.
@@ -6579,7 +6579,7 @@  discard block
 block discarded – undo
6579 6579
      *
6580 6580
      * @param array $statuses Listing statuses to be skipped.
6581 6581
      */
6582
-    $statuses = apply_filters( 'geodir_imex_export_skip_statuses', $statuses );
6582
+    $statuses = apply_filters('geodir_imex_export_skip_statuses', $statuses);
6583 6583
      
6584 6584
     return $statuses;
6585 6585
 }
Please login to merge, or discard this patch.