@@ -19,149 +19,149 @@ discard block |
||
| 19 | 19 | * @global string $dummy_image_path The dummy image path. |
| 20 | 20 | */ |
| 21 | 21 | function geodir_dummy_data_taxonomies($post_type,$category_array) { |
| 22 | - global $wpdb, $dummy_image_path; |
|
| 22 | + global $wpdb, $dummy_image_path; |
|
| 23 | 23 | |
| 24 | 24 | |
| 25 | 25 | |
| 26 | - $last_catid = ''; |
|
| 26 | + $last_catid = ''; |
|
| 27 | 27 | |
| 28 | - $uploads = wp_upload_dir(); // Array of key => value pairs |
|
| 28 | + $uploads = wp_upload_dir(); // Array of key => value pairs |
|
| 29 | 29 | |
| 30 | - for ($i = 0; $i < count($category_array); $i++) { |
|
| 31 | - $parent_catid = 0; |
|
| 32 | - if (is_array($category_array[$i])) { |
|
| 33 | - $cat_name_arr = $category_array[$i]; |
|
| 34 | - for ($j = 0; $j < count($cat_name_arr); $j++) { |
|
| 35 | - $catname = $cat_name_arr[$j]; |
|
| 30 | + for ($i = 0; $i < count($category_array); $i++) { |
|
| 31 | + $parent_catid = 0; |
|
| 32 | + if (is_array($category_array[$i])) { |
|
| 33 | + $cat_name_arr = $category_array[$i]; |
|
| 34 | + for ($j = 0; $j < count($cat_name_arr); $j++) { |
|
| 35 | + $catname = $cat_name_arr[$j]; |
|
| 36 | 36 | |
| 37 | - if (!term_exists($catname, $post_type.'category')) { |
|
| 38 | - $last_catid = wp_insert_term($catname, $post_type.'category', $args = array('parent' => $parent_catid)); |
|
| 37 | + if (!term_exists($catname, $post_type.'category')) { |
|
| 38 | + $last_catid = wp_insert_term($catname, $post_type.'category', $args = array('parent' => $parent_catid)); |
|
| 39 | 39 | |
| 40 | - if ($j == 0) { |
|
| 41 | - $parent_catid = $last_catid; |
|
| 42 | - } |
|
| 40 | + if ($j == 0) { |
|
| 41 | + $parent_catid = $last_catid; |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | 44 | |
| 45 | - if (geodir_dummy_folder_exists()) |
|
| 46 | - $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon"; |
|
| 47 | - else |
|
| 48 | - $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon'; |
|
| 45 | + if (geodir_dummy_folder_exists()) |
|
| 46 | + $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon"; |
|
| 47 | + else |
|
| 48 | + $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon'; |
|
| 49 | 49 | |
| 50 | - $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url); |
|
| 50 | + $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url); |
|
| 51 | 51 | |
| 52 | - $catname = str_replace(' ', '_', $catname); |
|
| 53 | - $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png"); |
|
| 52 | + $catname = str_replace(' ', '_', $catname); |
|
| 53 | + $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png"); |
|
| 54 | 54 | |
| 55 | - if (empty($uploaded['error'])) { |
|
| 56 | - $new_path = $uploaded['file']; |
|
| 57 | - $new_url = $uploaded['url']; |
|
| 58 | - } |
|
| 55 | + if (empty($uploaded['error'])) { |
|
| 56 | + $new_path = $uploaded['file']; |
|
| 57 | + $new_url = $uploaded['url']; |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - $wp_filetype = wp_check_filetype(basename($new_path), null); |
|
| 61 | - |
|
| 62 | - $attachment = array( |
|
| 63 | - 'guid' => $uploads['baseurl'] . '/' . basename($new_path), |
|
| 64 | - 'post_mime_type' => $wp_filetype['type'], |
|
| 65 | - 'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)), |
|
| 66 | - 'post_content' => '', |
|
| 67 | - 'post_status' => 'inherit' |
|
| 68 | - ); |
|
| 69 | - $attach_id = wp_insert_attachment($attachment, $new_path); |
|
| 70 | - |
|
| 71 | - // you must first include the image.php file |
|
| 72 | - // for the function wp_generate_attachment_metadata() to work |
|
| 73 | - require_once(ABSPATH . 'wp-admin/includes/image.php'); |
|
| 74 | - $attach_data = wp_generate_attachment_metadata($attach_id, $new_path); |
|
| 75 | - wp_update_attachment_metadata($attach_id, $attach_data); |
|
| 76 | - |
|
| 77 | - if (!get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, $post_type)) { |
|
| 78 | - update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => 'icon', 'src' => $new_url), $post_type); |
|
| 79 | - } |
|
| 80 | - } |
|
| 81 | - } |
|
| 60 | + $wp_filetype = wp_check_filetype(basename($new_path), null); |
|
| 82 | 61 | |
| 83 | - } else { |
|
| 84 | - $catname = $category_array[$i]; |
|
| 62 | + $attachment = array( |
|
| 63 | + 'guid' => $uploads['baseurl'] . '/' . basename($new_path), |
|
| 64 | + 'post_mime_type' => $wp_filetype['type'], |
|
| 65 | + 'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)), |
|
| 66 | + 'post_content' => '', |
|
| 67 | + 'post_status' => 'inherit' |
|
| 68 | + ); |
|
| 69 | + $attach_id = wp_insert_attachment($attachment, $new_path); |
|
| 85 | 70 | |
| 86 | - if (!term_exists($catname, $post_type.'category')) { |
|
| 87 | - $last_catid = wp_insert_term($catname, $post_type.'category'); |
|
| 71 | + // you must first include the image.php file |
|
| 72 | + // for the function wp_generate_attachment_metadata() to work |
|
| 73 | + require_once(ABSPATH . 'wp-admin/includes/image.php'); |
|
| 74 | + $attach_data = wp_generate_attachment_metadata($attach_id, $new_path); |
|
| 75 | + wp_update_attachment_metadata($attach_id, $attach_data); |
|
| 88 | 76 | |
| 89 | - if (geodir_dummy_folder_exists()) |
|
| 90 | - $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon"; |
|
| 91 | - else |
|
| 92 | - $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon'; |
|
| 77 | + if (!get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, $post_type)) { |
|
| 78 | + update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => 'icon', 'src' => $new_url), $post_type); |
|
| 79 | + } |
|
| 80 | + } |
|
| 81 | + } |
|
| 93 | 82 | |
| 94 | - $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url); |
|
| 83 | + } else { |
|
| 84 | + $catname = $category_array[$i]; |
|
| 95 | 85 | |
| 96 | - $catname = str_replace(' ', '_', $catname); |
|
| 97 | - $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png"); |
|
| 86 | + if (!term_exists($catname, $post_type.'category')) { |
|
| 87 | + $last_catid = wp_insert_term($catname, $post_type.'category'); |
|
| 98 | 88 | |
| 99 | - if (empty($uploaded['error'])) { |
|
| 100 | - $new_path = $uploaded['file']; |
|
| 101 | - $new_url = $uploaded['url']; |
|
| 102 | - } |
|
| 89 | + if (geodir_dummy_folder_exists()) |
|
| 90 | + $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon"; |
|
| 91 | + else |
|
| 92 | + $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon'; |
|
| 103 | 93 | |
| 104 | - $wp_filetype = wp_check_filetype(basename($new_path), null); |
|
| 94 | + $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url); |
|
| 105 | 95 | |
| 106 | - $attachment = array( |
|
| 107 | - 'guid' => $uploads['baseurl'] . '/' . basename($new_path), |
|
| 108 | - 'post_mime_type' => $wp_filetype['type'], |
|
| 109 | - 'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)), |
|
| 110 | - 'post_content' => '', |
|
| 111 | - 'post_status' => 'inherit' |
|
| 112 | - ); |
|
| 96 | + $catname = str_replace(' ', '_', $catname); |
|
| 97 | + $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png"); |
|
| 113 | 98 | |
| 114 | - $attach_id = wp_insert_attachment($attachment, $new_path); |
|
| 99 | + if (empty($uploaded['error'])) { |
|
| 100 | + $new_path = $uploaded['file']; |
|
| 101 | + $new_url = $uploaded['url']; |
|
| 102 | + } |
|
| 115 | 103 | |
| 104 | + $wp_filetype = wp_check_filetype(basename($new_path), null); |
|
| 116 | 105 | |
| 117 | - // you must first include the image.php file |
|
| 118 | - // for the function wp_generate_attachment_metadata() to work |
|
| 119 | - require_once(ABSPATH . 'wp-admin/includes/image.php'); |
|
| 120 | - $attach_data = wp_generate_attachment_metadata($attach_id, $new_path); |
|
| 121 | - wp_update_attachment_metadata($attach_id, $attach_data); |
|
| 106 | + $attachment = array( |
|
| 107 | + 'guid' => $uploads['baseurl'] . '/' . basename($new_path), |
|
| 108 | + 'post_mime_type' => $wp_filetype['type'], |
|
| 109 | + 'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)), |
|
| 110 | + 'post_content' => '', |
|
| 111 | + 'post_status' => 'inherit' |
|
| 112 | + ); |
|
| 113 | + |
|
| 114 | + $attach_id = wp_insert_attachment($attachment, $new_path); |
|
| 122 | 115 | |
| 123 | - if (!get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, $post_type)) { |
|
| 124 | - update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => $attach_id, 'src' => $new_url), $post_type); |
|
| 125 | - } |
|
| 126 | - } |
|
| 127 | - } |
|
| 128 | 116 | |
| 129 | - } |
|
| 117 | + // you must first include the image.php file |
|
| 118 | + // for the function wp_generate_attachment_metadata() to work |
|
| 119 | + require_once(ABSPATH . 'wp-admin/includes/image.php'); |
|
| 120 | + $attach_data = wp_generate_attachment_metadata($attach_id, $new_path); |
|
| 121 | + wp_update_attachment_metadata($attach_id, $attach_data); |
|
| 122 | + |
|
| 123 | + if (!get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, $post_type)) { |
|
| 124 | + update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => $attach_id, 'src' => $new_url), $post_type); |
|
| 125 | + } |
|
| 126 | + } |
|
| 127 | + } |
|
| 128 | + |
|
| 129 | + } |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | |
| 133 | 133 | function geodir_dummy_data_types(){ |
| 134 | - return array( |
|
| 135 | - 'standard_places' => array( |
|
| 136 | - 'name'=>__('Default','geodirectory'), |
|
| 137 | - 'count'=> 30 |
|
| 138 | - ), |
|
| 139 | - 'property_sale' => array( |
|
| 140 | - 'name'=>__('Property for sale','geodirectory'), |
|
| 141 | - 'count'=> 10 |
|
| 142 | - ), |
|
| 143 | - 'property_rent' => array( |
|
| 144 | - 'name'=>__('Property for rent','geodirectory'), |
|
| 145 | - 'count'=> 10 |
|
| 146 | - ) |
|
| 147 | - ); |
|
| 134 | + return array( |
|
| 135 | + 'standard_places' => array( |
|
| 136 | + 'name'=>__('Default','geodirectory'), |
|
| 137 | + 'count'=> 30 |
|
| 138 | + ), |
|
| 139 | + 'property_sale' => array( |
|
| 140 | + 'name'=>__('Property for sale','geodirectory'), |
|
| 141 | + 'count'=> 10 |
|
| 142 | + ), |
|
| 143 | + 'property_rent' => array( |
|
| 144 | + 'name'=>__('Property for rent','geodirectory'), |
|
| 145 | + 'count'=> 10 |
|
| 146 | + ) |
|
| 147 | + ); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | |
| 151 | 151 | function geodir_create_dummy_fields($fields) |
| 152 | 152 | { |
| 153 | 153 | |
| 154 | - /** |
|
| 155 | - * Filter the array of default custom fields DB table data. |
|
| 156 | - * |
|
| 157 | - * @since 1.0.0 |
|
| 158 | - * @param string $fields The default custom fields as an array. |
|
| 159 | - */ |
|
| 160 | - $fields = apply_filters('geodir_before_dummy_custom_fields_saved', $fields); |
|
| 161 | - foreach ($fields as $field_index => $field) { |
|
| 162 | - geodir_custom_field_save($field); |
|
| 163 | - |
|
| 164 | - } |
|
| 154 | + /** |
|
| 155 | + * Filter the array of default custom fields DB table data. |
|
| 156 | + * |
|
| 157 | + * @since 1.0.0 |
|
| 158 | + * @param string $fields The default custom fields as an array. |
|
| 159 | + */ |
|
| 160 | + $fields = apply_filters('geodir_before_dummy_custom_fields_saved', $fields); |
|
| 161 | + foreach ($fields as $field_index => $field) { |
|
| 162 | + geodir_custom_field_save($field); |
|
| 163 | + |
|
| 164 | + } |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | /** |
@@ -174,20 +174,20 @@ discard block |
||
| 174 | 174 | */ |
| 175 | 175 | function geodir_delete_dummy_posts($post_type,$data_type) |
| 176 | 176 | { |
| 177 | - global $wpdb, $plugin_prefix; |
|
| 177 | + global $wpdb, $plugin_prefix; |
|
| 178 | 178 | |
| 179 | 179 | |
| 180 | - $post_ids = $wpdb->get_results("SELECT post_id FROM " . $plugin_prefix . $post_type."_detail WHERE post_dummy='1'"); |
|
| 180 | + $post_ids = $wpdb->get_results("SELECT post_id FROM " . $plugin_prefix . $post_type."_detail WHERE post_dummy='1'"); |
|
| 181 | 181 | |
| 182 | 182 | |
| 183 | - foreach ($post_ids as $post_ids_obj) { |
|
| 184 | - wp_delete_post($post_ids_obj->post_id); |
|
| 185 | - } |
|
| 183 | + foreach ($post_ids as $post_ids_obj) { |
|
| 184 | + wp_delete_post($post_ids_obj->post_id); |
|
| 185 | + } |
|
| 186 | 186 | |
| 187 | - //double check posts are deleted |
|
| 188 | - $wpdb->get_results("DELETE FROM " . $plugin_prefix . $post_type. "_detail WHERE post_dummy='1'"); |
|
| 187 | + //double check posts are deleted |
|
| 188 | + $wpdb->get_results("DELETE FROM " . $plugin_prefix . $post_type. "_detail WHERE post_dummy='1'"); |
|
| 189 | 189 | |
| 190 | - update_option($post_type.'_dummy_data_type',''); |
|
| 190 | + update_option($post_type.'_dummy_data_type',''); |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | /** |
@@ -201,78 +201,78 @@ discard block |
||
| 201 | 201 | function geodir_insert_dummy_posts($post_type,$data_type,$item_index) |
| 202 | 202 | { |
| 203 | 203 | |
| 204 | - ini_set('max_execution_time', 999999); //300 seconds = 5 minutes |
|
| 205 | - $data_types = geodir_dummy_data_types(); |
|
| 206 | - |
|
| 207 | - $total_count = 0; |
|
| 208 | - global $dummy_post_index; |
|
| 209 | - $dummy_post_index = $item_index; |
|
| 210 | - foreach( $data_types as $key=>$val){ |
|
| 211 | - if($key==$data_type){ |
|
| 212 | - $total_count = $val['count']; |
|
| 213 | - if($key=='standard_places'){ |
|
| 214 | - /** |
|
| 215 | - * Contains dummy post content. |
|
| 216 | - * |
|
| 217 | - * @since 1.0.0 |
|
| 218 | - * @package GeoDirectory |
|
| 219 | - */ |
|
| 220 | - include_once( 'dummy-data/standard_places.php' ); |
|
| 221 | - }elseif($key=='property_sale'){ |
|
| 222 | - /** |
|
| 223 | - * Contains dummy property for sale post content. |
|
| 224 | - * |
|
| 225 | - * @since 1.6.11 |
|
| 226 | - * @package GeoDirectory |
|
| 227 | - */ |
|
| 228 | - include_once( 'dummy-data/property_sale.php' ); |
|
| 229 | - }elseif($key=='property_rent'){ |
|
| 230 | - /** |
|
| 231 | - * Contains dummy property for sale post content. |
|
| 232 | - * |
|
| 233 | - * @since 1.6.11 |
|
| 234 | - * @package GeoDirectory |
|
| 235 | - */ |
|
| 236 | - include_once( 'dummy-data/property_rent.php' ); |
|
| 237 | - } |
|
| 238 | - |
|
| 239 | - } |
|
| 240 | - |
|
| 241 | - do_action('geodir_insert_dummy_data_loop',$post_type,$data_type,$item_index); |
|
| 242 | - } |
|
| 243 | - |
|
| 244 | - |
|
| 245 | - |
|
| 246 | - // delete image cache on last entry |
|
| 247 | - if($total_count == $item_index){ |
|
| 248 | - delete_transient( 'cached_dummy_images' ); |
|
| 249 | - flush_rewrite_rules(); |
|
| 250 | - } |
|
| 204 | + ini_set('max_execution_time', 999999); //300 seconds = 5 minutes |
|
| 205 | + $data_types = geodir_dummy_data_types(); |
|
| 206 | + |
|
| 207 | + $total_count = 0; |
|
| 208 | + global $dummy_post_index; |
|
| 209 | + $dummy_post_index = $item_index; |
|
| 210 | + foreach( $data_types as $key=>$val){ |
|
| 211 | + if($key==$data_type){ |
|
| 212 | + $total_count = $val['count']; |
|
| 213 | + if($key=='standard_places'){ |
|
| 214 | + /** |
|
| 215 | + * Contains dummy post content. |
|
| 216 | + * |
|
| 217 | + * @since 1.0.0 |
|
| 218 | + * @package GeoDirectory |
|
| 219 | + */ |
|
| 220 | + include_once( 'dummy-data/standard_places.php' ); |
|
| 221 | + }elseif($key=='property_sale'){ |
|
| 222 | + /** |
|
| 223 | + * Contains dummy property for sale post content. |
|
| 224 | + * |
|
| 225 | + * @since 1.6.11 |
|
| 226 | + * @package GeoDirectory |
|
| 227 | + */ |
|
| 228 | + include_once( 'dummy-data/property_sale.php' ); |
|
| 229 | + }elseif($key=='property_rent'){ |
|
| 230 | + /** |
|
| 231 | + * Contains dummy property for sale post content. |
|
| 232 | + * |
|
| 233 | + * @since 1.6.11 |
|
| 234 | + * @package GeoDirectory |
|
| 235 | + */ |
|
| 236 | + include_once( 'dummy-data/property_rent.php' ); |
|
| 237 | + } |
|
| 238 | + |
|
| 239 | + } |
|
| 240 | + |
|
| 241 | + do_action('geodir_insert_dummy_data_loop',$post_type,$data_type,$item_index); |
|
| 242 | + } |
|
| 243 | + |
|
| 244 | + |
|
| 245 | + |
|
| 246 | + // delete image cache on last entry |
|
| 247 | + if($total_count == $item_index){ |
|
| 248 | + delete_transient( 'cached_dummy_images' ); |
|
| 249 | + flush_rewrite_rules(); |
|
| 250 | + } |
|
| 251 | 251 | |
| 252 | 252 | |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | |
| 256 | 256 | if (!function_exists('geodir_autoinstall_admin_header') && (get_option('geodir_installed') || defined( 'GD_TESTING_MODE' ))) { |
| 257 | - /** |
|
| 258 | - * GeoDirectory dummy data installation. |
|
| 259 | - * |
|
| 260 | - * @since 1.0.0 |
|
| 261 | - * @package GeoDirectory |
|
| 262 | - * @global object $wpdb WordPress Database object. |
|
| 263 | - * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 264 | - * @param string $post_type The post type. |
|
| 265 | - */ |
|
| 266 | - function geodir_autoinstall_admin_header($post_type = 'gd_place') |
|
| 267 | - { |
|
| 268 | - |
|
| 269 | - global $wpdb, $plugin_prefix; |
|
| 270 | - |
|
| 271 | - if (!geodir_is_default_location_set()) { |
|
| 272 | - echo '<div class="updated fade"><p><strong>' . sprintf(__('Please %sclick here%s to set a default location, this will help to set location of all dummy data.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>') . '</strong></p></div>'; |
|
| 273 | - } else { |
|
| 274 | - |
|
| 275 | - ?> |
|
| 257 | + /** |
|
| 258 | + * GeoDirectory dummy data installation. |
|
| 259 | + * |
|
| 260 | + * @since 1.0.0 |
|
| 261 | + * @package GeoDirectory |
|
| 262 | + * @global object $wpdb WordPress Database object. |
|
| 263 | + * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 264 | + * @param string $post_type The post type. |
|
| 265 | + */ |
|
| 266 | + function geodir_autoinstall_admin_header($post_type = 'gd_place') |
|
| 267 | + { |
|
| 268 | + |
|
| 269 | + global $wpdb, $plugin_prefix; |
|
| 270 | + |
|
| 271 | + if (!geodir_is_default_location_set()) { |
|
| 272 | + echo '<div class="updated fade"><p><strong>' . sprintf(__('Please %sclick here%s to set a default location, this will help to set location of all dummy data.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>') . '</strong></p></div>'; |
|
| 273 | + } else { |
|
| 274 | + |
|
| 275 | + ?> |
|
| 276 | 276 | <table class="form-table gd-dummy-table"> |
| 277 | 277 | <tbody> |
| 278 | 278 | <tr> |
@@ -283,74 +283,74 @@ discard block |
||
| 283 | 283 | |
| 284 | 284 | <?php |
| 285 | 285 | |
| 286 | - $cpts = geodir_get_posttypes('array'); |
|
| 286 | + $cpts = geodir_get_posttypes('array'); |
|
| 287 | 287 | |
| 288 | - $data_types = geodir_dummy_data_types(); |
|
| 288 | + $data_types = geodir_dummy_data_types(); |
|
| 289 | 289 | |
| 290 | - $nonce = wp_create_nonce('geodir_dummy_posts_insert_noncename'); |
|
| 290 | + $nonce = wp_create_nonce('geodir_dummy_posts_insert_noncename'); |
|
| 291 | 291 | |
| 292 | - foreach($cpts as $post_type=>$cpt){ |
|
| 292 | + foreach($cpts as $post_type=>$cpt){ |
|
| 293 | 293 | |
| 294 | - $data_types_for = apply_filters('geodir_dummy_date_types_for',$data_types,$post_type); |
|
| 294 | + $data_types_for = apply_filters('geodir_dummy_date_types_for',$data_types,$post_type); |
|
| 295 | 295 | |
| 296 | 296 | |
| 297 | - $set_dt = get_option($post_type.'_dummy_data_type'); |
|
| 297 | + $set_dt = get_option($post_type.'_dummy_data_type'); |
|
| 298 | 298 | |
| 299 | - geodir_add_column_if_not_exist($plugin_prefix . $post_type. "_detail", 'post_dummy', "enum( '1', '0' ) NULL DEFAULT '0'"); |
|
| 299 | + geodir_add_column_if_not_exist($plugin_prefix . $post_type. "_detail", 'post_dummy', "enum( '1', '0' ) NULL DEFAULT '0'"); |
|
| 300 | 300 | |
| 301 | - $post_counts = $wpdb->get_var("SELECT count(post_id) FROM " . $plugin_prefix . $post_type . "_detail WHERE post_dummy='1'"); |
|
| 301 | + $post_counts = $wpdb->get_var("SELECT count(post_id) FROM " . $plugin_prefix . $post_type . "_detail WHERE post_dummy='1'"); |
|
| 302 | 302 | |
| 303 | - echo "<tr>"; |
|
| 304 | - echo "<td><strong>".$cpt['labels']['name']."</strong></td>"; |
|
| 303 | + echo "<tr>"; |
|
| 304 | + echo "<td><strong>".$cpt['labels']['name']."</strong></td>"; |
|
| 305 | 305 | |
| 306 | 306 | |
| 307 | - $select_disabled = $post_counts > 0 ? 'disabled' : ''; |
|
| 308 | - echo "<td>"; |
|
| 309 | - echo "<select id='".$post_type."_data_type' onchange='geodir_dummy_set_count(this,\"$post_type\");' $select_disabled>"; |
|
| 310 | - foreach($data_types_for as $key=>$val){ |
|
| 311 | - $selected = ($key==$set_dt) ? "selected='selected'" : ''; |
|
| 312 | - echo "<option $selected value='$key' data-count='".$val['count']."'>".$val['name']."</option>"; |
|
| 313 | - } |
|
| 314 | - echo "</select>"; |
|
| 315 | - |
|
| 316 | - $select_display = $post_counts > 0 ? 'display:none;' : ''; |
|
| 317 | - echo "<select id='".$post_type."_data_type_count' style='$select_display' >"; |
|
| 318 | - $x = 1; |
|
| 319 | - while($x <= $val['count']){ |
|
| 320 | - $selected = ($x==$val['count']) ? "selected='selected'" : ''; |
|
| 321 | - echo "<option $selected value='$x'>".$x."</option>"; |
|
| 322 | - $x++; |
|
| 323 | - } |
|
| 324 | - echo "</select>"; |
|
| 325 | - echo "</td>"; |
|
| 307 | + $select_disabled = $post_counts > 0 ? 'disabled' : ''; |
|
| 308 | + echo "<td>"; |
|
| 309 | + echo "<select id='".$post_type."_data_type' onchange='geodir_dummy_set_count(this,\"$post_type\");' $select_disabled>"; |
|
| 310 | + foreach($data_types_for as $key=>$val){ |
|
| 311 | + $selected = ($key==$set_dt) ? "selected='selected'" : ''; |
|
| 312 | + echo "<option $selected value='$key' data-count='".$val['count']."'>".$val['name']."</option>"; |
|
| 313 | + } |
|
| 314 | + echo "</select>"; |
|
| 326 | 315 | |
| 316 | + $select_display = $post_counts > 0 ? 'display:none;' : ''; |
|
| 317 | + echo "<select id='".$post_type."_data_type_count' style='$select_display' >"; |
|
| 318 | + $x = 1; |
|
| 319 | + while($x <= $val['count']){ |
|
| 320 | + $selected = ($x==$val['count']) ? "selected='selected'" : ''; |
|
| 321 | + echo "<option $selected value='$x'>".$x."</option>"; |
|
| 322 | + $x++; |
|
| 323 | + } |
|
| 324 | + echo "</select>"; |
|
| 325 | + echo "</td>"; |
|
| 327 | 326 | |
| 328 | 327 | |
| 329 | 328 | |
| 330 | 329 | |
| 331 | - if($post_counts > 0){ |
|
| 332 | - echo '<td><input type="button" value="'.__('Remove data','geodirectory').'" class="button-primary geodir_dummy_button gd-remove-data" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>'; |
|
| 333 | - }else{ |
|
| 334 | - echo '<td><input type="button" value="'.__('Insert data','geodirectory').'" class="button-primary geodir_dummy_button" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>'; |
|
| 335 | - } |
|
| 336 | 330 | |
| 337 | - echo "</tr>"; |
|
| 338 | - //print_r($cpt); |
|
| 339 | - } |
|
| 331 | + if($post_counts > 0){ |
|
| 332 | + echo '<td><input type="button" value="'.__('Remove data','geodirectory').'" class="button-primary geodir_dummy_button gd-remove-data" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>'; |
|
| 333 | + }else{ |
|
| 334 | + echo '<td><input type="button" value="'.__('Insert data','geodirectory').'" class="button-primary geodir_dummy_button" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>'; |
|
| 335 | + } |
|
| 336 | + |
|
| 337 | + echo "</tr>"; |
|
| 338 | + //print_r($cpt); |
|
| 339 | + } |
|
| 340 | 340 | |
| 341 | - ?> |
|
| 341 | + ?> |
|
| 342 | 342 | </tbody> |
| 343 | 343 | </table> |
| 344 | 344 | <?php |
| 345 | 345 | |
| 346 | 346 | |
| 347 | - $default_location = geodir_get_default_location(); |
|
| 348 | - $city = isset($default_location->city) ? $default_location->city : ''; |
|
| 349 | - $region = isset($default_location->region) ? $default_location->region : ''; |
|
| 350 | - $country = isset($default_location->country) ? $default_location->country : ''; |
|
| 351 | - $city_latitude = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
| 352 | - $city_longitude = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
| 353 | - ?> |
|
| 347 | + $default_location = geodir_get_default_location(); |
|
| 348 | + $city = isset($default_location->city) ? $default_location->city : ''; |
|
| 349 | + $region = isset($default_location->region) ? $default_location->region : ''; |
|
| 350 | + $country = isset($default_location->country) ? $default_location->country : ''; |
|
| 351 | + $city_latitude = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
| 352 | + $city_longitude = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
| 353 | + ?> |
|
| 354 | 354 | <script type="text/javascript"> |
| 355 | 355 | |
| 356 | 356 | function geodir_dummy_set_count(data,cpt){ |
@@ -560,7 +560,7 @@ discard block |
||
| 560 | 560 | } |
| 561 | 561 | </script> |
| 562 | 562 | <?php |
| 563 | - } |
|
| 564 | - } |
|
| 563 | + } |
|
| 564 | + } |
|
| 565 | 565 | } |
| 566 | 566 | |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | * @global object $wpdb WordPress Database object. |
| 19 | 19 | * @global string $dummy_image_path The dummy image path. |
| 20 | 20 | */ |
| 21 | -function geodir_dummy_data_taxonomies($post_type,$category_array) { |
|
| 21 | +function geodir_dummy_data_taxonomies($post_type, $category_array) { |
|
| 22 | 22 | global $wpdb, $dummy_image_path; |
| 23 | 23 | |
| 24 | 24 | |
@@ -43,14 +43,14 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | |
| 45 | 45 | if (geodir_dummy_folder_exists()) |
| 46 | - $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon"; |
|
| 46 | + $dummy_image_url = geodir_plugin_url()."/geodirectory-admin/dummy/cat_icon"; |
|
| 47 | 47 | else |
| 48 | 48 | $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon'; |
| 49 | 49 | |
| 50 | 50 | $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url); |
| 51 | 51 | |
| 52 | 52 | $catname = str_replace(' ', '_', $catname); |
| 53 | - $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png"); |
|
| 53 | + $uploaded = (array) fetch_remote_file("$dummy_image_url/".$catname.".png"); |
|
| 54 | 54 | |
| 55 | 55 | if (empty($uploaded['error'])) { |
| 56 | 56 | $new_path = $uploaded['file']; |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | $wp_filetype = wp_check_filetype(basename($new_path), null); |
| 61 | 61 | |
| 62 | 62 | $attachment = array( |
| 63 | - 'guid' => $uploads['baseurl'] . '/' . basename($new_path), |
|
| 63 | + 'guid' => $uploads['baseurl'].'/'.basename($new_path), |
|
| 64 | 64 | 'post_mime_type' => $wp_filetype['type'], |
| 65 | 65 | 'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)), |
| 66 | 66 | 'post_content' => '', |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | // you must first include the image.php file |
| 72 | 72 | // for the function wp_generate_attachment_metadata() to work |
| 73 | - require_once(ABSPATH . 'wp-admin/includes/image.php'); |
|
| 73 | + require_once(ABSPATH.'wp-admin/includes/image.php'); |
|
| 74 | 74 | $attach_data = wp_generate_attachment_metadata($attach_id, $new_path); |
| 75 | 75 | wp_update_attachment_metadata($attach_id, $attach_data); |
| 76 | 76 | |
@@ -87,14 +87,14 @@ discard block |
||
| 87 | 87 | $last_catid = wp_insert_term($catname, $post_type.'category'); |
| 88 | 88 | |
| 89 | 89 | if (geodir_dummy_folder_exists()) |
| 90 | - $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon"; |
|
| 90 | + $dummy_image_url = geodir_plugin_url()."/geodirectory-admin/dummy/cat_icon"; |
|
| 91 | 91 | else |
| 92 | 92 | $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon'; |
| 93 | 93 | |
| 94 | 94 | $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url); |
| 95 | 95 | |
| 96 | 96 | $catname = str_replace(' ', '_', $catname); |
| 97 | - $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png"); |
|
| 97 | + $uploaded = (array) fetch_remote_file("$dummy_image_url/".$catname.".png"); |
|
| 98 | 98 | |
| 99 | 99 | if (empty($uploaded['error'])) { |
| 100 | 100 | $new_path = $uploaded['file']; |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | $wp_filetype = wp_check_filetype(basename($new_path), null); |
| 105 | 105 | |
| 106 | 106 | $attachment = array( |
| 107 | - 'guid' => $uploads['baseurl'] . '/' . basename($new_path), |
|
| 107 | + 'guid' => $uploads['baseurl'].'/'.basename($new_path), |
|
| 108 | 108 | 'post_mime_type' => $wp_filetype['type'], |
| 109 | 109 | 'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)), |
| 110 | 110 | 'post_content' => '', |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | |
| 117 | 117 | // you must first include the image.php file |
| 118 | 118 | // for the function wp_generate_attachment_metadata() to work |
| 119 | - require_once(ABSPATH . 'wp-admin/includes/image.php'); |
|
| 119 | + require_once(ABSPATH.'wp-admin/includes/image.php'); |
|
| 120 | 120 | $attach_data = wp_generate_attachment_metadata($attach_id, $new_path); |
| 121 | 121 | wp_update_attachment_metadata($attach_id, $attach_data); |
| 122 | 122 | |
@@ -130,18 +130,18 @@ discard block |
||
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | |
| 133 | -function geodir_dummy_data_types(){ |
|
| 133 | +function geodir_dummy_data_types() { |
|
| 134 | 134 | return array( |
| 135 | 135 | 'standard_places' => array( |
| 136 | - 'name'=>__('Default','geodirectory'), |
|
| 136 | + 'name'=>__('Default', 'geodirectory'), |
|
| 137 | 137 | 'count'=> 30 |
| 138 | 138 | ), |
| 139 | 139 | 'property_sale' => array( |
| 140 | - 'name'=>__('Property for sale','geodirectory'), |
|
| 140 | + 'name'=>__('Property for sale', 'geodirectory'), |
|
| 141 | 141 | 'count'=> 10 |
| 142 | 142 | ), |
| 143 | 143 | 'property_rent' => array( |
| 144 | - 'name'=>__('Property for rent','geodirectory'), |
|
| 144 | + 'name'=>__('Property for rent', 'geodirectory'), |
|
| 145 | 145 | 'count'=> 10 |
| 146 | 146 | ) |
| 147 | 147 | ); |
@@ -172,12 +172,12 @@ discard block |
||
| 172 | 172 | * @global object $wpdb WordPress Database object. |
| 173 | 173 | * @global string $plugin_prefix Geodirectory plugin table prefix. |
| 174 | 174 | */ |
| 175 | -function geodir_delete_dummy_posts($post_type,$data_type) |
|
| 175 | +function geodir_delete_dummy_posts($post_type, $data_type) |
|
| 176 | 176 | { |
| 177 | 177 | global $wpdb, $plugin_prefix; |
| 178 | 178 | |
| 179 | 179 | |
| 180 | - $post_ids = $wpdb->get_results("SELECT post_id FROM " . $plugin_prefix . $post_type."_detail WHERE post_dummy='1'"); |
|
| 180 | + $post_ids = $wpdb->get_results("SELECT post_id FROM ".$plugin_prefix.$post_type."_detail WHERE post_dummy='1'"); |
|
| 181 | 181 | |
| 182 | 182 | |
| 183 | 183 | foreach ($post_ids as $post_ids_obj) { |
@@ -185,9 +185,9 @@ discard block |
||
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | //double check posts are deleted |
| 188 | - $wpdb->get_results("DELETE FROM " . $plugin_prefix . $post_type. "_detail WHERE post_dummy='1'"); |
|
| 188 | + $wpdb->get_results("DELETE FROM ".$plugin_prefix.$post_type."_detail WHERE post_dummy='1'"); |
|
| 189 | 189 | |
| 190 | - update_option($post_type.'_dummy_data_type',''); |
|
| 190 | + update_option($post_type.'_dummy_data_type', ''); |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | /** |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | * @global object $wpdb WordPress Database object. |
| 199 | 199 | * @global object $current_user Current user object. |
| 200 | 200 | */ |
| 201 | -function geodir_insert_dummy_posts($post_type,$data_type,$item_index) |
|
| 201 | +function geodir_insert_dummy_posts($post_type, $data_type, $item_index) |
|
| 202 | 202 | { |
| 203 | 203 | |
| 204 | 204 | ini_set('max_execution_time', 999999); //300 seconds = 5 minutes |
@@ -207,45 +207,45 @@ discard block |
||
| 207 | 207 | $total_count = 0; |
| 208 | 208 | global $dummy_post_index; |
| 209 | 209 | $dummy_post_index = $item_index; |
| 210 | - foreach( $data_types as $key=>$val){ |
|
| 211 | - if($key==$data_type){ |
|
| 210 | + foreach ($data_types as $key=>$val) { |
|
| 211 | + if ($key == $data_type) { |
|
| 212 | 212 | $total_count = $val['count']; |
| 213 | - if($key=='standard_places'){ |
|
| 213 | + if ($key == 'standard_places') { |
|
| 214 | 214 | /** |
| 215 | 215 | * Contains dummy post content. |
| 216 | 216 | * |
| 217 | 217 | * @since 1.0.0 |
| 218 | 218 | * @package GeoDirectory |
| 219 | 219 | */ |
| 220 | - include_once( 'dummy-data/standard_places.php' ); |
|
| 221 | - }elseif($key=='property_sale'){ |
|
| 220 | + include_once('dummy-data/standard_places.php'); |
|
| 221 | + }elseif ($key == 'property_sale') { |
|
| 222 | 222 | /** |
| 223 | 223 | * Contains dummy property for sale post content. |
| 224 | 224 | * |
| 225 | 225 | * @since 1.6.11 |
| 226 | 226 | * @package GeoDirectory |
| 227 | 227 | */ |
| 228 | - include_once( 'dummy-data/property_sale.php' ); |
|
| 229 | - }elseif($key=='property_rent'){ |
|
| 228 | + include_once('dummy-data/property_sale.php'); |
|
| 229 | + }elseif ($key == 'property_rent') { |
|
| 230 | 230 | /** |
| 231 | 231 | * Contains dummy property for sale post content. |
| 232 | 232 | * |
| 233 | 233 | * @since 1.6.11 |
| 234 | 234 | * @package GeoDirectory |
| 235 | 235 | */ |
| 236 | - include_once( 'dummy-data/property_rent.php' ); |
|
| 236 | + include_once('dummy-data/property_rent.php'); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | - do_action('geodir_insert_dummy_data_loop',$post_type,$data_type,$item_index); |
|
| 241 | + do_action('geodir_insert_dummy_data_loop', $post_type, $data_type, $item_index); |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | |
| 245 | 245 | |
| 246 | 246 | // delete image cache on last entry |
| 247 | - if($total_count == $item_index){ |
|
| 248 | - delete_transient( 'cached_dummy_images' ); |
|
| 247 | + if ($total_count == $item_index) { |
|
| 248 | + delete_transient('cached_dummy_images'); |
|
| 249 | 249 | flush_rewrite_rules(); |
| 250 | 250 | } |
| 251 | 251 | |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | |
| 256 | -if (!function_exists('geodir_autoinstall_admin_header') && (get_option('geodir_installed') || defined( 'GD_TESTING_MODE' ))) { |
|
| 256 | +if (!function_exists('geodir_autoinstall_admin_header') && (get_option('geodir_installed') || defined('GD_TESTING_MODE'))) { |
|
| 257 | 257 | /** |
| 258 | 258 | * GeoDirectory dummy data installation. |
| 259 | 259 | * |
@@ -269,16 +269,16 @@ discard block |
||
| 269 | 269 | global $wpdb, $plugin_prefix; |
| 270 | 270 | |
| 271 | 271 | if (!geodir_is_default_location_set()) { |
| 272 | - echo '<div class="updated fade"><p><strong>' . sprintf(__('Please %sclick here%s to set a default location, this will help to set location of all dummy data.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>') . '</strong></p></div>'; |
|
| 272 | + echo '<div class="updated fade"><p><strong>'.sprintf(__('Please %sclick here%s to set a default location, this will help to set location of all dummy data.', 'geodirectory'), '<a href=\''.admin_url('admin.php?page=geodirectory&tab=default_location_settings').'\'>', '</a>').'</strong></p></div>'; |
|
| 273 | 273 | } else { |
| 274 | 274 | |
| 275 | 275 | ?> |
| 276 | 276 | <table class="form-table gd-dummy-table"> |
| 277 | 277 | <tbody> |
| 278 | 278 | <tr> |
| 279 | - <td><strong><?php _e('CPT','geodirectory');?></strong></td> |
|
| 280 | - <td><strong><?php _e('Data Type','geodirectory');?></strong></td> |
|
| 281 | - <td><strong><?php _e('Action','geodirectory');?></strong></td> |
|
| 279 | + <td><strong><?php _e('CPT', 'geodirectory'); ?></strong></td> |
|
| 280 | + <td><strong><?php _e('Data Type', 'geodirectory'); ?></strong></td> |
|
| 281 | + <td><strong><?php _e('Action', 'geodirectory'); ?></strong></td> |
|
| 282 | 282 | </tr> |
| 283 | 283 | |
| 284 | 284 | <?php |
@@ -289,16 +289,16 @@ discard block |
||
| 289 | 289 | |
| 290 | 290 | $nonce = wp_create_nonce('geodir_dummy_posts_insert_noncename'); |
| 291 | 291 | |
| 292 | - foreach($cpts as $post_type=>$cpt){ |
|
| 292 | + foreach ($cpts as $post_type=>$cpt) { |
|
| 293 | 293 | |
| 294 | - $data_types_for = apply_filters('geodir_dummy_date_types_for',$data_types,$post_type); |
|
| 294 | + $data_types_for = apply_filters('geodir_dummy_date_types_for', $data_types, $post_type); |
|
| 295 | 295 | |
| 296 | 296 | |
| 297 | 297 | $set_dt = get_option($post_type.'_dummy_data_type'); |
| 298 | 298 | |
| 299 | - geodir_add_column_if_not_exist($plugin_prefix . $post_type. "_detail", 'post_dummy', "enum( '1', '0' ) NULL DEFAULT '0'"); |
|
| 299 | + geodir_add_column_if_not_exist($plugin_prefix.$post_type."_detail", 'post_dummy', "enum( '1', '0' ) NULL DEFAULT '0'"); |
|
| 300 | 300 | |
| 301 | - $post_counts = $wpdb->get_var("SELECT count(post_id) FROM " . $plugin_prefix . $post_type . "_detail WHERE post_dummy='1'"); |
|
| 301 | + $post_counts = $wpdb->get_var("SELECT count(post_id) FROM ".$plugin_prefix.$post_type."_detail WHERE post_dummy='1'"); |
|
| 302 | 302 | |
| 303 | 303 | echo "<tr>"; |
| 304 | 304 | echo "<td><strong>".$cpt['labels']['name']."</strong></td>"; |
@@ -307,8 +307,8 @@ discard block |
||
| 307 | 307 | $select_disabled = $post_counts > 0 ? 'disabled' : ''; |
| 308 | 308 | echo "<td>"; |
| 309 | 309 | echo "<select id='".$post_type."_data_type' onchange='geodir_dummy_set_count(this,\"$post_type\");' $select_disabled>"; |
| 310 | - foreach($data_types_for as $key=>$val){ |
|
| 311 | - $selected = ($key==$set_dt) ? "selected='selected'" : ''; |
|
| 310 | + foreach ($data_types_for as $key=>$val) { |
|
| 311 | + $selected = ($key == $set_dt) ? "selected='selected'" : ''; |
|
| 312 | 312 | echo "<option $selected value='$key' data-count='".$val['count']."'>".$val['name']."</option>"; |
| 313 | 313 | } |
| 314 | 314 | echo "</select>"; |
@@ -316,8 +316,8 @@ discard block |
||
| 316 | 316 | $select_display = $post_counts > 0 ? 'display:none;' : ''; |
| 317 | 317 | echo "<select id='".$post_type."_data_type_count' style='$select_display' >"; |
| 318 | 318 | $x = 1; |
| 319 | - while($x <= $val['count']){ |
|
| 320 | - $selected = ($x==$val['count']) ? "selected='selected'" : ''; |
|
| 319 | + while ($x <= $val['count']) { |
|
| 320 | + $selected = ($x == $val['count']) ? "selected='selected'" : ''; |
|
| 321 | 321 | echo "<option $selected value='$x'>".$x."</option>"; |
| 322 | 322 | $x++; |
| 323 | 323 | } |
@@ -328,10 +328,10 @@ discard block |
||
| 328 | 328 | |
| 329 | 329 | |
| 330 | 330 | |
| 331 | - if($post_counts > 0){ |
|
| 332 | - echo '<td><input type="button" value="'.__('Remove data','geodirectory').'" class="button-primary geodir_dummy_button gd-remove-data" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>'; |
|
| 333 | - }else{ |
|
| 334 | - echo '<td><input type="button" value="'.__('Insert data','geodirectory').'" class="button-primary geodir_dummy_button" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>'; |
|
| 331 | + if ($post_counts > 0) { |
|
| 332 | + echo '<td><input type="button" value="'.__('Remove data', 'geodirectory').'" class="button-primary geodir_dummy_button gd-remove-data" onclick="gdInstallDummyData(this,\''.$nonce.'\',\''.$post_type.'\'); return false;" ></td>'; |
|
| 333 | + } else { |
|
| 334 | + echo '<td><input type="button" value="'.__('Insert data', 'geodirectory').'" class="button-primary geodir_dummy_button" onclick="gdInstallDummyData(this,\''.$nonce.'\',\''.$post_type.'\'); return false;" ></td>'; |
|
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | echo "</tr>"; |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | |
| 368 | 368 | } |
| 369 | 369 | var geocoder = window.gdMaps == 'google' ? new google.maps.Geocoder() : null; |
| 370 | - var CITY_ADDRESS = '<?php echo addslashes( $city . ',' . $region . ',' . $country );?>'; |
|
| 370 | + var CITY_ADDRESS = '<?php echo addslashes($city.','.$region.','.$country); ?>'; |
|
| 371 | 371 | var bound_lat_lng; |
| 372 | 372 | var latlng = ['<?php echo $city_latitude; ?>', <?php echo $city_longitude; ?>]; |
| 373 | 373 | var lat = <?php echo $city_latitude; ?>; |
@@ -397,7 +397,7 @@ discard block |
||
| 397 | 397 | return x.replace(" ", ''); |
| 398 | 398 | }); // remove spaces from lat/lon |
| 399 | 399 | } else { |
| 400 | - alert("<?php _e('Geocode was not successful for the following reason:','geodirectory');?> " + status); |
|
| 400 | + alert("<?php _e('Geocode was not successful for the following reason:', 'geodirectory'); ?> " + status); |
|
| 401 | 401 | } |
| 402 | 402 | }); |
| 403 | 403 | } else if (window.gdMaps == 'osm') { |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | var total_dummy_post_count = jQuery('#sub_' + active_tab).find('.selected_sample_data').val(); |
| 423 | 423 | |
| 424 | 424 | if (id == 'geodir_dummy_delete') { |
| 425 | - if (confirm('<?php _e('Are you sure you want to delete dummy data?' , 'geodirectory'); ?>')) { |
|
| 425 | + if (confirm('<?php _e('Are you sure you want to delete dummy data?', 'geodirectory'); ?>')) { |
|
| 426 | 426 | jQuery('#sub_' + active_tab).find('.geodir_auto_install').hide(); |
| 427 | 427 | jQuery('#sub_' + active_tab).find('.geodir_show_progress').show(); |
| 428 | 428 | jQuery.post('<?php echo geodir_get_ajax_url(); ?>&geodir_autofill=' + id + '&posttype=' + posttype + '&_wpnonce=' + nonce, |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | var post_url = '<?php echo geodir_get_ajax_url(); ?>&geodir_autofill=' + id + '&posttype=' + posttype + '&insert_dummy_post_index=' + dummy_post_index + '&city_bound_lat1=' + bound_lat_lng[0] + '&city_bound_lng1=' + bound_lat_lng[1] + '&city_bound_lat2=' + bound_lat_lng[2] + '&city_bound_lng2=' + bound_lat_lng[3] + '&_wpnonce=' + nonce; |
| 444 | 444 | |
| 445 | 445 | jQuery.post( post_url, function (data) { |
| 446 | - jQuery(obj).closest('form').find('.dummy_post_inserted').html('<?php _e('Dummy post(s) inserted:','geodirectory');?> ' + dummy_post_index + ' <?php _e('of' ,'geodirectory'); ?> ' + total_dummy_post_count + ''); |
|
| 446 | + jQuery(obj).closest('form').find('.dummy_post_inserted').html('<?php _e('Dummy post(s) inserted:', 'geodirectory'); ?> ' + dummy_post_index + ' <?php _e('of', 'geodirectory'); ?> ' + total_dummy_post_count + ''); |
|
| 447 | 447 | |
| 448 | 448 | dummy_post_index++; |
| 449 | 449 | |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | |
| 459 | 459 | |
| 460 | 460 | function gdRemoveDummyData(obj, nonce, posttype){ |
| 461 | - if (confirm('<?php _e('Are you sure you want to delete dummy data?' , 'geodirectory'); ?>')) { |
|
| 461 | + if (confirm('<?php _e('Are you sure you want to delete dummy data?', 'geodirectory'); ?>')) { |
|
| 462 | 462 | jQuery(obj).prop('disabled', true); |
| 463 | 463 | jQuery('.gd-dummy-data-results-' + posttype).remove(); |
| 464 | 464 | jQuery('<tr class="gd-dummy-data-results gd-dummy-data-results-' + posttype + '" >'+ |
@@ -473,14 +473,14 @@ discard block |
||
| 473 | 473 | |
| 474 | 474 | jQuery('.gd_progressbar_'+posttype).progressbar({value: 0}); |
| 475 | 475 | |
| 476 | - gd_progressbar('.gd_progressbar_container_'+posttype, 0, '<i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Removing data...', 'geodirlocation'));?>'); |
|
| 476 | + gd_progressbar('.gd_progressbar_container_'+posttype, 0, '<i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Removing data...', 'geodirlocation')); ?>'); |
|
| 477 | 477 | |
| 478 | 478 | |
| 479 | 479 | jQuery.post('<?php echo geodir_get_ajax_url(); ?>&geodir_autofill=geodir_dummy_delete&posttype=' + posttype + '&_wpnonce=' + nonce, |
| 480 | 480 | function (data) { |
| 481 | - gd_progressbar('.gd_progressbar_container_'+posttype, 100, '<i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirlocation'));?>'); |
|
| 481 | + gd_progressbar('.gd_progressbar_container_'+posttype, 100, '<i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirlocation')); ?>'); |
|
| 482 | 482 | jQuery(obj).removeClass('gd-remove-data'); |
| 483 | - jQuery(obj).val('<?php _e('Insert data','geodirectory');?>'); |
|
| 483 | + jQuery(obj).val('<?php _e('Insert data', 'geodirectory'); ?>'); |
|
| 484 | 484 | jQuery(obj).prop('disabled', false); |
| 485 | 485 | jQuery('#'+posttype+'_data_type_count').show(); |
| 486 | 486 | jQuery('#'+posttype+'_data_type').prop('disabled', false); |
@@ -523,7 +523,7 @@ discard block |
||
| 523 | 523 | |
| 524 | 524 | jQuery('.gd_progressbar_'+posttype).progressbar({value: 0}); |
| 525 | 525 | |
| 526 | - gd_progressbar('.gd_progressbar_container_'+posttype, 0, '0% (0 / ' + dateTypeCount + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Creating categories and custom fields...', 'geodirlocation'));?>'); |
|
| 526 | + gd_progressbar('.gd_progressbar_container_'+posttype, 0, '0% (0 / ' + dateTypeCount + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Creating categories and custom fields...', 'geodirlocation')); ?>'); |
|
| 527 | 527 | } |
| 528 | 528 | |
| 529 | 529 | if (!(typeof bound_lat_lng == 'object' && bound_lat_lng.length == 4)) { |
@@ -543,15 +543,15 @@ discard block |
||
| 543 | 543 | percentage = percentage > 100 ? 100 : percentage; |
| 544 | 544 | |
| 545 | 545 | |
| 546 | - gd_progressbar('.gd_progressbar_container_'+posttype, percentage, percentage + '% ('+insertedCount+' / ' + dateTypeCount + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Inserting data...', 'geodirlocation'));?>'); |
|
| 546 | + gd_progressbar('.gd_progressbar_container_'+posttype, percentage, percentage + '% ('+insertedCount+' / ' + dateTypeCount + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Inserting data...', 'geodirlocation')); ?>'); |
|
| 547 | 547 | |
| 548 | 548 | gdInstallDummyData(obj, nonce, posttype,insertedCount); |
| 549 | 549 | } |
| 550 | 550 | else { |
| 551 | 551 | percentage = 100; |
| 552 | - gd_progressbar('.gd_progressbar_container_'+posttype, percentage, percentage + '% ('+insertedCount+' / ' + dateTypeCount + ') <i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirlocation'));?>'); |
|
| 552 | + gd_progressbar('.gd_progressbar_container_'+posttype, percentage, percentage + '% ('+insertedCount+' / ' + dateTypeCount + ') <i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirlocation')); ?>'); |
|
| 553 | 553 | jQuery(obj).addClass('gd-remove-data'); |
| 554 | - jQuery(obj).val('<?php _e('Remove data','geodirectory');?>'); |
|
| 554 | + jQuery(obj).val('<?php _e('Remove data', 'geodirectory'); ?>'); |
|
| 555 | 555 | jQuery(obj).prop('disabled', false); |
| 556 | 556 | |
| 557 | 557 | } |
@@ -42,10 +42,11 @@ discard block |
||
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | |
| 45 | - if (geodir_dummy_folder_exists()) |
|
| 46 | - $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon"; |
|
| 47 | - else |
|
| 48 | - $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon'; |
|
| 45 | + if (geodir_dummy_folder_exists()) { |
|
| 46 | + $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon"; |
|
| 47 | + } else { |
|
| 48 | + $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon'; |
|
| 49 | + } |
|
| 49 | 50 | |
| 50 | 51 | $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url); |
| 51 | 52 | |
@@ -86,10 +87,11 @@ discard block |
||
| 86 | 87 | if (!term_exists($catname, $post_type.'category')) { |
| 87 | 88 | $last_catid = wp_insert_term($catname, $post_type.'category'); |
| 88 | 89 | |
| 89 | - if (geodir_dummy_folder_exists()) |
|
| 90 | - $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon"; |
|
| 91 | - else |
|
| 92 | - $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon'; |
|
| 90 | + if (geodir_dummy_folder_exists()) { |
|
| 91 | + $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon"; |
|
| 92 | + } else { |
|
| 93 | + $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon'; |
|
| 94 | + } |
|
| 93 | 95 | |
| 94 | 96 | $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url); |
| 95 | 97 | |
@@ -218,7 +220,7 @@ discard block |
||
| 218 | 220 | * @package GeoDirectory |
| 219 | 221 | */ |
| 220 | 222 | include_once( 'dummy-data/standard_places.php' ); |
| 221 | - }elseif($key=='property_sale'){ |
|
| 223 | + } elseif($key=='property_sale'){ |
|
| 222 | 224 | /** |
| 223 | 225 | * Contains dummy property for sale post content. |
| 224 | 226 | * |
@@ -226,7 +228,7 @@ discard block |
||
| 226 | 228 | * @package GeoDirectory |
| 227 | 229 | */ |
| 228 | 230 | include_once( 'dummy-data/property_sale.php' ); |
| 229 | - }elseif($key=='property_rent'){ |
|
| 231 | + } elseif($key=='property_rent'){ |
|
| 230 | 232 | /** |
| 231 | 233 | * Contains dummy property for sale post content. |
| 232 | 234 | * |
@@ -330,7 +332,7 @@ discard block |
||
| 330 | 332 | |
| 331 | 333 | if($post_counts > 0){ |
| 332 | 334 | echo '<td><input type="button" value="'.__('Remove data','geodirectory').'" class="button-primary geodir_dummy_button gd-remove-data" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>'; |
| 333 | - }else{ |
|
| 335 | + } else{ |
|
| 334 | 336 | echo '<td><input type="button" value="'.__('Insert data','geodirectory').'" class="button-primary geodir_dummy_button" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>'; |
| 335 | 337 | } |
| 336 | 338 | |
@@ -13,125 +13,125 @@ 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 | - wp_register_style('font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION);
|
|
| 71 | - wp_enqueue_style('font-awesome');
|
|
| 70 | + wp_register_style('font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION);
|
|
| 71 | + wp_enqueue_style('font-awesome');
|
|
| 72 | 72 | |
| 73 | - wp_register_script('geodirectory-admin', geodir_plugin_url() . '/geodirectory-assets/js/admin-req.min.js', array('jquery'), GEODIRECTORY_VERSION);
|
|
| 74 | - wp_enqueue_script('geodirectory-admin');
|
|
| 73 | + wp_register_script('geodirectory-admin', geodir_plugin_url() . '/geodirectory-assets/js/admin-req.min.js', array('jquery'), GEODIRECTORY_VERSION);
|
|
| 74 | + wp_enqueue_script('geodirectory-admin');
|
|
| 75 | 75 | |
| 76 | - } |
|
| 76 | + } |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | if (!function_exists('geodir_admin_scripts')) {
|
| 80 | - /** |
|
| 81 | - * Enqueue Admin Scripts. |
|
| 82 | - * |
|
| 83 | - * @since 1.0.0 |
|
| 84 | - * @package GeoDirectory |
|
| 85 | - */ |
|
| 86 | - function geodir_admin_scripts() |
|
| 87 | - {
|
|
| 88 | - $geodir_map_name = geodir_map_name(); |
|
| 80 | + /** |
|
| 81 | + * Enqueue Admin Scripts. |
|
| 82 | + * |
|
| 83 | + * @since 1.0.0 |
|
| 84 | + * @package GeoDirectory |
|
| 85 | + */ |
|
| 86 | + function geodir_admin_scripts() |
|
| 87 | + {
|
|
| 88 | + $geodir_map_name = geodir_map_name(); |
|
| 89 | 89 | |
| 90 | - wp_enqueue_script('jquery');
|
|
| 90 | + wp_enqueue_script('jquery');
|
|
| 91 | 91 | |
| 92 | - 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);
|
|
| 92 | + 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 | 93 | |
| 94 | - wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.js', array('jquery'), GEODIRECTORY_VERSION);
|
|
| 95 | - wp_enqueue_script('chosen');
|
|
| 94 | + wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.js', array('jquery'), GEODIRECTORY_VERSION);
|
|
| 95 | + wp_enqueue_script('chosen');
|
|
| 96 | 96 | |
| 97 | - wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.js', array(), GEODIRECTORY_VERSION);
|
|
| 98 | - wp_enqueue_script('geodirectory-choose-ajax');
|
|
| 97 | + wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.js', array(), GEODIRECTORY_VERSION);
|
|
| 98 | + wp_enqueue_script('geodirectory-choose-ajax');
|
|
| 99 | 99 | |
| 100 | - if (isset($_REQUEST['listing_type'])) {
|
|
| 101 | - wp_register_script('geodirectory-custom-fields-script', geodir_plugin_url() . '/geodirectory-assets/js/custom_fields.js', array(), GEODIRECTORY_VERSION);
|
|
| 102 | - } |
|
| 100 | + if (isset($_REQUEST['listing_type'])) {
|
|
| 101 | + wp_register_script('geodirectory-custom-fields-script', geodir_plugin_url() . '/geodirectory-assets/js/custom_fields.js', array(), GEODIRECTORY_VERSION);
|
|
| 102 | + } |
|
| 103 | 103 | |
| 104 | - wp_enqueue_script('geodirectory-custom-fields-script');
|
|
| 105 | - $plugin_path = geodir_plugin_url() . '/geodirectory-functions/cat-meta-functions'; |
|
| 104 | + wp_enqueue_script('geodirectory-custom-fields-script');
|
|
| 105 | + $plugin_path = geodir_plugin_url() . '/geodirectory-functions/cat-meta-functions'; |
|
| 106 | 106 | |
| 107 | - wp_enqueue_script('tax-meta-clss', $plugin_path . '/js/tax-meta-clss.js', array('jquery'), null, true);
|
|
| 107 | + wp_enqueue_script('tax-meta-clss', $plugin_path . '/js/tax-meta-clss.js', array('jquery'), null, true);
|
|
| 108 | 108 | |
| 109 | - if (in_array($geodir_map_name, array('auto', 'google'))) {
|
|
| 110 | - $map_lang = "&language=" . geodir_get_map_default_language(); |
|
| 111 | - $map_key = "&key=" . geodir_get_map_api_key(); |
|
| 112 | - /** This filter is documented in geodirectory_template_tags.php */ |
|
| 113 | - $map_extra = apply_filters('geodir_googlemap_script_extra', '');
|
|
| 114 | - wp_enqueue_script('geodirectory-googlemap-script', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra, '', NULL);
|
|
| 115 | - } |
|
| 109 | + if (in_array($geodir_map_name, array('auto', 'google'))) {
|
|
| 110 | + $map_lang = "&language=" . geodir_get_map_default_language(); |
|
| 111 | + $map_key = "&key=" . geodir_get_map_api_key(); |
|
| 112 | + /** This filter is documented in geodirectory_template_tags.php */ |
|
| 113 | + $map_extra = apply_filters('geodir_googlemap_script_extra', '');
|
|
| 114 | + wp_enqueue_script('geodirectory-googlemap-script', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra, '', NULL);
|
|
| 115 | + } |
|
| 116 | 116 | |
| 117 | - if ($geodir_map_name == 'osm') {
|
|
| 118 | - // Leaflet OpenStreetMap |
|
| 119 | - wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
|
|
| 120 | - wp_enqueue_style('geodirectory-leaflet-style');
|
|
| 117 | + if ($geodir_map_name == 'osm') {
|
|
| 118 | + // Leaflet OpenStreetMap |
|
| 119 | + wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
|
|
| 120 | + wp_enqueue_style('geodirectory-leaflet-style');
|
|
| 121 | 121 | |
| 122 | - wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 123 | - wp_enqueue_script('geodirectory-leaflet-script');
|
|
| 122 | + wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 123 | + wp_enqueue_script('geodirectory-leaflet-script');
|
|
| 124 | 124 | |
| 125 | - wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.js', array('geodirectory-leaflet-script'), GEODIRECTORY_VERSION);
|
|
| 126 | - wp_enqueue_script('geodirectory-leaflet-geo-script');
|
|
| 127 | - } |
|
| 128 | - wp_enqueue_script( 'jquery-ui-autocomplete' ); |
|
| 125 | + wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.js', array('geodirectory-leaflet-script'), GEODIRECTORY_VERSION);
|
|
| 126 | + wp_enqueue_script('geodirectory-leaflet-geo-script');
|
|
| 127 | + } |
|
| 128 | + wp_enqueue_script( 'jquery-ui-autocomplete' ); |
|
| 129 | 129 | |
| 130 | - wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true);
|
|
| 131 | - wp_enqueue_script('geodirectory-goMap-script');
|
|
| 130 | + wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true);
|
|
| 131 | + wp_enqueue_script('geodirectory-goMap-script');
|
|
| 132 | 132 | |
| 133 | - wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.js', array(), GEODIRECTORY_VERSION);
|
|
| 134 | - wp_enqueue_script('geodirectory-goMap-script');
|
|
| 133 | + wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.js', array(), GEODIRECTORY_VERSION);
|
|
| 134 | + wp_enqueue_script('geodirectory-goMap-script');
|
|
| 135 | 135 | |
| 136 | 136 | // font awesome rating script |
| 137 | 137 | if (get_option('geodir_reviewrating_enable_font_awesome')) {
|
@@ -142,167 +142,167 @@ discard block |
||
| 142 | 142 | wp_enqueue_script('geodir-jRating-js');
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 146 | - wp_enqueue_script('geodir-on-document-load');
|
|
| 147 | - |
|
| 148 | - |
|
| 149 | - // SCRIPT FOR UPLOAD |
|
| 150 | - wp_enqueue_script('plupload-all');
|
|
| 151 | - wp_enqueue_script('jquery-ui-sortable');
|
|
| 152 | - |
|
| 153 | - wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.js', array(), GEODIRECTORY_VERSION);
|
|
| 154 | - wp_enqueue_script('geodirectory-plupload-script');
|
|
| 155 | - |
|
| 156 | - // SCRIPT FOR UPLOAD END |
|
| 157 | - |
|
| 158 | - |
|
| 159 | - // place js config array for plupload |
|
| 160 | - $plupload_init = array( |
|
| 161 | - 'runtimes' => 'html5,silverlight,flash,html4', |
|
| 162 | - 'browse_button' => 'plupload-browse-button', // will be adjusted per uploader |
|
| 163 | - 'container' => 'plupload-upload-ui', // will be adjusted per uploader |
|
| 164 | - 'drop_element' => 'dropbox', // will be adjusted per uploader |
|
| 165 | - 'file_data_name' => 'async-upload', // will be adjusted per uploader |
|
| 166 | - 'multiple_queues' => true, |
|
| 167 | - 'max_file_size' => geodir_max_upload_size(), |
|
| 168 | - 'url' => admin_url('admin-ajax.php'),
|
|
| 169 | - 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
|
|
| 170 | - 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
|
|
| 171 | - 'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')),
|
|
| 172 | - 'multipart' => true, |
|
| 173 | - 'urlstream_upload' => true, |
|
| 174 | - 'multi_selection' => false, // will be added per uploader |
|
| 175 | - // additional post data to send to our ajax hook |
|
| 176 | - 'multipart_params' => array( |
|
| 177 | - '_ajax_nonce' => "", // will be added per uploader |
|
| 178 | - 'action' => 'plupload_action', // the ajax action name |
|
| 179 | - 'imgid' => 0 // will be added per uploader |
|
| 180 | - ) |
|
| 181 | - ); |
|
| 182 | - $base_plupload_config = json_encode($plupload_init); |
|
| 183 | - |
|
| 184 | - |
|
| 185 | - $thumb_img_arr = array(); |
|
| 186 | - |
|
| 187 | - if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
|
| 188 | - $thumb_img_arr = geodir_get_images($_REQUEST['pid']); |
|
| 189 | - |
|
| 190 | - $totImg = ''; |
|
| 191 | - $image_limit = ''; |
|
| 192 | - if (!empty($thumb_img_arr)) {
|
|
| 193 | - $totImg = count($thumb_img_arr); |
|
| 194 | - } |
|
| 145 | + wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 146 | + wp_enqueue_script('geodir-on-document-load');
|
|
| 147 | + |
|
| 148 | + |
|
| 149 | + // SCRIPT FOR UPLOAD |
|
| 150 | + wp_enqueue_script('plupload-all');
|
|
| 151 | + wp_enqueue_script('jquery-ui-sortable');
|
|
| 152 | + |
|
| 153 | + wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.js', array(), GEODIRECTORY_VERSION);
|
|
| 154 | + wp_enqueue_script('geodirectory-plupload-script');
|
|
| 155 | + |
|
| 156 | + // SCRIPT FOR UPLOAD END |
|
| 157 | + |
|
| 158 | + |
|
| 159 | + // place js config array for plupload |
|
| 160 | + $plupload_init = array( |
|
| 161 | + 'runtimes' => 'html5,silverlight,flash,html4', |
|
| 162 | + 'browse_button' => 'plupload-browse-button', // will be adjusted per uploader |
|
| 163 | + 'container' => 'plupload-upload-ui', // will be adjusted per uploader |
|
| 164 | + 'drop_element' => 'dropbox', // will be adjusted per uploader |
|
| 165 | + 'file_data_name' => 'async-upload', // will be adjusted per uploader |
|
| 166 | + 'multiple_queues' => true, |
|
| 167 | + 'max_file_size' => geodir_max_upload_size(), |
|
| 168 | + 'url' => admin_url('admin-ajax.php'),
|
|
| 169 | + 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
|
|
| 170 | + 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
|
|
| 171 | + 'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')),
|
|
| 172 | + 'multipart' => true, |
|
| 173 | + 'urlstream_upload' => true, |
|
| 174 | + 'multi_selection' => false, // will be added per uploader |
|
| 175 | + // additional post data to send to our ajax hook |
|
| 176 | + 'multipart_params' => array( |
|
| 177 | + '_ajax_nonce' => "", // will be added per uploader |
|
| 178 | + 'action' => 'plupload_action', // the ajax action name |
|
| 179 | + 'imgid' => 0 // will be added per uploader |
|
| 180 | + ) |
|
| 181 | + ); |
|
| 182 | + $base_plupload_config = json_encode($plupload_init); |
|
| 183 | + |
|
| 184 | + |
|
| 185 | + $thumb_img_arr = array(); |
|
| 186 | + |
|
| 187 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
|
| 188 | + $thumb_img_arr = geodir_get_images($_REQUEST['pid']); |
|
| 189 | + |
|
| 190 | + $totImg = ''; |
|
| 191 | + $image_limit = ''; |
|
| 192 | + if (!empty($thumb_img_arr)) {
|
|
| 193 | + $totImg = count($thumb_img_arr); |
|
| 194 | + } |
|
| 195 | 195 | |
| 196 | - $gd_plupload_init = array('base_plupload_config' => $base_plupload_config,
|
|
| 197 | - 'totalImg' => $totImg, |
|
| 198 | - 'image_limit' => $image_limit, |
|
| 199 | - 'upload_img_size' => geodir_max_upload_size()); |
|
| 196 | + $gd_plupload_init = array('base_plupload_config' => $base_plupload_config,
|
|
| 197 | + 'totalImg' => $totImg, |
|
| 198 | + 'image_limit' => $image_limit, |
|
| 199 | + 'upload_img_size' => geodir_max_upload_size()); |
|
| 200 | 200 | |
| 201 | - wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
|
|
| 201 | + wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
|
|
| 202 | 202 | |
| 203 | - $ajax_cons_data = array('url' => __(admin_url('admin-ajax.php')));
|
|
| 204 | - wp_localize_script('geodirectory-custom-fields-script', 'geodir_admin_ajax', $ajax_cons_data);
|
|
| 203 | + $ajax_cons_data = array('url' => __(admin_url('admin-ajax.php')));
|
|
| 204 | + wp_localize_script('geodirectory-custom-fields-script', 'geodir_admin_ajax', $ajax_cons_data);
|
|
| 205 | 205 | |
| 206 | 206 | |
| 207 | - wp_register_script('geodirectory-admin-script', geodir_plugin_url() . '/geodirectory-assets/js/admin.js', array(), GEODIRECTORY_VERSION);
|
|
| 208 | - wp_enqueue_script('geodirectory-admin-script');
|
|
| 207 | + wp_register_script('geodirectory-admin-script', geodir_plugin_url() . '/geodirectory-assets/js/admin.js', array(), GEODIRECTORY_VERSION);
|
|
| 208 | + wp_enqueue_script('geodirectory-admin-script');
|
|
| 209 | 209 | |
| 210 | - wp_enqueue_style('farbtastic');
|
|
| 211 | - wp_enqueue_script('farbtastic');
|
|
| 210 | + wp_enqueue_style('farbtastic');
|
|
| 211 | + wp_enqueue_script('farbtastic');
|
|
| 212 | 212 | |
| 213 | - $screen = get_current_screen(); |
|
| 214 | - if ($screen->base == 'post' && in_array($screen->post_type, geodir_get_posttypes())) {
|
|
| 215 | - wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation_admin.js');
|
|
| 216 | - } |
|
| 213 | + $screen = get_current_screen(); |
|
| 214 | + if ($screen->base == 'post' && in_array($screen->post_type, geodir_get_posttypes())) {
|
|
| 215 | + wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation_admin.js');
|
|
| 216 | + } |
|
| 217 | 217 | |
| 218 | - $ajax_cons_data = array('url' => esc_url(__(get_option('siteurl') . '?geodir_ajax=true')));
|
|
| 219 | - wp_localize_script('geodirectory-admin-script', 'geodir_ajax', $ajax_cons_data);
|
|
| 218 | + $ajax_cons_data = array('url' => esc_url(__(get_option('siteurl') . '?geodir_ajax=true')));
|
|
| 219 | + wp_localize_script('geodirectory-admin-script', 'geodir_ajax', $ajax_cons_data);
|
|
| 220 | 220 | |
| 221 | - } |
|
| 221 | + } |
|
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | if (!function_exists('geodir_admin_menu')) {
|
| 225 | - /** |
|
| 226 | - * Admin Menus |
|
| 227 | - * |
|
| 228 | - * Sets up the admin menus in wordpress. |
|
| 229 | - * |
|
| 230 | - * @since 1.0.0 |
|
| 231 | - * @package GeoDirectory |
|
| 232 | - * @global array $menu Menu array. |
|
| 233 | - * @global object $geodirectory GeoDirectory plugin object. |
|
| 234 | - */ |
|
| 235 | - function geodir_admin_menu() |
|
| 236 | - {
|
|
| 237 | - global $menu, $geodirectory; |
|
| 225 | + /** |
|
| 226 | + * Admin Menus |
|
| 227 | + * |
|
| 228 | + * Sets up the admin menus in wordpress. |
|
| 229 | + * |
|
| 230 | + * @since 1.0.0 |
|
| 231 | + * @package GeoDirectory |
|
| 232 | + * @global array $menu Menu array. |
|
| 233 | + * @global object $geodirectory GeoDirectory plugin object. |
|
| 234 | + */ |
|
| 235 | + function geodir_admin_menu() |
|
| 236 | + {
|
|
| 237 | + global $menu, $geodirectory; |
|
| 238 | 238 | |
| 239 | - if (current_user_can('manage_options')) $menu[] = array('', 'read', 'separator-geodirectory', '', 'wp-menu-separator geodirectory');
|
|
| 239 | + if (current_user_can('manage_options')) $menu[] = array('', 'read', 'separator-geodirectory', '', 'wp-menu-separator geodirectory');
|
|
| 240 | 240 | |
| 241 | - add_menu_page(__('Geodirectory', 'geodirectory'), __('Geodirectory', 'geodirectory'), 'manage_options', 'geodirectory', 'geodir_admin_panel', geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico', '55.1984');
|
|
| 241 | + add_menu_page(__('Geodirectory', 'geodirectory'), __('Geodirectory', 'geodirectory'), 'manage_options', 'geodirectory', 'geodir_admin_panel', geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico', '55.1984');
|
|
| 242 | 242 | |
| 243 | 243 | |
| 244 | - } |
|
| 244 | + } |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | if (!function_exists('geodir_admin_menu_order')) {
|
| 248 | - /** |
|
| 249 | - * Order admin menus. |
|
| 250 | - * |
|
| 251 | - * @since 1.0.0 |
|
| 252 | - * @package GeoDirectory |
|
| 253 | - * @param array $menu_order Menu order array. |
|
| 254 | - * @return array Modified menu order array. |
|
| 255 | - */ |
|
| 256 | - function geodir_admin_menu_order($menu_order) |
|
| 257 | - {
|
|
| 258 | - |
|
| 259 | - // Initialize our custom order array |
|
| 260 | - $geodir_menu_order = array(); |
|
| 261 | - |
|
| 262 | - // Get the index of our custom separator |
|
| 263 | - $geodir_separator = array_search('separator-geodirectory', $menu_order);
|
|
| 264 | - |
|
| 265 | - // Get index of posttype menu |
|
| 266 | - $post_types = geodir_get_posttypes(); |
|
| 267 | - |
|
| 268 | - // Loop through menu order and do some rearranging |
|
| 269 | - foreach ($menu_order as $index => $item) : |
|
| 270 | - |
|
| 271 | - if ((('geodirectory') == $item)) :
|
|
| 272 | - $geodir_menu_order[] = 'separator-geodirectory'; |
|
| 273 | - if (!empty($post_types)) {
|
|
| 274 | - foreach ($post_types as $post_type) {
|
|
| 275 | - $geodir_menu_order[] = 'edit.php?post_type=' . $post_type; |
|
| 276 | - } |
|
| 277 | - } |
|
| 278 | - $geodir_menu_order[] = $item; |
|
| 248 | + /** |
|
| 249 | + * Order admin menus. |
|
| 250 | + * |
|
| 251 | + * @since 1.0.0 |
|
| 252 | + * @package GeoDirectory |
|
| 253 | + * @param array $menu_order Menu order array. |
|
| 254 | + * @return array Modified menu order array. |
|
| 255 | + */ |
|
| 256 | + function geodir_admin_menu_order($menu_order) |
|
| 257 | + {
|
|
| 279 | 258 | |
| 280 | - unset($menu_order[$geodir_separator]); |
|
| 281 | - //unset( $menu_order[$geodir_places] ); |
|
| 282 | - elseif (!in_array($item, array('separator-geodirectory'))) :
|
|
| 283 | - $geodir_menu_order[] = $item; |
|
| 284 | - endif; |
|
| 259 | + // Initialize our custom order array |
|
| 260 | + $geodir_menu_order = array(); |
|
| 285 | 261 | |
| 286 | - endforeach; |
|
| 262 | + // Get the index of our custom separator |
|
| 263 | + $geodir_separator = array_search('separator-geodirectory', $menu_order);
|
|
| 287 | 264 | |
| 288 | - // Return order |
|
| 289 | - return $geodir_menu_order; |
|
| 290 | - } |
|
| 265 | + // Get index of posttype menu |
|
| 266 | + $post_types = geodir_get_posttypes(); |
|
| 267 | + |
|
| 268 | + // Loop through menu order and do some rearranging |
|
| 269 | + foreach ($menu_order as $index => $item) : |
|
| 270 | + |
|
| 271 | + if ((('geodirectory') == $item)) :
|
|
| 272 | + $geodir_menu_order[] = 'separator-geodirectory'; |
|
| 273 | + if (!empty($post_types)) {
|
|
| 274 | + foreach ($post_types as $post_type) {
|
|
| 275 | + $geodir_menu_order[] = 'edit.php?post_type=' . $post_type; |
|
| 276 | + } |
|
| 277 | + } |
|
| 278 | + $geodir_menu_order[] = $item; |
|
| 279 | + |
|
| 280 | + unset($menu_order[$geodir_separator]); |
|
| 281 | + //unset( $menu_order[$geodir_places] ); |
|
| 282 | + elseif (!in_array($item, array('separator-geodirectory'))) :
|
|
| 283 | + $geodir_menu_order[] = $item; |
|
| 284 | + endif; |
|
| 285 | + |
|
| 286 | + endforeach; |
|
| 287 | + |
|
| 288 | + // Return order |
|
| 289 | + return $geodir_menu_order; |
|
| 290 | + } |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | if (!function_exists('geodir_admin_custom_menu_order')) {
|
| 294 | - /** |
|
| 295 | - * Enables custom menu order. |
|
| 296 | - * |
|
| 297 | - * @since 1.0.0 |
|
| 298 | - * @package GeoDirectory |
|
| 299 | - * @return bool |
|
| 300 | - */ |
|
| 301 | - function geodir_admin_custom_menu_order() |
|
| 302 | - {
|
|
| 303 | - if (!current_user_can('manage_options')) return false;
|
|
| 304 | - return true; |
|
| 305 | - } |
|
| 294 | + /** |
|
| 295 | + * Enables custom menu order. |
|
| 296 | + * |
|
| 297 | + * @since 1.0.0 |
|
| 298 | + * @package GeoDirectory |
|
| 299 | + * @return bool |
|
| 300 | + */ |
|
| 301 | + function geodir_admin_custom_menu_order() |
|
| 302 | + {
|
|
| 303 | + if (!current_user_can('manage_options')) return false;
|
|
| 304 | + return true; |
|
| 305 | + } |
|
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | /** |
@@ -313,51 +313,51 @@ discard block |
||
| 313 | 313 | */ |
| 314 | 314 | function geodir_before_admin_panel() |
| 315 | 315 | {
|
| 316 | - if (isset($_REQUEST['installed']) && $_REQUEST['installed'] != '') {
|
|
| 317 | - echo '<div id="message" class="updated fade"> |
|
| 316 | + if (isset($_REQUEST['installed']) && $_REQUEST['installed'] != '') {
|
|
| 317 | + echo '<div id="message" class="updated fade"> |
|
| 318 | 318 | <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>
|
| 319 | 319 | <p><strong>' . __('Geodirectory has been installed and setup. Enjoy :)', 'geodirectory') . '</strong></p>
|
| 320 | 320 | </div>'; |
| 321 | 321 | |
| 322 | - } |
|
| 322 | + } |
|
| 323 | 323 | |
| 324 | - if (isset($_REQUEST['msg']) && $_REQUEST['msg'] != '') {
|
|
| 325 | - switch ($_REQUEST['msg']) {
|
|
| 326 | - case 'success': |
|
| 327 | - echo '<div id="message" class="updated fade"><p><strong>' . __('Your settings have been saved.', 'geodirectory') . '</strong></p></div>';
|
|
| 328 | - flush_rewrite_rules(false); |
|
| 324 | + if (isset($_REQUEST['msg']) && $_REQUEST['msg'] != '') {
|
|
| 325 | + switch ($_REQUEST['msg']) {
|
|
| 326 | + case 'success': |
|
| 327 | + echo '<div id="message" class="updated fade"><p><strong>' . __('Your settings have been saved.', 'geodirectory') . '</strong></p></div>';
|
|
| 328 | + flush_rewrite_rules(false); |
|
| 329 | 329 | |
| 330 | - break; |
|
| 330 | + break; |
|
| 331 | 331 | case 'fail': |
| 332 | 332 | $gderr = isset($_REQUEST['gderr']) ? $_REQUEST['gderr'] : ''; |
| 333 | 333 | |
| 334 | 334 | if ($gderr == 21) |
| 335 | - 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>';
|
|
| 335 | + 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>';
|
|
| 336 | 336 | else |
| 337 | 337 | echo '<div id="message" class="error fade"><p><strong>' . __('Error: Your settings have not been saved, please try again.', 'geodirectory') . '</strong></p></div>';
|
| 338 | - break; |
|
| 339 | - } |
|
| 340 | - } |
|
| 338 | + break; |
|
| 339 | + } |
|
| 340 | + } |
|
| 341 | 341 | |
| 342 | - $geodir_load_map = get_option('geodir_load_map');
|
|
| 343 | - $need_map_key = false; |
|
| 344 | - if($geodir_load_map=='' || $geodir_load_map=='google' || $geodir_load_map=='auto' ){
|
|
| 345 | - $need_map_key = true; |
|
| 346 | - } |
|
| 342 | + $geodir_load_map = get_option('geodir_load_map');
|
|
| 343 | + $need_map_key = false; |
|
| 344 | + if($geodir_load_map=='' || $geodir_load_map=='google' || $geodir_load_map=='auto' ){
|
|
| 345 | + $need_map_key = true; |
|
| 346 | + } |
|
| 347 | 347 | |
| 348 | - if (!geodir_get_map_api_key() && $need_map_key) {
|
|
| 349 | - 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>';
|
|
| 350 | - } |
|
| 348 | + if (!geodir_get_map_api_key() && $need_map_key) {
|
|
| 349 | + 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>';
|
|
| 350 | + } |
|
| 351 | 351 | |
| 352 | - if (!geodir_is_default_location_set()) {
|
|
| 353 | - 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>';
|
|
| 352 | + if (!geodir_is_default_location_set()) {
|
|
| 353 | + 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>';
|
|
| 354 | 354 | |
| 355 | - } |
|
| 355 | + } |
|
| 356 | 356 | |
| 357 | - if (!function_exists('curl_init')) {
|
|
| 358 | - 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>';
|
|
| 357 | + if (!function_exists('curl_init')) {
|
|
| 358 | + 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>';
|
|
| 359 | 359 | |
| 360 | - } |
|
| 360 | + } |
|
| 361 | 361 | |
| 362 | 362 | |
| 363 | 363 | |
@@ -374,19 +374,19 @@ discard block |
||
| 374 | 374 | */ |
| 375 | 375 | function geodir_handle_option_form_submit($current_tab) |
| 376 | 376 | {
|
| 377 | - global $geodir_settings; |
|
| 378 | - if (file_exists(dirname(__FILE__) . '/option-pages/' . $current_tab . '_array.php')) {
|
|
| 379 | - /** |
|
| 380 | - * Contains settings array for current tab. |
|
| 381 | - * |
|
| 382 | - * @since 1.0.0 |
|
| 383 | - * @package GeoDirectory |
|
| 384 | - */ |
|
| 385 | - include_once('option-pages/' . $current_tab . '_array.php');
|
|
| 386 | - } |
|
| 387 | - if (isset($_POST) && $_POST && isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') : |
|
| 388 | - if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
|
|
| 389 | - if (!wp_verify_nonce($_REQUEST['_wpnonce-' . $current_tab], 'geodir-settings-' . $current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
|
|
| 377 | + global $geodir_settings; |
|
| 378 | + if (file_exists(dirname(__FILE__) . '/option-pages/' . $current_tab . '_array.php')) {
|
|
| 379 | + /** |
|
| 380 | + * Contains settings array for current tab. |
|
| 381 | + * |
|
| 382 | + * @since 1.0.0 |
|
| 383 | + * @package GeoDirectory |
|
| 384 | + */ |
|
| 385 | + include_once('option-pages/' . $current_tab . '_array.php');
|
|
| 386 | + } |
|
| 387 | + if (isset($_POST) && $_POST && isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') : |
|
| 388 | + if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
|
|
| 389 | + if (!wp_verify_nonce($_REQUEST['_wpnonce-' . $current_tab], 'geodir-settings-' . $current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
|
|
| 390 | 390 | |
| 391 | 391 | /** |
| 392 | 392 | * Fires before updating geodirectory admin settings. |
@@ -398,38 +398,38 @@ discard block |
||
| 398 | 398 | */ |
| 399 | 399 | do_action('geodir_before_update_options', $current_tab, $geodir_settings);
|
| 400 | 400 | |
| 401 | - if (!empty($geodir_settings[$current_tab])) |
|
| 402 | - geodir_update_options($geodir_settings[$current_tab]); |
|
| 401 | + if (!empty($geodir_settings[$current_tab])) |
|
| 402 | + geodir_update_options($geodir_settings[$current_tab]); |
|
| 403 | 403 | |
| 404 | - /** |
|
| 405 | - * Called after GeoDirectory options settings are updated. |
|
| 406 | - * |
|
| 407 | - * @since 1.0.0 |
|
| 408 | - * @param array $geodir_settings The array of GeoDirectory settings. |
|
| 409 | - * @see 'geodir_before_update_options' |
|
| 410 | - */ |
|
| 411 | - do_action('geodir_update_options', $geodir_settings);
|
|
| 404 | + /** |
|
| 405 | + * Called after GeoDirectory options settings are updated. |
|
| 406 | + * |
|
| 407 | + * @since 1.0.0 |
|
| 408 | + * @param array $geodir_settings The array of GeoDirectory settings. |
|
| 409 | + * @see 'geodir_before_update_options' |
|
| 410 | + */ |
|
| 411 | + do_action('geodir_update_options', $geodir_settings);
|
|
| 412 | 412 | |
| 413 | - /** |
|
| 414 | - * Called after GeoDirectory options settings are updated. |
|
| 415 | - * |
|
| 416 | - * Provides tab specific settings. |
|
| 417 | - * |
|
| 418 | - * @since 1.0.0 |
|
| 419 | - * @param string $current_tab The current settings tab name. |
|
| 420 | - * @param array $geodir_settings[$current_tab] The array of settings for the current settings tab. |
|
| 421 | - */ |
|
| 422 | - do_action('geodir_update_options_' . $current_tab, $geodir_settings[$current_tab]);
|
|
| 413 | + /** |
|
| 414 | + * Called after GeoDirectory options settings are updated. |
|
| 415 | + * |
|
| 416 | + * Provides tab specific settings. |
|
| 417 | + * |
|
| 418 | + * @since 1.0.0 |
|
| 419 | + * @param string $current_tab The current settings tab name. |
|
| 420 | + * @param array $geodir_settings[$current_tab] The array of settings for the current settings tab. |
|
| 421 | + */ |
|
| 422 | + do_action('geodir_update_options_' . $current_tab, $geodir_settings[$current_tab]);
|
|
| 423 | 423 | |
| 424 | - flush_rewrite_rules(false); |
|
| 424 | + flush_rewrite_rules(false); |
|
| 425 | 425 | |
| 426 | - $current_tab = isset($_REQUEST['tab']) ? $_REQUEST['tab'] : ''; |
|
| 426 | + $current_tab = isset($_REQUEST['tab']) ? $_REQUEST['tab'] : ''; |
|
| 427 | 427 | |
| 428 | - $redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $_REQUEST['active_tab'] . '&msg=success');
|
|
| 428 | + $redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $_REQUEST['active_tab'] . '&msg=success');
|
|
| 429 | 429 | |
| 430 | - wp_redirect($redirect_url); |
|
| 431 | - exit(); |
|
| 432 | - endif; |
|
| 430 | + wp_redirect($redirect_url); |
|
| 431 | + exit(); |
|
| 432 | + endif; |
|
| 433 | 433 | |
| 434 | 434 | |
| 435 | 435 | } |
@@ -447,144 +447,144 @@ discard block |
||
| 447 | 447 | * @return bool Returns true if saved. |
| 448 | 448 | */ |
| 449 | 449 | function geodir_update_options($options, $dummy = false) {
|
| 450 | - if ((!isset($_POST) || !$_POST) && !$dummy) return false; |
|
| 450 | + if ((!isset($_POST) || !$_POST) && !$dummy) return false; |
|
| 451 | 451 | |
| 452 | - foreach ($options as $value) {
|
|
| 453 | - if ($dummy && isset($value['std'])) |
|
| 454 | - $_POST[$value['id']] = $value['std']; |
|
| 452 | + foreach ($options as $value) {
|
|
| 453 | + if ($dummy && isset($value['std'])) |
|
| 454 | + $_POST[$value['id']] = $value['std']; |
|
| 455 | 455 | |
| 456 | 456 | |
| 457 | - if (isset($value['type']) && $value['type'] == 'checkbox') : |
|
| 457 | + if (isset($value['type']) && $value['type'] == 'checkbox') : |
|
| 458 | 458 | |
| 459 | - if (isset($value['id']) && isset($_POST[$value['id']])) {
|
|
| 460 | - update_option($value['id'], $_POST[$value['id']]); |
|
| 461 | - } else {
|
|
| 462 | - update_option($value['id'], 0); |
|
| 463 | - } |
|
| 459 | + if (isset($value['id']) && isset($_POST[$value['id']])) {
|
|
| 460 | + update_option($value['id'], $_POST[$value['id']]); |
|
| 461 | + } else {
|
|
| 462 | + update_option($value['id'], 0); |
|
| 463 | + } |
|
| 464 | 464 | |
| 465 | - elseif (isset($value['type']) && $value['type'] == 'image_width') : |
|
| 465 | + elseif (isset($value['type']) && $value['type'] == 'image_width') : |
|
| 466 | 466 | |
| 467 | - if (isset($value['id']) && isset($_POST[$value['id'] . '_width'])) {
|
|
| 468 | - update_option($value['id'] . '_width', $_POST[$value['id'] . '_width']); |
|
| 469 | - update_option($value['id'] . '_height', $_POST[$value['id'] . '_height']); |
|
| 470 | - if (isset($_POST[$value['id'] . '_crop'])) : |
|
| 471 | - update_option($value['id'] . '_crop', 1); |
|
| 472 | - else : |
|
| 473 | - update_option($value['id'] . '_crop', 0); |
|
| 474 | - endif; |
|
| 475 | - } else {
|
|
| 476 | - update_option($value['id'] . '_width', $value['std']); |
|
| 477 | - update_option($value['id'] . '_height', $value['std']); |
|
| 478 | - update_option($value['id'] . '_crop', 1); |
|
| 479 | - } |
|
| 467 | + if (isset($value['id']) && isset($_POST[$value['id'] . '_width'])) {
|
|
| 468 | + update_option($value['id'] . '_width', $_POST[$value['id'] . '_width']); |
|
| 469 | + update_option($value['id'] . '_height', $_POST[$value['id'] . '_height']); |
|
| 470 | + if (isset($_POST[$value['id'] . '_crop'])) : |
|
| 471 | + update_option($value['id'] . '_crop', 1); |
|
| 472 | + else : |
|
| 473 | + update_option($value['id'] . '_crop', 0); |
|
| 474 | + endif; |
|
| 475 | + } else {
|
|
| 476 | + update_option($value['id'] . '_width', $value['std']); |
|
| 477 | + update_option($value['id'] . '_height', $value['std']); |
|
| 478 | + update_option($value['id'] . '_crop', 1); |
|
| 479 | + } |
|
| 480 | 480 | |
| 481 | - elseif (isset($value['type']) && $value['type'] == 'map') : |
|
| 482 | - $post_types = array(); |
|
| 483 | - $categories = array(); |
|
| 481 | + elseif (isset($value['type']) && $value['type'] == 'map') : |
|
| 482 | + $post_types = array(); |
|
| 483 | + $categories = array(); |
|
| 484 | 484 | |
| 485 | - if (!empty($_POST['home_map_post_types'])) : |
|
| 486 | - foreach ($_POST['home_map_post_types'] as $post_type) : |
|
| 487 | - $post_types[] = $post_type; |
|
| 488 | - endforeach; |
|
| 489 | - endif; |
|
| 485 | + if (!empty($_POST['home_map_post_types'])) : |
|
| 486 | + foreach ($_POST['home_map_post_types'] as $post_type) : |
|
| 487 | + $post_types[] = $post_type; |
|
| 488 | + endforeach; |
|
| 489 | + endif; |
|
| 490 | 490 | |
| 491 | - update_option('geodir_exclude_post_type_on_map', $post_types);
|
|
| 491 | + update_option('geodir_exclude_post_type_on_map', $post_types);
|
|
| 492 | 492 | |
| 493 | - if (!empty($_POST['post_category'])) : |
|
| 494 | - foreach ($_POST['post_category'] as $texonomy => $cat_arr) : |
|
| 495 | - $categories[$texonomy] = array(); |
|
| 496 | - foreach ($cat_arr as $category) : |
|
| 497 | - $categories[$texonomy][] = $category; |
|
| 498 | - endforeach; |
|
| 499 | - $categories[$texonomy] = !empty($categories[$texonomy]) ? array_unique($categories[$texonomy]) : array(); |
|
| 500 | - endforeach; |
|
| 501 | - endif; |
|
| 502 | - update_option('geodir_exclude_cat_on_map', $categories);
|
|
| 503 | - update_option('geodir_exclude_cat_on_map_upgrade', 1);
|
|
| 504 | - elseif (isset($value['type']) && $value['type'] == 'map_default_settings') : |
|
| 493 | + if (!empty($_POST['post_category'])) : |
|
| 494 | + foreach ($_POST['post_category'] as $texonomy => $cat_arr) : |
|
| 495 | + $categories[$texonomy] = array(); |
|
| 496 | + foreach ($cat_arr as $category) : |
|
| 497 | + $categories[$texonomy][] = $category; |
|
| 498 | + endforeach; |
|
| 499 | + $categories[$texonomy] = !empty($categories[$texonomy]) ? array_unique($categories[$texonomy]) : array(); |
|
| 500 | + endforeach; |
|
| 501 | + endif; |
|
| 502 | + update_option('geodir_exclude_cat_on_map', $categories);
|
|
| 503 | + update_option('geodir_exclude_cat_on_map_upgrade', 1);
|
|
| 504 | + elseif (isset($value['type']) && $value['type'] == 'map_default_settings') : |
|
| 505 | 505 | |
| 506 | 506 | |
| 507 | - if (!empty($_POST['geodir_default_map_language'])): |
|
| 508 | - update_option('geodir_default_map_language', $_POST['geodir_default_map_language']);
|
|
| 509 | - endif; |
|
| 507 | + if (!empty($_POST['geodir_default_map_language'])): |
|
| 508 | + update_option('geodir_default_map_language', $_POST['geodir_default_map_language']);
|
|
| 509 | + endif; |
|
| 510 | 510 | |
| 511 | 511 | |
| 512 | - if (!empty($_POST['geodir_default_map_search_pt'])): |
|
| 513 | - update_option('geodir_default_map_search_pt', $_POST['geodir_default_map_search_pt']);
|
|
| 514 | - endif; |
|
| 512 | + if (!empty($_POST['geodir_default_map_search_pt'])): |
|
| 513 | + update_option('geodir_default_map_search_pt', $_POST['geodir_default_map_search_pt']);
|
|
| 514 | + endif; |
|
| 515 | 515 | |
| 516 | 516 | |
| 517 | - elseif (isset($value['type']) && $value['type'] == 'file') : |
|
| 517 | + elseif (isset($value['type']) && $value['type'] == 'file') : |
|
| 518 | 518 | |
| 519 | 519 | |
| 520 | - if (isset($_POST[$value['id'] . '_remove']) && $_POST[$value['id'] . '_remove']) {// if remove is set then remove the file
|
|
| 520 | + if (isset($_POST[$value['id'] . '_remove']) && $_POST[$value['id'] . '_remove']) {// if remove is set then remove the file
|
|
| 521 | 521 | |
| 522 | - if (get_option($value['id'])) {
|
|
| 523 | - $image_name_arr = explode('/', get_option($value['id']));
|
|
| 524 | - $noimg_name = end($image_name_arr); |
|
| 525 | - $img_path = $uploads['path'] . '/' . $noimg_name; |
|
| 526 | - if (file_exists($img_path)) |
|
| 527 | - unlink($img_path); |
|
| 528 | - } |
|
| 522 | + if (get_option($value['id'])) {
|
|
| 523 | + $image_name_arr = explode('/', get_option($value['id']));
|
|
| 524 | + $noimg_name = end($image_name_arr); |
|
| 525 | + $img_path = $uploads['path'] . '/' . $noimg_name; |
|
| 526 | + if (file_exists($img_path)) |
|
| 527 | + unlink($img_path); |
|
| 528 | + } |
|
| 529 | 529 | |
| 530 | - update_option($value['id'], ''); |
|
| 531 | - } |
|
| 530 | + update_option($value['id'], ''); |
|
| 531 | + } |
|
| 532 | 532 | |
| 533 | - $uploadedfile = isset($_FILES[$value['id']]) ? $_FILES[$value['id']] : ''; |
|
| 534 | - $filename = isset($_FILES[$value['id']]['name']) ? $_FILES[$value['id']]['name'] : ''; |
|
| 535 | - |
|
| 536 | - if (!empty($filename)): |
|
| 537 | - $ext = pathinfo($filename, PATHINFO_EXTENSION); |
|
| 538 | - $uplaods = array(); |
|
| 539 | - |
|
| 540 | - foreach ($uploadedfile as $key => $uplaod): |
|
| 541 | - if ($key == 'name'): |
|
| 542 | - $uplaods[$key] = $filename; |
|
| 543 | - else : |
|
| 544 | - $uplaods[$key] = $uplaod; |
|
| 545 | - endif; |
|
| 546 | - endforeach; |
|
| 547 | - |
|
| 548 | - $uploads = wp_upload_dir(); |
|
| 549 | - |
|
| 550 | - if (get_option($value['id'])) {
|
|
| 551 | - $image_name_arr = explode('/', get_option($value['id']));
|
|
| 552 | - $noimg_name = end($image_name_arr); |
|
| 553 | - $img_path = $uploads['path'] . '/' . $noimg_name; |
|
| 554 | - if (file_exists($img_path)) |
|
| 555 | - unlink($img_path); |
|
| 556 | - } |
|
| 533 | + $uploadedfile = isset($_FILES[$value['id']]) ? $_FILES[$value['id']] : ''; |
|
| 534 | + $filename = isset($_FILES[$value['id']]['name']) ? $_FILES[$value['id']]['name'] : ''; |
|
| 535 | + |
|
| 536 | + if (!empty($filename)): |
|
| 537 | + $ext = pathinfo($filename, PATHINFO_EXTENSION); |
|
| 538 | + $uplaods = array(); |
|
| 539 | + |
|
| 540 | + foreach ($uploadedfile as $key => $uplaod): |
|
| 541 | + if ($key == 'name'): |
|
| 542 | + $uplaods[$key] = $filename; |
|
| 543 | + else : |
|
| 544 | + $uplaods[$key] = $uplaod; |
|
| 545 | + endif; |
|
| 546 | + endforeach; |
|
| 547 | + |
|
| 548 | + $uploads = wp_upload_dir(); |
|
| 549 | + |
|
| 550 | + if (get_option($value['id'])) {
|
|
| 551 | + $image_name_arr = explode('/', get_option($value['id']));
|
|
| 552 | + $noimg_name = end($image_name_arr); |
|
| 553 | + $img_path = $uploads['path'] . '/' . $noimg_name; |
|
| 554 | + if (file_exists($img_path)) |
|
| 555 | + unlink($img_path); |
|
| 556 | + } |
|
| 557 | 557 | |
| 558 | - $upload_overrides = array('test_form' => false);
|
|
| 559 | - $movefile = wp_handle_upload($uplaods, $upload_overrides); |
|
| 558 | + $upload_overrides = array('test_form' => false);
|
|
| 559 | + $movefile = wp_handle_upload($uplaods, $upload_overrides); |
|
| 560 | 560 | |
| 561 | - update_option($value['id'], $movefile['url']); |
|
| 561 | + update_option($value['id'], $movefile['url']); |
|
| 562 | 562 | |
| 563 | - endif; |
|
| 563 | + endif; |
|
| 564 | 564 | |
| 565 | - if (!get_option($value['id']) && isset($value['value'])): |
|
| 566 | - update_option($value['id'], $value['value']); |
|
| 567 | - endif; |
|
| 565 | + if (!get_option($value['id']) && isset($value['value'])): |
|
| 566 | + update_option($value['id'], $value['value']); |
|
| 567 | + endif; |
|
| 568 | 568 | |
| 569 | 569 | |
| 570 | - else : |
|
| 571 | - // same menu setting per theme. |
|
| 572 | - if (isset($value['id']) && $value['id'] == 'geodir_theme_location_nav' && isset($_POST[$value['id']])) {
|
|
| 573 | - $theme = wp_get_theme(); |
|
| 574 | - update_option('geodir_theme_location_nav_' . $theme->name, $_POST[$value['id']]);
|
|
| 575 | - } |
|
| 570 | + else : |
|
| 571 | + // same menu setting per theme. |
|
| 572 | + if (isset($value['id']) && $value['id'] == 'geodir_theme_location_nav' && isset($_POST[$value['id']])) {
|
|
| 573 | + $theme = wp_get_theme(); |
|
| 574 | + update_option('geodir_theme_location_nav_' . $theme->name, $_POST[$value['id']]);
|
|
| 575 | + } |
|
| 576 | 576 | |
| 577 | - if (isset($value['id']) && isset($_POST[$value['id']])) {
|
|
| 578 | - update_option($value['id'], $_POST[$value['id']]); |
|
| 579 | - } else {
|
|
| 580 | - delete_option($value['id']); |
|
| 581 | - } |
|
| 577 | + if (isset($value['id']) && isset($_POST[$value['id']])) {
|
|
| 578 | + update_option($value['id'], $_POST[$value['id']]); |
|
| 579 | + } else {
|
|
| 580 | + delete_option($value['id']); |
|
| 581 | + } |
|
| 582 | 582 | |
| 583 | - endif; |
|
| 584 | - } |
|
| 585 | - if ($dummy) |
|
| 586 | - $_POST = array(); |
|
| 587 | - return true; |
|
| 583 | + endif; |
|
| 584 | + } |
|
| 585 | + if ($dummy) |
|
| 586 | + $_POST = array(); |
|
| 587 | + return true; |
|
| 588 | 588 | |
| 589 | 589 | } |
| 590 | 590 | |
@@ -633,33 +633,33 @@ discard block |
||
| 633 | 633 | function places_custom_fields_tab($tabs) |
| 634 | 634 | {
|
| 635 | 635 | |
| 636 | - $geodir_post_types = get_option('geodir_post_types');
|
|
| 636 | + $geodir_post_types = get_option('geodir_post_types');
|
|
| 637 | 637 | |
| 638 | - if (!empty($geodir_post_types)) {
|
|
| 638 | + if (!empty($geodir_post_types)) {
|
|
| 639 | 639 | |
| 640 | - foreach ($geodir_post_types as $geodir_post_type => $geodir_posttype_info): |
|
| 640 | + foreach ($geodir_post_types as $geodir_post_type => $geodir_posttype_info): |
|
| 641 | 641 | |
| 642 | - $listing_slug = $geodir_posttype_info['labels']['singular_name']; |
|
| 642 | + $listing_slug = $geodir_posttype_info['labels']['singular_name']; |
|
| 643 | 643 | |
| 644 | - $tabs[$geodir_post_type . '_fields_settings'] = array( |
|
| 645 | - 'label' => __(ucfirst($listing_slug) . ' Settings', 'geodirectory'), |
|
| 646 | - 'subtabs' => array( |
|
| 647 | - array('subtab' => 'custom_fields',
|
|
| 648 | - 'label' => __('Custom Fields', 'geodirectory'),
|
|
| 649 | - 'request' => array('listing_type' => $geodir_post_type)),
|
|
| 650 | - array('subtab' => 'sorting_options',
|
|
| 651 | - 'label' => __('Sorting Options', 'geodirectory'),
|
|
| 652 | - 'request' => array('listing_type' => $geodir_post_type)),
|
|
| 653 | - ), |
|
| 654 | - 'tab_index' => 9, |
|
| 655 | - 'request' => array('listing_type' => $geodir_post_type)
|
|
| 656 | - ); |
|
| 644 | + $tabs[$geodir_post_type . '_fields_settings'] = array( |
|
| 645 | + 'label' => __(ucfirst($listing_slug) . ' Settings', 'geodirectory'), |
|
| 646 | + 'subtabs' => array( |
|
| 647 | + array('subtab' => 'custom_fields',
|
|
| 648 | + 'label' => __('Custom Fields', 'geodirectory'),
|
|
| 649 | + 'request' => array('listing_type' => $geodir_post_type)),
|
|
| 650 | + array('subtab' => 'sorting_options',
|
|
| 651 | + 'label' => __('Sorting Options', 'geodirectory'),
|
|
| 652 | + 'request' => array('listing_type' => $geodir_post_type)),
|
|
| 653 | + ), |
|
| 654 | + 'tab_index' => 9, |
|
| 655 | + 'request' => array('listing_type' => $geodir_post_type)
|
|
| 656 | + ); |
|
| 657 | 657 | |
| 658 | - endforeach; |
|
| 658 | + endforeach; |
|
| 659 | 659 | |
| 660 | - } |
|
| 660 | + } |
|
| 661 | 661 | |
| 662 | - return $tabs; |
|
| 662 | + return $tabs; |
|
| 663 | 663 | } |
| 664 | 664 | |
| 665 | 665 | |
@@ -675,9 +675,9 @@ discard block |
||
| 675 | 675 | */ |
| 676 | 676 | function geodir_tools_setting_tab($tabs) |
| 677 | 677 | {
|
| 678 | - wp_enqueue_script( 'jquery-ui-progressbar' ); |
|
| 679 | - $tabs['tools_settings'] = array('label' => __('GD Tools', 'geodirectory'));
|
|
| 680 | - return $tabs; |
|
| 678 | + wp_enqueue_script( 'jquery-ui-progressbar' ); |
|
| 679 | + $tabs['tools_settings'] = array('label' => __('GD Tools', 'geodirectory'));
|
|
| 680 | + return $tabs; |
|
| 681 | 681 | } |
| 682 | 682 | |
| 683 | 683 | /** |
@@ -692,8 +692,8 @@ discard block |
||
| 692 | 692 | */ |
| 693 | 693 | function geodir_compatibility_setting_tab($tabs) |
| 694 | 694 | {
|
| 695 | - $tabs['compatibility_settings'] = array('label' => __('Theme Compatibility', 'geodirectory'));
|
|
| 696 | - return $tabs; |
|
| 695 | + $tabs['compatibility_settings'] = array('label' => __('Theme Compatibility', 'geodirectory'));
|
|
| 696 | + return $tabs; |
|
| 697 | 697 | } |
| 698 | 698 | |
| 699 | 699 | |
@@ -709,144 +709,144 @@ discard block |
||
| 709 | 709 | */ |
| 710 | 710 | function geodir_extend_geodirectory_setting_tab($tabs) |
| 711 | 711 | {
|
| 712 | - $tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory'). ' <i class="fa fa-plug"></i>', 'url' => 'https://wpgeodirectory.com', 'target' => '_blank');
|
|
| 713 | - return $tabs; |
|
| 712 | + $tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory'). ' <i class="fa fa-plug"></i>', 'url' => 'https://wpgeodirectory.com', 'target' => '_blank');
|
|
| 713 | + return $tabs; |
|
| 714 | 714 | } |
| 715 | 715 | |
| 716 | 716 | |
| 717 | 717 | if (!function_exists('geodir_edit_post_columns')) {
|
| 718 | - /** |
|
| 719 | - * Modify admin post listing page columns. |
|
| 720 | - * |
|
| 721 | - * @since 1.0.0 |
|
| 722 | - * @package GeoDirectory |
|
| 723 | - * @param array $columns The column array. |
|
| 724 | - * @return array Altered column array. |
|
| 725 | - */ |
|
| 726 | - function geodir_edit_post_columns($columns) |
|
| 727 | - {
|
|
| 728 | - |
|
| 729 | - $new_columns = array('location' => __('Location (ID)', 'geodirectory'),
|
|
| 730 | - 'categorys' => __('Categories', 'geodirectory'));
|
|
| 731 | - |
|
| 732 | - if (($offset = array_search('author', array_keys($columns))) === false) // if the key doesn't exist
|
|
| 733 | - {
|
|
| 734 | - $offset = 0; // should we prepend $array with $data? |
|
| 735 | - $offset = count($columns); // or should we append $array with $data? lets pick this one... |
|
| 736 | - } |
|
| 718 | + /** |
|
| 719 | + * Modify admin post listing page columns. |
|
| 720 | + * |
|
| 721 | + * @since 1.0.0 |
|
| 722 | + * @package GeoDirectory |
|
| 723 | + * @param array $columns The column array. |
|
| 724 | + * @return array Altered column array. |
|
| 725 | + */ |
|
| 726 | + function geodir_edit_post_columns($columns) |
|
| 727 | + {
|
|
| 728 | + |
|
| 729 | + $new_columns = array('location' => __('Location (ID)', 'geodirectory'),
|
|
| 730 | + 'categorys' => __('Categories', 'geodirectory'));
|
|
| 737 | 731 | |
| 738 | - $columns = array_merge(array_slice($columns, 0, $offset), $new_columns, array_slice($columns, $offset)); |
|
| 732 | + if (($offset = array_search('author', array_keys($columns))) === false) // if the key doesn't exist
|
|
| 733 | + {
|
|
| 734 | + $offset = 0; // should we prepend $array with $data? |
|
| 735 | + $offset = count($columns); // or should we append $array with $data? lets pick this one... |
|
| 736 | + } |
|
| 739 | 737 | |
| 740 | - $columns = array_merge($columns, array('expire' => __('Expires', 'geodirectory')));
|
|
| 738 | + $columns = array_merge(array_slice($columns, 0, $offset), $new_columns, array_slice($columns, $offset)); |
|
| 741 | 739 | |
| 742 | - return $columns; |
|
| 743 | - } |
|
| 740 | + $columns = array_merge($columns, array('expire' => __('Expires', 'geodirectory')));
|
|
| 741 | + |
|
| 742 | + return $columns; |
|
| 743 | + } |
|
| 744 | 744 | } |
| 745 | 745 | |
| 746 | 746 | |
| 747 | 747 | if (!function_exists('geodir_manage_post_columns')) {
|
| 748 | - /** |
|
| 749 | - * Adds content to our custom post listing page columns. |
|
| 750 | - * |
|
| 751 | - * @since 1.0.0 |
|
| 752 | - * @package GeoDirectory |
|
| 753 | - * @global object $wpdb WordPress Database object. |
|
| 754 | - * @global object $post WordPress Post object. |
|
| 755 | - * @param string $column The column name. |
|
| 756 | - * @param int $post_id The post ID. |
|
| 757 | - */ |
|
| 758 | - function geodir_manage_post_columns($column, $post_id) |
|
| 759 | - {
|
|
| 760 | - global $post, $wpdb; |
|
| 761 | - |
|
| 762 | - switch ($column): |
|
| 763 | - /* If displaying the 'city' column. */ |
|
| 764 | - case 'location' : |
|
| 765 | - $location_id = geodir_get_post_meta($post->ID, 'post_location_id', true); |
|
| 766 | - $location = geodir_get_location($location_id); |
|
| 767 | - /* If no city is found, output a default message. */ |
|
| 768 | - if (empty($location)) {
|
|
| 769 | - _e('Unknown', 'geodirectory');
|
|
| 770 | - } else {
|
|
| 771 | - /* If there is a city id, append 'city name' to the text string. */ |
|
| 772 | - $add_location_id = $location_id > 0 ? ' (' . $location_id . ')' : '';
|
|
| 773 | - echo(__($location->country, 'geodirectory') . '-' . $location->region . '-' . $location->city . $add_location_id); |
|
| 774 | - } |
|
| 775 | - break; |
|
| 776 | - |
|
| 777 | - /* If displaying the 'expire' column. */ |
|
| 778 | - case 'expire' : |
|
| 779 | - $expire_date = geodir_get_post_meta($post->ID, 'expire_date', true); |
|
| 780 | - $d1 = $expire_date; // get expire_date |
|
| 781 | - $d2 = date('Y-m-d'); // get current date
|
|
| 782 | - $state = __('days left', 'geodirectory');
|
|
| 783 | - $date_diff_text = ''; |
|
| 784 | - $expire_class = 'expire_left'; |
|
| 785 | - if ($expire_date != 'Never') {
|
|
| 786 | - if (strtotime($d1) < strtotime($d2)) {
|
|
| 787 | - $state = __('days overdue', 'geodirectory');
|
|
| 788 | - $expire_class = 'expire_over'; |
|
| 789 | - } |
|
| 790 | - $date_diff = round(abs(strtotime($d1) - strtotime($d2)) / 86400); // get the difference in days |
|
| 791 | - $date_diff_text = '<br /><span class="' . $expire_class . '">(' . $date_diff . ' ' . $state . ')</span>';
|
|
| 792 | - } |
|
| 793 | - /* If no expire_date is found, output a default message. */ |
|
| 794 | - if (empty($expire_date)) |
|
| 795 | - echo __('Unknown', 'geodirectory');
|
|
| 796 | - /* If there is a expire_date, append 'days left' to the text string. */ |
|
| 797 | - else |
|
| 798 | - echo $expire_date . $date_diff_text; |
|
| 799 | - break; |
|
| 800 | - |
|
| 801 | - /* If displaying the 'categorys' column. */ |
|
| 802 | - case 'categorys' : |
|
| 803 | - |
|
| 804 | - /* Get the categorys for the post. */ |
|
| 805 | - |
|
| 806 | - |
|
| 807 | - $terms = wp_get_object_terms($post_id, get_object_taxonomies($post)); |
|
| 808 | - |
|
| 809 | - /* If terms were found. */ |
|
| 810 | - if (!empty($terms)) {
|
|
| 811 | - $out = array(); |
|
| 812 | - /* Loop through each term, linking to the 'edit posts' page for the specific term. */ |
|
| 813 | - foreach ($terms as $term) {
|
|
| 814 | - if (!strstr($term->taxonomy, 'tag')) {
|
|
| 815 | - $out[] = sprintf('<a href="%s">%s</a>',
|
|
| 816 | - esc_url(add_query_arg(array('post_type' => $post->post_type, $term->taxonomy => $term->slug), 'edit.php')),
|
|
| 817 | - esc_html(sanitize_term_field('name', $term->name, $term->term_id, $term->taxonomy, 'display'))
|
|
| 818 | - ); |
|
| 819 | - } |
|
| 820 | - } |
|
| 821 | - /* Join the terms, separating them with a comma. */ |
|
| 822 | - echo(join(', ', $out));
|
|
| 823 | - } /* If no terms were found, output a default message. */ |
|
| 824 | - else {
|
|
| 825 | - _e('No Categories', 'geodirectory');
|
|
| 826 | - } |
|
| 827 | - break; |
|
| 748 | + /** |
|
| 749 | + * Adds content to our custom post listing page columns. |
|
| 750 | + * |
|
| 751 | + * @since 1.0.0 |
|
| 752 | + * @package GeoDirectory |
|
| 753 | + * @global object $wpdb WordPress Database object. |
|
| 754 | + * @global object $post WordPress Post object. |
|
| 755 | + * @param string $column The column name. |
|
| 756 | + * @param int $post_id The post ID. |
|
| 757 | + */ |
|
| 758 | + function geodir_manage_post_columns($column, $post_id) |
|
| 759 | + {
|
|
| 760 | + global $post, $wpdb; |
|
| 761 | + |
|
| 762 | + switch ($column): |
|
| 763 | + /* If displaying the 'city' column. */ |
|
| 764 | + case 'location' : |
|
| 765 | + $location_id = geodir_get_post_meta($post->ID, 'post_location_id', true); |
|
| 766 | + $location = geodir_get_location($location_id); |
|
| 767 | + /* If no city is found, output a default message. */ |
|
| 768 | + if (empty($location)) {
|
|
| 769 | + _e('Unknown', 'geodirectory');
|
|
| 770 | + } else {
|
|
| 771 | + /* If there is a city id, append 'city name' to the text string. */ |
|
| 772 | + $add_location_id = $location_id > 0 ? ' (' . $location_id . ')' : '';
|
|
| 773 | + echo(__($location->country, 'geodirectory') . '-' . $location->region . '-' . $location->city . $add_location_id); |
|
| 774 | + } |
|
| 775 | + break; |
|
| 776 | + |
|
| 777 | + /* If displaying the 'expire' column. */ |
|
| 778 | + case 'expire' : |
|
| 779 | + $expire_date = geodir_get_post_meta($post->ID, 'expire_date', true); |
|
| 780 | + $d1 = $expire_date; // get expire_date |
|
| 781 | + $d2 = date('Y-m-d'); // get current date
|
|
| 782 | + $state = __('days left', 'geodirectory');
|
|
| 783 | + $date_diff_text = ''; |
|
| 784 | + $expire_class = 'expire_left'; |
|
| 785 | + if ($expire_date != 'Never') {
|
|
| 786 | + if (strtotime($d1) < strtotime($d2)) {
|
|
| 787 | + $state = __('days overdue', 'geodirectory');
|
|
| 788 | + $expire_class = 'expire_over'; |
|
| 789 | + } |
|
| 790 | + $date_diff = round(abs(strtotime($d1) - strtotime($d2)) / 86400); // get the difference in days |
|
| 791 | + $date_diff_text = '<br /><span class="' . $expire_class . '">(' . $date_diff . ' ' . $state . ')</span>';
|
|
| 792 | + } |
|
| 793 | + /* If no expire_date is found, output a default message. */ |
|
| 794 | + if (empty($expire_date)) |
|
| 795 | + echo __('Unknown', 'geodirectory');
|
|
| 796 | + /* If there is a expire_date, append 'days left' to the text string. */ |
|
| 797 | + else |
|
| 798 | + echo $expire_date . $date_diff_text; |
|
| 799 | + break; |
|
| 828 | 800 | |
| 829 | - endswitch; |
|
| 830 | - } |
|
| 801 | + /* If displaying the 'categorys' column. */ |
|
| 802 | + case 'categorys' : |
|
| 803 | + |
|
| 804 | + /* Get the categorys for the post. */ |
|
| 805 | + |
|
| 806 | + |
|
| 807 | + $terms = wp_get_object_terms($post_id, get_object_taxonomies($post)); |
|
| 808 | + |
|
| 809 | + /* If terms were found. */ |
|
| 810 | + if (!empty($terms)) {
|
|
| 811 | + $out = array(); |
|
| 812 | + /* Loop through each term, linking to the 'edit posts' page for the specific term. */ |
|
| 813 | + foreach ($terms as $term) {
|
|
| 814 | + if (!strstr($term->taxonomy, 'tag')) {
|
|
| 815 | + $out[] = sprintf('<a href="%s">%s</a>',
|
|
| 816 | + esc_url(add_query_arg(array('post_type' => $post->post_type, $term->taxonomy => $term->slug), 'edit.php')),
|
|
| 817 | + esc_html(sanitize_term_field('name', $term->name, $term->term_id, $term->taxonomy, 'display'))
|
|
| 818 | + ); |
|
| 819 | + } |
|
| 820 | + } |
|
| 821 | + /* Join the terms, separating them with a comma. */ |
|
| 822 | + echo(join(', ', $out));
|
|
| 823 | + } /* If no terms were found, output a default message. */ |
|
| 824 | + else {
|
|
| 825 | + _e('No Categories', 'geodirectory');
|
|
| 826 | + } |
|
| 827 | + break; |
|
| 828 | + |
|
| 829 | + endswitch; |
|
| 830 | + } |
|
| 831 | 831 | } |
| 832 | 832 | |
| 833 | 833 | |
| 834 | 834 | if (!function_exists('geodir_post_sortable_columns')) {
|
| 835 | - /** |
|
| 836 | - * Makes admin post listing page columns sortable. |
|
| 837 | - * |
|
| 838 | - * @since 1.0.0 |
|
| 839 | - * @package GeoDirectory |
|
| 840 | - * @param array $columns The column array. |
|
| 841 | - * @return array Altered column array. |
|
| 842 | - */ |
|
| 843 | - function geodir_post_sortable_columns($columns) |
|
| 844 | - {
|
|
| 845 | - |
|
| 846 | - $columns['expire'] = 'expire'; |
|
| 847 | - |
|
| 848 | - return $columns; |
|
| 849 | - } |
|
| 835 | + /** |
|
| 836 | + * Makes admin post listing page columns sortable. |
|
| 837 | + * |
|
| 838 | + * @since 1.0.0 |
|
| 839 | + * @package GeoDirectory |
|
| 840 | + * @param array $columns The column array. |
|
| 841 | + * @return array Altered column array. |
|
| 842 | + */ |
|
| 843 | + function geodir_post_sortable_columns($columns) |
|
| 844 | + {
|
|
| 845 | + |
|
| 846 | + $columns['expire'] = 'expire'; |
|
| 847 | + |
|
| 848 | + return $columns; |
|
| 849 | + } |
|
| 850 | 850 | } |
| 851 | 851 | |
| 852 | 852 | /** |
@@ -860,32 +860,32 @@ discard block |
||
| 860 | 860 | * @param int $post_id The post ID. |
| 861 | 861 | */ |
| 862 | 862 | function geodir_post_information_save($post_id, $post) {
|
| 863 | - global $wpdb, $current_user; |
|
| 863 | + global $wpdb, $current_user; |
|
| 864 | 864 | |
| 865 | - if (isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')) {
|
|
| 866 | - return; |
|
| 867 | - } |
|
| 865 | + if (isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')) {
|
|
| 866 | + return; |
|
| 867 | + } |
|
| 868 | 868 | |
| 869 | - $geodir_posttypes = geodir_get_posttypes(); |
|
| 869 | + $geodir_posttypes = geodir_get_posttypes(); |
|
| 870 | 870 | |
| 871 | - if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
|
|
| 872 | - return; |
|
| 871 | + if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
|
|
| 872 | + return; |
|
| 873 | 873 | |
| 874 | - if (!wp_is_post_revision($post_id) && isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)) {
|
|
| 875 | - if (isset($_REQUEST['_status'])) |
|
| 876 | - geodir_change_post_status($post_id, $_REQUEST['_status']); |
|
| 874 | + if (!wp_is_post_revision($post_id) && isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)) {
|
|
| 875 | + if (isset($_REQUEST['_status'])) |
|
| 876 | + geodir_change_post_status($post_id, $_REQUEST['_status']); |
|
| 877 | 877 | |
| 878 | - if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'trash' || $_REQUEST['action'] == 'untrash')) |
|
| 879 | - return; |
|
| 878 | + if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'trash' || $_REQUEST['action'] == 'untrash')) |
|
| 879 | + return; |
|
| 880 | 880 | |
| 881 | - if (!isset($_POST['geodir_post_info_noncename']) || !wp_verify_nonce($_POST['geodir_post_info_noncename'], plugin_basename(__FILE__))) |
|
| 882 | - return; |
|
| 881 | + if (!isset($_POST['geodir_post_info_noncename']) || !wp_verify_nonce($_POST['geodir_post_info_noncename'], plugin_basename(__FILE__))) |
|
| 882 | + return; |
|
| 883 | 883 | |
| 884 | - if (!isset($_POST['geodir_post_attachments_noncename']) || !wp_verify_nonce($_POST['geodir_post_attachments_noncename'], plugin_basename(__FILE__))) |
|
| 885 | - return; |
|
| 884 | + if (!isset($_POST['geodir_post_attachments_noncename']) || !wp_verify_nonce($_POST['geodir_post_attachments_noncename'], plugin_basename(__FILE__))) |
|
| 885 | + return; |
|
| 886 | 886 | |
| 887 | - geodir_save_listing($_REQUEST); |
|
| 888 | - } |
|
| 887 | + geodir_save_listing($_REQUEST); |
|
| 888 | + } |
|
| 889 | 889 | } |
| 890 | 890 | |
| 891 | 891 | /** |
@@ -901,102 +901,102 @@ discard block |
||
| 901 | 901 | */ |
| 902 | 902 | function geodir_admin_fields($options) |
| 903 | 903 | {
|
| 904 | - global $geodirectory; |
|
| 905 | - |
|
| 906 | - $first_title = true; |
|
| 907 | - $tab_id = ''; |
|
| 908 | - $i = 0; |
|
| 909 | - foreach ($options as $value) : |
|
| 910 | - if (!isset($value['name'])) $value['name'] = ''; |
|
| 911 | - if (!isset($value['class'])) $value['class'] = ''; |
|
| 912 | - if (!isset($value['css'])) $value['css'] = ''; |
|
| 913 | - if (!isset($value['std'])) $value['std'] = ''; |
|
| 914 | - $desc = ''; |
|
| 915 | - switch ($value['type']) : |
|
| 916 | - case 'dummy_installer': |
|
| 917 | - $post_type = isset($value['post_type']) ? $value['post_type'] : 'gd_place'; |
|
| 918 | - geodir_autoinstall_admin_header($post_type); |
|
| 919 | - break; |
|
| 920 | - case 'title': |
|
| 921 | - |
|
| 922 | - if ($i == 0) {
|
|
| 923 | - echo '<dl id="geodir_oiption_tabs" class="gd-tab-head"></dl>'; |
|
| 924 | - echo '<div class="inner_content_tab_main">'; |
|
| 925 | - } |
|
| 904 | + global $geodirectory; |
|
| 905 | + |
|
| 906 | + $first_title = true; |
|
| 907 | + $tab_id = ''; |
|
| 908 | + $i = 0; |
|
| 909 | + foreach ($options as $value) : |
|
| 910 | + if (!isset($value['name'])) $value['name'] = ''; |
|
| 911 | + if (!isset($value['class'])) $value['class'] = ''; |
|
| 912 | + if (!isset($value['css'])) $value['css'] = ''; |
|
| 913 | + if (!isset($value['std'])) $value['std'] = ''; |
|
| 914 | + $desc = ''; |
|
| 915 | + switch ($value['type']) : |
|
| 916 | + case 'dummy_installer': |
|
| 917 | + $post_type = isset($value['post_type']) ? $value['post_type'] : 'gd_place'; |
|
| 918 | + geodir_autoinstall_admin_header($post_type); |
|
| 919 | + break; |
|
| 920 | + case 'title': |
|
| 921 | + |
|
| 922 | + if ($i == 0) {
|
|
| 923 | + echo '<dl id="geodir_oiption_tabs" class="gd-tab-head"></dl>'; |
|
| 924 | + echo '<div class="inner_content_tab_main">'; |
|
| 925 | + } |
|
| 926 | 926 | |
| 927 | - $i++; |
|
| 927 | + $i++; |
|
| 928 | 928 | |
| 929 | - if (isset($value['id']) && $value['id']) |
|
| 930 | - $tab_id = $value['id']; |
|
| 929 | + if (isset($value['id']) && $value['id']) |
|
| 930 | + $tab_id = $value['id']; |
|
| 931 | 931 | |
| 932 | - if (isset($value['desc']) && $value['desc']) |
|
| 933 | - $desc = '<span style=" text-transform:none;">:- ' . $value['desc'] . '</span>'; |
|
| 932 | + if (isset($value['desc']) && $value['desc']) |
|
| 933 | + $desc = '<span style=" text-transform:none;">:- ' . $value['desc'] . '</span>'; |
|
| 934 | 934 | |
| 935 | - if (isset($value['name']) && $value['name']) {
|
|
| 936 | - if ($first_title === true) {
|
|
| 937 | - $first_title = false; |
|
| 938 | - } else {
|
|
| 939 | - echo '</div>'; |
|
| 940 | - } |
|
| 941 | - echo '<dd id="' . trim($tab_id) . '" class="geodir_option_tabs" ><a href="javascript:void(0);">' . $value['name'] . '</a></dd>'; |
|
| 935 | + if (isset($value['name']) && $value['name']) {
|
|
| 936 | + if ($first_title === true) {
|
|
| 937 | + $first_title = false; |
|
| 938 | + } else {
|
|
| 939 | + echo '</div>'; |
|
| 940 | + } |
|
| 941 | + echo '<dd id="' . trim($tab_id) . '" class="geodir_option_tabs" ><a href="javascript:void(0);">' . $value['name'] . '</a></dd>'; |
|
| 942 | 942 | |
| 943 | - echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >'; |
|
| 944 | - } |
|
| 943 | + echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >'; |
|
| 944 | + } |
|
| 945 | 945 | |
| 946 | - /** |
|
| 947 | - * Called after a GeoDirectory settings title is output in the GD settings page. |
|
| 948 | - * |
|
| 949 | - * The action is called dynamically geodir_settings_$value['id']. |
|
| 950 | - * |
|
| 951 | - * @since 1.0.0 |
|
| 952 | - */ |
|
| 953 | - do_action('geodir_settings_' . sanitize_title($value['id']));
|
|
| 954 | - break; |
|
| 955 | - |
|
| 956 | - case 'no_tabs': |
|
| 957 | - |
|
| 958 | - echo '<div class="inner_content_tab_main">'; |
|
| 959 | - echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >'; |
|
| 960 | - |
|
| 961 | - break; |
|
| 962 | - |
|
| 963 | - case 'sectionstart': |
|
| 964 | - if (isset($value['desc']) && $value['desc']) |
|
| 965 | - $desc = '<span style=" text-transform:none;"> - ' . $value['desc'] . '</span>'; |
|
| 966 | - if (isset($value['name']) && $value['name']) |
|
| 967 | - echo '<h3>' . $value['name'] . $desc . '</h3>'; |
|
| 968 | - /** |
|
| 969 | - * Called after a GeoDirectory settings sectionstart is output in the GD settings page. |
|
| 970 | - * |
|
| 971 | - * The action is called dynamically geodir_settings_$value['id']_start. |
|
| 972 | - * |
|
| 973 | - * @since 1.0.0 |
|
| 974 | - */ |
|
| 975 | - if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_start');
|
|
| 976 | - echo '<table class="form-table">' . "\n\n"; |
|
| 977 | - |
|
| 978 | - break; |
|
| 979 | - case 'sectionend': |
|
| 980 | - /** |
|
| 981 | - * Called before a GeoDirectory settings sectionend is output in the GD settings page. |
|
| 982 | - * |
|
| 983 | - * The action is called dynamically geodir_settings_$value['id']_end. |
|
| 984 | - * |
|
| 985 | - * @since 1.0.0 |
|
| 986 | - */ |
|
| 987 | - if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_end');
|
|
| 988 | - echo '</table>'; |
|
| 989 | - /** |
|
| 990 | - * Called after 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']) . '_after');
|
|
| 997 | - break; |
|
| 998 | - case 'text': |
|
| 999 | - ?> |
|
| 946 | + /** |
|
| 947 | + * Called after a GeoDirectory settings title is output in the GD settings page. |
|
| 948 | + * |
|
| 949 | + * The action is called dynamically geodir_settings_$value['id']. |
|
| 950 | + * |
|
| 951 | + * @since 1.0.0 |
|
| 952 | + */ |
|
| 953 | + do_action('geodir_settings_' . sanitize_title($value['id']));
|
|
| 954 | + break; |
|
| 955 | + |
|
| 956 | + case 'no_tabs': |
|
| 957 | + |
|
| 958 | + echo '<div class="inner_content_tab_main">'; |
|
| 959 | + echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >'; |
|
| 960 | + |
|
| 961 | + break; |
|
| 962 | + |
|
| 963 | + case 'sectionstart': |
|
| 964 | + if (isset($value['desc']) && $value['desc']) |
|
| 965 | + $desc = '<span style=" text-transform:none;"> - ' . $value['desc'] . '</span>'; |
|
| 966 | + if (isset($value['name']) && $value['name']) |
|
| 967 | + echo '<h3>' . $value['name'] . $desc . '</h3>'; |
|
| 968 | + /** |
|
| 969 | + * Called after a GeoDirectory settings sectionstart is output in the GD settings page. |
|
| 970 | + * |
|
| 971 | + * The action is called dynamically geodir_settings_$value['id']_start. |
|
| 972 | + * |
|
| 973 | + * @since 1.0.0 |
|
| 974 | + */ |
|
| 975 | + if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_start');
|
|
| 976 | + echo '<table class="form-table">' . "\n\n"; |
|
| 977 | + |
|
| 978 | + break; |
|
| 979 | + case 'sectionend': |
|
| 980 | + /** |
|
| 981 | + * Called before a GeoDirectory settings sectionend is output in the GD settings page. |
|
| 982 | + * |
|
| 983 | + * The action is called dynamically geodir_settings_$value['id']_end. |
|
| 984 | + * |
|
| 985 | + * @since 1.0.0 |
|
| 986 | + */ |
|
| 987 | + if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_end');
|
|
| 988 | + echo '</table>'; |
|
| 989 | + /** |
|
| 990 | + * Called after 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']) . '_after');
|
|
| 997 | + break; |
|
| 998 | + case 'text': |
|
| 999 | + ?> |
|
| 1000 | 1000 | <tr valign="top"> |
| 1001 | 1001 | <th scope="row" class="titledesc"><?php echo $value['name']; ?></th> |
| 1002 | 1002 | <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>" |
@@ -1005,15 +1005,15 @@ discard block |
||
| 1005 | 1005 | <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
|
| 1006 | 1006 | style=" <?php echo esc_attr($value['css']); ?>" |
| 1007 | 1007 | value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
|
| 1008 | - echo esc_attr(stripslashes(get_option($value['id']))); |
|
| 1009 | - } else {
|
|
| 1010 | - echo esc_attr($value['std']); |
|
| 1011 | - } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td> |
|
| 1008 | + echo esc_attr(stripslashes(get_option($value['id']))); |
|
| 1009 | + } else {
|
|
| 1010 | + echo esc_attr($value['std']); |
|
| 1011 | + } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td> |
|
| 1012 | 1012 | </tr><?php |
| 1013 | - break; |
|
| 1013 | + break; |
|
| 1014 | 1014 | |
| 1015 | - case 'password': |
|
| 1016 | - ?> |
|
| 1015 | + case 'password': |
|
| 1016 | + ?> |
|
| 1017 | 1017 | <tr valign="top"> |
| 1018 | 1018 | <th scope="row" class="titledesc"><?php echo $value['name']; ?></th> |
| 1019 | 1019 | <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>" |
@@ -1022,42 +1022,42 @@ discard block |
||
| 1022 | 1022 | <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
|
| 1023 | 1023 | style="<?php echo esc_attr($value['css']); ?>" |
| 1024 | 1024 | value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
|
| 1025 | - echo esc_attr(stripslashes(get_option($value['id']))); |
|
| 1026 | - } else {
|
|
| 1027 | - echo esc_attr($value['std']); |
|
| 1028 | - } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td> |
|
| 1025 | + echo esc_attr(stripslashes(get_option($value['id']))); |
|
| 1026 | + } else {
|
|
| 1027 | + echo esc_attr($value['std']); |
|
| 1028 | + } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td> |
|
| 1029 | 1029 | </tr><?php |
| 1030 | - break; |
|
| 1030 | + break; |
|
| 1031 | 1031 | |
| 1032 | - case 'html_content': |
|
| 1033 | - ?> |
|
| 1032 | + case 'html_content': |
|
| 1033 | + ?> |
|
| 1034 | 1034 | <tr valign="top"> |
| 1035 | 1035 | <th scope="row" class="titledesc"><?php echo $value['name']; ?></th> |
| 1036 | 1036 | <td class="forminp"><span class="description"><?php echo $value['desc']; ?></span></td> |
| 1037 | 1037 | </tr><?php |
| 1038 | - break; |
|
| 1038 | + break; |
|
| 1039 | 1039 | |
| 1040 | - case 'color' : |
|
| 1041 | - ?> |
|
| 1040 | + case 'color' : |
|
| 1041 | + ?> |
|
| 1042 | 1042 | <tr valign="top"> |
| 1043 | 1043 | <th scope="row" class="titledesc"><?php echo $value['name']; ?></th> |
| 1044 | 1044 | <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>" |
| 1045 | 1045 | id="<?php echo esc_attr($value['id']); ?>" type="text" |
| 1046 | 1046 | style="<?php echo esc_attr($value['css']); ?>" |
| 1047 | 1047 | value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
|
| 1048 | - echo esc_attr(stripslashes(get_option($value['id']))); |
|
| 1049 | - } else {
|
|
| 1050 | - echo esc_attr($value['std']); |
|
| 1051 | - } ?>" class="colorpick"/> <span |
|
| 1048 | + echo esc_attr(stripslashes(get_option($value['id']))); |
|
| 1049 | + } else {
|
|
| 1050 | + echo esc_attr($value['std']); |
|
| 1051 | + } ?>" class="colorpick"/> <span |
|
| 1052 | 1052 | class="description"><?php echo $value['desc']; ?></span> |
| 1053 | 1053 | |
| 1054 | 1054 | <div id="colorPickerDiv_<?php echo esc_attr($value['id']); ?>" class="colorpickdiv" |
| 1055 | 1055 | style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;display:none;"></div> |
| 1056 | 1056 | </td> |
| 1057 | 1057 | </tr><?php |
| 1058 | - break; |
|
| 1059 | - case 'image_width' : |
|
| 1060 | - ?> |
|
| 1058 | + break; |
|
| 1059 | + case 'image_width' : |
|
| 1060 | + ?> |
|
| 1061 | 1061 | <tr valign="top"> |
| 1062 | 1062 | <th scope="row" class="titledesc"><?php echo $value['name'] ?></th> |
| 1063 | 1063 | <td class="forminp"> |
@@ -1079,11 +1079,11 @@ discard block |
||
| 1079 | 1079 | |
| 1080 | 1080 | <span class="description"><?php echo $value['desc'] ?></span></td> |
| 1081 | 1081 | </tr><?php |
| 1082 | - break; |
|
| 1083 | - case 'select': |
|
| 1084 | - $option_value = get_option($value['id']); |
|
| 1085 | - $option_value = !empty($option_value) ? stripslashes_deep($option_value) : $option_value; |
|
| 1086 | - ?> |
|
| 1082 | + break; |
|
| 1083 | + case 'select': |
|
| 1084 | + $option_value = get_option($value['id']); |
|
| 1085 | + $option_value = !empty($option_value) ? stripslashes_deep($option_value) : $option_value; |
|
| 1086 | + ?> |
|
| 1087 | 1087 | <tr valign="top"> |
| 1088 | 1088 | <th scope="row" class="titledesc"><?php echo $value['name'] ?></th> |
| 1089 | 1089 | <td class="forminp"><select name="<?php echo esc_attr($value['id']); ?>" |
@@ -1092,33 +1092,33 @@ discard block |
||
| 1092 | 1092 | class="<?php if (isset($value['class'])) echo $value['class']; ?>" |
| 1093 | 1093 | option-ajaxchosen="false"> |
| 1094 | 1094 | <?php |
| 1095 | - foreach ($value['options'] as $key => $val) {
|
|
| 1096 | - $geodir_select_value = ''; |
|
| 1097 | - if ($option_value != '') {
|
|
| 1098 | - if ($option_value != '' && $option_value == $key) |
|
| 1099 | - $geodir_select_value = ' selected="selected" '; |
|
| 1100 | - } else {
|
|
| 1101 | - if ($value['std'] == $key) |
|
| 1102 | - $geodir_select_value = ' selected="selected" '; |
|
| 1103 | - } |
|
| 1104 | - ?> |
|
| 1095 | + foreach ($value['options'] as $key => $val) {
|
|
| 1096 | + $geodir_select_value = ''; |
|
| 1097 | + if ($option_value != '') {
|
|
| 1098 | + if ($option_value != '' && $option_value == $key) |
|
| 1099 | + $geodir_select_value = ' selected="selected" '; |
|
| 1100 | + } else {
|
|
| 1101 | + if ($value['std'] == $key) |
|
| 1102 | + $geodir_select_value = ' selected="selected" '; |
|
| 1103 | + } |
|
| 1104 | + ?> |
|
| 1105 | 1105 | <option |
| 1106 | 1106 | value="<?php echo esc_attr($key); ?>" <?php echo $geodir_select_value; ?> ><?php echo ucfirst($val) ?></option> |
| 1107 | 1107 | <?php |
| 1108 | - } |
|
| 1109 | - ?> |
|
| 1108 | + } |
|
| 1109 | + ?> |
|
| 1110 | 1110 | </select> <span class="description"><?php echo $value['desc'] ?></span> |
| 1111 | 1111 | </td> |
| 1112 | 1112 | </tr><?php |
| 1113 | - break; |
|
| 1113 | + break; |
|
| 1114 | 1114 | |
| 1115 | - case 'multiselect': |
|
| 1116 | - $option_values = get_option($value['id']); |
|
| 1117 | - if ($option_values === '' && !empty($value['std']) && is_array($value['std'])) {
|
|
| 1118 | - $option_values = $value['std']; |
|
| 1119 | - } |
|
| 1120 | - $option_values = !empty($option_values) ? stripslashes_deep($option_values) : $option_values; |
|
| 1121 | - ?> |
|
| 1115 | + case 'multiselect': |
|
| 1116 | + $option_values = get_option($value['id']); |
|
| 1117 | + if ($option_values === '' && !empty($value['std']) && is_array($value['std'])) {
|
|
| 1118 | + $option_values = $value['std']; |
|
| 1119 | + } |
|
| 1120 | + $option_values = !empty($option_values) ? stripslashes_deep($option_values) : $option_values; |
|
| 1121 | + ?> |
|
| 1122 | 1122 | <tr valign="top"> |
| 1123 | 1123 | <th scope="row" class="titledesc"><?php echo $value['name']; ?></th> |
| 1124 | 1124 | <td class="forminp"><select multiple="multiple" name="<?php echo esc_attr($value['id']); ?>[]" |
@@ -1128,25 +1128,25 @@ discard block |
||
| 1128 | 1128 | data-placeholder="<?php if (isset($value['placeholder_text'])) echo $value['placeholder_text'];?>" |
| 1129 | 1129 | option-ajaxchosen="false"> |
| 1130 | 1130 | <?php |
| 1131 | - foreach ($value['options'] as $key => $val) {
|
|
| 1132 | - if (strpos($key, 'optgroup_start-') === 0) {
|
|
| 1133 | - ?><optgroup label="<?php echo ucfirst($val); ?>"><?php |
|
| 1134 | - } else if (strpos($key, 'optgroup_end-') === 0) {
|
|
| 1135 | - ?></optgroup><?php |
|
| 1136 | - } else {
|
|
| 1137 | - ?> |
|
| 1131 | + foreach ($value['options'] as $key => $val) {
|
|
| 1132 | + if (strpos($key, 'optgroup_start-') === 0) {
|
|
| 1133 | + ?><optgroup label="<?php echo ucfirst($val); ?>"><?php |
|
| 1134 | + } else if (strpos($key, 'optgroup_end-') === 0) {
|
|
| 1135 | + ?></optgroup><?php |
|
| 1136 | + } else {
|
|
| 1137 | + ?> |
|
| 1138 | 1138 | <option |
| 1139 | 1139 | value="<?php echo esc_attr($key); ?>" <?php selected(true, (is_array($option_values) && in_array($key, $option_values)));?>><?php echo ucfirst($val) ?></option> |
| 1140 | 1140 | <?php |
| 1141 | - } |
|
| 1142 | - } |
|
| 1143 | - ?> |
|
| 1141 | + } |
|
| 1142 | + } |
|
| 1143 | + ?> |
|
| 1144 | 1144 | </select> <span class="description"><?php echo $value['desc'] ?></span> |
| 1145 | 1145 | </td> |
| 1146 | 1146 | </tr><?php |
| 1147 | - break; |
|
| 1148 | - case 'file': |
|
| 1149 | - ?> |
|
| 1147 | + break; |
|
| 1148 | + case 'file': |
|
| 1149 | + ?> |
|
| 1150 | 1150 | <tr valign="top"> |
| 1151 | 1151 | <th scope="row" class="titledesc"><?php echo $value['name']; ?></th> |
| 1152 | 1152 | <td class="forminp"> |
@@ -1166,87 +1166,87 @@ discard block |
||
| 1166 | 1166 | <?php } ?> |
| 1167 | 1167 | </td> |
| 1168 | 1168 | </tr><?php |
| 1169 | - break; |
|
| 1170 | - case 'map_default_settings' : |
|
| 1171 | - ?> |
|
| 1169 | + break; |
|
| 1170 | + case 'map_default_settings' : |
|
| 1171 | + ?> |
|
| 1172 | 1172 | |
| 1173 | 1173 | <tr valign="top"> |
| 1174 | 1174 | <th class="titledesc" width="40%"><?php _e('Default map language', 'geodirectory');?></th>
|
| 1175 | 1175 | <td width="60%"> |
| 1176 | 1176 | <select name="geodir_default_map_language" style="width:60%"> |
| 1177 | 1177 | <?php |
| 1178 | - $arr_map_langages = array( |
|
| 1179 | - 'ar' => __('ARABIC', 'geodirectory'),
|
|
| 1180 | - 'eu' => __('BASQUE', 'geodirectory'),
|
|
| 1181 | - 'bg' => __('BULGARIAN', 'geodirectory'),
|
|
| 1182 | - 'bn' => __('BENGALI', 'geodirectory'),
|
|
| 1183 | - 'ca' => __('CATALAN', 'geodirectory'),
|
|
| 1184 | - 'cs' => __('CZECH', 'geodirectory'),
|
|
| 1185 | - 'da' => __('DANISH', 'geodirectory'),
|
|
| 1186 | - 'de' => __('GERMAN', 'geodirectory'),
|
|
| 1187 | - 'el' => __('GREEK', 'geodirectory'),
|
|
| 1188 | - 'en' => __('ENGLISH', 'geodirectory'),
|
|
| 1189 | - 'en-AU' => __('ENGLISH (AUSTRALIAN)', 'geodirectory'),
|
|
| 1190 | - 'en-GB' => __('ENGLISH (GREAT BRITAIN)', 'geodirectory'),
|
|
| 1191 | - 'es' => __('SPANISH', 'geodirectory'),
|
|
| 1192 | - 'eu' => __('BASQUE', 'geodirectory'),
|
|
| 1193 | - 'fa' => __('FARSI', 'geodirectory'),
|
|
| 1194 | - 'fi' => __('FINNISH', 'geodirectory'),
|
|
| 1195 | - 'fil' => __('FILIPINO', 'geodirectory'),
|
|
| 1196 | - 'fr' => __('FRENCH', 'geodirectory'),
|
|
| 1197 | - 'gl' => __('GALICIAN', 'geodirectory'),
|
|
| 1198 | - 'gu' => __('GUJARATI', 'geodirectory'),
|
|
| 1199 | - 'hi' => __('HINDI', 'geodirectory'),
|
|
| 1200 | - 'hr' => __('CROATIAN', 'geodirectory'),
|
|
| 1201 | - 'hu' => __('HUNGARIAN', 'geodirectory'),
|
|
| 1202 | - 'id' => __('INDONESIAN', 'geodirectory'),
|
|
| 1203 | - 'it' => __('ITALIAN', 'geodirectory'),
|
|
| 1204 | - 'iw' => __('HEBREW', 'geodirectory'),
|
|
| 1205 | - 'ja' => __('JAPANESE', 'geodirectory'),
|
|
| 1206 | - 'kn' => __('KANNADA', 'geodirectory'),
|
|
| 1207 | - 'ko' => __('KOREAN', 'geodirectory'),
|
|
| 1208 | - 'lt' => __('LITHUANIAN', 'geodirectory'),
|
|
| 1209 | - 'lv' => __('LATVIAN', 'geodirectory'),
|
|
| 1210 | - 'ml' => __('MALAYALAM', 'geodirectory'),
|
|
| 1211 | - 'mr' => __('MARATHI', 'geodirectory'),
|
|
| 1212 | - 'nl' => __('DUTCH', 'geodirectory'),
|
|
| 1213 | - 'no' => __('NORWEGIAN', 'geodirectory'),
|
|
| 1214 | - 'pl' => __('POLISH', 'geodirectory'),
|
|
| 1215 | - 'pt' => __('PORTUGUESE', 'geodirectory'),
|
|
| 1216 | - 'pt-BR' => __('PORTUGUESE (BRAZIL)', 'geodirectory'),
|
|
| 1217 | - 'pt-PT' => __('PORTUGUESE (PORTUGAL)', 'geodirectory'),
|
|
| 1218 | - 'ro' => __('ROMANIAN', 'geodirectory'),
|
|
| 1219 | - 'ru' => __('RUSSIAN', 'geodirectory'),
|
|
| 1220 | - 'ru' => __('RUSSIAN', 'geodirectory'),
|
|
| 1221 | - 'sk' => __('SLOVAK', 'geodirectory'),
|
|
| 1222 | - 'sl' => __('SLOVENIAN', 'geodirectory'),
|
|
| 1223 | - 'sr' => __('SERBIAN', 'geodirectory'),
|
|
| 1224 | - 'sv' => __(' SWEDISH', 'geodirectory'),
|
|
| 1225 | - 'tl' => __('TAGALOG', 'geodirectory'),
|
|
| 1226 | - 'ta' => __('TAMIL', 'geodirectory'),
|
|
| 1227 | - 'te' => __('TELUGU', 'geodirectory'),
|
|
| 1228 | - 'th' => __('THAI', 'geodirectory'),
|
|
| 1229 | - 'tr' => __('TURKISH', 'geodirectory'),
|
|
| 1230 | - 'uk' => __('UKRAINIAN', 'geodirectory'),
|
|
| 1231 | - 'vi' => __('VIETNAMESE', 'geodirectory'),
|
|
| 1232 | - 'zh-CN' => __('CHINESE (SIMPLIFIED)', 'geodirectory'),
|
|
| 1233 | - 'zh-TW' => __('CHINESE (TRADITIONAL)', 'geodirectory'),
|
|
| 1234 | - ); |
|
| 1235 | - $geodir_default_map_language = get_option('geodir_default_map_language');
|
|
| 1236 | - if (empty($geodir_default_map_language)) |
|
| 1237 | - $geodir_default_map_language = 'en'; |
|
| 1238 | - foreach ($arr_map_langages as $language_key => $language_txt) {
|
|
| 1239 | - if (!empty($geodir_default_map_language) && $language_key == $geodir_default_map_language) |
|
| 1240 | - $geodir_default_language_selected = "selected='selected'"; |
|
| 1241 | - else |
|
| 1242 | - $geodir_default_language_selected = ''; |
|
| 1243 | - |
|
| 1244 | - ?> |
|
| 1178 | + $arr_map_langages = array( |
|
| 1179 | + 'ar' => __('ARABIC', 'geodirectory'),
|
|
| 1180 | + 'eu' => __('BASQUE', 'geodirectory'),
|
|
| 1181 | + 'bg' => __('BULGARIAN', 'geodirectory'),
|
|
| 1182 | + 'bn' => __('BENGALI', 'geodirectory'),
|
|
| 1183 | + 'ca' => __('CATALAN', 'geodirectory'),
|
|
| 1184 | + 'cs' => __('CZECH', 'geodirectory'),
|
|
| 1185 | + 'da' => __('DANISH', 'geodirectory'),
|
|
| 1186 | + 'de' => __('GERMAN', 'geodirectory'),
|
|
| 1187 | + 'el' => __('GREEK', 'geodirectory'),
|
|
| 1188 | + 'en' => __('ENGLISH', 'geodirectory'),
|
|
| 1189 | + 'en-AU' => __('ENGLISH (AUSTRALIAN)', 'geodirectory'),
|
|
| 1190 | + 'en-GB' => __('ENGLISH (GREAT BRITAIN)', 'geodirectory'),
|
|
| 1191 | + 'es' => __('SPANISH', 'geodirectory'),
|
|
| 1192 | + 'eu' => __('BASQUE', 'geodirectory'),
|
|
| 1193 | + 'fa' => __('FARSI', 'geodirectory'),
|
|
| 1194 | + 'fi' => __('FINNISH', 'geodirectory'),
|
|
| 1195 | + 'fil' => __('FILIPINO', 'geodirectory'),
|
|
| 1196 | + 'fr' => __('FRENCH', 'geodirectory'),
|
|
| 1197 | + 'gl' => __('GALICIAN', 'geodirectory'),
|
|
| 1198 | + 'gu' => __('GUJARATI', 'geodirectory'),
|
|
| 1199 | + 'hi' => __('HINDI', 'geodirectory'),
|
|
| 1200 | + 'hr' => __('CROATIAN', 'geodirectory'),
|
|
| 1201 | + 'hu' => __('HUNGARIAN', 'geodirectory'),
|
|
| 1202 | + 'id' => __('INDONESIAN', 'geodirectory'),
|
|
| 1203 | + 'it' => __('ITALIAN', 'geodirectory'),
|
|
| 1204 | + 'iw' => __('HEBREW', 'geodirectory'),
|
|
| 1205 | + 'ja' => __('JAPANESE', 'geodirectory'),
|
|
| 1206 | + 'kn' => __('KANNADA', 'geodirectory'),
|
|
| 1207 | + 'ko' => __('KOREAN', 'geodirectory'),
|
|
| 1208 | + 'lt' => __('LITHUANIAN', 'geodirectory'),
|
|
| 1209 | + 'lv' => __('LATVIAN', 'geodirectory'),
|
|
| 1210 | + 'ml' => __('MALAYALAM', 'geodirectory'),
|
|
| 1211 | + 'mr' => __('MARATHI', 'geodirectory'),
|
|
| 1212 | + 'nl' => __('DUTCH', 'geodirectory'),
|
|
| 1213 | + 'no' => __('NORWEGIAN', 'geodirectory'),
|
|
| 1214 | + 'pl' => __('POLISH', 'geodirectory'),
|
|
| 1215 | + 'pt' => __('PORTUGUESE', 'geodirectory'),
|
|
| 1216 | + 'pt-BR' => __('PORTUGUESE (BRAZIL)', 'geodirectory'),
|
|
| 1217 | + 'pt-PT' => __('PORTUGUESE (PORTUGAL)', 'geodirectory'),
|
|
| 1218 | + 'ro' => __('ROMANIAN', 'geodirectory'),
|
|
| 1219 | + 'ru' => __('RUSSIAN', 'geodirectory'),
|
|
| 1220 | + 'ru' => __('RUSSIAN', 'geodirectory'),
|
|
| 1221 | + 'sk' => __('SLOVAK', 'geodirectory'),
|
|
| 1222 | + 'sl' => __('SLOVENIAN', 'geodirectory'),
|
|
| 1223 | + 'sr' => __('SERBIAN', 'geodirectory'),
|
|
| 1224 | + 'sv' => __(' SWEDISH', 'geodirectory'),
|
|
| 1225 | + 'tl' => __('TAGALOG', 'geodirectory'),
|
|
| 1226 | + 'ta' => __('TAMIL', 'geodirectory'),
|
|
| 1227 | + 'te' => __('TELUGU', 'geodirectory'),
|
|
| 1228 | + 'th' => __('THAI', 'geodirectory'),
|
|
| 1229 | + 'tr' => __('TURKISH', 'geodirectory'),
|
|
| 1230 | + 'uk' => __('UKRAINIAN', 'geodirectory'),
|
|
| 1231 | + 'vi' => __('VIETNAMESE', 'geodirectory'),
|
|
| 1232 | + 'zh-CN' => __('CHINESE (SIMPLIFIED)', 'geodirectory'),
|
|
| 1233 | + 'zh-TW' => __('CHINESE (TRADITIONAL)', 'geodirectory'),
|
|
| 1234 | + ); |
|
| 1235 | + $geodir_default_map_language = get_option('geodir_default_map_language');
|
|
| 1236 | + if (empty($geodir_default_map_language)) |
|
| 1237 | + $geodir_default_map_language = 'en'; |
|
| 1238 | + foreach ($arr_map_langages as $language_key => $language_txt) {
|
|
| 1239 | + if (!empty($geodir_default_map_language) && $language_key == $geodir_default_map_language) |
|
| 1240 | + $geodir_default_language_selected = "selected='selected'"; |
|
| 1241 | + else |
|
| 1242 | + $geodir_default_language_selected = ''; |
|
| 1243 | + |
|
| 1244 | + ?> |
|
| 1245 | 1245 | <option |
| 1246 | 1246 | value="<?php echo $language_key?>" <?php echo $geodir_default_language_selected; ?>><?php echo $language_txt; ?></option> |
| 1247 | 1247 | |
| 1248 | 1248 | <?php } |
| 1249 | - ?> |
|
| 1249 | + ?> |
|
| 1250 | 1250 | </select> |
| 1251 | 1251 | </td> |
| 1252 | 1252 | </tr> |
@@ -1257,46 +1257,46 @@ discard block |
||
| 1257 | 1257 | <td width="60%"> |
| 1258 | 1258 | <select name="geodir_default_map_search_pt" style="width:60%"> |
| 1259 | 1259 | <?php |
| 1260 | - $post_types = geodir_get_posttypes('array');
|
|
| 1261 | - $geodir_default_map_search_pt = get_option('geodir_default_map_search_pt');
|
|
| 1262 | - if (empty($geodir_default_map_search_pt)) |
|
| 1263 | - $geodir_default_map_search_pt = 'gd_place'; |
|
| 1264 | - if (is_array($post_types)) {
|
|
| 1265 | - foreach ($post_types as $key => $post_types_obj) {
|
|
| 1266 | - if (!empty($geodir_default_map_search_pt) && $key == $geodir_default_map_search_pt) |
|
| 1267 | - $geodir_search_pt_selected = "selected='selected'"; |
|
| 1268 | - else |
|
| 1269 | - $geodir_search_pt_selected = ''; |
|
| 1270 | - |
|
| 1271 | - ?> |
|
| 1260 | + $post_types = geodir_get_posttypes('array');
|
|
| 1261 | + $geodir_default_map_search_pt = get_option('geodir_default_map_search_pt');
|
|
| 1262 | + if (empty($geodir_default_map_search_pt)) |
|
| 1263 | + $geodir_default_map_search_pt = 'gd_place'; |
|
| 1264 | + if (is_array($post_types)) {
|
|
| 1265 | + foreach ($post_types as $key => $post_types_obj) {
|
|
| 1266 | + if (!empty($geodir_default_map_search_pt) && $key == $geodir_default_map_search_pt) |
|
| 1267 | + $geodir_search_pt_selected = "selected='selected'"; |
|
| 1268 | + else |
|
| 1269 | + $geodir_search_pt_selected = ''; |
|
| 1270 | + |
|
| 1271 | + ?> |
|
| 1272 | 1272 | <option |
| 1273 | 1273 | value="<?php echo $key?>" <?php echo $geodir_search_pt_selected; ?>><?php echo $post_types_obj['labels']['singular_name']; ?></option> |
| 1274 | 1274 | |
| 1275 | 1275 | <?php } |
| 1276 | 1276 | |
| 1277 | - } |
|
| 1277 | + } |
|
| 1278 | 1278 | |
| 1279 | - ?> |
|
| 1279 | + ?> |
|
| 1280 | 1280 | </select> |
| 1281 | 1281 | </td> |
| 1282 | 1282 | </tr> |
| 1283 | 1283 | |
| 1284 | 1284 | <?php |
| 1285 | - break; |
|
| 1285 | + break; |
|
| 1286 | 1286 | |
| 1287 | - case 'map': |
|
| 1288 | - ?> |
|
| 1287 | + case 'map': |
|
| 1288 | + ?> |
|
| 1289 | 1289 | <tr valign="top"> |
| 1290 | 1290 | <td class="forminp"> |
| 1291 | 1291 | <?php |
| 1292 | - global $post_cat, $cat_display; |
|
| 1293 | - $post_types = geodir_get_posttypes('object');
|
|
| 1294 | - $cat_display = 'checkbox'; |
|
| 1295 | - $gd_post_types = get_option('geodir_exclude_post_type_on_map');
|
|
| 1296 | - $gd_cats = get_option('geodir_exclude_cat_on_map');
|
|
| 1297 | - $gd_cats_upgrade = (int)get_option('geodir_exclude_cat_on_map_upgrade');
|
|
| 1298 | - $count = 1; |
|
| 1299 | - ?> |
|
| 1292 | + global $post_cat, $cat_display; |
|
| 1293 | + $post_types = geodir_get_posttypes('object');
|
|
| 1294 | + $cat_display = 'checkbox'; |
|
| 1295 | + $gd_post_types = get_option('geodir_exclude_post_type_on_map');
|
|
| 1296 | + $gd_cats = get_option('geodir_exclude_cat_on_map');
|
|
| 1297 | + $gd_cats_upgrade = (int)get_option('geodir_exclude_cat_on_map_upgrade');
|
|
| 1298 | + $count = 1; |
|
| 1299 | + ?> |
|
| 1300 | 1300 | <table width="70%" class="widefat"> |
| 1301 | 1301 | <thead> |
| 1302 | 1302 | <tr> |
@@ -1305,18 +1305,18 @@ discard block |
||
| 1305 | 1305 | <th><b><?php echo DESIGN_POST_TYPE_CAT; ?></b></th> |
| 1306 | 1306 | </tr> |
| 1307 | 1307 | <?php |
| 1308 | - $gd_categs = $gd_cats; |
|
| 1309 | - foreach ($post_types as $key => $post_types_obj) : |
|
| 1310 | - $checked = is_array($gd_post_types) && in_array($key, $gd_post_types) ? 'checked="checked"' : ''; |
|
| 1311 | - $gd_taxonomy = geodir_get_taxonomies($key); |
|
| 1312 | - if ($gd_cats_upgrade) {
|
|
| 1313 | - $gd_cat_taxonomy = isset($gd_taxonomy[0]) ? $gd_taxonomy[0] : ''; |
|
| 1314 | - $gd_cats = isset($gd_categs[$gd_cat_taxonomy]) ? $gd_categs[$gd_cat_taxonomy] : array(); |
|
| 1315 | - $gd_cats = !empty($gd_cats) && is_array($gd_cats) ? array_unique($gd_cats) : array(); |
|
| 1316 | - } |
|
| 1317 | - $post_cat = implode(',', $gd_cats);
|
|
| 1318 | - $gd_taxonomy_list = geodir_custom_taxonomy_walker($gd_taxonomy); |
|
| 1319 | - ?> |
|
| 1308 | + $gd_categs = $gd_cats; |
|
| 1309 | + foreach ($post_types as $key => $post_types_obj) : |
|
| 1310 | + $checked = is_array($gd_post_types) && in_array($key, $gd_post_types) ? 'checked="checked"' : ''; |
|
| 1311 | + $gd_taxonomy = geodir_get_taxonomies($key); |
|
| 1312 | + if ($gd_cats_upgrade) {
|
|
| 1313 | + $gd_cat_taxonomy = isset($gd_taxonomy[0]) ? $gd_taxonomy[0] : ''; |
|
| 1314 | + $gd_cats = isset($gd_categs[$gd_cat_taxonomy]) ? $gd_categs[$gd_cat_taxonomy] : array(); |
|
| 1315 | + $gd_cats = !empty($gd_cats) && is_array($gd_cats) ? array_unique($gd_cats) : array(); |
|
| 1316 | + } |
|
| 1317 | + $post_cat = implode(',', $gd_cats);
|
|
| 1318 | + $gd_taxonomy_list = geodir_custom_taxonomy_walker($gd_taxonomy); |
|
| 1319 | + ?> |
|
| 1320 | 1320 | <tr> |
| 1321 | 1321 | <td valign="top" width="5%"><?php echo $count; ?></td> |
| 1322 | 1322 | <td valign="top" width="25%" id="td_post_types"><input type="checkbox" |
@@ -1337,19 +1337,19 @@ discard block |
||
| 1337 | 1337 | </td> |
| 1338 | 1338 | </tr> |
| 1339 | 1339 | <?php |
| 1340 | - break; |
|
| 1340 | + break; |
|
| 1341 | 1341 | |
| 1342 | - case 'checkbox' : |
|
| 1342 | + case 'checkbox' : |
|
| 1343 | 1343 | |
| 1344 | - if (!isset($value['checkboxgroup']) || (isset($value['checkboxgroup']) && $value['checkboxgroup'] == 'start')) : |
|
| 1345 | - ?> |
|
| 1344 | + if (!isset($value['checkboxgroup']) || (isset($value['checkboxgroup']) && $value['checkboxgroup'] == 'start')) : |
|
| 1345 | + ?> |
|
| 1346 | 1346 | <tr valign="top"> |
| 1347 | 1347 | <th scope="row" class="titledesc"><?php echo $value['name'] ?></th> |
| 1348 | 1348 | <td class="forminp"> |
| 1349 | 1349 | <?php |
| 1350 | - endif; |
|
| 1350 | + endif; |
|
| 1351 | 1351 | |
| 1352 | - ?> |
|
| 1352 | + ?> |
|
| 1353 | 1353 | <fieldset> |
| 1354 | 1354 | <legend class="screen-reader-text"><span><?php echo $value['name'] ?></span></legend> |
| 1355 | 1355 | <label for="<?php echo $value['id'] ?>"> |
@@ -1359,49 +1359,49 @@ discard block |
||
| 1359 | 1359 | </fieldset> |
| 1360 | 1360 | <?php |
| 1361 | 1361 | |
| 1362 | - if (!isset($value['checkboxgroup']) || (isset($value['checkboxgroup']) && $value['checkboxgroup'] == 'end')) : |
|
| 1363 | - ?> |
|
| 1362 | + if (!isset($value['checkboxgroup']) || (isset($value['checkboxgroup']) && $value['checkboxgroup'] == 'end')) : |
|
| 1363 | + ?> |
|
| 1364 | 1364 | </td> |
| 1365 | 1365 | </tr> |
| 1366 | 1366 | <?php |
| 1367 | - endif; |
|
| 1367 | + endif; |
|
| 1368 | 1368 | |
| 1369 | - break; |
|
| 1369 | + break; |
|
| 1370 | 1370 | |
| 1371 | - case 'radio' : |
|
| 1371 | + case 'radio' : |
|
| 1372 | 1372 | |
| 1373 | - if (!isset($value['radiogroup']) || (isset($value['radiogroup']) && $value['radiogroup'] == 'start')) : |
|
| 1374 | - ?> |
|
| 1373 | + if (!isset($value['radiogroup']) || (isset($value['radiogroup']) && $value['radiogroup'] == 'start')) : |
|
| 1374 | + ?> |
|
| 1375 | 1375 | <tr valign="top"> |
| 1376 | 1376 | <th scope="row" class="titledesc"><?php echo $value['name'] ?></th> |
| 1377 | 1377 | <td class="forminp"> |
| 1378 | 1378 | <?php |
| 1379 | - endif; |
|
| 1379 | + endif; |
|
| 1380 | 1380 | |
| 1381 | - ?> |
|
| 1381 | + ?> |
|
| 1382 | 1382 | <fieldset> |
| 1383 | 1383 | <legend class="screen-reader-text"><span><?php echo $value['name'] ?></span></legend> |
| 1384 | 1384 | <label for="<?php echo $value['id'];?>"> |
| 1385 | 1385 | <input name="<?php echo esc_attr($value['id']); ?>" |
| 1386 | 1386 | id="<?php echo esc_attr($value['id'] . $value['value']); ?>" type="radio" |
| 1387 | 1387 | value="<?php echo $value['value'] ?>" <?php if (get_option($value['id']) == $value['value']) {
|
| 1388 | - echo 'checked="checked"'; |
|
| 1389 | - }elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
|
|
| 1388 | + echo 'checked="checked"'; |
|
| 1389 | + }elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
|
|
| 1390 | 1390 | <?php echo $value['desc']; ?></label><br> |
| 1391 | 1391 | </fieldset> |
| 1392 | 1392 | <?php |
| 1393 | 1393 | |
| 1394 | - if (!isset($value['radiogroup']) || (isset($value['radiogroup']) && $value['radiogroup'] == 'end')) : |
|
| 1395 | - ?> |
|
| 1394 | + if (!isset($value['radiogroup']) || (isset($value['radiogroup']) && $value['radiogroup'] == 'end')) : |
|
| 1395 | + ?> |
|
| 1396 | 1396 | </td> |
| 1397 | 1397 | </tr> |
| 1398 | 1398 | <?php |
| 1399 | - endif; |
|
| 1399 | + endif; |
|
| 1400 | 1400 | |
| 1401 | - break; |
|
| 1401 | + break; |
|
| 1402 | 1402 | |
| 1403 | - case 'textarea': |
|
| 1404 | - ?> |
|
| 1403 | + case 'textarea': |
|
| 1404 | + ?> |
|
| 1405 | 1405 | <tr valign="top"> |
| 1406 | 1406 | <th scope="row" class="titledesc"><?php echo $value['name'] ?></th> |
| 1407 | 1407 | <td class="forminp"> |
@@ -1414,30 +1414,30 @@ discard block |
||
| 1414 | 1414 | |
| 1415 | 1415 | </td> |
| 1416 | 1416 | </tr><?php |
| 1417 | - break; |
|
| 1417 | + break; |
|
| 1418 | 1418 | |
| 1419 | - case 'editor': |
|
| 1420 | - ?> |
|
| 1419 | + case 'editor': |
|
| 1420 | + ?> |
|
| 1421 | 1421 | <tr valign="top"> |
| 1422 | 1422 | <th scope="row" class="titledesc"><?php echo $value['name'] ?></th> |
| 1423 | 1423 | <td class="forminp"><?php |
| 1424 | - if (get_option($value['id'])) |
|
| 1425 | - $content = stripslashes(get_option($value['id'])); |
|
| 1426 | - else |
|
| 1427 | - $content = $value['std']; |
|
| 1424 | + if (get_option($value['id'])) |
|
| 1425 | + $content = stripslashes(get_option($value['id'])); |
|
| 1426 | + else |
|
| 1427 | + $content = $value['std']; |
|
| 1428 | 1428 | |
| 1429 | - $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
|
|
| 1429 | + $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
|
|
| 1430 | 1430 | |
| 1431 | - wp_editor($content, esc_attr($value['id']), $editor_settings); |
|
| 1431 | + wp_editor($content, esc_attr($value['id']), $editor_settings); |
|
| 1432 | 1432 | |
| 1433 | - ?> <span class="description"><?php echo $value['desc'] ?></span> |
|
| 1433 | + ?> <span class="description"><?php echo $value['desc'] ?></span> |
|
| 1434 | 1434 | |
| 1435 | 1435 | </td> |
| 1436 | 1436 | </tr><?php |
| 1437 | - break; |
|
| 1437 | + break; |
|
| 1438 | 1438 | |
| 1439 | - case 'single_select_page' : |
|
| 1440 | - // WPML |
|
| 1439 | + case 'single_select_page' : |
|
| 1440 | + // WPML |
|
| 1441 | 1441 | $switch_lang = false; |
| 1442 | 1442 | $disabled = ''; |
| 1443 | 1443 | if (geodir_is_wpml() && isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'permalink_settings') {
|
@@ -1455,18 +1455,18 @@ discard block |
||
| 1455 | 1455 | // |
| 1456 | 1456 | $page_setting = (int)get_option($value['id']); |
| 1457 | 1457 | |
| 1458 | - $args = array('name' => $value['id'],
|
|
| 1459 | - 'id' => $value['id'], |
|
| 1460 | - 'sort_column' => 'menu_order', |
|
| 1461 | - 'sort_order' => 'ASC', |
|
| 1462 | - 'show_option_none' => ' ', |
|
| 1463 | - 'class' => $value['class'], |
|
| 1464 | - 'echo' => false, |
|
| 1465 | - 'selected' => $page_setting); |
|
| 1458 | + $args = array('name' => $value['id'],
|
|
| 1459 | + 'id' => $value['id'], |
|
| 1460 | + 'sort_column' => 'menu_order', |
|
| 1461 | + 'sort_order' => 'ASC', |
|
| 1462 | + 'show_option_none' => ' ', |
|
| 1463 | + 'class' => $value['class'], |
|
| 1464 | + 'echo' => false, |
|
| 1465 | + 'selected' => $page_setting); |
|
| 1466 | 1466 | |
| 1467 | - if (isset($value['args'])) $args = wp_parse_args($value['args'], $args); |
|
| 1467 | + if (isset($value['args'])) $args = wp_parse_args($value['args'], $args); |
|
| 1468 | 1468 | |
| 1469 | - ?> |
|
| 1469 | + ?> |
|
| 1470 | 1470 | <tr valign="top" class="single_select_page"> |
| 1471 | 1471 | <th scope="row" class="titledesc"><?php echo $value['name'] ?></th> |
| 1472 | 1472 | <td class="forminp"> |
@@ -1477,17 +1477,17 @@ discard block |
||
| 1477 | 1477 | if ($switch_lang) {
|
| 1478 | 1478 | $sitepress->switch_lang($switch_lang, true); |
| 1479 | 1479 | } |
| 1480 | - break; |
|
| 1481 | - case 'single_select_country' : |
|
| 1482 | - $country_setting = (string)get_option($value['id']); |
|
| 1483 | - if (strstr($country_setting, ':')) : |
|
| 1484 | - $country = current(explode(':', $country_setting));
|
|
| 1485 | - $state = end(explode(':', $country_setting));
|
|
| 1486 | - else : |
|
| 1487 | - $country = $country_setting; |
|
| 1488 | - $state = '*'; |
|
| 1489 | - endif; |
|
| 1490 | - ?> |
|
| 1480 | + break; |
|
| 1481 | + case 'single_select_country' : |
|
| 1482 | + $country_setting = (string)get_option($value['id']); |
|
| 1483 | + if (strstr($country_setting, ':')) : |
|
| 1484 | + $country = current(explode(':', $country_setting));
|
|
| 1485 | + $state = end(explode(':', $country_setting));
|
|
| 1486 | + else : |
|
| 1487 | + $country = $country_setting; |
|
| 1488 | + $state = '*'; |
|
| 1489 | + endif; |
|
| 1490 | + ?> |
|
| 1491 | 1491 | <tr valign="top"> |
| 1492 | 1492 | <th scope="rpw" class="titledesc"><?php echo $value['name'] ?></th> |
| 1493 | 1493 | <td class="forminp"><select name="<?php echo esc_attr($value['id']); ?>" |
@@ -1498,12 +1498,12 @@ discard block |
||
| 1498 | 1498 | </select> <span class="description"><?php echo $value['desc'] ?></span> |
| 1499 | 1499 | </td> |
| 1500 | 1500 | </tr><?php |
| 1501 | - break; |
|
| 1502 | - case 'multi_select_countries' : |
|
| 1503 | - $countries = $geodirectory->countries->countries; |
|
| 1504 | - asort($countries); |
|
| 1505 | - $selections = (array)get_option($value['id']); |
|
| 1506 | - ?> |
|
| 1501 | + break; |
|
| 1502 | + case 'multi_select_countries' : |
|
| 1503 | + $countries = $geodirectory->countries->countries; |
|
| 1504 | + asort($countries); |
|
| 1505 | + $selections = (array)get_option($value['id']); |
|
| 1506 | + ?> |
|
| 1507 | 1507 | <tr valign="top"> |
| 1508 | 1508 | <th scope="row" class="titledesc"><?php echo $value['name'] ?></th> |
| 1509 | 1509 | <td class="forminp"> |
@@ -1511,22 +1511,22 @@ discard block |
||
| 1511 | 1511 | data-placeholder="<?php _e('Choose countries…', 'geodirectory'); ?>"
|
| 1512 | 1512 | title="Country" class="chosen_select"> |
| 1513 | 1513 | <?php |
| 1514 | - if ($countries) foreach ($countries as $key => $val) : |
|
| 1515 | - echo '<option value="' . $key . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>'; |
|
| 1516 | - endforeach; |
|
| 1517 | - ?> |
|
| 1514 | + if ($countries) foreach ($countries as $key => $val) : |
|
| 1515 | + echo '<option value="' . $key . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>'; |
|
| 1516 | + endforeach; |
|
| 1517 | + ?> |
|
| 1518 | 1518 | </select> |
| 1519 | 1519 | </td> |
| 1520 | 1520 | </tr> |
| 1521 | 1521 | |
| 1522 | 1522 | <?php |
| 1523 | 1523 | |
| 1524 | - break; |
|
| 1524 | + break; |
|
| 1525 | 1525 | |
| 1526 | - case 'google_analytics' : |
|
| 1527 | - $selections = (array)get_option($value['id']); |
|
| 1528 | - if(get_option('geodir_ga_client_id') && get_option('geodir_ga_client_secret') ) {
|
|
| 1529 | - ?> |
|
| 1526 | + case 'google_analytics' : |
|
| 1527 | + $selections = (array)get_option($value['id']); |
|
| 1528 | + if(get_option('geodir_ga_client_id') && get_option('geodir_ga_client_secret') ) {
|
|
| 1529 | + ?> |
|
| 1530 | 1530 | <tr valign="top"> |
| 1531 | 1531 | <th scope="row" class="titledesc"><?php echo $value['name'] ?></th> |
| 1532 | 1532 | <td class="forminp"> |
@@ -1534,19 +1534,19 @@ discard block |
||
| 1534 | 1534 | |
| 1535 | 1535 | <?php |
| 1536 | 1536 | |
| 1537 | - $oAuthURL = "https://accounts.google.com/o/oauth2/auth?"; |
|
| 1538 | - $scope = "scope=https://www.googleapis.com/auth/analytics.readonly"; |
|
| 1539 | - $state = "&state=123";//any string |
|
| 1540 | - $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
|
|
| 1541 | - $response_type = "&response_type=code"; |
|
| 1542 | - $client_id = "&client_id=".get_option('geodir_ga_client_id');
|
|
| 1543 | - $access_type = "&access_type=offline"; |
|
| 1544 | - $approval_prompt = "&approval_prompt=force"; |
|
| 1537 | + $oAuthURL = "https://accounts.google.com/o/oauth2/auth?"; |
|
| 1538 | + $scope = "scope=https://www.googleapis.com/auth/analytics.readonly"; |
|
| 1539 | + $state = "&state=123";//any string |
|
| 1540 | + $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
|
|
| 1541 | + $response_type = "&response_type=code"; |
|
| 1542 | + $client_id = "&client_id=".get_option('geodir_ga_client_id');
|
|
| 1543 | + $access_type = "&access_type=offline"; |
|
| 1544 | + $approval_prompt = "&approval_prompt=force"; |
|
| 1545 | 1545 | |
| 1546 | - $auth_url = $oAuthURL . $scope . $state . $redirect_uri . $response_type . $client_id . $access_type . $approval_prompt; |
|
| 1546 | + $auth_url = $oAuthURL . $scope . $state . $redirect_uri . $response_type . $client_id . $access_type . $approval_prompt; |
|
| 1547 | 1547 | |
| 1548 | 1548 | |
| 1549 | - ?> |
|
| 1549 | + ?> |
|
| 1550 | 1550 | <script> |
| 1551 | 1551 | function gd_ga_popup() {
|
| 1552 | 1552 | var win = window.open("<?php echo $auth_url;?>", "Google Analytics", "");
|
@@ -1561,47 +1561,47 @@ discard block |
||
| 1561 | 1561 | </script> |
| 1562 | 1562 | |
| 1563 | 1563 | <?php |
| 1564 | - if (get_option('gd_ga_refresh_token')) {
|
|
| 1565 | - ?> |
|
| 1564 | + if (get_option('gd_ga_refresh_token')) {
|
|
| 1565 | + ?> |
|
| 1566 | 1566 | <span class="button-primary" |
| 1567 | 1567 | onclick="gd_ga_popup();"><?php _e('Re-authorize', 'geodirectory'); ?></span>
|
| 1568 | 1568 | <span |
| 1569 | 1569 | style="color: green; font-weight: bold;"><?php _e('Authorized', 'geodirectory'); ?></span>
|
| 1570 | 1570 | <?php |
| 1571 | - } else {
|
|
| 1572 | - ?> |
|
| 1571 | + } else {
|
|
| 1572 | + ?> |
|
| 1573 | 1573 | <span class="button-primary" |
| 1574 | 1574 | onclick="gd_ga_popup();"><?php _e('Authorize', 'geodirectory');?></span>
|
| 1575 | 1575 | <?php |
| 1576 | - } |
|
| 1577 | - ?> |
|
| 1576 | + } |
|
| 1577 | + ?> |
|
| 1578 | 1578 | </td> |
| 1579 | 1579 | </tr> |
| 1580 | 1580 | |
| 1581 | 1581 | <?php |
| 1582 | - } |
|
| 1582 | + } |
|
| 1583 | 1583 | |
| 1584 | - break; |
|
| 1584 | + break; |
|
| 1585 | 1585 | |
| 1586 | - case 'field_seperator' : |
|
| 1586 | + case 'field_seperator' : |
|
| 1587 | 1587 | |
| 1588 | - ?> |
|
| 1588 | + ?> |
|
| 1589 | 1589 | <tr valign="top"> |
| 1590 | 1590 | <td colspan="2" class="forminp geodir_line_seperator"></td> |
| 1591 | 1591 | </tr> |
| 1592 | 1592 | <?php |
| 1593 | 1593 | |
| 1594 | - break; |
|
| 1594 | + break; |
|
| 1595 | 1595 | |
| 1596 | - endswitch; |
|
| 1596 | + endswitch; |
|
| 1597 | 1597 | |
| 1598 | - endforeach; |
|
| 1598 | + endforeach; |
|
| 1599 | 1599 | |
| 1600 | - if ($first_title === false) {
|
|
| 1601 | - echo "</div>"; |
|
| 1602 | - } |
|
| 1600 | + if ($first_title === false) {
|
|
| 1601 | + echo "</div>"; |
|
| 1602 | + } |
|
| 1603 | 1603 | |
| 1604 | - ?> |
|
| 1604 | + ?> |
|
| 1605 | 1605 | |
| 1606 | 1606 | <script type="text/javascript"> |
| 1607 | 1607 | |
@@ -1661,33 +1661,33 @@ discard block |
||
| 1661 | 1661 | */ |
| 1662 | 1662 | function geodir_post_info_setting() |
| 1663 | 1663 | {
|
| 1664 | - global $post, $post_id; |
|
| 1665 | - |
|
| 1666 | - $post_type = get_post_type(); |
|
| 1667 | - |
|
| 1668 | - $package_info = array(); |
|
| 1669 | - |
|
| 1670 | - $package_info = geodir_post_package_info($package_info, $post, $post_type); |
|
| 1671 | - wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_info_noncename'); |
|
| 1672 | - echo '<div id="geodir_wrapper">'; |
|
| 1673 | - /** |
|
| 1674 | - * Called before the GD custom fields are output in the wp-admin area. |
|
| 1675 | - * |
|
| 1676 | - * @since 1.0.0 |
|
| 1677 | - * @see 'geodir_after_default_field_in_meta_box' |
|
| 1678 | - */ |
|
| 1679 | - do_action('geodir_before_default_field_in_meta_box');
|
|
| 1680 | - //geodir_get_custom_fields_html($package_info->pid,'default',$post_type); |
|
| 1681 | - // to display all fields in one information box |
|
| 1682 | - geodir_get_custom_fields_html($package_info->pid, 'all', $post_type); |
|
| 1683 | - /** |
|
| 1684 | - * Called after the GD custom fields are output in the wp-admin area. |
|
| 1685 | - * |
|
| 1686 | - * @since 1.0.0 |
|
| 1687 | - * @see 'geodir_before_default_field_in_meta_box' |
|
| 1688 | - */ |
|
| 1689 | - do_action('geodir_after_default_field_in_meta_box');
|
|
| 1690 | - echo '</div>'; |
|
| 1664 | + global $post, $post_id; |
|
| 1665 | + |
|
| 1666 | + $post_type = get_post_type(); |
|
| 1667 | + |
|
| 1668 | + $package_info = array(); |
|
| 1669 | + |
|
| 1670 | + $package_info = geodir_post_package_info($package_info, $post, $post_type); |
|
| 1671 | + wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_info_noncename'); |
|
| 1672 | + echo '<div id="geodir_wrapper">'; |
|
| 1673 | + /** |
|
| 1674 | + * Called before the GD custom fields are output in the wp-admin area. |
|
| 1675 | + * |
|
| 1676 | + * @since 1.0.0 |
|
| 1677 | + * @see 'geodir_after_default_field_in_meta_box' |
|
| 1678 | + */ |
|
| 1679 | + do_action('geodir_before_default_field_in_meta_box');
|
|
| 1680 | + //geodir_get_custom_fields_html($package_info->pid,'default',$post_type); |
|
| 1681 | + // to display all fields in one information box |
|
| 1682 | + geodir_get_custom_fields_html($package_info->pid, 'all', $post_type); |
|
| 1683 | + /** |
|
| 1684 | + * Called after the GD custom fields are output in the wp-admin area. |
|
| 1685 | + * |
|
| 1686 | + * @since 1.0.0 |
|
| 1687 | + * @see 'geodir_before_default_field_in_meta_box' |
|
| 1688 | + */ |
|
| 1689 | + do_action('geodir_after_default_field_in_meta_box');
|
|
| 1690 | + echo '</div>'; |
|
| 1691 | 1691 | } |
| 1692 | 1692 | |
| 1693 | 1693 | /** |
@@ -1700,18 +1700,18 @@ discard block |
||
| 1700 | 1700 | */ |
| 1701 | 1701 | function geodir_post_addinfo_setting() |
| 1702 | 1702 | {
|
| 1703 | - global $post, $post_id; |
|
| 1703 | + global $post, $post_id; |
|
| 1704 | 1704 | |
| 1705 | - $post_type = get_post_type(); |
|
| 1705 | + $post_type = get_post_type(); |
|
| 1706 | 1706 | |
| 1707 | - $package_info = array(); |
|
| 1707 | + $package_info = array(); |
|
| 1708 | 1708 | |
| 1709 | - $package_info = geodir_post_package_info($package_info, $post, $post_type); |
|
| 1709 | + $package_info = geodir_post_package_info($package_info, $post, $post_type); |
|
| 1710 | 1710 | |
| 1711 | - wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_addinfo_noncename'); |
|
| 1712 | - echo '<div id="geodir_wrapper">'; |
|
| 1713 | - geodir_get_custom_fields_html($package_info->pid, 'custom', $post_type); |
|
| 1714 | - echo '</div>'; |
|
| 1711 | + wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_addinfo_noncename'); |
|
| 1712 | + echo '<div id="geodir_wrapper">'; |
|
| 1713 | + geodir_get_custom_fields_html($package_info->pid, 'custom', $post_type); |
|
| 1714 | + echo '</div>'; |
|
| 1715 | 1715 | |
| 1716 | 1716 | } |
| 1717 | 1717 | |
@@ -1725,60 +1725,60 @@ discard block |
||
| 1725 | 1725 | */ |
| 1726 | 1726 | function geodir_post_attachments() |
| 1727 | 1727 | {
|
| 1728 | - global $post, $post_id; |
|
| 1728 | + global $post, $post_id; |
|
| 1729 | 1729 | |
| 1730 | - wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_attachments_noncename'); |
|
| 1730 | + wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_attachments_noncename'); |
|
| 1731 | 1731 | |
| 1732 | - if (geodir_get_featured_image($post_id, 'thumbnail')) {
|
|
| 1733 | - echo '<h4>' . __('Featured Image', 'geodirectory') . '</h4>';
|
|
| 1734 | - geodir_show_featured_image($post_id, 'thumbnail'); |
|
| 1735 | - } |
|
| 1732 | + if (geodir_get_featured_image($post_id, 'thumbnail')) {
|
|
| 1733 | + echo '<h4>' . __('Featured Image', 'geodirectory') . '</h4>';
|
|
| 1734 | + geodir_show_featured_image($post_id, 'thumbnail'); |
|
| 1735 | + } |
|
| 1736 | 1736 | |
| 1737 | - $image_limit = 0; |
|
| 1737 | + $image_limit = 0; |
|
| 1738 | 1738 | |
| 1739 | - ?> |
|
| 1739 | + ?> |
|
| 1740 | 1740 | |
| 1741 | 1741 | |
| 1742 | 1742 | <h5 class="form_title"> |
| 1743 | 1743 | <?php if ($image_limit != 0 && $image_limit == 1) {
|
| 1744 | - echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
|
|
| 1745 | - } ?> |
|
| 1744 | + echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
|
|
| 1745 | + } ?> |
|
| 1746 | 1746 | <?php if ($image_limit != 0 && $image_limit > 1) {
|
| 1747 | - echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
|
|
| 1748 | - } ?> |
|
| 1747 | + echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
|
|
| 1748 | + } ?> |
|
| 1749 | 1749 | <?php if ($image_limit == 0) {
|
| 1750 | - echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
|
|
| 1751 | - } ?> |
|
| 1750 | + echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
|
|
| 1751 | + } ?> |
|
| 1752 | 1752 | </h5> |
| 1753 | 1753 | |
| 1754 | 1754 | |
| 1755 | 1755 | <?php |
| 1756 | 1756 | |
| 1757 | - $curImages = geodir_get_images($post_id); |
|
| 1758 | - $place_img_array = array(); |
|
| 1757 | + $curImages = geodir_get_images($post_id); |
|
| 1758 | + $place_img_array = array(); |
|
| 1759 | 1759 | |
| 1760 | - if (!empty($curImages)): |
|
| 1761 | - foreach ($curImages as $p_img): |
|
| 1762 | - $place_img_array[] = $p_img->src; |
|
| 1763 | - endforeach; |
|
| 1764 | - endif; |
|
| 1760 | + if (!empty($curImages)): |
|
| 1761 | + foreach ($curImages as $p_img): |
|
| 1762 | + $place_img_array[] = $p_img->src; |
|
| 1763 | + endforeach; |
|
| 1764 | + endif; |
|
| 1765 | 1765 | |
| 1766 | - if (!empty($place_img_array)) |
|
| 1767 | - $curImages = implode(',', $place_img_array);
|
|
| 1766 | + if (!empty($place_img_array)) |
|
| 1767 | + $curImages = implode(',', $place_img_array);
|
|
| 1768 | 1768 | |
| 1769 | 1769 | |
| 1770 | - // adjust values here |
|
| 1771 | - $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 |
|
| 1770 | + // adjust values here |
|
| 1771 | + $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 |
|
| 1772 | 1772 | |
| 1773 | - $svalue = $curImages; // this will be initial value of the above form field. Image urls. |
|
| 1773 | + $svalue = $curImages; // this will be initial value of the above form field. Image urls. |
|
| 1774 | 1774 | |
| 1775 | - $multiple = true; // allow multiple files upload |
|
| 1775 | + $multiple = true; // allow multiple files upload |
|
| 1776 | 1776 | |
| 1777 | - $width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels) |
|
| 1777 | + $width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels) |
|
| 1778 | 1778 | |
| 1779 | - $height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels) |
|
| 1779 | + $height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels) |
|
| 1780 | 1780 | |
| 1781 | - ?> |
|
| 1781 | + ?> |
|
| 1782 | 1782 | |
| 1783 | 1783 | <div class="gtd-form_row clearfix" id="<?php echo $id; ?>dropbox" style="border:1px solid #999999;padding:5px;text-align:center;"> |
| 1784 | 1784 | <input type="hidden" name="<?php echo $id; ?>" id="<?php echo $id; ?>" value="<?php echo $svalue; ?>"/> |
@@ -1820,13 +1820,13 @@ discard block |
||
| 1820 | 1820 | */ |
| 1821 | 1821 | function geodir_action_post_updated($post_ID, $post_after, $post_before) |
| 1822 | 1822 | {
|
| 1823 | - $post_type = get_post_type($post_ID); |
|
| 1823 | + $post_type = get_post_type($post_ID); |
|
| 1824 | 1824 | |
| 1825 | - if (isset($_POST['action']) && $_POST['action'] == 'inline-save') {
|
|
| 1826 | - 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) {
|
|
| 1827 | - geodir_save_post_meta($post_ID, 'post_title', $post_after->post_title); |
|
| 1828 | - } |
|
| 1829 | - } |
|
| 1825 | + if (isset($_POST['action']) && $_POST['action'] == 'inline-save') {
|
|
| 1826 | + 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) {
|
|
| 1827 | + geodir_save_post_meta($post_ID, 'post_title', $post_after->post_title); |
|
| 1828 | + } |
|
| 1829 | + } |
|
| 1830 | 1830 | } |
| 1831 | 1831 | |
| 1832 | 1832 | /** |
@@ -1841,39 +1841,39 @@ discard block |
||
| 1841 | 1841 | */ |
| 1842 | 1842 | function geodir_notification_add_bcc_option($settings) |
| 1843 | 1843 | {
|
| 1844 | - if (!empty($settings)) {
|
|
| 1845 | - $new_settings = array(); |
|
| 1846 | - foreach ($settings as $setting) {
|
|
| 1847 | - if (isset($setting['id']) && $setting['id'] == 'site_bcc_options' && isset($setting['type']) && $setting['type'] == 'sectionend') {
|
|
| 1848 | - $geodir_bcc_listing_published_yes = array( |
|
| 1849 | - 'name' => __('Listing published', 'geodirectory'),
|
|
| 1850 | - 'desc' => __('Yes', 'geodirectory'),
|
|
| 1851 | - 'id' => 'geodir_bcc_listing_published', |
|
| 1852 | - 'std' => 'yes', |
|
| 1853 | - 'type' => 'radio', |
|
| 1854 | - 'value' => '1', |
|
| 1855 | - 'radiogroup' => 'start' |
|
| 1856 | - ); |
|
| 1857 | - |
|
| 1858 | - $geodir_bcc_listing_published_no = array( |
|
| 1859 | - 'name' => __('Listing published', 'geodirectory'),
|
|
| 1860 | - 'desc' => __('No', 'geodirectory'),
|
|
| 1861 | - 'id' => 'geodir_bcc_listing_published', |
|
| 1862 | - 'std' => 'yes', |
|
| 1863 | - 'type' => 'radio', |
|
| 1864 | - 'value' => '0', |
|
| 1865 | - 'radiogroup' => 'end' |
|
| 1866 | - ); |
|
| 1867 | - |
|
| 1868 | - $new_settings[] = $geodir_bcc_listing_published_yes; |
|
| 1869 | - $new_settings[] = $geodir_bcc_listing_published_no; |
|
| 1870 | - } |
|
| 1871 | - $new_settings[] = $setting; |
|
| 1872 | - } |
|
| 1873 | - $settings = $new_settings; |
|
| 1874 | - } |
|
| 1844 | + if (!empty($settings)) {
|
|
| 1845 | + $new_settings = array(); |
|
| 1846 | + foreach ($settings as $setting) {
|
|
| 1847 | + if (isset($setting['id']) && $setting['id'] == 'site_bcc_options' && isset($setting['type']) && $setting['type'] == 'sectionend') {
|
|
| 1848 | + $geodir_bcc_listing_published_yes = array( |
|
| 1849 | + 'name' => __('Listing published', 'geodirectory'),
|
|
| 1850 | + 'desc' => __('Yes', 'geodirectory'),
|
|
| 1851 | + 'id' => 'geodir_bcc_listing_published', |
|
| 1852 | + 'std' => 'yes', |
|
| 1853 | + 'type' => 'radio', |
|
| 1854 | + 'value' => '1', |
|
| 1855 | + 'radiogroup' => 'start' |
|
| 1856 | + ); |
|
| 1857 | + |
|
| 1858 | + $geodir_bcc_listing_published_no = array( |
|
| 1859 | + 'name' => __('Listing published', 'geodirectory'),
|
|
| 1860 | + 'desc' => __('No', 'geodirectory'),
|
|
| 1861 | + 'id' => 'geodir_bcc_listing_published', |
|
| 1862 | + 'std' => 'yes', |
|
| 1863 | + 'type' => 'radio', |
|
| 1864 | + 'value' => '0', |
|
| 1865 | + 'radiogroup' => 'end' |
|
| 1866 | + ); |
|
| 1867 | + |
|
| 1868 | + $new_settings[] = $geodir_bcc_listing_published_yes; |
|
| 1869 | + $new_settings[] = $geodir_bcc_listing_published_no; |
|
| 1870 | + } |
|
| 1871 | + $new_settings[] = $setting; |
|
| 1872 | + } |
|
| 1873 | + $settings = $new_settings; |
|
| 1874 | + } |
|
| 1875 | 1875 | |
| 1876 | - return $settings; |
|
| 1876 | + return $settings; |
|
| 1877 | 1877 | } |
| 1878 | 1878 | |
| 1879 | 1879 | |
@@ -1888,19 +1888,19 @@ discard block |
||
| 1888 | 1888 | */ |
| 1889 | 1889 | function get_gd_theme_compat_callback() |
| 1890 | 1890 | {
|
| 1891 | - global $wpdb; |
|
| 1892 | - $themes = get_option('gd_theme_compats');
|
|
| 1893 | - |
|
| 1894 | - if (isset($_POST['theme']) && isset($themes[$_POST['theme']]) && !empty($themes[$_POST['theme']])) {
|
|
| 1895 | - if (isset($_POST['export'])) {
|
|
| 1896 | - echo json_encode(array($_POST['theme'] => $themes[$_POST['theme']])); |
|
| 1897 | - } else {
|
|
| 1898 | - echo json_encode($themes[$_POST['theme']]); |
|
| 1899 | - } |
|
| 1891 | + global $wpdb; |
|
| 1892 | + $themes = get_option('gd_theme_compats');
|
|
| 1900 | 1893 | |
| 1901 | - } |
|
| 1894 | + if (isset($_POST['theme']) && isset($themes[$_POST['theme']]) && !empty($themes[$_POST['theme']])) {
|
|
| 1895 | + if (isset($_POST['export'])) {
|
|
| 1896 | + echo json_encode(array($_POST['theme'] => $themes[$_POST['theme']])); |
|
| 1897 | + } else {
|
|
| 1898 | + echo json_encode($themes[$_POST['theme']]); |
|
| 1899 | + } |
|
| 1902 | 1900 | |
| 1903 | - die(); |
|
| 1901 | + } |
|
| 1902 | + |
|
| 1903 | + die(); |
|
| 1904 | 1904 | } |
| 1905 | 1905 | |
| 1906 | 1906 | add_action('wp_ajax_get_gd_theme_compat_import_callback', 'get_gd_theme_compat_import_callback');
|
@@ -1914,20 +1914,20 @@ discard block |
||
| 1914 | 1914 | */ |
| 1915 | 1915 | function get_gd_theme_compat_import_callback() |
| 1916 | 1916 | {
|
| 1917 | - global $wpdb; |
|
| 1918 | - $themes = get_option('gd_theme_compats');
|
|
| 1919 | - if (isset($_POST['theme']) && !empty($_POST['theme'])) {
|
|
| 1920 | - $json = json_decode(stripslashes($_POST['theme']), true); |
|
| 1921 | - if (!empty($json) && is_array($json)) {
|
|
| 1922 | - $key = sanitize_text_field(key($json)); |
|
| 1923 | - $themes[$key] = $json[$key]; |
|
| 1924 | - update_option('gd_theme_compats', $themes);
|
|
| 1925 | - echo $key; |
|
| 1926 | - die(); |
|
| 1927 | - } |
|
| 1928 | - } |
|
| 1929 | - echo '0'; |
|
| 1930 | - die(); |
|
| 1917 | + global $wpdb; |
|
| 1918 | + $themes = get_option('gd_theme_compats');
|
|
| 1919 | + if (isset($_POST['theme']) && !empty($_POST['theme'])) {
|
|
| 1920 | + $json = json_decode(stripslashes($_POST['theme']), true); |
|
| 1921 | + if (!empty($json) && is_array($json)) {
|
|
| 1922 | + $key = sanitize_text_field(key($json)); |
|
| 1923 | + $themes[$key] = $json[$key]; |
|
| 1924 | + update_option('gd_theme_compats', $themes);
|
|
| 1925 | + echo $key; |
|
| 1926 | + die(); |
|
| 1927 | + } |
|
| 1928 | + } |
|
| 1929 | + echo '0'; |
|
| 1930 | + die(); |
|
| 1931 | 1931 | } |
| 1932 | 1932 | |
| 1933 | 1933 | |
@@ -1940,39 +1940,39 @@ discard block |
||
| 1940 | 1940 | */ |
| 1941 | 1941 | function gd_set_theme_compat() |
| 1942 | 1942 | {
|
| 1943 | - global $wpdb; |
|
| 1944 | - $theme = wp_get_theme(); |
|
| 1943 | + global $wpdb; |
|
| 1944 | + $theme = wp_get_theme(); |
|
| 1945 | 1945 | |
| 1946 | - if ($theme->parent()) {
|
|
| 1947 | - $theme_name = str_replace(" ", "_", $theme->parent()->get('Name'));
|
|
| 1948 | - } else {
|
|
| 1949 | - $theme_name = str_replace(" ", "_", $theme->get('Name'));
|
|
| 1950 | - } |
|
| 1946 | + if ($theme->parent()) {
|
|
| 1947 | + $theme_name = str_replace(" ", "_", $theme->parent()->get('Name'));
|
|
| 1948 | + } else {
|
|
| 1949 | + $theme_name = str_replace(" ", "_", $theme->get('Name'));
|
|
| 1950 | + } |
|
| 1951 | 1951 | |
| 1952 | - $theme_compats = get_option('gd_theme_compats');
|
|
| 1953 | - $current_compat = get_option('gd_theme_compat');
|
|
| 1954 | - $current_compat = str_replace("_custom", "", $current_compat);
|
|
| 1952 | + $theme_compats = get_option('gd_theme_compats');
|
|
| 1953 | + $current_compat = get_option('gd_theme_compat');
|
|
| 1954 | + $current_compat = str_replace("_custom", "", $current_compat);
|
|
| 1955 | 1955 | |
| 1956 | - if ($current_compat == $theme_name && strpos("_custom", get_option('gd_theme_compat')) !== false) {
|
|
| 1957 | - return; |
|
| 1958 | - }// if already running correct compat then bail |
|
| 1956 | + if ($current_compat == $theme_name && strpos("_custom", get_option('gd_theme_compat')) !== false) {
|
|
| 1957 | + return; |
|
| 1958 | + }// if already running correct compat then bail |
|
| 1959 | 1959 | |
| 1960 | - if (isset($theme_compats[$theme_name])) {// if there is a compat avail then set it
|
|
| 1961 | - update_option('gd_theme_compat', $theme_name);
|
|
| 1962 | - update_option('theme_compatibility_setting', $theme_compats[$theme_name]);
|
|
| 1960 | + if (isset($theme_compats[$theme_name])) {// if there is a compat avail then set it
|
|
| 1961 | + update_option('gd_theme_compat', $theme_name);
|
|
| 1962 | + update_option('theme_compatibility_setting', $theme_compats[$theme_name]);
|
|
| 1963 | 1963 | |
| 1964 | - // if there are default options to set then set them |
|
| 1965 | - if (isset($theme_compats[$theme_name]['geodir_theme_compat_default_options']) && !empty($theme_compats[$theme_name]['geodir_theme_compat_default_options'])) {
|
|
| 1964 | + // if there are default options to set then set them |
|
| 1965 | + if (isset($theme_compats[$theme_name]['geodir_theme_compat_default_options']) && !empty($theme_compats[$theme_name]['geodir_theme_compat_default_options'])) {
|
|
| 1966 | 1966 | |
| 1967 | - foreach ($theme_compats[$theme_name]['geodir_theme_compat_default_options'] as $key => $val) {
|
|
| 1968 | - update_option($key, $val); |
|
| 1969 | - } |
|
| 1970 | - } |
|
| 1967 | + foreach ($theme_compats[$theme_name]['geodir_theme_compat_default_options'] as $key => $val) {
|
|
| 1968 | + update_option($key, $val); |
|
| 1969 | + } |
|
| 1970 | + } |
|
| 1971 | 1971 | |
| 1972 | - } else {
|
|
| 1973 | - update_option('gd_theme_compat', '');
|
|
| 1974 | - update_option('theme_compatibility_setting', '');
|
|
| 1975 | - } |
|
| 1972 | + } else {
|
|
| 1973 | + update_option('gd_theme_compat', '');
|
|
| 1974 | + update_option('theme_compatibility_setting', '');
|
|
| 1975 | + } |
|
| 1976 | 1976 | |
| 1977 | 1977 | |
| 1978 | 1978 | } |
@@ -1987,9 +1987,9 @@ discard block |
||
| 1987 | 1987 | */ |
| 1988 | 1988 | function gd_check_avada_compat() |
| 1989 | 1989 | {
|
| 1990 | - if (function_exists('avada_load_textdomain') && !get_option('avada_nag')) {
|
|
| 1991 | - add_action('admin_notices', 'gd_avada_compat_warning');
|
|
| 1992 | - } |
|
| 1990 | + if (function_exists('avada_load_textdomain') && !get_option('avada_nag')) {
|
|
| 1991 | + add_action('admin_notices', 'gd_avada_compat_warning');
|
|
| 1992 | + } |
|
| 1993 | 1993 | } |
| 1994 | 1994 | |
| 1995 | 1995 | |
@@ -2002,22 +2002,22 @@ discard block |
||
| 2002 | 2002 | function gd_avada_compat_warning() |
| 2003 | 2003 | {
|
| 2004 | 2004 | |
| 2005 | - /* |
|
| 2005 | + /* |
|
| 2006 | 2006 | $msg_type = error |
| 2007 | 2007 | $msg_type = updated fade |
| 2008 | 2008 | $msg_type = update-nag |
| 2009 | 2009 | */ |
| 2010 | 2010 | |
| 2011 | - $plugin = 'avada-nag'; |
|
| 2012 | - $timestamp = 'avada-nag1234'; |
|
| 2013 | - $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');
|
|
| 2014 | - echo '<div id="' . $timestamp . '" class="error">'; |
|
| 2015 | - echo '<span class="gd-remove-noti" onclick="gdRemoveANotification(\'' . $plugin . '\',\'' . $timestamp . '\');" ><i class="fa fa-times"></i></span>'; |
|
| 2016 | - echo "<img class='gd-icon-noti' src='" . plugin_dir_url('') . "geodirectory/geodirectory-assets/images/favicon.ico' > ";
|
|
| 2017 | - echo "<p>$message</p>"; |
|
| 2018 | - echo "</div>"; |
|
| 2011 | + $plugin = 'avada-nag'; |
|
| 2012 | + $timestamp = 'avada-nag1234'; |
|
| 2013 | + $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');
|
|
| 2014 | + echo '<div id="' . $timestamp . '" class="error">'; |
|
| 2015 | + echo '<span class="gd-remove-noti" onclick="gdRemoveANotification(\'' . $plugin . '\',\'' . $timestamp . '\');" ><i class="fa fa-times"></i></span>'; |
|
| 2016 | + echo "<img class='gd-icon-noti' src='" . plugin_dir_url('') . "geodirectory/geodirectory-assets/images/favicon.ico' > ";
|
|
| 2017 | + echo "<p>$message</p>"; |
|
| 2018 | + echo "</div>"; |
|
| 2019 | 2019 | |
| 2020 | - ?> |
|
| 2020 | + ?> |
|
| 2021 | 2021 | <script> |
| 2022 | 2022 | function gdRemoveANotification($plugin, $timestamp) {
|
| 2023 | 2023 | |
@@ -2085,10 +2085,10 @@ discard block |
||
| 2085 | 2085 | */ |
| 2086 | 2086 | function geodir_avada_remove_notification() |
| 2087 | 2087 | {
|
| 2088 | - update_option('avada_nag', TRUE);
|
|
| 2088 | + update_option('avada_nag', TRUE);
|
|
| 2089 | 2089 | |
| 2090 | - // Always die in functions echoing ajax content |
|
| 2091 | - die(); |
|
| 2090 | + // Always die in functions echoing ajax content |
|
| 2091 | + die(); |
|
| 2092 | 2092 | } |
| 2093 | 2093 | |
| 2094 | 2094 | |
@@ -2110,9 +2110,9 @@ discard block |
||
| 2110 | 2110 | global $post, $typenow, $current_screen; |
| 2111 | 2111 | |
| 2112 | 2112 | $post_type = NULL; |
| 2113 | - if (isset($_REQUEST['post']) && get_post_type($_REQUEST['post'])) |
|
| 2113 | + if (isset($_REQUEST['post']) && get_post_type($_REQUEST['post'])) |
|
| 2114 | 2114 | $post_type = get_post_type($_REQUEST['post']); |
| 2115 | - elseif ($post && isset($post->post_type)) |
|
| 2115 | + elseif ($post && isset($post->post_type)) |
|
| 2116 | 2116 | $post_type = $post->post_type; |
| 2117 | 2117 | elseif ($typenow) |
| 2118 | 2118 | $post_type = $typenow; |
@@ -2147,7 +2147,7 @@ discard block |
||
| 2147 | 2147 | // Don't allow same slug url for listing and location |
| 2148 | 2148 | if (geodir_strtolower($listing_prefix) == geodir_strtolower($location_prefix)) {
|
| 2149 | 2149 | $redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $active_tab . '&msg=fail&gderr=21');
|
| 2150 | - wp_redirect($redirect_url); |
|
| 2150 | + wp_redirect($redirect_url); |
|
| 2151 | 2151 | exit; |
| 2152 | 2152 | } |
| 2153 | 2153 | |
@@ -2177,10 +2177,10 @@ discard block |
||
| 2177 | 2177 | * @package GeoDirectory |
| 2178 | 2178 | */ |
| 2179 | 2179 | function geodir_hide_admin_preview_button() {
|
| 2180 | - global $post_type; |
|
| 2181 | - $post_types = geodir_get_posttypes(); |
|
| 2182 | - if(in_array($post_type, $post_types)) |
|
| 2183 | - echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
|
|
| 2180 | + global $post_type; |
|
| 2181 | + $post_types = geodir_get_posttypes(); |
|
| 2182 | + if(in_array($post_type, $post_types)) |
|
| 2183 | + echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
|
|
| 2184 | 2184 | } |
| 2185 | 2185 | add_action( 'admin_head-post-new.php', 'geodir_hide_admin_preview_button' ); |
| 2186 | 2186 | add_action( 'admin_head-post.php', 'geodir_hide_admin_preview_button' ); |
@@ -2195,7 +2195,7 @@ discard block |
||
| 2195 | 2195 | */ |
| 2196 | 2196 | function geodir_import_export_tab( $tabs ) {
|
| 2197 | 2197 | $tabs['import_export'] = array( 'label' => __( 'Import & Export', 'geodirectory' ) ); |
| 2198 | - return $tabs; |
|
| 2198 | + return $tabs; |
|
| 2199 | 2199 | } |
| 2200 | 2200 | |
| 2201 | 2201 | /** |
@@ -2210,26 +2210,26 @@ discard block |
||
| 2210 | 2210 | function geodir_import_export_page() {
|
| 2211 | 2211 | $nonce = wp_create_nonce( 'geodir_import_export_nonce' ); |
| 2212 | 2212 | $gd_cats_sample_csv = geodir_plugin_url() . '/geodirectory-assets/gd_sample_categories.csv'; |
| 2213 | - /** |
|
| 2214 | - * Filter sample category data csv file url. |
|
| 2215 | - * |
|
| 2216 | - * @since 1.0.0 |
|
| 2217 | - * @package GeoDirectory |
|
| 2218 | - * |
|
| 2219 | - * @param string $gd_cats_sample_csv Sample category data csv file url. |
|
| 2220 | - */ |
|
| 2213 | + /** |
|
| 2214 | + * Filter sample category data csv file url. |
|
| 2215 | + * |
|
| 2216 | + * @since 1.0.0 |
|
| 2217 | + * @package GeoDirectory |
|
| 2218 | + * |
|
| 2219 | + * @param string $gd_cats_sample_csv Sample category data csv file url. |
|
| 2220 | + */ |
|
| 2221 | 2221 | $gd_cats_sample_csv = apply_filters( 'geodir_export_cats_sample_csv', $gd_cats_sample_csv ); |
| 2222 | 2222 | |
| 2223 | 2223 | $gd_posts_sample_csv = geodir_plugin_url() . '/geodirectory-assets/place_listing.csv'; |
| 2224 | - /** |
|
| 2225 | - * Filter sample post data csv file url. |
|
| 2226 | - * |
|
| 2227 | - * @since 1.0.0 |
|
| 2228 | - * @package GeoDirectory |
|
| 2229 | - * |
|
| 2230 | - * @param string $gd_posts_sample_csv Sample post data csv file url. |
|
| 2231 | - */ |
|
| 2232 | - $gd_posts_sample_csv = apply_filters( 'geodir_export_posts_sample_csv', $gd_posts_sample_csv ); |
|
| 2224 | + /** |
|
| 2225 | + * Filter sample post data csv file url. |
|
| 2226 | + * |
|
| 2227 | + * @since 1.0.0 |
|
| 2228 | + * @package GeoDirectory |
|
| 2229 | + * |
|
| 2230 | + * @param string $gd_posts_sample_csv Sample post data csv file url. |
|
| 2231 | + */ |
|
| 2232 | + $gd_posts_sample_csv = apply_filters( 'geodir_export_posts_sample_csv', $gd_posts_sample_csv ); |
|
| 2233 | 2233 | |
| 2234 | 2234 | $gd_posttypes = geodir_get_posttypes( 'array' ); |
| 2235 | 2235 | |
@@ -2252,14 +2252,14 @@ discard block |
||
| 2252 | 2252 | $gd_chunksize_options[100000] = 100000; |
| 2253 | 2253 | |
| 2254 | 2254 | /** |
| 2255 | - * Filter max entries per export csv file. |
|
| 2256 | - * |
|
| 2257 | - * @since 1.5.6 |
|
| 2258 | - * @package GeoDirectory |
|
| 2259 | - * |
|
| 2260 | - * @param string $gd_chunksize_options Entries options. |
|
| 2261 | - */ |
|
| 2262 | - $gd_chunksize_options = apply_filters( 'geodir_export_csv_chunksize_options', $gd_chunksize_options ); |
|
| 2255 | + * Filter max entries per export csv file. |
|
| 2256 | + * |
|
| 2257 | + * @since 1.5.6 |
|
| 2258 | + * @package GeoDirectory |
|
| 2259 | + * |
|
| 2260 | + * @param string $gd_chunksize_options Entries options. |
|
| 2261 | + */ |
|
| 2262 | + $gd_chunksize_options = apply_filters( 'geodir_export_csv_chunksize_options', $gd_chunksize_options ); |
|
| 2263 | 2263 | |
| 2264 | 2264 | $gd_chunksize_option = ''; |
| 2265 | 2265 | foreach ($gd_chunksize_options as $value => $title) {
|
@@ -2275,12 +2275,12 @@ discard block |
||
| 2275 | 2275 | <div class="gd-content-heading"> |
| 2276 | 2276 | |
| 2277 | 2277 | <?php |
| 2278 | - ini_set('max_execution_time', 999999);
|
|
| 2279 | - $ini_max_execution_time_check = @ini_get( 'max_execution_time' ); |
|
| 2280 | - ini_restore('max_execution_time');
|
|
| 2278 | + ini_set('max_execution_time', 999999);
|
|
| 2279 | + $ini_max_execution_time_check = @ini_get( 'max_execution_time' ); |
|
| 2280 | + ini_restore('max_execution_time');
|
|
| 2281 | 2281 | |
| 2282 | - if($ini_max_execution_time_check != 999999){ // only show these setting to the user if we can't change the ini setting
|
|
| 2283 | - ?> |
|
| 2282 | + if($ini_max_execution_time_check != 999999){ // only show these setting to the user if we can't change the ini setting
|
|
| 2283 | + ?> |
|
| 2284 | 2284 | <div id="gd_ie_reqs" class="metabox-holder"> |
| 2285 | 2285 | <div class="meta-box-sortables ui-sortable"> |
| 2286 | 2286 | <div class="postbox"> |
@@ -2453,7 +2453,7 @@ discard block |
||
| 2453 | 2453 | * Called just after the sample CSV download link. |
| 2454 | 2454 | * |
| 2455 | 2455 | * @since 1.0.0 |
| 2456 | - * @package GeoDirectory |
|
| 2456 | + * @package GeoDirectory |
|
| 2457 | 2457 | */ |
| 2458 | 2458 | do_action('geodir_sample_cats_csv_download_link');
|
| 2459 | 2459 | ?> |
@@ -2538,11 +2538,11 @@ discard block |
||
| 2538 | 2538 | * |
| 2539 | 2539 | * Called after the last setting on the GD > Import & Export page. |
| 2540 | 2540 | * @since 1.4.6 |
| 2541 | - * @package GeoDirectory |
|
| 2541 | + * @package GeoDirectory |
|
| 2542 | 2542 | * |
| 2543 | 2543 | * @param array $gd_posttypes GD post types. |
| 2544 | - * @param array $gd_chunksize_options File chunk size options. |
|
| 2545 | - * @param string $nonce Wordpress security token for GD import & export. |
|
| 2544 | + * @param array $gd_chunksize_options File chunk size options. |
|
| 2545 | + * @param string $nonce Wordpress security token for GD import & export. |
|
| 2546 | 2546 | */ |
| 2547 | 2547 | do_action( 'geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce ); |
| 2548 | 2548 | ?> |
@@ -3229,44 +3229,44 @@ discard block |
||
| 3229 | 3229 | function geodir_init_filesystem() |
| 3230 | 3230 | {
|
| 3231 | 3231 | |
| 3232 | - if(!function_exists('get_filesystem_method')){
|
|
| 3233 | - require_once(ABSPATH."/wp-admin/includes/file.php"); |
|
| 3234 | - } |
|
| 3235 | - $access_type = get_filesystem_method(); |
|
| 3236 | - if ($access_type === 'direct') {
|
|
| 3237 | - /* you can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */ |
|
| 3238 | - $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array()); |
|
| 3239 | - |
|
| 3240 | - /* initialize the API */ |
|
| 3241 | - if (!WP_Filesystem($creds)) {
|
|
| 3242 | - /* any problems and we exit */ |
|
| 3243 | - //return '@@@3'; |
|
| 3244 | - return false; |
|
| 3245 | - } |
|
| 3246 | - |
|
| 3247 | - global $wp_filesystem; |
|
| 3248 | - return $wp_filesystem; |
|
| 3249 | - /* do our file manipulations below */ |
|
| 3250 | - } elseif (defined('FTP_USER')) {
|
|
| 3251 | - $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array()); |
|
| 3232 | + if(!function_exists('get_filesystem_method')){
|
|
| 3233 | + require_once(ABSPATH."/wp-admin/includes/file.php"); |
|
| 3234 | + } |
|
| 3235 | + $access_type = get_filesystem_method(); |
|
| 3236 | + if ($access_type === 'direct') {
|
|
| 3237 | + /* you can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */ |
|
| 3238 | + $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array()); |
|
| 3239 | + |
|
| 3240 | + /* initialize the API */ |
|
| 3241 | + if (!WP_Filesystem($creds)) {
|
|
| 3242 | + /* any problems and we exit */ |
|
| 3243 | + //return '@@@3'; |
|
| 3244 | + return false; |
|
| 3245 | + } |
|
| 3252 | 3246 | |
| 3253 | - /* initialize the API */ |
|
| 3254 | - if (!WP_Filesystem($creds)) {
|
|
| 3255 | - /* any problems and we exit */ |
|
| 3256 | - //return '@@@33'; |
|
| 3257 | - return false; |
|
| 3258 | - } |
|
| 3247 | + global $wp_filesystem; |
|
| 3248 | + return $wp_filesystem; |
|
| 3249 | + /* do our file manipulations below */ |
|
| 3250 | + } elseif (defined('FTP_USER')) {
|
|
| 3251 | + $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array()); |
|
| 3252 | + |
|
| 3253 | + /* initialize the API */ |
|
| 3254 | + if (!WP_Filesystem($creds)) {
|
|
| 3255 | + /* any problems and we exit */ |
|
| 3256 | + //return '@@@33'; |
|
| 3257 | + return false; |
|
| 3258 | + } |
|
| 3259 | 3259 | |
| 3260 | - global $wp_filesystem; |
|
| 3261 | - //return '@@@1'; |
|
| 3262 | - return $wp_filesystem; |
|
| 3260 | + global $wp_filesystem; |
|
| 3261 | + //return '@@@1'; |
|
| 3262 | + return $wp_filesystem; |
|
| 3263 | 3263 | |
| 3264 | - } else {
|
|
| 3265 | - //return '@@@2'; |
|
| 3266 | - /* don't have direct write access. Prompt user with our notice */ |
|
| 3267 | - add_action('admin_notice', 'geodir_filesystem_notice');
|
|
| 3268 | - return false; |
|
| 3269 | - } |
|
| 3264 | + } else {
|
|
| 3265 | + //return '@@@2'; |
|
| 3266 | + /* don't have direct write access. Prompt user with our notice */ |
|
| 3267 | + add_action('admin_notice', 'geodir_filesystem_notice');
|
|
| 3268 | + return false; |
|
| 3269 | + } |
|
| 3270 | 3270 | |
| 3271 | 3271 | } |
| 3272 | 3272 | |
@@ -3284,10 +3284,10 @@ discard block |
||
| 3284 | 3284 | */ |
| 3285 | 3285 | function geodir_filesystem_notice() |
| 3286 | 3286 | { if ( defined( 'DOING_AJAX' ) ){return;}
|
| 3287 | - $access_type = get_filesystem_method(); |
|
| 3288 | - if ($access_type === 'direct') {
|
|
| 3289 | - } elseif (!defined('FTP_USER')) {
|
|
| 3290 | - ?> |
|
| 3287 | + $access_type = get_filesystem_method(); |
|
| 3288 | + if ($access_type === 'direct') {
|
|
| 3289 | + } elseif (!defined('FTP_USER')) {
|
|
| 3290 | + ?> |
|
| 3291 | 3291 | <div class="error"> |
| 3292 | 3292 | <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'); ?>
|
| 3293 | 3293 | <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> |
@@ -3313,1251 +3313,1251 @@ discard block |
||
| 3313 | 3313 | * @return string Json data. |
| 3314 | 3314 | */ |
| 3315 | 3315 | function geodir_ajax_import_export() {
|
| 3316 | - global $wpdb, $plugin_prefix, $current_user, $wp_filesystem; |
|
| 3316 | + global $wpdb, $plugin_prefix, $current_user, $wp_filesystem; |
|
| 3317 | 3317 | |
| 3318 | - error_reporting(0); |
|
| 3318 | + error_reporting(0); |
|
| 3319 | 3319 | |
| 3320 | - // try to set higher limits for import |
|
| 3321 | - $max_input_time = ini_get('max_input_time');
|
|
| 3322 | - $max_execution_time = ini_get('max_execution_time');
|
|
| 3323 | - $memory_limit= ini_get('memory_limit');
|
|
| 3320 | + // try to set higher limits for import |
|
| 3321 | + $max_input_time = ini_get('max_input_time');
|
|
| 3322 | + $max_execution_time = ini_get('max_execution_time');
|
|
| 3323 | + $memory_limit= ini_get('memory_limit');
|
|
| 3324 | 3324 | |
| 3325 | - if(!$max_input_time || $max_input_time<3000){
|
|
| 3326 | - ini_set('max_input_time', 3000);
|
|
| 3327 | - } |
|
| 3325 | + if(!$max_input_time || $max_input_time<3000){
|
|
| 3326 | + ini_set('max_input_time', 3000);
|
|
| 3327 | + } |
|
| 3328 | 3328 | |
| 3329 | - if(!$max_execution_time || $max_execution_time<3000){
|
|
| 3330 | - ini_set('max_execution_time', 3000);
|
|
| 3331 | - } |
|
| 3329 | + if(!$max_execution_time || $max_execution_time<3000){
|
|
| 3330 | + ini_set('max_execution_time', 3000);
|
|
| 3331 | + } |
|
| 3332 | 3332 | |
| 3333 | - if($memory_limit && str_replace('M','',$memory_limit)){
|
|
| 3334 | - if(str_replace('M','',$memory_limit)<256){
|
|
| 3335 | - ini_set('memory_limit', '256M');
|
|
| 3336 | - } |
|
| 3337 | - } |
|
| 3333 | + if($memory_limit && str_replace('M','',$memory_limit)){
|
|
| 3334 | + if(str_replace('M','',$memory_limit)<256){
|
|
| 3335 | + ini_set('memory_limit', '256M');
|
|
| 3336 | + } |
|
| 3337 | + } |
|
| 3338 | 3338 | |
| 3339 | - $json = array(); |
|
| 3339 | + $json = array(); |
|
| 3340 | 3340 | |
| 3341 | - if ( !current_user_can( 'manage_options' ) ) {
|
|
| 3342 | - wp_send_json( $json ); |
|
| 3343 | - } |
|
| 3341 | + if ( !current_user_can( 'manage_options' ) ) {
|
|
| 3342 | + wp_send_json( $json ); |
|
| 3343 | + } |
|
| 3344 | 3344 | |
| 3345 | - $task = isset( $_REQUEST['task'] ) ? $_REQUEST['task'] : NULL; |
|
| 3346 | - $nonce = isset( $_REQUEST['_nonce'] ) ? $_REQUEST['_nonce'] : NULL; |
|
| 3347 | - $stat = isset( $_REQUEST['_st'] ) ? $_REQUEST['_st'] : false; |
|
| 3345 | + $task = isset( $_REQUEST['task'] ) ? $_REQUEST['task'] : NULL; |
|
| 3346 | + $nonce = isset( $_REQUEST['_nonce'] ) ? $_REQUEST['_nonce'] : NULL; |
|
| 3347 | + $stat = isset( $_REQUEST['_st'] ) ? $_REQUEST['_st'] : false; |
|
| 3348 | 3348 | |
| 3349 | - if ( !wp_verify_nonce( $nonce, 'geodir_import_export_nonce' ) ) {
|
|
| 3350 | - wp_send_json( $json ); |
|
| 3351 | - } |
|
| 3349 | + if ( !wp_verify_nonce( $nonce, 'geodir_import_export_nonce' ) ) {
|
|
| 3350 | + wp_send_json( $json ); |
|
| 3351 | + } |
|
| 3352 | 3352 | |
| 3353 | - $post_type = isset( $_REQUEST['_pt'] ) ? $_REQUEST['_pt'] : NULL; |
|
| 3354 | - $chunk_per_page = isset( $_REQUEST['_n'] ) ? absint($_REQUEST['_n']) : NULL; |
|
| 3355 | - $chunk_per_page = $chunk_per_page < 50 || $chunk_per_page > 100000 ? 5000 : $chunk_per_page; |
|
| 3356 | - $chunk_page_no = isset( $_REQUEST['_p'] ) ? absint($_REQUEST['_p']) : 1; |
|
| 3353 | + $post_type = isset( $_REQUEST['_pt'] ) ? $_REQUEST['_pt'] : NULL; |
|
| 3354 | + $chunk_per_page = isset( $_REQUEST['_n'] ) ? absint($_REQUEST['_n']) : NULL; |
|
| 3355 | + $chunk_per_page = $chunk_per_page < 50 || $chunk_per_page > 100000 ? 5000 : $chunk_per_page; |
|
| 3356 | + $chunk_page_no = isset( $_REQUEST['_p'] ) ? absint($_REQUEST['_p']) : 1; |
|
| 3357 | 3357 | |
| 3358 | - $wp_filesystem = geodir_init_filesystem(); |
|
| 3359 | - if (!$wp_filesystem) {
|
|
| 3360 | - $json['error'] = __( 'Filesystem ERROR: Could not access filesystem.', 'geodirectory' ); |
|
| 3361 | - wp_send_json( $json ); |
|
| 3362 | - } |
|
| 3358 | + $wp_filesystem = geodir_init_filesystem(); |
|
| 3359 | + if (!$wp_filesystem) {
|
|
| 3360 | + $json['error'] = __( 'Filesystem ERROR: Could not access filesystem.', 'geodirectory' ); |
|
| 3361 | + wp_send_json( $json ); |
|
| 3362 | + } |
|
| 3363 | 3363 | |
| 3364 | - if (!empty($wp_filesystem) && isset($wp_filesystem->errors) && is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
|
|
| 3365 | - $json['error'] = __( 'Filesystem ERROR: ' . $wp_filesystem->errors->get_error_message(), 'geodirectory' ); |
|
| 3366 | - wp_send_json( $json ); |
|
| 3367 | - } |
|
| 3364 | + if (!empty($wp_filesystem) && isset($wp_filesystem->errors) && is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
|
|
| 3365 | + $json['error'] = __( 'Filesystem ERROR: ' . $wp_filesystem->errors->get_error_message(), 'geodirectory' ); |
|
| 3366 | + wp_send_json( $json ); |
|
| 3367 | + } |
|
| 3368 | 3368 | |
| 3369 | - $csv_file_dir = geodir_path_import_export( false ); |
|
| 3370 | - if ( !$wp_filesystem->is_dir( $csv_file_dir ) ) {
|
|
| 3371 | - if ( !$wp_filesystem->mkdir( $csv_file_dir, FS_CHMOD_DIR ) ) {
|
|
| 3372 | - $json['error'] = __( 'ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory' ); |
|
| 3373 | - wp_send_json( $json ); |
|
| 3374 | - } |
|
| 3375 | - } |
|
| 3369 | + $csv_file_dir = geodir_path_import_export( false ); |
|
| 3370 | + if ( !$wp_filesystem->is_dir( $csv_file_dir ) ) {
|
|
| 3371 | + if ( !$wp_filesystem->mkdir( $csv_file_dir, FS_CHMOD_DIR ) ) {
|
|
| 3372 | + $json['error'] = __( 'ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory' ); |
|
| 3373 | + wp_send_json( $json ); |
|
| 3374 | + } |
|
| 3375 | + } |
|
| 3376 | 3376 | |
| 3377 | - $location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
|
|
| 3378 | - $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
|
|
| 3379 | - |
|
| 3380 | - switch ( $task ) {
|
|
| 3381 | - case 'export_posts': {
|
|
| 3382 | - // WPML |
|
| 3383 | - $is_wpml = geodir_is_wpml(); |
|
| 3384 | - if ($is_wpml) {
|
|
| 3385 | - global $sitepress; |
|
| 3386 | - $active_lang = ICL_LANGUAGE_CODE; |
|
| 3377 | + $location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
|
|
| 3378 | + $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
|
|
| 3379 | + |
|
| 3380 | + switch ( $task ) {
|
|
| 3381 | + case 'export_posts': {
|
|
| 3382 | + // WPML |
|
| 3383 | + $is_wpml = geodir_is_wpml(); |
|
| 3384 | + if ($is_wpml) {
|
|
| 3385 | + global $sitepress; |
|
| 3386 | + $active_lang = ICL_LANGUAGE_CODE; |
|
| 3387 | 3387 | |
| 3388 | - $sitepress->switch_lang('all', true);
|
|
| 3389 | - } |
|
| 3390 | - // WPML |
|
| 3391 | - if ( $post_type == 'gd_event' ) {
|
|
| 3392 | - add_filter( 'geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2 ); |
|
| 3393 | - } |
|
| 3394 | - $filters = !empty( $_REQUEST['gd_imex'] ) && is_array( $_REQUEST['gd_imex'] ) ? $_REQUEST['gd_imex'] : NULL; |
|
| 3388 | + $sitepress->switch_lang('all', true);
|
|
| 3389 | + } |
|
| 3390 | + // WPML |
|
| 3391 | + if ( $post_type == 'gd_event' ) {
|
|
| 3392 | + add_filter( 'geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2 ); |
|
| 3393 | + } |
|
| 3394 | + $filters = !empty( $_REQUEST['gd_imex'] ) && is_array( $_REQUEST['gd_imex'] ) ? $_REQUEST['gd_imex'] : NULL; |
|
| 3395 | 3395 | |
| 3396 | - $file_name = $post_type . '_' . date( 'dmyHi' ); |
|
| 3397 | - if ( $filters && isset( $filters['start_date'] ) && isset( $filters['end_date'] ) ) {
|
|
| 3398 | - $file_name = $post_type . '_' . date_i18n( 'dmy', strtotime( $filters['start_date'] ) ) . '_' . date_i18n( 'dmy', strtotime( $filters['end_date'] ) ); |
|
| 3399 | - } |
|
| 3400 | - $posts_count = geodir_get_posts_count( $post_type ); |
|
| 3401 | - $file_url_base = geodir_path_import_export() . '/'; |
|
| 3402 | - $file_url = $file_url_base . $file_name . '.csv'; |
|
| 3403 | - $file_path = $csv_file_dir . '/' . $file_name . '.csv'; |
|
| 3404 | - $file_path_temp = $csv_file_dir . '/' . $post_type . '_' . $nonce . '.csv'; |
|
| 3396 | + $file_name = $post_type . '_' . date( 'dmyHi' ); |
|
| 3397 | + if ( $filters && isset( $filters['start_date'] ) && isset( $filters['end_date'] ) ) {
|
|
| 3398 | + $file_name = $post_type . '_' . date_i18n( 'dmy', strtotime( $filters['start_date'] ) ) . '_' . date_i18n( 'dmy', strtotime( $filters['end_date'] ) ); |
|
| 3399 | + } |
|
| 3400 | + $posts_count = geodir_get_posts_count( $post_type ); |
|
| 3401 | + $file_url_base = geodir_path_import_export() . '/'; |
|
| 3402 | + $file_url = $file_url_base . $file_name . '.csv'; |
|
| 3403 | + $file_path = $csv_file_dir . '/' . $file_name . '.csv'; |
|
| 3404 | + $file_path_temp = $csv_file_dir . '/' . $post_type . '_' . $nonce . '.csv'; |
|
| 3405 | 3405 | |
| 3406 | - $chunk_file_paths = array(); |
|
| 3406 | + $chunk_file_paths = array(); |
|
| 3407 | 3407 | |
| 3408 | - if ( isset( $_REQUEST['_c'] ) ) {
|
|
| 3409 | - $json['total'] = $posts_count; |
|
| 3410 | - // WPML |
|
| 3411 | - if ($is_wpml) {
|
|
| 3412 | - $sitepress->switch_lang($active_lang, true); |
|
| 3413 | - } |
|
| 3414 | - // WPML |
|
| 3415 | - wp_send_json( $json ); |
|
| 3416 | - gd_die(); |
|
| 3417 | - } else if ( isset( $_REQUEST['_st'] ) ) {
|
|
| 3418 | - $line_count = (int)geodir_import_export_line_count( $file_path_temp ); |
|
| 3419 | - $percentage = count( $posts_count ) > 0 && $line_count > 0 ? ceil( $line_count / $posts_count ) * 100 : 0; |
|
| 3420 | - $percentage = min( $percentage, 100 ); |
|
| 3408 | + if ( isset( $_REQUEST['_c'] ) ) {
|
|
| 3409 | + $json['total'] = $posts_count; |
|
| 3410 | + // WPML |
|
| 3411 | + if ($is_wpml) {
|
|
| 3412 | + $sitepress->switch_lang($active_lang, true); |
|
| 3413 | + } |
|
| 3414 | + // WPML |
|
| 3415 | + wp_send_json( $json ); |
|
| 3416 | + gd_die(); |
|
| 3417 | + } else if ( isset( $_REQUEST['_st'] ) ) {
|
|
| 3418 | + $line_count = (int)geodir_import_export_line_count( $file_path_temp ); |
|
| 3419 | + $percentage = count( $posts_count ) > 0 && $line_count > 0 ? ceil( $line_count / $posts_count ) * 100 : 0; |
|
| 3420 | + $percentage = min( $percentage, 100 ); |
|
| 3421 | 3421 | |
| 3422 | - $json['percentage'] = $percentage; |
|
| 3423 | - // WPML |
|
| 3424 | - if ($is_wpml) {
|
|
| 3425 | - $sitepress->switch_lang($active_lang, true); |
|
| 3426 | - } |
|
| 3427 | - // WPML |
|
| 3428 | - wp_send_json( $json ); |
|
| 3429 | - gd_die(); |
|
| 3430 | - } else {
|
|
| 3431 | - if ( !$posts_count > 0 ) {
|
|
| 3432 | - $json['error'] = __( 'No records to export.', 'geodirectory' ); |
|
| 3433 | - } else {
|
|
| 3434 | - $total_posts = $posts_count; |
|
| 3435 | - if ($chunk_per_page > $total_posts) {
|
|
| 3436 | - $chunk_per_page = $total_posts; |
|
| 3437 | - } |
|
| 3438 | - $chunk_total_pages = ceil( $total_posts / $chunk_per_page ); |
|
| 3422 | + $json['percentage'] = $percentage; |
|
| 3423 | + // WPML |
|
| 3424 | + if ($is_wpml) {
|
|
| 3425 | + $sitepress->switch_lang($active_lang, true); |
|
| 3426 | + } |
|
| 3427 | + // WPML |
|
| 3428 | + wp_send_json( $json ); |
|
| 3429 | + gd_die(); |
|
| 3430 | + } else {
|
|
| 3431 | + if ( !$posts_count > 0 ) {
|
|
| 3432 | + $json['error'] = __( 'No records to export.', 'geodirectory' ); |
|
| 3433 | + } else {
|
|
| 3434 | + $total_posts = $posts_count; |
|
| 3435 | + if ($chunk_per_page > $total_posts) {
|
|
| 3436 | + $chunk_per_page = $total_posts; |
|
| 3437 | + } |
|
| 3438 | + $chunk_total_pages = ceil( $total_posts / $chunk_per_page ); |
|
| 3439 | 3439 | |
| 3440 | - $j = $chunk_page_no; |
|
| 3441 | - $chunk_save_posts = geodir_imex_get_posts( $post_type, $chunk_per_page, $j ); |
|
| 3440 | + $j = $chunk_page_no; |
|
| 3441 | + $chunk_save_posts = geodir_imex_get_posts( $post_type, $chunk_per_page, $j ); |
|
| 3442 | 3442 | |
| 3443 | - $per_page = 500; |
|
| 3444 | - if ($per_page > $chunk_per_page) {
|
|
| 3445 | - $per_page = $chunk_per_page; |
|
| 3446 | - } |
|
| 3447 | - $total_pages = ceil( $chunk_per_page / $per_page ); |
|
| 3443 | + $per_page = 500; |
|
| 3444 | + if ($per_page > $chunk_per_page) {
|
|
| 3445 | + $per_page = $chunk_per_page; |
|
| 3446 | + } |
|
| 3447 | + $total_pages = ceil( $chunk_per_page / $per_page ); |
|
| 3448 | 3448 | |
| 3449 | - for ( $i = 0; $i <= $total_pages; $i++ ) {
|
|
| 3450 | - $save_posts = array_slice( $chunk_save_posts , ( $i * $per_page ), $per_page ); |
|
| 3449 | + for ( $i = 0; $i <= $total_pages; $i++ ) {
|
|
| 3450 | + $save_posts = array_slice( $chunk_save_posts , ( $i * $per_page ), $per_page ); |
|
| 3451 | 3451 | |
| 3452 | - $clear = $i == 0 ? true : false; |
|
| 3453 | - geodir_save_csv_data( $file_path_temp, $save_posts, $clear ); |
|
| 3454 | - } |
|
| 3452 | + $clear = $i == 0 ? true : false; |
|
| 3453 | + geodir_save_csv_data( $file_path_temp, $save_posts, $clear ); |
|
| 3454 | + } |
|
| 3455 | 3455 | |
| 3456 | - if ( $wp_filesystem->exists( $file_path_temp ) ) {
|
|
| 3457 | - $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : ''; |
|
| 3458 | - $chunk_file_name = $file_name . $chunk_page_no . '.csv'; |
|
| 3459 | - $file_path = $csv_file_dir . '/' . $chunk_file_name; |
|
| 3460 | - $wp_filesystem->move( $file_path_temp, $file_path, true ); |
|
| 3456 | + if ( $wp_filesystem->exists( $file_path_temp ) ) {
|
|
| 3457 | + $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : ''; |
|
| 3458 | + $chunk_file_name = $file_name . $chunk_page_no . '.csv'; |
|
| 3459 | + $file_path = $csv_file_dir . '/' . $chunk_file_name; |
|
| 3460 | + $wp_filesystem->move( $file_path_temp, $file_path, true ); |
|
| 3461 | 3461 | |
| 3462 | - $file_url = $file_url_base . $chunk_file_name; |
|
| 3463 | - $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
| 3464 | - } |
|
| 3462 | + $file_url = $file_url_base . $chunk_file_name; |
|
| 3463 | + $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
| 3464 | + } |
|
| 3465 | 3465 | |
| 3466 | - if ( !empty($chunk_file_paths) ) {
|
|
| 3467 | - $json['total'] = $posts_count; |
|
| 3468 | - $json['files'] = $chunk_file_paths; |
|
| 3469 | - } else {
|
|
| 3470 | - if ($j > 1) {
|
|
| 3471 | - $json['total'] = $posts_count; |
|
| 3472 | - $json['files'] = array(); |
|
| 3473 | - } else {
|
|
| 3474 | - $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' ); |
|
| 3475 | - } |
|
| 3476 | - } |
|
| 3477 | - } |
|
| 3478 | - // WPML |
|
| 3479 | - if ($is_wpml) {
|
|
| 3480 | - $sitepress->switch_lang($active_lang, true); |
|
| 3481 | - } |
|
| 3482 | - // WPML |
|
| 3483 | - wp_send_json( $json ); |
|
| 3484 | - } |
|
| 3485 | - } |
|
| 3486 | - break; |
|
| 3487 | - case 'export_cats': {
|
|
| 3488 | - // WPML |
|
| 3489 | - $is_wpml = geodir_is_wpml(); |
|
| 3490 | - if ($is_wpml) {
|
|
| 3491 | - global $sitepress; |
|
| 3492 | - $active_lang = ICL_LANGUAGE_CODE; |
|
| 3466 | + if ( !empty($chunk_file_paths) ) {
|
|
| 3467 | + $json['total'] = $posts_count; |
|
| 3468 | + $json['files'] = $chunk_file_paths; |
|
| 3469 | + } else {
|
|
| 3470 | + if ($j > 1) {
|
|
| 3471 | + $json['total'] = $posts_count; |
|
| 3472 | + $json['files'] = array(); |
|
| 3473 | + } else {
|
|
| 3474 | + $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' ); |
|
| 3475 | + } |
|
| 3476 | + } |
|
| 3477 | + } |
|
| 3478 | + // WPML |
|
| 3479 | + if ($is_wpml) {
|
|
| 3480 | + $sitepress->switch_lang($active_lang, true); |
|
| 3481 | + } |
|
| 3482 | + // WPML |
|
| 3483 | + wp_send_json( $json ); |
|
| 3484 | + } |
|
| 3485 | + } |
|
| 3486 | + break; |
|
| 3487 | + case 'export_cats': {
|
|
| 3488 | + // WPML |
|
| 3489 | + $is_wpml = geodir_is_wpml(); |
|
| 3490 | + if ($is_wpml) {
|
|
| 3491 | + global $sitepress; |
|
| 3492 | + $active_lang = ICL_LANGUAGE_CODE; |
|
| 3493 | 3493 | |
| 3494 | - $sitepress->switch_lang('all', true);
|
|
| 3495 | - } |
|
| 3496 | - // WPML |
|
| 3497 | - $file_name = $post_type . 'category_' . date( 'dmyHi' ); |
|
| 3494 | + $sitepress->switch_lang('all', true);
|
|
| 3495 | + } |
|
| 3496 | + // WPML |
|
| 3497 | + $file_name = $post_type . 'category_' . date( 'dmyHi' ); |
|
| 3498 | 3498 | |
| 3499 | - $terms_count = geodir_get_terms_count( $post_type ); |
|
| 3500 | - $file_url_base = geodir_path_import_export() . '/'; |
|
| 3501 | - $file_url = $file_url_base . $file_name . '.csv'; |
|
| 3502 | - $file_path = $csv_file_dir . '/' . $file_name . '.csv'; |
|
| 3503 | - $file_path_temp = $csv_file_dir . '/' . $post_type . 'category_' . $nonce . '.csv'; |
|
| 3499 | + $terms_count = geodir_get_terms_count( $post_type ); |
|
| 3500 | + $file_url_base = geodir_path_import_export() . '/'; |
|
| 3501 | + $file_url = $file_url_base . $file_name . '.csv'; |
|
| 3502 | + $file_path = $csv_file_dir . '/' . $file_name . '.csv'; |
|
| 3503 | + $file_path_temp = $csv_file_dir . '/' . $post_type . 'category_' . $nonce . '.csv'; |
|
| 3504 | 3504 | |
| 3505 | - $chunk_file_paths = array(); |
|
| 3505 | + $chunk_file_paths = array(); |
|
| 3506 | 3506 | |
| 3507 | - if ( isset( $_REQUEST['_st'] ) ) {
|
|
| 3508 | - $line_count = (int)geodir_import_export_line_count( $file_path_temp ); |
|
| 3509 | - $percentage = count( $terms_count ) > 0 && $line_count > 0 ? ceil( $line_count / $terms_count ) * 100 : 0; |
|
| 3510 | - $percentage = min( $percentage, 100 ); |
|
| 3507 | + if ( isset( $_REQUEST['_st'] ) ) {
|
|
| 3508 | + $line_count = (int)geodir_import_export_line_count( $file_path_temp ); |
|
| 3509 | + $percentage = count( $terms_count ) > 0 && $line_count > 0 ? ceil( $line_count / $terms_count ) * 100 : 0; |
|
| 3510 | + $percentage = min( $percentage, 100 ); |
|
| 3511 | 3511 | |
| 3512 | - $json['percentage'] = $percentage; |
|
| 3513 | - // WPML |
|
| 3514 | - if ($is_wpml) {
|
|
| 3515 | - $sitepress->switch_lang($active_lang, true); |
|
| 3516 | - } |
|
| 3517 | - // WPML |
|
| 3518 | - wp_send_json( $json ); |
|
| 3519 | - } else {
|
|
| 3520 | - if ( !$terms_count > 0 ) {
|
|
| 3521 | - $json['error'] = __( 'No records to export.', 'geodirectory' ); |
|
| 3522 | - } else {
|
|
| 3523 | - $total_terms = $terms_count; |
|
| 3524 | - if ($chunk_per_page > $terms_count) {
|
|
| 3525 | - $chunk_per_page = $terms_count; |
|
| 3526 | - } |
|
| 3527 | - $chunk_total_pages = ceil( $total_terms / $chunk_per_page ); |
|
| 3512 | + $json['percentage'] = $percentage; |
|
| 3513 | + // WPML |
|
| 3514 | + if ($is_wpml) {
|
|
| 3515 | + $sitepress->switch_lang($active_lang, true); |
|
| 3516 | + } |
|
| 3517 | + // WPML |
|
| 3518 | + wp_send_json( $json ); |
|
| 3519 | + } else {
|
|
| 3520 | + if ( !$terms_count > 0 ) {
|
|
| 3521 | + $json['error'] = __( 'No records to export.', 'geodirectory' ); |
|
| 3522 | + } else {
|
|
| 3523 | + $total_terms = $terms_count; |
|
| 3524 | + if ($chunk_per_page > $terms_count) {
|
|
| 3525 | + $chunk_per_page = $terms_count; |
|
| 3526 | + } |
|
| 3527 | + $chunk_total_pages = ceil( $total_terms / $chunk_per_page ); |
|
| 3528 | 3528 | |
| 3529 | - $j = $chunk_page_no; |
|
| 3530 | - $chunk_save_terms = geodir_imex_get_terms( $post_type, $chunk_per_page, $j ); |
|
| 3529 | + $j = $chunk_page_no; |
|
| 3530 | + $chunk_save_terms = geodir_imex_get_terms( $post_type, $chunk_per_page, $j ); |
|
| 3531 | 3531 | |
| 3532 | - $per_page = 500; |
|
| 3533 | - if ($per_page > $chunk_per_page) {
|
|
| 3534 | - $per_page = $chunk_per_page; |
|
| 3535 | - } |
|
| 3536 | - $total_pages = ceil( $chunk_per_page / $per_page ); |
|
| 3532 | + $per_page = 500; |
|
| 3533 | + if ($per_page > $chunk_per_page) {
|
|
| 3534 | + $per_page = $chunk_per_page; |
|
| 3535 | + } |
|
| 3536 | + $total_pages = ceil( $chunk_per_page / $per_page ); |
|
| 3537 | 3537 | |
| 3538 | - for ( $i = 0; $i <= $total_pages; $i++ ) {
|
|
| 3539 | - $save_terms = array_slice( $chunk_save_terms , ( $i * $per_page ), $per_page ); |
|
| 3538 | + for ( $i = 0; $i <= $total_pages; $i++ ) {
|
|
| 3539 | + $save_terms = array_slice( $chunk_save_terms , ( $i * $per_page ), $per_page ); |
|
| 3540 | 3540 | |
| 3541 | - $clear = $i == 0 ? true : false; |
|
| 3542 | - geodir_save_csv_data( $file_path_temp, $save_terms, $clear ); |
|
| 3543 | - } |
|
| 3541 | + $clear = $i == 0 ? true : false; |
|
| 3542 | + geodir_save_csv_data( $file_path_temp, $save_terms, $clear ); |
|
| 3543 | + } |
|
| 3544 | 3544 | |
| 3545 | - if ( $wp_filesystem->exists( $file_path_temp ) ) {
|
|
| 3546 | - $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : ''; |
|
| 3547 | - $chunk_file_name = $file_name . $chunk_page_no . '.csv'; |
|
| 3548 | - $file_path = $csv_file_dir . '/' . $chunk_file_name; |
|
| 3549 | - $wp_filesystem->move( $file_path_temp, $file_path, true ); |
|
| 3545 | + if ( $wp_filesystem->exists( $file_path_temp ) ) {
|
|
| 3546 | + $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : ''; |
|
| 3547 | + $chunk_file_name = $file_name . $chunk_page_no . '.csv'; |
|
| 3548 | + $file_path = $csv_file_dir . '/' . $chunk_file_name; |
|
| 3549 | + $wp_filesystem->move( $file_path_temp, $file_path, true ); |
|
| 3550 | 3550 | |
| 3551 | - $file_url = $file_url_base . $chunk_file_name; |
|
| 3552 | - $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
| 3553 | - } |
|
| 3551 | + $file_url = $file_url_base . $chunk_file_name; |
|
| 3552 | + $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
| 3553 | + } |
|
| 3554 | 3554 | |
| 3555 | - if ( !empty($chunk_file_paths) ) {
|
|
| 3556 | - $json['total'] = $terms_count; |
|
| 3557 | - $json['files'] = $chunk_file_paths; |
|
| 3558 | - } else {
|
|
| 3559 | - $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' ); |
|
| 3560 | - } |
|
| 3561 | - } |
|
| 3562 | - // WPML |
|
| 3563 | - if ($is_wpml) {
|
|
| 3564 | - $sitepress->switch_lang($active_lang, true); |
|
| 3565 | - } |
|
| 3566 | - // WPML |
|
| 3567 | - wp_send_json( $json ); |
|
| 3568 | - } |
|
| 3569 | - } |
|
| 3570 | - break; |
|
| 3571 | - case 'export_locations': {
|
|
| 3572 | - $file_url_base = geodir_path_import_export() . '/'; |
|
| 3573 | - $file_name = 'gd_locations_' . date( 'dmyHi' ); |
|
| 3574 | - $file_url = $file_url_base . $file_name . '.csv'; |
|
| 3575 | - $file_path = $csv_file_dir . '/' . $file_name . '.csv'; |
|
| 3576 | - $file_path_temp = $csv_file_dir . '/gd_locations_' . $nonce . '.csv'; |
|
| 3555 | + if ( !empty($chunk_file_paths) ) {
|
|
| 3556 | + $json['total'] = $terms_count; |
|
| 3557 | + $json['files'] = $chunk_file_paths; |
|
| 3558 | + } else {
|
|
| 3559 | + $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' ); |
|
| 3560 | + } |
|
| 3561 | + } |
|
| 3562 | + // WPML |
|
| 3563 | + if ($is_wpml) {
|
|
| 3564 | + $sitepress->switch_lang($active_lang, true); |
|
| 3565 | + } |
|
| 3566 | + // WPML |
|
| 3567 | + wp_send_json( $json ); |
|
| 3568 | + } |
|
| 3569 | + } |
|
| 3570 | + break; |
|
| 3571 | + case 'export_locations': {
|
|
| 3572 | + $file_url_base = geodir_path_import_export() . '/'; |
|
| 3573 | + $file_name = 'gd_locations_' . date( 'dmyHi' ); |
|
| 3574 | + $file_url = $file_url_base . $file_name . '.csv'; |
|
| 3575 | + $file_path = $csv_file_dir . '/' . $file_name . '.csv'; |
|
| 3576 | + $file_path_temp = $csv_file_dir . '/gd_locations_' . $nonce . '.csv'; |
|
| 3577 | 3577 | |
| 3578 | - $items_count = (int)geodir_location_imex_count_locations(); |
|
| 3578 | + $items_count = (int)geodir_location_imex_count_locations(); |
|
| 3579 | 3579 | |
| 3580 | - if ( isset( $_REQUEST['_st'] ) ) {
|
|
| 3581 | - $line_count = (int)geodir_import_export_line_count( $file_path_temp ); |
|
| 3582 | - $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0; |
|
| 3583 | - $percentage = min( $percentage, 100 ); |
|
| 3580 | + if ( isset( $_REQUEST['_st'] ) ) {
|
|
| 3581 | + $line_count = (int)geodir_import_export_line_count( $file_path_temp ); |
|
| 3582 | + $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0; |
|
| 3583 | + $percentage = min( $percentage, 100 ); |
|
| 3584 | 3584 | |
| 3585 | - $json['percentage'] = $percentage; |
|
| 3586 | - wp_send_json( $json ); |
|
| 3587 | - } else {
|
|
| 3588 | - $chunk_file_paths = array(); |
|
| 3585 | + $json['percentage'] = $percentage; |
|
| 3586 | + wp_send_json( $json ); |
|
| 3587 | + } else {
|
|
| 3588 | + $chunk_file_paths = array(); |
|
| 3589 | 3589 | |
| 3590 | - if ( !$items_count > 0 ) {
|
|
| 3591 | - $json['error'] = __( 'No records to export.', 'geodirectory' ); |
|
| 3592 | - } else {
|
|
| 3593 | - $chunk_per_page = min( $chunk_per_page, $items_count ); |
|
| 3594 | - $chunk_total_pages = ceil( $items_count / $chunk_per_page ); |
|
| 3590 | + if ( !$items_count > 0 ) {
|
|
| 3591 | + $json['error'] = __( 'No records to export.', 'geodirectory' ); |
|
| 3592 | + } else {
|
|
| 3593 | + $chunk_per_page = min( $chunk_per_page, $items_count ); |
|
| 3594 | + $chunk_total_pages = ceil( $items_count / $chunk_per_page ); |
|
| 3595 | 3595 | |
| 3596 | - $j = $chunk_page_no; |
|
| 3597 | - $chunk_save_items = geodir_location_imex_locations_data( $chunk_per_page, $j ); |
|
| 3596 | + $j = $chunk_page_no; |
|
| 3597 | + $chunk_save_items = geodir_location_imex_locations_data( $chunk_per_page, $j ); |
|
| 3598 | 3598 | |
| 3599 | - $per_page = 500; |
|
| 3600 | - $per_page = min( $per_page, $chunk_per_page ); |
|
| 3601 | - $total_pages = ceil( $chunk_per_page / $per_page ); |
|
| 3599 | + $per_page = 500; |
|
| 3600 | + $per_page = min( $per_page, $chunk_per_page ); |
|
| 3601 | + $total_pages = ceil( $chunk_per_page / $per_page ); |
|
| 3602 | 3602 | |
| 3603 | - for ( $i = 0; $i <= $total_pages; $i++ ) {
|
|
| 3604 | - $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page ); |
|
| 3603 | + for ( $i = 0; $i <= $total_pages; $i++ ) {
|
|
| 3604 | + $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page ); |
|
| 3605 | 3605 | |
| 3606 | - $clear = $i == 0 ? true : false; |
|
| 3607 | - geodir_save_csv_data( $file_path_temp, $save_items, $clear ); |
|
| 3608 | - } |
|
| 3606 | + $clear = $i == 0 ? true : false; |
|
| 3607 | + geodir_save_csv_data( $file_path_temp, $save_items, $clear ); |
|
| 3608 | + } |
|
| 3609 | 3609 | |
| 3610 | - if ( $wp_filesystem->exists( $file_path_temp ) ) {
|
|
| 3611 | - $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : ''; |
|
| 3612 | - $chunk_file_name = $file_name . $chunk_page_no . '.csv'; |
|
| 3613 | - $file_path = $csv_file_dir . '/' . $chunk_file_name; |
|
| 3614 | - $wp_filesystem->move( $file_path_temp, $file_path, true ); |
|
| 3610 | + if ( $wp_filesystem->exists( $file_path_temp ) ) {
|
|
| 3611 | + $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : ''; |
|
| 3612 | + $chunk_file_name = $file_name . $chunk_page_no . '.csv'; |
|
| 3613 | + $file_path = $csv_file_dir . '/' . $chunk_file_name; |
|
| 3614 | + $wp_filesystem->move( $file_path_temp, $file_path, true ); |
|
| 3615 | 3615 | |
| 3616 | - $file_url = $file_url_base . $chunk_file_name; |
|
| 3617 | - $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
| 3618 | - } |
|
| 3616 | + $file_url = $file_url_base . $chunk_file_name; |
|
| 3617 | + $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
| 3618 | + } |
|
| 3619 | 3619 | |
| 3620 | - if ( !empty($chunk_file_paths) ) {
|
|
| 3621 | - $json['total'] = $items_count; |
|
| 3622 | - $json['files'] = $chunk_file_paths; |
|
| 3623 | - } else {
|
|
| 3624 | - $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' ); |
|
| 3625 | - } |
|
| 3626 | - } |
|
| 3627 | - wp_send_json( $json ); |
|
| 3628 | - } |
|
| 3629 | - } |
|
| 3630 | - break; |
|
| 3631 | - case 'export_hoods': {
|
|
| 3632 | - $file_url_base = geodir_path_import_export() . '/'; |
|
| 3633 | - $file_name = 'gd_neighbourhoods_' . date( 'dmyHi' ); |
|
| 3634 | - $file_url = $file_url_base . $file_name . '.csv'; |
|
| 3635 | - $file_path = $csv_file_dir . '/' . $file_name . '.csv'; |
|
| 3636 | - $file_path_temp = $csv_file_dir . '/gd_neighbourhoods_' . $nonce . '.csv'; |
|
| 3620 | + if ( !empty($chunk_file_paths) ) {
|
|
| 3621 | + $json['total'] = $items_count; |
|
| 3622 | + $json['files'] = $chunk_file_paths; |
|
| 3623 | + } else {
|
|
| 3624 | + $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' ); |
|
| 3625 | + } |
|
| 3626 | + } |
|
| 3627 | + wp_send_json( $json ); |
|
| 3628 | + } |
|
| 3629 | + } |
|
| 3630 | + break; |
|
| 3631 | + case 'export_hoods': {
|
|
| 3632 | + $file_url_base = geodir_path_import_export() . '/'; |
|
| 3633 | + $file_name = 'gd_neighbourhoods_' . date( 'dmyHi' ); |
|
| 3634 | + $file_url = $file_url_base . $file_name . '.csv'; |
|
| 3635 | + $file_path = $csv_file_dir . '/' . $file_name . '.csv'; |
|
| 3636 | + $file_path_temp = $csv_file_dir . '/gd_neighbourhoods_' . $nonce . '.csv'; |
|
| 3637 | 3637 | |
| 3638 | - $items_count = (int)geodir_location_imex_count_neighbourhoods(); |
|
| 3638 | + $items_count = (int)geodir_location_imex_count_neighbourhoods(); |
|
| 3639 | 3639 | |
| 3640 | - if ( isset( $_REQUEST['_st'] ) ) {
|
|
| 3641 | - $line_count = (int)geodir_import_export_line_count( $file_path_temp ); |
|
| 3642 | - $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0; |
|
| 3643 | - $percentage = min( $percentage, 100 ); |
|
| 3640 | + if ( isset( $_REQUEST['_st'] ) ) {
|
|
| 3641 | + $line_count = (int)geodir_import_export_line_count( $file_path_temp ); |
|
| 3642 | + $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0; |
|
| 3643 | + $percentage = min( $percentage, 100 ); |
|
| 3644 | 3644 | |
| 3645 | - $json['percentage'] = $percentage; |
|
| 3646 | - wp_send_json( $json ); |
|
| 3647 | - } else {
|
|
| 3648 | - $chunk_file_paths = array(); |
|
| 3645 | + $json['percentage'] = $percentage; |
|
| 3646 | + wp_send_json( $json ); |
|
| 3647 | + } else {
|
|
| 3648 | + $chunk_file_paths = array(); |
|
| 3649 | 3649 | |
| 3650 | - if ( !$items_count > 0 ) {
|
|
| 3651 | - $json['error'] = __( 'No records to export.', 'geodirectory' ); |
|
| 3652 | - } else {
|
|
| 3653 | - $chunk_per_page = min( $chunk_per_page, $items_count ); |
|
| 3654 | - $chunk_total_pages = ceil( $items_count / $chunk_per_page ); |
|
| 3650 | + if ( !$items_count > 0 ) {
|
|
| 3651 | + $json['error'] = __( 'No records to export.', 'geodirectory' ); |
|
| 3652 | + } else {
|
|
| 3653 | + $chunk_per_page = min( $chunk_per_page, $items_count ); |
|
| 3654 | + $chunk_total_pages = ceil( $items_count / $chunk_per_page ); |
|
| 3655 | 3655 | |
| 3656 | - $j = $chunk_page_no; |
|
| 3657 | - $chunk_save_items = geodir_location_imex_neighbourhoods_data( $chunk_per_page, $j ); |
|
| 3656 | + $j = $chunk_page_no; |
|
| 3657 | + $chunk_save_items = geodir_location_imex_neighbourhoods_data( $chunk_per_page, $j ); |
|
| 3658 | 3658 | |
| 3659 | - $per_page = 500; |
|
| 3660 | - $per_page = min( $per_page, $chunk_per_page ); |
|
| 3661 | - $total_pages = ceil( $chunk_per_page / $per_page ); |
|
| 3659 | + $per_page = 500; |
|
| 3660 | + $per_page = min( $per_page, $chunk_per_page ); |
|
| 3661 | + $total_pages = ceil( $chunk_per_page / $per_page ); |
|
| 3662 | 3662 | |
| 3663 | - for ( $i = 0; $i <= $total_pages; $i++ ) {
|
|
| 3664 | - $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page ); |
|
| 3663 | + for ( $i = 0; $i <= $total_pages; $i++ ) {
|
|
| 3664 | + $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page ); |
|
| 3665 | 3665 | |
| 3666 | - $clear = $i == 0 ? true : false; |
|
| 3667 | - geodir_save_csv_data( $file_path_temp, $save_items, $clear ); |
|
| 3668 | - } |
|
| 3666 | + $clear = $i == 0 ? true : false; |
|
| 3667 | + geodir_save_csv_data( $file_path_temp, $save_items, $clear ); |
|
| 3668 | + } |
|
| 3669 | 3669 | |
| 3670 | - if ( $wp_filesystem->exists( $file_path_temp ) ) {
|
|
| 3671 | - $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : ''; |
|
| 3672 | - $chunk_file_name = $file_name . $chunk_page_no . '.csv'; |
|
| 3673 | - $file_path = $csv_file_dir . '/' . $chunk_file_name; |
|
| 3674 | - $wp_filesystem->move( $file_path_temp, $file_path, true ); |
|
| 3670 | + if ( $wp_filesystem->exists( $file_path_temp ) ) {
|
|
| 3671 | + $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : ''; |
|
| 3672 | + $chunk_file_name = $file_name . $chunk_page_no . '.csv'; |
|
| 3673 | + $file_path = $csv_file_dir . '/' . $chunk_file_name; |
|
| 3674 | + $wp_filesystem->move( $file_path_temp, $file_path, true ); |
|
| 3675 | 3675 | |
| 3676 | - $file_url = $file_url_base . $chunk_file_name; |
|
| 3677 | - $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
| 3678 | - } |
|
| 3676 | + $file_url = $file_url_base . $chunk_file_name; |
|
| 3677 | + $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
| 3678 | + } |
|
| 3679 | 3679 | |
| 3680 | - if ( !empty($chunk_file_paths) ) {
|
|
| 3681 | - $json['total'] = $items_count; |
|
| 3682 | - $json['files'] = $chunk_file_paths; |
|
| 3683 | - } else {
|
|
| 3684 | - $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' ); |
|
| 3685 | - } |
|
| 3686 | - } |
|
| 3687 | - wp_send_json( $json ); |
|
| 3688 | - } |
|
| 3689 | - } |
|
| 3690 | - break; |
|
| 3691 | - case 'prepare_import': |
|
| 3692 | - case 'import_cat': |
|
| 3693 | - case 'import_post': |
|
| 3694 | - case 'import_loc': |
|
| 3695 | - case 'import_hood': {
|
|
| 3696 | - // WPML |
|
| 3697 | - $is_wpml = geodir_is_wpml(); |
|
| 3698 | - if ($is_wpml) {
|
|
| 3699 | - global $sitepress; |
|
| 3700 | - $active_lang = ICL_LANGUAGE_CODE; |
|
| 3701 | - } |
|
| 3702 | - // WPML |
|
| 3680 | + if ( !empty($chunk_file_paths) ) {
|
|
| 3681 | + $json['total'] = $items_count; |
|
| 3682 | + $json['files'] = $chunk_file_paths; |
|
| 3683 | + } else {
|
|
| 3684 | + $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' ); |
|
| 3685 | + } |
|
| 3686 | + } |
|
| 3687 | + wp_send_json( $json ); |
|
| 3688 | + } |
|
| 3689 | + } |
|
| 3690 | + break; |
|
| 3691 | + case 'prepare_import': |
|
| 3692 | + case 'import_cat': |
|
| 3693 | + case 'import_post': |
|
| 3694 | + case 'import_loc': |
|
| 3695 | + case 'import_hood': {
|
|
| 3696 | + // WPML |
|
| 3697 | + $is_wpml = geodir_is_wpml(); |
|
| 3698 | + if ($is_wpml) {
|
|
| 3699 | + global $sitepress; |
|
| 3700 | + $active_lang = ICL_LANGUAGE_CODE; |
|
| 3701 | + } |
|
| 3702 | + // WPML |
|
| 3703 | 3703 | |
| 3704 | - ini_set( 'auto_detect_line_endings', true ); |
|
| 3704 | + ini_set( 'auto_detect_line_endings', true ); |
|
| 3705 | 3705 | |
| 3706 | - $uploads = wp_upload_dir(); |
|
| 3707 | - $uploads_dir = $uploads['path']; |
|
| 3708 | - $uploads_subdir = $uploads['subdir']; |
|
| 3706 | + $uploads = wp_upload_dir(); |
|
| 3707 | + $uploads_dir = $uploads['path']; |
|
| 3708 | + $uploads_subdir = $uploads['subdir']; |
|
| 3709 | 3709 | |
| 3710 | - $csv_file = isset( $_POST['_file'] ) ? $_POST['_file'] : NULL; |
|
| 3711 | - $import_choice = isset( $_REQUEST['_ch'] ) ? $_REQUEST['_ch'] : 'skip'; |
|
| 3710 | + $csv_file = isset( $_POST['_file'] ) ? $_POST['_file'] : NULL; |
|
| 3711 | + $import_choice = isset( $_REQUEST['_ch'] ) ? $_REQUEST['_ch'] : 'skip'; |
|
| 3712 | 3712 | |
| 3713 | - $csv_file_arr = explode( '/', $csv_file ); |
|
| 3714 | - $csv_filename = end( $csv_file_arr ); |
|
| 3715 | - $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $csv_filename; |
|
| 3713 | + $csv_file_arr = explode( '/', $csv_file ); |
|
| 3714 | + $csv_filename = end( $csv_file_arr ); |
|
| 3715 | + $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $csv_filename; |
|
| 3716 | 3716 | |
| 3717 | - $json['file'] = $csv_file; |
|
| 3718 | - $json['error'] = __( 'The uploaded file is not a valid csv file. Please try again.', 'geodirectory' ); |
|
| 3719 | - $file = array(); |
|
| 3717 | + $json['file'] = $csv_file; |
|
| 3718 | + $json['error'] = __( 'The uploaded file is not a valid csv file. Please try again.', 'geodirectory' ); |
|
| 3719 | + $file = array(); |
|
| 3720 | 3720 | |
| 3721 | - if ( $csv_file && $wp_filesystem->is_file( $target_path ) && $wp_filesystem->exists( $target_path ) ) {
|
|
| 3722 | - $wp_filetype = wp_check_filetype_and_ext( $target_path, $csv_filename ); |
|
| 3721 | + if ( $csv_file && $wp_filesystem->is_file( $target_path ) && $wp_filesystem->exists( $target_path ) ) {
|
|
| 3722 | + $wp_filetype = wp_check_filetype_and_ext( $target_path, $csv_filename ); |
|
| 3723 | 3723 | |
| 3724 | - if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
|
|
| 3725 | - $json['error'] = NULL; |
|
| 3726 | - $json['rows'] = 0; |
|
| 3724 | + if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
|
|
| 3725 | + $json['error'] = NULL; |
|
| 3726 | + $json['rows'] = 0; |
|
| 3727 | 3727 | |
| 3728 | - $lc_all = setlocale(LC_ALL, 0); // Fix issue of fgetcsv ignores special characters when they are at the beginning of line |
|
| 3729 | - setlocale(LC_ALL, 'en_US.UTF-8'); |
|
| 3730 | - if ( ( $handle = fopen($target_path, "r" ) ) !== FALSE ) {
|
|
| 3731 | - while ( ( $data = fgetcsv( $handle, 100000, "," ) ) !== FALSE ) {
|
|
| 3732 | - if ( !empty( $data ) ) {
|
|
| 3733 | - $file[] = $data; |
|
| 3734 | - } |
|
| 3735 | - } |
|
| 3736 | - fclose($handle); |
|
| 3737 | - } |
|
| 3738 | - setlocale(LC_ALL, $lc_all); |
|
| 3728 | + $lc_all = setlocale(LC_ALL, 0); // Fix issue of fgetcsv ignores special characters when they are at the beginning of line |
|
| 3729 | + setlocale(LC_ALL, 'en_US.UTF-8'); |
|
| 3730 | + if ( ( $handle = fopen($target_path, "r" ) ) !== FALSE ) {
|
|
| 3731 | + while ( ( $data = fgetcsv( $handle, 100000, "," ) ) !== FALSE ) {
|
|
| 3732 | + if ( !empty( $data ) ) {
|
|
| 3733 | + $file[] = $data; |
|
| 3734 | + } |
|
| 3735 | + } |
|
| 3736 | + fclose($handle); |
|
| 3737 | + } |
|
| 3738 | + setlocale(LC_ALL, $lc_all); |
|
| 3739 | 3739 | |
| 3740 | - $json['rows'] = (!empty($file) && count($file) > 1) ? count($file) - 1 : 0; |
|
| 3740 | + $json['rows'] = (!empty($file) && count($file) > 1) ? count($file) - 1 : 0; |
|
| 3741 | 3741 | |
| 3742 | - if (!$json['rows'] > 0) {
|
|
| 3743 | - $json['error'] = __('No data found in csv file.', 'geodirectory');
|
|
| 3744 | - } |
|
| 3745 | - } else {
|
|
| 3746 | - wp_send_json( $json ); |
|
| 3747 | - } |
|
| 3748 | - } else {
|
|
| 3749 | - wp_send_json( $json ); |
|
| 3750 | - } |
|
| 3742 | + if (!$json['rows'] > 0) {
|
|
| 3743 | + $json['error'] = __('No data found in csv file.', 'geodirectory');
|
|
| 3744 | + } |
|
| 3745 | + } else {
|
|
| 3746 | + wp_send_json( $json ); |
|
| 3747 | + } |
|
| 3748 | + } else {
|
|
| 3749 | + wp_send_json( $json ); |
|
| 3750 | + } |
|
| 3751 | 3751 | |
| 3752 | - if ( $task == 'prepare_import' || !empty( $json['error'] ) ) {
|
|
| 3753 | - wp_send_json( $json ); |
|
| 3754 | - } |
|
| 3752 | + if ( $task == 'prepare_import' || !empty( $json['error'] ) ) {
|
|
| 3753 | + wp_send_json( $json ); |
|
| 3754 | + } |
|
| 3755 | 3755 | |
| 3756 | - $total = $json['rows']; |
|
| 3757 | - $limit = isset($_POST['limit']) ? (int)$_POST['limit'] : 1; |
|
| 3758 | - $processed = isset($_POST['processed']) ? (int)$_POST['processed'] : 0; |
|
| 3756 | + $total = $json['rows']; |
|
| 3757 | + $limit = isset($_POST['limit']) ? (int)$_POST['limit'] : 1; |
|
| 3758 | + $processed = isset($_POST['processed']) ? (int)$_POST['processed'] : 0; |
|
| 3759 | 3759 | |
| 3760 | - $count = $limit; |
|
| 3760 | + $count = $limit; |
|
| 3761 | 3761 | |
| 3762 | - if ($count < $total) {
|
|
| 3763 | - $count = $processed + $count; |
|
| 3764 | - if ($count > $total) {
|
|
| 3765 | - $count = $total; |
|
| 3766 | - } |
|
| 3767 | - } else {
|
|
| 3768 | - $count = $total; |
|
| 3769 | - } |
|
| 3762 | + if ($count < $total) {
|
|
| 3763 | + $count = $processed + $count; |
|
| 3764 | + if ($count > $total) {
|
|
| 3765 | + $count = $total; |
|
| 3766 | + } |
|
| 3767 | + } else {
|
|
| 3768 | + $count = $total; |
|
| 3769 | + } |
|
| 3770 | 3770 | |
| 3771 | - $created = 0; |
|
| 3772 | - $updated = 0; |
|
| 3773 | - $skipped = 0; |
|
| 3774 | - $invalid = 0; |
|
| 3775 | - $invalid_addr = 0; |
|
| 3776 | - $images = 0; |
|
| 3771 | + $created = 0; |
|
| 3772 | + $updated = 0; |
|
| 3773 | + $skipped = 0; |
|
| 3774 | + $invalid = 0; |
|
| 3775 | + $invalid_addr = 0; |
|
| 3776 | + $images = 0; |
|
| 3777 | 3777 | |
| 3778 | - $gd_post_info = array(); |
|
| 3779 | - $countpost = 0; |
|
| 3778 | + $gd_post_info = array(); |
|
| 3779 | + $countpost = 0; |
|
| 3780 | 3780 | |
| 3781 | - $post_types = geodir_get_posttypes(); |
|
| 3781 | + $post_types = geodir_get_posttypes(); |
|
| 3782 | 3782 | |
| 3783 | - if ( $task == 'import_cat' ) {
|
|
| 3784 | - if (!empty($file)) {
|
|
| 3785 | - $columns = isset($file[0]) ? $file[0] : NULL; |
|
| 3783 | + if ( $task == 'import_cat' ) {
|
|
| 3784 | + if (!empty($file)) {
|
|
| 3785 | + $columns = isset($file[0]) ? $file[0] : NULL; |
|
| 3786 | 3786 | |
| 3787 | - if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
|
|
| 3788 | - $json['error'] = CSV_INVAILD_FILE; |
|
| 3789 | - wp_send_json( $json ); |
|
| 3790 | - exit; |
|
| 3791 | - } |
|
| 3787 | + if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
|
|
| 3788 | + $json['error'] = CSV_INVAILD_FILE; |
|
| 3789 | + wp_send_json( $json ); |
|
| 3790 | + exit; |
|
| 3791 | + } |
|
| 3792 | 3792 | |
| 3793 | - $gd_error_log = __('GD IMPORT CATEGORIES [ROW %d]:', 'geodirectory');
|
|
| 3793 | + $gd_error_log = __('GD IMPORT CATEGORIES [ROW %d]:', 'geodirectory');
|
|
| 3794 | 3794 | |
| 3795 | - for ($i = 1; $i <= $limit; $i++) {
|
|
| 3796 | - $index = $processed + $i; |
|
| 3795 | + for ($i = 1; $i <= $limit; $i++) {
|
|
| 3796 | + $index = $processed + $i; |
|
| 3797 | 3797 | |
| 3798 | - if (isset($file[$index])) {
|
|
| 3799 | - $row = $file[$index]; |
|
| 3800 | - $row = array_map( 'trim', $row ); |
|
| 3801 | - //$row = array_map( 'utf8_encode', $row ); |
|
| 3798 | + if (isset($file[$index])) {
|
|
| 3799 | + $row = $file[$index]; |
|
| 3800 | + $row = array_map( 'trim', $row ); |
|
| 3801 | + //$row = array_map( 'utf8_encode', $row ); |
|
| 3802 | 3802 | |
| 3803 | - $cat_id = ''; |
|
| 3804 | - $cat_name = ''; |
|
| 3805 | - $cat_slug = ''; |
|
| 3806 | - $cat_posttype = ''; |
|
| 3807 | - $cat_parent = ''; |
|
| 3808 | - $cat_description = ''; |
|
| 3809 | - $cat_schema = ''; |
|
| 3810 | - $cat_top_description = ''; |
|
| 3811 | - $cat_image = ''; |
|
| 3812 | - $cat_icon = ''; |
|
| 3813 | - $cat_language = ''; |
|
| 3814 | - $cat_id_original = ''; |
|
| 3803 | + $cat_id = ''; |
|
| 3804 | + $cat_name = ''; |
|
| 3805 | + $cat_slug = ''; |
|
| 3806 | + $cat_posttype = ''; |
|
| 3807 | + $cat_parent = ''; |
|
| 3808 | + $cat_description = ''; |
|
| 3809 | + $cat_schema = ''; |
|
| 3810 | + $cat_top_description = ''; |
|
| 3811 | + $cat_image = ''; |
|
| 3812 | + $cat_icon = ''; |
|
| 3813 | + $cat_language = ''; |
|
| 3814 | + $cat_id_original = ''; |
|
| 3815 | 3815 | |
| 3816 | - $c = 0; |
|
| 3817 | - foreach ($columns as $column ) {
|
|
| 3818 | - if ( $column == 'cat_id' ) {
|
|
| 3819 | - $cat_id = (int)$row[$c]; |
|
| 3820 | - } else if ( $column == 'cat_name' ) {
|
|
| 3821 | - $cat_name = $row[$c]; |
|
| 3822 | - } else if ( $column == 'cat_slug' ) {
|
|
| 3823 | - $cat_slug = $row[$c]; |
|
| 3824 | - } else if ( $column == 'cat_posttype' ) {
|
|
| 3825 | - $cat_posttype = $row[$c]; |
|
| 3826 | - } else if ( $column == 'cat_parent' ) {
|
|
| 3827 | - $cat_parent = trim($row[$c]); |
|
| 3828 | - } else if ( $column == 'cat_schema' && $row[$c] != '' ) {
|
|
| 3829 | - $cat_schema = $row[$c]; |
|
| 3830 | - } else if ( $column == 'cat_description' ) {
|
|
| 3831 | - $cat_description = $row[$c]; |
|
| 3832 | - } else if ( $column == 'cat_top_description' ) {
|
|
| 3833 | - $cat_top_description = $row[$c]; |
|
| 3834 | - } else if ( $column == 'cat_image' ) {
|
|
| 3835 | - $cat_image = $row[$c]; |
|
| 3836 | - } else if ( $column == 'cat_icon' ) {
|
|
| 3837 | - $cat_icon = $row[$c]; |
|
| 3838 | - } |
|
| 3839 | - // WPML |
|
| 3840 | - if ( $is_wpml ) {
|
|
| 3841 | - if ( $column == 'cat_language' ) {
|
|
| 3842 | - $cat_language = geodir_strtolower( trim( $row[$c] ) ); |
|
| 3843 | - } else if ( $column == 'cat_id_original' ) {
|
|
| 3844 | - $cat_id_original = (int)$row[$c]; |
|
| 3845 | - } |
|
| 3846 | - } |
|
| 3847 | - // WPML |
|
| 3848 | - $c++; |
|
| 3849 | - } |
|
| 3816 | + $c = 0; |
|
| 3817 | + foreach ($columns as $column ) {
|
|
| 3818 | + if ( $column == 'cat_id' ) {
|
|
| 3819 | + $cat_id = (int)$row[$c]; |
|
| 3820 | + } else if ( $column == 'cat_name' ) {
|
|
| 3821 | + $cat_name = $row[$c]; |
|
| 3822 | + } else if ( $column == 'cat_slug' ) {
|
|
| 3823 | + $cat_slug = $row[$c]; |
|
| 3824 | + } else if ( $column == 'cat_posttype' ) {
|
|
| 3825 | + $cat_posttype = $row[$c]; |
|
| 3826 | + } else if ( $column == 'cat_parent' ) {
|
|
| 3827 | + $cat_parent = trim($row[$c]); |
|
| 3828 | + } else if ( $column == 'cat_schema' && $row[$c] != '' ) {
|
|
| 3829 | + $cat_schema = $row[$c]; |
|
| 3830 | + } else if ( $column == 'cat_description' ) {
|
|
| 3831 | + $cat_description = $row[$c]; |
|
| 3832 | + } else if ( $column == 'cat_top_description' ) {
|
|
| 3833 | + $cat_top_description = $row[$c]; |
|
| 3834 | + } else if ( $column == 'cat_image' ) {
|
|
| 3835 | + $cat_image = $row[$c]; |
|
| 3836 | + } else if ( $column == 'cat_icon' ) {
|
|
| 3837 | + $cat_icon = $row[$c]; |
|
| 3838 | + } |
|
| 3839 | + // WPML |
|
| 3840 | + if ( $is_wpml ) {
|
|
| 3841 | + if ( $column == 'cat_language' ) {
|
|
| 3842 | + $cat_language = geodir_strtolower( trim( $row[$c] ) ); |
|
| 3843 | + } else if ( $column == 'cat_id_original' ) {
|
|
| 3844 | + $cat_id_original = (int)$row[$c]; |
|
| 3845 | + } |
|
| 3846 | + } |
|
| 3847 | + // WPML |
|
| 3848 | + $c++; |
|
| 3849 | + } |
|
| 3850 | 3850 | |
| 3851 | - if ( $cat_name == '' || !in_array( $cat_posttype, $post_types ) ) {
|
|
| 3852 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) ); |
|
| 3851 | + if ( $cat_name == '' || !in_array( $cat_posttype, $post_types ) ) {
|
|
| 3852 | + geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) ); |
|
| 3853 | 3853 | |
| 3854 | - $invalid++; |
|
| 3855 | - continue; |
|
| 3856 | - } |
|
| 3854 | + $invalid++; |
|
| 3855 | + continue; |
|
| 3856 | + } |
|
| 3857 | 3857 | |
| 3858 | - // WPML |
|
| 3859 | - if ($is_wpml && $cat_language != '') {
|
|
| 3860 | - $sitepress->switch_lang($cat_language, true); |
|
| 3861 | - } |
|
| 3862 | - // WPML |
|
| 3858 | + // WPML |
|
| 3859 | + if ($is_wpml && $cat_language != '') {
|
|
| 3860 | + $sitepress->switch_lang($cat_language, true); |
|
| 3861 | + } |
|
| 3862 | + // WPML |
|
| 3863 | 3863 | |
| 3864 | - $term_data = array(); |
|
| 3865 | - $term_data['name'] = $cat_name; |
|
| 3866 | - $term_data['slug'] = $cat_slug; |
|
| 3867 | - $term_data['description'] = $cat_description; |
|
| 3868 | - $term_data['cat_schema'] = $cat_schema; |
|
| 3869 | - $term_data['top_description'] = $cat_top_description; |
|
| 3870 | - $term_data['image'] = $cat_image != '' ? basename( $cat_image ) : ''; |
|
| 3871 | - $term_data['icon'] = $cat_icon != '' ? basename( $cat_icon ) : ''; |
|
| 3864 | + $term_data = array(); |
|
| 3865 | + $term_data['name'] = $cat_name; |
|
| 3866 | + $term_data['slug'] = $cat_slug; |
|
| 3867 | + $term_data['description'] = $cat_description; |
|
| 3868 | + $term_data['cat_schema'] = $cat_schema; |
|
| 3869 | + $term_data['top_description'] = $cat_top_description; |
|
| 3870 | + $term_data['image'] = $cat_image != '' ? basename( $cat_image ) : ''; |
|
| 3871 | + $term_data['icon'] = $cat_icon != '' ? basename( $cat_icon ) : ''; |
|
| 3872 | 3872 | |
| 3873 | - //$term_data = array_map( 'utf8_encode', $term_data ); |
|
| 3873 | + //$term_data = array_map( 'utf8_encode', $term_data ); |
|
| 3874 | 3874 | |
| 3875 | - $taxonomy = $cat_posttype . 'category'; |
|
| 3875 | + $taxonomy = $cat_posttype . 'category'; |
|
| 3876 | 3876 | |
| 3877 | - $term_data['taxonomy'] = $taxonomy; |
|
| 3877 | + $term_data['taxonomy'] = $taxonomy; |
|
| 3878 | 3878 | |
| 3879 | - $term_parent_id = 0; |
|
| 3880 | - if ($cat_parent != "" || (int)$cat_parent > 0) {
|
|
| 3881 | - $term_parent = ''; |
|
| 3879 | + $term_parent_id = 0; |
|
| 3880 | + if ($cat_parent != "" || (int)$cat_parent > 0) {
|
|
| 3881 | + $term_parent = ''; |
|
| 3882 | 3882 | |
| 3883 | - if ( $term_parent = get_term_by( 'name', $cat_parent, $taxonomy ) ) {
|
|
| 3884 | - // |
|
| 3885 | - } else if ( $term_parent = get_term_by( 'slug', $cat_parent, $taxonomy ) ) {
|
|
| 3886 | - // |
|
| 3887 | - } else if ( $term_parent = get_term_by( 'id', $cat_parent, $taxonomy ) ) {
|
|
| 3888 | - // |
|
| 3889 | - } else {
|
|
| 3890 | - $term_parent_data = array(); |
|
| 3891 | - $term_parent_data['name'] = $cat_parent; |
|
| 3892 | - //$term_parent_data = array_map( 'utf8_encode', $term_parent_data ); |
|
| 3893 | - $term_parent_data['taxonomy'] = $taxonomy; |
|
| 3883 | + if ( $term_parent = get_term_by( 'name', $cat_parent, $taxonomy ) ) {
|
|
| 3884 | + // |
|
| 3885 | + } else if ( $term_parent = get_term_by( 'slug', $cat_parent, $taxonomy ) ) {
|
|
| 3886 | + // |
|
| 3887 | + } else if ( $term_parent = get_term_by( 'id', $cat_parent, $taxonomy ) ) {
|
|
| 3888 | + // |
|
| 3889 | + } else {
|
|
| 3890 | + $term_parent_data = array(); |
|
| 3891 | + $term_parent_data['name'] = $cat_parent; |
|
| 3892 | + //$term_parent_data = array_map( 'utf8_encode', $term_parent_data ); |
|
| 3893 | + $term_parent_data['taxonomy'] = $taxonomy; |
|
| 3894 | 3894 | |
| 3895 | - $term_parent_id = (int)geodir_imex_insert_term( $taxonomy, $term_parent_data ); |
|
| 3896 | - } |
|
| 3895 | + $term_parent_id = (int)geodir_imex_insert_term( $taxonomy, $term_parent_data ); |
|
| 3896 | + } |
|
| 3897 | 3897 | |
| 3898 | - if ( !empty( $term_parent ) && !is_wp_error( $term_parent ) ) {
|
|
| 3899 | - $term_parent_id = (int)$term_parent->term_id; |
|
| 3900 | - } |
|
| 3901 | - } |
|
| 3902 | - $term_data['parent'] = (int)$term_parent_id; |
|
| 3898 | + if ( !empty( $term_parent ) && !is_wp_error( $term_parent ) ) {
|
|
| 3899 | + $term_parent_id = (int)$term_parent->term_id; |
|
| 3900 | + } |
|
| 3901 | + } |
|
| 3902 | + $term_data['parent'] = (int)$term_parent_id; |
|
| 3903 | 3903 | |
| 3904 | - $term_id = NULL; |
|
| 3905 | - if ( $import_choice == 'update' ) {
|
|
| 3906 | - if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
|
|
| 3907 | - $term_data['term_id'] = $term['term_id']; |
|
| 3904 | + $term_id = NULL; |
|
| 3905 | + if ( $import_choice == 'update' ) {
|
|
| 3906 | + if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
|
|
| 3907 | + $term_data['term_id'] = $term['term_id']; |
|
| 3908 | 3908 | |
| 3909 | - if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
|
|
| 3910 | - $updated++; |
|
| 3911 | - } else {
|
|
| 3912 | - $invalid++; |
|
| 3913 | - 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' ) ); |
|
| 3914 | - } |
|
| 3915 | - } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
|
|
| 3916 | - $term_data['term_id'] = $term['term_id']; |
|
| 3909 | + if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
|
|
| 3910 | + $updated++; |
|
| 3911 | + } else {
|
|
| 3912 | + $invalid++; |
|
| 3913 | + 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' ) ); |
|
| 3914 | + } |
|
| 3915 | + } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
|
|
| 3916 | + $term_data['term_id'] = $term['term_id']; |
|
| 3917 | 3917 | |
| 3918 | - if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
|
|
| 3919 | - $updated++; |
|
| 3920 | - } else {
|
|
| 3921 | - $invalid++; |
|
| 3922 | - 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' ) ); |
|
| 3923 | - } |
|
| 3924 | - } else {
|
|
| 3925 | - if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
|
|
| 3926 | - $created++; |
|
| 3927 | - } else {
|
|
| 3928 | - $invalid++; |
|
| 3929 | - 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' ) ); |
|
| 3930 | - } |
|
| 3931 | - } |
|
| 3932 | - } else if ( $import_choice == 'skip' ) {
|
|
| 3933 | - if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
|
|
| 3934 | - $skipped++; |
|
| 3935 | - } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
|
|
| 3936 | - $skipped++; |
|
| 3937 | - } else {
|
|
| 3938 | - if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
|
|
| 3939 | - $created++; |
|
| 3940 | - } else {
|
|
| 3941 | - $invalid++; |
|
| 3942 | - 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' ) ); |
|
| 3943 | - } |
|
| 3944 | - } |
|
| 3945 | - } else {
|
|
| 3946 | - $invalid++; |
|
| 3947 | - 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' ) ); |
|
| 3948 | - } |
|
| 3918 | + if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
|
|
| 3919 | + $updated++; |
|
| 3920 | + } else {
|
|
| 3921 | + $invalid++; |
|
| 3922 | + 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' ) ); |
|
| 3923 | + } |
|
| 3924 | + } else {
|
|
| 3925 | + if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
|
|
| 3926 | + $created++; |
|
| 3927 | + } else {
|
|
| 3928 | + $invalid++; |
|
| 3929 | + 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' ) ); |
|
| 3930 | + } |
|
| 3931 | + } |
|
| 3932 | + } else if ( $import_choice == 'skip' ) {
|
|
| 3933 | + if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
|
|
| 3934 | + $skipped++; |
|
| 3935 | + } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
|
|
| 3936 | + $skipped++; |
|
| 3937 | + } else {
|
|
| 3938 | + if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
|
|
| 3939 | + $created++; |
|
| 3940 | + } else {
|
|
| 3941 | + $invalid++; |
|
| 3942 | + 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' ) ); |
|
| 3943 | + } |
|
| 3944 | + } |
|
| 3945 | + } else {
|
|
| 3946 | + $invalid++; |
|
| 3947 | + 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' ) ); |
|
| 3948 | + } |
|
| 3949 | 3949 | |
| 3950 | - if ( $term_id ) {
|
|
| 3951 | - // WPML |
|
| 3952 | - if ($is_wpml && $cat_id_original > 0 && $cat_language != '') {
|
|
| 3953 | - $wpml_element_type = 'tax_' . $taxonomy; |
|
| 3954 | - $source_language = geodir_get_language_for_element( $cat_id_original, $wpml_element_type ); |
|
| 3955 | - $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language(); |
|
| 3956 | - |
|
| 3957 | - $trid = $sitepress->get_element_trid( $cat_id_original, $wpml_element_type ); |
|
| 3950 | + if ( $term_id ) {
|
|
| 3951 | + // WPML |
|
| 3952 | + if ($is_wpml && $cat_id_original > 0 && $cat_language != '') {
|
|
| 3953 | + $wpml_element_type = 'tax_' . $taxonomy; |
|
| 3954 | + $source_language = geodir_get_language_for_element( $cat_id_original, $wpml_element_type ); |
|
| 3955 | + $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language(); |
|
| 3956 | + |
|
| 3957 | + $trid = $sitepress->get_element_trid( $cat_id_original, $wpml_element_type ); |
|
| 3958 | 3958 | |
| 3959 | - $sitepress->set_element_language_details( $term_id, $wpml_element_type, $trid, $cat_language, $source_language ); |
|
| 3960 | - } |
|
| 3961 | - // WPML |
|
| 3959 | + $sitepress->set_element_language_details( $term_id, $wpml_element_type, $trid, $cat_language, $source_language ); |
|
| 3960 | + } |
|
| 3961 | + // WPML |
|
| 3962 | 3962 | |
| 3963 | - if ( isset( $term_data['top_description'] ) ) {
|
|
| 3964 | - update_tax_meta( $term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype ); |
|
| 3965 | - } |
|
| 3963 | + if ( isset( $term_data['top_description'] ) ) {
|
|
| 3964 | + update_tax_meta( $term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype ); |
|
| 3965 | + } |
|
| 3966 | 3966 | |
| 3967 | - if ( isset( $term_data['cat_schema'] ) ) {
|
|
| 3968 | - update_tax_meta( $term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype ); |
|
| 3969 | - } |
|
| 3967 | + if ( isset( $term_data['cat_schema'] ) ) {
|
|
| 3968 | + update_tax_meta( $term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype ); |
|
| 3969 | + } |
|
| 3970 | 3970 | |
| 3971 | - $attachment = false; |
|
| 3972 | - if ( isset( $term_data['image'] ) && $term_data['image'] != '' ) {
|
|
| 3973 | - $cat_image = geodir_get_default_catimage( $term_id, $cat_posttype ); |
|
| 3974 | - $cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : ''; |
|
| 3971 | + $attachment = false; |
|
| 3972 | + if ( isset( $term_data['image'] ) && $term_data['image'] != '' ) {
|
|
| 3973 | + $cat_image = geodir_get_default_catimage( $term_id, $cat_posttype ); |
|
| 3974 | + $cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : ''; |
|
| 3975 | 3975 | |
| 3976 | - if ( basename($cat_image) != $term_data['image'] ) {
|
|
| 3977 | - $attachment = true; |
|
| 3978 | - update_tax_meta( $term_id, 'ct_cat_default_img', array( 'id' => 'image', 'src' => $uploads['url'] . '/' . $term_data['image'] ), $cat_posttype ); |
|
| 3979 | - } |
|
| 3980 | - } |
|
| 3976 | + if ( basename($cat_image) != $term_data['image'] ) {
|
|
| 3977 | + $attachment = true; |
|
| 3978 | + update_tax_meta( $term_id, 'ct_cat_default_img', array( 'id' => 'image', 'src' => $uploads['url'] . '/' . $term_data['image'] ), $cat_posttype ); |
|
| 3979 | + } |
|
| 3980 | + } |
|
| 3981 | 3981 | |
| 3982 | - if ( isset( $term_data['icon'] ) && $term_data['icon'] != '' ) {
|
|
| 3983 | - $cat_icon = get_tax_meta( $term_id, 'ct_cat_icon', false, $cat_posttype ); |
|
| 3984 | - $cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : ''; |
|
| 3982 | + if ( isset( $term_data['icon'] ) && $term_data['icon'] != '' ) {
|
|
| 3983 | + $cat_icon = get_tax_meta( $term_id, 'ct_cat_icon', false, $cat_posttype ); |
|
| 3984 | + $cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : ''; |
|
| 3985 | 3985 | |
| 3986 | - if ( basename($cat_icon) != $term_data['icon'] ) {
|
|
| 3987 | - $attachment = true; |
|
| 3988 | - update_tax_meta( $term_id, 'ct_cat_icon', array( 'id' => 'icon', 'src' => $uploads['url'] . '/' . $term_data['icon'] ), $cat_posttype ); |
|
| 3989 | - } |
|
| 3990 | - } |
|
| 3986 | + if ( basename($cat_icon) != $term_data['icon'] ) {
|
|
| 3987 | + $attachment = true; |
|
| 3988 | + update_tax_meta( $term_id, 'ct_cat_icon', array( 'id' => 'icon', 'src' => $uploads['url'] . '/' . $term_data['icon'] ), $cat_posttype ); |
|
| 3989 | + } |
|
| 3990 | + } |
|
| 3991 | 3991 | |
| 3992 | - if ( $attachment ) {
|
|
| 3993 | - $images++; |
|
| 3994 | - } |
|
| 3995 | - } |
|
| 3992 | + if ( $attachment ) {
|
|
| 3993 | + $images++; |
|
| 3994 | + } |
|
| 3995 | + } |
|
| 3996 | 3996 | |
| 3997 | - // WPML |
|
| 3998 | - if ($is_wpml && $cat_language != '') {
|
|
| 3999 | - $sitepress->switch_lang($active_lang, true); |
|
| 4000 | - } |
|
| 4001 | - // WPML |
|
| 4002 | - } |
|
| 4003 | - } |
|
| 4004 | - } |
|
| 3997 | + // WPML |
|
| 3998 | + if ($is_wpml && $cat_language != '') {
|
|
| 3999 | + $sitepress->switch_lang($active_lang, true); |
|
| 4000 | + } |
|
| 4001 | + // WPML |
|
| 4002 | + } |
|
| 4003 | + } |
|
| 4004 | + } |
|
| 4005 | 4005 | |
| 4006 | - $json = array(); |
|
| 4007 | - $json['processed'] = $limit; |
|
| 4008 | - $json['created'] = $created; |
|
| 4009 | - $json['updated'] = $updated; |
|
| 4010 | - $json['skipped'] = $skipped; |
|
| 4011 | - $json['invalid'] = $invalid; |
|
| 4012 | - $json['images'] = $images; |
|
| 4006 | + $json = array(); |
|
| 4007 | + $json['processed'] = $limit; |
|
| 4008 | + $json['created'] = $created; |
|
| 4009 | + $json['updated'] = $updated; |
|
| 4010 | + $json['skipped'] = $skipped; |
|
| 4011 | + $json['invalid'] = $invalid; |
|
| 4012 | + $json['images'] = $images; |
|
| 4013 | 4013 | |
| 4014 | - wp_send_json( $json ); |
|
| 4015 | - exit; |
|
| 4016 | - } else if ( $task == 'import_post' ) {
|
|
| 4017 | - //run some stuff to make the import quicker |
|
| 4018 | - wp_defer_term_counting( true ); |
|
| 4019 | - wp_defer_comment_counting( true ); |
|
| 4020 | - $wpdb->query( 'SET autocommit = 0;' ); |
|
| 4021 | - |
|
| 4022 | - //remove_all_actions('publish_post');
|
|
| 4023 | - //remove_all_actions('transition_post_status');
|
|
| 4024 | - //remove_all_actions('publish_future_post');
|
|
| 4025 | - |
|
| 4026 | - if (!empty($file)) {
|
|
| 4027 | - $is_claim_active = is_plugin_active( 'geodir_claim_listing/geodir_claim_listing.php' ) && get_option('geodir_claim_enable') === 'yes' ? true : false;
|
|
| 4028 | - $wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses. |
|
| 4029 | - $default_status = 'publish'; |
|
| 4030 | - $current_date = date_i18n( 'Y-m-d', time() ); |
|
| 4014 | + wp_send_json( $json ); |
|
| 4015 | + exit; |
|
| 4016 | + } else if ( $task == 'import_post' ) {
|
|
| 4017 | + //run some stuff to make the import quicker |
|
| 4018 | + wp_defer_term_counting( true ); |
|
| 4019 | + wp_defer_comment_counting( true ); |
|
| 4020 | + $wpdb->query( 'SET autocommit = 0;' ); |
|
| 4021 | + |
|
| 4022 | + //remove_all_actions('publish_post');
|
|
| 4023 | + //remove_all_actions('transition_post_status');
|
|
| 4024 | + //remove_all_actions('publish_future_post');
|
|
| 4025 | + |
|
| 4026 | + if (!empty($file)) {
|
|
| 4027 | + $is_claim_active = is_plugin_active( 'geodir_claim_listing/geodir_claim_listing.php' ) && get_option('geodir_claim_enable') === 'yes' ? true : false;
|
|
| 4028 | + $wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses. |
|
| 4029 | + $default_status = 'publish'; |
|
| 4030 | + $current_date = date_i18n( 'Y-m-d', time() ); |
|
| 4031 | 4031 | |
| 4032 | - $columns = isset($file[0]) ? $file[0] : NULL; |
|
| 4032 | + $columns = isset($file[0]) ? $file[0] : NULL; |
|
| 4033 | 4033 | |
| 4034 | - if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
|
|
| 4035 | - $json['error'] = CSV_INVAILD_FILE; |
|
| 4036 | - wp_send_json( $json ); |
|
| 4037 | - exit; |
|
| 4038 | - } |
|
| 4034 | + if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
|
|
| 4035 | + $json['error'] = CSV_INVAILD_FILE; |
|
| 4036 | + wp_send_json( $json ); |
|
| 4037 | + exit; |
|
| 4038 | + } |
|
| 4039 | 4039 | |
| 4040 | - $gd_error_log = __('GD IMPORT LISTINGS [ROW %d]:', 'geodirectory');
|
|
| 4041 | - $wp_chars_error = __( '(check & remove if any invalid characters used in data)', 'geodirectory' ); |
|
| 4042 | - $processed_actual = 0; |
|
| 4043 | - for ($i = 1; $i <= $limit; $i++) {
|
|
| 4044 | - $index = $processed + $i; |
|
| 4045 | - $gd_post = array(); |
|
| 4040 | + $gd_error_log = __('GD IMPORT LISTINGS [ROW %d]:', 'geodirectory');
|
|
| 4041 | + $wp_chars_error = __( '(check & remove if any invalid characters used in data)', 'geodirectory' ); |
|
| 4042 | + $processed_actual = 0; |
|
| 4043 | + for ($i = 1; $i <= $limit; $i++) {
|
|
| 4044 | + $index = $processed + $i; |
|
| 4045 | + $gd_post = array(); |
|
| 4046 | 4046 | |
| 4047 | - if (isset($file[$index])) {
|
|
| 4048 | - $processed_actual++; |
|
| 4049 | - $row = $file[$index]; |
|
| 4050 | - $row = array_map( 'trim', $row ); |
|
| 4051 | - //$row = array_map( 'utf8_encode', $row ); |
|
| 4052 | - $row = array_map( 'addslashes_gpc', $row ); |
|
| 4047 | + if (isset($file[$index])) {
|
|
| 4048 | + $processed_actual++; |
|
| 4049 | + $row = $file[$index]; |
|
| 4050 | + $row = array_map( 'trim', $row ); |
|
| 4051 | + //$row = array_map( 'utf8_encode', $row ); |
|
| 4052 | + $row = array_map( 'addslashes_gpc', $row ); |
|
| 4053 | 4053 | |
| 4054 | - $post_id = ''; |
|
| 4055 | - $post_title = ''; |
|
| 4056 | - $post_author = ''; |
|
| 4057 | - $post_content = ''; |
|
| 4058 | - $post_category_arr = array(); |
|
| 4059 | - $default_category = ''; |
|
| 4060 | - $post_tags = array(); |
|
| 4061 | - $post_type = ''; |
|
| 4062 | - $post_status = ''; |
|
| 4063 | - $geodir_video = ''; |
|
| 4064 | - $post_address = ''; |
|
| 4065 | - $post_city = ''; |
|
| 4066 | - $post_region = ''; |
|
| 4067 | - $post_country = ''; |
|
| 4068 | - $post_zip = ''; |
|
| 4069 | - $post_latitude = ''; |
|
| 4070 | - $post_longitude = ''; |
|
| 4071 | - $post_neighbourhood = ''; |
|
| 4072 | - $neighbourhood_latitude = ''; |
|
| 4073 | - $neighbourhood_longitude = ''; |
|
| 4074 | - $geodir_timing = ''; |
|
| 4075 | - $geodir_contact = ''; |
|
| 4076 | - $geodir_email = ''; |
|
| 4077 | - $geodir_website = ''; |
|
| 4078 | - $geodir_twitter = ''; |
|
| 4079 | - $geodir_facebook = ''; |
|
| 4080 | - $geodir_twitter = ''; |
|
| 4081 | - $post_images = array(); |
|
| 4054 | + $post_id = ''; |
|
| 4055 | + $post_title = ''; |
|
| 4056 | + $post_author = ''; |
|
| 4057 | + $post_content = ''; |
|
| 4058 | + $post_category_arr = array(); |
|
| 4059 | + $default_category = ''; |
|
| 4060 | + $post_tags = array(); |
|
| 4061 | + $post_type = ''; |
|
| 4062 | + $post_status = ''; |
|
| 4063 | + $geodir_video = ''; |
|
| 4064 | + $post_address = ''; |
|
| 4065 | + $post_city = ''; |
|
| 4066 | + $post_region = ''; |
|
| 4067 | + $post_country = ''; |
|
| 4068 | + $post_zip = ''; |
|
| 4069 | + $post_latitude = ''; |
|
| 4070 | + $post_longitude = ''; |
|
| 4071 | + $post_neighbourhood = ''; |
|
| 4072 | + $neighbourhood_latitude = ''; |
|
| 4073 | + $neighbourhood_longitude = ''; |
|
| 4074 | + $geodir_timing = ''; |
|
| 4075 | + $geodir_contact = ''; |
|
| 4076 | + $geodir_email = ''; |
|
| 4077 | + $geodir_website = ''; |
|
| 4078 | + $geodir_twitter = ''; |
|
| 4079 | + $geodir_facebook = ''; |
|
| 4080 | + $geodir_twitter = ''; |
|
| 4081 | + $post_images = array(); |
|
| 4082 | 4082 | |
| 4083 | - $expire_date = 'Never'; |
|
| 4083 | + $expire_date = 'Never'; |
|
| 4084 | 4084 | |
| 4085 | - $language = ''; |
|
| 4086 | - $original_post_id = ''; |
|
| 4085 | + $language = ''; |
|
| 4086 | + $original_post_id = ''; |
|
| 4087 | 4087 | |
| 4088 | - $c = 0; |
|
| 4089 | - foreach ($columns as $column ) {
|
|
| 4090 | - $gd_post[$column] = $row[$c]; |
|
| 4088 | + $c = 0; |
|
| 4089 | + foreach ($columns as $column ) {
|
|
| 4090 | + $gd_post[$column] = $row[$c]; |
|
| 4091 | 4091 | |
| 4092 | - if ( $column == 'post_id' ) {
|
|
| 4093 | - $post_id = $row[$c]; |
|
| 4094 | - } else if ( $column == 'post_title' ) {
|
|
| 4095 | - $post_title = sanitize_text_field($row[$c]); |
|
| 4096 | - } else if ( $column == 'post_author' ) {
|
|
| 4097 | - $post_author = $row[$c]; |
|
| 4098 | - } else if ( $column == 'post_content' ) {
|
|
| 4099 | - $post_content = $row[$c]; |
|
| 4100 | - } else if ( $column == 'post_category' && $row[$c] != '' ) {
|
|
| 4101 | - $post_category_arr = explode( ',', $row[$c] ); |
|
| 4102 | - } else if ( $column == 'default_category' ) {
|
|
| 4103 | - $default_category = wp_kses_normalize_entities($row[$c]); |
|
| 4104 | - } else if ( $column == 'post_tags' && $row[$c] != '' ) {
|
|
| 4105 | - $post_tags = explode( ',', sanitize_text_field($row[$c]) ); |
|
| 4106 | - } else if ( $column == 'post_type' ) {
|
|
| 4107 | - $post_type = $row[$c]; |
|
| 4108 | - } else if ( $column == 'post_status' ) {
|
|
| 4109 | - $post_status = sanitize_key( $row[$c] ); |
|
| 4110 | - } else if ( $column == 'is_featured' ) {
|
|
| 4111 | - $is_featured = (int)$row[$c]; |
|
| 4112 | - } else if ( $column == 'geodir_video' ) {
|
|
| 4113 | - $geodir_video = $row[$c]; |
|
| 4114 | - } else if ( $column == 'post_address' ) {
|
|
| 4115 | - $post_address = sanitize_text_field($row[$c]); |
|
| 4116 | - } else if ( $column == 'post_city' ) {
|
|
| 4117 | - $post_city = sanitize_text_field($row[$c]); |
|
| 4118 | - } else if ( $column == 'post_region' ) {
|
|
| 4119 | - $post_region = sanitize_text_field($row[$c]); |
|
| 4120 | - } else if ( $column == 'post_country' ) {
|
|
| 4121 | - $post_country = sanitize_text_field($row[$c]); |
|
| 4122 | - } else if ( $column == 'post_zip' ) {
|
|
| 4123 | - $post_zip = sanitize_text_field($row[$c]); |
|
| 4124 | - } else if ( $column == 'post_latitude' ) {
|
|
| 4125 | - $post_latitude = sanitize_text_field($row[$c]); |
|
| 4126 | - } else if ( $column == 'post_longitude' ) {
|
|
| 4127 | - $post_longitude = sanitize_text_field($row[$c]); |
|
| 4128 | - } else if ( $column == 'post_neighbourhood' ) {
|
|
| 4129 | - $post_neighbourhood = sanitize_text_field($row[$c]); |
|
| 4130 | - unset($gd_post[$column]); |
|
| 4131 | - } else if ( $column == 'neighbourhood_latitude' ) {
|
|
| 4132 | - $neighbourhood_latitude = sanitize_text_field($row[$c]); |
|
| 4133 | - } else if ( $column == 'neighbourhood_longitude' ) {
|
|
| 4134 | - $neighbourhood_longitude = sanitize_text_field($row[$c]); |
|
| 4135 | - } else if ( $column == 'geodir_timing' ) {
|
|
| 4136 | - $geodir_timing = sanitize_text_field($row[$c]); |
|
| 4137 | - } else if ( $column == 'geodir_contact' ) {
|
|
| 4138 | - $geodir_contact = sanitize_text_field($row[$c]); |
|
| 4139 | - } else if ( $column == 'geodir_email' ) {
|
|
| 4140 | - $geodir_email = sanitize_email($row[$c]); |
|
| 4141 | - } else if ( $column == 'geodir_website' ) {
|
|
| 4142 | - $geodir_website = sanitize_text_field($row[$c]); |
|
| 4143 | - } else if ( $column == 'geodir_twitter' ) {
|
|
| 4144 | - $geodir_twitter = sanitize_text_field($row[$c]); |
|
| 4145 | - } else if ( $column == 'geodir_facebook' ) {
|
|
| 4146 | - $geodir_facebook = sanitize_text_field($row[$c]); |
|
| 4147 | - } else if ( $column == 'IMAGE' && !empty( $row[$c] ) && $row[$c] != '' ) {
|
|
| 4148 | - $post_images[] = $row[$c]; |
|
| 4149 | - } else if ( $column == 'alive_days' && (int)$row[$c] > 0 ) {
|
|
| 4150 | - $expire_date = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$row[$c] . ' days' ) ); |
|
| 4151 | - } else if ( $column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never' ) {
|
|
| 4152 | - $row[$c] = str_replace('/', '-', $row[$c]);
|
|
| 4153 | - $expire_date = date_i18n( 'Y-m-d', strtotime( $row[$c] ) ); |
|
| 4154 | - } |
|
| 4155 | - // WPML |
|
| 4156 | - if ($is_wpml) {
|
|
| 4157 | - if ($column == 'language') {
|
|
| 4158 | - $language = geodir_strtolower(trim($row[$c])); |
|
| 4159 | - } else if ($column == 'original_post_id') {
|
|
| 4160 | - $original_post_id = (int)$row[$c]; |
|
| 4161 | - } |
|
| 4162 | - } |
|
| 4163 | - // WPML |
|
| 4164 | - $c++; |
|
| 4165 | - } |
|
| 4166 | - // listing claimed or not |
|
| 4167 | - if ($is_claim_active && isset($gd_post['claimed'])) {
|
|
| 4168 | - $gd_post['claimed'] = (int)$gd_post['claimed'] == 1 ? 1 : 0; |
|
| 4169 | - } |
|
| 4092 | + if ( $column == 'post_id' ) {
|
|
| 4093 | + $post_id = $row[$c]; |
|
| 4094 | + } else if ( $column == 'post_title' ) {
|
|
| 4095 | + $post_title = sanitize_text_field($row[$c]); |
|
| 4096 | + } else if ( $column == 'post_author' ) {
|
|
| 4097 | + $post_author = $row[$c]; |
|
| 4098 | + } else if ( $column == 'post_content' ) {
|
|
| 4099 | + $post_content = $row[$c]; |
|
| 4100 | + } else if ( $column == 'post_category' && $row[$c] != '' ) {
|
|
| 4101 | + $post_category_arr = explode( ',', $row[$c] ); |
|
| 4102 | + } else if ( $column == 'default_category' ) {
|
|
| 4103 | + $default_category = wp_kses_normalize_entities($row[$c]); |
|
| 4104 | + } else if ( $column == 'post_tags' && $row[$c] != '' ) {
|
|
| 4105 | + $post_tags = explode( ',', sanitize_text_field($row[$c]) ); |
|
| 4106 | + } else if ( $column == 'post_type' ) {
|
|
| 4107 | + $post_type = $row[$c]; |
|
| 4108 | + } else if ( $column == 'post_status' ) {
|
|
| 4109 | + $post_status = sanitize_key( $row[$c] ); |
|
| 4110 | + } else if ( $column == 'is_featured' ) {
|
|
| 4111 | + $is_featured = (int)$row[$c]; |
|
| 4112 | + } else if ( $column == 'geodir_video' ) {
|
|
| 4113 | + $geodir_video = $row[$c]; |
|
| 4114 | + } else if ( $column == 'post_address' ) {
|
|
| 4115 | + $post_address = sanitize_text_field($row[$c]); |
|
| 4116 | + } else if ( $column == 'post_city' ) {
|
|
| 4117 | + $post_city = sanitize_text_field($row[$c]); |
|
| 4118 | + } else if ( $column == 'post_region' ) {
|
|
| 4119 | + $post_region = sanitize_text_field($row[$c]); |
|
| 4120 | + } else if ( $column == 'post_country' ) {
|
|
| 4121 | + $post_country = sanitize_text_field($row[$c]); |
|
| 4122 | + } else if ( $column == 'post_zip' ) {
|
|
| 4123 | + $post_zip = sanitize_text_field($row[$c]); |
|
| 4124 | + } else if ( $column == 'post_latitude' ) {
|
|
| 4125 | + $post_latitude = sanitize_text_field($row[$c]); |
|
| 4126 | + } else if ( $column == 'post_longitude' ) {
|
|
| 4127 | + $post_longitude = sanitize_text_field($row[$c]); |
|
| 4128 | + } else if ( $column == 'post_neighbourhood' ) {
|
|
| 4129 | + $post_neighbourhood = sanitize_text_field($row[$c]); |
|
| 4130 | + unset($gd_post[$column]); |
|
| 4131 | + } else if ( $column == 'neighbourhood_latitude' ) {
|
|
| 4132 | + $neighbourhood_latitude = sanitize_text_field($row[$c]); |
|
| 4133 | + } else if ( $column == 'neighbourhood_longitude' ) {
|
|
| 4134 | + $neighbourhood_longitude = sanitize_text_field($row[$c]); |
|
| 4135 | + } else if ( $column == 'geodir_timing' ) {
|
|
| 4136 | + $geodir_timing = sanitize_text_field($row[$c]); |
|
| 4137 | + } else if ( $column == 'geodir_contact' ) {
|
|
| 4138 | + $geodir_contact = sanitize_text_field($row[$c]); |
|
| 4139 | + } else if ( $column == 'geodir_email' ) {
|
|
| 4140 | + $geodir_email = sanitize_email($row[$c]); |
|
| 4141 | + } else if ( $column == 'geodir_website' ) {
|
|
| 4142 | + $geodir_website = sanitize_text_field($row[$c]); |
|
| 4143 | + } else if ( $column == 'geodir_twitter' ) {
|
|
| 4144 | + $geodir_twitter = sanitize_text_field($row[$c]); |
|
| 4145 | + } else if ( $column == 'geodir_facebook' ) {
|
|
| 4146 | + $geodir_facebook = sanitize_text_field($row[$c]); |
|
| 4147 | + } else if ( $column == 'IMAGE' && !empty( $row[$c] ) && $row[$c] != '' ) {
|
|
| 4148 | + $post_images[] = $row[$c]; |
|
| 4149 | + } else if ( $column == 'alive_days' && (int)$row[$c] > 0 ) {
|
|
| 4150 | + $expire_date = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$row[$c] . ' days' ) ); |
|
| 4151 | + } else if ( $column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never' ) {
|
|
| 4152 | + $row[$c] = str_replace('/', '-', $row[$c]);
|
|
| 4153 | + $expire_date = date_i18n( 'Y-m-d', strtotime( $row[$c] ) ); |
|
| 4154 | + } |
|
| 4155 | + // WPML |
|
| 4156 | + if ($is_wpml) {
|
|
| 4157 | + if ($column == 'language') {
|
|
| 4158 | + $language = geodir_strtolower(trim($row[$c])); |
|
| 4159 | + } else if ($column == 'original_post_id') {
|
|
| 4160 | + $original_post_id = (int)$row[$c]; |
|
| 4161 | + } |
|
| 4162 | + } |
|
| 4163 | + // WPML |
|
| 4164 | + $c++; |
|
| 4165 | + } |
|
| 4166 | + // listing claimed or not |
|
| 4167 | + if ($is_claim_active && isset($gd_post['claimed'])) {
|
|
| 4168 | + $gd_post['claimed'] = (int)$gd_post['claimed'] == 1 ? 1 : 0; |
|
| 4169 | + } |
|
| 4170 | 4170 | |
| 4171 | - // WPML |
|
| 4172 | - if ($is_wpml && $language != '') {
|
|
| 4173 | - $sitepress->switch_lang($language, true); |
|
| 4174 | - } |
|
| 4175 | - // WPML |
|
| 4171 | + // WPML |
|
| 4172 | + if ($is_wpml && $language != '') {
|
|
| 4173 | + $sitepress->switch_lang($language, true); |
|
| 4174 | + } |
|
| 4175 | + // WPML |
|
| 4176 | 4176 | |
| 4177 | - $gd_post['IMAGE'] = $post_images; |
|
| 4177 | + $gd_post['IMAGE'] = $post_images; |
|
| 4178 | 4178 | |
| 4179 | - $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status; |
|
| 4180 | - $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status; |
|
| 4179 | + $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status; |
|
| 4180 | + $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status; |
|
| 4181 | 4181 | |
| 4182 | - $valid = true; |
|
| 4182 | + $valid = true; |
|
| 4183 | 4183 | |
| 4184 | - if ( $post_title == '' || !in_array( $post_type, $post_types ) ) {
|
|
| 4185 | - $invalid++; |
|
| 4186 | - $valid = false; |
|
| 4187 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) ); |
|
| 4188 | - } |
|
| 4184 | + if ( $post_title == '' || !in_array( $post_type, $post_types ) ) {
|
|
| 4185 | + $invalid++; |
|
| 4186 | + $valid = false; |
|
| 4187 | + geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) ); |
|
| 4188 | + } |
|
| 4189 | 4189 | |
| 4190 | - $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true; |
|
| 4191 | - if ( $location_allowed ) {
|
|
| 4192 | - $location_result = geodir_get_default_location(); |
|
| 4193 | - if ( $post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '' ) {
|
|
| 4194 | - $invalid_addr++; |
|
| 4195 | - $valid = false; |
|
| 4196 | - 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' ) ); |
|
| 4197 | - } else if ( !empty( $location_result ) && $location_result->location_id == 0 ) {
|
|
| 4198 | - 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 ) ) ) {
|
|
| 4199 | - $invalid_addr++; |
|
| 4200 | - $valid = false; |
|
| 4201 | - 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' ) ); |
|
| 4202 | - } else {
|
|
| 4203 | - if (!$location_manager) {
|
|
| 4204 | - $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. |
|
| 4205 | - } |
|
| 4206 | - } |
|
| 4207 | - } |
|
| 4208 | - } |
|
| 4190 | + $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true; |
|
| 4191 | + if ( $location_allowed ) {
|
|
| 4192 | + $location_result = geodir_get_default_location(); |
|
| 4193 | + if ( $post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '' ) {
|
|
| 4194 | + $invalid_addr++; |
|
| 4195 | + $valid = false; |
|
| 4196 | + 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' ) ); |
|
| 4197 | + } else if ( !empty( $location_result ) && $location_result->location_id == 0 ) {
|
|
| 4198 | + 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 ) ) ) {
|
|
| 4199 | + $invalid_addr++; |
|
| 4200 | + $valid = false; |
|
| 4201 | + 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' ) ); |
|
| 4202 | + } else {
|
|
| 4203 | + if (!$location_manager) {
|
|
| 4204 | + $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. |
|
| 4205 | + } |
|
| 4206 | + } |
|
| 4207 | + } |
|
| 4208 | + } |
|
| 4209 | 4209 | |
| 4210 | - if ( !$valid ) {
|
|
| 4211 | - continue; |
|
| 4212 | - } |
|
| 4210 | + if ( !$valid ) {
|
|
| 4211 | + continue; |
|
| 4212 | + } |
|
| 4213 | 4213 | |
| 4214 | - $cat_taxonomy = $post_type . 'category'; |
|
| 4215 | - $tags_taxonomy = $post_type . '_tags'; |
|
| 4214 | + $cat_taxonomy = $post_type . 'category'; |
|
| 4215 | + $tags_taxonomy = $post_type . '_tags'; |
|
| 4216 | 4216 | |
| 4217 | - if ($default_category != '' && !in_array($default_category, $post_category_arr)) {
|
|
| 4218 | - $post_category_arr = array_merge(array($default_category), $post_category_arr); |
|
| 4219 | - } |
|
| 4217 | + if ($default_category != '' && !in_array($default_category, $post_category_arr)) {
|
|
| 4218 | + $post_category_arr = array_merge(array($default_category), $post_category_arr); |
|
| 4219 | + } |
|
| 4220 | 4220 | |
| 4221 | - $post_category = array(); |
|
| 4222 | - $default_category_id = NULL; |
|
| 4223 | - if ( !empty( $post_category_arr ) ) {
|
|
| 4224 | - foreach ( $post_category_arr as $value ) {
|
|
| 4225 | - $category_name = wp_kses_normalize_entities( trim( $value ) ); |
|
| 4221 | + $post_category = array(); |
|
| 4222 | + $default_category_id = NULL; |
|
| 4223 | + if ( !empty( $post_category_arr ) ) {
|
|
| 4224 | + foreach ( $post_category_arr as $value ) {
|
|
| 4225 | + $category_name = wp_kses_normalize_entities( trim( $value ) ); |
|
| 4226 | 4226 | |
| 4227 | - if ( $category_name != '' ) {
|
|
| 4228 | - $term_category = array(); |
|
| 4227 | + if ( $category_name != '' ) {
|
|
| 4228 | + $term_category = array(); |
|
| 4229 | 4229 | |
| 4230 | - if ( $term = get_term_by( 'name', $category_name, $cat_taxonomy ) ) {
|
|
| 4231 | - $term_category = $term; |
|
| 4232 | - } else if ( $term = get_term_by( 'slug', $category_name, $cat_taxonomy ) ) {
|
|
| 4233 | - $term_category = $term; |
|
| 4234 | - } else {
|
|
| 4235 | - $term_data = array(); |
|
| 4236 | - $term_data['name'] = $category_name; |
|
| 4237 | - $term_data['taxonomy'] = $cat_taxonomy; |
|
| 4230 | + if ( $term = get_term_by( 'name', $category_name, $cat_taxonomy ) ) {
|
|
| 4231 | + $term_category = $term; |
|
| 4232 | + } else if ( $term = get_term_by( 'slug', $category_name, $cat_taxonomy ) ) {
|
|
| 4233 | + $term_category = $term; |
|
| 4234 | + } else {
|
|
| 4235 | + $term_data = array(); |
|
| 4236 | + $term_data['name'] = $category_name; |
|
| 4237 | + $term_data['taxonomy'] = $cat_taxonomy; |
|
| 4238 | 4238 | |
| 4239 | - $term_id = geodir_imex_insert_term( $cat_taxonomy, $term_data ); |
|
| 4240 | - if ( $term_id ) {
|
|
| 4241 | - $term_category = get_term( $term_id, $cat_taxonomy ); |
|
| 4242 | - } |
|
| 4243 | - } |
|
| 4239 | + $term_id = geodir_imex_insert_term( $cat_taxonomy, $term_data ); |
|
| 4240 | + if ( $term_id ) {
|
|
| 4241 | + $term_category = get_term( $term_id, $cat_taxonomy ); |
|
| 4242 | + } |
|
| 4243 | + } |
|
| 4244 | 4244 | |
| 4245 | - if ( !empty( $term_category ) && !is_wp_error( $term_category ) ) {
|
|
| 4246 | - $post_category[] = intval($term_category->term_id); |
|
| 4245 | + if ( !empty( $term_category ) && !is_wp_error( $term_category ) ) {
|
|
| 4246 | + $post_category[] = intval($term_category->term_id); |
|
| 4247 | 4247 | |
| 4248 | - if ($category_name == $default_category) {
|
|
| 4249 | - $default_category_id = intval($term_category->term_id); |
|
| 4250 | - } |
|
| 4251 | - } |
|
| 4252 | - } |
|
| 4253 | - } |
|
| 4254 | - } |
|
| 4248 | + if ($category_name == $default_category) {
|
|
| 4249 | + $default_category_id = intval($term_category->term_id); |
|
| 4250 | + } |
|
| 4251 | + } |
|
| 4252 | + } |
|
| 4253 | + } |
|
| 4254 | + } |
|
| 4255 | 4255 | |
| 4256 | - $save_post = array(); |
|
| 4257 | - $save_post['post_title'] = $post_title; |
|
| 4258 | - $save_post['post_content'] = $post_content; |
|
| 4259 | - $save_post['post_type'] = $post_type; |
|
| 4260 | - $save_post['post_author'] = $post_author; |
|
| 4261 | - $save_post['post_status'] = $post_status; |
|
| 4262 | - $save_post['post_category'] = $post_category; |
|
| 4263 | - $save_post['post_tags'] = $post_tags; |
|
| 4264 | - |
|
| 4265 | - $saved_post_id = NULL; |
|
| 4266 | - if ( $import_choice == 'update' ) {
|
|
| 4267 | - $gd_wp_error = __( 'Unable to add listing, please check the listing data.', 'geodirectory' ); |
|
| 4256 | + $save_post = array(); |
|
| 4257 | + $save_post['post_title'] = $post_title; |
|
| 4258 | + $save_post['post_content'] = $post_content; |
|
| 4259 | + $save_post['post_type'] = $post_type; |
|
| 4260 | + $save_post['post_author'] = $post_author; |
|
| 4261 | + $save_post['post_status'] = $post_status; |
|
| 4262 | + $save_post['post_category'] = $post_category; |
|
| 4263 | + $save_post['post_tags'] = $post_tags; |
|
| 4264 | + |
|
| 4265 | + $saved_post_id = NULL; |
|
| 4266 | + if ( $import_choice == 'update' ) {
|
|
| 4267 | + $gd_wp_error = __( 'Unable to add listing, please check the listing data.', 'geodirectory' ); |
|
| 4268 | 4268 | |
| 4269 | - if ( $post_id > 0 && get_post( $post_id ) ) {
|
|
| 4270 | - $save_post['ID'] = $post_id; |
|
| 4269 | + if ( $post_id > 0 && get_post( $post_id ) ) {
|
|
| 4270 | + $save_post['ID'] = $post_id; |
|
| 4271 | 4271 | |
| 4272 | - if ( $saved_post_id = wp_update_post( $save_post, true ) ) {
|
|
| 4273 | - if ( is_wp_error( $saved_post_id ) ) {
|
|
| 4274 | - $gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error; |
|
| 4275 | - $saved_post_id = 0; |
|
| 4276 | - } else {
|
|
| 4277 | - $saved_post_id = $post_id; |
|
| 4278 | - $updated++; |
|
| 4279 | - } |
|
| 4280 | - } |
|
| 4281 | - } else {
|
|
| 4282 | - if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
|
|
| 4283 | - if ( is_wp_error( $saved_post_id ) ) {
|
|
| 4284 | - $gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error; |
|
| 4285 | - $saved_post_id = 0; |
|
| 4286 | - } else {
|
|
| 4287 | - $created++; |
|
| 4288 | - } |
|
| 4289 | - } |
|
| 4290 | - } |
|
| 4272 | + if ( $saved_post_id = wp_update_post( $save_post, true ) ) {
|
|
| 4273 | + if ( is_wp_error( $saved_post_id ) ) {
|
|
| 4274 | + $gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error; |
|
| 4275 | + $saved_post_id = 0; |
|
| 4276 | + } else {
|
|
| 4277 | + $saved_post_id = $post_id; |
|
| 4278 | + $updated++; |
|
| 4279 | + } |
|
| 4280 | + } |
|
| 4281 | + } else {
|
|
| 4282 | + if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
|
|
| 4283 | + if ( is_wp_error( $saved_post_id ) ) {
|
|
| 4284 | + $gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error; |
|
| 4285 | + $saved_post_id = 0; |
|
| 4286 | + } else {
|
|
| 4287 | + $created++; |
|
| 4288 | + } |
|
| 4289 | + } |
|
| 4290 | + } |
|
| 4291 | 4291 | |
| 4292 | - if ( !$saved_post_id > 0 ) {
|
|
| 4293 | - $invalid++; |
|
| 4294 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_wp_error ); |
|
| 4295 | - } |
|
| 4296 | - } else if ( $import_choice == 'skip' ) {
|
|
| 4297 | - if ( $post_id > 0 && get_post( $post_id ) ) {
|
|
| 4298 | - $skipped++; |
|
| 4299 | - } else {
|
|
| 4300 | - if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
|
|
| 4301 | - if ( is_wp_error( $saved_post_id ) ) {
|
|
| 4302 | - $invalid++; |
|
| 4292 | + if ( !$saved_post_id > 0 ) {
|
|
| 4293 | + $invalid++; |
|
| 4294 | + geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_wp_error ); |
|
| 4295 | + } |
|
| 4296 | + } else if ( $import_choice == 'skip' ) {
|
|
| 4297 | + if ( $post_id > 0 && get_post( $post_id ) ) {
|
|
| 4298 | + $skipped++; |
|
| 4299 | + } else {
|
|
| 4300 | + if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
|
|
| 4301 | + if ( is_wp_error( $saved_post_id ) ) {
|
|
| 4302 | + $invalid++; |
|
| 4303 | 4303 | |
| 4304 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $saved_post_id->get_error_message() . ' ' . $wp_chars_error ); |
|
| 4305 | - $saved_post_id = 0; |
|
| 4306 | - } else {
|
|
| 4307 | - $created++; |
|
| 4308 | - } |
|
| 4309 | - } else {
|
|
| 4310 | - $invalid++; |
|
| 4304 | + geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $saved_post_id->get_error_message() . ' ' . $wp_chars_error ); |
|
| 4305 | + $saved_post_id = 0; |
|
| 4306 | + } else {
|
|
| 4307 | + $created++; |
|
| 4308 | + } |
|
| 4309 | + } else {
|
|
| 4310 | + $invalid++; |
|
| 4311 | 4311 | |
| 4312 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error ); |
|
| 4313 | - } |
|
| 4314 | - } |
|
| 4315 | - } else {
|
|
| 4316 | - $invalid++; |
|
| 4312 | + geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error ); |
|
| 4313 | + } |
|
| 4314 | + } |
|
| 4315 | + } else {
|
|
| 4316 | + $invalid++; |
|
| 4317 | 4317 | |
| 4318 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error ); |
|
| 4319 | - } |
|
| 4318 | + geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error ); |
|
| 4319 | + } |
|
| 4320 | 4320 | |
| 4321 | - if ( (int)$saved_post_id > 0 ) {
|
|
| 4322 | - // WPML |
|
| 4323 | - if ($is_wpml && $original_post_id > 0 && $language != '') {
|
|
| 4324 | - $wpml_post_type = 'post_' . $post_type; |
|
| 4325 | - $source_language = geodir_get_language_for_element( $original_post_id, $wpml_post_type ); |
|
| 4326 | - $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language(); |
|
| 4321 | + if ( (int)$saved_post_id > 0 ) {
|
|
| 4322 | + // WPML |
|
| 4323 | + if ($is_wpml && $original_post_id > 0 && $language != '') {
|
|
| 4324 | + $wpml_post_type = 'post_' . $post_type; |
|
| 4325 | + $source_language = geodir_get_language_for_element( $original_post_id, $wpml_post_type ); |
|
| 4326 | + $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language(); |
|
| 4327 | 4327 | |
| 4328 | - $trid = $sitepress->get_element_trid( $original_post_id, $wpml_post_type ); |
|
| 4328 | + $trid = $sitepress->get_element_trid( $original_post_id, $wpml_post_type ); |
|
| 4329 | 4329 | |
| 4330 | - $sitepress->set_element_language_details( $saved_post_id, $wpml_post_type, $trid, $language, $source_language ); |
|
| 4331 | - } |
|
| 4332 | - // WPML |
|
| 4333 | - $gd_post_info = geodir_get_post_info( $saved_post_id ); |
|
| 4330 | + $sitepress->set_element_language_details( $saved_post_id, $wpml_post_type, $trid, $language, $source_language ); |
|
| 4331 | + } |
|
| 4332 | + // WPML |
|
| 4333 | + $gd_post_info = geodir_get_post_info( $saved_post_id ); |
|
| 4334 | 4334 | |
| 4335 | - $gd_post['post_id'] = $saved_post_id; |
|
| 4336 | - $gd_post['ID'] = $saved_post_id; |
|
| 4337 | - $gd_post['post_tags'] = $post_tags; |
|
| 4338 | - $gd_post['post_title'] = $post_title; |
|
| 4339 | - $gd_post['post_status'] = $post_status; |
|
| 4340 | - $gd_post['submit_time'] = time(); |
|
| 4341 | - $gd_post['submit_ip'] = $_SERVER['REMOTE_ADDR']; |
|
| 4335 | + $gd_post['post_id'] = $saved_post_id; |
|
| 4336 | + $gd_post['ID'] = $saved_post_id; |
|
| 4337 | + $gd_post['post_tags'] = $post_tags; |
|
| 4338 | + $gd_post['post_title'] = $post_title; |
|
| 4339 | + $gd_post['post_status'] = $post_status; |
|
| 4340 | + $gd_post['submit_time'] = time(); |
|
| 4341 | + $gd_post['submit_ip'] = $_SERVER['REMOTE_ADDR']; |
|
| 4342 | 4342 | |
| 4343 | - // post location |
|
| 4344 | - $post_location_id = 0; |
|
| 4345 | - if ( $location_allowed && !empty( $location_result ) && $location_result->location_id > 0 ) {
|
|
| 4346 | - $gd_post['post_neighbourhood'] = ''; |
|
| 4343 | + // post location |
|
| 4344 | + $post_location_id = 0; |
|
| 4345 | + if ( $location_allowed && !empty( $location_result ) && $location_result->location_id > 0 ) {
|
|
| 4346 | + $gd_post['post_neighbourhood'] = ''; |
|
| 4347 | 4347 | |
| 4348 | - $post_location_info = array( |
|
| 4349 | - 'city' => $post_city, |
|
| 4350 | - 'region' => $post_region, |
|
| 4351 | - 'country' => $post_country, |
|
| 4352 | - 'geo_lat' => $post_latitude, |
|
| 4353 | - 'geo_lng' => $post_longitude |
|
| 4354 | - ); |
|
| 4355 | - if ( $location_id = (int)geodir_add_new_location( $post_location_info ) ) {
|
|
| 4356 | - $post_location_id = $location_id; |
|
| 4357 | - } |
|
| 4348 | + $post_location_info = array( |
|
| 4349 | + 'city' => $post_city, |
|
| 4350 | + 'region' => $post_region, |
|
| 4351 | + 'country' => $post_country, |
|
| 4352 | + 'geo_lat' => $post_latitude, |
|
| 4353 | + 'geo_lng' => $post_longitude |
|
| 4354 | + ); |
|
| 4355 | + if ( $location_id = (int)geodir_add_new_location( $post_location_info ) ) {
|
|
| 4356 | + $post_location_id = $location_id; |
|
| 4357 | + } |
|
| 4358 | 4358 | |
| 4359 | - if ($post_location_id > 0 && $neighbourhood_active && !empty($post_neighbourhood)) {
|
|
| 4360 | - $neighbourhood_info = geodir_location_neighbourhood_by_name_loc_id($post_neighbourhood, $post_location_id); |
|
| 4359 | + if ($post_location_id > 0 && $neighbourhood_active && !empty($post_neighbourhood)) {
|
|
| 4360 | + $neighbourhood_info = geodir_location_neighbourhood_by_name_loc_id($post_neighbourhood, $post_location_id); |
|
| 4361 | 4361 | |
| 4362 | - $hood_data = array(); |
|
| 4363 | - $hood_data['hood_location_id'] = $post_location_id; |
|
| 4364 | - $hood_data['hood_name'] = $post_neighbourhood; |
|
| 4362 | + $hood_data = array(); |
|
| 4363 | + $hood_data['hood_location_id'] = $post_location_id; |
|
| 4364 | + $hood_data['hood_name'] = $post_neighbourhood; |
|
| 4365 | 4365 | |
| 4366 | - if (!empty($neighbourhood_info)) {
|
|
| 4367 | - $hood_data['hood_id'] = $neighbourhood_info->hood_id; |
|
| 4368 | - $hood_data['hood_slug'] = $neighbourhood_info->hood_slug; |
|
| 4366 | + if (!empty($neighbourhood_info)) {
|
|
| 4367 | + $hood_data['hood_id'] = $neighbourhood_info->hood_id; |
|
| 4368 | + $hood_data['hood_slug'] = $neighbourhood_info->hood_slug; |
|
| 4369 | 4369 | |
| 4370 | - if (empty($neighbourhood_latitude) || empty($neighbourhood_longitude)) {
|
|
| 4371 | - $neighbourhood_latitude = $neighbourhood_info->hood_latitude; |
|
| 4372 | - $neighbourhood_longitude = $neighbourhood_info->hood_longitude; |
|
| 4373 | - } |
|
| 4374 | - } |
|
| 4370 | + if (empty($neighbourhood_latitude) || empty($neighbourhood_longitude)) {
|
|
| 4371 | + $neighbourhood_latitude = $neighbourhood_info->hood_latitude; |
|
| 4372 | + $neighbourhood_longitude = $neighbourhood_info->hood_longitude; |
|
| 4373 | + } |
|
| 4374 | + } |
|
| 4375 | 4375 | |
| 4376 | - if (empty($neighbourhood_latitude) || empty($neighbourhood_longitude)) {
|
|
| 4377 | - $neighbourhood_latitude = $neighbourhood_info->hood_latitude; |
|
| 4378 | - $neighbourhood_longitude = $neighbourhood_info->hood_longitude; |
|
| 4379 | - } |
|
| 4376 | + if (empty($neighbourhood_latitude) || empty($neighbourhood_longitude)) {
|
|
| 4377 | + $neighbourhood_latitude = $neighbourhood_info->hood_latitude; |
|
| 4378 | + $neighbourhood_longitude = $neighbourhood_info->hood_longitude; |
|
| 4379 | + } |
|
| 4380 | 4380 | |
| 4381 | - $hood_data['hood_latitude'] = $post_latitude; |
|
| 4382 | - $hood_data['hood_longitude'] = $post_longitude; |
|
| 4381 | + $hood_data['hood_latitude'] = $post_latitude; |
|
| 4382 | + $hood_data['hood_longitude'] = $post_longitude; |
|
| 4383 | 4383 | |
| 4384 | - $neighbourhood_info = geodir_location_insert_update_neighbourhood($hood_data); |
|
| 4385 | - if (!empty($neighbourhood_info) && isset($neighbourhood_info->hood_slug)) {
|
|
| 4386 | - $gd_post['post_neighbourhood'] = $neighbourhood_info->hood_slug; |
|
| 4387 | - } |
|
| 4388 | - } |
|
| 4389 | - } |
|
| 4390 | - $gd_post['post_location_id'] = $post_location_id; |
|
| 4384 | + $neighbourhood_info = geodir_location_insert_update_neighbourhood($hood_data); |
|
| 4385 | + if (!empty($neighbourhood_info) && isset($neighbourhood_info->hood_slug)) {
|
|
| 4386 | + $gd_post['post_neighbourhood'] = $neighbourhood_info->hood_slug; |
|
| 4387 | + } |
|
| 4388 | + } |
|
| 4389 | + } |
|
| 4390 | + $gd_post['post_location_id'] = $post_location_id; |
|
| 4391 | 4391 | |
| 4392 | - // post package info |
|
| 4393 | - $package_id = isset( $gd_post['package_id'] ) && !empty( $gd_post['package_id'] ) ? (int)$gd_post['package_id'] : 0; |
|
| 4394 | - if (!$package_id && !empty($gd_post_info) && isset($gd_post_info->package_id) && $gd_post_info->package_id) {
|
|
| 4395 | - $package_id = $gd_post_info->package_id; |
|
| 4396 | - } |
|
| 4392 | + // post package info |
|
| 4393 | + $package_id = isset( $gd_post['package_id'] ) && !empty( $gd_post['package_id'] ) ? (int)$gd_post['package_id'] : 0; |
|
| 4394 | + if (!$package_id && !empty($gd_post_info) && isset($gd_post_info->package_id) && $gd_post_info->package_id) {
|
|
| 4395 | + $package_id = $gd_post_info->package_id; |
|
| 4396 | + } |
|
| 4397 | 4397 | |
| 4398 | - $package_info = array(); |
|
| 4399 | - if ($package_id && function_exists('geodir_get_package_info_by_id')) {
|
|
| 4400 | - $package_info = (array)geodir_get_package_info_by_id($package_id); |
|
| 4398 | + $package_info = array(); |
|
| 4399 | + if ($package_id && function_exists('geodir_get_package_info_by_id')) {
|
|
| 4400 | + $package_info = (array)geodir_get_package_info_by_id($package_id); |
|
| 4401 | 4401 | |
| 4402 | - if (!(!empty($package_info) && isset($package_info['post_type']) && $package_info['post_type'] == $post_type)) {
|
|
| 4403 | - $package_info = array(); |
|
| 4404 | - } |
|
| 4405 | - } |
|
| 4402 | + if (!(!empty($package_info) && isset($package_info['post_type']) && $package_info['post_type'] == $post_type)) {
|
|
| 4403 | + $package_info = array(); |
|
| 4404 | + } |
|
| 4405 | + } |
|
| 4406 | 4406 | |
| 4407 | - if (empty($package_info)) {
|
|
| 4408 | - $package_info = (array)geodir_post_package_info( array(), '', $post_type ); |
|
| 4409 | - } |
|
| 4407 | + if (empty($package_info)) {
|
|
| 4408 | + $package_info = (array)geodir_post_package_info( array(), '', $post_type ); |
|
| 4409 | + } |
|
| 4410 | 4410 | |
| 4411 | - if (!empty($package_info)) {
|
|
| 4412 | - $package_id = $package_info['pid']; |
|
| 4411 | + if (!empty($package_info)) {
|
|
| 4412 | + $package_id = $package_info['pid']; |
|
| 4413 | 4413 | |
| 4414 | - if (isset($gd_post['alive_days']) || isset($gd_post['expire_date'])) {
|
|
| 4415 | - $gd_post['expire_date'] = $expire_date; |
|
| 4416 | - } else {
|
|
| 4417 | - if ( isset( $package_info['days'] ) && (int)$package_info['days'] > 0 ) {
|
|
| 4418 | - $gd_post['alive_days'] = (int)$package_info['days']; |
|
| 4419 | - $gd_post['expire_date'] = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$package_info['days'] . ' days' ) ); |
|
| 4420 | - } else {
|
|
| 4421 | - $gd_post['expire_date'] = 'Never'; |
|
| 4422 | - } |
|
| 4423 | - } |
|
| 4414 | + if (isset($gd_post['alive_days']) || isset($gd_post['expire_date'])) {
|
|
| 4415 | + $gd_post['expire_date'] = $expire_date; |
|
| 4416 | + } else {
|
|
| 4417 | + if ( isset( $package_info['days'] ) && (int)$package_info['days'] > 0 ) {
|
|
| 4418 | + $gd_post['alive_days'] = (int)$package_info['days']; |
|
| 4419 | + $gd_post['expire_date'] = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$package_info['days'] . ' days' ) ); |
|
| 4420 | + } else {
|
|
| 4421 | + $gd_post['expire_date'] = 'Never'; |
|
| 4422 | + } |
|
| 4423 | + } |
|
| 4424 | 4424 | |
| 4425 | - $gd_post['package_id'] = $package_id; |
|
| 4426 | - } |
|
| 4425 | + $gd_post['package_id'] = $package_id; |
|
| 4426 | + } |
|
| 4427 | 4427 | |
| 4428 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 4428 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
| 4429 | 4429 | |
| 4430 | - if ($post_type == 'gd_event') {
|
|
| 4431 | - $gd_post = geodir_imex_process_event_data($gd_post); |
|
| 4432 | - } |
|
| 4430 | + if ($post_type == 'gd_event') {
|
|
| 4431 | + $gd_post = geodir_imex_process_event_data($gd_post); |
|
| 4432 | + } |
|
| 4433 | 4433 | |
| 4434 | - if (isset($gd_post['post_id'])) {
|
|
| 4435 | - unset($gd_post['post_id']); |
|
| 4436 | - } |
|
| 4434 | + if (isset($gd_post['post_id'])) {
|
|
| 4435 | + unset($gd_post['post_id']); |
|
| 4436 | + } |
|
| 4437 | 4437 | |
| 4438 | - // Export franchise fields |
|
| 4439 | - $is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false; |
|
| 4440 | - if ($is_franchise_active) {
|
|
| 4441 | - if ( isset( $gd_post['gd_is_franchise'] ) && (int)$gd_post['gd_is_franchise'] == 1 ) {
|
|
| 4442 | - $gd_franchise_lock = array(); |
|
| 4438 | + // Export franchise fields |
|
| 4439 | + $is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false; |
|
| 4440 | + if ($is_franchise_active) {
|
|
| 4441 | + if ( isset( $gd_post['gd_is_franchise'] ) && (int)$gd_post['gd_is_franchise'] == 1 ) {
|
|
| 4442 | + $gd_franchise_lock = array(); |
|
| 4443 | 4443 | |
| 4444 | - if ( isset( $gd_post['gd_franchise_lock'] ) ) {
|
|
| 4445 | - $gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock'] );
|
|
| 4446 | - $gd_franchise_lock = trim( $gd_franchise_lock ); |
|
| 4447 | - $gd_franchise_lock = explode( ",", $gd_franchise_lock ); |
|
| 4448 | - } |
|
| 4444 | + if ( isset( $gd_post['gd_franchise_lock'] ) ) {
|
|
| 4445 | + $gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock'] );
|
|
| 4446 | + $gd_franchise_lock = trim( $gd_franchise_lock ); |
|
| 4447 | + $gd_franchise_lock = explode( ",", $gd_franchise_lock ); |
|
| 4448 | + } |
|
| 4449 | 4449 | |
| 4450 | - update_post_meta( $saved_post_id, 'gd_is_franchise', 1 ); |
|
| 4451 | - update_post_meta( $saved_post_id, 'gd_franchise_lock', $gd_franchise_lock ); |
|
| 4452 | - } else {
|
|
| 4453 | - if ( isset( $gd_post['franchise'] ) && (int)$gd_post['franchise'] > 0 && geodir_franchise_check( (int)$gd_post['franchise'] ) ) {
|
|
| 4454 | - geodir_save_post_meta( $saved_post_id, 'franchise', (int)$gd_post['franchise'] ); |
|
| 4455 | - } |
|
| 4456 | - } |
|
| 4457 | - } |
|
| 4450 | + update_post_meta( $saved_post_id, 'gd_is_franchise', 1 ); |
|
| 4451 | + update_post_meta( $saved_post_id, 'gd_franchise_lock', $gd_franchise_lock ); |
|
| 4452 | + } else {
|
|
| 4453 | + if ( isset( $gd_post['franchise'] ) && (int)$gd_post['franchise'] > 0 && geodir_franchise_check( (int)$gd_post['franchise'] ) ) {
|
|
| 4454 | + geodir_save_post_meta( $saved_post_id, 'franchise', (int)$gd_post['franchise'] ); |
|
| 4455 | + } |
|
| 4456 | + } |
|
| 4457 | + } |
|
| 4458 | 4458 | |
| 4459 | - if (!empty($save_post['post_category']) && is_array($save_post['post_category'])) {
|
|
| 4460 | - $save_post['post_category'] = array_unique( array_map( 'intval', $save_post['post_category'] ) ); |
|
| 4461 | - if ($default_category_id) {
|
|
| 4462 | - $save_post['post_default_category'] = $default_category_id; |
|
| 4463 | - $gd_post['default_category'] = $default_category_id; |
|
| 4464 | - } |
|
| 4465 | - $gd_post[$cat_taxonomy] = $save_post['post_category']; |
|
| 4466 | - } |
|
| 4459 | + if (!empty($save_post['post_category']) && is_array($save_post['post_category'])) {
|
|
| 4460 | + $save_post['post_category'] = array_unique( array_map( 'intval', $save_post['post_category'] ) ); |
|
| 4461 | + if ($default_category_id) {
|
|
| 4462 | + $save_post['post_default_category'] = $default_category_id; |
|
| 4463 | + $gd_post['default_category'] = $default_category_id; |
|
| 4464 | + } |
|
| 4465 | + $gd_post[$cat_taxonomy] = $save_post['post_category']; |
|
| 4466 | + } |
|
| 4467 | 4467 | |
| 4468 | - // Save post info |
|
| 4469 | - geodir_save_post_info( $saved_post_id, $gd_post ); |
|
| 4470 | - // post taxonomies |
|
| 4471 | - if ( !empty( $save_post['post_category'] ) ) {
|
|
| 4472 | - wp_set_object_terms( $saved_post_id, $save_post['post_category'], $cat_taxonomy ); |
|
| 4468 | + // Save post info |
|
| 4469 | + geodir_save_post_info( $saved_post_id, $gd_post ); |
|
| 4470 | + // post taxonomies |
|
| 4471 | + if ( !empty( $save_post['post_category'] ) ) {
|
|
| 4472 | + wp_set_object_terms( $saved_post_id, $save_post['post_category'], $cat_taxonomy ); |
|
| 4473 | 4473 | |
| 4474 | - $post_default_category = isset( $save_post['post_default_category'] ) ? $save_post['post_default_category'] : ''; |
|
| 4475 | - if ($default_category_id) {
|
|
| 4476 | - $post_default_category = $default_category_id; |
|
| 4477 | - } |
|
| 4478 | - $post_cat_ids = geodir_get_post_meta($saved_post_id, $cat_taxonomy); |
|
| 4479 | - $save_post['post_category'] = !empty($post_cat_ids) ? explode(",", trim($post_cat_ids, ",")) : $save_post['post_category'];
|
|
| 4480 | - $post_category_str = !empty($save_post['post_category']) ? implode(",y:#", $save_post['post_category']) . ',y:' : '';
|
|
| 4474 | + $post_default_category = isset( $save_post['post_default_category'] ) ? $save_post['post_default_category'] : ''; |
|
| 4475 | + if ($default_category_id) {
|
|
| 4476 | + $post_default_category = $default_category_id; |
|
| 4477 | + } |
|
| 4478 | + $post_cat_ids = geodir_get_post_meta($saved_post_id, $cat_taxonomy); |
|
| 4479 | + $save_post['post_category'] = !empty($post_cat_ids) ? explode(",", trim($post_cat_ids, ",")) : $save_post['post_category'];
|
|
| 4480 | + $post_category_str = !empty($save_post['post_category']) ? implode(",y:#", $save_post['post_category']) . ',y:' : '';
|
|
| 4481 | 4481 | |
| 4482 | - if ($post_category_str != '' && $post_default_category) {
|
|
| 4483 | - $post_category_str = str_replace($post_default_category . ',y:', $post_default_category . ',y,d:', $post_category_str); |
|
| 4484 | - } |
|
| 4482 | + if ($post_category_str != '' && $post_default_category) {
|
|
| 4483 | + $post_category_str = str_replace($post_default_category . ',y:', $post_default_category . ',y,d:', $post_category_str); |
|
| 4484 | + } |
|
| 4485 | 4485 | |
| 4486 | - $post_category_str = $post_category_str != '' ? array($cat_taxonomy => $post_category_str) : ''; |
|
| 4486 | + $post_category_str = $post_category_str != '' ? array($cat_taxonomy => $post_category_str) : ''; |
|
| 4487 | 4487 | |
| 4488 | - geodir_set_postcat_structure( $saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str ); |
|
| 4489 | - } |
|
| 4488 | + geodir_set_postcat_structure( $saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str ); |
|
| 4489 | + } |
|
| 4490 | 4490 | |
| 4491 | - if ( !empty( $save_post['post_tags'] ) ) {
|
|
| 4492 | - wp_set_object_terms( $saved_post_id, $save_post['post_tags'], $tags_taxonomy ); |
|
| 4493 | - } |
|
| 4491 | + if ( !empty( $save_post['post_tags'] ) ) {
|
|
| 4492 | + wp_set_object_terms( $saved_post_id, $save_post['post_tags'], $tags_taxonomy ); |
|
| 4493 | + } |
|
| 4494 | 4494 | |
| 4495 | - // Post images |
|
| 4496 | - if ( !empty( $post_images ) ) {
|
|
| 4497 | - $post_images = array_unique($post_images); |
|
| 4495 | + // Post images |
|
| 4496 | + if ( !empty( $post_images ) ) {
|
|
| 4497 | + $post_images = array_unique($post_images); |
|
| 4498 | 4498 | |
| 4499 | - $old_post_images_arr = array(); |
|
| 4500 | - $saved_post_images_arr = array(); |
|
| 4499 | + $old_post_images_arr = array(); |
|
| 4500 | + $saved_post_images_arr = array(); |
|
| 4501 | 4501 | |
| 4502 | - $order = 1; |
|
| 4502 | + $order = 1; |
|
| 4503 | 4503 | |
| 4504 | - $old_post_images = geodir_get_images( $saved_post_id ); |
|
| 4505 | - if (!empty($old_post_images)) {
|
|
| 4506 | - foreach( $old_post_images as $old_post_image ) {
|
|
| 4507 | - if (!empty($old_post_image) && isset($old_post_image->file) && $old_post_image->file != '') {
|
|
| 4508 | - $old_post_images_arr[] = $old_post_image->file; |
|
| 4509 | - } |
|
| 4510 | - } |
|
| 4511 | - } |
|
| 4504 | + $old_post_images = geodir_get_images( $saved_post_id ); |
|
| 4505 | + if (!empty($old_post_images)) {
|
|
| 4506 | + foreach( $old_post_images as $old_post_image ) {
|
|
| 4507 | + if (!empty($old_post_image) && isset($old_post_image->file) && $old_post_image->file != '') {
|
|
| 4508 | + $old_post_images_arr[] = $old_post_image->file; |
|
| 4509 | + } |
|
| 4510 | + } |
|
| 4511 | + } |
|
| 4512 | 4512 | |
| 4513 | - foreach ( $post_images as $post_image ) {
|
|
| 4514 | - $image_name = basename( $post_image ); |
|
| 4515 | - $saved_post_images_arr[] = $image_name; |
|
| 4513 | + foreach ( $post_images as $post_image ) {
|
|
| 4514 | + $image_name = basename( $post_image ); |
|
| 4515 | + $saved_post_images_arr[] = $image_name; |
|
| 4516 | 4516 | |
| 4517 | - if (!empty($old_post_images_arr) && in_array( $image_name, $old_post_images_arr) ) {
|
|
| 4518 | - continue; // Skip if image already exists. |
|
| 4519 | - } |
|
| 4517 | + if (!empty($old_post_images_arr) && in_array( $image_name, $old_post_images_arr) ) {
|
|
| 4518 | + continue; // Skip if image already exists. |
|
| 4519 | + } |
|
| 4520 | 4520 | |
| 4521 | - $image_name_parts = explode( '.', $image_name ); |
|
| 4522 | - array_pop( $image_name_parts ); |
|
| 4523 | - $proper_image_name = implode( '.', $image_name_parts ); |
|
| 4521 | + $image_name_parts = explode( '.', $image_name ); |
|
| 4522 | + array_pop( $image_name_parts ); |
|
| 4523 | + $proper_image_name = implode( '.', $image_name_parts ); |
|
| 4524 | 4524 | |
| 4525 | - $arr_file_type = wp_check_filetype( $image_name ); |
|
| 4525 | + $arr_file_type = wp_check_filetype( $image_name ); |
|
| 4526 | 4526 | |
| 4527 | - if ( !empty( $arr_file_type ) ) {
|
|
| 4528 | - $uploaded_file_type = $arr_file_type['type']; |
|
| 4527 | + if ( !empty( $arr_file_type ) ) {
|
|
| 4528 | + $uploaded_file_type = $arr_file_type['type']; |
|
| 4529 | 4529 | |
| 4530 | - $attachment = array(); |
|
| 4531 | - $attachment['post_id'] = $saved_post_id; |
|
| 4532 | - $attachment['title'] = $proper_image_name; |
|
| 4533 | - $attachment['content'] = ''; |
|
| 4534 | - $attachment['file'] = $uploads_subdir . '/' . $image_name; |
|
| 4535 | - $attachment['mime_type'] = $uploaded_file_type; |
|
| 4536 | - $attachment['menu_order'] = $order; |
|
| 4537 | - $attachment['is_featured'] = 0; |
|
| 4538 | - |
|
| 4539 | - $attachment_set = ''; |
|
| 4540 | - foreach ( $attachment as $key => $val ) {
|
|
| 4541 | - if ( $val != '' ) {
|
|
| 4542 | - $attachment_set .= $key . " = '" . $val . "', "; |
|
| 4543 | - } |
|
| 4544 | - } |
|
| 4545 | - $attachment_set = trim( $attachment_set, ", " ); |
|
| 4530 | + $attachment = array(); |
|
| 4531 | + $attachment['post_id'] = $saved_post_id; |
|
| 4532 | + $attachment['title'] = $proper_image_name; |
|
| 4533 | + $attachment['content'] = ''; |
|
| 4534 | + $attachment['file'] = $uploads_subdir . '/' . $image_name; |
|
| 4535 | + $attachment['mime_type'] = $uploaded_file_type; |
|
| 4536 | + $attachment['menu_order'] = $order; |
|
| 4537 | + $attachment['is_featured'] = 0; |
|
| 4538 | + |
|
| 4539 | + $attachment_set = ''; |
|
| 4540 | + foreach ( $attachment as $key => $val ) {
|
|
| 4541 | + if ( $val != '' ) {
|
|
| 4542 | + $attachment_set .= $key . " = '" . $val . "', "; |
|
| 4543 | + } |
|
| 4544 | + } |
|
| 4545 | + $attachment_set = trim( $attachment_set, ", " ); |
|
| 4546 | 4546 | |
| 4547 | - // Add new attachment |
|
| 4548 | - $wpdb->query( "INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set ); |
|
| 4547 | + // Add new attachment |
|
| 4548 | + $wpdb->query( "INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set ); |
|
| 4549 | 4549 | |
| 4550 | - $order++; |
|
| 4551 | - } |
|
| 4552 | - } |
|
| 4550 | + $order++; |
|
| 4551 | + } |
|
| 4552 | + } |
|
| 4553 | 4553 | |
| 4554 | - $saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/" . implode("' AND file NOT LIKE '%/", $saved_post_images_arr) . "' )" : '';
|
|
| 4555 | - // Remove previous attachment |
|
| 4556 | - $wpdb->query( "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = " . (int)$saved_post_id . " " . $saved_post_images_sql ); |
|
| 4554 | + $saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/" . implode("' AND file NOT LIKE '%/", $saved_post_images_arr) . "' )" : '';
|
|
| 4555 | + // Remove previous attachment |
|
| 4556 | + $wpdb->query( "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = " . (int)$saved_post_id . " " . $saved_post_images_sql ); |
|
| 4557 | 4557 | |
| 4558 | - if ( !empty( $saved_post_images_arr ) ) {
|
|
| 4559 | - geodir_set_wp_featured_image($saved_post_id); |
|
| 4560 | - /* |
|
| 4558 | + if ( !empty( $saved_post_images_arr ) ) {
|
|
| 4559 | + geodir_set_wp_featured_image($saved_post_id); |
|
| 4560 | + /* |
|
| 4561 | 4561 | $menu_order = 1; |
| 4562 | 4562 | |
| 4563 | 4563 | foreach ( $saved_post_images_arr as $img_name ) {
|
@@ -4570,281 +4570,281 @@ discard block |
||
| 4570 | 4570 | } |
| 4571 | 4571 | $menu_order++; |
| 4572 | 4572 | }*/ |
| 4573 | - } |
|
| 4573 | + } |
|
| 4574 | 4574 | |
| 4575 | - if ( $order > 1 ) {
|
|
| 4576 | - $images++; |
|
| 4577 | - } |
|
| 4578 | - } |
|
| 4575 | + if ( $order > 1 ) {
|
|
| 4576 | + $images++; |
|
| 4577 | + } |
|
| 4578 | + } |
|
| 4579 | 4579 | |
| 4580 | - /** This action is documented in geodirectory-functions/post-functions.php */ |
|
| 4581 | - do_action( 'geodir_after_save_listing', $saved_post_id, $gd_post ); |
|
| 4580 | + /** This action is documented in geodirectory-functions/post-functions.php */ |
|
| 4581 | + do_action( 'geodir_after_save_listing', $saved_post_id, $gd_post ); |
|
| 4582 | 4582 | |
| 4583 | - if (isset($is_featured)) {
|
|
| 4584 | - geodir_save_post_meta($saved_post_id, 'is_featured', $is_featured); |
|
| 4585 | - } |
|
| 4586 | - if (isset($gd_post['expire_date'])) {
|
|
| 4587 | - geodir_save_post_meta($saved_post_id, 'expire_date', $gd_post['expire_date']); |
|
| 4588 | - } |
|
| 4589 | - } |
|
| 4583 | + if (isset($is_featured)) {
|
|
| 4584 | + geodir_save_post_meta($saved_post_id, 'is_featured', $is_featured); |
|
| 4585 | + } |
|
| 4586 | + if (isset($gd_post['expire_date'])) {
|
|
| 4587 | + geodir_save_post_meta($saved_post_id, 'expire_date', $gd_post['expire_date']); |
|
| 4588 | + } |
|
| 4589 | + } |
|
| 4590 | 4590 | |
| 4591 | - // WPML |
|
| 4592 | - if ($is_wpml && $language != '') {
|
|
| 4593 | - $sitepress->switch_lang($active_lang, true); |
|
| 4594 | - } |
|
| 4595 | - // WPML |
|
| 4596 | - } |
|
| 4597 | - } |
|
| 4598 | - } |
|
| 4591 | + // WPML |
|
| 4592 | + if ($is_wpml && $language != '') {
|
|
| 4593 | + $sitepress->switch_lang($active_lang, true); |
|
| 4594 | + } |
|
| 4595 | + // WPML |
|
| 4596 | + } |
|
| 4597 | + } |
|
| 4598 | + } |
|
| 4599 | 4599 | |
| 4600 | - //undo some stuff to make the import quicker |
|
| 4601 | - wp_defer_term_counting( false ); |
|
| 4602 | - wp_defer_comment_counting( false ); |
|
| 4603 | - $wpdb->query( 'COMMIT;' ); |
|
| 4604 | - $wpdb->query( 'SET autocommit = 1;' ); |
|
| 4605 | - |
|
| 4606 | - $json = array(); |
|
| 4607 | - $json['processed'] = $processed_actual; |
|
| 4608 | - $json['created'] = $created; |
|
| 4609 | - $json['updated'] = $updated; |
|
| 4610 | - $json['skipped'] = $skipped; |
|
| 4611 | - $json['invalid'] = $invalid; |
|
| 4612 | - $json['invalid_addr'] = $invalid_addr; |
|
| 4613 | - $json['images'] = $images; |
|
| 4600 | + //undo some stuff to make the import quicker |
|
| 4601 | + wp_defer_term_counting( false ); |
|
| 4602 | + wp_defer_comment_counting( false ); |
|
| 4603 | + $wpdb->query( 'COMMIT;' ); |
|
| 4604 | + $wpdb->query( 'SET autocommit = 1;' ); |
|
| 4605 | + |
|
| 4606 | + $json = array(); |
|
| 4607 | + $json['processed'] = $processed_actual; |
|
| 4608 | + $json['created'] = $created; |
|
| 4609 | + $json['updated'] = $updated; |
|
| 4610 | + $json['skipped'] = $skipped; |
|
| 4611 | + $json['invalid'] = $invalid; |
|
| 4612 | + $json['invalid_addr'] = $invalid_addr; |
|
| 4613 | + $json['images'] = $images; |
|
| 4614 | 4614 | |
| 4615 | - wp_send_json( $json ); |
|
| 4616 | - exit; |
|
| 4617 | - } else if ( $task == 'import_loc' ) {
|
|
| 4618 | - global $gd_post_types; |
|
| 4619 | - $gd_post_types = $post_types; |
|
| 4615 | + wp_send_json( $json ); |
|
| 4616 | + exit; |
|
| 4617 | + } else if ( $task == 'import_loc' ) {
|
|
| 4618 | + global $gd_post_types; |
|
| 4619 | + $gd_post_types = $post_types; |
|
| 4620 | 4620 | |
| 4621 | - if (!empty($file)) {
|
|
| 4622 | - $columns = isset($file[0]) ? $file[0] : NULL; |
|
| 4621 | + if (!empty($file)) {
|
|
| 4622 | + $columns = isset($file[0]) ? $file[0] : NULL; |
|
| 4623 | 4623 | |
| 4624 | - if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
|
|
| 4625 | - $json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
|
|
| 4626 | - wp_send_json( $json ); |
|
| 4627 | - } |
|
| 4624 | + if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
|
|
| 4625 | + $json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
|
|
| 4626 | + wp_send_json( $json ); |
|
| 4627 | + } |
|
| 4628 | 4628 | |
| 4629 | - $gd_error_log = __('GD IMPORT LOCATIONS [ROW %d]:', 'geodirectory');
|
|
| 4630 | - $gd_error_location = __( 'Could not be saved due to blank/invalid address(city, region, country, latitude, longitude)', 'geodirectory' ); |
|
| 4631 | - for ($i = 1; $i <= $limit; $i++) {
|
|
| 4632 | - $index = $processed + $i; |
|
| 4629 | + $gd_error_log = __('GD IMPORT LOCATIONS [ROW %d]:', 'geodirectory');
|
|
| 4630 | + $gd_error_location = __( 'Could not be saved due to blank/invalid address(city, region, country, latitude, longitude)', 'geodirectory' ); |
|
| 4631 | + for ($i = 1; $i <= $limit; $i++) {
|
|
| 4632 | + $index = $processed + $i; |
|
| 4633 | 4633 | |
| 4634 | - if (isset($file[$index])) {
|
|
| 4635 | - $row = $file[$index]; |
|
| 4636 | - $row = array_map( 'trim', $row ); |
|
| 4637 | - $data = array(); |
|
| 4634 | + if (isset($file[$index])) {
|
|
| 4635 | + $row = $file[$index]; |
|
| 4636 | + $row = array_map( 'trim', $row ); |
|
| 4637 | + $data = array(); |
|
| 4638 | 4638 | |
| 4639 | - foreach ($columns as $c => $column ) {
|
|
| 4640 | - 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'))) {
|
|
| 4641 | - $data[$column] = $row[$c]; |
|
| 4642 | - } |
|
| 4643 | - } |
|
| 4639 | + foreach ($columns as $c => $column ) {
|
|
| 4640 | + 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'))) {
|
|
| 4641 | + $data[$column] = $row[$c]; |
|
| 4642 | + } |
|
| 4643 | + } |
|
| 4644 | 4644 | |
| 4645 | - if ( empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude']) ) {
|
|
| 4646 | - $invalid++; |
|
| 4647 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location ); |
|
| 4648 | - continue; |
|
| 4649 | - } |
|
| 4645 | + if ( empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude']) ) {
|
|
| 4646 | + $invalid++; |
|
| 4647 | + geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location ); |
|
| 4648 | + continue; |
|
| 4649 | + } |
|
| 4650 | 4650 | |
| 4651 | - $data['location_id'] = isset($data['location_id']) ? absint($data['location_id']) : 0; |
|
| 4651 | + $data['location_id'] = isset($data['location_id']) ? absint($data['location_id']) : 0; |
|
| 4652 | 4652 | |
| 4653 | - if ( $import_choice == 'update' ) {
|
|
| 4654 | - if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
|
|
| 4655 | - if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
|
|
| 4656 | - $updated++; |
|
| 4657 | - } else {
|
|
| 4658 | - $invalid++; |
|
| 4659 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location ); |
|
| 4660 | - } |
|
| 4661 | - } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
|
|
| 4662 | - $data['location_id'] = (int)$location->location_id; |
|
| 4653 | + if ( $import_choice == 'update' ) {
|
|
| 4654 | + if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
|
|
| 4655 | + if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
|
|
| 4656 | + $updated++; |
|
| 4657 | + } else {
|
|
| 4658 | + $invalid++; |
|
| 4659 | + geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location ); |
|
| 4660 | + } |
|
| 4661 | + } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
|
|
| 4662 | + $data['location_id'] = (int)$location->location_id; |
|
| 4663 | 4663 | |
| 4664 | - if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region'] ) ) ) {
|
|
| 4665 | - $data['location_id'] = (int)$location->location_id; |
|
| 4666 | - } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'region' => $data['region'] ) ) ) {
|
|
| 4667 | - $data['location_id'] = (int)$location->location_id; |
|
| 4668 | - } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'] ) ) ) {
|
|
| 4669 | - $data['location_id'] = (int)$location->location_id; |
|
| 4670 | - } |
|
| 4664 | + if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region'] ) ) ) {
|
|
| 4665 | + $data['location_id'] = (int)$location->location_id; |
|
| 4666 | + } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'region' => $data['region'] ) ) ) {
|
|
| 4667 | + $data['location_id'] = (int)$location->location_id; |
|
| 4668 | + } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'] ) ) ) {
|
|
| 4669 | + $data['location_id'] = (int)$location->location_id; |
|
| 4670 | + } |
|
| 4671 | 4671 | |
| 4672 | - if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
|
|
| 4673 | - $updated++; |
|
| 4674 | - } else {
|
|
| 4675 | - $invalid++; |
|
| 4676 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location ); |
|
| 4677 | - } |
|
| 4678 | - } else {
|
|
| 4679 | - if ( $location_id = geodir_location_insert_city( $data, true ) ) {
|
|
| 4680 | - $created++; |
|
| 4681 | - } else {
|
|
| 4682 | - $invalid++; |
|
| 4683 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location ); |
|
| 4684 | - } |
|
| 4685 | - } |
|
| 4686 | - } elseif ( $import_choice == 'skip' ) {
|
|
| 4687 | - if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
|
|
| 4688 | - $skipped++; |
|
| 4689 | - } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
|
|
| 4690 | - $skipped++; |
|
| 4691 | - } else {
|
|
| 4692 | - if ( $location_id = geodir_location_insert_city( $data, true ) ) {
|
|
| 4693 | - $created++; |
|
| 4694 | - } else {
|
|
| 4695 | - $invalid++; |
|
| 4696 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location ); |
|
| 4697 | - } |
|
| 4698 | - } |
|
| 4699 | - } else {
|
|
| 4700 | - $invalid++; |
|
| 4701 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location ); |
|
| 4702 | - } |
|
| 4703 | - } |
|
| 4704 | - } |
|
| 4705 | - } |
|
| 4672 | + if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
|
|
| 4673 | + $updated++; |
|
| 4674 | + } else {
|
|
| 4675 | + $invalid++; |
|
| 4676 | + geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location ); |
|
| 4677 | + } |
|
| 4678 | + } else {
|
|
| 4679 | + if ( $location_id = geodir_location_insert_city( $data, true ) ) {
|
|
| 4680 | + $created++; |
|
| 4681 | + } else {
|
|
| 4682 | + $invalid++; |
|
| 4683 | + geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location ); |
|
| 4684 | + } |
|
| 4685 | + } |
|
| 4686 | + } elseif ( $import_choice == 'skip' ) {
|
|
| 4687 | + if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
|
|
| 4688 | + $skipped++; |
|
| 4689 | + } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
|
|
| 4690 | + $skipped++; |
|
| 4691 | + } else {
|
|
| 4692 | + if ( $location_id = geodir_location_insert_city( $data, true ) ) {
|
|
| 4693 | + $created++; |
|
| 4694 | + } else {
|
|
| 4695 | + $invalid++; |
|
| 4696 | + geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location ); |
|
| 4697 | + } |
|
| 4698 | + } |
|
| 4699 | + } else {
|
|
| 4700 | + $invalid++; |
|
| 4701 | + geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location ); |
|
| 4702 | + } |
|
| 4703 | + } |
|
| 4704 | + } |
|
| 4705 | + } |
|
| 4706 | 4706 | |
| 4707 | - $json = array(); |
|
| 4708 | - $json['processed'] = $limit; |
|
| 4709 | - $json['created'] = $created; |
|
| 4710 | - $json['updated'] = $updated; |
|
| 4711 | - $json['skipped'] = $skipped; |
|
| 4712 | - $json['invalid'] = $invalid; |
|
| 4713 | - $json['images'] = $images; |
|
| 4707 | + $json = array(); |
|
| 4708 | + $json['processed'] = $limit; |
|
| 4709 | + $json['created'] = $created; |
|
| 4710 | + $json['updated'] = $updated; |
|
| 4711 | + $json['skipped'] = $skipped; |
|
| 4712 | + $json['invalid'] = $invalid; |
|
| 4713 | + $json['images'] = $images; |
|
| 4714 | 4714 | |
| 4715 | - wp_send_json( $json ); |
|
| 4716 | - } else if ( $task == 'import_hood' ) {
|
|
| 4717 | - if (!empty($file)) {
|
|
| 4718 | - $columns = isset($file[0]) ? $file[0] : NULL; |
|
| 4715 | + wp_send_json( $json ); |
|
| 4716 | + } else if ( $task == 'import_hood' ) {
|
|
| 4717 | + if (!empty($file)) {
|
|
| 4718 | + $columns = isset($file[0]) ? $file[0] : NULL; |
|
| 4719 | 4719 | |
| 4720 | - if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
|
|
| 4721 | - $json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
|
|
| 4722 | - wp_send_json( $json ); |
|
| 4723 | - } |
|
| 4720 | + if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
|
|
| 4721 | + $json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
|
|
| 4722 | + wp_send_json( $json ); |
|
| 4723 | + } |
|
| 4724 | 4724 | |
| 4725 | - $gd_error_log = __('GD IMPORT NEIGHBOURHOODS [ROW %d]:', 'geodirectory');
|
|
| 4726 | - $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' ); |
|
| 4727 | - for ($i = 1; $i <= $limit; $i++) {
|
|
| 4728 | - $index = $processed + $i; |
|
| 4725 | + $gd_error_log = __('GD IMPORT NEIGHBOURHOODS [ROW %d]:', 'geodirectory');
|
|
| 4726 | + $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' ); |
|
| 4727 | + for ($i = 1; $i <= $limit; $i++) {
|
|
| 4728 | + $index = $processed + $i; |
|
| 4729 | 4729 | |
| 4730 | - if (isset($file[$index])) {
|
|
| 4731 | - $row = $file[$index]; |
|
| 4732 | - $row = array_map( 'trim', $row ); |
|
| 4733 | - $data = array(); |
|
| 4730 | + if (isset($file[$index])) {
|
|
| 4731 | + $row = $file[$index]; |
|
| 4732 | + $row = array_map( 'trim', $row ); |
|
| 4733 | + $data = array(); |
|
| 4734 | 4734 | |
| 4735 | - foreach ($columns as $c => $column) {
|
|
| 4736 | - if (in_array($column, array('neighbourhood_id', 'neighbourhood_name', 'neighbourhood_slug', 'latitude', 'longitude', 'location_id', 'city', 'region', 'country'))) {
|
|
| 4737 | - $data[$column] = sanitize_text_field($row[$c]); |
|
| 4738 | - } |
|
| 4739 | - } |
|
| 4735 | + foreach ($columns as $c => $column) {
|
|
| 4736 | + if (in_array($column, array('neighbourhood_id', 'neighbourhood_name', 'neighbourhood_slug', 'latitude', 'longitude', 'location_id', 'city', 'region', 'country'))) {
|
|
| 4737 | + $data[$column] = sanitize_text_field($row[$c]); |
|
| 4738 | + } |
|
| 4739 | + } |
|
| 4740 | 4740 | |
| 4741 | - if (empty($data['neighbourhood_name']) || empty($data['latitude']) || empty($data['longitude'])) {
|
|
| 4742 | - $invalid++; |
|
| 4743 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 4744 | - continue; |
|
| 4745 | - } |
|
| 4741 | + if (empty($data['neighbourhood_name']) || empty($data['latitude']) || empty($data['longitude'])) {
|
|
| 4742 | + $invalid++; |
|
| 4743 | + geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 4744 | + continue; |
|
| 4745 | + } |
|
| 4746 | 4746 | |
| 4747 | - $location_info = array(); |
|
| 4748 | - if (!empty($data['location_id']) && (int)$data['location_id'] > 0) {
|
|
| 4749 | - $location_info = geodir_get_location_by_id('', (int)$data['location_id']);
|
|
| 4750 | - } else if (!empty($data['city']) && !empty($data['region']) && !empty($data['country'])) {
|
|
| 4751 | - $location_info = geodir_get_location_by_slug('city', array('fields' => 'location_id', 'city' => $data['city'], 'country' => $data['country'], 'region' => $data['region']));
|
|
| 4752 | - } |
|
| 4747 | + $location_info = array(); |
|
| 4748 | + if (!empty($data['location_id']) && (int)$data['location_id'] > 0) {
|
|
| 4749 | + $location_info = geodir_get_location_by_id('', (int)$data['location_id']);
|
|
| 4750 | + } else if (!empty($data['city']) && !empty($data['region']) && !empty($data['country'])) {
|
|
| 4751 | + $location_info = geodir_get_location_by_slug('city', array('fields' => 'location_id', 'city' => $data['city'], 'country' => $data['country'], 'region' => $data['region']));
|
|
| 4752 | + } |
|
| 4753 | 4753 | |
| 4754 | - if (empty($location_info)) {
|
|
| 4755 | - $invalid++; |
|
| 4756 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 4757 | - continue; |
|
| 4758 | - } |
|
| 4754 | + if (empty($location_info)) {
|
|
| 4755 | + $invalid++; |
|
| 4756 | + geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 4757 | + continue; |
|
| 4758 | + } |
|
| 4759 | 4759 | |
| 4760 | - $location_id = $location_info->location_id; |
|
| 4760 | + $location_id = $location_info->location_id; |
|
| 4761 | 4761 | |
| 4762 | - $data['neighbourhood_id'] = isset($data['neighbourhood_id']) ? absint($data['neighbourhood_id']) : 0; |
|
| 4762 | + $data['neighbourhood_id'] = isset($data['neighbourhood_id']) ? absint($data['neighbourhood_id']) : 0; |
|
| 4763 | 4763 | |
| 4764 | - $hood_data = array(); |
|
| 4765 | - $hood_data['hood_name'] = $data['neighbourhood_name']; |
|
| 4766 | - $hood_data['hood_slug'] = $data['neighbourhood_slug']; |
|
| 4767 | - $hood_data['hood_latitude'] = $data['latitude']; |
|
| 4768 | - $hood_data['hood_longitude'] = $data['longitude']; |
|
| 4769 | - $hood_data['hood_location_id'] = $location_id; |
|
| 4764 | + $hood_data = array(); |
|
| 4765 | + $hood_data['hood_name'] = $data['neighbourhood_name']; |
|
| 4766 | + $hood_data['hood_slug'] = $data['neighbourhood_slug']; |
|
| 4767 | + $hood_data['hood_latitude'] = $data['latitude']; |
|
| 4768 | + $hood_data['hood_longitude'] = $data['longitude']; |
|
| 4769 | + $hood_data['hood_location_id'] = $location_id; |
|
| 4770 | 4770 | |
| 4771 | - if ( $import_choice == 'update' ) {
|
|
| 4772 | - if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
|
|
| 4773 | - $hood_data['hood_id'] = (int)$data['neighbourhood_id']; |
|
| 4771 | + if ( $import_choice == 'update' ) {
|
|
| 4772 | + if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
|
|
| 4773 | + $hood_data['hood_id'] = (int)$data['neighbourhood_id']; |
|
| 4774 | 4774 | |
| 4775 | - if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
|
|
| 4776 | - $updated++; |
|
| 4777 | - } else {
|
|
| 4778 | - $invalid++; |
|
| 4779 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 4780 | - } |
|
| 4781 | - } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
|
|
| 4782 | - $hood_data['hood_id'] = (int)$neighbourhood->hood_id; |
|
| 4775 | + if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
|
|
| 4776 | + $updated++; |
|
| 4777 | + } else {
|
|
| 4778 | + $invalid++; |
|
| 4779 | + geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 4780 | + } |
|
| 4781 | + } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
|
|
| 4782 | + $hood_data['hood_id'] = (int)$neighbourhood->hood_id; |
|
| 4783 | 4783 | |
| 4784 | - if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
|
|
| 4785 | - $updated++; |
|
| 4786 | - } else {
|
|
| 4787 | - $invalid++; |
|
| 4788 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 4789 | - } |
|
| 4790 | - } else {
|
|
| 4791 | - if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
|
|
| 4792 | - $created++; |
|
| 4793 | - } else {
|
|
| 4794 | - $invalid++; |
|
| 4795 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 4796 | - } |
|
| 4797 | - } |
|
| 4798 | - } elseif ( $import_choice == 'skip' ) {
|
|
| 4799 | - if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
|
|
| 4800 | - $skipped++; |
|
| 4801 | - } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
|
|
| 4802 | - $skipped++; |
|
| 4803 | - } else {
|
|
| 4784 | + if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
|
|
| 4785 | + $updated++; |
|
| 4786 | + } else {
|
|
| 4787 | + $invalid++; |
|
| 4788 | + geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 4789 | + } |
|
| 4790 | + } else {
|
|
| 4791 | + if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
|
|
| 4792 | + $created++; |
|
| 4793 | + } else {
|
|
| 4794 | + $invalid++; |
|
| 4795 | + geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 4796 | + } |
|
| 4797 | + } |
|
| 4798 | + } elseif ( $import_choice == 'skip' ) {
|
|
| 4799 | + if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
|
|
| 4800 | + $skipped++; |
|
| 4801 | + } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
|
|
| 4802 | + $skipped++; |
|
| 4803 | + } else {
|
|
| 4804 | 4804 | |
| 4805 | - if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
|
|
| 4806 | - $created++; |
|
| 4807 | - } else {
|
|
| 4808 | - $invalid++; |
|
| 4809 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 4810 | - } |
|
| 4811 | - } |
|
| 4812 | - } else {
|
|
| 4813 | - $invalid++; |
|
| 4814 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 4815 | - } |
|
| 4816 | - } |
|
| 4817 | - } |
|
| 4818 | - } |
|
| 4805 | + if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
|
|
| 4806 | + $created++; |
|
| 4807 | + } else {
|
|
| 4808 | + $invalid++; |
|
| 4809 | + geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 4810 | + } |
|
| 4811 | + } |
|
| 4812 | + } else {
|
|
| 4813 | + $invalid++; |
|
| 4814 | + geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 4815 | + } |
|
| 4816 | + } |
|
| 4817 | + } |
|
| 4818 | + } |
|
| 4819 | 4819 | |
| 4820 | - $json = array(); |
|
| 4821 | - $json['processed'] = $limit; |
|
| 4822 | - $json['created'] = $created; |
|
| 4823 | - $json['updated'] = $updated; |
|
| 4824 | - $json['skipped'] = $skipped; |
|
| 4825 | - $json['invalid'] = $invalid; |
|
| 4826 | - $json['images'] = $images; |
|
| 4820 | + $json = array(); |
|
| 4821 | + $json['processed'] = $limit; |
|
| 4822 | + $json['created'] = $created; |
|
| 4823 | + $json['updated'] = $updated; |
|
| 4824 | + $json['skipped'] = $skipped; |
|
| 4825 | + $json['invalid'] = $invalid; |
|
| 4826 | + $json['images'] = $images; |
|
| 4827 | 4827 | |
| 4828 | - wp_send_json( $json ); |
|
| 4829 | - } |
|
| 4830 | - } |
|
| 4831 | - break; |
|
| 4832 | - case 'import_finish':{
|
|
| 4833 | - /** |
|
| 4834 | - * Run an action when an import finishes. |
|
| 4835 | - * |
|
| 4836 | - * This action can be used to fire functions after an import ends. |
|
| 4837 | - * |
|
| 4838 | - * @since 1.5.3 |
|
| 4839 | - * @package GeoDirectory |
|
| 4840 | - */ |
|
| 4841 | - do_action('geodir_import_finished');
|
|
| 4842 | - } |
|
| 4843 | - break; |
|
| 4828 | + wp_send_json( $json ); |
|
| 4829 | + } |
|
| 4830 | + } |
|
| 4831 | + break; |
|
| 4832 | + case 'import_finish':{
|
|
| 4833 | + /** |
|
| 4834 | + * Run an action when an import finishes. |
|
| 4835 | + * |
|
| 4836 | + * This action can be used to fire functions after an import ends. |
|
| 4837 | + * |
|
| 4838 | + * @since 1.5.3 |
|
| 4839 | + * @package GeoDirectory |
|
| 4840 | + */ |
|
| 4841 | + do_action('geodir_import_finished');
|
|
| 4842 | + } |
|
| 4843 | + break; |
|
| 4844 | 4844 | |
| 4845 | - } |
|
| 4846 | - echo '0'; |
|
| 4847 | - gd_die(); |
|
| 4845 | + } |
|
| 4846 | + echo '0'; |
|
| 4847 | + gd_die(); |
|
| 4848 | 4848 | } |
| 4849 | 4849 | |
| 4850 | 4850 | /** |
@@ -4888,12 +4888,12 @@ discard block |
||
| 4888 | 4888 | $args['slug'] = wp_unique_term_slug( $args['slug'], (object)$term_args ); |
| 4889 | 4889 | } |
| 4890 | 4890 | |
| 4891 | - if( !empty( $term ) ) {
|
|
| 4891 | + if( !empty( $term ) ) {
|
|
| 4892 | 4892 | $result = wp_insert_term( $term, $taxonomy, $args ); |
| 4893 | - if( !is_wp_error( $result ) ) {
|
|
| 4894 | - return isset( $result['term_id'] ) ? $result['term_id'] : 0; |
|
| 4895 | - } |
|
| 4896 | - } |
|
| 4893 | + if( !is_wp_error( $result ) ) {
|
|
| 4894 | + return isset( $result['term_id'] ) ? $result['term_id'] : 0; |
|
| 4895 | + } |
|
| 4896 | + } |
|
| 4897 | 4897 | |
| 4898 | 4898 | return false; |
| 4899 | 4899 | } |
@@ -4939,16 +4939,16 @@ discard block |
||
| 4939 | 4939 | $result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data ); |
| 4940 | 4940 | |
| 4941 | 4941 | if( !is_wp_error( $result ) ) {
|
| 4942 | - return isset( $result['term_id'] ) ? $result['term_id'] : 0; |
|
| 4943 | - } |
|
| 4942 | + return isset( $result['term_id'] ) ? $result['term_id'] : 0; |
|
| 4943 | + } |
|
| 4944 | 4944 | } else if ( $term_data['slug'] != '' && $term_info = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
|
| 4945 | 4945 | $term_data['term_id'] = $term_info['term_id']; |
| 4946 | 4946 | |
| 4947 | 4947 | $result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data ); |
| 4948 | 4948 | |
| 4949 | 4949 | if( !is_wp_error( $result ) ) {
|
| 4950 | - return isset( $result['term_id'] ) ? $result['term_id'] : 0; |
|
| 4951 | - } |
|
| 4950 | + return isset( $result['term_id'] ) ? $result['term_id'] : 0; |
|
| 4951 | + } |
|
| 4952 | 4952 | } else {
|
| 4953 | 4953 | return geodir_imex_insert_term( $taxonomy, $term_data ); |
| 4954 | 4954 | } |
@@ -4970,47 +4970,47 @@ discard block |
||
| 4970 | 4970 | * @return int Posts count. |
| 4971 | 4971 | */ |
| 4972 | 4972 | function geodir_get_posts_count( $post_type ) {
|
| 4973 | - global $wpdb, $plugin_prefix; |
|
| 4973 | + global $wpdb, $plugin_prefix; |
|
| 4974 | 4974 | |
| 4975 | - if ( !post_type_exists( $post_type ) ) {
|
|
| 4976 | - return 0; |
|
| 4977 | - } |
|
| 4975 | + if ( !post_type_exists( $post_type ) ) {
|
|
| 4976 | + return 0; |
|
| 4977 | + } |
|
| 4978 | 4978 | |
| 4979 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 4979 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
| 4980 | 4980 | |
| 4981 | - // Skip listing with statuses trash, auto-draft etc... |
|
| 4982 | - $skip_statuses = geodir_imex_export_skip_statuses(); |
|
| 4983 | - $where_statuses = ''; |
|
| 4984 | - if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
|
|
| 4985 | - $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
|
|
| 4986 | - } |
|
| 4981 | + // Skip listing with statuses trash, auto-draft etc... |
|
| 4982 | + $skip_statuses = geodir_imex_export_skip_statuses(); |
|
| 4983 | + $where_statuses = ''; |
|
| 4984 | + if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
|
|
| 4985 | + $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
|
|
| 4986 | + } |
|
| 4987 | 4987 | |
| 4988 | - /** |
|
| 4989 | - * Filter the SQL where clause part to filter posts count in import/export. |
|
| 4990 | - * |
|
| 4991 | - * @since 1.6.4 |
|
| 4992 | - * @package GeoDirectory |
|
| 4993 | - * |
|
| 4994 | - * @param string $where SQL where clause part. |
|
| 4995 | - */ |
|
| 4996 | - $where_statuses = apply_filters( 'geodir_get_posts_count', $where_statuses, $post_type ); |
|
| 4997 | - |
|
| 4998 | - $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 );
|
|
| 4999 | - |
|
| 5000 | - $posts_count = (int)$wpdb->get_var( $query ); |
|
| 4988 | + /** |
|
| 4989 | + * Filter the SQL where clause part to filter posts count in import/export. |
|
| 4990 | + * |
|
| 4991 | + * @since 1.6.4 |
|
| 4992 | + * @package GeoDirectory |
|
| 4993 | + * |
|
| 4994 | + * @param string $where SQL where clause part. |
|
| 4995 | + */ |
|
| 4996 | + $where_statuses = apply_filters( 'geodir_get_posts_count', $where_statuses, $post_type ); |
|
| 4997 | + |
|
| 4998 | + $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 );
|
|
| 4999 | + |
|
| 5000 | + $posts_count = (int)$wpdb->get_var( $query ); |
|
| 5001 | 5001 | |
| 5002 | - /** |
|
| 5003 | - * Modify returned post counts for the current post type. |
|
| 5004 | - * |
|
| 5005 | - * @since 1.4.6 |
|
| 5006 | - * @package GeoDirectory |
|
| 5007 | - * |
|
| 5008 | - * @param int $posts_count Post counts. |
|
| 5009 | - * @param string $post_type Post type. |
|
| 5010 | - */ |
|
| 5011 | - $posts_count = apply_filters( 'geodir_imex_count_posts', $posts_count, $post_type ); |
|
| 5012 | - |
|
| 5013 | - return $posts_count; |
|
| 5002 | + /** |
|
| 5003 | + * Modify returned post counts for the current post type. |
|
| 5004 | + * |
|
| 5005 | + * @since 1.4.6 |
|
| 5006 | + * @package GeoDirectory |
|
| 5007 | + * |
|
| 5008 | + * @param int $posts_count Post counts. |
|
| 5009 | + * @param string $post_type Post type. |
|
| 5010 | + */ |
|
| 5011 | + $posts_count = apply_filters( 'geodir_imex_count_posts', $posts_count, $post_type ); |
|
| 5012 | + |
|
| 5013 | + return $posts_count; |
|
| 5014 | 5014 | } |
| 5015 | 5015 | |
| 5016 | 5016 | /** |
@@ -5038,10 +5038,10 @@ discard block |
||
| 5038 | 5038 | |
| 5039 | 5039 | if ( !empty( $posts ) ) {
|
| 5040 | 5040 | $is_payment_plugin = is_plugin_active( 'geodir_payment_manager/geodir_payment_manager.php' ); |
| 5041 | - $location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
|
|
| 5042 | - $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true; |
|
| 5043 | - $neighbourhood_active = $location_manager && $location_allowed && get_option('location_neighbourhoods') ? true : false;
|
|
| 5044 | - $is_claim_active = is_plugin_active( 'geodir_claim_listing/geodir_claim_listing.php' ) && get_option('geodir_claim_enable') === 'yes' ? true : false;
|
|
| 5041 | + $location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
|
|
| 5042 | + $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true; |
|
| 5043 | + $neighbourhood_active = $location_manager && $location_allowed && get_option('location_neighbourhoods') ? true : false;
|
|
| 5044 | + $is_claim_active = is_plugin_active( 'geodir_claim_listing/geodir_claim_listing.php' ) && get_option('geodir_claim_enable') === 'yes' ? true : false;
|
|
| 5045 | 5045 | |
| 5046 | 5046 | $csv_row = array(); |
| 5047 | 5047 | $csv_row[] = 'post_id'; |
@@ -5073,7 +5073,7 @@ discard block |
||
| 5073 | 5073 | } |
| 5074 | 5074 | $csv_row[] = 'post_status'; |
| 5075 | 5075 | $csv_row[] = 'is_featured'; |
| 5076 | - // Export claim listing field |
|
| 5076 | + // Export claim listing field |
|
| 5077 | 5077 | if ($is_claim_active) {
|
| 5078 | 5078 | $csv_row[] = 'claimed'; |
| 5079 | 5079 | } |
@@ -5081,7 +5081,7 @@ discard block |
||
| 5081 | 5081 | $csv_row[] = 'package_id'; |
| 5082 | 5082 | $csv_row[] = 'expire_date'; |
| 5083 | 5083 | } |
| 5084 | - $csv_row[] = 'post_date'; |
|
| 5084 | + $csv_row[] = 'post_date'; |
|
| 5085 | 5085 | $csv_row[] = 'post_address'; |
| 5086 | 5086 | $csv_row[] = 'post_city'; |
| 5087 | 5087 | $csv_row[] = 'post_region'; |
@@ -5089,11 +5089,11 @@ discard block |
||
| 5089 | 5089 | $csv_row[] = 'post_zip'; |
| 5090 | 5090 | $csv_row[] = 'post_latitude'; |
| 5091 | 5091 | $csv_row[] = 'post_longitude'; |
| 5092 | - if ($neighbourhood_active) {
|
|
| 5093 | - $csv_row[] = 'post_neighbourhood'; |
|
| 5094 | - $csv_row[] = 'neighbourhood_latitude'; |
|
| 5095 | - $csv_row[] = 'neighbourhood_longitude'; |
|
| 5096 | - } |
|
| 5092 | + if ($neighbourhood_active) {
|
|
| 5093 | + $csv_row[] = 'post_neighbourhood'; |
|
| 5094 | + $csv_row[] = 'neighbourhood_latitude'; |
|
| 5095 | + $csv_row[] = 'neighbourhood_longitude'; |
|
| 5096 | + } |
|
| 5097 | 5097 | $csv_row[] = 'geodir_timing'; |
| 5098 | 5098 | $csv_row[] = 'geodir_contact'; |
| 5099 | 5099 | $csv_row[] = 'geodir_email'; |
@@ -5125,21 +5125,21 @@ discard block |
||
| 5125 | 5125 | $csv_row[] = 'franchise'; |
| 5126 | 5126 | } |
| 5127 | 5127 | |
| 5128 | - /** |
|
| 5129 | - * Filter columns field names of gd export listings csv. |
|
| 5130 | - * |
|
| 5131 | - * @since 1.6.5 |
|
| 5132 | - * @package GeoDirectory |
|
| 5133 | - * |
|
| 5134 | - * @param array $csv_row Column names being exported in csv. |
|
| 5135 | - * @param string $post_type The post type. |
|
| 5136 | - */ |
|
| 5137 | - $csv_row = apply_filters('geodir_export_listing_csv_column_names', $csv_row, $post_type);
|
|
| 5128 | + /** |
|
| 5129 | + * Filter columns field names of gd export listings csv. |
|
| 5130 | + * |
|
| 5131 | + * @since 1.6.5 |
|
| 5132 | + * @package GeoDirectory |
|
| 5133 | + * |
|
| 5134 | + * @param array $csv_row Column names being exported in csv. |
|
| 5135 | + * @param string $post_type The post type. |
|
| 5136 | + */ |
|
| 5137 | + $csv_row = apply_filters('geodir_export_listing_csv_column_names', $csv_row, $post_type);
|
|
| 5138 | 5138 | |
| 5139 | 5139 | $csv_rows[] = $csv_row; |
| 5140 | 5140 | |
| 5141 | 5141 | $images_count = 5; |
| 5142 | - $xx=0; |
|
| 5142 | + $xx=0; |
|
| 5143 | 5143 | foreach ( $posts as $post ) {$xx++;
|
| 5144 | 5144 | $post_id = $post['ID']; |
| 5145 | 5145 | |
@@ -5270,14 +5270,14 @@ discard block |
||
| 5270 | 5270 | } |
| 5271 | 5271 | $csv_row[] = $post_info['post_status']; // post_status |
| 5272 | 5272 | $csv_row[] = (int)$post_info['is_featured'] == 1 ? 1 : ''; // is_featured |
| 5273 | - if ($is_claim_active) {
|
|
| 5274 | - $csv_row[] = !empty($post_info['claimed']) && (int)$post_info['claimed'] == 1 ? 1 : ''; // claimed |
|
| 5275 | - } |
|
| 5273 | + if ($is_claim_active) {
|
|
| 5274 | + $csv_row[] = !empty($post_info['claimed']) && (int)$post_info['claimed'] == 1 ? 1 : ''; // claimed |
|
| 5275 | + } |
|
| 5276 | 5276 | if ($is_payment_plugin) {
|
| 5277 | 5277 | $csv_row[] = (int)$post_info['package_id']; // package_id |
| 5278 | 5278 | $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
|
| 5279 | 5279 | } |
| 5280 | - $csv_row[] = $post_info['post_date']; // post_date |
|
| 5280 | + $csv_row[] = $post_info['post_date']; // post_date |
|
| 5281 | 5281 | $csv_row[] = $post_info['post_address']; // post_address |
| 5282 | 5282 | $csv_row[] = $post_info['post_city']; // post_city |
| 5283 | 5283 | $csv_row[] = $post_info['post_region']; // post_region |
@@ -5285,21 +5285,21 @@ discard block |
||
| 5285 | 5285 | $csv_row[] = $post_info['post_zip']; // post_zip |
| 5286 | 5286 | $csv_row[] = $post_info['post_latitude']; // post_latitude |
| 5287 | 5287 | $csv_row[] = $post_info['post_longitude']; // post_longitude |
| 5288 | - if ($neighbourhood_active) {
|
|
| 5289 | - $post_neighbourhood = ''; |
|
| 5290 | - $neighbourhood_latitude = ''; |
|
| 5291 | - $neighbourhood_longitude = ''; |
|
| 5292 | - if (!empty($post_info['post_neighbourhood']) && ($hood_info = geodir_location_get_neighbourhood_by_id($post_info['post_neighbourhood'], true, $post_info['post_location_id']))) {
|
|
| 5293 | - if (!empty($hood_info)) {
|
|
| 5294 | - $post_neighbourhood = $hood_info->hood_name; |
|
| 5295 | - $neighbourhood_latitude = $hood_info->hood_latitude; |
|
| 5296 | - $neighbourhood_longitude = $hood_info->hood_longitude; |
|
| 5297 | - } |
|
| 5298 | - } |
|
| 5299 | - $csv_row[] = $post_neighbourhood; // post_neighbourhood |
|
| 5300 | - $csv_row[] = $neighbourhood_latitude; // neighbourhood_latitude |
|
| 5301 | - $csv_row[] = $neighbourhood_longitude; // neighbourhood_longitude |
|
| 5302 | - } |
|
| 5288 | + if ($neighbourhood_active) {
|
|
| 5289 | + $post_neighbourhood = ''; |
|
| 5290 | + $neighbourhood_latitude = ''; |
|
| 5291 | + $neighbourhood_longitude = ''; |
|
| 5292 | + if (!empty($post_info['post_neighbourhood']) && ($hood_info = geodir_location_get_neighbourhood_by_id($post_info['post_neighbourhood'], true, $post_info['post_location_id']))) {
|
|
| 5293 | + if (!empty($hood_info)) {
|
|
| 5294 | + $post_neighbourhood = $hood_info->hood_name; |
|
| 5295 | + $neighbourhood_latitude = $hood_info->hood_latitude; |
|
| 5296 | + $neighbourhood_longitude = $hood_info->hood_longitude; |
|
| 5297 | + } |
|
| 5298 | + } |
|
| 5299 | + $csv_row[] = $post_neighbourhood; // post_neighbourhood |
|
| 5300 | + $csv_row[] = $neighbourhood_latitude; // neighbourhood_latitude |
|
| 5301 | + $csv_row[] = $neighbourhood_longitude; // neighbourhood_longitude |
|
| 5302 | + } |
|
| 5303 | 5303 | $csv_row[] = $post_info['geodir_timing']; // geodir_timing |
| 5304 | 5304 | $csv_row[] = $post_info['geodir_contact']; // geodir_contact |
| 5305 | 5305 | $csv_row[] = $post_info['geodir_email']; // geodir_email |
@@ -5339,16 +5339,16 @@ discard block |
||
| 5339 | 5339 | $csv_row[] = (int)$franchise; // franchise id |
| 5340 | 5340 | } |
| 5341 | 5341 | |
| 5342 | - /** |
|
| 5343 | - * Filter columns values of gd export listings csv file |
|
| 5344 | - * |
|
| 5345 | - * @since 1.6.5 |
|
| 5346 | - * @package GeoDirectory |
|
| 5347 | - * |
|
| 5348 | - * @param array $csv_row Field values being exported in csv. |
|
| 5349 | - * @param array $post_info The post info. |
|
| 5350 | - */ |
|
| 5351 | - $csv_row = apply_filters('geodir_export_listing_csv_column_values', $csv_row, $post_info);
|
|
| 5342 | + /** |
|
| 5343 | + * Filter columns values of gd export listings csv file |
|
| 5344 | + * |
|
| 5345 | + * @since 1.6.5 |
|
| 5346 | + * @package GeoDirectory |
|
| 5347 | + * |
|
| 5348 | + * @param array $csv_row Field values being exported in csv. |
|
| 5349 | + * @param array $post_info The post info. |
|
| 5350 | + */ |
|
| 5351 | + $csv_row = apply_filters('geodir_export_listing_csv_column_values', $csv_row, $post_info);
|
|
| 5352 | 5352 | |
| 5353 | 5353 | for ( $c = 0; $c < $images_count; $c++ ) {
|
| 5354 | 5354 | $csv_row[] = isset( $current_images[$c] ) ? $current_images[$c] : ''; // IMAGE |
@@ -5381,64 +5381,64 @@ discard block |
||
| 5381 | 5381 | * @return array Array of posts data. |
| 5382 | 5382 | */ |
| 5383 | 5383 | function geodir_get_export_posts( $post_type, $per_page = 0, $page_no = 0 ) {
|
| 5384 | - global $wpdb, $plugin_prefix; |
|
| 5384 | + global $wpdb, $plugin_prefix; |
|
| 5385 | 5385 | |
| 5386 | - if ( ! post_type_exists( $post_type ) ) |
|
| 5387 | - return new stdClass; |
|
| 5386 | + if ( ! post_type_exists( $post_type ) ) |
|
| 5387 | + return new stdClass; |
|
| 5388 | 5388 | |
| 5389 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 5389 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
| 5390 | 5390 | |
| 5391 | - $limit = ''; |
|
| 5392 | - if ( $per_page > 0 && $page_no > 0 ) {
|
|
| 5393 | - $offset = ( $page_no - 1 ) * $per_page; |
|
| 5391 | + $limit = ''; |
|
| 5392 | + if ( $per_page > 0 && $page_no > 0 ) {
|
|
| 5393 | + $offset = ( $page_no - 1 ) * $per_page; |
|
| 5394 | 5394 | |
| 5395 | - if ( $offset > 0 ) {
|
|
| 5396 | - $limit = " LIMIT " . $offset . "," . $per_page; |
|
| 5397 | - } else {
|
|
| 5398 | - $limit = " LIMIT " . $per_page; |
|
| 5399 | - } |
|
| 5400 | - } |
|
| 5395 | + if ( $offset > 0 ) {
|
|
| 5396 | + $limit = " LIMIT " . $offset . "," . $per_page; |
|
| 5397 | + } else {
|
|
| 5398 | + $limit = " LIMIT " . $per_page; |
|
| 5399 | + } |
|
| 5400 | + } |
|
| 5401 | 5401 | |
| 5402 | - // Skip listing with statuses trash, auto-draft etc... |
|
| 5403 | - $skip_statuses = geodir_imex_export_skip_statuses(); |
|
| 5404 | - $where_statuses = ''; |
|
| 5405 | - if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
|
|
| 5406 | - $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
|
|
| 5407 | - } |
|
| 5402 | + // Skip listing with statuses trash, auto-draft etc... |
|
| 5403 | + $skip_statuses = geodir_imex_export_skip_statuses(); |
|
| 5404 | + $where_statuses = ''; |
|
| 5405 | + if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
|
|
| 5406 | + $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
|
|
| 5407 | + } |
|
| 5408 | 5408 | |
| 5409 | - /** |
|
| 5410 | - * Filter the SQL where clause part to filter posts in import/export. |
|
| 5411 | - * |
|
| 5412 | - * @since 1.6.4 |
|
| 5413 | - * @package GeoDirectory |
|
| 5414 | - * |
|
| 5415 | - * @param string $where SQL where clause part. |
|
| 5416 | - */ |
|
| 5417 | - $where_statuses = apply_filters( 'geodir_get_export_posts', $where_statuses, $post_type ); |
|
| 5418 | - |
|
| 5419 | - $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 );
|
|
| 5420 | - /** |
|
| 5421 | - * Modify returned posts SQL query for the current post type. |
|
| 5422 | - * |
|
| 5423 | - * @since 1.4.6 |
|
| 5424 | - * @package GeoDirectory |
|
| 5425 | - * |
|
| 5426 | - * @param int $query The SQL query. |
|
| 5427 | - * @param string $post_type Post type. |
|
| 5428 | - */ |
|
| 5429 | - $query = apply_filters( 'geodir_imex_export_posts_query', $query, $post_type ); |
|
| 5430 | - $results = (array)$wpdb->get_results( $wpdb->prepare( $query, $post_type ), ARRAY_A ); |
|
| 5431 | - |
|
| 5432 | - /** |
|
| 5433 | - * Modify returned post results for the current post type. |
|
| 5434 | - * |
|
| 5435 | - * @since 1.4.6 |
|
| 5436 | - * @package GeoDirectory |
|
| 5437 | - * |
|
| 5438 | - * @param object $results An object containing all post ids. |
|
| 5439 | - * @param string $post_type Post type. |
|
| 5440 | - */ |
|
| 5441 | - return apply_filters( 'geodir_export_posts', $results, $post_type ); |
|
| 5409 | + /** |
|
| 5410 | + * Filter the SQL where clause part to filter posts in import/export. |
|
| 5411 | + * |
|
| 5412 | + * @since 1.6.4 |
|
| 5413 | + * @package GeoDirectory |
|
| 5414 | + * |
|
| 5415 | + * @param string $where SQL where clause part. |
|
| 5416 | + */ |
|
| 5417 | + $where_statuses = apply_filters( 'geodir_get_export_posts', $where_statuses, $post_type ); |
|
| 5418 | + |
|
| 5419 | + $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 );
|
|
| 5420 | + /** |
|
| 5421 | + * Modify returned posts SQL query for the current post type. |
|
| 5422 | + * |
|
| 5423 | + * @since 1.4.6 |
|
| 5424 | + * @package GeoDirectory |
|
| 5425 | + * |
|
| 5426 | + * @param int $query The SQL query. |
|
| 5427 | + * @param string $post_type Post type. |
|
| 5428 | + */ |
|
| 5429 | + $query = apply_filters( 'geodir_imex_export_posts_query', $query, $post_type ); |
|
| 5430 | + $results = (array)$wpdb->get_results( $wpdb->prepare( $query, $post_type ), ARRAY_A ); |
|
| 5431 | + |
|
| 5432 | + /** |
|
| 5433 | + * Modify returned post results for the current post type. |
|
| 5434 | + * |
|
| 5435 | + * @since 1.4.6 |
|
| 5436 | + * @package GeoDirectory |
|
| 5437 | + * |
|
| 5438 | + * @param object $results An object containing all post ids. |
|
| 5439 | + * @param string $post_type Post type. |
|
| 5440 | + */ |
|
| 5441 | + return apply_filters( 'geodir_export_posts', $results, $post_type ); |
|
| 5442 | 5442 | } |
| 5443 | 5443 | |
| 5444 | 5444 | /** |
@@ -5457,26 +5457,26 @@ discard block |
||
| 5457 | 5457 | * @return string The SQL query. |
| 5458 | 5458 | */ |
| 5459 | 5459 | function geodir_imex_get_events_query( $query, $post_type ) {
|
| 5460 | - if ( $post_type == 'gd_event' ) {
|
|
| 5461 | - global $wpdb, $plugin_prefix; |
|
| 5460 | + if ( $post_type == 'gd_event' ) {
|
|
| 5461 | + global $wpdb, $plugin_prefix; |
|
| 5462 | 5462 | |
| 5463 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 5464 | - $schedule_table = EVENT_SCHEDULE; |
|
| 5463 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
| 5464 | + $schedule_table = EVENT_SCHEDULE; |
|
| 5465 | 5465 | |
| 5466 | - // Skip listing with statuses trash, auto-draft etc... |
|
| 5467 | - $skip_statuses = geodir_imex_export_skip_statuses(); |
|
| 5468 | - $where_statuses = ''; |
|
| 5469 | - if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
|
|
| 5470 | - $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
|
|
| 5471 | - } |
|
| 5466 | + // Skip listing with statuses trash, auto-draft etc... |
|
| 5467 | + $skip_statuses = geodir_imex_export_skip_statuses(); |
|
| 5468 | + $where_statuses = ''; |
|
| 5469 | + if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
|
|
| 5470 | + $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
|
|
| 5471 | + } |
|
| 5472 | 5472 | |
| 5473 | - /** This action is documented in geodirectory-functions/geodirectory-admin/admin_functions.php */ |
|
| 5474 | - $where_statuses = apply_filters( 'geodir_get_export_posts', $where_statuses, $post_type ); |
|
| 5473 | + /** This action is documented in geodirectory-functions/geodirectory-admin/admin_functions.php */ |
|
| 5474 | + $where_statuses = apply_filters( 'geodir_get_export_posts', $where_statuses, $post_type ); |
|
| 5475 | 5475 | |
| 5476 | - $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 );
|
|
| 5477 | - } |
|
| 5476 | + $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 );
|
|
| 5477 | + } |
|
| 5478 | 5478 | |
| 5479 | - return $query; |
|
| 5479 | + return $query; |
|
| 5480 | 5480 | } |
| 5481 | 5481 | |
| 5482 | 5482 | /** |
@@ -5498,36 +5498,36 @@ discard block |
||
| 5498 | 5498 | * @return int Total terms count. |
| 5499 | 5499 | */ |
| 5500 | 5500 | function geodir_get_terms_count( $post_type ) {
|
| 5501 | - $args = array( 'hide_empty' => 0 ); |
|
| 5501 | + $args = array( 'hide_empty' => 0 ); |
|
| 5502 | 5502 | |
| 5503 | - remove_all_filters( 'get_terms' ); |
|
| 5503 | + remove_all_filters( 'get_terms' ); |
|
| 5504 | 5504 | |
| 5505 | - $taxonomy = $post_type . 'category'; |
|
| 5505 | + $taxonomy = $post_type . 'category'; |
|
| 5506 | 5506 | |
| 5507 | - // WPML |
|
| 5508 | - $is_wpml = geodir_is_wpml(); |
|
| 5509 | - $active_lang = 'all'; |
|
| 5510 | - if ( $is_wpml ) {
|
|
| 5511 | - global $sitepress; |
|
| 5512 | - $active_lang = $sitepress->get_current_language(); |
|
| 5507 | + // WPML |
|
| 5508 | + $is_wpml = geodir_is_wpml(); |
|
| 5509 | + $active_lang = 'all'; |
|
| 5510 | + if ( $is_wpml ) {
|
|
| 5511 | + global $sitepress; |
|
| 5512 | + $active_lang = $sitepress->get_current_language(); |
|
| 5513 | 5513 | |
| 5514 | - if ( $active_lang != 'all' ) {
|
|
| 5515 | - $sitepress->switch_lang( 'all', true ); |
|
| 5516 | - } |
|
| 5517 | - } |
|
| 5518 | - // WPML |
|
| 5514 | + if ( $active_lang != 'all' ) {
|
|
| 5515 | + $sitepress->switch_lang( 'all', true ); |
|
| 5516 | + } |
|
| 5517 | + } |
|
| 5518 | + // WPML |
|
| 5519 | 5519 | |
| 5520 | - $count_terms = wp_count_terms( $taxonomy, $args ); |
|
| 5520 | + $count_terms = wp_count_terms( $taxonomy, $args ); |
|
| 5521 | 5521 | |
| 5522 | - // WPML |
|
| 5523 | - if ( $is_wpml && $active_lang !== 'all' ) {
|
|
| 5524 | - global $sitepress; |
|
| 5525 | - $sitepress->switch_lang( $active_lang, true ); |
|
| 5526 | - } |
|
| 5527 | - // WPML |
|
| 5528 | - $count_terms = !is_wp_error( $count_terms ) ? $count_terms : 0; |
|
| 5522 | + // WPML |
|
| 5523 | + if ( $is_wpml && $active_lang !== 'all' ) {
|
|
| 5524 | + global $sitepress; |
|
| 5525 | + $sitepress->switch_lang( $active_lang, true ); |
|
| 5526 | + } |
|
| 5527 | + // WPML |
|
| 5528 | + $count_terms = !is_wp_error( $count_terms ) ? $count_terms : 0; |
|
| 5529 | 5529 | |
| 5530 | - return $count_terms; |
|
| 5530 | + return $count_terms; |
|
| 5531 | 5531 | } |
| 5532 | 5532 | |
| 5533 | 5533 | /** |
@@ -5566,11 +5566,11 @@ discard block |
||
| 5566 | 5566 | $csv_row[] = 'cat_posttype'; |
| 5567 | 5567 | $csv_row[] = 'cat_parent'; |
| 5568 | 5568 | $csv_row[] = 'cat_schema'; |
| 5569 | - // WPML |
|
| 5569 | + // WPML |
|
| 5570 | 5570 | $is_wpml = geodir_is_wpml(); |
| 5571 | 5571 | if ($is_wpml) {
|
| 5572 | 5572 | $csv_row[] = 'cat_language'; |
| 5573 | - $csv_row[] = 'cat_id_original'; |
|
| 5573 | + $csv_row[] = 'cat_id_original'; |
|
| 5574 | 5574 | } |
| 5575 | 5575 | // WPML |
| 5576 | 5576 | $csv_row[] = 'cat_description'; |
@@ -5600,10 +5600,10 @@ discard block |
||
| 5600 | 5600 | $csv_row[] = $post_type; |
| 5601 | 5601 | $csv_row[] = $cat_parent; |
| 5602 | 5602 | $csv_row[] = get_tax_meta( $term->term_id, 'ct_cat_schema', false, $post_type ); |
| 5603 | - // WPML |
|
| 5603 | + // WPML |
|
| 5604 | 5604 | if ($is_wpml) {
|
| 5605 | 5605 | $csv_row[] = geodir_get_language_for_element( $term->term_id, 'tax_' . $taxonomy ); |
| 5606 | - $csv_row[] = geodir_imex_original_post_id( $term->term_id, 'tax_' . $taxonomy ); |
|
| 5606 | + $csv_row[] = geodir_imex_original_post_id( $term->term_id, 'tax_' . $taxonomy ); |
|
| 5607 | 5607 | } |
| 5608 | 5608 | // WPML |
| 5609 | 5609 | $csv_row[] = $term->description; |
@@ -6199,43 +6199,43 @@ discard block |
||
| 6199 | 6199 | * @param string $status Post status. |
| 6200 | 6200 | */ |
| 6201 | 6201 | function geodir_create_page($slug, $option, $page_title = '', $page_content = '', $post_parent = 0, $status = 'publish') {
|
| 6202 | - global $wpdb, $current_user; |
|
| 6203 | - |
|
| 6204 | - $option_value = get_option($option); |
|
| 6205 | - |
|
| 6206 | - if ($option_value > 0) : |
|
| 6207 | - if (get_post($option_value)) : |
|
| 6208 | - // Page exists |
|
| 6209 | - return; |
|
| 6210 | - endif; |
|
| 6211 | - endif; |
|
| 6212 | - |
|
| 6213 | - $page_found = $wpdb->get_var( |
|
| 6214 | - $wpdb->prepare( |
|
| 6215 | - "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;", |
|
| 6216 | - array($slug) |
|
| 6217 | - ) |
|
| 6218 | - ); |
|
| 6219 | - |
|
| 6220 | - if ($page_found) : |
|
| 6221 | - // Page exists |
|
| 6222 | - if (!$option_value) update_option($option, $page_found); |
|
| 6223 | - return; |
|
| 6224 | - endif; |
|
| 6225 | - |
|
| 6226 | - $page_data = array( |
|
| 6227 | - 'post_status' => $status, |
|
| 6228 | - 'post_type' => 'page', |
|
| 6229 | - 'post_author' => $current_user->ID, |
|
| 6230 | - 'post_name' => $slug, |
|
| 6231 | - 'post_title' => $page_title, |
|
| 6232 | - 'post_content' => $page_content, |
|
| 6233 | - 'post_parent' => $post_parent, |
|
| 6234 | - 'comment_status' => 'closed' |
|
| 6235 | - ); |
|
| 6236 | - $page_id = wp_insert_post($page_data); |
|
| 6237 | - |
|
| 6238 | - add_option($option, $page_id); |
|
| 6202 | + global $wpdb, $current_user; |
|
| 6203 | + |
|
| 6204 | + $option_value = get_option($option); |
|
| 6205 | + |
|
| 6206 | + if ($option_value > 0) : |
|
| 6207 | + if (get_post($option_value)) : |
|
| 6208 | + // Page exists |
|
| 6209 | + return; |
|
| 6210 | + endif; |
|
| 6211 | + endif; |
|
| 6212 | + |
|
| 6213 | + $page_found = $wpdb->get_var( |
|
| 6214 | + $wpdb->prepare( |
|
| 6215 | + "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;", |
|
| 6216 | + array($slug) |
|
| 6217 | + ) |
|
| 6218 | + ); |
|
| 6219 | + |
|
| 6220 | + if ($page_found) : |
|
| 6221 | + // Page exists |
|
| 6222 | + if (!$option_value) update_option($option, $page_found); |
|
| 6223 | + return; |
|
| 6224 | + endif; |
|
| 6225 | + |
|
| 6226 | + $page_data = array( |
|
| 6227 | + 'post_status' => $status, |
|
| 6228 | + 'post_type' => 'page', |
|
| 6229 | + 'post_author' => $current_user->ID, |
|
| 6230 | + 'post_name' => $slug, |
|
| 6231 | + 'post_title' => $page_title, |
|
| 6232 | + 'post_content' => $page_content, |
|
| 6233 | + 'post_parent' => $post_parent, |
|
| 6234 | + 'comment_status' => 'closed' |
|
| 6235 | + ); |
|
| 6236 | + $page_id = wp_insert_post($page_data); |
|
| 6237 | + |
|
| 6238 | + add_option($option, $page_id); |
|
| 6239 | 6239 | |
| 6240 | 6240 | } |
| 6241 | 6241 | |
@@ -6266,9 +6266,9 @@ discard block |
||
| 6266 | 6266 | * @package GeoDirectory |
| 6267 | 6267 | */ |
| 6268 | 6268 | function geodir_admin_upgrade_notice() {
|
| 6269 | - $class = "error"; |
|
| 6270 | - $message = __("Please update core GeoDirectory or some addons may not function correctly.","geodirectory");
|
|
| 6271 | - echo"<div class=\"$class\"> <p>$message</p></div>"; |
|
| 6269 | + $class = "error"; |
|
| 6270 | + $message = __("Please update core GeoDirectory or some addons may not function correctly.","geodirectory");
|
|
| 6271 | + echo"<div class=\"$class\"> <p>$message</p></div>"; |
|
| 6272 | 6272 | } |
| 6273 | 6273 | |
| 6274 | 6274 | /** |
@@ -6281,18 +6281,18 @@ discard block |
||
| 6281 | 6281 | */ |
| 6282 | 6282 | function geodire_admin_upgrade_notice( $plugin_data, $r ) |
| 6283 | 6283 | {
|
| 6284 | - // readme contents |
|
| 6285 | - $args = array( |
|
| 6286 | - 'timeout' => 15, |
|
| 6287 | - 'redirection' => 5 |
|
| 6288 | - ); |
|
| 6289 | - $url = "http://plugins.svn.wordpress.org/geodirectory/trunk/readme.txt"; |
|
| 6290 | - $data = wp_remote_get( $url, $args ); |
|
| 6284 | + // readme contents |
|
| 6285 | + $args = array( |
|
| 6286 | + 'timeout' => 15, |
|
| 6287 | + 'redirection' => 5 |
|
| 6288 | + ); |
|
| 6289 | + $url = "http://plugins.svn.wordpress.org/geodirectory/trunk/readme.txt"; |
|
| 6290 | + $data = wp_remote_get( $url, $args ); |
|
| 6291 | 6291 | |
| 6292 | - if (!is_wp_error($data) && $data['response']['code'] == 200) {
|
|
| 6292 | + if (!is_wp_error($data) && $data['response']['code'] == 200) {
|
|
| 6293 | 6293 | |
| 6294 | - geodir_in_plugin_update_message($data['body']); |
|
| 6295 | - } |
|
| 6294 | + geodir_in_plugin_update_message($data['body']); |
|
| 6295 | + } |
|
| 6296 | 6296 | } |
| 6297 | 6297 | |
| 6298 | 6298 | |
@@ -6300,28 +6300,28 @@ discard block |
||
| 6300 | 6300 | * @param string $content http response body |
| 6301 | 6301 | */ |
| 6302 | 6302 | function geodir_in_plugin_update_message($content) {
|
| 6303 | - // Output Upgrade Notice |
|
| 6304 | - $matches = null; |
|
| 6305 | - $regexp = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( GEODIRECTORY_VERSION ) . '\s*=|$)~Uis'; |
|
| 6306 | - $upgrade_notice = ''; |
|
| 6307 | - if ( preg_match( $regexp, $content, $matches ) ) {
|
|
| 6308 | - if(empty($matches)){return;}
|
|
| 6309 | - |
|
| 6310 | - $version = trim( $matches[1] ); |
|
| 6311 | - if($version && $version>GEODIRECTORY_VERSION){
|
|
| 6312 | - |
|
| 6313 | - |
|
| 6314 | - $notices = (array) preg_split('~[\r\n]+~', trim( $matches[2] ) );
|
|
| 6315 | - if ( version_compare( GEODIRECTORY_VERSION, $version, '<' ) ) {
|
|
| 6316 | - $upgrade_notice .= '<div class="geodir_plugin_upgrade_notice">'; |
|
| 6317 | - foreach ( $notices as $index => $line ) {
|
|
| 6318 | - $upgrade_notice .= wp_kses_post( preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line ) );
|
|
| 6319 | - } |
|
| 6320 | - $upgrade_notice .= '</div> '; |
|
| 6321 | - } |
|
| 6322 | - } |
|
| 6323 | - } |
|
| 6324 | - echo $upgrade_notice; |
|
| 6303 | + // Output Upgrade Notice |
|
| 6304 | + $matches = null; |
|
| 6305 | + $regexp = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( GEODIRECTORY_VERSION ) . '\s*=|$)~Uis'; |
|
| 6306 | + $upgrade_notice = ''; |
|
| 6307 | + if ( preg_match( $regexp, $content, $matches ) ) {
|
|
| 6308 | + if(empty($matches)){return;}
|
|
| 6309 | + |
|
| 6310 | + $version = trim( $matches[1] ); |
|
| 6311 | + if($version && $version>GEODIRECTORY_VERSION){
|
|
| 6312 | + |
|
| 6313 | + |
|
| 6314 | + $notices = (array) preg_split('~[\r\n]+~', trim( $matches[2] ) );
|
|
| 6315 | + if ( version_compare( GEODIRECTORY_VERSION, $version, '<' ) ) {
|
|
| 6316 | + $upgrade_notice .= '<div class="geodir_plugin_upgrade_notice">'; |
|
| 6317 | + foreach ( $notices as $index => $line ) {
|
|
| 6318 | + $upgrade_notice .= wp_kses_post( preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line ) );
|
|
| 6319 | + } |
|
| 6320 | + $upgrade_notice .= '</div> '; |
|
| 6321 | + } |
|
| 6322 | + } |
|
| 6323 | + } |
|
| 6324 | + echo $upgrade_notice; |
|
| 6325 | 6325 | } |
| 6326 | 6326 | |
| 6327 | 6327 | /** |
@@ -6354,19 +6354,19 @@ discard block |
||
| 6354 | 6354 | * @param array Listing statuses to be skipped. |
| 6355 | 6355 | */ |
| 6356 | 6356 | function geodir_imex_export_skip_statuses() {
|
| 6357 | - $statuses = array( 'trash', 'auto-draft' ); |
|
| 6357 | + $statuses = array( 'trash', 'auto-draft' ); |
|
| 6358 | 6358 | |
| 6359 | - /** |
|
| 6360 | - * Filter the statuses to skip during GD export listings. |
|
| 6361 | - * |
|
| 6362 | - * @since 1.6.0 |
|
| 6363 | - * @package GeoDirectory |
|
| 6364 | - * |
|
| 6365 | - * @param array $statuses Listing statuses to be skipped. |
|
| 6366 | - */ |
|
| 6367 | - $statuses = apply_filters( 'geodir_imex_export_skip_statuses', $statuses ); |
|
| 6359 | + /** |
|
| 6360 | + * Filter the statuses to skip during GD export listings. |
|
| 6361 | + * |
|
| 6362 | + * @since 1.6.0 |
|
| 6363 | + * @package GeoDirectory |
|
| 6364 | + * |
|
| 6365 | + * @param array $statuses Listing statuses to be skipped. |
|
| 6366 | + */ |
|
| 6367 | + $statuses = apply_filters( 'geodir_imex_export_skip_statuses', $statuses ); |
|
| 6368 | 6368 | |
| 6369 | - return $statuses; |
|
| 6369 | + return $statuses; |
|
| 6370 | 6370 | } |
| 6371 | 6371 | |
| 6372 | 6372 | /** |
@@ -6378,15 +6378,15 @@ discard block |
||
| 6378 | 6378 | * @since 1.6.3 |
| 6379 | 6379 | */ |
| 6380 | 6380 | function geodir_admin_dequeue_scripts() {
|
| 6381 | - // EDD |
|
| 6382 | - if (wp_script_is('jquery-chosen', 'enqueued')) {
|
|
| 6383 | - wp_dequeue_script('jquery-chosen');
|
|
| 6384 | - } |
|
| 6381 | + // EDD |
|
| 6382 | + if (wp_script_is('jquery-chosen', 'enqueued')) {
|
|
| 6383 | + wp_dequeue_script('jquery-chosen');
|
|
| 6384 | + } |
|
| 6385 | 6385 | |
| 6386 | - // Ultimate Addons for Visual Composer |
|
| 6387 | - if (wp_script_is('ultimate-vc-backend-script', 'enqueued')) {
|
|
| 6388 | - wp_dequeue_script('ultimate-vc-backend-script');
|
|
| 6389 | - } |
|
| 6386 | + // Ultimate Addons for Visual Composer |
|
| 6387 | + if (wp_script_is('ultimate-vc-backend-script', 'enqueued')) {
|
|
| 6388 | + wp_dequeue_script('ultimate-vc-backend-script');
|
|
| 6389 | + } |
|
| 6390 | 6390 | } |
| 6391 | 6391 | |
| 6392 | 6392 | /** |
@@ -6402,48 +6402,48 @@ discard block |
||
| 6402 | 6402 | * @return string SQL where clause part. |
| 6403 | 6403 | */ |
| 6404 | 6404 | function geodir_imex_get_filter_where($where = '', $post_type = '') {
|
| 6405 | - global $wpdb; |
|
| 6405 | + global $wpdb; |
|
| 6406 | 6406 | |
| 6407 | - $filters = !empty( $_REQUEST['gd_imex'] ) && is_array( $_REQUEST['gd_imex'] ) ? $_REQUEST['gd_imex'] : NULL; |
|
| 6407 | + $filters = !empty( $_REQUEST['gd_imex'] ) && is_array( $_REQUEST['gd_imex'] ) ? $_REQUEST['gd_imex'] : NULL; |
|
| 6408 | 6408 | |
| 6409 | - if ( !empty( $filters ) ) {
|
|
| 6410 | - foreach ( $filters as $field => $value ) {
|
|
| 6411 | - switch ($field) {
|
|
| 6412 | - case 'start_date': |
|
| 6413 | - $where .= " AND `" . $wpdb->posts . "`.`post_date` >= '" . sanitize_text_field( $value ) . " 00:00:00'"; |
|
| 6414 | - break; |
|
| 6415 | - case 'end_date': |
|
| 6416 | - $where .= " AND `" . $wpdb->posts . "`.`post_date` <= '" . sanitize_text_field( $value ) . " 23:59:59'"; |
|
| 6417 | - break; |
|
| 6418 | - } |
|
| 6419 | - } |
|
| 6420 | - } |
|
| 6409 | + if ( !empty( $filters ) ) {
|
|
| 6410 | + foreach ( $filters as $field => $value ) {
|
|
| 6411 | + switch ($field) {
|
|
| 6412 | + case 'start_date': |
|
| 6413 | + $where .= " AND `" . $wpdb->posts . "`.`post_date` >= '" . sanitize_text_field( $value ) . " 00:00:00'"; |
|
| 6414 | + break; |
|
| 6415 | + case 'end_date': |
|
| 6416 | + $where .= " AND `" . $wpdb->posts . "`.`post_date` <= '" . sanitize_text_field( $value ) . " 23:59:59'"; |
|
| 6417 | + break; |
|
| 6418 | + } |
|
| 6419 | + } |
|
| 6420 | + } |
|
| 6421 | 6421 | |
| 6422 | - return $where; |
|
| 6422 | + return $where; |
|
| 6423 | 6423 | } |
| 6424 | 6424 | add_filter('geodir_get_posts_count', 'geodir_imex_get_filter_where', 10, 2);
|
| 6425 | 6425 | add_filter('geodir_get_export_posts', 'geodir_imex_get_filter_where', 10, 2);
|
| 6426 | 6426 | |
| 6427 | 6427 | |
| 6428 | 6428 | function geodir_fix_for_primer_theme(){
|
| 6429 | - if(!defined( 'PRIMER_VERSION' )){return;}
|
|
| 6430 | - global $pagenow; |
|
| 6429 | + if(!defined( 'PRIMER_VERSION' )){return;}
|
|
| 6430 | + global $pagenow; |
|
| 6431 | 6431 | |
| 6432 | - if ( ( 'post.php' === $pagenow || 'post-new.php' === $pagenow ) && (isset($_REQUEST['post_type']) || isset($_REQUEST['post']) ) ){
|
|
| 6432 | + if ( ( 'post.php' === $pagenow || 'post-new.php' === $pagenow ) && (isset($_REQUEST['post_type']) || isset($_REQUEST['post']) ) ){
|
|
| 6433 | 6433 | |
| 6434 | - $post_type = isset($_REQUEST['post_type']) ? esc_attr($_REQUEST['post_type']) : get_post_type( $_GET['post'] ); |
|
| 6434 | + $post_type = isset($_REQUEST['post_type']) ? esc_attr($_REQUEST['post_type']) : get_post_type( $_GET['post'] ); |
|
| 6435 | 6435 | |
| 6436 | - $post_types = geodir_get_posttypes(); |
|
| 6437 | - if ($post_type && in_array($post_type, $post_types) ) {
|
|
| 6438 | - global $primer_customizer_layouts; |
|
| 6439 | - remove_action( 'add_meta_boxes', array( $primer_customizer_layouts, 'add_meta_box' ), 10); |
|
| 6440 | - } |
|
| 6441 | - } |
|
| 6436 | + $post_types = geodir_get_posttypes(); |
|
| 6437 | + if ($post_type && in_array($post_type, $post_types) ) {
|
|
| 6438 | + global $primer_customizer_layouts; |
|
| 6439 | + remove_action( 'add_meta_boxes', array( $primer_customizer_layouts, 'add_meta_box' ), 10); |
|
| 6440 | + } |
|
| 6441 | + } |
|
| 6442 | 6442 | |
| 6443 | 6443 | } |
| 6444 | 6444 | |
| 6445 | 6445 | if(is_admin()){
|
| 6446 | - add_action('add_meta_boxes','geodir_fix_for_primer_theme',0);
|
|
| 6446 | + add_action('add_meta_boxes','geodir_fix_for_primer_theme',0);
|
|
| 6447 | 6447 | } |
| 6448 | 6448 | |
| 6449 | 6449 | |
@@ -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 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | wp_register_style('font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION);
|
| 71 | 71 | wp_enqueue_style('font-awesome');
|
| 72 | 72 | |
| 73 | - wp_register_script('geodirectory-admin', geodir_plugin_url() . '/geodirectory-assets/js/admin-req.min.js', array('jquery'), GEODIRECTORY_VERSION);
|
|
| 73 | + wp_register_script('geodirectory-admin', geodir_plugin_url().'/geodirectory-assets/js/admin-req.min.js', array('jquery'), GEODIRECTORY_VERSION);
|
|
| 74 | 74 | wp_enqueue_script('geodirectory-admin');
|
| 75 | 75 | |
| 76 | 76 | } |
@@ -89,60 +89,60 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | wp_enqueue_script('jquery');
|
| 91 | 91 | |
| 92 | - 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);
|
|
| 92 | + 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 | 93 | |
| 94 | - wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.js', array('jquery'), GEODIRECTORY_VERSION);
|
|
| 94 | + wp_register_script('chosen', geodir_plugin_url().'/geodirectory-assets/js/chosen.jquery.js', array('jquery'), GEODIRECTORY_VERSION);
|
|
| 95 | 95 | wp_enqueue_script('chosen');
|
| 96 | 96 | |
| 97 | - wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.js', array(), GEODIRECTORY_VERSION);
|
|
| 97 | + wp_register_script('geodirectory-choose-ajax', geodir_plugin_url().'/geodirectory-assets/js/ajax-chosen.js', array(), GEODIRECTORY_VERSION);
|
|
| 98 | 98 | wp_enqueue_script('geodirectory-choose-ajax');
|
| 99 | 99 | |
| 100 | 100 | if (isset($_REQUEST['listing_type'])) {
|
| 101 | - wp_register_script('geodirectory-custom-fields-script', geodir_plugin_url() . '/geodirectory-assets/js/custom_fields.js', array(), GEODIRECTORY_VERSION);
|
|
| 101 | + wp_register_script('geodirectory-custom-fields-script', geodir_plugin_url().'/geodirectory-assets/js/custom_fields.js', array(), GEODIRECTORY_VERSION);
|
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | wp_enqueue_script('geodirectory-custom-fields-script');
|
| 105 | - $plugin_path = geodir_plugin_url() . '/geodirectory-functions/cat-meta-functions'; |
|
| 105 | + $plugin_path = geodir_plugin_url().'/geodirectory-functions/cat-meta-functions'; |
|
| 106 | 106 | |
| 107 | - wp_enqueue_script('tax-meta-clss', $plugin_path . '/js/tax-meta-clss.js', array('jquery'), null, true);
|
|
| 107 | + wp_enqueue_script('tax-meta-clss', $plugin_path.'/js/tax-meta-clss.js', array('jquery'), null, true);
|
|
| 108 | 108 | |
| 109 | 109 | if (in_array($geodir_map_name, array('auto', 'google'))) {
|
| 110 | - $map_lang = "&language=" . geodir_get_map_default_language(); |
|
| 111 | - $map_key = "&key=" . geodir_get_map_api_key(); |
|
| 110 | + $map_lang = "&language=".geodir_get_map_default_language(); |
|
| 111 | + $map_key = "&key=".geodir_get_map_api_key(); |
|
| 112 | 112 | /** This filter is documented in geodirectory_template_tags.php */ |
| 113 | 113 | $map_extra = apply_filters('geodir_googlemap_script_extra', '');
|
| 114 | - wp_enqueue_script('geodirectory-googlemap-script', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra, '', NULL);
|
|
| 114 | + wp_enqueue_script('geodirectory-googlemap-script', 'https://maps.google.com/maps/api/js?'.$map_lang.$map_key.$map_extra, '', NULL);
|
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | if ($geodir_map_name == 'osm') {
|
| 118 | 118 | // Leaflet OpenStreetMap |
| 119 | - wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
|
|
| 119 | + wp_register_style('geodirectory-leaflet-style', geodir_plugin_url().'/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
|
|
| 120 | 120 | wp_enqueue_style('geodirectory-leaflet-style');
|
| 121 | 121 | |
| 122 | - wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 122 | + wp_register_script('geodirectory-leaflet-script', geodir_plugin_url().'/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 123 | 123 | wp_enqueue_script('geodirectory-leaflet-script');
|
| 124 | 124 | |
| 125 | - wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.js', array('geodirectory-leaflet-script'), GEODIRECTORY_VERSION);
|
|
| 125 | + wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url().'/geodirectory-assets/leaflet/osm.geocode.js', array('geodirectory-leaflet-script'), GEODIRECTORY_VERSION);
|
|
| 126 | 126 | wp_enqueue_script('geodirectory-leaflet-geo-script');
|
| 127 | 127 | } |
| 128 | - wp_enqueue_script( 'jquery-ui-autocomplete' ); |
|
| 128 | + wp_enqueue_script('jquery-ui-autocomplete');
|
|
| 129 | 129 | |
| 130 | - wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true);
|
|
| 130 | + wp_register_script('geodirectory-goMap-script', geodir_plugin_url().'/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true);
|
|
| 131 | 131 | wp_enqueue_script('geodirectory-goMap-script');
|
| 132 | 132 | |
| 133 | - wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.js', array(), GEODIRECTORY_VERSION);
|
|
| 133 | + wp_register_script('geodirectory-goMap-script', geodir_plugin_url().'/geodirectory-assets/js/goMap.js', array(), GEODIRECTORY_VERSION);
|
|
| 134 | 134 | wp_enqueue_script('geodirectory-goMap-script');
|
| 135 | 135 | |
| 136 | 136 | // font awesome rating script |
| 137 | 137 | if (get_option('geodir_reviewrating_enable_font_awesome')) {
|
| 138 | - wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 138 | + wp_register_script('geodir-barrating-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 139 | 139 | wp_enqueue_script('geodir-barrating-js');
|
| 140 | 140 | } else { // default rating script
|
| 141 | - wp_register_script('geodir-jRating-js', geodir_plugin_url() . '/geodirectory-assets/js/jRating.jquery.js', array(), GEODIRECTORY_VERSION);
|
|
| 141 | + wp_register_script('geodir-jRating-js', geodir_plugin_url().'/geodirectory-assets/js/jRating.jquery.js', array(), GEODIRECTORY_VERSION);
|
|
| 142 | 142 | wp_enqueue_script('geodir-jRating-js');
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 145 | + wp_register_script('geodir-on-document-load', geodir_plugin_url().'/geodirectory-assets/js/on_document_load.min.js', array(), GEODIRECTORY_VERSION);
|
|
| 146 | 146 | wp_enqueue_script('geodir-on-document-load');
|
| 147 | 147 | |
| 148 | 148 | |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | wp_enqueue_script('plupload-all');
|
| 151 | 151 | wp_enqueue_script('jquery-ui-sortable');
|
| 152 | 152 | |
| 153 | - wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.js', array(), GEODIRECTORY_VERSION);
|
|
| 153 | + wp_register_script('geodirectory-plupload-script', geodir_plugin_url().'/geodirectory-assets/js/geodirectory-plupload.js', array(), GEODIRECTORY_VERSION);
|
|
| 154 | 154 | wp_enqueue_script('geodirectory-plupload-script');
|
| 155 | 155 | |
| 156 | 156 | // SCRIPT FOR UPLOAD END |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | wp_localize_script('geodirectory-custom-fields-script', 'geodir_admin_ajax', $ajax_cons_data);
|
| 205 | 205 | |
| 206 | 206 | |
| 207 | - wp_register_script('geodirectory-admin-script', geodir_plugin_url() . '/geodirectory-assets/js/admin.js', array(), GEODIRECTORY_VERSION);
|
|
| 207 | + wp_register_script('geodirectory-admin-script', geodir_plugin_url().'/geodirectory-assets/js/admin.js', array(), GEODIRECTORY_VERSION);
|
|
| 208 | 208 | wp_enqueue_script('geodirectory-admin-script');
|
| 209 | 209 | |
| 210 | 210 | wp_enqueue_style('farbtastic');
|
@@ -212,10 +212,10 @@ discard block |
||
| 212 | 212 | |
| 213 | 213 | $screen = get_current_screen(); |
| 214 | 214 | if ($screen->base == 'post' && in_array($screen->post_type, geodir_get_posttypes())) {
|
| 215 | - wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation_admin.js');
|
|
| 215 | + wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url().'/geodirectory-assets/js/listing_validation_admin.js');
|
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | - $ajax_cons_data = array('url' => esc_url(__(get_option('siteurl') . '?geodir_ajax=true')));
|
|
| 218 | + $ajax_cons_data = array('url' => esc_url(__(get_option('siteurl').'?geodir_ajax=true')));
|
|
| 219 | 219 | wp_localize_script('geodirectory-admin-script', 'geodir_ajax', $ajax_cons_data);
|
| 220 | 220 | |
| 221 | 221 | } |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | |
| 239 | 239 | if (current_user_can('manage_options')) $menu[] = array('', 'read', 'separator-geodirectory', '', 'wp-menu-separator geodirectory');
|
| 240 | 240 | |
| 241 | - add_menu_page(__('Geodirectory', 'geodirectory'), __('Geodirectory', 'geodirectory'), 'manage_options', 'geodirectory', 'geodir_admin_panel', geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico', '55.1984');
|
|
| 241 | + add_menu_page(__('Geodirectory', 'geodirectory'), __('Geodirectory', 'geodirectory'), 'manage_options', 'geodirectory', 'geodir_admin_panel', geodir_plugin_url().'/geodirectory-assets/images/favicon.ico', '55.1984');
|
|
| 242 | 242 | |
| 243 | 243 | |
| 244 | 244 | } |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | $geodir_menu_order[] = 'separator-geodirectory'; |
| 273 | 273 | if (!empty($post_types)) {
|
| 274 | 274 | foreach ($post_types as $post_type) {
|
| 275 | - $geodir_menu_order[] = 'edit.php?post_type=' . $post_type; |
|
| 275 | + $geodir_menu_order[] = 'edit.php?post_type='.$post_type; |
|
| 276 | 276 | } |
| 277 | 277 | } |
| 278 | 278 | $geodir_menu_order[] = $item; |
@@ -315,8 +315,8 @@ discard block |
||
| 315 | 315 | {
|
| 316 | 316 | if (isset($_REQUEST['installed']) && $_REQUEST['installed'] != '') {
|
| 317 | 317 | echo '<div id="message" class="updated fade"> |
| 318 | - <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>
|
|
| 319 | - <p><strong>' . __('Geodirectory has been installed and setup. Enjoy :)', 'geodirectory') . '</strong></p>
|
|
| 318 | + <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>
|
|
| 319 | + <p><strong>' . __('Geodirectory has been installed and setup. Enjoy :)', 'geodirectory').'</strong></p>
|
|
| 320 | 320 | </div>'; |
| 321 | 321 | |
| 322 | 322 | } |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | if (isset($_REQUEST['msg']) && $_REQUEST['msg'] != '') {
|
| 325 | 325 | switch ($_REQUEST['msg']) {
|
| 326 | 326 | case 'success': |
| 327 | - echo '<div id="message" class="updated fade"><p><strong>' . __('Your settings have been saved.', 'geodirectory') . '</strong></p></div>';
|
|
| 327 | + echo '<div id="message" class="updated fade"><p><strong>'.__('Your settings have been saved.', 'geodirectory').'</strong></p></div>';
|
|
| 328 | 328 | flush_rewrite_rules(false); |
| 329 | 329 | |
| 330 | 330 | break; |
@@ -332,30 +332,30 @@ discard block |
||
| 332 | 332 | $gderr = isset($_REQUEST['gderr']) ? $_REQUEST['gderr'] : ''; |
| 333 | 333 | |
| 334 | 334 | if ($gderr == 21) |
| 335 | - 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>';
|
|
| 335 | + 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>';
|
|
| 336 | 336 | else |
| 337 | - echo '<div id="message" class="error fade"><p><strong>' . __('Error: Your settings have not been saved, please try again.', 'geodirectory') . '</strong></p></div>';
|
|
| 337 | + echo '<div id="message" class="error fade"><p><strong>'.__('Error: Your settings have not been saved, please try again.', 'geodirectory').'</strong></p></div>';
|
|
| 338 | 338 | break; |
| 339 | 339 | } |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | 342 | $geodir_load_map = get_option('geodir_load_map');
|
| 343 | 343 | $need_map_key = false; |
| 344 | - if($geodir_load_map=='' || $geodir_load_map=='google' || $geodir_load_map=='auto' ){
|
|
| 344 | + if ($geodir_load_map == '' || $geodir_load_map == 'google' || $geodir_load_map == 'auto') {
|
|
| 345 | 345 | $need_map_key = true; |
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | if (!geodir_get_map_api_key() && $need_map_key) {
|
| 349 | - 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>';
|
|
| 349 | + 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>';
|
|
| 350 | 350 | } |
| 351 | 351 | |
| 352 | 352 | if (!geodir_is_default_location_set()) {
|
| 353 | - 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>';
|
|
| 353 | + 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>';
|
|
| 354 | 354 | |
| 355 | 355 | } |
| 356 | 356 | |
| 357 | 357 | if (!function_exists('curl_init')) {
|
| 358 | - 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>';
|
|
| 358 | + 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>';
|
|
| 359 | 359 | |
| 360 | 360 | } |
| 361 | 361 | |
@@ -375,18 +375,18 @@ discard block |
||
| 375 | 375 | function geodir_handle_option_form_submit($current_tab) |
| 376 | 376 | {
|
| 377 | 377 | global $geodir_settings; |
| 378 | - if (file_exists(dirname(__FILE__) . '/option-pages/' . $current_tab . '_array.php')) {
|
|
| 378 | + if (file_exists(dirname(__FILE__).'/option-pages/'.$current_tab.'_array.php')) {
|
|
| 379 | 379 | /** |
| 380 | 380 | * Contains settings array for current tab. |
| 381 | 381 | * |
| 382 | 382 | * @since 1.0.0 |
| 383 | 383 | * @package GeoDirectory |
| 384 | 384 | */ |
| 385 | - include_once('option-pages/' . $current_tab . '_array.php');
|
|
| 385 | + include_once('option-pages/'.$current_tab.'_array.php');
|
|
| 386 | 386 | } |
| 387 | 387 | if (isset($_POST) && $_POST && isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') : |
| 388 | 388 | if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
|
| 389 | - if (!wp_verify_nonce($_REQUEST['_wpnonce-' . $current_tab], 'geodir-settings-' . $current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
|
|
| 389 | + if (!wp_verify_nonce($_REQUEST['_wpnonce-'.$current_tab], 'geodir-settings-'.$current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
|
|
| 390 | 390 | |
| 391 | 391 | /** |
| 392 | 392 | * Fires before updating geodirectory admin settings. |
@@ -419,13 +419,13 @@ discard block |
||
| 419 | 419 | * @param string $current_tab The current settings tab name. |
| 420 | 420 | * @param array $geodir_settings[$current_tab] The array of settings for the current settings tab. |
| 421 | 421 | */ |
| 422 | - do_action('geodir_update_options_' . $current_tab, $geodir_settings[$current_tab]);
|
|
| 422 | + do_action('geodir_update_options_'.$current_tab, $geodir_settings[$current_tab]);
|
|
| 423 | 423 | |
| 424 | 424 | flush_rewrite_rules(false); |
| 425 | 425 | |
| 426 | 426 | $current_tab = isset($_REQUEST['tab']) ? $_REQUEST['tab'] : ''; |
| 427 | 427 | |
| 428 | - $redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $_REQUEST['active_tab'] . '&msg=success');
|
|
| 428 | + $redirect_url = admin_url('admin.php?page=geodirectory&tab='.$current_tab.'&active_tab='.$_REQUEST['active_tab'].'&msg=success');
|
|
| 429 | 429 | |
| 430 | 430 | wp_redirect($redirect_url); |
| 431 | 431 | exit(); |
@@ -464,18 +464,18 @@ discard block |
||
| 464 | 464 | |
| 465 | 465 | elseif (isset($value['type']) && $value['type'] == 'image_width') : |
| 466 | 466 | |
| 467 | - if (isset($value['id']) && isset($_POST[$value['id'] . '_width'])) {
|
|
| 468 | - update_option($value['id'] . '_width', $_POST[$value['id'] . '_width']); |
|
| 469 | - update_option($value['id'] . '_height', $_POST[$value['id'] . '_height']); |
|
| 470 | - if (isset($_POST[$value['id'] . '_crop'])) : |
|
| 471 | - update_option($value['id'] . '_crop', 1); |
|
| 467 | + if (isset($value['id']) && isset($_POST[$value['id'].'_width'])) {
|
|
| 468 | + update_option($value['id'].'_width', $_POST[$value['id'].'_width']); |
|
| 469 | + update_option($value['id'].'_height', $_POST[$value['id'].'_height']); |
|
| 470 | + if (isset($_POST[$value['id'].'_crop'])) : |
|
| 471 | + update_option($value['id'].'_crop', 1); |
|
| 472 | 472 | else : |
| 473 | - update_option($value['id'] . '_crop', 0); |
|
| 473 | + update_option($value['id'].'_crop', 0); |
|
| 474 | 474 | endif; |
| 475 | 475 | } else {
|
| 476 | - update_option($value['id'] . '_width', $value['std']); |
|
| 477 | - update_option($value['id'] . '_height', $value['std']); |
|
| 478 | - update_option($value['id'] . '_crop', 1); |
|
| 476 | + update_option($value['id'].'_width', $value['std']); |
|
| 477 | + update_option($value['id'].'_height', $value['std']); |
|
| 478 | + update_option($value['id'].'_crop', 1); |
|
| 479 | 479 | } |
| 480 | 480 | |
| 481 | 481 | elseif (isset($value['type']) && $value['type'] == 'map') : |
@@ -517,12 +517,12 @@ discard block |
||
| 517 | 517 | elseif (isset($value['type']) && $value['type'] == 'file') : |
| 518 | 518 | |
| 519 | 519 | |
| 520 | - if (isset($_POST[$value['id'] . '_remove']) && $_POST[$value['id'] . '_remove']) {// if remove is set then remove the file
|
|
| 520 | + if (isset($_POST[$value['id'].'_remove']) && $_POST[$value['id'].'_remove']) {// if remove is set then remove the file
|
|
| 521 | 521 | |
| 522 | 522 | if (get_option($value['id'])) {
|
| 523 | 523 | $image_name_arr = explode('/', get_option($value['id']));
|
| 524 | 524 | $noimg_name = end($image_name_arr); |
| 525 | - $img_path = $uploads['path'] . '/' . $noimg_name; |
|
| 525 | + $img_path = $uploads['path'].'/'.$noimg_name; |
|
| 526 | 526 | if (file_exists($img_path)) |
| 527 | 527 | unlink($img_path); |
| 528 | 528 | } |
@@ -550,7 +550,7 @@ discard block |
||
| 550 | 550 | if (get_option($value['id'])) {
|
| 551 | 551 | $image_name_arr = explode('/', get_option($value['id']));
|
| 552 | 552 | $noimg_name = end($image_name_arr); |
| 553 | - $img_path = $uploads['path'] . '/' . $noimg_name; |
|
| 553 | + $img_path = $uploads['path'].'/'.$noimg_name; |
|
| 554 | 554 | if (file_exists($img_path)) |
| 555 | 555 | unlink($img_path); |
| 556 | 556 | } |
@@ -571,7 +571,7 @@ discard block |
||
| 571 | 571 | // same menu setting per theme. |
| 572 | 572 | if (isset($value['id']) && $value['id'] == 'geodir_theme_location_nav' && isset($_POST[$value['id']])) {
|
| 573 | 573 | $theme = wp_get_theme(); |
| 574 | - update_option('geodir_theme_location_nav_' . $theme->name, $_POST[$value['id']]);
|
|
| 574 | + update_option('geodir_theme_location_nav_'.$theme->name, $_POST[$value['id']]);
|
|
| 575 | 575 | } |
| 576 | 576 | |
| 577 | 577 | if (isset($value['id']) && isset($_POST[$value['id']])) {
|
@@ -641,8 +641,8 @@ discard block |
||
| 641 | 641 | |
| 642 | 642 | $listing_slug = $geodir_posttype_info['labels']['singular_name']; |
| 643 | 643 | |
| 644 | - $tabs[$geodir_post_type . '_fields_settings'] = array( |
|
| 645 | - 'label' => __(ucfirst($listing_slug) . ' Settings', 'geodirectory'), |
|
| 644 | + $tabs[$geodir_post_type.'_fields_settings'] = array( |
|
| 645 | + 'label' => __(ucfirst($listing_slug).' Settings', 'geodirectory'), |
|
| 646 | 646 | 'subtabs' => array( |
| 647 | 647 | array('subtab' => 'custom_fields',
|
| 648 | 648 | 'label' => __('Custom Fields', 'geodirectory'),
|
@@ -675,7 +675,7 @@ discard block |
||
| 675 | 675 | */ |
| 676 | 676 | function geodir_tools_setting_tab($tabs) |
| 677 | 677 | {
|
| 678 | - wp_enqueue_script( 'jquery-ui-progressbar' ); |
|
| 678 | + wp_enqueue_script('jquery-ui-progressbar');
|
|
| 679 | 679 | $tabs['tools_settings'] = array('label' => __('GD Tools', 'geodirectory'));
|
| 680 | 680 | return $tabs; |
| 681 | 681 | } |
@@ -709,7 +709,7 @@ discard block |
||
| 709 | 709 | */ |
| 710 | 710 | function geodir_extend_geodirectory_setting_tab($tabs) |
| 711 | 711 | {
|
| 712 | - $tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory'). ' <i class="fa fa-plug"></i>', 'url' => 'https://wpgeodirectory.com', 'target' => '_blank');
|
|
| 712 | + $tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory').' <i class="fa fa-plug"></i>', 'url' => 'https://wpgeodirectory.com', 'target' => '_blank');
|
|
| 713 | 713 | return $tabs; |
| 714 | 714 | } |
| 715 | 715 | |
@@ -769,8 +769,8 @@ discard block |
||
| 769 | 769 | _e('Unknown', 'geodirectory');
|
| 770 | 770 | } else {
|
| 771 | 771 | /* If there is a city id, append 'city name' to the text string. */ |
| 772 | - $add_location_id = $location_id > 0 ? ' (' . $location_id . ')' : '';
|
|
| 773 | - echo(__($location->country, 'geodirectory') . '-' . $location->region . '-' . $location->city . $add_location_id); |
|
| 772 | + $add_location_id = $location_id > 0 ? ' ('.$location_id.')' : '';
|
|
| 773 | + echo(__($location->country, 'geodirectory').'-'.$location->region.'-'.$location->city.$add_location_id); |
|
| 774 | 774 | } |
| 775 | 775 | break; |
| 776 | 776 | |
@@ -788,14 +788,14 @@ discard block |
||
| 788 | 788 | $expire_class = 'expire_over'; |
| 789 | 789 | } |
| 790 | 790 | $date_diff = round(abs(strtotime($d1) - strtotime($d2)) / 86400); // get the difference in days |
| 791 | - $date_diff_text = '<br /><span class="' . $expire_class . '">(' . $date_diff . ' ' . $state . ')</span>';
|
|
| 791 | + $date_diff_text = '<br /><span class="'.$expire_class.'">('.$date_diff.' '.$state.')</span>';
|
|
| 792 | 792 | } |
| 793 | 793 | /* If no expire_date is found, output a default message. */ |
| 794 | 794 | if (empty($expire_date)) |
| 795 | 795 | echo __('Unknown', 'geodirectory');
|
| 796 | 796 | /* If there is a expire_date, append 'days left' to the text string. */ |
| 797 | 797 | else |
| 798 | - echo $expire_date . $date_diff_text; |
|
| 798 | + echo $expire_date.$date_diff_text; |
|
| 799 | 799 | break; |
| 800 | 800 | |
| 801 | 801 | /* If displaying the 'categorys' column. */ |
@@ -862,7 +862,7 @@ discard block |
||
| 862 | 862 | function geodir_post_information_save($post_id, $post) {
|
| 863 | 863 | global $wpdb, $current_user; |
| 864 | 864 | |
| 865 | - if (isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')) {
|
|
| 865 | + if (isset($post->post_type) && ($post->post_type == 'nav_menu_item' || $post->post_type == 'page' || $post->post_type == 'post')) {
|
|
| 866 | 866 | return; |
| 867 | 867 | } |
| 868 | 868 | |
@@ -930,7 +930,7 @@ discard block |
||
| 930 | 930 | $tab_id = $value['id']; |
| 931 | 931 | |
| 932 | 932 | if (isset($value['desc']) && $value['desc']) |
| 933 | - $desc = '<span style=" text-transform:none;">:- ' . $value['desc'] . '</span>'; |
|
| 933 | + $desc = '<span style=" text-transform:none;">:- '.$value['desc'].'</span>'; |
|
| 934 | 934 | |
| 935 | 935 | if (isset($value['name']) && $value['name']) {
|
| 936 | 936 | if ($first_title === true) {
|
@@ -938,9 +938,9 @@ discard block |
||
| 938 | 938 | } else {
|
| 939 | 939 | echo '</div>'; |
| 940 | 940 | } |
| 941 | - echo '<dd id="' . trim($tab_id) . '" class="geodir_option_tabs" ><a href="javascript:void(0);">' . $value['name'] . '</a></dd>'; |
|
| 941 | + echo '<dd id="'.trim($tab_id).'" class="geodir_option_tabs" ><a href="javascript:void(0);">'.$value['name'].'</a></dd>'; |
|
| 942 | 942 | |
| 943 | - echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >'; |
|
| 943 | + echo '<div id="sub_'.trim($tab_id).'" class="gd-content-heading" style=" margin-bottom:10px;" >'; |
|
| 944 | 944 | } |
| 945 | 945 | |
| 946 | 946 | /** |
@@ -950,21 +950,21 @@ discard block |
||
| 950 | 950 | * |
| 951 | 951 | * @since 1.0.0 |
| 952 | 952 | */ |
| 953 | - do_action('geodir_settings_' . sanitize_title($value['id']));
|
|
| 953 | + do_action('geodir_settings_'.sanitize_title($value['id']));
|
|
| 954 | 954 | break; |
| 955 | 955 | |
| 956 | 956 | case 'no_tabs': |
| 957 | 957 | |
| 958 | 958 | echo '<div class="inner_content_tab_main">'; |
| 959 | - echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >'; |
|
| 959 | + echo '<div id="sub_'.trim($tab_id).'" class="gd-content-heading" style=" margin-bottom:10px;" >'; |
|
| 960 | 960 | |
| 961 | 961 | break; |
| 962 | 962 | |
| 963 | 963 | case 'sectionstart': |
| 964 | 964 | if (isset($value['desc']) && $value['desc']) |
| 965 | - $desc = '<span style=" text-transform:none;"> - ' . $value['desc'] . '</span>'; |
|
| 965 | + $desc = '<span style=" text-transform:none;"> - '.$value['desc'].'</span>'; |
|
| 966 | 966 | if (isset($value['name']) && $value['name']) |
| 967 | - echo '<h3>' . $value['name'] . $desc . '</h3>'; |
|
| 967 | + echo '<h3>'.$value['name'].$desc.'</h3>'; |
|
| 968 | 968 | /** |
| 969 | 969 | * Called after a GeoDirectory settings sectionstart is output in the GD settings page. |
| 970 | 970 | * |
@@ -972,8 +972,8 @@ discard block |
||
| 972 | 972 | * |
| 973 | 973 | * @since 1.0.0 |
| 974 | 974 | */ |
| 975 | - if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_start');
|
|
| 976 | - echo '<table class="form-table">' . "\n\n"; |
|
| 975 | + if (isset($value['id']) && $value['id']) do_action('geodir_settings_'.sanitize_title($value['id']).'_start');
|
|
| 976 | + echo '<table class="form-table">'."\n\n"; |
|
| 977 | 977 | |
| 978 | 978 | break; |
| 979 | 979 | case 'sectionend': |
@@ -984,7 +984,7 @@ discard block |
||
| 984 | 984 | * |
| 985 | 985 | * @since 1.0.0 |
| 986 | 986 | */ |
| 987 | - if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_end');
|
|
| 987 | + if (isset($value['id']) && $value['id']) do_action('geodir_settings_'.sanitize_title($value['id']).'_end');
|
|
| 988 | 988 | echo '</table>'; |
| 989 | 989 | /** |
| 990 | 990 | * Called after a GeoDirectory settings sectionend is output in the GD settings page. |
@@ -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']) . '_after');
|
|
| 996 | + if (isset($value['id']) && $value['id']) do_action('geodir_settings_'.sanitize_title($value['id']).'_after');
|
|
| 997 | 997 | break; |
| 998 | 998 | case 'text': |
| 999 | 999 | ?> |
@@ -1002,7 +1002,7 @@ discard block |
||
| 1002 | 1002 | <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>" |
| 1003 | 1003 | id="<?php echo esc_attr($value['id']); ?>" |
| 1004 | 1004 | type="<?php echo esc_attr($value['type']); ?>" |
| 1005 | - <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
|
|
| 1005 | + <?php if (isset($value['placeholder'])) {?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
|
|
| 1006 | 1006 | style=" <?php echo esc_attr($value['css']); ?>" |
| 1007 | 1007 | value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
|
| 1008 | 1008 | echo esc_attr(stripslashes(get_option($value['id']))); |
@@ -1019,7 +1019,7 @@ discard block |
||
| 1019 | 1019 | <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>" |
| 1020 | 1020 | id="<?php echo esc_attr($value['id']); ?>" |
| 1021 | 1021 | type="<?php echo esc_attr($value['type']); ?>" |
| 1022 | - <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
|
|
| 1022 | + <?php if (isset($value['placeholder'])) {?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
|
|
| 1023 | 1023 | style="<?php echo esc_attr($value['css']); ?>" |
| 1024 | 1024 | value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
|
| 1025 | 1025 | echo esc_attr(stripslashes(get_option($value['id']))); |
@@ -1065,17 +1065,17 @@ discard block |
||
| 1065 | 1065 | <?php _e('Width', 'geodirectory'); ?> <input
|
| 1066 | 1066 | name="<?php echo esc_attr($value['id']); ?>_width" |
| 1067 | 1067 | id="<?php echo esc_attr($value['id']); ?>_width" type="text" size="3" |
| 1068 | - value="<?php if ($size = get_option($value['id'] . '_width')) echo stripslashes($size); else echo $value['std']; ?>"/> |
|
| 1068 | + value="<?php if ($size = get_option($value['id'].'_width')) echo stripslashes($size); else echo $value['std']; ?>"/> |
|
| 1069 | 1069 | |
| 1070 | 1070 | <?php _e('Height', 'geodirectory'); ?> <input
|
| 1071 | 1071 | name="<?php echo esc_attr($value['id']); ?>_height" |
| 1072 | 1072 | id="<?php echo esc_attr($value['id']); ?>_height" type="text" size="3" |
| 1073 | - value="<?php if ($size = get_option($value['id'] . '_height')) echo stripslashes($size); else echo $value['std']; ?>"/> |
|
| 1073 | + value="<?php if ($size = get_option($value['id'].'_height')) echo stripslashes($size); else echo $value['std']; ?>"/> |
|
| 1074 | 1074 | |
| 1075 | 1075 | <label><?php _e('Hard Crop', 'geodirectory'); ?> <input
|
| 1076 | 1076 | name="<?php echo esc_attr($value['id']); ?>_crop" |
| 1077 | 1077 | id="<?php echo esc_attr($value['id']); ?>_crop" |
| 1078 | - type="checkbox" <?php if (get_option($value['id'] . '_crop') != '') checked(get_option($value['id'] . '_crop'), 1); else checked(1); ?> /></label> |
|
| 1078 | + type="checkbox" <?php if (get_option($value['id'].'_crop') != '') checked(get_option($value['id'].'_crop'), 1); else checked(1); ?> /></label> |
|
| 1079 | 1079 | |
| 1080 | 1080 | <span class="description"><?php echo $value['desc'] ?></span></td> |
| 1081 | 1081 | </tr><?php |
@@ -1125,7 +1125,7 @@ discard block |
||
| 1125 | 1125 | id="<?php echo esc_attr($value['id']); ?>" |
| 1126 | 1126 | style="<?php echo esc_attr($value['css']); ?>" |
| 1127 | 1127 | class="<?php if (isset($value['class'])) echo $value['class']; ?>" |
| 1128 | - data-placeholder="<?php if (isset($value['placeholder_text'])) echo $value['placeholder_text'];?>" |
|
| 1128 | + data-placeholder="<?php if (isset($value['placeholder_text'])) echo $value['placeholder_text']; ?>" |
|
| 1129 | 1129 | option-ajaxchosen="false"> |
| 1130 | 1130 | <?php |
| 1131 | 1131 | foreach ($value['options'] as $key => $val) {
|
@@ -1136,7 +1136,7 @@ discard block |
||
| 1136 | 1136 | } else {
|
| 1137 | 1137 | ?> |
| 1138 | 1138 | <option |
| 1139 | - value="<?php echo esc_attr($key); ?>" <?php selected(true, (is_array($option_values) && in_array($key, $option_values)));?>><?php echo ucfirst($val) ?></option> |
|
| 1139 | + value="<?php echo esc_attr($key); ?>" <?php selected(true, (is_array($option_values) && in_array($key, $option_values))); ?>><?php echo ucfirst($val) ?></option> |
|
| 1140 | 1140 | <?php |
| 1141 | 1141 | } |
| 1142 | 1142 | } |
@@ -1171,7 +1171,7 @@ discard block |
||
| 1171 | 1171 | ?> |
| 1172 | 1172 | |
| 1173 | 1173 | <tr valign="top"> |
| 1174 | - <th class="titledesc" width="40%"><?php _e('Default map language', 'geodirectory');?></th>
|
|
| 1174 | + <th class="titledesc" width="40%"><?php _e('Default map language', 'geodirectory'); ?></th>
|
|
| 1175 | 1175 | <td width="60%"> |
| 1176 | 1176 | <select name="geodir_default_map_language" style="width:60%"> |
| 1177 | 1177 | <?php |
@@ -1253,7 +1253,7 @@ discard block |
||
| 1253 | 1253 | |
| 1254 | 1254 | <tr valign="top"> |
| 1255 | 1255 | <th class="titledesc" |
| 1256 | - width="40%"><?php _e('Default post type search on map', 'geodirectory');?></th>
|
|
| 1256 | + width="40%"><?php _e('Default post type search on map', 'geodirectory'); ?></th>
|
|
| 1257 | 1257 | <td width="60%"> |
| 1258 | 1258 | <select name="geodir_default_map_search_pt" style="width:60%"> |
| 1259 | 1259 | <?php |
@@ -1294,7 +1294,7 @@ discard block |
||
| 1294 | 1294 | $cat_display = 'checkbox'; |
| 1295 | 1295 | $gd_post_types = get_option('geodir_exclude_post_type_on_map');
|
| 1296 | 1296 | $gd_cats = get_option('geodir_exclude_cat_on_map');
|
| 1297 | - $gd_cats_upgrade = (int)get_option('geodir_exclude_cat_on_map_upgrade');
|
|
| 1297 | + $gd_cats_upgrade = (int) get_option('geodir_exclude_cat_on_map_upgrade');
|
|
| 1298 | 1298 | $count = 1; |
| 1299 | 1299 | ?> |
| 1300 | 1300 | <table width="70%" class="widefat"> |
@@ -1323,7 +1323,7 @@ discard block |
||
| 1323 | 1323 | name="home_map_post_types[]" |
| 1324 | 1324 | id="<?php echo esc_attr($value['id']); ?>" |
| 1325 | 1325 | value="<?php echo $key; ?>" |
| 1326 | - class="map_post_type" <?php echo $checked;?> /> |
|
| 1326 | + class="map_post_type" <?php echo $checked; ?> /> |
|
| 1327 | 1327 | <?php echo $post_types_obj->labels->singular_name; ?></td> |
| 1328 | 1328 | <td width="40%"> |
| 1329 | 1329 | <div class="home_map_category" style="overflow:auto;width:200px;height:100px;" |
@@ -1381,12 +1381,12 @@ discard block |
||
| 1381 | 1381 | ?> |
| 1382 | 1382 | <fieldset> |
| 1383 | 1383 | <legend class="screen-reader-text"><span><?php echo $value['name'] ?></span></legend> |
| 1384 | - <label for="<?php echo $value['id'];?>"> |
|
| 1384 | + <label for="<?php echo $value['id']; ?>"> |
|
| 1385 | 1385 | <input name="<?php echo esc_attr($value['id']); ?>" |
| 1386 | - id="<?php echo esc_attr($value['id'] . $value['value']); ?>" type="radio" |
|
| 1386 | + id="<?php echo esc_attr($value['id'].$value['value']); ?>" type="radio" |
|
| 1387 | 1387 | value="<?php echo $value['value'] ?>" <?php if (get_option($value['id']) == $value['value']) {
|
| 1388 | 1388 | echo 'checked="checked"'; |
| 1389 | - }elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
|
|
| 1389 | + }elseif (get_option($value['id']) == '' && $value['std'] == $value['value']) {echo 'checked="checked"'; } ?> />
|
|
| 1390 | 1390 | <?php echo $value['desc']; ?></label><br> |
| 1391 | 1391 | </fieldset> |
| 1392 | 1392 | <?php |
@@ -1406,9 +1406,9 @@ discard block |
||
| 1406 | 1406 | <th scope="row" class="titledesc"><?php echo $value['name'] ?></th> |
| 1407 | 1407 | <td class="forminp"> |
| 1408 | 1408 | <textarea |
| 1409 | - <?php if (isset($value['args'])) echo $value['args'] . ' '; ?>name="<?php echo esc_attr($value['id']); ?>" |
|
| 1409 | + <?php if (isset($value['args'])) echo $value['args'].' '; ?>name="<?php echo esc_attr($value['id']); ?>" |
|
| 1410 | 1410 | id="<?php echo esc_attr($value['id']); ?>" |
| 1411 | - <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
|
|
| 1411 | + <?php if (isset($value['placeholder'])) {?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
|
|
| 1412 | 1412 | 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 |
| 1413 | 1413 | class="description"><?php echo $value['desc'] ?></span> |
| 1414 | 1414 | |
@@ -1453,7 +1453,7 @@ discard block |
||
| 1453 | 1453 | } |
| 1454 | 1454 | } |
| 1455 | 1455 | // |
| 1456 | - $page_setting = (int)get_option($value['id']); |
|
| 1456 | + $page_setting = (int) get_option($value['id']); |
|
| 1457 | 1457 | |
| 1458 | 1458 | $args = array('name' => $value['id'],
|
| 1459 | 1459 | 'id' => $value['id'], |
@@ -1470,7 +1470,7 @@ discard block |
||
| 1470 | 1470 | <tr valign="top" class="single_select_page"> |
| 1471 | 1471 | <th scope="row" class="titledesc"><?php echo $value['name'] ?></th> |
| 1472 | 1472 | <td class="forminp"> |
| 1473 | - <?php echo str_replace(' id=', " data-placeholder='" . __('Select a page...', 'geodirectory') . "' style='" . $value['css'] . "' class='" . $value['class'] . "' " . $disabled . " id=", wp_dropdown_pages($args)); ?>
|
|
| 1473 | + <?php echo str_replace(' id=', " data-placeholder='".__('Select a page...', 'geodirectory')."' style='".$value['css']."' class='".$value['class']."' ".$disabled." id=", wp_dropdown_pages($args)); ?>
|
|
| 1474 | 1474 | <span class="description"><?php echo $value['desc'] ?></span> |
| 1475 | 1475 | </td> |
| 1476 | 1476 | </tr><?php |
@@ -1479,7 +1479,7 @@ discard block |
||
| 1479 | 1479 | } |
| 1480 | 1480 | break; |
| 1481 | 1481 | case 'single_select_country' : |
| 1482 | - $country_setting = (string)get_option($value['id']); |
|
| 1482 | + $country_setting = (string) get_option($value['id']); |
|
| 1483 | 1483 | if (strstr($country_setting, ':')) : |
| 1484 | 1484 | $country = current(explode(':', $country_setting));
|
| 1485 | 1485 | $state = end(explode(':', $country_setting));
|
@@ -1502,7 +1502,7 @@ discard block |
||
| 1502 | 1502 | case 'multi_select_countries' : |
| 1503 | 1503 | $countries = $geodirectory->countries->countries; |
| 1504 | 1504 | asort($countries); |
| 1505 | - $selections = (array)get_option($value['id']); |
|
| 1505 | + $selections = (array) get_option($value['id']); |
|
| 1506 | 1506 | ?> |
| 1507 | 1507 | <tr valign="top"> |
| 1508 | 1508 | <th scope="row" class="titledesc"><?php echo $value['name'] ?></th> |
@@ -1512,7 +1512,7 @@ discard block |
||
| 1512 | 1512 | title="Country" class="chosen_select"> |
| 1513 | 1513 | <?php |
| 1514 | 1514 | if ($countries) foreach ($countries as $key => $val) : |
| 1515 | - echo '<option value="' . $key . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>'; |
|
| 1515 | + echo '<option value="'.$key.'" '.selected(in_array($key, $selections), true, false).'>'.$val.'</option>'; |
|
| 1516 | 1516 | endforeach; |
| 1517 | 1517 | ?> |
| 1518 | 1518 | </select> |
@@ -1524,8 +1524,8 @@ discard block |
||
| 1524 | 1524 | break; |
| 1525 | 1525 | |
| 1526 | 1526 | case 'google_analytics' : |
| 1527 | - $selections = (array)get_option($value['id']); |
|
| 1528 | - if(get_option('geodir_ga_client_id') && get_option('geodir_ga_client_secret') ) {
|
|
| 1527 | + $selections = (array) get_option($value['id']); |
|
| 1528 | + if (get_option('geodir_ga_client_id') && get_option('geodir_ga_client_secret')) {
|
|
| 1529 | 1529 | ?> |
| 1530 | 1530 | <tr valign="top"> |
| 1531 | 1531 | <th scope="row" class="titledesc"><?php echo $value['name'] ?></th> |
@@ -1536,20 +1536,20 @@ discard block |
||
| 1536 | 1536 | |
| 1537 | 1537 | $oAuthURL = "https://accounts.google.com/o/oauth2/auth?"; |
| 1538 | 1538 | $scope = "scope=https://www.googleapis.com/auth/analytics.readonly"; |
| 1539 | - $state = "&state=123";//any string |
|
| 1540 | - $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
|
|
| 1539 | + $state = "&state=123"; //any string |
|
| 1540 | + $redirect_uri = "&redirect_uri=".admin_url('admin-ajax.php')."?action=geodir_ga_callback";
|
|
| 1541 | 1541 | $response_type = "&response_type=code"; |
| 1542 | 1542 | $client_id = "&client_id=".get_option('geodir_ga_client_id');
|
| 1543 | 1543 | $access_type = "&access_type=offline"; |
| 1544 | 1544 | $approval_prompt = "&approval_prompt=force"; |
| 1545 | 1545 | |
| 1546 | - $auth_url = $oAuthURL . $scope . $state . $redirect_uri . $response_type . $client_id . $access_type . $approval_prompt; |
|
| 1546 | + $auth_url = $oAuthURL.$scope.$state.$redirect_uri.$response_type.$client_id.$access_type.$approval_prompt; |
|
| 1547 | 1547 | |
| 1548 | 1548 | |
| 1549 | 1549 | ?> |
| 1550 | 1550 | <script> |
| 1551 | 1551 | function gd_ga_popup() {
|
| 1552 | - var win = window.open("<?php echo $auth_url;?>", "Google Analytics", "");
|
|
| 1552 | + var win = window.open("<?php echo $auth_url; ?>", "Google Analytics", "");
|
|
| 1553 | 1553 | var pollTimer = window.setInterval(function () {
|
| 1554 | 1554 | if (win.closed !== false) { // !== is required for compatibility with Opera
|
| 1555 | 1555 | window.clearInterval(pollTimer); |
@@ -1571,7 +1571,7 @@ discard block |
||
| 1571 | 1571 | } else {
|
| 1572 | 1572 | ?> |
| 1573 | 1573 | <span class="button-primary" |
| 1574 | - onclick="gd_ga_popup();"><?php _e('Authorize', 'geodirectory');?></span>
|
|
| 1574 | + onclick="gd_ga_popup();"><?php _e('Authorize', 'geodirectory'); ?></span>
|
|
| 1575 | 1575 | <?php |
| 1576 | 1576 | } |
| 1577 | 1577 | ?> |
@@ -1642,9 +1642,9 @@ discard block |
||
| 1642 | 1642 | |
| 1643 | 1643 | <?php if (isset($_REQUEST['active_tab']) && $_REQUEST['active_tab'] != '') { ?>
|
| 1644 | 1644 | jQuery('.geodir_option_tabs').removeClass('gd-tab-active');
|
| 1645 | - jQuery('#<?php echo sanitize_text_field($_REQUEST['active_tab']);?>').addClass('gd-tab-active');
|
|
| 1645 | + jQuery('#<?php echo sanitize_text_field($_REQUEST['active_tab']); ?>').addClass('gd-tab-active');
|
|
| 1646 | 1646 | jQuery('.gd-content-heading').hide();
|
| 1647 | - jQuery('#sub_<?php echo sanitize_text_field($_REQUEST['active_tab']);?>').show();
|
|
| 1647 | + jQuery('#sub_<?php echo sanitize_text_field($_REQUEST['active_tab']); ?>').show();
|
|
| 1648 | 1648 | <?php } ?> |
| 1649 | 1649 | }); |
| 1650 | 1650 | </script> |
@@ -1730,7 +1730,7 @@ discard block |
||
| 1730 | 1730 | wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_attachments_noncename'); |
| 1731 | 1731 | |
| 1732 | 1732 | if (geodir_get_featured_image($post_id, 'thumbnail')) {
|
| 1733 | - echo '<h4>' . __('Featured Image', 'geodirectory') . '</h4>';
|
|
| 1733 | + echo '<h4>'.__('Featured Image', 'geodirectory').'</h4>';
|
|
| 1734 | 1734 | geodir_show_featured_image($post_id, 'thumbnail'); |
| 1735 | 1735 | } |
| 1736 | 1736 | |
@@ -1741,13 +1741,13 @@ discard block |
||
| 1741 | 1741 | |
| 1742 | 1742 | <h5 class="form_title"> |
| 1743 | 1743 | <?php if ($image_limit != 0 && $image_limit == 1) {
|
| 1744 | - echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
|
|
| 1744 | + echo '<br /><small>('.__('You can upload', 'geodirectory').' '.$image_limit.' '.__('image with this package', 'geodirectory').')</small>';
|
|
| 1745 | 1745 | } ?> |
| 1746 | 1746 | <?php if ($image_limit != 0 && $image_limit > 1) {
|
| 1747 | - echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
|
|
| 1747 | + echo '<br /><small>('.__('You can upload', 'geodirectory').' '.$image_limit.' '.__('images with this package', 'geodirectory').')</small>';
|
|
| 1748 | 1748 | } ?> |
| 1749 | 1749 | <?php if ($image_limit == 0) {
|
| 1750 | - echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
|
|
| 1750 | + echo '<br /><small>('.__('You can upload unlimited images with this package', 'geodirectory').')</small>';
|
|
| 1751 | 1751 | } ?> |
| 1752 | 1752 | </h5> |
| 1753 | 1753 | |
@@ -1786,10 +1786,10 @@ discard block |
||
| 1786 | 1786 | <div |
| 1787 | 1787 | class="plupload-upload-uic hide-if-no-js <?php if ($multiple): ?>plupload-upload-uic-multiple<?php endif; ?>" |
| 1788 | 1788 | id="<?php echo $id; ?>plupload-upload-ui"> |
| 1789 | - <h4><?php _e('Drop files to upload', 'geodirectory');?></h4>
|
|
| 1789 | + <h4><?php _e('Drop files to upload', 'geodirectory'); ?></h4>
|
|
| 1790 | 1790 | <input id="<?php echo $id; ?>plupload-browse-button" type="button" |
| 1791 | 1791 | value="<?php _e('Select Files', 'geodirectory'); ?>" class="button"/>
|
| 1792 | - <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce($id . 'pluploadan'); ?>"></span> |
|
| 1792 | + <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce($id.'pluploadan'); ?>"></span> |
|
| 1793 | 1793 | <?php if ($width && $height): ?> |
| 1794 | 1794 | <span class="plupload-resize"></span> |
| 1795 | 1795 | <span class="plupload-width" id="plupload-width<?php echo $width; ?>"></span> |
@@ -1801,7 +1801,7 @@ discard block |
||
| 1801 | 1801 | id="<?php echo $id; ?>plupload-thumbs" style="border-top:1px solid #ccc; padding-top:10px;"> |
| 1802 | 1802 | </div> |
| 1803 | 1803 | <span |
| 1804 | - id="upload-msg"><?php _e('Please drag & drop the images to rearrange the order', 'geodirectory');?></span>
|
|
| 1804 | + id="upload-msg"><?php _e('Please drag & drop the images to rearrange the order', 'geodirectory'); ?></span>
|
|
| 1805 | 1805 | <span id="<?php echo $id; ?>upload-error" style="display:none"></span> |
| 1806 | 1806 | </div> |
| 1807 | 1807 | |
@@ -2011,9 +2011,9 @@ discard block |
||
| 2011 | 2011 | $plugin = 'avada-nag'; |
| 2012 | 2012 | $timestamp = 'avada-nag1234'; |
| 2013 | 2013 | $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');
|
| 2014 | - echo '<div id="' . $timestamp . '" class="error">'; |
|
| 2015 | - echo '<span class="gd-remove-noti" onclick="gdRemoveANotification(\'' . $plugin . '\',\'' . $timestamp . '\');" ><i class="fa fa-times"></i></span>'; |
|
| 2016 | - echo "<img class='gd-icon-noti' src='" . plugin_dir_url('') . "geodirectory/geodirectory-assets/images/favicon.ico' > ";
|
|
| 2014 | + echo '<div id="'.$timestamp.'" class="error">'; |
|
| 2015 | + echo '<span class="gd-remove-noti" onclick="gdRemoveANotification(\''.$plugin.'\',\''.$timestamp.'\');" ><i class="fa fa-times"></i></span>'; |
|
| 2016 | + echo "<img class='gd-icon-noti' src='".plugin_dir_url('')."geodirectory/geodirectory-assets/images/favicon.ico' > ";
|
|
| 2017 | 2017 | echo "<p>$message</p>"; |
| 2018 | 2018 | echo "</div>"; |
| 2019 | 2019 | |
@@ -2146,7 +2146,7 @@ discard block |
||
| 2146 | 2146 | |
| 2147 | 2147 | // Don't allow same slug url for listing and location |
| 2148 | 2148 | if (geodir_strtolower($listing_prefix) == geodir_strtolower($location_prefix)) {
|
| 2149 | - $redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $active_tab . '&msg=fail&gderr=21');
|
|
| 2149 | + $redirect_url = admin_url('admin.php?page=geodirectory&tab='.$current_tab.'&active_tab='.$active_tab.'&msg=fail&gderr=21');
|
|
| 2150 | 2150 | wp_redirect($redirect_url); |
| 2151 | 2151 | exit; |
| 2152 | 2152 | } |
@@ -2158,7 +2158,7 @@ discard block |
||
| 2158 | 2158 | $default_language = $sitepress->get_default_language(); |
| 2159 | 2159 | |
| 2160 | 2160 | if ($current_language != 'all' && $current_language != $default_language) {
|
| 2161 | - $redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $active_tab);
|
|
| 2161 | + $redirect_url = admin_url('admin.php?page=geodirectory&tab='.$current_tab.'&active_tab='.$active_tab);
|
|
| 2162 | 2162 | wp_redirect($redirect_url); |
| 2163 | 2163 | exit; |
| 2164 | 2164 | } |
@@ -2179,11 +2179,11 @@ discard block |
||
| 2179 | 2179 | function geodir_hide_admin_preview_button() {
|
| 2180 | 2180 | global $post_type; |
| 2181 | 2181 | $post_types = geodir_get_posttypes(); |
| 2182 | - if(in_array($post_type, $post_types)) |
|
| 2182 | + if (in_array($post_type, $post_types)) |
|
| 2183 | 2183 | echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
|
| 2184 | 2184 | } |
| 2185 | -add_action( 'admin_head-post-new.php', 'geodir_hide_admin_preview_button' ); |
|
| 2186 | -add_action( 'admin_head-post.php', 'geodir_hide_admin_preview_button' ); |
|
| 2185 | +add_action('admin_head-post-new.php', 'geodir_hide_admin_preview_button');
|
|
| 2186 | +add_action('admin_head-post.php', 'geodir_hide_admin_preview_button');
|
|
| 2187 | 2187 | |
| 2188 | 2188 | /** |
| 2189 | 2189 | * Add the tab in left sidebar menu fro import & export page. |
@@ -2193,8 +2193,8 @@ discard block |
||
| 2193 | 2193 | * |
| 2194 | 2194 | * @return array Array of tab data. |
| 2195 | 2195 | */ |
| 2196 | -function geodir_import_export_tab( $tabs ) {
|
|
| 2197 | - $tabs['import_export'] = array( 'label' => __( 'Import & Export', 'geodirectory' ) ); |
|
| 2196 | +function geodir_import_export_tab($tabs) {
|
|
| 2197 | + $tabs['import_export'] = array('label' => __('Import & Export', 'geodirectory'));
|
|
| 2198 | 2198 | return $tabs; |
| 2199 | 2199 | } |
| 2200 | 2200 | |
@@ -2208,8 +2208,8 @@ discard block |
||
| 2208 | 2208 | * @return string Html content. |
| 2209 | 2209 | */ |
| 2210 | 2210 | function geodir_import_export_page() {
|
| 2211 | - $nonce = wp_create_nonce( 'geodir_import_export_nonce' ); |
|
| 2212 | - $gd_cats_sample_csv = geodir_plugin_url() . '/geodirectory-assets/gd_sample_categories.csv'; |
|
| 2211 | + $nonce = wp_create_nonce('geodir_import_export_nonce');
|
|
| 2212 | + $gd_cats_sample_csv = geodir_plugin_url().'/geodirectory-assets/gd_sample_categories.csv'; |
|
| 2213 | 2213 | /** |
| 2214 | 2214 | * Filter sample category data csv file url. |
| 2215 | 2215 | * |
@@ -2218,9 +2218,9 @@ discard block |
||
| 2218 | 2218 | * |
| 2219 | 2219 | * @param string $gd_cats_sample_csv Sample category data csv file url. |
| 2220 | 2220 | */ |
| 2221 | - $gd_cats_sample_csv = apply_filters( 'geodir_export_cats_sample_csv', $gd_cats_sample_csv ); |
|
| 2221 | + $gd_cats_sample_csv = apply_filters('geodir_export_cats_sample_csv', $gd_cats_sample_csv);
|
|
| 2222 | 2222 | |
| 2223 | - $gd_posts_sample_csv = geodir_plugin_url() . '/geodirectory-assets/place_listing.csv'; |
|
| 2223 | + $gd_posts_sample_csv = geodir_plugin_url().'/geodirectory-assets/place_listing.csv'; |
|
| 2224 | 2224 | /** |
| 2225 | 2225 | * Filter sample post data csv file url. |
| 2226 | 2226 | * |
@@ -2229,15 +2229,15 @@ discard block |
||
| 2229 | 2229 | * |
| 2230 | 2230 | * @param string $gd_posts_sample_csv Sample post data csv file url. |
| 2231 | 2231 | */ |
| 2232 | - $gd_posts_sample_csv = apply_filters( 'geodir_export_posts_sample_csv', $gd_posts_sample_csv ); |
|
| 2232 | + $gd_posts_sample_csv = apply_filters('geodir_export_posts_sample_csv', $gd_posts_sample_csv);
|
|
| 2233 | 2233 | |
| 2234 | - $gd_posttypes = geodir_get_posttypes( 'array' ); |
|
| 2234 | + $gd_posttypes = geodir_get_posttypes('array');
|
|
| 2235 | 2235 | |
| 2236 | 2236 | $gd_posttypes_option = ''; |
| 2237 | - foreach ( $gd_posttypes as $gd_posttype => $row ) {
|
|
| 2238 | - $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>'; |
|
| 2237 | + foreach ($gd_posttypes as $gd_posttype => $row) {
|
|
| 2238 | + $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>'; |
|
| 2239 | 2239 | } |
| 2240 | - wp_enqueue_script( 'jquery-ui-progressbar' ); |
|
| 2240 | + wp_enqueue_script('jquery-ui-progressbar');
|
|
| 2241 | 2241 | |
| 2242 | 2242 | $gd_chunksize_options = array(); |
| 2243 | 2243 | $gd_chunksize_options[100] = 100; |
@@ -2259,49 +2259,49 @@ discard block |
||
| 2259 | 2259 | * |
| 2260 | 2260 | * @param string $gd_chunksize_options Entries options. |
| 2261 | 2261 | */ |
| 2262 | - $gd_chunksize_options = apply_filters( 'geodir_export_csv_chunksize_options', $gd_chunksize_options ); |
|
| 2262 | + $gd_chunksize_options = apply_filters('geodir_export_csv_chunksize_options', $gd_chunksize_options);
|
|
| 2263 | 2263 | |
| 2264 | 2264 | $gd_chunksize_option = ''; |
| 2265 | 2265 | foreach ($gd_chunksize_options as $value => $title) {
|
| 2266 | - $gd_chunksize_option .= '<option value="' . $value . '" ' . selected($value, 5000, false) . '>' . $title . '</option>'; |
|
| 2266 | + $gd_chunksize_option .= '<option value="'.$value.'" '.selected($value, 5000, false).'>'.$title.'</option>'; |
|
| 2267 | 2267 | } |
| 2268 | 2268 | |
| 2269 | 2269 | $uploads = wp_upload_dir(); |
| 2270 | 2270 | ?> |
| 2271 | 2271 | </form> |
| 2272 | 2272 | <div class="inner_content_tab_main gd-import-export"> |
| 2273 | - <h3><?php _e( 'GD Import & Export CSV', 'geodirectory' ) ;?></h3> |
|
| 2274 | - <span class="description"><?php _e( 'Import & export csv for GD listings & categories.', 'geodirectory' ) ;?></span> |
|
| 2273 | + <h3><?php _e('GD Import & Export CSV', 'geodirectory'); ?></h3>
|
|
| 2274 | + <span class="description"><?php _e('Import & export csv for GD listings & categories.', 'geodirectory'); ?></span>
|
|
| 2275 | 2275 | <div class="gd-content-heading"> |
| 2276 | 2276 | |
| 2277 | 2277 | <?php |
| 2278 | 2278 | ini_set('max_execution_time', 999999);
|
| 2279 | - $ini_max_execution_time_check = @ini_get( 'max_execution_time' ); |
|
| 2279 | + $ini_max_execution_time_check = @ini_get('max_execution_time');
|
|
| 2280 | 2280 | ini_restore('max_execution_time');
|
| 2281 | 2281 | |
| 2282 | - if($ini_max_execution_time_check != 999999){ // only show these setting to the user if we can't change the ini setting
|
|
| 2282 | + if ($ini_max_execution_time_check != 999999) { // only show these setting to the user if we can't change the ini setting
|
|
| 2283 | 2283 | ?> |
| 2284 | 2284 | <div id="gd_ie_reqs" class="metabox-holder"> |
| 2285 | 2285 | <div class="meta-box-sortables ui-sortable"> |
| 2286 | 2286 | <div class="postbox"> |
| 2287 | - <h3 class="hndle"><span style='vertical-align:top;'><?php echo __( 'PHP Requirements for GD Import & Export CSV', 'geodirectory' );?></span></h3> |
|
| 2287 | + <h3 class="hndle"><span style='vertical-align:top;'><?php echo __('PHP Requirements for GD Import & Export CSV', 'geodirectory'); ?></span></h3>
|
|
| 2288 | 2288 | <div class="inside"> |
| 2289 | - <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> |
|
| 2289 | + <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>
|
|
| 2290 | 2290 | <table class="form-table"> |
| 2291 | 2291 | <thead> |
| 2292 | 2292 | <tr> |
| 2293 | - <th><?php _e( 'PHP Settings', 'geodirectory' );?></th><th><?php _e( 'Current Value', 'geodirectory' );?></th><th><?php _e( 'Recommended Value', 'geodirectory' );?></th> |
|
| 2293 | + <th><?php _e('PHP Settings', 'geodirectory'); ?></th><th><?php _e('Current Value', 'geodirectory'); ?></th><th><?php _e('Recommended Value', 'geodirectory'); ?></th>
|
|
| 2294 | 2294 | </tr> |
| 2295 | 2295 | </thead> |
| 2296 | 2296 | <tbody> |
| 2297 | 2297 | <tr> |
| 2298 | - <td>max_input_time</td><td><?php echo @ini_get( 'max_input_time' );?></td><td>3000</td> |
|
| 2298 | + <td>max_input_time</td><td><?php echo @ini_get('max_input_time'); ?></td><td>3000</td>
|
|
| 2299 | 2299 | </tr> |
| 2300 | 2300 | <tr> |
| 2301 | - <td>max_execution_time</td><td><?php echo @ini_get( 'max_execution_time' );?></td><td>3000</td> |
|
| 2301 | + <td>max_execution_time</td><td><?php echo @ini_get('max_execution_time'); ?></td><td>3000</td>
|
|
| 2302 | 2302 | </tr> |
| 2303 | 2303 | <tr> |
| 2304 | - <td>memory_limit</td><td><?php echo @ini_get( 'memory_limit' );?></td><td>256M</td> |
|
| 2304 | + <td>memory_limit</td><td><?php echo @ini_get('memory_limit'); ?></td><td>256M</td>
|
|
| 2305 | 2305 | </tr> |
| 2306 | 2306 | </tbody> |
| 2307 | 2307 | </table> |
@@ -2313,21 +2313,21 @@ discard block |
||
| 2313 | 2313 | <div id="gd_ie_imposts" class="metabox-holder"> |
| 2314 | 2314 | <div class="meta-box-sortables ui-sortable"> |
| 2315 | 2315 | <div id="gd_ie_im_posts" class="postbox gd-hndle-pbox"> |
| 2316 | - <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> |
|
| 2317 | - <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Listings: Import CSV', 'geodirectory' );?></span></h3> |
|
| 2316 | + <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>
|
|
| 2317 | + <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Listings: Import CSV', 'geodirectory'); ?></span></h3>
|
|
| 2318 | 2318 | <div class="inside"> |
| 2319 | 2319 | <table class="form-table"> |
| 2320 | 2320 | <tbody> |
| 2321 | 2321 | <tr> |
| 2322 | 2322 | <td class="gd-imex-box"> |
| 2323 | 2323 | <div class="gd-im-choices"> |
| 2324 | - <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> |
|
| 2325 | - <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> |
|
| 2324 | + <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>
|
|
| 2325 | + <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>
|
|
| 2326 | 2326 | </div> |
| 2327 | 2327 | <div class="plupload-upload-uic hide-if-no-js" id="gd_im_postplupload-upload-ui"> |
| 2328 | 2328 | <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');" />
|
| 2329 | - <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"> |
|
| 2330 | - <input type="hidden" id="gd_ie_imposts_csv" value="<?php echo $gd_posts_sample_csv;?>" /> |
|
| 2329 | + <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">
|
|
| 2330 | + <input type="hidden" id="gd_ie_imposts_csv" value="<?php echo $gd_posts_sample_csv; ?>" /> |
|
| 2331 | 2331 | <?php |
| 2332 | 2332 | /** |
| 2333 | 2333 | * Called just after the sample CSV download link. |
@@ -2336,7 +2336,7 @@ discard block |
||
| 2336 | 2336 | */ |
| 2337 | 2337 | do_action('geodir_sample_csv_download_link');
|
| 2338 | 2338 | ?> |
| 2339 | - <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce( 'gd_im_postpluploadan' ); ?>"></span> |
|
| 2339 | + <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce('gd_im_postpluploadan'); ?>"></span>
|
|
| 2340 | 2340 | <div class="filelist"></div> |
| 2341 | 2341 | </div> |
| 2342 | 2342 | <span id="gd_im_catupload-error" style="display:none"></span> |
@@ -2354,7 +2354,7 @@ discard block |
||
| 2354 | 2354 | <input type="hidden" id="gd_terminateaction" value="continue"/> |
| 2355 | 2355 | </div> |
| 2356 | 2356 | <div class="gd-import-progress" id="gd-import-progress" style="display:none"> |
| 2357 | - <div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory');?> </b><font
|
|
| 2357 | + <div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory'); ?> </b><font
|
|
| 2358 | 2358 | id="gd-import-done">0</font> / <font id="gd-import-total">0</font> ( <font |
| 2359 | 2359 | id="gd-import-perc">0%</font> ) |
| 2360 | 2360 | <div class="gd-fileprogress"></div> |
@@ -2366,10 +2366,10 @@ discard block |
||
| 2366 | 2366 | <div class="gd-imex-btns" style="display:none;"> |
| 2367 | 2367 | <input type="hidden" class="geodir_import_file" name="geodir_import_file" value="save"/> |
| 2368 | 2368 | <input onclick="gd_imex_PrepareImport(this, 'post')" type="button" value="<?php echo CSV_IMPORT_DATA; ?>" id="gd_import_data" class="button-primary" /> |
| 2369 | - <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"/> |
|
| 2370 | - <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')"/>
|
|
| 2369 | + <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"/>
|
|
| 2370 | + <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')"/>
|
|
| 2371 | 2371 | <div id="gd_process_data" style="display:none"> |
| 2372 | - <span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory');?>
|
|
| 2372 | + <span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory'); ?>
|
|
| 2373 | 2373 | </div> |
| 2374 | 2374 | </div> |
| 2375 | 2375 | </td> |
@@ -2383,30 +2383,30 @@ discard block |
||
| 2383 | 2383 | <div id="gd_ie_excategs" class="metabox-holder"> |
| 2384 | 2384 | <div class="meta-box-sortables ui-sortable"> |
| 2385 | 2385 | <div id="gd_ie_ex_posts" class="postbox gd-hndle-pbox"> |
| 2386 | - <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> |
|
| 2387 | - <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Listings: Export CSV', 'geodirectory' );?></span></h3> |
|
| 2386 | + <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>
|
|
| 2387 | + <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Listings: Export CSV', 'geodirectory'); ?></span></h3>
|
|
| 2388 | 2388 | <div class="inside"> |
| 2389 | 2389 | <table class="form-table"> |
| 2390 | 2390 | <tbody> |
| 2391 | 2391 | <tr> |
| 2392 | 2392 | <td class="fld"><label for="gd_post_type"> |
| 2393 | - <?php _e( 'Post Type:', 'geodirectory' );?> |
|
| 2393 | + <?php _e('Post Type:', 'geodirectory'); ?>
|
|
| 2394 | 2394 | </label></td> |
| 2395 | 2395 | <td><select name="gd_post_type" id="gd_post_type" style="min-width:140px"> |
| 2396 | - <?php echo $gd_posttypes_option;?> |
|
| 2396 | + <?php echo $gd_posttypes_option; ?> |
|
| 2397 | 2397 | </select></td> |
| 2398 | 2398 | </tr> |
| 2399 | 2399 | <tr> |
| 2400 | - <td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e( 'Max entries per csv file:', 'geodirectory' );?></label></td> |
|
| 2401 | - <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> |
|
| 2400 | + <td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e('Max entries per csv file:', 'geodirectory'); ?></label></td>
|
|
| 2401 | + <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>
|
|
| 2402 | 2402 | </tr> |
| 2403 | 2403 | <tr class="gd-imex-dates"> |
| 2404 | - <td class="fld"><label><?php _e( 'Published Date:', 'geodirectory' );?></label></td> |
|
| 2405 | - <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> |
|
| 2404 | + <td class="fld"><label><?php _e('Published Date:', 'geodirectory'); ?></label></td>
|
|
| 2405 | + <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>
|
|
| 2406 | 2406 | </tr> |
| 2407 | 2407 | <tr> |
| 2408 | 2408 | <td class="fld" style="vertical-align:top"><label> |
| 2409 | - <?php _e( 'Progress:', 'geodirectory' );?> |
|
| 2409 | + <?php _e('Progress:', 'geodirectory'); ?>
|
|
| 2410 | 2410 | </label></td> |
| 2411 | 2411 | <td><div id='gd_progressbar_box'> |
| 2412 | 2412 | <div id="gd_progressbar" class="gd_progressbar"> |
@@ -2414,13 +2414,13 @@ discard block |
||
| 2414 | 2414 | </div> |
| 2415 | 2415 | </div> |
| 2416 | 2416 | <p style="display:inline-block"> |
| 2417 | - <?php _e( 'Elapsed Time:', 'geodirectory' );?> |
|
| 2417 | + <?php _e('Elapsed Time:', 'geodirectory'); ?>
|
|
| 2418 | 2418 | </p> |
| 2419 | 2419 | |
| 2420 | 2420 | <p id="gd_timer" class="gd_timer">00:00:00</p></td> |
| 2421 | 2421 | </tr> |
| 2422 | 2422 | <tr class="gd-ie-actions"> |
| 2423 | - <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"> |
|
| 2423 | + <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">
|
|
| 2424 | 2424 | </td> |
| 2425 | 2425 | <td id="gd_ie_ex_files" class="gd-ie-files"></td> |
| 2426 | 2426 | </tr> |
@@ -2433,21 +2433,21 @@ discard block |
||
| 2433 | 2433 | <div id="gd_ie_imcategs" class="metabox-holder"> |
| 2434 | 2434 | <div class="meta-box-sortables ui-sortable"> |
| 2435 | 2435 | <div id="gd_ie_imcats" class="postbox gd-hndle-pbox"> |
| 2436 | - <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> |
|
| 2437 | - <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Categories: Import CSV', 'geodirectory' );?></span></h3> |
|
| 2436 | + <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>
|
|
| 2437 | + <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Categories: Import CSV', 'geodirectory'); ?></span></h3>
|
|
| 2438 | 2438 | <div class="inside"> |
| 2439 | 2439 | <table class="form-table"> |
| 2440 | 2440 | <tbody> |
| 2441 | 2441 | <tr> |
| 2442 | 2442 | <td class="gd-imex-box"> |
| 2443 | 2443 | <div class="gd-im-choices"> |
| 2444 | - <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> |
|
| 2445 | - <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> |
|
| 2444 | + <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>
|
|
| 2445 | + <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>
|
|
| 2446 | 2446 | </div> |
| 2447 | 2447 | <div class="plupload-upload-uic hide-if-no-js" id="gd_im_catplupload-upload-ui"> |
| 2448 | 2448 | <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');" />
|
| 2449 | - <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"> |
|
| 2450 | - <input type="hidden" id="gd_ie_imcats_csv" value="<?php echo $gd_cats_sample_csv;?>" /> |
|
| 2449 | + <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">
|
|
| 2450 | + <input type="hidden" id="gd_ie_imcats_csv" value="<?php echo $gd_cats_sample_csv; ?>" /> |
|
| 2451 | 2451 | <?php |
| 2452 | 2452 | /** |
| 2453 | 2453 | * Called just after the sample CSV download link. |
@@ -2457,7 +2457,7 @@ discard block |
||
| 2457 | 2457 | */ |
| 2458 | 2458 | do_action('geodir_sample_cats_csv_download_link');
|
| 2459 | 2459 | ?> |
| 2460 | - <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce( 'gd_im_catpluploadan' ); ?>"></span> |
|
| 2460 | + <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce('gd_im_catpluploadan'); ?>"></span>
|
|
| 2461 | 2461 | <div class="filelist"></div> |
| 2462 | 2462 | </div> |
| 2463 | 2463 | <span id="gd_im_catupload-error" style="display:none"></span> |
@@ -2474,7 +2474,7 @@ discard block |
||
| 2474 | 2474 | <input type="hidden" id="gd_terminateaction" value="continue"/> |
| 2475 | 2475 | </div> |
| 2476 | 2476 | <div class="gd-import-progress" id="gd-import-progress" style="display:none"> |
| 2477 | - <div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory');?> </b><font
|
|
| 2477 | + <div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory'); ?> </b><font
|
|
| 2478 | 2478 | id="gd-import-done">0</font> / <font id="gd-import-total">0</font> ( <font |
| 2479 | 2479 | id="gd-import-perc">0%</font> ) |
| 2480 | 2480 | <div class="gd-fileprogress"></div> |
@@ -2486,10 +2486,10 @@ discard block |
||
| 2486 | 2486 | <div class="gd-imex-btns" style="display:none;"> |
| 2487 | 2487 | <input type="hidden" class="geodir_import_file" name="geodir_import_file" value="save"/> |
| 2488 | 2488 | <input onclick="gd_imex_PrepareImport(this, 'cat')" type="button" value="<?php echo CSV_IMPORT_DATA; ?>" id="gd_import_data" class="button-primary" /> |
| 2489 | - <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"/> |
|
| 2490 | - <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')"/>
|
|
| 2489 | + <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"/>
|
|
| 2490 | + <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')"/>
|
|
| 2491 | 2491 | <div id="gd_process_data" style="display:none"> |
| 2492 | - <span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory');?>
|
|
| 2492 | + <span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory'); ?>
|
|
| 2493 | 2493 | </div> |
| 2494 | 2494 | </div> |
| 2495 | 2495 | </td> |
@@ -2503,26 +2503,26 @@ discard block |
||
| 2503 | 2503 | <div id="gd_ie_excategs" class="metabox-holder"> |
| 2504 | 2504 | <div class="meta-box-sortables ui-sortable"> |
| 2505 | 2505 | <div id="gd_ie_ex_cats" class="postbox gd-hndle-pbox"> |
| 2506 | - <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> |
|
| 2507 | - <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Categories: Export CSV', 'geodirectory' );?></span></h3> |
|
| 2506 | + <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>
|
|
| 2507 | + <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Categories: Export CSV', 'geodirectory'); ?></span></h3>
|
|
| 2508 | 2508 | <div class="inside"> |
| 2509 | 2509 | <table class="form-table"> |
| 2510 | 2510 | <tbody> |
| 2511 | 2511 | <tr> |
| 2512 | - <td class="fld"><label for="gd_post_type"><?php _e( 'Post Type:', 'geodirectory' );?></label></td> |
|
| 2513 | - <td><select name="gd_post_type" id="gd_post_type" style="min-width:140px"><?php echo $gd_posttypes_option;?></select></td> |
|
| 2512 | + <td class="fld"><label for="gd_post_type"><?php _e('Post Type:', 'geodirectory'); ?></label></td>
|
|
| 2513 | + <td><select name="gd_post_type" id="gd_post_type" style="min-width:140px"><?php echo $gd_posttypes_option; ?></select></td> |
|
| 2514 | 2514 | </tr> |
| 2515 | 2515 | <tr> |
| 2516 | - <td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e( 'Max entries per csv file:', 'geodirectory' );?></label></td> |
|
| 2517 | - <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> |
|
| 2516 | + <td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e('Max entries per csv file:', 'geodirectory'); ?></label></td>
|
|
| 2517 | + <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>
|
|
| 2518 | 2518 | </tr> |
| 2519 | 2519 | <tr> |
| 2520 | - <td class="fld" style="vertical-align:top"><label><?php _e( 'Progress:', 'geodirectory' );?></label></td> |
|
| 2521 | - <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> |
|
| 2520 | + <td class="fld" style="vertical-align:top"><label><?php _e('Progress:', 'geodirectory'); ?></label></td>
|
|
| 2521 | + <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>
|
|
| 2522 | 2522 | </tr> |
| 2523 | 2523 | <tr class="gd-ie-actions"> |
| 2524 | 2524 | <td style="vertical-align:top"> |
| 2525 | - <input type="submit" value="<?php echo esc_attr( __( 'Export CSV', 'geodirectory' ) );?>" class="button-primary" name="gd_ie_excats_submit" id="gd_ie_excats_submit"> |
|
| 2525 | + <input type="submit" value="<?php echo esc_attr(__('Export CSV', 'geodirectory')); ?>" class="button-primary" name="gd_ie_excats_submit" id="gd_ie_excats_submit">
|
|
| 2526 | 2526 | </td> |
| 2527 | 2527 | <td id="gd_ie_ex_files" class="gd-ie-files"></td> |
| 2528 | 2528 | </tr> |
@@ -2544,7 +2544,7 @@ discard block |
||
| 2544 | 2544 | * @param array $gd_chunksize_options File chunk size options. |
| 2545 | 2545 | * @param string $nonce Wordpress security token for GD import & export. |
| 2546 | 2546 | */ |
| 2547 | - do_action( 'geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce ); |
|
| 2547 | + do_action('geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce);
|
|
| 2548 | 2548 | ?> |
| 2549 | 2549 | </div> |
| 2550 | 2550 | </div> |
@@ -2563,7 +2563,7 @@ discard block |
||
| 2563 | 2563 | jQuery.ajax({
|
| 2564 | 2564 | url: ajaxurl, |
| 2565 | 2565 | type: "POST", |
| 2566 | - data: 'action=geodir_import_export&task=prepare_import&_pt=' + type + '&_file=' + uploadedFile + '&_nonce=<?php echo $nonce;?>', |
|
| 2566 | + data: 'action=geodir_import_export&task=prepare_import&_pt=' + type + '&_file=' + uploadedFile + '&_nonce=<?php echo $nonce; ?>', |
|
| 2567 | 2567 | dataType: 'json', |
| 2568 | 2568 | cache: false, |
| 2569 | 2569 | success: function(data) {
|
@@ -2615,7 +2615,7 @@ discard block |
||
| 2615 | 2615 | |
| 2616 | 2616 | jQuery(cont).find('.filelist .file').remove();
|
| 2617 | 2617 | |
| 2618 | - jQuery('#gd-import-msg', cont).find('#message').removeClass('updated').addClass('error').html("<p><?php echo esc_attr( PLZ_SELECT_CSV_FILE );?></p>");
|
|
| 2618 | + jQuery('#gd-import-msg', cont).find('#message').removeClass('updated').addClass('error').html("<p><?php echo esc_attr(PLZ_SELECT_CSV_FILE); ?></p>");
|
|
| 2619 | 2619 | jQuery('#gd-import-msg', cont).show();
|
| 2620 | 2620 | |
| 2621 | 2621 | return false; |
@@ -2674,7 +2674,7 @@ discard block |
||
| 2674 | 2674 | jQuery.ajax({
|
| 2675 | 2675 | url: ajaxurl, |
| 2676 | 2676 | type: "POST", |
| 2677 | - data: 'action=geodir_import_export&task=import_' + type + '&_pt=' + type + '&_file=' + uploadedFile + gddata + '&_ch=' + choice + '&_nonce=<?php echo $nonce;?>', |
|
| 2677 | + data: 'action=geodir_import_export&task=import_' + type + '&_pt=' + type + '&_file=' + uploadedFile + gddata + '&_ch=' + choice + '&_nonce=<?php echo $nonce; ?>', |
|
| 2678 | 2678 | dataType : 'json', |
| 2679 | 2679 | cache: false, |
| 2680 | 2680 | success: function (data) {
|
@@ -2863,27 +2863,27 @@ discard block |
||
| 2863 | 2863 | |
| 2864 | 2864 | var gdMsg = '<p></p>'; |
| 2865 | 2865 | if ( processed > 0 ) {
|
| 2866 | - var msgParse = '<p><?php echo addslashes( sprintf( __( 'Total %s item(s) found.', 'geodirectory' ), '%s' ) );?></p>'; |
|
| 2866 | + var msgParse = '<p><?php echo addslashes(sprintf(__('Total %s item(s) found.', 'geodirectory'), '%s')); ?></p>';
|
|
| 2867 | 2867 | msgParse = msgParse.replace("%s", processed);
|
| 2868 | 2868 | gdMsg += msgParse; |
| 2869 | 2869 | } |
| 2870 | 2870 | |
| 2871 | 2871 | if ( updated > 0 ) {
|
| 2872 | - var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) updated.', 'geodirectory' ), '%s', '%d' ) );?></p>'; |
|
| 2872 | + var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) updated.', 'geodirectory'), '%s', '%d')); ?></p>';
|
|
| 2873 | 2873 | msgParse = msgParse.replace("%s", updated);
|
| 2874 | 2874 | msgParse = msgParse.replace("%d", processed);
|
| 2875 | 2875 | gdMsg += msgParse; |
| 2876 | 2876 | } |
| 2877 | 2877 | |
| 2878 | 2878 | if ( created > 0 ) {
|
| 2879 | - var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) added.', 'geodirectory' ), '%s', '%d' ) );?></p>'; |
|
| 2879 | + var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) added.', 'geodirectory'), '%s', '%d')); ?></p>';
|
|
| 2880 | 2880 | msgParse = msgParse.replace("%s", created);
|
| 2881 | 2881 | msgParse = msgParse.replace("%d", processed);
|
| 2882 | 2882 | gdMsg += msgParse; |
| 2883 | 2883 | } |
| 2884 | 2884 | |
| 2885 | 2885 | if ( skipped > 0 ) {
|
| 2886 | - var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) ignored due to already exists.', 'geodirectory' ), '%s', '%d' ) );?></p>'; |
|
| 2886 | + var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) ignored due to already exists.', 'geodirectory'), '%s', '%d')); ?></p>';
|
|
| 2887 | 2887 | msgParse = msgParse.replace("%s", skipped);
|
| 2888 | 2888 | msgParse = msgParse.replace("%d", processed);
|
| 2889 | 2889 | gdMsg += msgParse; |
@@ -2893,17 +2893,17 @@ discard block |
||
| 2893 | 2893 | if (type=='loc') {
|
| 2894 | 2894 | invalid_addr = invalid; |
| 2895 | 2895 | } |
| 2896 | - 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>'; |
|
| 2896 | + 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>';
|
|
| 2897 | 2897 | msgParse = msgParse.replace("%s", invalid_addr);
|
| 2898 | 2898 | msgParse = msgParse.replace("%d", total);
|
| 2899 | 2899 | gdMsg += msgParse; |
| 2900 | 2900 | } |
| 2901 | 2901 | |
| 2902 | 2902 | if (invalid > 0 && type!='loc') {
|
| 2903 | - 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>'; |
|
| 2903 | + 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>';
|
|
| 2904 | 2904 | |
| 2905 | 2905 | if (type=='hood') {
|
| 2906 | - 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>'; |
|
| 2906 | + 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>';
|
|
| 2907 | 2907 | } |
| 2908 | 2908 | msgParse = msgParse.replace("%s", invalid);
|
| 2909 | 2909 | msgParse = msgParse.replace("%d", total);
|
@@ -2911,7 +2911,7 @@ discard block |
||
| 2911 | 2911 | } |
| 2912 | 2912 | |
| 2913 | 2913 | if (images > 0) {
|
| 2914 | - gdMsg += '<p><?php echo addslashes( sprintf( CSV_TRANSFER_IMG_FOLDER, $uploads['subdir'] ) );?></p>'; |
|
| 2914 | + gdMsg += '<p><?php echo addslashes(sprintf(CSV_TRANSFER_IMG_FOLDER, $uploads['subdir'])); ?></p>'; |
|
| 2915 | 2915 | } |
| 2916 | 2916 | gdMsg += '<p></p>'; |
| 2917 | 2917 | jQuery('#gd-import-msg', cont).find('#message').removeClass('error').addClass('updated').html(gdMsg);
|
@@ -3075,9 +3075,9 @@ discard block |
||
| 3075 | 3075 | if (typeof filters !== 'undefined' && filters && doFilter) {
|
| 3076 | 3076 | getTotal = true; |
| 3077 | 3077 | attach += '&_c=1'; |
| 3078 | - gd_progressbar(el, 0, '<i class="fa fa-refresh fa-spin"></i><?php echo esc_attr( __( 'Preparing...', 'geodirectory' ) );?>'); |
|
| 3078 | + gd_progressbar(el, 0, '<i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Preparing...', 'geodirectory')); ?>');
|
|
| 3079 | 3079 | } else {
|
| 3080 | - gd_progressbar(el, 0, '0% (0 / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>'); |
|
| 3080 | + gd_progressbar(el, 0, '0% (0 / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>');
|
|
| 3081 | 3081 | } |
| 3082 | 3082 | jQuery(el).find('#gd_timer').text('00:00:01');
|
| 3083 | 3083 | jQuery('#gd_ie_ex_files', el).html('');
|
@@ -3086,7 +3086,7 @@ discard block |
||
| 3086 | 3086 | jQuery.ajax({
|
| 3087 | 3087 | url: ajaxurl, |
| 3088 | 3088 | type: "POST", |
| 3089 | - data: 'action=geodir_import_export&task=export_posts&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce;?>&_p=' + page + attach, |
|
| 3089 | + data: 'action=geodir_import_export&task=export_posts&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce; ?>&_p=' + page + attach, |
|
| 3090 | 3090 | dataType : 'json', |
| 3091 | 3091 | cache: false, |
| 3092 | 3092 | beforeSend: function (jqXHR, settings) {},
|
@@ -3111,11 +3111,11 @@ discard block |
||
| 3111 | 3111 | } else {
|
| 3112 | 3112 | if (pages < page || pages == page) {
|
| 3113 | 3113 | window.clearInterval(timer_posts); |
| 3114 | - gd_progressbar(el, 100, '100% (' + total_posts + ' / ' + total_posts + ') <i class="fa fa-check"></i><?php echo esc_attr( __( 'Complete!', 'geodirectory' ) );?>');
|
|
| 3114 | + gd_progressbar(el, 100, '100% (' + total_posts + ' / ' + total_posts + ') <i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirectory')); ?>');
|
|
| 3115 | 3115 | } else {
|
| 3116 | 3116 | var percentage = Math.round(((page * chunk_size) / total_posts) * 100); |
| 3117 | 3117 | percentage = percentage > 100 ? 100 : percentage; |
| 3118 | - gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>');
|
|
| 3118 | + gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>');
|
|
| 3119 | 3119 | } |
| 3120 | 3120 | if (typeof data.files != 'undefined' && jQuery(data.files).length ) {
|
| 3121 | 3121 | var obj_files = data.files; |
@@ -3146,7 +3146,7 @@ discard block |
||
| 3146 | 3146 | |
| 3147 | 3147 | function gd_process_export_cats(el, post_type, total_cats, chunk_size, pages, page) {
|
| 3148 | 3148 | if (page < 2) {
|
| 3149 | - gd_progressbar(el, 0, '0% (0 / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>'); |
|
| 3149 | + gd_progressbar(el, 0, '0% (0 / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>');
|
|
| 3150 | 3150 | jQuery(el).find('#gd_timer').text('00:00:01');
|
| 3151 | 3151 | jQuery('#gd_ie_ex_files', el).html('');
|
| 3152 | 3152 | } |
@@ -3154,7 +3154,7 @@ discard block |
||
| 3154 | 3154 | jQuery.ajax({
|
| 3155 | 3155 | url: ajaxurl, |
| 3156 | 3156 | type: "POST", |
| 3157 | - data: 'action=geodir_import_export&task=export_cats&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce;?>&_p=' + page, |
|
| 3157 | + data: 'action=geodir_import_export&task=export_cats&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce; ?>&_p=' + page, |
|
| 3158 | 3158 | dataType : 'json', |
| 3159 | 3159 | cache: false, |
| 3160 | 3160 | beforeSend: function (jqXHR, settings) {},
|
@@ -3168,11 +3168,11 @@ discard block |
||
| 3168 | 3168 | } else {
|
| 3169 | 3169 | if (pages < page || pages == page) {
|
| 3170 | 3170 | window.clearInterval(timer_cats); |
| 3171 | - gd_progressbar(el, 100, '100% (' + total_cats + ' / ' + total_cats + ') <i class="fa fa-check"></i><?php echo esc_attr( __( 'Complete!', 'geodirectory' ) );?>');
|
|
| 3171 | + gd_progressbar(el, 100, '100% (' + total_cats + ' / ' + total_cats + ') <i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirectory')); ?>');
|
|
| 3172 | 3172 | } else {
|
| 3173 | 3173 | var percentage = Math.round(((page * chunk_size) / total_cats) * 100); |
| 3174 | 3174 | percentage = percentage > 100 ? 100 : percentage; |
| 3175 | - gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php esc_attr_e( 'Exporting...', 'geodirectory' );?>');
|
|
| 3175 | + gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php esc_attr_e('Exporting...', 'geodirectory'); ?>');
|
|
| 3176 | 3176 | } |
| 3177 | 3177 | if (typeof data.files != 'undefined' && jQuery(data.files).length ) {
|
| 3178 | 3178 | var obj_files = data.files; |
@@ -3229,13 +3229,13 @@ discard block |
||
| 3229 | 3229 | function geodir_init_filesystem() |
| 3230 | 3230 | {
|
| 3231 | 3231 | |
| 3232 | - if(!function_exists('get_filesystem_method')){
|
|
| 3232 | + if (!function_exists('get_filesystem_method')) {
|
|
| 3233 | 3233 | require_once(ABSPATH."/wp-admin/includes/file.php"); |
| 3234 | 3234 | } |
| 3235 | 3235 | $access_type = get_filesystem_method(); |
| 3236 | 3236 | if ($access_type === 'direct') {
|
| 3237 | 3237 | /* you can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */ |
| 3238 | - $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array()); |
|
| 3238 | + $creds = request_filesystem_credentials(trailingslashit(site_url()).'wp-admin/', '', false, false, array()); |
|
| 3239 | 3239 | |
| 3240 | 3240 | /* initialize the API */ |
| 3241 | 3241 | if (!WP_Filesystem($creds)) {
|
@@ -3248,7 +3248,7 @@ discard block |
||
| 3248 | 3248 | return $wp_filesystem; |
| 3249 | 3249 | /* do our file manipulations below */ |
| 3250 | 3250 | } elseif (defined('FTP_USER')) {
|
| 3251 | - $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array()); |
|
| 3251 | + $creds = request_filesystem_credentials(trailingslashit(site_url()).'wp-admin/', '', false, false, array()); |
|
| 3252 | 3252 | |
| 3253 | 3253 | /* initialize the API */ |
| 3254 | 3254 | if (!WP_Filesystem($creds)) {
|
@@ -3283,7 +3283,7 @@ discard block |
||
| 3283 | 3283 | * @package GeoDirectory |
| 3284 | 3284 | */ |
| 3285 | 3285 | function geodir_filesystem_notice() |
| 3286 | -{ if ( defined( 'DOING_AJAX' ) ){return;}
|
|
| 3286 | +{ if (defined('DOING_AJAX')) {return; }
|
|
| 3287 | 3287 | $access_type = get_filesystem_method(); |
| 3288 | 3288 | if ($access_type === 'direct') {
|
| 3289 | 3289 | } elseif (!defined('FTP_USER')) {
|
@@ -3320,64 +3320,64 @@ discard block |
||
| 3320 | 3320 | // try to set higher limits for import |
| 3321 | 3321 | $max_input_time = ini_get('max_input_time');
|
| 3322 | 3322 | $max_execution_time = ini_get('max_execution_time');
|
| 3323 | - $memory_limit= ini_get('memory_limit');
|
|
| 3323 | + $memory_limit = ini_get('memory_limit');
|
|
| 3324 | 3324 | |
| 3325 | - if(!$max_input_time || $max_input_time<3000){
|
|
| 3325 | + if (!$max_input_time || $max_input_time < 3000) {
|
|
| 3326 | 3326 | ini_set('max_input_time', 3000);
|
| 3327 | 3327 | } |
| 3328 | 3328 | |
| 3329 | - if(!$max_execution_time || $max_execution_time<3000){
|
|
| 3329 | + if (!$max_execution_time || $max_execution_time < 3000) {
|
|
| 3330 | 3330 | ini_set('max_execution_time', 3000);
|
| 3331 | 3331 | } |
| 3332 | 3332 | |
| 3333 | - if($memory_limit && str_replace('M','',$memory_limit)){
|
|
| 3334 | - if(str_replace('M','',$memory_limit)<256){
|
|
| 3333 | + if ($memory_limit && str_replace('M', '', $memory_limit)) {
|
|
| 3334 | + if (str_replace('M', '', $memory_limit) < 256) {
|
|
| 3335 | 3335 | ini_set('memory_limit', '256M');
|
| 3336 | 3336 | } |
| 3337 | 3337 | } |
| 3338 | 3338 | |
| 3339 | 3339 | $json = array(); |
| 3340 | 3340 | |
| 3341 | - if ( !current_user_can( 'manage_options' ) ) {
|
|
| 3342 | - wp_send_json( $json ); |
|
| 3341 | + if (!current_user_can('manage_options')) {
|
|
| 3342 | + wp_send_json($json); |
|
| 3343 | 3343 | } |
| 3344 | 3344 | |
| 3345 | - $task = isset( $_REQUEST['task'] ) ? $_REQUEST['task'] : NULL; |
|
| 3346 | - $nonce = isset( $_REQUEST['_nonce'] ) ? $_REQUEST['_nonce'] : NULL; |
|
| 3347 | - $stat = isset( $_REQUEST['_st'] ) ? $_REQUEST['_st'] : false; |
|
| 3345 | + $task = isset($_REQUEST['task']) ? $_REQUEST['task'] : NULL; |
|
| 3346 | + $nonce = isset($_REQUEST['_nonce']) ? $_REQUEST['_nonce'] : NULL; |
|
| 3347 | + $stat = isset($_REQUEST['_st']) ? $_REQUEST['_st'] : false; |
|
| 3348 | 3348 | |
| 3349 | - if ( !wp_verify_nonce( $nonce, 'geodir_import_export_nonce' ) ) {
|
|
| 3350 | - wp_send_json( $json ); |
|
| 3349 | + if (!wp_verify_nonce($nonce, 'geodir_import_export_nonce')) {
|
|
| 3350 | + wp_send_json($json); |
|
| 3351 | 3351 | } |
| 3352 | 3352 | |
| 3353 | - $post_type = isset( $_REQUEST['_pt'] ) ? $_REQUEST['_pt'] : NULL; |
|
| 3354 | - $chunk_per_page = isset( $_REQUEST['_n'] ) ? absint($_REQUEST['_n']) : NULL; |
|
| 3353 | + $post_type = isset($_REQUEST['_pt']) ? $_REQUEST['_pt'] : NULL; |
|
| 3354 | + $chunk_per_page = isset($_REQUEST['_n']) ? absint($_REQUEST['_n']) : NULL; |
|
| 3355 | 3355 | $chunk_per_page = $chunk_per_page < 50 || $chunk_per_page > 100000 ? 5000 : $chunk_per_page; |
| 3356 | - $chunk_page_no = isset( $_REQUEST['_p'] ) ? absint($_REQUEST['_p']) : 1; |
|
| 3356 | + $chunk_page_no = isset($_REQUEST['_p']) ? absint($_REQUEST['_p']) : 1; |
|
| 3357 | 3357 | |
| 3358 | 3358 | $wp_filesystem = geodir_init_filesystem(); |
| 3359 | 3359 | if (!$wp_filesystem) {
|
| 3360 | - $json['error'] = __( 'Filesystem ERROR: Could not access filesystem.', 'geodirectory' ); |
|
| 3361 | - wp_send_json( $json ); |
|
| 3360 | + $json['error'] = __('Filesystem ERROR: Could not access filesystem.', 'geodirectory');
|
|
| 3361 | + wp_send_json($json); |
|
| 3362 | 3362 | } |
| 3363 | 3363 | |
| 3364 | 3364 | if (!empty($wp_filesystem) && isset($wp_filesystem->errors) && is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
|
| 3365 | - $json['error'] = __( 'Filesystem ERROR: ' . $wp_filesystem->errors->get_error_message(), 'geodirectory' ); |
|
| 3366 | - wp_send_json( $json ); |
|
| 3365 | + $json['error'] = __('Filesystem ERROR: '.$wp_filesystem->errors->get_error_message(), 'geodirectory');
|
|
| 3366 | + wp_send_json($json); |
|
| 3367 | 3367 | } |
| 3368 | 3368 | |
| 3369 | - $csv_file_dir = geodir_path_import_export( false ); |
|
| 3370 | - if ( !$wp_filesystem->is_dir( $csv_file_dir ) ) {
|
|
| 3371 | - if ( !$wp_filesystem->mkdir( $csv_file_dir, FS_CHMOD_DIR ) ) {
|
|
| 3372 | - $json['error'] = __( 'ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory' ); |
|
| 3373 | - wp_send_json( $json ); |
|
| 3369 | + $csv_file_dir = geodir_path_import_export(false); |
|
| 3370 | + if (!$wp_filesystem->is_dir($csv_file_dir)) {
|
|
| 3371 | + if (!$wp_filesystem->mkdir($csv_file_dir, FS_CHMOD_DIR)) {
|
|
| 3372 | + $json['error'] = __('ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory');
|
|
| 3373 | + wp_send_json($json); |
|
| 3374 | 3374 | } |
| 3375 | 3375 | } |
| 3376 | 3376 | |
| 3377 | 3377 | $location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
|
| 3378 | 3378 | $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
|
| 3379 | 3379 | |
| 3380 | - switch ( $task ) {
|
|
| 3380 | + switch ($task) {
|
|
| 3381 | 3381 | case 'export_posts': {
|
| 3382 | 3382 | // WPML |
| 3383 | 3383 | $is_wpml = geodir_is_wpml(); |
@@ -3388,36 +3388,36 @@ discard block |
||
| 3388 | 3388 | $sitepress->switch_lang('all', true);
|
| 3389 | 3389 | } |
| 3390 | 3390 | // WPML |
| 3391 | - if ( $post_type == 'gd_event' ) {
|
|
| 3392 | - add_filter( 'geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2 ); |
|
| 3391 | + if ($post_type == 'gd_event') {
|
|
| 3392 | + add_filter('geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2);
|
|
| 3393 | 3393 | } |
| 3394 | - $filters = !empty( $_REQUEST['gd_imex'] ) && is_array( $_REQUEST['gd_imex'] ) ? $_REQUEST['gd_imex'] : NULL; |
|
| 3394 | + $filters = !empty($_REQUEST['gd_imex']) && is_array($_REQUEST['gd_imex']) ? $_REQUEST['gd_imex'] : NULL; |
|
| 3395 | 3395 | |
| 3396 | - $file_name = $post_type . '_' . date( 'dmyHi' ); |
|
| 3397 | - if ( $filters && isset( $filters['start_date'] ) && isset( $filters['end_date'] ) ) {
|
|
| 3398 | - $file_name = $post_type . '_' . date_i18n( 'dmy', strtotime( $filters['start_date'] ) ) . '_' . date_i18n( 'dmy', strtotime( $filters['end_date'] ) ); |
|
| 3396 | + $file_name = $post_type.'_'.date('dmyHi');
|
|
| 3397 | + if ($filters && isset($filters['start_date']) && isset($filters['end_date'])) {
|
|
| 3398 | + $file_name = $post_type.'_'.date_i18n('dmy', strtotime($filters['start_date'])).'_'.date_i18n('dmy', strtotime($filters['end_date']));
|
|
| 3399 | 3399 | } |
| 3400 | - $posts_count = geodir_get_posts_count( $post_type ); |
|
| 3401 | - $file_url_base = geodir_path_import_export() . '/'; |
|
| 3402 | - $file_url = $file_url_base . $file_name . '.csv'; |
|
| 3403 | - $file_path = $csv_file_dir . '/' . $file_name . '.csv'; |
|
| 3404 | - $file_path_temp = $csv_file_dir . '/' . $post_type . '_' . $nonce . '.csv'; |
|
| 3400 | + $posts_count = geodir_get_posts_count($post_type); |
|
| 3401 | + $file_url_base = geodir_path_import_export().'/'; |
|
| 3402 | + $file_url = $file_url_base.$file_name.'.csv'; |
|
| 3403 | + $file_path = $csv_file_dir.'/'.$file_name.'.csv'; |
|
| 3404 | + $file_path_temp = $csv_file_dir.'/'.$post_type.'_'.$nonce.'.csv'; |
|
| 3405 | 3405 | |
| 3406 | 3406 | $chunk_file_paths = array(); |
| 3407 | 3407 | |
| 3408 | - if ( isset( $_REQUEST['_c'] ) ) {
|
|
| 3408 | + if (isset($_REQUEST['_c'])) {
|
|
| 3409 | 3409 | $json['total'] = $posts_count; |
| 3410 | 3410 | // WPML |
| 3411 | 3411 | if ($is_wpml) {
|
| 3412 | 3412 | $sitepress->switch_lang($active_lang, true); |
| 3413 | 3413 | } |
| 3414 | 3414 | // WPML |
| 3415 | - wp_send_json( $json ); |
|
| 3415 | + wp_send_json($json); |
|
| 3416 | 3416 | gd_die(); |
| 3417 | - } else if ( isset( $_REQUEST['_st'] ) ) {
|
|
| 3418 | - $line_count = (int)geodir_import_export_line_count( $file_path_temp ); |
|
| 3419 | - $percentage = count( $posts_count ) > 0 && $line_count > 0 ? ceil( $line_count / $posts_count ) * 100 : 0; |
|
| 3420 | - $percentage = min( $percentage, 100 ); |
|
| 3417 | + } else if (isset($_REQUEST['_st'])) {
|
|
| 3418 | + $line_count = (int) geodir_import_export_line_count($file_path_temp); |
|
| 3419 | + $percentage = count($posts_count) > 0 && $line_count > 0 ? ceil($line_count / $posts_count) * 100 : 0; |
|
| 3420 | + $percentage = min($percentage, 100); |
|
| 3421 | 3421 | |
| 3422 | 3422 | $json['percentage'] = $percentage; |
| 3423 | 3423 | // WPML |
@@ -3425,45 +3425,45 @@ discard block |
||
| 3425 | 3425 | $sitepress->switch_lang($active_lang, true); |
| 3426 | 3426 | } |
| 3427 | 3427 | // WPML |
| 3428 | - wp_send_json( $json ); |
|
| 3428 | + wp_send_json($json); |
|
| 3429 | 3429 | gd_die(); |
| 3430 | 3430 | } else {
|
| 3431 | - if ( !$posts_count > 0 ) {
|
|
| 3432 | - $json['error'] = __( 'No records to export.', 'geodirectory' ); |
|
| 3431 | + if (!$posts_count > 0) {
|
|
| 3432 | + $json['error'] = __('No records to export.', 'geodirectory');
|
|
| 3433 | 3433 | } else {
|
| 3434 | 3434 | $total_posts = $posts_count; |
| 3435 | 3435 | if ($chunk_per_page > $total_posts) {
|
| 3436 | 3436 | $chunk_per_page = $total_posts; |
| 3437 | 3437 | } |
| 3438 | - $chunk_total_pages = ceil( $total_posts / $chunk_per_page ); |
|
| 3438 | + $chunk_total_pages = ceil($total_posts / $chunk_per_page); |
|
| 3439 | 3439 | |
| 3440 | 3440 | $j = $chunk_page_no; |
| 3441 | - $chunk_save_posts = geodir_imex_get_posts( $post_type, $chunk_per_page, $j ); |
|
| 3441 | + $chunk_save_posts = geodir_imex_get_posts($post_type, $chunk_per_page, $j); |
|
| 3442 | 3442 | |
| 3443 | 3443 | $per_page = 500; |
| 3444 | 3444 | if ($per_page > $chunk_per_page) {
|
| 3445 | 3445 | $per_page = $chunk_per_page; |
| 3446 | 3446 | } |
| 3447 | - $total_pages = ceil( $chunk_per_page / $per_page ); |
|
| 3447 | + $total_pages = ceil($chunk_per_page / $per_page); |
|
| 3448 | 3448 | |
| 3449 | - for ( $i = 0; $i <= $total_pages; $i++ ) {
|
|
| 3450 | - $save_posts = array_slice( $chunk_save_posts , ( $i * $per_page ), $per_page ); |
|
| 3449 | + for ($i = 0; $i <= $total_pages; $i++) {
|
|
| 3450 | + $save_posts = array_slice($chunk_save_posts, ($i * $per_page), $per_page); |
|
| 3451 | 3451 | |
| 3452 | 3452 | $clear = $i == 0 ? true : false; |
| 3453 | - geodir_save_csv_data( $file_path_temp, $save_posts, $clear ); |
|
| 3453 | + geodir_save_csv_data($file_path_temp, $save_posts, $clear); |
|
| 3454 | 3454 | } |
| 3455 | 3455 | |
| 3456 | - if ( $wp_filesystem->exists( $file_path_temp ) ) {
|
|
| 3457 | - $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : ''; |
|
| 3458 | - $chunk_file_name = $file_name . $chunk_page_no . '.csv'; |
|
| 3459 | - $file_path = $csv_file_dir . '/' . $chunk_file_name; |
|
| 3460 | - $wp_filesystem->move( $file_path_temp, $file_path, true ); |
|
| 3456 | + if ($wp_filesystem->exists($file_path_temp)) {
|
|
| 3457 | + $chunk_page_no = $chunk_total_pages > 1 ? '-'.$j : ''; |
|
| 3458 | + $chunk_file_name = $file_name.$chunk_page_no.'.csv'; |
|
| 3459 | + $file_path = $csv_file_dir.'/'.$chunk_file_name; |
|
| 3460 | + $wp_filesystem->move($file_path_temp, $file_path, true); |
|
| 3461 | 3461 | |
| 3462 | - $file_url = $file_url_base . $chunk_file_name; |
|
| 3463 | - $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
| 3462 | + $file_url = $file_url_base.$chunk_file_name; |
|
| 3463 | + $chunk_file_paths[] = array('i' => $j.'.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
| 3464 | 3464 | } |
| 3465 | 3465 | |
| 3466 | - if ( !empty($chunk_file_paths) ) {
|
|
| 3466 | + if (!empty($chunk_file_paths)) {
|
|
| 3467 | 3467 | $json['total'] = $posts_count; |
| 3468 | 3468 | $json['files'] = $chunk_file_paths; |
| 3469 | 3469 | } else {
|
@@ -3471,7 +3471,7 @@ discard block |
||
| 3471 | 3471 | $json['total'] = $posts_count; |
| 3472 | 3472 | $json['files'] = array(); |
| 3473 | 3473 | } else {
|
| 3474 | - $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' ); |
|
| 3474 | + $json['error'] = __('ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory');
|
|
| 3475 | 3475 | } |
| 3476 | 3476 | } |
| 3477 | 3477 | } |
@@ -3480,7 +3480,7 @@ discard block |
||
| 3480 | 3480 | $sitepress->switch_lang($active_lang, true); |
| 3481 | 3481 | } |
| 3482 | 3482 | // WPML |
| 3483 | - wp_send_json( $json ); |
|
| 3483 | + wp_send_json($json); |
|
| 3484 | 3484 | } |
| 3485 | 3485 | } |
| 3486 | 3486 | break; |
@@ -3494,20 +3494,20 @@ discard block |
||
| 3494 | 3494 | $sitepress->switch_lang('all', true);
|
| 3495 | 3495 | } |
| 3496 | 3496 | // WPML |
| 3497 | - $file_name = $post_type . 'category_' . date( 'dmyHi' ); |
|
| 3497 | + $file_name = $post_type.'category_'.date('dmyHi');
|
|
| 3498 | 3498 | |
| 3499 | - $terms_count = geodir_get_terms_count( $post_type ); |
|
| 3500 | - $file_url_base = geodir_path_import_export() . '/'; |
|
| 3501 | - $file_url = $file_url_base . $file_name . '.csv'; |
|
| 3502 | - $file_path = $csv_file_dir . '/' . $file_name . '.csv'; |
|
| 3503 | - $file_path_temp = $csv_file_dir . '/' . $post_type . 'category_' . $nonce . '.csv'; |
|
| 3499 | + $terms_count = geodir_get_terms_count($post_type); |
|
| 3500 | + $file_url_base = geodir_path_import_export().'/'; |
|
| 3501 | + $file_url = $file_url_base.$file_name.'.csv'; |
|
| 3502 | + $file_path = $csv_file_dir.'/'.$file_name.'.csv'; |
|
| 3503 | + $file_path_temp = $csv_file_dir.'/'.$post_type.'category_'.$nonce.'.csv'; |
|
| 3504 | 3504 | |
| 3505 | 3505 | $chunk_file_paths = array(); |
| 3506 | 3506 | |
| 3507 | - if ( isset( $_REQUEST['_st'] ) ) {
|
|
| 3508 | - $line_count = (int)geodir_import_export_line_count( $file_path_temp ); |
|
| 3509 | - $percentage = count( $terms_count ) > 0 && $line_count > 0 ? ceil( $line_count / $terms_count ) * 100 : 0; |
|
| 3510 | - $percentage = min( $percentage, 100 ); |
|
| 3507 | + if (isset($_REQUEST['_st'])) {
|
|
| 3508 | + $line_count = (int) geodir_import_export_line_count($file_path_temp); |
|
| 3509 | + $percentage = count($terms_count) > 0 && $line_count > 0 ? ceil($line_count / $terms_count) * 100 : 0; |
|
| 3510 | + $percentage = min($percentage, 100); |
|
| 3511 | 3511 | |
| 3512 | 3512 | $json['percentage'] = $percentage; |
| 3513 | 3513 | // WPML |
@@ -3515,48 +3515,48 @@ discard block |
||
| 3515 | 3515 | $sitepress->switch_lang($active_lang, true); |
| 3516 | 3516 | } |
| 3517 | 3517 | // WPML |
| 3518 | - wp_send_json( $json ); |
|
| 3518 | + wp_send_json($json); |
|
| 3519 | 3519 | } else {
|
| 3520 | - if ( !$terms_count > 0 ) {
|
|
| 3521 | - $json['error'] = __( 'No records to export.', 'geodirectory' ); |
|
| 3520 | + if (!$terms_count > 0) {
|
|
| 3521 | + $json['error'] = __('No records to export.', 'geodirectory');
|
|
| 3522 | 3522 | } else {
|
| 3523 | 3523 | $total_terms = $terms_count; |
| 3524 | 3524 | if ($chunk_per_page > $terms_count) {
|
| 3525 | 3525 | $chunk_per_page = $terms_count; |
| 3526 | 3526 | } |
| 3527 | - $chunk_total_pages = ceil( $total_terms / $chunk_per_page ); |
|
| 3527 | + $chunk_total_pages = ceil($total_terms / $chunk_per_page); |
|
| 3528 | 3528 | |
| 3529 | 3529 | $j = $chunk_page_no; |
| 3530 | - $chunk_save_terms = geodir_imex_get_terms( $post_type, $chunk_per_page, $j ); |
|
| 3530 | + $chunk_save_terms = geodir_imex_get_terms($post_type, $chunk_per_page, $j); |
|
| 3531 | 3531 | |
| 3532 | 3532 | $per_page = 500; |
| 3533 | 3533 | if ($per_page > $chunk_per_page) {
|
| 3534 | 3534 | $per_page = $chunk_per_page; |
| 3535 | 3535 | } |
| 3536 | - $total_pages = ceil( $chunk_per_page / $per_page ); |
|
| 3536 | + $total_pages = ceil($chunk_per_page / $per_page); |
|
| 3537 | 3537 | |
| 3538 | - for ( $i = 0; $i <= $total_pages; $i++ ) {
|
|
| 3539 | - $save_terms = array_slice( $chunk_save_terms , ( $i * $per_page ), $per_page ); |
|
| 3538 | + for ($i = 0; $i <= $total_pages; $i++) {
|
|
| 3539 | + $save_terms = array_slice($chunk_save_terms, ($i * $per_page), $per_page); |
|
| 3540 | 3540 | |
| 3541 | 3541 | $clear = $i == 0 ? true : false; |
| 3542 | - geodir_save_csv_data( $file_path_temp, $save_terms, $clear ); |
|
| 3542 | + geodir_save_csv_data($file_path_temp, $save_terms, $clear); |
|
| 3543 | 3543 | } |
| 3544 | 3544 | |
| 3545 | - if ( $wp_filesystem->exists( $file_path_temp ) ) {
|
|
| 3546 | - $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : ''; |
|
| 3547 | - $chunk_file_name = $file_name . $chunk_page_no . '.csv'; |
|
| 3548 | - $file_path = $csv_file_dir . '/' . $chunk_file_name; |
|
| 3549 | - $wp_filesystem->move( $file_path_temp, $file_path, true ); |
|
| 3545 | + if ($wp_filesystem->exists($file_path_temp)) {
|
|
| 3546 | + $chunk_page_no = $chunk_total_pages > 1 ? '-'.$j : ''; |
|
| 3547 | + $chunk_file_name = $file_name.$chunk_page_no.'.csv'; |
|
| 3548 | + $file_path = $csv_file_dir.'/'.$chunk_file_name; |
|
| 3549 | + $wp_filesystem->move($file_path_temp, $file_path, true); |
|
| 3550 | 3550 | |
| 3551 | - $file_url = $file_url_base . $chunk_file_name; |
|
| 3552 | - $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
| 3551 | + $file_url = $file_url_base.$chunk_file_name; |
|
| 3552 | + $chunk_file_paths[] = array('i' => $j.'.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
| 3553 | 3553 | } |
| 3554 | 3554 | |
| 3555 | - if ( !empty($chunk_file_paths) ) {
|
|
| 3555 | + if (!empty($chunk_file_paths)) {
|
|
| 3556 | 3556 | $json['total'] = $terms_count; |
| 3557 | 3557 | $json['files'] = $chunk_file_paths; |
| 3558 | 3558 | } else {
|
| 3559 | - $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' ); |
|
| 3559 | + $json['error'] = __('ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory');
|
|
| 3560 | 3560 | } |
| 3561 | 3561 | } |
| 3562 | 3562 | // WPML |
@@ -3564,127 +3564,127 @@ discard block |
||
| 3564 | 3564 | $sitepress->switch_lang($active_lang, true); |
| 3565 | 3565 | } |
| 3566 | 3566 | // WPML |
| 3567 | - wp_send_json( $json ); |
|
| 3567 | + wp_send_json($json); |
|
| 3568 | 3568 | } |
| 3569 | 3569 | } |
| 3570 | 3570 | break; |
| 3571 | 3571 | case 'export_locations': {
|
| 3572 | - $file_url_base = geodir_path_import_export() . '/'; |
|
| 3573 | - $file_name = 'gd_locations_' . date( 'dmyHi' ); |
|
| 3574 | - $file_url = $file_url_base . $file_name . '.csv'; |
|
| 3575 | - $file_path = $csv_file_dir . '/' . $file_name . '.csv'; |
|
| 3576 | - $file_path_temp = $csv_file_dir . '/gd_locations_' . $nonce . '.csv'; |
|
| 3572 | + $file_url_base = geodir_path_import_export().'/'; |
|
| 3573 | + $file_name = 'gd_locations_'.date('dmyHi');
|
|
| 3574 | + $file_url = $file_url_base.$file_name.'.csv'; |
|
| 3575 | + $file_path = $csv_file_dir.'/'.$file_name.'.csv'; |
|
| 3576 | + $file_path_temp = $csv_file_dir.'/gd_locations_'.$nonce.'.csv'; |
|
| 3577 | 3577 | |
| 3578 | - $items_count = (int)geodir_location_imex_count_locations(); |
|
| 3578 | + $items_count = (int) geodir_location_imex_count_locations(); |
|
| 3579 | 3579 | |
| 3580 | - if ( isset( $_REQUEST['_st'] ) ) {
|
|
| 3581 | - $line_count = (int)geodir_import_export_line_count( $file_path_temp ); |
|
| 3582 | - $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0; |
|
| 3583 | - $percentage = min( $percentage, 100 ); |
|
| 3580 | + if (isset($_REQUEST['_st'])) {
|
|
| 3581 | + $line_count = (int) geodir_import_export_line_count($file_path_temp); |
|
| 3582 | + $percentage = count($items_count) > 0 && $line_count > 0 ? ceil($line_count / $items_count) * 100 : 0; |
|
| 3583 | + $percentage = min($percentage, 100); |
|
| 3584 | 3584 | |
| 3585 | 3585 | $json['percentage'] = $percentage; |
| 3586 | - wp_send_json( $json ); |
|
| 3586 | + wp_send_json($json); |
|
| 3587 | 3587 | } else {
|
| 3588 | 3588 | $chunk_file_paths = array(); |
| 3589 | 3589 | |
| 3590 | - if ( !$items_count > 0 ) {
|
|
| 3591 | - $json['error'] = __( 'No records to export.', 'geodirectory' ); |
|
| 3590 | + if (!$items_count > 0) {
|
|
| 3591 | + $json['error'] = __('No records to export.', 'geodirectory');
|
|
| 3592 | 3592 | } else {
|
| 3593 | - $chunk_per_page = min( $chunk_per_page, $items_count ); |
|
| 3594 | - $chunk_total_pages = ceil( $items_count / $chunk_per_page ); |
|
| 3593 | + $chunk_per_page = min($chunk_per_page, $items_count); |
|
| 3594 | + $chunk_total_pages = ceil($items_count / $chunk_per_page); |
|
| 3595 | 3595 | |
| 3596 | 3596 | $j = $chunk_page_no; |
| 3597 | - $chunk_save_items = geodir_location_imex_locations_data( $chunk_per_page, $j ); |
|
| 3597 | + $chunk_save_items = geodir_location_imex_locations_data($chunk_per_page, $j); |
|
| 3598 | 3598 | |
| 3599 | 3599 | $per_page = 500; |
| 3600 | - $per_page = min( $per_page, $chunk_per_page ); |
|
| 3601 | - $total_pages = ceil( $chunk_per_page / $per_page ); |
|
| 3600 | + $per_page = min($per_page, $chunk_per_page); |
|
| 3601 | + $total_pages = ceil($chunk_per_page / $per_page); |
|
| 3602 | 3602 | |
| 3603 | - for ( $i = 0; $i <= $total_pages; $i++ ) {
|
|
| 3604 | - $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page ); |
|
| 3603 | + for ($i = 0; $i <= $total_pages; $i++) {
|
|
| 3604 | + $save_items = array_slice($chunk_save_items, ($i * $per_page), $per_page); |
|
| 3605 | 3605 | |
| 3606 | 3606 | $clear = $i == 0 ? true : false; |
| 3607 | - geodir_save_csv_data( $file_path_temp, $save_items, $clear ); |
|
| 3607 | + geodir_save_csv_data($file_path_temp, $save_items, $clear); |
|
| 3608 | 3608 | } |
| 3609 | 3609 | |
| 3610 | - if ( $wp_filesystem->exists( $file_path_temp ) ) {
|
|
| 3611 | - $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : ''; |
|
| 3612 | - $chunk_file_name = $file_name . $chunk_page_no . '.csv'; |
|
| 3613 | - $file_path = $csv_file_dir . '/' . $chunk_file_name; |
|
| 3614 | - $wp_filesystem->move( $file_path_temp, $file_path, true ); |
|
| 3610 | + if ($wp_filesystem->exists($file_path_temp)) {
|
|
| 3611 | + $chunk_page_no = $chunk_total_pages > 1 ? '-'.$j : ''; |
|
| 3612 | + $chunk_file_name = $file_name.$chunk_page_no.'.csv'; |
|
| 3613 | + $file_path = $csv_file_dir.'/'.$chunk_file_name; |
|
| 3614 | + $wp_filesystem->move($file_path_temp, $file_path, true); |
|
| 3615 | 3615 | |
| 3616 | - $file_url = $file_url_base . $chunk_file_name; |
|
| 3617 | - $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
| 3616 | + $file_url = $file_url_base.$chunk_file_name; |
|
| 3617 | + $chunk_file_paths[] = array('i' => $j.'.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
| 3618 | 3618 | } |
| 3619 | 3619 | |
| 3620 | - if ( !empty($chunk_file_paths) ) {
|
|
| 3620 | + if (!empty($chunk_file_paths)) {
|
|
| 3621 | 3621 | $json['total'] = $items_count; |
| 3622 | 3622 | $json['files'] = $chunk_file_paths; |
| 3623 | 3623 | } else {
|
| 3624 | - $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' ); |
|
| 3624 | + $json['error'] = __('Fail, something wrong to create csv file.', 'geodirectory');
|
|
| 3625 | 3625 | } |
| 3626 | 3626 | } |
| 3627 | - wp_send_json( $json ); |
|
| 3627 | + wp_send_json($json); |
|
| 3628 | 3628 | } |
| 3629 | 3629 | } |
| 3630 | 3630 | break; |
| 3631 | 3631 | case 'export_hoods': {
|
| 3632 | - $file_url_base = geodir_path_import_export() . '/'; |
|
| 3633 | - $file_name = 'gd_neighbourhoods_' . date( 'dmyHi' ); |
|
| 3634 | - $file_url = $file_url_base . $file_name . '.csv'; |
|
| 3635 | - $file_path = $csv_file_dir . '/' . $file_name . '.csv'; |
|
| 3636 | - $file_path_temp = $csv_file_dir . '/gd_neighbourhoods_' . $nonce . '.csv'; |
|
| 3632 | + $file_url_base = geodir_path_import_export().'/'; |
|
| 3633 | + $file_name = 'gd_neighbourhoods_'.date('dmyHi');
|
|
| 3634 | + $file_url = $file_url_base.$file_name.'.csv'; |
|
| 3635 | + $file_path = $csv_file_dir.'/'.$file_name.'.csv'; |
|
| 3636 | + $file_path_temp = $csv_file_dir.'/gd_neighbourhoods_'.$nonce.'.csv'; |
|
| 3637 | 3637 | |
| 3638 | - $items_count = (int)geodir_location_imex_count_neighbourhoods(); |
|
| 3638 | + $items_count = (int) geodir_location_imex_count_neighbourhoods(); |
|
| 3639 | 3639 | |
| 3640 | - if ( isset( $_REQUEST['_st'] ) ) {
|
|
| 3641 | - $line_count = (int)geodir_import_export_line_count( $file_path_temp ); |
|
| 3642 | - $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0; |
|
| 3643 | - $percentage = min( $percentage, 100 ); |
|
| 3640 | + if (isset($_REQUEST['_st'])) {
|
|
| 3641 | + $line_count = (int) geodir_import_export_line_count($file_path_temp); |
|
| 3642 | + $percentage = count($items_count) > 0 && $line_count > 0 ? ceil($line_count / $items_count) * 100 : 0; |
|
| 3643 | + $percentage = min($percentage, 100); |
|
| 3644 | 3644 | |
| 3645 | 3645 | $json['percentage'] = $percentage; |
| 3646 | - wp_send_json( $json ); |
|
| 3646 | + wp_send_json($json); |
|
| 3647 | 3647 | } else {
|
| 3648 | 3648 | $chunk_file_paths = array(); |
| 3649 | 3649 | |
| 3650 | - if ( !$items_count > 0 ) {
|
|
| 3651 | - $json['error'] = __( 'No records to export.', 'geodirectory' ); |
|
| 3650 | + if (!$items_count > 0) {
|
|
| 3651 | + $json['error'] = __('No records to export.', 'geodirectory');
|
|
| 3652 | 3652 | } else {
|
| 3653 | - $chunk_per_page = min( $chunk_per_page, $items_count ); |
|
| 3654 | - $chunk_total_pages = ceil( $items_count / $chunk_per_page ); |
|
| 3653 | + $chunk_per_page = min($chunk_per_page, $items_count); |
|
| 3654 | + $chunk_total_pages = ceil($items_count / $chunk_per_page); |
|
| 3655 | 3655 | |
| 3656 | 3656 | $j = $chunk_page_no; |
| 3657 | - $chunk_save_items = geodir_location_imex_neighbourhoods_data( $chunk_per_page, $j ); |
|
| 3657 | + $chunk_save_items = geodir_location_imex_neighbourhoods_data($chunk_per_page, $j); |
|
| 3658 | 3658 | |
| 3659 | 3659 | $per_page = 500; |
| 3660 | - $per_page = min( $per_page, $chunk_per_page ); |
|
| 3661 | - $total_pages = ceil( $chunk_per_page / $per_page ); |
|
| 3660 | + $per_page = min($per_page, $chunk_per_page); |
|
| 3661 | + $total_pages = ceil($chunk_per_page / $per_page); |
|
| 3662 | 3662 | |
| 3663 | - for ( $i = 0; $i <= $total_pages; $i++ ) {
|
|
| 3664 | - $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page ); |
|
| 3663 | + for ($i = 0; $i <= $total_pages; $i++) {
|
|
| 3664 | + $save_items = array_slice($chunk_save_items, ($i * $per_page), $per_page); |
|
| 3665 | 3665 | |
| 3666 | 3666 | $clear = $i == 0 ? true : false; |
| 3667 | - geodir_save_csv_data( $file_path_temp, $save_items, $clear ); |
|
| 3667 | + geodir_save_csv_data($file_path_temp, $save_items, $clear); |
|
| 3668 | 3668 | } |
| 3669 | 3669 | |
| 3670 | - if ( $wp_filesystem->exists( $file_path_temp ) ) {
|
|
| 3671 | - $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : ''; |
|
| 3672 | - $chunk_file_name = $file_name . $chunk_page_no . '.csv'; |
|
| 3673 | - $file_path = $csv_file_dir . '/' . $chunk_file_name; |
|
| 3674 | - $wp_filesystem->move( $file_path_temp, $file_path, true ); |
|
| 3670 | + if ($wp_filesystem->exists($file_path_temp)) {
|
|
| 3671 | + $chunk_page_no = $chunk_total_pages > 1 ? '-'.$j : ''; |
|
| 3672 | + $chunk_file_name = $file_name.$chunk_page_no.'.csv'; |
|
| 3673 | + $file_path = $csv_file_dir.'/'.$chunk_file_name; |
|
| 3674 | + $wp_filesystem->move($file_path_temp, $file_path, true); |
|
| 3675 | 3675 | |
| 3676 | - $file_url = $file_url_base . $chunk_file_name; |
|
| 3677 | - $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
| 3676 | + $file_url = $file_url_base.$chunk_file_name; |
|
| 3677 | + $chunk_file_paths[] = array('i' => $j.'.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
|
| 3678 | 3678 | } |
| 3679 | 3679 | |
| 3680 | - if ( !empty($chunk_file_paths) ) {
|
|
| 3680 | + if (!empty($chunk_file_paths)) {
|
|
| 3681 | 3681 | $json['total'] = $items_count; |
| 3682 | 3682 | $json['files'] = $chunk_file_paths; |
| 3683 | 3683 | } else {
|
| 3684 | - $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' ); |
|
| 3684 | + $json['error'] = __('Fail, something wrong to create csv file.', 'geodirectory');
|
|
| 3685 | 3685 | } |
| 3686 | 3686 | } |
| 3687 | - wp_send_json( $json ); |
|
| 3687 | + wp_send_json($json); |
|
| 3688 | 3688 | } |
| 3689 | 3689 | } |
| 3690 | 3690 | break; |
@@ -3701,25 +3701,25 @@ discard block |
||
| 3701 | 3701 | } |
| 3702 | 3702 | // WPML |
| 3703 | 3703 | |
| 3704 | - ini_set( 'auto_detect_line_endings', true ); |
|
| 3704 | + ini_set('auto_detect_line_endings', true);
|
|
| 3705 | 3705 | |
| 3706 | 3706 | $uploads = wp_upload_dir(); |
| 3707 | 3707 | $uploads_dir = $uploads['path']; |
| 3708 | 3708 | $uploads_subdir = $uploads['subdir']; |
| 3709 | 3709 | |
| 3710 | - $csv_file = isset( $_POST['_file'] ) ? $_POST['_file'] : NULL; |
|
| 3711 | - $import_choice = isset( $_REQUEST['_ch'] ) ? $_REQUEST['_ch'] : 'skip'; |
|
| 3710 | + $csv_file = isset($_POST['_file']) ? $_POST['_file'] : NULL; |
|
| 3711 | + $import_choice = isset($_REQUEST['_ch']) ? $_REQUEST['_ch'] : 'skip'; |
|
| 3712 | 3712 | |
| 3713 | - $csv_file_arr = explode( '/', $csv_file ); |
|
| 3714 | - $csv_filename = end( $csv_file_arr ); |
|
| 3715 | - $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $csv_filename; |
|
| 3713 | + $csv_file_arr = explode('/', $csv_file);
|
|
| 3714 | + $csv_filename = end($csv_file_arr); |
|
| 3715 | + $target_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$csv_filename; |
|
| 3716 | 3716 | |
| 3717 | 3717 | $json['file'] = $csv_file; |
| 3718 | - $json['error'] = __( 'The uploaded file is not a valid csv file. Please try again.', 'geodirectory' ); |
|
| 3718 | + $json['error'] = __('The uploaded file is not a valid csv file. Please try again.', 'geodirectory');
|
|
| 3719 | 3719 | $file = array(); |
| 3720 | 3720 | |
| 3721 | - if ( $csv_file && $wp_filesystem->is_file( $target_path ) && $wp_filesystem->exists( $target_path ) ) {
|
|
| 3722 | - $wp_filetype = wp_check_filetype_and_ext( $target_path, $csv_filename ); |
|
| 3721 | + if ($csv_file && $wp_filesystem->is_file($target_path) && $wp_filesystem->exists($target_path)) {
|
|
| 3722 | + $wp_filetype = wp_check_filetype_and_ext($target_path, $csv_filename); |
|
| 3723 | 3723 | |
| 3724 | 3724 | if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
|
| 3725 | 3725 | $json['error'] = NULL; |
@@ -3727,9 +3727,9 @@ discard block |
||
| 3727 | 3727 | |
| 3728 | 3728 | $lc_all = setlocale(LC_ALL, 0); // Fix issue of fgetcsv ignores special characters when they are at the beginning of line |
| 3729 | 3729 | setlocale(LC_ALL, 'en_US.UTF-8'); |
| 3730 | - if ( ( $handle = fopen($target_path, "r" ) ) !== FALSE ) {
|
|
| 3731 | - while ( ( $data = fgetcsv( $handle, 100000, "," ) ) !== FALSE ) {
|
|
| 3732 | - if ( !empty( $data ) ) {
|
|
| 3730 | + if (($handle = fopen($target_path, "r")) !== FALSE) {
|
|
| 3731 | + while (($data = fgetcsv($handle, 100000, ",")) !== FALSE) {
|
|
| 3732 | + if (!empty($data)) {
|
|
| 3733 | 3733 | $file[] = $data; |
| 3734 | 3734 | } |
| 3735 | 3735 | } |
@@ -3743,19 +3743,19 @@ discard block |
||
| 3743 | 3743 | $json['error'] = __('No data found in csv file.', 'geodirectory');
|
| 3744 | 3744 | } |
| 3745 | 3745 | } else {
|
| 3746 | - wp_send_json( $json ); |
|
| 3746 | + wp_send_json($json); |
|
| 3747 | 3747 | } |
| 3748 | 3748 | } else {
|
| 3749 | - wp_send_json( $json ); |
|
| 3749 | + wp_send_json($json); |
|
| 3750 | 3750 | } |
| 3751 | 3751 | |
| 3752 | - if ( $task == 'prepare_import' || !empty( $json['error'] ) ) {
|
|
| 3753 | - wp_send_json( $json ); |
|
| 3752 | + if ($task == 'prepare_import' || !empty($json['error'])) {
|
|
| 3753 | + wp_send_json($json); |
|
| 3754 | 3754 | } |
| 3755 | 3755 | |
| 3756 | 3756 | $total = $json['rows']; |
| 3757 | - $limit = isset($_POST['limit']) ? (int)$_POST['limit'] : 1; |
|
| 3758 | - $processed = isset($_POST['processed']) ? (int)$_POST['processed'] : 0; |
|
| 3757 | + $limit = isset($_POST['limit']) ? (int) $_POST['limit'] : 1; |
|
| 3758 | + $processed = isset($_POST['processed']) ? (int) $_POST['processed'] : 0; |
|
| 3759 | 3759 | |
| 3760 | 3760 | $count = $limit; |
| 3761 | 3761 | |
@@ -3780,13 +3780,13 @@ discard block |
||
| 3780 | 3780 | |
| 3781 | 3781 | $post_types = geodir_get_posttypes(); |
| 3782 | 3782 | |
| 3783 | - if ( $task == 'import_cat' ) {
|
|
| 3783 | + if ($task == 'import_cat') {
|
|
| 3784 | 3784 | if (!empty($file)) {
|
| 3785 | 3785 | $columns = isset($file[0]) ? $file[0] : NULL; |
| 3786 | 3786 | |
| 3787 | 3787 | if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
|
| 3788 | 3788 | $json['error'] = CSV_INVAILD_FILE; |
| 3789 | - wp_send_json( $json ); |
|
| 3789 | + wp_send_json($json); |
|
| 3790 | 3790 | exit; |
| 3791 | 3791 | } |
| 3792 | 3792 | |
@@ -3797,7 +3797,7 @@ discard block |
||
| 3797 | 3797 | |
| 3798 | 3798 | if (isset($file[$index])) {
|
| 3799 | 3799 | $row = $file[$index]; |
| 3800 | - $row = array_map( 'trim', $row ); |
|
| 3800 | + $row = array_map('trim', $row);
|
|
| 3801 | 3801 | //$row = array_map( 'utf8_encode', $row ); |
| 3802 | 3802 | |
| 3803 | 3803 | $cat_id = ''; |
@@ -3814,42 +3814,42 @@ discard block |
||
| 3814 | 3814 | $cat_id_original = ''; |
| 3815 | 3815 | |
| 3816 | 3816 | $c = 0; |
| 3817 | - foreach ($columns as $column ) {
|
|
| 3818 | - if ( $column == 'cat_id' ) {
|
|
| 3819 | - $cat_id = (int)$row[$c]; |
|
| 3820 | - } else if ( $column == 'cat_name' ) {
|
|
| 3817 | + foreach ($columns as $column) {
|
|
| 3818 | + if ($column == 'cat_id') {
|
|
| 3819 | + $cat_id = (int) $row[$c]; |
|
| 3820 | + } else if ($column == 'cat_name') {
|
|
| 3821 | 3821 | $cat_name = $row[$c]; |
| 3822 | - } else if ( $column == 'cat_slug' ) {
|
|
| 3822 | + } else if ($column == 'cat_slug') {
|
|
| 3823 | 3823 | $cat_slug = $row[$c]; |
| 3824 | - } else if ( $column == 'cat_posttype' ) {
|
|
| 3824 | + } else if ($column == 'cat_posttype') {
|
|
| 3825 | 3825 | $cat_posttype = $row[$c]; |
| 3826 | - } else if ( $column == 'cat_parent' ) {
|
|
| 3826 | + } else if ($column == 'cat_parent') {
|
|
| 3827 | 3827 | $cat_parent = trim($row[$c]); |
| 3828 | - } else if ( $column == 'cat_schema' && $row[$c] != '' ) {
|
|
| 3828 | + } else if ($column == 'cat_schema' && $row[$c] != '') {
|
|
| 3829 | 3829 | $cat_schema = $row[$c]; |
| 3830 | - } else if ( $column == 'cat_description' ) {
|
|
| 3830 | + } else if ($column == 'cat_description') {
|
|
| 3831 | 3831 | $cat_description = $row[$c]; |
| 3832 | - } else if ( $column == 'cat_top_description' ) {
|
|
| 3832 | + } else if ($column == 'cat_top_description') {
|
|
| 3833 | 3833 | $cat_top_description = $row[$c]; |
| 3834 | - } else if ( $column == 'cat_image' ) {
|
|
| 3834 | + } else if ($column == 'cat_image') {
|
|
| 3835 | 3835 | $cat_image = $row[$c]; |
| 3836 | - } else if ( $column == 'cat_icon' ) {
|
|
| 3836 | + } else if ($column == 'cat_icon') {
|
|
| 3837 | 3837 | $cat_icon = $row[$c]; |
| 3838 | 3838 | } |
| 3839 | 3839 | // WPML |
| 3840 | - if ( $is_wpml ) {
|
|
| 3841 | - if ( $column == 'cat_language' ) {
|
|
| 3842 | - $cat_language = geodir_strtolower( trim( $row[$c] ) ); |
|
| 3843 | - } else if ( $column == 'cat_id_original' ) {
|
|
| 3844 | - $cat_id_original = (int)$row[$c]; |
|
| 3840 | + if ($is_wpml) {
|
|
| 3841 | + if ($column == 'cat_language') {
|
|
| 3842 | + $cat_language = geodir_strtolower(trim($row[$c])); |
|
| 3843 | + } else if ($column == 'cat_id_original') {
|
|
| 3844 | + $cat_id_original = (int) $row[$c]; |
|
| 3845 | 3845 | } |
| 3846 | 3846 | } |
| 3847 | 3847 | // WPML |
| 3848 | 3848 | $c++; |
| 3849 | 3849 | } |
| 3850 | 3850 | |
| 3851 | - if ( $cat_name == '' || !in_array( $cat_posttype, $post_types ) ) {
|
|
| 3852 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) ); |
|
| 3851 | + if ($cat_name == '' || !in_array($cat_posttype, $post_types)) {
|
|
| 3852 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be added due to blank title/invalid post type', 'geodirectory'));
|
|
| 3853 | 3853 | |
| 3854 | 3854 | $invalid++; |
| 3855 | 3855 | continue; |
@@ -3867,24 +3867,24 @@ discard block |
||
| 3867 | 3867 | $term_data['description'] = $cat_description; |
| 3868 | 3868 | $term_data['cat_schema'] = $cat_schema; |
| 3869 | 3869 | $term_data['top_description'] = $cat_top_description; |
| 3870 | - $term_data['image'] = $cat_image != '' ? basename( $cat_image ) : ''; |
|
| 3871 | - $term_data['icon'] = $cat_icon != '' ? basename( $cat_icon ) : ''; |
|
| 3870 | + $term_data['image'] = $cat_image != '' ? basename($cat_image) : ''; |
|
| 3871 | + $term_data['icon'] = $cat_icon != '' ? basename($cat_icon) : ''; |
|
| 3872 | 3872 | |
| 3873 | 3873 | //$term_data = array_map( 'utf8_encode', $term_data ); |
| 3874 | 3874 | |
| 3875 | - $taxonomy = $cat_posttype . 'category'; |
|
| 3875 | + $taxonomy = $cat_posttype.'category'; |
|
| 3876 | 3876 | |
| 3877 | 3877 | $term_data['taxonomy'] = $taxonomy; |
| 3878 | 3878 | |
| 3879 | 3879 | $term_parent_id = 0; |
| 3880 | - if ($cat_parent != "" || (int)$cat_parent > 0) {
|
|
| 3880 | + if ($cat_parent != "" || (int) $cat_parent > 0) {
|
|
| 3881 | 3881 | $term_parent = ''; |
| 3882 | 3882 | |
| 3883 | - if ( $term_parent = get_term_by( 'name', $cat_parent, $taxonomy ) ) {
|
|
| 3883 | + if ($term_parent = get_term_by('name', $cat_parent, $taxonomy)) {
|
|
| 3884 | 3884 | // |
| 3885 | - } else if ( $term_parent = get_term_by( 'slug', $cat_parent, $taxonomy ) ) {
|
|
| 3885 | + } else if ($term_parent = get_term_by('slug', $cat_parent, $taxonomy)) {
|
|
| 3886 | 3886 | // |
| 3887 | - } else if ( $term_parent = get_term_by( 'id', $cat_parent, $taxonomy ) ) {
|
|
| 3887 | + } else if ($term_parent = get_term_by('id', $cat_parent, $taxonomy)) {
|
|
| 3888 | 3888 | // |
| 3889 | 3889 | } else {
|
| 3890 | 3890 | $term_parent_data = array(); |
@@ -3892,104 +3892,104 @@ discard block |
||
| 3892 | 3892 | //$term_parent_data = array_map( 'utf8_encode', $term_parent_data ); |
| 3893 | 3893 | $term_parent_data['taxonomy'] = $taxonomy; |
| 3894 | 3894 | |
| 3895 | - $term_parent_id = (int)geodir_imex_insert_term( $taxonomy, $term_parent_data ); |
|
| 3895 | + $term_parent_id = (int) geodir_imex_insert_term($taxonomy, $term_parent_data); |
|
| 3896 | 3896 | } |
| 3897 | 3897 | |
| 3898 | - if ( !empty( $term_parent ) && !is_wp_error( $term_parent ) ) {
|
|
| 3899 | - $term_parent_id = (int)$term_parent->term_id; |
|
| 3898 | + if (!empty($term_parent) && !is_wp_error($term_parent)) {
|
|
| 3899 | + $term_parent_id = (int) $term_parent->term_id; |
|
| 3900 | 3900 | } |
| 3901 | 3901 | } |
| 3902 | - $term_data['parent'] = (int)$term_parent_id; |
|
| 3902 | + $term_data['parent'] = (int) $term_parent_id; |
|
| 3903 | 3903 | |
| 3904 | 3904 | $term_id = NULL; |
| 3905 | - if ( $import_choice == 'update' ) {
|
|
| 3906 | - if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
|
|
| 3905 | + if ($import_choice == 'update') {
|
|
| 3906 | + if ($cat_id > 0 && $term = (array) term_exists($cat_id, $taxonomy)) {
|
|
| 3907 | 3907 | $term_data['term_id'] = $term['term_id']; |
| 3908 | 3908 | |
| 3909 | - if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
|
|
| 3909 | + if ($term_id = geodir_imex_update_term($taxonomy, $term_data)) {
|
|
| 3910 | 3910 | $updated++; |
| 3911 | 3911 | } else {
|
| 3912 | 3912 | $invalid++; |
| 3913 | - 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' ) ); |
|
| 3913 | + 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'));
|
|
| 3914 | 3914 | } |
| 3915 | - } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
|
|
| 3915 | + } else if ($term_data['slug'] != '' && $term = (array) term_exists($term_data['slug'], $taxonomy)) {
|
|
| 3916 | 3916 | $term_data['term_id'] = $term['term_id']; |
| 3917 | 3917 | |
| 3918 | - if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
|
|
| 3918 | + if ($term_id = geodir_imex_update_term($taxonomy, $term_data)) {
|
|
| 3919 | 3919 | $updated++; |
| 3920 | 3920 | } else {
|
| 3921 | 3921 | $invalid++; |
| 3922 | - 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' ) ); |
|
| 3922 | + 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'));
|
|
| 3923 | 3923 | } |
| 3924 | 3924 | } else {
|
| 3925 | - if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
|
|
| 3925 | + if ($term_id = geodir_imex_insert_term($taxonomy, $term_data)) {
|
|
| 3926 | 3926 | $created++; |
| 3927 | 3927 | } else {
|
| 3928 | 3928 | $invalid++; |
| 3929 | - 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' ) ); |
|
| 3929 | + 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'));
|
|
| 3930 | 3930 | } |
| 3931 | 3931 | } |
| 3932 | - } else if ( $import_choice == 'skip' ) {
|
|
| 3933 | - if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
|
|
| 3932 | + } else if ($import_choice == 'skip') {
|
|
| 3933 | + if ($cat_id > 0 && $term = (array) term_exists($cat_id, $taxonomy)) {
|
|
| 3934 | 3934 | $skipped++; |
| 3935 | - } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
|
|
| 3935 | + } else if ($term_data['slug'] != '' && $term = (array) term_exists($term_data['slug'], $taxonomy)) {
|
|
| 3936 | 3936 | $skipped++; |
| 3937 | 3937 | } else {
|
| 3938 | - if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
|
|
| 3938 | + if ($term_id = geodir_imex_insert_term($taxonomy, $term_data)) {
|
|
| 3939 | 3939 | $created++; |
| 3940 | 3940 | } else {
|
| 3941 | 3941 | $invalid++; |
| 3942 | - 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' ) ); |
|
| 3942 | + 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'));
|
|
| 3943 | 3943 | } |
| 3944 | 3944 | } |
| 3945 | 3945 | } else {
|
| 3946 | 3946 | $invalid++; |
| 3947 | - 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' ) ); |
|
| 3947 | + 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'));
|
|
| 3948 | 3948 | } |
| 3949 | 3949 | |
| 3950 | - if ( $term_id ) {
|
|
| 3950 | + if ($term_id) {
|
|
| 3951 | 3951 | // WPML |
| 3952 | 3952 | if ($is_wpml && $cat_id_original > 0 && $cat_language != '') {
|
| 3953 | - $wpml_element_type = 'tax_' . $taxonomy; |
|
| 3954 | - $source_language = geodir_get_language_for_element( $cat_id_original, $wpml_element_type ); |
|
| 3953 | + $wpml_element_type = 'tax_'.$taxonomy; |
|
| 3954 | + $source_language = geodir_get_language_for_element($cat_id_original, $wpml_element_type); |
|
| 3955 | 3955 | $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language(); |
| 3956 | 3956 | |
| 3957 | - $trid = $sitepress->get_element_trid( $cat_id_original, $wpml_element_type ); |
|
| 3957 | + $trid = $sitepress->get_element_trid($cat_id_original, $wpml_element_type); |
|
| 3958 | 3958 | |
| 3959 | - $sitepress->set_element_language_details( $term_id, $wpml_element_type, $trid, $cat_language, $source_language ); |
|
| 3959 | + $sitepress->set_element_language_details($term_id, $wpml_element_type, $trid, $cat_language, $source_language); |
|
| 3960 | 3960 | } |
| 3961 | 3961 | // WPML |
| 3962 | 3962 | |
| 3963 | - if ( isset( $term_data['top_description'] ) ) {
|
|
| 3964 | - update_tax_meta( $term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype ); |
|
| 3963 | + if (isset($term_data['top_description'])) {
|
|
| 3964 | + update_tax_meta($term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype); |
|
| 3965 | 3965 | } |
| 3966 | 3966 | |
| 3967 | - if ( isset( $term_data['cat_schema'] ) ) {
|
|
| 3968 | - update_tax_meta( $term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype ); |
|
| 3967 | + if (isset($term_data['cat_schema'])) {
|
|
| 3968 | + update_tax_meta($term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype); |
|
| 3969 | 3969 | } |
| 3970 | 3970 | |
| 3971 | 3971 | $attachment = false; |
| 3972 | - if ( isset( $term_data['image'] ) && $term_data['image'] != '' ) {
|
|
| 3973 | - $cat_image = geodir_get_default_catimage( $term_id, $cat_posttype ); |
|
| 3974 | - $cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : ''; |
|
| 3972 | + if (isset($term_data['image']) && $term_data['image'] != '') {
|
|
| 3973 | + $cat_image = geodir_get_default_catimage($term_id, $cat_posttype); |
|
| 3974 | + $cat_image = !empty($cat_image) && isset($cat_image['src']) ? $cat_image['src'] : ''; |
|
| 3975 | 3975 | |
| 3976 | - if ( basename($cat_image) != $term_data['image'] ) {
|
|
| 3976 | + if (basename($cat_image) != $term_data['image']) {
|
|
| 3977 | 3977 | $attachment = true; |
| 3978 | - update_tax_meta( $term_id, 'ct_cat_default_img', array( 'id' => 'image', 'src' => $uploads['url'] . '/' . $term_data['image'] ), $cat_posttype ); |
|
| 3978 | + update_tax_meta($term_id, 'ct_cat_default_img', array('id' => 'image', 'src' => $uploads['url'].'/'.$term_data['image']), $cat_posttype);
|
|
| 3979 | 3979 | } |
| 3980 | 3980 | } |
| 3981 | 3981 | |
| 3982 | - if ( isset( $term_data['icon'] ) && $term_data['icon'] != '' ) {
|
|
| 3983 | - $cat_icon = get_tax_meta( $term_id, 'ct_cat_icon', false, $cat_posttype ); |
|
| 3984 | - $cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : ''; |
|
| 3982 | + if (isset($term_data['icon']) && $term_data['icon'] != '') {
|
|
| 3983 | + $cat_icon = get_tax_meta($term_id, 'ct_cat_icon', false, $cat_posttype); |
|
| 3984 | + $cat_icon = !empty($cat_icon) && isset($cat_icon['src']) ? $cat_icon['src'] : ''; |
|
| 3985 | 3985 | |
| 3986 | - if ( basename($cat_icon) != $term_data['icon'] ) {
|
|
| 3986 | + if (basename($cat_icon) != $term_data['icon']) {
|
|
| 3987 | 3987 | $attachment = true; |
| 3988 | - update_tax_meta( $term_id, 'ct_cat_icon', array( 'id' => 'icon', 'src' => $uploads['url'] . '/' . $term_data['icon'] ), $cat_posttype ); |
|
| 3988 | + update_tax_meta($term_id, 'ct_cat_icon', array('id' => 'icon', 'src' => $uploads['url'].'/'.$term_data['icon']), $cat_posttype);
|
|
| 3989 | 3989 | } |
| 3990 | 3990 | } |
| 3991 | 3991 | |
| 3992 | - if ( $attachment ) {
|
|
| 3992 | + if ($attachment) {
|
|
| 3993 | 3993 | $images++; |
| 3994 | 3994 | } |
| 3995 | 3995 | } |
@@ -4011,34 +4011,34 @@ discard block |
||
| 4011 | 4011 | $json['invalid'] = $invalid; |
| 4012 | 4012 | $json['images'] = $images; |
| 4013 | 4013 | |
| 4014 | - wp_send_json( $json ); |
|
| 4014 | + wp_send_json($json); |
|
| 4015 | 4015 | exit; |
| 4016 | - } else if ( $task == 'import_post' ) {
|
|
| 4016 | + } else if ($task == 'import_post') {
|
|
| 4017 | 4017 | //run some stuff to make the import quicker |
| 4018 | - wp_defer_term_counting( true ); |
|
| 4019 | - wp_defer_comment_counting( true ); |
|
| 4020 | - $wpdb->query( 'SET autocommit = 0;' ); |
|
| 4018 | + wp_defer_term_counting(true); |
|
| 4019 | + wp_defer_comment_counting(true); |
|
| 4020 | + $wpdb->query('SET autocommit = 0;');
|
|
| 4021 | 4021 | |
| 4022 | 4022 | //remove_all_actions('publish_post');
|
| 4023 | 4023 | //remove_all_actions('transition_post_status');
|
| 4024 | 4024 | //remove_all_actions('publish_future_post');
|
| 4025 | 4025 | |
| 4026 | 4026 | if (!empty($file)) {
|
| 4027 | - $is_claim_active = is_plugin_active( 'geodir_claim_listing/geodir_claim_listing.php' ) && get_option('geodir_claim_enable') === 'yes' ? true : false;
|
|
| 4027 | + $is_claim_active = is_plugin_active('geodir_claim_listing/geodir_claim_listing.php') && get_option('geodir_claim_enable') === 'yes' ? true : false;
|
|
| 4028 | 4028 | $wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses. |
| 4029 | 4029 | $default_status = 'publish'; |
| 4030 | - $current_date = date_i18n( 'Y-m-d', time() ); |
|
| 4030 | + $current_date = date_i18n('Y-m-d', time());
|
|
| 4031 | 4031 | |
| 4032 | 4032 | $columns = isset($file[0]) ? $file[0] : NULL; |
| 4033 | 4033 | |
| 4034 | 4034 | if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
|
| 4035 | 4035 | $json['error'] = CSV_INVAILD_FILE; |
| 4036 | - wp_send_json( $json ); |
|
| 4036 | + wp_send_json($json); |
|
| 4037 | 4037 | exit; |
| 4038 | 4038 | } |
| 4039 | 4039 | |
| 4040 | 4040 | $gd_error_log = __('GD IMPORT LISTINGS [ROW %d]:', 'geodirectory');
|
| 4041 | - $wp_chars_error = __( '(check & remove if any invalid characters used in data)', 'geodirectory' ); |
|
| 4041 | + $wp_chars_error = __('(check & remove if any invalid characters used in data)', 'geodirectory');
|
|
| 4042 | 4042 | $processed_actual = 0; |
| 4043 | 4043 | for ($i = 1; $i <= $limit; $i++) {
|
| 4044 | 4044 | $index = $processed + $i; |
@@ -4047,9 +4047,9 @@ discard block |
||
| 4047 | 4047 | if (isset($file[$index])) {
|
| 4048 | 4048 | $processed_actual++; |
| 4049 | 4049 | $row = $file[$index]; |
| 4050 | - $row = array_map( 'trim', $row ); |
|
| 4050 | + $row = array_map('trim', $row);
|
|
| 4051 | 4051 | //$row = array_map( 'utf8_encode', $row ); |
| 4052 | - $row = array_map( 'addslashes_gpc', $row ); |
|
| 4052 | + $row = array_map('addslashes_gpc', $row);
|
|
| 4053 | 4053 | |
| 4054 | 4054 | $post_id = ''; |
| 4055 | 4055 | $post_title = ''; |
@@ -4086,78 +4086,78 @@ discard block |
||
| 4086 | 4086 | $original_post_id = ''; |
| 4087 | 4087 | |
| 4088 | 4088 | $c = 0; |
| 4089 | - foreach ($columns as $column ) {
|
|
| 4089 | + foreach ($columns as $column) {
|
|
| 4090 | 4090 | $gd_post[$column] = $row[$c]; |
| 4091 | 4091 | |
| 4092 | - if ( $column == 'post_id' ) {
|
|
| 4092 | + if ($column == 'post_id') {
|
|
| 4093 | 4093 | $post_id = $row[$c]; |
| 4094 | - } else if ( $column == 'post_title' ) {
|
|
| 4094 | + } else if ($column == 'post_title') {
|
|
| 4095 | 4095 | $post_title = sanitize_text_field($row[$c]); |
| 4096 | - } else if ( $column == 'post_author' ) {
|
|
| 4096 | + } else if ($column == 'post_author') {
|
|
| 4097 | 4097 | $post_author = $row[$c]; |
| 4098 | - } else if ( $column == 'post_content' ) {
|
|
| 4098 | + } else if ($column == 'post_content') {
|
|
| 4099 | 4099 | $post_content = $row[$c]; |
| 4100 | - } else if ( $column == 'post_category' && $row[$c] != '' ) {
|
|
| 4101 | - $post_category_arr = explode( ',', $row[$c] ); |
|
| 4102 | - } else if ( $column == 'default_category' ) {
|
|
| 4100 | + } else if ($column == 'post_category' && $row[$c] != '') {
|
|
| 4101 | + $post_category_arr = explode(',', $row[$c]);
|
|
| 4102 | + } else if ($column == 'default_category') {
|
|
| 4103 | 4103 | $default_category = wp_kses_normalize_entities($row[$c]); |
| 4104 | - } else if ( $column == 'post_tags' && $row[$c] != '' ) {
|
|
| 4105 | - $post_tags = explode( ',', sanitize_text_field($row[$c]) ); |
|
| 4106 | - } else if ( $column == 'post_type' ) {
|
|
| 4104 | + } else if ($column == 'post_tags' && $row[$c] != '') {
|
|
| 4105 | + $post_tags = explode(',', sanitize_text_field($row[$c]));
|
|
| 4106 | + } else if ($column == 'post_type') {
|
|
| 4107 | 4107 | $post_type = $row[$c]; |
| 4108 | - } else if ( $column == 'post_status' ) {
|
|
| 4109 | - $post_status = sanitize_key( $row[$c] ); |
|
| 4110 | - } else if ( $column == 'is_featured' ) {
|
|
| 4111 | - $is_featured = (int)$row[$c]; |
|
| 4112 | - } else if ( $column == 'geodir_video' ) {
|
|
| 4108 | + } else if ($column == 'post_status') {
|
|
| 4109 | + $post_status = sanitize_key($row[$c]); |
|
| 4110 | + } else if ($column == 'is_featured') {
|
|
| 4111 | + $is_featured = (int) $row[$c]; |
|
| 4112 | + } else if ($column == 'geodir_video') {
|
|
| 4113 | 4113 | $geodir_video = $row[$c]; |
| 4114 | - } else if ( $column == 'post_address' ) {
|
|
| 4114 | + } else if ($column == 'post_address') {
|
|
| 4115 | 4115 | $post_address = sanitize_text_field($row[$c]); |
| 4116 | - } else if ( $column == 'post_city' ) {
|
|
| 4116 | + } else if ($column == 'post_city') {
|
|
| 4117 | 4117 | $post_city = sanitize_text_field($row[$c]); |
| 4118 | - } else if ( $column == 'post_region' ) {
|
|
| 4118 | + } else if ($column == 'post_region') {
|
|
| 4119 | 4119 | $post_region = sanitize_text_field($row[$c]); |
| 4120 | - } else if ( $column == 'post_country' ) {
|
|
| 4120 | + } else if ($column == 'post_country') {
|
|
| 4121 | 4121 | $post_country = sanitize_text_field($row[$c]); |
| 4122 | - } else if ( $column == 'post_zip' ) {
|
|
| 4122 | + } else if ($column == 'post_zip') {
|
|
| 4123 | 4123 | $post_zip = sanitize_text_field($row[$c]); |
| 4124 | - } else if ( $column == 'post_latitude' ) {
|
|
| 4124 | + } else if ($column == 'post_latitude') {
|
|
| 4125 | 4125 | $post_latitude = sanitize_text_field($row[$c]); |
| 4126 | - } else if ( $column == 'post_longitude' ) {
|
|
| 4126 | + } else if ($column == 'post_longitude') {
|
|
| 4127 | 4127 | $post_longitude = sanitize_text_field($row[$c]); |
| 4128 | - } else if ( $column == 'post_neighbourhood' ) {
|
|
| 4128 | + } else if ($column == 'post_neighbourhood') {
|
|
| 4129 | 4129 | $post_neighbourhood = sanitize_text_field($row[$c]); |
| 4130 | 4130 | unset($gd_post[$column]); |
| 4131 | - } else if ( $column == 'neighbourhood_latitude' ) {
|
|
| 4131 | + } else if ($column == 'neighbourhood_latitude') {
|
|
| 4132 | 4132 | $neighbourhood_latitude = sanitize_text_field($row[$c]); |
| 4133 | - } else if ( $column == 'neighbourhood_longitude' ) {
|
|
| 4133 | + } else if ($column == 'neighbourhood_longitude') {
|
|
| 4134 | 4134 | $neighbourhood_longitude = sanitize_text_field($row[$c]); |
| 4135 | - } else if ( $column == 'geodir_timing' ) {
|
|
| 4135 | + } else if ($column == 'geodir_timing') {
|
|
| 4136 | 4136 | $geodir_timing = sanitize_text_field($row[$c]); |
| 4137 | - } else if ( $column == 'geodir_contact' ) {
|
|
| 4137 | + } else if ($column == 'geodir_contact') {
|
|
| 4138 | 4138 | $geodir_contact = sanitize_text_field($row[$c]); |
| 4139 | - } else if ( $column == 'geodir_email' ) {
|
|
| 4139 | + } else if ($column == 'geodir_email') {
|
|
| 4140 | 4140 | $geodir_email = sanitize_email($row[$c]); |
| 4141 | - } else if ( $column == 'geodir_website' ) {
|
|
| 4141 | + } else if ($column == 'geodir_website') {
|
|
| 4142 | 4142 | $geodir_website = sanitize_text_field($row[$c]); |
| 4143 | - } else if ( $column == 'geodir_twitter' ) {
|
|
| 4143 | + } else if ($column == 'geodir_twitter') {
|
|
| 4144 | 4144 | $geodir_twitter = sanitize_text_field($row[$c]); |
| 4145 | - } else if ( $column == 'geodir_facebook' ) {
|
|
| 4145 | + } else if ($column == 'geodir_facebook') {
|
|
| 4146 | 4146 | $geodir_facebook = sanitize_text_field($row[$c]); |
| 4147 | - } else if ( $column == 'IMAGE' && !empty( $row[$c] ) && $row[$c] != '' ) {
|
|
| 4147 | + } else if ($column == 'IMAGE' && !empty($row[$c]) && $row[$c] != '') {
|
|
| 4148 | 4148 | $post_images[] = $row[$c]; |
| 4149 | - } else if ( $column == 'alive_days' && (int)$row[$c] > 0 ) {
|
|
| 4150 | - $expire_date = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$row[$c] . ' days' ) ); |
|
| 4151 | - } else if ( $column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never' ) {
|
|
| 4149 | + } else if ($column == 'alive_days' && (int) $row[$c] > 0) {
|
|
| 4150 | + $expire_date = date_i18n('Y-m-d', strtotime($current_date.'+'.(int) $row[$c].' days'));
|
|
| 4151 | + } else if ($column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never') {
|
|
| 4152 | 4152 | $row[$c] = str_replace('/', '-', $row[$c]);
|
| 4153 | - $expire_date = date_i18n( 'Y-m-d', strtotime( $row[$c] ) ); |
|
| 4153 | + $expire_date = date_i18n('Y-m-d', strtotime($row[$c]));
|
|
| 4154 | 4154 | } |
| 4155 | 4155 | // WPML |
| 4156 | 4156 | if ($is_wpml) {
|
| 4157 | 4157 | if ($column == 'language') {
|
| 4158 | 4158 | $language = geodir_strtolower(trim($row[$c])); |
| 4159 | 4159 | } else if ($column == 'original_post_id') {
|
| 4160 | - $original_post_id = (int)$row[$c]; |
|
| 4160 | + $original_post_id = (int) $row[$c]; |
|
| 4161 | 4161 | } |
| 4162 | 4162 | } |
| 4163 | 4163 | // WPML |
@@ -4165,7 +4165,7 @@ discard block |
||
| 4165 | 4165 | } |
| 4166 | 4166 | // listing claimed or not |
| 4167 | 4167 | if ($is_claim_active && isset($gd_post['claimed'])) {
|
| 4168 | - $gd_post['claimed'] = (int)$gd_post['claimed'] == 1 ? 1 : 0; |
|
| 4168 | + $gd_post['claimed'] = (int) $gd_post['claimed'] == 1 ? 1 : 0; |
|
| 4169 | 4169 | } |
| 4170 | 4170 | |
| 4171 | 4171 | // WPML |
@@ -4176,43 +4176,43 @@ discard block |
||
| 4176 | 4176 | |
| 4177 | 4177 | $gd_post['IMAGE'] = $post_images; |
| 4178 | 4178 | |
| 4179 | - $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status; |
|
| 4180 | - $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status; |
|
| 4179 | + $post_status = !empty($post_status) ? sanitize_key($post_status) : $default_status; |
|
| 4180 | + $post_status = !empty($wp_post_statuses) && !isset($wp_post_statuses[$post_status]) ? $default_status : $post_status; |
|
| 4181 | 4181 | |
| 4182 | 4182 | $valid = true; |
| 4183 | 4183 | |
| 4184 | - if ( $post_title == '' || !in_array( $post_type, $post_types ) ) {
|
|
| 4184 | + if ($post_title == '' || !in_array($post_type, $post_types)) {
|
|
| 4185 | 4185 | $invalid++; |
| 4186 | 4186 | $valid = false; |
| 4187 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) ); |
|
| 4187 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be added due to blank title/invalid post type', 'geodirectory'));
|
|
| 4188 | 4188 | } |
| 4189 | 4189 | |
| 4190 | - $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true; |
|
| 4191 | - if ( $location_allowed ) {
|
|
| 4190 | + $location_allowed = function_exists('geodir_cpt_no_location') && geodir_cpt_no_location($post_type) ? false : true;
|
|
| 4191 | + if ($location_allowed) {
|
|
| 4192 | 4192 | $location_result = geodir_get_default_location(); |
| 4193 | - if ( $post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '' ) {
|
|
| 4193 | + if ($post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '') {
|
|
| 4194 | 4194 | $invalid_addr++; |
| 4195 | 4195 | $valid = false; |
| 4196 | - 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' ) ); |
|
| 4197 | - } else if ( !empty( $location_result ) && $location_result->location_id == 0 ) {
|
|
| 4198 | - 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 ) ) ) {
|
|
| 4196 | + 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'));
|
|
| 4197 | + } else if (!empty($location_result) && $location_result->location_id == 0) {
|
|
| 4198 | + 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))) {
|
|
| 4199 | 4199 | $invalid_addr++; |
| 4200 | 4200 | $valid = false; |
| 4201 | - 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' ) ); |
|
| 4201 | + 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'));
|
|
| 4202 | 4202 | } else {
|
| 4203 | 4203 | if (!$location_manager) {
|
| 4204 | - $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. |
|
| 4204 | + $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. |
|
| 4205 | 4205 | } |
| 4206 | 4206 | } |
| 4207 | 4207 | } |
| 4208 | 4208 | } |
| 4209 | 4209 | |
| 4210 | - if ( !$valid ) {
|
|
| 4210 | + if (!$valid) {
|
|
| 4211 | 4211 | continue; |
| 4212 | 4212 | } |
| 4213 | 4213 | |
| 4214 | - $cat_taxonomy = $post_type . 'category'; |
|
| 4215 | - $tags_taxonomy = $post_type . '_tags'; |
|
| 4214 | + $cat_taxonomy = $post_type.'category'; |
|
| 4215 | + $tags_taxonomy = $post_type.'_tags'; |
|
| 4216 | 4216 | |
| 4217 | 4217 | if ($default_category != '' && !in_array($default_category, $post_category_arr)) {
|
| 4218 | 4218 | $post_category_arr = array_merge(array($default_category), $post_category_arr); |
@@ -4220,29 +4220,29 @@ discard block |
||
| 4220 | 4220 | |
| 4221 | 4221 | $post_category = array(); |
| 4222 | 4222 | $default_category_id = NULL; |
| 4223 | - if ( !empty( $post_category_arr ) ) {
|
|
| 4224 | - foreach ( $post_category_arr as $value ) {
|
|
| 4225 | - $category_name = wp_kses_normalize_entities( trim( $value ) ); |
|
| 4223 | + if (!empty($post_category_arr)) {
|
|
| 4224 | + foreach ($post_category_arr as $value) {
|
|
| 4225 | + $category_name = wp_kses_normalize_entities(trim($value)); |
|
| 4226 | 4226 | |
| 4227 | - if ( $category_name != '' ) {
|
|
| 4227 | + if ($category_name != '') {
|
|
| 4228 | 4228 | $term_category = array(); |
| 4229 | 4229 | |
| 4230 | - if ( $term = get_term_by( 'name', $category_name, $cat_taxonomy ) ) {
|
|
| 4230 | + if ($term = get_term_by('name', $category_name, $cat_taxonomy)) {
|
|
| 4231 | 4231 | $term_category = $term; |
| 4232 | - } else if ( $term = get_term_by( 'slug', $category_name, $cat_taxonomy ) ) {
|
|
| 4232 | + } else if ($term = get_term_by('slug', $category_name, $cat_taxonomy)) {
|
|
| 4233 | 4233 | $term_category = $term; |
| 4234 | 4234 | } else {
|
| 4235 | 4235 | $term_data = array(); |
| 4236 | 4236 | $term_data['name'] = $category_name; |
| 4237 | 4237 | $term_data['taxonomy'] = $cat_taxonomy; |
| 4238 | 4238 | |
| 4239 | - $term_id = geodir_imex_insert_term( $cat_taxonomy, $term_data ); |
|
| 4240 | - if ( $term_id ) {
|
|
| 4241 | - $term_category = get_term( $term_id, $cat_taxonomy ); |
|
| 4239 | + $term_id = geodir_imex_insert_term($cat_taxonomy, $term_data); |
|
| 4240 | + if ($term_id) {
|
|
| 4241 | + $term_category = get_term($term_id, $cat_taxonomy); |
|
| 4242 | 4242 | } |
| 4243 | 4243 | } |
| 4244 | 4244 | |
| 4245 | - if ( !empty( $term_category ) && !is_wp_error( $term_category ) ) {
|
|
| 4245 | + if (!empty($term_category) && !is_wp_error($term_category)) {
|
|
| 4246 | 4246 | $post_category[] = intval($term_category->term_id); |
| 4247 | 4247 | |
| 4248 | 4248 | if ($category_name == $default_category) {
|
@@ -4263,15 +4263,15 @@ discard block |
||
| 4263 | 4263 | $save_post['post_tags'] = $post_tags; |
| 4264 | 4264 | |
| 4265 | 4265 | $saved_post_id = NULL; |
| 4266 | - if ( $import_choice == 'update' ) {
|
|
| 4267 | - $gd_wp_error = __( 'Unable to add listing, please check the listing data.', 'geodirectory' ); |
|
| 4266 | + if ($import_choice == 'update') {
|
|
| 4267 | + $gd_wp_error = __('Unable to add listing, please check the listing data.', 'geodirectory');
|
|
| 4268 | 4268 | |
| 4269 | - if ( $post_id > 0 && get_post( $post_id ) ) {
|
|
| 4269 | + if ($post_id > 0 && get_post($post_id)) {
|
|
| 4270 | 4270 | $save_post['ID'] = $post_id; |
| 4271 | 4271 | |
| 4272 | - if ( $saved_post_id = wp_update_post( $save_post, true ) ) {
|
|
| 4273 | - if ( is_wp_error( $saved_post_id ) ) {
|
|
| 4274 | - $gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error; |
|
| 4272 | + if ($saved_post_id = wp_update_post($save_post, true)) {
|
|
| 4273 | + if (is_wp_error($saved_post_id)) {
|
|
| 4274 | + $gd_wp_error = $saved_post_id->get_error_message().' '.$wp_chars_error; |
|
| 4275 | 4275 | $saved_post_id = 0; |
| 4276 | 4276 | } else {
|
| 4277 | 4277 | $saved_post_id = $post_id; |
@@ -4279,9 +4279,9 @@ discard block |
||
| 4279 | 4279 | } |
| 4280 | 4280 | } |
| 4281 | 4281 | } else {
|
| 4282 | - if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
|
|
| 4283 | - if ( is_wp_error( $saved_post_id ) ) {
|
|
| 4284 | - $gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error; |
|
| 4282 | + if ($saved_post_id = wp_insert_post($save_post, true)) {
|
|
| 4283 | + if (is_wp_error($saved_post_id)) {
|
|
| 4284 | + $gd_wp_error = $saved_post_id->get_error_message().' '.$wp_chars_error; |
|
| 4285 | 4285 | $saved_post_id = 0; |
| 4286 | 4286 | } else {
|
| 4287 | 4287 | $created++; |
@@ -4289,19 +4289,19 @@ discard block |
||
| 4289 | 4289 | } |
| 4290 | 4290 | } |
| 4291 | 4291 | |
| 4292 | - if ( !$saved_post_id > 0 ) {
|
|
| 4292 | + if (!$saved_post_id > 0) {
|
|
| 4293 | 4293 | $invalid++; |
| 4294 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_wp_error ); |
|
| 4294 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_wp_error); |
|
| 4295 | 4295 | } |
| 4296 | - } else if ( $import_choice == 'skip' ) {
|
|
| 4297 | - if ( $post_id > 0 && get_post( $post_id ) ) {
|
|
| 4296 | + } else if ($import_choice == 'skip') {
|
|
| 4297 | + if ($post_id > 0 && get_post($post_id)) {
|
|
| 4298 | 4298 | $skipped++; |
| 4299 | 4299 | } else {
|
| 4300 | - if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
|
|
| 4301 | - if ( is_wp_error( $saved_post_id ) ) {
|
|
| 4300 | + if ($saved_post_id = wp_insert_post($save_post, true)) {
|
|
| 4301 | + if (is_wp_error($saved_post_id)) {
|
|
| 4302 | 4302 | $invalid++; |
| 4303 | 4303 | |
| 4304 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $saved_post_id->get_error_message() . ' ' . $wp_chars_error ); |
|
| 4304 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$saved_post_id->get_error_message().' '.$wp_chars_error); |
|
| 4305 | 4305 | $saved_post_id = 0; |
| 4306 | 4306 | } else {
|
| 4307 | 4307 | $created++; |
@@ -4309,28 +4309,28 @@ discard block |
||
| 4309 | 4309 | } else {
|
| 4310 | 4310 | $invalid++; |
| 4311 | 4311 | |
| 4312 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error ); |
|
| 4312 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$wp_chars_error); |
|
| 4313 | 4313 | } |
| 4314 | 4314 | } |
| 4315 | 4315 | } else {
|
| 4316 | 4316 | $invalid++; |
| 4317 | 4317 | |
| 4318 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error ); |
|
| 4318 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$wp_chars_error); |
|
| 4319 | 4319 | } |
| 4320 | 4320 | |
| 4321 | - if ( (int)$saved_post_id > 0 ) {
|
|
| 4321 | + if ((int) $saved_post_id > 0) {
|
|
| 4322 | 4322 | // WPML |
| 4323 | 4323 | if ($is_wpml && $original_post_id > 0 && $language != '') {
|
| 4324 | - $wpml_post_type = 'post_' . $post_type; |
|
| 4325 | - $source_language = geodir_get_language_for_element( $original_post_id, $wpml_post_type ); |
|
| 4324 | + $wpml_post_type = 'post_'.$post_type; |
|
| 4325 | + $source_language = geodir_get_language_for_element($original_post_id, $wpml_post_type); |
|
| 4326 | 4326 | $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language(); |
| 4327 | 4327 | |
| 4328 | - $trid = $sitepress->get_element_trid( $original_post_id, $wpml_post_type ); |
|
| 4328 | + $trid = $sitepress->get_element_trid($original_post_id, $wpml_post_type); |
|
| 4329 | 4329 | |
| 4330 | - $sitepress->set_element_language_details( $saved_post_id, $wpml_post_type, $trid, $language, $source_language ); |
|
| 4330 | + $sitepress->set_element_language_details($saved_post_id, $wpml_post_type, $trid, $language, $source_language); |
|
| 4331 | 4331 | } |
| 4332 | 4332 | // WPML |
| 4333 | - $gd_post_info = geodir_get_post_info( $saved_post_id ); |
|
| 4333 | + $gd_post_info = geodir_get_post_info($saved_post_id); |
|
| 4334 | 4334 | |
| 4335 | 4335 | $gd_post['post_id'] = $saved_post_id; |
| 4336 | 4336 | $gd_post['ID'] = $saved_post_id; |
@@ -4342,7 +4342,7 @@ discard block |
||
| 4342 | 4342 | |
| 4343 | 4343 | // post location |
| 4344 | 4344 | $post_location_id = 0; |
| 4345 | - if ( $location_allowed && !empty( $location_result ) && $location_result->location_id > 0 ) {
|
|
| 4345 | + if ($location_allowed && !empty($location_result) && $location_result->location_id > 0) {
|
|
| 4346 | 4346 | $gd_post['post_neighbourhood'] = ''; |
| 4347 | 4347 | |
| 4348 | 4348 | $post_location_info = array( |
@@ -4352,7 +4352,7 @@ discard block |
||
| 4352 | 4352 | 'geo_lat' => $post_latitude, |
| 4353 | 4353 | 'geo_lng' => $post_longitude |
| 4354 | 4354 | ); |
| 4355 | - if ( $location_id = (int)geodir_add_new_location( $post_location_info ) ) {
|
|
| 4355 | + if ($location_id = (int) geodir_add_new_location($post_location_info)) {
|
|
| 4356 | 4356 | $post_location_id = $location_id; |
| 4357 | 4357 | } |
| 4358 | 4358 | |
@@ -4390,14 +4390,14 @@ discard block |
||
| 4390 | 4390 | $gd_post['post_location_id'] = $post_location_id; |
| 4391 | 4391 | |
| 4392 | 4392 | // post package info |
| 4393 | - $package_id = isset( $gd_post['package_id'] ) && !empty( $gd_post['package_id'] ) ? (int)$gd_post['package_id'] : 0; |
|
| 4393 | + $package_id = isset($gd_post['package_id']) && !empty($gd_post['package_id']) ? (int) $gd_post['package_id'] : 0; |
|
| 4394 | 4394 | if (!$package_id && !empty($gd_post_info) && isset($gd_post_info->package_id) && $gd_post_info->package_id) {
|
| 4395 | 4395 | $package_id = $gd_post_info->package_id; |
| 4396 | 4396 | } |
| 4397 | 4397 | |
| 4398 | 4398 | $package_info = array(); |
| 4399 | 4399 | if ($package_id && function_exists('geodir_get_package_info_by_id')) {
|
| 4400 | - $package_info = (array)geodir_get_package_info_by_id($package_id); |
|
| 4400 | + $package_info = (array) geodir_get_package_info_by_id($package_id); |
|
| 4401 | 4401 | |
| 4402 | 4402 | if (!(!empty($package_info) && isset($package_info['post_type']) && $package_info['post_type'] == $post_type)) {
|
| 4403 | 4403 | $package_info = array(); |
@@ -4405,18 +4405,18 @@ discard block |
||
| 4405 | 4405 | } |
| 4406 | 4406 | |
| 4407 | 4407 | if (empty($package_info)) {
|
| 4408 | - $package_info = (array)geodir_post_package_info( array(), '', $post_type ); |
|
| 4408 | + $package_info = (array) geodir_post_package_info(array(), '', $post_type); |
|
| 4409 | 4409 | } |
| 4410 | 4410 | |
| 4411 | - if (!empty($package_info)) {
|
|
| 4411 | + if (!empty($package_info)) {
|
|
| 4412 | 4412 | $package_id = $package_info['pid']; |
| 4413 | 4413 | |
| 4414 | 4414 | if (isset($gd_post['alive_days']) || isset($gd_post['expire_date'])) {
|
| 4415 | 4415 | $gd_post['expire_date'] = $expire_date; |
| 4416 | 4416 | } else {
|
| 4417 | - if ( isset( $package_info['days'] ) && (int)$package_info['days'] > 0 ) {
|
|
| 4418 | - $gd_post['alive_days'] = (int)$package_info['days']; |
|
| 4419 | - $gd_post['expire_date'] = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$package_info['days'] . ' days' ) ); |
|
| 4417 | + if (isset($package_info['days']) && (int) $package_info['days'] > 0) {
|
|
| 4418 | + $gd_post['alive_days'] = (int) $package_info['days']; |
|
| 4419 | + $gd_post['expire_date'] = date_i18n('Y-m-d', strtotime($current_date.'+'.(int) $package_info['days'].' days'));
|
|
| 4420 | 4420 | } else {
|
| 4421 | 4421 | $gd_post['expire_date'] = 'Never'; |
| 4422 | 4422 | } |
@@ -4425,7 +4425,7 @@ discard block |
||
| 4425 | 4425 | $gd_post['package_id'] = $package_id; |
| 4426 | 4426 | } |
| 4427 | 4427 | |
| 4428 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 4428 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 4429 | 4429 | |
| 4430 | 4430 | if ($post_type == 'gd_event') {
|
| 4431 | 4431 | $gd_post = geodir_imex_process_event_data($gd_post); |
@@ -4436,28 +4436,28 @@ discard block |
||
| 4436 | 4436 | } |
| 4437 | 4437 | |
| 4438 | 4438 | // Export franchise fields |
| 4439 | - $is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false; |
|
| 4439 | + $is_franchise_active = is_plugin_active('geodir_franchise/geodir_franchise.php') && geodir_franchise_enabled($post_type) ? true : false;
|
|
| 4440 | 4440 | if ($is_franchise_active) {
|
| 4441 | - if ( isset( $gd_post['gd_is_franchise'] ) && (int)$gd_post['gd_is_franchise'] == 1 ) {
|
|
| 4441 | + if (isset($gd_post['gd_is_franchise']) && (int) $gd_post['gd_is_franchise'] == 1) {
|
|
| 4442 | 4442 | $gd_franchise_lock = array(); |
| 4443 | 4443 | |
| 4444 | - if ( isset( $gd_post['gd_franchise_lock'] ) ) {
|
|
| 4445 | - $gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock'] );
|
|
| 4446 | - $gd_franchise_lock = trim( $gd_franchise_lock ); |
|
| 4447 | - $gd_franchise_lock = explode( ",", $gd_franchise_lock ); |
|
| 4444 | + if (isset($gd_post['gd_franchise_lock'])) {
|
|
| 4445 | + $gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock']);
|
|
| 4446 | + $gd_franchise_lock = trim($gd_franchise_lock); |
|
| 4447 | + $gd_franchise_lock = explode(",", $gd_franchise_lock);
|
|
| 4448 | 4448 | } |
| 4449 | 4449 | |
| 4450 | - update_post_meta( $saved_post_id, 'gd_is_franchise', 1 ); |
|
| 4451 | - update_post_meta( $saved_post_id, 'gd_franchise_lock', $gd_franchise_lock ); |
|
| 4450 | + update_post_meta($saved_post_id, 'gd_is_franchise', 1); |
|
| 4451 | + update_post_meta($saved_post_id, 'gd_franchise_lock', $gd_franchise_lock); |
|
| 4452 | 4452 | } else {
|
| 4453 | - if ( isset( $gd_post['franchise'] ) && (int)$gd_post['franchise'] > 0 && geodir_franchise_check( (int)$gd_post['franchise'] ) ) {
|
|
| 4454 | - geodir_save_post_meta( $saved_post_id, 'franchise', (int)$gd_post['franchise'] ); |
|
| 4453 | + if (isset($gd_post['franchise']) && (int) $gd_post['franchise'] > 0 && geodir_franchise_check((int) $gd_post['franchise'])) {
|
|
| 4454 | + geodir_save_post_meta($saved_post_id, 'franchise', (int) $gd_post['franchise']); |
|
| 4455 | 4455 | } |
| 4456 | 4456 | } |
| 4457 | 4457 | } |
| 4458 | 4458 | |
| 4459 | 4459 | if (!empty($save_post['post_category']) && is_array($save_post['post_category'])) {
|
| 4460 | - $save_post['post_category'] = array_unique( array_map( 'intval', $save_post['post_category'] ) ); |
|
| 4460 | + $save_post['post_category'] = array_unique(array_map('intval', $save_post['post_category']));
|
|
| 4461 | 4461 | if ($default_category_id) {
|
| 4462 | 4462 | $save_post['post_default_category'] = $default_category_id; |
| 4463 | 4463 | $gd_post['default_category'] = $default_category_id; |
@@ -4466,34 +4466,34 @@ discard block |
||
| 4466 | 4466 | } |
| 4467 | 4467 | |
| 4468 | 4468 | // Save post info |
| 4469 | - geodir_save_post_info( $saved_post_id, $gd_post ); |
|
| 4469 | + geodir_save_post_info($saved_post_id, $gd_post); |
|
| 4470 | 4470 | // post taxonomies |
| 4471 | - if ( !empty( $save_post['post_category'] ) ) {
|
|
| 4472 | - wp_set_object_terms( $saved_post_id, $save_post['post_category'], $cat_taxonomy ); |
|
| 4471 | + if (!empty($save_post['post_category'])) {
|
|
| 4472 | + wp_set_object_terms($saved_post_id, $save_post['post_category'], $cat_taxonomy); |
|
| 4473 | 4473 | |
| 4474 | - $post_default_category = isset( $save_post['post_default_category'] ) ? $save_post['post_default_category'] : ''; |
|
| 4474 | + $post_default_category = isset($save_post['post_default_category']) ? $save_post['post_default_category'] : ''; |
|
| 4475 | 4475 | if ($default_category_id) {
|
| 4476 | 4476 | $post_default_category = $default_category_id; |
| 4477 | 4477 | } |
| 4478 | 4478 | $post_cat_ids = geodir_get_post_meta($saved_post_id, $cat_taxonomy); |
| 4479 | 4479 | $save_post['post_category'] = !empty($post_cat_ids) ? explode(",", trim($post_cat_ids, ",")) : $save_post['post_category'];
|
| 4480 | - $post_category_str = !empty($save_post['post_category']) ? implode(",y:#", $save_post['post_category']) . ',y:' : '';
|
|
| 4480 | + $post_category_str = !empty($save_post['post_category']) ? implode(",y:#", $save_post['post_category']).',y:' : '';
|
|
| 4481 | 4481 | |
| 4482 | 4482 | if ($post_category_str != '' && $post_default_category) {
|
| 4483 | - $post_category_str = str_replace($post_default_category . ',y:', $post_default_category . ',y,d:', $post_category_str); |
|
| 4483 | + $post_category_str = str_replace($post_default_category.',y:', $post_default_category.',y,d:', $post_category_str); |
|
| 4484 | 4484 | } |
| 4485 | 4485 | |
| 4486 | 4486 | $post_category_str = $post_category_str != '' ? array($cat_taxonomy => $post_category_str) : ''; |
| 4487 | 4487 | |
| 4488 | - geodir_set_postcat_structure( $saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str ); |
|
| 4488 | + geodir_set_postcat_structure($saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str); |
|
| 4489 | 4489 | } |
| 4490 | 4490 | |
| 4491 | - if ( !empty( $save_post['post_tags'] ) ) {
|
|
| 4492 | - wp_set_object_terms( $saved_post_id, $save_post['post_tags'], $tags_taxonomy ); |
|
| 4491 | + if (!empty($save_post['post_tags'])) {
|
|
| 4492 | + wp_set_object_terms($saved_post_id, $save_post['post_tags'], $tags_taxonomy); |
|
| 4493 | 4493 | } |
| 4494 | 4494 | |
| 4495 | 4495 | // Post images |
| 4496 | - if ( !empty( $post_images ) ) {
|
|
| 4496 | + if (!empty($post_images)) {
|
|
| 4497 | 4497 | $post_images = array_unique($post_images); |
| 4498 | 4498 | |
| 4499 | 4499 | $old_post_images_arr = array(); |
@@ -4501,61 +4501,61 @@ discard block |
||
| 4501 | 4501 | |
| 4502 | 4502 | $order = 1; |
| 4503 | 4503 | |
| 4504 | - $old_post_images = geodir_get_images( $saved_post_id ); |
|
| 4504 | + $old_post_images = geodir_get_images($saved_post_id); |
|
| 4505 | 4505 | if (!empty($old_post_images)) {
|
| 4506 | - foreach( $old_post_images as $old_post_image ) {
|
|
| 4506 | + foreach ($old_post_images as $old_post_image) {
|
|
| 4507 | 4507 | if (!empty($old_post_image) && isset($old_post_image->file) && $old_post_image->file != '') {
|
| 4508 | 4508 | $old_post_images_arr[] = $old_post_image->file; |
| 4509 | 4509 | } |
| 4510 | 4510 | } |
| 4511 | 4511 | } |
| 4512 | 4512 | |
| 4513 | - foreach ( $post_images as $post_image ) {
|
|
| 4514 | - $image_name = basename( $post_image ); |
|
| 4513 | + foreach ($post_images as $post_image) {
|
|
| 4514 | + $image_name = basename($post_image); |
|
| 4515 | 4515 | $saved_post_images_arr[] = $image_name; |
| 4516 | 4516 | |
| 4517 | - if (!empty($old_post_images_arr) && in_array( $image_name, $old_post_images_arr) ) {
|
|
| 4517 | + if (!empty($old_post_images_arr) && in_array($image_name, $old_post_images_arr)) {
|
|
| 4518 | 4518 | continue; // Skip if image already exists. |
| 4519 | 4519 | } |
| 4520 | 4520 | |
| 4521 | - $image_name_parts = explode( '.', $image_name ); |
|
| 4522 | - array_pop( $image_name_parts ); |
|
| 4523 | - $proper_image_name = implode( '.', $image_name_parts ); |
|
| 4521 | + $image_name_parts = explode('.', $image_name);
|
|
| 4522 | + array_pop($image_name_parts); |
|
| 4523 | + $proper_image_name = implode('.', $image_name_parts);
|
|
| 4524 | 4524 | |
| 4525 | - $arr_file_type = wp_check_filetype( $image_name ); |
|
| 4525 | + $arr_file_type = wp_check_filetype($image_name); |
|
| 4526 | 4526 | |
| 4527 | - if ( !empty( $arr_file_type ) ) {
|
|
| 4527 | + if (!empty($arr_file_type)) {
|
|
| 4528 | 4528 | $uploaded_file_type = $arr_file_type['type']; |
| 4529 | 4529 | |
| 4530 | 4530 | $attachment = array(); |
| 4531 | 4531 | $attachment['post_id'] = $saved_post_id; |
| 4532 | 4532 | $attachment['title'] = $proper_image_name; |
| 4533 | 4533 | $attachment['content'] = ''; |
| 4534 | - $attachment['file'] = $uploads_subdir . '/' . $image_name; |
|
| 4534 | + $attachment['file'] = $uploads_subdir.'/'.$image_name; |
|
| 4535 | 4535 | $attachment['mime_type'] = $uploaded_file_type; |
| 4536 | 4536 | $attachment['menu_order'] = $order; |
| 4537 | 4537 | $attachment['is_featured'] = 0; |
| 4538 | 4538 | |
| 4539 | 4539 | $attachment_set = ''; |
| 4540 | - foreach ( $attachment as $key => $val ) {
|
|
| 4541 | - if ( $val != '' ) {
|
|
| 4542 | - $attachment_set .= $key . " = '" . $val . "', "; |
|
| 4540 | + foreach ($attachment as $key => $val) {
|
|
| 4541 | + if ($val != '') {
|
|
| 4542 | + $attachment_set .= $key." = '".$val."', "; |
|
| 4543 | 4543 | } |
| 4544 | 4544 | } |
| 4545 | - $attachment_set = trim( $attachment_set, ", " ); |
|
| 4545 | + $attachment_set = trim($attachment_set, ", "); |
|
| 4546 | 4546 | |
| 4547 | 4547 | // Add new attachment |
| 4548 | - $wpdb->query( "INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set ); |
|
| 4548 | + $wpdb->query("INSERT INTO ".GEODIR_ATTACHMENT_TABLE." SET ".$attachment_set);
|
|
| 4549 | 4549 | |
| 4550 | 4550 | $order++; |
| 4551 | 4551 | } |
| 4552 | 4552 | } |
| 4553 | 4553 | |
| 4554 | - $saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/" . implode("' AND file NOT LIKE '%/", $saved_post_images_arr) . "' )" : '';
|
|
| 4554 | + $saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/".implode("' AND file NOT LIKE '%/", $saved_post_images_arr)."' )" : '';
|
|
| 4555 | 4555 | // Remove previous attachment |
| 4556 | - $wpdb->query( "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = " . (int)$saved_post_id . " " . $saved_post_images_sql ); |
|
| 4556 | + $wpdb->query("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id = ".(int) $saved_post_id." ".$saved_post_images_sql);
|
|
| 4557 | 4557 | |
| 4558 | - if ( !empty( $saved_post_images_arr ) ) {
|
|
| 4558 | + if (!empty($saved_post_images_arr)) {
|
|
| 4559 | 4559 | geodir_set_wp_featured_image($saved_post_id); |
| 4560 | 4560 | /* |
| 4561 | 4561 | $menu_order = 1; |
@@ -4572,13 +4572,13 @@ discard block |
||
| 4572 | 4572 | }*/ |
| 4573 | 4573 | } |
| 4574 | 4574 | |
| 4575 | - if ( $order > 1 ) {
|
|
| 4575 | + if ($order > 1) {
|
|
| 4576 | 4576 | $images++; |
| 4577 | 4577 | } |
| 4578 | 4578 | } |
| 4579 | 4579 | |
| 4580 | 4580 | /** This action is documented in geodirectory-functions/post-functions.php */ |
| 4581 | - do_action( 'geodir_after_save_listing', $saved_post_id, $gd_post ); |
|
| 4581 | + do_action('geodir_after_save_listing', $saved_post_id, $gd_post);
|
|
| 4582 | 4582 | |
| 4583 | 4583 | if (isset($is_featured)) {
|
| 4584 | 4584 | geodir_save_post_meta($saved_post_id, 'is_featured', $is_featured); |
@@ -4598,10 +4598,10 @@ discard block |
||
| 4598 | 4598 | } |
| 4599 | 4599 | |
| 4600 | 4600 | //undo some stuff to make the import quicker |
| 4601 | - wp_defer_term_counting( false ); |
|
| 4602 | - wp_defer_comment_counting( false ); |
|
| 4603 | - $wpdb->query( 'COMMIT;' ); |
|
| 4604 | - $wpdb->query( 'SET autocommit = 1;' ); |
|
| 4601 | + wp_defer_term_counting(false); |
|
| 4602 | + wp_defer_comment_counting(false); |
|
| 4603 | + $wpdb->query('COMMIT;');
|
|
| 4604 | + $wpdb->query('SET autocommit = 1;');
|
|
| 4605 | 4605 | |
| 4606 | 4606 | $json = array(); |
| 4607 | 4607 | $json['processed'] = $processed_actual; |
@@ -4612,9 +4612,9 @@ discard block |
||
| 4612 | 4612 | $json['invalid_addr'] = $invalid_addr; |
| 4613 | 4613 | $json['images'] = $images; |
| 4614 | 4614 | |
| 4615 | - wp_send_json( $json ); |
|
| 4615 | + wp_send_json($json); |
|
| 4616 | 4616 | exit; |
| 4617 | - } else if ( $task == 'import_loc' ) {
|
|
| 4617 | + } else if ($task == 'import_loc') {
|
|
| 4618 | 4618 | global $gd_post_types; |
| 4619 | 4619 | $gd_post_types = $post_types; |
| 4620 | 4620 | |
@@ -4623,82 +4623,82 @@ discard block |
||
| 4623 | 4623 | |
| 4624 | 4624 | if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
|
| 4625 | 4625 | $json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
|
| 4626 | - wp_send_json( $json ); |
|
| 4626 | + wp_send_json($json); |
|
| 4627 | 4627 | } |
| 4628 | 4628 | |
| 4629 | 4629 | $gd_error_log = __('GD IMPORT LOCATIONS [ROW %d]:', 'geodirectory');
|
| 4630 | - $gd_error_location = __( 'Could not be saved due to blank/invalid address(city, region, country, latitude, longitude)', 'geodirectory' ); |
|
| 4630 | + $gd_error_location = __('Could not be saved due to blank/invalid address(city, region, country, latitude, longitude)', 'geodirectory');
|
|
| 4631 | 4631 | for ($i = 1; $i <= $limit; $i++) {
|
| 4632 | 4632 | $index = $processed + $i; |
| 4633 | 4633 | |
| 4634 | 4634 | if (isset($file[$index])) {
|
| 4635 | 4635 | $row = $file[$index]; |
| 4636 | - $row = array_map( 'trim', $row ); |
|
| 4636 | + $row = array_map('trim', $row);
|
|
| 4637 | 4637 | $data = array(); |
| 4638 | 4638 | |
| 4639 | - foreach ($columns as $c => $column ) {
|
|
| 4639 | + foreach ($columns as $c => $column) {
|
|
| 4640 | 4640 | 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'))) {
|
| 4641 | 4641 | $data[$column] = $row[$c]; |
| 4642 | 4642 | } |
| 4643 | 4643 | } |
| 4644 | 4644 | |
| 4645 | - if ( empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude']) ) {
|
|
| 4645 | + if (empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude'])) {
|
|
| 4646 | 4646 | $invalid++; |
| 4647 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location ); |
|
| 4647 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location); |
|
| 4648 | 4648 | continue; |
| 4649 | 4649 | } |
| 4650 | 4650 | |
| 4651 | 4651 | $data['location_id'] = isset($data['location_id']) ? absint($data['location_id']) : 0; |
| 4652 | 4652 | |
| 4653 | - if ( $import_choice == 'update' ) {
|
|
| 4654 | - if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
|
|
| 4655 | - if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
|
|
| 4653 | + if ($import_choice == 'update') {
|
|
| 4654 | + if ((int) $data['location_id'] > 0 && $location = geodir_get_location_by_id('', (int) $data['location_id'])) {
|
|
| 4655 | + if ($location_id = geodir_location_update_city($data, true, $location)) {
|
|
| 4656 | 4656 | $updated++; |
| 4657 | 4657 | } else {
|
| 4658 | 4658 | $invalid++; |
| 4659 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location ); |
|
| 4659 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location); |
|
| 4660 | 4660 | } |
| 4661 | - } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
|
|
| 4662 | - $data['location_id'] = (int)$location->location_id; |
|
| 4661 | + } else if (!empty($data['city_slug']) && $location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug']))) {
|
|
| 4662 | + $data['location_id'] = (int) $location->location_id; |
|
| 4663 | 4663 | |
| 4664 | - if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region'] ) ) ) {
|
|
| 4665 | - $data['location_id'] = (int)$location->location_id; |
|
| 4666 | - } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'region' => $data['region'] ) ) ) {
|
|
| 4667 | - $data['location_id'] = (int)$location->location_id; |
|
| 4668 | - } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'] ) ) ) {
|
|
| 4669 | - $data['location_id'] = (int)$location->location_id; |
|
| 4664 | + if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region']))) {
|
|
| 4665 | + $data['location_id'] = (int) $location->location_id; |
|
| 4666 | + } else if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'region' => $data['region']))) {
|
|
| 4667 | + $data['location_id'] = (int) $location->location_id; |
|
| 4668 | + } else if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'country' => $data['country']))) {
|
|
| 4669 | + $data['location_id'] = (int) $location->location_id; |
|
| 4670 | 4670 | } |
| 4671 | 4671 | |
| 4672 | - if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
|
|
| 4672 | + if ($location_id = geodir_location_update_city($data, true, $location)) {
|
|
| 4673 | 4673 | $updated++; |
| 4674 | 4674 | } else {
|
| 4675 | 4675 | $invalid++; |
| 4676 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location ); |
|
| 4676 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location); |
|
| 4677 | 4677 | } |
| 4678 | 4678 | } else {
|
| 4679 | - if ( $location_id = geodir_location_insert_city( $data, true ) ) {
|
|
| 4679 | + if ($location_id = geodir_location_insert_city($data, true)) {
|
|
| 4680 | 4680 | $created++; |
| 4681 | 4681 | } else {
|
| 4682 | 4682 | $invalid++; |
| 4683 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location ); |
|
| 4683 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location); |
|
| 4684 | 4684 | } |
| 4685 | 4685 | } |
| 4686 | - } elseif ( $import_choice == 'skip' ) {
|
|
| 4687 | - if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
|
|
| 4686 | + } elseif ($import_choice == 'skip') {
|
|
| 4687 | + if ((int) $data['location_id'] > 0 && $location = geodir_get_location_by_id('', (int) $data['location_id'])) {
|
|
| 4688 | 4688 | $skipped++; |
| 4689 | - } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
|
|
| 4689 | + } else if (!empty($data['city_slug']) && $location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug']))) {
|
|
| 4690 | 4690 | $skipped++; |
| 4691 | 4691 | } else {
|
| 4692 | - if ( $location_id = geodir_location_insert_city( $data, true ) ) {
|
|
| 4692 | + if ($location_id = geodir_location_insert_city($data, true)) {
|
|
| 4693 | 4693 | $created++; |
| 4694 | 4694 | } else {
|
| 4695 | 4695 | $invalid++; |
| 4696 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location ); |
|
| 4696 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location); |
|
| 4697 | 4697 | } |
| 4698 | 4698 | } |
| 4699 | 4699 | } else {
|
| 4700 | 4700 | $invalid++; |
| 4701 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location ); |
|
| 4701 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location); |
|
| 4702 | 4702 | } |
| 4703 | 4703 | } |
| 4704 | 4704 | } |
@@ -4712,24 +4712,24 @@ discard block |
||
| 4712 | 4712 | $json['invalid'] = $invalid; |
| 4713 | 4713 | $json['images'] = $images; |
| 4714 | 4714 | |
| 4715 | - wp_send_json( $json ); |
|
| 4716 | - } else if ( $task == 'import_hood' ) {
|
|
| 4715 | + wp_send_json($json); |
|
| 4716 | + } else if ($task == 'import_hood') {
|
|
| 4717 | 4717 | if (!empty($file)) {
|
| 4718 | 4718 | $columns = isset($file[0]) ? $file[0] : NULL; |
| 4719 | 4719 | |
| 4720 | 4720 | if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
|
| 4721 | 4721 | $json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
|
| 4722 | - wp_send_json( $json ); |
|
| 4722 | + wp_send_json($json); |
|
| 4723 | 4723 | } |
| 4724 | 4724 | |
| 4725 | 4725 | $gd_error_log = __('GD IMPORT NEIGHBOURHOODS [ROW %d]:', 'geodirectory');
|
| 4726 | - $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' ); |
|
| 4726 | + $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');
|
|
| 4727 | 4727 | for ($i = 1; $i <= $limit; $i++) {
|
| 4728 | 4728 | $index = $processed + $i; |
| 4729 | 4729 | |
| 4730 | 4730 | if (isset($file[$index])) {
|
| 4731 | 4731 | $row = $file[$index]; |
| 4732 | - $row = array_map( 'trim', $row ); |
|
| 4732 | + $row = array_map('trim', $row);
|
|
| 4733 | 4733 | $data = array(); |
| 4734 | 4734 | |
| 4735 | 4735 | foreach ($columns as $c => $column) {
|
@@ -4740,20 +4740,20 @@ discard block |
||
| 4740 | 4740 | |
| 4741 | 4741 | if (empty($data['neighbourhood_name']) || empty($data['latitude']) || empty($data['longitude'])) {
|
| 4742 | 4742 | $invalid++; |
| 4743 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 4743 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood); |
|
| 4744 | 4744 | continue; |
| 4745 | 4745 | } |
| 4746 | 4746 | |
| 4747 | 4747 | $location_info = array(); |
| 4748 | - if (!empty($data['location_id']) && (int)$data['location_id'] > 0) {
|
|
| 4749 | - $location_info = geodir_get_location_by_id('', (int)$data['location_id']);
|
|
| 4748 | + if (!empty($data['location_id']) && (int) $data['location_id'] > 0) {
|
|
| 4749 | + $location_info = geodir_get_location_by_id('', (int) $data['location_id']);
|
|
| 4750 | 4750 | } else if (!empty($data['city']) && !empty($data['region']) && !empty($data['country'])) {
|
| 4751 | 4751 | $location_info = geodir_get_location_by_slug('city', array('fields' => 'location_id', 'city' => $data['city'], 'country' => $data['country'], 'region' => $data['region']));
|
| 4752 | 4752 | } |
| 4753 | 4753 | |
| 4754 | 4754 | if (empty($location_info)) {
|
| 4755 | 4755 | $invalid++; |
| 4756 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 4756 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood); |
|
| 4757 | 4757 | continue; |
| 4758 | 4758 | } |
| 4759 | 4759 | |
@@ -4768,35 +4768,35 @@ discard block |
||
| 4768 | 4768 | $hood_data['hood_longitude'] = $data['longitude']; |
| 4769 | 4769 | $hood_data['hood_location_id'] = $location_id; |
| 4770 | 4770 | |
| 4771 | - if ( $import_choice == 'update' ) {
|
|
| 4772 | - if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
|
|
| 4773 | - $hood_data['hood_id'] = (int)$data['neighbourhood_id']; |
|
| 4771 | + if ($import_choice == 'update') {
|
|
| 4772 | + if ((int) $data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int) $data['neighbourhood_id']))) {
|
|
| 4773 | + $hood_data['hood_id'] = (int) $data['neighbourhood_id']; |
|
| 4774 | 4774 | |
| 4775 | 4775 | if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
|
| 4776 | 4776 | $updated++; |
| 4777 | 4777 | } else {
|
| 4778 | 4778 | $invalid++; |
| 4779 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 4779 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood); |
|
| 4780 | 4780 | } |
| 4781 | 4781 | } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
|
| 4782 | - $hood_data['hood_id'] = (int)$neighbourhood->hood_id; |
|
| 4782 | + $hood_data['hood_id'] = (int) $neighbourhood->hood_id; |
|
| 4783 | 4783 | |
| 4784 | 4784 | if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
|
| 4785 | 4785 | $updated++; |
| 4786 | 4786 | } else {
|
| 4787 | 4787 | $invalid++; |
| 4788 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 4788 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood); |
|
| 4789 | 4789 | } |
| 4790 | 4790 | } else {
|
| 4791 | 4791 | if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
|
| 4792 | 4792 | $created++; |
| 4793 | 4793 | } else {
|
| 4794 | 4794 | $invalid++; |
| 4795 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 4795 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood); |
|
| 4796 | 4796 | } |
| 4797 | 4797 | } |
| 4798 | - } elseif ( $import_choice == 'skip' ) {
|
|
| 4799 | - if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
|
|
| 4798 | + } elseif ($import_choice == 'skip') {
|
|
| 4799 | + if ((int) $data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int) $data['neighbourhood_id']))) {
|
|
| 4800 | 4800 | $skipped++; |
| 4801 | 4801 | } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
|
| 4802 | 4802 | $skipped++; |
@@ -4806,12 +4806,12 @@ discard block |
||
| 4806 | 4806 | $created++; |
| 4807 | 4807 | } else {
|
| 4808 | 4808 | $invalid++; |
| 4809 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 4809 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood); |
|
| 4810 | 4810 | } |
| 4811 | 4811 | } |
| 4812 | 4812 | } else {
|
| 4813 | 4813 | $invalid++; |
| 4814 | - geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood ); |
|
| 4814 | + geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood); |
|
| 4815 | 4815 | } |
| 4816 | 4816 | } |
| 4817 | 4817 | } |
@@ -4825,7 +4825,7 @@ discard block |
||
| 4825 | 4825 | $json['invalid'] = $invalid; |
| 4826 | 4826 | $json['images'] = $images; |
| 4827 | 4827 | |
| 4828 | - wp_send_json( $json ); |
|
| 4828 | + wp_send_json($json); |
|
| 4829 | 4829 | } |
| 4830 | 4830 | } |
| 4831 | 4831 | break; |
@@ -4869,29 +4869,29 @@ discard block |
||
| 4869 | 4869 | * } |
| 4870 | 4870 | * @return int|bool Term id when success, false when fail. |
| 4871 | 4871 | */ |
| 4872 | -function geodir_imex_insert_term( $taxonomy, $term_data ) {
|
|
| 4873 | - if ( empty( $taxonomy ) || empty( $term_data ) ) {
|
|
| 4872 | +function geodir_imex_insert_term($taxonomy, $term_data) {
|
|
| 4873 | + if (empty($taxonomy) || empty($term_data)) {
|
|
| 4874 | 4874 | return false; |
| 4875 | 4875 | } |
| 4876 | 4876 | |
| 4877 | - $term = isset( $term_data['name'] ) && !empty( $term_data['name'] ) ? $term_data['name'] : ''; |
|
| 4877 | + $term = isset($term_data['name']) && !empty($term_data['name']) ? $term_data['name'] : ''; |
|
| 4878 | 4878 | $args = array(); |
| 4879 | - $args['description'] = isset( $term_data['description'] ) ? $term_data['description'] : ''; |
|
| 4880 | - $args['slug'] = isset( $term_data['slug'] ) ? $term_data['slug'] : ''; |
|
| 4881 | - $args['parent'] = isset( $term_data['parent'] ) ? (int)$term_data['parent'] : ''; |
|
| 4879 | + $args['description'] = isset($term_data['description']) ? $term_data['description'] : ''; |
|
| 4880 | + $args['slug'] = isset($term_data['slug']) ? $term_data['slug'] : ''; |
|
| 4881 | + $args['parent'] = isset($term_data['parent']) ? (int) $term_data['parent'] : ''; |
|
| 4882 | 4882 | |
| 4883 | - if ( ( !empty( $args['slug'] ) && term_exists( $args['slug'], $taxonomy ) ) || empty( $args['slug'] ) ) {
|
|
| 4884 | - $term_args = array_merge( $term_data, $args ); |
|
| 4885 | - $defaults = array( 'alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => ''); |
|
| 4886 | - $term_args = wp_parse_args( $term_args, $defaults ); |
|
| 4887 | - $term_args = sanitize_term( $term_args, $taxonomy, 'db' ); |
|
| 4888 | - $args['slug'] = wp_unique_term_slug( $args['slug'], (object)$term_args ); |
|
| 4883 | + if ((!empty($args['slug']) && term_exists($args['slug'], $taxonomy)) || empty($args['slug'])) {
|
|
| 4884 | + $term_args = array_merge($term_data, $args); |
|
| 4885 | + $defaults = array('alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '');
|
|
| 4886 | + $term_args = wp_parse_args($term_args, $defaults); |
|
| 4887 | + $term_args = sanitize_term($term_args, $taxonomy, 'db'); |
|
| 4888 | + $args['slug'] = wp_unique_term_slug($args['slug'], (object) $term_args); |
|
| 4889 | 4889 | } |
| 4890 | 4890 | |
| 4891 | - if( !empty( $term ) ) {
|
|
| 4892 | - $result = wp_insert_term( $term, $taxonomy, $args ); |
|
| 4893 | - if( !is_wp_error( $result ) ) {
|
|
| 4894 | - return isset( $result['term_id'] ) ? $result['term_id'] : 0; |
|
| 4891 | + if (!empty($term)) {
|
|
| 4892 | + $result = wp_insert_term($term, $taxonomy, $args); |
|
| 4893 | + if (!is_wp_error($result)) {
|
|
| 4894 | + return isset($result['term_id']) ? $result['term_id'] : 0; |
|
| 4895 | 4895 | } |
| 4896 | 4896 | } |
| 4897 | 4897 | |
@@ -4921,36 +4921,36 @@ discard block |
||
| 4921 | 4921 | * } |
| 4922 | 4922 | * @return int|bool Term id when success, false when fail. |
| 4923 | 4923 | */ |
| 4924 | -function geodir_imex_update_term( $taxonomy, $term_data ) {
|
|
| 4925 | - if ( empty( $taxonomy ) || empty( $term_data ) ) {
|
|
| 4924 | +function geodir_imex_update_term($taxonomy, $term_data) {
|
|
| 4925 | + if (empty($taxonomy) || empty($term_data)) {
|
|
| 4926 | 4926 | return false; |
| 4927 | 4927 | } |
| 4928 | 4928 | |
| 4929 | - $term_id = isset( $term_data['term_id'] ) && !empty( $term_data['term_id'] ) ? $term_data['term_id'] : 0; |
|
| 4929 | + $term_id = isset($term_data['term_id']) && !empty($term_data['term_id']) ? $term_data['term_id'] : 0; |
|
| 4930 | 4930 | |
| 4931 | 4931 | $args = array(); |
| 4932 | - $args['description'] = isset( $term_data['description'] ) ? $term_data['description'] : ''; |
|
| 4933 | - $args['slug'] = isset( $term_data['slug'] ) ? $term_data['slug'] : ''; |
|
| 4934 | - $args['parent'] = isset( $term_data['parent'] ) ? (int)$term_data['parent'] : ''; |
|
| 4932 | + $args['description'] = isset($term_data['description']) ? $term_data['description'] : ''; |
|
| 4933 | + $args['slug'] = isset($term_data['slug']) ? $term_data['slug'] : ''; |
|
| 4934 | + $args['parent'] = isset($term_data['parent']) ? (int) $term_data['parent'] : ''; |
|
| 4935 | 4935 | |
| 4936 | - if ( $term_id > 0 && $term_info = (array)get_term( $term_id, $taxonomy ) ) {
|
|
| 4936 | + if ($term_id > 0 && $term_info = (array) get_term($term_id, $taxonomy)) {
|
|
| 4937 | 4937 | $term_data['term_id'] = $term_info['term_id']; |
| 4938 | 4938 | |
| 4939 | - $result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data ); |
|
| 4939 | + $result = wp_update_term($term_data['term_id'], $taxonomy, $term_data); |
|
| 4940 | 4940 | |
| 4941 | - if( !is_wp_error( $result ) ) {
|
|
| 4942 | - return isset( $result['term_id'] ) ? $result['term_id'] : 0; |
|
| 4941 | + if (!is_wp_error($result)) {
|
|
| 4942 | + return isset($result['term_id']) ? $result['term_id'] : 0; |
|
| 4943 | 4943 | } |
| 4944 | - } else if ( $term_data['slug'] != '' && $term_info = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
|
|
| 4944 | + } else if ($term_data['slug'] != '' && $term_info = (array) term_exists($term_data['slug'], $taxonomy)) {
|
|
| 4945 | 4945 | $term_data['term_id'] = $term_info['term_id']; |
| 4946 | 4946 | |
| 4947 | - $result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data ); |
|
| 4947 | + $result = wp_update_term($term_data['term_id'], $taxonomy, $term_data); |
|
| 4948 | 4948 | |
| 4949 | - if( !is_wp_error( $result ) ) {
|
|
| 4950 | - return isset( $result['term_id'] ) ? $result['term_id'] : 0; |
|
| 4949 | + if (!is_wp_error($result)) {
|
|
| 4950 | + return isset($result['term_id']) ? $result['term_id'] : 0; |
|
| 4951 | 4951 | } |
| 4952 | 4952 | } else {
|
| 4953 | - return geodir_imex_insert_term( $taxonomy, $term_data ); |
|
| 4953 | + return geodir_imex_insert_term($taxonomy, $term_data); |
|
| 4954 | 4954 | } |
| 4955 | 4955 | |
| 4956 | 4956 | return false; |
@@ -4969,20 +4969,20 @@ discard block |
||
| 4969 | 4969 | * @param string $post_type Post type. |
| 4970 | 4970 | * @return int Posts count. |
| 4971 | 4971 | */ |
| 4972 | -function geodir_get_posts_count( $post_type ) {
|
|
| 4972 | +function geodir_get_posts_count($post_type) {
|
|
| 4973 | 4973 | global $wpdb, $plugin_prefix; |
| 4974 | 4974 | |
| 4975 | - if ( !post_type_exists( $post_type ) ) {
|
|
| 4975 | + if (!post_type_exists($post_type)) {
|
|
| 4976 | 4976 | return 0; |
| 4977 | 4977 | } |
| 4978 | 4978 | |
| 4979 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 4979 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 4980 | 4980 | |
| 4981 | 4981 | // Skip listing with statuses trash, auto-draft etc... |
| 4982 | 4982 | $skip_statuses = geodir_imex_export_skip_statuses(); |
| 4983 | 4983 | $where_statuses = ''; |
| 4984 | - if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
|
|
| 4985 | - $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
|
|
| 4984 | + if (!empty($skip_statuses) && is_array($skip_statuses)) {
|
|
| 4985 | + $where_statuses = "AND `".$wpdb->posts."`.`post_status` NOT IN('".implode("','", $skip_statuses)."')";
|
|
| 4986 | 4986 | } |
| 4987 | 4987 | |
| 4988 | 4988 | /** |
@@ -4993,11 +4993,11 @@ discard block |
||
| 4993 | 4993 | * |
| 4994 | 4994 | * @param string $where SQL where clause part. |
| 4995 | 4995 | */ |
| 4996 | - $where_statuses = apply_filters( 'geodir_get_posts_count', $where_statuses, $post_type ); |
|
| 4996 | + $where_statuses = apply_filters('geodir_get_posts_count', $where_statuses, $post_type);
|
|
| 4997 | 4997 | |
| 4998 | - $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 );
|
|
| 4998 | + $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);
|
|
| 4999 | 4999 | |
| 5000 | - $posts_count = (int)$wpdb->get_var( $query ); |
|
| 5000 | + $posts_count = (int) $wpdb->get_var($query); |
|
| 5001 | 5001 | |
| 5002 | 5002 | /** |
| 5003 | 5003 | * Modify returned post counts for the current post type. |
@@ -5008,7 +5008,7 @@ discard block |
||
| 5008 | 5008 | * @param int $posts_count Post counts. |
| 5009 | 5009 | * @param string $post_type Post type. |
| 5010 | 5010 | */ |
| 5011 | - $posts_count = apply_filters( 'geodir_imex_count_posts', $posts_count, $post_type ); |
|
| 5011 | + $posts_count = apply_filters('geodir_imex_count_posts', $posts_count, $post_type);
|
|
| 5012 | 5012 | |
| 5013 | 5013 | return $posts_count; |
| 5014 | 5014 | } |
@@ -5029,19 +5029,19 @@ discard block |
||
| 5029 | 5029 | * @param int $page_no Page number. Default 0. |
| 5030 | 5030 | * @return array Array of posts data. |
| 5031 | 5031 | */ |
| 5032 | -function geodir_imex_get_posts( $post_type, $per_page = 0, $page_no = 0 ) {
|
|
| 5032 | +function geodir_imex_get_posts($post_type, $per_page = 0, $page_no = 0) {
|
|
| 5033 | 5033 | global $wp_filesystem; |
| 5034 | 5034 | |
| 5035 | - $posts = geodir_get_export_posts( $post_type, $per_page, $page_no ); |
|
| 5035 | + $posts = geodir_get_export_posts($post_type, $per_page, $page_no); |
|
| 5036 | 5036 | |
| 5037 | 5037 | $csv_rows = array(); |
| 5038 | 5038 | |
| 5039 | - if ( !empty( $posts ) ) {
|
|
| 5040 | - $is_payment_plugin = is_plugin_active( 'geodir_payment_manager/geodir_payment_manager.php' ); |
|
| 5039 | + if (!empty($posts)) {
|
|
| 5040 | + $is_payment_plugin = is_plugin_active('geodir_payment_manager/geodir_payment_manager.php');
|
|
| 5041 | 5041 | $location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
|
| 5042 | - $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true; |
|
| 5042 | + $location_allowed = function_exists('geodir_cpt_no_location') && geodir_cpt_no_location($post_type) ? false : true;
|
|
| 5043 | 5043 | $neighbourhood_active = $location_manager && $location_allowed && get_option('location_neighbourhoods') ? true : false;
|
| 5044 | - $is_claim_active = is_plugin_active( 'geodir_claim_listing/geodir_claim_listing.php' ) && get_option('geodir_claim_enable') === 'yes' ? true : false;
|
|
| 5044 | + $is_claim_active = is_plugin_active('geodir_claim_listing/geodir_claim_listing.php') && get_option('geodir_claim_enable') === 'yes' ? true : false;
|
|
| 5045 | 5045 | |
| 5046 | 5046 | $csv_row = array(); |
| 5047 | 5047 | $csv_row[] = 'post_id'; |
@@ -5052,7 +5052,7 @@ discard block |
||
| 5052 | 5052 | $csv_row[] = 'default_category'; |
| 5053 | 5053 | $csv_row[] = 'post_tags'; |
| 5054 | 5054 | $csv_row[] = 'post_type'; |
| 5055 | - if ( $post_type == 'gd_event' ) {
|
|
| 5055 | + if ($post_type == 'gd_event') {
|
|
| 5056 | 5056 | $csv_row[] = 'event_date'; |
| 5057 | 5057 | $csv_row[] = 'event_enddate'; |
| 5058 | 5058 | $csv_row[] = 'starttime'; |
@@ -5110,15 +5110,15 @@ discard block |
||
| 5110 | 5110 | } |
| 5111 | 5111 | // WPML |
| 5112 | 5112 | |
| 5113 | - $custom_fields = geodir_imex_get_custom_fields( $post_type ); |
|
| 5114 | - if ( !empty( $custom_fields ) ) {
|
|
| 5115 | - foreach ( $custom_fields as $custom_field ) {
|
|
| 5113 | + $custom_fields = geodir_imex_get_custom_fields($post_type); |
|
| 5114 | + if (!empty($custom_fields)) {
|
|
| 5115 | + foreach ($custom_fields as $custom_field) {
|
|
| 5116 | 5116 | $csv_row[] = $custom_field->htmlvar_name; |
| 5117 | 5117 | } |
| 5118 | 5118 | } |
| 5119 | 5119 | |
| 5120 | 5120 | // Export franchise fields |
| 5121 | - $is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false; |
|
| 5121 | + $is_franchise_active = is_plugin_active('geodir_franchise/geodir_franchise.php') && geodir_franchise_enabled($post_type) ? true : false;
|
|
| 5122 | 5122 | if ($is_franchise_active) {
|
| 5123 | 5123 | $csv_row[] = 'gd_is_franchise'; |
| 5124 | 5124 | $csv_row[] = 'gd_franchise_lock'; |
@@ -5139,28 +5139,28 @@ discard block |
||
| 5139 | 5139 | $csv_rows[] = $csv_row; |
| 5140 | 5140 | |
| 5141 | 5141 | $images_count = 5; |
| 5142 | - $xx=0; |
|
| 5143 | - foreach ( $posts as $post ) {$xx++;
|
|
| 5142 | + $xx = 0; |
|
| 5143 | + foreach ($posts as $post) {$xx++;
|
|
| 5144 | 5144 | $post_id = $post['ID']; |
| 5145 | 5145 | |
| 5146 | - $gd_post_info = geodir_get_post_info( $post_id ); |
|
| 5147 | - $post_info = (array)$gd_post_info; |
|
| 5146 | + $gd_post_info = geodir_get_post_info($post_id); |
|
| 5147 | + $post_info = (array) $gd_post_info; |
|
| 5148 | 5148 | |
| 5149 | - $taxonomy_category = $post_type . 'category'; |
|
| 5150 | - $taxonomy_tags = $post_type . '_tags'; |
|
| 5149 | + $taxonomy_category = $post_type.'category'; |
|
| 5150 | + $taxonomy_tags = $post_type.'_tags'; |
|
| 5151 | 5151 | |
| 5152 | 5152 | $post_category = ''; |
| 5153 | 5153 | $default_category_id = $gd_post_info->default_category; |
| 5154 | 5154 | $default_category = ''; |
| 5155 | 5155 | $post_tags = ''; |
| 5156 | - $terms = wp_get_post_terms( $post_id, array( $taxonomy_category, $taxonomy_tags ) ); |
|
| 5156 | + $terms = wp_get_post_terms($post_id, array($taxonomy_category, $taxonomy_tags)); |
|
| 5157 | 5157 | |
| 5158 | - if ( !empty( $terms ) && !is_wp_error( $terms ) ) {
|
|
| 5158 | + if (!empty($terms) && !is_wp_error($terms)) {
|
|
| 5159 | 5159 | $post_category = array(); |
| 5160 | 5160 | $post_tags = array(); |
| 5161 | 5161 | |
| 5162 | - foreach ( $terms as $term ) {
|
|
| 5163 | - if ( $term->taxonomy == $taxonomy_category ) {
|
|
| 5162 | + foreach ($terms as $term) {
|
|
| 5163 | + if ($term->taxonomy == $taxonomy_category) {
|
|
| 5164 | 5164 | $post_category[] = $term->name; |
| 5165 | 5165 | |
| 5166 | 5166 | if ($default_category_id == $term->term_id) {
|
@@ -5168,7 +5168,7 @@ discard block |
||
| 5168 | 5168 | } |
| 5169 | 5169 | } |
| 5170 | 5170 | |
| 5171 | - if ( $term->taxonomy == $taxonomy_tags ) {
|
|
| 5171 | + if ($term->taxonomy == $taxonomy_tags) {
|
|
| 5172 | 5172 | $post_tags[] = $term->name; |
| 5173 | 5173 | } |
| 5174 | 5174 | } |
@@ -5176,47 +5176,47 @@ discard block |
||
| 5176 | 5176 | if (empty($default_category) && !empty($post_category)) {
|
| 5177 | 5177 | $default_category = $post_category[0]; // Set first one as default category. |
| 5178 | 5178 | } |
| 5179 | - $post_category = !empty( $post_category ) ? implode( ',', $post_category ) : ''; |
|
| 5180 | - $post_tags = !empty( $post_tags ) ? implode( ',', $post_tags ) : ''; |
|
| 5179 | + $post_category = !empty($post_category) ? implode(',', $post_category) : '';
|
|
| 5180 | + $post_tags = !empty($post_tags) ? implode(',', $post_tags) : '';
|
|
| 5181 | 5181 | } |
| 5182 | 5182 | |
| 5183 | 5183 | // Franchise data |
| 5184 | - if ($is_franchise_active && isset($post_info['franchise']) && (int)$post_info['franchise'] > 0 && geodir_franchise_check((int)$post_info['franchise'])) {
|
|
| 5184 | + if ($is_franchise_active && isset($post_info['franchise']) && (int) $post_info['franchise'] > 0 && geodir_franchise_check((int) $post_info['franchise'])) {
|
|
| 5185 | 5185 | $franchise_id = $post_info['franchise']; |
| 5186 | 5186 | $gd_franchise_info = geodir_get_post_info($franchise_id); |
| 5187 | 5187 | |
| 5188 | 5188 | if (geodir_franchise_pkg_is_active($gd_franchise_info)) {
|
| 5189 | - $franchise_info = (array)$gd_franchise_info; |
|
| 5189 | + $franchise_info = (array) $gd_franchise_info; |
|
| 5190 | 5190 | $locked_fields = geodir_franchise_get_locked_fields($franchise_id, true); |
| 5191 | 5191 | |
| 5192 | 5192 | if (!empty($locked_fields)) {
|
| 5193 | - foreach( $locked_fields as $locked_field) {
|
|
| 5193 | + foreach ($locked_fields as $locked_field) {
|
|
| 5194 | 5194 | if (isset($post_info[$locked_field]) && isset($franchise_info[$locked_field])) {
|
| 5195 | 5195 | $post_info[$locked_field] = $franchise_info[$locked_field]; |
| 5196 | 5196 | } |
| 5197 | 5197 | |
| 5198 | 5198 | if (in_array($taxonomy_category, $locked_fields) || in_array('post_tags', $locked_fields)) {
|
| 5199 | - $franchise_terms = wp_get_post_terms( $franchise_id, array( $taxonomy_category, $taxonomy_tags ) ); |
|
| 5199 | + $franchise_terms = wp_get_post_terms($franchise_id, array($taxonomy_category, $taxonomy_tags)); |
|
| 5200 | 5200 | |
| 5201 | - if ( !empty( $franchise_terms ) && !is_wp_error( $franchise_terms ) ) {
|
|
| 5201 | + if (!empty($franchise_terms) && !is_wp_error($franchise_terms)) {
|
|
| 5202 | 5202 | $franchise_post_category = array(); |
| 5203 | 5203 | $franchise_post_tags = array(); |
| 5204 | 5204 | |
| 5205 | - foreach ( $franchise_terms as $franchise_term ) {
|
|
| 5206 | - if ( $franchise_term->taxonomy == $taxonomy_category ) {
|
|
| 5205 | + foreach ($franchise_terms as $franchise_term) {
|
|
| 5206 | + if ($franchise_term->taxonomy == $taxonomy_category) {
|
|
| 5207 | 5207 | $franchise_post_category[] = $franchise_term->name; |
| 5208 | 5208 | } |
| 5209 | 5209 | |
| 5210 | - if ( $franchise_term->taxonomy == $taxonomy_tags ) {
|
|
| 5210 | + if ($franchise_term->taxonomy == $taxonomy_tags) {
|
|
| 5211 | 5211 | $franchise_post_tags[] = $franchise_term->name; |
| 5212 | 5212 | } |
| 5213 | 5213 | } |
| 5214 | 5214 | |
| 5215 | 5215 | if (in_array($taxonomy_category, $locked_fields)) {
|
| 5216 | - $post_category = !empty( $franchise_post_category ) ? implode( ',', $franchise_post_category ) : ''; |
|
| 5216 | + $post_category = !empty($franchise_post_category) ? implode(',', $franchise_post_category) : '';
|
|
| 5217 | 5217 | } |
| 5218 | 5218 | if (in_array('post_tags', $locked_fields)) {
|
| 5219 | - $post_tags = !empty( $franchise_post_tags ) ? implode( ',', $franchise_post_tags ) : ''; |
|
| 5219 | + $post_tags = !empty($franchise_post_tags) ? implode(',', $franchise_post_tags) : '';
|
|
| 5220 | 5220 | } |
| 5221 | 5221 | } |
| 5222 | 5222 | } |
@@ -5225,18 +5225,18 @@ discard block |
||
| 5225 | 5225 | } |
| 5226 | 5226 | } |
| 5227 | 5227 | |
| 5228 | - $post_images = geodir_get_images( $post_id ); |
|
| 5228 | + $post_images = geodir_get_images($post_id); |
|
| 5229 | 5229 | $current_images = array(); |
| 5230 | - if ( !empty( $post_images ) ) {
|
|
| 5231 | - foreach ( $post_images as $post_image ) {
|
|
| 5232 | - $post_image = (array)$post_image; |
|
| 5233 | - $image = !empty( $post_image ) && isset( $post_image['path'] ) && $wp_filesystem->is_file( $post_image['path'] ) && $wp_filesystem->exists( $post_image['path'] ) ? $post_image['src'] : ''; |
|
| 5234 | - if ( $image ) {
|
|
| 5230 | + if (!empty($post_images)) {
|
|
| 5231 | + foreach ($post_images as $post_image) {
|
|
| 5232 | + $post_image = (array) $post_image; |
|
| 5233 | + $image = !empty($post_image) && isset($post_image['path']) && $wp_filesystem->is_file($post_image['path']) && $wp_filesystem->exists($post_image['path']) ? $post_image['src'] : ''; |
|
| 5234 | + if ($image) {
|
|
| 5235 | 5235 | $current_images[] = $image; |
| 5236 | 5236 | } |
| 5237 | 5237 | } |
| 5238 | 5238 | |
| 5239 | - $images_count = max( $images_count, count( $current_images ) ); |
|
| 5239 | + $images_count = max($images_count, count($current_images)); |
|
| 5240 | 5240 | } |
| 5241 | 5241 | |
| 5242 | 5242 | $csv_row = array(); |
@@ -5248,7 +5248,7 @@ discard block |
||
| 5248 | 5248 | $csv_row[] = $default_category; // default_category |
| 5249 | 5249 | $csv_row[] = $post_tags; // post_tags |
| 5250 | 5250 | $csv_row[] = $post_type; // post_type |
| 5251 | - if ( $post_type == 'gd_event' ) {
|
|
| 5251 | + if ($post_type == 'gd_event') {
|
|
| 5252 | 5252 | $event_data = geodir_imex_get_event_data($post, $gd_post_info); |
| 5253 | 5253 | $csv_row[] = $event_data['event_date']; // event_date |
| 5254 | 5254 | $csv_row[] = $event_data['event_enddate']; // enddate |
@@ -5269,12 +5269,12 @@ discard block |
||
| 5269 | 5269 | $csv_row[] = $event_data['recurring_end_date']; // repeat_end |
| 5270 | 5270 | } |
| 5271 | 5271 | $csv_row[] = $post_info['post_status']; // post_status |
| 5272 | - $csv_row[] = (int)$post_info['is_featured'] == 1 ? 1 : ''; // is_featured |
|
| 5272 | + $csv_row[] = (int) $post_info['is_featured'] == 1 ? 1 : ''; // is_featured |
|
| 5273 | 5273 | if ($is_claim_active) {
|
| 5274 | - $csv_row[] = !empty($post_info['claimed']) && (int)$post_info['claimed'] == 1 ? 1 : ''; // claimed |
|
| 5274 | + $csv_row[] = !empty($post_info['claimed']) && (int) $post_info['claimed'] == 1 ? 1 : ''; // claimed |
|
| 5275 | 5275 | } |
| 5276 | 5276 | if ($is_payment_plugin) {
|
| 5277 | - $csv_row[] = (int)$post_info['package_id']; // package_id |
|
| 5277 | + $csv_row[] = (int) $post_info['package_id']; // package_id |
|
| 5278 | 5278 | $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
|
| 5279 | 5279 | } |
| 5280 | 5280 | $csv_row[] = $post_info['post_date']; // post_date |
@@ -5310,14 +5310,14 @@ discard block |
||
| 5310 | 5310 | $csv_row[] = $post_info['geodir_special_offers']; // geodir_special_offers |
| 5311 | 5311 | // WPML |
| 5312 | 5312 | if ($is_wpml) {
|
| 5313 | - $csv_row[] = geodir_get_language_for_element( $post_id, 'post_' . $post_type ); |
|
| 5314 | - $csv_row[] = geodir_imex_original_post_id( $post_id, 'post_' . $post_type ); |
|
| 5313 | + $csv_row[] = geodir_get_language_for_element($post_id, 'post_'.$post_type); |
|
| 5314 | + $csv_row[] = geodir_imex_original_post_id($post_id, 'post_'.$post_type); |
|
| 5315 | 5315 | } |
| 5316 | 5316 | // WPML |
| 5317 | 5317 | |
| 5318 | - if ( !empty( $custom_fields ) ) {
|
|
| 5319 | - foreach ( $custom_fields as $custom_field ) {
|
|
| 5320 | - $csv_row[] = isset( $post_info[$custom_field->htmlvar_name] ) ? $post_info[$custom_field->htmlvar_name] : ''; |
|
| 5318 | + if (!empty($custom_fields)) {
|
|
| 5319 | + foreach ($custom_fields as $custom_field) {
|
|
| 5320 | + $csv_row[] = isset($post_info[$custom_field->htmlvar_name]) ? $post_info[$custom_field->htmlvar_name] : ''; |
|
| 5321 | 5321 | } |
| 5322 | 5322 | } |
| 5323 | 5323 | |
@@ -5328,15 +5328,15 @@ discard block |
||
| 5328 | 5328 | $franchise = ''; |
| 5329 | 5329 | |
| 5330 | 5330 | if (geodir_franchise_pkg_is_active($gd_post_info)) {
|
| 5331 | - $gd_is_franchise = (int)get_post_meta( $post_id, 'gd_is_franchise', true ); |
|
| 5332 | - $locaked_fields = $gd_is_franchise ? get_post_meta( $post_id, 'gd_franchise_lock', true ) : ''; |
|
| 5331 | + $gd_is_franchise = (int) get_post_meta($post_id, 'gd_is_franchise', true); |
|
| 5332 | + $locaked_fields = $gd_is_franchise ? get_post_meta($post_id, 'gd_franchise_lock', true) : ''; |
|
| 5333 | 5333 | $locaked_fields = (is_array($locaked_fields) && !empty($locaked_fields) ? implode(",", $locaked_fields) : '');
|
| 5334 | - $franchise = !$gd_is_franchise && isset($post_info['franchise']) && (int)$post_info['franchise'] > 0 ? (int)$post_info['franchise'] : 0; // franchise id |
|
| 5334 | + $franchise = !$gd_is_franchise && isset($post_info['franchise']) && (int) $post_info['franchise'] > 0 ? (int) $post_info['franchise'] : 0; // franchise id |
|
| 5335 | 5335 | } |
| 5336 | 5336 | |
| 5337 | - $csv_row[] = (int)$gd_is_franchise; // gd_is_franchise |
|
| 5337 | + $csv_row[] = (int) $gd_is_franchise; // gd_is_franchise |
|
| 5338 | 5338 | $csv_row[] = $locaked_fields; // gd_franchise_lock fields |
| 5339 | - $csv_row[] = (int)$franchise; // franchise id |
|
| 5339 | + $csv_row[] = (int) $franchise; // franchise id |
|
| 5340 | 5340 | } |
| 5341 | 5341 | |
| 5342 | 5342 | /** |
@@ -5350,15 +5350,15 @@ discard block |
||
| 5350 | 5350 | */ |
| 5351 | 5351 | $csv_row = apply_filters('geodir_export_listing_csv_column_values', $csv_row, $post_info);
|
| 5352 | 5352 | |
| 5353 | - for ( $c = 0; $c < $images_count; $c++ ) {
|
|
| 5354 | - $csv_row[] = isset( $current_images[$c] ) ? $current_images[$c] : ''; // IMAGE |
|
| 5353 | + for ($c = 0; $c < $images_count; $c++) {
|
|
| 5354 | + $csv_row[] = isset($current_images[$c]) ? $current_images[$c] : ''; // IMAGE |
|
| 5355 | 5355 | } |
| 5356 | 5356 | |
| 5357 | 5357 | $csv_rows[] = $csv_row; |
| 5358 | 5358 | |
| 5359 | 5359 | } |
| 5360 | 5360 | |
| 5361 | - for ( $c = 0; $c < $images_count; $c++ ) {
|
|
| 5361 | + for ($c = 0; $c < $images_count; $c++) {
|
|
| 5362 | 5362 | $csv_rows[0][] = 'IMAGE'; |
| 5363 | 5363 | } |
| 5364 | 5364 | } |
@@ -5380,30 +5380,30 @@ discard block |
||
| 5380 | 5380 | * @param int $page_no Page number. Default 0. |
| 5381 | 5381 | * @return array Array of posts data. |
| 5382 | 5382 | */ |
| 5383 | -function geodir_get_export_posts( $post_type, $per_page = 0, $page_no = 0 ) {
|
|
| 5383 | +function geodir_get_export_posts($post_type, $per_page = 0, $page_no = 0) {
|
|
| 5384 | 5384 | global $wpdb, $plugin_prefix; |
| 5385 | 5385 | |
| 5386 | - if ( ! post_type_exists( $post_type ) ) |
|
| 5386 | + if (!post_type_exists($post_type)) |
|
| 5387 | 5387 | return new stdClass; |
| 5388 | 5388 | |
| 5389 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 5389 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 5390 | 5390 | |
| 5391 | 5391 | $limit = ''; |
| 5392 | - if ( $per_page > 0 && $page_no > 0 ) {
|
|
| 5393 | - $offset = ( $page_no - 1 ) * $per_page; |
|
| 5392 | + if ($per_page > 0 && $page_no > 0) {
|
|
| 5393 | + $offset = ($page_no - 1) * $per_page; |
|
| 5394 | 5394 | |
| 5395 | - if ( $offset > 0 ) {
|
|
| 5396 | - $limit = " LIMIT " . $offset . "," . $per_page; |
|
| 5395 | + if ($offset > 0) {
|
|
| 5396 | + $limit = " LIMIT ".$offset.",".$per_page; |
|
| 5397 | 5397 | } else {
|
| 5398 | - $limit = " LIMIT " . $per_page; |
|
| 5398 | + $limit = " LIMIT ".$per_page; |
|
| 5399 | 5399 | } |
| 5400 | 5400 | } |
| 5401 | 5401 | |
| 5402 | 5402 | // Skip listing with statuses trash, auto-draft etc... |
| 5403 | 5403 | $skip_statuses = geodir_imex_export_skip_statuses(); |
| 5404 | 5404 | $where_statuses = ''; |
| 5405 | - if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
|
|
| 5406 | - $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
|
|
| 5405 | + if (!empty($skip_statuses) && is_array($skip_statuses)) {
|
|
| 5406 | + $where_statuses = "AND `".$wpdb->posts."`.`post_status` NOT IN('".implode("','", $skip_statuses)."')";
|
|
| 5407 | 5407 | } |
| 5408 | 5408 | |
| 5409 | 5409 | /** |
@@ -5414,9 +5414,9 @@ discard block |
||
| 5414 | 5414 | * |
| 5415 | 5415 | * @param string $where SQL where clause part. |
| 5416 | 5416 | */ |
| 5417 | - $where_statuses = apply_filters( 'geodir_get_export_posts', $where_statuses, $post_type ); |
|
| 5417 | + $where_statuses = apply_filters('geodir_get_export_posts', $where_statuses, $post_type);
|
|
| 5418 | 5418 | |
| 5419 | - $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 );
|
|
| 5419 | + $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);
|
|
| 5420 | 5420 | /** |
| 5421 | 5421 | * Modify returned posts SQL query for the current post type. |
| 5422 | 5422 | * |
@@ -5426,8 +5426,8 @@ discard block |
||
| 5426 | 5426 | * @param int $query The SQL query. |
| 5427 | 5427 | * @param string $post_type Post type. |
| 5428 | 5428 | */ |
| 5429 | - $query = apply_filters( 'geodir_imex_export_posts_query', $query, $post_type ); |
|
| 5430 | - $results = (array)$wpdb->get_results( $wpdb->prepare( $query, $post_type ), ARRAY_A ); |
|
| 5429 | + $query = apply_filters('geodir_imex_export_posts_query', $query, $post_type);
|
|
| 5430 | + $results = (array) $wpdb->get_results($wpdb->prepare($query, $post_type), ARRAY_A); |
|
| 5431 | 5431 | |
| 5432 | 5432 | /** |
| 5433 | 5433 | * Modify returned post results for the current post type. |
@@ -5438,7 +5438,7 @@ discard block |
||
| 5438 | 5438 | * @param object $results An object containing all post ids. |
| 5439 | 5439 | * @param string $post_type Post type. |
| 5440 | 5440 | */ |
| 5441 | - return apply_filters( 'geodir_export_posts', $results, $post_type ); |
|
| 5441 | + return apply_filters('geodir_export_posts', $results, $post_type);
|
|
| 5442 | 5442 | } |
| 5443 | 5443 | |
| 5444 | 5444 | /** |
@@ -5456,24 +5456,24 @@ discard block |
||
| 5456 | 5456 | * @param string $post_type Post type. |
| 5457 | 5457 | * @return string The SQL query. |
| 5458 | 5458 | */ |
| 5459 | -function geodir_imex_get_events_query( $query, $post_type ) {
|
|
| 5460 | - if ( $post_type == 'gd_event' ) {
|
|
| 5459 | +function geodir_imex_get_events_query($query, $post_type) {
|
|
| 5460 | + if ($post_type == 'gd_event') {
|
|
| 5461 | 5461 | global $wpdb, $plugin_prefix; |
| 5462 | 5462 | |
| 5463 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 5463 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 5464 | 5464 | $schedule_table = EVENT_SCHEDULE; |
| 5465 | 5465 | |
| 5466 | 5466 | // Skip listing with statuses trash, auto-draft etc... |
| 5467 | 5467 | $skip_statuses = geodir_imex_export_skip_statuses(); |
| 5468 | 5468 | $where_statuses = ''; |
| 5469 | - if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
|
|
| 5470 | - $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
|
|
| 5469 | + if (!empty($skip_statuses) && is_array($skip_statuses)) {
|
|
| 5470 | + $where_statuses = "AND `".$wpdb->posts."`.`post_status` NOT IN('".implode("','", $skip_statuses)."')";
|
|
| 5471 | 5471 | } |
| 5472 | 5472 | |
| 5473 | 5473 | /** This action is documented in geodirectory-functions/geodirectory-admin/admin_functions.php */ |
| 5474 | - $where_statuses = apply_filters( 'geodir_get_export_posts', $where_statuses, $post_type ); |
|
| 5474 | + $where_statuses = apply_filters('geodir_get_export_posts', $where_statuses, $post_type);
|
|
| 5475 | 5475 | |
| 5476 | - $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 );
|
|
| 5476 | + $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);
|
|
| 5477 | 5477 | } |
| 5478 | 5478 | |
| 5479 | 5479 | return $query; |
@@ -5497,35 +5497,35 @@ discard block |
||
| 5497 | 5497 | * @param string $post_type Post type. |
| 5498 | 5498 | * @return int Total terms count. |
| 5499 | 5499 | */ |
| 5500 | -function geodir_get_terms_count( $post_type ) {
|
|
| 5501 | - $args = array( 'hide_empty' => 0 ); |
|
| 5500 | +function geodir_get_terms_count($post_type) {
|
|
| 5501 | + $args = array('hide_empty' => 0);
|
|
| 5502 | 5502 | |
| 5503 | - remove_all_filters( 'get_terms' ); |
|
| 5503 | + remove_all_filters('get_terms');
|
|
| 5504 | 5504 | |
| 5505 | - $taxonomy = $post_type . 'category'; |
|
| 5505 | + $taxonomy = $post_type.'category'; |
|
| 5506 | 5506 | |
| 5507 | 5507 | // WPML |
| 5508 | 5508 | $is_wpml = geodir_is_wpml(); |
| 5509 | 5509 | $active_lang = 'all'; |
| 5510 | - if ( $is_wpml ) {
|
|
| 5510 | + if ($is_wpml) {
|
|
| 5511 | 5511 | global $sitepress; |
| 5512 | 5512 | $active_lang = $sitepress->get_current_language(); |
| 5513 | 5513 | |
| 5514 | - if ( $active_lang != 'all' ) {
|
|
| 5515 | - $sitepress->switch_lang( 'all', true ); |
|
| 5514 | + if ($active_lang != 'all') {
|
|
| 5515 | + $sitepress->switch_lang('all', true);
|
|
| 5516 | 5516 | } |
| 5517 | 5517 | } |
| 5518 | 5518 | // WPML |
| 5519 | 5519 | |
| 5520 | - $count_terms = wp_count_terms( $taxonomy, $args ); |
|
| 5520 | + $count_terms = wp_count_terms($taxonomy, $args); |
|
| 5521 | 5521 | |
| 5522 | 5522 | // WPML |
| 5523 | - if ( $is_wpml && $active_lang !== 'all' ) {
|
|
| 5523 | + if ($is_wpml && $active_lang !== 'all') {
|
|
| 5524 | 5524 | global $sitepress; |
| 5525 | - $sitepress->switch_lang( $active_lang, true ); |
|
| 5525 | + $sitepress->switch_lang($active_lang, true); |
|
| 5526 | 5526 | } |
| 5527 | 5527 | // WPML |
| 5528 | - $count_terms = !is_wp_error( $count_terms ) ? $count_terms : 0; |
|
| 5528 | + $count_terms = !is_wp_error($count_terms) ? $count_terms : 0; |
|
| 5529 | 5529 | |
| 5530 | 5530 | return $count_terms; |
| 5531 | 5531 | } |
@@ -5542,23 +5542,23 @@ discard block |
||
| 5542 | 5542 | * @param int $page_no Page number. Default 0. |
| 5543 | 5543 | * @return array Array of terms data. |
| 5544 | 5544 | */ |
| 5545 | -function geodir_imex_get_terms( $post_type, $per_page = 0, $page_no = 0 ) {
|
|
| 5546 | - $args = array( 'hide_empty' => 0, 'orderby' => 'id' ); |
|
| 5545 | +function geodir_imex_get_terms($post_type, $per_page = 0, $page_no = 0) {
|
|
| 5546 | + $args = array('hide_empty' => 0, 'orderby' => 'id');
|
|
| 5547 | 5547 | |
| 5548 | - remove_all_filters( 'get_terms' ); |
|
| 5548 | + remove_all_filters('get_terms');
|
|
| 5549 | 5549 | |
| 5550 | - $taxonomy = $post_type . 'category'; |
|
| 5550 | + $taxonomy = $post_type.'category'; |
|
| 5551 | 5551 | |
| 5552 | - if ( $per_page > 0 && $page_no > 0 ) {
|
|
| 5553 | - $args['offset'] = ( $page_no - 1 ) * $per_page; |
|
| 5552 | + if ($per_page > 0 && $page_no > 0) {
|
|
| 5553 | + $args['offset'] = ($page_no - 1) * $per_page; |
|
| 5554 | 5554 | $args['number'] = $per_page; |
| 5555 | 5555 | } |
| 5556 | 5556 | |
| 5557 | - $terms = get_terms( $taxonomy, $args ); |
|
| 5557 | + $terms = get_terms($taxonomy, $args); |
|
| 5558 | 5558 | |
| 5559 | 5559 | $csv_rows = array(); |
| 5560 | 5560 | |
| 5561 | - if ( !empty( $terms ) ) {
|
|
| 5561 | + if (!empty($terms)) {
|
|
| 5562 | 5562 | $csv_row = array(); |
| 5563 | 5563 | $csv_row[] = 'cat_id'; |
| 5564 | 5564 | $csv_row[] = 'cat_name'; |
@@ -5580,16 +5580,16 @@ discard block |
||
| 5580 | 5580 | |
| 5581 | 5581 | $csv_rows[] = $csv_row; |
| 5582 | 5582 | |
| 5583 | - foreach ( $terms as $term ) {
|
|
| 5584 | - $cat_icon = get_tax_meta( $term->term_id, 'ct_cat_icon', false, $post_type ); |
|
| 5585 | - $cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : ''; |
|
| 5583 | + foreach ($terms as $term) {
|
|
| 5584 | + $cat_icon = get_tax_meta($term->term_id, 'ct_cat_icon', false, $post_type); |
|
| 5585 | + $cat_icon = !empty($cat_icon) && isset($cat_icon['src']) ? $cat_icon['src'] : ''; |
|
| 5586 | 5586 | |
| 5587 | - $cat_image = geodir_get_default_catimage( $term->term_id, $post_type ); |
|
| 5588 | - $cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : ''; |
|
| 5587 | + $cat_image = geodir_get_default_catimage($term->term_id, $post_type); |
|
| 5588 | + $cat_image = !empty($cat_image) && isset($cat_image['src']) ? $cat_image['src'] : ''; |
|
| 5589 | 5589 | |
| 5590 | 5590 | $cat_parent = ''; |
| 5591 | - if (isset($term->parent) && (int)$term->parent > 0 && term_exists((int)$term->parent, $taxonomy)) {
|
|
| 5592 | - $parent_term = (array)get_term_by( 'id', (int)$term->parent, $taxonomy ); |
|
| 5591 | + if (isset($term->parent) && (int) $term->parent > 0 && term_exists((int) $term->parent, $taxonomy)) {
|
|
| 5592 | + $parent_term = (array) get_term_by('id', (int) $term->parent, $taxonomy);
|
|
| 5593 | 5593 | $cat_parent = !empty($parent_term) && isset($parent_term['name']) ? $parent_term['name'] : ''; |
| 5594 | 5594 | } |
| 5595 | 5595 | |
@@ -5599,15 +5599,15 @@ discard block |
||
| 5599 | 5599 | $csv_row[] = $term->slug; |
| 5600 | 5600 | $csv_row[] = $post_type; |
| 5601 | 5601 | $csv_row[] = $cat_parent; |
| 5602 | - $csv_row[] = get_tax_meta( $term->term_id, 'ct_cat_schema', false, $post_type ); |
|
| 5602 | + $csv_row[] = get_tax_meta($term->term_id, 'ct_cat_schema', false, $post_type); |
|
| 5603 | 5603 | // WPML |
| 5604 | 5604 | if ($is_wpml) {
|
| 5605 | - $csv_row[] = geodir_get_language_for_element( $term->term_id, 'tax_' . $taxonomy ); |
|
| 5606 | - $csv_row[] = geodir_imex_original_post_id( $term->term_id, 'tax_' . $taxonomy ); |
|
| 5605 | + $csv_row[] = geodir_get_language_for_element($term->term_id, 'tax_'.$taxonomy); |
|
| 5606 | + $csv_row[] = geodir_imex_original_post_id($term->term_id, 'tax_'.$taxonomy); |
|
| 5607 | 5607 | } |
| 5608 | 5608 | // WPML |
| 5609 | 5609 | $csv_row[] = $term->description; |
| 5610 | - $csv_row[] = get_tax_meta( $term->term_id, 'ct_cat_top_desc', false, $post_type ); |
|
| 5610 | + $csv_row[] = get_tax_meta($term->term_id, 'ct_cat_top_desc', false, $post_type); |
|
| 5611 | 5611 | $csv_row[] = $cat_image; |
| 5612 | 5612 | $csv_row[] = $cat_icon; |
| 5613 | 5613 | |
@@ -5626,10 +5626,10 @@ discard block |
||
| 5626 | 5626 | * @param bool $relative True for relative path & False for absolute path. |
| 5627 | 5627 | * @return string Path to the cache directory. |
| 5628 | 5628 | */ |
| 5629 | -function geodir_path_import_export( $relative = true ) {
|
|
| 5629 | +function geodir_path_import_export($relative = true) {
|
|
| 5630 | 5630 | $upload_dir = wp_upload_dir(); |
| 5631 | 5631 | |
| 5632 | - return $relative ? $upload_dir['baseurl'] . '/cache' : $upload_dir['basedir'] . '/cache'; |
|
| 5632 | + return $relative ? $upload_dir['baseurl'].'/cache' : $upload_dir['basedir'].'/cache'; |
|
| 5633 | 5633 | } |
| 5634 | 5634 | |
| 5635 | 5635 | /** |
@@ -5645,8 +5645,8 @@ discard block |
||
| 5645 | 5645 | * @param bool $clear If true then it overwrite data otherwise add rows at the end of file. |
| 5646 | 5646 | * @return bool true if success otherwise false. |
| 5647 | 5647 | */ |
| 5648 | -function geodir_save_csv_data( $file_path, $csv_data = array(), $clear = true ) {
|
|
| 5649 | - if ( empty( $csv_data ) ) {
|
|
| 5648 | +function geodir_save_csv_data($file_path, $csv_data = array(), $clear = true) {
|
|
| 5649 | + if (empty($csv_data)) {
|
|
| 5650 | 5650 | return false; |
| 5651 | 5651 | } |
| 5652 | 5652 | |
@@ -5654,17 +5654,17 @@ discard block |
||
| 5654 | 5654 | |
| 5655 | 5655 | $mode = $clear ? 'w+' : 'a+'; |
| 5656 | 5656 | |
| 5657 | - if ( function_exists( 'fputcsv' ) ) {
|
|
| 5658 | - $file = fopen( $file_path, $mode ); |
|
| 5659 | - foreach( $csv_data as $csv_row ) {
|
|
| 5657 | + if (function_exists('fputcsv')) {
|
|
| 5658 | + $file = fopen($file_path, $mode); |
|
| 5659 | + foreach ($csv_data as $csv_row) {
|
|
| 5660 | 5660 | //$csv_row = array_map( 'utf8_decode', $csv_row ); |
| 5661 | - $write_successful = fputcsv( $file, $csv_row, ",", $enclosure = '"' ); |
|
| 5661 | + $write_successful = fputcsv($file, $csv_row, ",", $enclosure = '"'); |
|
| 5662 | 5662 | } |
| 5663 | - fclose( $file ); |
|
| 5663 | + fclose($file); |
|
| 5664 | 5664 | } else {
|
| 5665 | - foreach( $csv_data as $csv_row ) {
|
|
| 5665 | + foreach ($csv_data as $csv_row) {
|
|
| 5666 | 5666 | //$csv_row = array_map( 'utf8_decode', $csv_row ); |
| 5667 | - $wp_filesystem->put_contents( $file_path, $csv_row ); |
|
| 5667 | + $wp_filesystem->put_contents($file_path, $csv_row); |
|
| 5668 | 5668 | } |
| 5669 | 5669 | } |
| 5670 | 5670 | |
@@ -5682,14 +5682,14 @@ discard block |
||
| 5682 | 5682 | * @param string $file Full path to file. |
| 5683 | 5683 | * @return int No of file rows. |
| 5684 | 5684 | */ |
| 5685 | -function geodir_import_export_line_count( $file ) {
|
|
| 5685 | +function geodir_import_export_line_count($file) {
|
|
| 5686 | 5686 | global $wp_filesystem; |
| 5687 | 5687 | |
| 5688 | - if ( $wp_filesystem->is_file( $file ) && $wp_filesystem->exists( $file ) ) {
|
|
| 5689 | - $contents = $wp_filesystem->get_contents_array( $file ); |
|
| 5688 | + if ($wp_filesystem->is_file($file) && $wp_filesystem->exists($file)) {
|
|
| 5689 | + $contents = $wp_filesystem->get_contents_array($file); |
|
| 5690 | 5690 | |
| 5691 | - if ( !empty( $contents ) && is_array( $contents ) ) {
|
|
| 5692 | - return count( $contents ) - 1; |
|
| 5691 | + if (!empty($contents) && is_array($contents)) {
|
|
| 5692 | + return count($contents) - 1; |
|
| 5693 | 5693 | } |
| 5694 | 5694 | } |
| 5695 | 5695 | |
@@ -5706,11 +5706,11 @@ discard block |
||
| 5706 | 5706 | * @param string $post_type The post type. |
| 5707 | 5707 | * @return object Queried object. |
| 5708 | 5708 | */ |
| 5709 | -function geodir_imex_get_custom_fields( $post_type ) {
|
|
| 5709 | +function geodir_imex_get_custom_fields($post_type) {
|
|
| 5710 | 5710 | global $wpdb; |
| 5711 | 5711 | |
| 5712 | - $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 ) );
|
|
| 5713 | - $rows = $wpdb->get_results( $sql ); |
|
| 5712 | + $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));
|
|
| 5713 | + $rows = $wpdb->get_results($sql); |
|
| 5714 | 5714 | |
| 5715 | 5715 | return $rows; |
| 5716 | 5716 | } |
@@ -5789,14 +5789,14 @@ discard block |
||
| 5789 | 5789 | global $wpdb, $plugin_prefix; |
| 5790 | 5790 | |
| 5791 | 5791 | $post_type = get_post_type($master_post_id); |
| 5792 | - $post_table = $plugin_prefix . $post_type . '_detail'; |
|
| 5792 | + $post_table = $plugin_prefix.$post_type.'_detail'; |
|
| 5793 | 5793 | |
| 5794 | - $query = $wpdb->prepare("SELECT * FROM " . $post_table . " WHERE post_id = %d", array($master_post_id));
|
|
| 5795 | - $data = (array)$wpdb->get_row($query); |
|
| 5794 | + $query = $wpdb->prepare("SELECT * FROM ".$post_table." WHERE post_id = %d", array($master_post_id));
|
|
| 5795 | + $data = (array) $wpdb->get_row($query); |
|
| 5796 | 5796 | |
| 5797 | - if ( !empty( $data ) ) {
|
|
| 5797 | + if (!empty($data)) {
|
|
| 5798 | 5798 | $data['post_id'] = $tr_post_id; |
| 5799 | - unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type . 'category'], $data['overall_rating'], $data['rating_count'], $data['ratings']); |
|
| 5799 | + unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type.'category'], $data['overall_rating'], $data['rating_count'], $data['ratings']); |
|
| 5800 | 5800 | |
| 5801 | 5801 | $wpdb->update($post_table, $data, array('post_id' => $tr_post_id));
|
| 5802 | 5802 | return true; |
@@ -5822,7 +5822,7 @@ discard block |
||
| 5822 | 5822 | global $sitepress, $wpdb; |
| 5823 | 5823 | $post_type = get_post_type($master_post_id); |
| 5824 | 5824 | |
| 5825 | - remove_filter('get_term', array($sitepress,'get_term_adjust_id')); // AVOID filtering to current language
|
|
| 5825 | + remove_filter('get_term', array($sitepress, 'get_term_adjust_id')); // AVOID filtering to current language
|
|
| 5826 | 5826 | |
| 5827 | 5827 | $taxonomies = get_object_taxonomies($post_type); |
| 5828 | 5828 | foreach ($taxonomies as $taxonomy) {
|
@@ -5831,9 +5831,9 @@ discard block |
||
| 5831 | 5831 | |
| 5832 | 5832 | if ($terms) {
|
| 5833 | 5833 | foreach ($terms as $term) {
|
| 5834 | - $tr_id = apply_filters( 'translate_object_id',$term->term_id, $taxonomy, false, $lang); |
|
| 5834 | + $tr_id = apply_filters('translate_object_id', $term->term_id, $taxonomy, false, $lang);
|
|
| 5835 | 5835 | |
| 5836 | - if (!is_null($tr_id)){
|
|
| 5836 | + if (!is_null($tr_id)) {
|
|
| 5837 | 5837 | // not using get_term - unfiltered get_term |
| 5838 | 5838 | $translated_term = $wpdb->get_row($wpdb->prepare("
|
| 5839 | 5839 | SELECT * FROM {$wpdb->terms} t JOIN {$wpdb->term_taxonomy} x ON x.term_id = t.term_id WHERE t.term_id = %d AND x.taxonomy = %s", $tr_id, $taxonomy));
|
@@ -5842,14 +5842,14 @@ discard block |
||
| 5842 | 5842 | } |
| 5843 | 5843 | } |
| 5844 | 5844 | |
| 5845 | - if (!is_taxonomy_hierarchical($taxonomy)){
|
|
| 5846 | - $terms_array = array_unique( array_map( 'intval', $terms_array ) ); |
|
| 5845 | + if (!is_taxonomy_hierarchical($taxonomy)) {
|
|
| 5846 | + $terms_array = array_unique(array_map('intval', $terms_array));
|
|
| 5847 | 5847 | } |
| 5848 | 5848 | |
| 5849 | 5849 | wp_set_post_terms($tr_post_id, $terms_array, $taxonomy); |
| 5850 | 5850 | |
| 5851 | - if ($taxonomy == $post_type . 'category') {
|
|
| 5852 | - geodir_set_postcat_structure($tr_post_id, $post_type . 'category'); |
|
| 5851 | + if ($taxonomy == $post_type.'category') {
|
|
| 5852 | + geodir_set_postcat_structure($tr_post_id, $post_type.'category'); |
|
| 5853 | 5853 | } |
| 5854 | 5854 | } |
| 5855 | 5855 | } |
@@ -5870,15 +5870,15 @@ discard block |
||
| 5870 | 5870 | function geodir_icl_duplicate_post_images($master_post_id, $tr_post_id, $lang) {
|
| 5871 | 5871 | global $wpdb; |
| 5872 | 5872 | |
| 5873 | - $query = $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id));
|
|
| 5873 | + $query = $wpdb->prepare("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id));
|
|
| 5874 | 5874 | $wpdb->query($query); |
| 5875 | 5875 | |
| 5876 | - $query = $wpdb->prepare("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id));
|
|
| 5876 | + $query = $wpdb->prepare("SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id));
|
|
| 5877 | 5877 | $post_images = $wpdb->get_results($query); |
| 5878 | 5878 | |
| 5879 | - if ( !empty( $post_images ) ) {
|
|
| 5880 | - foreach ( $post_images as $post_image) {
|
|
| 5881 | - $image_data = (array)$post_image; |
|
| 5879 | + if (!empty($post_images)) {
|
|
| 5880 | + foreach ($post_images as $post_image) {
|
|
| 5881 | + $image_data = (array) $post_image; |
|
| 5882 | 5882 | unset($image_data['ID']); |
| 5883 | 5883 | $image_data['post_id'] = $tr_post_id; |
| 5884 | 5884 | |
@@ -5904,10 +5904,10 @@ discard block |
||
| 5904 | 5904 | * @return array Event data array. |
| 5905 | 5905 | */ |
| 5906 | 5906 | function geodir_imex_get_event_data($post, $gd_post_info) {
|
| 5907 | - $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'] ) ) : ''; |
|
| 5907 | + $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'])) : '';
|
|
| 5908 | 5908 | $event_enddate = $event_date; |
| 5909 | - $starttime = isset( $post['starttime'] ) && $post['starttime'] != '' && $post['starttime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $post['starttime'] ) ) : ''; |
|
| 5910 | - $endtime = isset( $post['endtime'] ) && $post['endtime'] != '' && $post['endtime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $post['endtime'] ) ) : ''; |
|
| 5909 | + $starttime = isset($post['starttime']) && $post['starttime'] != '' && $post['starttime'] != '00:00:00' ? date_i18n('H:i', strtotime($post['starttime'])) : '';
|
|
| 5910 | + $endtime = isset($post['endtime']) && $post['endtime'] != '' && $post['endtime'] != '00:00:00' ? date_i18n('H:i', strtotime($post['endtime'])) : '';
|
|
| 5911 | 5911 | |
| 5912 | 5912 | $is_recurring_event = ''; |
| 5913 | 5913 | $event_duration_days = ''; |
@@ -5924,15 +5924,15 @@ discard block |
||
| 5924 | 5924 | |
| 5925 | 5925 | $recurring_data = isset($gd_post_info->recurring_dates) ? maybe_unserialize($gd_post_info->recurring_dates) : array(); |
| 5926 | 5926 | if (!empty($recurring_data)) {
|
| 5927 | - $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; |
|
| 5928 | - $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; |
|
| 5929 | - $starttime = isset( $recurring_data['starttime'] ) && $recurring_data['starttime'] != '' && $recurring_data['starttime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $recurring_data['starttime'] ) ) : $starttime; |
|
| 5930 | - $endtime = isset( $recurring_data['endtime'] ) && $recurring_data['endtime'] != '' && $recurring_data['endtime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $recurring_data['endtime'] ) ) : $endtime; |
|
| 5927 | + $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;
|
|
| 5928 | + $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;
|
|
| 5929 | + $starttime = isset($recurring_data['starttime']) && $recurring_data['starttime'] != '' && $recurring_data['starttime'] != '00:00:00' ? date_i18n('H:i', strtotime($recurring_data['starttime'])) : $starttime;
|
|
| 5930 | + $endtime = isset($recurring_data['endtime']) && $recurring_data['endtime'] != '' && $recurring_data['endtime'] != '00:00:00' ? date_i18n('H:i', strtotime($recurring_data['endtime'])) : $endtime;
|
|
| 5931 | 5931 | $is_whole_day_event = !empty($recurring_data['all_day']) ? 1 : ''; |
| 5932 | 5932 | $different_times = !empty($recurring_data['different_times']) ? true : false; |
| 5933 | 5933 | |
| 5934 | - $recurring_pkg = geodir_event_recurring_pkg( $gd_post_info ); |
|
| 5935 | - $is_recurring = isset( $gd_post_info->is_recurring ) && (int)$gd_post_info->is_recurring == 0 ? false : true; |
|
| 5934 | + $recurring_pkg = geodir_event_recurring_pkg($gd_post_info); |
|
| 5935 | + $is_recurring = isset($gd_post_info->is_recurring) && (int) $gd_post_info->is_recurring == 0 ? false : true; |
|
| 5936 | 5936 | |
| 5937 | 5937 | if ($recurring_pkg && $is_recurring) {
|
| 5938 | 5938 | $recurring_dates = $event_date; |
@@ -5942,13 +5942,13 @@ discard block |
||
| 5942 | 5942 | $recurring_type = !empty($recurring_data['repeat_type']) && in_array($recurring_data['repeat_type'], array('day', 'week', 'month', 'year', 'custom')) ? $recurring_data['repeat_type'] : 'custom';
|
| 5943 | 5943 | |
| 5944 | 5944 | if (!empty($recurring_data['event_recurring_dates'])) {
|
| 5945 | - $event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] ); |
|
| 5945 | + $event_recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
|
|
| 5946 | 5946 | |
| 5947 | 5947 | if (!empty($event_recurring_dates)) {
|
| 5948 | 5948 | $recurring_dates = array(); |
| 5949 | 5949 | |
| 5950 | 5950 | foreach ($event_recurring_dates as $date) {
|
| 5951 | - $recurring_dates[] = date_i18n( 'd/m/Y', strtotime( $date ) ); |
|
| 5951 | + $recurring_dates[] = date_i18n('d/m/Y', strtotime($date));
|
|
| 5952 | 5952 | } |
| 5953 | 5953 | |
| 5954 | 5954 | $recurring_dates = implode(",", $recurring_dates);
|
@@ -5964,7 +5964,7 @@ discard block |
||
| 5964 | 5964 | $times = array(); |
| 5965 | 5965 | |
| 5966 | 5966 | foreach ($recurring_data['starttimes'] as $time) {
|
| 5967 | - $times[] = $time != '00:00:00' ? date_i18n( 'H:i', strtotime( $time ) ) : '00:00'; |
|
| 5967 | + $times[] = $time != '00:00:00' ? date_i18n('H:i', strtotime($time)) : '00:00';
|
|
| 5968 | 5968 | } |
| 5969 | 5969 | |
| 5970 | 5970 | $event_starttimes = implode(",", $times);
|
@@ -5974,7 +5974,7 @@ discard block |
||
| 5974 | 5974 | $times = array(); |
| 5975 | 5975 | |
| 5976 | 5976 | foreach ($recurring_data['endtimes'] as $time) {
|
| 5977 | - $times[] = $time != '00:00:00' ? date_i18n( 'H:i', strtotime( $time ) ) : '00:00'; |
|
| 5977 | + $times[] = $time != '00:00:00' ? date_i18n('H:i', strtotime($time)) : '00:00';
|
|
| 5978 | 5978 | } |
| 5979 | 5979 | |
| 5980 | 5980 | $event_endtimes = implode(",", $times);
|
@@ -5986,8 +5986,8 @@ discard block |
||
| 5986 | 5986 | } |
| 5987 | 5987 | } |
| 5988 | 5988 | } else {
|
| 5989 | - $event_duration_days = isset($recurring_data['duration_x']) ? (int)$recurring_data['duration_x'] : 1; |
|
| 5990 | - $recurring_interval = !empty($recurring_data['repeat_x']) && (int)$recurring_data['repeat_x'] > 0 ? $recurring_data['repeat_x'] : 1; |
|
| 5989 | + $event_duration_days = isset($recurring_data['duration_x']) ? (int) $recurring_data['duration_x'] : 1; |
|
| 5990 | + $recurring_interval = !empty($recurring_data['repeat_x']) && (int) $recurring_data['repeat_x'] > 0 ? $recurring_data['repeat_x'] : 1; |
|
| 5991 | 5991 | |
| 5992 | 5992 | if (($recurring_type == 'week' || $recurring_type == 'month') && !empty($recurring_data['repeat_days'])) {
|
| 5993 | 5993 | $week_days = array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
|
@@ -6003,11 +6003,11 @@ discard block |
||
| 6003 | 6003 | } |
| 6004 | 6004 | |
| 6005 | 6005 | $recurring_week_nos = $recurring_type == 'month' && !empty($recurring_data['repeat_weeks']) ? implode(",", $recurring_data['repeat_weeks']) : $recurring_week_nos;
|
| 6006 | - if (!empty($recurring_data['repeat_end_type']) && (int)$recurring_data['repeat_end_type'] == 1) {
|
|
| 6007 | - $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'] ) ) : ''; |
|
| 6006 | + if (!empty($recurring_data['repeat_end_type']) && (int) $recurring_data['repeat_end_type'] == 1) {
|
|
| 6007 | + $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'])) : '';
|
|
| 6008 | 6008 | $max_recurring_count = empty($recurring_end_date) ? 1 : ''; |
| 6009 | 6009 | } else {
|
| 6010 | - $max_recurring_count = (!empty($recurring_data['max_repeat']) && (int)$recurring_data['max_repeat'] > 0 ? (int)$recurring_data['max_repeat'] : 1); |
|
| 6010 | + $max_recurring_count = (!empty($recurring_data['max_repeat']) && (int) $recurring_data['max_repeat'] > 0 ? (int) $recurring_data['max_repeat'] : 1); |
|
| 6011 | 6011 | } |
| 6012 | 6012 | } |
| 6013 | 6013 | } |
@@ -6071,9 +6071,9 @@ discard block |
||
| 6071 | 6071 | * @return array Event data array. |
| 6072 | 6072 | */ |
| 6073 | 6073 | function geodir_imex_process_event_data($gd_post) {
|
| 6074 | - $recurring_pkg = geodir_event_recurring_pkg( (object)$gd_post ); |
|
| 6074 | + $recurring_pkg = geodir_event_recurring_pkg((object) $gd_post); |
|
| 6075 | 6075 | |
| 6076 | - $is_recurring = isset( $gd_post['is_recurring_event'] ) && (int)$gd_post['is_recurring_event'] == 0 ? false : true; |
|
| 6076 | + $is_recurring = isset($gd_post['is_recurring_event']) && (int) $gd_post['is_recurring_event'] == 0 ? false : true; |
|
| 6077 | 6077 | $event_date = isset($gd_post['event_date']) && $gd_post['event_date'] != '' ? geodir_imex_get_date_ymd($gd_post['event_date']) : ''; |
| 6078 | 6078 | $event_enddate = isset($gd_post['event_enddate']) && $gd_post['event_enddate'] != '' ? geodir_imex_get_date_ymd($gd_post['event_enddate']) : $event_date; |
| 6079 | 6079 | $all_day = isset($gd_post['is_whole_day_event']) && !empty($gd_post['is_whole_day_event']) ? true : false; |
@@ -6120,17 +6120,17 @@ discard block |
||
| 6120 | 6120 | $event_recurring_dates = implode(",", $event_recurring_dates);
|
| 6121 | 6121 | } |
| 6122 | 6122 | } else {
|
| 6123 | - $duration_x = !empty( $gd_post['event_duration_days'] ) ? (int)$gd_post['event_duration_days'] : 1; |
|
| 6124 | - $repeat_x = !empty( $gd_post['recurring_interval'] ) ? (int)$gd_post['recurring_interval'] : 1; |
|
| 6125 | - $max_repeat = !empty( $gd_post['max_recurring_count'] ) ? (int)$gd_post['max_recurring_count'] : 1; |
|
| 6126 | - $repeat_end = !empty( $gd_post['recurring_end_date'] ) ? geodir_imex_get_date_ymd($gd_post['recurring_end_date']) : ''; |
|
| 6123 | + $duration_x = !empty($gd_post['event_duration_days']) ? (int) $gd_post['event_duration_days'] : 1; |
|
| 6124 | + $repeat_x = !empty($gd_post['recurring_interval']) ? (int) $gd_post['recurring_interval'] : 1; |
|
| 6125 | + $max_repeat = !empty($gd_post['max_recurring_count']) ? (int) $gd_post['max_recurring_count'] : 1; |
|
| 6126 | + $repeat_end = !empty($gd_post['recurring_end_date']) ? geodir_imex_get_date_ymd($gd_post['recurring_end_date']) : ''; |
|
| 6127 | 6127 | |
| 6128 | 6128 | $repeat_end_type = $repeat_end != '' ? 1 : 0; |
| 6129 | 6129 | $max_repeat = $repeat_end != '' ? '' : $max_repeat; |
| 6130 | 6130 | |
| 6131 | 6131 | $week_days = array_flip(array('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'));
|
| 6132 | 6132 | |
| 6133 | - $a_repeat_days = isset($gd_post['recurring_week_days']) && trim($gd_post['recurring_week_days'])!='' ? explode(',', trim($gd_post['recurring_week_days'])) : array();
|
|
| 6133 | + $a_repeat_days = isset($gd_post['recurring_week_days']) && trim($gd_post['recurring_week_days']) != '' ? explode(',', trim($gd_post['recurring_week_days'])) : array();
|
|
| 6134 | 6134 | $repeat_days = array(); |
| 6135 | 6135 | if (!empty($a_repeat_days)) {
|
| 6136 | 6136 | foreach ($a_repeat_days as $repeat_day) {
|
@@ -6148,7 +6148,7 @@ discard block |
||
| 6148 | 6148 | $repeat_weeks = array(); |
| 6149 | 6149 | if (!empty($a_repeat_weeks)) {
|
| 6150 | 6150 | foreach ($a_repeat_weeks as $repeat_week) {
|
| 6151 | - $repeat_weeks[] = (int)$repeat_week; |
|
| 6151 | + $repeat_weeks[] = (int) $repeat_week; |
|
| 6152 | 6152 | } |
| 6153 | 6153 | |
| 6154 | 6154 | $repeat_weeks = array_unique($repeat_weeks); |
@@ -6212,7 +6212,7 @@ discard block |
||
| 6212 | 6212 | |
| 6213 | 6213 | $page_found = $wpdb->get_var( |
| 6214 | 6214 | $wpdb->prepare( |
| 6215 | - "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;", |
|
| 6215 | + "SELECT ID FROM ".$wpdb->posts." WHERE post_name = %s LIMIT 1;", |
|
| 6216 | 6216 | array($slug) |
| 6217 | 6217 | ) |
| 6218 | 6218 | ); |
@@ -6267,7 +6267,7 @@ discard block |
||
| 6267 | 6267 | */ |
| 6268 | 6268 | function geodir_admin_upgrade_notice() {
|
| 6269 | 6269 | $class = "error"; |
| 6270 | - $message = __("Please update core GeoDirectory or some addons may not function correctly.","geodirectory");
|
|
| 6270 | + $message = __("Please update core GeoDirectory or some addons may not function correctly.", "geodirectory");
|
|
| 6271 | 6271 | echo"<div class=\"$class\"> <p>$message</p></div>"; |
| 6272 | 6272 | } |
| 6273 | 6273 | |
@@ -6279,7 +6279,7 @@ discard block |
||
| 6279 | 6279 | * @param (object) $r |
| 6280 | 6280 | * @return (string) $output |
| 6281 | 6281 | */ |
| 6282 | -function geodire_admin_upgrade_notice( $plugin_data, $r ) |
|
| 6282 | +function geodire_admin_upgrade_notice($plugin_data, $r) |
|
| 6283 | 6283 | {
|
| 6284 | 6284 | // readme contents |
| 6285 | 6285 | $args = array( |
@@ -6287,7 +6287,7 @@ discard block |
||
| 6287 | 6287 | 'redirection' => 5 |
| 6288 | 6288 | ); |
| 6289 | 6289 | $url = "http://plugins.svn.wordpress.org/geodirectory/trunk/readme.txt"; |
| 6290 | - $data = wp_remote_get( $url, $args ); |
|
| 6290 | + $data = wp_remote_get($url, $args); |
|
| 6291 | 6291 | |
| 6292 | 6292 | if (!is_wp_error($data) && $data['response']['code'] == 200) {
|
| 6293 | 6293 | |
@@ -6302,20 +6302,20 @@ discard block |
||
| 6302 | 6302 | function geodir_in_plugin_update_message($content) {
|
| 6303 | 6303 | // Output Upgrade Notice |
| 6304 | 6304 | $matches = null; |
| 6305 | - $regexp = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( GEODIRECTORY_VERSION ) . '\s*=|$)~Uis'; |
|
| 6305 | + $regexp = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*'.preg_quote(GEODIRECTORY_VERSION).'\s*=|$)~Uis'; |
|
| 6306 | 6306 | $upgrade_notice = ''; |
| 6307 | - if ( preg_match( $regexp, $content, $matches ) ) {
|
|
| 6308 | - if(empty($matches)){return;}
|
|
| 6307 | + if (preg_match($regexp, $content, $matches)) {
|
|
| 6308 | + if (empty($matches)) {return; }
|
|
| 6309 | 6309 | |
| 6310 | - $version = trim( $matches[1] ); |
|
| 6311 | - if($version && $version>GEODIRECTORY_VERSION){
|
|
| 6310 | + $version = trim($matches[1]); |
|
| 6311 | + if ($version && $version > GEODIRECTORY_VERSION) {
|
|
| 6312 | 6312 | |
| 6313 | 6313 | |
| 6314 | - $notices = (array) preg_split('~[\r\n]+~', trim( $matches[2] ) );
|
|
| 6315 | - if ( version_compare( GEODIRECTORY_VERSION, $version, '<' ) ) {
|
|
| 6314 | + $notices = (array) preg_split('~[\r\n]+~', trim($matches[2]));
|
|
| 6315 | + if (version_compare(GEODIRECTORY_VERSION, $version, '<')) {
|
|
| 6316 | 6316 | $upgrade_notice .= '<div class="geodir_plugin_upgrade_notice">'; |
| 6317 | - foreach ( $notices as $index => $line ) {
|
|
| 6318 | - $upgrade_notice .= wp_kses_post( preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line ) );
|
|
| 6317 | + foreach ($notices as $index => $line) {
|
|
| 6318 | + $upgrade_notice .= wp_kses_post(preg_replace('~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line));
|
|
| 6319 | 6319 | } |
| 6320 | 6320 | $upgrade_notice .= '</div> '; |
| 6321 | 6321 | } |
@@ -6339,7 +6339,7 @@ discard block |
||
| 6339 | 6339 | $default_language = $sitepress->get_default_language(); |
| 6340 | 6340 | if ($current_language != 'all' && $current_language != $default_language) {
|
| 6341 | 6341 | ?> |
| 6342 | - <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>
|
|
| 6342 | + <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>
|
|
| 6343 | 6343 | <?php |
| 6344 | 6344 | } |
| 6345 | 6345 | } |
@@ -6354,7 +6354,7 @@ discard block |
||
| 6354 | 6354 | * @param array Listing statuses to be skipped. |
| 6355 | 6355 | */ |
| 6356 | 6356 | function geodir_imex_export_skip_statuses() {
|
| 6357 | - $statuses = array( 'trash', 'auto-draft' ); |
|
| 6357 | + $statuses = array('trash', 'auto-draft');
|
|
| 6358 | 6358 | |
| 6359 | 6359 | /** |
| 6360 | 6360 | * Filter the statuses to skip during GD export listings. |
@@ -6364,7 +6364,7 @@ discard block |
||
| 6364 | 6364 | * |
| 6365 | 6365 | * @param array $statuses Listing statuses to be skipped. |
| 6366 | 6366 | */ |
| 6367 | - $statuses = apply_filters( 'geodir_imex_export_skip_statuses', $statuses ); |
|
| 6367 | + $statuses = apply_filters('geodir_imex_export_skip_statuses', $statuses);
|
|
| 6368 | 6368 | |
| 6369 | 6369 | return $statuses; |
| 6370 | 6370 | } |
@@ -6404,16 +6404,16 @@ discard block |
||
| 6404 | 6404 | function geodir_imex_get_filter_where($where = '', $post_type = '') {
|
| 6405 | 6405 | global $wpdb; |
| 6406 | 6406 | |
| 6407 | - $filters = !empty( $_REQUEST['gd_imex'] ) && is_array( $_REQUEST['gd_imex'] ) ? $_REQUEST['gd_imex'] : NULL; |
|
| 6407 | + $filters = !empty($_REQUEST['gd_imex']) && is_array($_REQUEST['gd_imex']) ? $_REQUEST['gd_imex'] : NULL; |
|
| 6408 | 6408 | |
| 6409 | - if ( !empty( $filters ) ) {
|
|
| 6410 | - foreach ( $filters as $field => $value ) {
|
|
| 6409 | + if (!empty($filters)) {
|
|
| 6410 | + foreach ($filters as $field => $value) {
|
|
| 6411 | 6411 | switch ($field) {
|
| 6412 | 6412 | case 'start_date': |
| 6413 | - $where .= " AND `" . $wpdb->posts . "`.`post_date` >= '" . sanitize_text_field( $value ) . " 00:00:00'"; |
|
| 6413 | + $where .= " AND `".$wpdb->posts."`.`post_date` >= '".sanitize_text_field($value)." 00:00:00'"; |
|
| 6414 | 6414 | break; |
| 6415 | 6415 | case 'end_date': |
| 6416 | - $where .= " AND `" . $wpdb->posts . "`.`post_date` <= '" . sanitize_text_field( $value ) . " 23:59:59'"; |
|
| 6416 | + $where .= " AND `".$wpdb->posts."`.`post_date` <= '".sanitize_text_field($value)." 23:59:59'"; |
|
| 6417 | 6417 | break; |
| 6418 | 6418 | } |
| 6419 | 6419 | } |
@@ -6425,25 +6425,25 @@ discard block |
||
| 6425 | 6425 | add_filter('geodir_get_export_posts', 'geodir_imex_get_filter_where', 10, 2);
|
| 6426 | 6426 | |
| 6427 | 6427 | |
| 6428 | -function geodir_fix_for_primer_theme(){
|
|
| 6429 | - if(!defined( 'PRIMER_VERSION' )){return;}
|
|
| 6428 | +function geodir_fix_for_primer_theme() {
|
|
| 6429 | + if (!defined('PRIMER_VERSION')) {return; }
|
|
| 6430 | 6430 | global $pagenow; |
| 6431 | 6431 | |
| 6432 | - if ( ( 'post.php' === $pagenow || 'post-new.php' === $pagenow ) && (isset($_REQUEST['post_type']) || isset($_REQUEST['post']) ) ){
|
|
| 6432 | + if (('post.php' === $pagenow || 'post-new.php' === $pagenow) && (isset($_REQUEST['post_type']) || isset($_REQUEST['post']))) {
|
|
| 6433 | 6433 | |
| 6434 | - $post_type = isset($_REQUEST['post_type']) ? esc_attr($_REQUEST['post_type']) : get_post_type( $_GET['post'] ); |
|
| 6434 | + $post_type = isset($_REQUEST['post_type']) ? esc_attr($_REQUEST['post_type']) : get_post_type($_GET['post']); |
|
| 6435 | 6435 | |
| 6436 | 6436 | $post_types = geodir_get_posttypes(); |
| 6437 | - if ($post_type && in_array($post_type, $post_types) ) {
|
|
| 6437 | + if ($post_type && in_array($post_type, $post_types)) {
|
|
| 6438 | 6438 | global $primer_customizer_layouts; |
| 6439 | - remove_action( 'add_meta_boxes', array( $primer_customizer_layouts, 'add_meta_box' ), 10); |
|
| 6439 | + remove_action('add_meta_boxes', array($primer_customizer_layouts, 'add_meta_box'), 10);
|
|
| 6440 | 6440 | } |
| 6441 | 6441 | } |
| 6442 | 6442 | |
| 6443 | 6443 | } |
| 6444 | 6444 | |
| 6445 | -if(is_admin()){
|
|
| 6446 | - add_action('add_meta_boxes','geodir_fix_for_primer_theme',0);
|
|
| 6445 | +if (is_admin()) {
|
|
| 6446 | + add_action('add_meta_boxes', 'geodir_fix_for_primer_theme', 0);
|
|
| 6447 | 6447 | } |
| 6448 | 6448 | |
| 6449 | 6449 | |
@@ -184,8 +184,9 @@ discard block |
||
| 184 | 184 | |
| 185 | 185 | $thumb_img_arr = array(); |
| 186 | 186 | |
| 187 | - if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
|
| 188 | - $thumb_img_arr = geodir_get_images($_REQUEST['pid']); |
|
| 187 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
|
| 188 | + $thumb_img_arr = geodir_get_images($_REQUEST['pid']); |
|
| 189 | + } |
|
| 189 | 190 | |
| 190 | 191 | $totImg = ''; |
| 191 | 192 | $image_limit = ''; |
@@ -236,7 +237,9 @@ discard block |
||
| 236 | 237 | {
|
| 237 | 238 | global $menu, $geodirectory; |
| 238 | 239 | |
| 239 | - if (current_user_can('manage_options')) $menu[] = array('', 'read', 'separator-geodirectory', '', 'wp-menu-separator geodirectory');
|
|
| 240 | + if (current_user_can('manage_options')) { |
|
| 241 | + $menu[] = array('', 'read', 'separator-geodirectory', '', 'wp-menu-separator geodirectory'); |
|
| 242 | + } |
|
| 240 | 243 | |
| 241 | 244 | add_menu_page(__('Geodirectory', 'geodirectory'), __('Geodirectory', 'geodirectory'), 'manage_options', 'geodirectory', 'geodir_admin_panel', geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico', '55.1984');
|
| 242 | 245 | |
@@ -300,7 +303,9 @@ discard block |
||
| 300 | 303 | */ |
| 301 | 304 | function geodir_admin_custom_menu_order() |
| 302 | 305 | {
|
| 303 | - if (!current_user_can('manage_options')) return false;
|
|
| 306 | + if (!current_user_can('manage_options')) { |
|
| 307 | + return false; |
|
| 308 | + } |
|
| 304 | 309 | return true; |
| 305 | 310 | } |
| 306 | 311 | } |
@@ -331,10 +336,11 @@ discard block |
||
| 331 | 336 | case 'fail': |
| 332 | 337 | $gderr = isset($_REQUEST['gderr']) ? $_REQUEST['gderr'] : ''; |
| 333 | 338 | |
| 334 | - if ($gderr == 21) |
|
| 335 | - 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>';
|
|
| 336 | - else |
|
| 337 | - echo '<div id="message" class="error fade"><p><strong>' . __('Error: Your settings have not been saved, please try again.', 'geodirectory') . '</strong></p></div>';
|
|
| 339 | + if ($gderr == 21) { |
|
| 340 | + 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>'; |
|
| 341 | + } else { |
|
| 342 | + echo '<div id="message" class="error fade"><p><strong>' . __('Error: Your settings have not been saved, please try again.', 'geodirectory') . '</strong></p></div>'; |
|
| 343 | + } |
|
| 338 | 344 | break; |
| 339 | 345 | } |
| 340 | 346 | } |
@@ -385,8 +391,12 @@ discard block |
||
| 385 | 391 | include_once('option-pages/' . $current_tab . '_array.php');
|
| 386 | 392 | } |
| 387 | 393 | if (isset($_POST) && $_POST && isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') : |
| 388 | - if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
|
|
| 389 | - if (!wp_verify_nonce($_REQUEST['_wpnonce-' . $current_tab], 'geodir-settings-' . $current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
|
|
| 394 | + if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) { |
|
| 395 | + die(__('Action failed. Please refresh the page and retry.', 'geodirectory')); |
|
| 396 | + } |
|
| 397 | + if (!wp_verify_nonce($_REQUEST['_wpnonce-' . $current_tab], 'geodir-settings-' . $current_tab)) { |
|
| 398 | + die(__('Action failed. Please refresh the page and retry.', 'geodirectory')); |
|
| 399 | + } |
|
| 390 | 400 | |
| 391 | 401 | /** |
| 392 | 402 | * Fires before updating geodirectory admin settings. |
@@ -398,8 +408,9 @@ discard block |
||
| 398 | 408 | */ |
| 399 | 409 | do_action('geodir_before_update_options', $current_tab, $geodir_settings);
|
| 400 | 410 | |
| 401 | - if (!empty($geodir_settings[$current_tab])) |
|
| 402 | - geodir_update_options($geodir_settings[$current_tab]); |
|
| 411 | + if (!empty($geodir_settings[$current_tab])) { |
|
| 412 | + geodir_update_options($geodir_settings[$current_tab]); |
|
| 413 | + } |
|
| 403 | 414 | |
| 404 | 415 | /** |
| 405 | 416 | * Called after GeoDirectory options settings are updated. |
@@ -447,11 +458,14 @@ discard block |
||
| 447 | 458 | * @return bool Returns true if saved. |
| 448 | 459 | */ |
| 449 | 460 | function geodir_update_options($options, $dummy = false) {
|
| 450 | - if ((!isset($_POST) || !$_POST) && !$dummy) return false; |
|
| 461 | + if ((!isset($_POST) || !$_POST) && !$dummy) { |
|
| 462 | + return false; |
|
| 463 | + } |
|
| 451 | 464 | |
| 452 | 465 | foreach ($options as $value) {
|
| 453 | - if ($dummy && isset($value['std'])) |
|
| 454 | - $_POST[$value['id']] = $value['std']; |
|
| 466 | + if ($dummy && isset($value['std'])) { |
|
| 467 | + $_POST[$value['id']] = $value['std']; |
|
| 468 | + } |
|
| 455 | 469 | |
| 456 | 470 | |
| 457 | 471 | if (isset($value['type']) && $value['type'] == 'checkbox') : |
@@ -460,25 +474,23 @@ discard block |
||
| 460 | 474 | update_option($value['id'], $_POST[$value['id']]); |
| 461 | 475 | } else {
|
| 462 | 476 | update_option($value['id'], 0); |
| 463 | - } |
|
| 464 | - |
|
| 465 | - elseif (isset($value['type']) && $value['type'] == 'image_width') : |
|
| 477 | + } elseif (isset($value['type']) && $value['type'] == 'image_width') : |
|
| 466 | 478 | |
| 467 | 479 | if (isset($value['id']) && isset($_POST[$value['id'] . '_width'])) {
|
| 468 | 480 | update_option($value['id'] . '_width', $_POST[$value['id'] . '_width']); |
| 469 | 481 | update_option($value['id'] . '_height', $_POST[$value['id'] . '_height']); |
| 470 | 482 | if (isset($_POST[$value['id'] . '_crop'])) : |
| 471 | 483 | update_option($value['id'] . '_crop', 1); |
| 472 | - else : |
|
| 473 | - update_option($value['id'] . '_crop', 0); |
|
| 484 | + else { |
|
| 485 | + : |
|
| 486 | + update_option($value['id'] . '_crop', 0); |
|
| 487 | + } |
|
| 474 | 488 | endif; |
| 475 | 489 | } else {
|
| 476 | 490 | update_option($value['id'] . '_width', $value['std']); |
| 477 | 491 | update_option($value['id'] . '_height', $value['std']); |
| 478 | 492 | update_option($value['id'] . '_crop', 1); |
| 479 | - } |
|
| 480 | - |
|
| 481 | - elseif (isset($value['type']) && $value['type'] == 'map') : |
|
| 493 | + } elseif (isset($value['type']) && $value['type'] == 'map') : |
|
| 482 | 494 | $post_types = array(); |
| 483 | 495 | $categories = array(); |
| 484 | 496 | |
@@ -523,8 +535,9 @@ discard block |
||
| 523 | 535 | $image_name_arr = explode('/', get_option($value['id']));
|
| 524 | 536 | $noimg_name = end($image_name_arr); |
| 525 | 537 | $img_path = $uploads['path'] . '/' . $noimg_name; |
| 526 | - if (file_exists($img_path)) |
|
| 527 | - unlink($img_path); |
|
| 538 | + if (file_exists($img_path)) { |
|
| 539 | + unlink($img_path); |
|
| 540 | + } |
|
| 528 | 541 | } |
| 529 | 542 | |
| 530 | 543 | update_option($value['id'], ''); |
@@ -540,8 +553,10 @@ discard block |
||
| 540 | 553 | foreach ($uploadedfile as $key => $uplaod): |
| 541 | 554 | if ($key == 'name'): |
| 542 | 555 | $uplaods[$key] = $filename; |
| 543 | - else : |
|
| 544 | - $uplaods[$key] = $uplaod; |
|
| 556 | + else { |
|
| 557 | + : |
|
| 558 | + $uplaods[$key] = $uplaod; |
|
| 559 | + } |
|
| 545 | 560 | endif; |
| 546 | 561 | endforeach; |
| 547 | 562 | |
@@ -551,8 +566,9 @@ discard block |
||
| 551 | 566 | $image_name_arr = explode('/', get_option($value['id']));
|
| 552 | 567 | $noimg_name = end($image_name_arr); |
| 553 | 568 | $img_path = $uploads['path'] . '/' . $noimg_name; |
| 554 | - if (file_exists($img_path)) |
|
| 555 | - unlink($img_path); |
|
| 569 | + if (file_exists($img_path)) { |
|
| 570 | + unlink($img_path); |
|
| 571 | + } |
|
| 556 | 572 | } |
| 557 | 573 | |
| 558 | 574 | $upload_overrides = array('test_form' => false);
|
@@ -567,10 +583,12 @@ discard block |
||
| 567 | 583 | endif; |
| 568 | 584 | |
| 569 | 585 | |
| 570 | - else : |
|
| 586 | + else { |
|
| 587 | + : |
|
| 571 | 588 | // same menu setting per theme. |
| 572 | 589 | if (isset($value['id']) && $value['id'] == 'geodir_theme_location_nav' && isset($_POST[$value['id']])) {
|
| 573 | - $theme = wp_get_theme(); |
|
| 590 | + $theme = wp_get_theme(); |
|
| 591 | + } |
|
| 574 | 592 | update_option('geodir_theme_location_nav_' . $theme->name, $_POST[$value['id']]);
|
| 575 | 593 | } |
| 576 | 594 | |
@@ -582,8 +600,9 @@ discard block |
||
| 582 | 600 | |
| 583 | 601 | endif; |
| 584 | 602 | } |
| 585 | - if ($dummy) |
|
| 586 | - $_POST = array(); |
|
| 603 | + if ($dummy) { |
|
| 604 | + $_POST = array(); |
|
| 605 | + } |
|
| 587 | 606 | return true; |
| 588 | 607 | |
| 589 | 608 | } |
@@ -729,9 +748,12 @@ discard block |
||
| 729 | 748 | $new_columns = array('location' => __('Location (ID)', 'geodirectory'),
|
| 730 | 749 | 'categorys' => __('Categories', 'geodirectory'));
|
| 731 | 750 | |
| 732 | - if (($offset = array_search('author', array_keys($columns))) === false) // if the key doesn't exist
|
|
| 751 | + if (($offset = array_search('author', array_keys($columns))) === false) { |
|
| 752 | + // if the key doesn't exist |
|
| 733 | 753 | {
|
| 734 | - $offset = 0; // should we prepend $array with $data? |
|
| 754 | + $offset = 0; |
|
| 755 | + } |
|
| 756 | + // should we prepend $array with $data? |
|
| 735 | 757 | $offset = count($columns); // or should we append $array with $data? lets pick this one... |
| 736 | 758 | } |
| 737 | 759 | |
@@ -791,11 +813,13 @@ discard block |
||
| 791 | 813 | $date_diff_text = '<br /><span class="' . $expire_class . '">(' . $date_diff . ' ' . $state . ')</span>';
|
| 792 | 814 | } |
| 793 | 815 | /* If no expire_date is found, output a default message. */ |
| 794 | - if (empty($expire_date)) |
|
| 795 | - echo __('Unknown', 'geodirectory');
|
|
| 816 | + if (empty($expire_date)) { |
|
| 817 | + echo __('Unknown', 'geodirectory'); |
|
| 818 | + } |
|
| 796 | 819 | /* If there is a expire_date, append 'days left' to the text string. */ |
| 797 | - else |
|
| 798 | - echo $expire_date . $date_diff_text; |
|
| 820 | + else { |
|
| 821 | + echo $expire_date . $date_diff_text; |
|
| 822 | + } |
|
| 799 | 823 | break; |
| 800 | 824 | |
| 801 | 825 | /* If displaying the 'categorys' column. */ |
@@ -868,21 +892,26 @@ discard block |
||
| 868 | 892 | |
| 869 | 893 | $geodir_posttypes = geodir_get_posttypes(); |
| 870 | 894 | |
| 871 | - if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
|
|
| 872 | - return; |
|
| 895 | + if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { |
|
| 896 | + return; |
|
| 897 | + } |
|
| 873 | 898 | |
| 874 | 899 | if (!wp_is_post_revision($post_id) && isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)) {
|
| 875 | - if (isset($_REQUEST['_status'])) |
|
| 876 | - geodir_change_post_status($post_id, $_REQUEST['_status']); |
|
| 900 | + if (isset($_REQUEST['_status'])) { |
|
| 901 | + geodir_change_post_status($post_id, $_REQUEST['_status']); |
|
| 902 | + } |
|
| 877 | 903 | |
| 878 | - if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'trash' || $_REQUEST['action'] == 'untrash')) |
|
| 879 | - return; |
|
| 904 | + if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'trash' || $_REQUEST['action'] == 'untrash')) { |
|
| 905 | + return; |
|
| 906 | + } |
|
| 880 | 907 | |
| 881 | - if (!isset($_POST['geodir_post_info_noncename']) || !wp_verify_nonce($_POST['geodir_post_info_noncename'], plugin_basename(__FILE__))) |
|
| 882 | - return; |
|
| 908 | + if (!isset($_POST['geodir_post_info_noncename']) || !wp_verify_nonce($_POST['geodir_post_info_noncename'], plugin_basename(__FILE__))) { |
|
| 909 | + return; |
|
| 910 | + } |
|
| 883 | 911 | |
| 884 | - if (!isset($_POST['geodir_post_attachments_noncename']) || !wp_verify_nonce($_POST['geodir_post_attachments_noncename'], plugin_basename(__FILE__))) |
|
| 885 | - return; |
|
| 912 | + if (!isset($_POST['geodir_post_attachments_noncename']) || !wp_verify_nonce($_POST['geodir_post_attachments_noncename'], plugin_basename(__FILE__))) { |
|
| 913 | + return; |
|
| 914 | + } |
|
| 886 | 915 | |
| 887 | 916 | geodir_save_listing($_REQUEST); |
| 888 | 917 | } |
@@ -907,10 +936,18 @@ discard block |
||
| 907 | 936 | $tab_id = ''; |
| 908 | 937 | $i = 0; |
| 909 | 938 | foreach ($options as $value) : |
| 910 | - if (!isset($value['name'])) $value['name'] = ''; |
|
| 911 | - if (!isset($value['class'])) $value['class'] = ''; |
|
| 912 | - if (!isset($value['css'])) $value['css'] = ''; |
|
| 913 | - if (!isset($value['std'])) $value['std'] = ''; |
|
| 939 | + if (!isset($value['name'])) { |
|
| 940 | + $value['name'] = ''; |
|
| 941 | + } |
|
| 942 | + if (!isset($value['class'])) { |
|
| 943 | + $value['class'] = ''; |
|
| 944 | + } |
|
| 945 | + if (!isset($value['css'])) { |
|
| 946 | + $value['css'] = ''; |
|
| 947 | + } |
|
| 948 | + if (!isset($value['std'])) { |
|
| 949 | + $value['std'] = ''; |
|
| 950 | + } |
|
| 914 | 951 | $desc = ''; |
| 915 | 952 | switch ($value['type']) : |
| 916 | 953 | case 'dummy_installer': |
@@ -926,11 +963,13 @@ discard block |
||
| 926 | 963 | |
| 927 | 964 | $i++; |
| 928 | 965 | |
| 929 | - if (isset($value['id']) && $value['id']) |
|
| 930 | - $tab_id = $value['id']; |
|
| 966 | + if (isset($value['id']) && $value['id']) { |
|
| 967 | + $tab_id = $value['id']; |
|
| 968 | + } |
|
| 931 | 969 | |
| 932 | - if (isset($value['desc']) && $value['desc']) |
|
| 933 | - $desc = '<span style=" text-transform:none;">:- ' . $value['desc'] . '</span>'; |
|
| 970 | + if (isset($value['desc']) && $value['desc']) { |
|
| 971 | + $desc = '<span style=" text-transform:none;">:- ' . $value['desc'] . '</span>'; |
|
| 972 | + } |
|
| 934 | 973 | |
| 935 | 974 | if (isset($value['name']) && $value['name']) {
|
| 936 | 975 | if ($first_title === true) {
|
@@ -961,10 +1000,12 @@ discard block |
||
| 961 | 1000 | break; |
| 962 | 1001 | |
| 963 | 1002 | case 'sectionstart': |
| 964 | - if (isset($value['desc']) && $value['desc']) |
|
| 965 | - $desc = '<span style=" text-transform:none;"> - ' . $value['desc'] . '</span>'; |
|
| 966 | - if (isset($value['name']) && $value['name']) |
|
| 967 | - echo '<h3>' . $value['name'] . $desc . '</h3>'; |
|
| 1003 | + if (isset($value['desc']) && $value['desc']) { |
|
| 1004 | + $desc = '<span style=" text-transform:none;"> - ' . $value['desc'] . '</span>'; |
|
| 1005 | + } |
|
| 1006 | + if (isset($value['name']) && $value['name']) { |
|
| 1007 | + echo '<h3>' . $value['name'] . $desc . '</h3>'; |
|
| 1008 | + } |
|
| 968 | 1009 | /** |
| 969 | 1010 | * Called after a GeoDirectory settings sectionstart is output in the GD settings page. |
| 970 | 1011 | * |
@@ -972,7 +1013,9 @@ discard block |
||
| 972 | 1013 | * |
| 973 | 1014 | * @since 1.0.0 |
| 974 | 1015 | */ |
| 975 | - if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_start');
|
|
| 1016 | + if (isset($value['id']) && $value['id']) { |
|
| 1017 | + do_action('geodir_settings_' . sanitize_title($value['id']) . '_start'); |
|
| 1018 | + } |
|
| 976 | 1019 | echo '<table class="form-table">' . "\n\n"; |
| 977 | 1020 | |
| 978 | 1021 | break; |
@@ -984,7 +1027,9 @@ discard block |
||
| 984 | 1027 | * |
| 985 | 1028 | * @since 1.0.0 |
| 986 | 1029 | */ |
| 987 | - if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_end');
|
|
| 1030 | + if (isset($value['id']) && $value['id']) { |
|
| 1031 | + do_action('geodir_settings_' . sanitize_title($value['id']) . '_end'); |
|
| 1032 | + } |
|
| 988 | 1033 | echo '</table>'; |
| 989 | 1034 | /** |
| 990 | 1035 | * Called after a GeoDirectory settings sectionend is output in the GD settings page. |
@@ -993,7 +1038,9 @@ discard block |
||
| 993 | 1038 | * |
| 994 | 1039 | * @since 1.0.0 |
| 995 | 1040 | */ |
| 996 | - if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_after');
|
|
| 1041 | + if (isset($value['id']) && $value['id']) { |
|
| 1042 | + do_action('geodir_settings_' . sanitize_title($value['id']) . '_after'); |
|
| 1043 | + } |
|
| 997 | 1044 | break; |
| 998 | 1045 | case 'text': |
| 999 | 1046 | ?> |
@@ -1065,17 +1112,32 @@ discard block |
||
| 1065 | 1112 | <?php _e('Width', 'geodirectory'); ?> <input
|
| 1066 | 1113 | name="<?php echo esc_attr($value['id']); ?>_width" |
| 1067 | 1114 | id="<?php echo esc_attr($value['id']); ?>_width" type="text" size="3" |
| 1068 | - value="<?php if ($size = get_option($value['id'] . '_width')) echo stripslashes($size); else echo $value['std']; ?>"/> |
|
| 1115 | + value="<?php if ($size = get_option($value['id'] . '_width')) { |
|
| 1116 | + echo stripslashes($size); |
|
| 1117 | +} else { |
|
| 1118 | + echo $value['std']; |
|
| 1119 | +} |
|
| 1120 | +?>"/> |
|
| 1069 | 1121 | |
| 1070 | 1122 | <?php _e('Height', 'geodirectory'); ?> <input
|
| 1071 | 1123 | name="<?php echo esc_attr($value['id']); ?>_height" |
| 1072 | 1124 | id="<?php echo esc_attr($value['id']); ?>_height" type="text" size="3" |
| 1073 | - value="<?php if ($size = get_option($value['id'] . '_height')) echo stripslashes($size); else echo $value['std']; ?>"/> |
|
| 1125 | + value="<?php if ($size = get_option($value['id'] . '_height')) { |
|
| 1126 | + echo stripslashes($size); |
|
| 1127 | +} else { |
|
| 1128 | + echo $value['std']; |
|
| 1129 | +} |
|
| 1130 | +?>"/> |
|
| 1074 | 1131 | |
| 1075 | 1132 | <label><?php _e('Hard Crop', 'geodirectory'); ?> <input
|
| 1076 | 1133 | name="<?php echo esc_attr($value['id']); ?>_crop" |
| 1077 | 1134 | id="<?php echo esc_attr($value['id']); ?>_crop" |
| 1078 | - type="checkbox" <?php if (get_option($value['id'] . '_crop') != '') checked(get_option($value['id'] . '_crop'), 1); else checked(1); ?> /></label> |
|
| 1135 | + type="checkbox" <?php if (get_option($value['id'] . '_crop') != '') { |
|
| 1136 | + checked(get_option($value['id'] . '_crop'), 1); |
|
| 1137 | +} else { |
|
| 1138 | + checked(1); |
|
| 1139 | +} |
|
| 1140 | +?> /></label> |
|
| 1079 | 1141 | |
| 1080 | 1142 | <span class="description"><?php echo $value['desc'] ?></span></td> |
| 1081 | 1143 | </tr><?php |
@@ -1089,17 +1151,22 @@ discard block |
||
| 1089 | 1151 | <td class="forminp"><select name="<?php echo esc_attr($value['id']); ?>" |
| 1090 | 1152 | id="<?php echo esc_attr($value['id']); ?>" |
| 1091 | 1153 | style="<?php echo esc_attr($value['css']); ?>" |
| 1092 | - class="<?php if (isset($value['class'])) echo $value['class']; ?>" |
|
| 1154 | + class="<?php if (isset($value['class'])) { |
|
| 1155 | + echo $value['class']; |
|
| 1156 | +} |
|
| 1157 | +?>" |
|
| 1093 | 1158 | option-ajaxchosen="false"> |
| 1094 | 1159 | <?php |
| 1095 | 1160 | foreach ($value['options'] as $key => $val) {
|
| 1096 | 1161 | $geodir_select_value = ''; |
| 1097 | 1162 | if ($option_value != '') {
|
| 1098 | - if ($option_value != '' && $option_value == $key) |
|
| 1099 | - $geodir_select_value = ' selected="selected" '; |
|
| 1163 | + if ($option_value != '' && $option_value == $key) { |
|
| 1164 | + $geodir_select_value = ' selected="selected" '; |
|
| 1165 | + } |
|
| 1100 | 1166 | } else {
|
| 1101 | - if ($value['std'] == $key) |
|
| 1102 | - $geodir_select_value = ' selected="selected" '; |
|
| 1167 | + if ($value['std'] == $key) { |
|
| 1168 | + $geodir_select_value = ' selected="selected" '; |
|
| 1169 | + } |
|
| 1103 | 1170 | } |
| 1104 | 1171 | ?> |
| 1105 | 1172 | <option |
@@ -1124,8 +1191,14 @@ discard block |
||
| 1124 | 1191 | <td class="forminp"><select multiple="multiple" name="<?php echo esc_attr($value['id']); ?>[]" |
| 1125 | 1192 | id="<?php echo esc_attr($value['id']); ?>" |
| 1126 | 1193 | style="<?php echo esc_attr($value['css']); ?>" |
| 1127 | - class="<?php if (isset($value['class'])) echo $value['class']; ?>" |
|
| 1128 | - data-placeholder="<?php if (isset($value['placeholder_text'])) echo $value['placeholder_text'];?>" |
|
| 1194 | + class="<?php if (isset($value['class'])) { |
|
| 1195 | + echo $value['class']; |
|
| 1196 | +} |
|
| 1197 | +?>" |
|
| 1198 | + data-placeholder="<?php if (isset($value['placeholder_text'])) { |
|
| 1199 | + echo $value['placeholder_text']; |
|
| 1200 | +} |
|
| 1201 | +?>" |
|
| 1129 | 1202 | option-ajaxchosen="false"> |
| 1130 | 1203 | <?php |
| 1131 | 1204 | foreach ($value['options'] as $key => $val) {
|
@@ -1152,7 +1225,10 @@ discard block |
||
| 1152 | 1225 | <td class="forminp"> |
| 1153 | 1226 | <input type="file" name="<?php echo esc_attr($value['id']); ?>" |
| 1154 | 1227 | id="<?php echo esc_attr($value['id']); ?>" style="<?php echo esc_attr($value['css']); ?>" |
| 1155 | - class="<?php if (isset($value['class'])) echo $value['class']; ?>"/> |
|
| 1228 | + class="<?php if (isset($value['class'])) { |
|
| 1229 | + echo $value['class']; |
|
| 1230 | +} |
|
| 1231 | +?>"/> |
|
| 1156 | 1232 | <?php if (get_option($value['id'])) { ?>
|
| 1157 | 1233 | <input type="hidden" name="<?php echo esc_attr($value['id']); ?>_remove" |
| 1158 | 1234 | id="<?php echo esc_attr($value['id']); ?>_remove" value="0"> |
@@ -1233,13 +1309,15 @@ discard block |
||
| 1233 | 1309 | 'zh-TW' => __('CHINESE (TRADITIONAL)', 'geodirectory'),
|
| 1234 | 1310 | ); |
| 1235 | 1311 | $geodir_default_map_language = get_option('geodir_default_map_language');
|
| 1236 | - if (empty($geodir_default_map_language)) |
|
| 1237 | - $geodir_default_map_language = 'en'; |
|
| 1312 | + if (empty($geodir_default_map_language)) { |
|
| 1313 | + $geodir_default_map_language = 'en'; |
|
| 1314 | + } |
|
| 1238 | 1315 | foreach ($arr_map_langages as $language_key => $language_txt) {
|
| 1239 | - if (!empty($geodir_default_map_language) && $language_key == $geodir_default_map_language) |
|
| 1240 | - $geodir_default_language_selected = "selected='selected'"; |
|
| 1241 | - else |
|
| 1242 | - $geodir_default_language_selected = ''; |
|
| 1316 | + if (!empty($geodir_default_map_language) && $language_key == $geodir_default_map_language) { |
|
| 1317 | + $geodir_default_language_selected = "selected='selected'"; |
|
| 1318 | + } else { |
|
| 1319 | + $geodir_default_language_selected = ''; |
|
| 1320 | + } |
|
| 1243 | 1321 | |
| 1244 | 1322 | ?> |
| 1245 | 1323 | <option |
@@ -1259,14 +1337,16 @@ discard block |
||
| 1259 | 1337 | <?php |
| 1260 | 1338 | $post_types = geodir_get_posttypes('array');
|
| 1261 | 1339 | $geodir_default_map_search_pt = get_option('geodir_default_map_search_pt');
|
| 1262 | - if (empty($geodir_default_map_search_pt)) |
|
| 1263 | - $geodir_default_map_search_pt = 'gd_place'; |
|
| 1340 | + if (empty($geodir_default_map_search_pt)) { |
|
| 1341 | + $geodir_default_map_search_pt = 'gd_place'; |
|
| 1342 | + } |
|
| 1264 | 1343 | if (is_array($post_types)) {
|
| 1265 | 1344 | foreach ($post_types as $key => $post_types_obj) {
|
| 1266 | - if (!empty($geodir_default_map_search_pt) && $key == $geodir_default_map_search_pt) |
|
| 1267 | - $geodir_search_pt_selected = "selected='selected'"; |
|
| 1268 | - else |
|
| 1269 | - $geodir_search_pt_selected = ''; |
|
| 1345 | + if (!empty($geodir_default_map_search_pt) && $key == $geodir_default_map_search_pt) { |
|
| 1346 | + $geodir_search_pt_selected = "selected='selected'"; |
|
| 1347 | + } else { |
|
| 1348 | + $geodir_search_pt_selected = ''; |
|
| 1349 | + } |
|
| 1270 | 1350 | |
| 1271 | 1351 | ?> |
| 1272 | 1352 | <option |
@@ -1386,7 +1466,7 @@ discard block |
||
| 1386 | 1466 | id="<?php echo esc_attr($value['id'] . $value['value']); ?>" type="radio" |
| 1387 | 1467 | value="<?php echo $value['value'] ?>" <?php if (get_option($value['id']) == $value['value']) {
|
| 1388 | 1468 | echo 'checked="checked"'; |
| 1389 | - }elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
|
|
| 1469 | + } elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
|
|
| 1390 | 1470 | <?php echo $value['desc']; ?></label><br> |
| 1391 | 1471 | </fieldset> |
| 1392 | 1472 | <?php |
@@ -1406,10 +1486,18 @@ discard block |
||
| 1406 | 1486 | <th scope="row" class="titledesc"><?php echo $value['name'] ?></th> |
| 1407 | 1487 | <td class="forminp"> |
| 1408 | 1488 | <textarea |
| 1409 | - <?php if (isset($value['args'])) echo $value['args'] . ' '; ?>name="<?php echo esc_attr($value['id']); ?>" |
|
| 1489 | + <?php if (isset($value['args'])) { |
|
| 1490 | + echo $value['args'] . ' '; |
|
| 1491 | +} |
|
| 1492 | +?>name="<?php echo esc_attr($value['id']); ?>" |
|
| 1410 | 1493 | id="<?php echo esc_attr($value['id']); ?>" |
| 1411 | 1494 | <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
|
| 1412 | - 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 |
|
| 1495 | + style="<?php echo esc_attr($value['css']); ?>"><?php if (get_option($value['id'])) { |
|
| 1496 | + echo esc_textarea(stripslashes(get_option($value['id']))); |
|
| 1497 | +} else { |
|
| 1498 | + echo esc_textarea($value['std']); |
|
| 1499 | +} |
|
| 1500 | +?></textarea><span |
|
| 1413 | 1501 | class="description"><?php echo $value['desc'] ?></span> |
| 1414 | 1502 | |
| 1415 | 1503 | </td> |
@@ -1421,10 +1509,11 @@ discard block |
||
| 1421 | 1509 | <tr valign="top"> |
| 1422 | 1510 | <th scope="row" class="titledesc"><?php echo $value['name'] ?></th> |
| 1423 | 1511 | <td class="forminp"><?php |
| 1424 | - if (get_option($value['id'])) |
|
| 1425 | - $content = stripslashes(get_option($value['id'])); |
|
| 1426 | - else |
|
| 1427 | - $content = $value['std']; |
|
| 1512 | + if (get_option($value['id'])) { |
|
| 1513 | + $content = stripslashes(get_option($value['id'])); |
|
| 1514 | + } else { |
|
| 1515 | + $content = $value['std']; |
|
| 1516 | + } |
|
| 1428 | 1517 | |
| 1429 | 1518 | $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
|
| 1430 | 1519 | |
@@ -1464,7 +1553,9 @@ discard block |
||
| 1464 | 1553 | 'echo' => false, |
| 1465 | 1554 | 'selected' => $page_setting); |
| 1466 | 1555 | |
| 1467 | - if (isset($value['args'])) $args = wp_parse_args($value['args'], $args); |
|
| 1556 | + if (isset($value['args'])) { |
|
| 1557 | + $args = wp_parse_args($value['args'], $args); |
|
| 1558 | + } |
|
| 1468 | 1559 | |
| 1469 | 1560 | ?> |
| 1470 | 1561 | <tr valign="top" class="single_select_page"> |
@@ -1483,8 +1574,10 @@ discard block |
||
| 1483 | 1574 | if (strstr($country_setting, ':')) : |
| 1484 | 1575 | $country = current(explode(':', $country_setting));
|
| 1485 | 1576 | $state = end(explode(':', $country_setting));
|
| 1486 | - else : |
|
| 1487 | - $country = $country_setting; |
|
| 1577 | + else { |
|
| 1578 | + : |
|
| 1579 | + $country = $country_setting; |
|
| 1580 | + } |
|
| 1488 | 1581 | $state = '*'; |
| 1489 | 1582 | endif; |
| 1490 | 1583 | ?> |
@@ -1511,8 +1604,10 @@ discard block |
||
| 1511 | 1604 | data-placeholder="<?php _e('Choose countries…', 'geodirectory'); ?>"
|
| 1512 | 1605 | title="Country" class="chosen_select"> |
| 1513 | 1606 | <?php |
| 1514 | - if ($countries) foreach ($countries as $key => $val) : |
|
| 1515 | - echo '<option value="' . $key . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>'; |
|
| 1607 | + if ($countries) { |
|
| 1608 | + foreach ($countries as $key => $val) : |
|
| 1609 | + echo '<option value="' . $key . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>'; |
|
| 1610 | + } |
|
| 1516 | 1611 | endforeach; |
| 1517 | 1612 | ?> |
| 1518 | 1613 | </select> |
@@ -1763,8 +1858,9 @@ discard block |
||
| 1763 | 1858 | endforeach; |
| 1764 | 1859 | endif; |
| 1765 | 1860 | |
| 1766 | - if (!empty($place_img_array)) |
|
| 1767 | - $curImages = implode(',', $place_img_array);
|
|
| 1861 | + if (!empty($place_img_array)) { |
|
| 1862 | + $curImages = implode(',', $place_img_array); |
|
| 1863 | + } |
|
| 1768 | 1864 | |
| 1769 | 1865 | |
| 1770 | 1866 | // adjust values here |
@@ -2110,16 +2206,17 @@ discard block |
||
| 2110 | 2206 | global $post, $typenow, $current_screen; |
| 2111 | 2207 | |
| 2112 | 2208 | $post_type = NULL; |
| 2113 | - if (isset($_REQUEST['post']) && get_post_type($_REQUEST['post'])) |
|
| 2114 | - $post_type = get_post_type($_REQUEST['post']); |
|
| 2115 | - elseif ($post && isset($post->post_type)) |
|
| 2116 | - $post_type = $post->post_type; |
|
| 2117 | - elseif ($typenow) |
|
| 2118 | - $post_type = $typenow; |
|
| 2119 | - elseif ($current_screen && isset($current_screen->post_type)) |
|
| 2120 | - $post_type = $current_screen->post_type; |
|
| 2121 | - elseif (isset($_REQUEST['post_type'])) |
|
| 2122 | - $post_type = sanitize_key($_REQUEST['post_type']); |
|
| 2209 | + if (isset($_REQUEST['post']) && get_post_type($_REQUEST['post'])) { |
|
| 2210 | + $post_type = get_post_type($_REQUEST['post']); |
|
| 2211 | + } elseif ($post && isset($post->post_type)) { |
|
| 2212 | + $post_type = $post->post_type; |
|
| 2213 | + } elseif ($typenow) { |
|
| 2214 | + $post_type = $typenow; |
|
| 2215 | + } elseif ($current_screen && isset($current_screen->post_type)) { |
|
| 2216 | + $post_type = $current_screen->post_type; |
|
| 2217 | + } elseif (isset($_REQUEST['post_type'])) { |
|
| 2218 | + $post_type = sanitize_key($_REQUEST['post_type']); |
|
| 2219 | + } |
|
| 2123 | 2220 | |
| 2124 | 2221 | |
| 2125 | 2222 | return $post_type; |
@@ -2179,9 +2276,10 @@ discard block |
||
| 2179 | 2276 | function geodir_hide_admin_preview_button() {
|
| 2180 | 2277 | global $post_type; |
| 2181 | 2278 | $post_types = geodir_get_posttypes(); |
| 2182 | - if(in_array($post_type, $post_types)) |
|
| 2183 | - echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
|
|
| 2184 | -} |
|
| 2279 | + if(in_array($post_type, $post_types)) { |
|
| 2280 | + echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>'; |
|
| 2281 | + } |
|
| 2282 | + } |
|
| 2185 | 2283 | add_action( 'admin_head-post-new.php', 'geodir_hide_admin_preview_button' ); |
| 2186 | 2284 | add_action( 'admin_head-post.php', 'geodir_hide_admin_preview_button' ); |
| 2187 | 2285 | |
@@ -5383,8 +5481,9 @@ discard block |
||
| 5383 | 5481 | function geodir_get_export_posts( $post_type, $per_page = 0, $page_no = 0 ) {
|
| 5384 | 5482 | global $wpdb, $plugin_prefix; |
| 5385 | 5483 | |
| 5386 | - if ( ! post_type_exists( $post_type ) ) |
|
| 5387 | - return new stdClass; |
|
| 5484 | + if ( ! post_type_exists( $post_type ) ) { |
|
| 5485 | + return new stdClass; |
|
| 5486 | + } |
|
| 5388 | 5487 | |
| 5389 | 5488 | $table = $plugin_prefix . $post_type . '_detail'; |
| 5390 | 5489 | |
@@ -6219,7 +6318,9 @@ discard block |
||
| 6219 | 6318 | |
| 6220 | 6319 | if ($page_found) : |
| 6221 | 6320 | // Page exists |
| 6222 | - if (!$option_value) update_option($option, $page_found); |
|
| 6321 | + if (!$option_value) { |
|
| 6322 | + update_option($option, $page_found); |
|
| 6323 | + } |
|
| 6223 | 6324 | return; |
| 6224 | 6325 | endif; |
| 6225 | 6326 | |
@@ -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 | |
@@ -122,19 +122,19 @@ discard block |
||
| 122 | 122 | * @package GeoDirectory |
| 123 | 123 | */ |
| 124 | 124 | function geodir_error_log($log){
|
| 125 | - /* |
|
| 125 | + /* |
|
| 126 | 126 | * A filter to override the WP_DEBUG setting for function geodir_error_log(). |
| 127 | 127 | * |
| 128 | 128 | * @since 1.5.7 |
| 129 | 129 | */ |
| 130 | - $should_log = apply_filters( 'geodir_log_errors', WP_DEBUG); |
|
| 131 | - if ( true === $should_log ) {
|
|
| 132 | - if ( is_array( $log ) || is_object( $log ) ) {
|
|
| 133 | - error_log( print_r( $log, true ) ); |
|
| 134 | - } else {
|
|
| 135 | - error_log( $log ); |
|
| 136 | - } |
|
| 137 | - } |
|
| 130 | + $should_log = apply_filters( 'geodir_log_errors', WP_DEBUG); |
|
| 131 | + if ( true === $should_log ) {
|
|
| 132 | + if ( is_array( $log ) || is_object( $log ) ) {
|
|
| 133 | + error_log( print_r( $log, true ) ); |
|
| 134 | + } else {
|
|
| 135 | + error_log( $log ); |
|
| 136 | + } |
|
| 137 | + } |
|
| 138 | 138 | } |
| 139 | 139 | /** |
| 140 | 140 | * Include all plugin functions. |
@@ -173,66 +173,66 @@ discard block |
||
| 173 | 173 | */ |
| 174 | 174 | if (is_admin() || defined( 'GD_TESTING_MODE' )) {
|
| 175 | 175 | |
| 176 | - /** |
|
| 177 | - * Include functions used in admin area only. |
|
| 178 | - * |
|
| 179 | - * @since 1.0.0 |
|
| 180 | - */ |
|
| 181 | - require_once('geodirectory-admin/admin_functions.php');
|
|
| 182 | - /** |
|
| 183 | - * Most actions/hooks used in admin area only are called from here. |
|
| 184 | - * |
|
| 185 | - * @since 1.6.11 |
|
| 186 | - */ |
|
| 187 | - require_once('geodirectory-admin/admin_dummy_data_functions.php');
|
|
| 188 | - /** |
|
| 189 | - * Most actions/hooks used in admin area only are called from here. |
|
| 190 | - * |
|
| 191 | - * @since 1.0.0 |
|
| 192 | - */ |
|
| 193 | - require_once('geodirectory-admin/admin_hooks_actions.php');
|
|
| 194 | - /** |
|
| 195 | - * Most admin JS and CSS is called from here. |
|
| 196 | - * |
|
| 197 | - * @since 1.0.0 |
|
| 198 | - */ |
|
| 199 | - require_once('geodirectory-admin/admin_template_tags.php');
|
|
| 200 | - /** |
|
| 201 | - * Include any functions needed for upgrades. |
|
| 202 | - * |
|
| 203 | - * @since 1.0.0 |
|
| 204 | - */ |
|
| 205 | - require_once(geodir_plugin_path() . '/upgrade.php'); |
|
| 206 | - if (get_option('geodir_installed') != 1) {
|
|
| 207 | - /** |
|
| 208 | - * Define language constants, here as they are not loaded yet. |
|
| 209 | - * |
|
| 210 | - * @since 1.0.0 |
|
| 211 | - */ |
|
| 212 | - require_once(geodir_plugin_path() . '/language.php'); |
|
| 213 | - /** |
|
| 214 | - * Include the plugin install file that sets up the databases and any options on first run. |
|
| 215 | - * |
|
| 216 | - * @since 1.0.0 |
|
| 217 | - */ |
|
| 218 | - require_once('geodirectory-admin/admin_install.php');
|
|
| 219 | - register_activation_hook(__FILE__, 'geodir_activation'); |
|
| 220 | - } |
|
| 221 | - register_deactivation_hook(__FILE__, 'geodir_deactivation'); |
|
| 222 | - |
|
| 223 | - /* |
|
| 176 | + /** |
|
| 177 | + * Include functions used in admin area only. |
|
| 178 | + * |
|
| 179 | + * @since 1.0.0 |
|
| 180 | + */ |
|
| 181 | + require_once('geodirectory-admin/admin_functions.php');
|
|
| 182 | + /** |
|
| 183 | + * Most actions/hooks used in admin area only are called from here. |
|
| 184 | + * |
|
| 185 | + * @since 1.6.11 |
|
| 186 | + */ |
|
| 187 | + require_once('geodirectory-admin/admin_dummy_data_functions.php');
|
|
| 188 | + /** |
|
| 189 | + * Most actions/hooks used in admin area only are called from here. |
|
| 190 | + * |
|
| 191 | + * @since 1.0.0 |
|
| 192 | + */ |
|
| 193 | + require_once('geodirectory-admin/admin_hooks_actions.php');
|
|
| 194 | + /** |
|
| 195 | + * Most admin JS and CSS is called from here. |
|
| 196 | + * |
|
| 197 | + * @since 1.0.0 |
|
| 198 | + */ |
|
| 199 | + require_once('geodirectory-admin/admin_template_tags.php');
|
|
| 200 | + /** |
|
| 201 | + * Include any functions needed for upgrades. |
|
| 202 | + * |
|
| 203 | + * @since 1.0.0 |
|
| 204 | + */ |
|
| 205 | + require_once(geodir_plugin_path() . '/upgrade.php'); |
|
| 206 | + if (get_option('geodir_installed') != 1) {
|
|
| 207 | + /** |
|
| 208 | + * Define language constants, here as they are not loaded yet. |
|
| 209 | + * |
|
| 210 | + * @since 1.0.0 |
|
| 211 | + */ |
|
| 212 | + require_once(geodir_plugin_path() . '/language.php'); |
|
| 213 | + /** |
|
| 214 | + * Include the plugin install file that sets up the databases and any options on first run. |
|
| 215 | + * |
|
| 216 | + * @since 1.0.0 |
|
| 217 | + */ |
|
| 218 | + require_once('geodirectory-admin/admin_install.php');
|
|
| 219 | + register_activation_hook(__FILE__, 'geodir_activation'); |
|
| 220 | + } |
|
| 221 | + register_deactivation_hook(__FILE__, 'geodir_deactivation'); |
|
| 222 | + |
|
| 223 | + /* |
|
| 224 | 224 | * Show a upgrade warning message if applicable. |
| 225 | 225 | * |
| 226 | 226 | * @since 1.5.6 |
| 227 | 227 | */ |
| 228 | - global $pagenow; |
|
| 228 | + global $pagenow; |
|
| 229 | 229 | if ( 'plugins.php' === $pagenow ) |
| 230 | - {
|
|
| 231 | - // Better update message |
|
| 232 | - $file = basename( __FILE__ ); |
|
| 233 | - $folder = basename( dirname( __FILE__ ) ); |
|
| 234 | - $hook = "in_plugin_update_message-{$folder}/{$file}";
|
|
| 235 | - add_action( $hook, 'geodire_admin_upgrade_notice', 20, 2 ); |
|
| 236 | - } |
|
| 230 | + {
|
|
| 231 | + // Better update message |
|
| 232 | + $file = basename( __FILE__ ); |
|
| 233 | + $folder = basename( dirname( __FILE__ ) ); |
|
| 234 | + $hook = "in_plugin_update_message-{$folder}/{$file}";
|
|
| 235 | + add_action( $hook, 'geodire_admin_upgrade_notice', 20, 2 ); |
|
| 236 | + } |
|
| 237 | 237 | |
| 238 | 238 | } |
@@ -10,47 +10,47 @@ discard block |
||
| 10 | 10 | global $wpdb; |
| 11 | 11 | |
| 12 | 12 | if (get_option('geodirectory' . '_db_version') != GEODIRECTORY_VERSION) {
|
| 13 | - /** |
|
| 14 | - * Include custom database table related functions. |
|
| 15 | - * |
|
| 16 | - * @since 1.0.0 |
|
| 17 | - * @package GeoDirectory |
|
| 18 | - */ |
|
| 19 | - include_once('geodirectory-admin/admin_db_install.php');
|
|
| 20 | - add_action('plugins_loaded', 'geodirectory_upgrade_all', 10);
|
|
| 21 | - if (GEODIRECTORY_VERSION <= '1.3.6') {
|
|
| 22 | - add_action('plugins_loaded', 'geodir_upgrade_136', 11);
|
|
| 23 | - } |
|
| 13 | + /** |
|
| 14 | + * Include custom database table related functions. |
|
| 15 | + * |
|
| 16 | + * @since 1.0.0 |
|
| 17 | + * @package GeoDirectory |
|
| 18 | + */ |
|
| 19 | + include_once('geodirectory-admin/admin_db_install.php');
|
|
| 20 | + add_action('plugins_loaded', 'geodirectory_upgrade_all', 10);
|
|
| 21 | + if (GEODIRECTORY_VERSION <= '1.3.6') {
|
|
| 22 | + add_action('plugins_loaded', 'geodir_upgrade_136', 11);
|
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - if (GEODIRECTORY_VERSION <= '1.4.6') {
|
|
| 26 | - add_action('init', 'geodir_upgrade_146', 11);
|
|
| 27 | - } |
|
| 25 | + if (GEODIRECTORY_VERSION <= '1.4.6') {
|
|
| 26 | + add_action('init', 'geodir_upgrade_146', 11);
|
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | - if (GEODIRECTORY_VERSION <= '1.4.8') {
|
|
| 30 | - add_action('init', 'geodir_upgrade_148', 11);
|
|
| 31 | - } |
|
| 29 | + if (GEODIRECTORY_VERSION <= '1.4.8') {
|
|
| 30 | + add_action('init', 'geodir_upgrade_148', 11);
|
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - if (GEODIRECTORY_VERSION <= '1.5.0') {
|
|
| 34 | - add_action('init', 'geodir_upgrade_150', 11);
|
|
| 35 | - } |
|
| 33 | + if (GEODIRECTORY_VERSION <= '1.5.0') {
|
|
| 34 | + add_action('init', 'geodir_upgrade_150', 11);
|
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - if (GEODIRECTORY_VERSION <= '1.5.2') {
|
|
| 38 | - add_action('init', 'geodir_upgrade_152', 11);
|
|
| 39 | - } |
|
| 37 | + if (GEODIRECTORY_VERSION <= '1.5.2') {
|
|
| 38 | + add_action('init', 'geodir_upgrade_152', 11);
|
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - if (GEODIRECTORY_VERSION <= '1.5.3') {
|
|
| 42 | - add_action('init', 'geodir_upgrade_153', 11);
|
|
| 43 | - } |
|
| 41 | + if (GEODIRECTORY_VERSION <= '1.5.3') {
|
|
| 42 | + add_action('init', 'geodir_upgrade_153', 11);
|
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - if (GEODIRECTORY_VERSION <= '1.5.4') {
|
|
| 46 | - add_action('init', 'geodir_upgrade_154', 11);
|
|
| 47 | - } |
|
| 45 | + if (GEODIRECTORY_VERSION <= '1.5.4') {
|
|
| 46 | + add_action('init', 'geodir_upgrade_154', 11);
|
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | 49 | |
| 50 | 50 | |
| 51 | - add_action('init', 'gd_fix_cpt_rewrite_slug', 11);// this needs to be kept for a few versions
|
|
| 51 | + add_action('init', 'gd_fix_cpt_rewrite_slug', 11);// this needs to be kept for a few versions
|
|
| 52 | 52 | |
| 53 | - update_option('geodirectory' . '_db_version', GEODIRECTORY_VERSION);
|
|
| 53 | + update_option('geodirectory' . '_db_version', GEODIRECTORY_VERSION);
|
|
| 54 | 54 | |
| 55 | 55 | } |
| 56 | 56 | |
@@ -63,10 +63,10 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | function geodirectory_upgrade_all() |
| 65 | 65 | {
|
| 66 | - geodir_create_tables(); |
|
| 67 | - geodir_update_review_db(); |
|
| 68 | - gd_install_theme_compat(); |
|
| 69 | - gd_convert_custom_field_display(); |
|
| 66 | + geodir_create_tables(); |
|
| 67 | + geodir_update_review_db(); |
|
| 68 | + gd_install_theme_compat(); |
|
| 69 | + gd_convert_custom_field_display(); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | /** |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | function geodir_upgrade_136() |
| 79 | 79 | {
|
| 80 | - geodir_fix_review_overall_rating(); |
|
| 80 | + geodir_fix_review_overall_rating(); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | /** |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | * @package GeoDirectory |
| 88 | 88 | */ |
| 89 | 89 | function geodir_upgrade_146(){
|
| 90 | - gd_convert_virtual_pages(); |
|
| 90 | + gd_convert_virtual_pages(); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | /** |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | * @package GeoDirectory |
| 98 | 98 | */ |
| 99 | 99 | function geodir_upgrade_150(){
|
| 100 | - gd_fix_cpt_rewrite_slug(); |
|
| 100 | + gd_fix_cpt_rewrite_slug(); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | |
@@ -109,11 +109,11 @@ discard block |
||
| 109 | 109 | * @package GeoDirectory |
| 110 | 110 | */ |
| 111 | 111 | function geodir_upgrade_148(){
|
| 112 | - /* |
|
| 112 | + /* |
|
| 113 | 113 | * Blank the users google password if present as we now use oAuth 2.0 |
| 114 | 114 | */ |
| 115 | - update_option('geodir_ga_pass','');
|
|
| 116 | - update_option('geodir_ga_user','');
|
|
| 115 | + update_option('geodir_ga_pass','');
|
|
| 116 | + update_option('geodir_ga_user','');
|
|
| 117 | 117 | |
| 118 | 118 | } |
| 119 | 119 | |
@@ -125,8 +125,8 @@ discard block |
||
| 125 | 125 | * @package GeoDirectory |
| 126 | 126 | */ |
| 127 | 127 | function geodir_upgrade_153(){
|
| 128 | - geodir_create_page(esc_sql(_x('gd-info', 'page_slug', 'geodirectory')), 'geodir_info_page', __('Info', 'geodirectory'), '');
|
|
| 129 | - geodir_create_page(esc_sql(_x('gd-login', 'page_slug', 'geodirectory')), 'geodir_login_page', __('Login', 'geodirectory'), '');
|
|
| 128 | + geodir_create_page(esc_sql(_x('gd-info', 'page_slug', 'geodirectory')), 'geodir_info_page', __('Info', 'geodirectory'), '');
|
|
| 129 | + geodir_create_page(esc_sql(_x('gd-login', 'page_slug', 'geodirectory')), 'geodir_login_page', __('Login', 'geodirectory'), '');
|
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | /** |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | * @package GeoDirectory |
| 137 | 137 | */ |
| 138 | 138 | function geodir_upgrade_154(){
|
| 139 | - geodir_create_page(esc_sql(_x('gd-home', 'page_slug', 'geodirectory')), 'geodir_home_page', __('GD Home page', 'geodirectory'), '');
|
|
| 139 | + geodir_create_page(esc_sql(_x('gd-home', 'page_slug', 'geodirectory')), 'geodir_home_page', __('GD Home page', 'geodirectory'), '');
|
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | /** |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | * @package GeoDirectory |
| 147 | 147 | */ |
| 148 | 148 | function geodir_upgrade_152(){
|
| 149 | - gd_fix_address_detail_table_limit(); |
|
| 149 | + gd_fix_address_detail_table_limit(); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | |
@@ -162,12 +162,12 @@ discard block |
||
| 162 | 162 | */ |
| 163 | 163 | function geodir_update_review_db() |
| 164 | 164 | {
|
| 165 | - global $wpdb, $plugin_prefix; |
|
| 165 | + global $wpdb, $plugin_prefix; |
|
| 166 | 166 | |
| 167 | - geodir_fix_review_date(); |
|
| 168 | - geodir_fix_review_post_status(); |
|
| 169 | - geodir_fix_review_content(); |
|
| 170 | - geodir_fix_review_location(); |
|
| 167 | + geodir_fix_review_date(); |
|
| 168 | + geodir_fix_review_post_status(); |
|
| 169 | + geodir_fix_review_content(); |
|
| 170 | + geodir_fix_review_location(); |
|
| 171 | 171 | |
| 172 | 172 | } |
| 173 | 173 | |
@@ -180,8 +180,8 @@ discard block |
||
| 180 | 180 | */ |
| 181 | 181 | function geodir_fix_review_date() |
| 182 | 182 | {
|
| 183 | - global $wpdb; |
|
| 184 | - $wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->comments c ON gdr.comment_id=c.comment_ID SET gdr.post_date = c.comment_date WHERE gdr.post_date='0000-00-00 00:00:00'");
|
|
| 183 | + global $wpdb; |
|
| 184 | + $wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->comments c ON gdr.comment_id=c.comment_ID SET gdr.post_date = c.comment_date WHERE gdr.post_date='0000-00-00 00:00:00'");
|
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | /** |
@@ -193,8 +193,8 @@ discard block |
||
| 193 | 193 | */ |
| 194 | 194 | function geodir_fix_review_post_status() |
| 195 | 195 | {
|
| 196 | - global $wpdb; |
|
| 197 | - $wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->posts p ON gdr.post_id=p.ID SET gdr.post_status = 1 WHERE gdr.post_status IS NULL AND p.post_status='publish'");
|
|
| 196 | + global $wpdb; |
|
| 197 | + $wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->posts p ON gdr.post_id=p.ID SET gdr.post_status = 1 WHERE gdr.post_status IS NULL AND p.post_status='publish'");
|
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | /** |
@@ -207,12 +207,12 @@ discard block |
||
| 207 | 207 | */ |
| 208 | 208 | function geodir_fix_review_content() |
| 209 | 209 | {
|
| 210 | - global $wpdb; |
|
| 211 | - if ($wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->comments c ON gdr.comment_id=c.comment_ID SET gdr.comment_content = c.comment_content WHERE gdr.comment_content IS NULL")) {
|
|
| 212 | - return true; |
|
| 213 | - } else {
|
|
| 214 | - return false; |
|
| 215 | - } |
|
| 210 | + global $wpdb; |
|
| 211 | + if ($wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->comments c ON gdr.comment_id=c.comment_ID SET gdr.comment_content = c.comment_content WHERE gdr.comment_content IS NULL")) {
|
|
| 212 | + return true; |
|
| 213 | + } else {
|
|
| 214 | + return false; |
|
| 215 | + } |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | /** |
@@ -225,20 +225,20 @@ discard block |
||
| 225 | 225 | */ |
| 226 | 226 | function geodir_fix_review_location() |
| 227 | 227 | {
|
| 228 | - global $wpdb; |
|
| 228 | + global $wpdb; |
|
| 229 | 229 | |
| 230 | - $all_postypes = geodir_get_posttypes(); |
|
| 230 | + $all_postypes = geodir_get_posttypes(); |
|
| 231 | 231 | |
| 232 | - if (!empty($all_postypes)) {
|
|
| 233 | - foreach ($all_postypes as $key) {
|
|
| 234 | - // update each GD CTP |
|
| 232 | + if (!empty($all_postypes)) {
|
|
| 233 | + foreach ($all_postypes as $key) {
|
|
| 234 | + // update each GD CTP |
|
| 235 | 235 | |
| 236 | - $wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN " . $wpdb->prefix . "geodir_" . $key . "_detail d ON gdr.post_id=d.post_id SET gdr.post_latitude = d.post_latitude, gdr.post_longitude = d.post_longitude, gdr.post_city = d.post_city, gdr.post_region=d.post_region, gdr.post_country=d.post_country WHERE gdr.post_latitude IS NULL OR gdr.post_city IS NULL");
|
|
| 236 | + $wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN " . $wpdb->prefix . "geodir_" . $key . "_detail d ON gdr.post_id=d.post_id SET gdr.post_latitude = d.post_latitude, gdr.post_longitude = d.post_longitude, gdr.post_city = d.post_city, gdr.post_region=d.post_region, gdr.post_country=d.post_country WHERE gdr.post_latitude IS NULL OR gdr.post_city IS NULL");
|
|
| 237 | 237 | |
| 238 | - } |
|
| 239 | - return true; |
|
| 240 | - } |
|
| 241 | - return false; |
|
| 238 | + } |
|
| 239 | + return true; |
|
| 240 | + } |
|
| 241 | + return false; |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | /** |
@@ -250,82 +250,82 @@ discard block |
||
| 250 | 250 | */ |
| 251 | 251 | function geodir_fix_review_overall_rating() |
| 252 | 252 | {
|
| 253 | - global $wpdb; |
|
| 253 | + global $wpdb; |
|
| 254 | 254 | |
| 255 | - $all_postypes = geodir_get_posttypes(); |
|
| 255 | + $all_postypes = geodir_get_posttypes(); |
|
| 256 | 256 | |
| 257 | - if (!empty($all_postypes)) {
|
|
| 258 | - foreach ($all_postypes as $key) {
|
|
| 259 | - // update each GD CTP |
|
| 260 | - $reviews = $wpdb->get_results("SELECT post_id FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d");
|
|
| 257 | + if (!empty($all_postypes)) {
|
|
| 258 | + foreach ($all_postypes as $key) {
|
|
| 259 | + // update each GD CTP |
|
| 260 | + $reviews = $wpdb->get_results("SELECT post_id FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d");
|
|
| 261 | 261 | |
| 262 | - if (!empty($reviews)) {
|
|
| 263 | - foreach ($reviews as $post_id) {
|
|
| 264 | - geodir_update_postrating($post_id->post_id, $key); |
|
| 265 | - } |
|
| 262 | + if (!empty($reviews)) {
|
|
| 263 | + foreach ($reviews as $post_id) {
|
|
| 264 | + geodir_update_postrating($post_id->post_id, $key); |
|
| 265 | + } |
|
| 266 | 266 | |
| 267 | - } |
|
| 267 | + } |
|
| 268 | 268 | |
| 269 | - } |
|
| 269 | + } |
|
| 270 | 270 | |
| 271 | - } |
|
| 271 | + } |
|
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | |
| 275 | 275 | function gd_convert_custom_field_display(){
|
| 276 | - global $wpdb; |
|
| 276 | + global $wpdb; |
|
| 277 | 277 | |
| 278 | - $field_info = $wpdb->get_results("select * from " . GEODIR_CUSTOM_FIELDS_TABLE);
|
|
| 278 | + $field_info = $wpdb->get_results("select * from " . GEODIR_CUSTOM_FIELDS_TABLE);
|
|
| 279 | 279 | |
| 280 | - $has_run = get_option('gd_convert_custom_field_display');
|
|
| 281 | - if($has_run){return;}
|
|
| 280 | + $has_run = get_option('gd_convert_custom_field_display');
|
|
| 281 | + if($has_run){return;}
|
|
| 282 | 282 | |
| 283 | - // set the field_type_key for standard fields |
|
| 284 | - $wpdb->query("UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET field_type_key = field_type");
|
|
| 283 | + // set the field_type_key for standard fields |
|
| 284 | + $wpdb->query("UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET field_type_key = field_type");
|
|
| 285 | 285 | |
| 286 | 286 | |
| 287 | - if(is_array( $field_info)){
|
|
| 287 | + if(is_array( $field_info)){
|
|
| 288 | 288 | |
| 289 | - foreach( $field_info as $cf){
|
|
| 289 | + foreach( $field_info as $cf){
|
|
| 290 | 290 | |
| 291 | - $id = $cf->id; |
|
| 291 | + $id = $cf->id; |
|
| 292 | 292 | |
| 293 | - if(!property_exists($cf,'show_in') || !$id){return;}
|
|
| 293 | + if(!property_exists($cf,'show_in') || !$id){return;}
|
|
| 294 | 294 | |
| 295 | - $show_in_arr = array(); |
|
| 295 | + $show_in_arr = array(); |
|
| 296 | 296 | |
| 297 | - if($cf->is_default){
|
|
| 298 | - $show_in_arr[] = "[detail]"; |
|
| 299 | - } |
|
| 297 | + if($cf->is_default){
|
|
| 298 | + $show_in_arr[] = "[detail]"; |
|
| 299 | + } |
|
| 300 | 300 | |
| 301 | - if($cf->show_on_detail){
|
|
| 302 | - $show_in_arr[] = "[moreinfo]"; |
|
| 303 | - } |
|
| 301 | + if($cf->show_on_detail){
|
|
| 302 | + $show_in_arr[] = "[moreinfo]"; |
|
| 303 | + } |
|
| 304 | 304 | |
| 305 | - if($cf->show_on_listing){
|
|
| 306 | - $show_in_arr[] = "[listing]"; |
|
| 307 | - } |
|
| 305 | + if($cf->show_on_listing){
|
|
| 306 | + $show_in_arr[] = "[listing]"; |
|
| 307 | + } |
|
| 308 | 308 | |
| 309 | - if($cf->show_as_tab || $cf->htmlvar_name=='geodir_video' || $cf->htmlvar_name=='geodir_special_offers'){
|
|
| 310 | - $show_in_arr[] = "[owntab]"; |
|
| 311 | - } |
|
| 309 | + if($cf->show_as_tab || $cf->htmlvar_name=='geodir_video' || $cf->htmlvar_name=='geodir_special_offers'){
|
|
| 310 | + $show_in_arr[] = "[owntab]"; |
|
| 311 | + } |
|
| 312 | 312 | |
| 313 | - if($cf->htmlvar_name=='post' || $cf->htmlvar_name=='geodir_contact' || $cf->htmlvar_name=='geodir_timing'){
|
|
| 314 | - $show_in_arr[] = "[mapbubble]"; |
|
| 315 | - } |
|
| 313 | + if($cf->htmlvar_name=='post' || $cf->htmlvar_name=='geodir_contact' || $cf->htmlvar_name=='geodir_timing'){
|
|
| 314 | + $show_in_arr[] = "[mapbubble]"; |
|
| 315 | + } |
|
| 316 | 316 | |
| 317 | - if(!empty($show_in_arr )){
|
|
| 318 | - $show_in_arr = implode(',',$show_in_arr);
|
|
| 319 | - }else{
|
|
| 320 | - $show_in_arr = ''; |
|
| 321 | - } |
|
| 317 | + if(!empty($show_in_arr )){
|
|
| 318 | + $show_in_arr = implode(',',$show_in_arr);
|
|
| 319 | + }else{
|
|
| 320 | + $show_in_arr = ''; |
|
| 321 | + } |
|
| 322 | 322 | |
| 323 | - $wpdb->query("UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET show_in='$show_in_arr' WHERE id=$id");
|
|
| 323 | + $wpdb->query("UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET show_in='$show_in_arr' WHERE id=$id");
|
|
| 324 | 324 | |
| 325 | - } |
|
| 325 | + } |
|
| 326 | 326 | |
| 327 | - update_option('gd_convert_custom_field_display',1);
|
|
| 328 | - } |
|
| 327 | + update_option('gd_convert_custom_field_display',1);
|
|
| 328 | + } |
|
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | ############################################ |
@@ -341,372 +341,372 @@ discard block |
||
| 341 | 341 | */ |
| 342 | 342 | function gd_install_theme_compat() |
| 343 | 343 | {
|
| 344 | - global $wpdb; |
|
| 344 | + global $wpdb; |
|
| 345 | 345 | |
| 346 | - $theme_compat = array(); |
|
| 347 | - $theme_compat = get_option('gd_theme_compats');
|
|
| 346 | + $theme_compat = array(); |
|
| 347 | + $theme_compat = get_option('gd_theme_compats');
|
|
| 348 | 348 | //GDF |
| 349 | - $theme_compat['GeoDirectory_Framework'] = array( |
|
| 350 | - 'geodir_wrapper_open_id' => 'geodir_wrapper', |
|
| 351 | - 'geodir_wrapper_open_class' => '', |
|
| 352 | - 'geodir_wrapper_open_replace' => '', |
|
| 353 | - 'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->', |
|
| 354 | - 'geodir_wrapper_content_open_id' => 'geodir_content', |
|
| 355 | - 'geodir_wrapper_content_open_class' => '', |
|
| 356 | - 'geodir_wrapper_content_open_replace' => '', |
|
| 357 | - 'geodir_wrapper_content_close_replace' => '', |
|
| 358 | - 'geodir_article_open_id' => '', |
|
| 359 | - 'geodir_article_open_class' => '', |
|
| 360 | - 'geodir_article_open_replace' => '', |
|
| 361 | - 'geodir_article_close_replace' => '', |
|
| 362 | - 'geodir_sidebar_right_open_id' => '', |
|
| 363 | - 'geodir_sidebar_right_open_class' => '', |
|
| 364 | - 'geodir_sidebar_right_open_replace' => '<aside id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>', |
|
| 365 | - 'geodir_sidebar_right_close_replace' => '', |
|
| 366 | - 'geodir_sidebar_left_open_id' => '', |
|
| 367 | - 'geodir_sidebar_left_open_class' => '', |
|
| 368 | - 'geodir_sidebar_left_open_replace' => '<aside id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>', |
|
| 369 | - 'geodir_sidebar_left_close_replace' => '', |
|
| 370 | - 'geodir_main_content_open_id' => '', |
|
| 371 | - 'geodir_main_content_open_class' => '', |
|
| 372 | - 'geodir_main_content_open_replace' => '<!-- removed -->', |
|
| 373 | - 'geodir_main_content_close_replace' => '<!-- removed -->', |
|
| 374 | - 'geodir_top_content_add' => '', |
|
| 375 | - 'geodir_before_main_content_add' => '<div class="clearfix geodir-common">', |
|
| 376 | - 'geodir_before_widget_filter' => '', |
|
| 377 | - 'geodir_after_widget_filter' => '', |
|
| 378 | - 'geodir_theme_compat_css' => '', |
|
| 379 | - 'geodir_theme_compat_js' => '', |
|
| 380 | - 'geodir_theme_compat_default_options' => '', |
|
| 381 | - 'geodir_theme_compat_code' => '' |
|
| 382 | - ); |
|
| 349 | + $theme_compat['GeoDirectory_Framework'] = array( |
|
| 350 | + 'geodir_wrapper_open_id' => 'geodir_wrapper', |
|
| 351 | + 'geodir_wrapper_open_class' => '', |
|
| 352 | + 'geodir_wrapper_open_replace' => '', |
|
| 353 | + 'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->', |
|
| 354 | + 'geodir_wrapper_content_open_id' => 'geodir_content', |
|
| 355 | + 'geodir_wrapper_content_open_class' => '', |
|
| 356 | + 'geodir_wrapper_content_open_replace' => '', |
|
| 357 | + 'geodir_wrapper_content_close_replace' => '', |
|
| 358 | + 'geodir_article_open_id' => '', |
|
| 359 | + 'geodir_article_open_class' => '', |
|
| 360 | + 'geodir_article_open_replace' => '', |
|
| 361 | + 'geodir_article_close_replace' => '', |
|
| 362 | + 'geodir_sidebar_right_open_id' => '', |
|
| 363 | + 'geodir_sidebar_right_open_class' => '', |
|
| 364 | + 'geodir_sidebar_right_open_replace' => '<aside id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>', |
|
| 365 | + 'geodir_sidebar_right_close_replace' => '', |
|
| 366 | + 'geodir_sidebar_left_open_id' => '', |
|
| 367 | + 'geodir_sidebar_left_open_class' => '', |
|
| 368 | + 'geodir_sidebar_left_open_replace' => '<aside id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>', |
|
| 369 | + 'geodir_sidebar_left_close_replace' => '', |
|
| 370 | + 'geodir_main_content_open_id' => '', |
|
| 371 | + 'geodir_main_content_open_class' => '', |
|
| 372 | + 'geodir_main_content_open_replace' => '<!-- removed -->', |
|
| 373 | + 'geodir_main_content_close_replace' => '<!-- removed -->', |
|
| 374 | + 'geodir_top_content_add' => '', |
|
| 375 | + 'geodir_before_main_content_add' => '<div class="clearfix geodir-common">', |
|
| 376 | + 'geodir_before_widget_filter' => '', |
|
| 377 | + 'geodir_after_widget_filter' => '', |
|
| 378 | + 'geodir_theme_compat_css' => '', |
|
| 379 | + 'geodir_theme_compat_js' => '', |
|
| 380 | + 'geodir_theme_compat_default_options' => '', |
|
| 381 | + 'geodir_theme_compat_code' => '' |
|
| 382 | + ); |
|
| 383 | 383 | |
| 384 | 384 | //Directory Theme |
| 385 | - $theme_compat['Directory_Starter'] = array( |
|
| 386 | - 'geodir_wrapper_open_id' => 'geodir_wrapper', |
|
| 387 | - 'geodir_wrapper_open_class' => '', |
|
| 388 | - 'geodir_wrapper_open_replace' => '', |
|
| 389 | - 'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->', |
|
| 390 | - 'geodir_wrapper_content_open_id' => 'geodir_content', |
|
| 391 | - 'geodir_wrapper_content_open_class' => '', |
|
| 392 | - 'geodir_wrapper_content_open_replace' => '', |
|
| 393 | - 'geodir_wrapper_content_close_replace' => '', |
|
| 394 | - 'geodir_article_open_id' => '', |
|
| 395 | - 'geodir_article_open_class' => '', |
|
| 396 | - 'geodir_article_open_replace' => '', |
|
| 397 | - 'geodir_article_close_replace' => '', |
|
| 398 | - 'geodir_sidebar_right_open_id' => '', |
|
| 399 | - 'geodir_sidebar_right_open_class' => '', |
|
| 400 | - 'geodir_sidebar_right_open_replace' => '<aside id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>', |
|
| 401 | - 'geodir_sidebar_right_close_replace' => '', |
|
| 402 | - 'geodir_sidebar_left_open_id' => '', |
|
| 403 | - 'geodir_sidebar_left_open_class' => '', |
|
| 404 | - 'geodir_sidebar_left_open_replace' => '<aside id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>', |
|
| 405 | - 'geodir_sidebar_left_close_replace' => '', |
|
| 406 | - 'geodir_main_content_open_id' => '', |
|
| 407 | - 'geodir_main_content_open_class' => '', |
|
| 408 | - 'geodir_main_content_open_replace' => '<!-- removed -->', |
|
| 409 | - 'geodir_main_content_close_replace' => '<!-- removed -->', |
|
| 410 | - 'geodir_top_content_add' => '', |
|
| 411 | - 'geodir_before_main_content_add' => '<div class="clearfix geodir-common">', |
|
| 412 | - 'geodir_before_widget_filter' => '', |
|
| 413 | - 'geodir_after_widget_filter' => '', |
|
| 414 | - 'geodir_theme_compat_css' => '', |
|
| 415 | - 'geodir_theme_compat_js' => '', |
|
| 416 | - 'geodir_theme_compat_default_options' => '', |
|
| 417 | - 'geodir_theme_compat_code' => '' |
|
| 418 | - ); |
|
| 385 | + $theme_compat['Directory_Starter'] = array( |
|
| 386 | + 'geodir_wrapper_open_id' => 'geodir_wrapper', |
|
| 387 | + 'geodir_wrapper_open_class' => '', |
|
| 388 | + 'geodir_wrapper_open_replace' => '', |
|
| 389 | + 'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->', |
|
| 390 | + 'geodir_wrapper_content_open_id' => 'geodir_content', |
|
| 391 | + 'geodir_wrapper_content_open_class' => '', |
|
| 392 | + 'geodir_wrapper_content_open_replace' => '', |
|
| 393 | + 'geodir_wrapper_content_close_replace' => '', |
|
| 394 | + 'geodir_article_open_id' => '', |
|
| 395 | + 'geodir_article_open_class' => '', |
|
| 396 | + 'geodir_article_open_replace' => '', |
|
| 397 | + 'geodir_article_close_replace' => '', |
|
| 398 | + 'geodir_sidebar_right_open_id' => '', |
|
| 399 | + 'geodir_sidebar_right_open_class' => '', |
|
| 400 | + 'geodir_sidebar_right_open_replace' => '<aside id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>', |
|
| 401 | + 'geodir_sidebar_right_close_replace' => '', |
|
| 402 | + 'geodir_sidebar_left_open_id' => '', |
|
| 403 | + 'geodir_sidebar_left_open_class' => '', |
|
| 404 | + 'geodir_sidebar_left_open_replace' => '<aside id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>', |
|
| 405 | + 'geodir_sidebar_left_close_replace' => '', |
|
| 406 | + 'geodir_main_content_open_id' => '', |
|
| 407 | + 'geodir_main_content_open_class' => '', |
|
| 408 | + 'geodir_main_content_open_replace' => '<!-- removed -->', |
|
| 409 | + 'geodir_main_content_close_replace' => '<!-- removed -->', |
|
| 410 | + 'geodir_top_content_add' => '', |
|
| 411 | + 'geodir_before_main_content_add' => '<div class="clearfix geodir-common">', |
|
| 412 | + 'geodir_before_widget_filter' => '', |
|
| 413 | + 'geodir_after_widget_filter' => '', |
|
| 414 | + 'geodir_theme_compat_css' => '', |
|
| 415 | + 'geodir_theme_compat_js' => '', |
|
| 416 | + 'geodir_theme_compat_default_options' => '', |
|
| 417 | + 'geodir_theme_compat_code' => '' |
|
| 418 | + ); |
|
| 419 | 419 | |
| 420 | 420 | //Jobby |
| 421 | - $theme_compat['Jobby'] = $theme_compat['Directory_Starter']; |
|
| 421 | + $theme_compat['Jobby'] = $theme_compat['Directory_Starter']; |
|
| 422 | 422 | |
| 423 | 423 | //GeoProperty |
| 424 | - $theme_compat['GeoProperty'] = $theme_compat['Directory_Starter']; |
|
| 424 | + $theme_compat['GeoProperty'] = $theme_compat['Directory_Starter']; |
|
| 425 | 425 | |
| 426 | 426 | //Avada |
| 427 | - $theme_compat['Avada'] = array( |
|
| 428 | - 'geodir_wrapper_open_id' => '', |
|
| 429 | - 'geodir_wrapper_open_class' => '', |
|
| 430 | - 'geodir_wrapper_open_replace' => '<!-- removed -->', |
|
| 431 | - 'geodir_wrapper_close_replace' => '<!-- removed -->', |
|
| 432 | - 'geodir_wrapper_content_open_id' => 'content', |
|
| 433 | - 'geodir_wrapper_content_open_class' => '', |
|
| 434 | - 'geodir_wrapper_content_open_replace' => '', |
|
| 435 | - 'geodir_wrapper_content_close_replace' => '', |
|
| 436 | - 'geodir_article_open_id' => '', |
|
| 437 | - 'geodir_article_open_class' => '', |
|
| 438 | - 'geodir_article_open_replace' => '', |
|
| 439 | - 'geodir_article_close_replace' => '', |
|
| 440 | - 'geodir_sidebar_right_open_id' => '', |
|
| 441 | - 'geodir_sidebar_right_open_class' => '', |
|
| 442 | - 'geodir_sidebar_right_open_replace' => '<div id="sidebar" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>', |
|
| 443 | - 'geodir_sidebar_right_close_replace' => '</div><!-- end sidebar -->', |
|
| 444 | - 'geodir_sidebar_left_open_id' => '', |
|
| 445 | - 'geodir_sidebar_left_open_class' => '', |
|
| 446 | - 'geodir_sidebar_left_open_replace' => '<div id="sidebar" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>', |
|
| 447 | - 'geodir_sidebar_left_close_replace' => '</div><!-- end sidebar -->', |
|
| 448 | - 'geodir_main_content_open_id' => '', |
|
| 449 | - 'geodir_main_content_open_class' => '', |
|
| 450 | - 'geodir_main_content_open_replace' => '<!-- removed -->', |
|
| 451 | - 'geodir_main_content_close_replace' => '<!-- removed -->', |
|
| 452 | - 'geodir_top_content_add' => '', |
|
| 453 | - 'geodir_before_main_content_add' => '', |
|
| 454 | - 'geodir_before_widget_filter' => '', |
|
| 455 | - 'geodir_after_widget_filter' => '', |
|
| 456 | - 'geodir_theme_compat_css' => stripslashes('.geodir-sidebar-left{float:left}select,textarea{border-style:solid;border-width:1px}.top-menu li > div{visibility:visible}.geodir-chosen-container-single .chosen-single{height:auto}ul li#menu-item-gd-location-switcher ul{width:222px}ul li#menu-item-gd-location-switcher ul li{padding-right:0!important}#mobile-nav li#mobile-menu-item-gd-location-switcher li a{padding-left:10px;padding-right:10px}#menu-item-gd-location-switcher dd,#mobile-menu-item-gd-location-switcher{margin-left:0}#menu-item-gd-location-switcher dd a{display:block}.geodir-chosen-container .chosen-results li.highlighted{background-color:#eee;background-image:none;color:#444}#mobile-nav li.mobile-nav-item li a:before{content:\'\';margin:0}#mobile-nav li.mobile-nav-item li a{padding:10px;width:auto}.geodir-listing-search{text-align:center}.geodir-search{float:none;margin:0}.geodir-search select,.geodir-search .search_by_post,.geodir-search input[type="text"],.geodir-search button[type="button"], .geodir-search input[type="button"],.geodir-search input[type="submit"]{display:inline-block;float:none}.geodir-cat-list ul li,.map_category ul li{list-style-type:none}.wpgeo-avada .page-title ul li:after{content:\'\'}.top_banner_section{margin-bottom:0}.geodir-category-list-in{margin:0;padding:15px}.geodir_full_page .geodir-cat-list .widget-title{margin-top:0}.geodir_full_page .geodir-cat-list ul li{padding-left:0}.geodir-loc-bar{border:none;margin:0;padding:0}.geodir-loc-bar-in{padding:15px 0}.geodir_full_page section.widget{margin-bottom:20px}.sidebar .geodir-loginbox-list li{margin-bottom:10px;padding-bottom:10px}.sidebar .geodir-loginbox-list li a{display:block}.sidebar .geodir-chosen-container .chosen-results li{margin:0;padding:5px 6px}.sidebar .geodir-chosen-container .chosen-results li.highlighted{background:#eee;background-image:none;color:#000}.sidebar .geodir_category_list_view li.geodir-gridview{display:inline-block;margin-bottom:15px}.wpgeo-avada.double-sidebars #main #sidebar{margin-left:3%}.wpgeo-avada.double-sidebars #main #sidebar-2{margin-left:-100%}.wpgeo-avada.double-sidebars #content{float:left;margin-left:0}.geodir_full_page section.widget{margin-bottom: 0px;} .sidebar .widget .geodir-hide {display: none;}li.fusion-mobile-nav-item .geodir_location_tab_container a:before{content: "" !important; margin-right: auto !important;}li.fusion-mobile-nav-item .geodir_location_tab_container a{padding-left:5px !important;}'),
|
|
| 457 | - 'geodir_theme_compat_js' => '', |
|
| 458 | - 'geodir_theme_compat_default_options' => '', |
|
| 459 | - 'geodir_theme_compat_code' => 'Avada' |
|
| 460 | - ); |
|
| 427 | + $theme_compat['Avada'] = array( |
|
| 428 | + 'geodir_wrapper_open_id' => '', |
|
| 429 | + 'geodir_wrapper_open_class' => '', |
|
| 430 | + 'geodir_wrapper_open_replace' => '<!-- removed -->', |
|
| 431 | + 'geodir_wrapper_close_replace' => '<!-- removed -->', |
|
| 432 | + 'geodir_wrapper_content_open_id' => 'content', |
|
| 433 | + 'geodir_wrapper_content_open_class' => '', |
|
| 434 | + 'geodir_wrapper_content_open_replace' => '', |
|
| 435 | + 'geodir_wrapper_content_close_replace' => '', |
|
| 436 | + 'geodir_article_open_id' => '', |
|
| 437 | + 'geodir_article_open_class' => '', |
|
| 438 | + 'geodir_article_open_replace' => '', |
|
| 439 | + 'geodir_article_close_replace' => '', |
|
| 440 | + 'geodir_sidebar_right_open_id' => '', |
|
| 441 | + 'geodir_sidebar_right_open_class' => '', |
|
| 442 | + 'geodir_sidebar_right_open_replace' => '<div id="sidebar" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>', |
|
| 443 | + 'geodir_sidebar_right_close_replace' => '</div><!-- end sidebar -->', |
|
| 444 | + 'geodir_sidebar_left_open_id' => '', |
|
| 445 | + 'geodir_sidebar_left_open_class' => '', |
|
| 446 | + 'geodir_sidebar_left_open_replace' => '<div id="sidebar" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>', |
|
| 447 | + 'geodir_sidebar_left_close_replace' => '</div><!-- end sidebar -->', |
|
| 448 | + 'geodir_main_content_open_id' => '', |
|
| 449 | + 'geodir_main_content_open_class' => '', |
|
| 450 | + 'geodir_main_content_open_replace' => '<!-- removed -->', |
|
| 451 | + 'geodir_main_content_close_replace' => '<!-- removed -->', |
|
| 452 | + 'geodir_top_content_add' => '', |
|
| 453 | + 'geodir_before_main_content_add' => '', |
|
| 454 | + 'geodir_before_widget_filter' => '', |
|
| 455 | + 'geodir_after_widget_filter' => '', |
|
| 456 | + 'geodir_theme_compat_css' => stripslashes('.geodir-sidebar-left{float:left}select,textarea{border-style:solid;border-width:1px}.top-menu li > div{visibility:visible}.geodir-chosen-container-single .chosen-single{height:auto}ul li#menu-item-gd-location-switcher ul{width:222px}ul li#menu-item-gd-location-switcher ul li{padding-right:0!important}#mobile-nav li#mobile-menu-item-gd-location-switcher li a{padding-left:10px;padding-right:10px}#menu-item-gd-location-switcher dd,#mobile-menu-item-gd-location-switcher{margin-left:0}#menu-item-gd-location-switcher dd a{display:block}.geodir-chosen-container .chosen-results li.highlighted{background-color:#eee;background-image:none;color:#444}#mobile-nav li.mobile-nav-item li a:before{content:\'\';margin:0}#mobile-nav li.mobile-nav-item li a{padding:10px;width:auto}.geodir-listing-search{text-align:center}.geodir-search{float:none;margin:0}.geodir-search select,.geodir-search .search_by_post,.geodir-search input[type="text"],.geodir-search button[type="button"], .geodir-search input[type="button"],.geodir-search input[type="submit"]{display:inline-block;float:none}.geodir-cat-list ul li,.map_category ul li{list-style-type:none}.wpgeo-avada .page-title ul li:after{content:\'\'}.top_banner_section{margin-bottom:0}.geodir-category-list-in{margin:0;padding:15px}.geodir_full_page .geodir-cat-list .widget-title{margin-top:0}.geodir_full_page .geodir-cat-list ul li{padding-left:0}.geodir-loc-bar{border:none;margin:0;padding:0}.geodir-loc-bar-in{padding:15px 0}.geodir_full_page section.widget{margin-bottom:20px}.sidebar .geodir-loginbox-list li{margin-bottom:10px;padding-bottom:10px}.sidebar .geodir-loginbox-list li a{display:block}.sidebar .geodir-chosen-container .chosen-results li{margin:0;padding:5px 6px}.sidebar .geodir-chosen-container .chosen-results li.highlighted{background:#eee;background-image:none;color:#000}.sidebar .geodir_category_list_view li.geodir-gridview{display:inline-block;margin-bottom:15px}.wpgeo-avada.double-sidebars #main #sidebar{margin-left:3%}.wpgeo-avada.double-sidebars #main #sidebar-2{margin-left:-100%}.wpgeo-avada.double-sidebars #content{float:left;margin-left:0}.geodir_full_page section.widget{margin-bottom: 0px;} .sidebar .widget .geodir-hide {display: none;}li.fusion-mobile-nav-item .geodir_location_tab_container a:before{content: "" !important; margin-right: auto !important;}li.fusion-mobile-nav-item .geodir_location_tab_container a{padding-left:5px !important;}'),
|
|
| 457 | + 'geodir_theme_compat_js' => '', |
|
| 458 | + 'geodir_theme_compat_default_options' => '', |
|
| 459 | + 'geodir_theme_compat_code' => 'Avada' |
|
| 460 | + ); |
|
| 461 | 461 | |
| 462 | 462 | //Enfold |
| 463 | - $theme_compat['Enfold'] = array( |
|
| 464 | - 'geodir_wrapper_open_id' => '', |
|
| 465 | - 'geodir_wrapper_open_class' => '', |
|
| 466 | - 'geodir_wrapper_open_replace' => '', |
|
| 467 | - 'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->', |
|
| 468 | - 'geodir_wrapper_content_open_id' => '', |
|
| 469 | - 'geodir_wrapper_content_open_class' => '', |
|
| 470 | - 'geodir_wrapper_content_open_replace' => '', |
|
| 471 | - 'geodir_wrapper_content_close_replace' => '</div></main>', |
|
| 472 | - 'geodir_article_open_id' => '', |
|
| 473 | - 'geodir_article_open_class' => '', |
|
| 474 | - 'geodir_article_open_replace' => '', |
|
| 475 | - 'geodir_article_close_replace' => '', |
|
| 476 | - 'geodir_sidebar_right_open_id' => '', |
|
| 477 | - 'geodir_sidebar_right_open_class' => '', |
|
| 478 | - 'geodir_sidebar_right_open_replace' => '', |
|
| 479 | - 'geodir_sidebar_right_close_replace' => '</div></aside><!-- sidebar ends here-->', |
|
| 480 | - 'geodir_sidebar_left_open_id' => '', |
|
| 481 | - 'geodir_sidebar_left_open_class' => '', |
|
| 482 | - 'geodir_sidebar_left_open_replace' => '', |
|
| 483 | - 'geodir_sidebar_left_close_replace' => '</div></aside><!-- sidebar ends here-->', |
|
| 484 | - 'geodir_main_content_open_id' => '', |
|
| 485 | - 'geodir_main_content_open_class' => '', |
|
| 486 | - 'geodir_main_content_open_replace' => '', |
|
| 487 | - 'geodir_main_content_close_replace' => '', |
|
| 488 | - 'geodir_top_content_add' => '', |
|
| 489 | - 'geodir_before_main_content_add' => '', |
|
| 490 | - 'geodir_before_widget_filter' => '', |
|
| 491 | - 'geodir_after_widget_filter' => '', |
|
| 492 | - 'geodir_theme_compat_css' => stripslashes('.geodir_full_page .top_banner_section{margin-bottom:0}.widget .geodir-cat-list ul li{clear:none}.wpgeo-enfold .av-main-nav ul{width:222px}.geodir-listing-search .geodir-loc-bar{border-top:none;padding:0}#main .geodir-listing-search,.geodir-listing-search .geodir-loc-bar{margin-bottom:0}#main .geodir-loc-bar-in,#main .geodir-category-list-in{background-color:#fcfcfc;margin:20px 0;padding:20px}#main .geodir_full_page .geodir-loc-bar-in,#main .geodir_full_page .geodir-loc-bar,#main .geodir_full_page .geodir-category-list-in{margin-top:0;margin-bottom:0}#main .geodir-loc-bar-in{padding:20px}#main .geodir-search{margin:0;width:100%}#main .geodir-search select{margin:0 3% 0 0;padding:8px 10px;width:13%}#main .geodir-search input[type="text"]{margin:0 3% 0 0;padding:10px;width:32.4%}#main .geodir-search input[type="button"],#main .geodir-search input[type="submit"]{font-size:inherit;line-height:2.25;margin:0;padding:7px;width:13%}.enfold-home-top section.widget{margin:0;padding:0}.enfold-home-top .top_banner_section{margin-bottom:0}.enfold-home-top .geodir-loc-bar{background:#fcfcfc;border:none;margin:0;padding:0}#main .enfold-home-top .geodir-loc-bar-in{background:none;border:none;margin:0 auto;padding:20px 0}#main .geodir-breadcrumb{border-bottom-style:solid;border-bottom-width:1px}#gd-tabs dt{clear:none}#geodir_slider ul li{list-style-type:none;margin:0;padding:0}#respond{clear:both}#comments .comments-title span{display:inline;font-size:inherit;font-weight:700}#reviewsTab .comments-area .bypostauthor cite span{display:inline}#top #comments .commentlist .comment,#top #comments .commentlist .comment > div{min-height:0}.commentlist .commenttext{padding-top:15px}#comment_imagesdropbox{margin-bottom:20px}.wpgeo-enfold .geodir_category_list_view li{margin-left:0;padding:0}.widget ul.geodir-loginbox-list{overflow:visible}.geodir_category_list_view li .geodir-post-img{display:block}.wpgeo-enfold .geodir_event_listing_calendar tr.title{background:#ccc}@media only screen and (max-width:480px){.geodir_category_list_view li .geodir-content,.geodir_category_list_view li .geodir-post-img,.geodir_category_list_view li .geodir-addinfo{float:none;width:100%;margin:10px 0}#main .geodir-search input[type="text"],#main .geodir-search input[type="button"],#main .geodir-search input[type="submit"],#main .geodir-search select{margin:10px 0;width:100%}}#main .geodir_full_page section:last-child .geodir-loc-bar{margin-bottom: -1px;border-bottom: none;}'),
|
|
| 493 | - 'geodir_theme_compat_js' => '', |
|
| 494 | - 'geodir_theme_compat_default_options' => '', |
|
| 495 | - 'geodir_theme_compat_code' => 'Enfold' |
|
| 496 | - ); |
|
| 463 | + $theme_compat['Enfold'] = array( |
|
| 464 | + 'geodir_wrapper_open_id' => '', |
|
| 465 | + 'geodir_wrapper_open_class' => '', |
|
| 466 | + 'geodir_wrapper_open_replace' => '', |
|
| 467 | + 'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->', |
|
| 468 | + 'geodir_wrapper_content_open_id' => '', |
|
| 469 | + 'geodir_wrapper_content_open_class' => '', |
|
| 470 | + 'geodir_wrapper_content_open_replace' => '', |
|
| 471 | + 'geodir_wrapper_content_close_replace' => '</div></main>', |
|
| 472 | + 'geodir_article_open_id' => '', |
|
| 473 | + 'geodir_article_open_class' => '', |
|
| 474 | + 'geodir_article_open_replace' => '', |
|
| 475 | + 'geodir_article_close_replace' => '', |
|
| 476 | + 'geodir_sidebar_right_open_id' => '', |
|
| 477 | + 'geodir_sidebar_right_open_class' => '', |
|
| 478 | + 'geodir_sidebar_right_open_replace' => '', |
|
| 479 | + 'geodir_sidebar_right_close_replace' => '</div></aside><!-- sidebar ends here-->', |
|
| 480 | + 'geodir_sidebar_left_open_id' => '', |
|
| 481 | + 'geodir_sidebar_left_open_class' => '', |
|
| 482 | + 'geodir_sidebar_left_open_replace' => '', |
|
| 483 | + 'geodir_sidebar_left_close_replace' => '</div></aside><!-- sidebar ends here-->', |
|
| 484 | + 'geodir_main_content_open_id' => '', |
|
| 485 | + 'geodir_main_content_open_class' => '', |
|
| 486 | + 'geodir_main_content_open_replace' => '', |
|
| 487 | + 'geodir_main_content_close_replace' => '', |
|
| 488 | + 'geodir_top_content_add' => '', |
|
| 489 | + 'geodir_before_main_content_add' => '', |
|
| 490 | + 'geodir_before_widget_filter' => '', |
|
| 491 | + 'geodir_after_widget_filter' => '', |
|
| 492 | + 'geodir_theme_compat_css' => stripslashes('.geodir_full_page .top_banner_section{margin-bottom:0}.widget .geodir-cat-list ul li{clear:none}.wpgeo-enfold .av-main-nav ul{width:222px}.geodir-listing-search .geodir-loc-bar{border-top:none;padding:0}#main .geodir-listing-search,.geodir-listing-search .geodir-loc-bar{margin-bottom:0}#main .geodir-loc-bar-in,#main .geodir-category-list-in{background-color:#fcfcfc;margin:20px 0;padding:20px}#main .geodir_full_page .geodir-loc-bar-in,#main .geodir_full_page .geodir-loc-bar,#main .geodir_full_page .geodir-category-list-in{margin-top:0;margin-bottom:0}#main .geodir-loc-bar-in{padding:20px}#main .geodir-search{margin:0;width:100%}#main .geodir-search select{margin:0 3% 0 0;padding:8px 10px;width:13%}#main .geodir-search input[type="text"]{margin:0 3% 0 0;padding:10px;width:32.4%}#main .geodir-search input[type="button"],#main .geodir-search input[type="submit"]{font-size:inherit;line-height:2.25;margin:0;padding:7px;width:13%}.enfold-home-top section.widget{margin:0;padding:0}.enfold-home-top .top_banner_section{margin-bottom:0}.enfold-home-top .geodir-loc-bar{background:#fcfcfc;border:none;margin:0;padding:0}#main .enfold-home-top .geodir-loc-bar-in{background:none;border:none;margin:0 auto;padding:20px 0}#main .geodir-breadcrumb{border-bottom-style:solid;border-bottom-width:1px}#gd-tabs dt{clear:none}#geodir_slider ul li{list-style-type:none;margin:0;padding:0}#respond{clear:both}#comments .comments-title span{display:inline;font-size:inherit;font-weight:700}#reviewsTab .comments-area .bypostauthor cite span{display:inline}#top #comments .commentlist .comment,#top #comments .commentlist .comment > div{min-height:0}.commentlist .commenttext{padding-top:15px}#comment_imagesdropbox{margin-bottom:20px}.wpgeo-enfold .geodir_category_list_view li{margin-left:0;padding:0}.widget ul.geodir-loginbox-list{overflow:visible}.geodir_category_list_view li .geodir-post-img{display:block}.wpgeo-enfold .geodir_event_listing_calendar tr.title{background:#ccc}@media only screen and (max-width:480px){.geodir_category_list_view li .geodir-content,.geodir_category_list_view li .geodir-post-img,.geodir_category_list_view li .geodir-addinfo{float:none;width:100%;margin:10px 0}#main .geodir-search input[type="text"],#main .geodir-search input[type="button"],#main .geodir-search input[type="submit"],#main .geodir-search select{margin:10px 0;width:100%}}#main .geodir_full_page section:last-child .geodir-loc-bar{margin-bottom: -1px;border-bottom: none;}'),
|
|
| 493 | + 'geodir_theme_compat_js' => '', |
|
| 494 | + 'geodir_theme_compat_default_options' => '', |
|
| 495 | + 'geodir_theme_compat_code' => 'Enfold' |
|
| 496 | + ); |
|
| 497 | 497 | |
| 498 | 498 | // X |
| 499 | - $theme_compat['X'] = array( |
|
| 500 | - 'geodir_wrapper_open_id' => '', |
|
| 501 | - 'geodir_wrapper_open_class' => '', |
|
| 502 | - 'geodir_wrapper_open_replace' => '', |
|
| 503 | - 'geodir_wrapper_close_replace' => '', |
|
| 504 | - 'geodir_wrapper_content_open_id' => '', |
|
| 505 | - 'geodir_wrapper_content_open_class' => '', |
|
| 506 | - 'geodir_wrapper_content_open_replace' => '', |
|
| 507 | - 'geodir_wrapper_content_close_replace' => '', |
|
| 508 | - 'geodir_article_open_id' => '', |
|
| 509 | - 'geodir_article_open_class' => '', |
|
| 510 | - 'geodir_article_open_replace' => '', |
|
| 511 | - 'geodir_article_close_replace' => '', |
|
| 512 | - 'geodir_sidebar_right_open_id' => '', |
|
| 513 | - 'geodir_sidebar_right_open_class' => '', |
|
| 514 | - 'geodir_sidebar_right_open_replace' => '', |
|
| 515 | - 'geodir_sidebar_right_close_replace' => '', |
|
| 516 | - 'geodir_sidebar_left_open_id' => '', |
|
| 517 | - 'geodir_sidebar_left_open_class' => '', |
|
| 518 | - 'geodir_sidebar_left_open_replace' => '', |
|
| 519 | - 'geodir_sidebar_left_close_replace' => '', |
|
| 520 | - 'geodir_main_content_open_id' => '', |
|
| 521 | - 'geodir_main_content_open_class' => '', |
|
| 522 | - 'geodir_main_content_open_replace' => '', |
|
| 523 | - 'geodir_main_content_close_replace' => '', |
|
| 524 | - 'geodir_top_content_add' => '', |
|
| 525 | - 'geodir_before_main_content_add' => '', |
|
| 526 | - 'geodir_before_widget_filter' => '', |
|
| 527 | - 'geodir_after_widget_filter' => '', |
|
| 528 | - 'geodir_theme_compat_css' => stripslashes('.x-colophon.bottom{clear:both}#geodir-main-content,.geodir_flex-container{margin-top:16px}.geodir-x ul{list-style:none}.widget ul.geodir_category_list_view{border:none}.geodir_category_list_view li.geodir-gridview:last-child{border-bottom:1px solid #e1e1e1}.home .x-header-landmark{display:none}.geodir-x .x-main .geodir_advance_search_widget{margin:0}.geodir-x .top_banner_section{margin-bottom:0}.geodir-loc-bar{background:rgba(0,0,0,0.05);margin:0;padding:0}.geodir-loc-bar-in{background:none;border:none;padding:10px}.geodir-search{margin:0;width:100%}.widget .geodir-search select,.geodir-search input[type="text"],.geodir-search input[type="button"],.geodir-search input[type="submit"]{border:1px solid #ccc;box-shadow:none;height:auto;line-height:21px;margin:0 1% 0 0;padding:5px 10px}.widget .geodir-search select,.geodir-search input[type="text"]{width:28%}.geodir-search input[type="submit"],.geodir-search input[type="button"]{line-height:19px;margin-right:0;width:11%}.geodir-search input:hover[type="submit"],.geodir-search input:hover[type="button"]{background:#333;color:#fff}.geodir-cat-list .widget-title{margin-top:0}.geodir-x .geodir-category-list-in{background:rgba(0,0,0,0.05);border:none}.widget .geodir-cat-list ul.geodir-popular-cat-list{border:none;border-radius:0;box-shadow:none}.geodir_full_page .geodir-cat-list ul li{border:none}.geodir_full_page .geodir-cat-list ul li a{border:none}.post-type-archive .geodir-loc-bar{border:none;margin-top:20px}#menu-item-gd-location-switcher dd{margin-left:0}.geodir-chosen-container-single .chosen-single{height:auto}.widget ul.geodir-loginbox-list{overflow:visible}.geodir_full_page section.widget{clear:both}.x-ethos .entry-title{margin-bottom:20px}.x-ethos .geodir-chosen-container-single .chosen-single{padding:0 0 0 8px}.x-ethos .widget ul li a,.x-ethos .geodir_category_list_view li{color:#333}@media only screen and (max-width:767px){.widget .geodir-search select,.geodir-search input[type="text"],.geodir-search input[type="button"],.geodir-search input[type="submit"]{margin:0 0 10px;width:100%}}.geodir_full_page .geodir-loc-bar-in,.geodir_full_page .geodir-loc-bar,.geodir_full_page .geodir-category-list-in{margin-top:0;margin-bottom:0}.geodir_full_page .geodir-loc-bar-in,.geodir_full_page .geodir-category-list-in{border-bottom:1px solid rgba(0,0,0,0.1)}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search select,.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type="text"],.geodir_full_page .geodir-search input[type="button"],.geodir_full_page .geodir-search input[type="submit"]{display:inline-block;float:none}'),
|
|
| 529 | - 'geodir_theme_compat_js' => '', |
|
| 530 | - 'geodir_theme_compat_default_options' => '', |
|
| 531 | - 'geodir_theme_compat_code' => 'X' |
|
| 532 | - ); |
|
| 499 | + $theme_compat['X'] = array( |
|
| 500 | + 'geodir_wrapper_open_id' => '', |
|
| 501 | + 'geodir_wrapper_open_class' => '', |
|
| 502 | + 'geodir_wrapper_open_replace' => '', |
|
| 503 | + 'geodir_wrapper_close_replace' => '', |
|
| 504 | + 'geodir_wrapper_content_open_id' => '', |
|
| 505 | + 'geodir_wrapper_content_open_class' => '', |
|
| 506 | + 'geodir_wrapper_content_open_replace' => '', |
|
| 507 | + 'geodir_wrapper_content_close_replace' => '', |
|
| 508 | + 'geodir_article_open_id' => '', |
|
| 509 | + 'geodir_article_open_class' => '', |
|
| 510 | + 'geodir_article_open_replace' => '', |
|
| 511 | + 'geodir_article_close_replace' => '', |
|
| 512 | + 'geodir_sidebar_right_open_id' => '', |
|
| 513 | + 'geodir_sidebar_right_open_class' => '', |
|
| 514 | + 'geodir_sidebar_right_open_replace' => '', |
|
| 515 | + 'geodir_sidebar_right_close_replace' => '', |
|
| 516 | + 'geodir_sidebar_left_open_id' => '', |
|
| 517 | + 'geodir_sidebar_left_open_class' => '', |
|
| 518 | + 'geodir_sidebar_left_open_replace' => '', |
|
| 519 | + 'geodir_sidebar_left_close_replace' => '', |
|
| 520 | + 'geodir_main_content_open_id' => '', |
|
| 521 | + 'geodir_main_content_open_class' => '', |
|
| 522 | + 'geodir_main_content_open_replace' => '', |
|
| 523 | + 'geodir_main_content_close_replace' => '', |
|
| 524 | + 'geodir_top_content_add' => '', |
|
| 525 | + 'geodir_before_main_content_add' => '', |
|
| 526 | + 'geodir_before_widget_filter' => '', |
|
| 527 | + 'geodir_after_widget_filter' => '', |
|
| 528 | + 'geodir_theme_compat_css' => stripslashes('.x-colophon.bottom{clear:both}#geodir-main-content,.geodir_flex-container{margin-top:16px}.geodir-x ul{list-style:none}.widget ul.geodir_category_list_view{border:none}.geodir_category_list_view li.geodir-gridview:last-child{border-bottom:1px solid #e1e1e1}.home .x-header-landmark{display:none}.geodir-x .x-main .geodir_advance_search_widget{margin:0}.geodir-x .top_banner_section{margin-bottom:0}.geodir-loc-bar{background:rgba(0,0,0,0.05);margin:0;padding:0}.geodir-loc-bar-in{background:none;border:none;padding:10px}.geodir-search{margin:0;width:100%}.widget .geodir-search select,.geodir-search input[type="text"],.geodir-search input[type="button"],.geodir-search input[type="submit"]{border:1px solid #ccc;box-shadow:none;height:auto;line-height:21px;margin:0 1% 0 0;padding:5px 10px}.widget .geodir-search select,.geodir-search input[type="text"]{width:28%}.geodir-search input[type="submit"],.geodir-search input[type="button"]{line-height:19px;margin-right:0;width:11%}.geodir-search input:hover[type="submit"],.geodir-search input:hover[type="button"]{background:#333;color:#fff}.geodir-cat-list .widget-title{margin-top:0}.geodir-x .geodir-category-list-in{background:rgba(0,0,0,0.05);border:none}.widget .geodir-cat-list ul.geodir-popular-cat-list{border:none;border-radius:0;box-shadow:none}.geodir_full_page .geodir-cat-list ul li{border:none}.geodir_full_page .geodir-cat-list ul li a{border:none}.post-type-archive .geodir-loc-bar{border:none;margin-top:20px}#menu-item-gd-location-switcher dd{margin-left:0}.geodir-chosen-container-single .chosen-single{height:auto}.widget ul.geodir-loginbox-list{overflow:visible}.geodir_full_page section.widget{clear:both}.x-ethos .entry-title{margin-bottom:20px}.x-ethos .geodir-chosen-container-single .chosen-single{padding:0 0 0 8px}.x-ethos .widget ul li a,.x-ethos .geodir_category_list_view li{color:#333}@media only screen and (max-width:767px){.widget .geodir-search select,.geodir-search input[type="text"],.geodir-search input[type="button"],.geodir-search input[type="submit"]{margin:0 0 10px;width:100%}}.geodir_full_page .geodir-loc-bar-in,.geodir_full_page .geodir-loc-bar,.geodir_full_page .geodir-category-list-in{margin-top:0;margin-bottom:0}.geodir_full_page .geodir-loc-bar-in,.geodir_full_page .geodir-category-list-in{border-bottom:1px solid rgba(0,0,0,0.1)}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search select,.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type="text"],.geodir_full_page .geodir-search input[type="button"],.geodir_full_page .geodir-search input[type="submit"]{display:inline-block;float:none}'),
|
|
| 529 | + 'geodir_theme_compat_js' => '', |
|
| 530 | + 'geodir_theme_compat_default_options' => '', |
|
| 531 | + 'geodir_theme_compat_code' => 'X' |
|
| 532 | + ); |
|
| 533 | 533 | |
| 534 | 534 | // Divi |
| 535 | - $theme_compat['Divi'] = array( |
|
| 536 | - 'geodir_wrapper_open_id' => 'main-content', |
|
| 537 | - 'geodir_wrapper_open_class' => '', |
|
| 538 | - 'geodir_wrapper_open_replace' => '', |
|
| 539 | - 'geodir_wrapper_close_replace' => '', |
|
| 540 | - 'geodir_wrapper_content_open_id' => 'left-area', |
|
| 541 | - 'geodir_wrapper_content_open_class' => '', |
|
| 542 | - 'geodir_wrapper_content_open_replace' => '<div class="container"><div id="content-area" class="clearfix"><div id="[id]" class="[class]" role="main" >', |
|
| 543 | - 'geodir_wrapper_content_close_replace' => '', |
|
| 544 | - 'geodir_article_open_id' => '', |
|
| 545 | - 'geodir_article_open_class' => '', |
|
| 546 | - 'geodir_article_open_replace' => '', |
|
| 547 | - 'geodir_article_close_replace' => '', |
|
| 548 | - 'geodir_sidebar_right_open_id' => 'sidebar', |
|
| 549 | - 'geodir_sidebar_right_open_class' => '', |
|
| 550 | - 'geodir_sidebar_right_open_replace' => '<aside id="[id]" class="" role="complementary" itemscope itemtype="[itemtype]" >', |
|
| 551 | - 'geodir_sidebar_right_close_replace' => '</aside><!-- sidebar ends here--></div></div>', |
|
| 552 | - 'geodir_sidebar_left_open_id' => 'sidebar', |
|
| 553 | - 'geodir_sidebar_left_open_class' => '', |
|
| 554 | - 'geodir_sidebar_left_open_replace' => '<aside id="[id]" class="" role="complementary" itemscope itemtype="[itemtype]" >', |
|
| 555 | - 'geodir_sidebar_left_close_replace' => '</aside><!-- sidebar ends here--></div></div>', |
|
| 556 | - 'geodir_main_content_open_id' => '', |
|
| 557 | - 'geodir_main_content_open_class' => '', |
|
| 558 | - 'geodir_main_content_open_replace' => '', |
|
| 559 | - 'geodir_main_content_close_replace' => '', |
|
| 560 | - 'geodir_top_content_add' => '', |
|
| 561 | - 'geodir_before_main_content_add' => '', |
|
| 562 | - 'geodir_before_widget_filter' => '', |
|
| 563 | - 'geodir_after_widget_filter' => '', |
|
| 564 | - 'geodir_theme_compat_css' => stripslashes('#left-area ul.geodir-direction-nav{list-style-type:none}#sidebar .geodir-company_info{margin-left:30px}#sidebar .geodir-widget{float:none;margin:0 0 30px 30px}.geodir_full_page .geodir-loc-bar{padding:0;margin:0;border:none}.geodir_full_page .geodir-category-list-in{margin-top:0}.geodir_full_page .top_banner_section{margin-bottom:0}.archive .entry-header,.geodir-breadcrumb{border-bottom:1px solid #e2e2e2}.archive .entry-header h1,ul#breadcrumbs{margin:0 auto;width:1080px}#left-area ul.geodir_category_list_view{padding:10px 0}.nav li#menu-item-gd-location-switcher ul{width:222px}#menu-item-gd-location-switcher li.gd-location-switcher-menu-item{padding-right:0}#menu-item-gd-location-switcher dd{margin-left:0}#menu-item-gd-location-switcher .geodir_location_tab_container dd a{padding:5px;width:auto}@media only screen and ( max-width: 980px ){.geodir-loc-bar-in,.geodir-cat-list,ul#breadcrumbs{width:690px}}@media only screen and ( max-width: 767px ){.geodir-loc-bar-in,.geodir-cat-list,ul#breadcrumbs{width:400px}}@media only screen and ( max-width: 479px ){.geodir-loc-bar-in,.geodir-cat-list,ul#breadcrumbs{width:280px}}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search select,.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type="text"],.geodir_full_page .geodir-search input[type="button"],.geodir_full_page .geodir-search input[type="submit"]{display:inline-block;float:none}'),
|
|
| 565 | - 'geodir_theme_compat_js' => '', |
|
| 566 | - 'geodir_theme_compat_default_options' => '', |
|
| 567 | - 'geodir_theme_compat_code' => 'Divi' |
|
| 568 | - ); |
|
| 535 | + $theme_compat['Divi'] = array( |
|
| 536 | + 'geodir_wrapper_open_id' => 'main-content', |
|
| 537 | + 'geodir_wrapper_open_class' => '', |
|
| 538 | + 'geodir_wrapper_open_replace' => '', |
|
| 539 | + 'geodir_wrapper_close_replace' => '', |
|
| 540 | + 'geodir_wrapper_content_open_id' => 'left-area', |
|
| 541 | + 'geodir_wrapper_content_open_class' => '', |
|
| 542 | + 'geodir_wrapper_content_open_replace' => '<div class="container"><div id="content-area" class="clearfix"><div id="[id]" class="[class]" role="main" >', |
|
| 543 | + 'geodir_wrapper_content_close_replace' => '', |
|
| 544 | + 'geodir_article_open_id' => '', |
|
| 545 | + 'geodir_article_open_class' => '', |
|
| 546 | + 'geodir_article_open_replace' => '', |
|
| 547 | + 'geodir_article_close_replace' => '', |
|
| 548 | + 'geodir_sidebar_right_open_id' => 'sidebar', |
|
| 549 | + 'geodir_sidebar_right_open_class' => '', |
|
| 550 | + 'geodir_sidebar_right_open_replace' => '<aside id="[id]" class="" role="complementary" itemscope itemtype="[itemtype]" >', |
|
| 551 | + 'geodir_sidebar_right_close_replace' => '</aside><!-- sidebar ends here--></div></div>', |
|
| 552 | + 'geodir_sidebar_left_open_id' => 'sidebar', |
|
| 553 | + 'geodir_sidebar_left_open_class' => '', |
|
| 554 | + 'geodir_sidebar_left_open_replace' => '<aside id="[id]" class="" role="complementary" itemscope itemtype="[itemtype]" >', |
|
| 555 | + 'geodir_sidebar_left_close_replace' => '</aside><!-- sidebar ends here--></div></div>', |
|
| 556 | + 'geodir_main_content_open_id' => '', |
|
| 557 | + 'geodir_main_content_open_class' => '', |
|
| 558 | + 'geodir_main_content_open_replace' => '', |
|
| 559 | + 'geodir_main_content_close_replace' => '', |
|
| 560 | + 'geodir_top_content_add' => '', |
|
| 561 | + 'geodir_before_main_content_add' => '', |
|
| 562 | + 'geodir_before_widget_filter' => '', |
|
| 563 | + 'geodir_after_widget_filter' => '', |
|
| 564 | + 'geodir_theme_compat_css' => stripslashes('#left-area ul.geodir-direction-nav{list-style-type:none}#sidebar .geodir-company_info{margin-left:30px}#sidebar .geodir-widget{float:none;margin:0 0 30px 30px}.geodir_full_page .geodir-loc-bar{padding:0;margin:0;border:none}.geodir_full_page .geodir-category-list-in{margin-top:0}.geodir_full_page .top_banner_section{margin-bottom:0}.archive .entry-header,.geodir-breadcrumb{border-bottom:1px solid #e2e2e2}.archive .entry-header h1,ul#breadcrumbs{margin:0 auto;width:1080px}#left-area ul.geodir_category_list_view{padding:10px 0}.nav li#menu-item-gd-location-switcher ul{width:222px}#menu-item-gd-location-switcher li.gd-location-switcher-menu-item{padding-right:0}#menu-item-gd-location-switcher dd{margin-left:0}#menu-item-gd-location-switcher .geodir_location_tab_container dd a{padding:5px;width:auto}@media only screen and ( max-width: 980px ){.geodir-loc-bar-in,.geodir-cat-list,ul#breadcrumbs{width:690px}}@media only screen and ( max-width: 767px ){.geodir-loc-bar-in,.geodir-cat-list,ul#breadcrumbs{width:400px}}@media only screen and ( max-width: 479px ){.geodir-loc-bar-in,.geodir-cat-list,ul#breadcrumbs{width:280px}}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search select,.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type="text"],.geodir_full_page .geodir-search input[type="button"],.geodir_full_page .geodir-search input[type="submit"]{display:inline-block;float:none}'),
|
|
| 565 | + 'geodir_theme_compat_js' => '', |
|
| 566 | + 'geodir_theme_compat_default_options' => '', |
|
| 567 | + 'geodir_theme_compat_code' => 'Divi' |
|
| 568 | + ); |
|
| 569 | 569 | |
| 570 | 570 | // Genesis |
| 571 | - $theme_compat['Genesis'] = array( |
|
| 572 | - 'geodir_wrapper_open_id' => '', |
|
| 573 | - 'geodir_wrapper_open_class' => 'content-sidebar-wrap', |
|
| 574 | - 'geodir_wrapper_open_replace' => '', |
|
| 575 | - 'geodir_wrapper_close_replace' => '', |
|
| 576 | - 'geodir_wrapper_content_open_id' => '', |
|
| 577 | - 'geodir_wrapper_content_open_class' => 'content', |
|
| 578 | - 'geodir_wrapper_content_open_replace' => '<div class="[class]" role="main" >', |
|
| 579 | - 'geodir_wrapper_content_close_replace' => '', |
|
| 580 | - 'geodir_article_open_id' => '', |
|
| 581 | - 'geodir_article_open_class' => '', |
|
| 582 | - 'geodir_article_open_replace' => '', |
|
| 583 | - 'geodir_article_close_replace' => '', |
|
| 584 | - 'geodir_sidebar_right_open_id' => '', |
|
| 585 | - 'geodir_sidebar_right_open_class' => 'sidebar sidebar-primary widget-area', |
|
| 586 | - 'geodir_sidebar_right_open_replace' => '<aside id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]">', |
|
| 587 | - 'geodir_sidebar_right_close_replace' => '', |
|
| 588 | - 'geodir_sidebar_left_open_id' => '', |
|
| 589 | - 'geodir_sidebar_left_open_class' => 'sidebar sidebar-secondary widget-area', |
|
| 590 | - 'geodir_sidebar_left_open_replace' => '<aside id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]">', |
|
| 591 | - 'geodir_sidebar_left_close_replace' => '', |
|
| 592 | - 'geodir_main_content_open_id' => '', |
|
| 593 | - 'geodir_main_content_open_class' => '', |
|
| 594 | - 'geodir_main_content_open_replace' => '<main id="[id]" class="entry [class]" role="main">', |
|
| 595 | - 'geodir_main_content_close_replace' => '', |
|
| 596 | - 'geodir_top_content_add' => '', |
|
| 597 | - 'geodir_before_main_content_add' => '', |
|
| 598 | - 'geodir_before_widget_filter' => '', |
|
| 599 | - 'geodir_after_widget_filter' => '', |
|
| 600 | - 'geodir_location_switcher_menu_li_class_filter' => 'menu-item menu-item-gd-location-switcher menu-item-has-children gd-location-switcher', |
|
| 601 | - 'geodir_theme_compat_css' => stripslashes('.full-width-content #geodir-wrapper-content{width:100%}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search select,.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type="text"],.geodir_full_page .geodir-search input[type="button"],.geodir_full_page .geodir-search input[type="submit"]{display:inline-block;float:none}.content{float:left}.sidebar-content .content,.sidebar-content #geodir-wrapper-content{float:right}.sidebar .geodir-company_info{background-color:#fff;border:none}.geodir_full_page .geodir-loc-bar{padding:0;margin:0;border:none}.geodir_full_page .geodir-category-list-in{margin-top:0}.geodir_full_page .top_banner_section{margin-bottom:0}.geodir-breadcrumb-bar{margin-bottom:-35px} .search-page .entry-title,.listings-page .entry-title{font-size: 20px;}.site-inner .geodir-breadcrumb-bar{margin-bottom:0px}'),
|
|
| 602 | - 'geodir_theme_compat_js' => '', |
|
| 603 | - 'geodir_theme_compat_default_options' => '', |
|
| 604 | - 'geodir_theme_compat_code' => 'Genesis' |
|
| 605 | - ); |
|
| 571 | + $theme_compat['Genesis'] = array( |
|
| 572 | + 'geodir_wrapper_open_id' => '', |
|
| 573 | + 'geodir_wrapper_open_class' => 'content-sidebar-wrap', |
|
| 574 | + 'geodir_wrapper_open_replace' => '', |
|
| 575 | + 'geodir_wrapper_close_replace' => '', |
|
| 576 | + 'geodir_wrapper_content_open_id' => '', |
|
| 577 | + 'geodir_wrapper_content_open_class' => 'content', |
|
| 578 | + 'geodir_wrapper_content_open_replace' => '<div class="[class]" role="main" >', |
|
| 579 | + 'geodir_wrapper_content_close_replace' => '', |
|
| 580 | + 'geodir_article_open_id' => '', |
|
| 581 | + 'geodir_article_open_class' => '', |
|
| 582 | + 'geodir_article_open_replace' => '', |
|
| 583 | + 'geodir_article_close_replace' => '', |
|
| 584 | + 'geodir_sidebar_right_open_id' => '', |
|
| 585 | + 'geodir_sidebar_right_open_class' => 'sidebar sidebar-primary widget-area', |
|
| 586 | + 'geodir_sidebar_right_open_replace' => '<aside id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]">', |
|
| 587 | + 'geodir_sidebar_right_close_replace' => '', |
|
| 588 | + 'geodir_sidebar_left_open_id' => '', |
|
| 589 | + 'geodir_sidebar_left_open_class' => 'sidebar sidebar-secondary widget-area', |
|
| 590 | + 'geodir_sidebar_left_open_replace' => '<aside id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]">', |
|
| 591 | + 'geodir_sidebar_left_close_replace' => '', |
|
| 592 | + 'geodir_main_content_open_id' => '', |
|
| 593 | + 'geodir_main_content_open_class' => '', |
|
| 594 | + 'geodir_main_content_open_replace' => '<main id="[id]" class="entry [class]" role="main">', |
|
| 595 | + 'geodir_main_content_close_replace' => '', |
|
| 596 | + 'geodir_top_content_add' => '', |
|
| 597 | + 'geodir_before_main_content_add' => '', |
|
| 598 | + 'geodir_before_widget_filter' => '', |
|
| 599 | + 'geodir_after_widget_filter' => '', |
|
| 600 | + 'geodir_location_switcher_menu_li_class_filter' => 'menu-item menu-item-gd-location-switcher menu-item-has-children gd-location-switcher', |
|
| 601 | + 'geodir_theme_compat_css' => stripslashes('.full-width-content #geodir-wrapper-content{width:100%}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search select,.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type="text"],.geodir_full_page .geodir-search input[type="button"],.geodir_full_page .geodir-search input[type="submit"]{display:inline-block;float:none}.content{float:left}.sidebar-content .content,.sidebar-content #geodir-wrapper-content{float:right}.sidebar .geodir-company_info{background-color:#fff;border:none}.geodir_full_page .geodir-loc-bar{padding:0;margin:0;border:none}.geodir_full_page .geodir-category-list-in{margin-top:0}.geodir_full_page .top_banner_section{margin-bottom:0}.geodir-breadcrumb-bar{margin-bottom:-35px} .search-page .entry-title,.listings-page .entry-title{font-size: 20px;}.site-inner .geodir-breadcrumb-bar{margin-bottom:0px}'),
|
|
| 602 | + 'geodir_theme_compat_js' => '', |
|
| 603 | + 'geodir_theme_compat_default_options' => '', |
|
| 604 | + 'geodir_theme_compat_code' => 'Genesis' |
|
| 605 | + ); |
|
| 606 | 606 | |
| 607 | 607 | // Jupiter |
| 608 | - $theme_compat['Jupiter'] = array( |
|
| 609 | - 'geodir_wrapper_open_id' => '', |
|
| 610 | - 'geodir_wrapper_open_class' => '', |
|
| 611 | - 'geodir_wrapper_open_replace' => '<div id="theme-page"><div class="mk-main-wrapper-holder"><div class="theme-page-wrapper mk-main-wrapper mk-grid vc_row-fluid">', |
|
| 612 | - 'geodir_wrapper_close_replace' => '</div></div></div>', |
|
| 613 | - 'geodir_wrapper_content_open_id' => '', |
|
| 614 | - 'geodir_wrapper_content_open_class' => '', |
|
| 615 | - 'geodir_wrapper_content_open_replace' => '', |
|
| 616 | - 'geodir_wrapper_content_close_replace' => '', |
|
| 617 | - 'geodir_article_open_id' => '', |
|
| 618 | - 'geodir_article_open_class' => '', |
|
| 619 | - 'geodir_article_open_replace' => '', |
|
| 620 | - 'geodir_article_close_replace' => '', |
|
| 621 | - 'geodir_sidebar_right_open_id' => 'mk-sidebar', |
|
| 622 | - 'geodir_sidebar_right_open_class' => 'mk-builtin geodir-sidebar-right geodir-listings-sidebar-right', |
|
| 623 | - 'geodir_sidebar_right_open_replace' => '', |
|
| 624 | - 'geodir_sidebar_right_close_replace' => '', |
|
| 625 | - 'geodir_sidebar_left_open_id' => 'mk-sidebar', |
|
| 626 | - 'geodir_sidebar_left_open_class' => 'mk-builtin geodir-sidebar-right geodir-listings-sidebar-right', |
|
| 627 | - 'geodir_sidebar_left_open_replace' => '', |
|
| 628 | - 'geodir_sidebar_left_close_replace' => '', |
|
| 629 | - 'geodir_main_content_open_id' => '', |
|
| 630 | - 'geodir_main_content_open_class' => '', |
|
| 631 | - 'geodir_main_content_open_replace' => '', |
|
| 632 | - 'geodir_main_content_close_replace' => '', |
|
| 633 | - 'geodir_top_content_add' => '', |
|
| 634 | - 'geodir_before_main_content_add' => '', |
|
| 635 | - 'geodir_before_widget_filter' => '', |
|
| 636 | - 'geodir_after_widget_filter' => '', |
|
| 637 | - 'geodir_before_title_filter' => '<h3 class="widgettitle geodir-widget-title">', |
|
| 638 | - 'geodir_after_title_filter' => '', |
|
| 639 | - 'geodir_menu_li_class_filter' => 'menu-item menu-item-has-children no-mega-menu', |
|
| 640 | - 'geodir_sub_menu_ul_class_filter' => '', |
|
| 641 | - 'geodir_sub_menu_li_class_filter' => '', |
|
| 642 | - 'geodir_menu_a_class_filter' => 'menu-item-link', |
|
| 643 | - 'geodir_sub_menu_a_class_filter' => 'menu-item-link one-page-nav-item', |
|
| 644 | - 'geodir_location_switcher_menu_li_class_filter' => 'menu-item menu-item-type-social menu-item-type-social gd-location-switcher menu-item-has-children no-mega-menu', |
|
| 645 | - 'geodir_location_switcher_menu_a_class_filter' => 'menu-item-link', |
|
| 646 | - 'geodir_location_switcher_menu_sub_ul_class_filter' => '', |
|
| 647 | - 'geodir_location_switcher_menu_sub_li_class_filter' => '', |
|
| 648 | - 'geodir_theme_compat_css' => stripslashes('.geodir-widget li,.geodir_category_list_view li{margin:0}#theme-page h3.geodir-entry-title{font-size:14px}#menu-item-gd-location-switcher dd{line-height:44px}#menu-item-gd-location-switcher .geodir_location_sugestion{line-height:20px}.geodir_loginbox{overflow:visible}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search select,.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type="text"],.geodir_full_page .geodir-search input[type="button"],.geodir_full_page .geodir-search input[type="submit"]{display:inline-block;float:none}'),
|
|
| 649 | - 'geodir_theme_compat_js' => '', |
|
| 650 | - 'geodir_theme_compat_default_options' => '', |
|
| 651 | - 'geodir_theme_compat_code' => 'Jupiter' |
|
| 652 | - ); |
|
| 608 | + $theme_compat['Jupiter'] = array( |
|
| 609 | + 'geodir_wrapper_open_id' => '', |
|
| 610 | + 'geodir_wrapper_open_class' => '', |
|
| 611 | + 'geodir_wrapper_open_replace' => '<div id="theme-page"><div class="mk-main-wrapper-holder"><div class="theme-page-wrapper mk-main-wrapper mk-grid vc_row-fluid">', |
|
| 612 | + 'geodir_wrapper_close_replace' => '</div></div></div>', |
|
| 613 | + 'geodir_wrapper_content_open_id' => '', |
|
| 614 | + 'geodir_wrapper_content_open_class' => '', |
|
| 615 | + 'geodir_wrapper_content_open_replace' => '', |
|
| 616 | + 'geodir_wrapper_content_close_replace' => '', |
|
| 617 | + 'geodir_article_open_id' => '', |
|
| 618 | + 'geodir_article_open_class' => '', |
|
| 619 | + 'geodir_article_open_replace' => '', |
|
| 620 | + 'geodir_article_close_replace' => '', |
|
| 621 | + 'geodir_sidebar_right_open_id' => 'mk-sidebar', |
|
| 622 | + 'geodir_sidebar_right_open_class' => 'mk-builtin geodir-sidebar-right geodir-listings-sidebar-right', |
|
| 623 | + 'geodir_sidebar_right_open_replace' => '', |
|
| 624 | + 'geodir_sidebar_right_close_replace' => '', |
|
| 625 | + 'geodir_sidebar_left_open_id' => 'mk-sidebar', |
|
| 626 | + 'geodir_sidebar_left_open_class' => 'mk-builtin geodir-sidebar-right geodir-listings-sidebar-right', |
|
| 627 | + 'geodir_sidebar_left_open_replace' => '', |
|
| 628 | + 'geodir_sidebar_left_close_replace' => '', |
|
| 629 | + 'geodir_main_content_open_id' => '', |
|
| 630 | + 'geodir_main_content_open_class' => '', |
|
| 631 | + 'geodir_main_content_open_replace' => '', |
|
| 632 | + 'geodir_main_content_close_replace' => '', |
|
| 633 | + 'geodir_top_content_add' => '', |
|
| 634 | + 'geodir_before_main_content_add' => '', |
|
| 635 | + 'geodir_before_widget_filter' => '', |
|
| 636 | + 'geodir_after_widget_filter' => '', |
|
| 637 | + 'geodir_before_title_filter' => '<h3 class="widgettitle geodir-widget-title">', |
|
| 638 | + 'geodir_after_title_filter' => '', |
|
| 639 | + 'geodir_menu_li_class_filter' => 'menu-item menu-item-has-children no-mega-menu', |
|
| 640 | + 'geodir_sub_menu_ul_class_filter' => '', |
|
| 641 | + 'geodir_sub_menu_li_class_filter' => '', |
|
| 642 | + 'geodir_menu_a_class_filter' => 'menu-item-link', |
|
| 643 | + 'geodir_sub_menu_a_class_filter' => 'menu-item-link one-page-nav-item', |
|
| 644 | + 'geodir_location_switcher_menu_li_class_filter' => 'menu-item menu-item-type-social menu-item-type-social gd-location-switcher menu-item-has-children no-mega-menu', |
|
| 645 | + 'geodir_location_switcher_menu_a_class_filter' => 'menu-item-link', |
|
| 646 | + 'geodir_location_switcher_menu_sub_ul_class_filter' => '', |
|
| 647 | + 'geodir_location_switcher_menu_sub_li_class_filter' => '', |
|
| 648 | + 'geodir_theme_compat_css' => stripslashes('.geodir-widget li,.geodir_category_list_view li{margin:0}#theme-page h3.geodir-entry-title{font-size:14px}#menu-item-gd-location-switcher dd{line-height:44px}#menu-item-gd-location-switcher .geodir_location_sugestion{line-height:20px}.geodir_loginbox{overflow:visible}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search select,.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type="text"],.geodir_full_page .geodir-search input[type="button"],.geodir_full_page .geodir-search input[type="submit"]{display:inline-block;float:none}'),
|
|
| 649 | + 'geodir_theme_compat_js' => '', |
|
| 650 | + 'geodir_theme_compat_default_options' => '', |
|
| 651 | + 'geodir_theme_compat_code' => 'Jupiter' |
|
| 652 | + ); |
|
| 653 | 653 | |
| 654 | 654 | // Multi News |
| 655 | - $theme_compat['Multi_News'] = array( |
|
| 656 | - 'geodir_wrapper_open_id' => '', |
|
| 657 | - 'geodir_wrapper_open_class' => 'main-container clearfix', |
|
| 658 | - 'geodir_wrapper_open_replace' => '', |
|
| 659 | - 'geodir_wrapper_close_replace' => '', |
|
| 660 | - 'geodir_wrapper_content_open_id' => '', |
|
| 661 | - 'geodir_wrapper_content_open_class' => '', |
|
| 662 | - 'geodir_wrapper_content_open_replace' => '<div class="main-left" ><div class="main-content "><div class="site-content page-wrap">', |
|
| 663 | - 'geodir_wrapper_content_close_replace' => '</div></div></div>', |
|
| 664 | - 'geodir_article_open_id' => '', |
|
| 665 | - 'geodir_article_open_class' => '', |
|
| 666 | - 'geodir_article_open_replace' => '', |
|
| 667 | - 'geodir_article_close_replace' => '', |
|
| 668 | - 'geodir_sidebar_right_open_id' => '', |
|
| 669 | - 'geodir_sidebar_right_open_class' => '', |
|
| 670 | - 'geodir_sidebar_right_open_replace' => '<aside class="sidebar" role="complementary" itemscope itemtype="[itemtype]" >', |
|
| 671 | - 'geodir_sidebar_right_close_replace' => '', |
|
| 672 | - 'geodir_sidebar_left_open_id' => '', |
|
| 673 | - 'geodir_sidebar_left_open_class' => '', |
|
| 674 | - 'geodir_sidebar_left_open_replace' => '<aside class="secondary-sidebar" role="complementary" itemscope itemtype="[itemtype]" >', |
|
| 675 | - 'geodir_sidebar_left_close_replace' => '', |
|
| 676 | - 'geodir_main_content_open_id' => '', |
|
| 677 | - 'geodir_main_content_open_class' => '', |
|
| 678 | - 'geodir_main_content_open_replace' => '<div class="site-content page-wrap">', |
|
| 679 | - 'geodir_main_content_close_replace' => '</div>', |
|
| 680 | - 'geodir_top_content_add' => '', |
|
| 681 | - 'geodir_before_main_content_add' => '', |
|
| 682 | - 'geodir_full_page_class_filter' => 'section full-width-section', |
|
| 683 | - 'geodir_before_widget_filter' => '', |
|
| 684 | - 'geodir_after_widget_filter' => '', |
|
| 685 | - 'geodir_before_title_filter' => '<div class="widget-title"><h2>', |
|
| 686 | - 'geodir_after_title_filter' => '</h2></div>', |
|
| 687 | - 'geodir_menu_li_class_filter' => '', |
|
| 688 | - 'geodir_sub_menu_ul_class_filter' => '', |
|
| 689 | - 'geodir_sub_menu_li_class_filter' => '', |
|
| 690 | - 'geodir_menu_a_class_filter' => '', |
|
| 691 | - 'geodir_sub_menu_a_class_filter' => '', |
|
| 692 | - 'geodir_location_switcher_menu_li_class_filter' => '', |
|
| 693 | - 'geodir_location_switcher_menu_a_class_filter' => '', |
|
| 694 | - 'geodir_location_switcher_menu_sub_ul_class_filter' => '', |
|
| 695 | - 'geodir_location_switcher_menu_sub_li_class_filter' => '', |
|
| 696 | - 'geodir_theme_compat_css' => stripslashes('.full-width-section .geodir-search{margin:0;width:100%}.geodir_full_page .geodir-search{margin:0 auto;float:none}.geodir-search input[type=button],.geodir-search input[type=submit]{width:13%}.geodir-search input[type=text]{border:1px solid #ddd;border-radius:0;padding:0 8px}.geodir-category-list-in,.geodir-loc-bar-in{background:#f2f2f2;border-color:#dbdbdb}.geodir-category-list-in{margin-top:0}.geodir-cat-list .widget-title h2{margin:-13px -13px 13px}.widget .geodir-cat-list ul li.geodir-pcat-show a:before{display:none!important}.widget .geodir-cat-list ul li.geodir-pcat-show i{margin-right:5px}.container .geodir-search select{margin:0 3% 0 0;padding:8px 10px;width:13%}#geodir_carousel,#geodir_slider{border-radius:0;-webkit-border-radius:0;-moz-border-radius:0;margin-bottom:20px!important;border:1px solid #e1e1e1;box-shadow:none}#geodir_carousel{padding:10px}.geodir-tabs-content ol.commentlist{margin:40px 0;padding:0}li#post_mapTab{min-height:400px}#reviewsTab ol.commentlist li{border-bottom:none}#reviewsTab ol.commentlist li article.comment{border-bottom:1px solid #e1e1e1;padding-bottom:10px}.comment-content .rating{display:none}.comment-respond .gd_rating{margin-bottom:20px}div.geodir-rating{width:85px!important}.comment-respond .comment-notes{margin-bottom:10px}.average-review span,.comment-form label,.dtreviewed,.geodir-details-sidebar-user-links a,.geodir-viewall,.geodir_more_info span,.reviewer,dl.geodir-tab-head dd a{font-family:"Archivo Narrow",sans-serif}section.comment-content{margin:0 0 0 12%}#reviewsTab .comments-area .comment-content{width:auto}section.comment-content .description,section.comment-content p{margin:15px 0}dl.geodir-tab-head dd a{background:#f3f3f3;margin-top:-1px;font-size:14px;padding:0 15px}dl.geodir-tab-head dd.geodir-tab-active a{padding-bottom:1px}.geodir-widget .geodir_list_heading,.geodir-widget h3.widget-title{padding:0 15px;background:#e9e9e9;border:1px solid #dbdbdb;height:38px;line-height:38px;color:#2d2d2d}.geodir-widget .geodir_list_heading h3{background:0 0;border:none}.geodir-widget .geodir_list_heading{margin:-13px -14px 13px}.geodir-map-listing-page{border-width:1px 0 0;border-style:solid;border-color:#dbdbdb}.geodir-sidebar-wrap .geodir-company_info{margin:15px}.geodir-details-sidebar-social-sharing iframe{float:left}.geodir-details-sidebar-rating{overflow:hidden}.geodir-details-sidebar-rating .gd_rating_show,.geodir-details-sidebar-rating .geodir-rating{float:left;margin-right:15px}.geodir-details-sidebar-rating span.item{float:left;margin-top:5px}.geodir-details-sidebar-rating .average-review{top:-4px;position:relative}.geodir-details-sidebar-rating span.item img{margin-top:5px}.geodir_full_page{background:#fff;border:1px solid #e1e1e1;-webkit-box-shadow:0 1px 0 #e5e5e5;box-shadow:0 1px 0 #e5e5e5;padding:15px;margin-bottom:20px;clear:both}.geodir_map_container .main_list img{margin:0 5px}.geodir_category_list_view li.geodir-gridview .geodir-post-img .geodir_thumbnail{margin-bottom:10px}.geodir-addinfo .geodir-pinpoint,.geodir-addinfo a i{margin-right:5px}.geodir_category_list_view li.geodir-gridview h3{font-size:18px;margin-bottom:10px}#related_listingTab ul.geodir_category_list_view{padding:0!important}#reviewsTab #comments .gd_rating{margin-top:5px}.widget .geodir_category_list_view li .geodir-entry-content,.widget .geodir_category_list_view li a:before{display:none!important}.geodir_category_list_view li .geodir-entry-title{margin-bottom:10px}.widget ul.geodir_category_list_view{padding:15px}.sidebar .widget .geodir_category_list_view li{width:calc(100% - 25px)}.widget .geodir-loginbox-list li{overflow:visible!important}.widget ul.chosen-results{margin:0!important}.main_list_selecter{margin-right:5px}.geodir-viewall{float:right;width:auto!important}.widget-title h2{padding:0 15px;background:#e9e9e9;border:1px solid #dbdbdb;height:38px;line-height:38px}.widget:first-child .geodir_list_heading .widget-title{margin-top:0}.geodir_list_heading .widget-title{float:left;width:80%;margin-top:0}.geodir_list_heading .widget-title h2{padding:0 px;background:0 0;border:none;height:auto;line-height:auto}.chosen-default:before{content:none;display:none;position:absolute;margin-left:-1000000px;float:left}#geodir-wrapper .entry-crumbs{margin-bottom:20px}.geodir-search .mom-select{float:left;width:150px;margin:5px;border:1px solid #ddd;height:40px}.iprelative .gm-style .gm-style-iw{width:100%!important}'),
|
|
| 697 | - 'geodir_theme_compat_js' => 'jQuery(document).ready(function(e){e(".geodir_full_page").length&&""===e.trim(e(".geodir_full_page").html())&&e(".geodir_full_page").css({display:"none"})});',
|
|
| 698 | - 'geodir_theme_compat_default_options' => '', |
|
| 699 | - 'geodir_theme_compat_code' => 'Multi_News' |
|
| 700 | - ); |
|
| 701 | - |
|
| 702 | - //Kelo |
|
| 703 | - $theme_compat['Kleo'] = array( |
|
| 704 | - 'geodir_theme_compat_code' => 'Kleo' |
|
| 705 | - ); |
|
| 706 | - |
|
| 707 | - update_option('gd_theme_compats', $theme_compat);
|
|
| 708 | - |
|
| 709 | - gd_set_theme_compat();// set the compat pack if avail |
|
| 655 | + $theme_compat['Multi_News'] = array( |
|
| 656 | + 'geodir_wrapper_open_id' => '', |
|
| 657 | + 'geodir_wrapper_open_class' => 'main-container clearfix', |
|
| 658 | + 'geodir_wrapper_open_replace' => '', |
|
| 659 | + 'geodir_wrapper_close_replace' => '', |
|
| 660 | + 'geodir_wrapper_content_open_id' => '', |
|
| 661 | + 'geodir_wrapper_content_open_class' => '', |
|
| 662 | + 'geodir_wrapper_content_open_replace' => '<div class="main-left" ><div class="main-content "><div class="site-content page-wrap">', |
|
| 663 | + 'geodir_wrapper_content_close_replace' => '</div></div></div>', |
|
| 664 | + 'geodir_article_open_id' => '', |
|
| 665 | + 'geodir_article_open_class' => '', |
|
| 666 | + 'geodir_article_open_replace' => '', |
|
| 667 | + 'geodir_article_close_replace' => '', |
|
| 668 | + 'geodir_sidebar_right_open_id' => '', |
|
| 669 | + 'geodir_sidebar_right_open_class' => '', |
|
| 670 | + 'geodir_sidebar_right_open_replace' => '<aside class="sidebar" role="complementary" itemscope itemtype="[itemtype]" >', |
|
| 671 | + 'geodir_sidebar_right_close_replace' => '', |
|
| 672 | + 'geodir_sidebar_left_open_id' => '', |
|
| 673 | + 'geodir_sidebar_left_open_class' => '', |
|
| 674 | + 'geodir_sidebar_left_open_replace' => '<aside class="secondary-sidebar" role="complementary" itemscope itemtype="[itemtype]" >', |
|
| 675 | + 'geodir_sidebar_left_close_replace' => '', |
|
| 676 | + 'geodir_main_content_open_id' => '', |
|
| 677 | + 'geodir_main_content_open_class' => '', |
|
| 678 | + 'geodir_main_content_open_replace' => '<div class="site-content page-wrap">', |
|
| 679 | + 'geodir_main_content_close_replace' => '</div>', |
|
| 680 | + 'geodir_top_content_add' => '', |
|
| 681 | + 'geodir_before_main_content_add' => '', |
|
| 682 | + 'geodir_full_page_class_filter' => 'section full-width-section', |
|
| 683 | + 'geodir_before_widget_filter' => '', |
|
| 684 | + 'geodir_after_widget_filter' => '', |
|
| 685 | + 'geodir_before_title_filter' => '<div class="widget-title"><h2>', |
|
| 686 | + 'geodir_after_title_filter' => '</h2></div>', |
|
| 687 | + 'geodir_menu_li_class_filter' => '', |
|
| 688 | + 'geodir_sub_menu_ul_class_filter' => '', |
|
| 689 | + 'geodir_sub_menu_li_class_filter' => '', |
|
| 690 | + 'geodir_menu_a_class_filter' => '', |
|
| 691 | + 'geodir_sub_menu_a_class_filter' => '', |
|
| 692 | + 'geodir_location_switcher_menu_li_class_filter' => '', |
|
| 693 | + 'geodir_location_switcher_menu_a_class_filter' => '', |
|
| 694 | + 'geodir_location_switcher_menu_sub_ul_class_filter' => '', |
|
| 695 | + 'geodir_location_switcher_menu_sub_li_class_filter' => '', |
|
| 696 | + 'geodir_theme_compat_css' => stripslashes('.full-width-section .geodir-search{margin:0;width:100%}.geodir_full_page .geodir-search{margin:0 auto;float:none}.geodir-search input[type=button],.geodir-search input[type=submit]{width:13%}.geodir-search input[type=text]{border:1px solid #ddd;border-radius:0;padding:0 8px}.geodir-category-list-in,.geodir-loc-bar-in{background:#f2f2f2;border-color:#dbdbdb}.geodir-category-list-in{margin-top:0}.geodir-cat-list .widget-title h2{margin:-13px -13px 13px}.widget .geodir-cat-list ul li.geodir-pcat-show a:before{display:none!important}.widget .geodir-cat-list ul li.geodir-pcat-show i{margin-right:5px}.container .geodir-search select{margin:0 3% 0 0;padding:8px 10px;width:13%}#geodir_carousel,#geodir_slider{border-radius:0;-webkit-border-radius:0;-moz-border-radius:0;margin-bottom:20px!important;border:1px solid #e1e1e1;box-shadow:none}#geodir_carousel{padding:10px}.geodir-tabs-content ol.commentlist{margin:40px 0;padding:0}li#post_mapTab{min-height:400px}#reviewsTab ol.commentlist li{border-bottom:none}#reviewsTab ol.commentlist li article.comment{border-bottom:1px solid #e1e1e1;padding-bottom:10px}.comment-content .rating{display:none}.comment-respond .gd_rating{margin-bottom:20px}div.geodir-rating{width:85px!important}.comment-respond .comment-notes{margin-bottom:10px}.average-review span,.comment-form label,.dtreviewed,.geodir-details-sidebar-user-links a,.geodir-viewall,.geodir_more_info span,.reviewer,dl.geodir-tab-head dd a{font-family:"Archivo Narrow",sans-serif}section.comment-content{margin:0 0 0 12%}#reviewsTab .comments-area .comment-content{width:auto}section.comment-content .description,section.comment-content p{margin:15px 0}dl.geodir-tab-head dd a{background:#f3f3f3;margin-top:-1px;font-size:14px;padding:0 15px}dl.geodir-tab-head dd.geodir-tab-active a{padding-bottom:1px}.geodir-widget .geodir_list_heading,.geodir-widget h3.widget-title{padding:0 15px;background:#e9e9e9;border:1px solid #dbdbdb;height:38px;line-height:38px;color:#2d2d2d}.geodir-widget .geodir_list_heading h3{background:0 0;border:none}.geodir-widget .geodir_list_heading{margin:-13px -14px 13px}.geodir-map-listing-page{border-width:1px 0 0;border-style:solid;border-color:#dbdbdb}.geodir-sidebar-wrap .geodir-company_info{margin:15px}.geodir-details-sidebar-social-sharing iframe{float:left}.geodir-details-sidebar-rating{overflow:hidden}.geodir-details-sidebar-rating .gd_rating_show,.geodir-details-sidebar-rating .geodir-rating{float:left;margin-right:15px}.geodir-details-sidebar-rating span.item{float:left;margin-top:5px}.geodir-details-sidebar-rating .average-review{top:-4px;position:relative}.geodir-details-sidebar-rating span.item img{margin-top:5px}.geodir_full_page{background:#fff;border:1px solid #e1e1e1;-webkit-box-shadow:0 1px 0 #e5e5e5;box-shadow:0 1px 0 #e5e5e5;padding:15px;margin-bottom:20px;clear:both}.geodir_map_container .main_list img{margin:0 5px}.geodir_category_list_view li.geodir-gridview .geodir-post-img .geodir_thumbnail{margin-bottom:10px}.geodir-addinfo .geodir-pinpoint,.geodir-addinfo a i{margin-right:5px}.geodir_category_list_view li.geodir-gridview h3{font-size:18px;margin-bottom:10px}#related_listingTab ul.geodir_category_list_view{padding:0!important}#reviewsTab #comments .gd_rating{margin-top:5px}.widget .geodir_category_list_view li .geodir-entry-content,.widget .geodir_category_list_view li a:before{display:none!important}.geodir_category_list_view li .geodir-entry-title{margin-bottom:10px}.widget ul.geodir_category_list_view{padding:15px}.sidebar .widget .geodir_category_list_view li{width:calc(100% - 25px)}.widget .geodir-loginbox-list li{overflow:visible!important}.widget ul.chosen-results{margin:0!important}.main_list_selecter{margin-right:5px}.geodir-viewall{float:right;width:auto!important}.widget-title h2{padding:0 15px;background:#e9e9e9;border:1px solid #dbdbdb;height:38px;line-height:38px}.widget:first-child .geodir_list_heading .widget-title{margin-top:0}.geodir_list_heading .widget-title{float:left;width:80%;margin-top:0}.geodir_list_heading .widget-title h2{padding:0 px;background:0 0;border:none;height:auto;line-height:auto}.chosen-default:before{content:none;display:none;position:absolute;margin-left:-1000000px;float:left}#geodir-wrapper .entry-crumbs{margin-bottom:20px}.geodir-search .mom-select{float:left;width:150px;margin:5px;border:1px solid #ddd;height:40px}.iprelative .gm-style .gm-style-iw{width:100%!important}'),
|
|
| 697 | + 'geodir_theme_compat_js' => 'jQuery(document).ready(function(e){e(".geodir_full_page").length&&""===e.trim(e(".geodir_full_page").html())&&e(".geodir_full_page").css({display:"none"})});',
|
|
| 698 | + 'geodir_theme_compat_default_options' => '', |
|
| 699 | + 'geodir_theme_compat_code' => 'Multi_News' |
|
| 700 | + ); |
|
| 701 | + |
|
| 702 | + //Kelo |
|
| 703 | + $theme_compat['Kleo'] = array( |
|
| 704 | + 'geodir_theme_compat_code' => 'Kleo' |
|
| 705 | + ); |
|
| 706 | + |
|
| 707 | + update_option('gd_theme_compats', $theme_compat);
|
|
| 708 | + |
|
| 709 | + gd_set_theme_compat();// set the compat pack if avail |
|
| 710 | 710 | } |
| 711 | 711 | |
| 712 | 712 | |
@@ -718,61 +718,61 @@ discard block |
||
| 718 | 718 | * @global object $wpdb WordPress Database object. |
| 719 | 719 | */ |
| 720 | 720 | function gd_convert_virtual_pages(){
|
| 721 | - global $wpdb; |
|
| 722 | - |
|
| 723 | - // Update the add listing page settings |
|
| 724 | - $add_listing_page = $wpdb->get_var( |
|
| 725 | - $wpdb->prepare( |
|
| 726 | - "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;", |
|
| 727 | - array('add-listing')
|
|
| 728 | - ) |
|
| 729 | - ); |
|
| 730 | - |
|
| 731 | - if($add_listing_page){
|
|
| 732 | - wp_update_post( array('ID' => $add_listing_page, 'post_status' => 'publish') );
|
|
| 733 | - update_option( 'geodir_add_listing_page', $add_listing_page); |
|
| 734 | - } |
|
| 735 | - |
|
| 736 | - // Update the listing preview page settings |
|
| 737 | - $listing_preview_page = $wpdb->get_var( |
|
| 738 | - $wpdb->prepare( |
|
| 739 | - "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;", |
|
| 740 | - array('listing-preview')
|
|
| 741 | - ) |
|
| 742 | - ); |
|
| 743 | - |
|
| 744 | - if($listing_preview_page){
|
|
| 745 | - wp_update_post( array('ID' => $listing_preview_page, 'post_status' => 'publish') );
|
|
| 746 | - update_option( 'geodir_preview_page', $listing_preview_page); |
|
| 747 | - } |
|
| 748 | - |
|
| 749 | - // Update the listing success page settings |
|
| 750 | - $listing_success_page = $wpdb->get_var( |
|
| 751 | - $wpdb->prepare( |
|
| 752 | - "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;", |
|
| 753 | - array('listing-success')
|
|
| 754 | - ) |
|
| 755 | - ); |
|
| 756 | - |
|
| 757 | - if($listing_success_page){
|
|
| 758 | - wp_update_post( array('ID' => $listing_success_page, 'post_status' => 'publish') );
|
|
| 759 | - update_option( 'geodir_success_page', $listing_success_page); |
|
| 760 | - } |
|
| 761 | - |
|
| 762 | - // Update the listing success page settings |
|
| 763 | - $location_page = $wpdb->get_var( |
|
| 764 | - $wpdb->prepare( |
|
| 765 | - "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;", |
|
| 766 | - array('location')
|
|
| 767 | - ) |
|
| 768 | - ); |
|
| 769 | - |
|
| 770 | - if($location_page){
|
|
| 771 | - $location_slug = get_option('geodir_location_prefix');
|
|
| 772 | - if(!$location_slug ){$location_slug = 'location';}
|
|
| 773 | - wp_update_post( array('ID' => $location_page, 'post_status' => 'publish','post_name' => $location_slug) );
|
|
| 774 | - update_option( 'geodir_location_page', $location_page); |
|
| 775 | - } |
|
| 721 | + global $wpdb; |
|
| 722 | + |
|
| 723 | + // Update the add listing page settings |
|
| 724 | + $add_listing_page = $wpdb->get_var( |
|
| 725 | + $wpdb->prepare( |
|
| 726 | + "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;", |
|
| 727 | + array('add-listing')
|
|
| 728 | + ) |
|
| 729 | + ); |
|
| 730 | + |
|
| 731 | + if($add_listing_page){
|
|
| 732 | + wp_update_post( array('ID' => $add_listing_page, 'post_status' => 'publish') );
|
|
| 733 | + update_option( 'geodir_add_listing_page', $add_listing_page); |
|
| 734 | + } |
|
| 735 | + |
|
| 736 | + // Update the listing preview page settings |
|
| 737 | + $listing_preview_page = $wpdb->get_var( |
|
| 738 | + $wpdb->prepare( |
|
| 739 | + "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;", |
|
| 740 | + array('listing-preview')
|
|
| 741 | + ) |
|
| 742 | + ); |
|
| 743 | + |
|
| 744 | + if($listing_preview_page){
|
|
| 745 | + wp_update_post( array('ID' => $listing_preview_page, 'post_status' => 'publish') );
|
|
| 746 | + update_option( 'geodir_preview_page', $listing_preview_page); |
|
| 747 | + } |
|
| 748 | + |
|
| 749 | + // Update the listing success page settings |
|
| 750 | + $listing_success_page = $wpdb->get_var( |
|
| 751 | + $wpdb->prepare( |
|
| 752 | + "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;", |
|
| 753 | + array('listing-success')
|
|
| 754 | + ) |
|
| 755 | + ); |
|
| 756 | + |
|
| 757 | + if($listing_success_page){
|
|
| 758 | + wp_update_post( array('ID' => $listing_success_page, 'post_status' => 'publish') );
|
|
| 759 | + update_option( 'geodir_success_page', $listing_success_page); |
|
| 760 | + } |
|
| 761 | + |
|
| 762 | + // Update the listing success page settings |
|
| 763 | + $location_page = $wpdb->get_var( |
|
| 764 | + $wpdb->prepare( |
|
| 765 | + "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;", |
|
| 766 | + array('location')
|
|
| 767 | + ) |
|
| 768 | + ); |
|
| 769 | + |
|
| 770 | + if($location_page){
|
|
| 771 | + $location_slug = get_option('geodir_location_prefix');
|
|
| 772 | + if(!$location_slug ){$location_slug = 'location';}
|
|
| 773 | + wp_update_post( array('ID' => $location_page, 'post_status' => 'publish','post_name' => $location_slug) );
|
|
| 774 | + update_option( 'geodir_location_page', $location_page); |
|
| 775 | + } |
|
| 776 | 776 | |
| 777 | 777 | } |
| 778 | 778 | |
@@ -786,31 +786,31 @@ discard block |
||
| 786 | 786 | function gd_fix_cpt_rewrite_slug() |
| 787 | 787 | {
|
| 788 | 788 | |
| 789 | - $alt_post_types = array(); |
|
| 790 | - $post_types = get_option('geodir_post_types');
|
|
| 789 | + $alt_post_types = array(); |
|
| 790 | + $post_types = get_option('geodir_post_types');
|
|
| 791 | 791 | |
| 792 | 792 | |
| 793 | - if (is_array($post_types)){
|
|
| 793 | + if (is_array($post_types)){
|
|
| 794 | 794 | |
| 795 | - foreach ($post_types as $post_type => $args) {
|
|
| 795 | + foreach ($post_types as $post_type => $args) {
|
|
| 796 | 796 | |
| 797 | 797 | |
| 798 | - if(isset($args['rewrite']['slug'])){
|
|
| 799 | - $args['rewrite']['slug'] = str_replace("/%gd_taxonomy%","",$args['rewrite']['slug']);
|
|
| 800 | - } |
|
| 798 | + if(isset($args['rewrite']['slug'])){
|
|
| 799 | + $args['rewrite']['slug'] = str_replace("/%gd_taxonomy%","",$args['rewrite']['slug']);
|
|
| 800 | + } |
|
| 801 | 801 | |
| 802 | - $alt_post_types[$post_type] = $args; |
|
| 802 | + $alt_post_types[$post_type] = $args; |
|
| 803 | 803 | |
| 804 | - } |
|
| 805 | - } |
|
| 804 | + } |
|
| 805 | + } |
|
| 806 | 806 | |
| 807 | - if(!empty($alt_post_types)) {
|
|
| 808 | - update_option('geodir_post_types',$alt_post_types);
|
|
| 809 | - } |
|
| 807 | + if(!empty($alt_post_types)) {
|
|
| 808 | + update_option('geodir_post_types',$alt_post_types);
|
|
| 809 | + } |
|
| 810 | 810 | |
| 811 | 811 | |
| 812 | - // flush the rewrite rules |
|
| 813 | - flush_rewrite_rules(); |
|
| 812 | + // flush the rewrite rules |
|
| 813 | + flush_rewrite_rules(); |
|
| 814 | 814 | } |
| 815 | 815 | |
| 816 | 816 | |
@@ -823,18 +823,18 @@ discard block |
||
| 823 | 823 | */ |
| 824 | 824 | function gd_fix_address_detail_table_limit() |
| 825 | 825 | {
|
| 826 | - global $wpdb; |
|
| 827 | - |
|
| 828 | - $all_postypes = geodir_get_posttypes(); |
|
| 829 | - |
|
| 830 | - if (!empty($all_postypes)) {
|
|
| 831 | - foreach ($all_postypes as $key) {
|
|
| 832 | - // update each GD CTP |
|
| 833 | - try {
|
|
| 834 | - $wpdb->query("ALTER TABLE " . $wpdb->prefix . "geodir_" . $key . "_detail MODIFY post_city VARCHAR( 50 ) NULL,MODIFY post_region VARCHAR( 50 ) NULL,MODIFY post_country VARCHAR( 50 ) NULL");
|
|
| 835 | - } catch(Exception $e) {
|
|
| 836 | - error_log( 'Error: ' . $e->getMessage() ); |
|
| 837 | - } |
|
| 838 | - } |
|
| 839 | - } |
|
| 826 | + global $wpdb; |
|
| 827 | + |
|
| 828 | + $all_postypes = geodir_get_posttypes(); |
|
| 829 | + |
|
| 830 | + if (!empty($all_postypes)) {
|
|
| 831 | + foreach ($all_postypes as $key) {
|
|
| 832 | + // update each GD CTP |
|
| 833 | + try {
|
|
| 834 | + $wpdb->query("ALTER TABLE " . $wpdb->prefix . "geodir_" . $key . "_detail MODIFY post_city VARCHAR( 50 ) NULL,MODIFY post_region VARCHAR( 50 ) NULL,MODIFY post_country VARCHAR( 50 ) NULL");
|
|
| 835 | + } catch(Exception $e) {
|
|
| 836 | + error_log( 'Error: ' . $e->getMessage() ); |
|
| 837 | + } |
|
| 838 | + } |
|
| 839 | + } |
|
| 840 | 840 | } |