@@ -480,15 +480,15 @@ discard block |
||
| 480 | 480 | <?php |
| 481 | 481 | |
| 482 | 482 | $default_location = geodir_get_default_location(); |
| 483 | - $city = isset($default_location->city) ? $default_location->city : ''; |
|
| 484 | - $region =isset($default_location->region) ? $default_location->region : ''; |
|
| 485 | - $country =isset($default_location->country) ? $default_location->country : ''; |
|
| 486 | - $city_latitude =isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
| 487 | - $city_longitude =isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
| 483 | + $city = isset($default_location->city) ? $default_location->city : ''; |
|
| 484 | + $region = isset($default_location->region) ? $default_location->region : ''; |
|
| 485 | + $country = isset($default_location->country) ? $default_location->country : ''; |
|
| 486 | + $city_latitude = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
| 487 | + $city_longitude = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
| 488 | 488 | |
| 489 | 489 | ?> |
| 490 | 490 | var geocoder = new google.maps.Geocoder(); |
| 491 | - var CITY_ADDRESS = '<?php echo $city.','.$region.','.$country;?>'; |
|
| 491 | + var CITY_ADDRESS = '<?php echo $city . ',' . $region . ',' . $country; ?>'; |
|
| 492 | 492 | var bound_lat_lng; |
| 493 | 493 | var lat = <?php echo $city_latitude; ?>; |
| 494 | 494 | var lng = <?php echo $city_longitude; ?>; |
@@ -525,7 +525,7 @@ discard block |
||
| 525 | 525 | ); |
| 526 | 526 | |
| 527 | 527 | } else {
|
| 528 | - alert("<?php _e('Geocode was not successful for the following reason:','geodirectory');?> " + status);
|
|
| 528 | + alert("<?php _e('Geocode was not successful for the following reason:', 'geodirectory'); ?> " + status);
|
|
| 529 | 529 | } |
| 530 | 530 | }); |
| 531 | 531 | |
@@ -538,7 +538,7 @@ discard block |
||
| 538 | 538 | var total_dummy_post_count = jQuery('#sub_' + active_tab).find('.selected_sample_data').val();
|
| 539 | 539 | |
| 540 | 540 | if (id == 'geodir_dummy_delete') {
|
| 541 | - if (confirm('<?php _e('Are you sure you want to delete dummy data?' , 'geodirectory'); ?>')) {
|
|
| 541 | + if (confirm('<?php _e('Are you sure you want to delete dummy data?', 'geodirectory'); ?>')) {
|
|
| 542 | 542 | jQuery('#sub_' + active_tab).find('.geodir_auto_install').hide();
|
| 543 | 543 | jQuery('#sub_' + active_tab).find('.geodir_show_progress').show();
|
| 544 | 544 | jQuery.post('<?php echo geodir_get_ajax_url(); ?>&geodir_autofill=' + id + '&posttype=' + posttype + '&_wpnonce=' + nonce,
|
@@ -557,7 +557,7 @@ discard block |
||
| 557 | 557 | 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,
|
| 558 | 558 | function (data) {
|
| 559 | 559 | |
| 560 | - 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 + '');
|
|
| 560 | + 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 + '');
|
|
| 561 | 561 | dummy_post_index++; |
| 562 | 562 | if (dummy_post_index <= total_dummy_post_count) |
| 563 | 563 | geodir_autoinstall(obj, id, nonce, posttype); |
@@ -666,7 +666,7 @@ discard block |
||
| 666 | 666 | else |
| 667 | 667 | $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon'; |
| 668 | 668 | $catname = str_replace(' ', '_', $catname);
|
| 669 | - $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
|
|
| 669 | + $uploaded = (array) fetch_remote_file("$dummy_image_url/" . $catname . ".png");
|
|
| 670 | 670 | |
| 671 | 671 | if (empty($uploaded['error'])) {
|
| 672 | 672 | $new_path = $uploaded['file']; |
@@ -707,7 +707,7 @@ discard block |
||
| 707 | 707 | else |
| 708 | 708 | $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon'; |
| 709 | 709 | $catname = str_replace(' ', '_', $catname);
|
| 710 | - $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
|
|
| 710 | + $uploaded = (array) fetch_remote_file("$dummy_image_url/" . $catname . ".png");
|
|
| 711 | 711 | |
| 712 | 712 | if (empty($uploaded['error'])) {
|
| 713 | 713 | $new_path = $uploaded['file']; |
@@ -1016,7 +1016,7 @@ discard block |
||
| 1016 | 1016 | */ |
| 1017 | 1017 | function geodir_extend_geodirectory_setting_tab($tabs) |
| 1018 | 1018 | {
|
| 1019 | - $tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory'). ' <i class="fa fa-plug"></i>', 'url' => 'http://wpgeodirectory.com', 'target' => '_blank');
|
|
| 1019 | + $tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory') . ' <i class="fa fa-plug"></i>', 'url' => 'http://wpgeodirectory.com', 'target' => '_blank');
|
|
| 1020 | 1020 | return $tabs; |
| 1021 | 1021 | } |
| 1022 | 1022 | |
@@ -1169,7 +1169,7 @@ discard block |
||
| 1169 | 1169 | function geodir_post_information_save($post_id, $post) {
|
| 1170 | 1170 | global $wpdb, $current_user; |
| 1171 | 1171 | |
| 1172 | - if (isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')) {
|
|
| 1172 | + if (isset($post->post_type) && ($post->post_type == 'nav_menu_item' || $post->post_type == 'page' || $post->post_type == 'post')) {
|
|
| 1173 | 1173 | return; |
| 1174 | 1174 | } |
| 1175 | 1175 | |
@@ -1309,7 +1309,7 @@ discard block |
||
| 1309 | 1309 | <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>" |
| 1310 | 1310 | id="<?php echo esc_attr($value['id']); ?>" |
| 1311 | 1311 | type="<?php echo esc_attr($value['type']); ?>" |
| 1312 | - <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
|
|
| 1312 | + <?php if (isset($value['placeholder'])) {?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
|
|
| 1313 | 1313 | style=" <?php echo esc_attr($value['css']); ?>" |
| 1314 | 1314 | value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
|
| 1315 | 1315 | echo esc_attr(stripslashes(get_option($value['id']))); |
@@ -1326,7 +1326,7 @@ discard block |
||
| 1326 | 1326 | <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>" |
| 1327 | 1327 | id="<?php echo esc_attr($value['id']); ?>" |
| 1328 | 1328 | type="<?php echo esc_attr($value['type']); ?>" |
| 1329 | - <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
|
|
| 1329 | + <?php if (isset($value['placeholder'])) {?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
|
|
| 1330 | 1330 | style="<?php echo esc_attr($value['css']); ?>" |
| 1331 | 1331 | value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
|
| 1332 | 1332 | echo esc_attr(stripslashes(get_option($value['id']))); |
@@ -1432,7 +1432,7 @@ discard block |
||
| 1432 | 1432 | id="<?php echo esc_attr($value['id']); ?>" |
| 1433 | 1433 | style="<?php echo esc_attr($value['css']); ?>" |
| 1434 | 1434 | class="<?php if (isset($value['class'])) echo $value['class']; ?>" |
| 1435 | - data-placeholder="<?php if (isset($value['placeholder_text'])) echo $value['placeholder_text'];?>" |
|
| 1435 | + data-placeholder="<?php if (isset($value['placeholder_text'])) echo $value['placeholder_text']; ?>" |
|
| 1436 | 1436 | option-ajaxchosen="false"> |
| 1437 | 1437 | <?php |
| 1438 | 1438 | foreach ($value['options'] as $key => $val) {
|
@@ -1443,7 +1443,7 @@ discard block |
||
| 1443 | 1443 | } else {
|
| 1444 | 1444 | ?> |
| 1445 | 1445 | <option |
| 1446 | - value="<?php echo esc_attr($key); ?>" <?php selected(true, (is_array($option_values) && in_array($key, $option_values)));?>><?php echo ucfirst($val) ?></option> |
|
| 1446 | + value="<?php echo esc_attr($key); ?>" <?php selected(true, (is_array($option_values) && in_array($key, $option_values))); ?>><?php echo ucfirst($val) ?></option> |
|
| 1447 | 1447 | <?php |
| 1448 | 1448 | } |
| 1449 | 1449 | } |
@@ -1478,7 +1478,7 @@ discard block |
||
| 1478 | 1478 | ?> |
| 1479 | 1479 | |
| 1480 | 1480 | <tr valign="top"> |
| 1481 | - <th class="titledesc" width="40%"><?php _e('Default map language', 'geodirectory');?></th>
|
|
| 1481 | + <th class="titledesc" width="40%"><?php _e('Default map language', 'geodirectory'); ?></th>
|
|
| 1482 | 1482 | <td width="60%"> |
| 1483 | 1483 | <select name="geodir_default_map_language" style="width:60%"> |
| 1484 | 1484 | <?php |
@@ -1560,7 +1560,7 @@ discard block |
||
| 1560 | 1560 | |
| 1561 | 1561 | <tr valign="top"> |
| 1562 | 1562 | <th class="titledesc" |
| 1563 | - width="40%"><?php _e('Default post type search on map', 'geodirectory');?></th>
|
|
| 1563 | + width="40%"><?php _e('Default post type search on map', 'geodirectory'); ?></th>
|
|
| 1564 | 1564 | <td width="60%"> |
| 1565 | 1565 | <select name="geodir_default_map_search_pt" style="width:60%"> |
| 1566 | 1566 | <?php |
@@ -1601,7 +1601,7 @@ discard block |
||
| 1601 | 1601 | $cat_display = 'checkbox'; |
| 1602 | 1602 | $gd_post_types = get_option('geodir_exclude_post_type_on_map');
|
| 1603 | 1603 | $gd_cats = get_option('geodir_exclude_cat_on_map');
|
| 1604 | - $gd_cats_upgrade = (int)get_option('geodir_exclude_cat_on_map_upgrade');
|
|
| 1604 | + $gd_cats_upgrade = (int) get_option('geodir_exclude_cat_on_map_upgrade');
|
|
| 1605 | 1605 | $count = 1; |
| 1606 | 1606 | ?> |
| 1607 | 1607 | <table width="70%" class="widefat"> |
@@ -1630,7 +1630,7 @@ discard block |
||
| 1630 | 1630 | name="home_map_post_types[]" |
| 1631 | 1631 | id="<?php echo esc_attr($value['id']); ?>" |
| 1632 | 1632 | value="<?php echo $key; ?>" |
| 1633 | - class="map_post_type" <?php echo $checked;?> /> |
|
| 1633 | + class="map_post_type" <?php echo $checked; ?> /> |
|
| 1634 | 1634 | <?php echo $post_types_obj->labels->singular_name; ?></td> |
| 1635 | 1635 | <td width="40%"> |
| 1636 | 1636 | <div class="home_map_category" style="overflow:auto;width:200px;height:100px;" |
@@ -1688,12 +1688,12 @@ discard block |
||
| 1688 | 1688 | ?> |
| 1689 | 1689 | <fieldset> |
| 1690 | 1690 | <legend class="screen-reader-text"><span><?php echo $value['name'] ?></span></legend> |
| 1691 | - <label for="<?php echo $value['id'];?>"> |
|
| 1691 | + <label for="<?php echo $value['id']; ?>"> |
|
| 1692 | 1692 | <input name="<?php echo esc_attr($value['id']); ?>" |
| 1693 | 1693 | id="<?php echo esc_attr($value['id'] . $value['value']); ?>" type="radio" |
| 1694 | 1694 | value="<?php echo $value['value'] ?>" <?php if (get_option($value['id']) == $value['value']) {
|
| 1695 | 1695 | echo 'checked="checked"'; |
| 1696 | - }elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
|
|
| 1696 | + }elseif (get_option($value['id']) == '' && $value['std'] == $value['value']) {echo 'checked="checked"'; } ?> />
|
|
| 1697 | 1697 | <?php echo $value['desc']; ?></label><br> |
| 1698 | 1698 | </fieldset> |
| 1699 | 1699 | <?php |
@@ -1715,7 +1715,7 @@ discard block |
||
| 1715 | 1715 | <textarea |
| 1716 | 1716 | <?php if (isset($value['args'])) echo $value['args'] . ' '; ?>name="<?php echo esc_attr($value['id']); ?>" |
| 1717 | 1717 | id="<?php echo esc_attr($value['id']); ?>" |
| 1718 | - <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
|
|
| 1718 | + <?php if (isset($value['placeholder'])) {?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
|
|
| 1719 | 1719 | 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 |
| 1720 | 1720 | class="description"><?php echo $value['desc'] ?></span> |
| 1721 | 1721 | |
@@ -1762,7 +1762,7 @@ discard block |
||
| 1762 | 1762 | } |
| 1763 | 1763 | } |
| 1764 | 1764 | // |
| 1765 | - $page_setting = (int)get_option($value['id']); |
|
| 1765 | + $page_setting = (int) get_option($value['id']); |
|
| 1766 | 1766 | |
| 1767 | 1767 | $args = array('name' => $value['id'],
|
| 1768 | 1768 | 'id' => $value['id'], |
@@ -1789,7 +1789,7 @@ discard block |
||
| 1789 | 1789 | break; |
| 1790 | 1790 | case 'single_select_country' : |
| 1791 | 1791 | $countries = $geodirectory->countries->countries; |
| 1792 | - $country_setting = (string)get_option($value['id']); |
|
| 1792 | + $country_setting = (string) get_option($value['id']); |
|
| 1793 | 1793 | if (strstr($country_setting, ':')) : |
| 1794 | 1794 | $country = current(explode(':', $country_setting));
|
| 1795 | 1795 | $state = end(explode(':', $country_setting));
|
@@ -1812,7 +1812,7 @@ discard block |
||
| 1812 | 1812 | case 'multi_select_countries' : |
| 1813 | 1813 | $countries = $geodirectory->countries->countries; |
| 1814 | 1814 | asort($countries); |
| 1815 | - $selections = (array)get_option($value['id']); |
|
| 1815 | + $selections = (array) get_option($value['id']); |
|
| 1816 | 1816 | ?> |
| 1817 | 1817 | <tr valign="top"> |
| 1818 | 1818 | <th scope="row" class="titledesc"><?php echo $value['name'] ?></th> |
@@ -1834,8 +1834,8 @@ discard block |
||
| 1834 | 1834 | break; |
| 1835 | 1835 | |
| 1836 | 1836 | case 'google_analytics' : |
| 1837 | - $selections = (array)get_option($value['id']); |
|
| 1838 | - if(get_option('geodir_ga_client_id') && get_option('geodir_ga_client_secret') ) {
|
|
| 1837 | + $selections = (array) get_option($value['id']); |
|
| 1838 | + if (get_option('geodir_ga_client_id') && get_option('geodir_ga_client_secret')) {
|
|
| 1839 | 1839 | ?> |
| 1840 | 1840 | <tr valign="top"> |
| 1841 | 1841 | <th scope="row" class="titledesc"><?php echo $value['name'] ?></th> |
@@ -1846,10 +1846,10 @@ discard block |
||
| 1846 | 1846 | |
| 1847 | 1847 | $oAuthURL = "https://accounts.google.com/o/oauth2/auth?"; |
| 1848 | 1848 | $scope = "scope=https://www.googleapis.com/auth/analytics.readonly"; |
| 1849 | - $state = "&state=123";//any string |
|
| 1849 | + $state = "&state=123"; //any string |
|
| 1850 | 1850 | $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
|
| 1851 | 1851 | $response_type = "&response_type=code"; |
| 1852 | - $client_id = "&client_id=".get_option('geodir_ga_client_id');
|
|
| 1852 | + $client_id = "&client_id=" . get_option('geodir_ga_client_id');
|
|
| 1853 | 1853 | $access_type = "&access_type=offline"; |
| 1854 | 1854 | $approval_prompt = "&approval_prompt=force"; |
| 1855 | 1855 | |
@@ -1859,7 +1859,7 @@ discard block |
||
| 1859 | 1859 | ?> |
| 1860 | 1860 | <script> |
| 1861 | 1861 | function gd_ga_popup() {
|
| 1862 | - var win = window.open("<?php echo $auth_url;?>", "Google Analytics", "");
|
|
| 1862 | + var win = window.open("<?php echo $auth_url; ?>", "Google Analytics", "");
|
|
| 1863 | 1863 | var pollTimer = window.setInterval(function () {
|
| 1864 | 1864 | if (win.closed !== false) { // !== is required for compatibility with Opera
|
| 1865 | 1865 | window.clearInterval(pollTimer); |
@@ -1881,7 +1881,7 @@ discard block |
||
| 1881 | 1881 | } else {
|
| 1882 | 1882 | ?> |
| 1883 | 1883 | <span class="button-primary" |
| 1884 | - onclick="gd_ga_popup();"><?php _e('Authorize', 'geodirectory');?></span>
|
|
| 1884 | + onclick="gd_ga_popup();"><?php _e('Authorize', 'geodirectory'); ?></span>
|
|
| 1885 | 1885 | <?php |
| 1886 | 1886 | } |
| 1887 | 1887 | ?> |
@@ -1952,9 +1952,9 @@ discard block |
||
| 1952 | 1952 | |
| 1953 | 1953 | <?php if (isset($_REQUEST['active_tab']) && $_REQUEST['active_tab'] != '') { ?>
|
| 1954 | 1954 | jQuery('.geodir_option_tabs').removeClass('gd-tab-active');
|
| 1955 | - jQuery('#<?php echo sanitize_text_field($_REQUEST['active_tab']);?>').addClass('gd-tab-active');
|
|
| 1955 | + jQuery('#<?php echo sanitize_text_field($_REQUEST['active_tab']); ?>').addClass('gd-tab-active');
|
|
| 1956 | 1956 | jQuery('.gd-content-heading').hide();
|
| 1957 | - jQuery('#sub_<?php echo sanitize_text_field($_REQUEST['active_tab']);?>').show();
|
|
| 1957 | + jQuery('#sub_<?php echo sanitize_text_field($_REQUEST['active_tab']); ?>').show();
|
|
| 1958 | 1958 | <?php } ?> |
| 1959 | 1959 | }); |
| 1960 | 1960 | </script> |
@@ -2096,7 +2096,7 @@ discard block |
||
| 2096 | 2096 | <div |
| 2097 | 2097 | class="plupload-upload-uic hide-if-no-js <?php if ($multiple): ?>plupload-upload-uic-multiple<?php endif; ?>" |
| 2098 | 2098 | id="<?php echo $id; ?>plupload-upload-ui"> |
| 2099 | - <h4><?php _e('Drop files to upload', 'geodirectory');?></h4>
|
|
| 2099 | + <h4><?php _e('Drop files to upload', 'geodirectory'); ?></h4>
|
|
| 2100 | 2100 | <input id="<?php echo $id; ?>plupload-browse-button" type="button" |
| 2101 | 2101 | value="<?php _e('Select Files', 'geodirectory'); ?>" class="button"/>
|
| 2102 | 2102 | <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce($id . 'pluploadan'); ?>"></span> |
@@ -2111,7 +2111,7 @@ discard block |
||
| 2111 | 2111 | id="<?php echo $id; ?>plupload-thumbs" style="border-top:1px solid #ccc; padding-top:10px;"> |
| 2112 | 2112 | </div> |
| 2113 | 2113 | <span |
| 2114 | - id="upload-msg"><?php _e('Please drag & drop the images to rearrange the order', 'geodirectory');?></span>
|
|
| 2114 | + id="upload-msg"><?php _e('Please drag & drop the images to rearrange the order', 'geodirectory'); ?></span>
|
|
| 2115 | 2115 | <span id="<?php echo $id; ?>upload-error" style="display:none"></span> |
| 2116 | 2116 | </div> |
| 2117 | 2117 | |
@@ -2489,11 +2489,11 @@ discard block |
||
| 2489 | 2489 | function geodir_hide_admin_preview_button() {
|
| 2490 | 2490 | global $post_type; |
| 2491 | 2491 | $post_types = geodir_get_posttypes(); |
| 2492 | - if(in_array($post_type, $post_types)) |
|
| 2492 | + if (in_array($post_type, $post_types)) |
|
| 2493 | 2493 | echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
|
| 2494 | 2494 | } |
| 2495 | -add_action( 'admin_head-post-new.php', 'geodir_hide_admin_preview_button' ); |
|
| 2496 | -add_action( 'admin_head-post.php', 'geodir_hide_admin_preview_button' ); |
|
| 2495 | +add_action('admin_head-post-new.php', 'geodir_hide_admin_preview_button');
|
|
| 2496 | +add_action('admin_head-post.php', 'geodir_hide_admin_preview_button');
|
|
| 2497 | 2497 | |
| 2498 | 2498 | /** |
| 2499 | 2499 | * Add the tab in left sidebar menu fro import & export page. |
@@ -2503,8 +2503,8 @@ discard block |
||
| 2503 | 2503 | * |
| 2504 | 2504 | * @return array Array of tab data. |
| 2505 | 2505 | */ |
| 2506 | -function geodir_import_export_tab( $tabs ) {
|
|
| 2507 | - $tabs['import_export'] = array( 'label' => __( 'Import & Export', 'geodirectory' ) ); |
|
| 2506 | +function geodir_import_export_tab($tabs) {
|
|
| 2507 | + $tabs['import_export'] = array('label' => __('Import & Export', 'geodirectory'));
|
|
| 2508 | 2508 | return $tabs; |
| 2509 | 2509 | } |
| 2510 | 2510 | |
@@ -2518,7 +2518,7 @@ discard block |
||
| 2518 | 2518 | * @return string Html content. |
| 2519 | 2519 | */ |
| 2520 | 2520 | function geodir_import_export_page() {
|
| 2521 | - $nonce = wp_create_nonce( 'geodir_import_export_nonce' ); |
|
| 2521 | + $nonce = wp_create_nonce('geodir_import_export_nonce');
|
|
| 2522 | 2522 | $gd_cats_sample_csv = geodir_plugin_url() . '/geodirectory-assets/gd_sample_categories.csv'; |
| 2523 | 2523 | /** |
| 2524 | 2524 | * Filter sample category data csv file url. |
@@ -2528,7 +2528,7 @@ discard block |
||
| 2528 | 2528 | * |
| 2529 | 2529 | * @param string $gd_cats_sample_csv Sample category data csv file url. |
| 2530 | 2530 | */ |
| 2531 | - $gd_cats_sample_csv = apply_filters( 'geodir_export_cats_sample_csv', $gd_cats_sample_csv ); |
|
| 2531 | + $gd_cats_sample_csv = apply_filters('geodir_export_cats_sample_csv', $gd_cats_sample_csv);
|
|
| 2532 | 2532 | |
| 2533 | 2533 | $gd_posts_sample_csv = geodir_plugin_url() . '/geodirectory-assets/place_listing.csv'; |
| 2534 | 2534 | /** |
@@ -2539,15 +2539,15 @@ discard block |
||
| 2539 | 2539 | * |
| 2540 | 2540 | * @param string $gd_posts_sample_csv Sample post data csv file url. |
| 2541 | 2541 | */ |
| 2542 | - $gd_posts_sample_csv = apply_filters( 'geodir_export_posts_sample_csv', $gd_posts_sample_csv ); |
|
| 2542 | + $gd_posts_sample_csv = apply_filters('geodir_export_posts_sample_csv', $gd_posts_sample_csv);
|
|
| 2543 | 2543 | |
| 2544 | - $gd_posttypes = geodir_get_posttypes( 'array' ); |
|
| 2544 | + $gd_posttypes = geodir_get_posttypes('array');
|
|
| 2545 | 2545 | |
| 2546 | 2546 | $gd_posttypes_option = ''; |
| 2547 | - foreach ( $gd_posttypes as $gd_posttype => $row ) {
|
|
| 2548 | - $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>'; |
|
| 2547 | + foreach ($gd_posttypes as $gd_posttype => $row) {
|
|
| 2548 | + $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>'; |
|
| 2549 | 2549 | } |
| 2550 | - wp_enqueue_script( 'jquery-ui-progressbar' ); |
|
| 2550 | + wp_enqueue_script('jquery-ui-progressbar');
|
|
| 2551 | 2551 | |
| 2552 | 2552 | $gd_chunksize_options = array(); |
| 2553 | 2553 | $gd_chunksize_options[100] = 100; |
@@ -2569,7 +2569,7 @@ discard block |
||
| 2569 | 2569 | * |
| 2570 | 2570 | * @param string $gd_chunksize_options Entries options. |
| 2571 | 2571 | */ |
| 2572 | - $gd_chunksize_options = apply_filters( 'geodir_export_csv_chunksize_options', $gd_chunksize_options ); |
|
| 2572 | + $gd_chunksize_options = apply_filters('geodir_export_csv_chunksize_options', $gd_chunksize_options);
|
|
| 2573 | 2573 | |
| 2574 | 2574 | $gd_chunksize_option = ''; |
| 2575 | 2575 | foreach ($gd_chunksize_options as $value => $title) {
|
@@ -2580,38 +2580,38 @@ discard block |
||
| 2580 | 2580 | ?> |
| 2581 | 2581 | </form> |
| 2582 | 2582 | <div class="inner_content_tab_main gd-import-export"> |
| 2583 | - <h3><?php _e( 'GD Import & Export CSV', 'geodirectory' ) ;?></h3> |
|
| 2584 | - <span class="description"><?php _e( 'Import & export csv for GD listings & categories.', 'geodirectory' ) ;?></span> |
|
| 2583 | + <h3><?php _e('GD Import & Export CSV', 'geodirectory'); ?></h3>
|
|
| 2584 | + <span class="description"><?php _e('Import & export csv for GD listings & categories.', 'geodirectory'); ?></span>
|
|
| 2585 | 2585 | <div class="gd-content-heading"> |
| 2586 | 2586 | |
| 2587 | 2587 | <?php |
| 2588 | 2588 | ini_set('max_execution_time', 999999);
|
| 2589 | - $ini_max_execution_time_check = @ini_get( 'max_execution_time' ); |
|
| 2589 | + $ini_max_execution_time_check = @ini_get('max_execution_time');
|
|
| 2590 | 2590 | ini_restore('max_execution_time');
|
| 2591 | 2591 | |
| 2592 | - if($ini_max_execution_time_check != 999999){ // only show these setting to the user if we can't change the ini setting
|
|
| 2592 | + if ($ini_max_execution_time_check != 999999) { // only show these setting to the user if we can't change the ini setting
|
|
| 2593 | 2593 | ?> |
| 2594 | 2594 | <div id="gd_ie_reqs" class="metabox-holder"> |
| 2595 | 2595 | <div class="meta-box-sortables ui-sortable"> |
| 2596 | 2596 | <div class="postbox"> |
| 2597 | - <h3 class="hndle"><span style='vertical-align:top;'><?php echo __( 'PHP Requirements for GD Import & Export CSV', 'geodirectory' );?></span></h3> |
|
| 2597 | + <h3 class="hndle"><span style='vertical-align:top;'><?php echo __('PHP Requirements for GD Import & Export CSV', 'geodirectory'); ?></span></h3>
|
|
| 2598 | 2598 | <div class="inside"> |
| 2599 | - <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> |
|
| 2599 | + <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>
|
|
| 2600 | 2600 | <table class="form-table"> |
| 2601 | 2601 | <thead> |
| 2602 | 2602 | <tr> |
| 2603 | - <th><?php _e( 'PHP Settings', 'geodirectory' );?></th><th><?php _e( 'Current Value', 'geodirectory' );?></th><th><?php _e( 'Recommended Value', 'geodirectory' );?></th> |
|
| 2603 | + <th><?php _e('PHP Settings', 'geodirectory'); ?></th><th><?php _e('Current Value', 'geodirectory'); ?></th><th><?php _e('Recommended Value', 'geodirectory'); ?></th>
|
|
| 2604 | 2604 | </tr> |
| 2605 | 2605 | </thead> |
| 2606 | 2606 | <tbody> |
| 2607 | 2607 | <tr> |
| 2608 | - <td>max_input_time</td><td><?php echo @ini_get( 'max_input_time' );?></td><td>3000</td> |
|
| 2608 | + <td>max_input_time</td><td><?php echo @ini_get('max_input_time'); ?></td><td>3000</td>
|
|
| 2609 | 2609 | </tr> |
| 2610 | 2610 | <tr> |
| 2611 | - <td>max_execution_time</td><td><?php echo @ini_get( 'max_execution_time' );?></td><td>3000</td> |
|
| 2611 | + <td>max_execution_time</td><td><?php echo @ini_get('max_execution_time'); ?></td><td>3000</td>
|
|
| 2612 | 2612 | </tr> |
| 2613 | 2613 | <tr> |
| 2614 | - <td>memory_limit</td><td><?php echo @ini_get( 'memory_limit' );?></td><td>256M</td> |
|
| 2614 | + <td>memory_limit</td><td><?php echo @ini_get('memory_limit'); ?></td><td>256M</td>
|
|
| 2615 | 2615 | </tr> |
| 2616 | 2616 | </tbody> |
| 2617 | 2617 | </table> |
@@ -2623,21 +2623,21 @@ discard block |
||
| 2623 | 2623 | <div id="gd_ie_imposts" class="metabox-holder"> |
| 2624 | 2624 | <div class="meta-box-sortables ui-sortable"> |
| 2625 | 2625 | <div id="gd_ie_im_posts" class="postbox gd-hndle-pbox"> |
| 2626 | - <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> |
|
| 2627 | - <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Listings: Import CSV', 'geodirectory' );?></span></h3> |
|
| 2626 | + <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>
|
|
| 2627 | + <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Listings: Import CSV', 'geodirectory'); ?></span></h3>
|
|
| 2628 | 2628 | <div class="inside"> |
| 2629 | 2629 | <table class="form-table"> |
| 2630 | 2630 | <tbody> |
| 2631 | 2631 | <tr> |
| 2632 | 2632 | <td class="gd-imex-box"> |
| 2633 | 2633 | <div class="gd-im-choices"> |
| 2634 | - <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> |
|
| 2635 | - <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> |
|
| 2634 | + <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>
|
|
| 2635 | + <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>
|
|
| 2636 | 2636 | </div> |
| 2637 | 2637 | <div class="plupload-upload-uic hide-if-no-js" id="gd_im_postplupload-upload-ui"> |
| 2638 | 2638 | <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');" />
|
| 2639 | - <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"> |
|
| 2640 | - <input type="hidden" id="gd_ie_imposts_csv" value="<?php echo $gd_posts_sample_csv;?>" /> |
|
| 2639 | + <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">
|
|
| 2640 | + <input type="hidden" id="gd_ie_imposts_csv" value="<?php echo $gd_posts_sample_csv; ?>" /> |
|
| 2641 | 2641 | <?php |
| 2642 | 2642 | /** |
| 2643 | 2643 | * Called just after the sample CSV download link. |
@@ -2646,7 +2646,7 @@ discard block |
||
| 2646 | 2646 | */ |
| 2647 | 2647 | do_action('geodir_sample_csv_download_link');
|
| 2648 | 2648 | ?> |
| 2649 | - <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce( 'gd_im_postpluploadan' ); ?>"></span> |
|
| 2649 | + <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce('gd_im_postpluploadan'); ?>"></span>
|
|
| 2650 | 2650 | <div class="filelist"></div> |
| 2651 | 2651 | </div> |
| 2652 | 2652 | <span id="gd_im_catupload-error" style="display:none"></span> |
@@ -2664,7 +2664,7 @@ discard block |
||
| 2664 | 2664 | <input type="hidden" id="gd_terminateaction" value="continue"/> |
| 2665 | 2665 | </div> |
| 2666 | 2666 | <div class="gd-import-progress" id="gd-import-progress" style="display:none"> |
| 2667 | - <div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory');?> </b><font
|
|
| 2667 | + <div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory'); ?> </b><font
|
|
| 2668 | 2668 | id="gd-import-done">0</font> / <font id="gd-import-total">0</font> ( <font |
| 2669 | 2669 | id="gd-import-perc">0%</font> ) |
| 2670 | 2670 | <div class="gd-fileprogress"></div> |
@@ -2676,10 +2676,10 @@ discard block |
||
| 2676 | 2676 | <div class="gd-imex-btns" style="display:none;"> |
| 2677 | 2677 | <input type="hidden" class="geodir_import_file" name="geodir_import_file" value="save"/> |
| 2678 | 2678 | <input onclick="gd_imex_PrepareImport(this, 'post')" type="button" value="<?php echo CSV_IMPORT_DATA; ?>" id="gd_import_data" class="button-primary" /> |
| 2679 | - <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"/> |
|
| 2680 | - <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')"/>
|
|
| 2679 | + <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"/>
|
|
| 2680 | + <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')"/>
|
|
| 2681 | 2681 | <div id="gd_process_data" style="display:none"> |
| 2682 | - <span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory');?>
|
|
| 2682 | + <span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory'); ?>
|
|
| 2683 | 2683 | </div> |
| 2684 | 2684 | </div> |
| 2685 | 2685 | </td> |
@@ -2693,26 +2693,26 @@ discard block |
||
| 2693 | 2693 | <div id="gd_ie_excategs" class="metabox-holder"> |
| 2694 | 2694 | <div class="meta-box-sortables ui-sortable"> |
| 2695 | 2695 | <div id="gd_ie_ex_posts" class="postbox gd-hndle-pbox"> |
| 2696 | - <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> |
|
| 2697 | - <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Listings: Export CSV', 'geodirectory' );?></span></h3> |
|
| 2696 | + <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>
|
|
| 2697 | + <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Listings: Export CSV', 'geodirectory'); ?></span></h3>
|
|
| 2698 | 2698 | <div class="inside"> |
| 2699 | 2699 | <table class="form-table"> |
| 2700 | 2700 | <tbody> |
| 2701 | 2701 | <tr> |
| 2702 | 2702 | <td class="fld"><label for="gd_post_type"> |
| 2703 | - <?php _e( 'Post Type:', 'geodirectory' );?> |
|
| 2703 | + <?php _e('Post Type:', 'geodirectory'); ?>
|
|
| 2704 | 2704 | </label></td> |
| 2705 | 2705 | <td><select name="gd_post_type" id="gd_post_type" style="min-width:140px"> |
| 2706 | - <?php echo $gd_posttypes_option;?> |
|
| 2706 | + <?php echo $gd_posttypes_option; ?> |
|
| 2707 | 2707 | </select></td> |
| 2708 | 2708 | </tr> |
| 2709 | 2709 | <tr> |
| 2710 | - <td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e( 'Max entries per csv file:', 'geodirectory' );?></label></td> |
|
| 2711 | - <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> |
|
| 2710 | + <td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e('Max entries per csv file:', 'geodirectory'); ?></label></td>
|
|
| 2711 | + <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>
|
|
| 2712 | 2712 | </tr> |
| 2713 | 2713 | <tr> |
| 2714 | 2714 | <td class="fld" style="vertical-align:top"><label> |
| 2715 | - <?php _e( 'Progress:', 'geodirectory' );?> |
|
| 2715 | + <?php _e('Progress:', 'geodirectory'); ?>
|
|
| 2716 | 2716 | </label></td> |
| 2717 | 2717 | <td><div id='gd_progressbar_box'> |
| 2718 | 2718 | <div id="gd_progressbar" class="gd_progressbar"> |
@@ -2720,13 +2720,13 @@ discard block |
||
| 2720 | 2720 | </div> |
| 2721 | 2721 | </div> |
| 2722 | 2722 | <p style="display:inline-block"> |
| 2723 | - <?php _e( 'Elapsed Time:', 'geodirectory' );?> |
|
| 2723 | + <?php _e('Elapsed Time:', 'geodirectory'); ?>
|
|
| 2724 | 2724 | </p> |
| 2725 | 2725 | |
| 2726 | 2726 | <p id="gd_timer" class="gd_timer">00:00:00</p></td> |
| 2727 | 2727 | </tr> |
| 2728 | 2728 | <tr class="gd-ie-actions"> |
| 2729 | - <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"> |
|
| 2729 | + <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">
|
|
| 2730 | 2730 | </td> |
| 2731 | 2731 | <td id="gd_ie_ex_files" class="gd-ie-files"></td> |
| 2732 | 2732 | </tr> |
@@ -2739,21 +2739,21 @@ discard block |
||
| 2739 | 2739 | <div id="gd_ie_imcategs" class="metabox-holder"> |
| 2740 | 2740 | <div class="meta-box-sortables ui-sortable"> |
| 2741 | 2741 | <div id="gd_ie_imcats" class="postbox gd-hndle-pbox"> |
| 2742 | - <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> |
|
| 2743 | - <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Categories: Import CSV', 'geodirectory' );?></span></h3> |
|
| 2742 | + <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>
|
|
| 2743 | + <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Categories: Import CSV', 'geodirectory'); ?></span></h3>
|
|
| 2744 | 2744 | <div class="inside"> |
| 2745 | 2745 | <table class="form-table"> |
| 2746 | 2746 | <tbody> |
| 2747 | 2747 | <tr> |
| 2748 | 2748 | <td class="gd-imex-box"> |
| 2749 | 2749 | <div class="gd-im-choices"> |
| 2750 | - <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> |
|
| 2751 | - <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> |
|
| 2750 | + <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>
|
|
| 2751 | + <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>
|
|
| 2752 | 2752 | </div> |
| 2753 | 2753 | <div class="plupload-upload-uic hide-if-no-js" id="gd_im_catplupload-upload-ui"> |
| 2754 | 2754 | <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');" />
|
| 2755 | - <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"> |
|
| 2756 | - <input type="hidden" id="gd_ie_imcats_csv" value="<?php echo $gd_cats_sample_csv;?>" /> |
|
| 2755 | + <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">
|
|
| 2756 | + <input type="hidden" id="gd_ie_imcats_csv" value="<?php echo $gd_cats_sample_csv; ?>" /> |
|
| 2757 | 2757 | <?php |
| 2758 | 2758 | /** |
| 2759 | 2759 | * Called just after the sample CSV download link. |
@@ -2763,7 +2763,7 @@ discard block |
||
| 2763 | 2763 | */ |
| 2764 | 2764 | do_action('geodir_sample_cats_csv_download_link');
|
| 2765 | 2765 | ?> |
| 2766 | - <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce( 'gd_im_catpluploadan' ); ?>"></span> |
|
| 2766 | + <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce('gd_im_catpluploadan'); ?>"></span>
|
|
| 2767 | 2767 | <div class="filelist"></div> |
| 2768 | 2768 | </div> |
| 2769 | 2769 | <span id="gd_im_catupload-error" style="display:none"></span> |
@@ -2780,7 +2780,7 @@ discard block |
||
| 2780 | 2780 | <input type="hidden" id="gd_terminateaction" value="continue"/> |
| 2781 | 2781 | </div> |
| 2782 | 2782 | <div class="gd-import-progress" id="gd-import-progress" style="display:none"> |
| 2783 | - <div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory');?> </b><font
|
|
| 2783 | + <div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory'); ?> </b><font
|
|
| 2784 | 2784 | id="gd-import-done">0</font> / <font id="gd-import-total">0</font> ( <font |
| 2785 | 2785 | id="gd-import-perc">0%</font> ) |
| 2786 | 2786 | <div class="gd-fileprogress"></div> |
@@ -2792,10 +2792,10 @@ discard block |
||
| 2792 | 2792 | <div class="gd-imex-btns" style="display:none;"> |
| 2793 | 2793 | <input type="hidden" class="geodir_import_file" name="geodir_import_file" value="save"/> |
| 2794 | 2794 | <input onclick="gd_imex_PrepareImport(this, 'cat')" type="button" value="<?php echo CSV_IMPORT_DATA; ?>" id="gd_import_data" class="button-primary" /> |
| 2795 | - <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"/> |
|
| 2796 | - <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')"/>
|
|
| 2795 | + <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"/>
|
|
| 2796 | + <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')"/>
|
|
| 2797 | 2797 | <div id="gd_process_data" style="display:none"> |
| 2798 | - <span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory');?>
|
|
| 2798 | + <span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory'); ?>
|
|
| 2799 | 2799 | </div> |
| 2800 | 2800 | </div> |
| 2801 | 2801 | </td> |
@@ -2809,26 +2809,26 @@ discard block |
||
| 2809 | 2809 | <div id="gd_ie_excategs" class="metabox-holder"> |
| 2810 | 2810 | <div class="meta-box-sortables ui-sortable"> |
| 2811 | 2811 | <div id="gd_ie_ex_cats" class="postbox gd-hndle-pbox"> |
| 2812 | - <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> |
|
| 2813 | - <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Categories: Export CSV', 'geodirectory' );?></span></h3> |
|
| 2812 | + <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>
|
|
| 2813 | + <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Categories: Export CSV', 'geodirectory'); ?></span></h3>
|
|
| 2814 | 2814 | <div class="inside"> |
| 2815 | 2815 | <table class="form-table"> |
| 2816 | 2816 | <tbody> |
| 2817 | 2817 | <tr> |
| 2818 | - <td class="fld"><label for="gd_post_type"><?php _e( 'Post Type:', 'geodirectory' );?></label></td> |
|
| 2819 | - <td><select name="gd_post_type" id="gd_post_type" style="min-width:140px"><?php echo $gd_posttypes_option;?></select></td> |
|
| 2818 | + <td class="fld"><label for="gd_post_type"><?php _e('Post Type:', 'geodirectory'); ?></label></td>
|
|
| 2819 | + <td><select name="gd_post_type" id="gd_post_type" style="min-width:140px"><?php echo $gd_posttypes_option; ?></select></td> |
|
| 2820 | 2820 | </tr> |
| 2821 | 2821 | <tr> |
| 2822 | - <td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e( 'Max entries per csv file:', 'geodirectory' );?></label></td> |
|
| 2823 | - <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> |
|
| 2822 | + <td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e('Max entries per csv file:', 'geodirectory'); ?></label></td>
|
|
| 2823 | + <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>
|
|
| 2824 | 2824 | </tr> |
| 2825 | 2825 | <tr> |
| 2826 | - <td class="fld" style="vertical-align:top"><label><?php _e( 'Progress:', 'geodirectory' );?></label></td> |
|
| 2827 | - <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> |
|
| 2826 | + <td class="fld" style="vertical-align:top"><label><?php _e('Progress:', 'geodirectory'); ?></label></td>
|
|
| 2827 | + <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>
|
|
| 2828 | 2828 | </tr> |
| 2829 | 2829 | <tr class="gd-ie-actions"> |
| 2830 | 2830 | <td style="vertical-align:top"> |
| 2831 | - <input type="submit" value="<?php echo esc_attr( __( 'Export CSV', 'geodirectory' ) );?>" class="button-primary" name="gd_ie_excats_submit" id="gd_ie_excats_submit"> |
|
| 2831 | + <input type="submit" value="<?php echo esc_attr(__('Export CSV', 'geodirectory')); ?>" class="button-primary" name="gd_ie_excats_submit" id="gd_ie_excats_submit">
|
|
| 2832 | 2832 | </td> |
| 2833 | 2833 | <td id="gd_ie_ex_files" class="gd-ie-files"></td> |
| 2834 | 2834 | </tr> |
@@ -2850,7 +2850,7 @@ discard block |
||
| 2850 | 2850 | * @param array $gd_chunksize_options File chunk size options. |
| 2851 | 2851 | * @param string $nonce Wordpress security token for GD import & export. |
| 2852 | 2852 | */ |
| 2853 | - do_action( 'geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce ); |
|
| 2853 | + do_action('geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce);
|
|
| 2854 | 2854 | ?> |
| 2855 | 2855 | </div> |
| 2856 | 2856 | </div> |
@@ -2869,7 +2869,7 @@ discard block |
||
| 2869 | 2869 | jQuery.ajax({
|
| 2870 | 2870 | url: ajaxurl, |
| 2871 | 2871 | type: "POST", |
| 2872 | - data: 'action=geodir_import_export&task=prepare_import&_pt=' + type + '&_file=' + uploadedFile + '&_nonce=<?php echo $nonce;?>', |
|
| 2872 | + data: 'action=geodir_import_export&task=prepare_import&_pt=' + type + '&_file=' + uploadedFile + '&_nonce=<?php echo $nonce; ?>', |
|
| 2873 | 2873 | dataType: 'json', |
| 2874 | 2874 | cache: false, |
| 2875 | 2875 | success: function(data) {
|
@@ -2921,7 +2921,7 @@ discard block |
||
| 2921 | 2921 | |
| 2922 | 2922 | jQuery(cont).find('.filelist .file').remove();
|
| 2923 | 2923 | |
| 2924 | - jQuery('#gd-import-msg', cont).find('#message').removeClass('updated').addClass('error').html("<p><?php echo esc_attr( PLZ_SELECT_CSV_FILE );?></p>");
|
|
| 2924 | + jQuery('#gd-import-msg', cont).find('#message').removeClass('updated').addClass('error').html("<p><?php echo esc_attr(PLZ_SELECT_CSV_FILE); ?></p>");
|
|
| 2925 | 2925 | jQuery('#gd-import-msg', cont).show();
|
| 2926 | 2926 | |
| 2927 | 2927 | return false; |
@@ -2980,7 +2980,7 @@ discard block |
||
| 2980 | 2980 | jQuery.ajax({
|
| 2981 | 2981 | url: ajaxurl, |
| 2982 | 2982 | type: "POST", |
| 2983 | - data: 'action=geodir_import_export&task=import_' + type + '&_pt=' + type + '&_file=' + uploadedFile + gddata + '&_ch=' + choice + '&_nonce=<?php echo $nonce;?>', |
|
| 2983 | + data: 'action=geodir_import_export&task=import_' + type + '&_pt=' + type + '&_file=' + uploadedFile + gddata + '&_ch=' + choice + '&_nonce=<?php echo $nonce; ?>', |
|
| 2984 | 2984 | dataType : 'json', |
| 2985 | 2985 | cache: false, |
| 2986 | 2986 | success: function (data) {
|
@@ -3169,27 +3169,27 @@ discard block |
||
| 3169 | 3169 | |
| 3170 | 3170 | var gdMsg = '<p></p>'; |
| 3171 | 3171 | if ( processed > 0 ) {
|
| 3172 | - var msgParse = '<p><?php echo addslashes( sprintf( __( 'Total %s item(s) found.', 'geodirectory' ), '%s' ) );?></p>'; |
|
| 3172 | + var msgParse = '<p><?php echo addslashes(sprintf(__('Total %s item(s) found.', 'geodirectory'), '%s')); ?></p>';
|
|
| 3173 | 3173 | msgParse = msgParse.replace("%s", processed);
|
| 3174 | 3174 | gdMsg += msgParse; |
| 3175 | 3175 | } |
| 3176 | 3176 | |
| 3177 | 3177 | if ( updated > 0 ) {
|
| 3178 | - var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) updated.', 'geodirectory' ), '%s', '%d' ) );?></p>'; |
|
| 3178 | + var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) updated.', 'geodirectory'), '%s', '%d')); ?></p>';
|
|
| 3179 | 3179 | msgParse = msgParse.replace("%s", updated);
|
| 3180 | 3180 | msgParse = msgParse.replace("%d", processed);
|
| 3181 | 3181 | gdMsg += msgParse; |
| 3182 | 3182 | } |
| 3183 | 3183 | |
| 3184 | 3184 | if ( created > 0 ) {
|
| 3185 | - var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) added.', 'geodirectory' ), '%s', '%d' ) );?></p>'; |
|
| 3185 | + var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) added.', 'geodirectory'), '%s', '%d')); ?></p>';
|
|
| 3186 | 3186 | msgParse = msgParse.replace("%s", created);
|
| 3187 | 3187 | msgParse = msgParse.replace("%d", processed);
|
| 3188 | 3188 | gdMsg += msgParse; |
| 3189 | 3189 | } |
| 3190 | 3190 | |
| 3191 | 3191 | if ( skipped > 0 ) {
|
| 3192 | - var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) ignored due to already exists.', 'geodirectory' ), '%s', '%d' ) );?></p>'; |
|
| 3192 | + var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) ignored due to already exists.', 'geodirectory'), '%s', '%d')); ?></p>';
|
|
| 3193 | 3193 | msgParse = msgParse.replace("%s", skipped);
|
| 3194 | 3194 | msgParse = msgParse.replace("%d", processed);
|
| 3195 | 3195 | gdMsg += msgParse; |
@@ -3199,17 +3199,17 @@ discard block |
||
| 3199 | 3199 | if (type=='loc') {
|
| 3200 | 3200 | invalid_addr = invalid; |
| 3201 | 3201 | } |
| 3202 | - 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>'; |
|
| 3202 | + 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>';
|
|
| 3203 | 3203 | msgParse = msgParse.replace("%s", invalid_addr);
|
| 3204 | 3204 | msgParse = msgParse.replace("%d", total);
|
| 3205 | 3205 | gdMsg += msgParse; |
| 3206 | 3206 | } |
| 3207 | 3207 | |
| 3208 | 3208 | if (invalid > 0 && type!='loc') {
|
| 3209 | - 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>'; |
|
| 3209 | + 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>';
|
|
| 3210 | 3210 | |
| 3211 | 3211 | if (type=='hood') {
|
| 3212 | - 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>'; |
|
| 3212 | + 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>';
|
|
| 3213 | 3213 | } |
| 3214 | 3214 | msgParse = msgParse.replace("%s", invalid);
|
| 3215 | 3215 | msgParse = msgParse.replace("%d", total);
|
@@ -3217,7 +3217,7 @@ discard block |
||
| 3217 | 3217 | } |
| 3218 | 3218 | |
| 3219 | 3219 | if (images > 0) {
|
| 3220 | - gdMsg += '<p><?php echo addslashes( sprintf( CSV_TRANSFER_IMG_FOLDER, $uploads['subdir'] ) );?></p>'; |
|
| 3220 | + gdMsg += '<p><?php echo addslashes(sprintf(CSV_TRANSFER_IMG_FOLDER, $uploads['subdir'])); ?></p>'; |
|
| 3221 | 3221 | } |
| 3222 | 3222 | gdMsg += '<p></p>'; |
| 3223 | 3223 | jQuery('#gd-import-msg', cont).find('#message').removeClass('error').addClass('updated').html(gdMsg);
|
@@ -3374,7 +3374,7 @@ discard block |
||
| 3374 | 3374 | |
| 3375 | 3375 | function gd_process_export_posts(el, post_type, total_posts, chunk_size, pages, page) {
|
| 3376 | 3376 | if (page < 2) {
|
| 3377 | - gd_progressbar(el, 0, '0% (0 / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>'); |
|
| 3377 | + gd_progressbar(el, 0, '0% (0 / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>');
|
|
| 3378 | 3378 | jQuery(el).find('#gd_timer').text('00:00:01');
|
| 3379 | 3379 | jQuery('#gd_ie_ex_files', el).html('');
|
| 3380 | 3380 | } |
@@ -3382,7 +3382,7 @@ discard block |
||
| 3382 | 3382 | jQuery.ajax({
|
| 3383 | 3383 | url: ajaxurl, |
| 3384 | 3384 | type: "POST", |
| 3385 | - data: 'action=geodir_import_export&task=export_posts&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce;?>&_p=' + page, |
|
| 3385 | + data: 'action=geodir_import_export&task=export_posts&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce; ?>&_p=' + page, |
|
| 3386 | 3386 | dataType : 'json', |
| 3387 | 3387 | cache: false, |
| 3388 | 3388 | beforeSend: function (jqXHR, settings) {},
|
@@ -3396,11 +3396,11 @@ discard block |
||
| 3396 | 3396 | } else {
|
| 3397 | 3397 | if (pages < page || pages == page) {
|
| 3398 | 3398 | window.clearInterval(timer_posts); |
| 3399 | - gd_progressbar(el, 100, '100% (' + total_posts + ' / ' + total_posts + ') <i class="fa fa-check"></i><?php echo esc_attr( __( 'Complete!', 'geodirectory' ) );?>');
|
|
| 3399 | + gd_progressbar(el, 100, '100% (' + total_posts + ' / ' + total_posts + ') <i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirectory')); ?>');
|
|
| 3400 | 3400 | } else {
|
| 3401 | 3401 | var percentage = Math.round(((page * chunk_size) / total_posts) * 100); |
| 3402 | 3402 | percentage = percentage > 100 ? 100 : percentage; |
| 3403 | - gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>');
|
|
| 3403 | + gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>');
|
|
| 3404 | 3404 | } |
| 3405 | 3405 | if (typeof data.files != 'undefined' && jQuery(data.files).length ) {
|
| 3406 | 3406 | var obj_files = data.files; |
@@ -3430,7 +3430,7 @@ discard block |
||
| 3430 | 3430 | |
| 3431 | 3431 | function gd_process_export_cats(el, post_type, total_cats, chunk_size, pages, page) {
|
| 3432 | 3432 | if (page < 2) {
|
| 3433 | - gd_progressbar(el, 0, '0% (0 / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>'); |
|
| 3433 | + gd_progressbar(el, 0, '0% (0 / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>');
|
|
| 3434 | 3434 | jQuery(el).find('#gd_timer').text('00:00:01');
|
| 3435 | 3435 | jQuery('#gd_ie_ex_files', el).html('');
|
| 3436 | 3436 | } |
@@ -3438,7 +3438,7 @@ discard block |
||
| 3438 | 3438 | jQuery.ajax({
|
| 3439 | 3439 | url: ajaxurl, |
| 3440 | 3440 | type: "POST", |
| 3441 | - data: 'action=geodir_import_export&task=export_cats&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce;?>&_p=' + page, |
|
| 3441 | + data: 'action=geodir_import_export&task=export_cats&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce; ?>&_p=' + page, |
|
| 3442 | 3442 | dataType : 'json', |
| 3443 | 3443 | cache: false, |
| 3444 | 3444 | beforeSend: function (jqXHR, settings) {},
|
@@ -3452,11 +3452,11 @@ discard block |
||
| 3452 | 3452 | } else {
|
| 3453 | 3453 | if (pages < page || pages == page) {
|
| 3454 | 3454 | window.clearInterval(timer_cats); |
| 3455 | - gd_progressbar(el, 100, '100% (' + total_cats + ' / ' + total_cats + ') <i class="fa fa-check"></i><?php echo esc_attr( __( 'Complete!', 'geodirectory' ) );?>');
|
|
| 3455 | + gd_progressbar(el, 100, '100% (' + total_cats + ' / ' + total_cats + ') <i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirectory')); ?>');
|
|
| 3456 | 3456 | } else {
|
| 3457 | 3457 | var percentage = Math.round(((page * chunk_size) / total_cats) * 100); |
| 3458 | 3458 | percentage = percentage > 100 ? 100 : percentage; |
| 3459 | - gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php esc_attr_e( 'Exporting...', 'geodirectory' );?>');
|
|
| 3459 | + gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php esc_attr_e('Exporting...', 'geodirectory'); ?>');
|
|
| 3460 | 3460 | } |
| 3461 | 3461 | if (typeof data.files != 'undefined' && jQuery(data.files).length ) {
|
| 3462 | 3462 | var obj_files = data.files; |
@@ -3513,8 +3513,8 @@ discard block |
||
| 3513 | 3513 | function geodir_init_filesystem() |
| 3514 | 3514 | {
|
| 3515 | 3515 | |
| 3516 | - if(!function_exists('get_filesystem_method')){
|
|
| 3517 | - require_once(ABSPATH."/wp-admin/includes/file.php"); |
|
| 3516 | + if (!function_exists('get_filesystem_method')) {
|
|
| 3517 | + require_once(ABSPATH . "/wp-admin/includes/file.php"); |
|
| 3518 | 3518 | } |
| 3519 | 3519 | $access_type = get_filesystem_method(); |
| 3520 | 3520 | if ($access_type === 'direct') {
|
@@ -3567,7 +3567,7 @@ discard block |
||
| 3567 | 3567 | * @package GeoDirectory |
| 3568 | 3568 | */ |
| 3569 | 3569 | function geodir_filesystem_notice() |
| 3570 | -{ if ( defined( 'DOING_AJAX' ) ){return;}
|
|
| 3570 | +{ if (defined('DOING_AJAX')) {return; }
|
|
| 3571 | 3571 | $access_type = get_filesystem_method(); |
| 3572 | 3572 | if ($access_type === 'direct') {
|
| 3573 | 3573 | } elseif (!defined('FTP_USER')) {
|
@@ -3604,64 +3604,64 @@ discard block |
||
| 3604 | 3604 | // try to set higher limits for import |
| 3605 | 3605 | $max_input_time = ini_get('max_input_time');
|
| 3606 | 3606 | $max_execution_time = ini_get('max_execution_time');
|
| 3607 | - $memory_limit= ini_get('memory_limit');
|
|
| 3607 | + $memory_limit = ini_get('memory_limit');
|
|
| 3608 | 3608 | |
| 3609 | - if(!$max_input_time || $max_input_time<3000){
|
|
| 3609 | + if (!$max_input_time || $max_input_time < 3000) {
|
|
| 3610 | 3610 | ini_set('max_input_time', 3000);
|
| 3611 | 3611 | } |
| 3612 | 3612 | |
| 3613 | - if(!$max_execution_time || $max_execution_time<3000){
|
|
| 3613 | + if (!$max_execution_time || $max_execution_time < 3000) {
|
|
| 3614 | 3614 | ini_set('max_execution_time', 3000);
|
| 3615 | 3615 | } |
| 3616 | 3616 | |
| 3617 | - if($memory_limit && str_replace('M','',$memory_limit)){
|
|
| 3618 | - if(str_replace('M','',$memory_limit)<256){
|
|
| 3617 | + if ($memory_limit && str_replace('M', '', $memory_limit)) {
|
|
| 3618 | + if (str_replace('M', '', $memory_limit) < 256) {
|
|
| 3619 | 3619 | ini_set('memory_limit', '256M');
|
| 3620 | 3620 | } |
| 3621 | 3621 | } |
| 3622 | 3622 | |
| 3623 | 3623 | $json = array(); |
| 3624 | 3624 | |
| 3625 | - if ( !current_user_can( 'manage_options' ) ) {
|
|
| 3626 | - wp_send_json( $json ); |
|
| 3625 | + if (!current_user_can('manage_options')) {
|
|
| 3626 | + wp_send_json($json); |
|
| 3627 | 3627 | } |
| 3628 | 3628 | |
| 3629 | - $task = isset( $_REQUEST['task'] ) ? $_REQUEST['task'] : NULL; |
|
| 3630 | - $nonce = isset( $_REQUEST['_nonce'] ) ? $_REQUEST['_nonce'] : NULL; |
|
| 3631 | - $stat = isset( $_REQUEST['_st'] ) ? $_REQUEST['_st'] : false; |
|
| 3629 | + $task = isset($_REQUEST['task']) ? $_REQUEST['task'] : NULL; |
|
| 3630 | + $nonce = isset($_REQUEST['_nonce']) ? $_REQUEST['_nonce'] : NULL; |
|
| 3631 | + $stat = isset($_REQUEST['_st']) ? $_REQUEST['_st'] : false; |
|
| 3632 | 3632 | |
| 3633 | - if ( !wp_verify_nonce( $nonce, 'geodir_import_export_nonce' ) ) {
|
|
| 3634 | - wp_send_json( $json ); |
|
| 3633 | + if (!wp_verify_nonce($nonce, 'geodir_import_export_nonce')) {
|
|
| 3634 | + wp_send_json($json); |
|
| 3635 | 3635 | } |
| 3636 | 3636 | |
| 3637 | - $post_type = isset( $_REQUEST['_pt'] ) ? $_REQUEST['_pt'] : NULL; |
|
| 3638 | - $chunk_per_page = isset( $_REQUEST['_n'] ) ? absint($_REQUEST['_n']) : NULL; |
|
| 3637 | + $post_type = isset($_REQUEST['_pt']) ? $_REQUEST['_pt'] : NULL; |
|
| 3638 | + $chunk_per_page = isset($_REQUEST['_n']) ? absint($_REQUEST['_n']) : NULL; |
|
| 3639 | 3639 | $chunk_per_page = $chunk_per_page < 50 || $chunk_per_page > 100000 ? 5000 : $chunk_per_page; |
| 3640 | - $chunk_page_no = isset( $_REQUEST['_p'] ) ? absint($_REQUEST['_p']) : 1; |
|
| 3640 | + $chunk_page_no = isset($_REQUEST['_p']) ? absint($_REQUEST['_p']) : 1; |
|
| 3641 | 3641 | |
| 3642 | 3642 | $wp_filesystem = geodir_init_filesystem(); |
| 3643 | 3643 | if (!$wp_filesystem) {
|
| 3644 | - $json['error'] = __( 'Filesystem ERROR: Could not access filesystem.', 'geodirectory' ); |
|
| 3645 | - wp_send_json( $json ); |
|
| 3644 | + $json['error'] = __('Filesystem ERROR: Could not access filesystem.', 'geodirectory');
|
|
| 3645 | + wp_send_json($json); |
|
| 3646 | 3646 | } |
| 3647 | 3647 | |
| 3648 | 3648 | if (!empty($wp_filesystem) && isset($wp_filesystem->errors) && is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
|
| 3649 | - $json['error'] = __( 'Filesystem ERROR: ' . $wp_filesystem->errors->get_error_message(), 'geodirectory' ); |
|
| 3650 | - wp_send_json( $json ); |
|
| 3649 | + $json['error'] = __('Filesystem ERROR: ' . $wp_filesystem->errors->get_error_message(), 'geodirectory');
|
|
| 3650 | + wp_send_json($json); |
|
| 3651 | 3651 | } |
| 3652 | 3652 | |
| 3653 | - $csv_file_dir = geodir_path_import_export( false ); |
|
| 3654 | - if ( !$wp_filesystem->is_dir( $csv_file_dir ) ) {
|
|
| 3655 | - if ( !$wp_filesystem->mkdir( $csv_file_dir, FS_CHMOD_DIR ) ) {
|
|
| 3656 | - $json['error'] = __( 'ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory' ); |
|
| 3657 | - wp_send_json( $json ); |
|
| 3653 | + $csv_file_dir = geodir_path_import_export(false); |
|
| 3654 | + if (!$wp_filesystem->is_dir($csv_file_dir)) {
|
|
| 3655 | + if (!$wp_filesystem->mkdir($csv_file_dir, FS_CHMOD_DIR)) {
|
|
| 3656 | + $json['error'] = __('ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory');
|
|
| 3657 | + wp_send_json($json); |
|
| 3658 | 3658 | } |
| 3659 | 3659 | } |
| 3660 | 3660 | |
| 3661 | 3661 | $location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
|
| 3662 | 3662 | $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
|
| 3663 | 3663 | |
| 3664 | - switch ( $task ) {
|
|
| 3664 | + switch ($task) {
|
|
| 3665 | 3665 | case 'export_posts': {
|
| 3666 | 3666 | // WPML |
| 3667 | 3667 | $is_wpml = geodir_is_wpml(); |
@@ -3672,12 +3672,12 @@ discard block |
||
| 3672 | 3672 | $sitepress->switch_lang('all', true);
|
| 3673 | 3673 | } |
| 3674 | 3674 | // WPML |
| 3675 | - if ( $post_type == 'gd_event' ) {
|
|
| 3675 | + if ($post_type == 'gd_event') {
|
|
| 3676 | 3676 | //add_filter( 'geodir_imex_count_posts', 'geodir_imex_count_events', 10, 2 ); |
| 3677 | - add_filter( 'geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2 ); |
|
| 3677 | + add_filter('geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2);
|
|
| 3678 | 3678 | } |
| 3679 | - $file_name = $post_type . '_' . date( 'dmyHi' ); |
|
| 3680 | - $posts_count = geodir_get_posts_count( $post_type ); |
|
| 3679 | + $file_name = $post_type . '_' . date('dmyHi');
|
|
| 3680 | + $posts_count = geodir_get_posts_count($post_type); |
|
| 3681 | 3681 | $file_url_base = geodir_path_import_export() . '/'; |
| 3682 | 3682 | $file_url = $file_url_base . $file_name . '.csv'; |
| 3683 | 3683 | $file_path = $csv_file_dir . '/' . $file_name . '.csv'; |
@@ -3685,10 +3685,10 @@ discard block |
||
| 3685 | 3685 | |
| 3686 | 3686 | $chunk_file_paths = array(); |
| 3687 | 3687 | |
| 3688 | - if ( isset( $_REQUEST['_st'] ) ) {
|
|
| 3689 | - $line_count = (int)geodir_import_export_line_count( $file_path_temp ); |
|
| 3690 | - $percentage = count( $posts_count ) > 0 && $line_count > 0 ? ceil( $line_count / $posts_count ) * 100 : 0; |
|
| 3691 | - $percentage = min( $percentage, 100 ); |
|
| 3688 | + if (isset($_REQUEST['_st'])) {
|
|
| 3689 | + $line_count = (int) geodir_import_export_line_count($file_path_temp); |
|
| 3690 | + $percentage = count($posts_count) > 0 && $line_count > 0 ? ceil($line_count / $posts_count) * 100 : 0; |
|
| 3691 | + $percentage = min($percentage, 100); |
|
| 3692 | 3692 | |
| 3693 | 3693 | $json['percentage'] = $percentage; |
| 3694 | 3694 | // WPML |
@@ -3696,45 +3696,45 @@ discard block |
||
| 3696 | 3696 | $sitepress->switch_lang($active_lang, true); |
| 3697 | 3697 | } |
| 3698 | 3698 | // WPML |
| 3699 | - wp_send_json( $json ); |
|
| 3699 | + wp_send_json($json); |
|
| 3700 | 3700 | exit; |
| 3701 | 3701 | } else {
|
| 3702 | - if ( !$posts_count > 0 ) {
|
|
| 3703 | - $json['error'] = __( 'No records to export.', 'geodirectory' ); |
|
| 3702 | + if (!$posts_count > 0) {
|
|
| 3703 | + $json['error'] = __('No records to export.', 'geodirectory');
|
|
| 3704 | 3704 | } else {
|
| 3705 | 3705 | $total_posts = $posts_count; |
| 3706 | 3706 | if ($chunk_per_page > $total_posts) {
|
| 3707 | 3707 | $chunk_per_page = $total_posts; |
| 3708 | 3708 | } |
| 3709 | - $chunk_total_pages = ceil( $total_posts / $chunk_per_page ); |
|
| 3709 | + $chunk_total_pages = ceil($total_posts / $chunk_per_page); |
|
| 3710 | 3710 | |
| 3711 | 3711 | $j = $chunk_page_no; |
| 3712 | - $chunk_save_posts = geodir_imex_get_posts( $post_type, $chunk_per_page, $j ); |
|
| 3712 | + $chunk_save_posts = geodir_imex_get_posts($post_type, $chunk_per_page, $j); |
|
| 3713 | 3713 | |
| 3714 | 3714 | $per_page = 500; |
| 3715 | 3715 | if ($per_page > $chunk_per_page) {
|
| 3716 | 3716 | $per_page = $chunk_per_page; |
| 3717 | 3717 | } |
| 3718 | - $total_pages = ceil( $chunk_per_page / $per_page ); |
|
| 3718 | + $total_pages = ceil($chunk_per_page / $per_page); |
|
| 3719 | 3719 | |
| 3720 | - for ( $i = 0; $i <= $total_pages; $i++ ) {
|
|
| 3721 | - $save_posts = array_slice( $chunk_save_posts , ( $i * $per_page ), $per_page ); |
|
| 3720 | + for ($i = 0; $i <= $total_pages; $i++) {
|
|
| 3721 | + $save_posts = array_slice($chunk_save_posts, ($i * $per_page), $per_page); |
|
| 3722 | 3722 | |
| 3723 | 3723 | $clear = $i == 0 ? true : false; |
| 3724 | - geodir_save_csv_data( $file_path_temp, $save_posts, $clear ); |
|
| 3724 | + geodir_save_csv_data($file_path_temp, $save_posts, $clear); |
|
| 3725 | 3725 | } |
| 3726 | 3726 | |
| 3727 | - if ( $wp_filesystem->exists( $file_path_temp ) ) {
|
|
| 3727 | + if ($wp_filesystem->exists($file_path_temp)) {
|
|
| 3728 | 3728 | $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : ''; |
| 3729 | 3729 | $chunk_file_name = $file_name . $chunk_page_no . '.csv'; |
| 3730 | 3730 | $file_path = $csv_file_dir . '/' . $chunk_file_name; |
| 3731 | - $wp_filesystem->move( $file_path_temp, $file_path, true ); |
|
| 3731 | + $wp_filesystem->move($file_path_temp, $file_path, true); |
|
| 3732 | 3732 | |
| 3733 | 3733 | $file_url = $file_url_base . $chunk_file_name; |
| 3734 | 3734 | $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
| 3735 | 3735 | } |
| 3736 | 3736 | |
| 3737 | - if ( !empty($chunk_file_paths) ) {
|
|
| 3737 | + if (!empty($chunk_file_paths)) {
|
|
| 3738 | 3738 | $json['total'] = $posts_count; |
| 3739 | 3739 | $json['files'] = $chunk_file_paths; |
| 3740 | 3740 | } else {
|
@@ -3742,7 +3742,7 @@ discard block |
||
| 3742 | 3742 | $json['total'] = $items_count; |
| 3743 | 3743 | $json['files'] = array(); |
| 3744 | 3744 | } else {
|
| 3745 | - $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' ); |
|
| 3745 | + $json['error'] = __('ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory');
|
|
| 3746 | 3746 | } |
| 3747 | 3747 | } |
| 3748 | 3748 | } |
@@ -3751,7 +3751,7 @@ discard block |
||
| 3751 | 3751 | $sitepress->switch_lang($active_lang, true); |
| 3752 | 3752 | } |
| 3753 | 3753 | // WPML |
| 3754 | - wp_send_json( $json ); |
|
| 3754 | + wp_send_json($json); |
|
| 3755 | 3755 | } |
| 3756 | 3756 | } |
| 3757 | 3757 | break; |
@@ -3765,9 +3765,9 @@ discard block |
||
| 3765 | 3765 | $sitepress->switch_lang('all', true);
|
| 3766 | 3766 | } |
| 3767 | 3767 | // WPML |
| 3768 | - $file_name = $post_type . 'category_' . date( 'dmyHi' ); |
|
| 3768 | + $file_name = $post_type . 'category_' . date('dmyHi');
|
|
| 3769 | 3769 | |
| 3770 | - $terms_count = geodir_get_terms_count( $post_type ); |
|
| 3770 | + $terms_count = geodir_get_terms_count($post_type); |
|
| 3771 | 3771 | $file_url_base = geodir_path_import_export() . '/'; |
| 3772 | 3772 | $file_url = $file_url_base . $file_name . '.csv'; |
| 3773 | 3773 | $file_path = $csv_file_dir . '/' . $file_name . '.csv'; |
@@ -3775,10 +3775,10 @@ discard block |
||
| 3775 | 3775 | |
| 3776 | 3776 | $chunk_file_paths = array(); |
| 3777 | 3777 | |
| 3778 | - if ( isset( $_REQUEST['_st'] ) ) {
|
|
| 3779 | - $line_count = (int)geodir_import_export_line_count( $file_path_temp ); |
|
| 3780 | - $percentage = count( $terms_count ) > 0 && $line_count > 0 ? ceil( $line_count / $terms_count ) * 100 : 0; |
|
| 3781 | - $percentage = min( $percentage, 100 ); |
|
| 3778 | + if (isset($_REQUEST['_st'])) {
|
|
| 3779 | + $line_count = (int) geodir_import_export_line_count($file_path_temp); |
|
| 3780 | + $percentage = count($terms_count) > 0 && $line_count > 0 ? ceil($line_count / $terms_count) * 100 : 0; |
|
| 3781 | + $percentage = min($percentage, 100); |
|
| 3782 | 3782 | |
| 3783 | 3783 | $json['percentage'] = $percentage; |
| 3784 | 3784 | // WPML |
@@ -3786,48 +3786,48 @@ discard block |
||
| 3786 | 3786 | $sitepress->switch_lang($active_lang, true); |
| 3787 | 3787 | } |
| 3788 | 3788 | // WPML |
| 3789 | - wp_send_json( $json ); |
|
| 3789 | + wp_send_json($json); |
|
| 3790 | 3790 | } else {
|
| 3791 | - if ( !$terms_count > 0 ) {
|
|
| 3792 | - $json['error'] = __( 'No records to export.', 'geodirectory' ); |
|
| 3791 | + if (!$terms_count > 0) {
|
|
| 3792 | + $json['error'] = __('No records to export.', 'geodirectory');
|
|
| 3793 | 3793 | } else {
|
| 3794 | 3794 | $total_terms = $terms_count; |
| 3795 | 3795 | if ($chunk_per_page > $terms_count) {
|
| 3796 | 3796 | $chunk_per_page = $terms_count; |
| 3797 | 3797 | } |
| 3798 | - $chunk_total_pages = ceil( $total_terms / $chunk_per_page ); |
|
| 3798 | + $chunk_total_pages = ceil($total_terms / $chunk_per_page); |
|
| 3799 | 3799 | |
| 3800 | 3800 | $j = $chunk_page_no; |
| 3801 | - $chunk_save_terms = geodir_imex_get_terms( $post_type, $chunk_per_page, $j ); |
|
| 3801 | + $chunk_save_terms = geodir_imex_get_terms($post_type, $chunk_per_page, $j); |
|
| 3802 | 3802 | |
| 3803 | 3803 | $per_page = 500; |
| 3804 | 3804 | if ($per_page > $chunk_per_page) {
|
| 3805 | 3805 | $per_page = $chunk_per_page; |
| 3806 | 3806 | } |
| 3807 | - $total_pages = ceil( $chunk_per_page / $per_page ); |
|
| 3807 | + $total_pages = ceil($chunk_per_page / $per_page); |
|
| 3808 | 3808 | |
| 3809 | - for ( $i = 0; $i <= $total_pages; $i++ ) {
|
|
| 3810 | - $save_terms = array_slice( $chunk_save_terms , ( $i * $per_page ), $per_page ); |
|
| 3809 | + for ($i = 0; $i <= $total_pages; $i++) {
|
|
| 3810 | + $save_terms = array_slice($chunk_save_terms, ($i * $per_page), $per_page); |
|
| 3811 | 3811 | |
| 3812 | 3812 | $clear = $i == 0 ? true : false; |
| 3813 | - geodir_save_csv_data( $file_path_temp, $save_terms, $clear ); |
|
| 3813 | + geodir_save_csv_data($file_path_temp, $save_terms, $clear); |
|
| 3814 | 3814 | } |
| 3815 | 3815 | |
| 3816 | - if ( $wp_filesystem->exists( $file_path_temp ) ) {
|
|
| 3816 | + if ($wp_filesystem->exists($file_path_temp)) {
|
|
| 3817 | 3817 | $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : ''; |
| 3818 | 3818 | $chunk_file_name = $file_name . $chunk_page_no . '.csv'; |
| 3819 | 3819 | $file_path = $csv_file_dir . '/' . $chunk_file_name; |
| 3820 | - $wp_filesystem->move( $file_path_temp, $file_path, true ); |
|
| 3820 | + $wp_filesystem->move($file_path_temp, $file_path, true); |
|
| 3821 | 3821 | |
| 3822 | 3822 | $file_url = $file_url_base . $chunk_file_name; |
| 3823 | 3823 | $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
| 3824 | 3824 | } |
| 3825 | 3825 | |
| 3826 | - if ( !empty($chunk_file_paths) ) {
|
|
| 3826 | + if (!empty($chunk_file_paths)) {
|
|
| 3827 | 3827 | $json['total'] = $terms_count; |
| 3828 | 3828 | $json['files'] = $chunk_file_paths; |
| 3829 | 3829 | } else {
|
| 3830 | - $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' ); |
|
| 3830 | + $json['error'] = __('ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory');
|
|
| 3831 | 3831 | } |
| 3832 | 3832 | } |
| 3833 | 3833 | // WPML |
@@ -3835,127 +3835,127 @@ discard block |
||
| 3835 | 3835 | $sitepress->switch_lang($active_lang, true); |
| 3836 | 3836 | } |
| 3837 | 3837 | // WPML |
| 3838 | - wp_send_json( $json ); |
|
| 3838 | + wp_send_json($json); |
|
| 3839 | 3839 | } |
| 3840 | 3840 | } |
| 3841 | 3841 | break; |
| 3842 | 3842 | case 'export_locations': {
|
| 3843 | 3843 | $file_url_base = geodir_path_import_export() . '/'; |
| 3844 | - $file_name = 'gd_locations_' . date( 'dmyHi' ); |
|
| 3844 | + $file_name = 'gd_locations_' . date('dmyHi');
|
|
| 3845 | 3845 | $file_url = $file_url_base . $file_name . '.csv'; |
| 3846 | 3846 | $file_path = $csv_file_dir . '/' . $file_name . '.csv'; |
| 3847 | 3847 | $file_path_temp = $csv_file_dir . '/gd_locations_' . $nonce . '.csv'; |
| 3848 | 3848 | |
| 3849 | - $items_count = (int)geodir_location_imex_count_locations(); |
|
| 3849 | + $items_count = (int) geodir_location_imex_count_locations(); |
|
| 3850 | 3850 | |
| 3851 | - if ( isset( $_REQUEST['_st'] ) ) {
|
|
| 3852 | - $line_count = (int)geodir_import_export_line_count( $file_path_temp ); |
|
| 3853 | - $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0; |
|
| 3854 | - $percentage = min( $percentage, 100 ); |
|
| 3851 | + if (isset($_REQUEST['_st'])) {
|
|
| 3852 | + $line_count = (int) geodir_import_export_line_count($file_path_temp); |
|
| 3853 | + $percentage = count($items_count) > 0 && $line_count > 0 ? ceil($line_count / $items_count) * 100 : 0; |
|
| 3854 | + $percentage = min($percentage, 100); |
|
| 3855 | 3855 | |
| 3856 | 3856 | $json['percentage'] = $percentage; |
| 3857 | - wp_send_json( $json ); |
|
| 3857 | + wp_send_json($json); |
|
| 3858 | 3858 | } else {
|
| 3859 | 3859 | $chunk_file_paths = array(); |
| 3860 | 3860 | |
| 3861 | - if ( !$items_count > 0 ) {
|
|
| 3862 | - $json['error'] = __( 'No records to export.', 'geodirectory' ); |
|
| 3861 | + if (!$items_count > 0) {
|
|
| 3862 | + $json['error'] = __('No records to export.', 'geodirectory');
|
|
| 3863 | 3863 | } else {
|
| 3864 | - $chunk_per_page = min( $chunk_per_page, $items_count ); |
|
| 3865 | - $chunk_total_pages = ceil( $items_count / $chunk_per_page ); |
|
| 3864 | + $chunk_per_page = min($chunk_per_page, $items_count); |
|
| 3865 | + $chunk_total_pages = ceil($items_count / $chunk_per_page); |
|
| 3866 | 3866 | |
| 3867 | 3867 | $j = $chunk_page_no; |
| 3868 | - $chunk_save_items = geodir_location_imex_locations_data( $chunk_per_page, $j ); |
|
| 3868 | + $chunk_save_items = geodir_location_imex_locations_data($chunk_per_page, $j); |
|
| 3869 | 3869 | |
| 3870 | 3870 | $per_page = 500; |
| 3871 | - $per_page = min( $per_page, $chunk_per_page ); |
|
| 3872 | - $total_pages = ceil( $chunk_per_page / $per_page ); |
|
| 3871 | + $per_page = min($per_page, $chunk_per_page); |
|
| 3872 | + $total_pages = ceil($chunk_per_page / $per_page); |
|
| 3873 | 3873 | |
| 3874 | - for ( $i = 0; $i <= $total_pages; $i++ ) {
|
|
| 3875 | - $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page ); |
|
| 3874 | + for ($i = 0; $i <= $total_pages; $i++) {
|
|
| 3875 | + $save_items = array_slice($chunk_save_items, ($i * $per_page), $per_page); |
|
| 3876 | 3876 | |
| 3877 | 3877 | $clear = $i == 0 ? true : false; |
| 3878 | - geodir_save_csv_data( $file_path_temp, $save_items, $clear ); |
|
| 3878 | + geodir_save_csv_data($file_path_temp, $save_items, $clear); |
|
| 3879 | 3879 | } |
| 3880 | 3880 | |
| 3881 | - if ( $wp_filesystem->exists( $file_path_temp ) ) {
|
|
| 3881 | + if ($wp_filesystem->exists($file_path_temp)) {
|
|
| 3882 | 3882 | $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : ''; |
| 3883 | 3883 | $chunk_file_name = $file_name . $chunk_page_no . '.csv'; |
| 3884 | 3884 | $file_path = $csv_file_dir . '/' . $chunk_file_name; |
| 3885 | - $wp_filesystem->move( $file_path_temp, $file_path, true ); |
|
| 3885 | + $wp_filesystem->move($file_path_temp, $file_path, true); |
|
| 3886 | 3886 | |
| 3887 | 3887 | $file_url = $file_url_base . $chunk_file_name; |
| 3888 | 3888 | $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
| 3889 | 3889 | } |
| 3890 | 3890 | |
| 3891 | - if ( !empty($chunk_file_paths) ) {
|
|
| 3891 | + if (!empty($chunk_file_paths)) {
|
|
| 3892 | 3892 | $json['total'] = $items_count; |
| 3893 | 3893 | $json['files'] = $chunk_file_paths; |
| 3894 | 3894 | } else {
|
| 3895 | - $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' ); |
|
| 3895 | + $json['error'] = __('Fail, something wrong to create csv file.', 'geodirectory');
|
|
| 3896 | 3896 | } |
| 3897 | 3897 | } |
| 3898 | - wp_send_json( $json ); |
|
| 3898 | + wp_send_json($json); |
|
| 3899 | 3899 | } |
| 3900 | 3900 | } |
| 3901 | 3901 | break; |
| 3902 | 3902 | case 'export_hoods': {
|
| 3903 | 3903 | $file_url_base = geodir_path_import_export() . '/'; |
| 3904 | - $file_name = 'gd_neighbourhoods_' . date( 'dmyHi' ); |
|
| 3904 | + $file_name = 'gd_neighbourhoods_' . date('dmyHi');
|
|
| 3905 | 3905 | $file_url = $file_url_base . $file_name . '.csv'; |
| 3906 | 3906 | $file_path = $csv_file_dir . '/' . $file_name . '.csv'; |
| 3907 | 3907 | $file_path_temp = $csv_file_dir . '/gd_neighbourhoods_' . $nonce . '.csv'; |
| 3908 | 3908 | |
| 3909 | - $items_count = (int)geodir_location_imex_count_neighbourhoods(); |
|
| 3909 | + $items_count = (int) geodir_location_imex_count_neighbourhoods(); |
|
| 3910 | 3910 | |
| 3911 | - if ( isset( $_REQUEST['_st'] ) ) {
|
|
| 3912 | - $line_count = (int)geodir_import_export_line_count( $file_path_temp ); |
|
| 3913 | - $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0; |
|
| 3914 | - $percentage = min( $percentage, 100 ); |
|
| 3911 | + if (isset($_REQUEST['_st'])) {
|
|
| 3912 | + $line_count = (int) geodir_import_export_line_count($file_path_temp); |
|
| 3913 | + $percentage = count($items_count) > 0 && $line_count > 0 ? ceil($line_count / $items_count) * 100 : 0; |
|
| 3914 | + $percentage = min($percentage, 100); |
|
| 3915 | 3915 | |
| 3916 | 3916 | $json['percentage'] = $percentage; |
| 3917 | - wp_send_json( $json ); |
|
| 3917 | + wp_send_json($json); |
|
| 3918 | 3918 | } else {
|
| 3919 | 3919 | $chunk_file_paths = array(); |
| 3920 | 3920 | |
| 3921 | - if ( !$items_count > 0 ) {
|
|
| 3922 | - $json['error'] = __( 'No records to export.', 'geodirectory' ); |
|
| 3921 | + if (!$items_count > 0) {
|
|
| 3922 | + $json['error'] = __('No records to export.', 'geodirectory');
|
|
| 3923 | 3923 | } else {
|
| 3924 | - $chunk_per_page = min( $chunk_per_page, $items_count ); |
|
| 3925 | - $chunk_total_pages = ceil( $items_count / $chunk_per_page ); |
|
| 3924 | + $chunk_per_page = min($chunk_per_page, $items_count); |
|
| 3925 | + $chunk_total_pages = ceil($items_count / $chunk_per_page); |
|
| 3926 | 3926 | |
| 3927 | 3927 | $j = $chunk_page_no; |
| 3928 | - $chunk_save_items = geodir_location_imex_neighbourhoods_data( $chunk_per_page, $j ); |
|
| 3928 | + $chunk_save_items = geodir_location_imex_neighbourhoods_data($chunk_per_page, $j); |
|
| 3929 | 3929 | |
| 3930 | 3930 | $per_page = 500; |
| 3931 | - $per_page = min( $per_page, $chunk_per_page ); |
|
| 3932 | - $total_pages = ceil( $chunk_per_page / $per_page ); |
|
| 3931 | + $per_page = min($per_page, $chunk_per_page); |
|
| 3932 | + $total_pages = ceil($chunk_per_page / $per_page); |
|
| 3933 | 3933 | |
| 3934 | - for ( $i = 0; $i <= $total_pages; $i++ ) {
|
|
| 3935 | - $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page ); |
|
| 3934 | + for ($i = 0; $i <= $total_pages; $i++) {
|
|
| 3935 | + $save_items = array_slice($chunk_save_items, ($i * $per_page), $per_page); |
|
| 3936 | 3936 | |
| 3937 | 3937 | $clear = $i == 0 ? true : false; |
| 3938 | - geodir_save_csv_data( $file_path_temp, $save_items, $clear ); |
|
| 3938 | + geodir_save_csv_data($file_path_temp, $save_items, $clear); |
|
| 3939 | 3939 | } |
| 3940 | 3940 | |
| 3941 | - if ( $wp_filesystem->exists( $file_path_temp ) ) {
|
|
| 3941 | + if ($wp_filesystem->exists($file_path_temp)) {
|
|
| 3942 | 3942 | $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : ''; |
| 3943 | 3943 | $chunk_file_name = $file_name . $chunk_page_no . '.csv'; |
| 3944 | 3944 | $file_path = $csv_file_dir . '/' . $chunk_file_name; |
| 3945 | - $wp_filesystem->move( $file_path_temp, $file_path, true ); |
|
| 3945 | + $wp_filesystem->move($file_path_temp, $file_path, true); |
|
| 3946 | 3946 | |
| 3947 | 3947 | $file_url = $file_url_base . $chunk_file_name; |
| 3948 | 3948 | $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
|
| 3949 | 3949 | } |
| 3950 | 3950 | |
| 3951 | - if ( !empty($chunk_file_paths) ) {
|
|
| 3951 | + if (!empty($chunk_file_paths)) {
|
|
| 3952 | 3952 | $json['total'] = $items_count; |
| 3953 | 3953 | $json['files'] = $chunk_file_paths; |
| 3954 | 3954 | } else {
|
| 3955 | - $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' ); |
|
| 3955 | + $json['error'] = __('Fail, something wrong to create csv file.', 'geodirectory');
|
|
| 3956 | 3956 | } |
| 3957 | 3957 | } |
| 3958 | - wp_send_json( $json ); |
|
| 3958 | + wp_send_json($json); |
|
| 3959 | 3959 | } |
| 3960 | 3960 | } |
| 3961 | 3961 | break; |
@@ -3972,32 +3972,32 @@ discard block |
||
| 3972 | 3972 | } |
| 3973 | 3973 | // WPML |
| 3974 | 3974 | |
| 3975 | - ini_set( 'auto_detect_line_endings', true ); |
|
| 3975 | + ini_set('auto_detect_line_endings', true);
|
|
| 3976 | 3976 | |
| 3977 | 3977 | $uploads = wp_upload_dir(); |
| 3978 | 3978 | $uploads_dir = $uploads['path']; |
| 3979 | 3979 | $uploads_subdir = $uploads['subdir']; |
| 3980 | 3980 | |
| 3981 | - $csv_file = isset( $_POST['_file'] ) ? $_POST['_file'] : NULL; |
|
| 3982 | - $import_choice = isset( $_REQUEST['_ch'] ) ? $_REQUEST['_ch'] : 'skip'; |
|
| 3981 | + $csv_file = isset($_POST['_file']) ? $_POST['_file'] : NULL; |
|
| 3982 | + $import_choice = isset($_REQUEST['_ch']) ? $_REQUEST['_ch'] : 'skip'; |
|
| 3983 | 3983 | |
| 3984 | - $csv_file_arr = explode( '/', $csv_file ); |
|
| 3985 | - $csv_filename = end( $csv_file_arr ); |
|
| 3984 | + $csv_file_arr = explode('/', $csv_file);
|
|
| 3985 | + $csv_filename = end($csv_file_arr); |
|
| 3986 | 3986 | $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $csv_filename; |
| 3987 | 3987 | |
| 3988 | 3988 | $json['file'] = $csv_file; |
| 3989 | - $json['error'] = __( 'The uploaded file is not a valid csv file. Please try again.', 'geodirectory' ); |
|
| 3989 | + $json['error'] = __('The uploaded file is not a valid csv file. Please try again.', 'geodirectory');
|
|
| 3990 | 3990 | |
| 3991 | - if ( $csv_file && $wp_filesystem->is_file( $target_path ) && $wp_filesystem->exists( $target_path ) ) {
|
|
| 3992 | - $wp_filetype = wp_check_filetype_and_ext( $target_path, $csv_filename ); |
|
| 3991 | + if ($csv_file && $wp_filesystem->is_file($target_path) && $wp_filesystem->exists($target_path)) {
|
|
| 3992 | + $wp_filetype = wp_check_filetype_and_ext($target_path, $csv_filename); |
|
| 3993 | 3993 | |
| 3994 | 3994 | if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
|
| 3995 | 3995 | $json['error'] = NULL; |
| 3996 | 3996 | $json['rows'] = 0; |
| 3997 | 3997 | |
| 3998 | - if ( ( $handle = fopen($target_path, "r" ) ) !== FALSE ) {
|
|
| 3999 | - while ( ( $data = fgetcsv( $handle, 100000, "," ) ) !== FALSE ) {
|
|
| 4000 | - if ( !empty( $data ) ) {
|
|
| 3998 | + if (($handle = fopen($target_path, "r")) !== FALSE) {
|
|
| 3999 | + while (($data = fgetcsv($handle, 100000, ",")) !== FALSE) {
|
|
| 4000 | + if (!empty($data)) {
|
|
| 4001 | 4001 | $file[] = $data; |
| 4002 | 4002 | } |
| 4003 | 4003 | } |
@@ -4010,19 +4010,19 @@ discard block |
||
| 4010 | 4010 | $json['error'] = __('No data found in csv file.', 'geodirectory');
|
| 4011 | 4011 | } |
| 4012 | 4012 | } else {
|
| 4013 | - wp_send_json( $json ); |
|
| 4013 | + wp_send_json($json); |
|
| 4014 | 4014 | } |
| 4015 | 4015 | } else {
|
| 4016 | - wp_send_json( $json ); |
|
| 4016 | + wp_send_json($json); |
|
| 4017 | 4017 | } |
| 4018 | 4018 | |
| 4019 | - if ( $task == 'prepare_import' || !empty( $json['error'] ) ) {
|
|
| 4020 | - wp_send_json( $json ); |
|
| 4019 | + if ($task == 'prepare_import' || !empty($json['error'])) {
|
|
| 4020 | + wp_send_json($json); |
|
| 4021 | 4021 | } |
| 4022 | 4022 | |
| 4023 | 4023 | $total = $json['rows']; |
| 4024 | - $limit = isset($_POST['limit']) ? (int)$_POST['limit'] : 1; |
|
| 4025 | - $processed = isset($_POST['processed']) ? (int)$_POST['processed'] : 0; |
|
| 4024 | + $limit = isset($_POST['limit']) ? (int) $_POST['limit'] : 1; |
|
| 4025 | + $processed = isset($_POST['processed']) ? (int) $_POST['processed'] : 0; |
|
| 4026 | 4026 | |
| 4027 | 4027 | $count = $limit; |
| 4028 | 4028 | $requested_limit = $limit; |
@@ -4051,13 +4051,13 @@ discard block |
||
| 4051 | 4051 | |
| 4052 | 4052 | $post_types = geodir_get_posttypes(); |
| 4053 | 4053 | |
| 4054 | - if ( $task == 'import_cat' ) {
|
|
| 4054 | + if ($task == 'import_cat') {
|
|
| 4055 | 4055 | if (!empty($file)) {
|
| 4056 | 4056 | $columns = isset($file[0]) ? $file[0] : NULL; |
| 4057 | 4057 | |
| 4058 | 4058 | if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
|
| 4059 | 4059 | $json['error'] = CSV_INVAILD_FILE; |
| 4060 | - wp_send_json( $json ); |
|
| 4060 | + wp_send_json($json); |
|
| 4061 | 4061 | exit; |
| 4062 | 4062 | } |
| 4063 | 4063 | |
@@ -4066,7 +4066,7 @@ discard block |
||
| 4066 | 4066 | |
| 4067 | 4067 | if (isset($file[$index])) {
|
| 4068 | 4068 | $row = $file[$index]; |
| 4069 | - $row = array_map( 'trim', $row ); |
|
| 4069 | + $row = array_map('trim', $row);
|
|
| 4070 | 4070 | //$row = array_map( 'utf8_encode', $row ); |
| 4071 | 4071 | |
| 4072 | 4072 | $cat_id = ''; |
@@ -4082,26 +4082,26 @@ discard block |
||
| 4082 | 4082 | $cat_language = ''; |
| 4083 | 4083 | |
| 4084 | 4084 | $c = 0; |
| 4085 | - foreach ($columns as $column ) {
|
|
| 4086 | - if ( $column == 'cat_id' ) {
|
|
| 4087 | - $cat_id = (int)$row[$c]; |
|
| 4088 | - } else if ( $column == 'cat_name' ) {
|
|
| 4085 | + foreach ($columns as $column) {
|
|
| 4086 | + if ($column == 'cat_id') {
|
|
| 4087 | + $cat_id = (int) $row[$c]; |
|
| 4088 | + } else if ($column == 'cat_name') {
|
|
| 4089 | 4089 | $cat_name = $row[$c]; |
| 4090 | - } else if ( $column == 'cat_slug' ) {
|
|
| 4090 | + } else if ($column == 'cat_slug') {
|
|
| 4091 | 4091 | $cat_slug = $row[$c]; |
| 4092 | - } else if ( $column == 'cat_posttype' ) {
|
|
| 4092 | + } else if ($column == 'cat_posttype') {
|
|
| 4093 | 4093 | $cat_posttype = $row[$c]; |
| 4094 | - } else if ( $column == 'cat_parent' ) {
|
|
| 4094 | + } else if ($column == 'cat_parent') {
|
|
| 4095 | 4095 | $cat_parent = trim($row[$c]); |
| 4096 | - } else if ( $column == 'cat_schema' && $row[$c] != '' ) {
|
|
| 4096 | + } else if ($column == 'cat_schema' && $row[$c] != '') {
|
|
| 4097 | 4097 | $cat_schema = $row[$c]; |
| 4098 | - } else if ( $column == 'cat_description' ) {
|
|
| 4098 | + } else if ($column == 'cat_description') {
|
|
| 4099 | 4099 | $cat_description = $row[$c]; |
| 4100 | - } else if ( $column == 'cat_top_description' ) {
|
|
| 4100 | + } else if ($column == 'cat_top_description') {
|
|
| 4101 | 4101 | $cat_top_description = $row[$c]; |
| 4102 | - } else if ( $column == 'cat_image' ) {
|
|
| 4102 | + } else if ($column == 'cat_image') {
|
|
| 4103 | 4103 | $cat_image = $row[$c]; |
| 4104 | - } else if ( $column == 'cat_icon' ) {
|
|
| 4104 | + } else if ($column == 'cat_icon') {
|
|
| 4105 | 4105 | $cat_icon = $row[$c]; |
| 4106 | 4106 | } |
| 4107 | 4107 | // WPML |
@@ -4112,7 +4112,7 @@ discard block |
||
| 4112 | 4112 | $c++; |
| 4113 | 4113 | } |
| 4114 | 4114 | |
| 4115 | - if ( $cat_name == '' || !in_array( $cat_posttype, $post_types ) ) {
|
|
| 4115 | + if ($cat_name == '' || !in_array($cat_posttype, $post_types)) {
|
|
| 4116 | 4116 | $invalid++; |
| 4117 | 4117 | continue; |
| 4118 | 4118 | } |
@@ -4129,8 +4129,8 @@ discard block |
||
| 4129 | 4129 | $term_data['description'] = $cat_description; |
| 4130 | 4130 | $term_data['cat_schema'] = $cat_schema; |
| 4131 | 4131 | $term_data['top_description'] = $cat_top_description; |
| 4132 | - $term_data['image'] = $cat_image != '' ? basename( $cat_image ) : ''; |
|
| 4133 | - $term_data['icon'] = $cat_icon != '' ? basename( $cat_icon ) : ''; |
|
| 4132 | + $term_data['image'] = $cat_image != '' ? basename($cat_image) : ''; |
|
| 4133 | + $term_data['icon'] = $cat_icon != '' ? basename($cat_icon) : ''; |
|
| 4134 | 4134 | |
| 4135 | 4135 | //$term_data = array_map( 'utf8_encode', $term_data ); |
| 4136 | 4136 | |
@@ -4139,14 +4139,14 @@ discard block |
||
| 4139 | 4139 | $term_data['taxonomy'] = $taxonomy; |
| 4140 | 4140 | |
| 4141 | 4141 | $term_parent_id = 0; |
| 4142 | - if ($cat_parent != "" || (int)$cat_parent > 0) {
|
|
| 4142 | + if ($cat_parent != "" || (int) $cat_parent > 0) {
|
|
| 4143 | 4143 | $term_parent = ''; |
| 4144 | 4144 | |
| 4145 | - if ( $term_parent = get_term_by( 'name', $cat_parent, $taxonomy ) ) {
|
|
| 4145 | + if ($term_parent = get_term_by('name', $cat_parent, $taxonomy)) {
|
|
| 4146 | 4146 | $term_parent = $term_parent; |
| 4147 | - } else if ( $term_parent = get_term_by( 'slug', $cat_parent, $taxonomy ) ) {
|
|
| 4147 | + } else if ($term_parent = get_term_by('slug', $cat_parent, $taxonomy)) {
|
|
| 4148 | 4148 | $term_parent = $term_parent; |
| 4149 | - } else if ( $term_parent = get_term_by( 'id', $cat_parent, $taxonomy ) ) {
|
|
| 4149 | + } else if ($term_parent = get_term_by('id', $cat_parent, $taxonomy)) {
|
|
| 4150 | 4150 | $term_parent = $term_parent; |
| 4151 | 4151 | } else {
|
| 4152 | 4152 | $term_parent_data = array(); |
@@ -4154,47 +4154,47 @@ discard block |
||
| 4154 | 4154 | //$term_parent_data = array_map( 'utf8_encode', $term_parent_data ); |
| 4155 | 4155 | $term_parent_data['taxonomy'] = $taxonomy; |
| 4156 | 4156 | |
| 4157 | - $term_parent_id = (int)geodir_imex_insert_term( $taxonomy, $term_parent_data ); |
|
| 4157 | + $term_parent_id = (int) geodir_imex_insert_term($taxonomy, $term_parent_data); |
|
| 4158 | 4158 | } |
| 4159 | 4159 | |
| 4160 | - if ( !empty( $term_parent ) && !is_wp_error( $term_parent ) ) {
|
|
| 4161 | - $term_parent_id = (int)$term_parent->term_id; |
|
| 4160 | + if (!empty($term_parent) && !is_wp_error($term_parent)) {
|
|
| 4161 | + $term_parent_id = (int) $term_parent->term_id; |
|
| 4162 | 4162 | } |
| 4163 | 4163 | } |
| 4164 | - $term_data['parent'] = (int)$term_parent_id; |
|
| 4164 | + $term_data['parent'] = (int) $term_parent_id; |
|
| 4165 | 4165 | |
| 4166 | 4166 | $term_id = NULL; |
| 4167 | - if ( $import_choice == 'update' ) {
|
|
| 4168 | - if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
|
|
| 4167 | + if ($import_choice == 'update') {
|
|
| 4168 | + if ($cat_id > 0 && $term = (array) term_exists($cat_id, $taxonomy)) {
|
|
| 4169 | 4169 | $term_data['term_id'] = $term['term_id']; |
| 4170 | 4170 | |
| 4171 | - if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
|
|
| 4171 | + if ($term_id = geodir_imex_update_term($taxonomy, $term_data)) {
|
|
| 4172 | 4172 | $updated++; |
| 4173 | 4173 | } else {
|
| 4174 | 4174 | $invalid++; |
| 4175 | 4175 | } |
| 4176 | - } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
|
|
| 4176 | + } else if ($term_data['slug'] != '' && $term = (array) term_exists($term_data['slug'], $taxonomy)) {
|
|
| 4177 | 4177 | $term_data['term_id'] = $term['term_id']; |
| 4178 | 4178 | |
| 4179 | - if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
|
|
| 4179 | + if ($term_id = geodir_imex_update_term($taxonomy, $term_data)) {
|
|
| 4180 | 4180 | $updated++; |
| 4181 | 4181 | } else {
|
| 4182 | 4182 | $invalid++; |
| 4183 | 4183 | } |
| 4184 | 4184 | } else {
|
| 4185 | - if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
|
|
| 4185 | + if ($term_id = geodir_imex_insert_term($taxonomy, $term_data)) {
|
|
| 4186 | 4186 | $created++; |
| 4187 | 4187 | } else {
|
| 4188 | 4188 | $invalid++; |
| 4189 | 4189 | } |
| 4190 | 4190 | } |
| 4191 | - } else if ( $import_choice == 'skip' ) {
|
|
| 4192 | - if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
|
|
| 4191 | + } else if ($import_choice == 'skip') {
|
|
| 4192 | + if ($cat_id > 0 && $term = (array) term_exists($cat_id, $taxonomy)) {
|
|
| 4193 | 4193 | $skipped++; |
| 4194 | - } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
|
|
| 4194 | + } else if ($term_data['slug'] != '' && $term = (array) term_exists($term_data['slug'], $taxonomy)) {
|
|
| 4195 | 4195 | $skipped++; |
| 4196 | 4196 | } else {
|
| 4197 | - if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
|
|
| 4197 | + if ($term_id = geodir_imex_insert_term($taxonomy, $term_data)) {
|
|
| 4198 | 4198 | $created++; |
| 4199 | 4199 | } else {
|
| 4200 | 4200 | $invalid++; |
@@ -4204,37 +4204,37 @@ discard block |
||
| 4204 | 4204 | $invalid++; |
| 4205 | 4205 | } |
| 4206 | 4206 | |
| 4207 | - if ( $term_id ) {
|
|
| 4208 | - if ( isset( $term_data['top_description'] ) ) {
|
|
| 4209 | - update_tax_meta( $term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype ); |
|
| 4207 | + if ($term_id) {
|
|
| 4208 | + if (isset($term_data['top_description'])) {
|
|
| 4209 | + update_tax_meta($term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype); |
|
| 4210 | 4210 | } |
| 4211 | 4211 | |
| 4212 | - if ( isset( $term_data['cat_schema'] ) ) {
|
|
| 4213 | - update_tax_meta( $term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype ); |
|
| 4212 | + if (isset($term_data['cat_schema'])) {
|
|
| 4213 | + update_tax_meta($term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype); |
|
| 4214 | 4214 | } |
| 4215 | 4215 | |
| 4216 | 4216 | $attachment = false; |
| 4217 | - if ( isset( $term_data['image'] ) && $term_data['image'] != '' ) {
|
|
| 4218 | - $cat_image = geodir_get_default_catimage( $term_id, $cat_posttype ); |
|
| 4219 | - $cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : ''; |
|
| 4217 | + if (isset($term_data['image']) && $term_data['image'] != '') {
|
|
| 4218 | + $cat_image = geodir_get_default_catimage($term_id, $cat_posttype); |
|
| 4219 | + $cat_image = !empty($cat_image) && isset($cat_image['src']) ? $cat_image['src'] : ''; |
|
| 4220 | 4220 | |
| 4221 | - if ( basename($cat_image) != $term_data['image'] ) {
|
|
| 4221 | + if (basename($cat_image) != $term_data['image']) {
|
|
| 4222 | 4222 | $attachment = true; |
| 4223 | - update_tax_meta( $term_id, 'ct_cat_default_img', array( 'id' => 'image', 'src' => $uploads['url'] . '/' . $term_data['image'] ), $cat_posttype ); |
|
| 4223 | + update_tax_meta($term_id, 'ct_cat_default_img', array('id' => 'image', 'src' => $uploads['url'] . '/' . $term_data['image']), $cat_posttype);
|
|
| 4224 | 4224 | } |
| 4225 | 4225 | } |
| 4226 | 4226 | |
| 4227 | - if ( isset( $term_data['icon'] ) && $term_data['icon'] != '' ) {
|
|
| 4228 | - $cat_icon = get_tax_meta( $term_id, 'ct_cat_icon', false, $cat_posttype ); |
|
| 4229 | - $cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : ''; |
|
| 4227 | + if (isset($term_data['icon']) && $term_data['icon'] != '') {
|
|
| 4228 | + $cat_icon = get_tax_meta($term_id, 'ct_cat_icon', false, $cat_posttype); |
|
| 4229 | + $cat_icon = !empty($cat_icon) && isset($cat_icon['src']) ? $cat_icon['src'] : ''; |
|
| 4230 | 4230 | |
| 4231 | - if ( basename($cat_icon) != $term_data['icon'] ) {
|
|
| 4231 | + if (basename($cat_icon) != $term_data['icon']) {
|
|
| 4232 | 4232 | $attachment = true; |
| 4233 | - update_tax_meta( $term_id, 'ct_cat_icon', array( 'id' => 'icon', 'src' => $uploads['url'] . '/' . $term_data['icon'] ), $cat_posttype ); |
|
| 4233 | + update_tax_meta($term_id, 'ct_cat_icon', array('id' => 'icon', 'src' => $uploads['url'] . '/' . $term_data['icon']), $cat_posttype);
|
|
| 4234 | 4234 | } |
| 4235 | 4235 | } |
| 4236 | 4236 | |
| 4237 | - if ( $attachment ) {
|
|
| 4237 | + if ($attachment) {
|
|
| 4238 | 4238 | $images++; |
| 4239 | 4239 | } |
| 4240 | 4240 | } |
@@ -4256,14 +4256,14 @@ discard block |
||
| 4256 | 4256 | $json['invalid'] = $invalid; |
| 4257 | 4257 | $json['images'] = $images; |
| 4258 | 4258 | |
| 4259 | - wp_send_json( $json ); |
|
| 4259 | + wp_send_json($json); |
|
| 4260 | 4260 | exit; |
| 4261 | - } else if ( $task == 'import_post' ) {
|
|
| 4261 | + } else if ($task == 'import_post') {
|
|
| 4262 | 4262 | |
| 4263 | 4263 | //run some stuff to make the import quicker |
| 4264 | - wp_defer_term_counting( true ); |
|
| 4265 | - wp_defer_comment_counting( true ); |
|
| 4266 | - $wpdb->query( 'SET autocommit = 0;' ); |
|
| 4264 | + wp_defer_term_counting(true); |
|
| 4265 | + wp_defer_comment_counting(true); |
|
| 4266 | + $wpdb->query('SET autocommit = 0;');
|
|
| 4267 | 4267 | |
| 4268 | 4268 | //remove_all_actions('publish_post');
|
| 4269 | 4269 | //remove_all_actions('transition_post_status');
|
@@ -4272,26 +4272,26 @@ discard block |
||
| 4272 | 4272 | if (!empty($file)) {
|
| 4273 | 4273 | $wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses. |
| 4274 | 4274 | $default_status = 'publish'; |
| 4275 | - $current_date = date_i18n( 'Y-m-d', time() ); |
|
| 4275 | + $current_date = date_i18n('Y-m-d', time());
|
|
| 4276 | 4276 | |
| 4277 | 4277 | $columns = isset($file[0]) ? $file[0] : NULL; |
| 4278 | 4278 | |
| 4279 | 4279 | if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
|
| 4280 | 4280 | $json['error'] = CSV_INVAILD_FILE; |
| 4281 | - wp_send_json( $json ); |
|
| 4281 | + wp_send_json($json); |
|
| 4282 | 4282 | exit; |
| 4283 | 4283 | } |
| 4284 | 4284 | |
| 4285 | - $processed_actual=0; |
|
| 4285 | + $processed_actual = 0; |
|
| 4286 | 4286 | for ($i = 1; $i <= $limit; $i++) {
|
| 4287 | 4287 | $index = $processed + $i; |
| 4288 | 4288 | $gd_post = array(); |
| 4289 | 4289 | |
| 4290 | 4290 | if (isset($file[$index])) {$processed_actual++;
|
| 4291 | 4291 | $row = $file[$index]; |
| 4292 | - $row = array_map( 'trim', $row ); |
|
| 4292 | + $row = array_map('trim', $row);
|
|
| 4293 | 4293 | //$row = array_map( 'utf8_encode', $row ); |
| 4294 | - $row = array_map( 'addslashes_gpc', $row ); |
|
| 4294 | + $row = array_map('addslashes_gpc', $row);
|
|
| 4295 | 4295 | |
| 4296 | 4296 | $post_id = ''; |
| 4297 | 4297 | $post_title = ''; |
@@ -4328,80 +4328,80 @@ discard block |
||
| 4328 | 4328 | $original_post_id = ''; |
| 4329 | 4329 | |
| 4330 | 4330 | $c = 0; |
| 4331 | - foreach ($columns as $column ) {
|
|
| 4331 | + foreach ($columns as $column) {
|
|
| 4332 | 4332 | $gd_post[$column] = $row[$c]; |
| 4333 | 4333 | |
| 4334 | - if ( $column == 'post_id' ) {
|
|
| 4334 | + if ($column == 'post_id') {
|
|
| 4335 | 4335 | $post_id = $row[$c]; |
| 4336 | - } else if ( $column == 'post_title' ) {
|
|
| 4336 | + } else if ($column == 'post_title') {
|
|
| 4337 | 4337 | $post_title = sanitize_text_field($row[$c]); |
| 4338 | - } else if ( $column == 'post_author' ) {
|
|
| 4338 | + } else if ($column == 'post_author') {
|
|
| 4339 | 4339 | $post_author = $row[$c]; |
| 4340 | - } else if ( $column == 'post_content' ) {
|
|
| 4340 | + } else if ($column == 'post_content') {
|
|
| 4341 | 4341 | $post_content = $row[$c]; |
| 4342 | - } else if ( $column == 'post_category' && $row[$c] != '' ) {
|
|
| 4343 | - $post_category_arr = explode( ',', $row[$c] ); |
|
| 4344 | - } else if ( $column == 'default_category' ) {
|
|
| 4342 | + } else if ($column == 'post_category' && $row[$c] != '') {
|
|
| 4343 | + $post_category_arr = explode(',', $row[$c]);
|
|
| 4344 | + } else if ($column == 'default_category') {
|
|
| 4345 | 4345 | $default_category = wp_kses_normalize_entities($row[$c]); |
| 4346 | - } else if ( $column == 'post_tags' && $row[$c] != '' ) {
|
|
| 4347 | - $post_tags = explode( ',', $row[$c] ); |
|
| 4348 | - } else if ( $column == 'post_type' ) {
|
|
| 4346 | + } else if ($column == 'post_tags' && $row[$c] != '') {
|
|
| 4347 | + $post_tags = explode(',', $row[$c]);
|
|
| 4348 | + } else if ($column == 'post_type') {
|
|
| 4349 | 4349 | $post_type = $row[$c]; |
| 4350 | - } else if ( $column == 'post_status' ) {
|
|
| 4351 | - $post_status = sanitize_key( $row[$c] ); |
|
| 4352 | - } else if ( $column == 'is_featured' ) {
|
|
| 4353 | - $is_featured = (int)$row[$c]; |
|
| 4354 | - } else if ( $column == 'geodir_video' ) {
|
|
| 4350 | + } else if ($column == 'post_status') {
|
|
| 4351 | + $post_status = sanitize_key($row[$c]); |
|
| 4352 | + } else if ($column == 'is_featured') {
|
|
| 4353 | + $is_featured = (int) $row[$c]; |
|
| 4354 | + } else if ($column == 'geodir_video') {
|
|
| 4355 | 4355 | $geodir_video = $row[$c]; |
| 4356 | - } else if ( $column == 'post_address' ) {
|
|
| 4356 | + } else if ($column == 'post_address') {
|
|
| 4357 | 4357 | $post_address = $row[$c]; |
| 4358 | - } else if ( $column == 'post_city' ) {
|
|
| 4358 | + } else if ($column == 'post_city') {
|
|
| 4359 | 4359 | $post_city = $row[$c]; |
| 4360 | - } else if ( $column == 'post_region' ) {
|
|
| 4360 | + } else if ($column == 'post_region') {
|
|
| 4361 | 4361 | $post_region = $row[$c]; |
| 4362 | - } else if ( $column == 'post_country' ) {
|
|
| 4362 | + } else if ($column == 'post_country') {
|
|
| 4363 | 4363 | $post_country = $row[$c]; |
| 4364 | - } else if ( $column == 'post_zip' ) {
|
|
| 4364 | + } else if ($column == 'post_zip') {
|
|
| 4365 | 4365 | $post_zip = $row[$c]; |
| 4366 | - } else if ( $column == 'post_latitude' ) {
|
|
| 4366 | + } else if ($column == 'post_latitude') {
|
|
| 4367 | 4367 | $post_latitude = $row[$c]; |
| 4368 | - } else if ( $column == 'post_longitude' ) {
|
|
| 4368 | + } else if ($column == 'post_longitude') {
|
|
| 4369 | 4369 | $post_longitude = $row[$c]; |
| 4370 | - } else if ( $column == 'post_neighbourhood' ) {
|
|
| 4370 | + } else if ($column == 'post_neighbourhood') {
|
|
| 4371 | 4371 | $post_neighbourhood = $row[$c]; |
| 4372 | 4372 | unset($gd_post[$column]); |
| 4373 | - } else if ( $column == 'neighbourhood_latitude' ) {
|
|
| 4373 | + } else if ($column == 'neighbourhood_latitude') {
|
|
| 4374 | 4374 | $neighbourhood_latitude = $row[$c]; |
| 4375 | - } else if ( $column == 'neighbourhood_longitude' ) {
|
|
| 4375 | + } else if ($column == 'neighbourhood_longitude') {
|
|
| 4376 | 4376 | $neighbourhood_longitude = $row[$c]; |
| 4377 | - } else if ( $column == 'geodir_timing' ) {
|
|
| 4377 | + } else if ($column == 'geodir_timing') {
|
|
| 4378 | 4378 | $geodir_timing = $row[$c]; |
| 4379 | - } else if ( $column == 'geodir_contact' ) {
|
|
| 4379 | + } else if ($column == 'geodir_contact') {
|
|
| 4380 | 4380 | $geodir_contact = $row[$c]; |
| 4381 | - } else if ( $column == 'geodir_email' ) {
|
|
| 4381 | + } else if ($column == 'geodir_email') {
|
|
| 4382 | 4382 | $geodir_email = $row[$c]; |
| 4383 | - } else if ( $column == 'geodir_website' ) {
|
|
| 4383 | + } else if ($column == 'geodir_website') {
|
|
| 4384 | 4384 | $geodir_website = $row[$c]; |
| 4385 | - } else if ( $column == 'geodir_twitter' ) {
|
|
| 4385 | + } else if ($column == 'geodir_twitter') {
|
|
| 4386 | 4386 | $geodir_twitter = $row[$c]; |
| 4387 | - } else if ( $column == 'geodir_facebook' ) {
|
|
| 4387 | + } else if ($column == 'geodir_facebook') {
|
|
| 4388 | 4388 | $geodir_facebook = $row[$c]; |
| 4389 | - } else if ( $column == 'geodir_twitter' ) {
|
|
| 4389 | + } else if ($column == 'geodir_twitter') {
|
|
| 4390 | 4390 | $geodir_twitter = $row[$c]; |
| 4391 | - } else if ( $column == 'IMAGE' && !empty( $row[$c] ) && $row[$c] != '' ) {
|
|
| 4391 | + } else if ($column == 'IMAGE' && !empty($row[$c]) && $row[$c] != '') {
|
|
| 4392 | 4392 | $post_images[] = $row[$c]; |
| 4393 | - } else if ( $column == 'alive_days' && (int)$row[$c] > 0 ) {
|
|
| 4394 | - $expire_date = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$row[$c] . ' days' ) ); |
|
| 4395 | - } else if ( $column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never' ) {
|
|
| 4393 | + } else if ($column == 'alive_days' && (int) $row[$c] > 0) {
|
|
| 4394 | + $expire_date = date_i18n('Y-m-d', strtotime($current_date . '+' . (int) $row[$c] . ' days'));
|
|
| 4395 | + } else if ($column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never') {
|
|
| 4396 | 4396 | $row[$c] = str_replace('/', '-', $row[$c]);
|
| 4397 | - $expire_date = date_i18n( 'Y-m-d', strtotime( $row[$c] ) ); |
|
| 4397 | + $expire_date = date_i18n('Y-m-d', strtotime($row[$c]));
|
|
| 4398 | 4398 | } |
| 4399 | 4399 | // WPML |
| 4400 | 4400 | if ($is_wpml) {
|
| 4401 | 4401 | if ($column == 'language') {
|
| 4402 | 4402 | $language = geodir_strtolower(trim($row[$c])); |
| 4403 | 4403 | } else if ($column == 'original_post_id') {
|
| 4404 | - $original_post_id = (int)$row[$c]; |
|
| 4404 | + $original_post_id = (int) $row[$c]; |
|
| 4405 | 4405 | } |
| 4406 | 4406 | } |
| 4407 | 4407 | // WPML |
@@ -4416,24 +4416,24 @@ discard block |
||
| 4416 | 4416 | |
| 4417 | 4417 | $gd_post['IMAGE'] = $post_images; |
| 4418 | 4418 | |
| 4419 | - $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status; |
|
| 4420 | - $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status; |
|
| 4419 | + $post_status = !empty($post_status) ? sanitize_key($post_status) : $default_status; |
|
| 4420 | + $post_status = !empty($wp_post_statuses) && !isset($wp_post_statuses[$post_status]) ? $default_status : $post_status; |
|
| 4421 | 4421 | |
| 4422 | 4422 | $valid = true; |
| 4423 | 4423 | |
| 4424 | - if ( $post_title == '' || !in_array( $post_type, $post_types ) ) {
|
|
| 4424 | + if ($post_title == '' || !in_array($post_type, $post_types)) {
|
|
| 4425 | 4425 | $invalid++; |
| 4426 | 4426 | $valid = false; |
| 4427 | 4427 | } |
| 4428 | 4428 | |
| 4429 | - $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true; |
|
| 4430 | - if ( $location_allowed ) {
|
|
| 4429 | + $location_allowed = function_exists('geodir_cpt_no_location') && geodir_cpt_no_location($post_type) ? false : true;
|
|
| 4430 | + if ($location_allowed) {
|
|
| 4431 | 4431 | $location_result = geodir_get_default_location(); |
| 4432 | - if ( $post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '' ) {
|
|
| 4432 | + if ($post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '') {
|
|
| 4433 | 4433 | $invalid_addr++; |
| 4434 | 4434 | $valid = false; |
| 4435 | - } else if ( !empty( $location_result ) && $location_result->location_id == 0 ) {
|
|
| 4436 | - 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 ) ) ) {
|
|
| 4435 | + } else if (!empty($location_result) && $location_result->location_id == 0) {
|
|
| 4436 | + 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))) {
|
|
| 4437 | 4437 | $invalid_addr++; |
| 4438 | 4438 | $valid = false; |
| 4439 | 4439 | } else {
|
@@ -4444,7 +4444,7 @@ discard block |
||
| 4444 | 4444 | } |
| 4445 | 4445 | } |
| 4446 | 4446 | |
| 4447 | - if ( !$valid ) {
|
|
| 4447 | + if (!$valid) {
|
|
| 4448 | 4448 | continue; |
| 4449 | 4449 | } |
| 4450 | 4450 | |
@@ -4457,29 +4457,29 @@ discard block |
||
| 4457 | 4457 | |
| 4458 | 4458 | $post_category = array(); |
| 4459 | 4459 | $default_category_id = NULL; |
| 4460 | - if ( !empty( $post_category_arr ) ) {
|
|
| 4461 | - foreach ( $post_category_arr as $value ) {
|
|
| 4462 | - $category_name = wp_kses_normalize_entities( trim( $value ) ); |
|
| 4460 | + if (!empty($post_category_arr)) {
|
|
| 4461 | + foreach ($post_category_arr as $value) {
|
|
| 4462 | + $category_name = wp_kses_normalize_entities(trim($value)); |
|
| 4463 | 4463 | |
| 4464 | - if ( $category_name != '' ) {
|
|
| 4464 | + if ($category_name != '') {
|
|
| 4465 | 4465 | $term_category = array(); |
| 4466 | 4466 | |
| 4467 | - if ( $term = get_term_by( 'name', $category_name, $cat_taxonomy ) ) {
|
|
| 4467 | + if ($term = get_term_by('name', $category_name, $cat_taxonomy)) {
|
|
| 4468 | 4468 | $term_category = $term; |
| 4469 | - } else if ( $term = get_term_by( 'slug', $category_name, $cat_taxonomy ) ) {
|
|
| 4469 | + } else if ($term = get_term_by('slug', $category_name, $cat_taxonomy)) {
|
|
| 4470 | 4470 | $term_category = $term; |
| 4471 | 4471 | } else {
|
| 4472 | 4472 | $term_data = array(); |
| 4473 | 4473 | $term_data['name'] = $category_name; |
| 4474 | 4474 | $term_data['taxonomy'] = $cat_taxonomy; |
| 4475 | 4475 | |
| 4476 | - $term_id = geodir_imex_insert_term( $cat_taxonomy, $term_data ); |
|
| 4477 | - if ( $term_id ) {
|
|
| 4478 | - $term_category = get_term( $term_id, $cat_taxonomy ); |
|
| 4476 | + $term_id = geodir_imex_insert_term($cat_taxonomy, $term_data); |
|
| 4477 | + if ($term_id) {
|
|
| 4478 | + $term_category = get_term($term_id, $cat_taxonomy); |
|
| 4479 | 4479 | } |
| 4480 | 4480 | } |
| 4481 | 4481 | |
| 4482 | - if ( !empty( $term_category ) && !is_wp_error( $term_category ) ) {
|
|
| 4482 | + if (!empty($term_category) && !is_wp_error($term_category)) {
|
|
| 4483 | 4483 | $post_category[] = intval($term_category->term_id); |
| 4484 | 4484 | |
| 4485 | 4485 | if ($category_name == $default_category) {
|
@@ -4500,28 +4500,28 @@ discard block |
||
| 4500 | 4500 | $save_post['post_tags'] = $post_tags; |
| 4501 | 4501 | |
| 4502 | 4502 | $saved_post_id = NULL; |
| 4503 | - if ( $import_choice == 'update' ) {
|
|
| 4504 | - if ( $post_id > 0 && get_post( $post_id ) ) {
|
|
| 4503 | + if ($import_choice == 'update') {
|
|
| 4504 | + if ($post_id > 0 && get_post($post_id)) {
|
|
| 4505 | 4505 | $save_post['ID'] = $post_id; |
| 4506 | 4506 | |
| 4507 | - if ( wp_update_post( $save_post ) ) {
|
|
| 4507 | + if (wp_update_post($save_post)) {
|
|
| 4508 | 4508 | $saved_post_id = $post_id; |
| 4509 | 4509 | $updated++; |
| 4510 | 4510 | } |
| 4511 | 4511 | } else {
|
| 4512 | - if ( $saved_post_id = wp_insert_post( $save_post ) ) {
|
|
| 4512 | + if ($saved_post_id = wp_insert_post($save_post)) {
|
|
| 4513 | 4513 | $created++; |
| 4514 | 4514 | } |
| 4515 | 4515 | } |
| 4516 | 4516 | |
| 4517 | - if ( !$saved_post_id > 0 ) {
|
|
| 4517 | + if (!$saved_post_id > 0) {
|
|
| 4518 | 4518 | $invalid++; |
| 4519 | 4519 | } |
| 4520 | - } else if ( $import_choice == 'skip' ) {
|
|
| 4521 | - if ( $post_id > 0 && get_post( $post_id ) ) {
|
|
| 4520 | + } else if ($import_choice == 'skip') {
|
|
| 4521 | + if ($post_id > 0 && get_post($post_id)) {
|
|
| 4522 | 4522 | $skipped++; |
| 4523 | 4523 | } else {
|
| 4524 | - if ( $saved_post_id = wp_insert_post( $save_post ) ) {
|
|
| 4524 | + if ($saved_post_id = wp_insert_post($save_post)) {
|
|
| 4525 | 4525 | $created++; |
| 4526 | 4526 | } else {
|
| 4527 | 4527 | $invalid++; |
@@ -4531,19 +4531,19 @@ discard block |
||
| 4531 | 4531 | $invalid++; |
| 4532 | 4532 | } |
| 4533 | 4533 | |
| 4534 | - if ( (int)$saved_post_id > 0 ) {
|
|
| 4534 | + if ((int) $saved_post_id > 0) {
|
|
| 4535 | 4535 | // WPML |
| 4536 | 4536 | if ($is_wpml && $original_post_id > 0 && $language != '') {
|
| 4537 | 4537 | $wpml_post_type = 'post_' . $post_type; |
| 4538 | - $source_language = geodir_get_language_for_element( $original_post_id, $wpml_post_type ); |
|
| 4538 | + $source_language = geodir_get_language_for_element($original_post_id, $wpml_post_type); |
|
| 4539 | 4539 | $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language(); |
| 4540 | 4540 | |
| 4541 | - $trid = $sitepress->get_element_trid( $original_post_id, $wpml_post_type ); |
|
| 4541 | + $trid = $sitepress->get_element_trid($original_post_id, $wpml_post_type); |
|
| 4542 | 4542 | |
| 4543 | - $sitepress->set_element_language_details( $saved_post_id, $wpml_post_type, $trid, $language, $source_language ); |
|
| 4543 | + $sitepress->set_element_language_details($saved_post_id, $wpml_post_type, $trid, $language, $source_language); |
|
| 4544 | 4544 | } |
| 4545 | 4545 | // WPML |
| 4546 | - $gd_post_info = geodir_get_post_info( $saved_post_id ); |
|
| 4546 | + $gd_post_info = geodir_get_post_info($saved_post_id); |
|
| 4547 | 4547 | |
| 4548 | 4548 | $gd_post['post_id'] = $saved_post_id; |
| 4549 | 4549 | $gd_post['ID'] = $saved_post_id; |
@@ -4555,7 +4555,7 @@ discard block |
||
| 4555 | 4555 | |
| 4556 | 4556 | // post location |
| 4557 | 4557 | $post_location_id = 0; |
| 4558 | - if ( $location_allowed && !empty( $location_result ) && $location_result->location_id > 0 ) {
|
|
| 4558 | + if ($location_allowed && !empty($location_result) && $location_result->location_id > 0) {
|
|
| 4559 | 4559 | $gd_post['post_neighbourhood'] = ''; |
| 4560 | 4560 | |
| 4561 | 4561 | $post_location_info = array( |
@@ -4565,7 +4565,7 @@ discard block |
||
| 4565 | 4565 | 'geo_lat' => $post_latitude, |
| 4566 | 4566 | 'geo_lng' => $post_longitude |
| 4567 | 4567 | ); |
| 4568 | - if ( $location_id = (int)geodir_add_new_location( $post_location_info ) ) {
|
|
| 4568 | + if ($location_id = (int) geodir_add_new_location($post_location_info)) {
|
|
| 4569 | 4569 | $post_location_id = $location_id; |
| 4570 | 4570 | } |
| 4571 | 4571 | |
@@ -4603,14 +4603,14 @@ discard block |
||
| 4603 | 4603 | $gd_post['post_location_id'] = $post_location_id; |
| 4604 | 4604 | |
| 4605 | 4605 | // post package info |
| 4606 | - $package_id = isset( $gd_post['package_id'] ) && !empty( $gd_post['package_id'] ) ? (int)$gd_post['package_id'] : 0; |
|
| 4606 | + $package_id = isset($gd_post['package_id']) && !empty($gd_post['package_id']) ? (int) $gd_post['package_id'] : 0; |
|
| 4607 | 4607 | if (!$package_id && !empty($gd_post_info) && isset($gd_post_info->package_id) && $gd_post_info->package_id) {
|
| 4608 | 4608 | $package_id = $gd_post_info->package_id; |
| 4609 | 4609 | } |
| 4610 | 4610 | |
| 4611 | 4611 | $package_info = array(); |
| 4612 | 4612 | if ($package_id && function_exists('geodir_get_package_info_by_id')) {
|
| 4613 | - $package_info = (array)geodir_get_package_info_by_id($package_id); |
|
| 4613 | + $package_info = (array) geodir_get_package_info_by_id($package_id); |
|
| 4614 | 4614 | |
| 4615 | 4615 | if (!(!empty($package_info) && isset($package_info['post_type']) && $package_info['post_type'] == $post_type)) {
|
| 4616 | 4616 | $package_info = array(); |
@@ -4618,18 +4618,18 @@ discard block |
||
| 4618 | 4618 | } |
| 4619 | 4619 | |
| 4620 | 4620 | if (empty($package_info)) {
|
| 4621 | - $package_info = (array)geodir_post_package_info( array(), '', $post_type ); |
|
| 4621 | + $package_info = (array) geodir_post_package_info(array(), '', $post_type); |
|
| 4622 | 4622 | } |
| 4623 | 4623 | |
| 4624 | - if (!empty($package_info)) {
|
|
| 4624 | + if (!empty($package_info)) {
|
|
| 4625 | 4625 | $package_id = $package_info['pid']; |
| 4626 | 4626 | |
| 4627 | 4627 | if (isset($gd_post['alive_days']) || isset($gd_post['expire_date'])) {
|
| 4628 | 4628 | $gd_post['expire_date'] = $expire_date; |
| 4629 | 4629 | } else {
|
| 4630 | - if ( isset( $package_info['days'] ) && (int)$package_info['days'] > 0 ) {
|
|
| 4631 | - $gd_post['alive_days'] = (int)$package_info['days']; |
|
| 4632 | - $gd_post['expire_date'] = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$package_info['days'] . ' days' ) ); |
|
| 4630 | + if (isset($package_info['days']) && (int) $package_info['days'] > 0) {
|
|
| 4631 | + $gd_post['alive_days'] = (int) $package_info['days']; |
|
| 4632 | + $gd_post['expire_date'] = date_i18n('Y-m-d', strtotime($current_date . '+' . (int) $package_info['days'] . ' days'));
|
|
| 4633 | 4633 | } else {
|
| 4634 | 4634 | $gd_post['expire_date'] = 'Never'; |
| 4635 | 4635 | } |
@@ -4649,28 +4649,28 @@ discard block |
||
| 4649 | 4649 | } |
| 4650 | 4650 | |
| 4651 | 4651 | // Export franchise fields |
| 4652 | - $is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false; |
|
| 4652 | + $is_franchise_active = is_plugin_active('geodir_franchise/geodir_franchise.php') && geodir_franchise_enabled($post_type) ? true : false;
|
|
| 4653 | 4653 | if ($is_franchise_active) {
|
| 4654 | - if ( isset( $gd_post['gd_is_franchise'] ) && (int)$gd_post['gd_is_franchise'] == 1 ) {
|
|
| 4654 | + if (isset($gd_post['gd_is_franchise']) && (int) $gd_post['gd_is_franchise'] == 1) {
|
|
| 4655 | 4655 | $gd_franchise_lock = array(); |
| 4656 | 4656 | |
| 4657 | - if ( isset( $gd_post['gd_franchise_lock'] ) ) {
|
|
| 4658 | - $gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock'] );
|
|
| 4659 | - $gd_franchise_lock = trim( $gd_franchise_lock ); |
|
| 4660 | - $gd_franchise_lock = explode( ",", $gd_franchise_lock ); |
|
| 4657 | + if (isset($gd_post['gd_franchise_lock'])) {
|
|
| 4658 | + $gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock']);
|
|
| 4659 | + $gd_franchise_lock = trim($gd_franchise_lock); |
|
| 4660 | + $gd_franchise_lock = explode(",", $gd_franchise_lock);
|
|
| 4661 | 4661 | } |
| 4662 | 4662 | |
| 4663 | - update_post_meta( $saved_post_id, 'gd_is_franchise', 1 ); |
|
| 4664 | - update_post_meta( $saved_post_id, 'gd_franchise_lock', $gd_franchise_lock ); |
|
| 4663 | + update_post_meta($saved_post_id, 'gd_is_franchise', 1); |
|
| 4664 | + update_post_meta($saved_post_id, 'gd_franchise_lock', $gd_franchise_lock); |
|
| 4665 | 4665 | } else {
|
| 4666 | - if ( isset( $gd_post['franchise'] ) && (int)$gd_post['franchise'] > 0 && geodir_franchise_check( (int)$gd_post['franchise'] ) ) {
|
|
| 4667 | - geodir_save_post_meta( $saved_post_id, 'franchise', (int)$gd_post['franchise'] ); |
|
| 4666 | + if (isset($gd_post['franchise']) && (int) $gd_post['franchise'] > 0 && geodir_franchise_check((int) $gd_post['franchise'])) {
|
|
| 4667 | + geodir_save_post_meta($saved_post_id, 'franchise', (int) $gd_post['franchise']); |
|
| 4668 | 4668 | } |
| 4669 | 4669 | } |
| 4670 | 4670 | } |
| 4671 | 4671 | |
| 4672 | 4672 | if (!empty($save_post['post_category']) && is_array($save_post['post_category'])) {
|
| 4673 | - $save_post['post_category'] = array_unique( array_map( 'intval', $save_post['post_category'] ) ); |
|
| 4673 | + $save_post['post_category'] = array_unique(array_map('intval', $save_post['post_category']));
|
|
| 4674 | 4674 | if ($default_category_id) {
|
| 4675 | 4675 | $save_post['post_default_category'] = $default_category_id; |
| 4676 | 4676 | $gd_post['default_category'] = $default_category_id; |
@@ -4679,12 +4679,12 @@ discard block |
||
| 4679 | 4679 | } |
| 4680 | 4680 | |
| 4681 | 4681 | // Save post info |
| 4682 | - geodir_save_post_info( $saved_post_id, $gd_post ); |
|
| 4682 | + geodir_save_post_info($saved_post_id, $gd_post); |
|
| 4683 | 4683 | // post taxonomies |
| 4684 | - if ( !empty( $save_post['post_category'] ) ) {
|
|
| 4685 | - wp_set_object_terms( $saved_post_id, $save_post['post_category'], $cat_taxonomy ); |
|
| 4684 | + if (!empty($save_post['post_category'])) {
|
|
| 4685 | + wp_set_object_terms($saved_post_id, $save_post['post_category'], $cat_taxonomy); |
|
| 4686 | 4686 | |
| 4687 | - $post_default_category = isset( $save_post['post_default_category'] ) ? $save_post['post_default_category'] : ''; |
|
| 4687 | + $post_default_category = isset($save_post['post_default_category']) ? $save_post['post_default_category'] : ''; |
|
| 4688 | 4688 | if ($default_category_id) {
|
| 4689 | 4689 | $post_default_category = $default_category_id; |
| 4690 | 4690 | } |
@@ -4698,15 +4698,15 @@ discard block |
||
| 4698 | 4698 | |
| 4699 | 4699 | $post_category_str = $post_category_str != '' ? array($cat_taxonomy => $post_category_str) : ''; |
| 4700 | 4700 | |
| 4701 | - geodir_set_postcat_structure( $saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str ); |
|
| 4701 | + geodir_set_postcat_structure($saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str); |
|
| 4702 | 4702 | } |
| 4703 | 4703 | |
| 4704 | - if ( !empty( $save_post['post_tags'] ) ) {
|
|
| 4705 | - wp_set_object_terms( $saved_post_id, $save_post['post_tags'], $tags_taxonomy ); |
|
| 4704 | + if (!empty($save_post['post_tags'])) {
|
|
| 4705 | + wp_set_object_terms($saved_post_id, $save_post['post_tags'], $tags_taxonomy); |
|
| 4706 | 4706 | } |
| 4707 | 4707 | |
| 4708 | 4708 | // Post images |
| 4709 | - if ( !empty( $post_images ) ) {
|
|
| 4709 | + if (!empty($post_images)) {
|
|
| 4710 | 4710 | $post_images = array_unique($post_images); |
| 4711 | 4711 | |
| 4712 | 4712 | $old_post_images_arr = array(); |
@@ -4714,30 +4714,30 @@ discard block |
||
| 4714 | 4714 | |
| 4715 | 4715 | $order = 1; |
| 4716 | 4716 | |
| 4717 | - $old_post_images = geodir_get_images( $saved_post_id ); |
|
| 4717 | + $old_post_images = geodir_get_images($saved_post_id); |
|
| 4718 | 4718 | if (!empty($old_post_images)) {
|
| 4719 | - foreach( $old_post_images as $old_post_image ) {
|
|
| 4719 | + foreach ($old_post_images as $old_post_image) {
|
|
| 4720 | 4720 | if (!empty($old_post_image) && isset($old_post_image->file) && $old_post_image->file != '') {
|
| 4721 | 4721 | $old_post_images_arr[] = $old_post_image->file; |
| 4722 | 4722 | } |
| 4723 | 4723 | } |
| 4724 | 4724 | } |
| 4725 | 4725 | |
| 4726 | - foreach ( $post_images as $post_image ) {
|
|
| 4727 | - $image_name = basename( $post_image ); |
|
| 4726 | + foreach ($post_images as $post_image) {
|
|
| 4727 | + $image_name = basename($post_image); |
|
| 4728 | 4728 | $saved_post_images_arr[] = $image_name; |
| 4729 | 4729 | |
| 4730 | - if (!empty($old_post_images_arr) && in_array( $image_name, $old_post_images_arr) ) {
|
|
| 4730 | + if (!empty($old_post_images_arr) && in_array($image_name, $old_post_images_arr)) {
|
|
| 4731 | 4731 | continue; // Skip if image already exists. |
| 4732 | 4732 | } |
| 4733 | 4733 | |
| 4734 | - $image_name_parts = explode( '.', $image_name ); |
|
| 4735 | - array_pop( $image_name_parts ); |
|
| 4736 | - $proper_image_name = implode( '.', $image_name_parts ); |
|
| 4734 | + $image_name_parts = explode('.', $image_name);
|
|
| 4735 | + array_pop($image_name_parts); |
|
| 4736 | + $proper_image_name = implode('.', $image_name_parts);
|
|
| 4737 | 4737 | |
| 4738 | - $arr_file_type = wp_check_filetype( $image_name ); |
|
| 4738 | + $arr_file_type = wp_check_filetype($image_name); |
|
| 4739 | 4739 | |
| 4740 | - if ( !empty( $arr_file_type ) ) {
|
|
| 4740 | + if (!empty($arr_file_type)) {
|
|
| 4741 | 4741 | $uploaded_file_type = $arr_file_type['type']; |
| 4742 | 4742 | |
| 4743 | 4743 | $attachment = array(); |
@@ -4750,46 +4750,46 @@ discard block |
||
| 4750 | 4750 | $attachment['is_featured'] = 0; |
| 4751 | 4751 | |
| 4752 | 4752 | $attachment_set = ''; |
| 4753 | - foreach ( $attachment as $key => $val ) {
|
|
| 4754 | - if ( $val != '' ) {
|
|
| 4753 | + foreach ($attachment as $key => $val) {
|
|
| 4754 | + if ($val != '') {
|
|
| 4755 | 4755 | $attachment_set .= $key . " = '" . $val . "', "; |
| 4756 | 4756 | } |
| 4757 | 4757 | } |
| 4758 | - $attachment_set = trim( $attachment_set, ", " ); |
|
| 4758 | + $attachment_set = trim($attachment_set, ", "); |
|
| 4759 | 4759 | |
| 4760 | 4760 | // Add new attachment |
| 4761 | - $wpdb->query( "INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set ); |
|
| 4761 | + $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
|
|
| 4762 | 4762 | |
| 4763 | 4763 | $order++; |
| 4764 | 4764 | } |
| 4765 | 4765 | } |
| 4766 | 4766 | |
| 4767 | - $saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/" . implode("' AND file NOT LIKE '%/", $saved_post_images_arr) . "' )" : '';
|
|
| 4767 | + $saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/" . implode("' AND file NOT LIKE '%/", $saved_post_images_arr) . "' )" : '';
|
|
| 4768 | 4768 | // Remove previous attachment |
| 4769 | - $wpdb->query( "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = " . (int)$saved_post_id . " " . $saved_post_images_sql ); |
|
| 4769 | + $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = " . (int) $saved_post_id . " " . $saved_post_images_sql);
|
|
| 4770 | 4770 | |
| 4771 | - if ( !empty( $saved_post_images_arr ) ) {
|
|
| 4771 | + if (!empty($saved_post_images_arr)) {
|
|
| 4772 | 4772 | $menu_order = 1; |
| 4773 | 4773 | |
| 4774 | - foreach ( $saved_post_images_arr as $img_name ) {
|
|
| 4775 | - $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 ) ) ); |
|
| 4774 | + foreach ($saved_post_images_arr as $img_name) {
|
|
| 4775 | + $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)));
|
|
| 4776 | 4776 | |
| 4777 | - if( $menu_order == 1 ) {
|
|
| 4778 | - 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 ) ) ) ) {
|
|
| 4779 | - $wpdb->query( $wpdb->prepare( "UPDATE " . $table . " SET featured_image = %s WHERE post_id =%d", array( $featured_image, $saved_post_id ) ) ); |
|
| 4777 | + if ($menu_order == 1) {
|
|
| 4778 | + 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)))) {
|
|
| 4779 | + $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s WHERE post_id =%d", array($featured_image, $saved_post_id)));
|
|
| 4780 | 4780 | } |
| 4781 | 4781 | } |
| 4782 | 4782 | $menu_order++; |
| 4783 | 4783 | } |
| 4784 | 4784 | } |
| 4785 | 4785 | |
| 4786 | - if ( $order > 1 ) {
|
|
| 4786 | + if ($order > 1) {
|
|
| 4787 | 4787 | $images++; |
| 4788 | 4788 | } |
| 4789 | 4789 | } |
| 4790 | 4790 | |
| 4791 | 4791 | /** This action is documented in geodirectory-functions/post-functions.php */ |
| 4792 | - do_action( 'geodir_after_save_listing', $saved_post_id, $gd_post ); |
|
| 4792 | + do_action('geodir_after_save_listing', $saved_post_id, $gd_post);
|
|
| 4793 | 4793 | |
| 4794 | 4794 | if (isset($is_featured)) {
|
| 4795 | 4795 | geodir_save_post_meta($saved_post_id, 'is_featured', $is_featured); |
@@ -4809,10 +4809,10 @@ discard block |
||
| 4809 | 4809 | } |
| 4810 | 4810 | |
| 4811 | 4811 | //undo some stuff to make the import quicker |
| 4812 | - wp_defer_term_counting( false ); |
|
| 4813 | - wp_defer_comment_counting( false ); |
|
| 4814 | - $wpdb->query( 'COMMIT;' ); |
|
| 4815 | - $wpdb->query( 'SET autocommit = 1;' ); |
|
| 4812 | + wp_defer_term_counting(false); |
|
| 4813 | + wp_defer_comment_counting(false); |
|
| 4814 | + $wpdb->query('COMMIT;');
|
|
| 4815 | + $wpdb->query('SET autocommit = 1;');
|
|
| 4816 | 4816 | |
| 4817 | 4817 | $json = array(); |
| 4818 | 4818 | $json['processed'] = $processed_actual; |
@@ -4823,9 +4823,9 @@ discard block |
||
| 4823 | 4823 | $json['invalid_addr'] = $invalid_addr; |
| 4824 | 4824 | $json['images'] = $images; |
| 4825 | 4825 | |
| 4826 | - wp_send_json( $json ); |
|
| 4826 | + wp_send_json($json); |
|
| 4827 | 4827 | exit; |
| 4828 | - } else if ( $task == 'import_loc' ) {
|
|
| 4828 | + } else if ($task == 'import_loc') {
|
|
| 4829 | 4829 | global $gd_post_types; |
| 4830 | 4830 | $gd_post_types = $post_types; |
| 4831 | 4831 | |
@@ -4834,7 +4834,7 @@ discard block |
||
| 4834 | 4834 | |
| 4835 | 4835 | if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
|
| 4836 | 4836 | $json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
|
| 4837 | - wp_send_json( $json ); |
|
| 4837 | + wp_send_json($json); |
|
| 4838 | 4838 | } |
| 4839 | 4839 | |
| 4840 | 4840 | for ($i = 1; $i <= $limit; $i++) {
|
@@ -4842,59 +4842,59 @@ discard block |
||
| 4842 | 4842 | |
| 4843 | 4843 | if (isset($file[$index])) {
|
| 4844 | 4844 | $row = $file[$index]; |
| 4845 | - $row = array_map( 'trim', $row ); |
|
| 4845 | + $row = array_map('trim', $row);
|
|
| 4846 | 4846 | $data = array(); |
| 4847 | 4847 | |
| 4848 | - foreach ($columns as $c => $column ) {
|
|
| 4848 | + foreach ($columns as $c => $column) {
|
|
| 4849 | 4849 | 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'))) {
|
| 4850 | 4850 | $data[$column] = $row[$c]; |
| 4851 | 4851 | } |
| 4852 | 4852 | } |
| 4853 | 4853 | |
| 4854 | - if ( empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude']) ) {
|
|
| 4854 | + if (empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude'])) {
|
|
| 4855 | 4855 | $invalid++; |
| 4856 | 4856 | continue; |
| 4857 | 4857 | } |
| 4858 | 4858 | |
| 4859 | 4859 | $data['location_id'] = isset($data['location_id']) ? absint($data['location_id']) : 0; |
| 4860 | 4860 | |
| 4861 | - if ( $import_choice == 'update' ) {
|
|
| 4862 | - if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
|
|
| 4863 | - if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
|
|
| 4861 | + if ($import_choice == 'update') {
|
|
| 4862 | + if ((int) $data['location_id'] > 0 && $location = geodir_get_location_by_id('', (int) $data['location_id'])) {
|
|
| 4863 | + if ($location_id = geodir_location_update_city($data, true, $location)) {
|
|
| 4864 | 4864 | $updated++; |
| 4865 | 4865 | } else {
|
| 4866 | 4866 | $invalid++; |
| 4867 | 4867 | } |
| 4868 | - } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
|
|
| 4869 | - $data['location_id'] = (int)$location->location_id; |
|
| 4868 | + } else if (!empty($data['city_slug']) && $location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug']))) {
|
|
| 4869 | + $data['location_id'] = (int) $location->location_id; |
|
| 4870 | 4870 | |
| 4871 | - if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region'] ) ) ) {
|
|
| 4872 | - $data['location_id'] = (int)$location->location_id; |
|
| 4873 | - } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'region' => $data['region'] ) ) ) {
|
|
| 4874 | - $data['location_id'] = (int)$location->location_id; |
|
| 4875 | - } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'] ) ) ) {
|
|
| 4876 | - $data['location_id'] = (int)$location->location_id; |
|
| 4871 | + if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region']))) {
|
|
| 4872 | + $data['location_id'] = (int) $location->location_id; |
|
| 4873 | + } else if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'region' => $data['region']))) {
|
|
| 4874 | + $data['location_id'] = (int) $location->location_id; |
|
| 4875 | + } else if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'country' => $data['country']))) {
|
|
| 4876 | + $data['location_id'] = (int) $location->location_id; |
|
| 4877 | 4877 | } |
| 4878 | 4878 | |
| 4879 | - if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
|
|
| 4879 | + if ($location_id = geodir_location_update_city($data, true, $location)) {
|
|
| 4880 | 4880 | $updated++; |
| 4881 | 4881 | } else {
|
| 4882 | 4882 | $invalid++; |
| 4883 | 4883 | } |
| 4884 | 4884 | } else {
|
| 4885 | - if ( $location_id = geodir_location_insert_city( $data, true ) ) {
|
|
| 4885 | + if ($location_id = geodir_location_insert_city($data, true)) {
|
|
| 4886 | 4886 | $created++; |
| 4887 | 4887 | } else {
|
| 4888 | 4888 | $invalid++; |
| 4889 | 4889 | } |
| 4890 | 4890 | } |
| 4891 | - } elseif ( $import_choice == 'skip' ) {
|
|
| 4892 | - if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
|
|
| 4891 | + } elseif ($import_choice == 'skip') {
|
|
| 4892 | + if ((int) $data['location_id'] > 0 && $location = geodir_get_location_by_id('', (int) $data['location_id'])) {
|
|
| 4893 | 4893 | $skipped++; |
| 4894 | - } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
|
|
| 4894 | + } else if (!empty($data['city_slug']) && $location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug']))) {
|
|
| 4895 | 4895 | $skipped++; |
| 4896 | 4896 | } else {
|
| 4897 | - if ( $location_id = geodir_location_insert_city( $data, true ) ) {
|
|
| 4897 | + if ($location_id = geodir_location_insert_city($data, true)) {
|
|
| 4898 | 4898 | $created++; |
| 4899 | 4899 | } else {
|
| 4900 | 4900 | $invalid++; |
@@ -4915,14 +4915,14 @@ discard block |
||
| 4915 | 4915 | $json['invalid'] = $invalid; |
| 4916 | 4916 | $json['images'] = $images; |
| 4917 | 4917 | |
| 4918 | - wp_send_json( $json ); |
|
| 4919 | - } else if ( $task == 'import_hood' ) {
|
|
| 4918 | + wp_send_json($json); |
|
| 4919 | + } else if ($task == 'import_hood') {
|
|
| 4920 | 4920 | if (!empty($file)) {
|
| 4921 | 4921 | $columns = isset($file[0]) ? $file[0] : NULL; |
| 4922 | 4922 | |
| 4923 | 4923 | if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
|
| 4924 | 4924 | $json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
|
| 4925 | - wp_send_json( $json ); |
|
| 4925 | + wp_send_json($json); |
|
| 4926 | 4926 | } |
| 4927 | 4927 | |
| 4928 | 4928 | for ($i = 1; $i <= $limit; $i++) {
|
@@ -4930,7 +4930,7 @@ discard block |
||
| 4930 | 4930 | |
| 4931 | 4931 | if (isset($file[$index])) {
|
| 4932 | 4932 | $row = $file[$index]; |
| 4933 | - $row = array_map( 'trim', $row ); |
|
| 4933 | + $row = array_map('trim', $row);
|
|
| 4934 | 4934 | $data = array(); |
| 4935 | 4935 | |
| 4936 | 4936 | foreach ($columns as $c => $column) {
|
@@ -4945,8 +4945,8 @@ discard block |
||
| 4945 | 4945 | } |
| 4946 | 4946 | |
| 4947 | 4947 | $location_info = array(); |
| 4948 | - if (!empty($data['location_id']) && (int)$data['location_id'] > 0) {
|
|
| 4949 | - $location_info = geodir_get_location_by_id('', (int)$data['location_id']);
|
|
| 4948 | + if (!empty($data['location_id']) && (int) $data['location_id'] > 0) {
|
|
| 4949 | + $location_info = geodir_get_location_by_id('', (int) $data['location_id']);
|
|
| 4950 | 4950 | } else if (!empty($data['city']) && !empty($data['region']) && !empty($data['country'])) {
|
| 4951 | 4951 | $location_info = geodir_get_location_by_slug('city', array('fields' => 'location_id', 'city' => $data['city'], 'country' => $data['country'], 'region' => $data['region']));
|
| 4952 | 4952 | } |
@@ -4967,9 +4967,9 @@ discard block |
||
| 4967 | 4967 | $hood_data['hood_longitude'] = $data['longitude']; |
| 4968 | 4968 | $hood_data['hood_location_id'] = $location_id; |
| 4969 | 4969 | |
| 4970 | - if ( $import_choice == 'update' ) {
|
|
| 4971 | - if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
|
|
| 4972 | - $hood_data['hood_id'] = (int)$data['neighbourhood_id']; |
|
| 4970 | + if ($import_choice == 'update') {
|
|
| 4971 | + if ((int) $data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int) $data['neighbourhood_id']))) {
|
|
| 4972 | + $hood_data['hood_id'] = (int) $data['neighbourhood_id']; |
|
| 4973 | 4973 | |
| 4974 | 4974 | if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
|
| 4975 | 4975 | $updated++; |
@@ -4977,7 +4977,7 @@ discard block |
||
| 4977 | 4977 | $invalid++; |
| 4978 | 4978 | } |
| 4979 | 4979 | } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
|
| 4980 | - $hood_data['hood_id'] = (int)$neighbourhood->hood_id; |
|
| 4980 | + $hood_data['hood_id'] = (int) $neighbourhood->hood_id; |
|
| 4981 | 4981 | |
| 4982 | 4982 | if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
|
| 4983 | 4983 | $updated++; |
@@ -4991,8 +4991,8 @@ discard block |
||
| 4991 | 4991 | $invalid++; |
| 4992 | 4992 | } |
| 4993 | 4993 | } |
| 4994 | - } elseif ( $import_choice == 'skip' ) {
|
|
| 4995 | - if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
|
|
| 4994 | + } elseif ($import_choice == 'skip') {
|
|
| 4995 | + if ((int) $data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int) $data['neighbourhood_id']))) {
|
|
| 4996 | 4996 | $skipped++; |
| 4997 | 4997 | } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
|
| 4998 | 4998 | $skipped++; |
@@ -5019,7 +5019,7 @@ discard block |
||
| 5019 | 5019 | $json['invalid'] = $invalid; |
| 5020 | 5020 | $json['images'] = $images; |
| 5021 | 5021 | |
| 5022 | - wp_send_json( $json ); |
|
| 5022 | + wp_send_json($json); |
|
| 5023 | 5023 | } |
| 5024 | 5024 | } |
| 5025 | 5025 | break; |
@@ -5063,29 +5063,29 @@ discard block |
||
| 5063 | 5063 | * } |
| 5064 | 5064 | * @return int|bool Term id when success, false when fail. |
| 5065 | 5065 | */ |
| 5066 | -function geodir_imex_insert_term( $taxonomy, $term_data ) {
|
|
| 5067 | - if ( empty( $taxonomy ) || empty( $term_data ) ) {
|
|
| 5066 | +function geodir_imex_insert_term($taxonomy, $term_data) {
|
|
| 5067 | + if (empty($taxonomy) || empty($term_data)) {
|
|
| 5068 | 5068 | return false; |
| 5069 | 5069 | } |
| 5070 | 5070 | |
| 5071 | - $term = isset( $term_data['name'] ) && !empty( $term_data['name'] ) ? $term_data['name'] : ''; |
|
| 5071 | + $term = isset($term_data['name']) && !empty($term_data['name']) ? $term_data['name'] : ''; |
|
| 5072 | 5072 | $args = array(); |
| 5073 | - $args['description'] = isset( $term_data['description'] ) ? $term_data['description'] : ''; |
|
| 5074 | - $args['slug'] = isset( $term_data['slug'] ) ? $term_data['slug'] : ''; |
|
| 5075 | - $args['parent'] = isset( $term_data['parent'] ) ? (int)$term_data['parent'] : ''; |
|
| 5073 | + $args['description'] = isset($term_data['description']) ? $term_data['description'] : ''; |
|
| 5074 | + $args['slug'] = isset($term_data['slug']) ? $term_data['slug'] : ''; |
|
| 5075 | + $args['parent'] = isset($term_data['parent']) ? (int) $term_data['parent'] : ''; |
|
| 5076 | 5076 | |
| 5077 | - if ( ( !empty( $args['slug'] ) && term_exists( $args['slug'], $taxonomy ) ) || empty( $args['slug'] ) ) {
|
|
| 5078 | - $term_args = array_merge( $term_data, $args ); |
|
| 5079 | - $defaults = array( 'alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => ''); |
|
| 5080 | - $term_args = wp_parse_args( $term_args, $defaults ); |
|
| 5081 | - $term_args = sanitize_term( $term_args, $taxonomy, 'db' ); |
|
| 5082 | - $args['slug'] = wp_unique_term_slug( $args['slug'], (object)$term_args ); |
|
| 5077 | + if ((!empty($args['slug']) && term_exists($args['slug'], $taxonomy)) || empty($args['slug'])) {
|
|
| 5078 | + $term_args = array_merge($term_data, $args); |
|
| 5079 | + $defaults = array('alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '');
|
|
| 5080 | + $term_args = wp_parse_args($term_args, $defaults); |
|
| 5081 | + $term_args = sanitize_term($term_args, $taxonomy, 'db'); |
|
| 5082 | + $args['slug'] = wp_unique_term_slug($args['slug'], (object) $term_args); |
|
| 5083 | 5083 | } |
| 5084 | 5084 | |
| 5085 | - if( !empty( $term ) ) {
|
|
| 5086 | - $result = wp_insert_term( $term, $taxonomy, $args ); |
|
| 5087 | - if( !is_wp_error( $result ) ) {
|
|
| 5088 | - return $term_id = isset( $result['term_id'] ) ? $result['term_id'] : 0; |
|
| 5085 | + if (!empty($term)) {
|
|
| 5086 | + $result = wp_insert_term($term, $taxonomy, $args); |
|
| 5087 | + if (!is_wp_error($result)) {
|
|
| 5088 | + return $term_id = isset($result['term_id']) ? $result['term_id'] : 0; |
|
| 5089 | 5089 | } |
| 5090 | 5090 | } |
| 5091 | 5091 | |
@@ -5115,37 +5115,37 @@ discard block |
||
| 5115 | 5115 | * } |
| 5116 | 5116 | * @return int|bool Term id when success, false when fail. |
| 5117 | 5117 | */ |
| 5118 | -function geodir_imex_update_term( $taxonomy, $term_data ) {
|
|
| 5119 | - if ( empty( $taxonomy ) || empty( $term_data ) ) {
|
|
| 5118 | +function geodir_imex_update_term($taxonomy, $term_data) {
|
|
| 5119 | + if (empty($taxonomy) || empty($term_data)) {
|
|
| 5120 | 5120 | return false; |
| 5121 | 5121 | } |
| 5122 | 5122 | |
| 5123 | - $term = isset( $term_data['name'] ) && !empty( $term_data['name'] ) ? $term_data['name'] : ''; |
|
| 5124 | - $term_id = isset( $term_data['term_id'] ) && !empty( $term_data['term_id'] ) ? $term_data['term_id'] : 0; |
|
| 5123 | + $term = isset($term_data['name']) && !empty($term_data['name']) ? $term_data['name'] : ''; |
|
| 5124 | + $term_id = isset($term_data['term_id']) && !empty($term_data['term_id']) ? $term_data['term_id'] : 0; |
|
| 5125 | 5125 | |
| 5126 | 5126 | $args = array(); |
| 5127 | - $args['description'] = isset( $term_data['description'] ) ? $term_data['description'] : ''; |
|
| 5128 | - $args['slug'] = isset( $term_data['slug'] ) ? $term_data['slug'] : ''; |
|
| 5129 | - $args['parent'] = isset( $term_data['parent'] ) ? (int)$term_data['parent'] : ''; |
|
| 5127 | + $args['description'] = isset($term_data['description']) ? $term_data['description'] : ''; |
|
| 5128 | + $args['slug'] = isset($term_data['slug']) ? $term_data['slug'] : ''; |
|
| 5129 | + $args['parent'] = isset($term_data['parent']) ? (int) $term_data['parent'] : ''; |
|
| 5130 | 5130 | |
| 5131 | - if ( $term_id > 0 && $term_info = (array)get_term( $term_id, $taxonomy ) ) {
|
|
| 5131 | + if ($term_id > 0 && $term_info = (array) get_term($term_id, $taxonomy)) {
|
|
| 5132 | 5132 | $term_data['term_id'] = $term_info['term_id']; |
| 5133 | 5133 | |
| 5134 | - $result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data ); |
|
| 5134 | + $result = wp_update_term($term_data['term_id'], $taxonomy, $term_data); |
|
| 5135 | 5135 | |
| 5136 | - if( !is_wp_error( $result ) ) {
|
|
| 5137 | - return $term_id = isset( $result['term_id'] ) ? $result['term_id'] : 0; |
|
| 5136 | + if (!is_wp_error($result)) {
|
|
| 5137 | + return $term_id = isset($result['term_id']) ? $result['term_id'] : 0; |
|
| 5138 | 5138 | } |
| 5139 | - } else if ( $term_data['slug'] != '' && $term_info = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
|
|
| 5139 | + } else if ($term_data['slug'] != '' && $term_info = (array) term_exists($term_data['slug'], $taxonomy)) {
|
|
| 5140 | 5140 | $term_data['term_id'] = $term_info['term_id']; |
| 5141 | 5141 | |
| 5142 | - $result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data ); |
|
| 5142 | + $result = wp_update_term($term_data['term_id'], $taxonomy, $term_data); |
|
| 5143 | 5143 | |
| 5144 | - if( !is_wp_error( $result ) ) {
|
|
| 5145 | - return $term_id = isset( $result['term_id'] ) ? $result['term_id'] : 0; |
|
| 5144 | + if (!is_wp_error($result)) {
|
|
| 5145 | + return $term_id = isset($result['term_id']) ? $result['term_id'] : 0; |
|
| 5146 | 5146 | } |
| 5147 | 5147 | } else {
|
| 5148 | - return geodir_imex_insert_term( $taxonomy, $term_data ); |
|
| 5148 | + return geodir_imex_insert_term($taxonomy, $term_data); |
|
| 5149 | 5149 | } |
| 5150 | 5150 | |
| 5151 | 5151 | return false; |
@@ -5160,9 +5160,9 @@ discard block |
||
| 5160 | 5160 | * @param string $post_type Post type. |
| 5161 | 5161 | * @return int Posts count. |
| 5162 | 5162 | */ |
| 5163 | -function geodir_get_posts_count( $post_type ) {
|
|
| 5164 | - $posts_count = wp_count_posts( $post_type ); |
|
| 5165 | - $posts_count = array_sum( (array)$posts_count ); |
|
| 5163 | +function geodir_get_posts_count($post_type) {
|
|
| 5164 | + $posts_count = wp_count_posts($post_type); |
|
| 5165 | + $posts_count = array_sum((array) $posts_count); |
|
| 5166 | 5166 | |
| 5167 | 5167 | /** |
| 5168 | 5168 | * Modify returned post counts for the current post type. |
@@ -5173,7 +5173,7 @@ discard block |
||
| 5173 | 5173 | * @param int $posts_count Post counts. |
| 5174 | 5174 | * @param string $post_type Post type. |
| 5175 | 5175 | */ |
| 5176 | - $posts_count = apply_filters( 'geodir_imex_count_posts', $posts_count, $post_type ); |
|
| 5176 | + $posts_count = apply_filters('geodir_imex_count_posts', $posts_count, $post_type);
|
|
| 5177 | 5177 | |
| 5178 | 5178 | return $posts_count; |
| 5179 | 5179 | } |
@@ -5191,8 +5191,8 @@ discard block |
||
| 5191 | 5191 | * @param string $post_type Post type. |
| 5192 | 5192 | * @return int Posts count. |
| 5193 | 5193 | */ |
| 5194 | -function geodir_imex_count_events( $posts_count, $post_type ) {
|
|
| 5195 | - if ( $post_type == 'gd_event' ) {
|
|
| 5194 | +function geodir_imex_count_events($posts_count, $post_type) {
|
|
| 5195 | + if ($post_type == 'gd_event') {
|
|
| 5196 | 5196 | global $wpdb, $plugin_prefix; |
| 5197 | 5197 | |
| 5198 | 5198 | $table = $plugin_prefix . $post_type . '_detail'; |
@@ -5200,7 +5200,7 @@ discard block |
||
| 5200 | 5200 | |
| 5201 | 5201 | $query = "SELECT COUNT({$wpdb->posts}.ID) AS total 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";
|
| 5202 | 5202 | |
| 5203 | - $posts_count = (int)$wpdb->get_var( $wpdb->prepare( $query, $post_type ) ); |
|
| 5203 | + $posts_count = (int) $wpdb->get_var($wpdb->prepare($query, $post_type)); |
|
| 5204 | 5204 | } |
| 5205 | 5205 | |
| 5206 | 5206 | return $posts_count; |
@@ -5222,17 +5222,17 @@ discard block |
||
| 5222 | 5222 | * @param int $page_no Page number. Default 0. |
| 5223 | 5223 | * @return array Array of posts data. |
| 5224 | 5224 | */ |
| 5225 | -function geodir_imex_get_posts( $post_type, $per_page = 0, $page_no = 0 ) {
|
|
| 5225 | +function geodir_imex_get_posts($post_type, $per_page = 0, $page_no = 0) {
|
|
| 5226 | 5226 | global $wp_filesystem; |
| 5227 | 5227 | |
| 5228 | - $posts = geodir_get_export_posts( $post_type, $per_page, $page_no ); |
|
| 5228 | + $posts = geodir_get_export_posts($post_type, $per_page, $page_no); |
|
| 5229 | 5229 | |
| 5230 | 5230 | $csv_rows = array(); |
| 5231 | 5231 | |
| 5232 | - if ( !empty( $posts ) ) {
|
|
| 5233 | - $is_payment_plugin = is_plugin_active( 'geodir_payment_manager/geodir_payment_manager.php' ); |
|
| 5232 | + if (!empty($posts)) {
|
|
| 5233 | + $is_payment_plugin = is_plugin_active('geodir_payment_manager/geodir_payment_manager.php');
|
|
| 5234 | 5234 | $location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
|
| 5235 | - $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true; |
|
| 5235 | + $location_allowed = function_exists('geodir_cpt_no_location') && geodir_cpt_no_location($post_type) ? false : true;
|
|
| 5236 | 5236 | $neighbourhood_active = $location_manager && $location_allowed && get_option('location_neighbourhoods') ? true : false;
|
| 5237 | 5237 | |
| 5238 | 5238 | $csv_row = array(); |
@@ -5244,7 +5244,7 @@ discard block |
||
| 5244 | 5244 | $csv_row[] = 'default_category'; |
| 5245 | 5245 | $csv_row[] = 'post_tags'; |
| 5246 | 5246 | $csv_row[] = 'post_type'; |
| 5247 | - if ( $post_type == 'gd_event' ) {
|
|
| 5247 | + if ($post_type == 'gd_event') {
|
|
| 5248 | 5248 | $csv_row[] = 'event_date'; |
| 5249 | 5249 | $csv_row[] = 'event_enddate'; |
| 5250 | 5250 | $csv_row[] = 'starttime'; |
@@ -5298,15 +5298,15 @@ discard block |
||
| 5298 | 5298 | } |
| 5299 | 5299 | // WPML |
| 5300 | 5300 | |
| 5301 | - $custom_fields = geodir_imex_get_custom_fields( $post_type ); |
|
| 5302 | - if ( !empty( $custom_fields ) ) {
|
|
| 5303 | - foreach ( $custom_fields as $custom_field ) {
|
|
| 5301 | + $custom_fields = geodir_imex_get_custom_fields($post_type); |
|
| 5302 | + if (!empty($custom_fields)) {
|
|
| 5303 | + foreach ($custom_fields as $custom_field) {
|
|
| 5304 | 5304 | $csv_row[] = $custom_field->htmlvar_name; |
| 5305 | 5305 | } |
| 5306 | 5306 | } |
| 5307 | 5307 | |
| 5308 | 5308 | // Export franchise fields |
| 5309 | - $is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false; |
|
| 5309 | + $is_franchise_active = is_plugin_active('geodir_franchise/geodir_franchise.php') && geodir_franchise_enabled($post_type) ? true : false;
|
|
| 5310 | 5310 | if ($is_franchise_active) {
|
| 5311 | 5311 | $csv_row[] = 'gd_is_franchise'; |
| 5312 | 5312 | $csv_row[] = 'gd_franchise_lock'; |
@@ -5316,12 +5316,12 @@ discard block |
||
| 5316 | 5316 | $csv_rows[] = $csv_row; |
| 5317 | 5317 | |
| 5318 | 5318 | $images_count = 5; |
| 5319 | - $xx=0; |
|
| 5320 | - foreach ( $posts as $post ) {$xx++;
|
|
| 5319 | + $xx = 0; |
|
| 5320 | + foreach ($posts as $post) {$xx++;
|
|
| 5321 | 5321 | $post_id = $post['ID']; |
| 5322 | 5322 | |
| 5323 | - $gd_post_info = geodir_get_post_info( $post_id ); |
|
| 5324 | - $post_info = (array)$gd_post_info; |
|
| 5323 | + $gd_post_info = geodir_get_post_info($post_id); |
|
| 5324 | + $post_info = (array) $gd_post_info; |
|
| 5325 | 5325 | |
| 5326 | 5326 | $taxonomy_category = $post_type . 'category'; |
| 5327 | 5327 | $taxonomy_tags = $post_type . '_tags'; |
@@ -5330,14 +5330,14 @@ discard block |
||
| 5330 | 5330 | $default_category_id = $gd_post_info->default_category; |
| 5331 | 5331 | $default_category = ''; |
| 5332 | 5332 | $post_tags = ''; |
| 5333 | - $terms = wp_get_post_terms( $post_id, array( $taxonomy_category, $taxonomy_tags ) ); |
|
| 5333 | + $terms = wp_get_post_terms($post_id, array($taxonomy_category, $taxonomy_tags)); |
|
| 5334 | 5334 | |
| 5335 | - if ( !empty( $terms ) && !is_wp_error( $terms ) ) {
|
|
| 5335 | + if (!empty($terms) && !is_wp_error($terms)) {
|
|
| 5336 | 5336 | $post_category = array(); |
| 5337 | 5337 | $post_tags = array(); |
| 5338 | 5338 | |
| 5339 | - foreach ( $terms as $term ) {
|
|
| 5340 | - if ( $term->taxonomy == $taxonomy_category ) {
|
|
| 5339 | + foreach ($terms as $term) {
|
|
| 5340 | + if ($term->taxonomy == $taxonomy_category) {
|
|
| 5341 | 5341 | $post_category[] = $term->name; |
| 5342 | 5342 | |
| 5343 | 5343 | if ($default_category_id == $term->term_id) {
|
@@ -5345,7 +5345,7 @@ discard block |
||
| 5345 | 5345 | } |
| 5346 | 5346 | } |
| 5347 | 5347 | |
| 5348 | - if ( $term->taxonomy == $taxonomy_tags ) {
|
|
| 5348 | + if ($term->taxonomy == $taxonomy_tags) {
|
|
| 5349 | 5349 | $post_tags[] = $term->name; |
| 5350 | 5350 | } |
| 5351 | 5351 | } |
@@ -5353,8 +5353,8 @@ discard block |
||
| 5353 | 5353 | if (empty($default_category) && !empty($post_category)) {
|
| 5354 | 5354 | $default_category = $post_category[0]; // Set first one as default category. |
| 5355 | 5355 | } |
| 5356 | - $post_category = !empty( $post_category ) ? implode( ',', $post_category ) : ''; |
|
| 5357 | - $post_tags = !empty( $post_tags ) ? implode( ',', $post_tags ) : ''; |
|
| 5356 | + $post_category = !empty($post_category) ? implode(',', $post_category) : '';
|
|
| 5357 | + $post_tags = !empty($post_tags) ? implode(',', $post_tags) : '';
|
|
| 5358 | 5358 | } |
| 5359 | 5359 | |
| 5360 | 5360 | // Franchise data |
@@ -5362,42 +5362,42 @@ discard block |
||
| 5362 | 5362 | $franchise_info = array(); |
| 5363 | 5363 | $locked_fields = array(); |
| 5364 | 5364 | |
| 5365 | - if ($is_franchise_active && isset($post_info['franchise']) && (int)$post_info['franchise'] > 0 && geodir_franchise_check((int)$post_info['franchise'])) {
|
|
| 5365 | + if ($is_franchise_active && isset($post_info['franchise']) && (int) $post_info['franchise'] > 0 && geodir_franchise_check((int) $post_info['franchise'])) {
|
|
| 5366 | 5366 | $franchise_id = $post_info['franchise']; |
| 5367 | 5367 | $gd_franchise_info = geodir_get_post_info($franchise_id); |
| 5368 | 5368 | |
| 5369 | 5369 | if (geodir_franchise_pkg_is_active($gd_franchise_info)) {
|
| 5370 | - $franchise_info = (array)$gd_franchise_info; |
|
| 5370 | + $franchise_info = (array) $gd_franchise_info; |
|
| 5371 | 5371 | $locked_fields = geodir_franchise_get_locked_fields($franchise_id, true); |
| 5372 | 5372 | |
| 5373 | 5373 | if (!empty($locked_fields)) {
|
| 5374 | - foreach( $locked_fields as $locked_field) {
|
|
| 5374 | + foreach ($locked_fields as $locked_field) {
|
|
| 5375 | 5375 | if (isset($post_info[$locked_field]) && isset($franchise_info[$locked_field])) {
|
| 5376 | 5376 | $post_info[$locked_field] = $franchise_info[$locked_field]; |
| 5377 | 5377 | } |
| 5378 | 5378 | |
| 5379 | 5379 | if (in_array($taxonomy_category, $locked_fields) || in_array('post_tags', $locked_fields)) {
|
| 5380 | - $franchise_terms = wp_get_post_terms( $franchise_id, array( $taxonomy_category, $taxonomy_tags ) ); |
|
| 5380 | + $franchise_terms = wp_get_post_terms($franchise_id, array($taxonomy_category, $taxonomy_tags)); |
|
| 5381 | 5381 | |
| 5382 | - if ( !empty( $franchise_terms ) && !is_wp_error( $franchise_terms ) ) {
|
|
| 5382 | + if (!empty($franchise_terms) && !is_wp_error($franchise_terms)) {
|
|
| 5383 | 5383 | $franchise_post_category = array(); |
| 5384 | 5384 | $franchise_post_tags = array(); |
| 5385 | 5385 | |
| 5386 | - foreach ( $franchise_terms as $franchise_term ) {
|
|
| 5387 | - if ( $franchise_term->taxonomy == $taxonomy_category ) {
|
|
| 5386 | + foreach ($franchise_terms as $franchise_term) {
|
|
| 5387 | + if ($franchise_term->taxonomy == $taxonomy_category) {
|
|
| 5388 | 5388 | $franchise_post_category[] = $franchise_term->name; |
| 5389 | 5389 | } |
| 5390 | 5390 | |
| 5391 | - if ( $franchise_term->taxonomy == $taxonomy_tags ) {
|
|
| 5391 | + if ($franchise_term->taxonomy == $taxonomy_tags) {
|
|
| 5392 | 5392 | $franchise_post_tags[] = $franchise_term->name; |
| 5393 | 5393 | } |
| 5394 | 5394 | } |
| 5395 | 5395 | |
| 5396 | 5396 | if (in_array($taxonomy_category, $locked_fields)) {
|
| 5397 | - $post_category = !empty( $franchise_post_category ) ? implode( ',', $franchise_post_category ) : ''; |
|
| 5397 | + $post_category = !empty($franchise_post_category) ? implode(',', $franchise_post_category) : '';
|
|
| 5398 | 5398 | } |
| 5399 | 5399 | if (in_array('post_tags', $locked_fields)) {
|
| 5400 | - $post_tags = !empty( $franchise_post_tags ) ? implode( ',', $franchise_post_tags ) : ''; |
|
| 5400 | + $post_tags = !empty($franchise_post_tags) ? implode(',', $franchise_post_tags) : '';
|
|
| 5401 | 5401 | } |
| 5402 | 5402 | } |
| 5403 | 5403 | } |
@@ -5406,18 +5406,18 @@ discard block |
||
| 5406 | 5406 | } |
| 5407 | 5407 | } |
| 5408 | 5408 | |
| 5409 | - $post_images = geodir_get_images( $post_id ); |
|
| 5409 | + $post_images = geodir_get_images($post_id); |
|
| 5410 | 5410 | $current_images = array(); |
| 5411 | - if ( !empty( $post_images ) ) {
|
|
| 5412 | - foreach ( $post_images as $post_image ) {
|
|
| 5413 | - $post_image = (array)$post_image; |
|
| 5414 | - $image = !empty( $post_image ) && isset( $post_image['path'] ) && $wp_filesystem->is_file( $post_image['path'] ) && $wp_filesystem->exists( $post_image['path'] ) ? $post_image['src'] : ''; |
|
| 5415 | - if ( $image ) {
|
|
| 5411 | + if (!empty($post_images)) {
|
|
| 5412 | + foreach ($post_images as $post_image) {
|
|
| 5413 | + $post_image = (array) $post_image; |
|
| 5414 | + $image = !empty($post_image) && isset($post_image['path']) && $wp_filesystem->is_file($post_image['path']) && $wp_filesystem->exists($post_image['path']) ? $post_image['src'] : ''; |
|
| 5415 | + if ($image) {
|
|
| 5416 | 5416 | $current_images[] = $image; |
| 5417 | 5417 | } |
| 5418 | 5418 | } |
| 5419 | 5419 | |
| 5420 | - $images_count = max( $images_count, count( $current_images ) ); |
|
| 5420 | + $images_count = max($images_count, count($current_images)); |
|
| 5421 | 5421 | } |
| 5422 | 5422 | |
| 5423 | 5423 | $csv_row = array(); |
@@ -5429,7 +5429,7 @@ discard block |
||
| 5429 | 5429 | $csv_row[] = $default_category; // default_category |
| 5430 | 5430 | $csv_row[] = $post_tags; // post_tags |
| 5431 | 5431 | $csv_row[] = $post_type; // post_type |
| 5432 | - if ( $post_type == 'gd_event' ) {
|
|
| 5432 | + if ($post_type == 'gd_event') {
|
|
| 5433 | 5433 | $event_data = geodir_imex_get_event_data($post, $gd_post_info); |
| 5434 | 5434 | $csv_row[] = $event_data['event_date']; // event_date |
| 5435 | 5435 | $csv_row[] = $event_data['event_enddate']; // enddate |
@@ -5450,9 +5450,9 @@ discard block |
||
| 5450 | 5450 | $csv_row[] = $event_data['recurring_end_date']; // repeat_end |
| 5451 | 5451 | } |
| 5452 | 5452 | $csv_row[] = $post_info['post_status']; // post_status |
| 5453 | - $csv_row[] = (int)$post_info['is_featured'] == 1 ? 1 : ''; // is_featured |
|
| 5453 | + $csv_row[] = (int) $post_info['is_featured'] == 1 ? 1 : ''; // is_featured |
|
| 5454 | 5454 | if ($is_payment_plugin) {
|
| 5455 | - $csv_row[] = (int)$post_info['package_id']; // package_id |
|
| 5455 | + $csv_row[] = (int) $post_info['package_id']; // package_id |
|
| 5456 | 5456 | $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
|
| 5457 | 5457 | } |
| 5458 | 5458 | $csv_row[] = $post_info['geodir_video']; // geodir_video |
@@ -5488,14 +5488,14 @@ discard block |
||
| 5488 | 5488 | $csv_row[] = $post_info['geodir_special_offers']; // geodir_special_offers |
| 5489 | 5489 | // WPML |
| 5490 | 5490 | if ($is_wpml) {
|
| 5491 | - $csv_row[] = geodir_get_language_for_element( $post_id, 'post_' . $post_type ); |
|
| 5492 | - $csv_row[] = geodir_imex_original_post_id( $post_id, 'post_' . $post_type ); |
|
| 5491 | + $csv_row[] = geodir_get_language_for_element($post_id, 'post_' . $post_type); |
|
| 5492 | + $csv_row[] = geodir_imex_original_post_id($post_id, 'post_' . $post_type); |
|
| 5493 | 5493 | } |
| 5494 | 5494 | // WPML |
| 5495 | 5495 | |
| 5496 | - if ( !empty( $custom_fields ) ) {
|
|
| 5497 | - foreach ( $custom_fields as $custom_field ) {
|
|
| 5498 | - $csv_row[] = isset( $post_info[$custom_field->htmlvar_name] ) ? $post_info[$custom_field->htmlvar_name] : ''; |
|
| 5496 | + if (!empty($custom_fields)) {
|
|
| 5497 | + foreach ($custom_fields as $custom_field) {
|
|
| 5498 | + $csv_row[] = isset($post_info[$custom_field->htmlvar_name]) ? $post_info[$custom_field->htmlvar_name] : ''; |
|
| 5499 | 5499 | } |
| 5500 | 5500 | } |
| 5501 | 5501 | |
@@ -5506,26 +5506,26 @@ discard block |
||
| 5506 | 5506 | $franchise = ''; |
| 5507 | 5507 | |
| 5508 | 5508 | if (geodir_franchise_pkg_is_active($gd_post_info)) {
|
| 5509 | - $gd_is_franchise = (int)get_post_meta( $post_id, 'gd_is_franchise', true ); |
|
| 5510 | - $locaked_fields = $gd_is_franchise ? get_post_meta( $post_id, 'gd_franchise_lock', true ) : ''; |
|
| 5509 | + $gd_is_franchise = (int) get_post_meta($post_id, 'gd_is_franchise', true); |
|
| 5510 | + $locaked_fields = $gd_is_franchise ? get_post_meta($post_id, 'gd_franchise_lock', true) : ''; |
|
| 5511 | 5511 | $locaked_fields = (is_array($locaked_fields) && !empty($locaked_fields) ? implode(",", $locaked_fields) : '');
|
| 5512 | - $franchise = !$gd_is_franchise && isset($post_info['franchise']) && (int)$post_info['franchise'] > 0 ? (int)$post_info['franchise'] : 0; // franchise id |
|
| 5512 | + $franchise = !$gd_is_franchise && isset($post_info['franchise']) && (int) $post_info['franchise'] > 0 ? (int) $post_info['franchise'] : 0; // franchise id |
|
| 5513 | 5513 | } |
| 5514 | 5514 | |
| 5515 | - $csv_row[] = (int)$gd_is_franchise; // gd_is_franchise |
|
| 5515 | + $csv_row[] = (int) $gd_is_franchise; // gd_is_franchise |
|
| 5516 | 5516 | $csv_row[] = $locaked_fields; // gd_franchise_lock fields |
| 5517 | - $csv_row[] = (int)$franchise; // franchise id |
|
| 5517 | + $csv_row[] = (int) $franchise; // franchise id |
|
| 5518 | 5518 | } |
| 5519 | 5519 | |
| 5520 | - for ( $c = 0; $c < $images_count; $c++ ) {
|
|
| 5521 | - $csv_row[] = isset( $current_images[$c] ) ? $current_images[$c] : ''; // IMAGE |
|
| 5520 | + for ($c = 0; $c < $images_count; $c++) {
|
|
| 5521 | + $csv_row[] = isset($current_images[$c]) ? $current_images[$c] : ''; // IMAGE |
|
| 5522 | 5522 | } |
| 5523 | 5523 | |
| 5524 | 5524 | $csv_rows[] = $csv_row; |
| 5525 | 5525 | |
| 5526 | 5526 | } |
| 5527 | 5527 | |
| 5528 | - for ( $c = 0; $c < $images_count; $c++ ) {
|
|
| 5528 | + for ($c = 0; $c < $images_count; $c++) {
|
|
| 5529 | 5529 | $csv_rows[0][] = 'IMAGE'; |
| 5530 | 5530 | } |
| 5531 | 5531 | } |
@@ -5547,19 +5547,19 @@ discard block |
||
| 5547 | 5547 | * @param int $page_no Page number. Default 0. |
| 5548 | 5548 | * @return array Array of posts data. |
| 5549 | 5549 | */ |
| 5550 | -function geodir_get_export_posts( $post_type, $per_page = 0, $page_no = 0 ) {
|
|
| 5550 | +function geodir_get_export_posts($post_type, $per_page = 0, $page_no = 0) {
|
|
| 5551 | 5551 | global $wpdb, $plugin_prefix; |
| 5552 | 5552 | |
| 5553 | - if ( ! post_type_exists( $post_type ) ) |
|
| 5553 | + if (!post_type_exists($post_type)) |
|
| 5554 | 5554 | return new stdClass; |
| 5555 | 5555 | |
| 5556 | 5556 | $table = $plugin_prefix . $post_type . '_detail'; |
| 5557 | 5557 | |
| 5558 | 5558 | $limit = ''; |
| 5559 | - if ( $per_page > 0 && $page_no > 0 ) {
|
|
| 5560 | - $offset = ( $page_no - 1 ) * $per_page; |
|
| 5559 | + if ($per_page > 0 && $page_no > 0) {
|
|
| 5560 | + $offset = ($page_no - 1) * $per_page; |
|
| 5561 | 5561 | |
| 5562 | - if ( $offset > 0 ) {
|
|
| 5562 | + if ($offset > 0) {
|
|
| 5563 | 5563 | $limit = " LIMIT " . $offset . "," . $per_page; |
| 5564 | 5564 | } else {
|
| 5565 | 5565 | $limit = " LIMIT " . $per_page; |
@@ -5576,9 +5576,9 @@ discard block |
||
| 5576 | 5576 | * @param int $query The SQL query. |
| 5577 | 5577 | * @param string $post_type Post type. |
| 5578 | 5578 | */ |
| 5579 | - $query = apply_filters( 'geodir_imex_export_posts_query', $query, $post_type ); |
|
| 5579 | + $query = apply_filters('geodir_imex_export_posts_query', $query, $post_type);
|
|
| 5580 | 5580 | |
| 5581 | - $results = (array)$wpdb->get_results( $wpdb->prepare( $query, $post_type ), ARRAY_A ); |
|
| 5581 | + $results = (array) $wpdb->get_results($wpdb->prepare($query, $post_type), ARRAY_A); |
|
| 5582 | 5582 | |
| 5583 | 5583 | /** |
| 5584 | 5584 | * Modify returned post results for the current post type. |
@@ -5589,7 +5589,7 @@ discard block |
||
| 5589 | 5589 | * @param object $results An object containing all post ids. |
| 5590 | 5590 | * @param string $post_type Post type. |
| 5591 | 5591 | */ |
| 5592 | - return apply_filters( 'geodir_export_posts', $results, $post_type ); |
|
| 5592 | + return apply_filters('geodir_export_posts', $results, $post_type);
|
|
| 5593 | 5593 | } |
| 5594 | 5594 | |
| 5595 | 5595 | /** |
@@ -5606,8 +5606,8 @@ discard block |
||
| 5606 | 5606 | * @param string $post_type Post type. |
| 5607 | 5607 | * @return string The SQL query. |
| 5608 | 5608 | */ |
| 5609 | -function geodir_imex_get_events_query( $query, $post_type ) {
|
|
| 5610 | - if ( $post_type == 'gd_event' ) {
|
|
| 5609 | +function geodir_imex_get_events_query($query, $post_type) {
|
|
| 5610 | + if ($post_type == 'gd_event') {
|
|
| 5611 | 5611 | global $wpdb, $plugin_prefix; |
| 5612 | 5612 | |
| 5613 | 5613 | $table = $plugin_prefix . $post_type . '_detail'; |
@@ -5628,15 +5628,15 @@ discard block |
||
| 5628 | 5628 | * @param string $post_type Post type. |
| 5629 | 5629 | * @return int Total terms count. |
| 5630 | 5630 | */ |
| 5631 | -function geodir_get_terms_count( $post_type ) {
|
|
| 5632 | - $args = array( 'hide_empty' => 0 ); |
|
| 5631 | +function geodir_get_terms_count($post_type) {
|
|
| 5632 | + $args = array('hide_empty' => 0);
|
|
| 5633 | 5633 | |
| 5634 | - remove_all_filters( 'get_terms' ); |
|
| 5634 | + remove_all_filters('get_terms');
|
|
| 5635 | 5635 | |
| 5636 | 5636 | $taxonomy = $post_type . 'category'; |
| 5637 | 5637 | |
| 5638 | - $count_terms = wp_count_terms( $taxonomy, $args ); |
|
| 5639 | - $count_terms = !is_wp_error( $count_terms ) ? $count_terms : 0; |
|
| 5638 | + $count_terms = wp_count_terms($taxonomy, $args); |
|
| 5639 | + $count_terms = !is_wp_error($count_terms) ? $count_terms : 0; |
|
| 5640 | 5640 | |
| 5641 | 5641 | return $count_terms; |
| 5642 | 5642 | } |
@@ -5653,23 +5653,23 @@ discard block |
||
| 5653 | 5653 | * @param int $page_no Page number. Default 0. |
| 5654 | 5654 | * @return array Array of terms data. |
| 5655 | 5655 | */ |
| 5656 | -function geodir_imex_get_terms( $post_type, $per_page = 0, $page_no = 0 ) {
|
|
| 5657 | - $args = array( 'hide_empty' => 0, 'orderby' => 'id' ); |
|
| 5656 | +function geodir_imex_get_terms($post_type, $per_page = 0, $page_no = 0) {
|
|
| 5657 | + $args = array('hide_empty' => 0, 'orderby' => 'id');
|
|
| 5658 | 5658 | |
| 5659 | - remove_all_filters( 'get_terms' ); |
|
| 5659 | + remove_all_filters('get_terms');
|
|
| 5660 | 5660 | |
| 5661 | 5661 | $taxonomy = $post_type . 'category'; |
| 5662 | 5662 | |
| 5663 | - if ( $per_page > 0 && $page_no > 0 ) {
|
|
| 5664 | - $args['offset'] = ( $page_no - 1 ) * $per_page; |
|
| 5663 | + if ($per_page > 0 && $page_no > 0) {
|
|
| 5664 | + $args['offset'] = ($page_no - 1) * $per_page; |
|
| 5665 | 5665 | $args['number'] = $per_page; |
| 5666 | 5666 | } |
| 5667 | 5667 | |
| 5668 | - $terms = get_terms( $taxonomy, $args ); |
|
| 5668 | + $terms = get_terms($taxonomy, $args); |
|
| 5669 | 5669 | |
| 5670 | 5670 | $csv_rows = array(); |
| 5671 | 5671 | |
| 5672 | - if ( !empty( $terms ) ) {
|
|
| 5672 | + if (!empty($terms)) {
|
|
| 5673 | 5673 | $csv_row = array(); |
| 5674 | 5674 | $csv_row[] = 'cat_id'; |
| 5675 | 5675 | $csv_row[] = 'cat_name'; |
@@ -5690,16 +5690,16 @@ discard block |
||
| 5690 | 5690 | |
| 5691 | 5691 | $csv_rows[] = $csv_row; |
| 5692 | 5692 | |
| 5693 | - foreach ( $terms as $term ) {
|
|
| 5694 | - $cat_icon = get_tax_meta( $term->term_id, 'ct_cat_icon', false, $post_type ); |
|
| 5695 | - $cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : ''; |
|
| 5693 | + foreach ($terms as $term) {
|
|
| 5694 | + $cat_icon = get_tax_meta($term->term_id, 'ct_cat_icon', false, $post_type); |
|
| 5695 | + $cat_icon = !empty($cat_icon) && isset($cat_icon['src']) ? $cat_icon['src'] : ''; |
|
| 5696 | 5696 | |
| 5697 | - $cat_image = geodir_get_default_catimage( $term->term_id, $post_type ); |
|
| 5698 | - $cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : ''; |
|
| 5697 | + $cat_image = geodir_get_default_catimage($term->term_id, $post_type); |
|
| 5698 | + $cat_image = !empty($cat_image) && isset($cat_image['src']) ? $cat_image['src'] : ''; |
|
| 5699 | 5699 | |
| 5700 | 5700 | $cat_parent = ''; |
| 5701 | - if (isset($term->parent) && (int)$term->parent > 0 && term_exists((int)$term->parent, $taxonomy)) {
|
|
| 5702 | - $parent_term = (array)get_term_by( 'id', (int)$term->parent, $taxonomy ); |
|
| 5701 | + if (isset($term->parent) && (int) $term->parent > 0 && term_exists((int) $term->parent, $taxonomy)) {
|
|
| 5702 | + $parent_term = (array) get_term_by('id', (int) $term->parent, $taxonomy);
|
|
| 5703 | 5703 | $cat_parent = !empty($parent_term) && isset($parent_term['name']) ? $parent_term['name'] : ''; |
| 5704 | 5704 | } |
| 5705 | 5705 | |
@@ -5709,14 +5709,14 @@ discard block |
||
| 5709 | 5709 | $csv_row[] = $term->slug; |
| 5710 | 5710 | $csv_row[] = $post_type; |
| 5711 | 5711 | $csv_row[] = $cat_parent; |
| 5712 | - $csv_row[] = get_tax_meta( $term->term_id, 'ct_cat_schema', false, $post_type ); |
|
| 5712 | + $csv_row[] = get_tax_meta($term->term_id, 'ct_cat_schema', false, $post_type); |
|
| 5713 | 5713 | $csv_row[] = $term->description; |
| 5714 | - $csv_row[] = get_tax_meta( $term->term_id, 'ct_cat_top_desc', false, $post_type ); |
|
| 5714 | + $csv_row[] = get_tax_meta($term->term_id, 'ct_cat_top_desc', false, $post_type); |
|
| 5715 | 5715 | $csv_row[] = $cat_image; |
| 5716 | 5716 | $csv_row[] = $cat_icon; |
| 5717 | 5717 | // WPML |
| 5718 | 5718 | if ($is_wpml) {
|
| 5719 | - $csv_row[] = geodir_get_language_for_element( $term->term_id, 'tax_' . $taxonomy ); |
|
| 5719 | + $csv_row[] = geodir_get_language_for_element($term->term_id, 'tax_' . $taxonomy); |
|
| 5720 | 5720 | } |
| 5721 | 5721 | // WPML |
| 5722 | 5722 | |
@@ -5735,7 +5735,7 @@ discard block |
||
| 5735 | 5735 | * @param bool $relative True for relative path & False for absolute path. |
| 5736 | 5736 | * @return string Path to the cache directory. |
| 5737 | 5737 | */ |
| 5738 | -function geodir_path_import_export( $relative = true ) {
|
|
| 5738 | +function geodir_path_import_export($relative = true) {
|
|
| 5739 | 5739 | $upload_dir = wp_upload_dir(); |
| 5740 | 5740 | |
| 5741 | 5741 | return $relative ? $upload_dir['baseurl'] . '/cache' : $upload_dir['basedir'] . '/cache'; |
@@ -5754,8 +5754,8 @@ discard block |
||
| 5754 | 5754 | * @param bool $clear If true then it overwrite data otherwise add rows at the end of file. |
| 5755 | 5755 | * @return bool true if success otherwise false. |
| 5756 | 5756 | */ |
| 5757 | -function geodir_save_csv_data( $file_path, $csv_data = array(), $clear = true ) {
|
|
| 5758 | - if ( empty( $csv_data ) ) {
|
|
| 5757 | +function geodir_save_csv_data($file_path, $csv_data = array(), $clear = true) {
|
|
| 5758 | + if (empty($csv_data)) {
|
|
| 5759 | 5759 | return false; |
| 5760 | 5760 | } |
| 5761 | 5761 | |
@@ -5763,17 +5763,17 @@ discard block |
||
| 5763 | 5763 | |
| 5764 | 5764 | $mode = $clear ? 'w+' : 'a+'; |
| 5765 | 5765 | |
| 5766 | - if ( function_exists( 'fputcsv' ) ) {
|
|
| 5767 | - $file = fopen( $file_path, $mode ); |
|
| 5768 | - foreach( $csv_data as $csv_row ) {
|
|
| 5766 | + if (function_exists('fputcsv')) {
|
|
| 5767 | + $file = fopen($file_path, $mode); |
|
| 5768 | + foreach ($csv_data as $csv_row) {
|
|
| 5769 | 5769 | //$csv_row = array_map( 'utf8_decode', $csv_row ); |
| 5770 | - $write_successful = fputcsv( $file, $csv_row, ",", $enclosure = '"' ); |
|
| 5770 | + $write_successful = fputcsv($file, $csv_row, ",", $enclosure = '"'); |
|
| 5771 | 5771 | } |
| 5772 | - fclose( $file ); |
|
| 5772 | + fclose($file); |
|
| 5773 | 5773 | } else {
|
| 5774 | - foreach( $csv_data as $csv_row ) {
|
|
| 5774 | + foreach ($csv_data as $csv_row) {
|
|
| 5775 | 5775 | //$csv_row = array_map( 'utf8_decode', $csv_row ); |
| 5776 | - $wp_filesystem->put_contents( $file_path, $csv_row ); |
|
| 5776 | + $wp_filesystem->put_contents($file_path, $csv_row); |
|
| 5777 | 5777 | } |
| 5778 | 5778 | } |
| 5779 | 5779 | |
@@ -5791,14 +5791,14 @@ discard block |
||
| 5791 | 5791 | * @param string $file Full path to file. |
| 5792 | 5792 | * @return int No of file rows. |
| 5793 | 5793 | */ |
| 5794 | -function geodir_import_export_line_count( $file ) {
|
|
| 5794 | +function geodir_import_export_line_count($file) {
|
|
| 5795 | 5795 | global $wp_filesystem; |
| 5796 | 5796 | |
| 5797 | - if ( $wp_filesystem->is_file( $file ) && $wp_filesystem->exists( $file ) ) {
|
|
| 5798 | - $contents = $wp_filesystem->get_contents_array( $file ); |
|
| 5797 | + if ($wp_filesystem->is_file($file) && $wp_filesystem->exists($file)) {
|
|
| 5798 | + $contents = $wp_filesystem->get_contents_array($file); |
|
| 5799 | 5799 | |
| 5800 | - if ( !empty( $contents ) && is_array( $contents ) ) {
|
|
| 5801 | - return count( $contents ) - 1; |
|
| 5800 | + if (!empty($contents) && is_array($contents)) {
|
|
| 5801 | + return count($contents) - 1; |
|
| 5802 | 5802 | } |
| 5803 | 5803 | } |
| 5804 | 5804 | |
@@ -5815,11 +5815,11 @@ discard block |
||
| 5815 | 5815 | * @param string $post_type The post type. |
| 5816 | 5816 | * @return object Queried object. |
| 5817 | 5817 | */ |
| 5818 | -function geodir_imex_get_custom_fields( $post_type ) {
|
|
| 5818 | +function geodir_imex_get_custom_fields($post_type) {
|
|
| 5819 | 5819 | global $wpdb; |
| 5820 | 5820 | |
| 5821 | - $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 ) );
|
|
| 5822 | - $rows = $wpdb->get_results( $sql ); |
|
| 5821 | + $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));
|
|
| 5822 | + $rows = $wpdb->get_results($sql); |
|
| 5823 | 5823 | |
| 5824 | 5824 | return $rows; |
| 5825 | 5825 | } |
@@ -5901,9 +5901,9 @@ discard block |
||
| 5901 | 5901 | $post_table = $plugin_prefix . $post_type . '_detail'; |
| 5902 | 5902 | |
| 5903 | 5903 | $query = $wpdb->prepare("SELECT * FROM " . $post_table . " WHERE post_id = %d", array($master_post_id));
|
| 5904 | - $data = (array)$wpdb->get_row($query); |
|
| 5904 | + $data = (array) $wpdb->get_row($query); |
|
| 5905 | 5905 | |
| 5906 | - if ( !empty( $data ) ) {
|
|
| 5906 | + if (!empty($data)) {
|
|
| 5907 | 5907 | $data['post_id'] = $tr_post_id; |
| 5908 | 5908 | unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type . 'category'], $data['overall_rating'], $data['rating_count'], $data['ratings']); |
| 5909 | 5909 | |
@@ -5931,7 +5931,7 @@ discard block |
||
| 5931 | 5931 | global $sitepress, $wpdb; |
| 5932 | 5932 | $post_type = get_post_type($master_post_id); |
| 5933 | 5933 | |
| 5934 | - remove_filter('get_term', array($sitepress,'get_term_adjust_id')); // AVOID filtering to current language
|
|
| 5934 | + remove_filter('get_term', array($sitepress, 'get_term_adjust_id')); // AVOID filtering to current language
|
|
| 5935 | 5935 | |
| 5936 | 5936 | $taxonomies = get_object_taxonomies($post_type); |
| 5937 | 5937 | foreach ($taxonomies as $taxonomy) {
|
@@ -5940,9 +5940,9 @@ discard block |
||
| 5940 | 5940 | |
| 5941 | 5941 | if ($terms) {
|
| 5942 | 5942 | foreach ($terms as $term) {
|
| 5943 | - $tr_id = apply_filters( 'translate_object_id',$term->term_id, $taxonomy, false, $lang); |
|
| 5943 | + $tr_id = apply_filters('translate_object_id', $term->term_id, $taxonomy, false, $lang);
|
|
| 5944 | 5944 | |
| 5945 | - if (!is_null($tr_id)){
|
|
| 5945 | + if (!is_null($tr_id)) {
|
|
| 5946 | 5946 | // not using get_term - unfiltered get_term |
| 5947 | 5947 | $translated_term = $wpdb->get_row($wpdb->prepare("
|
| 5948 | 5948 | 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));
|
@@ -5951,8 +5951,8 @@ discard block |
||
| 5951 | 5951 | } |
| 5952 | 5952 | } |
| 5953 | 5953 | |
| 5954 | - if (!is_taxonomy_hierarchical($taxonomy)){
|
|
| 5955 | - $terms_array = array_unique( array_map( 'intval', $terms_array ) ); |
|
| 5954 | + if (!is_taxonomy_hierarchical($taxonomy)) {
|
|
| 5955 | + $terms_array = array_unique(array_map('intval', $terms_array));
|
|
| 5956 | 5956 | } |
| 5957 | 5957 | |
| 5958 | 5958 | wp_set_post_terms($tr_post_id, $terms_array, $taxonomy); |
@@ -5985,9 +5985,9 @@ discard block |
||
| 5985 | 5985 | $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));
|
| 5986 | 5986 | $post_images = $wpdb->get_results($query); |
| 5987 | 5987 | |
| 5988 | - if ( !empty( $post_images ) ) {
|
|
| 5989 | - foreach ( $post_images as $post_image) {
|
|
| 5990 | - $image_data = (array)$post_image; |
|
| 5988 | + if (!empty($post_images)) {
|
|
| 5989 | + foreach ($post_images as $post_image) {
|
|
| 5990 | + $image_data = (array) $post_image; |
|
| 5991 | 5991 | unset($image_data['ID']); |
| 5992 | 5992 | $image_data['post_id'] = $tr_post_id; |
| 5993 | 5993 | |
@@ -6013,10 +6013,10 @@ discard block |
||
| 6013 | 6013 | * @return array Event data array. |
| 6014 | 6014 | */ |
| 6015 | 6015 | function geodir_imex_get_event_data($post, $gd_post_info) {
|
| 6016 | - $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'] ) ) : ''; |
|
| 6016 | + $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'])) : '';
|
|
| 6017 | 6017 | $event_enddate = $event_date; |
| 6018 | - $starttime = isset( $post['starttime'] ) && $post['starttime'] != '' && $post['starttime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $post['starttime'] ) ) : ''; |
|
| 6019 | - $endtime = isset( $post['endtime'] ) && $post['endtime'] != '' && $post['endtime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $post['endtime'] ) ) : ''; |
|
| 6018 | + $starttime = isset($post['starttime']) && $post['starttime'] != '' && $post['starttime'] != '00:00:00' ? date_i18n('H:i', strtotime($post['starttime'])) : '';
|
|
| 6019 | + $endtime = isset($post['endtime']) && $post['endtime'] != '' && $post['endtime'] != '00:00:00' ? date_i18n('H:i', strtotime($post['endtime'])) : '';
|
|
| 6020 | 6020 | |
| 6021 | 6021 | $is_recurring_event = ''; |
| 6022 | 6022 | $event_duration_days = ''; |
@@ -6034,15 +6034,15 @@ discard block |
||
| 6034 | 6034 | |
| 6035 | 6035 | $recurring_data = isset($gd_post_info->recurring_dates) ? maybe_unserialize($gd_post_info->recurring_dates) : array(); |
| 6036 | 6036 | if (!empty($recurring_data)) {
|
| 6037 | - $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; |
|
| 6038 | - $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; |
|
| 6039 | - $starttime = isset( $recurring_data['starttime'] ) && $recurring_data['starttime'] != '' && $recurring_data['starttime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $recurring_data['starttime'] ) ) : $starttime; |
|
| 6040 | - $endtime = isset( $recurring_data['endtime'] ) && $recurring_data['endtime'] != '' && $recurring_data['endtime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $recurring_data['endtime'] ) ) : $endtime; |
|
| 6037 | + $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;
|
|
| 6038 | + $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;
|
|
| 6039 | + $starttime = isset($recurring_data['starttime']) && $recurring_data['starttime'] != '' && $recurring_data['starttime'] != '00:00:00' ? date_i18n('H:i', strtotime($recurring_data['starttime'])) : $starttime;
|
|
| 6040 | + $endtime = isset($recurring_data['endtime']) && $recurring_data['endtime'] != '' && $recurring_data['endtime'] != '00:00:00' ? date_i18n('H:i', strtotime($recurring_data['endtime'])) : $endtime;
|
|
| 6041 | 6041 | $is_whole_day_event = !empty($recurring_data['all_day']) ? 1 : ''; |
| 6042 | 6042 | $different_times = !empty($recurring_data['different_times']) ? true : false; |
| 6043 | 6043 | |
| 6044 | - $recurring_pkg = geodir_event_recurring_pkg( $gd_post_info ); |
|
| 6045 | - $is_recurring = isset( $gd_post_info->is_recurring ) && (int)$gd_post_info->is_recurring == 0 ? false : true; |
|
| 6044 | + $recurring_pkg = geodir_event_recurring_pkg($gd_post_info); |
|
| 6045 | + $is_recurring = isset($gd_post_info->is_recurring) && (int) $gd_post_info->is_recurring == 0 ? false : true; |
|
| 6046 | 6046 | |
| 6047 | 6047 | if ($recurring_pkg && $is_recurring) {
|
| 6048 | 6048 | $recurring_dates = $event_date; |
@@ -6052,13 +6052,13 @@ discard block |
||
| 6052 | 6052 | $recurring_type = !empty($recurring_data['repeat_type']) && in_array($recurring_data['repeat_type'], array('day', 'week', 'month', 'year', 'custom')) ? $recurring_data['repeat_type'] : 'custom';
|
| 6053 | 6053 | |
| 6054 | 6054 | if (!empty($recurring_data['event_recurring_dates'])) {
|
| 6055 | - $event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] ); |
|
| 6055 | + $event_recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
|
|
| 6056 | 6056 | |
| 6057 | 6057 | if (!empty($event_recurring_dates)) {
|
| 6058 | 6058 | $recurring_dates = array(); |
| 6059 | 6059 | |
| 6060 | 6060 | foreach ($event_recurring_dates as $date) {
|
| 6061 | - $recurring_dates[] = date_i18n( 'd/m/Y', strtotime( $date ) ); |
|
| 6061 | + $recurring_dates[] = date_i18n('d/m/Y', strtotime($date));
|
|
| 6062 | 6062 | } |
| 6063 | 6063 | |
| 6064 | 6064 | $recurring_dates = implode(",", $recurring_dates);
|
@@ -6074,7 +6074,7 @@ discard block |
||
| 6074 | 6074 | $times = array(); |
| 6075 | 6075 | |
| 6076 | 6076 | foreach ($recurring_data['starttimes'] as $time) {
|
| 6077 | - $times[] = $time != '00:00:00' ? date_i18n( 'H:i', strtotime( $time ) ) : '00:00'; |
|
| 6077 | + $times[] = $time != '00:00:00' ? date_i18n('H:i', strtotime($time)) : '00:00';
|
|
| 6078 | 6078 | } |
| 6079 | 6079 | |
| 6080 | 6080 | $event_starttimes = implode(",", $times);
|
@@ -6084,7 +6084,7 @@ discard block |
||
| 6084 | 6084 | $times = array(); |
| 6085 | 6085 | |
| 6086 | 6086 | foreach ($recurring_data['endtimes'] as $time) {
|
| 6087 | - $times[] = $time != '00:00:00' ? date_i18n( 'H:i', strtotime( $time ) ) : '00:00'; |
|
| 6087 | + $times[] = $time != '00:00:00' ? date_i18n('H:i', strtotime($time)) : '00:00';
|
|
| 6088 | 6088 | } |
| 6089 | 6089 | |
| 6090 | 6090 | $event_endtimes = implode(",", $times);
|
@@ -6096,8 +6096,8 @@ discard block |
||
| 6096 | 6096 | } |
| 6097 | 6097 | } |
| 6098 | 6098 | } else {
|
| 6099 | - $event_duration_days = isset($recurring_data['duration_x']) ? (int)$recurring_data['duration_x'] : 1; |
|
| 6100 | - $recurring_interval = !empty($recurring_data['repeat_x']) && (int)$recurring_data['repeat_x'] > 0 ? $recurring_data['repeat_x'] : 1; |
|
| 6099 | + $event_duration_days = isset($recurring_data['duration_x']) ? (int) $recurring_data['duration_x'] : 1; |
|
| 6100 | + $recurring_interval = !empty($recurring_data['repeat_x']) && (int) $recurring_data['repeat_x'] > 0 ? $recurring_data['repeat_x'] : 1; |
|
| 6101 | 6101 | |
| 6102 | 6102 | if (($recurring_type == 'week' || $recurring_type == 'month') && !empty($recurring_data['repeat_days'])) {
|
| 6103 | 6103 | $week_days = array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
|
@@ -6113,11 +6113,11 @@ discard block |
||
| 6113 | 6113 | } |
| 6114 | 6114 | |
| 6115 | 6115 | $recurring_week_nos = $recurring_type == 'month' && !empty($recurring_data['repeat_weeks']) ? implode(",", $recurring_data['repeat_weeks']) : $recurring_week_nos;
|
| 6116 | - if (!empty($recurring_data['repeat_end_type']) && (int)$recurring_data['repeat_end_type'] == 1) {
|
|
| 6117 | - $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'] ) ) : ''; |
|
| 6116 | + if (!empty($recurring_data['repeat_end_type']) && (int) $recurring_data['repeat_end_type'] == 1) {
|
|
| 6117 | + $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'])) : '';
|
|
| 6118 | 6118 | $max_recurring_count = empty($recurring_end_date) ? 1 : ''; |
| 6119 | 6119 | } else {
|
| 6120 | - $max_recurring_count = (!empty($recurring_data['max_repeat']) && (int)$recurring_data['max_repeat'] > 0 ? (int)$recurring_data['max_repeat'] : 1); |
|
| 6120 | + $max_recurring_count = (!empty($recurring_data['max_repeat']) && (int) $recurring_data['max_repeat'] > 0 ? (int) $recurring_data['max_repeat'] : 1); |
|
| 6121 | 6121 | } |
| 6122 | 6122 | } |
| 6123 | 6123 | } |
@@ -6181,9 +6181,9 @@ discard block |
||
| 6181 | 6181 | * @return array Event data array. |
| 6182 | 6182 | */ |
| 6183 | 6183 | function geodir_imex_process_event_data($gd_post) {
|
| 6184 | - $recurring_pkg = geodir_event_recurring_pkg( (object)$gd_post ); |
|
| 6184 | + $recurring_pkg = geodir_event_recurring_pkg((object) $gd_post); |
|
| 6185 | 6185 | |
| 6186 | - $is_recurring = isset( $gd_post['is_recurring_event'] ) && (int)$gd_post['is_recurring_event'] == 0 ? false : true; |
|
| 6186 | + $is_recurring = isset($gd_post['is_recurring_event']) && (int) $gd_post['is_recurring_event'] == 0 ? false : true; |
|
| 6187 | 6187 | $event_date = isset($gd_post['event_date']) && $gd_post['event_date'] != '' ? geodir_imex_get_date_ymd($gd_post['event_date']) : ''; |
| 6188 | 6188 | $event_enddate = isset($gd_post['event_enddate']) && $gd_post['event_enddate'] != '' ? geodir_imex_get_date_ymd($gd_post['event_enddate']) : $event_date; |
| 6189 | 6189 | $all_day = isset($gd_post['is_whole_day_event']) && !empty($gd_post['is_whole_day_event']) ? true : false; |
@@ -6230,17 +6230,17 @@ discard block |
||
| 6230 | 6230 | $event_recurring_dates = implode(",", $event_recurring_dates);
|
| 6231 | 6231 | } |
| 6232 | 6232 | } else {
|
| 6233 | - $duration_x = !empty( $gd_post['event_duration_days'] ) ? (int)$gd_post['event_duration_days'] : 1; |
|
| 6234 | - $repeat_x = !empty( $gd_post['recurring_interval'] ) ? (int)$gd_post['recurring_interval'] : 1; |
|
| 6235 | - $max_repeat = !empty( $gd_post['max_recurring_count'] ) ? (int)$gd_post['max_recurring_count'] : 1; |
|
| 6236 | - $repeat_end = !empty( $gd_post['recurring_end_date'] ) ? geodir_imex_get_date_ymd($gd_post['recurring_end_date']) : ''; |
|
| 6233 | + $duration_x = !empty($gd_post['event_duration_days']) ? (int) $gd_post['event_duration_days'] : 1; |
|
| 6234 | + $repeat_x = !empty($gd_post['recurring_interval']) ? (int) $gd_post['recurring_interval'] : 1; |
|
| 6235 | + $max_repeat = !empty($gd_post['max_recurring_count']) ? (int) $gd_post['max_recurring_count'] : 1; |
|
| 6236 | + $repeat_end = !empty($gd_post['recurring_end_date']) ? geodir_imex_get_date_ymd($gd_post['recurring_end_date']) : ''; |
|
| 6237 | 6237 | |
| 6238 | 6238 | $repeat_end_type = $repeat_end != '' ? 1 : 0; |
| 6239 | 6239 | $max_repeat = $repeat_end != '' ? '' : $max_repeat; |
| 6240 | 6240 | |
| 6241 | 6241 | $week_days = array_flip(array('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'));
|
| 6242 | 6242 | |
| 6243 | - $a_repeat_days = isset($gd_post['recurring_week_days']) && trim($gd_post['recurring_week_days'])!='' ? explode(',', trim($gd_post['recurring_week_days'])) : array();
|
|
| 6243 | + $a_repeat_days = isset($gd_post['recurring_week_days']) && trim($gd_post['recurring_week_days']) != '' ? explode(',', trim($gd_post['recurring_week_days'])) : array();
|
|
| 6244 | 6244 | $repeat_days = array(); |
| 6245 | 6245 | if (!empty($a_repeat_days)) {
|
| 6246 | 6246 | foreach ($a_repeat_days as $repeat_day) {
|
@@ -6258,7 +6258,7 @@ discard block |
||
| 6258 | 6258 | $repeat_weeks = array(); |
| 6259 | 6259 | if (!empty($a_repeat_weeks)) {
|
| 6260 | 6260 | foreach ($a_repeat_weeks as $repeat_week) {
|
| 6261 | - $repeat_weeks[] = (int)$repeat_week; |
|
| 6261 | + $repeat_weeks[] = (int) $repeat_week; |
|
| 6262 | 6262 | } |
| 6263 | 6263 | |
| 6264 | 6264 | $repeat_weeks = array_unique($repeat_weeks); |
@@ -6377,7 +6377,7 @@ discard block |
||
| 6377 | 6377 | */ |
| 6378 | 6378 | function geodir_admin_upgrade_notice() {
|
| 6379 | 6379 | $class = "error"; |
| 6380 | - $message = __("Please update core GeoDirectory or some addons may not function correctly.","geodirectory");
|
|
| 6380 | + $message = __("Please update core GeoDirectory or some addons may not function correctly.", "geodirectory");
|
|
| 6381 | 6381 | echo"<div class=\"$class\"> <p>$message</p></div>"; |
| 6382 | 6382 | } |
| 6383 | 6383 | |
@@ -6389,7 +6389,7 @@ discard block |
||
| 6389 | 6389 | * @param (object) $r |
| 6390 | 6390 | * @return (string) $output |
| 6391 | 6391 | */ |
| 6392 | -function geodire_admin_upgrade_notice( $plugin_data, $r ) |
|
| 6392 | +function geodire_admin_upgrade_notice($plugin_data, $r) |
|
| 6393 | 6393 | {
|
| 6394 | 6394 | // readme contents |
| 6395 | 6395 | $args = array( |
@@ -6397,7 +6397,7 @@ discard block |
||
| 6397 | 6397 | 'redirection' => 5 |
| 6398 | 6398 | ); |
| 6399 | 6399 | $url = "http://plugins.svn.wordpress.org/geodirectory/trunk/readme.txt"; |
| 6400 | - $data = wp_remote_get( $url, $args ); |
|
| 6400 | + $data = wp_remote_get($url, $args); |
|
| 6401 | 6401 | |
| 6402 | 6402 | if (!is_wp_error($data) && $data['response']['code'] == 200) {
|
| 6403 | 6403 | |
@@ -6412,20 +6412,20 @@ discard block |
||
| 6412 | 6412 | function geodir_in_plugin_update_message($content) {
|
| 6413 | 6413 | // Output Upgrade Notice |
| 6414 | 6414 | $matches = null; |
| 6415 | - $regexp = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( GEODIRECTORY_VERSION ) . '\s*=|$)~Uis'; |
|
| 6415 | + $regexp = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote(GEODIRECTORY_VERSION) . '\s*=|$)~Uis'; |
|
| 6416 | 6416 | $upgrade_notice = ''; |
| 6417 | - if ( preg_match( $regexp, $content, $matches ) ) {
|
|
| 6418 | - if(empty($matches)){return;}
|
|
| 6417 | + if (preg_match($regexp, $content, $matches)) {
|
|
| 6418 | + if (empty($matches)) {return; }
|
|
| 6419 | 6419 | |
| 6420 | - $version = trim( $matches[1] ); |
|
| 6421 | - if($version && $version>GEODIRECTORY_VERSION){
|
|
| 6420 | + $version = trim($matches[1]); |
|
| 6421 | + if ($version && $version > GEODIRECTORY_VERSION) {
|
|
| 6422 | 6422 | |
| 6423 | 6423 | |
| 6424 | - $notices = (array) preg_split('~[\r\n]+~', trim( $matches[2] ) );
|
|
| 6425 | - if ( version_compare( GEODIRECTORY_VERSION, $version, '<' ) ) {
|
|
| 6424 | + $notices = (array) preg_split('~[\r\n]+~', trim($matches[2]));
|
|
| 6425 | + if (version_compare(GEODIRECTORY_VERSION, $version, '<')) {
|
|
| 6426 | 6426 | $upgrade_notice .= '<div class="geodir_plugin_upgrade_notice">'; |
| 6427 | - foreach ( $notices as $index => $line ) {
|
|
| 6428 | - $upgrade_notice .= wp_kses_post( preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line ) );
|
|
| 6427 | + foreach ($notices as $index => $line) {
|
|
| 6428 | + $upgrade_notice .= wp_kses_post(preg_replace('~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line));
|
|
| 6429 | 6429 | } |
| 6430 | 6430 | $upgrade_notice .= '</div> '; |
| 6431 | 6431 | } |
@@ -6449,7 +6449,7 @@ discard block |
||
| 6449 | 6449 | $default_language = $sitepress->get_default_language(); |
| 6450 | 6450 | if ($current_language != 'all' && $current_language != $default_language) {
|
| 6451 | 6451 | ?> |
| 6452 | - <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>
|
|
| 6452 | + <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>
|
|
| 6453 | 6453 | <?php |
| 6454 | 6454 | } |
| 6455 | 6455 | } |