@@ -49,13 +49,13 @@ |
||
49 | 49 | </h4> |
50 | 50 | <?php |
51 | 51 | if (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'fw') { |
52 | - echo "<p class=\"error_msg\"> " . INVALID_USER_FPW_MSG . " </p>"; |
|
52 | + echo "<p class=\"error_msg\"> ".INVALID_USER_FPW_MSG." </p>"; |
|
53 | 53 | } elseif (isset($_REQUEST['logemsg']) && $_REQUEST['logemsg'] == 1) { |
54 | - echo "<p class=\"error_msg\"> " . INVALID_USER_PW_MSG . " </p>"; |
|
54 | + echo "<p class=\"error_msg\"> ".INVALID_USER_PW_MSG." </p>"; |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | if (isset($_REQUEST['checkemail']) && $_REQUEST['checkemail'] == 'confirm') |
58 | - echo '<p class="sucess_msg">' . PW_SEND_CONFIRM_MSG . '</p>'; |
|
58 | + echo '<p class="sucess_msg">'.PW_SEND_CONFIRM_MSG.'</p>'; |
|
59 | 59 | |
60 | 60 | ?> |
61 | 61 | <form name="cus_loginform" id="cus_loginform" action="<?php echo esc_url(geodir_curPageURL()); ?>" |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | if ($redirect) { |
23 | 23 | ?> |
24 | 24 | <script type="text/javascript"> |
25 | - window.location.href = '<?php echo geodir_login_url();?>'; |
|
25 | + window.location.href = '<?php echo geodir_login_url(); ?>'; |
|
26 | 26 | </script> |
27 | 27 | <?php |
28 | 28 | } else |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | wp_redirect(preg_replace('|^http://|', 'https://', $_SERVER['REQUEST_URI'])); |
48 | 48 | exit(); |
49 | 49 | } else { |
50 | - wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); |
|
50 | + wp_redirect('https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); |
|
51 | 51 | exit(); |
52 | 52 | } |
53 | 53 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * @param string $message Login message. |
61 | 61 | */ |
62 | 62 | $message = apply_filters('login_message', $message); |
63 | - if (!empty($message)) echo $message . "\n"; |
|
63 | + if (!empty($message)) echo $message."\n"; |
|
64 | 64 | |
65 | 65 | } |
66 | 66 | |
@@ -208,9 +208,9 @@ discard block |
||
208 | 208 | |
209 | 209 | wp_set_password($new_pass, $user->ID); |
210 | 210 | update_user_meta($user->ID, 'default_password_nag', true); //Set up the Password change nag. |
211 | - $message = '<p><b>' . __('Your login Information :', 'geodirectory') . '</b></p>'; |
|
212 | - $message .= '<p>' . sprintf(__('Username: %s', 'geodirectory'), $user->user_login) . "</p>"; |
|
213 | - $message .= '<p>' . sprintf(__('Password: %s', 'geodirectory'), $new_pass) . "</p>"; |
|
211 | + $message = '<p><b>'.__('Your login Information :', 'geodirectory').'</b></p>'; |
|
212 | + $message .= '<p>'.sprintf(__('Username: %s', 'geodirectory'), $user->user_login)."</p>"; |
|
213 | + $message .= '<p>'.sprintf(__('Password: %s', 'geodirectory'), $new_pass)."</p>"; |
|
214 | 214 | //$message .= '<p>You can login to : <a href="'.home_url().'/?ptype=login' . "\">Login</a> or the URL is : ".home_url()."/?ptype=login</p>"; |
215 | 215 | //$message .= '<p>Thank You,<br> '.get_option('blogname').'</p>'; |
216 | 216 | $user_email = $user_data->user_email; |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | */ |
237 | 237 | $message = apply_filters('password_reset_message', $message, $new_pass); |
238 | 238 | //geodir_sendEmail($fromEmail,$fromEmailName,$user_email,$user_name,$title,$message,$extra='');///forgot password email |
239 | - geodir_sendEmail($fromEmail, $fromEmailName, $user_email, $user_name, $title, $message, $extra = '', 'forgot_password', $post_id = '', $user->ID);///forgot password email |
|
239 | + geodir_sendEmail($fromEmail, $fromEmailName, $user_email, $user_name, $title, $message, $extra = '', 'forgot_password', $post_id = '', $user->ID); ///forgot password email |
|
240 | 240 | |
241 | 241 | return true; |
242 | 242 | } |
@@ -390,13 +390,13 @@ discard block |
||
390 | 390 | ///////REGISTRATION EMAIL START////// |
391 | 391 | $fromEmail = geodir_get_site_email_id(); |
392 | 392 | $fromEmailName = get_site_emailName(); |
393 | - $message = __('<p><b>' . __('Your login Information :', 'geodirectory') . '</b></p> |
|
394 | -<p>' . __('Username:', 'geodirectory') . ' ' . $user_login . '</p> |
|
395 | -<p>' . __('Password:', 'geodirectory') . ' ' . $user_pass . '</p>'); |
|
393 | + $message = __('<p><b>'.__('Your login Information :', 'geodirectory').'</b></p> |
|
394 | +<p>' . __('Username:', 'geodirectory').' '.$user_login.'</p> |
|
395 | +<p>' . __('Password:', 'geodirectory').' '.$user_pass.'</p>'); |
|
396 | 396 | |
397 | 397 | /////////////customer email////////////// |
398 | 398 | //geodir_sendEmail($fromEmail,$fromEmailName,$user_email,$userName,$subject,$client_message,$extra='');///To client email |
399 | - geodir_sendEmail($fromEmail, $fromEmailName, $user_email, $userName, '', $message, '', 'registration', '', $user_id);/// registration email |
|
399 | + geodir_sendEmail($fromEmail, $fromEmailName, $user_email, $userName, '', $message, '', 'registration', '', $user_id); /// registration email |
|
400 | 400 | //////REGISTRATION EMAIL END//////// |
401 | 401 | } |
402 | 402 | |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | $action = 'resetpass'; |
428 | 428 | |
429 | 429 | // validate action so as to default to the login screen |
430 | - if (!in_array($action, array('logout', 'lostpassword', 'retrievepassword', 'resetpass', 'rp', 'register', 'login')) && false === has_filter('login_form_' . $action)) |
|
430 | + if (!in_array($action, array('logout', 'lostpassword', 'retrievepassword', 'resetpass', 'rp', 'register', 'login')) && false === has_filter('login_form_'.$action)) |
|
431 | 431 | $action = 'login'; |
432 | 432 | |
433 | 433 | nocache_headers(); |
@@ -437,8 +437,8 @@ discard block |
||
437 | 437 | $_SERVER['PHP_SELF'] = str_replace($_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF']); |
438 | 438 | |
439 | 439 | $schema = (isset($_SERVER['HTTPS']) && geodir_strtolower($_SERVER['HTTPS']) == 'on') ? 'https://' : 'http://'; |
440 | - if (dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) != home_url()) |
|
441 | - update_option('siteurl', dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'])); |
|
440 | + if (dirname($schema.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']) != home_url()) |
|
441 | + update_option('siteurl', dirname($schema.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'])); |
|
442 | 442 | } |
443 | 443 | |
444 | 444 | //Set a cookie now to see if they are supported by the browser. |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | * |
454 | 454 | * @since 1.0.0 |
455 | 455 | */ |
456 | - do_action('login_form_' . $action); |
|
456 | + do_action('login_form_'.$action); |
|
457 | 457 | |
458 | 458 | $http_post = ('POST' == $_SERVER['REQUEST_METHOD']); |
459 | 459 | |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | * @since 1.0.0 |
494 | 494 | */ |
495 | 495 | do_action('lost_password'); |
496 | - $message = '<div class="sucess_msg">' . ENTER_USER_EMAIL_NEW_PW_MSG . '</div>'; |
|
496 | + $message = '<div class="sucess_msg">'.ENTER_USER_EMAIL_NEW_PW_MSG.'</div>'; |
|
497 | 497 | $user_login = isset($_POST['user_login']) ? stripslashes($_POST['user_login']) : ''; |
498 | 498 | |
499 | 499 | break; |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | exit(); |
508 | 508 | } |
509 | 509 | |
510 | - wp_redirect(geodir_login_url(array('error'=>'invalidkey','action'=>'lostpassword'))); |
|
510 | + wp_redirect(geodir_login_url(array('error'=>'invalidkey', 'action'=>'lostpassword'))); |
|
511 | 511 | exit(); |
512 | 512 | |
513 | 513 | break; |
@@ -682,7 +682,7 @@ discard block |
||
682 | 682 | |
683 | 683 | if (is_wp_error($user)) { |
684 | 684 | if (isset($_SERVER['HTTP_REFERER']) && strstr($_SERVER['HTTP_REFERER'], 'ptype=property_submit') && $_POST['log'] != '' && $_POST['pwd'] != '') { |
685 | - wp_redirect($_SERVER['HTTP_REFERER'] . '&emsg=1'); |
|
685 | + wp_redirect($_SERVER['HTTP_REFERER'].'&emsg=1'); |
|
686 | 686 | } |
687 | 687 | } |
688 | 688 | if (!is_wp_error($user)) { |
@@ -710,7 +710,7 @@ discard block |
||
710 | 710 | |
711 | 711 | // Some parts of this script use the main login form to display a message |
712 | 712 | if (isset($_GET['loggedout']) && TRUE == $_GET['loggedout']) { |
713 | - $successmsg = '<div class="sucess_msg">' . YOU_ARE_LOGED_OUT_MSG . '</div>'; |
|
713 | + $successmsg = '<div class="sucess_msg">'.YOU_ARE_LOGED_OUT_MSG.'</div>'; |
|
714 | 714 | } elseif (isset($_GET['registration']) && 'disabled' == $_GET['registration']) { |
715 | 715 | $successmsg = USER_REG_NOT_ALLOW_MSG; |
716 | 716 | } elseif (isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail']) { |
@@ -723,9 +723,9 @@ discard block |
||
723 | 723 | |
724 | 724 | if ((isset($_POST['log']) && $_POST['log'] != '' && $errors) || ((!isset($_POST['log']) || $_POST['log'] == '') && isset($_REQUEST['testcookie']) && $_REQUEST['testcookie'])) { |
725 | 725 | if (isset($_REQUEST['pagetype']) && $_REQUEST['pagetype'] != '') { |
726 | - wp_redirect($_REQUEST['pagetype'] . '&emsg=1'); |
|
726 | + wp_redirect($_REQUEST['pagetype'].'&emsg=1'); |
|
727 | 727 | } else { |
728 | - wp_redirect(geodir_login_url(array('logemsg'=>'1','redirect_to'=>urlencode($_REQUEST['redirect_to'])))); |
|
728 | + wp_redirect(geodir_login_url(array('logemsg'=>'1', 'redirect_to'=>urlencode($_REQUEST['redirect_to'])))); |
|
729 | 729 | } |
730 | 730 | gd_die(); |
731 | 731 | } |
@@ -24,12 +24,12 @@ discard block |
||
24 | 24 | */ |
25 | 25 | |
26 | 26 | $config = array( |
27 | - 'id' => 'demo_meta_box', // meta box id, unique per meta box |
|
28 | - 'title' => __('Demo Meta Box', 'geodirectory'), // meta box title |
|
29 | - 'pages' => geodir_get_taxonomies(), // taxonomy name, accept categories, post_tag and custom taxonomies |
|
30 | - 'context' => 'normal', // where the meta box appear: normal (default), advanced, side; optional |
|
31 | - 'fields' => array(), // list of meta fields (can be added by field arrays) |
|
32 | - 'local_images' => false, // Use local or hosted images (meta box images for add/remove) |
|
27 | + 'id' => 'demo_meta_box', // meta box id, unique per meta box |
|
28 | + 'title' => __('Demo Meta Box', 'geodirectory'), // meta box title |
|
29 | + 'pages' => geodir_get_taxonomies(), // taxonomy name, accept categories, post_tag and custom taxonomies |
|
30 | + 'context' => 'normal', // where the meta box appear: normal (default), advanced, side; optional |
|
31 | + 'fields' => array(), // list of meta fields (can be added by field arrays) |
|
32 | + 'local_images' => false, // Use local or hosted images (meta box images for add/remove) |
|
33 | 33 | 'use_with_theme' => true //change path if used with theme set to true, false for a plugin or anything else for a custom path(default false). |
34 | 34 | ); |
35 | 35 | |
@@ -38,18 +38,18 @@ discard block |
||
38 | 38 | * Initiate your meta box |
39 | 39 | */ |
40 | 40 | $my_meta = new Tax_Meta_Class($config); |
41 | - $my_meta->addWysiwyg($prefix . 'cat_top_desc', array('name' => __('Category Top Description', 'geodirectory'), 'desc' => __('This will appear at the top of the category listing.', 'geodirectory'))); |
|
42 | - $my_meta->addImage($prefix . 'cat_default_img', array('name' => __('Default Listing Image', 'geodirectory'), 'desc' => __('Choose a default "no image"', 'geodirectory'))); |
|
43 | - $my_meta->addImage($prefix . 'cat_icon', array('name' => __('Category Icon', 'geodirectory'), 'desc' => __('Choose a category icon', 'geodirectory'), 'validate_func' => '!empty')); |
|
41 | + $my_meta->addWysiwyg($prefix.'cat_top_desc', array('name' => __('Category Top Description', 'geodirectory'), 'desc' => __('This will appear at the top of the category listing.', 'geodirectory'))); |
|
42 | + $my_meta->addImage($prefix.'cat_default_img', array('name' => __('Default Listing Image', 'geodirectory'), 'desc' => __('Choose a default "no image"', 'geodirectory'))); |
|
43 | + $my_meta->addImage($prefix.'cat_icon', array('name' => __('Category Icon', 'geodirectory'), 'desc' => __('Choose a category icon', 'geodirectory'), 'validate_func' => '!empty')); |
|
44 | 44 | /*$my_meta->addCheckbox($prefix.'pointless',array('name'=> __('<b>Exclude</b> Rating sort option','geodirectory'),'style'=>'hidden'));*/// hidden setting to trick WPML |
45 | 45 | |
46 | - $my_meta->addSelect($prefix . 'cat_schema', |
|
46 | + $my_meta->addSelect($prefix.'cat_schema', |
|
47 | 47 | /* |
48 | 48 | * Allows you to add/filter the cat schema types. |
49 | 49 | * |
50 | 50 | * @since 1.5.7 |
51 | 51 | */ |
52 | - apply_filters('geodir_cat_schemas',array( |
|
52 | + apply_filters('geodir_cat_schemas', array( |
|
53 | 53 | '' => __('Default (LocalBusiness)', 'geodirectory'), |
54 | 54 | 'AccountingService' => 'AccountingService', |
55 | 55 | 'Attorney' => 'Attorney', |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | 'WholesaleStore' => 'WholesaleStore', |
142 | 142 | 'Winery' => 'Winery' |
143 | 143 | )), |
144 | - array('name' => __('Schema Type', 'geodirectory'), 'desc' => __('Select the Schema to use for this category', 'geodirectory') . "", 'std' => array('selectkey2'))); |
|
144 | + array('name' => __('Schema Type', 'geodirectory'), 'desc' => __('Select the Schema to use for this category', 'geodirectory')."", 'std' => array('selectkey2'))); |
|
145 | 145 | |
146 | 146 | /*$my_meta->addSelect($prefix.'cat_sort',array(''=>__('Default' , 'geodirectory'), |
147 | 147 | 'random'=>__('Random','geodirectory'), |
@@ -179,8 +179,8 @@ discard block |
||
179 | 179 | if (!empty($gd_taxonomies)) { |
180 | 180 | foreach ($gd_taxonomies as $gd_taxonomy) { |
181 | 181 | |
182 | - add_filter('manage_edit-' . $gd_taxonomy . '_columns', 'addCat_column', 10, 2); |
|
183 | - add_action('manage_' . $gd_taxonomy . '_custom_column', 'manage_category_custom_fields', 10, 3); |
|
182 | + add_filter('manage_edit-'.$gd_taxonomy.'_columns', 'addCat_column', 10, 2); |
|
183 | + add_action('manage_'.$gd_taxonomy.'_custom_column', 'manage_category_custom_fields', 10, 3); |
|
184 | 184 | |
185 | 185 | } |
186 | 186 | } |
@@ -214,9 +214,9 @@ discard block |
||
214 | 214 | |
215 | 215 | $file_info = pathinfo($term_icon_url['src']); |
216 | 216 | |
217 | - if (isset($file_info['dirname'] ) && $file_info['dirname'] != '.' && $file_info['dirname'] != '..') |
|
217 | + if (isset($file_info['dirname']) && $file_info['dirname'] != '.' && $file_info['dirname'] != '..') |
|
218 | 218 | $sub_dir = $file_info['dirname']; |
219 | - else{$sub_dir = '';} |
|
219 | + else {$sub_dir = ''; } |
|
220 | 220 | |
221 | 221 | $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs |
222 | 222 | $uploads_baseurl = $uploads['baseurl']; |
@@ -226,10 +226,10 @@ discard block |
||
226 | 226 | |
227 | 227 | $sub_dir = str_replace($uploads_baseurl, '', $sub_dir); |
228 | 228 | |
229 | - $uploads_url = $uploads_baseurl . $sub_dir; |
|
229 | + $uploads_url = $uploads_baseurl.$sub_dir; |
|
230 | 230 | |
231 | - $term_icon_url['src'] = $uploads_url . '/' . $file_name; |
|
232 | - echo '<img src="' . $term_icon_url['src'] . '" />'; |
|
231 | + $term_icon_url['src'] = $uploads_url.'/'.$file_name; |
|
232 | + echo '<img src="'.$term_icon_url['src'].'" />'; |
|
233 | 233 | |
234 | 234 | } |
235 | 235 | } |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | if ($column_name == 'cat_default_img') { |
238 | 238 | $cat_default_img = get_tax_meta($term_id, 'ct_cat_default_img'); |
239 | 239 | if ($cat_default_img != '') |
240 | - echo '<img src="' . $cat_default_img['src'] . '" style="max-height:60px;max-width:60px;"/>'; |
|
240 | + echo '<img src="'.$cat_default_img['src'].'" style="max-height:60px;max-width:60px;"/>'; |
|
241 | 241 | |
242 | 242 | } |
243 | 243 | } |
@@ -268,8 +268,8 @@ discard block |
||
268 | 268 | jQuery("#addtag iframe").contents().find("body").html(''); |
269 | 269 | jQuery('#addtag [rel="ct_cat_default_img"]').removeClass('at-delete_image_button').addClass('at-upload_image_button'); |
270 | 270 | jQuery('#addtag [rel="ct_cat_icon"]').removeClass('at-delete_image_button').addClass('at-upload_image_button'); |
271 | - jQuery('#addtag [rel="ct_cat_default_img"]').val('<?php _e('Upload Image','geodirectory');?>'); |
|
272 | - jQuery('#addtag [rel="ct_cat_icon"]').val('<?php _e('Upload Image','geodirectory');?>'); |
|
271 | + jQuery('#addtag [rel="ct_cat_default_img"]').val('<?php _e('Upload Image', 'geodirectory'); ?>'); |
|
272 | + jQuery('#addtag [rel="ct_cat_icon"]').val('<?php _e('Upload Image', 'geodirectory'); ?>'); |
|
273 | 273 | } |
274 | 274 | }, 1000); |
275 | 275 |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | $this->add_missed_values(); |
114 | 114 | if (isset($meta_box['use_with_theme'])) |
115 | 115 | if ($meta_box['use_with_theme'] === true) { |
116 | - $this->SelfPath = get_stylesheet_directory_uri() . '/library/cat-meta'; |
|
116 | + $this->SelfPath = get_stylesheet_directory_uri().'/library/cat-meta'; |
|
117 | 117 | } elseif ($meta_box['use_with_theme'] === false) { |
118 | 118 | $this->SelfPath = plugins_url('cat-meta-functions', plugin_basename(dirname(__FILE__))); |
119 | 119 | } else { |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | $li = "<li id='item_{$attachment_id}'>"; |
263 | 263 | $li .= "<img src='{$attachment['url']}' alt='image_{$attachment_id}' />"; |
264 | 264 | //$li .= "<a title='" . __( 'Delete this image' ) . "' class='at-delete-file' href='#' rel='{$nonce}|{$term_id}|{$id}|{$attachment_id}'>" . __( 'Delete' ) . "</a>"; |
265 | - $li .= "<a title='" . __('Remove this image', 'geodirectory') . "' class='at-delete-file' href='#' rel='{$nonce}|{$term_id}|{$id}|{$attachment_id}'><img src='" . $this->SelfPath . "/images/delete-16.png' alt='" . __('Remove', 'geodirectory') . "' /></a>"; |
|
265 | + $li .= "<a title='".__('Remove this image', 'geodirectory')."' class='at-delete-file' href='#' rel='{$nonce}|{$term_id}|{$id}|{$attachment_id}'><img src='".$this->SelfPath."/images/delete-16.png' alt='".__('Remove', 'geodirectory')."' /></a>"; |
|
266 | 266 | $li .= "<input type='hidden' name='{$id}[]' value='{$attachment_id}' />"; |
267 | 267 | $li .= "</li>"; |
268 | 268 | $html .= $li; |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | $attachment_id = isset($_GET['attachment_id']) ? intval($_GET['attachment_id']) : 0; |
336 | 336 | $ok = false; |
337 | 337 | if (strpos($field_id, '[') === false) { |
338 | - check_admin_referer("at-delete-mupload_" . urldecode($field_id)); |
|
338 | + check_admin_referer("at-delete-mupload_".urldecode($field_id)); |
|
339 | 339 | if ($term_id > 0) |
340 | 340 | $this->delete_tax_meta($term_id, $field_id); |
341 | 341 | //$ok = wp_delete_attachment( $attachment_id ); |
@@ -423,8 +423,8 @@ discard block |
||
423 | 423 | |
424 | 424 | if ($this->has_field('date') && $this->is_edit_page()) { |
425 | 425 | // Enqueu JQuery UI, use proper version. |
426 | - wp_enqueue_style('tmc-jquery-ui-css', 'http://ajax.googleapis.com/ajax/libs/jqueryui/' . $this->get_jqueryui_ver() . '/themes/base/jquery-ui.css'); |
|
427 | - wp_enqueue_script('tmc-jquery-ui', 'https://ajax.googleapis.com/ajax/libs/jqueryui/' . $this->get_jqueryui_ver() . '/jquery-ui.min.js', array('jquery')); |
|
426 | + wp_enqueue_style('tmc-jquery-ui-css', 'http://ajax.googleapis.com/ajax/libs/jqueryui/'.$this->get_jqueryui_ver().'/themes/base/jquery-ui.css'); |
|
427 | + wp_enqueue_script('tmc-jquery-ui', 'https://ajax.googleapis.com/ajax/libs/jqueryui/'.$this->get_jqueryui_ver().'/jquery-ui.min.js', array('jquery')); |
|
428 | 428 | } |
429 | 429 | |
430 | 430 | } |
@@ -441,8 +441,8 @@ discard block |
||
441 | 441 | if ($this->has_field('time') && $this->is_edit_page()) { |
442 | 442 | |
443 | 443 | // Enqueu JQuery UI, use proper version. |
444 | - wp_enqueue_style('tmc-jquery-ui-css', 'https://ajax.googleapis.com/ajax/libs/jqueryui/' . $this->get_jqueryui_ver() . '/themes/base/jquery-ui.css', array(), false, true); |
|
445 | - wp_enqueue_script('tmc-jquery-ui', 'https://ajax.googleapis.com/ajax/libs/jqueryui/' . $this->get_jqueryui_ver() . '/jquery-ui.min.js', array('jquery'), false, true); |
|
444 | + wp_enqueue_style('tmc-jquery-ui-css', 'https://ajax.googleapis.com/ajax/libs/jqueryui/'.$this->get_jqueryui_ver().'/themes/base/jquery-ui.css', array(), false, true); |
|
445 | + wp_enqueue_script('tmc-jquery-ui', 'https://ajax.googleapis.com/ajax/libs/jqueryui/'.$this->get_jqueryui_ver().'/jquery-ui.min.js', array('jquery'), false, true); |
|
446 | 446 | wp_enqueue_script('at-timepicker', 'https://github.com/trentrichardson/jQuery-Timepicker-Addon/raw/master/jquery-ui-timepicker-addon.js', array('tmc-jquery-ui'), false, true); |
447 | 447 | |
448 | 448 | } |
@@ -462,13 +462,13 @@ discard block |
||
462 | 462 | if (!empty($this->_meta_box['pages'])) { |
463 | 463 | foreach ($this->_meta_box['pages'] as $page) { |
464 | 464 | //add fields to edit form |
465 | - add_action($page . '_edit_form_fields', array(&$this, 'show_edit_form')); |
|
465 | + add_action($page.'_edit_form_fields', array(&$this, 'show_edit_form')); |
|
466 | 466 | //add fields to add new form |
467 | - add_action($page . '_add_form_fields', array(&$this, 'show_new_form')); |
|
467 | + add_action($page.'_add_form_fields', array(&$this, 'show_new_form')); |
|
468 | 468 | // this saves the edit fields |
469 | - add_action('edited_' . $page, array(&$this, 'save'), 10, 2); |
|
469 | + add_action('edited_'.$page, array(&$this, 'save'), 10, 2); |
|
470 | 470 | // this saves the add fields |
471 | - add_action('created_' . $page, array(&$this, 'save'), 10, 2); |
|
471 | + add_action('created_'.$page, array(&$this, 'save'), 10, 2); |
|
472 | 472 | } |
473 | 473 | } |
474 | 474 | |
@@ -517,13 +517,13 @@ discard block |
||
517 | 517 | $meta = is_array($meta) ? array_map('esc_attr', $meta) : esc_attr($meta); |
518 | 518 | |
519 | 519 | if ($field['validate_func']) { |
520 | - echo '<tr class="form-field form-required ' . $field['style'] . '">'; |
|
520 | + echo '<tr class="form-field form-required '.$field['style'].'">'; |
|
521 | 521 | } else { |
522 | - echo '<tr class="form-field ' . $field['style'] . '">'; |
|
522 | + echo '<tr class="form-field '.$field['style'].'">'; |
|
523 | 523 | } |
524 | 524 | |
525 | 525 | // Call Separated methods for displaying each type of field. |
526 | - call_user_func(array(&$this, 'show_field_' . $field['type']), $field, $meta); |
|
526 | + call_user_func(array(&$this, 'show_field_'.$field['type']), $field, $meta); |
|
527 | 527 | echo '</tr>'; |
528 | 528 | } |
529 | 529 | echo '</table>'; |
@@ -550,14 +550,14 @@ discard block |
||
550 | 550 | foreach ($meta as $me) { |
551 | 551 | //for labling toggles |
552 | 552 | $mmm = $me[$field['fields'][0]['id']]; |
553 | - echo '<div class="at-repater-block">' . $mmm . '<br/><table class="repeater-table" style="display: none;">'; |
|
553 | + echo '<div class="at-repater-block">'.$mmm.'<br/><table class="repeater-table" style="display: none;">'; |
|
554 | 554 | if ($field['inline']) { |
555 | 555 | echo '<tr class="at-inline" VALIGN="top">'; |
556 | 556 | } |
557 | 557 | foreach ($field['fields'] as $f) { |
558 | 558 | //reset var $id for repeater |
559 | 559 | $id = ''; |
560 | - $id = $field['id'] . '[' . $c . '][' . $f['id'] . ']'; |
|
560 | + $id = $field['id'].'['.$c.']['.$f['id'].']'; |
|
561 | 561 | $m = $me[$f['id']]; |
562 | 562 | $m = ($m !== '') ? $m : $f['std']; |
563 | 563 | if ('image' != $f['type'] && $f['type'] != 'repeater') |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | if (!$field['inline']) { |
568 | 568 | echo '<tr>'; |
569 | 569 | } |
570 | - call_user_func(array(&$this, 'show_field_' . $f['type']), $f, $m); |
|
570 | + call_user_func(array(&$this, 'show_field_'.$f['type']), $f, $m); |
|
571 | 571 | if (!$field['inline']) { |
572 | 572 | echo '</tr>'; |
573 | 573 | } |
@@ -578,18 +578,18 @@ discard block |
||
578 | 578 | echo '</table> |
579 | 579 | <span class="at-re-toggle"><img src="'; |
580 | 580 | if ($this->_Local_images) { |
581 | - echo $plugin_path . '/images/edit.png'; |
|
581 | + echo $plugin_path.'/images/edit.png'; |
|
582 | 582 | } else { |
583 | 583 | echo 'http://i.imgur.com/ka0E2.png'; |
584 | 584 | } |
585 | 585 | echo '" alt="Edit" title="Edit"/></span> |
586 | 586 | <img src="'; |
587 | 587 | if ($this->_Local_images) { |
588 | - echo $plugin_path . '/images/remove.png'; |
|
588 | + echo $plugin_path.'/images/remove.png'; |
|
589 | 589 | } else { |
590 | 590 | echo 'http://i.imgur.com/g8Duj.png'; |
591 | 591 | } |
592 | - echo '" alt="' . __('Remove', 'geodirectory') . '" title="' . __('Remove', 'geodirectory') . '" id="remove-' . $field['id'] . '"></div>'; |
|
592 | + echo '" alt="'.__('Remove', 'geodirectory').'" title="'.__('Remove', 'geodirectory').'" id="remove-'.$field['id'].'"></div>'; |
|
593 | 593 | $c = $c + 1; |
594 | 594 | |
595 | 595 | } |
@@ -598,11 +598,11 @@ discard block |
||
598 | 598 | |
599 | 599 | echo '<img src="'; |
600 | 600 | if ($this->_Local_images) { |
601 | - echo $plugin_path . '/images/add.png'; |
|
601 | + echo $plugin_path.'/images/add.png'; |
|
602 | 602 | } else { |
603 | 603 | echo 'http://i.imgur.com/w5Tuc.png'; |
604 | 604 | } |
605 | - echo '" alt="' . __('Add', 'geodirectory') . '" title="' . __('Add', 'geodirectory') . '" id="add-' . $field['id'] . '"><br/></div>'; |
|
605 | + echo '" alt="'.__('Add', 'geodirectory').'" title="'.__('Add', 'geodirectory').'" id="add-'.$field['id'].'"><br/></div>'; |
|
606 | 606 | |
607 | 607 | //create all fields once more for js function and catch with object buffer |
608 | 608 | ob_start(); |
@@ -613,12 +613,12 @@ discard block |
||
613 | 613 | foreach ($field['fields'] as $f) { |
614 | 614 | //reset var $id for repeater |
615 | 615 | $id = ''; |
616 | - $id = $field['id'] . '[CurrentCounter][' . $f['id'] . ']'; |
|
616 | + $id = $field['id'].'[CurrentCounter]['.$f['id'].']'; |
|
617 | 617 | $f['id'] = $id; |
618 | 618 | if (!$field['inline']) { |
619 | 619 | echo '<tr>'; |
620 | 620 | } |
621 | - call_user_func(array(&$this, 'show_field_' . $f['type']), $f, ''); |
|
621 | + call_user_func(array(&$this, 'show_field_'.$f['type']), $f, ''); |
|
622 | 622 | if (!$field['inline']) { |
623 | 623 | echo '</tr>'; |
624 | 624 | } |
@@ -628,24 +628,24 @@ discard block |
||
628 | 628 | } |
629 | 629 | echo '</table><img src="'; |
630 | 630 | if ($this->_Local_images) { |
631 | - echo $plugin_path . '/images/remove.png'; |
|
631 | + echo $plugin_path.'/images/remove.png'; |
|
632 | 632 | } else { |
633 | 633 | echo 'http://i.imgur.com/g8Duj.png'; |
634 | 634 | } |
635 | - echo '" alt="' . __('Remove', 'geodirectory') . '" title="' . __('Remove', 'geodirectory') . '" id="remove-' . $field['id'] . '"></div>'; |
|
636 | - $counter = 'countadd_' . $field['id']; |
|
635 | + echo '" alt="'.__('Remove', 'geodirectory').'" title="'.__('Remove', 'geodirectory').'" id="remove-'.$field['id'].'"></div>'; |
|
636 | + $counter = 'countadd_'.$field['id']; |
|
637 | 637 | $js_code = ob_get_clean(); |
638 | 638 | $js_code = str_replace("'", "\"", $js_code); |
639 | - $js_code = str_replace("CurrentCounter", "' + " . $counter . " + '", $js_code); |
|
639 | + $js_code = str_replace("CurrentCounter", "' + ".$counter." + '", $js_code); |
|
640 | 640 | echo '<script> |
641 | 641 | jQuery(document).ready(function() { |
642 | - var ' . $counter . ' = ' . $c . '; |
|
643 | - jQuery("#add-' . $field['id'] . '").live(\'click\', function() { |
|
644 | - ' . $counter . ' = ' . $counter . ' + 1; |
|
645 | - jQuery(this).before(\'' . $js_code . '\'); |
|
642 | + var ' . $counter.' = '.$c.'; |
|
643 | + jQuery("#add-' . $field['id'].'").live(\'click\', function() { |
|
644 | + ' . $counter.' = '.$counter.' + 1; |
|
645 | + jQuery(this).before(\'' . $js_code.'\'); |
|
646 | 646 | update_repeater_fields(); |
647 | 647 | }); |
648 | - jQuery("#remove-' . $field['id'] . '").live(\'click\', function() { |
|
648 | + jQuery("#remove-' . $field['id'].'").live(\'click\', function() { |
|
649 | 649 | jQuery(this).parent().remove(); |
650 | 650 | }); |
651 | 651 | }); |
@@ -772,7 +772,7 @@ discard block |
||
772 | 772 | public function show_field_paragraph($field) |
773 | 773 | { |
774 | 774 | //$this->show_field_begin( $field, $meta ); |
775 | - echo '<p>' . $field['value'] . '</p>'; |
|
775 | + echo '<p>'.$field['value'].'</p>'; |
|
776 | 776 | //$this->show_field_end( $field, $meta ); |
777 | 777 | } |
778 | 778 | |
@@ -803,12 +803,12 @@ discard block |
||
803 | 803 | { |
804 | 804 | |
805 | 805 | if (!is_array($meta)) |
806 | - $meta = (array)$meta; |
|
806 | + $meta = (array) $meta; |
|
807 | 807 | |
808 | 808 | $this->show_field_begin($field, $meta); |
809 | - echo "<select class='at-select' name='{$field['id']}" . ($field['multiple'] ? "[]' id='{$field['id']}' multiple='multiple'" : "'") . ">"; |
|
809 | + echo "<select class='at-select' name='{$field['id']}".($field['multiple'] ? "[]' id='{$field['id']}' multiple='multiple'" : "'").">"; |
|
810 | 810 | foreach ($field['options'] as $key => $value) { |
811 | - echo "<option value='{$key}'" . selected(in_array($key, $meta), true, false) . ">{$value}</option>"; |
|
811 | + echo "<option value='{$key}'".selected(in_array($key, $meta), true, false).">{$value}</option>"; |
|
812 | 812 | } |
813 | 813 | echo "</select>"; |
814 | 814 | $this->show_field_end($field, $meta); |
@@ -827,11 +827,11 @@ discard block |
||
827 | 827 | { |
828 | 828 | |
829 | 829 | if (!is_array($meta)) |
830 | - $meta = (array)$meta; |
|
830 | + $meta = (array) $meta; |
|
831 | 831 | |
832 | 832 | $this->show_field_begin($field, $meta); |
833 | 833 | foreach ($field['options'] as $key => $value) { |
834 | - echo "<input type='radio' class='at-radio' name='{$field['id']}' value='{$key}'" . checked(in_array($key, $meta), true, false) . " /> <span class='at-radio-label'>{$value}</span>"; |
|
834 | + echo "<input type='radio' class='at-radio' name='{$field['id']}' value='{$key}'".checked(in_array($key, $meta), true, false)." /> <span class='at-radio-label'>{$value}</span>"; |
|
835 | 835 | } |
836 | 836 | $this->show_field_end($field, $meta); |
837 | 837 | } |
@@ -848,7 +848,7 @@ discard block |
||
848 | 848 | { |
849 | 849 | |
850 | 850 | $this->show_field_begin($field, $meta); |
851 | - echo "<input type='checkbox' class='rw-checkbox' name='{$field['id']}' id='{$field['id']}'" . checked(!empty($meta), true, false) . " /> {$field['desc']}"; |
|
851 | + echo "<input type='checkbox' class='rw-checkbox' name='{$field['id']}' id='{$field['id']}'".checked(!empty($meta), true, false)." /> {$field['desc']}"; |
|
852 | 852 | $this->show_field_end($field, $meta); |
853 | 853 | } |
854 | 854 | |
@@ -890,18 +890,18 @@ discard block |
||
890 | 890 | global $post; |
891 | 891 | |
892 | 892 | if (!is_array($meta)) |
893 | - $meta = (array)$meta; |
|
893 | + $meta = (array) $meta; |
|
894 | 894 | |
895 | 895 | $this->show_field_begin($field, $meta); |
896 | 896 | echo "{$field['desc']}<br />"; |
897 | 897 | |
898 | 898 | if (!empty($meta)) { |
899 | 899 | $nonce = wp_create_nonce('at_ajax_delete'); |
900 | - echo '<div style="margin-bottom: 10px"><strong>' . __('Uploaded files', 'geodirectory') . '</strong></div>'; |
|
900 | + echo '<div style="margin-bottom: 10px"><strong>'.__('Uploaded files', 'geodirectory').'</strong></div>'; |
|
901 | 901 | echo '<ol class="at-upload">'; |
902 | 902 | foreach ($meta as $att) { |
903 | 903 | // if (wp_attachment_is_image($att)) continue; // what's image uploader for? |
904 | - echo "<li>" . wp_get_attachment_link($att, '', false, false, ' ') . " (<a class='at-delete-file' href='#' rel='{$nonce}|{$post->ID}|{$field['id']}|{$att}'>" . __('Remove', 'geodirectory') . "</a>)</li>"; |
|
904 | + echo "<li>".wp_get_attachment_link($att, '', false, false, ' ')." (<a class='at-delete-file' href='#' rel='{$nonce}|{$post->ID}|{$field['id']}|{$att}'>".__('Remove', 'geodirectory')."</a>)</li>"; |
|
905 | 905 | } |
906 | 906 | echo '</ol>'; |
907 | 907 | } |
@@ -909,13 +909,13 @@ discard block |
||
909 | 909 | // show form upload |
910 | 910 | |
911 | 911 | echo "<div class='at-file-upload-label'>"; |
912 | - echo "<strong>" . __('Upload new files', 'geodirectory') . "</strong>"; |
|
912 | + echo "<strong>".__('Upload new files', 'geodirectory')."</strong>"; |
|
913 | 913 | echo "</div>"; |
914 | 914 | echo "<div class='new-files'>"; |
915 | 915 | echo "<div class='file-input'>"; |
916 | 916 | echo "<input type='file' name='{$field['id']}[]' />"; |
917 | 917 | echo "</div><!-- End .file-input -->"; |
918 | - echo "<a class='at-add-file button' href='#'>" . __('Add more files', 'geodirectory') . "</a>"; |
|
918 | + echo "<a class='at-add-file button' href='#'>".__('Add more files', 'geodirectory')."</a>"; |
|
919 | 919 | echo "</div><!-- End .new-files -->"; |
920 | 920 | echo "</td>"; |
921 | 921 | $this->show_field_end($field, $meta); |
@@ -932,7 +932,7 @@ discard block |
||
932 | 932 | public function show_field_image($field, $meta) |
933 | 933 | { |
934 | 934 | $this->show_field_begin($field, $meta); |
935 | - $html = wp_nonce_field("at-delete-mupload_{$field['id']}", "nonce-delete-mupload_" . $field['id'], false, false); |
|
935 | + $html = wp_nonce_field("at-delete-mupload_{$field['id']}", "nonce-delete-mupload_".$field['id'], false, false); |
|
936 | 936 | if (is_array($meta)) { |
937 | 937 | if (isset($meta[0]) && is_array($meta[0])) |
938 | 938 | $meta = $meta[0]; |
@@ -958,20 +958,20 @@ discard block |
||
958 | 958 | |
959 | 959 | $sub_dir = str_replace($uploads_baseurl, '', $sub_dir); |
960 | 960 | |
961 | - $uploads_url = $uploads_baseurl . $sub_dir; |
|
961 | + $uploads_url = $uploads_baseurl.$sub_dir; |
|
962 | 962 | |
963 | - $meta['src'] = $uploads_url . '/' . $file_name; |
|
963 | + $meta['src'] = $uploads_url.'/'.$file_name; |
|
964 | 964 | |
965 | 965 | |
966 | - $html .= "<span class='mupload_img_holder'><img src='" . $meta['src'] . "' style='max-height: 150px;max-width: 150px;' /></span>"; |
|
967 | - $html .= "<input type='hidden' name='" . $field['id'] . "[id]' id='" . $field['id'] . "[id]' value='" . $meta['id'] . "' />"; |
|
968 | - $html .= "<input type='hidden' class='" . $field['id'] . "[src]' name='" . $field['id'] . "[src]' id='" . $field['id'] . "[src]' value='" . $meta['src'] . "' />"; |
|
969 | - $html .= "<input class='at-delete_image_button' type='button' rel='" . $field['id'] . "' value='" . __('Remove Image', 'geodirectory') . "' />"; |
|
966 | + $html .= "<span class='mupload_img_holder'><img src='".$meta['src']."' style='max-height: 150px;max-width: 150px;' /></span>"; |
|
967 | + $html .= "<input type='hidden' name='".$field['id']."[id]' id='".$field['id']."[id]' value='".$meta['id']."' />"; |
|
968 | + $html .= "<input type='hidden' class='".$field['id']."[src]' name='".$field['id']."[src]' id='".$field['id']."[src]' value='".$meta['src']."' />"; |
|
969 | + $html .= "<input class='at-delete_image_button' type='button' rel='".$field['id']."' value='".__('Remove Image', 'geodirectory')."' />"; |
|
970 | 970 | } else { |
971 | 971 | $html .= "<span class='mupload_img_holder'></span>"; |
972 | - $html .= "<input type='hidden' name='" . $field['id'] . "[id]' id='" . $field['id'] . "[id]' value='' />"; |
|
973 | - $html .= "<input class='" . $field['id'] . "[src]' style='position:absolute;left:-500px;width:50px;' type='text' name='" . $field['id'] . "[src]' id='" . $field['id'] . "[src]' value='' />"; |
|
974 | - $html .= "<input class='at-upload_image_button' type='button' rel='" . $field['id'] . "' value='" . __('Upload Image', 'geodirectory') . "' />"; |
|
972 | + $html .= "<input type='hidden' name='".$field['id']."[id]' id='".$field['id']."[id]' value='' />"; |
|
973 | + $html .= "<input class='".$field['id']."[src]' style='position:absolute;left:-500px;width:50px;' type='text' name='".$field['id']."[src]' id='".$field['id']."[src]' value='' />"; |
|
974 | + $html .= "<input class='at-upload_image_button' type='button' rel='".$field['id']."' value='".__('Upload Image', 'geodirectory')."' />"; |
|
975 | 975 | } |
976 | 976 | echo $html; |
977 | 977 | $this->show_field_end($field, $meta); |
@@ -995,7 +995,7 @@ discard block |
||
995 | 995 | |
996 | 996 | echo "<input class='at-color' type='text' name='{$field['id']}' id='{$field['id']}' value='{$meta}' size='8' />"; |
997 | 997 | // echo "<a href='#' class='at-color-select button' rel='{$field['id']}'>" . __( 'Select a color' ) . "</a>"; |
998 | - echo "<input type='button' class='at-color-select button' rel='{$field['id']}' value='" . __('Select a color', 'geodirectory') . "'/>"; |
|
998 | + echo "<input type='button' class='at-color-select button' rel='{$field['id']}' value='".__('Select a color', 'geodirectory')."'/>"; |
|
999 | 999 | echo "<div style='display:none' class='at-color-picker' rel='{$field['id']}'></div>"; |
1000 | 1000 | $this->show_field_end($field, $meta); |
1001 | 1001 | |
@@ -1013,14 +1013,14 @@ discard block |
||
1013 | 1013 | { |
1014 | 1014 | |
1015 | 1015 | if (!is_array($meta)) |
1016 | - $meta = (array)$meta; |
|
1016 | + $meta = (array) $meta; |
|
1017 | 1017 | |
1018 | 1018 | $this->show_field_begin($field, $meta); |
1019 | 1019 | |
1020 | 1020 | $html = array(); |
1021 | 1021 | |
1022 | 1022 | foreach ($field['options'] as $key => $value) { |
1023 | - $html[] = "<input type='checkbox' class='at-checkbox_list' name='{$field['id']}[]' value='{$key}'" . checked(in_array($key, $meta), true, false) . " /> {$value}"; |
|
1023 | + $html[] = "<input type='checkbox' class='at-checkbox_list' name='{$field['id']}[]' value='{$key}'".checked(in_array($key, $meta), true, false)." /> {$value}"; |
|
1024 | 1024 | } |
1025 | 1025 | |
1026 | 1026 | echo implode('<br />', $html); |
@@ -1073,7 +1073,7 @@ discard block |
||
1073 | 1073 | { |
1074 | 1074 | global $post; |
1075 | 1075 | |
1076 | - if (!is_array($meta)) $meta = (array)$meta; |
|
1076 | + if (!is_array($meta)) $meta = (array) $meta; |
|
1077 | 1077 | $this->show_field_begin($field, $meta); |
1078 | 1078 | $options = $field['options']; |
1079 | 1079 | $posts = get_posts($options['args']); |
@@ -1081,13 +1081,13 @@ discard block |
||
1081 | 1081 | // checkbox_list |
1082 | 1082 | if ('checkbox_list' == $options['type']) { |
1083 | 1083 | foreach ($posts as $p) { |
1084 | - echo "<input type='checkbox' name='{$field['id']}[]' value='$p->ID'" . checked(in_array($p->ID, $meta), true, false) . " /> $p->post_title<br/>"; |
|
1084 | + echo "<input type='checkbox' name='{$field['id']}[]' value='$p->ID'".checked(in_array($p->ID, $meta), true, false)." /> $p->post_title<br/>"; |
|
1085 | 1085 | } |
1086 | 1086 | } // select |
1087 | 1087 | else { |
1088 | - echo "<select name='{$field['id']}" . ($field['multiple'] ? "[]' multiple='multiple' style='height:auto'" : "'") . ">"; |
|
1088 | + echo "<select name='{$field['id']}".($field['multiple'] ? "[]' multiple='multiple' style='height:auto'" : "'").">"; |
|
1089 | 1089 | foreach ($posts as $p) { |
1090 | - echo "<option value='$p->ID'" . selected(in_array($p->ID, $meta), true, false) . ">$p->post_title</option>"; |
|
1090 | + echo "<option value='$p->ID'".selected(in_array($p->ID, $meta), true, false).">$p->post_title</option>"; |
|
1091 | 1091 | } |
1092 | 1092 | echo "</select>"; |
1093 | 1093 | } |
@@ -1111,7 +1111,7 @@ discard block |
||
1111 | 1111 | { |
1112 | 1112 | global $post; |
1113 | 1113 | |
1114 | - if (!is_array($meta)) $meta = (array)$meta; |
|
1114 | + if (!is_array($meta)) $meta = (array) $meta; |
|
1115 | 1115 | $this->show_field_begin($field, $meta); |
1116 | 1116 | $options = $field['options']; |
1117 | 1117 | $terms = get_terms($options['taxonomy'], $options['args']); |
@@ -1119,13 +1119,13 @@ discard block |
||
1119 | 1119 | // checkbox_list |
1120 | 1120 | if ('checkbox_list' == $options['type']) { |
1121 | 1121 | foreach ($terms as $term) { |
1122 | - echo "<input type='checkbox' name='{$field['id']}[]' value='$term->slug'" . checked(in_array($term->slug, $meta), true, false) . " /> $term->name<br/>"; |
|
1122 | + echo "<input type='checkbox' name='{$field['id']}[]' value='$term->slug'".checked(in_array($term->slug, $meta), true, false)." /> $term->name<br/>"; |
|
1123 | 1123 | } |
1124 | 1124 | } // select |
1125 | 1125 | else { |
1126 | - echo "<select name='{$field['id']}" . ($field['multiple'] ? "[]' multiple='multiple' style='height:auto'" : "'") . ">"; |
|
1126 | + echo "<select name='{$field['id']}".($field['multiple'] ? "[]' multiple='multiple' style='height:auto'" : "'").">"; |
|
1127 | 1127 | foreach ($terms as $term) { |
1128 | - echo "<option value='$term->slug'" . selected(in_array($term->slug, $meta), true, false) . ">$term->name</option>"; |
|
1128 | + echo "<option value='$term->slug'".selected(in_array($term->slug, $meta), true, false).">$term->name</option>"; |
|
1129 | 1129 | } |
1130 | 1130 | echo "</select>"; |
1131 | 1131 | } |
@@ -1181,7 +1181,7 @@ discard block |
||
1181 | 1181 | |
1182 | 1182 | //$old_filename = $upload_dir['path'].'/'.$old_filename; |
1183 | 1183 | |
1184 | - $new_filename = $upload_dir['path'] . '/' . 'cat_icon_' . $term_id . '.png'; |
|
1184 | + $new_filename = $upload_dir['path'].'/'.'cat_icon_'.$term_id.'.png'; |
|
1185 | 1185 | |
1186 | 1186 | /*rename($old_filename, $new_filename); |
1187 | 1187 | |
@@ -1223,9 +1223,9 @@ discard block |
||
1223 | 1223 | if ($type != "paragraph") { |
1224 | 1224 | |
1225 | 1225 | // Call defined method to save meta value, if there's no methods, call common one. |
1226 | - $save_func = 'save_field_' . $type; |
|
1226 | + $save_func = 'save_field_'.$type; |
|
1227 | 1227 | if (method_exists($this, $save_func)) { |
1228 | - call_user_func(array(&$this, 'save_field_' . $type), $term_id, $field, $old, $new); |
|
1228 | + call_user_func(array(&$this, 'save_field_'.$type), $term_id, $field, $old, $new); |
|
1229 | 1229 | } else { |
1230 | 1230 | $this->save_field($term_id, $field, $old, $new); |
1231 | 1231 | } |
@@ -1370,7 +1370,7 @@ discard block |
||
1370 | 1370 | if (!is_wp_error($id)) { |
1371 | 1371 | |
1372 | 1372 | wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename)); |
1373 | - add_post_meta($term_id, $name, $id, false); // save file's url in meta fields |
|
1373 | + add_post_meta($term_id, $name, $id, false); // save file's url in meta fields |
|
1374 | 1374 | |
1375 | 1375 | } // End if |
1376 | 1376 | |
@@ -1415,7 +1415,7 @@ discard block |
||
1415 | 1415 | if (!is_wp_error($id)) { |
1416 | 1416 | |
1417 | 1417 | wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename)); |
1418 | - return $id; // return file's url in meta fields |
|
1418 | + return $id; // return file's url in meta fields |
|
1419 | 1419 | } // End if |
1420 | 1420 | } // End foreach |
1421 | 1421 | } |
@@ -1430,9 +1430,9 @@ discard block |
||
1430 | 1430 | { |
1431 | 1431 | |
1432 | 1432 | // Default values for meta box |
1433 | - $this->_meta_box = array_merge(array('context' => 'normal', 'priority' => 'high', 'pages' => array('post')), (array)$this->_meta_box); |
|
1433 | + $this->_meta_box = array_merge(array('context' => 'normal', 'priority' => 'high', 'pages' => array('post')), (array) $this->_meta_box); |
|
1434 | 1434 | |
1435 | - if(is_array($this->_fields)) { |
|
1435 | + if (is_array($this->_fields)) { |
|
1436 | 1436 | // Default values for fields |
1437 | 1437 | foreach ($this->_fields as &$field) { |
1438 | 1438 | $multiple = in_array($field['type'], array('checkbox_list', 'file', 'image')); |
@@ -1452,7 +1452,7 @@ discard block |
||
1452 | 1452 | */ |
1453 | 1453 | public function has_field($type) |
1454 | 1454 | { |
1455 | - if(is_array($this->_fields)) { |
|
1455 | + if (is_array($this->_fields)) { |
|
1456 | 1456 | foreach ($this->_fields as $field) { |
1457 | 1457 | if ($type == $field['type']) |
1458 | 1458 | return true; |
@@ -2020,12 +2020,12 @@ discard block |
||
2020 | 2020 | $post_type = $taxObject->object_type[0]; |
2021 | 2021 | } |
2022 | 2022 | |
2023 | - if($post_type=='post'){$post_type='';} |
|
2024 | - if($post_type){$post_type = $post_type.'_';} |
|
2023 | + if ($post_type == 'post') {$post_type = ''; } |
|
2024 | + if ($post_type) {$post_type = $post_type.'_'; } |
|
2025 | 2025 | |
2026 | 2026 | $t_id = (is_object($term_id)) ? $term_id->term_id : $term_id; |
2027 | 2027 | |
2028 | - $m = get_option('tax_meta_' . $post_type . $t_id); |
|
2028 | + $m = get_option('tax_meta_'.$post_type.$t_id); |
|
2029 | 2029 | if (isset($m[$key])) { |
2030 | 2030 | return $m[$key]; |
2031 | 2031 | } else { |
@@ -2042,15 +2042,15 @@ discard block |
||
2042 | 2042 | $post_type = $taxObject->object_type[0]; |
2043 | 2043 | } |
2044 | 2044 | |
2045 | - if($post_type=='post'){$post_type='';} |
|
2046 | - if($post_type){$post_type = $post_type.'_';} |
|
2045 | + if ($post_type == 'post') {$post_type = ''; } |
|
2046 | + if ($post_type) {$post_type = $post_type.'_'; } |
|
2047 | 2047 | |
2048 | - $m = get_option('tax_meta_' . $post_type . $term_id); |
|
2048 | + $m = get_option('tax_meta_'.$post_type.$term_id); |
|
2049 | 2049 | |
2050 | 2050 | if (isset($m[$key])) { |
2051 | 2051 | unset($m[$key]); |
2052 | 2052 | } |
2053 | - update_option('tax_meta_' . $post_type . $term_id, $m); |
|
2053 | + update_option('tax_meta_'.$post_type.$term_id, $m); |
|
2054 | 2054 | } |
2055 | 2055 | |
2056 | 2056 | //update meta |
@@ -2062,13 +2062,13 @@ discard block |
||
2062 | 2062 | $post_type = $taxObject->object_type[0]; |
2063 | 2063 | } |
2064 | 2064 | |
2065 | - if($post_type=='post'){$post_type='';} |
|
2066 | - if($post_type){$post_type = $post_type.'_';} |
|
2065 | + if ($post_type == 'post') {$post_type = ''; } |
|
2066 | + if ($post_type) {$post_type = $post_type.'_'; } |
|
2067 | 2067 | |
2068 | - $m = get_option('tax_meta_' . $post_type . $term_id); |
|
2068 | + $m = get_option('tax_meta_'.$post_type.$term_id); |
|
2069 | 2069 | |
2070 | 2070 | $m[$key] = $value; |
2071 | - update_option('tax_meta_' . $post_type . $term_id, $m); |
|
2071 | + update_option('tax_meta_'.$post_type.$term_id, $m); |
|
2072 | 2072 | |
2073 | 2073 | /** |
2074 | 2074 | * Called after the tax meta is updated. |
@@ -2103,12 +2103,12 @@ discard block |
||
2103 | 2103 | $post_type = $taxObject->object_type[0]; |
2104 | 2104 | } |
2105 | 2105 | |
2106 | - if($post_type=='post'){$post_type='';} |
|
2107 | - if($post_type){$post_type = $post_type.'_';} |
|
2106 | + if ($post_type == 'post') {$post_type = ''; } |
|
2107 | + if ($post_type) {$post_type = $post_type.'_'; } |
|
2108 | 2108 | |
2109 | 2109 | $t_id = (is_object($term_id)) ? $term_id->term_id : $term_id; |
2110 | 2110 | |
2111 | - $m = get_option('tax_meta_' . $post_type . $t_id); |
|
2111 | + $m = get_option('tax_meta_'.$post_type.$t_id); |
|
2112 | 2112 | if (isset($m[$key])) { |
2113 | 2113 | return $m[$key]; |
2114 | 2114 | } else { |
@@ -2125,15 +2125,15 @@ discard block |
||
2125 | 2125 | $taxObject = get_taxonomy($_REQUEST['taxonomy']); |
2126 | 2126 | $post_type = $taxObject->object_type[0]; |
2127 | 2127 | |
2128 | - if($post_type=='post'){$post_type='';} |
|
2129 | - if($post_type){$post_type = $post_type.'_';} |
|
2128 | + if ($post_type == 'post') {$post_type = ''; } |
|
2129 | + if ($post_type) {$post_type = $post_type.'_'; } |
|
2130 | 2130 | |
2131 | - $m = get_option('tax_meta_' . $post_type . $term_id); |
|
2131 | + $m = get_option('tax_meta_'.$post_type.$term_id); |
|
2132 | 2132 | |
2133 | 2133 | if (isset($m[$key])) { |
2134 | 2134 | unset($m[$key]); |
2135 | 2135 | } |
2136 | - update_option('tax_meta_' . $post_type . $term_id, $m); |
|
2136 | + update_option('tax_meta_'.$post_type.$term_id, $m); |
|
2137 | 2137 | } |
2138 | 2138 | } |
2139 | 2139 | |
@@ -2147,13 +2147,13 @@ discard block |
||
2147 | 2147 | $post_type = $taxObject->object_type[0]; |
2148 | 2148 | } |
2149 | 2149 | |
2150 | - if($post_type=='post'){$post_type='';} |
|
2151 | - if($post_type){$post_type = $post_type.'_';} |
|
2150 | + if ($post_type == 'post') {$post_type = ''; } |
|
2151 | + if ($post_type) {$post_type = $post_type.'_'; } |
|
2152 | 2152 | |
2153 | - $m = get_option('tax_meta_' . $post_type . $term_id); |
|
2153 | + $m = get_option('tax_meta_'.$post_type.$term_id); |
|
2154 | 2154 | |
2155 | 2155 | $m[$key] = $value; |
2156 | - update_option('tax_meta_' . $post_type . $term_id, $m); |
|
2156 | + update_option('tax_meta_'.$post_type.$term_id, $m); |
|
2157 | 2157 | |
2158 | 2158 | /** This action is documented in geodirectory-functions/cat-meta-functions/Tax-meta-class.php */ |
2159 | 2159 | do_action('gd_tax_meta_updated', false, true, $term_id, $post_type); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
63 | 63 | function geodir_get_admin_option_form($current_tab) |
64 | 64 | { |
65 | - geodir_admin_option_form($current_tab);// defined in admin template tags.php |
|
65 | + geodir_admin_option_form($current_tab); // defined in admin template tags.php |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | add_action('geodir_update_options_compatibility_settings', 'geodir_update_options_compatibility_settings'); |
71 | 71 | add_action('geodir_update_options_default_location_settings', 'geodir_location_form_submit'); |
72 | 72 | add_action('geodir_before_admin_panel', 'geodir_before_admin_panel'); // this function is in admin_functions.php |
73 | -add_action('geodir_before_update_options', 'geodir_before_update_options',10,2); |
|
73 | +add_action('geodir_before_update_options', 'geodir_before_update_options', 10, 2); |
|
74 | 74 | |
75 | 75 | //add_action('geodir_before_admin_panel', 'geodir_autoinstall_admin_header'); |
76 | 76 | |
@@ -226,9 +226,9 @@ discard block |
||
226 | 226 | |
227 | 227 | // Filter-Payment-Manager |
228 | 228 | |
229 | - add_meta_box('geodir_post_images', $post_typename . ' ' . __('Attachments', 'geodirectory'), 'geodir_post_attachments', $geodir_posttype, 'side'); |
|
229 | + add_meta_box('geodir_post_images', $post_typename.' '.__('Attachments', 'geodirectory'), 'geodir_post_attachments', $geodir_posttype, 'side'); |
|
230 | 230 | |
231 | - add_meta_box('geodir_post_info', $post_typename . ' ' . __('Information', 'geodirectory'), 'geodir_post_info_setting', $geodir_posttype, 'normal', 'high'); |
|
231 | + add_meta_box('geodir_post_info', $post_typename.' '.__('Information', 'geodirectory'), 'geodir_post_info_setting', $geodir_posttype, 'normal', 'high'); |
|
232 | 232 | |
233 | 233 | // no need of this box as all fields moved to main information box |
234 | 234 | //add_meta_box( 'geodir_post_addinfo', $post_typename. ' ' .__('Additional Information' , 'geodirectory'), 'geodir_post_addinfo_setting', $geodir_posttype,'normal', 'high' ); |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | |
238 | 238 | } |
239 | 239 | |
240 | -add_action('save_post', 'geodir_post_information_save',10,2); |
|
240 | +add_action('save_post', 'geodir_post_information_save', 10, 2); |
|
241 | 241 | |
242 | 242 | |
243 | 243 | |
@@ -264,10 +264,10 @@ discard block |
||
264 | 264 | |
265 | 265 | $gd_taxonomy = geodir_get_taxonomies($geodir_post_type); |
266 | 266 | |
267 | - if(!empty($gd_taxonomy)) { |
|
267 | + if (!empty($gd_taxonomy)) { |
|
268 | 268 | foreach ($gd_taxonomy as $tax) { |
269 | 269 | |
270 | - remove_meta_box($tax . 'div', $geodir_post_type, 'normal'); |
|
270 | + remove_meta_box($tax.'div', $geodir_post_type, 'normal'); |
|
271 | 271 | |
272 | 272 | } |
273 | 273 | } |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | global $wpdb; |
417 | 417 | $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
418 | 418 | ?> |
419 | - <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type;?>"/> |
|
419 | + <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type; ?>"/> |
|
420 | 420 | <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>"/> |
421 | 421 | <ul> |
422 | 422 | <?php |
@@ -427,18 +427,18 @@ discard block |
||
427 | 427 | |
428 | 428 | $check_html_variable = $wpdb->get_var( |
429 | 429 | $wpdb->prepare( |
430 | - "SELECT htmlvar_name FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name = %s AND post_type = %s AND field_type=%s", |
|
430 | + "SELECT htmlvar_name FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE htmlvar_name = %s AND post_type = %s AND field_type=%s", |
|
431 | 431 | array($val['htmlvar_name'], $listing_type, $val['field_type']) |
432 | 432 | ) |
433 | 433 | ); |
434 | 434 | |
435 | 435 | $display = $check_html_variable ? ' style="display:none;"' : ''; |
436 | 436 | ?> |
437 | - <li <?php echo $display;?>> |
|
438 | - <a id="gt-<?php echo $val['field_type'];?>-_-<?php echo $val['htmlvar_name'];?>" |
|
439 | - title="<?php echo $val['site_title'];?>" |
|
440 | - class="gt-draggable-form-items gt-<?php echo $val['field_type'];?> geodir-sort-<?php echo $val['htmlvar_name'];?>" |
|
441 | - href="javascript:void(0);"><b></b><?php _e($val['site_title'], 'geodirectory');?></a> |
|
437 | + <li <?php echo $display; ?>> |
|
438 | + <a id="gt-<?php echo $val['field_type']; ?>-_-<?php echo $val['htmlvar_name']; ?>" |
|
439 | + title="<?php echo $val['site_title']; ?>" |
|
440 | + class="gt-draggable-form-items gt-<?php echo $val['field_type']; ?> geodir-sort-<?php echo $val['htmlvar_name']; ?>" |
|
441 | + href="javascript:void(0);"><b></b><?php _e($val['site_title'], 'geodirectory'); ?></a> |
|
442 | 442 | </li> |
443 | 443 | <?php |
444 | 444 | } |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | <?php |
464 | 464 | global $wpdb; |
465 | 465 | |
466 | - $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE post_type = %s AND field_type != 'address' ORDER BY sort_order ASC", array($listing_type))); |
|
466 | + $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE post_type = %s AND field_type != 'address' ORDER BY sort_order ASC", array($listing_type))); |
|
467 | 467 | |
468 | 468 | if (!empty($fields)) { |
469 | 469 | foreach ($fields as $field) { |
@@ -492,39 +492,39 @@ discard block |
||
492 | 492 | { |
493 | 493 | $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
494 | 494 | ?> |
495 | - <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type;?>"/> |
|
495 | + <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type; ?>"/> |
|
496 | 496 | <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>"/> |
497 | 497 | <ul class="full"> |
498 | - <li><a id="gt-fieldset" class="gt-draggable-form-items gt-fieldset" href="javascript:void(0);"><?php _e('Fieldset', 'geodirectory');?></a></li> |
|
498 | + <li><a id="gt-fieldset" class="gt-draggable-form-items gt-fieldset" href="javascript:void(0);"><?php _e('Fieldset', 'geodirectory'); ?></a></li> |
|
499 | 499 | </ul> |
500 | 500 | <ul> |
501 | 501 | <li><a id="gt-text" class="gt-draggable-form-items gt-text" |
502 | - href="javascript:void(0);"><b></b><?php _e('Text', 'geodirectory');?></a></li> |
|
502 | + href="javascript:void(0);"><b></b><?php _e('Text', 'geodirectory'); ?></a></li> |
|
503 | 503 | <li><a id="gt-datepicker" class="gt-draggable-form-items gt-datepicker" |
504 | - href="javascript:void(0);"><b></b><?php _e('Date', 'geodirectory');?></a></li> |
|
504 | + href="javascript:void(0);"><b></b><?php _e('Date', 'geodirectory'); ?></a></li> |
|
505 | 505 | <li><a id="gt-textarea" class="gt-draggable-form-items gt-textarea" |
506 | - href="javascript:void(0);"><b></b><?php _e('Textarea', 'geodirectory');?></a></li> |
|
506 | + href="javascript:void(0);"><b></b><?php _e('Textarea', 'geodirectory'); ?></a></li> |
|
507 | 507 | <li><a id="gt-time" class="gt-draggable-form-items gt-time" |
508 | - href="javascript:void(0);"><b></b><?php _e('Time', 'geodirectory');?></a></li> |
|
508 | + href="javascript:void(0);"><b></b><?php _e('Time', 'geodirectory'); ?></a></li> |
|
509 | 509 | <li><a id="gt-checkbox" class="gt-draggable-form-items gt-checkbox" |
510 | - href="javascript:void(0);"><b></b><?php _e('Checkbox', 'geodirectory');?></a></li> |
|
510 | + href="javascript:void(0);"><b></b><?php _e('Checkbox', 'geodirectory'); ?></a></li> |
|
511 | 511 | <li><a id="gt-phone" class="gt-draggable-form-items gt-phone" |
512 | - href="javascript:void(0);"><b></b><?php _e('Phone', 'geodirectory');?></a></li> |
|
512 | + href="javascript:void(0);"><b></b><?php _e('Phone', 'geodirectory'); ?></a></li> |
|
513 | 513 | <li><a id="gt-radio" class="gt-draggable-form-items gt-radio" |
514 | - href="javascript:void(0);"><b></b><?php _e('Radio', 'geodirectory');?></a></li> |
|
514 | + href="javascript:void(0);"><b></b><?php _e('Radio', 'geodirectory'); ?></a></li> |
|
515 | 515 | <li><a id="gt-email" class="gt-draggable-form-items gt-email" |
516 | - href="javascript:void(0);"><b></b><?php _e('Email', 'geodirectory');?></a></li> |
|
516 | + href="javascript:void(0);"><b></b><?php _e('Email', 'geodirectory'); ?></a></li> |
|
517 | 517 | <li><a id="gt-select" class="gt-draggable-form-items gt-select" |
518 | - href="javascript:void(0);"><b></b><?php _e('Select', 'geodirectory');?></a></li> |
|
519 | - <!--<li><a id="gt-taxonomy" class="gt-draggable-form-items gt-select" href="javascript:void(0);"><b></b><?php _e('Taxonomy', 'geodirectory');?></a></li>--> |
|
518 | + href="javascript:void(0);"><b></b><?php _e('Select', 'geodirectory'); ?></a></li> |
|
519 | + <!--<li><a id="gt-taxonomy" class="gt-draggable-form-items gt-select" href="javascript:void(0);"><b></b><?php _e('Taxonomy', 'geodirectory'); ?></a></li>--> |
|
520 | 520 | <li><a id="gt-multiselect" class="gt-draggable-form-items gt-multiselect" |
521 | - href="javascript:void(0);"><b></b><?php _e('Multi Select', 'geodirectory');?></a></li> |
|
521 | + href="javascript:void(0);"><b></b><?php _e('Multi Select', 'geodirectory'); ?></a></li> |
|
522 | 522 | <li><a id="gt-url" class="gt-draggable-form-items gt-url" |
523 | - href="javascript:void(0);"><b></b><?php _e('URL', 'geodirectory');?></a></li> |
|
523 | + href="javascript:void(0);"><b></b><?php _e('URL', 'geodirectory'); ?></a></li> |
|
524 | 524 | <li><a id="gt-html" class="gt-draggable-form-items gt-html" |
525 | - href="javascript:void(0);"><b></b><?php _e('HTML', 'geodirectory');?></a></li> |
|
525 | + href="javascript:void(0);"><b></b><?php _e('HTML', 'geodirectory'); ?></a></li> |
|
526 | 526 | <li><a id="gt-file" class="gt-draggable-form-items gt-file" |
527 | - href="javascript:void(0);"><b></b><?php _e('File Upload', 'geodirectory');?></a></li> |
|
527 | + href="javascript:void(0);"><b></b><?php _e('File Upload', 'geodirectory'); ?></a></li> |
|
528 | 528 | |
529 | 529 | </ul> |
530 | 530 | |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | <ul class="core"> |
549 | 549 | <?php |
550 | 550 | global $wpdb; |
551 | - $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type = %s ORDER BY sort_order ASC", array($listing_type))); |
|
551 | + $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE post_type = %s ORDER BY sort_order ASC", array($listing_type))); |
|
552 | 552 | |
553 | 553 | if (!empty($fields)) { |
554 | 554 | foreach ($fields as $field) { |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | |
636 | 636 | switch ($sub_tab) { |
637 | 637 | case 'custom_fields': |
638 | - $note = sprintf(__('Click on any box below to add a field of that type on add %s listing form. You must be use a fieldset to group your fields.', 'geodirectory'), get_post_type_singular_label($listing_type));; |
|
638 | + $note = sprintf(__('Click on any box below to add a field of that type on add %s listing form. You must be use a fieldset to group your fields.', 'geodirectory'), get_post_type_singular_label($listing_type)); ; |
|
639 | 639 | break; |
640 | 640 | |
641 | 641 | case 'sorting_options': |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | |
690 | 690 | switch ($sub_tab) { |
691 | 691 | case 'custom_fields': |
692 | - $note = sprintf(__('Click to expand and view field related settings. You may drag and drop to arrange fields order on add %s listing form too.', 'geodirectory'), get_post_type_singular_label($listing_type));; |
|
692 | + $note = sprintf(__('Click to expand and view field related settings. You may drag and drop to arrange fields order on add %s listing form too.', 'geodirectory'), get_post_type_singular_label($listing_type)); ; |
|
693 | 693 | break; |
694 | 694 | |
695 | 695 | case 'sorting_options': |
@@ -716,8 +716,8 @@ discard block |
||
716 | 716 | |
717 | 717 | if (!get_option('geodir_remove_unnecessary_fields')) { |
718 | 718 | |
719 | - if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'")) |
|
720 | - $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`"); |
|
719 | + if ($wpdb->get_var("SHOW COLUMNS FROM ".$plugin_prefix."gd_place_detail WHERE field = 'categories'")) |
|
720 | + $wpdb->query("ALTER TABLE `".$plugin_prefix."gd_place_detail` DROP `categories`"); |
|
721 | 721 | |
722 | 722 | update_option('geodir_remove_unnecessary_fields', '1'); |
723 | 723 | |
@@ -745,14 +745,14 @@ discard block |
||
745 | 745 | case 'diagnosis' : |
746 | 746 | if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') |
747 | 747 | $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
748 | - call_user_func('geodir_diagnose_' . $diagnose_this); |
|
748 | + call_user_func('geodir_diagnose_'.$diagnose_this); |
|
749 | 749 | exit(); |
750 | 750 | break; |
751 | 751 | |
752 | 752 | case 'diagnosis-fix' : |
753 | 753 | if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') |
754 | 754 | $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
755 | - call_user_func('geodir_diagnose_' . $diagnose_this); |
|
755 | + call_user_func('geodir_diagnose_'.$diagnose_this); |
|
756 | 756 | exit(); |
757 | 757 | break; |
758 | 758 | } |
@@ -777,50 +777,50 @@ discard block |
||
777 | 777 | { |
778 | 778 | global $wpdb; |
779 | 779 | //$filter_arr['output_str'] .='###'.$table.'###'; |
780 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0) { |
|
781 | - $filter_arr['output_str'] .= "<li>" . __('ERROR: You did not follow instructions! Now you will need to contact support to manually fix things.', 'geodirectory') . "</li>"; |
|
780 | + if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak2'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") > 0) { |
|
781 | + $filter_arr['output_str'] .= "<li>".__('ERROR: You did not follow instructions! Now you will need to contact support to manually fix things.', 'geodirectory')."</li>"; |
|
782 | 782 | $filter_arr['is_error_during_diagnose'] = true; |
783 | 783 | |
784 | - } elseif ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) { |
|
785 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s_ms_bak table found', 'geodirectory'), $tabel_name) . "</li>"; |
|
784 | + } elseif ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") > 0) { |
|
785 | + $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: %s_ms_bak table found', 'geodirectory'), $tabel_name)."</li>"; |
|
786 | 786 | $filter_arr['is_error_during_diagnose'] = true; |
787 | - $filter_arr['output_str'] .= "<li>" . __('IMPORTANT: This can be caused by out of date core or addons, please update core + addons before trying the fix OR YOU WILL HAVE A BAD TIME!', 'geodirectory') . "</li>"; |
|
787 | + $filter_arr['output_str'] .= "<li>".__('IMPORTANT: This can be caused by out of date core or addons, please update core + addons before trying the fix OR YOU WILL HAVE A BAD TIME!', 'geodirectory')."</li>"; |
|
788 | 788 | $filter_arr['is_error_during_diagnose'] = true; |
789 | 789 | |
790 | 790 | if ($fix) { |
791 | - $ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $table . "_ms_bak");// get backup table count |
|
792 | - $new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table");// get new table count |
|
791 | + $ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM ".$table."_ms_bak"); // get backup table count |
|
792 | + $new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."$table"); // get new table count |
|
793 | 793 | |
794 | 794 | if ($ms_bak_count == $new_table_count) {// if they are the same count rename to bak2 |
795 | 795 | //$filter_arr['output_str'] .= "<li>".sprintf( __('-->PROBLEM: %s table count is the same as new table, contact support' , 'geodirectory'), $table )."</li>" ; |
796 | 796 | |
797 | - $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename bak table to new table |
|
797 | + $wpdb->query("RENAME TABLE ".$table."_ms_bak TO ".$table."_ms_bak2"); // rename bak table to new table |
|
798 | 798 | |
799 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) { |
|
800 | - $filter_arr['output_str'] .= "<li>" . __('-->FIXED: Renamed and backed up the tables', 'geodirectory') . "</li>"; |
|
799 | + if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") == 0) { |
|
800 | + $filter_arr['output_str'] .= "<li>".__('-->FIXED: Renamed and backed up the tables', 'geodirectory')."</li>"; |
|
801 | 801 | } else { |
802 | - $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>"; |
|
802 | + $filter_arr['output_str'] .= "<li>".__('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory')."</li>"; |
|
803 | 803 | } |
804 | 804 | |
805 | 805 | } elseif ($ms_bak_count > $new_table_count) {//if backup is greater then restore it |
806 | 806 | |
807 | - $wpdb->query("RENAME TABLE " . $wpdb->prefix . "$table TO " . $table . "_ms_bak2");// rename new table to bak2 |
|
808 | - $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $wpdb->prefix . "$table");// rename bak table to new table |
|
807 | + $wpdb->query("RENAME TABLE ".$wpdb->prefix."$table TO ".$table."_ms_bak2"); // rename new table to bak2 |
|
808 | + $wpdb->query("RENAME TABLE ".$table."_ms_bak TO ".$wpdb->prefix."$table"); // rename bak table to new table |
|
809 | 809 | |
810 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") && $wpdb->query("SHOW TABLES LIKE '$table'") == 0) { |
|
811 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: restored largest table %s', 'geodirectory'), $table) . "</li>"; |
|
810 | + if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") && $wpdb->query("SHOW TABLES LIKE '$table'") == 0) { |
|
811 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: restored largest table %s', 'geodirectory'), $table)."</li>"; |
|
812 | 812 | } else { |
813 | - $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>"; |
|
813 | + $filter_arr['output_str'] .= "<li>".__('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory')."</li>"; |
|
814 | 814 | } |
815 | 815 | |
816 | 816 | } elseif ($new_table_count > $ms_bak_count) {// we cant do much so rename the table to stop errors |
817 | 817 | |
818 | - $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename ms_bak table to ms_bak2 |
|
818 | + $wpdb->query("RENAME TABLE ".$table."_ms_bak TO ".$table."_ms_bak2"); // rename ms_bak table to ms_bak2 |
|
819 | 819 | |
820 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) { |
|
821 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: table %s_ms_bak renamed and backed up', 'geodirectory'), $table) . "</li>"; |
|
820 | + if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") == 0) { |
|
821 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: table %s_ms_bak renamed and backed up', 'geodirectory'), $table)."</li>"; |
|
822 | 822 | } else { |
823 | - $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>"; |
|
823 | + $filter_arr['output_str'] .= "<li>".__('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory')."</li>"; |
|
824 | 824 | } |
825 | 825 | |
826 | 826 | } |
@@ -828,54 +828,54 @@ discard block |
||
828 | 828 | } |
829 | 829 | |
830 | 830 | |
831 | - } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) { |
|
832 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: Two %s tables found', 'geodirectory'), $tabel_name) . "</li>"; |
|
831 | + } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") > 0) { |
|
832 | + $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: Two %s tables found', 'geodirectory'), $tabel_name)."</li>"; |
|
833 | 833 | $filter_arr['is_error_during_diagnose'] = true; |
834 | 834 | |
835 | 835 | if ($fix) { |
836 | 836 | if ($wpdb->get_var("SELECT COUNT(*) FROM $table") == 0) {// if first table is empty just delete it |
837 | 837 | if ($wpdb->query("DROP TABLE IF EXISTS $table")) { |
838 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $table) . "</li>"; |
|
838 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $table)."</li>"; |
|
839 | 839 | } else { |
840 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $table) . "</li>"; |
|
840 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $table)."</li>"; |
|
841 | 841 | } |
842 | 842 | |
843 | - } elseif ($wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table") == 0) {// if main table is empty but original is not, delete main and rename original |
|
844 | - if ($wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "$table")) { |
|
845 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $wpdb->prefix . $table) . "</li>"; |
|
843 | + } elseif ($wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."$table") == 0) {// if main table is empty but original is not, delete main and rename original |
|
844 | + if ($wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."$table")) { |
|
845 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $wpdb->prefix.$table)."</li>"; |
|
846 | 846 | } else { |
847 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $wpdb->prefix . $table) . "</li>"; |
|
847 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $wpdb->prefix.$table)."</li>"; |
|
848 | 848 | } |
849 | - if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) { |
|
850 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>"; |
|
849 | + if ($wpdb->query("RENAME TABLE $table TO ".$wpdb->prefix."$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) { |
|
850 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix.$table)."</li>"; |
|
851 | 851 | } else { |
852 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>"; |
|
852 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix.$table)."</li>"; |
|
853 | 853 | } |
854 | 854 | } else {// else rename the original table to _ms_bak |
855 | - if ($wpdb->query("RENAME TABLE $table TO " . $table . "_ms_bak") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) { |
|
856 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table contained info so we renamed %s to %s incase it is needed in future', 'geodirectory'), $table, $table . "_ms_bak") . "</li>"; |
|
855 | + if ($wpdb->query("RENAME TABLE $table TO ".$table."_ms_bak") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) { |
|
856 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Table contained info so we renamed %s to %s incase it is needed in future', 'geodirectory'), $table, $table."_ms_bak")."</li>"; |
|
857 | 857 | } else { |
858 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Table %s could not be renamed to %s, this table has info so may need to be reviewed manually in the DB', 'geodirectory'), $table, $table . "_ms_bak") . "</li>"; |
|
858 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Table %s could not be renamed to %s, this table has info so may need to be reviewed manually in the DB', 'geodirectory'), $table, $table."_ms_bak")."</li>"; |
|
859 | 859 | } |
860 | 860 | } |
861 | 861 | } |
862 | 862 | |
863 | - } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) { |
|
864 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table not converted', 'geodirectory'), $tabel_name) . "</li>"; |
|
863 | + } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") == 0) { |
|
864 | + $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: %s table not converted', 'geodirectory'), $tabel_name)."</li>"; |
|
865 | 865 | $filter_arr['is_error_during_diagnose'] = true; |
866 | 866 | |
867 | 867 | if ($fix) { |
868 | 868 | // if original table exists but new does not, rename |
869 | - if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) { |
|
870 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>"; |
|
869 | + if ($wpdb->query("RENAME TABLE $table TO ".$wpdb->prefix."$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) { |
|
870 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix.$table)."</li>"; |
|
871 | 871 | } else { |
872 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>"; |
|
872 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix.$table)."</li>"; |
|
873 | 873 | } |
874 | 874 | |
875 | 875 | } |
876 | 876 | |
877 | - } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") == 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) { |
|
878 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table does not exist', 'geodirectory'), $tabel_name) . "</li>"; |
|
877 | + } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") == 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") == 0) { |
|
878 | + $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: %s table does not exist', 'geodirectory'), $tabel_name)."</li>"; |
|
879 | 879 | $filter_arr['is_error_during_diagnose'] = true; |
880 | 880 | |
881 | 881 | if ($fix) { |
@@ -889,11 +889,11 @@ discard block |
||
889 | 889 | delete_option('geodir_custom_posts_db_version'); |
890 | 890 | delete_option('geodir_reviewratings_db_version'); |
891 | 891 | delete_option('geodiradvancesearch_db_version'); |
892 | - $filter_arr['output_str'] .= "<li>" . __('-->TRY: Please refresh page to run table install functions', 'geodirectory') . "</li>"; |
|
892 | + $filter_arr['output_str'] .= "<li>".__('-->TRY: Please refresh page to run table install functions', 'geodirectory')."</li>"; |
|
893 | 893 | } |
894 | 894 | |
895 | 895 | } else { |
896 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('%s table converted correctly', 'geodirectory'), $tabel_name) . "</li>"; |
|
896 | + $filter_arr['output_str'] .= "<li>".sprintf(__('%s table converted correctly', 'geodirectory'), $tabel_name)."</li>"; |
|
897 | 897 | } |
898 | 898 | return $filter_arr; |
899 | 899 | } |
@@ -922,23 +922,23 @@ discard block |
||
922 | 922 | if (!empty($all_postypes)) { |
923 | 923 | foreach ($all_postypes as $key) { |
924 | 924 | // update each GD CPT |
925 | - $posts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d"); |
|
925 | + $posts = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."geodir_".$key."_detail d"); |
|
926 | 926 | |
927 | 927 | if (!empty($posts)) { |
928 | 928 | |
929 | 929 | foreach ($posts as $p) { |
930 | 930 | $p->post_type = $key; |
931 | - $raw_tags = wp_get_object_terms($p->post_id, $p->post_type . '_tags', array('fields' => 'names')); |
|
931 | + $raw_tags = wp_get_object_terms($p->post_id, $p->post_type.'_tags', array('fields' => 'names')); |
|
932 | 932 | if (empty($raw_tags)) { |
933 | 933 | $post_tags = ''; |
934 | 934 | } else { |
935 | 935 | $post_tags = implode(",", $raw_tags); |
936 | 936 | } |
937 | - $tablename = $plugin_prefix . $p->post_type . '_detail'; |
|
938 | - $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id)); |
|
937 | + $tablename = $plugin_prefix.$p->post_type.'_detail'; |
|
938 | + $wpdb->query($wpdb->prepare("UPDATE ".$tablename." SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id)); |
|
939 | 939 | |
940 | 940 | } |
941 | - $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>"; |
|
941 | + $output_str .= "<li>".$key.__(': Done', 'geodirectory')."</li>"; |
|
942 | 942 | } |
943 | 943 | |
944 | 944 | } |
@@ -947,7 +947,7 @@ discard block |
||
947 | 947 | |
948 | 948 | if ($is_error_during_diagnose) { |
949 | 949 | $info_div_class = "geodir_problem_info"; |
950 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />"; |
|
950 | + $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />"; |
|
951 | 951 | } else { |
952 | 952 | $info_div_class = "geodir_noproblem_info"; |
953 | 953 | $fix_button_txt = ''; |
@@ -984,29 +984,29 @@ discard block |
||
984 | 984 | if (!empty($all_postypes)) { |
985 | 985 | foreach ($all_postypes as $key) { |
986 | 986 | // update each GD CTP |
987 | - $posts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d WHERE d." . $key . "category='' "); |
|
987 | + $posts = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."geodir_".$key."_detail d WHERE d.".$key."category='' "); |
|
988 | 988 | |
989 | 989 | if (!empty($posts)) { |
990 | 990 | |
991 | 991 | foreach ($posts as $p) { |
992 | 992 | $p->post_type = $key; |
993 | - $raw_cats = wp_get_object_terms($p->post_id, $p->post_type . 'category', array('fields' => 'ids')); |
|
993 | + $raw_cats = wp_get_object_terms($p->post_id, $p->post_type.'category', array('fields' => 'ids')); |
|
994 | 994 | |
995 | 995 | if (empty($raw_cats)) { |
996 | 996 | $post_categories = get_post_meta($p->post_id, 'post_categories', true); |
997 | 997 | |
998 | - if (!empty($post_categories) && !empty($post_categories[$p->post_type . 'category'])) { |
|
999 | - $post_categories[$p->post_type . 'category'] = str_replace("d:", "", $post_categories[$p->post_type . 'category']); |
|
1000 | - foreach (explode(",", $post_categories[$p->post_type . 'category']) as $cat_part) { |
|
998 | + if (!empty($post_categories) && !empty($post_categories[$p->post_type.'category'])) { |
|
999 | + $post_categories[$p->post_type.'category'] = str_replace("d:", "", $post_categories[$p->post_type.'category']); |
|
1000 | + foreach (explode(",", $post_categories[$p->post_type.'category']) as $cat_part) { |
|
1001 | 1001 | if (is_numeric($cat_part)) { |
1002 | - $raw_cats[] = (int)$cat_part; |
|
1002 | + $raw_cats[] = (int) $cat_part; |
|
1003 | 1003 | } |
1004 | 1004 | } |
1005 | 1005 | |
1006 | 1006 | } |
1007 | 1007 | |
1008 | 1008 | if (!empty($raw_cats)) { |
1009 | - $term_taxonomy_ids = wp_set_object_terms($p->post_id, $raw_cats, $p->post_type . 'category'); |
|
1009 | + $term_taxonomy_ids = wp_set_object_terms($p->post_id, $raw_cats, $p->post_type.'category'); |
|
1010 | 1010 | |
1011 | 1011 | } |
1012 | 1012 | |
@@ -1016,14 +1016,14 @@ discard block |
||
1016 | 1016 | if (empty($raw_cats)) { |
1017 | 1017 | $post_cats = ''; |
1018 | 1018 | } else { |
1019 | - $post_cats = ',' . implode(",", $raw_cats) . ','; |
|
1019 | + $post_cats = ','.implode(",", $raw_cats).','; |
|
1020 | 1020 | } |
1021 | - $tablename = $plugin_prefix . $p->post_type . '_detail'; |
|
1022 | - $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET " . $p->post_type . "category=%s WHERE post_id =%d", $post_cats, $p->post_id)); |
|
1021 | + $tablename = $plugin_prefix.$p->post_type.'_detail'; |
|
1022 | + $wpdb->query($wpdb->prepare("UPDATE ".$tablename." SET ".$p->post_type."category=%s WHERE post_id =%d", $post_cats, $p->post_id)); |
|
1023 | 1023 | } |
1024 | 1024 | |
1025 | 1025 | } |
1026 | - $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>"; |
|
1026 | + $output_str .= "<li>".$key.__(': Done', 'geodirectory')."</li>"; |
|
1027 | 1027 | |
1028 | 1028 | } |
1029 | 1029 | |
@@ -1031,7 +1031,7 @@ discard block |
||
1031 | 1031 | |
1032 | 1032 | if ($is_error_during_diagnose) { |
1033 | 1033 | $info_div_class = "geodir_problem_info"; |
1034 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />"; |
|
1034 | + $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />"; |
|
1035 | 1035 | } else { |
1036 | 1036 | $info_div_class = "geodir_noproblem_info"; |
1037 | 1037 | $fix_button_txt = ''; |
@@ -1084,15 +1084,15 @@ discard block |
||
1084 | 1084 | if (!empty($ver_arr)) { |
1085 | 1085 | foreach ($ver_arr as $key => $val) { |
1086 | 1086 | if (delete_option($val)) { |
1087 | - $output_str .= "<li>" . $key . __(' Version: Deleted', 'geodirectory') . "</li>"; |
|
1087 | + $output_str .= "<li>".$key.__(' Version: Deleted', 'geodirectory')."</li>"; |
|
1088 | 1088 | } else { |
1089 | - $output_str .= "<li>" . $key . __(' Version: Not Found', 'geodirectory') . "</li>"; |
|
1089 | + $output_str .= "<li>".$key.__(' Version: Not Found', 'geodirectory')."</li>"; |
|
1090 | 1090 | } |
1091 | 1091 | |
1092 | 1092 | } |
1093 | 1093 | |
1094 | 1094 | if ($output_str) { |
1095 | - $output_str .= "<li><strong>" . __(' Upgrade/install scripts will run on next page reload.', 'geodirectory') . "</strong></li>"; |
|
1095 | + $output_str .= "<li><strong>".__(' Upgrade/install scripts will run on next page reload.', 'geodirectory')."</strong></li>"; |
|
1096 | 1096 | } |
1097 | 1097 | |
1098 | 1098 | } |
@@ -1129,43 +1129,43 @@ discard block |
||
1129 | 1129 | $output_str = ''; |
1130 | 1130 | |
1131 | 1131 | // check review locations |
1132 | - if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE post_city='' OR post_city IS NULL OR post_latitude='' OR post_latitude IS NULL")) { |
|
1133 | - $output_str .= "<li>" . __('Review locations missing or broken', 'geodirectory') . "</li>"; |
|
1132 | + if ($wpdb->get_results("SELECT * FROM ".GEODIR_REVIEW_TABLE." WHERE post_city='' OR post_city IS NULL OR post_latitude='' OR post_latitude IS NULL")) { |
|
1133 | + $output_str .= "<li>".__('Review locations missing or broken', 'geodirectory')."</li>"; |
|
1134 | 1134 | $is_error_during_diagnose = true; |
1135 | 1135 | |
1136 | 1136 | if ($fix) { |
1137 | 1137 | if (geodir_fix_review_location()) { |
1138 | - $output_str .= "<li><strong>" . __('-->FIXED: Review locations fixed', 'geodirectory') . "</strong></li>"; |
|
1138 | + $output_str .= "<li><strong>".__('-->FIXED: Review locations fixed', 'geodirectory')."</strong></li>"; |
|
1139 | 1139 | } else { |
1140 | - $output_str .= "<li><strong>" . __('-->FAILED: Review locations fix failed', 'geodirectory') . "</strong></li>"; |
|
1140 | + $output_str .= "<li><strong>".__('-->FAILED: Review locations fix failed', 'geodirectory')."</strong></li>"; |
|
1141 | 1141 | } |
1142 | 1142 | } |
1143 | 1143 | |
1144 | 1144 | } else { |
1145 | - $output_str .= "<li>" . __('Review locations ok', 'geodirectory') . "</li>"; |
|
1145 | + $output_str .= "<li>".__('Review locations ok', 'geodirectory')."</li>"; |
|
1146 | 1146 | } |
1147 | 1147 | |
1148 | 1148 | // check review content |
1149 | - if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_content IS NULL")) { |
|
1150 | - $output_str .= "<li>" . __('Review content missing or broken', 'geodirectory') . "</li>"; |
|
1149 | + if ($wpdb->get_results("SELECT * FROM ".GEODIR_REVIEW_TABLE." WHERE comment_content IS NULL")) { |
|
1150 | + $output_str .= "<li>".__('Review content missing or broken', 'geodirectory')."</li>"; |
|
1151 | 1151 | $is_error_during_diagnose = true; |
1152 | 1152 | |
1153 | 1153 | if ($fix) { |
1154 | 1154 | if (geodir_fix_review_content()) { |
1155 | - $output_str .= "<li><strong>" . __('-->FIXED: Review content fixed', 'geodirectory') . "</strong></li>"; |
|
1155 | + $output_str .= "<li><strong>".__('-->FIXED: Review content fixed', 'geodirectory')."</strong></li>"; |
|
1156 | 1156 | } else { |
1157 | - $output_str .= "<li><strong>" . __('-->FAILED: Review content fix failed', 'geodirectory') . "</strong></li>"; |
|
1157 | + $output_str .= "<li><strong>".__('-->FAILED: Review content fix failed', 'geodirectory')."</strong></li>"; |
|
1158 | 1158 | } |
1159 | 1159 | } |
1160 | 1160 | |
1161 | 1161 | } else { |
1162 | - $output_str .= "<li>" . __('Review content ok', 'geodirectory') . "</li>"; |
|
1162 | + $output_str .= "<li>".__('Review content ok', 'geodirectory')."</li>"; |
|
1163 | 1163 | } |
1164 | 1164 | |
1165 | 1165 | |
1166 | 1166 | if ($is_error_during_diagnose) { |
1167 | 1167 | $info_div_class = "geodir_problem_info"; |
1168 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />"; |
|
1168 | + $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />"; |
|
1169 | 1169 | } else { |
1170 | 1170 | $info_div_class = "geodir_noproblem_info"; |
1171 | 1171 | $fix_button_txt = ''; |
@@ -1229,7 +1229,7 @@ discard block |
||
1229 | 1229 | |
1230 | 1230 | if ($is_error_during_diagnose) { |
1231 | 1231 | $info_div_class = "geodir_problem_info"; |
1232 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='multisite_conversion' />"; |
|
1232 | + $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='multisite_conversion' />"; |
|
1233 | 1233 | } else { |
1234 | 1234 | $info_div_class = "geodir_noproblem_info"; |
1235 | 1235 | $fix_button_txt = ''; |
@@ -1263,7 +1263,7 @@ discard block |
||
1263 | 1263 | else { |
1264 | 1264 | $page_found = $wpdb->get_var( |
1265 | 1265 | $wpdb->prepare( |
1266 | - "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;", |
|
1266 | + "SELECT ID FROM ".$wpdb->posts." WHERE post_name = %s LIMIT 1;", |
|
1267 | 1267 | array($slug) |
1268 | 1268 | ) |
1269 | 1269 | ); |
@@ -1309,18 +1309,18 @@ discard block |
||
1309 | 1309 | ////////////////////////////////// |
1310 | 1310 | $option_value = get_option('geodir_home_page'); |
1311 | 1311 | $page = get_post($option_value); |
1312 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1312 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; } |
|
1313 | 1313 | |
1314 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1315 | - $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1314 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
1315 | + $output_str .= "<li>".__('GD Home page exists with proper setting.', 'geodirectory')."</li>"; |
|
1316 | 1316 | else { |
1317 | 1317 | $is_error_during_diagnose = true; |
1318 | - $output_str .= "<li><strong>" . __('GD Home page is missing.', 'geodirectory') . "</strong></li>"; |
|
1318 | + $output_str .= "<li><strong>".__('GD Home page is missing.', 'geodirectory')."</strong></li>"; |
|
1319 | 1319 | if ($fix) { |
1320 | 1320 | if (geodir_fix_virtual_page('gd-home', __('GD Home page', 'geodirectory'), $page_found, 'geodir_home_page')) { |
1321 | - $output_str .= "<li><strong>" . __('-->FIXED: GD Home page fixed', 'geodirectory') . "</strong></li>"; |
|
1321 | + $output_str .= "<li><strong>".__('-->FIXED: GD Home page fixed', 'geodirectory')."</strong></li>"; |
|
1322 | 1322 | } else { |
1323 | - $output_str .= "<li><strong>" . __('-->FAILED: GD Home page fix failed', 'geodirectory') . "</strong></li>"; |
|
1323 | + $output_str .= "<li><strong>".__('-->FAILED: GD Home page fix failed', 'geodirectory')."</strong></li>"; |
|
1324 | 1324 | } |
1325 | 1325 | } |
1326 | 1326 | } |
@@ -1334,18 +1334,18 @@ discard block |
||
1334 | 1334 | ////////////////////////////////// |
1335 | 1335 | $option_value = get_option('geodir_add_listing_page'); |
1336 | 1336 | $page = get_post($option_value); |
1337 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1337 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; } |
|
1338 | 1338 | |
1339 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1340 | - $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1339 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
1340 | + $output_str .= "<li>".__('Add Listing page exists with proper setting.', 'geodirectory')."</li>"; |
|
1341 | 1341 | else { |
1342 | 1342 | $is_error_during_diagnose = true; |
1343 | - $output_str .= "<li><strong>" . __('Add Listing page is missing.', 'geodirectory') . "</strong></li>"; |
|
1343 | + $output_str .= "<li><strong>".__('Add Listing page is missing.', 'geodirectory')."</strong></li>"; |
|
1344 | 1344 | if ($fix) { |
1345 | 1345 | if (geodir_fix_virtual_page('add-listing', __('Add Listing', 'geodirectory'), $page_found, 'geodir_add_listing_page')) { |
1346 | - $output_str .= "<li><strong>" . __('-->FIXED: Add Listing page fixed', 'geodirectory') . "</strong></li>"; |
|
1346 | + $output_str .= "<li><strong>".__('-->FIXED: Add Listing page fixed', 'geodirectory')."</strong></li>"; |
|
1347 | 1347 | } else { |
1348 | - $output_str .= "<li><strong>" . __('-->FAILED: Add Listing page fix failed', 'geodirectory') . "</strong></li>"; |
|
1348 | + $output_str .= "<li><strong>".__('-->FAILED: Add Listing page fix failed', 'geodirectory')."</strong></li>"; |
|
1349 | 1349 | } |
1350 | 1350 | } |
1351 | 1351 | } |
@@ -1360,18 +1360,18 @@ discard block |
||
1360 | 1360 | ////////////////////////////////// |
1361 | 1361 | $option_value = get_option('geodir_preview_page'); |
1362 | 1362 | $page = get_post($option_value); |
1363 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1363 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; } |
|
1364 | 1364 | |
1365 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1366 | - $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1365 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
1366 | + $output_str .= "<li>".__('Listing Preview page exists with proper setting.', 'geodirectory')."</li>"; |
|
1367 | 1367 | else { |
1368 | 1368 | $is_error_during_diagnose = true; |
1369 | - $output_str .= "<li><strong>" . __('Listing Preview page is missing.', 'geodirectory') . "</strong></li>"; |
|
1369 | + $output_str .= "<li><strong>".__('Listing Preview page is missing.', 'geodirectory')."</strong></li>"; |
|
1370 | 1370 | if ($fix) { |
1371 | 1371 | if (geodir_fix_virtual_page('listing-preview', __('Listing Preview', 'geodirectory'), $page_found, 'geodir_preview_page')) { |
1372 | - $output_str .= "<li><strong>" . __('-->FIXED: Listing Preview page fixed', 'geodirectory') . "</strong></li>"; |
|
1372 | + $output_str .= "<li><strong>".__('-->FIXED: Listing Preview page fixed', 'geodirectory')."</strong></li>"; |
|
1373 | 1373 | } else { |
1374 | - $output_str .= "<li><strong>" . __('-->FAILED: Listing Preview page fix failed', 'geodirectory') . "</strong></li>"; |
|
1374 | + $output_str .= "<li><strong>".__('-->FAILED: Listing Preview page fix failed', 'geodirectory')."</strong></li>"; |
|
1375 | 1375 | } |
1376 | 1376 | } |
1377 | 1377 | } |
@@ -1385,18 +1385,18 @@ discard block |
||
1385 | 1385 | ////////////////////////////////// |
1386 | 1386 | $option_value = get_option('geodir_success_page'); |
1387 | 1387 | $page = get_post($option_value); |
1388 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1388 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; } |
|
1389 | 1389 | |
1390 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1391 | - $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1390 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
1391 | + $output_str .= "<li>".__('Listing Success page exists with proper setting.', 'geodirectory')."</li>"; |
|
1392 | 1392 | else { |
1393 | 1393 | $is_error_during_diagnose = true; |
1394 | - $output_str .= "<li><strong>" . __('Listing Success page is missing.', 'geodirectory') . "</strong></li>"; |
|
1394 | + $output_str .= "<li><strong>".__('Listing Success page is missing.', 'geodirectory')."</strong></li>"; |
|
1395 | 1395 | if ($fix) { |
1396 | 1396 | if (geodir_fix_virtual_page('listing-success', __('Listing Success', 'geodirectory'), $page_found, 'geodir_success_page')) { |
1397 | - $output_str .= "<li><strong>" . __('-->FIXED: Listing Success page fixed', 'geodirectory') . "</strong></li>"; |
|
1397 | + $output_str .= "<li><strong>".__('-->FIXED: Listing Success page fixed', 'geodirectory')."</strong></li>"; |
|
1398 | 1398 | } else { |
1399 | - $output_str .= "<li><strong>" . __('-->FAILED: Listing Success page fix failed', 'geodirectory') . "</strong></li>"; |
|
1399 | + $output_str .= "<li><strong>".__('-->FAILED: Listing Success page fix failed', 'geodirectory')."</strong></li>"; |
|
1400 | 1400 | } |
1401 | 1401 | } |
1402 | 1402 | } |
@@ -1410,18 +1410,18 @@ discard block |
||
1410 | 1410 | ////////////////////////////////// |
1411 | 1411 | $option_value = get_option('geodir_info_page'); |
1412 | 1412 | $page = get_post($option_value); |
1413 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1413 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; } |
|
1414 | 1414 | |
1415 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1416 | - $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1415 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
1416 | + $output_str .= "<li>".__('Info page exists with proper setting.', 'geodirectory')."</li>"; |
|
1417 | 1417 | else { |
1418 | 1418 | $is_error_during_diagnose = true; |
1419 | - $output_str .= "<li><strong>" . __('Info page is missing.', 'geodirectory') . "</strong></li>"; |
|
1419 | + $output_str .= "<li><strong>".__('Info page is missing.', 'geodirectory')."</strong></li>"; |
|
1420 | 1420 | if ($fix) { |
1421 | 1421 | if (geodir_fix_virtual_page('gd-info', __('Info', 'geodirectory'), $page_found, 'geodir_info_page')) { |
1422 | - $output_str .= "<li><strong>" . __('-->FIXED: Info page fixed', 'geodirectory') . "</strong></li>"; |
|
1422 | + $output_str .= "<li><strong>".__('-->FIXED: Info page fixed', 'geodirectory')."</strong></li>"; |
|
1423 | 1423 | } else { |
1424 | - $output_str .= "<li><strong>" . __('-->FAILED: Info page fix failed', 'geodirectory') . "</strong></li>"; |
|
1424 | + $output_str .= "<li><strong>".__('-->FAILED: Info page fix failed', 'geodirectory')."</strong></li>"; |
|
1425 | 1425 | } |
1426 | 1426 | } |
1427 | 1427 | } |
@@ -1435,18 +1435,18 @@ discard block |
||
1435 | 1435 | ////////////////////////////////// |
1436 | 1436 | $option_value = get_option('geodir_login_page'); |
1437 | 1437 | $page = get_post($option_value); |
1438 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1438 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; } |
|
1439 | 1439 | |
1440 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1441 | - $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1440 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
1441 | + $output_str .= "<li>".__('Login page exists with proper setting.', 'geodirectory')."</li>"; |
|
1442 | 1442 | else { |
1443 | 1443 | $is_error_during_diagnose = true; |
1444 | - $output_str .= "<li><strong>" . __('Login page is missing.', 'geodirectory') . "</strong></li>"; |
|
1444 | + $output_str .= "<li><strong>".__('Login page is missing.', 'geodirectory')."</strong></li>"; |
|
1445 | 1445 | if ($fix) { |
1446 | 1446 | if (geodir_fix_virtual_page('gd-login', __('Login', 'geodirectory'), $page_found, 'geodir_login_page')) { |
1447 | - $output_str .= "<li><strong>" . __('-->FIXED: Login page fixed', 'geodirectory') . "</strong></li>"; |
|
1447 | + $output_str .= "<li><strong>".__('-->FIXED: Login page fixed', 'geodirectory')."</strong></li>"; |
|
1448 | 1448 | } else { |
1449 | - $output_str .= "<li><strong>" . __('-->FAILED: Login page fix failed', 'geodirectory') . "</strong></li>"; |
|
1449 | + $output_str .= "<li><strong>".__('-->FAILED: Login page fix failed', 'geodirectory')."</strong></li>"; |
|
1450 | 1450 | } |
1451 | 1451 | } |
1452 | 1452 | } |
@@ -1460,18 +1460,18 @@ discard block |
||
1460 | 1460 | ////////////////////////////////// |
1461 | 1461 | $option_value = get_option('geodir_location_page'); |
1462 | 1462 | $page = get_post($option_value); |
1463 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';} |
|
1463 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; } |
|
1464 | 1464 | |
1465 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
1466 | - $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>"; |
|
1465 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
1466 | + $output_str .= "<li>".__('Location page exists with proper setting.', 'geodirectory')."</li>"; |
|
1467 | 1467 | else { |
1468 | 1468 | $is_error_during_diagnose = true; |
1469 | - $output_str .= "<li><strong>" . __('Location page is missing.', 'geodirectory') . "</strong></li>"; |
|
1469 | + $output_str .= "<li><strong>".__('Location page is missing.', 'geodirectory')."</strong></li>"; |
|
1470 | 1470 | if ($fix) { |
1471 | 1471 | if (geodir_fix_virtual_page('location', __('Location', 'geodirectory'), $page_found, 'geodir_location_page')) { |
1472 | - $output_str .= "<li><strong>" . __('-->FIXED: Location page fixed', 'geodirectory') . "</strong></li>"; |
|
1472 | + $output_str .= "<li><strong>".__('-->FIXED: Location page fixed', 'geodirectory')."</strong></li>"; |
|
1473 | 1473 | } else { |
1474 | - $output_str .= "<li><strong>" . __('-->FAILED: Location page fix failed', 'geodirectory') . "</strong></li>"; |
|
1474 | + $output_str .= "<li><strong>".__('-->FAILED: Location page fix failed', 'geodirectory')."</strong></li>"; |
|
1475 | 1475 | } |
1476 | 1476 | } |
1477 | 1477 | } |
@@ -1480,13 +1480,13 @@ discard block |
||
1480 | 1480 | /* Diagnose Location Page Ends */ |
1481 | 1481 | //////////////////////////////// |
1482 | 1482 | |
1483 | - $page_chk_arr = array('output_str'=>$output_str,'is_error_during_diagnose'=>$is_error_during_diagnose ); |
|
1483 | + $page_chk_arr = array('output_str'=>$output_str, 'is_error_during_diagnose'=>$is_error_during_diagnose); |
|
1484 | 1484 | /** |
1485 | 1485 | * This action is called at the end of the GD Tools page check function. |
1486 | 1486 | * |
1487 | 1487 | * @since 1.5.2 |
1488 | 1488 | */ |
1489 | - $page_chk_arr = apply_filters('geodir_diagnose_default_pages',$page_chk_arr); |
|
1489 | + $page_chk_arr = apply_filters('geodir_diagnose_default_pages', $page_chk_arr); |
|
1490 | 1490 | |
1491 | 1491 | $output_str = $page_chk_arr['output_str']; |
1492 | 1492 | $is_error_during_diagnose = $page_chk_arr['is_error_during_diagnose']; |
@@ -1496,7 +1496,7 @@ discard block |
||
1496 | 1496 | flush_rewrite_rules(); |
1497 | 1497 | } |
1498 | 1498 | $info_div_class = "geodir_problem_info"; |
1499 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='default_pages' />"; |
|
1499 | + $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='default_pages' />"; |
|
1500 | 1500 | } else { |
1501 | 1501 | $info_div_class = "geodir_noproblem_info"; |
1502 | 1502 | $fix_button_txt = ''; |
@@ -1523,10 +1523,10 @@ discard block |
||
1523 | 1523 | $output_str = ''; |
1524 | 1524 | |
1525 | 1525 | if ($is_error_during_diagnose) { |
1526 | - $output_str .= "<li>" . __('Fail to load custom fields in to file for translation, please check file permission:', 'geodirectory') . ' ' . geodir_plugin_path() . '/db-language.php' . "</li>"; |
|
1526 | + $output_str .= "<li>".__('Fail to load custom fields in to file for translation, please check file permission:', 'geodirectory').' '.geodir_plugin_path().'/db-language.php'."</li>"; |
|
1527 | 1527 | $info_div_class = "geodir_problem_info"; |
1528 | 1528 | } else { |
1529 | - $output_str .= "<li>" . __('Load custom fields in to file for translation: ok', 'geodirectory') . "</li>"; |
|
1529 | + $output_str .= "<li>".__('Load custom fields in to file for translation: ok', 'geodirectory')."</li>"; |
|
1530 | 1530 | $info_div_class = "geodir_noproblem_info"; |
1531 | 1531 | $fix_button_txt = ''; |
1532 | 1532 | } |
@@ -1568,17 +1568,17 @@ discard block |
||
1568 | 1568 | global $wpdb, $wp_query, $plugin_prefix; |
1569 | 1569 | |
1570 | 1570 | if (is_admin() && !empty($wp_query->query_vars) && !empty($wp_query->query_vars['is_geodir_loop']) && !empty($wp_query->query_vars['orderby']) && $wp_query->query_vars['orderby'] == 'expire' && !empty($wp_query->query_vars['post_type']) && in_array($wp_query->query_vars['post_type'], geodir_get_posttypes()) && !empty($wp_query->query_vars['orderby']) && isset($clauses['join']) && isset($clauses['orderby']) && isset($clauses['fields'])) { |
1571 | - $table = $plugin_prefix . $wp_query->query_vars['post_type'] . '_detail'; |
|
1571 | + $table = $plugin_prefix.$wp_query->query_vars['post_type'].'_detail'; |
|
1572 | 1572 | |
1573 | - $join = $clauses['join'] . ' INNER JOIN ' . $table . ' AS gd_posts ON (gd_posts.post_id = ' . $wpdb->posts . '.ID)'; |
|
1573 | + $join = $clauses['join'].' INNER JOIN '.$table.' AS gd_posts ON (gd_posts.post_id = '.$wpdb->posts.'.ID)'; |
|
1574 | 1574 | $clauses['join'] = $join; |
1575 | 1575 | |
1576 | - $fields = $clauses['fields'] != '' ? $clauses['fields'] . ', ' : ''; |
|
1576 | + $fields = $clauses['fields'] != '' ? $clauses['fields'].', ' : ''; |
|
1577 | 1577 | $fields .= 'IF(UNIX_TIMESTAMP(DATE_FORMAT(gd_posts.expire_date, "%Y-%m-%d")), UNIX_TIMESTAMP(DATE_FORMAT(gd_posts.expire_date, "%Y-%m-%d")), 253402300799) AS gd_expire'; |
1578 | 1578 | $clauses['fields'] = $fields; |
1579 | 1579 | |
1580 | 1580 | $order = !empty($wp_query->query_vars['order']) ? $wp_query->query_vars['order'] : 'ASC'; |
1581 | - $orderby = 'gd_expire ' . $order; |
|
1581 | + $orderby = 'gd_expire '.$order; |
|
1582 | 1582 | $clauses['orderby'] = $orderby; |
1583 | 1583 | } |
1584 | 1584 | return $clauses; |
@@ -1621,7 +1621,7 @@ discard block |
||
1621 | 1621 | global $current_user; |
1622 | 1622 | $upload_dir = wp_upload_dir(); |
1623 | 1623 | |
1624 | - $file = $upload_dir['path'] . '/temp_' . $current_user->data->ID . '/geodir_tmp.csv'; |
|
1624 | + $file = $upload_dir['path'].'/temp_'.$current_user->data->ID.'/geodir_tmp.csv'; |
|
1625 | 1625 | $handle = fopen($file, 'w'); |
1626 | 1626 | |
1627 | 1627 | fwrite($handle, $input); |
@@ -1666,7 +1666,7 @@ discard block |
||
1666 | 1666 | $uploads_dir = $uploads['path']; |
1667 | 1667 | $image_name_arr = explode('/', $filename); |
1668 | 1668 | $filename = end($image_name_arr); |
1669 | - $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
1669 | + $target_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$filename; |
|
1670 | 1670 | $return = array(); |
1671 | 1671 | $return['file'] = $uploadedFile; |
1672 | 1672 | $return['error'] = __('The uploaded file is not a valid csv file. Please try again.', 'geodirectory'); |
@@ -1683,8 +1683,8 @@ discard block |
||
1683 | 1683 | |
1684 | 1684 | if (($handle = fopen($target_path, "r")) !== FALSE) { |
1685 | 1685 | while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { |
1686 | - if(is_array($data) && !empty($data)) { |
|
1687 | - $file[] = '"' . implode('","', $data) . '"'; |
|
1686 | + if (is_array($data) && !empty($data)) { |
|
1687 | + $file[] = '"'.implode('","', $data).'"'; |
|
1688 | 1688 | } |
1689 | 1689 | } |
1690 | 1690 | fclose($handle); |
@@ -1801,10 +1801,10 @@ discard block |
||
1801 | 1801 | $tag_arr = explode(',', $post_tags); |
1802 | 1802 | } |
1803 | 1803 | |
1804 | - $table = $plugin_prefix . $buffer[5] . '_detail'; // check table in database |
|
1804 | + $table = $plugin_prefix.$buffer[5].'_detail'; // check table in database |
|
1805 | 1805 | |
1806 | 1806 | $error = ''; |
1807 | - if ($wpdb->get_var("SHOW TABLES LIKE '" . $table . "'") != $table) { |
|
1807 | + if ($wpdb->get_var("SHOW TABLES LIKE '".$table."'") != $table) { |
|
1808 | 1808 | $invalid_post_type++; |
1809 | 1809 | continue; |
1810 | 1810 | } |
@@ -1830,7 +1830,7 @@ discard block |
||
1830 | 1830 | if ($buffer[$c] != '0' && $buffer[$c] != '') { |
1831 | 1831 | $submitdata = date('Y-m-d'); |
1832 | 1832 | |
1833 | - $gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata . "+" . addslashes($buffer[$c]) . " days")); |
|
1833 | + $gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata."+".addslashes($buffer[$c])." days")); |
|
1834 | 1834 | } else { |
1835 | 1835 | $gd_post_info['expire_date'] = 'Never'; |
1836 | 1836 | } |
@@ -1858,7 +1858,7 @@ discard block |
||
1858 | 1858 | |
1859 | 1859 | // Post status |
1860 | 1860 | if ($customKeyarray[$c] == 'post_status') { |
1861 | - $post_status = sanitize_key( $buffer[$c] ); |
|
1861 | + $post_status = sanitize_key($buffer[$c]); |
|
1862 | 1862 | } |
1863 | 1863 | } |
1864 | 1864 | |
@@ -1876,8 +1876,8 @@ discard block |
||
1876 | 1876 | |
1877 | 1877 | // Default post status |
1878 | 1878 | $default_status = 'publish'; |
1879 | - $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status; |
|
1880 | - $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status; |
|
1879 | + $post_status = !empty($post_status) ? sanitize_key($post_status) : $default_status; |
|
1880 | + $post_status = !empty($wp_post_statuses) && !isset($wp_post_statuses[$post_status]) ? $default_status : $post_status; |
|
1881 | 1881 | |
1882 | 1882 | $my_post['post_title'] = $post_title; |
1883 | 1883 | $my_post['post_content'] = $post_desc; |
@@ -1921,7 +1921,7 @@ discard block |
||
1921 | 1921 | $payment_info = array(); |
1922 | 1922 | $package_info = array(); |
1923 | 1923 | |
1924 | - $package_info = (array)geodir_post_package_info($package_info, '', $buffer[5]); |
|
1924 | + $package_info = (array) geodir_post_package_info($package_info, '', $buffer[5]); |
|
1925 | 1925 | $package_id = ''; |
1926 | 1926 | if (isset($gd_post_info['package_id']) && $gd_post_info['package_id'] != '') { |
1927 | 1927 | $package_id = $gd_post_info['package_id']; |
@@ -1931,7 +1931,7 @@ discard block |
||
1931 | 1931 | $payment_info['package_id'] = $package_info['pid']; |
1932 | 1932 | |
1933 | 1933 | if (isset($package_info['alive_days']) && $package_info['alive_days'] != 0) { |
1934 | - $payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['alive_days'] . " days")); |
|
1934 | + $payment_info['expire_date'] = date('Y-m-d', strtotime("+".$package_info['alive_days']." days")); |
|
1935 | 1935 | } else { |
1936 | 1936 | $payment_info['expire_date'] = 'Never'; |
1937 | 1937 | } |
@@ -1943,7 +1943,7 @@ discard block |
||
1943 | 1943 | |
1944 | 1944 | $post_type = get_post_type($last_postid); |
1945 | 1945 | |
1946 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
1946 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
1947 | 1947 | |
1948 | 1948 | geodir_save_post_info($last_postid, $gd_post_info); |
1949 | 1949 | |
@@ -1964,7 +1964,7 @@ discard block |
||
1964 | 1964 | $attachment['post_id'] = $last_postid; |
1965 | 1965 | $attachment['title'] = $img_name_arr[0]; |
1966 | 1966 | $attachment['content'] = ''; |
1967 | - $attachment['file'] = $sub_dir . '/' . $image_name; |
|
1967 | + $attachment['file'] = $sub_dir.'/'.$image_name; |
|
1968 | 1968 | $attachment['mime_type'] = $uploaded_file_type; |
1969 | 1969 | $attachment['menu_order'] = $menu_order; |
1970 | 1970 | $attachment['is_featured'] = 0; |
@@ -1973,15 +1973,15 @@ discard block |
||
1973 | 1973 | |
1974 | 1974 | foreach ($attachment as $key => $val) { |
1975 | 1975 | if ($val != '') |
1976 | - $attachment_set .= $key . " = '" . $val . "', "; |
|
1976 | + $attachment_set .= $key." = '".$val."', "; |
|
1977 | 1977 | } |
1978 | 1978 | $attachment_set = trim($attachment_set, ", "); |
1979 | 1979 | |
1980 | - $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set); |
|
1980 | + $wpdb->query("INSERT INTO ".GEODIR_ATTACHMENT_TABLE." SET ".$attachment_set); |
|
1981 | 1981 | |
1982 | 1982 | if ($menu_order == 1) { |
1983 | 1983 | $post_type = get_post_type($last_postid); |
1984 | - $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($sub_dir . '/' . $image_name, $last_postid))); |
|
1984 | + $wpdb->query($wpdb->prepare("UPDATE ".$table." SET featured_image = %s where post_id =%d", array($sub_dir.'/'.$image_name, $last_postid))); |
|
1985 | 1985 | } |
1986 | 1986 | $menu_order++; |
1987 | 1987 | } |
@@ -2022,11 +2022,11 @@ discard block |
||
2022 | 2022 | } |
2023 | 2023 | |
2024 | 2024 | // Add the tab in left sidebar menu fro import & export page. |
2025 | -add_filter( 'geodir_settings_tabs_array', 'geodir_import_export_tab', 94 ); |
|
2025 | +add_filter('geodir_settings_tabs_array', 'geodir_import_export_tab', 94); |
|
2026 | 2026 | |
2027 | 2027 | // Handle ajax request for import/export. |
2028 | -add_action( 'wp_ajax_geodir_import_export', 'geodir_ajax_import_export' ); |
|
2029 | -add_action( 'wp_ajax_nopriv_geodir_import_exportn', 'geodir_ajax_import_export' ); |
|
2028 | +add_action('wp_ajax_geodir_import_export', 'geodir_ajax_import_export'); |
|
2029 | +add_action('wp_ajax_nopriv_geodir_import_exportn', 'geodir_ajax_import_export'); |
|
2030 | 2030 | |
2031 | 2031 | |
2032 | 2032 | /** |
@@ -2037,40 +2037,40 @@ discard block |
||
2037 | 2037 | * @param $post_id int $post_id The post ID of the post being saved. |
2038 | 2038 | * @param $post object $post The post object of the post being saved. |
2039 | 2039 | */ |
2040 | -function geodir_update_location_prefix($post_id,$post){ |
|
2041 | - if($post->post_type=='page' && $post->post_name && $post_id==get_option('geodir_location_page')){ |
|
2042 | - update_option('geodir_location_prefix',$post->post_name); |
|
2040 | +function geodir_update_location_prefix($post_id, $post) { |
|
2041 | + if ($post->post_type == 'page' && $post->post_name && $post_id == get_option('geodir_location_page')) { |
|
2042 | + update_option('geodir_location_prefix', $post->post_name); |
|
2043 | 2043 | } |
2044 | 2044 | |
2045 | 2045 | } |
2046 | 2046 | |
2047 | -add_action('save_post', 'geodir_update_location_prefix',10,2); |
|
2047 | +add_action('save_post', 'geodir_update_location_prefix', 10, 2); |
|
2048 | 2048 | |
2049 | -add_action( 'wp_ajax_geodir_ga_callback', 'geodir_ga_callback' ); |
|
2049 | +add_action('wp_ajax_geodir_ga_callback', 'geodir_ga_callback'); |
|
2050 | 2050 | |
2051 | -function geodir_ga_callback(){ |
|
2051 | +function geodir_ga_callback() { |
|
2052 | 2052 | |
2053 | -if(isset($_REQUEST['code']) && $_REQUEST['code']) { |
|
2053 | +if (isset($_REQUEST['code']) && $_REQUEST['code']) { |
|
2054 | 2054 | $oAuthURL = "https://www.googleapis.com/oauth2/v3/token?"; |
2055 | 2055 | $code = "code=".$_REQUEST['code']; |
2056 | 2056 | $grant_type = "&grant_type=authorization_code"; |
2057 | - $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback"; |
|
2057 | + $redirect_uri = "&redirect_uri=".admin_url('admin-ajax.php')."?action=geodir_ga_callback"; |
|
2058 | 2058 | $client_id = "&client_id=".get_option('geodir_ga_client_id'); |
2059 | 2059 | $client_secret = "&client_secret=".get_option('geodir_ga_client_secret'); |
2060 | 2060 | |
2061 | - $auth_url = $oAuthURL . $code . $redirect_uri . $grant_type . $client_id .$client_secret; |
|
2061 | + $auth_url = $oAuthURL.$code.$redirect_uri.$grant_type.$client_id.$client_secret; |
|
2062 | 2062 | |
2063 | 2063 | $response = wp_remote_post($auth_url, array('timeout' => 15)); |
2064 | 2064 | |
2065 | 2065 | //print_r($response); |
2066 | 2066 | |
2067 | - $error_msg = __('Something went wrong','geodirectory'); |
|
2068 | - if(!empty($response['response']['code']) && $response['response']['code']==200){ |
|
2067 | + $error_msg = __('Something went wrong', 'geodirectory'); |
|
2068 | + if (!empty($response['response']['code']) && $response['response']['code'] == 200) { |
|
2069 | 2069 | |
2070 | 2070 | $parts = json_decode($response['body']); |
2071 | 2071 | //print_r($parts); |
2072 | - if(!isset($parts->access_token)){echo $error_msg." - #1";exit;} |
|
2073 | - else{ |
|
2072 | + if (!isset($parts->access_token)) {echo $error_msg." - #1"; exit; } |
|
2073 | + else { |
|
2074 | 2074 | |
2075 | 2075 | update_option('gd_ga_access_token', $parts->access_token); |
2076 | 2076 | update_option('gd_ga_refresh_token', $parts->refresh_token); |
@@ -2079,25 +2079,25 @@ discard block |
||
2079 | 2079 | |
2080 | 2080 | |
2081 | 2081 | } |
2082 | - elseif(!empty($response['response']['code'])) { |
|
2082 | + elseif (!empty($response['response']['code'])) { |
|
2083 | 2083 | $parts = json_decode($response['body']); |
2084 | 2084 | |
2085 | - if(isset($parts->error)){ |
|
2086 | - echo $parts->error.": ".$parts->error_description;exit; |
|
2087 | - }else{ |
|
2088 | - echo $error_msg." - #2";exit; |
|
2085 | + if (isset($parts->error)) { |
|
2086 | + echo $parts->error.": ".$parts->error_description; exit; |
|
2087 | + } else { |
|
2088 | + echo $error_msg." - #2"; exit; |
|
2089 | 2089 | } |
2090 | 2090 | |
2091 | - }else{ |
|
2091 | + } else { |
|
2092 | 2092 | |
2093 | - echo $error_msg." - #3";exit; |
|
2093 | + echo $error_msg." - #3"; exit; |
|
2094 | 2094 | |
2095 | 2095 | } |
2096 | 2096 | } |
2097 | 2097 | exit; |
2098 | 2098 | } |
2099 | 2099 | |
2100 | -add_filter( 'icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4 ); |
|
2100 | +add_filter('icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4); |
|
2101 | 2101 | |
2102 | 2102 | if (isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'permalink_settings') { |
2103 | 2103 | add_action('geodir_before_admin_panel', 'geodir_wpml_permalink_setting_notice'); |
@@ -46,31 +46,31 @@ discard block |
||
46 | 46 | function geodir_admin_styles() |
47 | 47 | { |
48 | 48 | |
49 | - wp_register_style('geodirectory-admin-css', geodir_plugin_url() . '/geodirectory-assets/css/admin.css', array(), GEODIRECTORY_VERSION); |
|
49 | + wp_register_style('geodirectory-admin-css', geodir_plugin_url().'/geodirectory-assets/css/admin.css', array(), GEODIRECTORY_VERSION); |
|
50 | 50 | wp_enqueue_style('geodirectory-admin-css'); |
51 | 51 | |
52 | - wp_register_style('geodirectory-frontend-style', geodir_plugin_url() . '/geodirectory-assets/css/style.css', array(), GEODIRECTORY_VERSION); |
|
52 | + wp_register_style('geodirectory-frontend-style', geodir_plugin_url().'/geodirectory-assets/css/style.css', array(), GEODIRECTORY_VERSION); |
|
53 | 53 | wp_enqueue_style('geodirectory-frontend-style'); |
54 | 54 | |
55 | - wp_register_style('geodir-chosen-style', geodir_plugin_url() . '/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION); |
|
55 | + wp_register_style('geodir-chosen-style', geodir_plugin_url().'/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION); |
|
56 | 56 | wp_enqueue_style('geodir-chosen-style'); |
57 | 57 | |
58 | - wp_register_style('geodirectory-jquery-ui-timepicker-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery.ui.timepicker.css', array(), GEODIRECTORY_VERSION); |
|
58 | + wp_register_style('geodirectory-jquery-ui-timepicker-css', geodir_plugin_url().'/geodirectory-assets/css/jquery.ui.timepicker.css', array(), GEODIRECTORY_VERSION); |
|
59 | 59 | wp_enqueue_style('geodirectory-jquery-ui-timepicker-css'); |
60 | 60 | |
61 | - wp_register_style('geodirectory-jquery-ui-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery-ui.css', array(), GEODIRECTORY_VERSION); |
|
61 | + wp_register_style('geodirectory-jquery-ui-css', geodir_plugin_url().'/geodirectory-assets/css/jquery-ui.css', array(), GEODIRECTORY_VERSION); |
|
62 | 62 | wp_enqueue_style('geodirectory-jquery-ui-css'); |
63 | 63 | |
64 | - wp_register_style('geodirectory-custom-fields-css', geodir_plugin_url() . '/geodirectory-assets/css/custom_field.css', array(), GEODIRECTORY_VERSION); |
|
64 | + wp_register_style('geodirectory-custom-fields-css', geodir_plugin_url().'/geodirectory-assets/css/custom_field.css', array(), GEODIRECTORY_VERSION); |
|
65 | 65 | wp_enqueue_style('geodirectory-custom-fields-css'); |
66 | 66 | |
67 | - wp_register_style('geodirectory-pluplodar-css', geodir_plugin_url() . '/geodirectory-assets/css/pluploader.css', array(), GEODIRECTORY_VERSION); |
|
67 | + wp_register_style('geodirectory-pluplodar-css', geodir_plugin_url().'/geodirectory-assets/css/pluploader.css', array(), GEODIRECTORY_VERSION); |
|
68 | 68 | wp_enqueue_style('geodirectory-pluplodar-css'); |
69 | 69 | |
70 | - wp_register_style('geodir-rating-style', geodir_plugin_url() . '/geodirectory-assets/css/jRating.jquery.css', array(), GEODIRECTORY_VERSION); |
|
70 | + wp_register_style('geodir-rating-style', geodir_plugin_url().'/geodirectory-assets/css/jRating.jquery.css', array(), GEODIRECTORY_VERSION); |
|
71 | 71 | wp_enqueue_style('geodir-rating-style'); |
72 | 72 | |
73 | - wp_register_style('geodir-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl.css', array(), GEODIRECTORY_VERSION); |
|
73 | + wp_register_style('geodir-rtl-style', geodir_plugin_url().'/geodirectory-assets/css/rtl.css', array(), GEODIRECTORY_VERSION); |
|
74 | 74 | wp_enqueue_style('geodir-rtl-style'); |
75 | 75 | |
76 | 76 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | wp_register_style('geodirectory-font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION); |
90 | 90 | wp_enqueue_style('geodirectory-font-awesome'); |
91 | 91 | |
92 | - wp_register_script('geodirectory-admin', geodir_plugin_url() . '/geodirectory-assets/js/admin-req.min.js', array('jquery'), GEODIRECTORY_VERSION); |
|
92 | + wp_register_script('geodirectory-admin', geodir_plugin_url().'/geodirectory-assets/js/admin-req.min.js', array('jquery'), GEODIRECTORY_VERSION); |
|
93 | 93 | wp_enqueue_script('geodirectory-admin'); |
94 | 94 | |
95 | 95 | } |
@@ -107,41 +107,41 @@ discard block |
||
107 | 107 | |
108 | 108 | wp_enqueue_script('jquery'); |
109 | 109 | |
110 | - 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); |
|
110 | + wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.ui.timepicker.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), '', true); |
|
111 | 111 | |
112 | - wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.js', array(), GEODIRECTORY_VERSION); |
|
112 | + wp_register_script('chosen', geodir_plugin_url().'/geodirectory-assets/js/chosen.jquery.js', array(), GEODIRECTORY_VERSION); |
|
113 | 113 | wp_enqueue_script('chosen'); |
114 | 114 | |
115 | - wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.js', array(), GEODIRECTORY_VERSION); |
|
115 | + wp_register_script('geodirectory-choose-ajax', geodir_plugin_url().'/geodirectory-assets/js/ajax-chosen.js', array(), GEODIRECTORY_VERSION); |
|
116 | 116 | wp_enqueue_script('geodirectory-choose-ajax'); |
117 | 117 | |
118 | 118 | if (isset($_REQUEST['listing_type'])) { |
119 | - wp_register_script('geodirectory-custom-fields-script', geodir_plugin_url() . '/geodirectory-assets/js/custom_fields.js', array(), GEODIRECTORY_VERSION); |
|
119 | + wp_register_script('geodirectory-custom-fields-script', geodir_plugin_url().'/geodirectory-assets/js/custom_fields.js', array(), GEODIRECTORY_VERSION); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | wp_enqueue_script('geodirectory-custom-fields-script'); |
123 | - $plugin_path = geodir_plugin_url() . '/geodirectory-functions/cat-meta-functions'; |
|
123 | + $plugin_path = geodir_plugin_url().'/geodirectory-functions/cat-meta-functions'; |
|
124 | 124 | |
125 | - wp_enqueue_script('tax-meta-clss', $plugin_path . '/js/tax-meta-clss.js', array('jquery'), null, true); |
|
125 | + wp_enqueue_script('tax-meta-clss', $plugin_path.'/js/tax-meta-clss.js', array('jquery'), null, true); |
|
126 | 126 | |
127 | - $map_lang = "&language=" . geodir_get_map_default_language(); |
|
127 | + $map_lang = "&language=".geodir_get_map_default_language(); |
|
128 | 128 | /** This filter is documented in geodirectory_template_tags.php */ |
129 | 129 | $map_extra = apply_filters('geodir_googlemap_script_extra', ''); |
130 | - wp_enqueue_script('geodirectory-googlemap-script', '//maps.google.com/maps/api/js?' . $map_lang . $map_extra, '', NULL); |
|
130 | + wp_enqueue_script('geodirectory-googlemap-script', '//maps.google.com/maps/api/js?'.$map_lang.$map_extra, '', NULL); |
|
131 | 131 | |
132 | - wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.js', array(), GEODIRECTORY_VERSION); |
|
132 | + wp_register_script('geodirectory-goMap-script', geodir_plugin_url().'/geodirectory-assets/js/goMap.js', array(), GEODIRECTORY_VERSION); |
|
133 | 133 | wp_enqueue_script('geodirectory-goMap-script'); |
134 | 134 | |
135 | 135 | // font awesome rating script |
136 | 136 | if (get_option('geodir_reviewrating_enable_font_awesome')) { |
137 | - wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION); |
|
137 | + wp_register_script('geodir-barrating-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION); |
|
138 | 138 | wp_enqueue_script('geodir-barrating-js'); |
139 | 139 | } else { // default rating script |
140 | - wp_register_script('geodir-jRating-js', geodir_plugin_url() . '/geodirectory-assets/js/jRating.jquery.js', array(), GEODIRECTORY_VERSION); |
|
140 | + wp_register_script('geodir-jRating-js', geodir_plugin_url().'/geodirectory-assets/js/jRating.jquery.js', array(), GEODIRECTORY_VERSION); |
|
141 | 141 | wp_enqueue_script('geodir-jRating-js'); |
142 | 142 | } |
143 | 143 | |
144 | - wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.js', array(), GEODIRECTORY_VERSION); |
|
144 | + wp_register_script('geodir-on-document-load', geodir_plugin_url().'/geodirectory-assets/js/on_document_load.js', array(), GEODIRECTORY_VERSION); |
|
145 | 145 | wp_enqueue_script('geodir-on-document-load'); |
146 | 146 | |
147 | 147 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | wp_enqueue_script('plupload-all'); |
150 | 150 | wp_enqueue_script('jquery-ui-sortable'); |
151 | 151 | |
152 | - wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.js', array(), GEODIRECTORY_VERSION); |
|
152 | + wp_register_script('geodirectory-plupload-script', geodir_plugin_url().'/geodirectory-assets/js/geodirectory-plupload.js', array(), GEODIRECTORY_VERSION); |
|
153 | 153 | wp_enqueue_script('geodirectory-plupload-script'); |
154 | 154 | |
155 | 155 | // SCRIPT FOR UPLOAD END |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | wp_localize_script('geodirectory-custom-fields-script', 'geodir_admin_ajax', $ajax_cons_data); |
204 | 204 | |
205 | 205 | |
206 | - wp_register_script('geodirectory-admin-script', geodir_plugin_url() . '/geodirectory-assets/js/admin.js', array(), GEODIRECTORY_VERSION); |
|
206 | + wp_register_script('geodirectory-admin-script', geodir_plugin_url().'/geodirectory-assets/js/admin.js', array(), GEODIRECTORY_VERSION); |
|
207 | 207 | wp_enqueue_script('geodirectory-admin-script'); |
208 | 208 | |
209 | 209 | wp_enqueue_style('farbtastic'); |
@@ -211,10 +211,10 @@ discard block |
||
211 | 211 | |
212 | 212 | $screen = get_current_screen(); |
213 | 213 | if ($screen->base == 'post' && in_array($screen->post_type, geodir_get_posttypes())) { |
214 | - wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation_admin.js'); |
|
214 | + wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url().'/geodirectory-assets/js/listing_validation_admin.js'); |
|
215 | 215 | } |
216 | 216 | |
217 | - $ajax_cons_data = array('url' => __(get_option('siteurl') . '?geodir_ajax=true')); |
|
217 | + $ajax_cons_data = array('url' => __(get_option('siteurl').'?geodir_ajax=true')); |
|
218 | 218 | wp_localize_script('geodirectory-admin-script', 'geodir_ajax', $ajax_cons_data); |
219 | 219 | |
220 | 220 | } |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | |
238 | 238 | if (current_user_can('manage_options')) $menu[] = array('', 'read', 'separator-geodirectory', '', 'wp-menu-separator geodirectory'); |
239 | 239 | |
240 | - add_menu_page(__('Geodirectory', 'geodirectory'), __('Geodirectory', 'geodirectory'), 'manage_options', 'geodirectory', 'geodir_admin_panel', geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico', '55.1984'); |
|
240 | + add_menu_page(__('Geodirectory', 'geodirectory'), __('Geodirectory', 'geodirectory'), 'manage_options', 'geodirectory', 'geodir_admin_panel', geodir_plugin_url().'/geodirectory-assets/images/favicon.ico', '55.1984'); |
|
241 | 241 | |
242 | 242 | |
243 | 243 | } |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | $geodir_menu_order[] = 'separator-geodirectory'; |
272 | 272 | if (!empty($post_types)) { |
273 | 273 | foreach ($post_types as $post_type) { |
274 | - $geodir_menu_order[] = 'edit.php?post_type=' . $post_type; |
|
274 | + $geodir_menu_order[] = 'edit.php?post_type='.$post_type; |
|
275 | 275 | } |
276 | 276 | } |
277 | 277 | $geodir_menu_order[] = $item; |
@@ -314,8 +314,8 @@ discard block |
||
314 | 314 | { |
315 | 315 | if (isset($_REQUEST['installed']) && $_REQUEST['installed'] != '') { |
316 | 316 | echo '<div id="message" class="updated fade"> |
317 | - <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> |
|
318 | - <p><strong>' . __('Geodirectory has been installed and setup. Enjoy :)', 'geodirectory') . '</strong></p> |
|
317 | + <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> |
|
318 | + <p><strong>' . __('Geodirectory has been installed and setup. Enjoy :)', 'geodirectory').'</strong></p> |
|
319 | 319 | </div>'; |
320 | 320 | |
321 | 321 | } |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | if (isset($_REQUEST['msg']) && $_REQUEST['msg'] != '') { |
324 | 324 | switch ($_REQUEST['msg']) { |
325 | 325 | case 'success': |
326 | - echo '<div id="message" class="updated fade"><p><strong>' . __('Your settings have been saved.', 'geodirectory') . '</strong></p></div>'; |
|
326 | + echo '<div id="message" class="updated fade"><p><strong>'.__('Your settings have been saved.', 'geodirectory').'</strong></p></div>'; |
|
327 | 327 | flush_rewrite_rules(false); |
328 | 328 | |
329 | 329 | break; |
@@ -331,20 +331,20 @@ discard block |
||
331 | 331 | $gderr = isset($_REQUEST['gderr']) ? $_REQUEST['gderr'] : ''; |
332 | 332 | |
333 | 333 | if ($gderr == 21) |
334 | - 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>'; |
|
334 | + 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 | 335 | else |
336 | - echo '<div id="message" class="error fade"><p><strong>' . __('Error: Your settings have not been saved, please try again.', 'geodirectory') . '</strong></p></div>'; |
|
336 | + echo '<div id="message" class="error fade"><p><strong>'.__('Error: Your settings have not been saved, please try again.', 'geodirectory').'</strong></p></div>'; |
|
337 | 337 | break; |
338 | 338 | } |
339 | 339 | } |
340 | 340 | |
341 | 341 | if (!geodir_is_default_location_set()) { |
342 | - 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>'; |
|
342 | + 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>'; |
|
343 | 343 | |
344 | 344 | } |
345 | 345 | |
346 | 346 | if (!function_exists('curl_init')) { |
347 | - 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>'; |
|
347 | + 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>'; |
|
348 | 348 | |
349 | 349 | } |
350 | 350 | } |
@@ -360,18 +360,18 @@ discard block |
||
360 | 360 | function geodir_handle_option_form_submit($current_tab) |
361 | 361 | { |
362 | 362 | global $geodir_settings; |
363 | - if (file_exists(dirname(__FILE__) . '/option-pages/' . $current_tab . '_array.php')) { |
|
363 | + if (file_exists(dirname(__FILE__).'/option-pages/'.$current_tab.'_array.php')) { |
|
364 | 364 | /** |
365 | 365 | * Contains settings array for current tab. |
366 | 366 | * |
367 | 367 | * @since 1.0.0 |
368 | 368 | * @package GeoDirectory |
369 | 369 | */ |
370 | - include_once('option-pages/' . $current_tab . '_array.php'); |
|
370 | + include_once('option-pages/'.$current_tab.'_array.php'); |
|
371 | 371 | } |
372 | 372 | if (isset($_POST) && $_POST && isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') : |
373 | 373 | if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) die(__('Action failed. Please refresh the page and retry.', 'geodirectory')); |
374 | - if (!wp_verify_nonce($_REQUEST['_wpnonce-' . $current_tab], 'geodir-settings-' . $current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory')); |
|
374 | + if (!wp_verify_nonce($_REQUEST['_wpnonce-'.$current_tab], 'geodir-settings-'.$current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory')); |
|
375 | 375 | |
376 | 376 | /** |
377 | 377 | * Fires before updating geodirectory admin settings. |
@@ -404,13 +404,13 @@ discard block |
||
404 | 404 | * @param string $current_tab The current settings tab name. |
405 | 405 | * @param array $geodir_settings[$current_tab] The array of settings for the current settings tab. |
406 | 406 | */ |
407 | - do_action('geodir_update_options_' . $current_tab, $geodir_settings[$current_tab]); |
|
407 | + do_action('geodir_update_options_'.$current_tab, $geodir_settings[$current_tab]); |
|
408 | 408 | |
409 | 409 | flush_rewrite_rules(false); |
410 | 410 | |
411 | 411 | $current_tab = isset($_REQUEST['tab']) ? $_REQUEST['tab'] : ''; |
412 | 412 | |
413 | - $redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $_REQUEST['active_tab'] . '&msg=success'); |
|
413 | + $redirect_url = admin_url('admin.php?page=geodirectory&tab='.$current_tab.'&active_tab='.$_REQUEST['active_tab'].'&msg=success'); |
|
414 | 414 | |
415 | 415 | wp_redirect($redirect_url); |
416 | 416 | exit(); |
@@ -436,18 +436,18 @@ discard block |
||
436 | 436 | global $wpdb, $plugin_prefix; |
437 | 437 | |
438 | 438 | if (!geodir_is_default_location_set()) { |
439 | - 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>'; |
|
439 | + 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>'; |
|
440 | 440 | } else { |
441 | 441 | |
442 | - $geodir_url = admin_url() . 'admin.php?page=geodirectory&tab=general_settings&active_tab='; |
|
442 | + $geodir_url = admin_url().'admin.php?page=geodirectory&tab=general_settings&active_tab='; |
|
443 | 443 | |
444 | - $post_counts = $wpdb->get_var("SELECT count(post_id) FROM " . $plugin_prefix . $post_type . "_detail WHERE post_dummy='1'"); |
|
444 | + $post_counts = $wpdb->get_var("SELECT count(post_id) FROM ".$plugin_prefix.$post_type."_detail WHERE post_dummy='1'"); |
|
445 | 445 | |
446 | 446 | if ($post_counts > 0) { |
447 | 447 | $nonce = wp_create_nonce('geodir_dummy_posts_delete_noncename'); |
448 | 448 | |
449 | - $dummy_msg = '<div id="" class="geodir_auto_install updated highlight fade"><p><b>' . SAMPLE_DATA_SHOW_MSG . '</b><br /><a id="geodir_dummy_delete" class="button_delete" onclick="geodir_autoinstall(this,\'geodir_dummy_delete\',\'' . $nonce . '\',\'' . $post_type . '\')" href="javascript:void(0);" redirect_to="' . $geodir_url . '" >' . DELETE_BTN_SAMPLE_MSG . '</a></p></div>'; |
|
450 | - $dummy_msg .= '<div id="" style="display:none;" class="geodir_show_progress updated highlight fade"><p><b>' . GEODIR_SAMPLE_DATA_DELETE_MSG . '</b><br><img src="' . geodir_plugin_url() . '/geodirectory-assets/images/loadingAnimation.gif" /></p></div>'; |
|
449 | + $dummy_msg = '<div id="" class="geodir_auto_install updated highlight fade"><p><b>'.SAMPLE_DATA_SHOW_MSG.'</b><br /><a id="geodir_dummy_delete" class="button_delete" onclick="geodir_autoinstall(this,\'geodir_dummy_delete\',\''.$nonce.'\',\''.$post_type.'\')" href="javascript:void(0);" redirect_to="'.$geodir_url.'" >'.DELETE_BTN_SAMPLE_MSG.'</a></p></div>'; |
|
450 | + $dummy_msg .= '<div id="" style="display:none;" class="geodir_show_progress updated highlight fade"><p><b>'.GEODIR_SAMPLE_DATA_DELETE_MSG.'</b><br><img src="'.geodir_plugin_url().'/geodirectory-assets/images/loadingAnimation.gif" /></p></div>'; |
|
451 | 451 | } else { |
452 | 452 | $options_list = ''; |
453 | 453 | for ($option = 1; $option <= 30; $option++) { |
@@ -455,13 +455,13 @@ discard block |
||
455 | 455 | if ($option == 10) |
456 | 456 | $selected = 'selected="selected"'; |
457 | 457 | |
458 | - $options_list .= '<option ' . $selected . ' value="' . $option . '">' . $option . '</option>'; |
|
458 | + $options_list .= '<option '.$selected.' value="'.$option.'">'.$option.'</option>'; |
|
459 | 459 | } |
460 | 460 | |
461 | 461 | $nonce = wp_create_nonce('geodir_dummy_posts_insert_noncename'); |
462 | 462 | |
463 | - $dummy_msg = '<div id="" class="geodir_auto_install updated highlight fade"><p><b>' . AUTO_INSATALL_MSG . '</b><br /><select class="selected_sample_data">' . $options_list . '</select><a id="geodir_dummy_insert" class="button_insert" href="javascript:void(0);" onclick="geodir_autoinstall(this,\'geodir_dummy_insert\',\'' . $nonce . '\',\'' . $post_type . '\')" redirect_to="' . $geodir_url . '" >' . INSERT_BTN_SAMPLE_MSG . '</a></p></div>'; |
|
464 | - $dummy_msg .= '<div id="" style="display:none;" class="geodir_show_progress updated highlight fade"><p><b>' . GEODIR_SAMPLE_DATA_IMPORT_MSG . '</b><br><img src="' . geodir_plugin_url() . '/geodirectory-assets/images/loadingAnimation.gif" /><br><span class="dummy_post_inserted"></span></div>'; |
|
463 | + $dummy_msg = '<div id="" class="geodir_auto_install updated highlight fade"><p><b>'.AUTO_INSATALL_MSG.'</b><br /><select class="selected_sample_data">'.$options_list.'</select><a id="geodir_dummy_insert" class="button_insert" href="javascript:void(0);" onclick="geodir_autoinstall(this,\'geodir_dummy_insert\',\''.$nonce.'\',\''.$post_type.'\')" redirect_to="'.$geodir_url.'" >'.INSERT_BTN_SAMPLE_MSG.'</a></p></div>'; |
|
464 | + $dummy_msg .= '<div id="" style="display:none;" class="geodir_show_progress updated highlight fade"><p><b>'.GEODIR_SAMPLE_DATA_IMPORT_MSG.'</b><br><img src="'.geodir_plugin_url().'/geodirectory-assets/images/loadingAnimation.gif" /><br><span class="dummy_post_inserted"></span></div>'; |
|
465 | 465 | |
466 | 466 | } |
467 | 467 | echo $dummy_msg; |
@@ -470,15 +470,15 @@ discard block |
||
470 | 470 | <?php |
471 | 471 | |
472 | 472 | $default_location = geodir_get_default_location(); |
473 | - $city = isset($default_location->city) ? $default_location->city : ''; |
|
474 | - $region =isset($default_location->region) ? $default_location->region : ''; |
|
475 | - $country =isset($default_location->country) ? $default_location->country : ''; |
|
476 | - $city_latitude =isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
477 | - $city_longitude =isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
473 | + $city = isset($default_location->city) ? $default_location->city : ''; |
|
474 | + $region = isset($default_location->region) ? $default_location->region : ''; |
|
475 | + $country = isset($default_location->country) ? $default_location->country : ''; |
|
476 | + $city_latitude = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
477 | + $city_longitude = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
478 | 478 | |
479 | 479 | ?> |
480 | 480 | var geocoder = new google.maps.Geocoder(); |
481 | - var CITY_ADDRESS = '<?php echo $city.','.$region.','.$country;?>'; |
|
481 | + var CITY_ADDRESS = '<?php echo $city.','.$region.','.$country; ?>'; |
|
482 | 482 | var bound_lat_lng; |
483 | 483 | var lat = <?php echo $city_latitude; ?>; |
484 | 484 | var lng = <?php echo $city_longitude; ?>; |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | ); |
516 | 516 | |
517 | 517 | } else { |
518 | - alert("<?php _e('Geocode was not successful for the following reason:','geodirectory');?> " + status); |
|
518 | + alert("<?php _e('Geocode was not successful for the following reason:', 'geodirectory'); ?> " + status); |
|
519 | 519 | } |
520 | 520 | }); |
521 | 521 | |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | var total_dummy_post_count = jQuery('#sub_' + active_tab).find('.selected_sample_data').val(); |
529 | 529 | |
530 | 530 | if (id == 'geodir_dummy_delete') { |
531 | - if (confirm('<?php _e('Are you sure you want to delete dummy data?' , 'geodirectory'); ?>')) { |
|
531 | + if (confirm('<?php _e('Are you sure you want to delete dummy data?', 'geodirectory'); ?>')) { |
|
532 | 532 | jQuery('#sub_' + active_tab).find('.geodir_auto_install').hide(); |
533 | 533 | jQuery('#sub_' + active_tab).find('.geodir_show_progress').show(); |
534 | 534 | jQuery.post('<?php echo geodir_get_ajax_url(); ?>&geodir_autofill=' + id + '&posttype=' + posttype + '&_wpnonce=' + nonce, |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | jQuery.post('<?php echo geodir_get_ajax_url(); ?>&geodir_autofill=' + id + '&posttype=' + posttype + '&insert_dummy_post_index=' + dummy_post_index + '&city_bound_lat1=' + bound_lat_lng[0] + '&city_bound_lng1=' + bound_lat_lng[1] + '&city_bound_lat2=' + bound_lat_lng[2] + '&city_bound_lng2=' + bound_lat_lng[3] + '&_wpnonce=' + nonce, |
548 | 548 | function (data) { |
549 | 549 | |
550 | - 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 + ''); |
|
550 | + 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 + ''); |
|
551 | 551 | dummy_post_index++; |
552 | 552 | if (dummy_post_index <= total_dummy_post_count) |
553 | 553 | geodir_autoinstall(obj, id, nonce, posttype); |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | global $wpdb, $plugin_prefix; |
605 | 605 | |
606 | 606 | |
607 | - $post_ids = $wpdb->get_results("SELECT post_id FROM " . $plugin_prefix . "gd_place_detail WHERE post_dummy='1'"); |
|
607 | + $post_ids = $wpdb->get_results("SELECT post_id FROM ".$plugin_prefix."gd_place_detail WHERE post_dummy='1'"); |
|
608 | 608 | |
609 | 609 | |
610 | 610 | foreach ($post_ids as $post_ids_obj) { |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | } |
613 | 613 | |
614 | 614 | //double check posts are deleted |
615 | - $wpdb->get_results("DELETE FROM " . $plugin_prefix . "gd_place_detail WHERE post_dummy='1'"); |
|
615 | + $wpdb->get_results("DELETE FROM ".$plugin_prefix."gd_place_detail WHERE post_dummy='1'"); |
|
616 | 616 | } |
617 | 617 | |
618 | 618 | /** |
@@ -650,14 +650,14 @@ discard block |
||
650 | 650 | |
651 | 651 | |
652 | 652 | if (geodir_dummy_folder_exists()) |
653 | - $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon"; |
|
653 | + $dummy_image_url = geodir_plugin_url()."/geodirectory-admin/dummy/cat_icon"; |
|
654 | 654 | else |
655 | 655 | $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon'; |
656 | 656 | |
657 | 657 | $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url); |
658 | 658 | |
659 | 659 | $catname = str_replace(' ', '_', $catname); |
660 | - $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png"); |
|
660 | + $uploaded = (array) fetch_remote_file("$dummy_image_url/".$catname.".png"); |
|
661 | 661 | |
662 | 662 | if (empty($uploaded['error'])) { |
663 | 663 | $new_path = $uploaded['file']; |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | $wp_filetype = wp_check_filetype(basename($new_path), null); |
668 | 668 | |
669 | 669 | $attachment = array( |
670 | - 'guid' => $uploads['baseurl'] . '/' . basename($new_path), |
|
670 | + 'guid' => $uploads['baseurl'].'/'.basename($new_path), |
|
671 | 671 | 'post_mime_type' => $wp_filetype['type'], |
672 | 672 | 'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)), |
673 | 673 | 'post_content' => '', |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | |
678 | 678 | // you must first include the image.php file |
679 | 679 | // for the function wp_generate_attachment_metadata() to work |
680 | - require_once(ABSPATH . 'wp-admin/includes/image.php'); |
|
680 | + require_once(ABSPATH.'wp-admin/includes/image.php'); |
|
681 | 681 | $attach_data = wp_generate_attachment_metadata($attach_id, $new_path); |
682 | 682 | wp_update_attachment_metadata($attach_id, $attach_data); |
683 | 683 | |
@@ -694,14 +694,14 @@ discard block |
||
694 | 694 | $last_catid = wp_insert_term($catname, 'gd_placecategory'); |
695 | 695 | |
696 | 696 | if (geodir_dummy_folder_exists()) |
697 | - $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon"; |
|
697 | + $dummy_image_url = geodir_plugin_url()."/geodirectory-admin/dummy/cat_icon"; |
|
698 | 698 | else |
699 | 699 | $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon'; |
700 | 700 | |
701 | 701 | $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url); |
702 | 702 | |
703 | 703 | $catname = str_replace(' ', '_', $catname); |
704 | - $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png"); |
|
704 | + $uploaded = (array) fetch_remote_file("$dummy_image_url/".$catname.".png"); |
|
705 | 705 | |
706 | 706 | if (empty($uploaded['error'])) { |
707 | 707 | $new_path = $uploaded['file']; |
@@ -711,7 +711,7 @@ discard block |
||
711 | 711 | $wp_filetype = wp_check_filetype(basename($new_path), null); |
712 | 712 | |
713 | 713 | $attachment = array( |
714 | - 'guid' => $uploads['baseurl'] . '/' . basename($new_path), |
|
714 | + 'guid' => $uploads['baseurl'].'/'.basename($new_path), |
|
715 | 715 | 'post_mime_type' => $wp_filetype['type'], |
716 | 716 | 'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)), |
717 | 717 | 'post_content' => '', |
@@ -723,7 +723,7 @@ discard block |
||
723 | 723 | |
724 | 724 | // you must first include the image.php file |
725 | 725 | // for the function wp_generate_attachment_metadata() to work |
726 | - require_once(ABSPATH . 'wp-admin/includes/image.php'); |
|
726 | + require_once(ABSPATH.'wp-admin/includes/image.php'); |
|
727 | 727 | $attach_data = wp_generate_attachment_metadata($attach_id, $new_path); |
728 | 728 | wp_update_attachment_metadata($attach_id, $attach_data); |
729 | 729 | |
@@ -765,18 +765,18 @@ discard block |
||
765 | 765 | |
766 | 766 | elseif (isset($value['type']) && $value['type'] == 'image_width') : |
767 | 767 | |
768 | - if (isset($value['id']) && isset($_POST[$value['id'] . '_width'])) { |
|
769 | - update_option($value['id'] . '_width', $_POST[$value['id'] . '_width']); |
|
770 | - update_option($value['id'] . '_height', $_POST[$value['id'] . '_height']); |
|
771 | - if (isset($_POST[$value['id'] . '_crop'])) : |
|
772 | - update_option($value['id'] . '_crop', 1); |
|
768 | + if (isset($value['id']) && isset($_POST[$value['id'].'_width'])) { |
|
769 | + update_option($value['id'].'_width', $_POST[$value['id'].'_width']); |
|
770 | + update_option($value['id'].'_height', $_POST[$value['id'].'_height']); |
|
771 | + if (isset($_POST[$value['id'].'_crop'])) : |
|
772 | + update_option($value['id'].'_crop', 1); |
|
773 | 773 | else : |
774 | - update_option($value['id'] . '_crop', 0); |
|
774 | + update_option($value['id'].'_crop', 0); |
|
775 | 775 | endif; |
776 | 776 | } else { |
777 | - update_option($value['id'] . '_width', $value['std']); |
|
778 | - update_option($value['id'] . '_height', $value['std']); |
|
779 | - update_option($value['id'] . '_crop', 1); |
|
777 | + update_option($value['id'].'_width', $value['std']); |
|
778 | + update_option($value['id'].'_height', $value['std']); |
|
779 | + update_option($value['id'].'_crop', 1); |
|
780 | 780 | } |
781 | 781 | |
782 | 782 | elseif (isset($value['type']) && $value['type'] == 'map') : |
@@ -818,12 +818,12 @@ discard block |
||
818 | 818 | elseif (isset($value['type']) && $value['type'] == 'file') : |
819 | 819 | |
820 | 820 | |
821 | - if (isset($_POST[$value['id'] . '_remove']) && $_POST[$value['id'] . '_remove']) {// if remove is set then remove the file |
|
821 | + if (isset($_POST[$value['id'].'_remove']) && $_POST[$value['id'].'_remove']) {// if remove is set then remove the file |
|
822 | 822 | |
823 | 823 | if (get_option($value['id'])) { |
824 | 824 | $image_name_arr = explode('/', get_option($value['id'])); |
825 | 825 | $noimg_name = end($image_name_arr); |
826 | - $img_path = $uploads['path'] . '/' . $noimg_name; |
|
826 | + $img_path = $uploads['path'].'/'.$noimg_name; |
|
827 | 827 | if (file_exists($img_path)) |
828 | 828 | unlink($img_path); |
829 | 829 | } |
@@ -851,7 +851,7 @@ discard block |
||
851 | 851 | if (get_option($value['id'])) { |
852 | 852 | $image_name_arr = explode('/', get_option($value['id'])); |
853 | 853 | $noimg_name = end($image_name_arr); |
854 | - $img_path = $uploads['path'] . '/' . $noimg_name; |
|
854 | + $img_path = $uploads['path'].'/'.$noimg_name; |
|
855 | 855 | if (file_exists($img_path)) |
856 | 856 | unlink($img_path); |
857 | 857 | } |
@@ -872,7 +872,7 @@ discard block |
||
872 | 872 | // same menu setting per theme. |
873 | 873 | if (isset($value['id']) && $value['id'] == 'geodir_theme_location_nav' && isset($_POST[$value['id']])) { |
874 | 874 | $theme = wp_get_theme(); |
875 | - update_option('geodir_theme_location_nav_' . $theme->name, $_POST[$value['id']]); |
|
875 | + update_option('geodir_theme_location_nav_'.$theme->name, $_POST[$value['id']]); |
|
876 | 876 | } |
877 | 877 | |
878 | 878 | if (isset($value['id']) && isset($_POST[$value['id']])) { |
@@ -942,8 +942,8 @@ discard block |
||
942 | 942 | |
943 | 943 | $listing_slug = $geodir_posttype_info['labels']['singular_name']; |
944 | 944 | |
945 | - $tabs[$geodir_post_type . '_fields_settings'] = array( |
|
946 | - 'label' => __(ucfirst($listing_slug) . ' Settings', 'geodirectory'), |
|
945 | + $tabs[$geodir_post_type.'_fields_settings'] = array( |
|
946 | + 'label' => __(ucfirst($listing_slug).' Settings', 'geodirectory'), |
|
947 | 947 | 'subtabs' => array( |
948 | 948 | array('subtab' => 'custom_fields', |
949 | 949 | 'label' => __('Custom Fields', 'geodirectory'), |
@@ -1009,7 +1009,7 @@ discard block |
||
1009 | 1009 | */ |
1010 | 1010 | function geodir_extend_geodirectory_setting_tab($tabs) |
1011 | 1011 | { |
1012 | - $tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory'). ' <i class="fa fa-plug"></i>', 'url' => 'http://wpgeodirectory.com', 'target' => '_blank'); |
|
1012 | + $tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory').' <i class="fa fa-plug"></i>', 'url' => 'http://wpgeodirectory.com', 'target' => '_blank'); |
|
1013 | 1013 | return $tabs; |
1014 | 1014 | } |
1015 | 1015 | |
@@ -1069,8 +1069,8 @@ discard block |
||
1069 | 1069 | _e('Unknown', 'geodirectory'); |
1070 | 1070 | } else { |
1071 | 1071 | /* If there is a city id, append 'city name' to the text string. */ |
1072 | - $add_location_id = $location_id > 0 ? ' (' . $location_id . ')' : ''; |
|
1073 | - echo(__($location->country, 'geodirectory') . '-' . $location->region . '-' . $location->city . $add_location_id); |
|
1072 | + $add_location_id = $location_id > 0 ? ' ('.$location_id.')' : ''; |
|
1073 | + echo(__($location->country, 'geodirectory').'-'.$location->region.'-'.$location->city.$add_location_id); |
|
1074 | 1074 | } |
1075 | 1075 | break; |
1076 | 1076 | |
@@ -1088,14 +1088,14 @@ discard block |
||
1088 | 1088 | $expire_class = 'expire_over'; |
1089 | 1089 | } |
1090 | 1090 | $date_diff = round(abs(strtotime($d1) - strtotime($d2)) / 86400); // get the differance in days |
1091 | - $date_diff_text = '<br /><span class="' . $expire_class . '">(' . $date_diff . ' ' . $state . ')</span>'; |
|
1091 | + $date_diff_text = '<br /><span class="'.$expire_class.'">('.$date_diff.' '.$state.')</span>'; |
|
1092 | 1092 | } |
1093 | 1093 | /* If no expire_date is found, output a default message. */ |
1094 | 1094 | if (empty($expire_date)) |
1095 | 1095 | echo __('Unknown', 'geodirectory'); |
1096 | 1096 | /* If there is a expire_date, append 'days left' to the text string. */ |
1097 | 1097 | else |
1098 | - echo $expire_date . $date_diff_text; |
|
1098 | + echo $expire_date.$date_diff_text; |
|
1099 | 1099 | break; |
1100 | 1100 | |
1101 | 1101 | /* If displaying the 'categorys' column. */ |
@@ -1162,7 +1162,7 @@ discard block |
||
1162 | 1162 | function geodir_post_information_save($post_id, $post) { |
1163 | 1163 | global $wpdb, $current_user; |
1164 | 1164 | |
1165 | - if (isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')) { |
|
1165 | + if (isset($post->post_type) && ($post->post_type == 'nav_menu_item' || $post->post_type == 'page' || $post->post_type == 'post')) { |
|
1166 | 1166 | return; |
1167 | 1167 | } |
1168 | 1168 | |
@@ -1230,7 +1230,7 @@ discard block |
||
1230 | 1230 | $tab_id = $value['id']; |
1231 | 1231 | |
1232 | 1232 | if (isset($value['desc']) && $value['desc']) |
1233 | - $desc = '<span style=" text-transform:none;">:- ' . $value['desc'] . '</span>'; |
|
1233 | + $desc = '<span style=" text-transform:none;">:- '.$value['desc'].'</span>'; |
|
1234 | 1234 | |
1235 | 1235 | if (isset($value['name']) && $value['name']) { |
1236 | 1236 | if ($first_title === true) { |
@@ -1238,9 +1238,9 @@ discard block |
||
1238 | 1238 | } else { |
1239 | 1239 | echo '</div>'; |
1240 | 1240 | } |
1241 | - echo '<dd id="' . trim($tab_id) . '" class="geodir_option_tabs" ><a href="javascript:void(0);">' . $value['name'] . '</a></dd>'; |
|
1241 | + echo '<dd id="'.trim($tab_id).'" class="geodir_option_tabs" ><a href="javascript:void(0);">'.$value['name'].'</a></dd>'; |
|
1242 | 1242 | |
1243 | - echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >'; |
|
1243 | + echo '<div id="sub_'.trim($tab_id).'" class="gd-content-heading" style=" margin-bottom:10px;" >'; |
|
1244 | 1244 | } |
1245 | 1245 | |
1246 | 1246 | /** |
@@ -1250,21 +1250,21 @@ discard block |
||
1250 | 1250 | * |
1251 | 1251 | * @since 1.0.0 |
1252 | 1252 | */ |
1253 | - do_action('geodir_settings_' . sanitize_title($value['id'])); |
|
1253 | + do_action('geodir_settings_'.sanitize_title($value['id'])); |
|
1254 | 1254 | break; |
1255 | 1255 | |
1256 | 1256 | case 'no_tabs': |
1257 | 1257 | |
1258 | 1258 | echo '<div class="inner_content_tab_main">'; |
1259 | - echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >'; |
|
1259 | + echo '<div id="sub_'.trim($tab_id).'" class="gd-content-heading" style=" margin-bottom:10px;" >'; |
|
1260 | 1260 | |
1261 | 1261 | break; |
1262 | 1262 | |
1263 | 1263 | case 'sectionstart': |
1264 | 1264 | if (isset($value['desc']) && $value['desc']) |
1265 | - $desc = '<span style=" text-transform:none;"> - ' . $value['desc'] . '</span>'; |
|
1265 | + $desc = '<span style=" text-transform:none;"> - '.$value['desc'].'</span>'; |
|
1266 | 1266 | if (isset($value['name']) && $value['name']) |
1267 | - echo '<h3>' . $value['name'] . $desc . '</h3>'; |
|
1267 | + echo '<h3>'.$value['name'].$desc.'</h3>'; |
|
1268 | 1268 | /** |
1269 | 1269 | * Called after a GeoDirectory settings sectionstart is output in the GD settings page. |
1270 | 1270 | * |
@@ -1272,8 +1272,8 @@ discard block |
||
1272 | 1272 | * |
1273 | 1273 | * @since 1.0.0 |
1274 | 1274 | */ |
1275 | - if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_start'); |
|
1276 | - echo '<table class="form-table">' . "\n\n"; |
|
1275 | + if (isset($value['id']) && $value['id']) do_action('geodir_settings_'.sanitize_title($value['id']).'_start'); |
|
1276 | + echo '<table class="form-table">'."\n\n"; |
|
1277 | 1277 | |
1278 | 1278 | break; |
1279 | 1279 | case 'sectionend': |
@@ -1284,7 +1284,7 @@ discard block |
||
1284 | 1284 | * |
1285 | 1285 | * @since 1.0.0 |
1286 | 1286 | */ |
1287 | - if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_end'); |
|
1287 | + if (isset($value['id']) && $value['id']) do_action('geodir_settings_'.sanitize_title($value['id']).'_end'); |
|
1288 | 1288 | echo '</table>'; |
1289 | 1289 | /** |
1290 | 1290 | * Called after a GeoDirectory settings sectionend is output in the GD settings page. |
@@ -1293,7 +1293,7 @@ discard block |
||
1293 | 1293 | * |
1294 | 1294 | * @since 1.0.0 |
1295 | 1295 | */ |
1296 | - if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_after'); |
|
1296 | + if (isset($value['id']) && $value['id']) do_action('geodir_settings_'.sanitize_title($value['id']).'_after'); |
|
1297 | 1297 | break; |
1298 | 1298 | case 'text': |
1299 | 1299 | ?> |
@@ -1302,7 +1302,7 @@ discard block |
||
1302 | 1302 | <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>" |
1303 | 1303 | id="<?php echo esc_attr($value['id']); ?>" |
1304 | 1304 | type="<?php echo esc_attr($value['type']); ?>" |
1305 | - <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?> |
|
1305 | + <?php if (isset($value['placeholder'])) {?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?> |
|
1306 | 1306 | style=" <?php echo esc_attr($value['css']); ?>" |
1307 | 1307 | value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) { |
1308 | 1308 | echo esc_attr(stripslashes(get_option($value['id']))); |
@@ -1319,7 +1319,7 @@ discard block |
||
1319 | 1319 | <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>" |
1320 | 1320 | id="<?php echo esc_attr($value['id']); ?>" |
1321 | 1321 | type="<?php echo esc_attr($value['type']); ?>" |
1322 | - <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?> |
|
1322 | + <?php if (isset($value['placeholder'])) {?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?> |
|
1323 | 1323 | style="<?php echo esc_attr($value['css']); ?>" |
1324 | 1324 | value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) { |
1325 | 1325 | echo esc_attr(stripslashes(get_option($value['id']))); |
@@ -1365,17 +1365,17 @@ discard block |
||
1365 | 1365 | <?php _e('Width', 'geodirectory'); ?> <input |
1366 | 1366 | name="<?php echo esc_attr($value['id']); ?>_width" |
1367 | 1367 | id="<?php echo esc_attr($value['id']); ?>_width" type="text" size="3" |
1368 | - value="<?php if ($size = get_option($value['id'] . '_width')) echo stripslashes($size); else echo $value['std']; ?>"/> |
|
1368 | + value="<?php if ($size = get_option($value['id'].'_width')) echo stripslashes($size); else echo $value['std']; ?>"/> |
|
1369 | 1369 | |
1370 | 1370 | <?php _e('Height', 'geodirectory'); ?> <input |
1371 | 1371 | name="<?php echo esc_attr($value['id']); ?>_height" |
1372 | 1372 | id="<?php echo esc_attr($value['id']); ?>_height" type="text" size="3" |
1373 | - value="<?php if ($size = get_option($value['id'] . '_height')) echo stripslashes($size); else echo $value['std']; ?>"/> |
|
1373 | + value="<?php if ($size = get_option($value['id'].'_height')) echo stripslashes($size); else echo $value['std']; ?>"/> |
|
1374 | 1374 | |
1375 | 1375 | <label><?php _e('Hard Crop', 'geodirectory'); ?> <input |
1376 | 1376 | name="<?php echo esc_attr($value['id']); ?>_crop" |
1377 | 1377 | id="<?php echo esc_attr($value['id']); ?>_crop" |
1378 | - type="checkbox" <?php if (get_option($value['id'] . '_crop') != '') checked(get_option($value['id'] . '_crop'), 1); else checked(1); ?> /></label> |
|
1378 | + type="checkbox" <?php if (get_option($value['id'].'_crop') != '') checked(get_option($value['id'].'_crop'), 1); else checked(1); ?> /></label> |
|
1379 | 1379 | |
1380 | 1380 | <span class="description"><?php echo $value['desc'] ?></span></td> |
1381 | 1381 | </tr><?php |
@@ -1425,7 +1425,7 @@ discard block |
||
1425 | 1425 | id="<?php echo esc_attr($value['id']); ?>" |
1426 | 1426 | style="<?php echo esc_attr($value['css']); ?>" |
1427 | 1427 | class="<?php if (isset($value['class'])) echo $value['class']; ?>" |
1428 | - data-placeholder="<?php if (isset($value['placeholder_text'])) echo $value['placeholder_text'];?>" |
|
1428 | + data-placeholder="<?php if (isset($value['placeholder_text'])) echo $value['placeholder_text']; ?>" |
|
1429 | 1429 | option-ajaxchosen="false"> |
1430 | 1430 | <?php |
1431 | 1431 | foreach ($value['options'] as $key => $val) { |
@@ -1436,7 +1436,7 @@ discard block |
||
1436 | 1436 | } else { |
1437 | 1437 | ?> |
1438 | 1438 | <option |
1439 | - value="<?php echo esc_attr($key); ?>" <?php selected(true, (is_array($option_values) && in_array($key, $option_values)));?>><?php echo ucfirst($val) ?></option> |
|
1439 | + value="<?php echo esc_attr($key); ?>" <?php selected(true, (is_array($option_values) && in_array($key, $option_values))); ?>><?php echo ucfirst($val) ?></option> |
|
1440 | 1440 | <?php |
1441 | 1441 | } |
1442 | 1442 | } |
@@ -1471,7 +1471,7 @@ discard block |
||
1471 | 1471 | ?> |
1472 | 1472 | |
1473 | 1473 | <tr valign="top"> |
1474 | - <th class="titledesc" width="40%"><?php _e('Default map language', 'geodirectory');?></th> |
|
1474 | + <th class="titledesc" width="40%"><?php _e('Default map language', 'geodirectory'); ?></th> |
|
1475 | 1475 | <td width="60%"> |
1476 | 1476 | <select name="geodir_default_map_language" style="width:60%"> |
1477 | 1477 | <?php |
@@ -1553,7 +1553,7 @@ discard block |
||
1553 | 1553 | |
1554 | 1554 | <tr valign="top"> |
1555 | 1555 | <th class="titledesc" |
1556 | - width="40%"><?php _e('Default post type search on map', 'geodirectory');?></th> |
|
1556 | + width="40%"><?php _e('Default post type search on map', 'geodirectory'); ?></th> |
|
1557 | 1557 | <td width="60%"> |
1558 | 1558 | <select name="geodir_default_map_search_pt" style="width:60%"> |
1559 | 1559 | <?php |
@@ -1594,7 +1594,7 @@ discard block |
||
1594 | 1594 | $cat_display = 'checkbox'; |
1595 | 1595 | $gd_post_types = get_option('geodir_exclude_post_type_on_map'); |
1596 | 1596 | $gd_cats = get_option('geodir_exclude_cat_on_map'); |
1597 | - $gd_cats_upgrade = (int)get_option('geodir_exclude_cat_on_map_upgrade'); |
|
1597 | + $gd_cats_upgrade = (int) get_option('geodir_exclude_cat_on_map_upgrade'); |
|
1598 | 1598 | $count = 1; |
1599 | 1599 | ?> |
1600 | 1600 | <table width="70%" class="widefat"> |
@@ -1623,7 +1623,7 @@ discard block |
||
1623 | 1623 | name="home_map_post_types[]" |
1624 | 1624 | id="<?php echo esc_attr($value['id']); ?>" |
1625 | 1625 | value="<?php echo $key; ?>" |
1626 | - class="map_post_type" <?php echo $checked;?> /> |
|
1626 | + class="map_post_type" <?php echo $checked; ?> /> |
|
1627 | 1627 | <?php echo $post_types_obj->labels->singular_name; ?></td> |
1628 | 1628 | <td width="40%"> |
1629 | 1629 | <div class="home_map_category" style="overflow:auto;width:200px;height:100px;" |
@@ -1681,12 +1681,12 @@ discard block |
||
1681 | 1681 | ?> |
1682 | 1682 | <fieldset> |
1683 | 1683 | <legend class="screen-reader-text"><span><?php echo $value['name'] ?></span></legend> |
1684 | - <label for="<?php echo $value['id'];?>"> |
|
1684 | + <label for="<?php echo $value['id']; ?>"> |
|
1685 | 1685 | <input name="<?php echo esc_attr($value['id']); ?>" |
1686 | - id="<?php echo esc_attr($value['id'] . $value['value']); ?>" type="radio" |
|
1686 | + id="<?php echo esc_attr($value['id'].$value['value']); ?>" type="radio" |
|
1687 | 1687 | value="<?php echo $value['value'] ?>" <?php if (get_option($value['id']) == $value['value']) { |
1688 | 1688 | echo 'checked="checked"'; |
1689 | - }elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> /> |
|
1689 | + }elseif (get_option($value['id']) == '' && $value['std'] == $value['value']) {echo 'checked="checked"'; } ?> /> |
|
1690 | 1690 | <?php echo $value['desc']; ?></label><br> |
1691 | 1691 | </fieldset> |
1692 | 1692 | <?php |
@@ -1706,9 +1706,9 @@ discard block |
||
1706 | 1706 | <th scope="row" class="titledesc"><?php echo $value['name'] ?></th> |
1707 | 1707 | <td class="forminp"> |
1708 | 1708 | <textarea |
1709 | - <?php if (isset($value['args'])) echo $value['args'] . ' '; ?>name="<?php echo esc_attr($value['id']); ?>" |
|
1709 | + <?php if (isset($value['args'])) echo $value['args'].' '; ?>name="<?php echo esc_attr($value['id']); ?>" |
|
1710 | 1710 | id="<?php echo esc_attr($value['id']); ?>" |
1711 | - <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?> |
|
1711 | + <?php if (isset($value['placeholder'])) {?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?> |
|
1712 | 1712 | 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 |
1713 | 1713 | class="description"><?php echo $value['desc'] ?></span> |
1714 | 1714 | |
@@ -1753,7 +1753,7 @@ discard block |
||
1753 | 1753 | } |
1754 | 1754 | } |
1755 | 1755 | // |
1756 | - $page_setting = (int)get_option($value['id']); |
|
1756 | + $page_setting = (int) get_option($value['id']); |
|
1757 | 1757 | |
1758 | 1758 | $args = array('name' => $value['id'], |
1759 | 1759 | 'id' => $value['id'], |
@@ -1770,7 +1770,7 @@ discard block |
||
1770 | 1770 | <tr valign="top" class="single_select_page"> |
1771 | 1771 | <th scope="row" class="titledesc"><?php echo $value['name'] ?></th> |
1772 | 1772 | <td class="forminp"> |
1773 | - <?php echo str_replace(' id=', " data-placeholder='" . __('Select a page...', 'geodirectory') . "' style='" . $value['css'] . "' class='" . $value['class'] . "' " . $disabled . " id=", wp_dropdown_pages($args)); ?> |
|
1773 | + <?php echo str_replace(' id=', " data-placeholder='".__('Select a page...', 'geodirectory')."' style='".$value['css']."' class='".$value['class']."' ".$disabled." id=", wp_dropdown_pages($args)); ?> |
|
1774 | 1774 | <span class="description"><?php echo $value['desc'] ?></span> |
1775 | 1775 | </td> |
1776 | 1776 | </tr><?php |
@@ -1779,7 +1779,7 @@ discard block |
||
1779 | 1779 | } |
1780 | 1780 | break; |
1781 | 1781 | case 'single_select_country' : |
1782 | - $country_setting = (string)get_option($value['id']); |
|
1782 | + $country_setting = (string) get_option($value['id']); |
|
1783 | 1783 | if (strstr($country_setting, ':')) : |
1784 | 1784 | $country = current(explode(':', $country_setting)); |
1785 | 1785 | $state = end(explode(':', $country_setting)); |
@@ -1802,7 +1802,7 @@ discard block |
||
1802 | 1802 | case 'multi_select_countries' : |
1803 | 1803 | $countries = $geodirectory->countries->countries; |
1804 | 1804 | asort($countries); |
1805 | - $selections = (array)get_option($value['id']); |
|
1805 | + $selections = (array) get_option($value['id']); |
|
1806 | 1806 | ?> |
1807 | 1807 | <tr valign="top"> |
1808 | 1808 | <th scope="row" class="titledesc"><?php echo $value['name'] ?></th> |
@@ -1812,7 +1812,7 @@ discard block |
||
1812 | 1812 | title="Country" class="chosen_select"> |
1813 | 1813 | <?php |
1814 | 1814 | if ($countries) foreach ($countries as $key => $val) : |
1815 | - echo '<option value="' . $key . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>'; |
|
1815 | + echo '<option value="'.$key.'" '.selected(in_array($key, $selections), true, false).'>'.$val.'</option>'; |
|
1816 | 1816 | endforeach; |
1817 | 1817 | ?> |
1818 | 1818 | </select> |
@@ -1824,8 +1824,8 @@ discard block |
||
1824 | 1824 | break; |
1825 | 1825 | |
1826 | 1826 | case 'google_analytics' : |
1827 | - $selections = (array)get_option($value['id']); |
|
1828 | - if(get_option('geodir_ga_client_id') && get_option('geodir_ga_client_secret') ) { |
|
1827 | + $selections = (array) get_option($value['id']); |
|
1828 | + if (get_option('geodir_ga_client_id') && get_option('geodir_ga_client_secret')) { |
|
1829 | 1829 | ?> |
1830 | 1830 | <tr valign="top"> |
1831 | 1831 | <th scope="row" class="titledesc"><?php echo $value['name'] ?></th> |
@@ -1836,20 +1836,20 @@ discard block |
||
1836 | 1836 | |
1837 | 1837 | $oAuthURL = "https://accounts.google.com/o/oauth2/auth?"; |
1838 | 1838 | $scope = "scope=https://www.googleapis.com/auth/analytics.readonly"; |
1839 | - $state = "&state=123";//any string |
|
1840 | - $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback"; |
|
1839 | + $state = "&state=123"; //any string |
|
1840 | + $redirect_uri = "&redirect_uri=".admin_url('admin-ajax.php')."?action=geodir_ga_callback"; |
|
1841 | 1841 | $response_type = "&response_type=code"; |
1842 | 1842 | $client_id = "&client_id=".get_option('geodir_ga_client_id'); |
1843 | 1843 | $access_type = "&access_type=offline"; |
1844 | 1844 | $approval_prompt = "&approval_prompt=force"; |
1845 | 1845 | |
1846 | - $auth_url = $oAuthURL . $scope . $state . $redirect_uri . $response_type . $client_id . $access_type . $approval_prompt; |
|
1846 | + $auth_url = $oAuthURL.$scope.$state.$redirect_uri.$response_type.$client_id.$access_type.$approval_prompt; |
|
1847 | 1847 | |
1848 | 1848 | |
1849 | 1849 | ?> |
1850 | 1850 | <script> |
1851 | 1851 | function gd_ga_popup() { |
1852 | - var win = window.open("<?php echo $auth_url;?>", "Google Analytics", ""); |
|
1852 | + var win = window.open("<?php echo $auth_url; ?>", "Google Analytics", ""); |
|
1853 | 1853 | var pollTimer = window.setInterval(function () { |
1854 | 1854 | if (win.closed !== false) { // !== is required for compatibility with Opera |
1855 | 1855 | window.clearInterval(pollTimer); |
@@ -1871,7 +1871,7 @@ discard block |
||
1871 | 1871 | } else { |
1872 | 1872 | ?> |
1873 | 1873 | <span class="button-primary" |
1874 | - onclick="gd_ga_popup();"><?php _e('Authorize', 'geodirectory');?></span> |
|
1874 | + onclick="gd_ga_popup();"><?php _e('Authorize', 'geodirectory'); ?></span> |
|
1875 | 1875 | <?php |
1876 | 1876 | } |
1877 | 1877 | ?> |
@@ -1942,9 +1942,9 @@ discard block |
||
1942 | 1942 | |
1943 | 1943 | <?php if (isset($_REQUEST['active_tab']) && $_REQUEST['active_tab'] != '') { ?> |
1944 | 1944 | jQuery('.geodir_option_tabs').removeClass('gd-tab-active'); |
1945 | - jQuery('#<?php echo sanitize_text_field($_REQUEST['active_tab']);?>').addClass('gd-tab-active'); |
|
1945 | + jQuery('#<?php echo sanitize_text_field($_REQUEST['active_tab']); ?>').addClass('gd-tab-active'); |
|
1946 | 1946 | jQuery('.gd-content-heading').hide(); |
1947 | - jQuery('#sub_<?php echo sanitize_text_field($_REQUEST['active_tab']);?>').show(); |
|
1947 | + jQuery('#sub_<?php echo sanitize_text_field($_REQUEST['active_tab']); ?>').show(); |
|
1948 | 1948 | <?php } ?> |
1949 | 1949 | }); |
1950 | 1950 | </script> |
@@ -2030,7 +2030,7 @@ discard block |
||
2030 | 2030 | wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_attachments_noncename'); |
2031 | 2031 | |
2032 | 2032 | if (geodir_get_featured_image($post_id, 'thumbnail')) { |
2033 | - echo '<h4>' . __('Featured Image', 'geodirectory') . '</h4>'; |
|
2033 | + echo '<h4>'.__('Featured Image', 'geodirectory').'</h4>'; |
|
2034 | 2034 | geodir_show_featured_image($post_id, 'thumbnail'); |
2035 | 2035 | } |
2036 | 2036 | |
@@ -2041,13 +2041,13 @@ discard block |
||
2041 | 2041 | |
2042 | 2042 | <h5 class="form_title"> |
2043 | 2043 | <?php if ($image_limit != 0 && $image_limit == 1) { |
2044 | - echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>'; |
|
2044 | + echo '<br /><small>('.__('You can upload', 'geodirectory').' '.$image_limit.' '.__('image with this package', 'geodirectory').')</small>'; |
|
2045 | 2045 | } ?> |
2046 | 2046 | <?php if ($image_limit != 0 && $image_limit > 1) { |
2047 | - echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>'; |
|
2047 | + echo '<br /><small>('.__('You can upload', 'geodirectory').' '.$image_limit.' '.__('images with this package', 'geodirectory').')</small>'; |
|
2048 | 2048 | } ?> |
2049 | 2049 | <?php if ($image_limit == 0) { |
2050 | - echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>'; |
|
2050 | + echo '<br /><small>('.__('You can upload unlimited images with this package', 'geodirectory').')</small>'; |
|
2051 | 2051 | } ?> |
2052 | 2052 | </h5> |
2053 | 2053 | |
@@ -2086,10 +2086,10 @@ discard block |
||
2086 | 2086 | <div |
2087 | 2087 | class="plupload-upload-uic hide-if-no-js <?php if ($multiple): ?>plupload-upload-uic-multiple<?php endif; ?>" |
2088 | 2088 | id="<?php echo $id; ?>plupload-upload-ui"> |
2089 | - <h4><?php _e('Drop files to upload', 'geodirectory');?></h4> |
|
2089 | + <h4><?php _e('Drop files to upload', 'geodirectory'); ?></h4> |
|
2090 | 2090 | <input id="<?php echo $id; ?>plupload-browse-button" type="button" |
2091 | 2091 | value="<?php _e('Select Files', 'geodirectory'); ?>" class="button"/> |
2092 | - <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce($id . 'pluploadan'); ?>"></span> |
|
2092 | + <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce($id.'pluploadan'); ?>"></span> |
|
2093 | 2093 | <?php if ($width && $height): ?> |
2094 | 2094 | <span class="plupload-resize"></span> |
2095 | 2095 | <span class="plupload-width" id="plupload-width<?php echo $width; ?>"></span> |
@@ -2101,7 +2101,7 @@ discard block |
||
2101 | 2101 | id="<?php echo $id; ?>plupload-thumbs" style="border-top:1px solid #ccc; padding-top:10px;"> |
2102 | 2102 | </div> |
2103 | 2103 | <span |
2104 | - id="upload-msg"><?php _e('Please drag & drop the images to rearrange the order', 'geodirectory');?></span> |
|
2104 | + id="upload-msg"><?php _e('Please drag & drop the images to rearrange the order', 'geodirectory'); ?></span> |
|
2105 | 2105 | <span id="<?php echo $id; ?>upload-error" style="display:none"></span> |
2106 | 2106 | </div> |
2107 | 2107 | |
@@ -2311,9 +2311,9 @@ discard block |
||
2311 | 2311 | $plugin = 'avada-nag'; |
2312 | 2312 | $timestamp = 'avada-nag1234'; |
2313 | 2313 | $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'); |
2314 | - echo '<div id="' . $timestamp . '" class="error">'; |
|
2315 | - echo '<span class="gd-remove-noti" onclick="gdRemoveANotification(\'' . $plugin . '\',\'' . $timestamp . '\');" ><i class="fa fa-times"></i></span>'; |
|
2316 | - echo "<img class='gd-icon-noti' src='" . plugin_dir_url('') . "geodirectory/geodirectory-assets/images/favicon.ico' > "; |
|
2314 | + echo '<div id="'.$timestamp.'" class="error">'; |
|
2315 | + echo '<span class="gd-remove-noti" onclick="gdRemoveANotification(\''.$plugin.'\',\''.$timestamp.'\');" ><i class="fa fa-times"></i></span>'; |
|
2316 | + echo "<img class='gd-icon-noti' src='".plugin_dir_url('')."geodirectory/geodirectory-assets/images/favicon.ico' > "; |
|
2317 | 2317 | echo "<p>$message</p>"; |
2318 | 2318 | echo "</div>"; |
2319 | 2319 | |
@@ -2446,7 +2446,7 @@ discard block |
||
2446 | 2446 | |
2447 | 2447 | // Don't allow same slug url for listing and location |
2448 | 2448 | if (geodir_strtolower($listing_prefix) == geodir_strtolower($location_prefix)) { |
2449 | - $redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $active_tab . '&msg=fail&gderr=21'); |
|
2449 | + $redirect_url = admin_url('admin.php?page=geodirectory&tab='.$current_tab.'&active_tab='.$active_tab.'&msg=fail&gderr=21'); |
|
2450 | 2450 | wp_redirect($redirect_url); |
2451 | 2451 | exit; |
2452 | 2452 | } |
@@ -2458,7 +2458,7 @@ discard block |
||
2458 | 2458 | $default_language = $sitepress->get_default_language(); |
2459 | 2459 | |
2460 | 2460 | if ($current_language != 'all' && $current_language != $default_language) { |
2461 | - $redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $active_tab); |
|
2461 | + $redirect_url = admin_url('admin.php?page=geodirectory&tab='.$current_tab.'&active_tab='.$active_tab); |
|
2462 | 2462 | wp_redirect($redirect_url); |
2463 | 2463 | exit; |
2464 | 2464 | } |
@@ -2479,11 +2479,11 @@ discard block |
||
2479 | 2479 | function geodir_hide_admin_preview_button() { |
2480 | 2480 | global $post_type; |
2481 | 2481 | $post_types = geodir_get_posttypes(); |
2482 | - if(in_array($post_type, $post_types)) |
|
2482 | + if (in_array($post_type, $post_types)) |
|
2483 | 2483 | echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>'; |
2484 | 2484 | } |
2485 | -add_action( 'admin_head-post-new.php', 'geodir_hide_admin_preview_button' ); |
|
2486 | -add_action( 'admin_head-post.php', 'geodir_hide_admin_preview_button' ); |
|
2485 | +add_action('admin_head-post-new.php', 'geodir_hide_admin_preview_button'); |
|
2486 | +add_action('admin_head-post.php', 'geodir_hide_admin_preview_button'); |
|
2487 | 2487 | |
2488 | 2488 | /** |
2489 | 2489 | * Add the tab in left sidebar menu fro import & export page. |
@@ -2493,8 +2493,8 @@ discard block |
||
2493 | 2493 | * |
2494 | 2494 | * @return array Array of tab data. |
2495 | 2495 | */ |
2496 | -function geodir_import_export_tab( $tabs ) { |
|
2497 | - $tabs['import_export'] = array( 'label' => __( 'Import & Export', 'geodirectory' ) ); |
|
2496 | +function geodir_import_export_tab($tabs) { |
|
2497 | + $tabs['import_export'] = array('label' => __('Import & Export', 'geodirectory')); |
|
2498 | 2498 | return $tabs; |
2499 | 2499 | } |
2500 | 2500 | |
@@ -2508,8 +2508,8 @@ discard block |
||
2508 | 2508 | * @return string Html content. |
2509 | 2509 | */ |
2510 | 2510 | function geodir_import_export_page() { |
2511 | - $nonce = wp_create_nonce( 'geodir_import_export_nonce' ); |
|
2512 | - $gd_cats_sample_csv = geodir_plugin_url() . '/geodirectory-assets/gd_sample_categories.csv'; |
|
2511 | + $nonce = wp_create_nonce('geodir_import_export_nonce'); |
|
2512 | + $gd_cats_sample_csv = geodir_plugin_url().'/geodirectory-assets/gd_sample_categories.csv'; |
|
2513 | 2513 | /** |
2514 | 2514 | * Filter sample category data csv file url. |
2515 | 2515 | * |
@@ -2518,9 +2518,9 @@ discard block |
||
2518 | 2518 | * |
2519 | 2519 | * @param string $gd_cats_sample_csv Sample category data csv file url. |
2520 | 2520 | */ |
2521 | - $gd_cats_sample_csv = apply_filters( 'geodir_export_cats_sample_csv', $gd_cats_sample_csv ); |
|
2521 | + $gd_cats_sample_csv = apply_filters('geodir_export_cats_sample_csv', $gd_cats_sample_csv); |
|
2522 | 2522 | |
2523 | - $gd_posts_sample_csv = geodir_plugin_url() . '/geodirectory-assets/place_listing.csv'; |
|
2523 | + $gd_posts_sample_csv = geodir_plugin_url().'/geodirectory-assets/place_listing.csv'; |
|
2524 | 2524 | /** |
2525 | 2525 | * Filter sample post data csv file url. |
2526 | 2526 | * |
@@ -2529,15 +2529,15 @@ discard block |
||
2529 | 2529 | * |
2530 | 2530 | * @param string $gd_posts_sample_csv Sample post data csv file url. |
2531 | 2531 | */ |
2532 | - $gd_posts_sample_csv = apply_filters( 'geodir_export_posts_sample_csv', $gd_posts_sample_csv ); |
|
2532 | + $gd_posts_sample_csv = apply_filters('geodir_export_posts_sample_csv', $gd_posts_sample_csv); |
|
2533 | 2533 | |
2534 | - $gd_posttypes = geodir_get_posttypes( 'array' ); |
|
2534 | + $gd_posttypes = geodir_get_posttypes('array'); |
|
2535 | 2535 | |
2536 | 2536 | $gd_posttypes_option = ''; |
2537 | - foreach ( $gd_posttypes as $gd_posttype => $row ) { |
|
2538 | - $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>'; |
|
2537 | + foreach ($gd_posttypes as $gd_posttype => $row) { |
|
2538 | + $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>'; |
|
2539 | 2539 | } |
2540 | - wp_enqueue_script( 'jquery-ui-progressbar' ); |
|
2540 | + wp_enqueue_script('jquery-ui-progressbar'); |
|
2541 | 2541 | |
2542 | 2542 | $gd_chunksize_options = array(); |
2543 | 2543 | $gd_chunksize_options[100] = 100; |
@@ -2559,49 +2559,49 @@ discard block |
||
2559 | 2559 | * |
2560 | 2560 | * @param string $gd_chunksize_options Entries options. |
2561 | 2561 | */ |
2562 | - $gd_chunksize_options = apply_filters( 'geodir_export_csv_chunksize_options', $gd_chunksize_options ); |
|
2562 | + $gd_chunksize_options = apply_filters('geodir_export_csv_chunksize_options', $gd_chunksize_options); |
|
2563 | 2563 | |
2564 | 2564 | $gd_chunksize_option = ''; |
2565 | 2565 | foreach ($gd_chunksize_options as $value => $title) { |
2566 | - $gd_chunksize_option .= '<option value="' . $value . '" ' . selected($value, 5000, false) . '>' . $title . '</option>'; |
|
2566 | + $gd_chunksize_option .= '<option value="'.$value.'" '.selected($value, 5000, false).'>'.$title.'</option>'; |
|
2567 | 2567 | } |
2568 | 2568 | |
2569 | 2569 | $uploads = wp_upload_dir(); |
2570 | 2570 | ?> |
2571 | 2571 | </form> |
2572 | 2572 | <div class="inner_content_tab_main gd-import-export"> |
2573 | - <h3><?php _e( 'GD Import & Export CSV', 'geodirectory' ) ;?></h3> |
|
2574 | - <span class="description"><?php _e( 'Import & export csv for GD listings & categories.', 'geodirectory' ) ;?></span> |
|
2573 | + <h3><?php _e('GD Import & Export CSV', 'geodirectory'); ?></h3> |
|
2574 | + <span class="description"><?php _e('Import & export csv for GD listings & categories.', 'geodirectory'); ?></span> |
|
2575 | 2575 | <div class="gd-content-heading"> |
2576 | 2576 | |
2577 | 2577 | <?php |
2578 | 2578 | ini_set('max_execution_time', 999999); |
2579 | - $ini_max_execution_time_check = @ini_get( 'max_execution_time' ); |
|
2579 | + $ini_max_execution_time_check = @ini_get('max_execution_time'); |
|
2580 | 2580 | ini_restore('max_execution_time'); |
2581 | 2581 | |
2582 | - if($ini_max_execution_time_check != 999999){ // only show these setting to the user if we can't change the ini setting |
|
2582 | + if ($ini_max_execution_time_check != 999999) { // only show these setting to the user if we can't change the ini setting |
|
2583 | 2583 | ?> |
2584 | 2584 | <div id="gd_ie_reqs" class="metabox-holder"> |
2585 | 2585 | <div class="meta-box-sortables ui-sortable"> |
2586 | 2586 | <div class="postbox"> |
2587 | - <h3 class="hndle"><span style='vertical-align:top;'><?php echo __( 'PHP Requirements for GD Import & Export CSV', 'geodirectory' );?></span></h3> |
|
2587 | + <h3 class="hndle"><span style='vertical-align:top;'><?php echo __('PHP Requirements for GD Import & Export CSV', 'geodirectory'); ?></span></h3> |
|
2588 | 2588 | <div class="inside"> |
2589 | - <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> |
|
2589 | + <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> |
|
2590 | 2590 | <table class="form-table"> |
2591 | 2591 | <thead> |
2592 | 2592 | <tr> |
2593 | - <th><?php _e( 'PHP Settings', 'geodirectory' );?></th><th><?php _e( 'Current Value', 'geodirectory' );?></th><th><?php _e( 'Recommended Value', 'geodirectory' );?></th> |
|
2593 | + <th><?php _e('PHP Settings', 'geodirectory'); ?></th><th><?php _e('Current Value', 'geodirectory'); ?></th><th><?php _e('Recommended Value', 'geodirectory'); ?></th> |
|
2594 | 2594 | </tr> |
2595 | 2595 | </thead> |
2596 | 2596 | <tbody> |
2597 | 2597 | <tr> |
2598 | - <td>max_input_time</td><td><?php echo @ini_get( 'max_input_time' );?></td><td>3000</td> |
|
2598 | + <td>max_input_time</td><td><?php echo @ini_get('max_input_time'); ?></td><td>3000</td> |
|
2599 | 2599 | </tr> |
2600 | 2600 | <tr> |
2601 | - <td>max_execution_time</td><td><?php echo @ini_get( 'max_execution_time' );?></td><td>3000</td> |
|
2601 | + <td>max_execution_time</td><td><?php echo @ini_get('max_execution_time'); ?></td><td>3000</td> |
|
2602 | 2602 | </tr> |
2603 | 2603 | <tr> |
2604 | - <td>memory_limit</td><td><?php echo @ini_get( 'memory_limit' );?></td><td>256M</td> |
|
2604 | + <td>memory_limit</td><td><?php echo @ini_get('memory_limit'); ?></td><td>256M</td> |
|
2605 | 2605 | </tr> |
2606 | 2606 | </tbody> |
2607 | 2607 | </table> |
@@ -2613,21 +2613,21 @@ discard block |
||
2613 | 2613 | <div id="gd_ie_imposts" class="metabox-holder"> |
2614 | 2614 | <div class="meta-box-sortables ui-sortable"> |
2615 | 2615 | <div id="gd_ie_im_posts" class="postbox gd-hndle-pbox"> |
2616 | - <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> |
|
2617 | - <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Listings: Import CSV', 'geodirectory' );?></span></h3> |
|
2616 | + <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> |
|
2617 | + <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Listings: Import CSV', 'geodirectory'); ?></span></h3> |
|
2618 | 2618 | <div class="inside"> |
2619 | 2619 | <table class="form-table"> |
2620 | 2620 | <tbody> |
2621 | 2621 | <tr> |
2622 | 2622 | <td class="gd-imex-box"> |
2623 | 2623 | <div class="gd-im-choices"> |
2624 | - <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> |
|
2625 | - <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> |
|
2624 | + <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> |
|
2625 | + <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> |
|
2626 | 2626 | </div> |
2627 | 2627 | <div class="plupload-upload-uic hide-if-no-js" id="gd_im_postplupload-upload-ui"> |
2628 | 2628 | <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');" /> |
2629 | - <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"> |
|
2630 | - <input type="hidden" id="gd_ie_imposts_csv" value="<?php echo $gd_posts_sample_csv;?>" /> |
|
2629 | + <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"> |
|
2630 | + <input type="hidden" id="gd_ie_imposts_csv" value="<?php echo $gd_posts_sample_csv; ?>" /> |
|
2631 | 2631 | <?php |
2632 | 2632 | /** |
2633 | 2633 | * Called just after the sample CSV download link. |
@@ -2636,7 +2636,7 @@ discard block |
||
2636 | 2636 | */ |
2637 | 2637 | do_action('geodir_sample_csv_download_link'); |
2638 | 2638 | ?> |
2639 | - <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce( 'gd_im_postpluploadan' ); ?>"></span> |
|
2639 | + <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce('gd_im_postpluploadan'); ?>"></span> |
|
2640 | 2640 | <div class="filelist"></div> |
2641 | 2641 | </div> |
2642 | 2642 | <span id="gd_im_catupload-error" style="display:none"></span> |
@@ -2654,7 +2654,7 @@ discard block |
||
2654 | 2654 | <input type="hidden" id="gd_terminateaction" value="continue"/> |
2655 | 2655 | </div> |
2656 | 2656 | <div class="gd-import-progress" id="gd-import-progress" style="display:none"> |
2657 | - <div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory');?> </b><font |
|
2657 | + <div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory'); ?> </b><font |
|
2658 | 2658 | id="gd-import-done">0</font> / <font id="gd-import-total">0</font> ( <font |
2659 | 2659 | id="gd-import-perc">0%</font> ) |
2660 | 2660 | <div class="gd-fileprogress"></div> |
@@ -2666,10 +2666,10 @@ discard block |
||
2666 | 2666 | <div class="gd-imex-btns" style="display:none;"> |
2667 | 2667 | <input type="hidden" class="geodir_import_file" name="geodir_import_file" value="save"/> |
2668 | 2668 | <input onclick="gd_imex_PrepareImport(this, 'post')" type="button" value="<?php echo CSV_IMPORT_DATA; ?>" id="gd_import_data" class="button-primary" /> |
2669 | - <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"/> |
|
2670 | - <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')"/> |
|
2669 | + <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"/> |
|
2670 | + <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')"/> |
|
2671 | 2671 | <div id="gd_process_data" style="display:none"> |
2672 | - <span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory');?> |
|
2672 | + <span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory'); ?> |
|
2673 | 2673 | </div> |
2674 | 2674 | </div> |
2675 | 2675 | </td> |
@@ -2683,26 +2683,26 @@ discard block |
||
2683 | 2683 | <div id="gd_ie_excategs" class="metabox-holder"> |
2684 | 2684 | <div class="meta-box-sortables ui-sortable"> |
2685 | 2685 | <div id="gd_ie_ex_posts" class="postbox gd-hndle-pbox"> |
2686 | - <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> |
|
2687 | - <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Listings: Export CSV', 'geodirectory' );?></span></h3> |
|
2686 | + <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> |
|
2687 | + <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Listings: Export CSV', 'geodirectory'); ?></span></h3> |
|
2688 | 2688 | <div class="inside"> |
2689 | 2689 | <table class="form-table"> |
2690 | 2690 | <tbody> |
2691 | 2691 | <tr> |
2692 | 2692 | <td class="fld"><label for="gd_post_type"> |
2693 | - <?php _e( 'Post Type:', 'geodirectory' );?> |
|
2693 | + <?php _e('Post Type:', 'geodirectory'); ?> |
|
2694 | 2694 | </label></td> |
2695 | 2695 | <td><select name="gd_post_type" id="gd_post_type" style="min-width:140px"> |
2696 | - <?php echo $gd_posttypes_option;?> |
|
2696 | + <?php echo $gd_posttypes_option; ?> |
|
2697 | 2697 | </select></td> |
2698 | 2698 | </tr> |
2699 | 2699 | <tr> |
2700 | - <td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e( 'Max entries per csv file:', 'geodirectory' );?></label></td> |
|
2701 | - <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> |
|
2700 | + <td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e('Max entries per csv file:', 'geodirectory'); ?></label></td> |
|
2701 | + <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> |
|
2702 | 2702 | </tr> |
2703 | 2703 | <tr> |
2704 | 2704 | <td class="fld" style="vertical-align:top"><label> |
2705 | - <?php _e( 'Progress:', 'geodirectory' );?> |
|
2705 | + <?php _e('Progress:', 'geodirectory'); ?> |
|
2706 | 2706 | </label></td> |
2707 | 2707 | <td><div id='gd_progressbar_box'> |
2708 | 2708 | <div id="gd_progressbar" class="gd_progressbar"> |
@@ -2710,13 +2710,13 @@ discard block |
||
2710 | 2710 | </div> |
2711 | 2711 | </div> |
2712 | 2712 | <p style="display:inline-block"> |
2713 | - <?php _e( 'Elapsed Time:', 'geodirectory' );?> |
|
2713 | + <?php _e('Elapsed Time:', 'geodirectory'); ?> |
|
2714 | 2714 | </p> |
2715 | 2715 | |
2716 | 2716 | <p id="gd_timer" class="gd_timer">00:00:00</p></td> |
2717 | 2717 | </tr> |
2718 | 2718 | <tr class="gd-ie-actions"> |
2719 | - <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"> |
|
2719 | + <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"> |
|
2720 | 2720 | </td> |
2721 | 2721 | <td id="gd_ie_ex_files" class="gd-ie-files"></td> |
2722 | 2722 | </tr> |
@@ -2729,21 +2729,21 @@ discard block |
||
2729 | 2729 | <div id="gd_ie_imcategs" class="metabox-holder"> |
2730 | 2730 | <div class="meta-box-sortables ui-sortable"> |
2731 | 2731 | <div id="gd_ie_imcats" class="postbox gd-hndle-pbox"> |
2732 | - <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> |
|
2733 | - <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Categories: Import CSV', 'geodirectory' );?></span></h3> |
|
2732 | + <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> |
|
2733 | + <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Categories: Import CSV', 'geodirectory'); ?></span></h3> |
|
2734 | 2734 | <div class="inside"> |
2735 | 2735 | <table class="form-table"> |
2736 | 2736 | <tbody> |
2737 | 2737 | <tr> |
2738 | 2738 | <td class="gd-imex-box"> |
2739 | 2739 | <div class="gd-im-choices"> |
2740 | - <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> |
|
2741 | - <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> |
|
2740 | + <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> |
|
2741 | + <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> |
|
2742 | 2742 | </div> |
2743 | 2743 | <div class="plupload-upload-uic hide-if-no-js" id="gd_im_catplupload-upload-ui"> |
2744 | 2744 | <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');" /> |
2745 | - <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"> |
|
2746 | - <input type="hidden" id="gd_ie_imcats_csv" value="<?php echo $gd_cats_sample_csv;?>" /> |
|
2745 | + <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"> |
|
2746 | + <input type="hidden" id="gd_ie_imcats_csv" value="<?php echo $gd_cats_sample_csv; ?>" /> |
|
2747 | 2747 | <?php |
2748 | 2748 | /** |
2749 | 2749 | * Called just after the sample CSV download link. |
@@ -2753,7 +2753,7 @@ discard block |
||
2753 | 2753 | */ |
2754 | 2754 | do_action('geodir_sample_cats_csv_download_link'); |
2755 | 2755 | ?> |
2756 | - <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce( 'gd_im_catpluploadan' ); ?>"></span> |
|
2756 | + <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce('gd_im_catpluploadan'); ?>"></span> |
|
2757 | 2757 | <div class="filelist"></div> |
2758 | 2758 | </div> |
2759 | 2759 | <span id="gd_im_catupload-error" style="display:none"></span> |
@@ -2770,7 +2770,7 @@ discard block |
||
2770 | 2770 | <input type="hidden" id="gd_terminateaction" value="continue"/> |
2771 | 2771 | </div> |
2772 | 2772 | <div class="gd-import-progress" id="gd-import-progress" style="display:none"> |
2773 | - <div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory');?> </b><font |
|
2773 | + <div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory'); ?> </b><font |
|
2774 | 2774 | id="gd-import-done">0</font> / <font id="gd-import-total">0</font> ( <font |
2775 | 2775 | id="gd-import-perc">0%</font> ) |
2776 | 2776 | <div class="gd-fileprogress"></div> |
@@ -2782,10 +2782,10 @@ discard block |
||
2782 | 2782 | <div class="gd-imex-btns" style="display:none;"> |
2783 | 2783 | <input type="hidden" class="geodir_import_file" name="geodir_import_file" value="save"/> |
2784 | 2784 | <input onclick="gd_imex_PrepareImport(this, 'cat')" type="button" value="<?php echo CSV_IMPORT_DATA; ?>" id="gd_import_data" class="button-primary" /> |
2785 | - <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"/> |
|
2786 | - <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')"/> |
|
2785 | + <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"/> |
|
2786 | + <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')"/> |
|
2787 | 2787 | <div id="gd_process_data" style="display:none"> |
2788 | - <span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory');?> |
|
2788 | + <span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory'); ?> |
|
2789 | 2789 | </div> |
2790 | 2790 | </div> |
2791 | 2791 | </td> |
@@ -2799,26 +2799,26 @@ discard block |
||
2799 | 2799 | <div id="gd_ie_excategs" class="metabox-holder"> |
2800 | 2800 | <div class="meta-box-sortables ui-sortable"> |
2801 | 2801 | <div id="gd_ie_ex_cats" class="postbox gd-hndle-pbox"> |
2802 | - <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> |
|
2803 | - <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Categories: Export CSV', 'geodirectory' );?></span></h3> |
|
2802 | + <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> |
|
2803 | + <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Categories: Export CSV', 'geodirectory'); ?></span></h3> |
|
2804 | 2804 | <div class="inside"> |
2805 | 2805 | <table class="form-table"> |
2806 | 2806 | <tbody> |
2807 | 2807 | <tr> |
2808 | - <td class="fld"><label for="gd_post_type"><?php _e( 'Post Type:', 'geodirectory' );?></label></td> |
|
2809 | - <td><select name="gd_post_type" id="gd_post_type" style="min-width:140px"><?php echo $gd_posttypes_option;?></select></td> |
|
2808 | + <td class="fld"><label for="gd_post_type"><?php _e('Post Type:', 'geodirectory'); ?></label></td> |
|
2809 | + <td><select name="gd_post_type" id="gd_post_type" style="min-width:140px"><?php echo $gd_posttypes_option; ?></select></td> |
|
2810 | 2810 | </tr> |
2811 | 2811 | <tr> |
2812 | - <td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e( 'Max entries per csv file:', 'geodirectory' );?></label></td> |
|
2813 | - <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> |
|
2812 | + <td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e('Max entries per csv file:', 'geodirectory'); ?></label></td> |
|
2813 | + <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> |
|
2814 | 2814 | </tr> |
2815 | 2815 | <tr> |
2816 | - <td class="fld" style="vertical-align:top"><label><?php _e( 'Progress:', 'geodirectory' );?></label></td> |
|
2817 | - <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> |
|
2816 | + <td class="fld" style="vertical-align:top"><label><?php _e('Progress:', 'geodirectory'); ?></label></td> |
|
2817 | + <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> |
|
2818 | 2818 | </tr> |
2819 | 2819 | <tr class="gd-ie-actions"> |
2820 | 2820 | <td style="vertical-align:top"> |
2821 | - <input type="submit" value="<?php echo esc_attr( __( 'Export CSV', 'geodirectory' ) );?>" class="button-primary" name="gd_ie_excats_submit" id="gd_ie_excats_submit"> |
|
2821 | + <input type="submit" value="<?php echo esc_attr(__('Export CSV', 'geodirectory')); ?>" class="button-primary" name="gd_ie_excats_submit" id="gd_ie_excats_submit"> |
|
2822 | 2822 | </td> |
2823 | 2823 | <td id="gd_ie_ex_files" class="gd-ie-files"></td> |
2824 | 2824 | </tr> |
@@ -2840,7 +2840,7 @@ discard block |
||
2840 | 2840 | * @param array $gd_chunksize_options File chunk size options. |
2841 | 2841 | * @param string $nonce Wordpress security token for GD import & export. |
2842 | 2842 | */ |
2843 | - do_action( 'geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce ); |
|
2843 | + do_action('geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce); |
|
2844 | 2844 | ?> |
2845 | 2845 | </div> |
2846 | 2846 | </div> |
@@ -2859,7 +2859,7 @@ discard block |
||
2859 | 2859 | jQuery.ajax({ |
2860 | 2860 | url: ajaxurl, |
2861 | 2861 | type: "POST", |
2862 | - data: 'action=geodir_import_export&task=prepare_import&_pt=' + type + '&_file=' + uploadedFile + '&_nonce=<?php echo $nonce;?>', |
|
2862 | + data: 'action=geodir_import_export&task=prepare_import&_pt=' + type + '&_file=' + uploadedFile + '&_nonce=<?php echo $nonce; ?>', |
|
2863 | 2863 | dataType: 'json', |
2864 | 2864 | cache: false, |
2865 | 2865 | success: function(data) { |
@@ -2911,7 +2911,7 @@ discard block |
||
2911 | 2911 | |
2912 | 2912 | jQuery(cont).find('.filelist .file').remove(); |
2913 | 2913 | |
2914 | - jQuery('#gd-import-msg', cont).find('#message').removeClass('updated').addClass('error').html("<p><?php echo esc_attr( PLZ_SELECT_CSV_FILE );?></p>"); |
|
2914 | + jQuery('#gd-import-msg', cont).find('#message').removeClass('updated').addClass('error').html("<p><?php echo esc_attr(PLZ_SELECT_CSV_FILE); ?></p>"); |
|
2915 | 2915 | jQuery('#gd-import-msg', cont).show(); |
2916 | 2916 | |
2917 | 2917 | return false; |
@@ -2970,7 +2970,7 @@ discard block |
||
2970 | 2970 | jQuery.ajax({ |
2971 | 2971 | url: ajaxurl, |
2972 | 2972 | type: "POST", |
2973 | - data: 'action=geodir_import_export&task=import_' + type + '&_pt=' + type + '&_file=' + uploadedFile + gddata + '&_ch=' + choice + '&_nonce=<?php echo $nonce;?>', |
|
2973 | + data: 'action=geodir_import_export&task=import_' + type + '&_pt=' + type + '&_file=' + uploadedFile + gddata + '&_ch=' + choice + '&_nonce=<?php echo $nonce; ?>', |
|
2974 | 2974 | dataType : 'json', |
2975 | 2975 | cache: false, |
2976 | 2976 | success: function (data) { |
@@ -3159,27 +3159,27 @@ discard block |
||
3159 | 3159 | |
3160 | 3160 | var gdMsg = '<p></p>'; |
3161 | 3161 | if ( processed > 0 ) { |
3162 | - var msgParse = '<p><?php echo addslashes( sprintf( __( 'Total %s item(s) found.', 'geodirectory' ), '%s' ) );?></p>'; |
|
3162 | + var msgParse = '<p><?php echo addslashes(sprintf(__('Total %s item(s) found.', 'geodirectory'), '%s')); ?></p>'; |
|
3163 | 3163 | msgParse = msgParse.replace("%s", processed); |
3164 | 3164 | gdMsg += msgParse; |
3165 | 3165 | } |
3166 | 3166 | |
3167 | 3167 | if ( updated > 0 ) { |
3168 | - var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) updated.', 'geodirectory' ), '%s', '%d' ) );?></p>'; |
|
3168 | + var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) updated.', 'geodirectory'), '%s', '%d')); ?></p>'; |
|
3169 | 3169 | msgParse = msgParse.replace("%s", updated); |
3170 | 3170 | msgParse = msgParse.replace("%d", processed); |
3171 | 3171 | gdMsg += msgParse; |
3172 | 3172 | } |
3173 | 3173 | |
3174 | 3174 | if ( created > 0 ) { |
3175 | - var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) added.', 'geodirectory' ), '%s', '%d' ) );?></p>'; |
|
3175 | + var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) added.', 'geodirectory'), '%s', '%d')); ?></p>'; |
|
3176 | 3176 | msgParse = msgParse.replace("%s", created); |
3177 | 3177 | msgParse = msgParse.replace("%d", processed); |
3178 | 3178 | gdMsg += msgParse; |
3179 | 3179 | } |
3180 | 3180 | |
3181 | 3181 | if ( skipped > 0 ) { |
3182 | - var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) ignored due to already exists.', 'geodirectory' ), '%s', '%d' ) );?></p>'; |
|
3182 | + var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) ignored due to already exists.', 'geodirectory'), '%s', '%d')); ?></p>'; |
|
3183 | 3183 | msgParse = msgParse.replace("%s", skipped); |
3184 | 3184 | msgParse = msgParse.replace("%d", processed); |
3185 | 3185 | gdMsg += msgParse; |
@@ -3189,17 +3189,17 @@ discard block |
||
3189 | 3189 | if (type=='loc') { |
3190 | 3190 | invalid_addr = invalid; |
3191 | 3191 | } |
3192 | - 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>'; |
|
3192 | + 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>'; |
|
3193 | 3193 | msgParse = msgParse.replace("%s", invalid_addr); |
3194 | 3194 | msgParse = msgParse.replace("%d", total); |
3195 | 3195 | gdMsg += msgParse; |
3196 | 3196 | } |
3197 | 3197 | |
3198 | 3198 | if (invalid > 0 && type!='loc') { |
3199 | - var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) could not be added due to blank title/invalid post type.', 'geodirectory' ), '%s', '%d' ) );?></p>'; |
|
3199 | + var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) could not be added due to blank title/invalid post type.', 'geodirectory'), '%s', '%d')); ?></p>'; |
|
3200 | 3200 | |
3201 | 3201 | if (type=='hood') { |
3202 | - 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>'; |
|
3202 | + 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>'; |
|
3203 | 3203 | } |
3204 | 3204 | msgParse = msgParse.replace("%s", invalid); |
3205 | 3205 | msgParse = msgParse.replace("%d", total); |
@@ -3207,7 +3207,7 @@ discard block |
||
3207 | 3207 | } |
3208 | 3208 | |
3209 | 3209 | if (images > 0) { |
3210 | - gdMsg += '<p><?php echo addslashes( sprintf( CSV_TRANSFER_IMG_FOLDER, $uploads['subdir'] ) );?></p>'; |
|
3210 | + gdMsg += '<p><?php echo addslashes(sprintf(CSV_TRANSFER_IMG_FOLDER, $uploads['subdir'])); ?></p>'; |
|
3211 | 3211 | } |
3212 | 3212 | gdMsg += '<p></p>'; |
3213 | 3213 | jQuery('#gd-import-msg', cont).find('#message').removeClass('error').addClass('updated').html(gdMsg); |
@@ -3364,7 +3364,7 @@ discard block |
||
3364 | 3364 | |
3365 | 3365 | function gd_process_export_posts(el, post_type, total_posts, chunk_size, pages, page) { |
3366 | 3366 | if (page < 2) { |
3367 | - gd_progressbar(el, 0, '0% (0 / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>'); |
|
3367 | + gd_progressbar(el, 0, '0% (0 / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>'); |
|
3368 | 3368 | jQuery(el).find('#gd_timer').text('00:00:01'); |
3369 | 3369 | jQuery('#gd_ie_ex_files', el).html(''); |
3370 | 3370 | } |
@@ -3372,7 +3372,7 @@ discard block |
||
3372 | 3372 | jQuery.ajax({ |
3373 | 3373 | url: ajaxurl, |
3374 | 3374 | type: "POST", |
3375 | - data: 'action=geodir_import_export&task=export_posts&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce;?>&_p=' + page, |
|
3375 | + data: 'action=geodir_import_export&task=export_posts&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce; ?>&_p=' + page, |
|
3376 | 3376 | dataType : 'json', |
3377 | 3377 | cache: false, |
3378 | 3378 | beforeSend: function (jqXHR, settings) {}, |
@@ -3386,11 +3386,11 @@ discard block |
||
3386 | 3386 | } else { |
3387 | 3387 | if (pages < page || pages == page) { |
3388 | 3388 | window.clearInterval(timer_posts); |
3389 | - gd_progressbar(el, 100, '100% (' + total_posts + ' / ' + total_posts + ') <i class="fa fa-check"></i><?php echo esc_attr( __( 'Complete!', 'geodirectory' ) );?>'); |
|
3389 | + gd_progressbar(el, 100, '100% (' + total_posts + ' / ' + total_posts + ') <i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirectory')); ?>'); |
|
3390 | 3390 | } else { |
3391 | 3391 | var percentage = Math.round(((page * chunk_size) / total_posts) * 100); |
3392 | 3392 | percentage = percentage > 100 ? 100 : percentage; |
3393 | - gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>'); |
|
3393 | + gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>'); |
|
3394 | 3394 | } |
3395 | 3395 | if (typeof data.files != 'undefined' && jQuery(data.files).length ) { |
3396 | 3396 | var obj_files = data.files; |
@@ -3420,7 +3420,7 @@ discard block |
||
3420 | 3420 | |
3421 | 3421 | function gd_process_export_cats(el, post_type, total_cats, chunk_size, pages, page) { |
3422 | 3422 | if (page < 2) { |
3423 | - gd_progressbar(el, 0, '0% (0 / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>'); |
|
3423 | + gd_progressbar(el, 0, '0% (0 / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>'); |
|
3424 | 3424 | jQuery(el).find('#gd_timer').text('00:00:01'); |
3425 | 3425 | jQuery('#gd_ie_ex_files', el).html(''); |
3426 | 3426 | } |
@@ -3428,7 +3428,7 @@ discard block |
||
3428 | 3428 | jQuery.ajax({ |
3429 | 3429 | url: ajaxurl, |
3430 | 3430 | type: "POST", |
3431 | - data: 'action=geodir_import_export&task=export_cats&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce;?>&_p=' + page, |
|
3431 | + data: 'action=geodir_import_export&task=export_cats&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce; ?>&_p=' + page, |
|
3432 | 3432 | dataType : 'json', |
3433 | 3433 | cache: false, |
3434 | 3434 | beforeSend: function (jqXHR, settings) {}, |
@@ -3442,11 +3442,11 @@ discard block |
||
3442 | 3442 | } else { |
3443 | 3443 | if (pages < page || pages == page) { |
3444 | 3444 | window.clearInterval(timer_cats); |
3445 | - gd_progressbar(el, 100, '100% (' + total_cats + ' / ' + total_cats + ') <i class="fa fa-check"></i><?php echo esc_attr( __( 'Complete!', 'geodirectory' ) );?>'); |
|
3445 | + gd_progressbar(el, 100, '100% (' + total_cats + ' / ' + total_cats + ') <i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirectory')); ?>'); |
|
3446 | 3446 | } else { |
3447 | 3447 | var percentage = Math.round(((page * chunk_size) / total_cats) * 100); |
3448 | 3448 | percentage = percentage > 100 ? 100 : percentage; |
3449 | - gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php esc_attr_e( 'Exporting...', 'geodirectory' );?>'); |
|
3449 | + gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php esc_attr_e('Exporting...', 'geodirectory'); ?>'); |
|
3450 | 3450 | } |
3451 | 3451 | if (typeof data.files != 'undefined' && jQuery(data.files).length ) { |
3452 | 3452 | var obj_files = data.files; |
@@ -3503,13 +3503,13 @@ discard block |
||
3503 | 3503 | function geodir_init_filesystem() |
3504 | 3504 | { |
3505 | 3505 | |
3506 | - if(!function_exists('get_filesystem_method')){ |
|
3506 | + if (!function_exists('get_filesystem_method')) { |
|
3507 | 3507 | require_once(ABSPATH."/wp-admin/includes/file.php"); |
3508 | 3508 | } |
3509 | 3509 | $access_type = get_filesystem_method(); |
3510 | 3510 | if ($access_type === 'direct') { |
3511 | 3511 | /* you can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */ |
3512 | - $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array()); |
|
3512 | + $creds = request_filesystem_credentials(trailingslashit(site_url()).'wp-admin/', '', false, false, array()); |
|
3513 | 3513 | |
3514 | 3514 | /* initialize the API */ |
3515 | 3515 | if (!WP_Filesystem($creds)) { |
@@ -3522,7 +3522,7 @@ discard block |
||
3522 | 3522 | return $wp_filesystem; |
3523 | 3523 | /* do our file manipulations below */ |
3524 | 3524 | } elseif (defined('FTP_USER')) { |
3525 | - $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array()); |
|
3525 | + $creds = request_filesystem_credentials(trailingslashit(site_url()).'wp-admin/', '', false, false, array()); |
|
3526 | 3526 | |
3527 | 3527 | /* initialize the API */ |
3528 | 3528 | if (!WP_Filesystem($creds)) { |
@@ -3557,7 +3557,7 @@ discard block |
||
3557 | 3557 | * @package GeoDirectory |
3558 | 3558 | */ |
3559 | 3559 | function geodir_filesystem_notice() |
3560 | -{ if ( defined( 'DOING_AJAX' ) ){return;} |
|
3560 | +{ if (defined('DOING_AJAX')) {return; } |
|
3561 | 3561 | $access_type = get_filesystem_method(); |
3562 | 3562 | if ($access_type === 'direct') { |
3563 | 3563 | } elseif (!defined('FTP_USER')) { |
@@ -3594,64 +3594,64 @@ discard block |
||
3594 | 3594 | // try to set higher limits for import |
3595 | 3595 | $max_input_time = ini_get('max_input_time'); |
3596 | 3596 | $max_execution_time = ini_get('max_execution_time'); |
3597 | - $memory_limit= ini_get('memory_limit'); |
|
3597 | + $memory_limit = ini_get('memory_limit'); |
|
3598 | 3598 | |
3599 | - if(!$max_input_time || $max_input_time<3000){ |
|
3599 | + if (!$max_input_time || $max_input_time < 3000) { |
|
3600 | 3600 | ini_set('max_input_time', 3000); |
3601 | 3601 | } |
3602 | 3602 | |
3603 | - if(!$max_execution_time || $max_execution_time<3000){ |
|
3603 | + if (!$max_execution_time || $max_execution_time < 3000) { |
|
3604 | 3604 | ini_set('max_execution_time', 3000); |
3605 | 3605 | } |
3606 | 3606 | |
3607 | - if($memory_limit && str_replace('M','',$memory_limit)){ |
|
3608 | - if(str_replace('M','',$memory_limit)<256){ |
|
3607 | + if ($memory_limit && str_replace('M', '', $memory_limit)) { |
|
3608 | + if (str_replace('M', '', $memory_limit) < 256) { |
|
3609 | 3609 | ini_set('memory_limit', '256M'); |
3610 | 3610 | } |
3611 | 3611 | } |
3612 | 3612 | |
3613 | 3613 | $json = array(); |
3614 | 3614 | |
3615 | - if ( !current_user_can( 'manage_options' ) ) { |
|
3616 | - wp_send_json( $json ); |
|
3615 | + if (!current_user_can('manage_options')) { |
|
3616 | + wp_send_json($json); |
|
3617 | 3617 | } |
3618 | 3618 | |
3619 | - $task = isset( $_REQUEST['task'] ) ? $_REQUEST['task'] : NULL; |
|
3620 | - $nonce = isset( $_REQUEST['_nonce'] ) ? $_REQUEST['_nonce'] : NULL; |
|
3621 | - $stat = isset( $_REQUEST['_st'] ) ? $_REQUEST['_st'] : false; |
|
3619 | + $task = isset($_REQUEST['task']) ? $_REQUEST['task'] : NULL; |
|
3620 | + $nonce = isset($_REQUEST['_nonce']) ? $_REQUEST['_nonce'] : NULL; |
|
3621 | + $stat = isset($_REQUEST['_st']) ? $_REQUEST['_st'] : false; |
|
3622 | 3622 | |
3623 | - if ( !wp_verify_nonce( $nonce, 'geodir_import_export_nonce' ) ) { |
|
3624 | - wp_send_json( $json ); |
|
3623 | + if (!wp_verify_nonce($nonce, 'geodir_import_export_nonce')) { |
|
3624 | + wp_send_json($json); |
|
3625 | 3625 | } |
3626 | 3626 | |
3627 | - $post_type = isset( $_REQUEST['_pt'] ) ? $_REQUEST['_pt'] : NULL; |
|
3628 | - $chunk_per_page = isset( $_REQUEST['_n'] ) ? absint($_REQUEST['_n']) : NULL; |
|
3627 | + $post_type = isset($_REQUEST['_pt']) ? $_REQUEST['_pt'] : NULL; |
|
3628 | + $chunk_per_page = isset($_REQUEST['_n']) ? absint($_REQUEST['_n']) : NULL; |
|
3629 | 3629 | $chunk_per_page = $chunk_per_page < 50 || $chunk_per_page > 100000 ? 5000 : $chunk_per_page; |
3630 | - $chunk_page_no = isset( $_REQUEST['_p'] ) ? absint($_REQUEST['_p']) : 1; |
|
3630 | + $chunk_page_no = isset($_REQUEST['_p']) ? absint($_REQUEST['_p']) : 1; |
|
3631 | 3631 | |
3632 | 3632 | $wp_filesystem = geodir_init_filesystem(); |
3633 | 3633 | if (!$wp_filesystem) { |
3634 | - $json['error'] = __( 'Filesystem ERROR: Could not access filesystem.', 'geodirectory' ); |
|
3635 | - wp_send_json( $json ); |
|
3634 | + $json['error'] = __('Filesystem ERROR: Could not access filesystem.', 'geodirectory'); |
|
3635 | + wp_send_json($json); |
|
3636 | 3636 | } |
3637 | 3637 | |
3638 | 3638 | if (!empty($wp_filesystem) && isset($wp_filesystem->errors) && is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) { |
3639 | - $json['error'] = __( 'Filesystem ERROR: ' . $wp_filesystem->errors->get_error_message(), 'geodirectory' ); |
|
3640 | - wp_send_json( $json ); |
|
3639 | + $json['error'] = __('Filesystem ERROR: '.$wp_filesystem->errors->get_error_message(), 'geodirectory'); |
|
3640 | + wp_send_json($json); |
|
3641 | 3641 | } |
3642 | 3642 | |
3643 | - $csv_file_dir = geodir_path_import_export( false ); |
|
3644 | - if ( !$wp_filesystem->is_dir( $csv_file_dir ) ) { |
|
3645 | - if ( !$wp_filesystem->mkdir( $csv_file_dir, FS_CHMOD_DIR ) ) { |
|
3646 | - $json['error'] = __( 'ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory' ); |
|
3647 | - wp_send_json( $json ); |
|
3643 | + $csv_file_dir = geodir_path_import_export(false); |
|
3644 | + if (!$wp_filesystem->is_dir($csv_file_dir)) { |
|
3645 | + if (!$wp_filesystem->mkdir($csv_file_dir, FS_CHMOD_DIR)) { |
|
3646 | + $json['error'] = __('ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory'); |
|
3647 | + wp_send_json($json); |
|
3648 | 3648 | } |
3649 | 3649 | } |
3650 | 3650 | |
3651 | 3651 | $location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active. |
3652 | 3652 | $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false; |
3653 | 3653 | |
3654 | - switch ( $task ) { |
|
3654 | + switch ($task) { |
|
3655 | 3655 | case 'export_posts': { |
3656 | 3656 | // WPML |
3657 | 3657 | $is_wpml = geodir_is_wpml(); |
@@ -3662,22 +3662,22 @@ discard block |
||
3662 | 3662 | $sitepress->switch_lang('all', true); |
3663 | 3663 | } |
3664 | 3664 | // WPML |
3665 | - if ( $post_type == 'gd_event' ) { |
|
3666 | - add_filter( 'geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2 ); |
|
3665 | + if ($post_type == 'gd_event') { |
|
3666 | + add_filter('geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2); |
|
3667 | 3667 | } |
3668 | - $file_name = $post_type . '_' . date( 'dmyHi' ); |
|
3669 | - $posts_count = geodir_get_posts_count( $post_type ); |
|
3670 | - $file_url_base = geodir_path_import_export() . '/'; |
|
3671 | - $file_url = $file_url_base . $file_name . '.csv'; |
|
3672 | - $file_path = $csv_file_dir . '/' . $file_name . '.csv'; |
|
3673 | - $file_path_temp = $csv_file_dir . '/' . $post_type . '_' . $nonce . '.csv'; |
|
3668 | + $file_name = $post_type.'_'.date('dmyHi'); |
|
3669 | + $posts_count = geodir_get_posts_count($post_type); |
|
3670 | + $file_url_base = geodir_path_import_export().'/'; |
|
3671 | + $file_url = $file_url_base.$file_name.'.csv'; |
|
3672 | + $file_path = $csv_file_dir.'/'.$file_name.'.csv'; |
|
3673 | + $file_path_temp = $csv_file_dir.'/'.$post_type.'_'.$nonce.'.csv'; |
|
3674 | 3674 | |
3675 | 3675 | $chunk_file_paths = array(); |
3676 | 3676 | |
3677 | - if ( isset( $_REQUEST['_st'] ) ) { |
|
3678 | - $line_count = (int)geodir_import_export_line_count( $file_path_temp ); |
|
3679 | - $percentage = count( $posts_count ) > 0 && $line_count > 0 ? ceil( $line_count / $posts_count ) * 100 : 0; |
|
3680 | - $percentage = min( $percentage, 100 ); |
|
3677 | + if (isset($_REQUEST['_st'])) { |
|
3678 | + $line_count = (int) geodir_import_export_line_count($file_path_temp); |
|
3679 | + $percentage = count($posts_count) > 0 && $line_count > 0 ? ceil($line_count / $posts_count) * 100 : 0; |
|
3680 | + $percentage = min($percentage, 100); |
|
3681 | 3681 | |
3682 | 3682 | $json['percentage'] = $percentage; |
3683 | 3683 | // WPML |
@@ -3685,45 +3685,45 @@ discard block |
||
3685 | 3685 | $sitepress->switch_lang($active_lang, true); |
3686 | 3686 | } |
3687 | 3687 | // WPML |
3688 | - wp_send_json( $json ); |
|
3688 | + wp_send_json($json); |
|
3689 | 3689 | exit; |
3690 | 3690 | } else { |
3691 | - if ( !$posts_count > 0 ) { |
|
3692 | - $json['error'] = __( 'No records to export.', 'geodirectory' ); |
|
3691 | + if (!$posts_count > 0) { |
|
3692 | + $json['error'] = __('No records to export.', 'geodirectory'); |
|
3693 | 3693 | } else { |
3694 | 3694 | $total_posts = $posts_count; |
3695 | 3695 | if ($chunk_per_page > $total_posts) { |
3696 | 3696 | $chunk_per_page = $total_posts; |
3697 | 3697 | } |
3698 | - $chunk_total_pages = ceil( $total_posts / $chunk_per_page ); |
|
3698 | + $chunk_total_pages = ceil($total_posts / $chunk_per_page); |
|
3699 | 3699 | |
3700 | 3700 | $j = $chunk_page_no; |
3701 | - $chunk_save_posts = geodir_imex_get_posts( $post_type, $chunk_per_page, $j ); |
|
3701 | + $chunk_save_posts = geodir_imex_get_posts($post_type, $chunk_per_page, $j); |
|
3702 | 3702 | |
3703 | 3703 | $per_page = 500; |
3704 | 3704 | if ($per_page > $chunk_per_page) { |
3705 | 3705 | $per_page = $chunk_per_page; |
3706 | 3706 | } |
3707 | - $total_pages = ceil( $chunk_per_page / $per_page ); |
|
3707 | + $total_pages = ceil($chunk_per_page / $per_page); |
|
3708 | 3708 | |
3709 | - for ( $i = 0; $i <= $total_pages; $i++ ) { |
|
3710 | - $save_posts = array_slice( $chunk_save_posts , ( $i * $per_page ), $per_page ); |
|
3709 | + for ($i = 0; $i <= $total_pages; $i++) { |
|
3710 | + $save_posts = array_slice($chunk_save_posts, ($i * $per_page), $per_page); |
|
3711 | 3711 | |
3712 | 3712 | $clear = $i == 0 ? true : false; |
3713 | - geodir_save_csv_data( $file_path_temp, $save_posts, $clear ); |
|
3713 | + geodir_save_csv_data($file_path_temp, $save_posts, $clear); |
|
3714 | 3714 | } |
3715 | 3715 | |
3716 | - if ( $wp_filesystem->exists( $file_path_temp ) ) { |
|
3717 | - $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : ''; |
|
3718 | - $chunk_file_name = $file_name . $chunk_page_no . '.csv'; |
|
3719 | - $file_path = $csv_file_dir . '/' . $chunk_file_name; |
|
3720 | - $wp_filesystem->move( $file_path_temp, $file_path, true ); |
|
3716 | + if ($wp_filesystem->exists($file_path_temp)) { |
|
3717 | + $chunk_page_no = $chunk_total_pages > 1 ? '-'.$j : ''; |
|
3718 | + $chunk_file_name = $file_name.$chunk_page_no.'.csv'; |
|
3719 | + $file_path = $csv_file_dir.'/'.$chunk_file_name; |
|
3720 | + $wp_filesystem->move($file_path_temp, $file_path, true); |
|
3721 | 3721 | |
3722 | - $file_url = $file_url_base . $chunk_file_name; |
|
3723 | - $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2)); |
|
3722 | + $file_url = $file_url_base.$chunk_file_name; |
|
3723 | + $chunk_file_paths[] = array('i' => $j.'.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2)); |
|
3724 | 3724 | } |
3725 | 3725 | |
3726 | - if ( !empty($chunk_file_paths) ) { |
|
3726 | + if (!empty($chunk_file_paths)) { |
|
3727 | 3727 | $json['total'] = $posts_count; |
3728 | 3728 | $json['files'] = $chunk_file_paths; |
3729 | 3729 | } else { |
@@ -3731,7 +3731,7 @@ discard block |
||
3731 | 3731 | $json['total'] = $posts_count; |
3732 | 3732 | $json['files'] = array(); |
3733 | 3733 | } else { |
3734 | - $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' ); |
|
3734 | + $json['error'] = __('ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory'); |
|
3735 | 3735 | } |
3736 | 3736 | } |
3737 | 3737 | } |
@@ -3740,7 +3740,7 @@ discard block |
||
3740 | 3740 | $sitepress->switch_lang($active_lang, true); |
3741 | 3741 | } |
3742 | 3742 | // WPML |
3743 | - wp_send_json( $json ); |
|
3743 | + wp_send_json($json); |
|
3744 | 3744 | } |
3745 | 3745 | } |
3746 | 3746 | break; |
@@ -3754,20 +3754,20 @@ discard block |
||
3754 | 3754 | $sitepress->switch_lang('all', true); |
3755 | 3755 | } |
3756 | 3756 | // WPML |
3757 | - $file_name = $post_type . 'category_' . date( 'dmyHi' ); |
|
3757 | + $file_name = $post_type.'category_'.date('dmyHi'); |
|
3758 | 3758 | |
3759 | - $terms_count = geodir_get_terms_count( $post_type ); |
|
3760 | - $file_url_base = geodir_path_import_export() . '/'; |
|
3761 | - $file_url = $file_url_base . $file_name . '.csv'; |
|
3762 | - $file_path = $csv_file_dir . '/' . $file_name . '.csv'; |
|
3763 | - $file_path_temp = $csv_file_dir . '/' . $post_type . 'category_' . $nonce . '.csv'; |
|
3759 | + $terms_count = geodir_get_terms_count($post_type); |
|
3760 | + $file_url_base = geodir_path_import_export().'/'; |
|
3761 | + $file_url = $file_url_base.$file_name.'.csv'; |
|
3762 | + $file_path = $csv_file_dir.'/'.$file_name.'.csv'; |
|
3763 | + $file_path_temp = $csv_file_dir.'/'.$post_type.'category_'.$nonce.'.csv'; |
|
3764 | 3764 | |
3765 | 3765 | $chunk_file_paths = array(); |
3766 | 3766 | |
3767 | - if ( isset( $_REQUEST['_st'] ) ) { |
|
3768 | - $line_count = (int)geodir_import_export_line_count( $file_path_temp ); |
|
3769 | - $percentage = count( $terms_count ) > 0 && $line_count > 0 ? ceil( $line_count / $terms_count ) * 100 : 0; |
|
3770 | - $percentage = min( $percentage, 100 ); |
|
3767 | + if (isset($_REQUEST['_st'])) { |
|
3768 | + $line_count = (int) geodir_import_export_line_count($file_path_temp); |
|
3769 | + $percentage = count($terms_count) > 0 && $line_count > 0 ? ceil($line_count / $terms_count) * 100 : 0; |
|
3770 | + $percentage = min($percentage, 100); |
|
3771 | 3771 | |
3772 | 3772 | $json['percentage'] = $percentage; |
3773 | 3773 | // WPML |
@@ -3775,48 +3775,48 @@ discard block |
||
3775 | 3775 | $sitepress->switch_lang($active_lang, true); |
3776 | 3776 | } |
3777 | 3777 | // WPML |
3778 | - wp_send_json( $json ); |
|
3778 | + wp_send_json($json); |
|
3779 | 3779 | } else { |
3780 | - if ( !$terms_count > 0 ) { |
|
3781 | - $json['error'] = __( 'No records to export.', 'geodirectory' ); |
|
3780 | + if (!$terms_count > 0) { |
|
3781 | + $json['error'] = __('No records to export.', 'geodirectory'); |
|
3782 | 3782 | } else { |
3783 | 3783 | $total_terms = $terms_count; |
3784 | 3784 | if ($chunk_per_page > $terms_count) { |
3785 | 3785 | $chunk_per_page = $terms_count; |
3786 | 3786 | } |
3787 | - $chunk_total_pages = ceil( $total_terms / $chunk_per_page ); |
|
3787 | + $chunk_total_pages = ceil($total_terms / $chunk_per_page); |
|
3788 | 3788 | |
3789 | 3789 | $j = $chunk_page_no; |
3790 | - $chunk_save_terms = geodir_imex_get_terms( $post_type, $chunk_per_page, $j ); |
|
3790 | + $chunk_save_terms = geodir_imex_get_terms($post_type, $chunk_per_page, $j); |
|
3791 | 3791 | |
3792 | 3792 | $per_page = 500; |
3793 | 3793 | if ($per_page > $chunk_per_page) { |
3794 | 3794 | $per_page = $chunk_per_page; |
3795 | 3795 | } |
3796 | - $total_pages = ceil( $chunk_per_page / $per_page ); |
|
3796 | + $total_pages = ceil($chunk_per_page / $per_page); |
|
3797 | 3797 | |
3798 | - for ( $i = 0; $i <= $total_pages; $i++ ) { |
|
3799 | - $save_terms = array_slice( $chunk_save_terms , ( $i * $per_page ), $per_page ); |
|
3798 | + for ($i = 0; $i <= $total_pages; $i++) { |
|
3799 | + $save_terms = array_slice($chunk_save_terms, ($i * $per_page), $per_page); |
|
3800 | 3800 | |
3801 | 3801 | $clear = $i == 0 ? true : false; |
3802 | - geodir_save_csv_data( $file_path_temp, $save_terms, $clear ); |
|
3802 | + geodir_save_csv_data($file_path_temp, $save_terms, $clear); |
|
3803 | 3803 | } |
3804 | 3804 | |
3805 | - if ( $wp_filesystem->exists( $file_path_temp ) ) { |
|
3806 | - $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : ''; |
|
3807 | - $chunk_file_name = $file_name . $chunk_page_no . '.csv'; |
|
3808 | - $file_path = $csv_file_dir . '/' . $chunk_file_name; |
|
3809 | - $wp_filesystem->move( $file_path_temp, $file_path, true ); |
|
3805 | + if ($wp_filesystem->exists($file_path_temp)) { |
|
3806 | + $chunk_page_no = $chunk_total_pages > 1 ? '-'.$j : ''; |
|
3807 | + $chunk_file_name = $file_name.$chunk_page_no.'.csv'; |
|
3808 | + $file_path = $csv_file_dir.'/'.$chunk_file_name; |
|
3809 | + $wp_filesystem->move($file_path_temp, $file_path, true); |
|
3810 | 3810 | |
3811 | - $file_url = $file_url_base . $chunk_file_name; |
|
3812 | - $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2)); |
|
3811 | + $file_url = $file_url_base.$chunk_file_name; |
|
3812 | + $chunk_file_paths[] = array('i' => $j.'.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2)); |
|
3813 | 3813 | } |
3814 | 3814 | |
3815 | - if ( !empty($chunk_file_paths) ) { |
|
3815 | + if (!empty($chunk_file_paths)) { |
|
3816 | 3816 | $json['total'] = $terms_count; |
3817 | 3817 | $json['files'] = $chunk_file_paths; |
3818 | 3818 | } else { |
3819 | - $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' ); |
|
3819 | + $json['error'] = __('ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory'); |
|
3820 | 3820 | } |
3821 | 3821 | } |
3822 | 3822 | // WPML |
@@ -3824,127 +3824,127 @@ discard block |
||
3824 | 3824 | $sitepress->switch_lang($active_lang, true); |
3825 | 3825 | } |
3826 | 3826 | // WPML |
3827 | - wp_send_json( $json ); |
|
3827 | + wp_send_json($json); |
|
3828 | 3828 | } |
3829 | 3829 | } |
3830 | 3830 | break; |
3831 | 3831 | case 'export_locations': { |
3832 | - $file_url_base = geodir_path_import_export() . '/'; |
|
3833 | - $file_name = 'gd_locations_' . date( 'dmyHi' ); |
|
3834 | - $file_url = $file_url_base . $file_name . '.csv'; |
|
3835 | - $file_path = $csv_file_dir . '/' . $file_name . '.csv'; |
|
3836 | - $file_path_temp = $csv_file_dir . '/gd_locations_' . $nonce . '.csv'; |
|
3832 | + $file_url_base = geodir_path_import_export().'/'; |
|
3833 | + $file_name = 'gd_locations_'.date('dmyHi'); |
|
3834 | + $file_url = $file_url_base.$file_name.'.csv'; |
|
3835 | + $file_path = $csv_file_dir.'/'.$file_name.'.csv'; |
|
3836 | + $file_path_temp = $csv_file_dir.'/gd_locations_'.$nonce.'.csv'; |
|
3837 | 3837 | |
3838 | - $items_count = (int)geodir_location_imex_count_locations(); |
|
3838 | + $items_count = (int) geodir_location_imex_count_locations(); |
|
3839 | 3839 | |
3840 | - if ( isset( $_REQUEST['_st'] ) ) { |
|
3841 | - $line_count = (int)geodir_import_export_line_count( $file_path_temp ); |
|
3842 | - $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0; |
|
3843 | - $percentage = min( $percentage, 100 ); |
|
3840 | + if (isset($_REQUEST['_st'])) { |
|
3841 | + $line_count = (int) geodir_import_export_line_count($file_path_temp); |
|
3842 | + $percentage = count($items_count) > 0 && $line_count > 0 ? ceil($line_count / $items_count) * 100 : 0; |
|
3843 | + $percentage = min($percentage, 100); |
|
3844 | 3844 | |
3845 | 3845 | $json['percentage'] = $percentage; |
3846 | - wp_send_json( $json ); |
|
3846 | + wp_send_json($json); |
|
3847 | 3847 | } else { |
3848 | 3848 | $chunk_file_paths = array(); |
3849 | 3849 | |
3850 | - if ( !$items_count > 0 ) { |
|
3851 | - $json['error'] = __( 'No records to export.', 'geodirectory' ); |
|
3850 | + if (!$items_count > 0) { |
|
3851 | + $json['error'] = __('No records to export.', 'geodirectory'); |
|
3852 | 3852 | } else { |
3853 | - $chunk_per_page = min( $chunk_per_page, $items_count ); |
|
3854 | - $chunk_total_pages = ceil( $items_count / $chunk_per_page ); |
|
3853 | + $chunk_per_page = min($chunk_per_page, $items_count); |
|
3854 | + $chunk_total_pages = ceil($items_count / $chunk_per_page); |
|
3855 | 3855 | |
3856 | 3856 | $j = $chunk_page_no; |
3857 | - $chunk_save_items = geodir_location_imex_locations_data( $chunk_per_page, $j ); |
|
3857 | + $chunk_save_items = geodir_location_imex_locations_data($chunk_per_page, $j); |
|
3858 | 3858 | |
3859 | 3859 | $per_page = 500; |
3860 | - $per_page = min( $per_page, $chunk_per_page ); |
|
3861 | - $total_pages = ceil( $chunk_per_page / $per_page ); |
|
3860 | + $per_page = min($per_page, $chunk_per_page); |
|
3861 | + $total_pages = ceil($chunk_per_page / $per_page); |
|
3862 | 3862 | |
3863 | - for ( $i = 0; $i <= $total_pages; $i++ ) { |
|
3864 | - $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page ); |
|
3863 | + for ($i = 0; $i <= $total_pages; $i++) { |
|
3864 | + $save_items = array_slice($chunk_save_items, ($i * $per_page), $per_page); |
|
3865 | 3865 | |
3866 | 3866 | $clear = $i == 0 ? true : false; |
3867 | - geodir_save_csv_data( $file_path_temp, $save_items, $clear ); |
|
3867 | + geodir_save_csv_data($file_path_temp, $save_items, $clear); |
|
3868 | 3868 | } |
3869 | 3869 | |
3870 | - if ( $wp_filesystem->exists( $file_path_temp ) ) { |
|
3871 | - $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : ''; |
|
3872 | - $chunk_file_name = $file_name . $chunk_page_no . '.csv'; |
|
3873 | - $file_path = $csv_file_dir . '/' . $chunk_file_name; |
|
3874 | - $wp_filesystem->move( $file_path_temp, $file_path, true ); |
|
3870 | + if ($wp_filesystem->exists($file_path_temp)) { |
|
3871 | + $chunk_page_no = $chunk_total_pages > 1 ? '-'.$j : ''; |
|
3872 | + $chunk_file_name = $file_name.$chunk_page_no.'.csv'; |
|
3873 | + $file_path = $csv_file_dir.'/'.$chunk_file_name; |
|
3874 | + $wp_filesystem->move($file_path_temp, $file_path, true); |
|
3875 | 3875 | |
3876 | - $file_url = $file_url_base . $chunk_file_name; |
|
3877 | - $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2)); |
|
3876 | + $file_url = $file_url_base.$chunk_file_name; |
|
3877 | + $chunk_file_paths[] = array('i' => $j.'.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2)); |
|
3878 | 3878 | } |
3879 | 3879 | |
3880 | - if ( !empty($chunk_file_paths) ) { |
|
3880 | + if (!empty($chunk_file_paths)) { |
|
3881 | 3881 | $json['total'] = $items_count; |
3882 | 3882 | $json['files'] = $chunk_file_paths; |
3883 | 3883 | } else { |
3884 | - $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' ); |
|
3884 | + $json['error'] = __('Fail, something wrong to create csv file.', 'geodirectory'); |
|
3885 | 3885 | } |
3886 | 3886 | } |
3887 | - wp_send_json( $json ); |
|
3887 | + wp_send_json($json); |
|
3888 | 3888 | } |
3889 | 3889 | } |
3890 | 3890 | break; |
3891 | 3891 | case 'export_hoods': { |
3892 | - $file_url_base = geodir_path_import_export() . '/'; |
|
3893 | - $file_name = 'gd_neighbourhoods_' . date( 'dmyHi' ); |
|
3894 | - $file_url = $file_url_base . $file_name . '.csv'; |
|
3895 | - $file_path = $csv_file_dir . '/' . $file_name . '.csv'; |
|
3896 | - $file_path_temp = $csv_file_dir . '/gd_neighbourhoods_' . $nonce . '.csv'; |
|
3892 | + $file_url_base = geodir_path_import_export().'/'; |
|
3893 | + $file_name = 'gd_neighbourhoods_'.date('dmyHi'); |
|
3894 | + $file_url = $file_url_base.$file_name.'.csv'; |
|
3895 | + $file_path = $csv_file_dir.'/'.$file_name.'.csv'; |
|
3896 | + $file_path_temp = $csv_file_dir.'/gd_neighbourhoods_'.$nonce.'.csv'; |
|
3897 | 3897 | |
3898 | - $items_count = (int)geodir_location_imex_count_neighbourhoods(); |
|
3898 | + $items_count = (int) geodir_location_imex_count_neighbourhoods(); |
|
3899 | 3899 | |
3900 | - if ( isset( $_REQUEST['_st'] ) ) { |
|
3901 | - $line_count = (int)geodir_import_export_line_count( $file_path_temp ); |
|
3902 | - $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0; |
|
3903 | - $percentage = min( $percentage, 100 ); |
|
3900 | + if (isset($_REQUEST['_st'])) { |
|
3901 | + $line_count = (int) geodir_import_export_line_count($file_path_temp); |
|
3902 | + $percentage = count($items_count) > 0 && $line_count > 0 ? ceil($line_count / $items_count) * 100 : 0; |
|
3903 | + $percentage = min($percentage, 100); |
|
3904 | 3904 | |
3905 | 3905 | $json['percentage'] = $percentage; |
3906 | - wp_send_json( $json ); |
|
3906 | + wp_send_json($json); |
|
3907 | 3907 | } else { |
3908 | 3908 | $chunk_file_paths = array(); |
3909 | 3909 | |
3910 | - if ( !$items_count > 0 ) { |
|
3911 | - $json['error'] = __( 'No records to export.', 'geodirectory' ); |
|
3910 | + if (!$items_count > 0) { |
|
3911 | + $json['error'] = __('No records to export.', 'geodirectory'); |
|
3912 | 3912 | } else { |
3913 | - $chunk_per_page = min( $chunk_per_page, $items_count ); |
|
3914 | - $chunk_total_pages = ceil( $items_count / $chunk_per_page ); |
|
3913 | + $chunk_per_page = min($chunk_per_page, $items_count); |
|
3914 | + $chunk_total_pages = ceil($items_count / $chunk_per_page); |
|
3915 | 3915 | |
3916 | 3916 | $j = $chunk_page_no; |
3917 | - $chunk_save_items = geodir_location_imex_neighbourhoods_data( $chunk_per_page, $j ); |
|
3917 | + $chunk_save_items = geodir_location_imex_neighbourhoods_data($chunk_per_page, $j); |
|
3918 | 3918 | |
3919 | 3919 | $per_page = 500; |
3920 | - $per_page = min( $per_page, $chunk_per_page ); |
|
3921 | - $total_pages = ceil( $chunk_per_page / $per_page ); |
|
3920 | + $per_page = min($per_page, $chunk_per_page); |
|
3921 | + $total_pages = ceil($chunk_per_page / $per_page); |
|
3922 | 3922 | |
3923 | - for ( $i = 0; $i <= $total_pages; $i++ ) { |
|
3924 | - $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page ); |
|
3923 | + for ($i = 0; $i <= $total_pages; $i++) { |
|
3924 | + $save_items = array_slice($chunk_save_items, ($i * $per_page), $per_page); |
|
3925 | 3925 | |
3926 | 3926 | $clear = $i == 0 ? true : false; |
3927 | - geodir_save_csv_data( $file_path_temp, $save_items, $clear ); |
|
3927 | + geodir_save_csv_data($file_path_temp, $save_items, $clear); |
|
3928 | 3928 | } |
3929 | 3929 | |
3930 | - if ( $wp_filesystem->exists( $file_path_temp ) ) { |
|
3931 | - $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : ''; |
|
3932 | - $chunk_file_name = $file_name . $chunk_page_no . '.csv'; |
|
3933 | - $file_path = $csv_file_dir . '/' . $chunk_file_name; |
|
3934 | - $wp_filesystem->move( $file_path_temp, $file_path, true ); |
|
3930 | + if ($wp_filesystem->exists($file_path_temp)) { |
|
3931 | + $chunk_page_no = $chunk_total_pages > 1 ? '-'.$j : ''; |
|
3932 | + $chunk_file_name = $file_name.$chunk_page_no.'.csv'; |
|
3933 | + $file_path = $csv_file_dir.'/'.$chunk_file_name; |
|
3934 | + $wp_filesystem->move($file_path_temp, $file_path, true); |
|
3935 | 3935 | |
3936 | - $file_url = $file_url_base . $chunk_file_name; |
|
3937 | - $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2)); |
|
3936 | + $file_url = $file_url_base.$chunk_file_name; |
|
3937 | + $chunk_file_paths[] = array('i' => $j.'.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2)); |
|
3938 | 3938 | } |
3939 | 3939 | |
3940 | - if ( !empty($chunk_file_paths) ) { |
|
3940 | + if (!empty($chunk_file_paths)) { |
|
3941 | 3941 | $json['total'] = $items_count; |
3942 | 3942 | $json['files'] = $chunk_file_paths; |
3943 | 3943 | } else { |
3944 | - $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' ); |
|
3944 | + $json['error'] = __('Fail, something wrong to create csv file.', 'geodirectory'); |
|
3945 | 3945 | } |
3946 | 3946 | } |
3947 | - wp_send_json( $json ); |
|
3947 | + wp_send_json($json); |
|
3948 | 3948 | } |
3949 | 3949 | } |
3950 | 3950 | break; |
@@ -3961,33 +3961,33 @@ discard block |
||
3961 | 3961 | } |
3962 | 3962 | // WPML |
3963 | 3963 | |
3964 | - ini_set( 'auto_detect_line_endings', true ); |
|
3964 | + ini_set('auto_detect_line_endings', true); |
|
3965 | 3965 | |
3966 | 3966 | $uploads = wp_upload_dir(); |
3967 | 3967 | $uploads_dir = $uploads['path']; |
3968 | 3968 | $uploads_subdir = $uploads['subdir']; |
3969 | 3969 | |
3970 | - $csv_file = isset( $_POST['_file'] ) ? $_POST['_file'] : NULL; |
|
3971 | - $import_choice = isset( $_REQUEST['_ch'] ) ? $_REQUEST['_ch'] : 'skip'; |
|
3970 | + $csv_file = isset($_POST['_file']) ? $_POST['_file'] : NULL; |
|
3971 | + $import_choice = isset($_REQUEST['_ch']) ? $_REQUEST['_ch'] : 'skip'; |
|
3972 | 3972 | |
3973 | - $csv_file_arr = explode( '/', $csv_file ); |
|
3974 | - $csv_filename = end( $csv_file_arr ); |
|
3975 | - $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $csv_filename; |
|
3973 | + $csv_file_arr = explode('/', $csv_file); |
|
3974 | + $csv_filename = end($csv_file_arr); |
|
3975 | + $target_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$csv_filename; |
|
3976 | 3976 | |
3977 | 3977 | $json['file'] = $csv_file; |
3978 | - $json['error'] = __( 'The uploaded file is not a valid csv file. Please try again.', 'geodirectory' ); |
|
3978 | + $json['error'] = __('The uploaded file is not a valid csv file. Please try again.', 'geodirectory'); |
|
3979 | 3979 | $file = array(); |
3980 | 3980 | |
3981 | - if ( $csv_file && $wp_filesystem->is_file( $target_path ) && $wp_filesystem->exists( $target_path ) ) { |
|
3982 | - $wp_filetype = wp_check_filetype_and_ext( $target_path, $csv_filename ); |
|
3981 | + if ($csv_file && $wp_filesystem->is_file($target_path) && $wp_filesystem->exists($target_path)) { |
|
3982 | + $wp_filetype = wp_check_filetype_and_ext($target_path, $csv_filename); |
|
3983 | 3983 | |
3984 | 3984 | if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') { |
3985 | 3985 | $json['error'] = NULL; |
3986 | 3986 | $json['rows'] = 0; |
3987 | 3987 | |
3988 | - if ( ( $handle = fopen($target_path, "r" ) ) !== FALSE ) { |
|
3989 | - while ( ( $data = fgetcsv( $handle, 100000, "," ) ) !== FALSE ) { |
|
3990 | - if ( !empty( $data ) ) { |
|
3988 | + if (($handle = fopen($target_path, "r")) !== FALSE) { |
|
3989 | + while (($data = fgetcsv($handle, 100000, ",")) !== FALSE) { |
|
3990 | + if (!empty($data)) { |
|
3991 | 3991 | $file[] = $data; |
3992 | 3992 | } |
3993 | 3993 | } |
@@ -4000,19 +4000,19 @@ discard block |
||
4000 | 4000 | $json['error'] = __('No data found in csv file.', 'geodirectory'); |
4001 | 4001 | } |
4002 | 4002 | } else { |
4003 | - wp_send_json( $json ); |
|
4003 | + wp_send_json($json); |
|
4004 | 4004 | } |
4005 | 4005 | } else { |
4006 | - wp_send_json( $json ); |
|
4006 | + wp_send_json($json); |
|
4007 | 4007 | } |
4008 | 4008 | |
4009 | - if ( $task == 'prepare_import' || !empty( $json['error'] ) ) { |
|
4010 | - wp_send_json( $json ); |
|
4009 | + if ($task == 'prepare_import' || !empty($json['error'])) { |
|
4010 | + wp_send_json($json); |
|
4011 | 4011 | } |
4012 | 4012 | |
4013 | 4013 | $total = $json['rows']; |
4014 | - $limit = isset($_POST['limit']) ? (int)$_POST['limit'] : 1; |
|
4015 | - $processed = isset($_POST['processed']) ? (int)$_POST['processed'] : 0; |
|
4014 | + $limit = isset($_POST['limit']) ? (int) $_POST['limit'] : 1; |
|
4015 | + $processed = isset($_POST['processed']) ? (int) $_POST['processed'] : 0; |
|
4016 | 4016 | |
4017 | 4017 | $count = $limit; |
4018 | 4018 | |
@@ -4037,13 +4037,13 @@ discard block |
||
4037 | 4037 | |
4038 | 4038 | $post_types = geodir_get_posttypes(); |
4039 | 4039 | |
4040 | - if ( $task == 'import_cat' ) { |
|
4040 | + if ($task == 'import_cat') { |
|
4041 | 4041 | if (!empty($file)) { |
4042 | 4042 | $columns = isset($file[0]) ? $file[0] : NULL; |
4043 | 4043 | |
4044 | 4044 | if (empty($columns) || (!empty($columns) && $columns[0] == '')) { |
4045 | 4045 | $json['error'] = CSV_INVAILD_FILE; |
4046 | - wp_send_json( $json ); |
|
4046 | + wp_send_json($json); |
|
4047 | 4047 | exit; |
4048 | 4048 | } |
4049 | 4049 | |
@@ -4052,7 +4052,7 @@ discard block |
||
4052 | 4052 | |
4053 | 4053 | if (isset($file[$index])) { |
4054 | 4054 | $row = $file[$index]; |
4055 | - $row = array_map( 'trim', $row ); |
|
4055 | + $row = array_map('trim', $row); |
|
4056 | 4056 | //$row = array_map( 'utf8_encode', $row ); |
4057 | 4057 | |
4058 | 4058 | $cat_id = ''; |
@@ -4069,41 +4069,41 @@ discard block |
||
4069 | 4069 | $cat_id_original = ''; |
4070 | 4070 | |
4071 | 4071 | $c = 0; |
4072 | - foreach ($columns as $column ) { |
|
4073 | - if ( $column == 'cat_id' ) { |
|
4074 | - $cat_id = (int)$row[$c]; |
|
4075 | - } else if ( $column == 'cat_name' ) { |
|
4072 | + foreach ($columns as $column) { |
|
4073 | + if ($column == 'cat_id') { |
|
4074 | + $cat_id = (int) $row[$c]; |
|
4075 | + } else if ($column == 'cat_name') { |
|
4076 | 4076 | $cat_name = $row[$c]; |
4077 | - } else if ( $column == 'cat_slug' ) { |
|
4077 | + } else if ($column == 'cat_slug') { |
|
4078 | 4078 | $cat_slug = $row[$c]; |
4079 | - } else if ( $column == 'cat_posttype' ) { |
|
4079 | + } else if ($column == 'cat_posttype') { |
|
4080 | 4080 | $cat_posttype = $row[$c]; |
4081 | - } else if ( $column == 'cat_parent' ) { |
|
4081 | + } else if ($column == 'cat_parent') { |
|
4082 | 4082 | $cat_parent = trim($row[$c]); |
4083 | - } else if ( $column == 'cat_schema' && $row[$c] != '' ) { |
|
4083 | + } else if ($column == 'cat_schema' && $row[$c] != '') { |
|
4084 | 4084 | $cat_schema = $row[$c]; |
4085 | - } else if ( $column == 'cat_description' ) { |
|
4085 | + } else if ($column == 'cat_description') { |
|
4086 | 4086 | $cat_description = $row[$c]; |
4087 | - } else if ( $column == 'cat_top_description' ) { |
|
4087 | + } else if ($column == 'cat_top_description') { |
|
4088 | 4088 | $cat_top_description = $row[$c]; |
4089 | - } else if ( $column == 'cat_image' ) { |
|
4089 | + } else if ($column == 'cat_image') { |
|
4090 | 4090 | $cat_image = $row[$c]; |
4091 | - } else if ( $column == 'cat_icon' ) { |
|
4091 | + } else if ($column == 'cat_icon') { |
|
4092 | 4092 | $cat_icon = $row[$c]; |
4093 | 4093 | } |
4094 | 4094 | // WPML |
4095 | - if ( $is_wpml ) { |
|
4096 | - if ( $column == 'cat_language' ) { |
|
4097 | - $cat_language = geodir_strtolower( trim( $row[$c] ) ); |
|
4098 | - } else if ( $column == 'cat_id_original' ) { |
|
4099 | - $cat_id_original = (int)$row[$c]; |
|
4095 | + if ($is_wpml) { |
|
4096 | + if ($column == 'cat_language') { |
|
4097 | + $cat_language = geodir_strtolower(trim($row[$c])); |
|
4098 | + } else if ($column == 'cat_id_original') { |
|
4099 | + $cat_id_original = (int) $row[$c]; |
|
4100 | 4100 | } |
4101 | 4101 | } |
4102 | 4102 | // WPML |
4103 | 4103 | $c++; |
4104 | 4104 | } |
4105 | 4105 | |
4106 | - if ( $cat_name == '' || !in_array( $cat_posttype, $post_types ) ) { |
|
4106 | + if ($cat_name == '' || !in_array($cat_posttype, $post_types)) { |
|
4107 | 4107 | $invalid++; |
4108 | 4108 | continue; |
4109 | 4109 | } |
@@ -4120,24 +4120,24 @@ discard block |
||
4120 | 4120 | $term_data['description'] = $cat_description; |
4121 | 4121 | $term_data['cat_schema'] = $cat_schema; |
4122 | 4122 | $term_data['top_description'] = $cat_top_description; |
4123 | - $term_data['image'] = $cat_image != '' ? basename( $cat_image ) : ''; |
|
4124 | - $term_data['icon'] = $cat_icon != '' ? basename( $cat_icon ) : ''; |
|
4123 | + $term_data['image'] = $cat_image != '' ? basename($cat_image) : ''; |
|
4124 | + $term_data['icon'] = $cat_icon != '' ? basename($cat_icon) : ''; |
|
4125 | 4125 | |
4126 | 4126 | //$term_data = array_map( 'utf8_encode', $term_data ); |
4127 | 4127 | |
4128 | - $taxonomy = $cat_posttype . 'category'; |
|
4128 | + $taxonomy = $cat_posttype.'category'; |
|
4129 | 4129 | |
4130 | 4130 | $term_data['taxonomy'] = $taxonomy; |
4131 | 4131 | |
4132 | 4132 | $term_parent_id = 0; |
4133 | - if ($cat_parent != "" || (int)$cat_parent > 0) { |
|
4133 | + if ($cat_parent != "" || (int) $cat_parent > 0) { |
|
4134 | 4134 | $term_parent = ''; |
4135 | 4135 | |
4136 | - if ( $term_parent = get_term_by( 'name', $cat_parent, $taxonomy ) ) { |
|
4136 | + if ($term_parent = get_term_by('name', $cat_parent, $taxonomy)) { |
|
4137 | 4137 | // |
4138 | - } else if ( $term_parent = get_term_by( 'slug', $cat_parent, $taxonomy ) ) { |
|
4138 | + } else if ($term_parent = get_term_by('slug', $cat_parent, $taxonomy)) { |
|
4139 | 4139 | // |
4140 | - } else if ( $term_parent = get_term_by( 'id', $cat_parent, $taxonomy ) ) { |
|
4140 | + } else if ($term_parent = get_term_by('id', $cat_parent, $taxonomy)) { |
|
4141 | 4141 | // |
4142 | 4142 | } else { |
4143 | 4143 | $term_parent_data = array(); |
@@ -4145,47 +4145,47 @@ discard block |
||
4145 | 4145 | //$term_parent_data = array_map( 'utf8_encode', $term_parent_data ); |
4146 | 4146 | $term_parent_data['taxonomy'] = $taxonomy; |
4147 | 4147 | |
4148 | - $term_parent_id = (int)geodir_imex_insert_term( $taxonomy, $term_parent_data ); |
|
4148 | + $term_parent_id = (int) geodir_imex_insert_term($taxonomy, $term_parent_data); |
|
4149 | 4149 | } |
4150 | 4150 | |
4151 | - if ( !empty( $term_parent ) && !is_wp_error( $term_parent ) ) { |
|
4152 | - $term_parent_id = (int)$term_parent->term_id; |
|
4151 | + if (!empty($term_parent) && !is_wp_error($term_parent)) { |
|
4152 | + $term_parent_id = (int) $term_parent->term_id; |
|
4153 | 4153 | } |
4154 | 4154 | } |
4155 | - $term_data['parent'] = (int)$term_parent_id; |
|
4155 | + $term_data['parent'] = (int) $term_parent_id; |
|
4156 | 4156 | |
4157 | 4157 | $term_id = NULL; |
4158 | - if ( $import_choice == 'update' ) { |
|
4159 | - if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) { |
|
4158 | + if ($import_choice == 'update') { |
|
4159 | + if ($cat_id > 0 && $term = (array) term_exists($cat_id, $taxonomy)) { |
|
4160 | 4160 | $term_data['term_id'] = $term['term_id']; |
4161 | 4161 | |
4162 | - if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) { |
|
4162 | + if ($term_id = geodir_imex_update_term($taxonomy, $term_data)) { |
|
4163 | 4163 | $updated++; |
4164 | 4164 | } else { |
4165 | 4165 | $invalid++; |
4166 | 4166 | } |
4167 | - } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) { |
|
4167 | + } else if ($term_data['slug'] != '' && $term = (array) term_exists($term_data['slug'], $taxonomy)) { |
|
4168 | 4168 | $term_data['term_id'] = $term['term_id']; |
4169 | 4169 | |
4170 | - if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) { |
|
4170 | + if ($term_id = geodir_imex_update_term($taxonomy, $term_data)) { |
|
4171 | 4171 | $updated++; |
4172 | 4172 | } else { |
4173 | 4173 | $invalid++; |
4174 | 4174 | } |
4175 | 4175 | } else { |
4176 | - if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) { |
|
4176 | + if ($term_id = geodir_imex_insert_term($taxonomy, $term_data)) { |
|
4177 | 4177 | $created++; |
4178 | 4178 | } else { |
4179 | 4179 | $invalid++; |
4180 | 4180 | } |
4181 | 4181 | } |
4182 | - } else if ( $import_choice == 'skip' ) { |
|
4183 | - if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) { |
|
4182 | + } else if ($import_choice == 'skip') { |
|
4183 | + if ($cat_id > 0 && $term = (array) term_exists($cat_id, $taxonomy)) { |
|
4184 | 4184 | $skipped++; |
4185 | - } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) { |
|
4185 | + } else if ($term_data['slug'] != '' && $term = (array) term_exists($term_data['slug'], $taxonomy)) { |
|
4186 | 4186 | $skipped++; |
4187 | 4187 | } else { |
4188 | - if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) { |
|
4188 | + if ($term_id = geodir_imex_insert_term($taxonomy, $term_data)) { |
|
4189 | 4189 | $created++; |
4190 | 4190 | } else { |
4191 | 4191 | $invalid++; |
@@ -4195,49 +4195,49 @@ discard block |
||
4195 | 4195 | $invalid++; |
4196 | 4196 | } |
4197 | 4197 | |
4198 | - if ( $term_id ) { |
|
4198 | + if ($term_id) { |
|
4199 | 4199 | // WPML |
4200 | 4200 | if ($is_wpml && $cat_id_original > 0 && $cat_language != '') { |
4201 | - $wpml_element_type = 'tax_' . $taxonomy; |
|
4202 | - $source_language = geodir_get_language_for_element( $cat_id_original, $wpml_element_type ); |
|
4201 | + $wpml_element_type = 'tax_'.$taxonomy; |
|
4202 | + $source_language = geodir_get_language_for_element($cat_id_original, $wpml_element_type); |
|
4203 | 4203 | $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language(); |
4204 | 4204 | |
4205 | - $trid = $sitepress->get_element_trid( $cat_id_original, $wpml_element_type ); |
|
4205 | + $trid = $sitepress->get_element_trid($cat_id_original, $wpml_element_type); |
|
4206 | 4206 | |
4207 | - $sitepress->set_element_language_details( $term_id, $wpml_element_type, $trid, $cat_language, $source_language ); |
|
4207 | + $sitepress->set_element_language_details($term_id, $wpml_element_type, $trid, $cat_language, $source_language); |
|
4208 | 4208 | } |
4209 | 4209 | // WPML |
4210 | 4210 | |
4211 | - if ( isset( $term_data['top_description'] ) ) { |
|
4212 | - update_tax_meta( $term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype ); |
|
4211 | + if (isset($term_data['top_description'])) { |
|
4212 | + update_tax_meta($term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype); |
|
4213 | 4213 | } |
4214 | 4214 | |
4215 | - if ( isset( $term_data['cat_schema'] ) ) { |
|
4216 | - update_tax_meta( $term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype ); |
|
4215 | + if (isset($term_data['cat_schema'])) { |
|
4216 | + update_tax_meta($term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype); |
|
4217 | 4217 | } |
4218 | 4218 | |
4219 | 4219 | $attachment = false; |
4220 | - if ( isset( $term_data['image'] ) && $term_data['image'] != '' ) { |
|
4221 | - $cat_image = geodir_get_default_catimage( $term_id, $cat_posttype ); |
|
4222 | - $cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : ''; |
|
4220 | + if (isset($term_data['image']) && $term_data['image'] != '') { |
|
4221 | + $cat_image = geodir_get_default_catimage($term_id, $cat_posttype); |
|
4222 | + $cat_image = !empty($cat_image) && isset($cat_image['src']) ? $cat_image['src'] : ''; |
|
4223 | 4223 | |
4224 | - if ( basename($cat_image) != $term_data['image'] ) { |
|
4224 | + if (basename($cat_image) != $term_data['image']) { |
|
4225 | 4225 | $attachment = true; |
4226 | - update_tax_meta( $term_id, 'ct_cat_default_img', array( 'id' => 'image', 'src' => $uploads['url'] . '/' . $term_data['image'] ), $cat_posttype ); |
|
4226 | + update_tax_meta($term_id, 'ct_cat_default_img', array('id' => 'image', 'src' => $uploads['url'].'/'.$term_data['image']), $cat_posttype); |
|
4227 | 4227 | } |
4228 | 4228 | } |
4229 | 4229 | |
4230 | - if ( isset( $term_data['icon'] ) && $term_data['icon'] != '' ) { |
|
4231 | - $cat_icon = get_tax_meta( $term_id, 'ct_cat_icon', false, $cat_posttype ); |
|
4232 | - $cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : ''; |
|
4230 | + if (isset($term_data['icon']) && $term_data['icon'] != '') { |
|
4231 | + $cat_icon = get_tax_meta($term_id, 'ct_cat_icon', false, $cat_posttype); |
|
4232 | + $cat_icon = !empty($cat_icon) && isset($cat_icon['src']) ? $cat_icon['src'] : ''; |
|
4233 | 4233 | |
4234 | - if ( basename($cat_icon) != $term_data['icon'] ) { |
|
4234 | + if (basename($cat_icon) != $term_data['icon']) { |
|
4235 | 4235 | $attachment = true; |
4236 | - update_tax_meta( $term_id, 'ct_cat_icon', array( 'id' => 'icon', 'src' => $uploads['url'] . '/' . $term_data['icon'] ), $cat_posttype ); |
|
4236 | + update_tax_meta($term_id, 'ct_cat_icon', array('id' => 'icon', 'src' => $uploads['url'].'/'.$term_data['icon']), $cat_posttype); |
|
4237 | 4237 | } |
4238 | 4238 | } |
4239 | 4239 | |
4240 | - if ( $attachment ) { |
|
4240 | + if ($attachment) { |
|
4241 | 4241 | $images++; |
4242 | 4242 | } |
4243 | 4243 | } |
@@ -4259,14 +4259,14 @@ discard block |
||
4259 | 4259 | $json['invalid'] = $invalid; |
4260 | 4260 | $json['images'] = $images; |
4261 | 4261 | |
4262 | - wp_send_json( $json ); |
|
4262 | + wp_send_json($json); |
|
4263 | 4263 | exit; |
4264 | - } else if ( $task == 'import_post' ) { |
|
4264 | + } else if ($task == 'import_post') { |
|
4265 | 4265 | |
4266 | 4266 | //run some stuff to make the import quicker |
4267 | - wp_defer_term_counting( true ); |
|
4268 | - wp_defer_comment_counting( true ); |
|
4269 | - $wpdb->query( 'SET autocommit = 0;' ); |
|
4267 | + wp_defer_term_counting(true); |
|
4268 | + wp_defer_comment_counting(true); |
|
4269 | + $wpdb->query('SET autocommit = 0;'); |
|
4270 | 4270 | |
4271 | 4271 | //remove_all_actions('publish_post'); |
4272 | 4272 | //remove_all_actions('transition_post_status'); |
@@ -4275,26 +4275,26 @@ discard block |
||
4275 | 4275 | if (!empty($file)) { |
4276 | 4276 | $wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses. |
4277 | 4277 | $default_status = 'publish'; |
4278 | - $current_date = date_i18n( 'Y-m-d', time() ); |
|
4278 | + $current_date = date_i18n('Y-m-d', time()); |
|
4279 | 4279 | |
4280 | 4280 | $columns = isset($file[0]) ? $file[0] : NULL; |
4281 | 4281 | |
4282 | 4282 | if (empty($columns) || (!empty($columns) && $columns[0] == '')) { |
4283 | 4283 | $json['error'] = CSV_INVAILD_FILE; |
4284 | - wp_send_json( $json ); |
|
4284 | + wp_send_json($json); |
|
4285 | 4285 | exit; |
4286 | 4286 | } |
4287 | 4287 | |
4288 | - $processed_actual=0; |
|
4288 | + $processed_actual = 0; |
|
4289 | 4289 | for ($i = 1; $i <= $limit; $i++) { |
4290 | 4290 | $index = $processed + $i; |
4291 | 4291 | $gd_post = array(); |
4292 | 4292 | |
4293 | 4293 | if (isset($file[$index])) {$processed_actual++; |
4294 | 4294 | $row = $file[$index]; |
4295 | - $row = array_map( 'trim', $row ); |
|
4295 | + $row = array_map('trim', $row); |
|
4296 | 4296 | //$row = array_map( 'utf8_encode', $row ); |
4297 | - $row = array_map( 'addslashes_gpc', $row ); |
|
4297 | + $row = array_map('addslashes_gpc', $row); |
|
4298 | 4298 | |
4299 | 4299 | $post_id = ''; |
4300 | 4300 | $post_title = ''; |
@@ -4331,80 +4331,80 @@ discard block |
||
4331 | 4331 | $original_post_id = ''; |
4332 | 4332 | |
4333 | 4333 | $c = 0; |
4334 | - foreach ($columns as $column ) { |
|
4334 | + foreach ($columns as $column) { |
|
4335 | 4335 | $gd_post[$column] = $row[$c]; |
4336 | 4336 | |
4337 | - if ( $column == 'post_id' ) { |
|
4337 | + if ($column == 'post_id') { |
|
4338 | 4338 | $post_id = $row[$c]; |
4339 | - } else if ( $column == 'post_title' ) { |
|
4339 | + } else if ($column == 'post_title') { |
|
4340 | 4340 | $post_title = sanitize_text_field($row[$c]); |
4341 | - } else if ( $column == 'post_author' ) { |
|
4341 | + } else if ($column == 'post_author') { |
|
4342 | 4342 | $post_author = $row[$c]; |
4343 | - } else if ( $column == 'post_content' ) { |
|
4343 | + } else if ($column == 'post_content') { |
|
4344 | 4344 | $post_content = $row[$c]; |
4345 | - } else if ( $column == 'post_category' && $row[$c] != '' ) { |
|
4346 | - $post_category_arr = explode( ',', $row[$c] ); |
|
4347 | - } else if ( $column == 'default_category' ) { |
|
4345 | + } else if ($column == 'post_category' && $row[$c] != '') { |
|
4346 | + $post_category_arr = explode(',', $row[$c]); |
|
4347 | + } else if ($column == 'default_category') { |
|
4348 | 4348 | $default_category = wp_kses_normalize_entities($row[$c]); |
4349 | - } else if ( $column == 'post_tags' && $row[$c] != '' ) { |
|
4350 | - $post_tags = explode( ',', $row[$c] ); |
|
4351 | - } else if ( $column == 'post_type' ) { |
|
4349 | + } else if ($column == 'post_tags' && $row[$c] != '') { |
|
4350 | + $post_tags = explode(',', $row[$c]); |
|
4351 | + } else if ($column == 'post_type') { |
|
4352 | 4352 | $post_type = $row[$c]; |
4353 | - } else if ( $column == 'post_status' ) { |
|
4354 | - $post_status = sanitize_key( $row[$c] ); |
|
4355 | - } else if ( $column == 'is_featured' ) { |
|
4356 | - $is_featured = (int)$row[$c]; |
|
4357 | - } else if ( $column == 'geodir_video' ) { |
|
4353 | + } else if ($column == 'post_status') { |
|
4354 | + $post_status = sanitize_key($row[$c]); |
|
4355 | + } else if ($column == 'is_featured') { |
|
4356 | + $is_featured = (int) $row[$c]; |
|
4357 | + } else if ($column == 'geodir_video') { |
|
4358 | 4358 | $geodir_video = $row[$c]; |
4359 | - } else if ( $column == 'post_address' ) { |
|
4359 | + } else if ($column == 'post_address') { |
|
4360 | 4360 | $post_address = $row[$c]; |
4361 | - } else if ( $column == 'post_city' ) { |
|
4361 | + } else if ($column == 'post_city') { |
|
4362 | 4362 | $post_city = $row[$c]; |
4363 | - } else if ( $column == 'post_region' ) { |
|
4363 | + } else if ($column == 'post_region') { |
|
4364 | 4364 | $post_region = $row[$c]; |
4365 | - } else if ( $column == 'post_country' ) { |
|
4365 | + } else if ($column == 'post_country') { |
|
4366 | 4366 | $post_country = $row[$c]; |
4367 | - } else if ( $column == 'post_zip' ) { |
|
4367 | + } else if ($column == 'post_zip') { |
|
4368 | 4368 | $post_zip = $row[$c]; |
4369 | - } else if ( $column == 'post_latitude' ) { |
|
4369 | + } else if ($column == 'post_latitude') { |
|
4370 | 4370 | $post_latitude = $row[$c]; |
4371 | - } else if ( $column == 'post_longitude' ) { |
|
4371 | + } else if ($column == 'post_longitude') { |
|
4372 | 4372 | $post_longitude = $row[$c]; |
4373 | - } else if ( $column == 'post_neighbourhood' ) { |
|
4373 | + } else if ($column == 'post_neighbourhood') { |
|
4374 | 4374 | $post_neighbourhood = $row[$c]; |
4375 | 4375 | unset($gd_post[$column]); |
4376 | - } else if ( $column == 'neighbourhood_latitude' ) { |
|
4376 | + } else if ($column == 'neighbourhood_latitude') { |
|
4377 | 4377 | $neighbourhood_latitude = $row[$c]; |
4378 | - } else if ( $column == 'neighbourhood_longitude' ) { |
|
4378 | + } else if ($column == 'neighbourhood_longitude') { |
|
4379 | 4379 | $neighbourhood_longitude = $row[$c]; |
4380 | - } else if ( $column == 'geodir_timing' ) { |
|
4380 | + } else if ($column == 'geodir_timing') { |
|
4381 | 4381 | $geodir_timing = $row[$c]; |
4382 | - } else if ( $column == 'geodir_contact' ) { |
|
4382 | + } else if ($column == 'geodir_contact') { |
|
4383 | 4383 | $geodir_contact = $row[$c]; |
4384 | - } else if ( $column == 'geodir_email' ) { |
|
4384 | + } else if ($column == 'geodir_email') { |
|
4385 | 4385 | $geodir_email = $row[$c]; |
4386 | - } else if ( $column == 'geodir_website' ) { |
|
4386 | + } else if ($column == 'geodir_website') { |
|
4387 | 4387 | $geodir_website = $row[$c]; |
4388 | - } else if ( $column == 'geodir_twitter' ) { |
|
4388 | + } else if ($column == 'geodir_twitter') { |
|
4389 | 4389 | $geodir_twitter = $row[$c]; |
4390 | - } else if ( $column == 'geodir_facebook' ) { |
|
4390 | + } else if ($column == 'geodir_facebook') { |
|
4391 | 4391 | $geodir_facebook = $row[$c]; |
4392 | - } else if ( $column == 'geodir_twitter' ) { |
|
4392 | + } else if ($column == 'geodir_twitter') { |
|
4393 | 4393 | $geodir_twitter = $row[$c]; |
4394 | - } else if ( $column == 'IMAGE' && !empty( $row[$c] ) && $row[$c] != '' ) { |
|
4394 | + } else if ($column == 'IMAGE' && !empty($row[$c]) && $row[$c] != '') { |
|
4395 | 4395 | $post_images[] = $row[$c]; |
4396 | - } else if ( $column == 'alive_days' && (int)$row[$c] > 0 ) { |
|
4397 | - $expire_date = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$row[$c] . ' days' ) ); |
|
4398 | - } else if ( $column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never' ) { |
|
4396 | + } else if ($column == 'alive_days' && (int) $row[$c] > 0) { |
|
4397 | + $expire_date = date_i18n('Y-m-d', strtotime($current_date.'+'.(int) $row[$c].' days')); |
|
4398 | + } else if ($column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never') { |
|
4399 | 4399 | $row[$c] = str_replace('/', '-', $row[$c]); |
4400 | - $expire_date = date_i18n( 'Y-m-d', strtotime( $row[$c] ) ); |
|
4400 | + $expire_date = date_i18n('Y-m-d', strtotime($row[$c])); |
|
4401 | 4401 | } |
4402 | 4402 | // WPML |
4403 | 4403 | if ($is_wpml) { |
4404 | 4404 | if ($column == 'language') { |
4405 | 4405 | $language = geodir_strtolower(trim($row[$c])); |
4406 | 4406 | } else if ($column == 'original_post_id') { |
4407 | - $original_post_id = (int)$row[$c]; |
|
4407 | + $original_post_id = (int) $row[$c]; |
|
4408 | 4408 | } |
4409 | 4409 | } |
4410 | 4410 | // WPML |
@@ -4419,40 +4419,40 @@ discard block |
||
4419 | 4419 | |
4420 | 4420 | $gd_post['IMAGE'] = $post_images; |
4421 | 4421 | |
4422 | - $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status; |
|
4423 | - $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status; |
|
4422 | + $post_status = !empty($post_status) ? sanitize_key($post_status) : $default_status; |
|
4423 | + $post_status = !empty($wp_post_statuses) && !isset($wp_post_statuses[$post_status]) ? $default_status : $post_status; |
|
4424 | 4424 | |
4425 | 4425 | $valid = true; |
4426 | 4426 | |
4427 | - if ( $post_title == '' || !in_array( $post_type, $post_types ) ) { |
|
4427 | + if ($post_title == '' || !in_array($post_type, $post_types)) { |
|
4428 | 4428 | $invalid++; |
4429 | 4429 | $valid = false; |
4430 | 4430 | } |
4431 | 4431 | |
4432 | - $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true; |
|
4433 | - if ( $location_allowed ) { |
|
4432 | + $location_allowed = function_exists('geodir_cpt_no_location') && geodir_cpt_no_location($post_type) ? false : true; |
|
4433 | + if ($location_allowed) { |
|
4434 | 4434 | $location_result = geodir_get_default_location(); |
4435 | - if ( $post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '' ) { |
|
4435 | + if ($post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '') { |
|
4436 | 4436 | $invalid_addr++; |
4437 | 4437 | $valid = false; |
4438 | - } else if ( !empty( $location_result ) && $location_result->location_id == 0 ) { |
|
4439 | - 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 ) ) ) { |
|
4438 | + } else if (!empty($location_result) && $location_result->location_id == 0) { |
|
4439 | + 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))) { |
|
4440 | 4440 | $invalid_addr++; |
4441 | 4441 | $valid = false; |
4442 | 4442 | } else { |
4443 | 4443 | if (!$location_manager) { |
4444 | - $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. |
|
4444 | + $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. |
|
4445 | 4445 | } |
4446 | 4446 | } |
4447 | 4447 | } |
4448 | 4448 | } |
4449 | 4449 | |
4450 | - if ( !$valid ) { |
|
4450 | + if (!$valid) { |
|
4451 | 4451 | continue; |
4452 | 4452 | } |
4453 | 4453 | |
4454 | - $cat_taxonomy = $post_type . 'category'; |
|
4455 | - $tags_taxonomy = $post_type . '_tags'; |
|
4454 | + $cat_taxonomy = $post_type.'category'; |
|
4455 | + $tags_taxonomy = $post_type.'_tags'; |
|
4456 | 4456 | |
4457 | 4457 | if ($default_category != '' && !in_array($default_category, $post_category_arr)) { |
4458 | 4458 | $post_category_arr = array_merge(array($default_category), $post_category_arr); |
@@ -4460,29 +4460,29 @@ discard block |
||
4460 | 4460 | |
4461 | 4461 | $post_category = array(); |
4462 | 4462 | $default_category_id = NULL; |
4463 | - if ( !empty( $post_category_arr ) ) { |
|
4464 | - foreach ( $post_category_arr as $value ) { |
|
4465 | - $category_name = wp_kses_normalize_entities( trim( $value ) ); |
|
4463 | + if (!empty($post_category_arr)) { |
|
4464 | + foreach ($post_category_arr as $value) { |
|
4465 | + $category_name = wp_kses_normalize_entities(trim($value)); |
|
4466 | 4466 | |
4467 | - if ( $category_name != '' ) { |
|
4467 | + if ($category_name != '') { |
|
4468 | 4468 | $term_category = array(); |
4469 | 4469 | |
4470 | - if ( $term = get_term_by( 'name', $category_name, $cat_taxonomy ) ) { |
|
4470 | + if ($term = get_term_by('name', $category_name, $cat_taxonomy)) { |
|
4471 | 4471 | $term_category = $term; |
4472 | - } else if ( $term = get_term_by( 'slug', $category_name, $cat_taxonomy ) ) { |
|
4472 | + } else if ($term = get_term_by('slug', $category_name, $cat_taxonomy)) { |
|
4473 | 4473 | $term_category = $term; |
4474 | 4474 | } else { |
4475 | 4475 | $term_data = array(); |
4476 | 4476 | $term_data['name'] = $category_name; |
4477 | 4477 | $term_data['taxonomy'] = $cat_taxonomy; |
4478 | 4478 | |
4479 | - $term_id = geodir_imex_insert_term( $cat_taxonomy, $term_data ); |
|
4480 | - if ( $term_id ) { |
|
4481 | - $term_category = get_term( $term_id, $cat_taxonomy ); |
|
4479 | + $term_id = geodir_imex_insert_term($cat_taxonomy, $term_data); |
|
4480 | + if ($term_id) { |
|
4481 | + $term_category = get_term($term_id, $cat_taxonomy); |
|
4482 | 4482 | } |
4483 | 4483 | } |
4484 | 4484 | |
4485 | - if ( !empty( $term_category ) && !is_wp_error( $term_category ) ) { |
|
4485 | + if (!empty($term_category) && !is_wp_error($term_category)) { |
|
4486 | 4486 | $post_category[] = intval($term_category->term_id); |
4487 | 4487 | |
4488 | 4488 | if ($category_name == $default_category) { |
@@ -4503,28 +4503,28 @@ discard block |
||
4503 | 4503 | $save_post['post_tags'] = $post_tags; |
4504 | 4504 | |
4505 | 4505 | $saved_post_id = NULL; |
4506 | - if ( $import_choice == 'update' ) { |
|
4507 | - if ( $post_id > 0 && get_post( $post_id ) ) { |
|
4506 | + if ($import_choice == 'update') { |
|
4507 | + if ($post_id > 0 && get_post($post_id)) { |
|
4508 | 4508 | $save_post['ID'] = $post_id; |
4509 | 4509 | |
4510 | - if ( wp_update_post( $save_post ) ) { |
|
4510 | + if (wp_update_post($save_post)) { |
|
4511 | 4511 | $saved_post_id = $post_id; |
4512 | 4512 | $updated++; |
4513 | 4513 | } |
4514 | 4514 | } else { |
4515 | - if ( $saved_post_id = wp_insert_post( $save_post ) ) { |
|
4515 | + if ($saved_post_id = wp_insert_post($save_post)) { |
|
4516 | 4516 | $created++; |
4517 | 4517 | } |
4518 | 4518 | } |
4519 | 4519 | |
4520 | - if ( !$saved_post_id > 0 ) { |
|
4520 | + if (!$saved_post_id > 0) { |
|
4521 | 4521 | $invalid++; |
4522 | 4522 | } |
4523 | - } else if ( $import_choice == 'skip' ) { |
|
4524 | - if ( $post_id > 0 && get_post( $post_id ) ) { |
|
4523 | + } else if ($import_choice == 'skip') { |
|
4524 | + if ($post_id > 0 && get_post($post_id)) { |
|
4525 | 4525 | $skipped++; |
4526 | 4526 | } else { |
4527 | - if ( $saved_post_id = wp_insert_post( $save_post ) ) { |
|
4527 | + if ($saved_post_id = wp_insert_post($save_post)) { |
|
4528 | 4528 | $created++; |
4529 | 4529 | } else { |
4530 | 4530 | $invalid++; |
@@ -4534,19 +4534,19 @@ discard block |
||
4534 | 4534 | $invalid++; |
4535 | 4535 | } |
4536 | 4536 | |
4537 | - if ( (int)$saved_post_id > 0 ) { |
|
4537 | + if ((int) $saved_post_id > 0) { |
|
4538 | 4538 | // WPML |
4539 | 4539 | if ($is_wpml && $original_post_id > 0 && $language != '') { |
4540 | - $wpml_post_type = 'post_' . $post_type; |
|
4541 | - $source_language = geodir_get_language_for_element( $original_post_id, $wpml_post_type ); |
|
4540 | + $wpml_post_type = 'post_'.$post_type; |
|
4541 | + $source_language = geodir_get_language_for_element($original_post_id, $wpml_post_type); |
|
4542 | 4542 | $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language(); |
4543 | 4543 | |
4544 | - $trid = $sitepress->get_element_trid( $original_post_id, $wpml_post_type ); |
|
4544 | + $trid = $sitepress->get_element_trid($original_post_id, $wpml_post_type); |
|
4545 | 4545 | |
4546 | - $sitepress->set_element_language_details( $saved_post_id, $wpml_post_type, $trid, $language, $source_language ); |
|
4546 | + $sitepress->set_element_language_details($saved_post_id, $wpml_post_type, $trid, $language, $source_language); |
|
4547 | 4547 | } |
4548 | 4548 | // WPML |
4549 | - $gd_post_info = geodir_get_post_info( $saved_post_id ); |
|
4549 | + $gd_post_info = geodir_get_post_info($saved_post_id); |
|
4550 | 4550 | |
4551 | 4551 | $gd_post['post_id'] = $saved_post_id; |
4552 | 4552 | $gd_post['ID'] = $saved_post_id; |
@@ -4558,7 +4558,7 @@ discard block |
||
4558 | 4558 | |
4559 | 4559 | // post location |
4560 | 4560 | $post_location_id = 0; |
4561 | - if ( $location_allowed && !empty( $location_result ) && $location_result->location_id > 0 ) { |
|
4561 | + if ($location_allowed && !empty($location_result) && $location_result->location_id > 0) { |
|
4562 | 4562 | $gd_post['post_neighbourhood'] = ''; |
4563 | 4563 | |
4564 | 4564 | $post_location_info = array( |
@@ -4568,7 +4568,7 @@ discard block |
||
4568 | 4568 | 'geo_lat' => $post_latitude, |
4569 | 4569 | 'geo_lng' => $post_longitude |
4570 | 4570 | ); |
4571 | - if ( $location_id = (int)geodir_add_new_location( $post_location_info ) ) { |
|
4571 | + if ($location_id = (int) geodir_add_new_location($post_location_info)) { |
|
4572 | 4572 | $post_location_id = $location_id; |
4573 | 4573 | } |
4574 | 4574 | |
@@ -4606,14 +4606,14 @@ discard block |
||
4606 | 4606 | $gd_post['post_location_id'] = $post_location_id; |
4607 | 4607 | |
4608 | 4608 | // post package info |
4609 | - $package_id = isset( $gd_post['package_id'] ) && !empty( $gd_post['package_id'] ) ? (int)$gd_post['package_id'] : 0; |
|
4609 | + $package_id = isset($gd_post['package_id']) && !empty($gd_post['package_id']) ? (int) $gd_post['package_id'] : 0; |
|
4610 | 4610 | if (!$package_id && !empty($gd_post_info) && isset($gd_post_info->package_id) && $gd_post_info->package_id) { |
4611 | 4611 | $package_id = $gd_post_info->package_id; |
4612 | 4612 | } |
4613 | 4613 | |
4614 | 4614 | $package_info = array(); |
4615 | 4615 | if ($package_id && function_exists('geodir_get_package_info_by_id')) { |
4616 | - $package_info = (array)geodir_get_package_info_by_id($package_id); |
|
4616 | + $package_info = (array) geodir_get_package_info_by_id($package_id); |
|
4617 | 4617 | |
4618 | 4618 | if (!(!empty($package_info) && isset($package_info['post_type']) && $package_info['post_type'] == $post_type)) { |
4619 | 4619 | $package_info = array(); |
@@ -4621,18 +4621,18 @@ discard block |
||
4621 | 4621 | } |
4622 | 4622 | |
4623 | 4623 | if (empty($package_info)) { |
4624 | - $package_info = (array)geodir_post_package_info( array(), '', $post_type ); |
|
4624 | + $package_info = (array) geodir_post_package_info(array(), '', $post_type); |
|
4625 | 4625 | } |
4626 | 4626 | |
4627 | - if (!empty($package_info)) { |
|
4627 | + if (!empty($package_info)) { |
|
4628 | 4628 | $package_id = $package_info['pid']; |
4629 | 4629 | |
4630 | 4630 | if (isset($gd_post['alive_days']) || isset($gd_post['expire_date'])) { |
4631 | 4631 | $gd_post['expire_date'] = $expire_date; |
4632 | 4632 | } else { |
4633 | - if ( isset( $package_info['days'] ) && (int)$package_info['days'] > 0 ) { |
|
4634 | - $gd_post['alive_days'] = (int)$package_info['days']; |
|
4635 | - $gd_post['expire_date'] = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$package_info['days'] . ' days' ) ); |
|
4633 | + if (isset($package_info['days']) && (int) $package_info['days'] > 0) { |
|
4634 | + $gd_post['alive_days'] = (int) $package_info['days']; |
|
4635 | + $gd_post['expire_date'] = date_i18n('Y-m-d', strtotime($current_date.'+'.(int) $package_info['days'].' days')); |
|
4636 | 4636 | } else { |
4637 | 4637 | $gd_post['expire_date'] = 'Never'; |
4638 | 4638 | } |
@@ -4641,7 +4641,7 @@ discard block |
||
4641 | 4641 | $gd_post['package_id'] = $package_id; |
4642 | 4642 | } |
4643 | 4643 | |
4644 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
4644 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
4645 | 4645 | |
4646 | 4646 | if ($post_type == 'gd_event') { |
4647 | 4647 | $gd_post = geodir_imex_process_event_data($gd_post); |
@@ -4652,28 +4652,28 @@ discard block |
||
4652 | 4652 | } |
4653 | 4653 | |
4654 | 4654 | // Export franchise fields |
4655 | - $is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false; |
|
4655 | + $is_franchise_active = is_plugin_active('geodir_franchise/geodir_franchise.php') && geodir_franchise_enabled($post_type) ? true : false; |
|
4656 | 4656 | if ($is_franchise_active) { |
4657 | - if ( isset( $gd_post['gd_is_franchise'] ) && (int)$gd_post['gd_is_franchise'] == 1 ) { |
|
4657 | + if (isset($gd_post['gd_is_franchise']) && (int) $gd_post['gd_is_franchise'] == 1) { |
|
4658 | 4658 | $gd_franchise_lock = array(); |
4659 | 4659 | |
4660 | - if ( isset( $gd_post['gd_franchise_lock'] ) ) { |
|
4661 | - $gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock'] ); |
|
4662 | - $gd_franchise_lock = trim( $gd_franchise_lock ); |
|
4663 | - $gd_franchise_lock = explode( ",", $gd_franchise_lock ); |
|
4660 | + if (isset($gd_post['gd_franchise_lock'])) { |
|
4661 | + $gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock']); |
|
4662 | + $gd_franchise_lock = trim($gd_franchise_lock); |
|
4663 | + $gd_franchise_lock = explode(",", $gd_franchise_lock); |
|
4664 | 4664 | } |
4665 | 4665 | |
4666 | - update_post_meta( $saved_post_id, 'gd_is_franchise', 1 ); |
|
4667 | - update_post_meta( $saved_post_id, 'gd_franchise_lock', $gd_franchise_lock ); |
|
4666 | + update_post_meta($saved_post_id, 'gd_is_franchise', 1); |
|
4667 | + update_post_meta($saved_post_id, 'gd_franchise_lock', $gd_franchise_lock); |
|
4668 | 4668 | } else { |
4669 | - if ( isset( $gd_post['franchise'] ) && (int)$gd_post['franchise'] > 0 && geodir_franchise_check( (int)$gd_post['franchise'] ) ) { |
|
4670 | - geodir_save_post_meta( $saved_post_id, 'franchise', (int)$gd_post['franchise'] ); |
|
4669 | + if (isset($gd_post['franchise']) && (int) $gd_post['franchise'] > 0 && geodir_franchise_check((int) $gd_post['franchise'])) { |
|
4670 | + geodir_save_post_meta($saved_post_id, 'franchise', (int) $gd_post['franchise']); |
|
4671 | 4671 | } |
4672 | 4672 | } |
4673 | 4673 | } |
4674 | 4674 | |
4675 | 4675 | if (!empty($save_post['post_category']) && is_array($save_post['post_category'])) { |
4676 | - $save_post['post_category'] = array_unique( array_map( 'intval', $save_post['post_category'] ) ); |
|
4676 | + $save_post['post_category'] = array_unique(array_map('intval', $save_post['post_category'])); |
|
4677 | 4677 | if ($default_category_id) { |
4678 | 4678 | $save_post['post_default_category'] = $default_category_id; |
4679 | 4679 | $gd_post['default_category'] = $default_category_id; |
@@ -4682,34 +4682,34 @@ discard block |
||
4682 | 4682 | } |
4683 | 4683 | |
4684 | 4684 | // Save post info |
4685 | - geodir_save_post_info( $saved_post_id, $gd_post ); |
|
4685 | + geodir_save_post_info($saved_post_id, $gd_post); |
|
4686 | 4686 | // post taxonomies |
4687 | - if ( !empty( $save_post['post_category'] ) ) { |
|
4688 | - wp_set_object_terms( $saved_post_id, $save_post['post_category'], $cat_taxonomy ); |
|
4687 | + if (!empty($save_post['post_category'])) { |
|
4688 | + wp_set_object_terms($saved_post_id, $save_post['post_category'], $cat_taxonomy); |
|
4689 | 4689 | |
4690 | - $post_default_category = isset( $save_post['post_default_category'] ) ? $save_post['post_default_category'] : ''; |
|
4690 | + $post_default_category = isset($save_post['post_default_category']) ? $save_post['post_default_category'] : ''; |
|
4691 | 4691 | if ($default_category_id) { |
4692 | 4692 | $post_default_category = $default_category_id; |
4693 | 4693 | } |
4694 | 4694 | $post_cat_ids = geodir_get_post_meta($saved_post_id, $cat_taxonomy); |
4695 | 4695 | $save_post['post_category'] = !empty($post_cat_ids) ? explode(",", trim($post_cat_ids, ",")) : $save_post['post_category']; |
4696 | - $post_category_str = !empty($save_post['post_category']) ? implode(",y:#", $save_post['post_category']) . ',y:' : ''; |
|
4696 | + $post_category_str = !empty($save_post['post_category']) ? implode(",y:#", $save_post['post_category']).',y:' : ''; |
|
4697 | 4697 | |
4698 | 4698 | if ($post_category_str != '' && $post_default_category) { |
4699 | - $post_category_str = str_replace($post_default_category . ',y:', $post_default_category . ',y,d:', $post_category_str); |
|
4699 | + $post_category_str = str_replace($post_default_category.',y:', $post_default_category.',y,d:', $post_category_str); |
|
4700 | 4700 | } |
4701 | 4701 | |
4702 | 4702 | $post_category_str = $post_category_str != '' ? array($cat_taxonomy => $post_category_str) : ''; |
4703 | 4703 | |
4704 | - geodir_set_postcat_structure( $saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str ); |
|
4704 | + geodir_set_postcat_structure($saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str); |
|
4705 | 4705 | } |
4706 | 4706 | |
4707 | - if ( !empty( $save_post['post_tags'] ) ) { |
|
4708 | - wp_set_object_terms( $saved_post_id, $save_post['post_tags'], $tags_taxonomy ); |
|
4707 | + if (!empty($save_post['post_tags'])) { |
|
4708 | + wp_set_object_terms($saved_post_id, $save_post['post_tags'], $tags_taxonomy); |
|
4709 | 4709 | } |
4710 | 4710 | |
4711 | 4711 | // Post images |
4712 | - if ( !empty( $post_images ) ) { |
|
4712 | + if (!empty($post_images)) { |
|
4713 | 4713 | $post_images = array_unique($post_images); |
4714 | 4714 | |
4715 | 4715 | $old_post_images_arr = array(); |
@@ -4717,82 +4717,82 @@ discard block |
||
4717 | 4717 | |
4718 | 4718 | $order = 1; |
4719 | 4719 | |
4720 | - $old_post_images = geodir_get_images( $saved_post_id ); |
|
4720 | + $old_post_images = geodir_get_images($saved_post_id); |
|
4721 | 4721 | if (!empty($old_post_images)) { |
4722 | - foreach( $old_post_images as $old_post_image ) { |
|
4722 | + foreach ($old_post_images as $old_post_image) { |
|
4723 | 4723 | if (!empty($old_post_image) && isset($old_post_image->file) && $old_post_image->file != '') { |
4724 | 4724 | $old_post_images_arr[] = $old_post_image->file; |
4725 | 4725 | } |
4726 | 4726 | } |
4727 | 4727 | } |
4728 | 4728 | |
4729 | - foreach ( $post_images as $post_image ) { |
|
4730 | - $image_name = basename( $post_image ); |
|
4729 | + foreach ($post_images as $post_image) { |
|
4730 | + $image_name = basename($post_image); |
|
4731 | 4731 | $saved_post_images_arr[] = $image_name; |
4732 | 4732 | |
4733 | - if (!empty($old_post_images_arr) && in_array( $image_name, $old_post_images_arr) ) { |
|
4733 | + if (!empty($old_post_images_arr) && in_array($image_name, $old_post_images_arr)) { |
|
4734 | 4734 | continue; // Skip if image already exists. |
4735 | 4735 | } |
4736 | 4736 | |
4737 | - $image_name_parts = explode( '.', $image_name ); |
|
4738 | - array_pop( $image_name_parts ); |
|
4739 | - $proper_image_name = implode( '.', $image_name_parts ); |
|
4737 | + $image_name_parts = explode('.', $image_name); |
|
4738 | + array_pop($image_name_parts); |
|
4739 | + $proper_image_name = implode('.', $image_name_parts); |
|
4740 | 4740 | |
4741 | - $arr_file_type = wp_check_filetype( $image_name ); |
|
4741 | + $arr_file_type = wp_check_filetype($image_name); |
|
4742 | 4742 | |
4743 | - if ( !empty( $arr_file_type ) ) { |
|
4743 | + if (!empty($arr_file_type)) { |
|
4744 | 4744 | $uploaded_file_type = $arr_file_type['type']; |
4745 | 4745 | |
4746 | 4746 | $attachment = array(); |
4747 | 4747 | $attachment['post_id'] = $saved_post_id; |
4748 | 4748 | $attachment['title'] = $proper_image_name; |
4749 | 4749 | $attachment['content'] = ''; |
4750 | - $attachment['file'] = $uploads_subdir . '/' . $image_name; |
|
4750 | + $attachment['file'] = $uploads_subdir.'/'.$image_name; |
|
4751 | 4751 | $attachment['mime_type'] = $uploaded_file_type; |
4752 | 4752 | $attachment['menu_order'] = $order; |
4753 | 4753 | $attachment['is_featured'] = 0; |
4754 | 4754 | |
4755 | 4755 | $attachment_set = ''; |
4756 | - foreach ( $attachment as $key => $val ) { |
|
4757 | - if ( $val != '' ) { |
|
4758 | - $attachment_set .= $key . " = '" . $val . "', "; |
|
4756 | + foreach ($attachment as $key => $val) { |
|
4757 | + if ($val != '') { |
|
4758 | + $attachment_set .= $key." = '".$val."', "; |
|
4759 | 4759 | } |
4760 | 4760 | } |
4761 | - $attachment_set = trim( $attachment_set, ", " ); |
|
4761 | + $attachment_set = trim($attachment_set, ", "); |
|
4762 | 4762 | |
4763 | 4763 | // Add new attachment |
4764 | - $wpdb->query( "INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set ); |
|
4764 | + $wpdb->query("INSERT INTO ".GEODIR_ATTACHMENT_TABLE." SET ".$attachment_set); |
|
4765 | 4765 | |
4766 | 4766 | $order++; |
4767 | 4767 | } |
4768 | 4768 | } |
4769 | 4769 | |
4770 | - $saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/" . implode("' AND file NOT LIKE '%/", $saved_post_images_arr) . "' )" : ''; |
|
4770 | + $saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/".implode("' AND file NOT LIKE '%/", $saved_post_images_arr)."' )" : ''; |
|
4771 | 4771 | // Remove previous attachment |
4772 | - $wpdb->query( "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = " . (int)$saved_post_id . " " . $saved_post_images_sql ); |
|
4772 | + $wpdb->query("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id = ".(int) $saved_post_id." ".$saved_post_images_sql); |
|
4773 | 4773 | |
4774 | - if ( !empty( $saved_post_images_arr ) ) { |
|
4774 | + if (!empty($saved_post_images_arr)) { |
|
4775 | 4775 | $menu_order = 1; |
4776 | 4776 | |
4777 | - foreach ( $saved_post_images_arr as $img_name ) { |
|
4778 | - $wpdb->query( $wpdb->prepare( "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order = %d WHERE post_id =%d AND file LIKE %s", array( $menu_order, $saved_post_id, '%/' . $img_name ) ) ); |
|
4777 | + foreach ($saved_post_images_arr as $img_name) { |
|
4778 | + $wpdb->query($wpdb->prepare("UPDATE ".GEODIR_ATTACHMENT_TABLE." SET menu_order = %d WHERE post_id =%d AND file LIKE %s", array($menu_order, $saved_post_id, '%/'.$img_name))); |
|
4779 | 4779 | |
4780 | - if( $menu_order == 1 ) { |
|
4781 | - if ( $featured_image = $wpdb->get_var( $wpdb->prepare( "SELECT file FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =%d AND file LIKE %s", array( $saved_post_id, '%/' . $img_name ) ) ) ) { |
|
4782 | - $wpdb->query( $wpdb->prepare( "UPDATE " . $table . " SET featured_image = %s WHERE post_id =%d", array( $featured_image, $saved_post_id ) ) ); |
|
4780 | + if ($menu_order == 1) { |
|
4781 | + if ($featured_image = $wpdb->get_var($wpdb->prepare("SELECT file FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id =%d AND file LIKE %s", array($saved_post_id, '%/'.$img_name)))) { |
|
4782 | + $wpdb->query($wpdb->prepare("UPDATE ".$table." SET featured_image = %s WHERE post_id =%d", array($featured_image, $saved_post_id))); |
|
4783 | 4783 | } |
4784 | 4784 | } |
4785 | 4785 | $menu_order++; |
4786 | 4786 | } |
4787 | 4787 | } |
4788 | 4788 | |
4789 | - if ( $order > 1 ) { |
|
4789 | + if ($order > 1) { |
|
4790 | 4790 | $images++; |
4791 | 4791 | } |
4792 | 4792 | } |
4793 | 4793 | |
4794 | 4794 | /** This action is documented in geodirectory-functions/post-functions.php */ |
4795 | - do_action( 'geodir_after_save_listing', $saved_post_id, $gd_post ); |
|
4795 | + do_action('geodir_after_save_listing', $saved_post_id, $gd_post); |
|
4796 | 4796 | |
4797 | 4797 | if (isset($is_featured)) { |
4798 | 4798 | geodir_save_post_meta($saved_post_id, 'is_featured', $is_featured); |
@@ -4812,10 +4812,10 @@ discard block |
||
4812 | 4812 | } |
4813 | 4813 | |
4814 | 4814 | //undo some stuff to make the import quicker |
4815 | - wp_defer_term_counting( false ); |
|
4816 | - wp_defer_comment_counting( false ); |
|
4817 | - $wpdb->query( 'COMMIT;' ); |
|
4818 | - $wpdb->query( 'SET autocommit = 1;' ); |
|
4815 | + wp_defer_term_counting(false); |
|
4816 | + wp_defer_comment_counting(false); |
|
4817 | + $wpdb->query('COMMIT;'); |
|
4818 | + $wpdb->query('SET autocommit = 1;'); |
|
4819 | 4819 | |
4820 | 4820 | $json = array(); |
4821 | 4821 | $json['processed'] = $processed_actual; |
@@ -4826,9 +4826,9 @@ discard block |
||
4826 | 4826 | $json['invalid_addr'] = $invalid_addr; |
4827 | 4827 | $json['images'] = $images; |
4828 | 4828 | |
4829 | - wp_send_json( $json ); |
|
4829 | + wp_send_json($json); |
|
4830 | 4830 | exit; |
4831 | - } else if ( $task == 'import_loc' ) { |
|
4831 | + } else if ($task == 'import_loc') { |
|
4832 | 4832 | global $gd_post_types; |
4833 | 4833 | $gd_post_types = $post_types; |
4834 | 4834 | |
@@ -4837,7 +4837,7 @@ discard block |
||
4837 | 4837 | |
4838 | 4838 | if (empty($columns) || (!empty($columns) && $columns[0] == '')) { |
4839 | 4839 | $json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory'); |
4840 | - wp_send_json( $json ); |
|
4840 | + wp_send_json($json); |
|
4841 | 4841 | } |
4842 | 4842 | |
4843 | 4843 | for ($i = 1; $i <= $limit; $i++) { |
@@ -4845,59 +4845,59 @@ discard block |
||
4845 | 4845 | |
4846 | 4846 | if (isset($file[$index])) { |
4847 | 4847 | $row = $file[$index]; |
4848 | - $row = array_map( 'trim', $row ); |
|
4848 | + $row = array_map('trim', $row); |
|
4849 | 4849 | $data = array(); |
4850 | 4850 | |
4851 | - foreach ($columns as $c => $column ) { |
|
4851 | + foreach ($columns as $c => $column) { |
|
4852 | 4852 | if (in_array($column, array('location_id', 'latitude', 'longitude', 'city', 'city_slug', 'region', 'country', 'city_meta', 'city_desc', 'region_meta', 'region_desc', 'country_meta', 'country_desc'))) { |
4853 | 4853 | $data[$column] = $row[$c]; |
4854 | 4854 | } |
4855 | 4855 | } |
4856 | 4856 | |
4857 | - if ( empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude']) ) { |
|
4857 | + if (empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude'])) { |
|
4858 | 4858 | $invalid++; |
4859 | 4859 | continue; |
4860 | 4860 | } |
4861 | 4861 | |
4862 | 4862 | $data['location_id'] = isset($data['location_id']) ? absint($data['location_id']) : 0; |
4863 | 4863 | |
4864 | - if ( $import_choice == 'update' ) { |
|
4865 | - if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) { |
|
4866 | - if ( $location_id = geodir_location_update_city( $data, true, $location ) ) { |
|
4864 | + if ($import_choice == 'update') { |
|
4865 | + if ((int) $data['location_id'] > 0 && $location = geodir_get_location_by_id('', (int) $data['location_id'])) { |
|
4866 | + if ($location_id = geodir_location_update_city($data, true, $location)) { |
|
4867 | 4867 | $updated++; |
4868 | 4868 | } else { |
4869 | 4869 | $invalid++; |
4870 | 4870 | } |
4871 | - } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) { |
|
4872 | - $data['location_id'] = (int)$location->location_id; |
|
4871 | + } else if (!empty($data['city_slug']) && $location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug']))) { |
|
4872 | + $data['location_id'] = (int) $location->location_id; |
|
4873 | 4873 | |
4874 | - if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region'] ) ) ) { |
|
4875 | - $data['location_id'] = (int)$location->location_id; |
|
4876 | - } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'region' => $data['region'] ) ) ) { |
|
4877 | - $data['location_id'] = (int)$location->location_id; |
|
4878 | - } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'] ) ) ) { |
|
4879 | - $data['location_id'] = (int)$location->location_id; |
|
4874 | + if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region']))) { |
|
4875 | + $data['location_id'] = (int) $location->location_id; |
|
4876 | + } else if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'region' => $data['region']))) { |
|
4877 | + $data['location_id'] = (int) $location->location_id; |
|
4878 | + } else if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'country' => $data['country']))) { |
|
4879 | + $data['location_id'] = (int) $location->location_id; |
|
4880 | 4880 | } |
4881 | 4881 | |
4882 | - if ( $location_id = geodir_location_update_city( $data, true, $location ) ) { |
|
4882 | + if ($location_id = geodir_location_update_city($data, true, $location)) { |
|
4883 | 4883 | $updated++; |
4884 | 4884 | } else { |
4885 | 4885 | $invalid++; |
4886 | 4886 | } |
4887 | 4887 | } else { |
4888 | - if ( $location_id = geodir_location_insert_city( $data, true ) ) { |
|
4888 | + if ($location_id = geodir_location_insert_city($data, true)) { |
|
4889 | 4889 | $created++; |
4890 | 4890 | } else { |
4891 | 4891 | $invalid++; |
4892 | 4892 | } |
4893 | 4893 | } |
4894 | - } elseif ( $import_choice == 'skip' ) { |
|
4895 | - if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) { |
|
4894 | + } elseif ($import_choice == 'skip') { |
|
4895 | + if ((int) $data['location_id'] > 0 && $location = geodir_get_location_by_id('', (int) $data['location_id'])) { |
|
4896 | 4896 | $skipped++; |
4897 | - } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) { |
|
4897 | + } else if (!empty($data['city_slug']) && $location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug']))) { |
|
4898 | 4898 | $skipped++; |
4899 | 4899 | } else { |
4900 | - if ( $location_id = geodir_location_insert_city( $data, true ) ) { |
|
4900 | + if ($location_id = geodir_location_insert_city($data, true)) { |
|
4901 | 4901 | $created++; |
4902 | 4902 | } else { |
4903 | 4903 | $invalid++; |
@@ -4918,14 +4918,14 @@ discard block |
||
4918 | 4918 | $json['invalid'] = $invalid; |
4919 | 4919 | $json['images'] = $images; |
4920 | 4920 | |
4921 | - wp_send_json( $json ); |
|
4922 | - } else if ( $task == 'import_hood' ) { |
|
4921 | + wp_send_json($json); |
|
4922 | + } else if ($task == 'import_hood') { |
|
4923 | 4923 | if (!empty($file)) { |
4924 | 4924 | $columns = isset($file[0]) ? $file[0] : NULL; |
4925 | 4925 | |
4926 | 4926 | if (empty($columns) || (!empty($columns) && $columns[0] == '')) { |
4927 | 4927 | $json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory'); |
4928 | - wp_send_json( $json ); |
|
4928 | + wp_send_json($json); |
|
4929 | 4929 | } |
4930 | 4930 | |
4931 | 4931 | for ($i = 1; $i <= $limit; $i++) { |
@@ -4933,7 +4933,7 @@ discard block |
||
4933 | 4933 | |
4934 | 4934 | if (isset($file[$index])) { |
4935 | 4935 | $row = $file[$index]; |
4936 | - $row = array_map( 'trim', $row ); |
|
4936 | + $row = array_map('trim', $row); |
|
4937 | 4937 | $data = array(); |
4938 | 4938 | |
4939 | 4939 | foreach ($columns as $c => $column) { |
@@ -4948,8 +4948,8 @@ discard block |
||
4948 | 4948 | } |
4949 | 4949 | |
4950 | 4950 | $location_info = array(); |
4951 | - if (!empty($data['location_id']) && (int)$data['location_id'] > 0) { |
|
4952 | - $location_info = geodir_get_location_by_id('', (int)$data['location_id']); |
|
4951 | + if (!empty($data['location_id']) && (int) $data['location_id'] > 0) { |
|
4952 | + $location_info = geodir_get_location_by_id('', (int) $data['location_id']); |
|
4953 | 4953 | } else if (!empty($data['city']) && !empty($data['region']) && !empty($data['country'])) { |
4954 | 4954 | $location_info = geodir_get_location_by_slug('city', array('fields' => 'location_id', 'city' => $data['city'], 'country' => $data['country'], 'region' => $data['region'])); |
4955 | 4955 | } |
@@ -4970,9 +4970,9 @@ discard block |
||
4970 | 4970 | $hood_data['hood_longitude'] = $data['longitude']; |
4971 | 4971 | $hood_data['hood_location_id'] = $location_id; |
4972 | 4972 | |
4973 | - if ( $import_choice == 'update' ) { |
|
4974 | - if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) { |
|
4975 | - $hood_data['hood_id'] = (int)$data['neighbourhood_id']; |
|
4973 | + if ($import_choice == 'update') { |
|
4974 | + if ((int) $data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int) $data['neighbourhood_id']))) { |
|
4975 | + $hood_data['hood_id'] = (int) $data['neighbourhood_id']; |
|
4976 | 4976 | |
4977 | 4977 | if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) { |
4978 | 4978 | $updated++; |
@@ -4980,7 +4980,7 @@ discard block |
||
4980 | 4980 | $invalid++; |
4981 | 4981 | } |
4982 | 4982 | } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) { |
4983 | - $hood_data['hood_id'] = (int)$neighbourhood->hood_id; |
|
4983 | + $hood_data['hood_id'] = (int) $neighbourhood->hood_id; |
|
4984 | 4984 | |
4985 | 4985 | if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) { |
4986 | 4986 | $updated++; |
@@ -4994,8 +4994,8 @@ discard block |
||
4994 | 4994 | $invalid++; |
4995 | 4995 | } |
4996 | 4996 | } |
4997 | - } elseif ( $import_choice == 'skip' ) { |
|
4998 | - if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) { |
|
4997 | + } elseif ($import_choice == 'skip') { |
|
4998 | + if ((int) $data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int) $data['neighbourhood_id']))) { |
|
4999 | 4999 | $skipped++; |
5000 | 5000 | } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) { |
5001 | 5001 | $skipped++; |
@@ -5022,7 +5022,7 @@ discard block |
||
5022 | 5022 | $json['invalid'] = $invalid; |
5023 | 5023 | $json['images'] = $images; |
5024 | 5024 | |
5025 | - wp_send_json( $json ); |
|
5025 | + wp_send_json($json); |
|
5026 | 5026 | } |
5027 | 5027 | } |
5028 | 5028 | break; |
@@ -5066,29 +5066,29 @@ discard block |
||
5066 | 5066 | * } |
5067 | 5067 | * @return int|bool Term id when success, false when fail. |
5068 | 5068 | */ |
5069 | -function geodir_imex_insert_term( $taxonomy, $term_data ) { |
|
5070 | - if ( empty( $taxonomy ) || empty( $term_data ) ) { |
|
5069 | +function geodir_imex_insert_term($taxonomy, $term_data) { |
|
5070 | + if (empty($taxonomy) || empty($term_data)) { |
|
5071 | 5071 | return false; |
5072 | 5072 | } |
5073 | 5073 | |
5074 | - $term = isset( $term_data['name'] ) && !empty( $term_data['name'] ) ? $term_data['name'] : ''; |
|
5074 | + $term = isset($term_data['name']) && !empty($term_data['name']) ? $term_data['name'] : ''; |
|
5075 | 5075 | $args = array(); |
5076 | - $args['description'] = isset( $term_data['description'] ) ? $term_data['description'] : ''; |
|
5077 | - $args['slug'] = isset( $term_data['slug'] ) ? $term_data['slug'] : ''; |
|
5078 | - $args['parent'] = isset( $term_data['parent'] ) ? (int)$term_data['parent'] : ''; |
|
5076 | + $args['description'] = isset($term_data['description']) ? $term_data['description'] : ''; |
|
5077 | + $args['slug'] = isset($term_data['slug']) ? $term_data['slug'] : ''; |
|
5078 | + $args['parent'] = isset($term_data['parent']) ? (int) $term_data['parent'] : ''; |
|
5079 | 5079 | |
5080 | - if ( ( !empty( $args['slug'] ) && term_exists( $args['slug'], $taxonomy ) ) || empty( $args['slug'] ) ) { |
|
5081 | - $term_args = array_merge( $term_data, $args ); |
|
5082 | - $defaults = array( 'alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => ''); |
|
5083 | - $term_args = wp_parse_args( $term_args, $defaults ); |
|
5084 | - $term_args = sanitize_term( $term_args, $taxonomy, 'db' ); |
|
5085 | - $args['slug'] = wp_unique_term_slug( $args['slug'], (object)$term_args ); |
|
5080 | + if ((!empty($args['slug']) && term_exists($args['slug'], $taxonomy)) || empty($args['slug'])) { |
|
5081 | + $term_args = array_merge($term_data, $args); |
|
5082 | + $defaults = array('alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => ''); |
|
5083 | + $term_args = wp_parse_args($term_args, $defaults); |
|
5084 | + $term_args = sanitize_term($term_args, $taxonomy, 'db'); |
|
5085 | + $args['slug'] = wp_unique_term_slug($args['slug'], (object) $term_args); |
|
5086 | 5086 | } |
5087 | 5087 | |
5088 | - if( !empty( $term ) ) { |
|
5089 | - $result = wp_insert_term( $term, $taxonomy, $args ); |
|
5090 | - if( !is_wp_error( $result ) ) { |
|
5091 | - return isset( $result['term_id'] ) ? $result['term_id'] : 0; |
|
5088 | + if (!empty($term)) { |
|
5089 | + $result = wp_insert_term($term, $taxonomy, $args); |
|
5090 | + if (!is_wp_error($result)) { |
|
5091 | + return isset($result['term_id']) ? $result['term_id'] : 0; |
|
5092 | 5092 | } |
5093 | 5093 | } |
5094 | 5094 | |
@@ -5118,36 +5118,36 @@ discard block |
||
5118 | 5118 | * } |
5119 | 5119 | * @return int|bool Term id when success, false when fail. |
5120 | 5120 | */ |
5121 | -function geodir_imex_update_term( $taxonomy, $term_data ) { |
|
5122 | - if ( empty( $taxonomy ) || empty( $term_data ) ) { |
|
5121 | +function geodir_imex_update_term($taxonomy, $term_data) { |
|
5122 | + if (empty($taxonomy) || empty($term_data)) { |
|
5123 | 5123 | return false; |
5124 | 5124 | } |
5125 | 5125 | |
5126 | - $term_id = isset( $term_data['term_id'] ) && !empty( $term_data['term_id'] ) ? $term_data['term_id'] : 0; |
|
5126 | + $term_id = isset($term_data['term_id']) && !empty($term_data['term_id']) ? $term_data['term_id'] : 0; |
|
5127 | 5127 | |
5128 | 5128 | $args = array(); |
5129 | - $args['description'] = isset( $term_data['description'] ) ? $term_data['description'] : ''; |
|
5130 | - $args['slug'] = isset( $term_data['slug'] ) ? $term_data['slug'] : ''; |
|
5131 | - $args['parent'] = isset( $term_data['parent'] ) ? (int)$term_data['parent'] : ''; |
|
5129 | + $args['description'] = isset($term_data['description']) ? $term_data['description'] : ''; |
|
5130 | + $args['slug'] = isset($term_data['slug']) ? $term_data['slug'] : ''; |
|
5131 | + $args['parent'] = isset($term_data['parent']) ? (int) $term_data['parent'] : ''; |
|
5132 | 5132 | |
5133 | - if ( $term_id > 0 && $term_info = (array)get_term( $term_id, $taxonomy ) ) { |
|
5133 | + if ($term_id > 0 && $term_info = (array) get_term($term_id, $taxonomy)) { |
|
5134 | 5134 | $term_data['term_id'] = $term_info['term_id']; |
5135 | 5135 | |
5136 | - $result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data ); |
|
5136 | + $result = wp_update_term($term_data['term_id'], $taxonomy, $term_data); |
|
5137 | 5137 | |
5138 | - if( !is_wp_error( $result ) ) { |
|
5139 | - return isset( $result['term_id'] ) ? $result['term_id'] : 0; |
|
5138 | + if (!is_wp_error($result)) { |
|
5139 | + return isset($result['term_id']) ? $result['term_id'] : 0; |
|
5140 | 5140 | } |
5141 | - } else if ( $term_data['slug'] != '' && $term_info = (array)term_exists( $term_data['slug'], $taxonomy ) ) { |
|
5141 | + } else if ($term_data['slug'] != '' && $term_info = (array) term_exists($term_data['slug'], $taxonomy)) { |
|
5142 | 5142 | $term_data['term_id'] = $term_info['term_id']; |
5143 | 5143 | |
5144 | - $result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data ); |
|
5144 | + $result = wp_update_term($term_data['term_id'], $taxonomy, $term_data); |
|
5145 | 5145 | |
5146 | - if( !is_wp_error( $result ) ) { |
|
5147 | - return isset( $result['term_id'] ) ? $result['term_id'] : 0; |
|
5146 | + if (!is_wp_error($result)) { |
|
5147 | + return isset($result['term_id']) ? $result['term_id'] : 0; |
|
5148 | 5148 | } |
5149 | 5149 | } else { |
5150 | - return geodir_imex_insert_term( $taxonomy, $term_data ); |
|
5150 | + return geodir_imex_insert_term($taxonomy, $term_data); |
|
5151 | 5151 | } |
5152 | 5152 | |
5153 | 5153 | return false; |
@@ -5165,25 +5165,25 @@ discard block |
||
5165 | 5165 | * @param string $post_type Post type. |
5166 | 5166 | * @return int Posts count. |
5167 | 5167 | */ |
5168 | -function geodir_get_posts_count( $post_type ) { |
|
5168 | +function geodir_get_posts_count($post_type) { |
|
5169 | 5169 | global $wpdb, $plugin_prefix; |
5170 | 5170 | |
5171 | - if ( !post_type_exists( $post_type ) ) { |
|
5171 | + if (!post_type_exists($post_type)) { |
|
5172 | 5172 | return 0; |
5173 | 5173 | } |
5174 | 5174 | |
5175 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
5175 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
5176 | 5176 | |
5177 | 5177 | // Skip listing with statuses trash, auto-draft etc... |
5178 | 5178 | $skip_statuses = geodir_imex_export_skip_statuses(); |
5179 | 5179 | $where_statuses = ''; |
5180 | - if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) { |
|
5181 | - $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')"; |
|
5180 | + if (!empty($skip_statuses) && is_array($skip_statuses)) { |
|
5181 | + $where_statuses = "AND `".$wpdb->posts."`.`post_status` NOT IN('".implode("','", $skip_statuses)."')"; |
|
5182 | 5182 | } |
5183 | 5183 | |
5184 | - $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 ); |
|
5184 | + $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); |
|
5185 | 5185 | |
5186 | - $posts_count = (int)$wpdb->get_var( $query ); |
|
5186 | + $posts_count = (int) $wpdb->get_var($query); |
|
5187 | 5187 | |
5188 | 5188 | /** |
5189 | 5189 | * Modify returned post counts for the current post type. |
@@ -5194,7 +5194,7 @@ discard block |
||
5194 | 5194 | * @param int $posts_count Post counts. |
5195 | 5195 | * @param string $post_type Post type. |
5196 | 5196 | */ |
5197 | - $posts_count = apply_filters( 'geodir_imex_count_posts', $posts_count, $post_type ); |
|
5197 | + $posts_count = apply_filters('geodir_imex_count_posts', $posts_count, $post_type); |
|
5198 | 5198 | |
5199 | 5199 | return $posts_count; |
5200 | 5200 | } |
@@ -5215,17 +5215,17 @@ discard block |
||
5215 | 5215 | * @param int $page_no Page number. Default 0. |
5216 | 5216 | * @return array Array of posts data. |
5217 | 5217 | */ |
5218 | -function geodir_imex_get_posts( $post_type, $per_page = 0, $page_no = 0 ) { |
|
5218 | +function geodir_imex_get_posts($post_type, $per_page = 0, $page_no = 0) { |
|
5219 | 5219 | global $wp_filesystem; |
5220 | 5220 | |
5221 | - $posts = geodir_get_export_posts( $post_type, $per_page, $page_no ); |
|
5221 | + $posts = geodir_get_export_posts($post_type, $per_page, $page_no); |
|
5222 | 5222 | |
5223 | 5223 | $csv_rows = array(); |
5224 | 5224 | |
5225 | - if ( !empty( $posts ) ) { |
|
5226 | - $is_payment_plugin = is_plugin_active( 'geodir_payment_manager/geodir_payment_manager.php' ); |
|
5225 | + if (!empty($posts)) { |
|
5226 | + $is_payment_plugin = is_plugin_active('geodir_payment_manager/geodir_payment_manager.php'); |
|
5227 | 5227 | $location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active. |
5228 | - $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true; |
|
5228 | + $location_allowed = function_exists('geodir_cpt_no_location') && geodir_cpt_no_location($post_type) ? false : true; |
|
5229 | 5229 | $neighbourhood_active = $location_manager && $location_allowed && get_option('location_neighbourhoods') ? true : false; |
5230 | 5230 | |
5231 | 5231 | $csv_row = array(); |
@@ -5237,7 +5237,7 @@ discard block |
||
5237 | 5237 | $csv_row[] = 'default_category'; |
5238 | 5238 | $csv_row[] = 'post_tags'; |
5239 | 5239 | $csv_row[] = 'post_type'; |
5240 | - if ( $post_type == 'gd_event' ) { |
|
5240 | + if ($post_type == 'gd_event') { |
|
5241 | 5241 | $csv_row[] = 'event_date'; |
5242 | 5242 | $csv_row[] = 'event_enddate'; |
5243 | 5243 | $csv_row[] = 'starttime'; |
@@ -5291,15 +5291,15 @@ discard block |
||
5291 | 5291 | } |
5292 | 5292 | // WPML |
5293 | 5293 | |
5294 | - $custom_fields = geodir_imex_get_custom_fields( $post_type ); |
|
5295 | - if ( !empty( $custom_fields ) ) { |
|
5296 | - foreach ( $custom_fields as $custom_field ) { |
|
5294 | + $custom_fields = geodir_imex_get_custom_fields($post_type); |
|
5295 | + if (!empty($custom_fields)) { |
|
5296 | + foreach ($custom_fields as $custom_field) { |
|
5297 | 5297 | $csv_row[] = $custom_field->htmlvar_name; |
5298 | 5298 | } |
5299 | 5299 | } |
5300 | 5300 | |
5301 | 5301 | // Export franchise fields |
5302 | - $is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false; |
|
5302 | + $is_franchise_active = is_plugin_active('geodir_franchise/geodir_franchise.php') && geodir_franchise_enabled($post_type) ? true : false; |
|
5303 | 5303 | if ($is_franchise_active) { |
5304 | 5304 | $csv_row[] = 'gd_is_franchise'; |
5305 | 5305 | $csv_row[] = 'gd_franchise_lock'; |
@@ -5309,28 +5309,28 @@ discard block |
||
5309 | 5309 | $csv_rows[] = $csv_row; |
5310 | 5310 | |
5311 | 5311 | $images_count = 5; |
5312 | - $xx=0; |
|
5313 | - foreach ( $posts as $post ) {$xx++; |
|
5312 | + $xx = 0; |
|
5313 | + foreach ($posts as $post) {$xx++; |
|
5314 | 5314 | $post_id = $post['ID']; |
5315 | 5315 | |
5316 | - $gd_post_info = geodir_get_post_info( $post_id ); |
|
5317 | - $post_info = (array)$gd_post_info; |
|
5316 | + $gd_post_info = geodir_get_post_info($post_id); |
|
5317 | + $post_info = (array) $gd_post_info; |
|
5318 | 5318 | |
5319 | - $taxonomy_category = $post_type . 'category'; |
|
5320 | - $taxonomy_tags = $post_type . '_tags'; |
|
5319 | + $taxonomy_category = $post_type.'category'; |
|
5320 | + $taxonomy_tags = $post_type.'_tags'; |
|
5321 | 5321 | |
5322 | 5322 | $post_category = ''; |
5323 | 5323 | $default_category_id = $gd_post_info->default_category; |
5324 | 5324 | $default_category = ''; |
5325 | 5325 | $post_tags = ''; |
5326 | - $terms = wp_get_post_terms( $post_id, array( $taxonomy_category, $taxonomy_tags ) ); |
|
5326 | + $terms = wp_get_post_terms($post_id, array($taxonomy_category, $taxonomy_tags)); |
|
5327 | 5327 | |
5328 | - if ( !empty( $terms ) && !is_wp_error( $terms ) ) { |
|
5328 | + if (!empty($terms) && !is_wp_error($terms)) { |
|
5329 | 5329 | $post_category = array(); |
5330 | 5330 | $post_tags = array(); |
5331 | 5331 | |
5332 | - foreach ( $terms as $term ) { |
|
5333 | - if ( $term->taxonomy == $taxonomy_category ) { |
|
5332 | + foreach ($terms as $term) { |
|
5333 | + if ($term->taxonomy == $taxonomy_category) { |
|
5334 | 5334 | $post_category[] = $term->name; |
5335 | 5335 | |
5336 | 5336 | if ($default_category_id == $term->term_id) { |
@@ -5338,7 +5338,7 @@ discard block |
||
5338 | 5338 | } |
5339 | 5339 | } |
5340 | 5340 | |
5341 | - if ( $term->taxonomy == $taxonomy_tags ) { |
|
5341 | + if ($term->taxonomy == $taxonomy_tags) { |
|
5342 | 5342 | $post_tags[] = $term->name; |
5343 | 5343 | } |
5344 | 5344 | } |
@@ -5346,47 +5346,47 @@ discard block |
||
5346 | 5346 | if (empty($default_category) && !empty($post_category)) { |
5347 | 5347 | $default_category = $post_category[0]; // Set first one as default category. |
5348 | 5348 | } |
5349 | - $post_category = !empty( $post_category ) ? implode( ',', $post_category ) : ''; |
|
5350 | - $post_tags = !empty( $post_tags ) ? implode( ',', $post_tags ) : ''; |
|
5349 | + $post_category = !empty($post_category) ? implode(',', $post_category) : ''; |
|
5350 | + $post_tags = !empty($post_tags) ? implode(',', $post_tags) : ''; |
|
5351 | 5351 | } |
5352 | 5352 | |
5353 | 5353 | // Franchise data |
5354 | - if ($is_franchise_active && isset($post_info['franchise']) && (int)$post_info['franchise'] > 0 && geodir_franchise_check((int)$post_info['franchise'])) { |
|
5354 | + if ($is_franchise_active && isset($post_info['franchise']) && (int) $post_info['franchise'] > 0 && geodir_franchise_check((int) $post_info['franchise'])) { |
|
5355 | 5355 | $franchise_id = $post_info['franchise']; |
5356 | 5356 | $gd_franchise_info = geodir_get_post_info($franchise_id); |
5357 | 5357 | |
5358 | 5358 | if (geodir_franchise_pkg_is_active($gd_franchise_info)) { |
5359 | - $franchise_info = (array)$gd_franchise_info; |
|
5359 | + $franchise_info = (array) $gd_franchise_info; |
|
5360 | 5360 | $locked_fields = geodir_franchise_get_locked_fields($franchise_id, true); |
5361 | 5361 | |
5362 | 5362 | if (!empty($locked_fields)) { |
5363 | - foreach( $locked_fields as $locked_field) { |
|
5363 | + foreach ($locked_fields as $locked_field) { |
|
5364 | 5364 | if (isset($post_info[$locked_field]) && isset($franchise_info[$locked_field])) { |
5365 | 5365 | $post_info[$locked_field] = $franchise_info[$locked_field]; |
5366 | 5366 | } |
5367 | 5367 | |
5368 | 5368 | if (in_array($taxonomy_category, $locked_fields) || in_array('post_tags', $locked_fields)) { |
5369 | - $franchise_terms = wp_get_post_terms( $franchise_id, array( $taxonomy_category, $taxonomy_tags ) ); |
|
5369 | + $franchise_terms = wp_get_post_terms($franchise_id, array($taxonomy_category, $taxonomy_tags)); |
|
5370 | 5370 | |
5371 | - if ( !empty( $franchise_terms ) && !is_wp_error( $franchise_terms ) ) { |
|
5371 | + if (!empty($franchise_terms) && !is_wp_error($franchise_terms)) { |
|
5372 | 5372 | $franchise_post_category = array(); |
5373 | 5373 | $franchise_post_tags = array(); |
5374 | 5374 | |
5375 | - foreach ( $franchise_terms as $franchise_term ) { |
|
5376 | - if ( $franchise_term->taxonomy == $taxonomy_category ) { |
|
5375 | + foreach ($franchise_terms as $franchise_term) { |
|
5376 | + if ($franchise_term->taxonomy == $taxonomy_category) { |
|
5377 | 5377 | $franchise_post_category[] = $franchise_term->name; |
5378 | 5378 | } |
5379 | 5379 | |
5380 | - if ( $franchise_term->taxonomy == $taxonomy_tags ) { |
|
5380 | + if ($franchise_term->taxonomy == $taxonomy_tags) { |
|
5381 | 5381 | $franchise_post_tags[] = $franchise_term->name; |
5382 | 5382 | } |
5383 | 5383 | } |
5384 | 5384 | |
5385 | 5385 | if (in_array($taxonomy_category, $locked_fields)) { |
5386 | - $post_category = !empty( $franchise_post_category ) ? implode( ',', $franchise_post_category ) : ''; |
|
5386 | + $post_category = !empty($franchise_post_category) ? implode(',', $franchise_post_category) : ''; |
|
5387 | 5387 | } |
5388 | 5388 | if (in_array('post_tags', $locked_fields)) { |
5389 | - $post_tags = !empty( $franchise_post_tags ) ? implode( ',', $franchise_post_tags ) : ''; |
|
5389 | + $post_tags = !empty($franchise_post_tags) ? implode(',', $franchise_post_tags) : ''; |
|
5390 | 5390 | } |
5391 | 5391 | } |
5392 | 5392 | } |
@@ -5395,18 +5395,18 @@ discard block |
||
5395 | 5395 | } |
5396 | 5396 | } |
5397 | 5397 | |
5398 | - $post_images = geodir_get_images( $post_id ); |
|
5398 | + $post_images = geodir_get_images($post_id); |
|
5399 | 5399 | $current_images = array(); |
5400 | - if ( !empty( $post_images ) ) { |
|
5401 | - foreach ( $post_images as $post_image ) { |
|
5402 | - $post_image = (array)$post_image; |
|
5403 | - $image = !empty( $post_image ) && isset( $post_image['path'] ) && $wp_filesystem->is_file( $post_image['path'] ) && $wp_filesystem->exists( $post_image['path'] ) ? $post_image['src'] : ''; |
|
5404 | - if ( $image ) { |
|
5400 | + if (!empty($post_images)) { |
|
5401 | + foreach ($post_images as $post_image) { |
|
5402 | + $post_image = (array) $post_image; |
|
5403 | + $image = !empty($post_image) && isset($post_image['path']) && $wp_filesystem->is_file($post_image['path']) && $wp_filesystem->exists($post_image['path']) ? $post_image['src'] : ''; |
|
5404 | + if ($image) { |
|
5405 | 5405 | $current_images[] = $image; |
5406 | 5406 | } |
5407 | 5407 | } |
5408 | 5408 | |
5409 | - $images_count = max( $images_count, count( $current_images ) ); |
|
5409 | + $images_count = max($images_count, count($current_images)); |
|
5410 | 5410 | } |
5411 | 5411 | |
5412 | 5412 | $csv_row = array(); |
@@ -5418,7 +5418,7 @@ discard block |
||
5418 | 5418 | $csv_row[] = $default_category; // default_category |
5419 | 5419 | $csv_row[] = $post_tags; // post_tags |
5420 | 5420 | $csv_row[] = $post_type; // post_type |
5421 | - if ( $post_type == 'gd_event' ) { |
|
5421 | + if ($post_type == 'gd_event') { |
|
5422 | 5422 | $event_data = geodir_imex_get_event_data($post, $gd_post_info); |
5423 | 5423 | $csv_row[] = $event_data['event_date']; // event_date |
5424 | 5424 | $csv_row[] = $event_data['event_enddate']; // enddate |
@@ -5439,9 +5439,9 @@ discard block |
||
5439 | 5439 | $csv_row[] = $event_data['recurring_end_date']; // repeat_end |
5440 | 5440 | } |
5441 | 5441 | $csv_row[] = $post_info['post_status']; // post_status |
5442 | - $csv_row[] = (int)$post_info['is_featured'] == 1 ? 1 : ''; // is_featured |
|
5442 | + $csv_row[] = (int) $post_info['is_featured'] == 1 ? 1 : ''; // is_featured |
|
5443 | 5443 | if ($is_payment_plugin) { |
5444 | - $csv_row[] = (int)$post_info['package_id']; // package_id |
|
5444 | + $csv_row[] = (int) $post_info['package_id']; // package_id |
|
5445 | 5445 | $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 |
5446 | 5446 | } |
5447 | 5447 | $csv_row[] = $post_info['geodir_video']; // geodir_video |
@@ -5477,14 +5477,14 @@ discard block |
||
5477 | 5477 | $csv_row[] = $post_info['geodir_special_offers']; // geodir_special_offers |
5478 | 5478 | // WPML |
5479 | 5479 | if ($is_wpml) { |
5480 | - $csv_row[] = geodir_get_language_for_element( $post_id, 'post_' . $post_type ); |
|
5481 | - $csv_row[] = geodir_imex_original_post_id( $post_id, 'post_' . $post_type ); |
|
5480 | + $csv_row[] = geodir_get_language_for_element($post_id, 'post_'.$post_type); |
|
5481 | + $csv_row[] = geodir_imex_original_post_id($post_id, 'post_'.$post_type); |
|
5482 | 5482 | } |
5483 | 5483 | // WPML |
5484 | 5484 | |
5485 | - if ( !empty( $custom_fields ) ) { |
|
5486 | - foreach ( $custom_fields as $custom_field ) { |
|
5487 | - $csv_row[] = isset( $post_info[$custom_field->htmlvar_name] ) ? $post_info[$custom_field->htmlvar_name] : ''; |
|
5485 | + if (!empty($custom_fields)) { |
|
5486 | + foreach ($custom_fields as $custom_field) { |
|
5487 | + $csv_row[] = isset($post_info[$custom_field->htmlvar_name]) ? $post_info[$custom_field->htmlvar_name] : ''; |
|
5488 | 5488 | } |
5489 | 5489 | } |
5490 | 5490 | |
@@ -5495,26 +5495,26 @@ discard block |
||
5495 | 5495 | $franchise = ''; |
5496 | 5496 | |
5497 | 5497 | if (geodir_franchise_pkg_is_active($gd_post_info)) { |
5498 | - $gd_is_franchise = (int)get_post_meta( $post_id, 'gd_is_franchise', true ); |
|
5499 | - $locaked_fields = $gd_is_franchise ? get_post_meta( $post_id, 'gd_franchise_lock', true ) : ''; |
|
5498 | + $gd_is_franchise = (int) get_post_meta($post_id, 'gd_is_franchise', true); |
|
5499 | + $locaked_fields = $gd_is_franchise ? get_post_meta($post_id, 'gd_franchise_lock', true) : ''; |
|
5500 | 5500 | $locaked_fields = (is_array($locaked_fields) && !empty($locaked_fields) ? implode(",", $locaked_fields) : ''); |
5501 | - $franchise = !$gd_is_franchise && isset($post_info['franchise']) && (int)$post_info['franchise'] > 0 ? (int)$post_info['franchise'] : 0; // franchise id |
|
5501 | + $franchise = !$gd_is_franchise && isset($post_info['franchise']) && (int) $post_info['franchise'] > 0 ? (int) $post_info['franchise'] : 0; // franchise id |
|
5502 | 5502 | } |
5503 | 5503 | |
5504 | - $csv_row[] = (int)$gd_is_franchise; // gd_is_franchise |
|
5504 | + $csv_row[] = (int) $gd_is_franchise; // gd_is_franchise |
|
5505 | 5505 | $csv_row[] = $locaked_fields; // gd_franchise_lock fields |
5506 | - $csv_row[] = (int)$franchise; // franchise id |
|
5506 | + $csv_row[] = (int) $franchise; // franchise id |
|
5507 | 5507 | } |
5508 | 5508 | |
5509 | - for ( $c = 0; $c < $images_count; $c++ ) { |
|
5510 | - $csv_row[] = isset( $current_images[$c] ) ? $current_images[$c] : ''; // IMAGE |
|
5509 | + for ($c = 0; $c < $images_count; $c++) { |
|
5510 | + $csv_row[] = isset($current_images[$c]) ? $current_images[$c] : ''; // IMAGE |
|
5511 | 5511 | } |
5512 | 5512 | |
5513 | 5513 | $csv_rows[] = $csv_row; |
5514 | 5514 | |
5515 | 5515 | } |
5516 | 5516 | |
5517 | - for ( $c = 0; $c < $images_count; $c++ ) { |
|
5517 | + for ($c = 0; $c < $images_count; $c++) { |
|
5518 | 5518 | $csv_rows[0][] = 'IMAGE'; |
5519 | 5519 | } |
5520 | 5520 | } |
@@ -5536,33 +5536,33 @@ discard block |
||
5536 | 5536 | * @param int $page_no Page number. Default 0. |
5537 | 5537 | * @return array Array of posts data. |
5538 | 5538 | */ |
5539 | -function geodir_get_export_posts( $post_type, $per_page = 0, $page_no = 0 ) { |
|
5539 | +function geodir_get_export_posts($post_type, $per_page = 0, $page_no = 0) { |
|
5540 | 5540 | global $wpdb, $plugin_prefix; |
5541 | 5541 | |
5542 | - if ( ! post_type_exists( $post_type ) ) |
|
5542 | + if (!post_type_exists($post_type)) |
|
5543 | 5543 | return new stdClass; |
5544 | 5544 | |
5545 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
5545 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
5546 | 5546 | |
5547 | 5547 | $limit = ''; |
5548 | - if ( $per_page > 0 && $page_no > 0 ) { |
|
5549 | - $offset = ( $page_no - 1 ) * $per_page; |
|
5548 | + if ($per_page > 0 && $page_no > 0) { |
|
5549 | + $offset = ($page_no - 1) * $per_page; |
|
5550 | 5550 | |
5551 | - if ( $offset > 0 ) { |
|
5552 | - $limit = " LIMIT " . $offset . "," . $per_page; |
|
5551 | + if ($offset > 0) { |
|
5552 | + $limit = " LIMIT ".$offset.",".$per_page; |
|
5553 | 5553 | } else { |
5554 | - $limit = " LIMIT " . $per_page; |
|
5554 | + $limit = " LIMIT ".$per_page; |
|
5555 | 5555 | } |
5556 | 5556 | } |
5557 | 5557 | |
5558 | 5558 | // Skip listing with statuses trash, auto-draft etc... |
5559 | 5559 | $skip_statuses = geodir_imex_export_skip_statuses(); |
5560 | 5560 | $where_statuses = ''; |
5561 | - if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) { |
|
5562 | - $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')"; |
|
5561 | + if (!empty($skip_statuses) && is_array($skip_statuses)) { |
|
5562 | + $where_statuses = "AND `".$wpdb->posts."`.`post_status` NOT IN('".implode("','", $skip_statuses)."')"; |
|
5563 | 5563 | } |
5564 | 5564 | |
5565 | - $query = "SELECT {$wpdb->posts}.ID FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s " . $where_statuses . " ORDER BY {$wpdb->posts}.ID ASC" . $limit; |
|
5565 | + $query = "SELECT {$wpdb->posts}.ID FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s ".$where_statuses." ORDER BY {$wpdb->posts}.ID ASC".$limit; |
|
5566 | 5566 | /** |
5567 | 5567 | * Modify returned posts SQL query for the current post type. |
5568 | 5568 | * |
@@ -5572,9 +5572,9 @@ discard block |
||
5572 | 5572 | * @param int $query The SQL query. |
5573 | 5573 | * @param string $post_type Post type. |
5574 | 5574 | */ |
5575 | - $query = apply_filters( 'geodir_imex_export_posts_query', $query, $post_type ); |
|
5575 | + $query = apply_filters('geodir_imex_export_posts_query', $query, $post_type); |
|
5576 | 5576 | |
5577 | - $results = (array)$wpdb->get_results( $wpdb->prepare( $query, $post_type ), ARRAY_A ); |
|
5577 | + $results = (array) $wpdb->get_results($wpdb->prepare($query, $post_type), ARRAY_A); |
|
5578 | 5578 | |
5579 | 5579 | /** |
5580 | 5580 | * Modify returned post results for the current post type. |
@@ -5585,7 +5585,7 @@ discard block |
||
5585 | 5585 | * @param object $results An object containing all post ids. |
5586 | 5586 | * @param string $post_type Post type. |
5587 | 5587 | */ |
5588 | - return apply_filters( 'geodir_export_posts', $results, $post_type ); |
|
5588 | + return apply_filters('geodir_export_posts', $results, $post_type); |
|
5589 | 5589 | } |
5590 | 5590 | |
5591 | 5591 | /** |
@@ -5602,21 +5602,21 @@ discard block |
||
5602 | 5602 | * @param string $post_type Post type. |
5603 | 5603 | * @return string The SQL query. |
5604 | 5604 | */ |
5605 | -function geodir_imex_get_events_query( $query, $post_type ) { |
|
5606 | - if ( $post_type == 'gd_event' ) { |
|
5605 | +function geodir_imex_get_events_query($query, $post_type) { |
|
5606 | + if ($post_type == 'gd_event') { |
|
5607 | 5607 | global $wpdb, $plugin_prefix; |
5608 | 5608 | |
5609 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
5609 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
5610 | 5610 | $schedule_table = EVENT_SCHEDULE; |
5611 | 5611 | |
5612 | 5612 | // Skip listing with statuses trash, auto-draft etc... |
5613 | 5613 | $skip_statuses = geodir_imex_export_skip_statuses(); |
5614 | 5614 | $where_statuses = ''; |
5615 | - if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) { |
|
5616 | - $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')"; |
|
5615 | + if (!empty($skip_statuses) && is_array($skip_statuses)) { |
|
5616 | + $where_statuses = "AND `".$wpdb->posts."`.`post_status` NOT IN('".implode("','", $skip_statuses)."')"; |
|
5617 | 5617 | } |
5618 | 5618 | |
5619 | - $query = "SELECT {$wpdb->posts}.ID, {$schedule_table}.event_date, {$schedule_table}.event_enddate AS enddate, {$schedule_table}.event_starttime AS starttime, {$schedule_table}.event_endtime AS endtime FROM {$wpdb->posts} INNER JOIN {$table} ON ({$table}.post_id = {$wpdb->posts}.ID) INNER JOIN {$schedule_table} ON ({$schedule_table}.event_id = {$wpdb->posts}.ID) WHERE {$wpdb->posts}.post_type = %s " . $where_statuses . " GROUP BY {$table}.post_id ORDER BY {$wpdb->posts}.ID ASC, {$schedule_table}.schedule_id ASC"; |
|
5619 | + $query = "SELECT {$wpdb->posts}.ID, {$schedule_table}.event_date, {$schedule_table}.event_enddate AS enddate, {$schedule_table}.event_starttime AS starttime, {$schedule_table}.event_endtime AS endtime FROM {$wpdb->posts} INNER JOIN {$table} ON ({$table}.post_id = {$wpdb->posts}.ID) INNER JOIN {$schedule_table} ON ({$schedule_table}.event_id = {$wpdb->posts}.ID) WHERE {$wpdb->posts}.post_type = %s ".$where_statuses." GROUP BY {$table}.post_id ORDER BY {$wpdb->posts}.ID ASC, {$schedule_table}.schedule_id ASC"; |
|
5620 | 5620 | } |
5621 | 5621 | |
5622 | 5622 | return $query; |
@@ -5640,35 +5640,35 @@ discard block |
||
5640 | 5640 | * @param string $post_type Post type. |
5641 | 5641 | * @return int Total terms count. |
5642 | 5642 | */ |
5643 | -function geodir_get_terms_count( $post_type ) { |
|
5644 | - $args = array( 'hide_empty' => 0 ); |
|
5643 | +function geodir_get_terms_count($post_type) { |
|
5644 | + $args = array('hide_empty' => 0); |
|
5645 | 5645 | |
5646 | - remove_all_filters( 'get_terms' ); |
|
5646 | + remove_all_filters('get_terms'); |
|
5647 | 5647 | |
5648 | - $taxonomy = $post_type . 'category'; |
|
5648 | + $taxonomy = $post_type.'category'; |
|
5649 | 5649 | |
5650 | 5650 | // WPML |
5651 | 5651 | $is_wpml = geodir_is_wpml(); |
5652 | 5652 | $active_lang = 'all'; |
5653 | - if ( $is_wpml ) { |
|
5653 | + if ($is_wpml) { |
|
5654 | 5654 | global $sitepress; |
5655 | 5655 | $active_lang = $sitepress->get_current_language(); |
5656 | 5656 | |
5657 | - if ( $active_lang != 'all' ) { |
|
5658 | - $sitepress->switch_lang( 'all', true ); |
|
5657 | + if ($active_lang != 'all') { |
|
5658 | + $sitepress->switch_lang('all', true); |
|
5659 | 5659 | } |
5660 | 5660 | } |
5661 | 5661 | // WPML |
5662 | 5662 | |
5663 | - $count_terms = wp_count_terms( $taxonomy, $args ); |
|
5663 | + $count_terms = wp_count_terms($taxonomy, $args); |
|
5664 | 5664 | |
5665 | 5665 | // WPML |
5666 | - if ( $is_wpml && $active_lang !== 'all' ) { |
|
5666 | + if ($is_wpml && $active_lang !== 'all') { |
|
5667 | 5667 | global $sitepress; |
5668 | - $sitepress->switch_lang( $active_lang, true ); |
|
5668 | + $sitepress->switch_lang($active_lang, true); |
|
5669 | 5669 | } |
5670 | 5670 | // WPML |
5671 | - $count_terms = !is_wp_error( $count_terms ) ? $count_terms : 0; |
|
5671 | + $count_terms = !is_wp_error($count_terms) ? $count_terms : 0; |
|
5672 | 5672 | |
5673 | 5673 | return $count_terms; |
5674 | 5674 | } |
@@ -5685,23 +5685,23 @@ discard block |
||
5685 | 5685 | * @param int $page_no Page number. Default 0. |
5686 | 5686 | * @return array Array of terms data. |
5687 | 5687 | */ |
5688 | -function geodir_imex_get_terms( $post_type, $per_page = 0, $page_no = 0 ) { |
|
5689 | - $args = array( 'hide_empty' => 0, 'orderby' => 'id' ); |
|
5688 | +function geodir_imex_get_terms($post_type, $per_page = 0, $page_no = 0) { |
|
5689 | + $args = array('hide_empty' => 0, 'orderby' => 'id'); |
|
5690 | 5690 | |
5691 | - remove_all_filters( 'get_terms' ); |
|
5691 | + remove_all_filters('get_terms'); |
|
5692 | 5692 | |
5693 | - $taxonomy = $post_type . 'category'; |
|
5693 | + $taxonomy = $post_type.'category'; |
|
5694 | 5694 | |
5695 | - if ( $per_page > 0 && $page_no > 0 ) { |
|
5696 | - $args['offset'] = ( $page_no - 1 ) * $per_page; |
|
5695 | + if ($per_page > 0 && $page_no > 0) { |
|
5696 | + $args['offset'] = ($page_no - 1) * $per_page; |
|
5697 | 5697 | $args['number'] = $per_page; |
5698 | 5698 | } |
5699 | 5699 | |
5700 | - $terms = get_terms( $taxonomy, $args ); |
|
5700 | + $terms = get_terms($taxonomy, $args); |
|
5701 | 5701 | |
5702 | 5702 | $csv_rows = array(); |
5703 | 5703 | |
5704 | - if ( !empty( $terms ) ) { |
|
5704 | + if (!empty($terms)) { |
|
5705 | 5705 | $csv_row = array(); |
5706 | 5706 | $csv_row[] = 'cat_id'; |
5707 | 5707 | $csv_row[] = 'cat_name'; |
@@ -5723,16 +5723,16 @@ discard block |
||
5723 | 5723 | |
5724 | 5724 | $csv_rows[] = $csv_row; |
5725 | 5725 | |
5726 | - foreach ( $terms as $term ) { |
|
5727 | - $cat_icon = get_tax_meta( $term->term_id, 'ct_cat_icon', false, $post_type ); |
|
5728 | - $cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : ''; |
|
5726 | + foreach ($terms as $term) { |
|
5727 | + $cat_icon = get_tax_meta($term->term_id, 'ct_cat_icon', false, $post_type); |
|
5728 | + $cat_icon = !empty($cat_icon) && isset($cat_icon['src']) ? $cat_icon['src'] : ''; |
|
5729 | 5729 | |
5730 | - $cat_image = geodir_get_default_catimage( $term->term_id, $post_type ); |
|
5731 | - $cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : ''; |
|
5730 | + $cat_image = geodir_get_default_catimage($term->term_id, $post_type); |
|
5731 | + $cat_image = !empty($cat_image) && isset($cat_image['src']) ? $cat_image['src'] : ''; |
|
5732 | 5732 | |
5733 | 5733 | $cat_parent = ''; |
5734 | - if (isset($term->parent) && (int)$term->parent > 0 && term_exists((int)$term->parent, $taxonomy)) { |
|
5735 | - $parent_term = (array)get_term_by( 'id', (int)$term->parent, $taxonomy ); |
|
5734 | + if (isset($term->parent) && (int) $term->parent > 0 && term_exists((int) $term->parent, $taxonomy)) { |
|
5735 | + $parent_term = (array) get_term_by('id', (int) $term->parent, $taxonomy); |
|
5736 | 5736 | $cat_parent = !empty($parent_term) && isset($parent_term['name']) ? $parent_term['name'] : ''; |
5737 | 5737 | } |
5738 | 5738 | |
@@ -5742,15 +5742,15 @@ discard block |
||
5742 | 5742 | $csv_row[] = $term->slug; |
5743 | 5743 | $csv_row[] = $post_type; |
5744 | 5744 | $csv_row[] = $cat_parent; |
5745 | - $csv_row[] = get_tax_meta( $term->term_id, 'ct_cat_schema', false, $post_type ); |
|
5745 | + $csv_row[] = get_tax_meta($term->term_id, 'ct_cat_schema', false, $post_type); |
|
5746 | 5746 | // WPML |
5747 | 5747 | if ($is_wpml) { |
5748 | - $csv_row[] = geodir_get_language_for_element( $term->term_id, 'tax_' . $taxonomy ); |
|
5749 | - $csv_row[] = geodir_imex_original_post_id( $term->term_id, 'tax_' . $taxonomy ); |
|
5748 | + $csv_row[] = geodir_get_language_for_element($term->term_id, 'tax_'.$taxonomy); |
|
5749 | + $csv_row[] = geodir_imex_original_post_id($term->term_id, 'tax_'.$taxonomy); |
|
5750 | 5750 | } |
5751 | 5751 | // WPML |
5752 | 5752 | $csv_row[] = $term->description; |
5753 | - $csv_row[] = get_tax_meta( $term->term_id, 'ct_cat_top_desc', false, $post_type ); |
|
5753 | + $csv_row[] = get_tax_meta($term->term_id, 'ct_cat_top_desc', false, $post_type); |
|
5754 | 5754 | $csv_row[] = $cat_image; |
5755 | 5755 | $csv_row[] = $cat_icon; |
5756 | 5756 | |
@@ -5769,10 +5769,10 @@ discard block |
||
5769 | 5769 | * @param bool $relative True for relative path & False for absolute path. |
5770 | 5770 | * @return string Path to the cache directory. |
5771 | 5771 | */ |
5772 | -function geodir_path_import_export( $relative = true ) { |
|
5772 | +function geodir_path_import_export($relative = true) { |
|
5773 | 5773 | $upload_dir = wp_upload_dir(); |
5774 | 5774 | |
5775 | - return $relative ? $upload_dir['baseurl'] . '/cache' : $upload_dir['basedir'] . '/cache'; |
|
5775 | + return $relative ? $upload_dir['baseurl'].'/cache' : $upload_dir['basedir'].'/cache'; |
|
5776 | 5776 | } |
5777 | 5777 | |
5778 | 5778 | /** |
@@ -5788,8 +5788,8 @@ discard block |
||
5788 | 5788 | * @param bool $clear If true then it overwrite data otherwise add rows at the end of file. |
5789 | 5789 | * @return bool true if success otherwise false. |
5790 | 5790 | */ |
5791 | -function geodir_save_csv_data( $file_path, $csv_data = array(), $clear = true ) { |
|
5792 | - if ( empty( $csv_data ) ) { |
|
5791 | +function geodir_save_csv_data($file_path, $csv_data = array(), $clear = true) { |
|
5792 | + if (empty($csv_data)) { |
|
5793 | 5793 | return false; |
5794 | 5794 | } |
5795 | 5795 | |
@@ -5797,17 +5797,17 @@ discard block |
||
5797 | 5797 | |
5798 | 5798 | $mode = $clear ? 'w+' : 'a+'; |
5799 | 5799 | |
5800 | - if ( function_exists( 'fputcsv' ) ) { |
|
5801 | - $file = fopen( $file_path, $mode ); |
|
5802 | - foreach( $csv_data as $csv_row ) { |
|
5800 | + if (function_exists('fputcsv')) { |
|
5801 | + $file = fopen($file_path, $mode); |
|
5802 | + foreach ($csv_data as $csv_row) { |
|
5803 | 5803 | //$csv_row = array_map( 'utf8_decode', $csv_row ); |
5804 | - $write_successful = fputcsv( $file, $csv_row, ",", $enclosure = '"' ); |
|
5804 | + $write_successful = fputcsv($file, $csv_row, ",", $enclosure = '"'); |
|
5805 | 5805 | } |
5806 | - fclose( $file ); |
|
5806 | + fclose($file); |
|
5807 | 5807 | } else { |
5808 | - foreach( $csv_data as $csv_row ) { |
|
5808 | + foreach ($csv_data as $csv_row) { |
|
5809 | 5809 | //$csv_row = array_map( 'utf8_decode', $csv_row ); |
5810 | - $wp_filesystem->put_contents( $file_path, $csv_row ); |
|
5810 | + $wp_filesystem->put_contents($file_path, $csv_row); |
|
5811 | 5811 | } |
5812 | 5812 | } |
5813 | 5813 | |
@@ -5825,14 +5825,14 @@ discard block |
||
5825 | 5825 | * @param string $file Full path to file. |
5826 | 5826 | * @return int No of file rows. |
5827 | 5827 | */ |
5828 | -function geodir_import_export_line_count( $file ) { |
|
5828 | +function geodir_import_export_line_count($file) { |
|
5829 | 5829 | global $wp_filesystem; |
5830 | 5830 | |
5831 | - if ( $wp_filesystem->is_file( $file ) && $wp_filesystem->exists( $file ) ) { |
|
5832 | - $contents = $wp_filesystem->get_contents_array( $file ); |
|
5831 | + if ($wp_filesystem->is_file($file) && $wp_filesystem->exists($file)) { |
|
5832 | + $contents = $wp_filesystem->get_contents_array($file); |
|
5833 | 5833 | |
5834 | - if ( !empty( $contents ) && is_array( $contents ) ) { |
|
5835 | - return count( $contents ) - 1; |
|
5834 | + if (!empty($contents) && is_array($contents)) { |
|
5835 | + return count($contents) - 1; |
|
5836 | 5836 | } |
5837 | 5837 | } |
5838 | 5838 | |
@@ -5849,11 +5849,11 @@ discard block |
||
5849 | 5849 | * @param string $post_type The post type. |
5850 | 5850 | * @return object Queried object. |
5851 | 5851 | */ |
5852 | -function geodir_imex_get_custom_fields( $post_type ) { |
|
5852 | +function geodir_imex_get_custom_fields($post_type) { |
|
5853 | 5853 | global $wpdb; |
5854 | 5854 | |
5855 | - $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 ) ); |
|
5856 | - $rows = $wpdb->get_results( $sql ); |
|
5855 | + $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)); |
|
5856 | + $rows = $wpdb->get_results($sql); |
|
5857 | 5857 | |
5858 | 5858 | return $rows; |
5859 | 5859 | } |
@@ -5932,14 +5932,14 @@ discard block |
||
5932 | 5932 | global $wpdb, $plugin_prefix; |
5933 | 5933 | |
5934 | 5934 | $post_type = get_post_type($master_post_id); |
5935 | - $post_table = $plugin_prefix . $post_type . '_detail'; |
|
5935 | + $post_table = $plugin_prefix.$post_type.'_detail'; |
|
5936 | 5936 | |
5937 | - $query = $wpdb->prepare("SELECT * FROM " . $post_table . " WHERE post_id = %d", array($master_post_id)); |
|
5938 | - $data = (array)$wpdb->get_row($query); |
|
5937 | + $query = $wpdb->prepare("SELECT * FROM ".$post_table." WHERE post_id = %d", array($master_post_id)); |
|
5938 | + $data = (array) $wpdb->get_row($query); |
|
5939 | 5939 | |
5940 | - if ( !empty( $data ) ) { |
|
5940 | + if (!empty($data)) { |
|
5941 | 5941 | $data['post_id'] = $tr_post_id; |
5942 | - unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type . 'category'], $data['overall_rating'], $data['rating_count'], $data['ratings']); |
|
5942 | + unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type.'category'], $data['overall_rating'], $data['rating_count'], $data['ratings']); |
|
5943 | 5943 | |
5944 | 5944 | $wpdb->update($post_table, $data, array('post_id' => $tr_post_id)); |
5945 | 5945 | return true; |
@@ -5965,7 +5965,7 @@ discard block |
||
5965 | 5965 | global $sitepress, $wpdb; |
5966 | 5966 | $post_type = get_post_type($master_post_id); |
5967 | 5967 | |
5968 | - remove_filter('get_term', array($sitepress,'get_term_adjust_id')); // AVOID filtering to current language |
|
5968 | + remove_filter('get_term', array($sitepress, 'get_term_adjust_id')); // AVOID filtering to current language |
|
5969 | 5969 | |
5970 | 5970 | $taxonomies = get_object_taxonomies($post_type); |
5971 | 5971 | foreach ($taxonomies as $taxonomy) { |
@@ -5974,9 +5974,9 @@ discard block |
||
5974 | 5974 | |
5975 | 5975 | if ($terms) { |
5976 | 5976 | foreach ($terms as $term) { |
5977 | - $tr_id = apply_filters( 'translate_object_id',$term->term_id, $taxonomy, false, $lang); |
|
5977 | + $tr_id = apply_filters('translate_object_id', $term->term_id, $taxonomy, false, $lang); |
|
5978 | 5978 | |
5979 | - if (!is_null($tr_id)){ |
|
5979 | + if (!is_null($tr_id)) { |
|
5980 | 5980 | // not using get_term - unfiltered get_term |
5981 | 5981 | $translated_term = $wpdb->get_row($wpdb->prepare(" |
5982 | 5982 | 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)); |
@@ -5985,14 +5985,14 @@ discard block |
||
5985 | 5985 | } |
5986 | 5986 | } |
5987 | 5987 | |
5988 | - if (!is_taxonomy_hierarchical($taxonomy)){ |
|
5989 | - $terms_array = array_unique( array_map( 'intval', $terms_array ) ); |
|
5988 | + if (!is_taxonomy_hierarchical($taxonomy)) { |
|
5989 | + $terms_array = array_unique(array_map('intval', $terms_array)); |
|
5990 | 5990 | } |
5991 | 5991 | |
5992 | 5992 | wp_set_post_terms($tr_post_id, $terms_array, $taxonomy); |
5993 | 5993 | |
5994 | - if ($taxonomy == $post_type . 'category') { |
|
5995 | - geodir_set_postcat_structure($tr_post_id, $post_type . 'category'); |
|
5994 | + if ($taxonomy == $post_type.'category') { |
|
5995 | + geodir_set_postcat_structure($tr_post_id, $post_type.'category'); |
|
5996 | 5996 | } |
5997 | 5997 | } |
5998 | 5998 | } |
@@ -6013,15 +6013,15 @@ discard block |
||
6013 | 6013 | function geodir_icl_duplicate_post_images($master_post_id, $tr_post_id, $lang) { |
6014 | 6014 | global $wpdb; |
6015 | 6015 | |
6016 | - $query = $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id)); |
|
6016 | + $query = $wpdb->prepare("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id)); |
|
6017 | 6017 | $wpdb->query($query); |
6018 | 6018 | |
6019 | - $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)); |
|
6019 | + $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)); |
|
6020 | 6020 | $post_images = $wpdb->get_results($query); |
6021 | 6021 | |
6022 | - if ( !empty( $post_images ) ) { |
|
6023 | - foreach ( $post_images as $post_image) { |
|
6024 | - $image_data = (array)$post_image; |
|
6022 | + if (!empty($post_images)) { |
|
6023 | + foreach ($post_images as $post_image) { |
|
6024 | + $image_data = (array) $post_image; |
|
6025 | 6025 | unset($image_data['ID']); |
6026 | 6026 | $image_data['post_id'] = $tr_post_id; |
6027 | 6027 | |
@@ -6047,10 +6047,10 @@ discard block |
||
6047 | 6047 | * @return array Event data array. |
6048 | 6048 | */ |
6049 | 6049 | function geodir_imex_get_event_data($post, $gd_post_info) { |
6050 | - $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'] ) ) : ''; |
|
6050 | + $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'])) : ''; |
|
6051 | 6051 | $event_enddate = $event_date; |
6052 | - $starttime = isset( $post['starttime'] ) && $post['starttime'] != '' && $post['starttime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $post['starttime'] ) ) : ''; |
|
6053 | - $endtime = isset( $post['endtime'] ) && $post['endtime'] != '' && $post['endtime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $post['endtime'] ) ) : ''; |
|
6052 | + $starttime = isset($post['starttime']) && $post['starttime'] != '' && $post['starttime'] != '00:00:00' ? date_i18n('H:i', strtotime($post['starttime'])) : ''; |
|
6053 | + $endtime = isset($post['endtime']) && $post['endtime'] != '' && $post['endtime'] != '00:00:00' ? date_i18n('H:i', strtotime($post['endtime'])) : ''; |
|
6054 | 6054 | |
6055 | 6055 | $is_recurring_event = ''; |
6056 | 6056 | $event_duration_days = ''; |
@@ -6067,15 +6067,15 @@ discard block |
||
6067 | 6067 | |
6068 | 6068 | $recurring_data = isset($gd_post_info->recurring_dates) ? maybe_unserialize($gd_post_info->recurring_dates) : array(); |
6069 | 6069 | if (!empty($recurring_data)) { |
6070 | - $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; |
|
6071 | - $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; |
|
6072 | - $starttime = isset( $recurring_data['starttime'] ) && $recurring_data['starttime'] != '' && $recurring_data['starttime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $recurring_data['starttime'] ) ) : $starttime; |
|
6073 | - $endtime = isset( $recurring_data['endtime'] ) && $recurring_data['endtime'] != '' && $recurring_data['endtime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $recurring_data['endtime'] ) ) : $endtime; |
|
6070 | + $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; |
|
6071 | + $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; |
|
6072 | + $starttime = isset($recurring_data['starttime']) && $recurring_data['starttime'] != '' && $recurring_data['starttime'] != '00:00:00' ? date_i18n('H:i', strtotime($recurring_data['starttime'])) : $starttime; |
|
6073 | + $endtime = isset($recurring_data['endtime']) && $recurring_data['endtime'] != '' && $recurring_data['endtime'] != '00:00:00' ? date_i18n('H:i', strtotime($recurring_data['endtime'])) : $endtime; |
|
6074 | 6074 | $is_whole_day_event = !empty($recurring_data['all_day']) ? 1 : ''; |
6075 | 6075 | $different_times = !empty($recurring_data['different_times']) ? true : false; |
6076 | 6076 | |
6077 | - $recurring_pkg = geodir_event_recurring_pkg( $gd_post_info ); |
|
6078 | - $is_recurring = isset( $gd_post_info->is_recurring ) && (int)$gd_post_info->is_recurring == 0 ? false : true; |
|
6077 | + $recurring_pkg = geodir_event_recurring_pkg($gd_post_info); |
|
6078 | + $is_recurring = isset($gd_post_info->is_recurring) && (int) $gd_post_info->is_recurring == 0 ? false : true; |
|
6079 | 6079 | |
6080 | 6080 | if ($recurring_pkg && $is_recurring) { |
6081 | 6081 | $recurring_dates = $event_date; |
@@ -6085,13 +6085,13 @@ discard block |
||
6085 | 6085 | $recurring_type = !empty($recurring_data['repeat_type']) && in_array($recurring_data['repeat_type'], array('day', 'week', 'month', 'year', 'custom')) ? $recurring_data['repeat_type'] : 'custom'; |
6086 | 6086 | |
6087 | 6087 | if (!empty($recurring_data['event_recurring_dates'])) { |
6088 | - $event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] ); |
|
6088 | + $event_recurring_dates = explode(',', $recurring_data['event_recurring_dates']); |
|
6089 | 6089 | |
6090 | 6090 | if (!empty($event_recurring_dates)) { |
6091 | 6091 | $recurring_dates = array(); |
6092 | 6092 | |
6093 | 6093 | foreach ($event_recurring_dates as $date) { |
6094 | - $recurring_dates[] = date_i18n( 'd/m/Y', strtotime( $date ) ); |
|
6094 | + $recurring_dates[] = date_i18n('d/m/Y', strtotime($date)); |
|
6095 | 6095 | } |
6096 | 6096 | |
6097 | 6097 | $recurring_dates = implode(",", $recurring_dates); |
@@ -6107,7 +6107,7 @@ discard block |
||
6107 | 6107 | $times = array(); |
6108 | 6108 | |
6109 | 6109 | foreach ($recurring_data['starttimes'] as $time) { |
6110 | - $times[] = $time != '00:00:00' ? date_i18n( 'H:i', strtotime( $time ) ) : '00:00'; |
|
6110 | + $times[] = $time != '00:00:00' ? date_i18n('H:i', strtotime($time)) : '00:00'; |
|
6111 | 6111 | } |
6112 | 6112 | |
6113 | 6113 | $event_starttimes = implode(",", $times); |
@@ -6117,7 +6117,7 @@ discard block |
||
6117 | 6117 | $times = array(); |
6118 | 6118 | |
6119 | 6119 | foreach ($recurring_data['endtimes'] as $time) { |
6120 | - $times[] = $time != '00:00:00' ? date_i18n( 'H:i', strtotime( $time ) ) : '00:00'; |
|
6120 | + $times[] = $time != '00:00:00' ? date_i18n('H:i', strtotime($time)) : '00:00'; |
|
6121 | 6121 | } |
6122 | 6122 | |
6123 | 6123 | $event_endtimes = implode(",", $times); |
@@ -6129,8 +6129,8 @@ discard block |
||
6129 | 6129 | } |
6130 | 6130 | } |
6131 | 6131 | } else { |
6132 | - $event_duration_days = isset($recurring_data['duration_x']) ? (int)$recurring_data['duration_x'] : 1; |
|
6133 | - $recurring_interval = !empty($recurring_data['repeat_x']) && (int)$recurring_data['repeat_x'] > 0 ? $recurring_data['repeat_x'] : 1; |
|
6132 | + $event_duration_days = isset($recurring_data['duration_x']) ? (int) $recurring_data['duration_x'] : 1; |
|
6133 | + $recurring_interval = !empty($recurring_data['repeat_x']) && (int) $recurring_data['repeat_x'] > 0 ? $recurring_data['repeat_x'] : 1; |
|
6134 | 6134 | |
6135 | 6135 | if (($recurring_type == 'week' || $recurring_type == 'month') && !empty($recurring_data['repeat_days'])) { |
6136 | 6136 | $week_days = array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'); |
@@ -6146,11 +6146,11 @@ discard block |
||
6146 | 6146 | } |
6147 | 6147 | |
6148 | 6148 | $recurring_week_nos = $recurring_type == 'month' && !empty($recurring_data['repeat_weeks']) ? implode(",", $recurring_data['repeat_weeks']) : $recurring_week_nos; |
6149 | - if (!empty($recurring_data['repeat_end_type']) && (int)$recurring_data['repeat_end_type'] == 1) { |
|
6150 | - $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'] ) ) : ''; |
|
6149 | + if (!empty($recurring_data['repeat_end_type']) && (int) $recurring_data['repeat_end_type'] == 1) { |
|
6150 | + $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'])) : ''; |
|
6151 | 6151 | $max_recurring_count = empty($recurring_end_date) ? 1 : ''; |
6152 | 6152 | } else { |
6153 | - $max_recurring_count = (!empty($recurring_data['max_repeat']) && (int)$recurring_data['max_repeat'] > 0 ? (int)$recurring_data['max_repeat'] : 1); |
|
6153 | + $max_recurring_count = (!empty($recurring_data['max_repeat']) && (int) $recurring_data['max_repeat'] > 0 ? (int) $recurring_data['max_repeat'] : 1); |
|
6154 | 6154 | } |
6155 | 6155 | } |
6156 | 6156 | } |
@@ -6214,9 +6214,9 @@ discard block |
||
6214 | 6214 | * @return array Event data array. |
6215 | 6215 | */ |
6216 | 6216 | function geodir_imex_process_event_data($gd_post) { |
6217 | - $recurring_pkg = geodir_event_recurring_pkg( (object)$gd_post ); |
|
6217 | + $recurring_pkg = geodir_event_recurring_pkg((object) $gd_post); |
|
6218 | 6218 | |
6219 | - $is_recurring = isset( $gd_post['is_recurring_event'] ) && (int)$gd_post['is_recurring_event'] == 0 ? false : true; |
|
6219 | + $is_recurring = isset($gd_post['is_recurring_event']) && (int) $gd_post['is_recurring_event'] == 0 ? false : true; |
|
6220 | 6220 | $event_date = isset($gd_post['event_date']) && $gd_post['event_date'] != '' ? geodir_imex_get_date_ymd($gd_post['event_date']) : ''; |
6221 | 6221 | $event_enddate = isset($gd_post['event_enddate']) && $gd_post['event_enddate'] != '' ? geodir_imex_get_date_ymd($gd_post['event_enddate']) : $event_date; |
6222 | 6222 | $all_day = isset($gd_post['is_whole_day_event']) && !empty($gd_post['is_whole_day_event']) ? true : false; |
@@ -6263,17 +6263,17 @@ discard block |
||
6263 | 6263 | $event_recurring_dates = implode(",", $event_recurring_dates); |
6264 | 6264 | } |
6265 | 6265 | } else { |
6266 | - $duration_x = !empty( $gd_post['event_duration_days'] ) ? (int)$gd_post['event_duration_days'] : 1; |
|
6267 | - $repeat_x = !empty( $gd_post['recurring_interval'] ) ? (int)$gd_post['recurring_interval'] : 1; |
|
6268 | - $max_repeat = !empty( $gd_post['max_recurring_count'] ) ? (int)$gd_post['max_recurring_count'] : 1; |
|
6269 | - $repeat_end = !empty( $gd_post['recurring_end_date'] ) ? geodir_imex_get_date_ymd($gd_post['recurring_end_date']) : ''; |
|
6266 | + $duration_x = !empty($gd_post['event_duration_days']) ? (int) $gd_post['event_duration_days'] : 1; |
|
6267 | + $repeat_x = !empty($gd_post['recurring_interval']) ? (int) $gd_post['recurring_interval'] : 1; |
|
6268 | + $max_repeat = !empty($gd_post['max_recurring_count']) ? (int) $gd_post['max_recurring_count'] : 1; |
|
6269 | + $repeat_end = !empty($gd_post['recurring_end_date']) ? geodir_imex_get_date_ymd($gd_post['recurring_end_date']) : ''; |
|
6270 | 6270 | |
6271 | 6271 | $repeat_end_type = $repeat_end != '' ? 1 : 0; |
6272 | 6272 | $max_repeat = $repeat_end != '' ? '' : $max_repeat; |
6273 | 6273 | |
6274 | 6274 | $week_days = array_flip(array('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat')); |
6275 | 6275 | |
6276 | - $a_repeat_days = isset($gd_post['recurring_week_days']) && trim($gd_post['recurring_week_days'])!='' ? explode(',', trim($gd_post['recurring_week_days'])) : array(); |
|
6276 | + $a_repeat_days = isset($gd_post['recurring_week_days']) && trim($gd_post['recurring_week_days']) != '' ? explode(',', trim($gd_post['recurring_week_days'])) : array(); |
|
6277 | 6277 | $repeat_days = array(); |
6278 | 6278 | if (!empty($a_repeat_days)) { |
6279 | 6279 | foreach ($a_repeat_days as $repeat_day) { |
@@ -6291,7 +6291,7 @@ discard block |
||
6291 | 6291 | $repeat_weeks = array(); |
6292 | 6292 | if (!empty($a_repeat_weeks)) { |
6293 | 6293 | foreach ($a_repeat_weeks as $repeat_week) { |
6294 | - $repeat_weeks[] = (int)$repeat_week; |
|
6294 | + $repeat_weeks[] = (int) $repeat_week; |
|
6295 | 6295 | } |
6296 | 6296 | |
6297 | 6297 | $repeat_weeks = array_unique($repeat_weeks); |
@@ -6355,7 +6355,7 @@ discard block |
||
6355 | 6355 | |
6356 | 6356 | $page_found = $wpdb->get_var( |
6357 | 6357 | $wpdb->prepare( |
6358 | - "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;", |
|
6358 | + "SELECT ID FROM ".$wpdb->posts." WHERE post_name = %s LIMIT 1;", |
|
6359 | 6359 | array($slug) |
6360 | 6360 | ) |
6361 | 6361 | ); |
@@ -6410,7 +6410,7 @@ discard block |
||
6410 | 6410 | */ |
6411 | 6411 | function geodir_admin_upgrade_notice() { |
6412 | 6412 | $class = "error"; |
6413 | - $message = __("Please update core GeoDirectory or some addons may not function correctly.","geodirectory"); |
|
6413 | + $message = __("Please update core GeoDirectory or some addons may not function correctly.", "geodirectory"); |
|
6414 | 6414 | echo"<div class=\"$class\"> <p>$message</p></div>"; |
6415 | 6415 | } |
6416 | 6416 | |
@@ -6422,7 +6422,7 @@ discard block |
||
6422 | 6422 | * @param (object) $r |
6423 | 6423 | * @return (string) $output |
6424 | 6424 | */ |
6425 | -function geodire_admin_upgrade_notice( $plugin_data, $r ) |
|
6425 | +function geodire_admin_upgrade_notice($plugin_data, $r) |
|
6426 | 6426 | { |
6427 | 6427 | // readme contents |
6428 | 6428 | $args = array( |
@@ -6430,7 +6430,7 @@ discard block |
||
6430 | 6430 | 'redirection' => 5 |
6431 | 6431 | ); |
6432 | 6432 | $url = "http://plugins.svn.wordpress.org/geodirectory/trunk/readme.txt"; |
6433 | - $data = wp_remote_get( $url, $args ); |
|
6433 | + $data = wp_remote_get($url, $args); |
|
6434 | 6434 | |
6435 | 6435 | if (!is_wp_error($data) && $data['response']['code'] == 200) { |
6436 | 6436 | |
@@ -6445,20 +6445,20 @@ discard block |
||
6445 | 6445 | function geodir_in_plugin_update_message($content) { |
6446 | 6446 | // Output Upgrade Notice |
6447 | 6447 | $matches = null; |
6448 | - $regexp = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( GEODIRECTORY_VERSION ) . '\s*=|$)~Uis'; |
|
6448 | + $regexp = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*'.preg_quote(GEODIRECTORY_VERSION).'\s*=|$)~Uis'; |
|
6449 | 6449 | $upgrade_notice = ''; |
6450 | - if ( preg_match( $regexp, $content, $matches ) ) { |
|
6451 | - if(empty($matches)){return;} |
|
6450 | + if (preg_match($regexp, $content, $matches)) { |
|
6451 | + if (empty($matches)) {return; } |
|
6452 | 6452 | |
6453 | - $version = trim( $matches[1] ); |
|
6454 | - if($version && $version>GEODIRECTORY_VERSION){ |
|
6453 | + $version = trim($matches[1]); |
|
6454 | + if ($version && $version > GEODIRECTORY_VERSION) { |
|
6455 | 6455 | |
6456 | 6456 | |
6457 | - $notices = (array) preg_split('~[\r\n]+~', trim( $matches[2] ) ); |
|
6458 | - if ( version_compare( GEODIRECTORY_VERSION, $version, '<' ) ) { |
|
6457 | + $notices = (array) preg_split('~[\r\n]+~', trim($matches[2])); |
|
6458 | + if (version_compare(GEODIRECTORY_VERSION, $version, '<')) { |
|
6459 | 6459 | $upgrade_notice .= '<div class="geodir_plugin_upgrade_notice">'; |
6460 | - foreach ( $notices as $index => $line ) { |
|
6461 | - $upgrade_notice .= wp_kses_post( preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line ) ); |
|
6460 | + foreach ($notices as $index => $line) { |
|
6461 | + $upgrade_notice .= wp_kses_post(preg_replace('~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line)); |
|
6462 | 6462 | } |
6463 | 6463 | $upgrade_notice .= '</div> '; |
6464 | 6464 | } |
@@ -6482,7 +6482,7 @@ discard block |
||
6482 | 6482 | $default_language = $sitepress->get_default_language(); |
6483 | 6483 | if ($current_language != 'all' && $current_language != $default_language) { |
6484 | 6484 | ?> |
6485 | - <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> |
|
6485 | + <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> |
|
6486 | 6486 | <?php |
6487 | 6487 | } |
6488 | 6488 | } |
@@ -6497,7 +6497,7 @@ discard block |
||
6497 | 6497 | * @param array Listing statuses to be skipped. |
6498 | 6498 | */ |
6499 | 6499 | function geodir_imex_export_skip_statuses() { |
6500 | - $statuses = array( 'trash', 'auto-draft' ); |
|
6500 | + $statuses = array('trash', 'auto-draft'); |
|
6501 | 6501 | |
6502 | 6502 | /** |
6503 | 6503 | * Filter the statuses to skip during GD export listings. |
@@ -6507,7 +6507,7 @@ discard block |
||
6507 | 6507 | * |
6508 | 6508 | * @param array $statuses Listing statuses to be skipped. |
6509 | 6509 | */ |
6510 | - $statuses = apply_filters( 'geodir_imex_export_skip_statuses', $statuses ); |
|
6510 | + $statuses = apply_filters('geodir_imex_export_skip_statuses', $statuses); |
|
6511 | 6511 | |
6512 | 6512 | return $statuses; |
6513 | 6513 | } |