@@ -31,30 +31,30 @@ discard block |
||
| 31 | 31 | * CHECK FOR OLD COMPATIBILITY PACKS AND DISABLE IF THEY ARE ACTIVE |
| 32 | 32 | */ |
| 33 | 33 | if (is_admin()) {
|
| 34 | - /** |
|
| 35 | - * Include WordPress core file so we can use core functions to check for active plugins. |
|
| 36 | - */ |
|
| 37 | - include_once(ABSPATH . 'wp-admin/includes/plugin.php'); |
|
| 34 | + /** |
|
| 35 | + * Include WordPress core file so we can use core functions to check for active plugins. |
|
| 36 | + */ |
|
| 37 | + include_once(ABSPATH . 'wp-admin/includes/plugin.php'); |
|
| 38 | 38 | |
| 39 | - if (is_plugin_active('geodirectory-genesis-compatibility-pack/geodir_genesis_compatibility.php')) {
|
|
| 40 | - deactivate_plugins('geodirectory-genesis-compatibility-pack/geodir_genesis_compatibility.php');
|
|
| 41 | - } |
|
| 39 | + if (is_plugin_active('geodirectory-genesis-compatibility-pack/geodir_genesis_compatibility.php')) {
|
|
| 40 | + deactivate_plugins('geodirectory-genesis-compatibility-pack/geodir_genesis_compatibility.php');
|
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - if (is_plugin_active('geodirectory-x-theme-compatibility-pack/geodir_x_compatibility.php')) {
|
|
| 44 | - deactivate_plugins('geodirectory-x-theme-compatibility-pack/geodir_x_compatibility.php');
|
|
| 45 | - } |
|
| 43 | + if (is_plugin_active('geodirectory-x-theme-compatibility-pack/geodir_x_compatibility.php')) {
|
|
| 44 | + deactivate_plugins('geodirectory-x-theme-compatibility-pack/geodir_x_compatibility.php');
|
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - if (is_plugin_active('geodirectory-enfold-theme-compatibility-pack/geodir_enfold_compatibility.php')) {
|
|
| 48 | - deactivate_plugins('geodirectory-enfold-theme-compatibility-pack/geodir_enfold_compatibility.php');
|
|
| 49 | - } |
|
| 47 | + if (is_plugin_active('geodirectory-enfold-theme-compatibility-pack/geodir_enfold_compatibility.php')) {
|
|
| 48 | + deactivate_plugins('geodirectory-enfold-theme-compatibility-pack/geodir_enfold_compatibility.php');
|
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - if (is_plugin_active('geodir_avada_compatibility/geodir_avada_compatibility.php')) {
|
|
| 52 | - deactivate_plugins('geodir_avada_compatibility/geodir_avada_compatibility.php');
|
|
| 53 | - } |
|
| 51 | + if (is_plugin_active('geodir_avada_compatibility/geodir_avada_compatibility.php')) {
|
|
| 52 | + deactivate_plugins('geodir_avada_compatibility/geodir_avada_compatibility.php');
|
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - if (is_plugin_active('geodir_compat_pack_divi/geodir_divi_compatibility.php')) {
|
|
| 56 | - deactivate_plugins('geodir_compat_pack_divi/geodir_divi_compatibility.php');
|
|
| 57 | - } |
|
| 55 | + if (is_plugin_active('geodir_compat_pack_divi/geodir_divi_compatibility.php')) {
|
|
| 56 | + deactivate_plugins('geodir_compat_pack_divi/geodir_divi_compatibility.php');
|
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | 59 | } |
| 60 | 60 | |
@@ -130,19 +130,19 @@ discard block |
||
| 130 | 130 | * @package GeoDirectory |
| 131 | 131 | */ |
| 132 | 132 | function geodir_error_log($log){
|
| 133 | - /* |
|
| 133 | + /* |
|
| 134 | 134 | * A filter to override the WP_DEBUG setting for function geodir_error_log(). |
| 135 | 135 | * |
| 136 | 136 | * @since 1.5.7 |
| 137 | 137 | */ |
| 138 | - $should_log = apply_filters( 'geodir_log_errors', WP_DEBUG); |
|
| 139 | - if ( true === $should_log ) {
|
|
| 140 | - if ( is_array( $log ) || is_object( $log ) ) {
|
|
| 141 | - error_log( print_r( $log, true ) ); |
|
| 142 | - } else {
|
|
| 143 | - error_log( $log ); |
|
| 144 | - } |
|
| 145 | - } |
|
| 138 | + $should_log = apply_filters( 'geodir_log_errors', WP_DEBUG); |
|
| 139 | + if ( true === $should_log ) {
|
|
| 140 | + if ( is_array( $log ) || is_object( $log ) ) {
|
|
| 141 | + error_log( print_r( $log, true ) ); |
|
| 142 | + } else {
|
|
| 143 | + error_log( $log ); |
|
| 144 | + } |
|
| 145 | + } |
|
| 146 | 146 | } |
| 147 | 147 | /** |
| 148 | 148 | * Include all plugin functions. |
@@ -187,72 +187,72 @@ discard block |
||
| 187 | 187 | */ |
| 188 | 188 | if (is_admin() || defined( 'GD_TESTING_MODE' ) || ( defined( 'WP_CLI' ) && WP_CLI )) {
|
| 189 | 189 | |
| 190 | - /** |
|
| 191 | - * Include functions used in admin area only. |
|
| 192 | - * |
|
| 193 | - * @since 1.0.0 |
|
| 194 | - */ |
|
| 195 | - require_once('geodirectory-admin/admin_functions.php');
|
|
| 196 | - /** |
|
| 197 | - * Most actions/hooks used in admin area only are called from here. |
|
| 198 | - * |
|
| 199 | - * @since 1.6.11 |
|
| 200 | - */ |
|
| 201 | - require_once('geodirectory-admin/admin_dummy_data_functions.php');
|
|
| 202 | - /** |
|
| 203 | - * Most actions/hooks used in admin area only are called from here. |
|
| 204 | - * |
|
| 205 | - * @since 1.0.0 |
|
| 206 | - */ |
|
| 207 | - require_once('geodirectory-admin/admin_hooks_actions.php');
|
|
| 208 | - /** |
|
| 209 | - * Most admin JS and CSS is called from here. |
|
| 210 | - * |
|
| 211 | - * @since 1.0.0 |
|
| 212 | - */ |
|
| 213 | - require_once('geodirectory-admin/admin_template_tags.php');
|
|
| 214 | - /** |
|
| 215 | - * Include Google Analytics Class. |
|
| 216 | - * |
|
| 217 | - * @since 1.6.11 |
|
| 218 | - */ |
|
| 219 | - require_once('geodirectory-admin/class.analytics.stats.php');
|
|
| 220 | - /** |
|
| 221 | - * Include any functions needed for upgrades. |
|
| 222 | - * |
|
| 223 | - * @since 1.0.0 |
|
| 224 | - */ |
|
| 225 | - require_once(geodir_plugin_path() . '/upgrade.php'); |
|
| 226 | - if (get_option('geodir_installed') != 1) {
|
|
| 227 | - /** |
|
| 228 | - * Define language constants, here as they are not loaded yet. |
|
| 229 | - * |
|
| 230 | - * @since 1.0.0 |
|
| 231 | - */ |
|
| 232 | - require_once(geodir_plugin_path() . '/language.php'); |
|
| 233 | - /** |
|
| 234 | - * Include the plugin install file that sets up the databases and any options on first run. |
|
| 235 | - * |
|
| 236 | - * @since 1.0.0 |
|
| 237 | - */ |
|
| 238 | - require_once('geodirectory-admin/admin_install.php');
|
|
| 239 | - register_activation_hook(__FILE__, 'geodir_activation'); |
|
| 240 | - } |
|
| 241 | - register_deactivation_hook(__FILE__, 'geodir_deactivation'); |
|
| 190 | + /** |
|
| 191 | + * Include functions used in admin area only. |
|
| 192 | + * |
|
| 193 | + * @since 1.0.0 |
|
| 194 | + */ |
|
| 195 | + require_once('geodirectory-admin/admin_functions.php');
|
|
| 196 | + /** |
|
| 197 | + * Most actions/hooks used in admin area only are called from here. |
|
| 198 | + * |
|
| 199 | + * @since 1.6.11 |
|
| 200 | + */ |
|
| 201 | + require_once('geodirectory-admin/admin_dummy_data_functions.php');
|
|
| 202 | + /** |
|
| 203 | + * Most actions/hooks used in admin area only are called from here. |
|
| 204 | + * |
|
| 205 | + * @since 1.0.0 |
|
| 206 | + */ |
|
| 207 | + require_once('geodirectory-admin/admin_hooks_actions.php');
|
|
| 208 | + /** |
|
| 209 | + * Most admin JS and CSS is called from here. |
|
| 210 | + * |
|
| 211 | + * @since 1.0.0 |
|
| 212 | + */ |
|
| 213 | + require_once('geodirectory-admin/admin_template_tags.php');
|
|
| 214 | + /** |
|
| 215 | + * Include Google Analytics Class. |
|
| 216 | + * |
|
| 217 | + * @since 1.6.11 |
|
| 218 | + */ |
|
| 219 | + require_once('geodirectory-admin/class.analytics.stats.php');
|
|
| 220 | + /** |
|
| 221 | + * Include any functions needed for upgrades. |
|
| 222 | + * |
|
| 223 | + * @since 1.0.0 |
|
| 224 | + */ |
|
| 225 | + require_once(geodir_plugin_path() . '/upgrade.php'); |
|
| 226 | + if (get_option('geodir_installed') != 1) {
|
|
| 227 | + /** |
|
| 228 | + * Define language constants, here as they are not loaded yet. |
|
| 229 | + * |
|
| 230 | + * @since 1.0.0 |
|
| 231 | + */ |
|
| 232 | + require_once(geodir_plugin_path() . '/language.php'); |
|
| 233 | + /** |
|
| 234 | + * Include the plugin install file that sets up the databases and any options on first run. |
|
| 235 | + * |
|
| 236 | + * @since 1.0.0 |
|
| 237 | + */ |
|
| 238 | + require_once('geodirectory-admin/admin_install.php');
|
|
| 239 | + register_activation_hook(__FILE__, 'geodir_activation'); |
|
| 240 | + } |
|
| 241 | + register_deactivation_hook(__FILE__, 'geodir_deactivation'); |
|
| 242 | 242 | |
| 243 | - /* |
|
| 243 | + /* |
|
| 244 | 244 | * Show a upgrade warning message if applicable. |
| 245 | 245 | * |
| 246 | 246 | * @since 1.5.6 |
| 247 | 247 | */ |
| 248 | - global $pagenow; |
|
| 249 | - if ( 'plugins.php' === $pagenow ) |
|
| 250 | - {
|
|
| 251 | - // Better update message |
|
| 252 | - $file = basename( __FILE__ ); |
|
| 253 | - $folder = basename( dirname( __FILE__ ) ); |
|
| 254 | - $hook = "in_plugin_update_message-{$folder}/{$file}";
|
|
| 255 | - add_action( $hook, 'geodire_admin_upgrade_notice', 20, 2 ); |
|
| 256 | - } |
|
| 248 | + global $pagenow; |
|
| 249 | + if ( 'plugins.php' === $pagenow ) |
|
| 250 | + {
|
|
| 251 | + // Better update message |
|
| 252 | + $file = basename( __FILE__ ); |
|
| 253 | + $folder = basename( dirname( __FILE__ ) ); |
|
| 254 | + $hook = "in_plugin_update_message-{$folder}/{$file}";
|
|
| 255 | + add_action( $hook, 'geodire_admin_upgrade_notice', 20, 2 ); |
|
| 256 | + } |
|
| 257 | 257 | |
| 258 | 258 | } |
| 259 | 259 | \ No newline at end of file |
@@ -13,134 +13,134 @@ discard block |
||
| 13 | 13 | * @package GeoDirectory |
| 14 | 14 | */ |
| 15 | 15 | function geodir_deactivation() {
|
| 16 | - // Update installed variable |
|
| 17 | - update_option("geodir_installed", 0);
|
|
| 16 | + // Update installed variable |
|
| 17 | + update_option("geodir_installed", 0);
|
|
| 18 | 18 | |
| 19 | - // Remove rewrite rules and then recreate rewrite rules. |
|
| 20 | - flush_rewrite_rules(); |
|
| 19 | + // Remove rewrite rules and then recreate rewrite rules. |
|
| 20 | + flush_rewrite_rules(); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | if (!function_exists('geodir_admin_styles')) {
|
| 24 | - /** |
|
| 25 | - * Enqueue Admin Styles. |
|
| 26 | - * |
|
| 27 | - * @since 1.0.0 |
|
| 28 | - * @package GeoDirectory |
|
| 29 | - */ |
|
| 30 | - function geodir_admin_styles() {
|
|
| 31 | - wp_register_style('geodirectory-admin-css', geodir_plugin_url() . '/geodirectory-assets/css/admin.css', array(), GEODIRECTORY_VERSION);
|
|
| 32 | - wp_enqueue_style('geodirectory-admin-css');
|
|
| 24 | + /** |
|
| 25 | + * Enqueue Admin Styles. |
|
| 26 | + * |
|
| 27 | + * @since 1.0.0 |
|
| 28 | + * @package GeoDirectory |
|
| 29 | + */ |
|
| 30 | + function geodir_admin_styles() {
|
|
| 31 | + wp_register_style('geodirectory-admin-css', geodir_plugin_url() . '/geodirectory-assets/css/admin.css', array(), GEODIRECTORY_VERSION);
|
|
| 32 | + wp_enqueue_style('geodirectory-admin-css');
|
|
| 33 | 33 | |
| 34 | - wp_register_style('geodirectory-frontend-style', geodir_plugin_url() . '/geodirectory-assets/css/style.css', array(), GEODIRECTORY_VERSION);
|
|
| 35 | - wp_enqueue_style('geodirectory-frontend-style');
|
|
| 34 | + wp_register_style('geodirectory-frontend-style', geodir_plugin_url() . '/geodirectory-assets/css/style.css', array(), GEODIRECTORY_VERSION);
|
|
| 35 | + wp_enqueue_style('geodirectory-frontend-style');
|
|
| 36 | 36 | |
| 37 | - wp_register_style('geodir-chosen-style', geodir_plugin_url() . '/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION);
|
|
| 38 | - wp_enqueue_style('geodir-chosen-style');
|
|
| 37 | + wp_register_style('geodir-chosen-style', geodir_plugin_url() . '/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION);
|
|
| 38 | + wp_enqueue_style('geodir-chosen-style');
|
|
| 39 | 39 | |
| 40 | - wp_register_style('geodirectory-jquery-ui-timepicker-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery.ui.timepicker.css', array(), GEODIRECTORY_VERSION);
|
|
| 41 | - wp_enqueue_style('geodirectory-jquery-ui-timepicker-css');
|
|
| 40 | + wp_register_style('geodirectory-jquery-ui-timepicker-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery.ui.timepicker.css', array(), GEODIRECTORY_VERSION);
|
|
| 41 | + wp_enqueue_style('geodirectory-jquery-ui-timepicker-css');
|
|
| 42 | 42 | |
| 43 | - wp_register_style('geodirectory-jquery-ui-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery-ui.css', array(), GEODIRECTORY_VERSION);
|
|
| 44 | - wp_enqueue_style('geodirectory-jquery-ui-css');
|
|
| 43 | + wp_register_style('geodirectory-jquery-ui-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery-ui.css', array(), GEODIRECTORY_VERSION);
|
|
| 44 | + wp_enqueue_style('geodirectory-jquery-ui-css');
|
|
| 45 | 45 | |
| 46 | - wp_register_style('geodirectory-custom-fields-css', geodir_plugin_url() . '/geodirectory-assets/css/custom_field.css', array(), GEODIRECTORY_VERSION);
|
|
| 47 | - wp_enqueue_style('geodirectory-custom-fields-css');
|
|
| 46 | + wp_register_style('geodirectory-custom-fields-css', geodir_plugin_url() . '/geodirectory-assets/css/custom_field.css', array(), GEODIRECTORY_VERSION);
|
|
| 47 | + wp_enqueue_style('geodirectory-custom-fields-css');
|
|
| 48 | 48 | |
| 49 | - wp_register_style('geodirectory-pluplodar-css', geodir_plugin_url() . '/geodirectory-assets/css/pluploader.css', array(), GEODIRECTORY_VERSION);
|
|
| 50 | - wp_enqueue_style('geodirectory-pluplodar-css');
|
|
| 49 | + wp_register_style('geodirectory-pluplodar-css', geodir_plugin_url() . '/geodirectory-assets/css/pluploader.css', array(), GEODIRECTORY_VERSION);
|
|
| 50 | + wp_enqueue_style('geodirectory-pluplodar-css');
|
|
| 51 | 51 | |
| 52 | - wp_register_style('geodir-rating-style', geodir_plugin_url() . '/geodirectory-assets/css/jRating.jquery.css', array(), GEODIRECTORY_VERSION);
|
|
| 53 | - wp_enqueue_style('geodir-rating-style');
|
|
| 52 | + wp_register_style('geodir-rating-style', geodir_plugin_url() . '/geodirectory-assets/css/jRating.jquery.css', array(), GEODIRECTORY_VERSION);
|
|
| 53 | + wp_enqueue_style('geodir-rating-style');
|
|
| 54 | 54 | |
| 55 | - wp_register_style('geodir-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl.css', array(), GEODIRECTORY_VERSION);
|
|
| 56 | - wp_enqueue_style('geodir-rtl-style');
|
|
| 57 | - } |
|
| 55 | + wp_register_style('geodir-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl.css', array(), GEODIRECTORY_VERSION);
|
|
| 56 | + wp_enqueue_style('geodir-rtl-style');
|
|
| 57 | + } |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | if (!function_exists('geodir_admin_styles_req')) {
|
| 61 | - /** |
|
| 62 | - * Loads stylesheets from CDN. |
|
| 63 | - * |
|
| 64 | - * @since 1.0.0 |
|
| 65 | - * @package GeoDirectory |
|
| 66 | - */ |
|
| 67 | - function geodir_admin_styles_req() |
|
| 68 | - {
|
|
| 61 | + /** |
|
| 62 | + * Loads stylesheets from CDN. |
|
| 63 | + * |
|
| 64 | + * @since 1.0.0 |
|
| 65 | + * @package GeoDirectory |
|
| 66 | + */ |
|
| 67 | + function geodir_admin_styles_req() |
|
| 68 | + {
|
|
| 69 | 69 | |
| 70 | 70 | // wp_register_script('font-awesome', 'https://use.fontawesome.com/releases/v5.5.0/js/all.js#faload', array('font-awesome-shim'), GEODIRECTORY_VERSION);
|
| 71 | 71 | // wp_register_script('font-awesome-shim', 'https://use.fontawesome.com/releases/v5.5.0/js/v4-shims.js', array(), GEODIRECTORY_VERSION);
|
| 72 | 72 | // wp_enqueue_script( 'font-awesome' ); |
| 73 | 73 | |
| 74 | - wp_register_script('geodirectory-admin', geodir_plugin_url() . '/geodirectory-assets/js/admin-req.min.js', array('jquery'), GEODIRECTORY_VERSION);
|
|
| 75 | - wp_enqueue_script('geodirectory-admin');
|
|
| 74 | + wp_register_script('geodirectory-admin', geodir_plugin_url() . '/geodirectory-assets/js/admin-req.min.js', array('jquery'), GEODIRECTORY_VERSION);
|
|
| 75 | + wp_enqueue_script('geodirectory-admin');
|
|
| 76 | 76 | |
| 77 | - } |
|
| 77 | + } |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | if (!function_exists('geodir_admin_scripts')) {
|
| 81 | - /** |
|
| 82 | - * Enqueue Admin Scripts. |
|
| 83 | - * |
|
| 84 | - * @since 1.0.0 |
|
| 85 | - * @package GeoDirectory |
|
| 86 | - */ |
|
| 87 | - function geodir_admin_scripts() |
|
| 88 | - {
|
|
| 89 | - $geodir_map_name = geodir_map_name(); |
|
| 81 | + /** |
|
| 82 | + * Enqueue Admin Scripts. |
|
| 83 | + * |
|
| 84 | + * @since 1.0.0 |
|
| 85 | + * @package GeoDirectory |
|
| 86 | + */ |
|
| 87 | + function geodir_admin_scripts() |
|
| 88 | + {
|
|
| 89 | + $geodir_map_name = geodir_map_name(); |
|
| 90 | 90 | |
| 91 | - wp_enqueue_script('jquery');
|
|
| 91 | + wp_enqueue_script('jquery');
|
|
| 92 | 92 | |
| 93 | - wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), '', true);
|
|
| 93 | + wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), '', true);
|
|
| 94 | 94 | |
| 95 | - wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.js', array('jquery'), GEODIRECTORY_VERSION);
|
|
| 96 | - wp_enqueue_script('chosen');
|
|
| 95 | + wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.js', array('jquery'), GEODIRECTORY_VERSION);
|
|
| 96 | + wp_enqueue_script('chosen');
|
|
| 97 | 97 | |
| 98 | - wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.js', array(), GEODIRECTORY_VERSION);
|
|
| 99 | - wp_enqueue_script('geodirectory-choose-ajax');
|
|
| 98 | + wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.js', array(), GEODIRECTORY_VERSION);
|
|
| 99 | + wp_enqueue_script('geodirectory-choose-ajax');
|
|
| 100 | 100 | |
| 101 | - if (isset($_REQUEST['listing_type'])) {
|
|
| 102 | - wp_register_script('geodirectory-custom-fields-script', geodir_plugin_url() . '/geodirectory-assets/js/custom_fields.js', array(), GEODIRECTORY_VERSION);
|
|
| 103 | - } |
|
| 101 | + if (isset($_REQUEST['listing_type'])) {
|
|
| 102 | + wp_register_script('geodirectory-custom-fields-script', geodir_plugin_url() . '/geodirectory-assets/js/custom_fields.js', array(), GEODIRECTORY_VERSION);
|
|
| 103 | + } |
|
| 104 | 104 | |
| 105 | - wp_enqueue_script('geodirectory-custom-fields-script');
|
|
| 106 | - $plugin_path = geodir_plugin_url() . '/geodirectory-functions/cat-meta-functions'; |
|
| 105 | + wp_enqueue_script('geodirectory-custom-fields-script');
|
|
| 106 | + $plugin_path = geodir_plugin_url() . '/geodirectory-functions/cat-meta-functions'; |
|
| 107 | 107 | |
| 108 | - wp_enqueue_script('tax-meta-clss', $plugin_path . '/js/tax-meta-clss.js', array('jquery'), null, true);
|
|
| 108 | + wp_enqueue_script('tax-meta-clss', $plugin_path . '/js/tax-meta-clss.js', array('jquery'), null, true);
|
|
| 109 | 109 | |
| 110 | - if (in_array($geodir_map_name, array('auto', 'google'))) {
|
|
| 111 | - $map_lang = "&language=" . geodir_get_map_default_language(); |
|
| 112 | - $map_key = "&key=" . geodir_get_map_api_key(); |
|
| 113 | - /** This filter is documented in geodirectory_template_tags.php */ |
|
| 114 | - $map_extra = apply_filters('geodir_googlemap_script_extra', '');
|
|
| 115 | - wp_enqueue_script('google-maps-api', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra, '', NULL);
|
|
| 110 | + if (in_array($geodir_map_name, array('auto', 'google'))) {
|
|
| 111 | + $map_lang = "&language=" . geodir_get_map_default_language(); |
|
| 112 | + $map_key = "&key=" . geodir_get_map_api_key(); |
|
| 113 | + /** This filter is documented in geodirectory_template_tags.php */ |
|
| 114 | + $map_extra = apply_filters('geodir_googlemap_script_extra', '');
|
|
| 115 | + wp_enqueue_script('google-maps-api', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra, '', NULL);
|
|
| 116 | 116 | |
| 117 | - // Overlapping Marker Spiderfier |
|
| 118 | - wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 119 | - wp_enqueue_script('geodirectory-g-overlappingmarker-script');
|
|
| 120 | - } |
|
| 117 | + // Overlapping Marker Spiderfier |
|
| 118 | + wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 119 | + wp_enqueue_script('geodirectory-g-overlappingmarker-script');
|
|
| 120 | + } |
|
| 121 | 121 | |
| 122 | - if ($geodir_map_name == 'osm') {
|
|
| 123 | - // Leaflet OpenStreetMap |
|
| 124 | - wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
|
|
| 125 | - wp_enqueue_style('geodirectory-leaflet-style');
|
|
| 122 | + if ($geodir_map_name == 'osm') {
|
|
| 123 | + // Leaflet OpenStreetMap |
|
| 124 | + wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
|
|
| 125 | + wp_enqueue_style('geodirectory-leaflet-style');
|
|
| 126 | 126 | |
| 127 | - wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 128 | - wp_enqueue_script('geodirectory-leaflet-script');
|
|
| 127 | + wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 128 | + wp_enqueue_script('geodirectory-leaflet-script');
|
|
| 129 | 129 | |
| 130 | - wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.min.js', array('geodirectory-leaflet-script'), GEODIRECTORY_VERSION);
|
|
| 131 | - wp_enqueue_script('geodirectory-leaflet-geo-script');
|
|
| 130 | + wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.min.js', array('geodirectory-leaflet-script'), GEODIRECTORY_VERSION);
|
|
| 131 | + wp_enqueue_script('geodirectory-leaflet-geo-script');
|
|
| 132 | 132 | |
| 133 | - // Overlapping Marker Spiderfier Leaflet |
|
| 134 | - wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 135 | - wp_enqueue_script('geodirectory-o-overlappingmarker-script');
|
|
| 136 | - } |
|
| 137 | - wp_enqueue_script( 'jquery-ui-autocomplete' ); |
|
| 133 | + // Overlapping Marker Spiderfier Leaflet |
|
| 134 | + wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 135 | + wp_enqueue_script('geodirectory-o-overlappingmarker-script');
|
|
| 136 | + } |
|
| 137 | + wp_enqueue_script( 'jquery-ui-autocomplete' ); |
|
| 138 | 138 | |
| 139 | - wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true);
|
|
| 140 | - wp_enqueue_script('geodirectory-goMap-script');
|
|
| 139 | + wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true);
|
|
| 140 | + wp_enqueue_script('geodirectory-goMap-script');
|
|
| 141 | 141 | |
| 142 | - wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.js', array(), GEODIRECTORY_VERSION);
|
|
| 143 | - wp_enqueue_script('geodirectory-goMap-script');
|
|
| 142 | + wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.js', array(), GEODIRECTORY_VERSION);
|
|
| 143 | + wp_enqueue_script('geodirectory-goMap-script');
|
|
| 144 | 144 | |
| 145 | 145 | // font awesome rating script |
| 146 | 146 | if (get_option('geodir_reviewrating_enable_font_awesome')) {
|
@@ -151,167 +151,167 @@ discard block |
||
| 151 | 151 | wp_enqueue_script('geodir-jRating-js');
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 155 | - wp_enqueue_script('geodir-on-document-load');
|
|
| 156 | - |
|
| 157 | - |
|
| 158 | - // SCRIPT FOR UPLOAD |
|
| 159 | - wp_enqueue_script('plupload-all');
|
|
| 160 | - wp_enqueue_script('jquery-ui-sortable');
|
|
| 161 | - |
|
| 162 | - wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.js', array(), GEODIRECTORY_VERSION);
|
|
| 163 | - wp_enqueue_script('geodirectory-plupload-script');
|
|
| 164 | - |
|
| 165 | - // SCRIPT FOR UPLOAD END |
|
| 166 | - |
|
| 167 | - |
|
| 168 | - // place js config array for plupload |
|
| 169 | - $plupload_init = array( |
|
| 170 | - 'runtimes' => 'html5,silverlight,html4', |
|
| 171 | - 'browse_button' => 'plupload-browse-button', // will be adjusted per uploader |
|
| 172 | - 'container' => 'plupload-upload-ui', // will be adjusted per uploader |
|
| 173 | - 'drop_element' => 'dropbox', // will be adjusted per uploader |
|
| 174 | - 'file_data_name' => 'async-upload', // will be adjusted per uploader |
|
| 175 | - 'multiple_queues' => true, |
|
| 176 | - 'max_file_size' => geodir_max_upload_size(), |
|
| 177 | - 'url' => admin_url('admin-ajax.php'),
|
|
| 178 | - 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
|
|
| 179 | - 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
|
|
| 180 | - 'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')),
|
|
| 181 | - 'multipart' => true, |
|
| 182 | - 'urlstream_upload' => true, |
|
| 183 | - 'multi_selection' => false, // will be added per uploader |
|
| 184 | - // additional post data to send to our ajax hook |
|
| 185 | - 'multipart_params' => array( |
|
| 186 | - '_ajax_nonce' => "", // will be added per uploader |
|
| 187 | - 'action' => 'plupload_action', // the ajax action name |
|
| 188 | - 'imgid' => 0 // will be added per uploader |
|
| 189 | - ) |
|
| 190 | - ); |
|
| 191 | - $base_plupload_config = json_encode($plupload_init); |
|
| 192 | - |
|
| 193 | - |
|
| 194 | - $thumb_img_arr = array(); |
|
| 195 | - |
|
| 196 | - if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
|
| 197 | - $thumb_img_arr = geodir_get_images($_REQUEST['pid']); |
|
| 198 | - |
|
| 199 | - $totImg = ''; |
|
| 200 | - $image_limit = ''; |
|
| 201 | - if (!empty($thumb_img_arr)) {
|
|
| 202 | - $totImg = count($thumb_img_arr); |
|
| 203 | - } |
|
| 154 | + wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 155 | + wp_enqueue_script('geodir-on-document-load');
|
|
| 156 | + |
|
| 157 | + |
|
| 158 | + // SCRIPT FOR UPLOAD |
|
| 159 | + wp_enqueue_script('plupload-all');
|
|
| 160 | + wp_enqueue_script('jquery-ui-sortable');
|
|
| 161 | + |
|
| 162 | + wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.js', array(), GEODIRECTORY_VERSION);
|
|
| 163 | + wp_enqueue_script('geodirectory-plupload-script');
|
|
| 164 | + |
|
| 165 | + // SCRIPT FOR UPLOAD END |
|
| 166 | + |
|
| 167 | + |
|
| 168 | + // place js config array for plupload |
|
| 169 | + $plupload_init = array( |
|
| 170 | + 'runtimes' => 'html5,silverlight,html4', |
|
| 171 | + 'browse_button' => 'plupload-browse-button', // will be adjusted per uploader |
|
| 172 | + 'container' => 'plupload-upload-ui', // will be adjusted per uploader |
|
| 173 | + 'drop_element' => 'dropbox', // will be adjusted per uploader |
|
| 174 | + 'file_data_name' => 'async-upload', // will be adjusted per uploader |
|
| 175 | + 'multiple_queues' => true, |
|
| 176 | + 'max_file_size' => geodir_max_upload_size(), |
|
| 177 | + 'url' => admin_url('admin-ajax.php'),
|
|
| 178 | + 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
|
|
| 179 | + 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
|
|
| 180 | + 'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')),
|
|
| 181 | + 'multipart' => true, |
|
| 182 | + 'urlstream_upload' => true, |
|
| 183 | + 'multi_selection' => false, // will be added per uploader |
|
| 184 | + // additional post data to send to our ajax hook |
|
| 185 | + 'multipart_params' => array( |
|
| 186 | + '_ajax_nonce' => "", // will be added per uploader |
|
| 187 | + 'action' => 'plupload_action', // the ajax action name |
|
| 188 | + 'imgid' => 0 // will be added per uploader |
|
| 189 | + ) |
|
| 190 | + ); |
|
| 191 | + $base_plupload_config = json_encode($plupload_init); |
|
| 192 | + |
|
| 193 | + |
|
| 194 | + $thumb_img_arr = array(); |
|
| 195 | + |
|
| 196 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
|
| 197 | + $thumb_img_arr = geodir_get_images($_REQUEST['pid']); |
|
| 198 | + |
|
| 199 | + $totImg = ''; |
|
| 200 | + $image_limit = ''; |
|
| 201 | + if (!empty($thumb_img_arr)) {
|
|
| 202 | + $totImg = count($thumb_img_arr); |
|
| 203 | + } |
|
| 204 | 204 | |
| 205 | - $gd_plupload_init = array('base_plupload_config' => $base_plupload_config,
|
|
| 206 | - 'totalImg' => $totImg, |
|
| 207 | - 'image_limit' => $image_limit, |
|
| 208 | - 'upload_img_size' => geodir_max_upload_size()); |
|
| 205 | + $gd_plupload_init = array('base_plupload_config' => $base_plupload_config,
|
|
| 206 | + 'totalImg' => $totImg, |
|
| 207 | + 'image_limit' => $image_limit, |
|
| 208 | + 'upload_img_size' => geodir_max_upload_size()); |
|
| 209 | 209 | |
| 210 | - wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
|
|
| 210 | + wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
|
|
| 211 | 211 | |
| 212 | - $ajax_cons_data = array('url' => __(admin_url('admin-ajax.php')));
|
|
| 213 | - wp_localize_script('geodirectory-custom-fields-script', 'geodir_admin_ajax', $ajax_cons_data);
|
|
| 212 | + $ajax_cons_data = array('url' => __(admin_url('admin-ajax.php')));
|
|
| 213 | + wp_localize_script('geodirectory-custom-fields-script', 'geodir_admin_ajax', $ajax_cons_data);
|
|
| 214 | 214 | |
| 215 | 215 | |
| 216 | - wp_register_script('geodirectory-admin-script', geodir_plugin_url() . '/geodirectory-assets/js/admin.js', array(), GEODIRECTORY_VERSION);
|
|
| 217 | - wp_enqueue_script('geodirectory-admin-script');
|
|
| 216 | + wp_register_script('geodirectory-admin-script', geodir_plugin_url() . '/geodirectory-assets/js/admin.js', array(), GEODIRECTORY_VERSION);
|
|
| 217 | + wp_enqueue_script('geodirectory-admin-script');
|
|
| 218 | 218 | |
| 219 | - wp_enqueue_style('farbtastic');
|
|
| 220 | - wp_enqueue_script('farbtastic');
|
|
| 219 | + wp_enqueue_style('farbtastic');
|
|
| 220 | + wp_enqueue_script('farbtastic');
|
|
| 221 | 221 | |
| 222 | - $screen = get_current_screen(); |
|
| 223 | - if ($screen->base == 'post' && in_array($screen->post_type, geodir_get_posttypes())) {
|
|
| 224 | - wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation_admin.js');
|
|
| 225 | - } |
|
| 222 | + $screen = get_current_screen(); |
|
| 223 | + if ($screen->base == 'post' && in_array($screen->post_type, geodir_get_posttypes())) {
|
|
| 224 | + wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation_admin.js');
|
|
| 225 | + } |
|
| 226 | 226 | |
| 227 | - $ajax_cons_data = array('url' => esc_url(__(get_option('siteurl') . '?geodir_ajax=true')));
|
|
| 228 | - wp_localize_script('geodirectory-admin-script', 'geodir_ajax', $ajax_cons_data);
|
|
| 227 | + $ajax_cons_data = array('url' => esc_url(__(get_option('siteurl') . '?geodir_ajax=true')));
|
|
| 228 | + wp_localize_script('geodirectory-admin-script', 'geodir_ajax', $ajax_cons_data);
|
|
| 229 | 229 | |
| 230 | - } |
|
| 230 | + } |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | if (!function_exists('geodir_admin_menu')) {
|
| 234 | - /** |
|
| 235 | - * Admin Menus |
|
| 236 | - * |
|
| 237 | - * Sets up the admin menus in wordpress. |
|
| 238 | - * |
|
| 239 | - * @since 1.0.0 |
|
| 240 | - * @package GeoDirectory |
|
| 241 | - * @global array $menu Menu array. |
|
| 242 | - * @global object $geodirectory GeoDirectory plugin object. |
|
| 243 | - */ |
|
| 244 | - function geodir_admin_menu() |
|
| 245 | - {
|
|
| 246 | - global $menu, $geodirectory; |
|
| 234 | + /** |
|
| 235 | + * Admin Menus |
|
| 236 | + * |
|
| 237 | + * Sets up the admin menus in wordpress. |
|
| 238 | + * |
|
| 239 | + * @since 1.0.0 |
|
| 240 | + * @package GeoDirectory |
|
| 241 | + * @global array $menu Menu array. |
|
| 242 | + * @global object $geodirectory GeoDirectory plugin object. |
|
| 243 | + */ |
|
| 244 | + function geodir_admin_menu() |
|
| 245 | + {
|
|
| 246 | + global $menu, $geodirectory; |
|
| 247 | 247 | |
| 248 | - if (current_user_can('manage_options')) $menu[] = array('', 'read', 'separator-geodirectory', '', 'wp-menu-separator geodirectory');
|
|
| 248 | + if (current_user_can('manage_options')) $menu[] = array('', 'read', 'separator-geodirectory', '', 'wp-menu-separator geodirectory');
|
|
| 249 | 249 | |
| 250 | - add_menu_page(__('Geodirectory', 'geodirectory'), __('Geodirectory', 'geodirectory'), 'manage_options', 'geodirectory', 'geodir_admin_panel', geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico', '55.1984');
|
|
| 250 | + add_menu_page(__('Geodirectory', 'geodirectory'), __('Geodirectory', 'geodirectory'), 'manage_options', 'geodirectory', 'geodir_admin_panel', geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico', '55.1984');
|
|
| 251 | 251 | |
| 252 | 252 | |
| 253 | - } |
|
| 253 | + } |
|
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | if (!function_exists('geodir_admin_menu_order')) {
|
| 257 | - /** |
|
| 258 | - * Order admin menus. |
|
| 259 | - * |
|
| 260 | - * @since 1.0.0 |
|
| 261 | - * @package GeoDirectory |
|
| 262 | - * @param array $menu_order Menu order array. |
|
| 263 | - * @return array Modified menu order array. |
|
| 264 | - */ |
|
| 265 | - function geodir_admin_menu_order($menu_order) |
|
| 266 | - {
|
|
| 267 | - |
|
| 268 | - // Initialize our custom order array |
|
| 269 | - $geodir_menu_order = array(); |
|
| 270 | - |
|
| 271 | - // Get the index of our custom separator |
|
| 272 | - $geodir_separator = array_search('separator-geodirectory', $menu_order);
|
|
| 273 | - |
|
| 274 | - // Get index of posttype menu |
|
| 275 | - $post_types = geodir_get_posttypes(); |
|
| 276 | - |
|
| 277 | - // Loop through menu order and do some rearranging |
|
| 278 | - foreach ($menu_order as $index => $item) : |
|
| 279 | - |
|
| 280 | - if ((('geodirectory') == $item)) :
|
|
| 281 | - $geodir_menu_order[] = 'separator-geodirectory'; |
|
| 282 | - if (!empty($post_types)) {
|
|
| 283 | - foreach ($post_types as $post_type) {
|
|
| 284 | - $geodir_menu_order[] = 'edit.php?post_type=' . $post_type; |
|
| 285 | - } |
|
| 286 | - } |
|
| 287 | - $geodir_menu_order[] = $item; |
|
| 257 | + /** |
|
| 258 | + * Order admin menus. |
|
| 259 | + * |
|
| 260 | + * @since 1.0.0 |
|
| 261 | + * @package GeoDirectory |
|
| 262 | + * @param array $menu_order Menu order array. |
|
| 263 | + * @return array Modified menu order array. |
|
| 264 | + */ |
|
| 265 | + function geodir_admin_menu_order($menu_order) |
|
| 266 | + {
|
|
| 288 | 267 | |
| 289 | - unset($menu_order[$geodir_separator]); |
|
| 290 | - //unset( $menu_order[$geodir_places] ); |
|
| 291 | - elseif (!in_array($item, array('separator-geodirectory'))) :
|
|
| 292 | - $geodir_menu_order[] = $item; |
|
| 293 | - endif; |
|
| 268 | + // Initialize our custom order array |
|
| 269 | + $geodir_menu_order = array(); |
|
| 294 | 270 | |
| 295 | - endforeach; |
|
| 271 | + // Get the index of our custom separator |
|
| 272 | + $geodir_separator = array_search('separator-geodirectory', $menu_order);
|
|
| 296 | 273 | |
| 297 | - // Return order |
|
| 298 | - return $geodir_menu_order; |
|
| 299 | - } |
|
| 274 | + // Get index of posttype menu |
|
| 275 | + $post_types = geodir_get_posttypes(); |
|
| 276 | + |
|
| 277 | + // Loop through menu order and do some rearranging |
|
| 278 | + foreach ($menu_order as $index => $item) : |
|
| 279 | + |
|
| 280 | + if ((('geodirectory') == $item)) :
|
|
| 281 | + $geodir_menu_order[] = 'separator-geodirectory'; |
|
| 282 | + if (!empty($post_types)) {
|
|
| 283 | + foreach ($post_types as $post_type) {
|
|
| 284 | + $geodir_menu_order[] = 'edit.php?post_type=' . $post_type; |
|
| 285 | + } |
|
| 286 | + } |
|
| 287 | + $geodir_menu_order[] = $item; |
|
| 288 | + |
|
| 289 | + unset($menu_order[$geodir_separator]); |
|
| 290 | + //unset( $menu_order[$geodir_places] ); |
|
| 291 | + elseif (!in_array($item, array('separator-geodirectory'))) :
|
|
| 292 | + $geodir_menu_order[] = $item; |
|
| 293 | + endif; |
|
| 294 | + |
|
| 295 | + endforeach; |
|
| 296 | + |
|
| 297 | + // Return order |
|
| 298 | + return $geodir_menu_order; |
|
| 299 | + } |
|
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | if (!function_exists('geodir_admin_custom_menu_order')) {
|
| 303 | - /** |
|
| 304 | - * Enables custom menu order. |
|
| 305 | - * |
|
| 306 | - * @since 1.0.0 |
|
| 307 | - * @package GeoDirectory |
|
| 308 | - * @return bool |
|
| 309 | - */ |
|
| 310 | - function geodir_admin_custom_menu_order() |
|
| 311 | - {
|
|
| 312 | - if (!current_user_can('manage_options')) return false;
|
|
| 313 | - return true; |
|
| 314 | - } |
|
| 303 | + /** |
|
| 304 | + * Enables custom menu order. |
|
| 305 | + * |
|
| 306 | + * @since 1.0.0 |
|
| 307 | + * @package GeoDirectory |
|
| 308 | + * @return bool |
|
| 309 | + */ |
|
| 310 | + function geodir_admin_custom_menu_order() |
|
| 311 | + {
|
|
| 312 | + if (!current_user_can('manage_options')) return false;
|
|
| 313 | + return true; |
|
| 314 | + } |
|
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | /** |
@@ -322,51 +322,51 @@ discard block |
||
| 322 | 322 | */ |
| 323 | 323 | function geodir_before_admin_panel() |
| 324 | 324 | {
|
| 325 | - if (isset($_REQUEST['installed']) && $_REQUEST['installed'] != '') {
|
|
| 326 | - echo '<div id="message" class="updated fade"> |
|
| 325 | + if (isset($_REQUEST['installed']) && $_REQUEST['installed'] != '') {
|
|
| 326 | + echo '<div id="message" class="updated fade"> |
|
| 327 | 327 | <p style="float:right;">' . __('Like Geodirectory?', 'geodirectory') . ' <a href="http://wordpress.org/extend/plugins/Geodirectory/" target="_blank">' . __('Support us by leaving a rating!', 'geodirectory') . '</a></p>
|
| 328 | 328 | <p><strong>' . __('Geodirectory has been installed and setup. Enjoy :)', 'geodirectory') . '</strong></p>
|
| 329 | 329 | </div>'; |
| 330 | 330 | |
| 331 | - } |
|
| 331 | + } |
|
| 332 | 332 | |
| 333 | - if (isset($_REQUEST['msg']) && $_REQUEST['msg'] != '') {
|
|
| 334 | - switch ($_REQUEST['msg']) {
|
|
| 335 | - case 'success': |
|
| 336 | - echo '<div id="message" class="updated fade"><p><strong>' . __('Your settings have been saved.', 'geodirectory') . '</strong></p></div>';
|
|
| 337 | - flush_rewrite_rules(false); |
|
| 333 | + if (isset($_REQUEST['msg']) && $_REQUEST['msg'] != '') {
|
|
| 334 | + switch ($_REQUEST['msg']) {
|
|
| 335 | + case 'success': |
|
| 336 | + echo '<div id="message" class="updated fade"><p><strong>' . __('Your settings have been saved.', 'geodirectory') . '</strong></p></div>';
|
|
| 337 | + flush_rewrite_rules(false); |
|
| 338 | 338 | |
| 339 | - break; |
|
| 339 | + break; |
|
| 340 | 340 | case 'fail': |
| 341 | 341 | $gderr = isset($_REQUEST['gderr']) ? $_REQUEST['gderr'] : ''; |
| 342 | 342 | |
| 343 | 343 | if ($gderr == 21) |
| 344 | - echo '<div id="message" class="error fade"><p><strong>' . __('Error: You can not add same permalinks for both Listing and Location, please try again.', 'geodirectory') . '</strong></p></div>';
|
|
| 344 | + echo '<div id="message" class="error fade"><p><strong>' . __('Error: You can not add same permalinks for both Listing and Location, please try again.', 'geodirectory') . '</strong></p></div>';
|
|
| 345 | 345 | else |
| 346 | 346 | echo '<div id="message" class="error fade"><p><strong>' . __('Error: Your settings have not been saved, please try again.', 'geodirectory') . '</strong></p></div>';
|
| 347 | - break; |
|
| 348 | - } |
|
| 349 | - } |
|
| 347 | + break; |
|
| 348 | + } |
|
| 349 | + } |
|
| 350 | 350 | |
| 351 | - $geodir_load_map = get_option('geodir_load_map');
|
|
| 352 | - $need_map_key = false; |
|
| 353 | - if($geodir_load_map=='' || $geodir_load_map=='google' || $geodir_load_map=='auto' ){
|
|
| 354 | - $need_map_key = true; |
|
| 355 | - } |
|
| 351 | + $geodir_load_map = get_option('geodir_load_map');
|
|
| 352 | + $need_map_key = false; |
|
| 353 | + if($geodir_load_map=='' || $geodir_load_map=='google' || $geodir_load_map=='auto' ){
|
|
| 354 | + $need_map_key = true; |
|
| 355 | + } |
|
| 356 | 356 | |
| 357 | - if (!geodir_get_map_api_key() && $need_map_key) {
|
|
| 358 | - echo '<div class="error"><p><strong>' . sprintf(__('Google Maps API KEY not set, %sclick here%s to set one OR use Open Street Maps instead.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=design_settings&active_tab=geodir_map_settings') . '\'>', '</a>') . '</strong></p></div>';
|
|
| 359 | - } |
|
| 357 | + if (!geodir_get_map_api_key() && $need_map_key) {
|
|
| 358 | + echo '<div class="error"><p><strong>' . sprintf(__('Google Maps API KEY not set, %sclick here%s to set one OR use Open Street Maps instead.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=design_settings&active_tab=geodir_map_settings') . '\'>', '</a>') . '</strong></p></div>';
|
|
| 359 | + } |
|
| 360 | 360 | |
| 361 | - if (!geodir_is_default_location_set()) {
|
|
| 362 | - echo '<div class="updated fade"><p><strong>' . sprintf(__('Please %sclick here%s to set a default location, this will make the plugin work properly.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>') . '</strong></p></div>';
|
|
| 361 | + if (!geodir_is_default_location_set()) {
|
|
| 362 | + echo '<div class="updated fade"><p><strong>' . sprintf(__('Please %sclick here%s to set a default location, this will make the plugin work properly.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>') . '</strong></p></div>';
|
|
| 363 | 363 | |
| 364 | - } |
|
| 364 | + } |
|
| 365 | 365 | |
| 366 | - if (!function_exists('curl_init')) {
|
|
| 367 | - echo '<div class="error"><p><strong>' . __('CURL is not installed on this server, this can cause problems, please ask your server admin to install it.', 'geodirectory') . '</strong></p></div>';
|
|
| 366 | + if (!function_exists('curl_init')) {
|
|
| 367 | + echo '<div class="error"><p><strong>' . __('CURL is not installed on this server, this can cause problems, please ask your server admin to install it.', 'geodirectory') . '</strong></p></div>';
|
|
| 368 | 368 | |
| 369 | - } |
|
| 369 | + } |
|
| 370 | 370 | |
| 371 | 371 | |
| 372 | 372 | |
@@ -383,19 +383,19 @@ discard block |
||
| 383 | 383 | */ |
| 384 | 384 | function geodir_handle_option_form_submit($current_tab) |
| 385 | 385 | {
|
| 386 | - global $geodir_settings; |
|
| 387 | - if (file_exists(dirname(__FILE__) . '/option-pages/' . $current_tab . '_array.php')) {
|
|
| 388 | - /** |
|
| 389 | - * Contains settings array for current tab. |
|
| 390 | - * |
|
| 391 | - * @since 1.0.0 |
|
| 392 | - * @package GeoDirectory |
|
| 393 | - */ |
|
| 394 | - include_once('option-pages/' . $current_tab . '_array.php');
|
|
| 395 | - } |
|
| 396 | - if (isset($_POST) && $_POST && isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') : |
|
| 397 | - if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
|
|
| 398 | - if (!wp_verify_nonce($_REQUEST['_wpnonce-' . $current_tab], 'geodir-settings-' . $current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
|
|
| 386 | + global $geodir_settings; |
|
| 387 | + if (file_exists(dirname(__FILE__) . '/option-pages/' . $current_tab . '_array.php')) {
|
|
| 388 | + /** |
|
| 389 | + * Contains settings array for current tab. |
|
| 390 | + * |
|
| 391 | + * @since 1.0.0 |
|
| 392 | + * @package GeoDirectory |
|
| 393 | + */ |
|
| 394 | + include_once('option-pages/' . $current_tab . '_array.php');
|
|
| 395 | + } |
|
| 396 | + if (isset($_POST) && $_POST && isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') : |
|
| 397 | + if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
|
|
| 398 | + if (!wp_verify_nonce($_REQUEST['_wpnonce-' . $current_tab], 'geodir-settings-' . $current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
|
|
| 399 | 399 | |
| 400 | 400 | /** |
| 401 | 401 | * Fires before updating geodirectory admin settings. |
@@ -407,38 +407,38 @@ discard block |
||
| 407 | 407 | */ |
| 408 | 408 | do_action('geodir_before_update_options', $current_tab, $geodir_settings);
|
| 409 | 409 | |
| 410 | - if (!empty($geodir_settings[$current_tab])) |
|
| 411 | - geodir_update_options($geodir_settings[$current_tab]); |
|
| 410 | + if (!empty($geodir_settings[$current_tab])) |
|
| 411 | + geodir_update_options($geodir_settings[$current_tab]); |
|
| 412 | 412 | |
| 413 | - /** |
|
| 414 | - * Called after GeoDirectory options settings are updated. |
|
| 415 | - * |
|
| 416 | - * @since 1.0.0 |
|
| 417 | - * @param array $geodir_settings The array of GeoDirectory settings. |
|
| 418 | - * @see 'geodir_before_update_options' |
|
| 419 | - */ |
|
| 420 | - do_action('geodir_update_options', $geodir_settings);
|
|
| 413 | + /** |
|
| 414 | + * Called after GeoDirectory options settings are updated. |
|
| 415 | + * |
|
| 416 | + * @since 1.0.0 |
|
| 417 | + * @param array $geodir_settings The array of GeoDirectory settings. |
|
| 418 | + * @see 'geodir_before_update_options' |
|
| 419 | + */ |
|
| 420 | + do_action('geodir_update_options', $geodir_settings);
|
|
| 421 | 421 | |
| 422 | - /** |
|
| 423 | - * Called after GeoDirectory options settings are updated. |
|
| 424 | - * |
|
| 425 | - * Provides tab specific settings. |
|
| 426 | - * |
|
| 427 | - * @since 1.0.0 |
|
| 428 | - * @param string $current_tab The current settings tab name. |
|
| 429 | - * @param array $geodir_settings[$current_tab] The array of settings for the current settings tab. |
|
| 430 | - */ |
|
| 431 | - do_action('geodir_update_options_' . $current_tab, $geodir_settings[$current_tab]);
|
|
| 422 | + /** |
|
| 423 | + * Called after GeoDirectory options settings are updated. |
|
| 424 | + * |
|
| 425 | + * Provides tab specific settings. |
|
| 426 | + * |
|
| 427 | + * @since 1.0.0 |
|
| 428 | + * @param string $current_tab The current settings tab name. |
|
| 429 | + * @param array $geodir_settings[$current_tab] The array of settings for the current settings tab. |
|
| 430 | + */ |
|
| 431 | + do_action('geodir_update_options_' . $current_tab, $geodir_settings[$current_tab]);
|
|
| 432 | 432 | |
| 433 | - flush_rewrite_rules(false); |
|
| 433 | + flush_rewrite_rules(false); |
|
| 434 | 434 | |
| 435 | - $current_tab = isset($_REQUEST['tab']) ? $_REQUEST['tab'] : ''; |
|
| 435 | + $current_tab = isset($_REQUEST['tab']) ? $_REQUEST['tab'] : ''; |
|
| 436 | 436 | |
| 437 | - $redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $_REQUEST['active_tab'] . '&msg=success');
|
|
| 437 | + $redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $_REQUEST['active_tab'] . '&msg=success');
|
|
| 438 | 438 | |
| 439 | - wp_redirect($redirect_url); |
|
| 440 | - exit(); |
|
| 441 | - endif; |
|
| 439 | + wp_redirect($redirect_url); |
|
| 440 | + exit(); |
|
| 441 | + endif; |
|
| 442 | 442 | |
| 443 | 443 | |
| 444 | 444 | } |
@@ -456,144 +456,144 @@ discard block |
||
| 456 | 456 | * @return bool Returns true if saved. |
| 457 | 457 | */ |
| 458 | 458 | function geodir_update_options($options, $dummy = false) {
|
| 459 | - if ((!isset($_POST) || !$_POST) && !$dummy) return false; |
|
| 459 | + if ((!isset($_POST) || !$_POST) && !$dummy) return false; |
|
| 460 | 460 | |
| 461 | - foreach ($options as $value) {
|
|
| 462 | - if ($dummy && isset($value['std'])) |
|
| 463 | - $_POST[$value['id']] = $value['std']; |
|
| 461 | + foreach ($options as $value) {
|
|
| 462 | + if ($dummy && isset($value['std'])) |
|
| 463 | + $_POST[$value['id']] = $value['std']; |
|
| 464 | 464 | |
| 465 | 465 | |
| 466 | - if (isset($value['type']) && $value['type'] == 'checkbox') : |
|
| 466 | + if (isset($value['type']) && $value['type'] == 'checkbox') : |
|
| 467 | 467 | |
| 468 | - if (isset($value['id']) && isset($_POST[$value['id']])) {
|
|
| 469 | - update_option($value['id'], $_POST[$value['id']]); |
|
| 470 | - } else {
|
|
| 471 | - update_option($value['id'], 0); |
|
| 472 | - } |
|
| 468 | + if (isset($value['id']) && isset($_POST[$value['id']])) {
|
|
| 469 | + update_option($value['id'], $_POST[$value['id']]); |
|
| 470 | + } else {
|
|
| 471 | + update_option($value['id'], 0); |
|
| 472 | + } |
|
| 473 | 473 | |
| 474 | - elseif (isset($value['type']) && $value['type'] == 'image_width') : |
|
| 474 | + elseif (isset($value['type']) && $value['type'] == 'image_width') : |
|
| 475 | 475 | |
| 476 | - if (isset($value['id']) && isset($_POST[$value['id'] . '_width'])) {
|
|
| 477 | - update_option($value['id'] . '_width', $_POST[$value['id'] . '_width']); |
|
| 478 | - update_option($value['id'] . '_height', $_POST[$value['id'] . '_height']); |
|
| 479 | - if (isset($_POST[$value['id'] . '_crop'])) : |
|
| 480 | - update_option($value['id'] . '_crop', 1); |
|
| 481 | - else : |
|
| 482 | - update_option($value['id'] . '_crop', 0); |
|
| 483 | - endif; |
|
| 484 | - } else {
|
|
| 485 | - update_option($value['id'] . '_width', $value['std']); |
|
| 486 | - update_option($value['id'] . '_height', $value['std']); |
|
| 487 | - update_option($value['id'] . '_crop', 1); |
|
| 488 | - } |
|
| 476 | + if (isset($value['id']) && isset($_POST[$value['id'] . '_width'])) {
|
|
| 477 | + update_option($value['id'] . '_width', $_POST[$value['id'] . '_width']); |
|
| 478 | + update_option($value['id'] . '_height', $_POST[$value['id'] . '_height']); |
|
| 479 | + if (isset($_POST[$value['id'] . '_crop'])) : |
|
| 480 | + update_option($value['id'] . '_crop', 1); |
|
| 481 | + else : |
|
| 482 | + update_option($value['id'] . '_crop', 0); |
|
| 483 | + endif; |
|
| 484 | + } else {
|
|
| 485 | + update_option($value['id'] . '_width', $value['std']); |
|
| 486 | + update_option($value['id'] . '_height', $value['std']); |
|
| 487 | + update_option($value['id'] . '_crop', 1); |
|
| 488 | + } |
|
| 489 | 489 | |
| 490 | - elseif (isset($value['type']) && $value['type'] == 'map') : |
|
| 491 | - $post_types = array(); |
|
| 492 | - $categories = array(); |
|
| 490 | + elseif (isset($value['type']) && $value['type'] == 'map') : |
|
| 491 | + $post_types = array(); |
|
| 492 | + $categories = array(); |
|
| 493 | 493 | |
| 494 | - if (!empty($_POST['home_map_post_types'])) : |
|
| 495 | - foreach ($_POST['home_map_post_types'] as $post_type) : |
|
| 496 | - $post_types[] = $post_type; |
|
| 497 | - endforeach; |
|
| 498 | - endif; |
|
| 494 | + if (!empty($_POST['home_map_post_types'])) : |
|
| 495 | + foreach ($_POST['home_map_post_types'] as $post_type) : |
|
| 496 | + $post_types[] = $post_type; |
|
| 497 | + endforeach; |
|
| 498 | + endif; |
|
| 499 | 499 | |
| 500 | - update_option('geodir_exclude_post_type_on_map', $post_types);
|
|
| 500 | + update_option('geodir_exclude_post_type_on_map', $post_types);
|
|
| 501 | 501 | |
| 502 | - if (!empty($_POST['post_category'])) : |
|
| 503 | - foreach ($_POST['post_category'] as $texonomy => $cat_arr) : |
|
| 504 | - $categories[$texonomy] = array(); |
|
| 505 | - foreach ($cat_arr as $category) : |
|
| 506 | - $categories[$texonomy][] = $category; |
|
| 507 | - endforeach; |
|
| 508 | - $categories[$texonomy] = !empty($categories[$texonomy]) ? array_unique($categories[$texonomy]) : array(); |
|
| 509 | - endforeach; |
|
| 510 | - endif; |
|
| 511 | - update_option('geodir_exclude_cat_on_map', $categories);
|
|
| 512 | - update_option('geodir_exclude_cat_on_map_upgrade', 1);
|
|
| 513 | - elseif (isset($value['type']) && $value['type'] == 'map_default_settings') : |
|
| 502 | + if (!empty($_POST['post_category'])) : |
|
| 503 | + foreach ($_POST['post_category'] as $texonomy => $cat_arr) : |
|
| 504 | + $categories[$texonomy] = array(); |
|
| 505 | + foreach ($cat_arr as $category) : |
|
| 506 | + $categories[$texonomy][] = $category; |
|
| 507 | + endforeach; |
|
| 508 | + $categories[$texonomy] = !empty($categories[$texonomy]) ? array_unique($categories[$texonomy]) : array(); |
|
| 509 | + endforeach; |
|
| 510 | + endif; |
|
| 511 | + update_option('geodir_exclude_cat_on_map', $categories);
|
|
| 512 | + update_option('geodir_exclude_cat_on_map_upgrade', 1);
|
|
| 513 | + elseif (isset($value['type']) && $value['type'] == 'map_default_settings') : |
|
| 514 | 514 | |
| 515 | 515 | |
| 516 | - if (!empty($_POST['geodir_default_map_language'])): |
|
| 517 | - update_option('geodir_default_map_language', $_POST['geodir_default_map_language']);
|
|
| 518 | - endif; |
|
| 516 | + if (!empty($_POST['geodir_default_map_language'])): |
|
| 517 | + update_option('geodir_default_map_language', $_POST['geodir_default_map_language']);
|
|
| 518 | + endif; |
|
| 519 | 519 | |
| 520 | 520 | |
| 521 | - if (!empty($_POST['geodir_default_map_search_pt'])): |
|
| 522 | - update_option('geodir_default_map_search_pt', $_POST['geodir_default_map_search_pt']);
|
|
| 523 | - endif; |
|
| 521 | + if (!empty($_POST['geodir_default_map_search_pt'])): |
|
| 522 | + update_option('geodir_default_map_search_pt', $_POST['geodir_default_map_search_pt']);
|
|
| 523 | + endif; |
|
| 524 | 524 | |
| 525 | 525 | |
| 526 | - elseif (isset($value['type']) && $value['type'] == 'file') : |
|
| 526 | + elseif (isset($value['type']) && $value['type'] == 'file') : |
|
| 527 | 527 | |
| 528 | 528 | |
| 529 | - if (isset($_POST[$value['id'] . '_remove']) && $_POST[$value['id'] . '_remove']) {// if remove is set then remove the file
|
|
| 529 | + if (isset($_POST[$value['id'] . '_remove']) && $_POST[$value['id'] . '_remove']) {// if remove is set then remove the file
|
|
| 530 | 530 | |
| 531 | - if (get_option($value['id'])) {
|
|
| 532 | - $image_name_arr = explode('/', get_option($value['id']));
|
|
| 533 | - $noimg_name = end($image_name_arr); |
|
| 534 | - $img_path = $uploads['path'] . '/' . $noimg_name; |
|
| 535 | - if (file_exists($img_path)) |
|
| 536 | - unlink($img_path); |
|
| 537 | - } |
|
| 531 | + if (get_option($value['id'])) {
|
|
| 532 | + $image_name_arr = explode('/', get_option($value['id']));
|
|
| 533 | + $noimg_name = end($image_name_arr); |
|
| 534 | + $img_path = $uploads['path'] . '/' . $noimg_name; |
|
| 535 | + if (file_exists($img_path)) |
|
| 536 | + unlink($img_path); |
|
| 537 | + } |
|
| 538 | 538 | |
| 539 | - update_option($value['id'], ''); |
|
| 540 | - } |
|
| 539 | + update_option($value['id'], ''); |
|
| 540 | + } |
|
| 541 | 541 | |
| 542 | - $uploadedfile = isset($_FILES[$value['id']]) ? $_FILES[$value['id']] : ''; |
|
| 543 | - $filename = isset($_FILES[$value['id']]['name']) ? $_FILES[$value['id']]['name'] : ''; |
|
| 544 | - |
|
| 545 | - if (!empty($filename)): |
|
| 546 | - $ext = pathinfo($filename, PATHINFO_EXTENSION); |
|
| 547 | - $uplaods = array(); |
|
| 548 | - |
|
| 549 | - foreach ($uploadedfile as $key => $uplaod): |
|
| 550 | - if ($key == 'name'): |
|
| 551 | - $uplaods[$key] = $filename; |
|
| 552 | - else : |
|
| 553 | - $uplaods[$key] = $uplaod; |
|
| 554 | - endif; |
|
| 555 | - endforeach; |
|
| 556 | - |
|
| 557 | - $uploads = wp_upload_dir(); |
|
| 558 | - |
|
| 559 | - if (get_option($value['id'])) {
|
|
| 560 | - $image_name_arr = explode('/', get_option($value['id']));
|
|
| 561 | - $noimg_name = end($image_name_arr); |
|
| 562 | - $img_path = $uploads['path'] . '/' . $noimg_name; |
|
| 563 | - if (file_exists($img_path)) |
|
| 564 | - unlink($img_path); |
|
| 565 | - } |
|
| 542 | + $uploadedfile = isset($_FILES[$value['id']]) ? $_FILES[$value['id']] : ''; |
|
| 543 | + $filename = isset($_FILES[$value['id']]['name']) ? $_FILES[$value['id']]['name'] : ''; |
|
| 544 | + |
|
| 545 | + if (!empty($filename)): |
|
| 546 | + $ext = pathinfo($filename, PATHINFO_EXTENSION); |
|
| 547 | + $uplaods = array(); |
|
| 548 | + |
|
| 549 | + foreach ($uploadedfile as $key => $uplaod): |
|
| 550 | + if ($key == 'name'): |
|
| 551 | + $uplaods[$key] = $filename; |
|
| 552 | + else : |
|
| 553 | + $uplaods[$key] = $uplaod; |
|
| 554 | + endif; |
|
| 555 | + endforeach; |
|
| 556 | + |
|
| 557 | + $uploads = wp_upload_dir(); |
|
| 558 | + |
|
| 559 | + if (get_option($value['id'])) {
|
|
| 560 | + $image_name_arr = explode('/', get_option($value['id']));
|
|
| 561 | + $noimg_name = end($image_name_arr); |
|
| 562 | + $img_path = $uploads['path'] . '/' . $noimg_name; |
|
| 563 | + if (file_exists($img_path)) |
|
| 564 | + unlink($img_path); |
|
| 565 | + } |
|
| 566 | 566 | |
| 567 | - $upload_overrides = array('test_form' => false);
|
|
| 568 | - $movefile = wp_handle_upload($uplaods, $upload_overrides); |
|
| 567 | + $upload_overrides = array('test_form' => false);
|
|
| 568 | + $movefile = wp_handle_upload($uplaods, $upload_overrides); |
|
| 569 | 569 | |
| 570 | - update_option($value['id'], $movefile['url']); |
|
| 570 | + update_option($value['id'], $movefile['url']); |
|
| 571 | 571 | |
| 572 | - endif; |
|
| 572 | + endif; |
|
| 573 | 573 | |
| 574 | - if (!get_option($value['id']) && isset($value['value'])): |
|
| 575 | - update_option($value['id'], $value['value']); |
|
| 576 | - endif; |
|
| 574 | + if (!get_option($value['id']) && isset($value['value'])): |
|
| 575 | + update_option($value['id'], $value['value']); |
|
| 576 | + endif; |
|
| 577 | 577 | |
| 578 | 578 | |
| 579 | - else : |
|
| 580 | - // same menu setting per theme. |
|
| 581 | - if (isset($value['id']) && $value['id'] == 'geodir_theme_location_nav' && isset($_POST[$value['id']])) {
|
|
| 582 | - $theme = wp_get_theme(); |
|
| 583 | - update_option('geodir_theme_location_nav_' . $theme->name, $_POST[$value['id']]);
|
|
| 584 | - } |
|
| 579 | + else : |
|
| 580 | + // same menu setting per theme. |
|
| 581 | + if (isset($value['id']) && $value['id'] == 'geodir_theme_location_nav' && isset($_POST[$value['id']])) {
|
|
| 582 | + $theme = wp_get_theme(); |
|
| 583 | + update_option('geodir_theme_location_nav_' . $theme->name, $_POST[$value['id']]);
|
|
| 584 | + } |
|
| 585 | 585 | |
| 586 | - if (isset($value['id']) && isset($_POST[$value['id']])) {
|
|
| 587 | - update_option($value['id'], $_POST[$value['id']]); |
|
| 588 | - } else {
|
|
| 589 | - delete_option($value['id']); |
|
| 590 | - } |
|
| 586 | + if (isset($value['id']) && isset($_POST[$value['id']])) {
|
|
| 587 | + update_option($value['id'], $_POST[$value['id']]); |
|
| 588 | + } else {
|
|
| 589 | + delete_option($value['id']); |
|
| 590 | + } |
|
| 591 | 591 | |
| 592 | - endif; |
|
| 593 | - } |
|
| 594 | - if ($dummy) |
|
| 595 | - $_POST = array(); |
|
| 596 | - return true; |
|
| 592 | + endif; |
|
| 593 | + } |
|
| 594 | + if ($dummy) |
|
| 595 | + $_POST = array(); |
|
| 596 | + return true; |
|
| 597 | 597 | |
| 598 | 598 | } |
| 599 | 599 | |
@@ -642,33 +642,33 @@ discard block |
||
| 642 | 642 | function places_custom_fields_tab($tabs) |
| 643 | 643 | {
|
| 644 | 644 | |
| 645 | - $geodir_post_types = get_option('geodir_post_types');
|
|
| 645 | + $geodir_post_types = get_option('geodir_post_types');
|
|
| 646 | 646 | |
| 647 | - if (!empty($geodir_post_types)) {
|
|
| 647 | + if (!empty($geodir_post_types)) {
|
|
| 648 | 648 | |
| 649 | - foreach ($geodir_post_types as $geodir_post_type => $geodir_posttype_info): |
|
| 649 | + foreach ($geodir_post_types as $geodir_post_type => $geodir_posttype_info): |
|
| 650 | 650 | |
| 651 | - $listing_slug = __($geodir_posttype_info['labels']['singular_name'], 'geodirectory'); |
|
| 651 | + $listing_slug = __($geodir_posttype_info['labels']['singular_name'], 'geodirectory'); |
|
| 652 | 652 | |
| 653 | - $tabs[$geodir_post_type . '_fields_settings'] = array( |
|
| 654 | - 'label' => wp_sprintf(__('%s Settings', 'geodirectory'), $listing_slug),
|
|
| 655 | - 'subtabs' => array( |
|
| 656 | - array('subtab' => 'custom_fields',
|
|
| 657 | - 'label' => __('Custom Fields', 'geodirectory'),
|
|
| 658 | - 'request' => array('listing_type' => $geodir_post_type)),
|
|
| 659 | - array('subtab' => 'sorting_options',
|
|
| 660 | - 'label' => __('Sorting Options', 'geodirectory'),
|
|
| 661 | - 'request' => array('listing_type' => $geodir_post_type)),
|
|
| 662 | - ), |
|
| 663 | - 'tab_index' => 9, |
|
| 664 | - 'request' => array('listing_type' => $geodir_post_type)
|
|
| 665 | - ); |
|
| 653 | + $tabs[$geodir_post_type . '_fields_settings'] = array( |
|
| 654 | + 'label' => wp_sprintf(__('%s Settings', 'geodirectory'), $listing_slug),
|
|
| 655 | + 'subtabs' => array( |
|
| 656 | + array('subtab' => 'custom_fields',
|
|
| 657 | + 'label' => __('Custom Fields', 'geodirectory'),
|
|
| 658 | + 'request' => array('listing_type' => $geodir_post_type)),
|
|
| 659 | + array('subtab' => 'sorting_options',
|
|
| 660 | + 'label' => __('Sorting Options', 'geodirectory'),
|
|
| 661 | + 'request' => array('listing_type' => $geodir_post_type)),
|
|
| 662 | + ), |
|
| 663 | + 'tab_index' => 9, |
|
| 664 | + 'request' => array('listing_type' => $geodir_post_type)
|
|
| 665 | + ); |
|
| 666 | 666 | |
| 667 | - endforeach; |
|
| 667 | + endforeach; |
|
| 668 | 668 | |
| 669 | - } |
|
| 669 | + } |
|
| 670 | 670 | |
| 671 | - return $tabs; |
|
| 671 | + return $tabs; |
|
| 672 | 672 | } |
| 673 | 673 | |
| 674 | 674 | |
@@ -684,9 +684,9 @@ discard block |
||
| 684 | 684 | */ |
| 685 | 685 | function geodir_tools_setting_tab($tabs) |
| 686 | 686 | {
|
| 687 | - wp_enqueue_script( 'jquery-ui-progressbar' ); |
|
| 688 | - $tabs['tools_settings'] = array('label' => __('GD Tools', 'geodirectory'));
|
|
| 689 | - return $tabs; |
|
| 687 | + wp_enqueue_script( 'jquery-ui-progressbar' ); |
|
| 688 | + $tabs['tools_settings'] = array('label' => __('GD Tools', 'geodirectory'));
|
|
| 689 | + return $tabs; |
|
| 690 | 690 | } |
| 691 | 691 | |
| 692 | 692 | /** |
@@ -701,8 +701,8 @@ discard block |
||
| 701 | 701 | */ |
| 702 | 702 | function geodir_compatibility_setting_tab($tabs) |
| 703 | 703 | {
|
| 704 | - $tabs['compatibility_settings'] = array('label' => __('Theme Compatibility', 'geodirectory'));
|
|
| 705 | - return $tabs; |
|
| 704 | + $tabs['compatibility_settings'] = array('label' => __('Theme Compatibility', 'geodirectory'));
|
|
| 705 | + return $tabs; |
|
| 706 | 706 | } |
| 707 | 707 | |
| 708 | 708 | |
@@ -718,144 +718,144 @@ discard block |
||
| 718 | 718 | */ |
| 719 | 719 | function geodir_extend_geodirectory_setting_tab($tabs) |
| 720 | 720 | {
|
| 721 | - $tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory'). ' <i class="fas fa-plug"></i>', 'url' => 'https://wpgeodirectory.com', 'target' => '_blank');
|
|
| 722 | - return $tabs; |
|
| 721 | + $tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory'). ' <i class="fas fa-plug"></i>', 'url' => 'https://wpgeodirectory.com', 'target' => '_blank');
|
|
| 722 | + return $tabs; |
|
| 723 | 723 | } |
| 724 | 724 | |
| 725 | 725 | |
| 726 | 726 | if (!function_exists('geodir_edit_post_columns')) {
|
| 727 | - /** |
|
| 728 | - * Modify admin post listing page columns. |
|
| 729 | - * |
|
| 730 | - * @since 1.0.0 |
|
| 731 | - * @package GeoDirectory |
|
| 732 | - * @param array $columns The column array. |
|
| 733 | - * @return array Altered column array. |
|
| 734 | - */ |
|
| 735 | - function geodir_edit_post_columns($columns) |
|
| 736 | - {
|
|
| 737 | - |
|
| 738 | - $new_columns = array('location' => __('Location (ID)', 'geodirectory'),
|
|
| 739 | - 'categorys' => __('Categories', 'geodirectory'));
|
|
| 740 | - |
|
| 741 | - if (($offset = array_search('author', array_keys($columns))) === false) // if the key doesn't exist
|
|
| 742 | - {
|
|
| 743 | - $offset = 0; // should we prepend $array with $data? |
|
| 744 | - $offset = count($columns); // or should we append $array with $data? lets pick this one... |
|
| 745 | - } |
|
| 727 | + /** |
|
| 728 | + * Modify admin post listing page columns. |
|
| 729 | + * |
|
| 730 | + * @since 1.0.0 |
|
| 731 | + * @package GeoDirectory |
|
| 732 | + * @param array $columns The column array. |
|
| 733 | + * @return array Altered column array. |
|
| 734 | + */ |
|
| 735 | + function geodir_edit_post_columns($columns) |
|
| 736 | + {
|
|
| 746 | 737 | |
| 747 | - $columns = array_merge(array_slice($columns, 0, $offset), $new_columns, array_slice($columns, $offset)); |
|
| 738 | + $new_columns = array('location' => __('Location (ID)', 'geodirectory'),
|
|
| 739 | + 'categorys' => __('Categories', 'geodirectory'));
|
|
| 748 | 740 | |
| 749 | - $columns = array_merge($columns, array('expire' => __('Expires', 'geodirectory')));
|
|
| 741 | + if (($offset = array_search('author', array_keys($columns))) === false) // if the key doesn't exist
|
|
| 742 | + {
|
|
| 743 | + $offset = 0; // should we prepend $array with $data? |
|
| 744 | + $offset = count($columns); // or should we append $array with $data? lets pick this one... |
|
| 745 | + } |
|
| 750 | 746 | |
| 751 | - return $columns; |
|
| 752 | - } |
|
| 747 | + $columns = array_merge(array_slice($columns, 0, $offset), $new_columns, array_slice($columns, $offset)); |
|
| 748 | + |
|
| 749 | + $columns = array_merge($columns, array('expire' => __('Expires', 'geodirectory')));
|
|
| 750 | + |
|
| 751 | + return $columns; |
|
| 752 | + } |
|
| 753 | 753 | } |
| 754 | 754 | |
| 755 | 755 | |
| 756 | 756 | if (!function_exists('geodir_manage_post_columns')) {
|
| 757 | - /** |
|
| 758 | - * Adds content to our custom post listing page columns. |
|
| 759 | - * |
|
| 760 | - * @since 1.0.0 |
|
| 761 | - * @package GeoDirectory |
|
| 762 | - * @global object $wpdb WordPress Database object. |
|
| 763 | - * @global object $post WordPress Post object. |
|
| 764 | - * @param string $column The column name. |
|
| 765 | - * @param int $post_id The post ID. |
|
| 766 | - */ |
|
| 767 | - function geodir_manage_post_columns($column, $post_id) |
|
| 768 | - {
|
|
| 769 | - global $post, $wpdb; |
|
| 770 | - |
|
| 771 | - switch ($column): |
|
| 772 | - /* If displaying the 'city' column. */ |
|
| 773 | - case 'location' : |
|
| 774 | - $location_id = geodir_get_post_meta($post->ID, 'post_location_id', true); |
|
| 775 | - $location = geodir_get_location($location_id); |
|
| 776 | - /* If no city is found, output a default message. */ |
|
| 777 | - if (empty($location)) {
|
|
| 778 | - _e('Unknown', 'geodirectory');
|
|
| 779 | - } else {
|
|
| 780 | - /* If there is a city id, append 'city name' to the text string. */ |
|
| 781 | - $add_location_id = $location_id > 0 ? ' (' . $location_id . ')' : '';
|
|
| 782 | - echo(__($location->country, 'geodirectory') . '-' . $location->region . '-' . $location->city . $add_location_id); |
|
| 783 | - } |
|
| 784 | - break; |
|
| 785 | - |
|
| 786 | - /* If displaying the 'expire' column. */ |
|
| 787 | - case 'expire' : |
|
| 788 | - $expire_date = geodir_get_post_meta($post->ID, 'expire_date', true); |
|
| 789 | - $d1 = $expire_date; // get expire_date |
|
| 790 | - $d2 = date('Y-m-d'); // get current date
|
|
| 791 | - $state = __('days left', 'geodirectory');
|
|
| 792 | - $date_diff_text = ''; |
|
| 793 | - $expire_class = 'expire_left'; |
|
| 794 | - if ($expire_date != 'Never') {
|
|
| 795 | - if (strtotime($d1) < strtotime($d2)) {
|
|
| 796 | - $state = __('days overdue', 'geodirectory');
|
|
| 797 | - $expire_class = 'expire_over'; |
|
| 798 | - } |
|
| 799 | - $date_diff = round(abs(strtotime($d1) - strtotime($d2)) / 86400); // get the difference in days |
|
| 800 | - $date_diff_text = '<br /><span class="' . $expire_class . '">(' . $date_diff . ' ' . $state . ')</span>';
|
|
| 801 | - } |
|
| 802 | - /* If no expire_date is found, output a default message. */ |
|
| 803 | - if (empty($expire_date)) |
|
| 804 | - echo __('Unknown', 'geodirectory');
|
|
| 805 | - /* If there is a expire_date, append 'days left' to the text string. */ |
|
| 806 | - else |
|
| 807 | - echo $expire_date . $date_diff_text; |
|
| 808 | - break; |
|
| 809 | - |
|
| 810 | - /* If displaying the 'categorys' column. */ |
|
| 811 | - case 'categorys' : |
|
| 812 | - |
|
| 813 | - /* Get the categorys for the post. */ |
|
| 814 | - |
|
| 815 | - |
|
| 816 | - $terms = wp_get_object_terms($post_id, get_object_taxonomies($post)); |
|
| 817 | - |
|
| 818 | - /* If terms were found. */ |
|
| 819 | - if (!empty($terms)) {
|
|
| 820 | - $out = array(); |
|
| 821 | - /* Loop through each term, linking to the 'edit posts' page for the specific term. */ |
|
| 822 | - foreach ($terms as $term) {
|
|
| 823 | - if (!strstr($term->taxonomy, 'tag')) {
|
|
| 824 | - $out[] = sprintf('<a href="%s">%s</a>',
|
|
| 825 | - esc_url(add_query_arg(array('post_type' => $post->post_type, $term->taxonomy => $term->slug), 'edit.php')),
|
|
| 826 | - esc_html(sanitize_term_field('name', $term->name, $term->term_id, $term->taxonomy, 'display'))
|
|
| 827 | - ); |
|
| 828 | - } |
|
| 829 | - } |
|
| 830 | - /* Join the terms, separating them with a comma. */ |
|
| 831 | - echo(join(', ', $out));
|
|
| 832 | - } /* If no terms were found, output a default message. */ |
|
| 833 | - else {
|
|
| 834 | - _e('No Categories', 'geodirectory');
|
|
| 835 | - } |
|
| 836 | - break; |
|
| 757 | + /** |
|
| 758 | + * Adds content to our custom post listing page columns. |
|
| 759 | + * |
|
| 760 | + * @since 1.0.0 |
|
| 761 | + * @package GeoDirectory |
|
| 762 | + * @global object $wpdb WordPress Database object. |
|
| 763 | + * @global object $post WordPress Post object. |
|
| 764 | + * @param string $column The column name. |
|
| 765 | + * @param int $post_id The post ID. |
|
| 766 | + */ |
|
| 767 | + function geodir_manage_post_columns($column, $post_id) |
|
| 768 | + {
|
|
| 769 | + global $post, $wpdb; |
|
| 770 | + |
|
| 771 | + switch ($column): |
|
| 772 | + /* If displaying the 'city' column. */ |
|
| 773 | + case 'location' : |
|
| 774 | + $location_id = geodir_get_post_meta($post->ID, 'post_location_id', true); |
|
| 775 | + $location = geodir_get_location($location_id); |
|
| 776 | + /* If no city is found, output a default message. */ |
|
| 777 | + if (empty($location)) {
|
|
| 778 | + _e('Unknown', 'geodirectory');
|
|
| 779 | + } else {
|
|
| 780 | + /* If there is a city id, append 'city name' to the text string. */ |
|
| 781 | + $add_location_id = $location_id > 0 ? ' (' . $location_id . ')' : '';
|
|
| 782 | + echo(__($location->country, 'geodirectory') . '-' . $location->region . '-' . $location->city . $add_location_id); |
|
| 783 | + } |
|
| 784 | + break; |
|
| 785 | + |
|
| 786 | + /* If displaying the 'expire' column. */ |
|
| 787 | + case 'expire' : |
|
| 788 | + $expire_date = geodir_get_post_meta($post->ID, 'expire_date', true); |
|
| 789 | + $d1 = $expire_date; // get expire_date |
|
| 790 | + $d2 = date('Y-m-d'); // get current date
|
|
| 791 | + $state = __('days left', 'geodirectory');
|
|
| 792 | + $date_diff_text = ''; |
|
| 793 | + $expire_class = 'expire_left'; |
|
| 794 | + if ($expire_date != 'Never') {
|
|
| 795 | + if (strtotime($d1) < strtotime($d2)) {
|
|
| 796 | + $state = __('days overdue', 'geodirectory');
|
|
| 797 | + $expire_class = 'expire_over'; |
|
| 798 | + } |
|
| 799 | + $date_diff = round(abs(strtotime($d1) - strtotime($d2)) / 86400); // get the difference in days |
|
| 800 | + $date_diff_text = '<br /><span class="' . $expire_class . '">(' . $date_diff . ' ' . $state . ')</span>';
|
|
| 801 | + } |
|
| 802 | + /* If no expire_date is found, output a default message. */ |
|
| 803 | + if (empty($expire_date)) |
|
| 804 | + echo __('Unknown', 'geodirectory');
|
|
| 805 | + /* If there is a expire_date, append 'days left' to the text string. */ |
|
| 806 | + else |
|
| 807 | + echo $expire_date . $date_diff_text; |
|
| 808 | + break; |
|
| 837 | 809 | |
| 838 | - endswitch; |
|
| 839 | - } |
|
| 810 | + /* If displaying the 'categorys' column. */ |
|
| 811 | + case 'categorys' : |
|
| 812 | + |
|
| 813 | + /* Get the categorys for the post. */ |
|
| 814 | + |
|
| 815 | + |
|
| 816 | + $terms = wp_get_object_terms($post_id, get_object_taxonomies($post)); |
|
| 817 | + |
|
| 818 | + /* If terms were found. */ |
|
| 819 | + if (!empty($terms)) {
|
|
| 820 | + $out = array(); |
|
| 821 | + /* Loop through each term, linking to the 'edit posts' page for the specific term. */ |
|
| 822 | + foreach ($terms as $term) {
|
|
| 823 | + if (!strstr($term->taxonomy, 'tag')) {
|
|
| 824 | + $out[] = sprintf('<a href="%s">%s</a>',
|
|
| 825 | + esc_url(add_query_arg(array('post_type' => $post->post_type, $term->taxonomy => $term->slug), 'edit.php')),
|
|
| 826 | + esc_html(sanitize_term_field('name', $term->name, $term->term_id, $term->taxonomy, 'display'))
|
|
| 827 | + ); |
|
| 828 | + } |
|
| 829 | + } |
|
| 830 | + /* Join the terms, separating them with a comma. */ |
|
| 831 | + echo(join(', ', $out));
|
|
| 832 | + } /* If no terms were found, output a default message. */ |
|
| 833 | + else {
|
|
| 834 | + _e('No Categories', 'geodirectory');
|
|
| 835 | + } |
|
| 836 | + break; |
|
| 837 | + |
|
| 838 | + endswitch; |
|
| 839 | + } |
|
| 840 | 840 | } |
| 841 | 841 | |
| 842 | 842 | |
| 843 | 843 | if (!function_exists('geodir_post_sortable_columns')) {
|
| 844 | - /** |
|
| 845 | - * Makes admin post listing page columns sortable. |
|
| 846 | - * |
|
| 847 | - * @since 1.0.0 |
|
| 848 | - * @package GeoDirectory |
|
| 849 | - * @param array $columns The column array. |
|
| 850 | - * @return array Altered column array. |
|
| 851 | - */ |
|
| 852 | - function geodir_post_sortable_columns($columns) |
|
| 853 | - {
|
|
| 854 | - |
|
| 855 | - $columns['expire'] = 'expire'; |
|
| 856 | - |
|
| 857 | - return $columns; |
|
| 858 | - } |
|
| 844 | + /** |
|
| 845 | + * Makes admin post listing page columns sortable. |
|
| 846 | + * |
|
| 847 | + * @since 1.0.0 |
|
| 848 | + * @package GeoDirectory |
|
| 849 | + * @param array $columns The column array. |
|
| 850 | + * @return array Altered column array. |
|
| 851 | + */ |
|
| 852 | + function geodir_post_sortable_columns($columns) |
|
| 853 | + {
|
|
| 854 | + |
|
| 855 | + $columns['expire'] = 'expire'; |
|
| 856 | + |
|
| 857 | + return $columns; |
|
| 858 | + } |
|
| 859 | 859 | } |
| 860 | 860 | |
| 861 | 861 | /** |
@@ -869,32 +869,32 @@ discard block |
||
| 869 | 869 | * @param int $post_id The post ID. |
| 870 | 870 | */ |
| 871 | 871 | function geodir_post_information_save($post_id, $post) {
|
| 872 | - global $wpdb, $current_user; |
|
| 872 | + global $wpdb, $current_user; |
|
| 873 | 873 | |
| 874 | - if (isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')) {
|
|
| 875 | - return; |
|
| 876 | - } |
|
| 874 | + if (isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')) {
|
|
| 875 | + return; |
|
| 876 | + } |
|
| 877 | 877 | |
| 878 | - $geodir_posttypes = geodir_get_posttypes(); |
|
| 878 | + $geodir_posttypes = geodir_get_posttypes(); |
|
| 879 | 879 | |
| 880 | - if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
|
|
| 881 | - return; |
|
| 880 | + if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
|
|
| 881 | + return; |
|
| 882 | 882 | |
| 883 | - if (!wp_is_post_revision($post_id) && isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)) {
|
|
| 884 | - if (isset($_REQUEST['_status'])) |
|
| 885 | - geodir_change_post_status($post_id, $_REQUEST['_status']); |
|
| 883 | + if (!wp_is_post_revision($post_id) && isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)) {
|
|
| 884 | + if (isset($_REQUEST['_status'])) |
|
| 885 | + geodir_change_post_status($post_id, $_REQUEST['_status']); |
|
| 886 | 886 | |
| 887 | - if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'trash' || $_REQUEST['action'] == 'untrash')) |
|
| 888 | - return; |
|
| 887 | + if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'trash' || $_REQUEST['action'] == 'untrash')) |
|
| 888 | + return; |
|
| 889 | 889 | |
| 890 | - if (!isset($_POST['geodir_post_info_noncename']) || !wp_verify_nonce($_POST['geodir_post_info_noncename'], plugin_basename(__FILE__))) |
|
| 891 | - return; |
|
| 890 | + if (!isset($_POST['geodir_post_info_noncename']) || !wp_verify_nonce($_POST['geodir_post_info_noncename'], plugin_basename(__FILE__))) |
|
| 891 | + return; |
|
| 892 | 892 | |
| 893 | - if (!isset($_POST['geodir_post_attachments_noncename']) || !wp_verify_nonce($_POST['geodir_post_attachments_noncename'], plugin_basename(__FILE__))) |
|
| 894 | - return; |
|
| 893 | + if (!isset($_POST['geodir_post_attachments_noncename']) || !wp_verify_nonce($_POST['geodir_post_attachments_noncename'], plugin_basename(__FILE__))) |
|
| 894 | + return; |
|
| 895 | 895 | |
| 896 | - geodir_save_listing($_REQUEST); |
|
| 897 | - } |
|
| 896 | + geodir_save_listing($_REQUEST); |
|
| 897 | + } |
|
| 898 | 898 | } |
| 899 | 899 | |
| 900 | 900 | /** |
@@ -910,102 +910,102 @@ discard block |
||
| 910 | 910 | */ |
| 911 | 911 | function geodir_admin_fields($options) |
| 912 | 912 | {
|
| 913 | - global $geodirectory; |
|
| 914 | - |
|
| 915 | - $first_title = true; |
|
| 916 | - $tab_id = ''; |
|
| 917 | - $i = 0; |
|
| 918 | - foreach ($options as $value) : |
|
| 919 | - if (!isset($value['name'])) $value['name'] = ''; |
|
| 920 | - if (!isset($value['class'])) $value['class'] = ''; |
|
| 921 | - if (!isset($value['css'])) $value['css'] = ''; |
|
| 922 | - if (!isset($value['std'])) $value['std'] = ''; |
|
| 923 | - $desc = ''; |
|
| 924 | - switch ($value['type']) : |
|
| 925 | - case 'dummy_installer': |
|
| 926 | - $post_type = isset($value['post_type']) ? $value['post_type'] : 'gd_place'; |
|
| 927 | - geodir_autoinstall_admin_header($post_type); |
|
| 928 | - break; |
|
| 929 | - case 'title': |
|
| 930 | - |
|
| 931 | - if ($i == 0) {
|
|
| 932 | - echo '<dl id="geodir_oiption_tabs" class="gd-tab-head"></dl>'; |
|
| 933 | - echo '<div class="inner_content_tab_main">'; |
|
| 934 | - } |
|
| 913 | + global $geodirectory; |
|
| 914 | + |
|
| 915 | + $first_title = true; |
|
| 916 | + $tab_id = ''; |
|
| 917 | + $i = 0; |
|
| 918 | + foreach ($options as $value) : |
|
| 919 | + if (!isset($value['name'])) $value['name'] = ''; |
|
| 920 | + if (!isset($value['class'])) $value['class'] = ''; |
|
| 921 | + if (!isset($value['css'])) $value['css'] = ''; |
|
| 922 | + if (!isset($value['std'])) $value['std'] = ''; |
|
| 923 | + $desc = ''; |
|
| 924 | + switch ($value['type']) : |
|
| 925 | + case 'dummy_installer': |
|
| 926 | + $post_type = isset($value['post_type']) ? $value['post_type'] : 'gd_place'; |
|
| 927 | + geodir_autoinstall_admin_header($post_type); |
|
| 928 | + break; |
|
| 929 | + case 'title': |
|
| 930 | + |
|
| 931 | + if ($i == 0) {
|
|
| 932 | + echo '<dl id="geodir_oiption_tabs" class="gd-tab-head"></dl>'; |
|
| 933 | + echo '<div class="inner_content_tab_main">'; |
|
| 934 | + } |
|
| 935 | 935 | |
| 936 | - $i++; |
|
| 936 | + $i++; |
|
| 937 | 937 | |
| 938 | - if (isset($value['id']) && $value['id']) |
|
| 939 | - $tab_id = $value['id']; |
|
| 938 | + if (isset($value['id']) && $value['id']) |
|
| 939 | + $tab_id = $value['id']; |
|
| 940 | 940 | |
| 941 | - if (isset($value['desc']) && $value['desc']) |
|
| 942 | - $desc = '<span style=" text-transform:none;">:- ' . $value['desc'] . '</span>'; |
|
| 941 | + if (isset($value['desc']) && $value['desc']) |
|
| 942 | + $desc = '<span style=" text-transform:none;">:- ' . $value['desc'] . '</span>'; |
|
| 943 | 943 | |
| 944 | - if (isset($value['name']) && $value['name']) {
|
|
| 945 | - if ($first_title === true) {
|
|
| 946 | - $first_title = false; |
|
| 947 | - } else {
|
|
| 948 | - echo '</div>'; |
|
| 949 | - } |
|
| 950 | - echo '<dd id="' . trim($tab_id) . '" class="geodir_option_tabs" ><a href="javascript:void(0);">' . $value['name'] . '</a></dd>'; |
|
| 944 | + if (isset($value['name']) && $value['name']) {
|
|
| 945 | + if ($first_title === true) {
|
|
| 946 | + $first_title = false; |
|
| 947 | + } else {
|
|
| 948 | + echo '</div>'; |
|
| 949 | + } |
|
| 950 | + echo '<dd id="' . trim($tab_id) . '" class="geodir_option_tabs" ><a href="javascript:void(0);">' . $value['name'] . '</a></dd>'; |
|
| 951 | 951 | |
| 952 | - echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >'; |
|
| 953 | - } |
|
| 952 | + echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >'; |
|
| 953 | + } |
|
| 954 | 954 | |
| 955 | - /** |
|
| 956 | - * Called after a GeoDirectory settings title is output in the GD settings page. |
|
| 957 | - * |
|
| 958 | - * The action is called dynamically geodir_settings_$value['id']. |
|
| 959 | - * |
|
| 960 | - * @since 1.0.0 |
|
| 961 | - */ |
|
| 962 | - do_action('geodir_settings_' . sanitize_title($value['id']));
|
|
| 963 | - break; |
|
| 964 | - |
|
| 965 | - case 'no_tabs': |
|
| 966 | - |
|
| 967 | - echo '<div class="inner_content_tab_main">'; |
|
| 968 | - echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >'; |
|
| 969 | - |
|
| 970 | - break; |
|
| 971 | - |
|
| 972 | - case 'sectionstart': |
|
| 973 | - if (isset($value['desc']) && $value['desc']) |
|
| 974 | - $desc = '<span style=" text-transform:none;"> - ' . $value['desc'] . '</span>'; |
|
| 975 | - if (isset($value['name']) && $value['name']) |
|
| 976 | - echo '<h3>' . $value['name'] . $desc . '</h3>'; |
|
| 977 | - /** |
|
| 978 | - * Called after a GeoDirectory settings sectionstart is output in the GD settings page. |
|
| 979 | - * |
|
| 980 | - * The action is called dynamically geodir_settings_$value['id']_start. |
|
| 981 | - * |
|
| 982 | - * @since 1.0.0 |
|
| 983 | - */ |
|
| 984 | - if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_start');
|
|
| 985 | - echo '<table class="form-table">' . "\n\n"; |
|
| 986 | - |
|
| 987 | - break; |
|
| 988 | - case 'sectionend': |
|
| 989 | - /** |
|
| 990 | - * Called before a GeoDirectory settings sectionend is output in the GD settings page. |
|
| 991 | - * |
|
| 992 | - * The action is called dynamically geodir_settings_$value['id']_end. |
|
| 993 | - * |
|
| 994 | - * @since 1.0.0 |
|
| 995 | - */ |
|
| 996 | - if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_end');
|
|
| 997 | - echo '</table>'; |
|
| 998 | - /** |
|
| 999 | - * Called after a GeoDirectory settings sectionend is output in the GD settings page. |
|
| 1000 | - * |
|
| 1001 | - * The action is called dynamically geodir_settings_$value['id']_end. |
|
| 1002 | - * |
|
| 1003 | - * @since 1.0.0 |
|
| 1004 | - */ |
|
| 1005 | - if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_after');
|
|
| 1006 | - break; |
|
| 1007 | - case 'text': |
|
| 1008 | - ?> |
|
| 955 | + /** |
|
| 956 | + * Called after a GeoDirectory settings title is output in the GD settings page. |
|
| 957 | + * |
|
| 958 | + * The action is called dynamically geodir_settings_$value['id']. |
|
| 959 | + * |
|
| 960 | + * @since 1.0.0 |
|
| 961 | + */ |
|
| 962 | + do_action('geodir_settings_' . sanitize_title($value['id']));
|
|
| 963 | + break; |
|
| 964 | + |
|
| 965 | + case 'no_tabs': |
|
| 966 | + |
|
| 967 | + echo '<div class="inner_content_tab_main">'; |
|
| 968 | + echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >'; |
|
| 969 | + |
|
| 970 | + break; |
|
| 971 | + |
|
| 972 | + case 'sectionstart': |
|
| 973 | + if (isset($value['desc']) && $value['desc']) |
|
| 974 | + $desc = '<span style=" text-transform:none;"> - ' . $value['desc'] . '</span>'; |
|
| 975 | + if (isset($value['name']) && $value['name']) |
|
| 976 | + echo '<h3>' . $value['name'] . $desc . '</h3>'; |
|
| 977 | + /** |
|
| 978 | + * Called after a GeoDirectory settings sectionstart is output in the GD settings page. |
|
| 979 | + * |
|
| 980 | + * The action is called dynamically geodir_settings_$value['id']_start. |
|
| 981 | + * |
|
| 982 | + * @since 1.0.0 |
|
| 983 | + */ |
|
| 984 | + if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_start');
|
|
| 985 | + echo '<table class="form-table">' . "\n\n"; |
|
| 986 | + |
|
| 987 | + break; |
|
| 988 | + case 'sectionend': |
|
| 989 | + /** |
|
| 990 | + * Called before a GeoDirectory settings sectionend is output in the GD settings page. |
|
| 991 | + * |
|
| 992 | + * The action is called dynamically geodir_settings_$value['id']_end. |
|
| 993 | + * |
|
| 994 | + * @since 1.0.0 |
|
| 995 | + */ |
|
| 996 | + if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_end');
|
|
| 997 | + echo '</table>'; |
|
| 998 | + /** |
|
| 999 | + * Called after a GeoDirectory settings sectionend is output in the GD settings page. |
|
| 1000 | + * |
|
| 1001 | + * The action is called dynamically geodir_settings_$value['id']_end. |
|
| 1002 | + * |
|
| 1003 | + * @since 1.0.0 |
|
| 1004 | + */ |
|
| 1005 | + if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_after');
|
|
| 1006 | + break; |
|
| 1007 | + case 'text': |
|
| 1008 | + ?> |
|
| 1009 | 1009 | <tr valign="top"> |
| 1010 | 1010 | <th scope="row" class="titledesc"><?php echo $value['name']; ?></th> |
| 1011 | 1011 | <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>" |
@@ -1014,15 +1014,15 @@ discard block |
||
| 1014 | 1014 | <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
|
| 1015 | 1015 | style=" <?php echo esc_attr($value['css']); ?>" |
| 1016 | 1016 | value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
|
| 1017 | - echo esc_attr(stripslashes(get_option($value['id']))); |
|
| 1018 | - } else {
|
|
| 1019 | - echo esc_attr($value['std']); |
|
| 1020 | - } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td> |
|
| 1017 | + echo esc_attr(stripslashes(get_option($value['id']))); |
|
| 1018 | + } else {
|
|
| 1019 | + echo esc_attr($value['std']); |
|
| 1020 | + } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td> |
|
| 1021 | 1021 | </tr><?php |
| 1022 | - break; |
|
| 1022 | + break; |
|
| 1023 | 1023 | |
| 1024 | - case 'map-key': |
|
| 1025 | - ?> |
|
| 1024 | + case 'map-key': |
|
| 1025 | + ?> |
|
| 1026 | 1026 | <tr valign="top"> |
| 1027 | 1027 | <th scope="row" class="titledesc"><?php echo $value['name']; ?></th> |
| 1028 | 1028 | <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>" |
@@ -1031,18 +1031,18 @@ discard block |
||
| 1031 | 1031 | <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
|
| 1032 | 1032 | style=" <?php echo esc_attr($value['css']); ?>" |
| 1033 | 1033 | value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
|
| 1034 | - echo esc_attr(stripslashes(get_option($value['id']))); |
|
| 1035 | - } else {
|
|
| 1036 | - echo esc_attr($value['std']); |
|
| 1037 | - } ?>"/> |
|
| 1034 | + echo esc_attr(stripslashes(get_option($value['id']))); |
|
| 1035 | + } else {
|
|
| 1036 | + echo esc_attr($value['std']); |
|
| 1037 | + } ?>"/> |
|
| 1038 | 1038 | <?php $gm_api_url = 'https://console.developers.google.com/henhouse/?pb=["hh-1","maps_backend",null,[],"https://developers.google.com",null,["static_maps_backend","street_view_image_backend","maps_embed_backend","places_backend","geocoding_backend","directions_backend","distance_matrix_backend","geolocation","elevation_backend","timezone_backend","maps_backend"],null]';?> |
| 1039 | 1039 | <a id="gd-api-key" onclick='window.open("<?php echo wp_slash($gm_api_url);?>", "newwindow", "width=600, height=400"); return false;' href='<?php echo $gm_api_url;?>' class="button-primary" name="<?php _e('Generate API Key - ( MUST be logged in to your Google account )','geodirectory');?>" ><?php _e('Generate API Key','geodirectory');?></a>
|
| 1040 | 1040 | <span class="description"><?php echo $value['desc']; ?></span></td> |
| 1041 | 1041 | </tr><?php |
| 1042 | - break; |
|
| 1042 | + break; |
|
| 1043 | 1043 | |
| 1044 | - case 'password': |
|
| 1045 | - ?> |
|
| 1044 | + case 'password': |
|
| 1045 | + ?> |
|
| 1046 | 1046 | <tr valign="top"> |
| 1047 | 1047 | <th scope="row" class="titledesc"><?php echo $value['name']; ?></th> |
| 1048 | 1048 | <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>" |
@@ -1051,42 +1051,42 @@ discard block |
||
| 1051 | 1051 | <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
|
| 1052 | 1052 | style="<?php echo esc_attr($value['css']); ?>" |
| 1053 | 1053 | value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
|
| 1054 | - echo esc_attr(stripslashes(get_option($value['id']))); |
|
| 1055 | - } else {
|
|
| 1056 | - echo esc_attr($value['std']); |
|
| 1057 | - } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td> |
|
| 1054 | + echo esc_attr(stripslashes(get_option($value['id']))); |
|
| 1055 | + } else {
|
|
| 1056 | + echo esc_attr($value['std']); |
|
| 1057 | + } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td> |
|
| 1058 | 1058 | </tr><?php |
| 1059 | - break; |
|
| 1059 | + break; |
|
| 1060 | 1060 | |
| 1061 | - case 'html_content': |
|
| 1062 | - ?> |
|
| 1061 | + case 'html_content': |
|
| 1062 | + ?> |
|
| 1063 | 1063 | <tr valign="top"> |
| 1064 | 1064 | <th scope="row" class="titledesc"><?php echo $value['name']; ?></th> |
| 1065 | 1065 | <td class="forminp"><span class="description"><?php echo $value['desc']; ?></span></td> |
| 1066 | 1066 | </tr><?php |
| 1067 | - break; |
|
| 1067 | + break; |
|
| 1068 | 1068 | |
| 1069 | - case 'color' : |
|
| 1070 | - ?> |
|
| 1069 | + case 'color' : |
|
| 1070 | + ?> |
|
| 1071 | 1071 | <tr valign="top"> |
| 1072 | 1072 | <th scope="row" class="titledesc"><?php echo $value['name']; ?></th> |
| 1073 | 1073 | <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>" |
| 1074 | 1074 | id="<?php echo esc_attr($value['id']); ?>" type="text" |
| 1075 | 1075 | style="<?php echo esc_attr($value['css']); ?>" |
| 1076 | 1076 | value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
|
| 1077 | - echo esc_attr(stripslashes(get_option($value['id']))); |
|
| 1078 | - } else {
|
|
| 1079 | - echo esc_attr($value['std']); |
|
| 1080 | - } ?>" class="colorpick"/> <span |
|
| 1077 | + echo esc_attr(stripslashes(get_option($value['id']))); |
|
| 1078 | + } else {
|
|
| 1079 | + echo esc_attr($value['std']); |
|
| 1080 | + } ?>" class="colorpick"/> <span |
|
| 1081 | 1081 | class="description"><?php echo $value['desc']; ?></span> |
| 1082 | 1082 | |
| 1083 | 1083 | <div id="colorPickerDiv_<?php echo esc_attr($value['id']); ?>" class="colorpickdiv" |
| 1084 | 1084 | style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;display:none;"></div> |
| 1085 | 1085 | </td> |
| 1086 | 1086 | </tr><?php |
| 1087 | - break; |
|
| 1088 | - case 'image_width' : |
|
| 1089 | - ?> |
|
| 1087 | + break; |
|
| 1088 | + case 'image_width' : |
|
| 1089 | + ?> |
|
| 1090 | 1090 | <tr valign="top"> |
| 1091 | 1091 | <th scope="row" class="titledesc"><?php echo $value['name'] ?></th> |
| 1092 | 1092 | <td class="forminp"> |
@@ -1108,11 +1108,11 @@ discard block |
||
| 1108 | 1108 | |
| 1109 | 1109 | <span class="description"><?php echo $value['desc'] ?></span></td> |
| 1110 | 1110 | </tr><?php |
| 1111 | - break; |
|
| 1112 | - case 'select': |
|
| 1113 | - $option_value = get_option($value['id']); |
|
| 1114 | - $option_value = !empty($option_value) ? stripslashes_deep($option_value) : $option_value; |
|
| 1115 | - ?> |
|
| 1111 | + break; |
|
| 1112 | + case 'select': |
|
| 1113 | + $option_value = get_option($value['id']); |
|
| 1114 | + $option_value = !empty($option_value) ? stripslashes_deep($option_value) : $option_value; |
|
| 1115 | + ?> |
|
| 1116 | 1116 | <tr valign="top"> |
| 1117 | 1117 | <th scope="row" class="titledesc"><?php echo $value['name'] ?></th> |
| 1118 | 1118 | <td class="forminp"><select name="<?php echo esc_attr($value['id']); ?>" |
@@ -1121,33 +1121,33 @@ discard block |
||
| 1121 | 1121 | class="<?php if (isset($value['class'])) echo $value['class']; ?>" |
| 1122 | 1122 | option-ajaxchosen="false"> |
| 1123 | 1123 | <?php |
| 1124 | - foreach ($value['options'] as $key => $val) {
|
|
| 1125 | - $geodir_select_value = ''; |
|
| 1126 | - if ($option_value != '') {
|
|
| 1127 | - if ($option_value != '' && $option_value == $key) |
|
| 1128 | - $geodir_select_value = ' selected="selected" '; |
|
| 1129 | - } else {
|
|
| 1130 | - if ($value['std'] == $key) |
|
| 1131 | - $geodir_select_value = ' selected="selected" '; |
|
| 1132 | - } |
|
| 1133 | - ?> |
|
| 1124 | + foreach ($value['options'] as $key => $val) {
|
|
| 1125 | + $geodir_select_value = ''; |
|
| 1126 | + if ($option_value != '') {
|
|
| 1127 | + if ($option_value != '' && $option_value == $key) |
|
| 1128 | + $geodir_select_value = ' selected="selected" '; |
|
| 1129 | + } else {
|
|
| 1130 | + if ($value['std'] == $key) |
|
| 1131 | + $geodir_select_value = ' selected="selected" '; |
|
| 1132 | + } |
|
| 1133 | + ?> |
|
| 1134 | 1134 | <option |
| 1135 | 1135 | value="<?php echo esc_attr($key); ?>" <?php echo $geodir_select_value; ?> ><?php echo geodir_utf8_ucfirst($val) ?></option> |
| 1136 | 1136 | <?php |
| 1137 | - } |
|
| 1138 | - ?> |
|
| 1137 | + } |
|
| 1138 | + ?> |
|
| 1139 | 1139 | </select> <span class="description"><?php echo $value['desc'] ?></span> |
| 1140 | 1140 | </td> |
| 1141 | 1141 | </tr><?php |
| 1142 | - break; |
|
| 1142 | + break; |
|
| 1143 | 1143 | |
| 1144 | - case 'multiselect': |
|
| 1145 | - $option_values = get_option($value['id']); |
|
| 1146 | - if ($option_values === '' && !empty($value['std']) && is_array($value['std'])) {
|
|
| 1147 | - $option_values = $value['std']; |
|
| 1148 | - } |
|
| 1149 | - $option_values = !empty($option_values) ? stripslashes_deep($option_values) : $option_values; |
|
| 1150 | - ?> |
|
| 1144 | + case 'multiselect': |
|
| 1145 | + $option_values = get_option($value['id']); |
|
| 1146 | + if ($option_values === '' && !empty($value['std']) && is_array($value['std'])) {
|
|
| 1147 | + $option_values = $value['std']; |
|
| 1148 | + } |
|
| 1149 | + $option_values = !empty($option_values) ? stripslashes_deep($option_values) : $option_values; |
|
| 1150 | + ?> |
|
| 1151 | 1151 | <tr valign="top"> |
| 1152 | 1152 | <th scope="row" class="titledesc"><?php echo $value['name']; ?></th> |
| 1153 | 1153 | <td class="forminp"><select multiple="multiple" name="<?php echo esc_attr($value['id']); ?>[]" |
@@ -1157,26 +1157,26 @@ discard block |
||
| 1157 | 1157 | data-placeholder="<?php if (isset($value['placeholder_text'])) echo $value['placeholder_text'];?>" |
| 1158 | 1158 | option-ajaxchosen="false"> |
| 1159 | 1159 | <?php |
| 1160 | - foreach ($value['options'] as $key => $val) {
|
|
| 1161 | - if (strpos($key, 'optgroup_start-') === 0) {
|
|
| 1162 | - ?><optgroup label="<?php echo geodir_utf8_ucfirst($val); ?>"><?php |
|
| 1163 | - } else if (strpos($key, 'optgroup_end-') === 0) {
|
|
| 1164 | - ?></optgroup><?php |
|
| 1165 | - } else {
|
|
| 1166 | - ?> |
|
| 1160 | + foreach ($value['options'] as $key => $val) {
|
|
| 1161 | + if (strpos($key, 'optgroup_start-') === 0) {
|
|
| 1162 | + ?><optgroup label="<?php echo geodir_utf8_ucfirst($val); ?>"><?php |
|
| 1163 | + } else if (strpos($key, 'optgroup_end-') === 0) {
|
|
| 1164 | + ?></optgroup><?php |
|
| 1165 | + } else {
|
|
| 1166 | + ?> |
|
| 1167 | 1167 | <option value="<?php echo esc_attr($key); ?>" <?php selected(true, (is_array($option_values) && in_array($key, $option_values)));?>> |
| 1168 | 1168 | <?php echo geodir_utf8_ucfirst($val) ?> |
| 1169 | 1169 | </option> |
| 1170 | 1170 | <?php |
| 1171 | - } |
|
| 1172 | - } |
|
| 1173 | - ?> |
|
| 1171 | + } |
|
| 1172 | + } |
|
| 1173 | + ?> |
|
| 1174 | 1174 | </select> <span class="description"><?php echo $value['desc'] ?></span> |
| 1175 | 1175 | </td> |
| 1176 | 1176 | </tr><?php |
| 1177 | - break; |
|
| 1178 | - case 'file': |
|
| 1179 | - ?> |
|
| 1177 | + break; |
|
| 1178 | + case 'file': |
|
| 1179 | + ?> |
|
| 1180 | 1180 | <tr valign="top"> |
| 1181 | 1181 | <th scope="row" class="titledesc"><?php echo $value['name']; ?></th> |
| 1182 | 1182 | <td class="forminp"> |
@@ -1196,87 +1196,87 @@ discard block |
||
| 1196 | 1196 | <?php } ?> |
| 1197 | 1197 | </td> |
| 1198 | 1198 | </tr><?php |
| 1199 | - break; |
|
| 1200 | - case 'map_default_settings' : |
|
| 1201 | - ?> |
|
| 1199 | + break; |
|
| 1200 | + case 'map_default_settings' : |
|
| 1201 | + ?> |
|
| 1202 | 1202 | |
| 1203 | 1203 | <tr valign="top"> |
| 1204 | 1204 | <th class="titledesc" width="40%"><?php _e('Default map language', 'geodirectory');?></th>
|
| 1205 | 1205 | <td width="60%"> |
| 1206 | 1206 | <select name="geodir_default_map_language" style="width:60%"> |
| 1207 | 1207 | <?php |
| 1208 | - $arr_map_langages = array( |
|
| 1209 | - 'ar' => __('ARABIC', 'geodirectory'),
|
|
| 1210 | - 'eu' => __('BASQUE', 'geodirectory'),
|
|
| 1211 | - 'bg' => __('BULGARIAN', 'geodirectory'),
|
|
| 1212 | - 'bn' => __('BENGALI', 'geodirectory'),
|
|
| 1213 | - 'ca' => __('CATALAN', 'geodirectory'),
|
|
| 1214 | - 'cs' => __('CZECH', 'geodirectory'),
|
|
| 1215 | - 'da' => __('DANISH', 'geodirectory'),
|
|
| 1216 | - 'de' => __('GERMAN', 'geodirectory'),
|
|
| 1217 | - 'el' => __('GREEK', 'geodirectory'),
|
|
| 1218 | - 'en' => __('ENGLISH', 'geodirectory'),
|
|
| 1219 | - 'en-AU' => __('ENGLISH (AUSTRALIAN)', 'geodirectory'),
|
|
| 1220 | - 'en-GB' => __('ENGLISH (GREAT BRITAIN)', 'geodirectory'),
|
|
| 1221 | - 'es' => __('SPANISH', 'geodirectory'),
|
|
| 1222 | - 'eu' => __('BASQUE', 'geodirectory'),
|
|
| 1223 | - 'fa' => __('FARSI', 'geodirectory'),
|
|
| 1224 | - 'fi' => __('FINNISH', 'geodirectory'),
|
|
| 1225 | - 'fil' => __('FILIPINO', 'geodirectory'),
|
|
| 1226 | - 'fr' => __('FRENCH', 'geodirectory'),
|
|
| 1227 | - 'gl' => __('GALICIAN', 'geodirectory'),
|
|
| 1228 | - 'gu' => __('GUJARATI', 'geodirectory'),
|
|
| 1229 | - 'hi' => __('HINDI', 'geodirectory'),
|
|
| 1230 | - 'hr' => __('CROATIAN', 'geodirectory'),
|
|
| 1231 | - 'hu' => __('HUNGARIAN', 'geodirectory'),
|
|
| 1232 | - 'id' => __('INDONESIAN', 'geodirectory'),
|
|
| 1233 | - 'it' => __('ITALIAN', 'geodirectory'),
|
|
| 1234 | - 'iw' => __('HEBREW', 'geodirectory'),
|
|
| 1235 | - 'ja' => __('JAPANESE', 'geodirectory'),
|
|
| 1236 | - 'kn' => __('KANNADA', 'geodirectory'),
|
|
| 1237 | - 'ko' => __('KOREAN', 'geodirectory'),
|
|
| 1238 | - 'lt' => __('LITHUANIAN', 'geodirectory'),
|
|
| 1239 | - 'lv' => __('LATVIAN', 'geodirectory'),
|
|
| 1240 | - 'ml' => __('MALAYALAM', 'geodirectory'),
|
|
| 1241 | - 'mr' => __('MARATHI', 'geodirectory'),
|
|
| 1242 | - 'nl' => __('DUTCH', 'geodirectory'),
|
|
| 1243 | - 'no' => __('NORWEGIAN', 'geodirectory'),
|
|
| 1244 | - 'pl' => __('POLISH', 'geodirectory'),
|
|
| 1245 | - 'pt' => __('PORTUGUESE', 'geodirectory'),
|
|
| 1246 | - 'pt-BR' => __('PORTUGUESE (BRAZIL)', 'geodirectory'),
|
|
| 1247 | - 'pt-PT' => __('PORTUGUESE (PORTUGAL)', 'geodirectory'),
|
|
| 1248 | - 'ro' => __('ROMANIAN', 'geodirectory'),
|
|
| 1249 | - 'ru' => __('RUSSIAN', 'geodirectory'),
|
|
| 1250 | - 'ru' => __('RUSSIAN', 'geodirectory'),
|
|
| 1251 | - 'sk' => __('SLOVAK', 'geodirectory'),
|
|
| 1252 | - 'sl' => __('SLOVENIAN', 'geodirectory'),
|
|
| 1253 | - 'sr' => __('SERBIAN', 'geodirectory'),
|
|
| 1254 | - 'sv' => __(' SWEDISH', 'geodirectory'),
|
|
| 1255 | - 'tl' => __('TAGALOG', 'geodirectory'),
|
|
| 1256 | - 'ta' => __('TAMIL', 'geodirectory'),
|
|
| 1257 | - 'te' => __('TELUGU', 'geodirectory'),
|
|
| 1258 | - 'th' => __('THAI', 'geodirectory'),
|
|
| 1259 | - 'tr' => __('TURKISH', 'geodirectory'),
|
|
| 1260 | - 'uk' => __('UKRAINIAN', 'geodirectory'),
|
|
| 1261 | - 'vi' => __('VIETNAMESE', 'geodirectory'),
|
|
| 1262 | - 'zh-CN' => __('CHINESE (SIMPLIFIED)', 'geodirectory'),
|
|
| 1263 | - 'zh-TW' => __('CHINESE (TRADITIONAL)', 'geodirectory'),
|
|
| 1264 | - ); |
|
| 1265 | - $geodir_default_map_language = get_option('geodir_default_map_language');
|
|
| 1266 | - if (empty($geodir_default_map_language)) |
|
| 1267 | - $geodir_default_map_language = 'en'; |
|
| 1268 | - foreach ($arr_map_langages as $language_key => $language_txt) {
|
|
| 1269 | - if (!empty($geodir_default_map_language) && $language_key == $geodir_default_map_language) |
|
| 1270 | - $geodir_default_language_selected = "selected='selected'"; |
|
| 1271 | - else |
|
| 1272 | - $geodir_default_language_selected = ''; |
|
| 1273 | - |
|
| 1274 | - ?> |
|
| 1208 | + $arr_map_langages = array( |
|
| 1209 | + 'ar' => __('ARABIC', 'geodirectory'),
|
|
| 1210 | + 'eu' => __('BASQUE', 'geodirectory'),
|
|
| 1211 | + 'bg' => __('BULGARIAN', 'geodirectory'),
|
|
| 1212 | + 'bn' => __('BENGALI', 'geodirectory'),
|
|
| 1213 | + 'ca' => __('CATALAN', 'geodirectory'),
|
|
| 1214 | + 'cs' => __('CZECH', 'geodirectory'),
|
|
| 1215 | + 'da' => __('DANISH', 'geodirectory'),
|
|
| 1216 | + 'de' => __('GERMAN', 'geodirectory'),
|
|
| 1217 | + 'el' => __('GREEK', 'geodirectory'),
|
|
| 1218 | + 'en' => __('ENGLISH', 'geodirectory'),
|
|
| 1219 | + 'en-AU' => __('ENGLISH (AUSTRALIAN)', 'geodirectory'),
|
|
| 1220 | + 'en-GB' => __('ENGLISH (GREAT BRITAIN)', 'geodirectory'),
|
|
| 1221 | + 'es' => __('SPANISH', 'geodirectory'),
|
|
| 1222 | + 'eu' => __('BASQUE', 'geodirectory'),
|
|
| 1223 | + 'fa' => __('FARSI', 'geodirectory'),
|
|
| 1224 | + 'fi' => __('FINNISH', 'geodirectory'),
|
|
| 1225 | + 'fil' => __('FILIPINO', 'geodirectory'),
|
|
| 1226 | + 'fr' => __('FRENCH', 'geodirectory'),
|
|
| 1227 | + 'gl' => __('GALICIAN', 'geodirectory'),
|
|
| 1228 | + 'gu' => __('GUJARATI', 'geodirectory'),
|
|
| 1229 | + 'hi' => __('HINDI', 'geodirectory'),
|
|
| 1230 | + 'hr' => __('CROATIAN', 'geodirectory'),
|
|
| 1231 | + 'hu' => __('HUNGARIAN', 'geodirectory'),
|
|
| 1232 | + 'id' => __('INDONESIAN', 'geodirectory'),
|
|
| 1233 | + 'it' => __('ITALIAN', 'geodirectory'),
|
|
| 1234 | + 'iw' => __('HEBREW', 'geodirectory'),
|
|
| 1235 | + 'ja' => __('JAPANESE', 'geodirectory'),
|
|
| 1236 | + 'kn' => __('KANNADA', 'geodirectory'),
|
|
| 1237 | + 'ko' => __('KOREAN', 'geodirectory'),
|
|
| 1238 | + 'lt' => __('LITHUANIAN', 'geodirectory'),
|
|
| 1239 | + 'lv' => __('LATVIAN', 'geodirectory'),
|
|
| 1240 | + 'ml' => __('MALAYALAM', 'geodirectory'),
|
|
| 1241 | + 'mr' => __('MARATHI', 'geodirectory'),
|
|
| 1242 | + 'nl' => __('DUTCH', 'geodirectory'),
|
|
| 1243 | + 'no' => __('NORWEGIAN', 'geodirectory'),
|
|
| 1244 | + 'pl' => __('POLISH', 'geodirectory'),
|
|
| 1245 | + 'pt' => __('PORTUGUESE', 'geodirectory'),
|
|
| 1246 | + 'pt-BR' => __('PORTUGUESE (BRAZIL)', 'geodirectory'),
|
|
| 1247 | + 'pt-PT' => __('PORTUGUESE (PORTUGAL)', 'geodirectory'),
|
|
| 1248 | + 'ro' => __('ROMANIAN', 'geodirectory'),
|
|
| 1249 | + 'ru' => __('RUSSIAN', 'geodirectory'),
|
|
| 1250 | + 'ru' => __('RUSSIAN', 'geodirectory'),
|
|
| 1251 | + 'sk' => __('SLOVAK', 'geodirectory'),
|
|
| 1252 | + 'sl' => __('SLOVENIAN', 'geodirectory'),
|
|
| 1253 | + 'sr' => __('SERBIAN', 'geodirectory'),
|
|
| 1254 | + 'sv' => __(' SWEDISH', 'geodirectory'),
|
|
| 1255 | + 'tl' => __('TAGALOG', 'geodirectory'),
|
|
| 1256 | + 'ta' => __('TAMIL', 'geodirectory'),
|
|
| 1257 | + 'te' => __('TELUGU', 'geodirectory'),
|
|
| 1258 | + 'th' => __('THAI', 'geodirectory'),
|
|
| 1259 | + 'tr' => __('TURKISH', 'geodirectory'),
|
|
| 1260 | + 'uk' => __('UKRAINIAN', 'geodirectory'),
|
|
| 1261 | + 'vi' => __('VIETNAMESE', 'geodirectory'),
|
|
| 1262 | + 'zh-CN' => __('CHINESE (SIMPLIFIED)', 'geodirectory'),
|
|
| 1263 | + 'zh-TW' => __('CHINESE (TRADITIONAL)', 'geodirectory'),
|
|
| 1264 | + ); |
|
| 1265 | + $geodir_default_map_language = get_option('geodir_default_map_language');
|
|
| 1266 | + if (empty($geodir_default_map_language)) |
|
| 1267 | + $geodir_default_map_language = 'en'; |
|
| 1268 | + foreach ($arr_map_langages as $language_key => $language_txt) {
|
|
| 1269 | + if (!empty($geodir_default_map_language) && $language_key == $geodir_default_map_language) |
|
| 1270 | + $geodir_default_language_selected = "selected='selected'"; |
|
| 1271 | + else |
|
| 1272 | + $geodir_default_language_selected = ''; |
|
| 1273 | + |
|
| 1274 | + ?> |
|
| 1275 | 1275 | <option |
| 1276 | 1276 | value="<?php echo $language_key?>" <?php echo $geodir_default_language_selected; ?>><?php echo $language_txt; ?></option> |
| 1277 | 1277 | |
| 1278 | 1278 | <?php } |
| 1279 | - ?> |
|
| 1279 | + ?> |
|
| 1280 | 1280 | </select> |
| 1281 | 1281 | </td> |
| 1282 | 1282 | </tr> |
@@ -1287,46 +1287,46 @@ discard block |
||
| 1287 | 1287 | <td width="60%"> |
| 1288 | 1288 | <select name="geodir_default_map_search_pt" style="width:60%"> |
| 1289 | 1289 | <?php |
| 1290 | - $post_types = geodir_get_posttypes('array');
|
|
| 1291 | - $geodir_default_map_search_pt = get_option('geodir_default_map_search_pt');
|
|
| 1292 | - if (empty($geodir_default_map_search_pt)) |
|
| 1293 | - $geodir_default_map_search_pt = 'gd_place'; |
|
| 1294 | - if (is_array($post_types)) {
|
|
| 1295 | - foreach ($post_types as $key => $post_types_obj) {
|
|
| 1296 | - if (!empty($geodir_default_map_search_pt) && $key == $geodir_default_map_search_pt) |
|
| 1297 | - $geodir_search_pt_selected = "selected='selected'"; |
|
| 1298 | - else |
|
| 1299 | - $geodir_search_pt_selected = ''; |
|
| 1300 | - |
|
| 1301 | - ?> |
|
| 1290 | + $post_types = geodir_get_posttypes('array');
|
|
| 1291 | + $geodir_default_map_search_pt = get_option('geodir_default_map_search_pt');
|
|
| 1292 | + if (empty($geodir_default_map_search_pt)) |
|
| 1293 | + $geodir_default_map_search_pt = 'gd_place'; |
|
| 1294 | + if (is_array($post_types)) {
|
|
| 1295 | + foreach ($post_types as $key => $post_types_obj) {
|
|
| 1296 | + if (!empty($geodir_default_map_search_pt) && $key == $geodir_default_map_search_pt) |
|
| 1297 | + $geodir_search_pt_selected = "selected='selected'"; |
|
| 1298 | + else |
|
| 1299 | + $geodir_search_pt_selected = ''; |
|
| 1300 | + |
|
| 1301 | + ?> |
|
| 1302 | 1302 | <option |
| 1303 | 1303 | value="<?php echo $key?>" <?php echo $geodir_search_pt_selected; ?>><?php echo __($post_types_obj['labels']['singular_name'], 'geodirectory'); ?></option> |
| 1304 | 1304 | |
| 1305 | 1305 | <?php } |
| 1306 | 1306 | |
| 1307 | - } |
|
| 1307 | + } |
|
| 1308 | 1308 | |
| 1309 | - ?> |
|
| 1309 | + ?> |
|
| 1310 | 1310 | </select> |
| 1311 | 1311 | </td> |
| 1312 | 1312 | </tr> |
| 1313 | 1313 | |
| 1314 | 1314 | <?php |
| 1315 | - break; |
|
| 1315 | + break; |
|
| 1316 | 1316 | |
| 1317 | - case 'map': |
|
| 1318 | - ?> |
|
| 1317 | + case 'map': |
|
| 1318 | + ?> |
|
| 1319 | 1319 | <tr valign="top"> |
| 1320 | 1320 | <td class="forminp"> |
| 1321 | 1321 | <?php |
| 1322 | - global $post_cat, $cat_display; |
|
| 1323 | - $post_types = geodir_get_posttypes('object');
|
|
| 1324 | - $cat_display = 'checkbox'; |
|
| 1325 | - $gd_post_types = get_option('geodir_exclude_post_type_on_map');
|
|
| 1326 | - $gd_cats = get_option('geodir_exclude_cat_on_map');
|
|
| 1327 | - $gd_cats_upgrade = (int)get_option('geodir_exclude_cat_on_map_upgrade');
|
|
| 1328 | - $count = 1; |
|
| 1329 | - ?> |
|
| 1322 | + global $post_cat, $cat_display; |
|
| 1323 | + $post_types = geodir_get_posttypes('object');
|
|
| 1324 | + $cat_display = 'checkbox'; |
|
| 1325 | + $gd_post_types = get_option('geodir_exclude_post_type_on_map');
|
|
| 1326 | + $gd_cats = get_option('geodir_exclude_cat_on_map');
|
|
| 1327 | + $gd_cats_upgrade = (int)get_option('geodir_exclude_cat_on_map_upgrade');
|
|
| 1328 | + $count = 1; |
|
| 1329 | + ?> |
|
| 1330 | 1330 | <table width="70%" class="widefat"> |
| 1331 | 1331 | <thead> |
| 1332 | 1332 | <tr> |
@@ -1335,18 +1335,18 @@ discard block |
||
| 1335 | 1335 | <th><b><?php echo DESIGN_POST_TYPE_CAT; ?></b></th> |
| 1336 | 1336 | </tr> |
| 1337 | 1337 | <?php |
| 1338 | - $gd_categs = $gd_cats; |
|
| 1339 | - foreach ($post_types as $key => $post_types_obj) : |
|
| 1340 | - $checked = is_array($gd_post_types) && in_array($key, $gd_post_types) ? 'checked="checked"' : ''; |
|
| 1341 | - $gd_taxonomy = geodir_get_taxonomies($key); |
|
| 1342 | - if ($gd_cats_upgrade) {
|
|
| 1343 | - $gd_cat_taxonomy = isset($gd_taxonomy[0]) ? $gd_taxonomy[0] : ''; |
|
| 1344 | - $gd_cats = isset($gd_categs[$gd_cat_taxonomy]) ? $gd_categs[$gd_cat_taxonomy] : array(); |
|
| 1345 | - $gd_cats = !empty($gd_cats) && is_array($gd_cats) ? array_unique($gd_cats) : array(); |
|
| 1346 | - } |
|
| 1347 | - $post_cat = implode(',', $gd_cats);
|
|
| 1348 | - $gd_taxonomy_list = geodir_custom_taxonomy_walker($gd_taxonomy); |
|
| 1349 | - ?> |
|
| 1338 | + $gd_categs = $gd_cats; |
|
| 1339 | + foreach ($post_types as $key => $post_types_obj) : |
|
| 1340 | + $checked = is_array($gd_post_types) && in_array($key, $gd_post_types) ? 'checked="checked"' : ''; |
|
| 1341 | + $gd_taxonomy = geodir_get_taxonomies($key); |
|
| 1342 | + if ($gd_cats_upgrade) {
|
|
| 1343 | + $gd_cat_taxonomy = isset($gd_taxonomy[0]) ? $gd_taxonomy[0] : ''; |
|
| 1344 | + $gd_cats = isset($gd_categs[$gd_cat_taxonomy]) ? $gd_categs[$gd_cat_taxonomy] : array(); |
|
| 1345 | + $gd_cats = !empty($gd_cats) && is_array($gd_cats) ? array_unique($gd_cats) : array(); |
|
| 1346 | + } |
|
| 1347 | + $post_cat = implode(',', $gd_cats);
|
|
| 1348 | + $gd_taxonomy_list = geodir_custom_taxonomy_walker($gd_taxonomy); |
|
| 1349 | + ?> |
|
| 1350 | 1350 | <tr> |
| 1351 | 1351 | <td valign="top" width="5%"><?php echo $count; ?></td> |
| 1352 | 1352 | <td valign="top" width="25%" id="td_post_types"><input type="checkbox" |
@@ -1367,19 +1367,19 @@ discard block |
||
| 1367 | 1367 | </td> |
| 1368 | 1368 | </tr> |
| 1369 | 1369 | <?php |
| 1370 | - break; |
|
| 1370 | + break; |
|
| 1371 | 1371 | |
| 1372 | - case 'checkbox' : |
|
| 1372 | + case 'checkbox' : |
|
| 1373 | 1373 | |
| 1374 | - if (!isset($value['checkboxgroup']) || (isset($value['checkboxgroup']) && $value['checkboxgroup'] == 'start')) : |
|
| 1375 | - ?> |
|
| 1374 | + if (!isset($value['checkboxgroup']) || (isset($value['checkboxgroup']) && $value['checkboxgroup'] == 'start')) : |
|
| 1375 | + ?> |
|
| 1376 | 1376 | <tr valign="top"> |
| 1377 | 1377 | <th scope="row" class="titledesc"><?php echo $value['name'] ?></th> |
| 1378 | 1378 | <td class="forminp"> |
| 1379 | 1379 | <?php |
| 1380 | - endif; |
|
| 1380 | + endif; |
|
| 1381 | 1381 | |
| 1382 | - ?> |
|
| 1382 | + ?> |
|
| 1383 | 1383 | <fieldset> |
| 1384 | 1384 | <legend class="screen-reader-text"><span><?php echo $value['name'] ?></span></legend> |
| 1385 | 1385 | <label for="<?php echo $value['id'] ?>"> |
@@ -1389,49 +1389,49 @@ discard block |
||
| 1389 | 1389 | </fieldset> |
| 1390 | 1390 | <?php |
| 1391 | 1391 | |
| 1392 | - if (!isset($value['checkboxgroup']) || (isset($value['checkboxgroup']) && $value['checkboxgroup'] == 'end')) : |
|
| 1393 | - ?> |
|
| 1392 | + if (!isset($value['checkboxgroup']) || (isset($value['checkboxgroup']) && $value['checkboxgroup'] == 'end')) : |
|
| 1393 | + ?> |
|
| 1394 | 1394 | </td> |
| 1395 | 1395 | </tr> |
| 1396 | 1396 | <?php |
| 1397 | - endif; |
|
| 1397 | + endif; |
|
| 1398 | 1398 | |
| 1399 | - break; |
|
| 1399 | + break; |
|
| 1400 | 1400 | |
| 1401 | - case 'radio' : |
|
| 1401 | + case 'radio' : |
|
| 1402 | 1402 | |
| 1403 | - if (!isset($value['radiogroup']) || (isset($value['radiogroup']) && $value['radiogroup'] == 'start')) : |
|
| 1404 | - ?> |
|
| 1403 | + if (!isset($value['radiogroup']) || (isset($value['radiogroup']) && $value['radiogroup'] == 'start')) : |
|
| 1404 | + ?> |
|
| 1405 | 1405 | <tr valign="top"> |
| 1406 | 1406 | <th scope="row" class="titledesc"><?php echo $value['name'] ?></th> |
| 1407 | 1407 | <td class="forminp"> |
| 1408 | 1408 | <?php |
| 1409 | - endif; |
|
| 1409 | + endif; |
|
| 1410 | 1410 | |
| 1411 | - ?> |
|
| 1411 | + ?> |
|
| 1412 | 1412 | <fieldset> |
| 1413 | 1413 | <legend class="screen-reader-text"><span><?php echo $value['name'] ?></span></legend> |
| 1414 | 1414 | <label for="<?php echo $value['id'];?>"> |
| 1415 | 1415 | <input name="<?php echo esc_attr($value['id']); ?>" |
| 1416 | 1416 | id="<?php echo esc_attr($value['id'] . $value['value']); ?>" type="radio" |
| 1417 | 1417 | value="<?php echo $value['value'] ?>" <?php if (get_option($value['id']) == $value['value']) {
|
| 1418 | - echo 'checked="checked"'; |
|
| 1419 | - }elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
|
|
| 1418 | + echo 'checked="checked"'; |
|
| 1419 | + }elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
|
|
| 1420 | 1420 | <?php echo $value['desc']; ?></label><br> |
| 1421 | 1421 | </fieldset> |
| 1422 | 1422 | <?php |
| 1423 | 1423 | |
| 1424 | - if (!isset($value['radiogroup']) || (isset($value['radiogroup']) && $value['radiogroup'] == 'end')) : |
|
| 1425 | - ?> |
|
| 1424 | + if (!isset($value['radiogroup']) || (isset($value['radiogroup']) && $value['radiogroup'] == 'end')) : |
|
| 1425 | + ?> |
|
| 1426 | 1426 | </td> |
| 1427 | 1427 | </tr> |
| 1428 | 1428 | <?php |
| 1429 | - endif; |
|
| 1429 | + endif; |
|
| 1430 | 1430 | |
| 1431 | - break; |
|
| 1431 | + break; |
|
| 1432 | 1432 | |
| 1433 | - case 'textarea': |
|
| 1434 | - ?> |
|
| 1433 | + case 'textarea': |
|
| 1434 | + ?> |
|
| 1435 | 1435 | <tr valign="top"> |
| 1436 | 1436 | <th scope="row" class="titledesc"><?php echo $value['name'] ?></th> |
| 1437 | 1437 | <td class="forminp"> |
@@ -1444,30 +1444,30 @@ discard block |
||
| 1444 | 1444 | |
| 1445 | 1445 | </td> |
| 1446 | 1446 | </tr><?php |
| 1447 | - break; |
|
| 1447 | + break; |
|
| 1448 | 1448 | |
| 1449 | - case 'editor': |
|
| 1450 | - ?> |
|
| 1449 | + case 'editor': |
|
| 1450 | + ?> |
|
| 1451 | 1451 | <tr valign="top"> |
| 1452 | 1452 | <th scope="row" class="titledesc"><?php echo $value['name'] ?></th> |
| 1453 | 1453 | <td class="forminp"><?php |
| 1454 | - if (get_option($value['id'])) |
|
| 1455 | - $content = stripslashes(get_option($value['id'])); |
|
| 1456 | - else |
|
| 1457 | - $content = $value['std']; |
|
| 1454 | + if (get_option($value['id'])) |
|
| 1455 | + $content = stripslashes(get_option($value['id'])); |
|
| 1456 | + else |
|
| 1457 | + $content = $value['std']; |
|
| 1458 | 1458 | |
| 1459 | - $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
|
|
| 1459 | + $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
|
|
| 1460 | 1460 | |
| 1461 | - wp_editor($content, esc_attr($value['id']), $editor_settings); |
|
| 1461 | + wp_editor($content, esc_attr($value['id']), $editor_settings); |
|
| 1462 | 1462 | |
| 1463 | - ?> <span class="description"><?php echo $value['desc'] ?></span> |
|
| 1463 | + ?> <span class="description"><?php echo $value['desc'] ?></span> |
|
| 1464 | 1464 | |
| 1465 | 1465 | </td> |
| 1466 | 1466 | </tr><?php |
| 1467 | - break; |
|
| 1467 | + break; |
|
| 1468 | 1468 | |
| 1469 | - case 'single_select_page' : |
|
| 1470 | - // WPML |
|
| 1469 | + case 'single_select_page' : |
|
| 1470 | + // WPML |
|
| 1471 | 1471 | $switch_lang = false; |
| 1472 | 1472 | $disabled = ''; |
| 1473 | 1473 | if (geodir_is_wpml() && isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'permalink_settings') {
|
@@ -1485,18 +1485,18 @@ discard block |
||
| 1485 | 1485 | // |
| 1486 | 1486 | $page_setting = (int)get_option($value['id']); |
| 1487 | 1487 | |
| 1488 | - $args = array('name' => $value['id'],
|
|
| 1489 | - 'id' => $value['id'], |
|
| 1490 | - 'sort_column' => 'menu_order', |
|
| 1491 | - 'sort_order' => 'ASC', |
|
| 1492 | - 'show_option_none' => ' ', |
|
| 1493 | - 'class' => $value['class'], |
|
| 1494 | - 'echo' => false, |
|
| 1495 | - 'selected' => $page_setting); |
|
| 1488 | + $args = array('name' => $value['id'],
|
|
| 1489 | + 'id' => $value['id'], |
|
| 1490 | + 'sort_column' => 'menu_order', |
|
| 1491 | + 'sort_order' => 'ASC', |
|
| 1492 | + 'show_option_none' => ' ', |
|
| 1493 | + 'class' => $value['class'], |
|
| 1494 | + 'echo' => false, |
|
| 1495 | + 'selected' => $page_setting); |
|
| 1496 | 1496 | |
| 1497 | - if (isset($value['args'])) $args = wp_parse_args($value['args'], $args); |
|
| 1497 | + if (isset($value['args'])) $args = wp_parse_args($value['args'], $args); |
|
| 1498 | 1498 | |
| 1499 | - ?> |
|
| 1499 | + ?> |
|
| 1500 | 1500 | <tr valign="top" class="single_select_page"> |
| 1501 | 1501 | <th scope="row" class="titledesc"><?php echo $value['name'] ?></th> |
| 1502 | 1502 | <td class="forminp"> |
@@ -1507,17 +1507,17 @@ discard block |
||
| 1507 | 1507 | if ($switch_lang) {
|
| 1508 | 1508 | $sitepress->switch_lang($switch_lang, true); |
| 1509 | 1509 | } |
| 1510 | - break; |
|
| 1511 | - case 'single_select_country' : |
|
| 1512 | - $country_setting = (string)get_option($value['id']); |
|
| 1513 | - if (strstr($country_setting, ':')) : |
|
| 1514 | - $country = current(explode(':', $country_setting));
|
|
| 1515 | - $state = end(explode(':', $country_setting));
|
|
| 1516 | - else : |
|
| 1517 | - $country = $country_setting; |
|
| 1518 | - $state = '*'; |
|
| 1519 | - endif; |
|
| 1520 | - ?> |
|
| 1510 | + break; |
|
| 1511 | + case 'single_select_country' : |
|
| 1512 | + $country_setting = (string)get_option($value['id']); |
|
| 1513 | + if (strstr($country_setting, ':')) : |
|
| 1514 | + $country = current(explode(':', $country_setting));
|
|
| 1515 | + $state = end(explode(':', $country_setting));
|
|
| 1516 | + else : |
|
| 1517 | + $country = $country_setting; |
|
| 1518 | + $state = '*'; |
|
| 1519 | + endif; |
|
| 1520 | + ?> |
|
| 1521 | 1521 | <tr valign="top"> |
| 1522 | 1522 | <th scope="rpw" class="titledesc"><?php echo $value['name'] ?></th> |
| 1523 | 1523 | <td class="forminp"><select name="<?php echo esc_attr($value['id']); ?>" |
@@ -1528,12 +1528,12 @@ discard block |
||
| 1528 | 1528 | </select> <span class="description"><?php echo $value['desc'] ?></span> |
| 1529 | 1529 | </td> |
| 1530 | 1530 | </tr><?php |
| 1531 | - break; |
|
| 1532 | - case 'multi_select_countries' : |
|
| 1533 | - $countries = $geodirectory->countries->countries; |
|
| 1534 | - asort($countries); |
|
| 1535 | - $selections = (array)get_option($value['id']); |
|
| 1536 | - ?> |
|
| 1531 | + break; |
|
| 1532 | + case 'multi_select_countries' : |
|
| 1533 | + $countries = $geodirectory->countries->countries; |
|
| 1534 | + asort($countries); |
|
| 1535 | + $selections = (array)get_option($value['id']); |
|
| 1536 | + ?> |
|
| 1537 | 1537 | <tr valign="top"> |
| 1538 | 1538 | <th scope="row" class="titledesc"><?php echo $value['name'] ?></th> |
| 1539 | 1539 | <td class="forminp"> |
@@ -1541,21 +1541,21 @@ discard block |
||
| 1541 | 1541 | data-placeholder="<?php _e('Choose countries…', 'geodirectory'); ?>"
|
| 1542 | 1542 | title="Country" class="chosen_select"> |
| 1543 | 1543 | <?php |
| 1544 | - if ($countries) foreach ($countries as $key => $val) : |
|
| 1545 | - echo '<option value="' . $key . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>'; |
|
| 1546 | - endforeach; |
|
| 1547 | - ?> |
|
| 1544 | + if ($countries) foreach ($countries as $key => $val) : |
|
| 1545 | + echo '<option value="' . $key . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>'; |
|
| 1546 | + endforeach; |
|
| 1547 | + ?> |
|
| 1548 | 1548 | </select> |
| 1549 | 1549 | </td> |
| 1550 | 1550 | </tr> |
| 1551 | 1551 | |
| 1552 | 1552 | <?php |
| 1553 | 1553 | |
| 1554 | - break; |
|
| 1554 | + break; |
|
| 1555 | 1555 | |
| 1556 | - case 'google_analytics' : |
|
| 1557 | - $selections = (array)get_option($value['id']); |
|
| 1558 | - ?> |
|
| 1556 | + case 'google_analytics' : |
|
| 1557 | + $selections = (array)get_option($value['id']); |
|
| 1558 | + ?> |
|
| 1559 | 1559 | <tr valign="top"> |
| 1560 | 1560 | <th scope="row" class="titledesc"><?php echo $value['name'] ?></th> |
| 1561 | 1561 | <td class="forminp"> |
@@ -1563,62 +1563,62 @@ discard block |
||
| 1563 | 1563 | |
| 1564 | 1564 | <?php |
| 1565 | 1565 | |
| 1566 | - $oAuthURL = "https://accounts.google.com/o/oauth2/auth?"; |
|
| 1567 | - $scope = "scope=https://www.googleapis.com/auth/analytics.readonly"; |
|
| 1568 | - $state = "&state=123";//any string |
|
| 1569 | - $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
|
|
| 1570 | - $response_type = "&response_type=code"; |
|
| 1571 | - $client_id = "&client_id=".get_option('geodir_ga_client_id');
|
|
| 1572 | - $access_type = "&access_type=offline"; |
|
| 1573 | - $approval_prompt = "&approval_prompt=force"; |
|
| 1566 | + $oAuthURL = "https://accounts.google.com/o/oauth2/auth?"; |
|
| 1567 | + $scope = "scope=https://www.googleapis.com/auth/analytics.readonly"; |
|
| 1568 | + $state = "&state=123";//any string |
|
| 1569 | + $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
|
|
| 1570 | + $response_type = "&response_type=code"; |
|
| 1571 | + $client_id = "&client_id=".get_option('geodir_ga_client_id');
|
|
| 1572 | + $access_type = "&access_type=offline"; |
|
| 1573 | + $approval_prompt = "&approval_prompt=force"; |
|
| 1574 | 1574 | |
| 1575 | - $auth_url = $oAuthURL . $scope . $state . $redirect_uri . $response_type . $client_id . $access_type . $approval_prompt; |
|
| 1575 | + $auth_url = $oAuthURL . $scope . $state . $redirect_uri . $response_type . $client_id . $access_type . $approval_prompt; |
|
| 1576 | 1576 | |
| 1577 | 1577 | |
| 1578 | - if (get_option('geodir_ga_auth_token')) {
|
|
| 1579 | - ?> |
|
| 1578 | + if (get_option('geodir_ga_auth_token')) {
|
|
| 1579 | + ?> |
|
| 1580 | 1580 | <span class="button-primary" |
| 1581 | 1581 | onclick="gd_GA_Deauthorize('<?php echo wp_create_nonce('gd_ga_deauthorize');?>');"><?php _e('Deauthorize', 'geodirectory'); ?></span>
|
| 1582 | 1582 | <span style="color: green; font-weight: bold;"><?php _e('Authorized', 'geodirectory'); ?></span>
|
| 1583 | 1583 | <?php |
| 1584 | - global $gd_ga_errors; |
|
| 1585 | - if(!empty($gd_ga_errors)){
|
|
| 1586 | - print_r($gd_ga_errors); |
|
| 1587 | - } |
|
| 1588 | - } else {
|
|
| 1589 | - ?> |
|
| 1584 | + global $gd_ga_errors; |
|
| 1585 | + if(!empty($gd_ga_errors)){
|
|
| 1586 | + print_r($gd_ga_errors); |
|
| 1587 | + } |
|
| 1588 | + } else {
|
|
| 1589 | + ?> |
|
| 1590 | 1590 | <span class="button-primary" |
| 1591 | 1591 | onclick="window.open('<?php echo geodir_ga_activation_url();?>', 'activate','width=700, height=600, menubar=0, status=0, location=0, toolbar=0')"><?php _e('Authorize', 'geodirectory');?></span>
|
| 1592 | 1592 | <?php |
| 1593 | - } |
|
| 1594 | - ?> |
|
| 1593 | + } |
|
| 1594 | + ?> |
|
| 1595 | 1595 | </td> |
| 1596 | 1596 | </tr> |
| 1597 | 1597 | |
| 1598 | 1598 | <?php |
| 1599 | 1599 | |
| 1600 | 1600 | |
| 1601 | - break; |
|
| 1601 | + break; |
|
| 1602 | 1602 | |
| 1603 | - case 'field_seperator' : |
|
| 1603 | + case 'field_seperator' : |
|
| 1604 | 1604 | |
| 1605 | - ?> |
|
| 1605 | + ?> |
|
| 1606 | 1606 | <tr valign="top"> |
| 1607 | 1607 | <td colspan="2" class="forminp geodir_line_seperator"></td> |
| 1608 | 1608 | </tr> |
| 1609 | 1609 | <?php |
| 1610 | 1610 | |
| 1611 | - break; |
|
| 1611 | + break; |
|
| 1612 | 1612 | |
| 1613 | - endswitch; |
|
| 1613 | + endswitch; |
|
| 1614 | 1614 | |
| 1615 | - endforeach; |
|
| 1615 | + endforeach; |
|
| 1616 | 1616 | |
| 1617 | - if ($first_title === false) {
|
|
| 1618 | - echo "</div>"; |
|
| 1619 | - } |
|
| 1617 | + if ($first_title === false) {
|
|
| 1618 | + echo "</div>"; |
|
| 1619 | + } |
|
| 1620 | 1620 | |
| 1621 | - ?> |
|
| 1621 | + ?> |
|
| 1622 | 1622 | |
| 1623 | 1623 | <script type="text/javascript"> |
| 1624 | 1624 | |
@@ -1678,33 +1678,33 @@ discard block |
||
| 1678 | 1678 | */ |
| 1679 | 1679 | function geodir_post_info_setting() |
| 1680 | 1680 | {
|
| 1681 | - global $post, $post_id; |
|
| 1682 | - |
|
| 1683 | - $post_type = get_post_type(); |
|
| 1684 | - |
|
| 1685 | - $package_info = array(); |
|
| 1686 | - |
|
| 1687 | - $package_info = geodir_post_package_info($package_info, $post, $post_type); |
|
| 1688 | - wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_info_noncename'); |
|
| 1689 | - echo '<div id="geodir_wrapper">'; |
|
| 1690 | - /** |
|
| 1691 | - * Called before the GD custom fields are output in the wp-admin area. |
|
| 1692 | - * |
|
| 1693 | - * @since 1.0.0 |
|
| 1694 | - * @see 'geodir_after_default_field_in_meta_box' |
|
| 1695 | - */ |
|
| 1696 | - do_action('geodir_before_default_field_in_meta_box');
|
|
| 1697 | - //geodir_get_custom_fields_html($package_info->pid,'default',$post_type); |
|
| 1698 | - // to display all fields in one information box |
|
| 1699 | - geodir_get_custom_fields_html($package_info->pid, 'all', $post_type); |
|
| 1700 | - /** |
|
| 1701 | - * Called after the GD custom fields are output in the wp-admin area. |
|
| 1702 | - * |
|
| 1703 | - * @since 1.0.0 |
|
| 1704 | - * @see 'geodir_before_default_field_in_meta_box' |
|
| 1705 | - */ |
|
| 1706 | - do_action('geodir_after_default_field_in_meta_box');
|
|
| 1707 | - echo '</div>'; |
|
| 1681 | + global $post, $post_id; |
|
| 1682 | + |
|
| 1683 | + $post_type = get_post_type(); |
|
| 1684 | + |
|
| 1685 | + $package_info = array(); |
|
| 1686 | + |
|
| 1687 | + $package_info = geodir_post_package_info($package_info, $post, $post_type); |
|
| 1688 | + wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_info_noncename'); |
|
| 1689 | + echo '<div id="geodir_wrapper">'; |
|
| 1690 | + /** |
|
| 1691 | + * Called before the GD custom fields are output in the wp-admin area. |
|
| 1692 | + * |
|
| 1693 | + * @since 1.0.0 |
|
| 1694 | + * @see 'geodir_after_default_field_in_meta_box' |
|
| 1695 | + */ |
|
| 1696 | + do_action('geodir_before_default_field_in_meta_box');
|
|
| 1697 | + //geodir_get_custom_fields_html($package_info->pid,'default',$post_type); |
|
| 1698 | + // to display all fields in one information box |
|
| 1699 | + geodir_get_custom_fields_html($package_info->pid, 'all', $post_type); |
|
| 1700 | + /** |
|
| 1701 | + * Called after the GD custom fields are output in the wp-admin area. |
|
| 1702 | + * |
|
| 1703 | + * @since 1.0.0 |
|
| 1704 | + * @see 'geodir_before_default_field_in_meta_box' |
|
| 1705 | + */ |
|
| 1706 | + do_action('geodir_after_default_field_in_meta_box');
|
|
| 1707 | + echo '</div>'; |
|
| 1708 | 1708 | } |
| 1709 | 1709 | |
| 1710 | 1710 | /** |
@@ -1717,18 +1717,18 @@ discard block |
||
| 1717 | 1717 | */ |
| 1718 | 1718 | function geodir_post_addinfo_setting() |
| 1719 | 1719 | {
|
| 1720 | - global $post, $post_id; |
|
| 1720 | + global $post, $post_id; |
|
| 1721 | 1721 | |
| 1722 | - $post_type = get_post_type(); |
|
| 1722 | + $post_type = get_post_type(); |
|
| 1723 | 1723 | |
| 1724 | - $package_info = array(); |
|
| 1724 | + $package_info = array(); |
|
| 1725 | 1725 | |
| 1726 | - $package_info = geodir_post_package_info($package_info, $post, $post_type); |
|
| 1726 | + $package_info = geodir_post_package_info($package_info, $post, $post_type); |
|
| 1727 | 1727 | |
| 1728 | - wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_addinfo_noncename'); |
|
| 1729 | - echo '<div id="geodir_wrapper">'; |
|
| 1730 | - geodir_get_custom_fields_html($package_info->pid, 'custom', $post_type); |
|
| 1731 | - echo '</div>'; |
|
| 1728 | + wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_addinfo_noncename'); |
|
| 1729 | + echo '<div id="geodir_wrapper">'; |
|
| 1730 | + geodir_get_custom_fields_html($package_info->pid, 'custom', $post_type); |
|
| 1731 | + echo '</div>'; |
|
| 1732 | 1732 | |
| 1733 | 1733 | } |
| 1734 | 1734 | |
@@ -1742,60 +1742,60 @@ discard block |
||
| 1742 | 1742 | */ |
| 1743 | 1743 | function geodir_post_attachments() |
| 1744 | 1744 | {
|
| 1745 | - global $post, $post_id; |
|
| 1745 | + global $post, $post_id; |
|
| 1746 | 1746 | |
| 1747 | - wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_attachments_noncename'); |
|
| 1747 | + wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_attachments_noncename'); |
|
| 1748 | 1748 | |
| 1749 | - if (geodir_get_featured_image($post_id, 'thumbnail')) {
|
|
| 1750 | - echo '<h4>' . __('Featured Image', 'geodirectory') . '</h4>';
|
|
| 1751 | - geodir_show_featured_image($post_id, 'thumbnail'); |
|
| 1752 | - } |
|
| 1749 | + if (geodir_get_featured_image($post_id, 'thumbnail')) {
|
|
| 1750 | + echo '<h4>' . __('Featured Image', 'geodirectory') . '</h4>';
|
|
| 1751 | + geodir_show_featured_image($post_id, 'thumbnail'); |
|
| 1752 | + } |
|
| 1753 | 1753 | |
| 1754 | - $image_limit = 0; |
|
| 1754 | + $image_limit = 0; |
|
| 1755 | 1755 | |
| 1756 | - ?> |
|
| 1756 | + ?> |
|
| 1757 | 1757 | |
| 1758 | 1758 | |
| 1759 | 1759 | <h5 class="form_title"> |
| 1760 | 1760 | <?php if ($image_limit != 0 && $image_limit == 1) {
|
| 1761 | - echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
|
|
| 1762 | - } ?> |
|
| 1761 | + echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
|
|
| 1762 | + } ?> |
|
| 1763 | 1763 | <?php if ($image_limit != 0 && $image_limit > 1) {
|
| 1764 | - echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
|
|
| 1765 | - } ?> |
|
| 1764 | + echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
|
|
| 1765 | + } ?> |
|
| 1766 | 1766 | <?php if ($image_limit == 0) {
|
| 1767 | - echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
|
|
| 1768 | - } ?> |
|
| 1767 | + echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
|
|
| 1768 | + } ?> |
|
| 1769 | 1769 | </h5> |
| 1770 | 1770 | |
| 1771 | 1771 | |
| 1772 | 1772 | <?php |
| 1773 | 1773 | |
| 1774 | - $curImages = geodir_get_images($post_id); |
|
| 1775 | - $place_img_array = array(); |
|
| 1774 | + $curImages = geodir_get_images($post_id); |
|
| 1775 | + $place_img_array = array(); |
|
| 1776 | 1776 | |
| 1777 | - if (!empty($curImages)): |
|
| 1778 | - foreach ($curImages as $p_img): |
|
| 1779 | - $place_img_array[] = $p_img->src; |
|
| 1780 | - endforeach; |
|
| 1781 | - endif; |
|
| 1777 | + if (!empty($curImages)): |
|
| 1778 | + foreach ($curImages as $p_img): |
|
| 1779 | + $place_img_array[] = $p_img->src; |
|
| 1780 | + endforeach; |
|
| 1781 | + endif; |
|
| 1782 | 1782 | |
| 1783 | - if (!empty($place_img_array)) |
|
| 1784 | - $curImages = implode(',', $place_img_array);
|
|
| 1783 | + if (!empty($place_img_array)) |
|
| 1784 | + $curImages = implode(',', $place_img_array);
|
|
| 1785 | 1785 | |
| 1786 | 1786 | |
| 1787 | - // adjust values here |
|
| 1788 | - $id = "post_images"; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls |
|
| 1787 | + // adjust values here |
|
| 1788 | + $id = "post_images"; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls |
|
| 1789 | 1789 | |
| 1790 | - $svalue = $curImages; // this will be initial value of the above form field. Image urls. |
|
| 1790 | + $svalue = $curImages; // this will be initial value of the above form field. Image urls. |
|
| 1791 | 1791 | |
| 1792 | - $multiple = true; // allow multiple files upload |
|
| 1792 | + $multiple = true; // allow multiple files upload |
|
| 1793 | 1793 | |
| 1794 | - $width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels) |
|
| 1794 | + $width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels) |
|
| 1795 | 1795 | |
| 1796 | - $height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels) |
|
| 1796 | + $height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels) |
|
| 1797 | 1797 | |
| 1798 | - ?> |
|
| 1798 | + ?> |
|
| 1799 | 1799 | |
| 1800 | 1800 | <div class="gtd-form_row clearfix" id="<?php echo $id; ?>dropbox" style="border:1px solid #999999;padding:5px;text-align:center;"> |
| 1801 | 1801 | <input type="hidden" name="<?php echo $id; ?>" id="<?php echo $id; ?>" value="<?php echo $svalue; ?>"/> |
@@ -1837,13 +1837,13 @@ discard block |
||
| 1837 | 1837 | */ |
| 1838 | 1838 | function geodir_action_post_updated($post_ID, $post_after, $post_before) |
| 1839 | 1839 | {
|
| 1840 | - $post_type = get_post_type($post_ID); |
|
| 1840 | + $post_type = get_post_type($post_ID); |
|
| 1841 | 1841 | |
| 1842 | - if (isset($_POST['action']) && $_POST['action'] == 'inline-save') {
|
|
| 1843 | - if ($post_type != '' && in_array($post_type, geodir_get_posttypes()) && !wp_is_post_revision($post_ID) && !empty($post_after->post_title) && $post_after->post_title != $post_before->post_title) {
|
|
| 1844 | - geodir_save_post_meta($post_ID, 'post_title', $post_after->post_title); |
|
| 1845 | - } |
|
| 1846 | - } |
|
| 1842 | + if (isset($_POST['action']) && $_POST['action'] == 'inline-save') {
|
|
| 1843 | + if ($post_type != '' && in_array($post_type, geodir_get_posttypes()) && !wp_is_post_revision($post_ID) && !empty($post_after->post_title) && $post_after->post_title != $post_before->post_title) {
|
|
| 1844 | + geodir_save_post_meta($post_ID, 'post_title', $post_after->post_title); |
|
| 1845 | + } |
|
| 1846 | + } |
|
| 1847 | 1847 | } |
| 1848 | 1848 | |
| 1849 | 1849 | /** |
@@ -1858,39 +1858,39 @@ discard block |
||
| 1858 | 1858 | */ |
| 1859 | 1859 | function geodir_notification_add_bcc_option($settings) |
| 1860 | 1860 | {
|
| 1861 | - if (!empty($settings)) {
|
|
| 1862 | - $new_settings = array(); |
|
| 1863 | - foreach ($settings as $setting) {
|
|
| 1864 | - if (isset($setting['id']) && $setting['id'] == 'site_bcc_options' && isset($setting['type']) && $setting['type'] == 'sectionend') {
|
|
| 1865 | - $geodir_bcc_listing_published_yes = array( |
|
| 1866 | - 'name' => __('Listing published', 'geodirectory'),
|
|
| 1867 | - 'desc' => __('Yes', 'geodirectory'),
|
|
| 1868 | - 'id' => 'geodir_bcc_listing_published', |
|
| 1869 | - 'std' => 'yes', |
|
| 1870 | - 'type' => 'radio', |
|
| 1871 | - 'value' => '1', |
|
| 1872 | - 'radiogroup' => 'start' |
|
| 1873 | - ); |
|
| 1874 | - |
|
| 1875 | - $geodir_bcc_listing_published_no = array( |
|
| 1876 | - 'name' => __('Listing published', 'geodirectory'),
|
|
| 1877 | - 'desc' => __('No', 'geodirectory'),
|
|
| 1878 | - 'id' => 'geodir_bcc_listing_published', |
|
| 1879 | - 'std' => 'yes', |
|
| 1880 | - 'type' => 'radio', |
|
| 1881 | - 'value' => '0', |
|
| 1882 | - 'radiogroup' => 'end' |
|
| 1883 | - ); |
|
| 1884 | - |
|
| 1885 | - $new_settings[] = $geodir_bcc_listing_published_yes; |
|
| 1886 | - $new_settings[] = $geodir_bcc_listing_published_no; |
|
| 1887 | - } |
|
| 1888 | - $new_settings[] = $setting; |
|
| 1889 | - } |
|
| 1890 | - $settings = $new_settings; |
|
| 1891 | - } |
|
| 1861 | + if (!empty($settings)) {
|
|
| 1862 | + $new_settings = array(); |
|
| 1863 | + foreach ($settings as $setting) {
|
|
| 1864 | + if (isset($setting['id']) && $setting['id'] == 'site_bcc_options' && isset($setting['type']) && $setting['type'] == 'sectionend') {
|
|
| 1865 | + $geodir_bcc_listing_published_yes = array( |
|
| 1866 | + 'name' => __('Listing published', 'geodirectory'),
|
|
| 1867 | + 'desc' => __('Yes', 'geodirectory'),
|
|
| 1868 | + 'id' => 'geodir_bcc_listing_published', |
|
| 1869 | + 'std' => 'yes', |
|
| 1870 | + 'type' => 'radio', |
|
| 1871 | + 'value' => '1', |
|
| 1872 | + 'radiogroup' => 'start' |
|
| 1873 | + ); |
|
| 1874 | + |
|
| 1875 | + $geodir_bcc_listing_published_no = array( |
|
| 1876 | + 'name' => __('Listing published', 'geodirectory'),
|
|
| 1877 | + 'desc' => __('No', 'geodirectory'),
|
|
| 1878 | + 'id' => 'geodir_bcc_listing_published', |
|
| 1879 | + 'std' => 'yes', |
|
| 1880 | + 'type' => 'radio', |
|
| 1881 | + 'value' => '0', |
|
| 1882 | + 'radiogroup' => 'end' |
|
| 1883 | + ); |
|
| 1884 | + |
|
| 1885 | + $new_settings[] = $geodir_bcc_listing_published_yes; |
|
| 1886 | + $new_settings[] = $geodir_bcc_listing_published_no; |
|
| 1887 | + } |
|
| 1888 | + $new_settings[] = $setting; |
|
| 1889 | + } |
|
| 1890 | + $settings = $new_settings; |
|
| 1891 | + } |
|
| 1892 | 1892 | |
| 1893 | - return $settings; |
|
| 1893 | + return $settings; |
|
| 1894 | 1894 | } |
| 1895 | 1895 | |
| 1896 | 1896 | |
@@ -1905,19 +1905,19 @@ discard block |
||
| 1905 | 1905 | */ |
| 1906 | 1906 | function get_gd_theme_compat_callback() |
| 1907 | 1907 | {
|
| 1908 | - global $wpdb; |
|
| 1909 | - $themes = get_option('gd_theme_compats');
|
|
| 1910 | - |
|
| 1911 | - if (isset($_POST['theme']) && isset($themes[$_POST['theme']]) && !empty($themes[$_POST['theme']])) {
|
|
| 1912 | - if (isset($_POST['export'])) {
|
|
| 1913 | - echo json_encode(array($_POST['theme'] => $themes[$_POST['theme']])); |
|
| 1914 | - } else {
|
|
| 1915 | - echo json_encode($themes[$_POST['theme']]); |
|
| 1916 | - } |
|
| 1908 | + global $wpdb; |
|
| 1909 | + $themes = get_option('gd_theme_compats');
|
|
| 1917 | 1910 | |
| 1918 | - } |
|
| 1911 | + if (isset($_POST['theme']) && isset($themes[$_POST['theme']]) && !empty($themes[$_POST['theme']])) {
|
|
| 1912 | + if (isset($_POST['export'])) {
|
|
| 1913 | + echo json_encode(array($_POST['theme'] => $themes[$_POST['theme']])); |
|
| 1914 | + } else {
|
|
| 1915 | + echo json_encode($themes[$_POST['theme']]); |
|
| 1916 | + } |
|
| 1917 | + |
|
| 1918 | + } |
|
| 1919 | 1919 | |
| 1920 | - die(); |
|
| 1920 | + die(); |
|
| 1921 | 1921 | } |
| 1922 | 1922 | |
| 1923 | 1923 | add_action('wp_ajax_get_gd_theme_compat_import_callback', 'get_gd_theme_compat_import_callback');
|
@@ -1931,20 +1931,20 @@ discard block |
||
| 1931 | 1931 | */ |
| 1932 | 1932 | function get_gd_theme_compat_import_callback() |
| 1933 | 1933 | {
|
| 1934 | - global $wpdb; |
|
| 1935 | - $themes = get_option('gd_theme_compats');
|
|
| 1936 | - if (isset($_POST['theme']) && !empty($_POST['theme'])) {
|
|
| 1937 | - $json = json_decode(stripslashes($_POST['theme']), true); |
|
| 1938 | - if (!empty($json) && is_array($json)) {
|
|
| 1939 | - $key = sanitize_text_field(key($json)); |
|
| 1940 | - $themes[$key] = $json[$key]; |
|
| 1941 | - update_option('gd_theme_compats', $themes);
|
|
| 1942 | - echo $key; |
|
| 1943 | - die(); |
|
| 1944 | - } |
|
| 1945 | - } |
|
| 1946 | - echo '0'; |
|
| 1947 | - die(); |
|
| 1934 | + global $wpdb; |
|
| 1935 | + $themes = get_option('gd_theme_compats');
|
|
| 1936 | + if (isset($_POST['theme']) && !empty($_POST['theme'])) {
|
|
| 1937 | + $json = json_decode(stripslashes($_POST['theme']), true); |
|
| 1938 | + if (!empty($json) && is_array($json)) {
|
|
| 1939 | + $key = sanitize_text_field(key($json)); |
|
| 1940 | + $themes[$key] = $json[$key]; |
|
| 1941 | + update_option('gd_theme_compats', $themes);
|
|
| 1942 | + echo $key; |
|
| 1943 | + die(); |
|
| 1944 | + } |
|
| 1945 | + } |
|
| 1946 | + echo '0'; |
|
| 1947 | + die(); |
|
| 1948 | 1948 | } |
| 1949 | 1949 | |
| 1950 | 1950 | |
@@ -1957,39 +1957,39 @@ discard block |
||
| 1957 | 1957 | */ |
| 1958 | 1958 | function gd_set_theme_compat() |
| 1959 | 1959 | {
|
| 1960 | - global $wpdb; |
|
| 1961 | - $theme = wp_get_theme(); |
|
| 1960 | + global $wpdb; |
|
| 1961 | + $theme = wp_get_theme(); |
|
| 1962 | 1962 | |
| 1963 | - if ($theme->parent()) {
|
|
| 1964 | - $theme_name = str_replace(" ", "_", $theme->parent()->get('Name'));
|
|
| 1965 | - } else {
|
|
| 1966 | - $theme_name = str_replace(" ", "_", $theme->get('Name'));
|
|
| 1967 | - } |
|
| 1963 | + if ($theme->parent()) {
|
|
| 1964 | + $theme_name = str_replace(" ", "_", $theme->parent()->get('Name'));
|
|
| 1965 | + } else {
|
|
| 1966 | + $theme_name = str_replace(" ", "_", $theme->get('Name'));
|
|
| 1967 | + } |
|
| 1968 | 1968 | |
| 1969 | - $theme_compats = get_option('gd_theme_compats');
|
|
| 1970 | - $current_compat = get_option('gd_theme_compat');
|
|
| 1971 | - $current_compat = str_replace("_custom", "", $current_compat);
|
|
| 1969 | + $theme_compats = get_option('gd_theme_compats');
|
|
| 1970 | + $current_compat = get_option('gd_theme_compat');
|
|
| 1971 | + $current_compat = str_replace("_custom", "", $current_compat);
|
|
| 1972 | 1972 | |
| 1973 | - if ($current_compat == $theme_name && strpos(get_option('gd_theme_compat'), "_custom") !== false) {
|
|
| 1974 | - return; |
|
| 1975 | - }// if already running correct compat then bail |
|
| 1973 | + if ($current_compat == $theme_name && strpos(get_option('gd_theme_compat'), "_custom") !== false) {
|
|
| 1974 | + return; |
|
| 1975 | + }// if already running correct compat then bail |
|
| 1976 | 1976 | |
| 1977 | - if (isset($theme_compats[$theme_name])) {// if there is a compat avail then set it
|
|
| 1978 | - update_option('gd_theme_compat', $theme_name);
|
|
| 1979 | - update_option('theme_compatibility_setting', $theme_compats[$theme_name]);
|
|
| 1977 | + if (isset($theme_compats[$theme_name])) {// if there is a compat avail then set it
|
|
| 1978 | + update_option('gd_theme_compat', $theme_name);
|
|
| 1979 | + update_option('theme_compatibility_setting', $theme_compats[$theme_name]);
|
|
| 1980 | 1980 | |
| 1981 | - // if there are default options to set then set them |
|
| 1982 | - if (isset($theme_compats[$theme_name]['geodir_theme_compat_default_options']) && !empty($theme_compats[$theme_name]['geodir_theme_compat_default_options'])) {
|
|
| 1981 | + // if there are default options to set then set them |
|
| 1982 | + if (isset($theme_compats[$theme_name]['geodir_theme_compat_default_options']) && !empty($theme_compats[$theme_name]['geodir_theme_compat_default_options'])) {
|
|
| 1983 | 1983 | |
| 1984 | - foreach ($theme_compats[$theme_name]['geodir_theme_compat_default_options'] as $key => $val) {
|
|
| 1985 | - update_option($key, $val); |
|
| 1986 | - } |
|
| 1987 | - } |
|
| 1984 | + foreach ($theme_compats[$theme_name]['geodir_theme_compat_default_options'] as $key => $val) {
|
|
| 1985 | + update_option($key, $val); |
|
| 1986 | + } |
|
| 1987 | + } |
|
| 1988 | 1988 | |
| 1989 | - } else {
|
|
| 1990 | - update_option('gd_theme_compat', '');
|
|
| 1991 | - update_option('theme_compatibility_setting', '');
|
|
| 1992 | - } |
|
| 1989 | + } else {
|
|
| 1990 | + update_option('gd_theme_compat', '');
|
|
| 1991 | + update_option('theme_compatibility_setting', '');
|
|
| 1992 | + } |
|
| 1993 | 1993 | |
| 1994 | 1994 | |
| 1995 | 1995 | } |
@@ -2004,9 +2004,9 @@ discard block |
||
| 2004 | 2004 | */ |
| 2005 | 2005 | function gd_check_avada_compat() |
| 2006 | 2006 | {
|
| 2007 | - if (function_exists('avada_load_textdomain') && !get_option('avada_nag')) {
|
|
| 2008 | - add_action('admin_notices', 'gd_avada_compat_warning');
|
|
| 2009 | - } |
|
| 2007 | + if (function_exists('avada_load_textdomain') && !get_option('avada_nag')) {
|
|
| 2008 | + add_action('admin_notices', 'gd_avada_compat_warning');
|
|
| 2009 | + } |
|
| 2010 | 2010 | } |
| 2011 | 2011 | |
| 2012 | 2012 | |
@@ -2019,22 +2019,22 @@ discard block |
||
| 2019 | 2019 | function gd_avada_compat_warning() |
| 2020 | 2020 | {
|
| 2021 | 2021 | |
| 2022 | - /* |
|
| 2022 | + /* |
|
| 2023 | 2023 | $msg_type = error |
| 2024 | 2024 | $msg_type = updated fade |
| 2025 | 2025 | $msg_type = update-nag |
| 2026 | 2026 | */ |
| 2027 | 2027 | |
| 2028 | - $plugin = 'avada-nag'; |
|
| 2029 | - $timestamp = 'avada-nag1234'; |
|
| 2030 | - $message = __('Welcome to GeoDirectory, please have a look <a href="https://docs.wpgeodirectory.com/category/getting-started/" target="_blank">here</a> to get started. :)', 'geodirectory');
|
|
| 2031 | - echo '<div id="' . $timestamp . '" class="error">'; |
|
| 2032 | - echo '<span class="gd-remove-noti" onclick="gdRemoveANotification(\'' . $plugin . '\',\'' . $timestamp . '\');" ><i class="fas fa-times"></i></span>'; |
|
| 2033 | - echo "<img class='gd-icon-noti' src='" . plugin_dir_url('') . "geodirectory/geodirectory-assets/images/favicon.ico' > ";
|
|
| 2034 | - echo "<p>$message</p>"; |
|
| 2035 | - echo "</div>"; |
|
| 2028 | + $plugin = 'avada-nag'; |
|
| 2029 | + $timestamp = 'avada-nag1234'; |
|
| 2030 | + $message = __('Welcome to GeoDirectory, please have a look <a href="https://docs.wpgeodirectory.com/category/getting-started/" target="_blank">here</a> to get started. :)', 'geodirectory');
|
|
| 2031 | + echo '<div id="' . $timestamp . '" class="error">'; |
|
| 2032 | + echo '<span class="gd-remove-noti" onclick="gdRemoveANotification(\'' . $plugin . '\',\'' . $timestamp . '\');" ><i class="fas fa-times"></i></span>'; |
|
| 2033 | + echo "<img class='gd-icon-noti' src='" . plugin_dir_url('') . "geodirectory/geodirectory-assets/images/favicon.ico' > ";
|
|
| 2034 | + echo "<p>$message</p>"; |
|
| 2035 | + echo "</div>"; |
|
| 2036 | 2036 | |
| 2037 | - ?> |
|
| 2037 | + ?> |
|
| 2038 | 2038 | <script> |
| 2039 | 2039 | function gdRemoveANotification($plugin, $timestamp) {
|
| 2040 | 2040 | |
@@ -2102,10 +2102,10 @@ discard block |
||
| 2102 | 2102 | */ |
| 2103 | 2103 | function geodir_avada_remove_notification() |
| 2104 | 2104 | {
|
| 2105 | - update_option('avada_nag', TRUE);
|
|
| 2105 | + update_option('avada_nag', TRUE);
|
|
| 2106 | 2106 | |
| 2107 | - // Always die in functions echoing ajax content |
|
| 2108 | - die(); |
|
| 2107 | + // Always die in functions echoing ajax content |
|
| 2108 | + die(); |
|
| 2109 | 2109 | } |
| 2110 | 2110 | |
| 2111 | 2111 | |
@@ -2127,11 +2127,11 @@ discard block |
||
| 2127 | 2127 | global $post, $typenow, $current_screen; |
| 2128 | 2128 | |
| 2129 | 2129 | $post_type = NULL; |
| 2130 | - if (isset($_REQUEST['post_type'])) |
|
| 2130 | + if (isset($_REQUEST['post_type'])) |
|
| 2131 | 2131 | $post_type = sanitize_key($_REQUEST['post_type']); |
| 2132 | - elseif (isset($_REQUEST['post']) && get_post_type($_REQUEST['post'])) |
|
| 2132 | + elseif (isset($_REQUEST['post']) && get_post_type($_REQUEST['post'])) |
|
| 2133 | 2133 | $post_type = get_post_type($_REQUEST['post']); |
| 2134 | - elseif ($post && isset($post->post_type)) |
|
| 2134 | + elseif ($post && isset($post->post_type)) |
|
| 2135 | 2135 | $post_type = $post->post_type; |
| 2136 | 2136 | elseif ($typenow) |
| 2137 | 2137 | $post_type = $typenow; |
@@ -2165,7 +2165,7 @@ discard block |
||
| 2165 | 2165 | // Don't allow same slug url for listing and location |
| 2166 | 2166 | if (geodir_strtolower($listing_prefix) == geodir_strtolower($location_prefix)) {
|
| 2167 | 2167 | $redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $active_tab . '&msg=fail&gderr=21');
|
| 2168 | - wp_redirect($redirect_url); |
|
| 2168 | + wp_redirect($redirect_url); |
|
| 2169 | 2169 | exit; |
| 2170 | 2170 | } |
| 2171 | 2171 | |
@@ -2195,10 +2195,10 @@ discard block |
||
| 2195 | 2195 | * @package GeoDirectory |
| 2196 | 2196 | */ |
| 2197 | 2197 | function geodir_hide_admin_preview_button() {
|
| 2198 | - global $post_type; |
|
| 2199 | - $post_types = geodir_get_posttypes(); |
|
| 2200 | - if(in_array($post_type, $post_types)) |
|
| 2201 | - echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
|
|
| 2198 | + global $post_type; |
|
| 2199 | + $post_types = geodir_get_posttypes(); |
|
| 2200 | + if(in_array($post_type, $post_types)) |
|
| 2201 | + echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
|
|
| 2202 | 2202 | } |
| 2203 | 2203 | add_action( 'admin_head-post-new.php', 'geodir_hide_admin_preview_button' ); |
| 2204 | 2204 | add_action( 'admin_head-post.php', 'geodir_hide_admin_preview_button' ); |
@@ -2213,7 +2213,7 @@ discard block |
||
| 2213 | 2213 | */ |
| 2214 | 2214 | function geodir_import_export_tab( $tabs ) {
|
| 2215 | 2215 | $tabs['import_export'] = array( 'label' => __( 'Import & Export', 'geodirectory' ) ); |
| 2216 | - return $tabs; |
|
| 2216 | + return $tabs; |
|
| 2217 | 2217 | } |
| 2218 | 2218 | |
| 2219 | 2219 | /** |
@@ -2228,26 +2228,26 @@ discard block |
||
| 2228 | 2228 | function geodir_import_export_page() {
|
| 2229 | 2229 | $nonce = wp_create_nonce( 'geodir_import_export_nonce' ); |
| 2230 | 2230 | $gd_cats_sample_csv = geodir_plugin_url() . '/geodirectory-assets/gd_sample_categories.csv'; |
| 2231 | - /** |
|
| 2232 | - * Filter sample category data csv file url. |
|
| 2233 | - * |
|
| 2234 | - * @since 1.0.0 |
|
| 2235 | - * @package GeoDirectory |
|
| 2236 | - * |
|
| 2237 | - * @param string $gd_cats_sample_csv Sample category data csv file url. |
|
| 2238 | - */ |
|
| 2231 | + /** |
|
| 2232 | + * Filter sample category data csv file url. |
|
| 2233 | + * |
|
| 2234 | + * @since 1.0.0 |
|
| 2235 | + * @package GeoDirectory |
|
| 2236 | + * |
|
| 2237 | + * @param string $gd_cats_sample_csv Sample category data csv file url. |
|
| 2238 | + */ |
|
| 2239 | 2239 | $gd_cats_sample_csv = apply_filters( 'geodir_export_cats_sample_csv', $gd_cats_sample_csv ); |
| 2240 | 2240 | |
| 2241 | 2241 | $gd_posts_sample_csv = geodir_plugin_url() . '/geodirectory-assets/place_listing.csv'; |
| 2242 | - /** |
|
| 2243 | - * Filter sample post data csv file url. |
|
| 2244 | - * |
|
| 2245 | - * @since 1.0.0 |
|
| 2246 | - * @package GeoDirectory |
|
| 2247 | - * |
|
| 2248 | - * @param string $gd_posts_sample_csv Sample post data csv file url. |
|
| 2249 | - */ |
|
| 2250 | - $gd_posts_sample_csv = apply_filters( 'geodir_export_posts_sample_csv', $gd_posts_sample_csv ); |
|
| 2242 | + /** |
|
| 2243 | + * Filter sample post data csv file url. |
|
| 2244 | + * |
|
| 2245 | + * @since 1.0.0 |
|
| 2246 | + * @package GeoDirectory |
|
| 2247 | + * |
|
| 2248 | + * @param string $gd_posts_sample_csv Sample post data csv file url. |
|
| 2249 | + */ |
|
| 2250 | + $gd_posts_sample_csv = apply_filters( 'geodir_export_posts_sample_csv', $gd_posts_sample_csv ); |
|
| 2251 | 2251 | |
| 2252 | 2252 | $gd_posttypes = geodir_get_posttypes( 'array' ); |
| 2253 | 2253 | |
@@ -2270,14 +2270,14 @@ discard block |
||
| 2270 | 2270 | $gd_chunksize_options[100000] = 100000; |
| 2271 | 2271 | |
| 2272 | 2272 | /** |
| 2273 | - * Filter max entries per export csv file. |
|
| 2274 | - * |
|
| 2275 | - * @since 1.5.6 |
|
| 2276 | - * @package GeoDirectory |
|
| 2277 | - * |
|
| 2278 | - * @param string $gd_chunksize_options Entries options. |
|
| 2279 | - */ |
|
| 2280 | - $gd_chunksize_options = apply_filters( 'geodir_export_csv_chunksize_options', $gd_chunksize_options ); |
|
| 2273 | + * Filter max entries per export csv file. |
|
| 2274 | + * |
|
| 2275 | + * @since 1.5.6 |
|
| 2276 | + * @package GeoDirectory |
|
| 2277 | + * |
|
| 2278 | + * @param string $gd_chunksize_options Entries options. |
|
| 2279 | + */ |
|
| 2280 | + $gd_chunksize_options = apply_filters( 'geodir_export_csv_chunksize_options', $gd_chunksize_options ); |
|
| 2281 | 2281 | |
| 2282 | 2282 | $gd_chunksize_option = ''; |
| 2283 | 2283 | foreach ($gd_chunksize_options as $value => $title) {
|
@@ -2294,12 +2294,12 @@ discard block |
||
| 2294 | 2294 | <div class="gd-content-heading"> |
| 2295 | 2295 | |
| 2296 | 2296 | <?php |
| 2297 | - @ini_set('max_execution_time', 999999);
|
|
| 2298 | - $ini_max_execution_time_check = @ini_get( 'max_execution_time' ); |
|
| 2299 | - @ini_restore('max_execution_time');
|
|
| 2297 | + @ini_set('max_execution_time', 999999);
|
|
| 2298 | + $ini_max_execution_time_check = @ini_get( 'max_execution_time' ); |
|
| 2299 | + @ini_restore('max_execution_time');
|
|
| 2300 | 2300 | |
| 2301 | - if($ini_max_execution_time_check != 999999){ // only show these setting to the user if we can't change the ini setting
|
|
| 2302 | - ?> |
|
| 2301 | + if($ini_max_execution_time_check != 999999){ // only show these setting to the user if we can't change the ini setting
|
|
| 2302 | + ?> |
|
| 2303 | 2303 | <div id="gd_ie_reqs" class="metabox-holder"> |
| 2304 | 2304 | <div class="meta-box-sortables ui-sortable"> |
| 2305 | 2305 | <div class="postbox"> |
@@ -2474,7 +2474,7 @@ discard block |
||
| 2474 | 2474 | * Called just after the sample CSV download link. |
| 2475 | 2475 | * |
| 2476 | 2476 | * @since 1.0.0 |
| 2477 | - * @package GeoDirectory |
|
| 2477 | + * @package GeoDirectory |
|
| 2478 | 2478 | */ |
| 2479 | 2479 | do_action('geodir_sample_cats_csv_download_link');
|
| 2480 | 2480 | ?> |
@@ -2559,11 +2559,11 @@ discard block |
||
| 2559 | 2559 | * |
| 2560 | 2560 | * Called after the last setting on the GD > Import & Export page. |
| 2561 | 2561 | * @since 1.4.6 |
| 2562 | - * @package GeoDirectory |
|
| 2562 | + * @package GeoDirectory |
|
| 2563 | 2563 | * |
| 2564 | 2564 | * @param array $gd_posttypes GD post types. |
| 2565 | - * @param array $gd_chunksize_options File chunk size options. |
|
| 2566 | - * @param string $nonce Wordpress security token for GD import & export. |
|
| 2565 | + * @param array $gd_chunksize_options File chunk size options. |
|
| 2566 | + * @param string $nonce Wordpress security token for GD import & export. |
|
| 2567 | 2567 | */ |
| 2568 | 2568 | do_action( 'geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce ); |
| 2569 | 2569 | ?> |
@@ -3250,44 +3250,44 @@ discard block |
||
| 3250 | 3250 | function geodir_init_filesystem() |
| 3251 | 3251 | {
|
| 3252 | 3252 | |
| 3253 | - if(!function_exists('get_filesystem_method')){
|
|
| 3254 | - require_once(ABSPATH."/wp-admin/includes/file.php"); |
|
| 3255 | - } |
|
| 3256 | - $access_type = get_filesystem_method(); |
|
| 3257 | - if ($access_type === 'direct') {
|
|
| 3258 | - /* you can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */ |
|
| 3259 | - $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array()); |
|
| 3260 | - |
|
| 3261 | - /* initialize the API */ |
|
| 3262 | - if (!WP_Filesystem($creds)) {
|
|
| 3263 | - /* any problems and we exit */ |
|
| 3264 | - //return '@@@3'; |
|
| 3265 | - return false; |
|
| 3266 | - } |
|
| 3253 | + if(!function_exists('get_filesystem_method')){
|
|
| 3254 | + require_once(ABSPATH."/wp-admin/includes/file.php"); |
|
| 3255 | + } |
|
| 3256 | + $access_type = get_filesystem_method(); |
|
| 3257 | + if ($access_type === 'direct') {
|
|
| 3258 | + /* you can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */ |
|
| 3259 | + $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array()); |
|
| 3260 | + |
|
| 3261 | + /* initialize the API */ |
|
| 3262 | + if (!WP_Filesystem($creds)) {
|
|
| 3263 | + /* any problems and we exit */ |
|
| 3264 | + //return '@@@3'; |
|
| 3265 | + return false; |
|
| 3266 | + } |
|
| 3267 | 3267 | |
| 3268 | - global $wp_filesystem; |
|
| 3269 | - return $wp_filesystem; |
|
| 3270 | - /* do our file manipulations below */ |
|
| 3271 | - } elseif (defined('FTP_USER')) {
|
|
| 3272 | - $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array()); |
|
| 3268 | + global $wp_filesystem; |
|
| 3269 | + return $wp_filesystem; |
|
| 3270 | + /* do our file manipulations below */ |
|
| 3271 | + } elseif (defined('FTP_USER')) {
|
|
| 3272 | + $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array()); |
|
| 3273 | + |
|
| 3274 | + /* initialize the API */ |
|
| 3275 | + if (!WP_Filesystem($creds)) {
|
|
| 3276 | + /* any problems and we exit */ |
|
| 3277 | + //return '@@@33'; |
|
| 3278 | + return false; |
|
| 3279 | + } |
|
| 3273 | 3280 | |
| 3274 | - /* initialize the API */ |
|
| 3275 | - if (!WP_Filesystem($creds)) {
|
|
| 3276 | - /* any problems and we exit */ |
|
| 3277 | - //return '@@@33'; |
|
| 3278 | - return false; |
|
| 3279 | - } |
|
| 3281 | + global $wp_filesystem; |
|
| 3282 | + //return '@@@1'; |
|
| 3283 | + return $wp_filesystem; |
|
| 3280 | 3284 | |
| 3281 | - global $wp_filesystem; |
|
| 3282 | - //return '@@@1'; |
|
| 3283 | - return $wp_filesystem; |
|
| 3284 | - |
|
| 3285 | - } else {
|
|
| 3286 | - //return '@@@2'; |
|
| 3287 | - /* don't have direct write access. Prompt user with our notice */ |
|
| 3288 | - add_action('admin_notice', 'geodir_filesystem_notice');
|
|
| 3289 | - return false; |
|
| 3290 | - } |
|
| 3285 | + } else {
|
|
| 3286 | + //return '@@@2'; |
|
| 3287 | + /* don't have direct write access. Prompt user with our notice */ |
|
| 3288 | + add_action('admin_notice', 'geodir_filesystem_notice');
|
|
| 3289 | + return false; |
|
| 3290 | + } |
|
| 3291 | 3291 | |
| 3292 | 3292 | } |
| 3293 | 3293 | |
@@ -3305,10 +3305,10 @@ discard block |
||
| 3305 | 3305 | */ |
| 3306 | 3306 | function geodir_filesystem_notice() |
| 3307 | 3307 | { if ( defined( 'DOING_AJAX' ) ){return;}
|
| 3308 | - $access_type = get_filesystem_method(); |
|
| 3309 | - if ($access_type === 'direct') {
|
|
| 3310 | - } elseif (!defined('FTP_USER')) {
|
|
| 3311 | - ?> |
|
| 3308 | + $access_type = get_filesystem_method(); |
|
| 3309 | + if ($access_type === 'direct') {
|
|
| 3310 | + } elseif (!defined('FTP_USER')) {
|
|
| 3311 | + ?> |
|
| 3312 | 3312 | <div class="error"> |
| 3313 | 3313 | <p><?php _e('GeoDirectory does not have access to your filesystem, thing like import/export will not work. Please define your details in wp-config.php as explained here', 'geodirectory'); ?>
|
| 3314 | 3314 | <a target="_blank" href="http://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants">http://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants</a> |
@@ -3336,1280 +3336,1280 @@ discard block |
||
| 3336 | 3336 | * @return string Json data. |
| 3337 | 3337 | */ |
| 3338 | 3338 | function geodir_ajax_import_export() {
|
| 3339 | - global $wpdb, $plugin_prefix, $current_user, $wp_filesystem; |
|
| 3339 | + global $wpdb, $plugin_prefix, $current_user, $wp_filesystem; |
|
| 3340 | 3340 | |
| 3341 | - error_reporting(0); |
|
| 3341 | + error_reporting(0); |
|
| 3342 | 3342 | |
| 3343 | - $xstart = microtime(true); |
|
| 3343 | + $xstart = microtime(true); |
|
| 3344 | 3344 | |
| 3345 | - // try to set higher limits for import |
|
| 3346 | - $max_input_time = ini_get('max_input_time');
|
|
| 3347 | - $max_execution_time = ini_get('max_execution_time');
|
|
| 3348 | - $memory_limit= ini_get('memory_limit');
|
|
| 3345 | + // try to set higher limits for import |
|
| 3346 | + $max_input_time = ini_get('max_input_time');
|
|
| 3347 | + $max_execution_time = ini_get('max_execution_time');
|
|
| 3348 | + $memory_limit= ini_get('memory_limit');
|
|
| 3349 | 3349 | |
| 3350 | - if(!$max_input_time || $max_input_time<3000){
|
|
| 3351 | - @ini_set('max_input_time', 3000);
|
|
| 3352 | - } |
|
| 3350 | + if(!$max_input_time || $max_input_time<3000){
|
|
| 3351 | + @ini_set('max_input_time', 3000);
|
|
| 3352 | + } |
|
| 3353 | 3353 | |
| 3354 | - if(!$max_execution_time || $max_execution_time<3000){
|
|
| 3355 | - @ini_set('max_execution_time', 3000);
|
|
| 3356 | - } |
|
| 3354 | + if(!$max_execution_time || $max_execution_time<3000){
|
|
| 3355 | + @ini_set('max_execution_time', 3000);
|
|
| 3356 | + } |
|
| 3357 | 3357 | |
| 3358 | - if($memory_limit && str_replace('M','',$memory_limit)){
|
|
| 3359 | - if(str_replace('M','',$memory_limit)<256){
|
|
| 3360 | - @ini_set('memory_limit', '256M');
|
|
| 3361 | - } |
|
| 3362 | - } |
|
| 3358 | + if($memory_limit && str_replace('M','',$memory_limit)){
|
|
| 3359 | + if(str_replace('M','',$memory_limit)<256){
|
|
| 3360 | + @ini_set('memory_limit', '256M');
|
|
| 3361 | + } |
|
| 3362 | + } |
|
| 3363 | 3363 | |
| 3364 | - $json = array(); |
|
| 3364 | + $json = array(); |
|
| 3365 | 3365 | |
| 3366 | - if ( !current_user_can( 'manage_options' ) ) {
|
|
| 3367 | - wp_send_json( $json ); |
|
| 3368 | - } |
|
| 3366 | + if ( !current_user_can( 'manage_options' ) ) {
|
|
| 3367 | + wp_send_json( $json ); |
|
| 3368 | + } |
|
| 3369 | 3369 | |
| 3370 | - $task = isset( $_REQUEST['task'] ) ? $_REQUEST['task'] : NULL; |
|
| 3371 | - $nonce = isset( $_REQUEST['_nonce'] ) ? $_REQUEST['_nonce'] : NULL; |
|
| 3372 | - $stat = isset( $_REQUEST['_st'] ) ? $_REQUEST['_st'] : false; |
|
| 3370 | + $task = isset( $_REQUEST['task'] ) ? $_REQUEST['task'] : NULL; |
|
| 3371 | + $nonce = isset( $_REQUEST['_nonce'] ) ? $_REQUEST['_nonce'] : NULL; |
|
| 3372 | + $stat = isset( $_REQUEST['_st'] ) ? $_REQUEST['_st'] : false; |
|
| 3373 | 3373 | |
| 3374 | - if ( !wp_verify_nonce( $nonce, 'geodir_import_export_nonce' ) ) {
|
|
| 3375 | - wp_send_json( $json ); |
|
| 3376 | - } |
|
| 3374 | + if ( !wp_verify_nonce( $nonce, 'geodir_import_export_nonce' ) ) {
|
|
| 3375 | + wp_send_json( $json ); |
|
| 3376 | + } |
|
| 3377 | 3377 | |
| 3378 | - $post_type = isset( $_REQUEST['_pt'] ) ? $_REQUEST['_pt'] : NULL; |
|
| 3379 | - $chunk_per_page = isset( $_REQUEST['_n'] ) ? absint($_REQUEST['_n']) : NULL; |
|
| 3380 | - $chunk_per_page = $chunk_per_page < 50 || $chunk_per_page > 100000 ? 5000 : $chunk_per_page; |
|
| 3381 | - $chunk_page_no = isset( $_REQUEST['_p'] ) ? absint($_REQUEST['_p']) : 1; |
|
| 3378 | + $post_type = isset( $_REQUEST['_pt'] ) ? $_REQUEST['_pt'] : NULL; |
|
| 3379 | + $chunk_per_page = isset( $_REQUEST['_n'] ) ? absint($_REQUEST['_n']) : NULL; |
|
| 3380 | + $chunk_per_page = $chunk_per_page < 50 || $chunk_per_page > 100000 ? 5000 : $chunk_per_page; |
|
| 3381 | + $chunk_page_no = isset( $_REQUEST['_p'] ) ? absint($_REQUEST['_p']) : 1; |
|
| 3382 | 3382 | |
| 3383 | - $wp_filesystem = geodir_init_filesystem(); |
|
| 3384 | - if (!$wp_filesystem) {
|
|
| 3385 | - $json['error'] = __( 'Filesystem ERROR: Could not access filesystem.', 'geodirectory' ); |
|
| 3386 | - wp_send_json( $json ); |
|
| 3387 | - } |
|
| 3383 | + $wp_filesystem = geodir_init_filesystem(); |
|
| 3384 | + if (!$wp_filesystem) {
|
|
| 3385 | + $json['error'] = __( 'Filesystem ERROR: Could not access filesystem.', 'geodirectory' ); |
|
| 3386 | + wp_send_json( $json ); |
|
| 3387 | + } |
|
| 3388 | 3388 | |
| 3389 | - if (!empty($wp_filesystem) && isset($wp_filesystem->errors) && is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
|
|
| 3390 | - $json['error'] = __( 'Filesystem ERROR: ' . $wp_filesystem->errors->get_error_message(), 'geodirectory' ); |
|
| 3391 | - wp_send_json( $json ); |
|
| 3392 | - } |
|
| 3389 | + if (!empty($wp_filesystem) && isset($wp_filesystem->errors) && is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
|
|
| 3390 | + $json['error'] = __( 'Filesystem ERROR: ' . $wp_filesystem->errors->get_error_message(), 'geodirectory' ); |
|
| 3391 | + wp_send_json( $json ); |
|
| 3392 | + } |
|
| 3393 | 3393 | |
| 3394 | - $csv_file_dir = geodir_path_import_export( false ); |
|
| 3395 | - if ( !$wp_filesystem->is_dir( $csv_file_dir ) ) {
|
|
| 3396 | - if ( !$wp_filesystem->mkdir( $csv_file_dir, FS_CHMOD_DIR ) ) {
|
|
| 3397 | - $json['error'] = __( 'ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory' ); |
|
| 3398 | - wp_send_json( $json ); |
|
| 3399 | - } |
|
| 3400 | - } |
|
| 3394 | + $csv_file_dir = geodir_path_import_export( false ); |
|
| 3395 | + if ( !$wp_filesystem->is_dir( $csv_file_dir ) ) {
|
|
| 3396 | + if ( !$wp_filesystem->mkdir( $csv_file_dir, FS_CHMOD_DIR ) ) {
|
|
| 3397 | + $json['error'] = __( 'ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory' ); |
|
| 3398 | + wp_send_json( $json ); |
|
| 3399 | + } |
|
| 3400 | + } |
|
| 3401 | 3401 | |
| 3402 | - $location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
|
|
| 3403 | - $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
|
|
| 3404 | - |
|
| 3405 | - switch ( $task ) {
|
|
| 3406 | - case 'export_posts': {
|
|
| 3407 | - // WPML |
|
| 3408 | - $is_wpml = geodir_is_wpml(); |
|
| 3409 | - if ($is_wpml) {
|
|
| 3410 | - global $sitepress; |
|
| 3411 | - $active_lang = ICL_LANGUAGE_CODE; |
|
| 3402 | + $location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
|
|
| 3403 | + $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
|
|
| 3404 | + |
|
| 3405 | + switch ( $task ) {
|
|
| 3406 | + case 'export_posts': {
|
|
| 3407 | + // WPML |
|
| 3408 | + $is_wpml = geodir_is_wpml(); |
|
| 3409 | + if ($is_wpml) {
|
|
| 3410 | + global $sitepress; |
|
| 3411 | + $active_lang = ICL_LANGUAGE_CODE; |
|
| 3412 | 3412 | |
| 3413 | - $sitepress->switch_lang('all', true);
|
|
| 3414 | - } |
|
| 3415 | - // WPML |
|
| 3416 | - if ( $post_type == 'gd_event' ) {
|
|
| 3417 | - add_filter( 'geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2 ); |
|
| 3418 | - } |
|
| 3419 | - $filters = !empty( $_REQUEST['gd_imex'] ) && is_array( $_REQUEST['gd_imex'] ) ? $_REQUEST['gd_imex'] : NULL; |
|
| 3413 | + $sitepress->switch_lang('all', true);
|
|
| 3414 | + } |
|
| 3415 | + // WPML |
|
| 3416 | + if ( $post_type == 'gd_event' ) {
|
|
| 3417 | + add_filter( 'geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2 ); |
|
| 3418 | + } |
|
| 3419 | + $filters = !empty( $_REQUEST['gd_imex'] ) && is_array( $_REQUEST['gd_imex'] ) ? $_REQUEST['gd_imex'] : NULL; |
|
| 3420 | 3420 | |
| 3421 | - $file_name = $post_type . '_' . date( 'dmyHi' ); |
|
| 3422 | - if ( $filters && isset( $filters['start_date'] ) && isset( $filters['end_date'] ) ) {
|
|
| 3423 | - $file_name = $post_type . '_' . date_i18n( 'dmy', strtotime( $filters['start_date'] ) ) . '_' . date_i18n( 'dmy', strtotime( $filters['end_date'] ) ); |
|
| 3424 | - } |
|
| 3425 | - $posts_count = geodir_get_posts_count( $post_type ); |
|
| 3426 | - $file_url_base = geodir_path_import_export() . '/'; |
|
| 3427 | - $file_url = $file_url_base . $file_name . '.csv'; |
|
| 3428 | - $file_path = $csv_file_dir . '/' . $file_name . '.csv'; |
|
| 3429 | - $file_path_temp = $csv_file_dir . '/' . $post_type . '_' . $nonce . '.csv'; |
|
| 3421 | + $file_name = $post_type . '_' . date( 'dmyHi' ); |
|
| 3422 | + if ( $filters && isset( $filters['start_date'] ) && isset( $filters['end_date'] ) ) {
|
|
| 3423 | + $file_name = $post_type . '_' . date_i18n( 'dmy', strtotime( $filters['start_date'] ) ) . '_' . date_i18n( 'dmy', strtotime( $filters['end_date'] ) ); |
|
| 3424 | + } |
|
| 3425 | + $posts_count = geodir_get_posts_count( $post_type ); |
|
| 3426 | + $file_url_base = geodir_path_import_export() . '/'; |
|
| 3427 | + $file_url = $file_url_base . $file_name . '.csv'; |
|
| 3428 | + $file_path = $csv_file_dir . '/' . $file_name . '.csv'; |
|
| 3429 | + $file_path_temp = $csv_file_dir . '/' . $post_type . '_' . $nonce . '.csv'; |
|
| 3430 | 3430 | |
| 3431 | - $chunk_file_paths = array(); |
|
| 3431 | + $chunk_file_paths = array(); |
|
| 3432 | 3432 | |
| 3433 | - if ( isset( $_REQUEST['_c'] ) ) {
|
|
| 3434 | - $json['total'] = $posts_count; |
|
| 3435 | - // WPML |
|
| 3436 | - if ($is_wpml) {
|
|
| 3437 | - $sitepress->switch_lang($active_lang, true); |
|
| 3438 | - } |
|
| 3439 | - // WPML |
|
| 3440 | - wp_send_json( $json ); |
|
| 3441 | - gd_die(); |
|
| 3442 | - } else if ( isset( $_REQUEST['_st'] ) ) {
|
|
| 3443 | - $line_count = (int)geodir_import_export_line_count( $file_path_temp ); |
|
| 3444 | - $percentage = count( $posts_count ) > 0 && $line_count > 0 ? ceil( $line_count / $posts_count ) * 100 : 0; |
|
| 3445 | - $percentage = min( $percentage, 100 ); |
|
| 3433 | + if ( isset( $_REQUEST['_c'] ) ) {
|
|
| 3434 | + $json['total'] = $posts_count; |
|
| 3435 | + // WPML |
|
| 3436 | + if ($is_wpml) {
|
|
| 3437 | + $sitepress->switch_lang($active_lang, true); |
|
| 3438 | + } |
|
| 3439 | + // WPML |
|
| 3440 | + wp_send_json( $json ); |
|
| 3441 | + gd_die(); |
|
| 3442 | + } else if ( isset( $_REQUEST['_st'] ) ) {
|
|
| 3443 | + $line_count = (int)geodir_import_export_line_count( $file_path_temp ); |
|
| 3444 | + $percentage = count( $posts_count ) > 0 && $line_count > 0 ? ceil( $line_count / $posts_count ) * 100 : 0; |
|
| 3445 | + $percentage = min( $percentage, 100 ); |
|
| 3446 | 3446 | |
| 3447 | - $json['percentage'] = $percentage; |
|
| 3448 | - // WPML |
|
| 3449 | - if ($is_wpml) {
|
|
| 3450 | - $sitepress->switch_lang($active_lang, true); |
|
| 3451 | - } |
|
| 3452 | - // WPML |
|
| 3453 | - wp_send_json( $json ); |
|
| 3454 | - gd_die(); |
|
| 3455 | - } else {
|
|
| 3456 | - if ( !$posts_count > 0 ) {
|
|
| 3457 | - $json['error'] = __( 'No records to export.', 'geodirectory' ); |
|
| 3458 | - } else {
|
|
| 3459 | - $total_posts = $posts_count; |
|
| 3460 | - if ($chunk_per_page > $total_posts) {
|
|
| 3461 | - $chunk_per_page = $total_posts; |
|
| 3462 | - } |
|
| 3463 | - $chunk_total_pages = ceil( $total_posts / $chunk_per_page ); |
|
| 3447 | + $json['percentage'] = $percentage; |
|
| 3448 | + // WPML |
|
| 3449 | + if ($is_wpml) {
|
|
| 3450 | + $sitepress->switch_lang($active_lang, true); |
|
| 3451 | + } |
|
| 3452 | + // WPML |
|
| 3453 | + wp_send_json( $json ); |
|
| 3454 | + gd_die(); |
|
| 3455 | + } else {
|
|
| 3456 | + if ( !$posts_count > 0 ) {
|
|
| 3457 | + $json['error'] = __( 'No records to export.', 'geodirectory' ); |
|
| 3458 | + } else {
|
|
| 3459 | + $total_posts = $posts_count; |
|
| 3460 | + if ($chunk_per_page > $total_posts) {
|
|
| 3461 | + $chunk_per_page = $total_posts; |
|
| 3462 | + } |
|
| 3463 | + $chunk_total_pages = ceil( $total_posts / $chunk_per_page ); |
|
| 3464 | 3464 | |
| 3465 | - $j = $chunk_page_no; |
|
| 3466 | - $chunk_save_posts = geodir_imex_get_posts( $post_type, $chunk_per_page, $j ); |
|
| 3465 | + $j = $chunk_page_no; |
|
| 3466 | + $chunk_save_posts = geodir_imex_get_posts( $post_type, $chunk_per_page, $j ); |
|
| 3467 | 3467 | |
| 3468 | - $per_page = 500; |
|
| 3469 | - if ($per_page > $chunk_per_page) {
|
|
| 3470 | - $per_page = $chunk_per_page; |
|
| 3471 | - } |
|
| 3472 | - $total_pages = ceil( $chunk_per_page / $per_page ); |
|
| 3468 | + $per_page = 500; |
|
| 3469 | + if ($per_page > $chunk_per_page) {
|
|
| 3470 | + $per_page = $chunk_per_page; |
|
| 3471 | + } |
|
| 3472 | + $total_pages = ceil( $chunk_per_page / $per_page ); |
|
| 3473 | 3473 | |
| 3474 | - for ( $i = 0; $i <= $total_pages; $i++ ) {
|
|
| 3475 | - $save_posts = array_slice( $chunk_save_posts , ( $i * $per_page ), $per_page ); |
|
| 3474 | + for ( $i = 0; $i <= $total_pages; $i++ ) {
|
|
| 3475 | + $save_posts = array_slice( $chunk_save_posts , ( $i * $per_page ), $per_page ); |
|
| 3476 | 3476 | |
| 3477 | - $clear = $i == 0 ? true : false; |
|
| 3478 | - geodir_save_csv_data( $file_path_temp, $save_posts, $clear ); |
|
| 3479 | - } |
|
| 3477 | + $clear = $i == 0 ? true : false; |
|
| 3478 | + geodir_save_csv_data( $file_path_temp, $save_posts, $clear ); |
|
| 3479 | + } |
|
| 3480 | 3480 | |
| 3481 | - if ( $wp_filesystem->exists( $file_path_temp ) ) {
|
|
| 3482 | - $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : ''; |
|
| 3483 | - $chunk_file_name = $file_name . $chunk_page_no . '.csv'; |
|
| 3484 | - $file_path = $csv_file_dir . '/' . $chunk_file_name; |
|
| 3485 | - $wp_filesystem->move( $file_path_temp, $file_path, true ); |
|
| 3481 | + if ( $wp_filesystem->exists( $file_path_temp ) ) {
|
|
| 3482 | + $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : ''; |
|
| 3483 | + $chunk_file_name = $file_name . $chunk_page_no . '.csv'; |
|
| 3484 | + $file_path = $csv_file_dir . '/' . $chunk_file_name; |
|
| 3485 | + $wp_filesystem->move( $file_path_temp, $file_path, true ); |
|
| 3486 | 3486 | |
| 3487 | - $file_url = $file_url_base . $chunk_file_name; |
|
| 3488 | - $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
| 3489 | - } |
|
| 3487 | + $file_url = $file_url_base . $chunk_file_name; |
|
| 3488 | + $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
| 3489 | + } |
|
| 3490 | 3490 | |
| 3491 | - if ( !empty($chunk_file_paths) ) {
|
|
| 3492 | - $json['total'] = $posts_count; |
|
| 3493 | - $json['files'] = $chunk_file_paths; |
|
| 3494 | - } else {
|
|
| 3495 | - if ($j > 1) {
|
|
| 3496 | - $json['total'] = $posts_count; |
|
| 3497 | - $json['files'] = array(); |
|
| 3498 | - } else {
|
|
| 3499 | - $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' ); |
|
| 3500 | - } |
|
| 3501 | - } |
|
| 3502 | - } |
|
| 3503 | - // WPML |
|
| 3504 | - if ($is_wpml) {
|
|
| 3505 | - $sitepress->switch_lang($active_lang, true); |
|
| 3506 | - } |
|
| 3507 | - // WPML |
|
| 3508 | - wp_send_json( $json ); |
|
| 3509 | - } |
|
| 3510 | - } |
|
| 3511 | - break; |
|
| 3512 | - case 'export_cats': {
|
|
| 3513 | - // WPML |
|
| 3514 | - $is_wpml = geodir_is_wpml(); |
|
| 3515 | - if ($is_wpml) {
|
|
| 3516 | - global $sitepress; |
|
| 3517 | - $active_lang = ICL_LANGUAGE_CODE; |
|
| 3491 | + if ( !empty($chunk_file_paths) ) {
|
|
| 3492 | + $json['total'] = $posts_count; |
|
| 3493 | + $json['files'] = $chunk_file_paths; |
|
| 3494 | + } else {
|
|
| 3495 | + if ($j > 1) {
|
|
| 3496 | + $json['total'] = $posts_count; |
|
| 3497 | + $json['files'] = array(); |
|
| 3498 | + } else {
|
|
| 3499 | + $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' ); |
|
| 3500 | + } |
|
| 3501 | + } |
|
| 3502 | + } |
|
| 3503 | + // WPML |
|
| 3504 | + if ($is_wpml) {
|
|
| 3505 | + $sitepress->switch_lang($active_lang, true); |
|
| 3506 | + } |
|
| 3507 | + // WPML |
|
| 3508 | + wp_send_json( $json ); |
|
| 3509 | + } |
|
| 3510 | + } |
|
| 3511 | + break; |
|
| 3512 | + case 'export_cats': {
|
|
| 3513 | + // WPML |
|
| 3514 | + $is_wpml = geodir_is_wpml(); |
|
| 3515 | + if ($is_wpml) {
|
|
| 3516 | + global $sitepress; |
|
| 3517 | + $active_lang = ICL_LANGUAGE_CODE; |
|
| 3518 | 3518 | |
| 3519 | - $sitepress->switch_lang('all', true);
|
|
| 3520 | - } |
|
| 3521 | - // WPML |
|
| 3522 | - $file_name = $post_type . 'category_' . date( 'dmyHi' ); |
|
| 3519 | + $sitepress->switch_lang('all', true);
|
|
| 3520 | + } |
|
| 3521 | + // WPML |
|
| 3522 | + $file_name = $post_type . 'category_' . date( 'dmyHi' ); |
|
| 3523 | 3523 | |
| 3524 | - $terms_count = geodir_get_terms_count( $post_type ); |
|
| 3525 | - $file_url_base = geodir_path_import_export() . '/'; |
|
| 3526 | - $file_url = $file_url_base . $file_name . '.csv'; |
|
| 3527 | - $file_path = $csv_file_dir . '/' . $file_name . '.csv'; |
|
| 3528 | - $file_path_temp = $csv_file_dir . '/' . $post_type . 'category_' . $nonce . '.csv'; |
|
| 3524 | + $terms_count = geodir_get_terms_count( $post_type ); |
|
| 3525 | + $file_url_base = geodir_path_import_export() . '/'; |
|
| 3526 | + $file_url = $file_url_base . $file_name . '.csv'; |
|
| 3527 | + $file_path = $csv_file_dir . '/' . $file_name . '.csv'; |
|
| 3528 | + $file_path_temp = $csv_file_dir . '/' . $post_type . 'category_' . $nonce . '.csv'; |
|
| 3529 | 3529 | |
| 3530 | - $chunk_file_paths = array(); |
|
| 3530 | + $chunk_file_paths = array(); |
|
| 3531 | 3531 | |
| 3532 | - if ( isset( $_REQUEST['_st'] ) ) {
|
|
| 3533 | - $line_count = (int)geodir_import_export_line_count( $file_path_temp ); |
|
| 3534 | - $percentage = count( $terms_count ) > 0 && $line_count > 0 ? ceil( $line_count / $terms_count ) * 100 : 0; |
|
| 3535 | - $percentage = min( $percentage, 100 ); |
|
| 3532 | + if ( isset( $_REQUEST['_st'] ) ) {
|
|
| 3533 | + $line_count = (int)geodir_import_export_line_count( $file_path_temp ); |
|
| 3534 | + $percentage = count( $terms_count ) > 0 && $line_count > 0 ? ceil( $line_count / $terms_count ) * 100 : 0; |
|
| 3535 | + $percentage = min( $percentage, 100 ); |
|
| 3536 | 3536 | |
| 3537 | - $json['percentage'] = $percentage; |
|
| 3538 | - // WPML |
|
| 3539 | - if ($is_wpml) {
|
|
| 3540 | - $sitepress->switch_lang($active_lang, true); |
|
| 3541 | - } |
|
| 3542 | - // WPML |
|
| 3543 | - wp_send_json( $json ); |
|
| 3544 | - } else {
|
|
| 3545 | - if ( !$terms_count > 0 ) {
|
|
| 3546 | - $json['error'] = __( 'No records to export.', 'geodirectory' ); |
|
| 3547 | - } else {
|
|
| 3548 | - $total_terms = $terms_count; |
|
| 3549 | - if ($chunk_per_page > $terms_count) {
|
|
| 3550 | - $chunk_per_page = $terms_count; |
|
| 3551 | - } |
|
| 3552 | - $chunk_total_pages = ceil( $total_terms / $chunk_per_page ); |
|
| 3537 | + $json['percentage'] = $percentage; |
|
| 3538 | + // WPML |
|
| 3539 | + if ($is_wpml) {
|
|
| 3540 | + $sitepress->switch_lang($active_lang, true); |
|
| 3541 | + } |
|
| 3542 | + // WPML |
|
| 3543 | + wp_send_json( $json ); |
|
| 3544 | + } else {
|
|
| 3545 | + if ( !$terms_count > 0 ) {
|
|
| 3546 | + $json['error'] = __( 'No records to export.', 'geodirectory' ); |
|
| 3547 | + } else {
|
|
| 3548 | + $total_terms = $terms_count; |
|
| 3549 | + if ($chunk_per_page > $terms_count) {
|
|
| 3550 | + $chunk_per_page = $terms_count; |
|
| 3551 | + } |
|
| 3552 | + $chunk_total_pages = ceil( $total_terms / $chunk_per_page ); |
|
| 3553 | 3553 | |
| 3554 | - $j = $chunk_page_no; |
|
| 3555 | - $chunk_save_terms = geodir_imex_get_terms( $post_type, $chunk_per_page, $j ); |
|
| 3554 | + $j = $chunk_page_no; |
|
| 3555 | + $chunk_save_terms = geodir_imex_get_terms( $post_type, $chunk_per_page, $j ); |
|
| 3556 | 3556 | |
| 3557 | - $per_page = 500; |
|
| 3558 | - if ($per_page > $chunk_per_page) {
|
|
| 3559 | - $per_page = $chunk_per_page; |
|
| 3560 | - } |
|
| 3561 | - $total_pages = ceil( $chunk_per_page / $per_page ); |
|
| 3557 | + $per_page = 500; |
|
| 3558 | + if ($per_page > $chunk_per_page) {
|
|
| 3559 | + $per_page = $chunk_per_page; |
|
| 3560 | + } |
|
| 3561 | + $total_pages = ceil( $chunk_per_page / $per_page ); |
|
| 3562 | 3562 | |
| 3563 | - for ( $i = 0; $i <= $total_pages; $i++ ) {
|
|
| 3564 | - $save_terms = array_slice( $chunk_save_terms , ( $i * $per_page ), $per_page ); |
|
| 3563 | + for ( $i = 0; $i <= $total_pages; $i++ ) {
|
|
| 3564 | + $save_terms = array_slice( $chunk_save_terms , ( $i * $per_page ), $per_page ); |
|
| 3565 | 3565 | |
| 3566 | - $clear = $i == 0 ? true : false; |
|
| 3567 | - geodir_save_csv_data( $file_path_temp, $save_terms, $clear ); |
|
| 3568 | - } |
|
| 3566 | + $clear = $i == 0 ? true : false; |
|
| 3567 | + geodir_save_csv_data( $file_path_temp, $save_terms, $clear ); |
|
| 3568 | + } |
|
| 3569 | 3569 | |
| 3570 | - if ( $wp_filesystem->exists( $file_path_temp ) ) {
|
|
| 3571 | - $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : ''; |
|
| 3572 | - $chunk_file_name = $file_name . $chunk_page_no . '.csv'; |
|
| 3573 | - $file_path = $csv_file_dir . '/' . $chunk_file_name; |
|
| 3574 | - $wp_filesystem->move( $file_path_temp, $file_path, true ); |
|
| 3570 | + if ( $wp_filesystem->exists( $file_path_temp ) ) {
|
|
| 3571 | + $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : ''; |
|
| 3572 | + $chunk_file_name = $file_name . $chunk_page_no . '.csv'; |
|
| 3573 | + $file_path = $csv_file_dir . '/' . $chunk_file_name; |
|
| 3574 | + $wp_filesystem->move( $file_path_temp, $file_path, true ); |
|
| 3575 | 3575 | |
| 3576 | - $file_url = $file_url_base . $chunk_file_name; |
|
| 3577 | - $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
| 3578 | - } |
|
| 3576 | + $file_url = $file_url_base . $chunk_file_name; |
|
| 3577 | + $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
| 3578 | + } |
|
| 3579 | 3579 | |
| 3580 | - if ( !empty($chunk_file_paths) ) {
|
|
| 3581 | - $json['total'] = $terms_count; |
|
| 3582 | - $json['files'] = $chunk_file_paths; |
|
| 3583 | - } else {
|
|
| 3584 | - $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' ); |
|
| 3585 | - } |
|
| 3586 | - } |
|
| 3587 | - // WPML |
|
| 3588 | - if ($is_wpml) {
|
|
| 3589 | - $sitepress->switch_lang($active_lang, true); |
|
| 3590 | - } |
|
| 3591 | - // WPML |
|
| 3592 | - wp_send_json( $json ); |
|
| 3593 | - } |
|
| 3594 | - } |
|
| 3595 | - break; |
|
| 3596 | - case 'export_locations': {
|
|
| 3597 | - $file_url_base = geodir_path_import_export() . '/'; |
|
| 3598 | - $file_name = 'gd_locations_' . date( 'dmyHi' ); |
|
| 3599 | - $file_url = $file_url_base . $file_name . '.csv'; |
|
| 3600 | - $file_path = $csv_file_dir . '/' . $file_name . '.csv'; |
|
| 3601 | - $file_path_temp = $csv_file_dir . '/gd_locations_' . $nonce . '.csv'; |
|
| 3580 | + if ( !empty($chunk_file_paths) ) {
|
|
| 3581 | + $json['total'] = $terms_count; |
|
| 3582 | + $json['files'] = $chunk_file_paths; |
|
| 3583 | + } else {
|
|
| 3584 | + $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' ); |
|
| 3585 | + } |
|
| 3586 | + } |
|
| 3587 | + // WPML |
|
| 3588 | + if ($is_wpml) {
|
|
| 3589 | + $sitepress->switch_lang($active_lang, true); |
|
| 3590 | + } |
|
| 3591 | + // WPML |
|
| 3592 | + wp_send_json( $json ); |
|
| 3593 | + } |
|
| 3594 | + } |
|
| 3595 | + break; |
|
| 3596 | + case 'export_locations': {
|
|
| 3597 | + $file_url_base = geodir_path_import_export() . '/'; |
|
| 3598 | + $file_name = 'gd_locations_' . date( 'dmyHi' ); |
|
| 3599 | + $file_url = $file_url_base . $file_name . '.csv'; |
|
| 3600 | + $file_path = $csv_file_dir . '/' . $file_name . '.csv'; |
|
| 3601 | + $file_path_temp = $csv_file_dir . '/gd_locations_' . $nonce . '.csv'; |
|
| 3602 | 3602 | |
| 3603 | - $items_count = (int)geodir_location_imex_count_locations(); |
|
| 3603 | + $items_count = (int)geodir_location_imex_count_locations(); |
|
| 3604 | 3604 | |
| 3605 | - if ( isset( $_REQUEST['_st'] ) ) {
|
|
| 3606 | - $line_count = (int)geodir_import_export_line_count( $file_path_temp ); |
|
| 3607 | - $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0; |
|
| 3608 | - $percentage = min( $percentage, 100 ); |
|
| 3605 | + if ( isset( $_REQUEST['_st'] ) ) {
|
|
| 3606 | + $line_count = (int)geodir_import_export_line_count( $file_path_temp ); |
|
| 3607 | + $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0; |
|
| 3608 | + $percentage = min( $percentage, 100 ); |
|
| 3609 | 3609 | |
| 3610 | - $json['percentage'] = $percentage; |
|
| 3611 | - wp_send_json( $json ); |
|
| 3612 | - } else {
|
|
| 3613 | - $chunk_file_paths = array(); |
|
| 3610 | + $json['percentage'] = $percentage; |
|
| 3611 | + wp_send_json( $json ); |
|
| 3612 | + } else {
|
|
| 3613 | + $chunk_file_paths = array(); |
|
| 3614 | 3614 | |
| 3615 | - if ( !$items_count > 0 ) {
|
|
| 3616 | - $json['error'] = __( 'No records to export.', 'geodirectory' ); |
|
| 3617 | - } else {
|
|
| 3618 | - $chunk_per_page = min( $chunk_per_page, $items_count ); |
|
| 3619 | - $chunk_total_pages = ceil( $items_count / $chunk_per_page ); |
|
| 3615 | + if ( !$items_count > 0 ) {
|
|
| 3616 | + $json['error'] = __( 'No records to export.', 'geodirectory' ); |
|
| 3617 | + } else {
|
|
| 3618 | + $chunk_per_page = min( $chunk_per_page, $items_count ); |
|
| 3619 | + $chunk_total_pages = ceil( $items_count / $chunk_per_page ); |
|
| 3620 | 3620 | |
| 3621 | - $j = $chunk_page_no; |
|
| 3622 | - $chunk_save_items = geodir_location_imex_locations_data( $chunk_per_page, $j ); |
|
| 3621 | + $j = $chunk_page_no; |
|
| 3622 | + $chunk_save_items = geodir_location_imex_locations_data( $chunk_per_page, $j ); |
|
| 3623 | 3623 | |
| 3624 | - $per_page = 500; |
|
| 3625 | - $per_page = min( $per_page, $chunk_per_page ); |
|
| 3626 | - $total_pages = ceil( $chunk_per_page / $per_page ); |
|
| 3624 | + $per_page = 500; |
|
| 3625 | + $per_page = min( $per_page, $chunk_per_page ); |
|
| 3626 | + $total_pages = ceil( $chunk_per_page / $per_page ); |
|
| 3627 | 3627 | |
| 3628 | - for ( $i = 0; $i <= $total_pages; $i++ ) {
|
|
| 3629 | - $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page ); |
|
| 3628 | + for ( $i = 0; $i <= $total_pages; $i++ ) {
|
|
| 3629 | + $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page ); |
|
| 3630 | 3630 | |
| 3631 | - $clear = $i == 0 ? true : false; |
|
| 3632 | - geodir_save_csv_data( $file_path_temp, $save_items, $clear ); |
|
| 3633 | - } |
|
| 3631 | + $clear = $i == 0 ? true : false; |
|
| 3632 | + geodir_save_csv_data( $file_path_temp, $save_items, $clear ); |
|
| 3633 | + } |
|
| 3634 | 3634 | |
| 3635 | - if ( $wp_filesystem->exists( $file_path_temp ) ) {
|
|
| 3636 | - $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : ''; |
|
| 3637 | - $chunk_file_name = $file_name . $chunk_page_no . '.csv'; |
|
| 3638 | - $file_path = $csv_file_dir . '/' . $chunk_file_name; |
|
| 3639 | - $wp_filesystem->move( $file_path_temp, $file_path, true ); |
|
| 3635 | + if ( $wp_filesystem->exists( $file_path_temp ) ) {
|
|
| 3636 | + $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : ''; |
|
| 3637 | + $chunk_file_name = $file_name . $chunk_page_no . '.csv'; |
|
| 3638 | + $file_path = $csv_file_dir . '/' . $chunk_file_name; |
|
| 3639 | + $wp_filesystem->move( $file_path_temp, $file_path, true ); |
|
| 3640 | 3640 | |
| 3641 | - $file_url = $file_url_base . $chunk_file_name; |
|
| 3642 | - $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
| 3643 | - } |
|
| 3641 | + $file_url = $file_url_base . $chunk_file_name; |
|
| 3642 | + $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
| 3643 | + } |
|
| 3644 | 3644 | |
| 3645 | - if ( !empty($chunk_file_paths) ) {
|
|
| 3646 | - $json['total'] = $items_count; |
|
| 3647 | - $json['files'] = $chunk_file_paths; |
|
| 3648 | - } else {
|
|
| 3649 | - $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' ); |
|
| 3650 | - } |
|
| 3651 | - } |
|
| 3652 | - wp_send_json( $json ); |
|
| 3653 | - } |
|
| 3654 | - } |
|
| 3655 | - break; |
|
| 3656 | - case 'export_hoods': {
|
|
| 3657 | - $file_url_base = geodir_path_import_export() . '/'; |
|
| 3658 | - $file_name = 'gd_neighbourhoods_' . date( 'dmyHi' ); |
|
| 3659 | - $file_url = $file_url_base . $file_name . '.csv'; |
|
| 3660 | - $file_path = $csv_file_dir . '/' . $file_name . '.csv'; |
|
| 3661 | - $file_path_temp = $csv_file_dir . '/gd_neighbourhoods_' . $nonce . '.csv'; |
|
| 3645 | + if ( !empty($chunk_file_paths) ) {
|
|
| 3646 | + $json['total'] = $items_count; |
|
| 3647 | + $json['files'] = $chunk_file_paths; |
|
| 3648 | + } else {
|
|
| 3649 | + $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' ); |
|
| 3650 | + } |
|
| 3651 | + } |
|
| 3652 | + wp_send_json( $json ); |
|
| 3653 | + } |
|
| 3654 | + } |
|
| 3655 | + break; |
|
| 3656 | + case 'export_hoods': {
|
|
| 3657 | + $file_url_base = geodir_path_import_export() . '/'; |
|
| 3658 | + $file_name = 'gd_neighbourhoods_' . date( 'dmyHi' ); |
|
| 3659 | + $file_url = $file_url_base . $file_name . '.csv'; |
|
| 3660 | + $file_path = $csv_file_dir . '/' . $file_name . '.csv'; |
|
| 3661 | + $file_path_temp = $csv_file_dir . '/gd_neighbourhoods_' . $nonce . '.csv'; |
|
| 3662 | 3662 | |
| 3663 | - $items_count = (int)geodir_location_imex_count_neighbourhoods(); |
|
| 3663 | + $items_count = (int)geodir_location_imex_count_neighbourhoods(); |
|
| 3664 | 3664 | |
| 3665 | - if ( isset( $_REQUEST['_st'] ) ) {
|
|
| 3666 | - $line_count = (int)geodir_import_export_line_count( $file_path_temp ); |
|
| 3667 | - $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0; |
|
| 3668 | - $percentage = min( $percentage, 100 ); |
|
| 3665 | + if ( isset( $_REQUEST['_st'] ) ) {
|
|
| 3666 | + $line_count = (int)geodir_import_export_line_count( $file_path_temp ); |
|
| 3667 | + $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0; |
|
| 3668 | + $percentage = min( $percentage, 100 ); |
|
| 3669 | 3669 | |
| 3670 | - $json['percentage'] = $percentage; |
|
| 3671 | - wp_send_json( $json ); |
|
| 3672 | - } else {
|
|
| 3673 | - $chunk_file_paths = array(); |
|
| 3670 | + $json['percentage'] = $percentage; |
|
| 3671 | + wp_send_json( $json ); |
|
| 3672 | + } else {
|
|
| 3673 | + $chunk_file_paths = array(); |
|
| 3674 | 3674 | |
| 3675 | - if ( !$items_count > 0 ) {
|
|
| 3676 | - $json['error'] = __( 'No records to export.', 'geodirectory' ); |
|
| 3677 | - } else {
|
|
| 3678 | - $chunk_per_page = min( $chunk_per_page, $items_count ); |
|
| 3679 | - $chunk_total_pages = ceil( $items_count / $chunk_per_page ); |
|
| 3675 | + if ( !$items_count > 0 ) {
|
|
| 3676 | + $json['error'] = __( 'No records to export.', 'geodirectory' ); |
|
| 3677 | + } else {
|
|
| 3678 | + $chunk_per_page = min( $chunk_per_page, $items_count ); |
|
| 3679 | + $chunk_total_pages = ceil( $items_count / $chunk_per_page ); |
|
| 3680 | 3680 | |
| 3681 | - $j = $chunk_page_no; |
|
| 3682 | - $chunk_save_items = geodir_location_imex_neighbourhoods_data( $chunk_per_page, $j ); |
|
| 3681 | + $j = $chunk_page_no; |
|
| 3682 | + $chunk_save_items = geodir_location_imex_neighbourhoods_data( $chunk_per_page, $j ); |
|
| 3683 | 3683 | |
| 3684 | - $per_page = 500; |
|
| 3685 | - $per_page = min( $per_page, $chunk_per_page ); |
|
| 3686 | - $total_pages = ceil( $chunk_per_page / $per_page ); |
|
| 3684 | + $per_page = 500; |
|
| 3685 | + $per_page = min( $per_page, $chunk_per_page ); |
|
| 3686 | + $total_pages = ceil( $chunk_per_page / $per_page ); |
|
| 3687 | 3687 | |
| 3688 | - for ( $i = 0; $i <= $total_pages; $i++ ) {
|
|
| 3689 | - $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page ); |
|
| 3688 | + for ( $i = 0; $i <= $total_pages; $i++ ) {
|
|
| 3689 | + $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page ); |
|
| 3690 | 3690 | |
| 3691 | - $clear = $i == 0 ? true : false; |
|
| 3692 | - geodir_save_csv_data( $file_path_temp, $save_items, $clear ); |
|
| 3693 | - } |
|
| 3691 | + $clear = $i == 0 ? true : false; |
|
| 3692 | + geodir_save_csv_data( $file_path_temp, $save_items, $clear ); |
|
| 3693 | + } |
|
| 3694 | 3694 | |
| 3695 | - if ( $wp_filesystem->exists( $file_path_temp ) ) {
|
|
| 3696 | - $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : ''; |
|
| 3697 | - $chunk_file_name = $file_name . $chunk_page_no . '.csv'; |
|
| 3698 | - $file_path = $csv_file_dir . '/' . $chunk_file_name; |
|
| 3699 | - $wp_filesystem->move( $file_path_temp, $file_path, true ); |
|
| 3695 | + if ( $wp_filesystem->exists( $file_path_temp ) ) {
|
|
| 3696 | + $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : ''; |
|
| 3697 | + $chunk_file_name = $file_name . $chunk_page_no . '.csv'; |
|
| 3698 | + $file_path = $csv_file_dir . '/' . $chunk_file_name; |
|
| 3699 | + $wp_filesystem->move( $file_path_temp, $file_path, true ); |
|
| 3700 | 3700 | |
| 3701 | - $file_url = $file_url_base . $chunk_file_name; |
|
| 3702 | - $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
| 3703 | - } |
|
| 3701 | + $file_url = $file_url_base . $chunk_file_name; |
|
| 3702 | + $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
| 3703 | + } |
|
| 3704 | 3704 | |
| 3705 | - if ( !empty($chunk_file_paths) ) {
|
|
| 3706 | - $json['total'] = $items_count; |
|
| 3707 | - $json['files'] = $chunk_file_paths; |
|
| 3708 | - } else {
|
|
| 3709 | - $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' ); |
|
| 3710 | - } |
|
| 3711 | - } |
|
| 3712 | - wp_send_json( $json ); |
|
| 3713 | - } |
|
| 3714 | - } |
|
| 3715 | - break; |
|
| 3716 | - case 'prepare_import': |
|
| 3717 | - case 'import_cat': |
|
| 3718 | - case 'import_post': |
|
| 3719 | - case 'import_loc': |
|
| 3720 | - case 'import_hood': {
|
|
| 3721 | - // WPML |
|
| 3722 | - $is_wpml = geodir_is_wpml(); |
|
| 3723 | - if ($is_wpml) {
|
|
| 3724 | - global $sitepress; |
|
| 3725 | - $active_lang = ICL_LANGUAGE_CODE; |
|
| 3726 | - } |
|
| 3727 | - // WPML |
|
| 3705 | + if ( !empty($chunk_file_paths) ) {
|
|
| 3706 | + $json['total'] = $items_count; |
|
| 3707 | + $json['files'] = $chunk_file_paths; |
|
| 3708 | + } else {
|
|
| 3709 | + $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' ); |
|
| 3710 | + } |
|
| 3711 | + } |
|
| 3712 | + wp_send_json( $json ); |
|
| 3713 | + } |
|
| 3714 | + } |
|
| 3715 | + break; |
|
| 3716 | + case 'prepare_import': |
|
| 3717 | + case 'import_cat': |
|
| 3718 | + case 'import_post': |
|
| 3719 | + case 'import_loc': |
|
| 3720 | + case 'import_hood': {
|
|
| 3721 | + // WPML |
|
| 3722 | + $is_wpml = geodir_is_wpml(); |
|
| 3723 | + if ($is_wpml) {
|
|
| 3724 | + global $sitepress; |
|
| 3725 | + $active_lang = ICL_LANGUAGE_CODE; |
|
| 3726 | + } |
|
| 3727 | + // WPML |
|
| 3728 | 3728 | |
| 3729 | - @ini_set( 'auto_detect_line_endings', true ); |
|
| 3729 | + @ini_set( 'auto_detect_line_endings', true ); |
|
| 3730 | 3730 | |
| 3731 | - $uploads = wp_upload_dir(); |
|
| 3732 | - $uploads_dir = $uploads['path']; |
|
| 3733 | - $uploads_subdir = $uploads['subdir']; |
|
| 3731 | + $uploads = wp_upload_dir(); |
|
| 3732 | + $uploads_dir = $uploads['path']; |
|
| 3733 | + $uploads_subdir = $uploads['subdir']; |
|
| 3734 | 3734 | |
| 3735 | - $csv_file = isset( $_POST['_file'] ) ? $_POST['_file'] : NULL; |
|
| 3736 | - $import_choice = isset( $_REQUEST['_ch'] ) ? $_REQUEST['_ch'] : 'skip'; |
|
| 3735 | + $csv_file = isset( $_POST['_file'] ) ? $_POST['_file'] : NULL; |
|
| 3736 | + $import_choice = isset( $_REQUEST['_ch'] ) ? $_REQUEST['_ch'] : 'skip'; |
|
| 3737 | 3737 | |
| 3738 | - $csv_file_arr = explode( '/', $csv_file ); |
|
| 3739 | - $csv_filename = end( $csv_file_arr ); |
|
| 3740 | - $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $csv_filename; |
|
| 3738 | + $csv_file_arr = explode( '/', $csv_file ); |
|
| 3739 | + $csv_filename = end( $csv_file_arr ); |
|
| 3740 | + $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $csv_filename; |
|
| 3741 | 3741 | |
| 3742 | - $json['file'] = $csv_file; |
|
| 3743 | - $json['error'] = __( 'The uploaded file is not a valid csv file. Please try again.', 'geodirectory' ); |
|
| 3744 | - $file = array(); |
|
| 3745 | - |
|
| 3746 | - if ( $csv_file && $wp_filesystem->is_file( $target_path ) && $wp_filesystem->exists( $target_path ) ) {
|
|
| 3747 | - $wp_filetype = wp_check_filetype_and_ext( $target_path, $csv_filename ); |
|
| 3748 | - |
|
| 3749 | - if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
|
|
| 3750 | - $json['error'] = NULL; |
|
| 3751 | - |
|
| 3752 | - $lc_all = setlocale(LC_ALL, 0); // Fix issue of fgetcsv ignores special characters when they are at the beginning of line |
|
| 3753 | - setlocale(LC_ALL, 'en_US.UTF-8'); |
|
| 3754 | - if ( ( $handle = fopen($target_path, "r" ) ) !== FALSE ) {
|
|
| 3755 | - while ( ( $data = fgetcsv( $handle, 100000, "," ) ) !== FALSE ) {
|
|
| 3756 | - if ( !empty( $data ) ) {
|
|
| 3757 | - $file[] = $data; |
|
| 3758 | - } |
|
| 3759 | - } |
|
| 3760 | - fclose($handle); |
|
| 3761 | - } |
|
| 3762 | - setlocale(LC_ALL, $lc_all); |
|
| 3742 | + $json['file'] = $csv_file; |
|
| 3743 | + $json['error'] = __( 'The uploaded file is not a valid csv file. Please try again.', 'geodirectory' ); |
|
| 3744 | + $file = array(); |
|
| 3745 | + |
|
| 3746 | + if ( $csv_file && $wp_filesystem->is_file( $target_path ) && $wp_filesystem->exists( $target_path ) ) {
|
|
| 3747 | + $wp_filetype = wp_check_filetype_and_ext( $target_path, $csv_filename ); |
|
| 3748 | + |
|
| 3749 | + if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
|
|
| 3750 | + $json['error'] = NULL; |
|
| 3751 | + |
|
| 3752 | + $lc_all = setlocale(LC_ALL, 0); // Fix issue of fgetcsv ignores special characters when they are at the beginning of line |
|
| 3753 | + setlocale(LC_ALL, 'en_US.UTF-8'); |
|
| 3754 | + if ( ( $handle = fopen($target_path, "r" ) ) !== FALSE ) {
|
|
| 3755 | + while ( ( $data = fgetcsv( $handle, 100000, "," ) ) !== FALSE ) {
|
|
| 3756 | + if ( !empty( $data ) ) {
|
|
| 3757 | + $file[] = $data; |
|
| 3758 | + } |
|
| 3759 | + } |
|
| 3760 | + fclose($handle); |
|
| 3761 | + } |
|
| 3762 | + setlocale(LC_ALL, $lc_all); |
|
| 3763 | 3763 | |
| 3764 | - $json['rows'] = (!empty($file) && count($file) > 1) ? count($file) - 1 : 0; |
|
| 3764 | + $json['rows'] = (!empty($file) && count($file) > 1) ? count($file) - 1 : 0; |
|
| 3765 | 3765 | |
| 3766 | - if (!$json['rows'] > 0) {
|
|
| 3767 | - $json['error'] = __('No data found in csv file.', 'geodirectory');
|
|
| 3768 | - } |
|
| 3769 | - } else {
|
|
| 3770 | - wp_send_json( $json ); |
|
| 3771 | - } |
|
| 3772 | - } else {
|
|
| 3773 | - wp_send_json( $json ); |
|
| 3774 | - } |
|
| 3766 | + if (!$json['rows'] > 0) {
|
|
| 3767 | + $json['error'] = __('No data found in csv file.', 'geodirectory');
|
|
| 3768 | + } |
|
| 3769 | + } else {
|
|
| 3770 | + wp_send_json( $json ); |
|
| 3771 | + } |
|
| 3772 | + } else {
|
|
| 3773 | + wp_send_json( $json ); |
|
| 3774 | + } |
|
| 3775 | 3775 | |
| 3776 | - if ( $task == 'prepare_import' || !empty( $json['error'] ) ) {
|
|
| 3777 | - wp_send_json( $json ); |
|
| 3778 | - } |
|
| 3776 | + if ( $task == 'prepare_import' || !empty( $json['error'] ) ) {
|
|
| 3777 | + wp_send_json( $json ); |
|
| 3778 | + } |
|
| 3779 | 3779 | |
| 3780 | - $total = $json['rows']; |
|
| 3781 | - $limit = isset($_POST['limit']) ? (int)$_POST['limit'] : 1; |
|
| 3782 | - $processed = isset($_POST['processed']) ? (int)$_POST['processed'] : 0; |
|
| 3780 | + $total = $json['rows']; |
|
| 3781 | + $limit = isset($_POST['limit']) ? (int)$_POST['limit'] : 1; |
|
| 3782 | + $processed = isset($_POST['processed']) ? (int)$_POST['processed'] : 0; |
|
| 3783 | 3783 | |
| 3784 | - $count = $limit; |
|
| 3784 | + $count = $limit; |
|
| 3785 | 3785 | |
| 3786 | - if ($count < $total) {
|
|
| 3787 | - $count = $processed + $count; |
|
| 3788 | - if ($count > $total) {
|
|
| 3789 | - $count = $total; |
|
| 3790 | - } |
|
| 3791 | - } else {
|
|
| 3792 | - $count = $total; |
|
| 3793 | - } |
|
| 3786 | + if ($count < $total) {
|
|
| 3787 | + $count = $processed + $count; |
|
| 3788 | + if ($count > $total) {
|
|
| 3789 | + $count = $total; |
|
| 3790 | + } |
|
| 3791 | + } else {
|
|
| 3792 | + $count = $total; |
|
| 3793 | + } |
|
| 3794 | 3794 | |
| 3795 | - $created = 0; |
|
| 3796 | - $updated = 0; |
|
| 3797 | - $skipped = 0; |
|
| 3798 | - $invalid = 0; |
|
| 3799 | - $invalid_addr = 0; |
|
| 3800 | - $images = 0; |
|
| 3795 | + $created = 0; |
|
| 3796 | + $updated = 0; |
|
| 3797 | + $skipped = 0; |
|
| 3798 | + $invalid = 0; |
|
| 3799 | + $invalid_addr = 0; |
|
| 3800 | + $images = 0; |
|
| 3801 | 3801 | |
| 3802 | - $gd_post_info = array(); |
|
| 3803 | - $countpost = 0; |
|
| 3802 | + $gd_post_info = array(); |
|
| 3803 | + $countpost = 0; |
|
| 3804 | 3804 | |
| 3805 | - $post_types = geodir_get_posttypes(); |
|
| 3805 | + $post_types = geodir_get_posttypes(); |
|
| 3806 | 3806 | |
| 3807 | - if ( $task == 'import_cat' ) {
|
|
| 3808 | - if (!empty($file)) {
|
|
| 3809 | - $columns = isset($file[0]) ? $file[0] : NULL; |
|
| 3807 | + if ( $task == 'import_cat' ) {
|
|
| 3808 | + if (!empty($file)) {
|
|
| 3809 | + $columns = isset($file[0]) ? $file[0] : NULL; |
|
| 3810 | 3810 | |
| 3811 | - if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
|
|
| 3812 | - $json['error'] = CSV_INVAILD_FILE; |
|
| 3813 | - wp_send_json( $json ); |
|
| 3814 | - exit; |
|
| 3815 | - } |
|
| 3811 | + if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
|
|
| 3812 | + $json['error'] = CSV_INVAILD_FILE; |
|
| 3813 | + wp_send_json( $json ); |
|
| 3814 | + exit; |
|
| 3815 | + } |
|
| 3816 | 3816 | |
| 3817 | - $gd_error_log = __('GD IMPORT CATEGORIES [ROW %d]:', 'geodirectory');
|
|
| 3817 | + $gd_error_log = __('GD IMPORT CATEGORIES [ROW %d]:', 'geodirectory');
|
|
| 3818 | 3818 | |
| 3819 | - for ($i = 1; $i <= $limit; $i++) {
|
|
| 3820 | - $index = $processed + $i; |
|
| 3819 | + for ($i = 1; $i <= $limit; $i++) {
|
|
| 3820 | + $index = $processed + $i; |
|
| 3821 | 3821 | |
| 3822 | - if (isset($file[$index])) {
|
|
| 3823 | - $row = $file[$index]; |
|
| 3824 | - $row = array_map( 'trim', $row ); |
|
| 3825 | - //$row = array_map( 'utf8_encode', $row ); |
|
| 3822 | + if (isset($file[$index])) {
|
|
| 3823 | + $row = $file[$index]; |
|
| 3824 | + $row = array_map( 'trim', $row ); |
|
| 3825 | + //$row = array_map( 'utf8_encode', $row ); |
|
| 3826 | 3826 | |
| 3827 | - $cat_id = ''; |
|
| 3828 | - $cat_name = ''; |
|
| 3829 | - $cat_slug = ''; |
|
| 3830 | - $cat_posttype = ''; |
|
| 3831 | - $cat_parent = ''; |
|
| 3832 | - $cat_description = ''; |
|
| 3833 | - $cat_schema = ''; |
|
| 3834 | - $cat_top_description = ''; |
|
| 3835 | - $cat_image = ''; |
|
| 3836 | - $cat_icon = ''; |
|
| 3837 | - $cat_language = ''; |
|
| 3838 | - $cat_id_original = ''; |
|
| 3827 | + $cat_id = ''; |
|
| 3828 | + $cat_name = ''; |
|
| 3829 | + $cat_slug = ''; |
|
| 3830 | + $cat_posttype = ''; |
|
| 3831 | + $cat_parent = ''; |
|
| 3832 | + $cat_description = ''; |
|
| 3833 | + $cat_schema = ''; |
|
| 3834 | + $cat_top_description = ''; |
|
| 3835 | + $cat_image = ''; |
|
| 3836 | + $cat_icon = ''; |
|
| 3837 | + $cat_language = ''; |
|
| 3838 | + $cat_id_original = ''; |
|
| 3839 | 3839 | |
| 3840 | - $c = 0; |
|
| 3841 | - foreach ($columns as $column ) {
|
|
| 3842 | - if ( $column == 'cat_id' ) {
|
|
| 3843 | - $cat_id = (int)$row[$c]; |
|
| 3844 | - } else if ( $column == 'cat_name' ) {
|
|
| 3845 | - $cat_name = $row[$c]; |
|
| 3846 | - } else if ( $column == 'cat_slug' ) {
|
|
| 3847 | - $cat_slug = $row[$c]; |
|
| 3848 | - } else if ( $column == 'cat_posttype' ) {
|
|
| 3849 | - $cat_posttype = $row[$c]; |
|
| 3850 | - } else if ( $column == 'cat_parent' ) {
|
|
| 3851 | - $cat_parent = trim($row[$c]); |
|
| 3852 | - } else if ( $column == 'cat_schema' && $row[$c] != '' ) {
|
|
| 3853 | - $cat_schema = $row[$c]; |
|
| 3854 | - } else if ( $column == 'cat_description' ) {
|
|
| 3855 | - $cat_description = $row[$c]; |
|
| 3856 | - } else if ( $column == 'cat_top_description' ) {
|
|
| 3857 | - $cat_top_description = $row[$c]; |
|
| 3858 | - } else if ( $column == 'cat_image' ) {
|
|
| 3859 | - $cat_image = $row[$c]; |
|
| 3860 | - } else if ( $column == 'cat_icon' ) {
|
|
| 3861 | - $cat_icon = $row[$c]; |
|
| 3862 | - } |
|
| 3863 | - // WPML |
|
| 3864 | - if ( $is_wpml ) {
|
|
| 3865 | - if ( $column == 'cat_language' ) {
|
|
| 3866 | - $cat_language = geodir_strtolower( trim( $row[$c] ) ); |
|
| 3867 | - } else if ( $column == 'cat_id_original' ) {
|
|
| 3868 | - $cat_id_original = (int)$row[$c]; |
|
| 3869 | - } |
|
| 3870 | - } |
|
| 3871 | - // WPML |
|
| 3872 | - $c++; |
|
| 3873 | - } |
|
| 3840 | + $c = 0; |
|
| 3841 | + foreach ($columns as $column ) {
|
|
| 3842 | + if ( $column == 'cat_id' ) {
|
|
| 3843 | + $cat_id = (int)$row[$c]; |
|
| 3844 | + } else if ( $column == 'cat_name' ) {
|
|
| 3845 | + $cat_name = $row[$c]; |
|
| 3846 | + } else if ( $column == 'cat_slug' ) {
|
|
| 3847 | + $cat_slug = $row[$c]; |
|
| 3848 | + } else if ( $column == 'cat_posttype' ) {
|
|
| 3849 | + $cat_posttype = $row[$c]; |
|
| 3850 | + } else if ( $column == 'cat_parent' ) {
|
|
| 3851 | + $cat_parent = trim($row[$c]); |
|
| 3852 | + } else if ( $column == 'cat_schema' && $row[$c] != '' ) {
|
|
| 3853 | + $cat_schema = $row[$c]; |
|
| 3854 | + } else if ( $column == 'cat_description' ) {
|
|
| 3855 | + $cat_description = $row[$c]; |
|
| 3856 | + } else if ( $column == 'cat_top_description' ) {
|
|
| 3857 | + $cat_top_description = $row[$c]; |
|
| 3858 | + } else if ( $column == 'cat_image' ) {
|
|
| 3859 | + $cat_image = $row[$c]; |
|
| 3860 | + } else if ( $column == 'cat_icon' ) {
|
|
| 3861 | + $cat_icon = $row[$c]; |
|
| 3862 | + } |
|
| 3863 | + // WPML |
|
| 3864 | + if ( $is_wpml ) {
|
|
| 3865 | + if ( $column == 'cat_language' ) {
|
|
| 3866 | + $cat_language = geodir_strtolower( trim( $row[$c] ) ); |
|
| 3867 | + } else if ( $column == 'cat_id_original' ) {
|
|
| 3868 | + $cat_id_original = (int)$row[$c]; |
|
| 3869 | + } |
|
| 3870 | + } |
|
| 3871 | + // WPML |
|
| 3872 | + $c++; |
|
| 3873 | + } |
|
| 3874 | 3874 | |
| 3875 | - if ( $cat_name == '' || !in_array( $cat_posttype, $post_types ) ) {
|
|
| 3876 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) ); |
|
| 3875 | + if ( $cat_name == '' || !in_array( $cat_posttype, $post_types ) ) {
|
|
| 3876 | + geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) ); |
|
| 3877 | 3877 | |
| 3878 | - $invalid++; |
|
| 3879 | - continue; |
|
| 3880 | - } |
|
| 3878 | + $invalid++; |
|
| 3879 | + continue; |
|
| 3880 | + } |
|
| 3881 | 3881 | |
| 3882 | - // WPML |
|
| 3883 | - if ($is_wpml && $cat_language != '') {
|
|
| 3884 | - $sitepress->switch_lang($cat_language, true); |
|
| 3885 | - } |
|
| 3886 | - // WPML |
|
| 3882 | + // WPML |
|
| 3883 | + if ($is_wpml && $cat_language != '') {
|
|
| 3884 | + $sitepress->switch_lang($cat_language, true); |
|
| 3885 | + } |
|
| 3886 | + // WPML |
|
| 3887 | 3887 | |
| 3888 | - $term_data = array(); |
|
| 3889 | - $term_data['name'] = $cat_name; |
|
| 3890 | - $term_data['slug'] = $cat_slug; |
|
| 3891 | - $term_data['description'] = $cat_description; |
|
| 3892 | - $term_data['cat_schema'] = $cat_schema; |
|
| 3893 | - $term_data['top_description'] = $cat_top_description; |
|
| 3894 | - $term_data['image'] = $cat_image != '' ? basename( $cat_image ) : ''; |
|
| 3895 | - $term_data['icon'] = $cat_icon != '' ? basename( $cat_icon ) : ''; |
|
| 3888 | + $term_data = array(); |
|
| 3889 | + $term_data['name'] = $cat_name; |
|
| 3890 | + $term_data['slug'] = $cat_slug; |
|
| 3891 | + $term_data['description'] = $cat_description; |
|
| 3892 | + $term_data['cat_schema'] = $cat_schema; |
|
| 3893 | + $term_data['top_description'] = $cat_top_description; |
|
| 3894 | + $term_data['image'] = $cat_image != '' ? basename( $cat_image ) : ''; |
|
| 3895 | + $term_data['icon'] = $cat_icon != '' ? basename( $cat_icon ) : ''; |
|
| 3896 | 3896 | |
| 3897 | - //$term_data = array_map( 'utf8_encode', $term_data ); |
|
| 3897 | + //$term_data = array_map( 'utf8_encode', $term_data ); |
|
| 3898 | 3898 | |
| 3899 | - $taxonomy = $cat_posttype . 'category'; |
|
| 3899 | + $taxonomy = $cat_posttype . 'category'; |
|
| 3900 | 3900 | |
| 3901 | - $term_data['taxonomy'] = $taxonomy; |
|
| 3901 | + $term_data['taxonomy'] = $taxonomy; |
|
| 3902 | 3902 | |
| 3903 | - $term_parent_id = 0; |
|
| 3904 | - if ($cat_parent != "" || (int)$cat_parent > 0) {
|
|
| 3905 | - $term_parent = ''; |
|
| 3903 | + $term_parent_id = 0; |
|
| 3904 | + if ($cat_parent != "" || (int)$cat_parent > 0) {
|
|
| 3905 | + $term_parent = ''; |
|
| 3906 | 3906 | |
| 3907 | - if ( $term_parent = get_term_by( 'name', $cat_parent, $taxonomy ) ) {
|
|
| 3908 | - // |
|
| 3909 | - } else if ( $term_parent = get_term_by( 'slug', $cat_parent, $taxonomy ) ) {
|
|
| 3910 | - // |
|
| 3911 | - } else if ( $term_parent = get_term_by( 'id', $cat_parent, $taxonomy ) ) {
|
|
| 3912 | - // |
|
| 3913 | - } else {
|
|
| 3914 | - $term_parent_data = array(); |
|
| 3915 | - $term_parent_data['name'] = $cat_parent; |
|
| 3916 | - //$term_parent_data = array_map( 'utf8_encode', $term_parent_data ); |
|
| 3917 | - $term_parent_data['taxonomy'] = $taxonomy; |
|
| 3907 | + if ( $term_parent = get_term_by( 'name', $cat_parent, $taxonomy ) ) {
|
|
| 3908 | + // |
|
| 3909 | + } else if ( $term_parent = get_term_by( 'slug', $cat_parent, $taxonomy ) ) {
|
|
| 3910 | + // |
|
| 3911 | + } else if ( $term_parent = get_term_by( 'id', $cat_parent, $taxonomy ) ) {
|
|
| 3912 | + // |
|
| 3913 | + } else {
|
|
| 3914 | + $term_parent_data = array(); |
|
| 3915 | + $term_parent_data['name'] = $cat_parent; |
|
| 3916 | + //$term_parent_data = array_map( 'utf8_encode', $term_parent_data ); |
|
| 3917 | + $term_parent_data['taxonomy'] = $taxonomy; |
|
| 3918 | 3918 | |
| 3919 | - $term_parent_id = (int)geodir_imex_insert_term( $taxonomy, $term_parent_data ); |
|
| 3920 | - } |
|
| 3919 | + $term_parent_id = (int)geodir_imex_insert_term( $taxonomy, $term_parent_data ); |
|
| 3920 | + } |
|
| 3921 | 3921 | |
| 3922 | - if ( !empty( $term_parent ) && !is_wp_error( $term_parent ) ) {
|
|
| 3923 | - $term_parent_id = (int)$term_parent->term_id; |
|
| 3924 | - } |
|
| 3925 | - } |
|
| 3926 | - $term_data['parent'] = (int)$term_parent_id; |
|
| 3922 | + if ( !empty( $term_parent ) && !is_wp_error( $term_parent ) ) {
|
|
| 3923 | + $term_parent_id = (int)$term_parent->term_id; |
|
| 3924 | + } |
|
| 3925 | + } |
|
| 3926 | + $term_data['parent'] = (int)$term_parent_id; |
|
| 3927 | 3927 | |
| 3928 | - $term_id = NULL; |
|
| 3929 | - if ( $import_choice == 'update' ) {
|
|
| 3930 | - if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
|
|
| 3931 | - $term_data['term_id'] = $term['term_id']; |
|
| 3928 | + $term_id = NULL; |
|
| 3929 | + if ( $import_choice == 'update' ) {
|
|
| 3930 | + if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
|
|
| 3931 | + $term_data['term_id'] = $term['term_id']; |
|
| 3932 | 3932 | |
| 3933 | - if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
|
|
| 3934 | - $updated++; |
|
| 3935 | - } else {
|
|
| 3936 | - $invalid++; |
|
| 3937 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) ); |
|
| 3938 | - } |
|
| 3939 | - } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
|
|
| 3940 | - $term_data['term_id'] = $term['term_id']; |
|
| 3933 | + if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
|
|
| 3934 | + $updated++; |
|
| 3935 | + } else {
|
|
| 3936 | + $invalid++; |
|
| 3937 | + geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) ); |
|
| 3938 | + } |
|
| 3939 | + } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
|
|
| 3940 | + $term_data['term_id'] = $term['term_id']; |
|
| 3941 | 3941 | |
| 3942 | - if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
|
|
| 3943 | - $updated++; |
|
| 3944 | - } else {
|
|
| 3945 | - $invalid++; |
|
| 3946 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) ); |
|
| 3947 | - } |
|
| 3948 | - } else {
|
|
| 3949 | - if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
|
|
| 3950 | - $created++; |
|
| 3951 | - } else {
|
|
| 3952 | - $invalid++; |
|
| 3953 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) ); |
|
| 3954 | - } |
|
| 3955 | - } |
|
| 3956 | - } else if ( $import_choice == 'skip' ) {
|
|
| 3957 | - if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
|
|
| 3958 | - $skipped++; |
|
| 3959 | - } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
|
|
| 3960 | - $skipped++; |
|
| 3961 | - } else {
|
|
| 3962 | - if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
|
|
| 3963 | - $created++; |
|
| 3964 | - } else {
|
|
| 3965 | - $invalid++; |
|
| 3966 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) ); |
|
| 3967 | - } |
|
| 3968 | - } |
|
| 3969 | - } else {
|
|
| 3970 | - $invalid++; |
|
| 3971 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) ); |
|
| 3972 | - } |
|
| 3942 | + if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
|
|
| 3943 | + $updated++; |
|
| 3944 | + } else {
|
|
| 3945 | + $invalid++; |
|
| 3946 | + geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) ); |
|
| 3947 | + } |
|
| 3948 | + } else {
|
|
| 3949 | + if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
|
|
| 3950 | + $created++; |
|
| 3951 | + } else {
|
|
| 3952 | + $invalid++; |
|
| 3953 | + geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) ); |
|
| 3954 | + } |
|
| 3955 | + } |
|
| 3956 | + } else if ( $import_choice == 'skip' ) {
|
|
| 3957 | + if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
|
|
| 3958 | + $skipped++; |
|
| 3959 | + } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
|
|
| 3960 | + $skipped++; |
|
| 3961 | + } else {
|
|
| 3962 | + if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
|
|
| 3963 | + $created++; |
|
| 3964 | + } else {
|
|
| 3965 | + $invalid++; |
|
| 3966 | + geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) ); |
|
| 3967 | + } |
|
| 3968 | + } |
|
| 3969 | + } else {
|
|
| 3970 | + $invalid++; |
|
| 3971 | + geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) ); |
|
| 3972 | + } |
|
| 3973 | 3973 | |
| 3974 | - if ( $term_id ) {
|
|
| 3975 | - // WPML |
|
| 3976 | - if ($is_wpml && geodir_wpml_is_taxonomy_translated($taxonomy) && $cat_id_original > 0 && $cat_language != '') {
|
|
| 3977 | - $wpml_element_type = 'tax_' . $taxonomy; |
|
| 3978 | - $source_language = geodir_get_language_for_element( $cat_id_original, $wpml_element_type ); |
|
| 3979 | - $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language(); |
|
| 3980 | - |
|
| 3981 | - $trid = $sitepress->get_element_trid( $cat_id_original, $wpml_element_type ); |
|
| 3974 | + if ( $term_id ) {
|
|
| 3975 | + // WPML |
|
| 3976 | + if ($is_wpml && geodir_wpml_is_taxonomy_translated($taxonomy) && $cat_id_original > 0 && $cat_language != '') {
|
|
| 3977 | + $wpml_element_type = 'tax_' . $taxonomy; |
|
| 3978 | + $source_language = geodir_get_language_for_element( $cat_id_original, $wpml_element_type ); |
|
| 3979 | + $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language(); |
|
| 3980 | + |
|
| 3981 | + $trid = $sitepress->get_element_trid( $cat_id_original, $wpml_element_type ); |
|
| 3982 | 3982 | |
| 3983 | - $sitepress->set_element_language_details( $term_id, $wpml_element_type, $trid, $cat_language, $source_language ); |
|
| 3984 | - } |
|
| 3985 | - // WPML |
|
| 3983 | + $sitepress->set_element_language_details( $term_id, $wpml_element_type, $trid, $cat_language, $source_language ); |
|
| 3984 | + } |
|
| 3985 | + // WPML |
|
| 3986 | 3986 | |
| 3987 | - if ( isset( $term_data['top_description'] ) ) {
|
|
| 3988 | - geodir_update_tax_meta( $term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype ); |
|
| 3989 | - } |
|
| 3987 | + if ( isset( $term_data['top_description'] ) ) {
|
|
| 3988 | + geodir_update_tax_meta( $term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype ); |
|
| 3989 | + } |
|
| 3990 | 3990 | |
| 3991 | - if ( isset( $term_data['cat_schema'] ) ) {
|
|
| 3992 | - geodir_update_tax_meta( $term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype ); |
|
| 3993 | - } |
|
| 3991 | + if ( isset( $term_data['cat_schema'] ) ) {
|
|
| 3992 | + geodir_update_tax_meta( $term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype ); |
|
| 3993 | + } |
|
| 3994 | 3994 | |
| 3995 | - $attachment = false; |
|
| 3996 | - if ( isset( $term_data['image'] ) && $term_data['image'] != '' ) {
|
|
| 3997 | - $cat_image = geodir_get_default_catimage( $term_id, $cat_posttype ); |
|
| 3998 | - $cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : ''; |
|
| 3995 | + $attachment = false; |
|
| 3996 | + if ( isset( $term_data['image'] ) && $term_data['image'] != '' ) {
|
|
| 3997 | + $cat_image = geodir_get_default_catimage( $term_id, $cat_posttype ); |
|
| 3998 | + $cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : ''; |
|
| 3999 | 3999 | |
| 4000 | - if ( basename($cat_image) != $term_data['image'] ) {
|
|
| 4001 | - $attachment = true; |
|
| 4002 | - geodir_update_tax_meta( $term_id, 'ct_cat_default_img', array( 'id' => 'image', 'src' => $uploads['url'] . '/' . $term_data['image'] ), $cat_posttype ); |
|
| 4003 | - } |
|
| 4004 | - } |
|
| 4000 | + if ( basename($cat_image) != $term_data['image'] ) {
|
|
| 4001 | + $attachment = true; |
|
| 4002 | + geodir_update_tax_meta( $term_id, 'ct_cat_default_img', array( 'id' => 'image', 'src' => $uploads['url'] . '/' . $term_data['image'] ), $cat_posttype ); |
|
| 4003 | + } |
|
| 4004 | + } |
|
| 4005 | 4005 | |
| 4006 | - if ( isset( $term_data['icon'] ) && $term_data['icon'] != '' ) {
|
|
| 4007 | - $cat_icon = geodir_get_tax_meta( $term_id, 'ct_cat_icon', false, $cat_posttype ); |
|
| 4008 | - $cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : ''; |
|
| 4009 | - |
|
| 4010 | - if ( basename($cat_icon) != $term_data['icon'] ) {
|
|
| 4011 | - $attachment = true; |
|
| 4012 | - geodir_update_tax_meta( $term_id, 'ct_cat_icon', array( 'id' => 'icon', 'src' => $uploads['url'] . '/' . $term_data['icon'] ), $cat_posttype ); |
|
| 4013 | - } |
|
| 4014 | - } |
|
| 4006 | + if ( isset( $term_data['icon'] ) && $term_data['icon'] != '' ) {
|
|
| 4007 | + $cat_icon = geodir_get_tax_meta( $term_id, 'ct_cat_icon', false, $cat_posttype ); |
|
| 4008 | + $cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : ''; |
|
| 4009 | + |
|
| 4010 | + if ( basename($cat_icon) != $term_data['icon'] ) {
|
|
| 4011 | + $attachment = true; |
|
| 4012 | + geodir_update_tax_meta( $term_id, 'ct_cat_icon', array( 'id' => 'icon', 'src' => $uploads['url'] . '/' . $term_data['icon'] ), $cat_posttype ); |
|
| 4013 | + } |
|
| 4014 | + } |
|
| 4015 | 4015 | |
| 4016 | - if ( $attachment ) {
|
|
| 4017 | - $images++; |
|
| 4018 | - } |
|
| 4019 | - } |
|
| 4016 | + if ( $attachment ) {
|
|
| 4017 | + $images++; |
|
| 4018 | + } |
|
| 4019 | + } |
|
| 4020 | 4020 | |
| 4021 | - // WPML |
|
| 4022 | - if ($is_wpml && $cat_language != '') {
|
|
| 4023 | - $sitepress->switch_lang($active_lang, true); |
|
| 4024 | - } |
|
| 4025 | - // WPML |
|
| 4026 | - } |
|
| 4027 | - } |
|
| 4028 | - } |
|
| 4021 | + // WPML |
|
| 4022 | + if ($is_wpml && $cat_language != '') {
|
|
| 4023 | + $sitepress->switch_lang($active_lang, true); |
|
| 4024 | + } |
|
| 4025 | + // WPML |
|
| 4026 | + } |
|
| 4027 | + } |
|
| 4028 | + } |
|
| 4029 | 4029 | |
| 4030 | - $json = array(); |
|
| 4031 | - $json['processed'] = $limit; |
|
| 4032 | - $json['created'] = $created; |
|
| 4033 | - $json['updated'] = $updated; |
|
| 4034 | - $json['skipped'] = $skipped; |
|
| 4035 | - $json['invalid'] = $invalid; |
|
| 4036 | - $json['images'] = $images; |
|
| 4030 | + $json = array(); |
|
| 4031 | + $json['processed'] = $limit; |
|
| 4032 | + $json['created'] = $created; |
|
| 4033 | + $json['updated'] = $updated; |
|
| 4034 | + $json['skipped'] = $skipped; |
|
| 4035 | + $json['invalid'] = $invalid; |
|
| 4036 | + $json['images'] = $images; |
|
| 4037 | 4037 | |
| 4038 | - wp_send_json( $json ); |
|
| 4039 | - exit; |
|
| 4040 | - } else if ( $task == 'import_post' ) {
|
|
| 4041 | - $xtimings['###1'] = microtime(true)-$xstart; |
|
| 4042 | - //run some stuff to make the import quicker |
|
| 4043 | - wp_defer_term_counting( true ); |
|
| 4044 | - wp_defer_comment_counting( true ); |
|
| 4045 | - $wpdb->query( 'SET autocommit = 0;' ); |
|
| 4038 | + wp_send_json( $json ); |
|
| 4039 | + exit; |
|
| 4040 | + } else if ( $task == 'import_post' ) {
|
|
| 4041 | + $xtimings['###1'] = microtime(true)-$xstart; |
|
| 4042 | + //run some stuff to make the import quicker |
|
| 4043 | + wp_defer_term_counting( true ); |
|
| 4044 | + wp_defer_comment_counting( true ); |
|
| 4045 | + $wpdb->query( 'SET autocommit = 0;' ); |
|
| 4046 | 4046 | // |
| 4047 | 4047 | // remove_all_actions('publish_post');
|
| 4048 | 4048 | // remove_all_actions('transition_post_status');
|
| 4049 | 4049 | // remove_all_actions('publish_future_post');
|
| 4050 | 4050 | |
| 4051 | - if (!empty($file)) {
|
|
| 4052 | - $is_claim_active = is_plugin_active( 'geodir_claim_listing/geodir_claim_listing.php' ) && get_option('geodir_claim_enable') === 'yes' ? true : false;
|
|
| 4053 | - $wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses. |
|
| 4054 | - $default_status = 'publish'; |
|
| 4055 | - $current_date = date_i18n( 'Y-m-d', time() ); |
|
| 4051 | + if (!empty($file)) {
|
|
| 4052 | + $is_claim_active = is_plugin_active( 'geodir_claim_listing/geodir_claim_listing.php' ) && get_option('geodir_claim_enable') === 'yes' ? true : false;
|
|
| 4053 | + $wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses. |
|
| 4054 | + $default_status = 'publish'; |
|
| 4055 | + $current_date = date_i18n( 'Y-m-d', time() ); |
|
| 4056 | 4056 | |
| 4057 | - $columns = isset($file[0]) ? $file[0] : NULL; |
|
| 4057 | + $columns = isset($file[0]) ? $file[0] : NULL; |
|
| 4058 | 4058 | |
| 4059 | - if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
|
|
| 4060 | - $json['error'] = CSV_INVAILD_FILE; |
|
| 4061 | - wp_send_json( $json ); |
|
| 4062 | - exit; |
|
| 4063 | - } |
|
| 4064 | - $xtimings['###2'] = microtime(true)-$xstart; |
|
| 4065 | - $gd_error_log = __('GD IMPORT LISTINGS [ROW %d]:', 'geodirectory');
|
|
| 4066 | - $wp_chars_error = __( '(check & remove if any invalid characters used in data)', 'geodirectory' ); |
|
| 4067 | - $processed_actual = 0; |
|
| 4068 | - for ($i = 1; $i <= $limit; $i++) {
|
|
| 4069 | - $index = $processed + $i; |
|
| 4070 | - $gd_post = array(); |
|
| 4059 | + if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
|
|
| 4060 | + $json['error'] = CSV_INVAILD_FILE; |
|
| 4061 | + wp_send_json( $json ); |
|
| 4062 | + exit; |
|
| 4063 | + } |
|
| 4064 | + $xtimings['###2'] = microtime(true)-$xstart; |
|
| 4065 | + $gd_error_log = __('GD IMPORT LISTINGS [ROW %d]:', 'geodirectory');
|
|
| 4066 | + $wp_chars_error = __( '(check & remove if any invalid characters used in data)', 'geodirectory' ); |
|
| 4067 | + $processed_actual = 0; |
|
| 4068 | + for ($i = 1; $i <= $limit; $i++) {
|
|
| 4069 | + $index = $processed + $i; |
|
| 4070 | + $gd_post = array(); |
|
| 4071 | 4071 | |
| 4072 | - if (isset($file[$index])) {
|
|
| 4073 | - $processed_actual++; |
|
| 4074 | - $row = $file[$index]; |
|
| 4075 | - $row = array_map( 'trim', $row ); |
|
| 4076 | - //$row = array_map( 'utf8_encode', $row ); |
|
| 4077 | - $row = array_map( 'addslashes_gpc', $row ); |
|
| 4072 | + if (isset($file[$index])) {
|
|
| 4073 | + $processed_actual++; |
|
| 4074 | + $row = $file[$index]; |
|
| 4075 | + $row = array_map( 'trim', $row ); |
|
| 4076 | + //$row = array_map( 'utf8_encode', $row ); |
|
| 4077 | + $row = array_map( 'addslashes_gpc', $row ); |
|
| 4078 | 4078 | |
| 4079 | - $post_id = ''; |
|
| 4080 | - $post_title = ''; |
|
| 4081 | - $post_date = ''; |
|
| 4082 | - $post_author = ''; |
|
| 4083 | - $post_content = ''; |
|
| 4084 | - $post_category_arr = array(); |
|
| 4085 | - $default_category = ''; |
|
| 4086 | - $post_tags = array(); |
|
| 4087 | - $post_type = ''; |
|
| 4088 | - $post_status = ''; |
|
| 4089 | - $is_featured = 0; |
|
| 4090 | - $geodir_video = ''; |
|
| 4091 | - $post_address = ''; |
|
| 4092 | - $post_city = ''; |
|
| 4093 | - $post_region = ''; |
|
| 4094 | - $post_country = ''; |
|
| 4095 | - $post_zip = ''; |
|
| 4096 | - $post_latitude = ''; |
|
| 4097 | - $post_longitude = ''; |
|
| 4098 | - $post_neighbourhood = ''; |
|
| 4099 | - $neighbourhood_latitude = ''; |
|
| 4100 | - $neighbourhood_longitude = ''; |
|
| 4101 | - $geodir_timing = ''; |
|
| 4102 | - $geodir_contact = ''; |
|
| 4103 | - $geodir_email = ''; |
|
| 4104 | - $geodir_website = ''; |
|
| 4105 | - $geodir_twitter = ''; |
|
| 4106 | - $geodir_facebook = ''; |
|
| 4107 | - $geodir_twitter = ''; |
|
| 4108 | - $geodir_link_business = null; |
|
| 4109 | - $post_images = array(); |
|
| 4079 | + $post_id = ''; |
|
| 4080 | + $post_title = ''; |
|
| 4081 | + $post_date = ''; |
|
| 4082 | + $post_author = ''; |
|
| 4083 | + $post_content = ''; |
|
| 4084 | + $post_category_arr = array(); |
|
| 4085 | + $default_category = ''; |
|
| 4086 | + $post_tags = array(); |
|
| 4087 | + $post_type = ''; |
|
| 4088 | + $post_status = ''; |
|
| 4089 | + $is_featured = 0; |
|
| 4090 | + $geodir_video = ''; |
|
| 4091 | + $post_address = ''; |
|
| 4092 | + $post_city = ''; |
|
| 4093 | + $post_region = ''; |
|
| 4094 | + $post_country = ''; |
|
| 4095 | + $post_zip = ''; |
|
| 4096 | + $post_latitude = ''; |
|
| 4097 | + $post_longitude = ''; |
|
| 4098 | + $post_neighbourhood = ''; |
|
| 4099 | + $neighbourhood_latitude = ''; |
|
| 4100 | + $neighbourhood_longitude = ''; |
|
| 4101 | + $geodir_timing = ''; |
|
| 4102 | + $geodir_contact = ''; |
|
| 4103 | + $geodir_email = ''; |
|
| 4104 | + $geodir_website = ''; |
|
| 4105 | + $geodir_twitter = ''; |
|
| 4106 | + $geodir_facebook = ''; |
|
| 4107 | + $geodir_twitter = ''; |
|
| 4108 | + $geodir_link_business = null; |
|
| 4109 | + $post_images = array(); |
|
| 4110 | 4110 | |
| 4111 | - $expire_date = 'Never'; |
|
| 4111 | + $expire_date = 'Never'; |
|
| 4112 | 4112 | |
| 4113 | - $language = ''; |
|
| 4114 | - $original_post_id = ''; |
|
| 4113 | + $language = ''; |
|
| 4114 | + $original_post_id = ''; |
|
| 4115 | 4115 | |
| 4116 | - $c = 0; |
|
| 4117 | - foreach ($columns as $column ) {
|
|
| 4118 | - $gd_post[$column] = $row[$c]; |
|
| 4116 | + $c = 0; |
|
| 4117 | + foreach ($columns as $column ) {
|
|
| 4118 | + $gd_post[$column] = $row[$c]; |
|
| 4119 | 4119 | |
| 4120 | - if ( $column == 'post_id' ) {
|
|
| 4121 | - $post_id = $row[$c]; |
|
| 4122 | - } else if ( $column == 'post_title' ) {
|
|
| 4123 | - $post_title = sanitize_text_field($row[$c]); |
|
| 4124 | - } else if ( $column == 'post_author' ) {
|
|
| 4125 | - $post_author = $row[$c]; |
|
| 4126 | - } else if ( $column == 'post_date' ) {
|
|
| 4127 | - $post_date = $row[$c]; |
|
| 4128 | - } else if ( $column == 'post_content' ) {
|
|
| 4129 | - $post_content = $row[$c]; |
|
| 4130 | - } else if ( $column == 'post_category' && $row[$c] != '' ) {
|
|
| 4131 | - $post_category_arr = explode( ',', $row[$c] ); |
|
| 4132 | - } else if ( $column == 'default_category' ) {
|
|
| 4133 | - $default_category = wp_kses_normalize_entities($row[$c]); |
|
| 4134 | - } else if ( $column == 'post_tags' && $row[$c] != '' ) {
|
|
| 4135 | - $post_tags = explode( ',', sanitize_text_field($row[$c]) ); |
|
| 4136 | - } else if ( $column == 'post_type' ) {
|
|
| 4137 | - $post_type = $row[$c]; |
|
| 4138 | - } else if ( $column == 'post_status' ) {
|
|
| 4139 | - $post_status = sanitize_key( $row[$c] ); |
|
| 4140 | - } else if ( $column == 'is_featured' ) {
|
|
| 4141 | - $is_featured = (int)$row[$c]; |
|
| 4142 | - } else if ( $column == 'geodir_video' ) {
|
|
| 4143 | - $geodir_video = $row[$c]; |
|
| 4144 | - } else if ( $column == 'post_address' ) {
|
|
| 4145 | - $post_address = sanitize_text_field($row[$c]); |
|
| 4146 | - } else if ( $column == 'post_city' ) {
|
|
| 4147 | - $post_city = sanitize_text_field($row[$c]); |
|
| 4148 | - } else if ( $column == 'post_region' ) {
|
|
| 4149 | - $post_region = sanitize_text_field($row[$c]); |
|
| 4150 | - } else if ( $column == 'post_country' ) {
|
|
| 4151 | - $post_country = sanitize_text_field($row[$c]); |
|
| 4152 | - } else if ( $column == 'post_zip' ) {
|
|
| 4153 | - $post_zip = sanitize_text_field($row[$c]); |
|
| 4154 | - } else if ( $column == 'post_latitude' ) {
|
|
| 4155 | - $post_latitude = sanitize_text_field($row[$c]); |
|
| 4156 | - } else if ( $column == 'post_longitude' ) {
|
|
| 4157 | - $post_longitude = sanitize_text_field($row[$c]); |
|
| 4158 | - } else if ( $column == 'post_neighbourhood' ) {
|
|
| 4159 | - $post_neighbourhood = sanitize_text_field($row[$c]); |
|
| 4160 | - unset($gd_post[$column]); |
|
| 4161 | - } else if ( $column == 'neighbourhood_latitude' ) {
|
|
| 4162 | - $neighbourhood_latitude = sanitize_text_field($row[$c]); |
|
| 4163 | - } else if ( $column == 'neighbourhood_longitude' ) {
|
|
| 4164 | - $neighbourhood_longitude = sanitize_text_field($row[$c]); |
|
| 4165 | - } else if ( $column == 'geodir_timing' ) {
|
|
| 4166 | - $geodir_timing = sanitize_text_field($row[$c]); |
|
| 4167 | - } else if ( $column == 'geodir_contact' ) {
|
|
| 4168 | - $geodir_contact = sanitize_text_field($row[$c]); |
|
| 4169 | - } else if ( $column == 'geodir_email' ) {
|
|
| 4170 | - $geodir_email = sanitize_email($row[$c]); |
|
| 4171 | - } else if ( $column == 'geodir_website' ) {
|
|
| 4172 | - $geodir_website = sanitize_text_field($row[$c]); |
|
| 4173 | - } else if ( $column == 'geodir_twitter' ) {
|
|
| 4174 | - $geodir_twitter = sanitize_text_field($row[$c]); |
|
| 4175 | - } else if ( $column == 'geodir_facebook' ) {
|
|
| 4176 | - $geodir_facebook = sanitize_text_field($row[$c]); |
|
| 4177 | - } else if ( $column == 'IMAGE' && !empty( $row[$c] ) && $row[$c] != '' ) {
|
|
| 4178 | - $post_images[] = $row[$c]; |
|
| 4179 | - } else if ( $column == 'alive_days' && (int)$row[$c] > 0 ) {
|
|
| 4180 | - $expire_date = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$row[$c] . ' days' ) ); |
|
| 4181 | - } else if ( $column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never' ) {
|
|
| 4182 | - $row[$c] = str_replace('/', '-', $row[$c]);
|
|
| 4183 | - $expire_date = date_i18n( 'Y-m-d', strtotime( $row[$c] ) ); |
|
| 4184 | - } else if ( strpos( $column, 'linked_' ) === 0 ) {
|
|
| 4185 | - $geodir_link_business = (int)$row[$c]; |
|
| 4186 | - } |
|
| 4187 | - // WPML |
|
| 4188 | - if ($is_wpml) {
|
|
| 4189 | - if ($column == 'language') {
|
|
| 4190 | - $language = geodir_strtolower(trim($row[$c])); |
|
| 4191 | - } else if ($column == 'original_post_id') {
|
|
| 4192 | - $original_post_id = (int)$row[$c]; |
|
| 4193 | - } |
|
| 4194 | - } |
|
| 4195 | - // WPML |
|
| 4196 | - $c++; |
|
| 4197 | - } |
|
| 4198 | - // listing claimed or not |
|
| 4199 | - if ($is_claim_active && isset($gd_post['claimed'])) {
|
|
| 4200 | - $gd_post['claimed'] = (int)$gd_post['claimed'] == 1 ? 1 : 0; |
|
| 4201 | - } |
|
| 4120 | + if ( $column == 'post_id' ) {
|
|
| 4121 | + $post_id = $row[$c]; |
|
| 4122 | + } else if ( $column == 'post_title' ) {
|
|
| 4123 | + $post_title = sanitize_text_field($row[$c]); |
|
| 4124 | + } else if ( $column == 'post_author' ) {
|
|
| 4125 | + $post_author = $row[$c]; |
|
| 4126 | + } else if ( $column == 'post_date' ) {
|
|
| 4127 | + $post_date = $row[$c]; |
|
| 4128 | + } else if ( $column == 'post_content' ) {
|
|
| 4129 | + $post_content = $row[$c]; |
|
| 4130 | + } else if ( $column == 'post_category' && $row[$c] != '' ) {
|
|
| 4131 | + $post_category_arr = explode( ',', $row[$c] ); |
|
| 4132 | + } else if ( $column == 'default_category' ) {
|
|
| 4133 | + $default_category = wp_kses_normalize_entities($row[$c]); |
|
| 4134 | + } else if ( $column == 'post_tags' && $row[$c] != '' ) {
|
|
| 4135 | + $post_tags = explode( ',', sanitize_text_field($row[$c]) ); |
|
| 4136 | + } else if ( $column == 'post_type' ) {
|
|
| 4137 | + $post_type = $row[$c]; |
|
| 4138 | + } else if ( $column == 'post_status' ) {
|
|
| 4139 | + $post_status = sanitize_key( $row[$c] ); |
|
| 4140 | + } else if ( $column == 'is_featured' ) {
|
|
| 4141 | + $is_featured = (int)$row[$c]; |
|
| 4142 | + } else if ( $column == 'geodir_video' ) {
|
|
| 4143 | + $geodir_video = $row[$c]; |
|
| 4144 | + } else if ( $column == 'post_address' ) {
|
|
| 4145 | + $post_address = sanitize_text_field($row[$c]); |
|
| 4146 | + } else if ( $column == 'post_city' ) {
|
|
| 4147 | + $post_city = sanitize_text_field($row[$c]); |
|
| 4148 | + } else if ( $column == 'post_region' ) {
|
|
| 4149 | + $post_region = sanitize_text_field($row[$c]); |
|
| 4150 | + } else if ( $column == 'post_country' ) {
|
|
| 4151 | + $post_country = sanitize_text_field($row[$c]); |
|
| 4152 | + } else if ( $column == 'post_zip' ) {
|
|
| 4153 | + $post_zip = sanitize_text_field($row[$c]); |
|
| 4154 | + } else if ( $column == 'post_latitude' ) {
|
|
| 4155 | + $post_latitude = sanitize_text_field($row[$c]); |
|
| 4156 | + } else if ( $column == 'post_longitude' ) {
|
|
| 4157 | + $post_longitude = sanitize_text_field($row[$c]); |
|
| 4158 | + } else if ( $column == 'post_neighbourhood' ) {
|
|
| 4159 | + $post_neighbourhood = sanitize_text_field($row[$c]); |
|
| 4160 | + unset($gd_post[$column]); |
|
| 4161 | + } else if ( $column == 'neighbourhood_latitude' ) {
|
|
| 4162 | + $neighbourhood_latitude = sanitize_text_field($row[$c]); |
|
| 4163 | + } else if ( $column == 'neighbourhood_longitude' ) {
|
|
| 4164 | + $neighbourhood_longitude = sanitize_text_field($row[$c]); |
|
| 4165 | + } else if ( $column == 'geodir_timing' ) {
|
|
| 4166 | + $geodir_timing = sanitize_text_field($row[$c]); |
|
| 4167 | + } else if ( $column == 'geodir_contact' ) {
|
|
| 4168 | + $geodir_contact = sanitize_text_field($row[$c]); |
|
| 4169 | + } else if ( $column == 'geodir_email' ) {
|
|
| 4170 | + $geodir_email = sanitize_email($row[$c]); |
|
| 4171 | + } else if ( $column == 'geodir_website' ) {
|
|
| 4172 | + $geodir_website = sanitize_text_field($row[$c]); |
|
| 4173 | + } else if ( $column == 'geodir_twitter' ) {
|
|
| 4174 | + $geodir_twitter = sanitize_text_field($row[$c]); |
|
| 4175 | + } else if ( $column == 'geodir_facebook' ) {
|
|
| 4176 | + $geodir_facebook = sanitize_text_field($row[$c]); |
|
| 4177 | + } else if ( $column == 'IMAGE' && !empty( $row[$c] ) && $row[$c] != '' ) {
|
|
| 4178 | + $post_images[] = $row[$c]; |
|
| 4179 | + } else if ( $column == 'alive_days' && (int)$row[$c] > 0 ) {
|
|
| 4180 | + $expire_date = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$row[$c] . ' days' ) ); |
|
| 4181 | + } else if ( $column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never' ) {
|
|
| 4182 | + $row[$c] = str_replace('/', '-', $row[$c]);
|
|
| 4183 | + $expire_date = date_i18n( 'Y-m-d', strtotime( $row[$c] ) ); |
|
| 4184 | + } else if ( strpos( $column, 'linked_' ) === 0 ) {
|
|
| 4185 | + $geodir_link_business = (int)$row[$c]; |
|
| 4186 | + } |
|
| 4187 | + // WPML |
|
| 4188 | + if ($is_wpml) {
|
|
| 4189 | + if ($column == 'language') {
|
|
| 4190 | + $language = geodir_strtolower(trim($row[$c])); |
|
| 4191 | + } else if ($column == 'original_post_id') {
|
|
| 4192 | + $original_post_id = (int)$row[$c]; |
|
| 4193 | + } |
|
| 4194 | + } |
|
| 4195 | + // WPML |
|
| 4196 | + $c++; |
|
| 4197 | + } |
|
| 4198 | + // listing claimed or not |
|
| 4199 | + if ($is_claim_active && isset($gd_post['claimed'])) {
|
|
| 4200 | + $gd_post['claimed'] = (int)$gd_post['claimed'] == 1 ? 1 : 0; |
|
| 4201 | + } |
|
| 4202 | 4202 | |
| 4203 | - // WPML |
|
| 4204 | - if ($is_wpml && $language != '') {
|
|
| 4205 | - $sitepress->switch_lang($language, true); |
|
| 4206 | - } |
|
| 4207 | - // WPML |
|
| 4203 | + // WPML |
|
| 4204 | + if ($is_wpml && $language != '') {
|
|
| 4205 | + $sitepress->switch_lang($language, true); |
|
| 4206 | + } |
|
| 4207 | + // WPML |
|
| 4208 | 4208 | |
| 4209 | - $gd_post['IMAGE'] = $post_images; |
|
| 4209 | + $gd_post['IMAGE'] = $post_images; |
|
| 4210 | 4210 | |
| 4211 | - $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status; |
|
| 4212 | - $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status; |
|
| 4211 | + $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status; |
|
| 4212 | + $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status; |
|
| 4213 | 4213 | |
| 4214 | - $valid = true; |
|
| 4214 | + $valid = true; |
|
| 4215 | 4215 | |
| 4216 | - if ( $post_title == '' || !in_array( $post_type, $post_types ) ) {
|
|
| 4217 | - $invalid++; |
|
| 4218 | - $valid = false; |
|
| 4219 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) ); |
|
| 4220 | - } |
|
| 4221 | - $xtimings['###3'] = microtime(true)-$xstart; |
|
| 4222 | - $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true; |
|
| 4223 | - if ( $location_allowed ) {
|
|
| 4224 | - $location_result = geodir_get_default_location(); |
|
| 4225 | - if ( $post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '' ) {
|
|
| 4226 | - $invalid_addr++; |
|
| 4227 | - $valid = false; |
|
| 4228 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory' ) ); |
|
| 4229 | - } else if ( !empty( $location_result ) && $location_result->location_id == 0 ) {
|
|
| 4230 | - if ( ( geodir_strtolower( $post_city ) != geodir_strtolower( $location_result->city ) ) || ( geodir_strtolower( $post_region ) != geodir_strtolower( $location_result->region ) ) || (geodir_strtolower( $post_country ) != geodir_strtolower( $location_result->country ) ) ) {
|
|
| 4231 | - $invalid_addr++; |
|
| 4232 | - $valid = false; |
|
| 4233 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory' ) ); |
|
| 4234 | - } else {
|
|
| 4235 | - if (!$location_manager) {
|
|
| 4236 | - $gd_post['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // Set the default location when location manager not activated. |
|
| 4237 | - } |
|
| 4238 | - } |
|
| 4239 | - } |
|
| 4240 | - } |
|
| 4241 | - $xtimings['###4'] = microtime(true)-$xstart; |
|
| 4242 | - if ( !$valid ) {
|
|
| 4243 | - continue; |
|
| 4244 | - } |
|
| 4216 | + if ( $post_title == '' || !in_array( $post_type, $post_types ) ) {
|
|
| 4217 | + $invalid++; |
|
| 4218 | + $valid = false; |
|
| 4219 | + geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) ); |
|
| 4220 | + } |
|
| 4221 | + $xtimings['###3'] = microtime(true)-$xstart; |
|
| 4222 | + $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true; |
|
| 4223 | + if ( $location_allowed ) {
|
|
| 4224 | + $location_result = geodir_get_default_location(); |
|
| 4225 | + if ( $post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '' ) {
|
|
| 4226 | + $invalid_addr++; |
|
| 4227 | + $valid = false; |
|
| 4228 | + geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory' ) ); |
|
| 4229 | + } else if ( !empty( $location_result ) && $location_result->location_id == 0 ) {
|
|
| 4230 | + if ( ( geodir_strtolower( $post_city ) != geodir_strtolower( $location_result->city ) ) || ( geodir_strtolower( $post_region ) != geodir_strtolower( $location_result->region ) ) || (geodir_strtolower( $post_country ) != geodir_strtolower( $location_result->country ) ) ) {
|
|
| 4231 | + $invalid_addr++; |
|
| 4232 | + $valid = false; |
|
| 4233 | + geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory' ) ); |
|
| 4234 | + } else {
|
|
| 4235 | + if (!$location_manager) {
|
|
| 4236 | + $gd_post['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // Set the default location when location manager not activated. |
|
| 4237 | + } |
|
| 4238 | + } |
|
| 4239 | + } |
|
| 4240 | + } |
|
| 4241 | + $xtimings['###4'] = microtime(true)-$xstart; |
|
| 4242 | + if ( !$valid ) {
|
|
| 4243 | + continue; |
|
| 4244 | + } |
|
| 4245 | 4245 | |
| 4246 | - $cat_taxonomy = $post_type . 'category'; |
|
| 4247 | - $tags_taxonomy = $post_type . '_tags'; |
|
| 4246 | + $cat_taxonomy = $post_type . 'category'; |
|
| 4247 | + $tags_taxonomy = $post_type . '_tags'; |
|
| 4248 | 4248 | |
| 4249 | - if ($default_category != '' && !in_array($default_category, $post_category_arr)) {
|
|
| 4250 | - $post_category_arr = array_merge(array($default_category), $post_category_arr); |
|
| 4251 | - } |
|
| 4249 | + if ($default_category != '' && !in_array($default_category, $post_category_arr)) {
|
|
| 4250 | + $post_category_arr = array_merge(array($default_category), $post_category_arr); |
|
| 4251 | + } |
|
| 4252 | 4252 | |
| 4253 | - $post_category = array(); |
|
| 4254 | - $default_category_id = NULL; |
|
| 4255 | - if ( !empty( $post_category_arr ) ) {
|
|
| 4256 | - foreach ( $post_category_arr as $value ) {
|
|
| 4257 | - $category_name = wp_kses_normalize_entities( trim( $value ) ); |
|
| 4253 | + $post_category = array(); |
|
| 4254 | + $default_category_id = NULL; |
|
| 4255 | + if ( !empty( $post_category_arr ) ) {
|
|
| 4256 | + foreach ( $post_category_arr as $value ) {
|
|
| 4257 | + $category_name = wp_kses_normalize_entities( trim( $value ) ); |
|
| 4258 | 4258 | |
| 4259 | - if ( $category_name != '' ) {
|
|
| 4260 | - $term_category = array(); |
|
| 4259 | + if ( $category_name != '' ) {
|
|
| 4260 | + $term_category = array(); |
|
| 4261 | 4261 | |
| 4262 | - if ( $term = get_term_by( 'name', $category_name, $cat_taxonomy ) ) {
|
|
| 4263 | - $term_category = $term; |
|
| 4264 | - } else if ( $term = get_term_by( 'slug', $category_name, $cat_taxonomy ) ) {
|
|
| 4265 | - $term_category = $term; |
|
| 4266 | - } else {
|
|
| 4267 | - $term_data = array(); |
|
| 4268 | - $term_data['name'] = $category_name; |
|
| 4269 | - $term_data['taxonomy'] = $cat_taxonomy; |
|
| 4262 | + if ( $term = get_term_by( 'name', $category_name, $cat_taxonomy ) ) {
|
|
| 4263 | + $term_category = $term; |
|
| 4264 | + } else if ( $term = get_term_by( 'slug', $category_name, $cat_taxonomy ) ) {
|
|
| 4265 | + $term_category = $term; |
|
| 4266 | + } else {
|
|
| 4267 | + $term_data = array(); |
|
| 4268 | + $term_data['name'] = $category_name; |
|
| 4269 | + $term_data['taxonomy'] = $cat_taxonomy; |
|
| 4270 | 4270 | |
| 4271 | - $term_id = geodir_imex_insert_term( $cat_taxonomy, $term_data ); |
|
| 4272 | - if ( $term_id ) {
|
|
| 4273 | - $term_category = get_term( $term_id, $cat_taxonomy ); |
|
| 4274 | - } |
|
| 4275 | - } |
|
| 4271 | + $term_id = geodir_imex_insert_term( $cat_taxonomy, $term_data ); |
|
| 4272 | + if ( $term_id ) {
|
|
| 4273 | + $term_category = get_term( $term_id, $cat_taxonomy ); |
|
| 4274 | + } |
|
| 4275 | + } |
|
| 4276 | 4276 | |
| 4277 | - if ( !empty( $term_category ) && !is_wp_error( $term_category ) ) {
|
|
| 4278 | - $post_category[] = intval($term_category->term_id); |
|
| 4277 | + if ( !empty( $term_category ) && !is_wp_error( $term_category ) ) {
|
|
| 4278 | + $post_category[] = intval($term_category->term_id); |
|
| 4279 | 4279 | |
| 4280 | - if ($category_name == $default_category) {
|
|
| 4281 | - $default_category_id = intval($term_category->term_id); |
|
| 4282 | - } |
|
| 4283 | - } |
|
| 4284 | - } |
|
| 4285 | - } |
|
| 4286 | - } |
|
| 4287 | - $xtimings['###5'] = microtime(true)-$xstart; |
|
| 4288 | - $save_post = array(); |
|
| 4289 | - $save_post['post_title'] = $post_title; |
|
| 4290 | - if (!empty($post_date)) {
|
|
| 4291 | - $post_date = geodir_date( $post_date, 'Y-m-d H:i:s' ); // convert to mysql date format. |
|
| 4280 | + if ($category_name == $default_category) {
|
|
| 4281 | + $default_category_id = intval($term_category->term_id); |
|
| 4282 | + } |
|
| 4283 | + } |
|
| 4284 | + } |
|
| 4285 | + } |
|
| 4286 | + } |
|
| 4287 | + $xtimings['###5'] = microtime(true)-$xstart; |
|
| 4288 | + $save_post = array(); |
|
| 4289 | + $save_post['post_title'] = $post_title; |
|
| 4290 | + if (!empty($post_date)) {
|
|
| 4291 | + $post_date = geodir_date( $post_date, 'Y-m-d H:i:s' ); // convert to mysql date format. |
|
| 4292 | 4292 | |
| 4293 | - $save_post['post_date'] = $post_date; |
|
| 4294 | - $save_post['post_date_gmt'] = get_gmt_from_date( $post_date ); |
|
| 4295 | - } |
|
| 4296 | - $save_post['post_content'] = $post_content; |
|
| 4297 | - $save_post['post_type'] = $post_type; |
|
| 4298 | - $save_post['post_author'] = $post_author; |
|
| 4299 | - $save_post['post_status'] = $post_status; |
|
| 4300 | - $save_post['post_category'] = $post_category; |
|
| 4301 | - $save_post['post_tags'] = $post_tags; |
|
| 4302 | - |
|
| 4303 | - $saved_post_id = NULL; |
|
| 4304 | - if ( $import_choice == 'update' ) {
|
|
| 4305 | - $gd_wp_error = __( 'Unable to add listing, please check the listing data.', 'geodirectory' ); |
|
| 4293 | + $save_post['post_date'] = $post_date; |
|
| 4294 | + $save_post['post_date_gmt'] = get_gmt_from_date( $post_date ); |
|
| 4295 | + } |
|
| 4296 | + $save_post['post_content'] = $post_content; |
|
| 4297 | + $save_post['post_type'] = $post_type; |
|
| 4298 | + $save_post['post_author'] = $post_author; |
|
| 4299 | + $save_post['post_status'] = $post_status; |
|
| 4300 | + $save_post['post_category'] = $post_category; |
|
| 4301 | + $save_post['post_tags'] = $post_tags; |
|
| 4302 | + |
|
| 4303 | + $saved_post_id = NULL; |
|
| 4304 | + if ( $import_choice == 'update' ) {
|
|
| 4305 | + $gd_wp_error = __( 'Unable to add listing, please check the listing data.', 'geodirectory' ); |
|
| 4306 | 4306 | |
| 4307 | - if ( $post_id > 0 && get_post( $post_id ) ) {
|
|
| 4308 | - $save_post['ID'] = $post_id; |
|
| 4307 | + if ( $post_id > 0 && get_post( $post_id ) ) {
|
|
| 4308 | + $save_post['ID'] = $post_id; |
|
| 4309 | 4309 | |
| 4310 | - if ( $saved_post_id = wp_update_post( $save_post, true ) ) {
|
|
| 4311 | - if ( is_wp_error( $saved_post_id ) ) {
|
|
| 4312 | - $gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error; |
|
| 4313 | - $saved_post_id = 0; |
|
| 4314 | - } else {
|
|
| 4315 | - $saved_post_id = $post_id; |
|
| 4316 | - $updated++; |
|
| 4317 | - } |
|
| 4318 | - } |
|
| 4319 | - } else {
|
|
| 4320 | - if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
|
|
| 4321 | - if ( is_wp_error( $saved_post_id ) ) {
|
|
| 4322 | - $gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error; |
|
| 4323 | - $saved_post_id = 0; |
|
| 4324 | - } else {
|
|
| 4325 | - $created++; |
|
| 4326 | - } |
|
| 4327 | - } |
|
| 4328 | - } |
|
| 4310 | + if ( $saved_post_id = wp_update_post( $save_post, true ) ) {
|
|
| 4311 | + if ( is_wp_error( $saved_post_id ) ) {
|
|
| 4312 | + $gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error; |
|
| 4313 | + $saved_post_id = 0; |
|
| 4314 | + } else {
|
|
| 4315 | + $saved_post_id = $post_id; |
|
| 4316 | + $updated++; |
|
| 4317 | + } |
|
| 4318 | + } |
|
| 4319 | + } else {
|
|
| 4320 | + if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
|
|
| 4321 | + if ( is_wp_error( $saved_post_id ) ) {
|
|
| 4322 | + $gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error; |
|
| 4323 | + $saved_post_id = 0; |
|
| 4324 | + } else {
|
|
| 4325 | + $created++; |
|
| 4326 | + } |
|
| 4327 | + } |
|
| 4328 | + } |
|
| 4329 | 4329 | |
| 4330 | - if ( !$saved_post_id > 0 ) {
|
|
| 4331 | - $invalid++; |
|
| 4332 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_wp_error ); |
|
| 4333 | - } |
|
| 4334 | - } else if ( $import_choice == 'skip' ) {
|
|
| 4335 | - if ( $post_id > 0 && get_post( $post_id ) ) {
|
|
| 4336 | - $skipped++; |
|
| 4337 | - } else {
|
|
| 4338 | - if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
|
|
| 4339 | - if ( is_wp_error( $saved_post_id ) ) {
|
|
| 4340 | - $invalid++; |
|
| 4330 | + if ( !$saved_post_id > 0 ) {
|
|
| 4331 | + $invalid++; |
|
| 4332 | + geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_wp_error ); |
|
| 4333 | + } |
|
| 4334 | + } else if ( $import_choice == 'skip' ) {
|
|
| 4335 | + if ( $post_id > 0 && get_post( $post_id ) ) {
|
|
| 4336 | + $skipped++; |
|
| 4337 | + } else {
|
|
| 4338 | + if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
|
|
| 4339 | + if ( is_wp_error( $saved_post_id ) ) {
|
|
| 4340 | + $invalid++; |
|
| 4341 | 4341 | |
| 4342 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $saved_post_id->get_error_message() . ' ' . $wp_chars_error ); |
|
| 4343 | - $saved_post_id = 0; |
|
| 4344 | - } else {
|
|
| 4345 | - $created++; |
|
| 4346 | - } |
|
| 4347 | - } else {
|
|
| 4348 | - $invalid++; |
|
| 4342 | + geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $saved_post_id->get_error_message() . ' ' . $wp_chars_error ); |
|
| 4343 | + $saved_post_id = 0; |
|
| 4344 | + } else {
|
|
| 4345 | + $created++; |
|
| 4346 | + } |
|
| 4347 | + } else {
|
|
| 4348 | + $invalid++; |
|
| 4349 | 4349 | |
| 4350 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error ); |
|
| 4351 | - } |
|
| 4352 | - } |
|
| 4353 | - } else {
|
|
| 4354 | - $invalid++; |
|
| 4350 | + geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error ); |
|
| 4351 | + } |
|
| 4352 | + } |
|
| 4353 | + } else {
|
|
| 4354 | + $invalid++; |
|
| 4355 | 4355 | |
| 4356 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error ); |
|
| 4357 | - } |
|
| 4358 | - $xtimings['###6'] = microtime(true)-$xstart; |
|
| 4359 | - if ( (int)$saved_post_id > 0 ) {
|
|
| 4360 | - // WPML |
|
| 4361 | - if ($is_wpml && geodir_wpml_is_post_type_translated($post_type) && $original_post_id > 0 && $language != '') {
|
|
| 4362 | - $wpml_post_type = 'post_' . $post_type; |
|
| 4363 | - $source_language = geodir_get_language_for_element( $original_post_id, $wpml_post_type ); |
|
| 4364 | - $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language(); |
|
| 4365 | - |
|
| 4366 | - $trid = $sitepress->get_element_trid( $original_post_id, $wpml_post_type ); |
|
| 4356 | + geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error ); |
|
| 4357 | + } |
|
| 4358 | + $xtimings['###6'] = microtime(true)-$xstart; |
|
| 4359 | + if ( (int)$saved_post_id > 0 ) {
|
|
| 4360 | + // WPML |
|
| 4361 | + if ($is_wpml && geodir_wpml_is_post_type_translated($post_type) && $original_post_id > 0 && $language != '') {
|
|
| 4362 | + $wpml_post_type = 'post_' . $post_type; |
|
| 4363 | + $source_language = geodir_get_language_for_element( $original_post_id, $wpml_post_type ); |
|
| 4364 | + $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language(); |
|
| 4365 | + |
|
| 4366 | + $trid = $sitepress->get_element_trid( $original_post_id, $wpml_post_type ); |
|
| 4367 | 4367 | |
| 4368 | - $sitepress->set_element_language_details( $saved_post_id, $wpml_post_type, $trid, $language, $source_language ); |
|
| 4369 | - } |
|
| 4370 | - // WPML |
|
| 4371 | - $gd_post_info = geodir_get_post_info( $saved_post_id ); |
|
| 4368 | + $sitepress->set_element_language_details( $saved_post_id, $wpml_post_type, $trid, $language, $source_language ); |
|
| 4369 | + } |
|
| 4370 | + // WPML |
|
| 4371 | + $gd_post_info = geodir_get_post_info( $saved_post_id ); |
|
| 4372 | 4372 | |
| 4373 | - $gd_post['post_id'] = $saved_post_id; |
|
| 4374 | - $gd_post['ID'] = $saved_post_id; |
|
| 4375 | - $gd_post['post_tags'] = $post_tags; |
|
| 4376 | - $gd_post['post_title'] = $post_title; |
|
| 4377 | - $gd_post['post_status'] = $post_status; |
|
| 4378 | - $gd_post['submit_time'] = time(); |
|
| 4379 | - $gd_post['submit_ip'] = $_SERVER['REMOTE_ADDR']; |
|
| 4373 | + $gd_post['post_id'] = $saved_post_id; |
|
| 4374 | + $gd_post['ID'] = $saved_post_id; |
|
| 4375 | + $gd_post['post_tags'] = $post_tags; |
|
| 4376 | + $gd_post['post_title'] = $post_title; |
|
| 4377 | + $gd_post['post_status'] = $post_status; |
|
| 4378 | + $gd_post['submit_time'] = time(); |
|
| 4379 | + $gd_post['submit_ip'] = $_SERVER['REMOTE_ADDR']; |
|
| 4380 | 4380 | |
| 4381 | - // post location |
|
| 4382 | - $post_location_id = 0; |
|
| 4383 | - if ( $location_allowed && !empty( $location_result ) && $location_result->location_id > 0 ) {
|
|
| 4384 | - $gd_post['post_neighbourhood'] = ''; |
|
| 4381 | + // post location |
|
| 4382 | + $post_location_id = 0; |
|
| 4383 | + if ( $location_allowed && !empty( $location_result ) && $location_result->location_id > 0 ) {
|
|
| 4384 | + $gd_post['post_neighbourhood'] = ''; |
|
| 4385 | 4385 | |
| 4386 | - $post_location_info = array( |
|
| 4387 | - 'city' => $post_city, |
|
| 4388 | - 'region' => $post_region, |
|
| 4389 | - 'country' => $post_country, |
|
| 4390 | - 'geo_lat' => $post_latitude, |
|
| 4391 | - 'geo_lng' => $post_longitude |
|
| 4392 | - ); |
|
| 4393 | - if ( $location_id = (int)geodir_add_new_location( $post_location_info ) ) {
|
|
| 4394 | - $post_location_id = $location_id; |
|
| 4395 | - } |
|
| 4386 | + $post_location_info = array( |
|
| 4387 | + 'city' => $post_city, |
|
| 4388 | + 'region' => $post_region, |
|
| 4389 | + 'country' => $post_country, |
|
| 4390 | + 'geo_lat' => $post_latitude, |
|
| 4391 | + 'geo_lng' => $post_longitude |
|
| 4392 | + ); |
|
| 4393 | + if ( $location_id = (int)geodir_add_new_location( $post_location_info ) ) {
|
|
| 4394 | + $post_location_id = $location_id; |
|
| 4395 | + } |
|
| 4396 | 4396 | |
| 4397 | - if ($post_location_id > 0 && $neighbourhood_active && !empty($post_neighbourhood)) {
|
|
| 4398 | - $neighbourhood_info = geodir_location_neighbourhood_by_name_loc_id($post_neighbourhood, $post_location_id); |
|
| 4397 | + if ($post_location_id > 0 && $neighbourhood_active && !empty($post_neighbourhood)) {
|
|
| 4398 | + $neighbourhood_info = geodir_location_neighbourhood_by_name_loc_id($post_neighbourhood, $post_location_id); |
|
| 4399 | 4399 | |
| 4400 | - $hood_data = array(); |
|
| 4401 | - $hood_data['hood_location_id'] = $post_location_id; |
|
| 4402 | - $hood_data['hood_name'] = $post_neighbourhood; |
|
| 4400 | + $hood_data = array(); |
|
| 4401 | + $hood_data['hood_location_id'] = $post_location_id; |
|
| 4402 | + $hood_data['hood_name'] = $post_neighbourhood; |
|
| 4403 | 4403 | |
| 4404 | - if (!empty($neighbourhood_info)) {
|
|
| 4405 | - $hood_data['hood_id'] = $neighbourhood_info->hood_id; |
|
| 4406 | - $hood_data['hood_slug'] = $neighbourhood_info->hood_slug; |
|
| 4404 | + if (!empty($neighbourhood_info)) {
|
|
| 4405 | + $hood_data['hood_id'] = $neighbourhood_info->hood_id; |
|
| 4406 | + $hood_data['hood_slug'] = $neighbourhood_info->hood_slug; |
|
| 4407 | 4407 | |
| 4408 | - if (empty($neighbourhood_latitude) || empty($neighbourhood_longitude)) {
|
|
| 4409 | - $neighbourhood_latitude = $neighbourhood_info->hood_latitude; |
|
| 4410 | - $neighbourhood_longitude = $neighbourhood_info->hood_longitude; |
|
| 4411 | - } |
|
| 4412 | - } |
|
| 4408 | + if (empty($neighbourhood_latitude) || empty($neighbourhood_longitude)) {
|
|
| 4409 | + $neighbourhood_latitude = $neighbourhood_info->hood_latitude; |
|
| 4410 | + $neighbourhood_longitude = $neighbourhood_info->hood_longitude; |
|
| 4411 | + } |
|
| 4412 | + } |
|
| 4413 | 4413 | |
| 4414 | - if (empty($neighbourhood_latitude) || empty($neighbourhood_longitude)) {
|
|
| 4415 | - $neighbourhood_latitude = $neighbourhood_info->hood_latitude; |
|
| 4416 | - $neighbourhood_longitude = $neighbourhood_info->hood_longitude; |
|
| 4417 | - } |
|
| 4414 | + if (empty($neighbourhood_latitude) || empty($neighbourhood_longitude)) {
|
|
| 4415 | + $neighbourhood_latitude = $neighbourhood_info->hood_latitude; |
|
| 4416 | + $neighbourhood_longitude = $neighbourhood_info->hood_longitude; |
|
| 4417 | + } |
|
| 4418 | 4418 | |
| 4419 | - $hood_data['hood_latitude'] = $post_latitude; |
|
| 4420 | - $hood_data['hood_longitude'] = $post_longitude; |
|
| 4421 | - |
|
| 4422 | - $neighbourhood_info = geodir_location_insert_update_neighbourhood($hood_data); |
|
| 4423 | - if (!empty($neighbourhood_info) && isset($neighbourhood_info->hood_slug)) {
|
|
| 4424 | - $gd_post['post_neighbourhood'] = $neighbourhood_info->hood_slug; |
|
| 4425 | - } |
|
| 4426 | - } |
|
| 4427 | - } |
|
| 4428 | - $gd_post['post_location_id'] = $post_location_id; |
|
| 4419 | + $hood_data['hood_latitude'] = $post_latitude; |
|
| 4420 | + $hood_data['hood_longitude'] = $post_longitude; |
|
| 4421 | + |
|
| 4422 | + $neighbourhood_info = geodir_location_insert_update_neighbourhood($hood_data); |
|
| 4423 | + if (!empty($neighbourhood_info) && isset($neighbourhood_info->hood_slug)) {
|
|
| 4424 | + $gd_post['post_neighbourhood'] = $neighbourhood_info->hood_slug; |
|
| 4425 | + } |
|
| 4426 | + } |
|
| 4427 | + } |
|
| 4428 | + $gd_post['post_location_id'] = $post_location_id; |
|
| 4429 | 4429 | |
| 4430 | - if ($geodir_link_business !== null) {
|
|
| 4431 | - $gd_post['geodir_link_business'] = $geodir_link_business > 0 ? $geodir_link_business : ''; |
|
| 4432 | - } |
|
| 4430 | + if ($geodir_link_business !== null) {
|
|
| 4431 | + $gd_post['geodir_link_business'] = $geodir_link_business > 0 ? $geodir_link_business : ''; |
|
| 4432 | + } |
|
| 4433 | 4433 | |
| 4434 | - // post package info |
|
| 4435 | - $package_id = isset( $gd_post['package_id'] ) && !empty( $gd_post['package_id'] ) ? (int)$gd_post['package_id'] : 0; |
|
| 4436 | - if (!$package_id && !empty($gd_post_info) && isset($gd_post_info->package_id) && $gd_post_info->package_id) {
|
|
| 4437 | - $package_id = $gd_post_info->package_id; |
|
| 4438 | - } |
|
| 4434 | + // post package info |
|
| 4435 | + $package_id = isset( $gd_post['package_id'] ) && !empty( $gd_post['package_id'] ) ? (int)$gd_post['package_id'] : 0; |
|
| 4436 | + if (!$package_id && !empty($gd_post_info) && isset($gd_post_info->package_id) && $gd_post_info->package_id) {
|
|
| 4437 | + $package_id = $gd_post_info->package_id; |
|
| 4438 | + } |
|
| 4439 | 4439 | |
| 4440 | - $package_info = array(); |
|
| 4441 | - if ($package_id && function_exists('geodir_get_package_info_by_id')) {
|
|
| 4442 | - $package_info = (array)geodir_get_package_info_by_id($package_id); |
|
| 4440 | + $package_info = array(); |
|
| 4441 | + if ($package_id && function_exists('geodir_get_package_info_by_id')) {
|
|
| 4442 | + $package_info = (array)geodir_get_package_info_by_id($package_id); |
|
| 4443 | 4443 | |
| 4444 | - if (!(!empty($package_info) && isset($package_info['post_type']) && $package_info['post_type'] == $post_type)) {
|
|
| 4445 | - $package_info = array(); |
|
| 4446 | - } |
|
| 4447 | - } |
|
| 4444 | + if (!(!empty($package_info) && isset($package_info['post_type']) && $package_info['post_type'] == $post_type)) {
|
|
| 4445 | + $package_info = array(); |
|
| 4446 | + } |
|
| 4447 | + } |
|
| 4448 | 4448 | |
| 4449 | - if (empty($package_info)) {
|
|
| 4450 | - $package_info = (array)geodir_post_package_info( array(), '', $post_type ); |
|
| 4451 | - } |
|
| 4449 | + if (empty($package_info)) {
|
|
| 4450 | + $package_info = (array)geodir_post_package_info( array(), '', $post_type ); |
|
| 4451 | + } |
|
| 4452 | 4452 | |
| 4453 | - if (!empty($package_info)) {
|
|
| 4454 | - $package_id = $package_info['pid']; |
|
| 4453 | + if (!empty($package_info)) {
|
|
| 4454 | + $package_id = $package_info['pid']; |
|
| 4455 | 4455 | |
| 4456 | - if (isset($gd_post['alive_days']) || isset($gd_post['expire_date'])) {
|
|
| 4457 | - $gd_post['expire_date'] = $expire_date; |
|
| 4458 | - } else {
|
|
| 4459 | - if ( isset( $package_info['days'] ) && (int)$package_info['days'] > 0 ) {
|
|
| 4460 | - $gd_post['alive_days'] = (int)$package_info['days']; |
|
| 4461 | - $gd_post['expire_date'] = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$package_info['days'] . ' days' ) ); |
|
| 4462 | - } else {
|
|
| 4463 | - $gd_post['expire_date'] = 'Never'; |
|
| 4464 | - } |
|
| 4465 | - } |
|
| 4456 | + if (isset($gd_post['alive_days']) || isset($gd_post['expire_date'])) {
|
|
| 4457 | + $gd_post['expire_date'] = $expire_date; |
|
| 4458 | + } else {
|
|
| 4459 | + if ( isset( $package_info['days'] ) && (int)$package_info['days'] > 0 ) {
|
|
| 4460 | + $gd_post['alive_days'] = (int)$package_info['days']; |
|
| 4461 | + $gd_post['expire_date'] = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$package_info['days'] . ' days' ) ); |
|
| 4462 | + } else {
|
|
| 4463 | + $gd_post['expire_date'] = 'Never'; |
|
| 4464 | + } |
|
| 4465 | + } |
|
| 4466 | 4466 | |
| 4467 | - $gd_post['package_id'] = $package_id; |
|
| 4468 | - } |
|
| 4467 | + $gd_post['package_id'] = $package_id; |
|
| 4468 | + } |
|
| 4469 | 4469 | |
| 4470 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 4470 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
| 4471 | 4471 | |
| 4472 | - if ($post_type == 'gd_event') {
|
|
| 4473 | - $gd_post = geodir_imex_process_event_data($gd_post); |
|
| 4474 | - } |
|
| 4472 | + if ($post_type == 'gd_event') {
|
|
| 4473 | + $gd_post = geodir_imex_process_event_data($gd_post); |
|
| 4474 | + } |
|
| 4475 | 4475 | |
| 4476 | - if (isset($gd_post['post_id'])) {
|
|
| 4477 | - unset($gd_post['post_id']); |
|
| 4478 | - } |
|
| 4476 | + if (isset($gd_post['post_id'])) {
|
|
| 4477 | + unset($gd_post['post_id']); |
|
| 4478 | + } |
|
| 4479 | 4479 | |
| 4480 | - // Export franchise fields |
|
| 4481 | - $is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false; |
|
| 4482 | - if ($is_franchise_active) {
|
|
| 4483 | - if ( isset( $gd_post['gd_is_franchise'] ) && empty( $gd_post['franchise'] ) ) {
|
|
| 4484 | - if ( absint( $gd_post['gd_is_franchise'] ) != 0 ) {
|
|
| 4485 | - $gd_franchise_lock = array(); |
|
| 4480 | + // Export franchise fields |
|
| 4481 | + $is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false; |
|
| 4482 | + if ($is_franchise_active) {
|
|
| 4483 | + if ( isset( $gd_post['gd_is_franchise'] ) && empty( $gd_post['franchise'] ) ) {
|
|
| 4484 | + if ( absint( $gd_post['gd_is_franchise'] ) != 0 ) {
|
|
| 4485 | + $gd_franchise_lock = array(); |
|
| 4486 | 4486 | |
| 4487 | - if ( isset( $gd_post['gd_franchise_lock'] ) ) {
|
|
| 4488 | - $gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock'] );
|
|
| 4489 | - $gd_franchise_lock = trim( $gd_franchise_lock ); |
|
| 4490 | - $gd_franchise_lock = explode( ",", $gd_franchise_lock ); |
|
| 4491 | - } |
|
| 4487 | + if ( isset( $gd_post['gd_franchise_lock'] ) ) {
|
|
| 4488 | + $gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock'] );
|
|
| 4489 | + $gd_franchise_lock = trim( $gd_franchise_lock ); |
|
| 4490 | + $gd_franchise_lock = explode( ",", $gd_franchise_lock ); |
|
| 4491 | + } |
|
| 4492 | 4492 | |
| 4493 | - update_post_meta( $saved_post_id, 'gd_is_franchise', 1 ); |
|
| 4494 | - update_post_meta( $saved_post_id, 'gd_franchise_lock', $gd_franchise_lock ); |
|
| 4495 | - } else {
|
|
| 4496 | - if ( function_exists( 'geodir_franchise_remove_franchise' ) ) {
|
|
| 4497 | - geodir_franchise_remove_franchise( $saved_post_id ); |
|
| 4498 | - } |
|
| 4499 | - } |
|
| 4500 | - } else {
|
|
| 4501 | - if ( isset( $gd_post['franchise'] ) && (int)$gd_post['franchise'] > 0 && geodir_franchise_check( (int)$gd_post['franchise'] ) ) {
|
|
| 4502 | - geodir_save_post_meta( $saved_post_id, 'franchise', (int)$gd_post['franchise'] ); |
|
| 4503 | - } |
|
| 4504 | - } |
|
| 4505 | - } |
|
| 4493 | + update_post_meta( $saved_post_id, 'gd_is_franchise', 1 ); |
|
| 4494 | + update_post_meta( $saved_post_id, 'gd_franchise_lock', $gd_franchise_lock ); |
|
| 4495 | + } else {
|
|
| 4496 | + if ( function_exists( 'geodir_franchise_remove_franchise' ) ) {
|
|
| 4497 | + geodir_franchise_remove_franchise( $saved_post_id ); |
|
| 4498 | + } |
|
| 4499 | + } |
|
| 4500 | + } else {
|
|
| 4501 | + if ( isset( $gd_post['franchise'] ) && (int)$gd_post['franchise'] > 0 && geodir_franchise_check( (int)$gd_post['franchise'] ) ) {
|
|
| 4502 | + geodir_save_post_meta( $saved_post_id, 'franchise', (int)$gd_post['franchise'] ); |
|
| 4503 | + } |
|
| 4504 | + } |
|
| 4505 | + } |
|
| 4506 | 4506 | |
| 4507 | - if (!empty($save_post['post_category']) && is_array($save_post['post_category'])) {
|
|
| 4508 | - $save_post['post_category'] = array_unique( array_map( 'intval', $save_post['post_category'] ) ); |
|
| 4509 | - if ($default_category_id) {
|
|
| 4510 | - $save_post['post_default_category'] = $default_category_id; |
|
| 4511 | - $gd_post['default_category'] = $default_category_id; |
|
| 4512 | - } |
|
| 4513 | - $gd_post[$cat_taxonomy] = $save_post['post_category']; |
|
| 4514 | - } |
|
| 4515 | - $xtimings['###7'] = microtime(true)-$xstart; |
|
| 4516 | - // Save post info |
|
| 4517 | - geodir_save_post_info( $saved_post_id, $gd_post ); |
|
| 4518 | - $xtimings['###8'] = microtime(true)-$xstart; |
|
| 4519 | - // post taxonomies |
|
| 4520 | - if ( !empty( $save_post['post_category'] ) ) {
|
|
| 4521 | - wp_set_object_terms( $saved_post_id, $save_post['post_category'], $cat_taxonomy ); |
|
| 4507 | + if (!empty($save_post['post_category']) && is_array($save_post['post_category'])) {
|
|
| 4508 | + $save_post['post_category'] = array_unique( array_map( 'intval', $save_post['post_category'] ) ); |
|
| 4509 | + if ($default_category_id) {
|
|
| 4510 | + $save_post['post_default_category'] = $default_category_id; |
|
| 4511 | + $gd_post['default_category'] = $default_category_id; |
|
| 4512 | + } |
|
| 4513 | + $gd_post[$cat_taxonomy] = $save_post['post_category']; |
|
| 4514 | + } |
|
| 4515 | + $xtimings['###7'] = microtime(true)-$xstart; |
|
| 4516 | + // Save post info |
|
| 4517 | + geodir_save_post_info( $saved_post_id, $gd_post ); |
|
| 4518 | + $xtimings['###8'] = microtime(true)-$xstart; |
|
| 4519 | + // post taxonomies |
|
| 4520 | + if ( !empty( $save_post['post_category'] ) ) {
|
|
| 4521 | + wp_set_object_terms( $saved_post_id, $save_post['post_category'], $cat_taxonomy ); |
|
| 4522 | 4522 | |
| 4523 | - $post_default_category = isset( $save_post['post_default_category'] ) ? $save_post['post_default_category'] : ''; |
|
| 4524 | - if ($default_category_id) {
|
|
| 4525 | - $post_default_category = $default_category_id; |
|
| 4526 | - } |
|
| 4527 | - $post_cat_ids = geodir_get_post_meta($saved_post_id, $cat_taxonomy); |
|
| 4528 | - $save_post['post_category'] = !empty($post_cat_ids) ? explode(",", trim($post_cat_ids, ",")) : $save_post['post_category'];
|
|
| 4529 | - $post_category_str = !empty($save_post['post_category']) ? implode(",y:#", $save_post['post_category']) . ',y:' : '';
|
|
| 4523 | + $post_default_category = isset( $save_post['post_default_category'] ) ? $save_post['post_default_category'] : ''; |
|
| 4524 | + if ($default_category_id) {
|
|
| 4525 | + $post_default_category = $default_category_id; |
|
| 4526 | + } |
|
| 4527 | + $post_cat_ids = geodir_get_post_meta($saved_post_id, $cat_taxonomy); |
|
| 4528 | + $save_post['post_category'] = !empty($post_cat_ids) ? explode(",", trim($post_cat_ids, ",")) : $save_post['post_category'];
|
|
| 4529 | + $post_category_str = !empty($save_post['post_category']) ? implode(",y:#", $save_post['post_category']) . ',y:' : '';
|
|
| 4530 | 4530 | |
| 4531 | - if ($post_category_str != '' && $post_default_category) {
|
|
| 4532 | - $post_category_str = str_replace($post_default_category . ',y:', $post_default_category . ',y,d:', $post_category_str); |
|
| 4533 | - } |
|
| 4531 | + if ($post_category_str != '' && $post_default_category) {
|
|
| 4532 | + $post_category_str = str_replace($post_default_category . ',y:', $post_default_category . ',y,d:', $post_category_str); |
|
| 4533 | + } |
|
| 4534 | 4534 | |
| 4535 | - $post_category_str = $post_category_str != '' ? array($cat_taxonomy => $post_category_str) : ''; |
|
| 4535 | + $post_category_str = $post_category_str != '' ? array($cat_taxonomy => $post_category_str) : ''; |
|
| 4536 | 4536 | |
| 4537 | - geodir_set_postcat_structure( $saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str ); |
|
| 4538 | - } |
|
| 4539 | - $xtimings['###8.1'] = microtime(true)-$xstart; |
|
| 4540 | - if ( !empty( $save_post['post_tags'] ) ) {
|
|
| 4541 | - wp_set_object_terms( $saved_post_id, $save_post['post_tags'], $tags_taxonomy ); |
|
| 4542 | - } |
|
| 4543 | - $xtimings['###9'] = microtime(true)-$xstart; |
|
| 4544 | - // Post images |
|
| 4545 | - if ( !empty( $post_images ) ) {
|
|
| 4546 | - $post_images = array_unique($post_images); |
|
| 4537 | + geodir_set_postcat_structure( $saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str ); |
|
| 4538 | + } |
|
| 4539 | + $xtimings['###8.1'] = microtime(true)-$xstart; |
|
| 4540 | + if ( !empty( $save_post['post_tags'] ) ) {
|
|
| 4541 | + wp_set_object_terms( $saved_post_id, $save_post['post_tags'], $tags_taxonomy ); |
|
| 4542 | + } |
|
| 4543 | + $xtimings['###9'] = microtime(true)-$xstart; |
|
| 4544 | + // Post images |
|
| 4545 | + if ( !empty( $post_images ) ) {
|
|
| 4546 | + $post_images = array_unique($post_images); |
|
| 4547 | 4547 | |
| 4548 | - $old_post_images_arr = array(); |
|
| 4549 | - $saved_post_images_arr = array(); |
|
| 4548 | + $old_post_images_arr = array(); |
|
| 4549 | + $saved_post_images_arr = array(); |
|
| 4550 | 4550 | |
| 4551 | - $order = 1; |
|
| 4551 | + $order = 1; |
|
| 4552 | 4552 | |
| 4553 | - $old_post_images = geodir_get_images( $saved_post_id ); |
|
| 4554 | - $xtimings['###9.1'] = microtime(true)-$xstart; |
|
| 4555 | - if (!empty($old_post_images)) {
|
|
| 4556 | - foreach( $old_post_images as $old_post_image ) {
|
|
| 4557 | - if (!empty($old_post_image) && isset($old_post_image->file) && $old_post_image->file != '') {
|
|
| 4558 | - $old_post_images_arr[] = $old_post_image->file; |
|
| 4559 | - } |
|
| 4560 | - } |
|
| 4561 | - } |
|
| 4553 | + $old_post_images = geodir_get_images( $saved_post_id ); |
|
| 4554 | + $xtimings['###9.1'] = microtime(true)-$xstart; |
|
| 4555 | + if (!empty($old_post_images)) {
|
|
| 4556 | + foreach( $old_post_images as $old_post_image ) {
|
|
| 4557 | + if (!empty($old_post_image) && isset($old_post_image->file) && $old_post_image->file != '') {
|
|
| 4558 | + $old_post_images_arr[] = $old_post_image->file; |
|
| 4559 | + } |
|
| 4560 | + } |
|
| 4561 | + } |
|
| 4562 | 4562 | |
| 4563 | - foreach ( $post_images as $post_image ) {
|
|
| 4564 | - $image_name = basename( $post_image ); |
|
| 4565 | - $saved_post_images_arr[] = $image_name; |
|
| 4563 | + foreach ( $post_images as $post_image ) {
|
|
| 4564 | + $image_name = basename( $post_image ); |
|
| 4565 | + $saved_post_images_arr[] = $image_name; |
|
| 4566 | 4566 | |
| 4567 | - if (!empty($old_post_images_arr) && in_array( $image_name, $old_post_images_arr) ) {
|
|
| 4568 | - continue; // Skip if image already exists. |
|
| 4569 | - } |
|
| 4567 | + if (!empty($old_post_images_arr) && in_array( $image_name, $old_post_images_arr) ) {
|
|
| 4568 | + continue; // Skip if image already exists. |
|
| 4569 | + } |
|
| 4570 | 4570 | |
| 4571 | - $image_name_parts = explode( '.', $image_name ); |
|
| 4572 | - array_pop( $image_name_parts ); |
|
| 4573 | - $proper_image_name = implode( '.', $image_name_parts ); |
|
| 4574 | - $xtimings['###9.2'] = microtime(true)-$xstart; |
|
| 4575 | - $arr_file_type = wp_check_filetype( $image_name ); |
|
| 4576 | - $xtimings['###9.3'] = microtime(true)-$xstart; |
|
| 4577 | - if ( !empty( $arr_file_type ) ) {
|
|
| 4578 | - $uploaded_file_type = $arr_file_type['type']; |
|
| 4571 | + $image_name_parts = explode( '.', $image_name ); |
|
| 4572 | + array_pop( $image_name_parts ); |
|
| 4573 | + $proper_image_name = implode( '.', $image_name_parts ); |
|
| 4574 | + $xtimings['###9.2'] = microtime(true)-$xstart; |
|
| 4575 | + $arr_file_type = wp_check_filetype( $image_name ); |
|
| 4576 | + $xtimings['###9.3'] = microtime(true)-$xstart; |
|
| 4577 | + if ( !empty( $arr_file_type ) ) {
|
|
| 4578 | + $uploaded_file_type = $arr_file_type['type']; |
|
| 4579 | 4579 | |
| 4580 | - $attachment = array(); |
|
| 4581 | - $attachment['post_id'] = $saved_post_id; |
|
| 4582 | - $attachment['title'] = $proper_image_name; |
|
| 4583 | - $attachment['content'] = ''; |
|
| 4584 | - $attachment['file'] = $uploads_subdir . '/' . $image_name; |
|
| 4585 | - $attachment['mime_type'] = $uploaded_file_type; |
|
| 4586 | - $attachment['menu_order'] = $order; |
|
| 4587 | - $attachment['is_featured'] = 0; |
|
| 4588 | - |
|
| 4589 | - $attachment_set = ''; |
|
| 4590 | - foreach ( $attachment as $key => $val ) {
|
|
| 4591 | - if ( $val != '' ) {
|
|
| 4592 | - $attachment_set .= $key . " = '" . $val . "', "; |
|
| 4593 | - } |
|
| 4594 | - } |
|
| 4595 | - $attachment_set = trim( $attachment_set, ", " ); |
|
| 4580 | + $attachment = array(); |
|
| 4581 | + $attachment['post_id'] = $saved_post_id; |
|
| 4582 | + $attachment['title'] = $proper_image_name; |
|
| 4583 | + $attachment['content'] = ''; |
|
| 4584 | + $attachment['file'] = $uploads_subdir . '/' . $image_name; |
|
| 4585 | + $attachment['mime_type'] = $uploaded_file_type; |
|
| 4586 | + $attachment['menu_order'] = $order; |
|
| 4587 | + $attachment['is_featured'] = 0; |
|
| 4588 | + |
|
| 4589 | + $attachment_set = ''; |
|
| 4590 | + foreach ( $attachment as $key => $val ) {
|
|
| 4591 | + if ( $val != '' ) {
|
|
| 4592 | + $attachment_set .= $key . " = '" . $val . "', "; |
|
| 4593 | + } |
|
| 4594 | + } |
|
| 4595 | + $attachment_set = trim( $attachment_set, ", " ); |
|
| 4596 | 4596 | |
| 4597 | - // Add new attachment |
|
| 4598 | - $xtimings['###9.4'] = microtime(true)-$xstart; |
|
| 4599 | - $wpdb->query( "INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set ); |
|
| 4600 | - $xtimings['###9.5'] = microtime(true)-$xstart; |
|
| 4601 | - $order++; |
|
| 4602 | - } |
|
| 4603 | - } |
|
| 4604 | - |
|
| 4605 | - $saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/" . implode("' AND file NOT LIKE '%/", $saved_post_images_arr) . "' )" : '';
|
|
| 4606 | - // Remove previous attachment |
|
| 4607 | - $wpdb->query( "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = " . (int)$saved_post_id . " " . $saved_post_images_sql ); |
|
| 4608 | - $xtimings['###9.6'] = microtime(true)-$xstart; |
|
| 4609 | - if ( !empty( $saved_post_images_arr ) ) {
|
|
| 4610 | - geodir_set_wp_featured_image($saved_post_id); |
|
| 4611 | - $xtimings['###9.7'] = microtime(true)-$xstart; |
|
| 4612 | - /* |
|
| 4597 | + // Add new attachment |
|
| 4598 | + $xtimings['###9.4'] = microtime(true)-$xstart; |
|
| 4599 | + $wpdb->query( "INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set ); |
|
| 4600 | + $xtimings['###9.5'] = microtime(true)-$xstart; |
|
| 4601 | + $order++; |
|
| 4602 | + } |
|
| 4603 | + } |
|
| 4604 | + |
|
| 4605 | + $saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/" . implode("' AND file NOT LIKE '%/", $saved_post_images_arr) . "' )" : '';
|
|
| 4606 | + // Remove previous attachment |
|
| 4607 | + $wpdb->query( "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = " . (int)$saved_post_id . " " . $saved_post_images_sql ); |
|
| 4608 | + $xtimings['###9.6'] = microtime(true)-$xstart; |
|
| 4609 | + if ( !empty( $saved_post_images_arr ) ) {
|
|
| 4610 | + geodir_set_wp_featured_image($saved_post_id); |
|
| 4611 | + $xtimings['###9.7'] = microtime(true)-$xstart; |
|
| 4612 | + /* |
|
| 4613 | 4613 | $menu_order = 1; |
| 4614 | 4614 | |
| 4615 | 4615 | foreach ( $saved_post_images_arr as $img_name ) {
|
@@ -4622,288 +4622,288 @@ discard block |
||
| 4622 | 4622 | } |
| 4623 | 4623 | $menu_order++; |
| 4624 | 4624 | }*/ |
| 4625 | - } |
|
| 4625 | + } |
|
| 4626 | 4626 | |
| 4627 | - if ( $order > 1 ) {
|
|
| 4628 | - $images++; |
|
| 4629 | - } |
|
| 4630 | - } |
|
| 4631 | - $xtimings['###10'] = microtime(true)-$xstart; |
|
| 4632 | - /** This action is documented in geodirectory-functions/post-functions.php */ |
|
| 4633 | - do_action( 'geodir_after_save_listing', $saved_post_id, $gd_post ); |
|
| 4634 | - $xtimings['###11'] = microtime(true)-$xstart; |
|
| 4635 | - if (isset($is_featured)) {
|
|
| 4636 | - geodir_save_post_meta($saved_post_id, 'is_featured', $is_featured); |
|
| 4637 | - } |
|
| 4638 | - if (isset($gd_post['alive_days'])) {
|
|
| 4639 | - geodir_save_post_meta($saved_post_id, 'alive_days', $gd_post['alive_days']); |
|
| 4640 | - } |
|
| 4641 | - if (isset($gd_post['expire_date'])) {
|
|
| 4642 | - geodir_save_post_meta($saved_post_id, 'expire_date', $gd_post['expire_date']); |
|
| 4643 | - } |
|
| 4644 | - $xtimings['###12'] = microtime(true)-$xstart; |
|
| 4645 | - } |
|
| 4627 | + if ( $order > 1 ) {
|
|
| 4628 | + $images++; |
|
| 4629 | + } |
|
| 4630 | + } |
|
| 4631 | + $xtimings['###10'] = microtime(true)-$xstart; |
|
| 4632 | + /** This action is documented in geodirectory-functions/post-functions.php */ |
|
| 4633 | + do_action( 'geodir_after_save_listing', $saved_post_id, $gd_post ); |
|
| 4634 | + $xtimings['###11'] = microtime(true)-$xstart; |
|
| 4635 | + if (isset($is_featured)) {
|
|
| 4636 | + geodir_save_post_meta($saved_post_id, 'is_featured', $is_featured); |
|
| 4637 | + } |
|
| 4638 | + if (isset($gd_post['alive_days'])) {
|
|
| 4639 | + geodir_save_post_meta($saved_post_id, 'alive_days', $gd_post['alive_days']); |
|
| 4640 | + } |
|
| 4641 | + if (isset($gd_post['expire_date'])) {
|
|
| 4642 | + geodir_save_post_meta($saved_post_id, 'expire_date', $gd_post['expire_date']); |
|
| 4643 | + } |
|
| 4644 | + $xtimings['###12'] = microtime(true)-$xstart; |
|
| 4645 | + } |
|
| 4646 | 4646 | |
| 4647 | - // WPML |
|
| 4648 | - if ($is_wpml && $language != '') {
|
|
| 4649 | - $sitepress->switch_lang($active_lang, true); |
|
| 4650 | - } |
|
| 4651 | - // WPML |
|
| 4652 | - } |
|
| 4653 | - } |
|
| 4654 | - } |
|
| 4647 | + // WPML |
|
| 4648 | + if ($is_wpml && $language != '') {
|
|
| 4649 | + $sitepress->switch_lang($active_lang, true); |
|
| 4650 | + } |
|
| 4651 | + // WPML |
|
| 4652 | + } |
|
| 4653 | + } |
|
| 4654 | + } |
|
| 4655 | 4655 | |
| 4656 | - //undo some stuff to make the import quicker |
|
| 4657 | - wp_defer_term_counting( false ); |
|
| 4658 | - wp_defer_comment_counting( false ); |
|
| 4659 | - $wpdb->query( 'COMMIT;' ); |
|
| 4660 | - $wpdb->query( 'SET autocommit = 1;' ); |
|
| 4661 | - $xtimings['###13'] = microtime(true)-$xstart; |
|
| 4662 | - $json = array(); |
|
| 4663 | - $json['processed'] = $processed_actual; |
|
| 4664 | - $json['created'] = $created; |
|
| 4665 | - $json['updated'] = $updated; |
|
| 4666 | - $json['skipped'] = $skipped; |
|
| 4667 | - $json['invalid'] = $invalid; |
|
| 4668 | - $json['invalid_addr'] = $invalid_addr; |
|
| 4669 | - $json['images'] = $images; |
|
| 4670 | - $json['timing'] = microtime(true)-$xstart; |
|
| 4671 | - $json['timings'] = $xtimings; |
|
| 4656 | + //undo some stuff to make the import quicker |
|
| 4657 | + wp_defer_term_counting( false ); |
|
| 4658 | + wp_defer_comment_counting( false ); |
|
| 4659 | + $wpdb->query( 'COMMIT;' ); |
|
| 4660 | + $wpdb->query( 'SET autocommit = 1;' ); |
|
| 4661 | + $xtimings['###13'] = microtime(true)-$xstart; |
|
| 4662 | + $json = array(); |
|
| 4663 | + $json['processed'] = $processed_actual; |
|
| 4664 | + $json['created'] = $created; |
|
| 4665 | + $json['updated'] = $updated; |
|
| 4666 | + $json['skipped'] = $skipped; |
|
| 4667 | + $json['invalid'] = $invalid; |
|
| 4668 | + $json['invalid_addr'] = $invalid_addr; |
|
| 4669 | + $json['images'] = $images; |
|
| 4670 | + $json['timing'] = microtime(true)-$xstart; |
|
| 4671 | + $json['timings'] = $xtimings; |
|
| 4672 | 4672 | |
| 4673 | 4673 | |
| 4674 | - wp_send_json( $json ); |
|
| 4675 | - exit; |
|
| 4676 | - } else if ( $task == 'import_loc' ) {
|
|
| 4677 | - global $gd_post_types; |
|
| 4678 | - $gd_post_types = $post_types; |
|
| 4674 | + wp_send_json( $json ); |
|
| 4675 | + exit; |
|
| 4676 | + } else if ( $task == 'import_loc' ) {
|
|
| 4677 | + global $gd_post_types; |
|
| 4678 | + $gd_post_types = $post_types; |
|
| 4679 | 4679 | |
| 4680 | - if (!empty($file)) {
|
|
| 4681 | - $columns = isset($file[0]) ? $file[0] : NULL; |
|
| 4680 | + if (!empty($file)) {
|
|
| 4681 | + $columns = isset($file[0]) ? $file[0] : NULL; |
|
| 4682 | 4682 | |
| 4683 | - if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
|
|
| 4684 | - $json['error'] = __('The file you are uploading is not valid. There are problems with the file columns.', 'geodirectory');
|
|
| 4685 | - wp_send_json( $json ); |
|
| 4686 | - } |
|
| 4683 | + if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
|
|
| 4684 | + $json['error'] = __('The file you are uploading is not valid. There are problems with the file columns.', 'geodirectory');
|
|
| 4685 | + wp_send_json( $json ); |
|
| 4686 | + } |
|
| 4687 | 4687 | |
| 4688 | - $gd_error_log = __('GD IMPORT LOCATIONS [ROW %d]:', 'geodirectory');
|
|
| 4689 | - $gd_error_location = __( 'Could not be saved due to blank/invalid address(city, region, country, latitude, longitude)', 'geodirectory' ); |
|
| 4690 | - for ($i = 1; $i <= $limit; $i++) {
|
|
| 4691 | - $index = $processed + $i; |
|
| 4688 | + $gd_error_log = __('GD IMPORT LOCATIONS [ROW %d]:', 'geodirectory');
|
|
| 4689 | + $gd_error_location = __( 'Could not be saved due to blank/invalid address(city, region, country, latitude, longitude)', 'geodirectory' ); |
|
| 4690 | + for ($i = 1; $i <= $limit; $i++) {
|
|
| 4691 | + $index = $processed + $i; |
|
| 4692 | 4692 | |
| 4693 | - if (isset($file[$index])) {
|
|
| 4694 | - $row = $file[$index]; |
|
| 4695 | - $row = array_map( 'trim', $row ); |
|
| 4696 | - $data = array(); |
|
| 4693 | + if (isset($file[$index])) {
|
|
| 4694 | + $row = $file[$index]; |
|
| 4695 | + $row = array_map( 'trim', $row ); |
|
| 4696 | + $data = array(); |
|
| 4697 | 4697 | |
| 4698 | - foreach ($columns as $c => $column ) {
|
|
| 4699 | - if (in_array($column, array('location_id', 'latitude', 'longitude', 'city', 'city_slug', 'region', 'country', 'city_meta_title', 'city_meta_desc', 'city_desc', 'region_meta_title', 'region_meta_desc', 'region_desc', 'country_meta_title', 'country_meta_desc', 'country_desc'))) {
|
|
| 4700 | - $data[$column] = $row[$c]; |
|
| 4701 | - } |
|
| 4702 | - } |
|
| 4698 | + foreach ($columns as $c => $column ) {
|
|
| 4699 | + if (in_array($column, array('location_id', 'latitude', 'longitude', 'city', 'city_slug', 'region', 'country', 'city_meta_title', 'city_meta_desc', 'city_desc', 'region_meta_title', 'region_meta_desc', 'region_desc', 'country_meta_title', 'country_meta_desc', 'country_desc'))) {
|
|
| 4700 | + $data[$column] = $row[$c]; |
|
| 4701 | + } |
|
| 4702 | + } |
|
| 4703 | 4703 | |
| 4704 | - if ( empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude']) ) {
|
|
| 4705 | - $invalid++; |
|
| 4706 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location ); |
|
| 4707 | - continue; |
|
| 4708 | - } |
|
| 4704 | + if ( empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude']) ) {
|
|
| 4705 | + $invalid++; |
|
| 4706 | + geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location ); |
|
| 4707 | + continue; |
|
| 4708 | + } |
|
| 4709 | 4709 | |
| 4710 | - $data['location_id'] = isset($data['location_id']) ? absint($data['location_id']) : 0; |
|
| 4710 | + $data['location_id'] = isset($data['location_id']) ? absint($data['location_id']) : 0; |
|
| 4711 | 4711 | |
| 4712 | - if ( $import_choice == 'update' ) {
|
|
| 4713 | - if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
|
|
| 4714 | - if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
|
|
| 4715 | - $updated++; |
|
| 4716 | - } else {
|
|
| 4717 | - $invalid++; |
|
| 4718 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location ); |
|
| 4719 | - } |
|
| 4720 | - } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
|
|
| 4721 | - $data['location_id'] = (int)$location->location_id; |
|
| 4712 | + if ( $import_choice == 'update' ) {
|
|
| 4713 | + if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
|
|
| 4714 | + if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
|
|
| 4715 | + $updated++; |
|
| 4716 | + } else {
|
|
| 4717 | + $invalid++; |
|
| 4718 | + geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location ); |
|
| 4719 | + } |
|
| 4720 | + } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
|
|
| 4721 | + $data['location_id'] = (int)$location->location_id; |
|
| 4722 | 4722 | |
| 4723 | - if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region'] ) ) ) {
|
|
| 4724 | - $data['location_id'] = (int)$location->location_id; |
|
| 4725 | - } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'region' => $data['region'] ) ) ) {
|
|
| 4726 | - $data['location_id'] = (int)$location->location_id; |
|
| 4727 | - } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'] ) ) ) {
|
|
| 4728 | - $data['location_id'] = (int)$location->location_id; |
|
| 4729 | - } |
|
| 4723 | + if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region'] ) ) ) {
|
|
| 4724 | + $data['location_id'] = (int)$location->location_id; |
|
| 4725 | + } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'region' => $data['region'] ) ) ) {
|
|
| 4726 | + $data['location_id'] = (int)$location->location_id; |
|
| 4727 | + } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'] ) ) ) {
|
|
| 4728 | + $data['location_id'] = (int)$location->location_id; |
|
| 4729 | + } |
|
| 4730 | 4730 | |
| 4731 | - if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
|
|
| 4732 | - $updated++; |
|
| 4733 | - } else {
|
|
| 4734 | - $invalid++; |
|
| 4735 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location ); |
|
| 4736 | - } |
|
| 4737 | - } else {
|
|
| 4738 | - if ( $location_id = geodir_location_insert_city( $data, true ) ) {
|
|
| 4739 | - $created++; |
|
| 4740 | - } else {
|
|
| 4741 | - $invalid++; |
|
| 4742 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location ); |
|
| 4743 | - } |
|
| 4744 | - } |
|
| 4745 | - } elseif ( $import_choice == 'skip' ) {
|
|
| 4746 | - if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
|
|
| 4747 | - $skipped++; |
|
| 4748 | - } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
|
|
| 4749 | - $skipped++; |
|
| 4750 | - } else {
|
|
| 4751 | - if ( $location_id = geodir_location_insert_city( $data, true ) ) {
|
|
| 4752 | - $created++; |
|
| 4753 | - } else {
|
|
| 4754 | - $invalid++; |
|
| 4755 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location ); |
|
| 4756 | - } |
|
| 4757 | - } |
|
| 4758 | - } else {
|
|
| 4759 | - $invalid++; |
|
| 4760 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location ); |
|
| 4761 | - } |
|
| 4762 | - } |
|
| 4763 | - } |
|
| 4764 | - } |
|
| 4731 | + if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
|
|
| 4732 | + $updated++; |
|
| 4733 | + } else {
|
|
| 4734 | + $invalid++; |
|
| 4735 | + geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location ); |
|
| 4736 | + } |
|
| 4737 | + } else {
|
|
| 4738 | + if ( $location_id = geodir_location_insert_city( $data, true ) ) {
|
|
| 4739 | + $created++; |
|
| 4740 | + } else {
|
|
| 4741 | + $invalid++; |
|
| 4742 | + geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location ); |
|
| 4743 | + } |
|
| 4744 | + } |
|
| 4745 | + } elseif ( $import_choice == 'skip' ) {
|
|
| 4746 | + if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
|
|
| 4747 | + $skipped++; |
|
| 4748 | + } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
|
|
| 4749 | + $skipped++; |
|
| 4750 | + } else {
|
|
| 4751 | + if ( $location_id = geodir_location_insert_city( $data, true ) ) {
|
|
| 4752 | + $created++; |
|
| 4753 | + } else {
|
|
| 4754 | + $invalid++; |
|
| 4755 | + geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location ); |
|
| 4756 | + } |
|
| 4757 | + } |
|
| 4758 | + } else {
|
|
| 4759 | + $invalid++; |
|
| 4760 | + geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location ); |
|
| 4761 | + } |
|
| 4762 | + } |
|
| 4763 | + } |
|
| 4764 | + } |
|
| 4765 | 4765 | |
| 4766 | - $json = array(); |
|
| 4767 | - $json['processed'] = $limit; |
|
| 4768 | - $json['created'] = $created; |
|
| 4769 | - $json['updated'] = $updated; |
|
| 4770 | - $json['skipped'] = $skipped; |
|
| 4771 | - $json['invalid'] = $invalid; |
|
| 4772 | - $json['images'] = $images; |
|
| 4766 | + $json = array(); |
|
| 4767 | + $json['processed'] = $limit; |
|
| 4768 | + $json['created'] = $created; |
|
| 4769 | + $json['updated'] = $updated; |
|
| 4770 | + $json['skipped'] = $skipped; |
|
| 4771 | + $json['invalid'] = $invalid; |
|
| 4772 | + $json['images'] = $images; |
|
| 4773 | 4773 | |
| 4774 | - wp_send_json( $json ); |
|
| 4775 | - } else if ( $task == 'import_hood' ) {
|
|
| 4776 | - if (!empty($file)) {
|
|
| 4777 | - $columns = isset($file[0]) ? $file[0] : NULL; |
|
| 4774 | + wp_send_json( $json ); |
|
| 4775 | + } else if ( $task == 'import_hood' ) {
|
|
| 4776 | + if (!empty($file)) {
|
|
| 4777 | + $columns = isset($file[0]) ? $file[0] : NULL; |
|
| 4778 | 4778 | |
| 4779 | - if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
|
|
| 4780 | - $json['error'] = __('The file you are uploading is not valid. There are problems with the file columns.', 'geodirectory');
|
|
| 4781 | - wp_send_json( $json ); |
|
| 4782 | - } |
|
| 4779 | + if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
|
|
| 4780 | + $json['error'] = __('The file you are uploading is not valid. There are problems with the file columns.', 'geodirectory');
|
|
| 4781 | + wp_send_json( $json ); |
|
| 4782 | + } |
|
| 4783 | 4783 | |
| 4784 | - $gd_error_log = __('GD IMPORT NEIGHBOURHOODS [ROW %d]:', 'geodirectory');
|
|
| 4785 | - $gd_error_hood = __( 'Could not be saved due to invalid neighbourhood data(name, latitude, longitude) or invalid location data(either location_id or city/region/country is empty)', 'geodirectory' ); |
|
| 4786 | - for ($i = 1; $i <= $limit; $i++) {
|
|
| 4787 | - $index = $processed + $i; |
|
| 4784 | + $gd_error_log = __('GD IMPORT NEIGHBOURHOODS [ROW %d]:', 'geodirectory');
|
|
| 4785 | + $gd_error_hood = __( 'Could not be saved due to invalid neighbourhood data(name, latitude, longitude) or invalid location data(either location_id or city/region/country is empty)', 'geodirectory' ); |
|
| 4786 | + for ($i = 1; $i <= $limit; $i++) {
|
|
| 4787 | + $index = $processed + $i; |
|
| 4788 | 4788 | |
| 4789 | - if (isset($file[$index])) {
|
|
| 4790 | - $row = $file[$index]; |
|
| 4791 | - $row = array_map( 'trim', $row ); |
|
| 4792 | - $data = array(); |
|
| 4789 | + if (isset($file[$index])) {
|
|
| 4790 | + $row = $file[$index]; |
|
| 4791 | + $row = array_map( 'trim', $row ); |
|
| 4792 | + $data = array(); |
|
| 4793 | 4793 | |
| 4794 | - foreach ($columns as $c => $column) {
|
|
| 4795 | - if (in_array($column, array('neighbourhood_id', 'neighbourhood_name', 'neighbourhood_slug', 'latitude', 'longitude', 'location_id', 'city', 'region', 'country'))) {
|
|
| 4796 | - $data[$column] = sanitize_text_field($row[$c]); |
|
| 4797 | - } |
|
| 4798 | - } |
|
| 4794 | + foreach ($columns as $c => $column) {
|
|
| 4795 | + if (in_array($column, array('neighbourhood_id', 'neighbourhood_name', 'neighbourhood_slug', 'latitude', 'longitude', 'location_id', 'city', 'region', 'country'))) {
|
|
| 4796 | + $data[$column] = sanitize_text_field($row[$c]); |
|
| 4797 | + } |
|
| 4798 | + } |
|
| 4799 | 4799 | |
| 4800 | - if (empty($data['neighbourhood_name']) || empty($data['latitude']) || empty($data['longitude'])) {
|
|
| 4801 | - $invalid++; |
|
| 4802 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 4803 | - continue; |
|
| 4804 | - } |
|
| 4800 | + if (empty($data['neighbourhood_name']) || empty($data['latitude']) || empty($data['longitude'])) {
|
|
| 4801 | + $invalid++; |
|
| 4802 | + geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 4803 | + continue; |
|
| 4804 | + } |
|
| 4805 | 4805 | |
| 4806 | - $location_info = array(); |
|
| 4807 | - if (!empty($data['location_id']) && (int)$data['location_id'] > 0) {
|
|
| 4808 | - $location_info = geodir_get_location_by_id('', (int)$data['location_id']);
|
|
| 4809 | - } else if (!empty($data['city']) && !empty($data['region']) && !empty($data['country'])) {
|
|
| 4810 | - $location_info = geodir_get_location_by_slug('city', array('fields' => 'location_id', 'city' => $data['city'], 'country' => $data['country'], 'region' => $data['region']));
|
|
| 4811 | - } |
|
| 4806 | + $location_info = array(); |
|
| 4807 | + if (!empty($data['location_id']) && (int)$data['location_id'] > 0) {
|
|
| 4808 | + $location_info = geodir_get_location_by_id('', (int)$data['location_id']);
|
|
| 4809 | + } else if (!empty($data['city']) && !empty($data['region']) && !empty($data['country'])) {
|
|
| 4810 | + $location_info = geodir_get_location_by_slug('city', array('fields' => 'location_id', 'city' => $data['city'], 'country' => $data['country'], 'region' => $data['region']));
|
|
| 4811 | + } |
|
| 4812 | 4812 | |
| 4813 | - if (empty($location_info)) {
|
|
| 4814 | - $invalid++; |
|
| 4815 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 4816 | - continue; |
|
| 4817 | - } |
|
| 4813 | + if (empty($location_info)) {
|
|
| 4814 | + $invalid++; |
|
| 4815 | + geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 4816 | + continue; |
|
| 4817 | + } |
|
| 4818 | 4818 | |
| 4819 | - $location_id = $location_info->location_id; |
|
| 4819 | + $location_id = $location_info->location_id; |
|
| 4820 | 4820 | |
| 4821 | - $data['neighbourhood_id'] = isset($data['neighbourhood_id']) ? absint($data['neighbourhood_id']) : 0; |
|
| 4821 | + $data['neighbourhood_id'] = isset($data['neighbourhood_id']) ? absint($data['neighbourhood_id']) : 0; |
|
| 4822 | 4822 | |
| 4823 | - $hood_data = array(); |
|
| 4824 | - $hood_data['hood_name'] = $data['neighbourhood_name']; |
|
| 4825 | - $hood_data['hood_slug'] = $data['neighbourhood_slug']; |
|
| 4826 | - $hood_data['hood_latitude'] = $data['latitude']; |
|
| 4827 | - $hood_data['hood_longitude'] = $data['longitude']; |
|
| 4828 | - $hood_data['hood_location_id'] = $location_id; |
|
| 4823 | + $hood_data = array(); |
|
| 4824 | + $hood_data['hood_name'] = $data['neighbourhood_name']; |
|
| 4825 | + $hood_data['hood_slug'] = $data['neighbourhood_slug']; |
|
| 4826 | + $hood_data['hood_latitude'] = $data['latitude']; |
|
| 4827 | + $hood_data['hood_longitude'] = $data['longitude']; |
|
| 4828 | + $hood_data['hood_location_id'] = $location_id; |
|
| 4829 | 4829 | |
| 4830 | - if ( $import_choice == 'update' ) {
|
|
| 4831 | - if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
|
|
| 4832 | - $hood_data['hood_id'] = (int)$data['neighbourhood_id']; |
|
| 4830 | + if ( $import_choice == 'update' ) {
|
|
| 4831 | + if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
|
|
| 4832 | + $hood_data['hood_id'] = (int)$data['neighbourhood_id']; |
|
| 4833 | 4833 | |
| 4834 | - if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
|
|
| 4835 | - $updated++; |
|
| 4836 | - } else {
|
|
| 4837 | - $invalid++; |
|
| 4838 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 4839 | - } |
|
| 4840 | - } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
|
|
| 4841 | - $hood_data['hood_id'] = (int)$neighbourhood->hood_id; |
|
| 4834 | + if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
|
|
| 4835 | + $updated++; |
|
| 4836 | + } else {
|
|
| 4837 | + $invalid++; |
|
| 4838 | + geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 4839 | + } |
|
| 4840 | + } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
|
|
| 4841 | + $hood_data['hood_id'] = (int)$neighbourhood->hood_id; |
|
| 4842 | 4842 | |
| 4843 | - if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
|
|
| 4844 | - $updated++; |
|
| 4845 | - } else {
|
|
| 4846 | - $invalid++; |
|
| 4847 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 4848 | - } |
|
| 4849 | - } else {
|
|
| 4850 | - if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
|
|
| 4851 | - $created++; |
|
| 4852 | - } else {
|
|
| 4853 | - $invalid++; |
|
| 4854 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 4855 | - } |
|
| 4856 | - } |
|
| 4857 | - } elseif ( $import_choice == 'skip' ) {
|
|
| 4858 | - if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
|
|
| 4859 | - $skipped++; |
|
| 4860 | - } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
|
|
| 4861 | - $skipped++; |
|
| 4862 | - } else {
|
|
| 4843 | + if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
|
|
| 4844 | + $updated++; |
|
| 4845 | + } else {
|
|
| 4846 | + $invalid++; |
|
| 4847 | + geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 4848 | + } |
|
| 4849 | + } else {
|
|
| 4850 | + if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
|
|
| 4851 | + $created++; |
|
| 4852 | + } else {
|
|
| 4853 | + $invalid++; |
|
| 4854 | + geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 4855 | + } |
|
| 4856 | + } |
|
| 4857 | + } elseif ( $import_choice == 'skip' ) {
|
|
| 4858 | + if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
|
|
| 4859 | + $skipped++; |
|
| 4860 | + } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
|
|
| 4861 | + $skipped++; |
|
| 4862 | + } else {
|
|
| 4863 | 4863 | |
| 4864 | - if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
|
|
| 4865 | - $created++; |
|
| 4866 | - } else {
|
|
| 4867 | - $invalid++; |
|
| 4868 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 4869 | - } |
|
| 4870 | - } |
|
| 4871 | - } else {
|
|
| 4872 | - $invalid++; |
|
| 4873 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 4874 | - } |
|
| 4875 | - } |
|
| 4876 | - } |
|
| 4877 | - } |
|
| 4864 | + if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
|
|
| 4865 | + $created++; |
|
| 4866 | + } else {
|
|
| 4867 | + $invalid++; |
|
| 4868 | + geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 4869 | + } |
|
| 4870 | + } |
|
| 4871 | + } else {
|
|
| 4872 | + $invalid++; |
|
| 4873 | + geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 4874 | + } |
|
| 4875 | + } |
|
| 4876 | + } |
|
| 4877 | + } |
|
| 4878 | 4878 | |
| 4879 | - $json = array(); |
|
| 4880 | - $json['processed'] = $limit; |
|
| 4881 | - $json['created'] = $created; |
|
| 4882 | - $json['updated'] = $updated; |
|
| 4883 | - $json['skipped'] = $skipped; |
|
| 4884 | - $json['invalid'] = $invalid; |
|
| 4885 | - $json['images'] = $images; |
|
| 4879 | + $json = array(); |
|
| 4880 | + $json['processed'] = $limit; |
|
| 4881 | + $json['created'] = $created; |
|
| 4882 | + $json['updated'] = $updated; |
|
| 4883 | + $json['skipped'] = $skipped; |
|
| 4884 | + $json['invalid'] = $invalid; |
|
| 4885 | + $json['images'] = $images; |
|
| 4886 | 4886 | |
| 4887 | - wp_send_json( $json ); |
|
| 4888 | - } |
|
| 4889 | - } |
|
| 4890 | - break; |
|
| 4891 | - case 'import_finish':{
|
|
| 4892 | - /** |
|
| 4893 | - * Run an action when an import finishes. |
|
| 4894 | - * |
|
| 4895 | - * This action can be used to fire functions after an import ends. |
|
| 4896 | - * |
|
| 4897 | - * @since 1.5.3 |
|
| 4898 | - * @package GeoDirectory |
|
| 4899 | - */ |
|
| 4900 | - do_action('geodir_import_finished');
|
|
| 4901 | - } |
|
| 4902 | - break; |
|
| 4887 | + wp_send_json( $json ); |
|
| 4888 | + } |
|
| 4889 | + } |
|
| 4890 | + break; |
|
| 4891 | + case 'import_finish':{
|
|
| 4892 | + /** |
|
| 4893 | + * Run an action when an import finishes. |
|
| 4894 | + * |
|
| 4895 | + * This action can be used to fire functions after an import ends. |
|
| 4896 | + * |
|
| 4897 | + * @since 1.5.3 |
|
| 4898 | + * @package GeoDirectory |
|
| 4899 | + */ |
|
| 4900 | + do_action('geodir_import_finished');
|
|
| 4901 | + } |
|
| 4902 | + break; |
|
| 4903 | 4903 | |
| 4904 | - } |
|
| 4905 | - echo '0'; |
|
| 4906 | - gd_die(); |
|
| 4904 | + } |
|
| 4905 | + echo '0'; |
|
| 4906 | + gd_die(); |
|
| 4907 | 4907 | } |
| 4908 | 4908 | |
| 4909 | 4909 | /** |
@@ -4947,12 +4947,12 @@ discard block |
||
| 4947 | 4947 | $args['slug'] = wp_unique_term_slug( $args['slug'], (object)$term_args ); |
| 4948 | 4948 | } |
| 4949 | 4949 | |
| 4950 | - if( !empty( $term ) ) {
|
|
| 4950 | + if( !empty( $term ) ) {
|
|
| 4951 | 4951 | $result = wp_insert_term( $term, $taxonomy, $args ); |
| 4952 | - if( !is_wp_error( $result ) ) {
|
|
| 4953 | - return isset( $result['term_id'] ) ? $result['term_id'] : 0; |
|
| 4954 | - } |
|
| 4955 | - } |
|
| 4952 | + if( !is_wp_error( $result ) ) {
|
|
| 4953 | + return isset( $result['term_id'] ) ? $result['term_id'] : 0; |
|
| 4954 | + } |
|
| 4955 | + } |
|
| 4956 | 4956 | |
| 4957 | 4957 | return false; |
| 4958 | 4958 | } |
@@ -4998,16 +4998,16 @@ discard block |
||
| 4998 | 4998 | $result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data ); |
| 4999 | 4999 | |
| 5000 | 5000 | if( !is_wp_error( $result ) ) {
|
| 5001 | - return isset( $result['term_id'] ) ? $result['term_id'] : 0; |
|
| 5002 | - } |
|
| 5001 | + return isset( $result['term_id'] ) ? $result['term_id'] : 0; |
|
| 5002 | + } |
|
| 5003 | 5003 | } else if ( $term_data['slug'] != '' && $term_info = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
|
| 5004 | 5004 | $term_data['term_id'] = $term_info['term_id']; |
| 5005 | 5005 | |
| 5006 | 5006 | $result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data ); |
| 5007 | 5007 | |
| 5008 | 5008 | if( !is_wp_error( $result ) ) {
|
| 5009 | - return isset( $result['term_id'] ) ? $result['term_id'] : 0; |
|
| 5010 | - } |
|
| 5009 | + return isset( $result['term_id'] ) ? $result['term_id'] : 0; |
|
| 5010 | + } |
|
| 5011 | 5011 | } else {
|
| 5012 | 5012 | return geodir_imex_insert_term( $taxonomy, $term_data ); |
| 5013 | 5013 | } |
@@ -5029,47 +5029,47 @@ discard block |
||
| 5029 | 5029 | * @return int Posts count. |
| 5030 | 5030 | */ |
| 5031 | 5031 | function geodir_get_posts_count( $post_type ) {
|
| 5032 | - global $wpdb, $plugin_prefix; |
|
| 5032 | + global $wpdb, $plugin_prefix; |
|
| 5033 | 5033 | |
| 5034 | - if ( !post_type_exists( $post_type ) ) {
|
|
| 5035 | - return 0; |
|
| 5036 | - } |
|
| 5034 | + if ( !post_type_exists( $post_type ) ) {
|
|
| 5035 | + return 0; |
|
| 5036 | + } |
|
| 5037 | 5037 | |
| 5038 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 5038 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
| 5039 | 5039 | |
| 5040 | - // Skip listing with statuses trash, auto-draft etc... |
|
| 5041 | - $skip_statuses = geodir_imex_export_skip_statuses(); |
|
| 5042 | - $where_statuses = ''; |
|
| 5043 | - if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
|
|
| 5044 | - $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
|
|
| 5045 | - } |
|
| 5040 | + // Skip listing with statuses trash, auto-draft etc... |
|
| 5041 | + $skip_statuses = geodir_imex_export_skip_statuses(); |
|
| 5042 | + $where_statuses = ''; |
|
| 5043 | + if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
|
|
| 5044 | + $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
|
|
| 5045 | + } |
|
| 5046 | 5046 | |
| 5047 | - /** |
|
| 5048 | - * Filter the SQL where clause part to filter posts count in import/export. |
|
| 5049 | - * |
|
| 5050 | - * @since 1.6.4 |
|
| 5051 | - * @package GeoDirectory |
|
| 5052 | - * |
|
| 5053 | - * @param string $where SQL where clause part. |
|
| 5054 | - */ |
|
| 5055 | - $where_statuses = apply_filters( 'geodir_get_posts_count', $where_statuses, $post_type ); |
|
| 5056 | - |
|
| 5057 | - $query = $wpdb->prepare( "SELECT COUNT({$wpdb->posts}.ID) FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s " . $where_statuses, $post_type );
|
|
| 5058 | - |
|
| 5059 | - $posts_count = (int)$wpdb->get_var( $query ); |
|
| 5047 | + /** |
|
| 5048 | + * Filter the SQL where clause part to filter posts count in import/export. |
|
| 5049 | + * |
|
| 5050 | + * @since 1.6.4 |
|
| 5051 | + * @package GeoDirectory |
|
| 5052 | + * |
|
| 5053 | + * @param string $where SQL where clause part. |
|
| 5054 | + */ |
|
| 5055 | + $where_statuses = apply_filters( 'geodir_get_posts_count', $where_statuses, $post_type ); |
|
| 5056 | + |
|
| 5057 | + $query = $wpdb->prepare( "SELECT COUNT({$wpdb->posts}.ID) FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s " . $where_statuses, $post_type );
|
|
| 5058 | + |
|
| 5059 | + $posts_count = (int)$wpdb->get_var( $query ); |
|
| 5060 | 5060 | |
| 5061 | - /** |
|
| 5062 | - * Modify returned post counts for the current post type. |
|
| 5063 | - * |
|
| 5064 | - * @since 1.4.6 |
|
| 5065 | - * @package GeoDirectory |
|
| 5066 | - * |
|
| 5067 | - * @param int $posts_count Post counts. |
|
| 5068 | - * @param string $post_type Post type. |
|
| 5069 | - */ |
|
| 5070 | - $posts_count = apply_filters( 'geodir_imex_count_posts', $posts_count, $post_type ); |
|
| 5071 | - |
|
| 5072 | - return $posts_count; |
|
| 5061 | + /** |
|
| 5062 | + * Modify returned post counts for the current post type. |
|
| 5063 | + * |
|
| 5064 | + * @since 1.4.6 |
|
| 5065 | + * @package GeoDirectory |
|
| 5066 | + * |
|
| 5067 | + * @param int $posts_count Post counts. |
|
| 5068 | + * @param string $post_type Post type. |
|
| 5069 | + */ |
|
| 5070 | + $posts_count = apply_filters( 'geodir_imex_count_posts', $posts_count, $post_type ); |
|
| 5071 | + |
|
| 5072 | + return $posts_count; |
|
| 5073 | 5073 | } |
| 5074 | 5074 | |
| 5075 | 5075 | /** |
@@ -5137,7 +5137,7 @@ discard block |
||
| 5137 | 5137 | } |
| 5138 | 5138 | $csv_row[] = 'post_status'; |
| 5139 | 5139 | $csv_row[] = 'is_featured'; |
| 5140 | - // Export claim listing field |
|
| 5140 | + // Export claim listing field |
|
| 5141 | 5141 | if ($is_claim_active) {
|
| 5142 | 5142 | $csv_row[] = 'claimed'; |
| 5143 | 5143 | } |
@@ -5146,7 +5146,7 @@ discard block |
||
| 5146 | 5146 | $csv_row[] = 'alive_days'; |
| 5147 | 5147 | $csv_row[] = 'expire_date'; |
| 5148 | 5148 | } |
| 5149 | - $csv_row[] = 'post_date'; |
|
| 5149 | + $csv_row[] = 'post_date'; |
|
| 5150 | 5150 | $csv_row[] = 'post_address'; |
| 5151 | 5151 | $csv_row[] = 'post_city'; |
| 5152 | 5152 | $csv_row[] = 'post_region'; |
@@ -5154,11 +5154,11 @@ discard block |
||
| 5154 | 5154 | $csv_row[] = 'post_zip'; |
| 5155 | 5155 | $csv_row[] = 'post_latitude'; |
| 5156 | 5156 | $csv_row[] = 'post_longitude'; |
| 5157 | - if ($neighbourhood_active) {
|
|
| 5158 | - $csv_row[] = 'post_neighbourhood'; |
|
| 5159 | - $csv_row[] = 'neighbourhood_latitude'; |
|
| 5160 | - $csv_row[] = 'neighbourhood_longitude'; |
|
| 5161 | - } |
|
| 5157 | + if ($neighbourhood_active) {
|
|
| 5158 | + $csv_row[] = 'post_neighbourhood'; |
|
| 5159 | + $csv_row[] = 'neighbourhood_latitude'; |
|
| 5160 | + $csv_row[] = 'neighbourhood_longitude'; |
|
| 5161 | + } |
|
| 5162 | 5162 | $csv_row[] = 'geodir_timing'; |
| 5163 | 5163 | $csv_row[] = 'geodir_contact'; |
| 5164 | 5164 | $csv_row[] = 'geodir_email'; |
@@ -5193,21 +5193,21 @@ discard block |
||
| 5193 | 5193 | $csv_row[] = 'franchise'; |
| 5194 | 5194 | } |
| 5195 | 5195 | |
| 5196 | - /** |
|
| 5197 | - * Filter columns field names of gd export listings csv. |
|
| 5198 | - * |
|
| 5199 | - * @since 1.6.5 |
|
| 5200 | - * @package GeoDirectory |
|
| 5201 | - * |
|
| 5202 | - * @param array $csv_row Column names being exported in csv. |
|
| 5203 | - * @param string $post_type The post type. |
|
| 5204 | - */ |
|
| 5205 | - $csv_row = apply_filters('geodir_export_listing_csv_column_names', $csv_row, $post_type);
|
|
| 5196 | + /** |
|
| 5197 | + * Filter columns field names of gd export listings csv. |
|
| 5198 | + * |
|
| 5199 | + * @since 1.6.5 |
|
| 5200 | + * @package GeoDirectory |
|
| 5201 | + * |
|
| 5202 | + * @param array $csv_row Column names being exported in csv. |
|
| 5203 | + * @param string $post_type The post type. |
|
| 5204 | + */ |
|
| 5205 | + $csv_row = apply_filters('geodir_export_listing_csv_column_names', $csv_row, $post_type);
|
|
| 5206 | 5206 | |
| 5207 | 5207 | $csv_rows[] = $csv_row; |
| 5208 | 5208 | |
| 5209 | 5209 | $images_count = 5; |
| 5210 | - $xx=0; |
|
| 5210 | + $xx=0; |
|
| 5211 | 5211 | foreach ( $posts as $post ) {$xx++;
|
| 5212 | 5212 | $post_id = $post['ID']; |
| 5213 | 5213 | |
@@ -5338,15 +5338,15 @@ discard block |
||
| 5338 | 5338 | } |
| 5339 | 5339 | $csv_row[] = $post_info['post_status']; // post_status |
| 5340 | 5340 | $csv_row[] = (int)$post_info['is_featured'] == 1 ? 1 : ''; // is_featured |
| 5341 | - if ($is_claim_active) {
|
|
| 5342 | - $csv_row[] = !empty($post_info['claimed']) && (int)$post_info['claimed'] == 1 ? 1 : ''; // claimed |
|
| 5343 | - } |
|
| 5341 | + if ($is_claim_active) {
|
|
| 5342 | + $csv_row[] = !empty($post_info['claimed']) && (int)$post_info['claimed'] == 1 ? 1 : ''; // claimed |
|
| 5343 | + } |
|
| 5344 | 5344 | if ($is_payment_plugin) {
|
| 5345 | 5345 | $csv_row[] = (int)$post_info['package_id']; // package_id |
| 5346 | 5346 | $csv_row[] = $post_info['alive_days'] !== '' ? absint($post_info['alive_days']) : ''; // alive_days |
| 5347 | 5347 | $csv_row[] = $post_info['expire_date'] != '' && geodir_strtolower($post_info['expire_date']) != 'never' ? date_i18n('Y-m-d', strtotime($post_info['expire_date'])) : 'Never'; // expire_date
|
| 5348 | 5348 | } |
| 5349 | - $csv_row[] = $post_info['post_date']; // post_date |
|
| 5349 | + $csv_row[] = $post_info['post_date']; // post_date |
|
| 5350 | 5350 | $csv_row[] = stripslashes($post_info['post_address']); // post_address |
| 5351 | 5351 | $csv_row[] = stripslashes($post_info['post_city']); // post_city |
| 5352 | 5352 | $csv_row[] = stripslashes($post_info['post_region']); // post_region |
@@ -5354,21 +5354,21 @@ discard block |
||
| 5354 | 5354 | $csv_row[] = stripslashes($post_info['post_zip']); // post_zip |
| 5355 | 5355 | $csv_row[] = $post_info['post_latitude']; // post_latitude |
| 5356 | 5356 | $csv_row[] = $post_info['post_longitude']; // post_longitude |
| 5357 | - if ($neighbourhood_active) {
|
|
| 5358 | - $post_neighbourhood = ''; |
|
| 5359 | - $neighbourhood_latitude = ''; |
|
| 5360 | - $neighbourhood_longitude = ''; |
|
| 5361 | - if (!empty($post_info['post_neighbourhood']) && ($hood_info = geodir_location_get_neighbourhood_by_id($post_info['post_neighbourhood'], true, $post_info['post_location_id']))) {
|
|
| 5362 | - if (!empty($hood_info)) {
|
|
| 5363 | - $post_neighbourhood = $hood_info->hood_name; |
|
| 5364 | - $neighbourhood_latitude = $hood_info->hood_latitude; |
|
| 5365 | - $neighbourhood_longitude = $hood_info->hood_longitude; |
|
| 5366 | - } |
|
| 5367 | - } |
|
| 5368 | - $csv_row[] = stripslashes($post_neighbourhood); // post_neighbourhood |
|
| 5369 | - $csv_row[] = $neighbourhood_latitude; // neighbourhood_latitude |
|
| 5370 | - $csv_row[] = $neighbourhood_longitude; // neighbourhood_longitude |
|
| 5371 | - } |
|
| 5357 | + if ($neighbourhood_active) {
|
|
| 5358 | + $post_neighbourhood = ''; |
|
| 5359 | + $neighbourhood_latitude = ''; |
|
| 5360 | + $neighbourhood_longitude = ''; |
|
| 5361 | + if (!empty($post_info['post_neighbourhood']) && ($hood_info = geodir_location_get_neighbourhood_by_id($post_info['post_neighbourhood'], true, $post_info['post_location_id']))) {
|
|
| 5362 | + if (!empty($hood_info)) {
|
|
| 5363 | + $post_neighbourhood = $hood_info->hood_name; |
|
| 5364 | + $neighbourhood_latitude = $hood_info->hood_latitude; |
|
| 5365 | + $neighbourhood_longitude = $hood_info->hood_longitude; |
|
| 5366 | + } |
|
| 5367 | + } |
|
| 5368 | + $csv_row[] = stripslashes($post_neighbourhood); // post_neighbourhood |
|
| 5369 | + $csv_row[] = $neighbourhood_latitude; // neighbourhood_latitude |
|
| 5370 | + $csv_row[] = $neighbourhood_longitude; // neighbourhood_longitude |
|
| 5371 | + } |
|
| 5372 | 5372 | $csv_row[] = stripslashes($post_info['geodir_timing']); // geodir_timing |
| 5373 | 5373 | $csv_row[] = stripslashes($post_info['geodir_contact']); // geodir_contact |
| 5374 | 5374 | $csv_row[] = stripslashes($post_info['geodir_email']); // geodir_email |
@@ -5411,16 +5411,16 @@ discard block |
||
| 5411 | 5411 | $csv_row[] = (int)$franchise; // franchise id |
| 5412 | 5412 | } |
| 5413 | 5413 | |
| 5414 | - /** |
|
| 5415 | - * Filter columns values of gd export listings csv file |
|
| 5416 | - * |
|
| 5417 | - * @since 1.6.5 |
|
| 5418 | - * @package GeoDirectory |
|
| 5419 | - * |
|
| 5420 | - * @param array $csv_row Field values being exported in csv. |
|
| 5421 | - * @param array $post_info The post info. |
|
| 5422 | - */ |
|
| 5423 | - $csv_row = apply_filters('geodir_export_listing_csv_column_values', $csv_row, $post_info);
|
|
| 5414 | + /** |
|
| 5415 | + * Filter columns values of gd export listings csv file |
|
| 5416 | + * |
|
| 5417 | + * @since 1.6.5 |
|
| 5418 | + * @package GeoDirectory |
|
| 5419 | + * |
|
| 5420 | + * @param array $csv_row Field values being exported in csv. |
|
| 5421 | + * @param array $post_info The post info. |
|
| 5422 | + */ |
|
| 5423 | + $csv_row = apply_filters('geodir_export_listing_csv_column_values', $csv_row, $post_info);
|
|
| 5424 | 5424 | |
| 5425 | 5425 | for ( $c = 0; $c < $images_count; $c++ ) {
|
| 5426 | 5426 | $csv_row[] = isset( $current_images[$c] ) ? $current_images[$c] : ''; // IMAGE |
@@ -5453,64 +5453,64 @@ discard block |
||
| 5453 | 5453 | * @return array Array of posts data. |
| 5454 | 5454 | */ |
| 5455 | 5455 | function geodir_get_export_posts( $post_type, $per_page = 0, $page_no = 0 ) {
|
| 5456 | - global $wpdb, $plugin_prefix; |
|
| 5456 | + global $wpdb, $plugin_prefix; |
|
| 5457 | 5457 | |
| 5458 | - if ( ! post_type_exists( $post_type ) ) |
|
| 5459 | - return new stdClass; |
|
| 5458 | + if ( ! post_type_exists( $post_type ) ) |
|
| 5459 | + return new stdClass; |
|
| 5460 | 5460 | |
| 5461 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 5461 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
| 5462 | 5462 | |
| 5463 | - $limit = ''; |
|
| 5464 | - if ( $per_page > 0 && $page_no > 0 ) {
|
|
| 5465 | - $offset = ( $page_no - 1 ) * $per_page; |
|
| 5463 | + $limit = ''; |
|
| 5464 | + if ( $per_page > 0 && $page_no > 0 ) {
|
|
| 5465 | + $offset = ( $page_no - 1 ) * $per_page; |
|
| 5466 | 5466 | |
| 5467 | - if ( $offset > 0 ) {
|
|
| 5468 | - $limit = " LIMIT " . $offset . "," . $per_page; |
|
| 5469 | - } else {
|
|
| 5470 | - $limit = " LIMIT " . $per_page; |
|
| 5471 | - } |
|
| 5472 | - } |
|
| 5467 | + if ( $offset > 0 ) {
|
|
| 5468 | + $limit = " LIMIT " . $offset . "," . $per_page; |
|
| 5469 | + } else {
|
|
| 5470 | + $limit = " LIMIT " . $per_page; |
|
| 5471 | + } |
|
| 5472 | + } |
|
| 5473 | 5473 | |
| 5474 | - // Skip listing with statuses trash, auto-draft etc... |
|
| 5475 | - $skip_statuses = geodir_imex_export_skip_statuses(); |
|
| 5476 | - $where_statuses = ''; |
|
| 5477 | - if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
|
|
| 5478 | - $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
|
|
| 5479 | - } |
|
| 5474 | + // Skip listing with statuses trash, auto-draft etc... |
|
| 5475 | + $skip_statuses = geodir_imex_export_skip_statuses(); |
|
| 5476 | + $where_statuses = ''; |
|
| 5477 | + if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
|
|
| 5478 | + $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
|
|
| 5479 | + } |
|
| 5480 | 5480 | |
| 5481 | - /** |
|
| 5482 | - * Filter the SQL where clause part to filter posts in import/export. |
|
| 5483 | - * |
|
| 5484 | - * @since 1.6.4 |
|
| 5485 | - * @package GeoDirectory |
|
| 5486 | - * |
|
| 5487 | - * @param string $where SQL where clause part. |
|
| 5488 | - */ |
|
| 5489 | - $where_statuses = apply_filters( 'geodir_get_export_posts', $where_statuses, $post_type ); |
|
| 5490 | - |
|
| 5491 | - $query = $wpdb->prepare( "SELECT {$wpdb->posts}.ID FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s " . $where_statuses . " ORDER BY {$wpdb->posts}.ID ASC" . $limit, $post_type );
|
|
| 5492 | - /** |
|
| 5493 | - * Modify returned posts SQL query for the current post type. |
|
| 5494 | - * |
|
| 5495 | - * @since 1.4.6 |
|
| 5496 | - * @package GeoDirectory |
|
| 5497 | - * |
|
| 5498 | - * @param int $query The SQL query. |
|
| 5499 | - * @param string $post_type Post type. |
|
| 5500 | - */ |
|
| 5501 | - $query = apply_filters( 'geodir_imex_export_posts_query', $query, $post_type ); |
|
| 5502 | - $results = (array)$wpdb->get_results( $query, ARRAY_A ); |
|
| 5503 | - |
|
| 5504 | - /** |
|
| 5505 | - * Modify returned post results for the current post type. |
|
| 5506 | - * |
|
| 5507 | - * @since 1.4.6 |
|
| 5508 | - * @package GeoDirectory |
|
| 5509 | - * |
|
| 5510 | - * @param object $results An object containing all post ids. |
|
| 5511 | - * @param string $post_type Post type. |
|
| 5512 | - */ |
|
| 5513 | - return apply_filters( 'geodir_export_posts', $results, $post_type ); |
|
| 5481 | + /** |
|
| 5482 | + * Filter the SQL where clause part to filter posts in import/export. |
|
| 5483 | + * |
|
| 5484 | + * @since 1.6.4 |
|
| 5485 | + * @package GeoDirectory |
|
| 5486 | + * |
|
| 5487 | + * @param string $where SQL where clause part. |
|
| 5488 | + */ |
|
| 5489 | + $where_statuses = apply_filters( 'geodir_get_export_posts', $where_statuses, $post_type ); |
|
| 5490 | + |
|
| 5491 | + $query = $wpdb->prepare( "SELECT {$wpdb->posts}.ID FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s " . $where_statuses . " ORDER BY {$wpdb->posts}.ID ASC" . $limit, $post_type );
|
|
| 5492 | + /** |
|
| 5493 | + * Modify returned posts SQL query for the current post type. |
|
| 5494 | + * |
|
| 5495 | + * @since 1.4.6 |
|
| 5496 | + * @package GeoDirectory |
|
| 5497 | + * |
|
| 5498 | + * @param int $query The SQL query. |
|
| 5499 | + * @param string $post_type Post type. |
|
| 5500 | + */ |
|
| 5501 | + $query = apply_filters( 'geodir_imex_export_posts_query', $query, $post_type ); |
|
| 5502 | + $results = (array)$wpdb->get_results( $query, ARRAY_A ); |
|
| 5503 | + |
|
| 5504 | + /** |
|
| 5505 | + * Modify returned post results for the current post type. |
|
| 5506 | + * |
|
| 5507 | + * @since 1.4.6 |
|
| 5508 | + * @package GeoDirectory |
|
| 5509 | + * |
|
| 5510 | + * @param object $results An object containing all post ids. |
|
| 5511 | + * @param string $post_type Post type. |
|
| 5512 | + */ |
|
| 5513 | + return apply_filters( 'geodir_export_posts', $results, $post_type ); |
|
| 5514 | 5514 | } |
| 5515 | 5515 | |
| 5516 | 5516 | /** |
@@ -5529,26 +5529,26 @@ discard block |
||
| 5529 | 5529 | * @return string The SQL query. |
| 5530 | 5530 | */ |
| 5531 | 5531 | function geodir_imex_get_events_query( $query, $post_type ) {
|
| 5532 | - if ( $post_type == 'gd_event' ) {
|
|
| 5533 | - global $wpdb, $plugin_prefix; |
|
| 5532 | + if ( $post_type == 'gd_event' ) {
|
|
| 5533 | + global $wpdb, $plugin_prefix; |
|
| 5534 | 5534 | |
| 5535 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 5536 | - $schedule_table = EVENT_SCHEDULE; |
|
| 5535 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
| 5536 | + $schedule_table = EVENT_SCHEDULE; |
|
| 5537 | 5537 | |
| 5538 | - // Skip listing with statuses trash, auto-draft etc... |
|
| 5539 | - $skip_statuses = geodir_imex_export_skip_statuses(); |
|
| 5540 | - $where_statuses = ''; |
|
| 5541 | - if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
|
|
| 5542 | - $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
|
|
| 5543 | - } |
|
| 5538 | + // Skip listing with statuses trash, auto-draft etc... |
|
| 5539 | + $skip_statuses = geodir_imex_export_skip_statuses(); |
|
| 5540 | + $where_statuses = ''; |
|
| 5541 | + if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
|
|
| 5542 | + $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
|
|
| 5543 | + } |
|
| 5544 | 5544 | |
| 5545 | - /** This action is documented in geodirectory-functions/geodirectory-admin/admin_functions.php */ |
|
| 5546 | - $where_statuses = apply_filters( 'geodir_get_export_posts', $where_statuses, $post_type ); |
|
| 5545 | + /** This action is documented in geodirectory-functions/geodirectory-admin/admin_functions.php */ |
|
| 5546 | + $where_statuses = apply_filters( 'geodir_get_export_posts', $where_statuses, $post_type ); |
|
| 5547 | 5547 | |
| 5548 | - $query = $wpdb->prepare( "SELECT {$wpdb->posts}.ID, {$schedule_table}.event_date, {$schedule_table}.event_enddate AS enddate, {$schedule_table}.event_starttime AS starttime, {$schedule_table}.event_endtime AS endtime FROM {$wpdb->posts} INNER JOIN {$table} ON ({$table}.post_id = {$wpdb->posts}.ID) INNER JOIN {$schedule_table} ON ({$schedule_table}.event_id = {$wpdb->posts}.ID) WHERE {$wpdb->posts}.post_type = %s " . $where_statuses . " GROUP BY {$table}.post_id ORDER BY {$wpdb->posts}.ID ASC, {$schedule_table}.schedule_id ASC", $post_type );
|
|
| 5549 | - } |
|
| 5548 | + $query = $wpdb->prepare( "SELECT {$wpdb->posts}.ID, {$schedule_table}.event_date, {$schedule_table}.event_enddate AS enddate, {$schedule_table}.event_starttime AS starttime, {$schedule_table}.event_endtime AS endtime FROM {$wpdb->posts} INNER JOIN {$table} ON ({$table}.post_id = {$wpdb->posts}.ID) INNER JOIN {$schedule_table} ON ({$schedule_table}.event_id = {$wpdb->posts}.ID) WHERE {$wpdb->posts}.post_type = %s " . $where_statuses . " GROUP BY {$table}.post_id ORDER BY {$wpdb->posts}.ID ASC, {$schedule_table}.schedule_id ASC", $post_type );
|
|
| 5549 | + } |
|
| 5550 | 5550 | |
| 5551 | - return $query; |
|
| 5551 | + return $query; |
|
| 5552 | 5552 | } |
| 5553 | 5553 | |
| 5554 | 5554 | /** |
@@ -5570,36 +5570,36 @@ discard block |
||
| 5570 | 5570 | * @return int Total terms count. |
| 5571 | 5571 | */ |
| 5572 | 5572 | function geodir_get_terms_count( $post_type ) {
|
| 5573 | - $args = array( 'hide_empty' => 0 ); |
|
| 5573 | + $args = array( 'hide_empty' => 0 ); |
|
| 5574 | 5574 | |
| 5575 | - remove_all_filters( 'get_terms' ); |
|
| 5575 | + remove_all_filters( 'get_terms' ); |
|
| 5576 | 5576 | |
| 5577 | - $taxonomy = $post_type . 'category'; |
|
| 5577 | + $taxonomy = $post_type . 'category'; |
|
| 5578 | 5578 | |
| 5579 | - // WPML |
|
| 5580 | - $is_wpml = geodir_is_wpml(); |
|
| 5581 | - $active_lang = 'all'; |
|
| 5582 | - if ( $is_wpml ) {
|
|
| 5583 | - global $sitepress; |
|
| 5584 | - $active_lang = $sitepress->get_current_language(); |
|
| 5579 | + // WPML |
|
| 5580 | + $is_wpml = geodir_is_wpml(); |
|
| 5581 | + $active_lang = 'all'; |
|
| 5582 | + if ( $is_wpml ) {
|
|
| 5583 | + global $sitepress; |
|
| 5584 | + $active_lang = $sitepress->get_current_language(); |
|
| 5585 | 5585 | |
| 5586 | - if ( $active_lang != 'all' ) {
|
|
| 5587 | - $sitepress->switch_lang( 'all', true ); |
|
| 5588 | - } |
|
| 5589 | - } |
|
| 5590 | - // WPML |
|
| 5586 | + if ( $active_lang != 'all' ) {
|
|
| 5587 | + $sitepress->switch_lang( 'all', true ); |
|
| 5588 | + } |
|
| 5589 | + } |
|
| 5590 | + // WPML |
|
| 5591 | 5591 | |
| 5592 | - $count_terms = wp_count_terms( $taxonomy, $args ); |
|
| 5592 | + $count_terms = wp_count_terms( $taxonomy, $args ); |
|
| 5593 | 5593 | |
| 5594 | - // WPML |
|
| 5595 | - if ( $is_wpml && $active_lang !== 'all' ) {
|
|
| 5596 | - global $sitepress; |
|
| 5597 | - $sitepress->switch_lang( $active_lang, true ); |
|
| 5598 | - } |
|
| 5599 | - // WPML |
|
| 5600 | - $count_terms = !is_wp_error( $count_terms ) ? $count_terms : 0; |
|
| 5594 | + // WPML |
|
| 5595 | + if ( $is_wpml && $active_lang !== 'all' ) {
|
|
| 5596 | + global $sitepress; |
|
| 5597 | + $sitepress->switch_lang( $active_lang, true ); |
|
| 5598 | + } |
|
| 5599 | + // WPML |
|
| 5600 | + $count_terms = !is_wp_error( $count_terms ) ? $count_terms : 0; |
|
| 5601 | 5601 | |
| 5602 | - return $count_terms; |
|
| 5602 | + return $count_terms; |
|
| 5603 | 5603 | } |
| 5604 | 5604 | |
| 5605 | 5605 | /** |
@@ -5638,11 +5638,11 @@ discard block |
||
| 5638 | 5638 | $csv_row[] = 'cat_posttype'; |
| 5639 | 5639 | $csv_row[] = 'cat_parent'; |
| 5640 | 5640 | $csv_row[] = 'cat_schema'; |
| 5641 | - // WPML |
|
| 5641 | + // WPML |
|
| 5642 | 5642 | $is_wpml = geodir_wpml_is_taxonomy_translated( $taxonomy ); |
| 5643 | 5643 | if ($is_wpml) {
|
| 5644 | 5644 | $csv_row[] = 'cat_language'; |
| 5645 | - $csv_row[] = 'cat_id_original'; |
|
| 5645 | + $csv_row[] = 'cat_id_original'; |
|
| 5646 | 5646 | } |
| 5647 | 5647 | // WPML |
| 5648 | 5648 | $csv_row[] = 'cat_description'; |
@@ -5672,10 +5672,10 @@ discard block |
||
| 5672 | 5672 | $csv_row[] = $post_type; |
| 5673 | 5673 | $csv_row[] = $cat_parent; |
| 5674 | 5674 | $csv_row[] = geodir_get_tax_meta( $term->term_id, 'ct_cat_schema', false, $post_type ); |
| 5675 | - // WPML |
|
| 5675 | + // WPML |
|
| 5676 | 5676 | if ($is_wpml) {
|
| 5677 | 5677 | $csv_row[] = geodir_get_language_for_element( $term->term_id, 'tax_' . $taxonomy ); |
| 5678 | - $csv_row[] = geodir_imex_original_post_id( $term->term_id, 'tax_' . $taxonomy ); |
|
| 5678 | + $csv_row[] = geodir_imex_original_post_id( $term->term_id, 'tax_' . $taxonomy ); |
|
| 5679 | 5679 | } |
| 5680 | 5680 | // WPML |
| 5681 | 5681 | $csv_row[] = $term->description; |
@@ -6093,43 +6093,43 @@ discard block |
||
| 6093 | 6093 | * @param string $status Post status. |
| 6094 | 6094 | */ |
| 6095 | 6095 | function geodir_create_page($slug, $option, $page_title = '', $page_content = '', $post_parent = 0, $status = 'publish') {
|
| 6096 | - global $wpdb, $current_user; |
|
| 6097 | - |
|
| 6098 | - $option_value = get_option($option); |
|
| 6099 | - |
|
| 6100 | - if ($option_value > 0) : |
|
| 6101 | - if (get_post($option_value)) : |
|
| 6102 | - // Page exists |
|
| 6103 | - return; |
|
| 6104 | - endif; |
|
| 6105 | - endif; |
|
| 6106 | - |
|
| 6107 | - $page_found = $wpdb->get_var( |
|
| 6108 | - $wpdb->prepare( |
|
| 6109 | - "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;", |
|
| 6110 | - array($slug) |
|
| 6111 | - ) |
|
| 6112 | - ); |
|
| 6113 | - |
|
| 6114 | - if ($page_found) : |
|
| 6115 | - // Page exists |
|
| 6116 | - if (!$option_value) update_option($option, $page_found); |
|
| 6117 | - return; |
|
| 6118 | - endif; |
|
| 6119 | - |
|
| 6120 | - $page_data = array( |
|
| 6121 | - 'post_status' => $status, |
|
| 6122 | - 'post_type' => 'page', |
|
| 6123 | - 'post_author' => $current_user->ID, |
|
| 6124 | - 'post_name' => $slug, |
|
| 6125 | - 'post_title' => $page_title, |
|
| 6126 | - 'post_content' => $page_content, |
|
| 6127 | - 'post_parent' => $post_parent, |
|
| 6128 | - 'comment_status' => 'closed' |
|
| 6129 | - ); |
|
| 6130 | - $page_id = wp_insert_post($page_data); |
|
| 6131 | - |
|
| 6132 | - add_option($option, $page_id); |
|
| 6096 | + global $wpdb, $current_user; |
|
| 6097 | + |
|
| 6098 | + $option_value = get_option($option); |
|
| 6099 | + |
|
| 6100 | + if ($option_value > 0) : |
|
| 6101 | + if (get_post($option_value)) : |
|
| 6102 | + // Page exists |
|
| 6103 | + return; |
|
| 6104 | + endif; |
|
| 6105 | + endif; |
|
| 6106 | + |
|
| 6107 | + $page_found = $wpdb->get_var( |
|
| 6108 | + $wpdb->prepare( |
|
| 6109 | + "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;", |
|
| 6110 | + array($slug) |
|
| 6111 | + ) |
|
| 6112 | + ); |
|
| 6113 | + |
|
| 6114 | + if ($page_found) : |
|
| 6115 | + // Page exists |
|
| 6116 | + if (!$option_value) update_option($option, $page_found); |
|
| 6117 | + return; |
|
| 6118 | + endif; |
|
| 6119 | + |
|
| 6120 | + $page_data = array( |
|
| 6121 | + 'post_status' => $status, |
|
| 6122 | + 'post_type' => 'page', |
|
| 6123 | + 'post_author' => $current_user->ID, |
|
| 6124 | + 'post_name' => $slug, |
|
| 6125 | + 'post_title' => $page_title, |
|
| 6126 | + 'post_content' => $page_content, |
|
| 6127 | + 'post_parent' => $post_parent, |
|
| 6128 | + 'comment_status' => 'closed' |
|
| 6129 | + ); |
|
| 6130 | + $page_id = wp_insert_post($page_data); |
|
| 6131 | + |
|
| 6132 | + add_option($option, $page_id); |
|
| 6133 | 6133 | |
| 6134 | 6134 | } |
| 6135 | 6135 | |
@@ -6160,9 +6160,9 @@ discard block |
||
| 6160 | 6160 | * @package GeoDirectory |
| 6161 | 6161 | */ |
| 6162 | 6162 | function geodir_admin_upgrade_notice() {
|
| 6163 | - $class = "error"; |
|
| 6164 | - $message = __("Please update core GeoDirectory or some addons may not function correctly.","geodirectory");
|
|
| 6165 | - echo"<div class=\"$class\"> <p>$message</p></div>"; |
|
| 6163 | + $class = "error"; |
|
| 6164 | + $message = __("Please update core GeoDirectory or some addons may not function correctly.","geodirectory");
|
|
| 6165 | + echo"<div class=\"$class\"> <p>$message</p></div>"; |
|
| 6166 | 6166 | } |
| 6167 | 6167 | |
| 6168 | 6168 | /** |
@@ -6175,18 +6175,18 @@ discard block |
||
| 6175 | 6175 | */ |
| 6176 | 6176 | function geodire_admin_upgrade_notice( $plugin_data, $r ) |
| 6177 | 6177 | {
|
| 6178 | - // readme contents |
|
| 6179 | - $args = array( |
|
| 6180 | - 'timeout' => 15, |
|
| 6181 | - 'redirection' => 5 |
|
| 6182 | - ); |
|
| 6183 | - $url = "http://plugins.svn.wordpress.org/geodirectory/trunk/readme.txt"; |
|
| 6184 | - $data = wp_remote_get( $url, $args ); |
|
| 6178 | + // readme contents |
|
| 6179 | + $args = array( |
|
| 6180 | + 'timeout' => 15, |
|
| 6181 | + 'redirection' => 5 |
|
| 6182 | + ); |
|
| 6183 | + $url = "http://plugins.svn.wordpress.org/geodirectory/trunk/readme.txt"; |
|
| 6184 | + $data = wp_remote_get( $url, $args ); |
|
| 6185 | 6185 | |
| 6186 | - if (!is_wp_error($data) && $data['response']['code'] == 200) {
|
|
| 6186 | + if (!is_wp_error($data) && $data['response']['code'] == 200) {
|
|
| 6187 | 6187 | |
| 6188 | - geodir_in_plugin_update_message($data['body']); |
|
| 6189 | - } |
|
| 6188 | + geodir_in_plugin_update_message($data['body']); |
|
| 6189 | + } |
|
| 6190 | 6190 | } |
| 6191 | 6191 | |
| 6192 | 6192 | |
@@ -6194,28 +6194,28 @@ discard block |
||
| 6194 | 6194 | * @param string $content http response body |
| 6195 | 6195 | */ |
| 6196 | 6196 | function geodir_in_plugin_update_message($content) {
|
| 6197 | - // Output Upgrade Notice |
|
| 6198 | - $matches = null; |
|
| 6199 | - $regexp = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( GEODIRECTORY_VERSION ) . '\s*=|$)~Uis'; |
|
| 6200 | - $upgrade_notice = ''; |
|
| 6201 | - if ( preg_match( $regexp, $content, $matches ) ) {
|
|
| 6202 | - if(empty($matches)){return;}
|
|
| 6203 | - |
|
| 6204 | - $version = trim( $matches[1] ); |
|
| 6205 | - if($version && $version>GEODIRECTORY_VERSION){
|
|
| 6206 | - |
|
| 6207 | - |
|
| 6208 | - $notices = (array) preg_split('~[\r\n]+~', trim( $matches[2] ) );
|
|
| 6209 | - if ( version_compare( GEODIRECTORY_VERSION, $version, '<' ) ) {
|
|
| 6210 | - $upgrade_notice .= '<div class="geodir_plugin_upgrade_notice">'; |
|
| 6211 | - foreach ( $notices as $index => $line ) {
|
|
| 6212 | - $upgrade_notice .= wp_kses_post( preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line ) );
|
|
| 6213 | - } |
|
| 6214 | - $upgrade_notice .= '</div> '; |
|
| 6215 | - } |
|
| 6216 | - } |
|
| 6217 | - } |
|
| 6218 | - echo $upgrade_notice; |
|
| 6197 | + // Output Upgrade Notice |
|
| 6198 | + $matches = null; |
|
| 6199 | + $regexp = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( GEODIRECTORY_VERSION ) . '\s*=|$)~Uis'; |
|
| 6200 | + $upgrade_notice = ''; |
|
| 6201 | + if ( preg_match( $regexp, $content, $matches ) ) {
|
|
| 6202 | + if(empty($matches)){return;}
|
|
| 6203 | + |
|
| 6204 | + $version = trim( $matches[1] ); |
|
| 6205 | + if($version && $version>GEODIRECTORY_VERSION){
|
|
| 6206 | + |
|
| 6207 | + |
|
| 6208 | + $notices = (array) preg_split('~[\r\n]+~', trim( $matches[2] ) );
|
|
| 6209 | + if ( version_compare( GEODIRECTORY_VERSION, $version, '<' ) ) {
|
|
| 6210 | + $upgrade_notice .= '<div class="geodir_plugin_upgrade_notice">'; |
|
| 6211 | + foreach ( $notices as $index => $line ) {
|
|
| 6212 | + $upgrade_notice .= wp_kses_post( preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line ) );
|
|
| 6213 | + } |
|
| 6214 | + $upgrade_notice .= '</div> '; |
|
| 6215 | + } |
|
| 6216 | + } |
|
| 6217 | + } |
|
| 6218 | + echo $upgrade_notice; |
|
| 6219 | 6219 | } |
| 6220 | 6220 | |
| 6221 | 6221 | /** |
@@ -6248,19 +6248,19 @@ discard block |
||
| 6248 | 6248 | * @param array Listing statuses to be skipped. |
| 6249 | 6249 | */ |
| 6250 | 6250 | function geodir_imex_export_skip_statuses() {
|
| 6251 | - $statuses = array( 'trash', 'auto-draft' ); |
|
| 6251 | + $statuses = array( 'trash', 'auto-draft' ); |
|
| 6252 | 6252 | |
| 6253 | - /** |
|
| 6254 | - * Filter the statuses to skip during GD export listings. |
|
| 6255 | - * |
|
| 6256 | - * @since 1.6.0 |
|
| 6257 | - * @package GeoDirectory |
|
| 6258 | - * |
|
| 6259 | - * @param array $statuses Listing statuses to be skipped. |
|
| 6260 | - */ |
|
| 6261 | - $statuses = apply_filters( 'geodir_imex_export_skip_statuses', $statuses ); |
|
| 6253 | + /** |
|
| 6254 | + * Filter the statuses to skip during GD export listings. |
|
| 6255 | + * |
|
| 6256 | + * @since 1.6.0 |
|
| 6257 | + * @package GeoDirectory |
|
| 6258 | + * |
|
| 6259 | + * @param array $statuses Listing statuses to be skipped. |
|
| 6260 | + */ |
|
| 6261 | + $statuses = apply_filters( 'geodir_imex_export_skip_statuses', $statuses ); |
|
| 6262 | 6262 | |
| 6263 | - return $statuses; |
|
| 6263 | + return $statuses; |
|
| 6264 | 6264 | } |
| 6265 | 6265 | |
| 6266 | 6266 | /** |
@@ -6276,42 +6276,42 @@ discard block |
||
| 6276 | 6276 | * @global string $typenow Current post type. |
| 6277 | 6277 | */ |
| 6278 | 6278 | function geodir_admin_dequeue_scripts() {
|
| 6279 | - global $typenow; |
|
| 6279 | + global $typenow; |
|
| 6280 | 6280 | |
| 6281 | - // EDD |
|
| 6282 | - if (wp_script_is('jquery-chosen', 'enqueued')) {
|
|
| 6283 | - wp_dequeue_script('jquery-chosen');
|
|
| 6284 | - } |
|
| 6281 | + // EDD |
|
| 6282 | + if (wp_script_is('jquery-chosen', 'enqueued')) {
|
|
| 6283 | + wp_dequeue_script('jquery-chosen');
|
|
| 6284 | + } |
|
| 6285 | 6285 | |
| 6286 | - // Ultimate Addons for Visual Composer |
|
| 6287 | - if (wp_script_is('ultimate-vc-backend-script', 'enqueued')) {
|
|
| 6288 | - wp_dequeue_script('ultimate-vc-backend-script');
|
|
| 6289 | - } |
|
| 6286 | + // Ultimate Addons for Visual Composer |
|
| 6287 | + if (wp_script_is('ultimate-vc-backend-script', 'enqueued')) {
|
|
| 6288 | + wp_dequeue_script('ultimate-vc-backend-script');
|
|
| 6289 | + } |
|
| 6290 | 6290 | |
| 6291 | - // VC editor conflicts |
|
| 6292 | - if (class_exists('Vc_Role_Access_Controller') && wp_script_is('dfd_vc_damin_scripts', 'enqueued')) {
|
|
| 6293 | - wp_dequeue_script('dfd_vc_damin_scripts');
|
|
| 6294 | - } |
|
| 6291 | + // VC editor conflicts |
|
| 6292 | + if (class_exists('Vc_Role_Access_Controller') && wp_script_is('dfd_vc_damin_scripts', 'enqueued')) {
|
|
| 6293 | + wp_dequeue_script('dfd_vc_damin_scripts');
|
|
| 6294 | + } |
|
| 6295 | 6295 | |
| 6296 | - // Ultimate chosen |
|
| 6297 | - if (wp_script_is('ultimate-chosen-script', 'enqueued')) {
|
|
| 6298 | - wp_dequeue_script('ultimate-chosen-script');
|
|
| 6299 | - } |
|
| 6296 | + // Ultimate chosen |
|
| 6297 | + if (wp_script_is('ultimate-chosen-script', 'enqueued')) {
|
|
| 6298 | + wp_dequeue_script('ultimate-chosen-script');
|
|
| 6299 | + } |
|
| 6300 | 6300 | |
| 6301 | - // Crum composer choosen |
|
| 6302 | - if (wp_script_is('crum-composer-choosen', 'enqueued')) {
|
|
| 6303 | - wp_dequeue_script('crum-composer-choosen');
|
|
| 6304 | - } |
|
| 6301 | + // Crum composer choosen |
|
| 6302 | + if (wp_script_is('crum-composer-choosen', 'enqueued')) {
|
|
| 6303 | + wp_dequeue_script('crum-composer-choosen');
|
|
| 6304 | + } |
|
| 6305 | 6305 | |
| 6306 | - // Fix conflict Fusion Builder jquery chosen with GD jquery chosen. |
|
| 6307 | - if (class_exists('FusionBuilder') && wp_script_is('fusion_builder_chosen_js', 'enqueued')) {
|
|
| 6308 | - wp_dequeue_script('fusion_builder_chosen_js');
|
|
| 6309 | - } |
|
| 6306 | + // Fix conflict Fusion Builder jquery chosen with GD jquery chosen. |
|
| 6307 | + if (class_exists('FusionBuilder') && wp_script_is('fusion_builder_chosen_js', 'enqueued')) {
|
|
| 6308 | + wp_dequeue_script('fusion_builder_chosen_js');
|
|
| 6309 | + } |
|
| 6310 | 6310 | |
| 6311 | - // Fix conflicts timepicker & setting date value. |
|
| 6312 | - if (class_exists('acf') && wp_script_is('acf-timepicker', 'enqueued')) {
|
|
| 6313 | - wp_dequeue_script('acf-timepicker');
|
|
| 6314 | - } |
|
| 6311 | + // Fix conflicts timepicker & setting date value. |
|
| 6312 | + if (class_exists('acf') && wp_script_is('acf-timepicker', 'enqueued')) {
|
|
| 6313 | + wp_dequeue_script('acf-timepicker');
|
|
| 6314 | + } |
|
| 6315 | 6315 | } |
| 6316 | 6316 | |
| 6317 | 6317 | /** |
@@ -6327,48 +6327,48 @@ discard block |
||
| 6327 | 6327 | * @return string SQL where clause part. |
| 6328 | 6328 | */ |
| 6329 | 6329 | function geodir_imex_get_filter_where($where = '', $post_type = '') {
|
| 6330 | - global $wpdb; |
|
| 6330 | + global $wpdb; |
|
| 6331 | 6331 | |
| 6332 | - $filters = !empty( $_REQUEST['gd_imex'] ) && is_array( $_REQUEST['gd_imex'] ) ? $_REQUEST['gd_imex'] : NULL; |
|
| 6332 | + $filters = !empty( $_REQUEST['gd_imex'] ) && is_array( $_REQUEST['gd_imex'] ) ? $_REQUEST['gd_imex'] : NULL; |
|
| 6333 | 6333 | |
| 6334 | - if ( !empty( $filters ) ) {
|
|
| 6335 | - foreach ( $filters as $field => $value ) {
|
|
| 6336 | - switch ($field) {
|
|
| 6337 | - case 'start_date': |
|
| 6338 | - $where .= " AND `" . $wpdb->posts . "`.`post_date` >= '" . sanitize_text_field( $value ) . " 00:00:00'"; |
|
| 6339 | - break; |
|
| 6340 | - case 'end_date': |
|
| 6341 | - $where .= " AND `" . $wpdb->posts . "`.`post_date` <= '" . sanitize_text_field( $value ) . " 23:59:59'"; |
|
| 6342 | - break; |
|
| 6343 | - } |
|
| 6344 | - } |
|
| 6345 | - } |
|
| 6334 | + if ( !empty( $filters ) ) {
|
|
| 6335 | + foreach ( $filters as $field => $value ) {
|
|
| 6336 | + switch ($field) {
|
|
| 6337 | + case 'start_date': |
|
| 6338 | + $where .= " AND `" . $wpdb->posts . "`.`post_date` >= '" . sanitize_text_field( $value ) . " 00:00:00'"; |
|
| 6339 | + break; |
|
| 6340 | + case 'end_date': |
|
| 6341 | + $where .= " AND `" . $wpdb->posts . "`.`post_date` <= '" . sanitize_text_field( $value ) . " 23:59:59'"; |
|
| 6342 | + break; |
|
| 6343 | + } |
|
| 6344 | + } |
|
| 6345 | + } |
|
| 6346 | 6346 | |
| 6347 | - return $where; |
|
| 6347 | + return $where; |
|
| 6348 | 6348 | } |
| 6349 | 6349 | add_filter('geodir_get_posts_count', 'geodir_imex_get_filter_where', 10, 2);
|
| 6350 | 6350 | add_filter('geodir_get_export_posts', 'geodir_imex_get_filter_where', 10, 2);
|
| 6351 | 6351 | |
| 6352 | 6352 | |
| 6353 | 6353 | function geodir_fix_for_primer_theme(){
|
| 6354 | - if(!defined( 'PRIMER_VERSION' )){return;}
|
|
| 6355 | - global $pagenow; |
|
| 6354 | + if(!defined( 'PRIMER_VERSION' )){return;}
|
|
| 6355 | + global $pagenow; |
|
| 6356 | 6356 | |
| 6357 | - if ( ( 'post.php' === $pagenow || 'post-new.php' === $pagenow ) && (isset($_REQUEST['post_type']) || isset($_REQUEST['post']) ) ){
|
|
| 6357 | + if ( ( 'post.php' === $pagenow || 'post-new.php' === $pagenow ) && (isset($_REQUEST['post_type']) || isset($_REQUEST['post']) ) ){
|
|
| 6358 | 6358 | |
| 6359 | - $post_type = isset($_REQUEST['post_type']) ? esc_attr($_REQUEST['post_type']) : get_post_type( $_GET['post'] ); |
|
| 6359 | + $post_type = isset($_REQUEST['post_type']) ? esc_attr($_REQUEST['post_type']) : get_post_type( $_GET['post'] ); |
|
| 6360 | 6360 | |
| 6361 | - $post_types = geodir_get_posttypes(); |
|
| 6362 | - if ($post_type && in_array($post_type, $post_types) ) {
|
|
| 6363 | - global $primer_customizer_layouts; |
|
| 6364 | - remove_action( 'add_meta_boxes', array( $primer_customizer_layouts, 'add_meta_box' ), 10); |
|
| 6365 | - } |
|
| 6366 | - } |
|
| 6361 | + $post_types = geodir_get_posttypes(); |
|
| 6362 | + if ($post_type && in_array($post_type, $post_types) ) {
|
|
| 6363 | + global $primer_customizer_layouts; |
|
| 6364 | + remove_action( 'add_meta_boxes', array( $primer_customizer_layouts, 'add_meta_box' ), 10); |
|
| 6365 | + } |
|
| 6366 | + } |
|
| 6367 | 6367 | |
| 6368 | 6368 | } |
| 6369 | 6369 | |
| 6370 | 6370 | if(is_admin()){
|
| 6371 | - add_action('add_meta_boxes','geodir_fix_for_primer_theme',0);
|
|
| 6371 | + add_action('add_meta_boxes','geodir_fix_for_primer_theme',0);
|
|
| 6372 | 6372 | } |
| 6373 | 6373 | |
| 6374 | 6374 | |
@@ -6501,96 +6501,96 @@ discard block |
||
| 6501 | 6501 | |
| 6502 | 6502 | function geodir_ga_activation_url() {
|
| 6503 | 6503 | |
| 6504 | - return add_query_arg( array( |
|
| 6505 | - 'next' => admin_url("admin.php?page=geodirectory&active_tab=google_analytic_settings"),
|
|
| 6506 | - 'scope' => GEODIR_GA_SCOPE, |
|
| 6507 | - 'response_type' => 'code', |
|
| 6508 | - 'redirect_uri' => GEODIR_GA_REDIRECT, |
|
| 6509 | - 'client_id' => GEODIR_GA_CLIENTID, |
|
| 6510 | - ), 'https://accounts.google.com/o/oauth2/auth' ); |
|
| 6504 | + return add_query_arg( array( |
|
| 6505 | + 'next' => admin_url("admin.php?page=geodirectory&active_tab=google_analytic_settings"),
|
|
| 6506 | + 'scope' => GEODIR_GA_SCOPE, |
|
| 6507 | + 'response_type' => 'code', |
|
| 6508 | + 'redirect_uri' => GEODIR_GA_REDIRECT, |
|
| 6509 | + 'client_id' => GEODIR_GA_CLIENTID, |
|
| 6510 | + ), 'https://accounts.google.com/o/oauth2/auth' ); |
|
| 6511 | 6511 | |
| 6512 | - return $url; |
|
| 6512 | + return $url; |
|
| 6513 | 6513 | } |
| 6514 | 6514 | |
| 6515 | 6515 | function geodir_gd_accounts(){
|
| 6516 | - $accounts = array(); |
|
| 6517 | - $useAuth = ( get_option( 'geodir_ga_auth_code' ) == '' ? false : true ); |
|
| 6518 | - if($useAuth){
|
|
| 6519 | - try {
|
|
| 6520 | - $accounts = geodir_ga_get_analytics_accounts(); |
|
| 6521 | - } catch (Exception $e) {
|
|
| 6522 | - geodir_error_log( wp_sprintf( __( 'GD Google Analytics API Error(%s) : %s', 'geodirectory' ), $e->getCode(), $e->getMessage() ) ); |
|
| 6523 | - } |
|
| 6516 | + $accounts = array(); |
|
| 6517 | + $useAuth = ( get_option( 'geodir_ga_auth_code' ) == '' ? false : true ); |
|
| 6518 | + if($useAuth){
|
|
| 6519 | + try {
|
|
| 6520 | + $accounts = geodir_ga_get_analytics_accounts(); |
|
| 6521 | + } catch (Exception $e) {
|
|
| 6522 | + geodir_error_log( wp_sprintf( __( 'GD Google Analytics API Error(%s) : %s', 'geodirectory' ), $e->getCode(), $e->getMessage() ) ); |
|
| 6523 | + } |
|
| 6524 | 6524 | |
| 6525 | - if(is_array($accounts)){
|
|
| 6526 | - $accounts = array_merge(array(__('Select Account','geodirectory')),$accounts);
|
|
| 6527 | - }elseif(get_option('geodir_ga_account_id')){
|
|
| 6528 | - $accounts = array(); |
|
| 6529 | - $accounts[get_option('geodir_ga_account_id')] = __('Account re-authorization may be required','geodirectory').' ('.get_option('geodir_ga_account_id').')';
|
|
| 6530 | - } |
|
| 6531 | - } |
|
| 6532 | - return $accounts; |
|
| 6525 | + if(is_array($accounts)){
|
|
| 6526 | + $accounts = array_merge(array(__('Select Account','geodirectory')),$accounts);
|
|
| 6527 | + }elseif(get_option('geodir_ga_account_id')){
|
|
| 6528 | + $accounts = array(); |
|
| 6529 | + $accounts[get_option('geodir_ga_account_id')] = __('Account re-authorization may be required','geodirectory').' ('.get_option('geodir_ga_account_id').')';
|
|
| 6530 | + } |
|
| 6531 | + } |
|
| 6532 | + return $accounts; |
|
| 6533 | 6533 | } |
| 6534 | 6534 | |
| 6535 | 6535 | function geodir_ga_get_analytics_accounts() |
| 6536 | 6536 | {
|
| 6537 | - global $gd_ga_errors; |
|
| 6538 | - $accounts = array(); |
|
| 6537 | + global $gd_ga_errors; |
|
| 6538 | + $accounts = array(); |
|
| 6539 | 6539 | |
| 6540 | - if(get_option('geodir_ga_auth_token')===false){update_option('geodir_ga_auth_token','');}
|
|
| 6540 | + if(get_option('geodir_ga_auth_token')===false){update_option('geodir_ga_auth_token','');}
|
|
| 6541 | 6541 | |
| 6542 | 6542 | |
| 6543 | - if(get_option('geodir_gd_uids') && !isset($_POST['geodir_ga_auth_code'])){
|
|
| 6544 | - return get_option('geodir_gd_uids');
|
|
| 6545 | - } |
|
| 6543 | + if(get_option('geodir_gd_uids') && !isset($_POST['geodir_ga_auth_code'])){
|
|
| 6544 | + return get_option('geodir_gd_uids');
|
|
| 6545 | + } |
|
| 6546 | 6546 | |
| 6547 | - # Create a new Gdata call |
|
| 6548 | - if ( trim(get_option('geodir_ga_auth_code')) != '' )
|
|
| 6549 | - $stats = new GDGoogleAnalyticsStats(); |
|
| 6550 | - else |
|
| 6551 | - return false; |
|
| 6547 | + # Create a new Gdata call |
|
| 6548 | + if ( trim(get_option('geodir_ga_auth_code')) != '' )
|
|
| 6549 | + $stats = new GDGoogleAnalyticsStats(); |
|
| 6550 | + else |
|
| 6551 | + return false; |
|
| 6552 | 6552 | |
| 6553 | - # Check if Google sucessfully logged in |
|
| 6554 | - if ( ! $stats->checkLogin() ) |
|
| 6555 | - return false; |
|
| 6553 | + # Check if Google sucessfully logged in |
|
| 6554 | + if ( ! $stats->checkLogin() ) |
|
| 6555 | + return false; |
|
| 6556 | 6556 | |
| 6557 | - # Get a list of accounts |
|
| 6558 | - try {
|
|
| 6559 | - $accounts = $stats->getAllProfiles(); |
|
| 6560 | - } catch (Exception $e) {
|
|
| 6561 | - $gd_ga_errors[] = $e->getMessage(); |
|
| 6562 | - return false; |
|
| 6563 | - } |
|
| 6557 | + # Get a list of accounts |
|
| 6558 | + try {
|
|
| 6559 | + $accounts = $stats->getAllProfiles(); |
|
| 6560 | + } catch (Exception $e) {
|
|
| 6561 | + $gd_ga_errors[] = $e->getMessage(); |
|
| 6562 | + return false; |
|
| 6563 | + } |
|
| 6564 | 6564 | |
| 6565 | 6565 | |
| 6566 | - natcasesort ($accounts); |
|
| 6566 | + natcasesort ($accounts); |
|
| 6567 | 6567 | |
| 6568 | - # Return the account array if there are accounts |
|
| 6569 | - if ( count($accounts) > 0 ){
|
|
| 6570 | - update_option('geodir_gd_uids',$accounts);
|
|
| 6571 | - return $accounts; |
|
| 6572 | - } |
|
| 6573 | - else |
|
| 6574 | - return false; |
|
| 6568 | + # Return the account array if there are accounts |
|
| 6569 | + if ( count($accounts) > 0 ){
|
|
| 6570 | + update_option('geodir_gd_uids',$accounts);
|
|
| 6571 | + return $accounts; |
|
| 6572 | + } |
|
| 6573 | + else |
|
| 6574 | + return false; |
|
| 6575 | 6575 | } |
| 6576 | 6576 | |
| 6577 | 6577 | add_action( 'wp_ajax_geodir_ga_deauthorize', 'geodir_ga_deauthorize' ); |
| 6578 | 6578 | function geodir_ga_deauthorize(){
|
| 6579 | 6579 | |
| 6580 | - if ( ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'gd_ga_deauthorize' ) ) {
|
|
| 6580 | + if ( ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'gd_ga_deauthorize' ) ) {
|
|
| 6581 | 6581 | |
| 6582 | - die( 'Security check' ); |
|
| 6582 | + die( 'Security check' ); |
|
| 6583 | 6583 | |
| 6584 | - } else {
|
|
| 6585 | - update_option('geodir_ga_auth_token','');
|
|
| 6586 | - update_option('geodir_ga_auth_code','');
|
|
| 6587 | - update_option('geodir_gd_uids','');
|
|
| 6584 | + } else {
|
|
| 6585 | + update_option('geodir_ga_auth_token','');
|
|
| 6586 | + update_option('geodir_ga_auth_code','');
|
|
| 6587 | + update_option('geodir_gd_uids','');
|
|
| 6588 | 6588 | |
| 6589 | 6589 | |
| 6590 | - echo admin_url('?page=geodirectory&active_tab=google_analytic_settings');
|
|
| 6591 | - } |
|
| 6590 | + echo admin_url('?page=geodirectory&active_tab=google_analytic_settings');
|
|
| 6591 | + } |
|
| 6592 | 6592 | |
| 6593 | - die(); |
|
| 6593 | + die(); |
|
| 6594 | 6594 | } |
| 6595 | 6595 | |
| 6596 | 6596 | |
@@ -6601,14 +6601,14 @@ discard block |
||
| 6601 | 6601 | * @package GeoDirectory |
| 6602 | 6602 | */ |
| 6603 | 6603 | function geodir_post_type_setting_fun() {
|
| 6604 | - $post_type_arr = array(); |
|
| 6604 | + $post_type_arr = array(); |
|
| 6605 | 6605 | |
| 6606 | - $post_types = geodir_get_posttypes('object');
|
|
| 6606 | + $post_types = geodir_get_posttypes('object');
|
|
| 6607 | 6607 | |
| 6608 | - foreach ($post_types as $key => $post_types_obj) {
|
|
| 6609 | - $post_type_arr[$key] = $post_types_obj->labels->singular_name; |
|
| 6610 | - } |
|
| 6611 | - return $post_type_arr; |
|
| 6608 | + foreach ($post_types as $key => $post_types_obj) {
|
|
| 6609 | + $post_type_arr[$key] = $post_types_obj->labels->singular_name; |
|
| 6610 | + } |
|
| 6611 | + return $post_type_arr; |
|
| 6612 | 6612 | } |
| 6613 | 6613 | |
| 6614 | 6614 | /** |
@@ -6619,35 +6619,35 @@ discard block |
||
| 6619 | 6619 | */ |
| 6620 | 6620 | function geodir_listing_image_size_arr(){
|
| 6621 | 6621 | |
| 6622 | - global $_wp_additional_image_sizes; |
|
| 6623 | - |
|
| 6624 | - $sizes = array(); |
|
| 6625 | - |
|
| 6626 | - foreach ( get_intermediate_image_sizes() as $_size ) {
|
|
| 6627 | - if ( in_array( $_size, array('thumbnail', 'medium', 'medium_large', 'large') ) ) {
|
|
| 6628 | - $sizes[ $_size ]['width'] = get_option( "{$_size}_size_w" );
|
|
| 6629 | - $sizes[ $_size ]['height'] = get_option( "{$_size}_size_h" );
|
|
| 6630 | - $sizes[ $_size ]['crop'] = (bool) get_option( "{$_size}_crop" );
|
|
| 6631 | - } elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) {
|
|
| 6632 | - $sizes[ $_size ] = array( |
|
| 6633 | - 'width' => $_wp_additional_image_sizes[ $_size ]['width'], |
|
| 6634 | - 'height' => $_wp_additional_image_sizes[ $_size ]['height'], |
|
| 6635 | - 'crop' => $_wp_additional_image_sizes[ $_size ]['crop'], |
|
| 6636 | - ); |
|
| 6637 | - } |
|
| 6638 | - } |
|
| 6622 | + global $_wp_additional_image_sizes; |
|
| 6623 | + |
|
| 6624 | + $sizes = array(); |
|
| 6625 | + |
|
| 6626 | + foreach ( get_intermediate_image_sizes() as $_size ) {
|
|
| 6627 | + if ( in_array( $_size, array('thumbnail', 'medium', 'medium_large', 'large') ) ) {
|
|
| 6628 | + $sizes[ $_size ]['width'] = get_option( "{$_size}_size_w" );
|
|
| 6629 | + $sizes[ $_size ]['height'] = get_option( "{$_size}_size_h" );
|
|
| 6630 | + $sizes[ $_size ]['crop'] = (bool) get_option( "{$_size}_crop" );
|
|
| 6631 | + } elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) {
|
|
| 6632 | + $sizes[ $_size ] = array( |
|
| 6633 | + 'width' => $_wp_additional_image_sizes[ $_size ]['width'], |
|
| 6634 | + 'height' => $_wp_additional_image_sizes[ $_size ]['height'], |
|
| 6635 | + 'crop' => $_wp_additional_image_sizes[ $_size ]['crop'], |
|
| 6636 | + ); |
|
| 6637 | + } |
|
| 6638 | + } |
|
| 6639 | 6639 | |
| 6640 | 6640 | |
| 6641 | 6641 | |
| 6642 | - $options = array(); |
|
| 6642 | + $options = array(); |
|
| 6643 | 6643 | |
| 6644 | - $options['default'] = __('GD Default', 'geodirectory');
|
|
| 6644 | + $options['default'] = __('GD Default', 'geodirectory');
|
|
| 6645 | 6645 | |
| 6646 | - if(!empty($sizes)){
|
|
| 6647 | - foreach($sizes as $key=>$val){
|
|
| 6648 | - $options[$key] = $key. ' ( '.$val['width'].' x '.$val['height']. ' )'; |
|
| 6649 | - } |
|
| 6650 | - } |
|
| 6646 | + if(!empty($sizes)){
|
|
| 6647 | + foreach($sizes as $key=>$val){
|
|
| 6648 | + $options[$key] = $key. ' ( '.$val['width'].' x '.$val['height']. ' )'; |
|
| 6649 | + } |
|
| 6650 | + } |
|
| 6651 | 6651 | |
| 6652 | - return $options; |
|
| 6652 | + return $options; |
|
| 6653 | 6653 | } |
| 6654 | 6654 | \ No newline at end of file |
@@ -28,31 +28,31 @@ discard block |
||
| 28 | 28 | * @package GeoDirectory |
| 29 | 29 | */ |
| 30 | 30 | function geodir_admin_styles() {
|
| 31 | - wp_register_style('geodirectory-admin-css', geodir_plugin_url() . '/geodirectory-assets/css/admin.css', array(), GEODIRECTORY_VERSION);
|
|
| 31 | + wp_register_style('geodirectory-admin-css', geodir_plugin_url().'/geodirectory-assets/css/admin.css', array(), GEODIRECTORY_VERSION);
|
|
| 32 | 32 | wp_enqueue_style('geodirectory-admin-css');
|
| 33 | 33 | |
| 34 | - wp_register_style('geodirectory-frontend-style', geodir_plugin_url() . '/geodirectory-assets/css/style.css', array(), GEODIRECTORY_VERSION);
|
|
| 34 | + wp_register_style('geodirectory-frontend-style', geodir_plugin_url().'/geodirectory-assets/css/style.css', array(), GEODIRECTORY_VERSION);
|
|
| 35 | 35 | wp_enqueue_style('geodirectory-frontend-style');
|
| 36 | 36 | |
| 37 | - wp_register_style('geodir-chosen-style', geodir_plugin_url() . '/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION);
|
|
| 37 | + wp_register_style('geodir-chosen-style', geodir_plugin_url().'/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION);
|
|
| 38 | 38 | wp_enqueue_style('geodir-chosen-style');
|
| 39 | 39 | |
| 40 | - wp_register_style('geodirectory-jquery-ui-timepicker-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery.ui.timepicker.css', array(), GEODIRECTORY_VERSION);
|
|
| 40 | + wp_register_style('geodirectory-jquery-ui-timepicker-css', geodir_plugin_url().'/geodirectory-assets/css/jquery.ui.timepicker.css', array(), GEODIRECTORY_VERSION);
|
|
| 41 | 41 | wp_enqueue_style('geodirectory-jquery-ui-timepicker-css');
|
| 42 | 42 | |
| 43 | - wp_register_style('geodirectory-jquery-ui-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery-ui.css', array(), GEODIRECTORY_VERSION);
|
|
| 43 | + wp_register_style('geodirectory-jquery-ui-css', geodir_plugin_url().'/geodirectory-assets/css/jquery-ui.css', array(), GEODIRECTORY_VERSION);
|
|
| 44 | 44 | wp_enqueue_style('geodirectory-jquery-ui-css');
|
| 45 | 45 | |
| 46 | - wp_register_style('geodirectory-custom-fields-css', geodir_plugin_url() . '/geodirectory-assets/css/custom_field.css', array(), GEODIRECTORY_VERSION);
|
|
| 46 | + wp_register_style('geodirectory-custom-fields-css', geodir_plugin_url().'/geodirectory-assets/css/custom_field.css', array(), GEODIRECTORY_VERSION);
|
|
| 47 | 47 | wp_enqueue_style('geodirectory-custom-fields-css');
|
| 48 | 48 | |
| 49 | - wp_register_style('geodirectory-pluplodar-css', geodir_plugin_url() . '/geodirectory-assets/css/pluploader.css', array(), GEODIRECTORY_VERSION);
|
|
| 49 | + wp_register_style('geodirectory-pluplodar-css', geodir_plugin_url().'/geodirectory-assets/css/pluploader.css', array(), GEODIRECTORY_VERSION);
|
|
| 50 | 50 | wp_enqueue_style('geodirectory-pluplodar-css');
|
| 51 | 51 | |
| 52 | - wp_register_style('geodir-rating-style', geodir_plugin_url() . '/geodirectory-assets/css/jRating.jquery.css', array(), GEODIRECTORY_VERSION);
|
|
| 52 | + wp_register_style('geodir-rating-style', geodir_plugin_url().'/geodirectory-assets/css/jRating.jquery.css', array(), GEODIRECTORY_VERSION);
|
|
| 53 | 53 | wp_enqueue_style('geodir-rating-style');
|
| 54 | 54 | |
| 55 | - wp_register_style('geodir-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl.css', array(), GEODIRECTORY_VERSION);
|
|
| 55 | + wp_register_style('geodir-rtl-style', geodir_plugin_url().'/geodirectory-assets/css/rtl.css', array(), GEODIRECTORY_VERSION);
|
|
| 56 | 56 | wp_enqueue_style('geodir-rtl-style');
|
| 57 | 57 | } |
| 58 | 58 | } |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | // wp_register_script('font-awesome-shim', 'https://use.fontawesome.com/releases/v5.5.0/js/v4-shims.js', array(), GEODIRECTORY_VERSION);
|
| 72 | 72 | // wp_enqueue_script( 'font-awesome' ); |
| 73 | 73 | |
| 74 | - wp_register_script('geodirectory-admin', geodir_plugin_url() . '/geodirectory-assets/js/admin-req.min.js', array('jquery'), GEODIRECTORY_VERSION);
|
|
| 74 | + wp_register_script('geodirectory-admin', geodir_plugin_url().'/geodirectory-assets/js/admin-req.min.js', array('jquery'), GEODIRECTORY_VERSION);
|
|
| 75 | 75 | wp_enqueue_script('geodirectory-admin');
|
| 76 | 76 | |
| 77 | 77 | } |
@@ -90,68 +90,68 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | wp_enqueue_script('jquery');
|
| 92 | 92 | |
| 93 | - wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), '', true);
|
|
| 93 | + wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.ui.timepicker.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), '', true);
|
|
| 94 | 94 | |
| 95 | - wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.js', array('jquery'), GEODIRECTORY_VERSION);
|
|
| 95 | + wp_register_script('chosen', geodir_plugin_url().'/geodirectory-assets/js/chosen.jquery.js', array('jquery'), GEODIRECTORY_VERSION);
|
|
| 96 | 96 | wp_enqueue_script('chosen');
|
| 97 | 97 | |
| 98 | - wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.js', array(), GEODIRECTORY_VERSION);
|
|
| 98 | + wp_register_script('geodirectory-choose-ajax', geodir_plugin_url().'/geodirectory-assets/js/ajax-chosen.js', array(), GEODIRECTORY_VERSION);
|
|
| 99 | 99 | wp_enqueue_script('geodirectory-choose-ajax');
|
| 100 | 100 | |
| 101 | 101 | if (isset($_REQUEST['listing_type'])) {
|
| 102 | - wp_register_script('geodirectory-custom-fields-script', geodir_plugin_url() . '/geodirectory-assets/js/custom_fields.js', array(), GEODIRECTORY_VERSION);
|
|
| 102 | + wp_register_script('geodirectory-custom-fields-script', geodir_plugin_url().'/geodirectory-assets/js/custom_fields.js', array(), GEODIRECTORY_VERSION);
|
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | wp_enqueue_script('geodirectory-custom-fields-script');
|
| 106 | - $plugin_path = geodir_plugin_url() . '/geodirectory-functions/cat-meta-functions'; |
|
| 106 | + $plugin_path = geodir_plugin_url().'/geodirectory-functions/cat-meta-functions'; |
|
| 107 | 107 | |
| 108 | - wp_enqueue_script('tax-meta-clss', $plugin_path . '/js/tax-meta-clss.js', array('jquery'), null, true);
|
|
| 108 | + wp_enqueue_script('tax-meta-clss', $plugin_path.'/js/tax-meta-clss.js', array('jquery'), null, true);
|
|
| 109 | 109 | |
| 110 | 110 | if (in_array($geodir_map_name, array('auto', 'google'))) {
|
| 111 | - $map_lang = "&language=" . geodir_get_map_default_language(); |
|
| 112 | - $map_key = "&key=" . geodir_get_map_api_key(); |
|
| 111 | + $map_lang = "&language=".geodir_get_map_default_language(); |
|
| 112 | + $map_key = "&key=".geodir_get_map_api_key(); |
|
| 113 | 113 | /** This filter is documented in geodirectory_template_tags.php */ |
| 114 | 114 | $map_extra = apply_filters('geodir_googlemap_script_extra', '');
|
| 115 | - wp_enqueue_script('google-maps-api', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra, '', NULL);
|
|
| 115 | + wp_enqueue_script('google-maps-api', 'https://maps.google.com/maps/api/js?'.$map_lang.$map_key.$map_extra, '', NULL);
|
|
| 116 | 116 | |
| 117 | 117 | // Overlapping Marker Spiderfier |
| 118 | - wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 118 | + wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url().'/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 119 | 119 | wp_enqueue_script('geodirectory-g-overlappingmarker-script');
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | if ($geodir_map_name == 'osm') {
|
| 123 | 123 | // Leaflet OpenStreetMap |
| 124 | - wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
|
|
| 124 | + wp_register_style('geodirectory-leaflet-style', geodir_plugin_url().'/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
|
|
| 125 | 125 | wp_enqueue_style('geodirectory-leaflet-style');
|
| 126 | 126 | |
| 127 | - wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 127 | + wp_register_script('geodirectory-leaflet-script', geodir_plugin_url().'/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 128 | 128 | wp_enqueue_script('geodirectory-leaflet-script');
|
| 129 | 129 | |
| 130 | - wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.min.js', array('geodirectory-leaflet-script'), GEODIRECTORY_VERSION);
|
|
| 130 | + wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url().'/geodirectory-assets/leaflet/osm.geocode.min.js', array('geodirectory-leaflet-script'), GEODIRECTORY_VERSION);
|
|
| 131 | 131 | wp_enqueue_script('geodirectory-leaflet-geo-script');
|
| 132 | 132 | |
| 133 | 133 | // Overlapping Marker Spiderfier Leaflet |
| 134 | - wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 134 | + wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url().'/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 135 | 135 | wp_enqueue_script('geodirectory-o-overlappingmarker-script');
|
| 136 | 136 | } |
| 137 | - wp_enqueue_script( 'jquery-ui-autocomplete' ); |
|
| 137 | + wp_enqueue_script('jquery-ui-autocomplete');
|
|
| 138 | 138 | |
| 139 | - wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true);
|
|
| 139 | + wp_register_script('geodirectory-goMap-script', geodir_plugin_url().'/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true);
|
|
| 140 | 140 | wp_enqueue_script('geodirectory-goMap-script');
|
| 141 | 141 | |
| 142 | - wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.js', array(), GEODIRECTORY_VERSION);
|
|
| 142 | + wp_register_script('geodirectory-goMap-script', geodir_plugin_url().'/geodirectory-assets/js/goMap.js', array(), GEODIRECTORY_VERSION);
|
|
| 143 | 143 | wp_enqueue_script('geodirectory-goMap-script');
|
| 144 | 144 | |
| 145 | 145 | // font awesome rating script |
| 146 | 146 | if (get_option('geodir_reviewrating_enable_font_awesome')) {
|
| 147 | - wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 147 | + wp_register_script('geodir-barrating-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 148 | 148 | wp_enqueue_script('geodir-barrating-js');
|
| 149 | 149 | } else { // default rating script
|
| 150 | - wp_register_script('geodir-jRating-js', geodir_plugin_url() . '/geodirectory-assets/js/jRating.jquery.js', array(), GEODIRECTORY_VERSION);
|
|
| 150 | + wp_register_script('geodir-jRating-js', geodir_plugin_url().'/geodirectory-assets/js/jRating.jquery.js', array(), GEODIRECTORY_VERSION);
|
|
| 151 | 151 | wp_enqueue_script('geodir-jRating-js');
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 154 | + wp_register_script('geodir-on-document-load', geodir_plugin_url().'/geodirectory-assets/js/on_document_load.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 155 | 155 | wp_enqueue_script('geodir-on-document-load');
|
| 156 | 156 | |
| 157 | 157 | |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | wp_enqueue_script('plupload-all');
|
| 160 | 160 | wp_enqueue_script('jquery-ui-sortable');
|
| 161 | 161 | |
| 162 | - wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.js', array(), GEODIRECTORY_VERSION);
|
|
| 162 | + wp_register_script('geodirectory-plupload-script', geodir_plugin_url().'/geodirectory-assets/js/geodirectory-plupload.js', array(), GEODIRECTORY_VERSION);
|
|
| 163 | 163 | wp_enqueue_script('geodirectory-plupload-script');
|
| 164 | 164 | |
| 165 | 165 | // SCRIPT FOR UPLOAD END |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | wp_localize_script('geodirectory-custom-fields-script', 'geodir_admin_ajax', $ajax_cons_data);
|
| 214 | 214 | |
| 215 | 215 | |
| 216 | - wp_register_script('geodirectory-admin-script', geodir_plugin_url() . '/geodirectory-assets/js/admin.js', array(), GEODIRECTORY_VERSION);
|
|
| 216 | + wp_register_script('geodirectory-admin-script', geodir_plugin_url().'/geodirectory-assets/js/admin.js', array(), GEODIRECTORY_VERSION);
|
|
| 217 | 217 | wp_enqueue_script('geodirectory-admin-script');
|
| 218 | 218 | |
| 219 | 219 | wp_enqueue_style('farbtastic');
|
@@ -221,10 +221,10 @@ discard block |
||
| 221 | 221 | |
| 222 | 222 | $screen = get_current_screen(); |
| 223 | 223 | if ($screen->base == 'post' && in_array($screen->post_type, geodir_get_posttypes())) {
|
| 224 | - wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation_admin.js');
|
|
| 224 | + wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url().'/geodirectory-assets/js/listing_validation_admin.js');
|
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | - $ajax_cons_data = array('url' => esc_url(__(get_option('siteurl') . '?geodir_ajax=true')));
|
|
| 227 | + $ajax_cons_data = array('url' => esc_url(__(get_option('siteurl').'?geodir_ajax=true')));
|
|
| 228 | 228 | wp_localize_script('geodirectory-admin-script', 'geodir_ajax', $ajax_cons_data);
|
| 229 | 229 | |
| 230 | 230 | } |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | |
| 248 | 248 | if (current_user_can('manage_options')) $menu[] = array('', 'read', 'separator-geodirectory', '', 'wp-menu-separator geodirectory');
|
| 249 | 249 | |
| 250 | - add_menu_page(__('Geodirectory', 'geodirectory'), __('Geodirectory', 'geodirectory'), 'manage_options', 'geodirectory', 'geodir_admin_panel', geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico', '55.1984');
|
|
| 250 | + add_menu_page(__('Geodirectory', 'geodirectory'), __('Geodirectory', 'geodirectory'), 'manage_options', 'geodirectory', 'geodir_admin_panel', geodir_plugin_url().'/geodirectory-assets/images/favicon.ico', '55.1984');
|
|
| 251 | 251 | |
| 252 | 252 | |
| 253 | 253 | } |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | $geodir_menu_order[] = 'separator-geodirectory'; |
| 282 | 282 | if (!empty($post_types)) {
|
| 283 | 283 | foreach ($post_types as $post_type) {
|
| 284 | - $geodir_menu_order[] = 'edit.php?post_type=' . $post_type; |
|
| 284 | + $geodir_menu_order[] = 'edit.php?post_type='.$post_type; |
|
| 285 | 285 | } |
| 286 | 286 | } |
| 287 | 287 | $geodir_menu_order[] = $item; |
@@ -324,8 +324,8 @@ discard block |
||
| 324 | 324 | {
|
| 325 | 325 | if (isset($_REQUEST['installed']) && $_REQUEST['installed'] != '') {
|
| 326 | 326 | echo '<div id="message" class="updated fade"> |
| 327 | - <p style="float:right;">' . __('Like Geodirectory?', 'geodirectory') . ' <a href="http://wordpress.org/extend/plugins/Geodirectory/" target="_blank">' . __('Support us by leaving a rating!', 'geodirectory') . '</a></p>
|
|
| 328 | - <p><strong>' . __('Geodirectory has been installed and setup. Enjoy :)', 'geodirectory') . '</strong></p>
|
|
| 327 | + <p style="float:right;">' . __('Like Geodirectory?', 'geodirectory').' <a href="http://wordpress.org/extend/plugins/Geodirectory/" target="_blank">'.__('Support us by leaving a rating!', 'geodirectory').'</a></p>
|
|
| 328 | + <p><strong>' . __('Geodirectory has been installed and setup. Enjoy :)', 'geodirectory').'</strong></p>
|
|
| 329 | 329 | </div>'; |
| 330 | 330 | |
| 331 | 331 | } |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | if (isset($_REQUEST['msg']) && $_REQUEST['msg'] != '') {
|
| 334 | 334 | switch ($_REQUEST['msg']) {
|
| 335 | 335 | case 'success': |
| 336 | - echo '<div id="message" class="updated fade"><p><strong>' . __('Your settings have been saved.', 'geodirectory') . '</strong></p></div>';
|
|
| 336 | + echo '<div id="message" class="updated fade"><p><strong>'.__('Your settings have been saved.', 'geodirectory').'</strong></p></div>';
|
|
| 337 | 337 | flush_rewrite_rules(false); |
| 338 | 338 | |
| 339 | 339 | break; |
@@ -341,30 +341,30 @@ discard block |
||
| 341 | 341 | $gderr = isset($_REQUEST['gderr']) ? $_REQUEST['gderr'] : ''; |
| 342 | 342 | |
| 343 | 343 | if ($gderr == 21) |
| 344 | - echo '<div id="message" class="error fade"><p><strong>' . __('Error: You can not add same permalinks for both Listing and Location, please try again.', 'geodirectory') . '</strong></p></div>';
|
|
| 344 | + echo '<div id="message" class="error fade"><p><strong>'.__('Error: You can not add same permalinks for both Listing and Location, please try again.', 'geodirectory').'</strong></p></div>';
|
|
| 345 | 345 | else |
| 346 | - echo '<div id="message" class="error fade"><p><strong>' . __('Error: Your settings have not been saved, please try again.', 'geodirectory') . '</strong></p></div>';
|
|
| 346 | + echo '<div id="message" class="error fade"><p><strong>'.__('Error: Your settings have not been saved, please try again.', 'geodirectory').'</strong></p></div>';
|
|
| 347 | 347 | break; |
| 348 | 348 | } |
| 349 | 349 | } |
| 350 | 350 | |
| 351 | 351 | $geodir_load_map = get_option('geodir_load_map');
|
| 352 | 352 | $need_map_key = false; |
| 353 | - if($geodir_load_map=='' || $geodir_load_map=='google' || $geodir_load_map=='auto' ){
|
|
| 353 | + if ($geodir_load_map == '' || $geodir_load_map == 'google' || $geodir_load_map == 'auto') {
|
|
| 354 | 354 | $need_map_key = true; |
| 355 | 355 | } |
| 356 | 356 | |
| 357 | 357 | if (!geodir_get_map_api_key() && $need_map_key) {
|
| 358 | - echo '<div class="error"><p><strong>' . sprintf(__('Google Maps API KEY not set, %sclick here%s to set one OR use Open Street Maps instead.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=design_settings&active_tab=geodir_map_settings') . '\'>', '</a>') . '</strong></p></div>';
|
|
| 358 | + echo '<div class="error"><p><strong>'.sprintf(__('Google Maps API KEY not set, %sclick here%s to set one OR use Open Street Maps instead.', 'geodirectory'), '<a href=\''.admin_url('admin.php?page=geodirectory&tab=design_settings&active_tab=geodir_map_settings').'\'>', '</a>').'</strong></p></div>';
|
|
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | if (!geodir_is_default_location_set()) {
|
| 362 | - echo '<div class="updated fade"><p><strong>' . sprintf(__('Please %sclick here%s to set a default location, this will make the plugin work properly.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>') . '</strong></p></div>';
|
|
| 362 | + echo '<div class="updated fade"><p><strong>'.sprintf(__('Please %sclick here%s to set a default location, this will make the plugin work properly.', 'geodirectory'), '<a href=\''.admin_url('admin.php?page=geodirectory&tab=default_location_settings').'\'>', '</a>').'</strong></p></div>';
|
|
| 363 | 363 | |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | if (!function_exists('curl_init')) {
|
| 367 | - echo '<div class="error"><p><strong>' . __('CURL is not installed on this server, this can cause problems, please ask your server admin to install it.', 'geodirectory') . '</strong></p></div>';
|
|
| 367 | + echo '<div class="error"><p><strong>'.__('CURL is not installed on this server, this can cause problems, please ask your server admin to install it.', 'geodirectory').'</strong></p></div>';
|
|
| 368 | 368 | |
| 369 | 369 | } |
| 370 | 370 | |
@@ -384,18 +384,18 @@ discard block |
||
| 384 | 384 | function geodir_handle_option_form_submit($current_tab) |
| 385 | 385 | {
|
| 386 | 386 | global $geodir_settings; |
| 387 | - if (file_exists(dirname(__FILE__) . '/option-pages/' . $current_tab . '_array.php')) {
|
|
| 387 | + if (file_exists(dirname(__FILE__).'/option-pages/'.$current_tab.'_array.php')) {
|
|
| 388 | 388 | /** |
| 389 | 389 | * Contains settings array for current tab. |
| 390 | 390 | * |
| 391 | 391 | * @since 1.0.0 |
| 392 | 392 | * @package GeoDirectory |
| 393 | 393 | */ |
| 394 | - include_once('option-pages/' . $current_tab . '_array.php');
|
|
| 394 | + include_once('option-pages/'.$current_tab.'_array.php');
|
|
| 395 | 395 | } |
| 396 | 396 | if (isset($_POST) && $_POST && isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') : |
| 397 | 397 | if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
|
| 398 | - if (!wp_verify_nonce($_REQUEST['_wpnonce-' . $current_tab], 'geodir-settings-' . $current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
|
|
| 398 | + if (!wp_verify_nonce($_REQUEST['_wpnonce-'.$current_tab], 'geodir-settings-'.$current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
|
|
| 399 | 399 | |
| 400 | 400 | /** |
| 401 | 401 | * Fires before updating geodirectory admin settings. |
@@ -428,13 +428,13 @@ discard block |
||
| 428 | 428 | * @param string $current_tab The current settings tab name. |
| 429 | 429 | * @param array $geodir_settings[$current_tab] The array of settings for the current settings tab. |
| 430 | 430 | */ |
| 431 | - do_action('geodir_update_options_' . $current_tab, $geodir_settings[$current_tab]);
|
|
| 431 | + do_action('geodir_update_options_'.$current_tab, $geodir_settings[$current_tab]);
|
|
| 432 | 432 | |
| 433 | 433 | flush_rewrite_rules(false); |
| 434 | 434 | |
| 435 | 435 | $current_tab = isset($_REQUEST['tab']) ? $_REQUEST['tab'] : ''; |
| 436 | 436 | |
| 437 | - $redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $_REQUEST['active_tab'] . '&msg=success');
|
|
| 437 | + $redirect_url = admin_url('admin.php?page=geodirectory&tab='.$current_tab.'&active_tab='.$_REQUEST['active_tab'].'&msg=success');
|
|
| 438 | 438 | |
| 439 | 439 | wp_redirect($redirect_url); |
| 440 | 440 | exit(); |
@@ -473,18 +473,18 @@ discard block |
||
| 473 | 473 | |
| 474 | 474 | elseif (isset($value['type']) && $value['type'] == 'image_width') : |
| 475 | 475 | |
| 476 | - if (isset($value['id']) && isset($_POST[$value['id'] . '_width'])) {
|
|
| 477 | - update_option($value['id'] . '_width', $_POST[$value['id'] . '_width']); |
|
| 478 | - update_option($value['id'] . '_height', $_POST[$value['id'] . '_height']); |
|
| 479 | - if (isset($_POST[$value['id'] . '_crop'])) : |
|
| 480 | - update_option($value['id'] . '_crop', 1); |
|
| 476 | + if (isset($value['id']) && isset($_POST[$value['id'].'_width'])) {
|
|
| 477 | + update_option($value['id'].'_width', $_POST[$value['id'].'_width']); |
|
| 478 | + update_option($value['id'].'_height', $_POST[$value['id'].'_height']); |
|
| 479 | + if (isset($_POST[$value['id'].'_crop'])) : |
|
| 480 | + update_option($value['id'].'_crop', 1); |
|
| 481 | 481 | else : |
| 482 | - update_option($value['id'] . '_crop', 0); |
|
| 482 | + update_option($value['id'].'_crop', 0); |
|
| 483 | 483 | endif; |
| 484 | 484 | } else {
|
| 485 | - update_option($value['id'] . '_width', $value['std']); |
|
| 486 | - update_option($value['id'] . '_height', $value['std']); |
|
| 487 | - update_option($value['id'] . '_crop', 1); |
|
| 485 | + update_option($value['id'].'_width', $value['std']); |
|
| 486 | + update_option($value['id'].'_height', $value['std']); |
|
| 487 | + update_option($value['id'].'_crop', 1); |
|
| 488 | 488 | } |
| 489 | 489 | |
| 490 | 490 | elseif (isset($value['type']) && $value['type'] == 'map') : |
@@ -526,12 +526,12 @@ discard block |
||
| 526 | 526 | elseif (isset($value['type']) && $value['type'] == 'file') : |
| 527 | 527 | |
| 528 | 528 | |
| 529 | - if (isset($_POST[$value['id'] . '_remove']) && $_POST[$value['id'] . '_remove']) {// if remove is set then remove the file
|
|
| 529 | + if (isset($_POST[$value['id'].'_remove']) && $_POST[$value['id'].'_remove']) {// if remove is set then remove the file
|
|
| 530 | 530 | |
| 531 | 531 | if (get_option($value['id'])) {
|
| 532 | 532 | $image_name_arr = explode('/', get_option($value['id']));
|
| 533 | 533 | $noimg_name = end($image_name_arr); |
| 534 | - $img_path = $uploads['path'] . '/' . $noimg_name; |
|
| 534 | + $img_path = $uploads['path'].'/'.$noimg_name; |
|
| 535 | 535 | if (file_exists($img_path)) |
| 536 | 536 | unlink($img_path); |
| 537 | 537 | } |
@@ -559,7 +559,7 @@ discard block |
||
| 559 | 559 | if (get_option($value['id'])) {
|
| 560 | 560 | $image_name_arr = explode('/', get_option($value['id']));
|
| 561 | 561 | $noimg_name = end($image_name_arr); |
| 562 | - $img_path = $uploads['path'] . '/' . $noimg_name; |
|
| 562 | + $img_path = $uploads['path'].'/'.$noimg_name; |
|
| 563 | 563 | if (file_exists($img_path)) |
| 564 | 564 | unlink($img_path); |
| 565 | 565 | } |
@@ -580,7 +580,7 @@ discard block |
||
| 580 | 580 | // same menu setting per theme. |
| 581 | 581 | if (isset($value['id']) && $value['id'] == 'geodir_theme_location_nav' && isset($_POST[$value['id']])) {
|
| 582 | 582 | $theme = wp_get_theme(); |
| 583 | - update_option('geodir_theme_location_nav_' . $theme->name, $_POST[$value['id']]);
|
|
| 583 | + update_option('geodir_theme_location_nav_'.$theme->name, $_POST[$value['id']]);
|
|
| 584 | 584 | } |
| 585 | 585 | |
| 586 | 586 | if (isset($value['id']) && isset($_POST[$value['id']])) {
|
@@ -650,7 +650,7 @@ discard block |
||
| 650 | 650 | |
| 651 | 651 | $listing_slug = __($geodir_posttype_info['labels']['singular_name'], 'geodirectory'); |
| 652 | 652 | |
| 653 | - $tabs[$geodir_post_type . '_fields_settings'] = array( |
|
| 653 | + $tabs[$geodir_post_type.'_fields_settings'] = array( |
|
| 654 | 654 | 'label' => wp_sprintf(__('%s Settings', 'geodirectory'), $listing_slug),
|
| 655 | 655 | 'subtabs' => array( |
| 656 | 656 | array('subtab' => 'custom_fields',
|
@@ -684,7 +684,7 @@ discard block |
||
| 684 | 684 | */ |
| 685 | 685 | function geodir_tools_setting_tab($tabs) |
| 686 | 686 | {
|
| 687 | - wp_enqueue_script( 'jquery-ui-progressbar' ); |
|
| 687 | + wp_enqueue_script('jquery-ui-progressbar');
|
|
| 688 | 688 | $tabs['tools_settings'] = array('label' => __('GD Tools', 'geodirectory'));
|
| 689 | 689 | return $tabs; |
| 690 | 690 | } |
@@ -718,7 +718,7 @@ discard block |
||
| 718 | 718 | */ |
| 719 | 719 | function geodir_extend_geodirectory_setting_tab($tabs) |
| 720 | 720 | {
|
| 721 | - $tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory'). ' <i class="fas fa-plug"></i>', 'url' => 'https://wpgeodirectory.com', 'target' => '_blank');
|
|
| 721 | + $tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory').' <i class="fas fa-plug"></i>', 'url' => 'https://wpgeodirectory.com', 'target' => '_blank');
|
|
| 722 | 722 | return $tabs; |
| 723 | 723 | } |
| 724 | 724 | |
@@ -778,8 +778,8 @@ discard block |
||
| 778 | 778 | _e('Unknown', 'geodirectory');
|
| 779 | 779 | } else {
|
| 780 | 780 | /* If there is a city id, append 'city name' to the text string. */ |
| 781 | - $add_location_id = $location_id > 0 ? ' (' . $location_id . ')' : '';
|
|
| 782 | - echo(__($location->country, 'geodirectory') . '-' . $location->region . '-' . $location->city . $add_location_id); |
|
| 781 | + $add_location_id = $location_id > 0 ? ' ('.$location_id.')' : '';
|
|
| 782 | + echo(__($location->country, 'geodirectory').'-'.$location->region.'-'.$location->city.$add_location_id); |
|
| 783 | 783 | } |
| 784 | 784 | break; |
| 785 | 785 | |
@@ -797,14 +797,14 @@ discard block |
||
| 797 | 797 | $expire_class = 'expire_over'; |
| 798 | 798 | } |
| 799 | 799 | $date_diff = round(abs(strtotime($d1) - strtotime($d2)) / 86400); // get the difference in days |
| 800 | - $date_diff_text = '<br /><span class="' . $expire_class . '">(' . $date_diff . ' ' . $state . ')</span>';
|
|
| 800 | + $date_diff_text = '<br /><span class="'.$expire_class.'">('.$date_diff.' '.$state.')</span>';
|
|
| 801 | 801 | } |
| 802 | 802 | /* If no expire_date is found, output a default message. */ |
| 803 | 803 | if (empty($expire_date)) |
| 804 | 804 | echo __('Unknown', 'geodirectory');
|
| 805 | 805 | /* If there is a expire_date, append 'days left' to the text string. */ |
| 806 | 806 | else |
| 807 | - echo $expire_date . $date_diff_text; |
|
| 807 | + echo $expire_date.$date_diff_text; |
|
| 808 | 808 | break; |
| 809 | 809 | |
| 810 | 810 | /* If displaying the 'categorys' column. */ |
@@ -871,7 +871,7 @@ discard block |
||
| 871 | 871 | function geodir_post_information_save($post_id, $post) {
|
| 872 | 872 | global $wpdb, $current_user; |
| 873 | 873 | |
| 874 | - if (isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')) {
|
|
| 874 | + if (isset($post->post_type) && ($post->post_type == 'nav_menu_item' || $post->post_type == 'page' || $post->post_type == 'post')) {
|
|
| 875 | 875 | return; |
| 876 | 876 | } |
| 877 | 877 | |
@@ -939,7 +939,7 @@ discard block |
||
| 939 | 939 | $tab_id = $value['id']; |
| 940 | 940 | |
| 941 | 941 | if (isset($value['desc']) && $value['desc']) |
| 942 | - $desc = '<span style=" text-transform:none;">:- ' . $value['desc'] . '</span>'; |
|
| 942 | + $desc = '<span style=" text-transform:none;">:- '.$value['desc'].'</span>'; |
|
| 943 | 943 | |
| 944 | 944 | if (isset($value['name']) && $value['name']) {
|
| 945 | 945 | if ($first_title === true) {
|
@@ -947,9 +947,9 @@ discard block |
||
| 947 | 947 | } else {
|
| 948 | 948 | echo '</div>'; |
| 949 | 949 | } |
| 950 | - echo '<dd id="' . trim($tab_id) . '" class="geodir_option_tabs" ><a href="javascript:void(0);">' . $value['name'] . '</a></dd>'; |
|
| 950 | + echo '<dd id="'.trim($tab_id).'" class="geodir_option_tabs" ><a href="javascript:void(0);">'.$value['name'].'</a></dd>'; |
|
| 951 | 951 | |
| 952 | - echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >'; |
|
| 952 | + echo '<div id="sub_'.trim($tab_id).'" class="gd-content-heading" style=" margin-bottom:10px;" >'; |
|
| 953 | 953 | } |
| 954 | 954 | |
| 955 | 955 | /** |
@@ -959,21 +959,21 @@ discard block |
||
| 959 | 959 | * |
| 960 | 960 | * @since 1.0.0 |
| 961 | 961 | */ |
| 962 | - do_action('geodir_settings_' . sanitize_title($value['id']));
|
|
| 962 | + do_action('geodir_settings_'.sanitize_title($value['id']));
|
|
| 963 | 963 | break; |
| 964 | 964 | |
| 965 | 965 | case 'no_tabs': |
| 966 | 966 | |
| 967 | 967 | echo '<div class="inner_content_tab_main">'; |
| 968 | - echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >'; |
|
| 968 | + echo '<div id="sub_'.trim($tab_id).'" class="gd-content-heading" style=" margin-bottom:10px;" >'; |
|
| 969 | 969 | |
| 970 | 970 | break; |
| 971 | 971 | |
| 972 | 972 | case 'sectionstart': |
| 973 | 973 | if (isset($value['desc']) && $value['desc']) |
| 974 | - $desc = '<span style=" text-transform:none;"> - ' . $value['desc'] . '</span>'; |
|
| 974 | + $desc = '<span style=" text-transform:none;"> - '.$value['desc'].'</span>'; |
|
| 975 | 975 | if (isset($value['name']) && $value['name']) |
| 976 | - echo '<h3>' . $value['name'] . $desc . '</h3>'; |
|
| 976 | + echo '<h3>'.$value['name'].$desc.'</h3>'; |
|
| 977 | 977 | /** |
| 978 | 978 | * Called after a GeoDirectory settings sectionstart is output in the GD settings page. |
| 979 | 979 | * |
@@ -981,8 +981,8 @@ discard block |
||
| 981 | 981 | * |
| 982 | 982 | * @since 1.0.0 |
| 983 | 983 | */ |
| 984 | - if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_start');
|
|
| 985 | - echo '<table class="form-table">' . "\n\n"; |
|
| 984 | + if (isset($value['id']) && $value['id']) do_action('geodir_settings_'.sanitize_title($value['id']).'_start');
|
|
| 985 | + echo '<table class="form-table">'."\n\n"; |
|
| 986 | 986 | |
| 987 | 987 | break; |
| 988 | 988 | case 'sectionend': |
@@ -993,7 +993,7 @@ discard block |
||
| 993 | 993 | * |
| 994 | 994 | * @since 1.0.0 |
| 995 | 995 | */ |
| 996 | - if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_end');
|
|
| 996 | + if (isset($value['id']) && $value['id']) do_action('geodir_settings_'.sanitize_title($value['id']).'_end');
|
|
| 997 | 997 | echo '</table>'; |
| 998 | 998 | /** |
| 999 | 999 | * Called after a GeoDirectory settings sectionend is output in the GD settings page. |
@@ -1002,7 +1002,7 @@ discard block |
||
| 1002 | 1002 | * |
| 1003 | 1003 | * @since 1.0.0 |
| 1004 | 1004 | */ |
| 1005 | - if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_after');
|
|
| 1005 | + if (isset($value['id']) && $value['id']) do_action('geodir_settings_'.sanitize_title($value['id']).'_after');
|
|
| 1006 | 1006 | break; |
| 1007 | 1007 | case 'text': |
| 1008 | 1008 | ?> |
@@ -1011,7 +1011,7 @@ discard block |
||
| 1011 | 1011 | <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>" |
| 1012 | 1012 | id="<?php echo esc_attr($value['id']); ?>" |
| 1013 | 1013 | type="<?php echo esc_attr($value['type']); ?>" |
| 1014 | - <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
|
|
| 1014 | + <?php if (isset($value['placeholder'])) {?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
|
|
| 1015 | 1015 | style=" <?php echo esc_attr($value['css']); ?>" |
| 1016 | 1016 | value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
|
| 1017 | 1017 | echo esc_attr(stripslashes(get_option($value['id']))); |
@@ -1028,15 +1028,15 @@ discard block |
||
| 1028 | 1028 | <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>" |
| 1029 | 1029 | id="<?php echo esc_attr($value['id']); ?>" |
| 1030 | 1030 | type="<?php echo esc_attr($value['type']); ?>" |
| 1031 | - <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
|
|
| 1031 | + <?php if (isset($value['placeholder'])) {?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
|
|
| 1032 | 1032 | style=" <?php echo esc_attr($value['css']); ?>" |
| 1033 | 1033 | value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
|
| 1034 | 1034 | echo esc_attr(stripslashes(get_option($value['id']))); |
| 1035 | 1035 | } else {
|
| 1036 | 1036 | echo esc_attr($value['std']); |
| 1037 | 1037 | } ?>"/> |
| 1038 | - <?php $gm_api_url = 'https://console.developers.google.com/henhouse/?pb=["hh-1","maps_backend",null,[],"https://developers.google.com",null,["static_maps_backend","street_view_image_backend","maps_embed_backend","places_backend","geocoding_backend","directions_backend","distance_matrix_backend","geolocation","elevation_backend","timezone_backend","maps_backend"],null]';?> |
|
| 1039 | - <a id="gd-api-key" onclick='window.open("<?php echo wp_slash($gm_api_url);?>", "newwindow", "width=600, height=400"); return false;' href='<?php echo $gm_api_url;?>' class="button-primary" name="<?php _e('Generate API Key - ( MUST be logged in to your Google account )','geodirectory');?>" ><?php _e('Generate API Key','geodirectory');?></a>
|
|
| 1038 | + <?php $gm_api_url = 'https://console.developers.google.com/henhouse/?pb=["hh-1","maps_backend",null,[],"https://developers.google.com",null,["static_maps_backend","street_view_image_backend","maps_embed_backend","places_backend","geocoding_backend","directions_backend","distance_matrix_backend","geolocation","elevation_backend","timezone_backend","maps_backend"],null]'; ?> |
|
| 1039 | + <a id="gd-api-key" onclick='window.open("<?php echo wp_slash($gm_api_url); ?>", "newwindow", "width=600, height=400"); return false;' href='<?php echo $gm_api_url; ?>' class="button-primary" name="<?php _e('Generate API Key - ( MUST be logged in to your Google account )', 'geodirectory'); ?>" ><?php _e('Generate API Key', 'geodirectory'); ?></a>
|
|
| 1040 | 1040 | <span class="description"><?php echo $value['desc']; ?></span></td> |
| 1041 | 1041 | </tr><?php |
| 1042 | 1042 | break; |
@@ -1048,7 +1048,7 @@ discard block |
||
| 1048 | 1048 | <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>" |
| 1049 | 1049 | id="<?php echo esc_attr($value['id']); ?>" |
| 1050 | 1050 | type="<?php echo esc_attr($value['type']); ?>" |
| 1051 | - <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
|
|
| 1051 | + <?php if (isset($value['placeholder'])) {?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
|
|
| 1052 | 1052 | style="<?php echo esc_attr($value['css']); ?>" |
| 1053 | 1053 | value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
|
| 1054 | 1054 | echo esc_attr(stripslashes(get_option($value['id']))); |
@@ -1094,17 +1094,17 @@ discard block |
||
| 1094 | 1094 | <?php _e('Width', 'geodirectory'); ?> <input
|
| 1095 | 1095 | name="<?php echo esc_attr($value['id']); ?>_width" |
| 1096 | 1096 | id="<?php echo esc_attr($value['id']); ?>_width" type="text" size="3" |
| 1097 | - value="<?php if ($size = get_option($value['id'] . '_width')) echo stripslashes($size); else echo $value['std']; ?>"/> |
|
| 1097 | + value="<?php if ($size = get_option($value['id'].'_width')) echo stripslashes($size); else echo $value['std']; ?>"/> |
|
| 1098 | 1098 | |
| 1099 | 1099 | <?php _e('Height', 'geodirectory'); ?> <input
|
| 1100 | 1100 | name="<?php echo esc_attr($value['id']); ?>_height" |
| 1101 | 1101 | id="<?php echo esc_attr($value['id']); ?>_height" type="text" size="3" |
| 1102 | - value="<?php if ($size = get_option($value['id'] . '_height')) echo stripslashes($size); else echo $value['std']; ?>"/> |
|
| 1102 | + value="<?php if ($size = get_option($value['id'].'_height')) echo stripslashes($size); else echo $value['std']; ?>"/> |
|
| 1103 | 1103 | |
| 1104 | 1104 | <label><?php _e('Hard Crop', 'geodirectory'); ?> <input
|
| 1105 | 1105 | name="<?php echo esc_attr($value['id']); ?>_crop" |
| 1106 | 1106 | id="<?php echo esc_attr($value['id']); ?>_crop" |
| 1107 | - type="checkbox" <?php if (get_option($value['id'] . '_crop') != '') checked(get_option($value['id'] . '_crop'), 1); else checked(1); ?> /></label> |
|
| 1107 | + type="checkbox" <?php if (get_option($value['id'].'_crop') != '') checked(get_option($value['id'].'_crop'), 1); else checked(1); ?> /></label> |
|
| 1108 | 1108 | |
| 1109 | 1109 | <span class="description"><?php echo $value['desc'] ?></span></td> |
| 1110 | 1110 | </tr><?php |
@@ -1154,7 +1154,7 @@ discard block |
||
| 1154 | 1154 | id="<?php echo esc_attr($value['id']); ?>" |
| 1155 | 1155 | style="<?php echo esc_attr($value['css']); ?>" |
| 1156 | 1156 | class="<?php if (isset($value['class'])) echo $value['class']; ?>" |
| 1157 | - data-placeholder="<?php if (isset($value['placeholder_text'])) echo $value['placeholder_text'];?>" |
|
| 1157 | + data-placeholder="<?php if (isset($value['placeholder_text'])) echo $value['placeholder_text']; ?>" |
|
| 1158 | 1158 | option-ajaxchosen="false"> |
| 1159 | 1159 | <?php |
| 1160 | 1160 | foreach ($value['options'] as $key => $val) {
|
@@ -1164,7 +1164,7 @@ discard block |
||
| 1164 | 1164 | ?></optgroup><?php |
| 1165 | 1165 | } else {
|
| 1166 | 1166 | ?> |
| 1167 | - <option value="<?php echo esc_attr($key); ?>" <?php selected(true, (is_array($option_values) && in_array($key, $option_values)));?>> |
|
| 1167 | + <option value="<?php echo esc_attr($key); ?>" <?php selected(true, (is_array($option_values) && in_array($key, $option_values))); ?>> |
|
| 1168 | 1168 | <?php echo geodir_utf8_ucfirst($val) ?> |
| 1169 | 1169 | </option> |
| 1170 | 1170 | <?php |
@@ -1201,7 +1201,7 @@ discard block |
||
| 1201 | 1201 | ?> |
| 1202 | 1202 | |
| 1203 | 1203 | <tr valign="top"> |
| 1204 | - <th class="titledesc" width="40%"><?php _e('Default map language', 'geodirectory');?></th>
|
|
| 1204 | + <th class="titledesc" width="40%"><?php _e('Default map language', 'geodirectory'); ?></th>
|
|
| 1205 | 1205 | <td width="60%"> |
| 1206 | 1206 | <select name="geodir_default_map_language" style="width:60%"> |
| 1207 | 1207 | <?php |
@@ -1283,7 +1283,7 @@ discard block |
||
| 1283 | 1283 | |
| 1284 | 1284 | <tr valign="top"> |
| 1285 | 1285 | <th class="titledesc" |
| 1286 | - width="40%"><?php _e('Default post type search on map', 'geodirectory');?></th>
|
|
| 1286 | + width="40%"><?php _e('Default post type search on map', 'geodirectory'); ?></th>
|
|
| 1287 | 1287 | <td width="60%"> |
| 1288 | 1288 | <select name="geodir_default_map_search_pt" style="width:60%"> |
| 1289 | 1289 | <?php |
@@ -1324,7 +1324,7 @@ discard block |
||
| 1324 | 1324 | $cat_display = 'checkbox'; |
| 1325 | 1325 | $gd_post_types = get_option('geodir_exclude_post_type_on_map');
|
| 1326 | 1326 | $gd_cats = get_option('geodir_exclude_cat_on_map');
|
| 1327 | - $gd_cats_upgrade = (int)get_option('geodir_exclude_cat_on_map_upgrade');
|
|
| 1327 | + $gd_cats_upgrade = (int) get_option('geodir_exclude_cat_on_map_upgrade');
|
|
| 1328 | 1328 | $count = 1; |
| 1329 | 1329 | ?> |
| 1330 | 1330 | <table width="70%" class="widefat"> |
@@ -1353,7 +1353,7 @@ discard block |
||
| 1353 | 1353 | name="home_map_post_types[]" |
| 1354 | 1354 | id="<?php echo esc_attr($value['id']); ?>" |
| 1355 | 1355 | value="<?php echo $key; ?>" |
| 1356 | - class="map_post_type" <?php echo $checked;?> /> |
|
| 1356 | + class="map_post_type" <?php echo $checked; ?> /> |
|
| 1357 | 1357 | <?php echo __($post_types_obj->labels->singular_name, 'geodirectory'); ?></td> |
| 1358 | 1358 | <td width="40%"> |
| 1359 | 1359 | <div class="home_map_category" style="overflow:auto;width:200px;height:100px;" |
@@ -1411,12 +1411,12 @@ discard block |
||
| 1411 | 1411 | ?> |
| 1412 | 1412 | <fieldset> |
| 1413 | 1413 | <legend class="screen-reader-text"><span><?php echo $value['name'] ?></span></legend> |
| 1414 | - <label for="<?php echo $value['id'];?>"> |
|
| 1414 | + <label for="<?php echo $value['id']; ?>"> |
|
| 1415 | 1415 | <input name="<?php echo esc_attr($value['id']); ?>" |
| 1416 | - id="<?php echo esc_attr($value['id'] . $value['value']); ?>" type="radio" |
|
| 1416 | + id="<?php echo esc_attr($value['id'].$value['value']); ?>" type="radio" |
|
| 1417 | 1417 | value="<?php echo $value['value'] ?>" <?php if (get_option($value['id']) == $value['value']) {
|
| 1418 | 1418 | echo 'checked="checked"'; |
| 1419 | - }elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
|
|
| 1419 | + }elseif (get_option($value['id']) == '' && $value['std'] == $value['value']) {echo 'checked="checked"'; } ?> />
|
|
| 1420 | 1420 | <?php echo $value['desc']; ?></label><br> |
| 1421 | 1421 | </fieldset> |
| 1422 | 1422 | <?php |
@@ -1436,9 +1436,9 @@ discard block |
||
| 1436 | 1436 | <th scope="row" class="titledesc"><?php echo $value['name'] ?></th> |
| 1437 | 1437 | <td class="forminp"> |
| 1438 | 1438 | <textarea |
| 1439 | - <?php if (isset($value['args'])) echo $value['args'] . ' '; ?>name="<?php echo esc_attr($value['id']); ?>" |
|
| 1439 | + <?php if (isset($value['args'])) echo $value['args'].' '; ?>name="<?php echo esc_attr($value['id']); ?>" |
|
| 1440 | 1440 | id="<?php echo esc_attr($value['id']); ?>" |
| 1441 | - <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
|
|
| 1441 | + <?php if (isset($value['placeholder'])) {?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
|
|
| 1442 | 1442 | style="<?php echo esc_attr($value['css']); ?>"><?php if (get_option($value['id'])) echo esc_textarea(stripslashes(get_option($value['id']))); else echo esc_textarea($value['std']); ?></textarea><span |
| 1443 | 1443 | class="description"><?php echo $value['desc'] ?></span> |
| 1444 | 1444 | |
@@ -1483,7 +1483,7 @@ discard block |
||
| 1483 | 1483 | } |
| 1484 | 1484 | } |
| 1485 | 1485 | // |
| 1486 | - $page_setting = (int)get_option($value['id']); |
|
| 1486 | + $page_setting = (int) get_option($value['id']); |
|
| 1487 | 1487 | |
| 1488 | 1488 | $args = array('name' => $value['id'],
|
| 1489 | 1489 | 'id' => $value['id'], |
@@ -1500,7 +1500,7 @@ discard block |
||
| 1500 | 1500 | <tr valign="top" class="single_select_page"> |
| 1501 | 1501 | <th scope="row" class="titledesc"><?php echo $value['name'] ?></th> |
| 1502 | 1502 | <td class="forminp"> |
| 1503 | - <?php echo str_replace(' id=', " data-placeholder='" . __('Select a page...', 'geodirectory') . "' style='" . $value['css'] . "' class='" . $value['class'] . "' " . $disabled . " id=", wp_dropdown_pages($args)); ?>
|
|
| 1503 | + <?php echo str_replace(' id=', " data-placeholder='".__('Select a page...', 'geodirectory')."' style='".$value['css']."' class='".$value['class']."' ".$disabled." id=", wp_dropdown_pages($args)); ?>
|
|
| 1504 | 1504 | <span class="description"><?php echo $value['desc'] ?></span> |
| 1505 | 1505 | </td> |
| 1506 | 1506 | </tr><?php |
@@ -1509,7 +1509,7 @@ discard block |
||
| 1509 | 1509 | } |
| 1510 | 1510 | break; |
| 1511 | 1511 | case 'single_select_country' : |
| 1512 | - $country_setting = (string)get_option($value['id']); |
|
| 1512 | + $country_setting = (string) get_option($value['id']); |
|
| 1513 | 1513 | if (strstr($country_setting, ':')) : |
| 1514 | 1514 | $country = current(explode(':', $country_setting));
|
| 1515 | 1515 | $state = end(explode(':', $country_setting));
|
@@ -1532,7 +1532,7 @@ discard block |
||
| 1532 | 1532 | case 'multi_select_countries' : |
| 1533 | 1533 | $countries = $geodirectory->countries->countries; |
| 1534 | 1534 | asort($countries); |
| 1535 | - $selections = (array)get_option($value['id']); |
|
| 1535 | + $selections = (array) get_option($value['id']); |
|
| 1536 | 1536 | ?> |
| 1537 | 1537 | <tr valign="top"> |
| 1538 | 1538 | <th scope="row" class="titledesc"><?php echo $value['name'] ?></th> |
@@ -1542,7 +1542,7 @@ discard block |
||
| 1542 | 1542 | title="Country" class="chosen_select"> |
| 1543 | 1543 | <?php |
| 1544 | 1544 | if ($countries) foreach ($countries as $key => $val) : |
| 1545 | - echo '<option value="' . $key . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>'; |
|
| 1545 | + echo '<option value="'.$key.'" '.selected(in_array($key, $selections), true, false).'>'.$val.'</option>'; |
|
| 1546 | 1546 | endforeach; |
| 1547 | 1547 | ?> |
| 1548 | 1548 | </select> |
@@ -1554,7 +1554,7 @@ discard block |
||
| 1554 | 1554 | break; |
| 1555 | 1555 | |
| 1556 | 1556 | case 'google_analytics' : |
| 1557 | - $selections = (array)get_option($value['id']); |
|
| 1557 | + $selections = (array) get_option($value['id']); |
|
| 1558 | 1558 | ?> |
| 1559 | 1559 | <tr valign="top"> |
| 1560 | 1560 | <th scope="row" class="titledesc"><?php echo $value['name'] ?></th> |
@@ -1565,30 +1565,30 @@ discard block |
||
| 1565 | 1565 | |
| 1566 | 1566 | $oAuthURL = "https://accounts.google.com/o/oauth2/auth?"; |
| 1567 | 1567 | $scope = "scope=https://www.googleapis.com/auth/analytics.readonly"; |
| 1568 | - $state = "&state=123";//any string |
|
| 1569 | - $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
|
|
| 1568 | + $state = "&state=123"; //any string |
|
| 1569 | + $redirect_uri = "&redirect_uri=".admin_url('admin-ajax.php')."?action=geodir_ga_callback";
|
|
| 1570 | 1570 | $response_type = "&response_type=code"; |
| 1571 | 1571 | $client_id = "&client_id=".get_option('geodir_ga_client_id');
|
| 1572 | 1572 | $access_type = "&access_type=offline"; |
| 1573 | 1573 | $approval_prompt = "&approval_prompt=force"; |
| 1574 | 1574 | |
| 1575 | - $auth_url = $oAuthURL . $scope . $state . $redirect_uri . $response_type . $client_id . $access_type . $approval_prompt; |
|
| 1575 | + $auth_url = $oAuthURL.$scope.$state.$redirect_uri.$response_type.$client_id.$access_type.$approval_prompt; |
|
| 1576 | 1576 | |
| 1577 | 1577 | |
| 1578 | 1578 | if (get_option('geodir_ga_auth_token')) {
|
| 1579 | 1579 | ?> |
| 1580 | 1580 | <span class="button-primary" |
| 1581 | - onclick="gd_GA_Deauthorize('<?php echo wp_create_nonce('gd_ga_deauthorize');?>');"><?php _e('Deauthorize', 'geodirectory'); ?></span>
|
|
| 1581 | + onclick="gd_GA_Deauthorize('<?php echo wp_create_nonce('gd_ga_deauthorize'); ?>');"><?php _e('Deauthorize', 'geodirectory'); ?></span>
|
|
| 1582 | 1582 | <span style="color: green; font-weight: bold;"><?php _e('Authorized', 'geodirectory'); ?></span>
|
| 1583 | 1583 | <?php |
| 1584 | 1584 | global $gd_ga_errors; |
| 1585 | - if(!empty($gd_ga_errors)){
|
|
| 1585 | + if (!empty($gd_ga_errors)) {
|
|
| 1586 | 1586 | print_r($gd_ga_errors); |
| 1587 | 1587 | } |
| 1588 | 1588 | } else {
|
| 1589 | 1589 | ?> |
| 1590 | 1590 | <span class="button-primary" |
| 1591 | - onclick="window.open('<?php echo geodir_ga_activation_url();?>', 'activate','width=700, height=600, menubar=0, status=0, location=0, toolbar=0')"><?php _e('Authorize', 'geodirectory');?></span>
|
|
| 1591 | + onclick="window.open('<?php echo geodir_ga_activation_url(); ?>', 'activate','width=700, height=600, menubar=0, status=0, location=0, toolbar=0')"><?php _e('Authorize', 'geodirectory'); ?></span>
|
|
| 1592 | 1592 | <?php |
| 1593 | 1593 | } |
| 1594 | 1594 | ?> |
@@ -1659,9 +1659,9 @@ discard block |
||
| 1659 | 1659 | |
| 1660 | 1660 | <?php if (isset($_REQUEST['active_tab']) && $_REQUEST['active_tab'] != '') { ?>
|
| 1661 | 1661 | jQuery('.geodir_option_tabs').removeClass('gd-tab-active');
|
| 1662 | - jQuery('#<?php echo sanitize_text_field($_REQUEST['active_tab']);?>').addClass('gd-tab-active');
|
|
| 1662 | + jQuery('#<?php echo sanitize_text_field($_REQUEST['active_tab']); ?>').addClass('gd-tab-active');
|
|
| 1663 | 1663 | jQuery('.gd-content-heading').hide();
|
| 1664 | - jQuery('#sub_<?php echo sanitize_text_field($_REQUEST['active_tab']);?>').show();
|
|
| 1664 | + jQuery('#sub_<?php echo sanitize_text_field($_REQUEST['active_tab']); ?>').show();
|
|
| 1665 | 1665 | <?php } ?> |
| 1666 | 1666 | }); |
| 1667 | 1667 | </script> |
@@ -1747,7 +1747,7 @@ discard block |
||
| 1747 | 1747 | wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_attachments_noncename'); |
| 1748 | 1748 | |
| 1749 | 1749 | if (geodir_get_featured_image($post_id, 'thumbnail')) {
|
| 1750 | - echo '<h4>' . __('Featured Image', 'geodirectory') . '</h4>';
|
|
| 1750 | + echo '<h4>'.__('Featured Image', 'geodirectory').'</h4>';
|
|
| 1751 | 1751 | geodir_show_featured_image($post_id, 'thumbnail'); |
| 1752 | 1752 | } |
| 1753 | 1753 | |
@@ -1758,13 +1758,13 @@ discard block |
||
| 1758 | 1758 | |
| 1759 | 1759 | <h5 class="form_title"> |
| 1760 | 1760 | <?php if ($image_limit != 0 && $image_limit == 1) {
|
| 1761 | - echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
|
|
| 1761 | + echo '<br /><small>('.__('You can upload', 'geodirectory').' '.$image_limit.' '.__('image with this package', 'geodirectory').')</small>';
|
|
| 1762 | 1762 | } ?> |
| 1763 | 1763 | <?php if ($image_limit != 0 && $image_limit > 1) {
|
| 1764 | - echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
|
|
| 1764 | + echo '<br /><small>('.__('You can upload', 'geodirectory').' '.$image_limit.' '.__('images with this package', 'geodirectory').')</small>';
|
|
| 1765 | 1765 | } ?> |
| 1766 | 1766 | <?php if ($image_limit == 0) {
|
| 1767 | - echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
|
|
| 1767 | + echo '<br /><small>('.__('You can upload unlimited images with this package', 'geodirectory').')</small>';
|
|
| 1768 | 1768 | } ?> |
| 1769 | 1769 | </h5> |
| 1770 | 1770 | |
@@ -1803,10 +1803,10 @@ discard block |
||
| 1803 | 1803 | <div |
| 1804 | 1804 | class="plupload-upload-uic hide-if-no-js <?php if ($multiple): ?>plupload-upload-uic-multiple<?php endif; ?>" |
| 1805 | 1805 | id="<?php echo $id; ?>plupload-upload-ui"> |
| 1806 | - <h4><?php _e('Drop files to upload', 'geodirectory');?></h4>
|
|
| 1806 | + <h4><?php _e('Drop files to upload', 'geodirectory'); ?></h4>
|
|
| 1807 | 1807 | <input id="<?php echo $id; ?>plupload-browse-button" type="button" |
| 1808 | 1808 | value="<?php _e('Select Files', 'geodirectory'); ?>" class="button"/>
|
| 1809 | - <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce($id . 'pluploadan'); ?>"></span> |
|
| 1809 | + <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce($id.'pluploadan'); ?>"></span> |
|
| 1810 | 1810 | <?php if ($width && $height): ?> |
| 1811 | 1811 | <span class="plupload-resize"></span> |
| 1812 | 1812 | <span class="plupload-width" id="plupload-width<?php echo $width; ?>"></span> |
@@ -1818,7 +1818,7 @@ discard block |
||
| 1818 | 1818 | id="<?php echo $id; ?>plupload-thumbs" style="border-top:1px solid #ccc; padding-top:10px;"> |
| 1819 | 1819 | </div> |
| 1820 | 1820 | <span |
| 1821 | - id="upload-msg"><?php _e('Please drag & drop the images to rearrange the order', 'geodirectory');?></span>
|
|
| 1821 | + id="upload-msg"><?php _e('Please drag & drop the images to rearrange the order', 'geodirectory'); ?></span>
|
|
| 1822 | 1822 | <span id="<?php echo $id; ?>upload-error" style="display:none"></span> |
| 1823 | 1823 | </div> |
| 1824 | 1824 | |
@@ -2028,9 +2028,9 @@ discard block |
||
| 2028 | 2028 | $plugin = 'avada-nag'; |
| 2029 | 2029 | $timestamp = 'avada-nag1234'; |
| 2030 | 2030 | $message = __('Welcome to GeoDirectory, please have a look <a href="https://docs.wpgeodirectory.com/category/getting-started/" target="_blank">here</a> to get started. :)', 'geodirectory');
|
| 2031 | - echo '<div id="' . $timestamp . '" class="error">'; |
|
| 2032 | - echo '<span class="gd-remove-noti" onclick="gdRemoveANotification(\'' . $plugin . '\',\'' . $timestamp . '\');" ><i class="fas fa-times"></i></span>'; |
|
| 2033 | - echo "<img class='gd-icon-noti' src='" . plugin_dir_url('') . "geodirectory/geodirectory-assets/images/favicon.ico' > ";
|
|
| 2031 | + echo '<div id="'.$timestamp.'" class="error">'; |
|
| 2032 | + echo '<span class="gd-remove-noti" onclick="gdRemoveANotification(\''.$plugin.'\',\''.$timestamp.'\');" ><i class="fas fa-times"></i></span>'; |
|
| 2033 | + echo "<img class='gd-icon-noti' src='".plugin_dir_url('')."geodirectory/geodirectory-assets/images/favicon.ico' > ";
|
|
| 2034 | 2034 | echo "<p>$message</p>"; |
| 2035 | 2035 | echo "</div>"; |
| 2036 | 2036 | |
@@ -2164,7 +2164,7 @@ discard block |
||
| 2164 | 2164 | |
| 2165 | 2165 | // Don't allow same slug url for listing and location |
| 2166 | 2166 | if (geodir_strtolower($listing_prefix) == geodir_strtolower($location_prefix)) {
|
| 2167 | - $redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $active_tab . '&msg=fail&gderr=21');
|
|
| 2167 | + $redirect_url = admin_url('admin.php?page=geodirectory&tab='.$current_tab.'&active_tab='.$active_tab.'&msg=fail&gderr=21');
|
|
| 2168 | 2168 | wp_redirect($redirect_url); |
| 2169 | 2169 | exit; |
| 2170 | 2170 | } |
@@ -2176,7 +2176,7 @@ discard block |
||
| 2176 | 2176 | $default_language = $sitepress->get_default_language(); |
| 2177 | 2177 | |
| 2178 | 2178 | if ($current_language != 'all' && $current_language != $default_language) {
|
| 2179 | - $redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $active_tab);
|
|
| 2179 | + $redirect_url = admin_url('admin.php?page=geodirectory&tab='.$current_tab.'&active_tab='.$active_tab);
|
|
| 2180 | 2180 | wp_redirect($redirect_url); |
| 2181 | 2181 | exit; |
| 2182 | 2182 | } |
@@ -2197,11 +2197,11 @@ discard block |
||
| 2197 | 2197 | function geodir_hide_admin_preview_button() {
|
| 2198 | 2198 | global $post_type; |
| 2199 | 2199 | $post_types = geodir_get_posttypes(); |
| 2200 | - if(in_array($post_type, $post_types)) |
|
| 2200 | + if (in_array($post_type, $post_types)) |
|
| 2201 | 2201 | echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
|
| 2202 | 2202 | } |
| 2203 | -add_action( 'admin_head-post-new.php', 'geodir_hide_admin_preview_button' ); |
|
| 2204 | -add_action( 'admin_head-post.php', 'geodir_hide_admin_preview_button' ); |
|
| 2203 | +add_action('admin_head-post-new.php', 'geodir_hide_admin_preview_button');
|
|
| 2204 | +add_action('admin_head-post.php', 'geodir_hide_admin_preview_button');
|
|
| 2205 | 2205 | |
| 2206 | 2206 | /** |
| 2207 | 2207 | * Add the tab in left sidebar menu fro import & export page. |
@@ -2211,8 +2211,8 @@ discard block |
||
| 2211 | 2211 | * |
| 2212 | 2212 | * @return array Array of tab data. |
| 2213 | 2213 | */ |
| 2214 | -function geodir_import_export_tab( $tabs ) {
|
|
| 2215 | - $tabs['import_export'] = array( 'label' => __( 'Import & Export', 'geodirectory' ) ); |
|
| 2214 | +function geodir_import_export_tab($tabs) {
|
|
| 2215 | + $tabs['import_export'] = array('label' => __('Import & Export', 'geodirectory'));
|
|
| 2216 | 2216 | return $tabs; |
| 2217 | 2217 | } |
| 2218 | 2218 | |
@@ -2226,8 +2226,8 @@ discard block |
||
| 2226 | 2226 | * @return string Html content. |
| 2227 | 2227 | */ |
| 2228 | 2228 | function geodir_import_export_page() {
|
| 2229 | - $nonce = wp_create_nonce( 'geodir_import_export_nonce' ); |
|
| 2230 | - $gd_cats_sample_csv = geodir_plugin_url() . '/geodirectory-assets/gd_sample_categories.csv'; |
|
| 2229 | + $nonce = wp_create_nonce('geodir_import_export_nonce');
|
|
| 2230 | + $gd_cats_sample_csv = geodir_plugin_url().'/geodirectory-assets/gd_sample_categories.csv'; |
|
| 2231 | 2231 | /** |
| 2232 | 2232 | * Filter sample category data csv file url. |
| 2233 | 2233 | * |
@@ -2236,9 +2236,9 @@ discard block |
||
| 2236 | 2236 | * |
| 2237 | 2237 | * @param string $gd_cats_sample_csv Sample category data csv file url. |
| 2238 | 2238 | */ |
| 2239 | - $gd_cats_sample_csv = apply_filters( 'geodir_export_cats_sample_csv', $gd_cats_sample_csv ); |
|
| 2239 | + $gd_cats_sample_csv = apply_filters('geodir_export_cats_sample_csv', $gd_cats_sample_csv);
|
|
| 2240 | 2240 | |
| 2241 | - $gd_posts_sample_csv = geodir_plugin_url() . '/geodirectory-assets/place_listing.csv'; |
|
| 2241 | + $gd_posts_sample_csv = geodir_plugin_url().'/geodirectory-assets/place_listing.csv'; |
|
| 2242 | 2242 | /** |
| 2243 | 2243 | * Filter sample post data csv file url. |
| 2244 | 2244 | * |
@@ -2247,15 +2247,15 @@ discard block |
||
| 2247 | 2247 | * |
| 2248 | 2248 | * @param string $gd_posts_sample_csv Sample post data csv file url. |
| 2249 | 2249 | */ |
| 2250 | - $gd_posts_sample_csv = apply_filters( 'geodir_export_posts_sample_csv', $gd_posts_sample_csv ); |
|
| 2250 | + $gd_posts_sample_csv = apply_filters('geodir_export_posts_sample_csv', $gd_posts_sample_csv);
|
|
| 2251 | 2251 | |
| 2252 | - $gd_posttypes = geodir_get_posttypes( 'array' ); |
|
| 2252 | + $gd_posttypes = geodir_get_posttypes('array');
|
|
| 2253 | 2253 | |
| 2254 | 2254 | $gd_posttypes_option = ''; |
| 2255 | - foreach ( $gd_posttypes as $gd_posttype => $row ) {
|
|
| 2256 | - $gd_posttypes_option .= '<option value="' . $gd_posttype . '" data-cats="' . (int)geodir_get_terms_count( $gd_posttype ) . '" data-posts="' . (int)geodir_get_posts_count( $gd_posttype ) . '">' . __( $row['labels']['name'], 'geodirectory' ) . '</option>'; |
|
| 2255 | + foreach ($gd_posttypes as $gd_posttype => $row) {
|
|
| 2256 | + $gd_posttypes_option .= '<option value="'.$gd_posttype.'" data-cats="'.(int) geodir_get_terms_count($gd_posttype).'" data-posts="'.(int) geodir_get_posts_count($gd_posttype).'">'.__($row['labels']['name'], 'geodirectory').'</option>'; |
|
| 2257 | 2257 | } |
| 2258 | - wp_enqueue_script( 'jquery-ui-progressbar' ); |
|
| 2258 | + wp_enqueue_script('jquery-ui-progressbar');
|
|
| 2259 | 2259 | |
| 2260 | 2260 | $gd_chunksize_options = array(); |
| 2261 | 2261 | $gd_chunksize_options[100] = 100; |
@@ -2277,50 +2277,50 @@ discard block |
||
| 2277 | 2277 | * |
| 2278 | 2278 | * @param string $gd_chunksize_options Entries options. |
| 2279 | 2279 | */ |
| 2280 | - $gd_chunksize_options = apply_filters( 'geodir_export_csv_chunksize_options', $gd_chunksize_options ); |
|
| 2280 | + $gd_chunksize_options = apply_filters('geodir_export_csv_chunksize_options', $gd_chunksize_options);
|
|
| 2281 | 2281 | |
| 2282 | 2282 | $gd_chunksize_option = ''; |
| 2283 | 2283 | foreach ($gd_chunksize_options as $value => $title) {
|
| 2284 | - $gd_chunksize_option .= '<option value="' . $value . '" ' . selected($value, 5000, false) . '>' . $title . '</option>'; |
|
| 2284 | + $gd_chunksize_option .= '<option value="'.$value.'" '.selected($value, 5000, false).'>'.$title.'</option>'; |
|
| 2285 | 2285 | } |
| 2286 | 2286 | |
| 2287 | 2287 | $uploads = wp_upload_dir(); |
| 2288 | - $upload_dir = wp_sprintf( CSV_TRANSFER_IMG_FOLDER, str_replace( ABSPATH, '', $uploads['path'] ) ); |
|
| 2288 | + $upload_dir = wp_sprintf(CSV_TRANSFER_IMG_FOLDER, str_replace(ABSPATH, '', $uploads['path'])); |
|
| 2289 | 2289 | ?> |
| 2290 | 2290 | </form> |
| 2291 | 2291 | <div class="inner_content_tab_main gd-import-export"> |
| 2292 | - <h3><?php _e( 'GD Import & Export CSV', 'geodirectory' ) ;?></h3> |
|
| 2293 | - <span class="description"><?php _e( 'Import & export csv for GD listings & categories.', 'geodirectory' ) ;?></span> |
|
| 2292 | + <h3><?php _e('GD Import & Export CSV', 'geodirectory'); ?></h3>
|
|
| 2293 | + <span class="description"><?php _e('Import & export csv for GD listings & categories.', 'geodirectory'); ?></span>
|
|
| 2294 | 2294 | <div class="gd-content-heading"> |
| 2295 | 2295 | |
| 2296 | 2296 | <?php |
| 2297 | 2297 | @ini_set('max_execution_time', 999999);
|
| 2298 | - $ini_max_execution_time_check = @ini_get( 'max_execution_time' ); |
|
| 2298 | + $ini_max_execution_time_check = @ini_get('max_execution_time');
|
|
| 2299 | 2299 | @ini_restore('max_execution_time');
|
| 2300 | 2300 | |
| 2301 | - if($ini_max_execution_time_check != 999999){ // only show these setting to the user if we can't change the ini setting
|
|
| 2301 | + if ($ini_max_execution_time_check != 999999) { // only show these setting to the user if we can't change the ini setting
|
|
| 2302 | 2302 | ?> |
| 2303 | 2303 | <div id="gd_ie_reqs" class="metabox-holder"> |
| 2304 | 2304 | <div class="meta-box-sortables ui-sortable"> |
| 2305 | 2305 | <div class="postbox"> |
| 2306 | - <h3 class="hndle"><span style='vertical-align:top;'><?php echo __( 'PHP Requirements for GD Import & Export CSV', 'geodirectory' );?></span></h3> |
|
| 2306 | + <h3 class="hndle"><span style='vertical-align:top;'><?php echo __('PHP Requirements for GD Import & Export CSV', 'geodirectory'); ?></span></h3>
|
|
| 2307 | 2307 | <div class="inside"> |
| 2308 | - <span class="description"><?php echo __( 'Note: In case GD import & export csv not working for larger data then please check and configure following php settings.', 'geodirectory' );?></span> |
|
| 2308 | + <span class="description"><?php echo __('Note: In case GD import & export csv not working for larger data then please check and configure following php settings.', 'geodirectory'); ?></span>
|
|
| 2309 | 2309 | <table class="form-table"> |
| 2310 | 2310 | <thead> |
| 2311 | 2311 | <tr> |
| 2312 | - <th><?php _e( 'PHP Settings', 'geodirectory' );?></th><th><?php _e( 'Current Value', 'geodirectory' );?></th><th><?php _e( 'Recommended Value', 'geodirectory' );?></th> |
|
| 2312 | + <th><?php _e('PHP Settings', 'geodirectory'); ?></th><th><?php _e('Current Value', 'geodirectory'); ?></th><th><?php _e('Recommended Value', 'geodirectory'); ?></th>
|
|
| 2313 | 2313 | </tr> |
| 2314 | 2314 | </thead> |
| 2315 | 2315 | <tbody> |
| 2316 | 2316 | <tr> |
| 2317 | - <td>max_input_time</td><td><?php echo @ini_get( 'max_input_time' );?></td><td>3000</td> |
|
| 2317 | + <td>max_input_time</td><td><?php echo @ini_get('max_input_time'); ?></td><td>3000</td>
|
|
| 2318 | 2318 | </tr> |
| 2319 | 2319 | <tr> |
| 2320 | - <td>max_execution_time</td><td><?php echo @ini_get( 'max_execution_time' );?></td><td>3000</td> |
|
| 2320 | + <td>max_execution_time</td><td><?php echo @ini_get('max_execution_time'); ?></td><td>3000</td>
|
|
| 2321 | 2321 | </tr> |
| 2322 | 2322 | <tr> |
| 2323 | - <td>memory_limit</td><td><?php echo @ini_get( 'memory_limit' );?></td><td>256M</td> |
|
| 2323 | + <td>memory_limit</td><td><?php echo @ini_get('memory_limit'); ?></td><td>256M</td>
|
|
| 2324 | 2324 | </tr> |
| 2325 | 2325 | </tbody> |
| 2326 | 2326 | </table> |
@@ -2332,21 +2332,21 @@ discard block |
||
| 2332 | 2332 | <div id="gd_ie_imposts" class="metabox-holder"> |
| 2333 | 2333 | <div class="meta-box-sortables ui-sortable"> |
| 2334 | 2334 | <div id="gd_ie_im_posts" class="postbox gd-hndle-pbox"> |
| 2335 | - <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e( 'Toggle panel - GD Listings: Import CSV', 'geodirectory' );?></span><span aria-hidden="true" class="toggle-indicator"></span></button> |
|
| 2336 | - <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Listings: Import CSV', 'geodirectory' );?></span></h3> |
|
| 2335 | + <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e('Toggle panel - GD Listings: Import CSV', 'geodirectory'); ?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
|
|
| 2336 | + <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Listings: Import CSV', 'geodirectory'); ?></span></h3>
|
|
| 2337 | 2337 | <div class="inside"> |
| 2338 | 2338 | <table class="form-table"> |
| 2339 | 2339 | <tbody> |
| 2340 | 2340 | <tr> |
| 2341 | 2341 | <td class="gd-imex-box"> |
| 2342 | 2342 | <div class="gd-im-choices"> |
| 2343 | - <p><input type="radio" value="update" name="gd_im_choicepost" id="gd_im_pchoice_u" /><label for="gd_im_pchoice_u"><?php _e( 'Update listing if post with post_id already exists.', 'geodirectory' );?></label></p> |
|
| 2344 | - <p><input type="radio" checked="checked" value="skip" name="gd_im_choicepost" id="gd_im_pchoice_s" /><label for="gd_im_pchoice_s"><?php _e( 'Ignore listing if post with post_id already exists.', 'geodirectory' );?></label></p> |
|
| 2343 | + <p><input type="radio" value="update" name="gd_im_choicepost" id="gd_im_pchoice_u" /><label for="gd_im_pchoice_u"><?php _e('Update listing if post with post_id already exists.', 'geodirectory'); ?></label></p>
|
|
| 2344 | + <p><input type="radio" checked="checked" value="skip" name="gd_im_choicepost" id="gd_im_pchoice_s" /><label for="gd_im_pchoice_s"><?php _e('Ignore listing if post with post_id already exists.', 'geodirectory'); ?></label></p>
|
|
| 2345 | 2345 | </div> |
| 2346 | 2346 | <div class="plupload-upload-uic hide-if-no-js" id="gd_im_postplupload-upload-ui"> |
| 2347 | 2347 | <input type="text" readonly="readonly" name="gd_im_post_file" class="gd-imex-file gd_im_post_file" id="gd_im_post" onclick="jQuery('#gd_im_postplupload-browse-button').trigger('click');" />
|
| 2348 | - <input id="gd_im_postplupload-browse-button" type="button" value="<?php echo SELECT_UPLOAD_CSV; ?>" class="gd-imex-pupload button-primary" /><input type="button" value="<?php echo esc_attr( __( 'Download Sample CSV', 'geodirectory' ) );?>" class="button-secondary" name="gd_ie_imposts_sample" id="gd_ie_imposts_sample"> |
|
| 2349 | - <input type="hidden" id="gd_ie_imposts_csv" value="<?php echo $gd_posts_sample_csv;?>" /> |
|
| 2348 | + <input id="gd_im_postplupload-browse-button" type="button" value="<?php echo SELECT_UPLOAD_CSV; ?>" class="gd-imex-pupload button-primary" /><input type="button" value="<?php echo esc_attr(__('Download Sample CSV', 'geodirectory')); ?>" class="button-secondary" name="gd_ie_imposts_sample" id="gd_ie_imposts_sample">
|
|
| 2349 | + <input type="hidden" id="gd_ie_imposts_csv" value="<?php echo $gd_posts_sample_csv; ?>" /> |
|
| 2350 | 2350 | <input type="hidden" id="gd_im_post_allowed_types" data-exts=".csv" value="csv" /> |
| 2351 | 2351 | <?php |
| 2352 | 2352 | /** |
@@ -2356,7 +2356,7 @@ discard block |
||
| 2356 | 2356 | */ |
| 2357 | 2357 | do_action('geodir_sample_csv_download_link');
|
| 2358 | 2358 | ?> |
| 2359 | - <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce( 'gd_im_postpluploadan' ); ?>"></span> |
|
| 2359 | + <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce('gd_im_postpluploadan'); ?>"></span>
|
|
| 2360 | 2360 | <div class="filelist"></div> |
| 2361 | 2361 | </div> |
| 2362 | 2362 | <span id="gd_im_postupload-error" style="display:none"></span> |
@@ -2374,7 +2374,7 @@ discard block |
||
| 2374 | 2374 | <input type="hidden" id="gd_terminateaction" value="continue"/> |
| 2375 | 2375 | </div> |
| 2376 | 2376 | <div class="gd-import-progress" id="gd-import-progress" style="display:none"> |
| 2377 | - <div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory');?> </b><font
|
|
| 2377 | + <div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory'); ?> </b><font
|
|
| 2378 | 2378 | id="gd-import-done">0</font> / <font id="gd-import-total">0</font> ( <font |
| 2379 | 2379 | id="gd-import-perc">0%</font> ) |
| 2380 | 2380 | <div class="gd-fileprogress"></div> |
@@ -2386,10 +2386,10 @@ discard block |
||
| 2386 | 2386 | <div class="gd-imex-btns" style="display:none;"> |
| 2387 | 2387 | <input type="hidden" class="geodir_import_file" name="geodir_import_file" value="save"/> |
| 2388 | 2388 | <input onclick="gd_imex_PrepareImport(this, 'post')" type="button" value="<?php echo CSV_IMPORT_DATA; ?>" id="gd_import_data" class="button-primary" /> |
| 2389 | - <input onclick="gd_imex_ContinueImport(this, 'post')" type="button" value="<?php _e( "Continue Import Data", 'geodirectory' );?>" id="gd_continue_data" class="button-primary" style="display:none"/> |
|
| 2390 | - <input type="button" value="<?php _e("Terminate Import Data", 'geodirectory');?>" id="gd_stop_import" class="button-primary" name="gd_stop_import" style="display:none" onclick="gd_imex_TerminateImport(this, 'post')"/>
|
|
| 2389 | + <input onclick="gd_imex_ContinueImport(this, 'post')" type="button" value="<?php _e("Continue Import Data", 'geodirectory'); ?>" id="gd_continue_data" class="button-primary" style="display:none"/>
|
|
| 2390 | + <input type="button" value="<?php _e("Terminate Import Data", 'geodirectory'); ?>" id="gd_stop_import" class="button-primary" name="gd_stop_import" style="display:none" onclick="gd_imex_TerminateImport(this, 'post')"/>
|
|
| 2391 | 2391 | <div id="gd_process_data" style="display:none"> |
| 2392 | - <span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory');?>
|
|
| 2392 | + <span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory'); ?>
|
|
| 2393 | 2393 | </div> |
| 2394 | 2394 | </div> |
| 2395 | 2395 | </td> |
@@ -2403,30 +2403,30 @@ discard block |
||
| 2403 | 2403 | <div id="gd_ie_excategs" class="metabox-holder"> |
| 2404 | 2404 | <div class="meta-box-sortables ui-sortable"> |
| 2405 | 2405 | <div id="gd_ie_ex_posts" class="postbox gd-hndle-pbox"> |
| 2406 | - <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e( 'Toggle panel - Listings: Export CSV', 'geodirectory' );?></span><span aria-hidden="true" class="toggle-indicator"></span></button> |
|
| 2407 | - <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Listings: Export CSV', 'geodirectory' );?></span></h3> |
|
| 2406 | + <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e('Toggle panel - Listings: Export CSV', 'geodirectory'); ?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
|
|
| 2407 | + <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Listings: Export CSV', 'geodirectory'); ?></span></h3>
|
|
| 2408 | 2408 | <div class="inside"> |
| 2409 | 2409 | <table class="form-table"> |
| 2410 | 2410 | <tbody> |
| 2411 | 2411 | <tr> |
| 2412 | 2412 | <td class="fld"><label for="gd_post_type"> |
| 2413 | - <?php _e( 'Post Type:', 'geodirectory' );?> |
|
| 2413 | + <?php _e('Post Type:', 'geodirectory'); ?>
|
|
| 2414 | 2414 | </label></td> |
| 2415 | 2415 | <td><select name="gd_post_type" id="gd_post_type" style="min-width:140px"> |
| 2416 | - <?php echo $gd_posttypes_option;?> |
|
| 2416 | + <?php echo $gd_posttypes_option; ?> |
|
| 2417 | 2417 | </select></td> |
| 2418 | 2418 | </tr> |
| 2419 | 2419 | <tr> |
| 2420 | - <td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e( 'Max entries per csv file:', 'geodirectory' );?></label></td> |
|
| 2421 | - <td><select name="gd_chunk_size" id="gd_chunk_size" style="min-width:140px"><?php echo $gd_chunksize_option;?></select><span class="description"><?php _e( 'Please select the maximum number of entries per csv file (defaults to 5000, you might want to lower this to prevent memory issues on some installs)', 'geodirectory' );?></span></td> |
|
| 2420 | + <td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e('Max entries per csv file:', 'geodirectory'); ?></label></td>
|
|
| 2421 | + <td><select name="gd_chunk_size" id="gd_chunk_size" style="min-width:140px"><?php echo $gd_chunksize_option; ?></select><span class="description"><?php _e('Please select the maximum number of entries per csv file (defaults to 5000, you might want to lower this to prevent memory issues on some installs)', 'geodirectory'); ?></span></td>
|
|
| 2422 | 2422 | </tr> |
| 2423 | 2423 | <tr class="gd-imex-dates"> |
| 2424 | - <td class="fld"><label><?php _e( 'Published Date:', 'geodirectory' );?></label></td> |
|
| 2425 | - <td><label><span class="label-responsive"><?php _e( 'Start date:', 'geodirectory' );?></span><input type="text" id="gd_imex_start_date" name="gd_imex[start_date]" data-type="date" /></label><label><span class="label-responsive"><?php _e( 'End date:', 'geodirectory' );?></span><input type="text" id="gd_imex_end_date" name="gd_imex[end_date]" data-type="date" /></label></td> |
|
| 2424 | + <td class="fld"><label><?php _e('Published Date:', 'geodirectory'); ?></label></td>
|
|
| 2425 | + <td><label><span class="label-responsive"><?php _e('Start date:', 'geodirectory'); ?></span><input type="text" id="gd_imex_start_date" name="gd_imex[start_date]" data-type="date" /></label><label><span class="label-responsive"><?php _e('End date:', 'geodirectory'); ?></span><input type="text" id="gd_imex_end_date" name="gd_imex[end_date]" data-type="date" /></label></td>
|
|
| 2426 | 2426 | </tr> |
| 2427 | 2427 | <tr> |
| 2428 | 2428 | <td class="fld" style="vertical-align:top"><label> |
| 2429 | - <?php _e( 'Progress:', 'geodirectory' );?> |
|
| 2429 | + <?php _e('Progress:', 'geodirectory'); ?>
|
|
| 2430 | 2430 | </label></td> |
| 2431 | 2431 | <td><div id='gd_progressbar_box'> |
| 2432 | 2432 | <div id="gd_progressbar" class="gd_progressbar"> |
@@ -2434,13 +2434,13 @@ discard block |
||
| 2434 | 2434 | </div> |
| 2435 | 2435 | </div> |
| 2436 | 2436 | <p style="display:inline-block"> |
| 2437 | - <?php _e( 'Elapsed Time:', 'geodirectory' );?> |
|
| 2437 | + <?php _e('Elapsed Time:', 'geodirectory'); ?>
|
|
| 2438 | 2438 | </p> |
| 2439 | 2439 | |
| 2440 | 2440 | <p id="gd_timer" class="gd_timer">00:00:00</p></td> |
| 2441 | 2441 | </tr> |
| 2442 | 2442 | <tr class="gd-ie-actions"> |
| 2443 | - <td style="vertical-align:top"><input type="submit" value="<?php echo esc_attr( __( 'Export CSV', 'geodirectory' ) );?>" class="button-primary" name="gd_ie_exposts_submit" id="gd_ie_exposts_submit"> |
|
| 2443 | + <td style="vertical-align:top"><input type="submit" value="<?php echo esc_attr(__('Export CSV', 'geodirectory')); ?>" class="button-primary" name="gd_ie_exposts_submit" id="gd_ie_exposts_submit">
|
|
| 2444 | 2444 | </td> |
| 2445 | 2445 | <td id="gd_ie_ex_files" class="gd-ie-files"></td> |
| 2446 | 2446 | </tr> |
@@ -2453,21 +2453,21 @@ discard block |
||
| 2453 | 2453 | <div id="gd_ie_imcategs" class="metabox-holder"> |
| 2454 | 2454 | <div class="meta-box-sortables ui-sortable"> |
| 2455 | 2455 | <div id="gd_ie_imcats" class="postbox gd-hndle-pbox"> |
| 2456 | - <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e( 'Toggle panel - GD Categories: Import CSV', 'geodirectory' );?></span><span aria-hidden="true" class="toggle-indicator"></span></button> |
|
| 2457 | - <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Categories: Import CSV', 'geodirectory' );?></span></h3> |
|
| 2456 | + <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e('Toggle panel - GD Categories: Import CSV', 'geodirectory'); ?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
|
|
| 2457 | + <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Categories: Import CSV', 'geodirectory'); ?></span></h3>
|
|
| 2458 | 2458 | <div class="inside"> |
| 2459 | 2459 | <table class="form-table"> |
| 2460 | 2460 | <tbody> |
| 2461 | 2461 | <tr> |
| 2462 | 2462 | <td class="gd-imex-box"> |
| 2463 | 2463 | <div class="gd-im-choices"> |
| 2464 | - <p><input type="radio" value="update" name="gd_im_choicecat" id="gd_im_cchoice_u" /><label for="gd_im_cchoice_u"><?php _e( 'Update item if item with cat_id/cat_slug already exists.', 'geodirectory' );?></label></p> |
|
| 2465 | - <p><input type="radio" checked="checked" value="skip" name="gd_im_choicecat" id="gd_im_cchoice_s" /><label for="gd_im_cchoice_s"><?php _e( 'Ignore item if item with cat_id/cat_slug already exists.', 'geodirectory' );?></label></p> |
|
| 2464 | + <p><input type="radio" value="update" name="gd_im_choicecat" id="gd_im_cchoice_u" /><label for="gd_im_cchoice_u"><?php _e('Update item if item with cat_id/cat_slug already exists.', 'geodirectory'); ?></label></p>
|
|
| 2465 | + <p><input type="radio" checked="checked" value="skip" name="gd_im_choicecat" id="gd_im_cchoice_s" /><label for="gd_im_cchoice_s"><?php _e('Ignore item if item with cat_id/cat_slug already exists.', 'geodirectory'); ?></label></p>
|
|
| 2466 | 2466 | </div> |
| 2467 | 2467 | <div class="plupload-upload-uic hide-if-no-js" id="gd_im_catplupload-upload-ui"> |
| 2468 | 2468 | <input type="text" readonly="readonly" name="gd_im_cat_file" class="gd-imex-file gd_im_cat_file" id="gd_im_cat" onclick="jQuery('#gd_im_catplupload-browse-button').trigger('click');" />
|
| 2469 | - <input id="gd_im_catplupload-browse-button" type="button" value="<?php echo SELECT_UPLOAD_CSV; ?>" class="gd-imex-cupload button-primary" /><input type="button" value="<?php echo esc_attr( __( 'Download Sample CSV', 'geodirectory' ) );?>" class="button-secondary" name="gd_ie_imcats_sample" id="gd_ie_imcats_sample"> |
|
| 2470 | - <input type="hidden" id="gd_ie_imcats_csv" value="<?php echo $gd_cats_sample_csv;?>" /> |
|
| 2469 | + <input id="gd_im_catplupload-browse-button" type="button" value="<?php echo SELECT_UPLOAD_CSV; ?>" class="gd-imex-cupload button-primary" /><input type="button" value="<?php echo esc_attr(__('Download Sample CSV', 'geodirectory')); ?>" class="button-secondary" name="gd_ie_imcats_sample" id="gd_ie_imcats_sample">
|
|
| 2470 | + <input type="hidden" id="gd_ie_imcats_csv" value="<?php echo $gd_cats_sample_csv; ?>" /> |
|
| 2471 | 2471 | <input type="hidden" id="gd_im_cat_allowed_types" data-exts=".csv" value="csv" /> |
| 2472 | 2472 | <?php |
| 2473 | 2473 | /** |
@@ -2478,7 +2478,7 @@ discard block |
||
| 2478 | 2478 | */ |
| 2479 | 2479 | do_action('geodir_sample_cats_csv_download_link');
|
| 2480 | 2480 | ?> |
| 2481 | - <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce( 'gd_im_catpluploadan' ); ?>"></span> |
|
| 2481 | + <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce('gd_im_catpluploadan'); ?>"></span>
|
|
| 2482 | 2482 | <div class="filelist"></div> |
| 2483 | 2483 | </div> |
| 2484 | 2484 | <span id="gd_im_catupload-error" style="display:none"></span> |
@@ -2495,7 +2495,7 @@ discard block |
||
| 2495 | 2495 | <input type="hidden" id="gd_terminateaction" value="continue"/> |
| 2496 | 2496 | </div> |
| 2497 | 2497 | <div class="gd-import-progress" id="gd-import-progress" style="display:none"> |
| 2498 | - <div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory');?> </b><font
|
|
| 2498 | + <div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory'); ?> </b><font
|
|
| 2499 | 2499 | id="gd-import-done">0</font> / <font id="gd-import-total">0</font> ( <font |
| 2500 | 2500 | id="gd-import-perc">0%</font> ) |
| 2501 | 2501 | <div class="gd-fileprogress"></div> |
@@ -2507,10 +2507,10 @@ discard block |
||
| 2507 | 2507 | <div class="gd-imex-btns" style="display:none;"> |
| 2508 | 2508 | <input type="hidden" class="geodir_import_file" name="geodir_import_file" value="save"/> |
| 2509 | 2509 | <input onclick="gd_imex_PrepareImport(this, 'cat')" type="button" value="<?php echo CSV_IMPORT_DATA; ?>" id="gd_import_data" class="button-primary" /> |
| 2510 | - <input onclick="gd_imex_ContinueImport(this, 'cat')" type="button" value="<?php _e( "Continue Import Data", 'geodirectory' );?>" id="gd_continue_data" class="button-primary" style="display:none"/> |
|
| 2511 | - <input type="button" value="<?php _e("Terminate Import Data", 'geodirectory');?>" id="gd_stop_import" class="button-primary" name="gd_stop_import" style="display:none" onclick="gd_imex_TerminateImport(this, 'cat')"/>
|
|
| 2510 | + <input onclick="gd_imex_ContinueImport(this, 'cat')" type="button" value="<?php _e("Continue Import Data", 'geodirectory'); ?>" id="gd_continue_data" class="button-primary" style="display:none"/>
|
|
| 2511 | + <input type="button" value="<?php _e("Terminate Import Data", 'geodirectory'); ?>" id="gd_stop_import" class="button-primary" name="gd_stop_import" style="display:none" onclick="gd_imex_TerminateImport(this, 'cat')"/>
|
|
| 2512 | 2512 | <div id="gd_process_data" style="display:none"> |
| 2513 | - <span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory');?>
|
|
| 2513 | + <span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory'); ?>
|
|
| 2514 | 2514 | </div> |
| 2515 | 2515 | </div> |
| 2516 | 2516 | </td> |
@@ -2524,26 +2524,26 @@ discard block |
||
| 2524 | 2524 | <div id="gd_ie_excategs" class="metabox-holder"> |
| 2525 | 2525 | <div class="meta-box-sortables ui-sortable"> |
| 2526 | 2526 | <div id="gd_ie_ex_cats" class="postbox gd-hndle-pbox"> |
| 2527 | - <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e( 'Toggle panel - GD Categories: Export CSV', 'geodirectory' );?></span><span aria-hidden="true" class="toggle-indicator"></span></button> |
|
| 2528 | - <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Categories: Export CSV', 'geodirectory' );?></span></h3> |
|
| 2527 | + <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e('Toggle panel - GD Categories: Export CSV', 'geodirectory'); ?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
|
|
| 2528 | + <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Categories: Export CSV', 'geodirectory'); ?></span></h3>
|
|
| 2529 | 2529 | <div class="inside"> |
| 2530 | 2530 | <table class="form-table"> |
| 2531 | 2531 | <tbody> |
| 2532 | 2532 | <tr> |
| 2533 | - <td class="fld"><label for="gd_post_type"><?php _e( 'Post Type:', 'geodirectory' );?></label></td> |
|
| 2534 | - <td><select name="gd_post_type" id="gd_post_type" style="min-width:140px"><?php echo $gd_posttypes_option;?></select></td> |
|
| 2533 | + <td class="fld"><label for="gd_post_type"><?php _e('Post Type:', 'geodirectory'); ?></label></td>
|
|
| 2534 | + <td><select name="gd_post_type" id="gd_post_type" style="min-width:140px"><?php echo $gd_posttypes_option; ?></select></td> |
|
| 2535 | 2535 | </tr> |
| 2536 | 2536 | <tr> |
| 2537 | - <td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e( 'Max entries per csv file:', 'geodirectory' );?></label></td> |
|
| 2538 | - <td><select name="gd_chunk_size" id="gd_chunk_size" style="min-width:140px"><?php echo $gd_chunksize_option;?></select><span class="description"><?php _e( 'Please select the maximum number of entries per csv file (defaults to 5000, you might want to lower this to prevent memory issues on some installs)', 'geodirectory' );?></span></td> |
|
| 2537 | + <td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e('Max entries per csv file:', 'geodirectory'); ?></label></td>
|
|
| 2538 | + <td><select name="gd_chunk_size" id="gd_chunk_size" style="min-width:140px"><?php echo $gd_chunksize_option; ?></select><span class="description"><?php _e('Please select the maximum number of entries per csv file (defaults to 5000, you might want to lower this to prevent memory issues on some installs)', 'geodirectory'); ?></span></td>
|
|
| 2539 | 2539 | </tr> |
| 2540 | 2540 | <tr> |
| 2541 | - <td class="fld" style="vertical-align:top"><label><?php _e( 'Progress:', 'geodirectory' );?></label></td> |
|
| 2542 | - <td><div id='gd_progressbar_box'><div id="gd_progressbar" class="gd_progressbar"><div class="gd-progress-label"></div></div></div><p style="display:inline-block"><?php _e( 'Elapsed Time:', 'geodirectory' );?></p> <p id="gd_timer" class="gd_timer">00:00:00</p></td> |
|
| 2541 | + <td class="fld" style="vertical-align:top"><label><?php _e('Progress:', 'geodirectory'); ?></label></td>
|
|
| 2542 | + <td><div id='gd_progressbar_box'><div id="gd_progressbar" class="gd_progressbar"><div class="gd-progress-label"></div></div></div><p style="display:inline-block"><?php _e('Elapsed Time:', 'geodirectory'); ?></p> <p id="gd_timer" class="gd_timer">00:00:00</p></td>
|
|
| 2543 | 2543 | </tr> |
| 2544 | 2544 | <tr class="gd-ie-actions"> |
| 2545 | 2545 | <td style="vertical-align:top"> |
| 2546 | - <input type="submit" value="<?php echo esc_attr( __( 'Export CSV', 'geodirectory' ) );?>" class="button-primary" name="gd_ie_excats_submit" id="gd_ie_excats_submit"> |
|
| 2546 | + <input type="submit" value="<?php echo esc_attr(__('Export CSV', 'geodirectory')); ?>" class="button-primary" name="gd_ie_excats_submit" id="gd_ie_excats_submit">
|
|
| 2547 | 2547 | </td> |
| 2548 | 2548 | <td id="gd_ie_ex_files" class="gd-ie-files"></td> |
| 2549 | 2549 | </tr> |
@@ -2565,7 +2565,7 @@ discard block |
||
| 2565 | 2565 | * @param array $gd_chunksize_options File chunk size options. |
| 2566 | 2566 | * @param string $nonce Wordpress security token for GD import & export. |
| 2567 | 2567 | */ |
| 2568 | - do_action( 'geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce ); |
|
| 2568 | + do_action('geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce);
|
|
| 2569 | 2569 | ?> |
| 2570 | 2570 | </div> |
| 2571 | 2571 | </div> |
@@ -2584,7 +2584,7 @@ discard block |
||
| 2584 | 2584 | jQuery.ajax({
|
| 2585 | 2585 | url: ajaxurl, |
| 2586 | 2586 | type: "POST", |
| 2587 | - data: 'action=geodir_import_export&task=prepare_import&_pt=' + type + '&_file=' + uploadedFile + '&_nonce=<?php echo $nonce;?>', |
|
| 2587 | + data: 'action=geodir_import_export&task=prepare_import&_pt=' + type + '&_file=' + uploadedFile + '&_nonce=<?php echo $nonce; ?>', |
|
| 2588 | 2588 | dataType: 'json', |
| 2589 | 2589 | cache: false, |
| 2590 | 2590 | success: function(data) {
|
@@ -2636,7 +2636,7 @@ discard block |
||
| 2636 | 2636 | |
| 2637 | 2637 | jQuery(cont).find('.filelist .file').remove();
|
| 2638 | 2638 | |
| 2639 | - jQuery('#gd-import-msg', cont).find('#message').removeClass('updated').addClass('error').html("<p><?php echo esc_attr( PLZ_SELECT_CSV_FILE );?></p>");
|
|
| 2639 | + jQuery('#gd-import-msg', cont).find('#message').removeClass('updated').addClass('error').html("<p><?php echo esc_attr(PLZ_SELECT_CSV_FILE); ?></p>");
|
|
| 2640 | 2640 | jQuery('#gd-import-msg', cont).show();
|
| 2641 | 2641 | |
| 2642 | 2642 | return false; |
@@ -2695,7 +2695,7 @@ discard block |
||
| 2695 | 2695 | jQuery.ajax({
|
| 2696 | 2696 | url: ajaxurl, |
| 2697 | 2697 | type: "POST", |
| 2698 | - data: 'action=geodir_import_export&task=import_' + type + '&_pt=' + type + '&_file=' + uploadedFile + gddata + '&_ch=' + choice + '&_nonce=<?php echo $nonce;?>', |
|
| 2698 | + data: 'action=geodir_import_export&task=import_' + type + '&_pt=' + type + '&_file=' + uploadedFile + gddata + '&_ch=' + choice + '&_nonce=<?php echo $nonce; ?>', |
|
| 2699 | 2699 | dataType : 'json', |
| 2700 | 2700 | cache: false, |
| 2701 | 2701 | success: function (data) {
|
@@ -2884,27 +2884,27 @@ discard block |
||
| 2884 | 2884 | |
| 2885 | 2885 | var gdMsg = '<p></p>'; |
| 2886 | 2886 | if ( processed > 0 ) {
|
| 2887 | - var msgParse = '<p><?php echo addslashes( sprintf( __( 'Total %s item(s) found.', 'geodirectory' ), '%s' ) );?></p>'; |
|
| 2887 | + var msgParse = '<p><?php echo addslashes(sprintf(__('Total %s item(s) found.', 'geodirectory'), '%s')); ?></p>';
|
|
| 2888 | 2888 | msgParse = msgParse.replace("%s", processed);
|
| 2889 | 2889 | gdMsg += msgParse; |
| 2890 | 2890 | } |
| 2891 | 2891 | |
| 2892 | 2892 | if ( updated > 0 ) {
|
| 2893 | - var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) updated.', 'geodirectory' ), '%s', '%d' ) );?></p>'; |
|
| 2893 | + var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) updated.', 'geodirectory'), '%s', '%d')); ?></p>';
|
|
| 2894 | 2894 | msgParse = msgParse.replace("%s", updated);
|
| 2895 | 2895 | msgParse = msgParse.replace("%d", processed);
|
| 2896 | 2896 | gdMsg += msgParse; |
| 2897 | 2897 | } |
| 2898 | 2898 | |
| 2899 | 2899 | if ( created > 0 ) {
|
| 2900 | - var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) added.', 'geodirectory' ), '%s', '%d' ) );?></p>'; |
|
| 2900 | + var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) added.', 'geodirectory'), '%s', '%d')); ?></p>';
|
|
| 2901 | 2901 | msgParse = msgParse.replace("%s", created);
|
| 2902 | 2902 | msgParse = msgParse.replace("%d", processed);
|
| 2903 | 2903 | gdMsg += msgParse; |
| 2904 | 2904 | } |
| 2905 | 2905 | |
| 2906 | 2906 | if ( skipped > 0 ) {
|
| 2907 | - var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) ignored due to already exists.', 'geodirectory' ), '%s', '%d' ) );?></p>'; |
|
| 2907 | + var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) ignored due to already exists.', 'geodirectory'), '%s', '%d')); ?></p>';
|
|
| 2908 | 2908 | msgParse = msgParse.replace("%s", skipped);
|
| 2909 | 2909 | msgParse = msgParse.replace("%d", processed);
|
| 2910 | 2910 | gdMsg += msgParse; |
@@ -2914,17 +2914,17 @@ discard block |
||
| 2914 | 2914 | if (type=='loc') {
|
| 2915 | 2915 | invalid_addr = invalid; |
| 2916 | 2916 | } |
| 2917 | - var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory' ), '%s', '%d' ) );?></p>'; |
|
| 2917 | + var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory'), '%s', '%d')); ?></p>';
|
|
| 2918 | 2918 | msgParse = msgParse.replace("%s", invalid_addr);
|
| 2919 | 2919 | msgParse = msgParse.replace("%d", total);
|
| 2920 | 2920 | gdMsg += msgParse; |
| 2921 | 2921 | } |
| 2922 | 2922 | |
| 2923 | 2923 | if (invalid > 0 && type!='loc') {
|
| 2924 | - var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) could not be added due to blank title/invalid post type/invalid characters used in data.', 'geodirectory' ), '%s', '%d' ) );?></p>'; |
|
| 2924 | + var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) could not be added due to blank title/invalid post type/invalid characters used in data.', 'geodirectory'), '%s', '%d')); ?></p>';
|
|
| 2925 | 2925 | |
| 2926 | 2926 | if (type=='hood') {
|
| 2927 | - msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) could not be added due to invalid neighbourhood data(name, latitude, longitude) or invalid location data(either location_id or city/region/country is empty)', 'geodirectory' ), '%s', '%d' ) );?></p>'; |
|
| 2927 | + msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) could not be added due to invalid neighbourhood data(name, latitude, longitude) or invalid location data(either location_id or city/region/country is empty)', 'geodirectory'), '%s', '%d')); ?></p>';
|
|
| 2928 | 2928 | } |
| 2929 | 2929 | msgParse = msgParse.replace("%s", invalid);
|
| 2930 | 2930 | msgParse = msgParse.replace("%d", total);
|
@@ -2932,7 +2932,7 @@ discard block |
||
| 2932 | 2932 | } |
| 2933 | 2933 | |
| 2934 | 2934 | if (images > 0) {
|
| 2935 | - gdMsg += '<p><?php echo addslashes( $upload_dir );?></p>'; |
|
| 2935 | + gdMsg += '<p><?php echo addslashes($upload_dir); ?></p>'; |
|
| 2936 | 2936 | } |
| 2937 | 2937 | gdMsg += '<p></p>'; |
| 2938 | 2938 | jQuery('#gd-import-msg', cont).find('#message').removeClass('error').addClass('updated').html(gdMsg);
|
@@ -3096,9 +3096,9 @@ discard block |
||
| 3096 | 3096 | if (typeof filters !== 'undefined' && filters && doFilter) {
|
| 3097 | 3097 | getTotal = true; |
| 3098 | 3098 | attach += '&_c=1'; |
| 3099 | - gd_progressbar(el, 0, '<i class="fas fa-sync fa-spin"></i><?php echo esc_attr( __( 'Preparing...', 'geodirectory' ) );?>'); |
|
| 3099 | + gd_progressbar(el, 0, '<i class="fas fa-sync fa-spin"></i><?php echo esc_attr(__('Preparing...', 'geodirectory')); ?>');
|
|
| 3100 | 3100 | } else {
|
| 3101 | - gd_progressbar(el, 0, '0% (0 / ' + total_posts + ') <i class="fas fa-sync fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>'); |
|
| 3101 | + gd_progressbar(el, 0, '0% (0 / ' + total_posts + ') <i class="fas fa-sync fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>');
|
|
| 3102 | 3102 | } |
| 3103 | 3103 | jQuery(el).find('#gd_timer').text('00:00:01');
|
| 3104 | 3104 | jQuery('#gd_ie_ex_files', el).html('');
|
@@ -3107,7 +3107,7 @@ discard block |
||
| 3107 | 3107 | jQuery.ajax({
|
| 3108 | 3108 | url: ajaxurl, |
| 3109 | 3109 | type: "POST", |
| 3110 | - data: 'action=geodir_import_export&task=export_posts&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce;?>&_p=' + page + attach, |
|
| 3110 | + data: 'action=geodir_import_export&task=export_posts&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce; ?>&_p=' + page + attach, |
|
| 3111 | 3111 | dataType : 'json', |
| 3112 | 3112 | cache: false, |
| 3113 | 3113 | beforeSend: function (jqXHR, settings) {},
|
@@ -3132,11 +3132,11 @@ discard block |
||
| 3132 | 3132 | } else {
|
| 3133 | 3133 | if (pages < page || pages == page) {
|
| 3134 | 3134 | window.clearInterval(timer_posts); |
| 3135 | - gd_progressbar(el, 100, '100% (' + total_posts + ' / ' + total_posts + ') <i class="fas fa-check"></i><?php echo esc_attr( __( 'Complete!', 'geodirectory' ) );?>');
|
|
| 3135 | + gd_progressbar(el, 100, '100% (' + total_posts + ' / ' + total_posts + ') <i class="fas fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirectory')); ?>');
|
|
| 3136 | 3136 | } else {
|
| 3137 | 3137 | var percentage = Math.round(((page * chunk_size) / total_posts) * 100); |
| 3138 | 3138 | percentage = percentage > 100 ? 100 : percentage; |
| 3139 | - gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_posts + ') <i class="fas fa-sync fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>');
|
|
| 3139 | + gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_posts + ') <i class="fas fa-sync fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>');
|
|
| 3140 | 3140 | } |
| 3141 | 3141 | if (typeof data.files != 'undefined' && jQuery(data.files).length ) {
|
| 3142 | 3142 | var obj_files = data.files; |
@@ -3167,7 +3167,7 @@ discard block |
||
| 3167 | 3167 | |
| 3168 | 3168 | function gd_process_export_cats(el, post_type, total_cats, chunk_size, pages, page) {
|
| 3169 | 3169 | if (page < 2) {
|
| 3170 | - gd_progressbar(el, 0, '0% (0 / ' + total_cats + ') <i class="fas fa-sync fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>'); |
|
| 3170 | + gd_progressbar(el, 0, '0% (0 / ' + total_cats + ') <i class="fas fa-sync fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>');
|
|
| 3171 | 3171 | jQuery(el).find('#gd_timer').text('00:00:01');
|
| 3172 | 3172 | jQuery('#gd_ie_ex_files', el).html('');
|
| 3173 | 3173 | } |
@@ -3175,7 +3175,7 @@ discard block |
||
| 3175 | 3175 | jQuery.ajax({
|
| 3176 | 3176 | url: ajaxurl, |
| 3177 | 3177 | type: "POST", |
| 3178 | - data: 'action=geodir_import_export&task=export_cats&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce;?>&_p=' + page, |
|
| 3178 | + data: 'action=geodir_import_export&task=export_cats&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce; ?>&_p=' + page, |
|
| 3179 | 3179 | dataType : 'json', |
| 3180 | 3180 | cache: false, |
| 3181 | 3181 | beforeSend: function (jqXHR, settings) {},
|
@@ -3189,11 +3189,11 @@ discard block |
||
| 3189 | 3189 | } else {
|
| 3190 | 3190 | if (pages < page || pages == page) {
|
| 3191 | 3191 | window.clearInterval(timer_cats); |
| 3192 | - gd_progressbar(el, 100, '100% (' + total_cats + ' / ' + total_cats + ') <i class="fas fa-check"></i><?php echo esc_attr( __( 'Complete!', 'geodirectory' ) );?>');
|
|
| 3192 | + gd_progressbar(el, 100, '100% (' + total_cats + ' / ' + total_cats + ') <i class="fas fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirectory')); ?>');
|
|
| 3193 | 3193 | } else {
|
| 3194 | 3194 | var percentage = Math.round(((page * chunk_size) / total_cats) * 100); |
| 3195 | 3195 | percentage = percentage > 100 ? 100 : percentage; |
| 3196 | - gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_cats + ') <i class="fas fa-sync fa-spin"></i><?php esc_attr_e( 'Exporting...', 'geodirectory' );?>');
|
|
| 3196 | + gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_cats + ') <i class="fas fa-sync fa-spin"></i><?php esc_attr_e('Exporting...', 'geodirectory'); ?>');
|
|
| 3197 | 3197 | } |
| 3198 | 3198 | if (typeof data.files != 'undefined' && jQuery(data.files).length ) {
|
| 3199 | 3199 | var obj_files = data.files; |
@@ -3250,13 +3250,13 @@ discard block |
||
| 3250 | 3250 | function geodir_init_filesystem() |
| 3251 | 3251 | {
|
| 3252 | 3252 | |
| 3253 | - if(!function_exists('get_filesystem_method')){
|
|
| 3253 | + if (!function_exists('get_filesystem_method')) {
|
|
| 3254 | 3254 | require_once(ABSPATH."/wp-admin/includes/file.php"); |
| 3255 | 3255 | } |
| 3256 | 3256 | $access_type = get_filesystem_method(); |
| 3257 | 3257 | if ($access_type === 'direct') {
|
| 3258 | 3258 | /* you can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */ |
| 3259 | - $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array()); |
|
| 3259 | + $creds = request_filesystem_credentials(trailingslashit(site_url()).'wp-admin/', '', false, false, array()); |
|
| 3260 | 3260 | |
| 3261 | 3261 | /* initialize the API */ |
| 3262 | 3262 | if (!WP_Filesystem($creds)) {
|
@@ -3269,7 +3269,7 @@ discard block |
||
| 3269 | 3269 | return $wp_filesystem; |
| 3270 | 3270 | /* do our file manipulations below */ |
| 3271 | 3271 | } elseif (defined('FTP_USER')) {
|
| 3272 | - $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array()); |
|
| 3272 | + $creds = request_filesystem_credentials(trailingslashit(site_url()).'wp-admin/', '', false, false, array()); |
|
| 3273 | 3273 | |
| 3274 | 3274 | /* initialize the API */ |
| 3275 | 3275 | if (!WP_Filesystem($creds)) {
|
@@ -3304,7 +3304,7 @@ discard block |
||
| 3304 | 3304 | * @package GeoDirectory |
| 3305 | 3305 | */ |
| 3306 | 3306 | function geodir_filesystem_notice() |
| 3307 | -{ if ( defined( 'DOING_AJAX' ) ){return;}
|
|
| 3307 | +{ if (defined('DOING_AJAX')) {return; }
|
|
| 3308 | 3308 | $access_type = get_filesystem_method(); |
| 3309 | 3309 | if ($access_type === 'direct') {
|
| 3310 | 3310 | } elseif (!defined('FTP_USER')) {
|
@@ -3345,64 +3345,64 @@ discard block |
||
| 3345 | 3345 | // try to set higher limits for import |
| 3346 | 3346 | $max_input_time = ini_get('max_input_time');
|
| 3347 | 3347 | $max_execution_time = ini_get('max_execution_time');
|
| 3348 | - $memory_limit= ini_get('memory_limit');
|
|
| 3348 | + $memory_limit = ini_get('memory_limit');
|
|
| 3349 | 3349 | |
| 3350 | - if(!$max_input_time || $max_input_time<3000){
|
|
| 3350 | + if (!$max_input_time || $max_input_time < 3000) {
|
|
| 3351 | 3351 | @ini_set('max_input_time', 3000);
|
| 3352 | 3352 | } |
| 3353 | 3353 | |
| 3354 | - if(!$max_execution_time || $max_execution_time<3000){
|
|
| 3354 | + if (!$max_execution_time || $max_execution_time < 3000) {
|
|
| 3355 | 3355 | @ini_set('max_execution_time', 3000);
|
| 3356 | 3356 | } |
| 3357 | 3357 | |
| 3358 | - if($memory_limit && str_replace('M','',$memory_limit)){
|
|
| 3359 | - if(str_replace('M','',$memory_limit)<256){
|
|
| 3358 | + if ($memory_limit && str_replace('M', '', $memory_limit)) {
|
|
| 3359 | + if (str_replace('M', '', $memory_limit) < 256) {
|
|
| 3360 | 3360 | @ini_set('memory_limit', '256M');
|
| 3361 | 3361 | } |
| 3362 | 3362 | } |
| 3363 | 3363 | |
| 3364 | 3364 | $json = array(); |
| 3365 | 3365 | |
| 3366 | - if ( !current_user_can( 'manage_options' ) ) {
|
|
| 3367 | - wp_send_json( $json ); |
|
| 3366 | + if (!current_user_can('manage_options')) {
|
|
| 3367 | + wp_send_json($json); |
|
| 3368 | 3368 | } |
| 3369 | 3369 | |
| 3370 | - $task = isset( $_REQUEST['task'] ) ? $_REQUEST['task'] : NULL; |
|
| 3371 | - $nonce = isset( $_REQUEST['_nonce'] ) ? $_REQUEST['_nonce'] : NULL; |
|
| 3372 | - $stat = isset( $_REQUEST['_st'] ) ? $_REQUEST['_st'] : false; |
|
| 3370 | + $task = isset($_REQUEST['task']) ? $_REQUEST['task'] : NULL; |
|
| 3371 | + $nonce = isset($_REQUEST['_nonce']) ? $_REQUEST['_nonce'] : NULL; |
|
| 3372 | + $stat = isset($_REQUEST['_st']) ? $_REQUEST['_st'] : false; |
|
| 3373 | 3373 | |
| 3374 | - if ( !wp_verify_nonce( $nonce, 'geodir_import_export_nonce' ) ) {
|
|
| 3375 | - wp_send_json( $json ); |
|
| 3374 | + if (!wp_verify_nonce($nonce, 'geodir_import_export_nonce')) {
|
|
| 3375 | + wp_send_json($json); |
|
| 3376 | 3376 | } |
| 3377 | 3377 | |
| 3378 | - $post_type = isset( $_REQUEST['_pt'] ) ? $_REQUEST['_pt'] : NULL; |
|
| 3379 | - $chunk_per_page = isset( $_REQUEST['_n'] ) ? absint($_REQUEST['_n']) : NULL; |
|
| 3378 | + $post_type = isset($_REQUEST['_pt']) ? $_REQUEST['_pt'] : NULL; |
|
| 3379 | + $chunk_per_page = isset($_REQUEST['_n']) ? absint($_REQUEST['_n']) : NULL; |
|
| 3380 | 3380 | $chunk_per_page = $chunk_per_page < 50 || $chunk_per_page > 100000 ? 5000 : $chunk_per_page; |
| 3381 | - $chunk_page_no = isset( $_REQUEST['_p'] ) ? absint($_REQUEST['_p']) : 1; |
|
| 3381 | + $chunk_page_no = isset($_REQUEST['_p']) ? absint($_REQUEST['_p']) : 1; |
|
| 3382 | 3382 | |
| 3383 | 3383 | $wp_filesystem = geodir_init_filesystem(); |
| 3384 | 3384 | if (!$wp_filesystem) {
|
| 3385 | - $json['error'] = __( 'Filesystem ERROR: Could not access filesystem.', 'geodirectory' ); |
|
| 3386 | - wp_send_json( $json ); |
|
| 3385 | + $json['error'] = __('Filesystem ERROR: Could not access filesystem.', 'geodirectory');
|
|
| 3386 | + wp_send_json($json); |
|
| 3387 | 3387 | } |
| 3388 | 3388 | |
| 3389 | 3389 | if (!empty($wp_filesystem) && isset($wp_filesystem->errors) && is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
|
| 3390 | - $json['error'] = __( 'Filesystem ERROR: ' . $wp_filesystem->errors->get_error_message(), 'geodirectory' ); |
|
| 3391 | - wp_send_json( $json ); |
|
| 3390 | + $json['error'] = __('Filesystem ERROR: '.$wp_filesystem->errors->get_error_message(), 'geodirectory');
|
|
| 3391 | + wp_send_json($json); |
|
| 3392 | 3392 | } |
| 3393 | 3393 | |
| 3394 | - $csv_file_dir = geodir_path_import_export( false ); |
|
| 3395 | - if ( !$wp_filesystem->is_dir( $csv_file_dir ) ) {
|
|
| 3396 | - if ( !$wp_filesystem->mkdir( $csv_file_dir, FS_CHMOD_DIR ) ) {
|
|
| 3397 | - $json['error'] = __( 'ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory' ); |
|
| 3398 | - wp_send_json( $json ); |
|
| 3394 | + $csv_file_dir = geodir_path_import_export(false); |
|
| 3395 | + if (!$wp_filesystem->is_dir($csv_file_dir)) {
|
|
| 3396 | + if (!$wp_filesystem->mkdir($csv_file_dir, FS_CHMOD_DIR)) {
|
|
| 3397 | + $json['error'] = __('ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory');
|
|
| 3398 | + wp_send_json($json); |
|
| 3399 | 3399 | } |
| 3400 | 3400 | } |
| 3401 | 3401 | |
| 3402 | 3402 | $location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
|
| 3403 | 3403 | $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
|
| 3404 | 3404 | |
| 3405 | - switch ( $task ) {
|
|
| 3405 | + switch ($task) {
|
|
| 3406 | 3406 | case 'export_posts': {
|
| 3407 | 3407 | // WPML |
| 3408 | 3408 | $is_wpml = geodir_is_wpml(); |
@@ -3413,36 +3413,36 @@ discard block |
||
| 3413 | 3413 | $sitepress->switch_lang('all', true);
|
| 3414 | 3414 | } |
| 3415 | 3415 | // WPML |
| 3416 | - if ( $post_type == 'gd_event' ) {
|
|
| 3417 | - add_filter( 'geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2 ); |
|
| 3416 | + if ($post_type == 'gd_event') {
|
|
| 3417 | + add_filter('geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2);
|
|
| 3418 | 3418 | } |
| 3419 | - $filters = !empty( $_REQUEST['gd_imex'] ) && is_array( $_REQUEST['gd_imex'] ) ? $_REQUEST['gd_imex'] : NULL; |
|
| 3419 | + $filters = !empty($_REQUEST['gd_imex']) && is_array($_REQUEST['gd_imex']) ? $_REQUEST['gd_imex'] : NULL; |
|
| 3420 | 3420 | |
| 3421 | - $file_name = $post_type . '_' . date( 'dmyHi' ); |
|
| 3422 | - if ( $filters && isset( $filters['start_date'] ) && isset( $filters['end_date'] ) ) {
|
|
| 3423 | - $file_name = $post_type . '_' . date_i18n( 'dmy', strtotime( $filters['start_date'] ) ) . '_' . date_i18n( 'dmy', strtotime( $filters['end_date'] ) ); |
|
| 3421 | + $file_name = $post_type.'_'.date('dmyHi');
|
|
| 3422 | + if ($filters && isset($filters['start_date']) && isset($filters['end_date'])) {
|
|
| 3423 | + $file_name = $post_type.'_'.date_i18n('dmy', strtotime($filters['start_date'])).'_'.date_i18n('dmy', strtotime($filters['end_date']));
|
|
| 3424 | 3424 | } |
| 3425 | - $posts_count = geodir_get_posts_count( $post_type ); |
|
| 3426 | - $file_url_base = geodir_path_import_export() . '/'; |
|
| 3427 | - $file_url = $file_url_base . $file_name . '.csv'; |
|
| 3428 | - $file_path = $csv_file_dir . '/' . $file_name . '.csv'; |
|
| 3429 | - $file_path_temp = $csv_file_dir . '/' . $post_type . '_' . $nonce . '.csv'; |
|
| 3425 | + $posts_count = geodir_get_posts_count($post_type); |
|
| 3426 | + $file_url_base = geodir_path_import_export().'/'; |
|
| 3427 | + $file_url = $file_url_base.$file_name.'.csv'; |
|
| 3428 | + $file_path = $csv_file_dir.'/'.$file_name.'.csv'; |
|
| 3429 | + $file_path_temp = $csv_file_dir.'/'.$post_type.'_'.$nonce.'.csv'; |
|
| 3430 | 3430 | |
| 3431 | 3431 | $chunk_file_paths = array(); |
| 3432 | 3432 | |
| 3433 | - if ( isset( $_REQUEST['_c'] ) ) {
|
|
| 3433 | + if (isset($_REQUEST['_c'])) {
|
|
| 3434 | 3434 | $json['total'] = $posts_count; |
| 3435 | 3435 | // WPML |
| 3436 | 3436 | if ($is_wpml) {
|
| 3437 | 3437 | $sitepress->switch_lang($active_lang, true); |
| 3438 | 3438 | } |
| 3439 | 3439 | // WPML |
| 3440 | - wp_send_json( $json ); |
|
| 3440 | + wp_send_json($json); |
|
| 3441 | 3441 | gd_die(); |
| 3442 | - } else if ( isset( $_REQUEST['_st'] ) ) {
|
|
| 3443 | - $line_count = (int)geodir_import_export_line_count( $file_path_temp ); |
|
| 3444 | - $percentage = count( $posts_count ) > 0 && $line_count > 0 ? ceil( $line_count / $posts_count ) * 100 : 0; |
|
| 3445 | - $percentage = min( $percentage, 100 ); |
|
| 3442 | + } else if (isset($_REQUEST['_st'])) {
|
|
| 3443 | + $line_count = (int) geodir_import_export_line_count($file_path_temp); |
|
| 3444 | + $percentage = count($posts_count) > 0 && $line_count > 0 ? ceil($line_count / $posts_count) * 100 : 0; |
|
| 3445 | + $percentage = min($percentage, 100); |
|
| 3446 | 3446 | |
| 3447 | 3447 | $json['percentage'] = $percentage; |
| 3448 | 3448 | // WPML |
@@ -3450,45 +3450,45 @@ discard block |
||
| 3450 | 3450 | $sitepress->switch_lang($active_lang, true); |
| 3451 | 3451 | } |
| 3452 | 3452 | // WPML |
| 3453 | - wp_send_json( $json ); |
|
| 3453 | + wp_send_json($json); |
|
| 3454 | 3454 | gd_die(); |
| 3455 | 3455 | } else {
|
| 3456 | - if ( !$posts_count > 0 ) {
|
|
| 3457 | - $json['error'] = __( 'No records to export.', 'geodirectory' ); |
|
| 3456 | + if (!$posts_count > 0) {
|
|
| 3457 | + $json['error'] = __('No records to export.', 'geodirectory');
|
|
| 3458 | 3458 | } else {
|
| 3459 | 3459 | $total_posts = $posts_count; |
| 3460 | 3460 | if ($chunk_per_page > $total_posts) {
|
| 3461 | 3461 | $chunk_per_page = $total_posts; |
| 3462 | 3462 | } |
| 3463 | - $chunk_total_pages = ceil( $total_posts / $chunk_per_page ); |
|
| 3463 | + $chunk_total_pages = ceil($total_posts / $chunk_per_page); |
|
| 3464 | 3464 | |
| 3465 | 3465 | $j = $chunk_page_no; |
| 3466 | - $chunk_save_posts = geodir_imex_get_posts( $post_type, $chunk_per_page, $j ); |
|
| 3466 | + $chunk_save_posts = geodir_imex_get_posts($post_type, $chunk_per_page, $j); |
|
| 3467 | 3467 | |
| 3468 | 3468 | $per_page = 500; |
| 3469 | 3469 | if ($per_page > $chunk_per_page) {
|
| 3470 | 3470 | $per_page = $chunk_per_page; |
| 3471 | 3471 | } |
| 3472 | - $total_pages = ceil( $chunk_per_page / $per_page ); |
|
| 3472 | + $total_pages = ceil($chunk_per_page / $per_page); |
|
| 3473 | 3473 | |
| 3474 | - for ( $i = 0; $i <= $total_pages; $i++ ) {
|
|
| 3475 | - $save_posts = array_slice( $chunk_save_posts , ( $i * $per_page ), $per_page ); |
|
| 3474 | + for ($i = 0; $i <= $total_pages; $i++) {
|
|
| 3475 | + $save_posts = array_slice($chunk_save_posts, ($i * $per_page), $per_page); |
|
| 3476 | 3476 | |
| 3477 | 3477 | $clear = $i == 0 ? true : false; |
| 3478 | - geodir_save_csv_data( $file_path_temp, $save_posts, $clear ); |
|
| 3478 | + geodir_save_csv_data($file_path_temp, $save_posts, $clear); |
|
| 3479 | 3479 | } |
| 3480 | 3480 | |
| 3481 | - if ( $wp_filesystem->exists( $file_path_temp ) ) {
|
|
| 3482 | - $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : ''; |
|
| 3483 | - $chunk_file_name = $file_name . $chunk_page_no . '.csv'; |
|
| 3484 | - $file_path = $csv_file_dir . '/' . $chunk_file_name; |
|
| 3485 | - $wp_filesystem->move( $file_path_temp, $file_path, true ); |
|
| 3481 | + if ($wp_filesystem->exists($file_path_temp)) {
|
|
| 3482 | + $chunk_page_no = $chunk_total_pages > 1 ? '-'.$j : ''; |
|
| 3483 | + $chunk_file_name = $file_name.$chunk_page_no.'.csv'; |
|
| 3484 | + $file_path = $csv_file_dir.'/'.$chunk_file_name; |
|
| 3485 | + $wp_filesystem->move($file_path_temp, $file_path, true); |
|
| 3486 | 3486 | |
| 3487 | - $file_url = $file_url_base . $chunk_file_name; |
|
| 3488 | - $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
| 3487 | + $file_url = $file_url_base.$chunk_file_name; |
|
| 3488 | + $chunk_file_paths[] = array('i' => $j.'.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
| 3489 | 3489 | } |
| 3490 | 3490 | |
| 3491 | - if ( !empty($chunk_file_paths) ) {
|
|
| 3491 | + if (!empty($chunk_file_paths)) {
|
|
| 3492 | 3492 | $json['total'] = $posts_count; |
| 3493 | 3493 | $json['files'] = $chunk_file_paths; |
| 3494 | 3494 | } else {
|
@@ -3496,7 +3496,7 @@ discard block |
||
| 3496 | 3496 | $json['total'] = $posts_count; |
| 3497 | 3497 | $json['files'] = array(); |
| 3498 | 3498 | } else {
|
| 3499 | - $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' ); |
|
| 3499 | + $json['error'] = __('ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory');
|
|
| 3500 | 3500 | } |
| 3501 | 3501 | } |
| 3502 | 3502 | } |
@@ -3505,7 +3505,7 @@ discard block |
||
| 3505 | 3505 | $sitepress->switch_lang($active_lang, true); |
| 3506 | 3506 | } |
| 3507 | 3507 | // WPML |
| 3508 | - wp_send_json( $json ); |
|
| 3508 | + wp_send_json($json); |
|
| 3509 | 3509 | } |
| 3510 | 3510 | } |
| 3511 | 3511 | break; |
@@ -3519,20 +3519,20 @@ discard block |
||
| 3519 | 3519 | $sitepress->switch_lang('all', true);
|
| 3520 | 3520 | } |
| 3521 | 3521 | // WPML |
| 3522 | - $file_name = $post_type . 'category_' . date( 'dmyHi' ); |
|
| 3522 | + $file_name = $post_type.'category_'.date('dmyHi');
|
|
| 3523 | 3523 | |
| 3524 | - $terms_count = geodir_get_terms_count( $post_type ); |
|
| 3525 | - $file_url_base = geodir_path_import_export() . '/'; |
|
| 3526 | - $file_url = $file_url_base . $file_name . '.csv'; |
|
| 3527 | - $file_path = $csv_file_dir . '/' . $file_name . '.csv'; |
|
| 3528 | - $file_path_temp = $csv_file_dir . '/' . $post_type . 'category_' . $nonce . '.csv'; |
|
| 3524 | + $terms_count = geodir_get_terms_count($post_type); |
|
| 3525 | + $file_url_base = geodir_path_import_export().'/'; |
|
| 3526 | + $file_url = $file_url_base.$file_name.'.csv'; |
|
| 3527 | + $file_path = $csv_file_dir.'/'.$file_name.'.csv'; |
|
| 3528 | + $file_path_temp = $csv_file_dir.'/'.$post_type.'category_'.$nonce.'.csv'; |
|
| 3529 | 3529 | |
| 3530 | 3530 | $chunk_file_paths = array(); |
| 3531 | 3531 | |
| 3532 | - if ( isset( $_REQUEST['_st'] ) ) {
|
|
| 3533 | - $line_count = (int)geodir_import_export_line_count( $file_path_temp ); |
|
| 3534 | - $percentage = count( $terms_count ) > 0 && $line_count > 0 ? ceil( $line_count / $terms_count ) * 100 : 0; |
|
| 3535 | - $percentage = min( $percentage, 100 ); |
|
| 3532 | + if (isset($_REQUEST['_st'])) {
|
|
| 3533 | + $line_count = (int) geodir_import_export_line_count($file_path_temp); |
|
| 3534 | + $percentage = count($terms_count) > 0 && $line_count > 0 ? ceil($line_count / $terms_count) * 100 : 0; |
|
| 3535 | + $percentage = min($percentage, 100); |
|
| 3536 | 3536 | |
| 3537 | 3537 | $json['percentage'] = $percentage; |
| 3538 | 3538 | // WPML |
@@ -3540,48 +3540,48 @@ discard block |
||
| 3540 | 3540 | $sitepress->switch_lang($active_lang, true); |
| 3541 | 3541 | } |
| 3542 | 3542 | // WPML |
| 3543 | - wp_send_json( $json ); |
|
| 3543 | + wp_send_json($json); |
|
| 3544 | 3544 | } else {
|
| 3545 | - if ( !$terms_count > 0 ) {
|
|
| 3546 | - $json['error'] = __( 'No records to export.', 'geodirectory' ); |
|
| 3545 | + if (!$terms_count > 0) {
|
|
| 3546 | + $json['error'] = __('No records to export.', 'geodirectory');
|
|
| 3547 | 3547 | } else {
|
| 3548 | 3548 | $total_terms = $terms_count; |
| 3549 | 3549 | if ($chunk_per_page > $terms_count) {
|
| 3550 | 3550 | $chunk_per_page = $terms_count; |
| 3551 | 3551 | } |
| 3552 | - $chunk_total_pages = ceil( $total_terms / $chunk_per_page ); |
|
| 3552 | + $chunk_total_pages = ceil($total_terms / $chunk_per_page); |
|
| 3553 | 3553 | |
| 3554 | 3554 | $j = $chunk_page_no; |
| 3555 | - $chunk_save_terms = geodir_imex_get_terms( $post_type, $chunk_per_page, $j ); |
|
| 3555 | + $chunk_save_terms = geodir_imex_get_terms($post_type, $chunk_per_page, $j); |
|
| 3556 | 3556 | |
| 3557 | 3557 | $per_page = 500; |
| 3558 | 3558 | if ($per_page > $chunk_per_page) {
|
| 3559 | 3559 | $per_page = $chunk_per_page; |
| 3560 | 3560 | } |
| 3561 | - $total_pages = ceil( $chunk_per_page / $per_page ); |
|
| 3561 | + $total_pages = ceil($chunk_per_page / $per_page); |
|
| 3562 | 3562 | |
| 3563 | - for ( $i = 0; $i <= $total_pages; $i++ ) {
|
|
| 3564 | - $save_terms = array_slice( $chunk_save_terms , ( $i * $per_page ), $per_page ); |
|
| 3563 | + for ($i = 0; $i <= $total_pages; $i++) {
|
|
| 3564 | + $save_terms = array_slice($chunk_save_terms, ($i * $per_page), $per_page); |
|
| 3565 | 3565 | |
| 3566 | 3566 | $clear = $i == 0 ? true : false; |
| 3567 | - geodir_save_csv_data( $file_path_temp, $save_terms, $clear ); |
|
| 3567 | + geodir_save_csv_data($file_path_temp, $save_terms, $clear); |
|
| 3568 | 3568 | } |
| 3569 | 3569 | |
| 3570 | - if ( $wp_filesystem->exists( $file_path_temp ) ) {
|
|
| 3571 | - $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : ''; |
|
| 3572 | - $chunk_file_name = $file_name . $chunk_page_no . '.csv'; |
|
| 3573 | - $file_path = $csv_file_dir . '/' . $chunk_file_name; |
|
| 3574 | - $wp_filesystem->move( $file_path_temp, $file_path, true ); |
|
| 3570 | + if ($wp_filesystem->exists($file_path_temp)) {
|
|
| 3571 | + $chunk_page_no = $chunk_total_pages > 1 ? '-'.$j : ''; |
|
| 3572 | + $chunk_file_name = $file_name.$chunk_page_no.'.csv'; |
|
| 3573 | + $file_path = $csv_file_dir.'/'.$chunk_file_name; |
|
| 3574 | + $wp_filesystem->move($file_path_temp, $file_path, true); |
|
| 3575 | 3575 | |
| 3576 | - $file_url = $file_url_base . $chunk_file_name; |
|
| 3577 | - $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
| 3576 | + $file_url = $file_url_base.$chunk_file_name; |
|
| 3577 | + $chunk_file_paths[] = array('i' => $j.'.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
| 3578 | 3578 | } |
| 3579 | 3579 | |
| 3580 | - if ( !empty($chunk_file_paths) ) {
|
|
| 3580 | + if (!empty($chunk_file_paths)) {
|
|
| 3581 | 3581 | $json['total'] = $terms_count; |
| 3582 | 3582 | $json['files'] = $chunk_file_paths; |
| 3583 | 3583 | } else {
|
| 3584 | - $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' ); |
|
| 3584 | + $json['error'] = __('ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory');
|
|
| 3585 | 3585 | } |
| 3586 | 3586 | } |
| 3587 | 3587 | // WPML |
@@ -3589,127 +3589,127 @@ discard block |
||
| 3589 | 3589 | $sitepress->switch_lang($active_lang, true); |
| 3590 | 3590 | } |
| 3591 | 3591 | // WPML |
| 3592 | - wp_send_json( $json ); |
|
| 3592 | + wp_send_json($json); |
|
| 3593 | 3593 | } |
| 3594 | 3594 | } |
| 3595 | 3595 | break; |
| 3596 | 3596 | case 'export_locations': {
|
| 3597 | - $file_url_base = geodir_path_import_export() . '/'; |
|
| 3598 | - $file_name = 'gd_locations_' . date( 'dmyHi' ); |
|
| 3599 | - $file_url = $file_url_base . $file_name . '.csv'; |
|
| 3600 | - $file_path = $csv_file_dir . '/' . $file_name . '.csv'; |
|
| 3601 | - $file_path_temp = $csv_file_dir . '/gd_locations_' . $nonce . '.csv'; |
|
| 3597 | + $file_url_base = geodir_path_import_export().'/'; |
|
| 3598 | + $file_name = 'gd_locations_'.date('dmyHi');
|
|
| 3599 | + $file_url = $file_url_base.$file_name.'.csv'; |
|
| 3600 | + $file_path = $csv_file_dir.'/'.$file_name.'.csv'; |
|
| 3601 | + $file_path_temp = $csv_file_dir.'/gd_locations_'.$nonce.'.csv'; |
|
| 3602 | 3602 | |
| 3603 | - $items_count = (int)geodir_location_imex_count_locations(); |
|
| 3603 | + $items_count = (int) geodir_location_imex_count_locations(); |
|
| 3604 | 3604 | |
| 3605 | - if ( isset( $_REQUEST['_st'] ) ) {
|
|
| 3606 | - $line_count = (int)geodir_import_export_line_count( $file_path_temp ); |
|
| 3607 | - $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0; |
|
| 3608 | - $percentage = min( $percentage, 100 ); |
|
| 3605 | + if (isset($_REQUEST['_st'])) {
|
|
| 3606 | + $line_count = (int) geodir_import_export_line_count($file_path_temp); |
|
| 3607 | + $percentage = count($items_count) > 0 && $line_count > 0 ? ceil($line_count / $items_count) * 100 : 0; |
|
| 3608 | + $percentage = min($percentage, 100); |
|
| 3609 | 3609 | |
| 3610 | 3610 | $json['percentage'] = $percentage; |
| 3611 | - wp_send_json( $json ); |
|
| 3611 | + wp_send_json($json); |
|
| 3612 | 3612 | } else {
|
| 3613 | 3613 | $chunk_file_paths = array(); |
| 3614 | 3614 | |
| 3615 | - if ( !$items_count > 0 ) {
|
|
| 3616 | - $json['error'] = __( 'No records to export.', 'geodirectory' ); |
|
| 3615 | + if (!$items_count > 0) {
|
|
| 3616 | + $json['error'] = __('No records to export.', 'geodirectory');
|
|
| 3617 | 3617 | } else {
|
| 3618 | - $chunk_per_page = min( $chunk_per_page, $items_count ); |
|
| 3619 | - $chunk_total_pages = ceil( $items_count / $chunk_per_page ); |
|
| 3618 | + $chunk_per_page = min($chunk_per_page, $items_count); |
|
| 3619 | + $chunk_total_pages = ceil($items_count / $chunk_per_page); |
|
| 3620 | 3620 | |
| 3621 | 3621 | $j = $chunk_page_no; |
| 3622 | - $chunk_save_items = geodir_location_imex_locations_data( $chunk_per_page, $j ); |
|
| 3622 | + $chunk_save_items = geodir_location_imex_locations_data($chunk_per_page, $j); |
|
| 3623 | 3623 | |
| 3624 | 3624 | $per_page = 500; |
| 3625 | - $per_page = min( $per_page, $chunk_per_page ); |
|
| 3626 | - $total_pages = ceil( $chunk_per_page / $per_page ); |
|
| 3625 | + $per_page = min($per_page, $chunk_per_page); |
|
| 3626 | + $total_pages = ceil($chunk_per_page / $per_page); |
|
| 3627 | 3627 | |
| 3628 | - for ( $i = 0; $i <= $total_pages; $i++ ) {
|
|
| 3629 | - $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page ); |
|
| 3628 | + for ($i = 0; $i <= $total_pages; $i++) {
|
|
| 3629 | + $save_items = array_slice($chunk_save_items, ($i * $per_page), $per_page); |
|
| 3630 | 3630 | |
| 3631 | 3631 | $clear = $i == 0 ? true : false; |
| 3632 | - geodir_save_csv_data( $file_path_temp, $save_items, $clear ); |
|
| 3632 | + geodir_save_csv_data($file_path_temp, $save_items, $clear); |
|
| 3633 | 3633 | } |
| 3634 | 3634 | |
| 3635 | - if ( $wp_filesystem->exists( $file_path_temp ) ) {
|
|
| 3636 | - $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : ''; |
|
| 3637 | - $chunk_file_name = $file_name . $chunk_page_no . '.csv'; |
|
| 3638 | - $file_path = $csv_file_dir . '/' . $chunk_file_name; |
|
| 3639 | - $wp_filesystem->move( $file_path_temp, $file_path, true ); |
|
| 3635 | + if ($wp_filesystem->exists($file_path_temp)) {
|
|
| 3636 | + $chunk_page_no = $chunk_total_pages > 1 ? '-'.$j : ''; |
|
| 3637 | + $chunk_file_name = $file_name.$chunk_page_no.'.csv'; |
|
| 3638 | + $file_path = $csv_file_dir.'/'.$chunk_file_name; |
|
| 3639 | + $wp_filesystem->move($file_path_temp, $file_path, true); |
|
| 3640 | 3640 | |
| 3641 | - $file_url = $file_url_base . $chunk_file_name; |
|
| 3642 | - $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
| 3641 | + $file_url = $file_url_base.$chunk_file_name; |
|
| 3642 | + $chunk_file_paths[] = array('i' => $j.'.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
| 3643 | 3643 | } |
| 3644 | 3644 | |
| 3645 | - if ( !empty($chunk_file_paths) ) {
|
|
| 3645 | + if (!empty($chunk_file_paths)) {
|
|
| 3646 | 3646 | $json['total'] = $items_count; |
| 3647 | 3647 | $json['files'] = $chunk_file_paths; |
| 3648 | 3648 | } else {
|
| 3649 | - $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' ); |
|
| 3649 | + $json['error'] = __('Fail, something wrong to create csv file.', 'geodirectory');
|
|
| 3650 | 3650 | } |
| 3651 | 3651 | } |
| 3652 | - wp_send_json( $json ); |
|
| 3652 | + wp_send_json($json); |
|
| 3653 | 3653 | } |
| 3654 | 3654 | } |
| 3655 | 3655 | break; |
| 3656 | 3656 | case 'export_hoods': {
|
| 3657 | - $file_url_base = geodir_path_import_export() . '/'; |
|
| 3658 | - $file_name = 'gd_neighbourhoods_' . date( 'dmyHi' ); |
|
| 3659 | - $file_url = $file_url_base . $file_name . '.csv'; |
|
| 3660 | - $file_path = $csv_file_dir . '/' . $file_name . '.csv'; |
|
| 3661 | - $file_path_temp = $csv_file_dir . '/gd_neighbourhoods_' . $nonce . '.csv'; |
|
| 3657 | + $file_url_base = geodir_path_import_export().'/'; |
|
| 3658 | + $file_name = 'gd_neighbourhoods_'.date('dmyHi');
|
|
| 3659 | + $file_url = $file_url_base.$file_name.'.csv'; |
|
| 3660 | + $file_path = $csv_file_dir.'/'.$file_name.'.csv'; |
|
| 3661 | + $file_path_temp = $csv_file_dir.'/gd_neighbourhoods_'.$nonce.'.csv'; |
|
| 3662 | 3662 | |
| 3663 | - $items_count = (int)geodir_location_imex_count_neighbourhoods(); |
|
| 3663 | + $items_count = (int) geodir_location_imex_count_neighbourhoods(); |
|
| 3664 | 3664 | |
| 3665 | - if ( isset( $_REQUEST['_st'] ) ) {
|
|
| 3666 | - $line_count = (int)geodir_import_export_line_count( $file_path_temp ); |
|
| 3667 | - $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0; |
|
| 3668 | - $percentage = min( $percentage, 100 ); |
|
| 3665 | + if (isset($_REQUEST['_st'])) {
|
|
| 3666 | + $line_count = (int) geodir_import_export_line_count($file_path_temp); |
|
| 3667 | + $percentage = count($items_count) > 0 && $line_count > 0 ? ceil($line_count / $items_count) * 100 : 0; |
|
| 3668 | + $percentage = min($percentage, 100); |
|
| 3669 | 3669 | |
| 3670 | 3670 | $json['percentage'] = $percentage; |
| 3671 | - wp_send_json( $json ); |
|
| 3671 | + wp_send_json($json); |
|
| 3672 | 3672 | } else {
|
| 3673 | 3673 | $chunk_file_paths = array(); |
| 3674 | 3674 | |
| 3675 | - if ( !$items_count > 0 ) {
|
|
| 3676 | - $json['error'] = __( 'No records to export.', 'geodirectory' ); |
|
| 3675 | + if (!$items_count > 0) {
|
|
| 3676 | + $json['error'] = __('No records to export.', 'geodirectory');
|
|
| 3677 | 3677 | } else {
|
| 3678 | - $chunk_per_page = min( $chunk_per_page, $items_count ); |
|
| 3679 | - $chunk_total_pages = ceil( $items_count / $chunk_per_page ); |
|
| 3678 | + $chunk_per_page = min($chunk_per_page, $items_count); |
|
| 3679 | + $chunk_total_pages = ceil($items_count / $chunk_per_page); |
|
| 3680 | 3680 | |
| 3681 | 3681 | $j = $chunk_page_no; |
| 3682 | - $chunk_save_items = geodir_location_imex_neighbourhoods_data( $chunk_per_page, $j ); |
|
| 3682 | + $chunk_save_items = geodir_location_imex_neighbourhoods_data($chunk_per_page, $j); |
|
| 3683 | 3683 | |
| 3684 | 3684 | $per_page = 500; |
| 3685 | - $per_page = min( $per_page, $chunk_per_page ); |
|
| 3686 | - $total_pages = ceil( $chunk_per_page / $per_page ); |
|
| 3685 | + $per_page = min($per_page, $chunk_per_page); |
|
| 3686 | + $total_pages = ceil($chunk_per_page / $per_page); |
|
| 3687 | 3687 | |
| 3688 | - for ( $i = 0; $i <= $total_pages; $i++ ) {
|
|
| 3689 | - $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page ); |
|
| 3688 | + for ($i = 0; $i <= $total_pages; $i++) {
|
|
| 3689 | + $save_items = array_slice($chunk_save_items, ($i * $per_page), $per_page); |
|
| 3690 | 3690 | |
| 3691 | 3691 | $clear = $i == 0 ? true : false; |
| 3692 | - geodir_save_csv_data( $file_path_temp, $save_items, $clear ); |
|
| 3692 | + geodir_save_csv_data($file_path_temp, $save_items, $clear); |
|
| 3693 | 3693 | } |
| 3694 | 3694 | |
| 3695 | - if ( $wp_filesystem->exists( $file_path_temp ) ) {
|
|
| 3696 | - $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : ''; |
|
| 3697 | - $chunk_file_name = $file_name . $chunk_page_no . '.csv'; |
|
| 3698 | - $file_path = $csv_file_dir . '/' . $chunk_file_name; |
|
| 3699 | - $wp_filesystem->move( $file_path_temp, $file_path, true ); |
|
| 3695 | + if ($wp_filesystem->exists($file_path_temp)) {
|
|
| 3696 | + $chunk_page_no = $chunk_total_pages > 1 ? '-'.$j : ''; |
|
| 3697 | + $chunk_file_name = $file_name.$chunk_page_no.'.csv'; |
|
| 3698 | + $file_path = $csv_file_dir.'/'.$chunk_file_name; |
|
| 3699 | + $wp_filesystem->move($file_path_temp, $file_path, true); |
|
| 3700 | 3700 | |
| 3701 | - $file_url = $file_url_base . $chunk_file_name; |
|
| 3702 | - $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
| 3701 | + $file_url = $file_url_base.$chunk_file_name; |
|
| 3702 | + $chunk_file_paths[] = array('i' => $j.'.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
| 3703 | 3703 | } |
| 3704 | 3704 | |
| 3705 | - if ( !empty($chunk_file_paths) ) {
|
|
| 3705 | + if (!empty($chunk_file_paths)) {
|
|
| 3706 | 3706 | $json['total'] = $items_count; |
| 3707 | 3707 | $json['files'] = $chunk_file_paths; |
| 3708 | 3708 | } else {
|
| 3709 | - $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' ); |
|
| 3709 | + $json['error'] = __('Fail, something wrong to create csv file.', 'geodirectory');
|
|
| 3710 | 3710 | } |
| 3711 | 3711 | } |
| 3712 | - wp_send_json( $json ); |
|
| 3712 | + wp_send_json($json); |
|
| 3713 | 3713 | } |
| 3714 | 3714 | } |
| 3715 | 3715 | break; |
@@ -3726,34 +3726,34 @@ discard block |
||
| 3726 | 3726 | } |
| 3727 | 3727 | // WPML |
| 3728 | 3728 | |
| 3729 | - @ini_set( 'auto_detect_line_endings', true ); |
|
| 3729 | + @ini_set('auto_detect_line_endings', true);
|
|
| 3730 | 3730 | |
| 3731 | 3731 | $uploads = wp_upload_dir(); |
| 3732 | 3732 | $uploads_dir = $uploads['path']; |
| 3733 | 3733 | $uploads_subdir = $uploads['subdir']; |
| 3734 | 3734 | |
| 3735 | - $csv_file = isset( $_POST['_file'] ) ? $_POST['_file'] : NULL; |
|
| 3736 | - $import_choice = isset( $_REQUEST['_ch'] ) ? $_REQUEST['_ch'] : 'skip'; |
|
| 3735 | + $csv_file = isset($_POST['_file']) ? $_POST['_file'] : NULL; |
|
| 3736 | + $import_choice = isset($_REQUEST['_ch']) ? $_REQUEST['_ch'] : 'skip'; |
|
| 3737 | 3737 | |
| 3738 | - $csv_file_arr = explode( '/', $csv_file ); |
|
| 3739 | - $csv_filename = end( $csv_file_arr ); |
|
| 3740 | - $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $csv_filename; |
|
| 3738 | + $csv_file_arr = explode('/', $csv_file);
|
|
| 3739 | + $csv_filename = end($csv_file_arr); |
|
| 3740 | + $target_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$csv_filename; |
|
| 3741 | 3741 | |
| 3742 | 3742 | $json['file'] = $csv_file; |
| 3743 | - $json['error'] = __( 'The uploaded file is not a valid csv file. Please try again.', 'geodirectory' ); |
|
| 3743 | + $json['error'] = __('The uploaded file is not a valid csv file. Please try again.', 'geodirectory');
|
|
| 3744 | 3744 | $file = array(); |
| 3745 | 3745 | |
| 3746 | - if ( $csv_file && $wp_filesystem->is_file( $target_path ) && $wp_filesystem->exists( $target_path ) ) {
|
|
| 3747 | - $wp_filetype = wp_check_filetype_and_ext( $target_path, $csv_filename ); |
|
| 3746 | + if ($csv_file && $wp_filesystem->is_file($target_path) && $wp_filesystem->exists($target_path)) {
|
|
| 3747 | + $wp_filetype = wp_check_filetype_and_ext($target_path, $csv_filename); |
|
| 3748 | 3748 | |
| 3749 | 3749 | if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
|
| 3750 | 3750 | $json['error'] = NULL; |
| 3751 | 3751 | |
| 3752 | 3752 | $lc_all = setlocale(LC_ALL, 0); // Fix issue of fgetcsv ignores special characters when they are at the beginning of line |
| 3753 | 3753 | setlocale(LC_ALL, 'en_US.UTF-8'); |
| 3754 | - if ( ( $handle = fopen($target_path, "r" ) ) !== FALSE ) {
|
|
| 3755 | - while ( ( $data = fgetcsv( $handle, 100000, "," ) ) !== FALSE ) {
|
|
| 3756 | - if ( !empty( $data ) ) {
|
|
| 3754 | + if (($handle = fopen($target_path, "r")) !== FALSE) {
|
|
| 3755 | + while (($data = fgetcsv($handle, 100000, ",")) !== FALSE) {
|
|
| 3756 | + if (!empty($data)) {
|
|
| 3757 | 3757 | $file[] = $data; |
| 3758 | 3758 | } |
| 3759 | 3759 | } |
@@ -3767,19 +3767,19 @@ discard block |
||
| 3767 | 3767 | $json['error'] = __('No data found in csv file.', 'geodirectory');
|
| 3768 | 3768 | } |
| 3769 | 3769 | } else {
|
| 3770 | - wp_send_json( $json ); |
|
| 3770 | + wp_send_json($json); |
|
| 3771 | 3771 | } |
| 3772 | 3772 | } else {
|
| 3773 | - wp_send_json( $json ); |
|
| 3773 | + wp_send_json($json); |
|
| 3774 | 3774 | } |
| 3775 | 3775 | |
| 3776 | - if ( $task == 'prepare_import' || !empty( $json['error'] ) ) {
|
|
| 3777 | - wp_send_json( $json ); |
|
| 3776 | + if ($task == 'prepare_import' || !empty($json['error'])) {
|
|
| 3777 | + wp_send_json($json); |
|
| 3778 | 3778 | } |
| 3779 | 3779 | |
| 3780 | 3780 | $total = $json['rows']; |
| 3781 | - $limit = isset($_POST['limit']) ? (int)$_POST['limit'] : 1; |
|
| 3782 | - $processed = isset($_POST['processed']) ? (int)$_POST['processed'] : 0; |
|
| 3781 | + $limit = isset($_POST['limit']) ? (int) $_POST['limit'] : 1; |
|
| 3782 | + $processed = isset($_POST['processed']) ? (int) $_POST['processed'] : 0; |
|
| 3783 | 3783 | |
| 3784 | 3784 | $count = $limit; |
| 3785 | 3785 | |
@@ -3804,13 +3804,13 @@ discard block |
||
| 3804 | 3804 | |
| 3805 | 3805 | $post_types = geodir_get_posttypes(); |
| 3806 | 3806 | |
| 3807 | - if ( $task == 'import_cat' ) {
|
|
| 3807 | + if ($task == 'import_cat') {
|
|
| 3808 | 3808 | if (!empty($file)) {
|
| 3809 | 3809 | $columns = isset($file[0]) ? $file[0] : NULL; |
| 3810 | 3810 | |
| 3811 | 3811 | if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
|
| 3812 | 3812 | $json['error'] = CSV_INVAILD_FILE; |
| 3813 | - wp_send_json( $json ); |
|
| 3813 | + wp_send_json($json); |
|
| 3814 | 3814 | exit; |
| 3815 | 3815 | } |
| 3816 | 3816 | |
@@ -3821,7 +3821,7 @@ discard block |
||
| 3821 | 3821 | |
| 3822 | 3822 | if (isset($file[$index])) {
|
| 3823 | 3823 | $row = $file[$index]; |
| 3824 | - $row = array_map( 'trim', $row ); |
|
| 3824 | + $row = array_map('trim', $row);
|
|
| 3825 | 3825 | //$row = array_map( 'utf8_encode', $row ); |
| 3826 | 3826 | |
| 3827 | 3827 | $cat_id = ''; |
@@ -3838,42 +3838,42 @@ discard block |
||
| 3838 | 3838 | $cat_id_original = ''; |
| 3839 | 3839 | |
| 3840 | 3840 | $c = 0; |
| 3841 | - foreach ($columns as $column ) {
|
|
| 3842 | - if ( $column == 'cat_id' ) {
|
|
| 3843 | - $cat_id = (int)$row[$c]; |
|
| 3844 | - } else if ( $column == 'cat_name' ) {
|
|
| 3841 | + foreach ($columns as $column) {
|
|
| 3842 | + if ($column == 'cat_id') {
|
|
| 3843 | + $cat_id = (int) $row[$c]; |
|
| 3844 | + } else if ($column == 'cat_name') {
|
|
| 3845 | 3845 | $cat_name = $row[$c]; |
| 3846 | - } else if ( $column == 'cat_slug' ) {
|
|
| 3846 | + } else if ($column == 'cat_slug') {
|
|
| 3847 | 3847 | $cat_slug = $row[$c]; |
| 3848 | - } else if ( $column == 'cat_posttype' ) {
|
|
| 3848 | + } else if ($column == 'cat_posttype') {
|
|
| 3849 | 3849 | $cat_posttype = $row[$c]; |
| 3850 | - } else if ( $column == 'cat_parent' ) {
|
|
| 3850 | + } else if ($column == 'cat_parent') {
|
|
| 3851 | 3851 | $cat_parent = trim($row[$c]); |
| 3852 | - } else if ( $column == 'cat_schema' && $row[$c] != '' ) {
|
|
| 3852 | + } else if ($column == 'cat_schema' && $row[$c] != '') {
|
|
| 3853 | 3853 | $cat_schema = $row[$c]; |
| 3854 | - } else if ( $column == 'cat_description' ) {
|
|
| 3854 | + } else if ($column == 'cat_description') {
|
|
| 3855 | 3855 | $cat_description = $row[$c]; |
| 3856 | - } else if ( $column == 'cat_top_description' ) {
|
|
| 3856 | + } else if ($column == 'cat_top_description') {
|
|
| 3857 | 3857 | $cat_top_description = $row[$c]; |
| 3858 | - } else if ( $column == 'cat_image' ) {
|
|
| 3858 | + } else if ($column == 'cat_image') {
|
|
| 3859 | 3859 | $cat_image = $row[$c]; |
| 3860 | - } else if ( $column == 'cat_icon' ) {
|
|
| 3860 | + } else if ($column == 'cat_icon') {
|
|
| 3861 | 3861 | $cat_icon = $row[$c]; |
| 3862 | 3862 | } |
| 3863 | 3863 | // WPML |
| 3864 | - if ( $is_wpml ) {
|
|
| 3865 | - if ( $column == 'cat_language' ) {
|
|
| 3866 | - $cat_language = geodir_strtolower( trim( $row[$c] ) ); |
|
| 3867 | - } else if ( $column == 'cat_id_original' ) {
|
|
| 3868 | - $cat_id_original = (int)$row[$c]; |
|
| 3864 | + if ($is_wpml) {
|
|
| 3865 | + if ($column == 'cat_language') {
|
|
| 3866 | + $cat_language = geodir_strtolower(trim($row[$c])); |
|
| 3867 | + } else if ($column == 'cat_id_original') {
|
|
| 3868 | + $cat_id_original = (int) $row[$c]; |
|
| 3869 | 3869 | } |
| 3870 | 3870 | } |
| 3871 | 3871 | // WPML |
| 3872 | 3872 | $c++; |
| 3873 | 3873 | } |
| 3874 | 3874 | |
| 3875 | - if ( $cat_name == '' || !in_array( $cat_posttype, $post_types ) ) {
|
|
| 3876 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) ); |
|
| 3875 | + if ($cat_name == '' || !in_array($cat_posttype, $post_types)) {
|
|
| 3876 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be added due to blank title/invalid post type', 'geodirectory'));
|
|
| 3877 | 3877 | |
| 3878 | 3878 | $invalid++; |
| 3879 | 3879 | continue; |
@@ -3891,24 +3891,24 @@ discard block |
||
| 3891 | 3891 | $term_data['description'] = $cat_description; |
| 3892 | 3892 | $term_data['cat_schema'] = $cat_schema; |
| 3893 | 3893 | $term_data['top_description'] = $cat_top_description; |
| 3894 | - $term_data['image'] = $cat_image != '' ? basename( $cat_image ) : ''; |
|
| 3895 | - $term_data['icon'] = $cat_icon != '' ? basename( $cat_icon ) : ''; |
|
| 3894 | + $term_data['image'] = $cat_image != '' ? basename($cat_image) : ''; |
|
| 3895 | + $term_data['icon'] = $cat_icon != '' ? basename($cat_icon) : ''; |
|
| 3896 | 3896 | |
| 3897 | 3897 | //$term_data = array_map( 'utf8_encode', $term_data ); |
| 3898 | 3898 | |
| 3899 | - $taxonomy = $cat_posttype . 'category'; |
|
| 3899 | + $taxonomy = $cat_posttype.'category'; |
|
| 3900 | 3900 | |
| 3901 | 3901 | $term_data['taxonomy'] = $taxonomy; |
| 3902 | 3902 | |
| 3903 | 3903 | $term_parent_id = 0; |
| 3904 | - if ($cat_parent != "" || (int)$cat_parent > 0) {
|
|
| 3904 | + if ($cat_parent != "" || (int) $cat_parent > 0) {
|
|
| 3905 | 3905 | $term_parent = ''; |
| 3906 | 3906 | |
| 3907 | - if ( $term_parent = get_term_by( 'name', $cat_parent, $taxonomy ) ) {
|
|
| 3907 | + if ($term_parent = get_term_by('name', $cat_parent, $taxonomy)) {
|
|
| 3908 | 3908 | // |
| 3909 | - } else if ( $term_parent = get_term_by( 'slug', $cat_parent, $taxonomy ) ) {
|
|
| 3909 | + } else if ($term_parent = get_term_by('slug', $cat_parent, $taxonomy)) {
|
|
| 3910 | 3910 | // |
| 3911 | - } else if ( $term_parent = get_term_by( 'id', $cat_parent, $taxonomy ) ) {
|
|
| 3911 | + } else if ($term_parent = get_term_by('id', $cat_parent, $taxonomy)) {
|
|
| 3912 | 3912 | // |
| 3913 | 3913 | } else {
|
| 3914 | 3914 | $term_parent_data = array(); |
@@ -3916,104 +3916,104 @@ discard block |
||
| 3916 | 3916 | //$term_parent_data = array_map( 'utf8_encode', $term_parent_data ); |
| 3917 | 3917 | $term_parent_data['taxonomy'] = $taxonomy; |
| 3918 | 3918 | |
| 3919 | - $term_parent_id = (int)geodir_imex_insert_term( $taxonomy, $term_parent_data ); |
|
| 3919 | + $term_parent_id = (int) geodir_imex_insert_term($taxonomy, $term_parent_data); |
|
| 3920 | 3920 | } |
| 3921 | 3921 | |
| 3922 | - if ( !empty( $term_parent ) && !is_wp_error( $term_parent ) ) {
|
|
| 3923 | - $term_parent_id = (int)$term_parent->term_id; |
|
| 3922 | + if (!empty($term_parent) && !is_wp_error($term_parent)) {
|
|
| 3923 | + $term_parent_id = (int) $term_parent->term_id; |
|
| 3924 | 3924 | } |
| 3925 | 3925 | } |
| 3926 | - $term_data['parent'] = (int)$term_parent_id; |
|
| 3926 | + $term_data['parent'] = (int) $term_parent_id; |
|
| 3927 | 3927 | |
| 3928 | 3928 | $term_id = NULL; |
| 3929 | - if ( $import_choice == 'update' ) {
|
|
| 3930 | - if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
|
|
| 3929 | + if ($import_choice == 'update') {
|
|
| 3930 | + if ($cat_id > 0 && $term = (array) term_exists($cat_id, $taxonomy)) {
|
|
| 3931 | 3931 | $term_data['term_id'] = $term['term_id']; |
| 3932 | 3932 | |
| 3933 | - if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
|
|
| 3933 | + if ($term_id = geodir_imex_update_term($taxonomy, $term_data)) {
|
|
| 3934 | 3934 | $updated++; |
| 3935 | 3935 | } else {
|
| 3936 | 3936 | $invalid++; |
| 3937 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) ); |
|
| 3937 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory'));
|
|
| 3938 | 3938 | } |
| 3939 | - } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
|
|
| 3939 | + } else if ($term_data['slug'] != '' && $term = (array) term_exists($term_data['slug'], $taxonomy)) {
|
|
| 3940 | 3940 | $term_data['term_id'] = $term['term_id']; |
| 3941 | 3941 | |
| 3942 | - if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
|
|
| 3942 | + if ($term_id = geodir_imex_update_term($taxonomy, $term_data)) {
|
|
| 3943 | 3943 | $updated++; |
| 3944 | 3944 | } else {
|
| 3945 | 3945 | $invalid++; |
| 3946 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) ); |
|
| 3946 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory'));
|
|
| 3947 | 3947 | } |
| 3948 | 3948 | } else {
|
| 3949 | - if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
|
|
| 3949 | + if ($term_id = geodir_imex_insert_term($taxonomy, $term_data)) {
|
|
| 3950 | 3950 | $created++; |
| 3951 | 3951 | } else {
|
| 3952 | 3952 | $invalid++; |
| 3953 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) ); |
|
| 3953 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be added due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory'));
|
|
| 3954 | 3954 | } |
| 3955 | 3955 | } |
| 3956 | - } else if ( $import_choice == 'skip' ) {
|
|
| 3957 | - if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
|
|
| 3956 | + } else if ($import_choice == 'skip') {
|
|
| 3957 | + if ($cat_id > 0 && $term = (array) term_exists($cat_id, $taxonomy)) {
|
|
| 3958 | 3958 | $skipped++; |
| 3959 | - } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
|
|
| 3959 | + } else if ($term_data['slug'] != '' && $term = (array) term_exists($term_data['slug'], $taxonomy)) {
|
|
| 3960 | 3960 | $skipped++; |
| 3961 | 3961 | } else {
|
| 3962 | - if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
|
|
| 3962 | + if ($term_id = geodir_imex_insert_term($taxonomy, $term_data)) {
|
|
| 3963 | 3963 | $created++; |
| 3964 | 3964 | } else {
|
| 3965 | 3965 | $invalid++; |
| 3966 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) ); |
|
| 3966 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory'));
|
|
| 3967 | 3967 | } |
| 3968 | 3968 | } |
| 3969 | 3969 | } else {
|
| 3970 | 3970 | $invalid++; |
| 3971 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) ); |
|
| 3971 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be added due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory'));
|
|
| 3972 | 3972 | } |
| 3973 | 3973 | |
| 3974 | - if ( $term_id ) {
|
|
| 3974 | + if ($term_id) {
|
|
| 3975 | 3975 | // WPML |
| 3976 | 3976 | if ($is_wpml && geodir_wpml_is_taxonomy_translated($taxonomy) && $cat_id_original > 0 && $cat_language != '') {
|
| 3977 | - $wpml_element_type = 'tax_' . $taxonomy; |
|
| 3978 | - $source_language = geodir_get_language_for_element( $cat_id_original, $wpml_element_type ); |
|
| 3977 | + $wpml_element_type = 'tax_'.$taxonomy; |
|
| 3978 | + $source_language = geodir_get_language_for_element($cat_id_original, $wpml_element_type); |
|
| 3979 | 3979 | $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language(); |
| 3980 | 3980 | |
| 3981 | - $trid = $sitepress->get_element_trid( $cat_id_original, $wpml_element_type ); |
|
| 3981 | + $trid = $sitepress->get_element_trid($cat_id_original, $wpml_element_type); |
|
| 3982 | 3982 | |
| 3983 | - $sitepress->set_element_language_details( $term_id, $wpml_element_type, $trid, $cat_language, $source_language ); |
|
| 3983 | + $sitepress->set_element_language_details($term_id, $wpml_element_type, $trid, $cat_language, $source_language); |
|
| 3984 | 3984 | } |
| 3985 | 3985 | // WPML |
| 3986 | 3986 | |
| 3987 | - if ( isset( $term_data['top_description'] ) ) {
|
|
| 3988 | - geodir_update_tax_meta( $term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype ); |
|
| 3987 | + if (isset($term_data['top_description'])) {
|
|
| 3988 | + geodir_update_tax_meta($term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype); |
|
| 3989 | 3989 | } |
| 3990 | 3990 | |
| 3991 | - if ( isset( $term_data['cat_schema'] ) ) {
|
|
| 3992 | - geodir_update_tax_meta( $term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype ); |
|
| 3991 | + if (isset($term_data['cat_schema'])) {
|
|
| 3992 | + geodir_update_tax_meta($term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype); |
|
| 3993 | 3993 | } |
| 3994 | 3994 | |
| 3995 | 3995 | $attachment = false; |
| 3996 | - if ( isset( $term_data['image'] ) && $term_data['image'] != '' ) {
|
|
| 3997 | - $cat_image = geodir_get_default_catimage( $term_id, $cat_posttype ); |
|
| 3998 | - $cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : ''; |
|
| 3996 | + if (isset($term_data['image']) && $term_data['image'] != '') {
|
|
| 3997 | + $cat_image = geodir_get_default_catimage($term_id, $cat_posttype); |
|
| 3998 | + $cat_image = !empty($cat_image) && isset($cat_image['src']) ? $cat_image['src'] : ''; |
|
| 3999 | 3999 | |
| 4000 | - if ( basename($cat_image) != $term_data['image'] ) {
|
|
| 4000 | + if (basename($cat_image) != $term_data['image']) {
|
|
| 4001 | 4001 | $attachment = true; |
| 4002 | - geodir_update_tax_meta( $term_id, 'ct_cat_default_img', array( 'id' => 'image', 'src' => $uploads['url'] . '/' . $term_data['image'] ), $cat_posttype ); |
|
| 4002 | + geodir_update_tax_meta($term_id, 'ct_cat_default_img', array('id' => 'image', 'src' => $uploads['url'].'/'.$term_data['image']), $cat_posttype);
|
|
| 4003 | 4003 | } |
| 4004 | 4004 | } |
| 4005 | 4005 | |
| 4006 | - if ( isset( $term_data['icon'] ) && $term_data['icon'] != '' ) {
|
|
| 4007 | - $cat_icon = geodir_get_tax_meta( $term_id, 'ct_cat_icon', false, $cat_posttype ); |
|
| 4008 | - $cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : ''; |
|
| 4006 | + if (isset($term_data['icon']) && $term_data['icon'] != '') {
|
|
| 4007 | + $cat_icon = geodir_get_tax_meta($term_id, 'ct_cat_icon', false, $cat_posttype); |
|
| 4008 | + $cat_icon = !empty($cat_icon) && isset($cat_icon['src']) ? $cat_icon['src'] : ''; |
|
| 4009 | 4009 | |
| 4010 | - if ( basename($cat_icon) != $term_data['icon'] ) {
|
|
| 4010 | + if (basename($cat_icon) != $term_data['icon']) {
|
|
| 4011 | 4011 | $attachment = true; |
| 4012 | - geodir_update_tax_meta( $term_id, 'ct_cat_icon', array( 'id' => 'icon', 'src' => $uploads['url'] . '/' . $term_data['icon'] ), $cat_posttype ); |
|
| 4012 | + geodir_update_tax_meta($term_id, 'ct_cat_icon', array('id' => 'icon', 'src' => $uploads['url'].'/'.$term_data['icon']), $cat_posttype);
|
|
| 4013 | 4013 | } |
| 4014 | 4014 | } |
| 4015 | 4015 | |
| 4016 | - if ( $attachment ) {
|
|
| 4016 | + if ($attachment) {
|
|
| 4017 | 4017 | $images++; |
| 4018 | 4018 | } |
| 4019 | 4019 | } |
@@ -4035,35 +4035,35 @@ discard block |
||
| 4035 | 4035 | $json['invalid'] = $invalid; |
| 4036 | 4036 | $json['images'] = $images; |
| 4037 | 4037 | |
| 4038 | - wp_send_json( $json ); |
|
| 4038 | + wp_send_json($json); |
|
| 4039 | 4039 | exit; |
| 4040 | - } else if ( $task == 'import_post' ) {
|
|
| 4041 | - $xtimings['###1'] = microtime(true)-$xstart; |
|
| 4040 | + } else if ($task == 'import_post') {
|
|
| 4041 | + $xtimings['###1'] = microtime(true) - $xstart; |
|
| 4042 | 4042 | //run some stuff to make the import quicker |
| 4043 | - wp_defer_term_counting( true ); |
|
| 4044 | - wp_defer_comment_counting( true ); |
|
| 4045 | - $wpdb->query( 'SET autocommit = 0;' ); |
|
| 4043 | + wp_defer_term_counting(true); |
|
| 4044 | + wp_defer_comment_counting(true); |
|
| 4045 | + $wpdb->query('SET autocommit = 0;');
|
|
| 4046 | 4046 | // |
| 4047 | 4047 | // remove_all_actions('publish_post');
|
| 4048 | 4048 | // remove_all_actions('transition_post_status');
|
| 4049 | 4049 | // remove_all_actions('publish_future_post');
|
| 4050 | 4050 | |
| 4051 | 4051 | if (!empty($file)) {
|
| 4052 | - $is_claim_active = is_plugin_active( 'geodir_claim_listing/geodir_claim_listing.php' ) && get_option('geodir_claim_enable') === 'yes' ? true : false;
|
|
| 4052 | + $is_claim_active = is_plugin_active('geodir_claim_listing/geodir_claim_listing.php') && get_option('geodir_claim_enable') === 'yes' ? true : false;
|
|
| 4053 | 4053 | $wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses. |
| 4054 | 4054 | $default_status = 'publish'; |
| 4055 | - $current_date = date_i18n( 'Y-m-d', time() ); |
|
| 4055 | + $current_date = date_i18n('Y-m-d', time());
|
|
| 4056 | 4056 | |
| 4057 | 4057 | $columns = isset($file[0]) ? $file[0] : NULL; |
| 4058 | 4058 | |
| 4059 | 4059 | if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
|
| 4060 | 4060 | $json['error'] = CSV_INVAILD_FILE; |
| 4061 | - wp_send_json( $json ); |
|
| 4061 | + wp_send_json($json); |
|
| 4062 | 4062 | exit; |
| 4063 | 4063 | } |
| 4064 | - $xtimings['###2'] = microtime(true)-$xstart; |
|
| 4064 | + $xtimings['###2'] = microtime(true) - $xstart; |
|
| 4065 | 4065 | $gd_error_log = __('GD IMPORT LISTINGS [ROW %d]:', 'geodirectory');
|
| 4066 | - $wp_chars_error = __( '(check & remove if any invalid characters used in data)', 'geodirectory' ); |
|
| 4066 | + $wp_chars_error = __('(check & remove if any invalid characters used in data)', 'geodirectory');
|
|
| 4067 | 4067 | $processed_actual = 0; |
| 4068 | 4068 | for ($i = 1; $i <= $limit; $i++) {
|
| 4069 | 4069 | $index = $processed + $i; |
@@ -4072,9 +4072,9 @@ discard block |
||
| 4072 | 4072 | if (isset($file[$index])) {
|
| 4073 | 4073 | $processed_actual++; |
| 4074 | 4074 | $row = $file[$index]; |
| 4075 | - $row = array_map( 'trim', $row ); |
|
| 4075 | + $row = array_map('trim', $row);
|
|
| 4076 | 4076 | //$row = array_map( 'utf8_encode', $row ); |
| 4077 | - $row = array_map( 'addslashes_gpc', $row ); |
|
| 4077 | + $row = array_map('addslashes_gpc', $row);
|
|
| 4078 | 4078 | |
| 4079 | 4079 | $post_id = ''; |
| 4080 | 4080 | $post_title = ''; |
@@ -4114,82 +4114,82 @@ discard block |
||
| 4114 | 4114 | $original_post_id = ''; |
| 4115 | 4115 | |
| 4116 | 4116 | $c = 0; |
| 4117 | - foreach ($columns as $column ) {
|
|
| 4117 | + foreach ($columns as $column) {
|
|
| 4118 | 4118 | $gd_post[$column] = $row[$c]; |
| 4119 | 4119 | |
| 4120 | - if ( $column == 'post_id' ) {
|
|
| 4120 | + if ($column == 'post_id') {
|
|
| 4121 | 4121 | $post_id = $row[$c]; |
| 4122 | - } else if ( $column == 'post_title' ) {
|
|
| 4122 | + } else if ($column == 'post_title') {
|
|
| 4123 | 4123 | $post_title = sanitize_text_field($row[$c]); |
| 4124 | - } else if ( $column == 'post_author' ) {
|
|
| 4124 | + } else if ($column == 'post_author') {
|
|
| 4125 | 4125 | $post_author = $row[$c]; |
| 4126 | - } else if ( $column == 'post_date' ) {
|
|
| 4126 | + } else if ($column == 'post_date') {
|
|
| 4127 | 4127 | $post_date = $row[$c]; |
| 4128 | - } else if ( $column == 'post_content' ) {
|
|
| 4128 | + } else if ($column == 'post_content') {
|
|
| 4129 | 4129 | $post_content = $row[$c]; |
| 4130 | - } else if ( $column == 'post_category' && $row[$c] != '' ) {
|
|
| 4131 | - $post_category_arr = explode( ',', $row[$c] ); |
|
| 4132 | - } else if ( $column == 'default_category' ) {
|
|
| 4130 | + } else if ($column == 'post_category' && $row[$c] != '') {
|
|
| 4131 | + $post_category_arr = explode(',', $row[$c]);
|
|
| 4132 | + } else if ($column == 'default_category') {
|
|
| 4133 | 4133 | $default_category = wp_kses_normalize_entities($row[$c]); |
| 4134 | - } else if ( $column == 'post_tags' && $row[$c] != '' ) {
|
|
| 4135 | - $post_tags = explode( ',', sanitize_text_field($row[$c]) ); |
|
| 4136 | - } else if ( $column == 'post_type' ) {
|
|
| 4134 | + } else if ($column == 'post_tags' && $row[$c] != '') {
|
|
| 4135 | + $post_tags = explode(',', sanitize_text_field($row[$c]));
|
|
| 4136 | + } else if ($column == 'post_type') {
|
|
| 4137 | 4137 | $post_type = $row[$c]; |
| 4138 | - } else if ( $column == 'post_status' ) {
|
|
| 4139 | - $post_status = sanitize_key( $row[$c] ); |
|
| 4140 | - } else if ( $column == 'is_featured' ) {
|
|
| 4141 | - $is_featured = (int)$row[$c]; |
|
| 4142 | - } else if ( $column == 'geodir_video' ) {
|
|
| 4138 | + } else if ($column == 'post_status') {
|
|
| 4139 | + $post_status = sanitize_key($row[$c]); |
|
| 4140 | + } else if ($column == 'is_featured') {
|
|
| 4141 | + $is_featured = (int) $row[$c]; |
|
| 4142 | + } else if ($column == 'geodir_video') {
|
|
| 4143 | 4143 | $geodir_video = $row[$c]; |
| 4144 | - } else if ( $column == 'post_address' ) {
|
|
| 4144 | + } else if ($column == 'post_address') {
|
|
| 4145 | 4145 | $post_address = sanitize_text_field($row[$c]); |
| 4146 | - } else if ( $column == 'post_city' ) {
|
|
| 4146 | + } else if ($column == 'post_city') {
|
|
| 4147 | 4147 | $post_city = sanitize_text_field($row[$c]); |
| 4148 | - } else if ( $column == 'post_region' ) {
|
|
| 4148 | + } else if ($column == 'post_region') {
|
|
| 4149 | 4149 | $post_region = sanitize_text_field($row[$c]); |
| 4150 | - } else if ( $column == 'post_country' ) {
|
|
| 4150 | + } else if ($column == 'post_country') {
|
|
| 4151 | 4151 | $post_country = sanitize_text_field($row[$c]); |
| 4152 | - } else if ( $column == 'post_zip' ) {
|
|
| 4152 | + } else if ($column == 'post_zip') {
|
|
| 4153 | 4153 | $post_zip = sanitize_text_field($row[$c]); |
| 4154 | - } else if ( $column == 'post_latitude' ) {
|
|
| 4154 | + } else if ($column == 'post_latitude') {
|
|
| 4155 | 4155 | $post_latitude = sanitize_text_field($row[$c]); |
| 4156 | - } else if ( $column == 'post_longitude' ) {
|
|
| 4156 | + } else if ($column == 'post_longitude') {
|
|
| 4157 | 4157 | $post_longitude = sanitize_text_field($row[$c]); |
| 4158 | - } else if ( $column == 'post_neighbourhood' ) {
|
|
| 4158 | + } else if ($column == 'post_neighbourhood') {
|
|
| 4159 | 4159 | $post_neighbourhood = sanitize_text_field($row[$c]); |
| 4160 | 4160 | unset($gd_post[$column]); |
| 4161 | - } else if ( $column == 'neighbourhood_latitude' ) {
|
|
| 4161 | + } else if ($column == 'neighbourhood_latitude') {
|
|
| 4162 | 4162 | $neighbourhood_latitude = sanitize_text_field($row[$c]); |
| 4163 | - } else if ( $column == 'neighbourhood_longitude' ) {
|
|
| 4163 | + } else if ($column == 'neighbourhood_longitude') {
|
|
| 4164 | 4164 | $neighbourhood_longitude = sanitize_text_field($row[$c]); |
| 4165 | - } else if ( $column == 'geodir_timing' ) {
|
|
| 4165 | + } else if ($column == 'geodir_timing') {
|
|
| 4166 | 4166 | $geodir_timing = sanitize_text_field($row[$c]); |
| 4167 | - } else if ( $column == 'geodir_contact' ) {
|
|
| 4167 | + } else if ($column == 'geodir_contact') {
|
|
| 4168 | 4168 | $geodir_contact = sanitize_text_field($row[$c]); |
| 4169 | - } else if ( $column == 'geodir_email' ) {
|
|
| 4169 | + } else if ($column == 'geodir_email') {
|
|
| 4170 | 4170 | $geodir_email = sanitize_email($row[$c]); |
| 4171 | - } else if ( $column == 'geodir_website' ) {
|
|
| 4171 | + } else if ($column == 'geodir_website') {
|
|
| 4172 | 4172 | $geodir_website = sanitize_text_field($row[$c]); |
| 4173 | - } else if ( $column == 'geodir_twitter' ) {
|
|
| 4173 | + } else if ($column == 'geodir_twitter') {
|
|
| 4174 | 4174 | $geodir_twitter = sanitize_text_field($row[$c]); |
| 4175 | - } else if ( $column == 'geodir_facebook' ) {
|
|
| 4175 | + } else if ($column == 'geodir_facebook') {
|
|
| 4176 | 4176 | $geodir_facebook = sanitize_text_field($row[$c]); |
| 4177 | - } else if ( $column == 'IMAGE' && !empty( $row[$c] ) && $row[$c] != '' ) {
|
|
| 4177 | + } else if ($column == 'IMAGE' && !empty($row[$c]) && $row[$c] != '') {
|
|
| 4178 | 4178 | $post_images[] = $row[$c]; |
| 4179 | - } else if ( $column == 'alive_days' && (int)$row[$c] > 0 ) {
|
|
| 4180 | - $expire_date = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$row[$c] . ' days' ) ); |
|
| 4181 | - } else if ( $column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never' ) {
|
|
| 4179 | + } else if ($column == 'alive_days' && (int) $row[$c] > 0) {
|
|
| 4180 | + $expire_date = date_i18n('Y-m-d', strtotime($current_date.'+'.(int) $row[$c].' days'));
|
|
| 4181 | + } else if ($column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never') {
|
|
| 4182 | 4182 | $row[$c] = str_replace('/', '-', $row[$c]);
|
| 4183 | - $expire_date = date_i18n( 'Y-m-d', strtotime( $row[$c] ) ); |
|
| 4184 | - } else if ( strpos( $column, 'linked_' ) === 0 ) {
|
|
| 4185 | - $geodir_link_business = (int)$row[$c]; |
|
| 4183 | + $expire_date = date_i18n('Y-m-d', strtotime($row[$c]));
|
|
| 4184 | + } else if (strpos($column, 'linked_') === 0) {
|
|
| 4185 | + $geodir_link_business = (int) $row[$c]; |
|
| 4186 | 4186 | } |
| 4187 | 4187 | // WPML |
| 4188 | 4188 | if ($is_wpml) {
|
| 4189 | 4189 | if ($column == 'language') {
|
| 4190 | 4190 | $language = geodir_strtolower(trim($row[$c])); |
| 4191 | 4191 | } else if ($column == 'original_post_id') {
|
| 4192 | - $original_post_id = (int)$row[$c]; |
|
| 4192 | + $original_post_id = (int) $row[$c]; |
|
| 4193 | 4193 | } |
| 4194 | 4194 | } |
| 4195 | 4195 | // WPML |
@@ -4197,7 +4197,7 @@ discard block |
||
| 4197 | 4197 | } |
| 4198 | 4198 | // listing claimed or not |
| 4199 | 4199 | if ($is_claim_active && isset($gd_post['claimed'])) {
|
| 4200 | - $gd_post['claimed'] = (int)$gd_post['claimed'] == 1 ? 1 : 0; |
|
| 4200 | + $gd_post['claimed'] = (int) $gd_post['claimed'] == 1 ? 1 : 0; |
|
| 4201 | 4201 | } |
| 4202 | 4202 | |
| 4203 | 4203 | // WPML |
@@ -4208,43 +4208,43 @@ discard block |
||
| 4208 | 4208 | |
| 4209 | 4209 | $gd_post['IMAGE'] = $post_images; |
| 4210 | 4210 | |
| 4211 | - $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status; |
|
| 4212 | - $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status; |
|
| 4211 | + $post_status = !empty($post_status) ? sanitize_key($post_status) : $default_status; |
|
| 4212 | + $post_status = !empty($wp_post_statuses) && !isset($wp_post_statuses[$post_status]) ? $default_status : $post_status; |
|
| 4213 | 4213 | |
| 4214 | 4214 | $valid = true; |
| 4215 | 4215 | |
| 4216 | - if ( $post_title == '' || !in_array( $post_type, $post_types ) ) {
|
|
| 4216 | + if ($post_title == '' || !in_array($post_type, $post_types)) {
|
|
| 4217 | 4217 | $invalid++; |
| 4218 | 4218 | $valid = false; |
| 4219 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) ); |
|
| 4219 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be added due to blank title/invalid post type', 'geodirectory'));
|
|
| 4220 | 4220 | } |
| 4221 | - $xtimings['###3'] = microtime(true)-$xstart; |
|
| 4222 | - $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true; |
|
| 4223 | - if ( $location_allowed ) {
|
|
| 4221 | + $xtimings['###3'] = microtime(true) - $xstart; |
|
| 4222 | + $location_allowed = function_exists('geodir_cpt_no_location') && geodir_cpt_no_location($post_type) ? false : true;
|
|
| 4223 | + if ($location_allowed) {
|
|
| 4224 | 4224 | $location_result = geodir_get_default_location(); |
| 4225 | - if ( $post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '' ) {
|
|
| 4225 | + if ($post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '') {
|
|
| 4226 | 4226 | $invalid_addr++; |
| 4227 | 4227 | $valid = false; |
| 4228 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory' ) ); |
|
| 4229 | - } else if ( !empty( $location_result ) && $location_result->location_id == 0 ) {
|
|
| 4230 | - if ( ( geodir_strtolower( $post_city ) != geodir_strtolower( $location_result->city ) ) || ( geodir_strtolower( $post_region ) != geodir_strtolower( $location_result->region ) ) || (geodir_strtolower( $post_country ) != geodir_strtolower( $location_result->country ) ) ) {
|
|
| 4228 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory'));
|
|
| 4229 | + } else if (!empty($location_result) && $location_result->location_id == 0) {
|
|
| 4230 | + if ((geodir_strtolower($post_city) != geodir_strtolower($location_result->city)) || (geodir_strtolower($post_region) != geodir_strtolower($location_result->region)) || (geodir_strtolower($post_country) != geodir_strtolower($location_result->country))) {
|
|
| 4231 | 4231 | $invalid_addr++; |
| 4232 | 4232 | $valid = false; |
| 4233 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory' ) ); |
|
| 4233 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory'));
|
|
| 4234 | 4234 | } else {
|
| 4235 | 4235 | if (!$location_manager) {
|
| 4236 | - $gd_post['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // Set the default location when location manager not activated. |
|
| 4236 | + $gd_post['post_locations'] = '['.$location_result->city_slug.'],['.$location_result->region_slug.'],['.$location_result->country_slug.']'; // Set the default location when location manager not activated. |
|
| 4237 | 4237 | } |
| 4238 | 4238 | } |
| 4239 | 4239 | } |
| 4240 | 4240 | } |
| 4241 | - $xtimings['###4'] = microtime(true)-$xstart; |
|
| 4242 | - if ( !$valid ) {
|
|
| 4241 | + $xtimings['###4'] = microtime(true) - $xstart; |
|
| 4242 | + if (!$valid) {
|
|
| 4243 | 4243 | continue; |
| 4244 | 4244 | } |
| 4245 | 4245 | |
| 4246 | - $cat_taxonomy = $post_type . 'category'; |
|
| 4247 | - $tags_taxonomy = $post_type . '_tags'; |
|
| 4246 | + $cat_taxonomy = $post_type.'category'; |
|
| 4247 | + $tags_taxonomy = $post_type.'_tags'; |
|
| 4248 | 4248 | |
| 4249 | 4249 | if ($default_category != '' && !in_array($default_category, $post_category_arr)) {
|
| 4250 | 4250 | $post_category_arr = array_merge(array($default_category), $post_category_arr); |
@@ -4252,29 +4252,29 @@ discard block |
||
| 4252 | 4252 | |
| 4253 | 4253 | $post_category = array(); |
| 4254 | 4254 | $default_category_id = NULL; |
| 4255 | - if ( !empty( $post_category_arr ) ) {
|
|
| 4256 | - foreach ( $post_category_arr as $value ) {
|
|
| 4257 | - $category_name = wp_kses_normalize_entities( trim( $value ) ); |
|
| 4255 | + if (!empty($post_category_arr)) {
|
|
| 4256 | + foreach ($post_category_arr as $value) {
|
|
| 4257 | + $category_name = wp_kses_normalize_entities(trim($value)); |
|
| 4258 | 4258 | |
| 4259 | - if ( $category_name != '' ) {
|
|
| 4259 | + if ($category_name != '') {
|
|
| 4260 | 4260 | $term_category = array(); |
| 4261 | 4261 | |
| 4262 | - if ( $term = get_term_by( 'name', $category_name, $cat_taxonomy ) ) {
|
|
| 4262 | + if ($term = get_term_by('name', $category_name, $cat_taxonomy)) {
|
|
| 4263 | 4263 | $term_category = $term; |
| 4264 | - } else if ( $term = get_term_by( 'slug', $category_name, $cat_taxonomy ) ) {
|
|
| 4264 | + } else if ($term = get_term_by('slug', $category_name, $cat_taxonomy)) {
|
|
| 4265 | 4265 | $term_category = $term; |
| 4266 | 4266 | } else {
|
| 4267 | 4267 | $term_data = array(); |
| 4268 | 4268 | $term_data['name'] = $category_name; |
| 4269 | 4269 | $term_data['taxonomy'] = $cat_taxonomy; |
| 4270 | 4270 | |
| 4271 | - $term_id = geodir_imex_insert_term( $cat_taxonomy, $term_data ); |
|
| 4272 | - if ( $term_id ) {
|
|
| 4273 | - $term_category = get_term( $term_id, $cat_taxonomy ); |
|
| 4271 | + $term_id = geodir_imex_insert_term($cat_taxonomy, $term_data); |
|
| 4272 | + if ($term_id) {
|
|
| 4273 | + $term_category = get_term($term_id, $cat_taxonomy); |
|
| 4274 | 4274 | } |
| 4275 | 4275 | } |
| 4276 | 4276 | |
| 4277 | - if ( !empty( $term_category ) && !is_wp_error( $term_category ) ) {
|
|
| 4277 | + if (!empty($term_category) && !is_wp_error($term_category)) {
|
|
| 4278 | 4278 | $post_category[] = intval($term_category->term_id); |
| 4279 | 4279 | |
| 4280 | 4280 | if ($category_name == $default_category) {
|
@@ -4284,14 +4284,14 @@ discard block |
||
| 4284 | 4284 | } |
| 4285 | 4285 | } |
| 4286 | 4286 | } |
| 4287 | - $xtimings['###5'] = microtime(true)-$xstart; |
|
| 4287 | + $xtimings['###5'] = microtime(true) - $xstart; |
|
| 4288 | 4288 | $save_post = array(); |
| 4289 | 4289 | $save_post['post_title'] = $post_title; |
| 4290 | 4290 | if (!empty($post_date)) {
|
| 4291 | - $post_date = geodir_date( $post_date, 'Y-m-d H:i:s' ); // convert to mysql date format. |
|
| 4291 | + $post_date = geodir_date($post_date, 'Y-m-d H:i:s'); // convert to mysql date format. |
|
| 4292 | 4292 | |
| 4293 | 4293 | $save_post['post_date'] = $post_date; |
| 4294 | - $save_post['post_date_gmt'] = get_gmt_from_date( $post_date ); |
|
| 4294 | + $save_post['post_date_gmt'] = get_gmt_from_date($post_date); |
|
| 4295 | 4295 | } |
| 4296 | 4296 | $save_post['post_content'] = $post_content; |
| 4297 | 4297 | $save_post['post_type'] = $post_type; |
@@ -4301,15 +4301,15 @@ discard block |
||
| 4301 | 4301 | $save_post['post_tags'] = $post_tags; |
| 4302 | 4302 | |
| 4303 | 4303 | $saved_post_id = NULL; |
| 4304 | - if ( $import_choice == 'update' ) {
|
|
| 4305 | - $gd_wp_error = __( 'Unable to add listing, please check the listing data.', 'geodirectory' ); |
|
| 4304 | + if ($import_choice == 'update') {
|
|
| 4305 | + $gd_wp_error = __('Unable to add listing, please check the listing data.', 'geodirectory');
|
|
| 4306 | 4306 | |
| 4307 | - if ( $post_id > 0 && get_post( $post_id ) ) {
|
|
| 4307 | + if ($post_id > 0 && get_post($post_id)) {
|
|
| 4308 | 4308 | $save_post['ID'] = $post_id; |
| 4309 | 4309 | |
| 4310 | - if ( $saved_post_id = wp_update_post( $save_post, true ) ) {
|
|
| 4311 | - if ( is_wp_error( $saved_post_id ) ) {
|
|
| 4312 | - $gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error; |
|
| 4310 | + if ($saved_post_id = wp_update_post($save_post, true)) {
|
|
| 4311 | + if (is_wp_error($saved_post_id)) {
|
|
| 4312 | + $gd_wp_error = $saved_post_id->get_error_message().' '.$wp_chars_error; |
|
| 4313 | 4313 | $saved_post_id = 0; |
| 4314 | 4314 | } else {
|
| 4315 | 4315 | $saved_post_id = $post_id; |
@@ -4317,9 +4317,9 @@ discard block |
||
| 4317 | 4317 | } |
| 4318 | 4318 | } |
| 4319 | 4319 | } else {
|
| 4320 | - if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
|
|
| 4321 | - if ( is_wp_error( $saved_post_id ) ) {
|
|
| 4322 | - $gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error; |
|
| 4320 | + if ($saved_post_id = wp_insert_post($save_post, true)) {
|
|
| 4321 | + if (is_wp_error($saved_post_id)) {
|
|
| 4322 | + $gd_wp_error = $saved_post_id->get_error_message().' '.$wp_chars_error; |
|
| 4323 | 4323 | $saved_post_id = 0; |
| 4324 | 4324 | } else {
|
| 4325 | 4325 | $created++; |
@@ -4327,19 +4327,19 @@ discard block |
||
| 4327 | 4327 | } |
| 4328 | 4328 | } |
| 4329 | 4329 | |
| 4330 | - if ( !$saved_post_id > 0 ) {
|
|
| 4330 | + if (!$saved_post_id > 0) {
|
|
| 4331 | 4331 | $invalid++; |
| 4332 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_wp_error ); |
|
| 4332 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_wp_error); |
|
| 4333 | 4333 | } |
| 4334 | - } else if ( $import_choice == 'skip' ) {
|
|
| 4335 | - if ( $post_id > 0 && get_post( $post_id ) ) {
|
|
| 4334 | + } else if ($import_choice == 'skip') {
|
|
| 4335 | + if ($post_id > 0 && get_post($post_id)) {
|
|
| 4336 | 4336 | $skipped++; |
| 4337 | 4337 | } else {
|
| 4338 | - if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
|
|
| 4339 | - if ( is_wp_error( $saved_post_id ) ) {
|
|
| 4338 | + if ($saved_post_id = wp_insert_post($save_post, true)) {
|
|
| 4339 | + if (is_wp_error($saved_post_id)) {
|
|
| 4340 | 4340 | $invalid++; |
| 4341 | 4341 | |
| 4342 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $saved_post_id->get_error_message() . ' ' . $wp_chars_error ); |
|
| 4342 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$saved_post_id->get_error_message().' '.$wp_chars_error); |
|
| 4343 | 4343 | $saved_post_id = 0; |
| 4344 | 4344 | } else {
|
| 4345 | 4345 | $created++; |
@@ -4347,28 +4347,28 @@ discard block |
||
| 4347 | 4347 | } else {
|
| 4348 | 4348 | $invalid++; |
| 4349 | 4349 | |
| 4350 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error ); |
|
| 4350 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$wp_chars_error); |
|
| 4351 | 4351 | } |
| 4352 | 4352 | } |
| 4353 | 4353 | } else {
|
| 4354 | 4354 | $invalid++; |
| 4355 | 4355 | |
| 4356 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error ); |
|
| 4356 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$wp_chars_error); |
|
| 4357 | 4357 | } |
| 4358 | - $xtimings['###6'] = microtime(true)-$xstart; |
|
| 4359 | - if ( (int)$saved_post_id > 0 ) {
|
|
| 4358 | + $xtimings['###6'] = microtime(true) - $xstart; |
|
| 4359 | + if ((int) $saved_post_id > 0) {
|
|
| 4360 | 4360 | // WPML |
| 4361 | 4361 | if ($is_wpml && geodir_wpml_is_post_type_translated($post_type) && $original_post_id > 0 && $language != '') {
|
| 4362 | - $wpml_post_type = 'post_' . $post_type; |
|
| 4363 | - $source_language = geodir_get_language_for_element( $original_post_id, $wpml_post_type ); |
|
| 4362 | + $wpml_post_type = 'post_'.$post_type; |
|
| 4363 | + $source_language = geodir_get_language_for_element($original_post_id, $wpml_post_type); |
|
| 4364 | 4364 | $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language(); |
| 4365 | 4365 | |
| 4366 | - $trid = $sitepress->get_element_trid( $original_post_id, $wpml_post_type ); |
|
| 4366 | + $trid = $sitepress->get_element_trid($original_post_id, $wpml_post_type); |
|
| 4367 | 4367 | |
| 4368 | - $sitepress->set_element_language_details( $saved_post_id, $wpml_post_type, $trid, $language, $source_language ); |
|
| 4368 | + $sitepress->set_element_language_details($saved_post_id, $wpml_post_type, $trid, $language, $source_language); |
|
| 4369 | 4369 | } |
| 4370 | 4370 | // WPML |
| 4371 | - $gd_post_info = geodir_get_post_info( $saved_post_id ); |
|
| 4371 | + $gd_post_info = geodir_get_post_info($saved_post_id); |
|
| 4372 | 4372 | |
| 4373 | 4373 | $gd_post['post_id'] = $saved_post_id; |
| 4374 | 4374 | $gd_post['ID'] = $saved_post_id; |
@@ -4380,7 +4380,7 @@ discard block |
||
| 4380 | 4380 | |
| 4381 | 4381 | // post location |
| 4382 | 4382 | $post_location_id = 0; |
| 4383 | - if ( $location_allowed && !empty( $location_result ) && $location_result->location_id > 0 ) {
|
|
| 4383 | + if ($location_allowed && !empty($location_result) && $location_result->location_id > 0) {
|
|
| 4384 | 4384 | $gd_post['post_neighbourhood'] = ''; |
| 4385 | 4385 | |
| 4386 | 4386 | $post_location_info = array( |
@@ -4390,7 +4390,7 @@ discard block |
||
| 4390 | 4390 | 'geo_lat' => $post_latitude, |
| 4391 | 4391 | 'geo_lng' => $post_longitude |
| 4392 | 4392 | ); |
| 4393 | - if ( $location_id = (int)geodir_add_new_location( $post_location_info ) ) {
|
|
| 4393 | + if ($location_id = (int) geodir_add_new_location($post_location_info)) {
|
|
| 4394 | 4394 | $post_location_id = $location_id; |
| 4395 | 4395 | } |
| 4396 | 4396 | |
@@ -4432,14 +4432,14 @@ discard block |
||
| 4432 | 4432 | } |
| 4433 | 4433 | |
| 4434 | 4434 | // post package info |
| 4435 | - $package_id = isset( $gd_post['package_id'] ) && !empty( $gd_post['package_id'] ) ? (int)$gd_post['package_id'] : 0; |
|
| 4435 | + $package_id = isset($gd_post['package_id']) && !empty($gd_post['package_id']) ? (int) $gd_post['package_id'] : 0; |
|
| 4436 | 4436 | if (!$package_id && !empty($gd_post_info) && isset($gd_post_info->package_id) && $gd_post_info->package_id) {
|
| 4437 | 4437 | $package_id = $gd_post_info->package_id; |
| 4438 | 4438 | } |
| 4439 | 4439 | |
| 4440 | 4440 | $package_info = array(); |
| 4441 | 4441 | if ($package_id && function_exists('geodir_get_package_info_by_id')) {
|
| 4442 | - $package_info = (array)geodir_get_package_info_by_id($package_id); |
|
| 4442 | + $package_info = (array) geodir_get_package_info_by_id($package_id); |
|
| 4443 | 4443 | |
| 4444 | 4444 | if (!(!empty($package_info) && isset($package_info['post_type']) && $package_info['post_type'] == $post_type)) {
|
| 4445 | 4445 | $package_info = array(); |
@@ -4447,18 +4447,18 @@ discard block |
||
| 4447 | 4447 | } |
| 4448 | 4448 | |
| 4449 | 4449 | if (empty($package_info)) {
|
| 4450 | - $package_info = (array)geodir_post_package_info( array(), '', $post_type ); |
|
| 4450 | + $package_info = (array) geodir_post_package_info(array(), '', $post_type); |
|
| 4451 | 4451 | } |
| 4452 | 4452 | |
| 4453 | - if (!empty($package_info)) {
|
|
| 4453 | + if (!empty($package_info)) {
|
|
| 4454 | 4454 | $package_id = $package_info['pid']; |
| 4455 | 4455 | |
| 4456 | 4456 | if (isset($gd_post['alive_days']) || isset($gd_post['expire_date'])) {
|
| 4457 | 4457 | $gd_post['expire_date'] = $expire_date; |
| 4458 | 4458 | } else {
|
| 4459 | - if ( isset( $package_info['days'] ) && (int)$package_info['days'] > 0 ) {
|
|
| 4460 | - $gd_post['alive_days'] = (int)$package_info['days']; |
|
| 4461 | - $gd_post['expire_date'] = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$package_info['days'] . ' days' ) ); |
|
| 4459 | + if (isset($package_info['days']) && (int) $package_info['days'] > 0) {
|
|
| 4460 | + $gd_post['alive_days'] = (int) $package_info['days']; |
|
| 4461 | + $gd_post['expire_date'] = date_i18n('Y-m-d', strtotime($current_date.'+'.(int) $package_info['days'].' days'));
|
|
| 4462 | 4462 | } else {
|
| 4463 | 4463 | $gd_post['expire_date'] = 'Never'; |
| 4464 | 4464 | } |
@@ -4467,7 +4467,7 @@ discard block |
||
| 4467 | 4467 | $gd_post['package_id'] = $package_id; |
| 4468 | 4468 | } |
| 4469 | 4469 | |
| 4470 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 4470 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 4471 | 4471 | |
| 4472 | 4472 | if ($post_type == 'gd_event') {
|
| 4473 | 4473 | $gd_post = geodir_imex_process_event_data($gd_post); |
@@ -4478,71 +4478,71 @@ discard block |
||
| 4478 | 4478 | } |
| 4479 | 4479 | |
| 4480 | 4480 | // Export franchise fields |
| 4481 | - $is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false; |
|
| 4481 | + $is_franchise_active = is_plugin_active('geodir_franchise/geodir_franchise.php') && geodir_franchise_enabled($post_type) ? true : false;
|
|
| 4482 | 4482 | if ($is_franchise_active) {
|
| 4483 | - if ( isset( $gd_post['gd_is_franchise'] ) && empty( $gd_post['franchise'] ) ) {
|
|
| 4484 | - if ( absint( $gd_post['gd_is_franchise'] ) != 0 ) {
|
|
| 4483 | + if (isset($gd_post['gd_is_franchise']) && empty($gd_post['franchise'])) {
|
|
| 4484 | + if (absint($gd_post['gd_is_franchise']) != 0) {
|
|
| 4485 | 4485 | $gd_franchise_lock = array(); |
| 4486 | 4486 | |
| 4487 | - if ( isset( $gd_post['gd_franchise_lock'] ) ) {
|
|
| 4488 | - $gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock'] );
|
|
| 4489 | - $gd_franchise_lock = trim( $gd_franchise_lock ); |
|
| 4490 | - $gd_franchise_lock = explode( ",", $gd_franchise_lock ); |
|
| 4487 | + if (isset($gd_post['gd_franchise_lock'])) {
|
|
| 4488 | + $gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock']);
|
|
| 4489 | + $gd_franchise_lock = trim($gd_franchise_lock); |
|
| 4490 | + $gd_franchise_lock = explode(",", $gd_franchise_lock);
|
|
| 4491 | 4491 | } |
| 4492 | 4492 | |
| 4493 | - update_post_meta( $saved_post_id, 'gd_is_franchise', 1 ); |
|
| 4494 | - update_post_meta( $saved_post_id, 'gd_franchise_lock', $gd_franchise_lock ); |
|
| 4493 | + update_post_meta($saved_post_id, 'gd_is_franchise', 1); |
|
| 4494 | + update_post_meta($saved_post_id, 'gd_franchise_lock', $gd_franchise_lock); |
|
| 4495 | 4495 | } else {
|
| 4496 | - if ( function_exists( 'geodir_franchise_remove_franchise' ) ) {
|
|
| 4497 | - geodir_franchise_remove_franchise( $saved_post_id ); |
|
| 4496 | + if (function_exists('geodir_franchise_remove_franchise')) {
|
|
| 4497 | + geodir_franchise_remove_franchise($saved_post_id); |
|
| 4498 | 4498 | } |
| 4499 | 4499 | } |
| 4500 | 4500 | } else {
|
| 4501 | - if ( isset( $gd_post['franchise'] ) && (int)$gd_post['franchise'] > 0 && geodir_franchise_check( (int)$gd_post['franchise'] ) ) {
|
|
| 4502 | - geodir_save_post_meta( $saved_post_id, 'franchise', (int)$gd_post['franchise'] ); |
|
| 4501 | + if (isset($gd_post['franchise']) && (int) $gd_post['franchise'] > 0 && geodir_franchise_check((int) $gd_post['franchise'])) {
|
|
| 4502 | + geodir_save_post_meta($saved_post_id, 'franchise', (int) $gd_post['franchise']); |
|
| 4503 | 4503 | } |
| 4504 | 4504 | } |
| 4505 | 4505 | } |
| 4506 | 4506 | |
| 4507 | 4507 | if (!empty($save_post['post_category']) && is_array($save_post['post_category'])) {
|
| 4508 | - $save_post['post_category'] = array_unique( array_map( 'intval', $save_post['post_category'] ) ); |
|
| 4508 | + $save_post['post_category'] = array_unique(array_map('intval', $save_post['post_category']));
|
|
| 4509 | 4509 | if ($default_category_id) {
|
| 4510 | 4510 | $save_post['post_default_category'] = $default_category_id; |
| 4511 | 4511 | $gd_post['default_category'] = $default_category_id; |
| 4512 | 4512 | } |
| 4513 | 4513 | $gd_post[$cat_taxonomy] = $save_post['post_category']; |
| 4514 | 4514 | } |
| 4515 | - $xtimings['###7'] = microtime(true)-$xstart; |
|
| 4515 | + $xtimings['###7'] = microtime(true) - $xstart; |
|
| 4516 | 4516 | // Save post info |
| 4517 | - geodir_save_post_info( $saved_post_id, $gd_post ); |
|
| 4518 | - $xtimings['###8'] = microtime(true)-$xstart; |
|
| 4517 | + geodir_save_post_info($saved_post_id, $gd_post); |
|
| 4518 | + $xtimings['###8'] = microtime(true) - $xstart; |
|
| 4519 | 4519 | // post taxonomies |
| 4520 | - if ( !empty( $save_post['post_category'] ) ) {
|
|
| 4521 | - wp_set_object_terms( $saved_post_id, $save_post['post_category'], $cat_taxonomy ); |
|
| 4520 | + if (!empty($save_post['post_category'])) {
|
|
| 4521 | + wp_set_object_terms($saved_post_id, $save_post['post_category'], $cat_taxonomy); |
|
| 4522 | 4522 | |
| 4523 | - $post_default_category = isset( $save_post['post_default_category'] ) ? $save_post['post_default_category'] : ''; |
|
| 4523 | + $post_default_category = isset($save_post['post_default_category']) ? $save_post['post_default_category'] : ''; |
|
| 4524 | 4524 | if ($default_category_id) {
|
| 4525 | 4525 | $post_default_category = $default_category_id; |
| 4526 | 4526 | } |
| 4527 | 4527 | $post_cat_ids = geodir_get_post_meta($saved_post_id, $cat_taxonomy); |
| 4528 | 4528 | $save_post['post_category'] = !empty($post_cat_ids) ? explode(",", trim($post_cat_ids, ",")) : $save_post['post_category'];
|
| 4529 | - $post_category_str = !empty($save_post['post_category']) ? implode(",y:#", $save_post['post_category']) . ',y:' : '';
|
|
| 4529 | + $post_category_str = !empty($save_post['post_category']) ? implode(",y:#", $save_post['post_category']).',y:' : '';
|
|
| 4530 | 4530 | |
| 4531 | 4531 | if ($post_category_str != '' && $post_default_category) {
|
| 4532 | - $post_category_str = str_replace($post_default_category . ',y:', $post_default_category . ',y,d:', $post_category_str); |
|
| 4532 | + $post_category_str = str_replace($post_default_category.',y:', $post_default_category.',y,d:', $post_category_str); |
|
| 4533 | 4533 | } |
| 4534 | 4534 | |
| 4535 | 4535 | $post_category_str = $post_category_str != '' ? array($cat_taxonomy => $post_category_str) : ''; |
| 4536 | 4536 | |
| 4537 | - geodir_set_postcat_structure( $saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str ); |
|
| 4537 | + geodir_set_postcat_structure($saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str); |
|
| 4538 | 4538 | } |
| 4539 | - $xtimings['###8.1'] = microtime(true)-$xstart; |
|
| 4540 | - if ( !empty( $save_post['post_tags'] ) ) {
|
|
| 4541 | - wp_set_object_terms( $saved_post_id, $save_post['post_tags'], $tags_taxonomy ); |
|
| 4539 | + $xtimings['###8.1'] = microtime(true) - $xstart; |
|
| 4540 | + if (!empty($save_post['post_tags'])) {
|
|
| 4541 | + wp_set_object_terms($saved_post_id, $save_post['post_tags'], $tags_taxonomy); |
|
| 4542 | 4542 | } |
| 4543 | - $xtimings['###9'] = microtime(true)-$xstart; |
|
| 4543 | + $xtimings['###9'] = microtime(true) - $xstart; |
|
| 4544 | 4544 | // Post images |
| 4545 | - if ( !empty( $post_images ) ) {
|
|
| 4545 | + if (!empty($post_images)) {
|
|
| 4546 | 4546 | $post_images = array_unique($post_images); |
| 4547 | 4547 | |
| 4548 | 4548 | $old_post_images_arr = array(); |
@@ -4550,65 +4550,65 @@ discard block |
||
| 4550 | 4550 | |
| 4551 | 4551 | $order = 1; |
| 4552 | 4552 | |
| 4553 | - $old_post_images = geodir_get_images( $saved_post_id ); |
|
| 4554 | - $xtimings['###9.1'] = microtime(true)-$xstart; |
|
| 4553 | + $old_post_images = geodir_get_images($saved_post_id); |
|
| 4554 | + $xtimings['###9.1'] = microtime(true) - $xstart; |
|
| 4555 | 4555 | if (!empty($old_post_images)) {
|
| 4556 | - foreach( $old_post_images as $old_post_image ) {
|
|
| 4556 | + foreach ($old_post_images as $old_post_image) {
|
|
| 4557 | 4557 | if (!empty($old_post_image) && isset($old_post_image->file) && $old_post_image->file != '') {
|
| 4558 | 4558 | $old_post_images_arr[] = $old_post_image->file; |
| 4559 | 4559 | } |
| 4560 | 4560 | } |
| 4561 | 4561 | } |
| 4562 | 4562 | |
| 4563 | - foreach ( $post_images as $post_image ) {
|
|
| 4564 | - $image_name = basename( $post_image ); |
|
| 4563 | + foreach ($post_images as $post_image) {
|
|
| 4564 | + $image_name = basename($post_image); |
|
| 4565 | 4565 | $saved_post_images_arr[] = $image_name; |
| 4566 | 4566 | |
| 4567 | - if (!empty($old_post_images_arr) && in_array( $image_name, $old_post_images_arr) ) {
|
|
| 4567 | + if (!empty($old_post_images_arr) && in_array($image_name, $old_post_images_arr)) {
|
|
| 4568 | 4568 | continue; // Skip if image already exists. |
| 4569 | 4569 | } |
| 4570 | 4570 | |
| 4571 | - $image_name_parts = explode( '.', $image_name ); |
|
| 4572 | - array_pop( $image_name_parts ); |
|
| 4573 | - $proper_image_name = implode( '.', $image_name_parts ); |
|
| 4574 | - $xtimings['###9.2'] = microtime(true)-$xstart; |
|
| 4575 | - $arr_file_type = wp_check_filetype( $image_name ); |
|
| 4576 | - $xtimings['###9.3'] = microtime(true)-$xstart; |
|
| 4577 | - if ( !empty( $arr_file_type ) ) {
|
|
| 4571 | + $image_name_parts = explode('.', $image_name);
|
|
| 4572 | + array_pop($image_name_parts); |
|
| 4573 | + $proper_image_name = implode('.', $image_name_parts);
|
|
| 4574 | + $xtimings['###9.2'] = microtime(true) - $xstart; |
|
| 4575 | + $arr_file_type = wp_check_filetype($image_name); |
|
| 4576 | + $xtimings['###9.3'] = microtime(true) - $xstart; |
|
| 4577 | + if (!empty($arr_file_type)) {
|
|
| 4578 | 4578 | $uploaded_file_type = $arr_file_type['type']; |
| 4579 | 4579 | |
| 4580 | 4580 | $attachment = array(); |
| 4581 | 4581 | $attachment['post_id'] = $saved_post_id; |
| 4582 | 4582 | $attachment['title'] = $proper_image_name; |
| 4583 | 4583 | $attachment['content'] = ''; |
| 4584 | - $attachment['file'] = $uploads_subdir . '/' . $image_name; |
|
| 4584 | + $attachment['file'] = $uploads_subdir.'/'.$image_name; |
|
| 4585 | 4585 | $attachment['mime_type'] = $uploaded_file_type; |
| 4586 | 4586 | $attachment['menu_order'] = $order; |
| 4587 | 4587 | $attachment['is_featured'] = 0; |
| 4588 | 4588 | |
| 4589 | 4589 | $attachment_set = ''; |
| 4590 | - foreach ( $attachment as $key => $val ) {
|
|
| 4591 | - if ( $val != '' ) {
|
|
| 4592 | - $attachment_set .= $key . " = '" . $val . "', "; |
|
| 4590 | + foreach ($attachment as $key => $val) {
|
|
| 4591 | + if ($val != '') {
|
|
| 4592 | + $attachment_set .= $key." = '".$val."', "; |
|
| 4593 | 4593 | } |
| 4594 | 4594 | } |
| 4595 | - $attachment_set = trim( $attachment_set, ", " ); |
|
| 4595 | + $attachment_set = trim($attachment_set, ", "); |
|
| 4596 | 4596 | |
| 4597 | 4597 | // Add new attachment |
| 4598 | - $xtimings['###9.4'] = microtime(true)-$xstart; |
|
| 4599 | - $wpdb->query( "INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set ); |
|
| 4600 | - $xtimings['###9.5'] = microtime(true)-$xstart; |
|
| 4598 | + $xtimings['###9.4'] = microtime(true) - $xstart; |
|
| 4599 | + $wpdb->query("INSERT INTO ".GEODIR_ATTACHMENT_TABLE." SET ".$attachment_set);
|
|
| 4600 | + $xtimings['###9.5'] = microtime(true) - $xstart; |
|
| 4601 | 4601 | $order++; |
| 4602 | 4602 | } |
| 4603 | 4603 | } |
| 4604 | 4604 | |
| 4605 | - $saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/" . implode("' AND file NOT LIKE '%/", $saved_post_images_arr) . "' )" : '';
|
|
| 4605 | + $saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/".implode("' AND file NOT LIKE '%/", $saved_post_images_arr)."' )" : '';
|
|
| 4606 | 4606 | // Remove previous attachment |
| 4607 | - $wpdb->query( "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = " . (int)$saved_post_id . " " . $saved_post_images_sql ); |
|
| 4608 | - $xtimings['###9.6'] = microtime(true)-$xstart; |
|
| 4609 | - if ( !empty( $saved_post_images_arr ) ) {
|
|
| 4607 | + $wpdb->query("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id = ".(int) $saved_post_id." ".$saved_post_images_sql);
|
|
| 4608 | + $xtimings['###9.6'] = microtime(true) - $xstart; |
|
| 4609 | + if (!empty($saved_post_images_arr)) {
|
|
| 4610 | 4610 | geodir_set_wp_featured_image($saved_post_id); |
| 4611 | - $xtimings['###9.7'] = microtime(true)-$xstart; |
|
| 4611 | + $xtimings['###9.7'] = microtime(true) - $xstart; |
|
| 4612 | 4612 | /* |
| 4613 | 4613 | $menu_order = 1; |
| 4614 | 4614 | |
@@ -4624,14 +4624,14 @@ discard block |
||
| 4624 | 4624 | }*/ |
| 4625 | 4625 | } |
| 4626 | 4626 | |
| 4627 | - if ( $order > 1 ) {
|
|
| 4627 | + if ($order > 1) {
|
|
| 4628 | 4628 | $images++; |
| 4629 | 4629 | } |
| 4630 | 4630 | } |
| 4631 | - $xtimings['###10'] = microtime(true)-$xstart; |
|
| 4631 | + $xtimings['###10'] = microtime(true) - $xstart; |
|
| 4632 | 4632 | /** This action is documented in geodirectory-functions/post-functions.php */ |
| 4633 | - do_action( 'geodir_after_save_listing', $saved_post_id, $gd_post ); |
|
| 4634 | - $xtimings['###11'] = microtime(true)-$xstart; |
|
| 4633 | + do_action('geodir_after_save_listing', $saved_post_id, $gd_post);
|
|
| 4634 | + $xtimings['###11'] = microtime(true) - $xstart; |
|
| 4635 | 4635 | if (isset($is_featured)) {
|
| 4636 | 4636 | geodir_save_post_meta($saved_post_id, 'is_featured', $is_featured); |
| 4637 | 4637 | } |
@@ -4641,7 +4641,7 @@ discard block |
||
| 4641 | 4641 | if (isset($gd_post['expire_date'])) {
|
| 4642 | 4642 | geodir_save_post_meta($saved_post_id, 'expire_date', $gd_post['expire_date']); |
| 4643 | 4643 | } |
| 4644 | - $xtimings['###12'] = microtime(true)-$xstart; |
|
| 4644 | + $xtimings['###12'] = microtime(true) - $xstart; |
|
| 4645 | 4645 | } |
| 4646 | 4646 | |
| 4647 | 4647 | // WPML |
@@ -4654,11 +4654,11 @@ discard block |
||
| 4654 | 4654 | } |
| 4655 | 4655 | |
| 4656 | 4656 | //undo some stuff to make the import quicker |
| 4657 | - wp_defer_term_counting( false ); |
|
| 4658 | - wp_defer_comment_counting( false ); |
|
| 4659 | - $wpdb->query( 'COMMIT;' ); |
|
| 4660 | - $wpdb->query( 'SET autocommit = 1;' ); |
|
| 4661 | - $xtimings['###13'] = microtime(true)-$xstart; |
|
| 4657 | + wp_defer_term_counting(false); |
|
| 4658 | + wp_defer_comment_counting(false); |
|
| 4659 | + $wpdb->query('COMMIT;');
|
|
| 4660 | + $wpdb->query('SET autocommit = 1;');
|
|
| 4661 | + $xtimings['###13'] = microtime(true) - $xstart; |
|
| 4662 | 4662 | $json = array(); |
| 4663 | 4663 | $json['processed'] = $processed_actual; |
| 4664 | 4664 | $json['created'] = $created; |
@@ -4667,13 +4667,13 @@ discard block |
||
| 4667 | 4667 | $json['invalid'] = $invalid; |
| 4668 | 4668 | $json['invalid_addr'] = $invalid_addr; |
| 4669 | 4669 | $json['images'] = $images; |
| 4670 | - $json['timing'] = microtime(true)-$xstart; |
|
| 4670 | + $json['timing'] = microtime(true) - $xstart; |
|
| 4671 | 4671 | $json['timings'] = $xtimings; |
| 4672 | 4672 | |
| 4673 | 4673 | |
| 4674 | - wp_send_json( $json ); |
|
| 4674 | + wp_send_json($json); |
|
| 4675 | 4675 | exit; |
| 4676 | - } else if ( $task == 'import_loc' ) {
|
|
| 4676 | + } else if ($task == 'import_loc') {
|
|
| 4677 | 4677 | global $gd_post_types; |
| 4678 | 4678 | $gd_post_types = $post_types; |
| 4679 | 4679 | |
@@ -4682,82 +4682,82 @@ discard block |
||
| 4682 | 4682 | |
| 4683 | 4683 | if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
|
| 4684 | 4684 | $json['error'] = __('The file you are uploading is not valid. There are problems with the file columns.', 'geodirectory');
|
| 4685 | - wp_send_json( $json ); |
|
| 4685 | + wp_send_json($json); |
|
| 4686 | 4686 | } |
| 4687 | 4687 | |
| 4688 | 4688 | $gd_error_log = __('GD IMPORT LOCATIONS [ROW %d]:', 'geodirectory');
|
| 4689 | - $gd_error_location = __( 'Could not be saved due to blank/invalid address(city, region, country, latitude, longitude)', 'geodirectory' ); |
|
| 4689 | + $gd_error_location = __('Could not be saved due to blank/invalid address(city, region, country, latitude, longitude)', 'geodirectory');
|
|
| 4690 | 4690 | for ($i = 1; $i <= $limit; $i++) {
|
| 4691 | 4691 | $index = $processed + $i; |
| 4692 | 4692 | |
| 4693 | 4693 | if (isset($file[$index])) {
|
| 4694 | 4694 | $row = $file[$index]; |
| 4695 | - $row = array_map( 'trim', $row ); |
|
| 4695 | + $row = array_map('trim', $row);
|
|
| 4696 | 4696 | $data = array(); |
| 4697 | 4697 | |
| 4698 | - foreach ($columns as $c => $column ) {
|
|
| 4698 | + foreach ($columns as $c => $column) {
|
|
| 4699 | 4699 | if (in_array($column, array('location_id', 'latitude', 'longitude', 'city', 'city_slug', 'region', 'country', 'city_meta_title', 'city_meta_desc', 'city_desc', 'region_meta_title', 'region_meta_desc', 'region_desc', 'country_meta_title', 'country_meta_desc', 'country_desc'))) {
|
| 4700 | 4700 | $data[$column] = $row[$c]; |
| 4701 | 4701 | } |
| 4702 | 4702 | } |
| 4703 | 4703 | |
| 4704 | - if ( empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude']) ) {
|
|
| 4704 | + if (empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude'])) {
|
|
| 4705 | 4705 | $invalid++; |
| 4706 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location ); |
|
| 4706 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location); |
|
| 4707 | 4707 | continue; |
| 4708 | 4708 | } |
| 4709 | 4709 | |
| 4710 | 4710 | $data['location_id'] = isset($data['location_id']) ? absint($data['location_id']) : 0; |
| 4711 | 4711 | |
| 4712 | - if ( $import_choice == 'update' ) {
|
|
| 4713 | - if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
|
|
| 4714 | - if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
|
|
| 4712 | + if ($import_choice == 'update') {
|
|
| 4713 | + if ((int) $data['location_id'] > 0 && $location = geodir_get_location_by_id('', (int) $data['location_id'])) {
|
|
| 4714 | + if ($location_id = geodir_location_update_city($data, true, $location)) {
|
|
| 4715 | 4715 | $updated++; |
| 4716 | 4716 | } else {
|
| 4717 | 4717 | $invalid++; |
| 4718 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location ); |
|
| 4718 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location); |
|
| 4719 | 4719 | } |
| 4720 | - } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
|
|
| 4721 | - $data['location_id'] = (int)$location->location_id; |
|
| 4720 | + } else if (!empty($data['city_slug']) && $location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug']))) {
|
|
| 4721 | + $data['location_id'] = (int) $location->location_id; |
|
| 4722 | 4722 | |
| 4723 | - if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region'] ) ) ) {
|
|
| 4724 | - $data['location_id'] = (int)$location->location_id; |
|
| 4725 | - } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'region' => $data['region'] ) ) ) {
|
|
| 4726 | - $data['location_id'] = (int)$location->location_id; |
|
| 4727 | - } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'] ) ) ) {
|
|
| 4728 | - $data['location_id'] = (int)$location->location_id; |
|
| 4723 | + if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region']))) {
|
|
| 4724 | + $data['location_id'] = (int) $location->location_id; |
|
| 4725 | + } else if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'region' => $data['region']))) {
|
|
| 4726 | + $data['location_id'] = (int) $location->location_id; |
|
| 4727 | + } else if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'country' => $data['country']))) {
|
|
| 4728 | + $data['location_id'] = (int) $location->location_id; |
|
| 4729 | 4729 | } |
| 4730 | 4730 | |
| 4731 | - if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
|
|
| 4731 | + if ($location_id = geodir_location_update_city($data, true, $location)) {
|
|
| 4732 | 4732 | $updated++; |
| 4733 | 4733 | } else {
|
| 4734 | 4734 | $invalid++; |
| 4735 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location ); |
|
| 4735 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location); |
|
| 4736 | 4736 | } |
| 4737 | 4737 | } else {
|
| 4738 | - if ( $location_id = geodir_location_insert_city( $data, true ) ) {
|
|
| 4738 | + if ($location_id = geodir_location_insert_city($data, true)) {
|
|
| 4739 | 4739 | $created++; |
| 4740 | 4740 | } else {
|
| 4741 | 4741 | $invalid++; |
| 4742 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location ); |
|
| 4742 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location); |
|
| 4743 | 4743 | } |
| 4744 | 4744 | } |
| 4745 | - } elseif ( $import_choice == 'skip' ) {
|
|
| 4746 | - if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
|
|
| 4745 | + } elseif ($import_choice == 'skip') {
|
|
| 4746 | + if ((int) $data['location_id'] > 0 && $location = geodir_get_location_by_id('', (int) $data['location_id'])) {
|
|
| 4747 | 4747 | $skipped++; |
| 4748 | - } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
|
|
| 4748 | + } else if (!empty($data['city_slug']) && $location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug']))) {
|
|
| 4749 | 4749 | $skipped++; |
| 4750 | 4750 | } else {
|
| 4751 | - if ( $location_id = geodir_location_insert_city( $data, true ) ) {
|
|
| 4751 | + if ($location_id = geodir_location_insert_city($data, true)) {
|
|
| 4752 | 4752 | $created++; |
| 4753 | 4753 | } else {
|
| 4754 | 4754 | $invalid++; |
| 4755 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location ); |
|
| 4755 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location); |
|
| 4756 | 4756 | } |
| 4757 | 4757 | } |
| 4758 | 4758 | } else {
|
| 4759 | 4759 | $invalid++; |
| 4760 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location ); |
|
| 4760 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location); |
|
| 4761 | 4761 | } |
| 4762 | 4762 | } |
| 4763 | 4763 | } |
@@ -4771,24 +4771,24 @@ discard block |
||
| 4771 | 4771 | $json['invalid'] = $invalid; |
| 4772 | 4772 | $json['images'] = $images; |
| 4773 | 4773 | |
| 4774 | - wp_send_json( $json ); |
|
| 4775 | - } else if ( $task == 'import_hood' ) {
|
|
| 4774 | + wp_send_json($json); |
|
| 4775 | + } else if ($task == 'import_hood') {
|
|
| 4776 | 4776 | if (!empty($file)) {
|
| 4777 | 4777 | $columns = isset($file[0]) ? $file[0] : NULL; |
| 4778 | 4778 | |
| 4779 | 4779 | if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
|
| 4780 | 4780 | $json['error'] = __('The file you are uploading is not valid. There are problems with the file columns.', 'geodirectory');
|
| 4781 | - wp_send_json( $json ); |
|
| 4781 | + wp_send_json($json); |
|
| 4782 | 4782 | } |
| 4783 | 4783 | |
| 4784 | 4784 | $gd_error_log = __('GD IMPORT NEIGHBOURHOODS [ROW %d]:', 'geodirectory');
|
| 4785 | - $gd_error_hood = __( 'Could not be saved due to invalid neighbourhood data(name, latitude, longitude) or invalid location data(either location_id or city/region/country is empty)', 'geodirectory' ); |
|
| 4785 | + $gd_error_hood = __('Could not be saved due to invalid neighbourhood data(name, latitude, longitude) or invalid location data(either location_id or city/region/country is empty)', 'geodirectory');
|
|
| 4786 | 4786 | for ($i = 1; $i <= $limit; $i++) {
|
| 4787 | 4787 | $index = $processed + $i; |
| 4788 | 4788 | |
| 4789 | 4789 | if (isset($file[$index])) {
|
| 4790 | 4790 | $row = $file[$index]; |
| 4791 | - $row = array_map( 'trim', $row ); |
|
| 4791 | + $row = array_map('trim', $row);
|
|
| 4792 | 4792 | $data = array(); |
| 4793 | 4793 | |
| 4794 | 4794 | foreach ($columns as $c => $column) {
|
@@ -4799,20 +4799,20 @@ discard block |
||
| 4799 | 4799 | |
| 4800 | 4800 | if (empty($data['neighbourhood_name']) || empty($data['latitude']) || empty($data['longitude'])) {
|
| 4801 | 4801 | $invalid++; |
| 4802 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 4802 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood); |
|
| 4803 | 4803 | continue; |
| 4804 | 4804 | } |
| 4805 | 4805 | |
| 4806 | 4806 | $location_info = array(); |
| 4807 | - if (!empty($data['location_id']) && (int)$data['location_id'] > 0) {
|
|
| 4808 | - $location_info = geodir_get_location_by_id('', (int)$data['location_id']);
|
|
| 4807 | + if (!empty($data['location_id']) && (int) $data['location_id'] > 0) {
|
|
| 4808 | + $location_info = geodir_get_location_by_id('', (int) $data['location_id']);
|
|
| 4809 | 4809 | } else if (!empty($data['city']) && !empty($data['region']) && !empty($data['country'])) {
|
| 4810 | 4810 | $location_info = geodir_get_location_by_slug('city', array('fields' => 'location_id', 'city' => $data['city'], 'country' => $data['country'], 'region' => $data['region']));
|
| 4811 | 4811 | } |
| 4812 | 4812 | |
| 4813 | 4813 | if (empty($location_info)) {
|
| 4814 | 4814 | $invalid++; |
| 4815 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 4815 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood); |
|
| 4816 | 4816 | continue; |
| 4817 | 4817 | } |
| 4818 | 4818 | |
@@ -4827,35 +4827,35 @@ discard block |
||
| 4827 | 4827 | $hood_data['hood_longitude'] = $data['longitude']; |
| 4828 | 4828 | $hood_data['hood_location_id'] = $location_id; |
| 4829 | 4829 | |
| 4830 | - if ( $import_choice == 'update' ) {
|
|
| 4831 | - if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
|
|
| 4832 | - $hood_data['hood_id'] = (int)$data['neighbourhood_id']; |
|
| 4830 | + if ($import_choice == 'update') {
|
|
| 4831 | + if ((int) $data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int) $data['neighbourhood_id']))) {
|
|
| 4832 | + $hood_data['hood_id'] = (int) $data['neighbourhood_id']; |
|
| 4833 | 4833 | |
| 4834 | 4834 | if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
|
| 4835 | 4835 | $updated++; |
| 4836 | 4836 | } else {
|
| 4837 | 4837 | $invalid++; |
| 4838 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 4838 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood); |
|
| 4839 | 4839 | } |
| 4840 | 4840 | } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
|
| 4841 | - $hood_data['hood_id'] = (int)$neighbourhood->hood_id; |
|
| 4841 | + $hood_data['hood_id'] = (int) $neighbourhood->hood_id; |
|
| 4842 | 4842 | |
| 4843 | 4843 | if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
|
| 4844 | 4844 | $updated++; |
| 4845 | 4845 | } else {
|
| 4846 | 4846 | $invalid++; |
| 4847 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 4847 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood); |
|
| 4848 | 4848 | } |
| 4849 | 4849 | } else {
|
| 4850 | 4850 | if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
|
| 4851 | 4851 | $created++; |
| 4852 | 4852 | } else {
|
| 4853 | 4853 | $invalid++; |
| 4854 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 4854 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood); |
|
| 4855 | 4855 | } |
| 4856 | 4856 | } |
| 4857 | - } elseif ( $import_choice == 'skip' ) {
|
|
| 4858 | - if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
|
|
| 4857 | + } elseif ($import_choice == 'skip') {
|
|
| 4858 | + if ((int) $data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int) $data['neighbourhood_id']))) {
|
|
| 4859 | 4859 | $skipped++; |
| 4860 | 4860 | } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
|
| 4861 | 4861 | $skipped++; |
@@ -4865,12 +4865,12 @@ discard block |
||
| 4865 | 4865 | $created++; |
| 4866 | 4866 | } else {
|
| 4867 | 4867 | $invalid++; |
| 4868 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 4868 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood); |
|
| 4869 | 4869 | } |
| 4870 | 4870 | } |
| 4871 | 4871 | } else {
|
| 4872 | 4872 | $invalid++; |
| 4873 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 4873 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood); |
|
| 4874 | 4874 | } |
| 4875 | 4875 | } |
| 4876 | 4876 | } |
@@ -4884,7 +4884,7 @@ discard block |
||
| 4884 | 4884 | $json['invalid'] = $invalid; |
| 4885 | 4885 | $json['images'] = $images; |
| 4886 | 4886 | |
| 4887 | - wp_send_json( $json ); |
|
| 4887 | + wp_send_json($json); |
|
| 4888 | 4888 | } |
| 4889 | 4889 | } |
| 4890 | 4890 | break; |
@@ -4928,29 +4928,29 @@ discard block |
||
| 4928 | 4928 | * } |
| 4929 | 4929 | * @return int|bool Term id when success, false when fail. |
| 4930 | 4930 | */ |
| 4931 | -function geodir_imex_insert_term( $taxonomy, $term_data ) {
|
|
| 4932 | - if ( empty( $taxonomy ) || empty( $term_data ) ) {
|
|
| 4931 | +function geodir_imex_insert_term($taxonomy, $term_data) {
|
|
| 4932 | + if (empty($taxonomy) || empty($term_data)) {
|
|
| 4933 | 4933 | return false; |
| 4934 | 4934 | } |
| 4935 | 4935 | |
| 4936 | - $term = isset( $term_data['name'] ) && !empty( $term_data['name'] ) ? $term_data['name'] : ''; |
|
| 4936 | + $term = isset($term_data['name']) && !empty($term_data['name']) ? $term_data['name'] : ''; |
|
| 4937 | 4937 | $args = array(); |
| 4938 | - $args['description'] = isset( $term_data['description'] ) ? $term_data['description'] : ''; |
|
| 4939 | - $args['slug'] = isset( $term_data['slug'] ) ? $term_data['slug'] : ''; |
|
| 4940 | - $args['parent'] = isset( $term_data['parent'] ) ? (int)$term_data['parent'] : ''; |
|
| 4938 | + $args['description'] = isset($term_data['description']) ? $term_data['description'] : ''; |
|
| 4939 | + $args['slug'] = isset($term_data['slug']) ? $term_data['slug'] : ''; |
|
| 4940 | + $args['parent'] = isset($term_data['parent']) ? (int) $term_data['parent'] : ''; |
|
| 4941 | 4941 | |
| 4942 | - if ( ( !empty( $args['slug'] ) && term_exists( $args['slug'], $taxonomy ) ) || empty( $args['slug'] ) ) {
|
|
| 4943 | - $term_args = array_merge( $term_data, $args ); |
|
| 4944 | - $defaults = array( 'alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => ''); |
|
| 4945 | - $term_args = wp_parse_args( $term_args, $defaults ); |
|
| 4946 | - $term_args = sanitize_term( $term_args, $taxonomy, 'db' ); |
|
| 4947 | - $args['slug'] = wp_unique_term_slug( $args['slug'], (object)$term_args ); |
|
| 4942 | + if ((!empty($args['slug']) && term_exists($args['slug'], $taxonomy)) || empty($args['slug'])) {
|
|
| 4943 | + $term_args = array_merge($term_data, $args); |
|
| 4944 | + $defaults = array('alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '');
|
|
| 4945 | + $term_args = wp_parse_args($term_args, $defaults); |
|
| 4946 | + $term_args = sanitize_term($term_args, $taxonomy, 'db'); |
|
| 4947 | + $args['slug'] = wp_unique_term_slug($args['slug'], (object) $term_args); |
|
| 4948 | 4948 | } |
| 4949 | 4949 | |
| 4950 | - if( !empty( $term ) ) {
|
|
| 4951 | - $result = wp_insert_term( $term, $taxonomy, $args ); |
|
| 4952 | - if( !is_wp_error( $result ) ) {
|
|
| 4953 | - return isset( $result['term_id'] ) ? $result['term_id'] : 0; |
|
| 4950 | + if (!empty($term)) {
|
|
| 4951 | + $result = wp_insert_term($term, $taxonomy, $args); |
|
| 4952 | + if (!is_wp_error($result)) {
|
|
| 4953 | + return isset($result['term_id']) ? $result['term_id'] : 0; |
|
| 4954 | 4954 | } |
| 4955 | 4955 | } |
| 4956 | 4956 | |
@@ -4980,36 +4980,36 @@ discard block |
||
| 4980 | 4980 | * } |
| 4981 | 4981 | * @return int|bool Term id when success, false when fail. |
| 4982 | 4982 | */ |
| 4983 | -function geodir_imex_update_term( $taxonomy, $term_data ) {
|
|
| 4984 | - if ( empty( $taxonomy ) || empty( $term_data ) ) {
|
|
| 4983 | +function geodir_imex_update_term($taxonomy, $term_data) {
|
|
| 4984 | + if (empty($taxonomy) || empty($term_data)) {
|
|
| 4985 | 4985 | return false; |
| 4986 | 4986 | } |
| 4987 | 4987 | |
| 4988 | - $term_id = isset( $term_data['term_id'] ) && !empty( $term_data['term_id'] ) ? $term_data['term_id'] : 0; |
|
| 4988 | + $term_id = isset($term_data['term_id']) && !empty($term_data['term_id']) ? $term_data['term_id'] : 0; |
|
| 4989 | 4989 | |
| 4990 | 4990 | $args = array(); |
| 4991 | - $args['description'] = isset( $term_data['description'] ) ? $term_data['description'] : ''; |
|
| 4992 | - $args['slug'] = isset( $term_data['slug'] ) ? $term_data['slug'] : ''; |
|
| 4993 | - $args['parent'] = isset( $term_data['parent'] ) ? (int)$term_data['parent'] : ''; |
|
| 4991 | + $args['description'] = isset($term_data['description']) ? $term_data['description'] : ''; |
|
| 4992 | + $args['slug'] = isset($term_data['slug']) ? $term_data['slug'] : ''; |
|
| 4993 | + $args['parent'] = isset($term_data['parent']) ? (int) $term_data['parent'] : ''; |
|
| 4994 | 4994 | |
| 4995 | - if ( $term_id > 0 && $term_info = (array)get_term( $term_id, $taxonomy ) ) {
|
|
| 4995 | + if ($term_id > 0 && $term_info = (array) get_term($term_id, $taxonomy)) {
|
|
| 4996 | 4996 | $term_data['term_id'] = $term_info['term_id']; |
| 4997 | 4997 | |
| 4998 | - $result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data ); |
|
| 4998 | + $result = wp_update_term($term_data['term_id'], $taxonomy, $term_data); |
|
| 4999 | 4999 | |
| 5000 | - if( !is_wp_error( $result ) ) {
|
|
| 5001 | - return isset( $result['term_id'] ) ? $result['term_id'] : 0; |
|
| 5000 | + if (!is_wp_error($result)) {
|
|
| 5001 | + return isset($result['term_id']) ? $result['term_id'] : 0; |
|
| 5002 | 5002 | } |
| 5003 | - } else if ( $term_data['slug'] != '' && $term_info = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
|
|
| 5003 | + } else if ($term_data['slug'] != '' && $term_info = (array) term_exists($term_data['slug'], $taxonomy)) {
|
|
| 5004 | 5004 | $term_data['term_id'] = $term_info['term_id']; |
| 5005 | 5005 | |
| 5006 | - $result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data ); |
|
| 5006 | + $result = wp_update_term($term_data['term_id'], $taxonomy, $term_data); |
|
| 5007 | 5007 | |
| 5008 | - if( !is_wp_error( $result ) ) {
|
|
| 5009 | - return isset( $result['term_id'] ) ? $result['term_id'] : 0; |
|
| 5008 | + if (!is_wp_error($result)) {
|
|
| 5009 | + return isset($result['term_id']) ? $result['term_id'] : 0; |
|
| 5010 | 5010 | } |
| 5011 | 5011 | } else {
|
| 5012 | - return geodir_imex_insert_term( $taxonomy, $term_data ); |
|
| 5012 | + return geodir_imex_insert_term($taxonomy, $term_data); |
|
| 5013 | 5013 | } |
| 5014 | 5014 | |
| 5015 | 5015 | return false; |
@@ -5028,20 +5028,20 @@ discard block |
||
| 5028 | 5028 | * @param string $post_type Post type. |
| 5029 | 5029 | * @return int Posts count. |
| 5030 | 5030 | */ |
| 5031 | -function geodir_get_posts_count( $post_type ) {
|
|
| 5031 | +function geodir_get_posts_count($post_type) {
|
|
| 5032 | 5032 | global $wpdb, $plugin_prefix; |
| 5033 | 5033 | |
| 5034 | - if ( !post_type_exists( $post_type ) ) {
|
|
| 5034 | + if (!post_type_exists($post_type)) {
|
|
| 5035 | 5035 | return 0; |
| 5036 | 5036 | } |
| 5037 | 5037 | |
| 5038 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 5038 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 5039 | 5039 | |
| 5040 | 5040 | // Skip listing with statuses trash, auto-draft etc... |
| 5041 | 5041 | $skip_statuses = geodir_imex_export_skip_statuses(); |
| 5042 | 5042 | $where_statuses = ''; |
| 5043 | - if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
|
|
| 5044 | - $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
|
|
| 5043 | + if (!empty($skip_statuses) && is_array($skip_statuses)) {
|
|
| 5044 | + $where_statuses = "AND `".$wpdb->posts."`.`post_status` NOT IN('".implode("','", $skip_statuses)."')";
|
|
| 5045 | 5045 | } |
| 5046 | 5046 | |
| 5047 | 5047 | /** |
@@ -5052,11 +5052,11 @@ discard block |
||
| 5052 | 5052 | * |
| 5053 | 5053 | * @param string $where SQL where clause part. |
| 5054 | 5054 | */ |
| 5055 | - $where_statuses = apply_filters( 'geodir_get_posts_count', $where_statuses, $post_type ); |
|
| 5055 | + $where_statuses = apply_filters('geodir_get_posts_count', $where_statuses, $post_type);
|
|
| 5056 | 5056 | |
| 5057 | - $query = $wpdb->prepare( "SELECT COUNT({$wpdb->posts}.ID) FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s " . $where_statuses, $post_type );
|
|
| 5057 | + $query = $wpdb->prepare("SELECT COUNT({$wpdb->posts}.ID) FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s ".$where_statuses, $post_type);
|
|
| 5058 | 5058 | |
| 5059 | - $posts_count = (int)$wpdb->get_var( $query ); |
|
| 5059 | + $posts_count = (int) $wpdb->get_var($query); |
|
| 5060 | 5060 | |
| 5061 | 5061 | /** |
| 5062 | 5062 | * Modify returned post counts for the current post type. |
@@ -5067,7 +5067,7 @@ discard block |
||
| 5067 | 5067 | * @param int $posts_count Post counts. |
| 5068 | 5068 | * @param string $post_type Post type. |
| 5069 | 5069 | */ |
| 5070 | - $posts_count = apply_filters( 'geodir_imex_count_posts', $posts_count, $post_type ); |
|
| 5070 | + $posts_count = apply_filters('geodir_imex_count_posts', $posts_count, $post_type);
|
|
| 5071 | 5071 | |
| 5072 | 5072 | return $posts_count; |
| 5073 | 5073 | } |
@@ -5089,19 +5089,19 @@ discard block |
||
| 5089 | 5089 | * @param int $page_no Page number. Default 0. |
| 5090 | 5090 | * @return array Array of posts data. |
| 5091 | 5091 | */ |
| 5092 | -function geodir_imex_get_posts( $post_type, $per_page = 0, $page_no = 0 ) {
|
|
| 5092 | +function geodir_imex_get_posts($post_type, $per_page = 0, $page_no = 0) {
|
|
| 5093 | 5093 | global $wp_filesystem; |
| 5094 | 5094 | |
| 5095 | - $posts = geodir_get_export_posts( $post_type, $per_page, $page_no ); |
|
| 5095 | + $posts = geodir_get_export_posts($post_type, $per_page, $page_no); |
|
| 5096 | 5096 | |
| 5097 | 5097 | $csv_rows = array(); |
| 5098 | 5098 | |
| 5099 | - if ( !empty( $posts ) ) {
|
|
| 5100 | - $is_payment_plugin = is_plugin_active( 'geodir_payment_manager/geodir_payment_manager.php' ); |
|
| 5099 | + if (!empty($posts)) {
|
|
| 5100 | + $is_payment_plugin = is_plugin_active('geodir_payment_manager/geodir_payment_manager.php');
|
|
| 5101 | 5101 | $location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
|
| 5102 | - $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true; |
|
| 5102 | + $location_allowed = function_exists('geodir_cpt_no_location') && geodir_cpt_no_location($post_type) ? false : true;
|
|
| 5103 | 5103 | $neighbourhood_active = $location_manager && $location_allowed && get_option('location_neighbourhoods') ? true : false;
|
| 5104 | - $is_claim_active = is_plugin_active( 'geodir_claim_listing/geodir_claim_listing.php' ) && get_option('geodir_claim_enable') === 'yes' ? true : false;
|
|
| 5104 | + $is_claim_active = is_plugin_active('geodir_claim_listing/geodir_claim_listing.php') && get_option('geodir_claim_enable') === 'yes' ? true : false;
|
|
| 5105 | 5105 | $is_events_active = function_exists('geodir_event_plugin_activated') ? true : false;
|
| 5106 | 5106 | $is_custom_posts_active = function_exists('geodir_custom_post_type_plugin_activated') ? true : false;
|
| 5107 | 5107 | |
@@ -5116,7 +5116,7 @@ discard block |
||
| 5116 | 5116 | $csv_row[] = 'default_category'; |
| 5117 | 5117 | $csv_row[] = 'post_tags'; |
| 5118 | 5118 | $csv_row[] = 'post_type'; |
| 5119 | - if ( $post_type == 'gd_event' ) {
|
|
| 5119 | + if ($post_type == 'gd_event') {
|
|
| 5120 | 5120 | $csv_row[] = 'event_date'; |
| 5121 | 5121 | $csv_row[] = 'event_enddate'; |
| 5122 | 5122 | $csv_row[] = 'starttime'; |
@@ -5168,25 +5168,25 @@ discard block |
||
| 5168 | 5168 | $csv_row[] = 'geodir_video'; |
| 5169 | 5169 | $csv_row[] = 'geodir_special_offers'; |
| 5170 | 5170 | if ($is_events_active || $is_custom_posts_active) {
|
| 5171 | - $csv_row[] = !empty($post_ypes[$post_type]['linkable_to']) ? 'linked_' . $post_ypes[$post_type]['linkable_to'] . '_ID' : 'linked_cpt_ID'; |
|
| 5171 | + $csv_row[] = !empty($post_ypes[$post_type]['linkable_to']) ? 'linked_'.$post_ypes[$post_type]['linkable_to'].'_ID' : 'linked_cpt_ID'; |
|
| 5172 | 5172 | } |
| 5173 | 5173 | // WPML |
| 5174 | - $is_wpml = geodir_wpml_is_post_type_translated( $post_type ); |
|
| 5174 | + $is_wpml = geodir_wpml_is_post_type_translated($post_type); |
|
| 5175 | 5175 | if ($is_wpml) {
|
| 5176 | 5176 | $csv_row[] = 'language'; |
| 5177 | 5177 | $csv_row[] = 'original_post_id'; |
| 5178 | 5178 | } |
| 5179 | 5179 | // WPML |
| 5180 | 5180 | |
| 5181 | - $custom_fields = geodir_imex_get_custom_fields( $post_type ); |
|
| 5182 | - if ( !empty( $custom_fields ) ) {
|
|
| 5183 | - foreach ( $custom_fields as $custom_field ) {
|
|
| 5181 | + $custom_fields = geodir_imex_get_custom_fields($post_type); |
|
| 5182 | + if (!empty($custom_fields)) {
|
|
| 5183 | + foreach ($custom_fields as $custom_field) {
|
|
| 5184 | 5184 | $csv_row[] = $custom_field->htmlvar_name; |
| 5185 | 5185 | } |
| 5186 | 5186 | } |
| 5187 | 5187 | |
| 5188 | 5188 | // Export franchise fields |
| 5189 | - $is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false; |
|
| 5189 | + $is_franchise_active = is_plugin_active('geodir_franchise/geodir_franchise.php') && geodir_franchise_enabled($post_type) ? true : false;
|
|
| 5190 | 5190 | if ($is_franchise_active) {
|
| 5191 | 5191 | $csv_row[] = 'gd_is_franchise'; |
| 5192 | 5192 | $csv_row[] = 'gd_franchise_lock'; |
@@ -5207,28 +5207,28 @@ discard block |
||
| 5207 | 5207 | $csv_rows[] = $csv_row; |
| 5208 | 5208 | |
| 5209 | 5209 | $images_count = 5; |
| 5210 | - $xx=0; |
|
| 5211 | - foreach ( $posts as $post ) {$xx++;
|
|
| 5210 | + $xx = 0; |
|
| 5211 | + foreach ($posts as $post) {$xx++;
|
|
| 5212 | 5212 | $post_id = $post['ID']; |
| 5213 | 5213 | |
| 5214 | - $gd_post_info = geodir_get_post_info( $post_id ); |
|
| 5215 | - $post_info = (array)$gd_post_info; |
|
| 5214 | + $gd_post_info = geodir_get_post_info($post_id); |
|
| 5215 | + $post_info = (array) $gd_post_info; |
|
| 5216 | 5216 | |
| 5217 | - $taxonomy_category = $post_type . 'category'; |
|
| 5218 | - $taxonomy_tags = $post_type . '_tags'; |
|
| 5217 | + $taxonomy_category = $post_type.'category'; |
|
| 5218 | + $taxonomy_tags = $post_type.'_tags'; |
|
| 5219 | 5219 | |
| 5220 | 5220 | $post_category = ''; |
| 5221 | 5221 | $default_category_id = $gd_post_info->default_category; |
| 5222 | 5222 | $default_category = ''; |
| 5223 | 5223 | $post_tags = ''; |
| 5224 | - $terms = wp_get_post_terms( $post_id, array( $taxonomy_category, $taxonomy_tags ) ); |
|
| 5224 | + $terms = wp_get_post_terms($post_id, array($taxonomy_category, $taxonomy_tags)); |
|
| 5225 | 5225 | |
| 5226 | - if ( !empty( $terms ) && !is_wp_error( $terms ) ) {
|
|
| 5226 | + if (!empty($terms) && !is_wp_error($terms)) {
|
|
| 5227 | 5227 | $post_category = array(); |
| 5228 | 5228 | $post_tags = array(); |
| 5229 | 5229 | |
| 5230 | - foreach ( $terms as $term ) {
|
|
| 5231 | - if ( $term->taxonomy == $taxonomy_category ) {
|
|
| 5230 | + foreach ($terms as $term) {
|
|
| 5231 | + if ($term->taxonomy == $taxonomy_category) {
|
|
| 5232 | 5232 | $post_category[] = $term->name; |
| 5233 | 5233 | |
| 5234 | 5234 | if ($default_category_id == $term->term_id) {
|
@@ -5236,7 +5236,7 @@ discard block |
||
| 5236 | 5236 | } |
| 5237 | 5237 | } |
| 5238 | 5238 | |
| 5239 | - if ( $term->taxonomy == $taxonomy_tags ) {
|
|
| 5239 | + if ($term->taxonomy == $taxonomy_tags) {
|
|
| 5240 | 5240 | $post_tags[] = $term->name; |
| 5241 | 5241 | } |
| 5242 | 5242 | } |
@@ -5244,47 +5244,47 @@ discard block |
||
| 5244 | 5244 | if (empty($default_category) && !empty($post_category)) {
|
| 5245 | 5245 | $default_category = $post_category[0]; // Set first one as default category. |
| 5246 | 5246 | } |
| 5247 | - $post_category = !empty( $post_category ) ? implode( ',', $post_category ) : ''; |
|
| 5248 | - $post_tags = !empty( $post_tags ) ? implode( ',', $post_tags ) : ''; |
|
| 5247 | + $post_category = !empty($post_category) ? implode(',', $post_category) : '';
|
|
| 5248 | + $post_tags = !empty($post_tags) ? implode(',', $post_tags) : '';
|
|
| 5249 | 5249 | } |
| 5250 | 5250 | |
| 5251 | 5251 | // Franchise data |
| 5252 | - if ($is_franchise_active && isset($post_info['franchise']) && (int)$post_info['franchise'] > 0 && geodir_franchise_check((int)$post_info['franchise'])) {
|
|
| 5252 | + if ($is_franchise_active && isset($post_info['franchise']) && (int) $post_info['franchise'] > 0 && geodir_franchise_check((int) $post_info['franchise'])) {
|
|
| 5253 | 5253 | $franchise_id = $post_info['franchise']; |
| 5254 | 5254 | $gd_franchise_info = geodir_get_post_info($franchise_id); |
| 5255 | 5255 | |
| 5256 | 5256 | if (geodir_franchise_pkg_is_active($gd_franchise_info)) {
|
| 5257 | - $franchise_info = (array)$gd_franchise_info; |
|
| 5257 | + $franchise_info = (array) $gd_franchise_info; |
|
| 5258 | 5258 | $locked_fields = geodir_franchise_get_locked_fields($franchise_id, true); |
| 5259 | 5259 | |
| 5260 | 5260 | if (!empty($locked_fields)) {
|
| 5261 | - foreach( $locked_fields as $locked_field) {
|
|
| 5261 | + foreach ($locked_fields as $locked_field) {
|
|
| 5262 | 5262 | if (isset($post_info[$locked_field]) && isset($franchise_info[$locked_field])) {
|
| 5263 | 5263 | $post_info[$locked_field] = $franchise_info[$locked_field]; |
| 5264 | 5264 | } |
| 5265 | 5265 | |
| 5266 | 5266 | if (in_array($taxonomy_category, $locked_fields) || in_array('post_tags', $locked_fields)) {
|
| 5267 | - $franchise_terms = wp_get_post_terms( $franchise_id, array( $taxonomy_category, $taxonomy_tags ) ); |
|
| 5267 | + $franchise_terms = wp_get_post_terms($franchise_id, array($taxonomy_category, $taxonomy_tags)); |
|
| 5268 | 5268 | |
| 5269 | - if ( !empty( $franchise_terms ) && !is_wp_error( $franchise_terms ) ) {
|
|
| 5269 | + if (!empty($franchise_terms) && !is_wp_error($franchise_terms)) {
|
|
| 5270 | 5270 | $franchise_post_category = array(); |
| 5271 | 5271 | $franchise_post_tags = array(); |
| 5272 | 5272 | |
| 5273 | - foreach ( $franchise_terms as $franchise_term ) {
|
|
| 5274 | - if ( $franchise_term->taxonomy == $taxonomy_category ) {
|
|
| 5273 | + foreach ($franchise_terms as $franchise_term) {
|
|
| 5274 | + if ($franchise_term->taxonomy == $taxonomy_category) {
|
|
| 5275 | 5275 | $franchise_post_category[] = $franchise_term->name; |
| 5276 | 5276 | } |
| 5277 | 5277 | |
| 5278 | - if ( $franchise_term->taxonomy == $taxonomy_tags ) {
|
|
| 5278 | + if ($franchise_term->taxonomy == $taxonomy_tags) {
|
|
| 5279 | 5279 | $franchise_post_tags[] = $franchise_term->name; |
| 5280 | 5280 | } |
| 5281 | 5281 | } |
| 5282 | 5282 | |
| 5283 | 5283 | if (in_array($taxonomy_category, $locked_fields)) {
|
| 5284 | - $post_category = !empty( $franchise_post_category ) ? implode( ',', $franchise_post_category ) : ''; |
|
| 5284 | + $post_category = !empty($franchise_post_category) ? implode(',', $franchise_post_category) : '';
|
|
| 5285 | 5285 | } |
| 5286 | 5286 | if (in_array('post_tags', $locked_fields)) {
|
| 5287 | - $post_tags = !empty( $franchise_post_tags ) ? implode( ',', $franchise_post_tags ) : ''; |
|
| 5287 | + $post_tags = !empty($franchise_post_tags) ? implode(',', $franchise_post_tags) : '';
|
|
| 5288 | 5288 | } |
| 5289 | 5289 | } |
| 5290 | 5290 | } |
@@ -5293,18 +5293,18 @@ discard block |
||
| 5293 | 5293 | } |
| 5294 | 5294 | } |
| 5295 | 5295 | |
| 5296 | - $post_images = geodir_get_images( $post_id ); |
|
| 5296 | + $post_images = geodir_get_images($post_id); |
|
| 5297 | 5297 | $current_images = array(); |
| 5298 | - if ( !empty( $post_images ) ) {
|
|
| 5299 | - foreach ( $post_images as $post_image ) {
|
|
| 5300 | - $post_image = (array)$post_image; |
|
| 5301 | - $image = !empty( $post_image ) && isset( $post_image['path'] ) && $wp_filesystem->is_file( $post_image['path'] ) && $wp_filesystem->exists( $post_image['path'] ) ? $post_image['src'] : ''; |
|
| 5302 | - if ( $image ) {
|
|
| 5298 | + if (!empty($post_images)) {
|
|
| 5299 | + foreach ($post_images as $post_image) {
|
|
| 5300 | + $post_image = (array) $post_image; |
|
| 5301 | + $image = !empty($post_image) && isset($post_image['path']) && $wp_filesystem->is_file($post_image['path']) && $wp_filesystem->exists($post_image['path']) ? $post_image['src'] : ''; |
|
| 5302 | + if ($image) {
|
|
| 5303 | 5303 | $current_images[] = $image; |
| 5304 | 5304 | } |
| 5305 | 5305 | } |
| 5306 | 5306 | |
| 5307 | - $images_count = max( $images_count, count( $current_images ) ); |
|
| 5307 | + $images_count = max($images_count, count($current_images)); |
|
| 5308 | 5308 | } |
| 5309 | 5309 | |
| 5310 | 5310 | $csv_row = array(); |
@@ -5316,7 +5316,7 @@ discard block |
||
| 5316 | 5316 | $csv_row[] = $default_category; // default_category |
| 5317 | 5317 | $csv_row[] = $post_tags; // post_tags |
| 5318 | 5318 | $csv_row[] = $post_type; // post_type |
| 5319 | - if ( $post_type == 'gd_event' ) {
|
|
| 5319 | + if ($post_type == 'gd_event') {
|
|
| 5320 | 5320 | $event_data = geodir_imex_get_event_data($post, $gd_post_info); |
| 5321 | 5321 | $csv_row[] = $event_data['event_date']; // event_date |
| 5322 | 5322 | $csv_row[] = $event_data['event_enddate']; // enddate |
@@ -5337,12 +5337,12 @@ discard block |
||
| 5337 | 5337 | $csv_row[] = $event_data['recurring_end_date']; // repeat_end |
| 5338 | 5338 | } |
| 5339 | 5339 | $csv_row[] = $post_info['post_status']; // post_status |
| 5340 | - $csv_row[] = (int)$post_info['is_featured'] == 1 ? 1 : ''; // is_featured |
|
| 5340 | + $csv_row[] = (int) $post_info['is_featured'] == 1 ? 1 : ''; // is_featured |
|
| 5341 | 5341 | if ($is_claim_active) {
|
| 5342 | - $csv_row[] = !empty($post_info['claimed']) && (int)$post_info['claimed'] == 1 ? 1 : ''; // claimed |
|
| 5342 | + $csv_row[] = !empty($post_info['claimed']) && (int) $post_info['claimed'] == 1 ? 1 : ''; // claimed |
|
| 5343 | 5343 | } |
| 5344 | 5344 | if ($is_payment_plugin) {
|
| 5345 | - $csv_row[] = (int)$post_info['package_id']; // package_id |
|
| 5345 | + $csv_row[] = (int) $post_info['package_id']; // package_id |
|
| 5346 | 5346 | $csv_row[] = $post_info['alive_days'] !== '' ? absint($post_info['alive_days']) : ''; // alive_days |
| 5347 | 5347 | $csv_row[] = $post_info['expire_date'] != '' && geodir_strtolower($post_info['expire_date']) != 'never' ? date_i18n('Y-m-d', strtotime($post_info['expire_date'])) : 'Never'; // expire_date
|
| 5348 | 5348 | } |
@@ -5378,18 +5378,18 @@ discard block |
||
| 5378 | 5378 | $csv_row[] = stripslashes($post_info['geodir_video']); // geodir_video |
| 5379 | 5379 | $csv_row[] = stripslashes($post_info['geodir_special_offers']); // geodir_special_offers |
| 5380 | 5380 | if ($is_events_active || $is_custom_posts_active) {
|
| 5381 | - $csv_row[] = !empty($post_info['geodir_link_business']) ? (int)$post_info['geodir_link_business'] : ''; // linked business |
|
| 5381 | + $csv_row[] = !empty($post_info['geodir_link_business']) ? (int) $post_info['geodir_link_business'] : ''; // linked business |
|
| 5382 | 5382 | } |
| 5383 | 5383 | // WPML |
| 5384 | 5384 | if ($is_wpml) {
|
| 5385 | - $csv_row[] = geodir_get_language_for_element( $post_id, 'post_' . $post_type ); |
|
| 5386 | - $csv_row[] = geodir_imex_original_post_id( $post_id, 'post_' . $post_type ); |
|
| 5385 | + $csv_row[] = geodir_get_language_for_element($post_id, 'post_'.$post_type); |
|
| 5386 | + $csv_row[] = geodir_imex_original_post_id($post_id, 'post_'.$post_type); |
|
| 5387 | 5387 | } |
| 5388 | 5388 | // WPML |
| 5389 | 5389 | |
| 5390 | - if ( !empty( $custom_fields ) ) {
|
|
| 5391 | - foreach ( $custom_fields as $custom_field ) {
|
|
| 5392 | - $csv_row[] = isset( $post_info[$custom_field->htmlvar_name] ) ? $post_info[$custom_field->htmlvar_name] : ''; |
|
| 5390 | + if (!empty($custom_fields)) {
|
|
| 5391 | + foreach ($custom_fields as $custom_field) {
|
|
| 5392 | + $csv_row[] = isset($post_info[$custom_field->htmlvar_name]) ? $post_info[$custom_field->htmlvar_name] : ''; |
|
| 5393 | 5393 | } |
| 5394 | 5394 | } |
| 5395 | 5395 | |
@@ -5400,15 +5400,15 @@ discard block |
||
| 5400 | 5400 | $franchise = ''; |
| 5401 | 5401 | |
| 5402 | 5402 | if (geodir_franchise_pkg_is_active($gd_post_info)) {
|
| 5403 | - $gd_is_franchise = (int)get_post_meta( $post_id, 'gd_is_franchise', true ); |
|
| 5404 | - $locaked_fields = $gd_is_franchise ? get_post_meta( $post_id, 'gd_franchise_lock', true ) : ''; |
|
| 5403 | + $gd_is_franchise = (int) get_post_meta($post_id, 'gd_is_franchise', true); |
|
| 5404 | + $locaked_fields = $gd_is_franchise ? get_post_meta($post_id, 'gd_franchise_lock', true) : ''; |
|
| 5405 | 5405 | $locaked_fields = (is_array($locaked_fields) && !empty($locaked_fields) ? implode(",", $locaked_fields) : '');
|
| 5406 | - $franchise = !$gd_is_franchise && isset($post_info['franchise']) && (int)$post_info['franchise'] > 0 ? (int)$post_info['franchise'] : 0; // franchise id |
|
| 5406 | + $franchise = !$gd_is_franchise && isset($post_info['franchise']) && (int) $post_info['franchise'] > 0 ? (int) $post_info['franchise'] : 0; // franchise id |
|
| 5407 | 5407 | } |
| 5408 | 5408 | |
| 5409 | - $csv_row[] = (int)$gd_is_franchise; // gd_is_franchise |
|
| 5409 | + $csv_row[] = (int) $gd_is_franchise; // gd_is_franchise |
|
| 5410 | 5410 | $csv_row[] = $locaked_fields; // gd_franchise_lock fields |
| 5411 | - $csv_row[] = (int)$franchise; // franchise id |
|
| 5411 | + $csv_row[] = (int) $franchise; // franchise id |
|
| 5412 | 5412 | } |
| 5413 | 5413 | |
| 5414 | 5414 | /** |
@@ -5422,15 +5422,15 @@ discard block |
||
| 5422 | 5422 | */ |
| 5423 | 5423 | $csv_row = apply_filters('geodir_export_listing_csv_column_values', $csv_row, $post_info);
|
| 5424 | 5424 | |
| 5425 | - for ( $c = 0; $c < $images_count; $c++ ) {
|
|
| 5426 | - $csv_row[] = isset( $current_images[$c] ) ? $current_images[$c] : ''; // IMAGE |
|
| 5425 | + for ($c = 0; $c < $images_count; $c++) {
|
|
| 5426 | + $csv_row[] = isset($current_images[$c]) ? $current_images[$c] : ''; // IMAGE |
|
| 5427 | 5427 | } |
| 5428 | 5428 | |
| 5429 | 5429 | $csv_rows[] = $csv_row; |
| 5430 | 5430 | |
| 5431 | 5431 | } |
| 5432 | 5432 | |
| 5433 | - for ( $c = 0; $c < $images_count; $c++ ) {
|
|
| 5433 | + for ($c = 0; $c < $images_count; $c++) {
|
|
| 5434 | 5434 | $csv_rows[0][] = 'IMAGE'; |
| 5435 | 5435 | } |
| 5436 | 5436 | } |
@@ -5452,30 +5452,30 @@ discard block |
||
| 5452 | 5452 | * @param int $page_no Page number. Default 0. |
| 5453 | 5453 | * @return array Array of posts data. |
| 5454 | 5454 | */ |
| 5455 | -function geodir_get_export_posts( $post_type, $per_page = 0, $page_no = 0 ) {
|
|
| 5455 | +function geodir_get_export_posts($post_type, $per_page = 0, $page_no = 0) {
|
|
| 5456 | 5456 | global $wpdb, $plugin_prefix; |
| 5457 | 5457 | |
| 5458 | - if ( ! post_type_exists( $post_type ) ) |
|
| 5458 | + if (!post_type_exists($post_type)) |
|
| 5459 | 5459 | return new stdClass; |
| 5460 | 5460 | |
| 5461 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 5461 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 5462 | 5462 | |
| 5463 | 5463 | $limit = ''; |
| 5464 | - if ( $per_page > 0 && $page_no > 0 ) {
|
|
| 5465 | - $offset = ( $page_no - 1 ) * $per_page; |
|
| 5464 | + if ($per_page > 0 && $page_no > 0) {
|
|
| 5465 | + $offset = ($page_no - 1) * $per_page; |
|
| 5466 | 5466 | |
| 5467 | - if ( $offset > 0 ) {
|
|
| 5468 | - $limit = " LIMIT " . $offset . "," . $per_page; |
|
| 5467 | + if ($offset > 0) {
|
|
| 5468 | + $limit = " LIMIT ".$offset.",".$per_page; |
|
| 5469 | 5469 | } else {
|
| 5470 | - $limit = " LIMIT " . $per_page; |
|
| 5470 | + $limit = " LIMIT ".$per_page; |
|
| 5471 | 5471 | } |
| 5472 | 5472 | } |
| 5473 | 5473 | |
| 5474 | 5474 | // Skip listing with statuses trash, auto-draft etc... |
| 5475 | 5475 | $skip_statuses = geodir_imex_export_skip_statuses(); |
| 5476 | 5476 | $where_statuses = ''; |
| 5477 | - if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
|
|
| 5478 | - $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
|
|
| 5477 | + if (!empty($skip_statuses) && is_array($skip_statuses)) {
|
|
| 5478 | + $where_statuses = "AND `".$wpdb->posts."`.`post_status` NOT IN('".implode("','", $skip_statuses)."')";
|
|
| 5479 | 5479 | } |
| 5480 | 5480 | |
| 5481 | 5481 | /** |
@@ -5486,9 +5486,9 @@ discard block |
||
| 5486 | 5486 | * |
| 5487 | 5487 | * @param string $where SQL where clause part. |
| 5488 | 5488 | */ |
| 5489 | - $where_statuses = apply_filters( 'geodir_get_export_posts', $where_statuses, $post_type ); |
|
| 5489 | + $where_statuses = apply_filters('geodir_get_export_posts', $where_statuses, $post_type);
|
|
| 5490 | 5490 | |
| 5491 | - $query = $wpdb->prepare( "SELECT {$wpdb->posts}.ID FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s " . $where_statuses . " ORDER BY {$wpdb->posts}.ID ASC" . $limit, $post_type );
|
|
| 5491 | + $query = $wpdb->prepare("SELECT {$wpdb->posts}.ID FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s ".$where_statuses." ORDER BY {$wpdb->posts}.ID ASC".$limit, $post_type);
|
|
| 5492 | 5492 | /** |
| 5493 | 5493 | * Modify returned posts SQL query for the current post type. |
| 5494 | 5494 | * |
@@ -5498,8 +5498,8 @@ discard block |
||
| 5498 | 5498 | * @param int $query The SQL query. |
| 5499 | 5499 | * @param string $post_type Post type. |
| 5500 | 5500 | */ |
| 5501 | - $query = apply_filters( 'geodir_imex_export_posts_query', $query, $post_type ); |
|
| 5502 | - $results = (array)$wpdb->get_results( $query, ARRAY_A ); |
|
| 5501 | + $query = apply_filters('geodir_imex_export_posts_query', $query, $post_type);
|
|
| 5502 | + $results = (array) $wpdb->get_results($query, ARRAY_A); |
|
| 5503 | 5503 | |
| 5504 | 5504 | /** |
| 5505 | 5505 | * Modify returned post results for the current post type. |
@@ -5510,7 +5510,7 @@ discard block |
||
| 5510 | 5510 | * @param object $results An object containing all post ids. |
| 5511 | 5511 | * @param string $post_type Post type. |
| 5512 | 5512 | */ |
| 5513 | - return apply_filters( 'geodir_export_posts', $results, $post_type ); |
|
| 5513 | + return apply_filters('geodir_export_posts', $results, $post_type);
|
|
| 5514 | 5514 | } |
| 5515 | 5515 | |
| 5516 | 5516 | /** |
@@ -5528,24 +5528,24 @@ discard block |
||
| 5528 | 5528 | * @param string $post_type Post type. |
| 5529 | 5529 | * @return string The SQL query. |
| 5530 | 5530 | */ |
| 5531 | -function geodir_imex_get_events_query( $query, $post_type ) {
|
|
| 5532 | - if ( $post_type == 'gd_event' ) {
|
|
| 5531 | +function geodir_imex_get_events_query($query, $post_type) {
|
|
| 5532 | + if ($post_type == 'gd_event') {
|
|
| 5533 | 5533 | global $wpdb, $plugin_prefix; |
| 5534 | 5534 | |
| 5535 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 5535 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 5536 | 5536 | $schedule_table = EVENT_SCHEDULE; |
| 5537 | 5537 | |
| 5538 | 5538 | // Skip listing with statuses trash, auto-draft etc... |
| 5539 | 5539 | $skip_statuses = geodir_imex_export_skip_statuses(); |
| 5540 | 5540 | $where_statuses = ''; |
| 5541 | - if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
|
|
| 5542 | - $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
|
|
| 5541 | + if (!empty($skip_statuses) && is_array($skip_statuses)) {
|
|
| 5542 | + $where_statuses = "AND `".$wpdb->posts."`.`post_status` NOT IN('".implode("','", $skip_statuses)."')";
|
|
| 5543 | 5543 | } |
| 5544 | 5544 | |
| 5545 | 5545 | /** This action is documented in geodirectory-functions/geodirectory-admin/admin_functions.php */ |
| 5546 | - $where_statuses = apply_filters( 'geodir_get_export_posts', $where_statuses, $post_type ); |
|
| 5546 | + $where_statuses = apply_filters('geodir_get_export_posts', $where_statuses, $post_type);
|
|
| 5547 | 5547 | |
| 5548 | - $query = $wpdb->prepare( "SELECT {$wpdb->posts}.ID, {$schedule_table}.event_date, {$schedule_table}.event_enddate AS enddate, {$schedule_table}.event_starttime AS starttime, {$schedule_table}.event_endtime AS endtime FROM {$wpdb->posts} INNER JOIN {$table} ON ({$table}.post_id = {$wpdb->posts}.ID) INNER JOIN {$schedule_table} ON ({$schedule_table}.event_id = {$wpdb->posts}.ID) WHERE {$wpdb->posts}.post_type = %s " . $where_statuses . " GROUP BY {$table}.post_id ORDER BY {$wpdb->posts}.ID ASC, {$schedule_table}.schedule_id ASC", $post_type );
|
|
| 5548 | + $query = $wpdb->prepare("SELECT {$wpdb->posts}.ID, {$schedule_table}.event_date, {$schedule_table}.event_enddate AS enddate, {$schedule_table}.event_starttime AS starttime, {$schedule_table}.event_endtime AS endtime FROM {$wpdb->posts} INNER JOIN {$table} ON ({$table}.post_id = {$wpdb->posts}.ID) INNER JOIN {$schedule_table} ON ({$schedule_table}.event_id = {$wpdb->posts}.ID) WHERE {$wpdb->posts}.post_type = %s ".$where_statuses." GROUP BY {$table}.post_id ORDER BY {$wpdb->posts}.ID ASC, {$schedule_table}.schedule_id ASC", $post_type);
|
|
| 5549 | 5549 | } |
| 5550 | 5550 | |
| 5551 | 5551 | return $query; |
@@ -5569,35 +5569,35 @@ discard block |
||
| 5569 | 5569 | * @param string $post_type Post type. |
| 5570 | 5570 | * @return int Total terms count. |
| 5571 | 5571 | */ |
| 5572 | -function geodir_get_terms_count( $post_type ) {
|
|
| 5573 | - $args = array( 'hide_empty' => 0 ); |
|
| 5572 | +function geodir_get_terms_count($post_type) {
|
|
| 5573 | + $args = array('hide_empty' => 0);
|
|
| 5574 | 5574 | |
| 5575 | - remove_all_filters( 'get_terms' ); |
|
| 5575 | + remove_all_filters('get_terms');
|
|
| 5576 | 5576 | |
| 5577 | - $taxonomy = $post_type . 'category'; |
|
| 5577 | + $taxonomy = $post_type.'category'; |
|
| 5578 | 5578 | |
| 5579 | 5579 | // WPML |
| 5580 | 5580 | $is_wpml = geodir_is_wpml(); |
| 5581 | 5581 | $active_lang = 'all'; |
| 5582 | - if ( $is_wpml ) {
|
|
| 5582 | + if ($is_wpml) {
|
|
| 5583 | 5583 | global $sitepress; |
| 5584 | 5584 | $active_lang = $sitepress->get_current_language(); |
| 5585 | 5585 | |
| 5586 | - if ( $active_lang != 'all' ) {
|
|
| 5587 | - $sitepress->switch_lang( 'all', true ); |
|
| 5586 | + if ($active_lang != 'all') {
|
|
| 5587 | + $sitepress->switch_lang('all', true);
|
|
| 5588 | 5588 | } |
| 5589 | 5589 | } |
| 5590 | 5590 | // WPML |
| 5591 | 5591 | |
| 5592 | - $count_terms = wp_count_terms( $taxonomy, $args ); |
|
| 5592 | + $count_terms = wp_count_terms($taxonomy, $args); |
|
| 5593 | 5593 | |
| 5594 | 5594 | // WPML |
| 5595 | - if ( $is_wpml && $active_lang !== 'all' ) {
|
|
| 5595 | + if ($is_wpml && $active_lang !== 'all') {
|
|
| 5596 | 5596 | global $sitepress; |
| 5597 | - $sitepress->switch_lang( $active_lang, true ); |
|
| 5597 | + $sitepress->switch_lang($active_lang, true); |
|
| 5598 | 5598 | } |
| 5599 | 5599 | // WPML |
| 5600 | - $count_terms = !is_wp_error( $count_terms ) ? $count_terms : 0; |
|
| 5600 | + $count_terms = !is_wp_error($count_terms) ? $count_terms : 0; |
|
| 5601 | 5601 | |
| 5602 | 5602 | return $count_terms; |
| 5603 | 5603 | } |
@@ -5614,23 +5614,23 @@ discard block |
||
| 5614 | 5614 | * @param int $page_no Page number. Default 0. |
| 5615 | 5615 | * @return array Array of terms data. |
| 5616 | 5616 | */ |
| 5617 | -function geodir_imex_get_terms( $post_type, $per_page = 0, $page_no = 0 ) {
|
|
| 5618 | - $args = array( 'hide_empty' => 0, 'orderby' => 'id' ); |
|
| 5617 | +function geodir_imex_get_terms($post_type, $per_page = 0, $page_no = 0) {
|
|
| 5618 | + $args = array('hide_empty' => 0, 'orderby' => 'id');
|
|
| 5619 | 5619 | |
| 5620 | - remove_all_filters( 'get_terms' ); |
|
| 5620 | + remove_all_filters('get_terms');
|
|
| 5621 | 5621 | |
| 5622 | - $taxonomy = $post_type . 'category'; |
|
| 5622 | + $taxonomy = $post_type.'category'; |
|
| 5623 | 5623 | |
| 5624 | - if ( $per_page > 0 && $page_no > 0 ) {
|
|
| 5625 | - $args['offset'] = ( $page_no - 1 ) * $per_page; |
|
| 5624 | + if ($per_page > 0 && $page_no > 0) {
|
|
| 5625 | + $args['offset'] = ($page_no - 1) * $per_page; |
|
| 5626 | 5626 | $args['number'] = $per_page; |
| 5627 | 5627 | } |
| 5628 | 5628 | |
| 5629 | - $terms = get_terms( $taxonomy, $args ); |
|
| 5629 | + $terms = get_terms($taxonomy, $args); |
|
| 5630 | 5630 | |
| 5631 | 5631 | $csv_rows = array(); |
| 5632 | 5632 | |
| 5633 | - if ( !empty( $terms ) ) {
|
|
| 5633 | + if (!empty($terms)) {
|
|
| 5634 | 5634 | $csv_row = array(); |
| 5635 | 5635 | $csv_row[] = 'cat_id'; |
| 5636 | 5636 | $csv_row[] = 'cat_name'; |
@@ -5639,7 +5639,7 @@ discard block |
||
| 5639 | 5639 | $csv_row[] = 'cat_parent'; |
| 5640 | 5640 | $csv_row[] = 'cat_schema'; |
| 5641 | 5641 | // WPML |
| 5642 | - $is_wpml = geodir_wpml_is_taxonomy_translated( $taxonomy ); |
|
| 5642 | + $is_wpml = geodir_wpml_is_taxonomy_translated($taxonomy); |
|
| 5643 | 5643 | if ($is_wpml) {
|
| 5644 | 5644 | $csv_row[] = 'cat_language'; |
| 5645 | 5645 | $csv_row[] = 'cat_id_original'; |
@@ -5652,16 +5652,16 @@ discard block |
||
| 5652 | 5652 | |
| 5653 | 5653 | $csv_rows[] = $csv_row; |
| 5654 | 5654 | |
| 5655 | - foreach ( $terms as $term ) {
|
|
| 5656 | - $cat_icon = geodir_get_tax_meta( $term->term_id, 'ct_cat_icon', false, $post_type ); |
|
| 5657 | - $cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : ''; |
|
| 5655 | + foreach ($terms as $term) {
|
|
| 5656 | + $cat_icon = geodir_get_tax_meta($term->term_id, 'ct_cat_icon', false, $post_type); |
|
| 5657 | + $cat_icon = !empty($cat_icon) && isset($cat_icon['src']) ? $cat_icon['src'] : ''; |
|
| 5658 | 5658 | |
| 5659 | - $cat_image = geodir_get_default_catimage( $term->term_id, $post_type ); |
|
| 5660 | - $cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : ''; |
|
| 5659 | + $cat_image = geodir_get_default_catimage($term->term_id, $post_type); |
|
| 5660 | + $cat_image = !empty($cat_image) && isset($cat_image['src']) ? $cat_image['src'] : ''; |
|
| 5661 | 5661 | |
| 5662 | 5662 | $cat_parent = ''; |
| 5663 | - if (isset($term->parent) && (int)$term->parent > 0 && term_exists((int)$term->parent, $taxonomy)) {
|
|
| 5664 | - $parent_term = (array)get_term_by( 'id', (int)$term->parent, $taxonomy ); |
|
| 5663 | + if (isset($term->parent) && (int) $term->parent > 0 && term_exists((int) $term->parent, $taxonomy)) {
|
|
| 5664 | + $parent_term = (array) get_term_by('id', (int) $term->parent, $taxonomy);
|
|
| 5665 | 5665 | $cat_parent = !empty($parent_term) && isset($parent_term['name']) ? $parent_term['name'] : ''; |
| 5666 | 5666 | } |
| 5667 | 5667 | |
@@ -5671,15 +5671,15 @@ discard block |
||
| 5671 | 5671 | $csv_row[] = $term->slug; |
| 5672 | 5672 | $csv_row[] = $post_type; |
| 5673 | 5673 | $csv_row[] = $cat_parent; |
| 5674 | - $csv_row[] = geodir_get_tax_meta( $term->term_id, 'ct_cat_schema', false, $post_type ); |
|
| 5674 | + $csv_row[] = geodir_get_tax_meta($term->term_id, 'ct_cat_schema', false, $post_type); |
|
| 5675 | 5675 | // WPML |
| 5676 | 5676 | if ($is_wpml) {
|
| 5677 | - $csv_row[] = geodir_get_language_for_element( $term->term_id, 'tax_' . $taxonomy ); |
|
| 5678 | - $csv_row[] = geodir_imex_original_post_id( $term->term_id, 'tax_' . $taxonomy ); |
|
| 5677 | + $csv_row[] = geodir_get_language_for_element($term->term_id, 'tax_'.$taxonomy); |
|
| 5678 | + $csv_row[] = geodir_imex_original_post_id($term->term_id, 'tax_'.$taxonomy); |
|
| 5679 | 5679 | } |
| 5680 | 5680 | // WPML |
| 5681 | 5681 | $csv_row[] = $term->description; |
| 5682 | - $csv_row[] = geodir_get_tax_meta( $term->term_id, 'ct_cat_top_desc', false, $post_type ); |
|
| 5682 | + $csv_row[] = geodir_get_tax_meta($term->term_id, 'ct_cat_top_desc', false, $post_type); |
|
| 5683 | 5683 | $csv_row[] = $cat_image; |
| 5684 | 5684 | $csv_row[] = $cat_icon; |
| 5685 | 5685 | |
@@ -5698,10 +5698,10 @@ discard block |
||
| 5698 | 5698 | * @param bool $relative True for relative path & False for absolute path. |
| 5699 | 5699 | * @return string Path to the cache directory. |
| 5700 | 5700 | */ |
| 5701 | -function geodir_path_import_export( $relative = true ) {
|
|
| 5701 | +function geodir_path_import_export($relative = true) {
|
|
| 5702 | 5702 | $upload_dir = wp_upload_dir(); |
| 5703 | 5703 | |
| 5704 | - return $relative ? $upload_dir['baseurl'] . '/cache' : $upload_dir['basedir'] . '/cache'; |
|
| 5704 | + return $relative ? $upload_dir['baseurl'].'/cache' : $upload_dir['basedir'].'/cache'; |
|
| 5705 | 5705 | } |
| 5706 | 5706 | |
| 5707 | 5707 | /** |
@@ -5717,8 +5717,8 @@ discard block |
||
| 5717 | 5717 | * @param bool $clear If true then it overwrite data otherwise add rows at the end of file. |
| 5718 | 5718 | * @return bool true if success otherwise false. |
| 5719 | 5719 | */ |
| 5720 | -function geodir_save_csv_data( $file_path, $csv_data = array(), $clear = true ) {
|
|
| 5721 | - if ( empty( $csv_data ) ) {
|
|
| 5720 | +function geodir_save_csv_data($file_path, $csv_data = array(), $clear = true) {
|
|
| 5721 | + if (empty($csv_data)) {
|
|
| 5722 | 5722 | return false; |
| 5723 | 5723 | } |
| 5724 | 5724 | |
@@ -5726,17 +5726,17 @@ discard block |
||
| 5726 | 5726 | |
| 5727 | 5727 | $mode = $clear ? 'w+' : 'a+'; |
| 5728 | 5728 | |
| 5729 | - if ( function_exists( 'fputcsv' ) ) {
|
|
| 5730 | - $file = fopen( $file_path, $mode ); |
|
| 5731 | - foreach( $csv_data as $csv_row ) {
|
|
| 5729 | + if (function_exists('fputcsv')) {
|
|
| 5730 | + $file = fopen($file_path, $mode); |
|
| 5731 | + foreach ($csv_data as $csv_row) {
|
|
| 5732 | 5732 | //$csv_row = array_map( 'utf8_decode', $csv_row ); |
| 5733 | - $write_successful = fputcsv( $file, $csv_row, ",", $enclosure = '"' ); |
|
| 5733 | + $write_successful = fputcsv($file, $csv_row, ",", $enclosure = '"'); |
|
| 5734 | 5734 | } |
| 5735 | - fclose( $file ); |
|
| 5735 | + fclose($file); |
|
| 5736 | 5736 | } else {
|
| 5737 | - foreach( $csv_data as $csv_row ) {
|
|
| 5737 | + foreach ($csv_data as $csv_row) {
|
|
| 5738 | 5738 | //$csv_row = array_map( 'utf8_decode', $csv_row ); |
| 5739 | - $wp_filesystem->put_contents( $file_path, $csv_row ); |
|
| 5739 | + $wp_filesystem->put_contents($file_path, $csv_row); |
|
| 5740 | 5740 | } |
| 5741 | 5741 | } |
| 5742 | 5742 | |
@@ -5754,14 +5754,14 @@ discard block |
||
| 5754 | 5754 | * @param string $file Full path to file. |
| 5755 | 5755 | * @return int No of file rows. |
| 5756 | 5756 | */ |
| 5757 | -function geodir_import_export_line_count( $file ) {
|
|
| 5757 | +function geodir_import_export_line_count($file) {
|
|
| 5758 | 5758 | global $wp_filesystem; |
| 5759 | 5759 | |
| 5760 | - if ( $wp_filesystem->is_file( $file ) && $wp_filesystem->exists( $file ) ) {
|
|
| 5761 | - $contents = $wp_filesystem->get_contents_array( $file ); |
|
| 5760 | + if ($wp_filesystem->is_file($file) && $wp_filesystem->exists($file)) {
|
|
| 5761 | + $contents = $wp_filesystem->get_contents_array($file); |
|
| 5762 | 5762 | |
| 5763 | - if ( !empty( $contents ) && is_array( $contents ) ) {
|
|
| 5764 | - return count( $contents ) - 1; |
|
| 5763 | + if (!empty($contents) && is_array($contents)) {
|
|
| 5764 | + return count($contents) - 1; |
|
| 5765 | 5765 | } |
| 5766 | 5766 | } |
| 5767 | 5767 | |
@@ -5778,11 +5778,11 @@ discard block |
||
| 5778 | 5778 | * @param string $post_type The post type. |
| 5779 | 5779 | * @return object Queried object. |
| 5780 | 5780 | */ |
| 5781 | -function geodir_imex_get_custom_fields( $post_type ) {
|
|
| 5781 | +function geodir_imex_get_custom_fields($post_type) {
|
|
| 5782 | 5782 | global $wpdb; |
| 5783 | 5783 | |
| 5784 | - $sql = $wpdb->prepare("SELECT htmlvar_name FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND is_active='1' AND is_admin!='1' AND field_type != 'fieldset' AND htmlvar_name != '' ORDER BY id ASC", array( $post_type ) );
|
|
| 5785 | - $rows = $wpdb->get_results( $sql ); |
|
| 5784 | + $sql = $wpdb->prepare("SELECT htmlvar_name FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE post_type=%s AND is_active='1' AND is_admin!='1' AND field_type != 'fieldset' AND htmlvar_name != '' ORDER BY id ASC", array($post_type));
|
|
| 5785 | + $rows = $wpdb->get_results($sql); |
|
| 5786 | 5786 | |
| 5787 | 5787 | return $rows; |
| 5788 | 5788 | } |
@@ -5798,10 +5798,10 @@ discard block |
||
| 5798 | 5798 | * @return array Event data array. |
| 5799 | 5799 | */ |
| 5800 | 5800 | function geodir_imex_get_event_data($post, $gd_post_info) {
|
| 5801 | - $event_date = isset( $post['event_date'] ) && $post['event_date'] != '' && $post['event_date'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $post['event_date'] ) ) : ''; |
|
| 5801 | + $event_date = isset($post['event_date']) && $post['event_date'] != '' && $post['event_date'] != '0000-00-00 00:00:00' ? date_i18n('d/m/Y', strtotime($post['event_date'])) : '';
|
|
| 5802 | 5802 | $event_enddate = $event_date; |
| 5803 | - $starttime = isset( $post['starttime'] ) && $post['starttime'] != '' && $post['starttime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $post['starttime'] ) ) : ''; |
|
| 5804 | - $endtime = isset( $post['endtime'] ) && $post['endtime'] != '' && $post['endtime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $post['endtime'] ) ) : ''; |
|
| 5803 | + $starttime = isset($post['starttime']) && $post['starttime'] != '' && $post['starttime'] != '00:00:00' ? date_i18n('H:i', strtotime($post['starttime'])) : '';
|
|
| 5804 | + $endtime = isset($post['endtime']) && $post['endtime'] != '' && $post['endtime'] != '00:00:00' ? date_i18n('H:i', strtotime($post['endtime'])) : '';
|
|
| 5805 | 5805 | |
| 5806 | 5806 | $is_recurring_event = ''; |
| 5807 | 5807 | $event_duration_days = ''; |
@@ -5818,15 +5818,15 @@ discard block |
||
| 5818 | 5818 | |
| 5819 | 5819 | $recurring_data = isset($gd_post_info->recurring_dates) ? maybe_unserialize($gd_post_info->recurring_dates) : array(); |
| 5820 | 5820 | if (!empty($recurring_data)) {
|
| 5821 | - $event_date = isset( $recurring_data['event_start'] ) && $recurring_data['event_start'] != '' && $recurring_data['event_start'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $recurring_data['event_start'] ) ) : $event_date; |
|
| 5822 | - $event_enddate = isset( $recurring_data['event_end'] ) && $recurring_data['event_end'] != '' && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $recurring_data['event_end'] ) ) : $event_date; |
|
| 5823 | - $starttime = isset( $recurring_data['starttime'] ) && $recurring_data['starttime'] != '' && $recurring_data['starttime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $recurring_data['starttime'] ) ) : $starttime; |
|
| 5824 | - $endtime = isset( $recurring_data['endtime'] ) && $recurring_data['endtime'] != '' && $recurring_data['endtime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $recurring_data['endtime'] ) ) : $endtime; |
|
| 5821 | + $event_date = isset($recurring_data['event_start']) && $recurring_data['event_start'] != '' && $recurring_data['event_start'] != '0000-00-00 00:00:00' ? date_i18n('d/m/Y', strtotime($recurring_data['event_start'])) : $event_date;
|
|
| 5822 | + $event_enddate = isset($recurring_data['event_end']) && $recurring_data['event_end'] != '' && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? date_i18n('d/m/Y', strtotime($recurring_data['event_end'])) : $event_date;
|
|
| 5823 | + $starttime = isset($recurring_data['starttime']) && $recurring_data['starttime'] != '' && $recurring_data['starttime'] != '00:00:00' ? date_i18n('H:i', strtotime($recurring_data['starttime'])) : $starttime;
|
|
| 5824 | + $endtime = isset($recurring_data['endtime']) && $recurring_data['endtime'] != '' && $recurring_data['endtime'] != '00:00:00' ? date_i18n('H:i', strtotime($recurring_data['endtime'])) : $endtime;
|
|
| 5825 | 5825 | $is_whole_day_event = !empty($recurring_data['all_day']) ? 1 : ''; |
| 5826 | 5826 | $different_times = !empty($recurring_data['different_times']) ? true : false; |
| 5827 | 5827 | |
| 5828 | - $recurring_pkg = geodir_event_recurring_pkg( $gd_post_info ); |
|
| 5829 | - $is_recurring = isset( $gd_post_info->is_recurring ) && (int)$gd_post_info->is_recurring == 0 ? false : true; |
|
| 5828 | + $recurring_pkg = geodir_event_recurring_pkg($gd_post_info); |
|
| 5829 | + $is_recurring = isset($gd_post_info->is_recurring) && (int) $gd_post_info->is_recurring == 0 ? false : true; |
|
| 5830 | 5830 | |
| 5831 | 5831 | if ($recurring_pkg && $is_recurring) {
|
| 5832 | 5832 | $recurring_dates = $event_date; |
@@ -5836,13 +5836,13 @@ discard block |
||
| 5836 | 5836 | $recurring_type = !empty($recurring_data['repeat_type']) && in_array($recurring_data['repeat_type'], array('day', 'week', 'month', 'year', 'custom')) ? $recurring_data['repeat_type'] : 'custom';
|
| 5837 | 5837 | |
| 5838 | 5838 | if (!empty($recurring_data['event_recurring_dates'])) {
|
| 5839 | - $event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] ); |
|
| 5839 | + $event_recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
|
|
| 5840 | 5840 | |
| 5841 | 5841 | if (!empty($event_recurring_dates)) {
|
| 5842 | 5842 | $recurring_dates = array(); |
| 5843 | 5843 | |
| 5844 | 5844 | foreach ($event_recurring_dates as $date) {
|
| 5845 | - $recurring_dates[] = date_i18n( 'd/m/Y', strtotime( $date ) ); |
|
| 5845 | + $recurring_dates[] = date_i18n('d/m/Y', strtotime($date));
|
|
| 5846 | 5846 | } |
| 5847 | 5847 | |
| 5848 | 5848 | $recurring_dates = implode(",", $recurring_dates);
|
@@ -5858,7 +5858,7 @@ discard block |
||
| 5858 | 5858 | $times = array(); |
| 5859 | 5859 | |
| 5860 | 5860 | foreach ($recurring_data['starttimes'] as $time) {
|
| 5861 | - $times[] = $time != '00:00:00' ? date_i18n( 'H:i', strtotime( $time ) ) : '00:00'; |
|
| 5861 | + $times[] = $time != '00:00:00' ? date_i18n('H:i', strtotime($time)) : '00:00';
|
|
| 5862 | 5862 | } |
| 5863 | 5863 | |
| 5864 | 5864 | $event_starttimes = implode(",", $times);
|
@@ -5868,7 +5868,7 @@ discard block |
||
| 5868 | 5868 | $times = array(); |
| 5869 | 5869 | |
| 5870 | 5870 | foreach ($recurring_data['endtimes'] as $time) {
|
| 5871 | - $times[] = $time != '00:00:00' ? date_i18n( 'H:i', strtotime( $time ) ) : '00:00'; |
|
| 5871 | + $times[] = $time != '00:00:00' ? date_i18n('H:i', strtotime($time)) : '00:00';
|
|
| 5872 | 5872 | } |
| 5873 | 5873 | |
| 5874 | 5874 | $event_endtimes = implode(",", $times);
|
@@ -5880,8 +5880,8 @@ discard block |
||
| 5880 | 5880 | } |
| 5881 | 5881 | } |
| 5882 | 5882 | } else {
|
| 5883 | - $event_duration_days = isset($recurring_data['duration_x']) ? (int)$recurring_data['duration_x'] : 1; |
|
| 5884 | - $recurring_interval = !empty($recurring_data['repeat_x']) && (int)$recurring_data['repeat_x'] > 0 ? $recurring_data['repeat_x'] : 1; |
|
| 5883 | + $event_duration_days = isset($recurring_data['duration_x']) ? (int) $recurring_data['duration_x'] : 1; |
|
| 5884 | + $recurring_interval = !empty($recurring_data['repeat_x']) && (int) $recurring_data['repeat_x'] > 0 ? $recurring_data['repeat_x'] : 1; |
|
| 5885 | 5885 | |
| 5886 | 5886 | if (($recurring_type == 'week' || $recurring_type == 'month') && !empty($recurring_data['repeat_days'])) {
|
| 5887 | 5887 | $week_days = array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
|
@@ -5897,11 +5897,11 @@ discard block |
||
| 5897 | 5897 | } |
| 5898 | 5898 | |
| 5899 | 5899 | $recurring_week_nos = $recurring_type == 'month' && !empty($recurring_data['repeat_weeks']) ? implode(",", $recurring_data['repeat_weeks']) : $recurring_week_nos;
|
| 5900 | - if (!empty($recurring_data['repeat_end_type']) && (int)$recurring_data['repeat_end_type'] == 1) {
|
|
| 5901 | - $recurring_end_date = isset($recurring_data['repeat_end']) && $recurring_data['repeat_end'] != '' && $recurring_data['repeat_end'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $recurring_data['repeat_end'] ) ) : ''; |
|
| 5900 | + if (!empty($recurring_data['repeat_end_type']) && (int) $recurring_data['repeat_end_type'] == 1) {
|
|
| 5901 | + $recurring_end_date = isset($recurring_data['repeat_end']) && $recurring_data['repeat_end'] != '' && $recurring_data['repeat_end'] != '0000-00-00 00:00:00' ? date_i18n('d/m/Y', strtotime($recurring_data['repeat_end'])) : '';
|
|
| 5902 | 5902 | $max_recurring_count = empty($recurring_end_date) ? 1 : ''; |
| 5903 | 5903 | } else {
|
| 5904 | - $max_recurring_count = (!empty($recurring_data['max_repeat']) && (int)$recurring_data['max_repeat'] > 0 ? (int)$recurring_data['max_repeat'] : 1); |
|
| 5904 | + $max_recurring_count = (!empty($recurring_data['max_repeat']) && (int) $recurring_data['max_repeat'] > 0 ? (int) $recurring_data['max_repeat'] : 1); |
|
| 5905 | 5905 | } |
| 5906 | 5906 | } |
| 5907 | 5907 | } |
@@ -5965,9 +5965,9 @@ discard block |
||
| 5965 | 5965 | * @return array Event data array. |
| 5966 | 5966 | */ |
| 5967 | 5967 | function geodir_imex_process_event_data($gd_post) {
|
| 5968 | - $recurring_pkg = geodir_event_recurring_pkg( (object)$gd_post ); |
|
| 5968 | + $recurring_pkg = geodir_event_recurring_pkg((object) $gd_post); |
|
| 5969 | 5969 | |
| 5970 | - $is_recurring = isset( $gd_post['is_recurring_event'] ) && (int)$gd_post['is_recurring_event'] == 0 ? false : true; |
|
| 5970 | + $is_recurring = isset($gd_post['is_recurring_event']) && (int) $gd_post['is_recurring_event'] == 0 ? false : true; |
|
| 5971 | 5971 | $event_date = isset($gd_post['event_date']) && $gd_post['event_date'] != '' ? geodir_date($gd_post['event_date'], 'Y-m-d') : ''; |
| 5972 | 5972 | $event_enddate = isset($gd_post['event_enddate']) && $gd_post['event_enddate'] != '' ? geodir_date($gd_post['event_enddate'], 'Y-m-d') : $event_date; |
| 5973 | 5973 | $all_day = isset($gd_post['is_whole_day_event']) && !empty($gd_post['is_whole_day_event']) ? true : false; |
@@ -6014,17 +6014,17 @@ discard block |
||
| 6014 | 6014 | $event_recurring_dates = implode(",", $event_recurring_dates);
|
| 6015 | 6015 | } |
| 6016 | 6016 | } else {
|
| 6017 | - $duration_x = !empty( $gd_post['event_duration_days'] ) ? (int)$gd_post['event_duration_days'] : 1; |
|
| 6018 | - $repeat_x = !empty( $gd_post['recurring_interval'] ) ? (int)$gd_post['recurring_interval'] : 1; |
|
| 6019 | - $max_repeat = !empty( $gd_post['max_recurring_count'] ) ? (int)$gd_post['max_recurring_count'] : 1; |
|
| 6020 | - $repeat_end = !empty( $gd_post['recurring_end_date'] ) ? geodir_date($gd_post['recurring_end_date'], 'Y-m-d') : ''; |
|
| 6017 | + $duration_x = !empty($gd_post['event_duration_days']) ? (int) $gd_post['event_duration_days'] : 1; |
|
| 6018 | + $repeat_x = !empty($gd_post['recurring_interval']) ? (int) $gd_post['recurring_interval'] : 1; |
|
| 6019 | + $max_repeat = !empty($gd_post['max_recurring_count']) ? (int) $gd_post['max_recurring_count'] : 1; |
|
| 6020 | + $repeat_end = !empty($gd_post['recurring_end_date']) ? geodir_date($gd_post['recurring_end_date'], 'Y-m-d') : ''; |
|
| 6021 | 6021 | |
| 6022 | 6022 | $repeat_end_type = $repeat_end != '' ? 1 : 0; |
| 6023 | 6023 | $max_repeat = $repeat_end != '' ? '' : $max_repeat; |
| 6024 | 6024 | |
| 6025 | 6025 | $week_days = array_flip(array('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'));
|
| 6026 | 6026 | |
| 6027 | - $a_repeat_days = isset($gd_post['recurring_week_days']) && trim($gd_post['recurring_week_days'])!='' ? explode(',', trim($gd_post['recurring_week_days'])) : array();
|
|
| 6027 | + $a_repeat_days = isset($gd_post['recurring_week_days']) && trim($gd_post['recurring_week_days']) != '' ? explode(',', trim($gd_post['recurring_week_days'])) : array();
|
|
| 6028 | 6028 | $repeat_days = array(); |
| 6029 | 6029 | if (!empty($a_repeat_days)) {
|
| 6030 | 6030 | foreach ($a_repeat_days as $repeat_day) {
|
@@ -6042,7 +6042,7 @@ discard block |
||
| 6042 | 6042 | $repeat_weeks = array(); |
| 6043 | 6043 | if (!empty($a_repeat_weeks)) {
|
| 6044 | 6044 | foreach ($a_repeat_weeks as $repeat_week) {
|
| 6045 | - $repeat_weeks[] = (int)$repeat_week; |
|
| 6045 | + $repeat_weeks[] = (int) $repeat_week; |
|
| 6046 | 6046 | } |
| 6047 | 6047 | |
| 6048 | 6048 | $repeat_weeks = array_unique($repeat_weeks); |
@@ -6106,7 +6106,7 @@ discard block |
||
| 6106 | 6106 | |
| 6107 | 6107 | $page_found = $wpdb->get_var( |
| 6108 | 6108 | $wpdb->prepare( |
| 6109 | - "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;", |
|
| 6109 | + "SELECT ID FROM ".$wpdb->posts." WHERE post_name = %s LIMIT 1;", |
|
| 6110 | 6110 | array($slug) |
| 6111 | 6111 | ) |
| 6112 | 6112 | ); |
@@ -6161,7 +6161,7 @@ discard block |
||
| 6161 | 6161 | */ |
| 6162 | 6162 | function geodir_admin_upgrade_notice() {
|
| 6163 | 6163 | $class = "error"; |
| 6164 | - $message = __("Please update core GeoDirectory or some addons may not function correctly.","geodirectory");
|
|
| 6164 | + $message = __("Please update core GeoDirectory or some addons may not function correctly.", "geodirectory");
|
|
| 6165 | 6165 | echo"<div class=\"$class\"> <p>$message</p></div>"; |
| 6166 | 6166 | } |
| 6167 | 6167 | |
@@ -6173,7 +6173,7 @@ discard block |
||
| 6173 | 6173 | * @param (object) $r |
| 6174 | 6174 | * @return (string) $output |
| 6175 | 6175 | */ |
| 6176 | -function geodire_admin_upgrade_notice( $plugin_data, $r ) |
|
| 6176 | +function geodire_admin_upgrade_notice($plugin_data, $r) |
|
| 6177 | 6177 | {
|
| 6178 | 6178 | // readme contents |
| 6179 | 6179 | $args = array( |
@@ -6181,7 +6181,7 @@ discard block |
||
| 6181 | 6181 | 'redirection' => 5 |
| 6182 | 6182 | ); |
| 6183 | 6183 | $url = "http://plugins.svn.wordpress.org/geodirectory/trunk/readme.txt"; |
| 6184 | - $data = wp_remote_get( $url, $args ); |
|
| 6184 | + $data = wp_remote_get($url, $args); |
|
| 6185 | 6185 | |
| 6186 | 6186 | if (!is_wp_error($data) && $data['response']['code'] == 200) {
|
| 6187 | 6187 | |
@@ -6196,20 +6196,20 @@ discard block |
||
| 6196 | 6196 | function geodir_in_plugin_update_message($content) {
|
| 6197 | 6197 | // Output Upgrade Notice |
| 6198 | 6198 | $matches = null; |
| 6199 | - $regexp = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( GEODIRECTORY_VERSION ) . '\s*=|$)~Uis'; |
|
| 6199 | + $regexp = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*'.preg_quote(GEODIRECTORY_VERSION).'\s*=|$)~Uis'; |
|
| 6200 | 6200 | $upgrade_notice = ''; |
| 6201 | - if ( preg_match( $regexp, $content, $matches ) ) {
|
|
| 6202 | - if(empty($matches)){return;}
|
|
| 6201 | + if (preg_match($regexp, $content, $matches)) {
|
|
| 6202 | + if (empty($matches)) {return; }
|
|
| 6203 | 6203 | |
| 6204 | - $version = trim( $matches[1] ); |
|
| 6205 | - if($version && $version>GEODIRECTORY_VERSION){
|
|
| 6204 | + $version = trim($matches[1]); |
|
| 6205 | + if ($version && $version > GEODIRECTORY_VERSION) {
|
|
| 6206 | 6206 | |
| 6207 | 6207 | |
| 6208 | - $notices = (array) preg_split('~[\r\n]+~', trim( $matches[2] ) );
|
|
| 6209 | - if ( version_compare( GEODIRECTORY_VERSION, $version, '<' ) ) {
|
|
| 6208 | + $notices = (array) preg_split('~[\r\n]+~', trim($matches[2]));
|
|
| 6209 | + if (version_compare(GEODIRECTORY_VERSION, $version, '<')) {
|
|
| 6210 | 6210 | $upgrade_notice .= '<div class="geodir_plugin_upgrade_notice">'; |
| 6211 | - foreach ( $notices as $index => $line ) {
|
|
| 6212 | - $upgrade_notice .= wp_kses_post( preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line ) );
|
|
| 6211 | + foreach ($notices as $index => $line) {
|
|
| 6212 | + $upgrade_notice .= wp_kses_post(preg_replace('~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line));
|
|
| 6213 | 6213 | } |
| 6214 | 6214 | $upgrade_notice .= '</div> '; |
| 6215 | 6215 | } |
@@ -6233,7 +6233,7 @@ discard block |
||
| 6233 | 6233 | $default_language = $sitepress->get_default_language(); |
| 6234 | 6234 | if ($current_language != 'all' && $current_language != $default_language) {
|
| 6235 | 6235 | ?> |
| 6236 | - <div class="updated error notice-success" id="message"><p style="color:red"><strong><?php _e('Saving GeoDirectory pages settings on a different language breaks pages settings. Try to save after switching to default language.', 'geodirectory');?></strong></p></div>
|
|
| 6236 | + <div class="updated error notice-success" id="message"><p style="color:red"><strong><?php _e('Saving GeoDirectory pages settings on a different language breaks pages settings. Try to save after switching to default language.', 'geodirectory'); ?></strong></p></div>
|
|
| 6237 | 6237 | <?php |
| 6238 | 6238 | } |
| 6239 | 6239 | } |
@@ -6248,7 +6248,7 @@ discard block |
||
| 6248 | 6248 | * @param array Listing statuses to be skipped. |
| 6249 | 6249 | */ |
| 6250 | 6250 | function geodir_imex_export_skip_statuses() {
|
| 6251 | - $statuses = array( 'trash', 'auto-draft' ); |
|
| 6251 | + $statuses = array('trash', 'auto-draft');
|
|
| 6252 | 6252 | |
| 6253 | 6253 | /** |
| 6254 | 6254 | * Filter the statuses to skip during GD export listings. |
@@ -6258,7 +6258,7 @@ discard block |
||
| 6258 | 6258 | * |
| 6259 | 6259 | * @param array $statuses Listing statuses to be skipped. |
| 6260 | 6260 | */ |
| 6261 | - $statuses = apply_filters( 'geodir_imex_export_skip_statuses', $statuses ); |
|
| 6261 | + $statuses = apply_filters('geodir_imex_export_skip_statuses', $statuses);
|
|
| 6262 | 6262 | |
| 6263 | 6263 | return $statuses; |
| 6264 | 6264 | } |
@@ -6329,16 +6329,16 @@ discard block |
||
| 6329 | 6329 | function geodir_imex_get_filter_where($where = '', $post_type = '') {
|
| 6330 | 6330 | global $wpdb; |
| 6331 | 6331 | |
| 6332 | - $filters = !empty( $_REQUEST['gd_imex'] ) && is_array( $_REQUEST['gd_imex'] ) ? $_REQUEST['gd_imex'] : NULL; |
|
| 6332 | + $filters = !empty($_REQUEST['gd_imex']) && is_array($_REQUEST['gd_imex']) ? $_REQUEST['gd_imex'] : NULL; |
|
| 6333 | 6333 | |
| 6334 | - if ( !empty( $filters ) ) {
|
|
| 6335 | - foreach ( $filters as $field => $value ) {
|
|
| 6334 | + if (!empty($filters)) {
|
|
| 6335 | + foreach ($filters as $field => $value) {
|
|
| 6336 | 6336 | switch ($field) {
|
| 6337 | 6337 | case 'start_date': |
| 6338 | - $where .= " AND `" . $wpdb->posts . "`.`post_date` >= '" . sanitize_text_field( $value ) . " 00:00:00'"; |
|
| 6338 | + $where .= " AND `".$wpdb->posts."`.`post_date` >= '".sanitize_text_field($value)." 00:00:00'"; |
|
| 6339 | 6339 | break; |
| 6340 | 6340 | case 'end_date': |
| 6341 | - $where .= " AND `" . $wpdb->posts . "`.`post_date` <= '" . sanitize_text_field( $value ) . " 23:59:59'"; |
|
| 6341 | + $where .= " AND `".$wpdb->posts."`.`post_date` <= '".sanitize_text_field($value)." 23:59:59'"; |
|
| 6342 | 6342 | break; |
| 6343 | 6343 | } |
| 6344 | 6344 | } |
@@ -6350,25 +6350,25 @@ discard block |
||
| 6350 | 6350 | add_filter('geodir_get_export_posts', 'geodir_imex_get_filter_where', 10, 2);
|
| 6351 | 6351 | |
| 6352 | 6352 | |
| 6353 | -function geodir_fix_for_primer_theme(){
|
|
| 6354 | - if(!defined( 'PRIMER_VERSION' )){return;}
|
|
| 6353 | +function geodir_fix_for_primer_theme() {
|
|
| 6354 | + if (!defined('PRIMER_VERSION')) {return; }
|
|
| 6355 | 6355 | global $pagenow; |
| 6356 | 6356 | |
| 6357 | - if ( ( 'post.php' === $pagenow || 'post-new.php' === $pagenow ) && (isset($_REQUEST['post_type']) || isset($_REQUEST['post']) ) ){
|
|
| 6357 | + if (('post.php' === $pagenow || 'post-new.php' === $pagenow) && (isset($_REQUEST['post_type']) || isset($_REQUEST['post']))) {
|
|
| 6358 | 6358 | |
| 6359 | - $post_type = isset($_REQUEST['post_type']) ? esc_attr($_REQUEST['post_type']) : get_post_type( $_GET['post'] ); |
|
| 6359 | + $post_type = isset($_REQUEST['post_type']) ? esc_attr($_REQUEST['post_type']) : get_post_type($_GET['post']); |
|
| 6360 | 6360 | |
| 6361 | 6361 | $post_types = geodir_get_posttypes(); |
| 6362 | - if ($post_type && in_array($post_type, $post_types) ) {
|
|
| 6362 | + if ($post_type && in_array($post_type, $post_types)) {
|
|
| 6363 | 6363 | global $primer_customizer_layouts; |
| 6364 | - remove_action( 'add_meta_boxes', array( $primer_customizer_layouts, 'add_meta_box' ), 10); |
|
| 6364 | + remove_action('add_meta_boxes', array($primer_customizer_layouts, 'add_meta_box'), 10);
|
|
| 6365 | 6365 | } |
| 6366 | 6366 | } |
| 6367 | 6367 | |
| 6368 | 6368 | } |
| 6369 | 6369 | |
| 6370 | -if(is_admin()){
|
|
| 6371 | - add_action('add_meta_boxes','geodir_fix_for_primer_theme',0);
|
|
| 6370 | +if (is_admin()) {
|
|
| 6371 | + add_action('add_meta_boxes', 'geodir_fix_for_primer_theme', 0);
|
|
| 6372 | 6372 | } |
| 6373 | 6373 | |
| 6374 | 6374 | |
@@ -6501,32 +6501,32 @@ discard block |
||
| 6501 | 6501 | |
| 6502 | 6502 | function geodir_ga_activation_url() {
|
| 6503 | 6503 | |
| 6504 | - return add_query_arg( array( |
|
| 6504 | + return add_query_arg(array( |
|
| 6505 | 6505 | 'next' => admin_url("admin.php?page=geodirectory&active_tab=google_analytic_settings"),
|
| 6506 | 6506 | 'scope' => GEODIR_GA_SCOPE, |
| 6507 | 6507 | 'response_type' => 'code', |
| 6508 | 6508 | 'redirect_uri' => GEODIR_GA_REDIRECT, |
| 6509 | 6509 | 'client_id' => GEODIR_GA_CLIENTID, |
| 6510 | - ), 'https://accounts.google.com/o/oauth2/auth' ); |
|
| 6510 | + ), 'https://accounts.google.com/o/oauth2/auth'); |
|
| 6511 | 6511 | |
| 6512 | 6512 | return $url; |
| 6513 | 6513 | } |
| 6514 | 6514 | |
| 6515 | -function geodir_gd_accounts(){
|
|
| 6515 | +function geodir_gd_accounts() {
|
|
| 6516 | 6516 | $accounts = array(); |
| 6517 | - $useAuth = ( get_option( 'geodir_ga_auth_code' ) == '' ? false : true ); |
|
| 6518 | - if($useAuth){
|
|
| 6517 | + $useAuth = (get_option('geodir_ga_auth_code') == '' ? false : true);
|
|
| 6518 | + if ($useAuth) {
|
|
| 6519 | 6519 | try {
|
| 6520 | 6520 | $accounts = geodir_ga_get_analytics_accounts(); |
| 6521 | 6521 | } catch (Exception $e) {
|
| 6522 | - geodir_error_log( wp_sprintf( __( 'GD Google Analytics API Error(%s) : %s', 'geodirectory' ), $e->getCode(), $e->getMessage() ) ); |
|
| 6522 | + geodir_error_log(wp_sprintf(__('GD Google Analytics API Error(%s) : %s', 'geodirectory'), $e->getCode(), $e->getMessage()));
|
|
| 6523 | 6523 | } |
| 6524 | 6524 | |
| 6525 | - if(is_array($accounts)){
|
|
| 6526 | - $accounts = array_merge(array(__('Select Account','geodirectory')),$accounts);
|
|
| 6527 | - }elseif(get_option('geodir_ga_account_id')){
|
|
| 6525 | + if (is_array($accounts)) {
|
|
| 6526 | + $accounts = array_merge(array(__('Select Account', 'geodirectory')), $accounts);
|
|
| 6527 | + }elseif (get_option('geodir_ga_account_id')) {
|
|
| 6528 | 6528 | $accounts = array(); |
| 6529 | - $accounts[get_option('geodir_ga_account_id')] = __('Account re-authorization may be required','geodirectory').' ('.get_option('geodir_ga_account_id').')';
|
|
| 6529 | + $accounts[get_option('geodir_ga_account_id')] = __('Account re-authorization may be required', 'geodirectory').' ('.get_option('geodir_ga_account_id').')';
|
|
| 6530 | 6530 | } |
| 6531 | 6531 | } |
| 6532 | 6532 | return $accounts; |
@@ -6537,21 +6537,21 @@ discard block |
||
| 6537 | 6537 | global $gd_ga_errors; |
| 6538 | 6538 | $accounts = array(); |
| 6539 | 6539 | |
| 6540 | - if(get_option('geodir_ga_auth_token')===false){update_option('geodir_ga_auth_token','');}
|
|
| 6540 | + if (get_option('geodir_ga_auth_token') === false) {update_option('geodir_ga_auth_token', ''); }
|
|
| 6541 | 6541 | |
| 6542 | 6542 | |
| 6543 | - if(get_option('geodir_gd_uids') && !isset($_POST['geodir_ga_auth_code'])){
|
|
| 6543 | + if (get_option('geodir_gd_uids') && !isset($_POST['geodir_ga_auth_code'])) {
|
|
| 6544 | 6544 | return get_option('geodir_gd_uids');
|
| 6545 | 6545 | } |
| 6546 | 6546 | |
| 6547 | 6547 | # Create a new Gdata call |
| 6548 | - if ( trim(get_option('geodir_ga_auth_code')) != '' )
|
|
| 6548 | + if (trim(get_option('geodir_ga_auth_code')) != '')
|
|
| 6549 | 6549 | $stats = new GDGoogleAnalyticsStats(); |
| 6550 | 6550 | else |
| 6551 | 6551 | return false; |
| 6552 | 6552 | |
| 6553 | 6553 | # Check if Google sucessfully logged in |
| 6554 | - if ( ! $stats->checkLogin() ) |
|
| 6554 | + if (!$stats->checkLogin()) |
|
| 6555 | 6555 | return false; |
| 6556 | 6556 | |
| 6557 | 6557 | # Get a list of accounts |
@@ -6563,28 +6563,28 @@ discard block |
||
| 6563 | 6563 | } |
| 6564 | 6564 | |
| 6565 | 6565 | |
| 6566 | - natcasesort ($accounts); |
|
| 6566 | + natcasesort($accounts); |
|
| 6567 | 6567 | |
| 6568 | 6568 | # Return the account array if there are accounts |
| 6569 | - if ( count($accounts) > 0 ){
|
|
| 6570 | - update_option('geodir_gd_uids',$accounts);
|
|
| 6569 | + if (count($accounts) > 0) {
|
|
| 6570 | + update_option('geodir_gd_uids', $accounts);
|
|
| 6571 | 6571 | return $accounts; |
| 6572 | 6572 | } |
| 6573 | 6573 | else |
| 6574 | 6574 | return false; |
| 6575 | 6575 | } |
| 6576 | 6576 | |
| 6577 | -add_action( 'wp_ajax_geodir_ga_deauthorize', 'geodir_ga_deauthorize' ); |
|
| 6578 | -function geodir_ga_deauthorize(){
|
|
| 6577 | +add_action('wp_ajax_geodir_ga_deauthorize', 'geodir_ga_deauthorize');
|
|
| 6578 | +function geodir_ga_deauthorize() {
|
|
| 6579 | 6579 | |
| 6580 | - if ( ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'gd_ga_deauthorize' ) ) {
|
|
| 6580 | + if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'gd_ga_deauthorize')) {
|
|
| 6581 | 6581 | |
| 6582 | - die( 'Security check' ); |
|
| 6582 | + die('Security check');
|
|
| 6583 | 6583 | |
| 6584 | 6584 | } else {
|
| 6585 | - update_option('geodir_ga_auth_token','');
|
|
| 6586 | - update_option('geodir_ga_auth_code','');
|
|
| 6587 | - update_option('geodir_gd_uids','');
|
|
| 6585 | + update_option('geodir_ga_auth_token', '');
|
|
| 6586 | + update_option('geodir_ga_auth_code', '');
|
|
| 6587 | + update_option('geodir_gd_uids', '');
|
|
| 6588 | 6588 | |
| 6589 | 6589 | |
| 6590 | 6590 | echo admin_url('?page=geodirectory&active_tab=google_analytic_settings');
|
@@ -6617,22 +6617,22 @@ discard block |
||
| 6617 | 6617 | * @since 1.6.21 |
| 6618 | 6618 | * @return array |
| 6619 | 6619 | */ |
| 6620 | -function geodir_listing_image_size_arr(){
|
|
| 6620 | +function geodir_listing_image_size_arr() {
|
|
| 6621 | 6621 | |
| 6622 | 6622 | global $_wp_additional_image_sizes; |
| 6623 | 6623 | |
| 6624 | 6624 | $sizes = array(); |
| 6625 | 6625 | |
| 6626 | - foreach ( get_intermediate_image_sizes() as $_size ) {
|
|
| 6627 | - if ( in_array( $_size, array('thumbnail', 'medium', 'medium_large', 'large') ) ) {
|
|
| 6628 | - $sizes[ $_size ]['width'] = get_option( "{$_size}_size_w" );
|
|
| 6629 | - $sizes[ $_size ]['height'] = get_option( "{$_size}_size_h" );
|
|
| 6630 | - $sizes[ $_size ]['crop'] = (bool) get_option( "{$_size}_crop" );
|
|
| 6631 | - } elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) {
|
|
| 6632 | - $sizes[ $_size ] = array( |
|
| 6633 | - 'width' => $_wp_additional_image_sizes[ $_size ]['width'], |
|
| 6634 | - 'height' => $_wp_additional_image_sizes[ $_size ]['height'], |
|
| 6635 | - 'crop' => $_wp_additional_image_sizes[ $_size ]['crop'], |
|
| 6626 | + foreach (get_intermediate_image_sizes() as $_size) {
|
|
| 6627 | + if (in_array($_size, array('thumbnail', 'medium', 'medium_large', 'large'))) {
|
|
| 6628 | + $sizes[$_size]['width'] = get_option("{$_size}_size_w");
|
|
| 6629 | + $sizes[$_size]['height'] = get_option("{$_size}_size_h");
|
|
| 6630 | + $sizes[$_size]['crop'] = (bool) get_option("{$_size}_crop");
|
|
| 6631 | + } elseif (isset($_wp_additional_image_sizes[$_size])) {
|
|
| 6632 | + $sizes[$_size] = array( |
|
| 6633 | + 'width' => $_wp_additional_image_sizes[$_size]['width'], |
|
| 6634 | + 'height' => $_wp_additional_image_sizes[$_size]['height'], |
|
| 6635 | + 'crop' => $_wp_additional_image_sizes[$_size]['crop'], |
|
| 6636 | 6636 | ); |
| 6637 | 6637 | } |
| 6638 | 6638 | } |
@@ -6643,9 +6643,9 @@ discard block |
||
| 6643 | 6643 | |
| 6644 | 6644 | $options['default'] = __('GD Default', 'geodirectory');
|
| 6645 | 6645 | |
| 6646 | - if(!empty($sizes)){
|
|
| 6647 | - foreach($sizes as $key=>$val){
|
|
| 6648 | - $options[$key] = $key. ' ( '.$val['width'].' x '.$val['height']. ' )'; |
|
| 6646 | + if (!empty($sizes)) {
|
|
| 6647 | + foreach ($sizes as $key=>$val) {
|
|
| 6648 | + $options[$key] = $key.' ( '.$val['width'].' x '.$val['height'].' )'; |
|
| 6649 | 6649 | } |
| 6650 | 6650 | } |
| 6651 | 6651 | |
@@ -202,8 +202,8 @@ |
||
| 202 | 202 | public function remove_font_awesome( $url, $original_url, $_context ) { |
| 203 | 203 | |
| 204 | 204 | if ( $_context == 'display' |
| 205 | - && ( strstr( $url, "fontawesome" ) !== false || strstr( $url, "font-awesome" ) !== false ) |
|
| 206 | - && ( strstr( $url, ".js" ) !== false || strstr( $url, ".css" ) !== false ) |
|
| 205 | + && ( strstr( $url, "fontawesome" ) !== false || strstr( $url, "font-awesome" ) !== false ) |
|
| 206 | + && ( strstr( $url, ".js" ) !== false || strstr( $url, ".css" ) !== false ) |
|
| 207 | 207 | ) {// it's a font-awesome-url (probably) |
| 208 | 208 | |
| 209 | 209 | if ( strstr( $url, "wpfas=true" ) !== false ) { |
@@ -12,14 +12,14 @@ discard block |
||
| 12 | 12 | /** |
| 13 | 13 | * Bail if we are not in WP. |
| 14 | 14 | */ |
| 15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 15 | +if (!defined('ABSPATH')) { |
|
| 16 | 16 | exit; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * Only add if the class does not already exist. |
| 21 | 21 | */ |
| 22 | -if ( ! class_exists( 'WP_Font_Awesome_Settings' ) ) { |
|
| 22 | +if (!class_exists('WP_Font_Awesome_Settings')) { |
|
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | 25 | * A Class to be able to change settings for Font Awesome. |
@@ -77,17 +77,17 @@ discard block |
||
| 77 | 77 | * @return WP_Font_Awesome_Settings - Main instance. |
| 78 | 78 | */ |
| 79 | 79 | public static function instance() { |
| 80 | - if ( ! isset( self::$instance ) && ! ( self::$instance instanceof WP_Font_Awesome_Settings ) ) { |
|
| 80 | + if (!isset(self::$instance) && !(self::$instance instanceof WP_Font_Awesome_Settings)) { |
|
| 81 | 81 | self::$instance = new WP_Font_Awesome_Settings; |
| 82 | 82 | |
| 83 | - add_action( 'init', array( self::$instance, 'init' ) ); // set settings |
|
| 83 | + add_action('init', array(self::$instance, 'init')); // set settings |
|
| 84 | 84 | |
| 85 | - if ( is_admin() ) { |
|
| 86 | - add_action( 'admin_menu', array( self::$instance, 'menu_item' ) ); |
|
| 87 | - add_action( 'admin_init', array( self::$instance, 'register_settings' ) ); |
|
| 85 | + if (is_admin()) { |
|
| 86 | + add_action('admin_menu', array(self::$instance, 'menu_item')); |
|
| 87 | + add_action('admin_init', array(self::$instance, 'register_settings')); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - do_action( 'wp_font_awesome_settings_loaded' ); |
|
| 90 | + do_action('wp_font_awesome_settings_loaded'); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | return self::$instance; |
@@ -101,30 +101,30 @@ discard block |
||
| 101 | 101 | public function init() { |
| 102 | 102 | $this->settings = $this->get_settings(); |
| 103 | 103 | |
| 104 | - if ( $this->settings['type'] == 'CSS' ) { |
|
| 104 | + if ($this->settings['type'] == 'CSS') { |
|
| 105 | 105 | |
| 106 | - if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend' ) { |
|
| 107 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), 5000 );//echo '###';exit; |
|
| 106 | + if ($this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend') { |
|
| 107 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_style'), 5000); //echo '###';exit; |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend' ) { |
|
| 111 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 5000 ); |
|
| 110 | + if ($this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend') { |
|
| 111 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_style'), 5000); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | } else { |
| 115 | 115 | |
| 116 | - if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend' ) { |
|
| 117 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 5000 );//echo '###';exit; |
|
| 116 | + if ($this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend') { |
|
| 117 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'), 5000); //echo '###';exit; |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend' ) { |
|
| 121 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 5000 ); |
|
| 120 | + if ($this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend') { |
|
| 121 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'), 5000); |
|
| 122 | 122 | } |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | // remove font awesome if set to do so |
| 126 | - if ( $this->settings['dequeue'] == '1' ) { |
|
| 127 | - add_action( 'clean_url', array( $this, 'remove_font_awesome' ), 5000, 3 ); |
|
| 126 | + if ($this->settings['dequeue'] == '1') { |
|
| 127 | + add_action('clean_url', array($this, 'remove_font_awesome'), 5000, 3); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | } |
@@ -136,15 +136,15 @@ discard block |
||
| 136 | 136 | // build url |
| 137 | 137 | $url = $this->get_url(); |
| 138 | 138 | |
| 139 | - wp_deregister_style( 'font-awesome' ); // deregister in case its already there |
|
| 140 | - wp_register_style( 'font-awesome', $url, array(), null ); |
|
| 141 | - wp_enqueue_style( 'font-awesome' ); |
|
| 139 | + wp_deregister_style('font-awesome'); // deregister in case its already there |
|
| 140 | + wp_register_style('font-awesome', $url, array(), null); |
|
| 141 | + wp_enqueue_style('font-awesome'); |
|
| 142 | 142 | |
| 143 | - if ( $this->settings['shims'] ) { |
|
| 144 | - $url = $this->get_url( true ); |
|
| 145 | - wp_deregister_style( 'font-awesome-shims' ); // deregister in case its already there |
|
| 146 | - wp_register_style( 'font-awesome-shims', $url, array(), null ); |
|
| 147 | - wp_enqueue_style( 'font-awesome-shims' ); |
|
| 143 | + if ($this->settings['shims']) { |
|
| 144 | + $url = $this->get_url(true); |
|
| 145 | + wp_deregister_style('font-awesome-shims'); // deregister in case its already there |
|
| 146 | + wp_register_style('font-awesome-shims', $url, array(), null); |
|
| 147 | + wp_enqueue_style('font-awesome-shims'); |
|
| 148 | 148 | } |
| 149 | 149 | } |
| 150 | 150 | |
@@ -155,15 +155,15 @@ discard block |
||
| 155 | 155 | // build url |
| 156 | 156 | $url = $this->get_url(); |
| 157 | 157 | |
| 158 | - wp_deregister_script( 'font-awesome' ); // deregister in case its already there |
|
| 159 | - wp_register_script( 'font-awesome', $url, array(), null ); |
|
| 160 | - wp_enqueue_script( 'font-awesome' ); |
|
| 158 | + wp_deregister_script('font-awesome'); // deregister in case its already there |
|
| 159 | + wp_register_script('font-awesome', $url, array(), null); |
|
| 160 | + wp_enqueue_script('font-awesome'); |
|
| 161 | 161 | |
| 162 | - if ( $this->settings['shims'] ) { |
|
| 163 | - $url = $this->get_url( true ); |
|
| 164 | - wp_deregister_script( 'font-awesome-shims' ); // deregister in case its already there |
|
| 165 | - wp_register_script( 'font-awesome-shims', $url, array(), null ); |
|
| 166 | - wp_enqueue_script( 'font-awesome-shims' ); |
|
| 162 | + if ($this->settings['shims']) { |
|
| 163 | + $url = $this->get_url(true); |
|
| 164 | + wp_deregister_script('font-awesome-shims'); // deregister in case its already there |
|
| 165 | + wp_register_script('font-awesome-shims', $url, array(), null); |
|
| 166 | + wp_enqueue_script('font-awesome-shims'); |
|
| 167 | 167 | } |
| 168 | 168 | } |
| 169 | 169 | |
@@ -174,15 +174,15 @@ discard block |
||
| 174 | 174 | * |
| 175 | 175 | * @return string The url to the file. |
| 176 | 176 | */ |
| 177 | - public function get_url( $shims = false ) { |
|
| 177 | + public function get_url($shims = false) { |
|
| 178 | 178 | $script = $shims ? 'v4-shims' : 'all'; |
| 179 | 179 | $type = $this->settings['type']; |
| 180 | 180 | $version = $this->settings['version']; |
| 181 | 181 | |
| 182 | 182 | $url = "https://use.fontawesome.com/releases/"; // CDN |
| 183 | - $url .= ! empty( $version ) ? "v" . $version . '/' : "v" . $this->get_latest_version() . '/'; // version |
|
| 183 | + $url .= !empty($version) ? "v".$version.'/' : "v".$this->get_latest_version().'/'; // version |
|
| 184 | 184 | $url .= $type == 'CSS' ? 'css/' : 'js/'; // type |
| 185 | - $url .= $type == 'CSS' ? $script . '.css' : $script . '.js'; // type |
|
| 185 | + $url .= $type == 'CSS' ? $script.'.css' : $script.'.js'; // type |
|
| 186 | 186 | $url .= "?wpfas=true"; // set our var so our version is not removed |
| 187 | 187 | |
| 188 | 188 | return $url; |
@@ -199,16 +199,16 @@ discard block |
||
| 199 | 199 | * |
| 200 | 200 | * @return string The filtered url. |
| 201 | 201 | */ |
| 202 | - public function remove_font_awesome( $url, $original_url, $_context ) { |
|
| 202 | + public function remove_font_awesome($url, $original_url, $_context) { |
|
| 203 | 203 | |
| 204 | - if ( $_context == 'display' |
|
| 205 | - && ( strstr( $url, "fontawesome" ) !== false || strstr( $url, "font-awesome" ) !== false ) |
|
| 206 | - && ( strstr( $url, ".js" ) !== false || strstr( $url, ".css" ) !== false ) |
|
| 204 | + if ($_context == 'display' |
|
| 205 | + && (strstr($url, "fontawesome") !== false || strstr($url, "font-awesome") !== false) |
|
| 206 | + && (strstr($url, ".js") !== false || strstr($url, ".css") !== false) |
|
| 207 | 207 | ) {// it's a font-awesome-url (probably) |
| 208 | 208 | |
| 209 | - if ( strstr( $url, "wpfas=true" ) !== false ) { |
|
| 210 | - if ( $this->settings['type'] == 'JS' ) { |
|
| 211 | - if ( $this->settings['js-pseudo'] ) { |
|
| 209 | + if (strstr($url, "wpfas=true") !== false) { |
|
| 210 | + if ($this->settings['type'] == 'JS') { |
|
| 211 | + if ($this->settings['js-pseudo']) { |
|
| 212 | 212 | $url .= "' data-search-pseudo-elements defer='defer"; |
| 213 | 213 | } else { |
| 214 | 214 | $url .= "' defer='defer"; |
@@ -227,17 +227,17 @@ discard block |
||
| 227 | 227 | * Register the database settings with WordPress. |
| 228 | 228 | */ |
| 229 | 229 | public function register_settings() { |
| 230 | - register_setting( 'wp-font-awesome-settings', 'wp-font-awesome-settings' ); |
|
| 230 | + register_setting('wp-font-awesome-settings', 'wp-font-awesome-settings'); |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | /** |
| 234 | 234 | * Add the WordPress settings menu item. |
| 235 | 235 | */ |
| 236 | 236 | public function menu_item() { |
| 237 | - add_options_page( $this->name, $this->name, 'manage_options', 'wp-font-awesome-settings', array( |
|
| 237 | + add_options_page($this->name, $this->name, 'manage_options', 'wp-font-awesome-settings', array( |
|
| 238 | 238 | $this, |
| 239 | 239 | 'settings_page' |
| 240 | - ) ); |
|
| 240 | + )); |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | /** |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | */ |
| 248 | 248 | public function get_settings() { |
| 249 | 249 | |
| 250 | - $db_settings = get_option( 'wp-font-awesome-settings' ); |
|
| 250 | + $db_settings = get_option('wp-font-awesome-settings'); |
|
| 251 | 251 | |
| 252 | 252 | $defaults = array( |
| 253 | 253 | 'type' => 'CSS', // type to use, CSS or JS |
@@ -258,14 +258,14 @@ discard block |
||
| 258 | 258 | 'dequeue' => '0', // if we should try to remove other versions added by other plugins/themes |
| 259 | 259 | ); |
| 260 | 260 | |
| 261 | - $settings = wp_parse_args( $db_settings, $defaults ); |
|
| 261 | + $settings = wp_parse_args($db_settings, $defaults); |
|
| 262 | 262 | |
| 263 | 263 | /** |
| 264 | 264 | * Filter the Font Awesome settings. |
| 265 | 265 | * |
| 266 | 266 | * @todo if we add this filer people might use it and then it defeates the purpose of this class :/ |
| 267 | 267 | */ |
| 268 | - return $this->settings = apply_filters( 'wp-font-awesome-settings', $settings, $db_settings, $defaults ); |
|
| 268 | + return $this->settings = apply_filters('wp-font-awesome-settings', $settings, $db_settings, $defaults); |
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | |
@@ -273,12 +273,12 @@ discard block |
||
| 273 | 273 | * The settings page html output. |
| 274 | 274 | */ |
| 275 | 275 | public function settings_page() { |
| 276 | - if ( ! current_user_can( 'manage_options' ) ) { |
|
| 277 | - wp_die( __( 'You do not have sufficient permissions to access this page.' ) ); |
|
| 276 | + if (!current_user_can('manage_options')) { |
|
| 277 | + wp_die(__('You do not have sufficient permissions to access this page.')); |
|
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | // a hidden way to force the update of the verison number vai api instead of waiting the 48 hours |
| 281 | - if(isset($_REQUEST['force-version-check'])){ |
|
| 281 | + if (isset($_REQUEST['force-version-check'])) { |
|
| 282 | 282 | $this->get_latest_version($force_api = true); |
| 283 | 283 | } |
| 284 | 284 | ?> |
@@ -286,46 +286,46 @@ discard block |
||
| 286 | 286 | <h1><?php echo $this->name; ?></h1> |
| 287 | 287 | <form method="post" action="options.php"> |
| 288 | 288 | <?php |
| 289 | - settings_fields( 'wp-font-awesome-settings' ); |
|
| 290 | - do_settings_sections( 'wp-font-awesome-settings' ); |
|
| 289 | + settings_fields('wp-font-awesome-settings'); |
|
| 290 | + do_settings_sections('wp-font-awesome-settings'); |
|
| 291 | 291 | ?> |
| 292 | 292 | <table class="form-table"> |
| 293 | 293 | <tr valign="top"> |
| 294 | - <th scope="row"><label for="wpfas-type"><?php _e( 'Type' ); ?></label></th> |
|
| 294 | + <th scope="row"><label for="wpfas-type"><?php _e('Type'); ?></label></th> |
|
| 295 | 295 | <td> |
| 296 | 296 | <select name="wp-font-awesome-settings[type]" id="wpfas-type"> |
| 297 | 297 | <option |
| 298 | - value="CSS" <?php selected( $this->settings['type'], 'CSS' ); ?>><?php _e( 'CSS (default)' ); ?></option> |
|
| 299 | - <option value="JS" <?php selected( $this->settings['type'], 'JS' ); ?>>JS</option> |
|
| 298 | + value="CSS" <?php selected($this->settings['type'], 'CSS'); ?>><?php _e('CSS (default)'); ?></option> |
|
| 299 | + <option value="JS" <?php selected($this->settings['type'], 'JS'); ?>>JS</option> |
|
| 300 | 300 | </select> |
| 301 | 301 | </td> |
| 302 | 302 | </tr> |
| 303 | 303 | |
| 304 | 304 | <tr valign="top"> |
| 305 | - <th scope="row"><label for="wpfas-version"><?php _e( 'Version' ); ?></label></th> |
|
| 305 | + <th scope="row"><label for="wpfas-version"><?php _e('Version'); ?></label></th> |
|
| 306 | 306 | <td> |
| 307 | 307 | <select name="wp-font-awesome-settings[version]" id="wpfas-version"> |
| 308 | 308 | <option |
| 309 | - value="" <?php selected( $this->settings['version'], '' ); ?>><?php echo sprintf( __( 'Latest - %s (default)' ), $this->get_latest_version() ); ?></option> |
|
| 310 | - <option value="5.5.0" <?php selected( $this->settings['version'], '5.6.0' ); ?>> |
|
| 309 | + value="" <?php selected($this->settings['version'], ''); ?>><?php echo sprintf(__('Latest - %s (default)'), $this->get_latest_version()); ?></option> |
|
| 310 | + <option value="5.5.0" <?php selected($this->settings['version'], '5.6.0'); ?>> |
|
| 311 | 311 | 5.6.0 |
| 312 | 312 | </option> |
| 313 | - <option value="5.5.0" <?php selected( $this->settings['version'], '5.5.0' ); ?>> |
|
| 313 | + <option value="5.5.0" <?php selected($this->settings['version'], '5.5.0'); ?>> |
|
| 314 | 314 | 5.5.0 |
| 315 | 315 | </option> |
| 316 | - <option value="5.4.0" <?php selected( $this->settings['version'], '5.4.0' ); ?>> |
|
| 316 | + <option value="5.4.0" <?php selected($this->settings['version'], '5.4.0'); ?>> |
|
| 317 | 317 | 5.4.0 |
| 318 | 318 | </option> |
| 319 | - <option value="5.3.0" <?php selected( $this->settings['version'], '5.3.0' ); ?>> |
|
| 319 | + <option value="5.3.0" <?php selected($this->settings['version'], '5.3.0'); ?>> |
|
| 320 | 320 | 5.3.0 |
| 321 | 321 | </option> |
| 322 | - <option value="5.2.0" <?php selected( $this->settings['version'], '5.2.0' ); ?>> |
|
| 322 | + <option value="5.2.0" <?php selected($this->settings['version'], '5.2.0'); ?>> |
|
| 323 | 323 | 5.2.0 |
| 324 | 324 | </option> |
| 325 | - <option value="5.1.0" <?php selected( $this->settings['version'], '5.1.0' ); ?>> |
|
| 325 | + <option value="5.1.0" <?php selected($this->settings['version'], '5.1.0'); ?>> |
|
| 326 | 326 | 5.1.0 |
| 327 | 327 | </option> |
| 328 | - <option value="4.7.0" <?php selected( $this->settings['version'], '4.7.0' ); ?>> |
|
| 328 | + <option value="4.7.0" <?php selected($this->settings['version'], '4.7.0'); ?>> |
|
| 329 | 329 | 4.7.1 (CSS only) |
| 330 | 330 | </option> |
| 331 | 331 | </select> |
@@ -333,51 +333,51 @@ discard block |
||
| 333 | 333 | </tr> |
| 334 | 334 | |
| 335 | 335 | <tr valign="top"> |
| 336 | - <th scope="row"><label for="wpfas-enqueue"><?php _e( 'Enqueue' ); ?></label></th> |
|
| 336 | + <th scope="row"><label for="wpfas-enqueue"><?php _e('Enqueue'); ?></label></th> |
|
| 337 | 337 | <td> |
| 338 | 338 | <select name="wp-font-awesome-settings[enqueue]" id="wpfas-enqueue"> |
| 339 | 339 | <option |
| 340 | - value="" <?php selected( $this->settings['enqueue'], '' ); ?>><?php _e( 'Frontend + Backend (default)' ); ?></option> |
|
| 340 | + value="" <?php selected($this->settings['enqueue'], ''); ?>><?php _e('Frontend + Backend (default)'); ?></option> |
|
| 341 | 341 | <option |
| 342 | - value="frontend" <?php selected( $this->settings['enqueue'], 'frontend' ); ?>><?php _e( 'Frontend' ); ?></option> |
|
| 342 | + value="frontend" <?php selected($this->settings['enqueue'], 'frontend'); ?>><?php _e('Frontend'); ?></option> |
|
| 343 | 343 | <option |
| 344 | - value="backend" <?php selected( $this->settings['enqueue'], 'backend' ); ?>><?php _e( 'Backend' ); ?></option> |
|
| 344 | + value="backend" <?php selected($this->settings['enqueue'], 'backend'); ?>><?php _e('Backend'); ?></option> |
|
| 345 | 345 | </select> |
| 346 | 346 | </td> |
| 347 | 347 | </tr> |
| 348 | 348 | |
| 349 | 349 | <tr valign="top"> |
| 350 | 350 | <th scope="row"><label |
| 351 | - for="wpfas-shims"><?php _e( 'Enable v4 shims compatibility' ); ?></label></th> |
|
| 351 | + for="wpfas-shims"><?php _e('Enable v4 shims compatibility'); ?></label></th> |
|
| 352 | 352 | <td> |
| 353 | 353 | <input type="hidden" name="wp-font-awesome-settings[shims]" value="0"/> |
| 354 | 354 | <input type="checkbox" name="wp-font-awesome-settings[shims]" |
| 355 | - value="1" <?php checked( $this->settings['shims'], '1' ); ?> id="wpfas-shims"/> |
|
| 356 | - <span><?php _e( 'This enables v4 classes to work with v5, sort of like a band-aid until everyone has updated everything to v5.' ); ?></span> |
|
| 355 | + value="1" <?php checked($this->settings['shims'], '1'); ?> id="wpfas-shims"/> |
|
| 356 | + <span><?php _e('This enables v4 classes to work with v5, sort of like a band-aid until everyone has updated everything to v5.'); ?></span> |
|
| 357 | 357 | </td> |
| 358 | 358 | </tr> |
| 359 | 359 | |
| 360 | 360 | <tr valign="top"> |
| 361 | 361 | <th scope="row"><label |
| 362 | - for="wpfas-js-pseudo"><?php _e( 'Enable JS pseudo elements (not recommended)' ); ?></label> |
|
| 362 | + for="wpfas-js-pseudo"><?php _e('Enable JS pseudo elements (not recommended)'); ?></label> |
|
| 363 | 363 | </th> |
| 364 | 364 | <td> |
| 365 | 365 | <input type="hidden" name="wp-font-awesome-settings[js-pseudo]" value="0"/> |
| 366 | 366 | <input type="checkbox" name="wp-font-awesome-settings[js-pseudo]" |
| 367 | - value="1" <?php checked( $this->settings['js-pseudo'], '1' ); ?> |
|
| 367 | + value="1" <?php checked($this->settings['js-pseudo'], '1'); ?> |
|
| 368 | 368 | id="wpfas-js-pseudo"/> |
| 369 | - <span><?php _e( 'Used only with the JS version, this will make pseudo-elements work but can be CPU intensive on some sites.' ); ?></span> |
|
| 369 | + <span><?php _e('Used only with the JS version, this will make pseudo-elements work but can be CPU intensive on some sites.'); ?></span> |
|
| 370 | 370 | </td> |
| 371 | 371 | </tr> |
| 372 | 372 | |
| 373 | 373 | <tr valign="top"> |
| 374 | - <th scope="row"><label for="wpfas-dequeue"><?php _e( 'Dequeue' ); ?></label></th> |
|
| 374 | + <th scope="row"><label for="wpfas-dequeue"><?php _e('Dequeue'); ?></label></th> |
|
| 375 | 375 | <td> |
| 376 | 376 | <input type="hidden" name="wp-font-awesome-settings[dequeue]" value="0"/> |
| 377 | 377 | <input type="checkbox" name="wp-font-awesome-settings[dequeue]" |
| 378 | - value="1" <?php checked( $this->settings['dequeue'], '1' ); ?> |
|
| 378 | + value="1" <?php checked($this->settings['dequeue'], '1'); ?> |
|
| 379 | 379 | id="wpfas-dequeue"/> |
| 380 | - <span><?php _e( 'This will try to dequeue any other Font Awesome versions loaded by other sources if they are added with `font-awesome` or `fontawesome` in the name.' ); ?></span> |
|
| 380 | + <span><?php _e('This will try to dequeue any other Font Awesome versions loaded by other sources if they are added with `font-awesome` or `fontawesome` in the name.'); ?></span> |
|
| 381 | 381 | </td> |
| 382 | 382 | </tr> |
| 383 | 383 | |
@@ -402,12 +402,12 @@ discard block |
||
| 402 | 402 | * |
| 403 | 403 | * @return string Either a valid version number or an empty string. |
| 404 | 404 | */ |
| 405 | - public function validate_version_number( $version ) { |
|
| 405 | + public function validate_version_number($version) { |
|
| 406 | 406 | |
| 407 | - if ( version_compare( $version, '0.0.1', '>=' ) >= 0 ) { |
|
| 407 | + if (version_compare($version, '0.0.1', '>=') >= 0) { |
|
| 408 | 408 | // valid |
| 409 | 409 | } else { |
| 410 | - $version = '';// not validated |
|
| 410 | + $version = ''; // not validated |
|
| 411 | 411 | } |
| 412 | 412 | |
| 413 | 413 | return $version; |
@@ -425,16 +425,16 @@ discard block |
||
| 425 | 425 | public function get_latest_version($force_api = false) { |
| 426 | 426 | $latest_version = $this->latest; |
| 427 | 427 | |
| 428 | - $cache = get_transient( 'wp-font-awesome-settings-version' ); |
|
| 428 | + $cache = get_transient('wp-font-awesome-settings-version'); |
|
| 429 | 429 | |
| 430 | - if ( $cache === false || $force_api) { // its not set |
|
| 430 | + if ($cache === false || $force_api) { // its not set |
|
| 431 | 431 | $api_ver = $this->get_latest_version_from_api(); |
| 432 | - if ( version_compare( $api_ver, $this->latest, '>=' ) >= 0 ) { |
|
| 432 | + if (version_compare($api_ver, $this->latest, '>=') >= 0) { |
|
| 433 | 433 | $latest_version = $api_ver; |
| 434 | - set_transient( 'wp-font-awesome-settings-version', $api_ver, 48 * HOUR_IN_SECONDS ); |
|
| 434 | + set_transient('wp-font-awesome-settings-version', $api_ver, 48 * HOUR_IN_SECONDS); |
|
| 435 | 435 | } |
| 436 | - } elseif ( $this->validate_version_number( $cache ) ) { |
|
| 437 | - if ( version_compare( $cache, $this->latest, '>=' ) >= 0 ) { |
|
| 436 | + } elseif ($this->validate_version_number($cache)) { |
|
| 437 | + if (version_compare($cache, $this->latest, '>=') >= 0) { |
|
| 438 | 438 | $latest_version = $cache; |
| 439 | 439 | } |
| 440 | 440 | } |
@@ -450,10 +450,10 @@ discard block |
||
| 450 | 450 | */ |
| 451 | 451 | public function get_latest_version_from_api() { |
| 452 | 452 | $version = "0"; |
| 453 | - $response = wp_remote_get( "https://api.github.com/repos/FortAwesome/Font-Awesome/releases/latest" ); |
|
| 454 | - if ( ! is_wp_error( $response ) && is_array( $response ) ) { |
|
| 455 | - $api_response = json_decode( wp_remote_retrieve_body( $response ), true ); |
|
| 456 | - if ( isset( $api_response['tag_name'] ) && version_compare( $api_response['tag_name'], $this->latest, '>=' ) >= 0 && empty( $api_response['prerelease'] ) ) { |
|
| 453 | + $response = wp_remote_get("https://api.github.com/repos/FortAwesome/Font-Awesome/releases/latest"); |
|
| 454 | + if (!is_wp_error($response) && is_array($response)) { |
|
| 455 | + $api_response = json_decode(wp_remote_retrieve_body($response), true); |
|
| 456 | + if (isset($api_response['tag_name']) && version_compare($api_response['tag_name'], $this->latest, '>=') >= 0 && empty($api_response['prerelease'])) { |
|
| 457 | 457 | $version = $api_response['tag_name']; |
| 458 | 458 | } |
| 459 | 459 | } |
@@ -36,177 +36,177 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | function geodir_templates_scripts() |
| 38 | 38 | {
|
| 39 | - $is_detail_page = false; |
|
| 40 | - $geodir_map_name = geodir_map_name(); |
|
| 39 | + $is_detail_page = false; |
|
| 40 | + $geodir_map_name = geodir_map_name(); |
|
| 41 | 41 | |
| 42 | - if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) {
|
|
| 43 | - $is_detail_page = true; |
|
| 44 | - } |
|
| 42 | + if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) {
|
|
| 43 | + $is_detail_page = true; |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - wp_enqueue_script('jquery');
|
|
| 46 | + wp_enqueue_script('jquery');
|
|
| 47 | 47 | |
| 48 | - wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 49 | - wp_enqueue_script('geodirectory-script');
|
|
| 48 | + wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 49 | + wp_enqueue_script('geodirectory-script');
|
|
| 50 | 50 | |
| 51 | - $geodir_vars_data = array( |
|
| 52 | - 'siteurl' => get_option('siteurl'),
|
|
| 53 | - 'geodir_plugin_url' => geodir_plugin_url(), |
|
| 54 | - 'geodir_lazy_load' => get_option('geodir_lazy_load',1),
|
|
| 55 | - 'geodir_ajax_url' => geodir_get_ajax_url(), |
|
| 56 | - 'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'),
|
|
| 57 | - 'is_rtl' => is_rtl() ? 1 : 0, // fix rtl issue |
|
| 51 | + $geodir_vars_data = array( |
|
| 52 | + 'siteurl' => get_option('siteurl'),
|
|
| 53 | + 'geodir_plugin_url' => geodir_plugin_url(), |
|
| 54 | + 'geodir_lazy_load' => get_option('geodir_lazy_load',1),
|
|
| 55 | + 'geodir_ajax_url' => geodir_get_ajax_url(), |
|
| 56 | + 'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'),
|
|
| 57 | + 'is_rtl' => is_rtl() ? 1 : 0, // fix rtl issue |
|
| 58 | 58 | 'lightBox_txtImage' => addslashes(__('Image', 'geodirectory')),
|
| 59 | 59 | 'lightBox_txtOf' => addslashes(__('of', 'geodirectory')),
|
| 60 | - ); |
|
| 61 | - |
|
| 62 | - /** |
|
| 63 | - * Filter the `geodir_var` data array that outputs the wp_localize_script() translations and variables. |
|
| 64 | - * |
|
| 65 | - * This is used by addons to add JS translatable variables. |
|
| 66 | - * |
|
| 67 | - * @since 1.4.4 |
|
| 68 | - * @param array $geodir_vars_data {
|
|
| 69 | - * geodir var data used by addons to add JS translatable variables. |
|
| 70 | - * |
|
| 71 | - * @type string $siteurl Site url. |
|
| 72 | - * @type string $geodir_plugin_url Geodirectory core plugin url. |
|
| 73 | - * @type string $geodir_ajax_url Geodirectory plugin ajax url. |
|
| 74 | - * @type int $geodir_gd_modal Disable GD modal that displays slideshow images in popup?. |
|
| 75 | - * @type int $is_rtl Checks if current locale is RTL. |
|
| 76 | - * |
|
| 77 | - * } |
|
| 78 | - */ |
|
| 79 | - $geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data);
|
|
| 80 | - |
|
| 81 | - wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data);
|
|
| 82 | - |
|
| 83 | - wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true);
|
|
| 84 | - if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');}
|
|
| 85 | - |
|
| 86 | - wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true);
|
|
| 87 | - wp_enqueue_script('geodirectory-lightbox-jquery');
|
|
| 88 | - |
|
| 89 | - wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true);
|
|
| 90 | - if ($is_detail_page) {
|
|
| 91 | - wp_enqueue_script('geodirectory-jquery-simplemodal');
|
|
| 92 | - } |
|
| 60 | + ); |
|
| 61 | + |
|
| 62 | + /** |
|
| 63 | + * Filter the `geodir_var` data array that outputs the wp_localize_script() translations and variables. |
|
| 64 | + * |
|
| 65 | + * This is used by addons to add JS translatable variables. |
|
| 66 | + * |
|
| 67 | + * @since 1.4.4 |
|
| 68 | + * @param array $geodir_vars_data {
|
|
| 69 | + * geodir var data used by addons to add JS translatable variables. |
|
| 70 | + * |
|
| 71 | + * @type string $siteurl Site url. |
|
| 72 | + * @type string $geodir_plugin_url Geodirectory core plugin url. |
|
| 73 | + * @type string $geodir_ajax_url Geodirectory plugin ajax url. |
|
| 74 | + * @type int $geodir_gd_modal Disable GD modal that displays slideshow images in popup?. |
|
| 75 | + * @type int $is_rtl Checks if current locale is RTL. |
|
| 76 | + * |
|
| 77 | + * } |
|
| 78 | + */ |
|
| 79 | + $geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data);
|
|
| 80 | + |
|
| 81 | + wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data);
|
|
| 82 | + |
|
| 83 | + wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true);
|
|
| 84 | + if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');}
|
|
| 85 | + |
|
| 86 | + wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true);
|
|
| 87 | + wp_enqueue_script('geodirectory-lightbox-jquery');
|
|
| 88 | + |
|
| 89 | + wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true);
|
|
| 90 | + if ($is_detail_page) {
|
|
| 91 | + wp_enqueue_script('geodirectory-jquery-simplemodal');
|
|
| 92 | + } |
|
| 93 | 93 | |
| 94 | - if (in_array($geodir_map_name, array('auto', 'google'))) {
|
|
| 95 | - $map_lang = "&language=" . geodir_get_map_default_language(); |
|
| 96 | - $map_key = "&key=" . geodir_get_map_api_key(); |
|
| 97 | - /** |
|
| 98 | - * Filter the variables that are added to the end of the google maps script call. |
|
| 99 | - * |
|
| 100 | - * This i used to change things like google maps language etc. |
|
| 101 | - * |
|
| 102 | - * @since 1.0.0 |
|
| 103 | - * @param string $var The string to filter, default is empty string. |
|
| 104 | - */ |
|
| 105 | - $map_extra = apply_filters('geodir_googlemap_script_extra', '');
|
|
| 106 | - wp_enqueue_script('google-maps-api', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra , '', NULL);
|
|
| 94 | + if (in_array($geodir_map_name, array('auto', 'google'))) {
|
|
| 95 | + $map_lang = "&language=" . geodir_get_map_default_language(); |
|
| 96 | + $map_key = "&key=" . geodir_get_map_api_key(); |
|
| 97 | + /** |
|
| 98 | + * Filter the variables that are added to the end of the google maps script call. |
|
| 99 | + * |
|
| 100 | + * This i used to change things like google maps language etc. |
|
| 101 | + * |
|
| 102 | + * @since 1.0.0 |
|
| 103 | + * @param string $var The string to filter, default is empty string. |
|
| 104 | + */ |
|
| 105 | + $map_extra = apply_filters('geodir_googlemap_script_extra', '');
|
|
| 106 | + wp_enqueue_script('google-maps-api', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra , '', NULL);
|
|
| 107 | 107 | |
| 108 | - // Overlapping Marker Spiderfier |
|
| 109 | - wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 110 | - wp_enqueue_script('geodirectory-g-overlappingmarker-script');
|
|
| 111 | - } |
|
| 108 | + // Overlapping Marker Spiderfier |
|
| 109 | + wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 110 | + wp_enqueue_script('geodirectory-g-overlappingmarker-script');
|
|
| 111 | + } |
|
| 112 | 112 | |
| 113 | - if ($geodir_map_name == 'osm') {
|
|
| 114 | - // Leaflet OpenStreetMap |
|
| 115 | - wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
|
|
| 116 | - wp_enqueue_style('geodirectory-leaflet-style');
|
|
| 113 | + if ($geodir_map_name == 'osm') {
|
|
| 114 | + // Leaflet OpenStreetMap |
|
| 115 | + wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
|
|
| 116 | + wp_enqueue_style('geodirectory-leaflet-style');
|
|
| 117 | 117 | |
| 118 | - wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 119 | - wp_enqueue_script('geodirectory-leaflet-script');
|
|
| 118 | + wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 119 | + wp_enqueue_script('geodirectory-leaflet-script');
|
|
| 120 | 120 | |
| 121 | - wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 122 | - wp_enqueue_script('geodirectory-leaflet-geo-script');
|
|
| 121 | + wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 122 | + wp_enqueue_script('geodirectory-leaflet-geo-script');
|
|
| 123 | 123 | |
| 124 | - if ($is_detail_page) {
|
|
| 125 | - wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION);
|
|
| 126 | - wp_enqueue_style('geodirectory-leaflet-routing-style');
|
|
| 124 | + if ($is_detail_page) {
|
|
| 125 | + wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION);
|
|
| 126 | + wp_enqueue_style('geodirectory-leaflet-routing-style');
|
|
| 127 | 127 | |
| 128 | - wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 129 | - wp_enqueue_script('geodirectory-leaflet-routing-script');
|
|
| 130 | - } |
|
| 128 | + wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 129 | + wp_enqueue_script('geodirectory-leaflet-routing-script');
|
|
| 130 | + } |
|
| 131 | 131 | |
| 132 | - // Overlapping Marker Spiderfier Leaflet |
|
| 133 | - wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 134 | - wp_enqueue_script('geodirectory-o-overlappingmarker-script');
|
|
| 135 | - } |
|
| 136 | - wp_enqueue_script( 'jquery-ui-autocomplete' ); |
|
| 132 | + // Overlapping Marker Spiderfier Leaflet |
|
| 133 | + wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 134 | + wp_enqueue_script('geodirectory-o-overlappingmarker-script');
|
|
| 135 | + } |
|
| 136 | + wp_enqueue_script( 'jquery-ui-autocomplete' ); |
|
| 137 | 137 | |
| 138 | - wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true);
|
|
| 139 | - wp_enqueue_script('geodirectory-goMap-script');
|
|
| 140 | - |
|
| 141 | - wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 142 | - wp_enqueue_script('chosen');
|
|
| 143 | - |
|
| 144 | - wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 145 | - wp_enqueue_script('geodirectory-choose-ajax');
|
|
| 146 | - |
|
| 147 | - wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.min.js', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true);
|
|
| 148 | - |
|
| 149 | - if (is_page() && geodir_is_page('add-listing')) {
|
|
| 150 | - // SCRIPT FOR UPLOAD |
|
| 151 | - wp_enqueue_script('plupload-all');
|
|
| 152 | - wp_enqueue_script('jquery-ui-sortable');
|
|
| 153 | - |
|
| 154 | - wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true);
|
|
| 155 | - wp_enqueue_script('geodirectory-plupload-script');
|
|
| 156 | - // SCRIPT FOR UPLOAD END |
|
| 157 | - |
|
| 158 | - // check_ajax_referer function is used to make sure no files are uplaoded remotly but it will fail if used between https and non https so we do the check below of the urls |
|
| 159 | - if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
|
|
| 160 | - $ajax_url = admin_url('admin-ajax.php');
|
|
| 161 | - } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
|
|
| 162 | - $ajax_url = admin_url('admin-ajax.php');
|
|
| 163 | - } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
|
|
| 164 | - $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
|
|
| 165 | - } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
|
|
| 166 | - $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
|
|
| 167 | - } else {
|
|
| 168 | - $ajax_url = admin_url('admin-ajax.php');
|
|
| 169 | - } |
|
| 138 | + wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true);
|
|
| 139 | + wp_enqueue_script('geodirectory-goMap-script');
|
|
| 140 | + |
|
| 141 | + wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 142 | + wp_enqueue_script('chosen');
|
|
| 143 | + |
|
| 144 | + wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 145 | + wp_enqueue_script('geodirectory-choose-ajax');
|
|
| 146 | + |
|
| 147 | + wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.min.js', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true);
|
|
| 148 | + |
|
| 149 | + if (is_page() && geodir_is_page('add-listing')) {
|
|
| 150 | + // SCRIPT FOR UPLOAD |
|
| 151 | + wp_enqueue_script('plupload-all');
|
|
| 152 | + wp_enqueue_script('jquery-ui-sortable');
|
|
| 153 | + |
|
| 154 | + wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true);
|
|
| 155 | + wp_enqueue_script('geodirectory-plupload-script');
|
|
| 156 | + // SCRIPT FOR UPLOAD END |
|
| 157 | + |
|
| 158 | + // check_ajax_referer function is used to make sure no files are uplaoded remotly but it will fail if used between https and non https so we do the check below of the urls |
|
| 159 | + if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
|
|
| 160 | + $ajax_url = admin_url('admin-ajax.php');
|
|
| 161 | + } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
|
|
| 162 | + $ajax_url = admin_url('admin-ajax.php');
|
|
| 163 | + } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
|
|
| 164 | + $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
|
|
| 165 | + } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
|
|
| 166 | + $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
|
|
| 167 | + } else {
|
|
| 168 | + $ajax_url = admin_url('admin-ajax.php');
|
|
| 169 | + } |
|
| 170 | 170 | |
| 171 | - // place js config array for plupload |
|
| 172 | - $plupload_init = array( |
|
| 173 | - 'runtimes' => 'html5,silverlight,browserplus,gears,html4', |
|
| 174 | - 'browse_button' => 'plupload-browse-button', // will be adjusted per uploader |
|
| 175 | - 'container' => 'plupload-upload-ui', // will be adjusted per uploader |
|
| 176 | - 'drop_element' => 'dropbox', // will be adjusted per uploader |
|
| 177 | - 'file_data_name' => 'async-upload', // will be adjusted per uploader |
|
| 178 | - 'multiple_queues' => true, |
|
| 179 | - 'max_file_size' => geodir_max_upload_size(), |
|
| 180 | - 'url' => $ajax_url, |
|
| 181 | - 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
|
|
| 182 | - 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
|
|
| 183 | - 'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')),
|
|
| 184 | - 'multipart' => true, |
|
| 185 | - 'urlstream_upload' => true, |
|
| 186 | - 'multi_selection' => false, // will be added per uploader |
|
| 187 | - // additional post data to send to our ajax hook |
|
| 188 | - 'multipart_params' => array( |
|
| 189 | - '_ajax_nonce' => "", // will be added per uploader |
|
| 190 | - 'action' => 'plupload_action', // the ajax action name |
|
| 191 | - 'imgid' => 0 // will be added per uploader |
|
| 192 | - ) |
|
| 193 | - ); |
|
| 194 | - $base_plupload_config = json_encode($plupload_init); |
|
| 195 | - |
|
| 196 | - $gd_plupload_init = array('base_plupload_config' => $base_plupload_config,
|
|
| 197 | - 'upload_img_size' => geodir_max_upload_size()); |
|
| 198 | - |
|
| 199 | - wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
|
|
| 200 | - |
|
| 201 | - wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload');
|
|
| 202 | - } // End if for add place page |
|
| 203 | - |
|
| 204 | - wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
|
|
| 205 | - if ($is_detail_page) {
|
|
| 171 | + // place js config array for plupload |
|
| 172 | + $plupload_init = array( |
|
| 173 | + 'runtimes' => 'html5,silverlight,browserplus,gears,html4', |
|
| 174 | + 'browse_button' => 'plupload-browse-button', // will be adjusted per uploader |
|
| 175 | + 'container' => 'plupload-upload-ui', // will be adjusted per uploader |
|
| 176 | + 'drop_element' => 'dropbox', // will be adjusted per uploader |
|
| 177 | + 'file_data_name' => 'async-upload', // will be adjusted per uploader |
|
| 178 | + 'multiple_queues' => true, |
|
| 179 | + 'max_file_size' => geodir_max_upload_size(), |
|
| 180 | + 'url' => $ajax_url, |
|
| 181 | + 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
|
|
| 182 | + 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
|
|
| 183 | + 'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')),
|
|
| 184 | + 'multipart' => true, |
|
| 185 | + 'urlstream_upload' => true, |
|
| 186 | + 'multi_selection' => false, // will be added per uploader |
|
| 187 | + // additional post data to send to our ajax hook |
|
| 188 | + 'multipart_params' => array( |
|
| 189 | + '_ajax_nonce' => "", // will be added per uploader |
|
| 190 | + 'action' => 'plupload_action', // the ajax action name |
|
| 191 | + 'imgid' => 0 // will be added per uploader |
|
| 192 | + ) |
|
| 193 | + ); |
|
| 194 | + $base_plupload_config = json_encode($plupload_init); |
|
| 195 | + |
|
| 196 | + $gd_plupload_init = array('base_plupload_config' => $base_plupload_config,
|
|
| 197 | + 'upload_img_size' => geodir_max_upload_size()); |
|
| 198 | + |
|
| 199 | + wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
|
|
| 200 | + |
|
| 201 | + wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload');
|
|
| 202 | + } // End if for add place page |
|
| 203 | + |
|
| 204 | + wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
|
|
| 205 | + if ($is_detail_page) {
|
|
| 206 | 206 | wp_enqueue_script('geodirectory-post-custom-js');
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | - // font awesome rating script |
|
| 209 | + // font awesome rating script |
|
| 210 | 210 | if (get_option('geodir_reviewrating_enable_font_awesome')) {
|
| 211 | 211 | wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION, true);
|
| 212 | 212 | wp_enqueue_script('geodir-barrating-js');
|
@@ -215,11 +215,11 @@ discard block |
||
| 215 | 215 | wp_enqueue_script('geodir-jRating-js');
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | - wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
|
|
| 219 | - wp_enqueue_script('geodir-on-document-load');
|
|
| 218 | + wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
|
|
| 219 | + wp_enqueue_script('geodir-on-document-load');
|
|
| 220 | 220 | |
| 221 | - wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
|
|
| 222 | - wp_enqueue_script('google-geometa');
|
|
| 221 | + wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
|
|
| 222 | + wp_enqueue_script('google-geometa');
|
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | /** |
@@ -233,8 +233,8 @@ discard block |
||
| 233 | 233 | */ |
| 234 | 234 | function geodir_header_scripts() |
| 235 | 235 | {
|
| 236 | - echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>';
|
|
| 237 | - echo stripslashes(get_option('geodir_header_scripts'));
|
|
| 236 | + echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>';
|
|
| 237 | + echo stripslashes(get_option('geodir_header_scripts'));
|
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | /** |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | */ |
| 248 | 248 | function geodir_google_analytics_tracking_code() |
| 249 | 249 | {
|
| 250 | - if(get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')){?>
|
|
| 250 | + if(get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')){?>
|
|
| 251 | 251 | |
| 252 | 252 | <script> |
| 253 | 253 | (function(i,s,o,g,r,a,m){ i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
@@ -262,9 +262,9 @@ discard block |
||
| 262 | 262 | </script> |
| 263 | 263 | |
| 264 | 264 | <?php |
| 265 | - }elseif( get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){
|
|
| 266 | - echo stripslashes(get_option('geodir_ga_tracking_code'));
|
|
| 267 | - } |
|
| 265 | + }elseif( get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){
|
|
| 266 | + echo stripslashes(get_option('geodir_ga_tracking_code'));
|
|
| 267 | + } |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | /** |
@@ -278,16 +278,16 @@ discard block |
||
| 278 | 278 | function geodir_footer_scripts() |
| 279 | 279 | {
|
| 280 | 280 | |
| 281 | - echo stripslashes(get_option('geodir_footer_scripts'));
|
|
| 281 | + echo stripslashes(get_option('geodir_footer_scripts'));
|
|
| 282 | 282 | |
| 283 | - /* |
|
| 283 | + /* |
|
| 284 | 284 | * Apple suck and can't/won't fix bugs: https://bugs.webkit.org/show_bug.cgi?id=136041 |
| 285 | 285 | * |
| 286 | 286 | * Flexbox wont wrap on ios for search form items |
| 287 | 287 | */ |
| 288 | - if ( !empty( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'] ) ) {
|
|
| 289 | - echo "<style>body .geodir-listing-search.gd-search-bar-style .geodir-loc-bar .clearfix.geodir-loc-bar-in .geodir-search .gd-search-input-wrapper{flex:50 1 auto !important;min-width: initial !important;width:auto !important;}.geodir-filter-container .geodir-filter-cat{width:auto !important;}</style>";
|
|
| 290 | - } |
|
| 288 | + if ( !empty( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'] ) ) {
|
|
| 289 | + echo "<style>body .geodir-listing-search.gd-search-bar-style .geodir-loc-bar .clearfix.geodir-loc-bar-in .geodir-search .gd-search-input-wrapper{flex:50 1 auto !important;min-width: initial !important;width:auto !important;}.geodir-filter-container .geodir-filter-cat{width:auto !important;}</style>";
|
|
| 290 | + } |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | |
@@ -301,12 +301,12 @@ discard block |
||
| 301 | 301 | */ |
| 302 | 302 | function geodir_add_async_forscript($url) |
| 303 | 303 | {
|
| 304 | - if (strpos($url, '#asyncload')===false) |
|
| 305 | - return $url; |
|
| 306 | - else if (is_admin()) |
|
| 307 | - return str_replace('#asyncload', '', $url);
|
|
| 308 | - else |
|
| 309 | - return str_replace('#asyncload', '', $url)."' async='async";
|
|
| 304 | + if (strpos($url, '#asyncload')===false) |
|
| 305 | + return $url; |
|
| 306 | + else if (is_admin()) |
|
| 307 | + return str_replace('#asyncload', '', $url);
|
|
| 308 | + else |
|
| 309 | + return str_replace('#asyncload', '', $url)."' async='async";
|
|
| 310 | 310 | } |
| 311 | 311 | add_filter('clean_url', 'geodir_add_async_forscript', 11, 1);
|
| 312 | 312 | |
@@ -319,14 +319,14 @@ discard block |
||
| 319 | 319 | function geodir_templates_styles() |
| 320 | 320 | {
|
| 321 | 321 | |
| 322 | - wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION);
|
|
| 323 | - wp_enqueue_style('geodir-core-scss');
|
|
| 324 | - wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION);
|
|
| 322 | + wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION);
|
|
| 323 | + wp_enqueue_style('geodir-core-scss');
|
|
| 324 | + wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION);
|
|
| 325 | 325 | |
| 326 | - if(is_rtl()){
|
|
| 327 | - wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION);
|
|
| 328 | - wp_enqueue_style('geodirectory-frontend-rtl-style');
|
|
| 329 | - } |
|
| 326 | + if(is_rtl()){
|
|
| 327 | + wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION);
|
|
| 328 | + wp_enqueue_style('geodirectory-frontend-rtl-style');
|
|
| 329 | + } |
|
| 330 | 330 | |
| 331 | 331 | // wp_register_script('font-awesome', 'https://use.fontawesome.com/releases/v5.5.0/js/all.js#faload', array('font-awesome-shim'), GEODIRECTORY_VERSION);
|
| 332 | 332 | // wp_register_script('font-awesome-shim', 'https://use.fontawesome.com/releases/v5.5.0/js/v4-shims.js', array(), GEODIRECTORY_VERSION);
|
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | */ |
| 345 | 345 | function geodir_get_sidebar() |
| 346 | 346 | {
|
| 347 | - get_sidebar('geodirectory');
|
|
| 347 | + get_sidebar('geodirectory');
|
|
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | /** |
@@ -363,122 +363,122 @@ discard block |
||
| 363 | 363 | * @param bool $always_show Do you want to show the pagination always? Default: false. |
| 364 | 364 | */ |
| 365 | 365 | function geodir_pagination($before = '', $after = '', $prelabel = '', $nxtlabel = '', $pages_to_show = 5, $always_show = false) {
|
| 366 | - global $wp_query, $posts_per_page, $wpdb, $paged, $blog_id; |
|
| 366 | + global $wp_query, $posts_per_page, $wpdb, $paged, $blog_id; |
|
| 367 | 367 | |
| 368 | - if (empty($prelabel)) {
|
|
| 369 | - $prelabel = '<strong><</strong>'; |
|
| 370 | - } |
|
| 368 | + if (empty($prelabel)) {
|
|
| 369 | + $prelabel = '<strong><</strong>'; |
|
| 370 | + } |
|
| 371 | 371 | |
| 372 | - if (empty($nxtlabel)) {
|
|
| 373 | - $nxtlabel = '<strong>></strong>'; |
|
| 374 | - } |
|
| 372 | + if (empty($nxtlabel)) {
|
|
| 373 | + $nxtlabel = '<strong>></strong>'; |
|
| 374 | + } |
|
| 375 | 375 | |
| 376 | - $half_pages_to_show = round($pages_to_show / 2); |
|
| 376 | + $half_pages_to_show = round($pages_to_show / 2); |
|
| 377 | 377 | |
| 378 | - if (geodir_is_page('home')) // dont apply default pagination for geodirectory home page.
|
|
| 379 | - return; |
|
| 378 | + if (geodir_is_page('home')) // dont apply default pagination for geodirectory home page.
|
|
| 379 | + return; |
|
| 380 | 380 | |
| 381 | - if (!is_single()) {
|
|
| 382 | - if (function_exists('geodir_location_geo_home_link')) {
|
|
| 383 | - remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
|
|
| 384 | - } |
|
| 385 | - $numposts = $wp_query->found_posts; |
|
| 381 | + if (!is_single()) {
|
|
| 382 | + if (function_exists('geodir_location_geo_home_link')) {
|
|
| 383 | + remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
|
|
| 384 | + } |
|
| 385 | + $numposts = $wp_query->found_posts; |
|
| 386 | 386 | |
| 387 | - $max_page = ceil($numposts / $posts_per_page); |
|
| 387 | + $max_page = ceil($numposts / $posts_per_page); |
|
| 388 | 388 | |
| 389 | - if (empty($paged)) {
|
|
| 390 | - $paged = 1; |
|
| 391 | - } |
|
| 389 | + if (empty($paged)) {
|
|
| 390 | + $paged = 1; |
|
| 391 | + } |
|
| 392 | 392 | |
| 393 | - $post_type = geodir_get_current_posttype(); |
|
| 394 | - $listing_type_name = get_post_type_plural_label($post_type); |
|
| 395 | - if (geodir_is_page('listing') || geodir_is_page('search')) {
|
|
| 396 | - $term = array(); |
|
| 393 | + $post_type = geodir_get_current_posttype(); |
|
| 394 | + $listing_type_name = get_post_type_plural_label($post_type); |
|
| 395 | + if (geodir_is_page('listing') || geodir_is_page('search')) {
|
|
| 396 | + $term = array(); |
|
| 397 | 397 | |
| 398 | - if (is_tax()) {
|
|
| 399 | - $term_id = get_queried_object_id(); |
|
| 400 | - $taxonomy = get_query_var('taxonomy');
|
|
| 398 | + if (is_tax()) {
|
|
| 399 | + $term_id = get_queried_object_id(); |
|
| 400 | + $taxonomy = get_query_var('taxonomy');
|
|
| 401 | 401 | |
| 402 | - if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) {
|
|
| 403 | - $term = get_term($term_id, $post_type . 'category'); |
|
| 404 | - } |
|
| 405 | - } |
|
| 402 | + if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) {
|
|
| 403 | + $term = get_term($term_id, $post_type . 'category'); |
|
| 404 | + } |
|
| 405 | + } |
|
| 406 | 406 | |
| 407 | - if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) {
|
|
| 408 | - $taxonomy_search = $_REQUEST['s' . $post_type . 'category']; |
|
| 407 | + if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) {
|
|
| 408 | + $taxonomy_search = $_REQUEST['s' . $post_type . 'category']; |
|
| 409 | 409 | |
| 410 | - if (!is_array($taxonomy_search)) {
|
|
| 411 | - $term = get_term((int)$taxonomy_search, $post_type . 'category'); |
|
| 412 | - } else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search
|
|
| 413 | - $term = get_term((int)$taxonomy_search[0], $post_type . 'category'); |
|
| 414 | - } |
|
| 415 | - } |
|
| 410 | + if (!is_array($taxonomy_search)) {
|
|
| 411 | + $term = get_term((int)$taxonomy_search, $post_type . 'category'); |
|
| 412 | + } else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search
|
|
| 413 | + $term = get_term((int)$taxonomy_search[0], $post_type . 'category'); |
|
| 414 | + } |
|
| 415 | + } |
|
| 416 | 416 | |
| 417 | - if (!empty($term) && !is_wp_error($term)) {
|
|
| 418 | - $listing_type_name = $term->name; |
|
| 419 | - } |
|
| 420 | - } |
|
| 417 | + if (!empty($term) && !is_wp_error($term)) {
|
|
| 418 | + $listing_type_name = $term->name; |
|
| 419 | + } |
|
| 420 | + } |
|
| 421 | 421 | |
| 422 | - if ($max_page > 1 || $always_show) {
|
|
| 423 | - // Extra pagination info |
|
| 424 | - $geodir_pagination_more_info = get_option('geodir_pagination_advance_info');
|
|
| 425 | - $start_no = ( $paged - 1 ) * $posts_per_page + 1; |
|
| 426 | - $end_no = min($paged * $posts_per_page, $numposts); |
|
| 422 | + if ($max_page > 1 || $always_show) {
|
|
| 423 | + // Extra pagination info |
|
| 424 | + $geodir_pagination_more_info = get_option('geodir_pagination_advance_info');
|
|
| 425 | + $start_no = ( $paged - 1 ) * $posts_per_page + 1; |
|
| 426 | + $end_no = min($paged * $posts_per_page, $numposts); |
|
| 427 | 427 | |
| 428 | - if ($geodir_pagination_more_info != '') {
|
|
| 429 | - if ($listing_type_name) {
|
|
| 430 | - $listing_type_name = __($listing_type_name, 'geodirectory'); |
|
| 431 | - $pegination_desc = wp_sprintf(__('Showing %s %d-%d of %d', 'geodirectory'), $listing_type_name, $start_no, $end_no, $numposts);
|
|
| 432 | - } else {
|
|
| 433 | - $pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts);
|
|
| 434 | - } |
|
| 435 | - $pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>'; |
|
| 436 | - /** |
|
| 437 | - * Adds an extra pagination info above/under pagination. |
|
| 438 | - * |
|
| 439 | - * @since 1.5.9 |
|
| 440 | - * |
|
| 441 | - * @param string $pagination_info Extra pagination info content. |
|
| 442 | - * @param string $listing_type_name Listing results type. |
|
| 443 | - * @param string $start_no First result number. |
|
| 444 | - * @param string $end_no Last result number. |
|
| 445 | - * @param string $numposts Total number of listings. |
|
| 446 | - * @param string $post_type The post type. |
|
| 447 | - */ |
|
| 448 | - $pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type);
|
|
| 428 | + if ($geodir_pagination_more_info != '') {
|
|
| 429 | + if ($listing_type_name) {
|
|
| 430 | + $listing_type_name = __($listing_type_name, 'geodirectory'); |
|
| 431 | + $pegination_desc = wp_sprintf(__('Showing %s %d-%d of %d', 'geodirectory'), $listing_type_name, $start_no, $end_no, $numposts);
|
|
| 432 | + } else {
|
|
| 433 | + $pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts);
|
|
| 434 | + } |
|
| 435 | + $pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>'; |
|
| 436 | + /** |
|
| 437 | + * Adds an extra pagination info above/under pagination. |
|
| 438 | + * |
|
| 439 | + * @since 1.5.9 |
|
| 440 | + * |
|
| 441 | + * @param string $pagination_info Extra pagination info content. |
|
| 442 | + * @param string $listing_type_name Listing results type. |
|
| 443 | + * @param string $start_no First result number. |
|
| 444 | + * @param string $end_no Last result number. |
|
| 445 | + * @param string $numposts Total number of listings. |
|
| 446 | + * @param string $post_type The post type. |
|
| 447 | + */ |
|
| 448 | + $pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type);
|
|
| 449 | 449 | |
| 450 | - if ($geodir_pagination_more_info == 'before') {
|
|
| 451 | - $before = $before . $pagination_info; |
|
| 452 | - } else if ($geodir_pagination_more_info == 'after') {
|
|
| 453 | - $after = $pagination_info . $after; |
|
| 454 | - } |
|
| 455 | - } |
|
| 450 | + if ($geodir_pagination_more_info == 'before') {
|
|
| 451 | + $before = $before . $pagination_info; |
|
| 452 | + } else if ($geodir_pagination_more_info == 'after') {
|
|
| 453 | + $after = $pagination_info . $after; |
|
| 454 | + } |
|
| 455 | + } |
|
| 456 | 456 | |
| 457 | - echo "$before <div class='Navi gd-navi'>"; |
|
| 458 | - if ($paged >= ($pages_to_show - 1)) {
|
|
| 459 | - echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link()) . '">«</a>';
|
|
| 460 | - } |
|
| 461 | - previous_posts_link($prelabel); |
|
| 462 | - for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) {
|
|
| 463 | - if ($i >= 1 && $i <= $max_page) {
|
|
| 464 | - if ($i == $paged) {
|
|
| 465 | - echo "<strong class='on'>$i</strong>"; |
|
| 466 | - } else {
|
|
| 467 | - echo ' <a href="' . str_replace('&paged', '&paged', get_pagenum_link($i)) . '">' . $i . '</a> ';
|
|
| 468 | - } |
|
| 469 | - } |
|
| 470 | - } |
|
| 471 | - next_posts_link($nxtlabel, $max_page); |
|
| 472 | - if (($paged + $half_pages_to_show) < ($max_page)) {
|
|
| 473 | - echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link($max_page)) . '">»</a>';
|
|
| 474 | - } |
|
| 475 | - echo "</div> $after"; |
|
| 476 | - } |
|
| 457 | + echo "$before <div class='Navi gd-navi'>"; |
|
| 458 | + if ($paged >= ($pages_to_show - 1)) {
|
|
| 459 | + echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link()) . '">«</a>';
|
|
| 460 | + } |
|
| 461 | + previous_posts_link($prelabel); |
|
| 462 | + for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) {
|
|
| 463 | + if ($i >= 1 && $i <= $max_page) {
|
|
| 464 | + if ($i == $paged) {
|
|
| 465 | + echo "<strong class='on'>$i</strong>"; |
|
| 466 | + } else {
|
|
| 467 | + echo ' <a href="' . str_replace('&paged', '&paged', get_pagenum_link($i)) . '">' . $i . '</a> ';
|
|
| 468 | + } |
|
| 469 | + } |
|
| 470 | + } |
|
| 471 | + next_posts_link($nxtlabel, $max_page); |
|
| 472 | + if (($paged + $half_pages_to_show) < ($max_page)) {
|
|
| 473 | + echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link($max_page)) . '">»</a>';
|
|
| 474 | + } |
|
| 475 | + echo "</div> $after"; |
|
| 476 | + } |
|
| 477 | 477 | |
| 478 | - if (function_exists('geodir_location_geo_home_link')) {
|
|
| 479 | - add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
|
|
| 480 | - } |
|
| 481 | - } |
|
| 478 | + if (function_exists('geodir_location_geo_home_link')) {
|
|
| 479 | + add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
|
|
| 480 | + } |
|
| 481 | + } |
|
| 482 | 482 | } |
| 483 | 483 | |
| 484 | 484 | /** |
@@ -489,20 +489,20 @@ discard block |
||
| 489 | 489 | */ |
| 490 | 490 | function geodir_listingsearch_scripts() |
| 491 | 491 | {
|
| 492 | - if (get_option('gd_search_dist') != '') {
|
|
| 493 | - $dist = get_option('gd_search_dist');
|
|
| 494 | - } else {
|
|
| 495 | - $dist = 500; |
|
| 496 | - } |
|
| 497 | - $dist_dif = 1000; |
|
| 498 | - |
|
| 499 | - if ($dist <= 5000) $dist_dif = 500; |
|
| 500 | - if ($dist <= 1000) $dist_dif = 100; |
|
| 501 | - if ($dist <= 500) $dist_dif = 50; |
|
| 502 | - if ($dist <= 100) $dist_dif = 10; |
|
| 503 | - if ($dist <= 50) $dist_dif = 5; |
|
| 504 | - |
|
| 505 | - ?> |
|
| 492 | + if (get_option('gd_search_dist') != '') {
|
|
| 493 | + $dist = get_option('gd_search_dist');
|
|
| 494 | + } else {
|
|
| 495 | + $dist = 500; |
|
| 496 | + } |
|
| 497 | + $dist_dif = 1000; |
|
| 498 | + |
|
| 499 | + if ($dist <= 5000) $dist_dif = 500; |
|
| 500 | + if ($dist <= 1000) $dist_dif = 100; |
|
| 501 | + if ($dist <= 500) $dist_dif = 50; |
|
| 502 | + if ($dist <= 100) $dist_dif = 10; |
|
| 503 | + if ($dist <= 50) $dist_dif = 5; |
|
| 504 | + |
|
| 505 | + ?> |
|
| 506 | 506 | <script type="text/javascript"> |
| 507 | 507 | |
| 508 | 508 | jQuery(function ($) {
|
@@ -560,20 +560,20 @@ discard block |
||
| 560 | 560 | * @package GeoDirectory |
| 561 | 561 | */ |
| 562 | 562 | function geodir_add_sharelocation_scripts() {
|
| 563 | - $default_search_for_text = SEARCH_FOR_TEXT; |
|
| 564 | - if (get_option('geodir_search_field_default_text'))
|
|
| 565 | - $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
|
|
| 563 | + $default_search_for_text = SEARCH_FOR_TEXT; |
|
| 564 | + if (get_option('geodir_search_field_default_text'))
|
|
| 565 | + $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
|
|
| 566 | 566 | |
| 567 | - $default_near_text = NEAR_TEXT; |
|
| 568 | - if (get_option('geodir_near_field_default_text'))
|
|
| 569 | - $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
|
|
| 567 | + $default_near_text = NEAR_TEXT; |
|
| 568 | + if (get_option('geodir_near_field_default_text'))
|
|
| 569 | + $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
|
|
| 570 | 570 | |
| 571 | - $search_location = geodir_get_default_location(); |
|
| 571 | + $search_location = geodir_get_default_location(); |
|
| 572 | 572 | |
| 573 | - $default_search_for_text = addslashes(stripslashes($default_search_for_text)); |
|
| 574 | - $default_near_text = addslashes(stripslashes($default_near_text)); |
|
| 575 | - $city = !empty($search_location) ? addslashes(stripslashes($search_location->city)) : ''; |
|
| 576 | - ?> |
|
| 573 | + $default_search_for_text = addslashes(stripslashes($default_search_for_text)); |
|
| 574 | + $default_near_text = addslashes(stripslashes($default_near_text)); |
|
| 575 | + $city = !empty($search_location) ? addslashes(stripslashes($search_location->city)) : ''; |
|
| 576 | + ?> |
|
| 577 | 577 | <script type="text/javascript"> |
| 578 | 578 | var default_location = '<?php echo $city ;?>'; |
| 579 | 579 | var latlng; |
@@ -665,14 +665,14 @@ discard block |
||
| 665 | 665 | initialise2(); |
| 666 | 666 | } else {
|
| 667 | 667 | <?php |
| 668 | - $near_add = get_option('geodir_search_near_addition');
|
|
| 669 | - /** |
|
| 670 | - * Adds any extra info to the near search box query when trying to geolocate it via google api. |
|
| 671 | - * |
|
| 672 | - * @since 1.0.0 |
|
| 673 | - */ |
|
| 674 | - $near_add2 = apply_filters('geodir_search_near_addition', '');
|
|
| 675 | - ?> |
|
| 668 | + $near_add = get_option('geodir_search_near_addition');
|
|
| 669 | + /** |
|
| 670 | + * Adds any extra info to the near search box query when trying to geolocate it via google api. |
|
| 671 | + * |
|
| 672 | + * @since 1.0.0 |
|
| 673 | + */ |
|
| 674 | + $near_add2 = apply_filters('geodir_search_near_addition', '');
|
|
| 675 | + ?> |
|
| 676 | 676 | if (window.gdMaps === 'google') {
|
| 677 | 677 | Sgeocoder.geocode({'address': address<?php echo ($near_add ? '+", ' . $near_add . '"' : '') . $near_add2;?>},
|
| 678 | 678 | function (results, status) {
|
@@ -786,32 +786,32 @@ discard block |
||
| 786 | 786 | */ |
| 787 | 787 | function geodir_show_badges_on_image($which, $post, $link) |
| 788 | 788 | {
|
| 789 | - $return = ''; |
|
| 790 | - switch ($which) {
|
|
| 791 | - case 'featured': |
|
| 792 | - /** |
|
| 793 | - * Filter the featured image badge html that appears in the listings pages over the thumbnail. |
|
| 794 | - * |
|
| 795 | - * @since 1.0.0 |
|
| 796 | - * @param object $post The post object. |
|
| 797 | - * @param string $link The link to the post. |
|
| 798 | - */ |
|
| 799 | - $return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img"> </span></a>',$post,$link);
|
|
| 800 | - break; |
|
| 801 | - case 'new' : |
|
| 802 | - /** |
|
| 803 | - * Filter the new image badge html that appears in the listings pages over the thumbnail. |
|
| 804 | - * |
|
| 805 | - * @since 1.0.0 |
|
| 806 | - * @param object $post The post object. |
|
| 807 | - * @param string $link The link to the post. |
|
| 808 | - */ |
|
| 809 | - $return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing"> </span></a>',$post,$link);
|
|
| 810 | - break; |
|
| 811 | - |
|
| 812 | - } |
|
| 789 | + $return = ''; |
|
| 790 | + switch ($which) {
|
|
| 791 | + case 'featured': |
|
| 792 | + /** |
|
| 793 | + * Filter the featured image badge html that appears in the listings pages over the thumbnail. |
|
| 794 | + * |
|
| 795 | + * @since 1.0.0 |
|
| 796 | + * @param object $post The post object. |
|
| 797 | + * @param string $link The link to the post. |
|
| 798 | + */ |
|
| 799 | + $return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img"> </span></a>',$post,$link);
|
|
| 800 | + break; |
|
| 801 | + case 'new' : |
|
| 802 | + /** |
|
| 803 | + * Filter the new image badge html that appears in the listings pages over the thumbnail. |
|
| 804 | + * |
|
| 805 | + * @since 1.0.0 |
|
| 806 | + * @param object $post The post object. |
|
| 807 | + * @param string $link The link to the post. |
|
| 808 | + */ |
|
| 809 | + $return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing"> </span></a>',$post,$link);
|
|
| 810 | + break; |
|
| 811 | + |
|
| 812 | + } |
|
| 813 | 813 | |
| 814 | - return $return; |
|
| 814 | + return $return; |
|
| 815 | 815 | } |
| 816 | 816 | |
| 817 | 817 | /** |
@@ -820,9 +820,9 @@ discard block |
||
| 820 | 820 | * @since 1.6.22 |
| 821 | 821 | */ |
| 822 | 822 | function geodir_fix_script_conflict() {
|
| 823 | - if ( wp_script_is( 'flexslider', 'enqueued' ) && wp_script_is( 'geodirectory-jquery-flexslider-js', 'enqueued' ) ) {
|
|
| 824 | - wp_dequeue_script( 'flexslider' ); |
|
| 825 | - } |
|
| 823 | + if ( wp_script_is( 'flexslider', 'enqueued' ) && wp_script_is( 'geodirectory-jquery-flexslider-js', 'enqueued' ) ) {
|
|
| 824 | + wp_dequeue_script( 'flexslider' ); |
|
| 825 | + } |
|
| 826 | 826 | } |
| 827 | 827 | add_action( 'wp_enqueue_scripts', 'geodir_fix_script_conflict', 100 ); |
| 828 | 828 | |
@@ -835,12 +835,12 @@ discard block |
||
| 835 | 835 | */ |
| 836 | 836 | function geodir_fontawesome_defer($url) |
| 837 | 837 | {
|
| 838 | - if (strpos($url, 'use.fontawesome.com/releases/')===false) |
|
| 839 | - return $url; |
|
| 840 | - else if (is_admin()) |
|
| 841 | - return str_replace('#faload', '', $url);
|
|
| 842 | - else |
|
| 843 | - return $url."' data-search-pseudo-elements defer='defer"; |
|
| 838 | + if (strpos($url, 'use.fontawesome.com/releases/')===false) |
|
| 839 | + return $url; |
|
| 840 | + else if (is_admin()) |
|
| 841 | + return str_replace('#faload', '', $url);
|
|
| 842 | + else |
|
| 843 | + return $url."' data-search-pseudo-elements defer='defer"; |
|
| 844 | 844 | } |
| 845 | 845 | //add_filter('clean_url', 'geodir_fontawesome_defer', 11, 1); // let users add this as a snippet if they need it
|
| 846 | 846 | |
@@ -848,8 +848,8 @@ discard block |
||
| 848 | 848 | * Dequeue our fontawesome if using BB page. |
| 849 | 849 | */ |
| 850 | 850 | function geodir_fix_beaver_builder(){
|
| 851 | - if(isset($_REQUEST['fl_builder'])){
|
|
| 852 | - wp_dequeue_script( 'font-awesome' ); |
|
| 853 | - } |
|
| 851 | + if(isset($_REQUEST['fl_builder'])){
|
|
| 852 | + wp_dequeue_script( 'font-awesome' ); |
|
| 853 | + } |
|
| 854 | 854 | } |
| 855 | 855 | //add_filter('wp_print_scripts','geodir_fix_beaver_builder',100);
|
@@ -39,21 +39,21 @@ discard block |
||
| 39 | 39 | $is_detail_page = false; |
| 40 | 40 | $geodir_map_name = geodir_map_name(); |
| 41 | 41 | |
| 42 | - if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) {
|
|
| 42 | + if ((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview'))) {
|
|
| 43 | 43 | $is_detail_page = true; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | wp_enqueue_script('jquery');
|
| 47 | 47 | |
| 48 | - wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 48 | + wp_register_script('geodirectory-script', geodir_plugin_url().'/geodirectory-assets/js/geodirectory.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 49 | 49 | wp_enqueue_script('geodirectory-script');
|
| 50 | 50 | |
| 51 | 51 | $geodir_vars_data = array( |
| 52 | 52 | 'siteurl' => get_option('siteurl'),
|
| 53 | 53 | 'geodir_plugin_url' => geodir_plugin_url(), |
| 54 | - 'geodir_lazy_load' => get_option('geodir_lazy_load',1),
|
|
| 54 | + 'geodir_lazy_load' => get_option('geodir_lazy_load', 1),
|
|
| 55 | 55 | 'geodir_ajax_url' => geodir_get_ajax_url(), |
| 56 | - 'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'),
|
|
| 56 | + 'geodir_gd_modal' => (int) get_option('geodir_disable_gb_modal'),
|
|
| 57 | 57 | 'is_rtl' => is_rtl() ? 1 : 0, // fix rtl issue |
| 58 | 58 | 'lightBox_txtImage' => addslashes(__('Image', 'geodirectory')),
|
| 59 | 59 | 'lightBox_txtOf' => addslashes(__('of', 'geodirectory')),
|
@@ -76,24 +76,24 @@ discard block |
||
| 76 | 76 | * |
| 77 | 77 | * } |
| 78 | 78 | */ |
| 79 | - $geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data);
|
|
| 79 | + $geodir_vars_data = apply_filters('geodir_vars_data', $geodir_vars_data);
|
|
| 80 | 80 | |
| 81 | 81 | wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data);
|
| 82 | 82 | |
| 83 | - wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true);
|
|
| 84 | - if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');}
|
|
| 83 | + wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION, true);
|
|
| 84 | + if ($is_detail_page) {wp_enqueue_script('geodirectory-jquery-flexslider-js'); }
|
|
| 85 | 85 | |
| 86 | - wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true);
|
|
| 86 | + wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url().'/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION, true);
|
|
| 87 | 87 | wp_enqueue_script('geodirectory-lightbox-jquery');
|
| 88 | 88 | |
| 89 | - wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true);
|
|
| 89 | + wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url().'/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION, true);
|
|
| 90 | 90 | if ($is_detail_page) {
|
| 91 | 91 | wp_enqueue_script('geodirectory-jquery-simplemodal');
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | if (in_array($geodir_map_name, array('auto', 'google'))) {
|
| 95 | - $map_lang = "&language=" . geodir_get_map_default_language(); |
|
| 96 | - $map_key = "&key=" . geodir_get_map_api_key(); |
|
| 95 | + $map_lang = "&language=".geodir_get_map_default_language(); |
|
| 96 | + $map_key = "&key=".geodir_get_map_api_key(); |
|
| 97 | 97 | /** |
| 98 | 98 | * Filter the variables that are added to the end of the google maps script call. |
| 99 | 99 | * |
@@ -103,55 +103,55 @@ discard block |
||
| 103 | 103 | * @param string $var The string to filter, default is empty string. |
| 104 | 104 | */ |
| 105 | 105 | $map_extra = apply_filters('geodir_googlemap_script_extra', '');
|
| 106 | - wp_enqueue_script('google-maps-api', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra , '', NULL);
|
|
| 106 | + wp_enqueue_script('google-maps-api', 'https://maps.google.com/maps/api/js?'.$map_lang.$map_key.$map_extra, '', NULL);
|
|
| 107 | 107 | |
| 108 | 108 | // Overlapping Marker Spiderfier |
| 109 | - wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 109 | + wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url().'/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 110 | 110 | wp_enqueue_script('geodirectory-g-overlappingmarker-script');
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | if ($geodir_map_name == 'osm') {
|
| 114 | 114 | // Leaflet OpenStreetMap |
| 115 | - wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
|
|
| 115 | + wp_register_style('geodirectory-leaflet-style', geodir_plugin_url().'/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
|
|
| 116 | 116 | wp_enqueue_style('geodirectory-leaflet-style');
|
| 117 | 117 | |
| 118 | - wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 118 | + wp_register_script('geodirectory-leaflet-script', geodir_plugin_url().'/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 119 | 119 | wp_enqueue_script('geodirectory-leaflet-script');
|
| 120 | 120 | |
| 121 | - wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 121 | + wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url().'/geodirectory-assets/leaflet/osm.geocode.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 122 | 122 | wp_enqueue_script('geodirectory-leaflet-geo-script');
|
| 123 | 123 | |
| 124 | 124 | if ($is_detail_page) {
|
| 125 | - wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION);
|
|
| 125 | + wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url().'/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION);
|
|
| 126 | 126 | wp_enqueue_style('geodirectory-leaflet-routing-style');
|
| 127 | 127 | |
| 128 | - wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 128 | + wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url().'/geodirectory-assets/leaflet/routing/leaflet-routing-machine.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 129 | 129 | wp_enqueue_script('geodirectory-leaflet-routing-script');
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | // Overlapping Marker Spiderfier Leaflet |
| 133 | - wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 133 | + wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url().'/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 134 | 134 | wp_enqueue_script('geodirectory-o-overlappingmarker-script');
|
| 135 | 135 | } |
| 136 | - wp_enqueue_script( 'jquery-ui-autocomplete' ); |
|
| 136 | + wp_enqueue_script('jquery-ui-autocomplete');
|
|
| 137 | 137 | |
| 138 | - wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true);
|
|
| 138 | + wp_register_script('geodirectory-goMap-script', geodir_plugin_url().'/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true);
|
|
| 139 | 139 | wp_enqueue_script('geodirectory-goMap-script');
|
| 140 | 140 | |
| 141 | - wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 141 | + wp_register_script('chosen', geodir_plugin_url().'/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 142 | 142 | wp_enqueue_script('chosen');
|
| 143 | 143 | |
| 144 | - wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 144 | + wp_register_script('geodirectory-choose-ajax', geodir_plugin_url().'/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 145 | 145 | wp_enqueue_script('geodirectory-choose-ajax');
|
| 146 | 146 | |
| 147 | - wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.min.js', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true);
|
|
| 147 | + wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.ui.timepicker.min.js', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true);
|
|
| 148 | 148 | |
| 149 | 149 | if (is_page() && geodir_is_page('add-listing')) {
|
| 150 | 150 | // SCRIPT FOR UPLOAD |
| 151 | 151 | wp_enqueue_script('plupload-all');
|
| 152 | 152 | wp_enqueue_script('jquery-ui-sortable');
|
| 153 | 153 | |
| 154 | - wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true);
|
|
| 154 | + wp_register_script('geodirectory-plupload-script', geodir_plugin_url().'/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
|
|
| 155 | 155 | wp_enqueue_script('geodirectory-plupload-script');
|
| 156 | 156 | // SCRIPT FOR UPLOAD END |
| 157 | 157 | |
@@ -198,27 +198,27 @@ discard block |
||
| 198 | 198 | |
| 199 | 199 | wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
|
| 200 | 200 | |
| 201 | - wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload');
|
|
| 201 | + wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url().'/geodirectory-assets/js/listing_validation.min.js#asyncload');
|
|
| 202 | 202 | } // End if for add place page |
| 203 | 203 | |
| 204 | - wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
|
|
| 204 | + wp_register_script('geodirectory-post-custom-js', geodir_plugin_url().'/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
|
|
| 205 | 205 | if ($is_detail_page) {
|
| 206 | 206 | wp_enqueue_script('geodirectory-post-custom-js');
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | // font awesome rating script |
| 210 | 210 | if (get_option('geodir_reviewrating_enable_font_awesome')) {
|
| 211 | - wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION, true);
|
|
| 211 | + wp_register_script('geodir-barrating-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION, true);
|
|
| 212 | 212 | wp_enqueue_script('geodir-barrating-js');
|
| 213 | 213 | } else { // default rating script
|
| 214 | - wp_register_script('geodir-jRating-js', geodir_plugin_url() . '/geodirectory-assets/js/jRating.jquery.min.js', array(), GEODIRECTORY_VERSION, true);
|
|
| 214 | + wp_register_script('geodir-jRating-js', geodir_plugin_url().'/geodirectory-assets/js/jRating.jquery.min.js', array(), GEODIRECTORY_VERSION, true);
|
|
| 215 | 215 | wp_enqueue_script('geodir-jRating-js');
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | - wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
|
|
| 218 | + wp_register_script('geodir-on-document-load', geodir_plugin_url().'/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
|
|
| 219 | 219 | wp_enqueue_script('geodir-on-document-load');
|
| 220 | 220 | |
| 221 | - wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
|
|
| 221 | + wp_register_script('google-geometa', geodir_plugin_url().'/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
|
|
| 222 | 222 | wp_enqueue_script('google-geometa');
|
| 223 | 223 | } |
| 224 | 224 | |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | */ |
| 234 | 234 | function geodir_header_scripts() |
| 235 | 235 | {
|
| 236 | - echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>';
|
|
| 236 | + echo '<style>'.stripslashes(get_option('geodir_coustem_css')).'</style>';
|
|
| 237 | 237 | echo stripslashes(get_option('geodir_header_scripts'));
|
| 238 | 238 | } |
| 239 | 239 | |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | */ |
| 248 | 248 | function geodir_google_analytics_tracking_code() |
| 249 | 249 | {
|
| 250 | - if(get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')){?>
|
|
| 250 | + if (get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')) {?>
|
|
| 251 | 251 | |
| 252 | 252 | <script> |
| 253 | 253 | (function(i,s,o,g,r,a,m){ i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
@@ -255,14 +255,14 @@ discard block |
||
| 255 | 255 | m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) |
| 256 | 256 | })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); |
| 257 | 257 | |
| 258 | - ga('create', '<?php echo esc_attr(get_option('geodir_ga_account_id'));?>', 'auto');
|
|
| 259 | - <?php if(get_option('geodir_ga_anonymize_ip')){echo "ga('set', 'anonymizeIP', true);";}?>
|
|
| 258 | + ga('create', '<?php echo esc_attr(get_option('geodir_ga_account_id')); ?>', 'auto');
|
|
| 259 | + <?php if (get_option('geodir_ga_anonymize_ip')) {echo "ga('set', 'anonymizeIP', true);"; }?>
|
|
| 260 | 260 | ga('send', 'pageview');
|
| 261 | 261 | |
| 262 | 262 | </script> |
| 263 | 263 | |
| 264 | 264 | <?php |
| 265 | - }elseif( get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){
|
|
| 265 | + }elseif (get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')) {
|
|
| 266 | 266 | echo stripslashes(get_option('geodir_ga_tracking_code'));
|
| 267 | 267 | } |
| 268 | 268 | } |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | * |
| 286 | 286 | * Flexbox wont wrap on ios for search form items |
| 287 | 287 | */ |
| 288 | - if ( !empty( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'] ) ) {
|
|
| 288 | + if (!empty($_SERVER['HTTP_USER_AGENT']) && preg_match('/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'])) {
|
|
| 289 | 289 | echo "<style>body .geodir-listing-search.gd-search-bar-style .geodir-loc-bar .clearfix.geodir-loc-bar-in .geodir-search .gd-search-input-wrapper{flex:50 1 auto !important;min-width: initial !important;width:auto !important;}.geodir-filter-container .geodir-filter-cat{width:auto !important;}</style>";
|
| 290 | 290 | } |
| 291 | 291 | } |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | */ |
| 302 | 302 | function geodir_add_async_forscript($url) |
| 303 | 303 | {
|
| 304 | - if (strpos($url, '#asyncload')===false) |
|
| 304 | + if (strpos($url, '#asyncload') === false) |
|
| 305 | 305 | return $url; |
| 306 | 306 | else if (is_admin()) |
| 307 | 307 | return str_replace('#asyncload', '', $url);
|
@@ -319,12 +319,12 @@ discard block |
||
| 319 | 319 | function geodir_templates_styles() |
| 320 | 320 | {
|
| 321 | 321 | |
| 322 | - wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION);
|
|
| 322 | + wp_register_style('geodir-core-scss', geodir_plugin_url().'/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION);
|
|
| 323 | 323 | wp_enqueue_style('geodir-core-scss');
|
| 324 | - wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION);
|
|
| 324 | + wp_register_style('geodir-core-scss-footer', geodir_plugin_url().'/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION);
|
|
| 325 | 325 | |
| 326 | - if(is_rtl()){
|
|
| 327 | - wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION);
|
|
| 326 | + if (is_rtl()) {
|
|
| 327 | + wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url().'/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION);
|
|
| 328 | 328 | wp_enqueue_style('geodirectory-frontend-rtl-style');
|
| 329 | 329 | } |
| 330 | 330 | |
@@ -399,18 +399,18 @@ discard block |
||
| 399 | 399 | $term_id = get_queried_object_id(); |
| 400 | 400 | $taxonomy = get_query_var('taxonomy');
|
| 401 | 401 | |
| 402 | - if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) {
|
|
| 403 | - $term = get_term($term_id, $post_type . 'category'); |
|
| 402 | + if ($term_id && $post_type && get_query_var('taxonomy') == $post_type.'category') {
|
|
| 403 | + $term = get_term($term_id, $post_type.'category'); |
|
| 404 | 404 | } |
| 405 | 405 | } |
| 406 | 406 | |
| 407 | - if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) {
|
|
| 408 | - $taxonomy_search = $_REQUEST['s' . $post_type . 'category']; |
|
| 407 | + if (geodir_is_page('search') && !empty($_REQUEST['s'.$post_type.'category'])) {
|
|
| 408 | + $taxonomy_search = $_REQUEST['s'.$post_type.'category']; |
|
| 409 | 409 | |
| 410 | 410 | if (!is_array($taxonomy_search)) {
|
| 411 | - $term = get_term((int)$taxonomy_search, $post_type . 'category'); |
|
| 412 | - } else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search
|
|
| 413 | - $term = get_term((int)$taxonomy_search[0], $post_type . 'category'); |
|
| 411 | + $term = get_term((int) $taxonomy_search, $post_type.'category'); |
|
| 412 | + } else if (is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search
|
|
| 413 | + $term = get_term((int) $taxonomy_search[0], $post_type.'category'); |
|
| 414 | 414 | } |
| 415 | 415 | } |
| 416 | 416 | |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | if ($max_page > 1 || $always_show) {
|
| 423 | 423 | // Extra pagination info |
| 424 | 424 | $geodir_pagination_more_info = get_option('geodir_pagination_advance_info');
|
| 425 | - $start_no = ( $paged - 1 ) * $posts_per_page + 1; |
|
| 425 | + $start_no = ($paged - 1) * $posts_per_page + 1; |
|
| 426 | 426 | $end_no = min($paged * $posts_per_page, $numposts); |
| 427 | 427 | |
| 428 | 428 | if ($geodir_pagination_more_info != '') {
|
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | } else {
|
| 433 | 433 | $pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts);
|
| 434 | 434 | } |
| 435 | - $pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>'; |
|
| 435 | + $pagination_info = '<div class="gd-pagination-details">'.$pegination_desc.'</div>'; |
|
| 436 | 436 | /** |
| 437 | 437 | * Adds an extra pagination info above/under pagination. |
| 438 | 438 | * |
@@ -448,15 +448,15 @@ discard block |
||
| 448 | 448 | $pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type);
|
| 449 | 449 | |
| 450 | 450 | if ($geodir_pagination_more_info == 'before') {
|
| 451 | - $before = $before . $pagination_info; |
|
| 451 | + $before = $before.$pagination_info; |
|
| 452 | 452 | } else if ($geodir_pagination_more_info == 'after') {
|
| 453 | - $after = $pagination_info . $after; |
|
| 453 | + $after = $pagination_info.$after; |
|
| 454 | 454 | } |
| 455 | 455 | } |
| 456 | 456 | |
| 457 | 457 | echo "$before <div class='Navi gd-navi'>"; |
| 458 | 458 | if ($paged >= ($pages_to_show - 1)) {
|
| 459 | - echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link()) . '">«</a>';
|
|
| 459 | + echo '<a href="'.str_replace('&paged', '&paged', get_pagenum_link()).'">«</a>';
|
|
| 460 | 460 | } |
| 461 | 461 | previous_posts_link($prelabel); |
| 462 | 462 | for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) {
|
@@ -464,13 +464,13 @@ discard block |
||
| 464 | 464 | if ($i == $paged) {
|
| 465 | 465 | echo "<strong class='on'>$i</strong>"; |
| 466 | 466 | } else {
|
| 467 | - echo ' <a href="' . str_replace('&paged', '&paged', get_pagenum_link($i)) . '">' . $i . '</a> ';
|
|
| 467 | + echo ' <a href="'.str_replace('&paged', '&paged', get_pagenum_link($i)).'">'.$i.'</a> ';
|
|
| 468 | 468 | } |
| 469 | 469 | } |
| 470 | 470 | } |
| 471 | 471 | next_posts_link($nxtlabel, $max_page); |
| 472 | 472 | if (($paged + $half_pages_to_show) < ($max_page)) {
|
| 473 | - echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link($max_page)) . '">»</a>';
|
|
| 473 | + echo '<a href="'.str_replace('&paged', '&paged', get_pagenum_link($max_page)).'">»</a>';
|
|
| 474 | 474 | } |
| 475 | 475 | echo "</div> $after"; |
| 476 | 476 | } |
@@ -508,7 +508,7 @@ discard block |
||
| 508 | 508 | jQuery(function ($) {
|
| 509 | 509 | $("#distance_slider").slider({
|
| 510 | 510 | range: true, |
| 511 | - values: [0, <?php echo ($_REQUEST['sdist']!='') ? sanitize_text_field($_REQUEST['sdist']) : "0"; ?>], |
|
| 511 | + values: [0, <?php echo ($_REQUEST['sdist'] != '') ? sanitize_text_field($_REQUEST['sdist']) : "0"; ?>], |
|
| 512 | 512 | min: 0, |
| 513 | 513 | max: <?php echo $dist; ?>, |
| 514 | 514 | step: <?php echo $dist_dif; ?>, |
@@ -575,7 +575,7 @@ discard block |
||
| 575 | 575 | $city = !empty($search_location) ? addslashes(stripslashes($search_location->city)) : ''; |
| 576 | 576 | ?> |
| 577 | 577 | <script type="text/javascript"> |
| 578 | - var default_location = '<?php echo $city ;?>'; |
|
| 578 | + var default_location = '<?php echo $city; ?>'; |
|
| 579 | 579 | var latlng; |
| 580 | 580 | var address; |
| 581 | 581 | var dist = 0; |
@@ -591,7 +591,7 @@ discard block |
||
| 591 | 591 | var $form = jQuery(this).closest('form');
|
| 592 | 592 | |
| 593 | 593 | if (jQuery("#sdist input[type='radio']:checked").length != 0) dist = jQuery("#sdist input[type='radio']:checked").val();
|
| 594 | - if (jQuery('.search_text', $form).val() == '' || jQuery('.search_text', $form).val() == '<?php echo $default_search_for_text;?>') jQuery('.search_text', $form).val(s);
|
|
| 594 | + if (jQuery('.search_text', $form).val() == '' || jQuery('.search_text', $form).val() == '<?php echo $default_search_for_text; ?>') jQuery('.search_text', $form).val(s);
|
|
| 595 | 595 | |
| 596 | 596 | // Disable location based search for disabled location post type. |
| 597 | 597 | if (jQuery('.search_by_post', $form).val() != '' && typeof gd_cpt_no_location == 'function') {
|
@@ -605,7 +605,7 @@ discard block |
||
| 605 | 605 | } |
| 606 | 606 | } |
| 607 | 607 | |
| 608 | - if (dist > 0 || (jQuery('select[name="sort_by"]').val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest') || (jQuery(".snear", $form).val() != '' && jQuery(".snear", $form).val() != '<?php echo $default_near_text;?>')) {
|
|
| 608 | + if (dist > 0 || (jQuery('select[name="sort_by"]').val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest') || (jQuery(".snear", $form).val() != '' && jQuery(".snear", $form).val() != '<?php echo $default_near_text; ?>')) {
|
|
| 609 | 609 | |
| 610 | 610 | // OSM can't handel post code with no space so we test for it and add one if needed |
| 611 | 611 | if(window.gdMaps === 'osm'){
|
@@ -634,7 +634,7 @@ discard block |
||
| 634 | 634 | }); |
| 635 | 635 | |
| 636 | 636 | function geodir_setsearch($form) {
|
| 637 | - if ((dist > 0 || (jQuery('select[name="sort_by"]', $form).val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest')) && (jQuery(".snear", $form).val() == '' || jQuery(".snear", $form).val() == '<?php echo $default_near_text;?>')) jQuery(".snear", $form).val(default_location);
|
|
| 637 | + if ((dist > 0 || (jQuery('select[name="sort_by"]', $form).val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest')) && (jQuery(".snear", $form).val() == '' || jQuery(".snear", $form).val() == '<?php echo $default_near_text; ?>')) jQuery(".snear", $form).val(default_location);
|
|
| 638 | 638 | geocodeAddress($form); |
| 639 | 639 | } |
| 640 | 640 | |
@@ -653,15 +653,15 @@ discard block |
||
| 653 | 653 | // Call the geocode function |
| 654 | 654 | Sgeocoder = window.gdMaps == 'google' ? new google.maps.Geocoder() : null; |
| 655 | 655 | |
| 656 | - if (jQuery('.snear', $form).val() == '' || ( jQuery('.sgeo_lat').val() != '' && jQuery('.sgeo_lon').val() != '' ) || jQuery('.snear', $form).val().match("^<?php _e('In:','geodirectory');?>")) {
|
|
| 657 | - if (jQuery('.snear', $form).val().match("^<?php _e('In:','geodirectory');?>")) {
|
|
| 656 | + if (jQuery('.snear', $form).val() == '' || ( jQuery('.sgeo_lat').val() != '' && jQuery('.sgeo_lon').val() != '' ) || jQuery('.snear', $form).val().match("^<?php _e('In:', 'geodirectory'); ?>")) {
|
|
| 657 | + if (jQuery('.snear', $form).val().match("^<?php _e('In:', 'geodirectory'); ?>")) {
|
|
| 658 | 658 | jQuery(".snear", $form).val('');
|
| 659 | 659 | } |
| 660 | 660 | jQuery($form).submit(); |
| 661 | 661 | } else {
|
| 662 | 662 | var address = jQuery(".snear", $form).val();
|
| 663 | 663 | |
| 664 | - if (jQuery('.snear', $form).val() == '<?php echo $default_near_text;?>') {
|
|
| 664 | + if (jQuery('.snear', $form).val() == '<?php echo $default_near_text; ?>') {
|
|
| 665 | 665 | initialise2(); |
| 666 | 666 | } else {
|
| 667 | 667 | <?php |
@@ -674,21 +674,21 @@ discard block |
||
| 674 | 674 | $near_add2 = apply_filters('geodir_search_near_addition', '');
|
| 675 | 675 | ?> |
| 676 | 676 | if (window.gdMaps === 'google') {
|
| 677 | - Sgeocoder.geocode({'address': address<?php echo ($near_add ? '+", ' . $near_add . '"' : '') . $near_add2;?>},
|
|
| 677 | + Sgeocoder.geocode({'address': address<?php echo ($near_add ? '+", '.$near_add.'"' : '').$near_add2; ?>},
|
|
| 678 | 678 | function (results, status) {
|
| 679 | 679 | if (status == google.maps.GeocoderStatus.OK) {
|
| 680 | 680 | updateSearchPosition(results[0].geometry.location, $form); |
| 681 | 681 | } else {
|
| 682 | - alert("<?php esc_attr_e('Search was not successful for the following reason :', 'geodirectory');?>" + status);
|
|
| 682 | + alert("<?php esc_attr_e('Search was not successful for the following reason :', 'geodirectory'); ?>" + status);
|
|
| 683 | 683 | } |
| 684 | 684 | }); |
| 685 | 685 | } else if (window.gdMaps === 'osm') {
|
| 686 | - geocodePositionOSM(false, address<?php echo ($near_add ? '+", ' . $near_add . '"' : '') . $near_add2;?>, false, false, |
|
| 686 | + geocodePositionOSM(false, address<?php echo ($near_add ? '+", '.$near_add.'"' : '').$near_add2; ?>, false, false, |
|
| 687 | 687 | function(geo) {
|
| 688 | 688 | if (typeof geo !== 'undefined' && geo.lat && geo.lon) {
|
| 689 | 689 | updateSearchPosition(geo, $form); |
| 690 | 690 | } else {
|
| 691 | - alert("<?php esc_attr_e('Search was not successful for the requested address.', 'geodirectory');?>");
|
|
| 691 | + alert("<?php esc_attr_e('Search was not successful for the requested address.', 'geodirectory'); ?>");
|
|
| 692 | 692 | } |
| 693 | 693 | }); |
| 694 | 694 | } else {
|
@@ -734,19 +734,19 @@ discard block |
||
| 734 | 734 | var msg; |
| 735 | 735 | switch (err.code) {
|
| 736 | 736 | case err.UNKNOWN_ERROR: |
| 737 | - msg = "<?php _e('Unable to find your location','geodirectory');?>";
|
|
| 737 | + msg = "<?php _e('Unable to find your location', 'geodirectory'); ?>";
|
|
| 738 | 738 | break; |
| 739 | 739 | case err.PERMISSION_DENINED: |
| 740 | - msg = "<?php _e('Permission denied in finding your location','geodirectory');?>";
|
|
| 740 | + msg = "<?php _e('Permission denied in finding your location', 'geodirectory'); ?>";
|
|
| 741 | 741 | break; |
| 742 | 742 | case err.POSITION_UNAVAILABLE: |
| 743 | - msg = "<?php _e('Your location is currently unknown','geodirectory');?>";
|
|
| 743 | + msg = "<?php _e('Your location is currently unknown', 'geodirectory'); ?>";
|
|
| 744 | 744 | break; |
| 745 | 745 | case err.BREAK: |
| 746 | - msg = "<?php _e('Attempt to find location took too long','geodirectory');?>";
|
|
| 746 | + msg = "<?php _e('Attempt to find location took too long', 'geodirectory'); ?>";
|
|
| 747 | 747 | break; |
| 748 | 748 | default: |
| 749 | - msg = "<?php _e('Location detection not supported in browser','geodirectory');?>";
|
|
| 749 | + msg = "<?php _e('Location detection not supported in browser', 'geodirectory'); ?>";
|
|
| 750 | 750 | } |
| 751 | 751 | jQuery('#info').html(msg);
|
| 752 | 752 | } |
@@ -796,7 +796,7 @@ discard block |
||
| 796 | 796 | * @param object $post The post object. |
| 797 | 797 | * @param string $link The link to the post. |
| 798 | 798 | */ |
| 799 | - $return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img"> </span></a>',$post,$link);
|
|
| 799 | + $return = apply_filters('geodir_featured_badge_on_image', '<a href="'.$link.'"><span class="geodir_featured_img"> </span></a>', $post, $link);
|
|
| 800 | 800 | break; |
| 801 | 801 | case 'new' : |
| 802 | 802 | /** |
@@ -806,7 +806,7 @@ discard block |
||
| 806 | 806 | * @param object $post The post object. |
| 807 | 807 | * @param string $link The link to the post. |
| 808 | 808 | */ |
| 809 | - $return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing"> </span></a>',$post,$link);
|
|
| 809 | + $return = apply_filters('geodir_new_badge_on_image', '<a href="'.$link.'"><span class="geodir_new_listing"> </span></a>', $post, $link);
|
|
| 810 | 810 | break; |
| 811 | 811 | |
| 812 | 812 | } |
@@ -820,11 +820,11 @@ discard block |
||
| 820 | 820 | * @since 1.6.22 |
| 821 | 821 | */ |
| 822 | 822 | function geodir_fix_script_conflict() {
|
| 823 | - if ( wp_script_is( 'flexslider', 'enqueued' ) && wp_script_is( 'geodirectory-jquery-flexslider-js', 'enqueued' ) ) {
|
|
| 824 | - wp_dequeue_script( 'flexslider' ); |
|
| 823 | + if (wp_script_is('flexslider', 'enqueued') && wp_script_is('geodirectory-jquery-flexslider-js', 'enqueued')) {
|
|
| 824 | + wp_dequeue_script('flexslider');
|
|
| 825 | 825 | } |
| 826 | 826 | } |
| 827 | -add_action( 'wp_enqueue_scripts', 'geodir_fix_script_conflict', 100 ); |
|
| 827 | +add_action('wp_enqueue_scripts', 'geodir_fix_script_conflict', 100);
|
|
| 828 | 828 | |
| 829 | 829 | /** |
| 830 | 830 | * make fontawesome search for inline before and after icons |
@@ -835,7 +835,7 @@ discard block |
||
| 835 | 835 | */ |
| 836 | 836 | function geodir_fontawesome_defer($url) |
| 837 | 837 | {
|
| 838 | - if (strpos($url, 'use.fontawesome.com/releases/')===false) |
|
| 838 | + if (strpos($url, 'use.fontawesome.com/releases/') === false) |
|
| 839 | 839 | return $url; |
| 840 | 840 | else if (is_admin()) |
| 841 | 841 | return str_replace('#faload', '', $url);
|
@@ -847,9 +847,9 @@ discard block |
||
| 847 | 847 | /** |
| 848 | 848 | * Dequeue our fontawesome if using BB page. |
| 849 | 849 | */ |
| 850 | -function geodir_fix_beaver_builder(){
|
|
| 851 | - if(isset($_REQUEST['fl_builder'])){
|
|
| 852 | - wp_dequeue_script( 'font-awesome' ); |
|
| 850 | +function geodir_fix_beaver_builder() {
|
|
| 851 | + if (isset($_REQUEST['fl_builder'])) {
|
|
| 852 | + wp_dequeue_script('font-awesome');
|
|
| 853 | 853 | } |
| 854 | 854 | } |
| 855 | 855 | //add_filter('wp_print_scripts','geodir_fix_beaver_builder',100);
|
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | if ($is_wpml && !empty($wp->query_vars['page_id'])) {
|
| 69 | 69 | wp_redirect(geodir_getlink(get_permalink($wp->query_vars['page_id']), array('listing_type' => $post_type)));
|
| 70 | 70 | } else {
|
| 71 | - wp_redirect(trailingslashit(get_site_url()) . $pagename . '/?listing_type=' . $post_type); |
|
| 71 | + wp_redirect(trailingslashit(get_site_url()).$pagename.'/?listing_type='.$post_type); |
|
| 72 | 72 | } |
| 73 | 73 | gd_die(); |
| 74 | 74 | } |
@@ -126,21 +126,21 @@ discard block |
||
| 126 | 126 | case 'listing-listview': |
| 127 | 127 | $template = locate_template(array("geodirectory/listing-listview.php"));
|
| 128 | 128 | if (!$template) {
|
| 129 | - $template = geodir_plugin_path() . '/geodirectory-templates/listing-listview.php'; |
|
| 129 | + $template = geodir_plugin_path().'/geodirectory-templates/listing-listview.php'; |
|
| 130 | 130 | } |
| 131 | 131 | return $template; |
| 132 | 132 | break; |
| 133 | 133 | case 'widget-listing-listview': |
| 134 | 134 | $template = locate_template(array("geodirectory/widget-listing-listview.php"));
|
| 135 | 135 | if (!$template) {
|
| 136 | - $template = geodir_plugin_path() . '/geodirectory-templates/widget-listing-listview.php'; |
|
| 136 | + $template = geodir_plugin_path().'/geodirectory-templates/widget-listing-listview.php'; |
|
| 137 | 137 | } |
| 138 | 138 | return $template; |
| 139 | 139 | break; |
| 140 | 140 | case 'email-message': |
| 141 | 141 | $template = locate_template(array("geodirectory/email-message.php"));
|
| 142 | 142 | if (!$template) {
|
| 143 | - $template = geodir_plugin_path() . '/geodirectory-templates/email-message.php'; |
|
| 143 | + $template = geodir_plugin_path().'/geodirectory-templates/email-message.php'; |
|
| 144 | 144 | } |
| 145 | 145 | return $template; |
| 146 | 146 | break; |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | |
| 199 | 199 | $template = geodir_locate_template('signup');
|
| 200 | 200 | |
| 201 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-signup.php'; |
|
| 201 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-signup.php'; |
|
| 202 | 202 | |
| 203 | 203 | /** |
| 204 | 204 | * Filter the signup template path. |
@@ -212,11 +212,11 @@ discard block |
||
| 212 | 212 | if (geodir_is_page('add-listing') || $geodir_custom_page_list['geodir_add_listing_page']) {
|
| 213 | 213 | if (!geodir_is_default_location_set()) {
|
| 214 | 214 | global $information; |
| 215 | - $information = 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>');
|
|
| 215 | + $information = 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>');
|
|
| 216 | 216 | |
| 217 | 217 | $template = geodir_locate_template('information');
|
| 218 | 218 | |
| 219 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php'; |
|
| 219 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-information.php'; |
|
| 220 | 220 | /** |
| 221 | 221 | * Filter the information template path. |
| 222 | 222 | * |
@@ -228,10 +228,10 @@ discard block |
||
| 228 | 228 | // check if pid exists in the record if yes then check if this post belongs to the user who is logged in. |
| 229 | 229 | if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
|
| 230 | 230 | /// WPML |
| 231 | - if (geodir_wpml_is_post_type_translated(get_post_type((int)$_GET['pid'])) && $duplicate_of = wpml_get_master_post_from_duplicate((int)$_GET['pid'])) {
|
|
| 231 | + if (geodir_wpml_is_post_type_translated(get_post_type((int) $_GET['pid'])) && $duplicate_of = wpml_get_master_post_from_duplicate((int) $_GET['pid'])) {
|
|
| 232 | 232 | global $sitepress; |
| 233 | 233 | |
| 234 | - $lang_of_duplicate = geodir_get_language_for_element($duplicate_of, 'post_' . get_post_type($duplicate_of)); |
|
| 234 | + $lang_of_duplicate = geodir_get_language_for_element($duplicate_of, 'post_'.get_post_type($duplicate_of)); |
|
| 235 | 235 | $sitepress->switch_lang($lang_of_duplicate, true); |
| 236 | 236 | |
| 237 | 237 | $redirect_to = get_permalink(geodir_add_listing_page_id()); |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | if (!$is_current_user_owner) {
|
| 251 | 251 | $template = geodir_locate_template('information');
|
| 252 | 252 | |
| 253 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php'; |
|
| 253 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-information.php'; |
|
| 254 | 254 | /** |
| 255 | 255 | * Filter the information template path. |
| 256 | 256 | * |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | |
| 273 | 273 | $template = geodir_locate_template('add-listing');
|
| 274 | 274 | |
| 275 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/add-listing.php'; |
|
| 275 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/add-listing.php'; |
|
| 276 | 276 | /** |
| 277 | 277 | * Filter the add listing template path. |
| 278 | 278 | * |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | |
| 290 | 290 | $template = geodir_locate_template('preview');
|
| 291 | 291 | |
| 292 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php'; |
|
| 292 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/listing-detail.php'; |
|
| 293 | 293 | /** |
| 294 | 294 | * Filter the preview template path. |
| 295 | 295 | * |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | |
| 306 | 306 | $template = geodir_locate_template('success');
|
| 307 | 307 | |
| 308 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-success.php'; |
|
| 308 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/listing-success.php'; |
|
| 309 | 309 | /** |
| 310 | 310 | * Filter the success template path. |
| 311 | 311 | * |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | |
| 321 | 321 | $template = geodir_locate_template('detail');
|
| 322 | 322 | |
| 323 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php'; |
|
| 323 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/listing-detail.php'; |
|
| 324 | 324 | /** |
| 325 | 325 | * Filter the detail template path. |
| 326 | 326 | * |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | |
| 336 | 336 | $template = geodir_locate_template('listing');
|
| 337 | 337 | |
| 338 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-listing.php'; |
|
| 338 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-listing.php'; |
|
| 339 | 339 | /** |
| 340 | 340 | * Filter the listing template path. |
| 341 | 341 | * |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | |
| 351 | 351 | $template = geodir_locate_template('search');
|
| 352 | 352 | |
| 353 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-search.php'; |
|
| 353 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-search.php'; |
|
| 354 | 354 | /** |
| 355 | 355 | * Filter the search template path. |
| 356 | 356 | * |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | |
| 366 | 366 | $template = geodir_locate_template('author');
|
| 367 | 367 | |
| 368 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-author.php'; |
|
| 368 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-author.php'; |
|
| 369 | 369 | /** |
| 370 | 370 | * Filter the author template path. |
| 371 | 371 | * |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | |
| 377 | 377 | } |
| 378 | 378 | |
| 379 | - if ( geodir_is_page('home') || geodir_is_page('location')) {
|
|
| 379 | + if (geodir_is_page('home') || geodir_is_page('location')) {
|
|
| 380 | 380 | |
| 381 | 381 | global $post, $wp_query; |
| 382 | 382 | |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | |
| 387 | 387 | $template = geodir_locate_template('geodir-home');
|
| 388 | 388 | |
| 389 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-home.php'; |
|
| 389 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-home.php'; |
|
| 390 | 390 | /** |
| 391 | 391 | * Filter the home page template path. |
| 392 | 392 | * |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | |
| 400 | 400 | $template = geodir_locate_template('location');
|
| 401 | 401 | |
| 402 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-location.php'; |
|
| 402 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-location.php'; |
|
| 403 | 403 | /** |
| 404 | 404 | * Filter the location template path. |
| 405 | 405 | * |
@@ -441,7 +441,7 @@ discard block |
||
| 441 | 441 | */ |
| 442 | 442 | do_action("geodir_get_template_part_{$slug}", $slug, $name);
|
| 443 | 443 | $templates = array(); |
| 444 | - $name = (string)$name; |
|
| 444 | + $name = (string) $name; |
|
| 445 | 445 | if ('' !== $name) {
|
| 446 | 446 | $template_name = "{$slug}-{$name}.php";
|
| 447 | 447 | |
@@ -449,14 +449,14 @@ discard block |
||
| 449 | 449 | $template_name = "{$slug}.php";
|
| 450 | 450 | } |
| 451 | 451 | |
| 452 | - if (!locate_template(array("geodirectory/" . $template_name))) :
|
|
| 452 | + if (!locate_template(array("geodirectory/".$template_name))) :
|
|
| 453 | 453 | /** |
| 454 | 454 | * Filter the template part with slug and name. |
| 455 | 455 | * |
| 456 | 456 | * @since 1.0.0 |
| 457 | 457 | * @param string $template_name The template name. |
| 458 | 458 | */ |
| 459 | - $template = apply_filters("geodir_template_part-{$slug}-{$name}", geodir_plugin_path() . '/geodirectory-templates/' . $template_name);
|
|
| 459 | + $template = apply_filters("geodir_template_part-{$slug}-{$name}", geodir_plugin_path().'/geodirectory-templates/'.$template_name);
|
|
| 460 | 460 | /** |
| 461 | 461 | * Includes the template part with slug and name. |
| 462 | 462 | * |
@@ -464,7 +464,7 @@ discard block |
||
| 464 | 464 | */ |
| 465 | 465 | include($template); |
| 466 | 466 | else: |
| 467 | - locate_template(array("geodirectory/" . $template_name), true, false);
|
|
| 467 | + locate_template(array("geodirectory/".$template_name), true, false);
|
|
| 468 | 468 | endif; |
| 469 | 469 | |
| 470 | 470 | } |
@@ -492,9 +492,9 @@ discard block |
||
| 492 | 492 | $gdp_post_type = $gdp_post_type != '' && !empty($all_postypes) && in_array($gdp_post_type, $all_postypes) ? $gdp_post_type : NULL; |
| 493 | 493 | |
| 494 | 494 | if ($gdp_post_id && $gdp_post_type) {
|
| 495 | - $append_class = 'gd-post-' . $gdp_post_type; |
|
| 495 | + $append_class = 'gd-post-'.$gdp_post_type; |
|
| 496 | 496 | $append_class .= isset($post->is_featured) && $post->is_featured > 0 ? ' gd-post-featured' : ''; |
| 497 | - $class = $class != '' ? $class . ' ' . $append_class : $append_class; |
|
| 497 | + $class = $class != '' ? $class.' '.$append_class : $append_class; |
|
| 498 | 498 | } |
| 499 | 499 | |
| 500 | 500 | return $class; |
@@ -526,7 +526,7 @@ discard block |
||
| 526 | 526 | */ |
| 527 | 527 | $message = apply_filters('geodir_message_listing_not_found', $message, $template_listview, $favorite);
|
| 528 | 528 | |
| 529 | - echo '<li class="no-listing">' . $message . '</li>'; |
|
| 529 | + echo '<li class="no-listing">'.$message.'</li>'; |
|
| 530 | 530 | } |
| 531 | 531 | |
| 532 | 532 | /** |
@@ -555,7 +555,7 @@ discard block |
||
| 555 | 555 | function geodir_convert_listing_view_class($columns = '') {
|
| 556 | 556 | $class = ''; |
| 557 | 557 | |
| 558 | - switch ((int)$columns) {
|
|
| 558 | + switch ((int) $columns) {
|
|
| 559 | 559 | case 1: |
| 560 | 560 | $class = ''; |
| 561 | 561 | break; |
@@ -620,7 +620,7 @@ discard block |
||
| 620 | 620 | $html .= '<option value=""></option>'; |
| 621 | 621 | if (!empty($star_texts) && is_array($star_texts)) {
|
| 622 | 622 | foreach ($star_texts as $i => $text) {
|
| 623 | - $html .= '<option ' . selected((int)($i + 1), (int)$default, false) . ' value="' . (int)($i + 1) . '">' . $text . '</option>'; |
|
| 623 | + $html .= '<option '.selected((int) ($i + 1), (int) $default, false).' value="'.(int) ($i + 1).'">'.$text.'</option>'; |
|
| 624 | 624 | } |
| 625 | 625 | } else {
|
| 626 | 626 | $html .= '<option value="1">1</option>'; |
@@ -649,14 +649,14 @@ discard block |
||
| 649 | 649 | function geodir_font_awesome_rating_stars_html($html, $rating, $star_count = 5) {
|
| 650 | 650 | if (get_option('geodir_reviewrating_enable_font_awesome') == '1') {
|
| 651 | 651 | $rating = min($rating, $star_count); |
| 652 | - $full_stars = floor( $rating ); |
|
| 653 | - $half_stars = ceil( $rating - $full_stars ); |
|
| 652 | + $full_stars = floor($rating); |
|
| 653 | + $half_stars = ceil($rating - $full_stars); |
|
| 654 | 654 | $empty_stars = $star_count - $full_stars - $half_stars; |
| 655 | 655 | |
| 656 | 656 | $html = '<div class="gd-star-rating gd-fa-star-rating">'; |
| 657 | - $html .= str_repeat( '<i class="fas fa-star gd-full-star"></i>', $full_stars ); |
|
| 658 | - $html .= str_repeat( '<i class="fas fa-star-half-alt gd-half-star"></i>', $half_stars ); |
|
| 659 | - $html .= str_repeat( '<i class="far fa-star gd-empty-star"></i>', $empty_stars); |
|
| 657 | + $html .= str_repeat('<i class="fas fa-star gd-full-star"></i>', $full_stars);
|
|
| 658 | + $html .= str_repeat('<i class="fas fa-star-half-alt gd-half-star"></i>', $half_stars);
|
|
| 659 | + $html .= str_repeat('<i class="far fa-star gd-empty-star"></i>', $empty_stars);
|
|
| 660 | 660 | $html .= '</div>'; |
| 661 | 661 | } |
| 662 | 662 | |
@@ -675,48 +675,48 @@ discard block |
||
| 675 | 675 | $full_color = get_option('geodir_reviewrating_fa_full_rating_color', '#757575');
|
| 676 | 676 | if ($full_color != '#757575') {
|
| 677 | 677 | echo '<style type="text/css">.br-theme-fontawesome-stars .br-widget a.br-active,.br-theme-fontawesome-stars .br-widget a.br-selected, |
| 678 | - .gd-star-rating i,.gd-star-rating svg {color:' . stripslashes($full_color) . '!important;}</style>';
|
|
| 678 | + .gd-star-rating i,.gd-star-rating svg {color:' . stripslashes($full_color).'!important;}</style>';
|
|
| 679 | 679 | } |
| 680 | 680 | } |
| 681 | 681 | } |
| 682 | 682 | |
| 683 | -function geodir_parse_shortcodes( $content, $shortcode, $first = true ) {
|
|
| 684 | - if ( empty( $content ) || empty( $shortcode ) ) {
|
|
| 683 | +function geodir_parse_shortcodes($content, $shortcode, $first = true) {
|
|
| 684 | + if (empty($content) || empty($shortcode)) {
|
|
| 685 | 685 | return array(); |
| 686 | 686 | } |
| 687 | 687 | |
| 688 | - if ( false === strpos( $content, '[' ) ) {
|
|
| 688 | + if (false === strpos($content, '[')) {
|
|
| 689 | 689 | return array(); |
| 690 | 690 | } |
| 691 | 691 | |
| 692 | - if ( ! has_shortcode( $content, $shortcode ) ) {
|
|
| 692 | + if (!has_shortcode($content, $shortcode)) {
|
|
| 693 | 693 | return array(); |
| 694 | 694 | } |
| 695 | 695 | |
| 696 | 696 | $shortcodes = array(); |
| 697 | - if ( preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ) ) {
|
|
| 698 | - foreach ( $matches as $match ) {
|
|
| 699 | - if ( $shortcode === $match[2] ) {
|
|
| 700 | - $shortcode_attrs = shortcode_parse_atts( $match[3] ); |
|
| 701 | - if ( ! is_array( $shortcode_attrs ) ) {
|
|
| 697 | + if (preg_match_all('/'.get_shortcode_regex().'/s', $content, $matches, PREG_SET_ORDER)) {
|
|
| 698 | + foreach ($matches as $match) {
|
|
| 699 | + if ($shortcode === $match[2]) {
|
|
| 700 | + $shortcode_attrs = shortcode_parse_atts($match[3]); |
|
| 701 | + if (!is_array($shortcode_attrs)) {
|
|
| 702 | 702 | $shortcode_attrs = array(); |
| 703 | 703 | } |
| 704 | 704 | $shortcode_attrs['shortcode_tag'] = $shortcode; |
| 705 | - if ( !empty( $match[5] ) ) {
|
|
| 705 | + if (!empty($match[5])) {
|
|
| 706 | 706 | $shortcode_attrs['shortcode_content'] = $match[5]; |
| 707 | 707 | } |
| 708 | 708 | $shortcodes[] = $shortcode_attrs; |
| 709 | - if ( $first === true ) {
|
|
| 709 | + if ($first === true) {
|
|
| 710 | 710 | break; |
| 711 | 711 | } |
| 712 | 712 | } |
| 713 | 713 | } |
| 714 | - if ( $first === true && !empty( $shortcodes ) ) {
|
|
| 714 | + if ($first === true && !empty($shortcodes)) {
|
|
| 715 | 715 | $shortcodes = $shortcodes[0]; |
| 716 | 716 | } |
| 717 | 717 | } |
| 718 | 718 | |
| 719 | - return apply_filters( 'geodir_parse_shortcodes', $shortcodes, $content, $shortcode, $first ); |
|
| 719 | + return apply_filters('geodir_parse_shortcodes', $shortcodes, $content, $shortcode, $first);
|
|
| 720 | 720 | } |
| 721 | 721 | |
| 722 | 722 | /** |
@@ -730,14 +730,14 @@ discard block |
||
| 730 | 730 | * @param array $email_vars The email parameters. |
| 731 | 731 | * @return string Filtered email message. |
| 732 | 732 | */ |
| 733 | -function geodir_email_wrap_message( $message, $email_type = '', $email_vars = array() ) {
|
|
| 733 | +function geodir_email_wrap_message($message, $email_type = '', $email_vars = array()) {
|
|
| 734 | 734 | global $geodir_email_content, $geodir_email_type, $geodir_email_vars; |
| 735 | 735 | |
| 736 | 736 | $geodir_email_content = $message; |
| 737 | 737 | $geodir_email_type = $email_type; |
| 738 | 738 | $geodir_email_vars = $email_vars; |
| 739 | 739 | |
| 740 | - $template = apply_filters( "geodir_template_part-email-content", geodir_locate_template( 'email-message' ) ); |
|
| 740 | + $template = apply_filters("geodir_template_part-email-content", geodir_locate_template('email-message'));
|
|
| 741 | 741 | |
| 742 | 742 | ob_start(); |
| 743 | 743 | /** |
@@ -745,7 +745,7 @@ discard block |
||
| 745 | 745 | * |
| 746 | 746 | * @since 1.6.26 |
| 747 | 747 | */ |
| 748 | - include( $template ); |
|
| 748 | + include($template); |
|
| 749 | 749 | |
| 750 | 750 | $content = ob_get_clean(); |
| 751 | 751 | |
@@ -770,7 +770,7 @@ discard block |
||
| 770 | 770 | * @param string $post_id The post ID. |
| 771 | 771 | * @param string $user_id The user ID. |
| 772 | 772 | */ |
| 773 | -function geodir_email_wrap_user_message( $message, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id ) {
|
|
| 773 | +function geodir_email_wrap_user_message($message, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id) {
|
|
| 774 | 774 | $email_vars = array(); |
| 775 | 775 | $email_vars['message_type'] = $message_type; |
| 776 | 776 | $email_vars['fromEmail'] = $fromEmail; |
@@ -783,9 +783,9 @@ discard block |
||
| 783 | 783 | $email_vars['post_id'] = $post_id; |
| 784 | 784 | $email_vars['user_id'] = $user_id; |
| 785 | 785 | |
| 786 | - return geodir_email_wrap_message( $message, $message_type, $email_vars ); |
|
| 786 | + return geodir_email_wrap_message($message, $message_type, $email_vars); |
|
| 787 | 787 | } |
| 788 | -add_filter( 'geodir_sendEmail_message', 'geodir_email_wrap_user_message', 10, 11 ); |
|
| 788 | +add_filter('geodir_sendEmail_message', 'geodir_email_wrap_user_message', 10, 11);
|
|
| 789 | 789 | |
| 790 | 790 | /** |
| 791 | 791 | * Filter the admin email message. |
@@ -799,13 +799,13 @@ discard block |
||
| 799 | 799 | * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'. |
| 800 | 800 | * @param string $custom_1 Custom data to be sent. |
| 801 | 801 | */ |
| 802 | -function geodir_email_wrap_admin_message( $message, $page_id, $user_id, $message_type, $custom_1 ) {
|
|
| 802 | +function geodir_email_wrap_admin_message($message, $page_id, $user_id, $message_type, $custom_1) {
|
|
| 803 | 803 | $email_vars = array(); |
| 804 | 804 | $email_vars['message_type'] = $message_type; |
| 805 | 805 | $email_vars['page_id'] = $page_id; |
| 806 | 806 | $email_vars['user_id'] = $user_id; |
| 807 | 807 | $email_vars['custom_1'] = $custom_1; |
| 808 | 808 | |
| 809 | - return geodir_email_wrap_message( $message, $message_type, $email_vars ); |
|
| 809 | + return geodir_email_wrap_message($message, $message_type, $email_vars); |
|
| 810 | 810 | } |
| 811 | -add_filter( 'geodir_adminEmail_message', 'geodir_email_wrap_admin_message', 10, 5 ); |
|
| 812 | 811 | \ No newline at end of file |
| 812 | +add_filter('geodir_adminEmail_message', 'geodir_email_wrap_admin_message', 10, 5); |
|
| 813 | 813 | \ No newline at end of file |