@@ -46,31 +46,31 @@ discard block |
||
| 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 |
||
| 89 | 89 | wp_register_style('geodirectory-font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION);
|
| 90 | 90 | wp_enqueue_style('geodirectory-font-awesome');
|
| 91 | 91 | |
| 92 | - wp_register_script('geodirectory-admin', geodir_plugin_url() . '/geodirectory-assets/js/admin-req.min.js', array('jquery'), GEODIRECTORY_VERSION);
|
|
| 92 | + wp_register_script('geodirectory-admin', geodir_plugin_url().'/geodirectory-assets/js/admin-req.min.js', array('jquery'), GEODIRECTORY_VERSION);
|
|
| 93 | 93 | wp_enqueue_script('geodirectory-admin');
|
| 94 | 94 | |
| 95 | 95 | } |
@@ -108,59 +108,59 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 2691 | 2691 | <div class="gd-imex-btns" style="display:none;"> |
| 2692 | 2692 | <input type="hidden" class="geodir_import_file" name="geodir_import_file" value="save"/> |
| 2693 | 2693 | <input onclick="gd_imex_PrepareImport(this, 'post')" type="button" value="<?php echo CSV_IMPORT_DATA; ?>" id="gd_import_data" class="button-primary" /> |
| 2694 | - <input onclick="gd_imex_ContinueImport(this, 'post')" type="button" value="<?php _e( "Continue Import Data", 'geodirectory' );?>" id="gd_continue_data" class="button-primary" style="display:none"/> |
|
| 2695 | - <input type="button" value="<?php _e("Terminate Import Data", 'geodirectory');?>" id="gd_stop_import" class="button-primary" name="gd_stop_import" style="display:none" onclick="gd_imex_TerminateImport(this, 'post')"/>
|
|
| 2694 | + <input onclick="gd_imex_ContinueImport(this, 'post')" type="button" value="<?php _e("Continue Import Data", 'geodirectory'); ?>" id="gd_continue_data" class="button-primary" style="display:none"/>
|
|
| 2695 | + <input type="button" value="<?php _e("Terminate Import Data", 'geodirectory'); ?>" id="gd_stop_import" class="button-primary" name="gd_stop_import" style="display:none" onclick="gd_imex_TerminateImport(this, 'post')"/>
|
|
| 2696 | 2696 | <div id="gd_process_data" style="display:none"> |
| 2697 | - <span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory');?>
|
|
| 2697 | + <span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory'); ?>
|
|
| 2698 | 2698 | </div> |
| 2699 | 2699 | </div> |
| 2700 | 2700 | </td> |
@@ -2708,26 +2708,26 @@ discard block |
||
| 2708 | 2708 | <div id="gd_ie_excategs" class="metabox-holder"> |
| 2709 | 2709 | <div class="meta-box-sortables ui-sortable"> |
| 2710 | 2710 | <div id="gd_ie_ex_posts" class="postbox gd-hndle-pbox"> |
| 2711 | - <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e( 'Toggle panel - Listings: Export CSV', 'geodirectory' );?></span><span aria-hidden="true" class="toggle-indicator"></span></button> |
|
| 2712 | - <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Listings: Export CSV', 'geodirectory' );?></span></h3> |
|
| 2711 | + <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e('Toggle panel - Listings: Export CSV', 'geodirectory'); ?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
|
|
| 2712 | + <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Listings: Export CSV', 'geodirectory'); ?></span></h3>
|
|
| 2713 | 2713 | <div class="inside"> |
| 2714 | 2714 | <table class="form-table"> |
| 2715 | 2715 | <tbody> |
| 2716 | 2716 | <tr> |
| 2717 | 2717 | <td class="fld"><label for="gd_post_type"> |
| 2718 | - <?php _e( 'Post Type:', 'geodirectory' );?> |
|
| 2718 | + <?php _e('Post Type:', 'geodirectory'); ?>
|
|
| 2719 | 2719 | </label></td> |
| 2720 | 2720 | <td><select name="gd_post_type" id="gd_post_type" style="min-width:140px"> |
| 2721 | - <?php echo $gd_posttypes_option;?> |
|
| 2721 | + <?php echo $gd_posttypes_option; ?> |
|
| 2722 | 2722 | </select></td> |
| 2723 | 2723 | </tr> |
| 2724 | 2724 | <tr> |
| 2725 | - <td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e( 'Max entries per csv file:', 'geodirectory' );?></label></td> |
|
| 2726 | - <td><select name="gd_chunk_size" id="gd_chunk_size" style="min-width:140px"><?php echo $gd_chunksize_option;?></select><span class="description"><?php _e( 'Please select the maximum number of entries per csv file (defaults to 5000, you might want to lower this to prevent memory issues on some installs)', 'geodirectory' );?></span></td> |
|
| 2725 | + <td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e('Max entries per csv file:', 'geodirectory'); ?></label></td>
|
|
| 2726 | + <td><select name="gd_chunk_size" id="gd_chunk_size" style="min-width:140px"><?php echo $gd_chunksize_option; ?></select><span class="description"><?php _e('Please select the maximum number of entries per csv file (defaults to 5000, you might want to lower this to prevent memory issues on some installs)', 'geodirectory'); ?></span></td>
|
|
| 2727 | 2727 | </tr> |
| 2728 | 2728 | <tr> |
| 2729 | 2729 | <td class="fld" style="vertical-align:top"><label> |
| 2730 | - <?php _e( 'Progress:', 'geodirectory' );?> |
|
| 2730 | + <?php _e('Progress:', 'geodirectory'); ?>
|
|
| 2731 | 2731 | </label></td> |
| 2732 | 2732 | <td><div id='gd_progressbar_box'> |
| 2733 | 2733 | <div id="gd_progressbar" class="gd_progressbar"> |
@@ -2735,13 +2735,13 @@ discard block |
||
| 2735 | 2735 | </div> |
| 2736 | 2736 | </div> |
| 2737 | 2737 | <p style="display:inline-block"> |
| 2738 | - <?php _e( 'Elapsed Time:', 'geodirectory' );?> |
|
| 2738 | + <?php _e('Elapsed Time:', 'geodirectory'); ?>
|
|
| 2739 | 2739 | </p> |
| 2740 | 2740 | |
| 2741 | 2741 | <p id="gd_timer" class="gd_timer">00:00:00</p></td> |
| 2742 | 2742 | </tr> |
| 2743 | 2743 | <tr class="gd-ie-actions"> |
| 2744 | - <td style="vertical-align:top"><input type="submit" value="<?php echo esc_attr( __( 'Export CSV', 'geodirectory' ) );?>" class="button-primary" name="gd_ie_exposts_submit" id="gd_ie_exposts_submit"> |
|
| 2744 | + <td style="vertical-align:top"><input type="submit" value="<?php echo esc_attr(__('Export CSV', 'geodirectory')); ?>" class="button-primary" name="gd_ie_exposts_submit" id="gd_ie_exposts_submit">
|
|
| 2745 | 2745 | </td> |
| 2746 | 2746 | <td id="gd_ie_ex_files" class="gd-ie-files"></td> |
| 2747 | 2747 | </tr> |
@@ -2754,21 +2754,21 @@ discard block |
||
| 2754 | 2754 | <div id="gd_ie_imcategs" class="metabox-holder"> |
| 2755 | 2755 | <div class="meta-box-sortables ui-sortable"> |
| 2756 | 2756 | <div id="gd_ie_imcats" class="postbox gd-hndle-pbox"> |
| 2757 | - <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e( 'Toggle panel - GD Categories: Import CSV', 'geodirectory' );?></span><span aria-hidden="true" class="toggle-indicator"></span></button> |
|
| 2758 | - <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Categories: Import CSV', 'geodirectory' );?></span></h3> |
|
| 2757 | + <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e('Toggle panel - GD Categories: Import CSV', 'geodirectory'); ?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
|
|
| 2758 | + <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Categories: Import CSV', 'geodirectory'); ?></span></h3>
|
|
| 2759 | 2759 | <div class="inside"> |
| 2760 | 2760 | <table class="form-table"> |
| 2761 | 2761 | <tbody> |
| 2762 | 2762 | <tr> |
| 2763 | 2763 | <td class="gd-imex-box"> |
| 2764 | 2764 | <div class="gd-im-choices"> |
| 2765 | - <p><input type="radio" value="update" name="gd_im_choicecat" id="gd_im_cchoice_u" /><label for="gd_im_cchoice_u"><?php _e( 'Update item if item with cat_id/cat_slug already exists.', 'geodirectory' );?></label></p> |
|
| 2766 | - <p><input type="radio" checked="checked" value="skip" name="gd_im_choicecat" id="gd_im_cchoice_s" /><label for="gd_im_cchoice_s"><?php _e( 'Ignore item if item with cat_id/cat_slug already exists.', 'geodirectory' );?></label></p> |
|
| 2765 | + <p><input type="radio" value="update" name="gd_im_choicecat" id="gd_im_cchoice_u" /><label for="gd_im_cchoice_u"><?php _e('Update item if item with cat_id/cat_slug already exists.', 'geodirectory'); ?></label></p>
|
|
| 2766 | + <p><input type="radio" checked="checked" value="skip" name="gd_im_choicecat" id="gd_im_cchoice_s" /><label for="gd_im_cchoice_s"><?php _e('Ignore item if item with cat_id/cat_slug already exists.', 'geodirectory'); ?></label></p>
|
|
| 2767 | 2767 | </div> |
| 2768 | 2768 | <div class="plupload-upload-uic hide-if-no-js" id="gd_im_catplupload-upload-ui"> |
| 2769 | 2769 | <input type="text" readonly="readonly" name="gd_im_cat_file" class="gd-imex-file gd_im_cat_file" id="gd_im_cat" onclick="jQuery('#gd_im_catplupload-browse-button').trigger('click');" />
|
| 2770 | - <input id="gd_im_catplupload-browse-button" type="button" value="<?php echo SELECT_UPLOAD_CSV; ?>" class="gd-imex-cupload button-primary" /><input type="button" value="<?php echo esc_attr( __( 'Download Sample CSV', 'geodirectory' ) );?>" class="button-secondary" name="gd_ie_imcats_sample" id="gd_ie_imcats_sample"> |
|
| 2771 | - <input type="hidden" id="gd_ie_imcats_csv" value="<?php echo $gd_cats_sample_csv;?>" /> |
|
| 2770 | + <input id="gd_im_catplupload-browse-button" type="button" value="<?php echo SELECT_UPLOAD_CSV; ?>" class="gd-imex-cupload button-primary" /><input type="button" value="<?php echo esc_attr(__('Download Sample CSV', 'geodirectory')); ?>" class="button-secondary" name="gd_ie_imcats_sample" id="gd_ie_imcats_sample">
|
|
| 2771 | + <input type="hidden" id="gd_ie_imcats_csv" value="<?php echo $gd_cats_sample_csv; ?>" /> |
|
| 2772 | 2772 | <?php |
| 2773 | 2773 | /** |
| 2774 | 2774 | * Called just after the sample CSV download link. |
@@ -2778,7 +2778,7 @@ discard block |
||
| 2778 | 2778 | */ |
| 2779 | 2779 | do_action('geodir_sample_cats_csv_download_link');
|
| 2780 | 2780 | ?> |
| 2781 | - <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce( 'gd_im_catpluploadan' ); ?>"></span> |
|
| 2781 | + <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce('gd_im_catpluploadan'); ?>"></span>
|
|
| 2782 | 2782 | <div class="filelist"></div> |
| 2783 | 2783 | </div> |
| 2784 | 2784 | <span id="gd_im_catupload-error" style="display:none"></span> |
@@ -2795,7 +2795,7 @@ discard block |
||
| 2795 | 2795 | <input type="hidden" id="gd_terminateaction" value="continue"/> |
| 2796 | 2796 | </div> |
| 2797 | 2797 | <div class="gd-import-progress" id="gd-import-progress" style="display:none"> |
| 2798 | - <div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory');?> </b><font
|
|
| 2798 | + <div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory'); ?> </b><font
|
|
| 2799 | 2799 | id="gd-import-done">0</font> / <font id="gd-import-total">0</font> ( <font |
| 2800 | 2800 | id="gd-import-perc">0%</font> ) |
| 2801 | 2801 | <div class="gd-fileprogress"></div> |
@@ -2807,10 +2807,10 @@ discard block |
||
| 2807 | 2807 | <div class="gd-imex-btns" style="display:none;"> |
| 2808 | 2808 | <input type="hidden" class="geodir_import_file" name="geodir_import_file" value="save"/> |
| 2809 | 2809 | <input onclick="gd_imex_PrepareImport(this, 'cat')" type="button" value="<?php echo CSV_IMPORT_DATA; ?>" id="gd_import_data" class="button-primary" /> |
| 2810 | - <input onclick="gd_imex_ContinueImport(this, 'cat')" type="button" value="<?php _e( "Continue Import Data", 'geodirectory' );?>" id="gd_continue_data" class="button-primary" style="display:none"/> |
|
| 2811 | - <input type="button" value="<?php _e("Terminate Import Data", 'geodirectory');?>" id="gd_stop_import" class="button-primary" name="gd_stop_import" style="display:none" onclick="gd_imex_TerminateImport(this, 'cat')"/>
|
|
| 2810 | + <input onclick="gd_imex_ContinueImport(this, 'cat')" type="button" value="<?php _e("Continue Import Data", 'geodirectory'); ?>" id="gd_continue_data" class="button-primary" style="display:none"/>
|
|
| 2811 | + <input type="button" value="<?php _e("Terminate Import Data", 'geodirectory'); ?>" id="gd_stop_import" class="button-primary" name="gd_stop_import" style="display:none" onclick="gd_imex_TerminateImport(this, 'cat')"/>
|
|
| 2812 | 2812 | <div id="gd_process_data" style="display:none"> |
| 2813 | - <span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory');?>
|
|
| 2813 | + <span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory'); ?>
|
|
| 2814 | 2814 | </div> |
| 2815 | 2815 | </div> |
| 2816 | 2816 | </td> |
@@ -2824,26 +2824,26 @@ discard block |
||
| 2824 | 2824 | <div id="gd_ie_excategs" class="metabox-holder"> |
| 2825 | 2825 | <div class="meta-box-sortables ui-sortable"> |
| 2826 | 2826 | <div id="gd_ie_ex_cats" class="postbox gd-hndle-pbox"> |
| 2827 | - <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e( 'Toggle panel - GD Categories: Export CSV', 'geodirectory' );?></span><span aria-hidden="true" class="toggle-indicator"></span></button> |
|
| 2828 | - <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Categories: Export CSV', 'geodirectory' );?></span></h3> |
|
| 2827 | + <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e('Toggle panel - GD Categories: Export CSV', 'geodirectory'); ?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
|
|
| 2828 | + <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Categories: Export CSV', 'geodirectory'); ?></span></h3>
|
|
| 2829 | 2829 | <div class="inside"> |
| 2830 | 2830 | <table class="form-table"> |
| 2831 | 2831 | <tbody> |
| 2832 | 2832 | <tr> |
| 2833 | - <td class="fld"><label for="gd_post_type"><?php _e( 'Post Type:', 'geodirectory' );?></label></td> |
|
| 2834 | - <td><select name="gd_post_type" id="gd_post_type" style="min-width:140px"><?php echo $gd_posttypes_option;?></select></td> |
|
| 2833 | + <td class="fld"><label for="gd_post_type"><?php _e('Post Type:', 'geodirectory'); ?></label></td>
|
|
| 2834 | + <td><select name="gd_post_type" id="gd_post_type" style="min-width:140px"><?php echo $gd_posttypes_option; ?></select></td> |
|
| 2835 | 2835 | </tr> |
| 2836 | 2836 | <tr> |
| 2837 | - <td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e( 'Max entries per csv file:', 'geodirectory' );?></label></td> |
|
| 2838 | - <td><select name="gd_chunk_size" id="gd_chunk_size" style="min-width:140px"><?php echo $gd_chunksize_option;?></select><span class="description"><?php _e( 'Please select the maximum number of entries per csv file (defaults to 5000, you might want to lower this to prevent memory issues on some installs)', 'geodirectory' );?></span></td> |
|
| 2837 | + <td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e('Max entries per csv file:', 'geodirectory'); ?></label></td>
|
|
| 2838 | + <td><select name="gd_chunk_size" id="gd_chunk_size" style="min-width:140px"><?php echo $gd_chunksize_option; ?></select><span class="description"><?php _e('Please select the maximum number of entries per csv file (defaults to 5000, you might want to lower this to prevent memory issues on some installs)', 'geodirectory'); ?></span></td>
|
|
| 2839 | 2839 | </tr> |
| 2840 | 2840 | <tr> |
| 2841 | - <td class="fld" style="vertical-align:top"><label><?php _e( 'Progress:', 'geodirectory' );?></label></td> |
|
| 2842 | - <td><div id='gd_progressbar_box'><div id="gd_progressbar" class="gd_progressbar"><div class="gd-progress-label"></div></div></div><p style="display:inline-block"><?php _e( 'Elapsed Time:', 'geodirectory' );?></p> <p id="gd_timer" class="gd_timer">00:00:00</p></td> |
|
| 2841 | + <td class="fld" style="vertical-align:top"><label><?php _e('Progress:', 'geodirectory'); ?></label></td>
|
|
| 2842 | + <td><div id='gd_progressbar_box'><div id="gd_progressbar" class="gd_progressbar"><div class="gd-progress-label"></div></div></div><p style="display:inline-block"><?php _e('Elapsed Time:', 'geodirectory'); ?></p> <p id="gd_timer" class="gd_timer">00:00:00</p></td>
|
|
| 2843 | 2843 | </tr> |
| 2844 | 2844 | <tr class="gd-ie-actions"> |
| 2845 | 2845 | <td style="vertical-align:top"> |
| 2846 | - <input type="submit" value="<?php echo esc_attr( __( 'Export CSV', 'geodirectory' ) );?>" class="button-primary" name="gd_ie_excats_submit" id="gd_ie_excats_submit"> |
|
| 2846 | + <input type="submit" value="<?php echo esc_attr(__('Export CSV', 'geodirectory')); ?>" class="button-primary" name="gd_ie_excats_submit" id="gd_ie_excats_submit">
|
|
| 2847 | 2847 | </td> |
| 2848 | 2848 | <td id="gd_ie_ex_files" class="gd-ie-files"></td> |
| 2849 | 2849 | </tr> |
@@ -2865,7 +2865,7 @@ discard block |
||
| 2865 | 2865 | * @param array $gd_chunksize_options File chunk size options. |
| 2866 | 2866 | * @param string $nonce Wordpress security token for GD import & export. |
| 2867 | 2867 | */ |
| 2868 | - do_action( 'geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce ); |
|
| 2868 | + do_action('geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce);
|
|
| 2869 | 2869 | ?> |
| 2870 | 2870 | </div> |
| 2871 | 2871 | </div> |
@@ -2884,7 +2884,7 @@ discard block |
||
| 2884 | 2884 | jQuery.ajax({
|
| 2885 | 2885 | url: ajaxurl, |
| 2886 | 2886 | type: "POST", |
| 2887 | - data: 'action=geodir_import_export&task=prepare_import&_pt=' + type + '&_file=' + uploadedFile + '&_nonce=<?php echo $nonce;?>', |
|
| 2887 | + data: 'action=geodir_import_export&task=prepare_import&_pt=' + type + '&_file=' + uploadedFile + '&_nonce=<?php echo $nonce; ?>', |
|
| 2888 | 2888 | dataType: 'json', |
| 2889 | 2889 | cache: false, |
| 2890 | 2890 | success: function(data) {
|
@@ -2936,7 +2936,7 @@ discard block |
||
| 2936 | 2936 | |
| 2937 | 2937 | jQuery(cont).find('.filelist .file').remove();
|
| 2938 | 2938 | |
| 2939 | - jQuery('#gd-import-msg', cont).find('#message').removeClass('updated').addClass('error').html("<p><?php echo esc_attr( PLZ_SELECT_CSV_FILE );?></p>");
|
|
| 2939 | + jQuery('#gd-import-msg', cont).find('#message').removeClass('updated').addClass('error').html("<p><?php echo esc_attr(PLZ_SELECT_CSV_FILE); ?></p>");
|
|
| 2940 | 2940 | jQuery('#gd-import-msg', cont).show();
|
| 2941 | 2941 | |
| 2942 | 2942 | return false; |
@@ -2995,7 +2995,7 @@ discard block |
||
| 2995 | 2995 | jQuery.ajax({
|
| 2996 | 2996 | url: ajaxurl, |
| 2997 | 2997 | type: "POST", |
| 2998 | - data: 'action=geodir_import_export&task=import_' + type + '&_pt=' + type + '&_file=' + uploadedFile + gddata + '&_ch=' + choice + '&_nonce=<?php echo $nonce;?>', |
|
| 2998 | + data: 'action=geodir_import_export&task=import_' + type + '&_pt=' + type + '&_file=' + uploadedFile + gddata + '&_ch=' + choice + '&_nonce=<?php echo $nonce; ?>', |
|
| 2999 | 2999 | dataType : 'json', |
| 3000 | 3000 | cache: false, |
| 3001 | 3001 | success: function (data) {
|
@@ -3184,27 +3184,27 @@ discard block |
||
| 3184 | 3184 | |
| 3185 | 3185 | var gdMsg = '<p></p>'; |
| 3186 | 3186 | if ( processed > 0 ) {
|
| 3187 | - var msgParse = '<p><?php echo addslashes( sprintf( __( 'Total %s item(s) found.', 'geodirectory' ), '%s' ) );?></p>'; |
|
| 3187 | + var msgParse = '<p><?php echo addslashes(sprintf(__('Total %s item(s) found.', 'geodirectory'), '%s')); ?></p>';
|
|
| 3188 | 3188 | msgParse = msgParse.replace("%s", processed);
|
| 3189 | 3189 | gdMsg += msgParse; |
| 3190 | 3190 | } |
| 3191 | 3191 | |
| 3192 | 3192 | if ( updated > 0 ) {
|
| 3193 | - var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) updated.', 'geodirectory' ), '%s', '%d' ) );?></p>'; |
|
| 3193 | + var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) updated.', 'geodirectory'), '%s', '%d')); ?></p>';
|
|
| 3194 | 3194 | msgParse = msgParse.replace("%s", updated);
|
| 3195 | 3195 | msgParse = msgParse.replace("%d", processed);
|
| 3196 | 3196 | gdMsg += msgParse; |
| 3197 | 3197 | } |
| 3198 | 3198 | |
| 3199 | 3199 | if ( created > 0 ) {
|
| 3200 | - var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) added.', 'geodirectory' ), '%s', '%d' ) );?></p>'; |
|
| 3200 | + var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) added.', 'geodirectory'), '%s', '%d')); ?></p>';
|
|
| 3201 | 3201 | msgParse = msgParse.replace("%s", created);
|
| 3202 | 3202 | msgParse = msgParse.replace("%d", processed);
|
| 3203 | 3203 | gdMsg += msgParse; |
| 3204 | 3204 | } |
| 3205 | 3205 | |
| 3206 | 3206 | if ( skipped > 0 ) {
|
| 3207 | - var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) ignored due to already exists.', 'geodirectory' ), '%s', '%d' ) );?></p>'; |
|
| 3207 | + var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) ignored due to already exists.', 'geodirectory'), '%s', '%d')); ?></p>';
|
|
| 3208 | 3208 | msgParse = msgParse.replace("%s", skipped);
|
| 3209 | 3209 | msgParse = msgParse.replace("%d", processed);
|
| 3210 | 3210 | gdMsg += msgParse; |
@@ -3214,17 +3214,17 @@ discard block |
||
| 3214 | 3214 | if (type=='loc') {
|
| 3215 | 3215 | invalid_addr = invalid; |
| 3216 | 3216 | } |
| 3217 | - var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory' ), '%s', '%d' ) );?></p>'; |
|
| 3217 | + var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory'), '%s', '%d')); ?></p>';
|
|
| 3218 | 3218 | msgParse = msgParse.replace("%s", invalid_addr);
|
| 3219 | 3219 | msgParse = msgParse.replace("%d", total);
|
| 3220 | 3220 | gdMsg += msgParse; |
| 3221 | 3221 | } |
| 3222 | 3222 | |
| 3223 | 3223 | if (invalid > 0 && type!='loc') {
|
| 3224 | - var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) could not be added due to blank title/invalid post type/invalid characters used in data.', 'geodirectory' ), '%s', '%d' ) );?></p>'; |
|
| 3224 | + var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) could not be added due to blank title/invalid post type/invalid characters used in data.', 'geodirectory'), '%s', '%d')); ?></p>';
|
|
| 3225 | 3225 | |
| 3226 | 3226 | if (type=='hood') {
|
| 3227 | - msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) could not be added due to invalid neighbourhood data(name, latitude, longitude) or invalid location data(either location_id or city/region/country is empty)', 'geodirectory' ), '%s', '%d' ) );?></p>'; |
|
| 3227 | + msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) could not be added due to invalid neighbourhood data(name, latitude, longitude) or invalid location data(either location_id or city/region/country is empty)', 'geodirectory'), '%s', '%d')); ?></p>';
|
|
| 3228 | 3228 | } |
| 3229 | 3229 | msgParse = msgParse.replace("%s", invalid);
|
| 3230 | 3230 | msgParse = msgParse.replace("%d", total);
|
@@ -3232,7 +3232,7 @@ discard block |
||
| 3232 | 3232 | } |
| 3233 | 3233 | |
| 3234 | 3234 | if (images > 0) {
|
| 3235 | - gdMsg += '<p><?php echo addslashes( sprintf( CSV_TRANSFER_IMG_FOLDER, $uploads['subdir'] ) );?></p>'; |
|
| 3235 | + gdMsg += '<p><?php echo addslashes(sprintf(CSV_TRANSFER_IMG_FOLDER, $uploads['subdir'])); ?></p>'; |
|
| 3236 | 3236 | } |
| 3237 | 3237 | gdMsg += '<p></p>'; |
| 3238 | 3238 | jQuery('#gd-import-msg', cont).find('#message').removeClass('error').addClass('updated').html(gdMsg);
|
@@ -3381,7 +3381,7 @@ discard block |
||
| 3381 | 3381 | |
| 3382 | 3382 | function gd_process_export_posts(el, post_type, total_posts, chunk_size, pages, page) {
|
| 3383 | 3383 | if (page < 2) {
|
| 3384 | - gd_progressbar(el, 0, '0% (0 / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>'); |
|
| 3384 | + gd_progressbar(el, 0, '0% (0 / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>');
|
|
| 3385 | 3385 | jQuery(el).find('#gd_timer').text('00:00:01');
|
| 3386 | 3386 | jQuery('#gd_ie_ex_files', el).html('');
|
| 3387 | 3387 | } |
@@ -3389,7 +3389,7 @@ discard block |
||
| 3389 | 3389 | jQuery.ajax({
|
| 3390 | 3390 | url: ajaxurl, |
| 3391 | 3391 | type: "POST", |
| 3392 | - data: 'action=geodir_import_export&task=export_posts&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce;?>&_p=' + page, |
|
| 3392 | + data: 'action=geodir_import_export&task=export_posts&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce; ?>&_p=' + page, |
|
| 3393 | 3393 | dataType : 'json', |
| 3394 | 3394 | cache: false, |
| 3395 | 3395 | beforeSend: function (jqXHR, settings) {},
|
@@ -3403,11 +3403,11 @@ discard block |
||
| 3403 | 3403 | } else {
|
| 3404 | 3404 | if (pages < page || pages == page) {
|
| 3405 | 3405 | window.clearInterval(timer_posts); |
| 3406 | - gd_progressbar(el, 100, '100% (' + total_posts + ' / ' + total_posts + ') <i class="fa fa-check"></i><?php echo esc_attr( __( 'Complete!', 'geodirectory' ) );?>');
|
|
| 3406 | + gd_progressbar(el, 100, '100% (' + total_posts + ' / ' + total_posts + ') <i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirectory')); ?>');
|
|
| 3407 | 3407 | } else {
|
| 3408 | 3408 | var percentage = Math.round(((page * chunk_size) / total_posts) * 100); |
| 3409 | 3409 | percentage = percentage > 100 ? 100 : percentage; |
| 3410 | - gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>');
|
|
| 3410 | + gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>');
|
|
| 3411 | 3411 | } |
| 3412 | 3412 | if (typeof data.files != 'undefined' && jQuery(data.files).length ) {
|
| 3413 | 3413 | var obj_files = data.files; |
@@ -3437,7 +3437,7 @@ discard block |
||
| 3437 | 3437 | |
| 3438 | 3438 | function gd_process_export_cats(el, post_type, total_cats, chunk_size, pages, page) {
|
| 3439 | 3439 | if (page < 2) {
|
| 3440 | - gd_progressbar(el, 0, '0% (0 / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>'); |
|
| 3440 | + gd_progressbar(el, 0, '0% (0 / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>');
|
|
| 3441 | 3441 | jQuery(el).find('#gd_timer').text('00:00:01');
|
| 3442 | 3442 | jQuery('#gd_ie_ex_files', el).html('');
|
| 3443 | 3443 | } |
@@ -3445,7 +3445,7 @@ discard block |
||
| 3445 | 3445 | jQuery.ajax({
|
| 3446 | 3446 | url: ajaxurl, |
| 3447 | 3447 | type: "POST", |
| 3448 | - data: 'action=geodir_import_export&task=export_cats&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce;?>&_p=' + page, |
|
| 3448 | + data: 'action=geodir_import_export&task=export_cats&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce; ?>&_p=' + page, |
|
| 3449 | 3449 | dataType : 'json', |
| 3450 | 3450 | cache: false, |
| 3451 | 3451 | beforeSend: function (jqXHR, settings) {},
|
@@ -3459,11 +3459,11 @@ discard block |
||
| 3459 | 3459 | } else {
|
| 3460 | 3460 | if (pages < page || pages == page) {
|
| 3461 | 3461 | window.clearInterval(timer_cats); |
| 3462 | - gd_progressbar(el, 100, '100% (' + total_cats + ' / ' + total_cats + ') <i class="fa fa-check"></i><?php echo esc_attr( __( 'Complete!', 'geodirectory' ) );?>');
|
|
| 3462 | + gd_progressbar(el, 100, '100% (' + total_cats + ' / ' + total_cats + ') <i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirectory')); ?>');
|
|
| 3463 | 3463 | } else {
|
| 3464 | 3464 | var percentage = Math.round(((page * chunk_size) / total_cats) * 100); |
| 3465 | 3465 | percentage = percentage > 100 ? 100 : percentage; |
| 3466 | - gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php esc_attr_e( 'Exporting...', 'geodirectory' );?>');
|
|
| 3466 | + gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php esc_attr_e('Exporting...', 'geodirectory'); ?>');
|
|
| 3467 | 3467 | } |
| 3468 | 3468 | if (typeof data.files != 'undefined' && jQuery(data.files).length ) {
|
| 3469 | 3469 | var obj_files = data.files; |
@@ -3520,13 +3520,13 @@ discard block |
||
| 3520 | 3520 | function geodir_init_filesystem() |
| 3521 | 3521 | {
|
| 3522 | 3522 | |
| 3523 | - if(!function_exists('get_filesystem_method')){
|
|
| 3523 | + if (!function_exists('get_filesystem_method')) {
|
|
| 3524 | 3524 | require_once(ABSPATH."/wp-admin/includes/file.php"); |
| 3525 | 3525 | } |
| 3526 | 3526 | $access_type = get_filesystem_method(); |
| 3527 | 3527 | if ($access_type === 'direct') {
|
| 3528 | 3528 | /* you can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */ |
| 3529 | - $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array()); |
|
| 3529 | + $creds = request_filesystem_credentials(trailingslashit(site_url()).'wp-admin/', '', false, false, array()); |
|
| 3530 | 3530 | |
| 3531 | 3531 | /* initialize the API */ |
| 3532 | 3532 | if (!WP_Filesystem($creds)) {
|
@@ -3539,7 +3539,7 @@ discard block |
||
| 3539 | 3539 | return $wp_filesystem; |
| 3540 | 3540 | /* do our file manipulations below */ |
| 3541 | 3541 | } elseif (defined('FTP_USER')) {
|
| 3542 | - $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array()); |
|
| 3542 | + $creds = request_filesystem_credentials(trailingslashit(site_url()).'wp-admin/', '', false, false, array()); |
|
| 3543 | 3543 | |
| 3544 | 3544 | /* initialize the API */ |
| 3545 | 3545 | if (!WP_Filesystem($creds)) {
|
@@ -3574,7 +3574,7 @@ discard block |
||
| 3574 | 3574 | * @package GeoDirectory |
| 3575 | 3575 | */ |
| 3576 | 3576 | function geodir_filesystem_notice() |
| 3577 | -{ if ( defined( 'DOING_AJAX' ) ){return;}
|
|
| 3577 | +{ if (defined('DOING_AJAX')) {return; }
|
|
| 3578 | 3578 | $access_type = get_filesystem_method(); |
| 3579 | 3579 | if ($access_type === 'direct') {
|
| 3580 | 3580 | } elseif (!defined('FTP_USER')) {
|
@@ -3611,64 +3611,64 @@ discard block |
||
| 3611 | 3611 | // try to set higher limits for import |
| 3612 | 3612 | $max_input_time = ini_get('max_input_time');
|
| 3613 | 3613 | $max_execution_time = ini_get('max_execution_time');
|
| 3614 | - $memory_limit= ini_get('memory_limit');
|
|
| 3614 | + $memory_limit = ini_get('memory_limit');
|
|
| 3615 | 3615 | |
| 3616 | - if(!$max_input_time || $max_input_time<3000){
|
|
| 3616 | + if (!$max_input_time || $max_input_time < 3000) {
|
|
| 3617 | 3617 | ini_set('max_input_time', 3000);
|
| 3618 | 3618 | } |
| 3619 | 3619 | |
| 3620 | - if(!$max_execution_time || $max_execution_time<3000){
|
|
| 3620 | + if (!$max_execution_time || $max_execution_time < 3000) {
|
|
| 3621 | 3621 | ini_set('max_execution_time', 3000);
|
| 3622 | 3622 | } |
| 3623 | 3623 | |
| 3624 | - if($memory_limit && str_replace('M','',$memory_limit)){
|
|
| 3625 | - if(str_replace('M','',$memory_limit)<256){
|
|
| 3624 | + if ($memory_limit && str_replace('M', '', $memory_limit)) {
|
|
| 3625 | + if (str_replace('M', '', $memory_limit) < 256) {
|
|
| 3626 | 3626 | ini_set('memory_limit', '256M');
|
| 3627 | 3627 | } |
| 3628 | 3628 | } |
| 3629 | 3629 | |
| 3630 | 3630 | $json = array(); |
| 3631 | 3631 | |
| 3632 | - if ( !current_user_can( 'manage_options' ) ) {
|
|
| 3633 | - wp_send_json( $json ); |
|
| 3632 | + if (!current_user_can('manage_options')) {
|
|
| 3633 | + wp_send_json($json); |
|
| 3634 | 3634 | } |
| 3635 | 3635 | |
| 3636 | - $task = isset( $_REQUEST['task'] ) ? $_REQUEST['task'] : NULL; |
|
| 3637 | - $nonce = isset( $_REQUEST['_nonce'] ) ? $_REQUEST['_nonce'] : NULL; |
|
| 3638 | - $stat = isset( $_REQUEST['_st'] ) ? $_REQUEST['_st'] : false; |
|
| 3636 | + $task = isset($_REQUEST['task']) ? $_REQUEST['task'] : NULL; |
|
| 3637 | + $nonce = isset($_REQUEST['_nonce']) ? $_REQUEST['_nonce'] : NULL; |
|
| 3638 | + $stat = isset($_REQUEST['_st']) ? $_REQUEST['_st'] : false; |
|
| 3639 | 3639 | |
| 3640 | - if ( !wp_verify_nonce( $nonce, 'geodir_import_export_nonce' ) ) {
|
|
| 3641 | - wp_send_json( $json ); |
|
| 3640 | + if (!wp_verify_nonce($nonce, 'geodir_import_export_nonce')) {
|
|
| 3641 | + wp_send_json($json); |
|
| 3642 | 3642 | } |
| 3643 | 3643 | |
| 3644 | - $post_type = isset( $_REQUEST['_pt'] ) ? $_REQUEST['_pt'] : NULL; |
|
| 3645 | - $chunk_per_page = isset( $_REQUEST['_n'] ) ? absint($_REQUEST['_n']) : NULL; |
|
| 3644 | + $post_type = isset($_REQUEST['_pt']) ? $_REQUEST['_pt'] : NULL; |
|
| 3645 | + $chunk_per_page = isset($_REQUEST['_n']) ? absint($_REQUEST['_n']) : NULL; |
|
| 3646 | 3646 | $chunk_per_page = $chunk_per_page < 50 || $chunk_per_page > 100000 ? 5000 : $chunk_per_page; |
| 3647 | - $chunk_page_no = isset( $_REQUEST['_p'] ) ? absint($_REQUEST['_p']) : 1; |
|
| 3647 | + $chunk_page_no = isset($_REQUEST['_p']) ? absint($_REQUEST['_p']) : 1; |
|
| 3648 | 3648 | |
| 3649 | 3649 | $wp_filesystem = geodir_init_filesystem(); |
| 3650 | 3650 | if (!$wp_filesystem) {
|
| 3651 | - $json['error'] = __( 'Filesystem ERROR: Could not access filesystem.', 'geodirectory' ); |
|
| 3652 | - wp_send_json( $json ); |
|
| 3651 | + $json['error'] = __('Filesystem ERROR: Could not access filesystem.', 'geodirectory');
|
|
| 3652 | + wp_send_json($json); |
|
| 3653 | 3653 | } |
| 3654 | 3654 | |
| 3655 | 3655 | if (!empty($wp_filesystem) && isset($wp_filesystem->errors) && is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
|
| 3656 | - $json['error'] = __( 'Filesystem ERROR: ' . $wp_filesystem->errors->get_error_message(), 'geodirectory' ); |
|
| 3657 | - wp_send_json( $json ); |
|
| 3656 | + $json['error'] = __('Filesystem ERROR: '.$wp_filesystem->errors->get_error_message(), 'geodirectory');
|
|
| 3657 | + wp_send_json($json); |
|
| 3658 | 3658 | } |
| 3659 | 3659 | |
| 3660 | - $csv_file_dir = geodir_path_import_export( false ); |
|
| 3661 | - if ( !$wp_filesystem->is_dir( $csv_file_dir ) ) {
|
|
| 3662 | - if ( !$wp_filesystem->mkdir( $csv_file_dir, FS_CHMOD_DIR ) ) {
|
|
| 3663 | - $json['error'] = __( 'ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory' ); |
|
| 3664 | - wp_send_json( $json ); |
|
| 3660 | + $csv_file_dir = geodir_path_import_export(false); |
|
| 3661 | + if (!$wp_filesystem->is_dir($csv_file_dir)) {
|
|
| 3662 | + if (!$wp_filesystem->mkdir($csv_file_dir, FS_CHMOD_DIR)) {
|
|
| 3663 | + $json['error'] = __('ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory');
|
|
| 3664 | + wp_send_json($json); |
|
| 3665 | 3665 | } |
| 3666 | 3666 | } |
| 3667 | 3667 | |
| 3668 | 3668 | $location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
|
| 3669 | 3669 | $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
|
| 3670 | 3670 | |
| 3671 | - switch ( $task ) {
|
|
| 3671 | + switch ($task) {
|
|
| 3672 | 3672 | case 'export_posts': {
|
| 3673 | 3673 | // WPML |
| 3674 | 3674 | $is_wpml = geodir_is_wpml(); |
@@ -3679,22 +3679,22 @@ discard block |
||
| 3679 | 3679 | $sitepress->switch_lang('all', true);
|
| 3680 | 3680 | } |
| 3681 | 3681 | // WPML |
| 3682 | - if ( $post_type == 'gd_event' ) {
|
|
| 3683 | - add_filter( 'geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2 ); |
|
| 3682 | + if ($post_type == 'gd_event') {
|
|
| 3683 | + add_filter('geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2);
|
|
| 3684 | 3684 | } |
| 3685 | - $file_name = $post_type . '_' . date( 'dmyHi' ); |
|
| 3686 | - $posts_count = geodir_get_posts_count( $post_type ); |
|
| 3687 | - $file_url_base = geodir_path_import_export() . '/'; |
|
| 3688 | - $file_url = $file_url_base . $file_name . '.csv'; |
|
| 3689 | - $file_path = $csv_file_dir . '/' . $file_name . '.csv'; |
|
| 3690 | - $file_path_temp = $csv_file_dir . '/' . $post_type . '_' . $nonce . '.csv'; |
|
| 3685 | + $file_name = $post_type.'_'.date('dmyHi');
|
|
| 3686 | + $posts_count = geodir_get_posts_count($post_type); |
|
| 3687 | + $file_url_base = geodir_path_import_export().'/'; |
|
| 3688 | + $file_url = $file_url_base.$file_name.'.csv'; |
|
| 3689 | + $file_path = $csv_file_dir.'/'.$file_name.'.csv'; |
|
| 3690 | + $file_path_temp = $csv_file_dir.'/'.$post_type.'_'.$nonce.'.csv'; |
|
| 3691 | 3691 | |
| 3692 | 3692 | $chunk_file_paths = array(); |
| 3693 | 3693 | |
| 3694 | - if ( isset( $_REQUEST['_st'] ) ) {
|
|
| 3695 | - $line_count = (int)geodir_import_export_line_count( $file_path_temp ); |
|
| 3696 | - $percentage = count( $posts_count ) > 0 && $line_count > 0 ? ceil( $line_count / $posts_count ) * 100 : 0; |
|
| 3697 | - $percentage = min( $percentage, 100 ); |
|
| 3694 | + if (isset($_REQUEST['_st'])) {
|
|
| 3695 | + $line_count = (int) geodir_import_export_line_count($file_path_temp); |
|
| 3696 | + $percentage = count($posts_count) > 0 && $line_count > 0 ? ceil($line_count / $posts_count) * 100 : 0; |
|
| 3697 | + $percentage = min($percentage, 100); |
|
| 3698 | 3698 | |
| 3699 | 3699 | $json['percentage'] = $percentage; |
| 3700 | 3700 | // WPML |
@@ -3702,45 +3702,45 @@ discard block |
||
| 3702 | 3702 | $sitepress->switch_lang($active_lang, true); |
| 3703 | 3703 | } |
| 3704 | 3704 | // WPML |
| 3705 | - wp_send_json( $json ); |
|
| 3705 | + wp_send_json($json); |
|
| 3706 | 3706 | gd_die(); |
| 3707 | 3707 | } else {
|
| 3708 | - if ( !$posts_count > 0 ) {
|
|
| 3709 | - $json['error'] = __( 'No records to export.', 'geodirectory' ); |
|
| 3708 | + if (!$posts_count > 0) {
|
|
| 3709 | + $json['error'] = __('No records to export.', 'geodirectory');
|
|
| 3710 | 3710 | } else {
|
| 3711 | 3711 | $total_posts = $posts_count; |
| 3712 | 3712 | if ($chunk_per_page > $total_posts) {
|
| 3713 | 3713 | $chunk_per_page = $total_posts; |
| 3714 | 3714 | } |
| 3715 | - $chunk_total_pages = ceil( $total_posts / $chunk_per_page ); |
|
| 3715 | + $chunk_total_pages = ceil($total_posts / $chunk_per_page); |
|
| 3716 | 3716 | |
| 3717 | 3717 | $j = $chunk_page_no; |
| 3718 | - $chunk_save_posts = geodir_imex_get_posts( $post_type, $chunk_per_page, $j ); |
|
| 3718 | + $chunk_save_posts = geodir_imex_get_posts($post_type, $chunk_per_page, $j); |
|
| 3719 | 3719 | |
| 3720 | 3720 | $per_page = 500; |
| 3721 | 3721 | if ($per_page > $chunk_per_page) {
|
| 3722 | 3722 | $per_page = $chunk_per_page; |
| 3723 | 3723 | } |
| 3724 | - $total_pages = ceil( $chunk_per_page / $per_page ); |
|
| 3724 | + $total_pages = ceil($chunk_per_page / $per_page); |
|
| 3725 | 3725 | |
| 3726 | - for ( $i = 0; $i <= $total_pages; $i++ ) {
|
|
| 3727 | - $save_posts = array_slice( $chunk_save_posts , ( $i * $per_page ), $per_page ); |
|
| 3726 | + for ($i = 0; $i <= $total_pages; $i++) {
|
|
| 3727 | + $save_posts = array_slice($chunk_save_posts, ($i * $per_page), $per_page); |
|
| 3728 | 3728 | |
| 3729 | 3729 | $clear = $i == 0 ? true : false; |
| 3730 | - geodir_save_csv_data( $file_path_temp, $save_posts, $clear ); |
|
| 3730 | + geodir_save_csv_data($file_path_temp, $save_posts, $clear); |
|
| 3731 | 3731 | } |
| 3732 | 3732 | |
| 3733 | - if ( $wp_filesystem->exists( $file_path_temp ) ) {
|
|
| 3734 | - $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : ''; |
|
| 3735 | - $chunk_file_name = $file_name . $chunk_page_no . '.csv'; |
|
| 3736 | - $file_path = $csv_file_dir . '/' . $chunk_file_name; |
|
| 3737 | - $wp_filesystem->move( $file_path_temp, $file_path, true ); |
|
| 3733 | + if ($wp_filesystem->exists($file_path_temp)) {
|
|
| 3734 | + $chunk_page_no = $chunk_total_pages > 1 ? '-'.$j : ''; |
|
| 3735 | + $chunk_file_name = $file_name.$chunk_page_no.'.csv'; |
|
| 3736 | + $file_path = $csv_file_dir.'/'.$chunk_file_name; |
|
| 3737 | + $wp_filesystem->move($file_path_temp, $file_path, true); |
|
| 3738 | 3738 | |
| 3739 | - $file_url = $file_url_base . $chunk_file_name; |
|
| 3740 | - $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
| 3739 | + $file_url = $file_url_base.$chunk_file_name; |
|
| 3740 | + $chunk_file_paths[] = array('i' => $j.'.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
| 3741 | 3741 | } |
| 3742 | 3742 | |
| 3743 | - if ( !empty($chunk_file_paths) ) {
|
|
| 3743 | + if (!empty($chunk_file_paths)) {
|
|
| 3744 | 3744 | $json['total'] = $posts_count; |
| 3745 | 3745 | $json['files'] = $chunk_file_paths; |
| 3746 | 3746 | } else {
|
@@ -3748,7 +3748,7 @@ discard block |
||
| 3748 | 3748 | $json['total'] = $posts_count; |
| 3749 | 3749 | $json['files'] = array(); |
| 3750 | 3750 | } else {
|
| 3751 | - $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' ); |
|
| 3751 | + $json['error'] = __('ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory');
|
|
| 3752 | 3752 | } |
| 3753 | 3753 | } |
| 3754 | 3754 | } |
@@ -3757,7 +3757,7 @@ discard block |
||
| 3757 | 3757 | $sitepress->switch_lang($active_lang, true); |
| 3758 | 3758 | } |
| 3759 | 3759 | // WPML |
| 3760 | - wp_send_json( $json ); |
|
| 3760 | + wp_send_json($json); |
|
| 3761 | 3761 | } |
| 3762 | 3762 | } |
| 3763 | 3763 | break; |
@@ -3771,20 +3771,20 @@ discard block |
||
| 3771 | 3771 | $sitepress->switch_lang('all', true);
|
| 3772 | 3772 | } |
| 3773 | 3773 | // WPML |
| 3774 | - $file_name = $post_type . 'category_' . date( 'dmyHi' ); |
|
| 3774 | + $file_name = $post_type.'category_'.date('dmyHi');
|
|
| 3775 | 3775 | |
| 3776 | - $terms_count = geodir_get_terms_count( $post_type ); |
|
| 3777 | - $file_url_base = geodir_path_import_export() . '/'; |
|
| 3778 | - $file_url = $file_url_base . $file_name . '.csv'; |
|
| 3779 | - $file_path = $csv_file_dir . '/' . $file_name . '.csv'; |
|
| 3780 | - $file_path_temp = $csv_file_dir . '/' . $post_type . 'category_' . $nonce . '.csv'; |
|
| 3776 | + $terms_count = geodir_get_terms_count($post_type); |
|
| 3777 | + $file_url_base = geodir_path_import_export().'/'; |
|
| 3778 | + $file_url = $file_url_base.$file_name.'.csv'; |
|
| 3779 | + $file_path = $csv_file_dir.'/'.$file_name.'.csv'; |
|
| 3780 | + $file_path_temp = $csv_file_dir.'/'.$post_type.'category_'.$nonce.'.csv'; |
|
| 3781 | 3781 | |
| 3782 | 3782 | $chunk_file_paths = array(); |
| 3783 | 3783 | |
| 3784 | - if ( isset( $_REQUEST['_st'] ) ) {
|
|
| 3785 | - $line_count = (int)geodir_import_export_line_count( $file_path_temp ); |
|
| 3786 | - $percentage = count( $terms_count ) > 0 && $line_count > 0 ? ceil( $line_count / $terms_count ) * 100 : 0; |
|
| 3787 | - $percentage = min( $percentage, 100 ); |
|
| 3784 | + if (isset($_REQUEST['_st'])) {
|
|
| 3785 | + $line_count = (int) geodir_import_export_line_count($file_path_temp); |
|
| 3786 | + $percentage = count($terms_count) > 0 && $line_count > 0 ? ceil($line_count / $terms_count) * 100 : 0; |
|
| 3787 | + $percentage = min($percentage, 100); |
|
| 3788 | 3788 | |
| 3789 | 3789 | $json['percentage'] = $percentage; |
| 3790 | 3790 | // WPML |
@@ -3792,48 +3792,48 @@ discard block |
||
| 3792 | 3792 | $sitepress->switch_lang($active_lang, true); |
| 3793 | 3793 | } |
| 3794 | 3794 | // WPML |
| 3795 | - wp_send_json( $json ); |
|
| 3795 | + wp_send_json($json); |
|
| 3796 | 3796 | } else {
|
| 3797 | - if ( !$terms_count > 0 ) {
|
|
| 3798 | - $json['error'] = __( 'No records to export.', 'geodirectory' ); |
|
| 3797 | + if (!$terms_count > 0) {
|
|
| 3798 | + $json['error'] = __('No records to export.', 'geodirectory');
|
|
| 3799 | 3799 | } else {
|
| 3800 | 3800 | $total_terms = $terms_count; |
| 3801 | 3801 | if ($chunk_per_page > $terms_count) {
|
| 3802 | 3802 | $chunk_per_page = $terms_count; |
| 3803 | 3803 | } |
| 3804 | - $chunk_total_pages = ceil( $total_terms / $chunk_per_page ); |
|
| 3804 | + $chunk_total_pages = ceil($total_terms / $chunk_per_page); |
|
| 3805 | 3805 | |
| 3806 | 3806 | $j = $chunk_page_no; |
| 3807 | - $chunk_save_terms = geodir_imex_get_terms( $post_type, $chunk_per_page, $j ); |
|
| 3807 | + $chunk_save_terms = geodir_imex_get_terms($post_type, $chunk_per_page, $j); |
|
| 3808 | 3808 | |
| 3809 | 3809 | $per_page = 500; |
| 3810 | 3810 | if ($per_page > $chunk_per_page) {
|
| 3811 | 3811 | $per_page = $chunk_per_page; |
| 3812 | 3812 | } |
| 3813 | - $total_pages = ceil( $chunk_per_page / $per_page ); |
|
| 3813 | + $total_pages = ceil($chunk_per_page / $per_page); |
|
| 3814 | 3814 | |
| 3815 | - for ( $i = 0; $i <= $total_pages; $i++ ) {
|
|
| 3816 | - $save_terms = array_slice( $chunk_save_terms , ( $i * $per_page ), $per_page ); |
|
| 3815 | + for ($i = 0; $i <= $total_pages; $i++) {
|
|
| 3816 | + $save_terms = array_slice($chunk_save_terms, ($i * $per_page), $per_page); |
|
| 3817 | 3817 | |
| 3818 | 3818 | $clear = $i == 0 ? true : false; |
| 3819 | - geodir_save_csv_data( $file_path_temp, $save_terms, $clear ); |
|
| 3819 | + geodir_save_csv_data($file_path_temp, $save_terms, $clear); |
|
| 3820 | 3820 | } |
| 3821 | 3821 | |
| 3822 | - if ( $wp_filesystem->exists( $file_path_temp ) ) {
|
|
| 3823 | - $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : ''; |
|
| 3824 | - $chunk_file_name = $file_name . $chunk_page_no . '.csv'; |
|
| 3825 | - $file_path = $csv_file_dir . '/' . $chunk_file_name; |
|
| 3826 | - $wp_filesystem->move( $file_path_temp, $file_path, true ); |
|
| 3822 | + if ($wp_filesystem->exists($file_path_temp)) {
|
|
| 3823 | + $chunk_page_no = $chunk_total_pages > 1 ? '-'.$j : ''; |
|
| 3824 | + $chunk_file_name = $file_name.$chunk_page_no.'.csv'; |
|
| 3825 | + $file_path = $csv_file_dir.'/'.$chunk_file_name; |
|
| 3826 | + $wp_filesystem->move($file_path_temp, $file_path, true); |
|
| 3827 | 3827 | |
| 3828 | - $file_url = $file_url_base . $chunk_file_name; |
|
| 3829 | - $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
| 3828 | + $file_url = $file_url_base.$chunk_file_name; |
|
| 3829 | + $chunk_file_paths[] = array('i' => $j.'.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
| 3830 | 3830 | } |
| 3831 | 3831 | |
| 3832 | - if ( !empty($chunk_file_paths) ) {
|
|
| 3832 | + if (!empty($chunk_file_paths)) {
|
|
| 3833 | 3833 | $json['total'] = $terms_count; |
| 3834 | 3834 | $json['files'] = $chunk_file_paths; |
| 3835 | 3835 | } else {
|
| 3836 | - $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' ); |
|
| 3836 | + $json['error'] = __('ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory');
|
|
| 3837 | 3837 | } |
| 3838 | 3838 | } |
| 3839 | 3839 | // WPML |
@@ -3841,127 +3841,127 @@ discard block |
||
| 3841 | 3841 | $sitepress->switch_lang($active_lang, true); |
| 3842 | 3842 | } |
| 3843 | 3843 | // WPML |
| 3844 | - wp_send_json( $json ); |
|
| 3844 | + wp_send_json($json); |
|
| 3845 | 3845 | } |
| 3846 | 3846 | } |
| 3847 | 3847 | break; |
| 3848 | 3848 | case 'export_locations': {
|
| 3849 | - $file_url_base = geodir_path_import_export() . '/'; |
|
| 3850 | - $file_name = 'gd_locations_' . date( 'dmyHi' ); |
|
| 3851 | - $file_url = $file_url_base . $file_name . '.csv'; |
|
| 3852 | - $file_path = $csv_file_dir . '/' . $file_name . '.csv'; |
|
| 3853 | - $file_path_temp = $csv_file_dir . '/gd_locations_' . $nonce . '.csv'; |
|
| 3849 | + $file_url_base = geodir_path_import_export().'/'; |
|
| 3850 | + $file_name = 'gd_locations_'.date('dmyHi');
|
|
| 3851 | + $file_url = $file_url_base.$file_name.'.csv'; |
|
| 3852 | + $file_path = $csv_file_dir.'/'.$file_name.'.csv'; |
|
| 3853 | + $file_path_temp = $csv_file_dir.'/gd_locations_'.$nonce.'.csv'; |
|
| 3854 | 3854 | |
| 3855 | - $items_count = (int)geodir_location_imex_count_locations(); |
|
| 3855 | + $items_count = (int) geodir_location_imex_count_locations(); |
|
| 3856 | 3856 | |
| 3857 | - if ( isset( $_REQUEST['_st'] ) ) {
|
|
| 3858 | - $line_count = (int)geodir_import_export_line_count( $file_path_temp ); |
|
| 3859 | - $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0; |
|
| 3860 | - $percentage = min( $percentage, 100 ); |
|
| 3857 | + if (isset($_REQUEST['_st'])) {
|
|
| 3858 | + $line_count = (int) geodir_import_export_line_count($file_path_temp); |
|
| 3859 | + $percentage = count($items_count) > 0 && $line_count > 0 ? ceil($line_count / $items_count) * 100 : 0; |
|
| 3860 | + $percentage = min($percentage, 100); |
|
| 3861 | 3861 | |
| 3862 | 3862 | $json['percentage'] = $percentage; |
| 3863 | - wp_send_json( $json ); |
|
| 3863 | + wp_send_json($json); |
|
| 3864 | 3864 | } else {
|
| 3865 | 3865 | $chunk_file_paths = array(); |
| 3866 | 3866 | |
| 3867 | - if ( !$items_count > 0 ) {
|
|
| 3868 | - $json['error'] = __( 'No records to export.', 'geodirectory' ); |
|
| 3867 | + if (!$items_count > 0) {
|
|
| 3868 | + $json['error'] = __('No records to export.', 'geodirectory');
|
|
| 3869 | 3869 | } else {
|
| 3870 | - $chunk_per_page = min( $chunk_per_page, $items_count ); |
|
| 3871 | - $chunk_total_pages = ceil( $items_count / $chunk_per_page ); |
|
| 3870 | + $chunk_per_page = min($chunk_per_page, $items_count); |
|
| 3871 | + $chunk_total_pages = ceil($items_count / $chunk_per_page); |
|
| 3872 | 3872 | |
| 3873 | 3873 | $j = $chunk_page_no; |
| 3874 | - $chunk_save_items = geodir_location_imex_locations_data( $chunk_per_page, $j ); |
|
| 3874 | + $chunk_save_items = geodir_location_imex_locations_data($chunk_per_page, $j); |
|
| 3875 | 3875 | |
| 3876 | 3876 | $per_page = 500; |
| 3877 | - $per_page = min( $per_page, $chunk_per_page ); |
|
| 3878 | - $total_pages = ceil( $chunk_per_page / $per_page ); |
|
| 3877 | + $per_page = min($per_page, $chunk_per_page); |
|
| 3878 | + $total_pages = ceil($chunk_per_page / $per_page); |
|
| 3879 | 3879 | |
| 3880 | - for ( $i = 0; $i <= $total_pages; $i++ ) {
|
|
| 3881 | - $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page ); |
|
| 3880 | + for ($i = 0; $i <= $total_pages; $i++) {
|
|
| 3881 | + $save_items = array_slice($chunk_save_items, ($i * $per_page), $per_page); |
|
| 3882 | 3882 | |
| 3883 | 3883 | $clear = $i == 0 ? true : false; |
| 3884 | - geodir_save_csv_data( $file_path_temp, $save_items, $clear ); |
|
| 3884 | + geodir_save_csv_data($file_path_temp, $save_items, $clear); |
|
| 3885 | 3885 | } |
| 3886 | 3886 | |
| 3887 | - if ( $wp_filesystem->exists( $file_path_temp ) ) {
|
|
| 3888 | - $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : ''; |
|
| 3889 | - $chunk_file_name = $file_name . $chunk_page_no . '.csv'; |
|
| 3890 | - $file_path = $csv_file_dir . '/' . $chunk_file_name; |
|
| 3891 | - $wp_filesystem->move( $file_path_temp, $file_path, true ); |
|
| 3887 | + if ($wp_filesystem->exists($file_path_temp)) {
|
|
| 3888 | + $chunk_page_no = $chunk_total_pages > 1 ? '-'.$j : ''; |
|
| 3889 | + $chunk_file_name = $file_name.$chunk_page_no.'.csv'; |
|
| 3890 | + $file_path = $csv_file_dir.'/'.$chunk_file_name; |
|
| 3891 | + $wp_filesystem->move($file_path_temp, $file_path, true); |
|
| 3892 | 3892 | |
| 3893 | - $file_url = $file_url_base . $chunk_file_name; |
|
| 3894 | - $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
| 3893 | + $file_url = $file_url_base.$chunk_file_name; |
|
| 3894 | + $chunk_file_paths[] = array('i' => $j.'.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
| 3895 | 3895 | } |
| 3896 | 3896 | |
| 3897 | - if ( !empty($chunk_file_paths) ) {
|
|
| 3897 | + if (!empty($chunk_file_paths)) {
|
|
| 3898 | 3898 | $json['total'] = $items_count; |
| 3899 | 3899 | $json['files'] = $chunk_file_paths; |
| 3900 | 3900 | } else {
|
| 3901 | - $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' ); |
|
| 3901 | + $json['error'] = __('Fail, something wrong to create csv file.', 'geodirectory');
|
|
| 3902 | 3902 | } |
| 3903 | 3903 | } |
| 3904 | - wp_send_json( $json ); |
|
| 3904 | + wp_send_json($json); |
|
| 3905 | 3905 | } |
| 3906 | 3906 | } |
| 3907 | 3907 | break; |
| 3908 | 3908 | case 'export_hoods': {
|
| 3909 | - $file_url_base = geodir_path_import_export() . '/'; |
|
| 3910 | - $file_name = 'gd_neighbourhoods_' . date( 'dmyHi' ); |
|
| 3911 | - $file_url = $file_url_base . $file_name . '.csv'; |
|
| 3912 | - $file_path = $csv_file_dir . '/' . $file_name . '.csv'; |
|
| 3913 | - $file_path_temp = $csv_file_dir . '/gd_neighbourhoods_' . $nonce . '.csv'; |
|
| 3909 | + $file_url_base = geodir_path_import_export().'/'; |
|
| 3910 | + $file_name = 'gd_neighbourhoods_'.date('dmyHi');
|
|
| 3911 | + $file_url = $file_url_base.$file_name.'.csv'; |
|
| 3912 | + $file_path = $csv_file_dir.'/'.$file_name.'.csv'; |
|
| 3913 | + $file_path_temp = $csv_file_dir.'/gd_neighbourhoods_'.$nonce.'.csv'; |
|
| 3914 | 3914 | |
| 3915 | - $items_count = (int)geodir_location_imex_count_neighbourhoods(); |
|
| 3915 | + $items_count = (int) geodir_location_imex_count_neighbourhoods(); |
|
| 3916 | 3916 | |
| 3917 | - if ( isset( $_REQUEST['_st'] ) ) {
|
|
| 3918 | - $line_count = (int)geodir_import_export_line_count( $file_path_temp ); |
|
| 3919 | - $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0; |
|
| 3920 | - $percentage = min( $percentage, 100 ); |
|
| 3917 | + if (isset($_REQUEST['_st'])) {
|
|
| 3918 | + $line_count = (int) geodir_import_export_line_count($file_path_temp); |
|
| 3919 | + $percentage = count($items_count) > 0 && $line_count > 0 ? ceil($line_count / $items_count) * 100 : 0; |
|
| 3920 | + $percentage = min($percentage, 100); |
|
| 3921 | 3921 | |
| 3922 | 3922 | $json['percentage'] = $percentage; |
| 3923 | - wp_send_json( $json ); |
|
| 3923 | + wp_send_json($json); |
|
| 3924 | 3924 | } else {
|
| 3925 | 3925 | $chunk_file_paths = array(); |
| 3926 | 3926 | |
| 3927 | - if ( !$items_count > 0 ) {
|
|
| 3928 | - $json['error'] = __( 'No records to export.', 'geodirectory' ); |
|
| 3927 | + if (!$items_count > 0) {
|
|
| 3928 | + $json['error'] = __('No records to export.', 'geodirectory');
|
|
| 3929 | 3929 | } else {
|
| 3930 | - $chunk_per_page = min( $chunk_per_page, $items_count ); |
|
| 3931 | - $chunk_total_pages = ceil( $items_count / $chunk_per_page ); |
|
| 3930 | + $chunk_per_page = min($chunk_per_page, $items_count); |
|
| 3931 | + $chunk_total_pages = ceil($items_count / $chunk_per_page); |
|
| 3932 | 3932 | |
| 3933 | 3933 | $j = $chunk_page_no; |
| 3934 | - $chunk_save_items = geodir_location_imex_neighbourhoods_data( $chunk_per_page, $j ); |
|
| 3934 | + $chunk_save_items = geodir_location_imex_neighbourhoods_data($chunk_per_page, $j); |
|
| 3935 | 3935 | |
| 3936 | 3936 | $per_page = 500; |
| 3937 | - $per_page = min( $per_page, $chunk_per_page ); |
|
| 3938 | - $total_pages = ceil( $chunk_per_page / $per_page ); |
|
| 3937 | + $per_page = min($per_page, $chunk_per_page); |
|
| 3938 | + $total_pages = ceil($chunk_per_page / $per_page); |
|
| 3939 | 3939 | |
| 3940 | - for ( $i = 0; $i <= $total_pages; $i++ ) {
|
|
| 3941 | - $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page ); |
|
| 3940 | + for ($i = 0; $i <= $total_pages; $i++) {
|
|
| 3941 | + $save_items = array_slice($chunk_save_items, ($i * $per_page), $per_page); |
|
| 3942 | 3942 | |
| 3943 | 3943 | $clear = $i == 0 ? true : false; |
| 3944 | - geodir_save_csv_data( $file_path_temp, $save_items, $clear ); |
|
| 3944 | + geodir_save_csv_data($file_path_temp, $save_items, $clear); |
|
| 3945 | 3945 | } |
| 3946 | 3946 | |
| 3947 | - if ( $wp_filesystem->exists( $file_path_temp ) ) {
|
|
| 3948 | - $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : ''; |
|
| 3949 | - $chunk_file_name = $file_name . $chunk_page_no . '.csv'; |
|
| 3950 | - $file_path = $csv_file_dir . '/' . $chunk_file_name; |
|
| 3951 | - $wp_filesystem->move( $file_path_temp, $file_path, true ); |
|
| 3947 | + if ($wp_filesystem->exists($file_path_temp)) {
|
|
| 3948 | + $chunk_page_no = $chunk_total_pages > 1 ? '-'.$j : ''; |
|
| 3949 | + $chunk_file_name = $file_name.$chunk_page_no.'.csv'; |
|
| 3950 | + $file_path = $csv_file_dir.'/'.$chunk_file_name; |
|
| 3951 | + $wp_filesystem->move($file_path_temp, $file_path, true); |
|
| 3952 | 3952 | |
| 3953 | - $file_url = $file_url_base . $chunk_file_name; |
|
| 3954 | - $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
| 3953 | + $file_url = $file_url_base.$chunk_file_name; |
|
| 3954 | + $chunk_file_paths[] = array('i' => $j.'.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
| 3955 | 3955 | } |
| 3956 | 3956 | |
| 3957 | - if ( !empty($chunk_file_paths) ) {
|
|
| 3957 | + if (!empty($chunk_file_paths)) {
|
|
| 3958 | 3958 | $json['total'] = $items_count; |
| 3959 | 3959 | $json['files'] = $chunk_file_paths; |
| 3960 | 3960 | } else {
|
| 3961 | - $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' ); |
|
| 3961 | + $json['error'] = __('Fail, something wrong to create csv file.', 'geodirectory');
|
|
| 3962 | 3962 | } |
| 3963 | 3963 | } |
| 3964 | - wp_send_json( $json ); |
|
| 3964 | + wp_send_json($json); |
|
| 3965 | 3965 | } |
| 3966 | 3966 | } |
| 3967 | 3967 | break; |
@@ -3978,33 +3978,33 @@ discard block |
||
| 3978 | 3978 | } |
| 3979 | 3979 | // WPML |
| 3980 | 3980 | |
| 3981 | - ini_set( 'auto_detect_line_endings', true ); |
|
| 3981 | + ini_set('auto_detect_line_endings', true);
|
|
| 3982 | 3982 | |
| 3983 | 3983 | $uploads = wp_upload_dir(); |
| 3984 | 3984 | $uploads_dir = $uploads['path']; |
| 3985 | 3985 | $uploads_subdir = $uploads['subdir']; |
| 3986 | 3986 | |
| 3987 | - $csv_file = isset( $_POST['_file'] ) ? $_POST['_file'] : NULL; |
|
| 3988 | - $import_choice = isset( $_REQUEST['_ch'] ) ? $_REQUEST['_ch'] : 'skip'; |
|
| 3987 | + $csv_file = isset($_POST['_file']) ? $_POST['_file'] : NULL; |
|
| 3988 | + $import_choice = isset($_REQUEST['_ch']) ? $_REQUEST['_ch'] : 'skip'; |
|
| 3989 | 3989 | |
| 3990 | - $csv_file_arr = explode( '/', $csv_file ); |
|
| 3991 | - $csv_filename = end( $csv_file_arr ); |
|
| 3992 | - $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $csv_filename; |
|
| 3990 | + $csv_file_arr = explode('/', $csv_file);
|
|
| 3991 | + $csv_filename = end($csv_file_arr); |
|
| 3992 | + $target_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$csv_filename; |
|
| 3993 | 3993 | |
| 3994 | 3994 | $json['file'] = $csv_file; |
| 3995 | - $json['error'] = __( 'The uploaded file is not a valid csv file. Please try again.', 'geodirectory' ); |
|
| 3995 | + $json['error'] = __('The uploaded file is not a valid csv file. Please try again.', 'geodirectory');
|
|
| 3996 | 3996 | $file = array(); |
| 3997 | 3997 | |
| 3998 | - if ( $csv_file && $wp_filesystem->is_file( $target_path ) && $wp_filesystem->exists( $target_path ) ) {
|
|
| 3999 | - $wp_filetype = wp_check_filetype_and_ext( $target_path, $csv_filename ); |
|
| 3998 | + if ($csv_file && $wp_filesystem->is_file($target_path) && $wp_filesystem->exists($target_path)) {
|
|
| 3999 | + $wp_filetype = wp_check_filetype_and_ext($target_path, $csv_filename); |
|
| 4000 | 4000 | |
| 4001 | 4001 | if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
|
| 4002 | 4002 | $json['error'] = NULL; |
| 4003 | 4003 | $json['rows'] = 0; |
| 4004 | 4004 | |
| 4005 | - if ( ( $handle = fopen($target_path, "r" ) ) !== FALSE ) {
|
|
| 4006 | - while ( ( $data = fgetcsv( $handle, 100000, "," ) ) !== FALSE ) {
|
|
| 4007 | - if ( !empty( $data ) ) {
|
|
| 4005 | + if (($handle = fopen($target_path, "r")) !== FALSE) {
|
|
| 4006 | + while (($data = fgetcsv($handle, 100000, ",")) !== FALSE) {
|
|
| 4007 | + if (!empty($data)) {
|
|
| 4008 | 4008 | $file[] = $data; |
| 4009 | 4009 | } |
| 4010 | 4010 | } |
@@ -4017,19 +4017,19 @@ discard block |
||
| 4017 | 4017 | $json['error'] = __('No data found in csv file.', 'geodirectory');
|
| 4018 | 4018 | } |
| 4019 | 4019 | } else {
|
| 4020 | - wp_send_json( $json ); |
|
| 4020 | + wp_send_json($json); |
|
| 4021 | 4021 | } |
| 4022 | 4022 | } else {
|
| 4023 | - wp_send_json( $json ); |
|
| 4023 | + wp_send_json($json); |
|
| 4024 | 4024 | } |
| 4025 | 4025 | |
| 4026 | - if ( $task == 'prepare_import' || !empty( $json['error'] ) ) {
|
|
| 4027 | - wp_send_json( $json ); |
|
| 4026 | + if ($task == 'prepare_import' || !empty($json['error'])) {
|
|
| 4027 | + wp_send_json($json); |
|
| 4028 | 4028 | } |
| 4029 | 4029 | |
| 4030 | 4030 | $total = $json['rows']; |
| 4031 | - $limit = isset($_POST['limit']) ? (int)$_POST['limit'] : 1; |
|
| 4032 | - $processed = isset($_POST['processed']) ? (int)$_POST['processed'] : 0; |
|
| 4031 | + $limit = isset($_POST['limit']) ? (int) $_POST['limit'] : 1; |
|
| 4032 | + $processed = isset($_POST['processed']) ? (int) $_POST['processed'] : 0; |
|
| 4033 | 4033 | |
| 4034 | 4034 | $count = $limit; |
| 4035 | 4035 | |
@@ -4054,13 +4054,13 @@ discard block |
||
| 4054 | 4054 | |
| 4055 | 4055 | $post_types = geodir_get_posttypes(); |
| 4056 | 4056 | |
| 4057 | - if ( $task == 'import_cat' ) {
|
|
| 4057 | + if ($task == 'import_cat') {
|
|
| 4058 | 4058 | if (!empty($file)) {
|
| 4059 | 4059 | $columns = isset($file[0]) ? $file[0] : NULL; |
| 4060 | 4060 | |
| 4061 | 4061 | if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
|
| 4062 | 4062 | $json['error'] = CSV_INVAILD_FILE; |
| 4063 | - wp_send_json( $json ); |
|
| 4063 | + wp_send_json($json); |
|
| 4064 | 4064 | exit; |
| 4065 | 4065 | } |
| 4066 | 4066 | |
@@ -4071,7 +4071,7 @@ discard block |
||
| 4071 | 4071 | |
| 4072 | 4072 | if (isset($file[$index])) {
|
| 4073 | 4073 | $row = $file[$index]; |
| 4074 | - $row = array_map( 'trim', $row ); |
|
| 4074 | + $row = array_map('trim', $row);
|
|
| 4075 | 4075 | //$row = array_map( 'utf8_encode', $row ); |
| 4076 | 4076 | |
| 4077 | 4077 | $cat_id = ''; |
@@ -4088,42 +4088,42 @@ discard block |
||
| 4088 | 4088 | $cat_id_original = ''; |
| 4089 | 4089 | |
| 4090 | 4090 | $c = 0; |
| 4091 | - foreach ($columns as $column ) {
|
|
| 4092 | - if ( $column == 'cat_id' ) {
|
|
| 4093 | - $cat_id = (int)$row[$c]; |
|
| 4094 | - } else if ( $column == 'cat_name' ) {
|
|
| 4091 | + foreach ($columns as $column) {
|
|
| 4092 | + if ($column == 'cat_id') {
|
|
| 4093 | + $cat_id = (int) $row[$c]; |
|
| 4094 | + } else if ($column == 'cat_name') {
|
|
| 4095 | 4095 | $cat_name = $row[$c]; |
| 4096 | - } else if ( $column == 'cat_slug' ) {
|
|
| 4096 | + } else if ($column == 'cat_slug') {
|
|
| 4097 | 4097 | $cat_slug = $row[$c]; |
| 4098 | - } else if ( $column == 'cat_posttype' ) {
|
|
| 4098 | + } else if ($column == 'cat_posttype') {
|
|
| 4099 | 4099 | $cat_posttype = $row[$c]; |
| 4100 | - } else if ( $column == 'cat_parent' ) {
|
|
| 4100 | + } else if ($column == 'cat_parent') {
|
|
| 4101 | 4101 | $cat_parent = trim($row[$c]); |
| 4102 | - } else if ( $column == 'cat_schema' && $row[$c] != '' ) {
|
|
| 4102 | + } else if ($column == 'cat_schema' && $row[$c] != '') {
|
|
| 4103 | 4103 | $cat_schema = $row[$c]; |
| 4104 | - } else if ( $column == 'cat_description' ) {
|
|
| 4104 | + } else if ($column == 'cat_description') {
|
|
| 4105 | 4105 | $cat_description = $row[$c]; |
| 4106 | - } else if ( $column == 'cat_top_description' ) {
|
|
| 4106 | + } else if ($column == 'cat_top_description') {
|
|
| 4107 | 4107 | $cat_top_description = $row[$c]; |
| 4108 | - } else if ( $column == 'cat_image' ) {
|
|
| 4108 | + } else if ($column == 'cat_image') {
|
|
| 4109 | 4109 | $cat_image = $row[$c]; |
| 4110 | - } else if ( $column == 'cat_icon' ) {
|
|
| 4110 | + } else if ($column == 'cat_icon') {
|
|
| 4111 | 4111 | $cat_icon = $row[$c]; |
| 4112 | 4112 | } |
| 4113 | 4113 | // WPML |
| 4114 | - if ( $is_wpml ) {
|
|
| 4115 | - if ( $column == 'cat_language' ) {
|
|
| 4116 | - $cat_language = geodir_strtolower( trim( $row[$c] ) ); |
|
| 4117 | - } else if ( $column == 'cat_id_original' ) {
|
|
| 4118 | - $cat_id_original = (int)$row[$c]; |
|
| 4114 | + if ($is_wpml) {
|
|
| 4115 | + if ($column == 'cat_language') {
|
|
| 4116 | + $cat_language = geodir_strtolower(trim($row[$c])); |
|
| 4117 | + } else if ($column == 'cat_id_original') {
|
|
| 4118 | + $cat_id_original = (int) $row[$c]; |
|
| 4119 | 4119 | } |
| 4120 | 4120 | } |
| 4121 | 4121 | // WPML |
| 4122 | 4122 | $c++; |
| 4123 | 4123 | } |
| 4124 | 4124 | |
| 4125 | - if ( $cat_name == '' || !in_array( $cat_posttype, $post_types ) ) {
|
|
| 4126 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) ); |
|
| 4125 | + if ($cat_name == '' || !in_array($cat_posttype, $post_types)) {
|
|
| 4126 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be added due to blank title/invalid post type', 'geodirectory'));
|
|
| 4127 | 4127 | |
| 4128 | 4128 | $invalid++; |
| 4129 | 4129 | continue; |
@@ -4141,24 +4141,24 @@ discard block |
||
| 4141 | 4141 | $term_data['description'] = $cat_description; |
| 4142 | 4142 | $term_data['cat_schema'] = $cat_schema; |
| 4143 | 4143 | $term_data['top_description'] = $cat_top_description; |
| 4144 | - $term_data['image'] = $cat_image != '' ? basename( $cat_image ) : ''; |
|
| 4145 | - $term_data['icon'] = $cat_icon != '' ? basename( $cat_icon ) : ''; |
|
| 4144 | + $term_data['image'] = $cat_image != '' ? basename($cat_image) : ''; |
|
| 4145 | + $term_data['icon'] = $cat_icon != '' ? basename($cat_icon) : ''; |
|
| 4146 | 4146 | |
| 4147 | 4147 | //$term_data = array_map( 'utf8_encode', $term_data ); |
| 4148 | 4148 | |
| 4149 | - $taxonomy = $cat_posttype . 'category'; |
|
| 4149 | + $taxonomy = $cat_posttype.'category'; |
|
| 4150 | 4150 | |
| 4151 | 4151 | $term_data['taxonomy'] = $taxonomy; |
| 4152 | 4152 | |
| 4153 | 4153 | $term_parent_id = 0; |
| 4154 | - if ($cat_parent != "" || (int)$cat_parent > 0) {
|
|
| 4154 | + if ($cat_parent != "" || (int) $cat_parent > 0) {
|
|
| 4155 | 4155 | $term_parent = ''; |
| 4156 | 4156 | |
| 4157 | - if ( $term_parent = get_term_by( 'name', $cat_parent, $taxonomy ) ) {
|
|
| 4157 | + if ($term_parent = get_term_by('name', $cat_parent, $taxonomy)) {
|
|
| 4158 | 4158 | // |
| 4159 | - } else if ( $term_parent = get_term_by( 'slug', $cat_parent, $taxonomy ) ) {
|
|
| 4159 | + } else if ($term_parent = get_term_by('slug', $cat_parent, $taxonomy)) {
|
|
| 4160 | 4160 | // |
| 4161 | - } else if ( $term_parent = get_term_by( 'id', $cat_parent, $taxonomy ) ) {
|
|
| 4161 | + } else if ($term_parent = get_term_by('id', $cat_parent, $taxonomy)) {
|
|
| 4162 | 4162 | // |
| 4163 | 4163 | } else {
|
| 4164 | 4164 | $term_parent_data = array(); |
@@ -4166,104 +4166,104 @@ discard block |
||
| 4166 | 4166 | //$term_parent_data = array_map( 'utf8_encode', $term_parent_data ); |
| 4167 | 4167 | $term_parent_data['taxonomy'] = $taxonomy; |
| 4168 | 4168 | |
| 4169 | - $term_parent_id = (int)geodir_imex_insert_term( $taxonomy, $term_parent_data ); |
|
| 4169 | + $term_parent_id = (int) geodir_imex_insert_term($taxonomy, $term_parent_data); |
|
| 4170 | 4170 | } |
| 4171 | 4171 | |
| 4172 | - if ( !empty( $term_parent ) && !is_wp_error( $term_parent ) ) {
|
|
| 4173 | - $term_parent_id = (int)$term_parent->term_id; |
|
| 4172 | + if (!empty($term_parent) && !is_wp_error($term_parent)) {
|
|
| 4173 | + $term_parent_id = (int) $term_parent->term_id; |
|
| 4174 | 4174 | } |
| 4175 | 4175 | } |
| 4176 | - $term_data['parent'] = (int)$term_parent_id; |
|
| 4176 | + $term_data['parent'] = (int) $term_parent_id; |
|
| 4177 | 4177 | |
| 4178 | 4178 | $term_id = NULL; |
| 4179 | - if ( $import_choice == 'update' ) {
|
|
| 4180 | - if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
|
|
| 4179 | + if ($import_choice == 'update') {
|
|
| 4180 | + if ($cat_id > 0 && $term = (array) term_exists($cat_id, $taxonomy)) {
|
|
| 4181 | 4181 | $term_data['term_id'] = $term['term_id']; |
| 4182 | 4182 | |
| 4183 | - if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
|
|
| 4183 | + if ($term_id = geodir_imex_update_term($taxonomy, $term_data)) {
|
|
| 4184 | 4184 | $updated++; |
| 4185 | 4185 | } else {
|
| 4186 | 4186 | $invalid++; |
| 4187 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) ); |
|
| 4187 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory'));
|
|
| 4188 | 4188 | } |
| 4189 | - } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
|
|
| 4189 | + } else if ($term_data['slug'] != '' && $term = (array) term_exists($term_data['slug'], $taxonomy)) {
|
|
| 4190 | 4190 | $term_data['term_id'] = $term['term_id']; |
| 4191 | 4191 | |
| 4192 | - if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
|
|
| 4192 | + if ($term_id = geodir_imex_update_term($taxonomy, $term_data)) {
|
|
| 4193 | 4193 | $updated++; |
| 4194 | 4194 | } else {
|
| 4195 | 4195 | $invalid++; |
| 4196 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) ); |
|
| 4196 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory'));
|
|
| 4197 | 4197 | } |
| 4198 | 4198 | } else {
|
| 4199 | - if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
|
|
| 4199 | + if ($term_id = geodir_imex_insert_term($taxonomy, $term_data)) {
|
|
| 4200 | 4200 | $created++; |
| 4201 | 4201 | } else {
|
| 4202 | 4202 | $invalid++; |
| 4203 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) ); |
|
| 4203 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be added due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory'));
|
|
| 4204 | 4204 | } |
| 4205 | 4205 | } |
| 4206 | - } else if ( $import_choice == 'skip' ) {
|
|
| 4207 | - if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
|
|
| 4206 | + } else if ($import_choice == 'skip') {
|
|
| 4207 | + if ($cat_id > 0 && $term = (array) term_exists($cat_id, $taxonomy)) {
|
|
| 4208 | 4208 | $skipped++; |
| 4209 | - } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
|
|
| 4209 | + } else if ($term_data['slug'] != '' && $term = (array) term_exists($term_data['slug'], $taxonomy)) {
|
|
| 4210 | 4210 | $skipped++; |
| 4211 | 4211 | } else {
|
| 4212 | - if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
|
|
| 4212 | + if ($term_id = geodir_imex_insert_term($taxonomy, $term_data)) {
|
|
| 4213 | 4213 | $created++; |
| 4214 | 4214 | } else {
|
| 4215 | 4215 | $invalid++; |
| 4216 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) ); |
|
| 4216 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory'));
|
|
| 4217 | 4217 | } |
| 4218 | 4218 | } |
| 4219 | 4219 | } else {
|
| 4220 | 4220 | $invalid++; |
| 4221 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) ); |
|
| 4221 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be added due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory'));
|
|
| 4222 | 4222 | } |
| 4223 | 4223 | |
| 4224 | - if ( $term_id ) {
|
|
| 4224 | + if ($term_id) {
|
|
| 4225 | 4225 | // WPML |
| 4226 | 4226 | if ($is_wpml && $cat_id_original > 0 && $cat_language != '') {
|
| 4227 | - $wpml_element_type = 'tax_' . $taxonomy; |
|
| 4228 | - $source_language = geodir_get_language_for_element( $cat_id_original, $wpml_element_type ); |
|
| 4227 | + $wpml_element_type = 'tax_'.$taxonomy; |
|
| 4228 | + $source_language = geodir_get_language_for_element($cat_id_original, $wpml_element_type); |
|
| 4229 | 4229 | $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language(); |
| 4230 | 4230 | |
| 4231 | - $trid = $sitepress->get_element_trid( $cat_id_original, $wpml_element_type ); |
|
| 4231 | + $trid = $sitepress->get_element_trid($cat_id_original, $wpml_element_type); |
|
| 4232 | 4232 | |
| 4233 | - $sitepress->set_element_language_details( $term_id, $wpml_element_type, $trid, $cat_language, $source_language ); |
|
| 4233 | + $sitepress->set_element_language_details($term_id, $wpml_element_type, $trid, $cat_language, $source_language); |
|
| 4234 | 4234 | } |
| 4235 | 4235 | // WPML |
| 4236 | 4236 | |
| 4237 | - if ( isset( $term_data['top_description'] ) ) {
|
|
| 4238 | - update_tax_meta( $term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype ); |
|
| 4237 | + if (isset($term_data['top_description'])) {
|
|
| 4238 | + update_tax_meta($term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype); |
|
| 4239 | 4239 | } |
| 4240 | 4240 | |
| 4241 | - if ( isset( $term_data['cat_schema'] ) ) {
|
|
| 4242 | - update_tax_meta( $term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype ); |
|
| 4241 | + if (isset($term_data['cat_schema'])) {
|
|
| 4242 | + update_tax_meta($term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype); |
|
| 4243 | 4243 | } |
| 4244 | 4244 | |
| 4245 | 4245 | $attachment = false; |
| 4246 | - if ( isset( $term_data['image'] ) && $term_data['image'] != '' ) {
|
|
| 4247 | - $cat_image = geodir_get_default_catimage( $term_id, $cat_posttype ); |
|
| 4248 | - $cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : ''; |
|
| 4246 | + if (isset($term_data['image']) && $term_data['image'] != '') {
|
|
| 4247 | + $cat_image = geodir_get_default_catimage($term_id, $cat_posttype); |
|
| 4248 | + $cat_image = !empty($cat_image) && isset($cat_image['src']) ? $cat_image['src'] : ''; |
|
| 4249 | 4249 | |
| 4250 | - if ( basename($cat_image) != $term_data['image'] ) {
|
|
| 4250 | + if (basename($cat_image) != $term_data['image']) {
|
|
| 4251 | 4251 | $attachment = true; |
| 4252 | - update_tax_meta( $term_id, 'ct_cat_default_img', array( 'id' => 'image', 'src' => $uploads['url'] . '/' . $term_data['image'] ), $cat_posttype ); |
|
| 4252 | + update_tax_meta($term_id, 'ct_cat_default_img', array('id' => 'image', 'src' => $uploads['url'].'/'.$term_data['image']), $cat_posttype);
|
|
| 4253 | 4253 | } |
| 4254 | 4254 | } |
| 4255 | 4255 | |
| 4256 | - if ( isset( $term_data['icon'] ) && $term_data['icon'] != '' ) {
|
|
| 4257 | - $cat_icon = get_tax_meta( $term_id, 'ct_cat_icon', false, $cat_posttype ); |
|
| 4258 | - $cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : ''; |
|
| 4256 | + if (isset($term_data['icon']) && $term_data['icon'] != '') {
|
|
| 4257 | + $cat_icon = get_tax_meta($term_id, 'ct_cat_icon', false, $cat_posttype); |
|
| 4258 | + $cat_icon = !empty($cat_icon) && isset($cat_icon['src']) ? $cat_icon['src'] : ''; |
|
| 4259 | 4259 | |
| 4260 | - if ( basename($cat_icon) != $term_data['icon'] ) {
|
|
| 4260 | + if (basename($cat_icon) != $term_data['icon']) {
|
|
| 4261 | 4261 | $attachment = true; |
| 4262 | - update_tax_meta( $term_id, 'ct_cat_icon', array( 'id' => 'icon', 'src' => $uploads['url'] . '/' . $term_data['icon'] ), $cat_posttype ); |
|
| 4262 | + update_tax_meta($term_id, 'ct_cat_icon', array('id' => 'icon', 'src' => $uploads['url'].'/'.$term_data['icon']), $cat_posttype);
|
|
| 4263 | 4263 | } |
| 4264 | 4264 | } |
| 4265 | 4265 | |
| 4266 | - if ( $attachment ) {
|
|
| 4266 | + if ($attachment) {
|
|
| 4267 | 4267 | $images++; |
| 4268 | 4268 | } |
| 4269 | 4269 | } |
@@ -4285,13 +4285,13 @@ discard block |
||
| 4285 | 4285 | $json['invalid'] = $invalid; |
| 4286 | 4286 | $json['images'] = $images; |
| 4287 | 4287 | |
| 4288 | - wp_send_json( $json ); |
|
| 4288 | + wp_send_json($json); |
|
| 4289 | 4289 | exit; |
| 4290 | - } else if ( $task == 'import_post' ) {
|
|
| 4290 | + } else if ($task == 'import_post') {
|
|
| 4291 | 4291 | //run some stuff to make the import quicker |
| 4292 | - wp_defer_term_counting( true ); |
|
| 4293 | - wp_defer_comment_counting( true ); |
|
| 4294 | - $wpdb->query( 'SET autocommit = 0;' ); |
|
| 4292 | + wp_defer_term_counting(true); |
|
| 4293 | + wp_defer_comment_counting(true); |
|
| 4294 | + $wpdb->query('SET autocommit = 0;');
|
|
| 4295 | 4295 | |
| 4296 | 4296 | //remove_all_actions('publish_post');
|
| 4297 | 4297 | //remove_all_actions('transition_post_status');
|
@@ -4300,18 +4300,18 @@ discard block |
||
| 4300 | 4300 | if (!empty($file)) {
|
| 4301 | 4301 | $wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses. |
| 4302 | 4302 | $default_status = 'publish'; |
| 4303 | - $current_date = date_i18n( 'Y-m-d', time() ); |
|
| 4303 | + $current_date = date_i18n('Y-m-d', time());
|
|
| 4304 | 4304 | |
| 4305 | 4305 | $columns = isset($file[0]) ? $file[0] : NULL; |
| 4306 | 4306 | |
| 4307 | 4307 | if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
|
| 4308 | 4308 | $json['error'] = CSV_INVAILD_FILE; |
| 4309 | - wp_send_json( $json ); |
|
| 4309 | + wp_send_json($json); |
|
| 4310 | 4310 | exit; |
| 4311 | 4311 | } |
| 4312 | 4312 | |
| 4313 | 4313 | $gd_error_log = __('GD IMPORT LISTINGS [ROW %d]:', 'geodirectory');
|
| 4314 | - $wp_chars_error = __( '(check & remove if any invalid characters used in data)', 'geodirectory' ); |
|
| 4314 | + $wp_chars_error = __('(check & remove if any invalid characters used in data)', 'geodirectory');
|
|
| 4315 | 4315 | $processed_actual = 0; |
| 4316 | 4316 | for ($i = 1; $i <= $limit; $i++) {
|
| 4317 | 4317 | $index = $processed + $i; |
@@ -4320,9 +4320,9 @@ discard block |
||
| 4320 | 4320 | if (isset($file[$index])) {
|
| 4321 | 4321 | $processed_actual++; |
| 4322 | 4322 | $row = $file[$index]; |
| 4323 | - $row = array_map( 'trim', $row ); |
|
| 4323 | + $row = array_map('trim', $row);
|
|
| 4324 | 4324 | //$row = array_map( 'utf8_encode', $row ); |
| 4325 | - $row = array_map( 'addslashes_gpc', $row ); |
|
| 4325 | + $row = array_map('addslashes_gpc', $row);
|
|
| 4326 | 4326 | |
| 4327 | 4327 | $post_id = ''; |
| 4328 | 4328 | $post_title = ''; |
@@ -4359,78 +4359,78 @@ discard block |
||
| 4359 | 4359 | $original_post_id = ''; |
| 4360 | 4360 | |
| 4361 | 4361 | $c = 0; |
| 4362 | - foreach ($columns as $column ) {
|
|
| 4362 | + foreach ($columns as $column) {
|
|
| 4363 | 4363 | $gd_post[$column] = $row[$c]; |
| 4364 | 4364 | |
| 4365 | - if ( $column == 'post_id' ) {
|
|
| 4365 | + if ($column == 'post_id') {
|
|
| 4366 | 4366 | $post_id = $row[$c]; |
| 4367 | - } else if ( $column == 'post_title' ) {
|
|
| 4367 | + } else if ($column == 'post_title') {
|
|
| 4368 | 4368 | $post_title = sanitize_text_field($row[$c]); |
| 4369 | - } else if ( $column == 'post_author' ) {
|
|
| 4369 | + } else if ($column == 'post_author') {
|
|
| 4370 | 4370 | $post_author = $row[$c]; |
| 4371 | - } else if ( $column == 'post_content' ) {
|
|
| 4371 | + } else if ($column == 'post_content') {
|
|
| 4372 | 4372 | $post_content = $row[$c]; |
| 4373 | - } else if ( $column == 'post_category' && $row[$c] != '' ) {
|
|
| 4374 | - $post_category_arr = explode( ',', $row[$c] ); |
|
| 4375 | - } else if ( $column == 'default_category' ) {
|
|
| 4373 | + } else if ($column == 'post_category' && $row[$c] != '') {
|
|
| 4374 | + $post_category_arr = explode(',', $row[$c]);
|
|
| 4375 | + } else if ($column == 'default_category') {
|
|
| 4376 | 4376 | $default_category = wp_kses_normalize_entities($row[$c]); |
| 4377 | - } else if ( $column == 'post_tags' && $row[$c] != '' ) {
|
|
| 4378 | - $post_tags = explode( ',', sanitize_text_field($row[$c]) ); |
|
| 4379 | - } else if ( $column == 'post_type' ) {
|
|
| 4377 | + } else if ($column == 'post_tags' && $row[$c] != '') {
|
|
| 4378 | + $post_tags = explode(',', sanitize_text_field($row[$c]));
|
|
| 4379 | + } else if ($column == 'post_type') {
|
|
| 4380 | 4380 | $post_type = $row[$c]; |
| 4381 | - } else if ( $column == 'post_status' ) {
|
|
| 4382 | - $post_status = sanitize_key( $row[$c] ); |
|
| 4383 | - } else if ( $column == 'is_featured' ) {
|
|
| 4384 | - $is_featured = (int)$row[$c]; |
|
| 4385 | - } else if ( $column == 'geodir_video' ) {
|
|
| 4381 | + } else if ($column == 'post_status') {
|
|
| 4382 | + $post_status = sanitize_key($row[$c]); |
|
| 4383 | + } else if ($column == 'is_featured') {
|
|
| 4384 | + $is_featured = (int) $row[$c]; |
|
| 4385 | + } else if ($column == 'geodir_video') {
|
|
| 4386 | 4386 | $geodir_video = $row[$c]; |
| 4387 | - } else if ( $column == 'post_address' ) {
|
|
| 4387 | + } else if ($column == 'post_address') {
|
|
| 4388 | 4388 | $post_address = sanitize_text_field($row[$c]); |
| 4389 | - } else if ( $column == 'post_city' ) {
|
|
| 4389 | + } else if ($column == 'post_city') {
|
|
| 4390 | 4390 | $post_city = sanitize_text_field($row[$c]); |
| 4391 | - } else if ( $column == 'post_region' ) {
|
|
| 4391 | + } else if ($column == 'post_region') {
|
|
| 4392 | 4392 | $post_region = sanitize_text_field($row[$c]); |
| 4393 | - } else if ( $column == 'post_country' ) {
|
|
| 4393 | + } else if ($column == 'post_country') {
|
|
| 4394 | 4394 | $post_country = sanitize_text_field($row[$c]); |
| 4395 | - } else if ( $column == 'post_zip' ) {
|
|
| 4395 | + } else if ($column == 'post_zip') {
|
|
| 4396 | 4396 | $post_zip = sanitize_text_field($row[$c]); |
| 4397 | - } else if ( $column == 'post_latitude' ) {
|
|
| 4397 | + } else if ($column == 'post_latitude') {
|
|
| 4398 | 4398 | $post_latitude = sanitize_text_field($row[$c]); |
| 4399 | - } else if ( $column == 'post_longitude' ) {
|
|
| 4399 | + } else if ($column == 'post_longitude') {
|
|
| 4400 | 4400 | $post_longitude = sanitize_text_field($row[$c]); |
| 4401 | - } else if ( $column == 'post_neighbourhood' ) {
|
|
| 4401 | + } else if ($column == 'post_neighbourhood') {
|
|
| 4402 | 4402 | $post_neighbourhood = sanitize_text_field($row[$c]); |
| 4403 | 4403 | unset($gd_post[$column]); |
| 4404 | - } else if ( $column == 'neighbourhood_latitude' ) {
|
|
| 4404 | + } else if ($column == 'neighbourhood_latitude') {
|
|
| 4405 | 4405 | $neighbourhood_latitude = sanitize_text_field($row[$c]); |
| 4406 | - } else if ( $column == 'neighbourhood_longitude' ) {
|
|
| 4406 | + } else if ($column == 'neighbourhood_longitude') {
|
|
| 4407 | 4407 | $neighbourhood_longitude = sanitize_text_field($row[$c]); |
| 4408 | - } else if ( $column == 'geodir_timing' ) {
|
|
| 4408 | + } else if ($column == 'geodir_timing') {
|
|
| 4409 | 4409 | $geodir_timing = sanitize_text_field($row[$c]); |
| 4410 | - } else if ( $column == 'geodir_contact' ) {
|
|
| 4410 | + } else if ($column == 'geodir_contact') {
|
|
| 4411 | 4411 | $geodir_contact = sanitize_text_field($row[$c]); |
| 4412 | - } else if ( $column == 'geodir_email' ) {
|
|
| 4412 | + } else if ($column == 'geodir_email') {
|
|
| 4413 | 4413 | $geodir_email = sanitize_email($row[$c]); |
| 4414 | - } else if ( $column == 'geodir_website' ) {
|
|
| 4414 | + } else if ($column == 'geodir_website') {
|
|
| 4415 | 4415 | $geodir_website = sanitize_text_field($row[$c]); |
| 4416 | - } else if ( $column == 'geodir_twitter' ) {
|
|
| 4416 | + } else if ($column == 'geodir_twitter') {
|
|
| 4417 | 4417 | $geodir_twitter = sanitize_text_field($row[$c]); |
| 4418 | - } else if ( $column == 'geodir_facebook' ) {
|
|
| 4418 | + } else if ($column == 'geodir_facebook') {
|
|
| 4419 | 4419 | $geodir_facebook = sanitize_text_field($row[$c]); |
| 4420 | - } else if ( $column == 'IMAGE' && !empty( $row[$c] ) && $row[$c] != '' ) {
|
|
| 4420 | + } else if ($column == 'IMAGE' && !empty($row[$c]) && $row[$c] != '') {
|
|
| 4421 | 4421 | $post_images[] = $row[$c]; |
| 4422 | - } else if ( $column == 'alive_days' && (int)$row[$c] > 0 ) {
|
|
| 4423 | - $expire_date = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$row[$c] . ' days' ) ); |
|
| 4424 | - } else if ( $column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never' ) {
|
|
| 4422 | + } else if ($column == 'alive_days' && (int) $row[$c] > 0) {
|
|
| 4423 | + $expire_date = date_i18n('Y-m-d', strtotime($current_date.'+'.(int) $row[$c].' days'));
|
|
| 4424 | + } else if ($column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never') {
|
|
| 4425 | 4425 | $row[$c] = str_replace('/', '-', $row[$c]);
|
| 4426 | - $expire_date = date_i18n( 'Y-m-d', strtotime( $row[$c] ) ); |
|
| 4426 | + $expire_date = date_i18n('Y-m-d', strtotime($row[$c]));
|
|
| 4427 | 4427 | } |
| 4428 | 4428 | // WPML |
| 4429 | 4429 | if ($is_wpml) {
|
| 4430 | 4430 | if ($column == 'language') {
|
| 4431 | 4431 | $language = geodir_strtolower(trim($row[$c])); |
| 4432 | 4432 | } else if ($column == 'original_post_id') {
|
| 4433 | - $original_post_id = (int)$row[$c]; |
|
| 4433 | + $original_post_id = (int) $row[$c]; |
|
| 4434 | 4434 | } |
| 4435 | 4435 | } |
| 4436 | 4436 | // WPML |
@@ -4445,43 +4445,43 @@ discard block |
||
| 4445 | 4445 | |
| 4446 | 4446 | $gd_post['IMAGE'] = $post_images; |
| 4447 | 4447 | |
| 4448 | - $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status; |
|
| 4449 | - $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status; |
|
| 4448 | + $post_status = !empty($post_status) ? sanitize_key($post_status) : $default_status; |
|
| 4449 | + $post_status = !empty($wp_post_statuses) && !isset($wp_post_statuses[$post_status]) ? $default_status : $post_status; |
|
| 4450 | 4450 | |
| 4451 | 4451 | $valid = true; |
| 4452 | 4452 | |
| 4453 | - if ( $post_title == '' || !in_array( $post_type, $post_types ) ) {
|
|
| 4453 | + if ($post_title == '' || !in_array($post_type, $post_types)) {
|
|
| 4454 | 4454 | $invalid++; |
| 4455 | 4455 | $valid = false; |
| 4456 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) ); |
|
| 4456 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be added due to blank title/invalid post type', 'geodirectory'));
|
|
| 4457 | 4457 | } |
| 4458 | 4458 | |
| 4459 | - $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true; |
|
| 4460 | - if ( $location_allowed ) {
|
|
| 4459 | + $location_allowed = function_exists('geodir_cpt_no_location') && geodir_cpt_no_location($post_type) ? false : true;
|
|
| 4460 | + if ($location_allowed) {
|
|
| 4461 | 4461 | $location_result = geodir_get_default_location(); |
| 4462 | - if ( $post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '' ) {
|
|
| 4462 | + if ($post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '') {
|
|
| 4463 | 4463 | $invalid_addr++; |
| 4464 | 4464 | $valid = false; |
| 4465 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory' ) ); |
|
| 4466 | - } else if ( !empty( $location_result ) && $location_result->location_id == 0 ) {
|
|
| 4467 | - if ( ( geodir_strtolower( $post_city ) != geodir_strtolower( $location_result->city ) ) || ( geodir_strtolower( $post_region ) != geodir_strtolower( $location_result->region ) ) || (geodir_strtolower( $post_country ) != geodir_strtolower( $location_result->country ) ) ) {
|
|
| 4465 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory'));
|
|
| 4466 | + } else if (!empty($location_result) && $location_result->location_id == 0) {
|
|
| 4467 | + if ((geodir_strtolower($post_city) != geodir_strtolower($location_result->city)) || (geodir_strtolower($post_region) != geodir_strtolower($location_result->region)) || (geodir_strtolower($post_country) != geodir_strtolower($location_result->country))) {
|
|
| 4468 | 4468 | $invalid_addr++; |
| 4469 | 4469 | $valid = false; |
| 4470 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory' ) ); |
|
| 4470 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory'));
|
|
| 4471 | 4471 | } else {
|
| 4472 | 4472 | if (!$location_manager) {
|
| 4473 | - $gd_post['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // Set the default location when location manager not activated. |
|
| 4473 | + $gd_post['post_locations'] = '['.$location_result->city_slug.'],['.$location_result->region_slug.'],['.$location_result->country_slug.']'; // Set the default location when location manager not activated. |
|
| 4474 | 4474 | } |
| 4475 | 4475 | } |
| 4476 | 4476 | } |
| 4477 | 4477 | } |
| 4478 | 4478 | |
| 4479 | - if ( !$valid ) {
|
|
| 4479 | + if (!$valid) {
|
|
| 4480 | 4480 | continue; |
| 4481 | 4481 | } |
| 4482 | 4482 | |
| 4483 | - $cat_taxonomy = $post_type . 'category'; |
|
| 4484 | - $tags_taxonomy = $post_type . '_tags'; |
|
| 4483 | + $cat_taxonomy = $post_type.'category'; |
|
| 4484 | + $tags_taxonomy = $post_type.'_tags'; |
|
| 4485 | 4485 | |
| 4486 | 4486 | if ($default_category != '' && !in_array($default_category, $post_category_arr)) {
|
| 4487 | 4487 | $post_category_arr = array_merge(array($default_category), $post_category_arr); |
@@ -4489,29 +4489,29 @@ discard block |
||
| 4489 | 4489 | |
| 4490 | 4490 | $post_category = array(); |
| 4491 | 4491 | $default_category_id = NULL; |
| 4492 | - if ( !empty( $post_category_arr ) ) {
|
|
| 4493 | - foreach ( $post_category_arr as $value ) {
|
|
| 4494 | - $category_name = wp_kses_normalize_entities( trim( $value ) ); |
|
| 4492 | + if (!empty($post_category_arr)) {
|
|
| 4493 | + foreach ($post_category_arr as $value) {
|
|
| 4494 | + $category_name = wp_kses_normalize_entities(trim($value)); |
|
| 4495 | 4495 | |
| 4496 | - if ( $category_name != '' ) {
|
|
| 4496 | + if ($category_name != '') {
|
|
| 4497 | 4497 | $term_category = array(); |
| 4498 | 4498 | |
| 4499 | - if ( $term = get_term_by( 'name', $category_name, $cat_taxonomy ) ) {
|
|
| 4499 | + if ($term = get_term_by('name', $category_name, $cat_taxonomy)) {
|
|
| 4500 | 4500 | $term_category = $term; |
| 4501 | - } else if ( $term = get_term_by( 'slug', $category_name, $cat_taxonomy ) ) {
|
|
| 4501 | + } else if ($term = get_term_by('slug', $category_name, $cat_taxonomy)) {
|
|
| 4502 | 4502 | $term_category = $term; |
| 4503 | 4503 | } else {
|
| 4504 | 4504 | $term_data = array(); |
| 4505 | 4505 | $term_data['name'] = $category_name; |
| 4506 | 4506 | $term_data['taxonomy'] = $cat_taxonomy; |
| 4507 | 4507 | |
| 4508 | - $term_id = geodir_imex_insert_term( $cat_taxonomy, $term_data ); |
|
| 4509 | - if ( $term_id ) {
|
|
| 4510 | - $term_category = get_term( $term_id, $cat_taxonomy ); |
|
| 4508 | + $term_id = geodir_imex_insert_term($cat_taxonomy, $term_data); |
|
| 4509 | + if ($term_id) {
|
|
| 4510 | + $term_category = get_term($term_id, $cat_taxonomy); |
|
| 4511 | 4511 | } |
| 4512 | 4512 | } |
| 4513 | 4513 | |
| 4514 | - if ( !empty( $term_category ) && !is_wp_error( $term_category ) ) {
|
|
| 4514 | + if (!empty($term_category) && !is_wp_error($term_category)) {
|
|
| 4515 | 4515 | $post_category[] = intval($term_category->term_id); |
| 4516 | 4516 | |
| 4517 | 4517 | if ($category_name == $default_category) {
|
@@ -4532,15 +4532,15 @@ discard block |
||
| 4532 | 4532 | $save_post['post_tags'] = $post_tags; |
| 4533 | 4533 | |
| 4534 | 4534 | $saved_post_id = NULL; |
| 4535 | - if ( $import_choice == 'update' ) {
|
|
| 4536 | - $gd_wp_error = __( 'Unable to add listing, please check the listing data.', 'geodirectory' ); |
|
| 4535 | + if ($import_choice == 'update') {
|
|
| 4536 | + $gd_wp_error = __('Unable to add listing, please check the listing data.', 'geodirectory');
|
|
| 4537 | 4537 | |
| 4538 | - if ( $post_id > 0 && get_post( $post_id ) ) {
|
|
| 4538 | + if ($post_id > 0 && get_post($post_id)) {
|
|
| 4539 | 4539 | $save_post['ID'] = $post_id; |
| 4540 | 4540 | |
| 4541 | - if ( $saved_post_id = wp_update_post( $save_post, true ) ) {
|
|
| 4542 | - if ( is_wp_error( $saved_post_id ) ) {
|
|
| 4543 | - $gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error; |
|
| 4541 | + if ($saved_post_id = wp_update_post($save_post, true)) {
|
|
| 4542 | + if (is_wp_error($saved_post_id)) {
|
|
| 4543 | + $gd_wp_error = $saved_post_id->get_error_message().' '.$wp_chars_error; |
|
| 4544 | 4544 | $saved_post_id = 0; |
| 4545 | 4545 | } else {
|
| 4546 | 4546 | $saved_post_id = $post_id; |
@@ -4548,9 +4548,9 @@ discard block |
||
| 4548 | 4548 | } |
| 4549 | 4549 | } |
| 4550 | 4550 | } else {
|
| 4551 | - if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
|
|
| 4552 | - if ( is_wp_error( $saved_post_id ) ) {
|
|
| 4553 | - $gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error; |
|
| 4551 | + if ($saved_post_id = wp_insert_post($save_post, true)) {
|
|
| 4552 | + if (is_wp_error($saved_post_id)) {
|
|
| 4553 | + $gd_wp_error = $saved_post_id->get_error_message().' '.$wp_chars_error; |
|
| 4554 | 4554 | $saved_post_id = 0; |
| 4555 | 4555 | } else {
|
| 4556 | 4556 | $created++; |
@@ -4558,19 +4558,19 @@ discard block |
||
| 4558 | 4558 | } |
| 4559 | 4559 | } |
| 4560 | 4560 | |
| 4561 | - if ( !$saved_post_id > 0 ) {
|
|
| 4561 | + if (!$saved_post_id > 0) {
|
|
| 4562 | 4562 | $invalid++; |
| 4563 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_wp_error ); |
|
| 4563 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_wp_error); |
|
| 4564 | 4564 | } |
| 4565 | - } else if ( $import_choice == 'skip' ) {
|
|
| 4566 | - if ( $post_id > 0 && get_post( $post_id ) ) {
|
|
| 4565 | + } else if ($import_choice == 'skip') {
|
|
| 4566 | + if ($post_id > 0 && get_post($post_id)) {
|
|
| 4567 | 4567 | $skipped++; |
| 4568 | 4568 | } else {
|
| 4569 | - if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
|
|
| 4570 | - if ( is_wp_error( $saved_post_id ) ) {
|
|
| 4569 | + if ($saved_post_id = wp_insert_post($save_post, true)) {
|
|
| 4570 | + if (is_wp_error($saved_post_id)) {
|
|
| 4571 | 4571 | $invalid++; |
| 4572 | 4572 | |
| 4573 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $saved_post_id->get_error_message() . ' ' . $wp_chars_error ); |
|
| 4573 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$saved_post_id->get_error_message().' '.$wp_chars_error); |
|
| 4574 | 4574 | $saved_post_id = 0; |
| 4575 | 4575 | } else {
|
| 4576 | 4576 | $created++; |
@@ -4578,28 +4578,28 @@ discard block |
||
| 4578 | 4578 | } else {
|
| 4579 | 4579 | $invalid++; |
| 4580 | 4580 | |
| 4581 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error ); |
|
| 4581 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$wp_chars_error); |
|
| 4582 | 4582 | } |
| 4583 | 4583 | } |
| 4584 | 4584 | } else {
|
| 4585 | 4585 | $invalid++; |
| 4586 | 4586 | |
| 4587 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error ); |
|
| 4587 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$wp_chars_error); |
|
| 4588 | 4588 | } |
| 4589 | 4589 | |
| 4590 | - if ( (int)$saved_post_id > 0 ) {
|
|
| 4590 | + if ((int) $saved_post_id > 0) {
|
|
| 4591 | 4591 | // WPML |
| 4592 | 4592 | if ($is_wpml && $original_post_id > 0 && $language != '') {
|
| 4593 | - $wpml_post_type = 'post_' . $post_type; |
|
| 4594 | - $source_language = geodir_get_language_for_element( $original_post_id, $wpml_post_type ); |
|
| 4593 | + $wpml_post_type = 'post_'.$post_type; |
|
| 4594 | + $source_language = geodir_get_language_for_element($original_post_id, $wpml_post_type); |
|
| 4595 | 4595 | $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language(); |
| 4596 | 4596 | |
| 4597 | - $trid = $sitepress->get_element_trid( $original_post_id, $wpml_post_type ); |
|
| 4597 | + $trid = $sitepress->get_element_trid($original_post_id, $wpml_post_type); |
|
| 4598 | 4598 | |
| 4599 | - $sitepress->set_element_language_details( $saved_post_id, $wpml_post_type, $trid, $language, $source_language ); |
|
| 4599 | + $sitepress->set_element_language_details($saved_post_id, $wpml_post_type, $trid, $language, $source_language); |
|
| 4600 | 4600 | } |
| 4601 | 4601 | // WPML |
| 4602 | - $gd_post_info = geodir_get_post_info( $saved_post_id ); |
|
| 4602 | + $gd_post_info = geodir_get_post_info($saved_post_id); |
|
| 4603 | 4603 | |
| 4604 | 4604 | $gd_post['post_id'] = $saved_post_id; |
| 4605 | 4605 | $gd_post['ID'] = $saved_post_id; |
@@ -4611,7 +4611,7 @@ discard block |
||
| 4611 | 4611 | |
| 4612 | 4612 | // post location |
| 4613 | 4613 | $post_location_id = 0; |
| 4614 | - if ( $location_allowed && !empty( $location_result ) && $location_result->location_id > 0 ) {
|
|
| 4614 | + if ($location_allowed && !empty($location_result) && $location_result->location_id > 0) {
|
|
| 4615 | 4615 | $gd_post['post_neighbourhood'] = ''; |
| 4616 | 4616 | |
| 4617 | 4617 | $post_location_info = array( |
@@ -4621,7 +4621,7 @@ discard block |
||
| 4621 | 4621 | 'geo_lat' => $post_latitude, |
| 4622 | 4622 | 'geo_lng' => $post_longitude |
| 4623 | 4623 | ); |
| 4624 | - if ( $location_id = (int)geodir_add_new_location( $post_location_info ) ) {
|
|
| 4624 | + if ($location_id = (int) geodir_add_new_location($post_location_info)) {
|
|
| 4625 | 4625 | $post_location_id = $location_id; |
| 4626 | 4626 | } |
| 4627 | 4627 | |
@@ -4659,14 +4659,14 @@ discard block |
||
| 4659 | 4659 | $gd_post['post_location_id'] = $post_location_id; |
| 4660 | 4660 | |
| 4661 | 4661 | // post package info |
| 4662 | - $package_id = isset( $gd_post['package_id'] ) && !empty( $gd_post['package_id'] ) ? (int)$gd_post['package_id'] : 0; |
|
| 4662 | + $package_id = isset($gd_post['package_id']) && !empty($gd_post['package_id']) ? (int) $gd_post['package_id'] : 0; |
|
| 4663 | 4663 | if (!$package_id && !empty($gd_post_info) && isset($gd_post_info->package_id) && $gd_post_info->package_id) {
|
| 4664 | 4664 | $package_id = $gd_post_info->package_id; |
| 4665 | 4665 | } |
| 4666 | 4666 | |
| 4667 | 4667 | $package_info = array(); |
| 4668 | 4668 | if ($package_id && function_exists('geodir_get_package_info_by_id')) {
|
| 4669 | - $package_info = (array)geodir_get_package_info_by_id($package_id); |
|
| 4669 | + $package_info = (array) geodir_get_package_info_by_id($package_id); |
|
| 4670 | 4670 | |
| 4671 | 4671 | if (!(!empty($package_info) && isset($package_info['post_type']) && $package_info['post_type'] == $post_type)) {
|
| 4672 | 4672 | $package_info = array(); |
@@ -4674,18 +4674,18 @@ discard block |
||
| 4674 | 4674 | } |
| 4675 | 4675 | |
| 4676 | 4676 | if (empty($package_info)) {
|
| 4677 | - $package_info = (array)geodir_post_package_info( array(), '', $post_type ); |
|
| 4677 | + $package_info = (array) geodir_post_package_info(array(), '', $post_type); |
|
| 4678 | 4678 | } |
| 4679 | 4679 | |
| 4680 | - if (!empty($package_info)) {
|
|
| 4680 | + if (!empty($package_info)) {
|
|
| 4681 | 4681 | $package_id = $package_info['pid']; |
| 4682 | 4682 | |
| 4683 | 4683 | if (isset($gd_post['alive_days']) || isset($gd_post['expire_date'])) {
|
| 4684 | 4684 | $gd_post['expire_date'] = $expire_date; |
| 4685 | 4685 | } else {
|
| 4686 | - if ( isset( $package_info['days'] ) && (int)$package_info['days'] > 0 ) {
|
|
| 4687 | - $gd_post['alive_days'] = (int)$package_info['days']; |
|
| 4688 | - $gd_post['expire_date'] = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$package_info['days'] . ' days' ) ); |
|
| 4686 | + if (isset($package_info['days']) && (int) $package_info['days'] > 0) {
|
|
| 4687 | + $gd_post['alive_days'] = (int) $package_info['days']; |
|
| 4688 | + $gd_post['expire_date'] = date_i18n('Y-m-d', strtotime($current_date.'+'.(int) $package_info['days'].' days'));
|
|
| 4689 | 4689 | } else {
|
| 4690 | 4690 | $gd_post['expire_date'] = 'Never'; |
| 4691 | 4691 | } |
@@ -4694,7 +4694,7 @@ discard block |
||
| 4694 | 4694 | $gd_post['package_id'] = $package_id; |
| 4695 | 4695 | } |
| 4696 | 4696 | |
| 4697 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 4697 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 4698 | 4698 | |
| 4699 | 4699 | if ($post_type == 'gd_event') {
|
| 4700 | 4700 | $gd_post = geodir_imex_process_event_data($gd_post); |
@@ -4705,28 +4705,28 @@ discard block |
||
| 4705 | 4705 | } |
| 4706 | 4706 | |
| 4707 | 4707 | // Export franchise fields |
| 4708 | - $is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false; |
|
| 4708 | + $is_franchise_active = is_plugin_active('geodir_franchise/geodir_franchise.php') && geodir_franchise_enabled($post_type) ? true : false;
|
|
| 4709 | 4709 | if ($is_franchise_active) {
|
| 4710 | - if ( isset( $gd_post['gd_is_franchise'] ) && (int)$gd_post['gd_is_franchise'] == 1 ) {
|
|
| 4710 | + if (isset($gd_post['gd_is_franchise']) && (int) $gd_post['gd_is_franchise'] == 1) {
|
|
| 4711 | 4711 | $gd_franchise_lock = array(); |
| 4712 | 4712 | |
| 4713 | - if ( isset( $gd_post['gd_franchise_lock'] ) ) {
|
|
| 4714 | - $gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock'] );
|
|
| 4715 | - $gd_franchise_lock = trim( $gd_franchise_lock ); |
|
| 4716 | - $gd_franchise_lock = explode( ",", $gd_franchise_lock ); |
|
| 4713 | + if (isset($gd_post['gd_franchise_lock'])) {
|
|
| 4714 | + $gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock']);
|
|
| 4715 | + $gd_franchise_lock = trim($gd_franchise_lock); |
|
| 4716 | + $gd_franchise_lock = explode(",", $gd_franchise_lock);
|
|
| 4717 | 4717 | } |
| 4718 | 4718 | |
| 4719 | - update_post_meta( $saved_post_id, 'gd_is_franchise', 1 ); |
|
| 4720 | - update_post_meta( $saved_post_id, 'gd_franchise_lock', $gd_franchise_lock ); |
|
| 4719 | + update_post_meta($saved_post_id, 'gd_is_franchise', 1); |
|
| 4720 | + update_post_meta($saved_post_id, 'gd_franchise_lock', $gd_franchise_lock); |
|
| 4721 | 4721 | } else {
|
| 4722 | - if ( isset( $gd_post['franchise'] ) && (int)$gd_post['franchise'] > 0 && geodir_franchise_check( (int)$gd_post['franchise'] ) ) {
|
|
| 4723 | - geodir_save_post_meta( $saved_post_id, 'franchise', (int)$gd_post['franchise'] ); |
|
| 4722 | + if (isset($gd_post['franchise']) && (int) $gd_post['franchise'] > 0 && geodir_franchise_check((int) $gd_post['franchise'])) {
|
|
| 4723 | + geodir_save_post_meta($saved_post_id, 'franchise', (int) $gd_post['franchise']); |
|
| 4724 | 4724 | } |
| 4725 | 4725 | } |
| 4726 | 4726 | } |
| 4727 | 4727 | |
| 4728 | 4728 | if (!empty($save_post['post_category']) && is_array($save_post['post_category'])) {
|
| 4729 | - $save_post['post_category'] = array_unique( array_map( 'intval', $save_post['post_category'] ) ); |
|
| 4729 | + $save_post['post_category'] = array_unique(array_map('intval', $save_post['post_category']));
|
|
| 4730 | 4730 | if ($default_category_id) {
|
| 4731 | 4731 | $save_post['post_default_category'] = $default_category_id; |
| 4732 | 4732 | $gd_post['default_category'] = $default_category_id; |
@@ -4735,34 +4735,34 @@ discard block |
||
| 4735 | 4735 | } |
| 4736 | 4736 | |
| 4737 | 4737 | // Save post info |
| 4738 | - geodir_save_post_info( $saved_post_id, $gd_post ); |
|
| 4738 | + geodir_save_post_info($saved_post_id, $gd_post); |
|
| 4739 | 4739 | // post taxonomies |
| 4740 | - if ( !empty( $save_post['post_category'] ) ) {
|
|
| 4741 | - wp_set_object_terms( $saved_post_id, $save_post['post_category'], $cat_taxonomy ); |
|
| 4740 | + if (!empty($save_post['post_category'])) {
|
|
| 4741 | + wp_set_object_terms($saved_post_id, $save_post['post_category'], $cat_taxonomy); |
|
| 4742 | 4742 | |
| 4743 | - $post_default_category = isset( $save_post['post_default_category'] ) ? $save_post['post_default_category'] : ''; |
|
| 4743 | + $post_default_category = isset($save_post['post_default_category']) ? $save_post['post_default_category'] : ''; |
|
| 4744 | 4744 | if ($default_category_id) {
|
| 4745 | 4745 | $post_default_category = $default_category_id; |
| 4746 | 4746 | } |
| 4747 | 4747 | $post_cat_ids = geodir_get_post_meta($saved_post_id, $cat_taxonomy); |
| 4748 | 4748 | $save_post['post_category'] = !empty($post_cat_ids) ? explode(",", trim($post_cat_ids, ",")) : $save_post['post_category'];
|
| 4749 | - $post_category_str = !empty($save_post['post_category']) ? implode(",y:#", $save_post['post_category']) . ',y:' : '';
|
|
| 4749 | + $post_category_str = !empty($save_post['post_category']) ? implode(",y:#", $save_post['post_category']).',y:' : '';
|
|
| 4750 | 4750 | |
| 4751 | 4751 | if ($post_category_str != '' && $post_default_category) {
|
| 4752 | - $post_category_str = str_replace($post_default_category . ',y:', $post_default_category . ',y,d:', $post_category_str); |
|
| 4752 | + $post_category_str = str_replace($post_default_category.',y:', $post_default_category.',y,d:', $post_category_str); |
|
| 4753 | 4753 | } |
| 4754 | 4754 | |
| 4755 | 4755 | $post_category_str = $post_category_str != '' ? array($cat_taxonomy => $post_category_str) : ''; |
| 4756 | 4756 | |
| 4757 | - geodir_set_postcat_structure( $saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str ); |
|
| 4757 | + geodir_set_postcat_structure($saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str); |
|
| 4758 | 4758 | } |
| 4759 | 4759 | |
| 4760 | - if ( !empty( $save_post['post_tags'] ) ) {
|
|
| 4761 | - wp_set_object_terms( $saved_post_id, $save_post['post_tags'], $tags_taxonomy ); |
|
| 4760 | + if (!empty($save_post['post_tags'])) {
|
|
| 4761 | + wp_set_object_terms($saved_post_id, $save_post['post_tags'], $tags_taxonomy); |
|
| 4762 | 4762 | } |
| 4763 | 4763 | |
| 4764 | 4764 | // Post images |
| 4765 | - if ( !empty( $post_images ) ) {
|
|
| 4765 | + if (!empty($post_images)) {
|
|
| 4766 | 4766 | $post_images = array_unique($post_images); |
| 4767 | 4767 | |
| 4768 | 4768 | $old_post_images_arr = array(); |
@@ -4770,82 +4770,82 @@ discard block |
||
| 4770 | 4770 | |
| 4771 | 4771 | $order = 1; |
| 4772 | 4772 | |
| 4773 | - $old_post_images = geodir_get_images( $saved_post_id ); |
|
| 4773 | + $old_post_images = geodir_get_images($saved_post_id); |
|
| 4774 | 4774 | if (!empty($old_post_images)) {
|
| 4775 | - foreach( $old_post_images as $old_post_image ) {
|
|
| 4775 | + foreach ($old_post_images as $old_post_image) {
|
|
| 4776 | 4776 | if (!empty($old_post_image) && isset($old_post_image->file) && $old_post_image->file != '') {
|
| 4777 | 4777 | $old_post_images_arr[] = $old_post_image->file; |
| 4778 | 4778 | } |
| 4779 | 4779 | } |
| 4780 | 4780 | } |
| 4781 | 4781 | |
| 4782 | - foreach ( $post_images as $post_image ) {
|
|
| 4783 | - $image_name = basename( $post_image ); |
|
| 4782 | + foreach ($post_images as $post_image) {
|
|
| 4783 | + $image_name = basename($post_image); |
|
| 4784 | 4784 | $saved_post_images_arr[] = $image_name; |
| 4785 | 4785 | |
| 4786 | - if (!empty($old_post_images_arr) && in_array( $image_name, $old_post_images_arr) ) {
|
|
| 4786 | + if (!empty($old_post_images_arr) && in_array($image_name, $old_post_images_arr)) {
|
|
| 4787 | 4787 | continue; // Skip if image already exists. |
| 4788 | 4788 | } |
| 4789 | 4789 | |
| 4790 | - $image_name_parts = explode( '.', $image_name ); |
|
| 4791 | - array_pop( $image_name_parts ); |
|
| 4792 | - $proper_image_name = implode( '.', $image_name_parts ); |
|
| 4790 | + $image_name_parts = explode('.', $image_name);
|
|
| 4791 | + array_pop($image_name_parts); |
|
| 4792 | + $proper_image_name = implode('.', $image_name_parts);
|
|
| 4793 | 4793 | |
| 4794 | - $arr_file_type = wp_check_filetype( $image_name ); |
|
| 4794 | + $arr_file_type = wp_check_filetype($image_name); |
|
| 4795 | 4795 | |
| 4796 | - if ( !empty( $arr_file_type ) ) {
|
|
| 4796 | + if (!empty($arr_file_type)) {
|
|
| 4797 | 4797 | $uploaded_file_type = $arr_file_type['type']; |
| 4798 | 4798 | |
| 4799 | 4799 | $attachment = array(); |
| 4800 | 4800 | $attachment['post_id'] = $saved_post_id; |
| 4801 | 4801 | $attachment['title'] = $proper_image_name; |
| 4802 | 4802 | $attachment['content'] = ''; |
| 4803 | - $attachment['file'] = $uploads_subdir . '/' . $image_name; |
|
| 4803 | + $attachment['file'] = $uploads_subdir.'/'.$image_name; |
|
| 4804 | 4804 | $attachment['mime_type'] = $uploaded_file_type; |
| 4805 | 4805 | $attachment['menu_order'] = $order; |
| 4806 | 4806 | $attachment['is_featured'] = 0; |
| 4807 | 4807 | |
| 4808 | 4808 | $attachment_set = ''; |
| 4809 | - foreach ( $attachment as $key => $val ) {
|
|
| 4810 | - if ( $val != '' ) {
|
|
| 4811 | - $attachment_set .= $key . " = '" . $val . "', "; |
|
| 4809 | + foreach ($attachment as $key => $val) {
|
|
| 4810 | + if ($val != '') {
|
|
| 4811 | + $attachment_set .= $key." = '".$val."', "; |
|
| 4812 | 4812 | } |
| 4813 | 4813 | } |
| 4814 | - $attachment_set = trim( $attachment_set, ", " ); |
|
| 4814 | + $attachment_set = trim($attachment_set, ", "); |
|
| 4815 | 4815 | |
| 4816 | 4816 | // Add new attachment |
| 4817 | - $wpdb->query( "INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set ); |
|
| 4817 | + $wpdb->query("INSERT INTO ".GEODIR_ATTACHMENT_TABLE." SET ".$attachment_set);
|
|
| 4818 | 4818 | |
| 4819 | 4819 | $order++; |
| 4820 | 4820 | } |
| 4821 | 4821 | } |
| 4822 | 4822 | |
| 4823 | - $saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/" . implode("' AND file NOT LIKE '%/", $saved_post_images_arr) . "' )" : '';
|
|
| 4823 | + $saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/".implode("' AND file NOT LIKE '%/", $saved_post_images_arr)."' )" : '';
|
|
| 4824 | 4824 | // Remove previous attachment |
| 4825 | - $wpdb->query( "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = " . (int)$saved_post_id . " " . $saved_post_images_sql ); |
|
| 4825 | + $wpdb->query("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id = ".(int) $saved_post_id." ".$saved_post_images_sql);
|
|
| 4826 | 4826 | |
| 4827 | - if ( !empty( $saved_post_images_arr ) ) {
|
|
| 4827 | + if (!empty($saved_post_images_arr)) {
|
|
| 4828 | 4828 | $menu_order = 1; |
| 4829 | 4829 | |
| 4830 | - foreach ( $saved_post_images_arr as $img_name ) {
|
|
| 4831 | - $wpdb->query( $wpdb->prepare( "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order = %d WHERE post_id =%d AND file LIKE %s", array( $menu_order, $saved_post_id, '%/' . $img_name ) ) ); |
|
| 4830 | + foreach ($saved_post_images_arr as $img_name) {
|
|
| 4831 | + $wpdb->query($wpdb->prepare("UPDATE ".GEODIR_ATTACHMENT_TABLE." SET menu_order = %d WHERE post_id =%d AND file LIKE %s", array($menu_order, $saved_post_id, '%/'.$img_name)));
|
|
| 4832 | 4832 | |
| 4833 | - if( $menu_order == 1 ) {
|
|
| 4834 | - if ( $featured_image = $wpdb->get_var( $wpdb->prepare( "SELECT file FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =%d AND file LIKE %s", array( $saved_post_id, '%/' . $img_name ) ) ) ) {
|
|
| 4835 | - $wpdb->query( $wpdb->prepare( "UPDATE " . $table . " SET featured_image = %s WHERE post_id =%d", array( $featured_image, $saved_post_id ) ) ); |
|
| 4833 | + if ($menu_order == 1) {
|
|
| 4834 | + if ($featured_image = $wpdb->get_var($wpdb->prepare("SELECT file FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id =%d AND file LIKE %s", array($saved_post_id, '%/'.$img_name)))) {
|
|
| 4835 | + $wpdb->query($wpdb->prepare("UPDATE ".$table." SET featured_image = %s WHERE post_id =%d", array($featured_image, $saved_post_id)));
|
|
| 4836 | 4836 | } |
| 4837 | 4837 | } |
| 4838 | 4838 | $menu_order++; |
| 4839 | 4839 | } |
| 4840 | 4840 | } |
| 4841 | 4841 | |
| 4842 | - if ( $order > 1 ) {
|
|
| 4842 | + if ($order > 1) {
|
|
| 4843 | 4843 | $images++; |
| 4844 | 4844 | } |
| 4845 | 4845 | } |
| 4846 | 4846 | |
| 4847 | 4847 | /** This action is documented in geodirectory-functions/post-functions.php */ |
| 4848 | - do_action( 'geodir_after_save_listing', $saved_post_id, $gd_post ); |
|
| 4848 | + do_action('geodir_after_save_listing', $saved_post_id, $gd_post);
|
|
| 4849 | 4849 | |
| 4850 | 4850 | if (isset($is_featured)) {
|
| 4851 | 4851 | geodir_save_post_meta($saved_post_id, 'is_featured', $is_featured); |
@@ -4865,10 +4865,10 @@ discard block |
||
| 4865 | 4865 | } |
| 4866 | 4866 | |
| 4867 | 4867 | //undo some stuff to make the import quicker |
| 4868 | - wp_defer_term_counting( false ); |
|
| 4869 | - wp_defer_comment_counting( false ); |
|
| 4870 | - $wpdb->query( 'COMMIT;' ); |
|
| 4871 | - $wpdb->query( 'SET autocommit = 1;' ); |
|
| 4868 | + wp_defer_term_counting(false); |
|
| 4869 | + wp_defer_comment_counting(false); |
|
| 4870 | + $wpdb->query('COMMIT;');
|
|
| 4871 | + $wpdb->query('SET autocommit = 1;');
|
|
| 4872 | 4872 | |
| 4873 | 4873 | $json = array(); |
| 4874 | 4874 | $json['processed'] = $processed_actual; |
@@ -4879,9 +4879,9 @@ discard block |
||
| 4879 | 4879 | $json['invalid_addr'] = $invalid_addr; |
| 4880 | 4880 | $json['images'] = $images; |
| 4881 | 4881 | |
| 4882 | - wp_send_json( $json ); |
|
| 4882 | + wp_send_json($json); |
|
| 4883 | 4883 | exit; |
| 4884 | - } else if ( $task == 'import_loc' ) {
|
|
| 4884 | + } else if ($task == 'import_loc') {
|
|
| 4885 | 4885 | global $gd_post_types; |
| 4886 | 4886 | $gd_post_types = $post_types; |
| 4887 | 4887 | |
@@ -4890,82 +4890,82 @@ discard block |
||
| 4890 | 4890 | |
| 4891 | 4891 | if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
|
| 4892 | 4892 | $json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
|
| 4893 | - wp_send_json( $json ); |
|
| 4893 | + wp_send_json($json); |
|
| 4894 | 4894 | } |
| 4895 | 4895 | |
| 4896 | 4896 | $gd_error_log = __('GD IMPORT LOCATIONS [ROW %d]:', 'geodirectory');
|
| 4897 | - $gd_error_location = __( 'Could not be saved due to blank/invalid address(city, region, country, latitude, longitude)', 'geodirectory' ); |
|
| 4897 | + $gd_error_location = __('Could not be saved due to blank/invalid address(city, region, country, latitude, longitude)', 'geodirectory');
|
|
| 4898 | 4898 | for ($i = 1; $i <= $limit; $i++) {
|
| 4899 | 4899 | $index = $processed + $i; |
| 4900 | 4900 | |
| 4901 | 4901 | if (isset($file[$index])) {
|
| 4902 | 4902 | $row = $file[$index]; |
| 4903 | - $row = array_map( 'trim', $row ); |
|
| 4903 | + $row = array_map('trim', $row);
|
|
| 4904 | 4904 | $data = array(); |
| 4905 | 4905 | |
| 4906 | - foreach ($columns as $c => $column ) {
|
|
| 4906 | + foreach ($columns as $c => $column) {
|
|
| 4907 | 4907 | 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'))) {
|
| 4908 | 4908 | $data[$column] = $row[$c]; |
| 4909 | 4909 | } |
| 4910 | 4910 | } |
| 4911 | 4911 | |
| 4912 | - if ( empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude']) ) {
|
|
| 4912 | + if (empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude'])) {
|
|
| 4913 | 4913 | $invalid++; |
| 4914 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location ); |
|
| 4914 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location); |
|
| 4915 | 4915 | continue; |
| 4916 | 4916 | } |
| 4917 | 4917 | |
| 4918 | 4918 | $data['location_id'] = isset($data['location_id']) ? absint($data['location_id']) : 0; |
| 4919 | 4919 | |
| 4920 | - if ( $import_choice == 'update' ) {
|
|
| 4921 | - if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
|
|
| 4922 | - if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
|
|
| 4920 | + if ($import_choice == 'update') {
|
|
| 4921 | + if ((int) $data['location_id'] > 0 && $location = geodir_get_location_by_id('', (int) $data['location_id'])) {
|
|
| 4922 | + if ($location_id = geodir_location_update_city($data, true, $location)) {
|
|
| 4923 | 4923 | $updated++; |
| 4924 | 4924 | } else {
|
| 4925 | 4925 | $invalid++; |
| 4926 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location ); |
|
| 4926 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location); |
|
| 4927 | 4927 | } |
| 4928 | - } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
|
|
| 4929 | - $data['location_id'] = (int)$location->location_id; |
|
| 4928 | + } else if (!empty($data['city_slug']) && $location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug']))) {
|
|
| 4929 | + $data['location_id'] = (int) $location->location_id; |
|
| 4930 | 4930 | |
| 4931 | - if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region'] ) ) ) {
|
|
| 4932 | - $data['location_id'] = (int)$location->location_id; |
|
| 4933 | - } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'region' => $data['region'] ) ) ) {
|
|
| 4934 | - $data['location_id'] = (int)$location->location_id; |
|
| 4935 | - } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'] ) ) ) {
|
|
| 4936 | - $data['location_id'] = (int)$location->location_id; |
|
| 4931 | + if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region']))) {
|
|
| 4932 | + $data['location_id'] = (int) $location->location_id; |
|
| 4933 | + } else if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'region' => $data['region']))) {
|
|
| 4934 | + $data['location_id'] = (int) $location->location_id; |
|
| 4935 | + } else if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'country' => $data['country']))) {
|
|
| 4936 | + $data['location_id'] = (int) $location->location_id; |
|
| 4937 | 4937 | } |
| 4938 | 4938 | |
| 4939 | - if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
|
|
| 4939 | + if ($location_id = geodir_location_update_city($data, true, $location)) {
|
|
| 4940 | 4940 | $updated++; |
| 4941 | 4941 | } else {
|
| 4942 | 4942 | $invalid++; |
| 4943 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location ); |
|
| 4943 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location); |
|
| 4944 | 4944 | } |
| 4945 | 4945 | } else {
|
| 4946 | - if ( $location_id = geodir_location_insert_city( $data, true ) ) {
|
|
| 4946 | + if ($location_id = geodir_location_insert_city($data, true)) {
|
|
| 4947 | 4947 | $created++; |
| 4948 | 4948 | } else {
|
| 4949 | 4949 | $invalid++; |
| 4950 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location ); |
|
| 4950 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location); |
|
| 4951 | 4951 | } |
| 4952 | 4952 | } |
| 4953 | - } elseif ( $import_choice == 'skip' ) {
|
|
| 4954 | - if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
|
|
| 4953 | + } elseif ($import_choice == 'skip') {
|
|
| 4954 | + if ((int) $data['location_id'] > 0 && $location = geodir_get_location_by_id('', (int) $data['location_id'])) {
|
|
| 4955 | 4955 | $skipped++; |
| 4956 | - } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
|
|
| 4956 | + } else if (!empty($data['city_slug']) && $location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug']))) {
|
|
| 4957 | 4957 | $skipped++; |
| 4958 | 4958 | } else {
|
| 4959 | - if ( $location_id = geodir_location_insert_city( $data, true ) ) {
|
|
| 4959 | + if ($location_id = geodir_location_insert_city($data, true)) {
|
|
| 4960 | 4960 | $created++; |
| 4961 | 4961 | } else {
|
| 4962 | 4962 | $invalid++; |
| 4963 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location ); |
|
| 4963 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location); |
|
| 4964 | 4964 | } |
| 4965 | 4965 | } |
| 4966 | 4966 | } else {
|
| 4967 | 4967 | $invalid++; |
| 4968 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location ); |
|
| 4968 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location); |
|
| 4969 | 4969 | } |
| 4970 | 4970 | } |
| 4971 | 4971 | } |
@@ -4979,24 +4979,24 @@ discard block |
||
| 4979 | 4979 | $json['invalid'] = $invalid; |
| 4980 | 4980 | $json['images'] = $images; |
| 4981 | 4981 | |
| 4982 | - wp_send_json( $json ); |
|
| 4983 | - } else if ( $task == 'import_hood' ) {
|
|
| 4982 | + wp_send_json($json); |
|
| 4983 | + } else if ($task == 'import_hood') {
|
|
| 4984 | 4984 | if (!empty($file)) {
|
| 4985 | 4985 | $columns = isset($file[0]) ? $file[0] : NULL; |
| 4986 | 4986 | |
| 4987 | 4987 | if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
|
| 4988 | 4988 | $json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
|
| 4989 | - wp_send_json( $json ); |
|
| 4989 | + wp_send_json($json); |
|
| 4990 | 4990 | } |
| 4991 | 4991 | |
| 4992 | 4992 | $gd_error_log = __('GD IMPORT NEIGHBOURHOODS [ROW %d]:', 'geodirectory');
|
| 4993 | - $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' ); |
|
| 4993 | + $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');
|
|
| 4994 | 4994 | for ($i = 1; $i <= $limit; $i++) {
|
| 4995 | 4995 | $index = $processed + $i; |
| 4996 | 4996 | |
| 4997 | 4997 | if (isset($file[$index])) {
|
| 4998 | 4998 | $row = $file[$index]; |
| 4999 | - $row = array_map( 'trim', $row ); |
|
| 4999 | + $row = array_map('trim', $row);
|
|
| 5000 | 5000 | $data = array(); |
| 5001 | 5001 | |
| 5002 | 5002 | foreach ($columns as $c => $column) {
|
@@ -5007,20 +5007,20 @@ discard block |
||
| 5007 | 5007 | |
| 5008 | 5008 | if (empty($data['neighbourhood_name']) || empty($data['latitude']) || empty($data['longitude'])) {
|
| 5009 | 5009 | $invalid++; |
| 5010 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 5010 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood); |
|
| 5011 | 5011 | continue; |
| 5012 | 5012 | } |
| 5013 | 5013 | |
| 5014 | 5014 | $location_info = array(); |
| 5015 | - if (!empty($data['location_id']) && (int)$data['location_id'] > 0) {
|
|
| 5016 | - $location_info = geodir_get_location_by_id('', (int)$data['location_id']);
|
|
| 5015 | + if (!empty($data['location_id']) && (int) $data['location_id'] > 0) {
|
|
| 5016 | + $location_info = geodir_get_location_by_id('', (int) $data['location_id']);
|
|
| 5017 | 5017 | } else if (!empty($data['city']) && !empty($data['region']) && !empty($data['country'])) {
|
| 5018 | 5018 | $location_info = geodir_get_location_by_slug('city', array('fields' => 'location_id', 'city' => $data['city'], 'country' => $data['country'], 'region' => $data['region']));
|
| 5019 | 5019 | } |
| 5020 | 5020 | |
| 5021 | 5021 | if (empty($location_info)) {
|
| 5022 | 5022 | $invalid++; |
| 5023 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 5023 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood); |
|
| 5024 | 5024 | continue; |
| 5025 | 5025 | } |
| 5026 | 5026 | |
@@ -5035,35 +5035,35 @@ discard block |
||
| 5035 | 5035 | $hood_data['hood_longitude'] = $data['longitude']; |
| 5036 | 5036 | $hood_data['hood_location_id'] = $location_id; |
| 5037 | 5037 | |
| 5038 | - if ( $import_choice == 'update' ) {
|
|
| 5039 | - if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
|
|
| 5040 | - $hood_data['hood_id'] = (int)$data['neighbourhood_id']; |
|
| 5038 | + if ($import_choice == 'update') {
|
|
| 5039 | + if ((int) $data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int) $data['neighbourhood_id']))) {
|
|
| 5040 | + $hood_data['hood_id'] = (int) $data['neighbourhood_id']; |
|
| 5041 | 5041 | |
| 5042 | 5042 | if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
|
| 5043 | 5043 | $updated++; |
| 5044 | 5044 | } else {
|
| 5045 | 5045 | $invalid++; |
| 5046 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 5046 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood); |
|
| 5047 | 5047 | } |
| 5048 | 5048 | } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
|
| 5049 | - $hood_data['hood_id'] = (int)$neighbourhood->hood_id; |
|
| 5049 | + $hood_data['hood_id'] = (int) $neighbourhood->hood_id; |
|
| 5050 | 5050 | |
| 5051 | 5051 | if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
|
| 5052 | 5052 | $updated++; |
| 5053 | 5053 | } else {
|
| 5054 | 5054 | $invalid++; |
| 5055 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 5055 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood); |
|
| 5056 | 5056 | } |
| 5057 | 5057 | } else {
|
| 5058 | 5058 | if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
|
| 5059 | 5059 | $created++; |
| 5060 | 5060 | } else {
|
| 5061 | 5061 | $invalid++; |
| 5062 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 5062 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood); |
|
| 5063 | 5063 | } |
| 5064 | 5064 | } |
| 5065 | - } elseif ( $import_choice == 'skip' ) {
|
|
| 5066 | - if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
|
|
| 5065 | + } elseif ($import_choice == 'skip') {
|
|
| 5066 | + if ((int) $data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int) $data['neighbourhood_id']))) {
|
|
| 5067 | 5067 | $skipped++; |
| 5068 | 5068 | } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
|
| 5069 | 5069 | $skipped++; |
@@ -5073,12 +5073,12 @@ discard block |
||
| 5073 | 5073 | $created++; |
| 5074 | 5074 | } else {
|
| 5075 | 5075 | $invalid++; |
| 5076 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 5076 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood); |
|
| 5077 | 5077 | } |
| 5078 | 5078 | } |
| 5079 | 5079 | } else {
|
| 5080 | 5080 | $invalid++; |
| 5081 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 5081 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood); |
|
| 5082 | 5082 | } |
| 5083 | 5083 | } |
| 5084 | 5084 | } |
@@ -5092,7 +5092,7 @@ discard block |
||
| 5092 | 5092 | $json['invalid'] = $invalid; |
| 5093 | 5093 | $json['images'] = $images; |
| 5094 | 5094 | |
| 5095 | - wp_send_json( $json ); |
|
| 5095 | + wp_send_json($json); |
|
| 5096 | 5096 | } |
| 5097 | 5097 | } |
| 5098 | 5098 | break; |
@@ -5136,29 +5136,29 @@ discard block |
||
| 5136 | 5136 | * } |
| 5137 | 5137 | * @return int|bool Term id when success, false when fail. |
| 5138 | 5138 | */ |
| 5139 | -function geodir_imex_insert_term( $taxonomy, $term_data ) {
|
|
| 5140 | - if ( empty( $taxonomy ) || empty( $term_data ) ) {
|
|
| 5139 | +function geodir_imex_insert_term($taxonomy, $term_data) {
|
|
| 5140 | + if (empty($taxonomy) || empty($term_data)) {
|
|
| 5141 | 5141 | return false; |
| 5142 | 5142 | } |
| 5143 | 5143 | |
| 5144 | - $term = isset( $term_data['name'] ) && !empty( $term_data['name'] ) ? $term_data['name'] : ''; |
|
| 5144 | + $term = isset($term_data['name']) && !empty($term_data['name']) ? $term_data['name'] : ''; |
|
| 5145 | 5145 | $args = array(); |
| 5146 | - $args['description'] = isset( $term_data['description'] ) ? $term_data['description'] : ''; |
|
| 5147 | - $args['slug'] = isset( $term_data['slug'] ) ? $term_data['slug'] : ''; |
|
| 5148 | - $args['parent'] = isset( $term_data['parent'] ) ? (int)$term_data['parent'] : ''; |
|
| 5146 | + $args['description'] = isset($term_data['description']) ? $term_data['description'] : ''; |
|
| 5147 | + $args['slug'] = isset($term_data['slug']) ? $term_data['slug'] : ''; |
|
| 5148 | + $args['parent'] = isset($term_data['parent']) ? (int) $term_data['parent'] : ''; |
|
| 5149 | 5149 | |
| 5150 | - if ( ( !empty( $args['slug'] ) && term_exists( $args['slug'], $taxonomy ) ) || empty( $args['slug'] ) ) {
|
|
| 5151 | - $term_args = array_merge( $term_data, $args ); |
|
| 5152 | - $defaults = array( 'alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => ''); |
|
| 5153 | - $term_args = wp_parse_args( $term_args, $defaults ); |
|
| 5154 | - $term_args = sanitize_term( $term_args, $taxonomy, 'db' ); |
|
| 5155 | - $args['slug'] = wp_unique_term_slug( $args['slug'], (object)$term_args ); |
|
| 5150 | + if ((!empty($args['slug']) && term_exists($args['slug'], $taxonomy)) || empty($args['slug'])) {
|
|
| 5151 | + $term_args = array_merge($term_data, $args); |
|
| 5152 | + $defaults = array('alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '');
|
|
| 5153 | + $term_args = wp_parse_args($term_args, $defaults); |
|
| 5154 | + $term_args = sanitize_term($term_args, $taxonomy, 'db'); |
|
| 5155 | + $args['slug'] = wp_unique_term_slug($args['slug'], (object) $term_args); |
|
| 5156 | 5156 | } |
| 5157 | 5157 | |
| 5158 | - if( !empty( $term ) ) {
|
|
| 5159 | - $result = wp_insert_term( $term, $taxonomy, $args ); |
|
| 5160 | - if( !is_wp_error( $result ) ) {
|
|
| 5161 | - return isset( $result['term_id'] ) ? $result['term_id'] : 0; |
|
| 5158 | + if (!empty($term)) {
|
|
| 5159 | + $result = wp_insert_term($term, $taxonomy, $args); |
|
| 5160 | + if (!is_wp_error($result)) {
|
|
| 5161 | + return isset($result['term_id']) ? $result['term_id'] : 0; |
|
| 5162 | 5162 | } |
| 5163 | 5163 | } |
| 5164 | 5164 | |
@@ -5188,36 +5188,36 @@ discard block |
||
| 5188 | 5188 | * } |
| 5189 | 5189 | * @return int|bool Term id when success, false when fail. |
| 5190 | 5190 | */ |
| 5191 | -function geodir_imex_update_term( $taxonomy, $term_data ) {
|
|
| 5192 | - if ( empty( $taxonomy ) || empty( $term_data ) ) {
|
|
| 5191 | +function geodir_imex_update_term($taxonomy, $term_data) {
|
|
| 5192 | + if (empty($taxonomy) || empty($term_data)) {
|
|
| 5193 | 5193 | return false; |
| 5194 | 5194 | } |
| 5195 | 5195 | |
| 5196 | - $term_id = isset( $term_data['term_id'] ) && !empty( $term_data['term_id'] ) ? $term_data['term_id'] : 0; |
|
| 5196 | + $term_id = isset($term_data['term_id']) && !empty($term_data['term_id']) ? $term_data['term_id'] : 0; |
|
| 5197 | 5197 | |
| 5198 | 5198 | $args = array(); |
| 5199 | - $args['description'] = isset( $term_data['description'] ) ? $term_data['description'] : ''; |
|
| 5200 | - $args['slug'] = isset( $term_data['slug'] ) ? $term_data['slug'] : ''; |
|
| 5201 | - $args['parent'] = isset( $term_data['parent'] ) ? (int)$term_data['parent'] : ''; |
|
| 5199 | + $args['description'] = isset($term_data['description']) ? $term_data['description'] : ''; |
|
| 5200 | + $args['slug'] = isset($term_data['slug']) ? $term_data['slug'] : ''; |
|
| 5201 | + $args['parent'] = isset($term_data['parent']) ? (int) $term_data['parent'] : ''; |
|
| 5202 | 5202 | |
| 5203 | - if ( $term_id > 0 && $term_info = (array)get_term( $term_id, $taxonomy ) ) {
|
|
| 5203 | + if ($term_id > 0 && $term_info = (array) get_term($term_id, $taxonomy)) {
|
|
| 5204 | 5204 | $term_data['term_id'] = $term_info['term_id']; |
| 5205 | 5205 | |
| 5206 | - $result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data ); |
|
| 5206 | + $result = wp_update_term($term_data['term_id'], $taxonomy, $term_data); |
|
| 5207 | 5207 | |
| 5208 | - if( !is_wp_error( $result ) ) {
|
|
| 5209 | - return isset( $result['term_id'] ) ? $result['term_id'] : 0; |
|
| 5208 | + if (!is_wp_error($result)) {
|
|
| 5209 | + return isset($result['term_id']) ? $result['term_id'] : 0; |
|
| 5210 | 5210 | } |
| 5211 | - } else if ( $term_data['slug'] != '' && $term_info = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
|
|
| 5211 | + } else if ($term_data['slug'] != '' && $term_info = (array) term_exists($term_data['slug'], $taxonomy)) {
|
|
| 5212 | 5212 | $term_data['term_id'] = $term_info['term_id']; |
| 5213 | 5213 | |
| 5214 | - $result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data ); |
|
| 5214 | + $result = wp_update_term($term_data['term_id'], $taxonomy, $term_data); |
|
| 5215 | 5215 | |
| 5216 | - if( !is_wp_error( $result ) ) {
|
|
| 5217 | - return isset( $result['term_id'] ) ? $result['term_id'] : 0; |
|
| 5216 | + if (!is_wp_error($result)) {
|
|
| 5217 | + return isset($result['term_id']) ? $result['term_id'] : 0; |
|
| 5218 | 5218 | } |
| 5219 | 5219 | } else {
|
| 5220 | - return geodir_imex_insert_term( $taxonomy, $term_data ); |
|
| 5220 | + return geodir_imex_insert_term($taxonomy, $term_data); |
|
| 5221 | 5221 | } |
| 5222 | 5222 | |
| 5223 | 5223 | return false; |
@@ -5235,25 +5235,25 @@ discard block |
||
| 5235 | 5235 | * @param string $post_type Post type. |
| 5236 | 5236 | * @return int Posts count. |
| 5237 | 5237 | */ |
| 5238 | -function geodir_get_posts_count( $post_type ) {
|
|
| 5238 | +function geodir_get_posts_count($post_type) {
|
|
| 5239 | 5239 | global $wpdb, $plugin_prefix; |
| 5240 | 5240 | |
| 5241 | - if ( !post_type_exists( $post_type ) ) {
|
|
| 5241 | + if (!post_type_exists($post_type)) {
|
|
| 5242 | 5242 | return 0; |
| 5243 | 5243 | } |
| 5244 | 5244 | |
| 5245 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 5245 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 5246 | 5246 | |
| 5247 | 5247 | // Skip listing with statuses trash, auto-draft etc... |
| 5248 | 5248 | $skip_statuses = geodir_imex_export_skip_statuses(); |
| 5249 | 5249 | $where_statuses = ''; |
| 5250 | - if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
|
|
| 5251 | - $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
|
|
| 5250 | + if (!empty($skip_statuses) && is_array($skip_statuses)) {
|
|
| 5251 | + $where_statuses = "AND `".$wpdb->posts."`.`post_status` NOT IN('".implode("','", $skip_statuses)."')";
|
|
| 5252 | 5252 | } |
| 5253 | 5253 | |
| 5254 | - $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 );
|
|
| 5254 | + $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);
|
|
| 5255 | 5255 | |
| 5256 | - $posts_count = (int)$wpdb->get_var( $query ); |
|
| 5256 | + $posts_count = (int) $wpdb->get_var($query); |
|
| 5257 | 5257 | |
| 5258 | 5258 | /** |
| 5259 | 5259 | * Modify returned post counts for the current post type. |
@@ -5264,7 +5264,7 @@ discard block |
||
| 5264 | 5264 | * @param int $posts_count Post counts. |
| 5265 | 5265 | * @param string $post_type Post type. |
| 5266 | 5266 | */ |
| 5267 | - $posts_count = apply_filters( 'geodir_imex_count_posts', $posts_count, $post_type ); |
|
| 5267 | + $posts_count = apply_filters('geodir_imex_count_posts', $posts_count, $post_type);
|
|
| 5268 | 5268 | |
| 5269 | 5269 | return $posts_count; |
| 5270 | 5270 | } |
@@ -5285,17 +5285,17 @@ discard block |
||
| 5285 | 5285 | * @param int $page_no Page number. Default 0. |
| 5286 | 5286 | * @return array Array of posts data. |
| 5287 | 5287 | */ |
| 5288 | -function geodir_imex_get_posts( $post_type, $per_page = 0, $page_no = 0 ) {
|
|
| 5288 | +function geodir_imex_get_posts($post_type, $per_page = 0, $page_no = 0) {
|
|
| 5289 | 5289 | global $wp_filesystem; |
| 5290 | 5290 | |
| 5291 | - $posts = geodir_get_export_posts( $post_type, $per_page, $page_no ); |
|
| 5291 | + $posts = geodir_get_export_posts($post_type, $per_page, $page_no); |
|
| 5292 | 5292 | |
| 5293 | 5293 | $csv_rows = array(); |
| 5294 | 5294 | |
| 5295 | - if ( !empty( $posts ) ) {
|
|
| 5296 | - $is_payment_plugin = is_plugin_active( 'geodir_payment_manager/geodir_payment_manager.php' ); |
|
| 5295 | + if (!empty($posts)) {
|
|
| 5296 | + $is_payment_plugin = is_plugin_active('geodir_payment_manager/geodir_payment_manager.php');
|
|
| 5297 | 5297 | $location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
|
| 5298 | - $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true; |
|
| 5298 | + $location_allowed = function_exists('geodir_cpt_no_location') && geodir_cpt_no_location($post_type) ? false : true;
|
|
| 5299 | 5299 | $neighbourhood_active = $location_manager && $location_allowed && get_option('location_neighbourhoods') ? true : false;
|
| 5300 | 5300 | |
| 5301 | 5301 | $csv_row = array(); |
@@ -5307,7 +5307,7 @@ discard block |
||
| 5307 | 5307 | $csv_row[] = 'default_category'; |
| 5308 | 5308 | $csv_row[] = 'post_tags'; |
| 5309 | 5309 | $csv_row[] = 'post_type'; |
| 5310 | - if ( $post_type == 'gd_event' ) {
|
|
| 5310 | + if ($post_type == 'gd_event') {
|
|
| 5311 | 5311 | $csv_row[] = 'event_date'; |
| 5312 | 5312 | $csv_row[] = 'event_enddate'; |
| 5313 | 5313 | $csv_row[] = 'starttime'; |
@@ -5361,15 +5361,15 @@ discard block |
||
| 5361 | 5361 | } |
| 5362 | 5362 | // WPML |
| 5363 | 5363 | |
| 5364 | - $custom_fields = geodir_imex_get_custom_fields( $post_type ); |
|
| 5365 | - if ( !empty( $custom_fields ) ) {
|
|
| 5366 | - foreach ( $custom_fields as $custom_field ) {
|
|
| 5364 | + $custom_fields = geodir_imex_get_custom_fields($post_type); |
|
| 5365 | + if (!empty($custom_fields)) {
|
|
| 5366 | + foreach ($custom_fields as $custom_field) {
|
|
| 5367 | 5367 | $csv_row[] = $custom_field->htmlvar_name; |
| 5368 | 5368 | } |
| 5369 | 5369 | } |
| 5370 | 5370 | |
| 5371 | 5371 | // Export franchise fields |
| 5372 | - $is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false; |
|
| 5372 | + $is_franchise_active = is_plugin_active('geodir_franchise/geodir_franchise.php') && geodir_franchise_enabled($post_type) ? true : false;
|
|
| 5373 | 5373 | if ($is_franchise_active) {
|
| 5374 | 5374 | $csv_row[] = 'gd_is_franchise'; |
| 5375 | 5375 | $csv_row[] = 'gd_franchise_lock'; |
@@ -5379,28 +5379,28 @@ discard block |
||
| 5379 | 5379 | $csv_rows[] = $csv_row; |
| 5380 | 5380 | |
| 5381 | 5381 | $images_count = 5; |
| 5382 | - $xx=0; |
|
| 5383 | - foreach ( $posts as $post ) {$xx++;
|
|
| 5382 | + $xx = 0; |
|
| 5383 | + foreach ($posts as $post) {$xx++;
|
|
| 5384 | 5384 | $post_id = $post['ID']; |
| 5385 | 5385 | |
| 5386 | - $gd_post_info = geodir_get_post_info( $post_id ); |
|
| 5387 | - $post_info = (array)$gd_post_info; |
|
| 5386 | + $gd_post_info = geodir_get_post_info($post_id); |
|
| 5387 | + $post_info = (array) $gd_post_info; |
|
| 5388 | 5388 | |
| 5389 | - $taxonomy_category = $post_type . 'category'; |
|
| 5390 | - $taxonomy_tags = $post_type . '_tags'; |
|
| 5389 | + $taxonomy_category = $post_type.'category'; |
|
| 5390 | + $taxonomy_tags = $post_type.'_tags'; |
|
| 5391 | 5391 | |
| 5392 | 5392 | $post_category = ''; |
| 5393 | 5393 | $default_category_id = $gd_post_info->default_category; |
| 5394 | 5394 | $default_category = ''; |
| 5395 | 5395 | $post_tags = ''; |
| 5396 | - $terms = wp_get_post_terms( $post_id, array( $taxonomy_category, $taxonomy_tags ) ); |
|
| 5396 | + $terms = wp_get_post_terms($post_id, array($taxonomy_category, $taxonomy_tags)); |
|
| 5397 | 5397 | |
| 5398 | - if ( !empty( $terms ) && !is_wp_error( $terms ) ) {
|
|
| 5398 | + if (!empty($terms) && !is_wp_error($terms)) {
|
|
| 5399 | 5399 | $post_category = array(); |
| 5400 | 5400 | $post_tags = array(); |
| 5401 | 5401 | |
| 5402 | - foreach ( $terms as $term ) {
|
|
| 5403 | - if ( $term->taxonomy == $taxonomy_category ) {
|
|
| 5402 | + foreach ($terms as $term) {
|
|
| 5403 | + if ($term->taxonomy == $taxonomy_category) {
|
|
| 5404 | 5404 | $post_category[] = $term->name; |
| 5405 | 5405 | |
| 5406 | 5406 | if ($default_category_id == $term->term_id) {
|
@@ -5408,7 +5408,7 @@ discard block |
||
| 5408 | 5408 | } |
| 5409 | 5409 | } |
| 5410 | 5410 | |
| 5411 | - if ( $term->taxonomy == $taxonomy_tags ) {
|
|
| 5411 | + if ($term->taxonomy == $taxonomy_tags) {
|
|
| 5412 | 5412 | $post_tags[] = $term->name; |
| 5413 | 5413 | } |
| 5414 | 5414 | } |
@@ -5416,47 +5416,47 @@ discard block |
||
| 5416 | 5416 | if (empty($default_category) && !empty($post_category)) {
|
| 5417 | 5417 | $default_category = $post_category[0]; // Set first one as default category. |
| 5418 | 5418 | } |
| 5419 | - $post_category = !empty( $post_category ) ? implode( ',', $post_category ) : ''; |
|
| 5420 | - $post_tags = !empty( $post_tags ) ? implode( ',', $post_tags ) : ''; |
|
| 5419 | + $post_category = !empty($post_category) ? implode(',', $post_category) : '';
|
|
| 5420 | + $post_tags = !empty($post_tags) ? implode(',', $post_tags) : '';
|
|
| 5421 | 5421 | } |
| 5422 | 5422 | |
| 5423 | 5423 | // Franchise data |
| 5424 | - if ($is_franchise_active && isset($post_info['franchise']) && (int)$post_info['franchise'] > 0 && geodir_franchise_check((int)$post_info['franchise'])) {
|
|
| 5424 | + if ($is_franchise_active && isset($post_info['franchise']) && (int) $post_info['franchise'] > 0 && geodir_franchise_check((int) $post_info['franchise'])) {
|
|
| 5425 | 5425 | $franchise_id = $post_info['franchise']; |
| 5426 | 5426 | $gd_franchise_info = geodir_get_post_info($franchise_id); |
| 5427 | 5427 | |
| 5428 | 5428 | if (geodir_franchise_pkg_is_active($gd_franchise_info)) {
|
| 5429 | - $franchise_info = (array)$gd_franchise_info; |
|
| 5429 | + $franchise_info = (array) $gd_franchise_info; |
|
| 5430 | 5430 | $locked_fields = geodir_franchise_get_locked_fields($franchise_id, true); |
| 5431 | 5431 | |
| 5432 | 5432 | if (!empty($locked_fields)) {
|
| 5433 | - foreach( $locked_fields as $locked_field) {
|
|
| 5433 | + foreach ($locked_fields as $locked_field) {
|
|
| 5434 | 5434 | if (isset($post_info[$locked_field]) && isset($franchise_info[$locked_field])) {
|
| 5435 | 5435 | $post_info[$locked_field] = $franchise_info[$locked_field]; |
| 5436 | 5436 | } |
| 5437 | 5437 | |
| 5438 | 5438 | if (in_array($taxonomy_category, $locked_fields) || in_array('post_tags', $locked_fields)) {
|
| 5439 | - $franchise_terms = wp_get_post_terms( $franchise_id, array( $taxonomy_category, $taxonomy_tags ) ); |
|
| 5439 | + $franchise_terms = wp_get_post_terms($franchise_id, array($taxonomy_category, $taxonomy_tags)); |
|
| 5440 | 5440 | |
| 5441 | - if ( !empty( $franchise_terms ) && !is_wp_error( $franchise_terms ) ) {
|
|
| 5441 | + if (!empty($franchise_terms) && !is_wp_error($franchise_terms)) {
|
|
| 5442 | 5442 | $franchise_post_category = array(); |
| 5443 | 5443 | $franchise_post_tags = array(); |
| 5444 | 5444 | |
| 5445 | - foreach ( $franchise_terms as $franchise_term ) {
|
|
| 5446 | - if ( $franchise_term->taxonomy == $taxonomy_category ) {
|
|
| 5445 | + foreach ($franchise_terms as $franchise_term) {
|
|
| 5446 | + if ($franchise_term->taxonomy == $taxonomy_category) {
|
|
| 5447 | 5447 | $franchise_post_category[] = $franchise_term->name; |
| 5448 | 5448 | } |
| 5449 | 5449 | |
| 5450 | - if ( $franchise_term->taxonomy == $taxonomy_tags ) {
|
|
| 5450 | + if ($franchise_term->taxonomy == $taxonomy_tags) {
|
|
| 5451 | 5451 | $franchise_post_tags[] = $franchise_term->name; |
| 5452 | 5452 | } |
| 5453 | 5453 | } |
| 5454 | 5454 | |
| 5455 | 5455 | if (in_array($taxonomy_category, $locked_fields)) {
|
| 5456 | - $post_category = !empty( $franchise_post_category ) ? implode( ',', $franchise_post_category ) : ''; |
|
| 5456 | + $post_category = !empty($franchise_post_category) ? implode(',', $franchise_post_category) : '';
|
|
| 5457 | 5457 | } |
| 5458 | 5458 | if (in_array('post_tags', $locked_fields)) {
|
| 5459 | - $post_tags = !empty( $franchise_post_tags ) ? implode( ',', $franchise_post_tags ) : ''; |
|
| 5459 | + $post_tags = !empty($franchise_post_tags) ? implode(',', $franchise_post_tags) : '';
|
|
| 5460 | 5460 | } |
| 5461 | 5461 | } |
| 5462 | 5462 | } |
@@ -5465,18 +5465,18 @@ discard block |
||
| 5465 | 5465 | } |
| 5466 | 5466 | } |
| 5467 | 5467 | |
| 5468 | - $post_images = geodir_get_images( $post_id ); |
|
| 5468 | + $post_images = geodir_get_images($post_id); |
|
| 5469 | 5469 | $current_images = array(); |
| 5470 | - if ( !empty( $post_images ) ) {
|
|
| 5471 | - foreach ( $post_images as $post_image ) {
|
|
| 5472 | - $post_image = (array)$post_image; |
|
| 5473 | - $image = !empty( $post_image ) && isset( $post_image['path'] ) && $wp_filesystem->is_file( $post_image['path'] ) && $wp_filesystem->exists( $post_image['path'] ) ? $post_image['src'] : ''; |
|
| 5474 | - if ( $image ) {
|
|
| 5470 | + if (!empty($post_images)) {
|
|
| 5471 | + foreach ($post_images as $post_image) {
|
|
| 5472 | + $post_image = (array) $post_image; |
|
| 5473 | + $image = !empty($post_image) && isset($post_image['path']) && $wp_filesystem->is_file($post_image['path']) && $wp_filesystem->exists($post_image['path']) ? $post_image['src'] : ''; |
|
| 5474 | + if ($image) {
|
|
| 5475 | 5475 | $current_images[] = $image; |
| 5476 | 5476 | } |
| 5477 | 5477 | } |
| 5478 | 5478 | |
| 5479 | - $images_count = max( $images_count, count( $current_images ) ); |
|
| 5479 | + $images_count = max($images_count, count($current_images)); |
|
| 5480 | 5480 | } |
| 5481 | 5481 | |
| 5482 | 5482 | $csv_row = array(); |
@@ -5488,7 +5488,7 @@ discard block |
||
| 5488 | 5488 | $csv_row[] = $default_category; // default_category |
| 5489 | 5489 | $csv_row[] = $post_tags; // post_tags |
| 5490 | 5490 | $csv_row[] = $post_type; // post_type |
| 5491 | - if ( $post_type == 'gd_event' ) {
|
|
| 5491 | + if ($post_type == 'gd_event') {
|
|
| 5492 | 5492 | $event_data = geodir_imex_get_event_data($post, $gd_post_info); |
| 5493 | 5493 | $csv_row[] = $event_data['event_date']; // event_date |
| 5494 | 5494 | $csv_row[] = $event_data['event_enddate']; // enddate |
@@ -5509,9 +5509,9 @@ discard block |
||
| 5509 | 5509 | $csv_row[] = $event_data['recurring_end_date']; // repeat_end |
| 5510 | 5510 | } |
| 5511 | 5511 | $csv_row[] = $post_info['post_status']; // post_status |
| 5512 | - $csv_row[] = (int)$post_info['is_featured'] == 1 ? 1 : ''; // is_featured |
|
| 5512 | + $csv_row[] = (int) $post_info['is_featured'] == 1 ? 1 : ''; // is_featured |
|
| 5513 | 5513 | if ($is_payment_plugin) {
|
| 5514 | - $csv_row[] = (int)$post_info['package_id']; // package_id |
|
| 5514 | + $csv_row[] = (int) $post_info['package_id']; // package_id |
|
| 5515 | 5515 | $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
|
| 5516 | 5516 | } |
| 5517 | 5517 | $csv_row[] = $post_info['geodir_video']; // geodir_video |
@@ -5547,14 +5547,14 @@ discard block |
||
| 5547 | 5547 | $csv_row[] = $post_info['geodir_special_offers']; // geodir_special_offers |
| 5548 | 5548 | // WPML |
| 5549 | 5549 | if ($is_wpml) {
|
| 5550 | - $csv_row[] = geodir_get_language_for_element( $post_id, 'post_' . $post_type ); |
|
| 5551 | - $csv_row[] = geodir_imex_original_post_id( $post_id, 'post_' . $post_type ); |
|
| 5550 | + $csv_row[] = geodir_get_language_for_element($post_id, 'post_'.$post_type); |
|
| 5551 | + $csv_row[] = geodir_imex_original_post_id($post_id, 'post_'.$post_type); |
|
| 5552 | 5552 | } |
| 5553 | 5553 | // WPML |
| 5554 | 5554 | |
| 5555 | - if ( !empty( $custom_fields ) ) {
|
|
| 5556 | - foreach ( $custom_fields as $custom_field ) {
|
|
| 5557 | - $csv_row[] = isset( $post_info[$custom_field->htmlvar_name] ) ? $post_info[$custom_field->htmlvar_name] : ''; |
|
| 5555 | + if (!empty($custom_fields)) {
|
|
| 5556 | + foreach ($custom_fields as $custom_field) {
|
|
| 5557 | + $csv_row[] = isset($post_info[$custom_field->htmlvar_name]) ? $post_info[$custom_field->htmlvar_name] : ''; |
|
| 5558 | 5558 | } |
| 5559 | 5559 | } |
| 5560 | 5560 | |
@@ -5565,26 +5565,26 @@ discard block |
||
| 5565 | 5565 | $franchise = ''; |
| 5566 | 5566 | |
| 5567 | 5567 | if (geodir_franchise_pkg_is_active($gd_post_info)) {
|
| 5568 | - $gd_is_franchise = (int)get_post_meta( $post_id, 'gd_is_franchise', true ); |
|
| 5569 | - $locaked_fields = $gd_is_franchise ? get_post_meta( $post_id, 'gd_franchise_lock', true ) : ''; |
|
| 5568 | + $gd_is_franchise = (int) get_post_meta($post_id, 'gd_is_franchise', true); |
|
| 5569 | + $locaked_fields = $gd_is_franchise ? get_post_meta($post_id, 'gd_franchise_lock', true) : ''; |
|
| 5570 | 5570 | $locaked_fields = (is_array($locaked_fields) && !empty($locaked_fields) ? implode(",", $locaked_fields) : '');
|
| 5571 | - $franchise = !$gd_is_franchise && isset($post_info['franchise']) && (int)$post_info['franchise'] > 0 ? (int)$post_info['franchise'] : 0; // franchise id |
|
| 5571 | + $franchise = !$gd_is_franchise && isset($post_info['franchise']) && (int) $post_info['franchise'] > 0 ? (int) $post_info['franchise'] : 0; // franchise id |
|
| 5572 | 5572 | } |
| 5573 | 5573 | |
| 5574 | - $csv_row[] = (int)$gd_is_franchise; // gd_is_franchise |
|
| 5574 | + $csv_row[] = (int) $gd_is_franchise; // gd_is_franchise |
|
| 5575 | 5575 | $csv_row[] = $locaked_fields; // gd_franchise_lock fields |
| 5576 | - $csv_row[] = (int)$franchise; // franchise id |
|
| 5576 | + $csv_row[] = (int) $franchise; // franchise id |
|
| 5577 | 5577 | } |
| 5578 | 5578 | |
| 5579 | - for ( $c = 0; $c < $images_count; $c++ ) {
|
|
| 5580 | - $csv_row[] = isset( $current_images[$c] ) ? $current_images[$c] : ''; // IMAGE |
|
| 5579 | + for ($c = 0; $c < $images_count; $c++) {
|
|
| 5580 | + $csv_row[] = isset($current_images[$c]) ? $current_images[$c] : ''; // IMAGE |
|
| 5581 | 5581 | } |
| 5582 | 5582 | |
| 5583 | 5583 | $csv_rows[] = $csv_row; |
| 5584 | 5584 | |
| 5585 | 5585 | } |
| 5586 | 5586 | |
| 5587 | - for ( $c = 0; $c < $images_count; $c++ ) {
|
|
| 5587 | + for ($c = 0; $c < $images_count; $c++) {
|
|
| 5588 | 5588 | $csv_rows[0][] = 'IMAGE'; |
| 5589 | 5589 | } |
| 5590 | 5590 | } |
@@ -5606,33 +5606,33 @@ discard block |
||
| 5606 | 5606 | * @param int $page_no Page number. Default 0. |
| 5607 | 5607 | * @return array Array of posts data. |
| 5608 | 5608 | */ |
| 5609 | -function geodir_get_export_posts( $post_type, $per_page = 0, $page_no = 0 ) {
|
|
| 5609 | +function geodir_get_export_posts($post_type, $per_page = 0, $page_no = 0) {
|
|
| 5610 | 5610 | global $wpdb, $plugin_prefix; |
| 5611 | 5611 | |
| 5612 | - if ( ! post_type_exists( $post_type ) ) |
|
| 5612 | + if (!post_type_exists($post_type)) |
|
| 5613 | 5613 | return new stdClass; |
| 5614 | 5614 | |
| 5615 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 5615 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 5616 | 5616 | |
| 5617 | 5617 | $limit = ''; |
| 5618 | - if ( $per_page > 0 && $page_no > 0 ) {
|
|
| 5619 | - $offset = ( $page_no - 1 ) * $per_page; |
|
| 5618 | + if ($per_page > 0 && $page_no > 0) {
|
|
| 5619 | + $offset = ($page_no - 1) * $per_page; |
|
| 5620 | 5620 | |
| 5621 | - if ( $offset > 0 ) {
|
|
| 5622 | - $limit = " LIMIT " . $offset . "," . $per_page; |
|
| 5621 | + if ($offset > 0) {
|
|
| 5622 | + $limit = " LIMIT ".$offset.",".$per_page; |
|
| 5623 | 5623 | } else {
|
| 5624 | - $limit = " LIMIT " . $per_page; |
|
| 5624 | + $limit = " LIMIT ".$per_page; |
|
| 5625 | 5625 | } |
| 5626 | 5626 | } |
| 5627 | 5627 | |
| 5628 | 5628 | // Skip listing with statuses trash, auto-draft etc... |
| 5629 | 5629 | $skip_statuses = geodir_imex_export_skip_statuses(); |
| 5630 | 5630 | $where_statuses = ''; |
| 5631 | - if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
|
|
| 5632 | - $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
|
|
| 5631 | + if (!empty($skip_statuses) && is_array($skip_statuses)) {
|
|
| 5632 | + $where_statuses = "AND `".$wpdb->posts."`.`post_status` NOT IN('".implode("','", $skip_statuses)."')";
|
|
| 5633 | 5633 | } |
| 5634 | 5634 | |
| 5635 | - $query = "SELECT {$wpdb->posts}.ID FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s " . $where_statuses . " ORDER BY {$wpdb->posts}.ID ASC" . $limit;
|
|
| 5635 | + $query = "SELECT {$wpdb->posts}.ID FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s ".$where_statuses." ORDER BY {$wpdb->posts}.ID ASC".$limit;
|
|
| 5636 | 5636 | /** |
| 5637 | 5637 | * Modify returned posts SQL query for the current post type. |
| 5638 | 5638 | * |
@@ -5642,9 +5642,9 @@ discard block |
||
| 5642 | 5642 | * @param int $query The SQL query. |
| 5643 | 5643 | * @param string $post_type Post type. |
| 5644 | 5644 | */ |
| 5645 | - $query = apply_filters( 'geodir_imex_export_posts_query', $query, $post_type ); |
|
| 5645 | + $query = apply_filters('geodir_imex_export_posts_query', $query, $post_type);
|
|
| 5646 | 5646 | |
| 5647 | - $results = (array)$wpdb->get_results( $wpdb->prepare( $query, $post_type ), ARRAY_A ); |
|
| 5647 | + $results = (array) $wpdb->get_results($wpdb->prepare($query, $post_type), ARRAY_A); |
|
| 5648 | 5648 | |
| 5649 | 5649 | /** |
| 5650 | 5650 | * Modify returned post results for the current post type. |
@@ -5655,7 +5655,7 @@ discard block |
||
| 5655 | 5655 | * @param object $results An object containing all post ids. |
| 5656 | 5656 | * @param string $post_type Post type. |
| 5657 | 5657 | */ |
| 5658 | - return apply_filters( 'geodir_export_posts', $results, $post_type ); |
|
| 5658 | + return apply_filters('geodir_export_posts', $results, $post_type);
|
|
| 5659 | 5659 | } |
| 5660 | 5660 | |
| 5661 | 5661 | /** |
@@ -5672,21 +5672,21 @@ discard block |
||
| 5672 | 5672 | * @param string $post_type Post type. |
| 5673 | 5673 | * @return string The SQL query. |
| 5674 | 5674 | */ |
| 5675 | -function geodir_imex_get_events_query( $query, $post_type ) {
|
|
| 5676 | - if ( $post_type == 'gd_event' ) {
|
|
| 5675 | +function geodir_imex_get_events_query($query, $post_type) {
|
|
| 5676 | + if ($post_type == 'gd_event') {
|
|
| 5677 | 5677 | global $wpdb, $plugin_prefix; |
| 5678 | 5678 | |
| 5679 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 5679 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 5680 | 5680 | $schedule_table = EVENT_SCHEDULE; |
| 5681 | 5681 | |
| 5682 | 5682 | // Skip listing with statuses trash, auto-draft etc... |
| 5683 | 5683 | $skip_statuses = geodir_imex_export_skip_statuses(); |
| 5684 | 5684 | $where_statuses = ''; |
| 5685 | - if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
|
|
| 5686 | - $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
|
|
| 5685 | + if (!empty($skip_statuses) && is_array($skip_statuses)) {
|
|
| 5686 | + $where_statuses = "AND `".$wpdb->posts."`.`post_status` NOT IN('".implode("','", $skip_statuses)."')";
|
|
| 5687 | 5687 | } |
| 5688 | 5688 | |
| 5689 | - $query = "SELECT {$wpdb->posts}.ID, {$schedule_table}.event_date, {$schedule_table}.event_enddate AS enddate, {$schedule_table}.event_starttime AS starttime, {$schedule_table}.event_endtime AS endtime FROM {$wpdb->posts} INNER JOIN {$table} ON ({$table}.post_id = {$wpdb->posts}.ID) INNER JOIN {$schedule_table} ON ({$schedule_table}.event_id = {$wpdb->posts}.ID) WHERE {$wpdb->posts}.post_type = %s " . $where_statuses . " GROUP BY {$table}.post_id ORDER BY {$wpdb->posts}.ID ASC, {$schedule_table}.schedule_id ASC";
|
|
| 5689 | + $query = "SELECT {$wpdb->posts}.ID, {$schedule_table}.event_date, {$schedule_table}.event_enddate AS enddate, {$schedule_table}.event_starttime AS starttime, {$schedule_table}.event_endtime AS endtime FROM {$wpdb->posts} INNER JOIN {$table} ON ({$table}.post_id = {$wpdb->posts}.ID) INNER JOIN {$schedule_table} ON ({$schedule_table}.event_id = {$wpdb->posts}.ID) WHERE {$wpdb->posts}.post_type = %s ".$where_statuses." GROUP BY {$table}.post_id ORDER BY {$wpdb->posts}.ID ASC, {$schedule_table}.schedule_id ASC";
|
|
| 5690 | 5690 | } |
| 5691 | 5691 | |
| 5692 | 5692 | return $query; |
@@ -5710,35 +5710,35 @@ discard block |
||
| 5710 | 5710 | * @param string $post_type Post type. |
| 5711 | 5711 | * @return int Total terms count. |
| 5712 | 5712 | */ |
| 5713 | -function geodir_get_terms_count( $post_type ) {
|
|
| 5714 | - $args = array( 'hide_empty' => 0 ); |
|
| 5713 | +function geodir_get_terms_count($post_type) {
|
|
| 5714 | + $args = array('hide_empty' => 0);
|
|
| 5715 | 5715 | |
| 5716 | - remove_all_filters( 'get_terms' ); |
|
| 5716 | + remove_all_filters('get_terms');
|
|
| 5717 | 5717 | |
| 5718 | - $taxonomy = $post_type . 'category'; |
|
| 5718 | + $taxonomy = $post_type.'category'; |
|
| 5719 | 5719 | |
| 5720 | 5720 | // WPML |
| 5721 | 5721 | $is_wpml = geodir_is_wpml(); |
| 5722 | 5722 | $active_lang = 'all'; |
| 5723 | - if ( $is_wpml ) {
|
|
| 5723 | + if ($is_wpml) {
|
|
| 5724 | 5724 | global $sitepress; |
| 5725 | 5725 | $active_lang = $sitepress->get_current_language(); |
| 5726 | 5726 | |
| 5727 | - if ( $active_lang != 'all' ) {
|
|
| 5728 | - $sitepress->switch_lang( 'all', true ); |
|
| 5727 | + if ($active_lang != 'all') {
|
|
| 5728 | + $sitepress->switch_lang('all', true);
|
|
| 5729 | 5729 | } |
| 5730 | 5730 | } |
| 5731 | 5731 | // WPML |
| 5732 | 5732 | |
| 5733 | - $count_terms = wp_count_terms( $taxonomy, $args ); |
|
| 5733 | + $count_terms = wp_count_terms($taxonomy, $args); |
|
| 5734 | 5734 | |
| 5735 | 5735 | // WPML |
| 5736 | - if ( $is_wpml && $active_lang !== 'all' ) {
|
|
| 5736 | + if ($is_wpml && $active_lang !== 'all') {
|
|
| 5737 | 5737 | global $sitepress; |
| 5738 | - $sitepress->switch_lang( $active_lang, true ); |
|
| 5738 | + $sitepress->switch_lang($active_lang, true); |
|
| 5739 | 5739 | } |
| 5740 | 5740 | // WPML |
| 5741 | - $count_terms = !is_wp_error( $count_terms ) ? $count_terms : 0; |
|
| 5741 | + $count_terms = !is_wp_error($count_terms) ? $count_terms : 0; |
|
| 5742 | 5742 | |
| 5743 | 5743 | return $count_terms; |
| 5744 | 5744 | } |
@@ -5755,23 +5755,23 @@ discard block |
||
| 5755 | 5755 | * @param int $page_no Page number. Default 0. |
| 5756 | 5756 | * @return array Array of terms data. |
| 5757 | 5757 | */ |
| 5758 | -function geodir_imex_get_terms( $post_type, $per_page = 0, $page_no = 0 ) {
|
|
| 5759 | - $args = array( 'hide_empty' => 0, 'orderby' => 'id' ); |
|
| 5758 | +function geodir_imex_get_terms($post_type, $per_page = 0, $page_no = 0) {
|
|
| 5759 | + $args = array('hide_empty' => 0, 'orderby' => 'id');
|
|
| 5760 | 5760 | |
| 5761 | - remove_all_filters( 'get_terms' ); |
|
| 5761 | + remove_all_filters('get_terms');
|
|
| 5762 | 5762 | |
| 5763 | - $taxonomy = $post_type . 'category'; |
|
| 5763 | + $taxonomy = $post_type.'category'; |
|
| 5764 | 5764 | |
| 5765 | - if ( $per_page > 0 && $page_no > 0 ) {
|
|
| 5766 | - $args['offset'] = ( $page_no - 1 ) * $per_page; |
|
| 5765 | + if ($per_page > 0 && $page_no > 0) {
|
|
| 5766 | + $args['offset'] = ($page_no - 1) * $per_page; |
|
| 5767 | 5767 | $args['number'] = $per_page; |
| 5768 | 5768 | } |
| 5769 | 5769 | |
| 5770 | - $terms = get_terms( $taxonomy, $args ); |
|
| 5770 | + $terms = get_terms($taxonomy, $args); |
|
| 5771 | 5771 | |
| 5772 | 5772 | $csv_rows = array(); |
| 5773 | 5773 | |
| 5774 | - if ( !empty( $terms ) ) {
|
|
| 5774 | + if (!empty($terms)) {
|
|
| 5775 | 5775 | $csv_row = array(); |
| 5776 | 5776 | $csv_row[] = 'cat_id'; |
| 5777 | 5777 | $csv_row[] = 'cat_name'; |
@@ -5793,16 +5793,16 @@ discard block |
||
| 5793 | 5793 | |
| 5794 | 5794 | $csv_rows[] = $csv_row; |
| 5795 | 5795 | |
| 5796 | - foreach ( $terms as $term ) {
|
|
| 5797 | - $cat_icon = get_tax_meta( $term->term_id, 'ct_cat_icon', false, $post_type ); |
|
| 5798 | - $cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : ''; |
|
| 5796 | + foreach ($terms as $term) {
|
|
| 5797 | + $cat_icon = get_tax_meta($term->term_id, 'ct_cat_icon', false, $post_type); |
|
| 5798 | + $cat_icon = !empty($cat_icon) && isset($cat_icon['src']) ? $cat_icon['src'] : ''; |
|
| 5799 | 5799 | |
| 5800 | - $cat_image = geodir_get_default_catimage( $term->term_id, $post_type ); |
|
| 5801 | - $cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : ''; |
|
| 5800 | + $cat_image = geodir_get_default_catimage($term->term_id, $post_type); |
|
| 5801 | + $cat_image = !empty($cat_image) && isset($cat_image['src']) ? $cat_image['src'] : ''; |
|
| 5802 | 5802 | |
| 5803 | 5803 | $cat_parent = ''; |
| 5804 | - if (isset($term->parent) && (int)$term->parent > 0 && term_exists((int)$term->parent, $taxonomy)) {
|
|
| 5805 | - $parent_term = (array)get_term_by( 'id', (int)$term->parent, $taxonomy ); |
|
| 5804 | + if (isset($term->parent) && (int) $term->parent > 0 && term_exists((int) $term->parent, $taxonomy)) {
|
|
| 5805 | + $parent_term = (array) get_term_by('id', (int) $term->parent, $taxonomy);
|
|
| 5806 | 5806 | $cat_parent = !empty($parent_term) && isset($parent_term['name']) ? $parent_term['name'] : ''; |
| 5807 | 5807 | } |
| 5808 | 5808 | |
@@ -5812,15 +5812,15 @@ discard block |
||
| 5812 | 5812 | $csv_row[] = $term->slug; |
| 5813 | 5813 | $csv_row[] = $post_type; |
| 5814 | 5814 | $csv_row[] = $cat_parent; |
| 5815 | - $csv_row[] = get_tax_meta( $term->term_id, 'ct_cat_schema', false, $post_type ); |
|
| 5815 | + $csv_row[] = get_tax_meta($term->term_id, 'ct_cat_schema', false, $post_type); |
|
| 5816 | 5816 | // WPML |
| 5817 | 5817 | if ($is_wpml) {
|
| 5818 | - $csv_row[] = geodir_get_language_for_element( $term->term_id, 'tax_' . $taxonomy ); |
|
| 5819 | - $csv_row[] = geodir_imex_original_post_id( $term->term_id, 'tax_' . $taxonomy ); |
|
| 5818 | + $csv_row[] = geodir_get_language_for_element($term->term_id, 'tax_'.$taxonomy); |
|
| 5819 | + $csv_row[] = geodir_imex_original_post_id($term->term_id, 'tax_'.$taxonomy); |
|
| 5820 | 5820 | } |
| 5821 | 5821 | // WPML |
| 5822 | 5822 | $csv_row[] = $term->description; |
| 5823 | - $csv_row[] = get_tax_meta( $term->term_id, 'ct_cat_top_desc', false, $post_type ); |
|
| 5823 | + $csv_row[] = get_tax_meta($term->term_id, 'ct_cat_top_desc', false, $post_type); |
|
| 5824 | 5824 | $csv_row[] = $cat_image; |
| 5825 | 5825 | $csv_row[] = $cat_icon; |
| 5826 | 5826 | |
@@ -5839,10 +5839,10 @@ discard block |
||
| 5839 | 5839 | * @param bool $relative True for relative path & False for absolute path. |
| 5840 | 5840 | * @return string Path to the cache directory. |
| 5841 | 5841 | */ |
| 5842 | -function geodir_path_import_export( $relative = true ) {
|
|
| 5842 | +function geodir_path_import_export($relative = true) {
|
|
| 5843 | 5843 | $upload_dir = wp_upload_dir(); |
| 5844 | 5844 | |
| 5845 | - return $relative ? $upload_dir['baseurl'] . '/cache' : $upload_dir['basedir'] . '/cache'; |
|
| 5845 | + return $relative ? $upload_dir['baseurl'].'/cache' : $upload_dir['basedir'].'/cache'; |
|
| 5846 | 5846 | } |
| 5847 | 5847 | |
| 5848 | 5848 | /** |
@@ -5858,8 +5858,8 @@ discard block |
||
| 5858 | 5858 | * @param bool $clear If true then it overwrite data otherwise add rows at the end of file. |
| 5859 | 5859 | * @return bool true if success otherwise false. |
| 5860 | 5860 | */ |
| 5861 | -function geodir_save_csv_data( $file_path, $csv_data = array(), $clear = true ) {
|
|
| 5862 | - if ( empty( $csv_data ) ) {
|
|
| 5861 | +function geodir_save_csv_data($file_path, $csv_data = array(), $clear = true) {
|
|
| 5862 | + if (empty($csv_data)) {
|
|
| 5863 | 5863 | return false; |
| 5864 | 5864 | } |
| 5865 | 5865 | |
@@ -5867,17 +5867,17 @@ discard block |
||
| 5867 | 5867 | |
| 5868 | 5868 | $mode = $clear ? 'w+' : 'a+'; |
| 5869 | 5869 | |
| 5870 | - if ( function_exists( 'fputcsv' ) ) {
|
|
| 5871 | - $file = fopen( $file_path, $mode ); |
|
| 5872 | - foreach( $csv_data as $csv_row ) {
|
|
| 5870 | + if (function_exists('fputcsv')) {
|
|
| 5871 | + $file = fopen($file_path, $mode); |
|
| 5872 | + foreach ($csv_data as $csv_row) {
|
|
| 5873 | 5873 | //$csv_row = array_map( 'utf8_decode', $csv_row ); |
| 5874 | - $write_successful = fputcsv( $file, $csv_row, ",", $enclosure = '"' ); |
|
| 5874 | + $write_successful = fputcsv($file, $csv_row, ",", $enclosure = '"'); |
|
| 5875 | 5875 | } |
| 5876 | - fclose( $file ); |
|
| 5876 | + fclose($file); |
|
| 5877 | 5877 | } else {
|
| 5878 | - foreach( $csv_data as $csv_row ) {
|
|
| 5878 | + foreach ($csv_data as $csv_row) {
|
|
| 5879 | 5879 | //$csv_row = array_map( 'utf8_decode', $csv_row ); |
| 5880 | - $wp_filesystem->put_contents( $file_path, $csv_row ); |
|
| 5880 | + $wp_filesystem->put_contents($file_path, $csv_row); |
|
| 5881 | 5881 | } |
| 5882 | 5882 | } |
| 5883 | 5883 | |
@@ -5895,14 +5895,14 @@ discard block |
||
| 5895 | 5895 | * @param string $file Full path to file. |
| 5896 | 5896 | * @return int No of file rows. |
| 5897 | 5897 | */ |
| 5898 | -function geodir_import_export_line_count( $file ) {
|
|
| 5898 | +function geodir_import_export_line_count($file) {
|
|
| 5899 | 5899 | global $wp_filesystem; |
| 5900 | 5900 | |
| 5901 | - if ( $wp_filesystem->is_file( $file ) && $wp_filesystem->exists( $file ) ) {
|
|
| 5902 | - $contents = $wp_filesystem->get_contents_array( $file ); |
|
| 5901 | + if ($wp_filesystem->is_file($file) && $wp_filesystem->exists($file)) {
|
|
| 5902 | + $contents = $wp_filesystem->get_contents_array($file); |
|
| 5903 | 5903 | |
| 5904 | - if ( !empty( $contents ) && is_array( $contents ) ) {
|
|
| 5905 | - return count( $contents ) - 1; |
|
| 5904 | + if (!empty($contents) && is_array($contents)) {
|
|
| 5905 | + return count($contents) - 1; |
|
| 5906 | 5906 | } |
| 5907 | 5907 | } |
| 5908 | 5908 | |
@@ -5919,11 +5919,11 @@ discard block |
||
| 5919 | 5919 | * @param string $post_type The post type. |
| 5920 | 5920 | * @return object Queried object. |
| 5921 | 5921 | */ |
| 5922 | -function geodir_imex_get_custom_fields( $post_type ) {
|
|
| 5922 | +function geodir_imex_get_custom_fields($post_type) {
|
|
| 5923 | 5923 | global $wpdb; |
| 5924 | 5924 | |
| 5925 | - $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 ) );
|
|
| 5926 | - $rows = $wpdb->get_results( $sql ); |
|
| 5925 | + $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));
|
|
| 5926 | + $rows = $wpdb->get_results($sql); |
|
| 5927 | 5927 | |
| 5928 | 5928 | return $rows; |
| 5929 | 5929 | } |
@@ -6002,14 +6002,14 @@ discard block |
||
| 6002 | 6002 | global $wpdb, $plugin_prefix; |
| 6003 | 6003 | |
| 6004 | 6004 | $post_type = get_post_type($master_post_id); |
| 6005 | - $post_table = $plugin_prefix . $post_type . '_detail'; |
|
| 6005 | + $post_table = $plugin_prefix.$post_type.'_detail'; |
|
| 6006 | 6006 | |
| 6007 | - $query = $wpdb->prepare("SELECT * FROM " . $post_table . " WHERE post_id = %d", array($master_post_id));
|
|
| 6008 | - $data = (array)$wpdb->get_row($query); |
|
| 6007 | + $query = $wpdb->prepare("SELECT * FROM ".$post_table." WHERE post_id = %d", array($master_post_id));
|
|
| 6008 | + $data = (array) $wpdb->get_row($query); |
|
| 6009 | 6009 | |
| 6010 | - if ( !empty( $data ) ) {
|
|
| 6010 | + if (!empty($data)) {
|
|
| 6011 | 6011 | $data['post_id'] = $tr_post_id; |
| 6012 | - unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type . 'category'], $data['overall_rating'], $data['rating_count'], $data['ratings']); |
|
| 6012 | + unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type.'category'], $data['overall_rating'], $data['rating_count'], $data['ratings']); |
|
| 6013 | 6013 | |
| 6014 | 6014 | $wpdb->update($post_table, $data, array('post_id' => $tr_post_id));
|
| 6015 | 6015 | return true; |
@@ -6035,7 +6035,7 @@ discard block |
||
| 6035 | 6035 | global $sitepress, $wpdb; |
| 6036 | 6036 | $post_type = get_post_type($master_post_id); |
| 6037 | 6037 | |
| 6038 | - remove_filter('get_term', array($sitepress,'get_term_adjust_id')); // AVOID filtering to current language
|
|
| 6038 | + remove_filter('get_term', array($sitepress, 'get_term_adjust_id')); // AVOID filtering to current language
|
|
| 6039 | 6039 | |
| 6040 | 6040 | $taxonomies = get_object_taxonomies($post_type); |
| 6041 | 6041 | foreach ($taxonomies as $taxonomy) {
|
@@ -6044,9 +6044,9 @@ discard block |
||
| 6044 | 6044 | |
| 6045 | 6045 | if ($terms) {
|
| 6046 | 6046 | foreach ($terms as $term) {
|
| 6047 | - $tr_id = apply_filters( 'translate_object_id',$term->term_id, $taxonomy, false, $lang); |
|
| 6047 | + $tr_id = apply_filters('translate_object_id', $term->term_id, $taxonomy, false, $lang);
|
|
| 6048 | 6048 | |
| 6049 | - if (!is_null($tr_id)){
|
|
| 6049 | + if (!is_null($tr_id)) {
|
|
| 6050 | 6050 | // not using get_term - unfiltered get_term |
| 6051 | 6051 | $translated_term = $wpdb->get_row($wpdb->prepare("
|
| 6052 | 6052 | 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));
|
@@ -6055,14 +6055,14 @@ discard block |
||
| 6055 | 6055 | } |
| 6056 | 6056 | } |
| 6057 | 6057 | |
| 6058 | - if (!is_taxonomy_hierarchical($taxonomy)){
|
|
| 6059 | - $terms_array = array_unique( array_map( 'intval', $terms_array ) ); |
|
| 6058 | + if (!is_taxonomy_hierarchical($taxonomy)) {
|
|
| 6059 | + $terms_array = array_unique(array_map('intval', $terms_array));
|
|
| 6060 | 6060 | } |
| 6061 | 6061 | |
| 6062 | 6062 | wp_set_post_terms($tr_post_id, $terms_array, $taxonomy); |
| 6063 | 6063 | |
| 6064 | - if ($taxonomy == $post_type . 'category') {
|
|
| 6065 | - geodir_set_postcat_structure($tr_post_id, $post_type . 'category'); |
|
| 6064 | + if ($taxonomy == $post_type.'category') {
|
|
| 6065 | + geodir_set_postcat_structure($tr_post_id, $post_type.'category'); |
|
| 6066 | 6066 | } |
| 6067 | 6067 | } |
| 6068 | 6068 | } |
@@ -6083,15 +6083,15 @@ discard block |
||
| 6083 | 6083 | function geodir_icl_duplicate_post_images($master_post_id, $tr_post_id, $lang) {
|
| 6084 | 6084 | global $wpdb; |
| 6085 | 6085 | |
| 6086 | - $query = $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id));
|
|
| 6086 | + $query = $wpdb->prepare("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id));
|
|
| 6087 | 6087 | $wpdb->query($query); |
| 6088 | 6088 | |
| 6089 | - $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));
|
|
| 6089 | + $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));
|
|
| 6090 | 6090 | $post_images = $wpdb->get_results($query); |
| 6091 | 6091 | |
| 6092 | - if ( !empty( $post_images ) ) {
|
|
| 6093 | - foreach ( $post_images as $post_image) {
|
|
| 6094 | - $image_data = (array)$post_image; |
|
| 6092 | + if (!empty($post_images)) {
|
|
| 6093 | + foreach ($post_images as $post_image) {
|
|
| 6094 | + $image_data = (array) $post_image; |
|
| 6095 | 6095 | unset($image_data['ID']); |
| 6096 | 6096 | $image_data['post_id'] = $tr_post_id; |
| 6097 | 6097 | |
@@ -6117,10 +6117,10 @@ discard block |
||
| 6117 | 6117 | * @return array Event data array. |
| 6118 | 6118 | */ |
| 6119 | 6119 | function geodir_imex_get_event_data($post, $gd_post_info) {
|
| 6120 | - $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'] ) ) : ''; |
|
| 6120 | + $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'])) : '';
|
|
| 6121 | 6121 | $event_enddate = $event_date; |
| 6122 | - $starttime = isset( $post['starttime'] ) && $post['starttime'] != '' && $post['starttime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $post['starttime'] ) ) : ''; |
|
| 6123 | - $endtime = isset( $post['endtime'] ) && $post['endtime'] != '' && $post['endtime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $post['endtime'] ) ) : ''; |
|
| 6122 | + $starttime = isset($post['starttime']) && $post['starttime'] != '' && $post['starttime'] != '00:00:00' ? date_i18n('H:i', strtotime($post['starttime'])) : '';
|
|
| 6123 | + $endtime = isset($post['endtime']) && $post['endtime'] != '' && $post['endtime'] != '00:00:00' ? date_i18n('H:i', strtotime($post['endtime'])) : '';
|
|
| 6124 | 6124 | |
| 6125 | 6125 | $is_recurring_event = ''; |
| 6126 | 6126 | $event_duration_days = ''; |
@@ -6137,15 +6137,15 @@ discard block |
||
| 6137 | 6137 | |
| 6138 | 6138 | $recurring_data = isset($gd_post_info->recurring_dates) ? maybe_unserialize($gd_post_info->recurring_dates) : array(); |
| 6139 | 6139 | if (!empty($recurring_data)) {
|
| 6140 | - $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; |
|
| 6141 | - $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; |
|
| 6142 | - $starttime = isset( $recurring_data['starttime'] ) && $recurring_data['starttime'] != '' && $recurring_data['starttime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $recurring_data['starttime'] ) ) : $starttime; |
|
| 6143 | - $endtime = isset( $recurring_data['endtime'] ) && $recurring_data['endtime'] != '' && $recurring_data['endtime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $recurring_data['endtime'] ) ) : $endtime; |
|
| 6140 | + $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;
|
|
| 6141 | + $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;
|
|
| 6142 | + $starttime = isset($recurring_data['starttime']) && $recurring_data['starttime'] != '' && $recurring_data['starttime'] != '00:00:00' ? date_i18n('H:i', strtotime($recurring_data['starttime'])) : $starttime;
|
|
| 6143 | + $endtime = isset($recurring_data['endtime']) && $recurring_data['endtime'] != '' && $recurring_data['endtime'] != '00:00:00' ? date_i18n('H:i', strtotime($recurring_data['endtime'])) : $endtime;
|
|
| 6144 | 6144 | $is_whole_day_event = !empty($recurring_data['all_day']) ? 1 : ''; |
| 6145 | 6145 | $different_times = !empty($recurring_data['different_times']) ? true : false; |
| 6146 | 6146 | |
| 6147 | - $recurring_pkg = geodir_event_recurring_pkg( $gd_post_info ); |
|
| 6148 | - $is_recurring = isset( $gd_post_info->is_recurring ) && (int)$gd_post_info->is_recurring == 0 ? false : true; |
|
| 6147 | + $recurring_pkg = geodir_event_recurring_pkg($gd_post_info); |
|
| 6148 | + $is_recurring = isset($gd_post_info->is_recurring) && (int) $gd_post_info->is_recurring == 0 ? false : true; |
|
| 6149 | 6149 | |
| 6150 | 6150 | if ($recurring_pkg && $is_recurring) {
|
| 6151 | 6151 | $recurring_dates = $event_date; |
@@ -6155,13 +6155,13 @@ discard block |
||
| 6155 | 6155 | $recurring_type = !empty($recurring_data['repeat_type']) && in_array($recurring_data['repeat_type'], array('day', 'week', 'month', 'year', 'custom')) ? $recurring_data['repeat_type'] : 'custom';
|
| 6156 | 6156 | |
| 6157 | 6157 | if (!empty($recurring_data['event_recurring_dates'])) {
|
| 6158 | - $event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] ); |
|
| 6158 | + $event_recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
|
|
| 6159 | 6159 | |
| 6160 | 6160 | if (!empty($event_recurring_dates)) {
|
| 6161 | 6161 | $recurring_dates = array(); |
| 6162 | 6162 | |
| 6163 | 6163 | foreach ($event_recurring_dates as $date) {
|
| 6164 | - $recurring_dates[] = date_i18n( 'd/m/Y', strtotime( $date ) ); |
|
| 6164 | + $recurring_dates[] = date_i18n('d/m/Y', strtotime($date));
|
|
| 6165 | 6165 | } |
| 6166 | 6166 | |
| 6167 | 6167 | $recurring_dates = implode(",", $recurring_dates);
|
@@ -6177,7 +6177,7 @@ discard block |
||
| 6177 | 6177 | $times = array(); |
| 6178 | 6178 | |
| 6179 | 6179 | foreach ($recurring_data['starttimes'] as $time) {
|
| 6180 | - $times[] = $time != '00:00:00' ? date_i18n( 'H:i', strtotime( $time ) ) : '00:00'; |
|
| 6180 | + $times[] = $time != '00:00:00' ? date_i18n('H:i', strtotime($time)) : '00:00';
|
|
| 6181 | 6181 | } |
| 6182 | 6182 | |
| 6183 | 6183 | $event_starttimes = implode(",", $times);
|
@@ -6187,7 +6187,7 @@ discard block |
||
| 6187 | 6187 | $times = array(); |
| 6188 | 6188 | |
| 6189 | 6189 | foreach ($recurring_data['endtimes'] as $time) {
|
| 6190 | - $times[] = $time != '00:00:00' ? date_i18n( 'H:i', strtotime( $time ) ) : '00:00'; |
|
| 6190 | + $times[] = $time != '00:00:00' ? date_i18n('H:i', strtotime($time)) : '00:00';
|
|
| 6191 | 6191 | } |
| 6192 | 6192 | |
| 6193 | 6193 | $event_endtimes = implode(",", $times);
|
@@ -6199,8 +6199,8 @@ discard block |
||
| 6199 | 6199 | } |
| 6200 | 6200 | } |
| 6201 | 6201 | } else {
|
| 6202 | - $event_duration_days = isset($recurring_data['duration_x']) ? (int)$recurring_data['duration_x'] : 1; |
|
| 6203 | - $recurring_interval = !empty($recurring_data['repeat_x']) && (int)$recurring_data['repeat_x'] > 0 ? $recurring_data['repeat_x'] : 1; |
|
| 6202 | + $event_duration_days = isset($recurring_data['duration_x']) ? (int) $recurring_data['duration_x'] : 1; |
|
| 6203 | + $recurring_interval = !empty($recurring_data['repeat_x']) && (int) $recurring_data['repeat_x'] > 0 ? $recurring_data['repeat_x'] : 1; |
|
| 6204 | 6204 | |
| 6205 | 6205 | if (($recurring_type == 'week' || $recurring_type == 'month') && !empty($recurring_data['repeat_days'])) {
|
| 6206 | 6206 | $week_days = array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
|
@@ -6216,11 +6216,11 @@ discard block |
||
| 6216 | 6216 | } |
| 6217 | 6217 | |
| 6218 | 6218 | $recurring_week_nos = $recurring_type == 'month' && !empty($recurring_data['repeat_weeks']) ? implode(",", $recurring_data['repeat_weeks']) : $recurring_week_nos;
|
| 6219 | - if (!empty($recurring_data['repeat_end_type']) && (int)$recurring_data['repeat_end_type'] == 1) {
|
|
| 6220 | - $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'] ) ) : ''; |
|
| 6219 | + if (!empty($recurring_data['repeat_end_type']) && (int) $recurring_data['repeat_end_type'] == 1) {
|
|
| 6220 | + $recurring_end_date = isset($recurring_data['repeat_end']) && $recurring_data['repeat_end'] != '' && $recurring_data['repeat_end'] != '0000-00-00 00:00:00' ? date_i18n('d/m/Y', strtotime($recurring_data['repeat_end'])) : '';
|
|
| 6221 | 6221 | $max_recurring_count = empty($recurring_end_date) ? 1 : ''; |
| 6222 | 6222 | } else {
|
| 6223 | - $max_recurring_count = (!empty($recurring_data['max_repeat']) && (int)$recurring_data['max_repeat'] > 0 ? (int)$recurring_data['max_repeat'] : 1); |
|
| 6223 | + $max_recurring_count = (!empty($recurring_data['max_repeat']) && (int) $recurring_data['max_repeat'] > 0 ? (int) $recurring_data['max_repeat'] : 1); |
|
| 6224 | 6224 | } |
| 6225 | 6225 | } |
| 6226 | 6226 | } |
@@ -6284,9 +6284,9 @@ discard block |
||
| 6284 | 6284 | * @return array Event data array. |
| 6285 | 6285 | */ |
| 6286 | 6286 | function geodir_imex_process_event_data($gd_post) {
|
| 6287 | - $recurring_pkg = geodir_event_recurring_pkg( (object)$gd_post ); |
|
| 6287 | + $recurring_pkg = geodir_event_recurring_pkg((object) $gd_post); |
|
| 6288 | 6288 | |
| 6289 | - $is_recurring = isset( $gd_post['is_recurring_event'] ) && (int)$gd_post['is_recurring_event'] == 0 ? false : true; |
|
| 6289 | + $is_recurring = isset($gd_post['is_recurring_event']) && (int) $gd_post['is_recurring_event'] == 0 ? false : true; |
|
| 6290 | 6290 | $event_date = isset($gd_post['event_date']) && $gd_post['event_date'] != '' ? geodir_imex_get_date_ymd($gd_post['event_date']) : ''; |
| 6291 | 6291 | $event_enddate = isset($gd_post['event_enddate']) && $gd_post['event_enddate'] != '' ? geodir_imex_get_date_ymd($gd_post['event_enddate']) : $event_date; |
| 6292 | 6292 | $all_day = isset($gd_post['is_whole_day_event']) && !empty($gd_post['is_whole_day_event']) ? true : false; |
@@ -6333,17 +6333,17 @@ discard block |
||
| 6333 | 6333 | $event_recurring_dates = implode(",", $event_recurring_dates);
|
| 6334 | 6334 | } |
| 6335 | 6335 | } else {
|
| 6336 | - $duration_x = !empty( $gd_post['event_duration_days'] ) ? (int)$gd_post['event_duration_days'] : 1; |
|
| 6337 | - $repeat_x = !empty( $gd_post['recurring_interval'] ) ? (int)$gd_post['recurring_interval'] : 1; |
|
| 6338 | - $max_repeat = !empty( $gd_post['max_recurring_count'] ) ? (int)$gd_post['max_recurring_count'] : 1; |
|
| 6339 | - $repeat_end = !empty( $gd_post['recurring_end_date'] ) ? geodir_imex_get_date_ymd($gd_post['recurring_end_date']) : ''; |
|
| 6336 | + $duration_x = !empty($gd_post['event_duration_days']) ? (int) $gd_post['event_duration_days'] : 1; |
|
| 6337 | + $repeat_x = !empty($gd_post['recurring_interval']) ? (int) $gd_post['recurring_interval'] : 1; |
|
| 6338 | + $max_repeat = !empty($gd_post['max_recurring_count']) ? (int) $gd_post['max_recurring_count'] : 1; |
|
| 6339 | + $repeat_end = !empty($gd_post['recurring_end_date']) ? geodir_imex_get_date_ymd($gd_post['recurring_end_date']) : ''; |
|
| 6340 | 6340 | |
| 6341 | 6341 | $repeat_end_type = $repeat_end != '' ? 1 : 0; |
| 6342 | 6342 | $max_repeat = $repeat_end != '' ? '' : $max_repeat; |
| 6343 | 6343 | |
| 6344 | 6344 | $week_days = array_flip(array('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'));
|
| 6345 | 6345 | |
| 6346 | - $a_repeat_days = isset($gd_post['recurring_week_days']) && trim($gd_post['recurring_week_days'])!='' ? explode(',', trim($gd_post['recurring_week_days'])) : array();
|
|
| 6346 | + $a_repeat_days = isset($gd_post['recurring_week_days']) && trim($gd_post['recurring_week_days']) != '' ? explode(',', trim($gd_post['recurring_week_days'])) : array();
|
|
| 6347 | 6347 | $repeat_days = array(); |
| 6348 | 6348 | if (!empty($a_repeat_days)) {
|
| 6349 | 6349 | foreach ($a_repeat_days as $repeat_day) {
|
@@ -6361,7 +6361,7 @@ discard block |
||
| 6361 | 6361 | $repeat_weeks = array(); |
| 6362 | 6362 | if (!empty($a_repeat_weeks)) {
|
| 6363 | 6363 | foreach ($a_repeat_weeks as $repeat_week) {
|
| 6364 | - $repeat_weeks[] = (int)$repeat_week; |
|
| 6364 | + $repeat_weeks[] = (int) $repeat_week; |
|
| 6365 | 6365 | } |
| 6366 | 6366 | |
| 6367 | 6367 | $repeat_weeks = array_unique($repeat_weeks); |
@@ -6425,7 +6425,7 @@ discard block |
||
| 6425 | 6425 | |
| 6426 | 6426 | $page_found = $wpdb->get_var( |
| 6427 | 6427 | $wpdb->prepare( |
| 6428 | - "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;", |
|
| 6428 | + "SELECT ID FROM ".$wpdb->posts." WHERE post_name = %s LIMIT 1;", |
|
| 6429 | 6429 | array($slug) |
| 6430 | 6430 | ) |
| 6431 | 6431 | ); |
@@ -6480,7 +6480,7 @@ discard block |
||
| 6480 | 6480 | */ |
| 6481 | 6481 | function geodir_admin_upgrade_notice() {
|
| 6482 | 6482 | $class = "error"; |
| 6483 | - $message = __("Please update core GeoDirectory or some addons may not function correctly.","geodirectory");
|
|
| 6483 | + $message = __("Please update core GeoDirectory or some addons may not function correctly.", "geodirectory");
|
|
| 6484 | 6484 | echo"<div class=\"$class\"> <p>$message</p></div>"; |
| 6485 | 6485 | } |
| 6486 | 6486 | |
@@ -6492,7 +6492,7 @@ discard block |
||
| 6492 | 6492 | * @param (object) $r |
| 6493 | 6493 | * @return (string) $output |
| 6494 | 6494 | */ |
| 6495 | -function geodire_admin_upgrade_notice( $plugin_data, $r ) |
|
| 6495 | +function geodire_admin_upgrade_notice($plugin_data, $r) |
|
| 6496 | 6496 | {
|
| 6497 | 6497 | // readme contents |
| 6498 | 6498 | $args = array( |
@@ -6500,7 +6500,7 @@ discard block |
||
| 6500 | 6500 | 'redirection' => 5 |
| 6501 | 6501 | ); |
| 6502 | 6502 | $url = "http://plugins.svn.wordpress.org/geodirectory/trunk/readme.txt"; |
| 6503 | - $data = wp_remote_get( $url, $args ); |
|
| 6503 | + $data = wp_remote_get($url, $args); |
|
| 6504 | 6504 | |
| 6505 | 6505 | if (!is_wp_error($data) && $data['response']['code'] == 200) {
|
| 6506 | 6506 | |
@@ -6515,20 +6515,20 @@ discard block |
||
| 6515 | 6515 | function geodir_in_plugin_update_message($content) {
|
| 6516 | 6516 | // Output Upgrade Notice |
| 6517 | 6517 | $matches = null; |
| 6518 | - $regexp = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( GEODIRECTORY_VERSION ) . '\s*=|$)~Uis'; |
|
| 6518 | + $regexp = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*'.preg_quote(GEODIRECTORY_VERSION).'\s*=|$)~Uis'; |
|
| 6519 | 6519 | $upgrade_notice = ''; |
| 6520 | - if ( preg_match( $regexp, $content, $matches ) ) {
|
|
| 6521 | - if(empty($matches)){return;}
|
|
| 6520 | + if (preg_match($regexp, $content, $matches)) {
|
|
| 6521 | + if (empty($matches)) {return; }
|
|
| 6522 | 6522 | |
| 6523 | - $version = trim( $matches[1] ); |
|
| 6524 | - if($version && $version>GEODIRECTORY_VERSION){
|
|
| 6523 | + $version = trim($matches[1]); |
|
| 6524 | + if ($version && $version > GEODIRECTORY_VERSION) {
|
|
| 6525 | 6525 | |
| 6526 | 6526 | |
| 6527 | - $notices = (array) preg_split('~[\r\n]+~', trim( $matches[2] ) );
|
|
| 6528 | - if ( version_compare( GEODIRECTORY_VERSION, $version, '<' ) ) {
|
|
| 6527 | + $notices = (array) preg_split('~[\r\n]+~', trim($matches[2]));
|
|
| 6528 | + if (version_compare(GEODIRECTORY_VERSION, $version, '<')) {
|
|
| 6529 | 6529 | $upgrade_notice .= '<div class="geodir_plugin_upgrade_notice">'; |
| 6530 | - foreach ( $notices as $index => $line ) {
|
|
| 6531 | - $upgrade_notice .= wp_kses_post( preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line ) );
|
|
| 6530 | + foreach ($notices as $index => $line) {
|
|
| 6531 | + $upgrade_notice .= wp_kses_post(preg_replace('~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line));
|
|
| 6532 | 6532 | } |
| 6533 | 6533 | $upgrade_notice .= '</div> '; |
| 6534 | 6534 | } |
@@ -6552,7 +6552,7 @@ discard block |
||
| 6552 | 6552 | $default_language = $sitepress->get_default_language(); |
| 6553 | 6553 | if ($current_language != 'all' && $current_language != $default_language) {
|
| 6554 | 6554 | ?> |
| 6555 | - <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>
|
|
| 6555 | + <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>
|
|
| 6556 | 6556 | <?php |
| 6557 | 6557 | } |
| 6558 | 6558 | } |
@@ -6567,7 +6567,7 @@ discard block |
||
| 6567 | 6567 | * @param array Listing statuses to be skipped. |
| 6568 | 6568 | */ |
| 6569 | 6569 | function geodir_imex_export_skip_statuses() {
|
| 6570 | - $statuses = array( 'trash', 'auto-draft' ); |
|
| 6570 | + $statuses = array('trash', 'auto-draft');
|
|
| 6571 | 6571 | |
| 6572 | 6572 | /** |
| 6573 | 6573 | * Filter the statuses to skip during GD export listings. |
@@ -6577,7 +6577,7 @@ discard block |
||
| 6577 | 6577 | * |
| 6578 | 6578 | * @param array $statuses Listing statuses to be skipped. |
| 6579 | 6579 | */ |
| 6580 | - $statuses = apply_filters( 'geodir_imex_export_skip_statuses', $statuses ); |
|
| 6580 | + $statuses = apply_filters('geodir_imex_export_skip_statuses', $statuses);
|
|
| 6581 | 6581 | |
| 6582 | 6582 | return $statuses; |
| 6583 | 6583 | } |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | /** |
| 11 | 11 | * Get All Plugin functions from WordPress |
| 12 | 12 | */ |
| 13 | -include_once(ABSPATH . 'wp-admin/includes/plugin.php'); |
|
| 13 | +include_once(ABSPATH.'wp-admin/includes/plugin.php'); |
|
| 14 | 14 | |
| 15 | 15 | /*-----------------------------------------------------------------------------------*/ |
| 16 | 16 | /* Helper functions */ |
@@ -29,9 +29,9 @@ discard block |
||
| 29 | 29 | {
|
| 30 | 30 | |
| 31 | 31 | if (is_ssl()) : |
| 32 | - return str_replace('http://', 'https://', WP_PLUGIN_URL) . "/" . plugin_basename(dirname(dirname(__FILE__)));
|
|
| 32 | + return str_replace('http://', 'https://', WP_PLUGIN_URL)."/".plugin_basename(dirname(dirname(__FILE__)));
|
|
| 33 | 33 | else : |
| 34 | - return WP_PLUGIN_URL . "/" . plugin_basename(dirname(dirname(__FILE__))); |
|
| 34 | + return WP_PLUGIN_URL."/".plugin_basename(dirname(dirname(__FILE__))); |
|
| 35 | 35 | endif; |
| 36 | 36 | } |
| 37 | 37 | |
@@ -47,10 +47,10 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | function geodir_plugin_path() |
| 49 | 49 | {
|
| 50 | - if ( defined( 'GD_TESTING_MODE' ) && GD_TESTING_MODE ) {
|
|
| 50 | + if (defined('GD_TESTING_MODE') && GD_TESTING_MODE) {
|
|
| 51 | 51 | return dirname(dirname(__FILE__)); |
| 52 | 52 | } else {
|
| 53 | - return WP_PLUGIN_DIR . "/" . plugin_basename(dirname(dirname(__FILE__))); |
|
| 53 | + return WP_PLUGIN_DIR."/".plugin_basename(dirname(dirname(__FILE__))); |
|
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | |
@@ -129,10 +129,10 @@ discard block |
||
| 129 | 129 | foreach ($params as $key => $value) {
|
| 130 | 130 | if (gettype($value) == 'array') { //Handle array data properly
|
| 131 | 131 | foreach ($value as $val) {
|
| 132 | - $params_arr[] = $key . '[]=' . urlencode($val); |
|
| 132 | + $params_arr[] = $key.'[]='.urlencode($val); |
|
| 133 | 133 | } |
| 134 | 134 | } else {
|
| 135 | - $params_arr[] = $key . '=' . urlencode($value); |
|
| 135 | + $params_arr[] = $key.'='.urlencode($value); |
|
| 136 | 136 | } |
| 137 | 137 | } |
| 138 | 138 | $link .= implode('&', $params_arr);
|
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | |
| 161 | 161 | $add_listing_link = get_page_link(geodir_add_listing_page_id()); |
| 162 | 162 | |
| 163 | - return esc_url( add_query_arg(array('listing_type' => $post_type), $add_listing_link) );
|
|
| 163 | + return esc_url(add_query_arg(array('listing_type' => $post_type), $add_listing_link));
|
|
| 164 | 164 | } else |
| 165 | 165 | return get_bloginfo('url');
|
| 166 | 166 | } |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | $pageURL .= "s"; |
| 181 | 181 | } |
| 182 | 182 | $pageURL .= "://"; |
| 183 | - $pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]; |
|
| 183 | + $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; |
|
| 184 | 184 | /** |
| 185 | 185 | * Filter the current page URL returned by function geodir_curPageURL(). |
| 186 | 186 | * |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | function geodir_is_page($gdpage = '') |
| 253 | 253 | {
|
| 254 | 254 | |
| 255 | - global $wp_query, $post,$wp; |
|
| 255 | + global $wp_query, $post, $wp; |
|
| 256 | 256 | //if(!is_admin()): |
| 257 | 257 | |
| 258 | 258 | switch ($gdpage): |
@@ -277,14 +277,14 @@ discard block |
||
| 277 | 277 | break; |
| 278 | 278 | case 'detail': |
| 279 | 279 | $post_type = get_query_var('post_type');
|
| 280 | - if(is_array($post_type)){$post_type = reset($post_type);}
|
|
| 280 | + if (is_array($post_type)) {$post_type = reset($post_type); }
|
|
| 281 | 281 | if (is_single() && in_array($post_type, geodir_get_posttypes())) |
| 282 | 282 | return true; |
| 283 | 283 | break; |
| 284 | 284 | case 'pt': |
| 285 | 285 | $post_type = get_query_var('post_type');
|
| 286 | - if(is_array($post_type)){$post_type = reset($post_type);}
|
|
| 287 | - if (is_post_type_archive() && in_array($post_type , geodir_get_posttypes()) && !is_tax()) |
|
| 286 | + if (is_array($post_type)) {$post_type = reset($post_type); }
|
|
| 287 | + if (is_post_type_archive() && in_array($post_type, geodir_get_posttypes()) && !is_tax()) |
|
| 288 | 288 | return true; |
| 289 | 289 | |
| 290 | 290 | break; |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | return true; |
| 296 | 296 | } |
| 297 | 297 | $post_type = get_query_var('post_type');
|
| 298 | - if(is_array($post_type)){$post_type = reset($post_type);}
|
|
| 298 | + if (is_array($post_type)) {$post_type = reset($post_type); }
|
|
| 299 | 299 | if (is_post_type_archive() && in_array($post_type, geodir_get_posttypes())) |
| 300 | 300 | return true; |
| 301 | 301 | |
@@ -314,8 +314,8 @@ discard block |
||
| 314 | 314 | if (is_author() && isset($_REQUEST['geodir_dashbord'])) |
| 315 | 315 | return true; |
| 316 | 316 | |
| 317 | - if (function_exists('bp_loggedin_user_id') && function_exists('bp_displayed_user_id') && $my_id = (int)bp_loggedin_user_id()) {
|
|
| 318 | - if (((bool)bp_is_current_component('listings') || (bool)bp_is_current_component('favorites')) && $my_id > 0 && $my_id == (int)bp_displayed_user_id()) {
|
|
| 317 | + if (function_exists('bp_loggedin_user_id') && function_exists('bp_displayed_user_id') && $my_id = (int) bp_loggedin_user_id()) {
|
|
| 318 | + if (((bool) bp_is_current_component('listings') || (bool) bp_is_current_component('favorites')) && $my_id > 0 && $my_id == (int) bp_displayed_user_id()) {
|
|
| 319 | 319 | return true; |
| 320 | 320 | } |
| 321 | 321 | } |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | if (empty($wp->query_vars) || !array_diff(array_keys($wp->query_vars), array('preview', 'page', 'paged', 'cpage'))) {
|
| 369 | 369 | if (get_option('geodir_set_as_home'))
|
| 370 | 370 | $wp->query_vars['gd_is_geodir_page'] = true; |
| 371 | - if(geodir_is_page('home')){
|
|
| 371 | + if (geodir_is_page('home')) {
|
|
| 372 | 372 | $wp->query_vars['gd_is_geodir_page'] = true; |
| 373 | 373 | } |
| 374 | 374 | |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | |
| 421 | 421 | if (!isset($wp->query_vars['gd_is_geodir_page'])) {
|
| 422 | 422 | $geodir_taxonomis = geodir_get_taxonomies('', true);
|
| 423 | - if(!empty($geodir_taxonomis)){
|
|
| 423 | + if (!empty($geodir_taxonomis)) {
|
|
| 424 | 424 | foreach ($geodir_taxonomis as $taxonomy) {
|
| 425 | 425 | if (array_key_exists($taxonomy, $wp->query_vars)) {
|
| 426 | 426 | $wp->query_vars['gd_is_geodir_page'] = true; |
@@ -440,10 +440,10 @@ discard block |
||
| 440 | 440 | |
| 441 | 441 | |
| 442 | 442 | //check if homepage |
| 443 | - if(!isset($wp->query_vars['gd_is_geodir_page']) |
|
| 443 | + if (!isset($wp->query_vars['gd_is_geodir_page']) |
|
| 444 | 444 | && !isset($wp->query_vars['page_id']) |
| 445 | 445 | && !isset($wp->query_vars['pagename']) |
| 446 | - && is_page_geodir_home()){
|
|
| 446 | + && is_page_geodir_home()) {
|
|
| 447 | 447 | $wp->query_vars['gd_is_geodir_page'] = true; |
| 448 | 448 | } |
| 449 | 449 | //echo $wp->query_vars['gd_is_geodir_page'] ; |
@@ -505,7 +505,7 @@ discard block |
||
| 505 | 505 | * @since 1.0.0 |
| 506 | 506 | * @param array $imagesizes[$size] Image size array of the passed key. |
| 507 | 507 | */ |
| 508 | - return apply_filters('geodir_get_imagesize_' . $size, $imagesizes[$size]);
|
|
| 508 | + return apply_filters('geodir_get_imagesize_'.$size, $imagesizes[$size]);
|
|
| 509 | 509 | |
| 510 | 510 | } elseif (!empty($size)) {
|
| 511 | 511 | |
@@ -544,13 +544,13 @@ discard block |
||
| 544 | 544 | function createRandomString() |
| 545 | 545 | {
|
| 546 | 546 | $chars = "abcdefghijkmlnopqrstuvwxyz1023456789"; |
| 547 | - srand((double)microtime() * 1000000); |
|
| 547 | + srand((double) microtime() * 1000000); |
|
| 548 | 548 | $i = 0; |
| 549 | 549 | $rstring = ''; |
| 550 | 550 | while ($i <= 25) {
|
| 551 | 551 | $num = rand() % 33; |
| 552 | 552 | $tmp = substr($chars, $num, 1); |
| 553 | - $rstring = $rstring . $tmp; |
|
| 553 | + $rstring = $rstring.$tmp; |
|
| 554 | 554 | $i++; |
| 555 | 555 | } |
| 556 | 556 | return $rstring; |
@@ -681,11 +681,11 @@ discard block |
||
| 681 | 681 | } |
| 682 | 682 | |
| 683 | 683 | if (!empty($subject)) {
|
| 684 | - $subject = __(stripslashes_deep($subject),'geodirectory'); |
|
| 684 | + $subject = __(stripslashes_deep($subject), 'geodirectory'); |
|
| 685 | 685 | } |
| 686 | 686 | |
| 687 | 687 | if (!empty($message)) {
|
| 688 | - $message = __(stripslashes_deep($message),'geodirectory'); |
|
| 688 | + $message = __(stripslashes_deep($message), 'geodirectory'); |
|
| 689 | 689 | } |
| 690 | 690 | |
| 691 | 691 | $to_message = nl2br($to_message); |
@@ -705,12 +705,12 @@ discard block |
||
| 705 | 705 | |
| 706 | 706 | if ($post_info) {
|
| 707 | 707 | $posted_date = $post_info->post_date; |
| 708 | - $listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>'; |
|
| 708 | + $listingLink = '<a href="'.$productlink.'"><b>'.$post_info->post_title.'</b></a>'; |
|
| 709 | 709 | } |
| 710 | 710 | $siteurl = home_url(); |
| 711 | - $siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>'; |
|
| 711 | + $siteurl_link = '<a href="'.$siteurl.'">'.$siteurl.'</a>'; |
|
| 712 | 712 | $loginurl = geodir_login_url(); |
| 713 | - $loginurl_link = '<a href="' . $loginurl . '">login</a>'; |
|
| 713 | + $loginurl_link = '<a href="'.$loginurl.'">login</a>'; |
|
| 714 | 714 | |
| 715 | 715 | $post_author_id = !empty($post_info) ? $post_info->post_author : 0; |
| 716 | 716 | $post_author_name = geodir_get_client_name($post_author_id); |
@@ -724,18 +724,18 @@ discard block |
||
| 724 | 724 | $fromEmailName = get_option('site_email_name');
|
| 725 | 725 | } |
| 726 | 726 | |
| 727 | - $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]', '[#posted_date#]','[#from_email#]','[#user_login#]','[#username#]','[#post_author_id#]','[#post_author_name#]','[#current_date#]');
|
|
| 728 | - $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName, $posted_date,$fromEmail, $user_login, $user_login, $post_author_id, $post_author_name, $current_date); |
|
| 727 | + $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]', '[#posted_date#]', '[#from_email#]', '[#user_login#]', '[#username#]', '[#post_author_id#]', '[#post_author_name#]', '[#current_date#]');
|
|
| 728 | + $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName, $posted_date, $fromEmail, $user_login, $user_login, $post_author_id, $post_author_name, $current_date); |
|
| 729 | 729 | $message = str_replace($search_array, $replace_array, $message); |
| 730 | 730 | |
| 731 | - $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]','[#from_email#]','[#user_login#]','[#username#]','[#post_author_id#]','[#post_author_name#]','[#current_date#]');
|
|
| 732 | - $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName, $posted_date,$fromEmail, $user_login, $user_login, $post_author_id, $post_author_name, $current_date); |
|
| 731 | + $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]', '[#from_email#]', '[#user_login#]', '[#username#]', '[#post_author_id#]', '[#post_author_name#]', '[#current_date#]');
|
|
| 732 | + $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName, $posted_date, $fromEmail, $user_login, $user_login, $post_author_id, $post_author_name, $current_date); |
|
| 733 | 733 | $subject = str_replace($search_array, $replace_array, $subject); |
| 734 | 734 | |
| 735 | - $headers = 'MIME-Version: 1.0' . "\r\n"; |
|
| 736 | - $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n"; |
|
| 737 | - $headers .= "Reply-To: " . $fromEmail . "\r\n"; |
|
| 738 | - $headers .= 'From: ' . $sitefromEmailName . ' <' . $sitefromEmail . '>' . "\r\n"; |
|
| 735 | + $headers = 'MIME-Version: 1.0'."\r\n"; |
|
| 736 | + $headers .= 'Content-type: text/html; charset=UTF-8'."\r\n"; |
|
| 737 | + $headers .= "Reply-To: ".$fromEmail."\r\n"; |
|
| 738 | + $headers .= 'From: '.$sitefromEmailName.' <'.$sitefromEmail.'>'."\r\n"; |
|
| 739 | 739 | |
| 740 | 740 | $to = $toEmail; |
| 741 | 741 | |
@@ -756,7 +756,7 @@ discard block |
||
| 756 | 756 | * @param string $post_id The post ID. |
| 757 | 757 | * @param string $user_id The user ID. |
| 758 | 758 | */ |
| 759 | - $to = apply_filters('geodir_sendEmail_to',$to,$fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
|
|
| 759 | + $to = apply_filters('geodir_sendEmail_to', $to, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
|
|
| 760 | 760 | /** |
| 761 | 761 | * Filter the client email subject. |
| 762 | 762 | * |
@@ -774,7 +774,7 @@ discard block |
||
| 774 | 774 | * @param string $post_id The post ID. |
| 775 | 775 | * @param string $user_id The user ID. |
| 776 | 776 | */ |
| 777 | - $subject = apply_filters('geodir_sendEmail_subject',$subject,$fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
|
|
| 777 | + $subject = apply_filters('geodir_sendEmail_subject', $subject, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
|
|
| 778 | 778 | /** |
| 779 | 779 | * Filter the client email message. |
| 780 | 780 | * |
@@ -792,7 +792,7 @@ discard block |
||
| 792 | 792 | * @param string $post_id The post ID. |
| 793 | 793 | * @param string $user_id The user ID. |
| 794 | 794 | */ |
| 795 | - $message = apply_filters('geodir_sendEmail_message',$message,$fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
|
|
| 795 | + $message = apply_filters('geodir_sendEmail_message', $message, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
|
|
| 796 | 796 | /** |
| 797 | 797 | * Filter the client email headers. |
| 798 | 798 | * |
@@ -810,22 +810,22 @@ discard block |
||
| 810 | 810 | * @param string $post_id The post ID. |
| 811 | 811 | * @param string $user_id The user ID. |
| 812 | 812 | */ |
| 813 | - $headers = apply_filters('geodir_sendEmail_headers',$headers,$fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
|
|
| 813 | + $headers = apply_filters('geodir_sendEmail_headers', $headers, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
|
|
| 814 | 814 | |
| 815 | 815 | $sent = wp_mail($to, $subject, $message, $headers); |
| 816 | 816 | |
| 817 | - if( ! $sent ) {
|
|
| 818 | - if ( is_array( $to ) ) {
|
|
| 819 | - $to = implode( ',', $to ); |
|
| 817 | + if (!$sent) {
|
|
| 818 | + if (is_array($to)) {
|
|
| 819 | + $to = implode(',', $to);
|
|
| 820 | 820 | } |
| 821 | 821 | $log_message = sprintf( |
| 822 | - __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ), |
|
| 822 | + __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
|
|
| 823 | 823 | $message_type, |
| 824 | - date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ), |
|
| 824 | + date_i18n('F j Y H:i:s', current_time('timestamp')),
|
|
| 825 | 825 | $to, |
| 826 | 826 | $subject |
| 827 | 827 | ); |
| 828 | - geodir_error_log( $log_message ); |
|
| 828 | + geodir_error_log($log_message); |
|
| 829 | 829 | } |
| 830 | 830 | |
| 831 | 831 | ///////// ADMIN BCC EMIALS |
@@ -837,11 +837,11 @@ discard block |
||
| 837 | 837 | $subject = __(stripslashes_deep(get_option('geodir_post_submited_success_email_subject_admin')), 'geodirectory');
|
| 838 | 838 | $message = __(stripslashes_deep(get_option('geodir_post_submited_success_email_content_admin')), 'geodirectory');
|
| 839 | 839 | |
| 840 | - $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]', '[#posted_date#]','[#user_login#]','[#username#]');
|
|
| 840 | + $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]', '[#posted_date#]', '[#user_login#]', '[#username#]');
|
|
| 841 | 841 | $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName, $posted_date, $user_login, $user_login); |
| 842 | 842 | $message = str_replace($search_array, $replace_array, $message); |
| 843 | 843 | |
| 844 | - $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]','[#user_login#]','[#username#]');
|
|
| 844 | + $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]', '[#user_login#]', '[#username#]');
|
|
| 845 | 845 | $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName, $posted_date, $user_login, $user_login); |
| 846 | 846 | $subject = str_replace($search_array, $replace_array, $subject); |
| 847 | 847 | |
@@ -866,21 +866,21 @@ discard block |
||
| 866 | 866 | $admin_bcc = true; |
| 867 | 867 | } |
| 868 | 868 | |
| 869 | - if($admin_bcc===true){
|
|
| 869 | + if ($admin_bcc === true) {
|
|
| 870 | 870 | $sent = wp_mail($to, $subject, $message, $headers); |
| 871 | 871 | |
| 872 | - if( ! $sent ) {
|
|
| 873 | - if ( is_array( $to ) ) {
|
|
| 874 | - $to = implode( ',', $to ); |
|
| 872 | + if (!$sent) {
|
|
| 873 | + if (is_array($to)) {
|
|
| 874 | + $to = implode(',', $to);
|
|
| 875 | 875 | } |
| 876 | 876 | $log_message = sprintf( |
| 877 | - __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ), |
|
| 877 | + __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
|
|
| 878 | 878 | $message_type, |
| 879 | - date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ), |
|
| 879 | + date_i18n('F j Y H:i:s', current_time('timestamp')),
|
|
| 880 | 880 | $to, |
| 881 | 881 | $subject |
| 882 | 882 | ); |
| 883 | - geodir_error_log( $log_message ); |
|
| 883 | + geodir_error_log($log_message); |
|
| 884 | 884 | } |
| 885 | 885 | } |
| 886 | 886 | |
@@ -912,12 +912,12 @@ discard block |
||
| 912 | 912 | foreach ($parents as $parent): |
| 913 | 913 | $item = get_term_by('id', $parent, get_query_var('taxonomy'));
|
| 914 | 914 | $url = get_term_link($item, get_query_var('taxonomy'));
|
| 915 | - echo '<li> > <a href="' . $url . '">' . $item->name . '</a></li>'; |
|
| 915 | + echo '<li> > <a href="'.$url.'">'.$item->name.'</a></li>'; |
|
| 916 | 916 | endforeach; |
| 917 | 917 | |
| 918 | 918 | endif; |
| 919 | 919 | |
| 920 | - echo '<li> > ' . $term->name . '</li>'; |
|
| 920 | + echo '<li> > '.$term->name.'</li>'; |
|
| 921 | 921 | } |
| 922 | 922 | |
| 923 | 923 | |
@@ -951,7 +951,7 @@ discard block |
||
| 951 | 951 | * |
| 952 | 952 | * @since 1.0.0 |
| 953 | 953 | */ |
| 954 | - $breadcrumb .= '<li>' . apply_filters('geodir_breadcrumb_first_link', '<a href="' . home_url() . '">' . __('Home', 'geodirectory') . '</a>') . '</li>';
|
|
| 954 | + $breadcrumb .= '<li>'.apply_filters('geodir_breadcrumb_first_link', '<a href="'.home_url().'">'.__('Home', 'geodirectory').'</a>').'</li>';
|
|
| 955 | 955 | |
| 956 | 956 | $gd_post_type = geodir_get_current_posttype(); |
| 957 | 957 | $post_type_info = get_post_type_object($gd_post_type); |
@@ -975,7 +975,7 @@ discard block |
||
| 975 | 975 | $location_manager = defined('POST_LOCATION_TABLE') ? true : false;
|
| 976 | 976 | $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
|
| 977 | 977 | |
| 978 | - if(geodir_is_page('detail') && isset($post->country_slug)){
|
|
| 978 | + if (geodir_is_page('detail') && isset($post->country_slug)) {
|
|
| 979 | 979 | $location_terms = array( |
| 980 | 980 | 'gd_country' => $post->country_slug, |
| 981 | 981 | 'gd_region' => $post->region_slug, |
@@ -1030,12 +1030,12 @@ discard block |
||
| 1030 | 1030 | $is_location_last = ''; |
| 1031 | 1031 | $is_taxonomy_last = ''; |
| 1032 | 1032 | $breadcrumb .= '<li>'; |
| 1033 | - if (get_query_var($gd_post_type . 'category')) |
|
| 1034 | - $gd_taxonomy = $gd_post_type . 'category'; |
|
| 1035 | - elseif (get_query_var($gd_post_type . '_tags')) |
|
| 1036 | - $gd_taxonomy = $gd_post_type . '_tags'; |
|
| 1033 | + if (get_query_var($gd_post_type.'category')) |
|
| 1034 | + $gd_taxonomy = $gd_post_type.'category'; |
|
| 1035 | + elseif (get_query_var($gd_post_type.'_tags')) |
|
| 1036 | + $gd_taxonomy = $gd_post_type.'_tags'; |
|
| 1037 | 1037 | |
| 1038 | - $breadcrumb .= $separator . '<a href="' . $listing_link . '">' . __(ucfirst($post_type_info->label), 'geodirectory') . '</a>'; |
|
| 1038 | + $breadcrumb .= $separator.'<a href="'.$listing_link.'">'.__(ucfirst($post_type_info->label), 'geodirectory').'</a>'; |
|
| 1039 | 1039 | if (!empty($gd_taxonomy) || geodir_is_page('detail'))
|
| 1040 | 1040 | $is_location_last = false; |
| 1041 | 1041 | else |
@@ -1085,18 +1085,18 @@ discard block |
||
| 1085 | 1085 | } |
| 1086 | 1086 | |
| 1087 | 1087 | if ($is_location_last && $key == 'gd_country' && !(isset($location_terms['gd_region']) && $location_terms['gd_region'] != '') && !(isset($location_terms['gd_city']) && $location_terms['gd_city'] != '')) {
|
| 1088 | - $breadcrumb .= $location_term_actual_country != '' ? $separator . $location_term_actual_country : $separator . $gd_location_link_text; |
|
| 1088 | + $breadcrumb .= $location_term_actual_country != '' ? $separator.$location_term_actual_country : $separator.$gd_location_link_text; |
|
| 1089 | 1089 | } else if ($is_location_last && $key == 'gd_region' && !(isset($location_terms['gd_city']) && $location_terms['gd_city'] != '')) {
|
| 1090 | - $breadcrumb .= $location_term_actual_region != '' ? $separator . $location_term_actual_region : $separator . $gd_location_link_text; |
|
| 1090 | + $breadcrumb .= $location_term_actual_region != '' ? $separator.$location_term_actual_region : $separator.$gd_location_link_text; |
|
| 1091 | 1091 | } else if ($is_location_last && $key == 'gd_city' && empty($location_terms['gd_neighbourhood'])) {
|
| 1092 | - $breadcrumb .= $location_term_actual_city != '' ? $separator . $location_term_actual_city : $separator . $gd_location_link_text; |
|
| 1092 | + $breadcrumb .= $location_term_actual_city != '' ? $separator.$location_term_actual_city : $separator.$gd_location_link_text; |
|
| 1093 | 1093 | } else if ($is_location_last && $key == 'gd_neighbourhood') {
|
| 1094 | - $breadcrumb .= $separator . $gd_location_link_text; |
|
| 1094 | + $breadcrumb .= $separator.$gd_location_link_text; |
|
| 1095 | 1095 | } else {
|
| 1096 | 1096 | if (get_option('permalink_structure') != '') {
|
| 1097 | - $location_link .= $location_term . '/'; |
|
| 1097 | + $location_link .= $location_term.'/'; |
|
| 1098 | 1098 | } else {
|
| 1099 | - $location_link .= "&$key=" . $location_term; |
|
| 1099 | + $location_link .= "&$key=".$location_term; |
|
| 1100 | 1100 | } |
| 1101 | 1101 | |
| 1102 | 1102 | if ($key == 'gd_country' && $location_term_actual_country != '') {
|
@@ -1113,7 +1113,7 @@ discard block |
||
| 1113 | 1113 | } |
| 1114 | 1114 | */ |
| 1115 | 1115 | |
| 1116 | - $breadcrumb .= $separator . '<a href="' . $location_link . '">' . $gd_location_link_text . '</a>'; |
|
| 1116 | + $breadcrumb .= $separator.'<a href="'.$location_link.'">'.$gd_location_link_text.'</a>'; |
|
| 1117 | 1117 | } |
| 1118 | 1118 | } |
| 1119 | 1119 | } |
@@ -1124,8 +1124,8 @@ discard block |
||
| 1124 | 1124 | |
| 1125 | 1125 | //if(get_option('geodir_add_categories_url'))
|
| 1126 | 1126 | {
|
| 1127 | - if (get_query_var($gd_post_type . '_tags')) {
|
|
| 1128 | - $cat_link = $listing_link . 'tags/'; |
|
| 1127 | + if (get_query_var($gd_post_type.'_tags')) {
|
|
| 1128 | + $cat_link = $listing_link.'tags/'; |
|
| 1129 | 1129 | } else |
| 1130 | 1130 | $cat_link = $listing_link; |
| 1131 | 1131 | |
@@ -1136,7 +1136,7 @@ discard block |
||
| 1136 | 1136 | |
| 1137 | 1137 | if ($location_term != '') {
|
| 1138 | 1138 | if (get_option('permalink_structure') != '') {
|
| 1139 | - $cat_link .= $location_term . '/'; |
|
| 1139 | + $cat_link .= $location_term.'/'; |
|
| 1140 | 1140 | } |
| 1141 | 1141 | } |
| 1142 | 1142 | } |
@@ -1155,10 +1155,10 @@ discard block |
||
| 1155 | 1155 | } |
| 1156 | 1156 | |
| 1157 | 1157 | if ($term_index == count($term_array) && $is_taxonomy_last) |
| 1158 | - $breadcrumb .= $separator . $term_link_text; |
|
| 1158 | + $breadcrumb .= $separator.$term_link_text; |
|
| 1159 | 1159 | else {
|
| 1160 | - $cat_link .= $term . '/'; |
|
| 1161 | - $breadcrumb .= $separator . '<a href="' . $cat_link . '">' . $term_link_text . '</a>'; |
|
| 1160 | + $cat_link .= $term.'/'; |
|
| 1161 | + $breadcrumb .= $separator.'<a href="'.$cat_link.'">'.$term_link_text.'</a>'; |
|
| 1162 | 1162 | } |
| 1163 | 1163 | $term_index++; |
| 1164 | 1164 | } |
@@ -1168,7 +1168,7 @@ discard block |
||
| 1168 | 1168 | } |
| 1169 | 1169 | |
| 1170 | 1170 | if (geodir_is_page('detail'))
|
| 1171 | - $breadcrumb .= $separator . get_the_title(); |
|
| 1171 | + $breadcrumb .= $separator.get_the_title(); |
|
| 1172 | 1172 | |
| 1173 | 1173 | $breadcrumb .= '</li>'; |
| 1174 | 1174 | |
@@ -1188,7 +1188,7 @@ discard block |
||
| 1188 | 1188 | $default_author_link = apply_filters('geodir_dashboard_author_link', $default_author_link, $user_id);
|
| 1189 | 1189 | |
| 1190 | 1190 | $breadcrumb .= '<li>'; |
| 1191 | - $breadcrumb .= $separator . '<a href="' . $default_author_link . '">' . __('My Dashboard', 'geodirectory') . '</a>';
|
|
| 1191 | + $breadcrumb .= $separator.'<a href="'.$default_author_link.'">'.__('My Dashboard', 'geodirectory').'</a>';
|
|
| 1192 | 1192 | |
| 1193 | 1193 | if (isset($_REQUEST['list'])) {
|
| 1194 | 1194 | $author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true', 'stype' => $_REQUEST['stype']), false);
|
@@ -1203,20 +1203,20 @@ discard block |
||
| 1203 | 1203 | */ |
| 1204 | 1204 | $author_link = apply_filters('geodir_dashboard_author_link', $author_link, $user_id, $_REQUEST['stype']);
|
| 1205 | 1205 | |
| 1206 | - $breadcrumb .= $separator . '<a href="' . $author_link . '">' . __(ucfirst($post_type_info->label), 'geodirectory') . '</a>'; |
|
| 1207 | - $breadcrumb .= $separator . ucfirst(__('My', 'geodirectory') . ' ' . $_REQUEST['list']);
|
|
| 1206 | + $breadcrumb .= $separator.'<a href="'.$author_link.'">'.__(ucfirst($post_type_info->label), 'geodirectory').'</a>'; |
|
| 1207 | + $breadcrumb .= $separator.ucfirst(__('My', 'geodirectory').' '.$_REQUEST['list']);
|
|
| 1208 | 1208 | } else |
| 1209 | - $breadcrumb .= $separator . __(ucfirst($post_type_info->label), 'geodirectory'); |
|
| 1209 | + $breadcrumb .= $separator.__(ucfirst($post_type_info->label), 'geodirectory'); |
|
| 1210 | 1210 | |
| 1211 | 1211 | $breadcrumb .= '</li>'; |
| 1212 | 1212 | } elseif (is_category() || is_single()) {
|
| 1213 | 1213 | $category = get_the_category(); |
| 1214 | 1214 | if (is_category()) {
|
| 1215 | - $breadcrumb .= '<li>' . $separator . $category[0]->cat_name . '</li>'; |
|
| 1215 | + $breadcrumb .= '<li>'.$separator.$category[0]->cat_name.'</li>'; |
|
| 1216 | 1216 | } |
| 1217 | 1217 | if (is_single()) {
|
| 1218 | - $breadcrumb .= '<li>' . $separator . '<a href="' . get_category_link($category[0]->term_id) . '">' . $category[0]->cat_name . '</a></li>'; |
|
| 1219 | - $breadcrumb .= '<li>' . $separator . get_the_title() . '</li>'; |
|
| 1218 | + $breadcrumb .= '<li>'.$separator.'<a href="'.get_category_link($category[0]->term_id).'">'.$category[0]->cat_name.'</a></li>'; |
|
| 1219 | + $breadcrumb .= '<li>'.$separator.get_the_title().'</li>'; |
|
| 1220 | 1220 | } |
| 1221 | 1221 | /* End of my version ##################################################### */ |
| 1222 | 1222 | } else if (is_page()) {
|
@@ -1226,31 +1226,31 @@ discard block |
||
| 1226 | 1226 | $page_title = defined('GD_LOCATION') ? GD_LOCATION : __('Location', 'geodirectory');
|
| 1227 | 1227 | } |
| 1228 | 1228 | |
| 1229 | - $breadcrumb .= '<li>' . $separator; |
|
| 1229 | + $breadcrumb .= '<li>'.$separator; |
|
| 1230 | 1230 | $breadcrumb .= stripslashes_deep($page_title); |
| 1231 | 1231 | $breadcrumb .= '</li>'; |
| 1232 | 1232 | } else if (is_tag()) {
|
| 1233 | - $breadcrumb .= "<li> " . $separator . single_tag_title('',false) . '</li>';
|
|
| 1233 | + $breadcrumb .= "<li> ".$separator.single_tag_title('', false).'</li>';
|
|
| 1234 | 1234 | } else if (is_day()) {
|
| 1235 | - $breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
|
|
| 1235 | + $breadcrumb .= "<li> ".$separator.__(" Archive for", 'geodirectory')." ";
|
|
| 1236 | 1236 | the_time('F jS, Y');
|
| 1237 | 1237 | $breadcrumb .= '</li>'; |
| 1238 | 1238 | } else if (is_month()) {
|
| 1239 | - $breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
|
|
| 1239 | + $breadcrumb .= "<li> ".$separator.__(" Archive for", 'geodirectory')." ";
|
|
| 1240 | 1240 | the_time('F, Y');
|
| 1241 | 1241 | $breadcrumb .= '</li>'; |
| 1242 | 1242 | } else if (is_year()) {
|
| 1243 | - $breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
|
|
| 1243 | + $breadcrumb .= "<li> ".$separator.__(" Archive for", 'geodirectory')." ";
|
|
| 1244 | 1244 | the_time('Y');
|
| 1245 | 1245 | $breadcrumb .= '</li>'; |
| 1246 | 1246 | } else if (is_author()) {
|
| 1247 | - $breadcrumb .= "<li> " . $separator . __(" Author Archive", 'geodirectory');
|
|
| 1247 | + $breadcrumb .= "<li> ".$separator.__(" Author Archive", 'geodirectory');
|
|
| 1248 | 1248 | $breadcrumb .= '</li>'; |
| 1249 | 1249 | } else if (isset($_GET['paged']) && !empty($_GET['paged'])) {
|
| 1250 | - $breadcrumb .= "<li>" . $separator . __("Blog Archives", 'geodirectory');
|
|
| 1250 | + $breadcrumb .= "<li>".$separator.__("Blog Archives", 'geodirectory');
|
|
| 1251 | 1251 | $breadcrumb .= '</li>'; |
| 1252 | 1252 | } else if (is_search()) {
|
| 1253 | - $breadcrumb .= "<li> " . $separator . __(" Search Results", 'geodirectory');
|
|
| 1253 | + $breadcrumb .= "<li> ".$separator.__(" Search Results", 'geodirectory');
|
|
| 1254 | 1254 | $breadcrumb .= '</li>'; |
| 1255 | 1255 | } |
| 1256 | 1256 | $breadcrumb .= '</ul></div>'; |
@@ -1306,7 +1306,7 @@ discard block |
||
| 1306 | 1306 | function fetch_remote_file($url) |
| 1307 | 1307 | {
|
| 1308 | 1308 | // extract the file name and extension from the url |
| 1309 | - require_once(ABSPATH . 'wp-includes/pluggable.php'); |
|
| 1309 | + require_once(ABSPATH.'wp-includes/pluggable.php'); |
|
| 1310 | 1310 | $file_name = basename($url); |
| 1311 | 1311 | if (strpos($file_name, '?') !== false) {
|
| 1312 | 1312 | list($file_name) = explode('?', $file_name);
|
@@ -1338,7 +1338,7 @@ discard block |
||
| 1338 | 1338 | return new WP_Error('upload_dir_error', $upload['error']);
|
| 1339 | 1339 | |
| 1340 | 1340 | // fetch the remote url and write it to the placeholder file |
| 1341 | - $headers = wp_remote_get($url, array('stream' => true,'filename' => $upload['file']));
|
|
| 1341 | + $headers = wp_remote_get($url, array('stream' => true, 'filename' => $upload['file']));
|
|
| 1342 | 1342 | |
| 1343 | 1343 | $log_message = ''; |
| 1344 | 1344 | $filesize = filesize($upload['file']); |
@@ -1351,21 +1351,21 @@ discard block |
||
| 1351 | 1351 | $log_message = sprintf(__('Remote server returned error response %1$d %2$s', 'geodirectory'), esc_html($headers['response']), get_status_header_desc($headers['response']));
|
| 1352 | 1352 | } |
| 1353 | 1353 | elseif (isset($headers['headers']['content-length']) && $filesize != $headers['headers']['content-length']) {
|
| 1354 | - $log_message = __('Remote file is incorrect size', 'geodirectory');
|
|
| 1354 | + $log_message = __('Remote file is incorrect size', 'geodirectory');
|
|
| 1355 | 1355 | } |
| 1356 | 1356 | elseif (0 == $filesize) {
|
| 1357 | 1357 | $log_message = __('Zero size file downloaded', 'geodirectory');
|
| 1358 | 1358 | } |
| 1359 | 1359 | |
| 1360 | - if($log_message){
|
|
| 1360 | + if ($log_message) {
|
|
| 1361 | 1361 | $del = unlink($upload['file']); |
| 1362 | - if(!$del){geodir_error_log(__('GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory'));}
|
|
| 1363 | - return new WP_Error('import_file_error',$log_message );
|
|
| 1362 | + if (!$del) {geodir_error_log(__('GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory')); }
|
|
| 1363 | + return new WP_Error('import_file_error', $log_message);
|
|
| 1364 | 1364 | } |
| 1365 | 1365 | |
| 1366 | 1366 | if ($dummy && $add_to_cache && is_array($upload)) {
|
| 1367 | 1367 | $images = get_transient('cached_dummy_images');
|
| 1368 | - if(is_array($images)) |
|
| 1368 | + if (is_array($images)) |
|
| 1369 | 1369 | $images[$key] = $upload; |
| 1370 | 1370 | else |
| 1371 | 1371 | $images = array($key => $upload); |
@@ -1386,12 +1386,12 @@ discard block |
||
| 1386 | 1386 | */ |
| 1387 | 1387 | function geodir_max_upload_size() |
| 1388 | 1388 | {
|
| 1389 | - $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
|
|
| 1389 | + $max_filesize = (float) get_option('geodir_upload_max_filesize', 2);
|
|
| 1390 | 1390 | |
| 1391 | 1391 | if ($max_filesize > 0 && $max_filesize < 1) {
|
| 1392 | - $max_filesize = (int)($max_filesize * 1024) . 'kb'; |
|
| 1392 | + $max_filesize = (int) ($max_filesize * 1024).'kb'; |
|
| 1393 | 1393 | } else {
|
| 1394 | - $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb'; |
|
| 1394 | + $max_filesize = $max_filesize > 0 ? $max_filesize.'mb' : '2mb'; |
|
| 1395 | 1395 | } |
| 1396 | 1396 | |
| 1397 | 1397 | /** |
@@ -1414,7 +1414,7 @@ discard block |
||
| 1414 | 1414 | */ |
| 1415 | 1415 | function geodir_dummy_folder_exists() |
| 1416 | 1416 | {
|
| 1417 | - $path = geodir_plugin_path() . '/geodirectory-admin/dummy/'; |
|
| 1417 | + $path = geodir_plugin_path().'/geodirectory-admin/dummy/'; |
|
| 1418 | 1418 | if (!is_dir($path)) |
| 1419 | 1419 | return false; |
| 1420 | 1420 | else |
@@ -1458,35 +1458,35 @@ discard block |
||
| 1458 | 1458 | {
|
| 1459 | 1459 | global $wpdb; |
| 1460 | 1460 | if ($message_type == 'expiration') {
|
| 1461 | - $subject = stripslashes(__(get_option('renew_email_subject'),'geodirectory'));
|
|
| 1462 | - $client_message = stripslashes(__(get_option('renew_email_content'),'geodirectory'));
|
|
| 1461 | + $subject = stripslashes(__(get_option('renew_email_subject'), 'geodirectory'));
|
|
| 1462 | + $client_message = stripslashes(__(get_option('renew_email_content'), 'geodirectory'));
|
|
| 1463 | 1463 | } elseif ($message_type == 'post_submited') {
|
| 1464 | - $subject = __(get_option('post_submited_success_email_subject_admin'),'geodirectory');
|
|
| 1465 | - $client_message = __(get_option('post_submited_success_email_content_admin'),'geodirectory');
|
|
| 1464 | + $subject = __(get_option('post_submited_success_email_subject_admin'), 'geodirectory');
|
|
| 1465 | + $client_message = __(get_option('post_submited_success_email_content_admin'), 'geodirectory');
|
|
| 1466 | 1466 | } elseif ($message_type == 'renew') {
|
| 1467 | - $subject = __(get_option('post_renew_success_email_subject_admin'),'geodirectory');
|
|
| 1468 | - $client_message = __(get_option('post_renew_success_email_content_admin'),'geodirectory');
|
|
| 1467 | + $subject = __(get_option('post_renew_success_email_subject_admin'), 'geodirectory');
|
|
| 1468 | + $client_message = __(get_option('post_renew_success_email_content_admin'), 'geodirectory');
|
|
| 1469 | 1469 | } elseif ($message_type == 'upgrade') {
|
| 1470 | - $subject = __(get_option('post_upgrade_success_email_subject_admin'),'geodirectory');
|
|
| 1471 | - $client_message = __(get_option('post_upgrade_success_email_content_admin'),'geodirectory');
|
|
| 1470 | + $subject = __(get_option('post_upgrade_success_email_subject_admin'), 'geodirectory');
|
|
| 1471 | + $client_message = __(get_option('post_upgrade_success_email_content_admin'), 'geodirectory');
|
|
| 1472 | 1472 | } elseif ($message_type == 'claim_approved') {
|
| 1473 | - $subject = __(get_option('claim_approved_email_subject'),'geodirectory');
|
|
| 1474 | - $client_message = __(get_option('claim_approved_email_content'),'geodirectory');
|
|
| 1473 | + $subject = __(get_option('claim_approved_email_subject'), 'geodirectory');
|
|
| 1474 | + $client_message = __(get_option('claim_approved_email_content'), 'geodirectory');
|
|
| 1475 | 1475 | } elseif ($message_type == 'claim_rejected') {
|
| 1476 | - $subject = __(get_option('claim_rejected_email_subject'),'geodirectory');
|
|
| 1477 | - $client_message = __(get_option('claim_rejected_email_content'),'geodirectory');
|
|
| 1476 | + $subject = __(get_option('claim_rejected_email_subject'), 'geodirectory');
|
|
| 1477 | + $client_message = __(get_option('claim_rejected_email_content'), 'geodirectory');
|
|
| 1478 | 1478 | } elseif ($message_type == 'claim_requested') {
|
| 1479 | - $subject = __(get_option('claim_email_subject_admin'),'geodirectory');
|
|
| 1480 | - $client_message = __(get_option('claim_email_content_admin'),'geodirectory');
|
|
| 1479 | + $subject = __(get_option('claim_email_subject_admin'), 'geodirectory');
|
|
| 1480 | + $client_message = __(get_option('claim_email_content_admin'), 'geodirectory');
|
|
| 1481 | 1481 | } elseif ($message_type == 'auto_claim') {
|
| 1482 | - $subject = __(get_option('auto_claim_email_subject'),'geodirectory');
|
|
| 1483 | - $client_message = __(get_option('auto_claim_email_content'),'geodirectory');
|
|
| 1482 | + $subject = __(get_option('auto_claim_email_subject'), 'geodirectory');
|
|
| 1483 | + $client_message = __(get_option('auto_claim_email_content'), 'geodirectory');
|
|
| 1484 | 1484 | } elseif ($message_type == 'payment_success') {
|
| 1485 | - $subject = __(get_option('post_payment_success_admin_email_subject'),'geodirectory');
|
|
| 1486 | - $client_message = __(get_option('post_payment_success_admin_email_content'),'geodirectory');
|
|
| 1485 | + $subject = __(get_option('post_payment_success_admin_email_subject'), 'geodirectory');
|
|
| 1486 | + $client_message = __(get_option('post_payment_success_admin_email_content'), 'geodirectory');
|
|
| 1487 | 1487 | } elseif ($message_type == 'payment_fail') {
|
| 1488 | - $subject = __(get_option('post_payment_fail_admin_email_subject'),'geodirectory');
|
|
| 1489 | - $client_message = __(get_option('post_payment_fail_admin_email_content'),'geodirectory');
|
|
| 1488 | + $subject = __(get_option('post_payment_fail_admin_email_subject'), 'geodirectory');
|
|
| 1489 | + $client_message = __(get_option('post_payment_fail_admin_email_content'), 'geodirectory');
|
|
| 1490 | 1490 | } |
| 1491 | 1491 | $transaction_details = $custom_1; |
| 1492 | 1492 | $fromEmail = get_option('site_email');
|
@@ -1497,11 +1497,11 @@ discard block |
||
| 1497 | 1497 | $productlink = get_permalink($page_id); |
| 1498 | 1498 | $post_info = get_post($page_id); |
| 1499 | 1499 | $post_date = date('dS F,Y', strtotime($post_info->post_date));
|
| 1500 | - $listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>'; |
|
| 1500 | + $listingLink = '<a href="'.$productlink.'"><b>'.$post_info->post_title.'</b></a>'; |
|
| 1501 | 1501 | $loginurl = geodir_login_url(); |
| 1502 | - $loginurl_link = '<a href="' . $loginurl . '">login</a>'; |
|
| 1502 | + $loginurl_link = '<a href="'.$loginurl.'">login</a>'; |
|
| 1503 | 1503 | $siteurl = home_url(); |
| 1504 | - $siteurl_link = '<a href="' . $siteurl . '">' . $fromEmailName . '</a>'; |
|
| 1504 | + $siteurl_link = '<a href="'.$siteurl.'">'.$fromEmailName.'</a>'; |
|
| 1505 | 1505 | $user_info = get_userdata($user_id); |
| 1506 | 1506 | $user_email = $user_info->user_email; |
| 1507 | 1507 | $display_name = geodir_get_client_name($user_id); |
@@ -1515,14 +1515,14 @@ discard block |
||
| 1515 | 1515 | } else {
|
| 1516 | 1516 | $post_type = 'listing'; |
| 1517 | 1517 | } |
| 1518 | - $renew_link = '<a href="' . $siteurl . '?ptype=post_' . $post_type . '&renew=1&pid=' . $page_id . '">' . RENEW_LINK . '</a>'; |
|
| 1518 | + $renew_link = '<a href="'.$siteurl.'?ptype=post_'.$post_type.'&renew=1&pid='.$page_id.'">'.RENEW_LINK.'</a>'; |
|
| 1519 | 1519 | $search_array = array('[#client_name#]', '[#listing_link#]', '[#posted_date#]', '[#number_of_days#]', '[#number_of_grace_days#]', '[#login_url#]', '[#username#]', '[#user_email#]', '[#site_name_url#]', '[#renew_link#]', '[#post_id#]', '[#site_name#]', '[#transaction_details#]');
|
| 1520 | 1520 | $replace_array = array($display_name, $listingLink, $post_date, $alivedays, $number_of_grace_days, $loginurl_link, $user_login, $user_email, $siteurl_link, $renew_link, $page_id, $fromEmailName, $transaction_details); |
| 1521 | 1521 | $client_message = str_replace($search_array, $replace_array, $client_message); |
| 1522 | 1522 | $subject = str_replace($search_array, $replace_array, $subject); |
| 1523 | - $headers = 'MIME-Version: 1.0' . "\r\n"; |
|
| 1524 | - $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n"; |
|
| 1525 | - $headers .= 'From: ' . $fromEmailName . ' <' . $fromEmail . '>' . "\r\n"; |
|
| 1523 | + $headers = 'MIME-Version: 1.0'."\r\n"; |
|
| 1524 | + $headers .= 'Content-type: text/html; charset=UTF-8'."\r\n"; |
|
| 1525 | + $headers .= 'From: '.$fromEmailName.' <'.$fromEmail.'>'."\r\n"; |
|
| 1526 | 1526 | |
| 1527 | 1527 | $to = $fromEmail; |
| 1528 | 1528 | $message = $client_message; |
@@ -1539,7 +1539,7 @@ discard block |
||
| 1539 | 1539 | * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'. |
| 1540 | 1540 | * @param string $custom_1 Custom data to be sent. |
| 1541 | 1541 | */ |
| 1542 | - $to = apply_filters('geodir_adminEmail_to',$to,$page_id, $user_id, $message_type, $custom_1 );
|
|
| 1542 | + $to = apply_filters('geodir_adminEmail_to', $to, $page_id, $user_id, $message_type, $custom_1);
|
|
| 1543 | 1543 | /** |
| 1544 | 1544 | * Filter the admin email subject. |
| 1545 | 1545 | * |
@@ -1551,7 +1551,7 @@ discard block |
||
| 1551 | 1551 | * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'. |
| 1552 | 1552 | * @param string $custom_1 Custom data to be sent. |
| 1553 | 1553 | */ |
| 1554 | - $subject = apply_filters('geodir_adminEmail_subject',$subject,$page_id, $user_id, $message_type, $custom_1);
|
|
| 1554 | + $subject = apply_filters('geodir_adminEmail_subject', $subject, $page_id, $user_id, $message_type, $custom_1);
|
|
| 1555 | 1555 | /** |
| 1556 | 1556 | * Filter the admin email message. |
| 1557 | 1557 | * |
@@ -1563,7 +1563,7 @@ discard block |
||
| 1563 | 1563 | * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'. |
| 1564 | 1564 | * @param string $custom_1 Custom data to be sent. |
| 1565 | 1565 | */ |
| 1566 | - $message = apply_filters('geodir_adminEmail_message',$message,$page_id, $user_id, $message_type, $custom_1);
|
|
| 1566 | + $message = apply_filters('geodir_adminEmail_message', $message, $page_id, $user_id, $message_type, $custom_1);
|
|
| 1567 | 1567 | /** |
| 1568 | 1568 | * Filter the admin email headers. |
| 1569 | 1569 | * |
@@ -1575,23 +1575,23 @@ discard block |
||
| 1575 | 1575 | * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'. |
| 1576 | 1576 | * @param string $custom_1 Custom data to be sent. |
| 1577 | 1577 | */ |
| 1578 | - $headers = apply_filters('geodir_adminEmail_headers',$headers,$page_id, $user_id, $message_type, $custom_1);
|
|
| 1578 | + $headers = apply_filters('geodir_adminEmail_headers', $headers, $page_id, $user_id, $message_type, $custom_1);
|
|
| 1579 | 1579 | |
| 1580 | 1580 | |
| 1581 | 1581 | |
| 1582 | 1582 | $sent = wp_mail($to, $subject, $message, $headers); |
| 1583 | - if( ! $sent ) {
|
|
| 1584 | - if ( is_array( $to ) ) {
|
|
| 1585 | - $to = implode( ',', $to ); |
|
| 1583 | + if (!$sent) {
|
|
| 1584 | + if (is_array($to)) {
|
|
| 1585 | + $to = implode(',', $to);
|
|
| 1586 | 1586 | } |
| 1587 | 1587 | $log_message = sprintf( |
| 1588 | - __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ), |
|
| 1588 | + __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
|
|
| 1589 | 1589 | $message_type, |
| 1590 | - date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ), |
|
| 1590 | + date_i18n('F j Y H:i:s', current_time('timestamp')),
|
|
| 1591 | 1591 | $to, |
| 1592 | 1592 | $subject |
| 1593 | 1593 | ); |
| 1594 | - geodir_error_log( $log_message ); |
|
| 1594 | + geodir_error_log($log_message); |
|
| 1595 | 1595 | } |
| 1596 | 1596 | } |
| 1597 | 1597 | } |
@@ -1617,18 +1617,18 @@ discard block |
||
| 1617 | 1617 | {
|
| 1618 | 1618 | $login_details = ''; |
| 1619 | 1619 | if ($message_type == 'send_friend') {
|
| 1620 | - $subject = stripslashes(__(get_option('email_friend_subject'),'geodirectory'));
|
|
| 1621 | - $message = stripslashes(__(get_option('email_friend_content'),'geodirectory'));
|
|
| 1620 | + $subject = stripslashes(__(get_option('email_friend_subject'), 'geodirectory'));
|
|
| 1621 | + $message = stripslashes(__(get_option('email_friend_content'), 'geodirectory'));
|
|
| 1622 | 1622 | } elseif ($message_type == 'send_enquiry') {
|
| 1623 | - $subject = __(get_option('email_enquiry_subject'),'geodirectory');
|
|
| 1624 | - $message = __(get_option('email_enquiry_content'),'geodirectory');
|
|
| 1623 | + $subject = __(get_option('email_enquiry_subject'), 'geodirectory');
|
|
| 1624 | + $message = __(get_option('email_enquiry_content'), 'geodirectory');
|
|
| 1625 | 1625 | } elseif ($message_type == 'forgot_password') {
|
| 1626 | - $subject = __(get_option('forgot_password_subject'),'geodirectory');
|
|
| 1627 | - $message = __(get_option('forgot_password_content'),'geodirectory');
|
|
| 1626 | + $subject = __(get_option('forgot_password_subject'), 'geodirectory');
|
|
| 1627 | + $message = __(get_option('forgot_password_content'), 'geodirectory');
|
|
| 1628 | 1628 | $login_details = $to_message; |
| 1629 | 1629 | } elseif ($message_type == 'registration') {
|
| 1630 | - $subject = __(get_option('registration_success_email_subject'),'geodirectory');
|
|
| 1631 | - $message = __(get_option('registration_success_email_content'),'geodirectory');
|
|
| 1630 | + $subject = __(get_option('registration_success_email_subject'), 'geodirectory');
|
|
| 1631 | + $message = __(get_option('registration_success_email_content'), 'geodirectory');
|
|
| 1632 | 1632 | $login_details = $to_message; |
| 1633 | 1633 | } |
| 1634 | 1634 | $to_message = nl2br($to_message); |
@@ -1636,11 +1636,11 @@ discard block |
||
| 1636 | 1636 | $sitefromEmailName = get_site_emailName(); |
| 1637 | 1637 | $productlink = get_permalink($post_id); |
| 1638 | 1638 | $post_info = get_post($post_id); |
| 1639 | - $listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>'; |
|
| 1639 | + $listingLink = '<a href="'.$productlink.'"><b>'.$post_info->post_title.'</b></a>'; |
|
| 1640 | 1640 | $siteurl = home_url(); |
| 1641 | - $siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>'; |
|
| 1641 | + $siteurl_link = '<a href="'.$siteurl.'">'.$siteurl.'</a>'; |
|
| 1642 | 1642 | $loginurl = geodir_login_url(); |
| 1643 | - $loginurl_link = '<a href="' . $loginurl . '">login</a>'; |
|
| 1643 | + $loginurl_link = '<a href="'.$loginurl.'">login</a>'; |
|
| 1644 | 1644 | if ($fromEmail == '') {
|
| 1645 | 1645 | $fromEmail = get_option('site_email');
|
| 1646 | 1646 | } |
@@ -1654,26 +1654,26 @@ discard block |
||
| 1654 | 1654 | $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]');
|
| 1655 | 1655 | $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName); |
| 1656 | 1656 | $subject = str_replace($search_array, $replace_array, $subject); |
| 1657 | - $headers = 'MIME-Version: 1.0' . "\r\n"; |
|
| 1658 | - $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n"; |
|
| 1659 | - $headers .= "Reply-To: " . $fromEmail . "\r\n"; |
|
| 1660 | - $headers .= 'From: ' . $sitefromEmailName . ' <' . $sitefromEmail . '>' . "\r\n"; |
|
| 1657 | + $headers = 'MIME-Version: 1.0'."\r\n"; |
|
| 1658 | + $headers .= 'Content-type: text/html; charset=UTF-8'."\r\n"; |
|
| 1659 | + $headers .= "Reply-To: ".$fromEmail."\r\n"; |
|
| 1660 | + $headers .= 'From: '.$sitefromEmailName.' <'.$sitefromEmail.'>'."\r\n"; |
|
| 1661 | 1661 | |
| 1662 | 1662 | $to = $toEmail; |
| 1663 | 1663 | |
| 1664 | 1664 | $sent = wp_mail($to, $subject, $message, $headers); |
| 1665 | - if( ! $sent ) {
|
|
| 1666 | - if ( is_array( $to ) ) {
|
|
| 1667 | - $to = implode( ',', $to ); |
|
| 1665 | + if (!$sent) {
|
|
| 1666 | + if (is_array($to)) {
|
|
| 1667 | + $to = implode(',', $to);
|
|
| 1668 | 1668 | } |
| 1669 | 1669 | $log_message = sprintf( |
| 1670 | - __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ), |
|
| 1670 | + __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
|
|
| 1671 | 1671 | $message_type, |
| 1672 | - date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ), |
|
| 1672 | + date_i18n('F j Y H:i:s', current_time('timestamp')),
|
|
| 1673 | 1673 | $to, |
| 1674 | 1674 | $subject |
| 1675 | 1675 | ); |
| 1676 | - geodir_error_log( $log_message ); |
|
| 1676 | + geodir_error_log($log_message); |
|
| 1677 | 1677 | } |
| 1678 | 1678 | |
| 1679 | 1679 | ///////// ADMIN BCC EMIALS |
@@ -1681,7 +1681,7 @@ discard block |
||
| 1681 | 1681 | if ($message_type == 'registration') {
|
| 1682 | 1682 | $message_raw = explode(__("Password:", 'geodirectory'), $message);
|
| 1683 | 1683 | $message_raw2 = explode("</p>", $message_raw[1], 2);
|
| 1684 | - $message = $message_raw[0] . __('Password:', 'geodirectory') . ' **********</p>' . $message_raw2[1];
|
|
| 1684 | + $message = $message_raw[0].__('Password:', 'geodirectory').' **********</p>'.$message_raw2[1];
|
|
| 1685 | 1685 | } |
| 1686 | 1686 | $adminEmail = get_bloginfo('admin_email');
|
| 1687 | 1687 | $to = $adminEmail; |
@@ -1699,20 +1699,20 @@ discard block |
||
| 1699 | 1699 | $admin_bcc = true; |
| 1700 | 1700 | } |
| 1701 | 1701 | |
| 1702 | - if($admin_bcc === true){
|
|
| 1702 | + if ($admin_bcc === true) {
|
|
| 1703 | 1703 | $sent = wp_mail($to, $subject, $message, $headers); |
| 1704 | - if( ! $sent ) {
|
|
| 1705 | - if ( is_array( $to ) ) {
|
|
| 1706 | - $to = implode( ',', $to ); |
|
| 1704 | + if (!$sent) {
|
|
| 1705 | + if (is_array($to)) {
|
|
| 1706 | + $to = implode(',', $to);
|
|
| 1707 | 1707 | } |
| 1708 | 1708 | $log_message = sprintf( |
| 1709 | - __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ), |
|
| 1709 | + __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
|
|
| 1710 | 1710 | $message_type, |
| 1711 | - date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ), |
|
| 1711 | + date_i18n('F j Y H:i:s', current_time('timestamp')),
|
|
| 1712 | 1712 | $to, |
| 1713 | 1713 | $subject |
| 1714 | 1714 | ); |
| 1715 | - geodir_error_log( $log_message ); |
|
| 1715 | + geodir_error_log($log_message); |
|
| 1716 | 1716 | } |
| 1717 | 1717 | } |
| 1718 | 1718 | |
@@ -1760,7 +1760,7 @@ discard block |
||
| 1760 | 1760 | function geodir_custom_posts_body_class($classes) {
|
| 1761 | 1761 | global $wpdb, $wp; |
| 1762 | 1762 | $post_types = geodir_get_posttypes('object');
|
| 1763 | - if (!empty($post_types) && count((array)$post_types) > 1) {
|
|
| 1763 | + if (!empty($post_types) && count((array) $post_types) > 1) {
|
|
| 1764 | 1764 | $classes[] = 'geodir_custom_posts'; |
| 1765 | 1765 | } |
| 1766 | 1766 | |
@@ -1820,7 +1820,7 @@ discard block |
||
| 1820 | 1820 | $geodir_option = get_option($geodir_option_name); |
| 1821 | 1821 | |
| 1822 | 1822 | if (!empty($geodir_option)) {
|
| 1823 | - add_option($geodir_option_name . '_' . $version_date, $geodir_option); |
|
| 1823 | + add_option($geodir_option_name.'_'.$version_date, $geodir_option); |
|
| 1824 | 1824 | } |
| 1825 | 1825 | } |
| 1826 | 1826 | |
@@ -1926,36 +1926,36 @@ discard block |
||
| 1926 | 1926 | |
| 1927 | 1927 | $query_args = $gd_query_args_widgets; |
| 1928 | 1928 | if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
|
| 1929 | - return $wpdb->posts . ".post_date DESC, "; |
|
| 1929 | + return $wpdb->posts.".post_date DESC, "; |
|
| 1930 | 1930 | } |
| 1931 | 1931 | |
| 1932 | 1932 | $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type']; |
| 1933 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1933 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 1934 | 1934 | |
| 1935 | 1935 | $sort_by = !empty($query_args['order_by']) ? $query_args['order_by'] : ''; |
| 1936 | 1936 | |
| 1937 | 1937 | switch ($sort_by) {
|
| 1938 | 1938 | case 'latest': |
| 1939 | 1939 | case 'newest': |
| 1940 | - $orderby = $wpdb->posts . ".post_date DESC, "; |
|
| 1940 | + $orderby = $wpdb->posts.".post_date DESC, "; |
|
| 1941 | 1941 | break; |
| 1942 | 1942 | case 'featured': |
| 1943 | - $orderby = $table . ".is_featured ASC, "; |
|
| 1943 | + $orderby = $table.".is_featured ASC, "; |
|
| 1944 | 1944 | break; |
| 1945 | 1945 | case 'az': |
| 1946 | - $orderby = $wpdb->posts . ".post_title ASC, "; |
|
| 1946 | + $orderby = $wpdb->posts.".post_title ASC, "; |
|
| 1947 | 1947 | break; |
| 1948 | 1948 | case 'high_review': |
| 1949 | - $orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, "; |
|
| 1949 | + $orderby = $table.".rating_count DESC, ".$table.".overall_rating DESC, "; |
|
| 1950 | 1950 | break; |
| 1951 | 1951 | case 'high_rating': |
| 1952 | - $orderby = "( " . $table . ".overall_rating ) DESC, "; |
|
| 1952 | + $orderby = "( ".$table.".overall_rating ) DESC, "; |
|
| 1953 | 1953 | break; |
| 1954 | 1954 | case 'random': |
| 1955 | 1955 | $orderby = "RAND(), "; |
| 1956 | 1956 | break; |
| 1957 | 1957 | default: |
| 1958 | - $orderby = $wpdb->posts . ".post_title ASC, "; |
|
| 1958 | + $orderby = $wpdb->posts.".post_title ASC, "; |
|
| 1959 | 1959 | break; |
| 1960 | 1960 | } |
| 1961 | 1961 | |
@@ -1982,9 +1982,9 @@ discard block |
||
| 1982 | 1982 | $gd_query_args_widgets = $query_args; |
| 1983 | 1983 | |
| 1984 | 1984 | $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type']; |
| 1985 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1985 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 1986 | 1986 | |
| 1987 | - $fields = $wpdb->posts . ".*, " . $table . ".*"; |
|
| 1987 | + $fields = $wpdb->posts.".*, ".$table.".*"; |
|
| 1988 | 1988 | /** |
| 1989 | 1989 | * Filter widget listing fields string part that is being used for query. |
| 1990 | 1990 | * |
@@ -1995,7 +1995,7 @@ discard block |
||
| 1995 | 1995 | */ |
| 1996 | 1996 | $fields = apply_filters('geodir_filter_widget_listings_fields', $fields, $table, $post_type);
|
| 1997 | 1997 | |
| 1998 | - $join = "INNER JOIN " . $table . " ON (" . $table . ".post_id = " . $wpdb->posts . ".ID)";
|
|
| 1998 | + $join = "INNER JOIN ".$table." ON (".$table.".post_id = ".$wpdb->posts.".ID)";
|
|
| 1999 | 1999 | |
| 2000 | 2000 | ########### WPML ########### |
| 2001 | 2001 | |
@@ -2003,7 +2003,7 @@ discard block |
||
| 2003 | 2003 | global $sitepress; |
| 2004 | 2004 | $lang_code = ICL_LANGUAGE_CODE; |
| 2005 | 2005 | if ($lang_code) {
|
| 2006 | - $join .= " JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID"; |
|
| 2006 | + $join .= " JOIN ".$table_prefix."icl_translations icl_t ON icl_t.element_id = ".$table_prefix."posts.ID"; |
|
| 2007 | 2007 | } |
| 2008 | 2008 | } |
| 2009 | 2009 | |
@@ -2018,9 +2018,9 @@ discard block |
||
| 2018 | 2018 | */ |
| 2019 | 2019 | $join = apply_filters('geodir_filter_widget_listings_join', $join, $post_type);
|
| 2020 | 2020 | |
| 2021 | - $post_status = is_super_admin() ? " OR " . $wpdb->posts . ".post_status = 'private'" : ''; |
|
| 2021 | + $post_status = is_super_admin() ? " OR ".$wpdb->posts.".post_status = 'private'" : ''; |
|
| 2022 | 2022 | |
| 2023 | - $where = " AND ( " . $wpdb->posts . ".post_status = 'publish' " . $post_status . " ) AND " . $wpdb->posts . ".post_type = '" . $post_type . "'"; |
|
| 2023 | + $where = " AND ( ".$wpdb->posts.".post_status = 'publish' ".$post_status." ) AND ".$wpdb->posts.".post_type = '".$post_type."'"; |
|
| 2024 | 2024 | |
| 2025 | 2025 | ########### WPML ########### |
| 2026 | 2026 | if (function_exists('icl_object_id')) {
|
@@ -2037,7 +2037,7 @@ discard block |
||
| 2037 | 2037 | * @param string $post_type Post type. |
| 2038 | 2038 | */ |
| 2039 | 2039 | $where = apply_filters('geodir_filter_widget_listings_where', $where, $post_type);
|
| 2040 | - $where = $where != '' ? " WHERE 1=1 " . $where : ''; |
|
| 2040 | + $where = $where != '' ? " WHERE 1=1 ".$where : ''; |
|
| 2041 | 2041 | |
| 2042 | 2042 | $groupby = " GROUP BY $wpdb->posts.ID "; |
| 2043 | 2043 | /** |
@@ -2050,10 +2050,10 @@ discard block |
||
| 2050 | 2050 | $groupby = apply_filters('geodir_filter_widget_listings_groupby', $groupby, $post_type);
|
| 2051 | 2051 | |
| 2052 | 2052 | if ($count_only) {
|
| 2053 | - $sql = "SELECT COUNT(" . $wpdb->posts . ".ID) AS total FROM " . $wpdb->posts . "
|
|
| 2054 | - " . $join . " |
|
| 2053 | + $sql = "SELECT COUNT(".$wpdb->posts.".ID) AS total FROM ".$wpdb->posts."
|
|
| 2054 | + " . $join." |
|
| 2055 | 2055 | " . $where; |
| 2056 | - $rows = (int)$wpdb->get_var($sql); |
|
| 2056 | + $rows = (int) $wpdb->get_var($sql); |
|
| 2057 | 2057 | } else {
|
| 2058 | 2058 | $orderby = geodir_widget_listings_get_order($query_args); |
| 2059 | 2059 | /** |
@@ -2065,8 +2065,8 @@ discard block |
||
| 2065 | 2065 | * @param string $post_type Post type. |
| 2066 | 2066 | */ |
| 2067 | 2067 | $orderby = apply_filters('geodir_filter_widget_listings_orderby', $orderby, $table, $post_type);
|
| 2068 | - $orderby .= $wpdb->posts . ".post_title ASC"; |
|
| 2069 | - $orderby = $orderby != '' ? " ORDER BY " . $orderby : ''; |
|
| 2068 | + $orderby .= $wpdb->posts.".post_title ASC"; |
|
| 2069 | + $orderby = $orderby != '' ? " ORDER BY ".$orderby : ''; |
|
| 2070 | 2070 | |
| 2071 | 2071 | $limit = !empty($query_args['posts_per_page']) ? $query_args['posts_per_page'] : 5; |
| 2072 | 2072 | /** |
@@ -2079,16 +2079,16 @@ discard block |
||
| 2079 | 2079 | $limit = apply_filters('geodir_filter_widget_listings_limit', $limit, $post_type);
|
| 2080 | 2080 | |
| 2081 | 2081 | $page = !empty($query_args['pageno']) ? absint($query_args['pageno']) : 1; |
| 2082 | - if ( !$page ) |
|
| 2082 | + if (!$page) |
|
| 2083 | 2083 | $page = 1; |
| 2084 | 2084 | |
| 2085 | - $limit = (int)$limit > 0 ? " LIMIT " . absint( ( $page - 1 ) * (int)$limit ) . ", " . (int)$limit : ""; |
|
| 2085 | + $limit = (int) $limit > 0 ? " LIMIT ".absint(($page - 1) * (int) $limit).", ".(int) $limit : ""; |
|
| 2086 | 2086 | |
| 2087 | - $sql = "SELECT SQL_CALC_FOUND_ROWS " . $fields . " FROM " . $wpdb->posts . " |
|
| 2088 | - " . $join . " |
|
| 2089 | - " . $where . " |
|
| 2090 | - " . $groupby . " |
|
| 2091 | - " . $orderby . " |
|
| 2087 | + $sql = "SELECT SQL_CALC_FOUND_ROWS ".$fields." FROM ".$wpdb->posts." |
|
| 2088 | + " . $join." |
|
| 2089 | + " . $where." |
|
| 2090 | + " . $groupby." |
|
| 2091 | + " . $orderby." |
|
| 2092 | 2092 | " . $limit; |
| 2093 | 2093 | $rows = $wpdb->get_results($sql); |
| 2094 | 2094 | } |
@@ -2141,10 +2141,10 @@ discard block |
||
| 2141 | 2141 | } |
| 2142 | 2142 | |
| 2143 | 2143 | $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type']; |
| 2144 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 2144 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 2145 | 2145 | |
| 2146 | 2146 | if (!empty($query_args['with_pics_only'])) {
|
| 2147 | - $join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )"; |
|
| 2147 | + $join .= " LEFT JOIN ".GEODIR_ATTACHMENT_TABLE." ON ( ".GEODIR_ATTACHMENT_TABLE.".post_id=".$table.".post_id AND ".GEODIR_ATTACHMENT_TABLE.".mime_type LIKE '%image%' )"; |
|
| 2148 | 2148 | } |
| 2149 | 2149 | |
| 2150 | 2150 | if (!empty($query_args['tax_query'])) {
|
@@ -2176,7 +2176,7 @@ discard block |
||
| 2176 | 2176 | return $where; |
| 2177 | 2177 | } |
| 2178 | 2178 | $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type']; |
| 2179 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 2179 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 2180 | 2180 | |
| 2181 | 2181 | if (!empty($query_args)) {
|
| 2182 | 2182 | if (!empty($query_args['gd_location']) && function_exists('geodir_default_location_where')) {
|
@@ -2184,27 +2184,27 @@ discard block |
||
| 2184 | 2184 | } |
| 2185 | 2185 | |
| 2186 | 2186 | if (!empty($query_args['post_author'])) {
|
| 2187 | - $where .= " AND " . $wpdb->posts . ".post_author = " . (int)$query_args['post_author']; |
|
| 2187 | + $where .= " AND ".$wpdb->posts.".post_author = ".(int) $query_args['post_author']; |
|
| 2188 | 2188 | } |
| 2189 | 2189 | |
| 2190 | 2190 | if (!empty($query_args['show_featured_only'])) {
|
| 2191 | - $where .= " AND " . $table . ".is_featured = '1'"; |
|
| 2191 | + $where .= " AND ".$table.".is_featured = '1'"; |
|
| 2192 | 2192 | } |
| 2193 | 2193 | |
| 2194 | 2194 | if (!empty($query_args['show_special_only'])) {
|
| 2195 | - $where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )"; |
|
| 2195 | + $where .= " AND ( ".$table.".geodir_special_offers != '' AND ".$table.".geodir_special_offers IS NOT NULL )"; |
|
| 2196 | 2196 | } |
| 2197 | 2197 | |
| 2198 | 2198 | if (!empty($query_args['with_pics_only'])) {
|
| 2199 | - $where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL "; |
|
| 2199 | + $where .= " AND ".GEODIR_ATTACHMENT_TABLE.".ID IS NOT NULL "; |
|
| 2200 | 2200 | } |
| 2201 | 2201 | |
| 2202 | 2202 | if (!empty($query_args['featured_image_only'])) {
|
| 2203 | - $where .= " AND " . $table . ".featured_image IS NOT NULL AND " . $table . ".featured_image!='' "; |
|
| 2203 | + $where .= " AND ".$table.".featured_image IS NOT NULL AND ".$table.".featured_image!='' "; |
|
| 2204 | 2204 | } |
| 2205 | 2205 | |
| 2206 | 2206 | if (!empty($query_args['with_videos_only'])) {
|
| 2207 | - $where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )"; |
|
| 2207 | + $where .= " AND ( ".$table.".geodir_video != '' AND ".$table.".geodir_video IS NOT NULL )"; |
|
| 2208 | 2208 | } |
| 2209 | 2209 | |
| 2210 | 2210 | if (!empty($query_args['tax_query'])) {
|
@@ -2261,7 +2261,7 @@ discard block |
||
| 2261 | 2261 | } |
| 2262 | 2262 | |
| 2263 | 2263 | if (!empty($query_args) && !empty($query_args['posts_per_page'])) {
|
| 2264 | - $limit = (int)$query_args['posts_per_page']; |
|
| 2264 | + $limit = (int) $query_args['posts_per_page']; |
|
| 2265 | 2265 | } |
| 2266 | 2266 | |
| 2267 | 2267 | return $limit; |
@@ -2404,9 +2404,9 @@ discard block |
||
| 2404 | 2404 | add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
|
| 2405 | 2405 | } |
| 2406 | 2406 | $home_url = str_replace("www.", "", $home_url);
|
| 2407 | - if ( (strpos($home_url, $cur_url) !== false || strpos($home_url . '/', $cur_url) !== false) && ('page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front')==get_option('geodir_home_page')) ) {
|
|
| 2407 | + if ((strpos($home_url, $cur_url) !== false || strpos($home_url.'/', $cur_url) !== false) && ('page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front') == get_option('geodir_home_page'))) {
|
|
| 2408 | 2408 | return true; |
| 2409 | - }elseif(get_query_var('page_id') == get_option('page_on_front') && 'page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front')==get_option('geodir_home_page')){
|
|
| 2409 | + }elseif (get_query_var('page_id') == get_option('page_on_front') && 'page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front') == get_option('geodir_home_page')) {
|
|
| 2410 | 2410 | return true; |
| 2411 | 2411 | } else {
|
| 2412 | 2412 | return false; |
@@ -2489,19 +2489,19 @@ discard block |
||
| 2489 | 2489 | |
| 2490 | 2490 | $gd_post_type = geodir_get_current_posttype(); |
| 2491 | 2491 | |
| 2492 | - $category_limit = isset($instance['category_limit']) && $instance['category_limit'] > 0 ? (int)$instance['category_limit'] : 15; |
|
| 2493 | - if(!empty($gd_post_type)){
|
|
| 2492 | + $category_limit = isset($instance['category_limit']) && $instance['category_limit'] > 0 ? (int) $instance['category_limit'] : 15; |
|
| 2493 | + if (!empty($gd_post_type)) {
|
|
| 2494 | 2494 | $default_post_type = $gd_post_type; |
| 2495 | - }elseif(isset($instance['default_post_type']) && gdsc_is_post_type_valid($instance['default_post_type']) ){
|
|
| 2495 | + }elseif (isset($instance['default_post_type']) && gdsc_is_post_type_valid($instance['default_post_type'])) {
|
|
| 2496 | 2496 | $default_post_type = $instance['default_post_type']; |
| 2497 | - }else{
|
|
| 2497 | + } else {
|
|
| 2498 | 2498 | $all_gd_post_type = geodir_get_posttypes(); |
| 2499 | 2499 | $default_post_type = (isset($all_gd_post_type[0])) ? $all_gd_post_type[0] : ''; |
| 2500 | 2500 | } |
| 2501 | 2501 | |
| 2502 | 2502 | $taxonomy = array(); |
| 2503 | 2503 | if (!empty($gd_post_type)) {
|
| 2504 | - $taxonomy[] = $gd_post_type . "category"; |
|
| 2504 | + $taxonomy[] = $gd_post_type."category"; |
|
| 2505 | 2505 | } else {
|
| 2506 | 2506 | $taxonomy = geodir_get_taxonomies($gd_post_type); |
| 2507 | 2507 | } |
@@ -2521,7 +2521,7 @@ discard block |
||
| 2521 | 2521 | $b_terms[$b_key] = geodir_sort_terms($b_val, 'count'); |
| 2522 | 2522 | } |
| 2523 | 2523 | |
| 2524 | - $default_taxonomy = $default_post_type != '' && isset($b_terms[$default_post_type . 'category']) ? $default_post_type . 'category' : ''; |
|
| 2524 | + $default_taxonomy = $default_post_type != '' && isset($b_terms[$default_post_type.'category']) ? $default_post_type.'category' : ''; |
|
| 2525 | 2525 | |
| 2526 | 2526 | $tax_change_output = ''; |
| 2527 | 2527 | if (count($b_terms) > 1) {
|
@@ -2529,20 +2529,20 @@ discard block |
||
| 2529 | 2529 | foreach ($b_terms as $key => $val) {
|
| 2530 | 2530 | $ptype = get_post_type_object(str_replace("category", "", $key));
|
| 2531 | 2531 | $cpt_name = __($ptype->labels->singular_name, 'geodirectory'); |
| 2532 | - $tax_change_output .= "<option value='$key' ". selected($key, $default_taxonomy, false) .">" . sprintf(__('%s Categories', 'geodirectory'),$cpt_name) . "</option>";
|
|
| 2532 | + $tax_change_output .= "<option value='$key' ".selected($key, $default_taxonomy, false).">".sprintf(__('%s Categories', 'geodirectory'), $cpt_name)."</option>";
|
|
| 2533 | 2533 | } |
| 2534 | 2534 | $tax_change_output .= "</select>"; |
| 2535 | 2535 | } |
| 2536 | 2536 | |
| 2537 | 2537 | if (!empty($b_terms)) {
|
| 2538 | - $terms = $default_taxonomy != '' && isset($b_terms[$default_taxonomy]) ? $b_terms[$default_taxonomy] : reset($b_terms);// get the first array |
|
| 2539 | - global $cat_count;//make global so we can change via function |
|
| 2538 | + $terms = $default_taxonomy != '' && isset($b_terms[$default_taxonomy]) ? $b_terms[$default_taxonomy] : reset($b_terms); // get the first array |
|
| 2539 | + global $cat_count; //make global so we can change via function |
|
| 2540 | 2540 | $cat_count = 0; |
| 2541 | 2541 | ?> |
| 2542 | 2542 | <div class="geodir-category-list-in clearfix"> |
| 2543 | 2543 | <div class="geodir-cat-list clearfix"> |
| 2544 | 2544 | <?php |
| 2545 | - echo $before_title . __($title) . $after_title; |
|
| 2545 | + echo $before_title.__($title).$after_title; |
|
| 2546 | 2546 | |
| 2547 | 2547 | echo $tax_change_output; |
| 2548 | 2548 | |
@@ -2559,8 +2559,8 @@ discard block |
||
| 2559 | 2559 | $hide = 'style="display:none;"'; |
| 2560 | 2560 | } |
| 2561 | 2561 | echo "<div class='geodir-cat-list-more' $hide >"; |
| 2562 | - echo '<a href="javascript:void(0)" class="geodir-morecat geodir-showcat">' . __('More Categories', 'geodirectory') . '</a>';
|
|
| 2563 | - echo '<a href="javascript:void(0)" class="geodir-morecat geodir-hidecat geodir-hide">' . __('Less Categories', 'geodirectory') . '</a>';
|
|
| 2562 | + echo '<a href="javascript:void(0)" class="geodir-morecat geodir-showcat">'.__('More Categories', 'geodirectory').'</a>';
|
|
| 2563 | + echo '<a href="javascript:void(0)" class="geodir-morecat geodir-hidecat geodir-hide">'.__('Less Categories', 'geodirectory').'</a>';
|
|
| 2564 | 2564 | echo "</div>"; |
| 2565 | 2565 | /* add scripts */ |
| 2566 | 2566 | add_action('wp_footer', 'geodir_popular_category_add_scripts', 100);
|
@@ -2600,7 +2600,7 @@ discard block |
||
| 2600 | 2600 | $class_row = $cat_count > $category_limit ? 'geodir-pcat-hide geodir-hide' : 'geodir-pcat-show'; |
| 2601 | 2601 | $total_post = $cat->count; |
| 2602 | 2602 | |
| 2603 | - $term_link = get_term_link( $cat, $cat->taxonomy ); |
|
| 2603 | + $term_link = get_term_link($cat, $cat->taxonomy); |
|
| 2604 | 2604 | /** |
| 2605 | 2605 | * Filer the category term link. |
| 2606 | 2606 | * |
@@ -2609,10 +2609,10 @@ discard block |
||
| 2609 | 2609 | * @param int $cat->term_id The term id. |
| 2610 | 2610 | * @param string $post_type Wordpress post type. |
| 2611 | 2611 | */ |
| 2612 | - $term_link = apply_filters( 'geodir_category_term_link', $term_link, $cat->term_id, $post_type ); |
|
| 2612 | + $term_link = apply_filters('geodir_category_term_link', $term_link, $cat->term_id, $post_type);
|
|
| 2613 | 2613 | |
| 2614 | - echo '<li class="' . $class_row . '"><a href="' . $term_link . '">'; |
|
| 2615 | - echo '<img alt="' . esc_attr($cat->name) . ' icon" style="height:20px;vertical-align:middle;" src="' . $term_icon_url . '"/> <span class="cat-link">'; echo $cat->name . '</span> <span class="geodir_term_class geodir_link_span geodir_category_class_' . $post_type . '_' . $cat->term_id . '">(' . $total_post . ')</span> ';
|
|
| 2614 | + echo '<li class="'.$class_row.'"><a href="'.$term_link.'">'; |
|
| 2615 | + echo '<img alt="'.esc_attr($cat->name).' icon" style="height:20px;vertical-align:middle;" src="'.$term_icon_url.'"/> <span class="cat-link">'; echo $cat->name.'</span> <span class="geodir_term_class geodir_link_span geodir_category_class_'.$post_type.'_'.$cat->term_id.'">('.$total_post.')</span> ';
|
|
| 2616 | 2616 | echo '</a></li>'; |
| 2617 | 2617 | } |
| 2618 | 2618 | } |
@@ -2743,29 +2743,29 @@ discard block |
||
| 2743 | 2743 | itemWidth: 75, |
| 2744 | 2744 | itemMargin: 5, |
| 2745 | 2745 | asNavFor: '#geodir_widget_slider', |
| 2746 | - rtl: <?php echo ( is_rtl() ? 'true' : 'false' ); /* fix rtl issue */ ?> |
|
| 2746 | + rtl: <?php echo (is_rtl() ? 'true' : 'false'); /* fix rtl issue */ ?> |
|
| 2747 | 2747 | }); |
| 2748 | 2748 | |
| 2749 | 2749 | jQuery('#geodir_widget_slider').flexslider({
|
| 2750 | - animation: "<?php echo $animation;?>", |
|
| 2750 | + animation: "<?php echo $animation; ?>", |
|
| 2751 | 2751 | selector: ".geodir-slides > li", |
| 2752 | 2752 | namespace: "geodir-", |
| 2753 | 2753 | controlNav: true, |
| 2754 | - animationLoop: <?php echo $animationLoop;?>, |
|
| 2755 | - slideshow: <?php echo $slideshow;?>, |
|
| 2756 | - slideshowSpeed: <?php echo $slideshowSpeed;?>, |
|
| 2757 | - animationSpeed: <?php echo $animationSpeed;?>, |
|
| 2758 | - directionNav: <?php echo $directionNav;?>, |
|
| 2759 | - maxItems: <?php echo $max_show;?>, |
|
| 2754 | + animationLoop: <?php echo $animationLoop; ?>, |
|
| 2755 | + slideshow: <?php echo $slideshow; ?>, |
|
| 2756 | + slideshowSpeed: <?php echo $slideshowSpeed; ?>, |
|
| 2757 | + animationSpeed: <?php echo $animationSpeed; ?>, |
|
| 2758 | + directionNav: <?php echo $directionNav; ?>, |
|
| 2759 | + maxItems: <?php echo $max_show; ?>, |
|
| 2760 | 2760 | move: 1, |
| 2761 | - <?php if($slide_width){ echo "itemWidth: ".$slide_width.",";}?>
|
|
| 2761 | + <?php if ($slide_width) { echo "itemWidth: ".$slide_width.","; }?>
|
|
| 2762 | 2762 | sync: "#geodir_widget_carousel", |
| 2763 | 2763 | start: function (slider) {
|
| 2764 | 2764 | jQuery('.geodir-listing-flex-loader').hide();
|
| 2765 | 2765 | jQuery('#geodir_widget_slider').css({'visibility': 'visible'});
|
| 2766 | 2766 | jQuery('#geodir_widget_carousel').css({'visibility': 'visible'});
|
| 2767 | 2767 | }, |
| 2768 | - rtl: <?php echo ( is_rtl() ? 'true' : 'false' ); /* fix rtl issue */ ?> |
|
| 2768 | + rtl: <?php echo (is_rtl() ? 'true' : 'false'); /* fix rtl issue */ ?> |
|
| 2769 | 2769 | }); |
| 2770 | 2770 | }); |
| 2771 | 2771 | </script> |
@@ -2801,12 +2801,12 @@ discard block |
||
| 2801 | 2801 | $widget_listings = geodir_get_widget_listings($query_args); |
| 2802 | 2802 | if (!empty($widget_listings) || (isset($with_no_results) && $with_no_results)) {
|
| 2803 | 2803 | if ($title) {
|
| 2804 | - echo $before_title . $title . $after_title; |
|
| 2804 | + echo $before_title.$title.$after_title; |
|
| 2805 | 2805 | } |
| 2806 | 2806 | |
| 2807 | 2807 | global $post; |
| 2808 | 2808 | |
| 2809 | - $current_post = $post;// keep current post info |
|
| 2809 | + $current_post = $post; // keep current post info |
|
| 2810 | 2810 | |
| 2811 | 2811 | $widget_main_slides = ''; |
| 2812 | 2812 | $nav_slides = ''; |
@@ -2824,11 +2824,11 @@ discard block |
||
| 2824 | 2824 | $widget_spacer_height = ((200 - $widget_image->height) / 2); |
| 2825 | 2825 | } |
| 2826 | 2826 | |
| 2827 | - $widget_main_slides .= '<li class="geodir-listing-slider-widget"><img class="geodir-listing-slider-spacer" src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:' . $widget_spacer_height . 'px !important;margin:0 auto;" width="100" />'; |
|
| 2827 | + $widget_main_slides .= '<li class="geodir-listing-slider-widget"><img class="geodir-listing-slider-spacer" src="'.geodir_plugin_url()."/geodirectory-assets/images/spacer.gif".'" alt="'.$widget_image->title.'" title="'.$widget_image->title.'" style="max-height:'.$widget_spacer_height.'px !important;margin:0 auto;" width="100" />'; |
|
| 2828 | 2828 | |
| 2829 | 2829 | $title = ''; |
| 2830 | 2830 | if ($show_title) {
|
| 2831 | - $title_html = '<div class="geodir-slider-title"><a href="' . get_permalink($post->ID) . '">' . get_the_title($post->ID) . '</a></div>'; |
|
| 2831 | + $title_html = '<div class="geodir-slider-title"><a href="'.get_permalink($post->ID).'">'.get_the_title($post->ID).'</a></div>'; |
|
| 2832 | 2832 | $post_id = $post->ID; |
| 2833 | 2833 | $post_permalink = get_permalink($post->ID); |
| 2834 | 2834 | $post_title = get_the_title($post->ID); |
@@ -2841,11 +2841,11 @@ discard block |
||
| 2841 | 2841 | * @param string $post_permalink The post permalink url. |
| 2842 | 2842 | * @param string $post_title The post title text. |
| 2843 | 2843 | */ |
| 2844 | - $title = apply_filters('geodir_listing_slider_title',$title_html,$post_id,$post_permalink,$post_title);
|
|
| 2844 | + $title = apply_filters('geodir_listing_slider_title', $title_html, $post_id, $post_permalink, $post_title);
|
|
| 2845 | 2845 | } |
| 2846 | 2846 | |
| 2847 | - $widget_main_slides .= $title . '<img src="' . $widget_image->src . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:200px;margin:0 auto;" /></li>'; |
|
| 2848 | - $nav_slides .= '<li><img src="' . $widget_image->src . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:48px;margin:0 auto;" /></li>'; |
|
| 2847 | + $widget_main_slides .= $title.'<img src="'.$widget_image->src.'" alt="'.$widget_image->title.'" title="'.$widget_image->title.'" style="max-height:200px;margin:0 auto;" /></li>'; |
|
| 2848 | + $nav_slides .= '<li><img src="'.$widget_image->src.'" alt="'.$widget_image->title.'" title="'.$widget_image->title.'" style="max-height:48px;margin:0 auto;" /></li>'; |
|
| 2849 | 2849 | $widget_slides++; |
| 2850 | 2850 | } |
| 2851 | 2851 | } |
@@ -2889,7 +2889,7 @@ discard block |
||
| 2889 | 2889 | $title = empty($instance['title']) ? __('My Dashboard', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
|
| 2890 | 2890 | |
| 2891 | 2891 | echo $before_widget; |
| 2892 | - echo $before_title . $title . $after_title; |
|
| 2892 | + echo $before_title.$title.$after_title; |
|
| 2893 | 2893 | |
| 2894 | 2894 | if (is_user_logged_in()) {
|
| 2895 | 2895 | global $current_user; |
@@ -2931,7 +2931,7 @@ discard block |
||
| 2931 | 2931 | */ |
| 2932 | 2932 | $add_link = apply_filters('geodir_dashboard_link_add_listing', $add_link, $key, $current_user->ID);
|
| 2933 | 2933 | |
| 2934 | - $addlisting_links .= '<option ' . $selected . ' value="' . $add_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>'; |
|
| 2934 | + $addlisting_links .= '<option '.$selected.' value="'.$add_link.'">'.__(ucfirst($name), 'geodirectory').'</option>'; |
|
| 2935 | 2935 | |
| 2936 | 2936 | } |
| 2937 | 2937 | } |
@@ -2977,7 +2977,7 @@ discard block |
||
| 2977 | 2977 | */ |
| 2978 | 2978 | $post_type_link = apply_filters('geodir_dashboard_link_favorite_listing', $post_type_link, $key, $current_user->ID);
|
| 2979 | 2979 | |
| 2980 | - $favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>'; |
|
| 2980 | + $favourite_links .= '<option '.$selected.' value="'.$post_type_link.'">'.__(ucfirst($name), 'geodirectory').'</option>'; |
|
| 2981 | 2981 | } |
| 2982 | 2982 | } |
| 2983 | 2983 | |
@@ -3022,7 +3022,7 @@ discard block |
||
| 3022 | 3022 | */ |
| 3023 | 3023 | $listing_link = apply_filters('geodir_dashboard_link_my_listing', $listing_link, $key, $current_user->ID);
|
| 3024 | 3024 | |
| 3025 | - $listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>'; |
|
| 3025 | + $listing_links .= '<option '.$selected.' value="'.$listing_link.'">'.__(ucfirst($name), 'geodirectory').'</option>'; |
|
| 3026 | 3026 | } |
| 3027 | 3027 | } |
| 3028 | 3028 | |
@@ -3205,7 +3205,7 @@ discard block |
||
| 3205 | 3205 | } |
| 3206 | 3206 | |
| 3207 | 3207 | if (empty($title) || $title == 'All') {
|
| 3208 | - $title .= ' ' . __(get_post_type_plural_label($post_type), 'geodirectory'); |
|
| 3208 | + $title .= ' '.__(get_post_type_plural_label($post_type), 'geodirectory'); |
|
| 3209 | 3209 | } |
| 3210 | 3210 | |
| 3211 | 3211 | $location_url = array(); |
@@ -3259,7 +3259,7 @@ discard block |
||
| 3259 | 3259 | $geodir_add_location_url = '1'; |
| 3260 | 3260 | } |
| 3261 | 3261 | |
| 3262 | - $viewall_url = get_term_link((int)$category[0], $post_type . 'category'); |
|
| 3262 | + $viewall_url = get_term_link((int) $category[0], $post_type.'category'); |
|
| 3263 | 3263 | |
| 3264 | 3264 | $geodir_add_location_url = NULL; |
| 3265 | 3265 | } |
@@ -3267,7 +3267,7 @@ discard block |
||
| 3267 | 3267 | $gd_session->set('gd_multi_location', 1);
|
| 3268 | 3268 | } |
| 3269 | 3269 | |
| 3270 | - if(is_wp_error( $viewall_url )){$viewall_url = '';}
|
|
| 3270 | + if (is_wp_error($viewall_url)) {$viewall_url = ''; }
|
|
| 3271 | 3271 | |
| 3272 | 3272 | $query_args = array( |
| 3273 | 3273 | 'posts_per_page' => $post_number, |
@@ -3333,7 +3333,7 @@ discard block |
||
| 3333 | 3333 | */ |
| 3334 | 3334 | do_action('geodir_before_view_all_link_in_widget'); ?>
|
| 3335 | 3335 | <div class="geodir_list_heading clearfix"> |
| 3336 | - <?php echo $before_title . $title . $after_title; ?> |
|
| 3336 | + <?php echo $before_title.$title.$after_title; ?> |
|
| 3337 | 3337 | <a href="<?php echo $viewall_url; ?>" |
| 3338 | 3338 | class="geodir-viewall"><?php _e('View all', 'geodirectory'); ?></a>
|
| 3339 | 3339 | </div> |
@@ -3419,9 +3419,9 @@ discard block |
||
| 3419 | 3419 | {
|
| 3420 | 3420 | global $wpdb, $plugin_prefix; |
| 3421 | 3421 | |
| 3422 | - $detail_table = $plugin_prefix . $post_type . '_detail'; |
|
| 3422 | + $detail_table = $plugin_prefix.$post_type.'_detail'; |
|
| 3423 | 3423 | |
| 3424 | - $sql = "SELECT COALESCE(SUM(rating_count),0) FROM " . $detail_table . " WHERE post_status = 'publish' AND rating_count > 0 AND FIND_IN_SET(" . $term_id . ", " . $taxonomy . ")";
|
|
| 3424 | + $sql = "SELECT COALESCE(SUM(rating_count),0) FROM ".$detail_table." WHERE post_status = 'publish' AND rating_count > 0 AND FIND_IN_SET(".$term_id.", ".$taxonomy.")";
|
|
| 3425 | 3425 | |
| 3426 | 3426 | /** |
| 3427 | 3427 | * Filter count review sql query. |
@@ -3460,7 +3460,7 @@ discard block |
||
| 3460 | 3460 | * @param bool $force_update Force update option value?. Default.false. |
| 3461 | 3461 | * @param int $post_ID The post id to update if any. |
| 3462 | 3462 | */ |
| 3463 | - $option_data = apply_filters('geodir_count_reviews_by_terms_before', '', $force_update,$post_ID);
|
|
| 3463 | + $option_data = apply_filters('geodir_count_reviews_by_terms_before', '', $force_update, $post_ID);
|
|
| 3464 | 3464 | if (!empty($option_data)) {
|
| 3465 | 3465 | return $option_data; |
| 3466 | 3466 | } |
@@ -3468,11 +3468,11 @@ discard block |
||
| 3468 | 3468 | $option_data = get_option('geodir_global_review_count');
|
| 3469 | 3469 | |
| 3470 | 3470 | if (!$option_data || $force_update) {
|
| 3471 | - if ((int)$post_ID > 0) { // Update reviews count for specific post categories only.
|
|
| 3471 | + if ((int) $post_ID > 0) { // Update reviews count for specific post categories only.
|
|
| 3472 | 3472 | global $gd_session; |
| 3473 | - $term_array = (array)$option_data; |
|
| 3473 | + $term_array = (array) $option_data; |
|
| 3474 | 3474 | $post_type = get_post_type($post_ID); |
| 3475 | - $taxonomy = $post_type . 'category'; |
|
| 3475 | + $taxonomy = $post_type.'category'; |
|
| 3476 | 3476 | $terms = wp_get_object_terms($post_ID, $taxonomy, array('fields' => 'ids'));
|
| 3477 | 3477 | |
| 3478 | 3478 | if (!empty($terms) && !is_wp_error($terms)) {
|
@@ -3487,9 +3487,9 @@ discard block |
||
| 3487 | 3487 | |
| 3488 | 3488 | $terms = array(); |
| 3489 | 3489 | if (isset($_POST['post_category'][$taxonomy])) {
|
| 3490 | - $terms = (array)$_POST['post_category'][$taxonomy]; |
|
| 3490 | + $terms = (array) $_POST['post_category'][$taxonomy]; |
|
| 3491 | 3491 | } else if (!empty($session_listing) && isset($session_listing['post_category'][$taxonomy])) {
|
| 3492 | - $terms = (array)$session_listing['post_category'][$taxonomy]; |
|
| 3492 | + $terms = (array) $session_listing['post_category'][$taxonomy]; |
|
| 3493 | 3493 | } |
| 3494 | 3494 | |
| 3495 | 3495 | if (!empty($terms)) {
|
@@ -3577,7 +3577,7 @@ discard block |
||
| 3577 | 3577 | return true; |
| 3578 | 3578 | } |
| 3579 | 3579 | |
| 3580 | -function geodir_term_review_count_force_update_single_post($post_id){
|
|
| 3580 | +function geodir_term_review_count_force_update_single_post($post_id) {
|
|
| 3581 | 3581 | geodir_count_reviews_by_terms(true, $post_id); |
| 3582 | 3582 | } |
| 3583 | 3583 | |
@@ -3714,17 +3714,17 @@ discard block |
||
| 3714 | 3714 | */ |
| 3715 | 3715 | $locale = apply_filters('plugin_locale', get_locale(), 'geodirectory');
|
| 3716 | 3716 | |
| 3717 | - load_textdomain('geodirectory', WP_LANG_DIR . '/' . 'geodirectory' . '/' . 'geodirectory' . '-' . $locale . '.mo');
|
|
| 3718 | - load_plugin_textdomain('geodirectory', false, plugin_basename(dirname(dirname(__FILE__))) . '/geodirectory-languages');
|
|
| 3717 | + load_textdomain('geodirectory', WP_LANG_DIR.'/'.'geodirectory'.'/'.'geodirectory'.'-'.$locale.'.mo');
|
|
| 3718 | + load_plugin_textdomain('geodirectory', false, plugin_basename(dirname(dirname(__FILE__))).'/geodirectory-languages');
|
|
| 3719 | 3719 | |
| 3720 | 3720 | /** |
| 3721 | 3721 | * Define language constants. |
| 3722 | 3722 | * |
| 3723 | 3723 | * @since 1.0.0 |
| 3724 | 3724 | */ |
| 3725 | - require_once(geodir_plugin_path() . '/language.php'); |
|
| 3725 | + require_once(geodir_plugin_path().'/language.php'); |
|
| 3726 | 3726 | |
| 3727 | - $language_file = geodir_plugin_path() . '/db-language.php'; |
|
| 3727 | + $language_file = geodir_plugin_path().'/db-language.php'; |
|
| 3728 | 3728 | |
| 3729 | 3729 | // Load language string file if not created yet |
| 3730 | 3730 | if (!file_exists($language_file)) {
|
@@ -3739,8 +3739,8 @@ discard block |
||
| 3739 | 3739 | */ |
| 3740 | 3740 | try {
|
| 3741 | 3741 | require_once($language_file); |
| 3742 | - } catch(Exception $e) {
|
|
| 3743 | - error_log('Language Error: ' . $e->getMessage());
|
|
| 3742 | + } catch (Exception $e) {
|
|
| 3743 | + error_log('Language Error: '.$e->getMessage());
|
|
| 3744 | 3744 | } |
| 3745 | 3745 | } |
| 3746 | 3746 | } |
@@ -3757,18 +3757,18 @@ discard block |
||
| 3757 | 3757 | */ |
| 3758 | 3758 | function geodirectory_load_db_language() {
|
| 3759 | 3759 | global $wp_filesystem; |
| 3760 | - if( empty( $wp_filesystem ) ) {
|
|
| 3761 | - require_once( ABSPATH .'/wp-admin/includes/file.php' ); |
|
| 3760 | + if (empty($wp_filesystem)) {
|
|
| 3761 | + require_once(ABSPATH.'/wp-admin/includes/file.php'); |
|
| 3762 | 3762 | WP_Filesystem(); |
| 3763 | 3763 | global $wp_filesystem; |
| 3764 | 3764 | } |
| 3765 | 3765 | |
| 3766 | - $language_file = geodir_plugin_path() . '/db-language.php'; |
|
| 3766 | + $language_file = geodir_plugin_path().'/db-language.php'; |
|
| 3767 | 3767 | |
| 3768 | - if(is_file($language_file) && !is_writable($language_file)) |
|
| 3768 | + if (is_file($language_file) && !is_writable($language_file)) |
|
| 3769 | 3769 | return false; // Not possible to create. |
| 3770 | 3770 | |
| 3771 | - if(!is_file($language_file) && !is_writable(dirname($language_file))) |
|
| 3771 | + if (!is_file($language_file) && !is_writable(dirname($language_file))) |
|
| 3772 | 3772 | return false; // Not possible to create. |
| 3773 | 3773 | |
| 3774 | 3774 | $contents_strings = array(); |
@@ -3802,17 +3802,17 @@ discard block |
||
| 3802 | 3802 | $contents = implode(PHP_EOL, $contents_head); |
| 3803 | 3803 | |
| 3804 | 3804 | if (!empty($contents_strings)) {
|
| 3805 | - foreach ( $contents_strings as $string ) {
|
|
| 3805 | + foreach ($contents_strings as $string) {
|
|
| 3806 | 3806 | if (is_scalar($string) && $string != '') {
|
| 3807 | 3807 | $string = str_replace("'", "\'", $string);
|
| 3808 | - $contents .= PHP_EOL . "__('" . $string . "', 'geodirectory');";
|
|
| 3808 | + $contents .= PHP_EOL."__('".$string."', 'geodirectory');";
|
|
| 3809 | 3809 | } |
| 3810 | 3810 | } |
| 3811 | 3811 | } |
| 3812 | 3812 | |
| 3813 | 3813 | $contents .= implode(PHP_EOL, $contents_foot); |
| 3814 | 3814 | |
| 3815 | - if($wp_filesystem->put_contents( $language_file, $contents, FS_CHMOD_FILE)) |
|
| 3815 | + if ($wp_filesystem->put_contents($language_file, $contents, FS_CHMOD_FILE)) |
|
| 3816 | 3816 | return false; // Failure; could not write file. |
| 3817 | 3817 | |
| 3818 | 3818 | return true; |
@@ -3834,11 +3834,11 @@ discard block |
||
| 3834 | 3834 | global $wpdb; |
| 3835 | 3835 | |
| 3836 | 3836 | // Custom fields table |
| 3837 | - $sql = "SELECT admin_title, admin_desc, site_title, clabels, required_msg, default_value, option_values FROM " . GEODIR_CUSTOM_FIELDS_TABLE; |
|
| 3837 | + $sql = "SELECT admin_title, admin_desc, site_title, clabels, required_msg, default_value, option_values FROM ".GEODIR_CUSTOM_FIELDS_TABLE; |
|
| 3838 | 3838 | $rows = $wpdb->get_results($sql); |
| 3839 | 3839 | |
| 3840 | 3840 | if (!empty($rows)) {
|
| 3841 | - foreach($rows as $row) {
|
|
| 3841 | + foreach ($rows as $row) {
|
|
| 3842 | 3842 | if (!empty($row->admin_title)) |
| 3843 | 3843 | $translation_texts[] = stripslashes_deep($row->admin_title); |
| 3844 | 3844 | |
@@ -3872,11 +3872,11 @@ discard block |
||
| 3872 | 3872 | } |
| 3873 | 3873 | |
| 3874 | 3874 | // Custom sorting fields table |
| 3875 | - $sql = "SELECT site_title, asc_title, desc_title FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE; |
|
| 3875 | + $sql = "SELECT site_title, asc_title, desc_title FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE; |
|
| 3876 | 3876 | $rows = $wpdb->get_results($sql); |
| 3877 | 3877 | |
| 3878 | 3878 | if (!empty($rows)) {
|
| 3879 | - foreach($rows as $row) {
|
|
| 3879 | + foreach ($rows as $row) {
|
|
| 3880 | 3880 | if (!empty($row->site_title)) |
| 3881 | 3881 | $translation_texts[] = stripslashes_deep($row->site_title); |
| 3882 | 3882 | |
@@ -3890,11 +3890,11 @@ discard block |
||
| 3890 | 3890 | |
| 3891 | 3891 | // Advance search filter fields table |
| 3892 | 3892 | if (defined('GEODIR_ADVANCE_SEARCH_TABLE')) {
|
| 3893 | - $sql = "SELECT field_site_name, front_search_title, field_desc FROM " . GEODIR_ADVANCE_SEARCH_TABLE; |
|
| 3893 | + $sql = "SELECT field_site_name, front_search_title, field_desc FROM ".GEODIR_ADVANCE_SEARCH_TABLE; |
|
| 3894 | 3894 | $rows = $wpdb->get_results($sql); |
| 3895 | 3895 | |
| 3896 | 3896 | if (!empty($rows)) {
|
| 3897 | - foreach($rows as $row) {
|
|
| 3897 | + foreach ($rows as $row) {
|
|
| 3898 | 3898 | if (!empty($row->field_site_name)) |
| 3899 | 3899 | $translation_texts[] = stripslashes_deep($row->field_site_name); |
| 3900 | 3900 | |
@@ -3929,7 +3929,7 @@ discard block |
||
| 3929 | 3929 | * |
| 3930 | 3930 | * @param array $geodir_allowed_mime_types and file extensions. |
| 3931 | 3931 | */ |
| 3932 | - return apply_filters( 'geodir_allowed_mime_types', array( |
|
| 3932 | + return apply_filters('geodir_allowed_mime_types', array(
|
|
| 3933 | 3933 | 'Image' => array( // Image formats. |
| 3934 | 3934 | 'jpg' => 'image/jpeg', |
| 3935 | 3935 | 'jpe' => 'image/jpeg', |
@@ -4018,13 +4018,13 @@ discard block |
||
| 4018 | 4018 | |
| 4019 | 4019 | |
| 4020 | 4020 | |
| 4021 | -add_filter('wpseo_replacements','geodir_wpseo_replacements',10,1);
|
|
| 4021 | +add_filter('wpseo_replacements', 'geodir_wpseo_replacements', 10, 1);
|
|
| 4022 | 4022 | /* |
| 4023 | 4023 | * Add location variables to wpseo replacements. |
| 4024 | 4024 | * |
| 4025 | 4025 | * @since 1.5.4 |
| 4026 | 4026 | */ |
| 4027 | -function geodir_wpseo_replacements($vars){
|
|
| 4027 | +function geodir_wpseo_replacements($vars) {
|
|
| 4028 | 4028 | |
| 4029 | 4029 | global $wp; |
| 4030 | 4030 | $title = ''; |
@@ -4039,12 +4039,12 @@ discard block |
||
| 4039 | 4039 | * @param array $location_array The array of location variables. |
| 4040 | 4040 | * @param array $vars The page title variables. |
| 4041 | 4041 | */ |
| 4042 | - $location_array = apply_filters('geodir_filter_title_variables_location_arr_seo',$location_array, $vars);
|
|
| 4042 | + $location_array = apply_filters('geodir_filter_title_variables_location_arr_seo', $location_array, $vars);
|
|
| 4043 | 4043 | $location_titles = array(); |
| 4044 | - if(get_query_var( 'gd_country_full' )){
|
|
| 4045 | - if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );}
|
|
| 4046 | - if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );}
|
|
| 4047 | - if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );}
|
|
| 4044 | + if (get_query_var('gd_country_full')) {
|
|
| 4045 | + if (get_query_var('gd_country_full')) {$location_array['gd_country'] = get_query_var('gd_country_full'); }
|
|
| 4046 | + if (get_query_var('gd_region_full')) {$location_array['gd_region'] = get_query_var('gd_region_full'); }
|
|
| 4047 | + if (get_query_var('gd_city_full')) {$location_array['gd_city'] = get_query_var('gd_city_full'); }
|
|
| 4048 | 4048 | } |
| 4049 | 4049 | $location_single = ''; |
| 4050 | 4050 | $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : ''; |
@@ -4116,23 +4116,23 @@ discard block |
||
| 4116 | 4116 | } |
| 4117 | 4117 | |
| 4118 | 4118 | |
| 4119 | - if(!empty($location_titles)) {
|
|
| 4119 | + if (!empty($location_titles)) {
|
|
| 4120 | 4120 | $vars['%%location%%'] = implode(", ", $location_titles);
|
| 4121 | 4121 | } |
| 4122 | 4122 | |
| 4123 | 4123 | |
| 4124 | - if(!empty($location_titles)) {
|
|
| 4125 | - $vars['%%in_location%%'] = __('in ', 'geodirectory') . implode(", ", $location_titles);
|
|
| 4124 | + if (!empty($location_titles)) {
|
|
| 4125 | + $vars['%%in_location%%'] = __('in ', 'geodirectory').implode(", ", $location_titles);
|
|
| 4126 | 4126 | } |
| 4127 | 4127 | |
| 4128 | 4128 | |
| 4129 | 4129 | |
| 4130 | - if($location_single) {
|
|
| 4131 | - $vars['%%in_location_single%%'] = __('in', 'geodirectory') . ' ' .$location_single;
|
|
| 4130 | + if ($location_single) {
|
|
| 4131 | + $vars['%%in_location_single%%'] = __('in', 'geodirectory').' '.$location_single;
|
|
| 4132 | 4132 | } |
| 4133 | 4133 | |
| 4134 | 4134 | |
| 4135 | - if($location_single) {
|
|
| 4135 | + if ($location_single) {
|
|
| 4136 | 4136 | $vars['%%location_single%%'] = $location_single; |
| 4137 | 4137 | } |
| 4138 | 4138 | |
@@ -4144,17 +4144,17 @@ discard block |
||
| 4144 | 4144 | * @param string $vars The title with variables. |
| 4145 | 4145 | * @param array $location_array The array of location variables. |
| 4146 | 4146 | */ |
| 4147 | - return apply_filters('geodir_wpseo_replacements_vars',$vars,$location_array);
|
|
| 4147 | + return apply_filters('geodir_wpseo_replacements_vars', $vars, $location_array);
|
|
| 4148 | 4148 | } |
| 4149 | 4149 | |
| 4150 | 4150 | |
| 4151 | -add_filter('geodir_seo_meta_title','geodir_filter_title_variables',10,3);
|
|
| 4152 | -add_filter('geodir_seo_page_title','geodir_filter_title_variables',10,2);
|
|
| 4153 | -add_filter('geodir_seo_meta_description_pre','geodir_filter_title_variables',10,3);
|
|
| 4154 | -function geodir_filter_title_variables($title, $gd_page, $sep=''){
|
|
| 4151 | +add_filter('geodir_seo_meta_title', 'geodir_filter_title_variables', 10, 3);
|
|
| 4152 | +add_filter('geodir_seo_page_title', 'geodir_filter_title_variables', 10, 2);
|
|
| 4153 | +add_filter('geodir_seo_meta_description_pre', 'geodir_filter_title_variables', 10, 3);
|
|
| 4154 | +function geodir_filter_title_variables($title, $gd_page, $sep = '') {
|
|
| 4155 | 4155 | |
| 4156 | 4156 | |
| 4157 | - if(!$gd_page || !$title){return $title;}// if no a GD page then bail.
|
|
| 4157 | + if (!$gd_page || !$title) {return $title; }// if no a GD page then bail.
|
|
| 4158 | 4158 | global $post; |
| 4159 | 4159 | //print_r($post); |
| 4160 | 4160 | /* |
@@ -4196,123 +4196,123 @@ discard block |
||
| 4196 | 4196 | } |
| 4197 | 4197 | |
| 4198 | 4198 | |
| 4199 | - if(strpos($title,'%%title%%') !== false){
|
|
| 4200 | - $title = str_replace("%%title%%",$post->post_title,$title);
|
|
| 4199 | + if (strpos($title, '%%title%%') !== false) {
|
|
| 4200 | + $title = str_replace("%%title%%", $post->post_title, $title);
|
|
| 4201 | 4201 | } |
| 4202 | 4202 | |
| 4203 | - if(strpos($title,'%%sitename%%') !== false){
|
|
| 4204 | - $title = str_replace("%%sitename%%",get_bloginfo('name'),$title);
|
|
| 4203 | + if (strpos($title, '%%sitename%%') !== false) {
|
|
| 4204 | + $title = str_replace("%%sitename%%", get_bloginfo('name'), $title);
|
|
| 4205 | 4205 | } |
| 4206 | 4206 | |
| 4207 | - if(strpos($title,'%%sitedesc%%') !== false){
|
|
| 4208 | - $title = str_replace("%%sitedesc%%",get_bloginfo('description'),$title);
|
|
| 4207 | + if (strpos($title, '%%sitedesc%%') !== false) {
|
|
| 4208 | + $title = str_replace("%%sitedesc%%", get_bloginfo('description'), $title);
|
|
| 4209 | 4209 | } |
| 4210 | 4210 | |
| 4211 | - if(strpos($title,'%%excerpt%%') !== false){
|
|
| 4212 | - $title = str_replace("%%excerpt%%",strip_tags(get_the_excerpt()),$title);
|
|
| 4211 | + if (strpos($title, '%%excerpt%%') !== false) {
|
|
| 4212 | + $title = str_replace("%%excerpt%%", strip_tags(get_the_excerpt()), $title);
|
|
| 4213 | 4213 | } |
| 4214 | 4214 | |
| 4215 | - if(strpos($title,'%%pt_single%%') !== false){
|
|
| 4215 | + if (strpos($title, '%%pt_single%%') !== false) {
|
|
| 4216 | 4216 | $single_name = ''; |
| 4217 | - if($gd_page=='search' || $gd_page=='author'){
|
|
| 4217 | + if ($gd_page == 'search' || $gd_page == 'author') {
|
|
| 4218 | 4218 | $geodir_post_types = get_option('geodir_post_types');
|
| 4219 | 4219 | $spt = esc_attr($_REQUEST['stype']); |
| 4220 | - if(isset($geodir_post_types[$spt]['labels']['singular_name'])){
|
|
| 4221 | - $single_name = __($geodir_post_types[$spt]['labels']['singular_name'],'geodirectory'); |
|
| 4220 | + if (isset($geodir_post_types[$spt]['labels']['singular_name'])) {
|
|
| 4221 | + $single_name = __($geodir_post_types[$spt]['labels']['singular_name'], 'geodirectory'); |
|
| 4222 | 4222 | } |
| 4223 | - }elseif($gd_page=='add-listing'){
|
|
| 4223 | + }elseif ($gd_page == 'add-listing') {
|
|
| 4224 | 4224 | $geodir_post_types = get_option('geodir_post_types');
|
| 4225 | 4225 | $spt = isset($_REQUEST['listing_type']) ? esc_attr($_REQUEST['listing_type']) : ''; |
| 4226 | - if(!$spt && isset($_REQUEST['pid'])){
|
|
| 4227 | - $spt = get_post_type( $_REQUEST['pid'] ); |
|
| 4226 | + if (!$spt && isset($_REQUEST['pid'])) {
|
|
| 4227 | + $spt = get_post_type($_REQUEST['pid']); |
|
| 4228 | 4228 | } |
| 4229 | - if(!$spt){$spt='gd_place';}
|
|
| 4230 | - if(isset($geodir_post_types[$spt]['labels']['singular_name'])){
|
|
| 4231 | - $single_name = __($geodir_post_types[$spt]['labels']['singular_name'],'geodirectory'); |
|
| 4229 | + if (!$spt) {$spt = 'gd_place'; }
|
|
| 4230 | + if (isset($geodir_post_types[$spt]['labels']['singular_name'])) {
|
|
| 4231 | + $single_name = __($geodir_post_types[$spt]['labels']['singular_name'], 'geodirectory'); |
|
| 4232 | 4232 | } |
| 4233 | 4233 | } |
| 4234 | - elseif($post->post_type){
|
|
| 4234 | + elseif ($post->post_type) {
|
|
| 4235 | 4235 | $geodir_post_types = get_option('geodir_post_types');
|
| 4236 | - if(isset($geodir_post_types[$post->post_type]['labels']['singular_name'])){
|
|
| 4237 | - $single_name = __($geodir_post_types[$post->post_type]['labels']['singular_name'],'geodirectory'); |
|
| 4236 | + if (isset($geodir_post_types[$post->post_type]['labels']['singular_name'])) {
|
|
| 4237 | + $single_name = __($geodir_post_types[$post->post_type]['labels']['singular_name'], 'geodirectory'); |
|
| 4238 | 4238 | } |
| 4239 | 4239 | |
| 4240 | 4240 | |
| 4241 | 4241 | } |
| 4242 | - $title = str_replace("%%pt_single%%",$single_name,$title);
|
|
| 4242 | + $title = str_replace("%%pt_single%%", $single_name, $title);
|
|
| 4243 | 4243 | } |
| 4244 | 4244 | |
| 4245 | - if(strpos($title,'%%pt_plural%%') !== false){
|
|
| 4245 | + if (strpos($title, '%%pt_plural%%') !== false) {
|
|
| 4246 | 4246 | $plural_name = ''; |
| 4247 | - if($gd_page=='search' || $gd_page=='author'){
|
|
| 4247 | + if ($gd_page == 'search' || $gd_page == 'author') {
|
|
| 4248 | 4248 | $geodir_post_types = get_option('geodir_post_types');
|
| 4249 | 4249 | $spt = esc_attr($_REQUEST['stype']); |
| 4250 | - if(isset($geodir_post_types[$spt]['labels']['name'])){
|
|
| 4251 | - $plural_name = __($geodir_post_types[$spt]['labels']['name'],'geodirectory'); |
|
| 4250 | + if (isset($geodir_post_types[$spt]['labels']['name'])) {
|
|
| 4251 | + $plural_name = __($geodir_post_types[$spt]['labels']['name'], 'geodirectory'); |
|
| 4252 | 4252 | } |
| 4253 | - }elseif($gd_page=='add-listing'){
|
|
| 4253 | + }elseif ($gd_page == 'add-listing') {
|
|
| 4254 | 4254 | $geodir_post_types = get_option('geodir_post_types');
|
| 4255 | 4255 | $spt = sanitize_text_field($_REQUEST['listing_type']); |
| 4256 | - if(!$spt){$spt='gd_place';}
|
|
| 4257 | - if(isset($geodir_post_types[$spt]['labels']['name'])){
|
|
| 4258 | - $plural_name = __($geodir_post_types[$spt]['labels']['name'],'geodirectory'); |
|
| 4256 | + if (!$spt) {$spt = 'gd_place'; }
|
|
| 4257 | + if (isset($geodir_post_types[$spt]['labels']['name'])) {
|
|
| 4258 | + $plural_name = __($geodir_post_types[$spt]['labels']['name'], 'geodirectory'); |
|
| 4259 | 4259 | } |
| 4260 | 4260 | } |
| 4261 | - elseif(isset($post->post_type) && $post->post_type){
|
|
| 4261 | + elseif (isset($post->post_type) && $post->post_type) {
|
|
| 4262 | 4262 | $geodir_post_types = get_option('geodir_post_types');
|
| 4263 | - if(isset($geodir_post_types[$post->post_type]['labels']['name'])){
|
|
| 4264 | - $plural_name = __($geodir_post_types[$post->post_type]['labels']['name'],'geodirectory'); |
|
| 4263 | + if (isset($geodir_post_types[$post->post_type]['labels']['name'])) {
|
|
| 4264 | + $plural_name = __($geodir_post_types[$post->post_type]['labels']['name'], 'geodirectory'); |
|
| 4265 | 4265 | } |
| 4266 | 4266 | |
| 4267 | 4267 | } |
| 4268 | - $title = str_replace("%%pt_plural%%",$plural_name,$title);
|
|
| 4268 | + $title = str_replace("%%pt_plural%%", $plural_name, $title);
|
|
| 4269 | 4269 | } |
| 4270 | 4270 | |
| 4271 | 4271 | |
| 4272 | 4272 | |
| 4273 | - if(strpos($title,'%%category%%') !== false){
|
|
| 4273 | + if (strpos($title, '%%category%%') !== false) {
|
|
| 4274 | 4274 | $cat_name = ''; |
| 4275 | 4275 | |
| 4276 | - if($gd_page=='detail') {
|
|
| 4276 | + if ($gd_page == 'detail') {
|
|
| 4277 | 4277 | if ($post->default_category) {
|
| 4278 | - $cat = get_term($post->default_category, $post->post_type . 'category'); |
|
| 4278 | + $cat = get_term($post->default_category, $post->post_type.'category'); |
|
| 4279 | 4279 | $cat_name = (isset($cat->name)) ? $cat->name : ''; |
| 4280 | 4280 | } |
| 4281 | - }elseif($gd_page=='listing'){
|
|
| 4281 | + }elseif ($gd_page == 'listing') {
|
|
| 4282 | 4282 | $queried_object = get_queried_object(); |
| 4283 | - if(isset($queried_object->name)){
|
|
| 4283 | + if (isset($queried_object->name)) {
|
|
| 4284 | 4284 | $cat_name = $queried_object->name; |
| 4285 | 4285 | } |
| 4286 | 4286 | } |
| 4287 | - $title = str_replace("%%category%%",$cat_name,$title);
|
|
| 4287 | + $title = str_replace("%%category%%", $cat_name, $title);
|
|
| 4288 | 4288 | } |
| 4289 | 4289 | |
| 4290 | - if(strpos($title,'%%tag%%') !== false){
|
|
| 4290 | + if (strpos($title, '%%tag%%') !== false) {
|
|
| 4291 | 4291 | $cat_name = ''; |
| 4292 | 4292 | |
| 4293 | - if($gd_page=='detail') {
|
|
| 4293 | + if ($gd_page == 'detail') {
|
|
| 4294 | 4294 | if ($post->default_category) {
|
| 4295 | - $cat = get_term($post->default_category, $post->post_type . 'category'); |
|
| 4295 | + $cat = get_term($post->default_category, $post->post_type.'category'); |
|
| 4296 | 4296 | $cat_name = (isset($cat->name)) ? $cat->name : ''; |
| 4297 | 4297 | } |
| 4298 | - }elseif($gd_page=='listing'){
|
|
| 4298 | + }elseif ($gd_page == 'listing') {
|
|
| 4299 | 4299 | $queried_object = get_queried_object(); |
| 4300 | - if(isset($queried_object->name)){
|
|
| 4300 | + if (isset($queried_object->name)) {
|
|
| 4301 | 4301 | $cat_name = $queried_object->name; |
| 4302 | 4302 | } |
| 4303 | 4303 | } |
| 4304 | - $title = str_replace("%%tag%%",$cat_name,$title);
|
|
| 4304 | + $title = str_replace("%%tag%%", $cat_name, $title);
|
|
| 4305 | 4305 | } |
| 4306 | 4306 | |
| 4307 | 4307 | |
| 4308 | 4308 | |
| 4309 | - if(strpos($title,'%%id%%') !== false){
|
|
| 4309 | + if (strpos($title, '%%id%%') !== false) {
|
|
| 4310 | 4310 | $ID = (isset($post->ID)) ? $post->ID : ''; |
| 4311 | - $title = str_replace("%%id%%",$ID,$title);
|
|
| 4311 | + $title = str_replace("%%id%%", $ID, $title);
|
|
| 4312 | 4312 | } |
| 4313 | 4313 | |
| 4314 | - if(strpos($title,'%%sep%%') !== false){
|
|
| 4315 | - $title = str_replace("%%sep%%",$sep,$title);
|
|
| 4314 | + if (strpos($title, '%%sep%%') !== false) {
|
|
| 4315 | + $title = str_replace("%%sep%%", $sep, $title);
|
|
| 4316 | 4316 | } |
| 4317 | 4317 | |
| 4318 | 4318 | |
@@ -4330,12 +4330,12 @@ discard block |
||
| 4330 | 4330 | * @param string $gd_page The page being filtered. |
| 4331 | 4331 | * @param string $sep The separator, default: `|`. |
| 4332 | 4332 | */ |
| 4333 | - $location_array = apply_filters('geodir_filter_title_variables_location_arr',$location_array,$title, $gd_page, $sep);
|
|
| 4333 | + $location_array = apply_filters('geodir_filter_title_variables_location_arr', $location_array, $title, $gd_page, $sep);
|
|
| 4334 | 4334 | $location_titles = array(); |
| 4335 | - if($gd_page=='location' && get_query_var( 'gd_country_full' )){
|
|
| 4336 | - if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );}
|
|
| 4337 | - if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );}
|
|
| 4338 | - if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );}
|
|
| 4335 | + if ($gd_page == 'location' && get_query_var('gd_country_full')) {
|
|
| 4336 | + if (get_query_var('gd_country_full')) {$location_array['gd_country'] = get_query_var('gd_country_full'); }
|
|
| 4337 | + if (get_query_var('gd_region_full')) {$location_array['gd_region'] = get_query_var('gd_region_full'); }
|
|
| 4338 | + if (get_query_var('gd_city_full')) {$location_array['gd_city'] = get_query_var('gd_city_full'); }
|
|
| 4339 | 4339 | } |
| 4340 | 4340 | $location_single = ''; |
| 4341 | 4341 | $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : ''; |
@@ -4407,51 +4407,51 @@ discard block |
||
| 4407 | 4407 | } |
| 4408 | 4408 | |
| 4409 | 4409 | |
| 4410 | - if(strpos($title,'%%location%%') !== false){
|
|
| 4410 | + if (strpos($title, '%%location%%') !== false) {
|
|
| 4411 | 4411 | $location = ''; |
| 4412 | - if($location_titles) {
|
|
| 4412 | + if ($location_titles) {
|
|
| 4413 | 4413 | $location = implode(", ", $location_titles);
|
| 4414 | 4414 | } |
| 4415 | - $title = str_replace("%%location%%",$location,$title);
|
|
| 4415 | + $title = str_replace("%%location%%", $location, $title);
|
|
| 4416 | 4416 | } |
| 4417 | 4417 | |
| 4418 | - if(strpos($title,'%%in_location%%') !== false){
|
|
| 4418 | + if (strpos($title, '%%in_location%%') !== false) {
|
|
| 4419 | 4419 | $location = ''; |
| 4420 | - if($location_titles) {
|
|
| 4421 | - $location = __('in ', 'geodirectory') . implode(", ", $location_titles);
|
|
| 4420 | + if ($location_titles) {
|
|
| 4421 | + $location = __('in ', 'geodirectory').implode(", ", $location_titles);
|
|
| 4422 | 4422 | } |
| 4423 | - $title = str_replace("%%in_location%%",$location,$title);
|
|
| 4423 | + $title = str_replace("%%in_location%%", $location, $title);
|
|
| 4424 | 4424 | } |
| 4425 | 4425 | |
| 4426 | - if(strpos($title,'%%in_location_single%%') !== false){
|
|
| 4427 | - if($location_single) {
|
|
| 4428 | - $location_single = __('in', 'geodirectory') . ' ' .$location_single;
|
|
| 4426 | + if (strpos($title, '%%in_location_single%%') !== false) {
|
|
| 4427 | + if ($location_single) {
|
|
| 4428 | + $location_single = __('in', 'geodirectory').' '.$location_single;
|
|
| 4429 | 4429 | } |
| 4430 | - $title = str_replace("%%in_location_single%%",$location_single,$title);
|
|
| 4430 | + $title = str_replace("%%in_location_single%%", $location_single, $title);
|
|
| 4431 | 4431 | } |
| 4432 | 4432 | |
| 4433 | - if(strpos($title,'%%location_single%%') !== false){
|
|
| 4434 | - $title = str_replace("%%location_single%%",$location_single,$title);
|
|
| 4433 | + if (strpos($title, '%%location_single%%') !== false) {
|
|
| 4434 | + $title = str_replace("%%location_single%%", $location_single, $title);
|
|
| 4435 | 4435 | } |
| 4436 | 4436 | |
| 4437 | 4437 | |
| 4438 | - if(strpos($title,'%%search_term%%') !== false){
|
|
| 4438 | + if (strpos($title, '%%search_term%%') !== false) {
|
|
| 4439 | 4439 | $search_term = ''; |
| 4440 | - if(isset($_REQUEST['s'])){
|
|
| 4440 | + if (isset($_REQUEST['s'])) {
|
|
| 4441 | 4441 | $search_term = esc_attr($_REQUEST['s']); |
| 4442 | 4442 | } |
| 4443 | - $title = str_replace("%%search_term%%",$search_term,$title);
|
|
| 4443 | + $title = str_replace("%%search_term%%", $search_term, $title);
|
|
| 4444 | 4444 | } |
| 4445 | 4445 | |
| 4446 | - if(strpos($title,'%%search_near%%') !== false){
|
|
| 4446 | + if (strpos($title, '%%search_near%%') !== false) {
|
|
| 4447 | 4447 | $search_term = ''; |
| 4448 | - if(isset($_REQUEST['snear'])){
|
|
| 4448 | + if (isset($_REQUEST['snear'])) {
|
|
| 4449 | 4449 | $search_term = esc_attr($_REQUEST['snear']); |
| 4450 | 4450 | } |
| 4451 | - $title = str_replace("%%search_near%%",$search_term,$title);
|
|
| 4451 | + $title = str_replace("%%search_near%%", $search_term, $title);
|
|
| 4452 | 4452 | } |
| 4453 | 4453 | |
| 4454 | - if(strpos($title,'%%name%%') !== false){
|
|
| 4454 | + if (strpos($title, '%%name%%') !== false) {
|
|
| 4455 | 4455 | $author_name = get_the_author(); |
| 4456 | 4456 | if (!$author_name || $author_name === '') {
|
| 4457 | 4457 | $queried_object = get_queried_object(); |
@@ -4476,9 +4476,9 @@ discard block |
||
| 4476 | 4476 | $title = str_replace("%%pagetotal%%", $pagetotal, $title);
|
| 4477 | 4477 | } |
| 4478 | 4478 | |
| 4479 | - $title = wptexturize( $title ); |
|
| 4480 | - $title = convert_chars( $title ); |
|
| 4481 | - $title = esc_html( $title ); |
|
| 4479 | + $title = wptexturize($title); |
|
| 4480 | + $title = convert_chars($title); |
|
| 4481 | + $title = esc_html($title); |
|
| 4482 | 4482 | |
| 4483 | 4483 | /** |
| 4484 | 4484 | * Filter the title variables after standard ones have been filtered. |
@@ -4491,7 +4491,7 @@ discard block |
||
| 4491 | 4491 | * @param string $sep The separator, default: `|`. |
| 4492 | 4492 | */ |
| 4493 | 4493 | |
| 4494 | - return apply_filters('geodir_filter_title_variables_vars',$title,$location_array, $gd_page, $sep);
|
|
| 4494 | + return apply_filters('geodir_filter_title_variables_vars', $title, $location_array, $gd_page, $sep);
|
|
| 4495 | 4495 | } |
| 4496 | 4496 | |
| 4497 | 4497 | /** |
@@ -4614,7 +4614,7 @@ discard block |
||
| 4614 | 4614 | } |
| 4615 | 4615 | |
| 4616 | 4616 | $action = isset($_REQUEST['action']) ? sanitize_text_field($_REQUEST['action']) : ''; |
| 4617 | - $is_admin = is_admin() && ( !defined('DOING_AJAX' ) || ( defined('DOING_AJAX') && !DOING_AJAX ) ) ? true : false;
|
|
| 4617 | + $is_admin = is_admin() && (!defined('DOING_AJAX') || (defined('DOING_AJAX') && !DOING_AJAX)) ? true : false;
|
|
| 4618 | 4618 | $inline_save = $action == 'inline-save' ? true : false; |
| 4619 | 4619 | |
| 4620 | 4620 | if (empty($post->post_type) || $is_admin || $inline_save || (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)) {
|
@@ -4625,7 +4625,7 @@ discard block |
||
| 4625 | 4625 | return; |
| 4626 | 4626 | } |
| 4627 | 4627 | |
| 4628 | - $user_id = (int)get_current_user_id(); |
|
| 4628 | + $user_id = (int) get_current_user_id(); |
|
| 4629 | 4629 | |
| 4630 | 4630 | if ($user_id > 0 && get_option('geodir_notify_post_edited') && !wp_is_post_revision($post_ID) && in_array($post->post_type, geodir_get_posttypes())) {
|
| 4631 | 4631 | $author_id = !empty($post->post_author) ? $post->post_author : 0; |
@@ -4669,7 +4669,7 @@ discard block |
||
| 4669 | 4669 | $nr = geodir_title_meta_pagenumbering('nr');
|
| 4670 | 4670 | |
| 4671 | 4671 | if ($max > 1 && $nr > 1) {
|
| 4672 | - $replacement = sprintf($sep . ' ' . __('Page %1$d of %2$d', 'geodirectory'), $nr, $max);
|
|
| 4672 | + $replacement = sprintf($sep.' '.__('Page %1$d of %2$d', 'geodirectory'), $nr, $max);
|
|
| 4673 | 4673 | } |
| 4674 | 4674 | |
| 4675 | 4675 | return $replacement; |
@@ -4688,7 +4688,7 @@ discard block |
||
| 4688 | 4688 | |
| 4689 | 4689 | $nr = geodir_title_meta_pagenumbering('nr');
|
| 4690 | 4690 | if (isset($nr) && $nr > 0) {
|
| 4691 | - $replacement = (string)$nr; |
|
| 4691 | + $replacement = (string) $nr; |
|
| 4692 | 4692 | } |
| 4693 | 4693 | |
| 4694 | 4694 | return $replacement; |
@@ -4707,7 +4707,7 @@ discard block |
||
| 4707 | 4707 | |
| 4708 | 4708 | $max = geodir_title_meta_pagenumbering('max');
|
| 4709 | 4709 | if (isset($max) && $max > 0) {
|
| 4710 | - $replacement = (string)$max; |
|
| 4710 | + $replacement = (string) $max; |
|
| 4711 | 4711 | } |
| 4712 | 4712 | |
| 4713 | 4713 | return $replacement; |
@@ -4749,7 +4749,7 @@ discard block |
||
| 4749 | 4749 | } |
| 4750 | 4750 | |
| 4751 | 4751 | if (isset($post->post_content)) {
|
| 4752 | - $max_num_pages = (substr_count($post->post_content, '<!--nextpage-->' ) + 1); |
|
| 4752 | + $max_num_pages = (substr_count($post->post_content, '<!--nextpage-->') + 1); |
|
| 4753 | 4753 | } |
| 4754 | 4754 | } |
| 4755 | 4755 | |