|
@@ -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('font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION);
|
|
90
|
90
|
wp_enqueue_style('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 & drop the images to rearrange the order', 'geodirectory');?></span>
|
|
|
2129
|
+ id="upload-msg"><?php _e('Please drag & 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> ( <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,30 +2708,30 @@ 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 class="gd-imex-dates">
|
|
2729
|
|
- <td class="fld"><label><?php _e( 'Published Date:', 'geodirectory' );?></label></td>
|
|
2730
|
|
- <td><label><span class="label-responsive"><?php _e( 'Start date:', 'geodirectory' );?></span><input type="text" id="gd_imex_start_date" name="gd_imex[start_date]" data-type="date" /></label><label><span class="label-responsive"><?php _e( 'End date:', 'geodirectory' );?></span><input type="text" id="gd_imex_end_date" name="gd_imex[end_date]" data-type="date" /></label></td>
|
|
|
2729
|
+ <td class="fld"><label><?php _e('Published Date:', 'geodirectory'); ?></label></td>
|
|
|
2730
|
+ <td><label><span class="label-responsive"><?php _e('Start date:', 'geodirectory'); ?></span><input type="text" id="gd_imex_start_date" name="gd_imex[start_date]" data-type="date" /></label><label><span class="label-responsive"><?php _e('End date:', 'geodirectory'); ?></span><input type="text" id="gd_imex_end_date" name="gd_imex[end_date]" data-type="date" /></label></td>
|
|
2731
|
2731
|
</tr>
|
|
2732
|
2732
|
<tr>
|
|
2733
|
2733
|
<td class="fld" style="vertical-align:top"><label>
|
|
2734
|
|
- <?php _e( 'Progress:', 'geodirectory' );?>
|
|
|
2734
|
+ <?php _e('Progress:', 'geodirectory'); ?>
|
|
2735
|
2735
|
</label></td>
|
|
2736
|
2736
|
<td><div id='gd_progressbar_box'>
|
|
2737
|
2737
|
<div id="gd_progressbar" class="gd_progressbar">
|
|
@@ -2739,13 +2739,13 @@ discard block |
|
|
block discarded – undo |
|
2739
|
2739
|
</div>
|
|
2740
|
2740
|
</div>
|
|
2741
|
2741
|
<p style="display:inline-block">
|
|
2742
|
|
- <?php _e( 'Elapsed Time:', 'geodirectory' );?>
|
|
|
2742
|
+ <?php _e('Elapsed Time:', 'geodirectory'); ?>
|
|
2743
|
2743
|
</p>
|
|
2744
|
2744
|
|
|
2745
|
2745
|
<p id="gd_timer" class="gd_timer">00:00:00</p></td>
|
|
2746
|
2746
|
</tr>
|
|
2747
|
2747
|
<tr class="gd-ie-actions">
|
|
2748
|
|
- <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">
|
|
|
2748
|
+ <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">
|
|
2749
|
2749
|
</td>
|
|
2750
|
2750
|
<td id="gd_ie_ex_files" class="gd-ie-files"></td>
|
|
2751
|
2751
|
</tr>
|
|
@@ -2758,21 +2758,21 @@ discard block |
|
|
block discarded – undo |
|
2758
|
2758
|
<div id="gd_ie_imcategs" class="metabox-holder">
|
|
2759
|
2759
|
<div class="meta-box-sortables ui-sortable">
|
|
2760
|
2760
|
<div id="gd_ie_imcats" class="postbox gd-hndle-pbox">
|
|
2761
|
|
- <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>
|
|
2762
|
|
- <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Categories: Import CSV', 'geodirectory' );?></span></h3>
|
|
|
2761
|
+ <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>
|
|
|
2762
|
+ <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Categories: Import CSV', 'geodirectory'); ?></span></h3>
|
|
2763
|
2763
|
<div class="inside">
|
|
2764
|
2764
|
<table class="form-table">
|
|
2765
|
2765
|
<tbody>
|
|
2766
|
2766
|
<tr>
|
|
2767
|
2767
|
<td class="gd-imex-box">
|
|
2768
|
2768
|
<div class="gd-im-choices">
|
|
2769
|
|
- <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>
|
|
2770
|
|
- <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>
|
|
|
2769
|
+ <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>
|
|
|
2770
|
+ <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>
|
|
2771
|
2771
|
</div>
|
|
2772
|
2772
|
<div class="plupload-upload-uic hide-if-no-js" id="gd_im_catplupload-upload-ui">
|
|
2773
|
2773
|
<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');" />
|
|
2774
|
|
- <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">
|
|
2775
|
|
- <input type="hidden" id="gd_ie_imcats_csv" value="<?php echo $gd_cats_sample_csv;?>" />
|
|
|
2774
|
+ <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">
|
|
|
2775
|
+ <input type="hidden" id="gd_ie_imcats_csv" value="<?php echo $gd_cats_sample_csv; ?>" />
|
|
2776
|
2776
|
<?php
|
|
2777
|
2777
|
/**
|
|
2778
|
2778
|
* Called just after the sample CSV download link.
|
|
@@ -2782,7 +2782,7 @@ discard block |
|
|
block discarded – undo |
|
2782
|
2782
|
*/
|
|
2783
|
2783
|
do_action('geodir_sample_cats_csv_download_link');
|
|
2784
|
2784
|
?>
|
|
2785
|
|
- <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce( 'gd_im_catpluploadan' ); ?>"></span>
|
|
|
2785
|
+ <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce('gd_im_catpluploadan'); ?>"></span>
|
|
2786
|
2786
|
<div class="filelist"></div>
|
|
2787
|
2787
|
</div>
|
|
2788
|
2788
|
<span id="gd_im_catupload-error" style="display:none"></span>
|
|
@@ -2799,7 +2799,7 @@ discard block |
|
|
block discarded – undo |
|
2799
|
2799
|
<input type="hidden" id="gd_terminateaction" value="continue"/>
|
|
2800
|
2800
|
</div>
|
|
2801
|
2801
|
<div class="gd-import-progress" id="gd-import-progress" style="display:none">
|
|
2802
|
|
- <div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory');?> </b><font
|
|
|
2802
|
+ <div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory'); ?> </b><font
|
|
2803
|
2803
|
id="gd-import-done">0</font> / <font id="gd-import-total">0</font> ( <font
|
|
2804
|
2804
|
id="gd-import-perc">0%</font> )
|
|
2805
|
2805
|
<div class="gd-fileprogress"></div>
|
|
@@ -2811,10 +2811,10 @@ discard block |
|
|
block discarded – undo |
|
2811
|
2811
|
<div class="gd-imex-btns" style="display:none;">
|
|
2812
|
2812
|
<input type="hidden" class="geodir_import_file" name="geodir_import_file" value="save"/>
|
|
2813
|
2813
|
<input onclick="gd_imex_PrepareImport(this, 'cat')" type="button" value="<?php echo CSV_IMPORT_DATA; ?>" id="gd_import_data" class="button-primary" />
|
|
2814
|
|
- <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"/>
|
|
2815
|
|
- <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')"/>
|
|
|
2814
|
+ <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"/>
|
|
|
2815
|
+ <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')"/>
|
|
2816
|
2816
|
<div id="gd_process_data" style="display:none">
|
|
2817
|
|
- <span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory');?>
|
|
|
2817
|
+ <span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory'); ?>
|
|
2818
|
2818
|
</div>
|
|
2819
|
2819
|
</div>
|
|
2820
|
2820
|
</td>
|
|
@@ -2828,26 +2828,26 @@ discard block |
|
|
block discarded – undo |
|
2828
|
2828
|
<div id="gd_ie_excategs" class="metabox-holder">
|
|
2829
|
2829
|
<div class="meta-box-sortables ui-sortable">
|
|
2830
|
2830
|
<div id="gd_ie_ex_cats" class="postbox gd-hndle-pbox">
|
|
2831
|
|
- <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>
|
|
2832
|
|
- <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Categories: Export CSV', 'geodirectory' );?></span></h3>
|
|
|
2831
|
+ <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>
|
|
|
2832
|
+ <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Categories: Export CSV', 'geodirectory'); ?></span></h3>
|
|
2833
|
2833
|
<div class="inside">
|
|
2834
|
2834
|
<table class="form-table">
|
|
2835
|
2835
|
<tbody>
|
|
2836
|
2836
|
<tr>
|
|
2837
|
|
- <td class="fld"><label for="gd_post_type"><?php _e( 'Post Type:', 'geodirectory' );?></label></td>
|
|
2838
|
|
- <td><select name="gd_post_type" id="gd_post_type" style="min-width:140px"><?php echo $gd_posttypes_option;?></select></td>
|
|
|
2837
|
+ <td class="fld"><label for="gd_post_type"><?php _e('Post Type:', 'geodirectory'); ?></label></td>
|
|
|
2838
|
+ <td><select name="gd_post_type" id="gd_post_type" style="min-width:140px"><?php echo $gd_posttypes_option; ?></select></td>
|
|
2839
|
2839
|
</tr>
|
|
2840
|
2840
|
<tr>
|
|
2841
|
|
- <td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e( 'Max entries per csv file:', 'geodirectory' );?></label></td>
|
|
2842
|
|
- <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>
|
|
|
2841
|
+ <td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e('Max entries per csv file:', 'geodirectory'); ?></label></td>
|
|
|
2842
|
+ <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>
|
|
2843
|
2843
|
</tr>
|
|
2844
|
2844
|
<tr>
|
|
2845
|
|
- <td class="fld" style="vertical-align:top"><label><?php _e( 'Progress:', 'geodirectory' );?></label></td>
|
|
2846
|
|
- <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> <p id="gd_timer" class="gd_timer">00:00:00</p></td>
|
|
|
2845
|
+ <td class="fld" style="vertical-align:top"><label><?php _e('Progress:', 'geodirectory'); ?></label></td>
|
|
|
2846
|
+ <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> <p id="gd_timer" class="gd_timer">00:00:00</p></td>
|
|
2847
|
2847
|
</tr>
|
|
2848
|
2848
|
<tr class="gd-ie-actions">
|
|
2849
|
2849
|
<td style="vertical-align:top">
|
|
2850
|
|
- <input type="submit" value="<?php echo esc_attr( __( 'Export CSV', 'geodirectory' ) );?>" class="button-primary" name="gd_ie_excats_submit" id="gd_ie_excats_submit">
|
|
|
2850
|
+ <input type="submit" value="<?php echo esc_attr(__('Export CSV', 'geodirectory')); ?>" class="button-primary" name="gd_ie_excats_submit" id="gd_ie_excats_submit">
|
|
2851
|
2851
|
</td>
|
|
2852
|
2852
|
<td id="gd_ie_ex_files" class="gd-ie-files"></td>
|
|
2853
|
2853
|
</tr>
|
|
@@ -2869,7 +2869,7 @@ discard block |
|
|
block discarded – undo |
|
2869
|
2869
|
* @param array $gd_chunksize_options File chunk size options.
|
|
2870
|
2870
|
* @param string $nonce Wordpress security token for GD import & export.
|
|
2871
|
2871
|
*/
|
|
2872
|
|
- do_action( 'geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce );
|
|
|
2872
|
+ do_action('geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce);
|
|
2873
|
2873
|
?>
|
|
2874
|
2874
|
</div>
|
|
2875
|
2875
|
</div>
|
|
@@ -2888,7 +2888,7 @@ discard block |
|
|
block discarded – undo |
|
2888
|
2888
|
jQuery.ajax({
|
|
2889
|
2889
|
url: ajaxurl,
|
|
2890
|
2890
|
type: "POST",
|
|
2891
|
|
- data: 'action=geodir_import_export&task=prepare_import&_pt=' + type + '&_file=' + uploadedFile + '&_nonce=<?php echo $nonce;?>',
|
|
|
2891
|
+ data: 'action=geodir_import_export&task=prepare_import&_pt=' + type + '&_file=' + uploadedFile + '&_nonce=<?php echo $nonce; ?>',
|
|
2892
|
2892
|
dataType: 'json',
|
|
2893
|
2893
|
cache: false,
|
|
2894
|
2894
|
success: function(data) {
|
|
@@ -2940,7 +2940,7 @@ discard block |
|
|
block discarded – undo |
|
2940
|
2940
|
|
|
2941
|
2941
|
jQuery(cont).find('.filelist .file').remove();
|
|
2942
|
2942
|
|
|
2943
|
|
- jQuery('#gd-import-msg', cont).find('#message').removeClass('updated').addClass('error').html("<p><?php echo esc_attr( PLZ_SELECT_CSV_FILE );?></p>");
|
|
|
2943
|
+ jQuery('#gd-import-msg', cont).find('#message').removeClass('updated').addClass('error').html("<p><?php echo esc_attr(PLZ_SELECT_CSV_FILE); ?></p>");
|
|
2944
|
2944
|
jQuery('#gd-import-msg', cont).show();
|
|
2945
|
2945
|
|
|
2946
|
2946
|
return false;
|
|
@@ -2999,7 +2999,7 @@ discard block |
|
|
block discarded – undo |
|
2999
|
2999
|
jQuery.ajax({
|
|
3000
|
3000
|
url: ajaxurl,
|
|
3001
|
3001
|
type: "POST",
|
|
3002
|
|
- data: 'action=geodir_import_export&task=import_' + type + '&_pt=' + type + '&_file=' + uploadedFile + gddata + '&_ch=' + choice + '&_nonce=<?php echo $nonce;?>',
|
|
|
3002
|
+ data: 'action=geodir_import_export&task=import_' + type + '&_pt=' + type + '&_file=' + uploadedFile + gddata + '&_ch=' + choice + '&_nonce=<?php echo $nonce; ?>',
|
|
3003
|
3003
|
dataType : 'json',
|
|
3004
|
3004
|
cache: false,
|
|
3005
|
3005
|
success: function (data) {
|
|
@@ -3188,27 +3188,27 @@ discard block |
|
|
block discarded – undo |
|
3188
|
3188
|
|
|
3189
|
3189
|
var gdMsg = '<p></p>';
|
|
3190
|
3190
|
if ( processed > 0 ) {
|
|
3191
|
|
- var msgParse = '<p><?php echo addslashes( sprintf( __( 'Total %s item(s) found.', 'geodirectory' ), '%s' ) );?></p>';
|
|
|
3191
|
+ var msgParse = '<p><?php echo addslashes(sprintf(__('Total %s item(s) found.', 'geodirectory'), '%s')); ?></p>';
|
|
3192
|
3192
|
msgParse = msgParse.replace("%s", processed);
|
|
3193
|
3193
|
gdMsg += msgParse;
|
|
3194
|
3194
|
}
|
|
3195
|
3195
|
|
|
3196
|
3196
|
if ( updated > 0 ) {
|
|
3197
|
|
- var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) updated.', 'geodirectory' ), '%s', '%d' ) );?></p>';
|
|
|
3197
|
+ var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) updated.', 'geodirectory'), '%s', '%d')); ?></p>';
|
|
3198
|
3198
|
msgParse = msgParse.replace("%s", updated);
|
|
3199
|
3199
|
msgParse = msgParse.replace("%d", processed);
|
|
3200
|
3200
|
gdMsg += msgParse;
|
|
3201
|
3201
|
}
|
|
3202
|
3202
|
|
|
3203
|
3203
|
if ( created > 0 ) {
|
|
3204
|
|
- var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) added.', 'geodirectory' ), '%s', '%d' ) );?></p>';
|
|
|
3204
|
+ var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) added.', 'geodirectory'), '%s', '%d')); ?></p>';
|
|
3205
|
3205
|
msgParse = msgParse.replace("%s", created);
|
|
3206
|
3206
|
msgParse = msgParse.replace("%d", processed);
|
|
3207
|
3207
|
gdMsg += msgParse;
|
|
3208
|
3208
|
}
|
|
3209
|
3209
|
|
|
3210
|
3210
|
if ( skipped > 0 ) {
|
|
3211
|
|
- var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) ignored due to already exists.', 'geodirectory' ), '%s', '%d' ) );?></p>';
|
|
|
3211
|
+ var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) ignored due to already exists.', 'geodirectory'), '%s', '%d')); ?></p>';
|
|
3212
|
3212
|
msgParse = msgParse.replace("%s", skipped);
|
|
3213
|
3213
|
msgParse = msgParse.replace("%d", processed);
|
|
3214
|
3214
|
gdMsg += msgParse;
|
|
@@ -3218,17 +3218,17 @@ discard block |
|
|
block discarded – undo |
|
3218
|
3218
|
if (type=='loc') {
|
|
3219
|
3219
|
invalid_addr = invalid;
|
|
3220
|
3220
|
}
|
|
3221
|
|
- 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>';
|
|
|
3221
|
+ 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>';
|
|
3222
|
3222
|
msgParse = msgParse.replace("%s", invalid_addr);
|
|
3223
|
3223
|
msgParse = msgParse.replace("%d", total);
|
|
3224
|
3224
|
gdMsg += msgParse;
|
|
3225
|
3225
|
}
|
|
3226
|
3226
|
|
|
3227
|
3227
|
if (invalid > 0 && type!='loc') {
|
|
3228
|
|
- 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>';
|
|
|
3228
|
+ 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>';
|
|
3229
|
3229
|
|
|
3230
|
3230
|
if (type=='hood') {
|
|
3231
|
|
- 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>';
|
|
|
3231
|
+ 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>';
|
|
3232
|
3232
|
}
|
|
3233
|
3233
|
msgParse = msgParse.replace("%s", invalid);
|
|
3234
|
3234
|
msgParse = msgParse.replace("%d", total);
|
|
@@ -3236,7 +3236,7 @@ discard block |
|
|
block discarded – undo |
|
3236
|
3236
|
}
|
|
3237
|
3237
|
|
|
3238
|
3238
|
if (images > 0) {
|
|
3239
|
|
- gdMsg += '<p><?php echo addslashes( sprintf( CSV_TRANSFER_IMG_FOLDER, $uploads['subdir'] ) );?></p>';
|
|
|
3239
|
+ gdMsg += '<p><?php echo addslashes(sprintf(CSV_TRANSFER_IMG_FOLDER, $uploads['subdir'])); ?></p>';
|
|
3240
|
3240
|
}
|
|
3241
|
3241
|
gdMsg += '<p></p>';
|
|
3242
|
3242
|
jQuery('#gd-import-msg', cont).find('#message').removeClass('error').addClass('updated').html(gdMsg);
|
|
@@ -3400,9 +3400,9 @@ discard block |
|
|
block discarded – undo |
|
3400
|
3400
|
if (typeof filters !== 'undefined' && filters && doFilter) {
|
|
3401
|
3401
|
getTotal = true;
|
|
3402
|
3402
|
attach += '&_c=1';
|
|
3403
|
|
- gd_progressbar(el, 0, '<i class="fa fa-refresh fa-spin"></i><?php echo esc_attr( __( 'Preparing...', 'geodirectory' ) );?>');
|
|
|
3403
|
+ gd_progressbar(el, 0, '<i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Preparing...', 'geodirectory')); ?>');
|
|
3404
|
3404
|
} else {
|
|
3405
|
|
- gd_progressbar(el, 0, '0% (0 / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>');
|
|
|
3405
|
+ gd_progressbar(el, 0, '0% (0 / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>');
|
|
3406
|
3406
|
}
|
|
3407
|
3407
|
jQuery(el).find('#gd_timer').text('00:00:01');
|
|
3408
|
3408
|
jQuery('#gd_ie_ex_files', el).html('');
|
|
@@ -3411,7 +3411,7 @@ discard block |
|
|
block discarded – undo |
|
3411
|
3411
|
jQuery.ajax({
|
|
3412
|
3412
|
url: ajaxurl,
|
|
3413
|
3413
|
type: "POST",
|
|
3414
|
|
- data: 'action=geodir_import_export&task=export_posts&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce;?>&_p=' + page + attach,
|
|
|
3414
|
+ data: 'action=geodir_import_export&task=export_posts&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce; ?>&_p=' + page + attach,
|
|
3415
|
3415
|
dataType : 'json',
|
|
3416
|
3416
|
cache: false,
|
|
3417
|
3417
|
beforeSend: function (jqXHR, settings) {},
|
|
@@ -3436,11 +3436,11 @@ discard block |
|
|
block discarded – undo |
|
3436
|
3436
|
} else {
|
|
3437
|
3437
|
if (pages < page || pages == page) {
|
|
3438
|
3438
|
window.clearInterval(timer_posts);
|
|
3439
|
|
- gd_progressbar(el, 100, '100% (' + total_posts + ' / ' + total_posts + ') <i class="fa fa-check"></i><?php echo esc_attr( __( 'Complete!', 'geodirectory' ) );?>');
|
|
|
3439
|
+ gd_progressbar(el, 100, '100% (' + total_posts + ' / ' + total_posts + ') <i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirectory')); ?>');
|
|
3440
|
3440
|
} else {
|
|
3441
|
3441
|
var percentage = Math.round(((page * chunk_size) / total_posts) * 100);
|
|
3442
|
3442
|
percentage = percentage > 100 ? 100 : percentage;
|
|
3443
|
|
- gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>');
|
|
|
3443
|
+ gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>');
|
|
3444
|
3444
|
}
|
|
3445
|
3445
|
if (typeof data.files != 'undefined' && jQuery(data.files).length ) {
|
|
3446
|
3446
|
var obj_files = data.files;
|
|
@@ -3471,7 +3471,7 @@ discard block |
|
|
block discarded – undo |
|
3471
|
3471
|
|
|
3472
|
3472
|
function gd_process_export_cats(el, post_type, total_cats, chunk_size, pages, page) {
|
|
3473
|
3473
|
if (page < 2) {
|
|
3474
|
|
- gd_progressbar(el, 0, '0% (0 / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>');
|
|
|
3474
|
+ gd_progressbar(el, 0, '0% (0 / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>');
|
|
3475
|
3475
|
jQuery(el).find('#gd_timer').text('00:00:01');
|
|
3476
|
3476
|
jQuery('#gd_ie_ex_files', el).html('');
|
|
3477
|
3477
|
}
|
|
@@ -3479,7 +3479,7 @@ discard block |
|
|
block discarded – undo |
|
3479
|
3479
|
jQuery.ajax({
|
|
3480
|
3480
|
url: ajaxurl,
|
|
3481
|
3481
|
type: "POST",
|
|
3482
|
|
- data: 'action=geodir_import_export&task=export_cats&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce;?>&_p=' + page,
|
|
|
3482
|
+ data: 'action=geodir_import_export&task=export_cats&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce; ?>&_p=' + page,
|
|
3483
|
3483
|
dataType : 'json',
|
|
3484
|
3484
|
cache: false,
|
|
3485
|
3485
|
beforeSend: function (jqXHR, settings) {},
|
|
@@ -3493,11 +3493,11 @@ discard block |
|
|
block discarded – undo |
|
3493
|
3493
|
} else {
|
|
3494
|
3494
|
if (pages < page || pages == page) {
|
|
3495
|
3495
|
window.clearInterval(timer_cats);
|
|
3496
|
|
- gd_progressbar(el, 100, '100% (' + total_cats + ' / ' + total_cats + ') <i class="fa fa-check"></i><?php echo esc_attr( __( 'Complete!', 'geodirectory' ) );?>');
|
|
|
3496
|
+ gd_progressbar(el, 100, '100% (' + total_cats + ' / ' + total_cats + ') <i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirectory')); ?>');
|
|
3497
|
3497
|
} else {
|
|
3498
|
3498
|
var percentage = Math.round(((page * chunk_size) / total_cats) * 100);
|
|
3499
|
3499
|
percentage = percentage > 100 ? 100 : percentage;
|
|
3500
|
|
- gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php esc_attr_e( 'Exporting...', 'geodirectory' );?>');
|
|
|
3500
|
+ gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php esc_attr_e('Exporting...', 'geodirectory'); ?>');
|
|
3501
|
3501
|
}
|
|
3502
|
3502
|
if (typeof data.files != 'undefined' && jQuery(data.files).length ) {
|
|
3503
|
3503
|
var obj_files = data.files;
|
|
@@ -3554,13 +3554,13 @@ discard block |
|
|
block discarded – undo |
|
3554
|
3554
|
function geodir_init_filesystem()
|
|
3555
|
3555
|
{
|
|
3556
|
3556
|
|
|
3557
|
|
- if(!function_exists('get_filesystem_method')){
|
|
|
3557
|
+ if (!function_exists('get_filesystem_method')) {
|
|
3558
|
3558
|
require_once(ABSPATH."/wp-admin/includes/file.php");
|
|
3559
|
3559
|
}
|
|
3560
|
3560
|
$access_type = get_filesystem_method();
|
|
3561
|
3561
|
if ($access_type === 'direct') {
|
|
3562
|
3562
|
/* you can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */
|
|
3563
|
|
- $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
|
|
|
3563
|
+ $creds = request_filesystem_credentials(trailingslashit(site_url()).'wp-admin/', '', false, false, array());
|
|
3564
|
3564
|
|
|
3565
|
3565
|
/* initialize the API */
|
|
3566
|
3566
|
if (!WP_Filesystem($creds)) {
|
|
@@ -3573,7 +3573,7 @@ discard block |
|
|
block discarded – undo |
|
3573
|
3573
|
return $wp_filesystem;
|
|
3574
|
3574
|
/* do our file manipulations below */
|
|
3575
|
3575
|
} elseif (defined('FTP_USER')) {
|
|
3576
|
|
- $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
|
|
|
3576
|
+ $creds = request_filesystem_credentials(trailingslashit(site_url()).'wp-admin/', '', false, false, array());
|
|
3577
|
3577
|
|
|
3578
|
3578
|
/* initialize the API */
|
|
3579
|
3579
|
if (!WP_Filesystem($creds)) {
|
|
@@ -3608,7 +3608,7 @@ discard block |
|
|
block discarded – undo |
|
3608
|
3608
|
* @package GeoDirectory
|
|
3609
|
3609
|
*/
|
|
3610
|
3610
|
function geodir_filesystem_notice()
|
|
3611
|
|
-{ if ( defined( 'DOING_AJAX' ) ){return;}
|
|
|
3611
|
+{ if (defined('DOING_AJAX')) {return; }
|
|
3612
|
3612
|
$access_type = get_filesystem_method();
|
|
3613
|
3613
|
if ($access_type === 'direct') {
|
|
3614
|
3614
|
} elseif (!defined('FTP_USER')) {
|
|
@@ -3645,64 +3645,64 @@ discard block |
|
|
block discarded – undo |
|
3645
|
3645
|
// try to set higher limits for import
|
|
3646
|
3646
|
$max_input_time = ini_get('max_input_time');
|
|
3647
|
3647
|
$max_execution_time = ini_get('max_execution_time');
|
|
3648
|
|
- $memory_limit= ini_get('memory_limit');
|
|
|
3648
|
+ $memory_limit = ini_get('memory_limit');
|
|
3649
|
3649
|
|
|
3650
|
|
- if(!$max_input_time || $max_input_time<3000){
|
|
|
3650
|
+ if (!$max_input_time || $max_input_time < 3000) {
|
|
3651
|
3651
|
ini_set('max_input_time', 3000);
|
|
3652
|
3652
|
}
|
|
3653
|
3653
|
|
|
3654
|
|
- if(!$max_execution_time || $max_execution_time<3000){
|
|
|
3654
|
+ if (!$max_execution_time || $max_execution_time < 3000) {
|
|
3655
|
3655
|
ini_set('max_execution_time', 3000);
|
|
3656
|
3656
|
}
|
|
3657
|
3657
|
|
|
3658
|
|
- if($memory_limit && str_replace('M','',$memory_limit)){
|
|
3659
|
|
- if(str_replace('M','',$memory_limit)<256){
|
|
|
3658
|
+ if ($memory_limit && str_replace('M', '', $memory_limit)) {
|
|
|
3659
|
+ if (str_replace('M', '', $memory_limit) < 256) {
|
|
3660
|
3660
|
ini_set('memory_limit', '256M');
|
|
3661
|
3661
|
}
|
|
3662
|
3662
|
}
|
|
3663
|
3663
|
|
|
3664
|
3664
|
$json = array();
|
|
3665
|
3665
|
|
|
3666
|
|
- if ( !current_user_can( 'manage_options' ) ) {
|
|
3667
|
|
- wp_send_json( $json );
|
|
|
3666
|
+ if (!current_user_can('manage_options')) {
|
|
|
3667
|
+ wp_send_json($json);
|
|
3668
|
3668
|
}
|
|
3669
|
3669
|
|
|
3670
|
|
- $task = isset( $_REQUEST['task'] ) ? $_REQUEST['task'] : NULL;
|
|
3671
|
|
- $nonce = isset( $_REQUEST['_nonce'] ) ? $_REQUEST['_nonce'] : NULL;
|
|
3672
|
|
- $stat = isset( $_REQUEST['_st'] ) ? $_REQUEST['_st'] : false;
|
|
|
3670
|
+ $task = isset($_REQUEST['task']) ? $_REQUEST['task'] : NULL;
|
|
|
3671
|
+ $nonce = isset($_REQUEST['_nonce']) ? $_REQUEST['_nonce'] : NULL;
|
|
|
3672
|
+ $stat = isset($_REQUEST['_st']) ? $_REQUEST['_st'] : false;
|
|
3673
|
3673
|
|
|
3674
|
|
- if ( !wp_verify_nonce( $nonce, 'geodir_import_export_nonce' ) ) {
|
|
3675
|
|
- wp_send_json( $json );
|
|
|
3674
|
+ if (!wp_verify_nonce($nonce, 'geodir_import_export_nonce')) {
|
|
|
3675
|
+ wp_send_json($json);
|
|
3676
|
3676
|
}
|
|
3677
|
3677
|
|
|
3678
|
|
- $post_type = isset( $_REQUEST['_pt'] ) ? $_REQUEST['_pt'] : NULL;
|
|
3679
|
|
- $chunk_per_page = isset( $_REQUEST['_n'] ) ? absint($_REQUEST['_n']) : NULL;
|
|
|
3678
|
+ $post_type = isset($_REQUEST['_pt']) ? $_REQUEST['_pt'] : NULL;
|
|
|
3679
|
+ $chunk_per_page = isset($_REQUEST['_n']) ? absint($_REQUEST['_n']) : NULL;
|
|
3680
|
3680
|
$chunk_per_page = $chunk_per_page < 50 || $chunk_per_page > 100000 ? 5000 : $chunk_per_page;
|
|
3681
|
|
- $chunk_page_no = isset( $_REQUEST['_p'] ) ? absint($_REQUEST['_p']) : 1;
|
|
|
3681
|
+ $chunk_page_no = isset($_REQUEST['_p']) ? absint($_REQUEST['_p']) : 1;
|
|
3682
|
3682
|
|
|
3683
|
3683
|
$wp_filesystem = geodir_init_filesystem();
|
|
3684
|
3684
|
if (!$wp_filesystem) {
|
|
3685
|
|
- $json['error'] = __( 'Filesystem ERROR: Could not access filesystem.', 'geodirectory' );
|
|
3686
|
|
- wp_send_json( $json );
|
|
|
3685
|
+ $json['error'] = __('Filesystem ERROR: Could not access filesystem.', 'geodirectory');
|
|
|
3686
|
+ wp_send_json($json);
|
|
3687
|
3687
|
}
|
|
3688
|
3688
|
|
|
3689
|
3689
|
if (!empty($wp_filesystem) && isset($wp_filesystem->errors) && is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
|
|
3690
|
|
- $json['error'] = __( 'Filesystem ERROR: ' . $wp_filesystem->errors->get_error_message(), 'geodirectory' );
|
|
3691
|
|
- wp_send_json( $json );
|
|
|
3690
|
+ $json['error'] = __('Filesystem ERROR: '.$wp_filesystem->errors->get_error_message(), 'geodirectory');
|
|
|
3691
|
+ wp_send_json($json);
|
|
3692
|
3692
|
}
|
|
3693
|
3693
|
|
|
3694
|
|
- $csv_file_dir = geodir_path_import_export( false );
|
|
3695
|
|
- if ( !$wp_filesystem->is_dir( $csv_file_dir ) ) {
|
|
3696
|
|
- if ( !$wp_filesystem->mkdir( $csv_file_dir, FS_CHMOD_DIR ) ) {
|
|
3697
|
|
- $json['error'] = __( 'ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory' );
|
|
3698
|
|
- wp_send_json( $json );
|
|
|
3694
|
+ $csv_file_dir = geodir_path_import_export(false);
|
|
|
3695
|
+ if (!$wp_filesystem->is_dir($csv_file_dir)) {
|
|
|
3696
|
+ if (!$wp_filesystem->mkdir($csv_file_dir, FS_CHMOD_DIR)) {
|
|
|
3697
|
+ $json['error'] = __('ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory');
|
|
|
3698
|
+ wp_send_json($json);
|
|
3699
|
3699
|
}
|
|
3700
|
3700
|
}
|
|
3701
|
3701
|
|
|
3702
|
3702
|
$location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
|
|
3703
|
3703
|
$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
|
|
3704
|
3704
|
|
|
3705
|
|
- switch ( $task ) {
|
|
|
3705
|
+ switch ($task) {
|
|
3706
|
3706
|
case 'export_posts': {
|
|
3707
|
3707
|
// WPML
|
|
3708
|
3708
|
$is_wpml = geodir_is_wpml();
|
|
@@ -3713,36 +3713,36 @@ discard block |
|
|
block discarded – undo |
|
3713
|
3713
|
$sitepress->switch_lang('all', true);
|
|
3714
|
3714
|
}
|
|
3715
|
3715
|
// WPML
|
|
3716
|
|
- if ( $post_type == 'gd_event' ) {
|
|
3717
|
|
- add_filter( 'geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2 );
|
|
|
3716
|
+ if ($post_type == 'gd_event') {
|
|
|
3717
|
+ add_filter('geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2);
|
|
3718
|
3718
|
}
|
|
3719
|
|
- $filters = !empty( $_REQUEST['gd_imex'] ) && is_array( $_REQUEST['gd_imex'] ) ? $_REQUEST['gd_imex'] : NULL;
|
|
|
3719
|
+ $filters = !empty($_REQUEST['gd_imex']) && is_array($_REQUEST['gd_imex']) ? $_REQUEST['gd_imex'] : NULL;
|
|
3720
|
3720
|
|
|
3721
|
|
- $file_name = $post_type . '_' . date( 'dmyHi' );
|
|
3722
|
|
- if ( $filters && isset( $filters['start_date'] ) && isset( $filters['end_date'] ) ) {
|
|
3723
|
|
- $file_name = $post_type . '_' . date_i18n( 'dmy', strtotime( $filters['start_date'] ) ) . '_' . date_i18n( 'dmy', strtotime( $filters['end_date'] ) );
|
|
|
3721
|
+ $file_name = $post_type.'_'.date('dmyHi');
|
|
|
3722
|
+ if ($filters && isset($filters['start_date']) && isset($filters['end_date'])) {
|
|
|
3723
|
+ $file_name = $post_type.'_'.date_i18n('dmy', strtotime($filters['start_date'])).'_'.date_i18n('dmy', strtotime($filters['end_date']));
|
|
3724
|
3724
|
}
|
|
3725
|
|
- $posts_count = geodir_get_posts_count( $post_type );
|
|
3726
|
|
- $file_url_base = geodir_path_import_export() . '/';
|
|
3727
|
|
- $file_url = $file_url_base . $file_name . '.csv';
|
|
3728
|
|
- $file_path = $csv_file_dir . '/' . $file_name . '.csv';
|
|
3729
|
|
- $file_path_temp = $csv_file_dir . '/' . $post_type . '_' . $nonce . '.csv';
|
|
|
3725
|
+ $posts_count = geodir_get_posts_count($post_type);
|
|
|
3726
|
+ $file_url_base = geodir_path_import_export().'/';
|
|
|
3727
|
+ $file_url = $file_url_base.$file_name.'.csv';
|
|
|
3728
|
+ $file_path = $csv_file_dir.'/'.$file_name.'.csv';
|
|
|
3729
|
+ $file_path_temp = $csv_file_dir.'/'.$post_type.'_'.$nonce.'.csv';
|
|
3730
|
3730
|
|
|
3731
|
3731
|
$chunk_file_paths = array();
|
|
3732
|
3732
|
|
|
3733
|
|
- if ( isset( $_REQUEST['_c'] ) ) {
|
|
|
3733
|
+ if (isset($_REQUEST['_c'])) {
|
|
3734
|
3734
|
$json['total'] = $posts_count;
|
|
3735
|
3735
|
// WPML
|
|
3736
|
3736
|
if ($is_wpml) {
|
|
3737
|
3737
|
$sitepress->switch_lang($active_lang, true);
|
|
3738
|
3738
|
}
|
|
3739
|
3739
|
// WPML
|
|
3740
|
|
- wp_send_json( $json );
|
|
|
3740
|
+ wp_send_json($json);
|
|
3741
|
3741
|
gd_die();
|
|
3742
|
|
- } else if ( isset( $_REQUEST['_st'] ) ) {
|
|
3743
|
|
- $line_count = (int)geodir_import_export_line_count( $file_path_temp );
|
|
3744
|
|
- $percentage = count( $posts_count ) > 0 && $line_count > 0 ? ceil( $line_count / $posts_count ) * 100 : 0;
|
|
3745
|
|
- $percentage = min( $percentage, 100 );
|
|
|
3742
|
+ } else if (isset($_REQUEST['_st'])) {
|
|
|
3743
|
+ $line_count = (int) geodir_import_export_line_count($file_path_temp);
|
|
|
3744
|
+ $percentage = count($posts_count) > 0 && $line_count > 0 ? ceil($line_count / $posts_count) * 100 : 0;
|
|
|
3745
|
+ $percentage = min($percentage, 100);
|
|
3746
|
3746
|
|
|
3747
|
3747
|
$json['percentage'] = $percentage;
|
|
3748
|
3748
|
// WPML
|
|
@@ -3750,45 +3750,45 @@ discard block |
|
|
block discarded – undo |
|
3750
|
3750
|
$sitepress->switch_lang($active_lang, true);
|
|
3751
|
3751
|
}
|
|
3752
|
3752
|
// WPML
|
|
3753
|
|
- wp_send_json( $json );
|
|
|
3753
|
+ wp_send_json($json);
|
|
3754
|
3754
|
gd_die();
|
|
3755
|
3755
|
} else {
|
|
3756
|
|
- if ( !$posts_count > 0 ) {
|
|
3757
|
|
- $json['error'] = __( 'No records to export.', 'geodirectory' );
|
|
|
3756
|
+ if (!$posts_count > 0) {
|
|
|
3757
|
+ $json['error'] = __('No records to export.', 'geodirectory');
|
|
3758
|
3758
|
} else {
|
|
3759
|
3759
|
$total_posts = $posts_count;
|
|
3760
|
3760
|
if ($chunk_per_page > $total_posts) {
|
|
3761
|
3761
|
$chunk_per_page = $total_posts;
|
|
3762
|
3762
|
}
|
|
3763
|
|
- $chunk_total_pages = ceil( $total_posts / $chunk_per_page );
|
|
|
3763
|
+ $chunk_total_pages = ceil($total_posts / $chunk_per_page);
|
|
3764
|
3764
|
|
|
3765
|
3765
|
$j = $chunk_page_no;
|
|
3766
|
|
- $chunk_save_posts = geodir_imex_get_posts( $post_type, $chunk_per_page, $j );
|
|
|
3766
|
+ $chunk_save_posts = geodir_imex_get_posts($post_type, $chunk_per_page, $j);
|
|
3767
|
3767
|
|
|
3768
|
3768
|
$per_page = 500;
|
|
3769
|
3769
|
if ($per_page > $chunk_per_page) {
|
|
3770
|
3770
|
$per_page = $chunk_per_page;
|
|
3771
|
3771
|
}
|
|
3772
|
|
- $total_pages = ceil( $chunk_per_page / $per_page );
|
|
|
3772
|
+ $total_pages = ceil($chunk_per_page / $per_page);
|
|
3773
|
3773
|
|
|
3774
|
|
- for ( $i = 0; $i <= $total_pages; $i++ ) {
|
|
3775
|
|
- $save_posts = array_slice( $chunk_save_posts , ( $i * $per_page ), $per_page );
|
|
|
3774
|
+ for ($i = 0; $i <= $total_pages; $i++) {
|
|
|
3775
|
+ $save_posts = array_slice($chunk_save_posts, ($i * $per_page), $per_page);
|
|
3776
|
3776
|
|
|
3777
|
3777
|
$clear = $i == 0 ? true : false;
|
|
3778
|
|
- geodir_save_csv_data( $file_path_temp, $save_posts, $clear );
|
|
|
3778
|
+ geodir_save_csv_data($file_path_temp, $save_posts, $clear);
|
|
3779
|
3779
|
}
|
|
3780
|
3780
|
|
|
3781
|
|
- if ( $wp_filesystem->exists( $file_path_temp ) ) {
|
|
3782
|
|
- $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
|
|
3783
|
|
- $chunk_file_name = $file_name . $chunk_page_no . '.csv';
|
|
3784
|
|
- $file_path = $csv_file_dir . '/' . $chunk_file_name;
|
|
3785
|
|
- $wp_filesystem->move( $file_path_temp, $file_path, true );
|
|
|
3781
|
+ if ($wp_filesystem->exists($file_path_temp)) {
|
|
|
3782
|
+ $chunk_page_no = $chunk_total_pages > 1 ? '-'.$j : '';
|
|
|
3783
|
+ $chunk_file_name = $file_name.$chunk_page_no.'.csv';
|
|
|
3784
|
+ $file_path = $csv_file_dir.'/'.$chunk_file_name;
|
|
|
3785
|
+ $wp_filesystem->move($file_path_temp, $file_path, true);
|
|
3786
|
3786
|
|
|
3787
|
|
- $file_url = $file_url_base . $chunk_file_name;
|
|
3788
|
|
- $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
|
3787
|
+ $file_url = $file_url_base.$chunk_file_name;
|
|
|
3788
|
+ $chunk_file_paths[] = array('i' => $j.'.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
3789
|
3789
|
}
|
|
3790
|
3790
|
|
|
3791
|
|
- if ( !empty($chunk_file_paths) ) {
|
|
|
3791
|
+ if (!empty($chunk_file_paths)) {
|
|
3792
|
3792
|
$json['total'] = $posts_count;
|
|
3793
|
3793
|
$json['files'] = $chunk_file_paths;
|
|
3794
|
3794
|
} else {
|
|
@@ -3796,7 +3796,7 @@ discard block |
|
|
block discarded – undo |
|
3796
|
3796
|
$json['total'] = $posts_count;
|
|
3797
|
3797
|
$json['files'] = array();
|
|
3798
|
3798
|
} else {
|
|
3799
|
|
- $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
|
|
|
3799
|
+ $json['error'] = __('ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory');
|
|
3800
|
3800
|
}
|
|
3801
|
3801
|
}
|
|
3802
|
3802
|
}
|
|
@@ -3805,7 +3805,7 @@ discard block |
|
|
block discarded – undo |
|
3805
|
3805
|
$sitepress->switch_lang($active_lang, true);
|
|
3806
|
3806
|
}
|
|
3807
|
3807
|
// WPML
|
|
3808
|
|
- wp_send_json( $json );
|
|
|
3808
|
+ wp_send_json($json);
|
|
3809
|
3809
|
}
|
|
3810
|
3810
|
}
|
|
3811
|
3811
|
break;
|
|
@@ -3819,20 +3819,20 @@ discard block |
|
|
block discarded – undo |
|
3819
|
3819
|
$sitepress->switch_lang('all', true);
|
|
3820
|
3820
|
}
|
|
3821
|
3821
|
// WPML
|
|
3822
|
|
- $file_name = $post_type . 'category_' . date( 'dmyHi' );
|
|
|
3822
|
+ $file_name = $post_type.'category_'.date('dmyHi');
|
|
3823
|
3823
|
|
|
3824
|
|
- $terms_count = geodir_get_terms_count( $post_type );
|
|
3825
|
|
- $file_url_base = geodir_path_import_export() . '/';
|
|
3826
|
|
- $file_url = $file_url_base . $file_name . '.csv';
|
|
3827
|
|
- $file_path = $csv_file_dir . '/' . $file_name . '.csv';
|
|
3828
|
|
- $file_path_temp = $csv_file_dir . '/' . $post_type . 'category_' . $nonce . '.csv';
|
|
|
3824
|
+ $terms_count = geodir_get_terms_count($post_type);
|
|
|
3825
|
+ $file_url_base = geodir_path_import_export().'/';
|
|
|
3826
|
+ $file_url = $file_url_base.$file_name.'.csv';
|
|
|
3827
|
+ $file_path = $csv_file_dir.'/'.$file_name.'.csv';
|
|
|
3828
|
+ $file_path_temp = $csv_file_dir.'/'.$post_type.'category_'.$nonce.'.csv';
|
|
3829
|
3829
|
|
|
3830
|
3830
|
$chunk_file_paths = array();
|
|
3831
|
3831
|
|
|
3832
|
|
- if ( isset( $_REQUEST['_st'] ) ) {
|
|
3833
|
|
- $line_count = (int)geodir_import_export_line_count( $file_path_temp );
|
|
3834
|
|
- $percentage = count( $terms_count ) > 0 && $line_count > 0 ? ceil( $line_count / $terms_count ) * 100 : 0;
|
|
3835
|
|
- $percentage = min( $percentage, 100 );
|
|
|
3832
|
+ if (isset($_REQUEST['_st'])) {
|
|
|
3833
|
+ $line_count = (int) geodir_import_export_line_count($file_path_temp);
|
|
|
3834
|
+ $percentage = count($terms_count) > 0 && $line_count > 0 ? ceil($line_count / $terms_count) * 100 : 0;
|
|
|
3835
|
+ $percentage = min($percentage, 100);
|
|
3836
|
3836
|
|
|
3837
|
3837
|
$json['percentage'] = $percentage;
|
|
3838
|
3838
|
// WPML
|
|
@@ -3840,48 +3840,48 @@ discard block |
|
|
block discarded – undo |
|
3840
|
3840
|
$sitepress->switch_lang($active_lang, true);
|
|
3841
|
3841
|
}
|
|
3842
|
3842
|
// WPML
|
|
3843
|
|
- wp_send_json( $json );
|
|
|
3843
|
+ wp_send_json($json);
|
|
3844
|
3844
|
} else {
|
|
3845
|
|
- if ( !$terms_count > 0 ) {
|
|
3846
|
|
- $json['error'] = __( 'No records to export.', 'geodirectory' );
|
|
|
3845
|
+ if (!$terms_count > 0) {
|
|
|
3846
|
+ $json['error'] = __('No records to export.', 'geodirectory');
|
|
3847
|
3847
|
} else {
|
|
3848
|
3848
|
$total_terms = $terms_count;
|
|
3849
|
3849
|
if ($chunk_per_page > $terms_count) {
|
|
3850
|
3850
|
$chunk_per_page = $terms_count;
|
|
3851
|
3851
|
}
|
|
3852
|
|
- $chunk_total_pages = ceil( $total_terms / $chunk_per_page );
|
|
|
3852
|
+ $chunk_total_pages = ceil($total_terms / $chunk_per_page);
|
|
3853
|
3853
|
|
|
3854
|
3854
|
$j = $chunk_page_no;
|
|
3855
|
|
- $chunk_save_terms = geodir_imex_get_terms( $post_type, $chunk_per_page, $j );
|
|
|
3855
|
+ $chunk_save_terms = geodir_imex_get_terms($post_type, $chunk_per_page, $j);
|
|
3856
|
3856
|
|
|
3857
|
3857
|
$per_page = 500;
|
|
3858
|
3858
|
if ($per_page > $chunk_per_page) {
|
|
3859
|
3859
|
$per_page = $chunk_per_page;
|
|
3860
|
3860
|
}
|
|
3861
|
|
- $total_pages = ceil( $chunk_per_page / $per_page );
|
|
|
3861
|
+ $total_pages = ceil($chunk_per_page / $per_page);
|
|
3862
|
3862
|
|
|
3863
|
|
- for ( $i = 0; $i <= $total_pages; $i++ ) {
|
|
3864
|
|
- $save_terms = array_slice( $chunk_save_terms , ( $i * $per_page ), $per_page );
|
|
|
3863
|
+ for ($i = 0; $i <= $total_pages; $i++) {
|
|
|
3864
|
+ $save_terms = array_slice($chunk_save_terms, ($i * $per_page), $per_page);
|
|
3865
|
3865
|
|
|
3866
|
3866
|
$clear = $i == 0 ? true : false;
|
|
3867
|
|
- geodir_save_csv_data( $file_path_temp, $save_terms, $clear );
|
|
|
3867
|
+ geodir_save_csv_data($file_path_temp, $save_terms, $clear);
|
|
3868
|
3868
|
}
|
|
3869
|
3869
|
|
|
3870
|
|
- if ( $wp_filesystem->exists( $file_path_temp ) ) {
|
|
3871
|
|
- $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
|
|
3872
|
|
- $chunk_file_name = $file_name . $chunk_page_no . '.csv';
|
|
3873
|
|
- $file_path = $csv_file_dir . '/' . $chunk_file_name;
|
|
3874
|
|
- $wp_filesystem->move( $file_path_temp, $file_path, true );
|
|
|
3870
|
+ if ($wp_filesystem->exists($file_path_temp)) {
|
|
|
3871
|
+ $chunk_page_no = $chunk_total_pages > 1 ? '-'.$j : '';
|
|
|
3872
|
+ $chunk_file_name = $file_name.$chunk_page_no.'.csv';
|
|
|
3873
|
+ $file_path = $csv_file_dir.'/'.$chunk_file_name;
|
|
|
3874
|
+ $wp_filesystem->move($file_path_temp, $file_path, true);
|
|
3875
|
3875
|
|
|
3876
|
|
- $file_url = $file_url_base . $chunk_file_name;
|
|
3877
|
|
- $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
|
3876
|
+ $file_url = $file_url_base.$chunk_file_name;
|
|
|
3877
|
+ $chunk_file_paths[] = array('i' => $j.'.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
3878
|
3878
|
}
|
|
3879
|
3879
|
|
|
3880
|
|
- if ( !empty($chunk_file_paths) ) {
|
|
|
3880
|
+ if (!empty($chunk_file_paths)) {
|
|
3881
|
3881
|
$json['total'] = $terms_count;
|
|
3882
|
3882
|
$json['files'] = $chunk_file_paths;
|
|
3883
|
3883
|
} else {
|
|
3884
|
|
- $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
|
|
|
3884
|
+ $json['error'] = __('ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory');
|
|
3885
|
3885
|
}
|
|
3886
|
3886
|
}
|
|
3887
|
3887
|
// WPML
|
|
@@ -3889,127 +3889,127 @@ discard block |
|
|
block discarded – undo |
|
3889
|
3889
|
$sitepress->switch_lang($active_lang, true);
|
|
3890
|
3890
|
}
|
|
3891
|
3891
|
// WPML
|
|
3892
|
|
- wp_send_json( $json );
|
|
|
3892
|
+ wp_send_json($json);
|
|
3893
|
3893
|
}
|
|
3894
|
3894
|
}
|
|
3895
|
3895
|
break;
|
|
3896
|
3896
|
case 'export_locations': {
|
|
3897
|
|
- $file_url_base = geodir_path_import_export() . '/';
|
|
3898
|
|
- $file_name = 'gd_locations_' . date( 'dmyHi' );
|
|
3899
|
|
- $file_url = $file_url_base . $file_name . '.csv';
|
|
3900
|
|
- $file_path = $csv_file_dir . '/' . $file_name . '.csv';
|
|
3901
|
|
- $file_path_temp = $csv_file_dir . '/gd_locations_' . $nonce . '.csv';
|
|
|
3897
|
+ $file_url_base = geodir_path_import_export().'/';
|
|
|
3898
|
+ $file_name = 'gd_locations_'.date('dmyHi');
|
|
|
3899
|
+ $file_url = $file_url_base.$file_name.'.csv';
|
|
|
3900
|
+ $file_path = $csv_file_dir.'/'.$file_name.'.csv';
|
|
|
3901
|
+ $file_path_temp = $csv_file_dir.'/gd_locations_'.$nonce.'.csv';
|
|
3902
|
3902
|
|
|
3903
|
|
- $items_count = (int)geodir_location_imex_count_locations();
|
|
|
3903
|
+ $items_count = (int) geodir_location_imex_count_locations();
|
|
3904
|
3904
|
|
|
3905
|
|
- if ( isset( $_REQUEST['_st'] ) ) {
|
|
3906
|
|
- $line_count = (int)geodir_import_export_line_count( $file_path_temp );
|
|
3907
|
|
- $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
|
|
3908
|
|
- $percentage = min( $percentage, 100 );
|
|
|
3905
|
+ if (isset($_REQUEST['_st'])) {
|
|
|
3906
|
+ $line_count = (int) geodir_import_export_line_count($file_path_temp);
|
|
|
3907
|
+ $percentage = count($items_count) > 0 && $line_count > 0 ? ceil($line_count / $items_count) * 100 : 0;
|
|
|
3908
|
+ $percentage = min($percentage, 100);
|
|
3909
|
3909
|
|
|
3910
|
3910
|
$json['percentage'] = $percentage;
|
|
3911
|
|
- wp_send_json( $json );
|
|
|
3911
|
+ wp_send_json($json);
|
|
3912
|
3912
|
} else {
|
|
3913
|
3913
|
$chunk_file_paths = array();
|
|
3914
|
3914
|
|
|
3915
|
|
- if ( !$items_count > 0 ) {
|
|
3916
|
|
- $json['error'] = __( 'No records to export.', 'geodirectory' );
|
|
|
3915
|
+ if (!$items_count > 0) {
|
|
|
3916
|
+ $json['error'] = __('No records to export.', 'geodirectory');
|
|
3917
|
3917
|
} else {
|
|
3918
|
|
- $chunk_per_page = min( $chunk_per_page, $items_count );
|
|
3919
|
|
- $chunk_total_pages = ceil( $items_count / $chunk_per_page );
|
|
|
3918
|
+ $chunk_per_page = min($chunk_per_page, $items_count);
|
|
|
3919
|
+ $chunk_total_pages = ceil($items_count / $chunk_per_page);
|
|
3920
|
3920
|
|
|
3921
|
3921
|
$j = $chunk_page_no;
|
|
3922
|
|
- $chunk_save_items = geodir_location_imex_locations_data( $chunk_per_page, $j );
|
|
|
3922
|
+ $chunk_save_items = geodir_location_imex_locations_data($chunk_per_page, $j);
|
|
3923
|
3923
|
|
|
3924
|
3924
|
$per_page = 500;
|
|
3925
|
|
- $per_page = min( $per_page, $chunk_per_page );
|
|
3926
|
|
- $total_pages = ceil( $chunk_per_page / $per_page );
|
|
|
3925
|
+ $per_page = min($per_page, $chunk_per_page);
|
|
|
3926
|
+ $total_pages = ceil($chunk_per_page / $per_page);
|
|
3927
|
3927
|
|
|
3928
|
|
- for ( $i = 0; $i <= $total_pages; $i++ ) {
|
|
3929
|
|
- $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
|
|
|
3928
|
+ for ($i = 0; $i <= $total_pages; $i++) {
|
|
|
3929
|
+ $save_items = array_slice($chunk_save_items, ($i * $per_page), $per_page);
|
|
3930
|
3930
|
|
|
3931
|
3931
|
$clear = $i == 0 ? true : false;
|
|
3932
|
|
- geodir_save_csv_data( $file_path_temp, $save_items, $clear );
|
|
|
3932
|
+ geodir_save_csv_data($file_path_temp, $save_items, $clear);
|
|
3933
|
3933
|
}
|
|
3934
|
3934
|
|
|
3935
|
|
- if ( $wp_filesystem->exists( $file_path_temp ) ) {
|
|
3936
|
|
- $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
|
|
3937
|
|
- $chunk_file_name = $file_name . $chunk_page_no . '.csv';
|
|
3938
|
|
- $file_path = $csv_file_dir . '/' . $chunk_file_name;
|
|
3939
|
|
- $wp_filesystem->move( $file_path_temp, $file_path, true );
|
|
|
3935
|
+ if ($wp_filesystem->exists($file_path_temp)) {
|
|
|
3936
|
+ $chunk_page_no = $chunk_total_pages > 1 ? '-'.$j : '';
|
|
|
3937
|
+ $chunk_file_name = $file_name.$chunk_page_no.'.csv';
|
|
|
3938
|
+ $file_path = $csv_file_dir.'/'.$chunk_file_name;
|
|
|
3939
|
+ $wp_filesystem->move($file_path_temp, $file_path, true);
|
|
3940
|
3940
|
|
|
3941
|
|
- $file_url = $file_url_base . $chunk_file_name;
|
|
3942
|
|
- $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
|
3941
|
+ $file_url = $file_url_base.$chunk_file_name;
|
|
|
3942
|
+ $chunk_file_paths[] = array('i' => $j.'.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
3943
|
3943
|
}
|
|
3944
|
3944
|
|
|
3945
|
|
- if ( !empty($chunk_file_paths) ) {
|
|
|
3945
|
+ if (!empty($chunk_file_paths)) {
|
|
3946
|
3946
|
$json['total'] = $items_count;
|
|
3947
|
3947
|
$json['files'] = $chunk_file_paths;
|
|
3948
|
3948
|
} else {
|
|
3949
|
|
- $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
|
|
|
3949
|
+ $json['error'] = __('Fail, something wrong to create csv file.', 'geodirectory');
|
|
3950
|
3950
|
}
|
|
3951
|
3951
|
}
|
|
3952
|
|
- wp_send_json( $json );
|
|
|
3952
|
+ wp_send_json($json);
|
|
3953
|
3953
|
}
|
|
3954
|
3954
|
}
|
|
3955
|
3955
|
break;
|
|
3956
|
3956
|
case 'export_hoods': {
|
|
3957
|
|
- $file_url_base = geodir_path_import_export() . '/';
|
|
3958
|
|
- $file_name = 'gd_neighbourhoods_' . date( 'dmyHi' );
|
|
3959
|
|
- $file_url = $file_url_base . $file_name . '.csv';
|
|
3960
|
|
- $file_path = $csv_file_dir . '/' . $file_name . '.csv';
|
|
3961
|
|
- $file_path_temp = $csv_file_dir . '/gd_neighbourhoods_' . $nonce . '.csv';
|
|
|
3957
|
+ $file_url_base = geodir_path_import_export().'/';
|
|
|
3958
|
+ $file_name = 'gd_neighbourhoods_'.date('dmyHi');
|
|
|
3959
|
+ $file_url = $file_url_base.$file_name.'.csv';
|
|
|
3960
|
+ $file_path = $csv_file_dir.'/'.$file_name.'.csv';
|
|
|
3961
|
+ $file_path_temp = $csv_file_dir.'/gd_neighbourhoods_'.$nonce.'.csv';
|
|
3962
|
3962
|
|
|
3963
|
|
- $items_count = (int)geodir_location_imex_count_neighbourhoods();
|
|
|
3963
|
+ $items_count = (int) geodir_location_imex_count_neighbourhoods();
|
|
3964
|
3964
|
|
|
3965
|
|
- if ( isset( $_REQUEST['_st'] ) ) {
|
|
3966
|
|
- $line_count = (int)geodir_import_export_line_count( $file_path_temp );
|
|
3967
|
|
- $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
|
|
3968
|
|
- $percentage = min( $percentage, 100 );
|
|
|
3965
|
+ if (isset($_REQUEST['_st'])) {
|
|
|
3966
|
+ $line_count = (int) geodir_import_export_line_count($file_path_temp);
|
|
|
3967
|
+ $percentage = count($items_count) > 0 && $line_count > 0 ? ceil($line_count / $items_count) * 100 : 0;
|
|
|
3968
|
+ $percentage = min($percentage, 100);
|
|
3969
|
3969
|
|
|
3970
|
3970
|
$json['percentage'] = $percentage;
|
|
3971
|
|
- wp_send_json( $json );
|
|
|
3971
|
+ wp_send_json($json);
|
|
3972
|
3972
|
} else {
|
|
3973
|
3973
|
$chunk_file_paths = array();
|
|
3974
|
3974
|
|
|
3975
|
|
- if ( !$items_count > 0 ) {
|
|
3976
|
|
- $json['error'] = __( 'No records to export.', 'geodirectory' );
|
|
|
3975
|
+ if (!$items_count > 0) {
|
|
|
3976
|
+ $json['error'] = __('No records to export.', 'geodirectory');
|
|
3977
|
3977
|
} else {
|
|
3978
|
|
- $chunk_per_page = min( $chunk_per_page, $items_count );
|
|
3979
|
|
- $chunk_total_pages = ceil( $items_count / $chunk_per_page );
|
|
|
3978
|
+ $chunk_per_page = min($chunk_per_page, $items_count);
|
|
|
3979
|
+ $chunk_total_pages = ceil($items_count / $chunk_per_page);
|
|
3980
|
3980
|
|
|
3981
|
3981
|
$j = $chunk_page_no;
|
|
3982
|
|
- $chunk_save_items = geodir_location_imex_neighbourhoods_data( $chunk_per_page, $j );
|
|
|
3982
|
+ $chunk_save_items = geodir_location_imex_neighbourhoods_data($chunk_per_page, $j);
|
|
3983
|
3983
|
|
|
3984
|
3984
|
$per_page = 500;
|
|
3985
|
|
- $per_page = min( $per_page, $chunk_per_page );
|
|
3986
|
|
- $total_pages = ceil( $chunk_per_page / $per_page );
|
|
|
3985
|
+ $per_page = min($per_page, $chunk_per_page);
|
|
|
3986
|
+ $total_pages = ceil($chunk_per_page / $per_page);
|
|
3987
|
3987
|
|
|
3988
|
|
- for ( $i = 0; $i <= $total_pages; $i++ ) {
|
|
3989
|
|
- $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
|
|
|
3988
|
+ for ($i = 0; $i <= $total_pages; $i++) {
|
|
|
3989
|
+ $save_items = array_slice($chunk_save_items, ($i * $per_page), $per_page);
|
|
3990
|
3990
|
|
|
3991
|
3991
|
$clear = $i == 0 ? true : false;
|
|
3992
|
|
- geodir_save_csv_data( $file_path_temp, $save_items, $clear );
|
|
|
3992
|
+ geodir_save_csv_data($file_path_temp, $save_items, $clear);
|
|
3993
|
3993
|
}
|
|
3994
|
3994
|
|
|
3995
|
|
- if ( $wp_filesystem->exists( $file_path_temp ) ) {
|
|
3996
|
|
- $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
|
|
3997
|
|
- $chunk_file_name = $file_name . $chunk_page_no . '.csv';
|
|
3998
|
|
- $file_path = $csv_file_dir . '/' . $chunk_file_name;
|
|
3999
|
|
- $wp_filesystem->move( $file_path_temp, $file_path, true );
|
|
|
3995
|
+ if ($wp_filesystem->exists($file_path_temp)) {
|
|
|
3996
|
+ $chunk_page_no = $chunk_total_pages > 1 ? '-'.$j : '';
|
|
|
3997
|
+ $chunk_file_name = $file_name.$chunk_page_no.'.csv';
|
|
|
3998
|
+ $file_path = $csv_file_dir.'/'.$chunk_file_name;
|
|
|
3999
|
+ $wp_filesystem->move($file_path_temp, $file_path, true);
|
|
4000
|
4000
|
|
|
4001
|
|
- $file_url = $file_url_base . $chunk_file_name;
|
|
4002
|
|
- $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
|
4001
|
+ $file_url = $file_url_base.$chunk_file_name;
|
|
|
4002
|
+ $chunk_file_paths[] = array('i' => $j.'.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
4003
|
4003
|
}
|
|
4004
|
4004
|
|
|
4005
|
|
- if ( !empty($chunk_file_paths) ) {
|
|
|
4005
|
+ if (!empty($chunk_file_paths)) {
|
|
4006
|
4006
|
$json['total'] = $items_count;
|
|
4007
|
4007
|
$json['files'] = $chunk_file_paths;
|
|
4008
|
4008
|
} else {
|
|
4009
|
|
- $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
|
|
|
4009
|
+ $json['error'] = __('Fail, something wrong to create csv file.', 'geodirectory');
|
|
4010
|
4010
|
}
|
|
4011
|
4011
|
}
|
|
4012
|
|
- wp_send_json( $json );
|
|
|
4012
|
+ wp_send_json($json);
|
|
4013
|
4013
|
}
|
|
4014
|
4014
|
}
|
|
4015
|
4015
|
break;
|
|
@@ -4026,33 +4026,33 @@ discard block |
|
|
block discarded – undo |
|
4026
|
4026
|
}
|
|
4027
|
4027
|
// WPML
|
|
4028
|
4028
|
|
|
4029
|
|
- ini_set( 'auto_detect_line_endings', true );
|
|
|
4029
|
+ ini_set('auto_detect_line_endings', true);
|
|
4030
|
4030
|
|
|
4031
|
4031
|
$uploads = wp_upload_dir();
|
|
4032
|
4032
|
$uploads_dir = $uploads['path'];
|
|
4033
|
4033
|
$uploads_subdir = $uploads['subdir'];
|
|
4034
|
4034
|
|
|
4035
|
|
- $csv_file = isset( $_POST['_file'] ) ? $_POST['_file'] : NULL;
|
|
4036
|
|
- $import_choice = isset( $_REQUEST['_ch'] ) ? $_REQUEST['_ch'] : 'skip';
|
|
|
4035
|
+ $csv_file = isset($_POST['_file']) ? $_POST['_file'] : NULL;
|
|
|
4036
|
+ $import_choice = isset($_REQUEST['_ch']) ? $_REQUEST['_ch'] : 'skip';
|
|
4037
|
4037
|
|
|
4038
|
|
- $csv_file_arr = explode( '/', $csv_file );
|
|
4039
|
|
- $csv_filename = end( $csv_file_arr );
|
|
4040
|
|
- $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $csv_filename;
|
|
|
4038
|
+ $csv_file_arr = explode('/', $csv_file);
|
|
|
4039
|
+ $csv_filename = end($csv_file_arr);
|
|
|
4040
|
+ $target_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$csv_filename;
|
|
4041
|
4041
|
|
|
4042
|
4042
|
$json['file'] = $csv_file;
|
|
4043
|
|
- $json['error'] = __( 'The uploaded file is not a valid csv file. Please try again.', 'geodirectory' );
|
|
|
4043
|
+ $json['error'] = __('The uploaded file is not a valid csv file. Please try again.', 'geodirectory');
|
|
4044
|
4044
|
$file = array();
|
|
4045
|
4045
|
|
|
4046
|
|
- if ( $csv_file && $wp_filesystem->is_file( $target_path ) && $wp_filesystem->exists( $target_path ) ) {
|
|
4047
|
|
- $wp_filetype = wp_check_filetype_and_ext( $target_path, $csv_filename );
|
|
|
4046
|
+ if ($csv_file && $wp_filesystem->is_file($target_path) && $wp_filesystem->exists($target_path)) {
|
|
|
4047
|
+ $wp_filetype = wp_check_filetype_and_ext($target_path, $csv_filename);
|
|
4048
|
4048
|
|
|
4049
|
4049
|
if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
|
|
4050
|
4050
|
$json['error'] = NULL;
|
|
4051
|
4051
|
$json['rows'] = 0;
|
|
4052
|
4052
|
|
|
4053
|
|
- if ( ( $handle = fopen($target_path, "r" ) ) !== FALSE ) {
|
|
4054
|
|
- while ( ( $data = fgetcsv( $handle, 100000, "," ) ) !== FALSE ) {
|
|
4055
|
|
- if ( !empty( $data ) ) {
|
|
|
4053
|
+ if (($handle = fopen($target_path, "r")) !== FALSE) {
|
|
|
4054
|
+ while (($data = fgetcsv($handle, 100000, ",")) !== FALSE) {
|
|
|
4055
|
+ if (!empty($data)) {
|
|
4056
|
4056
|
$file[] = $data;
|
|
4057
|
4057
|
}
|
|
4058
|
4058
|
}
|
|
@@ -4065,19 +4065,19 @@ discard block |
|
|
block discarded – undo |
|
4065
|
4065
|
$json['error'] = __('No data found in csv file.', 'geodirectory');
|
|
4066
|
4066
|
}
|
|
4067
|
4067
|
} else {
|
|
4068
|
|
- wp_send_json( $json );
|
|
|
4068
|
+ wp_send_json($json);
|
|
4069
|
4069
|
}
|
|
4070
|
4070
|
} else {
|
|
4071
|
|
- wp_send_json( $json );
|
|
|
4071
|
+ wp_send_json($json);
|
|
4072
|
4072
|
}
|
|
4073
|
4073
|
|
|
4074
|
|
- if ( $task == 'prepare_import' || !empty( $json['error'] ) ) {
|
|
4075
|
|
- wp_send_json( $json );
|
|
|
4074
|
+ if ($task == 'prepare_import' || !empty($json['error'])) {
|
|
|
4075
|
+ wp_send_json($json);
|
|
4076
|
4076
|
}
|
|
4077
|
4077
|
|
|
4078
|
4078
|
$total = $json['rows'];
|
|
4079
|
|
- $limit = isset($_POST['limit']) ? (int)$_POST['limit'] : 1;
|
|
4080
|
|
- $processed = isset($_POST['processed']) ? (int)$_POST['processed'] : 0;
|
|
|
4079
|
+ $limit = isset($_POST['limit']) ? (int) $_POST['limit'] : 1;
|
|
|
4080
|
+ $processed = isset($_POST['processed']) ? (int) $_POST['processed'] : 0;
|
|
4081
|
4081
|
|
|
4082
|
4082
|
$count = $limit;
|
|
4083
|
4083
|
|
|
@@ -4102,13 +4102,13 @@ discard block |
|
|
block discarded – undo |
|
4102
|
4102
|
|
|
4103
|
4103
|
$post_types = geodir_get_posttypes();
|
|
4104
|
4104
|
|
|
4105
|
|
- if ( $task == 'import_cat' ) {
|
|
|
4105
|
+ if ($task == 'import_cat') {
|
|
4106
|
4106
|
if (!empty($file)) {
|
|
4107
|
4107
|
$columns = isset($file[0]) ? $file[0] : NULL;
|
|
4108
|
4108
|
|
|
4109
|
4109
|
if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
|
|
4110
|
4110
|
$json['error'] = CSV_INVAILD_FILE;
|
|
4111
|
|
- wp_send_json( $json );
|
|
|
4111
|
+ wp_send_json($json);
|
|
4112
|
4112
|
exit;
|
|
4113
|
4113
|
}
|
|
4114
|
4114
|
|
|
@@ -4119,7 +4119,7 @@ discard block |
|
|
block discarded – undo |
|
4119
|
4119
|
|
|
4120
|
4120
|
if (isset($file[$index])) {
|
|
4121
|
4121
|
$row = $file[$index];
|
|
4122
|
|
- $row = array_map( 'trim', $row );
|
|
|
4122
|
+ $row = array_map('trim', $row);
|
|
4123
|
4123
|
//$row = array_map( 'utf8_encode', $row );
|
|
4124
|
4124
|
|
|
4125
|
4125
|
$cat_id = '';
|
|
@@ -4136,42 +4136,42 @@ discard block |
|
|
block discarded – undo |
|
4136
|
4136
|
$cat_id_original = '';
|
|
4137
|
4137
|
|
|
4138
|
4138
|
$c = 0;
|
|
4139
|
|
- foreach ($columns as $column ) {
|
|
4140
|
|
- if ( $column == 'cat_id' ) {
|
|
4141
|
|
- $cat_id = (int)$row[$c];
|
|
4142
|
|
- } else if ( $column == 'cat_name' ) {
|
|
|
4139
|
+ foreach ($columns as $column) {
|
|
|
4140
|
+ if ($column == 'cat_id') {
|
|
|
4141
|
+ $cat_id = (int) $row[$c];
|
|
|
4142
|
+ } else if ($column == 'cat_name') {
|
|
4143
|
4143
|
$cat_name = $row[$c];
|
|
4144
|
|
- } else if ( $column == 'cat_slug' ) {
|
|
|
4144
|
+ } else if ($column == 'cat_slug') {
|
|
4145
|
4145
|
$cat_slug = $row[$c];
|
|
4146
|
|
- } else if ( $column == 'cat_posttype' ) {
|
|
|
4146
|
+ } else if ($column == 'cat_posttype') {
|
|
4147
|
4147
|
$cat_posttype = $row[$c];
|
|
4148
|
|
- } else if ( $column == 'cat_parent' ) {
|
|
|
4148
|
+ } else if ($column == 'cat_parent') {
|
|
4149
|
4149
|
$cat_parent = trim($row[$c]);
|
|
4150
|
|
- } else if ( $column == 'cat_schema' && $row[$c] != '' ) {
|
|
|
4150
|
+ } else if ($column == 'cat_schema' && $row[$c] != '') {
|
|
4151
|
4151
|
$cat_schema = $row[$c];
|
|
4152
|
|
- } else if ( $column == 'cat_description' ) {
|
|
|
4152
|
+ } else if ($column == 'cat_description') {
|
|
4153
|
4153
|
$cat_description = $row[$c];
|
|
4154
|
|
- } else if ( $column == 'cat_top_description' ) {
|
|
|
4154
|
+ } else if ($column == 'cat_top_description') {
|
|
4155
|
4155
|
$cat_top_description = $row[$c];
|
|
4156
|
|
- } else if ( $column == 'cat_image' ) {
|
|
|
4156
|
+ } else if ($column == 'cat_image') {
|
|
4157
|
4157
|
$cat_image = $row[$c];
|
|
4158
|
|
- } else if ( $column == 'cat_icon' ) {
|
|
|
4158
|
+ } else if ($column == 'cat_icon') {
|
|
4159
|
4159
|
$cat_icon = $row[$c];
|
|
4160
|
4160
|
}
|
|
4161
|
4161
|
// WPML
|
|
4162
|
|
- if ( $is_wpml ) {
|
|
4163
|
|
- if ( $column == 'cat_language' ) {
|
|
4164
|
|
- $cat_language = geodir_strtolower( trim( $row[$c] ) );
|
|
4165
|
|
- } else if ( $column == 'cat_id_original' ) {
|
|
4166
|
|
- $cat_id_original = (int)$row[$c];
|
|
|
4162
|
+ if ($is_wpml) {
|
|
|
4163
|
+ if ($column == 'cat_language') {
|
|
|
4164
|
+ $cat_language = geodir_strtolower(trim($row[$c]));
|
|
|
4165
|
+ } else if ($column == 'cat_id_original') {
|
|
|
4166
|
+ $cat_id_original = (int) $row[$c];
|
|
4167
|
4167
|
}
|
|
4168
|
4168
|
}
|
|
4169
|
4169
|
// WPML
|
|
4170
|
4170
|
$c++;
|
|
4171
|
4171
|
}
|
|
4172
|
4172
|
|
|
4173
|
|
- if ( $cat_name == '' || !in_array( $cat_posttype, $post_types ) ) {
|
|
4174
|
|
- geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) );
|
|
|
4173
|
+ if ($cat_name == '' || !in_array($cat_posttype, $post_types)) {
|
|
|
4174
|
+ geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be added due to blank title/invalid post type', 'geodirectory'));
|
|
4175
|
4175
|
|
|
4176
|
4176
|
$invalid++;
|
|
4177
|
4177
|
continue;
|
|
@@ -4189,24 +4189,24 @@ discard block |
|
|
block discarded – undo |
|
4189
|
4189
|
$term_data['description'] = $cat_description;
|
|
4190
|
4190
|
$term_data['cat_schema'] = $cat_schema;
|
|
4191
|
4191
|
$term_data['top_description'] = $cat_top_description;
|
|
4192
|
|
- $term_data['image'] = $cat_image != '' ? basename( $cat_image ) : '';
|
|
4193
|
|
- $term_data['icon'] = $cat_icon != '' ? basename( $cat_icon ) : '';
|
|
|
4192
|
+ $term_data['image'] = $cat_image != '' ? basename($cat_image) : '';
|
|
|
4193
|
+ $term_data['icon'] = $cat_icon != '' ? basename($cat_icon) : '';
|
|
4194
|
4194
|
|
|
4195
|
4195
|
//$term_data = array_map( 'utf8_encode', $term_data );
|
|
4196
|
4196
|
|
|
4197
|
|
- $taxonomy = $cat_posttype . 'category';
|
|
|
4197
|
+ $taxonomy = $cat_posttype.'category';
|
|
4198
|
4198
|
|
|
4199
|
4199
|
$term_data['taxonomy'] = $taxonomy;
|
|
4200
|
4200
|
|
|
4201
|
4201
|
$term_parent_id = 0;
|
|
4202
|
|
- if ($cat_parent != "" || (int)$cat_parent > 0) {
|
|
|
4202
|
+ if ($cat_parent != "" || (int) $cat_parent > 0) {
|
|
4203
|
4203
|
$term_parent = '';
|
|
4204
|
4204
|
|
|
4205
|
|
- if ( $term_parent = get_term_by( 'name', $cat_parent, $taxonomy ) ) {
|
|
|
4205
|
+ if ($term_parent = get_term_by('name', $cat_parent, $taxonomy)) {
|
|
4206
|
4206
|
//
|
|
4207
|
|
- } else if ( $term_parent = get_term_by( 'slug', $cat_parent, $taxonomy ) ) {
|
|
|
4207
|
+ } else if ($term_parent = get_term_by('slug', $cat_parent, $taxonomy)) {
|
|
4208
|
4208
|
//
|
|
4209
|
|
- } else if ( $term_parent = get_term_by( 'id', $cat_parent, $taxonomy ) ) {
|
|
|
4209
|
+ } else if ($term_parent = get_term_by('id', $cat_parent, $taxonomy)) {
|
|
4210
|
4210
|
//
|
|
4211
|
4211
|
} else {
|
|
4212
|
4212
|
$term_parent_data = array();
|
|
@@ -4214,104 +4214,104 @@ discard block |
|
|
block discarded – undo |
|
4214
|
4214
|
//$term_parent_data = array_map( 'utf8_encode', $term_parent_data );
|
|
4215
|
4215
|
$term_parent_data['taxonomy'] = $taxonomy;
|
|
4216
|
4216
|
|
|
4217
|
|
- $term_parent_id = (int)geodir_imex_insert_term( $taxonomy, $term_parent_data );
|
|
|
4217
|
+ $term_parent_id = (int) geodir_imex_insert_term($taxonomy, $term_parent_data);
|
|
4218
|
4218
|
}
|
|
4219
|
4219
|
|
|
4220
|
|
- if ( !empty( $term_parent ) && !is_wp_error( $term_parent ) ) {
|
|
4221
|
|
- $term_parent_id = (int)$term_parent->term_id;
|
|
|
4220
|
+ if (!empty($term_parent) && !is_wp_error($term_parent)) {
|
|
|
4221
|
+ $term_parent_id = (int) $term_parent->term_id;
|
|
4222
|
4222
|
}
|
|
4223
|
4223
|
}
|
|
4224
|
|
- $term_data['parent'] = (int)$term_parent_id;
|
|
|
4224
|
+ $term_data['parent'] = (int) $term_parent_id;
|
|
4225
|
4225
|
|
|
4226
|
4226
|
$term_id = NULL;
|
|
4227
|
|
- if ( $import_choice == 'update' ) {
|
|
4228
|
|
- if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
|
|
|
4227
|
+ if ($import_choice == 'update') {
|
|
|
4228
|
+ if ($cat_id > 0 && $term = (array) term_exists($cat_id, $taxonomy)) {
|
|
4229
|
4229
|
$term_data['term_id'] = $term['term_id'];
|
|
4230
|
4230
|
|
|
4231
|
|
- if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
|
|
|
4231
|
+ if ($term_id = geodir_imex_update_term($taxonomy, $term_data)) {
|
|
4232
|
4232
|
$updated++;
|
|
4233
|
4233
|
} else {
|
|
4234
|
4234
|
$invalid++;
|
|
4235
|
|
- 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' ) );
|
|
|
4235
|
+ 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'));
|
|
4236
|
4236
|
}
|
|
4237
|
|
- } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
|
|
|
4237
|
+ } else if ($term_data['slug'] != '' && $term = (array) term_exists($term_data['slug'], $taxonomy)) {
|
|
4238
|
4238
|
$term_data['term_id'] = $term['term_id'];
|
|
4239
|
4239
|
|
|
4240
|
|
- if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
|
|
|
4240
|
+ if ($term_id = geodir_imex_update_term($taxonomy, $term_data)) {
|
|
4241
|
4241
|
$updated++;
|
|
4242
|
4242
|
} else {
|
|
4243
|
4243
|
$invalid++;
|
|
4244
|
|
- 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' ) );
|
|
|
4244
|
+ 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'));
|
|
4245
|
4245
|
}
|
|
4246
|
4246
|
} else {
|
|
4247
|
|
- if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
|
|
|
4247
|
+ if ($term_id = geodir_imex_insert_term($taxonomy, $term_data)) {
|
|
4248
|
4248
|
$created++;
|
|
4249
|
4249
|
} else {
|
|
4250
|
4250
|
$invalid++;
|
|
4251
|
|
- 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' ) );
|
|
|
4251
|
+ 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'));
|
|
4252
|
4252
|
}
|
|
4253
|
4253
|
}
|
|
4254
|
|
- } else if ( $import_choice == 'skip' ) {
|
|
4255
|
|
- if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
|
|
|
4254
|
+ } else if ($import_choice == 'skip') {
|
|
|
4255
|
+ if ($cat_id > 0 && $term = (array) term_exists($cat_id, $taxonomy)) {
|
|
4256
|
4256
|
$skipped++;
|
|
4257
|
|
- } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
|
|
|
4257
|
+ } else if ($term_data['slug'] != '' && $term = (array) term_exists($term_data['slug'], $taxonomy)) {
|
|
4258
|
4258
|
$skipped++;
|
|
4259
|
4259
|
} else {
|
|
4260
|
|
- if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
|
|
|
4260
|
+ if ($term_id = geodir_imex_insert_term($taxonomy, $term_data)) {
|
|
4261
|
4261
|
$created++;
|
|
4262
|
4262
|
} else {
|
|
4263
|
4263
|
$invalid++;
|
|
4264
|
|
- 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' ) );
|
|
|
4264
|
+ 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'));
|
|
4265
|
4265
|
}
|
|
4266
|
4266
|
}
|
|
4267
|
4267
|
} else {
|
|
4268
|
4268
|
$invalid++;
|
|
4269
|
|
- 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' ) );
|
|
|
4269
|
+ 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'));
|
|
4270
|
4270
|
}
|
|
4271
|
4271
|
|
|
4272
|
|
- if ( $term_id ) {
|
|
|
4272
|
+ if ($term_id) {
|
|
4273
|
4273
|
// WPML
|
|
4274
|
4274
|
if ($is_wpml && $cat_id_original > 0 && $cat_language != '') {
|
|
4275
|
|
- $wpml_element_type = 'tax_' . $taxonomy;
|
|
4276
|
|
- $source_language = geodir_get_language_for_element( $cat_id_original, $wpml_element_type );
|
|
|
4275
|
+ $wpml_element_type = 'tax_'.$taxonomy;
|
|
|
4276
|
+ $source_language = geodir_get_language_for_element($cat_id_original, $wpml_element_type);
|
|
4277
|
4277
|
$source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
|
|
4278
|
4278
|
|
|
4279
|
|
- $trid = $sitepress->get_element_trid( $cat_id_original, $wpml_element_type );
|
|
|
4279
|
+ $trid = $sitepress->get_element_trid($cat_id_original, $wpml_element_type);
|
|
4280
|
4280
|
|
|
4281
|
|
- $sitepress->set_element_language_details( $term_id, $wpml_element_type, $trid, $cat_language, $source_language );
|
|
|
4281
|
+ $sitepress->set_element_language_details($term_id, $wpml_element_type, $trid, $cat_language, $source_language);
|
|
4282
|
4282
|
}
|
|
4283
|
4283
|
// WPML
|
|
4284
|
4284
|
|
|
4285
|
|
- if ( isset( $term_data['top_description'] ) ) {
|
|
4286
|
|
- update_tax_meta( $term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype );
|
|
|
4285
|
+ if (isset($term_data['top_description'])) {
|
|
|
4286
|
+ update_tax_meta($term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype);
|
|
4287
|
4287
|
}
|
|
4288
|
4288
|
|
|
4289
|
|
- if ( isset( $term_data['cat_schema'] ) ) {
|
|
4290
|
|
- update_tax_meta( $term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype );
|
|
|
4289
|
+ if (isset($term_data['cat_schema'])) {
|
|
|
4290
|
+ update_tax_meta($term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype);
|
|
4291
|
4291
|
}
|
|
4292
|
4292
|
|
|
4293
|
4293
|
$attachment = false;
|
|
4294
|
|
- if ( isset( $term_data['image'] ) && $term_data['image'] != '' ) {
|
|
4295
|
|
- $cat_image = geodir_get_default_catimage( $term_id, $cat_posttype );
|
|
4296
|
|
- $cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : '';
|
|
|
4294
|
+ if (isset($term_data['image']) && $term_data['image'] != '') {
|
|
|
4295
|
+ $cat_image = geodir_get_default_catimage($term_id, $cat_posttype);
|
|
|
4296
|
+ $cat_image = !empty($cat_image) && isset($cat_image['src']) ? $cat_image['src'] : '';
|
|
4297
|
4297
|
|
|
4298
|
|
- if ( basename($cat_image) != $term_data['image'] ) {
|
|
|
4298
|
+ if (basename($cat_image) != $term_data['image']) {
|
|
4299
|
4299
|
$attachment = true;
|
|
4300
|
|
- update_tax_meta( $term_id, 'ct_cat_default_img', array( 'id' => 'image', 'src' => $uploads['url'] . '/' . $term_data['image'] ), $cat_posttype );
|
|
|
4300
|
+ update_tax_meta($term_id, 'ct_cat_default_img', array('id' => 'image', 'src' => $uploads['url'].'/'.$term_data['image']), $cat_posttype);
|
|
4301
|
4301
|
}
|
|
4302
|
4302
|
}
|
|
4303
|
4303
|
|
|
4304
|
|
- if ( isset( $term_data['icon'] ) && $term_data['icon'] != '' ) {
|
|
4305
|
|
- $cat_icon = get_tax_meta( $term_id, 'ct_cat_icon', false, $cat_posttype );
|
|
4306
|
|
- $cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : '';
|
|
|
4304
|
+ if (isset($term_data['icon']) && $term_data['icon'] != '') {
|
|
|
4305
|
+ $cat_icon = get_tax_meta($term_id, 'ct_cat_icon', false, $cat_posttype);
|
|
|
4306
|
+ $cat_icon = !empty($cat_icon) && isset($cat_icon['src']) ? $cat_icon['src'] : '';
|
|
4307
|
4307
|
|
|
4308
|
|
- if ( basename($cat_icon) != $term_data['icon'] ) {
|
|
|
4308
|
+ if (basename($cat_icon) != $term_data['icon']) {
|
|
4309
|
4309
|
$attachment = true;
|
|
4310
|
|
- update_tax_meta( $term_id, 'ct_cat_icon', array( 'id' => 'icon', 'src' => $uploads['url'] . '/' . $term_data['icon'] ), $cat_posttype );
|
|
|
4310
|
+ update_tax_meta($term_id, 'ct_cat_icon', array('id' => 'icon', 'src' => $uploads['url'].'/'.$term_data['icon']), $cat_posttype);
|
|
4311
|
4311
|
}
|
|
4312
|
4312
|
}
|
|
4313
|
4313
|
|
|
4314
|
|
- if ( $attachment ) {
|
|
|
4314
|
+ if ($attachment) {
|
|
4315
|
4315
|
$images++;
|
|
4316
|
4316
|
}
|
|
4317
|
4317
|
}
|
|
@@ -4333,13 +4333,13 @@ discard block |
|
|
block discarded – undo |
|
4333
|
4333
|
$json['invalid'] = $invalid;
|
|
4334
|
4334
|
$json['images'] = $images;
|
|
4335
|
4335
|
|
|
4336
|
|
- wp_send_json( $json );
|
|
|
4336
|
+ wp_send_json($json);
|
|
4337
|
4337
|
exit;
|
|
4338
|
|
- } else if ( $task == 'import_post' ) {
|
|
|
4338
|
+ } else if ($task == 'import_post') {
|
|
4339
|
4339
|
//run some stuff to make the import quicker
|
|
4340
|
|
- wp_defer_term_counting( true );
|
|
4341
|
|
- wp_defer_comment_counting( true );
|
|
4342
|
|
- $wpdb->query( 'SET autocommit = 0;' );
|
|
|
4340
|
+ wp_defer_term_counting(true);
|
|
|
4341
|
+ wp_defer_comment_counting(true);
|
|
|
4342
|
+ $wpdb->query('SET autocommit = 0;');
|
|
4343
|
4343
|
|
|
4344
|
4344
|
//remove_all_actions('publish_post');
|
|
4345
|
4345
|
//remove_all_actions('transition_post_status');
|
|
@@ -4348,18 +4348,18 @@ discard block |
|
|
block discarded – undo |
|
4348
|
4348
|
if (!empty($file)) {
|
|
4349
|
4349
|
$wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses.
|
|
4350
|
4350
|
$default_status = 'publish';
|
|
4351
|
|
- $current_date = date_i18n( 'Y-m-d', time() );
|
|
|
4351
|
+ $current_date = date_i18n('Y-m-d', time());
|
|
4352
|
4352
|
|
|
4353
|
4353
|
$columns = isset($file[0]) ? $file[0] : NULL;
|
|
4354
|
4354
|
|
|
4355
|
4355
|
if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
|
|
4356
|
4356
|
$json['error'] = CSV_INVAILD_FILE;
|
|
4357
|
|
- wp_send_json( $json );
|
|
|
4357
|
+ wp_send_json($json);
|
|
4358
|
4358
|
exit;
|
|
4359
|
4359
|
}
|
|
4360
|
4360
|
|
|
4361
|
4361
|
$gd_error_log = __('GD IMPORT LISTINGS [ROW %d]:', 'geodirectory');
|
|
4362
|
|
- $wp_chars_error = __( '(check & remove if any invalid characters used in data)', 'geodirectory' );
|
|
|
4362
|
+ $wp_chars_error = __('(check & remove if any invalid characters used in data)', 'geodirectory');
|
|
4363
|
4363
|
$processed_actual = 0;
|
|
4364
|
4364
|
for ($i = 1; $i <= $limit; $i++) {
|
|
4365
|
4365
|
$index = $processed + $i;
|
|
@@ -4368,9 +4368,9 @@ discard block |
|
|
block discarded – undo |
|
4368
|
4368
|
if (isset($file[$index])) {
|
|
4369
|
4369
|
$processed_actual++;
|
|
4370
|
4370
|
$row = $file[$index];
|
|
4371
|
|
- $row = array_map( 'trim', $row );
|
|
|
4371
|
+ $row = array_map('trim', $row);
|
|
4372
|
4372
|
//$row = array_map( 'utf8_encode', $row );
|
|
4373
|
|
- $row = array_map( 'addslashes_gpc', $row );
|
|
|
4373
|
+ $row = array_map('addslashes_gpc', $row);
|
|
4374
|
4374
|
|
|
4375
|
4375
|
$post_id = '';
|
|
4376
|
4376
|
$post_title = '';
|
|
@@ -4407,78 +4407,78 @@ discard block |
|
|
block discarded – undo |
|
4407
|
4407
|
$original_post_id = '';
|
|
4408
|
4408
|
|
|
4409
|
4409
|
$c = 0;
|
|
4410
|
|
- foreach ($columns as $column ) {
|
|
|
4410
|
+ foreach ($columns as $column) {
|
|
4411
|
4411
|
$gd_post[$column] = $row[$c];
|
|
4412
|
4412
|
|
|
4413
|
|
- if ( $column == 'post_id' ) {
|
|
|
4413
|
+ if ($column == 'post_id') {
|
|
4414
|
4414
|
$post_id = $row[$c];
|
|
4415
|
|
- } else if ( $column == 'post_title' ) {
|
|
|
4415
|
+ } else if ($column == 'post_title') {
|
|
4416
|
4416
|
$post_title = sanitize_text_field($row[$c]);
|
|
4417
|
|
- } else if ( $column == 'post_author' ) {
|
|
|
4417
|
+ } else if ($column == 'post_author') {
|
|
4418
|
4418
|
$post_author = $row[$c];
|
|
4419
|
|
- } else if ( $column == 'post_content' ) {
|
|
|
4419
|
+ } else if ($column == 'post_content') {
|
|
4420
|
4420
|
$post_content = $row[$c];
|
|
4421
|
|
- } else if ( $column == 'post_category' && $row[$c] != '' ) {
|
|
4422
|
|
- $post_category_arr = explode( ',', $row[$c] );
|
|
4423
|
|
- } else if ( $column == 'default_category' ) {
|
|
|
4421
|
+ } else if ($column == 'post_category' && $row[$c] != '') {
|
|
|
4422
|
+ $post_category_arr = explode(',', $row[$c]);
|
|
|
4423
|
+ } else if ($column == 'default_category') {
|
|
4424
|
4424
|
$default_category = wp_kses_normalize_entities($row[$c]);
|
|
4425
|
|
- } else if ( $column == 'post_tags' && $row[$c] != '' ) {
|
|
4426
|
|
- $post_tags = explode( ',', sanitize_text_field($row[$c]) );
|
|
4427
|
|
- } else if ( $column == 'post_type' ) {
|
|
|
4425
|
+ } else if ($column == 'post_tags' && $row[$c] != '') {
|
|
|
4426
|
+ $post_tags = explode(',', sanitize_text_field($row[$c]));
|
|
|
4427
|
+ } else if ($column == 'post_type') {
|
|
4428
|
4428
|
$post_type = $row[$c];
|
|
4429
|
|
- } else if ( $column == 'post_status' ) {
|
|
4430
|
|
- $post_status = sanitize_key( $row[$c] );
|
|
4431
|
|
- } else if ( $column == 'is_featured' ) {
|
|
4432
|
|
- $is_featured = (int)$row[$c];
|
|
4433
|
|
- } else if ( $column == 'geodir_video' ) {
|
|
|
4429
|
+ } else if ($column == 'post_status') {
|
|
|
4430
|
+ $post_status = sanitize_key($row[$c]);
|
|
|
4431
|
+ } else if ($column == 'is_featured') {
|
|
|
4432
|
+ $is_featured = (int) $row[$c];
|
|
|
4433
|
+ } else if ($column == 'geodir_video') {
|
|
4434
|
4434
|
$geodir_video = $row[$c];
|
|
4435
|
|
- } else if ( $column == 'post_address' ) {
|
|
|
4435
|
+ } else if ($column == 'post_address') {
|
|
4436
|
4436
|
$post_address = sanitize_text_field($row[$c]);
|
|
4437
|
|
- } else if ( $column == 'post_city' ) {
|
|
|
4437
|
+ } else if ($column == 'post_city') {
|
|
4438
|
4438
|
$post_city = sanitize_text_field($row[$c]);
|
|
4439
|
|
- } else if ( $column == 'post_region' ) {
|
|
|
4439
|
+ } else if ($column == 'post_region') {
|
|
4440
|
4440
|
$post_region = sanitize_text_field($row[$c]);
|
|
4441
|
|
- } else if ( $column == 'post_country' ) {
|
|
|
4441
|
+ } else if ($column == 'post_country') {
|
|
4442
|
4442
|
$post_country = sanitize_text_field($row[$c]);
|
|
4443
|
|
- } else if ( $column == 'post_zip' ) {
|
|
|
4443
|
+ } else if ($column == 'post_zip') {
|
|
4444
|
4444
|
$post_zip = sanitize_text_field($row[$c]);
|
|
4445
|
|
- } else if ( $column == 'post_latitude' ) {
|
|
|
4445
|
+ } else if ($column == 'post_latitude') {
|
|
4446
|
4446
|
$post_latitude = sanitize_text_field($row[$c]);
|
|
4447
|
|
- } else if ( $column == 'post_longitude' ) {
|
|
|
4447
|
+ } else if ($column == 'post_longitude') {
|
|
4448
|
4448
|
$post_longitude = sanitize_text_field($row[$c]);
|
|
4449
|
|
- } else if ( $column == 'post_neighbourhood' ) {
|
|
|
4449
|
+ } else if ($column == 'post_neighbourhood') {
|
|
4450
|
4450
|
$post_neighbourhood = sanitize_text_field($row[$c]);
|
|
4451
|
4451
|
unset($gd_post[$column]);
|
|
4452
|
|
- } else if ( $column == 'neighbourhood_latitude' ) {
|
|
|
4452
|
+ } else if ($column == 'neighbourhood_latitude') {
|
|
4453
|
4453
|
$neighbourhood_latitude = sanitize_text_field($row[$c]);
|
|
4454
|
|
- } else if ( $column == 'neighbourhood_longitude' ) {
|
|
|
4454
|
+ } else if ($column == 'neighbourhood_longitude') {
|
|
4455
|
4455
|
$neighbourhood_longitude = sanitize_text_field($row[$c]);
|
|
4456
|
|
- } else if ( $column == 'geodir_timing' ) {
|
|
|
4456
|
+ } else if ($column == 'geodir_timing') {
|
|
4457
|
4457
|
$geodir_timing = sanitize_text_field($row[$c]);
|
|
4458
|
|
- } else if ( $column == 'geodir_contact' ) {
|
|
|
4458
|
+ } else if ($column == 'geodir_contact') {
|
|
4459
|
4459
|
$geodir_contact = sanitize_text_field($row[$c]);
|
|
4460
|
|
- } else if ( $column == 'geodir_email' ) {
|
|
|
4460
|
+ } else if ($column == 'geodir_email') {
|
|
4461
|
4461
|
$geodir_email = sanitize_email($row[$c]);
|
|
4462
|
|
- } else if ( $column == 'geodir_website' ) {
|
|
|
4462
|
+ } else if ($column == 'geodir_website') {
|
|
4463
|
4463
|
$geodir_website = sanitize_text_field($row[$c]);
|
|
4464
|
|
- } else if ( $column == 'geodir_twitter' ) {
|
|
|
4464
|
+ } else if ($column == 'geodir_twitter') {
|
|
4465
|
4465
|
$geodir_twitter = sanitize_text_field($row[$c]);
|
|
4466
|
|
- } else if ( $column == 'geodir_facebook' ) {
|
|
|
4466
|
+ } else if ($column == 'geodir_facebook') {
|
|
4467
|
4467
|
$geodir_facebook = sanitize_text_field($row[$c]);
|
|
4468
|
|
- } else if ( $column == 'IMAGE' && !empty( $row[$c] ) && $row[$c] != '' ) {
|
|
|
4468
|
+ } else if ($column == 'IMAGE' && !empty($row[$c]) && $row[$c] != '') {
|
|
4469
|
4469
|
$post_images[] = $row[$c];
|
|
4470
|
|
- } else if ( $column == 'alive_days' && (int)$row[$c] > 0 ) {
|
|
4471
|
|
- $expire_date = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$row[$c] . ' days' ) );
|
|
4472
|
|
- } else if ( $column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never' ) {
|
|
|
4470
|
+ } else if ($column == 'alive_days' && (int) $row[$c] > 0) {
|
|
|
4471
|
+ $expire_date = date_i18n('Y-m-d', strtotime($current_date.'+'.(int) $row[$c].' days'));
|
|
|
4472
|
+ } else if ($column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never') {
|
|
4473
|
4473
|
$row[$c] = str_replace('/', '-', $row[$c]);
|
|
4474
|
|
- $expire_date = date_i18n( 'Y-m-d', strtotime( $row[$c] ) );
|
|
|
4474
|
+ $expire_date = date_i18n('Y-m-d', strtotime($row[$c]));
|
|
4475
|
4475
|
}
|
|
4476
|
4476
|
// WPML
|
|
4477
|
4477
|
if ($is_wpml) {
|
|
4478
|
4478
|
if ($column == 'language') {
|
|
4479
|
4479
|
$language = geodir_strtolower(trim($row[$c]));
|
|
4480
|
4480
|
} else if ($column == 'original_post_id') {
|
|
4481
|
|
- $original_post_id = (int)$row[$c];
|
|
|
4481
|
+ $original_post_id = (int) $row[$c];
|
|
4482
|
4482
|
}
|
|
4483
|
4483
|
}
|
|
4484
|
4484
|
// WPML
|
|
@@ -4493,43 +4493,43 @@ discard block |
|
|
block discarded – undo |
|
4493
|
4493
|
|
|
4494
|
4494
|
$gd_post['IMAGE'] = $post_images;
|
|
4495
|
4495
|
|
|
4496
|
|
- $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status;
|
|
4497
|
|
- $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status;
|
|
|
4496
|
+ $post_status = !empty($post_status) ? sanitize_key($post_status) : $default_status;
|
|
|
4497
|
+ $post_status = !empty($wp_post_statuses) && !isset($wp_post_statuses[$post_status]) ? $default_status : $post_status;
|
|
4498
|
4498
|
|
|
4499
|
4499
|
$valid = true;
|
|
4500
|
4500
|
|
|
4501
|
|
- if ( $post_title == '' || !in_array( $post_type, $post_types ) ) {
|
|
|
4501
|
+ if ($post_title == '' || !in_array($post_type, $post_types)) {
|
|
4502
|
4502
|
$invalid++;
|
|
4503
|
4503
|
$valid = false;
|
|
4504
|
|
- geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) );
|
|
|
4504
|
+ geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be added due to blank title/invalid post type', 'geodirectory'));
|
|
4505
|
4505
|
}
|
|
4506
|
4506
|
|
|
4507
|
|
- $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
|
|
4508
|
|
- if ( $location_allowed ) {
|
|
|
4507
|
+ $location_allowed = function_exists('geodir_cpt_no_location') && geodir_cpt_no_location($post_type) ? false : true;
|
|
|
4508
|
+ if ($location_allowed) {
|
|
4509
|
4509
|
$location_result = geodir_get_default_location();
|
|
4510
|
|
- if ( $post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '' ) {
|
|
|
4510
|
+ if ($post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '') {
|
|
4511
|
4511
|
$invalid_addr++;
|
|
4512
|
4512
|
$valid = false;
|
|
4513
|
|
- 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' ) );
|
|
4514
|
|
- } else if ( !empty( $location_result ) && $location_result->location_id == 0 ) {
|
|
4515
|
|
- 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 ) ) ) {
|
|
|
4513
|
+ 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'));
|
|
|
4514
|
+ } else if (!empty($location_result) && $location_result->location_id == 0) {
|
|
|
4515
|
+ 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))) {
|
|
4516
|
4516
|
$invalid_addr++;
|
|
4517
|
4517
|
$valid = false;
|
|
4518
|
|
- 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' ) );
|
|
|
4518
|
+ 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'));
|
|
4519
|
4519
|
} else {
|
|
4520
|
4520
|
if (!$location_manager) {
|
|
4521
|
|
- $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.
|
|
|
4521
|
+ $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.
|
|
4522
|
4522
|
}
|
|
4523
|
4523
|
}
|
|
4524
|
4524
|
}
|
|
4525
|
4525
|
}
|
|
4526
|
4526
|
|
|
4527
|
|
- if ( !$valid ) {
|
|
|
4527
|
+ if (!$valid) {
|
|
4528
|
4528
|
continue;
|
|
4529
|
4529
|
}
|
|
4530
|
4530
|
|
|
4531
|
|
- $cat_taxonomy = $post_type . 'category';
|
|
4532
|
|
- $tags_taxonomy = $post_type . '_tags';
|
|
|
4531
|
+ $cat_taxonomy = $post_type.'category';
|
|
|
4532
|
+ $tags_taxonomy = $post_type.'_tags';
|
|
4533
|
4533
|
|
|
4534
|
4534
|
if ($default_category != '' && !in_array($default_category, $post_category_arr)) {
|
|
4535
|
4535
|
$post_category_arr = array_merge(array($default_category), $post_category_arr);
|
|
@@ -4537,29 +4537,29 @@ discard block |
|
|
block discarded – undo |
|
4537
|
4537
|
|
|
4538
|
4538
|
$post_category = array();
|
|
4539
|
4539
|
$default_category_id = NULL;
|
|
4540
|
|
- if ( !empty( $post_category_arr ) ) {
|
|
4541
|
|
- foreach ( $post_category_arr as $value ) {
|
|
4542
|
|
- $category_name = wp_kses_normalize_entities( trim( $value ) );
|
|
|
4540
|
+ if (!empty($post_category_arr)) {
|
|
|
4541
|
+ foreach ($post_category_arr as $value) {
|
|
|
4542
|
+ $category_name = wp_kses_normalize_entities(trim($value));
|
|
4543
|
4543
|
|
|
4544
|
|
- if ( $category_name != '' ) {
|
|
|
4544
|
+ if ($category_name != '') {
|
|
4545
|
4545
|
$term_category = array();
|
|
4546
|
4546
|
|
|
4547
|
|
- if ( $term = get_term_by( 'name', $category_name, $cat_taxonomy ) ) {
|
|
|
4547
|
+ if ($term = get_term_by('name', $category_name, $cat_taxonomy)) {
|
|
4548
|
4548
|
$term_category = $term;
|
|
4549
|
|
- } else if ( $term = get_term_by( 'slug', $category_name, $cat_taxonomy ) ) {
|
|
|
4549
|
+ } else if ($term = get_term_by('slug', $category_name, $cat_taxonomy)) {
|
|
4550
|
4550
|
$term_category = $term;
|
|
4551
|
4551
|
} else {
|
|
4552
|
4552
|
$term_data = array();
|
|
4553
|
4553
|
$term_data['name'] = $category_name;
|
|
4554
|
4554
|
$term_data['taxonomy'] = $cat_taxonomy;
|
|
4555
|
4555
|
|
|
4556
|
|
- $term_id = geodir_imex_insert_term( $cat_taxonomy, $term_data );
|
|
4557
|
|
- if ( $term_id ) {
|
|
4558
|
|
- $term_category = get_term( $term_id, $cat_taxonomy );
|
|
|
4556
|
+ $term_id = geodir_imex_insert_term($cat_taxonomy, $term_data);
|
|
|
4557
|
+ if ($term_id) {
|
|
|
4558
|
+ $term_category = get_term($term_id, $cat_taxonomy);
|
|
4559
|
4559
|
}
|
|
4560
|
4560
|
}
|
|
4561
|
4561
|
|
|
4562
|
|
- if ( !empty( $term_category ) && !is_wp_error( $term_category ) ) {
|
|
|
4562
|
+ if (!empty($term_category) && !is_wp_error($term_category)) {
|
|
4563
|
4563
|
$post_category[] = intval($term_category->term_id);
|
|
4564
|
4564
|
|
|
4565
|
4565
|
if ($category_name == $default_category) {
|
|
@@ -4580,15 +4580,15 @@ discard block |
|
|
block discarded – undo |
|
4580
|
4580
|
$save_post['post_tags'] = $post_tags;
|
|
4581
|
4581
|
|
|
4582
|
4582
|
$saved_post_id = NULL;
|
|
4583
|
|
- if ( $import_choice == 'update' ) {
|
|
4584
|
|
- $gd_wp_error = __( 'Unable to add listing, please check the listing data.', 'geodirectory' );
|
|
|
4583
|
+ if ($import_choice == 'update') {
|
|
|
4584
|
+ $gd_wp_error = __('Unable to add listing, please check the listing data.', 'geodirectory');
|
|
4585
|
4585
|
|
|
4586
|
|
- if ( $post_id > 0 && get_post( $post_id ) ) {
|
|
|
4586
|
+ if ($post_id > 0 && get_post($post_id)) {
|
|
4587
|
4587
|
$save_post['ID'] = $post_id;
|
|
4588
|
4588
|
|
|
4589
|
|
- if ( $saved_post_id = wp_update_post( $save_post, true ) ) {
|
|
4590
|
|
- if ( is_wp_error( $saved_post_id ) ) {
|
|
4591
|
|
- $gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error;
|
|
|
4589
|
+ if ($saved_post_id = wp_update_post($save_post, true)) {
|
|
|
4590
|
+ if (is_wp_error($saved_post_id)) {
|
|
|
4591
|
+ $gd_wp_error = $saved_post_id->get_error_message().' '.$wp_chars_error;
|
|
4592
|
4592
|
$saved_post_id = 0;
|
|
4593
|
4593
|
} else {
|
|
4594
|
4594
|
$saved_post_id = $post_id;
|
|
@@ -4596,9 +4596,9 @@ discard block |
|
|
block discarded – undo |
|
4596
|
4596
|
}
|
|
4597
|
4597
|
}
|
|
4598
|
4598
|
} else {
|
|
4599
|
|
- if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
|
|
4600
|
|
- if ( is_wp_error( $saved_post_id ) ) {
|
|
4601
|
|
- $gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error;
|
|
|
4599
|
+ if ($saved_post_id = wp_insert_post($save_post, true)) {
|
|
|
4600
|
+ if (is_wp_error($saved_post_id)) {
|
|
|
4601
|
+ $gd_wp_error = $saved_post_id->get_error_message().' '.$wp_chars_error;
|
|
4602
|
4602
|
$saved_post_id = 0;
|
|
4603
|
4603
|
} else {
|
|
4604
|
4604
|
$created++;
|
|
@@ -4606,19 +4606,19 @@ discard block |
|
|
block discarded – undo |
|
4606
|
4606
|
}
|
|
4607
|
4607
|
}
|
|
4608
|
4608
|
|
|
4609
|
|
- if ( !$saved_post_id > 0 ) {
|
|
|
4609
|
+ if (!$saved_post_id > 0) {
|
|
4610
|
4610
|
$invalid++;
|
|
4611
|
|
- geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_wp_error );
|
|
|
4611
|
+ geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_wp_error);
|
|
4612
|
4612
|
}
|
|
4613
|
|
- } else if ( $import_choice == 'skip' ) {
|
|
4614
|
|
- if ( $post_id > 0 && get_post( $post_id ) ) {
|
|
|
4613
|
+ } else if ($import_choice == 'skip') {
|
|
|
4614
|
+ if ($post_id > 0 && get_post($post_id)) {
|
|
4615
|
4615
|
$skipped++;
|
|
4616
|
4616
|
} else {
|
|
4617
|
|
- if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
|
|
4618
|
|
- if ( is_wp_error( $saved_post_id ) ) {
|
|
|
4617
|
+ if ($saved_post_id = wp_insert_post($save_post, true)) {
|
|
|
4618
|
+ if (is_wp_error($saved_post_id)) {
|
|
4619
|
4619
|
$invalid++;
|
|
4620
|
4620
|
|
|
4621
|
|
- geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $saved_post_id->get_error_message() . ' ' . $wp_chars_error );
|
|
|
4621
|
+ geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$saved_post_id->get_error_message().' '.$wp_chars_error);
|
|
4622
|
4622
|
$saved_post_id = 0;
|
|
4623
|
4623
|
} else {
|
|
4624
|
4624
|
$created++;
|
|
@@ -4626,28 +4626,28 @@ discard block |
|
|
block discarded – undo |
|
4626
|
4626
|
} else {
|
|
4627
|
4627
|
$invalid++;
|
|
4628
|
4628
|
|
|
4629
|
|
- geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error );
|
|
|
4629
|
+ geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$wp_chars_error);
|
|
4630
|
4630
|
}
|
|
4631
|
4631
|
}
|
|
4632
|
4632
|
} else {
|
|
4633
|
4633
|
$invalid++;
|
|
4634
|
4634
|
|
|
4635
|
|
- geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error );
|
|
|
4635
|
+ geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$wp_chars_error);
|
|
4636
|
4636
|
}
|
|
4637
|
4637
|
|
|
4638
|
|
- if ( (int)$saved_post_id > 0 ) {
|
|
|
4638
|
+ if ((int) $saved_post_id > 0) {
|
|
4639
|
4639
|
// WPML
|
|
4640
|
4640
|
if ($is_wpml && $original_post_id > 0 && $language != '') {
|
|
4641
|
|
- $wpml_post_type = 'post_' . $post_type;
|
|
4642
|
|
- $source_language = geodir_get_language_for_element( $original_post_id, $wpml_post_type );
|
|
|
4641
|
+ $wpml_post_type = 'post_'.$post_type;
|
|
|
4642
|
+ $source_language = geodir_get_language_for_element($original_post_id, $wpml_post_type);
|
|
4643
|
4643
|
$source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
|
|
4644
|
4644
|
|
|
4645
|
|
- $trid = $sitepress->get_element_trid( $original_post_id, $wpml_post_type );
|
|
|
4645
|
+ $trid = $sitepress->get_element_trid($original_post_id, $wpml_post_type);
|
|
4646
|
4646
|
|
|
4647
|
|
- $sitepress->set_element_language_details( $saved_post_id, $wpml_post_type, $trid, $language, $source_language );
|
|
|
4647
|
+ $sitepress->set_element_language_details($saved_post_id, $wpml_post_type, $trid, $language, $source_language);
|
|
4648
|
4648
|
}
|
|
4649
|
4649
|
// WPML
|
|
4650
|
|
- $gd_post_info = geodir_get_post_info( $saved_post_id );
|
|
|
4650
|
+ $gd_post_info = geodir_get_post_info($saved_post_id);
|
|
4651
|
4651
|
|
|
4652
|
4652
|
$gd_post['post_id'] = $saved_post_id;
|
|
4653
|
4653
|
$gd_post['ID'] = $saved_post_id;
|
|
@@ -4659,7 +4659,7 @@ discard block |
|
|
block discarded – undo |
|
4659
|
4659
|
|
|
4660
|
4660
|
// post location
|
|
4661
|
4661
|
$post_location_id = 0;
|
|
4662
|
|
- if ( $location_allowed && !empty( $location_result ) && $location_result->location_id > 0 ) {
|
|
|
4662
|
+ if ($location_allowed && !empty($location_result) && $location_result->location_id > 0) {
|
|
4663
|
4663
|
$gd_post['post_neighbourhood'] = '';
|
|
4664
|
4664
|
|
|
4665
|
4665
|
$post_location_info = array(
|
|
@@ -4669,7 +4669,7 @@ discard block |
|
|
block discarded – undo |
|
4669
|
4669
|
'geo_lat' => $post_latitude,
|
|
4670
|
4670
|
'geo_lng' => $post_longitude
|
|
4671
|
4671
|
);
|
|
4672
|
|
- if ( $location_id = (int)geodir_add_new_location( $post_location_info ) ) {
|
|
|
4672
|
+ if ($location_id = (int) geodir_add_new_location($post_location_info)) {
|
|
4673
|
4673
|
$post_location_id = $location_id;
|
|
4674
|
4674
|
}
|
|
4675
|
4675
|
|
|
@@ -4707,14 +4707,14 @@ discard block |
|
|
block discarded – undo |
|
4707
|
4707
|
$gd_post['post_location_id'] = $post_location_id;
|
|
4708
|
4708
|
|
|
4709
|
4709
|
// post package info
|
|
4710
|
|
- $package_id = isset( $gd_post['package_id'] ) && !empty( $gd_post['package_id'] ) ? (int)$gd_post['package_id'] : 0;
|
|
|
4710
|
+ $package_id = isset($gd_post['package_id']) && !empty($gd_post['package_id']) ? (int) $gd_post['package_id'] : 0;
|
|
4711
|
4711
|
if (!$package_id && !empty($gd_post_info) && isset($gd_post_info->package_id) && $gd_post_info->package_id) {
|
|
4712
|
4712
|
$package_id = $gd_post_info->package_id;
|
|
4713
|
4713
|
}
|
|
4714
|
4714
|
|
|
4715
|
4715
|
$package_info = array();
|
|
4716
|
4716
|
if ($package_id && function_exists('geodir_get_package_info_by_id')) {
|
|
4717
|
|
- $package_info = (array)geodir_get_package_info_by_id($package_id);
|
|
|
4717
|
+ $package_info = (array) geodir_get_package_info_by_id($package_id);
|
|
4718
|
4718
|
|
|
4719
|
4719
|
if (!(!empty($package_info) && isset($package_info['post_type']) && $package_info['post_type'] == $post_type)) {
|
|
4720
|
4720
|
$package_info = array();
|
|
@@ -4722,18 +4722,18 @@ discard block |
|
|
block discarded – undo |
|
4722
|
4722
|
}
|
|
4723
|
4723
|
|
|
4724
|
4724
|
if (empty($package_info)) {
|
|
4725
|
|
- $package_info = (array)geodir_post_package_info( array(), '', $post_type );
|
|
|
4725
|
+ $package_info = (array) geodir_post_package_info(array(), '', $post_type);
|
|
4726
|
4726
|
}
|
|
4727
|
4727
|
|
|
4728
|
|
- if (!empty($package_info)) {
|
|
|
4728
|
+ if (!empty($package_info)) {
|
|
4729
|
4729
|
$package_id = $package_info['pid'];
|
|
4730
|
4730
|
|
|
4731
|
4731
|
if (isset($gd_post['alive_days']) || isset($gd_post['expire_date'])) {
|
|
4732
|
4732
|
$gd_post['expire_date'] = $expire_date;
|
|
4733
|
4733
|
} else {
|
|
4734
|
|
- if ( isset( $package_info['days'] ) && (int)$package_info['days'] > 0 ) {
|
|
4735
|
|
- $gd_post['alive_days'] = (int)$package_info['days'];
|
|
4736
|
|
- $gd_post['expire_date'] = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$package_info['days'] . ' days' ) );
|
|
|
4734
|
+ if (isset($package_info['days']) && (int) $package_info['days'] > 0) {
|
|
|
4735
|
+ $gd_post['alive_days'] = (int) $package_info['days'];
|
|
|
4736
|
+ $gd_post['expire_date'] = date_i18n('Y-m-d', strtotime($current_date.'+'.(int) $package_info['days'].' days'));
|
|
4737
|
4737
|
} else {
|
|
4738
|
4738
|
$gd_post['expire_date'] = 'Never';
|
|
4739
|
4739
|
}
|
|
@@ -4742,7 +4742,7 @@ discard block |
|
|
block discarded – undo |
|
4742
|
4742
|
$gd_post['package_id'] = $package_id;
|
|
4743
|
4743
|
}
|
|
4744
|
4744
|
|
|
4745
|
|
- $table = $plugin_prefix . $post_type . '_detail';
|
|
|
4745
|
+ $table = $plugin_prefix.$post_type.'_detail';
|
|
4746
|
4746
|
|
|
4747
|
4747
|
if ($post_type == 'gd_event') {
|
|
4748
|
4748
|
$gd_post = geodir_imex_process_event_data($gd_post);
|
|
@@ -4753,28 +4753,28 @@ discard block |
|
|
block discarded – undo |
|
4753
|
4753
|
}
|
|
4754
|
4754
|
|
|
4755
|
4755
|
// Export franchise fields
|
|
4756
|
|
- $is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false;
|
|
|
4756
|
+ $is_franchise_active = is_plugin_active('geodir_franchise/geodir_franchise.php') && geodir_franchise_enabled($post_type) ? true : false;
|
|
4757
|
4757
|
if ($is_franchise_active) {
|
|
4758
|
|
- if ( isset( $gd_post['gd_is_franchise'] ) && (int)$gd_post['gd_is_franchise'] == 1 ) {
|
|
|
4758
|
+ if (isset($gd_post['gd_is_franchise']) && (int) $gd_post['gd_is_franchise'] == 1) {
|
|
4759
|
4759
|
$gd_franchise_lock = array();
|
|
4760
|
4760
|
|
|
4761
|
|
- if ( isset( $gd_post['gd_franchise_lock'] ) ) {
|
|
4762
|
|
- $gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock'] );
|
|
4763
|
|
- $gd_franchise_lock = trim( $gd_franchise_lock );
|
|
4764
|
|
- $gd_franchise_lock = explode( ",", $gd_franchise_lock );
|
|
|
4761
|
+ if (isset($gd_post['gd_franchise_lock'])) {
|
|
|
4762
|
+ $gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock']);
|
|
|
4763
|
+ $gd_franchise_lock = trim($gd_franchise_lock);
|
|
|
4764
|
+ $gd_franchise_lock = explode(",", $gd_franchise_lock);
|
|
4765
|
4765
|
}
|
|
4766
|
4766
|
|
|
4767
|
|
- update_post_meta( $saved_post_id, 'gd_is_franchise', 1 );
|
|
4768
|
|
- update_post_meta( $saved_post_id, 'gd_franchise_lock', $gd_franchise_lock );
|
|
|
4767
|
+ update_post_meta($saved_post_id, 'gd_is_franchise', 1);
|
|
|
4768
|
+ update_post_meta($saved_post_id, 'gd_franchise_lock', $gd_franchise_lock);
|
|
4769
|
4769
|
} else {
|
|
4770
|
|
- if ( isset( $gd_post['franchise'] ) && (int)$gd_post['franchise'] > 0 && geodir_franchise_check( (int)$gd_post['franchise'] ) ) {
|
|
4771
|
|
- geodir_save_post_meta( $saved_post_id, 'franchise', (int)$gd_post['franchise'] );
|
|
|
4770
|
+ if (isset($gd_post['franchise']) && (int) $gd_post['franchise'] > 0 && geodir_franchise_check((int) $gd_post['franchise'])) {
|
|
|
4771
|
+ geodir_save_post_meta($saved_post_id, 'franchise', (int) $gd_post['franchise']);
|
|
4772
|
4772
|
}
|
|
4773
|
4773
|
}
|
|
4774
|
4774
|
}
|
|
4775
|
4775
|
|
|
4776
|
4776
|
if (!empty($save_post['post_category']) && is_array($save_post['post_category'])) {
|
|
4777
|
|
- $save_post['post_category'] = array_unique( array_map( 'intval', $save_post['post_category'] ) );
|
|
|
4777
|
+ $save_post['post_category'] = array_unique(array_map('intval', $save_post['post_category']));
|
|
4778
|
4778
|
if ($default_category_id) {
|
|
4779
|
4779
|
$save_post['post_default_category'] = $default_category_id;
|
|
4780
|
4780
|
$gd_post['default_category'] = $default_category_id;
|
|
@@ -4783,34 +4783,34 @@ discard block |
|
|
block discarded – undo |
|
4783
|
4783
|
}
|
|
4784
|
4784
|
|
|
4785
|
4785
|
// Save post info
|
|
4786
|
|
- geodir_save_post_info( $saved_post_id, $gd_post );
|
|
|
4786
|
+ geodir_save_post_info($saved_post_id, $gd_post);
|
|
4787
|
4787
|
// post taxonomies
|
|
4788
|
|
- if ( !empty( $save_post['post_category'] ) ) {
|
|
4789
|
|
- wp_set_object_terms( $saved_post_id, $save_post['post_category'], $cat_taxonomy );
|
|
|
4788
|
+ if (!empty($save_post['post_category'])) {
|
|
|
4789
|
+ wp_set_object_terms($saved_post_id, $save_post['post_category'], $cat_taxonomy);
|
|
4790
|
4790
|
|
|
4791
|
|
- $post_default_category = isset( $save_post['post_default_category'] ) ? $save_post['post_default_category'] : '';
|
|
|
4791
|
+ $post_default_category = isset($save_post['post_default_category']) ? $save_post['post_default_category'] : '';
|
|
4792
|
4792
|
if ($default_category_id) {
|
|
4793
|
4793
|
$post_default_category = $default_category_id;
|
|
4794
|
4794
|
}
|
|
4795
|
4795
|
$post_cat_ids = geodir_get_post_meta($saved_post_id, $cat_taxonomy);
|
|
4796
|
4796
|
$save_post['post_category'] = !empty($post_cat_ids) ? explode(",", trim($post_cat_ids, ",")) : $save_post['post_category'];
|
|
4797
|
|
- $post_category_str = !empty($save_post['post_category']) ? implode(",y:#", $save_post['post_category']) . ',y:' : '';
|
|
|
4797
|
+ $post_category_str = !empty($save_post['post_category']) ? implode(",y:#", $save_post['post_category']).',y:' : '';
|
|
4798
|
4798
|
|
|
4799
|
4799
|
if ($post_category_str != '' && $post_default_category) {
|
|
4800
|
|
- $post_category_str = str_replace($post_default_category . ',y:', $post_default_category . ',y,d:', $post_category_str);
|
|
|
4800
|
+ $post_category_str = str_replace($post_default_category.',y:', $post_default_category.',y,d:', $post_category_str);
|
|
4801
|
4801
|
}
|
|
4802
|
4802
|
|
|
4803
|
4803
|
$post_category_str = $post_category_str != '' ? array($cat_taxonomy => $post_category_str) : '';
|
|
4804
|
4804
|
|
|
4805
|
|
- geodir_set_postcat_structure( $saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str );
|
|
|
4805
|
+ geodir_set_postcat_structure($saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str);
|
|
4806
|
4806
|
}
|
|
4807
|
4807
|
|
|
4808
|
|
- if ( !empty( $save_post['post_tags'] ) ) {
|
|
4809
|
|
- wp_set_object_terms( $saved_post_id, $save_post['post_tags'], $tags_taxonomy );
|
|
|
4808
|
+ if (!empty($save_post['post_tags'])) {
|
|
|
4809
|
+ wp_set_object_terms($saved_post_id, $save_post['post_tags'], $tags_taxonomy);
|
|
4810
|
4810
|
}
|
|
4811
|
4811
|
|
|
4812
|
4812
|
// Post images
|
|
4813
|
|
- if ( !empty( $post_images ) ) {
|
|
|
4813
|
+ if (!empty($post_images)) {
|
|
4814
|
4814
|
$post_images = array_unique($post_images);
|
|
4815
|
4815
|
|
|
4816
|
4816
|
$old_post_images_arr = array();
|
|
@@ -4818,61 +4818,61 @@ discard block |
|
|
block discarded – undo |
|
4818
|
4818
|
|
|
4819
|
4819
|
$order = 1;
|
|
4820
|
4820
|
|
|
4821
|
|
- $old_post_images = geodir_get_images( $saved_post_id );
|
|
|
4821
|
+ $old_post_images = geodir_get_images($saved_post_id);
|
|
4822
|
4822
|
if (!empty($old_post_images)) {
|
|
4823
|
|
- foreach( $old_post_images as $old_post_image ) {
|
|
|
4823
|
+ foreach ($old_post_images as $old_post_image) {
|
|
4824
|
4824
|
if (!empty($old_post_image) && isset($old_post_image->file) && $old_post_image->file != '') {
|
|
4825
|
4825
|
$old_post_images_arr[] = $old_post_image->file;
|
|
4826
|
4826
|
}
|
|
4827
|
4827
|
}
|
|
4828
|
4828
|
}
|
|
4829
|
4829
|
|
|
4830
|
|
- foreach ( $post_images as $post_image ) {
|
|
4831
|
|
- $image_name = basename( $post_image );
|
|
|
4830
|
+ foreach ($post_images as $post_image) {
|
|
|
4831
|
+ $image_name = basename($post_image);
|
|
4832
|
4832
|
$saved_post_images_arr[] = $image_name;
|
|
4833
|
4833
|
|
|
4834
|
|
- if (!empty($old_post_images_arr) && in_array( $image_name, $old_post_images_arr) ) {
|
|
|
4834
|
+ if (!empty($old_post_images_arr) && in_array($image_name, $old_post_images_arr)) {
|
|
4835
|
4835
|
continue; // Skip if image already exists.
|
|
4836
|
4836
|
}
|
|
4837
|
4837
|
|
|
4838
|
|
- $image_name_parts = explode( '.', $image_name );
|
|
4839
|
|
- array_pop( $image_name_parts );
|
|
4840
|
|
- $proper_image_name = implode( '.', $image_name_parts );
|
|
|
4838
|
+ $image_name_parts = explode('.', $image_name);
|
|
|
4839
|
+ array_pop($image_name_parts);
|
|
|
4840
|
+ $proper_image_name = implode('.', $image_name_parts);
|
|
4841
|
4841
|
|
|
4842
|
|
- $arr_file_type = wp_check_filetype( $image_name );
|
|
|
4842
|
+ $arr_file_type = wp_check_filetype($image_name);
|
|
4843
|
4843
|
|
|
4844
|
|
- if ( !empty( $arr_file_type ) ) {
|
|
|
4844
|
+ if (!empty($arr_file_type)) {
|
|
4845
|
4845
|
$uploaded_file_type = $arr_file_type['type'];
|
|
4846
|
4846
|
|
|
4847
|
4847
|
$attachment = array();
|
|
4848
|
4848
|
$attachment['post_id'] = $saved_post_id;
|
|
4849
|
4849
|
$attachment['title'] = $proper_image_name;
|
|
4850
|
4850
|
$attachment['content'] = '';
|
|
4851
|
|
- $attachment['file'] = $uploads_subdir . '/' . $image_name;
|
|
|
4851
|
+ $attachment['file'] = $uploads_subdir.'/'.$image_name;
|
|
4852
|
4852
|
$attachment['mime_type'] = $uploaded_file_type;
|
|
4853
|
4853
|
$attachment['menu_order'] = $order;
|
|
4854
|
4854
|
$attachment['is_featured'] = 0;
|
|
4855
|
4855
|
|
|
4856
|
4856
|
$attachment_set = '';
|
|
4857
|
|
- foreach ( $attachment as $key => $val ) {
|
|
4858
|
|
- if ( $val != '' ) {
|
|
4859
|
|
- $attachment_set .= $key . " = '" . $val . "', ";
|
|
|
4857
|
+ foreach ($attachment as $key => $val) {
|
|
|
4858
|
+ if ($val != '') {
|
|
|
4859
|
+ $attachment_set .= $key." = '".$val."', ";
|
|
4860
|
4860
|
}
|
|
4861
|
4861
|
}
|
|
4862
|
|
- $attachment_set = trim( $attachment_set, ", " );
|
|
|
4862
|
+ $attachment_set = trim($attachment_set, ", ");
|
|
4863
|
4863
|
|
|
4864
|
4864
|
// Add new attachment
|
|
4865
|
|
- $wpdb->query( "INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set );
|
|
|
4865
|
+ $wpdb->query("INSERT INTO ".GEODIR_ATTACHMENT_TABLE." SET ".$attachment_set);
|
|
4866
|
4866
|
|
|
4867
|
4867
|
$order++;
|
|
4868
|
4868
|
}
|
|
4869
|
4869
|
}
|
|
4870
|
4870
|
|
|
4871
|
|
- $saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/" . implode("' AND file NOT LIKE '%/", $saved_post_images_arr) . "' )" : '';
|
|
|
4871
|
+ $saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/".implode("' AND file NOT LIKE '%/", $saved_post_images_arr)."' )" : '';
|
|
4872
|
4872
|
// Remove previous attachment
|
|
4873
|
|
- $wpdb->query( "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = " . (int)$saved_post_id . " " . $saved_post_images_sql );
|
|
|
4873
|
+ $wpdb->query("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id = ".(int) $saved_post_id." ".$saved_post_images_sql);
|
|
4874
|
4874
|
|
|
4875
|
|
- if ( !empty( $saved_post_images_arr ) ) {
|
|
|
4875
|
+ if (!empty($saved_post_images_arr)) {
|
|
4876
|
4876
|
geodir_set_wp_featured_image($saved_post_id);
|
|
4877
|
4877
|
/*
|
|
4878
|
4878
|
$menu_order = 1;
|
|
@@ -4889,13 +4889,13 @@ discard block |
|
|
block discarded – undo |
|
4889
|
4889
|
}*/
|
|
4890
|
4890
|
}
|
|
4891
|
4891
|
|
|
4892
|
|
- if ( $order > 1 ) {
|
|
|
4892
|
+ if ($order > 1) {
|
|
4893
|
4893
|
$images++;
|
|
4894
|
4894
|
}
|
|
4895
|
4895
|
}
|
|
4896
|
4896
|
|
|
4897
|
4897
|
/** This action is documented in geodirectory-functions/post-functions.php */
|
|
4898
|
|
- do_action( 'geodir_after_save_listing', $saved_post_id, $gd_post );
|
|
|
4898
|
+ do_action('geodir_after_save_listing', $saved_post_id, $gd_post);
|
|
4899
|
4899
|
|
|
4900
|
4900
|
if (isset($is_featured)) {
|
|
4901
|
4901
|
geodir_save_post_meta($saved_post_id, 'is_featured', $is_featured);
|
|
@@ -4915,10 +4915,10 @@ discard block |
|
|
block discarded – undo |
|
4915
|
4915
|
}
|
|
4916
|
4916
|
|
|
4917
|
4917
|
//undo some stuff to make the import quicker
|
|
4918
|
|
- wp_defer_term_counting( false );
|
|
4919
|
|
- wp_defer_comment_counting( false );
|
|
4920
|
|
- $wpdb->query( 'COMMIT;' );
|
|
4921
|
|
- $wpdb->query( 'SET autocommit = 1;' );
|
|
|
4918
|
+ wp_defer_term_counting(false);
|
|
|
4919
|
+ wp_defer_comment_counting(false);
|
|
|
4920
|
+ $wpdb->query('COMMIT;');
|
|
|
4921
|
+ $wpdb->query('SET autocommit = 1;');
|
|
4922
|
4922
|
|
|
4923
|
4923
|
$json = array();
|
|
4924
|
4924
|
$json['processed'] = $processed_actual;
|
|
@@ -4929,9 +4929,9 @@ discard block |
|
|
block discarded – undo |
|
4929
|
4929
|
$json['invalid_addr'] = $invalid_addr;
|
|
4930
|
4930
|
$json['images'] = $images;
|
|
4931
|
4931
|
|
|
4932
|
|
- wp_send_json( $json );
|
|
|
4932
|
+ wp_send_json($json);
|
|
4933
|
4933
|
exit;
|
|
4934
|
|
- } else if ( $task == 'import_loc' ) {
|
|
|
4934
|
+ } else if ($task == 'import_loc') {
|
|
4935
|
4935
|
global $gd_post_types;
|
|
4936
|
4936
|
$gd_post_types = $post_types;
|
|
4937
|
4937
|
|
|
@@ -4940,82 +4940,82 @@ discard block |
|
|
block discarded – undo |
|
4940
|
4940
|
|
|
4941
|
4941
|
if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
|
|
4942
|
4942
|
$json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
|
|
4943
|
|
- wp_send_json( $json );
|
|
|
4943
|
+ wp_send_json($json);
|
|
4944
|
4944
|
}
|
|
4945
|
4945
|
|
|
4946
|
4946
|
$gd_error_log = __('GD IMPORT LOCATIONS [ROW %d]:', 'geodirectory');
|
|
4947
|
|
- $gd_error_location = __( 'Could not be saved due to blank/invalid address(city, region, country, latitude, longitude)', 'geodirectory' );
|
|
|
4947
|
+ $gd_error_location = __('Could not be saved due to blank/invalid address(city, region, country, latitude, longitude)', 'geodirectory');
|
|
4948
|
4948
|
for ($i = 1; $i <= $limit; $i++) {
|
|
4949
|
4949
|
$index = $processed + $i;
|
|
4950
|
4950
|
|
|
4951
|
4951
|
if (isset($file[$index])) {
|
|
4952
|
4952
|
$row = $file[$index];
|
|
4953
|
|
- $row = array_map( 'trim', $row );
|
|
|
4953
|
+ $row = array_map('trim', $row);
|
|
4954
|
4954
|
$data = array();
|
|
4955
|
4955
|
|
|
4956
|
|
- foreach ($columns as $c => $column ) {
|
|
|
4956
|
+ foreach ($columns as $c => $column) {
|
|
4957
|
4957
|
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'))) {
|
|
4958
|
4958
|
$data[$column] = $row[$c];
|
|
4959
|
4959
|
}
|
|
4960
|
4960
|
}
|
|
4961
|
4961
|
|
|
4962
|
|
- if ( empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude']) ) {
|
|
|
4962
|
+ if (empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude'])) {
|
|
4963
|
4963
|
$invalid++;
|
|
4964
|
|
- geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
|
|
|
4964
|
+ geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location);
|
|
4965
|
4965
|
continue;
|
|
4966
|
4966
|
}
|
|
4967
|
4967
|
|
|
4968
|
4968
|
$data['location_id'] = isset($data['location_id']) ? absint($data['location_id']) : 0;
|
|
4969
|
4969
|
|
|
4970
|
|
- if ( $import_choice == 'update' ) {
|
|
4971
|
|
- if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
|
|
4972
|
|
- if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
|
|
|
4970
|
+ if ($import_choice == 'update') {
|
|
|
4971
|
+ if ((int) $data['location_id'] > 0 && $location = geodir_get_location_by_id('', (int) $data['location_id'])) {
|
|
|
4972
|
+ if ($location_id = geodir_location_update_city($data, true, $location)) {
|
|
4973
|
4973
|
$updated++;
|
|
4974
|
4974
|
} else {
|
|
4975
|
4975
|
$invalid++;
|
|
4976
|
|
- geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
|
|
|
4976
|
+ geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location);
|
|
4977
|
4977
|
}
|
|
4978
|
|
- } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
|
|
4979
|
|
- $data['location_id'] = (int)$location->location_id;
|
|
|
4978
|
+ } else if (!empty($data['city_slug']) && $location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug']))) {
|
|
|
4979
|
+ $data['location_id'] = (int) $location->location_id;
|
|
4980
|
4980
|
|
|
4981
|
|
- if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region'] ) ) ) {
|
|
4982
|
|
- $data['location_id'] = (int)$location->location_id;
|
|
4983
|
|
- } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'region' => $data['region'] ) ) ) {
|
|
4984
|
|
- $data['location_id'] = (int)$location->location_id;
|
|
4985
|
|
- } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'] ) ) ) {
|
|
4986
|
|
- $data['location_id'] = (int)$location->location_id;
|
|
|
4981
|
+ if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region']))) {
|
|
|
4982
|
+ $data['location_id'] = (int) $location->location_id;
|
|
|
4983
|
+ } else if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'region' => $data['region']))) {
|
|
|
4984
|
+ $data['location_id'] = (int) $location->location_id;
|
|
|
4985
|
+ } else if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'country' => $data['country']))) {
|
|
|
4986
|
+ $data['location_id'] = (int) $location->location_id;
|
|
4987
|
4987
|
}
|
|
4988
|
4988
|
|
|
4989
|
|
- if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
|
|
|
4989
|
+ if ($location_id = geodir_location_update_city($data, true, $location)) {
|
|
4990
|
4990
|
$updated++;
|
|
4991
|
4991
|
} else {
|
|
4992
|
4992
|
$invalid++;
|
|
4993
|
|
- geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
|
|
|
4993
|
+ geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location);
|
|
4994
|
4994
|
}
|
|
4995
|
4995
|
} else {
|
|
4996
|
|
- if ( $location_id = geodir_location_insert_city( $data, true ) ) {
|
|
|
4996
|
+ if ($location_id = geodir_location_insert_city($data, true)) {
|
|
4997
|
4997
|
$created++;
|
|
4998
|
4998
|
} else {
|
|
4999
|
4999
|
$invalid++;
|
|
5000
|
|
- geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
|
|
|
5000
|
+ geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location);
|
|
5001
|
5001
|
}
|
|
5002
|
5002
|
}
|
|
5003
|
|
- } elseif ( $import_choice == 'skip' ) {
|
|
5004
|
|
- if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
|
|
|
5003
|
+ } elseif ($import_choice == 'skip') {
|
|
|
5004
|
+ if ((int) $data['location_id'] > 0 && $location = geodir_get_location_by_id('', (int) $data['location_id'])) {
|
|
5005
|
5005
|
$skipped++;
|
|
5006
|
|
- } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
|
|
|
5006
|
+ } else if (!empty($data['city_slug']) && $location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug']))) {
|
|
5007
|
5007
|
$skipped++;
|
|
5008
|
5008
|
} else {
|
|
5009
|
|
- if ( $location_id = geodir_location_insert_city( $data, true ) ) {
|
|
|
5009
|
+ if ($location_id = geodir_location_insert_city($data, true)) {
|
|
5010
|
5010
|
$created++;
|
|
5011
|
5011
|
} else {
|
|
5012
|
5012
|
$invalid++;
|
|
5013
|
|
- geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
|
|
|
5013
|
+ geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location);
|
|
5014
|
5014
|
}
|
|
5015
|
5015
|
}
|
|
5016
|
5016
|
} else {
|
|
5017
|
5017
|
$invalid++;
|
|
5018
|
|
- geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
|
|
|
5018
|
+ geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location);
|
|
5019
|
5019
|
}
|
|
5020
|
5020
|
}
|
|
5021
|
5021
|
}
|
|
@@ -5029,24 +5029,24 @@ discard block |
|
|
block discarded – undo |
|
5029
|
5029
|
$json['invalid'] = $invalid;
|
|
5030
|
5030
|
$json['images'] = $images;
|
|
5031
|
5031
|
|
|
5032
|
|
- wp_send_json( $json );
|
|
5033
|
|
- } else if ( $task == 'import_hood' ) {
|
|
|
5032
|
+ wp_send_json($json);
|
|
|
5033
|
+ } else if ($task == 'import_hood') {
|
|
5034
|
5034
|
if (!empty($file)) {
|
|
5035
|
5035
|
$columns = isset($file[0]) ? $file[0] : NULL;
|
|
5036
|
5036
|
|
|
5037
|
5037
|
if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
|
|
5038
|
5038
|
$json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
|
|
5039
|
|
- wp_send_json( $json );
|
|
|
5039
|
+ wp_send_json($json);
|
|
5040
|
5040
|
}
|
|
5041
|
5041
|
|
|
5042
|
5042
|
$gd_error_log = __('GD IMPORT NEIGHBOURHOODS [ROW %d]:', 'geodirectory');
|
|
5043
|
|
- $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' );
|
|
|
5043
|
+ $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');
|
|
5044
|
5044
|
for ($i = 1; $i <= $limit; $i++) {
|
|
5045
|
5045
|
$index = $processed + $i;
|
|
5046
|
5046
|
|
|
5047
|
5047
|
if (isset($file[$index])) {
|
|
5048
|
5048
|
$row = $file[$index];
|
|
5049
|
|
- $row = array_map( 'trim', $row );
|
|
|
5049
|
+ $row = array_map('trim', $row);
|
|
5050
|
5050
|
$data = array();
|
|
5051
|
5051
|
|
|
5052
|
5052
|
foreach ($columns as $c => $column) {
|
|
@@ -5057,20 +5057,20 @@ discard block |
|
|
block discarded – undo |
|
5057
|
5057
|
|
|
5058
|
5058
|
if (empty($data['neighbourhood_name']) || empty($data['latitude']) || empty($data['longitude'])) {
|
|
5059
|
5059
|
$invalid++;
|
|
5060
|
|
- geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
|
|
|
5060
|
+ geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
|
|
5061
|
5061
|
continue;
|
|
5062
|
5062
|
}
|
|
5063
|
5063
|
|
|
5064
|
5064
|
$location_info = array();
|
|
5065
|
|
- if (!empty($data['location_id']) && (int)$data['location_id'] > 0) {
|
|
5066
|
|
- $location_info = geodir_get_location_by_id('', (int)$data['location_id']);
|
|
|
5065
|
+ if (!empty($data['location_id']) && (int) $data['location_id'] > 0) {
|
|
|
5066
|
+ $location_info = geodir_get_location_by_id('', (int) $data['location_id']);
|
|
5067
|
5067
|
} else if (!empty($data['city']) && !empty($data['region']) && !empty($data['country'])) {
|
|
5068
|
5068
|
$location_info = geodir_get_location_by_slug('city', array('fields' => 'location_id', 'city' => $data['city'], 'country' => $data['country'], 'region' => $data['region']));
|
|
5069
|
5069
|
}
|
|
5070
|
5070
|
|
|
5071
|
5071
|
if (empty($location_info)) {
|
|
5072
|
5072
|
$invalid++;
|
|
5073
|
|
- geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
|
|
|
5073
|
+ geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
|
|
5074
|
5074
|
continue;
|
|
5075
|
5075
|
}
|
|
5076
|
5076
|
|
|
@@ -5085,35 +5085,35 @@ discard block |
|
|
block discarded – undo |
|
5085
|
5085
|
$hood_data['hood_longitude'] = $data['longitude'];
|
|
5086
|
5086
|
$hood_data['hood_location_id'] = $location_id;
|
|
5087
|
5087
|
|
|
5088
|
|
- if ( $import_choice == 'update' ) {
|
|
5089
|
|
- if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
|
|
5090
|
|
- $hood_data['hood_id'] = (int)$data['neighbourhood_id'];
|
|
|
5088
|
+ if ($import_choice == 'update') {
|
|
|
5089
|
+ if ((int) $data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int) $data['neighbourhood_id']))) {
|
|
|
5090
|
+ $hood_data['hood_id'] = (int) $data['neighbourhood_id'];
|
|
5091
|
5091
|
|
|
5092
|
5092
|
if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
|
|
5093
|
5093
|
$updated++;
|
|
5094
|
5094
|
} else {
|
|
5095
|
5095
|
$invalid++;
|
|
5096
|
|
- geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
|
|
|
5096
|
+ geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
|
|
5097
|
5097
|
}
|
|
5098
|
5098
|
} else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
|
|
5099
|
|
- $hood_data['hood_id'] = (int)$neighbourhood->hood_id;
|
|
|
5099
|
+ $hood_data['hood_id'] = (int) $neighbourhood->hood_id;
|
|
5100
|
5100
|
|
|
5101
|
5101
|
if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
|
|
5102
|
5102
|
$updated++;
|
|
5103
|
5103
|
} else {
|
|
5104
|
5104
|
$invalid++;
|
|
5105
|
|
- geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
|
|
|
5105
|
+ geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
|
|
5106
|
5106
|
}
|
|
5107
|
5107
|
} else {
|
|
5108
|
5108
|
if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
|
|
5109
|
5109
|
$created++;
|
|
5110
|
5110
|
} else {
|
|
5111
|
5111
|
$invalid++;
|
|
5112
|
|
- geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
|
|
|
5112
|
+ geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
|
|
5113
|
5113
|
}
|
|
5114
|
5114
|
}
|
|
5115
|
|
- } elseif ( $import_choice == 'skip' ) {
|
|
5116
|
|
- if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
|
|
|
5115
|
+ } elseif ($import_choice == 'skip') {
|
|
|
5116
|
+ if ((int) $data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int) $data['neighbourhood_id']))) {
|
|
5117
|
5117
|
$skipped++;
|
|
5118
|
5118
|
} else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
|
|
5119
|
5119
|
$skipped++;
|
|
@@ -5123,12 +5123,12 @@ discard block |
|
|
block discarded – undo |
|
5123
|
5123
|
$created++;
|
|
5124
|
5124
|
} else {
|
|
5125
|
5125
|
$invalid++;
|
|
5126
|
|
- geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
|
|
|
5126
|
+ geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
|
|
5127
|
5127
|
}
|
|
5128
|
5128
|
}
|
|
5129
|
5129
|
} else {
|
|
5130
|
5130
|
$invalid++;
|
|
5131
|
|
- geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
|
|
|
5131
|
+ geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
|
|
5132
|
5132
|
}
|
|
5133
|
5133
|
}
|
|
5134
|
5134
|
}
|
|
@@ -5142,7 +5142,7 @@ discard block |
|
|
block discarded – undo |
|
5142
|
5142
|
$json['invalid'] = $invalid;
|
|
5143
|
5143
|
$json['images'] = $images;
|
|
5144
|
5144
|
|
|
5145
|
|
- wp_send_json( $json );
|
|
|
5145
|
+ wp_send_json($json);
|
|
5146
|
5146
|
}
|
|
5147
|
5147
|
}
|
|
5148
|
5148
|
break;
|
|
@@ -5186,29 +5186,29 @@ discard block |
|
|
block discarded – undo |
|
5186
|
5186
|
* }
|
|
5187
|
5187
|
* @return int|bool Term id when success, false when fail.
|
|
5188
|
5188
|
*/
|
|
5189
|
|
-function geodir_imex_insert_term( $taxonomy, $term_data ) {
|
|
5190
|
|
- if ( empty( $taxonomy ) || empty( $term_data ) ) {
|
|
|
5189
|
+function geodir_imex_insert_term($taxonomy, $term_data) {
|
|
|
5190
|
+ if (empty($taxonomy) || empty($term_data)) {
|
|
5191
|
5191
|
return false;
|
|
5192
|
5192
|
}
|
|
5193
|
5193
|
|
|
5194
|
|
- $term = isset( $term_data['name'] ) && !empty( $term_data['name'] ) ? $term_data['name'] : '';
|
|
|
5194
|
+ $term = isset($term_data['name']) && !empty($term_data['name']) ? $term_data['name'] : '';
|
|
5195
|
5195
|
$args = array();
|
|
5196
|
|
- $args['description'] = isset( $term_data['description'] ) ? $term_data['description'] : '';
|
|
5197
|
|
- $args['slug'] = isset( $term_data['slug'] ) ? $term_data['slug'] : '';
|
|
5198
|
|
- $args['parent'] = isset( $term_data['parent'] ) ? (int)$term_data['parent'] : '';
|
|
|
5196
|
+ $args['description'] = isset($term_data['description']) ? $term_data['description'] : '';
|
|
|
5197
|
+ $args['slug'] = isset($term_data['slug']) ? $term_data['slug'] : '';
|
|
|
5198
|
+ $args['parent'] = isset($term_data['parent']) ? (int) $term_data['parent'] : '';
|
|
5199
|
5199
|
|
|
5200
|
|
- if ( ( !empty( $args['slug'] ) && term_exists( $args['slug'], $taxonomy ) ) || empty( $args['slug'] ) ) {
|
|
5201
|
|
- $term_args = array_merge( $term_data, $args );
|
|
5202
|
|
- $defaults = array( 'alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '');
|
|
5203
|
|
- $term_args = wp_parse_args( $term_args, $defaults );
|
|
5204
|
|
- $term_args = sanitize_term( $term_args, $taxonomy, 'db' );
|
|
5205
|
|
- $args['slug'] = wp_unique_term_slug( $args['slug'], (object)$term_args );
|
|
|
5200
|
+ if ((!empty($args['slug']) && term_exists($args['slug'], $taxonomy)) || empty($args['slug'])) {
|
|
|
5201
|
+ $term_args = array_merge($term_data, $args);
|
|
|
5202
|
+ $defaults = array('alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '');
|
|
|
5203
|
+ $term_args = wp_parse_args($term_args, $defaults);
|
|
|
5204
|
+ $term_args = sanitize_term($term_args, $taxonomy, 'db');
|
|
|
5205
|
+ $args['slug'] = wp_unique_term_slug($args['slug'], (object) $term_args);
|
|
5206
|
5206
|
}
|
|
5207
|
5207
|
|
|
5208
|
|
- if( !empty( $term ) ) {
|
|
5209
|
|
- $result = wp_insert_term( $term, $taxonomy, $args );
|
|
5210
|
|
- if( !is_wp_error( $result ) ) {
|
|
5211
|
|
- return isset( $result['term_id'] ) ? $result['term_id'] : 0;
|
|
|
5208
|
+ if (!empty($term)) {
|
|
|
5209
|
+ $result = wp_insert_term($term, $taxonomy, $args);
|
|
|
5210
|
+ if (!is_wp_error($result)) {
|
|
|
5211
|
+ return isset($result['term_id']) ? $result['term_id'] : 0;
|
|
5212
|
5212
|
}
|
|
5213
|
5213
|
}
|
|
5214
|
5214
|
|
|
@@ -5238,36 +5238,36 @@ discard block |
|
|
block discarded – undo |
|
5238
|
5238
|
* }
|
|
5239
|
5239
|
* @return int|bool Term id when success, false when fail.
|
|
5240
|
5240
|
*/
|
|
5241
|
|
-function geodir_imex_update_term( $taxonomy, $term_data ) {
|
|
5242
|
|
- if ( empty( $taxonomy ) || empty( $term_data ) ) {
|
|
|
5241
|
+function geodir_imex_update_term($taxonomy, $term_data) {
|
|
|
5242
|
+ if (empty($taxonomy) || empty($term_data)) {
|
|
5243
|
5243
|
return false;
|
|
5244
|
5244
|
}
|
|
5245
|
5245
|
|
|
5246
|
|
- $term_id = isset( $term_data['term_id'] ) && !empty( $term_data['term_id'] ) ? $term_data['term_id'] : 0;
|
|
|
5246
|
+ $term_id = isset($term_data['term_id']) && !empty($term_data['term_id']) ? $term_data['term_id'] : 0;
|
|
5247
|
5247
|
|
|
5248
|
5248
|
$args = array();
|
|
5249
|
|
- $args['description'] = isset( $term_data['description'] ) ? $term_data['description'] : '';
|
|
5250
|
|
- $args['slug'] = isset( $term_data['slug'] ) ? $term_data['slug'] : '';
|
|
5251
|
|
- $args['parent'] = isset( $term_data['parent'] ) ? (int)$term_data['parent'] : '';
|
|
|
5249
|
+ $args['description'] = isset($term_data['description']) ? $term_data['description'] : '';
|
|
|
5250
|
+ $args['slug'] = isset($term_data['slug']) ? $term_data['slug'] : '';
|
|
|
5251
|
+ $args['parent'] = isset($term_data['parent']) ? (int) $term_data['parent'] : '';
|
|
5252
|
5252
|
|
|
5253
|
|
- if ( $term_id > 0 && $term_info = (array)get_term( $term_id, $taxonomy ) ) {
|
|
|
5253
|
+ if ($term_id > 0 && $term_info = (array) get_term($term_id, $taxonomy)) {
|
|
5254
|
5254
|
$term_data['term_id'] = $term_info['term_id'];
|
|
5255
|
5255
|
|
|
5256
|
|
- $result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
|
|
|
5256
|
+ $result = wp_update_term($term_data['term_id'], $taxonomy, $term_data);
|
|
5257
|
5257
|
|
|
5258
|
|
- if( !is_wp_error( $result ) ) {
|
|
5259
|
|
- return isset( $result['term_id'] ) ? $result['term_id'] : 0;
|
|
|
5258
|
+ if (!is_wp_error($result)) {
|
|
|
5259
|
+ return isset($result['term_id']) ? $result['term_id'] : 0;
|
|
5260
|
5260
|
}
|
|
5261
|
|
- } else if ( $term_data['slug'] != '' && $term_info = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
|
|
|
5261
|
+ } else if ($term_data['slug'] != '' && $term_info = (array) term_exists($term_data['slug'], $taxonomy)) {
|
|
5262
|
5262
|
$term_data['term_id'] = $term_info['term_id'];
|
|
5263
|
5263
|
|
|
5264
|
|
- $result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
|
|
|
5264
|
+ $result = wp_update_term($term_data['term_id'], $taxonomy, $term_data);
|
|
5265
|
5265
|
|
|
5266
|
|
- if( !is_wp_error( $result ) ) {
|
|
5267
|
|
- return isset( $result['term_id'] ) ? $result['term_id'] : 0;
|
|
|
5266
|
+ if (!is_wp_error($result)) {
|
|
|
5267
|
+ return isset($result['term_id']) ? $result['term_id'] : 0;
|
|
5268
|
5268
|
}
|
|
5269
|
5269
|
} else {
|
|
5270
|
|
- return geodir_imex_insert_term( $taxonomy, $term_data );
|
|
|
5270
|
+ return geodir_imex_insert_term($taxonomy, $term_data);
|
|
5271
|
5271
|
}
|
|
5272
|
5272
|
|
|
5273
|
5273
|
return false;
|
|
@@ -5286,20 +5286,20 @@ discard block |
|
|
block discarded – undo |
|
5286
|
5286
|
* @param string $post_type Post type.
|
|
5287
|
5287
|
* @return int Posts count.
|
|
5288
|
5288
|
*/
|
|
5289
|
|
-function geodir_get_posts_count( $post_type ) {
|
|
|
5289
|
+function geodir_get_posts_count($post_type) {
|
|
5290
|
5290
|
global $wpdb, $plugin_prefix;
|
|
5291
|
5291
|
|
|
5292
|
|
- if ( !post_type_exists( $post_type ) ) {
|
|
|
5292
|
+ if (!post_type_exists($post_type)) {
|
|
5293
|
5293
|
return 0;
|
|
5294
|
5294
|
}
|
|
5295
|
5295
|
|
|
5296
|
|
- $table = $plugin_prefix . $post_type . '_detail';
|
|
|
5296
|
+ $table = $plugin_prefix.$post_type.'_detail';
|
|
5297
|
5297
|
|
|
5298
|
5298
|
// Skip listing with statuses trash, auto-draft etc...
|
|
5299
|
5299
|
$skip_statuses = geodir_imex_export_skip_statuses();
|
|
5300
|
5300
|
$where_statuses = '';
|
|
5301
|
|
- if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
|
|
5302
|
|
- $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
|
|
|
5301
|
+ if (!empty($skip_statuses) && is_array($skip_statuses)) {
|
|
|
5302
|
+ $where_statuses = "AND `".$wpdb->posts."`.`post_status` NOT IN('".implode("','", $skip_statuses)."')";
|
|
5303
|
5303
|
}
|
|
5304
|
5304
|
|
|
5305
|
5305
|
/**
|
|
@@ -5310,11 +5310,11 @@ discard block |
|
|
block discarded – undo |
|
5310
|
5310
|
*
|
|
5311
|
5311
|
* @param string $where SQL where clause part.
|
|
5312
|
5312
|
*/
|
|
5313
|
|
- $where_statuses = apply_filters( 'geodir_get_posts_count', $where_statuses, $post_type );
|
|
|
5313
|
+ $where_statuses = apply_filters('geodir_get_posts_count', $where_statuses, $post_type);
|
|
5314
|
5314
|
|
|
5315
|
|
- $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 );
|
|
|
5315
|
+ $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);
|
|
5316
|
5316
|
|
|
5317
|
|
- $posts_count = (int)$wpdb->get_var( $query );
|
|
|
5317
|
+ $posts_count = (int) $wpdb->get_var($query);
|
|
5318
|
5318
|
|
|
5319
|
5319
|
/**
|
|
5320
|
5320
|
* Modify returned post counts for the current post type.
|
|
@@ -5325,7 +5325,7 @@ discard block |
|
|
block discarded – undo |
|
5325
|
5325
|
* @param int $posts_count Post counts.
|
|
5326
|
5326
|
* @param string $post_type Post type.
|
|
5327
|
5327
|
*/
|
|
5328
|
|
- $posts_count = apply_filters( 'geodir_imex_count_posts', $posts_count, $post_type );
|
|
|
5328
|
+ $posts_count = apply_filters('geodir_imex_count_posts', $posts_count, $post_type);
|
|
5329
|
5329
|
|
|
5330
|
5330
|
return $posts_count;
|
|
5331
|
5331
|
}
|
|
@@ -5346,17 +5346,17 @@ discard block |
|
|
block discarded – undo |
|
5346
|
5346
|
* @param int $page_no Page number. Default 0.
|
|
5347
|
5347
|
* @return array Array of posts data.
|
|
5348
|
5348
|
*/
|
|
5349
|
|
-function geodir_imex_get_posts( $post_type, $per_page = 0, $page_no = 0 ) {
|
|
|
5349
|
+function geodir_imex_get_posts($post_type, $per_page = 0, $page_no = 0) {
|
|
5350
|
5350
|
global $wp_filesystem;
|
|
5351
|
5351
|
|
|
5352
|
|
- $posts = geodir_get_export_posts( $post_type, $per_page, $page_no );
|
|
|
5352
|
+ $posts = geodir_get_export_posts($post_type, $per_page, $page_no);
|
|
5353
|
5353
|
|
|
5354
|
5354
|
$csv_rows = array();
|
|
5355
|
5355
|
|
|
5356
|
|
- if ( !empty( $posts ) ) {
|
|
5357
|
|
- $is_payment_plugin = is_plugin_active( 'geodir_payment_manager/geodir_payment_manager.php' );
|
|
|
5356
|
+ if (!empty($posts)) {
|
|
|
5357
|
+ $is_payment_plugin = is_plugin_active('geodir_payment_manager/geodir_payment_manager.php');
|
|
5358
|
5358
|
$location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
|
|
5359
|
|
- $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
|
|
|
5359
|
+ $location_allowed = function_exists('geodir_cpt_no_location') && geodir_cpt_no_location($post_type) ? false : true;
|
|
5360
|
5360
|
$neighbourhood_active = $location_manager && $location_allowed && get_option('location_neighbourhoods') ? true : false;
|
|
5361
|
5361
|
|
|
5362
|
5362
|
$csv_row = array();
|
|
@@ -5368,7 +5368,7 @@ discard block |
|
|
block discarded – undo |
|
5368
|
5368
|
$csv_row[] = 'default_category';
|
|
5369
|
5369
|
$csv_row[] = 'post_tags';
|
|
5370
|
5370
|
$csv_row[] = 'post_type';
|
|
5371
|
|
- if ( $post_type == 'gd_event' ) {
|
|
|
5371
|
+ if ($post_type == 'gd_event') {
|
|
5372
|
5372
|
$csv_row[] = 'event_date';
|
|
5373
|
5373
|
$csv_row[] = 'event_enddate';
|
|
5374
|
5374
|
$csv_row[] = 'starttime';
|
|
@@ -5423,15 +5423,15 @@ discard block |
|
|
block discarded – undo |
|
5423
|
5423
|
}
|
|
5424
|
5424
|
// WPML
|
|
5425
|
5425
|
|
|
5426
|
|
- $custom_fields = geodir_imex_get_custom_fields( $post_type );
|
|
5427
|
|
- if ( !empty( $custom_fields ) ) {
|
|
5428
|
|
- foreach ( $custom_fields as $custom_field ) {
|
|
|
5426
|
+ $custom_fields = geodir_imex_get_custom_fields($post_type);
|
|
|
5427
|
+ if (!empty($custom_fields)) {
|
|
|
5428
|
+ foreach ($custom_fields as $custom_field) {
|
|
5429
|
5429
|
$csv_row[] = $custom_field->htmlvar_name;
|
|
5430
|
5430
|
}
|
|
5431
|
5431
|
}
|
|
5432
|
5432
|
|
|
5433
|
5433
|
// Export franchise fields
|
|
5434
|
|
- $is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false;
|
|
|
5434
|
+ $is_franchise_active = is_plugin_active('geodir_franchise/geodir_franchise.php') && geodir_franchise_enabled($post_type) ? true : false;
|
|
5435
|
5435
|
if ($is_franchise_active) {
|
|
5436
|
5436
|
$csv_row[] = 'gd_is_franchise';
|
|
5437
|
5437
|
$csv_row[] = 'gd_franchise_lock';
|
|
@@ -5441,28 +5441,28 @@ discard block |
|
|
block discarded – undo |
|
5441
|
5441
|
$csv_rows[] = $csv_row;
|
|
5442
|
5442
|
|
|
5443
|
5443
|
$images_count = 5;
|
|
5444
|
|
- $xx=0;
|
|
5445
|
|
- foreach ( $posts as $post ) {$xx++;
|
|
|
5444
|
+ $xx = 0;
|
|
|
5445
|
+ foreach ($posts as $post) {$xx++;
|
|
5446
|
5446
|
$post_id = $post['ID'];
|
|
5447
|
5447
|
|
|
5448
|
|
- $gd_post_info = geodir_get_post_info( $post_id );
|
|
5449
|
|
- $post_info = (array)$gd_post_info;
|
|
|
5448
|
+ $gd_post_info = geodir_get_post_info($post_id);
|
|
|
5449
|
+ $post_info = (array) $gd_post_info;
|
|
5450
|
5450
|
|
|
5451
|
|
- $taxonomy_category = $post_type . 'category';
|
|
5452
|
|
- $taxonomy_tags = $post_type . '_tags';
|
|
|
5451
|
+ $taxonomy_category = $post_type.'category';
|
|
|
5452
|
+ $taxonomy_tags = $post_type.'_tags';
|
|
5453
|
5453
|
|
|
5454
|
5454
|
$post_category = '';
|
|
5455
|
5455
|
$default_category_id = $gd_post_info->default_category;
|
|
5456
|
5456
|
$default_category = '';
|
|
5457
|
5457
|
$post_tags = '';
|
|
5458
|
|
- $terms = wp_get_post_terms( $post_id, array( $taxonomy_category, $taxonomy_tags ) );
|
|
|
5458
|
+ $terms = wp_get_post_terms($post_id, array($taxonomy_category, $taxonomy_tags));
|
|
5459
|
5459
|
|
|
5460
|
|
- if ( !empty( $terms ) && !is_wp_error( $terms ) ) {
|
|
|
5460
|
+ if (!empty($terms) && !is_wp_error($terms)) {
|
|
5461
|
5461
|
$post_category = array();
|
|
5462
|
5462
|
$post_tags = array();
|
|
5463
|
5463
|
|
|
5464
|
|
- foreach ( $terms as $term ) {
|
|
5465
|
|
- if ( $term->taxonomy == $taxonomy_category ) {
|
|
|
5464
|
+ foreach ($terms as $term) {
|
|
|
5465
|
+ if ($term->taxonomy == $taxonomy_category) {
|
|
5466
|
5466
|
$post_category[] = $term->name;
|
|
5467
|
5467
|
|
|
5468
|
5468
|
if ($default_category_id == $term->term_id) {
|
|
@@ -5470,7 +5470,7 @@ discard block |
|
|
block discarded – undo |
|
5470
|
5470
|
}
|
|
5471
|
5471
|
}
|
|
5472
|
5472
|
|
|
5473
|
|
- if ( $term->taxonomy == $taxonomy_tags ) {
|
|
|
5473
|
+ if ($term->taxonomy == $taxonomy_tags) {
|
|
5474
|
5474
|
$post_tags[] = $term->name;
|
|
5475
|
5475
|
}
|
|
5476
|
5476
|
}
|
|
@@ -5478,47 +5478,47 @@ discard block |
|
|
block discarded – undo |
|
5478
|
5478
|
if (empty($default_category) && !empty($post_category)) {
|
|
5479
|
5479
|
$default_category = $post_category[0]; // Set first one as default category.
|
|
5480
|
5480
|
}
|
|
5481
|
|
- $post_category = !empty( $post_category ) ? implode( ',', $post_category ) : '';
|
|
5482
|
|
- $post_tags = !empty( $post_tags ) ? implode( ',', $post_tags ) : '';
|
|
|
5481
|
+ $post_category = !empty($post_category) ? implode(',', $post_category) : '';
|
|
|
5482
|
+ $post_tags = !empty($post_tags) ? implode(',', $post_tags) : '';
|
|
5483
|
5483
|
}
|
|
5484
|
5484
|
|
|
5485
|
5485
|
// Franchise data
|
|
5486
|
|
- if ($is_franchise_active && isset($post_info['franchise']) && (int)$post_info['franchise'] > 0 && geodir_franchise_check((int)$post_info['franchise'])) {
|
|
|
5486
|
+ if ($is_franchise_active && isset($post_info['franchise']) && (int) $post_info['franchise'] > 0 && geodir_franchise_check((int) $post_info['franchise'])) {
|
|
5487
|
5487
|
$franchise_id = $post_info['franchise'];
|
|
5488
|
5488
|
$gd_franchise_info = geodir_get_post_info($franchise_id);
|
|
5489
|
5489
|
|
|
5490
|
5490
|
if (geodir_franchise_pkg_is_active($gd_franchise_info)) {
|
|
5491
|
|
- $franchise_info = (array)$gd_franchise_info;
|
|
|
5491
|
+ $franchise_info = (array) $gd_franchise_info;
|
|
5492
|
5492
|
$locked_fields = geodir_franchise_get_locked_fields($franchise_id, true);
|
|
5493
|
5493
|
|
|
5494
|
5494
|
if (!empty($locked_fields)) {
|
|
5495
|
|
- foreach( $locked_fields as $locked_field) {
|
|
|
5495
|
+ foreach ($locked_fields as $locked_field) {
|
|
5496
|
5496
|
if (isset($post_info[$locked_field]) && isset($franchise_info[$locked_field])) {
|
|
5497
|
5497
|
$post_info[$locked_field] = $franchise_info[$locked_field];
|
|
5498
|
5498
|
}
|
|
5499
|
5499
|
|
|
5500
|
5500
|
if (in_array($taxonomy_category, $locked_fields) || in_array('post_tags', $locked_fields)) {
|
|
5501
|
|
- $franchise_terms = wp_get_post_terms( $franchise_id, array( $taxonomy_category, $taxonomy_tags ) );
|
|
|
5501
|
+ $franchise_terms = wp_get_post_terms($franchise_id, array($taxonomy_category, $taxonomy_tags));
|
|
5502
|
5502
|
|
|
5503
|
|
- if ( !empty( $franchise_terms ) && !is_wp_error( $franchise_terms ) ) {
|
|
|
5503
|
+ if (!empty($franchise_terms) && !is_wp_error($franchise_terms)) {
|
|
5504
|
5504
|
$franchise_post_category = array();
|
|
5505
|
5505
|
$franchise_post_tags = array();
|
|
5506
|
5506
|
|
|
5507
|
|
- foreach ( $franchise_terms as $franchise_term ) {
|
|
5508
|
|
- if ( $franchise_term->taxonomy == $taxonomy_category ) {
|
|
|
5507
|
+ foreach ($franchise_terms as $franchise_term) {
|
|
|
5508
|
+ if ($franchise_term->taxonomy == $taxonomy_category) {
|
|
5509
|
5509
|
$franchise_post_category[] = $franchise_term->name;
|
|
5510
|
5510
|
}
|
|
5511
|
5511
|
|
|
5512
|
|
- if ( $franchise_term->taxonomy == $taxonomy_tags ) {
|
|
|
5512
|
+ if ($franchise_term->taxonomy == $taxonomy_tags) {
|
|
5513
|
5513
|
$franchise_post_tags[] = $franchise_term->name;
|
|
5514
|
5514
|
}
|
|
5515
|
5515
|
}
|
|
5516
|
5516
|
|
|
5517
|
5517
|
if (in_array($taxonomy_category, $locked_fields)) {
|
|
5518
|
|
- $post_category = !empty( $franchise_post_category ) ? implode( ',', $franchise_post_category ) : '';
|
|
|
5518
|
+ $post_category = !empty($franchise_post_category) ? implode(',', $franchise_post_category) : '';
|
|
5519
|
5519
|
}
|
|
5520
|
5520
|
if (in_array('post_tags', $locked_fields)) {
|
|
5521
|
|
- $post_tags = !empty( $franchise_post_tags ) ? implode( ',', $franchise_post_tags ) : '';
|
|
|
5521
|
+ $post_tags = !empty($franchise_post_tags) ? implode(',', $franchise_post_tags) : '';
|
|
5522
|
5522
|
}
|
|
5523
|
5523
|
}
|
|
5524
|
5524
|
}
|
|
@@ -5527,18 +5527,18 @@ discard block |
|
|
block discarded – undo |
|
5527
|
5527
|
}
|
|
5528
|
5528
|
}
|
|
5529
|
5529
|
|
|
5530
|
|
- $post_images = geodir_get_images( $post_id );
|
|
|
5530
|
+ $post_images = geodir_get_images($post_id);
|
|
5531
|
5531
|
$current_images = array();
|
|
5532
|
|
- if ( !empty( $post_images ) ) {
|
|
5533
|
|
- foreach ( $post_images as $post_image ) {
|
|
5534
|
|
- $post_image = (array)$post_image;
|
|
5535
|
|
- $image = !empty( $post_image ) && isset( $post_image['path'] ) && $wp_filesystem->is_file( $post_image['path'] ) && $wp_filesystem->exists( $post_image['path'] ) ? $post_image['src'] : '';
|
|
5536
|
|
- if ( $image ) {
|
|
|
5532
|
+ if (!empty($post_images)) {
|
|
|
5533
|
+ foreach ($post_images as $post_image) {
|
|
|
5534
|
+ $post_image = (array) $post_image;
|
|
|
5535
|
+ $image = !empty($post_image) && isset($post_image['path']) && $wp_filesystem->is_file($post_image['path']) && $wp_filesystem->exists($post_image['path']) ? $post_image['src'] : '';
|
|
|
5536
|
+ if ($image) {
|
|
5537
|
5537
|
$current_images[] = $image;
|
|
5538
|
5538
|
}
|
|
5539
|
5539
|
}
|
|
5540
|
5540
|
|
|
5541
|
|
- $images_count = max( $images_count, count( $current_images ) );
|
|
|
5541
|
+ $images_count = max($images_count, count($current_images));
|
|
5542
|
5542
|
}
|
|
5543
|
5543
|
|
|
5544
|
5544
|
$csv_row = array();
|
|
@@ -5550,7 +5550,7 @@ discard block |
|
|
block discarded – undo |
|
5550
|
5550
|
$csv_row[] = $default_category; // default_category
|
|
5551
|
5551
|
$csv_row[] = $post_tags; // post_tags
|
|
5552
|
5552
|
$csv_row[] = $post_type; // post_type
|
|
5553
|
|
- if ( $post_type == 'gd_event' ) {
|
|
|
5553
|
+ if ($post_type == 'gd_event') {
|
|
5554
|
5554
|
$event_data = geodir_imex_get_event_data($post, $gd_post_info);
|
|
5555
|
5555
|
$csv_row[] = $event_data['event_date']; // event_date
|
|
5556
|
5556
|
$csv_row[] = $event_data['event_enddate']; // enddate
|
|
@@ -5571,9 +5571,9 @@ discard block |
|
|
block discarded – undo |
|
5571
|
5571
|
$csv_row[] = $event_data['recurring_end_date']; // repeat_end
|
|
5572
|
5572
|
}
|
|
5573
|
5573
|
$csv_row[] = $post_info['post_status']; // post_status
|
|
5574
|
|
- $csv_row[] = (int)$post_info['is_featured'] == 1 ? 1 : ''; // is_featured
|
|
|
5574
|
+ $csv_row[] = (int) $post_info['is_featured'] == 1 ? 1 : ''; // is_featured
|
|
5575
|
5575
|
if ($is_payment_plugin) {
|
|
5576
|
|
- $csv_row[] = (int)$post_info['package_id']; // package_id
|
|
|
5576
|
+ $csv_row[] = (int) $post_info['package_id']; // package_id
|
|
5577
|
5577
|
$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
|
|
5578
|
5578
|
}
|
|
5579
|
5579
|
$csv_row[] = $post_info['post_date']; // post_date
|
|
@@ -5610,14 +5610,14 @@ discard block |
|
|
block discarded – undo |
|
5610
|
5610
|
$csv_row[] = $post_info['geodir_special_offers']; // geodir_special_offers
|
|
5611
|
5611
|
// WPML
|
|
5612
|
5612
|
if ($is_wpml) {
|
|
5613
|
|
- $csv_row[] = geodir_get_language_for_element( $post_id, 'post_' . $post_type );
|
|
5614
|
|
- $csv_row[] = geodir_imex_original_post_id( $post_id, 'post_' . $post_type );
|
|
|
5613
|
+ $csv_row[] = geodir_get_language_for_element($post_id, 'post_'.$post_type);
|
|
|
5614
|
+ $csv_row[] = geodir_imex_original_post_id($post_id, 'post_'.$post_type);
|
|
5615
|
5615
|
}
|
|
5616
|
5616
|
// WPML
|
|
5617
|
5617
|
|
|
5618
|
|
- if ( !empty( $custom_fields ) ) {
|
|
5619
|
|
- foreach ( $custom_fields as $custom_field ) {
|
|
5620
|
|
- $csv_row[] = isset( $post_info[$custom_field->htmlvar_name] ) ? $post_info[$custom_field->htmlvar_name] : '';
|
|
|
5618
|
+ if (!empty($custom_fields)) {
|
|
|
5619
|
+ foreach ($custom_fields as $custom_field) {
|
|
|
5620
|
+ $csv_row[] = isset($post_info[$custom_field->htmlvar_name]) ? $post_info[$custom_field->htmlvar_name] : '';
|
|
5621
|
5621
|
}
|
|
5622
|
5622
|
}
|
|
5623
|
5623
|
|
|
@@ -5628,26 +5628,26 @@ discard block |
|
|
block discarded – undo |
|
5628
|
5628
|
$franchise = '';
|
|
5629
|
5629
|
|
|
5630
|
5630
|
if (geodir_franchise_pkg_is_active($gd_post_info)) {
|
|
5631
|
|
- $gd_is_franchise = (int)get_post_meta( $post_id, 'gd_is_franchise', true );
|
|
5632
|
|
- $locaked_fields = $gd_is_franchise ? get_post_meta( $post_id, 'gd_franchise_lock', true ) : '';
|
|
|
5631
|
+ $gd_is_franchise = (int) get_post_meta($post_id, 'gd_is_franchise', true);
|
|
|
5632
|
+ $locaked_fields = $gd_is_franchise ? get_post_meta($post_id, 'gd_franchise_lock', true) : '';
|
|
5633
|
5633
|
$locaked_fields = (is_array($locaked_fields) && !empty($locaked_fields) ? implode(",", $locaked_fields) : '');
|
|
5634
|
|
- $franchise = !$gd_is_franchise && isset($post_info['franchise']) && (int)$post_info['franchise'] > 0 ? (int)$post_info['franchise'] : 0; // franchise id
|
|
|
5634
|
+ $franchise = !$gd_is_franchise && isset($post_info['franchise']) && (int) $post_info['franchise'] > 0 ? (int) $post_info['franchise'] : 0; // franchise id
|
|
5635
|
5635
|
}
|
|
5636
|
5636
|
|
|
5637
|
|
- $csv_row[] = (int)$gd_is_franchise; // gd_is_franchise
|
|
|
5637
|
+ $csv_row[] = (int) $gd_is_franchise; // gd_is_franchise
|
|
5638
|
5638
|
$csv_row[] = $locaked_fields; // gd_franchise_lock fields
|
|
5639
|
|
- $csv_row[] = (int)$franchise; // franchise id
|
|
|
5639
|
+ $csv_row[] = (int) $franchise; // franchise id
|
|
5640
|
5640
|
}
|
|
5641
|
5641
|
|
|
5642
|
|
- for ( $c = 0; $c < $images_count; $c++ ) {
|
|
5643
|
|
- $csv_row[] = isset( $current_images[$c] ) ? $current_images[$c] : ''; // IMAGE
|
|
|
5642
|
+ for ($c = 0; $c < $images_count; $c++) {
|
|
|
5643
|
+ $csv_row[] = isset($current_images[$c]) ? $current_images[$c] : ''; // IMAGE
|
|
5644
|
5644
|
}
|
|
5645
|
5645
|
|
|
5646
|
5646
|
$csv_rows[] = $csv_row;
|
|
5647
|
5647
|
|
|
5648
|
5648
|
}
|
|
5649
|
5649
|
|
|
5650
|
|
- for ( $c = 0; $c < $images_count; $c++ ) {
|
|
|
5650
|
+ for ($c = 0; $c < $images_count; $c++) {
|
|
5651
|
5651
|
$csv_rows[0][] = 'IMAGE';
|
|
5652
|
5652
|
}
|
|
5653
|
5653
|
}
|
|
@@ -5669,30 +5669,30 @@ discard block |
|
|
block discarded – undo |
|
5669
|
5669
|
* @param int $page_no Page number. Default 0.
|
|
5670
|
5670
|
* @return array Array of posts data.
|
|
5671
|
5671
|
*/
|
|
5672
|
|
-function geodir_get_export_posts( $post_type, $per_page = 0, $page_no = 0 ) {
|
|
|
5672
|
+function geodir_get_export_posts($post_type, $per_page = 0, $page_no = 0) {
|
|
5673
|
5673
|
global $wpdb, $plugin_prefix;
|
|
5674
|
5674
|
|
|
5675
|
|
- if ( ! post_type_exists( $post_type ) )
|
|
|
5675
|
+ if (!post_type_exists($post_type))
|
|
5676
|
5676
|
return new stdClass;
|
|
5677
|
5677
|
|
|
5678
|
|
- $table = $plugin_prefix . $post_type . '_detail';
|
|
|
5678
|
+ $table = $plugin_prefix.$post_type.'_detail';
|
|
5679
|
5679
|
|
|
5680
|
5680
|
$limit = '';
|
|
5681
|
|
- if ( $per_page > 0 && $page_no > 0 ) {
|
|
5682
|
|
- $offset = ( $page_no - 1 ) * $per_page;
|
|
|
5681
|
+ if ($per_page > 0 && $page_no > 0) {
|
|
|
5682
|
+ $offset = ($page_no - 1) * $per_page;
|
|
5683
|
5683
|
|
|
5684
|
|
- if ( $offset > 0 ) {
|
|
5685
|
|
- $limit = " LIMIT " . $offset . "," . $per_page;
|
|
|
5684
|
+ if ($offset > 0) {
|
|
|
5685
|
+ $limit = " LIMIT ".$offset.",".$per_page;
|
|
5686
|
5686
|
} else {
|
|
5687
|
|
- $limit = " LIMIT " . $per_page;
|
|
|
5687
|
+ $limit = " LIMIT ".$per_page;
|
|
5688
|
5688
|
}
|
|
5689
|
5689
|
}
|
|
5690
|
5690
|
|
|
5691
|
5691
|
// Skip listing with statuses trash, auto-draft etc...
|
|
5692
|
5692
|
$skip_statuses = geodir_imex_export_skip_statuses();
|
|
5693
|
5693
|
$where_statuses = '';
|
|
5694
|
|
- if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
|
|
5695
|
|
- $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
|
|
|
5694
|
+ if (!empty($skip_statuses) && is_array($skip_statuses)) {
|
|
|
5695
|
+ $where_statuses = "AND `".$wpdb->posts."`.`post_status` NOT IN('".implode("','", $skip_statuses)."')";
|
|
5696
|
5696
|
}
|
|
5697
|
5697
|
|
|
5698
|
5698
|
/**
|
|
@@ -5703,9 +5703,9 @@ discard block |
|
|
block discarded – undo |
|
5703
|
5703
|
*
|
|
5704
|
5704
|
* @param string $where SQL where clause part.
|
|
5705
|
5705
|
*/
|
|
5706
|
|
- $where_statuses = apply_filters( 'geodir_get_export_posts', $where_statuses, $post_type );
|
|
|
5706
|
+ $where_statuses = apply_filters('geodir_get_export_posts', $where_statuses, $post_type);
|
|
5707
|
5707
|
|
|
5708
|
|
- $query = $wpdb->prepare( "SELECT {$wpdb->posts}.ID FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s " . $where_statuses . " ORDER BY {$wpdb->posts}.ID ASC" . $limit, $post_type );
|
|
|
5708
|
+ $query = $wpdb->prepare("SELECT {$wpdb->posts}.ID FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s ".$where_statuses." ORDER BY {$wpdb->posts}.ID ASC".$limit, $post_type);
|
|
5709
|
5709
|
/**
|
|
5710
|
5710
|
* Modify returned posts SQL query for the current post type.
|
|
5711
|
5711
|
*
|
|
@@ -5715,8 +5715,8 @@ discard block |
|
|
block discarded – undo |
|
5715
|
5715
|
* @param int $query The SQL query.
|
|
5716
|
5716
|
* @param string $post_type Post type.
|
|
5717
|
5717
|
*/
|
|
5718
|
|
- $query = apply_filters( 'geodir_imex_export_posts_query', $query, $post_type );
|
|
5719
|
|
- $results = (array)$wpdb->get_results( $wpdb->prepare( $query, $post_type ), ARRAY_A );
|
|
|
5718
|
+ $query = apply_filters('geodir_imex_export_posts_query', $query, $post_type);
|
|
|
5719
|
+ $results = (array) $wpdb->get_results($wpdb->prepare($query, $post_type), ARRAY_A);
|
|
5720
|
5720
|
|
|
5721
|
5721
|
/**
|
|
5722
|
5722
|
* Modify returned post results for the current post type.
|
|
@@ -5727,7 +5727,7 @@ discard block |
|
|
block discarded – undo |
|
5727
|
5727
|
* @param object $results An object containing all post ids.
|
|
5728
|
5728
|
* @param string $post_type Post type.
|
|
5729
|
5729
|
*/
|
|
5730
|
|
- return apply_filters( 'geodir_export_posts', $results, $post_type );
|
|
|
5730
|
+ return apply_filters('geodir_export_posts', $results, $post_type);
|
|
5731
|
5731
|
}
|
|
5732
|
5732
|
|
|
5733
|
5733
|
/**
|
|
@@ -5745,24 +5745,24 @@ discard block |
|
|
block discarded – undo |
|
5745
|
5745
|
* @param string $post_type Post type.
|
|
5746
|
5746
|
* @return string The SQL query.
|
|
5747
|
5747
|
*/
|
|
5748
|
|
-function geodir_imex_get_events_query( $query, $post_type ) {
|
|
5749
|
|
- if ( $post_type == 'gd_event' ) {
|
|
|
5748
|
+function geodir_imex_get_events_query($query, $post_type) {
|
|
|
5749
|
+ if ($post_type == 'gd_event') {
|
|
5750
|
5750
|
global $wpdb, $plugin_prefix;
|
|
5751
|
5751
|
|
|
5752
|
|
- $table = $plugin_prefix . $post_type . '_detail';
|
|
|
5752
|
+ $table = $plugin_prefix.$post_type.'_detail';
|
|
5753
|
5753
|
$schedule_table = EVENT_SCHEDULE;
|
|
5754
|
5754
|
|
|
5755
|
5755
|
// Skip listing with statuses trash, auto-draft etc...
|
|
5756
|
5756
|
$skip_statuses = geodir_imex_export_skip_statuses();
|
|
5757
|
5757
|
$where_statuses = '';
|
|
5758
|
|
- if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
|
|
5759
|
|
- $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
|
|
|
5758
|
+ if (!empty($skip_statuses) && is_array($skip_statuses)) {
|
|
|
5759
|
+ $where_statuses = "AND `".$wpdb->posts."`.`post_status` NOT IN('".implode("','", $skip_statuses)."')";
|
|
5760
|
5760
|
}
|
|
5761
|
5761
|
|
|
5762
|
5762
|
/** This action is documented in geodirectory-functions/geodirectory-admin/admin_functions.php */
|
|
5763
|
|
- $where_statuses = apply_filters( 'geodir_get_export_posts', $where_statuses, $post_type );
|
|
|
5763
|
+ $where_statuses = apply_filters('geodir_get_export_posts', $where_statuses, $post_type);
|
|
5764
|
5764
|
|
|
5765
|
|
- $query = $wpdb->prepare( "SELECT {$wpdb->posts}.ID, {$schedule_table}.event_date, {$schedule_table}.event_enddate AS enddate, {$schedule_table}.event_starttime AS starttime, {$schedule_table}.event_endtime AS endtime FROM {$wpdb->posts} INNER JOIN {$table} ON ({$table}.post_id = {$wpdb->posts}.ID) INNER JOIN {$schedule_table} ON ({$schedule_table}.event_id = {$wpdb->posts}.ID) WHERE {$wpdb->posts}.post_type = %s " . $where_statuses . " GROUP BY {$table}.post_id ORDER BY {$wpdb->posts}.ID ASC, {$schedule_table}.schedule_id ASC", $post_type );
|
|
|
5765
|
+ $query = $wpdb->prepare("SELECT {$wpdb->posts}.ID, {$schedule_table}.event_date, {$schedule_table}.event_enddate AS enddate, {$schedule_table}.event_starttime AS starttime, {$schedule_table}.event_endtime AS endtime FROM {$wpdb->posts} INNER JOIN {$table} ON ({$table}.post_id = {$wpdb->posts}.ID) INNER JOIN {$schedule_table} ON ({$schedule_table}.event_id = {$wpdb->posts}.ID) WHERE {$wpdb->posts}.post_type = %s ".$where_statuses." GROUP BY {$table}.post_id ORDER BY {$wpdb->posts}.ID ASC, {$schedule_table}.schedule_id ASC", $post_type);
|
|
5766
|
5766
|
}
|
|
5767
|
5767
|
|
|
5768
|
5768
|
return $query;
|
|
@@ -5786,35 +5786,35 @@ discard block |
|
|
block discarded – undo |
|
5786
|
5786
|
* @param string $post_type Post type.
|
|
5787
|
5787
|
* @return int Total terms count.
|
|
5788
|
5788
|
*/
|
|
5789
|
|
-function geodir_get_terms_count( $post_type ) {
|
|
5790
|
|
- $args = array( 'hide_empty' => 0 );
|
|
|
5789
|
+function geodir_get_terms_count($post_type) {
|
|
|
5790
|
+ $args = array('hide_empty' => 0);
|
|
5791
|
5791
|
|
|
5792
|
|
- remove_all_filters( 'get_terms' );
|
|
|
5792
|
+ remove_all_filters('get_terms');
|
|
5793
|
5793
|
|
|
5794
|
|
- $taxonomy = $post_type . 'category';
|
|
|
5794
|
+ $taxonomy = $post_type.'category';
|
|
5795
|
5795
|
|
|
5796
|
5796
|
// WPML
|
|
5797
|
5797
|
$is_wpml = geodir_is_wpml();
|
|
5798
|
5798
|
$active_lang = 'all';
|
|
5799
|
|
- if ( $is_wpml ) {
|
|
|
5799
|
+ if ($is_wpml) {
|
|
5800
|
5800
|
global $sitepress;
|
|
5801
|
5801
|
$active_lang = $sitepress->get_current_language();
|
|
5802
|
5802
|
|
|
5803
|
|
- if ( $active_lang != 'all' ) {
|
|
5804
|
|
- $sitepress->switch_lang( 'all', true );
|
|
|
5803
|
+ if ($active_lang != 'all') {
|
|
|
5804
|
+ $sitepress->switch_lang('all', true);
|
|
5805
|
5805
|
}
|
|
5806
|
5806
|
}
|
|
5807
|
5807
|
// WPML
|
|
5808
|
5808
|
|
|
5809
|
|
- $count_terms = wp_count_terms( $taxonomy, $args );
|
|
|
5809
|
+ $count_terms = wp_count_terms($taxonomy, $args);
|
|
5810
|
5810
|
|
|
5811
|
5811
|
// WPML
|
|
5812
|
|
- if ( $is_wpml && $active_lang !== 'all' ) {
|
|
|
5812
|
+ if ($is_wpml && $active_lang !== 'all') {
|
|
5813
|
5813
|
global $sitepress;
|
|
5814
|
|
- $sitepress->switch_lang( $active_lang, true );
|
|
|
5814
|
+ $sitepress->switch_lang($active_lang, true);
|
|
5815
|
5815
|
}
|
|
5816
|
5816
|
// WPML
|
|
5817
|
|
- $count_terms = !is_wp_error( $count_terms ) ? $count_terms : 0;
|
|
|
5817
|
+ $count_terms = !is_wp_error($count_terms) ? $count_terms : 0;
|
|
5818
|
5818
|
|
|
5819
|
5819
|
return $count_terms;
|
|
5820
|
5820
|
}
|
|
@@ -5831,23 +5831,23 @@ discard block |
|
|
block discarded – undo |
|
5831
|
5831
|
* @param int $page_no Page number. Default 0.
|
|
5832
|
5832
|
* @return array Array of terms data.
|
|
5833
|
5833
|
*/
|
|
5834
|
|
-function geodir_imex_get_terms( $post_type, $per_page = 0, $page_no = 0 ) {
|
|
5835
|
|
- $args = array( 'hide_empty' => 0, 'orderby' => 'id' );
|
|
|
5834
|
+function geodir_imex_get_terms($post_type, $per_page = 0, $page_no = 0) {
|
|
|
5835
|
+ $args = array('hide_empty' => 0, 'orderby' => 'id');
|
|
5836
|
5836
|
|
|
5837
|
|
- remove_all_filters( 'get_terms' );
|
|
|
5837
|
+ remove_all_filters('get_terms');
|
|
5838
|
5838
|
|
|
5839
|
|
- $taxonomy = $post_type . 'category';
|
|
|
5839
|
+ $taxonomy = $post_type.'category';
|
|
5840
|
5840
|
|
|
5841
|
|
- if ( $per_page > 0 && $page_no > 0 ) {
|
|
5842
|
|
- $args['offset'] = ( $page_no - 1 ) * $per_page;
|
|
|
5841
|
+ if ($per_page > 0 && $page_no > 0) {
|
|
|
5842
|
+ $args['offset'] = ($page_no - 1) * $per_page;
|
|
5843
|
5843
|
$args['number'] = $per_page;
|
|
5844
|
5844
|
}
|
|
5845
|
5845
|
|
|
5846
|
|
- $terms = get_terms( $taxonomy, $args );
|
|
|
5846
|
+ $terms = get_terms($taxonomy, $args);
|
|
5847
|
5847
|
|
|
5848
|
5848
|
$csv_rows = array();
|
|
5849
|
5849
|
|
|
5850
|
|
- if ( !empty( $terms ) ) {
|
|
|
5850
|
+ if (!empty($terms)) {
|
|
5851
|
5851
|
$csv_row = array();
|
|
5852
|
5852
|
$csv_row[] = 'cat_id';
|
|
5853
|
5853
|
$csv_row[] = 'cat_name';
|
|
@@ -5869,16 +5869,16 @@ discard block |
|
|
block discarded – undo |
|
5869
|
5869
|
|
|
5870
|
5870
|
$csv_rows[] = $csv_row;
|
|
5871
|
5871
|
|
|
5872
|
|
- foreach ( $terms as $term ) {
|
|
5873
|
|
- $cat_icon = get_tax_meta( $term->term_id, 'ct_cat_icon', false, $post_type );
|
|
5874
|
|
- $cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : '';
|
|
|
5872
|
+ foreach ($terms as $term) {
|
|
|
5873
|
+ $cat_icon = get_tax_meta($term->term_id, 'ct_cat_icon', false, $post_type);
|
|
|
5874
|
+ $cat_icon = !empty($cat_icon) && isset($cat_icon['src']) ? $cat_icon['src'] : '';
|
|
5875
|
5875
|
|
|
5876
|
|
- $cat_image = geodir_get_default_catimage( $term->term_id, $post_type );
|
|
5877
|
|
- $cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : '';
|
|
|
5876
|
+ $cat_image = geodir_get_default_catimage($term->term_id, $post_type);
|
|
|
5877
|
+ $cat_image = !empty($cat_image) && isset($cat_image['src']) ? $cat_image['src'] : '';
|
|
5878
|
5878
|
|
|
5879
|
5879
|
$cat_parent = '';
|
|
5880
|
|
- if (isset($term->parent) && (int)$term->parent > 0 && term_exists((int)$term->parent, $taxonomy)) {
|
|
5881
|
|
- $parent_term = (array)get_term_by( 'id', (int)$term->parent, $taxonomy );
|
|
|
5880
|
+ if (isset($term->parent) && (int) $term->parent > 0 && term_exists((int) $term->parent, $taxonomy)) {
|
|
|
5881
|
+ $parent_term = (array) get_term_by('id', (int) $term->parent, $taxonomy);
|
|
5882
|
5882
|
$cat_parent = !empty($parent_term) && isset($parent_term['name']) ? $parent_term['name'] : '';
|
|
5883
|
5883
|
}
|
|
5884
|
5884
|
|
|
@@ -5888,15 +5888,15 @@ discard block |
|
|
block discarded – undo |
|
5888
|
5888
|
$csv_row[] = $term->slug;
|
|
5889
|
5889
|
$csv_row[] = $post_type;
|
|
5890
|
5890
|
$csv_row[] = $cat_parent;
|
|
5891
|
|
- $csv_row[] = get_tax_meta( $term->term_id, 'ct_cat_schema', false, $post_type );
|
|
|
5891
|
+ $csv_row[] = get_tax_meta($term->term_id, 'ct_cat_schema', false, $post_type);
|
|
5892
|
5892
|
// WPML
|
|
5893
|
5893
|
if ($is_wpml) {
|
|
5894
|
|
- $csv_row[] = geodir_get_language_for_element( $term->term_id, 'tax_' . $taxonomy );
|
|
5895
|
|
- $csv_row[] = geodir_imex_original_post_id( $term->term_id, 'tax_' . $taxonomy );
|
|
|
5894
|
+ $csv_row[] = geodir_get_language_for_element($term->term_id, 'tax_'.$taxonomy);
|
|
|
5895
|
+ $csv_row[] = geodir_imex_original_post_id($term->term_id, 'tax_'.$taxonomy);
|
|
5896
|
5896
|
}
|
|
5897
|
5897
|
// WPML
|
|
5898
|
5898
|
$csv_row[] = $term->description;
|
|
5899
|
|
- $csv_row[] = get_tax_meta( $term->term_id, 'ct_cat_top_desc', false, $post_type );
|
|
|
5899
|
+ $csv_row[] = get_tax_meta($term->term_id, 'ct_cat_top_desc', false, $post_type);
|
|
5900
|
5900
|
$csv_row[] = $cat_image;
|
|
5901
|
5901
|
$csv_row[] = $cat_icon;
|
|
5902
|
5902
|
|
|
@@ -5915,10 +5915,10 @@ discard block |
|
|
block discarded – undo |
|
5915
|
5915
|
* @param bool $relative True for relative path & False for absolute path.
|
|
5916
|
5916
|
* @return string Path to the cache directory.
|
|
5917
|
5917
|
*/
|
|
5918
|
|
-function geodir_path_import_export( $relative = true ) {
|
|
|
5918
|
+function geodir_path_import_export($relative = true) {
|
|
5919
|
5919
|
$upload_dir = wp_upload_dir();
|
|
5920
|
5920
|
|
|
5921
|
|
- return $relative ? $upload_dir['baseurl'] . '/cache' : $upload_dir['basedir'] . '/cache';
|
|
|
5921
|
+ return $relative ? $upload_dir['baseurl'].'/cache' : $upload_dir['basedir'].'/cache';
|
|
5922
|
5922
|
}
|
|
5923
|
5923
|
|
|
5924
|
5924
|
/**
|
|
@@ -5934,8 +5934,8 @@ discard block |
|
|
block discarded – undo |
|
5934
|
5934
|
* @param bool $clear If true then it overwrite data otherwise add rows at the end of file.
|
|
5935
|
5935
|
* @return bool true if success otherwise false.
|
|
5936
|
5936
|
*/
|
|
5937
|
|
-function geodir_save_csv_data( $file_path, $csv_data = array(), $clear = true ) {
|
|
5938
|
|
- if ( empty( $csv_data ) ) {
|
|
|
5937
|
+function geodir_save_csv_data($file_path, $csv_data = array(), $clear = true) {
|
|
|
5938
|
+ if (empty($csv_data)) {
|
|
5939
|
5939
|
return false;
|
|
5940
|
5940
|
}
|
|
5941
|
5941
|
|
|
@@ -5943,17 +5943,17 @@ discard block |
|
|
block discarded – undo |
|
5943
|
5943
|
|
|
5944
|
5944
|
$mode = $clear ? 'w+' : 'a+';
|
|
5945
|
5945
|
|
|
5946
|
|
- if ( function_exists( 'fputcsv' ) ) {
|
|
5947
|
|
- $file = fopen( $file_path, $mode );
|
|
5948
|
|
- foreach( $csv_data as $csv_row ) {
|
|
|
5946
|
+ if (function_exists('fputcsv')) {
|
|
|
5947
|
+ $file = fopen($file_path, $mode);
|
|
|
5948
|
+ foreach ($csv_data as $csv_row) {
|
|
5949
|
5949
|
//$csv_row = array_map( 'utf8_decode', $csv_row );
|
|
5950
|
|
- $write_successful = fputcsv( $file, $csv_row, ",", $enclosure = '"' );
|
|
|
5950
|
+ $write_successful = fputcsv($file, $csv_row, ",", $enclosure = '"');
|
|
5951
|
5951
|
}
|
|
5952
|
|
- fclose( $file );
|
|
|
5952
|
+ fclose($file);
|
|
5953
|
5953
|
} else {
|
|
5954
|
|
- foreach( $csv_data as $csv_row ) {
|
|
|
5954
|
+ foreach ($csv_data as $csv_row) {
|
|
5955
|
5955
|
//$csv_row = array_map( 'utf8_decode', $csv_row );
|
|
5956
|
|
- $wp_filesystem->put_contents( $file_path, $csv_row );
|
|
|
5956
|
+ $wp_filesystem->put_contents($file_path, $csv_row);
|
|
5957
|
5957
|
}
|
|
5958
|
5958
|
}
|
|
5959
|
5959
|
|
|
@@ -5971,14 +5971,14 @@ discard block |
|
|
block discarded – undo |
|
5971
|
5971
|
* @param string $file Full path to file.
|
|
5972
|
5972
|
* @return int No of file rows.
|
|
5973
|
5973
|
*/
|
|
5974
|
|
-function geodir_import_export_line_count( $file ) {
|
|
|
5974
|
+function geodir_import_export_line_count($file) {
|
|
5975
|
5975
|
global $wp_filesystem;
|
|
5976
|
5976
|
|
|
5977
|
|
- if ( $wp_filesystem->is_file( $file ) && $wp_filesystem->exists( $file ) ) {
|
|
5978
|
|
- $contents = $wp_filesystem->get_contents_array( $file );
|
|
|
5977
|
+ if ($wp_filesystem->is_file($file) && $wp_filesystem->exists($file)) {
|
|
|
5978
|
+ $contents = $wp_filesystem->get_contents_array($file);
|
|
5979
|
5979
|
|
|
5980
|
|
- if ( !empty( $contents ) && is_array( $contents ) ) {
|
|
5981
|
|
- return count( $contents ) - 1;
|
|
|
5980
|
+ if (!empty($contents) && is_array($contents)) {
|
|
|
5981
|
+ return count($contents) - 1;
|
|
5982
|
5982
|
}
|
|
5983
|
5983
|
}
|
|
5984
|
5984
|
|
|
@@ -5995,11 +5995,11 @@ discard block |
|
|
block discarded – undo |
|
5995
|
5995
|
* @param string $post_type The post type.
|
|
5996
|
5996
|
* @return object Queried object.
|
|
5997
|
5997
|
*/
|
|
5998
|
|
-function geodir_imex_get_custom_fields( $post_type ) {
|
|
|
5998
|
+function geodir_imex_get_custom_fields($post_type) {
|
|
5999
|
5999
|
global $wpdb;
|
|
6000
|
6000
|
|
|
6001
|
|
- $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 ) );
|
|
6002
|
|
- $rows = $wpdb->get_results( $sql );
|
|
|
6001
|
+ $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));
|
|
|
6002
|
+ $rows = $wpdb->get_results($sql);
|
|
6003
|
6003
|
|
|
6004
|
6004
|
return $rows;
|
|
6005
|
6005
|
}
|
|
@@ -6078,14 +6078,14 @@ discard block |
|
|
block discarded – undo |
|
6078
|
6078
|
global $wpdb, $plugin_prefix;
|
|
6079
|
6079
|
|
|
6080
|
6080
|
$post_type = get_post_type($master_post_id);
|
|
6081
|
|
- $post_table = $plugin_prefix . $post_type . '_detail';
|
|
|
6081
|
+ $post_table = $plugin_prefix.$post_type.'_detail';
|
|
6082
|
6082
|
|
|
6083
|
|
- $query = $wpdb->prepare("SELECT * FROM " . $post_table . " WHERE post_id = %d", array($master_post_id));
|
|
6084
|
|
- $data = (array)$wpdb->get_row($query);
|
|
|
6083
|
+ $query = $wpdb->prepare("SELECT * FROM ".$post_table." WHERE post_id = %d", array($master_post_id));
|
|
|
6084
|
+ $data = (array) $wpdb->get_row($query);
|
|
6085
|
6085
|
|
|
6086
|
|
- if ( !empty( $data ) ) {
|
|
|
6086
|
+ if (!empty($data)) {
|
|
6087
|
6087
|
$data['post_id'] = $tr_post_id;
|
|
6088
|
|
- unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type . 'category'], $data['overall_rating'], $data['rating_count'], $data['ratings']);
|
|
|
6088
|
+ unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type.'category'], $data['overall_rating'], $data['rating_count'], $data['ratings']);
|
|
6089
|
6089
|
|
|
6090
|
6090
|
$wpdb->update($post_table, $data, array('post_id' => $tr_post_id));
|
|
6091
|
6091
|
return true;
|
|
@@ -6111,7 +6111,7 @@ discard block |
|
|
block discarded – undo |
|
6111
|
6111
|
global $sitepress, $wpdb;
|
|
6112
|
6112
|
$post_type = get_post_type($master_post_id);
|
|
6113
|
6113
|
|
|
6114
|
|
- remove_filter('get_term', array($sitepress,'get_term_adjust_id')); // AVOID filtering to current language
|
|
|
6114
|
+ remove_filter('get_term', array($sitepress, 'get_term_adjust_id')); // AVOID filtering to current language
|
|
6115
|
6115
|
|
|
6116
|
6116
|
$taxonomies = get_object_taxonomies($post_type);
|
|
6117
|
6117
|
foreach ($taxonomies as $taxonomy) {
|
|
@@ -6120,9 +6120,9 @@ discard block |
|
|
block discarded – undo |
|
6120
|
6120
|
|
|
6121
|
6121
|
if ($terms) {
|
|
6122
|
6122
|
foreach ($terms as $term) {
|
|
6123
|
|
- $tr_id = apply_filters( 'translate_object_id',$term->term_id, $taxonomy, false, $lang);
|
|
|
6123
|
+ $tr_id = apply_filters('translate_object_id', $term->term_id, $taxonomy, false, $lang);
|
|
6124
|
6124
|
|
|
6125
|
|
- if (!is_null($tr_id)){
|
|
|
6125
|
+ if (!is_null($tr_id)) {
|
|
6126
|
6126
|
// not using get_term - unfiltered get_term
|
|
6127
|
6127
|
$translated_term = $wpdb->get_row($wpdb->prepare("
|
|
6128
|
6128
|
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));
|
|
@@ -6131,14 +6131,14 @@ discard block |
|
|
block discarded – undo |
|
6131
|
6131
|
}
|
|
6132
|
6132
|
}
|
|
6133
|
6133
|
|
|
6134
|
|
- if (!is_taxonomy_hierarchical($taxonomy)){
|
|
6135
|
|
- $terms_array = array_unique( array_map( 'intval', $terms_array ) );
|
|
|
6134
|
+ if (!is_taxonomy_hierarchical($taxonomy)) {
|
|
|
6135
|
+ $terms_array = array_unique(array_map('intval', $terms_array));
|
|
6136
|
6136
|
}
|
|
6137
|
6137
|
|
|
6138
|
6138
|
wp_set_post_terms($tr_post_id, $terms_array, $taxonomy);
|
|
6139
|
6139
|
|
|
6140
|
|
- if ($taxonomy == $post_type . 'category') {
|
|
6141
|
|
- geodir_set_postcat_structure($tr_post_id, $post_type . 'category');
|
|
|
6140
|
+ if ($taxonomy == $post_type.'category') {
|
|
|
6141
|
+ geodir_set_postcat_structure($tr_post_id, $post_type.'category');
|
|
6142
|
6142
|
}
|
|
6143
|
6143
|
}
|
|
6144
|
6144
|
}
|
|
@@ -6159,15 +6159,15 @@ discard block |
|
|
block discarded – undo |
|
6159
|
6159
|
function geodir_icl_duplicate_post_images($master_post_id, $tr_post_id, $lang) {
|
|
6160
|
6160
|
global $wpdb;
|
|
6161
|
6161
|
|
|
6162
|
|
- $query = $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id));
|
|
|
6162
|
+ $query = $wpdb->prepare("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id));
|
|
6163
|
6163
|
$wpdb->query($query);
|
|
6164
|
6164
|
|
|
6165
|
|
- $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));
|
|
|
6165
|
+ $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));
|
|
6166
|
6166
|
$post_images = $wpdb->get_results($query);
|
|
6167
|
6167
|
|
|
6168
|
|
- if ( !empty( $post_images ) ) {
|
|
6169
|
|
- foreach ( $post_images as $post_image) {
|
|
6170
|
|
- $image_data = (array)$post_image;
|
|
|
6168
|
+ if (!empty($post_images)) {
|
|
|
6169
|
+ foreach ($post_images as $post_image) {
|
|
|
6170
|
+ $image_data = (array) $post_image;
|
|
6171
|
6171
|
unset($image_data['ID']);
|
|
6172
|
6172
|
$image_data['post_id'] = $tr_post_id;
|
|
6173
|
6173
|
|
|
@@ -6193,10 +6193,10 @@ discard block |
|
|
block discarded – undo |
|
6193
|
6193
|
* @return array Event data array.
|
|
6194
|
6194
|
*/
|
|
6195
|
6195
|
function geodir_imex_get_event_data($post, $gd_post_info) {
|
|
6196
|
|
- $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'] ) ) : '';
|
|
|
6196
|
+ $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'])) : '';
|
|
6197
|
6197
|
$event_enddate = $event_date;
|
|
6198
|
|
- $starttime = isset( $post['starttime'] ) && $post['starttime'] != '' && $post['starttime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $post['starttime'] ) ) : '';
|
|
6199
|
|
- $endtime = isset( $post['endtime'] ) && $post['endtime'] != '' && $post['endtime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $post['endtime'] ) ) : '';
|
|
|
6198
|
+ $starttime = isset($post['starttime']) && $post['starttime'] != '' && $post['starttime'] != '00:00:00' ? date_i18n('H:i', strtotime($post['starttime'])) : '';
|
|
|
6199
|
+ $endtime = isset($post['endtime']) && $post['endtime'] != '' && $post['endtime'] != '00:00:00' ? date_i18n('H:i', strtotime($post['endtime'])) : '';
|
|
6200
|
6200
|
|
|
6201
|
6201
|
$is_recurring_event = '';
|
|
6202
|
6202
|
$event_duration_days = '';
|
|
@@ -6213,15 +6213,15 @@ discard block |
|
|
block discarded – undo |
|
6213
|
6213
|
|
|
6214
|
6214
|
$recurring_data = isset($gd_post_info->recurring_dates) ? maybe_unserialize($gd_post_info->recurring_dates) : array();
|
|
6215
|
6215
|
if (!empty($recurring_data)) {
|
|
6216
|
|
- $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;
|
|
6217
|
|
- $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;
|
|
6218
|
|
- $starttime = isset( $recurring_data['starttime'] ) && $recurring_data['starttime'] != '' && $recurring_data['starttime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $recurring_data['starttime'] ) ) : $starttime;
|
|
6219
|
|
- $endtime = isset( $recurring_data['endtime'] ) && $recurring_data['endtime'] != '' && $recurring_data['endtime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $recurring_data['endtime'] ) ) : $endtime;
|
|
|
6216
|
+ $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;
|
|
|
6217
|
+ $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;
|
|
|
6218
|
+ $starttime = isset($recurring_data['starttime']) && $recurring_data['starttime'] != '' && $recurring_data['starttime'] != '00:00:00' ? date_i18n('H:i', strtotime($recurring_data['starttime'])) : $starttime;
|
|
|
6219
|
+ $endtime = isset($recurring_data['endtime']) && $recurring_data['endtime'] != '' && $recurring_data['endtime'] != '00:00:00' ? date_i18n('H:i', strtotime($recurring_data['endtime'])) : $endtime;
|
|
6220
|
6220
|
$is_whole_day_event = !empty($recurring_data['all_day']) ? 1 : '';
|
|
6221
|
6221
|
$different_times = !empty($recurring_data['different_times']) ? true : false;
|
|
6222
|
6222
|
|
|
6223
|
|
- $recurring_pkg = geodir_event_recurring_pkg( $gd_post_info );
|
|
6224
|
|
- $is_recurring = isset( $gd_post_info->is_recurring ) && (int)$gd_post_info->is_recurring == 0 ? false : true;
|
|
|
6223
|
+ $recurring_pkg = geodir_event_recurring_pkg($gd_post_info);
|
|
|
6224
|
+ $is_recurring = isset($gd_post_info->is_recurring) && (int) $gd_post_info->is_recurring == 0 ? false : true;
|
|
6225
|
6225
|
|
|
6226
|
6226
|
if ($recurring_pkg && $is_recurring) {
|
|
6227
|
6227
|
$recurring_dates = $event_date;
|
|
@@ -6231,13 +6231,13 @@ discard block |
|
|
block discarded – undo |
|
6231
|
6231
|
$recurring_type = !empty($recurring_data['repeat_type']) && in_array($recurring_data['repeat_type'], array('day', 'week', 'month', 'year', 'custom')) ? $recurring_data['repeat_type'] : 'custom';
|
|
6232
|
6232
|
|
|
6233
|
6233
|
if (!empty($recurring_data['event_recurring_dates'])) {
|
|
6234
|
|
- $event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] );
|
|
|
6234
|
+ $event_recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
|
|
6235
|
6235
|
|
|
6236
|
6236
|
if (!empty($event_recurring_dates)) {
|
|
6237
|
6237
|
$recurring_dates = array();
|
|
6238
|
6238
|
|
|
6239
|
6239
|
foreach ($event_recurring_dates as $date) {
|
|
6240
|
|
- $recurring_dates[] = date_i18n( 'd/m/Y', strtotime( $date ) );
|
|
|
6240
|
+ $recurring_dates[] = date_i18n('d/m/Y', strtotime($date));
|
|
6241
|
6241
|
}
|
|
6242
|
6242
|
|
|
6243
|
6243
|
$recurring_dates = implode(",", $recurring_dates);
|
|
@@ -6253,7 +6253,7 @@ discard block |
|
|
block discarded – undo |
|
6253
|
6253
|
$times = array();
|
|
6254
|
6254
|
|
|
6255
|
6255
|
foreach ($recurring_data['starttimes'] as $time) {
|
|
6256
|
|
- $times[] = $time != '00:00:00' ? date_i18n( 'H:i', strtotime( $time ) ) : '00:00';
|
|
|
6256
|
+ $times[] = $time != '00:00:00' ? date_i18n('H:i', strtotime($time)) : '00:00';
|
|
6257
|
6257
|
}
|
|
6258
|
6258
|
|
|
6259
|
6259
|
$event_starttimes = implode(",", $times);
|
|
@@ -6263,7 +6263,7 @@ discard block |
|
|
block discarded – undo |
|
6263
|
6263
|
$times = array();
|
|
6264
|
6264
|
|
|
6265
|
6265
|
foreach ($recurring_data['endtimes'] as $time) {
|
|
6266
|
|
- $times[] = $time != '00:00:00' ? date_i18n( 'H:i', strtotime( $time ) ) : '00:00';
|
|
|
6266
|
+ $times[] = $time != '00:00:00' ? date_i18n('H:i', strtotime($time)) : '00:00';
|
|
6267
|
6267
|
}
|
|
6268
|
6268
|
|
|
6269
|
6269
|
$event_endtimes = implode(",", $times);
|
|
@@ -6275,8 +6275,8 @@ discard block |
|
|
block discarded – undo |
|
6275
|
6275
|
}
|
|
6276
|
6276
|
}
|
|
6277
|
6277
|
} else {
|
|
6278
|
|
- $event_duration_days = isset($recurring_data['duration_x']) ? (int)$recurring_data['duration_x'] : 1;
|
|
6279
|
|
- $recurring_interval = !empty($recurring_data['repeat_x']) && (int)$recurring_data['repeat_x'] > 0 ? $recurring_data['repeat_x'] : 1;
|
|
|
6278
|
+ $event_duration_days = isset($recurring_data['duration_x']) ? (int) $recurring_data['duration_x'] : 1;
|
|
|
6279
|
+ $recurring_interval = !empty($recurring_data['repeat_x']) && (int) $recurring_data['repeat_x'] > 0 ? $recurring_data['repeat_x'] : 1;
|
|
6280
|
6280
|
|
|
6281
|
6281
|
if (($recurring_type == 'week' || $recurring_type == 'month') && !empty($recurring_data['repeat_days'])) {
|
|
6282
|
6282
|
$week_days = array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
|
|
@@ -6292,11 +6292,11 @@ discard block |
|
|
block discarded – undo |
|
6292
|
6292
|
}
|
|
6293
|
6293
|
|
|
6294
|
6294
|
$recurring_week_nos = $recurring_type == 'month' && !empty($recurring_data['repeat_weeks']) ? implode(",", $recurring_data['repeat_weeks']) : $recurring_week_nos;
|
|
6295
|
|
- if (!empty($recurring_data['repeat_end_type']) && (int)$recurring_data['repeat_end_type'] == 1) {
|
|
6296
|
|
- $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'] ) ) : '';
|
|
|
6295
|
+ if (!empty($recurring_data['repeat_end_type']) && (int) $recurring_data['repeat_end_type'] == 1) {
|
|
|
6296
|
+ $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'])) : '';
|
|
6297
|
6297
|
$max_recurring_count = empty($recurring_end_date) ? 1 : '';
|
|
6298
|
6298
|
} else {
|
|
6299
|
|
- $max_recurring_count = (!empty($recurring_data['max_repeat']) && (int)$recurring_data['max_repeat'] > 0 ? (int)$recurring_data['max_repeat'] : 1);
|
|
|
6299
|
+ $max_recurring_count = (!empty($recurring_data['max_repeat']) && (int) $recurring_data['max_repeat'] > 0 ? (int) $recurring_data['max_repeat'] : 1);
|
|
6300
|
6300
|
}
|
|
6301
|
6301
|
}
|
|
6302
|
6302
|
}
|
|
@@ -6360,9 +6360,9 @@ discard block |
|
|
block discarded – undo |
|
6360
|
6360
|
* @return array Event data array.
|
|
6361
|
6361
|
*/
|
|
6362
|
6362
|
function geodir_imex_process_event_data($gd_post) {
|
|
6363
|
|
- $recurring_pkg = geodir_event_recurring_pkg( (object)$gd_post );
|
|
|
6363
|
+ $recurring_pkg = geodir_event_recurring_pkg((object) $gd_post);
|
|
6364
|
6364
|
|
|
6365
|
|
- $is_recurring = isset( $gd_post['is_recurring_event'] ) && (int)$gd_post['is_recurring_event'] == 0 ? false : true;
|
|
|
6365
|
+ $is_recurring = isset($gd_post['is_recurring_event']) && (int) $gd_post['is_recurring_event'] == 0 ? false : true;
|
|
6366
|
6366
|
$event_date = isset($gd_post['event_date']) && $gd_post['event_date'] != '' ? geodir_imex_get_date_ymd($gd_post['event_date']) : '';
|
|
6367
|
6367
|
$event_enddate = isset($gd_post['event_enddate']) && $gd_post['event_enddate'] != '' ? geodir_imex_get_date_ymd($gd_post['event_enddate']) : $event_date;
|
|
6368
|
6368
|
$all_day = isset($gd_post['is_whole_day_event']) && !empty($gd_post['is_whole_day_event']) ? true : false;
|
|
@@ -6409,17 +6409,17 @@ discard block |
|
|
block discarded – undo |
|
6409
|
6409
|
$event_recurring_dates = implode(",", $event_recurring_dates);
|
|
6410
|
6410
|
}
|
|
6411
|
6411
|
} else {
|
|
6412
|
|
- $duration_x = !empty( $gd_post['event_duration_days'] ) ? (int)$gd_post['event_duration_days'] : 1;
|
|
6413
|
|
- $repeat_x = !empty( $gd_post['recurring_interval'] ) ? (int)$gd_post['recurring_interval'] : 1;
|
|
6414
|
|
- $max_repeat = !empty( $gd_post['max_recurring_count'] ) ? (int)$gd_post['max_recurring_count'] : 1;
|
|
6415
|
|
- $repeat_end = !empty( $gd_post['recurring_end_date'] ) ? geodir_imex_get_date_ymd($gd_post['recurring_end_date']) : '';
|
|
|
6412
|
+ $duration_x = !empty($gd_post['event_duration_days']) ? (int) $gd_post['event_duration_days'] : 1;
|
|
|
6413
|
+ $repeat_x = !empty($gd_post['recurring_interval']) ? (int) $gd_post['recurring_interval'] : 1;
|
|
|
6414
|
+ $max_repeat = !empty($gd_post['max_recurring_count']) ? (int) $gd_post['max_recurring_count'] : 1;
|
|
|
6415
|
+ $repeat_end = !empty($gd_post['recurring_end_date']) ? geodir_imex_get_date_ymd($gd_post['recurring_end_date']) : '';
|
|
6416
|
6416
|
|
|
6417
|
6417
|
$repeat_end_type = $repeat_end != '' ? 1 : 0;
|
|
6418
|
6418
|
$max_repeat = $repeat_end != '' ? '' : $max_repeat;
|
|
6419
|
6419
|
|
|
6420
|
6420
|
$week_days = array_flip(array('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'));
|
|
6421
|
6421
|
|
|
6422
|
|
- $a_repeat_days = isset($gd_post['recurring_week_days']) && trim($gd_post['recurring_week_days'])!='' ? explode(',', trim($gd_post['recurring_week_days'])) : array();
|
|
|
6422
|
+ $a_repeat_days = isset($gd_post['recurring_week_days']) && trim($gd_post['recurring_week_days']) != '' ? explode(',', trim($gd_post['recurring_week_days'])) : array();
|
|
6423
|
6423
|
$repeat_days = array();
|
|
6424
|
6424
|
if (!empty($a_repeat_days)) {
|
|
6425
|
6425
|
foreach ($a_repeat_days as $repeat_day) {
|
|
@@ -6437,7 +6437,7 @@ discard block |
|
|
block discarded – undo |
|
6437
|
6437
|
$repeat_weeks = array();
|
|
6438
|
6438
|
if (!empty($a_repeat_weeks)) {
|
|
6439
|
6439
|
foreach ($a_repeat_weeks as $repeat_week) {
|
|
6440
|
|
- $repeat_weeks[] = (int)$repeat_week;
|
|
|
6440
|
+ $repeat_weeks[] = (int) $repeat_week;
|
|
6441
|
6441
|
}
|
|
6442
|
6442
|
|
|
6443
|
6443
|
$repeat_weeks = array_unique($repeat_weeks);
|
|
@@ -6501,7 +6501,7 @@ discard block |
|
|
block discarded – undo |
|
6501
|
6501
|
|
|
6502
|
6502
|
$page_found = $wpdb->get_var(
|
|
6503
|
6503
|
$wpdb->prepare(
|
|
6504
|
|
- "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;",
|
|
|
6504
|
+ "SELECT ID FROM ".$wpdb->posts." WHERE post_name = %s LIMIT 1;",
|
|
6505
|
6505
|
array($slug)
|
|
6506
|
6506
|
)
|
|
6507
|
6507
|
);
|
|
@@ -6556,7 +6556,7 @@ discard block |
|
|
block discarded – undo |
|
6556
|
6556
|
*/
|
|
6557
|
6557
|
function geodir_admin_upgrade_notice() {
|
|
6558
|
6558
|
$class = "error";
|
|
6559
|
|
- $message = __("Please update core GeoDirectory or some addons may not function correctly.","geodirectory");
|
|
|
6559
|
+ $message = __("Please update core GeoDirectory or some addons may not function correctly.", "geodirectory");
|
|
6560
|
6560
|
echo"<div class=\"$class\"> <p>$message</p></div>";
|
|
6561
|
6561
|
}
|
|
6562
|
6562
|
|
|
@@ -6568,7 +6568,7 @@ discard block |
|
|
block discarded – undo |
|
6568
|
6568
|
* @param (object) $r
|
|
6569
|
6569
|
* @return (string) $output
|
|
6570
|
6570
|
*/
|
|
6571
|
|
-function geodire_admin_upgrade_notice( $plugin_data, $r )
|
|
|
6571
|
+function geodire_admin_upgrade_notice($plugin_data, $r)
|
|
6572
|
6572
|
{
|
|
6573
|
6573
|
// readme contents
|
|
6574
|
6574
|
$args = array(
|
|
@@ -6576,7 +6576,7 @@ discard block |
|
|
block discarded – undo |
|
6576
|
6576
|
'redirection' => 5
|
|
6577
|
6577
|
);
|
|
6578
|
6578
|
$url = "http://plugins.svn.wordpress.org/geodirectory/trunk/readme.txt";
|
|
6579
|
|
- $data = wp_remote_get( $url, $args );
|
|
|
6579
|
+ $data = wp_remote_get($url, $args);
|
|
6580
|
6580
|
|
|
6581
|
6581
|
if (!is_wp_error($data) && $data['response']['code'] == 200) {
|
|
6582
|
6582
|
|
|
@@ -6591,20 +6591,20 @@ discard block |
|
|
block discarded – undo |
|
6591
|
6591
|
function geodir_in_plugin_update_message($content) {
|
|
6592
|
6592
|
// Output Upgrade Notice
|
|
6593
|
6593
|
$matches = null;
|
|
6594
|
|
- $regexp = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( GEODIRECTORY_VERSION ) . '\s*=|$)~Uis';
|
|
|
6594
|
+ $regexp = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*'.preg_quote(GEODIRECTORY_VERSION).'\s*=|$)~Uis';
|
|
6595
|
6595
|
$upgrade_notice = '';
|
|
6596
|
|
- if ( preg_match( $regexp, $content, $matches ) ) {
|
|
6597
|
|
- if(empty($matches)){return;}
|
|
|
6596
|
+ if (preg_match($regexp, $content, $matches)) {
|
|
|
6597
|
+ if (empty($matches)) {return; }
|
|
6598
|
6598
|
|
|
6599
|
|
- $version = trim( $matches[1] );
|
|
6600
|
|
- if($version && $version>GEODIRECTORY_VERSION){
|
|
|
6599
|
+ $version = trim($matches[1]);
|
|
|
6600
|
+ if ($version && $version > GEODIRECTORY_VERSION) {
|
|
6601
|
6601
|
|
|
6602
|
6602
|
|
|
6603
|
|
- $notices = (array) preg_split('~[\r\n]+~', trim( $matches[2] ) );
|
|
6604
|
|
- if ( version_compare( GEODIRECTORY_VERSION, $version, '<' ) ) {
|
|
|
6603
|
+ $notices = (array) preg_split('~[\r\n]+~', trim($matches[2]));
|
|
|
6604
|
+ if (version_compare(GEODIRECTORY_VERSION, $version, '<')) {
|
|
6605
|
6605
|
$upgrade_notice .= '<div class="geodir_plugin_upgrade_notice">';
|
|
6606
|
|
- foreach ( $notices as $index => $line ) {
|
|
6607
|
|
- $upgrade_notice .= wp_kses_post( preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line ) );
|
|
|
6606
|
+ foreach ($notices as $index => $line) {
|
|
|
6607
|
+ $upgrade_notice .= wp_kses_post(preg_replace('~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line));
|
|
6608
|
6608
|
}
|
|
6609
|
6609
|
$upgrade_notice .= '</div> ';
|
|
6610
|
6610
|
}
|
|
@@ -6628,7 +6628,7 @@ discard block |
|
|
block discarded – undo |
|
6628
|
6628
|
$default_language = $sitepress->get_default_language();
|
|
6629
|
6629
|
if ($current_language != 'all' && $current_language != $default_language) {
|
|
6630
|
6630
|
?>
|
|
6631
|
|
- <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>
|
|
|
6631
|
+ <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>
|
|
6632
|
6632
|
<?php
|
|
6633
|
6633
|
}
|
|
6634
|
6634
|
}
|
|
@@ -6643,7 +6643,7 @@ discard block |
|
|
block discarded – undo |
|
6643
|
6643
|
* @param array Listing statuses to be skipped.
|
|
6644
|
6644
|
*/
|
|
6645
|
6645
|
function geodir_imex_export_skip_statuses() {
|
|
6646
|
|
- $statuses = array( 'trash', 'auto-draft' );
|
|
|
6646
|
+ $statuses = array('trash', 'auto-draft');
|
|
6647
|
6647
|
|
|
6648
|
6648
|
/**
|
|
6649
|
6649
|
* Filter the statuses to skip during GD export listings.
|
|
@@ -6653,7 +6653,7 @@ discard block |
|
|
block discarded – undo |
|
6653
|
6653
|
*
|
|
6654
|
6654
|
* @param array $statuses Listing statuses to be skipped.
|
|
6655
|
6655
|
*/
|
|
6656
|
|
- $statuses = apply_filters( 'geodir_imex_export_skip_statuses', $statuses );
|
|
|
6656
|
+ $statuses = apply_filters('geodir_imex_export_skip_statuses', $statuses);
|
|
6657
|
6657
|
|
|
6658
|
6658
|
return $statuses;
|
|
6659
|
6659
|
}
|
|
@@ -6693,16 +6693,16 @@ discard block |
|
|
block discarded – undo |
|
6693
|
6693
|
function geodir_imex_get_filter_where($where = '', $post_type = '') {
|
|
6694
|
6694
|
global $wpdb;
|
|
6695
|
6695
|
|
|
6696
|
|
- $filters = !empty( $_REQUEST['gd_imex'] ) && is_array( $_REQUEST['gd_imex'] ) ? $_REQUEST['gd_imex'] : NULL;
|
|
|
6696
|
+ $filters = !empty($_REQUEST['gd_imex']) && is_array($_REQUEST['gd_imex']) ? $_REQUEST['gd_imex'] : NULL;
|
|
6697
|
6697
|
|
|
6698
|
|
- if ( !empty( $filters ) ) {
|
|
6699
|
|
- foreach ( $filters as $field => $value ) {
|
|
|
6698
|
+ if (!empty($filters)) {
|
|
|
6699
|
+ foreach ($filters as $field => $value) {
|
|
6700
|
6700
|
switch ($field) {
|
|
6701
|
6701
|
case 'start_date':
|
|
6702
|
|
- $where .= " AND `" . $wpdb->posts . "`.`post_date` >= '" . sanitize_text_field( $value ) . " 23:59:59'";
|
|
|
6702
|
+ $where .= " AND `".$wpdb->posts."`.`post_date` >= '".sanitize_text_field($value)." 23:59:59'";
|
|
6703
|
6703
|
break;
|
|
6704
|
6704
|
case 'end_date':
|
|
6705
|
|
- $where .= " AND `" . $wpdb->posts . "`.`post_date` <= '" . sanitize_text_field( $value ) . " 23:59:59'";
|
|
|
6705
|
+ $where .= " AND `".$wpdb->posts."`.`post_date` <= '".sanitize_text_field($value)." 23:59:59'";
|
|
6706
|
6706
|
break;
|
|
6707
|
6707
|
}
|
|
6708
|
6708
|
}
|